Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo-mod-jslibs-dist.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-04-22 16:31:00 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-04-22 16:31:00 +0300
commit99f542f0c2fb665466c4e1ec3d11713d086d31cf (patch)
tree731939e84bf91aa3890881531047b50dfac9401f
parent9963fae47a8a1e8a9de80e4623ddbb806a865cdc (diff)
Update to Alpine 3.10.2alpinejs/v3.21000.20200
-rw-r--r--alpinejs/packages/alpinejs/dist/cdn.js105
-rw-r--r--alpinejs/packages/alpinejs/dist/cdn.min.js4
-rw-r--r--alpinejs/packages/alpinejs/dist/module.cjs.js105
-rw-r--r--alpinejs/packages/alpinejs/dist/module.esm.js2115
-rw-r--r--alpinejs/packages/alpinejs/package.json2
-rw-r--r--alpinejs/packages/alpinejs/src/alpine.js3
-rw-r--r--alpinejs/packages/alpinejs/src/directives.js1
-rw-r--r--alpinejs/packages/alpinejs/src/directives/index.js13
-rw-r--r--alpinejs/packages/alpinejs/src/directives/x-data.js2
-rw-r--r--alpinejs/packages/alpinejs/src/directives/x-html.js10
-rw-r--r--alpinejs/packages/alpinejs/src/directives/x-model.js13
-rw-r--r--alpinejs/packages/alpinejs/src/directives/x-modelable.js12
-rw-r--r--alpinejs/packages/alpinejs/src/directives/x-show.js32
-rw-r--r--alpinejs/packages/alpinejs/src/evaluator.js16
-rw-r--r--alpinejs/packages/alpinejs/src/magics/$watch.js8
-rw-r--r--alpinejs/packages/alpinejs/src/magics/index.js11
-rw-r--r--alpinejs/packages/alpinejs/src/nextTick.js19
-rw-r--r--alpinejs/packages/alpinejs/src/reactivity.js2
-rw-r--r--alpinejs/packages/alpinejs/src/utils/on.js18
-rw-r--r--alpinejs/packages/collapse/dist/cdn.js31
-rw-r--r--alpinejs/packages/collapse/dist/cdn.min.js2
-rw-r--r--alpinejs/packages/collapse/dist/module.cjs.js31
-rw-r--r--alpinejs/packages/collapse/dist/module.esm.js31
-rw-r--r--alpinejs/packages/collapse/package.json2
-rw-r--r--alpinejs/packages/collapse/src/index.js32
-rw-r--r--alpinejs/packages/csp/dist/cdn.js105
-rw-r--r--alpinejs/packages/csp/dist/cdn.min.js4
-rw-r--r--alpinejs/packages/csp/dist/module.cjs.js105
-rw-r--r--alpinejs/packages/csp/dist/module.esm.js2115
-rw-r--r--alpinejs/packages/docs/package.json2
-rw-r--r--alpinejs/packages/docs/src/en/directives/bind.md3
-rw-r--r--alpinejs/packages/docs/src/en/directives/for.md2
-rw-r--r--alpinejs/packages/docs/src/en/directives/model.md2
-rw-r--r--alpinejs/packages/docs/src/en/directives/modelable.md7
-rw-r--r--alpinejs/packages/docs/src/en/directives/on.md5
-rw-r--r--alpinejs/packages/docs/src/en/directives/teleport.md2
-rw-r--r--alpinejs/packages/docs/src/en/directives/transition.md6
-rw-r--r--alpinejs/packages/docs/src/en/essentials/installation.md2
-rw-r--r--alpinejs/packages/docs/src/en/essentials/state.md2
-rw-r--r--alpinejs/packages/docs/src/en/magics/id.md2
-rw-r--r--alpinejs/packages/docs/src/en/magics/nextTick.md19
-rw-r--r--alpinejs/packages/docs/src/en/magics/store.md2
-rw-r--r--alpinejs/packages/docs/src/en/plugins/collapse.md29
-rw-r--r--alpinejs/packages/docs/src/en/plugins/focus.md4
-rw-r--r--alpinejs/packages/docs/src/en/plugins/intersect.md23
-rw-r--r--alpinejs/packages/docs/src/en/plugins/mask.md157
-rw-r--r--alpinejs/packages/docs/src/en/plugins/morph.md4
-rw-r--r--alpinejs/packages/docs/src/en/upgrade-guide.md2
-rw-r--r--alpinejs/packages/focus/dist/module.esm.js1172
-rw-r--r--alpinejs/packages/focus/package.json2
-rw-r--r--alpinejs/packages/intersect/dist/cdn.js9
-rw-r--r--alpinejs/packages/intersect/dist/cdn.min.js2
-rw-r--r--alpinejs/packages/intersect/dist/module.cjs.js9
-rw-r--r--alpinejs/packages/intersect/dist/module.esm.js9
-rw-r--r--alpinejs/packages/intersect/package.json2
-rw-r--r--alpinejs/packages/intersect/src/index.js8
-rw-r--r--alpinejs/packages/mask/builds/cdn.js5
-rw-r--r--alpinejs/packages/mask/builds/module.js5
-rw-r--r--alpinejs/packages/mask/dist/cdn.js150
-rw-r--r--alpinejs/packages/mask/dist/cdn.min.js1
-rw-r--r--alpinejs/packages/mask/dist/module.cjs.js160
-rw-r--r--alpinejs/packages/mask/dist/module.esm.js150
-rw-r--r--alpinejs/packages/mask/package.json9
-rw-r--r--alpinejs/packages/mask/src/index.js202
-rw-r--r--alpinejs/packages/morph/dist/cdn.js513
-rw-r--r--alpinejs/packages/morph/dist/cdn.min.js4
-rw-r--r--alpinejs/packages/morph/dist/module.cjs.js525
-rw-r--r--alpinejs/packages/morph/dist/module.esm.js513
-rw-r--r--alpinejs/packages/morph/package.json2
-rw-r--r--alpinejs/packages/morph/src/dom.js66
-rw-r--r--alpinejs/packages/morph/src/morph.js557
-rw-r--r--alpinejs/packages/persist/package.json2
-rw-r--r--alpinejs/packages/trap/dist/cdn.js700
-rw-r--r--alpinejs/packages/trap/dist/cdn.min.js9
-rw-r--r--alpinejs/packages/trap/dist/module.cjs.js762
-rw-r--r--alpinejs/packages/trap/dist/module.esm.js755
76 files changed, 4741 insertions, 6786 deletions
diff --git a/alpinejs/packages/alpinejs/dist/cdn.js b/alpinejs/packages/alpinejs/dist/cdn.js
index 4ba2177..aeca34f 100644
--- a/alpinejs/packages/alpinejs/dist/cdn.js
+++ b/alpinejs/packages/alpinejs/dist/cdn.js
@@ -76,6 +76,7 @@
el._x_effects.delete(effectReference);
release(effectReference);
};
+ return effectReference;
};
return [wrappedEffect, () => {
cleanup2();
@@ -427,6 +428,13 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
}
// packages/alpinejs/src/evaluator.js
+ var shouldAutoEvaluateFunctions = true;
+ function dontAutoEvaluateFunctions(callback) {
+ let cache = shouldAutoEvaluateFunctions;
+ shouldAutoEvaluateFunctions = false;
+ callback();
+ shouldAutoEvaluateFunctions = cache;
+ }
function evaluate(el, expression, extras = {}) {
let result;
evaluateLater(el, expression)((value) => result = value, extras);
@@ -498,7 +506,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
};
}
function runIfTypeOfFunction(receiver, value, scope2, params, el) {
- if (typeof value === "function") {
+ if (shouldAutoEvaluateFunctions && typeof value === "function") {
let result = value.apply(scope2, params);
if (result instanceof Promise) {
result.then((i) => runIfTypeOfFunction(receiver, i, scope2, params)).catch((error2) => handleError(error2, el, value));
@@ -632,6 +640,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
"bind",
"init",
"for",
+ "mask",
"model",
"modelable",
"transition",
@@ -660,13 +669,19 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
// packages/alpinejs/src/nextTick.js
var tickStack = [];
var isHolding = false;
- function nextTick(callback) {
- tickStack.push(callback);
+ function nextTick(callback = () => {
+ }) {
queueMicrotask(() => {
isHolding || setTimeout(() => {
releaseNextTicks();
});
});
+ return new Promise((res) => {
+ tickStack.push(() => {
+ callback();
+ res();
+ });
+ });
}
function releaseNextTicks() {
isHolding = false;
@@ -1414,8 +1429,9 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
get raw() {
return raw;
},
- version: "3.9.1",
+ version: "3.10.2",
flushAndStopDeferringMutations,
+ dontAutoEvaluateFunctions,
disableEffectScheduling,
stopObservingMutations,
destroyTree,
@@ -2146,7 +2162,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
let evaluate2 = evaluateLater2(key);
let firstTime = true;
let oldValue;
- effect3(() => evaluate2((value) => {
+ let effectReference = effect3(() => evaluate2((value) => {
JSON.stringify(value);
if (!firstTime) {
queueMicrotask(() => {
@@ -2158,6 +2174,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
}
firstTime = false;
}));
+ el._x_effects.delete(effectReference);
});
// packages/alpinejs/src/magics/$store.js
@@ -2217,8 +2234,15 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
// packages/alpinejs/src/magics/$el.js
magic("el", (el) => el);
+ // packages/alpinejs/src/magics/index.js
+ warnMissingPluginMagic("Focus", "focus", "focus");
+ warnMissingPluginMagic("Persist", "persist", "persist");
+ function warnMissingPluginMagic(name, magicName, slug) {
+ magic(magicName, (el) => warn(`You can't use [$${directiveName}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el));
+ }
+
// packages/alpinejs/src/directives/x-modelable.js
- directive("modelable", (el, {expression}, {effect: effect3, evaluate: evaluate2, evaluateLater: evaluateLater2}) => {
+ directive("modelable", (el, {expression}, {effect: effect3, evaluateLater: evaluateLater2}) => {
let func = evaluateLater2(expression);
let innerGet = () => {
let result;
@@ -2229,12 +2253,11 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
let innerSet = (val) => evaluateInnerSet(() => {
}, {scope: {__placeholder: val}});
let initialValue = innerGet();
- if (el._x_modelable_hook)
- initialValue = el._x_modelable_hook(initialValue);
innerSet(initialValue);
queueMicrotask(() => {
if (!el._x_model)
return;
+ el._x_removeModelListeners["default"]();
let outerGet = el._x_model.get;
let outerSet = el._x_model.set;
effect3(() => innerSet(outerGet()));
@@ -2320,6 +2343,8 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
handler3 = wrapHandler(handler3, (next, e) => {
if (el.contains(e.target))
return;
+ if (e.target.isConnected === false)
+ return;
if (el.offsetWidth < 1 && el.offsetHeight < 1)
return;
if (el._x_isShown === false)
@@ -2327,6 +2352,12 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
next(e);
});
}
+ if (modifiers.includes("once")) {
+ handler3 = wrapHandler(handler3, (next, e) => {
+ next(e);
+ listenerTarget.removeEventListener(event, handler3, options);
+ });
+ }
handler3 = wrapHandler(handler3, (next, e) => {
if (isKeyEvent(event)) {
if (isListeningForASpecificKeyThatHasntBeenPressed(e, modifiers)) {
@@ -2345,12 +2376,6 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
let wait = isNumeric(nextModifier.split("ms")[0]) ? Number(nextModifier.split("ms")[0]) : 250;
handler3 = throttle(handler3, wait);
}
- if (modifiers.includes("once")) {
- handler3 = wrapHandler(handler3, (next, e) => {
- next(e);
- listenerTarget.removeEventListener(event, handler3, options);
- });
- }
listenerTarget.addEventListener(event, handler3, options);
return () => {
listenerTarget.removeEventListener(event, handler3, options);
@@ -2438,7 +2463,10 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
rightSideOfExpression: assigmentFunction
}});
});
- cleanup2(() => removeListener());
+ if (!el._x_removeModelListeners)
+ el._x_removeModelListeners = {};
+ el._x_removeModelListeners["default"] = removeListener;
+ cleanup2(() => el._x_removeModelListeners["default"]());
let evaluateSetModel = evaluateLater(el, `${expression} = __placeholder`);
el._x_model = {
get() {
@@ -2538,7 +2566,12 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
let evaluate2 = evaluateLater2(expression);
effect3(() => {
evaluate2((value) => {
- el.innerHTML = value;
+ mutateDom(() => {
+ el.innerHTML = value;
+ el._x_ignoreSelf = true;
+ initTree(el);
+ delete el._x_ignoreSelf;
+ });
});
});
});
@@ -2608,24 +2641,35 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
cleanup1();
cleanup22();
reactiveData["destroy"] && evaluate(el, reactiveData["destroy"]);
+ undo();
});
}));
// packages/alpinejs/src/directives/x-show.js
directive("show", (el, {modifiers, expression}, {effect: effect3}) => {
let evaluate2 = evaluateLater(el, expression);
- let hide = () => mutateDom(() => {
- el.style.display = "none";
+ if (!el._x_doHide)
+ el._x_doHide = () => {
+ mutateDom(() => el.style.display = "none");
+ };
+ if (!el._x_doShow)
+ el._x_doShow = () => {
+ mutateDom(() => {
+ if (el.style.length === 1 && el.style.display === "none") {
+ el.removeAttribute("style");
+ } else {
+ el.style.removeProperty("display");
+ }
+ });
+ };
+ let hide = () => {
+ el._x_doHide();
el._x_isShown = false;
- });
- let show = () => mutateDom(() => {
- if (el.style.length === 1 && el.style.display === "none") {
- el.removeAttribute("style");
- } else {
- el.style.removeProperty("display");
- }
+ };
+ let show = () => {
+ el._x_doShow();
el._x_isShown = true;
- });
+ };
let clickAwayCompatibleShow = () => setTimeout(show);
let toggle = once((value) => value ? show() : hide(), (value) => {
if (typeof el._x_toggleAndCascadeWithTransitions === "function") {
@@ -2882,6 +2926,15 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
cleanup2(() => removeListener());
}));
+ // packages/alpinejs/src/directives/index.js
+ warnMissingPluginDirective("Collapse", "collapse", "collapse");
+ warnMissingPluginDirective("Intersect", "intersect", "intersect");
+ warnMissingPluginDirective("Focus", "trap", "focus");
+ warnMissingPluginDirective("Mask", "mask", "mask");
+ function warnMissingPluginDirective(name, directiveName2, slug) {
+ directive(directiveName2, (el) => warn(`You can't use [x-${directiveName2}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el));
+ }
+
// packages/alpinejs/src/index.js
alpine_default.setEvaluator(normalEvaluator);
alpine_default.setReactivityEngine({reactive: reactive2, effect: effect2, release: stop, raw: toRaw});
diff --git a/alpinejs/packages/alpinejs/dist/cdn.min.js b/alpinejs/packages/alpinejs/dist/cdn.min.js
index 06be4e5..01f9fcd 100644
--- a/alpinejs/packages/alpinejs/dist/cdn.min.js
+++ b/alpinejs/packages/alpinejs/dist/cdn.min.js
@@ -1,5 +1,5 @@
-(()=>{var Ue=!1,We=!1,F=[];function Dt(e){nn(e)}function nn(e){F.includes(e)||F.push(e),on()}function he(e){let t=F.indexOf(e);t!==-1&&F.splice(t,1)}function on(){!We&&!Ue&&(Ue=!0,queueMicrotask(sn))}function sn(){Ue=!1,We=!0;for(let e=0;e<F.length;e++)F[e]();F.length=0,We=!1}var A,K,Y,Ge,Ye=!0;function $t(e){Ye=!1,e(),Ye=!0}function Lt(e){A=e.reactive,Y=e.release,K=t=>e.effect(t,{scheduler:r=>{Ye?Dt(r):r()}}),Ge=e.raw}function Je(e){K=e}function jt(e){let t=()=>{};return[n=>{let i=K(n);e._x_effects||(e._x_effects=new Set,e._x_runEffects=()=>{e._x_effects.forEach(o=>o())}),e._x_effects.add(i),t=()=>{i!==void 0&&(e._x_effects.delete(i),Y(i))}},()=>{t()}]}var Ft=[],Kt=[],Bt=[];function zt(e){Bt.push(e)}function _e(e,t){typeof t=="function"?(e._x_cleanups||(e._x_cleanups=[]),e._x_cleanups.push(t)):(t=e,Kt.push(t))}function Vt(e){Ft.push(e)}function ge(e,t,r){e._x_attributeCleanups||(e._x_attributeCleanups={}),e._x_attributeCleanups[t]||(e._x_attributeCleanups[t]=[]),e._x_attributeCleanups[t].push(r)}function Ze(e,t){!e._x_attributeCleanups||Object.entries(e._x_attributeCleanups).forEach(([r,n])=>{(t===void 0||t.includes(r))&&(n.forEach(i=>i()),delete e._x_attributeCleanups[r])})}var Xe=new MutationObserver(Qe),et=!1;function tt(){Xe.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0}),et=!0}function rt(){an(),Xe.disconnect(),et=!1}var te=[],nt=!1;function an(){te=te.concat(Xe.takeRecords()),te.length&&!nt&&(nt=!0,queueMicrotask(()=>{cn(),nt=!1}))}function cn(){Qe(te),te.length=0}function m(e){if(!et)return e();rt();let t=e();return tt(),t}var it=!1,xe=[];function Ht(){it=!0}function qt(){it=!1,Qe(xe),xe=[]}function Qe(e){if(it){xe=xe.concat(e);return}let t=[],r=[],n=new Map,i=new Map;for(let o=0;o<e.length;o++)if(!e[o].target._x_ignoreMutationObserver&&(e[o].type==="childList"&&(e[o].addedNodes.forEach(s=>s.nodeType===1&&t.push(s)),e[o].removedNodes.forEach(s=>s.nodeType===1&&r.push(s))),e[o].type==="attributes")){let s=e[o].target,a=e[o].attributeName,c=e[o].oldValue,l=()=>{n.has(s)||n.set(s,[]),n.get(s).push({name:a,value:s.getAttribute(a)})},u=()=>{i.has(s)||i.set(s,[]),i.get(s).push(a)};s.hasAttribute(a)&&c===null?l():s.hasAttribute(a)?(u(),l()):u()}i.forEach((o,s)=>{Ze(s,o)}),n.forEach((o,s)=>{Ft.forEach(a=>a(s,o))});for(let o of r)if(!t.includes(o)&&(Kt.forEach(s=>s(o)),o._x_cleanups))for(;o._x_cleanups.length;)o._x_cleanups.pop()();t.forEach(o=>{o._x_ignoreSelf=!0,o._x_ignore=!0});for(let o of t)r.includes(o)||!o.isConnected||(delete o._x_ignoreSelf,delete o._x_ignore,Bt.forEach(s=>s(o)),o._x_ignore=!0,o._x_ignoreSelf=!0);t.forEach(o=>{delete o._x_ignoreSelf,delete o._x_ignore}),t=null,r=null,n=null,i=null}function ye(e){return I(k(e))}function T(e,t,r){return e._x_dataStack=[t,...k(r||e)],()=>{e._x_dataStack=e._x_dataStack.filter(n=>n!==t)}}function ot(e,t){let r=e._x_dataStack[0];Object.entries(t).forEach(([n,i])=>{r[n]=i})}function k(e){return e._x_dataStack?e._x_dataStack:typeof ShadowRoot=="function"&&e instanceof ShadowRoot?k(e.host):e.parentNode?k(e.parentNode):[]}function I(e){let t=new Proxy({},{ownKeys:()=>Array.from(new Set(e.flatMap(r=>Object.keys(r)))),has:(r,n)=>e.some(i=>i.hasOwnProperty(n)),get:(r,n)=>(e.find(i=>{if(i.hasOwnProperty(n)){let o=Object.getOwnPropertyDescriptor(i,n);if(o.get&&o.get._x_alreadyBound||o.set&&o.set._x_alreadyBound)return!0;if((o.get||o.set)&&o.enumerable){let s=o.get,a=o.set,c=o;s=s&&s.bind(t),a=a&&a.bind(t),s&&(s._x_alreadyBound=!0),a&&(a._x_alreadyBound=!0),Object.defineProperty(i,n,{...c,get:s,set:a})}return!0}return!1})||{})[n],set:(r,n,i)=>{let o=e.find(s=>s.hasOwnProperty(n));return o?o[n]=i:e[e.length-1][n]=i,!0}});return t}function be(e){let t=n=>typeof n=="object"&&!Array.isArray(n)&&n!==null,r=(n,i="")=>{Object.entries(Object.getOwnPropertyDescriptors(n)).forEach(([o,{value:s,enumerable:a}])=>{if(a===!1||s===void 0)return;let c=i===""?o:`${i}.${o}`;typeof s=="object"&&s!==null&&s._x_interceptor?n[o]=s.initialize(e,c,o):t(s)&&s!==n&&!(s instanceof Element)&&r(s,c)})};return r(e)}function ve(e,t=()=>{}){let r={initialValue:void 0,_x_interceptor:!0,initialize(n,i,o){return e(this.initialValue,()=>ln(n,i),s=>st(n,i,s),i,o)}};return t(r),n=>{if(typeof n=="object"&&n!==null&&n._x_interceptor){let i=r.initialize.bind(r);r.initialize=(o,s,a)=>{let c=n.initialize(o,s,a);return r.initialValue=c,i(o,s,a)}}else r.initialValue=n;return r}}function ln(e,t){return t.split(".").reduce((r,n)=>r[n],e)}function st(e,t,r){if(typeof t=="string"&&(t=t.split(".")),t.length===1)e[t[0]]=r;else{if(t.length===0)throw error;return e[t[0]]||(e[t[0]]={}),st(e[t[0]],t.slice(1),r)}}var Ut={};function y(e,t){Ut[e]=t}function re(e,t){return Object.entries(Ut).forEach(([r,n])=>{Object.defineProperty(e,`$${r}`,{get(){let[i,o]=at(t);return i={interceptor:ve,...i},_e(t,o),n(t,i)},enumerable:!1})}),{obj:e,cleanup:()=>{t=null}}}function Wt(e,t,r,...n){try{return r(...n)}catch(i){J(i,e,t)}}function J(e,t,r=void 0){Object.assign(e,{el:t,expression:r}),console.warn(`Alpine Expression Error: ${e.message}
+(()=>{var Ge=!1,Ye=!1,K=[];function Lt(e){cn(e)}function cn(e){K.includes(e)||K.push(e),ln()}function he(e){let t=K.indexOf(e);t!==-1&&K.splice(t,1)}function ln(){!Ye&&!Ge&&(Ge=!0,queueMicrotask(un))}function un(){Ge=!1,Ye=!0;for(let e=0;e<K.length;e++)K[e]();K.length=0,Ye=!1}var A,B,Y,Je,Ze=!0;function Ft(e){Ze=!1,e(),Ze=!0}function jt(e){A=e.reactive,Y=e.release,B=t=>e.effect(t,{scheduler:r=>{Ze?Lt(r):r()}}),Je=e.raw}function Qe(e){B=e}function Kt(e){let t=()=>{};return[n=>{let i=B(n);return e._x_effects||(e._x_effects=new Set,e._x_runEffects=()=>{e._x_effects.forEach(o=>o())}),e._x_effects.add(i),t=()=>{i!==void 0&&(e._x_effects.delete(i),Y(i))},i},()=>{t()}]}var Bt=[],zt=[],Vt=[];function Ht(e){Vt.push(e)}function _e(e,t){typeof t=="function"?(e._x_cleanups||(e._x_cleanups=[]),e._x_cleanups.push(t)):(t=e,zt.push(t))}function qt(e){Bt.push(e)}function ge(e,t,r){e._x_attributeCleanups||(e._x_attributeCleanups={}),e._x_attributeCleanups[t]||(e._x_attributeCleanups[t]=[]),e._x_attributeCleanups[t].push(r)}function Xe(e,t){!e._x_attributeCleanups||Object.entries(e._x_attributeCleanups).forEach(([r,n])=>{(t===void 0||t.includes(r))&&(n.forEach(i=>i()),delete e._x_attributeCleanups[r])})}var tt=new MutationObserver(et),rt=!1;function nt(){tt.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0}),rt=!0}function it(){fn(),tt.disconnect(),rt=!1}var te=[],ot=!1;function fn(){te=te.concat(tt.takeRecords()),te.length&&!ot&&(ot=!0,queueMicrotask(()=>{dn(),ot=!1}))}function dn(){et(te),te.length=0}function m(e){if(!rt)return e();it();let t=e();return nt(),t}var st=!1,xe=[];function Ut(){st=!0}function Wt(){st=!1,et(xe),xe=[]}function et(e){if(st){xe=xe.concat(e);return}let t=[],r=[],n=new Map,i=new Map;for(let o=0;o<e.length;o++)if(!e[o].target._x_ignoreMutationObserver&&(e[o].type==="childList"&&(e[o].addedNodes.forEach(s=>s.nodeType===1&&t.push(s)),e[o].removedNodes.forEach(s=>s.nodeType===1&&r.push(s))),e[o].type==="attributes")){let s=e[o].target,a=e[o].attributeName,c=e[o].oldValue,l=()=>{n.has(s)||n.set(s,[]),n.get(s).push({name:a,value:s.getAttribute(a)})},u=()=>{i.has(s)||i.set(s,[]),i.get(s).push(a)};s.hasAttribute(a)&&c===null?l():s.hasAttribute(a)?(u(),l()):u()}i.forEach((o,s)=>{Xe(s,o)}),n.forEach((o,s)=>{Bt.forEach(a=>a(s,o))});for(let o of r)if(!t.includes(o)&&(zt.forEach(s=>s(o)),o._x_cleanups))for(;o._x_cleanups.length;)o._x_cleanups.pop()();t.forEach(o=>{o._x_ignoreSelf=!0,o._x_ignore=!0});for(let o of t)r.includes(o)||!o.isConnected||(delete o._x_ignoreSelf,delete o._x_ignore,Vt.forEach(s=>s(o)),o._x_ignore=!0,o._x_ignoreSelf=!0);t.forEach(o=>{delete o._x_ignoreSelf,delete o._x_ignore}),t=null,r=null,n=null,i=null}function ye(e){return I(P(e))}function C(e,t,r){return e._x_dataStack=[t,...P(r||e)],()=>{e._x_dataStack=e._x_dataStack.filter(n=>n!==t)}}function at(e,t){let r=e._x_dataStack[0];Object.entries(t).forEach(([n,i])=>{r[n]=i})}function P(e){return e._x_dataStack?e._x_dataStack:typeof ShadowRoot=="function"&&e instanceof ShadowRoot?P(e.host):e.parentNode?P(e.parentNode):[]}function I(e){let t=new Proxy({},{ownKeys:()=>Array.from(new Set(e.flatMap(r=>Object.keys(r)))),has:(r,n)=>e.some(i=>i.hasOwnProperty(n)),get:(r,n)=>(e.find(i=>{if(i.hasOwnProperty(n)){let o=Object.getOwnPropertyDescriptor(i,n);if(o.get&&o.get._x_alreadyBound||o.set&&o.set._x_alreadyBound)return!0;if((o.get||o.set)&&o.enumerable){let s=o.get,a=o.set,c=o;s=s&&s.bind(t),a=a&&a.bind(t),s&&(s._x_alreadyBound=!0),a&&(a._x_alreadyBound=!0),Object.defineProperty(i,n,{...c,get:s,set:a})}return!0}return!1})||{})[n],set:(r,n,i)=>{let o=e.find(s=>s.hasOwnProperty(n));return o?o[n]=i:e[e.length-1][n]=i,!0}});return t}function be(e){let t=n=>typeof n=="object"&&!Array.isArray(n)&&n!==null,r=(n,i="")=>{Object.entries(Object.getOwnPropertyDescriptors(n)).forEach(([o,{value:s,enumerable:a}])=>{if(a===!1||s===void 0)return;let c=i===""?o:`${i}.${o}`;typeof s=="object"&&s!==null&&s._x_interceptor?n[o]=s.initialize(e,c,o):t(s)&&s!==n&&!(s instanceof Element)&&r(s,c)})};return r(e)}function ve(e,t=()=>{}){let r={initialValue:void 0,_x_interceptor:!0,initialize(n,i,o){return e(this.initialValue,()=>pn(n,i),s=>ct(n,i,s),i,o)}};return t(r),n=>{if(typeof n=="object"&&n!==null&&n._x_interceptor){let i=r.initialize.bind(r);r.initialize=(o,s,a)=>{let c=n.initialize(o,s,a);return r.initialValue=c,i(o,s,a)}}else r.initialValue=n;return r}}function pn(e,t){return t.split(".").reduce((r,n)=>r[n],e)}function ct(e,t,r){if(typeof t=="string"&&(t=t.split(".")),t.length===1)e[t[0]]=r;else{if(t.length===0)throw error;return e[t[0]]||(e[t[0]]={}),ct(e[t[0]],t.slice(1),r)}}var Gt={};function x(e,t){Gt[e]=t}function re(e,t){return Object.entries(Gt).forEach(([r,n])=>{Object.defineProperty(e,`$${r}`,{get(){let[i,o]=lt(t);return i={interceptor:ve,...i},_e(t,o),n(t,i)},enumerable:!1})}),{obj:e,cleanup:()=>{t=null}}}function Yt(e,t,r,...n){try{return r(...n)}catch(i){J(i,e,t)}}function J(e,t,r=void 0){Object.assign(e,{el:t,expression:r}),console.warn(`Alpine Expression Error: ${e.message}
${r?'Expression: "'+r+`"
-`:""}`,t),setTimeout(()=>{throw e},0)}function N(e,t,r={}){let n;return g(e,t)(i=>n=i,r),n}function g(...e){return Gt(...e)}var Gt=ct;function Yt(e){Gt=e}function ct(e,t){let r={},n=re(r,e).cleanup;ge(e,"evaluator",n);let i=[r,...k(e)];if(typeof t=="function")return un(i,t);let o=fn(i,t,e);return Wt.bind(null,e,t,o)}function un(e,t){return(r=()=>{},{scope:n={},params:i=[]}={})=>{let o=t.apply(I([n,...e]),i);we(r,o)}}var lt={};function dn(e,t){if(lt[e])return lt[e];let r=Object.getPrototypeOf(async function(){}).constructor,n=/^[\n\s]*if.*\(.*\)/.test(e)||/^(let|const)\s/.test(e)?`(() => { ${e} })()`:e,o=(()=>{try{return new r(["__self","scope"],`with (scope) { __self.result = ${n} }; __self.finished = true; return __self.result;`)}catch(s){return J(s,t,e),Promise.resolve()}})();return lt[e]=o,o}function fn(e,t,r){let n=dn(t,r);return(i=()=>{},{scope:o={},params:s=[]}={})=>{n.result=void 0,n.finished=!1;let a=I([o,...e]);if(typeof n=="function"){let c=n(n,a).catch(l=>J(l,r,t));n.finished?(we(i,n.result,a,s,r),n.result=void 0):c.then(l=>{we(i,l,a,s,r)}).catch(l=>J(l,r,t)).finally(()=>n.result=void 0)}}}function we(e,t,r,n,i){if(typeof t=="function"){let o=t.apply(r,n);o instanceof Promise?o.then(s=>we(e,s,r,n)).catch(s=>J(s,i,t)):e(o)}else e(t)}var ut="x-";function w(e=""){return ut+e}function Jt(e){ut=e}var Zt={};function p(e,t){Zt[e]=t}function ne(e,t,r){let n={};return Array.from(t).map(Qt((o,s)=>n[o]=s)).filter(Xt).map(mn(n,r)).sort(hn).map(o=>pn(e,o))}function er(e){return Array.from(e).map(Qt()).filter(t=>!Xt(t))}var ft=!1,ie=new Map,tr=Symbol();function rr(e){ft=!0;let t=Symbol();tr=t,ie.set(t,[]);let r=()=>{for(;ie.get(t).length;)ie.get(t).shift()();ie.delete(t)},n=()=>{ft=!1,r()};e(r),n()}function at(e){let t=[],r=a=>t.push(a),[n,i]=jt(e);return t.push(i),[{Alpine:P,effect:n,cleanup:r,evaluateLater:g.bind(g,e),evaluate:N.bind(N,e)},()=>t.forEach(a=>a())]}function pn(e,t){let r=()=>{},n=Zt[t.type]||r,[i,o]=at(e);ge(e,t.original,o);let s=()=>{e._x_ignore||e._x_ignoreSelf||(n.inline&&n.inline(e,t,i),n=n.bind(n,e,t,i),ft?ie.get(tr).push(n):n())};return s.runCleanups=o,s}var Ee=(e,t)=>({name:r,value:n})=>(r.startsWith(e)&&(r=r.replace(e,t)),{name:r,value:n}),Se=e=>e;function Qt(e=()=>{}){return({name:t,value:r})=>{let{name:n,value:i}=nr.reduce((o,s)=>s(o),{name:t,value:r});return n!==t&&e(n,t),{name:n,value:i}}}var nr=[];function Z(e){nr.push(e)}function Xt({name:e}){return ir().test(e)}var ir=()=>new RegExp(`^${ut}([^:^.]+)\\b`);function mn(e,t){return({name:r,value:n})=>{let i=r.match(ir()),o=r.match(/:([a-zA-Z0-9\-:]+)/),s=r.match(/\.[^.\]]+(?=[^\]]*$)/g)||[],a=t||e[r]||r;return{type:i?i[1]:null,value:o?o[1]:null,modifiers:s.map(c=>c.replace(".","")),expression:n,original:a}}}var dt="DEFAULT",Ae=["ignore","ref","data","id","bind","init","for","model","modelable","transition","show","if",dt,"teleport","element"];function hn(e,t){let r=Ae.indexOf(e.type)===-1?dt:e.type,n=Ae.indexOf(t.type)===-1?dt:t.type;return Ae.indexOf(r)-Ae.indexOf(n)}function B(e,t,r={}){e.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0,cancelable:!0}))}var pt=[],mt=!1;function Te(e){pt.push(e),queueMicrotask(()=>{mt||setTimeout(()=>{Oe()})})}function Oe(){for(mt=!1;pt.length;)pt.shift()()}function or(){mt=!0}function C(e,t){if(typeof ShadowRoot=="function"&&e instanceof ShadowRoot){Array.from(e.children).forEach(i=>C(i,t));return}let r=!1;if(t(e,()=>r=!0),r)return;let n=e.firstElementChild;for(;n;)C(n,t,!1),n=n.nextElementSibling}function z(e,...t){console.warn(`Alpine Warning: ${e}`,...t)}function ar(){document.body||z("Unable to initialize. Trying to load Alpine before `<body>` is available. Did you forget to add `defer` in Alpine's `<script>` tag?"),B(document,"alpine:init"),B(document,"alpine:initializing"),tt(),zt(t=>E(t,C)),_e(t=>ht(t)),Vt((t,r)=>{ne(t,r).forEach(n=>n())});let e=t=>!V(t.parentElement,!0);Array.from(document.querySelectorAll(sr())).filter(e).forEach(t=>{E(t)}),B(document,"alpine:initialized")}var _t=[],cr=[];function lr(){return _t.map(e=>e())}function sr(){return _t.concat(cr).map(e=>e())}function Ce(e){_t.push(e)}function Re(e){cr.push(e)}function V(e,t=!1){return Q(e,r=>{if((t?sr():lr()).some(i=>r.matches(i)))return!0})}function Q(e,t){if(!!e){if(t(e))return e;if(e._x_teleportBack&&(e=e._x_teleportBack),!!e.parentElement)return Q(e.parentElement,t)}}function ur(e){return lr().some(t=>e.matches(t))}function E(e,t=C){rr(()=>{t(e,(r,n)=>{ne(r,r.attributes).forEach(i=>i()),r._x_ignore&&n()})})}function ht(e){C(e,t=>Ze(t))}function oe(e,t){return Array.isArray(t)?fr(e,t.join(" ")):typeof t=="object"&&t!==null?_n(e,t):typeof t=="function"?oe(e,t()):fr(e,t)}function fr(e,t){let r=o=>o.split(" ").filter(Boolean),n=o=>o.split(" ").filter(s=>!e.classList.contains(s)).filter(Boolean),i=o=>(e.classList.add(...o),()=>{e.classList.remove(...o)});return t=t===!0?t="":t||"",i(n(t))}function _n(e,t){let r=a=>a.split(" ").filter(Boolean),n=Object.entries(t).flatMap(([a,c])=>c?r(a):!1).filter(Boolean),i=Object.entries(t).flatMap(([a,c])=>c?!1:r(a)).filter(Boolean),o=[],s=[];return i.forEach(a=>{e.classList.contains(a)&&(e.classList.remove(a),s.push(a))}),n.forEach(a=>{e.classList.contains(a)||(e.classList.add(a),o.push(a))}),()=>{s.forEach(a=>e.classList.add(a)),o.forEach(a=>e.classList.remove(a))}}function H(e,t){return typeof t=="object"&&t!==null?gn(e,t):xn(e,t)}function gn(e,t){let r={};return Object.entries(t).forEach(([n,i])=>{r[n]=e.style[n],n.startsWith("--")||(n=yn(n)),e.style.setProperty(n,i)}),setTimeout(()=>{e.style.length===0&&e.removeAttribute("style")}),()=>{H(e,r)}}function xn(e,t){let r=e.getAttribute("style",t);return e.setAttribute("style",t),()=>{e.setAttribute("style",r||"")}}function yn(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function se(e,t=()=>{}){let r=!1;return function(){r?t.apply(this,arguments):(r=!0,e.apply(this,arguments))}}p("transition",(e,{value:t,modifiers:r,expression:n},{evaluate:i})=>{typeof n=="function"&&(n=i(n)),n?bn(e,n,t):vn(e,r,t)});function bn(e,t,r){dr(e,oe,""),{enter:i=>{e._x_transition.enter.during=i},"enter-start":i=>{e._x_transition.enter.start=i},"enter-end":i=>{e._x_transition.enter.end=i},leave:i=>{e._x_transition.leave.during=i},"leave-start":i=>{e._x_transition.leave.start=i},"leave-end":i=>{e._x_transition.leave.end=i}}[r](t)}function vn(e,t,r){dr(e,H);let n=!t.includes("in")&&!t.includes("out")&&!r,i=n||t.includes("in")||["enter"].includes(r),o=n||t.includes("out")||["leave"].includes(r);t.includes("in")&&!n&&(t=t.filter((h,b)=>b<t.indexOf("out"))),t.includes("out")&&!n&&(t=t.filter((h,b)=>b>t.indexOf("out")));let s=!t.includes("opacity")&&!t.includes("scale"),a=s||t.includes("opacity"),c=s||t.includes("scale"),l=a?0:1,u=c?ae(t,"scale",95)/100:1,d=ae(t,"delay",0),x=ae(t,"origin","center"),M="opacity, transform",W=ae(t,"duration",150)/1e3,pe=ae(t,"duration",75)/1e3,f="cubic-bezier(0.4, 0.0, 0.2, 1)";i&&(e._x_transition.enter.during={transformOrigin:x,transitionDelay:d,transitionProperty:M,transitionDuration:`${W}s`,transitionTimingFunction:f},e._x_transition.enter.start={opacity:l,transform:`scale(${u})`},e._x_transition.enter.end={opacity:1,transform:"scale(1)"}),o&&(e._x_transition.leave.during={transformOrigin:x,transitionDelay:d,transitionProperty:M,transitionDuration:`${pe}s`,transitionTimingFunction:f},e._x_transition.leave.start={opacity:1,transform:"scale(1)"},e._x_transition.leave.end={opacity:l,transform:`scale(${u})`})}function dr(e,t,r={}){e._x_transition||(e._x_transition={enter:{during:r,start:r,end:r},leave:{during:r,start:r,end:r},in(n=()=>{},i=()=>{}){Me(e,t,{during:this.enter.during,start:this.enter.start,end:this.enter.end},n,i)},out(n=()=>{},i=()=>{}){Me(e,t,{during:this.leave.during,start:this.leave.start,end:this.leave.end},n,i)}})}window.Element.prototype._x_toggleAndCascadeWithTransitions=function(e,t,r,n){let i=()=>{document.visibilityState==="visible"?requestAnimationFrame(r):setTimeout(r)};if(t){e._x_transition&&(e._x_transition.enter||e._x_transition.leave)?e._x_transition.enter&&(Object.entries(e._x_transition.enter.during).length||Object.entries(e._x_transition.enter.start).length||Object.entries(e._x_transition.enter.end).length)?e._x_transition.in(r):i():e._x_transition?e._x_transition.in(r):i();return}e._x_hidePromise=e._x_transition?new Promise((o,s)=>{e._x_transition.out(()=>{},()=>o(n)),e._x_transitioning.beforeCancel(()=>s({isFromCancelledTransition:!0}))}):Promise.resolve(n),queueMicrotask(()=>{let o=pr(e);o?(o._x_hideChildren||(o._x_hideChildren=[]),o._x_hideChildren.push(e)):queueMicrotask(()=>{let s=a=>{let c=Promise.all([a._x_hidePromise,...(a._x_hideChildren||[]).map(s)]).then(([l])=>l());return delete a._x_hidePromise,delete a._x_hideChildren,c};s(e).catch(a=>{if(!a.isFromCancelledTransition)throw a})})})};function pr(e){let t=e.parentNode;if(!!t)return t._x_hidePromise?t:pr(t)}function Me(e,t,{during:r,start:n,end:i}={},o=()=>{},s=()=>{}){if(e._x_transitioning&&e._x_transitioning.cancel(),Object.keys(r).length===0&&Object.keys(n).length===0&&Object.keys(i).length===0){o(),s();return}let a,c,l;wn(e,{start(){a=t(e,n)},during(){c=t(e,r)},before:o,end(){a(),l=t(e,i)},after:s,cleanup(){c(),l()}})}function wn(e,t){let r,n,i,o=se(()=>{m(()=>{r=!0,n||t.before(),i||(t.end(),Oe()),t.after(),e.isConnected&&t.cleanup(),delete e._x_transitioning})});e._x_transitioning={beforeCancels:[],beforeCancel(s){this.beforeCancels.push(s)},cancel:se(function(){for(;this.beforeCancels.length;)this.beforeCancels.shift()();o()}),finish:o},m(()=>{t.start(),t.during()}),or(),requestAnimationFrame(()=>{if(r)return;let s=Number(getComputedStyle(e).transitionDuration.replace(/,.*/,"").replace("s",""))*1e3,a=Number(getComputedStyle(e).transitionDelay.replace(/,.*/,"").replace("s",""))*1e3;s===0&&(s=Number(getComputedStyle(e).animationDuration.replace("s",""))*1e3),m(()=>{t.before()}),n=!0,requestAnimationFrame(()=>{r||(m(()=>{t.end()}),Oe(),setTimeout(e._x_transitioning.finish,s+a),i=!0)})})}function ae(e,t,r){if(e.indexOf(t)===-1)return r;let n=e[e.indexOf(t)+1];if(!n||t==="scale"&&isNaN(n))return r;if(t==="duration"){let i=n.match(/([0-9]+)ms/);if(i)return i[1]}return t==="origin"&&["top","right","left","center","bottom"].includes(e[e.indexOf(t)+2])?[n,e[e.indexOf(t)+2]].join(" "):n}var gt=!1;function D(e,t=()=>{}){return(...r)=>gt?t(...r):e(...r)}function mr(e,t){t._x_dataStack||(t._x_dataStack=e._x_dataStack),gt=!0,Sn(()=>{En(t)}),gt=!1}function En(e){let t=!1;E(e,(n,i)=>{C(n,(o,s)=>{if(t&&ur(o))return s();t=!0,i(o,s)})})}function Sn(e){let t=K;Je((r,n)=>{let i=t(r);return Y(i),()=>{}}),e(),Je(t)}function ce(e,t,r,n=[]){switch(e._x_bindings||(e._x_bindings=A({})),e._x_bindings[t]=r,t=n.includes("camel")?Rn(t):t,t){case"value":An(e,r);break;case"style":Tn(e,r);break;case"class":On(e,r);break;default:Cn(e,t,r);break}}function An(e,t){if(e.type==="radio")e.attributes.value===void 0&&(e.value=t),window.fromModel&&(e.checked=hr(e.value,t));else if(e.type==="checkbox")Number.isInteger(t)?e.value=t:!Number.isInteger(t)&&!Array.isArray(t)&&typeof t!="boolean"&&![null,void 0].includes(t)?e.value=String(t):Array.isArray(t)?e.checked=t.some(r=>hr(r,e.value)):e.checked=!!t;else if(e.tagName==="SELECT")Mn(e,t);else{if(e.value===t)return;e.value=t}}function On(e,t){e._x_undoAddedClasses&&e._x_undoAddedClasses(),e._x_undoAddedClasses=oe(e,t)}function Tn(e,t){e._x_undoAddedStyles&&e._x_undoAddedStyles(),e._x_undoAddedStyles=H(e,t)}function Cn(e,t,r){[null,void 0,!1].includes(r)&&kn(t)?e.removeAttribute(t):(_r(t)&&(r=t),Nn(e,t,r))}function Nn(e,t,r){e.getAttribute(t)!=r&&e.setAttribute(t,r)}function Mn(e,t){let r=[].concat(t).map(n=>n+"");Array.from(e.options).forEach(n=>{n.selected=r.includes(n.value)})}function Rn(e){return e.toLowerCase().replace(/-(\w)/g,(t,r)=>r.toUpperCase())}function hr(e,t){return e==t}function _r(e){return["disabled","checked","required","readonly","hidden","open","selected","autofocus","itemscope","multiple","novalidate","allowfullscreen","allowpaymentrequest","formnovalidate","autoplay","controls","loop","muted","playsinline","default","ismap","reversed","async","defer","nomodule"].includes(e)}function kn(e){return!["aria-pressed","aria-checked","aria-expanded","aria-selected"].includes(e)}function gr(e,t,r){if(e._x_bindings&&e._x_bindings[t]!==void 0)return e._x_bindings[t];let n=e.getAttribute(t);return n===null?typeof r=="function"?r():r:_r(t)?!![t,"true"].includes(n):n===""?!0:n}function Ne(e,t){var r;return function(){var n=this,i=arguments,o=function(){r=null,e.apply(n,i)};clearTimeout(r),r=setTimeout(o,t)}}function ke(e,t){let r;return function(){let n=this,i=arguments;r||(e.apply(n,i),r=!0,setTimeout(()=>r=!1,t))}}function xr(e){e(P)}var q={},yr=!1;function br(e,t){if(yr||(q=A(q),yr=!0),t===void 0)return q[e];q[e]=t,typeof t=="object"&&t!==null&&t.hasOwnProperty("init")&&typeof t.init=="function"&&q[e].init(),be(q[e])}function vr(){return q}var wr={};function Er(e,t){wr[e]=typeof t!="function"?()=>t:t}function Sr(e){return Object.entries(wr).forEach(([t,r])=>{Object.defineProperty(e,t,{get(){return(...n)=>r(...n)}})}),e}var Ar={};function Or(e,t){Ar[e]=t}function Tr(e,t){return Object.entries(Ar).forEach(([r,n])=>{Object.defineProperty(e,r,{get(){return(...i)=>n.bind(t)(...i)},enumerable:!1})}),e}var In={get reactive(){return A},get release(){return Y},get effect(){return K},get raw(){return Ge},version:"3.9.1",flushAndStopDeferringMutations:qt,disableEffectScheduling:$t,stopObservingMutations:rt,destroyTree:ht,setReactivityEngine:Lt,closestDataStack:k,skipDuringClone:D,addRootSelector:Ce,addInitSelector:Re,addScopeToNode:T,deferMutations:Ht,mapAttributes:Z,evaluateLater:g,setEvaluator:Yt,mergeProxies:I,findClosest:Q,closestRoot:V,interceptor:ve,transition:Me,setStyles:H,mutateDom:m,directive:p,throttle:ke,debounce:Ne,evaluate:N,initTree:E,nextTick:Te,prefixed:w,prefix:Jt,plugin:xr,magic:y,store:br,start:ar,clone:mr,bound:gr,$data:ye,data:Or,bind:Er},P=In;function xt(e,t){let r=Object.create(null),n=e.split(",");for(let i=0;i<n.length;i++)r[n[i]]=!0;return t?i=>!!r[i.toLowerCase()]:i=>!!r[i]}var Xo={[1]:"TEXT",[2]:"CLASS",[4]:"STYLE",[8]:"PROPS",[16]:"FULL_PROPS",[32]:"HYDRATE_EVENTS",[64]:"STABLE_FRAGMENT",[128]:"KEYED_FRAGMENT",[256]:"UNKEYED_FRAGMENT",[512]:"NEED_PATCH",[1024]:"DYNAMIC_SLOTS",[2048]:"DEV_ROOT_FRAGMENT",[-1]:"HOISTED",[-2]:"BAIL"},es={[1]:"STABLE",[2]:"DYNAMIC",[3]:"FORWARDED"};var Pn="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly";var ts=xt(Pn+",async,autofocus,autoplay,controls,default,defer,disabled,hidden,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");var Cr=Object.freeze({}),rs=Object.freeze([]);var yt=Object.assign;var Dn=Object.prototype.hasOwnProperty,le=(e,t)=>Dn.call(e,t),$=Array.isArray,X=e=>Rr(e)==="[object Map]";var $n=e=>typeof e=="string",Ie=e=>typeof e=="symbol",ue=e=>e!==null&&typeof e=="object";var Ln=Object.prototype.toString,Rr=e=>Ln.call(e),bt=e=>Rr(e).slice(8,-1);var Pe=e=>$n(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e;var De=e=>{let t=Object.create(null);return r=>t[r]||(t[r]=e(r))},jn=/-(\w)/g,ns=De(e=>e.replace(jn,(t,r)=>r?r.toUpperCase():"")),Fn=/\B([A-Z])/g,is=De(e=>e.replace(Fn,"-$1").toLowerCase()),vt=De(e=>e.charAt(0).toUpperCase()+e.slice(1)),os=De(e=>e?`on${vt(e)}`:""),wt=(e,t)=>e!==t&&(e===e||t===t);var Et=new WeakMap,fe=[],R,U=Symbol("iterate"),St=Symbol("Map key iterate");function Kn(e){return e&&e._isEffect===!0}function Mr(e,t=Cr){Kn(e)&&(e=e.raw);let r=Bn(e,t);return t.lazy||r(),r}function kr(e){e.active&&(Nr(e),e.options.onStop&&e.options.onStop(),e.active=!1)}var zn=0;function Bn(e,t){let r=function(){if(!r.active)return e();if(!fe.includes(r)){Nr(r);try{return Vn(),fe.push(r),R=r,e()}finally{fe.pop(),Ir(),R=fe[fe.length-1]}}};return r.id=zn++,r.allowRecurse=!!t.allowRecurse,r._isEffect=!0,r.active=!0,r.raw=e,r.deps=[],r.options=t,r}function Nr(e){let{deps:t}=e;if(t.length){for(let r=0;r<t.length;r++)t[r].delete(e);t.length=0}}var ee=!0,At=[];function Hn(){At.push(ee),ee=!1}function Vn(){At.push(ee),ee=!0}function Ir(){let e=At.pop();ee=e===void 0?!0:e}function O(e,t,r){if(!ee||R===void 0)return;let n=Et.get(e);n||Et.set(e,n=new Map);let i=n.get(r);i||n.set(r,i=new Set),i.has(R)||(i.add(R),R.deps.push(i),R.options.onTrack&&R.options.onTrack({effect:R,target:e,type:t,key:r}))}function L(e,t,r,n,i,o){let s=Et.get(e);if(!s)return;let a=new Set,c=u=>{u&&u.forEach(d=>{(d!==R||d.allowRecurse)&&a.add(d)})};if(t==="clear")s.forEach(c);else if(r==="length"&&$(e))s.forEach((u,d)=>{(d==="length"||d>=n)&&c(u)});else switch(r!==void 0&&c(s.get(r)),t){case"add":$(e)?Pe(r)&&c(s.get("length")):(c(s.get(U)),X(e)&&c(s.get(St)));break;case"delete":$(e)||(c(s.get(U)),X(e)&&c(s.get(St)));break;case"set":X(e)&&c(s.get(U));break}let l=u=>{u.options.onTrigger&&u.options.onTrigger({effect:u,target:e,key:r,type:t,newValue:n,oldValue:i,oldTarget:o}),u.options.scheduler?u.options.scheduler(u):u()};a.forEach(l)}var qn=xt("__proto__,__v_isRef,__isVue"),Pr=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(Ie)),Un=$e(),Wn=$e(!1,!0),Gn=$e(!0),Yn=$e(!0,!0),Le={};["includes","indexOf","lastIndexOf"].forEach(e=>{let t=Array.prototype[e];Le[e]=function(...r){let n=_(this);for(let o=0,s=this.length;o<s;o++)O(n,"get",o+"");let i=t.apply(n,r);return i===-1||i===!1?t.apply(n,r.map(_)):i}});["push","pop","shift","unshift","splice"].forEach(e=>{let t=Array.prototype[e];Le[e]=function(...r){Hn();let n=t.apply(this,r);return Ir(),n}});function $e(e=!1,t=!1){return function(n,i,o){if(i==="__v_isReactive")return!e;if(i==="__v_isReadonly")return e;if(i==="__v_raw"&&o===(e?t?Zn:$r:t?Jn:Dr).get(n))return n;let s=$(n);if(!e&&s&&le(Le,i))return Reflect.get(Le,i,o);let a=Reflect.get(n,i,o);return(Ie(i)?Pr.has(i):qn(i))||(e||O(n,"get",i),t)?a:Ot(a)?!s||!Pe(i)?a.value:a:ue(a)?e?Lr(a):je(a):a}}var Qn=jr(),Xn=jr(!0);function jr(e=!1){return function(r,n,i,o){let s=r[n];if(!e&&(i=_(i),s=_(s),!$(r)&&Ot(s)&&!Ot(i)))return s.value=i,!0;let a=$(r)&&Pe(n)?Number(n)<r.length:le(r,n),c=Reflect.set(r,n,i,o);return r===_(o)&&(a?wt(i,s)&&L(r,"set",n,i,s):L(r,"add",n,i)),c}}function ei(e,t){let r=le(e,t),n=e[t],i=Reflect.deleteProperty(e,t);return i&&r&&L(e,"delete",t,void 0,n),i}function ti(e,t){let r=Reflect.has(e,t);return(!Ie(t)||!Pr.has(t))&&O(e,"has",t),r}function ri(e){return O(e,"iterate",$(e)?"length":U),Reflect.ownKeys(e)}var Fr={get:Un,set:Qn,deleteProperty:ei,has:ti,ownKeys:ri},Kr={get:Gn,set(e,t){return console.warn(`Set operation on key "${String(t)}" failed: target is readonly.`,e),!0},deleteProperty(e,t){return console.warn(`Delete operation on key "${String(t)}" failed: target is readonly.`,e),!0}},fs=yt({},Fr,{get:Wn,set:Xn}),ds=yt({},Kr,{get:Yn}),Tt=e=>ue(e)?je(e):e,Ct=e=>ue(e)?Lr(e):e,Rt=e=>e,Fe=e=>Reflect.getPrototypeOf(e);function Ke(e,t,r=!1,n=!1){e=e.__v_raw;let i=_(e),o=_(t);t!==o&&!r&&O(i,"get",t),!r&&O(i,"get",o);let{has:s}=Fe(i),a=n?Rt:r?Ct:Tt;if(s.call(i,t))return a(e.get(t));if(s.call(i,o))return a(e.get(o));e!==i&&e.get(t)}function Be(e,t=!1){let r=this.__v_raw,n=_(r),i=_(e);return e!==i&&!t&&O(n,"has",e),!t&&O(n,"has",i),e===i?r.has(e):r.has(e)||r.has(i)}function ze(e,t=!1){return e=e.__v_raw,!t&&O(_(e),"iterate",U),Reflect.get(e,"size",e)}function Br(e){e=_(e);let t=_(this);return Fe(t).has.call(t,e)||(t.add(e),L(t,"add",e,e)),this}function Vr(e,t){t=_(t);let r=_(this),{has:n,get:i}=Fe(r),o=n.call(r,e);o?zr(r,n,e):(e=_(e),o=n.call(r,e));let s=i.call(r,e);return r.set(e,t),o?wt(t,s)&&L(r,"set",e,t,s):L(r,"add",e,t),this}function Hr(e){let t=_(this),{has:r,get:n}=Fe(t),i=r.call(t,e);i?zr(t,r,e):(e=_(e),i=r.call(t,e));let o=n?n.call(t,e):void 0,s=t.delete(e);return i&&L(t,"delete",e,void 0,o),s}function qr(){let e=_(this),t=e.size!==0,r=X(e)?new Map(e):new Set(e),n=e.clear();return t&&L(e,"clear",void 0,void 0,r),n}function Ve(e,t){return function(n,i){let o=this,s=o.__v_raw,a=_(s),c=t?Rt:e?Ct:Tt;return!e&&O(a,"iterate",U),s.forEach((l,u)=>n.call(i,c(l),c(u),o))}}function He(e,t,r){return function(...n){let i=this.__v_raw,o=_(i),s=X(o),a=e==="entries"||e===Symbol.iterator&&s,c=e==="keys"&&s,l=i[e](...n),u=r?Rt:t?Ct:Tt;return!t&&O(o,"iterate",c?St:U),{next(){let{value:d,done:x}=l.next();return x?{value:d,done:x}:{value:a?[u(d[0]),u(d[1])]:u(d),done:x}},[Symbol.iterator](){return this}}}}function j(e){return function(...t){{let r=t[0]?`on key "${t[0]}" `:"";console.warn(`${vt(e)} operation ${r}failed: target is readonly.`,_(this))}return e==="delete"?!1:this}}var Ur={get(e){return Ke(this,e)},get size(){return ze(this)},has:Be,add:Br,set:Vr,delete:Hr,clear:qr,forEach:Ve(!1,!1)},Wr={get(e){return Ke(this,e,!1,!0)},get size(){return ze(this)},has:Be,add:Br,set:Vr,delete:Hr,clear:qr,forEach:Ve(!1,!0)},Gr={get(e){return Ke(this,e,!0)},get size(){return ze(this,!0)},has(e){return Be.call(this,e,!0)},add:j("add"),set:j("set"),delete:j("delete"),clear:j("clear"),forEach:Ve(!0,!1)},Yr={get(e){return Ke(this,e,!0,!0)},get size(){return ze(this,!0)},has(e){return Be.call(this,e,!0)},add:j("add"),set:j("set"),delete:j("delete"),clear:j("clear"),forEach:Ve(!0,!0)},ni=["keys","values","entries",Symbol.iterator];ni.forEach(e=>{Ur[e]=He(e,!1,!1),Gr[e]=He(e,!0,!1),Wr[e]=He(e,!1,!0),Yr[e]=He(e,!0,!0)});function qe(e,t){let r=t?e?Yr:Wr:e?Gr:Ur;return(n,i,o)=>i==="__v_isReactive"?!e:i==="__v_isReadonly"?e:i==="__v_raw"?n:Reflect.get(le(r,i)&&i in n?r:n,i,o)}var ii={get:qe(!1,!1)},ps={get:qe(!1,!0)},oi={get:qe(!0,!1)},ms={get:qe(!0,!0)};function zr(e,t,r){let n=_(r);if(n!==r&&t.call(e,n)){let i=bt(e);console.warn(`Reactive ${i} contains both the raw and reactive versions of the same object${i==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}var Dr=new WeakMap,Jn=new WeakMap,$r=new WeakMap,Zn=new WeakMap;function si(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function ai(e){return e.__v_skip||!Object.isExtensible(e)?0:si(bt(e))}function je(e){return e&&e.__v_isReadonly?e:Jr(e,!1,Fr,ii,Dr)}function Lr(e){return Jr(e,!0,Kr,oi,$r)}function Jr(e,t,r,n,i){if(!ue(e))return console.warn(`value cannot be made reactive: ${String(e)}`),e;if(e.__v_raw&&!(t&&e.__v_isReactive))return e;let o=i.get(e);if(o)return o;let s=ai(e);if(s===0)return e;let a=new Proxy(e,s===2?n:r);return i.set(e,a),a}function _(e){return e&&_(e.__v_raw)||e}function Ot(e){return Boolean(e&&e.__v_isRef===!0)}y("nextTick",()=>Te);y("dispatch",e=>B.bind(B,e));y("watch",(e,{evaluateLater:t,effect:r})=>(n,i)=>{let o=t(n),s=!0,a;r(()=>o(c=>{JSON.stringify(c),s?a=c:queueMicrotask(()=>{i(c,a),a=c}),s=!1}))});y("store",vr);y("data",e=>ye(e));y("root",e=>V(e));y("refs",e=>(e._x_refs_proxy||(e._x_refs_proxy=I(ci(e))),e._x_refs_proxy));function ci(e){let t=[],r=e;for(;r;)r._x_refs&&t.push(r._x_refs),r=r.parentNode;return t}var Mt={};function Nt(e){return Mt[e]||(Mt[e]=0),++Mt[e]}function Zr(e,t){return Q(e,r=>{if(r._x_ids&&r._x_ids[t])return!0})}function Qr(e,t){e._x_ids||(e._x_ids={}),e._x_ids[t]||(e._x_ids[t]=Nt(t))}y("id",e=>(t,r=null)=>{let n=Zr(e,t),i=n?n._x_ids[t]:Nt(t);return r?`${t}-${i}-${r}`:`${t}-${i}`});y("el",e=>e);p("modelable",(e,{expression:t},{effect:r,evaluate:n,evaluateLater:i})=>{let o=i(t),s=()=>{let u;return o(d=>u=d),u},a=i(`${t} = __placeholder`),c=u=>a(()=>{},{scope:{__placeholder:u}}),l=s();e._x_modelable_hook&&(l=e._x_modelable_hook(l)),c(l),queueMicrotask(()=>{if(!e._x_model)return;let u=e._x_model.get,d=e._x_model.set;r(()=>c(u())),r(()=>d(s()))})});p("teleport",(e,{expression:t},{cleanup:r})=>{e.tagName.toLowerCase()!=="template"&&z("x-teleport can only be used on a <template> tag",e);let n=document.querySelector(t);n||z(`Cannot find x-teleport element for selector: "${t}"`);let i=e.content.cloneNode(!0).firstElementChild;e._x_teleport=i,i._x_teleportBack=e,e._x_forwardEvents&&e._x_forwardEvents.forEach(o=>{i.addEventListener(o,s=>{s.stopPropagation(),e.dispatchEvent(new s.constructor(s.type,s))})}),T(i,{},e),m(()=>{n.appendChild(i),E(i),i._x_ignore=!0}),r(()=>i.remove())});var Xr=()=>{};Xr.inline=(e,{modifiers:t},{cleanup:r})=>{t.includes("self")?e._x_ignoreSelf=!0:e._x_ignore=!0,r(()=>{t.includes("self")?delete e._x_ignoreSelf:delete e._x_ignore})};p("ignore",Xr);p("effect",(e,{expression:t},{effect:r})=>r(g(e,t)));function de(e,t,r,n){let i=e,o=c=>n(c),s={},a=(c,l)=>u=>l(c,u);if(r.includes("dot")&&(t=li(t)),r.includes("camel")&&(t=ui(t)),r.includes("passive")&&(s.passive=!0),r.includes("capture")&&(s.capture=!0),r.includes("window")&&(i=window),r.includes("document")&&(i=document),r.includes("prevent")&&(o=a(o,(c,l)=>{l.preventDefault(),c(l)})),r.includes("stop")&&(o=a(o,(c,l)=>{l.stopPropagation(),c(l)})),r.includes("self")&&(o=a(o,(c,l)=>{l.target===e&&c(l)})),(r.includes("away")||r.includes("outside"))&&(i=document,o=a(o,(c,l)=>{e.contains(l.target)||e.offsetWidth<1&&e.offsetHeight<1||e._x_isShown!==!1&&c(l)})),o=a(o,(c,l)=>{fi(t)&&di(l,r)||c(l)}),r.includes("debounce")){let c=r[r.indexOf("debounce")+1]||"invalid-wait",l=kt(c.split("ms")[0])?Number(c.split("ms")[0]):250;o=Ne(o,l)}if(r.includes("throttle")){let c=r[r.indexOf("throttle")+1]||"invalid-wait",l=kt(c.split("ms")[0])?Number(c.split("ms")[0]):250;o=ke(o,l)}return r.includes("once")&&(o=a(o,(c,l)=>{c(l),i.removeEventListener(t,o,s)})),i.addEventListener(t,o,s),()=>{i.removeEventListener(t,o,s)}}function li(e){return e.replace(/-/g,".")}function ui(e){return e.toLowerCase().replace(/-(\w)/g,(t,r)=>r.toUpperCase())}function kt(e){return!Array.isArray(e)&&!isNaN(e)}function pi(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[_\s]/,"-").toLowerCase()}function fi(e){return["keydown","keyup"].includes(e)}function di(e,t){let r=t.filter(o=>!["window","document","prevent","stop","once"].includes(o));if(r.includes("debounce")){let o=r.indexOf("debounce");r.splice(o,kt((r[o+1]||"invalid-wait").split("ms")[0])?2:1)}if(r.length===0||r.length===1&&en(e.key).includes(r[0]))return!1;let i=["ctrl","shift","alt","meta","cmd","super"].filter(o=>r.includes(o));return r=r.filter(o=>!i.includes(o)),!(i.length>0&&i.filter(s=>((s==="cmd"||s==="super")&&(s="meta"),e[`${s}Key`])).length===i.length&&en(e.key).includes(r[0]))}function en(e){if(!e)return[];e=pi(e);let t={ctrl:"control",slash:"/",space:"-",spacebar:"-",cmd:"meta",esc:"escape",up:"arrow-up",down:"arrow-down",left:"arrow-left",right:"arrow-right",period:".",equal:"="};return t[e]=e,Object.keys(t).map(r=>{if(t[r]===e)return r}).filter(r=>r)}p("model",(e,{modifiers:t,expression:r},{effect:n,cleanup:i})=>{let o=g(e,r),s=`${r} = rightSideOfExpression($event, ${r})`,a=g(e,s);var c=e.tagName.toLowerCase()==="select"||["checkbox","radio"].includes(e.type)||t.includes("lazy")?"change":"input";let l=mi(e,t,r),u=de(e,c,t,x=>{a(()=>{},{scope:{$event:x,rightSideOfExpression:l}})});i(()=>u());let d=g(e,`${r} = __placeholder`);e._x_model={get(){let x;return o(M=>x=M),x},set(x){d(()=>{},{scope:{__placeholder:x}})}},e._x_forceModelUpdate=()=>{o(x=>{x===void 0&&r.match(/\./)&&(x=""),window.fromModel=!0,m(()=>ce(e,"value",x)),delete window.fromModel})},n(()=>{t.includes("unintrusive")&&document.activeElement.isSameNode(e)||e._x_forceModelUpdate()})});function mi(e,t,r){return e.type==="radio"&&m(()=>{e.hasAttribute("name")||e.setAttribute("name",r)}),(n,i)=>m(()=>{if(n instanceof CustomEvent&&n.detail!==void 0)return n.detail||n.target.value;if(e.type==="checkbox")if(Array.isArray(i)){let o=t.includes("number")?It(n.target.value):n.target.value;return n.target.checked?i.concat([o]):i.filter(s=>!hi(s,o))}else return n.target.checked;else{if(e.tagName.toLowerCase()==="select"&&e.multiple)return t.includes("number")?Array.from(n.target.selectedOptions).map(o=>{let s=o.value||o.text;return It(s)}):Array.from(n.target.selectedOptions).map(o=>o.value||o.text);{let o=n.target.value;return t.includes("number")?It(o):t.includes("trim")?o.trim():o}}})}function It(e){let t=e?parseFloat(e):null;return _i(t)?t:e}function hi(e,t){return e==t}function _i(e){return!Array.isArray(e)&&!isNaN(e)}p("cloak",e=>queueMicrotask(()=>m(()=>e.removeAttribute(w("cloak")))));Re(()=>`[${w("init")}]`);p("init",D((e,{expression:t},{evaluate:r})=>typeof t=="string"?!!t.trim()&&r(t,{},!1):r(t,{},!1)));p("text",(e,{expression:t},{effect:r,evaluateLater:n})=>{let i=n(t);r(()=>{i(o=>{m(()=>{e.textContent=o})})})});p("html",(e,{expression:t},{effect:r,evaluateLater:n})=>{let i=n(t);r(()=>{i(o=>{e.innerHTML=o})})});Z(Ee(":",Se(w("bind:"))));p("bind",(e,{value:t,modifiers:r,expression:n,original:i},{effect:o})=>{if(!t)return gi(e,n,i,o);if(t==="key")return xi(e,n);let s=g(e,n);o(()=>s(a=>{a===void 0&&n.match(/\./)&&(a=""),m(()=>ce(e,t,a,r))}))});function gi(e,t,r,n){let i={};Sr(i);let o=g(e,t),s=[];for(;s.length;)s.pop()();o(a=>{let c=Object.entries(a).map(([u,d])=>({name:u,value:d})),l=er(c);c=c.map(u=>l.find(d=>d.name===u.name)?{name:`x-bind:${u.name}`,value:`"${u.value}"`}:u),ne(e,c,r).map(u=>{s.push(u.runCleanups),u()})},{scope:i})}function xi(e,t){e._x_keyExpression=t}Ce(()=>`[${w("data")}]`);p("data",D((e,{expression:t},{cleanup:r})=>{t=t===""?"{}":t;let n={},i=re(n,e).cleanup,o={};Tr(o,n);let s=N(e,t,{scope:o});s===void 0&&(s={});let a=re(s,e).cleanup,c=A(s);be(c);let l=T(e,c);c.init&&N(e,c.init),r(()=>{l(),i(),a(),c.destroy&&N(e,c.destroy)})}));p("show",(e,{modifiers:t,expression:r},{effect:n})=>{let i=g(e,r),o=()=>m(()=>{e.style.display="none",e._x_isShown=!1}),s=()=>m(()=>{e.style.length===1&&e.style.display==="none"?e.removeAttribute("style"):e.style.removeProperty("display"),e._x_isShown=!0}),a=()=>setTimeout(s),c=se(d=>d?s():o(),d=>{typeof e._x_toggleAndCascadeWithTransitions=="function"?e._x_toggleAndCascadeWithTransitions(e,d,s,o):d?a():o()}),l,u=!0;n(()=>i(d=>{!u&&d===l||(t.includes("immediate")&&(d?a():o()),c(d),l=d,u=!1)}))});p("for",(e,{expression:t},{effect:r,cleanup:n})=>{let i=bi(t),o=g(e,i.items),s=g(e,e._x_keyExpression||"index");e._x_prevKeys=[],e._x_lookup={},r(()=>yi(e,i,o,s)),n(()=>{Object.values(e._x_lookup).forEach(a=>a.remove()),delete e._x_prevKeys,delete e._x_lookup})});function yi(e,t,r,n){let i=s=>typeof s=="object"&&!Array.isArray(s),o=e;r(s=>{vi(s)&&s>=0&&(s=Array.from(Array(s).keys(),f=>f+1)),s===void 0&&(s=[]);let a=e._x_lookup,c=e._x_prevKeys,l=[],u=[];if(i(s))s=Object.entries(s).map(([f,h])=>{let b=tn(t,h,f,s);n(v=>u.push(v),{scope:{index:f,...b}}),l.push(b)});else for(let f=0;f<s.length;f++){let h=tn(t,s[f],f,s);n(b=>u.push(b),{scope:{index:f,...h}}),l.push(h)}let d=[],x=[],M=[],W=[];for(let f=0;f<c.length;f++){let h=c[f];u.indexOf(h)===-1&&M.push(h)}c=c.filter(f=>!M.includes(f));let pe="template";for(let f=0;f<u.length;f++){let h=u[f],b=c.indexOf(h);if(b===-1)c.splice(f,0,h),d.push([pe,f]);else if(b!==f){let v=c.splice(f,1)[0],S=c.splice(b-1,1)[0];c.splice(f,0,S),c.splice(b,0,v),x.push([v,S])}else W.push(h);pe=h}for(let f=0;f<M.length;f++){let h=M[f];a[h]._x_effects&&a[h]._x_effects.forEach(he),a[h].remove(),a[h]=null,delete a[h]}for(let f=0;f<x.length;f++){let[h,b]=x[f],v=a[h],S=a[b],G=document.createElement("div");m(()=>{S.after(G),v.after(S),S._x_currentIfEl&&S.after(S._x_currentIfEl),G.before(v),v._x_currentIfEl&&v.after(v._x_currentIfEl),G.remove()}),ot(S,l[u.indexOf(b)])}for(let f=0;f<d.length;f++){let[h,b]=d[f],v=h==="template"?o:a[h];v._x_currentIfEl&&(v=v._x_currentIfEl);let S=l[b],G=u[b],me=document.importNode(o.content,!0).firstElementChild;T(me,A(S),o),m(()=>{v.after(me),E(me)}),typeof G=="object"&&z("x-for key cannot be an object, it must be a string or an integer",o),a[G]=me}for(let f=0;f<W.length;f++)ot(a[W[f]],l[u.indexOf(W[f])]);o._x_prevKeys=u})}function bi(e){let t=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,r=/^\s*\(|\)\s*$/g,n=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,i=e.match(n);if(!i)return;let o={};o.items=i[2].trim();let s=i[1].replace(r,"").trim(),a=s.match(t);return a?(o.item=s.replace(t,"").trim(),o.index=a[1].trim(),a[2]&&(o.collection=a[2].trim())):o.item=s,o}function tn(e,t,r,n){let i={};return/^\[.*\]$/.test(e.item)&&Array.isArray(t)?e.item.replace("[","").replace("]","").split(",").map(s=>s.trim()).forEach((s,a)=>{i[s]=t[a]}):/^\{.*\}$/.test(e.item)&&!Array.isArray(t)&&typeof t=="object"?e.item.replace("{","").replace("}","").split(",").map(s=>s.trim()).forEach(s=>{i[s]=t[s]}):i[e.item]=t,e.index&&(i[e.index]=r),e.collection&&(i[e.collection]=n),i}function vi(e){return!Array.isArray(e)&&!isNaN(e)}function rn(){}rn.inline=(e,{expression:t},{cleanup:r})=>{let n=V(e);n._x_refs||(n._x_refs={}),n._x_refs[t]=e,r(()=>delete n._x_refs[t])};p("ref",rn);p("if",(e,{expression:t},{effect:r,cleanup:n})=>{let i=g(e,t),o=()=>{if(e._x_currentIfEl)return e._x_currentIfEl;let a=e.content.cloneNode(!0).firstElementChild;return T(a,{},e),m(()=>{e.after(a),E(a)}),e._x_currentIfEl=a,e._x_undoIf=()=>{C(a,c=>{c._x_effects&&c._x_effects.forEach(he)}),a.remove(),delete e._x_currentIfEl},a},s=()=>{!e._x_undoIf||(e._x_undoIf(),delete e._x_undoIf)};r(()=>i(a=>{a?o():s()})),n(()=>e._x_undoIf&&e._x_undoIf())});p("id",(e,{expression:t},{evaluate:r})=>{r(t).forEach(i=>Qr(e,i))});Z(Ee("@",Se(w("on:"))));p("on",D((e,{value:t,modifiers:r,expression:n},{cleanup:i})=>{let o=n?g(e,n):()=>{};e.tagName.toLowerCase()==="template"&&(e._x_forwardEvents||(e._x_forwardEvents=[]),e._x_forwardEvents.includes(t)||e._x_forwardEvents.push(t));let s=de(e,t,r,a=>{o(()=>{},{scope:{$event:a},params:[a]})});i(()=>s())}));P.setEvaluator(ct);P.setReactivityEngine({reactive:je,effect:Mr,release:kr,raw:_});var Pt=P;window.Alpine=Pt;queueMicrotask(()=>{Pt.start()});})();
+`:""}`,t),setTimeout(()=>{throw e},0)}var we=!0;function Jt(e){let t=we;we=!1,e(),we=t}function k(e,t,r={}){let n;return g(e,t)(i=>n=i,r),n}function g(...e){return Zt(...e)}var Zt=ut;function Qt(e){Zt=e}function ut(e,t){let r={},n=re(r,e).cleanup;ge(e,"evaluator",n);let i=[r,...P(e)];if(typeof t=="function")return mn(i,t);let o=hn(i,t,e);return Yt.bind(null,e,t,o)}function mn(e,t){return(r=()=>{},{scope:n={},params:i=[]}={})=>{let o=t.apply(I([n,...e]),i);Ee(r,o)}}var ft={};function _n(e,t){if(ft[e])return ft[e];let r=Object.getPrototypeOf(async function(){}).constructor,n=/^[\n\s]*if.*\(.*\)/.test(e)||/^(let|const)\s/.test(e)?`(() => { ${e} })()`:e,o=(()=>{try{return new r(["__self","scope"],`with (scope) { __self.result = ${n} }; __self.finished = true; return __self.result;`)}catch(s){return J(s,t,e),Promise.resolve()}})();return ft[e]=o,o}function hn(e,t,r){let n=_n(t,r);return(i=()=>{},{scope:o={},params:s=[]}={})=>{n.result=void 0,n.finished=!1;let a=I([o,...e]);if(typeof n=="function"){let c=n(n,a).catch(l=>J(l,r,t));n.finished?(Ee(i,n.result,a,s,r),n.result=void 0):c.then(l=>{Ee(i,l,a,s,r)}).catch(l=>J(l,r,t)).finally(()=>n.result=void 0)}}}function Ee(e,t,r,n,i){if(we&&typeof t=="function"){let o=t.apply(r,n);o instanceof Promise?o.then(s=>Ee(e,s,r,n)).catch(s=>J(s,i,t)):e(o)}else e(t)}var dt="x-";function E(e=""){return dt+e}function Xt(e){dt=e}var er={};function d(e,t){er[e]=t}function ne(e,t,r){let n={};return Array.from(t).map(tr((o,s)=>n[o]=s)).filter(rr).map(xn(n,r)).sort(yn).map(o=>gn(e,o))}function nr(e){return Array.from(e).map(tr()).filter(t=>!rr(t))}var pt=!1,ie=new Map,ir=Symbol();function or(e){pt=!0;let t=Symbol();ir=t,ie.set(t,[]);let r=()=>{for(;ie.get(t).length;)ie.get(t).shift()();ie.delete(t)},n=()=>{pt=!1,r()};e(r),n()}function lt(e){let t=[],r=a=>t.push(a),[n,i]=Kt(e);return t.push(i),[{Alpine:D,effect:n,cleanup:r,evaluateLater:g.bind(g,e),evaluate:k.bind(k,e)},()=>t.forEach(a=>a())]}function gn(e,t){let r=()=>{},n=er[t.type]||r,[i,o]=lt(e);ge(e,t.original,o);let s=()=>{e._x_ignore||e._x_ignoreSelf||(n.inline&&n.inline(e,t,i),n=n.bind(n,e,t,i),pt?ie.get(ir).push(n):n())};return s.runCleanups=o,s}var Se=(e,t)=>({name:r,value:n})=>(r.startsWith(e)&&(r=r.replace(e,t)),{name:r,value:n}),Ae=e=>e;function tr(e=()=>{}){return({name:t,value:r})=>{let{name:n,value:i}=sr.reduce((o,s)=>s(o),{name:t,value:r});return n!==t&&e(n,t),{name:n,value:i}}}var sr=[];function Z(e){sr.push(e)}function rr({name:e}){return ar().test(e)}var ar=()=>new RegExp(`^${dt}([^:^.]+)\\b`);function xn(e,t){return({name:r,value:n})=>{let i=r.match(ar()),o=r.match(/:([a-zA-Z0-9\-:]+)/),s=r.match(/\.[^.\]]+(?=[^\]]*$)/g)||[],a=t||e[r]||r;return{type:i?i[1]:null,value:o?o[1]:null,modifiers:s.map(c=>c.replace(".","")),expression:n,original:a}}}var mt="DEFAULT",Oe=["ignore","ref","data","id","bind","init","for","mask","model","modelable","transition","show","if",mt,"teleport","element"];function yn(e,t){let r=Oe.indexOf(e.type)===-1?mt:e.type,n=Oe.indexOf(t.type)===-1?mt:t.type;return Oe.indexOf(r)-Oe.indexOf(n)}function z(e,t,r={}){e.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0,cancelable:!0}))}var ht=[],_t=!1;function Ce(e=()=>{}){return queueMicrotask(()=>{_t||setTimeout(()=>{Te()})}),new Promise(t=>{ht.push(()=>{e(),t()})})}function Te(){for(_t=!1;ht.length;)ht.shift()()}function cr(){_t=!0}function R(e,t){if(typeof ShadowRoot=="function"&&e instanceof ShadowRoot){Array.from(e.children).forEach(i=>R(i,t));return}let r=!1;if(t(e,()=>r=!0),r)return;let n=e.firstElementChild;for(;n;)R(n,t,!1),n=n.nextElementSibling}function O(e,...t){console.warn(`Alpine Warning: ${e}`,...t)}function ur(){document.body||O("Unable to initialize. Trying to load Alpine before `<body>` is available. Did you forget to add `defer` in Alpine's `<script>` tag?"),z(document,"alpine:init"),z(document,"alpine:initializing"),nt(),Ht(t=>w(t,R)),_e(t=>gt(t)),qt((t,r)=>{ne(t,r).forEach(n=>n())});let e=t=>!V(t.parentElement,!0);Array.from(document.querySelectorAll(lr())).filter(e).forEach(t=>{w(t)}),z(document,"alpine:initialized")}var xt=[],fr=[];function dr(){return xt.map(e=>e())}function lr(){return xt.concat(fr).map(e=>e())}function Re(e){xt.push(e)}function Me(e){fr.push(e)}function V(e,t=!1){return Q(e,r=>{if((t?lr():dr()).some(i=>r.matches(i)))return!0})}function Q(e,t){if(!!e){if(t(e))return e;if(e._x_teleportBack&&(e=e._x_teleportBack),!!e.parentElement)return Q(e.parentElement,t)}}function pr(e){return dr().some(t=>e.matches(t))}function w(e,t=R){or(()=>{t(e,(r,n)=>{ne(r,r.attributes).forEach(i=>i()),r._x_ignore&&n()})})}function gt(e){R(e,t=>Xe(t))}function oe(e,t){return Array.isArray(t)?mr(e,t.join(" ")):typeof t=="object"&&t!==null?bn(e,t):typeof t=="function"?oe(e,t()):mr(e,t)}function mr(e,t){let r=o=>o.split(" ").filter(Boolean),n=o=>o.split(" ").filter(s=>!e.classList.contains(s)).filter(Boolean),i=o=>(e.classList.add(...o),()=>{e.classList.remove(...o)});return t=t===!0?t="":t||"",i(n(t))}function bn(e,t){let r=a=>a.split(" ").filter(Boolean),n=Object.entries(t).flatMap(([a,c])=>c?r(a):!1).filter(Boolean),i=Object.entries(t).flatMap(([a,c])=>c?!1:r(a)).filter(Boolean),o=[],s=[];return i.forEach(a=>{e.classList.contains(a)&&(e.classList.remove(a),s.push(a))}),n.forEach(a=>{e.classList.contains(a)||(e.classList.add(a),o.push(a))}),()=>{s.forEach(a=>e.classList.add(a)),o.forEach(a=>e.classList.remove(a))}}function H(e,t){return typeof t=="object"&&t!==null?vn(e,t):wn(e,t)}function vn(e,t){let r={};return Object.entries(t).forEach(([n,i])=>{r[n]=e.style[n],n.startsWith("--")||(n=En(n)),e.style.setProperty(n,i)}),setTimeout(()=>{e.style.length===0&&e.removeAttribute("style")}),()=>{H(e,r)}}function wn(e,t){let r=e.getAttribute("style",t);return e.setAttribute("style",t),()=>{e.setAttribute("style",r||"")}}function En(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function se(e,t=()=>{}){let r=!1;return function(){r?t.apply(this,arguments):(r=!0,e.apply(this,arguments))}}d("transition",(e,{value:t,modifiers:r,expression:n},{evaluate:i})=>{typeof n=="function"&&(n=i(n)),n?Sn(e,n,t):An(e,r,t)});function Sn(e,t,r){hr(e,oe,""),{enter:i=>{e._x_transition.enter.during=i},"enter-start":i=>{e._x_transition.enter.start=i},"enter-end":i=>{e._x_transition.enter.end=i},leave:i=>{e._x_transition.leave.during=i},"leave-start":i=>{e._x_transition.leave.start=i},"leave-end":i=>{e._x_transition.leave.end=i}}[r](t)}function An(e,t,r){hr(e,H);let n=!t.includes("in")&&!t.includes("out")&&!r,i=n||t.includes("in")||["enter"].includes(r),o=n||t.includes("out")||["leave"].includes(r);t.includes("in")&&!n&&(t=t.filter((h,b)=>b<t.indexOf("out"))),t.includes("out")&&!n&&(t=t.filter((h,b)=>b>t.indexOf("out")));let s=!t.includes("opacity")&&!t.includes("scale"),a=s||t.includes("opacity"),c=s||t.includes("scale"),l=a?0:1,u=c?ae(t,"scale",95)/100:1,p=ae(t,"delay",0),y=ae(t,"origin","center"),N="opacity, transform",W=ae(t,"duration",150)/1e3,pe=ae(t,"duration",75)/1e3,f="cubic-bezier(0.4, 0.0, 0.2, 1)";i&&(e._x_transition.enter.during={transformOrigin:y,transitionDelay:p,transitionProperty:N,transitionDuration:`${W}s`,transitionTimingFunction:f},e._x_transition.enter.start={opacity:l,transform:`scale(${u})`},e._x_transition.enter.end={opacity:1,transform:"scale(1)"}),o&&(e._x_transition.leave.during={transformOrigin:y,transitionDelay:p,transitionProperty:N,transitionDuration:`${pe}s`,transitionTimingFunction:f},e._x_transition.leave.start={opacity:1,transform:"scale(1)"},e._x_transition.leave.end={opacity:l,transform:`scale(${u})`})}function hr(e,t,r={}){e._x_transition||(e._x_transition={enter:{during:r,start:r,end:r},leave:{during:r,start:r,end:r},in(n=()=>{},i=()=>{}){Ne(e,t,{during:this.enter.during,start:this.enter.start,end:this.enter.end},n,i)},out(n=()=>{},i=()=>{}){Ne(e,t,{during:this.leave.during,start:this.leave.start,end:this.leave.end},n,i)}})}window.Element.prototype._x_toggleAndCascadeWithTransitions=function(e,t,r,n){let i=()=>{document.visibilityState==="visible"?requestAnimationFrame(r):setTimeout(r)};if(t){e._x_transition&&(e._x_transition.enter||e._x_transition.leave)?e._x_transition.enter&&(Object.entries(e._x_transition.enter.during).length||Object.entries(e._x_transition.enter.start).length||Object.entries(e._x_transition.enter.end).length)?e._x_transition.in(r):i():e._x_transition?e._x_transition.in(r):i();return}e._x_hidePromise=e._x_transition?new Promise((o,s)=>{e._x_transition.out(()=>{},()=>o(n)),e._x_transitioning.beforeCancel(()=>s({isFromCancelledTransition:!0}))}):Promise.resolve(n),queueMicrotask(()=>{let o=_r(e);o?(o._x_hideChildren||(o._x_hideChildren=[]),o._x_hideChildren.push(e)):queueMicrotask(()=>{let s=a=>{let c=Promise.all([a._x_hidePromise,...(a._x_hideChildren||[]).map(s)]).then(([l])=>l());return delete a._x_hidePromise,delete a._x_hideChildren,c};s(e).catch(a=>{if(!a.isFromCancelledTransition)throw a})})})};function _r(e){let t=e.parentNode;if(!!t)return t._x_hidePromise?t:_r(t)}function Ne(e,t,{during:r,start:n,end:i}={},o=()=>{},s=()=>{}){if(e._x_transitioning&&e._x_transitioning.cancel(),Object.keys(r).length===0&&Object.keys(n).length===0&&Object.keys(i).length===0){o(),s();return}let a,c,l;On(e,{start(){a=t(e,n)},during(){c=t(e,r)},before:o,end(){a(),l=t(e,i)},after:s,cleanup(){c(),l()}})}function On(e,t){let r,n,i,o=se(()=>{m(()=>{r=!0,n||t.before(),i||(t.end(),Te()),t.after(),e.isConnected&&t.cleanup(),delete e._x_transitioning})});e._x_transitioning={beforeCancels:[],beforeCancel(s){this.beforeCancels.push(s)},cancel:se(function(){for(;this.beforeCancels.length;)this.beforeCancels.shift()();o()}),finish:o},m(()=>{t.start(),t.during()}),cr(),requestAnimationFrame(()=>{if(r)return;let s=Number(getComputedStyle(e).transitionDuration.replace(/,.*/,"").replace("s",""))*1e3,a=Number(getComputedStyle(e).transitionDelay.replace(/,.*/,"").replace("s",""))*1e3;s===0&&(s=Number(getComputedStyle(e).animationDuration.replace("s",""))*1e3),m(()=>{t.before()}),n=!0,requestAnimationFrame(()=>{r||(m(()=>{t.end()}),Te(),setTimeout(e._x_transitioning.finish,s+a),i=!0)})})}function ae(e,t,r){if(e.indexOf(t)===-1)return r;let n=e[e.indexOf(t)+1];if(!n||t==="scale"&&isNaN(n))return r;if(t==="duration"){let i=n.match(/([0-9]+)ms/);if(i)return i[1]}return t==="origin"&&["top","right","left","center","bottom"].includes(e[e.indexOf(t)+2])?[n,e[e.indexOf(t)+2]].join(" "):n}var yt=!1;function $(e,t=()=>{}){return(...r)=>yt?t(...r):e(...r)}function gr(e,t){t._x_dataStack||(t._x_dataStack=e._x_dataStack),yt=!0,Cn(()=>{Tn(t)}),yt=!1}function Tn(e){let t=!1;w(e,(n,i)=>{R(n,(o,s)=>{if(t&&pr(o))return s();t=!0,i(o,s)})})}function Cn(e){let t=B;Qe((r,n)=>{let i=t(r);return Y(i),()=>{}}),e(),Qe(t)}function ce(e,t,r,n=[]){switch(e._x_bindings||(e._x_bindings=A({})),e._x_bindings[t]=r,t=n.includes("camel")?Pn(t):t,t){case"value":Rn(e,r);break;case"style":Nn(e,r);break;case"class":Mn(e,r);break;default:kn(e,t,r);break}}function Rn(e,t){if(e.type==="radio")e.attributes.value===void 0&&(e.value=t),window.fromModel&&(e.checked=xr(e.value,t));else if(e.type==="checkbox")Number.isInteger(t)?e.value=t:!Number.isInteger(t)&&!Array.isArray(t)&&typeof t!="boolean"&&![null,void 0].includes(t)?e.value=String(t):Array.isArray(t)?e.checked=t.some(r=>xr(r,e.value)):e.checked=!!t;else if(e.tagName==="SELECT")In(e,t);else{if(e.value===t)return;e.value=t}}function Mn(e,t){e._x_undoAddedClasses&&e._x_undoAddedClasses(),e._x_undoAddedClasses=oe(e,t)}function Nn(e,t){e._x_undoAddedStyles&&e._x_undoAddedStyles(),e._x_undoAddedStyles=H(e,t)}function kn(e,t,r){[null,void 0,!1].includes(r)&&$n(t)?e.removeAttribute(t):(yr(t)&&(r=t),Dn(e,t,r))}function Dn(e,t,r){e.getAttribute(t)!=r&&e.setAttribute(t,r)}function In(e,t){let r=[].concat(t).map(n=>n+"");Array.from(e.options).forEach(n=>{n.selected=r.includes(n.value)})}function Pn(e){return e.toLowerCase().replace(/-(\w)/g,(t,r)=>r.toUpperCase())}function xr(e,t){return e==t}function yr(e){return["disabled","checked","required","readonly","hidden","open","selected","autofocus","itemscope","multiple","novalidate","allowfullscreen","allowpaymentrequest","formnovalidate","autoplay","controls","loop","muted","playsinline","default","ismap","reversed","async","defer","nomodule"].includes(e)}function $n(e){return!["aria-pressed","aria-checked","aria-expanded","aria-selected"].includes(e)}function br(e,t,r){if(e._x_bindings&&e._x_bindings[t]!==void 0)return e._x_bindings[t];let n=e.getAttribute(t);return n===null?typeof r=="function"?r():r:yr(t)?!![t,"true"].includes(n):n===""?!0:n}function ke(e,t){var r;return function(){var n=this,i=arguments,o=function(){r=null,e.apply(n,i)};clearTimeout(r),r=setTimeout(o,t)}}function Pe(e,t){let r;return function(){let n=this,i=arguments;r||(e.apply(n,i),r=!0,setTimeout(()=>r=!1,t))}}function vr(e){e(D)}var q={},wr=!1;function Er(e,t){if(wr||(q=A(q),wr=!0),t===void 0)return q[e];q[e]=t,typeof t=="object"&&t!==null&&t.hasOwnProperty("init")&&typeof t.init=="function"&&q[e].init(),be(q[e])}function Sr(){return q}var Ar={};function Or(e,t){Ar[e]=typeof t!="function"?()=>t:t}function Tr(e){return Object.entries(Ar).forEach(([t,r])=>{Object.defineProperty(e,t,{get(){return(...n)=>r(...n)}})}),e}var Cr={};function Rr(e,t){Cr[e]=t}function Mr(e,t){return Object.entries(Cr).forEach(([r,n])=>{Object.defineProperty(e,r,{get(){return(...i)=>n.bind(t)(...i)},enumerable:!1})}),e}var Ln={get reactive(){return A},get release(){return Y},get effect(){return B},get raw(){return Je},version:"3.10.2",flushAndStopDeferringMutations:Wt,dontAutoEvaluateFunctions:Jt,disableEffectScheduling:Ft,stopObservingMutations:it,destroyTree:gt,setReactivityEngine:jt,closestDataStack:P,skipDuringClone:$,addRootSelector:Re,addInitSelector:Me,addScopeToNode:C,deferMutations:Ut,mapAttributes:Z,evaluateLater:g,setEvaluator:Qt,mergeProxies:I,findClosest:Q,closestRoot:V,interceptor:ve,transition:Ne,setStyles:H,mutateDom:m,directive:d,throttle:Pe,debounce:ke,evaluate:k,initTree:w,nextTick:Ce,prefixed:E,prefix:Xt,plugin:vr,magic:x,store:Er,start:ur,clone:gr,bound:br,$data:ye,data:Rr,bind:Or},D=Ln;function bt(e,t){let r=Object.create(null),n=e.split(",");for(let i=0;i<n.length;i++)r[n[i]]=!0;return t?i=>!!r[i.toLowerCase()]:i=>!!r[i]}var ns={[1]:"TEXT",[2]:"CLASS",[4]:"STYLE",[8]:"PROPS",[16]:"FULL_PROPS",[32]:"HYDRATE_EVENTS",[64]:"STABLE_FRAGMENT",[128]:"KEYED_FRAGMENT",[256]:"UNKEYED_FRAGMENT",[512]:"NEED_PATCH",[1024]:"DYNAMIC_SLOTS",[2048]:"DEV_ROOT_FRAGMENT",[-1]:"HOISTED",[-2]:"BAIL"},is={[1]:"STABLE",[2]:"DYNAMIC",[3]:"FORWARDED"};var Fn="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly";var os=bt(Fn+",async,autofocus,autoplay,controls,default,defer,disabled,hidden,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");var Nr=Object.freeze({}),ss=Object.freeze([]);var vt=Object.assign;var jn=Object.prototype.hasOwnProperty,le=(e,t)=>jn.call(e,t),L=Array.isArray,X=e=>kr(e)==="[object Map]";var Kn=e=>typeof e=="string",Ie=e=>typeof e=="symbol",ue=e=>e!==null&&typeof e=="object";var Bn=Object.prototype.toString,kr=e=>Bn.call(e),wt=e=>kr(e).slice(8,-1);var De=e=>Kn(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e;var $e=e=>{let t=Object.create(null);return r=>t[r]||(t[r]=e(r))},zn=/-(\w)/g,as=$e(e=>e.replace(zn,(t,r)=>r?r.toUpperCase():"")),Vn=/\B([A-Z])/g,cs=$e(e=>e.replace(Vn,"-$1").toLowerCase()),Et=$e(e=>e.charAt(0).toUpperCase()+e.slice(1)),ls=$e(e=>e?`on${Et(e)}`:""),St=(e,t)=>e!==t&&(e===e||t===t);var At=new WeakMap,fe=[],M,U=Symbol("iterate"),Ot=Symbol("Map key iterate");function Hn(e){return e&&e._isEffect===!0}function Pr(e,t=Nr){Hn(e)&&(e=e.raw);let r=qn(e,t);return t.lazy||r(),r}function Dr(e){e.active&&(Ir(e),e.options.onStop&&e.options.onStop(),e.active=!1)}var Un=0;function qn(e,t){let r=function(){if(!r.active)return e();if(!fe.includes(r)){Ir(r);try{return Wn(),fe.push(r),M=r,e()}finally{fe.pop(),$r(),M=fe[fe.length-1]}}};return r.id=Un++,r.allowRecurse=!!t.allowRecurse,r._isEffect=!0,r.active=!0,r.raw=e,r.deps=[],r.options=t,r}function Ir(e){let{deps:t}=e;if(t.length){for(let r=0;r<t.length;r++)t[r].delete(e);t.length=0}}var ee=!0,Tt=[];function Gn(){Tt.push(ee),ee=!1}function Wn(){Tt.push(ee),ee=!0}function $r(){let e=Tt.pop();ee=e===void 0?!0:e}function T(e,t,r){if(!ee||M===void 0)return;let n=At.get(e);n||At.set(e,n=new Map);let i=n.get(r);i||n.set(r,i=new Set),i.has(M)||(i.add(M),M.deps.push(i),M.options.onTrack&&M.options.onTrack({effect:M,target:e,type:t,key:r}))}function F(e,t,r,n,i,o){let s=At.get(e);if(!s)return;let a=new Set,c=u=>{u&&u.forEach(p=>{(p!==M||p.allowRecurse)&&a.add(p)})};if(t==="clear")s.forEach(c);else if(r==="length"&&L(e))s.forEach((u,p)=>{(p==="length"||p>=n)&&c(u)});else switch(r!==void 0&&c(s.get(r)),t){case"add":L(e)?De(r)&&c(s.get("length")):(c(s.get(U)),X(e)&&c(s.get(Ot)));break;case"delete":L(e)||(c(s.get(U)),X(e)&&c(s.get(Ot)));break;case"set":X(e)&&c(s.get(U));break}let l=u=>{u.options.onTrigger&&u.options.onTrigger({effect:u,target:e,key:r,type:t,newValue:n,oldValue:i,oldTarget:o}),u.options.scheduler?u.options.scheduler(u):u()};a.forEach(l)}var Yn=bt("__proto__,__v_isRef,__isVue"),Lr=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(Ie)),Jn=Le(),Zn=Le(!1,!0),Qn=Le(!0),Xn=Le(!0,!0),Fe={};["includes","indexOf","lastIndexOf"].forEach(e=>{let t=Array.prototype[e];Fe[e]=function(...r){let n=_(this);for(let o=0,s=this.length;o<s;o++)T(n,"get",o+"");let i=t.apply(n,r);return i===-1||i===!1?t.apply(n,r.map(_)):i}});["push","pop","shift","unshift","splice"].forEach(e=>{let t=Array.prototype[e];Fe[e]=function(...r){Gn();let n=t.apply(this,r);return $r(),n}});function Le(e=!1,t=!1){return function(n,i,o){if(i==="__v_isReactive")return!e;if(i==="__v_isReadonly")return e;if(i==="__v_raw"&&o===(e?t?ti:jr:t?ei:Fr).get(n))return n;let s=L(n);if(!e&&s&&le(Fe,i))return Reflect.get(Fe,i,o);let a=Reflect.get(n,i,o);return(Ie(i)?Lr.has(i):Yn(i))||(e||T(n,"get",i),t)?a:Ct(a)?!s||!De(i)?a.value:a:ue(a)?e?Kr(a):je(a):a}}var ri=Br(),ni=Br(!0);function Br(e=!1){return function(r,n,i,o){let s=r[n];if(!e&&(i=_(i),s=_(s),!L(r)&&Ct(s)&&!Ct(i)))return s.value=i,!0;let a=L(r)&&De(n)?Number(n)<r.length:le(r,n),c=Reflect.set(r,n,i,o);return r===_(o)&&(a?St(i,s)&&F(r,"set",n,i,s):F(r,"add",n,i)),c}}function ii(e,t){let r=le(e,t),n=e[t],i=Reflect.deleteProperty(e,t);return i&&r&&F(e,"delete",t,void 0,n),i}function oi(e,t){let r=Reflect.has(e,t);return(!Ie(t)||!Lr.has(t))&&T(e,"has",t),r}function si(e){return T(e,"iterate",L(e)?"length":U),Reflect.ownKeys(e)}var zr={get:Jn,set:ri,deleteProperty:ii,has:oi,ownKeys:si},Vr={get:Qn,set(e,t){return console.warn(`Set operation on key "${String(t)}" failed: target is readonly.`,e),!0},deleteProperty(e,t){return console.warn(`Delete operation on key "${String(t)}" failed: target is readonly.`,e),!0}},hs=vt({},zr,{get:Zn,set:ni}),_s=vt({},Vr,{get:Xn}),Rt=e=>ue(e)?je(e):e,Mt=e=>ue(e)?Kr(e):e,Nt=e=>e,Ke=e=>Reflect.getPrototypeOf(e);function Be(e,t,r=!1,n=!1){e=e.__v_raw;let i=_(e),o=_(t);t!==o&&!r&&T(i,"get",t),!r&&T(i,"get",o);let{has:s}=Ke(i),a=n?Nt:r?Mt:Rt;if(s.call(i,t))return a(e.get(t));if(s.call(i,o))return a(e.get(o));e!==i&&e.get(t)}function ze(e,t=!1){let r=this.__v_raw,n=_(r),i=_(e);return e!==i&&!t&&T(n,"has",e),!t&&T(n,"has",i),e===i?r.has(e):r.has(e)||r.has(i)}function Ve(e,t=!1){return e=e.__v_raw,!t&&T(_(e),"iterate",U),Reflect.get(e,"size",e)}function Hr(e){e=_(e);let t=_(this);return Ke(t).has.call(t,e)||(t.add(e),F(t,"add",e,e)),this}function Ur(e,t){t=_(t);let r=_(this),{has:n,get:i}=Ke(r),o=n.call(r,e);o?qr(r,n,e):(e=_(e),o=n.call(r,e));let s=i.call(r,e);return r.set(e,t),o?St(t,s)&&F(r,"set",e,t,s):F(r,"add",e,t),this}function Wr(e){let t=_(this),{has:r,get:n}=Ke(t),i=r.call(t,e);i?qr(t,r,e):(e=_(e),i=r.call(t,e));let o=n?n.call(t,e):void 0,s=t.delete(e);return i&&F(t,"delete",e,void 0,o),s}function Gr(){let e=_(this),t=e.size!==0,r=X(e)?new Map(e):new Set(e),n=e.clear();return t&&F(e,"clear",void 0,void 0,r),n}function He(e,t){return function(n,i){let o=this,s=o.__v_raw,a=_(s),c=t?Nt:e?Mt:Rt;return!e&&T(a,"iterate",U),s.forEach((l,u)=>n.call(i,c(l),c(u),o))}}function qe(e,t,r){return function(...n){let i=this.__v_raw,o=_(i),s=X(o),a=e==="entries"||e===Symbol.iterator&&s,c=e==="keys"&&s,l=i[e](...n),u=r?Nt:t?Mt:Rt;return!t&&T(o,"iterate",c?Ot:U),{next(){let{value:p,done:y}=l.next();return y?{value:p,done:y}:{value:a?[u(p[0]),u(p[1])]:u(p),done:y}},[Symbol.iterator](){return this}}}}function j(e){return function(...t){{let r=t[0]?`on key "${t[0]}" `:"";console.warn(`${Et(e)} operation ${r}failed: target is readonly.`,_(this))}return e==="delete"?!1:this}}var Yr={get(e){return Be(this,e)},get size(){return Ve(this)},has:ze,add:Hr,set:Ur,delete:Wr,clear:Gr,forEach:He(!1,!1)},Jr={get(e){return Be(this,e,!1,!0)},get size(){return Ve(this)},has:ze,add:Hr,set:Ur,delete:Wr,clear:Gr,forEach:He(!1,!0)},Zr={get(e){return Be(this,e,!0)},get size(){return Ve(this,!0)},has(e){return ze.call(this,e,!0)},add:j("add"),set:j("set"),delete:j("delete"),clear:j("clear"),forEach:He(!0,!1)},Qr={get(e){return Be(this,e,!0,!0)},get size(){return Ve(this,!0)},has(e){return ze.call(this,e,!0)},add:j("add"),set:j("set"),delete:j("delete"),clear:j("clear"),forEach:He(!0,!0)},ai=["keys","values","entries",Symbol.iterator];ai.forEach(e=>{Yr[e]=qe(e,!1,!1),Zr[e]=qe(e,!0,!1),Jr[e]=qe(e,!1,!0),Qr[e]=qe(e,!0,!0)});function Ue(e,t){let r=t?e?Qr:Jr:e?Zr:Yr;return(n,i,o)=>i==="__v_isReactive"?!e:i==="__v_isReadonly"?e:i==="__v_raw"?n:Reflect.get(le(r,i)&&i in n?r:n,i,o)}var ci={get:Ue(!1,!1)},gs={get:Ue(!1,!0)},li={get:Ue(!0,!1)},xs={get:Ue(!0,!0)};function qr(e,t,r){let n=_(r);if(n!==r&&t.call(e,n)){let i=wt(e);console.warn(`Reactive ${i} contains both the raw and reactive versions of the same object${i==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}var Fr=new WeakMap,ei=new WeakMap,jr=new WeakMap,ti=new WeakMap;function ui(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function fi(e){return e.__v_skip||!Object.isExtensible(e)?0:ui(wt(e))}function je(e){return e&&e.__v_isReadonly?e:Xr(e,!1,zr,ci,Fr)}function Kr(e){return Xr(e,!0,Vr,li,jr)}function Xr(e,t,r,n,i){if(!ue(e))return console.warn(`value cannot be made reactive: ${String(e)}`),e;if(e.__v_raw&&!(t&&e.__v_isReactive))return e;let o=i.get(e);if(o)return o;let s=fi(e);if(s===0)return e;let a=new Proxy(e,s===2?n:r);return i.set(e,a),a}function _(e){return e&&_(e.__v_raw)||e}function Ct(e){return Boolean(e&&e.__v_isRef===!0)}x("nextTick",()=>Ce);x("dispatch",e=>z.bind(z,e));x("watch",(e,{evaluateLater:t,effect:r})=>(n,i)=>{let o=t(n),s=!0,a,c=r(()=>o(l=>{JSON.stringify(l),s?a=l:queueMicrotask(()=>{i(l,a),a=l}),s=!1}));e._x_effects.delete(c)});x("store",Sr);x("data",e=>ye(e));x("root",e=>V(e));x("refs",e=>(e._x_refs_proxy||(e._x_refs_proxy=I(di(e))),e._x_refs_proxy));function di(e){let t=[],r=e;for(;r;)r._x_refs&&t.push(r._x_refs),r=r.parentNode;return t}var kt={};function Pt(e){return kt[e]||(kt[e]=0),++kt[e]}function en(e,t){return Q(e,r=>{if(r._x_ids&&r._x_ids[t])return!0})}function tn(e,t){e._x_ids||(e._x_ids={}),e._x_ids[t]||(e._x_ids[t]=Pt(t))}x("id",e=>(t,r=null)=>{let n=en(e,t),i=n?n._x_ids[t]:Pt(t);return r?`${t}-${i}-${r}`:`${t}-${i}`});x("el",e=>e);rn("Focus","focus","focus");rn("Persist","persist","persist");function rn(e,t,r){x(t,n=>O(`You can't use [$${directiveName}] without first installing the "${e}" plugin here: https://alpinejs.dev/plugins/${r}`,n))}d("modelable",(e,{expression:t},{effect:r,evaluateLater:n})=>{let i=n(t),o=()=>{let l;return i(u=>l=u),l},s=n(`${t} = __placeholder`),a=l=>s(()=>{},{scope:{__placeholder:l}}),c=o();a(c),queueMicrotask(()=>{if(!e._x_model)return;e._x_removeModelListeners.default();let l=e._x_model.get,u=e._x_model.set;r(()=>a(l())),r(()=>u(o()))})});d("teleport",(e,{expression:t},{cleanup:r})=>{e.tagName.toLowerCase()!=="template"&&O("x-teleport can only be used on a <template> tag",e);let n=document.querySelector(t);n||O(`Cannot find x-teleport element for selector: "${t}"`);let i=e.content.cloneNode(!0).firstElementChild;e._x_teleport=i,i._x_teleportBack=e,e._x_forwardEvents&&e._x_forwardEvents.forEach(o=>{i.addEventListener(o,s=>{s.stopPropagation(),e.dispatchEvent(new s.constructor(s.type,s))})}),C(i,{},e),m(()=>{n.appendChild(i),w(i),i._x_ignore=!0}),r(()=>i.remove())});var nn=()=>{};nn.inline=(e,{modifiers:t},{cleanup:r})=>{t.includes("self")?e._x_ignoreSelf=!0:e._x_ignore=!0,r(()=>{t.includes("self")?delete e._x_ignoreSelf:delete e._x_ignore})};d("ignore",nn);d("effect",(e,{expression:t},{effect:r})=>r(g(e,t)));function de(e,t,r,n){let i=e,o=c=>n(c),s={},a=(c,l)=>u=>l(c,u);if(r.includes("dot")&&(t=pi(t)),r.includes("camel")&&(t=mi(t)),r.includes("passive")&&(s.passive=!0),r.includes("capture")&&(s.capture=!0),r.includes("window")&&(i=window),r.includes("document")&&(i=document),r.includes("prevent")&&(o=a(o,(c,l)=>{l.preventDefault(),c(l)})),r.includes("stop")&&(o=a(o,(c,l)=>{l.stopPropagation(),c(l)})),r.includes("self")&&(o=a(o,(c,l)=>{l.target===e&&c(l)})),(r.includes("away")||r.includes("outside"))&&(i=document,o=a(o,(c,l)=>{e.contains(l.target)||l.target.isConnected!==!1&&(e.offsetWidth<1&&e.offsetHeight<1||e._x_isShown!==!1&&c(l))})),r.includes("once")&&(o=a(o,(c,l)=>{c(l),i.removeEventListener(t,o,s)})),o=a(o,(c,l)=>{hi(t)&&_i(l,r)||c(l)}),r.includes("debounce")){let c=r[r.indexOf("debounce")+1]||"invalid-wait",l=It(c.split("ms")[0])?Number(c.split("ms")[0]):250;o=ke(o,l)}if(r.includes("throttle")){let c=r[r.indexOf("throttle")+1]||"invalid-wait",l=It(c.split("ms")[0])?Number(c.split("ms")[0]):250;o=Pe(o,l)}return i.addEventListener(t,o,s),()=>{i.removeEventListener(t,o,s)}}function pi(e){return e.replace(/-/g,".")}function mi(e){return e.toLowerCase().replace(/-(\w)/g,(t,r)=>r.toUpperCase())}function It(e){return!Array.isArray(e)&&!isNaN(e)}function gi(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[_\s]/,"-").toLowerCase()}function hi(e){return["keydown","keyup"].includes(e)}function _i(e,t){let r=t.filter(o=>!["window","document","prevent","stop","once"].includes(o));if(r.includes("debounce")){let o=r.indexOf("debounce");r.splice(o,It((r[o+1]||"invalid-wait").split("ms")[0])?2:1)}if(r.length===0||r.length===1&&on(e.key).includes(r[0]))return!1;let i=["ctrl","shift","alt","meta","cmd","super"].filter(o=>r.includes(o));return r=r.filter(o=>!i.includes(o)),!(i.length>0&&i.filter(s=>((s==="cmd"||s==="super")&&(s="meta"),e[`${s}Key`])).length===i.length&&on(e.key).includes(r[0]))}function on(e){if(!e)return[];e=gi(e);let t={ctrl:"control",slash:"/",space:"-",spacebar:"-",cmd:"meta",esc:"escape",up:"arrow-up",down:"arrow-down",left:"arrow-left",right:"arrow-right",period:".",equal:"="};return t[e]=e,Object.keys(t).map(r=>{if(t[r]===e)return r}).filter(r=>r)}d("model",(e,{modifiers:t,expression:r},{effect:n,cleanup:i})=>{let o=g(e,r),s=`${r} = rightSideOfExpression($event, ${r})`,a=g(e,s);var c=e.tagName.toLowerCase()==="select"||["checkbox","radio"].includes(e.type)||t.includes("lazy")?"change":"input";let l=xi(e,t,r),u=de(e,c,t,y=>{a(()=>{},{scope:{$event:y,rightSideOfExpression:l}})});e._x_removeModelListeners||(e._x_removeModelListeners={}),e._x_removeModelListeners.default=u,i(()=>e._x_removeModelListeners.default());let p=g(e,`${r} = __placeholder`);e._x_model={get(){let y;return o(N=>y=N),y},set(y){p(()=>{},{scope:{__placeholder:y}})}},e._x_forceModelUpdate=()=>{o(y=>{y===void 0&&r.match(/\./)&&(y=""),window.fromModel=!0,m(()=>ce(e,"value",y)),delete window.fromModel})},n(()=>{t.includes("unintrusive")&&document.activeElement.isSameNode(e)||e._x_forceModelUpdate()})});function xi(e,t,r){return e.type==="radio"&&m(()=>{e.hasAttribute("name")||e.setAttribute("name",r)}),(n,i)=>m(()=>{if(n instanceof CustomEvent&&n.detail!==void 0)return n.detail||n.target.value;if(e.type==="checkbox")if(Array.isArray(i)){let o=t.includes("number")?Dt(n.target.value):n.target.value;return n.target.checked?i.concat([o]):i.filter(s=>!yi(s,o))}else return n.target.checked;else{if(e.tagName.toLowerCase()==="select"&&e.multiple)return t.includes("number")?Array.from(n.target.selectedOptions).map(o=>{let s=o.value||o.text;return Dt(s)}):Array.from(n.target.selectedOptions).map(o=>o.value||o.text);{let o=n.target.value;return t.includes("number")?Dt(o):t.includes("trim")?o.trim():o}}})}function Dt(e){let t=e?parseFloat(e):null;return bi(t)?t:e}function yi(e,t){return e==t}function bi(e){return!Array.isArray(e)&&!isNaN(e)}d("cloak",e=>queueMicrotask(()=>m(()=>e.removeAttribute(E("cloak")))));Me(()=>`[${E("init")}]`);d("init",$((e,{expression:t},{evaluate:r})=>typeof t=="string"?!!t.trim()&&r(t,{},!1):r(t,{},!1)));d("text",(e,{expression:t},{effect:r,evaluateLater:n})=>{let i=n(t);r(()=>{i(o=>{m(()=>{e.textContent=o})})})});d("html",(e,{expression:t},{effect:r,evaluateLater:n})=>{let i=n(t);r(()=>{i(o=>{m(()=>{e.innerHTML=o,e._x_ignoreSelf=!0,w(e),delete e._x_ignoreSelf})})})});Z(Se(":",Ae(E("bind:"))));d("bind",(e,{value:t,modifiers:r,expression:n,original:i},{effect:o})=>{if(!t)return vi(e,n,i,o);if(t==="key")return wi(e,n);let s=g(e,n);o(()=>s(a=>{a===void 0&&n.match(/\./)&&(a=""),m(()=>ce(e,t,a,r))}))});function vi(e,t,r,n){let i={};Tr(i);let o=g(e,t),s=[];for(;s.length;)s.pop()();o(a=>{let c=Object.entries(a).map(([u,p])=>({name:u,value:p})),l=nr(c);c=c.map(u=>l.find(p=>p.name===u.name)?{name:`x-bind:${u.name}`,value:`"${u.value}"`}:u),ne(e,c,r).map(u=>{s.push(u.runCleanups),u()})},{scope:i})}function wi(e,t){e._x_keyExpression=t}Re(()=>`[${E("data")}]`);d("data",$((e,{expression:t},{cleanup:r})=>{t=t===""?"{}":t;let n={},i=re(n,e).cleanup,o={};Mr(o,n);let s=k(e,t,{scope:o});s===void 0&&(s={});let a=re(s,e).cleanup,c=A(s);be(c);let l=C(e,c);c.init&&k(e,c.init),r(()=>{l(),i(),a(),c.destroy&&k(e,c.destroy),l()})}));d("show",(e,{modifiers:t,expression:r},{effect:n})=>{let i=g(e,r);e._x_doHide||(e._x_doHide=()=>{m(()=>e.style.display="none")}),e._x_doShow||(e._x_doShow=()=>{m(()=>{e.style.length===1&&e.style.display==="none"?e.removeAttribute("style"):e.style.removeProperty("display")})});let o=()=>{e._x_doHide(),e._x_isShown=!1},s=()=>{e._x_doShow(),e._x_isShown=!0},a=()=>setTimeout(s),c=se(p=>p?s():o(),p=>{typeof e._x_toggleAndCascadeWithTransitions=="function"?e._x_toggleAndCascadeWithTransitions(e,p,s,o):p?a():o()}),l,u=!0;n(()=>i(p=>{!u&&p===l||(t.includes("immediate")&&(p?a():o()),c(p),l=p,u=!1)}))});d("for",(e,{expression:t},{effect:r,cleanup:n})=>{let i=Si(t),o=g(e,i.items),s=g(e,e._x_keyExpression||"index");e._x_prevKeys=[],e._x_lookup={},r(()=>Ei(e,i,o,s)),n(()=>{Object.values(e._x_lookup).forEach(a=>a.remove()),delete e._x_prevKeys,delete e._x_lookup})});function Ei(e,t,r,n){let i=s=>typeof s=="object"&&!Array.isArray(s),o=e;r(s=>{Ai(s)&&s>=0&&(s=Array.from(Array(s).keys(),f=>f+1)),s===void 0&&(s=[]);let a=e._x_lookup,c=e._x_prevKeys,l=[],u=[];if(i(s))s=Object.entries(s).map(([f,h])=>{let b=sn(t,h,f,s);n(v=>u.push(v),{scope:{index:f,...b}}),l.push(b)});else for(let f=0;f<s.length;f++){let h=sn(t,s[f],f,s);n(b=>u.push(b),{scope:{index:f,...h}}),l.push(h)}let p=[],y=[],N=[],W=[];for(let f=0;f<c.length;f++){let h=c[f];u.indexOf(h)===-1&&N.push(h)}c=c.filter(f=>!N.includes(f));let pe="template";for(let f=0;f<u.length;f++){let h=u[f],b=c.indexOf(h);if(b===-1)c.splice(f,0,h),p.push([pe,f]);else if(b!==f){let v=c.splice(f,1)[0],S=c.splice(b-1,1)[0];c.splice(f,0,S),c.splice(b,0,v),y.push([v,S])}else W.push(h);pe=h}for(let f=0;f<N.length;f++){let h=N[f];a[h]._x_effects&&a[h]._x_effects.forEach(he),a[h].remove(),a[h]=null,delete a[h]}for(let f=0;f<y.length;f++){let[h,b]=y[f],v=a[h],S=a[b],G=document.createElement("div");m(()=>{S.after(G),v.after(S),S._x_currentIfEl&&S.after(S._x_currentIfEl),G.before(v),v._x_currentIfEl&&v.after(v._x_currentIfEl),G.remove()}),at(S,l[u.indexOf(b)])}for(let f=0;f<p.length;f++){let[h,b]=p[f],v=h==="template"?o:a[h];v._x_currentIfEl&&(v=v._x_currentIfEl);let S=l[b],G=u[b],me=document.importNode(o.content,!0).firstElementChild;C(me,A(S),o),m(()=>{v.after(me),w(me)}),typeof G=="object"&&O("x-for key cannot be an object, it must be a string or an integer",o),a[G]=me}for(let f=0;f<W.length;f++)at(a[W[f]],l[u.indexOf(W[f])]);o._x_prevKeys=u})}function Si(e){let t=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,r=/^\s*\(|\)\s*$/g,n=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,i=e.match(n);if(!i)return;let o={};o.items=i[2].trim();let s=i[1].replace(r,"").trim(),a=s.match(t);return a?(o.item=s.replace(t,"").trim(),o.index=a[1].trim(),a[2]&&(o.collection=a[2].trim())):o.item=s,o}function sn(e,t,r,n){let i={};return/^\[.*\]$/.test(e.item)&&Array.isArray(t)?e.item.replace("[","").replace("]","").split(",").map(s=>s.trim()).forEach((s,a)=>{i[s]=t[a]}):/^\{.*\}$/.test(e.item)&&!Array.isArray(t)&&typeof t=="object"?e.item.replace("{","").replace("}","").split(",").map(s=>s.trim()).forEach(s=>{i[s]=t[s]}):i[e.item]=t,e.index&&(i[e.index]=r),e.collection&&(i[e.collection]=n),i}function Ai(e){return!Array.isArray(e)&&!isNaN(e)}function an(){}an.inline=(e,{expression:t},{cleanup:r})=>{let n=V(e);n._x_refs||(n._x_refs={}),n._x_refs[t]=e,r(()=>delete n._x_refs[t])};d("ref",an);d("if",(e,{expression:t},{effect:r,cleanup:n})=>{let i=g(e,t),o=()=>{if(e._x_currentIfEl)return e._x_currentIfEl;let a=e.content.cloneNode(!0).firstElementChild;return C(a,{},e),m(()=>{e.after(a),w(a)}),e._x_currentIfEl=a,e._x_undoIf=()=>{R(a,c=>{c._x_effects&&c._x_effects.forEach(he)}),a.remove(),delete e._x_currentIfEl},a},s=()=>{!e._x_undoIf||(e._x_undoIf(),delete e._x_undoIf)};r(()=>i(a=>{a?o():s()})),n(()=>e._x_undoIf&&e._x_undoIf())});d("id",(e,{expression:t},{evaluate:r})=>{r(t).forEach(i=>tn(e,i))});Z(Se("@",Ae(E("on:"))));d("on",$((e,{value:t,modifiers:r,expression:n},{cleanup:i})=>{let o=n?g(e,n):()=>{};e.tagName.toLowerCase()==="template"&&(e._x_forwardEvents||(e._x_forwardEvents=[]),e._x_forwardEvents.includes(t)||e._x_forwardEvents.push(t));let s=de(e,t,r,a=>{o(()=>{},{scope:{$event:a},params:[a]})});i(()=>s())}));We("Collapse","collapse","collapse");We("Intersect","intersect","intersect");We("Focus","trap","focus");We("Mask","mask","mask");function We(e,t,r){d(t,n=>O(`You can't use [x-${t}] without first installing the "${e}" plugin here: https://alpinejs.dev/plugins/${r}`,n))}D.setEvaluator(ut);D.setReactivityEngine({reactive:je,effect:Pr,release:Dr,raw:_});var $t=D;window.Alpine=$t;queueMicrotask(()=>{$t.start()});})();
diff --git a/alpinejs/packages/alpinejs/dist/module.cjs.js b/alpinejs/packages/alpinejs/dist/module.cjs.js
index fc40a5e..7813685 100644
--- a/alpinejs/packages/alpinejs/dist/module.cjs.js
+++ b/alpinejs/packages/alpinejs/dist/module.cjs.js
@@ -1341,6 +1341,7 @@ function elementBoundEffect(el) {
el._x_effects.delete(effectReference);
release(effectReference);
};
+ return effectReference;
};
return [wrappedEffect, () => {
cleanup();
@@ -1692,6 +1693,13 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
}
// packages/alpinejs/src/evaluator.js
+var shouldAutoEvaluateFunctions = true;
+function dontAutoEvaluateFunctions(callback) {
+ let cache = shouldAutoEvaluateFunctions;
+ shouldAutoEvaluateFunctions = false;
+ callback();
+ shouldAutoEvaluateFunctions = cache;
+}
function evaluate(el, expression, extras = {}) {
let result;
evaluateLater(el, expression)((value) => result = value, extras);
@@ -1763,7 +1771,7 @@ function generateEvaluatorFromString(dataStack, expression, el) {
};
}
function runIfTypeOfFunction(receiver, value, scope2, params, el) {
- if (typeof value === "function") {
+ if (shouldAutoEvaluateFunctions && typeof value === "function") {
let result = value.apply(scope2, params);
if (result instanceof Promise) {
result.then((i) => runIfTypeOfFunction(receiver, i, scope2, params)).catch((error2) => handleError(error2, el, value));
@@ -1897,6 +1905,7 @@ var directiveOrder = [
"bind",
"init",
"for",
+ "mask",
"model",
"modelable",
"transition",
@@ -1925,13 +1934,19 @@ function dispatch(el, name, detail = {}) {
// packages/alpinejs/src/nextTick.js
var tickStack = [];
var isHolding = false;
-function nextTick(callback) {
- tickStack.push(callback);
+function nextTick(callback = () => {
+}) {
queueMicrotask(() => {
isHolding || setTimeout(() => {
releaseNextTicks();
});
});
+ return new Promise((res) => {
+ tickStack.push(() => {
+ callback();
+ res();
+ });
+ });
}
function releaseNextTicks() {
isHolding = false;
@@ -2679,8 +2694,9 @@ var Alpine = {
get raw() {
return raw;
},
- version: "3.9.1",
+ version: "3.10.2",
flushAndStopDeferringMutations,
+ dontAutoEvaluateFunctions,
disableEffectScheduling,
stopObservingMutations,
destroyTree,
@@ -2735,7 +2751,7 @@ magic("watch", (el, {evaluateLater: evaluateLater2, effect: effect3}) => (key, c
let evaluate2 = evaluateLater2(key);
let firstTime = true;
let oldValue;
- effect3(() => evaluate2((value) => {
+ let effectReference = effect3(() => evaluate2((value) => {
JSON.stringify(value);
if (!firstTime) {
queueMicrotask(() => {
@@ -2747,6 +2763,7 @@ magic("watch", (el, {evaluateLater: evaluateLater2, effect: effect3}) => (key, c
}
firstTime = false;
}));
+ el._x_effects.delete(effectReference);
});
// packages/alpinejs/src/magics/$store.js
@@ -2806,8 +2823,15 @@ magic("id", (el) => (name, key = null) => {
// packages/alpinejs/src/magics/$el.js
magic("el", (el) => el);
+// packages/alpinejs/src/magics/index.js
+warnMissingPluginMagic("Focus", "focus", "focus");
+warnMissingPluginMagic("Persist", "persist", "persist");
+function warnMissingPluginMagic(name, magicName, slug) {
+ magic(magicName, (el) => warn(`You can't use [$${directiveName}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el));
+}
+
// packages/alpinejs/src/directives/x-modelable.js
-directive("modelable", (el, {expression}, {effect: effect3, evaluate: evaluate2, evaluateLater: evaluateLater2}) => {
+directive("modelable", (el, {expression}, {effect: effect3, evaluateLater: evaluateLater2}) => {
let func = evaluateLater2(expression);
let innerGet = () => {
let result;
@@ -2818,12 +2842,11 @@ directive("modelable", (el, {expression}, {effect: effect3, evaluate: evaluate2,
let innerSet = (val) => evaluateInnerSet(() => {
}, {scope: {__placeholder: val}});
let initialValue = innerGet();
- if (el._x_modelable_hook)
- initialValue = el._x_modelable_hook(initialValue);
innerSet(initialValue);
queueMicrotask(() => {
if (!el._x_model)
return;
+ el._x_removeModelListeners["default"]();
let outerGet = el._x_model.get;
let outerSet = el._x_model.set;
effect3(() => innerSet(outerGet()));
@@ -2909,6 +2932,8 @@ function on(el, event, modifiers, callback) {
handler3 = wrapHandler(handler3, (next, e) => {
if (el.contains(e.target))
return;
+ if (e.target.isConnected === false)
+ return;
if (el.offsetWidth < 1 && el.offsetHeight < 1)
return;
if (el._x_isShown === false)
@@ -2916,6 +2941,12 @@ function on(el, event, modifiers, callback) {
next(e);
});
}
+ if (modifiers.includes("once")) {
+ handler3 = wrapHandler(handler3, (next, e) => {
+ next(e);
+ listenerTarget.removeEventListener(event, handler3, options);
+ });
+ }
handler3 = wrapHandler(handler3, (next, e) => {
if (isKeyEvent(event)) {
if (isListeningForASpecificKeyThatHasntBeenPressed(e, modifiers)) {
@@ -2934,12 +2965,6 @@ function on(el, event, modifiers, callback) {
let wait = isNumeric(nextModifier.split("ms")[0]) ? Number(nextModifier.split("ms")[0]) : 250;
handler3 = throttle(handler3, wait);
}
- if (modifiers.includes("once")) {
- handler3 = wrapHandler(handler3, (next, e) => {
- next(e);
- listenerTarget.removeEventListener(event, handler3, options);
- });
- }
listenerTarget.addEventListener(event, handler3, options);
return () => {
listenerTarget.removeEventListener(event, handler3, options);
@@ -3027,7 +3052,10 @@ directive("model", (el, {modifiers, expression}, {effect: effect3, cleanup}) =>
rightSideOfExpression: assigmentFunction
}});
});
- cleanup(() => removeListener());
+ if (!el._x_removeModelListeners)
+ el._x_removeModelListeners = {};
+ el._x_removeModelListeners["default"] = removeListener;
+ cleanup(() => el._x_removeModelListeners["default"]());
let evaluateSetModel = evaluateLater(el, `${expression} = __placeholder`);
el._x_model = {
get() {
@@ -3127,7 +3155,12 @@ directive("html", (el, {expression}, {effect: effect3, evaluateLater: evaluateLa
let evaluate2 = evaluateLater2(expression);
effect3(() => {
evaluate2((value) => {
- el.innerHTML = value;
+ mutateDom(() => {
+ el.innerHTML = value;
+ el._x_ignoreSelf = true;
+ initTree(el);
+ delete el._x_ignoreSelf;
+ });
});
});
});
@@ -3197,24 +3230,35 @@ directive("data", skipDuringClone((el, {expression}, {cleanup}) => {
cleanup1();
cleanup2();
reactiveData["destroy"] && evaluate(el, reactiveData["destroy"]);
+ undo();
});
}));
// packages/alpinejs/src/directives/x-show.js
directive("show", (el, {modifiers, expression}, {effect: effect3}) => {
let evaluate2 = evaluateLater(el, expression);
- let hide = () => mutateDom(() => {
- el.style.display = "none";
+ if (!el._x_doHide)
+ el._x_doHide = () => {
+ mutateDom(() => el.style.display = "none");
+ };
+ if (!el._x_doShow)
+ el._x_doShow = () => {
+ mutateDom(() => {
+ if (el.style.length === 1 && el.style.display === "none") {
+ el.removeAttribute("style");
+ } else {
+ el.style.removeProperty("display");
+ }
+ });
+ };
+ let hide = () => {
+ el._x_doHide();
el._x_isShown = false;
- });
- let show = () => mutateDom(() => {
- if (el.style.length === 1 && el.style.display === "none") {
- el.removeAttribute("style");
- } else {
- el.style.removeProperty("display");
- }
+ };
+ let show = () => {
+ el._x_doShow();
el._x_isShown = true;
- });
+ };
let clickAwayCompatibleShow = () => setTimeout(show);
let toggle = once((value) => value ? show() : hide(), (value) => {
if (typeof el._x_toggleAndCascadeWithTransitions === "function") {
@@ -3471,6 +3515,15 @@ directive("on", skipDuringClone((el, {value, modifiers, expression}, {cleanup})
cleanup(() => removeListener());
}));
+// packages/alpinejs/src/directives/index.js
+warnMissingPluginDirective("Collapse", "collapse", "collapse");
+warnMissingPluginDirective("Intersect", "intersect", "intersect");
+warnMissingPluginDirective("Focus", "trap", "focus");
+warnMissingPluginDirective("Mask", "mask", "mask");
+function warnMissingPluginDirective(name, directiveName2, slug) {
+ directive(directiveName2, (el) => warn(`You can't use [x-${directiveName2}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el));
+}
+
// packages/alpinejs/src/index.js
alpine_default.setEvaluator(normalEvaluator);
alpine_default.setReactivityEngine({reactive: import_reactivity8.reactive, effect: import_reactivity8.effect, release: import_reactivity8.stop, raw: import_reactivity8.toRaw});
diff --git a/alpinejs/packages/alpinejs/dist/module.esm.js b/alpinejs/packages/alpinejs/dist/module.esm.js
index 054b727..5e8eed0 100644
--- a/alpinejs/packages/alpinejs/dist/module.esm.js
+++ b/alpinejs/packages/alpinejs/dist/module.esm.js
@@ -1,1259 +1,3 @@
-var __create = Object.create;
-var __defProp = Object.defineProperty;
-var __getProtoOf = Object.getPrototypeOf;
-var __hasOwnProp = Object.prototype.hasOwnProperty;
-var __getOwnPropNames = Object.getOwnPropertyNames;
-var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
-var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
-var __commonJS = (callback, module) => () => {
- if (!module) {
- module = {exports: {}};
- callback(module.exports, module);
- }
- return module.exports;
-};
-var __exportStar = (target, module, desc) => {
- if (module && typeof module === "object" || typeof module === "function") {
- for (let key of __getOwnPropNames(module))
- if (!__hasOwnProp.call(target, key) && key !== "default")
- __defProp(target, key, {get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable});
- }
- return target;
-};
-var __toModule = (module) => {
- return __exportStar(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? {get: () => module.default, enumerable: true} : {value: module, enumerable: true})), module);
-};
-
-// node_modules/@vue/shared/dist/shared.cjs.js
-var require_shared_cjs = __commonJS((exports) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", {value: true});
- function makeMap(str, expectsLowerCase) {
- const map = Object.create(null);
- const list = str.split(",");
- for (let i = 0; i < list.length; i++) {
- map[list[i]] = true;
- }
- return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
- }
- var PatchFlagNames = {
- [1]: `TEXT`,
- [2]: `CLASS`,
- [4]: `STYLE`,
- [8]: `PROPS`,
- [16]: `FULL_PROPS`,
- [32]: `HYDRATE_EVENTS`,
- [64]: `STABLE_FRAGMENT`,
- [128]: `KEYED_FRAGMENT`,
- [256]: `UNKEYED_FRAGMENT`,
- [512]: `NEED_PATCH`,
- [1024]: `DYNAMIC_SLOTS`,
- [2048]: `DEV_ROOT_FRAGMENT`,
- [-1]: `HOISTED`,
- [-2]: `BAIL`
- };
- var slotFlagsText = {
- [1]: "STABLE",
- [2]: "DYNAMIC",
- [3]: "FORWARDED"
- };
- var GLOBALS_WHITE_LISTED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt";
- var isGloballyWhitelisted = /* @__PURE__ */ makeMap(GLOBALS_WHITE_LISTED);
- var range = 2;
- function generateCodeFrame(source, start2 = 0, end = source.length) {
- const lines = source.split(/\r?\n/);
- let count = 0;
- const res = [];
- for (let i = 0; i < lines.length; i++) {
- count += lines[i].length + 1;
- if (count >= start2) {
- for (let j = i - range; j <= i + range || end > count; j++) {
- if (j < 0 || j >= lines.length)
- continue;
- const line = j + 1;
- res.push(`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);
- const lineLength = lines[j].length;
- if (j === i) {
- const pad = start2 - (count - lineLength) + 1;
- const length = Math.max(1, end > count ? lineLength - pad : end - start2);
- res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
- } else if (j > i) {
- if (end > count) {
- const length = Math.max(Math.min(end - count, lineLength), 1);
- res.push(` | ` + "^".repeat(length));
- }
- count += lineLength + 1;
- }
- }
- break;
- }
- }
- return res.join("\n");
- }
- var specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
- var isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
- var isBooleanAttr2 = /* @__PURE__ */ makeMap(specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`);
- var unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
- var attrValidationCache = {};
- function isSSRSafeAttrName(name) {
- if (attrValidationCache.hasOwnProperty(name)) {
- return attrValidationCache[name];
- }
- const isUnsafe = unsafeAttrCharRE.test(name);
- if (isUnsafe) {
- console.error(`unsafe attribute name: ${name}`);
- }
- return attrValidationCache[name] = !isUnsafe;
- }
- var propsToAttrMap = {
- acceptCharset: "accept-charset",
- className: "class",
- htmlFor: "for",
- httpEquiv: "http-equiv"
- };
- var isNoUnitNumericStyleProp = /* @__PURE__ */ makeMap(`animation-iteration-count,border-image-outset,border-image-slice,border-image-width,box-flex,box-flex-group,box-ordinal-group,column-count,columns,flex,flex-grow,flex-positive,flex-shrink,flex-negative,flex-order,grid-row,grid-row-end,grid-row-span,grid-row-start,grid-column,grid-column-end,grid-column-span,grid-column-start,font-weight,line-clamp,line-height,opacity,order,orphans,tab-size,widows,z-index,zoom,fill-opacity,flood-opacity,stop-opacity,stroke-dasharray,stroke-dashoffset,stroke-miterlimit,stroke-opacity,stroke-width`);
- var isKnownAttr = /* @__PURE__ */ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`);
- function normalizeStyle(value) {
- if (isArray(value)) {
- const res = {};
- for (let i = 0; i < value.length; i++) {
- const item = value[i];
- const normalized = normalizeStyle(isString(item) ? parseStringStyle(item) : item);
- if (normalized) {
- for (const key in normalized) {
- res[key] = normalized[key];
- }
- }
- }
- return res;
- } else if (isObject(value)) {
- return value;
- }
- }
- var listDelimiterRE = /;(?![^(]*\))/g;
- var propertyDelimiterRE = /:(.+)/;
- function parseStringStyle(cssText) {
- const ret = {};
- cssText.split(listDelimiterRE).forEach((item) => {
- if (item) {
- const tmp = item.split(propertyDelimiterRE);
- tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
- }
- });
- return ret;
- }
- function stringifyStyle(styles) {
- let ret = "";
- if (!styles) {
- return ret;
- }
- for (const key in styles) {
- const value = styles[key];
- const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
- if (isString(value) || typeof value === "number" && isNoUnitNumericStyleProp(normalizedKey)) {
- ret += `${normalizedKey}:${value};`;
- }
- }
- return ret;
- }
- function normalizeClass(value) {
- let res = "";
- if (isString(value)) {
- res = value;
- } else if (isArray(value)) {
- for (let i = 0; i < value.length; i++) {
- const normalized = normalizeClass(value[i]);
- if (normalized) {
- res += normalized + " ";
- }
- }
- } else if (isObject(value)) {
- for (const name in value) {
- if (value[name]) {
- res += name + " ";
- }
- }
- }
- return res.trim();
- }
- var HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
- var SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
- var VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
- var isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
- var isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
- var isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
- var escapeRE = /["'&<>]/;
- function escapeHtml(string) {
- const str = "" + string;
- const match = escapeRE.exec(str);
- if (!match) {
- return str;
- }
- let html = "";
- let escaped;
- let index;
- let lastIndex = 0;
- for (index = match.index; index < str.length; index++) {
- switch (str.charCodeAt(index)) {
- case 34:
- escaped = "&quot;";
- break;
- case 38:
- escaped = "&amp;";
- break;
- case 39:
- escaped = "&#39;";
- break;
- case 60:
- escaped = "&lt;";
- break;
- case 62:
- escaped = "&gt;";
- break;
- default:
- continue;
- }
- if (lastIndex !== index) {
- html += str.substring(lastIndex, index);
- }
- lastIndex = index + 1;
- html += escaped;
- }
- return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
- }
- var commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
- function escapeHtmlComment(src) {
- return src.replace(commentStripRE, "");
- }
- function looseCompareArrays(a, b) {
- if (a.length !== b.length)
- return false;
- let equal = true;
- for (let i = 0; equal && i < a.length; i++) {
- equal = looseEqual(a[i], b[i]);
- }
- return equal;
- }
- function looseEqual(a, b) {
- if (a === b)
- return true;
- let aValidType = isDate(a);
- let bValidType = isDate(b);
- if (aValidType || bValidType) {
- return aValidType && bValidType ? a.getTime() === b.getTime() : false;
- }
- aValidType = isArray(a);
- bValidType = isArray(b);
- if (aValidType || bValidType) {
- return aValidType && bValidType ? looseCompareArrays(a, b) : false;
- }
- aValidType = isObject(a);
- bValidType = isObject(b);
- if (aValidType || bValidType) {
- if (!aValidType || !bValidType) {
- return false;
- }
- const aKeysCount = Object.keys(a).length;
- const bKeysCount = Object.keys(b).length;
- if (aKeysCount !== bKeysCount) {
- return false;
- }
- for (const key in a) {
- const aHasKey = a.hasOwnProperty(key);
- const bHasKey = b.hasOwnProperty(key);
- if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
- return false;
- }
- }
- }
- return String(a) === String(b);
- }
- function looseIndexOf(arr, val) {
- return arr.findIndex((item) => looseEqual(item, val));
- }
- var toDisplayString = (val) => {
- return val == null ? "" : isObject(val) ? JSON.stringify(val, replacer, 2) : String(val);
- };
- var replacer = (_key, val) => {
- if (isMap(val)) {
- return {
- [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
- entries[`${key} =>`] = val2;
- return entries;
- }, {})
- };
- } else if (isSet(val)) {
- return {
- [`Set(${val.size})`]: [...val.values()]
- };
- } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
- return String(val);
- }
- return val;
- };
- var babelParserDefaultPlugins = [
- "bigInt",
- "optionalChaining",
- "nullishCoalescingOperator"
- ];
- var EMPTY_OBJ = Object.freeze({});
- var EMPTY_ARR = Object.freeze([]);
- var NOOP = () => {
- };
- var NO = () => false;
- var onRE = /^on[^a-z]/;
- var isOn = (key) => onRE.test(key);
- var isModelListener = (key) => key.startsWith("onUpdate:");
- var extend = Object.assign;
- var remove = (arr, el) => {
- const i = arr.indexOf(el);
- if (i > -1) {
- arr.splice(i, 1);
- }
- };
- var hasOwnProperty = Object.prototype.hasOwnProperty;
- var hasOwn = (val, key) => hasOwnProperty.call(val, key);
- var isArray = Array.isArray;
- var isMap = (val) => toTypeString(val) === "[object Map]";
- var isSet = (val) => toTypeString(val) === "[object Set]";
- var isDate = (val) => val instanceof Date;
- var isFunction = (val) => typeof val === "function";
- var isString = (val) => typeof val === "string";
- var isSymbol = (val) => typeof val === "symbol";
- var isObject = (val) => val !== null && typeof val === "object";
- var isPromise = (val) => {
- return isObject(val) && isFunction(val.then) && isFunction(val.catch);
- };
- var objectToString = Object.prototype.toString;
- var toTypeString = (value) => objectToString.call(value);
- var toRawType = (value) => {
- return toTypeString(value).slice(8, -1);
- };
- var isPlainObject = (val) => toTypeString(val) === "[object Object]";
- var isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
- var isReservedProp = /* @__PURE__ */ makeMap(",key,ref,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
- var cacheStringFunction = (fn) => {
- const cache = Object.create(null);
- return (str) => {
- const hit = cache[str];
- return hit || (cache[str] = fn(str));
- };
- };
- var camelizeRE = /-(\w)/g;
- var camelize = cacheStringFunction((str) => {
- return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
- });
- var hyphenateRE = /\B([A-Z])/g;
- var hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
- var capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
- var toHandlerKey = cacheStringFunction((str) => str ? `on${capitalize(str)}` : ``);
- var hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
- var invokeArrayFns = (fns, arg) => {
- for (let i = 0; i < fns.length; i++) {
- fns[i](arg);
- }
- };
- var def = (obj, key, value) => {
- Object.defineProperty(obj, key, {
- configurable: true,
- enumerable: false,
- value
- });
- };
- var toNumber = (val) => {
- const n = parseFloat(val);
- return isNaN(n) ? val : n;
- };
- var _globalThis;
- var getGlobalThis = () => {
- return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
- };
- exports.EMPTY_ARR = EMPTY_ARR;
- exports.EMPTY_OBJ = EMPTY_OBJ;
- exports.NO = NO;
- exports.NOOP = NOOP;
- exports.PatchFlagNames = PatchFlagNames;
- exports.babelParserDefaultPlugins = babelParserDefaultPlugins;
- exports.camelize = camelize;
- exports.capitalize = capitalize;
- exports.def = def;
- exports.escapeHtml = escapeHtml;
- exports.escapeHtmlComment = escapeHtmlComment;
- exports.extend = extend;
- exports.generateCodeFrame = generateCodeFrame;
- exports.getGlobalThis = getGlobalThis;
- exports.hasChanged = hasChanged;
- exports.hasOwn = hasOwn;
- exports.hyphenate = hyphenate;
- exports.invokeArrayFns = invokeArrayFns;
- exports.isArray = isArray;
- exports.isBooleanAttr = isBooleanAttr2;
- exports.isDate = isDate;
- exports.isFunction = isFunction;
- exports.isGloballyWhitelisted = isGloballyWhitelisted;
- exports.isHTMLTag = isHTMLTag;
- exports.isIntegerKey = isIntegerKey;
- exports.isKnownAttr = isKnownAttr;
- exports.isMap = isMap;
- exports.isModelListener = isModelListener;
- exports.isNoUnitNumericStyleProp = isNoUnitNumericStyleProp;
- exports.isObject = isObject;
- exports.isOn = isOn;
- exports.isPlainObject = isPlainObject;
- exports.isPromise = isPromise;
- exports.isReservedProp = isReservedProp;
- exports.isSSRSafeAttrName = isSSRSafeAttrName;
- exports.isSVGTag = isSVGTag;
- exports.isSet = isSet;
- exports.isSpecialBooleanAttr = isSpecialBooleanAttr;
- exports.isString = isString;
- exports.isSymbol = isSymbol;
- exports.isVoidTag = isVoidTag;
- exports.looseEqual = looseEqual;
- exports.looseIndexOf = looseIndexOf;
- exports.makeMap = makeMap;
- exports.normalizeClass = normalizeClass;
- exports.normalizeStyle = normalizeStyle;
- exports.objectToString = objectToString;
- exports.parseStringStyle = parseStringStyle;
- exports.propsToAttrMap = propsToAttrMap;
- exports.remove = remove;
- exports.slotFlagsText = slotFlagsText;
- exports.stringifyStyle = stringifyStyle;
- exports.toDisplayString = toDisplayString;
- exports.toHandlerKey = toHandlerKey;
- exports.toNumber = toNumber;
- exports.toRawType = toRawType;
- exports.toTypeString = toTypeString;
-});
-
-// node_modules/@vue/shared/index.js
-var require_shared = __commonJS((exports, module) => {
- "use strict";
- if (false) {
- module.exports = null;
- } else {
- module.exports = require_shared_cjs();
- }
-});
-
-// node_modules/@vue/reactivity/dist/reactivity.cjs.js
-var require_reactivity_cjs = __commonJS((exports) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", {value: true});
- var shared = require_shared();
- var targetMap = new WeakMap();
- var effectStack = [];
- var activeEffect;
- var ITERATE_KEY = Symbol("iterate");
- var MAP_KEY_ITERATE_KEY = Symbol("Map key iterate");
- function isEffect(fn) {
- return fn && fn._isEffect === true;
- }
- function effect3(fn, options = shared.EMPTY_OBJ) {
- if (isEffect(fn)) {
- fn = fn.raw;
- }
- const effect4 = createReactiveEffect(fn, options);
- if (!options.lazy) {
- effect4();
- }
- return effect4;
- }
- function stop2(effect4) {
- if (effect4.active) {
- cleanup(effect4);
- if (effect4.options.onStop) {
- effect4.options.onStop();
- }
- effect4.active = false;
- }
- }
- var uid = 0;
- function createReactiveEffect(fn, options) {
- const effect4 = function reactiveEffect() {
- if (!effect4.active) {
- return fn();
- }
- if (!effectStack.includes(effect4)) {
- cleanup(effect4);
- try {
- enableTracking();
- effectStack.push(effect4);
- activeEffect = effect4;
- return fn();
- } finally {
- effectStack.pop();
- resetTracking();
- activeEffect = effectStack[effectStack.length - 1];
- }
- }
- };
- effect4.id = uid++;
- effect4.allowRecurse = !!options.allowRecurse;
- effect4._isEffect = true;
- effect4.active = true;
- effect4.raw = fn;
- effect4.deps = [];
- effect4.options = options;
- return effect4;
- }
- function cleanup(effect4) {
- const {deps} = effect4;
- if (deps.length) {
- for (let i = 0; i < deps.length; i++) {
- deps[i].delete(effect4);
- }
- deps.length = 0;
- }
- }
- var shouldTrack = true;
- var trackStack = [];
- function pauseTracking() {
- trackStack.push(shouldTrack);
- shouldTrack = false;
- }
- function enableTracking() {
- trackStack.push(shouldTrack);
- shouldTrack = true;
- }
- function resetTracking() {
- const last = trackStack.pop();
- shouldTrack = last === void 0 ? true : last;
- }
- function track(target, type, key) {
- if (!shouldTrack || activeEffect === void 0) {
- return;
- }
- let depsMap = targetMap.get(target);
- if (!depsMap) {
- targetMap.set(target, depsMap = new Map());
- }
- let dep = depsMap.get(key);
- if (!dep) {
- depsMap.set(key, dep = new Set());
- }
- if (!dep.has(activeEffect)) {
- dep.add(activeEffect);
- activeEffect.deps.push(dep);
- if (activeEffect.options.onTrack) {
- activeEffect.options.onTrack({
- effect: activeEffect,
- target,
- type,
- key
- });
- }
- }
- }
- function trigger(target, type, key, newValue, oldValue, oldTarget) {
- const depsMap = targetMap.get(target);
- if (!depsMap) {
- return;
- }
- const effects = new Set();
- const add2 = (effectsToAdd) => {
- if (effectsToAdd) {
- effectsToAdd.forEach((effect4) => {
- if (effect4 !== activeEffect || effect4.allowRecurse) {
- effects.add(effect4);
- }
- });
- }
- };
- if (type === "clear") {
- depsMap.forEach(add2);
- } else if (key === "length" && shared.isArray(target)) {
- depsMap.forEach((dep, key2) => {
- if (key2 === "length" || key2 >= newValue) {
- add2(dep);
- }
- });
- } else {
- if (key !== void 0) {
- add2(depsMap.get(key));
- }
- switch (type) {
- case "add":
- if (!shared.isArray(target)) {
- add2(depsMap.get(ITERATE_KEY));
- if (shared.isMap(target)) {
- add2(depsMap.get(MAP_KEY_ITERATE_KEY));
- }
- } else if (shared.isIntegerKey(key)) {
- add2(depsMap.get("length"));
- }
- break;
- case "delete":
- if (!shared.isArray(target)) {
- add2(depsMap.get(ITERATE_KEY));
- if (shared.isMap(target)) {
- add2(depsMap.get(MAP_KEY_ITERATE_KEY));
- }
- }
- break;
- case "set":
- if (shared.isMap(target)) {
- add2(depsMap.get(ITERATE_KEY));
- }
- break;
- }
- }
- const run = (effect4) => {
- if (effect4.options.onTrigger) {
- effect4.options.onTrigger({
- effect: effect4,
- target,
- key,
- type,
- newValue,
- oldValue,
- oldTarget
- });
- }
- if (effect4.options.scheduler) {
- effect4.options.scheduler(effect4);
- } else {
- effect4();
- }
- };
- effects.forEach(run);
- }
- var isNonTrackableKeys = /* @__PURE__ */ shared.makeMap(`__proto__,__v_isRef,__isVue`);
- var builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol).map((key) => Symbol[key]).filter(shared.isSymbol));
- var get2 = /* @__PURE__ */ createGetter();
- var shallowGet = /* @__PURE__ */ createGetter(false, true);
- var readonlyGet = /* @__PURE__ */ createGetter(true);
- var shallowReadonlyGet = /* @__PURE__ */ createGetter(true, true);
- var arrayInstrumentations = {};
- ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
- const method = Array.prototype[key];
- arrayInstrumentations[key] = function(...args) {
- const arr = toRaw2(this);
- for (let i = 0, l = this.length; i < l; i++) {
- track(arr, "get", i + "");
- }
- const res = method.apply(arr, args);
- if (res === -1 || res === false) {
- return method.apply(arr, args.map(toRaw2));
- } else {
- return res;
- }
- };
- });
- ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
- const method = Array.prototype[key];
- arrayInstrumentations[key] = function(...args) {
- pauseTracking();
- const res = method.apply(this, args);
- resetTracking();
- return res;
- };
- });
- function createGetter(isReadonly2 = false, shallow = false) {
- return function get3(target, key, receiver) {
- if (key === "__v_isReactive") {
- return !isReadonly2;
- } else if (key === "__v_isReadonly") {
- return isReadonly2;
- } else if (key === "__v_raw" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
- return target;
- }
- const targetIsArray = shared.isArray(target);
- if (!isReadonly2 && targetIsArray && shared.hasOwn(arrayInstrumentations, key)) {
- return Reflect.get(arrayInstrumentations, key, receiver);
- }
- const res = Reflect.get(target, key, receiver);
- if (shared.isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
- return res;
- }
- if (!isReadonly2) {
- track(target, "get", key);
- }
- if (shallow) {
- return res;
- }
- if (isRef(res)) {
- const shouldUnwrap = !targetIsArray || !shared.isIntegerKey(key);
- return shouldUnwrap ? res.value : res;
- }
- if (shared.isObject(res)) {
- return isReadonly2 ? readonly(res) : reactive3(res);
- }
- return res;
- };
- }
- var set2 = /* @__PURE__ */ createSetter();
- var shallowSet = /* @__PURE__ */ createSetter(true);
- function createSetter(shallow = false) {
- return function set3(target, key, value, receiver) {
- let oldValue = target[key];
- if (!shallow) {
- value = toRaw2(value);
- oldValue = toRaw2(oldValue);
- if (!shared.isArray(target) && isRef(oldValue) && !isRef(value)) {
- oldValue.value = value;
- return true;
- }
- }
- const hadKey = shared.isArray(target) && shared.isIntegerKey(key) ? Number(key) < target.length : shared.hasOwn(target, key);
- const result = Reflect.set(target, key, value, receiver);
- if (target === toRaw2(receiver)) {
- if (!hadKey) {
- trigger(target, "add", key, value);
- } else if (shared.hasChanged(value, oldValue)) {
- trigger(target, "set", key, value, oldValue);
- }
- }
- return result;
- };
- }
- function deleteProperty(target, key) {
- const hadKey = shared.hasOwn(target, key);
- const oldValue = target[key];
- const result = Reflect.deleteProperty(target, key);
- if (result && hadKey) {
- trigger(target, "delete", key, void 0, oldValue);
- }
- return result;
- }
- function has(target, key) {
- const result = Reflect.has(target, key);
- if (!shared.isSymbol(key) || !builtInSymbols.has(key)) {
- track(target, "has", key);
- }
- return result;
- }
- function ownKeys(target) {
- track(target, "iterate", shared.isArray(target) ? "length" : ITERATE_KEY);
- return Reflect.ownKeys(target);
- }
- var mutableHandlers = {
- get: get2,
- set: set2,
- deleteProperty,
- has,
- ownKeys
- };
- var readonlyHandlers = {
- get: readonlyGet,
- set(target, key) {
- {
- console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
- }
- return true;
- },
- deleteProperty(target, key) {
- {
- console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
- }
- return true;
- }
- };
- var shallowReactiveHandlers = shared.extend({}, mutableHandlers, {
- get: shallowGet,
- set: shallowSet
- });
- var shallowReadonlyHandlers = shared.extend({}, readonlyHandlers, {
- get: shallowReadonlyGet
- });
- var toReactive = (value) => shared.isObject(value) ? reactive3(value) : value;
- var toReadonly = (value) => shared.isObject(value) ? readonly(value) : value;
- var toShallow = (value) => value;
- var getProto = (v) => Reflect.getPrototypeOf(v);
- function get$1(target, key, isReadonly2 = false, isShallow = false) {
- target = target["__v_raw"];
- const rawTarget = toRaw2(target);
- const rawKey = toRaw2(key);
- if (key !== rawKey) {
- !isReadonly2 && track(rawTarget, "get", key);
- }
- !isReadonly2 && track(rawTarget, "get", rawKey);
- const {has: has2} = getProto(rawTarget);
- const wrap = isShallow ? toShallow : isReadonly2 ? toReadonly : toReactive;
- if (has2.call(rawTarget, key)) {
- return wrap(target.get(key));
- } else if (has2.call(rawTarget, rawKey)) {
- return wrap(target.get(rawKey));
- } else if (target !== rawTarget) {
- target.get(key);
- }
- }
- function has$1(key, isReadonly2 = false) {
- const target = this["__v_raw"];
- const rawTarget = toRaw2(target);
- const rawKey = toRaw2(key);
- if (key !== rawKey) {
- !isReadonly2 && track(rawTarget, "has", key);
- }
- !isReadonly2 && track(rawTarget, "has", rawKey);
- return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
- }
- function size(target, isReadonly2 = false) {
- target = target["__v_raw"];
- !isReadonly2 && track(toRaw2(target), "iterate", ITERATE_KEY);
- return Reflect.get(target, "size", target);
- }
- function add(value) {
- value = toRaw2(value);
- const target = toRaw2(this);
- const proto = getProto(target);
- const hadKey = proto.has.call(target, value);
- if (!hadKey) {
- target.add(value);
- trigger(target, "add", value, value);
- }
- return this;
- }
- function set$1(key, value) {
- value = toRaw2(value);
- const target = toRaw2(this);
- const {has: has2, get: get3} = getProto(target);
- let hadKey = has2.call(target, key);
- if (!hadKey) {
- key = toRaw2(key);
- hadKey = has2.call(target, key);
- } else {
- checkIdentityKeys(target, has2, key);
- }
- const oldValue = get3.call(target, key);
- target.set(key, value);
- if (!hadKey) {
- trigger(target, "add", key, value);
- } else if (shared.hasChanged(value, oldValue)) {
- trigger(target, "set", key, value, oldValue);
- }
- return this;
- }
- function deleteEntry(key) {
- const target = toRaw2(this);
- const {has: has2, get: get3} = getProto(target);
- let hadKey = has2.call(target, key);
- if (!hadKey) {
- key = toRaw2(key);
- hadKey = has2.call(target, key);
- } else {
- checkIdentityKeys(target, has2, key);
- }
- const oldValue = get3 ? get3.call(target, key) : void 0;
- const result = target.delete(key);
- if (hadKey) {
- trigger(target, "delete", key, void 0, oldValue);
- }
- return result;
- }
- function clear() {
- const target = toRaw2(this);
- const hadItems = target.size !== 0;
- const oldTarget = shared.isMap(target) ? new Map(target) : new Set(target);
- const result = target.clear();
- if (hadItems) {
- trigger(target, "clear", void 0, void 0, oldTarget);
- }
- return result;
- }
- function createForEach(isReadonly2, isShallow) {
- return function forEach(callback, thisArg) {
- const observed = this;
- const target = observed["__v_raw"];
- const rawTarget = toRaw2(target);
- const wrap = isShallow ? toShallow : isReadonly2 ? toReadonly : toReactive;
- !isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY);
- return target.forEach((value, key) => {
- return callback.call(thisArg, wrap(value), wrap(key), observed);
- });
- };
- }
- function createIterableMethod(method, isReadonly2, isShallow) {
- return function(...args) {
- const target = this["__v_raw"];
- const rawTarget = toRaw2(target);
- const targetIsMap = shared.isMap(rawTarget);
- const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
- const isKeyOnly = method === "keys" && targetIsMap;
- const innerIterator = target[method](...args);
- const wrap = isShallow ? toShallow : isReadonly2 ? toReadonly : toReactive;
- !isReadonly2 && track(rawTarget, "iterate", isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
- return {
- next() {
- const {value, done} = innerIterator.next();
- return done ? {value, done} : {
- value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
- done
- };
- },
- [Symbol.iterator]() {
- return this;
- }
- };
- };
- }
- function createReadonlyMethod(type) {
- return function(...args) {
- {
- const key = args[0] ? `on key "${args[0]}" ` : ``;
- console.warn(`${shared.capitalize(type)} operation ${key}failed: target is readonly.`, toRaw2(this));
- }
- return type === "delete" ? false : this;
- };
- }
- var mutableInstrumentations = {
- get(key) {
- return get$1(this, key);
- },
- get size() {
- return size(this);
- },
- has: has$1,
- add,
- set: set$1,
- delete: deleteEntry,
- clear,
- forEach: createForEach(false, false)
- };
- var shallowInstrumentations = {
- get(key) {
- return get$1(this, key, false, true);
- },
- get size() {
- return size(this);
- },
- has: has$1,
- add,
- set: set$1,
- delete: deleteEntry,
- clear,
- forEach: createForEach(false, true)
- };
- var readonlyInstrumentations = {
- get(key) {
- return get$1(this, key, true);
- },
- get size() {
- return size(this, true);
- },
- has(key) {
- return has$1.call(this, key, true);
- },
- add: createReadonlyMethod("add"),
- set: createReadonlyMethod("set"),
- delete: createReadonlyMethod("delete"),
- clear: createReadonlyMethod("clear"),
- forEach: createForEach(true, false)
- };
- var shallowReadonlyInstrumentations = {
- get(key) {
- return get$1(this, key, true, true);
- },
- get size() {
- return size(this, true);
- },
- has(key) {
- return has$1.call(this, key, true);
- },
- add: createReadonlyMethod("add"),
- set: createReadonlyMethod("set"),
- delete: createReadonlyMethod("delete"),
- clear: createReadonlyMethod("clear"),
- forEach: createForEach(true, true)
- };
- var iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
- iteratorMethods.forEach((method) => {
- mutableInstrumentations[method] = createIterableMethod(method, false, false);
- readonlyInstrumentations[method] = createIterableMethod(method, true, false);
- shallowInstrumentations[method] = createIterableMethod(method, false, true);
- shallowReadonlyInstrumentations[method] = createIterableMethod(method, true, true);
- });
- function createInstrumentationGetter(isReadonly2, shallow) {
- const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations;
- return (target, key, receiver) => {
- if (key === "__v_isReactive") {
- return !isReadonly2;
- } else if (key === "__v_isReadonly") {
- return isReadonly2;
- } else if (key === "__v_raw") {
- return target;
- }
- return Reflect.get(shared.hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
- };
- }
- var mutableCollectionHandlers = {
- get: createInstrumentationGetter(false, false)
- };
- var shallowCollectionHandlers = {
- get: createInstrumentationGetter(false, true)
- };
- var readonlyCollectionHandlers = {
- get: createInstrumentationGetter(true, false)
- };
- var shallowReadonlyCollectionHandlers = {
- get: createInstrumentationGetter(true, true)
- };
- function checkIdentityKeys(target, has2, key) {
- const rawKey = toRaw2(key);
- if (rawKey !== key && has2.call(target, rawKey)) {
- const type = shared.toRawType(target);
- console.warn(`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`);
- }
- }
- var reactiveMap = new WeakMap();
- var shallowReactiveMap = new WeakMap();
- var readonlyMap = new WeakMap();
- var shallowReadonlyMap = new WeakMap();
- function targetTypeMap(rawType) {
- switch (rawType) {
- case "Object":
- case "Array":
- return 1;
- case "Map":
- case "Set":
- case "WeakMap":
- case "WeakSet":
- return 2;
- default:
- return 0;
- }
- }
- function getTargetType(value) {
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(shared.toRawType(value));
- }
- function reactive3(target) {
- if (target && target["__v_isReadonly"]) {
- return target;
- }
- return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
- }
- function shallowReactive(target) {
- return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap);
- }
- function readonly(target) {
- return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
- }
- function shallowReadonly(target) {
- return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
- }
- function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
- if (!shared.isObject(target)) {
- {
- console.warn(`value cannot be made reactive: ${String(target)}`);
- }
- return target;
- }
- if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
- return target;
- }
- const existingProxy = proxyMap.get(target);
- if (existingProxy) {
- return existingProxy;
- }
- const targetType = getTargetType(target);
- if (targetType === 0) {
- return target;
- }
- const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
- proxyMap.set(target, proxy);
- return proxy;
- }
- function isReactive2(value) {
- if (isReadonly(value)) {
- return isReactive2(value["__v_raw"]);
- }
- return !!(value && value["__v_isReactive"]);
- }
- function isReadonly(value) {
- return !!(value && value["__v_isReadonly"]);
- }
- function isProxy(value) {
- return isReactive2(value) || isReadonly(value);
- }
- function toRaw2(observed) {
- return observed && toRaw2(observed["__v_raw"]) || observed;
- }
- function markRaw(value) {
- shared.def(value, "__v_skip", true);
- return value;
- }
- var convert = (val) => shared.isObject(val) ? reactive3(val) : val;
- function isRef(r) {
- return Boolean(r && r.__v_isRef === true);
- }
- function ref(value) {
- return createRef(value);
- }
- function shallowRef(value) {
- return createRef(value, true);
- }
- var RefImpl = class {
- constructor(_rawValue, _shallow = false) {
- this._rawValue = _rawValue;
- this._shallow = _shallow;
- this.__v_isRef = true;
- this._value = _shallow ? _rawValue : convert(_rawValue);
- }
- get value() {
- track(toRaw2(this), "get", "value");
- return this._value;
- }
- set value(newVal) {
- if (shared.hasChanged(toRaw2(newVal), this._rawValue)) {
- this._rawValue = newVal;
- this._value = this._shallow ? newVal : convert(newVal);
- trigger(toRaw2(this), "set", "value", newVal);
- }
- }
- };
- function createRef(rawValue, shallow = false) {
- if (isRef(rawValue)) {
- return rawValue;
- }
- return new RefImpl(rawValue, shallow);
- }
- function triggerRef(ref2) {
- trigger(toRaw2(ref2), "set", "value", ref2.value);
- }
- function unref(ref2) {
- return isRef(ref2) ? ref2.value : ref2;
- }
- var shallowUnwrapHandlers = {
- get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
- set: (target, key, value, receiver) => {
- const oldValue = target[key];
- if (isRef(oldValue) && !isRef(value)) {
- oldValue.value = value;
- return true;
- } else {
- return Reflect.set(target, key, value, receiver);
- }
- }
- };
- function proxyRefs(objectWithRefs) {
- return isReactive2(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
- }
- var CustomRefImpl = class {
- constructor(factory) {
- this.__v_isRef = true;
- const {get: get3, set: set3} = factory(() => track(this, "get", "value"), () => trigger(this, "set", "value"));
- this._get = get3;
- this._set = set3;
- }
- get value() {
- return this._get();
- }
- set value(newVal) {
- this._set(newVal);
- }
- };
- function customRef(factory) {
- return new CustomRefImpl(factory);
- }
- function toRefs(object) {
- if (!isProxy(object)) {
- console.warn(`toRefs() expects a reactive object but received a plain one.`);
- }
- const ret = shared.isArray(object) ? new Array(object.length) : {};
- for (const key in object) {
- ret[key] = toRef(object, key);
- }
- return ret;
- }
- var ObjectRefImpl = class {
- constructor(_object, _key) {
- this._object = _object;
- this._key = _key;
- this.__v_isRef = true;
- }
- get value() {
- return this._object[this._key];
- }
- set value(newVal) {
- this._object[this._key] = newVal;
- }
- };
- function toRef(object, key) {
- return isRef(object[key]) ? object[key] : new ObjectRefImpl(object, key);
- }
- var ComputedRefImpl = class {
- constructor(getter, _setter, isReadonly2) {
- this._setter = _setter;
- this._dirty = true;
- this.__v_isRef = true;
- this.effect = effect3(getter, {
- lazy: true,
- scheduler: () => {
- if (!this._dirty) {
- this._dirty = true;
- trigger(toRaw2(this), "set", "value");
- }
- }
- });
- this["__v_isReadonly"] = isReadonly2;
- }
- get value() {
- const self2 = toRaw2(this);
- if (self2._dirty) {
- self2._value = this.effect();
- self2._dirty = false;
- }
- track(self2, "get", "value");
- return self2._value;
- }
- set value(newValue) {
- this._setter(newValue);
- }
- };
- function computed(getterOrOptions) {
- let getter;
- let setter;
- if (shared.isFunction(getterOrOptions)) {
- getter = getterOrOptions;
- setter = () => {
- console.warn("Write operation failed: computed value is readonly");
- };
- } else {
- getter = getterOrOptions.get;
- setter = getterOrOptions.set;
- }
- return new ComputedRefImpl(getter, setter, shared.isFunction(getterOrOptions) || !getterOrOptions.set);
- }
- exports.ITERATE_KEY = ITERATE_KEY;
- exports.computed = computed;
- exports.customRef = customRef;
- exports.effect = effect3;
- exports.enableTracking = enableTracking;
- exports.isProxy = isProxy;
- exports.isReactive = isReactive2;
- exports.isReadonly = isReadonly;
- exports.isRef = isRef;
- exports.markRaw = markRaw;
- exports.pauseTracking = pauseTracking;
- exports.proxyRefs = proxyRefs;
- exports.reactive = reactive3;
- exports.readonly = readonly;
- exports.ref = ref;
- exports.resetTracking = resetTracking;
- exports.shallowReactive = shallowReactive;
- exports.shallowReadonly = shallowReadonly;
- exports.shallowRef = shallowRef;
- exports.stop = stop2;
- exports.toRaw = toRaw2;
- exports.toRef = toRef;
- exports.toRefs = toRefs;
- exports.track = track;
- exports.trigger = trigger;
- exports.triggerRef = triggerRef;
- exports.unref = unref;
-});
-
-// node_modules/@vue/reactivity/index.js
-var require_reactivity = __commonJS((exports, module) => {
- "use strict";
- if (false) {
- module.exports = null;
- } else {
- module.exports = require_reactivity_cjs();
- }
-});
-
// packages/alpinejs/src/scheduler.js
var flushPending = false;
var flushing = false;
@@ -1314,7 +58,7 @@ function overrideEffect(override) {
effect = override;
}
function elementBoundEffect(el) {
- let cleanup = () => {
+ let cleanup2 = () => {
};
let wrappedEffect = (callback) => {
let effectReference = effect(callback);
@@ -1325,15 +69,16 @@ function elementBoundEffect(el) {
};
}
el._x_effects.add(effectReference);
- cleanup = () => {
+ cleanup2 = () => {
if (effectReference === void 0)
return;
el._x_effects.delete(effectReference);
release(effectReference);
};
+ return effectReference;
};
return [wrappedEffect, () => {
- cleanup();
+ cleanup2();
}];
}
@@ -1439,7 +184,7 @@ function onMutate(mutations) {
let el = mutations[i].target;
let name = mutations[i].attributeName;
let oldValue = mutations[i].oldValue;
- let add = () => {
+ let add2 = () => {
if (!addedAttributes.has(el))
addedAttributes.set(el, []);
addedAttributes.get(el).push({name, value: el.getAttribute(name)});
@@ -1450,10 +195,10 @@ function onMutate(mutations) {
removedAttributes.get(el).push(name);
};
if (el.hasAttribute(name) && oldValue === null) {
- add();
+ add2();
} else if (el.hasAttribute(name)) {
remove();
- add();
+ add2();
} else {
remove();
}
@@ -1577,7 +322,7 @@ function mergeProxies(objects) {
// packages/alpinejs/src/interceptor.js
function initInterceptors(data2) {
- let isObject = (val) => typeof val === "object" && !Array.isArray(val) && val !== null;
+ let isObject2 = (val) => typeof val === "object" && !Array.isArray(val) && val !== null;
let recurse = (obj, basePath = "") => {
Object.entries(Object.getOwnPropertyDescriptors(obj)).forEach(([key, {value, enumerable}]) => {
if (enumerable === false || value === void 0)
@@ -1586,7 +331,7 @@ function initInterceptors(data2) {
if (typeof value === "object" && value !== null && value._x_interceptor) {
obj[key] = value.initialize(data2, path, key);
} else {
- if (isObject(value) && value !== obj && !(value instanceof Element)) {
+ if (isObject2(value) && value !== obj && !(value instanceof Element)) {
recurse(value, path);
}
}
@@ -1647,9 +392,9 @@ function injectMagics(obj, el) {
Object.entries(magics).forEach(([name, callback]) => {
Object.defineProperty(obj, `$${name}`, {
get() {
- let [utilities, cleanup] = getElementBoundUtilities(el);
+ let [utilities, cleanup2] = getElementBoundUtilities(el);
utilities = {interceptor, ...utilities};
- onElRemoved(el, cleanup);
+ onElRemoved(el, cleanup2);
return callback(el, utilities);
},
enumerable: false
@@ -1682,6 +427,13 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
}
// packages/alpinejs/src/evaluator.js
+var shouldAutoEvaluateFunctions = true;
+function dontAutoEvaluateFunctions(callback) {
+ let cache = shouldAutoEvaluateFunctions;
+ shouldAutoEvaluateFunctions = false;
+ callback();
+ shouldAutoEvaluateFunctions = cache;
+}
function evaluate(el, expression, extras = {}) {
let result;
evaluateLater(el, expression)((value) => result = value, extras);
@@ -1696,8 +448,8 @@ function setEvaluator(newEvaluator) {
}
function normalEvaluator(el, expression) {
let overriddenMagics = {};
- let cleanup = injectMagics(overriddenMagics, el).cleanup;
- onAttributeRemoved(el, "evaluator", cleanup);
+ let cleanup2 = injectMagics(overriddenMagics, el).cleanup;
+ onAttributeRemoved(el, "evaluator", cleanup2);
let dataStack = [overriddenMagics, ...closestDataStack(el)];
if (typeof expression === "function") {
return generateEvaluatorFromFunction(dataStack, expression);
@@ -1753,7 +505,7 @@ function generateEvaluatorFromString(dataStack, expression, el) {
};
}
function runIfTypeOfFunction(receiver, value, scope2, params, el) {
- if (typeof value === "function") {
+ if (shouldAutoEvaluateFunctions && typeof value === "function") {
let result = value.apply(scope2, params);
if (result instanceof Promise) {
result.then((i) => runIfTypeOfFunction(receiver, i, scope2, params)).catch((error2) => handleError(error2, el, value));
@@ -1809,13 +561,13 @@ function deferHandlingDirectives(callback) {
}
function getElementBoundUtilities(el) {
let cleanups = [];
- let cleanup = (callback) => cleanups.push(callback);
+ let cleanup2 = (callback) => cleanups.push(callback);
let [effect3, cleanupEffect] = elementBoundEffect(el);
cleanups.push(cleanupEffect);
let utilities = {
Alpine: alpine_default,
effect: effect3,
- cleanup,
+ cleanup: cleanup2,
evaluateLater: evaluateLater.bind(evaluateLater, el),
evaluate: evaluate.bind(evaluate, el)
};
@@ -1826,8 +578,8 @@ function getDirectiveHandler(el, directive2) {
let noop = () => {
};
let handler3 = directiveHandlers[directive2.type] || noop;
- let [utilities, cleanup] = getElementBoundUtilities(el);
- onAttributeRemoved(el, directive2.original, cleanup);
+ let [utilities, cleanup2] = getElementBoundUtilities(el);
+ onAttributeRemoved(el, directive2.original, cleanup2);
let fullHandler = () => {
if (el._x_ignore || el._x_ignoreSelf)
return;
@@ -1835,7 +587,7 @@ function getDirectiveHandler(el, directive2) {
handler3 = handler3.bind(handler3, el, directive2, utilities);
isDeferringHandlers ? directiveHandlerStacks.get(currentHandlerStackKey).push(handler3) : handler3();
};
- fullHandler.runCleanups = cleanup;
+ fullHandler.runCleanups = cleanup2;
return fullHandler;
}
var startingWith = (subject, replacement) => ({name, value}) => {
@@ -1887,6 +639,7 @@ var directiveOrder = [
"bind",
"init",
"for",
+ "mask",
"model",
"modelable",
"transition",
@@ -1915,13 +668,19 @@ function dispatch(el, name, detail = {}) {
// packages/alpinejs/src/nextTick.js
var tickStack = [];
var isHolding = false;
-function nextTick(callback) {
- tickStack.push(callback);
+function nextTick(callback = () => {
+}) {
queueMicrotask(() => {
isHolding || setTimeout(() => {
releaseNextTicks();
});
});
+ return new Promise((res) => {
+ tickStack.push(() => {
+ callback();
+ res();
+ });
+ });
}
function releaseNextTicks() {
isHolding = false;
@@ -2669,8 +1428,9 @@ var Alpine = {
get raw() {
return raw;
},
- version: "3.9.1",
+ version: "3.10.2",
flushAndStopDeferringMutations,
+ dontAutoEvaluateFunctions,
disableEffectScheduling,
stopObservingMutations,
destroyTree,
@@ -2711,8 +1471,684 @@ var Alpine = {
};
var alpine_default = Alpine;
-// packages/alpinejs/src/index.js
-var import_reactivity8 = __toModule(require_reactivity());
+// node_modules/@vue/shared/dist/shared.esm-bundler.js
+function makeMap(str, expectsLowerCase) {
+ const map = Object.create(null);
+ const list = str.split(",");
+ for (let i = 0; i < list.length; i++) {
+ map[list[i]] = true;
+ }
+ return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
+}
+var PatchFlagNames = {
+ [1]: `TEXT`,
+ [2]: `CLASS`,
+ [4]: `STYLE`,
+ [8]: `PROPS`,
+ [16]: `FULL_PROPS`,
+ [32]: `HYDRATE_EVENTS`,
+ [64]: `STABLE_FRAGMENT`,
+ [128]: `KEYED_FRAGMENT`,
+ [256]: `UNKEYED_FRAGMENT`,
+ [512]: `NEED_PATCH`,
+ [1024]: `DYNAMIC_SLOTS`,
+ [2048]: `DEV_ROOT_FRAGMENT`,
+ [-1]: `HOISTED`,
+ [-2]: `BAIL`
+};
+var slotFlagsText = {
+ [1]: "STABLE",
+ [2]: "DYNAMIC",
+ [3]: "FORWARDED"
+};
+var specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
+var isBooleanAttr2 = /* @__PURE__ */ makeMap(specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`);
+var EMPTY_OBJ = true ? Object.freeze({}) : {};
+var EMPTY_ARR = true ? Object.freeze([]) : [];
+var extend = Object.assign;
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+var hasOwn = (val, key) => hasOwnProperty.call(val, key);
+var isArray = Array.isArray;
+var isMap = (val) => toTypeString(val) === "[object Map]";
+var isString = (val) => typeof val === "string";
+var isSymbol = (val) => typeof val === "symbol";
+var isObject = (val) => val !== null && typeof val === "object";
+var objectToString = Object.prototype.toString;
+var toTypeString = (value) => objectToString.call(value);
+var toRawType = (value) => {
+ return toTypeString(value).slice(8, -1);
+};
+var isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
+var cacheStringFunction = (fn) => {
+ const cache = Object.create(null);
+ return (str) => {
+ const hit = cache[str];
+ return hit || (cache[str] = fn(str));
+ };
+};
+var camelizeRE = /-(\w)/g;
+var camelize = cacheStringFunction((str) => {
+ return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
+});
+var hyphenateRE = /\B([A-Z])/g;
+var hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
+var capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
+var toHandlerKey = cacheStringFunction((str) => str ? `on${capitalize(str)}` : ``);
+var hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
+
+// node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js
+var targetMap = new WeakMap();
+var effectStack = [];
+var activeEffect;
+var ITERATE_KEY = Symbol(true ? "iterate" : "");
+var MAP_KEY_ITERATE_KEY = Symbol(true ? "Map key iterate" : "");
+function isEffect(fn) {
+ return fn && fn._isEffect === true;
+}
+function effect2(fn, options = EMPTY_OBJ) {
+ if (isEffect(fn)) {
+ fn = fn.raw;
+ }
+ const effect3 = createReactiveEffect(fn, options);
+ if (!options.lazy) {
+ effect3();
+ }
+ return effect3;
+}
+function stop(effect3) {
+ if (effect3.active) {
+ cleanup(effect3);
+ if (effect3.options.onStop) {
+ effect3.options.onStop();
+ }
+ effect3.active = false;
+ }
+}
+var uid = 0;
+function createReactiveEffect(fn, options) {
+ const effect3 = function reactiveEffect() {
+ if (!effect3.active) {
+ return fn();
+ }
+ if (!effectStack.includes(effect3)) {
+ cleanup(effect3);
+ try {
+ enableTracking();
+ effectStack.push(effect3);
+ activeEffect = effect3;
+ return fn();
+ } finally {
+ effectStack.pop();
+ resetTracking();
+ activeEffect = effectStack[effectStack.length - 1];
+ }
+ }
+ };
+ effect3.id = uid++;
+ effect3.allowRecurse = !!options.allowRecurse;
+ effect3._isEffect = true;
+ effect3.active = true;
+ effect3.raw = fn;
+ effect3.deps = [];
+ effect3.options = options;
+ return effect3;
+}
+function cleanup(effect3) {
+ const {deps} = effect3;
+ if (deps.length) {
+ for (let i = 0; i < deps.length; i++) {
+ deps[i].delete(effect3);
+ }
+ deps.length = 0;
+ }
+}
+var shouldTrack = true;
+var trackStack = [];
+function pauseTracking() {
+ trackStack.push(shouldTrack);
+ shouldTrack = false;
+}
+function enableTracking() {
+ trackStack.push(shouldTrack);
+ shouldTrack = true;
+}
+function resetTracking() {
+ const last = trackStack.pop();
+ shouldTrack = last === void 0 ? true : last;
+}
+function track(target, type, key) {
+ if (!shouldTrack || activeEffect === void 0) {
+ return;
+ }
+ let depsMap = targetMap.get(target);
+ if (!depsMap) {
+ targetMap.set(target, depsMap = new Map());
+ }
+ let dep = depsMap.get(key);
+ if (!dep) {
+ depsMap.set(key, dep = new Set());
+ }
+ if (!dep.has(activeEffect)) {
+ dep.add(activeEffect);
+ activeEffect.deps.push(dep);
+ if (activeEffect.options.onTrack) {
+ activeEffect.options.onTrack({
+ effect: activeEffect,
+ target,
+ type,
+ key
+ });
+ }
+ }
+}
+function trigger(target, type, key, newValue, oldValue, oldTarget) {
+ const depsMap = targetMap.get(target);
+ if (!depsMap) {
+ return;
+ }
+ const effects = new Set();
+ const add2 = (effectsToAdd) => {
+ if (effectsToAdd) {
+ effectsToAdd.forEach((effect3) => {
+ if (effect3 !== activeEffect || effect3.allowRecurse) {
+ effects.add(effect3);
+ }
+ });
+ }
+ };
+ if (type === "clear") {
+ depsMap.forEach(add2);
+ } else if (key === "length" && isArray(target)) {
+ depsMap.forEach((dep, key2) => {
+ if (key2 === "length" || key2 >= newValue) {
+ add2(dep);
+ }
+ });
+ } else {
+ if (key !== void 0) {
+ add2(depsMap.get(key));
+ }
+ switch (type) {
+ case "add":
+ if (!isArray(target)) {
+ add2(depsMap.get(ITERATE_KEY));
+ if (isMap(target)) {
+ add2(depsMap.get(MAP_KEY_ITERATE_KEY));
+ }
+ } else if (isIntegerKey(key)) {
+ add2(depsMap.get("length"));
+ }
+ break;
+ case "delete":
+ if (!isArray(target)) {
+ add2(depsMap.get(ITERATE_KEY));
+ if (isMap(target)) {
+ add2(depsMap.get(MAP_KEY_ITERATE_KEY));
+ }
+ }
+ break;
+ case "set":
+ if (isMap(target)) {
+ add2(depsMap.get(ITERATE_KEY));
+ }
+ break;
+ }
+ }
+ const run = (effect3) => {
+ if (effect3.options.onTrigger) {
+ effect3.options.onTrigger({
+ effect: effect3,
+ target,
+ key,
+ type,
+ newValue,
+ oldValue,
+ oldTarget
+ });
+ }
+ if (effect3.options.scheduler) {
+ effect3.options.scheduler(effect3);
+ } else {
+ effect3();
+ }
+ };
+ effects.forEach(run);
+}
+var isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
+var builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol).map((key) => Symbol[key]).filter(isSymbol));
+var get2 = /* @__PURE__ */ createGetter();
+var shallowGet = /* @__PURE__ */ createGetter(false, true);
+var readonlyGet = /* @__PURE__ */ createGetter(true);
+var shallowReadonlyGet = /* @__PURE__ */ createGetter(true, true);
+var arrayInstrumentations = {};
+["includes", "indexOf", "lastIndexOf"].forEach((key) => {
+ const method = Array.prototype[key];
+ arrayInstrumentations[key] = function(...args) {
+ const arr = toRaw(this);
+ for (let i = 0, l = this.length; i < l; i++) {
+ track(arr, "get", i + "");
+ }
+ const res = method.apply(arr, args);
+ if (res === -1 || res === false) {
+ return method.apply(arr, args.map(toRaw));
+ } else {
+ return res;
+ }
+ };
+});
+["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
+ const method = Array.prototype[key];
+ arrayInstrumentations[key] = function(...args) {
+ pauseTracking();
+ const res = method.apply(this, args);
+ resetTracking();
+ return res;
+ };
+});
+function createGetter(isReadonly = false, shallow = false) {
+ return function get3(target, key, receiver) {
+ if (key === "__v_isReactive") {
+ return !isReadonly;
+ } else if (key === "__v_isReadonly") {
+ return isReadonly;
+ } else if (key === "__v_raw" && receiver === (isReadonly ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
+ return target;
+ }
+ const targetIsArray = isArray(target);
+ if (!isReadonly && targetIsArray && hasOwn(arrayInstrumentations, key)) {
+ return Reflect.get(arrayInstrumentations, key, receiver);
+ }
+ const res = Reflect.get(target, key, receiver);
+ if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
+ return res;
+ }
+ if (!isReadonly) {
+ track(target, "get", key);
+ }
+ if (shallow) {
+ return res;
+ }
+ if (isRef(res)) {
+ const shouldUnwrap = !targetIsArray || !isIntegerKey(key);
+ return shouldUnwrap ? res.value : res;
+ }
+ if (isObject(res)) {
+ return isReadonly ? readonly(res) : reactive2(res);
+ }
+ return res;
+ };
+}
+var set2 = /* @__PURE__ */ createSetter();
+var shallowSet = /* @__PURE__ */ createSetter(true);
+function createSetter(shallow = false) {
+ return function set3(target, key, value, receiver) {
+ let oldValue = target[key];
+ if (!shallow) {
+ value = toRaw(value);
+ oldValue = toRaw(oldValue);
+ if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
+ oldValue.value = value;
+ return true;
+ }
+ }
+ const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
+ const result = Reflect.set(target, key, value, receiver);
+ if (target === toRaw(receiver)) {
+ if (!hadKey) {
+ trigger(target, "add", key, value);
+ } else if (hasChanged(value, oldValue)) {
+ trigger(target, "set", key, value, oldValue);
+ }
+ }
+ return result;
+ };
+}
+function deleteProperty(target, key) {
+ const hadKey = hasOwn(target, key);
+ const oldValue = target[key];
+ const result = Reflect.deleteProperty(target, key);
+ if (result && hadKey) {
+ trigger(target, "delete", key, void 0, oldValue);
+ }
+ return result;
+}
+function has(target, key) {
+ const result = Reflect.has(target, key);
+ if (!isSymbol(key) || !builtInSymbols.has(key)) {
+ track(target, "has", key);
+ }
+ return result;
+}
+function ownKeys(target) {
+ track(target, "iterate", isArray(target) ? "length" : ITERATE_KEY);
+ return Reflect.ownKeys(target);
+}
+var mutableHandlers = {
+ get: get2,
+ set: set2,
+ deleteProperty,
+ has,
+ ownKeys
+};
+var readonlyHandlers = {
+ get: readonlyGet,
+ set(target, key) {
+ if (true) {
+ console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
+ }
+ return true;
+ },
+ deleteProperty(target, key) {
+ if (true) {
+ console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
+ }
+ return true;
+ }
+};
+var shallowReactiveHandlers = extend({}, mutableHandlers, {
+ get: shallowGet,
+ set: shallowSet
+});
+var shallowReadonlyHandlers = extend({}, readonlyHandlers, {
+ get: shallowReadonlyGet
+});
+var toReactive = (value) => isObject(value) ? reactive2(value) : value;
+var toReadonly = (value) => isObject(value) ? readonly(value) : value;
+var toShallow = (value) => value;
+var getProto = (v) => Reflect.getPrototypeOf(v);
+function get$1(target, key, isReadonly = false, isShallow = false) {
+ target = target["__v_raw"];
+ const rawTarget = toRaw(target);
+ const rawKey = toRaw(key);
+ if (key !== rawKey) {
+ !isReadonly && track(rawTarget, "get", key);
+ }
+ !isReadonly && track(rawTarget, "get", rawKey);
+ const {has: has2} = getProto(rawTarget);
+ const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
+ if (has2.call(rawTarget, key)) {
+ return wrap(target.get(key));
+ } else if (has2.call(rawTarget, rawKey)) {
+ return wrap(target.get(rawKey));
+ } else if (target !== rawTarget) {
+ target.get(key);
+ }
+}
+function has$1(key, isReadonly = false) {
+ const target = this["__v_raw"];
+ const rawTarget = toRaw(target);
+ const rawKey = toRaw(key);
+ if (key !== rawKey) {
+ !isReadonly && track(rawTarget, "has", key);
+ }
+ !isReadonly && track(rawTarget, "has", rawKey);
+ return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
+}
+function size(target, isReadonly = false) {
+ target = target["__v_raw"];
+ !isReadonly && track(toRaw(target), "iterate", ITERATE_KEY);
+ return Reflect.get(target, "size", target);
+}
+function add(value) {
+ value = toRaw(value);
+ const target = toRaw(this);
+ const proto = getProto(target);
+ const hadKey = proto.has.call(target, value);
+ if (!hadKey) {
+ target.add(value);
+ trigger(target, "add", value, value);
+ }
+ return this;
+}
+function set$1(key, value) {
+ value = toRaw(value);
+ const target = toRaw(this);
+ const {has: has2, get: get3} = getProto(target);
+ let hadKey = has2.call(target, key);
+ if (!hadKey) {
+ key = toRaw(key);
+ hadKey = has2.call(target, key);
+ } else if (true) {
+ checkIdentityKeys(target, has2, key);
+ }
+ const oldValue = get3.call(target, key);
+ target.set(key, value);
+ if (!hadKey) {
+ trigger(target, "add", key, value);
+ } else if (hasChanged(value, oldValue)) {
+ trigger(target, "set", key, value, oldValue);
+ }
+ return this;
+}
+function deleteEntry(key) {
+ const target = toRaw(this);
+ const {has: has2, get: get3} = getProto(target);
+ let hadKey = has2.call(target, key);
+ if (!hadKey) {
+ key = toRaw(key);
+ hadKey = has2.call(target, key);
+ } else if (true) {
+ checkIdentityKeys(target, has2, key);
+ }
+ const oldValue = get3 ? get3.call(target, key) : void 0;
+ const result = target.delete(key);
+ if (hadKey) {
+ trigger(target, "delete", key, void 0, oldValue);
+ }
+ return result;
+}
+function clear() {
+ const target = toRaw(this);
+ const hadItems = target.size !== 0;
+ const oldTarget = true ? isMap(target) ? new Map(target) : new Set(target) : void 0;
+ const result = target.clear();
+ if (hadItems) {
+ trigger(target, "clear", void 0, void 0, oldTarget);
+ }
+ return result;
+}
+function createForEach(isReadonly, isShallow) {
+ return function forEach(callback, thisArg) {
+ const observed = this;
+ const target = observed["__v_raw"];
+ const rawTarget = toRaw(target);
+ const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
+ !isReadonly && track(rawTarget, "iterate", ITERATE_KEY);
+ return target.forEach((value, key) => {
+ return callback.call(thisArg, wrap(value), wrap(key), observed);
+ });
+ };
+}
+function createIterableMethod(method, isReadonly, isShallow) {
+ return function(...args) {
+ const target = this["__v_raw"];
+ const rawTarget = toRaw(target);
+ const targetIsMap = isMap(rawTarget);
+ const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
+ const isKeyOnly = method === "keys" && targetIsMap;
+ const innerIterator = target[method](...args);
+ const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
+ !isReadonly && track(rawTarget, "iterate", isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
+ return {
+ next() {
+ const {value, done} = innerIterator.next();
+ return done ? {value, done} : {
+ value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
+ done
+ };
+ },
+ [Symbol.iterator]() {
+ return this;
+ }
+ };
+ };
+}
+function createReadonlyMethod(type) {
+ return function(...args) {
+ if (true) {
+ const key = args[0] ? `on key "${args[0]}" ` : ``;
+ console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));
+ }
+ return type === "delete" ? false : this;
+ };
+}
+var mutableInstrumentations = {
+ get(key) {
+ return get$1(this, key);
+ },
+ get size() {
+ return size(this);
+ },
+ has: has$1,
+ add,
+ set: set$1,
+ delete: deleteEntry,
+ clear,
+ forEach: createForEach(false, false)
+};
+var shallowInstrumentations = {
+ get(key) {
+ return get$1(this, key, false, true);
+ },
+ get size() {
+ return size(this);
+ },
+ has: has$1,
+ add,
+ set: set$1,
+ delete: deleteEntry,
+ clear,
+ forEach: createForEach(false, true)
+};
+var readonlyInstrumentations = {
+ get(key) {
+ return get$1(this, key, true);
+ },
+ get size() {
+ return size(this, true);
+ },
+ has(key) {
+ return has$1.call(this, key, true);
+ },
+ add: createReadonlyMethod("add"),
+ set: createReadonlyMethod("set"),
+ delete: createReadonlyMethod("delete"),
+ clear: createReadonlyMethod("clear"),
+ forEach: createForEach(true, false)
+};
+var shallowReadonlyInstrumentations = {
+ get(key) {
+ return get$1(this, key, true, true);
+ },
+ get size() {
+ return size(this, true);
+ },
+ has(key) {
+ return has$1.call(this, key, true);
+ },
+ add: createReadonlyMethod("add"),
+ set: createReadonlyMethod("set"),
+ delete: createReadonlyMethod("delete"),
+ clear: createReadonlyMethod("clear"),
+ forEach: createForEach(true, true)
+};
+var iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
+iteratorMethods.forEach((method) => {
+ mutableInstrumentations[method] = createIterableMethod(method, false, false);
+ readonlyInstrumentations[method] = createIterableMethod(method, true, false);
+ shallowInstrumentations[method] = createIterableMethod(method, false, true);
+ shallowReadonlyInstrumentations[method] = createIterableMethod(method, true, true);
+});
+function createInstrumentationGetter(isReadonly, shallow) {
+ const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;
+ return (target, key, receiver) => {
+ if (key === "__v_isReactive") {
+ return !isReadonly;
+ } else if (key === "__v_isReadonly") {
+ return isReadonly;
+ } else if (key === "__v_raw") {
+ return target;
+ }
+ return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
+ };
+}
+var mutableCollectionHandlers = {
+ get: createInstrumentationGetter(false, false)
+};
+var shallowCollectionHandlers = {
+ get: createInstrumentationGetter(false, true)
+};
+var readonlyCollectionHandlers = {
+ get: createInstrumentationGetter(true, false)
+};
+var shallowReadonlyCollectionHandlers = {
+ get: createInstrumentationGetter(true, true)
+};
+function checkIdentityKeys(target, has2, key) {
+ const rawKey = toRaw(key);
+ if (rawKey !== key && has2.call(target, rawKey)) {
+ const type = toRawType(target);
+ console.warn(`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`);
+ }
+}
+var reactiveMap = new WeakMap();
+var shallowReactiveMap = new WeakMap();
+var readonlyMap = new WeakMap();
+var shallowReadonlyMap = new WeakMap();
+function targetTypeMap(rawType) {
+ switch (rawType) {
+ case "Object":
+ case "Array":
+ return 1;
+ case "Map":
+ case "Set":
+ case "WeakMap":
+ case "WeakSet":
+ return 2;
+ default:
+ return 0;
+ }
+}
+function getTargetType(value) {
+ return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
+}
+function reactive2(target) {
+ if (target && target["__v_isReadonly"]) {
+ return target;
+ }
+ return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
+}
+function readonly(target) {
+ return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
+}
+function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers, proxyMap) {
+ if (!isObject(target)) {
+ if (true) {
+ console.warn(`value cannot be made reactive: ${String(target)}`);
+ }
+ return target;
+ }
+ if (target["__v_raw"] && !(isReadonly && target["__v_isReactive"])) {
+ return target;
+ }
+ const existingProxy = proxyMap.get(target);
+ if (existingProxy) {
+ return existingProxy;
+ }
+ const targetType = getTargetType(target);
+ if (targetType === 0) {
+ return target;
+ }
+ const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
+ proxyMap.set(target, proxy);
+ return proxy;
+}
+function toRaw(observed) {
+ return observed && toRaw(observed["__v_raw"]) || observed;
+}
+function isRef(r) {
+ return Boolean(r && r.__v_isRef === true);
+}
// packages/alpinejs/src/magics/$nextTick.js
magic("nextTick", () => nextTick);
@@ -2725,7 +2161,7 @@ magic("watch", (el, {evaluateLater: evaluateLater2, effect: effect3}) => (key, c
let evaluate2 = evaluateLater2(key);
let firstTime = true;
let oldValue;
- effect3(() => evaluate2((value) => {
+ let effectReference = effect3(() => evaluate2((value) => {
JSON.stringify(value);
if (!firstTime) {
queueMicrotask(() => {
@@ -2737,6 +2173,7 @@ magic("watch", (el, {evaluateLater: evaluateLater2, effect: effect3}) => (key, c
}
firstTime = false;
}));
+ el._x_effects.delete(effectReference);
});
// packages/alpinejs/src/magics/$store.js
@@ -2796,8 +2233,15 @@ magic("id", (el) => (name, key = null) => {
// packages/alpinejs/src/magics/$el.js
magic("el", (el) => el);
+// packages/alpinejs/src/magics/index.js
+warnMissingPluginMagic("Focus", "focus", "focus");
+warnMissingPluginMagic("Persist", "persist", "persist");
+function warnMissingPluginMagic(name, magicName, slug) {
+ magic(magicName, (el) => warn(`You can't use [$${directiveName}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el));
+}
+
// packages/alpinejs/src/directives/x-modelable.js
-directive("modelable", (el, {expression}, {effect: effect3, evaluate: evaluate2, evaluateLater: evaluateLater2}) => {
+directive("modelable", (el, {expression}, {effect: effect3, evaluateLater: evaluateLater2}) => {
let func = evaluateLater2(expression);
let innerGet = () => {
let result;
@@ -2808,12 +2252,11 @@ directive("modelable", (el, {expression}, {effect: effect3, evaluate: evaluate2,
let innerSet = (val) => evaluateInnerSet(() => {
}, {scope: {__placeholder: val}});
let initialValue = innerGet();
- if (el._x_modelable_hook)
- initialValue = el._x_modelable_hook(initialValue);
innerSet(initialValue);
queueMicrotask(() => {
if (!el._x_model)
return;
+ el._x_removeModelListeners["default"]();
let outerGet = el._x_model.get;
let outerSet = el._x_model.set;
effect3(() => innerSet(outerGet()));
@@ -2822,7 +2265,7 @@ directive("modelable", (el, {expression}, {effect: effect3, evaluate: evaluate2,
});
// packages/alpinejs/src/directives/x-teleport.js
-directive("teleport", (el, {expression}, {cleanup}) => {
+directive("teleport", (el, {expression}, {cleanup: cleanup2}) => {
if (el.tagName.toLowerCase() !== "template")
warn("x-teleport can only be used on a <template> tag", el);
let target = document.querySelector(expression);
@@ -2845,15 +2288,15 @@ directive("teleport", (el, {expression}, {cleanup}) => {
initTree(clone2);
clone2._x_ignore = true;
});
- cleanup(() => clone2.remove());
+ cleanup2(() => clone2.remove());
});
// packages/alpinejs/src/directives/x-ignore.js
var handler = () => {
};
-handler.inline = (el, {modifiers}, {cleanup}) => {
+handler.inline = (el, {modifiers}, {cleanup: cleanup2}) => {
modifiers.includes("self") ? el._x_ignoreSelf = true : el._x_ignore = true;
- cleanup(() => {
+ cleanup2(() => {
modifiers.includes("self") ? delete el._x_ignoreSelf : delete el._x_ignore;
});
};
@@ -2899,6 +2342,8 @@ function on(el, event, modifiers, callback) {
handler3 = wrapHandler(handler3, (next, e) => {
if (el.contains(e.target))
return;
+ if (e.target.isConnected === false)
+ return;
if (el.offsetWidth < 1 && el.offsetHeight < 1)
return;
if (el._x_isShown === false)
@@ -2906,6 +2351,12 @@ function on(el, event, modifiers, callback) {
next(e);
});
}
+ if (modifiers.includes("once")) {
+ handler3 = wrapHandler(handler3, (next, e) => {
+ next(e);
+ listenerTarget.removeEventListener(event, handler3, options);
+ });
+ }
handler3 = wrapHandler(handler3, (next, e) => {
if (isKeyEvent(event)) {
if (isListeningForASpecificKeyThatHasntBeenPressed(e, modifiers)) {
@@ -2924,12 +2375,6 @@ function on(el, event, modifiers, callback) {
let wait = isNumeric(nextModifier.split("ms")[0]) ? Number(nextModifier.split("ms")[0]) : 250;
handler3 = throttle(handler3, wait);
}
- if (modifiers.includes("once")) {
- handler3 = wrapHandler(handler3, (next, e) => {
- next(e);
- listenerTarget.removeEventListener(event, handler3, options);
- });
- }
listenerTarget.addEventListener(event, handler3, options);
return () => {
listenerTarget.removeEventListener(event, handler3, options);
@@ -3004,7 +2449,7 @@ function keyToModifiers(key) {
}
// packages/alpinejs/src/directives/x-model.js
-directive("model", (el, {modifiers, expression}, {effect: effect3, cleanup}) => {
+directive("model", (el, {modifiers, expression}, {effect: effect3, cleanup: cleanup2}) => {
let evaluate2 = evaluateLater(el, expression);
let assignmentExpression = `${expression} = rightSideOfExpression($event, ${expression})`;
let evaluateAssignment = evaluateLater(el, assignmentExpression);
@@ -3017,7 +2462,10 @@ directive("model", (el, {modifiers, expression}, {effect: effect3, cleanup}) =>
rightSideOfExpression: assigmentFunction
}});
});
- cleanup(() => removeListener());
+ if (!el._x_removeModelListeners)
+ el._x_removeModelListeners = {};
+ el._x_removeModelListeners["default"] = removeListener;
+ cleanup2(() => el._x_removeModelListeners["default"]());
let evaluateSetModel = evaluateLater(el, `${expression} = __placeholder`);
el._x_model = {
get() {
@@ -3117,7 +2565,12 @@ directive("html", (el, {expression}, {effect: effect3, evaluateLater: evaluateLa
let evaluate2 = evaluateLater2(expression);
effect3(() => {
evaluate2((value) => {
- el.innerHTML = value;
+ mutateDom(() => {
+ el.innerHTML = value;
+ el._x_ignoreSelf = true;
+ initTree(el);
+ delete el._x_ignoreSelf;
+ });
});
});
});
@@ -3168,7 +2621,7 @@ function storeKeyForXFor(el, expression) {
// packages/alpinejs/src/directives/x-data.js
addRootSelector(() => `[${prefix("data")}]`);
-directive("data", skipDuringClone((el, {expression}, {cleanup}) => {
+directive("data", skipDuringClone((el, {expression}, {cleanup: cleanup2}) => {
expression = expression === "" ? "{}" : expression;
let magicContext = {};
let cleanup1 = injectMagics(magicContext, el).cleanup;
@@ -3177,34 +2630,45 @@ directive("data", skipDuringClone((el, {expression}, {cleanup}) => {
let data2 = evaluate(el, expression, {scope: dataProviderContext});
if (data2 === void 0)
data2 = {};
- let cleanup2 = injectMagics(data2, el).cleanup;
+ let cleanup22 = injectMagics(data2, el).cleanup;
let reactiveData = reactive(data2);
initInterceptors(reactiveData);
let undo = addScopeToNode(el, reactiveData);
reactiveData["init"] && evaluate(el, reactiveData["init"]);
- cleanup(() => {
+ cleanup2(() => {
undo();
cleanup1();
- cleanup2();
+ cleanup22();
reactiveData["destroy"] && evaluate(el, reactiveData["destroy"]);
+ undo();
});
}));
// packages/alpinejs/src/directives/x-show.js
directive("show", (el, {modifiers, expression}, {effect: effect3}) => {
let evaluate2 = evaluateLater(el, expression);
- let hide = () => mutateDom(() => {
- el.style.display = "none";
+ if (!el._x_doHide)
+ el._x_doHide = () => {
+ mutateDom(() => el.style.display = "none");
+ };
+ if (!el._x_doShow)
+ el._x_doShow = () => {
+ mutateDom(() => {
+ if (el.style.length === 1 && el.style.display === "none") {
+ el.removeAttribute("style");
+ } else {
+ el.style.removeProperty("display");
+ }
+ });
+ };
+ let hide = () => {
+ el._x_doHide();
el._x_isShown = false;
- });
- let show = () => mutateDom(() => {
- if (el.style.length === 1 && el.style.display === "none") {
- el.removeAttribute("style");
- } else {
- el.style.removeProperty("display");
- }
+ };
+ let show = () => {
+ el._x_doShow();
el._x_isShown = true;
- });
+ };
let clickAwayCompatibleShow = () => setTimeout(show);
let toggle = once((value) => value ? show() : hide(), (value) => {
if (typeof el._x_toggleAndCascadeWithTransitions === "function") {
@@ -3227,21 +2691,21 @@ directive("show", (el, {modifiers, expression}, {effect: effect3}) => {
});
// packages/alpinejs/src/directives/x-for.js
-directive("for", (el, {expression}, {effect: effect3, cleanup}) => {
+directive("for", (el, {expression}, {effect: effect3, cleanup: cleanup2}) => {
let iteratorNames = parseForExpression(expression);
let evaluateItems = evaluateLater(el, iteratorNames.items);
let evaluateKey = evaluateLater(el, el._x_keyExpression || "index");
el._x_prevKeys = [];
el._x_lookup = {};
effect3(() => loop(el, iteratorNames, evaluateItems, evaluateKey));
- cleanup(() => {
+ cleanup2(() => {
Object.values(el._x_lookup).forEach((el2) => el2.remove());
delete el._x_prevKeys;
delete el._x_lookup;
});
});
function loop(el, iteratorNames, evaluateItems, evaluateKey) {
- let isObject = (i) => typeof i === "object" && !Array.isArray(i);
+ let isObject2 = (i) => typeof i === "object" && !Array.isArray(i);
let templateEl = el;
evaluateItems((items) => {
if (isNumeric3(items) && items >= 0) {
@@ -3253,7 +2717,7 @@ function loop(el, iteratorNames, evaluateItems, evaluateKey) {
let prevKeys = el._x_prevKeys;
let scopes = [];
let keys = [];
- if (isObject(items)) {
+ if (isObject2(items)) {
items = Object.entries(items).map(([key, value]) => {
let scope2 = getIterationScopeVariables(iteratorNames, value, key, items);
evaluateKey((value2) => keys.push(value2), {scope: {index: key, ...scope2}});
@@ -3392,17 +2856,17 @@ function isNumeric3(subject) {
// packages/alpinejs/src/directives/x-ref.js
function handler2() {
}
-handler2.inline = (el, {expression}, {cleanup}) => {
+handler2.inline = (el, {expression}, {cleanup: cleanup2}) => {
let root = closestRoot(el);
if (!root._x_refs)
root._x_refs = {};
root._x_refs[expression] = el;
- cleanup(() => delete root._x_refs[expression]);
+ cleanup2(() => delete root._x_refs[expression]);
};
directive("ref", handler2);
// packages/alpinejs/src/directives/x-if.js
-directive("if", (el, {expression}, {effect: effect3, cleanup}) => {
+directive("if", (el, {expression}, {effect: effect3, cleanup: cleanup2}) => {
let evaluate2 = evaluateLater(el, expression);
let show = () => {
if (el._x_currentIfEl)
@@ -3434,7 +2898,7 @@ directive("if", (el, {expression}, {effect: effect3, cleanup}) => {
effect3(() => evaluate2((value) => {
value ? show() : hide();
}));
- cleanup(() => el._x_undoIf && el._x_undoIf());
+ cleanup2(() => el._x_undoIf && el._x_undoIf());
});
// packages/alpinejs/src/directives/x-id.js
@@ -3445,7 +2909,7 @@ directive("id", (el, {expression}, {evaluate: evaluate2}) => {
// packages/alpinejs/src/directives/x-on.js
mapAttributes(startingWith("@", into(prefix("on:"))));
-directive("on", skipDuringClone((el, {value, modifiers, expression}, {cleanup}) => {
+directive("on", skipDuringClone((el, {value, modifiers, expression}, {cleanup: cleanup2}) => {
let evaluate2 = expression ? evaluateLater(el, expression) : () => {
};
if (el.tagName.toLowerCase() === "template") {
@@ -3458,12 +2922,21 @@ directive("on", skipDuringClone((el, {value, modifiers, expression}, {cleanup})
evaluate2(() => {
}, {scope: {$event: e}, params: [e]});
});
- cleanup(() => removeListener());
+ cleanup2(() => removeListener());
}));
+// packages/alpinejs/src/directives/index.js
+warnMissingPluginDirective("Collapse", "collapse", "collapse");
+warnMissingPluginDirective("Intersect", "intersect", "intersect");
+warnMissingPluginDirective("Focus", "trap", "focus");
+warnMissingPluginDirective("Mask", "mask", "mask");
+function warnMissingPluginDirective(name, directiveName2, slug) {
+ directive(directiveName2, (el) => warn(`You can't use [x-${directiveName2}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el));
+}
+
// packages/alpinejs/src/index.js
alpine_default.setEvaluator(normalEvaluator);
-alpine_default.setReactivityEngine({reactive: import_reactivity8.reactive, effect: import_reactivity8.effect, release: import_reactivity8.stop, raw: import_reactivity8.toRaw});
+alpine_default.setReactivityEngine({reactive: reactive2, effect: effect2, release: stop, raw: toRaw});
var src_default = alpine_default;
// packages/alpinejs/builds/module.js
diff --git a/alpinejs/packages/alpinejs/package.json b/alpinejs/packages/alpinejs/package.json
index 3902705..24b6a3f 100644
--- a/alpinejs/packages/alpinejs/package.json
+++ b/alpinejs/packages/alpinejs/package.json
@@ -1,6 +1,6 @@
{
"name": "alpinejs",
- "version": "3.9.1",
+ "version": "3.10.2",
"description": "The rugged, minimal JavaScript framework",
"author": "Caleb Porzio",
"license": "MIT",
diff --git a/alpinejs/packages/alpinejs/src/alpine.js b/alpinejs/packages/alpinejs/src/alpine.js
index 7028bb1..b9a7796 100644
--- a/alpinejs/packages/alpinejs/src/alpine.js
+++ b/alpinejs/packages/alpinejs/src/alpine.js
@@ -3,7 +3,7 @@ import { mapAttributes, directive, setPrefix as prefix, prefix as prefixed } fro
import { start, addRootSelector, addInitSelector, closestRoot, findClosest, initTree, destroyTree } from './lifecycle'
import { mutateDom, deferMutations, flushAndStopDeferringMutations, stopObservingMutations } from './mutation'
import { mergeProxies, closestDataStack, addScopeToNode, scope as $data } from './scope'
-import { setEvaluator, evaluate, evaluateLater } from './evaluator'
+import { setEvaluator, evaluate, evaluateLater, dontAutoEvaluateFunctions } from './evaluator'
import { transition } from './directives/x-transition'
import { clone, skipDuringClone } from './clone'
import { interceptor } from './interceptor'
@@ -25,6 +25,7 @@ let Alpine = {
get raw() { return raw },
version: ALPINE_VERSION,
flushAndStopDeferringMutations,
+ dontAutoEvaluateFunctions,
disableEffectScheduling,
stopObservingMutations,
destroyTree,
diff --git a/alpinejs/packages/alpinejs/src/directives.js b/alpinejs/packages/alpinejs/src/directives.js
index 42d1654..4a1b9cf 100644
--- a/alpinejs/packages/alpinejs/src/directives.js
+++ b/alpinejs/packages/alpinejs/src/directives.js
@@ -170,6 +170,7 @@ let directiveOrder = [
'bind',
'init',
'for',
+ 'mask',
'model',
'modelable',
'transition',
diff --git a/alpinejs/packages/alpinejs/src/directives/index.js b/alpinejs/packages/alpinejs/src/directives/index.js
index 8da02c5..0c9ed3b 100644
--- a/alpinejs/packages/alpinejs/src/directives/index.js
+++ b/alpinejs/packages/alpinejs/src/directives/index.js
@@ -1,3 +1,6 @@
+import { directive } from '../directives'
+import { warn } from '../utils/warn'
+
import './x-transition'
import './x-modelable'
import './x-teleport'
@@ -16,3 +19,13 @@ import './x-ref'
import './x-if'
import './x-id'
import './x-on'
+
+// Register warnings for people using plugin syntaxes and not loading the plugin itself:
+warnMissingPluginDirective('Collapse', 'collapse', 'collapse')
+warnMissingPluginDirective('Intersect', 'intersect', 'intersect')
+warnMissingPluginDirective('Focus', 'trap', 'focus')
+warnMissingPluginDirective('Mask', 'mask', 'mask')
+
+function warnMissingPluginDirective(name, directiveName, slug) {
+ directive(directiveName, (el) => warn(`You can't use [x-${directiveName}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el))
+}
diff --git a/alpinejs/packages/alpinejs/src/directives/x-data.js b/alpinejs/packages/alpinejs/src/directives/x-data.js
index da20b8f..5e41f90 100644
--- a/alpinejs/packages/alpinejs/src/directives/x-data.js
+++ b/alpinejs/packages/alpinejs/src/directives/x-data.js
@@ -41,5 +41,7 @@ directive('data', skipDuringClone((el, { expression }, { cleanup }) => {
cleanup2()
reactiveData['destroy'] && evaluate(el, reactiveData['destroy'])
+
+ undo()
})
}))
diff --git a/alpinejs/packages/alpinejs/src/directives/x-html.js b/alpinejs/packages/alpinejs/src/directives/x-html.js
index b4977d3..d434ec2 100644
--- a/alpinejs/packages/alpinejs/src/directives/x-html.js
+++ b/alpinejs/packages/alpinejs/src/directives/x-html.js
@@ -1,5 +1,5 @@
-import { evaluateLater } from '../evaluator'
import { directive } from '../directives'
+import { initTree } from '../lifecycle'
import { mutateDom } from '../mutation'
directive('html', (el, { expression }, { effect, evaluateLater }) => {
@@ -7,7 +7,13 @@ directive('html', (el, { expression }, { effect, evaluateLater }) => {
effect(() => {
evaluate(value => {
- el.innerHTML = value
+ mutateDom(() => {
+ el.innerHTML = value
+
+ el._x_ignoreSelf = true
+ initTree(el)
+ delete el._x_ignoreSelf
+ })
})
})
})
diff --git a/alpinejs/packages/alpinejs/src/directives/x-model.js b/alpinejs/packages/alpinejs/src/directives/x-model.js
index b35e124..0db3d5a 100644
--- a/alpinejs/packages/alpinejs/src/directives/x-model.js
+++ b/alpinejs/packages/alpinejs/src/directives/x-model.js
@@ -25,12 +25,19 @@ directive('model', (el, { modifiers, expression }, { effect, cleanup }) => {
}})
})
- cleanup(() => removeListener())
+ // Register the listener removal callback on the element, so that
+ // in addition to the cleanup function, x-modelable may call it.
+ // Also, make this a keyed object if we decide to reintroduce
+ // "named modelables" some time in a future Alpine version.
+ if (! el._x_removeModelListeners) el._x_removeModelListeners = {}
+ el._x_removeModelListeners['default'] = removeListener
+
+ cleanup(() => el._x_removeModelListeners['default']())
// Allow programmatic overiding of x-model.
let evaluateSetModel = evaluateLater(el, `${expression} = __placeholder`)
el._x_model = {
- get() {
+ get() {
let result
evaluate(value => result = value)
return result
@@ -73,7 +80,7 @@ function generateAssignmentFunction(el, modifiers, expression) {
return (event, currentValue) => {
return mutateDom(() => {
// Check for event.detail due to an issue where IE11 handles other events as a CustomEvent.
- // Safari autofill triggers event as CustomEvent and assigns value to target
+ // Safari autofill triggers event as CustomEvent and assigns value to target
// so we return event.target.value instead of event.detail
if (event instanceof CustomEvent && event.detail !== undefined) {
return event.detail || event.target.value
diff --git a/alpinejs/packages/alpinejs/src/directives/x-modelable.js b/alpinejs/packages/alpinejs/src/directives/x-modelable.js
index 572bf9a..4cd7ac0 100644
--- a/alpinejs/packages/alpinejs/src/directives/x-modelable.js
+++ b/alpinejs/packages/alpinejs/src/directives/x-modelable.js
@@ -1,7 +1,6 @@
-import { evaluateLater } from '../evaluator'
import { directive } from '../directives'
-directive('modelable', (el, { expression }, { effect, evaluate, evaluateLater }) => {
+directive('modelable', (el, { expression }, { effect, evaluateLater }) => {
let func = evaluateLater(expression)
let innerGet = () => { let result; func(i => result = i); return result; }
let evaluateInnerSet = evaluateLater(`${expression} = __placeholder`)
@@ -9,13 +8,16 @@ directive('modelable', (el, { expression }, { effect, evaluate, evaluateLater })
let initialValue = innerGet()
- // Allow packages like Livewire to hook into $modelable. Ex: `wire:model.defer`
- if (el._x_modelable_hook) initialValue = el._x_modelable_hook(initialValue)
-
innerSet(initialValue)
queueMicrotask(() => {
if (! el._x_model) return
+
+ // Remove native event listeners as these are now bound with x-modelable.
+ // The reason for this is that it's often useful to wrap <input> elements
+ // in x-modelable/model, but the input events from the native input
+ // override any functionality added by x-modelable causing confusion.
+ el._x_removeModelListeners['default']()
let outerGet = el._x_model.get
let outerSet = el._x_model.set
diff --git a/alpinejs/packages/alpinejs/src/directives/x-show.js b/alpinejs/packages/alpinejs/src/directives/x-show.js
index b9619b5..3a1369a 100644
--- a/alpinejs/packages/alpinejs/src/directives/x-show.js
+++ b/alpinejs/packages/alpinejs/src/directives/x-show.js
@@ -6,21 +6,31 @@ import { once } from '../utils/once'
directive('show', (el, { modifiers, expression }, { effect }) => {
let evaluate = evaluateLater(el, expression)
- let hide = () => mutateDom(() => {
- el.style.display = 'none'
+ // We're going to set this function on the element directly so that
+ // other plugins like "Collapse" can overwrite them with their own logic.
+ if (! el._x_doHide) el._x_doHide = () => {
+ mutateDom(() => el.style.display = 'none')
+ }
- el._x_isShown = false
- })
+ if (! el._x_doShow) el._x_doShow = () => {
+ mutateDom(() => {
+ if (el.style.length === 1 && el.style.display === 'none') {
+ el.removeAttribute('style')
+ } else {
+ el.style.removeProperty('display')
+ }
+ })
+ }
- let show = () => mutateDom(() => {
- if (el.style.length === 1 && el.style.display === 'none') {
- el.removeAttribute('style')
- } else {
- el.style.removeProperty('display')
- }
+ let hide = () => {
+ el._x_doHide()
+ el._x_isShown = false
+ }
+ let show = () => {
+ el._x_doShow()
el._x_isShown = true
- })
+ }
// We are wrapping this function in a setTimeout here to prevent
// a race condition from happening where elements that have a
diff --git a/alpinejs/packages/alpinejs/src/evaluator.js b/alpinejs/packages/alpinejs/src/evaluator.js
index 5f1b0dd..8614eab 100644
--- a/alpinejs/packages/alpinejs/src/evaluator.js
+++ b/alpinejs/packages/alpinejs/src/evaluator.js
@@ -3,6 +3,18 @@ import { injectMagics } from './magics'
import { tryCatch, handleError } from './utils/error'
import { onAttributeRemoved } from './mutation'
+let shouldAutoEvaluateFunctions = true
+
+export function dontAutoEvaluateFunctions(callback) {
+ let cache = shouldAutoEvaluateFunctions
+
+ shouldAutoEvaluateFunctions = false
+
+ callback()
+
+ shouldAutoEvaluateFunctions = cache
+}
+
export function evaluate(el, expression, extras = {}) {
let result
@@ -94,7 +106,7 @@ function generateEvaluatorFromString(dataStack, expression, el) {
let completeScope = mergeProxies([ scope, ...dataStack ])
- if( typeof func === 'function' ) {
+ if (typeof func === 'function' ) {
let promise = func(func, completeScope).catch((error) => handleError(error, el, expression))
// Check if the function ran synchronously,
@@ -118,7 +130,7 @@ function generateEvaluatorFromString(dataStack, expression, el) {
}
export function runIfTypeOfFunction(receiver, value, scope, params, el) {
- if (typeof value === 'function') {
+ if (shouldAutoEvaluateFunctions && typeof value === 'function') {
let result = value.apply(scope, params)
if (result instanceof Promise) {
diff --git a/alpinejs/packages/alpinejs/src/magics/$watch.js b/alpinejs/packages/alpinejs/src/magics/$watch.js
index feb314c..5af5c11 100644
--- a/alpinejs/packages/alpinejs/src/magics/$watch.js
+++ b/alpinejs/packages/alpinejs/src/magics/$watch.js
@@ -7,7 +7,7 @@ magic('watch', (el, { evaluateLater, effect }) => (key, callback) => {
let oldValue
- effect(() => evaluate(value => {
+ let effectReference = effect(() => evaluate(value => {
// JSON.stringify touches every single property at any level enabling deep watching
JSON.stringify(value)
@@ -25,4 +25,10 @@ magic('watch', (el, { evaluateLater, effect }) => (key, callback) => {
firstTime = false
}))
+
+ // We want to remove this effect from the list of effects
+ // stored on an element. Livewire uses that list to
+ // "re-run" Alpine effects after a page load. A "watcher"
+ // shuldn't be re-run like that. It will cause infinite loops.
+ el._x_effects.delete(effectReference)
})
diff --git a/alpinejs/packages/alpinejs/src/magics/index.js b/alpinejs/packages/alpinejs/src/magics/index.js
index b3776c6..f233f0f 100644
--- a/alpinejs/packages/alpinejs/src/magics/index.js
+++ b/alpinejs/packages/alpinejs/src/magics/index.js
@@ -1,3 +1,6 @@
+import { warn } from '../utils/warn'
+import { magic } from '../magics'
+
import './$nextTick'
import './$dispatch'
import './$watch'
@@ -7,3 +10,11 @@ import './$root'
import './$refs'
import './$id'
import './$el'
+
+// Register warnings for people using plugin syntaxes and not loading the plugin itself:
+warnMissingPluginMagic('Focus', 'focus', 'focus')
+warnMissingPluginMagic('Persist', 'persist', 'persist')
+
+function warnMissingPluginMagic(name, magicName, slug) {
+ magic(magicName, (el) => warn(`You can't use [$${directiveName}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el))
+}
diff --git a/alpinejs/packages/alpinejs/src/nextTick.js b/alpinejs/packages/alpinejs/src/nextTick.js
index e5c0d88..50bfaaf 100644
--- a/alpinejs/packages/alpinejs/src/nextTick.js
+++ b/alpinejs/packages/alpinejs/src/nextTick.js
@@ -3,14 +3,19 @@ let tickStack = []
let isHolding = false
-export function nextTick(callback) {
- tickStack.push(callback)
-
- queueMicrotask(() => {
- isHolding || setTimeout(() => {
- releaseNextTicks()
- })
+export function nextTick(callback = () => {}) {
+ queueMicrotask(() => {
+ isHolding || setTimeout(() => {
+ releaseNextTicks()
})
+ })
+
+ return new Promise((res) => {
+ tickStack.push(() => {
+ callback();
+ res();
+ });
+ })
}
export function releaseNextTicks() {
diff --git a/alpinejs/packages/alpinejs/src/reactivity.js b/alpinejs/packages/alpinejs/src/reactivity.js
index b233d06..2b7add6 100644
--- a/alpinejs/packages/alpinejs/src/reactivity.js
+++ b/alpinejs/packages/alpinejs/src/reactivity.js
@@ -49,6 +49,8 @@ export function elementBoundEffect(el) {
release(effectReference)
}
+
+ return effectReference
}
return [wrappedEffect, () => { cleanup() }]
diff --git a/alpinejs/packages/alpinejs/src/utils/on.js b/alpinejs/packages/alpinejs/src/utils/on.js
index b000cfd..1727d37 100644
--- a/alpinejs/packages/alpinejs/src/utils/on.js
+++ b/alpinejs/packages/alpinejs/src/utils/on.js
@@ -28,6 +28,8 @@ export default function on (el, event, modifiers, callback) {
handler = wrapHandler(handler, (next, e) => {
if (el.contains(e.target)) return
+ if (e.target.isConnected === false) return
+
if (el.offsetWidth < 1 && el.offsetHeight < 1) return
// Additional check for special implementations like x-collapse
@@ -38,6 +40,14 @@ export default function on (el, event, modifiers, callback) {
})
}
+ if (modifiers.includes('once')) {
+ handler = wrapHandler(handler, (next, e) => {
+ next(e)
+
+ listenerTarget.removeEventListener(event, handler, options)
+ })
+ }
+
// Handle :keydown and :keyup listeners.
handler = wrapHandler(handler, (next, e) => {
if (isKeyEvent(event)) {
@@ -63,14 +73,6 @@ export default function on (el, event, modifiers, callback) {
handler = throttle(handler, wait)
}
- if (modifiers.includes('once')) {
- handler = wrapHandler(handler, (next, e) => {
- next(e)
-
- listenerTarget.removeEventListener(event, handler, options)
- })
- }
-
listenerTarget.addEventListener(event, handler, options)
return () => {
diff --git a/alpinejs/packages/collapse/dist/cdn.js b/alpinejs/packages/collapse/dist/cdn.js
index 4842723..fde041e 100644
--- a/alpinejs/packages/collapse/dist/cdn.js
+++ b/alpinejs/packages/collapse/dist/cdn.js
@@ -1,12 +1,22 @@
(() => {
// packages/collapse/src/index.js
function src_default(Alpine) {
- Alpine.directive("collapse", (el, {expression, modifiers}, {effect, evaluateLater}) => {
+ Alpine.directive("collapse", collapse);
+ collapse.inline = (el, {modifiers}) => {
+ if (!modifiers.includes("min"))
+ return;
+ el._x_doShow = () => {
+ };
+ el._x_doHide = () => {
+ };
+ };
+ function collapse(el, {modifiers}) {
let duration = modifierValue(modifiers, "duration", 250) / 1e3;
- let floor = 0;
+ let floor = modifierValue(modifiers, "min", 0);
+ let fullyHide = !modifiers.includes("min");
if (!el._x_isShown)
el.style.height = `${floor}px`;
- if (!el._x_isShown)
+ if (!el._x_isShown && fullyHide)
el.hidden = true;
if (!el._x_isShown)
el.style.overflow = "hidden";
@@ -24,8 +34,10 @@
in(before = () => {
}, after = () => {
}) {
- el.hidden = false;
- el.style.display = null;
+ if (fullyHide)
+ el.hidden = false;
+ if (fullyHide)
+ el.style.display = null;
let current = el.getBoundingClientRect().height;
el.style.height = "auto";
let full = el.getBoundingClientRect().height;
@@ -52,14 +64,14 @@
end: {height: floor + "px"}
}, () => el.style.overflow = "hidden", () => {
el._x_isShown = false;
- if (el.style.height == `${floor}px`) {
+ if (el.style.height == `${floor}px` && fullyHide) {
el.style.display = "none";
el.hidden = true;
}
});
}
};
- });
+ }
}
function modifierValue(modifiers, key, fallback) {
if (modifiers.indexOf(key) === -1)
@@ -72,6 +84,11 @@
if (match)
return match[1];
}
+ if (key === "min") {
+ let match = rawValue.match(/([0-9]+)px/);
+ if (match)
+ return match[1];
+ }
return rawValue;
}
diff --git a/alpinejs/packages/collapse/dist/cdn.min.js b/alpinejs/packages/collapse/dist/cdn.min.js
index 5919142..e368cea 100644
--- a/alpinejs/packages/collapse/dist/cdn.min.js
+++ b/alpinejs/packages/collapse/dist/cdn.min.js
@@ -1 +1 @@
-(()=>{function f(i){i.directive("collapse",(t,{expression:s,modifiers:n},{effect:h,evaluateLater:x})=>{let g=c(n,"duration",250)/1e3,r=0;t._x_isShown||(t.style.height=`${r}px`),t._x_isShown||(t.hidden=!0),t._x_isShown||(t.style.overflow="hidden");let l=(u,o)=>{let e=i.setStyles(u,o);return o.height?()=>{}:e},d={transitionProperty:"height",transitionDuration:`${g}s`,transitionTimingFunction:"cubic-bezier(0.4, 0.0, 0.2, 1)"};t._x_transition={in(u=()=>{},o=()=>{}){t.hidden=!1,t.style.display=null;let e=t.getBoundingClientRect().height;t.style.height="auto";let a=t.getBoundingClientRect().height;e===a&&(e=r),i.transition(t,i.setStyles,{during:d,start:{height:e+"px"},end:{height:a+"px"}},()=>t._x_isShown=!0,()=>{t.style.height==`${a}px`&&(t.style.overflow=null)})},out(u=()=>{},o=()=>{}){let e=t.getBoundingClientRect().height;i.transition(t,l,{during:d,start:{height:e+"px"},end:{height:r+"px"}},()=>t.style.overflow="hidden",()=>{t._x_isShown=!1,t.style.height==`${r}px`&&(t.style.display="none",t.hidden=!0)})}}})}function c(i,t,s){if(i.indexOf(t)===-1)return s;let n=i[i.indexOf(t)+1];if(!n)return s;if(t==="duration"){let h=n.match(/([0-9]+)ms/);if(h)return h[1]}return n}document.addEventListener("alpine:init",()=>{window.Alpine.plugin(f)});})();
+(()=>{function c(n){n.directive("collapse",e),e.inline=(t,{modifiers:i})=>{!i.includes("min")||(t._x_doShow=()=>{},t._x_doHide=()=>{})};function e(t,{modifiers:i}){let r=l(i,"duration",250)/1e3,h=l(i,"min",0),u=!i.includes("min");t._x_isShown||(t.style.height=`${h}px`),!t._x_isShown&&u&&(t.hidden=!0),t._x_isShown||(t.style.overflow="hidden");let g=(d,s)=>{let o=n.setStyles(d,s);return s.height?()=>{}:o},f={transitionProperty:"height",transitionDuration:`${r}s`,transitionTimingFunction:"cubic-bezier(0.4, 0.0, 0.2, 1)"};t._x_transition={in(d=()=>{},s=()=>{}){u&&(t.hidden=!1),u&&(t.style.display=null);let o=t.getBoundingClientRect().height;t.style.height="auto";let a=t.getBoundingClientRect().height;o===a&&(o=h),n.transition(t,n.setStyles,{during:f,start:{height:o+"px"},end:{height:a+"px"}},()=>t._x_isShown=!0,()=>{t.style.height==`${a}px`&&(t.style.overflow=null)})},out(d=()=>{},s=()=>{}){let o=t.getBoundingClientRect().height;n.transition(t,g,{during:f,start:{height:o+"px"},end:{height:h+"px"}},()=>t.style.overflow="hidden",()=>{t._x_isShown=!1,t.style.height==`${h}px`&&u&&(t.style.display="none",t.hidden=!0)})}}}}function l(n,e,t){if(n.indexOf(e)===-1)return t;let i=n[n.indexOf(e)+1];if(!i)return t;if(e==="duration"){let r=i.match(/([0-9]+)ms/);if(r)return r[1]}if(e==="min"){let r=i.match(/([0-9]+)px/);if(r)return r[1]}return i}document.addEventListener("alpine:init",()=>{window.Alpine.plugin(c)});})();
diff --git a/alpinejs/packages/collapse/dist/module.cjs.js b/alpinejs/packages/collapse/dist/module.cjs.js
index 63e04a0..6e593d1 100644
--- a/alpinejs/packages/collapse/dist/module.cjs.js
+++ b/alpinejs/packages/collapse/dist/module.cjs.js
@@ -13,12 +13,22 @@ __export(exports, {
// packages/collapse/src/index.js
function src_default(Alpine) {
- Alpine.directive("collapse", (el, {expression, modifiers}, {effect, evaluateLater}) => {
+ Alpine.directive("collapse", collapse);
+ collapse.inline = (el, {modifiers}) => {
+ if (!modifiers.includes("min"))
+ return;
+ el._x_doShow = () => {
+ };
+ el._x_doHide = () => {
+ };
+ };
+ function collapse(el, {modifiers}) {
let duration = modifierValue(modifiers, "duration", 250) / 1e3;
- let floor = 0;
+ let floor = modifierValue(modifiers, "min", 0);
+ let fullyHide = !modifiers.includes("min");
if (!el._x_isShown)
el.style.height = `${floor}px`;
- if (!el._x_isShown)
+ if (!el._x_isShown && fullyHide)
el.hidden = true;
if (!el._x_isShown)
el.style.overflow = "hidden";
@@ -36,8 +46,10 @@ function src_default(Alpine) {
in(before = () => {
}, after = () => {
}) {
- el.hidden = false;
- el.style.display = null;
+ if (fullyHide)
+ el.hidden = false;
+ if (fullyHide)
+ el.style.display = null;
let current = el.getBoundingClientRect().height;
el.style.height = "auto";
let full = el.getBoundingClientRect().height;
@@ -64,14 +76,14 @@ function src_default(Alpine) {
end: {height: floor + "px"}
}, () => el.style.overflow = "hidden", () => {
el._x_isShown = false;
- if (el.style.height == `${floor}px`) {
+ if (el.style.height == `${floor}px` && fullyHide) {
el.style.display = "none";
el.hidden = true;
}
});
}
};
- });
+ }
}
function modifierValue(modifiers, key, fallback) {
if (modifiers.indexOf(key) === -1)
@@ -84,6 +96,11 @@ function modifierValue(modifiers, key, fallback) {
if (match)
return match[1];
}
+ if (key === "min") {
+ let match = rawValue.match(/([0-9]+)px/);
+ if (match)
+ return match[1];
+ }
return rawValue;
}
diff --git a/alpinejs/packages/collapse/dist/module.esm.js b/alpinejs/packages/collapse/dist/module.esm.js
index 82fc363..c0e331c 100644
--- a/alpinejs/packages/collapse/dist/module.esm.js
+++ b/alpinejs/packages/collapse/dist/module.esm.js
@@ -1,11 +1,21 @@
// packages/collapse/src/index.js
function src_default(Alpine) {
- Alpine.directive("collapse", (el, {expression, modifiers}, {effect, evaluateLater}) => {
+ Alpine.directive("collapse", collapse);
+ collapse.inline = (el, {modifiers}) => {
+ if (!modifiers.includes("min"))
+ return;
+ el._x_doShow = () => {
+ };
+ el._x_doHide = () => {
+ };
+ };
+ function collapse(el, {modifiers}) {
let duration = modifierValue(modifiers, "duration", 250) / 1e3;
- let floor = 0;
+ let floor = modifierValue(modifiers, "min", 0);
+ let fullyHide = !modifiers.includes("min");
if (!el._x_isShown)
el.style.height = `${floor}px`;
- if (!el._x_isShown)
+ if (!el._x_isShown && fullyHide)
el.hidden = true;
if (!el._x_isShown)
el.style.overflow = "hidden";
@@ -23,8 +33,10 @@ function src_default(Alpine) {
in(before = () => {
}, after = () => {
}) {
- el.hidden = false;
- el.style.display = null;
+ if (fullyHide)
+ el.hidden = false;
+ if (fullyHide)
+ el.style.display = null;
let current = el.getBoundingClientRect().height;
el.style.height = "auto";
let full = el.getBoundingClientRect().height;
@@ -51,14 +63,14 @@ function src_default(Alpine) {
end: {height: floor + "px"}
}, () => el.style.overflow = "hidden", () => {
el._x_isShown = false;
- if (el.style.height == `${floor}px`) {
+ if (el.style.height == `${floor}px` && fullyHide) {
el.style.display = "none";
el.hidden = true;
}
});
}
};
- });
+ }
}
function modifierValue(modifiers, key, fallback) {
if (modifiers.indexOf(key) === -1)
@@ -71,6 +83,11 @@ function modifierValue(modifiers, key, fallback) {
if (match)
return match[1];
}
+ if (key === "min") {
+ let match = rawValue.match(/([0-9]+)px/);
+ if (match)
+ return match[1];
+ }
return rawValue;
}
diff --git a/alpinejs/packages/collapse/package.json b/alpinejs/packages/collapse/package.json
index a14f149..e78804f 100644
--- a/alpinejs/packages/collapse/package.json
+++ b/alpinejs/packages/collapse/package.json
@@ -1,6 +1,6 @@
{
"name": "@alpinejs/collapse",
- "version": "3.9.1",
+ "version": "3.10.2",
"description": "Collapse and expand elements with robust animations",
"author": "Caleb Porzio",
"license": "MIT",
diff --git a/alpinejs/packages/collapse/src/index.js b/alpinejs/packages/collapse/src/index.js
index aa2ea94..42d0af4 100644
--- a/alpinejs/packages/collapse/src/index.js
+++ b/alpinejs/packages/collapse/src/index.js
@@ -1,7 +1,19 @@
export default function (Alpine) {
- Alpine.directive('collapse', (el, { expression, modifiers }, { effect, evaluateLater }) => {
+ Alpine.directive('collapse', collapse)
+
+ // If we're using a "minimum height", we'll need to disable
+ // x-show's default behavior of setting display: 'none'.
+ collapse.inline = (el, { modifiers }) => {
+ if (! modifiers.includes('min')) return
+
+ el._x_doShow = () => {}
+ el._x_doHide = () => {}
+ }
+
+ function collapse(el, { modifiers }) {
let duration = modifierValue(modifiers, 'duration', 250) / 1000
- let floor = 0
+ let floor = modifierValue(modifiers, 'min', 0)
+ let fullyHide = ! modifiers.includes('min')
if (! el._x_isShown) el.style.height = `${floor}px`
// We use the hidden attribute for the benefit of Tailwind
@@ -9,7 +21,7 @@ export default function (Alpine) {
// We also use display:none as the hidden attribute has very
// low CSS specificity and could be accidentally overriden
// by a user.
- if (! el._x_isShown) el.hidden = true
+ if (! el._x_isShown && fullyHide) el.hidden = true
if (! el._x_isShown) el.style.overflow = 'hidden'
// Override the setStyles function with one that won't
@@ -28,8 +40,8 @@ export default function (Alpine) {
el._x_transition = {
in(before = () => {}, after = () => {}) {
- el.hidden = false;
- el.style.display = null
+ if (fullyHide) el.hidden = false;
+ if (fullyHide) el.style.display = null
let current = el.getBoundingClientRect().height
@@ -61,14 +73,14 @@ export default function (Alpine) {
el._x_isShown = false
// check if element is fully collapsed
- if (el.style.height == `${floor}px`) {
+ if (el.style.height == `${floor}px` && fullyHide) {
el.style.display = 'none'
el.hidden = true
}
})
},
}
- })
+ }
}
function modifierValue(modifiers, key, fallback) {
@@ -86,5 +98,11 @@ function modifierValue(modifiers, key, fallback) {
if (match) return match[1]
}
+ if (key === 'min') {
+ // Support x-collapse.min.100px && min.100
+ let match = rawValue.match(/([0-9]+)px/)
+ if (match) return match[1]
+ }
+
return rawValue
}
diff --git a/alpinejs/packages/csp/dist/cdn.js b/alpinejs/packages/csp/dist/cdn.js
index 1b07e7b..8599847 100644
--- a/alpinejs/packages/csp/dist/cdn.js
+++ b/alpinejs/packages/csp/dist/cdn.js
@@ -76,6 +76,7 @@
el._x_effects.delete(effectReference);
release(effectReference);
};
+ return effectReference;
};
return [wrappedEffect, () => {
cleanup2();
@@ -427,6 +428,13 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
}
// packages/alpinejs/src/evaluator.js
+ var shouldAutoEvaluateFunctions = true;
+ function dontAutoEvaluateFunctions(callback) {
+ let cache = shouldAutoEvaluateFunctions;
+ shouldAutoEvaluateFunctions = false;
+ callback();
+ shouldAutoEvaluateFunctions = cache;
+ }
function evaluate(el, expression, extras = {}) {
let result;
evaluateLater(el, expression)((value) => result = value, extras);
@@ -498,7 +506,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
};
}
function runIfTypeOfFunction(receiver, value, scope2, params, el) {
- if (typeof value === "function") {
+ if (shouldAutoEvaluateFunctions && typeof value === "function") {
let result = value.apply(scope2, params);
if (result instanceof Promise) {
result.then((i) => runIfTypeOfFunction(receiver, i, scope2, params)).catch((error2) => handleError(error2, el, value));
@@ -632,6 +640,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
"bind",
"init",
"for",
+ "mask",
"model",
"modelable",
"transition",
@@ -660,13 +669,19 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
// packages/alpinejs/src/nextTick.js
var tickStack = [];
var isHolding = false;
- function nextTick(callback) {
- tickStack.push(callback);
+ function nextTick(callback = () => {
+ }) {
queueMicrotask(() => {
isHolding || setTimeout(() => {
releaseNextTicks();
});
});
+ return new Promise((res) => {
+ tickStack.push(() => {
+ callback();
+ res();
+ });
+ });
}
function releaseNextTicks() {
isHolding = false;
@@ -1414,8 +1429,9 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
get raw() {
return raw;
},
- version: "3.9.1",
+ version: "3.10.2",
flushAndStopDeferringMutations,
+ dontAutoEvaluateFunctions,
disableEffectScheduling,
stopObservingMutations,
destroyTree,
@@ -2146,7 +2162,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
let evaluate2 = evaluateLater2(key);
let firstTime = true;
let oldValue;
- effect3(() => evaluate2((value) => {
+ let effectReference = effect3(() => evaluate2((value) => {
JSON.stringify(value);
if (!firstTime) {
queueMicrotask(() => {
@@ -2158,6 +2174,7 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
}
firstTime = false;
}));
+ el._x_effects.delete(effectReference);
});
// packages/alpinejs/src/magics/$store.js
@@ -2217,8 +2234,15 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
// packages/alpinejs/src/magics/$el.js
magic("el", (el) => el);
+ // packages/alpinejs/src/magics/index.js
+ warnMissingPluginMagic("Focus", "focus", "focus");
+ warnMissingPluginMagic("Persist", "persist", "persist");
+ function warnMissingPluginMagic(name, magicName, slug) {
+ magic(magicName, (el) => warn(`You can't use [$${directiveName}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el));
+ }
+
// packages/alpinejs/src/directives/x-modelable.js
- directive("modelable", (el, {expression}, {effect: effect3, evaluate: evaluate2, evaluateLater: evaluateLater2}) => {
+ directive("modelable", (el, {expression}, {effect: effect3, evaluateLater: evaluateLater2}) => {
let func = evaluateLater2(expression);
let innerGet = () => {
let result;
@@ -2229,12 +2253,11 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
let innerSet = (val) => evaluateInnerSet(() => {
}, {scope: {__placeholder: val}});
let initialValue = innerGet();
- if (el._x_modelable_hook)
- initialValue = el._x_modelable_hook(initialValue);
innerSet(initialValue);
queueMicrotask(() => {
if (!el._x_model)
return;
+ el._x_removeModelListeners["default"]();
let outerGet = el._x_model.get;
let outerSet = el._x_model.set;
effect3(() => innerSet(outerGet()));
@@ -2320,6 +2343,8 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
handler3 = wrapHandler(handler3, (next, e) => {
if (el.contains(e.target))
return;
+ if (e.target.isConnected === false)
+ return;
if (el.offsetWidth < 1 && el.offsetHeight < 1)
return;
if (el._x_isShown === false)
@@ -2327,6 +2352,12 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
next(e);
});
}
+ if (modifiers.includes("once")) {
+ handler3 = wrapHandler(handler3, (next, e) => {
+ next(e);
+ listenerTarget.removeEventListener(event, handler3, options);
+ });
+ }
handler3 = wrapHandler(handler3, (next, e) => {
if (isKeyEvent(event)) {
if (isListeningForASpecificKeyThatHasntBeenPressed(e, modifiers)) {
@@ -2345,12 +2376,6 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
let wait = isNumeric(nextModifier.split("ms")[0]) ? Number(nextModifier.split("ms")[0]) : 250;
handler3 = throttle(handler3, wait);
}
- if (modifiers.includes("once")) {
- handler3 = wrapHandler(handler3, (next, e) => {
- next(e);
- listenerTarget.removeEventListener(event, handler3, options);
- });
- }
listenerTarget.addEventListener(event, handler3, options);
return () => {
listenerTarget.removeEventListener(event, handler3, options);
@@ -2438,7 +2463,10 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
rightSideOfExpression: assigmentFunction
}});
});
- cleanup2(() => removeListener());
+ if (!el._x_removeModelListeners)
+ el._x_removeModelListeners = {};
+ el._x_removeModelListeners["default"] = removeListener;
+ cleanup2(() => el._x_removeModelListeners["default"]());
let evaluateSetModel = evaluateLater(el, `${expression} = __placeholder`);
el._x_model = {
get() {
@@ -2538,7 +2566,12 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
let evaluate2 = evaluateLater2(expression);
effect3(() => {
evaluate2((value) => {
- el.innerHTML = value;
+ mutateDom(() => {
+ el.innerHTML = value;
+ el._x_ignoreSelf = true;
+ initTree(el);
+ delete el._x_ignoreSelf;
+ });
});
});
});
@@ -2608,24 +2641,35 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
cleanup1();
cleanup22();
reactiveData["destroy"] && evaluate(el, reactiveData["destroy"]);
+ undo();
});
}));
// packages/alpinejs/src/directives/x-show.js
directive("show", (el, {modifiers, expression}, {effect: effect3}) => {
let evaluate2 = evaluateLater(el, expression);
- let hide = () => mutateDom(() => {
- el.style.display = "none";
+ if (!el._x_doHide)
+ el._x_doHide = () => {
+ mutateDom(() => el.style.display = "none");
+ };
+ if (!el._x_doShow)
+ el._x_doShow = () => {
+ mutateDom(() => {
+ if (el.style.length === 1 && el.style.display === "none") {
+ el.removeAttribute("style");
+ } else {
+ el.style.removeProperty("display");
+ }
+ });
+ };
+ let hide = () => {
+ el._x_doHide();
el._x_isShown = false;
- });
- let show = () => mutateDom(() => {
- if (el.style.length === 1 && el.style.display === "none") {
- el.removeAttribute("style");
- } else {
- el.style.removeProperty("display");
- }
+ };
+ let show = () => {
+ el._x_doShow();
el._x_isShown = true;
- });
+ };
let clickAwayCompatibleShow = () => setTimeout(show);
let toggle = once((value) => value ? show() : hide(), (value) => {
if (typeof el._x_toggleAndCascadeWithTransitions === "function") {
@@ -2882,6 +2926,15 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
cleanup2(() => removeListener());
}));
+ // packages/alpinejs/src/directives/index.js
+ warnMissingPluginDirective("Collapse", "collapse", "collapse");
+ warnMissingPluginDirective("Intersect", "intersect", "intersect");
+ warnMissingPluginDirective("Focus", "trap", "focus");
+ warnMissingPluginDirective("Mask", "mask", "mask");
+ function warnMissingPluginDirective(name, directiveName2, slug) {
+ directive(directiveName2, (el) => warn(`You can't use [x-${directiveName2}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el));
+ }
+
// packages/csp/src/index.js
alpine_default.setEvaluator(cspCompliantEvaluator);
alpine_default.setReactivityEngine({reactive: reactive2, effect: effect2, release: stop, raw: toRaw});
diff --git a/alpinejs/packages/csp/dist/cdn.min.js b/alpinejs/packages/csp/dist/cdn.min.js
index 07a0ea2..0aa6f4b 100644
--- a/alpinejs/packages/csp/dist/cdn.min.js
+++ b/alpinejs/packages/csp/dist/cdn.min.js
@@ -1,5 +1,5 @@
-(()=>{var We=!1,Ge=!1,F=[];function $t(e){nn(e)}function nn(e){F.includes(e)||F.push(e),on()}function _e(e){let t=F.indexOf(e);t!==-1&&F.splice(t,1)}function on(){!Ge&&!We&&(We=!0,queueMicrotask(sn))}function sn(){We=!1,Ge=!0;for(let e=0;e<F.length;e++)F[e]();F.length=0,Ge=!1}var A,K,J,Ye,Je=!0;function jt(e){Je=!1,e(),Je=!0}function Lt(e){A=e.reactive,J=e.release,K=t=>e.effect(t,{scheduler:r=>{Je?$t(r):r()}}),Ye=e.raw}function Ze(e){K=e}function Ft(e){let t=()=>{};return[n=>{let i=K(n);e._x_effects||(e._x_effects=new Set,e._x_runEffects=()=>{e._x_effects.forEach(o=>o())}),e._x_effects.add(i),t=()=>{i!==void 0&&(e._x_effects.delete(i),J(i))}},()=>{t()}]}var Kt=[],Bt=[],zt=[];function Vt(e){zt.push(e)}function ge(e,t){typeof t=="function"?(e._x_cleanups||(e._x_cleanups=[]),e._x_cleanups.push(t)):(t=e,Bt.push(t))}function Ht(e){Kt.push(e)}function xe(e,t,r){e._x_attributeCleanups||(e._x_attributeCleanups={}),e._x_attributeCleanups[t]||(e._x_attributeCleanups[t]=[]),e._x_attributeCleanups[t].push(r)}function Qe(e,t){!e._x_attributeCleanups||Object.entries(e._x_attributeCleanups).forEach(([r,n])=>{(t===void 0||t.includes(r))&&(n.forEach(i=>i()),delete e._x_attributeCleanups[r])})}var et=new MutationObserver(Xe),tt=!1;function rt(){et.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0}),tt=!0}function nt(){an(),et.disconnect(),tt=!1}var ne=[],it=!1;function an(){ne=ne.concat(et.takeRecords()),ne.length&&!it&&(it=!0,queueMicrotask(()=>{cn(),it=!1}))}function cn(){Xe(ne),ne.length=0}function m(e){if(!tt)return e();nt();let t=e();return rt(),t}var ot=!1,ye=[];function qt(){ot=!0}function Ut(){ot=!1,Xe(ye),ye=[]}function Xe(e){if(ot){ye=ye.concat(e);return}let t=[],r=[],n=new Map,i=new Map;for(let o=0;o<e.length;o++)if(!e[o].target._x_ignoreMutationObserver&&(e[o].type==="childList"&&(e[o].addedNodes.forEach(s=>s.nodeType===1&&t.push(s)),e[o].removedNodes.forEach(s=>s.nodeType===1&&r.push(s))),e[o].type==="attributes")){let s=e[o].target,a=e[o].attributeName,c=e[o].oldValue,l=()=>{n.has(s)||n.set(s,[]),n.get(s).push({name:a,value:s.getAttribute(a)})},u=()=>{i.has(s)||i.set(s,[]),i.get(s).push(a)};s.hasAttribute(a)&&c===null?l():s.hasAttribute(a)?(u(),l()):u()}i.forEach((o,s)=>{Qe(s,o)}),n.forEach((o,s)=>{Kt.forEach(a=>a(s,o))});for(let o of r)if(!t.includes(o)&&(Bt.forEach(s=>s(o)),o._x_cleanups))for(;o._x_cleanups.length;)o._x_cleanups.pop()();t.forEach(o=>{o._x_ignoreSelf=!0,o._x_ignore=!0});for(let o of t)r.includes(o)||!o.isConnected||(delete o._x_ignoreSelf,delete o._x_ignore,zt.forEach(s=>s(o)),o._x_ignore=!0,o._x_ignoreSelf=!0);t.forEach(o=>{delete o._x_ignoreSelf,delete o._x_ignore}),t=null,r=null,n=null,i=null}function be(e){return C(T(e))}function R(e,t,r){return e._x_dataStack=[t,...T(r||e)],()=>{e._x_dataStack=e._x_dataStack.filter(n=>n!==t)}}function st(e,t){let r=e._x_dataStack[0];Object.entries(t).forEach(([n,i])=>{r[n]=i})}function T(e){return e._x_dataStack?e._x_dataStack:typeof ShadowRoot=="function"&&e instanceof ShadowRoot?T(e.host):e.parentNode?T(e.parentNode):[]}function C(e){let t=new Proxy({},{ownKeys:()=>Array.from(new Set(e.flatMap(r=>Object.keys(r)))),has:(r,n)=>e.some(i=>i.hasOwnProperty(n)),get:(r,n)=>(e.find(i=>{if(i.hasOwnProperty(n)){let o=Object.getOwnPropertyDescriptor(i,n);if(o.get&&o.get._x_alreadyBound||o.set&&o.set._x_alreadyBound)return!0;if((o.get||o.set)&&o.enumerable){let s=o.get,a=o.set,c=o;s=s&&s.bind(t),a=a&&a.bind(t),s&&(s._x_alreadyBound=!0),a&&(a._x_alreadyBound=!0),Object.defineProperty(i,n,{...c,get:s,set:a})}return!0}return!1})||{})[n],set:(r,n,i)=>{let o=e.find(s=>s.hasOwnProperty(n));return o?o[n]=i:e[e.length-1][n]=i,!0}});return t}function ve(e){let t=n=>typeof n=="object"&&!Array.isArray(n)&&n!==null,r=(n,i="")=>{Object.entries(Object.getOwnPropertyDescriptors(n)).forEach(([o,{value:s,enumerable:a}])=>{if(a===!1||s===void 0)return;let c=i===""?o:`${i}.${o}`;typeof s=="object"&&s!==null&&s._x_interceptor?n[o]=s.initialize(e,c,o):t(s)&&s!==n&&!(s instanceof Element)&&r(s,c)})};return r(e)}function we(e,t=()=>{}){let r={initialValue:void 0,_x_interceptor:!0,initialize(n,i,o){return e(this.initialValue,()=>ln(n,i),s=>at(n,i,s),i,o)}};return t(r),n=>{if(typeof n=="object"&&n!==null&&n._x_interceptor){let i=r.initialize.bind(r);r.initialize=(o,s,a)=>{let c=n.initialize(o,s,a);return r.initialValue=c,i(o,s,a)}}else r.initialValue=n;return r}}function ln(e,t){return t.split(".").reduce((r,n)=>r[n],e)}function at(e,t,r){if(typeof t=="string"&&(t=t.split(".")),t.length===1)e[t[0]]=r;else{if(t.length===0)throw error;return e[t[0]]||(e[t[0]]={}),at(e[t[0]],t.slice(1),r)}}var Wt={};function y(e,t){Wt[e]=t}function B(e,t){return Object.entries(Wt).forEach(([r,n])=>{Object.defineProperty(e,`$${r}`,{get(){let[i,o]=ct(t);return i={interceptor:we,...i},ge(t,o),n(t,i)},enumerable:!1})}),{obj:e,cleanup:()=>{t=null}}}function Ee(e,t,r,...n){try{return r(...n)}catch(i){Z(i,e,t)}}function Z(e,t,r=void 0){Object.assign(e,{el:t,expression:r}),console.warn(`Alpine Expression Error: ${e.message}
+(()=>{var Ye=!1,Je=!1,K=[];function jt(e){cn(e)}function cn(e){K.includes(e)||K.push(e),ln()}function _e(e){let t=K.indexOf(e);t!==-1&&K.splice(t,1)}function ln(){!Je&&!Ye&&(Ye=!0,queueMicrotask(un))}function un(){Ye=!1,Je=!0;for(let e=0;e<K.length;e++)K[e]();K.length=0,Je=!1}var A,B,J,Ze,Qe=!0;function Ft(e){Qe=!1,e(),Qe=!0}function Kt(e){A=e.reactive,J=e.release,B=t=>e.effect(t,{scheduler:r=>{Qe?jt(r):r()}}),Ze=e.raw}function Xe(e){B=e}function Bt(e){let t=()=>{};return[n=>{let i=B(n);return e._x_effects||(e._x_effects=new Set,e._x_runEffects=()=>{e._x_effects.forEach(o=>o())}),e._x_effects.add(i),t=()=>{i!==void 0&&(e._x_effects.delete(i),J(i))},i},()=>{t()}]}var zt=[],Vt=[],Ht=[];function qt(e){Ht.push(e)}function ge(e,t){typeof t=="function"?(e._x_cleanups||(e._x_cleanups=[]),e._x_cleanups.push(t)):(t=e,Vt.push(t))}function Ut(e){zt.push(e)}function xe(e,t,r){e._x_attributeCleanups||(e._x_attributeCleanups={}),e._x_attributeCleanups[t]||(e._x_attributeCleanups[t]=[]),e._x_attributeCleanups[t].push(r)}function et(e,t){!e._x_attributeCleanups||Object.entries(e._x_attributeCleanups).forEach(([r,n])=>{(t===void 0||t.includes(r))&&(n.forEach(i=>i()),delete e._x_attributeCleanups[r])})}var rt=new MutationObserver(tt),nt=!1;function it(){rt.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0}),nt=!0}function ot(){fn(),rt.disconnect(),nt=!1}var ne=[],st=!1;function fn(){ne=ne.concat(rt.takeRecords()),ne.length&&!st&&(st=!0,queueMicrotask(()=>{dn(),st=!1}))}function dn(){tt(ne),ne.length=0}function m(e){if(!nt)return e();ot();let t=e();return it(),t}var at=!1,ye=[];function Wt(){at=!0}function Gt(){at=!1,tt(ye),ye=[]}function tt(e){if(at){ye=ye.concat(e);return}let t=[],r=[],n=new Map,i=new Map;for(let o=0;o<e.length;o++)if(!e[o].target._x_ignoreMutationObserver&&(e[o].type==="childList"&&(e[o].addedNodes.forEach(s=>s.nodeType===1&&t.push(s)),e[o].removedNodes.forEach(s=>s.nodeType===1&&r.push(s))),e[o].type==="attributes")){let s=e[o].target,a=e[o].attributeName,c=e[o].oldValue,l=()=>{n.has(s)||n.set(s,[]),n.get(s).push({name:a,value:s.getAttribute(a)})},u=()=>{i.has(s)||i.set(s,[]),i.get(s).push(a)};s.hasAttribute(a)&&c===null?l():s.hasAttribute(a)?(u(),l()):u()}i.forEach((o,s)=>{et(s,o)}),n.forEach((o,s)=>{zt.forEach(a=>a(s,o))});for(let o of r)if(!t.includes(o)&&(Vt.forEach(s=>s(o)),o._x_cleanups))for(;o._x_cleanups.length;)o._x_cleanups.pop()();t.forEach(o=>{o._x_ignoreSelf=!0,o._x_ignore=!0});for(let o of t)r.includes(o)||!o.isConnected||(delete o._x_ignoreSelf,delete o._x_ignore,Ht.forEach(s=>s(o)),o._x_ignore=!0,o._x_ignoreSelf=!0);t.forEach(o=>{delete o._x_ignoreSelf,delete o._x_ignore}),t=null,r=null,n=null,i=null}function be(e){return M(C(e))}function R(e,t,r){return e._x_dataStack=[t,...C(r||e)],()=>{e._x_dataStack=e._x_dataStack.filter(n=>n!==t)}}function ct(e,t){let r=e._x_dataStack[0];Object.entries(t).forEach(([n,i])=>{r[n]=i})}function C(e){return e._x_dataStack?e._x_dataStack:typeof ShadowRoot=="function"&&e instanceof ShadowRoot?C(e.host):e.parentNode?C(e.parentNode):[]}function M(e){let t=new Proxy({},{ownKeys:()=>Array.from(new Set(e.flatMap(r=>Object.keys(r)))),has:(r,n)=>e.some(i=>i.hasOwnProperty(n)),get:(r,n)=>(e.find(i=>{if(i.hasOwnProperty(n)){let o=Object.getOwnPropertyDescriptor(i,n);if(o.get&&o.get._x_alreadyBound||o.set&&o.set._x_alreadyBound)return!0;if((o.get||o.set)&&o.enumerable){let s=o.get,a=o.set,c=o;s=s&&s.bind(t),a=a&&a.bind(t),s&&(s._x_alreadyBound=!0),a&&(a._x_alreadyBound=!0),Object.defineProperty(i,n,{...c,get:s,set:a})}return!0}return!1})||{})[n],set:(r,n,i)=>{let o=e.find(s=>s.hasOwnProperty(n));return o?o[n]=i:e[e.length-1][n]=i,!0}});return t}function ve(e){let t=n=>typeof n=="object"&&!Array.isArray(n)&&n!==null,r=(n,i="")=>{Object.entries(Object.getOwnPropertyDescriptors(n)).forEach(([o,{value:s,enumerable:a}])=>{if(a===!1||s===void 0)return;let c=i===""?o:`${i}.${o}`;typeof s=="object"&&s!==null&&s._x_interceptor?n[o]=s.initialize(e,c,o):t(s)&&s!==n&&!(s instanceof Element)&&r(s,c)})};return r(e)}function we(e,t=()=>{}){let r={initialValue:void 0,_x_interceptor:!0,initialize(n,i,o){return e(this.initialValue,()=>pn(n,i),s=>lt(n,i,s),i,o)}};return t(r),n=>{if(typeof n=="object"&&n!==null&&n._x_interceptor){let i=r.initialize.bind(r);r.initialize=(o,s,a)=>{let c=n.initialize(o,s,a);return r.initialValue=c,i(o,s,a)}}else r.initialValue=n;return r}}function pn(e,t){return t.split(".").reduce((r,n)=>r[n],e)}function lt(e,t,r){if(typeof t=="string"&&(t=t.split(".")),t.length===1)e[t[0]]=r;else{if(t.length===0)throw error;return e[t[0]]||(e[t[0]]={}),lt(e[t[0]],t.slice(1),r)}}var Yt={};function x(e,t){Yt[e]=t}function z(e,t){return Object.entries(Yt).forEach(([r,n])=>{Object.defineProperty(e,`$${r}`,{get(){let[i,o]=ut(t);return i={interceptor:we,...i},ge(t,o),n(t,i)},enumerable:!1})}),{obj:e,cleanup:()=>{t=null}}}function Ee(e,t,r,...n){try{return r(...n)}catch(i){Z(i,e,t)}}function Z(e,t,r=void 0){Object.assign(e,{el:t,expression:r}),console.warn(`Alpine Expression Error: ${e.message}
${r?'Expression: "'+r+`"
-`:""}`,t),setTimeout(()=>{throw e},0)}function I(e,t,r={}){let n;return g(e,t)(i=>n=i,r),n}function g(...e){return Gt(...e)}var Gt=un;function Yt(e){Gt=e}function un(e,t){let r={},n=B(r,e).cleanup;xe(e,"evaluator",n);let i=[r,...T(e)];if(typeof t=="function")return lt(i,t);let o=fn(i,t,e);return Ee.bind(null,e,t,o)}function lt(e,t){return(r=()=>{},{scope:n={},params:i=[]}={})=>{let o=t.apply(C([n,...e]),i);Q(r,o)}}var ut={};function dn(e,t){if(ut[e])return ut[e];let r=Object.getPrototypeOf(async function(){}).constructor,n=/^[\n\s]*if.*\(.*\)/.test(e)||/^(let|const)\s/.test(e)?`(() => { ${e} })()`:e,o=(()=>{try{return new r(["__self","scope"],`with (scope) { __self.result = ${n} }; __self.finished = true; return __self.result;`)}catch(s){return Z(s,t,e),Promise.resolve()}})();return ut[e]=o,o}function fn(e,t,r){let n=dn(t,r);return(i=()=>{},{scope:o={},params:s=[]}={})=>{n.result=void 0,n.finished=!1;let a=C([o,...e]);if(typeof n=="function"){let c=n(n,a).catch(l=>Z(l,r,t));n.finished?(Q(i,n.result,a,s,r),n.result=void 0):c.then(l=>{Q(i,l,a,s,r)}).catch(l=>Z(l,r,t)).finally(()=>n.result=void 0)}}}function Q(e,t,r,n,i){if(typeof t=="function"){let o=t.apply(r,n);o instanceof Promise?o.then(s=>Q(e,s,r,n)).catch(s=>Z(s,i,t)):e(o)}else e(t)}var ft="x-";function w(e=""){return ft+e}function Jt(e){ft=e}var Zt={};function p(e,t){Zt[e]=t}function ie(e,t,r){let n={};return Array.from(t).map(Qt((o,s)=>n[o]=s)).filter(Xt).map(mn(n,r)).sort(hn).map(o=>pn(e,o))}function er(e){return Array.from(e).map(Qt()).filter(t=>!Xt(t))}var dt=!1,oe=new Map,tr=Symbol();function rr(e){dt=!0;let t=Symbol();tr=t,oe.set(t,[]);let r=()=>{for(;oe.get(t).length;)oe.get(t).shift()();oe.delete(t)},n=()=>{dt=!1,r()};e(r),n()}function ct(e){let t=[],r=a=>t.push(a),[n,i]=Ft(e);return t.push(i),[{Alpine:P,effect:n,cleanup:r,evaluateLater:g.bind(g,e),evaluate:I.bind(I,e)},()=>t.forEach(a=>a())]}function pn(e,t){let r=()=>{},n=Zt[t.type]||r,[i,o]=ct(e);xe(e,t.original,o);let s=()=>{e._x_ignore||e._x_ignoreSelf||(n.inline&&n.inline(e,t,i),n=n.bind(n,e,t,i),dt?oe.get(tr).push(n):n())};return s.runCleanups=o,s}var Se=(e,t)=>({name:r,value:n})=>(r.startsWith(e)&&(r=r.replace(e,t)),{name:r,value:n}),Ae=e=>e;function Qt(e=()=>{}){return({name:t,value:r})=>{let{name:n,value:i}=nr.reduce((o,s)=>s(o),{name:t,value:r});return n!==t&&e(n,t),{name:n,value:i}}}var nr=[];function X(e){nr.push(e)}function Xt({name:e}){return ir().test(e)}var ir=()=>new RegExp(`^${ft}([^:^.]+)\\b`);function mn(e,t){return({name:r,value:n})=>{let i=r.match(ir()),o=r.match(/:([a-zA-Z0-9\-:]+)/),s=r.match(/\.[^.\]]+(?=[^\]]*$)/g)||[],a=t||e[r]||r;return{type:i?i[1]:null,value:o?o[1]:null,modifiers:s.map(c=>c.replace(".","")),expression:n,original:a}}}var pt="DEFAULT",Oe=["ignore","ref","data","id","bind","init","for","model","modelable","transition","show","if",pt,"teleport","element"];function hn(e,t){let r=Oe.indexOf(e.type)===-1?pt:e.type,n=Oe.indexOf(t.type)===-1?pt:t.type;return Oe.indexOf(r)-Oe.indexOf(n)}function z(e,t,r={}){e.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0,cancelable:!0}))}var mt=[],ht=!1;function Ce(e){mt.push(e),queueMicrotask(()=>{ht||setTimeout(()=>{Te()})})}function Te(){for(ht=!1;mt.length;)mt.shift()()}function or(){ht=!0}function M(e,t){if(typeof ShadowRoot=="function"&&e instanceof ShadowRoot){Array.from(e.children).forEach(i=>M(i,t));return}let r=!1;if(t(e,()=>r=!0),r)return;let n=e.firstElementChild;for(;n;)M(n,t,!1),n=n.nextElementSibling}function V(e,...t){console.warn(`Alpine Warning: ${e}`,...t)}function ar(){document.body||V("Unable to initialize. Trying to load Alpine before `<body>` is available. Did you forget to add `defer` in Alpine's `<script>` tag?"),z(document,"alpine:init"),z(document,"alpine:initializing"),rt(),Vt(t=>E(t,M)),ge(t=>_t(t)),Ht((t,r)=>{ie(t,r).forEach(n=>n())});let e=t=>!H(t.parentElement,!0);Array.from(document.querySelectorAll(sr())).filter(e).forEach(t=>{E(t)}),z(document,"alpine:initialized")}var gt=[],cr=[];function lr(){return gt.map(e=>e())}function sr(){return gt.concat(cr).map(e=>e())}function Re(e){gt.push(e)}function Me(e){cr.push(e)}function H(e,t=!1){return ee(e,r=>{if((t?sr():lr()).some(i=>r.matches(i)))return!0})}function ee(e,t){if(!!e){if(t(e))return e;if(e._x_teleportBack&&(e=e._x_teleportBack),!!e.parentElement)return ee(e.parentElement,t)}}function ur(e){return lr().some(t=>e.matches(t))}function E(e,t=M){rr(()=>{t(e,(r,n)=>{ie(r,r.attributes).forEach(i=>i()),r._x_ignore&&n()})})}function _t(e){M(e,t=>Qe(t))}function se(e,t){return Array.isArray(t)?fr(e,t.join(" ")):typeof t=="object"&&t!==null?_n(e,t):typeof t=="function"?se(e,t()):fr(e,t)}function fr(e,t){let r=o=>o.split(" ").filter(Boolean),n=o=>o.split(" ").filter(s=>!e.classList.contains(s)).filter(Boolean),i=o=>(e.classList.add(...o),()=>{e.classList.remove(...o)});return t=t===!0?t="":t||"",i(n(t))}function _n(e,t){let r=a=>a.split(" ").filter(Boolean),n=Object.entries(t).flatMap(([a,c])=>c?r(a):!1).filter(Boolean),i=Object.entries(t).flatMap(([a,c])=>c?!1:r(a)).filter(Boolean),o=[],s=[];return i.forEach(a=>{e.classList.contains(a)&&(e.classList.remove(a),s.push(a))}),n.forEach(a=>{e.classList.contains(a)||(e.classList.add(a),o.push(a))}),()=>{s.forEach(a=>e.classList.add(a)),o.forEach(a=>e.classList.remove(a))}}function q(e,t){return typeof t=="object"&&t!==null?gn(e,t):xn(e,t)}function gn(e,t){let r={};return Object.entries(t).forEach(([n,i])=>{r[n]=e.style[n],n.startsWith("--")||(n=yn(n)),e.style.setProperty(n,i)}),setTimeout(()=>{e.style.length===0&&e.removeAttribute("style")}),()=>{q(e,r)}}function xn(e,t){let r=e.getAttribute("style",t);return e.setAttribute("style",t),()=>{e.setAttribute("style",r||"")}}function yn(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function ae(e,t=()=>{}){let r=!1;return function(){r?t.apply(this,arguments):(r=!0,e.apply(this,arguments))}}p("transition",(e,{value:t,modifiers:r,expression:n},{evaluate:i})=>{typeof n=="function"&&(n=i(n)),n?bn(e,n,t):vn(e,r,t)});function bn(e,t,r){dr(e,se,""),{enter:i=>{e._x_transition.enter.during=i},"enter-start":i=>{e._x_transition.enter.start=i},"enter-end":i=>{e._x_transition.enter.end=i},leave:i=>{e._x_transition.leave.during=i},"leave-start":i=>{e._x_transition.leave.start=i},"leave-end":i=>{e._x_transition.leave.end=i}}[r](t)}function vn(e,t,r){dr(e,q);let n=!t.includes("in")&&!t.includes("out")&&!r,i=n||t.includes("in")||["enter"].includes(r),o=n||t.includes("out")||["leave"].includes(r);t.includes("in")&&!n&&(t=t.filter((h,b)=>b<t.indexOf("out"))),t.includes("out")&&!n&&(t=t.filter((h,b)=>b>t.indexOf("out")));let s=!t.includes("opacity")&&!t.includes("scale"),a=s||t.includes("opacity"),c=s||t.includes("scale"),l=a?0:1,u=c?ce(t,"scale",95)/100:1,d=ce(t,"delay",0),x=ce(t,"origin","center"),k="opacity, transform",G=ce(t,"duration",150)/1e3,me=ce(t,"duration",75)/1e3,f="cubic-bezier(0.4, 0.0, 0.2, 1)";i&&(e._x_transition.enter.during={transformOrigin:x,transitionDelay:d,transitionProperty:k,transitionDuration:`${G}s`,transitionTimingFunction:f},e._x_transition.enter.start={opacity:l,transform:`scale(${u})`},e._x_transition.enter.end={opacity:1,transform:"scale(1)"}),o&&(e._x_transition.leave.during={transformOrigin:x,transitionDelay:d,transitionProperty:k,transitionDuration:`${me}s`,transitionTimingFunction:f},e._x_transition.leave.start={opacity:1,transform:"scale(1)"},e._x_transition.leave.end={opacity:l,transform:`scale(${u})`})}function dr(e,t,r={}){e._x_transition||(e._x_transition={enter:{during:r,start:r,end:r},leave:{during:r,start:r,end:r},in(n=()=>{},i=()=>{}){Ne(e,t,{during:this.enter.during,start:this.enter.start,end:this.enter.end},n,i)},out(n=()=>{},i=()=>{}){Ne(e,t,{during:this.leave.during,start:this.leave.start,end:this.leave.end},n,i)}})}window.Element.prototype._x_toggleAndCascadeWithTransitions=function(e,t,r,n){let i=()=>{document.visibilityState==="visible"?requestAnimationFrame(r):setTimeout(r)};if(t){e._x_transition&&(e._x_transition.enter||e._x_transition.leave)?e._x_transition.enter&&(Object.entries(e._x_transition.enter.during).length||Object.entries(e._x_transition.enter.start).length||Object.entries(e._x_transition.enter.end).length)?e._x_transition.in(r):i():e._x_transition?e._x_transition.in(r):i();return}e._x_hidePromise=e._x_transition?new Promise((o,s)=>{e._x_transition.out(()=>{},()=>o(n)),e._x_transitioning.beforeCancel(()=>s({isFromCancelledTransition:!0}))}):Promise.resolve(n),queueMicrotask(()=>{let o=pr(e);o?(o._x_hideChildren||(o._x_hideChildren=[]),o._x_hideChildren.push(e)):queueMicrotask(()=>{let s=a=>{let c=Promise.all([a._x_hidePromise,...(a._x_hideChildren||[]).map(s)]).then(([l])=>l());return delete a._x_hidePromise,delete a._x_hideChildren,c};s(e).catch(a=>{if(!a.isFromCancelledTransition)throw a})})})};function pr(e){let t=e.parentNode;if(!!t)return t._x_hidePromise?t:pr(t)}function Ne(e,t,{during:r,start:n,end:i}={},o=()=>{},s=()=>{}){if(e._x_transitioning&&e._x_transitioning.cancel(),Object.keys(r).length===0&&Object.keys(n).length===0&&Object.keys(i).length===0){o(),s();return}let a,c,l;wn(e,{start(){a=t(e,n)},during(){c=t(e,r)},before:o,end(){a(),l=t(e,i)},after:s,cleanup(){c(),l()}})}function wn(e,t){let r,n,i,o=ae(()=>{m(()=>{r=!0,n||t.before(),i||(t.end(),Te()),t.after(),e.isConnected&&t.cleanup(),delete e._x_transitioning})});e._x_transitioning={beforeCancels:[],beforeCancel(s){this.beforeCancels.push(s)},cancel:ae(function(){for(;this.beforeCancels.length;)this.beforeCancels.shift()();o()}),finish:o},m(()=>{t.start(),t.during()}),or(),requestAnimationFrame(()=>{if(r)return;let s=Number(getComputedStyle(e).transitionDuration.replace(/,.*/,"").replace("s",""))*1e3,a=Number(getComputedStyle(e).transitionDelay.replace(/,.*/,"").replace("s",""))*1e3;s===0&&(s=Number(getComputedStyle(e).animationDuration.replace("s",""))*1e3),m(()=>{t.before()}),n=!0,requestAnimationFrame(()=>{r||(m(()=>{t.end()}),Te(),setTimeout(e._x_transitioning.finish,s+a),i=!0)})})}function ce(e,t,r){if(e.indexOf(t)===-1)return r;let n=e[e.indexOf(t)+1];if(!n||t==="scale"&&isNaN(n))return r;if(t==="duration"){let i=n.match(/([0-9]+)ms/);if(i)return i[1]}return t==="origin"&&["top","right","left","center","bottom"].includes(e[e.indexOf(t)+2])?[n,e[e.indexOf(t)+2]].join(" "):n}var xt=!1;function D(e,t=()=>{}){return(...r)=>xt?t(...r):e(...r)}function mr(e,t){t._x_dataStack||(t._x_dataStack=e._x_dataStack),xt=!0,Sn(()=>{En(t)}),xt=!1}function En(e){let t=!1;E(e,(n,i)=>{M(n,(o,s)=>{if(t&&ur(o))return s();t=!0,i(o,s)})})}function Sn(e){let t=K;Ze((r,n)=>{let i=t(r);return J(i),()=>{}}),e(),Ze(t)}function le(e,t,r,n=[]){switch(e._x_bindings||(e._x_bindings=A({})),e._x_bindings[t]=r,t=n.includes("camel")?Rn(t):t,t){case"value":An(e,r);break;case"style":Tn(e,r);break;case"class":On(e,r);break;default:Cn(e,t,r);break}}function An(e,t){if(e.type==="radio")e.attributes.value===void 0&&(e.value=t),window.fromModel&&(e.checked=hr(e.value,t));else if(e.type==="checkbox")Number.isInteger(t)?e.value=t:!Number.isInteger(t)&&!Array.isArray(t)&&typeof t!="boolean"&&![null,void 0].includes(t)?e.value=String(t):Array.isArray(t)?e.checked=t.some(r=>hr(r,e.value)):e.checked=!!t;else if(e.tagName==="SELECT")Mn(e,t);else{if(e.value===t)return;e.value=t}}function On(e,t){e._x_undoAddedClasses&&e._x_undoAddedClasses(),e._x_undoAddedClasses=se(e,t)}function Tn(e,t){e._x_undoAddedStyles&&e._x_undoAddedStyles(),e._x_undoAddedStyles=q(e,t)}function Cn(e,t,r){[null,void 0,!1].includes(r)&&kn(t)?e.removeAttribute(t):(_r(t)&&(r=t),Nn(e,t,r))}function Nn(e,t,r){e.getAttribute(t)!=r&&e.setAttribute(t,r)}function Mn(e,t){let r=[].concat(t).map(n=>n+"");Array.from(e.options).forEach(n=>{n.selected=r.includes(n.value)})}function Rn(e){return e.toLowerCase().replace(/-(\w)/g,(t,r)=>r.toUpperCase())}function hr(e,t){return e==t}function _r(e){return["disabled","checked","required","readonly","hidden","open","selected","autofocus","itemscope","multiple","novalidate","allowfullscreen","allowpaymentrequest","formnovalidate","autoplay","controls","loop","muted","playsinline","default","ismap","reversed","async","defer","nomodule"].includes(e)}function kn(e){return!["aria-pressed","aria-checked","aria-expanded","aria-selected"].includes(e)}function gr(e,t,r){if(e._x_bindings&&e._x_bindings[t]!==void 0)return e._x_bindings[t];let n=e.getAttribute(t);return n===null?typeof r=="function"?r():r:_r(t)?!![t,"true"].includes(n):n===""?!0:n}function ke(e,t){var r;return function(){var n=this,i=arguments,o=function(){r=null,e.apply(n,i)};clearTimeout(r),r=setTimeout(o,t)}}function Ie(e,t){let r;return function(){let n=this,i=arguments;r||(e.apply(n,i),r=!0,setTimeout(()=>r=!1,t))}}function xr(e){e(P)}var U={},yr=!1;function br(e,t){if(yr||(U=A(U),yr=!0),t===void 0)return U[e];U[e]=t,typeof t=="object"&&t!==null&&t.hasOwnProperty("init")&&typeof t.init=="function"&&U[e].init(),ve(U[e])}function vr(){return U}var wr={};function Er(e,t){wr[e]=typeof t!="function"?()=>t:t}function Sr(e){return Object.entries(wr).forEach(([t,r])=>{Object.defineProperty(e,t,{get(){return(...n)=>r(...n)}})}),e}var Ar={};function Or(e,t){Ar[e]=t}function Tr(e,t){return Object.entries(Ar).forEach(([r,n])=>{Object.defineProperty(e,r,{get(){return(...i)=>n.bind(t)(...i)},enumerable:!1})}),e}var In={get reactive(){return A},get release(){return J},get effect(){return K},get raw(){return Ye},version:"3.9.1",flushAndStopDeferringMutations:Ut,disableEffectScheduling:jt,stopObservingMutations:nt,destroyTree:_t,setReactivityEngine:Lt,closestDataStack:T,skipDuringClone:D,addRootSelector:Re,addInitSelector:Me,addScopeToNode:R,deferMutations:qt,mapAttributes:X,evaluateLater:g,setEvaluator:Yt,mergeProxies:C,findClosest:ee,closestRoot:H,interceptor:we,transition:Ne,setStyles:q,mutateDom:m,directive:p,throttle:Ie,debounce:ke,evaluate:I,initTree:E,nextTick:Ce,prefixed:w,prefix:Jt,plugin:xr,magic:y,store:br,start:ar,clone:mr,bound:gr,$data:be,data:Or,bind:Er},P=In;function yt(e,t){let r=Object.create(null),n=e.split(",");for(let i=0;i<n.length;i++)r[n[i]]=!0;return t?i=>!!r[i.toLowerCase()]:i=>!!r[i]}var es={[1]:"TEXT",[2]:"CLASS",[4]:"STYLE",[8]:"PROPS",[16]:"FULL_PROPS",[32]:"HYDRATE_EVENTS",[64]:"STABLE_FRAGMENT",[128]:"KEYED_FRAGMENT",[256]:"UNKEYED_FRAGMENT",[512]:"NEED_PATCH",[1024]:"DYNAMIC_SLOTS",[2048]:"DEV_ROOT_FRAGMENT",[-1]:"HOISTED",[-2]:"BAIL"},ts={[1]:"STABLE",[2]:"DYNAMIC",[3]:"FORWARDED"};var Pn="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly";var rs=yt(Pn+",async,autofocus,autoplay,controls,default,defer,disabled,hidden,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");var Cr=Object.freeze({}),ns=Object.freeze([]);var bt=Object.assign;var Dn=Object.prototype.hasOwnProperty,ue=(e,t)=>Dn.call(e,t),$=Array.isArray,te=e=>Rr(e)==="[object Map]";var $n=e=>typeof e=="string",Pe=e=>typeof e=="symbol",fe=e=>e!==null&&typeof e=="object";var jn=Object.prototype.toString,Rr=e=>jn.call(e),vt=e=>Rr(e).slice(8,-1);var De=e=>$n(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e;var $e=e=>{let t=Object.create(null);return r=>t[r]||(t[r]=e(r))},Ln=/-(\w)/g,is=$e(e=>e.replace(Ln,(t,r)=>r?r.toUpperCase():"")),Fn=/\B([A-Z])/g,os=$e(e=>e.replace(Fn,"-$1").toLowerCase()),wt=$e(e=>e.charAt(0).toUpperCase()+e.slice(1)),ss=$e(e=>e?`on${wt(e)}`:""),Et=(e,t)=>e!==t&&(e===e||t===t);var St=new WeakMap,de=[],N,W=Symbol("iterate"),At=Symbol("Map key iterate");function Kn(e){return e&&e._isEffect===!0}function Mr(e,t=Cr){Kn(e)&&(e=e.raw);let r=Bn(e,t);return t.lazy||r(),r}function kr(e){e.active&&(Nr(e),e.options.onStop&&e.options.onStop(),e.active=!1)}var zn=0;function Bn(e,t){let r=function(){if(!r.active)return e();if(!de.includes(r)){Nr(r);try{return Vn(),de.push(r),N=r,e()}finally{de.pop(),Ir(),N=de[de.length-1]}}};return r.id=zn++,r.allowRecurse=!!t.allowRecurse,r._isEffect=!0,r.active=!0,r.raw=e,r.deps=[],r.options=t,r}function Nr(e){let{deps:t}=e;if(t.length){for(let r=0;r<t.length;r++)t[r].delete(e);t.length=0}}var re=!0,Ot=[];function Hn(){Ot.push(re),re=!1}function Vn(){Ot.push(re),re=!0}function Ir(){let e=Ot.pop();re=e===void 0?!0:e}function O(e,t,r){if(!re||N===void 0)return;let n=St.get(e);n||St.set(e,n=new Map);let i=n.get(r);i||n.set(r,i=new Set),i.has(N)||(i.add(N),N.deps.push(i),N.options.onTrack&&N.options.onTrack({effect:N,target:e,type:t,key:r}))}function j(e,t,r,n,i,o){let s=St.get(e);if(!s)return;let a=new Set,c=u=>{u&&u.forEach(d=>{(d!==N||d.allowRecurse)&&a.add(d)})};if(t==="clear")s.forEach(c);else if(r==="length"&&$(e))s.forEach((u,d)=>{(d==="length"||d>=n)&&c(u)});else switch(r!==void 0&&c(s.get(r)),t){case"add":$(e)?De(r)&&c(s.get("length")):(c(s.get(W)),te(e)&&c(s.get(At)));break;case"delete":$(e)||(c(s.get(W)),te(e)&&c(s.get(At)));break;case"set":te(e)&&c(s.get(W));break}let l=u=>{u.options.onTrigger&&u.options.onTrigger({effect:u,target:e,key:r,type:t,newValue:n,oldValue:i,oldTarget:o}),u.options.scheduler?u.options.scheduler(u):u()};a.forEach(l)}var qn=yt("__proto__,__v_isRef,__isVue"),Pr=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(Pe)),Un=je(),Wn=je(!1,!0),Gn=je(!0),Yn=je(!0,!0),Le={};["includes","indexOf","lastIndexOf"].forEach(e=>{let t=Array.prototype[e];Le[e]=function(...r){let n=_(this);for(let o=0,s=this.length;o<s;o++)O(n,"get",o+"");let i=t.apply(n,r);return i===-1||i===!1?t.apply(n,r.map(_)):i}});["push","pop","shift","unshift","splice"].forEach(e=>{let t=Array.prototype[e];Le[e]=function(...r){Hn();let n=t.apply(this,r);return Ir(),n}});function je(e=!1,t=!1){return function(n,i,o){if(i==="__v_isReactive")return!e;if(i==="__v_isReadonly")return e;if(i==="__v_raw"&&o===(e?t?Zn:$r:t?Jn:Dr).get(n))return n;let s=$(n);if(!e&&s&&ue(Le,i))return Reflect.get(Le,i,o);let a=Reflect.get(n,i,o);return(Pe(i)?Pr.has(i):qn(i))||(e||O(n,"get",i),t)?a:Tt(a)?!s||!De(i)?a.value:a:fe(a)?e?jr(a):Fe(a):a}}var Qn=Lr(),Xn=Lr(!0);function Lr(e=!1){return function(r,n,i,o){let s=r[n];if(!e&&(i=_(i),s=_(s),!$(r)&&Tt(s)&&!Tt(i)))return s.value=i,!0;let a=$(r)&&De(n)?Number(n)<r.length:ue(r,n),c=Reflect.set(r,n,i,o);return r===_(o)&&(a?Et(i,s)&&j(r,"set",n,i,s):j(r,"add",n,i)),c}}function ei(e,t){let r=ue(e,t),n=e[t],i=Reflect.deleteProperty(e,t);return i&&r&&j(e,"delete",t,void 0,n),i}function ti(e,t){let r=Reflect.has(e,t);return(!Pe(t)||!Pr.has(t))&&O(e,"has",t),r}function ri(e){return O(e,"iterate",$(e)?"length":W),Reflect.ownKeys(e)}var Fr={get:Un,set:Qn,deleteProperty:ei,has:ti,ownKeys:ri},Kr={get:Gn,set(e,t){return console.warn(`Set operation on key "${String(t)}" failed: target is readonly.`,e),!0},deleteProperty(e,t){return console.warn(`Delete operation on key "${String(t)}" failed: target is readonly.`,e),!0}},ds=bt({},Fr,{get:Wn,set:Xn}),ps=bt({},Kr,{get:Yn}),Ct=e=>fe(e)?Fe(e):e,Rt=e=>fe(e)?jr(e):e,Mt=e=>e,Ke=e=>Reflect.getPrototypeOf(e);function Be(e,t,r=!1,n=!1){e=e.__v_raw;let i=_(e),o=_(t);t!==o&&!r&&O(i,"get",t),!r&&O(i,"get",o);let{has:s}=Ke(i),a=n?Mt:r?Rt:Ct;if(s.call(i,t))return a(e.get(t));if(s.call(i,o))return a(e.get(o));e!==i&&e.get(t)}function ze(e,t=!1){let r=this.__v_raw,n=_(r),i=_(e);return e!==i&&!t&&O(n,"has",e),!t&&O(n,"has",i),e===i?r.has(e):r.has(e)||r.has(i)}function Ve(e,t=!1){return e=e.__v_raw,!t&&O(_(e),"iterate",W),Reflect.get(e,"size",e)}function Br(e){e=_(e);let t=_(this);return Ke(t).has.call(t,e)||(t.add(e),j(t,"add",e,e)),this}function Vr(e,t){t=_(t);let r=_(this),{has:n,get:i}=Ke(r),o=n.call(r,e);o?zr(r,n,e):(e=_(e),o=n.call(r,e));let s=i.call(r,e);return r.set(e,t),o?Et(t,s)&&j(r,"set",e,t,s):j(r,"add",e,t),this}function Hr(e){let t=_(this),{has:r,get:n}=Ke(t),i=r.call(t,e);i?zr(t,r,e):(e=_(e),i=r.call(t,e));let o=n?n.call(t,e):void 0,s=t.delete(e);return i&&j(t,"delete",e,void 0,o),s}function qr(){let e=_(this),t=e.size!==0,r=te(e)?new Map(e):new Set(e),n=e.clear();return t&&j(e,"clear",void 0,void 0,r),n}function He(e,t){return function(n,i){let o=this,s=o.__v_raw,a=_(s),c=t?Mt:e?Rt:Ct;return!e&&O(a,"iterate",W),s.forEach((l,u)=>n.call(i,c(l),c(u),o))}}function qe(e,t,r){return function(...n){let i=this.__v_raw,o=_(i),s=te(o),a=e==="entries"||e===Symbol.iterator&&s,c=e==="keys"&&s,l=i[e](...n),u=r?Mt:t?Rt:Ct;return!t&&O(o,"iterate",c?At:W),{next(){let{value:d,done:x}=l.next();return x?{value:d,done:x}:{value:a?[u(d[0]),u(d[1])]:u(d),done:x}},[Symbol.iterator](){return this}}}}function L(e){return function(...t){{let r=t[0]?`on key "${t[0]}" `:"";console.warn(`${wt(e)} operation ${r}failed: target is readonly.`,_(this))}return e==="delete"?!1:this}}var Ur={get(e){return Be(this,e)},get size(){return Ve(this)},has:ze,add:Br,set:Vr,delete:Hr,clear:qr,forEach:He(!1,!1)},Wr={get(e){return Be(this,e,!1,!0)},get size(){return Ve(this)},has:ze,add:Br,set:Vr,delete:Hr,clear:qr,forEach:He(!1,!0)},Gr={get(e){return Be(this,e,!0)},get size(){return Ve(this,!0)},has(e){return ze.call(this,e,!0)},add:L("add"),set:L("set"),delete:L("delete"),clear:L("clear"),forEach:He(!0,!1)},Yr={get(e){return Be(this,e,!0,!0)},get size(){return Ve(this,!0)},has(e){return ze.call(this,e,!0)},add:L("add"),set:L("set"),delete:L("delete"),clear:L("clear"),forEach:He(!0,!0)},ni=["keys","values","entries",Symbol.iterator];ni.forEach(e=>{Ur[e]=qe(e,!1,!1),Gr[e]=qe(e,!0,!1),Wr[e]=qe(e,!1,!0),Yr[e]=qe(e,!0,!0)});function Ue(e,t){let r=t?e?Yr:Wr:e?Gr:Ur;return(n,i,o)=>i==="__v_isReactive"?!e:i==="__v_isReadonly"?e:i==="__v_raw"?n:Reflect.get(ue(r,i)&&i in n?r:n,i,o)}var ii={get:Ue(!1,!1)},ms={get:Ue(!1,!0)},oi={get:Ue(!0,!1)},hs={get:Ue(!0,!0)};function zr(e,t,r){let n=_(r);if(n!==r&&t.call(e,n)){let i=vt(e);console.warn(`Reactive ${i} contains both the raw and reactive versions of the same object${i==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}var Dr=new WeakMap,Jn=new WeakMap,$r=new WeakMap,Zn=new WeakMap;function si(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function ai(e){return e.__v_skip||!Object.isExtensible(e)?0:si(vt(e))}function Fe(e){return e&&e.__v_isReadonly?e:Jr(e,!1,Fr,ii,Dr)}function jr(e){return Jr(e,!0,Kr,oi,$r)}function Jr(e,t,r,n,i){if(!fe(e))return console.warn(`value cannot be made reactive: ${String(e)}`),e;if(e.__v_raw&&!(t&&e.__v_isReactive))return e;let o=i.get(e);if(o)return o;let s=ai(e);if(s===0)return e;let a=new Proxy(e,s===2?n:r);return i.set(e,a),a}function _(e){return e&&_(e.__v_raw)||e}function Tt(e){return Boolean(e&&e.__v_isRef===!0)}y("nextTick",()=>Ce);y("dispatch",e=>z.bind(z,e));y("watch",(e,{evaluateLater:t,effect:r})=>(n,i)=>{let o=t(n),s=!0,a;r(()=>o(c=>{JSON.stringify(c),s?a=c:queueMicrotask(()=>{i(c,a),a=c}),s=!1}))});y("store",vr);y("data",e=>be(e));y("root",e=>H(e));y("refs",e=>(e._x_refs_proxy||(e._x_refs_proxy=C(ci(e))),e._x_refs_proxy));function ci(e){let t=[],r=e;for(;r;)r._x_refs&&t.push(r._x_refs),r=r.parentNode;return t}var Nt={};function kt(e){return Nt[e]||(Nt[e]=0),++Nt[e]}function Zr(e,t){return ee(e,r=>{if(r._x_ids&&r._x_ids[t])return!0})}function Qr(e,t){e._x_ids||(e._x_ids={}),e._x_ids[t]||(e._x_ids[t]=kt(t))}y("id",e=>(t,r=null)=>{let n=Zr(e,t),i=n?n._x_ids[t]:kt(t);return r?`${t}-${i}-${r}`:`${t}-${i}`});y("el",e=>e);p("modelable",(e,{expression:t},{effect:r,evaluate:n,evaluateLater:i})=>{let o=i(t),s=()=>{let u;return o(d=>u=d),u},a=i(`${t} = __placeholder`),c=u=>a(()=>{},{scope:{__placeholder:u}}),l=s();e._x_modelable_hook&&(l=e._x_modelable_hook(l)),c(l),queueMicrotask(()=>{if(!e._x_model)return;let u=e._x_model.get,d=e._x_model.set;r(()=>c(u())),r(()=>d(s()))})});p("teleport",(e,{expression:t},{cleanup:r})=>{e.tagName.toLowerCase()!=="template"&&V("x-teleport can only be used on a <template> tag",e);let n=document.querySelector(t);n||V(`Cannot find x-teleport element for selector: "${t}"`);let i=e.content.cloneNode(!0).firstElementChild;e._x_teleport=i,i._x_teleportBack=e,e._x_forwardEvents&&e._x_forwardEvents.forEach(o=>{i.addEventListener(o,s=>{s.stopPropagation(),e.dispatchEvent(new s.constructor(s.type,s))})}),R(i,{},e),m(()=>{n.appendChild(i),E(i),i._x_ignore=!0}),r(()=>i.remove())});var Xr=()=>{};Xr.inline=(e,{modifiers:t},{cleanup:r})=>{t.includes("self")?e._x_ignoreSelf=!0:e._x_ignore=!0,r(()=>{t.includes("self")?delete e._x_ignoreSelf:delete e._x_ignore})};p("ignore",Xr);p("effect",(e,{expression:t},{effect:r})=>r(g(e,t)));function pe(e,t,r,n){let i=e,o=c=>n(c),s={},a=(c,l)=>u=>l(c,u);if(r.includes("dot")&&(t=li(t)),r.includes("camel")&&(t=ui(t)),r.includes("passive")&&(s.passive=!0),r.includes("capture")&&(s.capture=!0),r.includes("window")&&(i=window),r.includes("document")&&(i=document),r.includes("prevent")&&(o=a(o,(c,l)=>{l.preventDefault(),c(l)})),r.includes("stop")&&(o=a(o,(c,l)=>{l.stopPropagation(),c(l)})),r.includes("self")&&(o=a(o,(c,l)=>{l.target===e&&c(l)})),(r.includes("away")||r.includes("outside"))&&(i=document,o=a(o,(c,l)=>{e.contains(l.target)||e.offsetWidth<1&&e.offsetHeight<1||e._x_isShown!==!1&&c(l)})),o=a(o,(c,l)=>{fi(t)&&di(l,r)||c(l)}),r.includes("debounce")){let c=r[r.indexOf("debounce")+1]||"invalid-wait",l=It(c.split("ms")[0])?Number(c.split("ms")[0]):250;o=ke(o,l)}if(r.includes("throttle")){let c=r[r.indexOf("throttle")+1]||"invalid-wait",l=It(c.split("ms")[0])?Number(c.split("ms")[0]):250;o=Ie(o,l)}return r.includes("once")&&(o=a(o,(c,l)=>{c(l),i.removeEventListener(t,o,s)})),i.addEventListener(t,o,s),()=>{i.removeEventListener(t,o,s)}}function li(e){return e.replace(/-/g,".")}function ui(e){return e.toLowerCase().replace(/-(\w)/g,(t,r)=>r.toUpperCase())}function It(e){return!Array.isArray(e)&&!isNaN(e)}function pi(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[_\s]/,"-").toLowerCase()}function fi(e){return["keydown","keyup"].includes(e)}function di(e,t){let r=t.filter(o=>!["window","document","prevent","stop","once"].includes(o));if(r.includes("debounce")){let o=r.indexOf("debounce");r.splice(o,It((r[o+1]||"invalid-wait").split("ms")[0])?2:1)}if(r.length===0||r.length===1&&en(e.key).includes(r[0]))return!1;let i=["ctrl","shift","alt","meta","cmd","super"].filter(o=>r.includes(o));return r=r.filter(o=>!i.includes(o)),!(i.length>0&&i.filter(s=>((s==="cmd"||s==="super")&&(s="meta"),e[`${s}Key`])).length===i.length&&en(e.key).includes(r[0]))}function en(e){if(!e)return[];e=pi(e);let t={ctrl:"control",slash:"/",space:"-",spacebar:"-",cmd:"meta",esc:"escape",up:"arrow-up",down:"arrow-down",left:"arrow-left",right:"arrow-right",period:".",equal:"="};return t[e]=e,Object.keys(t).map(r=>{if(t[r]===e)return r}).filter(r=>r)}p("model",(e,{modifiers:t,expression:r},{effect:n,cleanup:i})=>{let o=g(e,r),s=`${r} = rightSideOfExpression($event, ${r})`,a=g(e,s);var c=e.tagName.toLowerCase()==="select"||["checkbox","radio"].includes(e.type)||t.includes("lazy")?"change":"input";let l=mi(e,t,r),u=pe(e,c,t,x=>{a(()=>{},{scope:{$event:x,rightSideOfExpression:l}})});i(()=>u());let d=g(e,`${r} = __placeholder`);e._x_model={get(){let x;return o(k=>x=k),x},set(x){d(()=>{},{scope:{__placeholder:x}})}},e._x_forceModelUpdate=()=>{o(x=>{x===void 0&&r.match(/\./)&&(x=""),window.fromModel=!0,m(()=>le(e,"value",x)),delete window.fromModel})},n(()=>{t.includes("unintrusive")&&document.activeElement.isSameNode(e)||e._x_forceModelUpdate()})});function mi(e,t,r){return e.type==="radio"&&m(()=>{e.hasAttribute("name")||e.setAttribute("name",r)}),(n,i)=>m(()=>{if(n instanceof CustomEvent&&n.detail!==void 0)return n.detail||n.target.value;if(e.type==="checkbox")if(Array.isArray(i)){let o=t.includes("number")?Pt(n.target.value):n.target.value;return n.target.checked?i.concat([o]):i.filter(s=>!hi(s,o))}else return n.target.checked;else{if(e.tagName.toLowerCase()==="select"&&e.multiple)return t.includes("number")?Array.from(n.target.selectedOptions).map(o=>{let s=o.value||o.text;return Pt(s)}):Array.from(n.target.selectedOptions).map(o=>o.value||o.text);{let o=n.target.value;return t.includes("number")?Pt(o):t.includes("trim")?o.trim():o}}})}function Pt(e){let t=e?parseFloat(e):null;return _i(t)?t:e}function hi(e,t){return e==t}function _i(e){return!Array.isArray(e)&&!isNaN(e)}p("cloak",e=>queueMicrotask(()=>m(()=>e.removeAttribute(w("cloak")))));Me(()=>`[${w("init")}]`);p("init",D((e,{expression:t},{evaluate:r})=>typeof t=="string"?!!t.trim()&&r(t,{},!1):r(t,{},!1)));p("text",(e,{expression:t},{effect:r,evaluateLater:n})=>{let i=n(t);r(()=>{i(o=>{m(()=>{e.textContent=o})})})});p("html",(e,{expression:t},{effect:r,evaluateLater:n})=>{let i=n(t);r(()=>{i(o=>{e.innerHTML=o})})});X(Se(":",Ae(w("bind:"))));p("bind",(e,{value:t,modifiers:r,expression:n,original:i},{effect:o})=>{if(!t)return gi(e,n,i,o);if(t==="key")return xi(e,n);let s=g(e,n);o(()=>s(a=>{a===void 0&&n.match(/\./)&&(a=""),m(()=>le(e,t,a,r))}))});function gi(e,t,r,n){let i={};Sr(i);let o=g(e,t),s=[];for(;s.length;)s.pop()();o(a=>{let c=Object.entries(a).map(([u,d])=>({name:u,value:d})),l=er(c);c=c.map(u=>l.find(d=>d.name===u.name)?{name:`x-bind:${u.name}`,value:`"${u.value}"`}:u),ie(e,c,r).map(u=>{s.push(u.runCleanups),u()})},{scope:i})}function xi(e,t){e._x_keyExpression=t}Re(()=>`[${w("data")}]`);p("data",D((e,{expression:t},{cleanup:r})=>{t=t===""?"{}":t;let n={},i=B(n,e).cleanup,o={};Tr(o,n);let s=I(e,t,{scope:o});s===void 0&&(s={});let a=B(s,e).cleanup,c=A(s);ve(c);let l=R(e,c);c.init&&I(e,c.init),r(()=>{l(),i(),a(),c.destroy&&I(e,c.destroy)})}));p("show",(e,{modifiers:t,expression:r},{effect:n})=>{let i=g(e,r),o=()=>m(()=>{e.style.display="none",e._x_isShown=!1}),s=()=>m(()=>{e.style.length===1&&e.style.display==="none"?e.removeAttribute("style"):e.style.removeProperty("display"),e._x_isShown=!0}),a=()=>setTimeout(s),c=ae(d=>d?s():o(),d=>{typeof e._x_toggleAndCascadeWithTransitions=="function"?e._x_toggleAndCascadeWithTransitions(e,d,s,o):d?a():o()}),l,u=!0;n(()=>i(d=>{!u&&d===l||(t.includes("immediate")&&(d?a():o()),c(d),l=d,u=!1)}))});p("for",(e,{expression:t},{effect:r,cleanup:n})=>{let i=bi(t),o=g(e,i.items),s=g(e,e._x_keyExpression||"index");e._x_prevKeys=[],e._x_lookup={},r(()=>yi(e,i,o,s)),n(()=>{Object.values(e._x_lookup).forEach(a=>a.remove()),delete e._x_prevKeys,delete e._x_lookup})});function yi(e,t,r,n){let i=s=>typeof s=="object"&&!Array.isArray(s),o=e;r(s=>{vi(s)&&s>=0&&(s=Array.from(Array(s).keys(),f=>f+1)),s===void 0&&(s=[]);let a=e._x_lookup,c=e._x_prevKeys,l=[],u=[];if(i(s))s=Object.entries(s).map(([f,h])=>{let b=tn(t,h,f,s);n(v=>u.push(v),{scope:{index:f,...b}}),l.push(b)});else for(let f=0;f<s.length;f++){let h=tn(t,s[f],f,s);n(b=>u.push(b),{scope:{index:f,...h}}),l.push(h)}let d=[],x=[],k=[],G=[];for(let f=0;f<c.length;f++){let h=c[f];u.indexOf(h)===-1&&k.push(h)}c=c.filter(f=>!k.includes(f));let me="template";for(let f=0;f<u.length;f++){let h=u[f],b=c.indexOf(h);if(b===-1)c.splice(f,0,h),d.push([me,f]);else if(b!==f){let v=c.splice(f,1)[0],S=c.splice(b-1,1)[0];c.splice(f,0,S),c.splice(b,0,v),x.push([v,S])}else G.push(h);me=h}for(let f=0;f<k.length;f++){let h=k[f];a[h]._x_effects&&a[h]._x_effects.forEach(_e),a[h].remove(),a[h]=null,delete a[h]}for(let f=0;f<x.length;f++){let[h,b]=x[f],v=a[h],S=a[b],Y=document.createElement("div");m(()=>{S.after(Y),v.after(S),S._x_currentIfEl&&S.after(S._x_currentIfEl),Y.before(v),v._x_currentIfEl&&v.after(v._x_currentIfEl),Y.remove()}),st(S,l[u.indexOf(b)])}for(let f=0;f<d.length;f++){let[h,b]=d[f],v=h==="template"?o:a[h];v._x_currentIfEl&&(v=v._x_currentIfEl);let S=l[b],Y=u[b],he=document.importNode(o.content,!0).firstElementChild;R(he,A(S),o),m(()=>{v.after(he),E(he)}),typeof Y=="object"&&V("x-for key cannot be an object, it must be a string or an integer",o),a[Y]=he}for(let f=0;f<G.length;f++)st(a[G[f]],l[u.indexOf(G[f])]);o._x_prevKeys=u})}function bi(e){let t=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,r=/^\s*\(|\)\s*$/g,n=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,i=e.match(n);if(!i)return;let o={};o.items=i[2].trim();let s=i[1].replace(r,"").trim(),a=s.match(t);return a?(o.item=s.replace(t,"").trim(),o.index=a[1].trim(),a[2]&&(o.collection=a[2].trim())):o.item=s,o}function tn(e,t,r,n){let i={};return/^\[.*\]$/.test(e.item)&&Array.isArray(t)?e.item.replace("[","").replace("]","").split(",").map(s=>s.trim()).forEach((s,a)=>{i[s]=t[a]}):/^\{.*\}$/.test(e.item)&&!Array.isArray(t)&&typeof t=="object"?e.item.replace("{","").replace("}","").split(",").map(s=>s.trim()).forEach(s=>{i[s]=t[s]}):i[e.item]=t,e.index&&(i[e.index]=r),e.collection&&(i[e.collection]=n),i}function vi(e){return!Array.isArray(e)&&!isNaN(e)}function rn(){}rn.inline=(e,{expression:t},{cleanup:r})=>{let n=H(e);n._x_refs||(n._x_refs={}),n._x_refs[t]=e,r(()=>delete n._x_refs[t])};p("ref",rn);p("if",(e,{expression:t},{effect:r,cleanup:n})=>{let i=g(e,t),o=()=>{if(e._x_currentIfEl)return e._x_currentIfEl;let a=e.content.cloneNode(!0).firstElementChild;return R(a,{},e),m(()=>{e.after(a),E(a)}),e._x_currentIfEl=a,e._x_undoIf=()=>{M(a,c=>{c._x_effects&&c._x_effects.forEach(_e)}),a.remove(),delete e._x_currentIfEl},a},s=()=>{!e._x_undoIf||(e._x_undoIf(),delete e._x_undoIf)};r(()=>i(a=>{a?o():s()})),n(()=>e._x_undoIf&&e._x_undoIf())});p("id",(e,{expression:t},{evaluate:r})=>{r(t).forEach(i=>Qr(e,i))});X(Se("@",Ae(w("on:"))));p("on",D((e,{value:t,modifiers:r,expression:n},{cleanup:i})=>{let o=n?g(e,n):()=>{};e.tagName.toLowerCase()==="template"&&(e._x_forwardEvents||(e._x_forwardEvents=[]),e._x_forwardEvents.includes(t)||e._x_forwardEvents.push(t));let s=pe(e,t,r,a=>{o(()=>{},{scope:{$event:a},params:[a]})});i(()=>s())}));P.setEvaluator(wi);P.setReactivityEngine({reactive:Fe,effect:Mr,release:kr,raw:_});function wi(e,t){let r={};B(r,e);let n=[r,...T(e)];if(typeof t=="function")return lt(n,t);let i=(o=()=>{},{scope:s={},params:a=[]}={})=>{let c=C([s,...n]);c[t]!==void 0&&Q(o,c[t],c,a)};return Ee.bind(null,e,t,i)}var Dt=P;window.Alpine=Dt;queueMicrotask(()=>{Dt.start()});})();
+`:""}`,t),setTimeout(()=>{throw e},0)}var Se=!0;function Jt(e){let t=Se;Se=!1,e(),Se=t}function I(e,t,r={}){let n;return g(e,t)(i=>n=i,r),n}function g(...e){return Zt(...e)}var Zt=mn;function Qt(e){Zt=e}function mn(e,t){let r={},n=z(r,e).cleanup;xe(e,"evaluator",n);let i=[r,...C(e)];if(typeof t=="function")return ft(i,t);let o=hn(i,t,e);return Ee.bind(null,e,t,o)}function ft(e,t){return(r=()=>{},{scope:n={},params:i=[]}={})=>{let o=t.apply(M([n,...e]),i);Q(r,o)}}var dt={};function _n(e,t){if(dt[e])return dt[e];let r=Object.getPrototypeOf(async function(){}).constructor,n=/^[\n\s]*if.*\(.*\)/.test(e)||/^(let|const)\s/.test(e)?`(() => { ${e} })()`:e,o=(()=>{try{return new r(["__self","scope"],`with (scope) { __self.result = ${n} }; __self.finished = true; return __self.result;`)}catch(s){return Z(s,t,e),Promise.resolve()}})();return dt[e]=o,o}function hn(e,t,r){let n=_n(t,r);return(i=()=>{},{scope:o={},params:s=[]}={})=>{n.result=void 0,n.finished=!1;let a=M([o,...e]);if(typeof n=="function"){let c=n(n,a).catch(l=>Z(l,r,t));n.finished?(Q(i,n.result,a,s,r),n.result=void 0):c.then(l=>{Q(i,l,a,s,r)}).catch(l=>Z(l,r,t)).finally(()=>n.result=void 0)}}}function Q(e,t,r,n,i){if(Se&&typeof t=="function"){let o=t.apply(r,n);o instanceof Promise?o.then(s=>Q(e,s,r,n)).catch(s=>Z(s,i,t)):e(o)}else e(t)}var pt="x-";function E(e=""){return pt+e}function Xt(e){pt=e}var er={};function d(e,t){er[e]=t}function ie(e,t,r){let n={};return Array.from(t).map(tr((o,s)=>n[o]=s)).filter(rr).map(xn(n,r)).sort(yn).map(o=>gn(e,o))}function nr(e){return Array.from(e).map(tr()).filter(t=>!rr(t))}var mt=!1,oe=new Map,ir=Symbol();function or(e){mt=!0;let t=Symbol();ir=t,oe.set(t,[]);let r=()=>{for(;oe.get(t).length;)oe.get(t).shift()();oe.delete(t)},n=()=>{mt=!1,r()};e(r),n()}function ut(e){let t=[],r=a=>t.push(a),[n,i]=Bt(e);return t.push(i),[{Alpine:D,effect:n,cleanup:r,evaluateLater:g.bind(g,e),evaluate:I.bind(I,e)},()=>t.forEach(a=>a())]}function gn(e,t){let r=()=>{},n=er[t.type]||r,[i,o]=ut(e);xe(e,t.original,o);let s=()=>{e._x_ignore||e._x_ignoreSelf||(n.inline&&n.inline(e,t,i),n=n.bind(n,e,t,i),mt?oe.get(ir).push(n):n())};return s.runCleanups=o,s}var Ae=(e,t)=>({name:r,value:n})=>(r.startsWith(e)&&(r=r.replace(e,t)),{name:r,value:n}),Oe=e=>e;function tr(e=()=>{}){return({name:t,value:r})=>{let{name:n,value:i}=sr.reduce((o,s)=>s(o),{name:t,value:r});return n!==t&&e(n,t),{name:n,value:i}}}var sr=[];function X(e){sr.push(e)}function rr({name:e}){return ar().test(e)}var ar=()=>new RegExp(`^${pt}([^:^.]+)\\b`);function xn(e,t){return({name:r,value:n})=>{let i=r.match(ar()),o=r.match(/:([a-zA-Z0-9\-:]+)/),s=r.match(/\.[^.\]]+(?=[^\]]*$)/g)||[],a=t||e[r]||r;return{type:i?i[1]:null,value:o?o[1]:null,modifiers:s.map(c=>c.replace(".","")),expression:n,original:a}}}var ht="DEFAULT",Te=["ignore","ref","data","id","bind","init","for","mask","model","modelable","transition","show","if",ht,"teleport","element"];function yn(e,t){let r=Te.indexOf(e.type)===-1?ht:e.type,n=Te.indexOf(t.type)===-1?ht:t.type;return Te.indexOf(r)-Te.indexOf(n)}function V(e,t,r={}){e.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0,cancelable:!0}))}var _t=[],gt=!1;function Me(e=()=>{}){return queueMicrotask(()=>{gt||setTimeout(()=>{Ce()})}),new Promise(t=>{_t.push(()=>{e(),t()})})}function Ce(){for(gt=!1;_t.length;)_t.shift()()}function cr(){gt=!0}function N(e,t){if(typeof ShadowRoot=="function"&&e instanceof ShadowRoot){Array.from(e.children).forEach(i=>N(i,t));return}let r=!1;if(t(e,()=>r=!0),r)return;let n=e.firstElementChild;for(;n;)N(n,t,!1),n=n.nextElementSibling}function O(e,...t){console.warn(`Alpine Warning: ${e}`,...t)}function ur(){document.body||O("Unable to initialize. Trying to load Alpine before `<body>` is available. Did you forget to add `defer` in Alpine's `<script>` tag?"),V(document,"alpine:init"),V(document,"alpine:initializing"),it(),qt(t=>w(t,N)),ge(t=>xt(t)),Ut((t,r)=>{ie(t,r).forEach(n=>n())});let e=t=>!H(t.parentElement,!0);Array.from(document.querySelectorAll(lr())).filter(e).forEach(t=>{w(t)}),V(document,"alpine:initialized")}var yt=[],fr=[];function dr(){return yt.map(e=>e())}function lr(){return yt.concat(fr).map(e=>e())}function Re(e){yt.push(e)}function Ne(e){fr.push(e)}function H(e,t=!1){return ee(e,r=>{if((t?lr():dr()).some(i=>r.matches(i)))return!0})}function ee(e,t){if(!!e){if(t(e))return e;if(e._x_teleportBack&&(e=e._x_teleportBack),!!e.parentElement)return ee(e.parentElement,t)}}function pr(e){return dr().some(t=>e.matches(t))}function w(e,t=N){or(()=>{t(e,(r,n)=>{ie(r,r.attributes).forEach(i=>i()),r._x_ignore&&n()})})}function xt(e){N(e,t=>et(t))}function se(e,t){return Array.isArray(t)?mr(e,t.join(" ")):typeof t=="object"&&t!==null?bn(e,t):typeof t=="function"?se(e,t()):mr(e,t)}function mr(e,t){let r=o=>o.split(" ").filter(Boolean),n=o=>o.split(" ").filter(s=>!e.classList.contains(s)).filter(Boolean),i=o=>(e.classList.add(...o),()=>{e.classList.remove(...o)});return t=t===!0?t="":t||"",i(n(t))}function bn(e,t){let r=a=>a.split(" ").filter(Boolean),n=Object.entries(t).flatMap(([a,c])=>c?r(a):!1).filter(Boolean),i=Object.entries(t).flatMap(([a,c])=>c?!1:r(a)).filter(Boolean),o=[],s=[];return i.forEach(a=>{e.classList.contains(a)&&(e.classList.remove(a),s.push(a))}),n.forEach(a=>{e.classList.contains(a)||(e.classList.add(a),o.push(a))}),()=>{s.forEach(a=>e.classList.add(a)),o.forEach(a=>e.classList.remove(a))}}function q(e,t){return typeof t=="object"&&t!==null?vn(e,t):wn(e,t)}function vn(e,t){let r={};return Object.entries(t).forEach(([n,i])=>{r[n]=e.style[n],n.startsWith("--")||(n=En(n)),e.style.setProperty(n,i)}),setTimeout(()=>{e.style.length===0&&e.removeAttribute("style")}),()=>{q(e,r)}}function wn(e,t){let r=e.getAttribute("style",t);return e.setAttribute("style",t),()=>{e.setAttribute("style",r||"")}}function En(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function ae(e,t=()=>{}){let r=!1;return function(){r?t.apply(this,arguments):(r=!0,e.apply(this,arguments))}}d("transition",(e,{value:t,modifiers:r,expression:n},{evaluate:i})=>{typeof n=="function"&&(n=i(n)),n?Sn(e,n,t):An(e,r,t)});function Sn(e,t,r){hr(e,se,""),{enter:i=>{e._x_transition.enter.during=i},"enter-start":i=>{e._x_transition.enter.start=i},"enter-end":i=>{e._x_transition.enter.end=i},leave:i=>{e._x_transition.leave.during=i},"leave-start":i=>{e._x_transition.leave.start=i},"leave-end":i=>{e._x_transition.leave.end=i}}[r](t)}function An(e,t,r){hr(e,q);let n=!t.includes("in")&&!t.includes("out")&&!r,i=n||t.includes("in")||["enter"].includes(r),o=n||t.includes("out")||["leave"].includes(r);t.includes("in")&&!n&&(t=t.filter((h,b)=>b<t.indexOf("out"))),t.includes("out")&&!n&&(t=t.filter((h,b)=>b>t.indexOf("out")));let s=!t.includes("opacity")&&!t.includes("scale"),a=s||t.includes("opacity"),c=s||t.includes("scale"),l=a?0:1,u=c?ce(t,"scale",95)/100:1,p=ce(t,"delay",0),y=ce(t,"origin","center"),P="opacity, transform",G=ce(t,"duration",150)/1e3,me=ce(t,"duration",75)/1e3,f="cubic-bezier(0.4, 0.0, 0.2, 1)";i&&(e._x_transition.enter.during={transformOrigin:y,transitionDelay:p,transitionProperty:P,transitionDuration:`${G}s`,transitionTimingFunction:f},e._x_transition.enter.start={opacity:l,transform:`scale(${u})`},e._x_transition.enter.end={opacity:1,transform:"scale(1)"}),o&&(e._x_transition.leave.during={transformOrigin:y,transitionDelay:p,transitionProperty:P,transitionDuration:`${me}s`,transitionTimingFunction:f},e._x_transition.leave.start={opacity:1,transform:"scale(1)"},e._x_transition.leave.end={opacity:l,transform:`scale(${u})`})}function hr(e,t,r={}){e._x_transition||(e._x_transition={enter:{during:r,start:r,end:r},leave:{during:r,start:r,end:r},in(n=()=>{},i=()=>{}){ke(e,t,{during:this.enter.during,start:this.enter.start,end:this.enter.end},n,i)},out(n=()=>{},i=()=>{}){ke(e,t,{during:this.leave.during,start:this.leave.start,end:this.leave.end},n,i)}})}window.Element.prototype._x_toggleAndCascadeWithTransitions=function(e,t,r,n){let i=()=>{document.visibilityState==="visible"?requestAnimationFrame(r):setTimeout(r)};if(t){e._x_transition&&(e._x_transition.enter||e._x_transition.leave)?e._x_transition.enter&&(Object.entries(e._x_transition.enter.during).length||Object.entries(e._x_transition.enter.start).length||Object.entries(e._x_transition.enter.end).length)?e._x_transition.in(r):i():e._x_transition?e._x_transition.in(r):i();return}e._x_hidePromise=e._x_transition?new Promise((o,s)=>{e._x_transition.out(()=>{},()=>o(n)),e._x_transitioning.beforeCancel(()=>s({isFromCancelledTransition:!0}))}):Promise.resolve(n),queueMicrotask(()=>{let o=_r(e);o?(o._x_hideChildren||(o._x_hideChildren=[]),o._x_hideChildren.push(e)):queueMicrotask(()=>{let s=a=>{let c=Promise.all([a._x_hidePromise,...(a._x_hideChildren||[]).map(s)]).then(([l])=>l());return delete a._x_hidePromise,delete a._x_hideChildren,c};s(e).catch(a=>{if(!a.isFromCancelledTransition)throw a})})})};function _r(e){let t=e.parentNode;if(!!t)return t._x_hidePromise?t:_r(t)}function ke(e,t,{during:r,start:n,end:i}={},o=()=>{},s=()=>{}){if(e._x_transitioning&&e._x_transitioning.cancel(),Object.keys(r).length===0&&Object.keys(n).length===0&&Object.keys(i).length===0){o(),s();return}let a,c,l;On(e,{start(){a=t(e,n)},during(){c=t(e,r)},before:o,end(){a(),l=t(e,i)},after:s,cleanup(){c(),l()}})}function On(e,t){let r,n,i,o=ae(()=>{m(()=>{r=!0,n||t.before(),i||(t.end(),Ce()),t.after(),e.isConnected&&t.cleanup(),delete e._x_transitioning})});e._x_transitioning={beforeCancels:[],beforeCancel(s){this.beforeCancels.push(s)},cancel:ae(function(){for(;this.beforeCancels.length;)this.beforeCancels.shift()();o()}),finish:o},m(()=>{t.start(),t.during()}),cr(),requestAnimationFrame(()=>{if(r)return;let s=Number(getComputedStyle(e).transitionDuration.replace(/,.*/,"").replace("s",""))*1e3,a=Number(getComputedStyle(e).transitionDelay.replace(/,.*/,"").replace("s",""))*1e3;s===0&&(s=Number(getComputedStyle(e).animationDuration.replace("s",""))*1e3),m(()=>{t.before()}),n=!0,requestAnimationFrame(()=>{r||(m(()=>{t.end()}),Ce(),setTimeout(e._x_transitioning.finish,s+a),i=!0)})})}function ce(e,t,r){if(e.indexOf(t)===-1)return r;let n=e[e.indexOf(t)+1];if(!n||t==="scale"&&isNaN(n))return r;if(t==="duration"){let i=n.match(/([0-9]+)ms/);if(i)return i[1]}return t==="origin"&&["top","right","left","center","bottom"].includes(e[e.indexOf(t)+2])?[n,e[e.indexOf(t)+2]].join(" "):n}var bt=!1;function $(e,t=()=>{}){return(...r)=>bt?t(...r):e(...r)}function gr(e,t){t._x_dataStack||(t._x_dataStack=e._x_dataStack),bt=!0,Cn(()=>{Tn(t)}),bt=!1}function Tn(e){let t=!1;w(e,(n,i)=>{N(n,(o,s)=>{if(t&&pr(o))return s();t=!0,i(o,s)})})}function Cn(e){let t=B;Xe((r,n)=>{let i=t(r);return J(i),()=>{}}),e(),Xe(t)}function le(e,t,r,n=[]){switch(e._x_bindings||(e._x_bindings=A({})),e._x_bindings[t]=r,t=n.includes("camel")?Pn(t):t,t){case"value":Mn(e,r);break;case"style":Nn(e,r);break;case"class":Rn(e,r);break;default:kn(e,t,r);break}}function Mn(e,t){if(e.type==="radio")e.attributes.value===void 0&&(e.value=t),window.fromModel&&(e.checked=xr(e.value,t));else if(e.type==="checkbox")Number.isInteger(t)?e.value=t:!Number.isInteger(t)&&!Array.isArray(t)&&typeof t!="boolean"&&![null,void 0].includes(t)?e.value=String(t):Array.isArray(t)?e.checked=t.some(r=>xr(r,e.value)):e.checked=!!t;else if(e.tagName==="SELECT")In(e,t);else{if(e.value===t)return;e.value=t}}function Rn(e,t){e._x_undoAddedClasses&&e._x_undoAddedClasses(),e._x_undoAddedClasses=se(e,t)}function Nn(e,t){e._x_undoAddedStyles&&e._x_undoAddedStyles(),e._x_undoAddedStyles=q(e,t)}function kn(e,t,r){[null,void 0,!1].includes(r)&&$n(t)?e.removeAttribute(t):(yr(t)&&(r=t),Dn(e,t,r))}function Dn(e,t,r){e.getAttribute(t)!=r&&e.setAttribute(t,r)}function In(e,t){let r=[].concat(t).map(n=>n+"");Array.from(e.options).forEach(n=>{n.selected=r.includes(n.value)})}function Pn(e){return e.toLowerCase().replace(/-(\w)/g,(t,r)=>r.toUpperCase())}function xr(e,t){return e==t}function yr(e){return["disabled","checked","required","readonly","hidden","open","selected","autofocus","itemscope","multiple","novalidate","allowfullscreen","allowpaymentrequest","formnovalidate","autoplay","controls","loop","muted","playsinline","default","ismap","reversed","async","defer","nomodule"].includes(e)}function $n(e){return!["aria-pressed","aria-checked","aria-expanded","aria-selected"].includes(e)}function br(e,t,r){if(e._x_bindings&&e._x_bindings[t]!==void 0)return e._x_bindings[t];let n=e.getAttribute(t);return n===null?typeof r=="function"?r():r:yr(t)?!![t,"true"].includes(n):n===""?!0:n}function Pe(e,t){var r;return function(){var n=this,i=arguments,o=function(){r=null,e.apply(n,i)};clearTimeout(r),r=setTimeout(o,t)}}function Ie(e,t){let r;return function(){let n=this,i=arguments;r||(e.apply(n,i),r=!0,setTimeout(()=>r=!1,t))}}function vr(e){e(D)}var U={},wr=!1;function Er(e,t){if(wr||(U=A(U),wr=!0),t===void 0)return U[e];U[e]=t,typeof t=="object"&&t!==null&&t.hasOwnProperty("init")&&typeof t.init=="function"&&U[e].init(),ve(U[e])}function Sr(){return U}var Ar={};function Or(e,t){Ar[e]=typeof t!="function"?()=>t:t}function Tr(e){return Object.entries(Ar).forEach(([t,r])=>{Object.defineProperty(e,t,{get(){return(...n)=>r(...n)}})}),e}var Cr={};function Mr(e,t){Cr[e]=t}function Rr(e,t){return Object.entries(Cr).forEach(([r,n])=>{Object.defineProperty(e,r,{get(){return(...i)=>n.bind(t)(...i)},enumerable:!1})}),e}var Ln={get reactive(){return A},get release(){return J},get effect(){return B},get raw(){return Ze},version:"3.10.2",flushAndStopDeferringMutations:Gt,dontAutoEvaluateFunctions:Jt,disableEffectScheduling:Ft,stopObservingMutations:ot,destroyTree:xt,setReactivityEngine:Kt,closestDataStack:C,skipDuringClone:$,addRootSelector:Re,addInitSelector:Ne,addScopeToNode:R,deferMutations:Wt,mapAttributes:X,evaluateLater:g,setEvaluator:Qt,mergeProxies:M,findClosest:ee,closestRoot:H,interceptor:we,transition:ke,setStyles:q,mutateDom:m,directive:d,throttle:Ie,debounce:Pe,evaluate:I,initTree:w,nextTick:Me,prefixed:E,prefix:Xt,plugin:vr,magic:x,store:Er,start:ur,clone:gr,bound:br,$data:be,data:Mr,bind:Or},D=Ln;function vt(e,t){let r=Object.create(null),n=e.split(",");for(let i=0;i<n.length;i++)r[n[i]]=!0;return t?i=>!!r[i.toLowerCase()]:i=>!!r[i]}var is={[1]:"TEXT",[2]:"CLASS",[4]:"STYLE",[8]:"PROPS",[16]:"FULL_PROPS",[32]:"HYDRATE_EVENTS",[64]:"STABLE_FRAGMENT",[128]:"KEYED_FRAGMENT",[256]:"UNKEYED_FRAGMENT",[512]:"NEED_PATCH",[1024]:"DYNAMIC_SLOTS",[2048]:"DEV_ROOT_FRAGMENT",[-1]:"HOISTED",[-2]:"BAIL"},os={[1]:"STABLE",[2]:"DYNAMIC",[3]:"FORWARDED"};var jn="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly";var ss=vt(jn+",async,autofocus,autoplay,controls,default,defer,disabled,hidden,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");var Nr=Object.freeze({}),as=Object.freeze([]);var wt=Object.assign;var Fn=Object.prototype.hasOwnProperty,ue=(e,t)=>Fn.call(e,t),L=Array.isArray,te=e=>kr(e)==="[object Map]";var Kn=e=>typeof e=="string",De=e=>typeof e=="symbol",fe=e=>e!==null&&typeof e=="object";var Bn=Object.prototype.toString,kr=e=>Bn.call(e),Et=e=>kr(e).slice(8,-1);var $e=e=>Kn(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e;var Le=e=>{let t=Object.create(null);return r=>t[r]||(t[r]=e(r))},zn=/-(\w)/g,cs=Le(e=>e.replace(zn,(t,r)=>r?r.toUpperCase():"")),Vn=/\B([A-Z])/g,ls=Le(e=>e.replace(Vn,"-$1").toLowerCase()),St=Le(e=>e.charAt(0).toUpperCase()+e.slice(1)),us=Le(e=>e?`on${St(e)}`:""),At=(e,t)=>e!==t&&(e===e||t===t);var Ot=new WeakMap,de=[],k,W=Symbol("iterate"),Tt=Symbol("Map key iterate");function Hn(e){return e&&e._isEffect===!0}function Pr(e,t=Nr){Hn(e)&&(e=e.raw);let r=qn(e,t);return t.lazy||r(),r}function Dr(e){e.active&&(Ir(e),e.options.onStop&&e.options.onStop(),e.active=!1)}var Un=0;function qn(e,t){let r=function(){if(!r.active)return e();if(!de.includes(r)){Ir(r);try{return Wn(),de.push(r),k=r,e()}finally{de.pop(),$r(),k=de[de.length-1]}}};return r.id=Un++,r.allowRecurse=!!t.allowRecurse,r._isEffect=!0,r.active=!0,r.raw=e,r.deps=[],r.options=t,r}function Ir(e){let{deps:t}=e;if(t.length){for(let r=0;r<t.length;r++)t[r].delete(e);t.length=0}}var re=!0,Ct=[];function Gn(){Ct.push(re),re=!1}function Wn(){Ct.push(re),re=!0}function $r(){let e=Ct.pop();re=e===void 0?!0:e}function T(e,t,r){if(!re||k===void 0)return;let n=Ot.get(e);n||Ot.set(e,n=new Map);let i=n.get(r);i||n.set(r,i=new Set),i.has(k)||(i.add(k),k.deps.push(i),k.options.onTrack&&k.options.onTrack({effect:k,target:e,type:t,key:r}))}function j(e,t,r,n,i,o){let s=Ot.get(e);if(!s)return;let a=new Set,c=u=>{u&&u.forEach(p=>{(p!==k||p.allowRecurse)&&a.add(p)})};if(t==="clear")s.forEach(c);else if(r==="length"&&L(e))s.forEach((u,p)=>{(p==="length"||p>=n)&&c(u)});else switch(r!==void 0&&c(s.get(r)),t){case"add":L(e)?$e(r)&&c(s.get("length")):(c(s.get(W)),te(e)&&c(s.get(Tt)));break;case"delete":L(e)||(c(s.get(W)),te(e)&&c(s.get(Tt)));break;case"set":te(e)&&c(s.get(W));break}let l=u=>{u.options.onTrigger&&u.options.onTrigger({effect:u,target:e,key:r,type:t,newValue:n,oldValue:i,oldTarget:o}),u.options.scheduler?u.options.scheduler(u):u()};a.forEach(l)}var Yn=vt("__proto__,__v_isRef,__isVue"),Lr=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(De)),Jn=je(),Zn=je(!1,!0),Qn=je(!0),Xn=je(!0,!0),Fe={};["includes","indexOf","lastIndexOf"].forEach(e=>{let t=Array.prototype[e];Fe[e]=function(...r){let n=_(this);for(let o=0,s=this.length;o<s;o++)T(n,"get",o+"");let i=t.apply(n,r);return i===-1||i===!1?t.apply(n,r.map(_)):i}});["push","pop","shift","unshift","splice"].forEach(e=>{let t=Array.prototype[e];Fe[e]=function(...r){Gn();let n=t.apply(this,r);return $r(),n}});function je(e=!1,t=!1){return function(n,i,o){if(i==="__v_isReactive")return!e;if(i==="__v_isReadonly")return e;if(i==="__v_raw"&&o===(e?t?ti:Fr:t?ei:jr).get(n))return n;let s=L(n);if(!e&&s&&ue(Fe,i))return Reflect.get(Fe,i,o);let a=Reflect.get(n,i,o);return(De(i)?Lr.has(i):Yn(i))||(e||T(n,"get",i),t)?a:Mt(a)?!s||!$e(i)?a.value:a:fe(a)?e?Kr(a):Ke(a):a}}var ri=Br(),ni=Br(!0);function Br(e=!1){return function(r,n,i,o){let s=r[n];if(!e&&(i=_(i),s=_(s),!L(r)&&Mt(s)&&!Mt(i)))return s.value=i,!0;let a=L(r)&&$e(n)?Number(n)<r.length:ue(r,n),c=Reflect.set(r,n,i,o);return r===_(o)&&(a?At(i,s)&&j(r,"set",n,i,s):j(r,"add",n,i)),c}}function ii(e,t){let r=ue(e,t),n=e[t],i=Reflect.deleteProperty(e,t);return i&&r&&j(e,"delete",t,void 0,n),i}function oi(e,t){let r=Reflect.has(e,t);return(!De(t)||!Lr.has(t))&&T(e,"has",t),r}function si(e){return T(e,"iterate",L(e)?"length":W),Reflect.ownKeys(e)}var zr={get:Jn,set:ri,deleteProperty:ii,has:oi,ownKeys:si},Vr={get:Qn,set(e,t){return console.warn(`Set operation on key "${String(t)}" failed: target is readonly.`,e),!0},deleteProperty(e,t){return console.warn(`Delete operation on key "${String(t)}" failed: target is readonly.`,e),!0}},_s=wt({},zr,{get:Zn,set:ni}),gs=wt({},Vr,{get:Xn}),Rt=e=>fe(e)?Ke(e):e,Nt=e=>fe(e)?Kr(e):e,kt=e=>e,Be=e=>Reflect.getPrototypeOf(e);function ze(e,t,r=!1,n=!1){e=e.__v_raw;let i=_(e),o=_(t);t!==o&&!r&&T(i,"get",t),!r&&T(i,"get",o);let{has:s}=Be(i),a=n?kt:r?Nt:Rt;if(s.call(i,t))return a(e.get(t));if(s.call(i,o))return a(e.get(o));e!==i&&e.get(t)}function Ve(e,t=!1){let r=this.__v_raw,n=_(r),i=_(e);return e!==i&&!t&&T(n,"has",e),!t&&T(n,"has",i),e===i?r.has(e):r.has(e)||r.has(i)}function He(e,t=!1){return e=e.__v_raw,!t&&T(_(e),"iterate",W),Reflect.get(e,"size",e)}function Hr(e){e=_(e);let t=_(this);return Be(t).has.call(t,e)||(t.add(e),j(t,"add",e,e)),this}function Ur(e,t){t=_(t);let r=_(this),{has:n,get:i}=Be(r),o=n.call(r,e);o?qr(r,n,e):(e=_(e),o=n.call(r,e));let s=i.call(r,e);return r.set(e,t),o?At(t,s)&&j(r,"set",e,t,s):j(r,"add",e,t),this}function Wr(e){let t=_(this),{has:r,get:n}=Be(t),i=r.call(t,e);i?qr(t,r,e):(e=_(e),i=r.call(t,e));let o=n?n.call(t,e):void 0,s=t.delete(e);return i&&j(t,"delete",e,void 0,o),s}function Gr(){let e=_(this),t=e.size!==0,r=te(e)?new Map(e):new Set(e),n=e.clear();return t&&j(e,"clear",void 0,void 0,r),n}function qe(e,t){return function(n,i){let o=this,s=o.__v_raw,a=_(s),c=t?kt:e?Nt:Rt;return!e&&T(a,"iterate",W),s.forEach((l,u)=>n.call(i,c(l),c(u),o))}}function Ue(e,t,r){return function(...n){let i=this.__v_raw,o=_(i),s=te(o),a=e==="entries"||e===Symbol.iterator&&s,c=e==="keys"&&s,l=i[e](...n),u=r?kt:t?Nt:Rt;return!t&&T(o,"iterate",c?Tt:W),{next(){let{value:p,done:y}=l.next();return y?{value:p,done:y}:{value:a?[u(p[0]),u(p[1])]:u(p),done:y}},[Symbol.iterator](){return this}}}}function F(e){return function(...t){{let r=t[0]?`on key "${t[0]}" `:"";console.warn(`${St(e)} operation ${r}failed: target is readonly.`,_(this))}return e==="delete"?!1:this}}var Yr={get(e){return ze(this,e)},get size(){return He(this)},has:Ve,add:Hr,set:Ur,delete:Wr,clear:Gr,forEach:qe(!1,!1)},Jr={get(e){return ze(this,e,!1,!0)},get size(){return He(this)},has:Ve,add:Hr,set:Ur,delete:Wr,clear:Gr,forEach:qe(!1,!0)},Zr={get(e){return ze(this,e,!0)},get size(){return He(this,!0)},has(e){return Ve.call(this,e,!0)},add:F("add"),set:F("set"),delete:F("delete"),clear:F("clear"),forEach:qe(!0,!1)},Qr={get(e){return ze(this,e,!0,!0)},get size(){return He(this,!0)},has(e){return Ve.call(this,e,!0)},add:F("add"),set:F("set"),delete:F("delete"),clear:F("clear"),forEach:qe(!0,!0)},ai=["keys","values","entries",Symbol.iterator];ai.forEach(e=>{Yr[e]=Ue(e,!1,!1),Zr[e]=Ue(e,!0,!1),Jr[e]=Ue(e,!1,!0),Qr[e]=Ue(e,!0,!0)});function We(e,t){let r=t?e?Qr:Jr:e?Zr:Yr;return(n,i,o)=>i==="__v_isReactive"?!e:i==="__v_isReadonly"?e:i==="__v_raw"?n:Reflect.get(ue(r,i)&&i in n?r:n,i,o)}var ci={get:We(!1,!1)},xs={get:We(!1,!0)},li={get:We(!0,!1)},ys={get:We(!0,!0)};function qr(e,t,r){let n=_(r);if(n!==r&&t.call(e,n)){let i=Et(e);console.warn(`Reactive ${i} contains both the raw and reactive versions of the same object${i==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}var jr=new WeakMap,ei=new WeakMap,Fr=new WeakMap,ti=new WeakMap;function ui(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function fi(e){return e.__v_skip||!Object.isExtensible(e)?0:ui(Et(e))}function Ke(e){return e&&e.__v_isReadonly?e:Xr(e,!1,zr,ci,jr)}function Kr(e){return Xr(e,!0,Vr,li,Fr)}function Xr(e,t,r,n,i){if(!fe(e))return console.warn(`value cannot be made reactive: ${String(e)}`),e;if(e.__v_raw&&!(t&&e.__v_isReactive))return e;let o=i.get(e);if(o)return o;let s=fi(e);if(s===0)return e;let a=new Proxy(e,s===2?n:r);return i.set(e,a),a}function _(e){return e&&_(e.__v_raw)||e}function Mt(e){return Boolean(e&&e.__v_isRef===!0)}x("nextTick",()=>Me);x("dispatch",e=>V.bind(V,e));x("watch",(e,{evaluateLater:t,effect:r})=>(n,i)=>{let o=t(n),s=!0,a,c=r(()=>o(l=>{JSON.stringify(l),s?a=l:queueMicrotask(()=>{i(l,a),a=l}),s=!1}));e._x_effects.delete(c)});x("store",Sr);x("data",e=>be(e));x("root",e=>H(e));x("refs",e=>(e._x_refs_proxy||(e._x_refs_proxy=M(di(e))),e._x_refs_proxy));function di(e){let t=[],r=e;for(;r;)r._x_refs&&t.push(r._x_refs),r=r.parentNode;return t}var Pt={};function It(e){return Pt[e]||(Pt[e]=0),++Pt[e]}function en(e,t){return ee(e,r=>{if(r._x_ids&&r._x_ids[t])return!0})}function tn(e,t){e._x_ids||(e._x_ids={}),e._x_ids[t]||(e._x_ids[t]=It(t))}x("id",e=>(t,r=null)=>{let n=en(e,t),i=n?n._x_ids[t]:It(t);return r?`${t}-${i}-${r}`:`${t}-${i}`});x("el",e=>e);rn("Focus","focus","focus");rn("Persist","persist","persist");function rn(e,t,r){x(t,n=>O(`You can't use [$${directiveName}] without first installing the "${e}" plugin here: https://alpinejs.dev/plugins/${r}`,n))}d("modelable",(e,{expression:t},{effect:r,evaluateLater:n})=>{let i=n(t),o=()=>{let l;return i(u=>l=u),l},s=n(`${t} = __placeholder`),a=l=>s(()=>{},{scope:{__placeholder:l}}),c=o();a(c),queueMicrotask(()=>{if(!e._x_model)return;e._x_removeModelListeners.default();let l=e._x_model.get,u=e._x_model.set;r(()=>a(l())),r(()=>u(o()))})});d("teleport",(e,{expression:t},{cleanup:r})=>{e.tagName.toLowerCase()!=="template"&&O("x-teleport can only be used on a <template> tag",e);let n=document.querySelector(t);n||O(`Cannot find x-teleport element for selector: "${t}"`);let i=e.content.cloneNode(!0).firstElementChild;e._x_teleport=i,i._x_teleportBack=e,e._x_forwardEvents&&e._x_forwardEvents.forEach(o=>{i.addEventListener(o,s=>{s.stopPropagation(),e.dispatchEvent(new s.constructor(s.type,s))})}),R(i,{},e),m(()=>{n.appendChild(i),w(i),i._x_ignore=!0}),r(()=>i.remove())});var nn=()=>{};nn.inline=(e,{modifiers:t},{cleanup:r})=>{t.includes("self")?e._x_ignoreSelf=!0:e._x_ignore=!0,r(()=>{t.includes("self")?delete e._x_ignoreSelf:delete e._x_ignore})};d("ignore",nn);d("effect",(e,{expression:t},{effect:r})=>r(g(e,t)));function pe(e,t,r,n){let i=e,o=c=>n(c),s={},a=(c,l)=>u=>l(c,u);if(r.includes("dot")&&(t=pi(t)),r.includes("camel")&&(t=mi(t)),r.includes("passive")&&(s.passive=!0),r.includes("capture")&&(s.capture=!0),r.includes("window")&&(i=window),r.includes("document")&&(i=document),r.includes("prevent")&&(o=a(o,(c,l)=>{l.preventDefault(),c(l)})),r.includes("stop")&&(o=a(o,(c,l)=>{l.stopPropagation(),c(l)})),r.includes("self")&&(o=a(o,(c,l)=>{l.target===e&&c(l)})),(r.includes("away")||r.includes("outside"))&&(i=document,o=a(o,(c,l)=>{e.contains(l.target)||l.target.isConnected!==!1&&(e.offsetWidth<1&&e.offsetHeight<1||e._x_isShown!==!1&&c(l))})),r.includes("once")&&(o=a(o,(c,l)=>{c(l),i.removeEventListener(t,o,s)})),o=a(o,(c,l)=>{hi(t)&&_i(l,r)||c(l)}),r.includes("debounce")){let c=r[r.indexOf("debounce")+1]||"invalid-wait",l=Dt(c.split("ms")[0])?Number(c.split("ms")[0]):250;o=Pe(o,l)}if(r.includes("throttle")){let c=r[r.indexOf("throttle")+1]||"invalid-wait",l=Dt(c.split("ms")[0])?Number(c.split("ms")[0]):250;o=Ie(o,l)}return i.addEventListener(t,o,s),()=>{i.removeEventListener(t,o,s)}}function pi(e){return e.replace(/-/g,".")}function mi(e){return e.toLowerCase().replace(/-(\w)/g,(t,r)=>r.toUpperCase())}function Dt(e){return!Array.isArray(e)&&!isNaN(e)}function gi(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[_\s]/,"-").toLowerCase()}function hi(e){return["keydown","keyup"].includes(e)}function _i(e,t){let r=t.filter(o=>!["window","document","prevent","stop","once"].includes(o));if(r.includes("debounce")){let o=r.indexOf("debounce");r.splice(o,Dt((r[o+1]||"invalid-wait").split("ms")[0])?2:1)}if(r.length===0||r.length===1&&on(e.key).includes(r[0]))return!1;let i=["ctrl","shift","alt","meta","cmd","super"].filter(o=>r.includes(o));return r=r.filter(o=>!i.includes(o)),!(i.length>0&&i.filter(s=>((s==="cmd"||s==="super")&&(s="meta"),e[`${s}Key`])).length===i.length&&on(e.key).includes(r[0]))}function on(e){if(!e)return[];e=gi(e);let t={ctrl:"control",slash:"/",space:"-",spacebar:"-",cmd:"meta",esc:"escape",up:"arrow-up",down:"arrow-down",left:"arrow-left",right:"arrow-right",period:".",equal:"="};return t[e]=e,Object.keys(t).map(r=>{if(t[r]===e)return r}).filter(r=>r)}d("model",(e,{modifiers:t,expression:r},{effect:n,cleanup:i})=>{let o=g(e,r),s=`${r} = rightSideOfExpression($event, ${r})`,a=g(e,s);var c=e.tagName.toLowerCase()==="select"||["checkbox","radio"].includes(e.type)||t.includes("lazy")?"change":"input";let l=xi(e,t,r),u=pe(e,c,t,y=>{a(()=>{},{scope:{$event:y,rightSideOfExpression:l}})});e._x_removeModelListeners||(e._x_removeModelListeners={}),e._x_removeModelListeners.default=u,i(()=>e._x_removeModelListeners.default());let p=g(e,`${r} = __placeholder`);e._x_model={get(){let y;return o(P=>y=P),y},set(y){p(()=>{},{scope:{__placeholder:y}})}},e._x_forceModelUpdate=()=>{o(y=>{y===void 0&&r.match(/\./)&&(y=""),window.fromModel=!0,m(()=>le(e,"value",y)),delete window.fromModel})},n(()=>{t.includes("unintrusive")&&document.activeElement.isSameNode(e)||e._x_forceModelUpdate()})});function xi(e,t,r){return e.type==="radio"&&m(()=>{e.hasAttribute("name")||e.setAttribute("name",r)}),(n,i)=>m(()=>{if(n instanceof CustomEvent&&n.detail!==void 0)return n.detail||n.target.value;if(e.type==="checkbox")if(Array.isArray(i)){let o=t.includes("number")?$t(n.target.value):n.target.value;return n.target.checked?i.concat([o]):i.filter(s=>!yi(s,o))}else return n.target.checked;else{if(e.tagName.toLowerCase()==="select"&&e.multiple)return t.includes("number")?Array.from(n.target.selectedOptions).map(o=>{let s=o.value||o.text;return $t(s)}):Array.from(n.target.selectedOptions).map(o=>o.value||o.text);{let o=n.target.value;return t.includes("number")?$t(o):t.includes("trim")?o.trim():o}}})}function $t(e){let t=e?parseFloat(e):null;return bi(t)?t:e}function yi(e,t){return e==t}function bi(e){return!Array.isArray(e)&&!isNaN(e)}d("cloak",e=>queueMicrotask(()=>m(()=>e.removeAttribute(E("cloak")))));Ne(()=>`[${E("init")}]`);d("init",$((e,{expression:t},{evaluate:r})=>typeof t=="string"?!!t.trim()&&r(t,{},!1):r(t,{},!1)));d("text",(e,{expression:t},{effect:r,evaluateLater:n})=>{let i=n(t);r(()=>{i(o=>{m(()=>{e.textContent=o})})})});d("html",(e,{expression:t},{effect:r,evaluateLater:n})=>{let i=n(t);r(()=>{i(o=>{m(()=>{e.innerHTML=o,e._x_ignoreSelf=!0,w(e),delete e._x_ignoreSelf})})})});X(Ae(":",Oe(E("bind:"))));d("bind",(e,{value:t,modifiers:r,expression:n,original:i},{effect:o})=>{if(!t)return vi(e,n,i,o);if(t==="key")return wi(e,n);let s=g(e,n);o(()=>s(a=>{a===void 0&&n.match(/\./)&&(a=""),m(()=>le(e,t,a,r))}))});function vi(e,t,r,n){let i={};Tr(i);let o=g(e,t),s=[];for(;s.length;)s.pop()();o(a=>{let c=Object.entries(a).map(([u,p])=>({name:u,value:p})),l=nr(c);c=c.map(u=>l.find(p=>p.name===u.name)?{name:`x-bind:${u.name}`,value:`"${u.value}"`}:u),ie(e,c,r).map(u=>{s.push(u.runCleanups),u()})},{scope:i})}function wi(e,t){e._x_keyExpression=t}Re(()=>`[${E("data")}]`);d("data",$((e,{expression:t},{cleanup:r})=>{t=t===""?"{}":t;let n={},i=z(n,e).cleanup,o={};Rr(o,n);let s=I(e,t,{scope:o});s===void 0&&(s={});let a=z(s,e).cleanup,c=A(s);ve(c);let l=R(e,c);c.init&&I(e,c.init),r(()=>{l(),i(),a(),c.destroy&&I(e,c.destroy),l()})}));d("show",(e,{modifiers:t,expression:r},{effect:n})=>{let i=g(e,r);e._x_doHide||(e._x_doHide=()=>{m(()=>e.style.display="none")}),e._x_doShow||(e._x_doShow=()=>{m(()=>{e.style.length===1&&e.style.display==="none"?e.removeAttribute("style"):e.style.removeProperty("display")})});let o=()=>{e._x_doHide(),e._x_isShown=!1},s=()=>{e._x_doShow(),e._x_isShown=!0},a=()=>setTimeout(s),c=ae(p=>p?s():o(),p=>{typeof e._x_toggleAndCascadeWithTransitions=="function"?e._x_toggleAndCascadeWithTransitions(e,p,s,o):p?a():o()}),l,u=!0;n(()=>i(p=>{!u&&p===l||(t.includes("immediate")&&(p?a():o()),c(p),l=p,u=!1)}))});d("for",(e,{expression:t},{effect:r,cleanup:n})=>{let i=Si(t),o=g(e,i.items),s=g(e,e._x_keyExpression||"index");e._x_prevKeys=[],e._x_lookup={},r(()=>Ei(e,i,o,s)),n(()=>{Object.values(e._x_lookup).forEach(a=>a.remove()),delete e._x_prevKeys,delete e._x_lookup})});function Ei(e,t,r,n){let i=s=>typeof s=="object"&&!Array.isArray(s),o=e;r(s=>{Ai(s)&&s>=0&&(s=Array.from(Array(s).keys(),f=>f+1)),s===void 0&&(s=[]);let a=e._x_lookup,c=e._x_prevKeys,l=[],u=[];if(i(s))s=Object.entries(s).map(([f,h])=>{let b=sn(t,h,f,s);n(v=>u.push(v),{scope:{index:f,...b}}),l.push(b)});else for(let f=0;f<s.length;f++){let h=sn(t,s[f],f,s);n(b=>u.push(b),{scope:{index:f,...h}}),l.push(h)}let p=[],y=[],P=[],G=[];for(let f=0;f<c.length;f++){let h=c[f];u.indexOf(h)===-1&&P.push(h)}c=c.filter(f=>!P.includes(f));let me="template";for(let f=0;f<u.length;f++){let h=u[f],b=c.indexOf(h);if(b===-1)c.splice(f,0,h),p.push([me,f]);else if(b!==f){let v=c.splice(f,1)[0],S=c.splice(b-1,1)[0];c.splice(f,0,S),c.splice(b,0,v),y.push([v,S])}else G.push(h);me=h}for(let f=0;f<P.length;f++){let h=P[f];a[h]._x_effects&&a[h]._x_effects.forEach(_e),a[h].remove(),a[h]=null,delete a[h]}for(let f=0;f<y.length;f++){let[h,b]=y[f],v=a[h],S=a[b],Y=document.createElement("div");m(()=>{S.after(Y),v.after(S),S._x_currentIfEl&&S.after(S._x_currentIfEl),Y.before(v),v._x_currentIfEl&&v.after(v._x_currentIfEl),Y.remove()}),ct(S,l[u.indexOf(b)])}for(let f=0;f<p.length;f++){let[h,b]=p[f],v=h==="template"?o:a[h];v._x_currentIfEl&&(v=v._x_currentIfEl);let S=l[b],Y=u[b],he=document.importNode(o.content,!0).firstElementChild;R(he,A(S),o),m(()=>{v.after(he),w(he)}),typeof Y=="object"&&O("x-for key cannot be an object, it must be a string or an integer",o),a[Y]=he}for(let f=0;f<G.length;f++)ct(a[G[f]],l[u.indexOf(G[f])]);o._x_prevKeys=u})}function Si(e){let t=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,r=/^\s*\(|\)\s*$/g,n=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,i=e.match(n);if(!i)return;let o={};o.items=i[2].trim();let s=i[1].replace(r,"").trim(),a=s.match(t);return a?(o.item=s.replace(t,"").trim(),o.index=a[1].trim(),a[2]&&(o.collection=a[2].trim())):o.item=s,o}function sn(e,t,r,n){let i={};return/^\[.*\]$/.test(e.item)&&Array.isArray(t)?e.item.replace("[","").replace("]","").split(",").map(s=>s.trim()).forEach((s,a)=>{i[s]=t[a]}):/^\{.*\}$/.test(e.item)&&!Array.isArray(t)&&typeof t=="object"?e.item.replace("{","").replace("}","").split(",").map(s=>s.trim()).forEach(s=>{i[s]=t[s]}):i[e.item]=t,e.index&&(i[e.index]=r),e.collection&&(i[e.collection]=n),i}function Ai(e){return!Array.isArray(e)&&!isNaN(e)}function an(){}an.inline=(e,{expression:t},{cleanup:r})=>{let n=H(e);n._x_refs||(n._x_refs={}),n._x_refs[t]=e,r(()=>delete n._x_refs[t])};d("ref",an);d("if",(e,{expression:t},{effect:r,cleanup:n})=>{let i=g(e,t),o=()=>{if(e._x_currentIfEl)return e._x_currentIfEl;let a=e.content.cloneNode(!0).firstElementChild;return R(a,{},e),m(()=>{e.after(a),w(a)}),e._x_currentIfEl=a,e._x_undoIf=()=>{N(a,c=>{c._x_effects&&c._x_effects.forEach(_e)}),a.remove(),delete e._x_currentIfEl},a},s=()=>{!e._x_undoIf||(e._x_undoIf(),delete e._x_undoIf)};r(()=>i(a=>{a?o():s()})),n(()=>e._x_undoIf&&e._x_undoIf())});d("id",(e,{expression:t},{evaluate:r})=>{r(t).forEach(i=>tn(e,i))});X(Ae("@",Oe(E("on:"))));d("on",$((e,{value:t,modifiers:r,expression:n},{cleanup:i})=>{let o=n?g(e,n):()=>{};e.tagName.toLowerCase()==="template"&&(e._x_forwardEvents||(e._x_forwardEvents=[]),e._x_forwardEvents.includes(t)||e._x_forwardEvents.push(t));let s=pe(e,t,r,a=>{o(()=>{},{scope:{$event:a},params:[a]})});i(()=>s())}));Ge("Collapse","collapse","collapse");Ge("Intersect","intersect","intersect");Ge("Focus","trap","focus");Ge("Mask","mask","mask");function Ge(e,t,r){d(t,n=>O(`You can't use [x-${t}] without first installing the "${e}" plugin here: https://alpinejs.dev/plugins/${r}`,n))}D.setEvaluator(Oi);D.setReactivityEngine({reactive:Ke,effect:Pr,release:Dr,raw:_});function Oi(e,t){let r={};z(r,e);let n=[r,...C(e)];if(typeof t=="function")return ft(n,t);let i=(o=()=>{},{scope:s={},params:a=[]}={})=>{let c=M([s,...n]);c[t]!==void 0&&Q(o,c[t],c,a)};return Ee.bind(null,e,t,i)}var Lt=D;window.Alpine=Lt;queueMicrotask(()=>{Lt.start()});})();
diff --git a/alpinejs/packages/csp/dist/module.cjs.js b/alpinejs/packages/csp/dist/module.cjs.js
index 5096393..3fba32e 100644
--- a/alpinejs/packages/csp/dist/module.cjs.js
+++ b/alpinejs/packages/csp/dist/module.cjs.js
@@ -1341,6 +1341,7 @@ function elementBoundEffect(el) {
el._x_effects.delete(effectReference);
release(effectReference);
};
+ return effectReference;
};
return [wrappedEffect, () => {
cleanup();
@@ -1692,6 +1693,13 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
}
// packages/alpinejs/src/evaluator.js
+var shouldAutoEvaluateFunctions = true;
+function dontAutoEvaluateFunctions(callback) {
+ let cache = shouldAutoEvaluateFunctions;
+ shouldAutoEvaluateFunctions = false;
+ callback();
+ shouldAutoEvaluateFunctions = cache;
+}
function evaluate(el, expression, extras = {}) {
let result;
evaluateLater(el, expression)((value) => result = value, extras);
@@ -1763,7 +1771,7 @@ function generateEvaluatorFromString(dataStack, expression, el) {
};
}
function runIfTypeOfFunction(receiver, value, scope2, params, el) {
- if (typeof value === "function") {
+ if (shouldAutoEvaluateFunctions && typeof value === "function") {
let result = value.apply(scope2, params);
if (result instanceof Promise) {
result.then((i) => runIfTypeOfFunction(receiver, i, scope2, params)).catch((error2) => handleError(error2, el, value));
@@ -1897,6 +1905,7 @@ var directiveOrder = [
"bind",
"init",
"for",
+ "mask",
"model",
"modelable",
"transition",
@@ -1925,13 +1934,19 @@ function dispatch(el, name, detail = {}) {
// packages/alpinejs/src/nextTick.js
var tickStack = [];
var isHolding = false;
-function nextTick(callback) {
- tickStack.push(callback);
+function nextTick(callback = () => {
+}) {
queueMicrotask(() => {
isHolding || setTimeout(() => {
releaseNextTicks();
});
});
+ return new Promise((res) => {
+ tickStack.push(() => {
+ callback();
+ res();
+ });
+ });
}
function releaseNextTicks() {
isHolding = false;
@@ -2679,8 +2694,9 @@ var Alpine = {
get raw() {
return raw;
},
- version: "3.9.1",
+ version: "3.10.2",
flushAndStopDeferringMutations,
+ dontAutoEvaluateFunctions,
disableEffectScheduling,
stopObservingMutations,
destroyTree,
@@ -2735,7 +2751,7 @@ magic("watch", (el, {evaluateLater: evaluateLater2, effect: effect3}) => (key, c
let evaluate2 = evaluateLater2(key);
let firstTime = true;
let oldValue;
- effect3(() => evaluate2((value) => {
+ let effectReference = effect3(() => evaluate2((value) => {
JSON.stringify(value);
if (!firstTime) {
queueMicrotask(() => {
@@ -2747,6 +2763,7 @@ magic("watch", (el, {evaluateLater: evaluateLater2, effect: effect3}) => (key, c
}
firstTime = false;
}));
+ el._x_effects.delete(effectReference);
});
// packages/alpinejs/src/magics/$store.js
@@ -2806,8 +2823,15 @@ magic("id", (el) => (name, key = null) => {
// packages/alpinejs/src/magics/$el.js
magic("el", (el) => el);
+// packages/alpinejs/src/magics/index.js
+warnMissingPluginMagic("Focus", "focus", "focus");
+warnMissingPluginMagic("Persist", "persist", "persist");
+function warnMissingPluginMagic(name, magicName, slug) {
+ magic(magicName, (el) => warn(`You can't use [$${directiveName}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el));
+}
+
// packages/alpinejs/src/directives/x-modelable.js
-directive("modelable", (el, {expression}, {effect: effect3, evaluate: evaluate2, evaluateLater: evaluateLater2}) => {
+directive("modelable", (el, {expression}, {effect: effect3, evaluateLater: evaluateLater2}) => {
let func = evaluateLater2(expression);
let innerGet = () => {
let result;
@@ -2818,12 +2842,11 @@ directive("modelable", (el, {expression}, {effect: effect3, evaluate: evaluate2,
let innerSet = (val) => evaluateInnerSet(() => {
}, {scope: {__placeholder: val}});
let initialValue = innerGet();
- if (el._x_modelable_hook)
- initialValue = el._x_modelable_hook(initialValue);
innerSet(initialValue);
queueMicrotask(() => {
if (!el._x_model)
return;
+ el._x_removeModelListeners["default"]();
let outerGet = el._x_model.get;
let outerSet = el._x_model.set;
effect3(() => innerSet(outerGet()));
@@ -2909,6 +2932,8 @@ function on(el, event, modifiers, callback) {
handler3 = wrapHandler(handler3, (next, e) => {
if (el.contains(e.target))
return;
+ if (e.target.isConnected === false)
+ return;
if (el.offsetWidth < 1 && el.offsetHeight < 1)
return;
if (el._x_isShown === false)
@@ -2916,6 +2941,12 @@ function on(el, event, modifiers, callback) {
next(e);
});
}
+ if (modifiers.includes("once")) {
+ handler3 = wrapHandler(handler3, (next, e) => {
+ next(e);
+ listenerTarget.removeEventListener(event, handler3, options);
+ });
+ }
handler3 = wrapHandler(handler3, (next, e) => {
if (isKeyEvent(event)) {
if (isListeningForASpecificKeyThatHasntBeenPressed(e, modifiers)) {
@@ -2934,12 +2965,6 @@ function on(el, event, modifiers, callback) {
let wait = isNumeric(nextModifier.split("ms")[0]) ? Number(nextModifier.split("ms")[0]) : 250;
handler3 = throttle(handler3, wait);
}
- if (modifiers.includes("once")) {
- handler3 = wrapHandler(handler3, (next, e) => {
- next(e);
- listenerTarget.removeEventListener(event, handler3, options);
- });
- }
listenerTarget.addEventListener(event, handler3, options);
return () => {
listenerTarget.removeEventListener(event, handler3, options);
@@ -3027,7 +3052,10 @@ directive("model", (el, {modifiers, expression}, {effect: effect3, cleanup}) =>
rightSideOfExpression: assigmentFunction
}});
});
- cleanup(() => removeListener());
+ if (!el._x_removeModelListeners)
+ el._x_removeModelListeners = {};
+ el._x_removeModelListeners["default"] = removeListener;
+ cleanup(() => el._x_removeModelListeners["default"]());
let evaluateSetModel = evaluateLater(el, `${expression} = __placeholder`);
el._x_model = {
get() {
@@ -3127,7 +3155,12 @@ directive("html", (el, {expression}, {effect: effect3, evaluateLater: evaluateLa
let evaluate2 = evaluateLater2(expression);
effect3(() => {
evaluate2((value) => {
- el.innerHTML = value;
+ mutateDom(() => {
+ el.innerHTML = value;
+ el._x_ignoreSelf = true;
+ initTree(el);
+ delete el._x_ignoreSelf;
+ });
});
});
});
@@ -3197,24 +3230,35 @@ directive("data", skipDuringClone((el, {expression}, {cleanup}) => {
cleanup1();
cleanup2();
reactiveData["destroy"] && evaluate(el, reactiveData["destroy"]);
+ undo();
});
}));
// packages/alpinejs/src/directives/x-show.js
directive("show", (el, {modifiers, expression}, {effect: effect3}) => {
let evaluate2 = evaluateLater(el, expression);
- let hide = () => mutateDom(() => {
- el.style.display = "none";
+ if (!el._x_doHide)
+ el._x_doHide = () => {
+ mutateDom(() => el.style.display = "none");
+ };
+ if (!el._x_doShow)
+ el._x_doShow = () => {
+ mutateDom(() => {
+ if (el.style.length === 1 && el.style.display === "none") {
+ el.removeAttribute("style");
+ } else {
+ el.style.removeProperty("display");
+ }
+ });
+ };
+ let hide = () => {
+ el._x_doHide();
el._x_isShown = false;
- });
- let show = () => mutateDom(() => {
- if (el.style.length === 1 && el.style.display === "none") {
- el.removeAttribute("style");
- } else {
- el.style.removeProperty("display");
- }
+ };
+ let show = () => {
+ el._x_doShow();
el._x_isShown = true;
- });
+ };
let clickAwayCompatibleShow = () => setTimeout(show);
let toggle = once((value) => value ? show() : hide(), (value) => {
if (typeof el._x_toggleAndCascadeWithTransitions === "function") {
@@ -3471,6 +3515,15 @@ directive("on", skipDuringClone((el, {value, modifiers, expression}, {cleanup})
cleanup(() => removeListener());
}));
+// packages/alpinejs/src/directives/index.js
+warnMissingPluginDirective("Collapse", "collapse", "collapse");
+warnMissingPluginDirective("Intersect", "intersect", "intersect");
+warnMissingPluginDirective("Focus", "trap", "focus");
+warnMissingPluginDirective("Mask", "mask", "mask");
+function warnMissingPluginDirective(name, directiveName2, slug) {
+ directive(directiveName2, (el) => warn(`You can't use [x-${directiveName2}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el));
+}
+
// packages/csp/src/index.js
alpine_default.setEvaluator(cspCompliantEvaluator);
alpine_default.setReactivityEngine({reactive: import_reactivity8.reactive, effect: import_reactivity8.effect, release: import_reactivity8.stop, raw: import_reactivity8.toRaw});
diff --git a/alpinejs/packages/csp/dist/module.esm.js b/alpinejs/packages/csp/dist/module.esm.js
index 5c585f2..40eaee2 100644
--- a/alpinejs/packages/csp/dist/module.esm.js
+++ b/alpinejs/packages/csp/dist/module.esm.js
@@ -1,1259 +1,3 @@
-var __create = Object.create;
-var __defProp = Object.defineProperty;
-var __getProtoOf = Object.getPrototypeOf;
-var __hasOwnProp = Object.prototype.hasOwnProperty;
-var __getOwnPropNames = Object.getOwnPropertyNames;
-var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
-var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
-var __commonJS = (callback, module) => () => {
- if (!module) {
- module = {exports: {}};
- callback(module.exports, module);
- }
- return module.exports;
-};
-var __exportStar = (target, module, desc) => {
- if (module && typeof module === "object" || typeof module === "function") {
- for (let key of __getOwnPropNames(module))
- if (!__hasOwnProp.call(target, key) && key !== "default")
- __defProp(target, key, {get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable});
- }
- return target;
-};
-var __toModule = (module) => {
- return __exportStar(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? {get: () => module.default, enumerable: true} : {value: module, enumerable: true})), module);
-};
-
-// node_modules/@vue/shared/dist/shared.cjs.js
-var require_shared_cjs = __commonJS((exports) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", {value: true});
- function makeMap(str, expectsLowerCase) {
- const map = Object.create(null);
- const list = str.split(",");
- for (let i = 0; i < list.length; i++) {
- map[list[i]] = true;
- }
- return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
- }
- var PatchFlagNames = {
- [1]: `TEXT`,
- [2]: `CLASS`,
- [4]: `STYLE`,
- [8]: `PROPS`,
- [16]: `FULL_PROPS`,
- [32]: `HYDRATE_EVENTS`,
- [64]: `STABLE_FRAGMENT`,
- [128]: `KEYED_FRAGMENT`,
- [256]: `UNKEYED_FRAGMENT`,
- [512]: `NEED_PATCH`,
- [1024]: `DYNAMIC_SLOTS`,
- [2048]: `DEV_ROOT_FRAGMENT`,
- [-1]: `HOISTED`,
- [-2]: `BAIL`
- };
- var slotFlagsText = {
- [1]: "STABLE",
- [2]: "DYNAMIC",
- [3]: "FORWARDED"
- };
- var GLOBALS_WHITE_LISTED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt";
- var isGloballyWhitelisted = /* @__PURE__ */ makeMap(GLOBALS_WHITE_LISTED);
- var range = 2;
- function generateCodeFrame(source, start2 = 0, end = source.length) {
- const lines = source.split(/\r?\n/);
- let count = 0;
- const res = [];
- for (let i = 0; i < lines.length; i++) {
- count += lines[i].length + 1;
- if (count >= start2) {
- for (let j = i - range; j <= i + range || end > count; j++) {
- if (j < 0 || j >= lines.length)
- continue;
- const line = j + 1;
- res.push(`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);
- const lineLength = lines[j].length;
- if (j === i) {
- const pad = start2 - (count - lineLength) + 1;
- const length = Math.max(1, end > count ? lineLength - pad : end - start2);
- res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
- } else if (j > i) {
- if (end > count) {
- const length = Math.max(Math.min(end - count, lineLength), 1);
- res.push(` | ` + "^".repeat(length));
- }
- count += lineLength + 1;
- }
- }
- break;
- }
- }
- return res.join("\n");
- }
- var specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
- var isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
- var isBooleanAttr2 = /* @__PURE__ */ makeMap(specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`);
- var unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
- var attrValidationCache = {};
- function isSSRSafeAttrName(name) {
- if (attrValidationCache.hasOwnProperty(name)) {
- return attrValidationCache[name];
- }
- const isUnsafe = unsafeAttrCharRE.test(name);
- if (isUnsafe) {
- console.error(`unsafe attribute name: ${name}`);
- }
- return attrValidationCache[name] = !isUnsafe;
- }
- var propsToAttrMap = {
- acceptCharset: "accept-charset",
- className: "class",
- htmlFor: "for",
- httpEquiv: "http-equiv"
- };
- var isNoUnitNumericStyleProp = /* @__PURE__ */ makeMap(`animation-iteration-count,border-image-outset,border-image-slice,border-image-width,box-flex,box-flex-group,box-ordinal-group,column-count,columns,flex,flex-grow,flex-positive,flex-shrink,flex-negative,flex-order,grid-row,grid-row-end,grid-row-span,grid-row-start,grid-column,grid-column-end,grid-column-span,grid-column-start,font-weight,line-clamp,line-height,opacity,order,orphans,tab-size,widows,z-index,zoom,fill-opacity,flood-opacity,stop-opacity,stroke-dasharray,stroke-dashoffset,stroke-miterlimit,stroke-opacity,stroke-width`);
- var isKnownAttr = /* @__PURE__ */ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`);
- function normalizeStyle(value) {
- if (isArray(value)) {
- const res = {};
- for (let i = 0; i < value.length; i++) {
- const item = value[i];
- const normalized = normalizeStyle(isString(item) ? parseStringStyle(item) : item);
- if (normalized) {
- for (const key in normalized) {
- res[key] = normalized[key];
- }
- }
- }
- return res;
- } else if (isObject(value)) {
- return value;
- }
- }
- var listDelimiterRE = /;(?![^(]*\))/g;
- var propertyDelimiterRE = /:(.+)/;
- function parseStringStyle(cssText) {
- const ret = {};
- cssText.split(listDelimiterRE).forEach((item) => {
- if (item) {
- const tmp = item.split(propertyDelimiterRE);
- tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
- }
- });
- return ret;
- }
- function stringifyStyle(styles) {
- let ret = "";
- if (!styles) {
- return ret;
- }
- for (const key in styles) {
- const value = styles[key];
- const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
- if (isString(value) || typeof value === "number" && isNoUnitNumericStyleProp(normalizedKey)) {
- ret += `${normalizedKey}:${value};`;
- }
- }
- return ret;
- }
- function normalizeClass(value) {
- let res = "";
- if (isString(value)) {
- res = value;
- } else if (isArray(value)) {
- for (let i = 0; i < value.length; i++) {
- const normalized = normalizeClass(value[i]);
- if (normalized) {
- res += normalized + " ";
- }
- }
- } else if (isObject(value)) {
- for (const name in value) {
- if (value[name]) {
- res += name + " ";
- }
- }
- }
- return res.trim();
- }
- var HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
- var SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
- var VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
- var isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
- var isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
- var isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
- var escapeRE = /["'&<>]/;
- function escapeHtml(string) {
- const str = "" + string;
- const match = escapeRE.exec(str);
- if (!match) {
- return str;
- }
- let html = "";
- let escaped;
- let index;
- let lastIndex = 0;
- for (index = match.index; index < str.length; index++) {
- switch (str.charCodeAt(index)) {
- case 34:
- escaped = "&quot;";
- break;
- case 38:
- escaped = "&amp;";
- break;
- case 39:
- escaped = "&#39;";
- break;
- case 60:
- escaped = "&lt;";
- break;
- case 62:
- escaped = "&gt;";
- break;
- default:
- continue;
- }
- if (lastIndex !== index) {
- html += str.substring(lastIndex, index);
- }
- lastIndex = index + 1;
- html += escaped;
- }
- return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
- }
- var commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
- function escapeHtmlComment(src) {
- return src.replace(commentStripRE, "");
- }
- function looseCompareArrays(a, b) {
- if (a.length !== b.length)
- return false;
- let equal = true;
- for (let i = 0; equal && i < a.length; i++) {
- equal = looseEqual(a[i], b[i]);
- }
- return equal;
- }
- function looseEqual(a, b) {
- if (a === b)
- return true;
- let aValidType = isDate(a);
- let bValidType = isDate(b);
- if (aValidType || bValidType) {
- return aValidType && bValidType ? a.getTime() === b.getTime() : false;
- }
- aValidType = isArray(a);
- bValidType = isArray(b);
- if (aValidType || bValidType) {
- return aValidType && bValidType ? looseCompareArrays(a, b) : false;
- }
- aValidType = isObject(a);
- bValidType = isObject(b);
- if (aValidType || bValidType) {
- if (!aValidType || !bValidType) {
- return false;
- }
- const aKeysCount = Object.keys(a).length;
- const bKeysCount = Object.keys(b).length;
- if (aKeysCount !== bKeysCount) {
- return false;
- }
- for (const key in a) {
- const aHasKey = a.hasOwnProperty(key);
- const bHasKey = b.hasOwnProperty(key);
- if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
- return false;
- }
- }
- }
- return String(a) === String(b);
- }
- function looseIndexOf(arr, val) {
- return arr.findIndex((item) => looseEqual(item, val));
- }
- var toDisplayString = (val) => {
- return val == null ? "" : isObject(val) ? JSON.stringify(val, replacer, 2) : String(val);
- };
- var replacer = (_key, val) => {
- if (isMap(val)) {
- return {
- [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {
- entries[`${key} =>`] = val2;
- return entries;
- }, {})
- };
- } else if (isSet(val)) {
- return {
- [`Set(${val.size})`]: [...val.values()]
- };
- } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {
- return String(val);
- }
- return val;
- };
- var babelParserDefaultPlugins = [
- "bigInt",
- "optionalChaining",
- "nullishCoalescingOperator"
- ];
- var EMPTY_OBJ = Object.freeze({});
- var EMPTY_ARR = Object.freeze([]);
- var NOOP = () => {
- };
- var NO = () => false;
- var onRE = /^on[^a-z]/;
- var isOn = (key) => onRE.test(key);
- var isModelListener = (key) => key.startsWith("onUpdate:");
- var extend = Object.assign;
- var remove = (arr, el) => {
- const i = arr.indexOf(el);
- if (i > -1) {
- arr.splice(i, 1);
- }
- };
- var hasOwnProperty = Object.prototype.hasOwnProperty;
- var hasOwn = (val, key) => hasOwnProperty.call(val, key);
- var isArray = Array.isArray;
- var isMap = (val) => toTypeString(val) === "[object Map]";
- var isSet = (val) => toTypeString(val) === "[object Set]";
- var isDate = (val) => val instanceof Date;
- var isFunction = (val) => typeof val === "function";
- var isString = (val) => typeof val === "string";
- var isSymbol = (val) => typeof val === "symbol";
- var isObject = (val) => val !== null && typeof val === "object";
- var isPromise = (val) => {
- return isObject(val) && isFunction(val.then) && isFunction(val.catch);
- };
- var objectToString = Object.prototype.toString;
- var toTypeString = (value) => objectToString.call(value);
- var toRawType = (value) => {
- return toTypeString(value).slice(8, -1);
- };
- var isPlainObject = (val) => toTypeString(val) === "[object Object]";
- var isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
- var isReservedProp = /* @__PURE__ */ makeMap(",key,ref,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
- var cacheStringFunction = (fn) => {
- const cache = Object.create(null);
- return (str) => {
- const hit = cache[str];
- return hit || (cache[str] = fn(str));
- };
- };
- var camelizeRE = /-(\w)/g;
- var camelize = cacheStringFunction((str) => {
- return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
- });
- var hyphenateRE = /\B([A-Z])/g;
- var hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
- var capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
- var toHandlerKey = cacheStringFunction((str) => str ? `on${capitalize(str)}` : ``);
- var hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
- var invokeArrayFns = (fns, arg) => {
- for (let i = 0; i < fns.length; i++) {
- fns[i](arg);
- }
- };
- var def = (obj, key, value) => {
- Object.defineProperty(obj, key, {
- configurable: true,
- enumerable: false,
- value
- });
- };
- var toNumber = (val) => {
- const n = parseFloat(val);
- return isNaN(n) ? val : n;
- };
- var _globalThis;
- var getGlobalThis = () => {
- return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
- };
- exports.EMPTY_ARR = EMPTY_ARR;
- exports.EMPTY_OBJ = EMPTY_OBJ;
- exports.NO = NO;
- exports.NOOP = NOOP;
- exports.PatchFlagNames = PatchFlagNames;
- exports.babelParserDefaultPlugins = babelParserDefaultPlugins;
- exports.camelize = camelize;
- exports.capitalize = capitalize;
- exports.def = def;
- exports.escapeHtml = escapeHtml;
- exports.escapeHtmlComment = escapeHtmlComment;
- exports.extend = extend;
- exports.generateCodeFrame = generateCodeFrame;
- exports.getGlobalThis = getGlobalThis;
- exports.hasChanged = hasChanged;
- exports.hasOwn = hasOwn;
- exports.hyphenate = hyphenate;
- exports.invokeArrayFns = invokeArrayFns;
- exports.isArray = isArray;
- exports.isBooleanAttr = isBooleanAttr2;
- exports.isDate = isDate;
- exports.isFunction = isFunction;
- exports.isGloballyWhitelisted = isGloballyWhitelisted;
- exports.isHTMLTag = isHTMLTag;
- exports.isIntegerKey = isIntegerKey;
- exports.isKnownAttr = isKnownAttr;
- exports.isMap = isMap;
- exports.isModelListener = isModelListener;
- exports.isNoUnitNumericStyleProp = isNoUnitNumericStyleProp;
- exports.isObject = isObject;
- exports.isOn = isOn;
- exports.isPlainObject = isPlainObject;
- exports.isPromise = isPromise;
- exports.isReservedProp = isReservedProp;
- exports.isSSRSafeAttrName = isSSRSafeAttrName;
- exports.isSVGTag = isSVGTag;
- exports.isSet = isSet;
- exports.isSpecialBooleanAttr = isSpecialBooleanAttr;
- exports.isString = isString;
- exports.isSymbol = isSymbol;
- exports.isVoidTag = isVoidTag;
- exports.looseEqual = looseEqual;
- exports.looseIndexOf = looseIndexOf;
- exports.makeMap = makeMap;
- exports.normalizeClass = normalizeClass;
- exports.normalizeStyle = normalizeStyle;
- exports.objectToString = objectToString;
- exports.parseStringStyle = parseStringStyle;
- exports.propsToAttrMap = propsToAttrMap;
- exports.remove = remove;
- exports.slotFlagsText = slotFlagsText;
- exports.stringifyStyle = stringifyStyle;
- exports.toDisplayString = toDisplayString;
- exports.toHandlerKey = toHandlerKey;
- exports.toNumber = toNumber;
- exports.toRawType = toRawType;
- exports.toTypeString = toTypeString;
-});
-
-// node_modules/@vue/shared/index.js
-var require_shared = __commonJS((exports, module) => {
- "use strict";
- if (false) {
- module.exports = null;
- } else {
- module.exports = require_shared_cjs();
- }
-});
-
-// node_modules/@vue/reactivity/dist/reactivity.cjs.js
-var require_reactivity_cjs = __commonJS((exports) => {
- "use strict";
- Object.defineProperty(exports, "__esModule", {value: true});
- var shared = require_shared();
- var targetMap = new WeakMap();
- var effectStack = [];
- var activeEffect;
- var ITERATE_KEY = Symbol("iterate");
- var MAP_KEY_ITERATE_KEY = Symbol("Map key iterate");
- function isEffect(fn) {
- return fn && fn._isEffect === true;
- }
- function effect3(fn, options = shared.EMPTY_OBJ) {
- if (isEffect(fn)) {
- fn = fn.raw;
- }
- const effect4 = createReactiveEffect(fn, options);
- if (!options.lazy) {
- effect4();
- }
- return effect4;
- }
- function stop2(effect4) {
- if (effect4.active) {
- cleanup(effect4);
- if (effect4.options.onStop) {
- effect4.options.onStop();
- }
- effect4.active = false;
- }
- }
- var uid = 0;
- function createReactiveEffect(fn, options) {
- const effect4 = function reactiveEffect() {
- if (!effect4.active) {
- return fn();
- }
- if (!effectStack.includes(effect4)) {
- cleanup(effect4);
- try {
- enableTracking();
- effectStack.push(effect4);
- activeEffect = effect4;
- return fn();
- } finally {
- effectStack.pop();
- resetTracking();
- activeEffect = effectStack[effectStack.length - 1];
- }
- }
- };
- effect4.id = uid++;
- effect4.allowRecurse = !!options.allowRecurse;
- effect4._isEffect = true;
- effect4.active = true;
- effect4.raw = fn;
- effect4.deps = [];
- effect4.options = options;
- return effect4;
- }
- function cleanup(effect4) {
- const {deps} = effect4;
- if (deps.length) {
- for (let i = 0; i < deps.length; i++) {
- deps[i].delete(effect4);
- }
- deps.length = 0;
- }
- }
- var shouldTrack = true;
- var trackStack = [];
- function pauseTracking() {
- trackStack.push(shouldTrack);
- shouldTrack = false;
- }
- function enableTracking() {
- trackStack.push(shouldTrack);
- shouldTrack = true;
- }
- function resetTracking() {
- const last = trackStack.pop();
- shouldTrack = last === void 0 ? true : last;
- }
- function track(target, type, key) {
- if (!shouldTrack || activeEffect === void 0) {
- return;
- }
- let depsMap = targetMap.get(target);
- if (!depsMap) {
- targetMap.set(target, depsMap = new Map());
- }
- let dep = depsMap.get(key);
- if (!dep) {
- depsMap.set(key, dep = new Set());
- }
- if (!dep.has(activeEffect)) {
- dep.add(activeEffect);
- activeEffect.deps.push(dep);
- if (activeEffect.options.onTrack) {
- activeEffect.options.onTrack({
- effect: activeEffect,
- target,
- type,
- key
- });
- }
- }
- }
- function trigger(target, type, key, newValue, oldValue, oldTarget) {
- const depsMap = targetMap.get(target);
- if (!depsMap) {
- return;
- }
- const effects = new Set();
- const add2 = (effectsToAdd) => {
- if (effectsToAdd) {
- effectsToAdd.forEach((effect4) => {
- if (effect4 !== activeEffect || effect4.allowRecurse) {
- effects.add(effect4);
- }
- });
- }
- };
- if (type === "clear") {
- depsMap.forEach(add2);
- } else if (key === "length" && shared.isArray(target)) {
- depsMap.forEach((dep, key2) => {
- if (key2 === "length" || key2 >= newValue) {
- add2(dep);
- }
- });
- } else {
- if (key !== void 0) {
- add2(depsMap.get(key));
- }
- switch (type) {
- case "add":
- if (!shared.isArray(target)) {
- add2(depsMap.get(ITERATE_KEY));
- if (shared.isMap(target)) {
- add2(depsMap.get(MAP_KEY_ITERATE_KEY));
- }
- } else if (shared.isIntegerKey(key)) {
- add2(depsMap.get("length"));
- }
- break;
- case "delete":
- if (!shared.isArray(target)) {
- add2(depsMap.get(ITERATE_KEY));
- if (shared.isMap(target)) {
- add2(depsMap.get(MAP_KEY_ITERATE_KEY));
- }
- }
- break;
- case "set":
- if (shared.isMap(target)) {
- add2(depsMap.get(ITERATE_KEY));
- }
- break;
- }
- }
- const run = (effect4) => {
- if (effect4.options.onTrigger) {
- effect4.options.onTrigger({
- effect: effect4,
- target,
- key,
- type,
- newValue,
- oldValue,
- oldTarget
- });
- }
- if (effect4.options.scheduler) {
- effect4.options.scheduler(effect4);
- } else {
- effect4();
- }
- };
- effects.forEach(run);
- }
- var isNonTrackableKeys = /* @__PURE__ */ shared.makeMap(`__proto__,__v_isRef,__isVue`);
- var builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol).map((key) => Symbol[key]).filter(shared.isSymbol));
- var get2 = /* @__PURE__ */ createGetter();
- var shallowGet = /* @__PURE__ */ createGetter(false, true);
- var readonlyGet = /* @__PURE__ */ createGetter(true);
- var shallowReadonlyGet = /* @__PURE__ */ createGetter(true, true);
- var arrayInstrumentations = {};
- ["includes", "indexOf", "lastIndexOf"].forEach((key) => {
- const method = Array.prototype[key];
- arrayInstrumentations[key] = function(...args) {
- const arr = toRaw2(this);
- for (let i = 0, l = this.length; i < l; i++) {
- track(arr, "get", i + "");
- }
- const res = method.apply(arr, args);
- if (res === -1 || res === false) {
- return method.apply(arr, args.map(toRaw2));
- } else {
- return res;
- }
- };
- });
- ["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
- const method = Array.prototype[key];
- arrayInstrumentations[key] = function(...args) {
- pauseTracking();
- const res = method.apply(this, args);
- resetTracking();
- return res;
- };
- });
- function createGetter(isReadonly2 = false, shallow = false) {
- return function get3(target, key, receiver) {
- if (key === "__v_isReactive") {
- return !isReadonly2;
- } else if (key === "__v_isReadonly") {
- return isReadonly2;
- } else if (key === "__v_raw" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
- return target;
- }
- const targetIsArray = shared.isArray(target);
- if (!isReadonly2 && targetIsArray && shared.hasOwn(arrayInstrumentations, key)) {
- return Reflect.get(arrayInstrumentations, key, receiver);
- }
- const res = Reflect.get(target, key, receiver);
- if (shared.isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
- return res;
- }
- if (!isReadonly2) {
- track(target, "get", key);
- }
- if (shallow) {
- return res;
- }
- if (isRef(res)) {
- const shouldUnwrap = !targetIsArray || !shared.isIntegerKey(key);
- return shouldUnwrap ? res.value : res;
- }
- if (shared.isObject(res)) {
- return isReadonly2 ? readonly(res) : reactive3(res);
- }
- return res;
- };
- }
- var set2 = /* @__PURE__ */ createSetter();
- var shallowSet = /* @__PURE__ */ createSetter(true);
- function createSetter(shallow = false) {
- return function set3(target, key, value, receiver) {
- let oldValue = target[key];
- if (!shallow) {
- value = toRaw2(value);
- oldValue = toRaw2(oldValue);
- if (!shared.isArray(target) && isRef(oldValue) && !isRef(value)) {
- oldValue.value = value;
- return true;
- }
- }
- const hadKey = shared.isArray(target) && shared.isIntegerKey(key) ? Number(key) < target.length : shared.hasOwn(target, key);
- const result = Reflect.set(target, key, value, receiver);
- if (target === toRaw2(receiver)) {
- if (!hadKey) {
- trigger(target, "add", key, value);
- } else if (shared.hasChanged(value, oldValue)) {
- trigger(target, "set", key, value, oldValue);
- }
- }
- return result;
- };
- }
- function deleteProperty(target, key) {
- const hadKey = shared.hasOwn(target, key);
- const oldValue = target[key];
- const result = Reflect.deleteProperty(target, key);
- if (result && hadKey) {
- trigger(target, "delete", key, void 0, oldValue);
- }
- return result;
- }
- function has(target, key) {
- const result = Reflect.has(target, key);
- if (!shared.isSymbol(key) || !builtInSymbols.has(key)) {
- track(target, "has", key);
- }
- return result;
- }
- function ownKeys(target) {
- track(target, "iterate", shared.isArray(target) ? "length" : ITERATE_KEY);
- return Reflect.ownKeys(target);
- }
- var mutableHandlers = {
- get: get2,
- set: set2,
- deleteProperty,
- has,
- ownKeys
- };
- var readonlyHandlers = {
- get: readonlyGet,
- set(target, key) {
- {
- console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
- }
- return true;
- },
- deleteProperty(target, key) {
- {
- console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
- }
- return true;
- }
- };
- var shallowReactiveHandlers = shared.extend({}, mutableHandlers, {
- get: shallowGet,
- set: shallowSet
- });
- var shallowReadonlyHandlers = shared.extend({}, readonlyHandlers, {
- get: shallowReadonlyGet
- });
- var toReactive = (value) => shared.isObject(value) ? reactive3(value) : value;
- var toReadonly = (value) => shared.isObject(value) ? readonly(value) : value;
- var toShallow = (value) => value;
- var getProto = (v) => Reflect.getPrototypeOf(v);
- function get$1(target, key, isReadonly2 = false, isShallow = false) {
- target = target["__v_raw"];
- const rawTarget = toRaw2(target);
- const rawKey = toRaw2(key);
- if (key !== rawKey) {
- !isReadonly2 && track(rawTarget, "get", key);
- }
- !isReadonly2 && track(rawTarget, "get", rawKey);
- const {has: has2} = getProto(rawTarget);
- const wrap = isShallow ? toShallow : isReadonly2 ? toReadonly : toReactive;
- if (has2.call(rawTarget, key)) {
- return wrap(target.get(key));
- } else if (has2.call(rawTarget, rawKey)) {
- return wrap(target.get(rawKey));
- } else if (target !== rawTarget) {
- target.get(key);
- }
- }
- function has$1(key, isReadonly2 = false) {
- const target = this["__v_raw"];
- const rawTarget = toRaw2(target);
- const rawKey = toRaw2(key);
- if (key !== rawKey) {
- !isReadonly2 && track(rawTarget, "has", key);
- }
- !isReadonly2 && track(rawTarget, "has", rawKey);
- return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
- }
- function size(target, isReadonly2 = false) {
- target = target["__v_raw"];
- !isReadonly2 && track(toRaw2(target), "iterate", ITERATE_KEY);
- return Reflect.get(target, "size", target);
- }
- function add(value) {
- value = toRaw2(value);
- const target = toRaw2(this);
- const proto = getProto(target);
- const hadKey = proto.has.call(target, value);
- if (!hadKey) {
- target.add(value);
- trigger(target, "add", value, value);
- }
- return this;
- }
- function set$1(key, value) {
- value = toRaw2(value);
- const target = toRaw2(this);
- const {has: has2, get: get3} = getProto(target);
- let hadKey = has2.call(target, key);
- if (!hadKey) {
- key = toRaw2(key);
- hadKey = has2.call(target, key);
- } else {
- checkIdentityKeys(target, has2, key);
- }
- const oldValue = get3.call(target, key);
- target.set(key, value);
- if (!hadKey) {
- trigger(target, "add", key, value);
- } else if (shared.hasChanged(value, oldValue)) {
- trigger(target, "set", key, value, oldValue);
- }
- return this;
- }
- function deleteEntry(key) {
- const target = toRaw2(this);
- const {has: has2, get: get3} = getProto(target);
- let hadKey = has2.call(target, key);
- if (!hadKey) {
- key = toRaw2(key);
- hadKey = has2.call(target, key);
- } else {
- checkIdentityKeys(target, has2, key);
- }
- const oldValue = get3 ? get3.call(target, key) : void 0;
- const result = target.delete(key);
- if (hadKey) {
- trigger(target, "delete", key, void 0, oldValue);
- }
- return result;
- }
- function clear() {
- const target = toRaw2(this);
- const hadItems = target.size !== 0;
- const oldTarget = shared.isMap(target) ? new Map(target) : new Set(target);
- const result = target.clear();
- if (hadItems) {
- trigger(target, "clear", void 0, void 0, oldTarget);
- }
- return result;
- }
- function createForEach(isReadonly2, isShallow) {
- return function forEach(callback, thisArg) {
- const observed = this;
- const target = observed["__v_raw"];
- const rawTarget = toRaw2(target);
- const wrap = isShallow ? toShallow : isReadonly2 ? toReadonly : toReactive;
- !isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY);
- return target.forEach((value, key) => {
- return callback.call(thisArg, wrap(value), wrap(key), observed);
- });
- };
- }
- function createIterableMethod(method, isReadonly2, isShallow) {
- return function(...args) {
- const target = this["__v_raw"];
- const rawTarget = toRaw2(target);
- const targetIsMap = shared.isMap(rawTarget);
- const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
- const isKeyOnly = method === "keys" && targetIsMap;
- const innerIterator = target[method](...args);
- const wrap = isShallow ? toShallow : isReadonly2 ? toReadonly : toReactive;
- !isReadonly2 && track(rawTarget, "iterate", isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
- return {
- next() {
- const {value, done} = innerIterator.next();
- return done ? {value, done} : {
- value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
- done
- };
- },
- [Symbol.iterator]() {
- return this;
- }
- };
- };
- }
- function createReadonlyMethod(type) {
- return function(...args) {
- {
- const key = args[0] ? `on key "${args[0]}" ` : ``;
- console.warn(`${shared.capitalize(type)} operation ${key}failed: target is readonly.`, toRaw2(this));
- }
- return type === "delete" ? false : this;
- };
- }
- var mutableInstrumentations = {
- get(key) {
- return get$1(this, key);
- },
- get size() {
- return size(this);
- },
- has: has$1,
- add,
- set: set$1,
- delete: deleteEntry,
- clear,
- forEach: createForEach(false, false)
- };
- var shallowInstrumentations = {
- get(key) {
- return get$1(this, key, false, true);
- },
- get size() {
- return size(this);
- },
- has: has$1,
- add,
- set: set$1,
- delete: deleteEntry,
- clear,
- forEach: createForEach(false, true)
- };
- var readonlyInstrumentations = {
- get(key) {
- return get$1(this, key, true);
- },
- get size() {
- return size(this, true);
- },
- has(key) {
- return has$1.call(this, key, true);
- },
- add: createReadonlyMethod("add"),
- set: createReadonlyMethod("set"),
- delete: createReadonlyMethod("delete"),
- clear: createReadonlyMethod("clear"),
- forEach: createForEach(true, false)
- };
- var shallowReadonlyInstrumentations = {
- get(key) {
- return get$1(this, key, true, true);
- },
- get size() {
- return size(this, true);
- },
- has(key) {
- return has$1.call(this, key, true);
- },
- add: createReadonlyMethod("add"),
- set: createReadonlyMethod("set"),
- delete: createReadonlyMethod("delete"),
- clear: createReadonlyMethod("clear"),
- forEach: createForEach(true, true)
- };
- var iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
- iteratorMethods.forEach((method) => {
- mutableInstrumentations[method] = createIterableMethod(method, false, false);
- readonlyInstrumentations[method] = createIterableMethod(method, true, false);
- shallowInstrumentations[method] = createIterableMethod(method, false, true);
- shallowReadonlyInstrumentations[method] = createIterableMethod(method, true, true);
- });
- function createInstrumentationGetter(isReadonly2, shallow) {
- const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations;
- return (target, key, receiver) => {
- if (key === "__v_isReactive") {
- return !isReadonly2;
- } else if (key === "__v_isReadonly") {
- return isReadonly2;
- } else if (key === "__v_raw") {
- return target;
- }
- return Reflect.get(shared.hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
- };
- }
- var mutableCollectionHandlers = {
- get: createInstrumentationGetter(false, false)
- };
- var shallowCollectionHandlers = {
- get: createInstrumentationGetter(false, true)
- };
- var readonlyCollectionHandlers = {
- get: createInstrumentationGetter(true, false)
- };
- var shallowReadonlyCollectionHandlers = {
- get: createInstrumentationGetter(true, true)
- };
- function checkIdentityKeys(target, has2, key) {
- const rawKey = toRaw2(key);
- if (rawKey !== key && has2.call(target, rawKey)) {
- const type = shared.toRawType(target);
- console.warn(`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`);
- }
- }
- var reactiveMap = new WeakMap();
- var shallowReactiveMap = new WeakMap();
- var readonlyMap = new WeakMap();
- var shallowReadonlyMap = new WeakMap();
- function targetTypeMap(rawType) {
- switch (rawType) {
- case "Object":
- case "Array":
- return 1;
- case "Map":
- case "Set":
- case "WeakMap":
- case "WeakSet":
- return 2;
- default:
- return 0;
- }
- }
- function getTargetType(value) {
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(shared.toRawType(value));
- }
- function reactive3(target) {
- if (target && target["__v_isReadonly"]) {
- return target;
- }
- return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
- }
- function shallowReactive(target) {
- return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap);
- }
- function readonly(target) {
- return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
- }
- function shallowReadonly(target) {
- return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
- }
- function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
- if (!shared.isObject(target)) {
- {
- console.warn(`value cannot be made reactive: ${String(target)}`);
- }
- return target;
- }
- if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
- return target;
- }
- const existingProxy = proxyMap.get(target);
- if (existingProxy) {
- return existingProxy;
- }
- const targetType = getTargetType(target);
- if (targetType === 0) {
- return target;
- }
- const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
- proxyMap.set(target, proxy);
- return proxy;
- }
- function isReactive2(value) {
- if (isReadonly(value)) {
- return isReactive2(value["__v_raw"]);
- }
- return !!(value && value["__v_isReactive"]);
- }
- function isReadonly(value) {
- return !!(value && value["__v_isReadonly"]);
- }
- function isProxy(value) {
- return isReactive2(value) || isReadonly(value);
- }
- function toRaw2(observed) {
- return observed && toRaw2(observed["__v_raw"]) || observed;
- }
- function markRaw(value) {
- shared.def(value, "__v_skip", true);
- return value;
- }
- var convert = (val) => shared.isObject(val) ? reactive3(val) : val;
- function isRef(r) {
- return Boolean(r && r.__v_isRef === true);
- }
- function ref(value) {
- return createRef(value);
- }
- function shallowRef(value) {
- return createRef(value, true);
- }
- var RefImpl = class {
- constructor(_rawValue, _shallow = false) {
- this._rawValue = _rawValue;
- this._shallow = _shallow;
- this.__v_isRef = true;
- this._value = _shallow ? _rawValue : convert(_rawValue);
- }
- get value() {
- track(toRaw2(this), "get", "value");
- return this._value;
- }
- set value(newVal) {
- if (shared.hasChanged(toRaw2(newVal), this._rawValue)) {
- this._rawValue = newVal;
- this._value = this._shallow ? newVal : convert(newVal);
- trigger(toRaw2(this), "set", "value", newVal);
- }
- }
- };
- function createRef(rawValue, shallow = false) {
- if (isRef(rawValue)) {
- return rawValue;
- }
- return new RefImpl(rawValue, shallow);
- }
- function triggerRef(ref2) {
- trigger(toRaw2(ref2), "set", "value", ref2.value);
- }
- function unref(ref2) {
- return isRef(ref2) ? ref2.value : ref2;
- }
- var shallowUnwrapHandlers = {
- get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
- set: (target, key, value, receiver) => {
- const oldValue = target[key];
- if (isRef(oldValue) && !isRef(value)) {
- oldValue.value = value;
- return true;
- } else {
- return Reflect.set(target, key, value, receiver);
- }
- }
- };
- function proxyRefs(objectWithRefs) {
- return isReactive2(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
- }
- var CustomRefImpl = class {
- constructor(factory) {
- this.__v_isRef = true;
- const {get: get3, set: set3} = factory(() => track(this, "get", "value"), () => trigger(this, "set", "value"));
- this._get = get3;
- this._set = set3;
- }
- get value() {
- return this._get();
- }
- set value(newVal) {
- this._set(newVal);
- }
- };
- function customRef(factory) {
- return new CustomRefImpl(factory);
- }
- function toRefs(object) {
- if (!isProxy(object)) {
- console.warn(`toRefs() expects a reactive object but received a plain one.`);
- }
- const ret = shared.isArray(object) ? new Array(object.length) : {};
- for (const key in object) {
- ret[key] = toRef(object, key);
- }
- return ret;
- }
- var ObjectRefImpl = class {
- constructor(_object, _key) {
- this._object = _object;
- this._key = _key;
- this.__v_isRef = true;
- }
- get value() {
- return this._object[this._key];
- }
- set value(newVal) {
- this._object[this._key] = newVal;
- }
- };
- function toRef(object, key) {
- return isRef(object[key]) ? object[key] : new ObjectRefImpl(object, key);
- }
- var ComputedRefImpl = class {
- constructor(getter, _setter, isReadonly2) {
- this._setter = _setter;
- this._dirty = true;
- this.__v_isRef = true;
- this.effect = effect3(getter, {
- lazy: true,
- scheduler: () => {
- if (!this._dirty) {
- this._dirty = true;
- trigger(toRaw2(this), "set", "value");
- }
- }
- });
- this["__v_isReadonly"] = isReadonly2;
- }
- get value() {
- const self2 = toRaw2(this);
- if (self2._dirty) {
- self2._value = this.effect();
- self2._dirty = false;
- }
- track(self2, "get", "value");
- return self2._value;
- }
- set value(newValue) {
- this._setter(newValue);
- }
- };
- function computed(getterOrOptions) {
- let getter;
- let setter;
- if (shared.isFunction(getterOrOptions)) {
- getter = getterOrOptions;
- setter = () => {
- console.warn("Write operation failed: computed value is readonly");
- };
- } else {
- getter = getterOrOptions.get;
- setter = getterOrOptions.set;
- }
- return new ComputedRefImpl(getter, setter, shared.isFunction(getterOrOptions) || !getterOrOptions.set);
- }
- exports.ITERATE_KEY = ITERATE_KEY;
- exports.computed = computed;
- exports.customRef = customRef;
- exports.effect = effect3;
- exports.enableTracking = enableTracking;
- exports.isProxy = isProxy;
- exports.isReactive = isReactive2;
- exports.isReadonly = isReadonly;
- exports.isRef = isRef;
- exports.markRaw = markRaw;
- exports.pauseTracking = pauseTracking;
- exports.proxyRefs = proxyRefs;
- exports.reactive = reactive3;
- exports.readonly = readonly;
- exports.ref = ref;
- exports.resetTracking = resetTracking;
- exports.shallowReactive = shallowReactive;
- exports.shallowReadonly = shallowReadonly;
- exports.shallowRef = shallowRef;
- exports.stop = stop2;
- exports.toRaw = toRaw2;
- exports.toRef = toRef;
- exports.toRefs = toRefs;
- exports.track = track;
- exports.trigger = trigger;
- exports.triggerRef = triggerRef;
- exports.unref = unref;
-});
-
-// node_modules/@vue/reactivity/index.js
-var require_reactivity = __commonJS((exports, module) => {
- "use strict";
- if (false) {
- module.exports = null;
- } else {
- module.exports = require_reactivity_cjs();
- }
-});
-
// packages/alpinejs/src/scheduler.js
var flushPending = false;
var flushing = false;
@@ -1314,7 +58,7 @@ function overrideEffect(override) {
effect = override;
}
function elementBoundEffect(el) {
- let cleanup = () => {
+ let cleanup2 = () => {
};
let wrappedEffect = (callback) => {
let effectReference = effect(callback);
@@ -1325,15 +69,16 @@ function elementBoundEffect(el) {
};
}
el._x_effects.add(effectReference);
- cleanup = () => {
+ cleanup2 = () => {
if (effectReference === void 0)
return;
el._x_effects.delete(effectReference);
release(effectReference);
};
+ return effectReference;
};
return [wrappedEffect, () => {
- cleanup();
+ cleanup2();
}];
}
@@ -1439,7 +184,7 @@ function onMutate(mutations) {
let el = mutations[i].target;
let name = mutations[i].attributeName;
let oldValue = mutations[i].oldValue;
- let add = () => {
+ let add2 = () => {
if (!addedAttributes.has(el))
addedAttributes.set(el, []);
addedAttributes.get(el).push({name, value: el.getAttribute(name)});
@@ -1450,10 +195,10 @@ function onMutate(mutations) {
removedAttributes.get(el).push(name);
};
if (el.hasAttribute(name) && oldValue === null) {
- add();
+ add2();
} else if (el.hasAttribute(name)) {
remove();
- add();
+ add2();
} else {
remove();
}
@@ -1577,7 +322,7 @@ function mergeProxies(objects) {
// packages/alpinejs/src/interceptor.js
function initInterceptors(data2) {
- let isObject = (val) => typeof val === "object" && !Array.isArray(val) && val !== null;
+ let isObject2 = (val) => typeof val === "object" && !Array.isArray(val) && val !== null;
let recurse = (obj, basePath = "") => {
Object.entries(Object.getOwnPropertyDescriptors(obj)).forEach(([key, {value, enumerable}]) => {
if (enumerable === false || value === void 0)
@@ -1586,7 +331,7 @@ function initInterceptors(data2) {
if (typeof value === "object" && value !== null && value._x_interceptor) {
obj[key] = value.initialize(data2, path, key);
} else {
- if (isObject(value) && value !== obj && !(value instanceof Element)) {
+ if (isObject2(value) && value !== obj && !(value instanceof Element)) {
recurse(value, path);
}
}
@@ -1647,9 +392,9 @@ function injectMagics(obj, el) {
Object.entries(magics).forEach(([name, callback]) => {
Object.defineProperty(obj, `$${name}`, {
get() {
- let [utilities, cleanup] = getElementBoundUtilities(el);
+ let [utilities, cleanup2] = getElementBoundUtilities(el);
utilities = {interceptor, ...utilities};
- onElRemoved(el, cleanup);
+ onElRemoved(el, cleanup2);
return callback(el, utilities);
},
enumerable: false
@@ -1682,6 +427,13 @@ ${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el);
}
// packages/alpinejs/src/evaluator.js
+var shouldAutoEvaluateFunctions = true;
+function dontAutoEvaluateFunctions(callback) {
+ let cache = shouldAutoEvaluateFunctions;
+ shouldAutoEvaluateFunctions = false;
+ callback();
+ shouldAutoEvaluateFunctions = cache;
+}
function evaluate(el, expression, extras = {}) {
let result;
evaluateLater(el, expression)((value) => result = value, extras);
@@ -1696,8 +448,8 @@ function setEvaluator(newEvaluator) {
}
function normalEvaluator(el, expression) {
let overriddenMagics = {};
- let cleanup = injectMagics(overriddenMagics, el).cleanup;
- onAttributeRemoved(el, "evaluator", cleanup);
+ let cleanup2 = injectMagics(overriddenMagics, el).cleanup;
+ onAttributeRemoved(el, "evaluator", cleanup2);
let dataStack = [overriddenMagics, ...closestDataStack(el)];
if (typeof expression === "function") {
return generateEvaluatorFromFunction(dataStack, expression);
@@ -1753,7 +505,7 @@ function generateEvaluatorFromString(dataStack, expression, el) {
};
}
function runIfTypeOfFunction(receiver, value, scope2, params, el) {
- if (typeof value === "function") {
+ if (shouldAutoEvaluateFunctions && typeof value === "function") {
let result = value.apply(scope2, params);
if (result instanceof Promise) {
result.then((i) => runIfTypeOfFunction(receiver, i, scope2, params)).catch((error2) => handleError(error2, el, value));
@@ -1809,13 +561,13 @@ function deferHandlingDirectives(callback) {
}
function getElementBoundUtilities(el) {
let cleanups = [];
- let cleanup = (callback) => cleanups.push(callback);
+ let cleanup2 = (callback) => cleanups.push(callback);
let [effect3, cleanupEffect] = elementBoundEffect(el);
cleanups.push(cleanupEffect);
let utilities = {
Alpine: alpine_default,
effect: effect3,
- cleanup,
+ cleanup: cleanup2,
evaluateLater: evaluateLater.bind(evaluateLater, el),
evaluate: evaluate.bind(evaluate, el)
};
@@ -1826,8 +578,8 @@ function getDirectiveHandler(el, directive2) {
let noop = () => {
};
let handler3 = directiveHandlers[directive2.type] || noop;
- let [utilities, cleanup] = getElementBoundUtilities(el);
- onAttributeRemoved(el, directive2.original, cleanup);
+ let [utilities, cleanup2] = getElementBoundUtilities(el);
+ onAttributeRemoved(el, directive2.original, cleanup2);
let fullHandler = () => {
if (el._x_ignore || el._x_ignoreSelf)
return;
@@ -1835,7 +587,7 @@ function getDirectiveHandler(el, directive2) {
handler3 = handler3.bind(handler3, el, directive2, utilities);
isDeferringHandlers ? directiveHandlerStacks.get(currentHandlerStackKey).push(handler3) : handler3();
};
- fullHandler.runCleanups = cleanup;
+ fullHandler.runCleanups = cleanup2;
return fullHandler;
}
var startingWith = (subject, replacement) => ({name, value}) => {
@@ -1887,6 +639,7 @@ var directiveOrder = [
"bind",
"init",
"for",
+ "mask",
"model",
"modelable",
"transition",
@@ -1915,13 +668,19 @@ function dispatch(el, name, detail = {}) {
// packages/alpinejs/src/nextTick.js
var tickStack = [];
var isHolding = false;
-function nextTick(callback) {
- tickStack.push(callback);
+function nextTick(callback = () => {
+}) {
queueMicrotask(() => {
isHolding || setTimeout(() => {
releaseNextTicks();
});
});
+ return new Promise((res) => {
+ tickStack.push(() => {
+ callback();
+ res();
+ });
+ });
}
function releaseNextTicks() {
isHolding = false;
@@ -2669,8 +1428,9 @@ var Alpine = {
get raw() {
return raw;
},
- version: "3.9.1",
+ version: "3.10.2",
flushAndStopDeferringMutations,
+ dontAutoEvaluateFunctions,
disableEffectScheduling,
stopObservingMutations,
destroyTree,
@@ -2711,8 +1471,684 @@ var Alpine = {
};
var alpine_default = Alpine;
-// packages/csp/src/index.js
-var import_reactivity8 = __toModule(require_reactivity());
+// node_modules/@vue/shared/dist/shared.esm-bundler.js
+function makeMap(str, expectsLowerCase) {
+ const map = Object.create(null);
+ const list = str.split(",");
+ for (let i = 0; i < list.length; i++) {
+ map[list[i]] = true;
+ }
+ return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
+}
+var PatchFlagNames = {
+ [1]: `TEXT`,
+ [2]: `CLASS`,
+ [4]: `STYLE`,
+ [8]: `PROPS`,
+ [16]: `FULL_PROPS`,
+ [32]: `HYDRATE_EVENTS`,
+ [64]: `STABLE_FRAGMENT`,
+ [128]: `KEYED_FRAGMENT`,
+ [256]: `UNKEYED_FRAGMENT`,
+ [512]: `NEED_PATCH`,
+ [1024]: `DYNAMIC_SLOTS`,
+ [2048]: `DEV_ROOT_FRAGMENT`,
+ [-1]: `HOISTED`,
+ [-2]: `BAIL`
+};
+var slotFlagsText = {
+ [1]: "STABLE",
+ [2]: "DYNAMIC",
+ [3]: "FORWARDED"
+};
+var specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
+var isBooleanAttr2 = /* @__PURE__ */ makeMap(specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`);
+var EMPTY_OBJ = true ? Object.freeze({}) : {};
+var EMPTY_ARR = true ? Object.freeze([]) : [];
+var extend = Object.assign;
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+var hasOwn = (val, key) => hasOwnProperty.call(val, key);
+var isArray = Array.isArray;
+var isMap = (val) => toTypeString(val) === "[object Map]";
+var isString = (val) => typeof val === "string";
+var isSymbol = (val) => typeof val === "symbol";
+var isObject = (val) => val !== null && typeof val === "object";
+var objectToString = Object.prototype.toString;
+var toTypeString = (value) => objectToString.call(value);
+var toRawType = (value) => {
+ return toTypeString(value).slice(8, -1);
+};
+var isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
+var cacheStringFunction = (fn) => {
+ const cache = Object.create(null);
+ return (str) => {
+ const hit = cache[str];
+ return hit || (cache[str] = fn(str));
+ };
+};
+var camelizeRE = /-(\w)/g;
+var camelize = cacheStringFunction((str) => {
+ return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
+});
+var hyphenateRE = /\B([A-Z])/g;
+var hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
+var capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
+var toHandlerKey = cacheStringFunction((str) => str ? `on${capitalize(str)}` : ``);
+var hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
+
+// node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js
+var targetMap = new WeakMap();
+var effectStack = [];
+var activeEffect;
+var ITERATE_KEY = Symbol(true ? "iterate" : "");
+var MAP_KEY_ITERATE_KEY = Symbol(true ? "Map key iterate" : "");
+function isEffect(fn) {
+ return fn && fn._isEffect === true;
+}
+function effect2(fn, options = EMPTY_OBJ) {
+ if (isEffect(fn)) {
+ fn = fn.raw;
+ }
+ const effect3 = createReactiveEffect(fn, options);
+ if (!options.lazy) {
+ effect3();
+ }
+ return effect3;
+}
+function stop(effect3) {
+ if (effect3.active) {
+ cleanup(effect3);
+ if (effect3.options.onStop) {
+ effect3.options.onStop();
+ }
+ effect3.active = false;
+ }
+}
+var uid = 0;
+function createReactiveEffect(fn, options) {
+ const effect3 = function reactiveEffect() {
+ if (!effect3.active) {
+ return fn();
+ }
+ if (!effectStack.includes(effect3)) {
+ cleanup(effect3);
+ try {
+ enableTracking();
+ effectStack.push(effect3);
+ activeEffect = effect3;
+ return fn();
+ } finally {
+ effectStack.pop();
+ resetTracking();
+ activeEffect = effectStack[effectStack.length - 1];
+ }
+ }
+ };
+ effect3.id = uid++;
+ effect3.allowRecurse = !!options.allowRecurse;
+ effect3._isEffect = true;
+ effect3.active = true;
+ effect3.raw = fn;
+ effect3.deps = [];
+ effect3.options = options;
+ return effect3;
+}
+function cleanup(effect3) {
+ const {deps} = effect3;
+ if (deps.length) {
+ for (let i = 0; i < deps.length; i++) {
+ deps[i].delete(effect3);
+ }
+ deps.length = 0;
+ }
+}
+var shouldTrack = true;
+var trackStack = [];
+function pauseTracking() {
+ trackStack.push(shouldTrack);
+ shouldTrack = false;
+}
+function enableTracking() {
+ trackStack.push(shouldTrack);
+ shouldTrack = true;
+}
+function resetTracking() {
+ const last = trackStack.pop();
+ shouldTrack = last === void 0 ? true : last;
+}
+function track(target, type, key) {
+ if (!shouldTrack || activeEffect === void 0) {
+ return;
+ }
+ let depsMap = targetMap.get(target);
+ if (!depsMap) {
+ targetMap.set(target, depsMap = new Map());
+ }
+ let dep = depsMap.get(key);
+ if (!dep) {
+ depsMap.set(key, dep = new Set());
+ }
+ if (!dep.has(activeEffect)) {
+ dep.add(activeEffect);
+ activeEffect.deps.push(dep);
+ if (activeEffect.options.onTrack) {
+ activeEffect.options.onTrack({
+ effect: activeEffect,
+ target,
+ type,
+ key
+ });
+ }
+ }
+}
+function trigger(target, type, key, newValue, oldValue, oldTarget) {
+ const depsMap = targetMap.get(target);
+ if (!depsMap) {
+ return;
+ }
+ const effects = new Set();
+ const add2 = (effectsToAdd) => {
+ if (effectsToAdd) {
+ effectsToAdd.forEach((effect3) => {
+ if (effect3 !== activeEffect || effect3.allowRecurse) {
+ effects.add(effect3);
+ }
+ });
+ }
+ };
+ if (type === "clear") {
+ depsMap.forEach(add2);
+ } else if (key === "length" && isArray(target)) {
+ depsMap.forEach((dep, key2) => {
+ if (key2 === "length" || key2 >= newValue) {
+ add2(dep);
+ }
+ });
+ } else {
+ if (key !== void 0) {
+ add2(depsMap.get(key));
+ }
+ switch (type) {
+ case "add":
+ if (!isArray(target)) {
+ add2(depsMap.get(ITERATE_KEY));
+ if (isMap(target)) {
+ add2(depsMap.get(MAP_KEY_ITERATE_KEY));
+ }
+ } else if (isIntegerKey(key)) {
+ add2(depsMap.get("length"));
+ }
+ break;
+ case "delete":
+ if (!isArray(target)) {
+ add2(depsMap.get(ITERATE_KEY));
+ if (isMap(target)) {
+ add2(depsMap.get(MAP_KEY_ITERATE_KEY));
+ }
+ }
+ break;
+ case "set":
+ if (isMap(target)) {
+ add2(depsMap.get(ITERATE_KEY));
+ }
+ break;
+ }
+ }
+ const run = (effect3) => {
+ if (effect3.options.onTrigger) {
+ effect3.options.onTrigger({
+ effect: effect3,
+ target,
+ key,
+ type,
+ newValue,
+ oldValue,
+ oldTarget
+ });
+ }
+ if (effect3.options.scheduler) {
+ effect3.options.scheduler(effect3);
+ } else {
+ effect3();
+ }
+ };
+ effects.forEach(run);
+}
+var isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
+var builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol).map((key) => Symbol[key]).filter(isSymbol));
+var get2 = /* @__PURE__ */ createGetter();
+var shallowGet = /* @__PURE__ */ createGetter(false, true);
+var readonlyGet = /* @__PURE__ */ createGetter(true);
+var shallowReadonlyGet = /* @__PURE__ */ createGetter(true, true);
+var arrayInstrumentations = {};
+["includes", "indexOf", "lastIndexOf"].forEach((key) => {
+ const method = Array.prototype[key];
+ arrayInstrumentations[key] = function(...args) {
+ const arr = toRaw(this);
+ for (let i = 0, l = this.length; i < l; i++) {
+ track(arr, "get", i + "");
+ }
+ const res = method.apply(arr, args);
+ if (res === -1 || res === false) {
+ return method.apply(arr, args.map(toRaw));
+ } else {
+ return res;
+ }
+ };
+});
+["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
+ const method = Array.prototype[key];
+ arrayInstrumentations[key] = function(...args) {
+ pauseTracking();
+ const res = method.apply(this, args);
+ resetTracking();
+ return res;
+ };
+});
+function createGetter(isReadonly = false, shallow = false) {
+ return function get3(target, key, receiver) {
+ if (key === "__v_isReactive") {
+ return !isReadonly;
+ } else if (key === "__v_isReadonly") {
+ return isReadonly;
+ } else if (key === "__v_raw" && receiver === (isReadonly ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {
+ return target;
+ }
+ const targetIsArray = isArray(target);
+ if (!isReadonly && targetIsArray && hasOwn(arrayInstrumentations, key)) {
+ return Reflect.get(arrayInstrumentations, key, receiver);
+ }
+ const res = Reflect.get(target, key, receiver);
+ if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
+ return res;
+ }
+ if (!isReadonly) {
+ track(target, "get", key);
+ }
+ if (shallow) {
+ return res;
+ }
+ if (isRef(res)) {
+ const shouldUnwrap = !targetIsArray || !isIntegerKey(key);
+ return shouldUnwrap ? res.value : res;
+ }
+ if (isObject(res)) {
+ return isReadonly ? readonly(res) : reactive2(res);
+ }
+ return res;
+ };
+}
+var set2 = /* @__PURE__ */ createSetter();
+var shallowSet = /* @__PURE__ */ createSetter(true);
+function createSetter(shallow = false) {
+ return function set3(target, key, value, receiver) {
+ let oldValue = target[key];
+ if (!shallow) {
+ value = toRaw(value);
+ oldValue = toRaw(oldValue);
+ if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
+ oldValue.value = value;
+ return true;
+ }
+ }
+ const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
+ const result = Reflect.set(target, key, value, receiver);
+ if (target === toRaw(receiver)) {
+ if (!hadKey) {
+ trigger(target, "add", key, value);
+ } else if (hasChanged(value, oldValue)) {
+ trigger(target, "set", key, value, oldValue);
+ }
+ }
+ return result;
+ };
+}
+function deleteProperty(target, key) {
+ const hadKey = hasOwn(target, key);
+ const oldValue = target[key];
+ const result = Reflect.deleteProperty(target, key);
+ if (result && hadKey) {
+ trigger(target, "delete", key, void 0, oldValue);
+ }
+ return result;
+}
+function has(target, key) {
+ const result = Reflect.has(target, key);
+ if (!isSymbol(key) || !builtInSymbols.has(key)) {
+ track(target, "has", key);
+ }
+ return result;
+}
+function ownKeys(target) {
+ track(target, "iterate", isArray(target) ? "length" : ITERATE_KEY);
+ return Reflect.ownKeys(target);
+}
+var mutableHandlers = {
+ get: get2,
+ set: set2,
+ deleteProperty,
+ has,
+ ownKeys
+};
+var readonlyHandlers = {
+ get: readonlyGet,
+ set(target, key) {
+ if (true) {
+ console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
+ }
+ return true;
+ },
+ deleteProperty(target, key) {
+ if (true) {
+ console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
+ }
+ return true;
+ }
+};
+var shallowReactiveHandlers = extend({}, mutableHandlers, {
+ get: shallowGet,
+ set: shallowSet
+});
+var shallowReadonlyHandlers = extend({}, readonlyHandlers, {
+ get: shallowReadonlyGet
+});
+var toReactive = (value) => isObject(value) ? reactive2(value) : value;
+var toReadonly = (value) => isObject(value) ? readonly(value) : value;
+var toShallow = (value) => value;
+var getProto = (v) => Reflect.getPrototypeOf(v);
+function get$1(target, key, isReadonly = false, isShallow = false) {
+ target = target["__v_raw"];
+ const rawTarget = toRaw(target);
+ const rawKey = toRaw(key);
+ if (key !== rawKey) {
+ !isReadonly && track(rawTarget, "get", key);
+ }
+ !isReadonly && track(rawTarget, "get", rawKey);
+ const {has: has2} = getProto(rawTarget);
+ const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
+ if (has2.call(rawTarget, key)) {
+ return wrap(target.get(key));
+ } else if (has2.call(rawTarget, rawKey)) {
+ return wrap(target.get(rawKey));
+ } else if (target !== rawTarget) {
+ target.get(key);
+ }
+}
+function has$1(key, isReadonly = false) {
+ const target = this["__v_raw"];
+ const rawTarget = toRaw(target);
+ const rawKey = toRaw(key);
+ if (key !== rawKey) {
+ !isReadonly && track(rawTarget, "has", key);
+ }
+ !isReadonly && track(rawTarget, "has", rawKey);
+ return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
+}
+function size(target, isReadonly = false) {
+ target = target["__v_raw"];
+ !isReadonly && track(toRaw(target), "iterate", ITERATE_KEY);
+ return Reflect.get(target, "size", target);
+}
+function add(value) {
+ value = toRaw(value);
+ const target = toRaw(this);
+ const proto = getProto(target);
+ const hadKey = proto.has.call(target, value);
+ if (!hadKey) {
+ target.add(value);
+ trigger(target, "add", value, value);
+ }
+ return this;
+}
+function set$1(key, value) {
+ value = toRaw(value);
+ const target = toRaw(this);
+ const {has: has2, get: get3} = getProto(target);
+ let hadKey = has2.call(target, key);
+ if (!hadKey) {
+ key = toRaw(key);
+ hadKey = has2.call(target, key);
+ } else if (true) {
+ checkIdentityKeys(target, has2, key);
+ }
+ const oldValue = get3.call(target, key);
+ target.set(key, value);
+ if (!hadKey) {
+ trigger(target, "add", key, value);
+ } else if (hasChanged(value, oldValue)) {
+ trigger(target, "set", key, value, oldValue);
+ }
+ return this;
+}
+function deleteEntry(key) {
+ const target = toRaw(this);
+ const {has: has2, get: get3} = getProto(target);
+ let hadKey = has2.call(target, key);
+ if (!hadKey) {
+ key = toRaw(key);
+ hadKey = has2.call(target, key);
+ } else if (true) {
+ checkIdentityKeys(target, has2, key);
+ }
+ const oldValue = get3 ? get3.call(target, key) : void 0;
+ const result = target.delete(key);
+ if (hadKey) {
+ trigger(target, "delete", key, void 0, oldValue);
+ }
+ return result;
+}
+function clear() {
+ const target = toRaw(this);
+ const hadItems = target.size !== 0;
+ const oldTarget = true ? isMap(target) ? new Map(target) : new Set(target) : void 0;
+ const result = target.clear();
+ if (hadItems) {
+ trigger(target, "clear", void 0, void 0, oldTarget);
+ }
+ return result;
+}
+function createForEach(isReadonly, isShallow) {
+ return function forEach(callback, thisArg) {
+ const observed = this;
+ const target = observed["__v_raw"];
+ const rawTarget = toRaw(target);
+ const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
+ !isReadonly && track(rawTarget, "iterate", ITERATE_KEY);
+ return target.forEach((value, key) => {
+ return callback.call(thisArg, wrap(value), wrap(key), observed);
+ });
+ };
+}
+function createIterableMethod(method, isReadonly, isShallow) {
+ return function(...args) {
+ const target = this["__v_raw"];
+ const rawTarget = toRaw(target);
+ const targetIsMap = isMap(rawTarget);
+ const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
+ const isKeyOnly = method === "keys" && targetIsMap;
+ const innerIterator = target[method](...args);
+ const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
+ !isReadonly && track(rawTarget, "iterate", isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
+ return {
+ next() {
+ const {value, done} = innerIterator.next();
+ return done ? {value, done} : {
+ value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
+ done
+ };
+ },
+ [Symbol.iterator]() {
+ return this;
+ }
+ };
+ };
+}
+function createReadonlyMethod(type) {
+ return function(...args) {
+ if (true) {
+ const key = args[0] ? `on key "${args[0]}" ` : ``;
+ console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));
+ }
+ return type === "delete" ? false : this;
+ };
+}
+var mutableInstrumentations = {
+ get(key) {
+ return get$1(this, key);
+ },
+ get size() {
+ return size(this);
+ },
+ has: has$1,
+ add,
+ set: set$1,
+ delete: deleteEntry,
+ clear,
+ forEach: createForEach(false, false)
+};
+var shallowInstrumentations = {
+ get(key) {
+ return get$1(this, key, false, true);
+ },
+ get size() {
+ return size(this);
+ },
+ has: has$1,
+ add,
+ set: set$1,
+ delete: deleteEntry,
+ clear,
+ forEach: createForEach(false, true)
+};
+var readonlyInstrumentations = {
+ get(key) {
+ return get$1(this, key, true);
+ },
+ get size() {
+ return size(this, true);
+ },
+ has(key) {
+ return has$1.call(this, key, true);
+ },
+ add: createReadonlyMethod("add"),
+ set: createReadonlyMethod("set"),
+ delete: createReadonlyMethod("delete"),
+ clear: createReadonlyMethod("clear"),
+ forEach: createForEach(true, false)
+};
+var shallowReadonlyInstrumentations = {
+ get(key) {
+ return get$1(this, key, true, true);
+ },
+ get size() {
+ return size(this, true);
+ },
+ has(key) {
+ return has$1.call(this, key, true);
+ },
+ add: createReadonlyMethod("add"),
+ set: createReadonlyMethod("set"),
+ delete: createReadonlyMethod("delete"),
+ clear: createReadonlyMethod("clear"),
+ forEach: createForEach(true, true)
+};
+var iteratorMethods = ["keys", "values", "entries", Symbol.iterator];
+iteratorMethods.forEach((method) => {
+ mutableInstrumentations[method] = createIterableMethod(method, false, false);
+ readonlyInstrumentations[method] = createIterableMethod(method, true, false);
+ shallowInstrumentations[method] = createIterableMethod(method, false, true);
+ shallowReadonlyInstrumentations[method] = createIterableMethod(method, true, true);
+});
+function createInstrumentationGetter(isReadonly, shallow) {
+ const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;
+ return (target, key, receiver) => {
+ if (key === "__v_isReactive") {
+ return !isReadonly;
+ } else if (key === "__v_isReadonly") {
+ return isReadonly;
+ } else if (key === "__v_raw") {
+ return target;
+ }
+ return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
+ };
+}
+var mutableCollectionHandlers = {
+ get: createInstrumentationGetter(false, false)
+};
+var shallowCollectionHandlers = {
+ get: createInstrumentationGetter(false, true)
+};
+var readonlyCollectionHandlers = {
+ get: createInstrumentationGetter(true, false)
+};
+var shallowReadonlyCollectionHandlers = {
+ get: createInstrumentationGetter(true, true)
+};
+function checkIdentityKeys(target, has2, key) {
+ const rawKey = toRaw(key);
+ if (rawKey !== key && has2.call(target, rawKey)) {
+ const type = toRawType(target);
+ console.warn(`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`);
+ }
+}
+var reactiveMap = new WeakMap();
+var shallowReactiveMap = new WeakMap();
+var readonlyMap = new WeakMap();
+var shallowReadonlyMap = new WeakMap();
+function targetTypeMap(rawType) {
+ switch (rawType) {
+ case "Object":
+ case "Array":
+ return 1;
+ case "Map":
+ case "Set":
+ case "WeakMap":
+ case "WeakSet":
+ return 2;
+ default:
+ return 0;
+ }
+}
+function getTargetType(value) {
+ return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
+}
+function reactive2(target) {
+ if (target && target["__v_isReadonly"]) {
+ return target;
+ }
+ return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
+}
+function readonly(target) {
+ return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
+}
+function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers, proxyMap) {
+ if (!isObject(target)) {
+ if (true) {
+ console.warn(`value cannot be made reactive: ${String(target)}`);
+ }
+ return target;
+ }
+ if (target["__v_raw"] && !(isReadonly && target["__v_isReactive"])) {
+ return target;
+ }
+ const existingProxy = proxyMap.get(target);
+ if (existingProxy) {
+ return existingProxy;
+ }
+ const targetType = getTargetType(target);
+ if (targetType === 0) {
+ return target;
+ }
+ const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
+ proxyMap.set(target, proxy);
+ return proxy;
+}
+function toRaw(observed) {
+ return observed && toRaw(observed["__v_raw"]) || observed;
+}
+function isRef(r) {
+ return Boolean(r && r.__v_isRef === true);
+}
// packages/alpinejs/src/magics/$nextTick.js
magic("nextTick", () => nextTick);
@@ -2725,7 +2161,7 @@ magic("watch", (el, {evaluateLater: evaluateLater2, effect: effect3}) => (key, c
let evaluate2 = evaluateLater2(key);
let firstTime = true;
let oldValue;
- effect3(() => evaluate2((value) => {
+ let effectReference = effect3(() => evaluate2((value) => {
JSON.stringify(value);
if (!firstTime) {
queueMicrotask(() => {
@@ -2737,6 +2173,7 @@ magic("watch", (el, {evaluateLater: evaluateLater2, effect: effect3}) => (key, c
}
firstTime = false;
}));
+ el._x_effects.delete(effectReference);
});
// packages/alpinejs/src/magics/$store.js
@@ -2796,8 +2233,15 @@ magic("id", (el) => (name, key = null) => {
// packages/alpinejs/src/magics/$el.js
magic("el", (el) => el);
+// packages/alpinejs/src/magics/index.js
+warnMissingPluginMagic("Focus", "focus", "focus");
+warnMissingPluginMagic("Persist", "persist", "persist");
+function warnMissingPluginMagic(name, magicName, slug) {
+ magic(magicName, (el) => warn(`You can't use [$${directiveName}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el));
+}
+
// packages/alpinejs/src/directives/x-modelable.js
-directive("modelable", (el, {expression}, {effect: effect3, evaluate: evaluate2, evaluateLater: evaluateLater2}) => {
+directive("modelable", (el, {expression}, {effect: effect3, evaluateLater: evaluateLater2}) => {
let func = evaluateLater2(expression);
let innerGet = () => {
let result;
@@ -2808,12 +2252,11 @@ directive("modelable", (el, {expression}, {effect: effect3, evaluate: evaluate2,
let innerSet = (val) => evaluateInnerSet(() => {
}, {scope: {__placeholder: val}});
let initialValue = innerGet();
- if (el._x_modelable_hook)
- initialValue = el._x_modelable_hook(initialValue);
innerSet(initialValue);
queueMicrotask(() => {
if (!el._x_model)
return;
+ el._x_removeModelListeners["default"]();
let outerGet = el._x_model.get;
let outerSet = el._x_model.set;
effect3(() => innerSet(outerGet()));
@@ -2822,7 +2265,7 @@ directive("modelable", (el, {expression}, {effect: effect3, evaluate: evaluate2,
});
// packages/alpinejs/src/directives/x-teleport.js
-directive("teleport", (el, {expression}, {cleanup}) => {
+directive("teleport", (el, {expression}, {cleanup: cleanup2}) => {
if (el.tagName.toLowerCase() !== "template")
warn("x-teleport can only be used on a <template> tag", el);
let target = document.querySelector(expression);
@@ -2845,15 +2288,15 @@ directive("teleport", (el, {expression}, {cleanup}) => {
initTree(clone2);
clone2._x_ignore = true;
});
- cleanup(() => clone2.remove());
+ cleanup2(() => clone2.remove());
});
// packages/alpinejs/src/directives/x-ignore.js
var handler = () => {
};
-handler.inline = (el, {modifiers}, {cleanup}) => {
+handler.inline = (el, {modifiers}, {cleanup: cleanup2}) => {
modifiers.includes("self") ? el._x_ignoreSelf = true : el._x_ignore = true;
- cleanup(() => {
+ cleanup2(() => {
modifiers.includes("self") ? delete el._x_ignoreSelf : delete el._x_ignore;
});
};
@@ -2899,6 +2342,8 @@ function on(el, event, modifiers, callback) {
handler3 = wrapHandler(handler3, (next, e) => {
if (el.contains(e.target))
return;
+ if (e.target.isConnected === false)
+ return;
if (el.offsetWidth < 1 && el.offsetHeight < 1)
return;
if (el._x_isShown === false)
@@ -2906,6 +2351,12 @@ function on(el, event, modifiers, callback) {
next(e);
});
}
+ if (modifiers.includes("once")) {
+ handler3 = wrapHandler(handler3, (next, e) => {
+ next(e);
+ listenerTarget.removeEventListener(event, handler3, options);
+ });
+ }
handler3 = wrapHandler(handler3, (next, e) => {
if (isKeyEvent(event)) {
if (isListeningForASpecificKeyThatHasntBeenPressed(e, modifiers)) {
@@ -2924,12 +2375,6 @@ function on(el, event, modifiers, callback) {
let wait = isNumeric(nextModifier.split("ms")[0]) ? Number(nextModifier.split("ms")[0]) : 250;
handler3 = throttle(handler3, wait);
}
- if (modifiers.includes("once")) {
- handler3 = wrapHandler(handler3, (next, e) => {
- next(e);
- listenerTarget.removeEventListener(event, handler3, options);
- });
- }
listenerTarget.addEventListener(event, handler3, options);
return () => {
listenerTarget.removeEventListener(event, handler3, options);
@@ -3004,7 +2449,7 @@ function keyToModifiers(key) {
}
// packages/alpinejs/src/directives/x-model.js
-directive("model", (el, {modifiers, expression}, {effect: effect3, cleanup}) => {
+directive("model", (el, {modifiers, expression}, {effect: effect3, cleanup: cleanup2}) => {
let evaluate2 = evaluateLater(el, expression);
let assignmentExpression = `${expression} = rightSideOfExpression($event, ${expression})`;
let evaluateAssignment = evaluateLater(el, assignmentExpression);
@@ -3017,7 +2462,10 @@ directive("model", (el, {modifiers, expression}, {effect: effect3, cleanup}) =>
rightSideOfExpression: assigmentFunction
}});
});
- cleanup(() => removeListener());
+ if (!el._x_removeModelListeners)
+ el._x_removeModelListeners = {};
+ el._x_removeModelListeners["default"] = removeListener;
+ cleanup2(() => el._x_removeModelListeners["default"]());
let evaluateSetModel = evaluateLater(el, `${expression} = __placeholder`);
el._x_model = {
get() {
@@ -3117,7 +2565,12 @@ directive("html", (el, {expression}, {effect: effect3, evaluateLater: evaluateLa
let evaluate2 = evaluateLater2(expression);
effect3(() => {
evaluate2((value) => {
- el.innerHTML = value;
+ mutateDom(() => {
+ el.innerHTML = value;
+ el._x_ignoreSelf = true;
+ initTree(el);
+ delete el._x_ignoreSelf;
+ });
});
});
});
@@ -3168,7 +2621,7 @@ function storeKeyForXFor(el, expression) {
// packages/alpinejs/src/directives/x-data.js
addRootSelector(() => `[${prefix("data")}]`);
-directive("data", skipDuringClone((el, {expression}, {cleanup}) => {
+directive("data", skipDuringClone((el, {expression}, {cleanup: cleanup2}) => {
expression = expression === "" ? "{}" : expression;
let magicContext = {};
let cleanup1 = injectMagics(magicContext, el).cleanup;
@@ -3177,34 +2630,45 @@ directive("data", skipDuringClone((el, {expression}, {cleanup}) => {
let data2 = evaluate(el, expression, {scope: dataProviderContext});
if (data2 === void 0)
data2 = {};
- let cleanup2 = injectMagics(data2, el).cleanup;
+ let cleanup22 = injectMagics(data2, el).cleanup;
let reactiveData = reactive(data2);
initInterceptors(reactiveData);
let undo = addScopeToNode(el, reactiveData);
reactiveData["init"] && evaluate(el, reactiveData["init"]);
- cleanup(() => {
+ cleanup2(() => {
undo();
cleanup1();
- cleanup2();
+ cleanup22();
reactiveData["destroy"] && evaluate(el, reactiveData["destroy"]);
+ undo();
});
}));
// packages/alpinejs/src/directives/x-show.js
directive("show", (el, {modifiers, expression}, {effect: effect3}) => {
let evaluate2 = evaluateLater(el, expression);
- let hide = () => mutateDom(() => {
- el.style.display = "none";
+ if (!el._x_doHide)
+ el._x_doHide = () => {
+ mutateDom(() => el.style.display = "none");
+ };
+ if (!el._x_doShow)
+ el._x_doShow = () => {
+ mutateDom(() => {
+ if (el.style.length === 1 && el.style.display === "none") {
+ el.removeAttribute("style");
+ } else {
+ el.style.removeProperty("display");
+ }
+ });
+ };
+ let hide = () => {
+ el._x_doHide();
el._x_isShown = false;
- });
- let show = () => mutateDom(() => {
- if (el.style.length === 1 && el.style.display === "none") {
- el.removeAttribute("style");
- } else {
- el.style.removeProperty("display");
- }
+ };
+ let show = () => {
+ el._x_doShow();
el._x_isShown = true;
- });
+ };
let clickAwayCompatibleShow = () => setTimeout(show);
let toggle = once((value) => value ? show() : hide(), (value) => {
if (typeof el._x_toggleAndCascadeWithTransitions === "function") {
@@ -3227,21 +2691,21 @@ directive("show", (el, {modifiers, expression}, {effect: effect3}) => {
});
// packages/alpinejs/src/directives/x-for.js
-directive("for", (el, {expression}, {effect: effect3, cleanup}) => {
+directive("for", (el, {expression}, {effect: effect3, cleanup: cleanup2}) => {
let iteratorNames = parseForExpression(expression);
let evaluateItems = evaluateLater(el, iteratorNames.items);
let evaluateKey = evaluateLater(el, el._x_keyExpression || "index");
el._x_prevKeys = [];
el._x_lookup = {};
effect3(() => loop(el, iteratorNames, evaluateItems, evaluateKey));
- cleanup(() => {
+ cleanup2(() => {
Object.values(el._x_lookup).forEach((el2) => el2.remove());
delete el._x_prevKeys;
delete el._x_lookup;
});
});
function loop(el, iteratorNames, evaluateItems, evaluateKey) {
- let isObject = (i) => typeof i === "object" && !Array.isArray(i);
+ let isObject2 = (i) => typeof i === "object" && !Array.isArray(i);
let templateEl = el;
evaluateItems((items) => {
if (isNumeric3(items) && items >= 0) {
@@ -3253,7 +2717,7 @@ function loop(el, iteratorNames, evaluateItems, evaluateKey) {
let prevKeys = el._x_prevKeys;
let scopes = [];
let keys = [];
- if (isObject(items)) {
+ if (isObject2(items)) {
items = Object.entries(items).map(([key, value]) => {
let scope2 = getIterationScopeVariables(iteratorNames, value, key, items);
evaluateKey((value2) => keys.push(value2), {scope: {index: key, ...scope2}});
@@ -3392,17 +2856,17 @@ function isNumeric3(subject) {
// packages/alpinejs/src/directives/x-ref.js
function handler2() {
}
-handler2.inline = (el, {expression}, {cleanup}) => {
+handler2.inline = (el, {expression}, {cleanup: cleanup2}) => {
let root = closestRoot(el);
if (!root._x_refs)
root._x_refs = {};
root._x_refs[expression] = el;
- cleanup(() => delete root._x_refs[expression]);
+ cleanup2(() => delete root._x_refs[expression]);
};
directive("ref", handler2);
// packages/alpinejs/src/directives/x-if.js
-directive("if", (el, {expression}, {effect: effect3, cleanup}) => {
+directive("if", (el, {expression}, {effect: effect3, cleanup: cleanup2}) => {
let evaluate2 = evaluateLater(el, expression);
let show = () => {
if (el._x_currentIfEl)
@@ -3434,7 +2898,7 @@ directive("if", (el, {expression}, {effect: effect3, cleanup}) => {
effect3(() => evaluate2((value) => {
value ? show() : hide();
}));
- cleanup(() => el._x_undoIf && el._x_undoIf());
+ cleanup2(() => el._x_undoIf && el._x_undoIf());
});
// packages/alpinejs/src/directives/x-id.js
@@ -3445,7 +2909,7 @@ directive("id", (el, {expression}, {evaluate: evaluate2}) => {
// packages/alpinejs/src/directives/x-on.js
mapAttributes(startingWith("@", into(prefix("on:"))));
-directive("on", skipDuringClone((el, {value, modifiers, expression}, {cleanup}) => {
+directive("on", skipDuringClone((el, {value, modifiers, expression}, {cleanup: cleanup2}) => {
let evaluate2 = expression ? evaluateLater(el, expression) : () => {
};
if (el.tagName.toLowerCase() === "template") {
@@ -3458,12 +2922,21 @@ directive("on", skipDuringClone((el, {value, modifiers, expression}, {cleanup})
evaluate2(() => {
}, {scope: {$event: e}, params: [e]});
});
- cleanup(() => removeListener());
+ cleanup2(() => removeListener());
}));
+// packages/alpinejs/src/directives/index.js
+warnMissingPluginDirective("Collapse", "collapse", "collapse");
+warnMissingPluginDirective("Intersect", "intersect", "intersect");
+warnMissingPluginDirective("Focus", "trap", "focus");
+warnMissingPluginDirective("Mask", "mask", "mask");
+function warnMissingPluginDirective(name, directiveName2, slug) {
+ directive(directiveName2, (el) => warn(`You can't use [x-${directiveName2}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el));
+}
+
// packages/csp/src/index.js
alpine_default.setEvaluator(cspCompliantEvaluator);
-alpine_default.setReactivityEngine({reactive: import_reactivity8.reactive, effect: import_reactivity8.effect, release: import_reactivity8.stop, raw: import_reactivity8.toRaw});
+alpine_default.setReactivityEngine({reactive: reactive2, effect: effect2, release: stop, raw: toRaw});
function cspCompliantEvaluator(el, expression) {
let overriddenMagics = {};
injectMagics(overriddenMagics, el);
diff --git a/alpinejs/packages/docs/package.json b/alpinejs/packages/docs/package.json
index e888873..61fbce5 100644
--- a/alpinejs/packages/docs/package.json
+++ b/alpinejs/packages/docs/package.json
@@ -1,6 +1,6 @@
{
"name": "@alpinejs/docs",
- "version": "3.9.1-revision.1",
+ "version": "3.10.2-revision.1",
"description": "The documentation for Alpine",
"author": "Caleb Porzio",
"license": "MIT"
diff --git a/alpinejs/packages/docs/src/en/directives/bind.md b/alpinejs/packages/docs/src/en/directives/bind.md
index 65074eb..357e025 100644
--- a/alpinejs/packages/docs/src/en/directives/bind.md
+++ b/alpinejs/packages/docs/src/en/directives/bind.md
@@ -159,7 +159,7 @@ And like most expressions in Alpine, you can always use the result of a JavaScri
`x-bind` allows you to bind an object of different directives and attributes to an element.
-The object keys can be anything you would normally write as an attribute name in Alpine. This includes Alpine directives and modifiers, but also plain HTML attributes. The object values are either plain strings, or in the case of dynamic Alpine directoves, callbacks to be evaluated by Alpine.
+The object keys can be anything you would normally write as an attribute name in Alpine. This includes Alpine directives and modifiers, but also plain HTML attributes. The object values are either plain strings, or in the case of dynamic Alpine directives, callbacks to be evaluated by Alpine.
```alpine
<div x-data="dropdown()">
@@ -174,6 +174,7 @@ The object keys can be anything you would normally write as an attribute name in
open: false,
trigger: {
+ ['x-ref']: 'trigger',
['@click']() {
this.open = true
},
diff --git a/alpinejs/packages/docs/src/en/directives/for.md b/alpinejs/packages/docs/src/en/directives/for.md
index 7526af1..31c4232 100644
--- a/alpinejs/packages/docs/src/en/directives/for.md
+++ b/alpinejs/packages/docs/src/en/directives/for.md
@@ -33,7 +33,7 @@ There are two rules worth noting about `x-for`:
<a name="keys"></a>
## Keys
-It is important to specify keys for each `x-for` iteration if you are going to be re-ordering items. Without dynamic keys, Alpine may have a hard time keeping track of what re-orders and will cause odd side-effects.
+It is important to specify unique keys for each `x-for` iteration if you are going to be re-ordering items. Without dynamic keys, Alpine may have a hard time keeping track of what re-orders and will cause odd side-effects.
```alpine
<ul x-data="{ colors: [
diff --git a/alpinejs/packages/docs/src/en/directives/model.md b/alpinejs/packages/docs/src/en/directives/model.md
index 8e9831b..8b11def 100644
--- a/alpinejs/packages/docs/src/en/directives/model.md
+++ b/alpinejs/packages/docs/src/en/directives/model.md
@@ -288,7 +288,7 @@ Color: <span x-text="color"></span>
<a name="lazy"></a>
### `.lazy`
-On text inputs, by default, `x-model` updates the property on every key-stroke. By adding the `.lazy` modifier, you can force an `x-model` input to only update the property when user focuses away from the input element.
+On text inputs, by default, `x-model` updates the property on every keystroke. By adding the `.lazy` modifier, you can force an `x-model` input to only update the property when user focuses away from the input element.
This is handy for things like real-time form-validation where you might not want to show an input validation error until the user "tabs" away from a field.
diff --git a/alpinejs/packages/docs/src/en/directives/modelable.md b/alpinejs/packages/docs/src/en/directives/modelable.md
index 83eb789..01c38d6 100644
--- a/alpinejs/packages/docs/src/en/directives/modelable.md
+++ b/alpinejs/packages/docs/src/en/directives/modelable.md
@@ -5,9 +5,7 @@ title: modelable
# x-modelable
-`x-modelable` allows you to expose any value by name as the target of the `x-model` directive.
-
-Typically this feature would be used in conjunction with a backend templating framework like Laravel Blade. It's useful for abstracting away Alpine components into backend templates and exposing state to the outside through `x-model` as if it were a native input.
+`x-modelable` allows you to expose any Alpine property as the target of the `x-model` directive.
Here's a simple example of using `x-modelable` to expose a variable for binding with `x-model`.
@@ -17,7 +15,7 @@ Here's a simple example of using `x-modelable` to expose a variable for binding
<button @click="count++">Increment</button>
</div>
- Some Number: <span x-text="number"></span>
+ Number: <span x-text="number"></span>
</div>
```
@@ -35,3 +33,4 @@ Here's a simple example of using `x-modelable` to expose a variable for binding
As you can see the outer scope property "number" is now bound to the inner scope property "count".
+Typically this feature would be used in conjunction with a backend templating framework like Laravel Blade. It's useful for abstracting away Alpine components into backend templates and exposing state to the outside through `x-model` as if it were a native input.
diff --git a/alpinejs/packages/docs/src/en/directives/on.md b/alpinejs/packages/docs/src/en/directives/on.md
index 271c874..3745a56 100644
--- a/alpinejs/packages/docs/src/en/directives/on.md
+++ b/alpinejs/packages/docs/src/en/directives/on.md
@@ -13,7 +13,7 @@ Here's an example of simple button that shows an alert when clicked.
<button x-on:click="alert('Hello World!')">Say Hi</button>
```
-> `x-on` can only listen for events with lower case names, as HTML attribtes are case-insensitive. Writing `x-on:CLICK` will listen for an event named `click`. If you need to listen for a custom event with a camelCase name, you can use the [`.camel` helper](#camel) to work around this limitation. Alternatively, you can use [`x-bind`](/directives/bind.md#bind-directives) to attach an `x-on` directive to an element in javascript code (where case will be preserved).
+> `x-on` can only listen for events with lower case names, as HTML attributes are case-insensitive. Writing `x-on:CLICK` will listen for an event named `click`. If you need to listen for a custom event with a camelCase name, you can use the [`.camel` helper](#camel) to work around this limitation. Alternatively, you can use [`x-bind`](/directives/bind.md#bind-directives) to attach an `x-on` directive to an element in javascript code (where case will be preserved).
<a name="shorthand-syntax"></a>
## Shorthand syntax
@@ -89,6 +89,7 @@ For easy reference, here is a list of common keys you may want to listen for.
| `.caps-lock` | Caps Lock |
| `.equal` | Equal, `=` |
| `.period` | Period, `.` |
+| `.slash` | Foward Slash, `/` |
<a name="custom-events"></a>
## Custom events
@@ -165,7 +166,7 @@ In the above example, clicking the button WON'T log the message. This is because
In the above example, after showing the dropdown contents by clicking the "Toggle" button, you can close the dropdown by clicking anywhere on the page outside the content.
-This is because `.outside` is listening for clicks that DONT originate from the element it's registered on.
+This is because `.outside` is listening for clicks that DON'T originate from the element it's registered on.
> It's worth noting that the `.outside` expression will only be evaluated when the element it's registered on is visible on the page. Otherwise, there would be nasty race conditions where clicking the "Toggle" button would also fire the `@click.outside` handler when it is not visible.
diff --git a/alpinejs/packages/docs/src/en/directives/teleport.md b/alpinejs/packages/docs/src/en/directives/teleport.md
index 8b782ef..b550c7a 100644
--- a/alpinejs/packages/docs/src/en/directives/teleport.md
+++ b/alpinejs/packages/docs/src/en/directives/teleport.md
@@ -101,7 +101,7 @@ To make this experience more seamless, you can "forward" events by simply regist
Notice how we are now able to listen for events dispatched from within the teleported element from outside the `<template>` element itself?
-Alpine does this by looking for event listeners registered on `<template x-teleport...>` and stops those events from propogating past the live, teleported, DOM element. Then, it creates a copy of that event and re-dispatches it from `<template x-teleport...>`.
+Alpine does this by looking for event listeners registered on `<template x-teleport...>` and stops those events from propagating past the live, teleported, DOM element. Then, it creates a copy of that event and re-dispatches it from `<template x-teleport...>`.
<a name="nesting"></a>
## Nesting
diff --git a/alpinejs/packages/docs/src/en/directives/transition.md b/alpinejs/packages/docs/src/en/directives/transition.md
index 1cbceb6..1c2dcfb 100644
--- a/alpinejs/packages/docs/src/en/directives/transition.md
+++ b/alpinejs/packages/docs/src/en/directives/transition.md
@@ -46,15 +46,17 @@ You can override these defaults with modifiers attached to `x-transition`. Let's
<a name="customizing-duration"></a>
### Customizing duration
+Initially, the duration is set to be 150 milliseconds when entering, and 75 milliseconds when leaving.
+
You can configure the duration you want for a transition with the `.duration` modifier:
```alpine
<div ... x-transition.duration.500ms>
```
-The above `<div>` will transition for 500 milliseconds when entering, and 250 milliseconds when leaving.
+The above `<div>` will transition for 500 milliseconds when entering, and 500 milliseconds when leaving.
-This difference in duration generally desirable default. If you wish to customize the durations specifically for entering and leaving, you can do that like so:
+If you wish to customize the durations specifically for entering and leaving, you can do that like so:
```alpine
<div ...
diff --git a/alpinejs/packages/docs/src/en/essentials/installation.md b/alpinejs/packages/docs/src/en/essentials/installation.md
index 0b4ea49..bee805d 100644
--- a/alpinejs/packages/docs/src/en/essentials/installation.md
+++ b/alpinejs/packages/docs/src/en/essentials/installation.md
@@ -33,7 +33,7 @@ This is by far the simplest way to get started with Alpine. Include the followin
Notice the `@3.x.x` in the provided CDN link. This will pull the latest version of Alpine version 3. For stability in production, it's recommended that you hardcode the latest version in the CDN link.
```alpine
-<script defer src="https://unpkg.com/alpinejs@3.9.1/dist/cdn.min.js"></script>
+<script defer src="https://unpkg.com/alpinejs@3.10.2/dist/cdn.min.js"></script>
```
That's it! Alpine is now available for use inside your page.
diff --git a/alpinejs/packages/docs/src/en/essentials/state.md b/alpinejs/packages/docs/src/en/essentials/state.md
index fd1f39b..02935a0 100644
--- a/alpinejs/packages/docs/src/en/essentials/state.md
+++ b/alpinejs/packages/docs/src/en/essentials/state.md
@@ -54,7 +54,7 @@ Although this may seem obvious to some, it's worth mentioning that Alpine data c
<a name="data-less-alpine"></a>
### Data-less Alpine
-Sometimes you may want to use Alpine functionality, but don't need any reactive data. In these cases, you can opt-out of passing an expression to `x-data` entirely. For example:
+Sometimes you may want to use Alpine functionality, but don't need any reactive data. In these cases, you can opt out of passing an expression to `x-data` entirely. For example:
```alpine
<button x-data @click="alert('I\'ve been clicked!')">Click Me</button>
diff --git a/alpinejs/packages/docs/src/en/magics/id.md b/alpinejs/packages/docs/src/en/magics/id.md
index d0e2b8d..a1cb84b 100644
--- a/alpinejs/packages/docs/src/en/magics/id.md
+++ b/alpinejs/packages/docs/src/en/magics/id.md
@@ -34,7 +34,7 @@ Now let's say you want to have those same two input elements, but this time you
This presents a problem, you now need to be able to reference the same ID twice. One for the `<label>`'s `for` attribute, and the other for the `id` on the input.
-Here's is a way that you might think to accomplish this and is totally valid:
+Here is a way that you might think to accomplish this and is totally valid:
```alpine
<div x-data="{ id: $id('text-input') }">
diff --git a/alpinejs/packages/docs/src/en/magics/nextTick.md b/alpinejs/packages/docs/src/en/magics/nextTick.md
index 8b119f9..b6b276c 100644
--- a/alpinejs/packages/docs/src/en/magics/nextTick.md
+++ b/alpinejs/packages/docs/src/en/magics/nextTick.md
@@ -21,3 +21,22 @@ title: nextTick
```
In the above example, rather than logging "Hello" to the console, "Hello World!" will be logged because `$nextTick` was used to wait until Alpine was finished updating the DOM.
+
+<a name="promises"></a>
+
+## Promises
+
+`$nextTick` returns a promise, allowing the use of `$nextTick` to pause an async function until after pending dom updates. When used like this, `$nextTick` also does not require an argument to be passed.
+
+```alpine
+<div x-data="{ title: 'Hello' }">
+ <button
+ @click="
+ title = 'Hello World!';
+ await $nextTick();
+ console.log($el.innerText);
+ "
+ x-text="title"
+ ></button>
+</div>
+```
diff --git a/alpinejs/packages/docs/src/en/magics/store.md b/alpinejs/packages/docs/src/en/magics/store.md
index e18eb60..6610d29 100644
--- a/alpinejs/packages/docs/src/en/magics/store.md
+++ b/alpinejs/packages/docs/src/en/magics/store.md
@@ -6,7 +6,7 @@ title: store
# $store
-You can use `$store` to conveniently access global Alpine stores registered using [`Alpine.store(...)`](#). For example:
+You can use `$store` to conveniently access global Alpine stores registered using [`Alpine.store(...)`](/magics/store). For example:
```alpine
<button x-data @click="$store.darkMode.toggle()">Toggle Dark Mode</button>
diff --git a/alpinejs/packages/docs/src/en/plugins/collapse.md b/alpinejs/packages/docs/src/en/plugins/collapse.md
index 183f12f..7d6047f 100644
--- a/alpinejs/packages/docs/src/en/plugins/collapse.md
+++ b/alpinejs/packages/docs/src/en/plugins/collapse.md
@@ -107,3 +107,32 @@ You can customize the duration of the collapse/expand transition by appending th
</div>
</div>
<!-- END_VERBATIM -->
+
+<a name="dot-min"></a>
+### .min
+
+By default, `x-collapse`'s "collapsed" state sets the height of the element to `0px` and also sets `display: none;`.
+
+Sometimes, it's helpful to "cut-off" an element rather than fully hide it. By using the `.min` modifier, you can set a minimum height for `x-collapse`'s "collapsed" state. For example:
+
+```alpine
+<div x-data="{ expanded: false }">
+ <button @click="expanded = ! expanded">Toggle Content</button>
+
+ <p x-show="expanded" x-collapse.min.50px>
+ ...
+ </p>
+</div>
+```
+
+<!-- START_VERBATIM -->
+<div x-data="{ expanded: false }" class="demo">
+ <button @click="expanded = ! expanded">Toggle Content</button>
+
+ <div x-show="expanded" x-collapse.min.50px>
+ <div class="pt-4">
+ Reprehenderit eu excepteur ullamco esse cillum reprehenderit exercitation labore non. Dolore dolore ea dolore veniam sint in sint ex Lorem ipsum. Sint laborum deserunt deserunt amet voluptate cillum deserunt. Amet nisi pariatur sit ut id. Ipsum est minim est commodo id dolor sint id quis sint Lorem.
+ </div>
+ </div>
+</div>
+<!-- END_VERBATIM -->
diff --git a/alpinejs/packages/docs/src/en/plugins/focus.md b/alpinejs/packages/docs/src/en/plugins/focus.md
index 1ae3522..00ad767 100644
--- a/alpinejs/packages/docs/src/en/plugins/focus.md
+++ b/alpinejs/packages/docs/src/en/plugins/focus.md
@@ -187,7 +187,7 @@ Here is nesting in action:
<a name="inert"></a>
#### .inert
-When building things like dialogs/modals, it's recommended to hide all the other elements on the page from screenreaders when trapping focus.
+When building things like dialogs/modals, it's recommended to hide all the other elements on the page from screen readers when trapping focus.
By adding `.inert` to `x-trap`, when focus is trapped, all other elements on the page will receive `aria-hidden="true"` attributes, and when focus trapping is disabled, those attributes will also be removed.
@@ -218,7 +218,7 @@ By adding `.inert` to `x-trap`, when focus is trapped, all other elements on the
<a name="noscroll"></a>
#### .noscroll
-When building dialogs/modals with Alpine, it's recommended that you disable scrollling for the surrounding content when the dialog is open.
+When building dialogs/modals with Alpine, it's recommended that you disable scrolling for the surrounding content when the dialog is open.
`x-trap` allows you to do this automatically with the `.noscroll` modifiers.
diff --git a/alpinejs/packages/docs/src/en/plugins/intersect.md b/alpinejs/packages/docs/src/en/plugins/intersect.md
index 1e82cb7..b1cb7d3 100644
--- a/alpinejs/packages/docs/src/en/plugins/intersect.md
+++ b/alpinejs/packages/docs/src/en/plugins/intersect.md
@@ -1,5 +1,5 @@
---
-order: 1
+order: 2
title: Intersect
description: An Alpine convenience wrapper for Intersection Observer that allows you to easily react when an element enters the viewport.
graph_image: https://alpinejs.dev/social_intersect.jpg
@@ -110,7 +110,7 @@ Sometimes it's useful to evaluate an expression only the first time an element e
<a name="half"></a>
### .half
-Evaluates the expression once the intersection threshold exceeds `0.5`.
+Evaluates the expression once the intersection threshold exceeds `0.5`.
Useful for elements where it's important to show at least part of the element.
@@ -121,7 +121,7 @@ Useful for elements where it's important to show at least part of the element.
<a name="full"></a>
### .full
-Evaluates the expression once the intersection threshold exceeds `0.99`.
+Evaluates the expression once the intersection threshold exceeds `0.99`.
Useful for elements where it's important to show the whole element.
@@ -129,6 +129,23 @@ Useful for elements where it's important to show the whole element.
<div x-intersect.full="shown = true">...</div> // when `0.99` of the element is in the viewport
```
+<a name="threshold"></a>
+### .threshold
+
+Allows you to control the `threshold` property of the underlying `IntersectionObserver`:
+
+This value should be in the range of "0-100". A value of "0" means: trigger an "intersection" if ANY part of the element enters the viewport (the default behavior). While a value of "100" means: don't trigger an "intersection" unless the entire element has entered the viewport.
+
+Any value in between is a percentage of those two extremes.
+
+For example if you want to trigger an intersection after half of the element has entered the page, you can use `.threshold.50`:
+
+```alpine
+<div x-intersect.threshold.50="shown = true">...</div> // when 50% of the element is in the viewport
+```
+
+If you wanted to trigger only when 5% of the element has entered the viewport, you could use: `.threshold.05`, and so on and so forth.
+
<a name="margin"></a>
### .margin
diff --git a/alpinejs/packages/docs/src/en/plugins/mask.md b/alpinejs/packages/docs/src/en/plugins/mask.md
new file mode 100644
index 0000000..60badfd
--- /dev/null
+++ b/alpinejs/packages/docs/src/en/plugins/mask.md
@@ -0,0 +1,157 @@
+---
+order: 1
+title: Mask
+description: Automatically format text fields as users type
+graph_image: https://alpinejs.dev/social_mask.jpg
+---
+
+# Mask Plugin
+
+Alpine's Mask plugin allows you to automatically format a text input field as a user types.
+
+This is useful for many different types of inputs: phone numbers, credit cards, dollar amounts, account numbers, dates, etc.
+
+<a name="installation"></a>
+## Installation
+
+<div x-data="{ expanded: false }">
+<div class=" relative">
+<div x-show="! expanded" class="absolute inset-0 flex justify-start items-end bg-gradient-to-t from-white to-[#ffffff66]"></div>
+<div x-show="expanded" x-collapse.min.80px class="markdown">
+
+You can use this plugin by either including it from a `<script>` tag or installing it via NPM:
+
+### Via CDN
+
+You can include the CDN build of this plugin as a `<script>` tag, just make sure to include it BEFORE Alpine's core JS file.
+
+```alpine
+<!-- Alpine Plugins -->
+<script defer src="https://unpkg.com/@alpinejs/mask@3.x.x/dist/cdn.min.js"></script>
+
+<!-- Alpine Core -->
+<script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
+```
+
+### Via NPM
+
+You can install Mask from NPM for use inside your bundle like so:
+
+```shell
+npm install @alpinejs/mask
+```
+
+Then initialize it from your bundle:
+
+```js
+import Alpine from 'alpinejs'
+import mask from '@alpinejs/mask'
+
+Alpine.plugin(mask)
+
+...
+```
+
+</div>
+</div>
+<button :aria-expanded="expanded" @click="expanded = ! expanded" class="text-aqua-600 font-medium underline">
+ <span x-text="expanded ? 'Hide' : 'Show more'">Show</span> <span x-text="expanded ? '↑' : '↓'">↓</span>
+</button>
+ </div>
+
+<a name="x-mask"></a>
+## x-mask
+
+The primary API for using this plugin is the `x-mask` directive.
+
+Let's start by looking at the following simple example of a date field:
+
+```alpine
+<input x-mask="99/99/9999" placeholder="MM/DD/YYYY">
+```
+
+<!-- START_VERBATIM -->
+<div class="demo">
+ <input x-data x-mask="99/99/9999" placeholder="MM/DD/YYYY">
+</div>
+<!-- END_VERBATIM -->
+
+Notice how the text you type into the input field must adhere to the format provided by `x-mask`. In addition to enforcing numeric characters, the forward slashes `/` are also automatically added if a user doesn't type them first.
+
+The following wildcard characters are supported in masks:
+
+| Wildcard | Description |
+| -------------------------- | --------------------------- |
+| `*` | Any character |
+| `a` | Only alpha characters (a-z, A-Z) |
+| `9` | Only numeric characters (0-9) |
+
+<a name="mask-functions"></a>
+## Dynamic Masks
+
+Sometimes simple mask literals (i.e. `(999) 999-9999`) are not sufficient. In these cases, `x-mask:dynamic` allows you to dynamically generate masks on the fly based on user input.
+
+Here's an example of a credit card input that needs to change it's mask based on if the number starts with the numbers "34" or "37" (which means it's an Amex card and therefore has a different format).
+
+```alpine
+<input x-mask:dynamic="
+ $input.startsWith('34') || $input.startsWith('37')
+ ? '9999 999999 99999' : '9999 9999 9999 9999'
+">
+```
+
+As you can see in the above example, every time a user types in the input, that value is passed to the expression as `$input`. Based on the `$input`, a different mask is utilized in the field.
+
+Try it for yourself by typing a number that starts with "34" and one that doesn't.
+
+<!-- START_VERBATIM -->
+<div class="demo">
+ <input x-data x-mask:dynamic="
+ $input.startsWith('34') || $input.startsWith('37')
+ ? '9999 999999 99999' : '9999 9999 9999 9999'
+ ">
+</div>
+<!-- END_VERBATIM -->
+
+`x-mask:dynamic` also accepts a function as a result of the expression and will automatically pass it the `$input` as the the first paramter. For example:
+
+```alpine
+<input x-mask:dynamic="creditCardMask">
+
+<script>
+function creditCardMask(input) {
+ return input.startsWith('34') || input.startsWith('37')
+ ? '9999 999999 99999'
+ : '9999 9999 9999 9999'
+}
+</script>
+```
+
+<a name="money-inputs"></a>
+## Money Inputs
+
+Because writing your own dynamic mask expression for money inputs is fairly complex, Alpine offers a prebuilt one and makes it available as `$money()`.
+
+Here is a fully functioning money input mask:
+
+```alpine
+<input x-mask:dynamic="$money($input)">
+```
+
+<!-- START_VERBATIM -->
+<div class="demo" x-data>
+ <input type="text" x-mask:dynamic="$money($input)" placeholder="0.00">
+</div>
+<!-- END_VERBATIM -->
+
+If you wish to swap the periods for commas and vice versa (as is required in certain currencies), you can do so using the second optional parameter:
+
+```alpine
+<input x-mask:dynamic="$money($input, ',')">
+```
+
+<!-- START_VERBATIM -->
+<div class="demo" x-data>
+ <input type="text" x-mask:dynamic="$money($input, ',')" placeholder="0,00">
+</div>
+<!-- END_VERBATIM -->
diff --git a/alpinejs/packages/docs/src/en/plugins/morph.md b/alpinejs/packages/docs/src/en/plugins/morph.md
index 030074b..3098ca8 100644
--- a/alpinejs/packages/docs/src/en/plugins/morph.md
+++ b/alpinejs/packages/docs/src/en/plugins/morph.md
@@ -137,7 +137,7 @@ Here's an example of using `Alpine.morph()` to update an Alpine component with n
The "Morph" plugin works by comparing two DOM trees, the live element, and the passed in HTML.
-Morph walks both trees simultaneusly and compares each node and its children. If it finds differences, it "patches" (changes) the current DOM tree to match the passed in HTML's tree.
+Morph walks both trees simultaneously and compares each node and its children. If it finds differences, it "patches" (changes) the current DOM tree to match the passed in HTML's tree.
While the default algorithm is very capable, there are cases where you may want to hook into its lifecycle and observe or change its behavior as it's happening.
@@ -249,4 +249,4 @@ By adding keys to each node, we can accomplish this like so:
Now that there are "keys" on the `<li>`s, Morph will match them in both trees and move them accordingly.
-You can configure what Morph considers a "key" with the `key:` configutation option. [More on that here](#lifecycle-hooks)
+You can configure what Morph considers a "key" with the `key:` configuration option. [More on that here](#lifecycle-hooks)
diff --git a/alpinejs/packages/docs/src/en/upgrade-guide.md b/alpinejs/packages/docs/src/en/upgrade-guide.md
index 011a594..fa634d5 100644
--- a/alpinejs/packages/docs/src/en/upgrade-guide.md
+++ b/alpinejs/packages/docs/src/en/upgrade-guide.md
@@ -299,7 +299,7 @@ In Alpine V2 for below code
</div>
```
-after clicking button all `$refs` were displayed. However in Alpine V3 it's possible to access only `$refs` for elements created statically, so only first ref will be returned as expected.
+after clicking button all `$refs` were displayed. However, in Alpine V3 it's possible to access only `$refs` for elements created statically, so only first ref will be returned as expected.
<a name="no-ie-11"></a>
diff --git a/alpinejs/packages/focus/dist/module.esm.js b/alpinejs/packages/focus/dist/module.esm.js
index 343b920..703348d 100644
--- a/alpinejs/packages/focus/dist/module.esm.js
+++ b/alpinejs/packages/focus/dist/module.esm.js
@@ -1,680 +1,628 @@
-var __create = Object.create;
-var __defProp = Object.defineProperty;
-var __getProtoOf = Object.getPrototypeOf;
-var __hasOwnProp = Object.prototype.hasOwnProperty;
-var __getOwnPropNames = Object.getOwnPropertyNames;
-var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
-var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
-var __commonJS = (callback, module) => () => {
- if (!module) {
- module = {exports: {}};
- callback(module.exports, module);
+// node_modules/tabbable/dist/index.esm.js
+/*!
+* tabbable 5.2.1
+* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
+*/
+var candidateSelectors = ["input", "select", "textarea", "a[href]", "button", "[tabindex]", "audio[controls]", "video[controls]", '[contenteditable]:not([contenteditable="false"])', "details>summary:first-of-type", "details"];
+var candidateSelector = /* @__PURE__ */ candidateSelectors.join(",");
+var matches = typeof Element === "undefined" ? function() {
+} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
+var getCandidates = function getCandidates2(el, includeContainer, filter) {
+ var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
+ if (includeContainer && matches.call(el, candidateSelector)) {
+ candidates.unshift(el);
}
- return module.exports;
+ candidates = candidates.filter(filter);
+ return candidates;
};
-var __exportStar = (target, module, desc) => {
- if (module && typeof module === "object" || typeof module === "function") {
- for (let key of __getOwnPropNames(module))
- if (!__hasOwnProp.call(target, key) && key !== "default")
- __defProp(target, key, {get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable});
+var isContentEditable = function isContentEditable2(node) {
+ return node.contentEditable === "true";
+};
+var getTabindex = function getTabindex2(node) {
+ var tabindexAttr = parseInt(node.getAttribute("tabindex"), 10);
+ if (!isNaN(tabindexAttr)) {
+ return tabindexAttr;
}
- return target;
+ if (isContentEditable(node)) {
+ return 0;
+ }
+ if ((node.nodeName === "AUDIO" || node.nodeName === "VIDEO" || node.nodeName === "DETAILS") && node.getAttribute("tabindex") === null) {
+ return 0;
+ }
+ return node.tabIndex;
};
-var __toModule = (module) => {
- return __exportStar(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? {get: () => module.default, enumerable: true} : {value: module, enumerable: true})), module);
+var sortOrderedTabbables = function sortOrderedTabbables2(a, b) {
+ return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
};
-
-// node_modules/tabbable/dist/index.js
-var require_dist = __commonJS((exports) => {
- /*!
- * tabbable 5.2.1
- * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
- */
- "use strict";
- Object.defineProperty(exports, "__esModule", {value: true});
- var candidateSelectors = ["input", "select", "textarea", "a[href]", "button", "[tabindex]", "audio[controls]", "video[controls]", '[contenteditable]:not([contenteditable="false"])', "details>summary:first-of-type", "details"];
- var candidateSelector = /* @__PURE__ */ candidateSelectors.join(",");
- var matches = typeof Element === "undefined" ? function() {
- } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
- var getCandidates = function getCandidates2(el, includeContainer, filter) {
- var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
- if (includeContainer && matches.call(el, candidateSelector)) {
- candidates.unshift(el);
- }
- candidates = candidates.filter(filter);
- return candidates;
- };
- var isContentEditable = function isContentEditable2(node) {
- return node.contentEditable === "true";
- };
- var getTabindex = function getTabindex2(node) {
- var tabindexAttr = parseInt(node.getAttribute("tabindex"), 10);
- if (!isNaN(tabindexAttr)) {
- return tabindexAttr;
+var isInput = function isInput2(node) {
+ return node.tagName === "INPUT";
+};
+var isHiddenInput = function isHiddenInput2(node) {
+ return isInput(node) && node.type === "hidden";
+};
+var isDetailsWithSummary = function isDetailsWithSummary2(node) {
+ var r = node.tagName === "DETAILS" && Array.prototype.slice.apply(node.children).some(function(child) {
+ return child.tagName === "SUMMARY";
+ });
+ return r;
+};
+var getCheckedRadio = function getCheckedRadio2(nodes, form) {
+ for (var i = 0; i < nodes.length; i++) {
+ if (nodes[i].checked && nodes[i].form === form) {
+ return nodes[i];
}
- if (isContentEditable(node)) {
- return 0;
+ }
+};
+var isTabbableRadio = function isTabbableRadio2(node) {
+ if (!node.name) {
+ return true;
+ }
+ var radioScope = node.form || node.ownerDocument;
+ var queryRadios = function queryRadios2(name) {
+ return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');
+ };
+ var radioSet;
+ if (typeof window !== "undefined" && typeof window.CSS !== "undefined" && typeof window.CSS.escape === "function") {
+ radioSet = queryRadios(window.CSS.escape(node.name));
+ } else {
+ try {
+ radioSet = queryRadios(node.name);
+ } catch (err) {
+ console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", err.message);
+ return false;
}
- if ((node.nodeName === "AUDIO" || node.nodeName === "VIDEO" || node.nodeName === "DETAILS") && node.getAttribute("tabindex") === null) {
- return 0;
+ }
+ var checked = getCheckedRadio(radioSet, node.form);
+ return !checked || checked === node;
+};
+var isRadio = function isRadio2(node) {
+ return isInput(node) && node.type === "radio";
+};
+var isNonTabbableRadio = function isNonTabbableRadio2(node) {
+ return isRadio(node) && !isTabbableRadio(node);
+};
+var isHidden = function isHidden2(node, displayCheck) {
+ if (getComputedStyle(node).visibility === "hidden") {
+ return true;
+ }
+ var isDirectSummary = matches.call(node, "details>summary:first-of-type");
+ var nodeUnderDetails = isDirectSummary ? node.parentElement : node;
+ if (matches.call(nodeUnderDetails, "details:not([open]) *")) {
+ return true;
+ }
+ if (!displayCheck || displayCheck === "full") {
+ while (node) {
+ if (getComputedStyle(node).display === "none") {
+ return true;
+ }
+ node = node.parentElement;
}
- return node.tabIndex;
- };
- var sortOrderedTabbables = function sortOrderedTabbables2(a, b) {
- return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
- };
- var isInput = function isInput2(node) {
- return node.tagName === "INPUT";
- };
- var isHiddenInput = function isHiddenInput2(node) {
- return isInput(node) && node.type === "hidden";
- };
- var isDetailsWithSummary = function isDetailsWithSummary2(node) {
- var r = node.tagName === "DETAILS" && Array.prototype.slice.apply(node.children).some(function(child) {
- return child.tagName === "SUMMARY";
- });
- return r;
- };
- var getCheckedRadio = function getCheckedRadio2(nodes, form) {
- for (var i = 0; i < nodes.length; i++) {
- if (nodes[i].checked && nodes[i].form === form) {
- return nodes[i];
+ } else if (displayCheck === "non-zero-area") {
+ var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height;
+ return width === 0 && height === 0;
+ }
+ return false;
+};
+var isDisabledFromFieldset = function isDisabledFromFieldset2(node) {
+ if (isInput(node) || node.tagName === "SELECT" || node.tagName === "TEXTAREA" || node.tagName === "BUTTON") {
+ var parentNode = node.parentElement;
+ while (parentNode) {
+ if (parentNode.tagName === "FIELDSET" && parentNode.disabled) {
+ for (var i = 0; i < parentNode.children.length; i++) {
+ var child = parentNode.children.item(i);
+ if (child.tagName === "LEGEND") {
+ if (child.contains(node)) {
+ return false;
+ }
+ return true;
+ }
+ }
+ return true;
}
+ parentNode = parentNode.parentElement;
}
- };
- var isTabbableRadio = function isTabbableRadio2(node) {
- if (!node.name) {
- return true;
+ }
+ return false;
+};
+var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable2(options, node) {
+ if (node.disabled || isHiddenInput(node) || isHidden(node, options.displayCheck) || isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
+ return false;
+ }
+ return true;
+};
+var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable2(options, node) {
+ if (!isNodeMatchingSelectorFocusable(options, node) || isNonTabbableRadio(node) || getTabindex(node) < 0) {
+ return false;
+ }
+ return true;
+};
+var tabbable = function tabbable2(el, options) {
+ options = options || {};
+ var regularTabbables = [];
+ var orderedTabbables = [];
+ var candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
+ candidates.forEach(function(candidate, i) {
+ var candidateTabindex = getTabindex(candidate);
+ if (candidateTabindex === 0) {
+ regularTabbables.push(candidate);
+ } else {
+ orderedTabbables.push({
+ documentOrder: i,
+ tabIndex: candidateTabindex,
+ node: candidate
+ });
}
- var radioScope = node.form || node.ownerDocument;
- var queryRadios = function queryRadios2(name) {
- return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');
- };
- var radioSet;
- if (typeof window !== "undefined" && typeof window.CSS !== "undefined" && typeof window.CSS.escape === "function") {
- radioSet = queryRadios(window.CSS.escape(node.name));
+ });
+ var tabbableNodes = orderedTabbables.sort(sortOrderedTabbables).map(function(a) {
+ return a.node;
+ }).concat(regularTabbables);
+ return tabbableNodes;
+};
+var focusable = function focusable2(el, options) {
+ options = options || {};
+ var candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));
+ return candidates;
+};
+var focusableCandidateSelector = /* @__PURE__ */ candidateSelectors.concat("iframe").join(",");
+var isFocusable = function isFocusable2(node, options) {
+ options = options || {};
+ if (!node) {
+ throw new Error("No node provided");
+ }
+ if (matches.call(node, focusableCandidateSelector) === false) {
+ return false;
+ }
+ return isNodeMatchingSelectorFocusable(options, node);
+};
+
+// node_modules/focus-trap/dist/focus-trap.esm.js
+/*!
+* focus-trap 6.6.1
+* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
+*/
+function ownKeys(object, enumerableOnly) {
+ var keys = Object.keys(object);
+ if (Object.getOwnPropertySymbols) {
+ var symbols = Object.getOwnPropertySymbols(object);
+ if (enumerableOnly) {
+ symbols = symbols.filter(function(sym) {
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
+ });
+ }
+ keys.push.apply(keys, symbols);
+ }
+ return keys;
+}
+function _objectSpread2(target) {
+ for (var i = 1; i < arguments.length; i++) {
+ var source = arguments[i] != null ? arguments[i] : {};
+ if (i % 2) {
+ ownKeys(Object(source), true).forEach(function(key) {
+ _defineProperty(target, key, source[key]);
+ });
+ } else if (Object.getOwnPropertyDescriptors) {
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
- try {
- radioSet = queryRadios(node.name);
- } catch (err) {
- console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", err.message);
- return false;
+ ownKeys(Object(source)).forEach(function(key) {
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
+ });
+ }
+ }
+ return target;
+}
+function _defineProperty(obj, key, value) {
+ if (key in obj) {
+ Object.defineProperty(obj, key, {
+ value,
+ enumerable: true,
+ configurable: true,
+ writable: true
+ });
+ } else {
+ obj[key] = value;
+ }
+ return obj;
+}
+var activeFocusTraps = function() {
+ var trapQueue = [];
+ return {
+ activateTrap: function activateTrap(trap) {
+ if (trapQueue.length > 0) {
+ var activeTrap = trapQueue[trapQueue.length - 1];
+ if (activeTrap !== trap) {
+ activeTrap.pause();
+ }
}
+ var trapIndex = trapQueue.indexOf(trap);
+ if (trapIndex === -1) {
+ trapQueue.push(trap);
+ } else {
+ trapQueue.splice(trapIndex, 1);
+ trapQueue.push(trap);
+ }
+ },
+ deactivateTrap: function deactivateTrap(trap) {
+ var trapIndex = trapQueue.indexOf(trap);
+ if (trapIndex !== -1) {
+ trapQueue.splice(trapIndex, 1);
+ }
+ if (trapQueue.length > 0) {
+ trapQueue[trapQueue.length - 1].unpause();
+ }
+ }
+ };
+}();
+var isSelectableInput = function isSelectableInput2(node) {
+ return node.tagName && node.tagName.toLowerCase() === "input" && typeof node.select === "function";
+};
+var isEscapeEvent = function isEscapeEvent2(e) {
+ return e.key === "Escape" || e.key === "Esc" || e.keyCode === 27;
+};
+var isTabEvent = function isTabEvent2(e) {
+ return e.key === "Tab" || e.keyCode === 9;
+};
+var delay = function delay2(fn) {
+ return setTimeout(fn, 0);
+};
+var findIndex = function findIndex2(arr, fn) {
+ var idx = -1;
+ arr.every(function(value, i) {
+ if (fn(value)) {
+ idx = i;
+ return false;
}
- var checked = getCheckedRadio(radioSet, node.form);
- return !checked || checked === node;
+ return true;
+ });
+ return idx;
+};
+var valueOrHandler = function valueOrHandler2(value) {
+ for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ params[_key - 1] = arguments[_key];
+ }
+ return typeof value === "function" ? value.apply(void 0, params) : value;
+};
+var createFocusTrap = function createFocusTrap2(elements, userOptions) {
+ var doc = document;
+ var config = _objectSpread2({
+ returnFocusOnDeactivate: true,
+ escapeDeactivates: true,
+ delayInitialFocus: true
+ }, userOptions);
+ var state = {
+ containers: [],
+ tabbableGroups: [],
+ nodeFocusedBeforeActivation: null,
+ mostRecentlyFocusedNode: null,
+ active: false,
+ paused: false,
+ delayInitialFocusTimer: void 0
};
- var isRadio = function isRadio2(node) {
- return isInput(node) && node.type === "radio";
+ var trap;
+ var getOption = function getOption2(configOverrideOptions, optionName, configOptionName) {
+ return configOverrideOptions && configOverrideOptions[optionName] !== void 0 ? configOverrideOptions[optionName] : config[configOptionName || optionName];
};
- var isNonTabbableRadio = function isNonTabbableRadio2(node) {
- return isRadio(node) && !isTabbableRadio(node);
+ var containersContain = function containersContain2(element) {
+ return state.containers.some(function(container) {
+ return container.contains(element);
+ });
};
- var isHidden = function isHidden2(node, displayCheck) {
- if (getComputedStyle(node).visibility === "hidden") {
- return true;
- }
- var isDirectSummary = matches.call(node, "details>summary:first-of-type");
- var nodeUnderDetails = isDirectSummary ? node.parentElement : node;
- if (matches.call(nodeUnderDetails, "details:not([open]) *")) {
- return true;
- }
- if (!displayCheck || displayCheck === "full") {
- while (node) {
- if (getComputedStyle(node).display === "none") {
- return true;
- }
- node = node.parentElement;
+ var getNodeForOption = function getNodeForOption2(optionName) {
+ var optionValue = config[optionName];
+ if (!optionValue) {
+ return null;
+ }
+ var node = optionValue;
+ if (typeof optionValue === "string") {
+ node = doc.querySelector(optionValue);
+ if (!node) {
+ throw new Error("`".concat(optionName, "` refers to no known node"));
}
- } else if (displayCheck === "non-zero-area") {
- var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height;
- return width === 0 && height === 0;
}
- return false;
- };
- var isDisabledFromFieldset = function isDisabledFromFieldset2(node) {
- if (isInput(node) || node.tagName === "SELECT" || node.tagName === "TEXTAREA" || node.tagName === "BUTTON") {
- var parentNode = node.parentElement;
- while (parentNode) {
- if (parentNode.tagName === "FIELDSET" && parentNode.disabled) {
- for (var i = 0; i < parentNode.children.length; i++) {
- var child = parentNode.children.item(i);
- if (child.tagName === "LEGEND") {
- if (child.contains(node)) {
- return false;
- }
- return true;
- }
- }
- return true;
- }
- parentNode = parentNode.parentElement;
+ if (typeof optionValue === "function") {
+ node = optionValue();
+ if (!node) {
+ throw new Error("`".concat(optionName, "` did not return a node"));
}
}
- return false;
+ return node;
};
- var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable2(options, node) {
- if (node.disabled || isHiddenInput(node) || isHidden(node, options.displayCheck) || isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
+ var getInitialFocusNode = function getInitialFocusNode2() {
+ var node;
+ if (getOption({}, "initialFocus") === false) {
return false;
}
- return true;
- };
- var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable2(options, node) {
- if (!isNodeMatchingSelectorFocusable(options, node) || isNonTabbableRadio(node) || getTabindex(node) < 0) {
- return false;
+ if (getNodeForOption("initialFocus") !== null) {
+ node = getNodeForOption("initialFocus");
+ } else if (containersContain(doc.activeElement)) {
+ node = doc.activeElement;
+ } else {
+ var firstTabbableGroup = state.tabbableGroups[0];
+ var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode;
+ node = firstTabbableNode || getNodeForOption("fallbackFocus");
}
- return true;
+ if (!node) {
+ throw new Error("Your focus-trap needs to have at least one focusable element");
+ }
+ return node;
};
- var tabbable2 = function tabbable3(el, options) {
- options = options || {};
- var regularTabbables = [];
- var orderedTabbables = [];
- var candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
- candidates.forEach(function(candidate, i) {
- var candidateTabindex = getTabindex(candidate);
- if (candidateTabindex === 0) {
- regularTabbables.push(candidate);
- } else {
- orderedTabbables.push({
- documentOrder: i,
- tabIndex: candidateTabindex,
- node: candidate
- });
+ var updateTabbableNodes = function updateTabbableNodes2() {
+ state.tabbableGroups = state.containers.map(function(container) {
+ var tabbableNodes = tabbable(container);
+ if (tabbableNodes.length > 0) {
+ return {
+ container,
+ firstTabbableNode: tabbableNodes[0],
+ lastTabbableNode: tabbableNodes[tabbableNodes.length - 1]
+ };
}
+ return void 0;
+ }).filter(function(group) {
+ return !!group;
});
- var tabbableNodes = orderedTabbables.sort(sortOrderedTabbables).map(function(a) {
- return a.node;
- }).concat(regularTabbables);
- return tabbableNodes;
- };
- var focusable2 = function focusable3(el, options) {
- options = options || {};
- var candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));
- return candidates;
+ if (state.tabbableGroups.length <= 0 && !getNodeForOption("fallbackFocus")) {
+ throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");
+ }
};
- var isTabbable = function isTabbable2(node, options) {
- options = options || {};
- if (!node) {
- throw new Error("No node provided");
+ var tryFocus = function tryFocus2(node) {
+ if (node === false) {
+ return;
}
- if (matches.call(node, candidateSelector) === false) {
- return false;
+ if (node === doc.activeElement) {
+ return;
}
- return isNodeMatchingSelectorTabbable(options, node);
- };
- var focusableCandidateSelector = /* @__PURE__ */ candidateSelectors.concat("iframe").join(",");
- var isFocusable2 = function isFocusable3(node, options) {
- options = options || {};
- if (!node) {
- throw new Error("No node provided");
+ if (!node || !node.focus) {
+ tryFocus2(getInitialFocusNode());
+ return;
}
- if (matches.call(node, focusableCandidateSelector) === false) {
- return false;
+ node.focus({
+ preventScroll: !!config.preventScroll
+ });
+ state.mostRecentlyFocusedNode = node;
+ if (isSelectableInput(node)) {
+ node.select();
}
- return isNodeMatchingSelectorFocusable(options, node);
};
- exports.focusable = focusable2;
- exports.isFocusable = isFocusable2;
- exports.isTabbable = isTabbable;
- exports.tabbable = tabbable2;
-});
-
-// node_modules/focus-trap/dist/focus-trap.js
-var require_focus_trap = __commonJS((exports) => {
- /*!
- * focus-trap 6.6.1
- * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
- */
- "use strict";
- Object.defineProperty(exports, "__esModule", {value: true});
- var tabbable2 = require_dist();
- function ownKeys(object, enumerableOnly) {
- var keys = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- if (enumerableOnly) {
- symbols = symbols.filter(function(sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- });
- }
- keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpread2(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i] != null ? arguments[i] : {};
- if (i % 2) {
- ownKeys(Object(source), true).forEach(function(key) {
- _defineProperty(target, key, source[key]);
- });
- } else if (Object.getOwnPropertyDescriptors) {
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
- } else {
- ownKeys(Object(source)).forEach(function(key) {
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
- });
- }
+ var getReturnFocusNode = function getReturnFocusNode2(previousActiveElement) {
+ var node = getNodeForOption("setReturnFocus");
+ return node ? node : previousActiveElement;
+ };
+ var checkPointerDown = function checkPointerDown2(e) {
+ if (containersContain(e.target)) {
+ return;
}
- return target;
- }
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value,
- enumerable: true,
- configurable: true,
- writable: true
+ if (valueOrHandler(config.clickOutsideDeactivates, e)) {
+ trap.deactivate({
+ returnFocus: config.returnFocusOnDeactivate && !isFocusable(e.target)
});
+ return;
+ }
+ if (valueOrHandler(config.allowOutsideClick, e)) {
+ return;
+ }
+ e.preventDefault();
+ };
+ var checkFocusIn = function checkFocusIn2(e) {
+ var targetContained = containersContain(e.target);
+ if (targetContained || e.target instanceof Document) {
+ if (targetContained) {
+ state.mostRecentlyFocusedNode = e.target;
+ }
} else {
- obj[key] = value;
+ e.stopImmediatePropagation();
+ tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
}
- return obj;
- }
- var activeFocusTraps = function() {
- var trapQueue = [];
- return {
- activateTrap: function activateTrap(trap) {
- if (trapQueue.length > 0) {
- var activeTrap = trapQueue[trapQueue.length - 1];
- if (activeTrap !== trap) {
- activeTrap.pause();
- }
- }
- var trapIndex = trapQueue.indexOf(trap);
- if (trapIndex === -1) {
- trapQueue.push(trap);
+ };
+ var checkTab = function checkTab2(e) {
+ updateTabbableNodes();
+ var destinationNode = null;
+ if (state.tabbableGroups.length > 0) {
+ var containerIndex = findIndex(state.tabbableGroups, function(_ref) {
+ var container = _ref.container;
+ return container.contains(e.target);
+ });
+ if (containerIndex < 0) {
+ if (e.shiftKey) {
+ destinationNode = state.tabbableGroups[state.tabbableGroups.length - 1].lastTabbableNode;
} else {
- trapQueue.splice(trapIndex, 1);
- trapQueue.push(trap);
+ destinationNode = state.tabbableGroups[0].firstTabbableNode;
}
- },
- deactivateTrap: function deactivateTrap(trap) {
- var trapIndex = trapQueue.indexOf(trap);
- if (trapIndex !== -1) {
- trapQueue.splice(trapIndex, 1);
+ } else if (e.shiftKey) {
+ var startOfGroupIndex = findIndex(state.tabbableGroups, function(_ref2) {
+ var firstTabbableNode = _ref2.firstTabbableNode;
+ return e.target === firstTabbableNode;
+ });
+ if (startOfGroupIndex < 0 && state.tabbableGroups[containerIndex].container === e.target) {
+ startOfGroupIndex = containerIndex;
}
- if (trapQueue.length > 0) {
- trapQueue[trapQueue.length - 1].unpause();
+ if (startOfGroupIndex >= 0) {
+ var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
+ var destinationGroup = state.tabbableGroups[destinationGroupIndex];
+ destinationNode = destinationGroup.lastTabbableNode;
+ }
+ } else {
+ var lastOfGroupIndex = findIndex(state.tabbableGroups, function(_ref3) {
+ var lastTabbableNode = _ref3.lastTabbableNode;
+ return e.target === lastTabbableNode;
+ });
+ if (lastOfGroupIndex < 0 && state.tabbableGroups[containerIndex].container === e.target) {
+ lastOfGroupIndex = containerIndex;
+ }
+ if (lastOfGroupIndex >= 0) {
+ var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
+ var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
+ destinationNode = _destinationGroup.firstTabbableNode;
}
}
- };
- }();
- var isSelectableInput = function isSelectableInput2(node) {
- return node.tagName && node.tagName.toLowerCase() === "input" && typeof node.select === "function";
- };
- var isEscapeEvent = function isEscapeEvent2(e) {
- return e.key === "Escape" || e.key === "Esc" || e.keyCode === 27;
+ } else {
+ destinationNode = getNodeForOption("fallbackFocus");
+ }
+ if (destinationNode) {
+ e.preventDefault();
+ tryFocus(destinationNode);
+ }
};
- var isTabEvent = function isTabEvent2(e) {
- return e.key === "Tab" || e.keyCode === 9;
+ var checkKey = function checkKey2(e) {
+ if (isEscapeEvent(e) && valueOrHandler(config.escapeDeactivates) !== false) {
+ e.preventDefault();
+ trap.deactivate();
+ return;
+ }
+ if (isTabEvent(e)) {
+ checkTab(e);
+ return;
+ }
};
- var delay = function delay2(fn) {
- return setTimeout(fn, 0);
+ var checkClick = function checkClick2(e) {
+ if (valueOrHandler(config.clickOutsideDeactivates, e)) {
+ return;
+ }
+ if (containersContain(e.target)) {
+ return;
+ }
+ if (valueOrHandler(config.allowOutsideClick, e)) {
+ return;
+ }
+ e.preventDefault();
+ e.stopImmediatePropagation();
};
- var findIndex = function findIndex2(arr, fn) {
- var idx = -1;
- arr.every(function(value, i) {
- if (fn(value)) {
- idx = i;
- return false;
- }
- return true;
+ var addListeners = function addListeners2() {
+ if (!state.active) {
+ return;
+ }
+ activeFocusTraps.activateTrap(trap);
+ state.delayInitialFocusTimer = config.delayInitialFocus ? delay(function() {
+ tryFocus(getInitialFocusNode());
+ }) : tryFocus(getInitialFocusNode());
+ doc.addEventListener("focusin", checkFocusIn, true);
+ doc.addEventListener("mousedown", checkPointerDown, {
+ capture: true,
+ passive: false
});
- return idx;
+ doc.addEventListener("touchstart", checkPointerDown, {
+ capture: true,
+ passive: false
+ });
+ doc.addEventListener("click", checkClick, {
+ capture: true,
+ passive: false
+ });
+ doc.addEventListener("keydown", checkKey, {
+ capture: true,
+ passive: false
+ });
+ return trap;
};
- var valueOrHandler = function valueOrHandler2(value) {
- for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- params[_key - 1] = arguments[_key];
+ var removeListeners = function removeListeners2() {
+ if (!state.active) {
+ return;
}
- return typeof value === "function" ? value.apply(void 0, params) : value;
+ doc.removeEventListener("focusin", checkFocusIn, true);
+ doc.removeEventListener("mousedown", checkPointerDown, true);
+ doc.removeEventListener("touchstart", checkPointerDown, true);
+ doc.removeEventListener("click", checkClick, true);
+ doc.removeEventListener("keydown", checkKey, true);
+ return trap;
};
- var createFocusTrap2 = function createFocusTrap3(elements, userOptions) {
- var doc = document;
- var config = _objectSpread2({
- returnFocusOnDeactivate: true,
- escapeDeactivates: true,
- delayInitialFocus: true
- }, userOptions);
- var state = {
- containers: [],
- tabbableGroups: [],
- nodeFocusedBeforeActivation: null,
- mostRecentlyFocusedNode: null,
- active: false,
- paused: false,
- delayInitialFocusTimer: void 0
- };
- var trap;
- var getOption = function getOption2(configOverrideOptions, optionName, configOptionName) {
- return configOverrideOptions && configOverrideOptions[optionName] !== void 0 ? configOverrideOptions[optionName] : config[configOptionName || optionName];
- };
- var containersContain = function containersContain2(element) {
- return state.containers.some(function(container) {
- return container.contains(element);
- });
- };
- var getNodeForOption = function getNodeForOption2(optionName) {
- var optionValue = config[optionName];
- if (!optionValue) {
- return null;
- }
- var node = optionValue;
- if (typeof optionValue === "string") {
- node = doc.querySelector(optionValue);
- if (!node) {
- throw new Error("`".concat(optionName, "` refers to no known node"));
- }
- }
- if (typeof optionValue === "function") {
- node = optionValue();
- if (!node) {
- throw new Error("`".concat(optionName, "` did not return a node"));
- }
- }
- return node;
- };
- var getInitialFocusNode = function getInitialFocusNode2() {
- var node;
- if (getOption({}, "initialFocus") === false) {
- return false;
- }
- if (getNodeForOption("initialFocus") !== null) {
- node = getNodeForOption("initialFocus");
- } else if (containersContain(doc.activeElement)) {
- node = doc.activeElement;
- } else {
- var firstTabbableGroup = state.tabbableGroups[0];
- var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode;
- node = firstTabbableNode || getNodeForOption("fallbackFocus");
- }
- if (!node) {
- throw new Error("Your focus-trap needs to have at least one focusable element");
- }
- return node;
- };
- var updateTabbableNodes = function updateTabbableNodes2() {
- state.tabbableGroups = state.containers.map(function(container) {
- var tabbableNodes = tabbable2.tabbable(container);
- if (tabbableNodes.length > 0) {
- return {
- container,
- firstTabbableNode: tabbableNodes[0],
- lastTabbableNode: tabbableNodes[tabbableNodes.length - 1]
- };
- }
- return void 0;
- }).filter(function(group) {
- return !!group;
- });
- if (state.tabbableGroups.length <= 0 && !getNodeForOption("fallbackFocus")) {
- throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");
- }
- };
- var tryFocus = function tryFocus2(node) {
- if (node === false) {
- return;
- }
- if (node === doc.activeElement) {
- return;
- }
- if (!node || !node.focus) {
- tryFocus2(getInitialFocusNode());
- return;
- }
- node.focus({
- preventScroll: !!config.preventScroll
- });
- state.mostRecentlyFocusedNode = node;
- if (isSelectableInput(node)) {
- node.select();
- }
- };
- var getReturnFocusNode = function getReturnFocusNode2(previousActiveElement) {
- var node = getNodeForOption("setReturnFocus");
- return node ? node : previousActiveElement;
- };
- var checkPointerDown = function checkPointerDown2(e) {
- if (containersContain(e.target)) {
- return;
+ trap = {
+ activate: function activate(activateOptions) {
+ if (state.active) {
+ return this;
}
- if (valueOrHandler(config.clickOutsideDeactivates, e)) {
- trap.deactivate({
- returnFocus: config.returnFocusOnDeactivate && !tabbable2.isFocusable(e.target)
- });
- return;
+ var onActivate = getOption(activateOptions, "onActivate");
+ var onPostActivate = getOption(activateOptions, "onPostActivate");
+ var checkCanFocusTrap = getOption(activateOptions, "checkCanFocusTrap");
+ if (!checkCanFocusTrap) {
+ updateTabbableNodes();
}
- if (valueOrHandler(config.allowOutsideClick, e)) {
- return;
+ state.active = true;
+ state.paused = false;
+ state.nodeFocusedBeforeActivation = doc.activeElement;
+ if (onActivate) {
+ onActivate();
}
- e.preventDefault();
- };
- var checkFocusIn = function checkFocusIn2(e) {
- var targetContained = containersContain(e.target);
- if (targetContained || e.target instanceof Document) {
- if (targetContained) {
- state.mostRecentlyFocusedNode = e.target;
+ var finishActivation = function finishActivation2() {
+ if (checkCanFocusTrap) {
+ updateTabbableNodes();
}
- } else {
- e.stopImmediatePropagation();
- tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
- }
- };
- var checkTab = function checkTab2(e) {
- updateTabbableNodes();
- var destinationNode = null;
- if (state.tabbableGroups.length > 0) {
- var containerIndex = findIndex(state.tabbableGroups, function(_ref) {
- var container = _ref.container;
- return container.contains(e.target);
- });
- if (containerIndex < 0) {
- if (e.shiftKey) {
- destinationNode = state.tabbableGroups[state.tabbableGroups.length - 1].lastTabbableNode;
- } else {
- destinationNode = state.tabbableGroups[0].firstTabbableNode;
- }
- } else if (e.shiftKey) {
- var startOfGroupIndex = findIndex(state.tabbableGroups, function(_ref2) {
- var firstTabbableNode = _ref2.firstTabbableNode;
- return e.target === firstTabbableNode;
- });
- if (startOfGroupIndex < 0 && state.tabbableGroups[containerIndex].container === e.target) {
- startOfGroupIndex = containerIndex;
- }
- if (startOfGroupIndex >= 0) {
- var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
- var destinationGroup = state.tabbableGroups[destinationGroupIndex];
- destinationNode = destinationGroup.lastTabbableNode;
- }
- } else {
- var lastOfGroupIndex = findIndex(state.tabbableGroups, function(_ref3) {
- var lastTabbableNode = _ref3.lastTabbableNode;
- return e.target === lastTabbableNode;
- });
- if (lastOfGroupIndex < 0 && state.tabbableGroups[containerIndex].container === e.target) {
- lastOfGroupIndex = containerIndex;
- }
- if (lastOfGroupIndex >= 0) {
- var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
- var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
- destinationNode = _destinationGroup.firstTabbableNode;
- }
+ addListeners();
+ if (onPostActivate) {
+ onPostActivate();
}
- } else {
- destinationNode = getNodeForOption("fallbackFocus");
- }
- if (destinationNode) {
- e.preventDefault();
- tryFocus(destinationNode);
- }
- };
- var checkKey = function checkKey2(e) {
- if (isEscapeEvent(e) && valueOrHandler(config.escapeDeactivates) !== false) {
- e.preventDefault();
- trap.deactivate();
- return;
- }
- if (isTabEvent(e)) {
- checkTab(e);
- return;
- }
- };
- var checkClick = function checkClick2(e) {
- if (valueOrHandler(config.clickOutsideDeactivates, e)) {
- return;
- }
- if (containersContain(e.target)) {
- return;
- }
- if (valueOrHandler(config.allowOutsideClick, e)) {
- return;
+ };
+ if (checkCanFocusTrap) {
+ checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
+ return this;
}
- e.preventDefault();
- e.stopImmediatePropagation();
- };
- var addListeners = function addListeners2() {
+ finishActivation();
+ return this;
+ },
+ deactivate: function deactivate(deactivateOptions) {
if (!state.active) {
- return;
- }
- activeFocusTraps.activateTrap(trap);
- state.delayInitialFocusTimer = config.delayInitialFocus ? delay(function() {
- tryFocus(getInitialFocusNode());
- }) : tryFocus(getInitialFocusNode());
- doc.addEventListener("focusin", checkFocusIn, true);
- doc.addEventListener("mousedown", checkPointerDown, {
- capture: true,
- passive: false
- });
- doc.addEventListener("touchstart", checkPointerDown, {
- capture: true,
- passive: false
- });
- doc.addEventListener("click", checkClick, {
- capture: true,
- passive: false
- });
- doc.addEventListener("keydown", checkKey, {
- capture: true,
- passive: false
- });
- return trap;
- };
- var removeListeners = function removeListeners2() {
- if (!state.active) {
- return;
+ return this;
}
- doc.removeEventListener("focusin", checkFocusIn, true);
- doc.removeEventListener("mousedown", checkPointerDown, true);
- doc.removeEventListener("touchstart", checkPointerDown, true);
- doc.removeEventListener("click", checkClick, true);
- doc.removeEventListener("keydown", checkKey, true);
- return trap;
- };
- trap = {
- activate: function activate(activateOptions) {
- if (state.active) {
- return this;
- }
- var onActivate = getOption(activateOptions, "onActivate");
- var onPostActivate = getOption(activateOptions, "onPostActivate");
- var checkCanFocusTrap = getOption(activateOptions, "checkCanFocusTrap");
- if (!checkCanFocusTrap) {
- updateTabbableNodes();
- }
- state.active = true;
- state.paused = false;
- state.nodeFocusedBeforeActivation = doc.activeElement;
- if (onActivate) {
- onActivate();
- }
- var finishActivation = function finishActivation2() {
- if (checkCanFocusTrap) {
- updateTabbableNodes();
+ clearTimeout(state.delayInitialFocusTimer);
+ state.delayInitialFocusTimer = void 0;
+ removeListeners();
+ state.active = false;
+ state.paused = false;
+ activeFocusTraps.deactivateTrap(trap);
+ var onDeactivate = getOption(deactivateOptions, "onDeactivate");
+ var onPostDeactivate = getOption(deactivateOptions, "onPostDeactivate");
+ var checkCanReturnFocus = getOption(deactivateOptions, "checkCanReturnFocus");
+ if (onDeactivate) {
+ onDeactivate();
+ }
+ var returnFocus = getOption(deactivateOptions, "returnFocus", "returnFocusOnDeactivate");
+ var finishDeactivation = function finishDeactivation2() {
+ delay(function() {
+ if (returnFocus) {
+ tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
}
- addListeners();
- if (onPostActivate) {
- onPostActivate();
+ if (onPostDeactivate) {
+ onPostDeactivate();
}
- };
- if (checkCanFocusTrap) {
- checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
- return this;
- }
- finishActivation();
+ });
+ };
+ if (returnFocus && checkCanReturnFocus) {
+ checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation, finishDeactivation);
return this;
- },
- deactivate: function deactivate(deactivateOptions) {
- if (!state.active) {
- return this;
- }
- clearTimeout(state.delayInitialFocusTimer);
- state.delayInitialFocusTimer = void 0;
- removeListeners();
- state.active = false;
- state.paused = false;
- activeFocusTraps.deactivateTrap(trap);
- var onDeactivate = getOption(deactivateOptions, "onDeactivate");
- var onPostDeactivate = getOption(deactivateOptions, "onPostDeactivate");
- var checkCanReturnFocus = getOption(deactivateOptions, "checkCanReturnFocus");
- if (onDeactivate) {
- onDeactivate();
- }
- var returnFocus = getOption(deactivateOptions, "returnFocus", "returnFocusOnDeactivate");
- var finishDeactivation = function finishDeactivation2() {
- delay(function() {
- if (returnFocus) {
- tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
- }
- if (onPostDeactivate) {
- onPostDeactivate();
- }
- });
- };
- if (returnFocus && checkCanReturnFocus) {
- checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation, finishDeactivation);
- return this;
- }
- finishDeactivation();
+ }
+ finishDeactivation();
+ return this;
+ },
+ pause: function pause() {
+ if (state.paused || !state.active) {
return this;
- },
- pause: function pause() {
- if (state.paused || !state.active) {
- return this;
- }
- state.paused = true;
- removeListeners();
+ }
+ state.paused = true;
+ removeListeners();
+ return this;
+ },
+ unpause: function unpause() {
+ if (!state.paused || !state.active) {
return this;
- },
- unpause: function unpause() {
- if (!state.paused || !state.active) {
- return this;
- }
- state.paused = false;
+ }
+ state.paused = false;
+ updateTabbableNodes();
+ addListeners();
+ return this;
+ },
+ updateContainerElements: function updateContainerElements(containerElements) {
+ var elementsAsArray = [].concat(containerElements).filter(Boolean);
+ state.containers = elementsAsArray.map(function(element) {
+ return typeof element === "string" ? doc.querySelector(element) : element;
+ });
+ if (state.active) {
updateTabbableNodes();
- addListeners();
- return this;
- },
- updateContainerElements: function updateContainerElements(containerElements) {
- var elementsAsArray = [].concat(containerElements).filter(Boolean);
- state.containers = elementsAsArray.map(function(element) {
- return typeof element === "string" ? doc.querySelector(element) : element;
- });
- if (state.active) {
- updateTabbableNodes();
- }
- return this;
}
- };
- trap.updateContainerElements(elements);
- return trap;
+ return this;
+ }
};
- exports.createFocusTrap = createFocusTrap2;
-});
+ trap.updateContainerElements(elements);
+ return trap;
+};
// packages/focus/src/index.js
-var import_focus_trap = __toModule(require_focus_trap());
-var import_tabbable = __toModule(require_dist());
function src_default(Alpine) {
let lastFocused;
let currentFocused;
@@ -707,7 +655,7 @@ function src_default(Alpine) {
return this.withWrapAround();
},
focusable(el2) {
- return (0, import_tabbable.isFocusable)(el2);
+ return isFocusable(el2);
},
previouslyFocused() {
return lastFocused;
@@ -721,7 +669,7 @@ function src_default(Alpine) {
focusables() {
if (Array.isArray(within))
return within;
- return (0, import_tabbable.focusable)(within, {displayCheck: "none"});
+ return focusable(within, {displayCheck: "none"});
},
all() {
return this.focusables();
@@ -789,7 +737,7 @@ function src_default(Alpine) {
Alpine.directive("trap", Alpine.skipDuringClone((el, {expression, modifiers}, {effect, evaluateLater, cleanup}) => {
let evaluator = evaluateLater(expression);
let oldValue = false;
- let trap = (0, import_focus_trap.createFocusTrap)(el, {
+ let trap = createFocusTrap(el, {
escapeDeactivates: false,
allowOutsideClick: true,
fallbackFocus: () => el
diff --git a/alpinejs/packages/focus/package.json b/alpinejs/packages/focus/package.json
index 8ca4f91..048f617 100644
--- a/alpinejs/packages/focus/package.json
+++ b/alpinejs/packages/focus/package.json
@@ -1,6 +1,6 @@
{
"name": "@alpinejs/focus",
- "version": "3.9.1",
+ "version": "3.10.2",
"description": "Manage focus within a page",
"author": "Caleb Porzio",
"license": "MIT",
diff --git a/alpinejs/packages/intersect/dist/cdn.js b/alpinejs/packages/intersect/dist/cdn.js
index ed524d5..9257505 100644
--- a/alpinejs/packages/intersect/dist/cdn.js
+++ b/alpinejs/packages/intersect/dist/cdn.js
@@ -26,7 +26,14 @@
return 0.99;
if (modifiers.includes("half"))
return 0.5;
- return 0;
+ if (!modifiers.includes("threshold"))
+ return 0;
+ let threshold = modifiers[modifiers.indexOf("threshold") + 1];
+ if (threshold === "100")
+ return 1;
+ if (threshold === "0")
+ return 0;
+ return Number(`.${threshold}`);
}
function getLengthValue(rawValue) {
let match = rawValue.match(/^(-?[0-9]+)(px|%)?$/);
diff --git a/alpinejs/packages/intersect/dist/cdn.min.js b/alpinejs/packages/intersect/dist/cdn.min.js
index f8b0554..b049f57 100644
--- a/alpinejs/packages/intersect/dist/cdn.min.js
+++ b/alpinejs/packages/intersect/dist/cdn.min.js
@@ -1 +1 @@
-(()=>{function l(e){e.directive("intersect",(t,{value:i,expression:o,modifiers:n},{evaluateLater:r,cleanup:u})=>{let s=r(o),a={rootMargin:h(n),threshold:p(n)},c=new IntersectionObserver(d=>{d.forEach(f=>{f.isIntersecting!==(i==="leave")&&(s(),n.includes("once")&&c.disconnect())})},a);c.observe(t),u(()=>{c.disconnect()})})}function p(e){return e.includes("full")?.99:e.includes("half")?.5:0}function x(e){let t=e.match(/^(-?[0-9]+)(px|%)?$/);return t?t[1]+(t[2]||"px"):void 0}function h(e){let t="margin",i="0px 0px 0px 0px",o=e.indexOf(t);if(o===-1)return i;let n=[];for(let r=1;r<5;r++)n.push(x(e[o+r]||""));return n=n.filter(r=>r!==void 0),n.length?n.join(" ").trim():i}document.addEventListener("alpine:init",()=>{window.Alpine.plugin(l)});})();
+(()=>{function c(e){e.directive("intersect",(t,{value:i,expression:l,modifiers:n},{evaluateLater:r,cleanup:o})=>{let s=r(l),d={rootMargin:p(n),threshold:f(n)},u=new IntersectionObserver(h=>{h.forEach(a=>{a.isIntersecting!==(i==="leave")&&(s(),n.includes("once")&&u.disconnect())})},d);u.observe(t),o(()=>{u.disconnect()})})}function f(e){if(e.includes("full"))return .99;if(e.includes("half"))return .5;if(!e.includes("threshold"))return 0;let t=e[e.indexOf("threshold")+1];return t==="100"?1:t==="0"?0:Number(`.${t}`)}function x(e){let t=e.match(/^(-?[0-9]+)(px|%)?$/);return t?t[1]+(t[2]||"px"):void 0}function p(e){let t="margin",i="0px 0px 0px 0px",l=e.indexOf(t);if(l===-1)return i;let n=[];for(let r=1;r<5;r++)n.push(x(e[l+r]||""));return n=n.filter(r=>r!==void 0),n.length?n.join(" ").trim():i}document.addEventListener("alpine:init",()=>{window.Alpine.plugin(c)});})();
diff --git a/alpinejs/packages/intersect/dist/module.cjs.js b/alpinejs/packages/intersect/dist/module.cjs.js
index 737d082..71f5c47 100644
--- a/alpinejs/packages/intersect/dist/module.cjs.js
+++ b/alpinejs/packages/intersect/dist/module.cjs.js
@@ -38,7 +38,14 @@ function getThreshhold(modifiers) {
return 0.99;
if (modifiers.includes("half"))
return 0.5;
- return 0;
+ if (!modifiers.includes("threshold"))
+ return 0;
+ let threshold = modifiers[modifiers.indexOf("threshold") + 1];
+ if (threshold === "100")
+ return 1;
+ if (threshold === "0")
+ return 0;
+ return Number(`.${threshold}`);
}
function getLengthValue(rawValue) {
let match = rawValue.match(/^(-?[0-9]+)(px|%)?$/);
diff --git a/alpinejs/packages/intersect/dist/module.esm.js b/alpinejs/packages/intersect/dist/module.esm.js
index d89a47c..2ed0c3e 100644
--- a/alpinejs/packages/intersect/dist/module.esm.js
+++ b/alpinejs/packages/intersect/dist/module.esm.js
@@ -25,7 +25,14 @@ function getThreshhold(modifiers) {
return 0.99;
if (modifiers.includes("half"))
return 0.5;
- return 0;
+ if (!modifiers.includes("threshold"))
+ return 0;
+ let threshold = modifiers[modifiers.indexOf("threshold") + 1];
+ if (threshold === "100")
+ return 1;
+ if (threshold === "0")
+ return 0;
+ return Number(`.${threshold}`);
}
function getLengthValue(rawValue) {
let match = rawValue.match(/^(-?[0-9]+)(px|%)?$/);
diff --git a/alpinejs/packages/intersect/package.json b/alpinejs/packages/intersect/package.json
index 387a4fb..3f13925 100644
--- a/alpinejs/packages/intersect/package.json
+++ b/alpinejs/packages/intersect/package.json
@@ -1,6 +1,6 @@
{
"name": "@alpinejs/intersect",
- "version": "3.9.1",
+ "version": "3.10.2",
"description": "Trigger JavaScript when an element enters the viewport",
"author": "Caleb Porzio",
"license": "MIT",
diff --git a/alpinejs/packages/intersect/src/index.js b/alpinejs/packages/intersect/src/index.js
index bd9b57b..0880258 100644
--- a/alpinejs/packages/intersect/src/index.js
+++ b/alpinejs/packages/intersect/src/index.js
@@ -29,8 +29,14 @@ export default function (Alpine) {
function getThreshhold(modifiers) {
if (modifiers.includes('full')) return 0.99
if (modifiers.includes('half')) return 0.5
+ if (! modifiers.includes('threshold')) return 0
- return 0
+ let threshold = modifiers[modifiers.indexOf('threshold') + 1]
+
+ if (threshold === '100') return 1
+ if (threshold === '0') return 0
+
+ return Number(`.${threshold}`)
}
export function getLengthValue(rawValue) {
diff --git a/alpinejs/packages/mask/builds/cdn.js b/alpinejs/packages/mask/builds/cdn.js
new file mode 100644
index 0000000..7b9e1e5
--- /dev/null
+++ b/alpinejs/packages/mask/builds/cdn.js
@@ -0,0 +1,5 @@
+import mask from '../src/index.js'
+
+document.addEventListener('alpine:init', () => {
+ window.Alpine.plugin(mask)
+})
diff --git a/alpinejs/packages/mask/builds/module.js b/alpinejs/packages/mask/builds/module.js
new file mode 100644
index 0000000..c569048
--- /dev/null
+++ b/alpinejs/packages/mask/builds/module.js
@@ -0,0 +1,5 @@
+import maskPlugin, { stripDown } from '../src/index.js'
+
+export default maskPlugin
+
+export { stripDown }
diff --git a/alpinejs/packages/mask/dist/cdn.js b/alpinejs/packages/mask/dist/cdn.js
new file mode 100644
index 0000000..5994a27
--- /dev/null
+++ b/alpinejs/packages/mask/dist/cdn.js
@@ -0,0 +1,150 @@
+(() => {
+ // packages/mask/src/index.js
+ function src_default(Alpine) {
+ Alpine.directive("mask", (el, {value, expression}, {effect, evaluateLater}) => {
+ let templateFn = () => expression;
+ let lastInputValue = "";
+ if (["function", "dynamic"].includes(value)) {
+ let evaluator = evaluateLater(expression);
+ effect(() => {
+ templateFn = (input) => {
+ let result;
+ Alpine.dontAutoEvaluateFunctions(() => {
+ evaluator((value2) => {
+ result = typeof value2 === "function" ? value2(input) : value2;
+ }, {scope: {
+ $input: input,
+ $money: formatMoney.bind({el})
+ }});
+ });
+ return result;
+ };
+ processInputValue(el);
+ });
+ } else {
+ processInputValue(el);
+ }
+ el.addEventListener("input", () => processInputValue(el));
+ el.addEventListener("blur", () => processInputValue(el, false));
+ function processInputValue(el2, shouldRestoreCursor = true) {
+ let input = el2.value;
+ let template = templateFn(input);
+ if (lastInputValue.length - el2.value.length === 1) {
+ return lastInputValue = el2.value;
+ }
+ let setInput = () => {
+ lastInputValue = el2.value = formatInput(input, template);
+ };
+ if (shouldRestoreCursor) {
+ restoreCursorPosition(el2, template, () => {
+ setInput();
+ });
+ } else {
+ setInput();
+ }
+ }
+ function formatInput(input, template) {
+ if (input === "")
+ return "";
+ let strippedDownInput = stripDown(template, input);
+ let rebuiltInput = buildUp(template, strippedDownInput);
+ return rebuiltInput;
+ }
+ });
+ }
+ function restoreCursorPosition(el, template, callback) {
+ let cursorPosition = el.selectionStart;
+ let unformattedValue = el.value;
+ callback();
+ let beforeLeftOfCursorBeforeFormatting = unformattedValue.slice(0, cursorPosition);
+ let newPosition = buildUp(template, stripDown(template, beforeLeftOfCursorBeforeFormatting)).length;
+ el.setSelectionRange(newPosition, newPosition);
+ }
+ function stripDown(template, input) {
+ let inputToBeStripped = input;
+ let output = "";
+ let regexes = {
+ "9": /[0-9]/,
+ a: /[a-zA-Z]/,
+ "*": /[a-zA-Z0-9]/
+ };
+ let wildcardTemplate = "";
+ for (let i = 0; i < template.length; i++) {
+ if (["9", "a", "*"].includes(template[i])) {
+ wildcardTemplate += template[i];
+ continue;
+ }
+ for (let j = 0; j < inputToBeStripped.length; j++) {
+ if (inputToBeStripped[j] === template[i]) {
+ inputToBeStripped = inputToBeStripped.slice(0, j) + inputToBeStripped.slice(j + 1);
+ break;
+ }
+ }
+ }
+ for (let i = 0; i < wildcardTemplate.length; i++) {
+ let found = false;
+ for (let j = 0; j < inputToBeStripped.length; j++) {
+ if (regexes[wildcardTemplate[i]].test(inputToBeStripped[j])) {
+ output += inputToBeStripped[j];
+ inputToBeStripped = inputToBeStripped.slice(0, j) + inputToBeStripped.slice(j + 1);
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ break;
+ }
+ return output;
+ }
+ function buildUp(template, input) {
+ let clean = Array.from(input);
+ let output = "";
+ for (let i = 0; i < template.length; i++) {
+ if (!["9", "a", "*"].includes(template[i])) {
+ output += template[i];
+ continue;
+ }
+ if (clean.length === 0)
+ break;
+ output += clean.shift();
+ }
+ return output;
+ }
+ function formatMoney(input, delimeter = ".", thousands) {
+ thousands = delimeter === "," && thousands === void 0 ? "." : ",";
+ let addThousands = (input2, thousands2) => {
+ let output = "";
+ let counter = 0;
+ for (let i = input2.length - 1; i >= 0; i--) {
+ if (input2[i] === thousands2)
+ continue;
+ if (counter === 3) {
+ output = input2[i] + thousands2 + output;
+ counter = 0;
+ } else {
+ output = input2[i] + output;
+ }
+ counter++;
+ }
+ return output;
+ };
+ let nothousands = input.replaceAll(thousands, "");
+ let template = Array.from({length: nothousands.split(delimeter)[0].length}).fill("9").join("");
+ template = addThousands(template, thousands);
+ if (input.includes(delimeter))
+ template += `${delimeter}99`;
+ queueMicrotask(() => {
+ if (this.el.value.endsWith(delimeter))
+ return;
+ if (this.el.value[this.el.selectionStart - 1] === delimeter) {
+ this.el.setSelectionRange(this.el.selectionStart - 1, this.el.selectionStart - 1);
+ }
+ });
+ return template;
+ }
+
+ // packages/mask/builds/cdn.js
+ document.addEventListener("alpine:init", () => {
+ window.Alpine.plugin(src_default);
+ });
+})();
diff --git a/alpinejs/packages/mask/dist/cdn.min.js b/alpinejs/packages/mask/dist/cdn.min.js
new file mode 100644
index 0000000..8d8541a
--- /dev/null
+++ b/alpinejs/packages/mask/dist/cdn.min.js
@@ -0,0 +1 @@
+(()=>{function b(i){i.directive("mask",(e,{value:t,expression:u},{effect:s,evaluateLater:f})=>{let n=()=>u,o="";if(["function","dynamic"].includes(t)){let r=f(u);s(()=>{n=a=>{let c;return i.dontAutoEvaluateFunctions(()=>{r(d=>{c=typeof d=="function"?d(a):d},{scope:{$input:a,$money:I.bind({el:e})}})}),c},l(e)})}else l(e);e.addEventListener("input",()=>l(e)),e.addEventListener("blur",()=>l(e,!1));function l(r,a=!0){let c=r.value,d=n(c);if(o.length-r.value.length==1)return o=r.value;let h=()=>{o=r.value=p(c,d)};a?k(r,d,()=>{h()}):h()}function p(r,a){if(r==="")return"";let c=g(a,r);return v(a,c)}})}function k(i,e,t){let u=i.selectionStart,s=i.value;t();let f=s.slice(0,u),n=v(e,g(e,f)).length;i.setSelectionRange(n,n)}function g(i,e){let t=e,u="",s={"9":/[0-9]/,a:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},f="";for(let n=0;n<i.length;n++){if(["9","a","*"].includes(i[n])){f+=i[n];continue}for(let o=0;o<t.length;o++)if(t[o]===i[n]){t=t.slice(0,o)+t.slice(o+1);break}}for(let n=0;n<f.length;n++){let o=!1;for(let l=0;l<t.length;l++)if(s[f[n]].test(t[l])){u+=t[l],t=t.slice(0,l)+t.slice(l+1),o=!0;break}if(!o)break}return u}function v(i,e){let t=Array.from(e),u="";for(let s=0;s<i.length;s++){if(!["9","a","*"].includes(i[s])){u+=i[s];continue}if(t.length===0)break;u+=t.shift()}return u}function I(i,e=".",t){t=e===","&&t===void 0?".":",";let u=(n,o)=>{let l="",p=0;for(let r=n.length-1;r>=0;r--)n[r]!==o&&(p===3?(l=n[r]+o+l,p=0):l=n[r]+l,p++);return l},s=i.replaceAll(t,""),f=Array.from({length:s.split(e)[0].length}).fill("9").join("");return f=u(f,t),i.includes(e)&&(f+=`${e}99`),queueMicrotask(()=>{this.el.value.endsWith(e)||this.el.value[this.el.selectionStart-1]===e&&this.el.setSelectionRange(this.el.selectionStart-1,this.el.selectionStart-1)}),f}document.addEventListener("alpine:init",()=>{window.Alpine.plugin(b)});})();
diff --git a/alpinejs/packages/mask/dist/module.cjs.js b/alpinejs/packages/mask/dist/module.cjs.js
new file mode 100644
index 0000000..9b67020
--- /dev/null
+++ b/alpinejs/packages/mask/dist/module.cjs.js
@@ -0,0 +1,160 @@
+var __defProp = Object.defineProperty;
+var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
+var __export = (target, all) => {
+ for (var name in all)
+ __defProp(target, name, {get: all[name], enumerable: true});
+};
+
+// packages/mask/builds/module.js
+__markAsModule(exports);
+__export(exports, {
+ default: () => module_default,
+ stripDown: () => stripDown
+});
+
+// packages/mask/src/index.js
+function src_default(Alpine) {
+ Alpine.directive("mask", (el, {value, expression}, {effect, evaluateLater}) => {
+ let templateFn = () => expression;
+ let lastInputValue = "";
+ if (["function", "dynamic"].includes(value)) {
+ let evaluator = evaluateLater(expression);
+ effect(() => {
+ templateFn = (input) => {
+ let result;
+ Alpine.dontAutoEvaluateFunctions(() => {
+ evaluator((value2) => {
+ result = typeof value2 === "function" ? value2(input) : value2;
+ }, {scope: {
+ $input: input,
+ $money: formatMoney.bind({el})
+ }});
+ });
+ return result;
+ };
+ processInputValue(el);
+ });
+ } else {
+ processInputValue(el);
+ }
+ el.addEventListener("input", () => processInputValue(el));
+ el.addEventListener("blur", () => processInputValue(el, false));
+ function processInputValue(el2, shouldRestoreCursor = true) {
+ let input = el2.value;
+ let template = templateFn(input);
+ if (lastInputValue.length - el2.value.length === 1) {
+ return lastInputValue = el2.value;
+ }
+ let setInput = () => {
+ lastInputValue = el2.value = formatInput(input, template);
+ };
+ if (shouldRestoreCursor) {
+ restoreCursorPosition(el2, template, () => {
+ setInput();
+ });
+ } else {
+ setInput();
+ }
+ }
+ function formatInput(input, template) {
+ if (input === "")
+ return "";
+ let strippedDownInput = stripDown(template, input);
+ let rebuiltInput = buildUp(template, strippedDownInput);
+ return rebuiltInput;
+ }
+ });
+}
+function restoreCursorPosition(el, template, callback) {
+ let cursorPosition = el.selectionStart;
+ let unformattedValue = el.value;
+ callback();
+ let beforeLeftOfCursorBeforeFormatting = unformattedValue.slice(0, cursorPosition);
+ let newPosition = buildUp(template, stripDown(template, beforeLeftOfCursorBeforeFormatting)).length;
+ el.setSelectionRange(newPosition, newPosition);
+}
+function stripDown(template, input) {
+ let inputToBeStripped = input;
+ let output = "";
+ let regexes = {
+ "9": /[0-9]/,
+ a: /[a-zA-Z]/,
+ "*": /[a-zA-Z0-9]/
+ };
+ let wildcardTemplate = "";
+ for (let i = 0; i < template.length; i++) {
+ if (["9", "a", "*"].includes(template[i])) {
+ wildcardTemplate += template[i];
+ continue;
+ }
+ for (let j = 0; j < inputToBeStripped.length; j++) {
+ if (inputToBeStripped[j] === template[i]) {
+ inputToBeStripped = inputToBeStripped.slice(0, j) + inputToBeStripped.slice(j + 1);
+ break;
+ }
+ }
+ }
+ for (let i = 0; i < wildcardTemplate.length; i++) {
+ let found = false;
+ for (let j = 0; j < inputToBeStripped.length; j++) {
+ if (regexes[wildcardTemplate[i]].test(inputToBeStripped[j])) {
+ output += inputToBeStripped[j];
+ inputToBeStripped = inputToBeStripped.slice(0, j) + inputToBeStripped.slice(j + 1);
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ break;
+ }
+ return output;
+}
+function buildUp(template, input) {
+ let clean = Array.from(input);
+ let output = "";
+ for (let i = 0; i < template.length; i++) {
+ if (!["9", "a", "*"].includes(template[i])) {
+ output += template[i];
+ continue;
+ }
+ if (clean.length === 0)
+ break;
+ output += clean.shift();
+ }
+ return output;
+}
+function formatMoney(input, delimeter = ".", thousands) {
+ thousands = delimeter === "," && thousands === void 0 ? "." : ",";
+ let addThousands = (input2, thousands2) => {
+ let output = "";
+ let counter = 0;
+ for (let i = input2.length - 1; i >= 0; i--) {
+ if (input2[i] === thousands2)
+ continue;
+ if (counter === 3) {
+ output = input2[i] + thousands2 + output;
+ counter = 0;
+ } else {
+ output = input2[i] + output;
+ }
+ counter++;
+ }
+ return output;
+ };
+ let nothousands = input.replaceAll(thousands, "");
+ let template = Array.from({length: nothousands.split(delimeter)[0].length}).fill("9").join("");
+ template = addThousands(template, thousands);
+ if (input.includes(delimeter))
+ template += `${delimeter}99`;
+ queueMicrotask(() => {
+ if (this.el.value.endsWith(delimeter))
+ return;
+ if (this.el.value[this.el.selectionStart - 1] === delimeter) {
+ this.el.setSelectionRange(this.el.selectionStart - 1, this.el.selectionStart - 1);
+ }
+ });
+ return template;
+}
+
+// packages/mask/builds/module.js
+var module_default = src_default;
diff --git a/alpinejs/packages/mask/dist/module.esm.js b/alpinejs/packages/mask/dist/module.esm.js
new file mode 100644
index 0000000..95e2274
--- /dev/null
+++ b/alpinejs/packages/mask/dist/module.esm.js
@@ -0,0 +1,150 @@
+// packages/mask/src/index.js
+function src_default(Alpine) {
+ Alpine.directive("mask", (el, {value, expression}, {effect, evaluateLater}) => {
+ let templateFn = () => expression;
+ let lastInputValue = "";
+ if (["function", "dynamic"].includes(value)) {
+ let evaluator = evaluateLater(expression);
+ effect(() => {
+ templateFn = (input) => {
+ let result;
+ Alpine.dontAutoEvaluateFunctions(() => {
+ evaluator((value2) => {
+ result = typeof value2 === "function" ? value2(input) : value2;
+ }, {scope: {
+ $input: input,
+ $money: formatMoney.bind({el})
+ }});
+ });
+ return result;
+ };
+ processInputValue(el);
+ });
+ } else {
+ processInputValue(el);
+ }
+ el.addEventListener("input", () => processInputValue(el));
+ el.addEventListener("blur", () => processInputValue(el, false));
+ function processInputValue(el2, shouldRestoreCursor = true) {
+ let input = el2.value;
+ let template = templateFn(input);
+ if (lastInputValue.length - el2.value.length === 1) {
+ return lastInputValue = el2.value;
+ }
+ let setInput = () => {
+ lastInputValue = el2.value = formatInput(input, template);
+ };
+ if (shouldRestoreCursor) {
+ restoreCursorPosition(el2, template, () => {
+ setInput();
+ });
+ } else {
+ setInput();
+ }
+ }
+ function formatInput(input, template) {
+ if (input === "")
+ return "";
+ let strippedDownInput = stripDown(template, input);
+ let rebuiltInput = buildUp(template, strippedDownInput);
+ return rebuiltInput;
+ }
+ });
+}
+function restoreCursorPosition(el, template, callback) {
+ let cursorPosition = el.selectionStart;
+ let unformattedValue = el.value;
+ callback();
+ let beforeLeftOfCursorBeforeFormatting = unformattedValue.slice(0, cursorPosition);
+ let newPosition = buildUp(template, stripDown(template, beforeLeftOfCursorBeforeFormatting)).length;
+ el.setSelectionRange(newPosition, newPosition);
+}
+function stripDown(template, input) {
+ let inputToBeStripped = input;
+ let output = "";
+ let regexes = {
+ "9": /[0-9]/,
+ a: /[a-zA-Z]/,
+ "*": /[a-zA-Z0-9]/
+ };
+ let wildcardTemplate = "";
+ for (let i = 0; i < template.length; i++) {
+ if (["9", "a", "*"].includes(template[i])) {
+ wildcardTemplate += template[i];
+ continue;
+ }
+ for (let j = 0; j < inputToBeStripped.length; j++) {
+ if (inputToBeStripped[j] === template[i]) {
+ inputToBeStripped = inputToBeStripped.slice(0, j) + inputToBeStripped.slice(j + 1);
+ break;
+ }
+ }
+ }
+ for (let i = 0; i < wildcardTemplate.length; i++) {
+ let found = false;
+ for (let j = 0; j < inputToBeStripped.length; j++) {
+ if (regexes[wildcardTemplate[i]].test(inputToBeStripped[j])) {
+ output += inputToBeStripped[j];
+ inputToBeStripped = inputToBeStripped.slice(0, j) + inputToBeStripped.slice(j + 1);
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ break;
+ }
+ return output;
+}
+function buildUp(template, input) {
+ let clean = Array.from(input);
+ let output = "";
+ for (let i = 0; i < template.length; i++) {
+ if (!["9", "a", "*"].includes(template[i])) {
+ output += template[i];
+ continue;
+ }
+ if (clean.length === 0)
+ break;
+ output += clean.shift();
+ }
+ return output;
+}
+function formatMoney(input, delimeter = ".", thousands) {
+ thousands = delimeter === "," && thousands === void 0 ? "." : ",";
+ let addThousands = (input2, thousands2) => {
+ let output = "";
+ let counter = 0;
+ for (let i = input2.length - 1; i >= 0; i--) {
+ if (input2[i] === thousands2)
+ continue;
+ if (counter === 3) {
+ output = input2[i] + thousands2 + output;
+ counter = 0;
+ } else {
+ output = input2[i] + output;
+ }
+ counter++;
+ }
+ return output;
+ };
+ let nothousands = input.replaceAll(thousands, "");
+ let template = Array.from({length: nothousands.split(delimeter)[0].length}).fill("9").join("");
+ template = addThousands(template, thousands);
+ if (input.includes(delimeter))
+ template += `${delimeter}99`;
+ queueMicrotask(() => {
+ if (this.el.value.endsWith(delimeter))
+ return;
+ if (this.el.value[this.el.selectionStart - 1] === delimeter) {
+ this.el.setSelectionRange(this.el.selectionStart - 1, this.el.selectionStart - 1);
+ }
+ });
+ return template;
+}
+
+// packages/mask/builds/module.js
+var module_default = src_default;
+export {
+ module_default as default,
+ stripDown
+};
diff --git a/alpinejs/packages/mask/package.json b/alpinejs/packages/mask/package.json
new file mode 100644
index 0000000..9da2bbb
--- /dev/null
+++ b/alpinejs/packages/mask/package.json
@@ -0,0 +1,9 @@
+{
+ "name": "@alpinejs/mask",
+ "version": "3.10.2",
+ "description": "An Alpine plugin for input masking",
+ "author": "Caleb Porzio",
+ "license": "MIT",
+ "main": "dist/module.cjs.js",
+ "module": "dist/module.esm.js"
+}
diff --git a/alpinejs/packages/mask/src/index.js b/alpinejs/packages/mask/src/index.js
new file mode 100644
index 0000000..ec8c5e5
--- /dev/null
+++ b/alpinejs/packages/mask/src/index.js
@@ -0,0 +1,202 @@
+
+export default function (Alpine) {
+ Alpine.directive('mask', (el, { value, expression }, { effect, evaluateLater }) => {
+ let templateFn = () => expression
+ let lastInputValue = ''
+
+ if (['function', 'dynamic'].includes(value)) {
+ // This is an x-mask:function directive.
+
+ let evaluator = evaluateLater(expression)
+
+ effect(() => {
+ templateFn = input => {
+ let result
+
+ // We need to prevent "auto-evaluation" of functions like
+ // x-on expressions do so that we can use them as mask functions.
+ Alpine.dontAutoEvaluateFunctions(() => {
+ evaluator(value => {
+ result = typeof value === 'function' ? value(input) : value
+ }, { scope: {
+ // These are "magics" we'll make available to the x-mask:function:
+ '$input': input,
+ '$money': formatMoney.bind({ el }),
+ }})
+ })
+
+ return result
+ }
+
+ // Run on initialize which serves a dual purpose:
+ // - Initializing the mask on the input if it has an initial value.
+ // - Running the template function to set up reactivity, so that
+ // when a dependancy inside it changes, the input re-masks.
+ processInputValue(el)
+ })
+ } else {
+ processInputValue(el)
+ }
+
+ el.addEventListener('input', () => processInputValue(el))
+ // Don't "restoreCursorPosition" on "blur", because Safari
+ // will re-focus the input and cause a focus trap.
+ el.addEventListener('blur', () => processInputValue(el, false))
+
+ function processInputValue (el, shouldRestoreCursor = true) {
+ let input = el.value
+
+ let template = templateFn(input)
+
+ // If they hit backspace, don't process input.
+ if (lastInputValue.length - el.value.length === 1) {
+ return lastInputValue = el.value
+ }
+
+ let setInput = () => { lastInputValue = el.value = formatInput(input, template) }
+
+ if (shouldRestoreCursor) {
+ // When an input element's value is set, it moves the cursor to the end
+ // therefore we need to track, estimate, and restore the cursor after
+ // a change was made.
+ restoreCursorPosition(el, template, () => {
+ setInput()
+ })
+ } else {
+ setInput()
+ }
+ }
+
+ function formatInput(input, template) {
+ // Let empty inputs be empty inputs.
+ if (input === '') return ''
+
+ let strippedDownInput = stripDown(template, input)
+ let rebuiltInput = buildUp(template, strippedDownInput)
+
+ return rebuiltInput
+ }
+ })
+}
+
+export function restoreCursorPosition(el, template, callback) {
+ let cursorPosition = el.selectionStart
+ let unformattedValue = el.value
+
+ callback()
+
+ let beforeLeftOfCursorBeforeFormatting = unformattedValue.slice(0, cursorPosition)
+
+ let newPosition = buildUp(
+ template, stripDown(
+ template, beforeLeftOfCursorBeforeFormatting
+ )
+ ).length
+
+ el.setSelectionRange(newPosition, newPosition)
+}
+
+export function stripDown(template, input) {
+ let inputToBeStripped = input
+ let output = ''
+ let regexes = {
+ '9': /[0-9]/,
+ 'a': /[a-zA-Z]/,
+ '*': /[a-zA-Z0-9]/,
+ }
+
+ let wildcardTemplate = ''
+
+ // Strip away non wildcard template characters.
+ for (let i = 0; i < template.length; i++) {
+ if (['9', 'a', '*'].includes(template[i])) {
+ wildcardTemplate += template[i]
+ continue;
+ }
+
+ for (let j = 0; j < inputToBeStripped.length; j++) {
+ if (inputToBeStripped[j] === template[i]) {
+ inputToBeStripped = inputToBeStripped.slice(0, j) + inputToBeStripped.slice(j+1)
+
+ break;
+ }
+ }
+ }
+
+ for (let i = 0; i < wildcardTemplate.length; i++) {
+ let found = false
+
+ for (let j = 0; j < inputToBeStripped.length; j++) {
+ if (regexes[wildcardTemplate[i]].test(inputToBeStripped[j])) {
+ output += inputToBeStripped[j]
+ inputToBeStripped = inputToBeStripped.slice(0, j) + inputToBeStripped.slice(j+1)
+
+ found = true
+ break;
+ }
+ }
+
+ if (! found) break;
+ }
+
+ return output
+}
+
+export function buildUp(template, input) {
+ let clean = Array.from(input)
+ let output = ''
+
+ for (let i = 0; i < template.length; i++) {
+ if (! ['9', 'a', '*'].includes(template[i])) {
+ output += template[i]
+ continue;
+ }
+
+ if (clean.length === 0) break;
+
+ output += clean.shift()
+ }
+
+ return output
+}
+
+function formatMoney(input, delimeter = '.', thousands) {
+ thousands = (delimeter === ',' && thousands === undefined)
+ ? '.' : ','
+
+ let addThousands = (input, thousands) => {
+ let output = ''
+ let counter = 0
+
+ for (let i = input.length - 1; i >= 0; i--) {
+ if (input[i] === thousands) continue;
+
+ if (counter === 3) {
+ output = input[i] + thousands + output
+ counter = 0
+ } else {
+ output = input[i] + output
+ }
+ counter++
+ }
+
+ return output
+ }
+
+ let nothousands = input.replaceAll(thousands, '')
+ let template = Array.from({ length: nothousands.split(delimeter)[0].length }).fill('9').join('')
+
+ template = addThousands(template, thousands)
+
+ if (input.includes(delimeter)) template += `${delimeter}99`
+
+ queueMicrotask(() => {
+ if (this.el.value.endsWith(delimeter)) return
+
+ if (this.el.value[this.el.selectionStart - 1] === delimeter) {
+ this.el.setSelectionRange(this.el.selectionStart - 1, this.el.selectionStart - 1)
+ }
+ })
+
+ return template
+}
diff --git a/alpinejs/packages/morph/dist/cdn.js b/alpinejs/packages/morph/dist/cdn.js
index 947a47d..868db84 100644
--- a/alpinejs/packages/morph/dist/cdn.js
+++ b/alpinejs/packages/morph/dist/cdn.js
@@ -1,263 +1,5 @@
(() => {
- // packages/morph/src/morph.js
- var resolveStep = () => {
- };
- var logger = () => {
- };
- var fromEl;
- var toEl;
- function breakpoint(message) {
- if (!debug)
- return;
- logger((message || "").replace("\n", "\\n"), fromEl, toEl);
- return new Promise((resolve) => resolveStep = () => resolve());
- }
- async function morph(from, toHtml, options) {
- assignOptions(options);
- fromEl = from;
- toEl = createElement(toHtml);
- if (window.Alpine && !from._x_dataStack) {
- toEl._x_dataStack = window.Alpine.closestDataStack(from);
- toEl._x_dataStack && window.Alpine.clone(from, toEl);
- }
- await breakpoint();
- await patch(from, toEl);
- fromEl = void 0;
- toEl = void 0;
- return from;
- }
- morph.step = () => resolveStep();
- morph.log = (theLogger) => {
- logger = theLogger;
- };
- var key;
- var lookahead;
- var updating;
- var updated;
- var removing;
- var removed;
- var adding;
- var added;
- var debug;
- var noop = () => {
- };
- function assignOptions(options = {}) {
- let defaultGetKey = (el) => el.getAttribute("key");
- updating = options.updating || noop;
- updated = options.updated || noop;
- removing = options.removing || noop;
- removed = options.removed || noop;
- adding = options.adding || noop;
- added = options.added || noop;
- key = options.key || defaultGetKey;
- lookahead = options.lookahead || false;
- debug = options.debug || false;
- }
- function createElement(html) {
- return document.createRange().createContextualFragment(html).firstElementChild;
- }
- async function patch(from, to) {
- if (differentElementNamesTypesOrKeys(from, to)) {
- let result = patchElement(from, to);
- await breakpoint("Swap elements");
- return result;
- }
- let updateChildrenOnly = false;
- if (shouldSkip(updating, from, to, () => updateChildrenOnly = true))
- return;
- window.Alpine && initializeAlpineOnTo(from, to, () => updateChildrenOnly = true);
- if (textOrComment(to)) {
- await patchNodeValue(from, to);
- updated(from, to);
- return;
- }
- if (!updateChildrenOnly) {
- await patchAttributes(from, to);
- }
- updated(from, to);
- await patchChildren(from, to);
- }
- function differentElementNamesTypesOrKeys(from, to) {
- return from.nodeType != to.nodeType || from.nodeName != to.nodeName || getKey(from) != getKey(to);
- }
- function textOrComment(el) {
- return el.nodeType === 3 || el.nodeType === 8;
- }
- function patchElement(from, to) {
- if (shouldSkip(removing, from))
- return;
- let toCloned = to.cloneNode(true);
- if (shouldSkip(adding, toCloned))
- return;
- dom(from).replace(toCloned);
- removed(from);
- added(toCloned);
- }
- async function patchNodeValue(from, to) {
- let value = to.nodeValue;
- if (from.nodeValue !== value) {
- from.nodeValue = value;
- await breakpoint("Change text node to: " + value);
- }
- }
- async function patchAttributes(from, to) {
- if (from._x_isShown && !to._x_isShown) {
- return;
- }
- if (!from._x_isShown && to._x_isShown) {
- return;
- }
- let domAttributes = Array.from(from.attributes);
- let toAttributes = Array.from(to.attributes);
- for (let i = domAttributes.length - 1; i >= 0; i--) {
- let name = domAttributes[i].name;
- if (!to.hasAttribute(name)) {
- from.removeAttribute(name);
- await breakpoint("Remove attribute");
- }
- }
- for (let i = toAttributes.length - 1; i >= 0; i--) {
- let name = toAttributes[i].name;
- let value = toAttributes[i].value;
- if (from.getAttribute(name) !== value) {
- from.setAttribute(name, value);
- await breakpoint(`Set [${name}] attribute to: "${value}"`);
- }
- }
- }
- async function patchChildren(from, to) {
- let domChildren = from.childNodes;
- let toChildren = to.childNodes;
- let toKeyToNodeMap = keyToMap(toChildren);
- let domKeyDomNodeMap = keyToMap(domChildren);
- let currentTo = dom(to).nodes().first();
- let currentFrom = dom(from).nodes().first();
- let domKeyHoldovers = {};
- while (currentTo) {
- let toKey = getKey(currentTo);
- let domKey = getKey(currentFrom);
- if (!currentFrom) {
- if (toKey && domKeyHoldovers[toKey]) {
- let holdover = domKeyHoldovers[toKey];
- dom(from).append(holdover);
- currentFrom = holdover;
- await breakpoint("Add element (from key)");
- } else {
- let added2 = addNodeTo(currentTo, from) || {};
- await breakpoint("Add element: " + added2.outerHTML || added2.nodeValue);
- currentTo = dom(currentTo).nodes().next();
- continue;
- }
- }
- if (lookahead) {
- let nextToElementSibling = dom(currentTo).next();
- let found = false;
- while (!found && nextToElementSibling) {
- if (currentFrom.isEqualNode(nextToElementSibling)) {
- found = true;
- currentFrom = addNodeBefore(currentTo, currentFrom);
- domKey = getKey(currentFrom);
- await breakpoint("Move element (lookahead)");
- }
- nextToElementSibling = dom(nextToElementSibling).next();
- }
- }
- if (toKey !== domKey) {
- if (!toKey && domKey) {
- domKeyHoldovers[domKey] = currentFrom;
- currentFrom = addNodeBefore(currentTo, currentFrom);
- domKeyHoldovers[domKey].remove();
- currentFrom = dom(currentFrom).nodes().next();
- currentTo = dom(currentTo).nodes().next();
- await breakpoint('No "to" key');
- continue;
- }
- if (toKey && !domKey) {
- if (domKeyDomNodeMap[toKey]) {
- currentFrom = dom(currentFrom).replace(domKeyDomNodeMap[toKey]);
- await breakpoint('No "from" key');
- }
- }
- if (toKey && domKey) {
- domKeyHoldovers[domKey] = currentFrom;
- let domKeyNode = domKeyDomNodeMap[toKey];
- if (domKeyNode) {
- currentFrom = dom(currentFrom).replace(domKeyNode);
- await breakpoint('Move "from" key');
- } else {
- domKeyHoldovers[domKey] = currentFrom;
- currentFrom = addNodeBefore(currentTo, currentFrom);
- domKeyHoldovers[domKey].remove();
- currentFrom = dom(currentFrom).next();
- currentTo = dom(currentTo).next();
- await breakpoint("I dont even know what this does");
- continue;
- }
- }
- }
- await patch(currentFrom, currentTo);
- currentTo = currentTo && dom(currentTo).nodes().next();
- currentFrom = currentFrom && dom(currentFrom).nodes().next();
- }
- let removals = [];
- while (currentFrom) {
- if (!shouldSkip(removing, currentFrom))
- removals.push(currentFrom);
- currentFrom = dom(currentFrom).nodes().next();
- }
- while (removals.length) {
- let domForRemoval = removals.pop();
- domForRemoval.remove();
- await breakpoint("remove el");
- removed(domForRemoval);
- }
- }
- function getKey(el) {
- return el && el.nodeType === 1 && key(el);
- }
- function keyToMap(els) {
- let map = {};
- els.forEach((el) => {
- let theKey = getKey(el);
- if (theKey) {
- map[theKey] = el;
- }
- });
- return map;
- }
- function shouldSkip(hook, ...args) {
- let skip = false;
- hook(...args, () => skip = true);
- return skip;
- }
- function addNodeTo(node, parent) {
- if (!shouldSkip(adding, node)) {
- let clone = node.cloneNode(true);
- dom(parent).append(clone);
- added(clone);
- return clone;
- }
- return null;
- }
- function addNodeBefore(node, beforeMe) {
- if (!shouldSkip(adding, node)) {
- let clone = node.cloneNode(true);
- dom(beforeMe).before(clone);
- added(clone);
- return clone;
- }
- return beforeMe;
- }
- function initializeAlpineOnTo(from, to, childrenOnly) {
- if (from.nodeType !== 1)
- return;
- if (from._x_dataStack) {
- window.Alpine.clone(from, to);
- }
- }
- function dom(el) {
- return new DomManager(el);
- }
+ // packages/morph/src/dom.js
var DomManager = class {
el = void 0;
constructor(el) {
@@ -309,6 +51,259 @@
return el;
}
};
+ function dom(el) {
+ return new DomManager(el);
+ }
+ function createElement(html) {
+ return document.createRange().createContextualFragment(html).firstElementChild;
+ }
+ function textOrComment(el) {
+ return el.nodeType === 3 || el.nodeType === 8;
+ }
+
+ // packages/morph/src/morph.js
+ var resolveStep = () => {
+ };
+ var logger = () => {
+ };
+ async function morph(from, toHtml, options) {
+ let fromEl;
+ let toEl;
+ let key, lookahead, updating, updated, removing, removed, adding, added, debug;
+ function breakpoint(message) {
+ if (!debug)
+ return;
+ logger((message || "").replace("\n", "\\n"), fromEl, toEl);
+ return new Promise((resolve) => resolveStep = () => resolve());
+ }
+ function assignOptions(options2 = {}) {
+ let defaultGetKey = (el) => el.getAttribute("key");
+ let noop = () => {
+ };
+ updating = options2.updating || noop;
+ updated = options2.updated || noop;
+ removing = options2.removing || noop;
+ removed = options2.removed || noop;
+ adding = options2.adding || noop;
+ added = options2.added || noop;
+ key = options2.key || defaultGetKey;
+ lookahead = options2.lookahead || false;
+ debug = options2.debug || false;
+ }
+ async function patch(from2, to) {
+ if (differentElementNamesTypesOrKeys(from2, to)) {
+ let result = patchElement(from2, to);
+ await breakpoint("Swap elements");
+ return result;
+ }
+ let updateChildrenOnly = false;
+ if (shouldSkip(updating, from2, to, () => updateChildrenOnly = true))
+ return;
+ window.Alpine && initializeAlpineOnTo(from2, to, () => updateChildrenOnly = true);
+ if (textOrComment(to)) {
+ await patchNodeValue(from2, to);
+ updated(from2, to);
+ return;
+ }
+ if (!updateChildrenOnly) {
+ await patchAttributes(from2, to);
+ }
+ updated(from2, to);
+ await patchChildren(from2, to);
+ }
+ function differentElementNamesTypesOrKeys(from2, to) {
+ return from2.nodeType != to.nodeType || from2.nodeName != to.nodeName || getKey(from2) != getKey(to);
+ }
+ function patchElement(from2, to) {
+ if (shouldSkip(removing, from2))
+ return;
+ let toCloned = to.cloneNode(true);
+ if (shouldSkip(adding, toCloned))
+ return;
+ dom(from2).replace(toCloned);
+ removed(from2);
+ added(toCloned);
+ }
+ async function patchNodeValue(from2, to) {
+ let value = to.nodeValue;
+ if (from2.nodeValue !== value) {
+ from2.nodeValue = value;
+ await breakpoint("Change text node to: " + value);
+ }
+ }
+ async function patchAttributes(from2, to) {
+ if (from2._x_isShown && !to._x_isShown) {
+ return;
+ }
+ if (!from2._x_isShown && to._x_isShown) {
+ return;
+ }
+ let domAttributes = Array.from(from2.attributes);
+ let toAttributes = Array.from(to.attributes);
+ for (let i = domAttributes.length - 1; i >= 0; i--) {
+ let name = domAttributes[i].name;
+ if (!to.hasAttribute(name)) {
+ from2.removeAttribute(name);
+ await breakpoint("Remove attribute");
+ }
+ }
+ for (let i = toAttributes.length - 1; i >= 0; i--) {
+ let name = toAttributes[i].name;
+ let value = toAttributes[i].value;
+ if (from2.getAttribute(name) !== value) {
+ from2.setAttribute(name, value);
+ await breakpoint(`Set [${name}] attribute to: "${value}"`);
+ }
+ }
+ }
+ async function patchChildren(from2, to) {
+ let domChildren = from2.childNodes;
+ let toChildren = to.childNodes;
+ let toKeyToNodeMap = keyToMap(toChildren);
+ let domKeyDomNodeMap = keyToMap(domChildren);
+ let currentTo = dom(to).nodes().first();
+ let currentFrom = dom(from2).nodes().first();
+ let domKeyHoldovers = {};
+ while (currentTo) {
+ let toKey = getKey(currentTo);
+ let domKey = getKey(currentFrom);
+ if (!currentFrom) {
+ if (toKey && domKeyHoldovers[toKey]) {
+ let holdover = domKeyHoldovers[toKey];
+ dom(from2).append(holdover);
+ currentFrom = holdover;
+ await breakpoint("Add element (from key)");
+ } else {
+ let added2 = addNodeTo(currentTo, from2) || {};
+ await breakpoint("Add element: " + (added2.outerHTML || added2.nodeValue));
+ currentTo = dom(currentTo).nodes().next();
+ continue;
+ }
+ }
+ if (lookahead) {
+ let nextToElementSibling = dom(currentTo).next();
+ let found = false;
+ while (!found && nextToElementSibling) {
+ if (currentFrom.isEqualNode(nextToElementSibling)) {
+ found = true;
+ currentFrom = addNodeBefore(currentTo, currentFrom);
+ domKey = getKey(currentFrom);
+ await breakpoint("Move element (lookahead)");
+ }
+ nextToElementSibling = dom(nextToElementSibling).next();
+ }
+ }
+ if (toKey !== domKey) {
+ if (!toKey && domKey) {
+ domKeyHoldovers[domKey] = currentFrom;
+ currentFrom = addNodeBefore(currentTo, currentFrom);
+ domKeyHoldovers[domKey].remove();
+ currentFrom = dom(currentFrom).nodes().next();
+ currentTo = dom(currentTo).nodes().next();
+ await breakpoint('No "to" key');
+ continue;
+ }
+ if (toKey && !domKey) {
+ if (domKeyDomNodeMap[toKey]) {
+ currentFrom = dom(currentFrom).replace(domKeyDomNodeMap[toKey]);
+ await breakpoint('No "from" key');
+ }
+ }
+ if (toKey && domKey) {
+ domKeyHoldovers[domKey] = currentFrom;
+ let domKeyNode = domKeyDomNodeMap[toKey];
+ if (domKeyNode) {
+ currentFrom = dom(currentFrom).replace(domKeyNode);
+ await breakpoint('Move "from" key');
+ } else {
+ domKeyHoldovers[domKey] = currentFrom;
+ currentFrom = addNodeBefore(currentTo, currentFrom);
+ domKeyHoldovers[domKey].remove();
+ currentFrom = dom(currentFrom).next();
+ currentTo = dom(currentTo).next();
+ await breakpoint("Swap elements with keys");
+ continue;
+ }
+ }
+ }
+ let currentFromNext = currentFrom && dom(currentFrom).nodes().next();
+ await patch(currentFrom, currentTo);
+ currentTo = currentTo && dom(currentTo).nodes().next();
+ currentFrom = currentFromNext;
+ }
+ let removals = [];
+ while (currentFrom) {
+ if (!shouldSkip(removing, currentFrom))
+ removals.push(currentFrom);
+ currentFrom = dom(currentFrom).nodes().next();
+ }
+ while (removals.length) {
+ let domForRemoval = removals.shift();
+ domForRemoval.remove();
+ await breakpoint("remove el");
+ removed(domForRemoval);
+ }
+ }
+ function getKey(el) {
+ return el && el.nodeType === 1 && key(el);
+ }
+ function keyToMap(els) {
+ let map = {};
+ els.forEach((el) => {
+ let theKey = getKey(el);
+ if (theKey) {
+ map[theKey] = el;
+ }
+ });
+ return map;
+ }
+ function addNodeTo(node, parent) {
+ if (!shouldSkip(adding, node)) {
+ let clone = node.cloneNode(true);
+ dom(parent).append(clone);
+ added(clone);
+ return clone;
+ }
+ return null;
+ }
+ function addNodeBefore(node, beforeMe) {
+ if (!shouldSkip(adding, node)) {
+ let clone = node.cloneNode(true);
+ dom(beforeMe).before(clone);
+ added(clone);
+ return clone;
+ }
+ return beforeMe;
+ }
+ assignOptions(options);
+ fromEl = from;
+ toEl = createElement(toHtml);
+ if (window.Alpine && window.Alpine.closestDataStack && !from._x_dataStack) {
+ toEl._x_dataStack = window.Alpine.closestDataStack(from);
+ toEl._x_dataStack && window.Alpine.clone(from, toEl);
+ }
+ await breakpoint();
+ await patch(from, toEl);
+ fromEl = void 0;
+ toEl = void 0;
+ return from;
+ }
+ morph.step = () => resolveStep();
+ morph.log = (theLogger) => {
+ logger = theLogger;
+ };
+ function shouldSkip(hook, ...args) {
+ let skip = false;
+ hook(...args, () => skip = true);
+ return skip;
+ }
+ function initializeAlpineOnTo(from, to, childrenOnly) {
+ if (from.nodeType !== 1)
+ return;
+ if (from._x_dataStack) {
+ window.Alpine.clone(from, to);
+ }
+ }
// packages/morph/src/index.js
function src_default(Alpine) {
diff --git a/alpinejs/packages/morph/dist/cdn.min.js b/alpinejs/packages/morph/dist/cdn.min.js
index dff89d4..82a0ac9 100644
--- a/alpinejs/packages/morph/dist/cdn.min.js
+++ b/alpinejs/packages/morph/dist/cdn.min.js
@@ -1,2 +1,2 @@
-(()=>{var C=()=>{},E=()=>{},_,f;function d(e){if(!!K)return E((e||"").replace(`
-`,"\\n"),_,f),new Promise(t=>C=()=>t())}async function y(e,t,n){return H(n),_=e,f=L(t),window.Alpine&&!e._x_dataStack&&(f._x_dataStack=window.Alpine.closestDataStack(e),f._x_dataStack&&window.Alpine.clone(e,f)),await d(),await B(e,f),_=void 0,f=void 0,e}y.step=()=>C();y.log=e=>{E=e};var O,M,V,b,A,N,v,g,K,w=()=>{};function H(e={}){let t=n=>n.getAttribute("key");V=e.updating||w,b=e.updated||w,A=e.removing||w,N=e.removed||w,v=e.adding||w,g=e.added||w,O=e.key||t,M=e.lookahead||!1,K=e.debug||!1}function L(e){return document.createRange().createContextualFragment(e).firstElementChild}async function B(e,t){if($(e,t)){let u=q(e,t);return await d("Swap elements"),u}let n=!1;if(!x(V,e,t,()=>n=!0)){if(window.Alpine&&P(e,t,()=>n=!0),j(t)){await z(e,t),b(e,t);return}n||await G(e,t),b(e,t),await I(e,t)}}function $(e,t){return e.nodeType!=t.nodeType||e.nodeName!=t.nodeName||m(e)!=m(t)}function j(e){return e.nodeType===3||e.nodeType===8}function q(e,t){if(x(A,e))return;let n=t.cloneNode(!0);x(v,n)||(a(e).replace(n),N(e),g(n))}async function z(e,t){let n=t.nodeValue;e.nodeValue!==n&&(e.nodeValue=n,await d("Change text node to: "+n))}async function G(e,t){if(e._x_isShown&&!t._x_isShown||!e._x_isShown&&t._x_isShown)return;let n=Array.from(e.attributes),u=Array.from(t.attributes);for(let p=n.length-1;p>=0;p--){let s=n[p].name;t.hasAttribute(s)||(e.removeAttribute(s),await d("Remove attribute"))}for(let p=u.length-1;p>=0;p--){let s=u[p].name,r=u[p].value;e.getAttribute(s)!==r&&(e.setAttribute(s,r),await d(`Set [${s}] attribute to: "${r}"`))}}async function I(e,t){let n=e.childNodes,u=t.childNodes,p=F(u),s=F(n),r=a(t).nodes().first(),i=a(e).nodes().first(),h={};for(;r;){let l=m(r),c=m(i);if(!i)if(l&&h[l]){let o=h[l];a(e).append(o),i=o,await d("Add element (from key)")}else{let o=J(r,e)||{};await d("Add element: "+o.outerHTML||o.nodeValue),r=a(r).nodes().next();continue}if(M){let o=a(r).next(),S=!1;for(;!S&&o;)i.isEqualNode(o)&&(S=!0,i=T(r,i),c=m(i),await d("Move element (lookahead)")),o=a(o).next()}if(l!==c){if(!l&&c){h[c]=i,i=T(r,i),h[c].remove(),i=a(i).nodes().next(),r=a(r).nodes().next(),await d('No "to" key');continue}if(l&&!c&&s[l]&&(i=a(i).replace(s[l]),await d('No "from" key')),l&&c){h[c]=i;let o=s[l];if(o)i=a(i).replace(o),await d('Move "from" key');else{h[c]=i,i=T(r,i),h[c].remove(),i=a(i).next(),r=a(r).next(),await d("I dont even know what this does");continue}}}await B(i,r),r=r&&a(r).nodes().next(),i=i&&a(i).nodes().next()}let k=[];for(;i;)x(A,i)||k.push(i),i=a(i).nodes().next();for(;k.length;){let l=k.pop();l.remove(),await d("remove el"),N(l)}}function m(e){return e&&e.nodeType===1&&O(e)}function F(e){let t={};return e.forEach(n=>{let u=m(n);u&&(t[u]=n)}),t}function x(e,...t){let n=!1;return e(...t,()=>n=!0),n}function J(e,t){if(!x(v,e)){let n=e.cloneNode(!0);return a(t).append(n),g(n),n}return null}function T(e,t){if(!x(v,e)){let n=e.cloneNode(!0);return a(t).before(n),g(n),n}return t}function P(e,t,n){e.nodeType===1&&e._x_dataStack&&window.Alpine.clone(e,t)}function a(e){return new R(e)}var R=class{el=void 0;constructor(t){this.el=t}traversals={first:"firstElementChild",next:"nextElementSibling",parent:"parentElement"};nodes(){return this.traversals={first:"firstChild",next:"nextSibling",parent:"parentNode"},this}first(){return this.teleportTo(this.el[this.traversals.first])}next(){return this.teleportTo(this.teleportBack(this.el[this.traversals.next]))}before(t){return this.el[this.traversals.parent].insertBefore(t,this.el),t}replace(t){return this.el[this.traversals.parent].replaceChild(t,this.el),t}append(t){return this.el.appendChild(t),t}teleportTo(t){return t&&(t._x_teleport?t._x_teleport:t)}teleportBack(t){return t&&(t._x_teleportBack?t._x_teleportBack:t)}};function D(e){e.morph=y}document.addEventListener("alpine:init",()=>{window.Alpine.plugin(D)});})();
+(()=>{var D=class{el=void 0;constructor(r){this.el=r}traversals={first:"firstElementChild",next:"nextElementSibling",parent:"parentElement"};nodes(){return this.traversals={first:"firstChild",next:"nextSibling",parent:"parentNode"},this}first(){return this.teleportTo(this.el[this.traversals.first])}next(){return this.teleportTo(this.teleportBack(this.el[this.traversals.next]))}before(r){return this.el[this.traversals.parent].insertBefore(r,this.el),r}replace(r){return this.el[this.traversals.parent].replaceChild(r,this.el),r}append(r){return this.el.appendChild(r),r}teleportTo(r){return r&&(r._x_teleport?r._x_teleport:r)}teleportBack(r){return r&&(r._x_teleportBack?r._x_teleportBack:r)}};function o(a){return new D(a)}function R(a){return document.createRange().createContextualFragment(a).firstElementChild}function j(a){return a.nodeType===3||a.nodeType===8}var H=()=>{},L=()=>{};async function _(a,r,v){let A,w,E,K,O,b,N,S,g,k,B;function d(e){if(!!B)return L((e||"").replace(`
+`,"\\n"),A,w),new Promise(t=>H=()=>t())}function q(e={}){let t=c=>c.getAttribute("key"),n=()=>{};O=e.updating||n,b=e.updated||n,N=e.removing||n,S=e.removed||n,g=e.adding||n,k=e.added||n,E=e.key||t,K=e.lookahead||!1,B=e.debug||!1}async function M(e,t){if(z(e,t)){let c=G(e,t);return await d("Swap elements"),c}let n=!1;if(!y(O,e,t,()=>n=!0)){if(window.Alpine&&W(e,t,()=>n=!0),j(t)){await P(e,t),b(e,t);return}n||await I(e,t),b(e,t),await J(e,t)}}function z(e,t){return e.nodeType!=t.nodeType||e.nodeName!=t.nodeName||x(e)!=x(t)}function G(e,t){if(y(N,e))return;let n=t.cloneNode(!0);y(g,n)||(o(e).replace(n),S(e),k(n))}async function P(e,t){let n=t.nodeValue;e.nodeValue!==n&&(e.nodeValue=n,await d("Change text node to: "+n))}async function I(e,t){if(e._x_isShown&&!t._x_isShown||!e._x_isShown&&t._x_isShown)return;let n=Array.from(e.attributes),c=Array.from(t.attributes);for(let h=n.length-1;h>=0;h--){let p=n[h].name;t.hasAttribute(p)||(e.removeAttribute(p),await d("Remove attribute"))}for(let h=c.length-1;h>=0;h--){let p=c[h].name,l=c[h].value;e.getAttribute(p)!==l&&(e.setAttribute(p,l),await d(`Set [${p}] attribute to: "${l}"`))}}async function J(e,t){let n=e.childNodes,c=t.childNodes,h=V(c),p=V(n),l=o(t).nodes().first(),i=o(e).nodes().first(),m={};for(;l;){let u=x(l),f=x(i);if(!i)if(u&&m[u]){let s=m[u];o(e).append(s),i=s,await d("Add element (from key)")}else{let s=Q(l,e)||{};await d("Add element: "+(s.outerHTML||s.nodeValue)),l=o(l).nodes().next();continue}if(K){let s=o(l).next(),F=!1;for(;!F&&s;)i.isEqualNode(s)&&(F=!0,i=T(l,i),f=x(i),await d("Move element (lookahead)")),s=o(s).next()}if(u!==f){if(!u&&f){m[f]=i,i=T(l,i),m[f].remove(),i=o(i).nodes().next(),l=o(l).nodes().next(),await d('No "to" key');continue}if(u&&!f&&p[u]&&(i=o(i).replace(p[u]),await d('No "from" key')),u&&f){m[f]=i;let s=p[u];if(s)i=o(i).replace(s),await d('Move "from" key');else{m[f]=i,i=T(l,i),m[f].remove(),i=o(i).next(),l=o(l).next(),await d("Swap elements with keys");continue}}}let U=i&&o(i).nodes().next();await M(i,l),l=l&&o(l).nodes().next(),i=U}let C=[];for(;i;)y(N,i)||C.push(i),i=o(i).nodes().next();for(;C.length;){let u=C.shift();u.remove(),await d("remove el"),S(u)}}function x(e){return e&&e.nodeType===1&&E(e)}function V(e){let t={};return e.forEach(n=>{let c=x(n);c&&(t[c]=n)}),t}function Q(e,t){if(!y(g,e)){let n=e.cloneNode(!0);return o(t).append(n),k(n),n}return null}function T(e,t){if(!y(g,e)){let n=e.cloneNode(!0);return o(t).before(n),k(n),n}return t}return q(v),A=a,w=R(r),window.Alpine&&window.Alpine.closestDataStack&&!a._x_dataStack&&(w._x_dataStack=window.Alpine.closestDataStack(a),w._x_dataStack&&window.Alpine.clone(a,w)),await d(),await M(a,w),A=void 0,w=void 0,a}_.step=()=>H();_.log=a=>{L=a};function y(a,...r){let v=!1;return a(...r,()=>v=!0),v}function W(a,r,v){a.nodeType===1&&a._x_dataStack&&window.Alpine.clone(a,r)}function $(a){a.morph=_}document.addEventListener("alpine:init",()=>{window.Alpine.plugin($)});})();
diff --git a/alpinejs/packages/morph/dist/module.cjs.js b/alpinejs/packages/morph/dist/module.cjs.js
index 260bf1f..5bf0fcf 100644
--- a/alpinejs/packages/morph/dist/module.cjs.js
+++ b/alpinejs/packages/morph/dist/module.cjs.js
@@ -4,12 +4,12 @@ var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {get: all[name], enumerable: true});
};
-var __publicField = (obj, key2, value) => {
- if (typeof key2 !== "symbol")
- key2 += "";
- if (key2 in obj)
- return __defProp(obj, key2, {enumerable: true, configurable: true, writable: true, value});
- return obj[key2] = value;
+var __publicField = (obj, key, value) => {
+ if (typeof key !== "symbol")
+ key += "";
+ if (key in obj)
+ return __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value});
+ return obj[key] = value;
};
// packages/morph/builds/module.js
@@ -19,265 +19,7 @@ __export(exports, {
morph: () => morph
});
-// packages/morph/src/morph.js
-var resolveStep = () => {
-};
-var logger = () => {
-};
-var fromEl;
-var toEl;
-function breakpoint(message) {
- if (!debug)
- return;
- logger((message || "").replace("\n", "\\n"), fromEl, toEl);
- return new Promise((resolve) => resolveStep = () => resolve());
-}
-async function morph(from, toHtml, options) {
- assignOptions(options);
- fromEl = from;
- toEl = createElement(toHtml);
- if (window.Alpine && !from._x_dataStack) {
- toEl._x_dataStack = window.Alpine.closestDataStack(from);
- toEl._x_dataStack && window.Alpine.clone(from, toEl);
- }
- await breakpoint();
- await patch(from, toEl);
- fromEl = void 0;
- toEl = void 0;
- return from;
-}
-morph.step = () => resolveStep();
-morph.log = (theLogger) => {
- logger = theLogger;
-};
-var key;
-var lookahead;
-var updating;
-var updated;
-var removing;
-var removed;
-var adding;
-var added;
-var debug;
-var noop = () => {
-};
-function assignOptions(options = {}) {
- let defaultGetKey = (el) => el.getAttribute("key");
- updating = options.updating || noop;
- updated = options.updated || noop;
- removing = options.removing || noop;
- removed = options.removed || noop;
- adding = options.adding || noop;
- added = options.added || noop;
- key = options.key || defaultGetKey;
- lookahead = options.lookahead || false;
- debug = options.debug || false;
-}
-function createElement(html) {
- return document.createRange().createContextualFragment(html).firstElementChild;
-}
-async function patch(from, to) {
- if (differentElementNamesTypesOrKeys(from, to)) {
- let result = patchElement(from, to);
- await breakpoint("Swap elements");
- return result;
- }
- let updateChildrenOnly = false;
- if (shouldSkip(updating, from, to, () => updateChildrenOnly = true))
- return;
- window.Alpine && initializeAlpineOnTo(from, to, () => updateChildrenOnly = true);
- if (textOrComment(to)) {
- await patchNodeValue(from, to);
- updated(from, to);
- return;
- }
- if (!updateChildrenOnly) {
- await patchAttributes(from, to);
- }
- updated(from, to);
- await patchChildren(from, to);
-}
-function differentElementNamesTypesOrKeys(from, to) {
- return from.nodeType != to.nodeType || from.nodeName != to.nodeName || getKey(from) != getKey(to);
-}
-function textOrComment(el) {
- return el.nodeType === 3 || el.nodeType === 8;
-}
-function patchElement(from, to) {
- if (shouldSkip(removing, from))
- return;
- let toCloned = to.cloneNode(true);
- if (shouldSkip(adding, toCloned))
- return;
- dom(from).replace(toCloned);
- removed(from);
- added(toCloned);
-}
-async function patchNodeValue(from, to) {
- let value = to.nodeValue;
- if (from.nodeValue !== value) {
- from.nodeValue = value;
- await breakpoint("Change text node to: " + value);
- }
-}
-async function patchAttributes(from, to) {
- if (from._x_isShown && !to._x_isShown) {
- return;
- }
- if (!from._x_isShown && to._x_isShown) {
- return;
- }
- let domAttributes = Array.from(from.attributes);
- let toAttributes = Array.from(to.attributes);
- for (let i = domAttributes.length - 1; i >= 0; i--) {
- let name = domAttributes[i].name;
- if (!to.hasAttribute(name)) {
- from.removeAttribute(name);
- await breakpoint("Remove attribute");
- }
- }
- for (let i = toAttributes.length - 1; i >= 0; i--) {
- let name = toAttributes[i].name;
- let value = toAttributes[i].value;
- if (from.getAttribute(name) !== value) {
- from.setAttribute(name, value);
- await breakpoint(`Set [${name}] attribute to: "${value}"`);
- }
- }
-}
-async function patchChildren(from, to) {
- let domChildren = from.childNodes;
- let toChildren = to.childNodes;
- let toKeyToNodeMap = keyToMap(toChildren);
- let domKeyDomNodeMap = keyToMap(domChildren);
- let currentTo = dom(to).nodes().first();
- let currentFrom = dom(from).nodes().first();
- let domKeyHoldovers = {};
- while (currentTo) {
- let toKey = getKey(currentTo);
- let domKey = getKey(currentFrom);
- if (!currentFrom) {
- if (toKey && domKeyHoldovers[toKey]) {
- let holdover = domKeyHoldovers[toKey];
- dom(from).append(holdover);
- currentFrom = holdover;
- await breakpoint("Add element (from key)");
- } else {
- let added2 = addNodeTo(currentTo, from) || {};
- await breakpoint("Add element: " + added2.outerHTML || added2.nodeValue);
- currentTo = dom(currentTo).nodes().next();
- continue;
- }
- }
- if (lookahead) {
- let nextToElementSibling = dom(currentTo).next();
- let found = false;
- while (!found && nextToElementSibling) {
- if (currentFrom.isEqualNode(nextToElementSibling)) {
- found = true;
- currentFrom = addNodeBefore(currentTo, currentFrom);
- domKey = getKey(currentFrom);
- await breakpoint("Move element (lookahead)");
- }
- nextToElementSibling = dom(nextToElementSibling).next();
- }
- }
- if (toKey !== domKey) {
- if (!toKey && domKey) {
- domKeyHoldovers[domKey] = currentFrom;
- currentFrom = addNodeBefore(currentTo, currentFrom);
- domKeyHoldovers[domKey].remove();
- currentFrom = dom(currentFrom).nodes().next();
- currentTo = dom(currentTo).nodes().next();
- await breakpoint('No "to" key');
- continue;
- }
- if (toKey && !domKey) {
- if (domKeyDomNodeMap[toKey]) {
- currentFrom = dom(currentFrom).replace(domKeyDomNodeMap[toKey]);
- await breakpoint('No "from" key');
- }
- }
- if (toKey && domKey) {
- domKeyHoldovers[domKey] = currentFrom;
- let domKeyNode = domKeyDomNodeMap[toKey];
- if (domKeyNode) {
- currentFrom = dom(currentFrom).replace(domKeyNode);
- await breakpoint('Move "from" key');
- } else {
- domKeyHoldovers[domKey] = currentFrom;
- currentFrom = addNodeBefore(currentTo, currentFrom);
- domKeyHoldovers[domKey].remove();
- currentFrom = dom(currentFrom).next();
- currentTo = dom(currentTo).next();
- await breakpoint("I dont even know what this does");
- continue;
- }
- }
- }
- await patch(currentFrom, currentTo);
- currentTo = currentTo && dom(currentTo).nodes().next();
- currentFrom = currentFrom && dom(currentFrom).nodes().next();
- }
- let removals = [];
- while (currentFrom) {
- if (!shouldSkip(removing, currentFrom))
- removals.push(currentFrom);
- currentFrom = dom(currentFrom).nodes().next();
- }
- while (removals.length) {
- let domForRemoval = removals.pop();
- domForRemoval.remove();
- await breakpoint("remove el");
- removed(domForRemoval);
- }
-}
-function getKey(el) {
- return el && el.nodeType === 1 && key(el);
-}
-function keyToMap(els) {
- let map = {};
- els.forEach((el) => {
- let theKey = getKey(el);
- if (theKey) {
- map[theKey] = el;
- }
- });
- return map;
-}
-function shouldSkip(hook, ...args) {
- let skip = false;
- hook(...args, () => skip = true);
- return skip;
-}
-function addNodeTo(node, parent) {
- if (!shouldSkip(adding, node)) {
- let clone = node.cloneNode(true);
- dom(parent).append(clone);
- added(clone);
- return clone;
- }
- return null;
-}
-function addNodeBefore(node, beforeMe) {
- if (!shouldSkip(adding, node)) {
- let clone = node.cloneNode(true);
- dom(beforeMe).before(clone);
- added(clone);
- return clone;
- }
- return beforeMe;
-}
-function initializeAlpineOnTo(from, to, childrenOnly) {
- if (from.nodeType !== 1)
- return;
- if (from._x_dataStack) {
- window.Alpine.clone(from, to);
- }
-}
-function dom(el) {
- return new DomManager(el);
-}
+// packages/morph/src/dom.js
var DomManager = class {
constructor(el) {
__publicField(this, "el");
@@ -329,6 +71,259 @@ var DomManager = class {
return el;
}
};
+function dom(el) {
+ return new DomManager(el);
+}
+function createElement(html) {
+ return document.createRange().createContextualFragment(html).firstElementChild;
+}
+function textOrComment(el) {
+ return el.nodeType === 3 || el.nodeType === 8;
+}
+
+// packages/morph/src/morph.js
+var resolveStep = () => {
+};
+var logger = () => {
+};
+async function morph(from, toHtml, options) {
+ let fromEl;
+ let toEl;
+ let key, lookahead, updating, updated, removing, removed, adding, added, debug;
+ function breakpoint(message) {
+ if (!debug)
+ return;
+ logger((message || "").replace("\n", "\\n"), fromEl, toEl);
+ return new Promise((resolve) => resolveStep = () => resolve());
+ }
+ function assignOptions(options2 = {}) {
+ let defaultGetKey = (el) => el.getAttribute("key");
+ let noop = () => {
+ };
+ updating = options2.updating || noop;
+ updated = options2.updated || noop;
+ removing = options2.removing || noop;
+ removed = options2.removed || noop;
+ adding = options2.adding || noop;
+ added = options2.added || noop;
+ key = options2.key || defaultGetKey;
+ lookahead = options2.lookahead || false;
+ debug = options2.debug || false;
+ }
+ async function patch(from2, to) {
+ if (differentElementNamesTypesOrKeys(from2, to)) {
+ let result = patchElement(from2, to);
+ await breakpoint("Swap elements");
+ return result;
+ }
+ let updateChildrenOnly = false;
+ if (shouldSkip(updating, from2, to, () => updateChildrenOnly = true))
+ return;
+ window.Alpine && initializeAlpineOnTo(from2, to, () => updateChildrenOnly = true);
+ if (textOrComment(to)) {
+ await patchNodeValue(from2, to);
+ updated(from2, to);
+ return;
+ }
+ if (!updateChildrenOnly) {
+ await patchAttributes(from2, to);
+ }
+ updated(from2, to);
+ await patchChildren(from2, to);
+ }
+ function differentElementNamesTypesOrKeys(from2, to) {
+ return from2.nodeType != to.nodeType || from2.nodeName != to.nodeName || getKey(from2) != getKey(to);
+ }
+ function patchElement(from2, to) {
+ if (shouldSkip(removing, from2))
+ return;
+ let toCloned = to.cloneNode(true);
+ if (shouldSkip(adding, toCloned))
+ return;
+ dom(from2).replace(toCloned);
+ removed(from2);
+ added(toCloned);
+ }
+ async function patchNodeValue(from2, to) {
+ let value = to.nodeValue;
+ if (from2.nodeValue !== value) {
+ from2.nodeValue = value;
+ await breakpoint("Change text node to: " + value);
+ }
+ }
+ async function patchAttributes(from2, to) {
+ if (from2._x_isShown && !to._x_isShown) {
+ return;
+ }
+ if (!from2._x_isShown && to._x_isShown) {
+ return;
+ }
+ let domAttributes = Array.from(from2.attributes);
+ let toAttributes = Array.from(to.attributes);
+ for (let i = domAttributes.length - 1; i >= 0; i--) {
+ let name = domAttributes[i].name;
+ if (!to.hasAttribute(name)) {
+ from2.removeAttribute(name);
+ await breakpoint("Remove attribute");
+ }
+ }
+ for (let i = toAttributes.length - 1; i >= 0; i--) {
+ let name = toAttributes[i].name;
+ let value = toAttributes[i].value;
+ if (from2.getAttribute(name) !== value) {
+ from2.setAttribute(name, value);
+ await breakpoint(`Set [${name}] attribute to: "${value}"`);
+ }
+ }
+ }
+ async function patchChildren(from2, to) {
+ let domChildren = from2.childNodes;
+ let toChildren = to.childNodes;
+ let toKeyToNodeMap = keyToMap(toChildren);
+ let domKeyDomNodeMap = keyToMap(domChildren);
+ let currentTo = dom(to).nodes().first();
+ let currentFrom = dom(from2).nodes().first();
+ let domKeyHoldovers = {};
+ while (currentTo) {
+ let toKey = getKey(currentTo);
+ let domKey = getKey(currentFrom);
+ if (!currentFrom) {
+ if (toKey && domKeyHoldovers[toKey]) {
+ let holdover = domKeyHoldovers[toKey];
+ dom(from2).append(holdover);
+ currentFrom = holdover;
+ await breakpoint("Add element (from key)");
+ } else {
+ let added2 = addNodeTo(currentTo, from2) || {};
+ await breakpoint("Add element: " + (added2.outerHTML || added2.nodeValue));
+ currentTo = dom(currentTo).nodes().next();
+ continue;
+ }
+ }
+ if (lookahead) {
+ let nextToElementSibling = dom(currentTo).next();
+ let found = false;
+ while (!found && nextToElementSibling) {
+ if (currentFrom.isEqualNode(nextToElementSibling)) {
+ found = true;
+ currentFrom = addNodeBefore(currentTo, currentFrom);
+ domKey = getKey(currentFrom);
+ await breakpoint("Move element (lookahead)");
+ }
+ nextToElementSibling = dom(nextToElementSibling).next();
+ }
+ }
+ if (toKey !== domKey) {
+ if (!toKey && domKey) {
+ domKeyHoldovers[domKey] = currentFrom;
+ currentFrom = addNodeBefore(currentTo, currentFrom);
+ domKeyHoldovers[domKey].remove();
+ currentFrom = dom(currentFrom).nodes().next();
+ currentTo = dom(currentTo).nodes().next();
+ await breakpoint('No "to" key');
+ continue;
+ }
+ if (toKey && !domKey) {
+ if (domKeyDomNodeMap[toKey]) {
+ currentFrom = dom(currentFrom).replace(domKeyDomNodeMap[toKey]);
+ await breakpoint('No "from" key');
+ }
+ }
+ if (toKey && domKey) {
+ domKeyHoldovers[domKey] = currentFrom;
+ let domKeyNode = domKeyDomNodeMap[toKey];
+ if (domKeyNode) {
+ currentFrom = dom(currentFrom).replace(domKeyNode);
+ await breakpoint('Move "from" key');
+ } else {
+ domKeyHoldovers[domKey] = currentFrom;
+ currentFrom = addNodeBefore(currentTo, currentFrom);
+ domKeyHoldovers[domKey].remove();
+ currentFrom = dom(currentFrom).next();
+ currentTo = dom(currentTo).next();
+ await breakpoint("Swap elements with keys");
+ continue;
+ }
+ }
+ }
+ let currentFromNext = currentFrom && dom(currentFrom).nodes().next();
+ await patch(currentFrom, currentTo);
+ currentTo = currentTo && dom(currentTo).nodes().next();
+ currentFrom = currentFromNext;
+ }
+ let removals = [];
+ while (currentFrom) {
+ if (!shouldSkip(removing, currentFrom))
+ removals.push(currentFrom);
+ currentFrom = dom(currentFrom).nodes().next();
+ }
+ while (removals.length) {
+ let domForRemoval = removals.shift();
+ domForRemoval.remove();
+ await breakpoint("remove el");
+ removed(domForRemoval);
+ }
+ }
+ function getKey(el) {
+ return el && el.nodeType === 1 && key(el);
+ }
+ function keyToMap(els) {
+ let map = {};
+ els.forEach((el) => {
+ let theKey = getKey(el);
+ if (theKey) {
+ map[theKey] = el;
+ }
+ });
+ return map;
+ }
+ function addNodeTo(node, parent) {
+ if (!shouldSkip(adding, node)) {
+ let clone = node.cloneNode(true);
+ dom(parent).append(clone);
+ added(clone);
+ return clone;
+ }
+ return null;
+ }
+ function addNodeBefore(node, beforeMe) {
+ if (!shouldSkip(adding, node)) {
+ let clone = node.cloneNode(true);
+ dom(beforeMe).before(clone);
+ added(clone);
+ return clone;
+ }
+ return beforeMe;
+ }
+ assignOptions(options);
+ fromEl = from;
+ toEl = createElement(toHtml);
+ if (window.Alpine && window.Alpine.closestDataStack && !from._x_dataStack) {
+ toEl._x_dataStack = window.Alpine.closestDataStack(from);
+ toEl._x_dataStack && window.Alpine.clone(from, toEl);
+ }
+ await breakpoint();
+ await patch(from, toEl);
+ fromEl = void 0;
+ toEl = void 0;
+ return from;
+}
+morph.step = () => resolveStep();
+morph.log = (theLogger) => {
+ logger = theLogger;
+};
+function shouldSkip(hook, ...args) {
+ let skip = false;
+ hook(...args, () => skip = true);
+ return skip;
+}
+function initializeAlpineOnTo(from, to, childrenOnly) {
+ if (from.nodeType !== 1)
+ return;
+ if (from._x_dataStack) {
+ window.Alpine.clone(from, to);
+ }
+}
// packages/morph/src/index.js
function src_default(Alpine) {
diff --git a/alpinejs/packages/morph/dist/module.esm.js b/alpinejs/packages/morph/dist/module.esm.js
index b0be17a..cd6dac5 100644
--- a/alpinejs/packages/morph/dist/module.esm.js
+++ b/alpinejs/packages/morph/dist/module.esm.js
@@ -1,262 +1,4 @@
-// packages/morph/src/morph.js
-var resolveStep = () => {
-};
-var logger = () => {
-};
-var fromEl;
-var toEl;
-function breakpoint(message) {
- if (!debug)
- return;
- logger((message || "").replace("\n", "\\n"), fromEl, toEl);
- return new Promise((resolve) => resolveStep = () => resolve());
-}
-async function morph(from, toHtml, options) {
- assignOptions(options);
- fromEl = from;
- toEl = createElement(toHtml);
- if (window.Alpine && !from._x_dataStack) {
- toEl._x_dataStack = window.Alpine.closestDataStack(from);
- toEl._x_dataStack && window.Alpine.clone(from, toEl);
- }
- await breakpoint();
- await patch(from, toEl);
- fromEl = void 0;
- toEl = void 0;
- return from;
-}
-morph.step = () => resolveStep();
-morph.log = (theLogger) => {
- logger = theLogger;
-};
-var key;
-var lookahead;
-var updating;
-var updated;
-var removing;
-var removed;
-var adding;
-var added;
-var debug;
-var noop = () => {
-};
-function assignOptions(options = {}) {
- let defaultGetKey = (el) => el.getAttribute("key");
- updating = options.updating || noop;
- updated = options.updated || noop;
- removing = options.removing || noop;
- removed = options.removed || noop;
- adding = options.adding || noop;
- added = options.added || noop;
- key = options.key || defaultGetKey;
- lookahead = options.lookahead || false;
- debug = options.debug || false;
-}
-function createElement(html) {
- return document.createRange().createContextualFragment(html).firstElementChild;
-}
-async function patch(from, to) {
- if (differentElementNamesTypesOrKeys(from, to)) {
- let result = patchElement(from, to);
- await breakpoint("Swap elements");
- return result;
- }
- let updateChildrenOnly = false;
- if (shouldSkip(updating, from, to, () => updateChildrenOnly = true))
- return;
- window.Alpine && initializeAlpineOnTo(from, to, () => updateChildrenOnly = true);
- if (textOrComment(to)) {
- await patchNodeValue(from, to);
- updated(from, to);
- return;
- }
- if (!updateChildrenOnly) {
- await patchAttributes(from, to);
- }
- updated(from, to);
- await patchChildren(from, to);
-}
-function differentElementNamesTypesOrKeys(from, to) {
- return from.nodeType != to.nodeType || from.nodeName != to.nodeName || getKey(from) != getKey(to);
-}
-function textOrComment(el) {
- return el.nodeType === 3 || el.nodeType === 8;
-}
-function patchElement(from, to) {
- if (shouldSkip(removing, from))
- return;
- let toCloned = to.cloneNode(true);
- if (shouldSkip(adding, toCloned))
- return;
- dom(from).replace(toCloned);
- removed(from);
- added(toCloned);
-}
-async function patchNodeValue(from, to) {
- let value = to.nodeValue;
- if (from.nodeValue !== value) {
- from.nodeValue = value;
- await breakpoint("Change text node to: " + value);
- }
-}
-async function patchAttributes(from, to) {
- if (from._x_isShown && !to._x_isShown) {
- return;
- }
- if (!from._x_isShown && to._x_isShown) {
- return;
- }
- let domAttributes = Array.from(from.attributes);
- let toAttributes = Array.from(to.attributes);
- for (let i = domAttributes.length - 1; i >= 0; i--) {
- let name = domAttributes[i].name;
- if (!to.hasAttribute(name)) {
- from.removeAttribute(name);
- await breakpoint("Remove attribute");
- }
- }
- for (let i = toAttributes.length - 1; i >= 0; i--) {
- let name = toAttributes[i].name;
- let value = toAttributes[i].value;
- if (from.getAttribute(name) !== value) {
- from.setAttribute(name, value);
- await breakpoint(`Set [${name}] attribute to: "${value}"`);
- }
- }
-}
-async function patchChildren(from, to) {
- let domChildren = from.childNodes;
- let toChildren = to.childNodes;
- let toKeyToNodeMap = keyToMap(toChildren);
- let domKeyDomNodeMap = keyToMap(domChildren);
- let currentTo = dom(to).nodes().first();
- let currentFrom = dom(from).nodes().first();
- let domKeyHoldovers = {};
- while (currentTo) {
- let toKey = getKey(currentTo);
- let domKey = getKey(currentFrom);
- if (!currentFrom) {
- if (toKey && domKeyHoldovers[toKey]) {
- let holdover = domKeyHoldovers[toKey];
- dom(from).append(holdover);
- currentFrom = holdover;
- await breakpoint("Add element (from key)");
- } else {
- let added2 = addNodeTo(currentTo, from) || {};
- await breakpoint("Add element: " + added2.outerHTML || added2.nodeValue);
- currentTo = dom(currentTo).nodes().next();
- continue;
- }
- }
- if (lookahead) {
- let nextToElementSibling = dom(currentTo).next();
- let found = false;
- while (!found && nextToElementSibling) {
- if (currentFrom.isEqualNode(nextToElementSibling)) {
- found = true;
- currentFrom = addNodeBefore(currentTo, currentFrom);
- domKey = getKey(currentFrom);
- await breakpoint("Move element (lookahead)");
- }
- nextToElementSibling = dom(nextToElementSibling).next();
- }
- }
- if (toKey !== domKey) {
- if (!toKey && domKey) {
- domKeyHoldovers[domKey] = currentFrom;
- currentFrom = addNodeBefore(currentTo, currentFrom);
- domKeyHoldovers[domKey].remove();
- currentFrom = dom(currentFrom).nodes().next();
- currentTo = dom(currentTo).nodes().next();
- await breakpoint('No "to" key');
- continue;
- }
- if (toKey && !domKey) {
- if (domKeyDomNodeMap[toKey]) {
- currentFrom = dom(currentFrom).replace(domKeyDomNodeMap[toKey]);
- await breakpoint('No "from" key');
- }
- }
- if (toKey && domKey) {
- domKeyHoldovers[domKey] = currentFrom;
- let domKeyNode = domKeyDomNodeMap[toKey];
- if (domKeyNode) {
- currentFrom = dom(currentFrom).replace(domKeyNode);
- await breakpoint('Move "from" key');
- } else {
- domKeyHoldovers[domKey] = currentFrom;
- currentFrom = addNodeBefore(currentTo, currentFrom);
- domKeyHoldovers[domKey].remove();
- currentFrom = dom(currentFrom).next();
- currentTo = dom(currentTo).next();
- await breakpoint("I dont even know what this does");
- continue;
- }
- }
- }
- await patch(currentFrom, currentTo);
- currentTo = currentTo && dom(currentTo).nodes().next();
- currentFrom = currentFrom && dom(currentFrom).nodes().next();
- }
- let removals = [];
- while (currentFrom) {
- if (!shouldSkip(removing, currentFrom))
- removals.push(currentFrom);
- currentFrom = dom(currentFrom).nodes().next();
- }
- while (removals.length) {
- let domForRemoval = removals.pop();
- domForRemoval.remove();
- await breakpoint("remove el");
- removed(domForRemoval);
- }
-}
-function getKey(el) {
- return el && el.nodeType === 1 && key(el);
-}
-function keyToMap(els) {
- let map = {};
- els.forEach((el) => {
- let theKey = getKey(el);
- if (theKey) {
- map[theKey] = el;
- }
- });
- return map;
-}
-function shouldSkip(hook, ...args) {
- let skip = false;
- hook(...args, () => skip = true);
- return skip;
-}
-function addNodeTo(node, parent) {
- if (!shouldSkip(adding, node)) {
- let clone = node.cloneNode(true);
- dom(parent).append(clone);
- added(clone);
- return clone;
- }
- return null;
-}
-function addNodeBefore(node, beforeMe) {
- if (!shouldSkip(adding, node)) {
- let clone = node.cloneNode(true);
- dom(beforeMe).before(clone);
- added(clone);
- return clone;
- }
- return beforeMe;
-}
-function initializeAlpineOnTo(from, to, childrenOnly) {
- if (from.nodeType !== 1)
- return;
- if (from._x_dataStack) {
- window.Alpine.clone(from, to);
- }
-}
-function dom(el) {
- return new DomManager(el);
-}
+// packages/morph/src/dom.js
var DomManager = class {
el = void 0;
constructor(el) {
@@ -308,6 +50,259 @@ var DomManager = class {
return el;
}
};
+function dom(el) {
+ return new DomManager(el);
+}
+function createElement(html) {
+ return document.createRange().createContextualFragment(html).firstElementChild;
+}
+function textOrComment(el) {
+ return el.nodeType === 3 || el.nodeType === 8;
+}
+
+// packages/morph/src/morph.js
+var resolveStep = () => {
+};
+var logger = () => {
+};
+async function morph(from, toHtml, options) {
+ let fromEl;
+ let toEl;
+ let key, lookahead, updating, updated, removing, removed, adding, added, debug;
+ function breakpoint(message) {
+ if (!debug)
+ return;
+ logger((message || "").replace("\n", "\\n"), fromEl, toEl);
+ return new Promise((resolve) => resolveStep = () => resolve());
+ }
+ function assignOptions(options2 = {}) {
+ let defaultGetKey = (el) => el.getAttribute("key");
+ let noop = () => {
+ };
+ updating = options2.updating || noop;
+ updated = options2.updated || noop;
+ removing = options2.removing || noop;
+ removed = options2.removed || noop;
+ adding = options2.adding || noop;
+ added = options2.added || noop;
+ key = options2.key || defaultGetKey;
+ lookahead = options2.lookahead || false;
+ debug = options2.debug || false;
+ }
+ async function patch(from2, to) {
+ if (differentElementNamesTypesOrKeys(from2, to)) {
+ let result = patchElement(from2, to);
+ await breakpoint("Swap elements");
+ return result;
+ }
+ let updateChildrenOnly = false;
+ if (shouldSkip(updating, from2, to, () => updateChildrenOnly = true))
+ return;
+ window.Alpine && initializeAlpineOnTo(from2, to, () => updateChildrenOnly = true);
+ if (textOrComment(to)) {
+ await patchNodeValue(from2, to);
+ updated(from2, to);
+ return;
+ }
+ if (!updateChildrenOnly) {
+ await patchAttributes(from2, to);
+ }
+ updated(from2, to);
+ await patchChildren(from2, to);
+ }
+ function differentElementNamesTypesOrKeys(from2, to) {
+ return from2.nodeType != to.nodeType || from2.nodeName != to.nodeName || getKey(from2) != getKey(to);
+ }
+ function patchElement(from2, to) {
+ if (shouldSkip(removing, from2))
+ return;
+ let toCloned = to.cloneNode(true);
+ if (shouldSkip(adding, toCloned))
+ return;
+ dom(from2).replace(toCloned);
+ removed(from2);
+ added(toCloned);
+ }
+ async function patchNodeValue(from2, to) {
+ let value = to.nodeValue;
+ if (from2.nodeValue !== value) {
+ from2.nodeValue = value;
+ await breakpoint("Change text node to: " + value);
+ }
+ }
+ async function patchAttributes(from2, to) {
+ if (from2._x_isShown && !to._x_isShown) {
+ return;
+ }
+ if (!from2._x_isShown && to._x_isShown) {
+ return;
+ }
+ let domAttributes = Array.from(from2.attributes);
+ let toAttributes = Array.from(to.attributes);
+ for (let i = domAttributes.length - 1; i >= 0; i--) {
+ let name = domAttributes[i].name;
+ if (!to.hasAttribute(name)) {
+ from2.removeAttribute(name);
+ await breakpoint("Remove attribute");
+ }
+ }
+ for (let i = toAttributes.length - 1; i >= 0; i--) {
+ let name = toAttributes[i].name;
+ let value = toAttributes[i].value;
+ if (from2.getAttribute(name) !== value) {
+ from2.setAttribute(name, value);
+ await breakpoint(`Set [${name}] attribute to: "${value}"`);
+ }
+ }
+ }
+ async function patchChildren(from2, to) {
+ let domChildren = from2.childNodes;
+ let toChildren = to.childNodes;
+ let toKeyToNodeMap = keyToMap(toChildren);
+ let domKeyDomNodeMap = keyToMap(domChildren);
+ let currentTo = dom(to).nodes().first();
+ let currentFrom = dom(from2).nodes().first();
+ let domKeyHoldovers = {};
+ while (currentTo) {
+ let toKey = getKey(currentTo);
+ let domKey = getKey(currentFrom);
+ if (!currentFrom) {
+ if (toKey && domKeyHoldovers[toKey]) {
+ let holdover = domKeyHoldovers[toKey];
+ dom(from2).append(holdover);
+ currentFrom = holdover;
+ await breakpoint("Add element (from key)");
+ } else {
+ let added2 = addNodeTo(currentTo, from2) || {};
+ await breakpoint("Add element: " + (added2.outerHTML || added2.nodeValue));
+ currentTo = dom(currentTo).nodes().next();
+ continue;
+ }
+ }
+ if (lookahead) {
+ let nextToElementSibling = dom(currentTo).next();
+ let found = false;
+ while (!found && nextToElementSibling) {
+ if (currentFrom.isEqualNode(nextToElementSibling)) {
+ found = true;
+ currentFrom = addNodeBefore(currentTo, currentFrom);
+ domKey = getKey(currentFrom);
+ await breakpoint("Move element (lookahead)");
+ }
+ nextToElementSibling = dom(nextToElementSibling).next();
+ }
+ }
+ if (toKey !== domKey) {
+ if (!toKey && domKey) {
+ domKeyHoldovers[domKey] = currentFrom;
+ currentFrom = addNodeBefore(currentTo, currentFrom);
+ domKeyHoldovers[domKey].remove();
+ currentFrom = dom(currentFrom).nodes().next();
+ currentTo = dom(currentTo).nodes().next();
+ await breakpoint('No "to" key');
+ continue;
+ }
+ if (toKey && !domKey) {
+ if (domKeyDomNodeMap[toKey]) {
+ currentFrom = dom(currentFrom).replace(domKeyDomNodeMap[toKey]);
+ await breakpoint('No "from" key');
+ }
+ }
+ if (toKey && domKey) {
+ domKeyHoldovers[domKey] = currentFrom;
+ let domKeyNode = domKeyDomNodeMap[toKey];
+ if (domKeyNode) {
+ currentFrom = dom(currentFrom).replace(domKeyNode);
+ await breakpoint('Move "from" key');
+ } else {
+ domKeyHoldovers[domKey] = currentFrom;
+ currentFrom = addNodeBefore(currentTo, currentFrom);
+ domKeyHoldovers[domKey].remove();
+ currentFrom = dom(currentFrom).next();
+ currentTo = dom(currentTo).next();
+ await breakpoint("Swap elements with keys");
+ continue;
+ }
+ }
+ }
+ let currentFromNext = currentFrom && dom(currentFrom).nodes().next();
+ await patch(currentFrom, currentTo);
+ currentTo = currentTo && dom(currentTo).nodes().next();
+ currentFrom = currentFromNext;
+ }
+ let removals = [];
+ while (currentFrom) {
+ if (!shouldSkip(removing, currentFrom))
+ removals.push(currentFrom);
+ currentFrom = dom(currentFrom).nodes().next();
+ }
+ while (removals.length) {
+ let domForRemoval = removals.shift();
+ domForRemoval.remove();
+ await breakpoint("remove el");
+ removed(domForRemoval);
+ }
+ }
+ function getKey(el) {
+ return el && el.nodeType === 1 && key(el);
+ }
+ function keyToMap(els) {
+ let map = {};
+ els.forEach((el) => {
+ let theKey = getKey(el);
+ if (theKey) {
+ map[theKey] = el;
+ }
+ });
+ return map;
+ }
+ function addNodeTo(node, parent) {
+ if (!shouldSkip(adding, node)) {
+ let clone = node.cloneNode(true);
+ dom(parent).append(clone);
+ added(clone);
+ return clone;
+ }
+ return null;
+ }
+ function addNodeBefore(node, beforeMe) {
+ if (!shouldSkip(adding, node)) {
+ let clone = node.cloneNode(true);
+ dom(beforeMe).before(clone);
+ added(clone);
+ return clone;
+ }
+ return beforeMe;
+ }
+ assignOptions(options);
+ fromEl = from;
+ toEl = createElement(toHtml);
+ if (window.Alpine && window.Alpine.closestDataStack && !from._x_dataStack) {
+ toEl._x_dataStack = window.Alpine.closestDataStack(from);
+ toEl._x_dataStack && window.Alpine.clone(from, toEl);
+ }
+ await breakpoint();
+ await patch(from, toEl);
+ fromEl = void 0;
+ toEl = void 0;
+ return from;
+}
+morph.step = () => resolveStep();
+morph.log = (theLogger) => {
+ logger = theLogger;
+};
+function shouldSkip(hook, ...args) {
+ let skip = false;
+ hook(...args, () => skip = true);
+ return skip;
+}
+function initializeAlpineOnTo(from, to, childrenOnly) {
+ if (from.nodeType !== 1)
+ return;
+ if (from._x_dataStack) {
+ window.Alpine.clone(from, to);
+ }
+}
// packages/morph/src/index.js
function src_default(Alpine) {
diff --git a/alpinejs/packages/morph/package.json b/alpinejs/packages/morph/package.json
index cb1e3fa..2370fe8 100644
--- a/alpinejs/packages/morph/package.json
+++ b/alpinejs/packages/morph/package.json
@@ -1,6 +1,6 @@
{
"name": "@alpinejs/morph",
- "version": "3.9.1",
+ "version": "3.10.2",
"description": "Diff and patch a block of HTML on a page with an HTML template",
"author": "Caleb Porzio",
"license": "MIT",
diff --git a/alpinejs/packages/morph/src/dom.js b/alpinejs/packages/morph/src/dom.js
new file mode 100644
index 0000000..1e74fe7
--- /dev/null
+++ b/alpinejs/packages/morph/src/dom.js
@@ -0,0 +1,66 @@
+class DomManager {
+ el = undefined
+
+ constructor(el) {
+ this.el = el
+ }
+
+ traversals = {
+ 'first': 'firstElementChild',
+ 'next': 'nextElementSibling',
+ 'parent': 'parentElement',
+ }
+
+ nodes() {
+ this.traversals = {
+ 'first': 'firstChild',
+ 'next': 'nextSibling',
+ 'parent': 'parentNode',
+ }; return this
+ }
+
+ first() {
+ return this.teleportTo(this.el[this.traversals['first']])
+ }
+
+ next() {
+ return this.teleportTo(this.teleportBack(this.el[this.traversals['next']]))
+ }
+
+ before(insertee) {
+ this.el[this.traversals['parent']].insertBefore(insertee, this.el); return insertee
+ }
+
+ replace(replacement) {
+ this.el[this.traversals['parent']].replaceChild(replacement, this.el); return replacement
+ }
+
+ append(appendee) {
+ this.el.appendChild(appendee); return appendee
+ }
+
+ teleportTo(el) {
+ if (! el) return el
+ if (el._x_teleport) return el._x_teleport
+ return el
+ }
+
+ teleportBack(el) {
+ if (! el) return el
+ if (el._x_teleportBack) return el._x_teleportBack
+ return el
+ }
+}
+
+export function dom(el) {
+ return new DomManager(el)
+}
+
+export function createElement(html) {
+ return document.createRange().createContextualFragment(html).firstElementChild
+}
+
+export function textOrComment(el) {
+ return el.nodeType === 3
+ || el.nodeType === 8
+}
diff --git a/alpinejs/packages/morph/src/morph.js b/alpinejs/packages/morph/src/morph.js
index 112a9cf..b472c6c 100644
--- a/alpinejs/packages/morph/src/morph.js
+++ b/alpinejs/packages/morph/src/morph.js
@@ -1,432 +1,373 @@
+import { dom, createElement, textOrComment} from './dom.js'
+
let resolveStep = () => {}
let logger = () => {}
-// Keep these global so that we can access them
-// from hooks while debugging.
-let fromEl
-let toEl
-
-function breakpoint(message) {
- if (! debug) return
-
- logger((message || '').replace('\n', '\\n'), fromEl, toEl)
-
- return new Promise(resolve => resolveStep = () => resolve())
-}
-
export async function morph(from, toHtml, options) {
- assignOptions(options)
-
- fromEl = from
- toEl = createElement(toHtml)
+ // We're defining these globals and methods inside this function (instead of outside)
+ // because it's an async function and if run twice, they would overwrite
+ // each other.
- // If there is no x-data on the element we're morphing,
- // let's seed it with the outer Alpine scope on the page.
- if (window.Alpine && ! from._x_dataStack) {
- toEl._x_dataStack = window.Alpine.closestDataStack(from)
+ let fromEl
+ let toEl
+ let key
+ ,lookahead
+ ,updating
+ ,updated
+ ,removing
+ ,removed
+ ,adding
+ ,added
+ ,debug
- toEl._x_dataStack && window.Alpine.clone(from, toEl)
- }
- await breakpoint()
+ function breakpoint(message) {
+ if (! debug) return
- await patch(from, toEl)
+ logger((message || '').replace('\n', '\\n'), fromEl, toEl)
- // Release these for the garbage collector.
- fromEl = undefined
- toEl = undefined
+ return new Promise(resolve => resolveStep = () => resolve())
+ }
- return from
-}
+ function assignOptions(options = {}) {
+ let defaultGetKey = el => el.getAttribute('key')
+ let noop = () => {}
+
+ updating = options.updating || noop
+ updated = options.updated || noop
+ removing = options.removing || noop
+ removed = options.removed || noop
+ adding = options.adding || noop
+ added = options.added || noop
+ key = options.key || defaultGetKey
+ lookahead = options.lookahead || false
+ debug = options.debug || false
+ }
-morph.step = () => resolveStep()
-morph.log = (theLogger) => {
- logger = theLogger
-}
+ async function patch(from, to) {
+ // This is a time saver, however, it won't catch differences in nested <template> tags.
+ // I'm leaving this here as I believe it's an important speed improvement, I just
+ // don't see a way to enable it currently:
+ //
+ // if (from.isEqualNode(to)) return
-let key
-,lookahead
-,updating
-,updated
-,removing
-,removed
-,adding
-,added
-,debug
-
-let noop = () => {}
-
-function assignOptions(options = {}) {
- let defaultGetKey = el => el.getAttribute('key')
-
- updating = options.updating || noop
- updated = options.updated || noop
- removing = options.removing || noop
- removed = options.removed || noop
- adding = options.adding || noop
- added = options.added || noop
- key = options.key || defaultGetKey
- lookahead = options.lookahead || false
- debug = options.debug || false
-}
+ if (differentElementNamesTypesOrKeys(from, to)) {
+ let result = patchElement(from, to)
-function createElement(html) {
- return document.createRange().createContextualFragment(html).firstElementChild
-}
+ await breakpoint('Swap elements')
-async function patch(from, to) {
- // This is a time saver, however, it won't catch differences in nested <template> tags.
- // I'm leaving this here as I believe it's an important speed improvement, I just
- // don't see a way to enable it currently:
- //
- // if (from.isEqualNode(to)) return
+ return result
+ }
- if (differentElementNamesTypesOrKeys(from, to)) {
- let result = patchElement(from, to)
+ let updateChildrenOnly = false
- await breakpoint('Swap elements')
+ if (shouldSkip(updating, from, to, () => updateChildrenOnly = true)) return
- return result
- }
+ window.Alpine && initializeAlpineOnTo(from, to, () => updateChildrenOnly = true)
- let updateChildrenOnly = false
+ if (textOrComment(to)) {
+ await patchNodeValue(from, to)
+ updated(from, to)
- if (shouldSkip(updating, from, to, () => updateChildrenOnly = true)) return
+ return
+ }
- window.Alpine && initializeAlpineOnTo(from, to, () => updateChildrenOnly = true)
+ if (! updateChildrenOnly) {
+ await patchAttributes(from, to)
+ }
- if (textOrComment(to)) {
- await patchNodeValue(from, to)
updated(from, to)
- return
+ await patchChildren(from, to)
}
- if (! updateChildrenOnly) {
- await patchAttributes(from, to)
+ function differentElementNamesTypesOrKeys(from, to) {
+ return from.nodeType != to.nodeType
+ || from.nodeName != to.nodeName
+ || getKey(from) != getKey(to)
}
- updated(from, to)
-
- await patchChildren(from, to)
-}
-
-function differentElementNamesTypesOrKeys(from, to) {
- return from.nodeType != to.nodeType
- || from.nodeName != to.nodeName
- || getKey(from) != getKey(to)
-}
-
-function textOrComment(el) {
- return el.nodeType === 3
- || el.nodeType === 8
-}
-
-function patchElement(from, to) {
- if (shouldSkip(removing, from)) return
+ function patchElement(from, to) {
+ if (shouldSkip(removing, from)) return
- let toCloned = to.cloneNode(true)
+ let toCloned = to.cloneNode(true)
- if (shouldSkip(adding, toCloned)) return
+ if (shouldSkip(adding, toCloned)) return
- dom(from).replace(toCloned)
+ dom(from).replace(toCloned)
- removed(from)
- added(toCloned)
-}
+ removed(from)
+ added(toCloned)
+ }
-async function patchNodeValue(from, to) {
- let value = to.nodeValue
+ async function patchNodeValue(from, to) {
+ let value = to.nodeValue
- if (from.nodeValue !== value) {
- from.nodeValue = value
+ if (from.nodeValue !== value) {
+ from.nodeValue = value
- await breakpoint('Change text node to: ' + value)
+ await breakpoint('Change text node to: ' + value)
+ }
}
-}
-async function patchAttributes(from, to) {
- if (from._x_isShown && ! to._x_isShown) {
- return
- }
- if (! from._x_isShown && to._x_isShown) {
- return
- }
+ async function patchAttributes(from, to) {
+ if (from._x_isShown && ! to._x_isShown) {
+ return
+ }
+ if (! from._x_isShown && to._x_isShown) {
+ return
+ }
- let domAttributes = Array.from(from.attributes)
- let toAttributes = Array.from(to.attributes)
+ let domAttributes = Array.from(from.attributes)
+ let toAttributes = Array.from(to.attributes)
- for (let i = domAttributes.length - 1; i >= 0; i--) {
- let name = domAttributes[i].name;
+ for (let i = domAttributes.length - 1; i >= 0; i--) {
+ let name = domAttributes[i].name;
- if (! to.hasAttribute(name)) {
- from.removeAttribute(name)
+ if (! to.hasAttribute(name)) {
+ from.removeAttribute(name)
- await breakpoint('Remove attribute')
+ await breakpoint('Remove attribute')
+ }
}
- }
- for (let i = toAttributes.length - 1; i >= 0; i--) {
- let name = toAttributes[i].name
- let value = toAttributes[i].value
+ for (let i = toAttributes.length - 1; i >= 0; i--) {
+ let name = toAttributes[i].name
+ let value = toAttributes[i].value
- if (from.getAttribute(name) !== value) {
- from.setAttribute(name, value)
+ if (from.getAttribute(name) !== value) {
+ from.setAttribute(name, value)
- await breakpoint(`Set [${name}] attribute to: "${value}"`)
+ await breakpoint(`Set [${name}] attribute to: "${value}"`)
+ }
}
}
-}
-async function patchChildren(from, to) {
- let domChildren = from.childNodes
- let toChildren = to.childNodes
+ async function patchChildren(from, to) {
+ let domChildren = from.childNodes
+ let toChildren = to.childNodes
- let toKeyToNodeMap = keyToMap(toChildren)
- let domKeyDomNodeMap = keyToMap(domChildren)
+ let toKeyToNodeMap = keyToMap(toChildren)
+ let domKeyDomNodeMap = keyToMap(domChildren)
- let currentTo = dom(to).nodes().first()
- let currentFrom = dom(from).nodes().first()
+ let currentTo = dom(to).nodes().first()
+ let currentFrom = dom(from).nodes().first()
- let domKeyHoldovers = {}
+ let domKeyHoldovers = {}
- while (currentTo) {
- let toKey = getKey(currentTo)
- let domKey = getKey(currentFrom)
+ while (currentTo) {
+ let toKey = getKey(currentTo)
+ let domKey = getKey(currentFrom)
- // Add new elements
- if (! currentFrom) {
- if (toKey && domKeyHoldovers[toKey]) {
- let holdover = domKeyHoldovers[toKey]
+ // Add new elements
+ if (! currentFrom) {
+ if (toKey && domKeyHoldovers[toKey]) {
+ let holdover = domKeyHoldovers[toKey]
- dom(from).append(holdover)
- currentFrom = holdover
+ dom(from).append(holdover)
+ currentFrom = holdover
- await breakpoint('Add element (from key)')
- } else {
- let added = addNodeTo(currentTo, from) || {}
+ await breakpoint('Add element (from key)')
+ } else {
+ let added = addNodeTo(currentTo, from) || {}
- await breakpoint('Add element: ' + added.outerHTML || added.nodeValue)
+ await breakpoint('Add element: ' + (added.outerHTML || added.nodeValue))
- currentTo = dom(currentTo).nodes().next()
+ currentTo = dom(currentTo).nodes().next()
- continue
+ continue
+ }
}
- }
- if (lookahead) {
- let nextToElementSibling = dom(currentTo).next()
+ if (lookahead) {
+ let nextToElementSibling = dom(currentTo).next()
- let found = false
+ let found = false
- while (!found && nextToElementSibling) {
- if (currentFrom.isEqualNode(nextToElementSibling)) {
- found = true
+ while (!found && nextToElementSibling) {
+ if (currentFrom.isEqualNode(nextToElementSibling)) {
+ found = true
- currentFrom = addNodeBefore(currentTo, currentFrom)
+ currentFrom = addNodeBefore(currentTo, currentFrom)
- domKey = getKey(currentFrom)
+ domKey = getKey(currentFrom)
- await breakpoint('Move element (lookahead)')
- }
+ await breakpoint('Move element (lookahead)')
+ }
- nextToElementSibling = dom(nextToElementSibling).next()
+ nextToElementSibling = dom(nextToElementSibling).next()
+ }
}
- }
- if (toKey !== domKey) {
- if (! toKey && domKey) {
- domKeyHoldovers[domKey] = currentFrom
- currentFrom = addNodeBefore(currentTo, currentFrom)
- domKeyHoldovers[domKey].remove()
- currentFrom = dom(currentFrom).nodes().next()
- currentTo = dom(currentTo).nodes().next()
+ if (toKey !== domKey) {
+ if (! toKey && domKey) {
+ domKeyHoldovers[domKey] = currentFrom
+ currentFrom = addNodeBefore(currentTo, currentFrom)
+ domKeyHoldovers[domKey].remove()
+ currentFrom = dom(currentFrom).nodes().next()
+ currentTo = dom(currentTo).nodes().next()
- await breakpoint('No "to" key')
+ await breakpoint('No "to" key')
- continue
- }
+ continue
+ }
- if (toKey && ! domKey) {
- if (domKeyDomNodeMap[toKey]) {
- currentFrom = dom(currentFrom).replace(domKeyDomNodeMap[toKey])
+ if (toKey && ! domKey) {
+ if (domKeyDomNodeMap[toKey]) {
+ currentFrom = dom(currentFrom).replace(domKeyDomNodeMap[toKey])
- await breakpoint('No "from" key')
+ await breakpoint('No "from" key')
+ }
}
- }
- if (toKey && domKey) {
- domKeyHoldovers[domKey] = currentFrom
- let domKeyNode = domKeyDomNodeMap[toKey]
+ if (toKey && domKey) {
+ domKeyHoldovers[domKey] = currentFrom
+ let domKeyNode = domKeyDomNodeMap[toKey]
- if (domKeyNode) {
- currentFrom = dom(currentFrom).replace(domKeyNode)
+ if (domKeyNode) {
+ currentFrom = dom(currentFrom).replace(domKeyNode)
- await breakpoint('Move "from" key')
- } else {
- domKeyHoldovers[domKey] = currentFrom
- currentFrom = addNodeBefore(currentTo, currentFrom)
- domKeyHoldovers[domKey].remove()
- currentFrom = dom(currentFrom).next()
- currentTo = dom(currentTo).next()
+ await breakpoint('Move "from" key')
+ } else {
+ domKeyHoldovers[domKey] = currentFrom
+ currentFrom = addNodeBefore(currentTo, currentFrom)
+ domKeyHoldovers[domKey].remove()
+ currentFrom = dom(currentFrom).next()
+ currentTo = dom(currentTo).next()
- await breakpoint('I dont even know what this does')
+ await breakpoint('Swap elements with keys')
- continue
+ continue
+ }
}
}
- }
- // Patch elements
- await patch(currentFrom, currentTo)
+ // Get next from sibling before patching in case the node is replaced
+ let currentFromNext = currentFrom && dom(currentFrom).nodes().next()
- currentTo = currentTo && dom(currentTo).nodes().next()
- currentFrom = currentFrom && dom(currentFrom).nodes().next()
- }
+ // Patch elements
+ await patch(currentFrom, currentTo)
- // Cleanup extra froms.
- let removals = []
-
- // We need to collect the "removals" first before actually
- // removing them so we don't mess with the order of things.
- while (currentFrom) {
- if(! shouldSkip(removing, currentFrom)) removals.push(currentFrom)
+ currentTo = currentTo && dom(currentTo).nodes().next()
+ currentFrom = currentFromNext
+ }
- currentFrom = dom(currentFrom).nodes().next()
- }
+ // Cleanup extra froms.
+ let removals = []
- // Now we can do the actual removals.
- while (removals.length) {
- let domForRemoval = removals.pop()
+ // We need to collect the "removals" first before actually
+ // removing them so we don't mess with the order of things.
+ while (currentFrom) {
+ if(! shouldSkip(removing, currentFrom)) removals.push(currentFrom)
- domForRemoval.remove()
+ currentFrom = dom(currentFrom).nodes().next()
+ }
- await breakpoint('remove el')
+ // Now we can do the actual removals.
+ while (removals.length) {
+ let domForRemoval = removals.shift()
- removed(domForRemoval)
- }
-}
+ domForRemoval.remove()
-function getKey(el) {
- return el && el.nodeType === 1 && key(el)
-}
+ await breakpoint('remove el')
-function keyToMap(els) {
- let map = {}
+ removed(domForRemoval)
+ }
+ }
- els.forEach(el => {
- let theKey = getKey(el)
+ function getKey(el) {
+ return el && el.nodeType === 1 && key(el)
+ }
- if (theKey) {
- map[theKey] = el
- }
- })
+ function keyToMap(els) {
+ let map = {}
- return map
-}
+ els.forEach(el => {
+ let theKey = getKey(el)
-function shouldSkip(hook, ...args) {
- let skip = false
+ if (theKey) {
+ map[theKey] = el
+ }
+ })
- hook(...args, () => skip = true)
+ return map
+ }
- return skip
-}
+ function addNodeTo(node, parent) {
+ if(! shouldSkip(adding, node)) {
+ let clone = node.cloneNode(true)
-function addNodeTo(node, parent) {
- if(! shouldSkip(adding, node)) {
- let clone = node.cloneNode(true)
+ dom(parent).append(clone)
- dom(parent).append(clone)
+ added(clone)
- added(clone)
+ return clone
+ }
- return clone
+ return null;
}
- return null;
-}
+ function addNodeBefore(node, beforeMe) {
+ if(! shouldSkip(adding, node)) {
+ let clone = node.cloneNode(true)
-function addNodeBefore(node, beforeMe) {
- if(! shouldSkip(adding, node)) {
- let clone = node.cloneNode(true)
+ dom(beforeMe).before(clone)
- dom(beforeMe).before(clone)
+ added(clone)
- added(clone)
+ return clone
+ }
- return clone
+ return beforeMe
}
- return beforeMe
-}
+ // Finally we morph the element
-function initializeAlpineOnTo(from, to, childrenOnly) {
- if (from.nodeType !== 1) return
-
- // If the element we are updating is an Alpine component...
- if (from._x_dataStack) {
- // Then temporarily clone it (with it's data) to the "to" element.
- // This should simulate backend Livewire being aware of Alpine changes.
- window.Alpine.clone(from, to)
- }
-}
+ assignOptions(options)
-function dom(el) {
- return new DomManager(el)
-}
+ fromEl = from
+ toEl = createElement(toHtml)
-class DomManager {
- el = undefined
+ // If there is no x-data on the element we're morphing,
+ // let's seed it with the outer Alpine scope on the page.
+ if (window.Alpine && window.Alpine.closestDataStack && ! from._x_dataStack) {
+ toEl._x_dataStack = window.Alpine.closestDataStack(from)
- constructor(el) {
- this.el = el
+ toEl._x_dataStack && window.Alpine.clone(from, toEl)
}
- traversals = {
- 'first': 'firstElementChild',
- 'next': 'nextElementSibling',
- 'parent': 'parentElement',
- }
+ await breakpoint()
- nodes() {
- this.traversals = {
- 'first': 'firstChild',
- 'next': 'nextSibling',
- 'parent': 'parentNode',
- }; return this
- }
+ await patch(from, toEl)
- first() {
- return this.teleportTo(this.el[this.traversals['first']])
- }
+ // Release these for the garbage collector.
+ fromEl = undefined
+ toEl = undefined
- next() {
- return this.teleportTo(this.teleportBack(this.el[this.traversals['next']]))
- }
+ return from
+}
- before(insertee) {
- this.el[this.traversals['parent']].insertBefore(insertee, this.el); return insertee
- }
+morph.step = () => resolveStep()
+morph.log = (theLogger) => {
+ logger = theLogger
+}
- replace(replacement) {
- this.el[this.traversals['parent']].replaceChild(replacement, this.el); return replacement
- }
+function shouldSkip(hook, ...args) {
+ let skip = false
- append(appendee) {
- this.el.appendChild(appendee); return appendee
- }
+ hook(...args, () => skip = true)
- teleportTo(el) {
- if (! el) return el
- if (el._x_teleport) return el._x_teleport
- return el
- }
+ return skip
+}
- teleportBack(el) {
- if (! el) return el
- if (el._x_teleportBack) return el._x_teleportBack
- return el
+function initializeAlpineOnTo(from, to, childrenOnly) {
+ if (from.nodeType !== 1) return
+
+ // If the element we are updating is an Alpine component...
+ if (from._x_dataStack) {
+ // Then temporarily clone it (with it's data) to the "to" element.
+ // This should simulate backend Livewire being aware of Alpine changes.
+ window.Alpine.clone(from, to)
}
}
diff --git a/alpinejs/packages/persist/package.json b/alpinejs/packages/persist/package.json
index f0ca184..72894b7 100644
--- a/alpinejs/packages/persist/package.json
+++ b/alpinejs/packages/persist/package.json
@@ -1,6 +1,6 @@
{
"name": "@alpinejs/persist",
- "version": "3.9.1",
+ "version": "3.10.2",
"description": "Persist Alpine data across page loads",
"author": "Caleb Porzio",
"license": "MIT",
diff --git a/alpinejs/packages/trap/dist/cdn.js b/alpinejs/packages/trap/dist/cdn.js
deleted file mode 100644
index 8d2b40b..0000000
--- a/alpinejs/packages/trap/dist/cdn.js
+++ /dev/null
@@ -1,700 +0,0 @@
-(() => {
- // node_modules/tabbable/dist/index.esm.js
- /*!
- * tabbable 5.2.1
- * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
- */
- var candidateSelectors = ["input", "select", "textarea", "a[href]", "button", "[tabindex]", "audio[controls]", "video[controls]", '[contenteditable]:not([contenteditable="false"])', "details>summary:first-of-type", "details"];
- var candidateSelector = /* @__PURE__ */ candidateSelectors.join(",");
- var matches = typeof Element === "undefined" ? function() {
- } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
- var getCandidates = function getCandidates2(el, includeContainer, filter) {
- var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
- if (includeContainer && matches.call(el, candidateSelector)) {
- candidates.unshift(el);
- }
- candidates = candidates.filter(filter);
- return candidates;
- };
- var isContentEditable = function isContentEditable2(node) {
- return node.contentEditable === "true";
- };
- var getTabindex = function getTabindex2(node) {
- var tabindexAttr = parseInt(node.getAttribute("tabindex"), 10);
- if (!isNaN(tabindexAttr)) {
- return tabindexAttr;
- }
- if (isContentEditable(node)) {
- return 0;
- }
- if ((node.nodeName === "AUDIO" || node.nodeName === "VIDEO" || node.nodeName === "DETAILS") && node.getAttribute("tabindex") === null) {
- return 0;
- }
- return node.tabIndex;
- };
- var sortOrderedTabbables = function sortOrderedTabbables2(a, b) {
- return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
- };
- var isInput = function isInput2(node) {
- return node.tagName === "INPUT";
- };
- var isHiddenInput = function isHiddenInput2(node) {
- return isInput(node) && node.type === "hidden";
- };
- var isDetailsWithSummary = function isDetailsWithSummary2(node) {
- var r = node.tagName === "DETAILS" && Array.prototype.slice.apply(node.children).some(function(child) {
- return child.tagName === "SUMMARY";
- });
- return r;
- };
- var getCheckedRadio = function getCheckedRadio2(nodes, form) {
- for (var i = 0; i < nodes.length; i++) {
- if (nodes[i].checked && nodes[i].form === form) {
- return nodes[i];
- }
- }
- };
- var isTabbableRadio = function isTabbableRadio2(node) {
- if (!node.name) {
- return true;
- }
- var radioScope = node.form || node.ownerDocument;
- var queryRadios = function queryRadios2(name) {
- return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');
- };
- var radioSet;
- if (typeof window !== "undefined" && typeof window.CSS !== "undefined" && typeof window.CSS.escape === "function") {
- radioSet = queryRadios(window.CSS.escape(node.name));
- } else {
- try {
- radioSet = queryRadios(node.name);
- } catch (err) {
- console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", err.message);
- return false;
- }
- }
- var checked = getCheckedRadio(radioSet, node.form);
- return !checked || checked === node;
- };
- var isRadio = function isRadio2(node) {
- return isInput(node) && node.type === "radio";
- };
- var isNonTabbableRadio = function isNonTabbableRadio2(node) {
- return isRadio(node) && !isTabbableRadio(node);
- };
- var isHidden = function isHidden2(node, displayCheck) {
- if (getComputedStyle(node).visibility === "hidden") {
- return true;
- }
- var isDirectSummary = matches.call(node, "details>summary:first-of-type");
- var nodeUnderDetails = isDirectSummary ? node.parentElement : node;
- if (matches.call(nodeUnderDetails, "details:not([open]) *")) {
- return true;
- }
- if (!displayCheck || displayCheck === "full") {
- while (node) {
- if (getComputedStyle(node).display === "none") {
- return true;
- }
- node = node.parentElement;
- }
- } else if (displayCheck === "non-zero-area") {
- var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height;
- return width === 0 && height === 0;
- }
- return false;
- };
- var isDisabledFromFieldset = function isDisabledFromFieldset2(node) {
- if (isInput(node) || node.tagName === "SELECT" || node.tagName === "TEXTAREA" || node.tagName === "BUTTON") {
- var parentNode = node.parentElement;
- while (parentNode) {
- if (parentNode.tagName === "FIELDSET" && parentNode.disabled) {
- for (var i = 0; i < parentNode.children.length; i++) {
- var child = parentNode.children.item(i);
- if (child.tagName === "LEGEND") {
- if (child.contains(node)) {
- return false;
- }
- return true;
- }
- }
- return true;
- }
- parentNode = parentNode.parentElement;
- }
- }
- return false;
- };
- var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable2(options, node) {
- if (node.disabled || isHiddenInput(node) || isHidden(node, options.displayCheck) || isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
- return false;
- }
- return true;
- };
- var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable2(options, node) {
- if (!isNodeMatchingSelectorFocusable(options, node) || isNonTabbableRadio(node) || getTabindex(node) < 0) {
- return false;
- }
- return true;
- };
- var tabbable = function tabbable2(el, options) {
- options = options || {};
- var regularTabbables = [];
- var orderedTabbables = [];
- var candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
- candidates.forEach(function(candidate, i) {
- var candidateTabindex = getTabindex(candidate);
- if (candidateTabindex === 0) {
- regularTabbables.push(candidate);
- } else {
- orderedTabbables.push({
- documentOrder: i,
- tabIndex: candidateTabindex,
- node: candidate
- });
- }
- });
- var tabbableNodes = orderedTabbables.sort(sortOrderedTabbables).map(function(a) {
- return a.node;
- }).concat(regularTabbables);
- return tabbableNodes;
- };
- var focusableCandidateSelector = /* @__PURE__ */ candidateSelectors.concat("iframe").join(",");
- var isFocusable = function isFocusable2(node, options) {
- options = options || {};
- if (!node) {
- throw new Error("No node provided");
- }
- if (matches.call(node, focusableCandidateSelector) === false) {
- return false;
- }
- return isNodeMatchingSelectorFocusable(options, node);
- };
-
- // node_modules/focus-trap/dist/focus-trap.esm.js
- /*!
- * focus-trap 6.6.1
- * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
- */
- function ownKeys(object, enumerableOnly) {
- var keys = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- if (enumerableOnly) {
- symbols = symbols.filter(function(sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- });
- }
- keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpread2(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i] != null ? arguments[i] : {};
- if (i % 2) {
- ownKeys(Object(source), true).forEach(function(key) {
- _defineProperty(target, key, source[key]);
- });
- } else if (Object.getOwnPropertyDescriptors) {
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
- } else {
- ownKeys(Object(source)).forEach(function(key) {
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
- });
- }
- }
- return target;
- }
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- var activeFocusTraps = function() {
- var trapQueue = [];
- return {
- activateTrap: function activateTrap(trap) {
- if (trapQueue.length > 0) {
- var activeTrap = trapQueue[trapQueue.length - 1];
- if (activeTrap !== trap) {
- activeTrap.pause();
- }
- }
- var trapIndex = trapQueue.indexOf(trap);
- if (trapIndex === -1) {
- trapQueue.push(trap);
- } else {
- trapQueue.splice(trapIndex, 1);
- trapQueue.push(trap);
- }
- },
- deactivateTrap: function deactivateTrap(trap) {
- var trapIndex = trapQueue.indexOf(trap);
- if (trapIndex !== -1) {
- trapQueue.splice(trapIndex, 1);
- }
- if (trapQueue.length > 0) {
- trapQueue[trapQueue.length - 1].unpause();
- }
- }
- };
- }();
- var isSelectableInput = function isSelectableInput2(node) {
- return node.tagName && node.tagName.toLowerCase() === "input" && typeof node.select === "function";
- };
- var isEscapeEvent = function isEscapeEvent2(e) {
- return e.key === "Escape" || e.key === "Esc" || e.keyCode === 27;
- };
- var isTabEvent = function isTabEvent2(e) {
- return e.key === "Tab" || e.keyCode === 9;
- };
- var delay = function delay2(fn) {
- return setTimeout(fn, 0);
- };
- var findIndex = function findIndex2(arr, fn) {
- var idx = -1;
- arr.every(function(value, i) {
- if (fn(value)) {
- idx = i;
- return false;
- }
- return true;
- });
- return idx;
- };
- var valueOrHandler = function valueOrHandler2(value) {
- for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- params[_key - 1] = arguments[_key];
- }
- return typeof value === "function" ? value.apply(void 0, params) : value;
- };
- var createFocusTrap = function createFocusTrap2(elements, userOptions) {
- var doc = document;
- var config = _objectSpread2({
- returnFocusOnDeactivate: true,
- escapeDeactivates: true,
- delayInitialFocus: true
- }, userOptions);
- var state = {
- containers: [],
- tabbableGroups: [],
- nodeFocusedBeforeActivation: null,
- mostRecentlyFocusedNode: null,
- active: false,
- paused: false,
- delayInitialFocusTimer: void 0
- };
- var trap;
- var getOption = function getOption2(configOverrideOptions, optionName, configOptionName) {
- return configOverrideOptions && configOverrideOptions[optionName] !== void 0 ? configOverrideOptions[optionName] : config[configOptionName || optionName];
- };
- var containersContain = function containersContain2(element) {
- return state.containers.some(function(container) {
- return container.contains(element);
- });
- };
- var getNodeForOption = function getNodeForOption2(optionName) {
- var optionValue = config[optionName];
- if (!optionValue) {
- return null;
- }
- var node = optionValue;
- if (typeof optionValue === "string") {
- node = doc.querySelector(optionValue);
- if (!node) {
- throw new Error("`".concat(optionName, "` refers to no known node"));
- }
- }
- if (typeof optionValue === "function") {
- node = optionValue();
- if (!node) {
- throw new Error("`".concat(optionName, "` did not return a node"));
- }
- }
- return node;
- };
- var getInitialFocusNode = function getInitialFocusNode2() {
- var node;
- if (getOption({}, "initialFocus") === false) {
- return false;
- }
- if (getNodeForOption("initialFocus") !== null) {
- node = getNodeForOption("initialFocus");
- } else if (containersContain(doc.activeElement)) {
- node = doc.activeElement;
- } else {
- var firstTabbableGroup = state.tabbableGroups[0];
- var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode;
- node = firstTabbableNode || getNodeForOption("fallbackFocus");
- }
- if (!node) {
- throw new Error("Your focus-trap needs to have at least one focusable element");
- }
- return node;
- };
- var updateTabbableNodes = function updateTabbableNodes2() {
- state.tabbableGroups = state.containers.map(function(container) {
- var tabbableNodes = tabbable(container);
- if (tabbableNodes.length > 0) {
- return {
- container,
- firstTabbableNode: tabbableNodes[0],
- lastTabbableNode: tabbableNodes[tabbableNodes.length - 1]
- };
- }
- return void 0;
- }).filter(function(group) {
- return !!group;
- });
- if (state.tabbableGroups.length <= 0 && !getNodeForOption("fallbackFocus")) {
- throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");
- }
- };
- var tryFocus = function tryFocus2(node) {
- if (node === false) {
- return;
- }
- if (node === doc.activeElement) {
- return;
- }
- if (!node || !node.focus) {
- tryFocus2(getInitialFocusNode());
- return;
- }
- node.focus({
- preventScroll: !!config.preventScroll
- });
- state.mostRecentlyFocusedNode = node;
- if (isSelectableInput(node)) {
- node.select();
- }
- };
- var getReturnFocusNode = function getReturnFocusNode2(previousActiveElement) {
- var node = getNodeForOption("setReturnFocus");
- return node ? node : previousActiveElement;
- };
- var checkPointerDown = function checkPointerDown2(e) {
- if (containersContain(e.target)) {
- return;
- }
- if (valueOrHandler(config.clickOutsideDeactivates, e)) {
- trap.deactivate({
- returnFocus: config.returnFocusOnDeactivate && !isFocusable(e.target)
- });
- return;
- }
- if (valueOrHandler(config.allowOutsideClick, e)) {
- return;
- }
- e.preventDefault();
- };
- var checkFocusIn = function checkFocusIn2(e) {
- var targetContained = containersContain(e.target);
- if (targetContained || e.target instanceof Document) {
- if (targetContained) {
- state.mostRecentlyFocusedNode = e.target;
- }
- } else {
- e.stopImmediatePropagation();
- tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
- }
- };
- var checkTab = function checkTab2(e) {
- updateTabbableNodes();
- var destinationNode = null;
- if (state.tabbableGroups.length > 0) {
- var containerIndex = findIndex(state.tabbableGroups, function(_ref) {
- var container = _ref.container;
- return container.contains(e.target);
- });
- if (containerIndex < 0) {
- if (e.shiftKey) {
- destinationNode = state.tabbableGroups[state.tabbableGroups.length - 1].lastTabbableNode;
- } else {
- destinationNode = state.tabbableGroups[0].firstTabbableNode;
- }
- } else if (e.shiftKey) {
- var startOfGroupIndex = findIndex(state.tabbableGroups, function(_ref2) {
- var firstTabbableNode = _ref2.firstTabbableNode;
- return e.target === firstTabbableNode;
- });
- if (startOfGroupIndex < 0 && state.tabbableGroups[containerIndex].container === e.target) {
- startOfGroupIndex = containerIndex;
- }
- if (startOfGroupIndex >= 0) {
- var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
- var destinationGroup = state.tabbableGroups[destinationGroupIndex];
- destinationNode = destinationGroup.lastTabbableNode;
- }
- } else {
- var lastOfGroupIndex = findIndex(state.tabbableGroups, function(_ref3) {
- var lastTabbableNode = _ref3.lastTabbableNode;
- return e.target === lastTabbableNode;
- });
- if (lastOfGroupIndex < 0 && state.tabbableGroups[containerIndex].container === e.target) {
- lastOfGroupIndex = containerIndex;
- }
- if (lastOfGroupIndex >= 0) {
- var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
- var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
- destinationNode = _destinationGroup.firstTabbableNode;
- }
- }
- } else {
- destinationNode = getNodeForOption("fallbackFocus");
- }
- if (destinationNode) {
- e.preventDefault();
- tryFocus(destinationNode);
- }
- };
- var checkKey = function checkKey2(e) {
- if (isEscapeEvent(e) && valueOrHandler(config.escapeDeactivates) !== false) {
- e.preventDefault();
- trap.deactivate();
- return;
- }
- if (isTabEvent(e)) {
- checkTab(e);
- return;
- }
- };
- var checkClick = function checkClick2(e) {
- if (valueOrHandler(config.clickOutsideDeactivates, e)) {
- return;
- }
- if (containersContain(e.target)) {
- return;
- }
- if (valueOrHandler(config.allowOutsideClick, e)) {
- return;
- }
- e.preventDefault();
- e.stopImmediatePropagation();
- };
- var addListeners = function addListeners2() {
- if (!state.active) {
- return;
- }
- activeFocusTraps.activateTrap(trap);
- state.delayInitialFocusTimer = config.delayInitialFocus ? delay(function() {
- tryFocus(getInitialFocusNode());
- }) : tryFocus(getInitialFocusNode());
- doc.addEventListener("focusin", checkFocusIn, true);
- doc.addEventListener("mousedown", checkPointerDown, {
- capture: true,
- passive: false
- });
- doc.addEventListener("touchstart", checkPointerDown, {
- capture: true,
- passive: false
- });
- doc.addEventListener("click", checkClick, {
- capture: true,
- passive: false
- });
- doc.addEventListener("keydown", checkKey, {
- capture: true,
- passive: false
- });
- return trap;
- };
- var removeListeners = function removeListeners2() {
- if (!state.active) {
- return;
- }
- doc.removeEventListener("focusin", checkFocusIn, true);
- doc.removeEventListener("mousedown", checkPointerDown, true);
- doc.removeEventListener("touchstart", checkPointerDown, true);
- doc.removeEventListener("click", checkClick, true);
- doc.removeEventListener("keydown", checkKey, true);
- return trap;
- };
- trap = {
- activate: function activate(activateOptions) {
- if (state.active) {
- return this;
- }
- var onActivate = getOption(activateOptions, "onActivate");
- var onPostActivate = getOption(activateOptions, "onPostActivate");
- var checkCanFocusTrap = getOption(activateOptions, "checkCanFocusTrap");
- if (!checkCanFocusTrap) {
- updateTabbableNodes();
- }
- state.active = true;
- state.paused = false;
- state.nodeFocusedBeforeActivation = doc.activeElement;
- if (onActivate) {
- onActivate();
- }
- var finishActivation = function finishActivation2() {
- if (checkCanFocusTrap) {
- updateTabbableNodes();
- }
- addListeners();
- if (onPostActivate) {
- onPostActivate();
- }
- };
- if (checkCanFocusTrap) {
- checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
- return this;
- }
- finishActivation();
- return this;
- },
- deactivate: function deactivate(deactivateOptions) {
- if (!state.active) {
- return this;
- }
- clearTimeout(state.delayInitialFocusTimer);
- state.delayInitialFocusTimer = void 0;
- removeListeners();
- state.active = false;
- state.paused = false;
- activeFocusTraps.deactivateTrap(trap);
- var onDeactivate = getOption(deactivateOptions, "onDeactivate");
- var onPostDeactivate = getOption(deactivateOptions, "onPostDeactivate");
- var checkCanReturnFocus = getOption(deactivateOptions, "checkCanReturnFocus");
- if (onDeactivate) {
- onDeactivate();
- }
- var returnFocus = getOption(deactivateOptions, "returnFocus", "returnFocusOnDeactivate");
- var finishDeactivation = function finishDeactivation2() {
- delay(function() {
- if (returnFocus) {
- tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
- }
- if (onPostDeactivate) {
- onPostDeactivate();
- }
- });
- };
- if (returnFocus && checkCanReturnFocus) {
- checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation, finishDeactivation);
- return this;
- }
- finishDeactivation();
- return this;
- },
- pause: function pause() {
- if (state.paused || !state.active) {
- return this;
- }
- state.paused = true;
- removeListeners();
- return this;
- },
- unpause: function unpause() {
- if (!state.paused || !state.active) {
- return this;
- }
- state.paused = false;
- updateTabbableNodes();
- addListeners();
- return this;
- },
- updateContainerElements: function updateContainerElements(containerElements) {
- var elementsAsArray = [].concat(containerElements).filter(Boolean);
- state.containers = elementsAsArray.map(function(element) {
- return typeof element === "string" ? doc.querySelector(element) : element;
- });
- if (state.active) {
- updateTabbableNodes();
- }
- return this;
- }
- };
- trap.updateContainerElements(elements);
- return trap;
- };
-
- // packages/trap/src/index.js
- function src_default(Alpine) {
- Alpine.directive("trap", Alpine.skipDuringClone((el, {expression, modifiers}, {effect, evaluateLater}) => {
- let evaluator = evaluateLater(expression);
- let oldValue = false;
- let trap = createFocusTrap(el, {
- escapeDeactivates: false,
- allowOutsideClick: true,
- fallbackFocus: () => el
- });
- let undoInert = () => {
- };
- let undoDisableScrolling = () => {
- };
- effect(() => evaluator((value) => {
- if (oldValue === value)
- return;
- if (value && !oldValue) {
- setTimeout(() => {
- if (modifiers.includes("inert"))
- undoInert = setInert(el);
- if (modifiers.includes("noscroll"))
- undoDisableScrolling = disableScrolling();
- trap.activate();
- });
- }
- if (!value && oldValue) {
- undoInert();
- undoInert = () => {
- };
- undoDisableScrolling();
- undoDisableScrolling = () => {
- };
- trap.deactivate();
- }
- oldValue = !!value;
- }));
- }, (el, {expression, modifiers}, {evaluate}) => {
- if (modifiers.includes("inert") && evaluate(expression))
- setInert(el);
- }));
- }
- function setInert(el) {
- let undos = [];
- crawlSiblingsUp(el, (sibling) => {
- let cache = sibling.hasAttribute("aria-hidden");
- sibling.setAttribute("aria-hidden", "true");
- undos.push(() => cache || sibling.removeAttribute("aria-hidden"));
- });
- return () => {
- while (undos.length)
- undos.pop()();
- };
- }
- function crawlSiblingsUp(el, callback) {
- if (el.isSameNode(document.body) || !el.parentNode)
- return;
- Array.from(el.parentNode.children).forEach((sibling) => {
- if (!sibling.isSameNode(el))
- callback(sibling);
- crawlSiblingsUp(el.parentNode, callback);
- });
- }
- function disableScrolling() {
- let overflow = document.documentElement.style.overflow;
- let paddingRight = document.documentElement.style.paddingRight;
- let scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
- document.documentElement.style.overflow = "hidden";
- document.documentElement.style.paddingRight = `${scrollbarWidth}px`;
- return () => {
- document.documentElement.style.overflow = overflow;
- document.documentElement.style.paddingRight = paddingRight;
- };
- }
-
- // packages/trap/builds/cdn.js
- document.addEventListener("alpine:init", () => {
- window.Alpine.plugin(src_default);
- });
-})();
diff --git a/alpinejs/packages/trap/dist/cdn.min.js b/alpinejs/packages/trap/dist/cdn.min.js
deleted file mode 100644
index a0e71bf..0000000
--- a/alpinejs/packages/trap/dist/cdn.min.js
+++ /dev/null
@@ -1,9 +0,0 @@
-(()=>{var P=["input","select","textarea","a[href]","button","[tabindex]","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"],x=P.join(","),S=typeof Element=="undefined"?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,J=function(e,t,a){var u=Array.prototype.slice.apply(e.querySelectorAll(x));return t&&S.call(e,x)&&u.unshift(e),u=u.filter(a),u},Z=function(e){return e.contentEditable==="true"},j=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return isNaN(t)?Z(e)||(e.nodeName==="AUDIO"||e.nodeName==="VIDEO"||e.nodeName==="DETAILS")&&e.getAttribute("tabindex")===null?0:e.tabIndex:t},$=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},D=function(e){return e.tagName==="INPUT"},_=function(e){return D(e)&&e.type==="hidden"},ee=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(a){return a.tagName==="SUMMARY"});return t},te=function(e,t){for(var a=0;a<e.length;a++)if(e[a].checked&&e[a].form===t)return e[a]},re=function(e){if(!e.name)return!0;var t=e.form||e.ownerDocument,a=function(s){return t.querySelectorAll('input[type="radio"][name="'+s+'"]')},u;if(typeof window!="undefined"&&typeof window.CSS!="undefined"&&typeof window.CSS.escape=="function")u=a(window.CSS.escape(e.name));else try{u=a(e.name)}catch(f){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",f.message),!1}var i=te(u,e.form);return!i||i===e},ae=function(e){return D(e)&&e.type==="radio"},ne=function(e){return ae(e)&&!re(e)},ie=function(e,t){if(getComputedStyle(e).visibility==="hidden")return!0;var a=S.call(e,"details>summary:first-of-type"),u=a?e.parentElement:e;if(S.call(u,"details:not([open]) *"))return!0;if(!t||t==="full")for(;e;){if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}else if(t==="non-zero-area"){var i=e.getBoundingClientRect(),f=i.width,s=i.height;return f===0&&s===0}return!1},ue=function(e){if(D(e)||e.tagName==="SELECT"||e.tagName==="TEXTAREA"||e.tagName==="BUTTON")for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var a=0;a<t.children.length;a++){var u=t.children.item(a);if(u.tagName==="LEGEND")return!u.contains(e)}return!0}t=t.parentElement}return!1},G=function(e,t){return!(t.disabled||_(t)||ie(t,e.displayCheck)||ee(t)||ue(t))},oe=function(e,t){return!(!G(e,t)||ne(t)||j(t)<0)},M=function(e,t){t=t||{};var a=[],u=[],i=J(e,t.includeContainer,oe.bind(null,t));i.forEach(function(s,p){var d=j(s);d===0?a.push(s):u.push({documentOrder:p,tabIndex:d,node:s})});var f=u.sort($).map(function(s){return s.node}).concat(a);return f};var ce=P.concat("iframe").join(","),q=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return S.call(e,ce)===!1?!1:G(t,e)};function B(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);e&&(a=a.filter(function(u){return Object.getOwnPropertyDescriptor(n,u).enumerable})),t.push.apply(t,a)}return t}function le(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?B(Object(t),!0).forEach(function(a){se(n,a,t[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):B(Object(t)).forEach(function(a){Object.defineProperty(n,a,Object.getOwnPropertyDescriptor(t,a))})}return n}function se(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}var H=function(){var n=[];return{activateTrap:function(t){if(n.length>0){var a=n[n.length-1];a!==t&&a.pause()}var u=n.indexOf(t);u===-1||n.splice(u,1),n.push(t)},deactivateTrap:function(t){var a=n.indexOf(t);a!==-1&&n.splice(a,1),n.length>0&&n[n.length-1].unpause()}}}(),fe=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},de=function(e){return e.key==="Escape"||e.key==="Esc"||e.keyCode===27},be=function(e){return e.key==="Tab"||e.keyCode===9},U=function(e){return setTimeout(e,0)},k=function(e,t){var a=-1;return e.every(function(u,i){return t(u)?(a=i,!1):!0}),a},F=function(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),u=1;u<t;u++)a[u-1]=arguments[u];return typeof e=="function"?e.apply(void 0,a):e},K=function(e,t){var a=document,u=le({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0},t),i={containers:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0},f,s=function(r,o,c){return r&&r[o]!==void 0?r[o]:u[c||o]},p=function(r){return i.containers.some(function(o){return o.contains(r)})},d=function(r){var o=u[r];if(!o)return null;var c=o;if(typeof o=="string"&&(c=a.querySelector(o),!c))throw new Error("`".concat(r,"` refers to no known node"));if(typeof o=="function"&&(c=o(),!c))throw new Error("`".concat(r,"` did not return a node"));return c},m=function(){var r;if(s({},"initialFocus")===!1)return!1;if(d("initialFocus")!==null)r=d("initialFocus");else if(p(a.activeElement))r=a.activeElement;else{var o=i.tabbableGroups[0],c=o&&o.firstTabbableNode;r=c||d("fallbackFocus")}if(!r)throw new Error("Your focus-trap needs to have at least one focusable element");return r},v=function(){if(i.tabbableGroups=i.containers.map(function(r){var o=M(r);if(o.length>0)return{container:r,firstTabbableNode:o[0],lastTabbableNode:o[o.length-1]}}).filter(function(r){return!!r}),i.tabbableGroups.length<=0&&!d("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")},E=function l(r){if(r!==!1&&r!==a.activeElement){if(!r||!r.focus){l(m());return}r.focus({preventScroll:!!u.preventScroll}),i.mostRecentlyFocusedNode=r,fe(r)&&r.select()}},C=function(r){var o=d("setReturnFocus");return o||r},N=function(r){if(!p(r.target)){if(F(u.clickOutsideDeactivates,r)){f.deactivate({returnFocus:u.returnFocusOnDeactivate&&!q(r.target)});return}F(u.allowOutsideClick,r)||r.preventDefault()}},A=function(r){var o=p(r.target);o||r.target instanceof Document?o&&(i.mostRecentlyFocusedNode=r.target):(r.stopImmediatePropagation(),E(i.mostRecentlyFocusedNode||m()))},z=function(r){v();var o=null;if(i.tabbableGroups.length>0){var c=k(i.tabbableGroups,function(T){var w=T.container;return w.contains(r.target)});if(c<0)r.shiftKey?o=i.tabbableGroups[i.tabbableGroups.length-1].lastTabbableNode:o=i.tabbableGroups[0].firstTabbableNode;else if(r.shiftKey){var b=k(i.tabbableGroups,function(T){var w=T.firstTabbableNode;return r.target===w});if(b<0&&i.tabbableGroups[c].container===r.target&&(b=c),b>=0){var h=b===0?i.tabbableGroups.length-1:b-1,g=i.tabbableGroups[h];o=g.lastTabbableNode}}else{var y=k(i.tabbableGroups,function(T){var w=T.lastTabbableNode;return r.target===w});if(y<0&&i.tabbableGroups[c].container===r.target&&(y=c),y>=0){var Q=y===i.tabbableGroups.length-1?0:y+1,X=i.tabbableGroups[Q];o=X.firstTabbableNode}}}else o=d("fallbackFocus");o&&(r.preventDefault(),E(o))},R=function(r){if(de(r)&&F(u.escapeDeactivates)!==!1){r.preventDefault(),f.deactivate();return}if(be(r)){z(r);return}},I=function(r){F(u.clickOutsideDeactivates,r)||p(r.target)||F(u.allowOutsideClick,r)||(r.preventDefault(),r.stopImmediatePropagation())},O=function(){if(!!i.active)return H.activateTrap(f),i.delayInitialFocusTimer=u.delayInitialFocus?U(function(){E(m())}):E(m()),a.addEventListener("focusin",A,!0),a.addEventListener("mousedown",N,{capture:!0,passive:!1}),a.addEventListener("touchstart",N,{capture:!0,passive:!1}),a.addEventListener("click",I,{capture:!0,passive:!1}),a.addEventListener("keydown",R,{capture:!0,passive:!1}),f},L=function(){if(!!i.active)return a.removeEventListener("focusin",A,!0),a.removeEventListener("mousedown",N,!0),a.removeEventListener("touchstart",N,!0),a.removeEventListener("click",I,!0),a.removeEventListener("keydown",R,!0),f};return f={activate:function(r){if(i.active)return this;var o=s(r,"onActivate"),c=s(r,"onPostActivate"),b=s(r,"checkCanFocusTrap");b||v(),i.active=!0,i.paused=!1,i.nodeFocusedBeforeActivation=a.activeElement,o&&o();var h=function(){b&&v(),O(),c&&c()};return b?(b(i.containers.concat()).then(h,h),this):(h(),this)},deactivate:function(r){if(!i.active)return this;clearTimeout(i.delayInitialFocusTimer),i.delayInitialFocusTimer=void 0,L(),i.active=!1,i.paused=!1,H.deactivateTrap(f);var o=s(r,"onDeactivate"),c=s(r,"onPostDeactivate"),b=s(r,"checkCanReturnFocus");o&&o();var h=s(r,"returnFocus","returnFocusOnDeactivate"),g=function(){U(function(){h&&E(C(i.nodeFocusedBeforeActivation)),c&&c()})};return h&&b?(b(C(i.nodeFocusedBeforeActivation)).then(g,g),this):(g(),this)},pause:function(){return i.paused||!i.active?this:(i.paused=!0,L(),this)},unpause:function(){return!i.paused||!i.active?this:(i.paused=!1,v(),O(),this)},updateContainerElements:function(r){var o=[].concat(r).filter(Boolean);return i.containers=o.map(function(c){return typeof c=="string"?a.querySelector(c):c}),i.active&&v(),this}},f.updateContainerElements(e),f};function V(n){n.directive("trap",n.skipDuringClone((e,{expression:t,modifiers:a},{effect:u,evaluateLater:i})=>{let f=i(t),s=!1,p=K(e,{escapeDeactivates:!1,allowOutsideClick:!0,fallbackFocus:()=>e}),d=()=>{},m=()=>{};u(()=>f(v=>{s!==v&&(v&&!s&&setTimeout(()=>{a.includes("inert")&&(d=W(e)),a.includes("noscroll")&&(m=ve()),p.activate()}),!v&&s&&(d(),d=()=>{},m(),m=()=>{},p.deactivate()),s=!!v)}))},(e,{expression:t,modifiers:a},{evaluate:u})=>{a.includes("inert")&&u(t)&&W(e)}))}function W(n){let e=[];return Y(n,t=>{let a=t.hasAttribute("aria-hidden");t.setAttribute("aria-hidden","true"),e.push(()=>a||t.removeAttribute("aria-hidden"))}),()=>{for(;e.length;)e.pop()()}}function Y(n,e){n.isSameNode(document.body)||!n.parentNode||Array.from(n.parentNode.children).forEach(t=>{t.isSameNode(n)||e(t),Y(n.parentNode,e)})}function ve(){let n=document.documentElement.style.overflow,e=document.documentElement.style.paddingRight,t=window.innerWidth-document.documentElement.clientWidth;return document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=`${t}px`,()=>{document.documentElement.style.overflow=n,document.documentElement.style.paddingRight=e}}document.addEventListener("alpine:init",()=>{window.Alpine.plugin(V)});})();
-/*!
-* focus-trap 6.6.1
-* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
-*/
-/*!
-* tabbable 5.2.1
-* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
-*/
diff --git a/alpinejs/packages/trap/dist/module.cjs.js b/alpinejs/packages/trap/dist/module.cjs.js
deleted file mode 100644
index 86c121e..0000000
--- a/alpinejs/packages/trap/dist/module.cjs.js
+++ /dev/null
@@ -1,762 +0,0 @@
-var __create = Object.create;
-var __defProp = Object.defineProperty;
-var __getProtoOf = Object.getPrototypeOf;
-var __hasOwnProp = Object.prototype.hasOwnProperty;
-var __getOwnPropNames = Object.getOwnPropertyNames;
-var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
-var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
-var __commonJS = (callback, module2) => () => {
- if (!module2) {
- module2 = {exports: {}};
- callback(module2.exports, module2);
- }
- return module2.exports;
-};
-var __export = (target, all) => {
- for (var name in all)
- __defProp(target, name, {get: all[name], enumerable: true});
-};
-var __exportStar = (target, module2, desc) => {
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
- for (let key of __getOwnPropNames(module2))
- if (!__hasOwnProp.call(target, key) && key !== "default")
- __defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
- }
- return target;
-};
-var __toModule = (module2) => {
- return __exportStar(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
-};
-
-// node_modules/tabbable/dist/index.js
-var require_dist = __commonJS((exports2) => {
- /*!
- * tabbable 5.2.1
- * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
- */
- "use strict";
- Object.defineProperty(exports2, "__esModule", {value: true});
- var candidateSelectors = ["input", "select", "textarea", "a[href]", "button", "[tabindex]", "audio[controls]", "video[controls]", '[contenteditable]:not([contenteditable="false"])', "details>summary:first-of-type", "details"];
- var candidateSelector = /* @__PURE__ */ candidateSelectors.join(",");
- var matches = typeof Element === "undefined" ? function() {
- } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
- var getCandidates = function getCandidates2(el, includeContainer, filter) {
- var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
- if (includeContainer && matches.call(el, candidateSelector)) {
- candidates.unshift(el);
- }
- candidates = candidates.filter(filter);
- return candidates;
- };
- var isContentEditable = function isContentEditable2(node) {
- return node.contentEditable === "true";
- };
- var getTabindex = function getTabindex2(node) {
- var tabindexAttr = parseInt(node.getAttribute("tabindex"), 10);
- if (!isNaN(tabindexAttr)) {
- return tabindexAttr;
- }
- if (isContentEditable(node)) {
- return 0;
- }
- if ((node.nodeName === "AUDIO" || node.nodeName === "VIDEO" || node.nodeName === "DETAILS") && node.getAttribute("tabindex") === null) {
- return 0;
- }
- return node.tabIndex;
- };
- var sortOrderedTabbables = function sortOrderedTabbables2(a, b) {
- return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
- };
- var isInput = function isInput2(node) {
- return node.tagName === "INPUT";
- };
- var isHiddenInput = function isHiddenInput2(node) {
- return isInput(node) && node.type === "hidden";
- };
- var isDetailsWithSummary = function isDetailsWithSummary2(node) {
- var r = node.tagName === "DETAILS" && Array.prototype.slice.apply(node.children).some(function(child) {
- return child.tagName === "SUMMARY";
- });
- return r;
- };
- var getCheckedRadio = function getCheckedRadio2(nodes, form) {
- for (var i = 0; i < nodes.length; i++) {
- if (nodes[i].checked && nodes[i].form === form) {
- return nodes[i];
- }
- }
- };
- var isTabbableRadio = function isTabbableRadio2(node) {
- if (!node.name) {
- return true;
- }
- var radioScope = node.form || node.ownerDocument;
- var queryRadios = function queryRadios2(name) {
- return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');
- };
- var radioSet;
- if (typeof window !== "undefined" && typeof window.CSS !== "undefined" && typeof window.CSS.escape === "function") {
- radioSet = queryRadios(window.CSS.escape(node.name));
- } else {
- try {
- radioSet = queryRadios(node.name);
- } catch (err) {
- console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", err.message);
- return false;
- }
- }
- var checked = getCheckedRadio(radioSet, node.form);
- return !checked || checked === node;
- };
- var isRadio = function isRadio2(node) {
- return isInput(node) && node.type === "radio";
- };
- var isNonTabbableRadio = function isNonTabbableRadio2(node) {
- return isRadio(node) && !isTabbableRadio(node);
- };
- var isHidden = function isHidden2(node, displayCheck) {
- if (getComputedStyle(node).visibility === "hidden") {
- return true;
- }
- var isDirectSummary = matches.call(node, "details>summary:first-of-type");
- var nodeUnderDetails = isDirectSummary ? node.parentElement : node;
- if (matches.call(nodeUnderDetails, "details:not([open]) *")) {
- return true;
- }
- if (!displayCheck || displayCheck === "full") {
- while (node) {
- if (getComputedStyle(node).display === "none") {
- return true;
- }
- node = node.parentElement;
- }
- } else if (displayCheck === "non-zero-area") {
- var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height;
- return width === 0 && height === 0;
- }
- return false;
- };
- var isDisabledFromFieldset = function isDisabledFromFieldset2(node) {
- if (isInput(node) || node.tagName === "SELECT" || node.tagName === "TEXTAREA" || node.tagName === "BUTTON") {
- var parentNode = node.parentElement;
- while (parentNode) {
- if (parentNode.tagName === "FIELDSET" && parentNode.disabled) {
- for (var i = 0; i < parentNode.children.length; i++) {
- var child = parentNode.children.item(i);
- if (child.tagName === "LEGEND") {
- if (child.contains(node)) {
- return false;
- }
- return true;
- }
- }
- return true;
- }
- parentNode = parentNode.parentElement;
- }
- }
- return false;
- };
- var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable2(options, node) {
- if (node.disabled || isHiddenInput(node) || isHidden(node, options.displayCheck) || isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
- return false;
- }
- return true;
- };
- var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable2(options, node) {
- if (!isNodeMatchingSelectorFocusable(options, node) || isNonTabbableRadio(node) || getTabindex(node) < 0) {
- return false;
- }
- return true;
- };
- var tabbable = function tabbable2(el, options) {
- options = options || {};
- var regularTabbables = [];
- var orderedTabbables = [];
- var candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
- candidates.forEach(function(candidate, i) {
- var candidateTabindex = getTabindex(candidate);
- if (candidateTabindex === 0) {
- regularTabbables.push(candidate);
- } else {
- orderedTabbables.push({
- documentOrder: i,
- tabIndex: candidateTabindex,
- node: candidate
- });
- }
- });
- var tabbableNodes = orderedTabbables.sort(sortOrderedTabbables).map(function(a) {
- return a.node;
- }).concat(regularTabbables);
- return tabbableNodes;
- };
- var focusable = function focusable2(el, options) {
- options = options || {};
- var candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));
- return candidates;
- };
- var isTabbable = function isTabbable2(node, options) {
- options = options || {};
- if (!node) {
- throw new Error("No node provided");
- }
- if (matches.call(node, candidateSelector) === false) {
- return false;
- }
- return isNodeMatchingSelectorTabbable(options, node);
- };
- var focusableCandidateSelector = /* @__PURE__ */ candidateSelectors.concat("iframe").join(",");
- var isFocusable = function isFocusable2(node, options) {
- options = options || {};
- if (!node) {
- throw new Error("No node provided");
- }
- if (matches.call(node, focusableCandidateSelector) === false) {
- return false;
- }
- return isNodeMatchingSelectorFocusable(options, node);
- };
- exports2.focusable = focusable;
- exports2.isFocusable = isFocusable;
- exports2.isTabbable = isTabbable;
- exports2.tabbable = tabbable;
-});
-
-// node_modules/focus-trap/dist/focus-trap.js
-var require_focus_trap = __commonJS((exports2) => {
- /*!
- * focus-trap 6.6.1
- * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
- */
- "use strict";
- Object.defineProperty(exports2, "__esModule", {value: true});
- var tabbable = require_dist();
- function ownKeys(object, enumerableOnly) {
- var keys = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- if (enumerableOnly) {
- symbols = symbols.filter(function(sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- });
- }
- keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpread2(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i] != null ? arguments[i] : {};
- if (i % 2) {
- ownKeys(Object(source), true).forEach(function(key) {
- _defineProperty(target, key, source[key]);
- });
- } else if (Object.getOwnPropertyDescriptors) {
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
- } else {
- ownKeys(Object(source)).forEach(function(key) {
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
- });
- }
- }
- return target;
- }
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- var activeFocusTraps = function() {
- var trapQueue = [];
- return {
- activateTrap: function activateTrap(trap) {
- if (trapQueue.length > 0) {
- var activeTrap = trapQueue[trapQueue.length - 1];
- if (activeTrap !== trap) {
- activeTrap.pause();
- }
- }
- var trapIndex = trapQueue.indexOf(trap);
- if (trapIndex === -1) {
- trapQueue.push(trap);
- } else {
- trapQueue.splice(trapIndex, 1);
- trapQueue.push(trap);
- }
- },
- deactivateTrap: function deactivateTrap(trap) {
- var trapIndex = trapQueue.indexOf(trap);
- if (trapIndex !== -1) {
- trapQueue.splice(trapIndex, 1);
- }
- if (trapQueue.length > 0) {
- trapQueue[trapQueue.length - 1].unpause();
- }
- }
- };
- }();
- var isSelectableInput = function isSelectableInput2(node) {
- return node.tagName && node.tagName.toLowerCase() === "input" && typeof node.select === "function";
- };
- var isEscapeEvent = function isEscapeEvent2(e) {
- return e.key === "Escape" || e.key === "Esc" || e.keyCode === 27;
- };
- var isTabEvent = function isTabEvent2(e) {
- return e.key === "Tab" || e.keyCode === 9;
- };
- var delay = function delay2(fn) {
- return setTimeout(fn, 0);
- };
- var findIndex = function findIndex2(arr, fn) {
- var idx = -1;
- arr.every(function(value, i) {
- if (fn(value)) {
- idx = i;
- return false;
- }
- return true;
- });
- return idx;
- };
- var valueOrHandler = function valueOrHandler2(value) {
- for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- params[_key - 1] = arguments[_key];
- }
- return typeof value === "function" ? value.apply(void 0, params) : value;
- };
- var createFocusTrap2 = function createFocusTrap3(elements, userOptions) {
- var doc = document;
- var config = _objectSpread2({
- returnFocusOnDeactivate: true,
- escapeDeactivates: true,
- delayInitialFocus: true
- }, userOptions);
- var state = {
- containers: [],
- tabbableGroups: [],
- nodeFocusedBeforeActivation: null,
- mostRecentlyFocusedNode: null,
- active: false,
- paused: false,
- delayInitialFocusTimer: void 0
- };
- var trap;
- var getOption = function getOption2(configOverrideOptions, optionName, configOptionName) {
- return configOverrideOptions && configOverrideOptions[optionName] !== void 0 ? configOverrideOptions[optionName] : config[configOptionName || optionName];
- };
- var containersContain = function containersContain2(element) {
- return state.containers.some(function(container) {
- return container.contains(element);
- });
- };
- var getNodeForOption = function getNodeForOption2(optionName) {
- var optionValue = config[optionName];
- if (!optionValue) {
- return null;
- }
- var node = optionValue;
- if (typeof optionValue === "string") {
- node = doc.querySelector(optionValue);
- if (!node) {
- throw new Error("`".concat(optionName, "` refers to no known node"));
- }
- }
- if (typeof optionValue === "function") {
- node = optionValue();
- if (!node) {
- throw new Error("`".concat(optionName, "` did not return a node"));
- }
- }
- return node;
- };
- var getInitialFocusNode = function getInitialFocusNode2() {
- var node;
- if (getOption({}, "initialFocus") === false) {
- return false;
- }
- if (getNodeForOption("initialFocus") !== null) {
- node = getNodeForOption("initialFocus");
- } else if (containersContain(doc.activeElement)) {
- node = doc.activeElement;
- } else {
- var firstTabbableGroup = state.tabbableGroups[0];
- var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode;
- node = firstTabbableNode || getNodeForOption("fallbackFocus");
- }
- if (!node) {
- throw new Error("Your focus-trap needs to have at least one focusable element");
- }
- return node;
- };
- var updateTabbableNodes = function updateTabbableNodes2() {
- state.tabbableGroups = state.containers.map(function(container) {
- var tabbableNodes = tabbable.tabbable(container);
- if (tabbableNodes.length > 0) {
- return {
- container,
- firstTabbableNode: tabbableNodes[0],
- lastTabbableNode: tabbableNodes[tabbableNodes.length - 1]
- };
- }
- return void 0;
- }).filter(function(group) {
- return !!group;
- });
- if (state.tabbableGroups.length <= 0 && !getNodeForOption("fallbackFocus")) {
- throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");
- }
- };
- var tryFocus = function tryFocus2(node) {
- if (node === false) {
- return;
- }
- if (node === doc.activeElement) {
- return;
- }
- if (!node || !node.focus) {
- tryFocus2(getInitialFocusNode());
- return;
- }
- node.focus({
- preventScroll: !!config.preventScroll
- });
- state.mostRecentlyFocusedNode = node;
- if (isSelectableInput(node)) {
- node.select();
- }
- };
- var getReturnFocusNode = function getReturnFocusNode2(previousActiveElement) {
- var node = getNodeForOption("setReturnFocus");
- return node ? node : previousActiveElement;
- };
- var checkPointerDown = function checkPointerDown2(e) {
- if (containersContain(e.target)) {
- return;
- }
- if (valueOrHandler(config.clickOutsideDeactivates, e)) {
- trap.deactivate({
- returnFocus: config.returnFocusOnDeactivate && !tabbable.isFocusable(e.target)
- });
- return;
- }
- if (valueOrHandler(config.allowOutsideClick, e)) {
- return;
- }
- e.preventDefault();
- };
- var checkFocusIn = function checkFocusIn2(e) {
- var targetContained = containersContain(e.target);
- if (targetContained || e.target instanceof Document) {
- if (targetContained) {
- state.mostRecentlyFocusedNode = e.target;
- }
- } else {
- e.stopImmediatePropagation();
- tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
- }
- };
- var checkTab = function checkTab2(e) {
- updateTabbableNodes();
- var destinationNode = null;
- if (state.tabbableGroups.length > 0) {
- var containerIndex = findIndex(state.tabbableGroups, function(_ref) {
- var container = _ref.container;
- return container.contains(e.target);
- });
- if (containerIndex < 0) {
- if (e.shiftKey) {
- destinationNode = state.tabbableGroups[state.tabbableGroups.length - 1].lastTabbableNode;
- } else {
- destinationNode = state.tabbableGroups[0].firstTabbableNode;
- }
- } else if (e.shiftKey) {
- var startOfGroupIndex = findIndex(state.tabbableGroups, function(_ref2) {
- var firstTabbableNode = _ref2.firstTabbableNode;
- return e.target === firstTabbableNode;
- });
- if (startOfGroupIndex < 0 && state.tabbableGroups[containerIndex].container === e.target) {
- startOfGroupIndex = containerIndex;
- }
- if (startOfGroupIndex >= 0) {
- var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
- var destinationGroup = state.tabbableGroups[destinationGroupIndex];
- destinationNode = destinationGroup.lastTabbableNode;
- }
- } else {
- var lastOfGroupIndex = findIndex(state.tabbableGroups, function(_ref3) {
- var lastTabbableNode = _ref3.lastTabbableNode;
- return e.target === lastTabbableNode;
- });
- if (lastOfGroupIndex < 0 && state.tabbableGroups[containerIndex].container === e.target) {
- lastOfGroupIndex = containerIndex;
- }
- if (lastOfGroupIndex >= 0) {
- var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
- var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
- destinationNode = _destinationGroup.firstTabbableNode;
- }
- }
- } else {
- destinationNode = getNodeForOption("fallbackFocus");
- }
- if (destinationNode) {
- e.preventDefault();
- tryFocus(destinationNode);
- }
- };
- var checkKey = function checkKey2(e) {
- if (isEscapeEvent(e) && valueOrHandler(config.escapeDeactivates) !== false) {
- e.preventDefault();
- trap.deactivate();
- return;
- }
- if (isTabEvent(e)) {
- checkTab(e);
- return;
- }
- };
- var checkClick = function checkClick2(e) {
- if (valueOrHandler(config.clickOutsideDeactivates, e)) {
- return;
- }
- if (containersContain(e.target)) {
- return;
- }
- if (valueOrHandler(config.allowOutsideClick, e)) {
- return;
- }
- e.preventDefault();
- e.stopImmediatePropagation();
- };
- var addListeners = function addListeners2() {
- if (!state.active) {
- return;
- }
- activeFocusTraps.activateTrap(trap);
- state.delayInitialFocusTimer = config.delayInitialFocus ? delay(function() {
- tryFocus(getInitialFocusNode());
- }) : tryFocus(getInitialFocusNode());
- doc.addEventListener("focusin", checkFocusIn, true);
- doc.addEventListener("mousedown", checkPointerDown, {
- capture: true,
- passive: false
- });
- doc.addEventListener("touchstart", checkPointerDown, {
- capture: true,
- passive: false
- });
- doc.addEventListener("click", checkClick, {
- capture: true,
- passive: false
- });
- doc.addEventListener("keydown", checkKey, {
- capture: true,
- passive: false
- });
- return trap;
- };
- var removeListeners = function removeListeners2() {
- if (!state.active) {
- return;
- }
- doc.removeEventListener("focusin", checkFocusIn, true);
- doc.removeEventListener("mousedown", checkPointerDown, true);
- doc.removeEventListener("touchstart", checkPointerDown, true);
- doc.removeEventListener("click", checkClick, true);
- doc.removeEventListener("keydown", checkKey, true);
- return trap;
- };
- trap = {
- activate: function activate(activateOptions) {
- if (state.active) {
- return this;
- }
- var onActivate = getOption(activateOptions, "onActivate");
- var onPostActivate = getOption(activateOptions, "onPostActivate");
- var checkCanFocusTrap = getOption(activateOptions, "checkCanFocusTrap");
- if (!checkCanFocusTrap) {
- updateTabbableNodes();
- }
- state.active = true;
- state.paused = false;
- state.nodeFocusedBeforeActivation = doc.activeElement;
- if (onActivate) {
- onActivate();
- }
- var finishActivation = function finishActivation2() {
- if (checkCanFocusTrap) {
- updateTabbableNodes();
- }
- addListeners();
- if (onPostActivate) {
- onPostActivate();
- }
- };
- if (checkCanFocusTrap) {
- checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
- return this;
- }
- finishActivation();
- return this;
- },
- deactivate: function deactivate(deactivateOptions) {
- if (!state.active) {
- return this;
- }
- clearTimeout(state.delayInitialFocusTimer);
- state.delayInitialFocusTimer = void 0;
- removeListeners();
- state.active = false;
- state.paused = false;
- activeFocusTraps.deactivateTrap(trap);
- var onDeactivate = getOption(deactivateOptions, "onDeactivate");
- var onPostDeactivate = getOption(deactivateOptions, "onPostDeactivate");
- var checkCanReturnFocus = getOption(deactivateOptions, "checkCanReturnFocus");
- if (onDeactivate) {
- onDeactivate();
- }
- var returnFocus = getOption(deactivateOptions, "returnFocus", "returnFocusOnDeactivate");
- var finishDeactivation = function finishDeactivation2() {
- delay(function() {
- if (returnFocus) {
- tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
- }
- if (onPostDeactivate) {
- onPostDeactivate();
- }
- });
- };
- if (returnFocus && checkCanReturnFocus) {
- checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation, finishDeactivation);
- return this;
- }
- finishDeactivation();
- return this;
- },
- pause: function pause() {
- if (state.paused || !state.active) {
- return this;
- }
- state.paused = true;
- removeListeners();
- return this;
- },
- unpause: function unpause() {
- if (!state.paused || !state.active) {
- return this;
- }
- state.paused = false;
- updateTabbableNodes();
- addListeners();
- return this;
- },
- updateContainerElements: function updateContainerElements(containerElements) {
- var elementsAsArray = [].concat(containerElements).filter(Boolean);
- state.containers = elementsAsArray.map(function(element) {
- return typeof element === "string" ? doc.querySelector(element) : element;
- });
- if (state.active) {
- updateTabbableNodes();
- }
- return this;
- }
- };
- trap.updateContainerElements(elements);
- return trap;
- };
- exports2.createFocusTrap = createFocusTrap2;
-});
-
-// packages/trap/builds/module.js
-__markAsModule(exports);
-__export(exports, {
- default: () => module_default
-});
-
-// packages/trap/src/index.js
-var import_focus_trap = __toModule(require_focus_trap());
-function src_default(Alpine) {
- Alpine.directive("trap", Alpine.skipDuringClone((el, {expression, modifiers}, {effect, evaluateLater}) => {
- let evaluator = evaluateLater(expression);
- let oldValue = false;
- let trap = (0, import_focus_trap.createFocusTrap)(el, {
- escapeDeactivates: false,
- allowOutsideClick: true,
- fallbackFocus: () => el
- });
- let undoInert = () => {
- };
- let undoDisableScrolling = () => {
- };
- effect(() => evaluator((value) => {
- if (oldValue === value)
- return;
- if (value && !oldValue) {
- setTimeout(() => {
- if (modifiers.includes("inert"))
- undoInert = setInert(el);
- if (modifiers.includes("noscroll"))
- undoDisableScrolling = disableScrolling();
- trap.activate();
- });
- }
- if (!value && oldValue) {
- undoInert();
- undoInert = () => {
- };
- undoDisableScrolling();
- undoDisableScrolling = () => {
- };
- trap.deactivate();
- }
- oldValue = !!value;
- }));
- }, (el, {expression, modifiers}, {evaluate}) => {
- if (modifiers.includes("inert") && evaluate(expression))
- setInert(el);
- }));
-}
-function setInert(el) {
- let undos = [];
- crawlSiblingsUp(el, (sibling) => {
- let cache = sibling.hasAttribute("aria-hidden");
- sibling.setAttribute("aria-hidden", "true");
- undos.push(() => cache || sibling.removeAttribute("aria-hidden"));
- });
- return () => {
- while (undos.length)
- undos.pop()();
- };
-}
-function crawlSiblingsUp(el, callback) {
- if (el.isSameNode(document.body) || !el.parentNode)
- return;
- Array.from(el.parentNode.children).forEach((sibling) => {
- if (!sibling.isSameNode(el))
- callback(sibling);
- crawlSiblingsUp(el.parentNode, callback);
- });
-}
-function disableScrolling() {
- let overflow = document.documentElement.style.overflow;
- let paddingRight = document.documentElement.style.paddingRight;
- let scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
- document.documentElement.style.overflow = "hidden";
- document.documentElement.style.paddingRight = `${scrollbarWidth}px`;
- return () => {
- document.documentElement.style.overflow = overflow;
- document.documentElement.style.paddingRight = paddingRight;
- };
-}
-
-// packages/trap/builds/module.js
-var module_default = src_default;
diff --git a/alpinejs/packages/trap/dist/module.esm.js b/alpinejs/packages/trap/dist/module.esm.js
deleted file mode 100644
index 00d58ec..0000000
--- a/alpinejs/packages/trap/dist/module.esm.js
+++ /dev/null
@@ -1,755 +0,0 @@
-var __create = Object.create;
-var __defProp = Object.defineProperty;
-var __getProtoOf = Object.getPrototypeOf;
-var __hasOwnProp = Object.prototype.hasOwnProperty;
-var __getOwnPropNames = Object.getOwnPropertyNames;
-var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
-var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
-var __commonJS = (callback, module) => () => {
- if (!module) {
- module = {exports: {}};
- callback(module.exports, module);
- }
- return module.exports;
-};
-var __exportStar = (target, module, desc) => {
- if (module && typeof module === "object" || typeof module === "function") {
- for (let key of __getOwnPropNames(module))
- if (!__hasOwnProp.call(target, key) && key !== "default")
- __defProp(target, key, {get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable});
- }
- return target;
-};
-var __toModule = (module) => {
- return __exportStar(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? {get: () => module.default, enumerable: true} : {value: module, enumerable: true})), module);
-};
-
-// node_modules/tabbable/dist/index.js
-var require_dist = __commonJS((exports) => {
- /*!
- * tabbable 5.2.1
- * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
- */
- "use strict";
- Object.defineProperty(exports, "__esModule", {value: true});
- var candidateSelectors = ["input", "select", "textarea", "a[href]", "button", "[tabindex]", "audio[controls]", "video[controls]", '[contenteditable]:not([contenteditable="false"])', "details>summary:first-of-type", "details"];
- var candidateSelector = /* @__PURE__ */ candidateSelectors.join(",");
- var matches = typeof Element === "undefined" ? function() {
- } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
- var getCandidates = function getCandidates2(el, includeContainer, filter) {
- var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
- if (includeContainer && matches.call(el, candidateSelector)) {
- candidates.unshift(el);
- }
- candidates = candidates.filter(filter);
- return candidates;
- };
- var isContentEditable = function isContentEditable2(node) {
- return node.contentEditable === "true";
- };
- var getTabindex = function getTabindex2(node) {
- var tabindexAttr = parseInt(node.getAttribute("tabindex"), 10);
- if (!isNaN(tabindexAttr)) {
- return tabindexAttr;
- }
- if (isContentEditable(node)) {
- return 0;
- }
- if ((node.nodeName === "AUDIO" || node.nodeName === "VIDEO" || node.nodeName === "DETAILS") && node.getAttribute("tabindex") === null) {
- return 0;
- }
- return node.tabIndex;
- };
- var sortOrderedTabbables = function sortOrderedTabbables2(a, b) {
- return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
- };
- var isInput = function isInput2(node) {
- return node.tagName === "INPUT";
- };
- var isHiddenInput = function isHiddenInput2(node) {
- return isInput(node) && node.type === "hidden";
- };
- var isDetailsWithSummary = function isDetailsWithSummary2(node) {
- var r = node.tagName === "DETAILS" && Array.prototype.slice.apply(node.children).some(function(child) {
- return child.tagName === "SUMMARY";
- });
- return r;
- };
- var getCheckedRadio = function getCheckedRadio2(nodes, form) {
- for (var i = 0; i < nodes.length; i++) {
- if (nodes[i].checked && nodes[i].form === form) {
- return nodes[i];
- }
- }
- };
- var isTabbableRadio = function isTabbableRadio2(node) {
- if (!node.name) {
- return true;
- }
- var radioScope = node.form || node.ownerDocument;
- var queryRadios = function queryRadios2(name) {
- return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');
- };
- var radioSet;
- if (typeof window !== "undefined" && typeof window.CSS !== "undefined" && typeof window.CSS.escape === "function") {
- radioSet = queryRadios(window.CSS.escape(node.name));
- } else {
- try {
- radioSet = queryRadios(node.name);
- } catch (err) {
- console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", err.message);
- return false;
- }
- }
- var checked = getCheckedRadio(radioSet, node.form);
- return !checked || checked === node;
- };
- var isRadio = function isRadio2(node) {
- return isInput(node) && node.type === "radio";
- };
- var isNonTabbableRadio = function isNonTabbableRadio2(node) {
- return isRadio(node) && !isTabbableRadio(node);
- };
- var isHidden = function isHidden2(node, displayCheck) {
- if (getComputedStyle(node).visibility === "hidden") {
- return true;
- }
- var isDirectSummary = matches.call(node, "details>summary:first-of-type");
- var nodeUnderDetails = isDirectSummary ? node.parentElement : node;
- if (matches.call(nodeUnderDetails, "details:not([open]) *")) {
- return true;
- }
- if (!displayCheck || displayCheck === "full") {
- while (node) {
- if (getComputedStyle(node).display === "none") {
- return true;
- }
- node = node.parentElement;
- }
- } else if (displayCheck === "non-zero-area") {
- var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height;
- return width === 0 && height === 0;
- }
- return false;
- };
- var isDisabledFromFieldset = function isDisabledFromFieldset2(node) {
- if (isInput(node) || node.tagName === "SELECT" || node.tagName === "TEXTAREA" || node.tagName === "BUTTON") {
- var parentNode = node.parentElement;
- while (parentNode) {
- if (parentNode.tagName === "FIELDSET" && parentNode.disabled) {
- for (var i = 0; i < parentNode.children.length; i++) {
- var child = parentNode.children.item(i);
- if (child.tagName === "LEGEND") {
- if (child.contains(node)) {
- return false;
- }
- return true;
- }
- }
- return true;
- }
- parentNode = parentNode.parentElement;
- }
- }
- return false;
- };
- var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable2(options, node) {
- if (node.disabled || isHiddenInput(node) || isHidden(node, options.displayCheck) || isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
- return false;
- }
- return true;
- };
- var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable2(options, node) {
- if (!isNodeMatchingSelectorFocusable(options, node) || isNonTabbableRadio(node) || getTabindex(node) < 0) {
- return false;
- }
- return true;
- };
- var tabbable = function tabbable2(el, options) {
- options = options || {};
- var regularTabbables = [];
- var orderedTabbables = [];
- var candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
- candidates.forEach(function(candidate, i) {
- var candidateTabindex = getTabindex(candidate);
- if (candidateTabindex === 0) {
- regularTabbables.push(candidate);
- } else {
- orderedTabbables.push({
- documentOrder: i,
- tabIndex: candidateTabindex,
- node: candidate
- });
- }
- });
- var tabbableNodes = orderedTabbables.sort(sortOrderedTabbables).map(function(a) {
- return a.node;
- }).concat(regularTabbables);
- return tabbableNodes;
- };
- var focusable = function focusable2(el, options) {
- options = options || {};
- var candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));
- return candidates;
- };
- var isTabbable = function isTabbable2(node, options) {
- options = options || {};
- if (!node) {
- throw new Error("No node provided");
- }
- if (matches.call(node, candidateSelector) === false) {
- return false;
- }
- return isNodeMatchingSelectorTabbable(options, node);
- };
- var focusableCandidateSelector = /* @__PURE__ */ candidateSelectors.concat("iframe").join(",");
- var isFocusable = function isFocusable2(node, options) {
- options = options || {};
- if (!node) {
- throw new Error("No node provided");
- }
- if (matches.call(node, focusableCandidateSelector) === false) {
- return false;
- }
- return isNodeMatchingSelectorFocusable(options, node);
- };
- exports.focusable = focusable;
- exports.isFocusable = isFocusable;
- exports.isTabbable = isTabbable;
- exports.tabbable = tabbable;
-});
-
-// node_modules/focus-trap/dist/focus-trap.js
-var require_focus_trap = __commonJS((exports) => {
- /*!
- * focus-trap 6.6.1
- * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
- */
- "use strict";
- Object.defineProperty(exports, "__esModule", {value: true});
- var tabbable = require_dist();
- function ownKeys(object, enumerableOnly) {
- var keys = Object.keys(object);
- if (Object.getOwnPropertySymbols) {
- var symbols = Object.getOwnPropertySymbols(object);
- if (enumerableOnly) {
- symbols = symbols.filter(function(sym) {
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
- });
- }
- keys.push.apply(keys, symbols);
- }
- return keys;
- }
- function _objectSpread2(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i] != null ? arguments[i] : {};
- if (i % 2) {
- ownKeys(Object(source), true).forEach(function(key) {
- _defineProperty(target, key, source[key]);
- });
- } else if (Object.getOwnPropertyDescriptors) {
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
- } else {
- ownKeys(Object(source)).forEach(function(key) {
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
- });
- }
- }
- return target;
- }
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- var activeFocusTraps = function() {
- var trapQueue = [];
- return {
- activateTrap: function activateTrap(trap) {
- if (trapQueue.length > 0) {
- var activeTrap = trapQueue[trapQueue.length - 1];
- if (activeTrap !== trap) {
- activeTrap.pause();
- }
- }
- var trapIndex = trapQueue.indexOf(trap);
- if (trapIndex === -1) {
- trapQueue.push(trap);
- } else {
- trapQueue.splice(trapIndex, 1);
- trapQueue.push(trap);
- }
- },
- deactivateTrap: function deactivateTrap(trap) {
- var trapIndex = trapQueue.indexOf(trap);
- if (trapIndex !== -1) {
- trapQueue.splice(trapIndex, 1);
- }
- if (trapQueue.length > 0) {
- trapQueue[trapQueue.length - 1].unpause();
- }
- }
- };
- }();
- var isSelectableInput = function isSelectableInput2(node) {
- return node.tagName && node.tagName.toLowerCase() === "input" && typeof node.select === "function";
- };
- var isEscapeEvent = function isEscapeEvent2(e) {
- return e.key === "Escape" || e.key === "Esc" || e.keyCode === 27;
- };
- var isTabEvent = function isTabEvent2(e) {
- return e.key === "Tab" || e.keyCode === 9;
- };
- var delay = function delay2(fn) {
- return setTimeout(fn, 0);
- };
- var findIndex = function findIndex2(arr, fn) {
- var idx = -1;
- arr.every(function(value, i) {
- if (fn(value)) {
- idx = i;
- return false;
- }
- return true;
- });
- return idx;
- };
- var valueOrHandler = function valueOrHandler2(value) {
- for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- params[_key - 1] = arguments[_key];
- }
- return typeof value === "function" ? value.apply(void 0, params) : value;
- };
- var createFocusTrap2 = function createFocusTrap3(elements, userOptions) {
- var doc = document;
- var config = _objectSpread2({
- returnFocusOnDeactivate: true,
- escapeDeactivates: true,
- delayInitialFocus: true
- }, userOptions);
- var state = {
- containers: [],
- tabbableGroups: [],
- nodeFocusedBeforeActivation: null,
- mostRecentlyFocusedNode: null,
- active: false,
- paused: false,
- delayInitialFocusTimer: void 0
- };
- var trap;
- var getOption = function getOption2(configOverrideOptions, optionName, configOptionName) {
- return configOverrideOptions && configOverrideOptions[optionName] !== void 0 ? configOverrideOptions[optionName] : config[configOptionName || optionName];
- };
- var containersContain = function containersContain2(element) {
- return state.containers.some(function(container) {
- return container.contains(element);
- });
- };
- var getNodeForOption = function getNodeForOption2(optionName) {
- var optionValue = config[optionName];
- if (!optionValue) {
- return null;
- }
- var node = optionValue;
- if (typeof optionValue === "string") {
- node = doc.querySelector(optionValue);
- if (!node) {
- throw new Error("`".concat(optionName, "` refers to no known node"));
- }
- }
- if (typeof optionValue === "function") {
- node = optionValue();
- if (!node) {
- throw new Error("`".concat(optionName, "` did not return a node"));
- }
- }
- return node;
- };
- var getInitialFocusNode = function getInitialFocusNode2() {
- var node;
- if (getOption({}, "initialFocus") === false) {
- return false;
- }
- if (getNodeForOption("initialFocus") !== null) {
- node = getNodeForOption("initialFocus");
- } else if (containersContain(doc.activeElement)) {
- node = doc.activeElement;
- } else {
- var firstTabbableGroup = state.tabbableGroups[0];
- var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode;
- node = firstTabbableNode || getNodeForOption("fallbackFocus");
- }
- if (!node) {
- throw new Error("Your focus-trap needs to have at least one focusable element");
- }
- return node;
- };
- var updateTabbableNodes = function updateTabbableNodes2() {
- state.tabbableGroups = state.containers.map(function(container) {
- var tabbableNodes = tabbable.tabbable(container);
- if (tabbableNodes.length > 0) {
- return {
- container,
- firstTabbableNode: tabbableNodes[0],
- lastTabbableNode: tabbableNodes[tabbableNodes.length - 1]
- };
- }
- return void 0;
- }).filter(function(group) {
- return !!group;
- });
- if (state.tabbableGroups.length <= 0 && !getNodeForOption("fallbackFocus")) {
- throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");
- }
- };
- var tryFocus = function tryFocus2(node) {
- if (node === false) {
- return;
- }
- if (node === doc.activeElement) {
- return;
- }
- if (!node || !node.focus) {
- tryFocus2(getInitialFocusNode());
- return;
- }
- node.focus({
- preventScroll: !!config.preventScroll
- });
- state.mostRecentlyFocusedNode = node;
- if (isSelectableInput(node)) {
- node.select();
- }
- };
- var getReturnFocusNode = function getReturnFocusNode2(previousActiveElement) {
- var node = getNodeForOption("setReturnFocus");
- return node ? node : previousActiveElement;
- };
- var checkPointerDown = function checkPointerDown2(e) {
- if (containersContain(e.target)) {
- return;
- }
- if (valueOrHandler(config.clickOutsideDeactivates, e)) {
- trap.deactivate({
- returnFocus: config.returnFocusOnDeactivate && !tabbable.isFocusable(e.target)
- });
- return;
- }
- if (valueOrHandler(config.allowOutsideClick, e)) {
- return;
- }
- e.preventDefault();
- };
- var checkFocusIn = function checkFocusIn2(e) {
- var targetContained = containersContain(e.target);
- if (targetContained || e.target instanceof Document) {
- if (targetContained) {
- state.mostRecentlyFocusedNode = e.target;
- }
- } else {
- e.stopImmediatePropagation();
- tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
- }
- };
- var checkTab = function checkTab2(e) {
- updateTabbableNodes();
- var destinationNode = null;
- if (state.tabbableGroups.length > 0) {
- var containerIndex = findIndex(state.tabbableGroups, function(_ref) {
- var container = _ref.container;
- return container.contains(e.target);
- });
- if (containerIndex < 0) {
- if (e.shiftKey) {
- destinationNode = state.tabbableGroups[state.tabbableGroups.length - 1].lastTabbableNode;
- } else {
- destinationNode = state.tabbableGroups[0].firstTabbableNode;
- }
- } else if (e.shiftKey) {
- var startOfGroupIndex = findIndex(state.tabbableGroups, function(_ref2) {
- var firstTabbableNode = _ref2.firstTabbableNode;
- return e.target === firstTabbableNode;
- });
- if (startOfGroupIndex < 0 && state.tabbableGroups[containerIndex].container === e.target) {
- startOfGroupIndex = containerIndex;
- }
- if (startOfGroupIndex >= 0) {
- var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
- var destinationGroup = state.tabbableGroups[destinationGroupIndex];
- destinationNode = destinationGroup.lastTabbableNode;
- }
- } else {
- var lastOfGroupIndex = findIndex(state.tabbableGroups, function(_ref3) {
- var lastTabbableNode = _ref3.lastTabbableNode;
- return e.target === lastTabbableNode;
- });
- if (lastOfGroupIndex < 0 && state.tabbableGroups[containerIndex].container === e.target) {
- lastOfGroupIndex = containerIndex;
- }
- if (lastOfGroupIndex >= 0) {
- var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
- var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
- destinationNode = _destinationGroup.firstTabbableNode;
- }
- }
- } else {
- destinationNode = getNodeForOption("fallbackFocus");
- }
- if (destinationNode) {
- e.preventDefault();
- tryFocus(destinationNode);
- }
- };
- var checkKey = function checkKey2(e) {
- if (isEscapeEvent(e) && valueOrHandler(config.escapeDeactivates) !== false) {
- e.preventDefault();
- trap.deactivate();
- return;
- }
- if (isTabEvent(e)) {
- checkTab(e);
- return;
- }
- };
- var checkClick = function checkClick2(e) {
- if (valueOrHandler(config.clickOutsideDeactivates, e)) {
- return;
- }
- if (containersContain(e.target)) {
- return;
- }
- if (valueOrHandler(config.allowOutsideClick, e)) {
- return;
- }
- e.preventDefault();
- e.stopImmediatePropagation();
- };
- var addListeners = function addListeners2() {
- if (!state.active) {
- return;
- }
- activeFocusTraps.activateTrap(trap);
- state.delayInitialFocusTimer = config.delayInitialFocus ? delay(function() {
- tryFocus(getInitialFocusNode());
- }) : tryFocus(getInitialFocusNode());
- doc.addEventListener("focusin", checkFocusIn, true);
- doc.addEventListener("mousedown", checkPointerDown, {
- capture: true,
- passive: false
- });
- doc.addEventListener("touchstart", checkPointerDown, {
- capture: true,
- passive: false
- });
- doc.addEventListener("click", checkClick, {
- capture: true,
- passive: false
- });
- doc.addEventListener("keydown", checkKey, {
- capture: true,
- passive: false
- });
- return trap;
- };
- var removeListeners = function removeListeners2() {
- if (!state.active) {
- return;
- }
- doc.removeEventListener("focusin", checkFocusIn, true);
- doc.removeEventListener("mousedown", checkPointerDown, true);
- doc.removeEventListener("touchstart", checkPointerDown, true);
- doc.removeEventListener("click", checkClick, true);
- doc.removeEventListener("keydown", checkKey, true);
- return trap;
- };
- trap = {
- activate: function activate(activateOptions) {
- if (state.active) {
- return this;
- }
- var onActivate = getOption(activateOptions, "onActivate");
- var onPostActivate = getOption(activateOptions, "onPostActivate");
- var checkCanFocusTrap = getOption(activateOptions, "checkCanFocusTrap");
- if (!checkCanFocusTrap) {
- updateTabbableNodes();
- }
- state.active = true;
- state.paused = false;
- state.nodeFocusedBeforeActivation = doc.activeElement;
- if (onActivate) {
- onActivate();
- }
- var finishActivation = function finishActivation2() {
- if (checkCanFocusTrap) {
- updateTabbableNodes();
- }
- addListeners();
- if (onPostActivate) {
- onPostActivate();
- }
- };
- if (checkCanFocusTrap) {
- checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
- return this;
- }
- finishActivation();
- return this;
- },
- deactivate: function deactivate(deactivateOptions) {
- if (!state.active) {
- return this;
- }
- clearTimeout(state.delayInitialFocusTimer);
- state.delayInitialFocusTimer = void 0;
- removeListeners();
- state.active = false;
- state.paused = false;
- activeFocusTraps.deactivateTrap(trap);
- var onDeactivate = getOption(deactivateOptions, "onDeactivate");
- var onPostDeactivate = getOption(deactivateOptions, "onPostDeactivate");
- var checkCanReturnFocus = getOption(deactivateOptions, "checkCanReturnFocus");
- if (onDeactivate) {
- onDeactivate();
- }
- var returnFocus = getOption(deactivateOptions, "returnFocus", "returnFocusOnDeactivate");
- var finishDeactivation = function finishDeactivation2() {
- delay(function() {
- if (returnFocus) {
- tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
- }
- if (onPostDeactivate) {
- onPostDeactivate();
- }
- });
- };
- if (returnFocus && checkCanReturnFocus) {
- checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation, finishDeactivation);
- return this;
- }
- finishDeactivation();
- return this;
- },
- pause: function pause() {
- if (state.paused || !state.active) {
- return this;
- }
- state.paused = true;
- removeListeners();
- return this;
- },
- unpause: function unpause() {
- if (!state.paused || !state.active) {
- return this;
- }
- state.paused = false;
- updateTabbableNodes();
- addListeners();
- return this;
- },
- updateContainerElements: function updateContainerElements(containerElements) {
- var elementsAsArray = [].concat(containerElements).filter(Boolean);
- state.containers = elementsAsArray.map(function(element) {
- return typeof element === "string" ? doc.querySelector(element) : element;
- });
- if (state.active) {
- updateTabbableNodes();
- }
- return this;
- }
- };
- trap.updateContainerElements(elements);
- return trap;
- };
- exports.createFocusTrap = createFocusTrap2;
-});
-
-// packages/trap/src/index.js
-var import_focus_trap = __toModule(require_focus_trap());
-function src_default(Alpine) {
- Alpine.directive("trap", Alpine.skipDuringClone((el, {expression, modifiers}, {effect, evaluateLater}) => {
- let evaluator = evaluateLater(expression);
- let oldValue = false;
- let trap = (0, import_focus_trap.createFocusTrap)(el, {
- escapeDeactivates: false,
- allowOutsideClick: true,
- fallbackFocus: () => el
- });
- let undoInert = () => {
- };
- let undoDisableScrolling = () => {
- };
- effect(() => evaluator((value) => {
- if (oldValue === value)
- return;
- if (value && !oldValue) {
- setTimeout(() => {
- if (modifiers.includes("inert"))
- undoInert = setInert(el);
- if (modifiers.includes("noscroll"))
- undoDisableScrolling = disableScrolling();
- trap.activate();
- });
- }
- if (!value && oldValue) {
- undoInert();
- undoInert = () => {
- };
- undoDisableScrolling();
- undoDisableScrolling = () => {
- };
- trap.deactivate();
- }
- oldValue = !!value;
- }));
- }, (el, {expression, modifiers}, {evaluate}) => {
- if (modifiers.includes("inert") && evaluate(expression))
- setInert(el);
- }));
-}
-function setInert(el) {
- let undos = [];
- crawlSiblingsUp(el, (sibling) => {
- let cache = sibling.hasAttribute("aria-hidden");
- sibling.setAttribute("aria-hidden", "true");
- undos.push(() => cache || sibling.removeAttribute("aria-hidden"));
- });
- return () => {
- while (undos.length)
- undos.pop()();
- };
-}
-function crawlSiblingsUp(el, callback) {
- if (el.isSameNode(document.body) || !el.parentNode)
- return;
- Array.from(el.parentNode.children).forEach((sibling) => {
- if (!sibling.isSameNode(el))
- callback(sibling);
- crawlSiblingsUp(el.parentNode, callback);
- });
-}
-function disableScrolling() {
- let overflow = document.documentElement.style.overflow;
- let paddingRight = document.documentElement.style.paddingRight;
- let scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
- document.documentElement.style.overflow = "hidden";
- document.documentElement.style.paddingRight = `${scrollbarWidth}px`;
- return () => {
- document.documentElement.style.overflow = overflow;
- document.documentElement.style.paddingRight = paddingRight;
- };
-}
-
-// packages/trap/builds/module.js
-var module_default = src_default;
-export {
- module_default as default
-};