From 68d831dc0bfed7bc60a4248ba812781710ff2d2b Mon Sep 17 00:00:00 2001 From: Gaby Stallo Date: Sun, 19 Feb 2023 01:58:25 -0300 Subject: [PATCH] alpine.js app example --- examples/alpinejs/.gitignore | 19 + examples/alpinejs/css/app.css | 8 + examples/alpinejs/index.html | 106 +++++ examples/alpinejs/js/app.js | 110 +++++ examples/alpinejs/js/router.js | 23 + examples/alpinejs/js/storage.js | 15 + .../@alpinejs/focus/dist/cdn.min.js | 9 + .../node_modules/alpinejs/dist/cdn.min.js | 5 + .../director/build/director.min.js | 7 + .../node_modules/todomvc-app-css/index.css | 393 ++++++++++++++++++ .../node_modules/todomvc-common/base.css | 141 +++++++ .../node_modules/todomvc-common/base.js | 249 +++++++++++ examples/alpinejs/package.json | 10 + examples/alpinejs/readme.md | 12 + 14 files changed, 1107 insertions(+) create mode 100644 examples/alpinejs/.gitignore create mode 100644 examples/alpinejs/css/app.css create mode 100644 examples/alpinejs/index.html create mode 100644 examples/alpinejs/js/app.js create mode 100644 examples/alpinejs/js/router.js create mode 100644 examples/alpinejs/js/storage.js create mode 100644 examples/alpinejs/node_modules/@alpinejs/focus/dist/cdn.min.js create mode 100644 examples/alpinejs/node_modules/alpinejs/dist/cdn.min.js create mode 100644 examples/alpinejs/node_modules/director/build/director.min.js create mode 100644 examples/alpinejs/node_modules/todomvc-app-css/index.css create mode 100644 examples/alpinejs/node_modules/todomvc-common/base.css create mode 100644 examples/alpinejs/node_modules/todomvc-common/base.js create mode 100644 examples/alpinejs/package.json create mode 100644 examples/alpinejs/readme.md diff --git a/examples/alpinejs/.gitignore b/examples/alpinejs/.gitignore new file mode 100644 index 0000000000..7ae0e2cad9 --- /dev/null +++ b/examples/alpinejs/.gitignore @@ -0,0 +1,19 @@ +node_modules/todomvc-app-css/** +!node_modules/todomvc-app-css/index.css + +node_modules/todomvc-common/** +!node_modules/todomvc-common/base.js +!node_modules/todomvc-common/base.css + +node_modules/director/** +!node_modules/director/build +!node_modules/director/build/director.min.js + +node_modules/@alpinejs/** +!node_modules/@alpinejs/focus +!node_modules/@alpinejs/focus/dist +!node_modules/@alpinejs/focus/dist/cdn.min.js + +node_modules/alpinejs/** +!node_modules/alpinejs/dist +!node_modules/alpinejs/dist/cdn.min.js \ No newline at end of file diff --git a/examples/alpinejs/css/app.css b/examples/alpinejs/css/app.css new file mode 100644 index 0000000000..dc5dd44da9 --- /dev/null +++ b/examples/alpinejs/css/app.css @@ -0,0 +1,8 @@ +/* + +app-template.css overrides + +remove this comment if used +remove this file if not + +*/ diff --git a/examples/alpinejs/index.html b/examples/alpinejs/index.html new file mode 100644 index 0000000000..b5d655d600 --- /dev/null +++ b/examples/alpinejs/index.html @@ -0,0 +1,106 @@ + + + + + + Alpine.js • TodoMVC + + + + +
+
+

todos

+ +
+
+ + +
    + +
+
+ +
+ + + + + + + + + + diff --git a/examples/alpinejs/js/app.js b/examples/alpinejs/js/app.js new file mode 100644 index 0000000000..353d3f8488 --- /dev/null +++ b/examples/alpinejs/js/app.js @@ -0,0 +1,110 @@ +(function (window) { + 'use strict'; + + window.todoapp = function() { + return { + + // app initial state + todos: window.todoStorage.fetch(), + newTodoTitle: '', + editingTodo: null, + visibility: 'all', + + // computed properties + get completed() { + return this.todos.filter(function (todo) { + return todo.completed; + }); + }, + + get active() { + return this.todos.filter(function (todo) { + return ! todo.completed; + }); + }, + + get filteredTodos() { + if (this.visibility == 'active') { + return this.active; + } + + if (this.visibility == 'completed') { + return this.completed; + } + + // by default show "all" todos + return this.todos; + }, + + // initialize + initTodoApp: function () { + this.$watch('todos', function (todos) { + window.todoStorage.save(todos); + }); + window.setUpTodoAppRouter(this); + }, + + // methods + add: function () { + var title = this.newTodoTitle.trim(); + if (!title) { + return; + } + this.todos.push({ id:Date.now(), title: title, completed: false }); + this.newTodoTitle = ''; + }, + + edit: function (todo) { + this.cancelEdit(); + todo.editingBuffer = todo.title; + this.editingTodo = todo; + }, + + cancelEdit: function () { + if(!this.editingTodo) { + return; + } + delete this.editingTodo.editingBuffer; + this.editingTodo = null; + }, + + saveEdit: function () { + var newTitle = this.editingTodo.editingBuffer.trim(); + + if (!this.editingTodo) { + return; + } + + if (newTitle == '') { + this.remove(this.editingTodo); + return; + } + this.editingTodo.title = newTitle; + this.cancelEdit(); + }, + + remove: function (todo) { + var index = this.todos.indexOf(todo); + this.todos.splice(index, 1); + }, + + removeCompleted: function () { + this.todos = this.active; + }, + + toggleAllCompleted: function () { + if (!this.active.length) { + this.todos.forEach(function (todo) { + todo.completed = false; + }); + return; + } + + this.todos.forEach(function (todo) { + todo.completed = true; + }); + } + }; + }; + +})(window); diff --git a/examples/alpinejs/js/router.js b/examples/alpinejs/js/router.js new file mode 100644 index 0000000000..550f5b6a88 --- /dev/null +++ b/examples/alpinejs/js/router.js @@ -0,0 +1,23 @@ +(function (window) { + 'use strict'; + + window.setUpTodoAppRouter = function (todoapp) { + var router = new window.Router(); + + ['all', 'active', 'completed'].forEach(function (visibility) { + router.on(visibility, function () { + todoapp.visibility = visibility; + }); + }); + + router.configure({ + notfound: function () { + window.location.hash = ''; + todoapp.visibility = 'all'; + } + }); + + router.init(); + }; + +})(window); \ No newline at end of file diff --git a/examples/alpinejs/js/storage.js b/examples/alpinejs/js/storage.js new file mode 100644 index 0000000000..5f3d44f557 --- /dev/null +++ b/examples/alpinejs/js/storage.js @@ -0,0 +1,15 @@ +(function (window) { + 'use strict'; + + var STORAGE_KEY = 'todos-alpinejs'; + + window.todoStorage = { + fetch: function () { + return JSON.parse(localStorage.getItem(STORAGE_KEY) || '[]'); + }, + save: function (data) { + localStorage.setItem(STORAGE_KEY, JSON.stringify(data)); + } + }; + +})(window); diff --git a/examples/alpinejs/node_modules/@alpinejs/focus/dist/cdn.min.js b/examples/alpinejs/node_modules/@alpinejs/focus/dist/cdn.min.js new file mode 100644 index 0000000000..a1e4d4026b --- /dev/null +++ b/examples/alpinejs/node_modules/@alpinejs/focus/dist/cdn.min.js @@ -0,0 +1,9 @@ +(()=>{var j=["input","select","textarea","a[href]","button","[tabindex]","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"],_=j.join(","),A=typeof Element=="undefined"?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,G=function(e,t,a){var u=Array.prototype.slice.apply(e.querySelectorAll(_));return t&&A.call(e,_)&&u.unshift(e),u=u.filter(a),u},Z=function(e){return e.contentEditable==="true"},M=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},C=function(e){return e.tagName==="INPUT"},ee=function(e){return C(e)&&e.type==="hidden"},te=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(a){return a.tagName==="SUMMARY"});return t},re=function(e,t){for(var a=0;asummary:first-of-type"),u=a?e.parentElement:e;if(A.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 r=e.getBoundingClientRect(),s=r.width,l=r.height;return s===0&&l===0}return!1},oe=function(e){if(C(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;a0){var a=i[i.length-1];a!==t&&a.pause()}var u=i.indexOf(t);u===-1||i.splice(u,1),i.push(t)},deactivateTrap:function(t){var a=i.indexOf(t);a!==-1&&i.splice(a,1),i.length>0&&i[i.length-1].unpause()}}}(),de=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},be=function(e){return e.key==="Escape"||e.key==="Esc"||e.keyCode===27},ve=function(e){return e.key==="Tab"||e.keyCode===9},U=function(e){return setTimeout(e,0)},L=function(e,t){var a=-1;return e.every(function(u,r){return t(u)?(a=r,!1):!0}),a},D=function(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),u=1;u0)return{container:n,firstTabbableNode:o[0],lastTabbableNode:o[o.length-1]}}).filter(function(n){return!!n}),r.tabbableGroups.length<=0&&!b("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")},p=function f(n){if(n!==!1&&n!==a.activeElement){if(!n||!n.focus){f(v());return}n.focus({preventScroll:!!u.preventScroll}),r.mostRecentlyFocusedNode=n,de(n)&&n.select()}},E=function(n){var o=b("setReturnFocus");return o||n},y=function(n){if(!h(n.target)){if(D(u.clickOutsideDeactivates,n)){s.deactivate({returnFocus:u.returnFocusOnDeactivate&&!k(n.target)});return}D(u.allowOutsideClick,n)||n.preventDefault()}},w=function(n){var o=h(n.target);o||n.target instanceof Document?o&&(r.mostRecentlyFocusedNode=n.target):(n.stopImmediatePropagation(),p(r.mostRecentlyFocusedNode||v()))},Q=function(n){m();var o=null;if(r.tabbableGroups.length>0){var c=L(r.tabbableGroups,function(S){var N=S.container;return N.contains(n.target)});if(c<0)n.shiftKey?o=r.tabbableGroups[r.tabbableGroups.length-1].lastTabbableNode:o=r.tabbableGroups[0].firstTabbableNode;else if(n.shiftKey){var d=L(r.tabbableGroups,function(S){var N=S.firstTabbableNode;return n.target===N});if(d<0&&r.tabbableGroups[c].container===n.target&&(d=c),d>=0){var g=d===0?r.tabbableGroups.length-1:d-1,F=r.tabbableGroups[g];o=F.lastTabbableNode}}else{var T=L(r.tabbableGroups,function(S){var N=S.lastTabbableNode;return n.target===N});if(T<0&&r.tabbableGroups[c].container===n.target&&(T=c),T>=0){var X=T===r.tabbableGroups.length-1?0:T+1,J=r.tabbableGroups[X];o=J.firstTabbableNode}}}else o=b("fallbackFocus");o&&(n.preventDefault(),p(o))},R=function(n){if(be(n)&&D(u.escapeDeactivates)!==!1){n.preventDefault(),s.deactivate();return}if(ve(n)){Q(n);return}},x=function(n){D(u.clickOutsideDeactivates,n)||h(n.target)||D(u.allowOutsideClick,n)||(n.preventDefault(),n.stopImmediatePropagation())},I=function(){if(!!r.active)return H.activateTrap(s),r.delayInitialFocusTimer=u.delayInitialFocus?U(function(){p(v())}):p(v()),a.addEventListener("focusin",w,!0),a.addEventListener("mousedown",y,{capture:!0,passive:!1}),a.addEventListener("touchstart",y,{capture:!0,passive:!1}),a.addEventListener("click",x,{capture:!0,passive:!1}),a.addEventListener("keydown",R,{capture:!0,passive:!1}),s},P=function(){if(!!r.active)return a.removeEventListener("focusin",w,!0),a.removeEventListener("mousedown",y,!0),a.removeEventListener("touchstart",y,!0),a.removeEventListener("click",x,!0),a.removeEventListener("keydown",R,!0),s};return s={activate:function(n){if(r.active)return this;var o=l(n,"onActivate"),c=l(n,"onPostActivate"),d=l(n,"checkCanFocusTrap");d||m(),r.active=!0,r.paused=!1,r.nodeFocusedBeforeActivation=a.activeElement,o&&o();var g=function(){d&&m(),I(),c&&c()};return d?(d(r.containers.concat()).then(g,g),this):(g(),this)},deactivate:function(n){if(!r.active)return this;clearTimeout(r.delayInitialFocusTimer),r.delayInitialFocusTimer=void 0,P(),r.active=!1,r.paused=!1,H.deactivateTrap(s);var o=l(n,"onDeactivate"),c=l(n,"onPostDeactivate"),d=l(n,"checkCanReturnFocus");o&&o();var g=l(n,"returnFocus","returnFocusOnDeactivate"),F=function(){U(function(){g&&p(E(r.nodeFocusedBeforeActivation)),c&&c()})};return g&&d?(d(E(r.nodeFocusedBeforeActivation)).then(F,F),this):(F(),this)},pause:function(){return r.paused||!r.active?this:(r.paused=!0,P(),this)},unpause:function(){return!r.paused||!r.active?this:(r.paused=!1,m(),I(),this)},updateContainerElements:function(n){var o=[].concat(n).filter(Boolean);return r.containers=o.map(function(c){return typeof c=="string"?a.querySelector(c):c}),r.active&&m(),this}},s.updateContainerElements(e),s};function Y(i){let e,t;window.addEventListener("focusin",()=>{e=t,t=document.activeElement}),i.magic("focus",a=>{let u=a;return{__noscroll:!1,__wrapAround:!1,within(r){return u=r,this},withoutScrolling(){return this.__noscroll=!0,this},noscroll(){return this.__noscroll=!0,this},withWrapAround(){return this.__wrapAround=!0,this},wrap(){return this.withWrapAround()},focusable(r){return k(r)},previouslyFocused(){return e},lastFocused(){return e},focused(){return t},focusables(){return Array.isArray(u)?u:W(u,{displayCheck:"none"})},all(){return this.focusables()},isFirst(r){let s=this.all();return s[0]&&s[0].isSameNode(r)},isLast(r){let s=this.all();return s.length&&s.slice(-1)[0].isSameNode(r)},getFirst(){return this.all()[0]},getLast(){return this.all().slice(-1)[0]},getNext(){let r=this.all(),s=document.activeElement;if(r.indexOf(s)!==-1)return this.__wrapAround&&r.indexOf(s)===r.length-1?r[0]:r[r.indexOf(s)+1]},getPrevious(){let r=this.all(),s=document.activeElement;if(r.indexOf(s)!==-1)return this.__wrapAround&&r.indexOf(s)===0?r.slice(-1)[0]:r[r.indexOf(s)-1]},first(){this.focus(this.getFirst())},last(){this.focus(this.getLast())},next(){this.focus(this.getNext())},previous(){this.focus(this.getPrevious())},prev(){return this.previous()},focus(r){!r||setTimeout(()=>{r.hasAttribute("tabindex")||r.setAttribute("tabindex","0"),r.focus({preventScroll:this._noscroll})})}}}),i.directive("trap",i.skipDuringClone((a,{expression:u,modifiers:r},{effect:s,evaluateLater:l,cleanup:h})=>{let b=l(u),v=!1,m=K(a,{escapeDeactivates:!1,allowOutsideClick:!0,fallbackFocus:()=>a,initialFocus:a.querySelector("[autofocus]")}),p=()=>{},E=()=>{},y=()=>{p(),p=()=>{},E(),E=()=>{},m.deactivate({returnFocus:!r.includes("noreturn")})};s(()=>b(w=>{v!==w&&(w&&!v&&setTimeout(()=>{r.includes("inert")&&(p=V(a)),r.includes("noscroll")&&(E=pe()),m.activate()}),!w&&v&&y(),v=!!w)})),h(y)},(a,{expression:u,modifiers:r},{evaluate:s})=>{r.includes("inert")&&s(u)&&V(a)}))}function V(i){let e=[];return z(i,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 z(i,e){i.isSameNode(document.body)||!i.parentNode||Array.from(i.parentNode.children).forEach(t=>{t.isSameNode(i)?z(i.parentNode,e):e(t)})}function pe(){let i=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=i,document.documentElement.style.paddingRight=e}}document.addEventListener("alpine:init",()=>{window.Alpine.plugin(Y)});})(); +/*! +* 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/examples/alpinejs/node_modules/alpinejs/dist/cdn.min.js b/examples/alpinejs/node_modules/alpinejs/dist/cdn.min.js new file mode 100644 index 0000000000..0c826a2dc6 --- /dev/null +++ b/examples/alpinejs/node_modules/alpinejs/dist/cdn.min.js @@ -0,0 +1,5 @@ +(()=>{var Ye=!1,Ze=!1,V=[];function Ft(e){mn(e)}function mn(e){V.includes(e)||V.push(e),hn()}function xe(e){let t=V.indexOf(e);t!==-1&&V.splice(t,1)}function hn(){!Ze&&!Ye&&(Ye=!0,queueMicrotask(_n))}function _n(){Ye=!1,Ze=!0;for(let e=0;ee.effect(t,{scheduler:r=>{Xe?Ft(r):r()}}),Qe=e.raw}function et(e){I=e}function zt(e){let t=()=>{};return[n=>{let i=I(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),$(i))},i},()=>{t()}]}var Vt=[],Ht=[],qt=[];function Ut(e){qt.push(e)}function ye(e,t){typeof t=="function"?(e._x_cleanups||(e._x_cleanups=[]),e._x_cleanups.push(t)):(t=e,Ht.push(t))}function Wt(e){Vt.push(e)}function Gt(e,t,r){e._x_attributeCleanups||(e._x_attributeCleanups={}),e._x_attributeCleanups[t]||(e._x_attributeCleanups[t]=[]),e._x_attributeCleanups[t].push(r)}function tt(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 nt=new MutationObserver(rt),it=!1;function ie(){nt.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0}),it=!0}function ot(){gn(),nt.disconnect(),it=!1}var oe=[],st=!1;function gn(){oe=oe.concat(nt.takeRecords()),oe.length&&!st&&(st=!0,queueMicrotask(()=>{xn(),st=!1}))}function xn(){rt(oe),oe.length=0}function h(e){if(!it)return e();ot();let t=e();return ie(),t}var at=!1,be=[];function Jt(){at=!0}function Yt(){at=!1,rt(be),be=[]}function rt(e){if(at){be=be.concat(e);return}let t=[],r=[],n=new Map,i=new Map;for(let o=0;os.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)=>{tt(s,o)}),n.forEach((o,s)=>{Vt.forEach(a=>a(s,o))});for(let o of r)if(!t.includes(o)&&(Ht.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,qt.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 ve(e){return j(L(e))}function M(e,t,r){return e._x_dataStack=[t,...L(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 L(e){return e._x_dataStack?e._x_dataStack:typeof ShadowRoot=="function"&&e instanceof ShadowRoot?L(e.host):e.parentNode?L(e.parentNode):[]}function j(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 we(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 Ee(e,t=()=>{}){let r={initialValue:void 0,_x_interceptor:!0,initialize(n,i,o){return e(this.initialValue,()=>yn(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 yn(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 Zt={};function y(e,t){Zt[e]=t}function se(e,t){return Object.entries(Zt).forEach(([r,n])=>{Object.defineProperty(e,`$${r}`,{get(){let[i,o]=ut(t);return i={interceptor:Ee,...i},ye(t,o),n(t,i)},enumerable:!1})}),e}function Qt(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)}var Se=!0;function Xt(e){let t=Se;Se=!1,e(),Se=t}function P(e,t,r={}){let n;return x(e,t)(i=>n=i,r),n}function x(...e){return er(...e)}var er=ft;function tr(e){er=e}function ft(e,t){let r={};se(r,e);let n=[r,...L(e)];if(typeof t=="function")return bn(n,t);let i=vn(n,t,e);return Qt.bind(null,e,t,i)}function bn(e,t){return(r=()=>{},{scope:n={},params:i=[]}={})=>{let o=t.apply(j([n,...e]),i);Ae(r,o)}}var dt={};function wn(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)?`(async()=>{ ${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 vn(e,t,r){let n=wn(t,r);return(i=()=>{},{scope:o={},params:s=[]}={})=>{n.result=void 0,n.finished=!1;let a=j([o,...e]);if(typeof n=="function"){let c=n(n,a).catch(l=>Z(l,r,t));n.finished?(Ae(i,n.result,a,s,r),n.result=void 0):c.then(l=>{Ae(i,l,a,s,r)}).catch(l=>Z(l,r,t)).finally(()=>n.result=void 0)}}}function Ae(e,t,r,n,i){if(Se&&typeof t=="function"){let o=t.apply(r,n);o instanceof Promise?o.then(s=>Ae(e,s,r,n)).catch(s=>Z(s,i,t)):e(o)}else typeof t=="object"&&t instanceof Promise?t.then(o=>e(o)):e(t)}var pt="x-";function S(e=""){return pt+e}function rr(e){pt=e}var mt={};function p(e,t){return mt[e]=t,{before(r){if(!mt[r]){console.warn("Cannot find directive `${directive}`. `${name}` will use the default order of execution");return}let n=H.indexOf(r)??H.indexOf("DEFAULT");n>=0&&H.splice(n,0,e)}}}function ae(e,t,r){if(t=Array.from(t),e._x_virtualDirectives){let o=Object.entries(e._x_virtualDirectives).map(([a,c])=>({name:a,value:c})),s=ht(o);o=o.map(a=>s.find(c=>c.name===a.name)?{name:`x-bind:${a.name}`,value:`"${a.value}"`}:a),t=t.concat(o)}let n={};return t.map(nr((o,s)=>n[o]=s)).filter(ir).map(Sn(n,r)).sort(An).map(o=>En(e,o))}function ht(e){return Array.from(e).map(nr()).filter(t=>!ir(t))}var _t=!1,ce=new Map,or=Symbol();function sr(e){_t=!0;let t=Symbol();or=t,ce.set(t,[]);let r=()=>{for(;ce.get(t).length;)ce.get(t).shift()();ce.delete(t)},n=()=>{_t=!1,r()};e(r),n()}function ut(e){let t=[],r=a=>t.push(a),[n,i]=zt(e);return t.push(i),[{Alpine:F,effect:n,cleanup:r,evaluateLater:x.bind(x,e),evaluate:P.bind(P,e)},()=>t.forEach(a=>a())]}function En(e,t){let r=()=>{},n=mt[t.type]||r,[i,o]=ut(e);Gt(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),_t?ce.get(or).push(n):n())};return s.runCleanups=o,s}var Oe=(e,t)=>({name:r,value:n})=>(r.startsWith(e)&&(r=r.replace(e,t)),{name:r,value:n}),Te=e=>e;function nr(e=()=>{}){return({name:t,value:r})=>{let{name:n,value:i}=ar.reduce((o,s)=>s(o),{name:t,value:r});return n!==t&&e(n,t),{name:n,value:i}}}var ar=[];function Q(e){ar.push(e)}function ir({name:e}){return cr().test(e)}var cr=()=>new RegExp(`^${pt}([^:^.]+)\\b`);function Sn(e,t){return({name:r,value:n})=>{let i=r.match(cr()),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 gt="DEFAULT",H=["ignore","ref","data","id","radio","tabs","switch","disclosure","menu","listbox","combobox","bind","init","for","mask","model","modelable","transition","show","if",gt,"teleport"];function An(e,t){let r=H.indexOf(e.type)===-1?gt:e.type,n=H.indexOf(t.type)===-1?gt:t.type;return H.indexOf(r)-H.indexOf(n)}function q(e,t,r={}){e.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0,cancelable:!0}))}function A(e,t){if(typeof ShadowRoot=="function"&&e instanceof ShadowRoot){Array.from(e.children).forEach(i=>A(i,t));return}let r=!1;if(t(e,()=>r=!0),r)return;let n=e.firstElementChild;for(;n;)A(n,t,!1),n=n.nextElementSibling}function C(e,...t){console.warn(`Alpine Warning: ${e}`,...t)}function ur(){document.body||C("Unable to initialize. Trying to load Alpine before `` is available. Did you forget to add `defer` in Alpine's `