spendwise 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,353 @@
1
+ /* global Alpine, FinEngine, fmt, showToast, confirmDialog, unwrap */
2
+ 'use strict';
3
+
4
+ function settingsView (primary = false) {
5
+ return {
6
+ // The same component is reused inside the import and backups modals for
7
+ // its helpers. Only the full-page instance (primary) owns the
8
+ // unsaved-changes gate and the web panel - otherwise the modal copies,
9
+ // holding drafts cloned at page load, fight over ui.settingsDirty and
10
+ // report phantom unsaved settings after any real save bumps the rev.
11
+ primary,
12
+ draft: null,
13
+ backups: [],
14
+ initialUnlocked: false, // opt-in to edit initial savings once history exists
15
+
16
+ get db () { return Alpine.store('data').db; },
17
+ get ui () { return Alpine.store('ui'); },
18
+ get dirty () { return !!(this.draft && this.db && JSON.stringify(this.draft) !== JSON.stringify(this.db.settings)); },
19
+ get dbPath () { return Alpine.store('data').path; },
20
+
21
+ init () {
22
+ this.reset();
23
+ // db can arrive after init, or be replaced wholesale (import/restore).
24
+ // Watch the revision - NOT `db`: Alpine's $watch JSON.stringifies the
25
+ // watched value on every dependency change, so watching the whole db
26
+ // made every keystroke re-stringify the entire multi-year database.
27
+ this.$watch('db?.meta.rev', () => {
28
+ // primary guards genuine unsaved edits; the modal reuses have
29
+ // none worth keeping, so they always resync to the new settings
30
+ if (!this.primary || !this.dirty) this.reset();
31
+ });
32
+ if (!this.primary) return;
33
+ this.loadWebStatus();
34
+ // sync once (the watch below only fires on change) then mirror to the
35
+ // store so the unsaved-changes gate (app.js) can see draft edits here
36
+ this.ui.settingsDirty = this.dirty;
37
+ this.$watch('dirty', (v) => { this.ui.settingsDirty = v; });
38
+ },
39
+
40
+ reset () {
41
+ this.draft = this.db ? FinEngine.clone(this.db.settings) : null;
42
+ this.initialUnlocked = false;
43
+ },
44
+
45
+ get monthsCount () { return this.db ? FinEngine.monthKeys(this.db).length : 0; },
46
+ // with real history, the seed is read-only until explicitly unlocked
47
+ get initialLocked () { return this.monthsCount > 1 && !this.initialUnlocked; },
48
+
49
+ async unlockInitial () {
50
+ const okEdit = await confirmDialog({
51
+ title: 'Edit initial savings?',
52
+ body: 'This is the seed for your very first month. Changing it rewrites the starting and '
53
+ + 'closing savings of every month since - you almost never need to touch it after setup.',
54
+ confirmText: 'Let me edit it',
55
+ });
56
+ if (okEdit) this.initialUnlocked = true;
57
+ },
58
+
59
+ hotkeys (e) {
60
+ if (this.ui.view !== 'settings' || !(e.ctrlKey || e.metaKey)) return;
61
+ if ((e.key || '').toLowerCase() === 's') {
62
+ e.preventDefault();
63
+ if (this.dirty) this.save();
64
+ }
65
+ },
66
+
67
+ kindLabel (kind) {
68
+ return { income: 'Income (+)', expense: 'Expenses (−)', envelope: 'Envelope budgets (−)', goal: 'Goal budgets (−)' }[kind] || kind;
69
+ },
70
+
71
+ // ---------------------------------------------------------- groups
72
+
73
+ addGroup (kind) {
74
+ const group = { id: FinEngine.uuid(), title: 'New Group', kind, order: this.draft.groups.length };
75
+ if (kind === 'envelope') group.strictOverspend = false; // goals are never strict
76
+ this.draft.groups.push(group);
77
+ },
78
+
79
+ move (index, dir) {
80
+ const to = index + dir;
81
+ if (to < 0 || to >= this.draft.groups.length) return;
82
+ const [g] = this.draft.groups.splice(index, 1);
83
+ this.draft.groups.splice(to, 0, g);
84
+ this.draft.groups.forEach((g, i) => { g.order = i; });
85
+ },
86
+
87
+ async removeGroup (group) {
88
+ let inUse = false;
89
+ for (const key of FinEngine.monthKeys(this.db)) {
90
+ const inst = this.db.months[key].groups.find((g) => g.groupId === group.id);
91
+ if (inst && inst.fields.length) { inUse = true; break; }
92
+ }
93
+ const okRemove = await confirmDialog({
94
+ title: `Remove group “${group.title}”?`,
95
+ body: inUse
96
+ ? 'Past months that recorded fields in this group keep their data, but the group disappears from new months. '
97
+ + 'If its envelopes still hold money, empty them to income first so the ledger stays accurate.'
98
+ : 'The group is empty everywhere - safe to remove.',
99
+ confirmText: 'Remove group', danger: inUse,
100
+ });
101
+ if (!okRemove) return;
102
+ this.draft.groups = this.draft.groups.filter((g) => g.id !== group.id);
103
+ this.draft.groups.forEach((g, i) => { g.order = i; });
104
+ },
105
+
106
+ async save () {
107
+ if (this.ui.offline) return;
108
+ const initialChanged = FinEngine.num(this.draft.initialSavings) !== FinEngine.num(this.db.settings.initialSavings);
109
+ if (initialChanged && this.monthsCount > 1) {
110
+ const okRewrite = await confirmDialog({
111
+ title: 'Rewrite the savings chain?',
112
+ body: `Initial savings changes from ${fmt(this.db.settings.initialSavings)} to ${fmt(this.draft.initialSavings)}. `
113
+ + `Every one of your ${this.monthsCount} months gets its savings figures recomputed from the beginning `
114
+ + '(a backup is taken first).',
115
+ confirmText: 'Recompute everything', danger: true,
116
+ });
117
+ if (!okRewrite) return;
118
+ }
119
+ try {
120
+ const res = unwrap(await window.api.saveSettings({
121
+ settings: FinEngine.clone(this.draft),
122
+ expectedRev: this.db.meta.rev,
123
+ }));
124
+ Alpine.store('data').db = res.data;
125
+ this.reset();
126
+ this.ui.savedSnapshot = JSON.stringify(res.data.months[this.ui.currentKey]);
127
+ if (res.changes && res.changes.length) {
128
+ this.ui.recomputeChanges = res.changes;
129
+ this.ui.modals.recompute = true;
130
+ } else {
131
+ showToast('Settings saved', 'success');
132
+ }
133
+ } catch (e) {
134
+ showToast(e.message, 'error', 7000);
135
+ }
136
+ },
137
+
138
+ // -------------------------------------------------------- updates
139
+
140
+ updateCheckEnabled () {
141
+ return !(this.db && this.db.settings && this.db.settings.updateCheck === false); // default on
142
+ },
143
+
144
+ /**
145
+ * Saved immediately rather than through the groups draft: the toggle
146
+ * sits away from that form's Save button, so leaving it pending would
147
+ * read as "it didn't take".
148
+ */
149
+ async setUpdateCheck (enabled) {
150
+ if (this.ui.offline) return;
151
+ try {
152
+ const settings = FinEngine.clone(this.db.settings);
153
+ settings.updateCheck = !!enabled;
154
+ const res = unwrap(await window.api.saveSettings({ settings, expectedRev: this.db.meta.rev }));
155
+ Alpine.store('data').db = res.data;
156
+ this.reset();
157
+ if (enabled) {
158
+ this.checkNow();
159
+ } else {
160
+ Alpine.store('data').update = { available: false, latest: null, url: '', checking: false, checked: false };
161
+ }
162
+ } catch (e) {
163
+ showToast(e.message, 'error', 7000);
164
+ }
165
+ },
166
+
167
+ checkNow () {
168
+ // the root component owns the call; Settings just asks for a fresh one
169
+ const root = document.querySelector('[x-data="appRoot()"]');
170
+ if (root && root._x_dataStack) Alpine.$data(root).checkUpdate({ force: true });
171
+ },
172
+
173
+ openReleases () {
174
+ const root = document.querySelector('[x-data="appRoot()"]');
175
+ if (root && root._x_dataStack) Alpine.$data(root).openReleases();
176
+ },
177
+
178
+ // ---------------------------------------------------- app password
179
+
180
+ pwCurrent: '', pwNew: '', pwConfirm: '',
181
+ get hasPassword () { return !!(this.db && this.db.settings && this.db.settings.auth); },
182
+ get isWeb () { return !!window.IS_WEB; },
183
+
184
+ async setPassword () {
185
+ if (!this.pwNew) return showToast('Enter a new password.', 'error');
186
+ if (this.pwNew.length < 4) return showToast('Use at least 4 characters.', 'error');
187
+ if (this.pwNew !== this.pwConfirm) return showToast('The two passwords don’t match.', 'error');
188
+ try {
189
+ const res = unwrap(await window.api.authSet({ current: this.pwCurrent, next: this.pwNew }));
190
+ await this.refreshAuthLocal();
191
+ this.pwCurrent = this.pwNew = this.pwConfirm = '';
192
+ showToast('App password ' + (this.hasPassword ? 'set' : 'removed'), 'success');
193
+ return res;
194
+ } catch (e) { showToast(e.message, 'error', 7000); }
195
+ },
196
+
197
+ async removePassword () {
198
+ const okRemove = await confirmDialog({
199
+ title: 'Remove the app password?',
200
+ body: 'The app opens without a lock screen, and web access (if enabled) stops until a new password is set.',
201
+ confirmText: 'Remove password', danger: true,
202
+ });
203
+ if (!okRemove) return;
204
+ try {
205
+ unwrap(await window.api.authSet({ current: this.pwCurrent, next: '' }));
206
+ await this.refreshAuthLocal();
207
+ this.pwCurrent = '';
208
+ showToast('App password removed', 'success');
209
+ } catch (e) { showToast(e.message, 'error', 7000); }
210
+ },
211
+
212
+ /** Pull the fresh auth block + rev without disturbing the draft. */
213
+ async refreshAuthLocal () {
214
+ const fresh = unwrap(await window.api.loadDb());
215
+ for (const target of [this.db.settings, this.draft]) {
216
+ if (!target) continue;
217
+ if (fresh.data.settings.auth) target.auth = FinEngine.clone(fresh.data.settings.auth);
218
+ else delete target.auth;
219
+ }
220
+ this.db.meta.rev = fresh.data.meta.rev;
221
+ },
222
+
223
+ // ------------------------------------------------------ web access
224
+
225
+ web: { loaded: false, enabled: false, port: 4180, running: false, urls: [], hasPassword: false, trustProxy: 0, secureCookie: false },
226
+
227
+ async loadWebStatus () {
228
+ if (this.isWeb || !window.api.webStatus) return; // desktop only
229
+ try {
230
+ Object.assign(this.web, unwrap(await window.api.webStatus()), { loaded: true });
231
+ } catch { /* main process predates web access */ }
232
+ },
233
+
234
+ async toggleWeb () {
235
+ try {
236
+ const res = unwrap(await window.api.webSet({ enabled: !this.web.enabled, port: this.web.port, trustProxy: this.web.trustProxy, secureCookie: this.web.secureCookie }));
237
+ Object.assign(this.web, res);
238
+ showToast(res.enabled ? 'Web access is on' : 'Web access is off', 'success');
239
+ } catch (e) { showToast(e.message, 'error', 7000); }
240
+ },
241
+
242
+ async applyWebPort () {
243
+ if (!this.web.enabled) return;
244
+ try {
245
+ Object.assign(this.web, unwrap(await window.api.webSet({ enabled: true, port: this.web.port, trustProxy: this.web.trustProxy, secureCookie: this.web.secureCookie })));
246
+ showToast('Web access moved to port ' + this.web.port, 'success');
247
+ } catch (e) { showToast(e.message, 'error', 7000); }
248
+ },
249
+
250
+ // reverse-proxy settings; persisted even while web access is off so
251
+ // they're already in place the next time it's turned on
252
+ async applyWebProxy () {
253
+ try {
254
+ Object.assign(this.web, unwrap(await window.api.webSet({ enabled: this.web.enabled, port: this.web.port, trustProxy: this.web.trustProxy, secureCookie: this.web.secureCookie })));
255
+ showToast('Reverse-proxy settings saved', 'success');
256
+ } catch (e) { showToast(e.message, 'error', 7000); }
257
+ },
258
+
259
+ // ------------------------------------------------------------ data
260
+
261
+ async exportDb () {
262
+ try {
263
+ const res = unwrap(await window.api.exportDb());
264
+ if (res.exported) showToast(`Exported to ${res.exported}`, 'success', 6000);
265
+ } catch (e) { showToast(e.message, 'error', 7000); }
266
+ },
267
+
268
+ async changeLocation () {
269
+ const okMove = await confirmDialog({
270
+ title: 'Move the database?',
271
+ body: 'Pick a new location for db.json - for example a synced folder (Dropbox, OneDrive) to share data '
272
+ + 'between machines. Choosing an existing db.json adopts that file instead of overwriting it.',
273
+ confirmText: 'Choose location',
274
+ });
275
+ if (!okMove) return;
276
+ try {
277
+ const res = unwrap(await window.api.changeDbLocation());
278
+ Alpine.store('data').db = res.data;
279
+ Alpine.store('data').path = res.path;
280
+ this.afterDataReplaced();
281
+ showToast(`Database now at ${res.path}`, 'success', 6000);
282
+ } catch (e) { showToast(e.message, 'error', 7000); }
283
+ },
284
+
285
+ async importLegacy () {
286
+ const okImport = await confirmDialog({
287
+ title: 'Import legacy data?',
288
+ body: 'Select the old finances app’s data folder (the one with files like “january-26”). '
289
+ + 'You’ll get to review each group’s type before anything is written. '
290
+ + 'Importing REPLACES the current database - a backup of it is taken first.',
291
+ confirmText: 'Choose folder…', danger: true,
292
+ });
293
+ if (!okImport) return;
294
+ try {
295
+ const res = unwrap(await window.api.migrateScan());
296
+ if (!res.scanned) return;
297
+ this.ui.importMap = { folder: res.folder, groups: res.groups.map((g) => ({ ...g })) };
298
+ this.ui.modals.importMap = true;
299
+ } catch (e) { showToast(e.message, 'error', 9000); }
300
+ },
301
+
302
+ async runImport () {
303
+ const map = this.ui.importMap;
304
+ const overrides = Object.fromEntries(map.groups.map((g) => [g.title, g.kind]));
305
+ try {
306
+ const res = unwrap(await window.api.migrateLegacy({ folder: map.folder, overrides }));
307
+ if (!res.imported) return;
308
+ this.ui.modals.importMap = false;
309
+ Alpine.store('data').db = res.data;
310
+ this.afterDataReplaced();
311
+ this.ui.importSummary = res.summary;
312
+ this.ui.modals.importSummary = true;
313
+ } catch (e) { showToast(e.message, 'error', 9000); }
314
+ },
315
+
316
+ async loadBackups () {
317
+ try {
318
+ const res = unwrap(await window.api.listBackups());
319
+ this.backups = res.backups;
320
+ this.ui.modals.backups = true;
321
+ } catch (e) { showToast(e.message, 'error', 7000); }
322
+ },
323
+
324
+ async restoreBackup (backup) {
325
+ const okRestore = await confirmDialog({
326
+ title: `Restore ${backup.name}?`,
327
+ body: 'The current data is backed up first, then replaced by this snapshot.',
328
+ confirmText: 'Restore', danger: true,
329
+ });
330
+ if (!okRestore) return;
331
+ try {
332
+ const res = unwrap(await window.api.restoreBackup({ name: backup.name }));
333
+ Alpine.store('data').db = res.data;
334
+ this.ui.modals.backups = false;
335
+ this.afterDataReplaced();
336
+ showToast('Backup restored', 'success');
337
+ } catch (e) { showToast(e.message, 'error', 7000); }
338
+ },
339
+
340
+ openBackupsFolder () { window.api.openBackupsFolder(); },
341
+
342
+ /** After the whole db is swapped, re-point the UI at a sensible month. */
343
+ afterDataReplaced () {
344
+ const db = this.db;
345
+ const keys = FinEngine.monthKeys(db);
346
+ const open = keys.filter((k) => db.months[k].status === 'open');
347
+ this.ui.currentKey = open.length ? open[open.length - 1] : keys[keys.length - 1];
348
+ this.ui.unlockedKeys = [];
349
+ this.ui.savedSnapshot = JSON.stringify(db.months[this.ui.currentKey]);
350
+ this.reset();
351
+ },
352
+ };
353
+ }
@@ -0,0 +1,50 @@
1
+ /*
2
+ * Web-preview shim: when the renderer runs in a plain browser (dev-server.mjs)
3
+ * instead of Electron, window.api is provided over HTTP. Never loaded by the
4
+ * Electron build - the dev server injects the <script> tag when serving.
5
+ */
6
+ 'use strict';
7
+
8
+ if (!window.api) {
9
+ window.IS_WEB = true; // renderer is running in a browser, not Electron
10
+ const call = (method) => async (payload) => {
11
+ const res = await fetch('/api/' + method, {
12
+ method: 'POST',
13
+ headers: { 'Content-Type': 'application/json' },
14
+ body: JSON.stringify(payload || {}),
15
+ });
16
+ if (res.status === 401) {
17
+ // session expired - reload lands on the server's login page
18
+ window.location.reload();
19
+ return { ok: false, error: 'Signed out - reloading…' };
20
+ }
21
+ return res.json();
22
+ };
23
+ window.api = {
24
+ loadDb: call('loadDb'),
25
+ rev: call('rev'),
26
+ // routed by the dev preview server; the production web server only
27
+ // exposes auth via its own /api/login (password mgmt is desktop-only)
28
+ authHas: call('authHas'),
29
+ authVerify: call('authVerify'),
30
+ authSet: call('authSet'),
31
+ saveMonth: call('saveMonth'),
32
+ saveClosedMonth: call('saveClosedMonth'),
33
+ closeMonth: call('closeMonth'),
34
+ saveSettings: call('saveSettings'),
35
+ applyTagsEverywhere: call('applyTagsEverywhere'),
36
+ listBackups: call('listBackups'),
37
+ restoreBackup: call('restoreBackup'),
38
+ openBackupsFolder: call('openBackupsFolder'),
39
+ exportDb: call('exportDb'),
40
+ changeDbLocation: call('changeDbLocation'),
41
+ migrateScan: call('migrateScan'),
42
+ migrateLegacy: call('migrateLegacy'),
43
+ checkUpdate: call('checkUpdate'),
44
+ // no shell here: the browser opens the release page itself
45
+ openReleases: async () => {
46
+ window.open('https://github.com/blindmikey/spendwise/releases/latest', '_blank', 'noopener,noreferrer');
47
+ return { ok: true };
48
+ },
49
+ };
50
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "Spend Wise",
3
+ "short_name": "Spend Wise",
4
+ "description": "Envelope budgeting - your money, spent wisely.",
5
+ "start_url": "/",
6
+ "scope": "/",
7
+ "display": "standalone",
8
+ "background_color": "#fafafa",
9
+ "theme_color": "#059669",
10
+ "icons": [
11
+ {
12
+ "src": "assets/icon.png",
13
+ "sizes": "48x48 72x72 96x96 128x128 256x256 512x512 1024x1024 2048x2048",
14
+ "type": "image/png",
15
+ "purpose": "any"
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1 @@
1
+ (()=>{function g(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 c=(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,()=>{Math.abs(t.getBoundingClientRect().height-a)<1&&(t.style.overflow=null)})},out(d=()=>{},s=()=>{}){let o=t.getBoundingClientRect().height;n.transition(t,c,{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(g)});})();
@@ -0,0 +1,5 @@
1
+ (()=>{var ee=!1,re=!1,W=[],ne=-1,ie=!1;function Ve(t){Dn(t)}function Ue(){ie=!0}function qe(){ie=!1,We()}function Dn(t){W.includes(t)||W.push(t),We()}function Ke(t){let e=W.indexOf(t);e!==-1&&e>ne&&W.splice(e,1)}function We(){if(!re&&!ee){if(ie)return;ee=!0,queueMicrotask(In)}}function In(){ee=!1,re=!0;for(let t=0;t<W.length;t++)W[t](),ne=t;W.length=0,ne=-1,re=!1}var C,R,j,se,oe=!0;function Ge(t){oe=!1,t(),oe=!0}function Je(t){C=t.reactive,j=t.release,R=e=>t.effect(e,{scheduler:r=>{oe?Ve(r):r()}}),se=t.raw}function ae(t){R=t}function Ye(t){let e=()=>{};return[n=>{let i=R(n);return t._x_effects||(t._x_effects=new Set,t._x_runEffects=()=>{t._x_effects.forEach(o=>o())}),t._x_effects.add(i),e=()=>{i!==void 0&&(t._x_effects.delete(i),j(i))},i},()=>{e()}]}function St(t,e){let r=!0,n,i,o=R(()=>{let s=t(),a=JSON.stringify(s);if(!r&&(typeof s=="object"||s!==n)){let c=typeof n=="object"?JSON.parse(i):n;queueMicrotask(()=>{e(s,c)})}n=s,i=a,r=!1});return()=>j(o)}async function Xe(t){Ue();try{await t(),await Promise.resolve()}finally{qe()}}var Ze=[],Qe=[],tr=[];function er(t){tr.push(t)}function et(t,e){typeof e=="function"?(t._x_cleanups||(t._x_cleanups=[]),t._x_cleanups.push(e)):(e=t,Qe.push(e))}function At(t){Ze.push(t)}function Ot(t,e,r){t._x_attributeCleanups||(t._x_attributeCleanups={}),t._x_attributeCleanups[e]||(t._x_attributeCleanups[e]=[]),t._x_attributeCleanups[e].push(r)}function ce(t,e){t._x_attributeCleanups&&Object.entries(t._x_attributeCleanups).forEach(([r,n])=>{(e===void 0||e.includes(r))&&(n.forEach(i=>i()),delete t._x_attributeCleanups[r])})}function rr(t){for(t._x_effects?.forEach(Ke);t._x_cleanups?.length;)t._x_cleanups.pop()()}var le=new MutationObserver(pe),ue=!1;function ut(){le.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0}),ue=!0}function fe(){kn(),le.disconnect(),ue=!1}var lt=[];function kn(){let t=le.takeRecords();lt.push(()=>t.length>0&&pe(t));let e=lt.length;queueMicrotask(()=>{if(lt.length===e)for(;lt.length>0;)lt.shift()()})}function m(t){if(!ue)return t();fe();let e=t();return ut(),e}var de=!1,vt=[];function nr(){de=!0}function ir(){de=!1,pe(vt),vt=[]}function pe(t){if(de){vt=vt.concat(t);return}let e=[],r=new Set,n=new Map,i=new Map;for(let o=0;o<t.length;o++)if(!t[o].target._x_ignoreMutationObserver&&(t[o].type==="childList"&&(t[o].removedNodes.forEach(s=>{s.nodeType===1&&s._x_marker&&r.add(s)}),t[o].addedNodes.forEach(s=>{if(s.nodeType===1){if(r.has(s)){r.delete(s);return}s._x_marker||e.push(s)}})),t[o].type==="attributes")){let s=t[o].target,a=t[o].attributeName,c=t[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)=>{ce(s,o)}),n.forEach((o,s)=>{Ze.forEach(a=>a(s,o))});for(let o of r)e.some(s=>s.contains(o))||Qe.forEach(s=>s(o));for(let o of e)o.isConnected&&tr.forEach(s=>s(o));e=null,r=null,n=null,i=null}function Ct(t){return P(F(t))}function N(t,e,r){return t._x_dataStack=[e,...F(r||t)],()=>{t._x_dataStack=t._x_dataStack.filter(n=>n!==e)}}function F(t){return t._x_dataStack?t._x_dataStack:typeof ShadowRoot=="function"&&t instanceof ShadowRoot?F(t.host):t.parentNode?F(t.parentNode):[]}function P(t){return new Proxy({objects:t},$n)}function or(t,e){return t===null||t===Object.prototype?null:Object.prototype.hasOwnProperty.call(t,e)?t:or(Object.getPrototypeOf(t),e)}var $n={ownKeys({objects:t}){return Array.from(new Set(t.flatMap(e=>Object.keys(e))))},has({objects:t},e){return e==Symbol.unscopables?!1:t.some(r=>Object.prototype.hasOwnProperty.call(r,e)||Reflect.has(r,e))},get({objects:t},e,r){return e=="toJSON"?Ln:Reflect.get(t.find(n=>Reflect.has(n,e))||{},e,r)},set({objects:t},e,r,n){let i;for(let s of t)if(i=or(s,e),i)break;i||(i=t[t.length-1]);let o=Object.getOwnPropertyDescriptor(i,e);return o?.set&&o?.get?o.set.call(n,r)||!0:Reflect.set(i,e,r)}};function Ln(){return Reflect.ownKeys(this).reduce((e,r)=>(e[r]=Reflect.get(this,r),e),{})}function rt(t){let e=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||typeof s=="object"&&s!==null&&s.__v_skip)return;let c=i===""?o:`${i}.${o}`;typeof s=="object"&&s!==null&&s._x_interceptor?n[o]=s.initialize(t,c,o):e(s)&&s!==n&&!(s instanceof Element)&&r(s,c)})};return r(t)}function Tt(t,e=()=>{}){let r={initialValue:void 0,_x_interceptor:!0,initialize(n,i,o){return t(this.initialValue,()=>jn(n,i),s=>me(n,i,s),i,o)}};return e(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 jn(t,e){return e.split(".").reduce((r,n)=>r[n],t)}function me(t,e,r){if(typeof e=="string"&&(e=e.split(".")),e.length===1)t[e[0]]=r;else{if(e.length===0)throw error;return t[e[0]]||(t[e[0]]={}),me(t[e[0]],e.slice(1),r)}}var sr={};function x(t,e){sr[t]=e}function H(t,e){let r=Fn(e);return Object.entries(sr).forEach(([n,i])=>{Object.defineProperty(t,`$${n}`,{get(){return i(e,r)},enumerable:!1})}),t}function Fn(t){let[e,r]=he(t),n={interceptor:Tt,...e};return et(t,r),n}function ar(t,e,r,...n){try{return r(...n)}catch(i){nt(i,t,e)}}function nt(...t){return cr(...t)}var cr=Bn;function lr(t){cr=t}function Bn(t,e,r=void 0){t=Object.assign(t??{message:"No error message given."},{el:e,expression:r}),console.warn(`Alpine Expression Error: ${t.message}
2
+
3
+ ${r?'Expression: "'+r+`"
4
+
5
+ `:""}`,e),setTimeout(()=>{throw t},0)}var it=!0;function Mt(t){let e=it;it=!1;let r=t();return it=e,r}function T(t,e,r={}){let n;return _(t,e)(i=>n=i,r),n}function _(...t){return ur(...t)}var ur=()=>{};function fr(t){ur=t}var dr;function pr(t){dr=t}function mr(t,e){let r={};H(r,t);let n=[r,...F(t)],i=typeof e=="function"?zn(n,e):Vn(n,e,t);return ar.bind(null,t,e,i)}function zn(t,e){return(r=()=>{},{scope:n={},params:i=[],context:o}={})=>{if(!it){ft(r,e,P([n,...t]),i);return}let s=e.apply(P([n,...t]),i);ft(r,s)}}var _e={};function Hn(t,e){if(_e[t])return _e[t];let r=Object.getPrototypeOf(async function(){}).constructor,n=/^[\n\s]*if.*\(.*\)/.test(t.trim())||/^(let|const)\s/.test(t.trim())?`(async()=>{ ${t} })()`:t,o=(()=>{try{let s=new r(["__self","scope"],`with (scope) { __self.result = ${n} }; __self.finished = true; return __self.result;`);return Object.defineProperty(s,"name",{value:`[Alpine] ${t}`}),s}catch(s){return nt(s,e,t),Promise.resolve()}})();return _e[t]=o,o}function Vn(t,e,r){let n=Hn(e,r);return(i=()=>{},{scope:o={},params:s=[],context:a}={})=>{n.result=void 0,n.finished=!1;let c=P([o,...t]);if(typeof n=="function"){let l=n.call(a,n,c).catch(u=>nt(u,r,e));n.finished?(ft(i,n.result,c,s,r),n.result=void 0):l.then(u=>{ft(i,u,c,s,r)}).catch(u=>nt(u,r,e)).finally(()=>n.result=void 0)}}}function ft(t,e,r,n,i){if(it&&typeof e=="function"){let o=e.apply(r,n);o instanceof Promise?o.then(s=>ft(t,s,r,n)).catch(s=>nt(s,i,e)):t(o)}else typeof e=="object"&&e instanceof Promise?e.then(o=>t(o)):t(e)}function hr(...t){return dr(...t)}function _r(t,e,r={}){let n={};H(n,t);let i=[n,...F(t)],o=P([r.scope??{},...i]),s=r.params??[];if(e.includes("await")){let a=Object.getPrototypeOf(async function(){}).constructor,c=/^[\n\s]*if.*\(.*\)/.test(e.trim())||/^(let|const)\s/.test(e.trim())?`(async()=>{ ${e} })()`:e;return new a(["scope"],`with (scope) { let __result = ${c}; return __result }`).call(r.context,o)}else{let a=/^[\n\s]*if.*\(.*\)/.test(e.trim())||/^(let|const)\s/.test(e.trim())?`(()=>{ ${e} })()`:e,l=new Function(["scope"],`with (scope) { let __result = ${a}; return __result }`).call(r.context,o);return typeof l=="function"&&it?l.apply(o,s):l}}var ye="x-";function O(t=""){return ye+t}function gr(t){ye=t}var Rt={};function p(t,e){return Rt[t]=e,{before(r){if(!Rt[r]){console.warn(String.raw`Cannot find directive \`${r}\`. \`${t}\` will use the default order of execution`);return}let n=G.indexOf(r);G.splice(n>=0?n:G.indexOf("DEFAULT"),0,t)}}}function xr(t){return Object.keys(Rt).includes(t)}function pt(t,e,r){if(e=Array.from(e),t._x_virtualDirectives){let o=Object.entries(t._x_virtualDirectives).map(([a,c])=>({name:a,value:c})),s=be(o);o=o.map(a=>s.find(c=>c.name===a.name)?{name:`x-bind:${a.name}`,value:`"${a.value}"`}:a),e=e.concat(o)}let n={};return e.map(wr((o,s)=>n[o]=s)).filter(Sr).map(qn(n,r)).sort(Kn).map(o=>Un(t,o))}function be(t){return Array.from(t).map(wr()).filter(e=>!Sr(e))}var ge=!1,dt=new Map,yr=Symbol();function br(t){ge=!0;let e=Symbol();yr=e,dt.set(e,[]);let r=()=>{for(;dt.get(e).length;)dt.get(e).shift()();dt.delete(e)},n=()=>{ge=!1,r()};t(r),n()}function he(t){let e=[],r=a=>e.push(a),[n,i]=Ye(t);return e.push(i),[{Alpine:B,effect:n,cleanup:r,evaluateLater:_.bind(_,t),evaluate:T.bind(T,t)},()=>e.forEach(a=>a())]}function Un(t,e){let r=()=>{},n=Rt[e.type]||r,[i,o]=he(t);Ot(t,e.original,o);let s=()=>{t._x_ignore||t._x_ignoreSelf||(n.inline&&n.inline(t,e,i),n=n.bind(n,t,e,i),ge?dt.get(yr).push(n):n())};return s.runCleanups=o,s}var Nt=(t,e)=>({name:r,value:n})=>(r.startsWith(t)&&(r=r.replace(t,e)),{name:r,value:n}),Pt=t=>t;function wr(t=()=>{}){return({name:e,value:r})=>{let{name:n,value:i}=Er.reduce((o,s)=>s(o),{name:e,value:r});return n!==e&&t(n,e),{name:n,value:i}}}var Er=[];function ot(t){Er.push(t)}function Sr({name:t}){return vr().test(t)}var vr=()=>new RegExp(`^${ye}([^:^.]+)\\b`);function qn(t,e){return({name:r,value:n})=>{r===n&&(n="");let i=r.match(vr()),o=r.match(/:([a-zA-Z0-9\-_:]+)/),s=r.match(/\.[^.\]]+(?=[^\]]*$)/g)||[],a=e||t[r]||r;return{type:i?i[1]:null,value:o?o[1]:null,modifiers:s.map(c=>c.replace(".","")),expression:n,original:a}}}var xe="DEFAULT",G=["ignore","ref","id","data","anchor","bind","init","for","model","modelable","transition","show","if",xe,"teleport"];function Kn(t,e){let r=G.indexOf(t.type)===-1?xe:t.type,n=G.indexOf(e.type)===-1?xe:e.type;return G.indexOf(r)-G.indexOf(n)}function J(t,e,r={},n={}){return t.dispatchEvent(new CustomEvent(e,{detail:r,bubbles:!0,composed:!0,cancelable:!0,...n}))}function D(t,e){if(typeof ShadowRoot=="function"&&t instanceof ShadowRoot){Array.from(t.children).forEach(i=>D(i,e));return}let r=!1;if(e(t,()=>r=!0),r)return;let n=t.firstElementChild;for(;n;)D(n,e,!1),n=n.nextElementSibling}function E(t,...e){console.warn(`Alpine Warning: ${t}`,...e)}var Ar=!1;function Or(){Ar&&E("Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems."),Ar=!0,document.body||E("Unable to initialize. Trying to load Alpine before `<body>` is available. Did you forget to add `defer` in Alpine's `<script>` tag?"),J(document,"alpine:init"),J(document,"alpine:initializing"),ut(),er(e=>S(e,D)),et(e=>I(e)),At((e,r)=>{pt(e,r).forEach(n=>n())});let t=e=>!Y(e.parentElement,!0);Array.from(document.querySelectorAll(Mr().join(","))).filter(t).forEach(e=>{S(e)}),J(document,"alpine:initialized"),setTimeout(()=>{Gn()})}var we=[],Cr=[];function Tr(){return we.map(t=>t())}function Mr(){return we.concat(Cr).map(t=>t())}function Dt(t){we.push(t)}function It(t){Cr.push(t)}function Y(t,e=!1){return A(t,r=>{if((e?Mr():Tr()).some(i=>r.matches(i)))return!0})}function A(t,e){if(t){if(e(t))return t;if(t._x_teleportBack)return A(t._x_teleportBack,e);if(t.parentNode instanceof ShadowRoot)return A(t.parentNode.host,e);if(t.parentElement)return A(t.parentElement,e)}}function Rr(t){return Tr().some(e=>t.matches(e))}var Nr=[];function Pr(t){Nr.push(t)}var Wn=1;function S(t,e=D,r=()=>{}){A(t,n=>n._x_ignore)||br(()=>{e(t,(n,i)=>{n._x_marker||(r(n,i),Nr.forEach(o=>o(n,i)),pt(n,n.attributes).forEach(o=>o()),n._x_ignore||(n._x_marker=Wn++),n._x_ignore&&i())})})}function I(t,e=D){e(t,r=>{rr(r),ce(r),delete r._x_marker})}function Gn(){[["ui","dialog",["[x-dialog], [x-popover]"]],["anchor","anchor",["[x-anchor]"]],["sort","sort",["[x-sort]"]]].forEach(([e,r,n])=>{xr(r)||n.some(i=>{if(document.querySelector(i))return E(`found "${i}", but missing ${e} plugin`),!0})})}var Ee=[],Se=!1;function st(t=()=>{}){return queueMicrotask(()=>{Se||setTimeout(()=>{kt()})}),new Promise(e=>{Ee.push(()=>{t(),e()})})}function kt(){for(Se=!1;Ee.length;)Ee.shift()()}function Dr(){Se=!0}function mt(t,e){return Array.isArray(e)?Ir(t,e.join(" ")):typeof e=="object"&&e!==null?Jn(t,e):typeof e=="function"?mt(t,e()):Ir(t,e)}function ve(t){return t.split(/\s/).filter(Boolean)}function Ir(t,e){let r=i=>ve(i).filter(o=>!t.classList.contains(o)).filter(Boolean),n=i=>(t.classList.add(...i),()=>{t.classList.remove(...i)});return e=e===!0?e="":e||"",n(r(e))}function Jn(t,e){let r=Object.entries(e).flatMap(([s,a])=>a?ve(s):!1).filter(Boolean),n=Object.entries(e).flatMap(([s,a])=>a?!1:ve(s)).filter(Boolean),i=[],o=[];return n.forEach(s=>{t.classList.contains(s)&&(t.classList.remove(s),o.push(s))}),r.forEach(s=>{t.classList.contains(s)||(t.classList.add(s),i.push(s))}),()=>{o.forEach(s=>t.classList.add(s)),i.forEach(s=>t.classList.remove(s))}}function X(t,e){return typeof e=="object"&&e!==null?Yn(t,e):Xn(t,e)}function Yn(t,e){let r={};return Object.entries(e).forEach(([n,i])=>{r[n]=t.style[n],n.startsWith("--")||(n=Zn(n)),t.style.setProperty(n,i)}),setTimeout(()=>{t.style.length===0&&t.removeAttribute("style")}),()=>{X(t,r)}}function Xn(t,e){let r=t.getAttribute("style",e);return t.setAttribute("style",e),()=>{t.setAttribute("style",r||"")}}function Zn(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function ht(t,e=()=>{}){let r=!1;return function(){r?e.apply(this,arguments):(r=!0,t.apply(this,arguments))}}p("transition",(t,{value:e,modifiers:r,expression:n},{evaluate:i})=>{typeof n=="function"&&(n=i(n)),n!==!1&&(!n||typeof n=="boolean"?ti(t,r,e):Qn(t,n,e))});function Qn(t,e,r){kr(t,mt,""),{enter:i=>{t._x_transition.enter.during=i},"enter-start":i=>{t._x_transition.enter.start=i},"enter-end":i=>{t._x_transition.enter.end=i},leave:i=>{t._x_transition.leave.during=i},"leave-start":i=>{t._x_transition.leave.start=i},"leave-end":i=>{t._x_transition.leave.end=i}}[r](e)}function ti(t,e,r){kr(t,X);let n=!e.includes("in")&&!e.includes("out")&&!r,i=n||e.includes("in")||["enter"].includes(r),o=n||e.includes("out")||["leave"].includes(r);e.includes("in")&&!n&&(e=e.filter((w,tt)=>tt<e.indexOf("out"))),e.includes("out")&&!n&&(e=e.filter((w,tt)=>tt>e.indexOf("out")));let s=!e.includes("opacity")&&!e.includes("scale"),a=s||e.includes("opacity"),c=s||e.includes("scale"),l=a?0:1,u=c?_t(e,"scale",95)/100:1,f=_t(e,"delay",0)/1e3,b=_t(e,"origin","center"),g="opacity, transform",L=_t(e,"duration",150)/1e3,d=_t(e,"duration",75)/1e3,y="cubic-bezier(0.4, 0.0, 0.2, 1)";i&&(t._x_transition.enter.during={transformOrigin:b,transitionDelay:`${f}s`,transitionProperty:g,transitionDuration:`${L}s`,transitionTimingFunction:y},t._x_transition.enter.start={opacity:l,transform:`scale(${u})`},t._x_transition.enter.end={opacity:1,transform:"scale(1)"}),o&&(t._x_transition.leave.during={transformOrigin:b,transitionDelay:`${f}s`,transitionProperty:g,transitionDuration:`${d}s`,transitionTimingFunction:y},t._x_transition.leave.start={opacity:1,transform:"scale(1)"},t._x_transition.leave.end={opacity:l,transform:`scale(${u})`})}function kr(t,e,r={}){t._x_transition||(t._x_transition={enter:{during:r,start:r,end:r},leave:{during:r,start:r,end:r},in(n=()=>{},i=()=>{}){$t(t,e,{during:this.enter.during,start:this.enter.start,end:this.enter.end},n,i)},out(n=()=>{},i=()=>{}){$t(t,e,{during:this.leave.during,start:this.leave.start,end:this.leave.end},n,i)}})}window.Element.prototype._x_toggleAndCascadeWithTransitions=function(t,e,r,n){let i=document.visibilityState==="visible"?requestAnimationFrame:setTimeout,o=()=>i(r);if(e){t._x_transition&&(t._x_transition.enter||t._x_transition.leave)?t._x_transition.enter&&(Object.entries(t._x_transition.enter.during).length||Object.entries(t._x_transition.enter.start).length||Object.entries(t._x_transition.enter.end).length)?t._x_transition.in(r):o():t._x_transition?t._x_transition.in(r):o();return}t._x_hidePromise=t._x_transition?new Promise((s,a)=>{t._x_transition.out(()=>{},()=>s(n)),t._x_transitioning&&t._x_transitioning.beforeCancel(()=>a({isFromCancelledTransition:!0}))}):Promise.resolve(n),queueMicrotask(()=>{let s=$r(t);s?(s._x_hideChildren||(s._x_hideChildren=[]),s._x_hideChildren.push(t)):i(()=>{let a=c=>{let l=Promise.all([c._x_hidePromise,...(c._x_hideChildren||[]).map(a)]).then(([u])=>u?.());return delete c._x_hidePromise,delete c._x_hideChildren,l};a(t).catch(c=>{if(!c.isFromCancelledTransition)throw c})})})};function $r(t){let e=t.parentNode;if(e)return e._x_hidePromise?e:$r(e)}function $t(t,e,{during:r,start:n,end:i}={},o=()=>{},s=()=>{}){if(t._x_transitioning&&t._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;ei(t,{start(){a=e(t,n)},during(){c=e(t,r)},before:o,end(){a(),l=e(t,i)},after:s,cleanup(){c(),l()}})}function ei(t,e){let r,n,i,o=ht(()=>{m(()=>{r=!0,n||e.before(),i||(e.end(),kt()),e.after(),t.isConnected&&e.cleanup(),delete t._x_transitioning})});t._x_transitioning={beforeCancels:[],beforeCancel(s){this.beforeCancels.push(s)},cancel:ht(function(){for(;this.beforeCancels.length;)this.beforeCancels.shift()();o()}),finish:o},m(()=>{e.start(),e.during()}),Dr(),requestAnimationFrame(()=>{if(r)return;let s=Number(getComputedStyle(t).transitionDuration.replace(/,.*/,"").replace("s",""))*1e3,a=Number(getComputedStyle(t).transitionDelay.replace(/,.*/,"").replace("s",""))*1e3;s===0&&(s=Number(getComputedStyle(t).animationDuration.replace("s",""))*1e3),m(()=>{e.before()}),n=!0,requestAnimationFrame(()=>{r||(m(()=>{e.end()}),kt(),setTimeout(t._x_transitioning.finish,s+a),i=!0)})})}function _t(t,e,r){if(t.indexOf(e)===-1)return r;let n=t[t.indexOf(e)+1];if(!n||e==="scale"&&isNaN(n))return r;if(e==="duration"||e==="delay"){let i=n.match(/([0-9]+)ms/);if(i)return i[1]}return e==="origin"&&["top","right","left","center","bottom"].includes(t[t.indexOf(e)+2])?[n,t[t.indexOf(e)+2]].join(" "):n}var k=!1;function v(t,e=()=>{}){return(...r)=>k?e(...r):t(...r)}function Lr(t){return(...e)=>k&&t(...e)}var jr=[];function V(t){jr.push(t)}function Fr(t,e){jr.forEach(r=>r(t,e)),k=!0,zr(()=>{S(e,(r,n)=>{n(r,()=>{})})}),k=!1}var Lt=!1;function Br(t,e){e._x_dataStack||(e._x_dataStack=t._x_dataStack),k=!0,Lt=!0,zr(()=>{ri(e)}),k=!1,Lt=!1}function ri(t){let e=!1;S(t,(n,i)=>{D(n,(o,s)=>{if(e&&Rr(o))return s();e=!0,i(o,s)})})}function zr(t){let e=R;ae((r,n)=>{let i=e(r);return j(i),()=>{}}),t(),ae(e)}function gt(t,e,r,n=[]){switch(t._x_bindings||(t._x_bindings=C({})),t._x_bindings[e]=r,e=n.includes("camel")?ui(e):e,e){case"value":ni(t,r);break;case"style":oi(t,r);break;case"class":ii(t,r);break;case"selected":case"checked":si(t,e,r);break;default:Hr(t,e,r);break}}function ni(t,e){if(jt(t))t.attributes.value===void 0&&(t.value=e);else if(yt(t))Number.isInteger(e)?t.value=e:!Array.isArray(e)&&typeof e!="boolean"&&![null,void 0].includes(e)?t.value=String(e):Array.isArray(e)?t.checked=e.some(r=>fi(r,t.value)):t.checked=!!e;else if(t.tagName==="SELECT")li(t,e);else{if(t.value===e)return;t.value=e===void 0?"":e}}function ii(t,e){t._x_undoAddedClasses&&t._x_undoAddedClasses(),t._x_undoAddedClasses=mt(t,e)}function oi(t,e){t._x_undoAddedStyles&&t._x_undoAddedStyles(),t._x_undoAddedStyles=X(t,e)}function si(t,e,r){Hr(t,e,r),ci(t,e,r)}function Hr(t,e,r){[null,void 0,!1].includes(r)&&pi(e)?t.removeAttribute(e):(Vr(e)&&(r=e),ai(t,e,r))}function ai(t,e,r){t.getAttribute(e)!=r&&t.setAttribute(e,r)}function ci(t,e,r){t[e]!==r&&(t[e]=r)}function li(t,e){let r=[].concat(e).map(n=>n+"");Array.from(t.options).forEach(n=>{n.selected=r.includes(n.value)})}function ui(t){return t.toLowerCase().replace(/-(\w)/g,(e,r)=>r.toUpperCase())}function fi(t,e){return t==e}function xt(t){return[1,"1","true","on","yes",!0].includes(t)?!0:[0,"0","false","off","no",!1].includes(t)?!1:t?Boolean(t):null}var di=new Set(["allowfullscreen","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","inert","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected","shadowrootclonable","shadowrootdelegatesfocus","shadowrootserializable"]);function Vr(t){return di.has(t)}function pi(t){return!["aria-pressed","aria-checked","aria-expanded","aria-selected"].includes(t)}function Ur(t,e,r){return t._x_bindings&&t._x_bindings[e]!==void 0?t._x_bindings[e]:Kr(t,e,r)}function qr(t,e,r,n=!0){if(t._x_bindings&&t._x_bindings[e]!==void 0)return t._x_bindings[e];if(t._x_inlineBindings&&t._x_inlineBindings[e]!==void 0){let i=t._x_inlineBindings[e];return i.extract=n,Mt(()=>T(t,i.expression))}return Kr(t,e,r)}function Kr(t,e,r){let n=t.getAttribute(e);return n===null?typeof r=="function"?r():r:n===""?!0:Vr(e)?!![e,"true"].includes(n):n}function yt(t){return t.type==="checkbox"||t.localName==="ui-checkbox"||t.localName==="ui-switch"}function jt(t){return t.type==="radio"||t.localName==="ui-radio"}function Ft(t,e){let r;return function(){let n=this,i=arguments,o=function(){r=null,t.apply(n,i)};clearTimeout(r),r=setTimeout(o,e)}}function Bt(t,e){let r;return function(){let n=this,i=arguments;r||(t.apply(n,i),r=!0,setTimeout(()=>r=!1,e))}}function zt({get:t,set:e},{get:r,set:n}){let i=!0,o,s,a=R(()=>{let c=t(),l=r();if(i)n(Ae(c)),i=!1;else{let u=JSON.stringify(c),f=JSON.stringify(l);u!==o?n(Ae(c)):u!==f&&e(Ae(l))}o=JSON.stringify(t()),s=JSON.stringify(r())});return()=>{j(a)}}function Ae(t){return typeof t=="object"?JSON.parse(JSON.stringify(t)):t}function Wr(t){(Array.isArray(t)?t:[t]).forEach(r=>r(B))}var Z={},Gr=!1;function Jr(t,e){if(Gr||(Z=C(Z),Gr=!0),e===void 0)return Z[t];Z[t]=e,rt(Z[t]),typeof e=="object"&&e!==null&&e.hasOwnProperty("init")&&typeof e.init=="function"&&Z[t].init()}function Yr(){return Z}var Xr={};function Zr(t,e){let r=typeof e!="function"?()=>e:e;return t instanceof Element?Oe(t,r()):(Xr[t]=r,()=>{})}function Qr(t){return Object.entries(Xr).forEach(([e,r])=>{Object.defineProperty(t,e,{get(){return(...n)=>r(...n)}})}),t}function Oe(t,e,r){let n=[];for(;n.length;)n.pop()();let i=Object.entries(e).map(([s,a])=>({name:s,value:a})),o=be(i);return i=i.map(s=>o.find(a=>a.name===s.name)?{name:`x-bind:${s.name}`,value:`"${s.value}"`}:s),pt(t,i,r).map(s=>{n.push(s.runCleanups),s()}),()=>{for(;n.length;)n.pop()()}}var tn={};function en(t,e){tn[t]=e}function rn(t,e){return Object.entries(tn).forEach(([r,n])=>{Object.defineProperty(t,r,{get(){return(...i)=>n.bind(e)(...i)},enumerable:!1})}),t}var mi={get reactive(){return C},get release(){return j},get effect(){return R},get raw(){return se},get transaction(){return Xe},version:"3.15.12",flushAndStopDeferringMutations:ir,dontAutoEvaluateFunctions:Mt,disableEffectScheduling:Ge,startObservingMutations:ut,stopObservingMutations:fe,setReactivityEngine:Je,onAttributeRemoved:Ot,onAttributesAdded:At,closestDataStack:F,skipDuringClone:v,onlyDuringClone:Lr,addRootSelector:Dt,addInitSelector:It,setErrorHandler:lr,interceptClone:V,addScopeToNode:N,deferMutations:nr,mapAttributes:ot,evaluateLater:_,interceptInit:Pr,initInterceptors:rt,injectMagics:H,setEvaluator:fr,setRawEvaluator:pr,mergeProxies:P,extractProp:qr,findClosest:A,onElRemoved:et,closestRoot:Y,destroyTree:I,interceptor:Tt,transition:$t,setStyles:X,mutateDom:m,directive:p,entangle:zt,throttle:Bt,debounce:Ft,evaluate:T,evaluateRaw:hr,initTree:S,nextTick:st,prefixed:O,prefix:gr,plugin:Wr,magic:x,store:Jr,start:Or,clone:Br,cloneNode:Fr,bound:Ur,$data:Ct,watch:St,walk:D,data:en,bind:Zr},B=mi;function Ce(t,e){let r=Object.create(null),n=t.split(",");for(let i=0;i<n.length;i++)r[n[i]]=!0;return e?i=>!!r[i.toLowerCase()]:i=>!!r[i]}var hi="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly";var qs=Ce(hi+",async,autofocus,autoplay,controls,default,defer,disabled,hidden,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");var nn=Object.freeze({}),Ks=Object.freeze([]);var _i=Object.prototype.hasOwnProperty,bt=(t,e)=>_i.call(t,e),U=Array.isArray,at=t=>on(t)==="[object Map]";var gi=t=>typeof t=="string",Ht=t=>typeof t=="symbol",wt=t=>t!==null&&typeof t=="object";var xi=Object.prototype.toString,on=t=>xi.call(t),Te=t=>on(t).slice(8,-1);var Vt=t=>gi(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t;var Ut=t=>{let e=Object.create(null);return r=>e[r]||(e[r]=t(r))},yi=/-(\w)/g,Ws=Ut(t=>t.replace(yi,(e,r)=>r?r.toUpperCase():"")),bi=/\B([A-Z])/g,Gs=Ut(t=>t.replace(bi,"-$1").toLowerCase()),Me=Ut(t=>t.charAt(0).toUpperCase()+t.slice(1)),Js=Ut(t=>t?`on${Me(t)}`:""),Re=(t,e)=>t!==e&&(t===t||e===e);var Ne=new WeakMap,Et=[],$,Q=Symbol("iterate"),Pe=Symbol("Map key iterate");function wi(t){return t&&t._isEffect===!0}function fn(t,e=nn){wi(t)&&(t=t.raw);let r=Si(t,e);return e.lazy||r(),r}function dn(t){t.active&&(pn(t),t.options.onStop&&t.options.onStop(),t.active=!1)}var Ei=0;function Si(t,e){let r=function(){if(!r.active)return t();if(!Et.includes(r)){pn(r);try{return Ai(),Et.push(r),$=r,t()}finally{Et.pop(),mn(),$=Et[Et.length-1]}}};return r.id=Ei++,r.allowRecurse=!!e.allowRecurse,r._isEffect=!0,r.active=!0,r.raw=t,r.deps=[],r.options=e,r}function pn(t){let{deps:e}=t;if(e.length){for(let r=0;r<e.length;r++)e[r].delete(t);e.length=0}}var ct=!0,Ie=[];function vi(){Ie.push(ct),ct=!1}function Ai(){Ie.push(ct),ct=!0}function mn(){let t=Ie.pop();ct=t===void 0?!0:t}function M(t,e,r){if(!ct||$===void 0)return;let n=Ne.get(t);n||Ne.set(t,n=new Map);let i=n.get(r);i||n.set(r,i=new Set),i.has($)||(i.add($),$.deps.push(i),$.options.onTrack&&$.options.onTrack({effect:$,target:t,type:e,key:r}))}function K(t,e,r,n,i,o){let s=Ne.get(t);if(!s)return;let a=new Set,c=u=>{u&&u.forEach(f=>{(f!==$||f.allowRecurse)&&a.add(f)})};if(e==="clear")s.forEach(c);else if(r==="length"&&U(t))s.forEach((u,f)=>{(f==="length"||f>=n)&&c(u)});else switch(r!==void 0&&c(s.get(r)),e){case"add":U(t)?Vt(r)&&c(s.get("length")):(c(s.get(Q)),at(t)&&c(s.get(Pe)));break;case"delete":U(t)||(c(s.get(Q)),at(t)&&c(s.get(Pe)));break;case"set":at(t)&&c(s.get(Q));break}let l=u=>{u.options.onTrigger&&u.options.onTrigger({effect:u,target:t,key:r,type:e,newValue:n,oldValue:i,oldTarget:o}),u.options.scheduler?u.options.scheduler(u):u()};a.forEach(l)}var Oi=Ce("__proto__,__v_isRef,__isVue"),hn=new Set(Object.getOwnPropertyNames(Symbol).map(t=>Symbol[t]).filter(Ht)),Ci=_n();var Ti=_n(!0);var sn=Mi();function Mi(){let t={};return["includes","indexOf","lastIndexOf"].forEach(e=>{t[e]=function(...r){let n=h(this);for(let o=0,s=this.length;o<s;o++)M(n,"get",o+"");let i=n[e](...r);return i===-1||i===!1?n[e](...r.map(h)):i}}),["push","pop","shift","unshift","splice"].forEach(e=>{t[e]=function(...r){vi();let n=h(this)[e].apply(this,r);return mn(),n}}),t}function _n(t=!1,e=!1){return function(n,i,o){if(i==="__v_isReactive")return!t;if(i==="__v_isReadonly")return t;if(i==="__v_raw"&&o===(t?e?qi:bn:e?Ui:yn).get(n))return n;let s=U(n);if(!t&&s&&bt(sn,i))return Reflect.get(sn,i,o);let a=Reflect.get(n,i,o);return(Ht(i)?hn.has(i):Oi(i))||(t||M(n,"get",i),e)?a:De(a)?!s||!Vt(i)?a.value:a:wt(a)?t?wn(a):Xt(a):a}}var Ri=Ni();function Ni(t=!1){return function(r,n,i,o){let s=r[n];if(!t&&(i=h(i),s=h(s),!U(r)&&De(s)&&!De(i)))return s.value=i,!0;let a=U(r)&&Vt(n)?Number(n)<r.length:bt(r,n),c=Reflect.set(r,n,i,o);return r===h(o)&&(a?Re(i,s)&&K(r,"set",n,i,s):K(r,"add",n,i)),c}}function Pi(t,e){let r=bt(t,e),n=t[e],i=Reflect.deleteProperty(t,e);return i&&r&&K(t,"delete",e,void 0,n),i}function Di(t,e){let r=Reflect.has(t,e);return(!Ht(e)||!hn.has(e))&&M(t,"has",e),r}function Ii(t){return M(t,"iterate",U(t)?"length":Q),Reflect.ownKeys(t)}var ki={get:Ci,set:Ri,deleteProperty:Pi,has:Di,ownKeys:Ii},$i={get:Ti,set(t,e){return console.warn(`Set operation on key "${String(e)}" failed: target is readonly.`,t),!0},deleteProperty(t,e){return console.warn(`Delete operation on key "${String(e)}" failed: target is readonly.`,t),!0}};var ke=t=>wt(t)?Xt(t):t,$e=t=>wt(t)?wn(t):t,Le=t=>t,Yt=t=>Reflect.getPrototypeOf(t);function qt(t,e,r=!1,n=!1){t=t.__v_raw;let i=h(t),o=h(e);e!==o&&!r&&M(i,"get",e),!r&&M(i,"get",o);let{has:s}=Yt(i),a=n?Le:r?$e:ke;if(s.call(i,e))return a(t.get(e));if(s.call(i,o))return a(t.get(o));t!==i&&t.get(e)}function Kt(t,e=!1){let r=this.__v_raw,n=h(r),i=h(t);return t!==i&&!e&&M(n,"has",t),!e&&M(n,"has",i),t===i?r.has(t):r.has(t)||r.has(i)}function Wt(t,e=!1){return t=t.__v_raw,!e&&M(h(t),"iterate",Q),Reflect.get(t,"size",t)}function an(t){t=h(t);let e=h(this);return Yt(e).has.call(e,t)||(e.add(t),K(e,"add",t,t)),this}function cn(t,e){e=h(e);let r=h(this),{has:n,get:i}=Yt(r),o=n.call(r,t);o?xn(r,n,t):(t=h(t),o=n.call(r,t));let s=i.call(r,t);return r.set(t,e),o?Re(e,s)&&K(r,"set",t,e,s):K(r,"add",t,e),this}function ln(t){let e=h(this),{has:r,get:n}=Yt(e),i=r.call(e,t);i?xn(e,r,t):(t=h(t),i=r.call(e,t));let o=n?n.call(e,t):void 0,s=e.delete(t);return i&&K(e,"delete",t,void 0,o),s}function un(){let t=h(this),e=t.size!==0,r=at(t)?new Map(t):new Set(t),n=t.clear();return e&&K(t,"clear",void 0,void 0,r),n}function Gt(t,e){return function(n,i){let o=this,s=o.__v_raw,a=h(s),c=e?Le:t?$e:ke;return!t&&M(a,"iterate",Q),s.forEach((l,u)=>n.call(i,c(l),c(u),o))}}function Jt(t,e,r){return function(...n){let i=this.__v_raw,o=h(i),s=at(o),a=t==="entries"||t===Symbol.iterator&&s,c=t==="keys"&&s,l=i[t](...n),u=r?Le:e?$e:ke;return!e&&M(o,"iterate",c?Pe:Q),{next(){let{value:f,done:b}=l.next();return b?{value:f,done:b}:{value:a?[u(f[0]),u(f[1])]:u(f),done:b}},[Symbol.iterator](){return this}}}}function q(t){return function(...e){{let r=e[0]?`on key "${e[0]}" `:"";console.warn(`${Me(t)} operation ${r}failed: target is readonly.`,h(this))}return t==="delete"?!1:this}}function Li(){let t={get(o){return qt(this,o)},get size(){return Wt(this)},has:Kt,add:an,set:cn,delete:ln,clear:un,forEach:Gt(!1,!1)},e={get(o){return qt(this,o,!1,!0)},get size(){return Wt(this)},has:Kt,add:an,set:cn,delete:ln,clear:un,forEach:Gt(!1,!0)},r={get(o){return qt(this,o,!0)},get size(){return Wt(this,!0)},has(o){return Kt.call(this,o,!0)},add:q("add"),set:q("set"),delete:q("delete"),clear:q("clear"),forEach:Gt(!0,!1)},n={get(o){return qt(this,o,!0,!0)},get size(){return Wt(this,!0)},has(o){return Kt.call(this,o,!0)},add:q("add"),set:q("set"),delete:q("delete"),clear:q("clear"),forEach:Gt(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(o=>{t[o]=Jt(o,!1,!1),r[o]=Jt(o,!0,!1),e[o]=Jt(o,!1,!0),n[o]=Jt(o,!0,!0)}),[t,r,e,n]}var[ji,Fi,Bi,zi]=Li();function gn(t,e){let r=e?t?zi:Bi:t?Fi:ji;return(n,i,o)=>i==="__v_isReactive"?!t:i==="__v_isReadonly"?t:i==="__v_raw"?n:Reflect.get(bt(r,i)&&i in n?r:n,i,o)}var Hi={get:gn(!1,!1)};var Vi={get:gn(!0,!1)};function xn(t,e,r){let n=h(r);if(n!==r&&e.call(t,n)){let i=Te(t);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 yn=new WeakMap,Ui=new WeakMap,bn=new WeakMap,qi=new WeakMap;function Ki(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Wi(t){return t.__v_skip||!Object.isExtensible(t)?0:Ki(Te(t))}function Xt(t){return t&&t.__v_isReadonly?t:En(t,!1,ki,Hi,yn)}function wn(t){return En(t,!0,$i,Vi,bn)}function En(t,e,r,n,i){if(!wt(t))return console.warn(`value cannot be made reactive: ${String(t)}`),t;if(t.__v_raw&&!(e&&t.__v_isReactive))return t;let o=i.get(t);if(o)return o;let s=Wi(t);if(s===0)return t;let a=new Proxy(t,s===2?n:r);return i.set(t,a),a}function h(t){return t&&h(t.__v_raw)||t}function De(t){return Boolean(t&&t.__v_isRef===!0)}x("nextTick",()=>st);x("dispatch",t=>J.bind(J,t));x("watch",(t,{evaluateLater:e,cleanup:r})=>(n,i)=>{let o=e(n),a=St(()=>{let c;return o(l=>c=l),c},i);r(a)});x("store",Yr);x("data",t=>Ct(t));x("root",t=>Y(t));x("refs",t=>(t._x_refs_proxy||(t._x_refs_proxy=P(Gi(t))),t._x_refs_proxy));function Gi(t){let e=[];return A(t,r=>{r._x_refs&&e.push(r._x_refs)}),e}var je={};function Fe(t){return je[t]||(je[t]=0),++je[t]}function Sn(t,e){return A(t,r=>{if(r._x_ids&&r._x_ids[e])return!0})}function vn(t,e){t._x_ids||(t._x_ids={}),t._x_ids[e]||(t._x_ids[e]=Fe(e))}x("id",(t,{cleanup:e})=>(r,n=null)=>{let i=`${r}${n?`-${n}`:""}`;return Ji(t,i,e,()=>{let o=Sn(t,r),s=o?o._x_ids[r]:Fe(r);return n?`${r}-${s}-${n}`:`${r}-${s}`})});V((t,e)=>{t._x_id&&(e._x_id=t._x_id)});function Ji(t,e,r,n){if(t._x_id||(t._x_id={}),t._x_id[e])return t._x_id[e];let i=n();return t._x_id[e]=i,r(()=>{delete t._x_id[e]}),i}x("el",t=>t);An("Focus","focus","focus");An("Persist","persist","persist");function An(t,e,r){x(e,n=>E(`You can't use [$${e}] without first installing the "${t}" plugin here: https://alpinejs.dev/plugins/${r}`,n))}p("modelable",(t,{expression:e},{effect:r,evaluateLater:n,cleanup:i})=>{let o=n(e),s=()=>{let u;return o(f=>u=f),u},a=n(`${e} = __placeholder`),c=u=>a(()=>{},{scope:{__placeholder:u}}),l=s();c(l),queueMicrotask(()=>{if(!t._x_model)return;t._x_removeModelListeners.default();let u=t._x_model.get,f=t._x_model.setWithModifiers,b=zt({get(){return u()},set(g){f(g)}},{get(){return s()},set(g){c(g)}});i(b)})});p("teleport",(t,{modifiers:e,expression:r},{cleanup:n})=>{t.tagName.toLowerCase()!=="template"&&E("x-teleport can only be used on a <template> tag",t);let i=On(r),o=t.content.cloneNode(!0).firstElementChild;t._x_teleport=o,o._x_teleportBack=t,t.setAttribute("data-teleport-template",!0),o.setAttribute("data-teleport-target",!0),t._x_forwardEvents&&t._x_forwardEvents.forEach(a=>{o.addEventListener(a,c=>{c.stopPropagation(),t.dispatchEvent(new c.constructor(c.type,c))})}),N(o,{},t);let s=(a,c,l)=>{l.includes("prepend")?c.parentNode.insertBefore(a,c):l.includes("append")?c.parentNode.insertBefore(a,c.nextSibling):c.appendChild(a)};m(()=>{v(()=>{s(o,i,e),S(o)})()}),t._x_teleportPutBack=()=>{let a=On(r);m(()=>{s(t._x_teleport,a,e)})},n(()=>m(()=>{o.remove(),I(o)}))});var Yi=document.createElement("div");function On(t){let e=v(()=>document.querySelector(t),()=>Yi)();return e||E(`Cannot find x-teleport element for selector: "${t}"`),e}var Cn=()=>{};Cn.inline=(t,{modifiers:e},{cleanup:r})=>{e.includes("self")?t._x_ignoreSelf=!0:t._x_ignore=!0,r(()=>{e.includes("self")?delete t._x_ignoreSelf:delete t._x_ignore})};p("ignore",Cn);p("effect",v((t,{expression:e},{effect:r})=>{r(_(t,e))}));function z(t,e,r,n){let i=t,o=c=>n(c),s={},a=(c,l)=>u=>l(c,u);return r.includes("dot")&&(e=Xi(e)),r.includes("camel")&&(e=Zi(e)),r.includes("capture")&&(s.capture=!0),r.includes("window")&&(i=window),r.includes("document")&&(i=document),r.includes("passive")&&(s.passive=r[r.indexOf("passive")+1]!=="false"),o=Be(r,o),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("once")&&(o=a(o,(c,l)=>{c(l),i.removeEventListener(e,o,s)})),(r.includes("away")||r.includes("outside"))&&(i=document,o=a(o,(c,l)=>{t.contains(l.target)||l.target.isConnected!==!1&&(t.offsetWidth<1&&t.offsetHeight<1||t._x_isShown!==!1&&c(l))})),r.includes("self")&&(o=a(o,(c,l)=>{l.target===t&&c(l)})),e==="submit"&&(o=a(o,(c,l)=>{l.target._x_pendingModelUpdates&&l.target._x_pendingModelUpdates.forEach(u=>u()),c(l)})),(to(e)||Mn(e))&&(o=a(o,(c,l)=>{eo(l,r)||c(l)})),i.addEventListener(e,o,s),()=>{i.removeEventListener(e,o,s)}}function Be(t,e){if(t.includes("debounce")){let r=t[t.indexOf("debounce")+1]||"invalid-wait",n=Zt(r.split("ms")[0])?Number(r.split("ms")[0]):250;e=Ft(e,n)}if(t.includes("throttle")){let r=t[t.indexOf("throttle")+1]||"invalid-wait",n=Zt(r.split("ms")[0])?Number(r.split("ms")[0]):250;e=Bt(e,n)}return e}function Xi(t){return t.replace(/-/g,".")}function Zi(t){return t.toLowerCase().replace(/-(\w)/g,(e,r)=>r.toUpperCase())}function Zt(t){return!Array.isArray(t)&&!isNaN(t)}function Qi(t){return[" ","_"].includes(t)?t:t.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[_\s]/,"-").toLowerCase()}function to(t){return["keydown","keyup"].includes(t)}function Mn(t){return["contextmenu","click","mouse"].some(e=>t.includes(e))}function eo(t,e){let r=e.filter(o=>!["window","document","prevent","stop","once","capture","self","away","outside","passive","preserve-scroll","blur","change","lazy"].includes(o));if(r.includes("debounce")){let o=r.indexOf("debounce");r.splice(o,Zt((r[o+1]||"invalid-wait").split("ms")[0])?2:1)}if(r.includes("throttle")){let o=r.indexOf("throttle");r.splice(o,Zt((r[o+1]||"invalid-wait").split("ms")[0])?2:1)}if(r.length===0||r.length===1&&Tn(t.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"),t[`${s}Key`])).length===i.length&&(Mn(t.type)||Tn(t.key).includes(r[0])))}function Tn(t){if(!t)return[];t=Qi(t);let e={ctrl:"control",slash:"/",space:" ",spacebar:" ",cmd:"meta",esc:"escape",up:"arrow-up",down:"arrow-down",left:"arrow-left",right:"arrow-right",period:".",comma:",",equal:"=",minus:"-",underscore:"_"};return e[t]=t,Object.keys(e).map(r=>{if(e[r]===t)return r}).filter(r=>r)}p("model",(t,{modifiers:e,expression:r},{effect:n,cleanup:i})=>{let o=t;e.includes("parent")&&(o=A(t,d=>d!==t));let s=_(o,r),a;typeof r=="string"?a=_(o,`${r} = __placeholder`):typeof r=="function"&&typeof r()=="string"?a=_(o,`${r()} = __placeholder`):a=()=>{};let c=()=>{let d;return s(y=>d=y),Rn(d)?d.get():d},l=d=>{let y;s(w=>y=w),Rn(y)?y.set(d):a(()=>{},{scope:{__placeholder:d}})};typeof r=="string"&&t.type==="radio"&&m(()=>{t.hasAttribute("name")||t.setAttribute("name",r)});let u=e.includes("change")||e.includes("lazy"),f=e.includes("blur"),b=e.includes("enter"),g=u||f||b,L;if(k)L=()=>{};else if(g){let d=[],y=w=>l(Qt(t,e,w,c()));if(u&&d.push(z(t,"change",e,y)),f&&(d.push(z(t,"blur",e,y)),t.form)){let w=t.form,tt=()=>y({target:t});w._x_pendingModelUpdates||(w._x_pendingModelUpdates=[]),w._x_pendingModelUpdates.push(tt),i(()=>{w._x_pendingModelUpdates&&w._x_pendingModelUpdates.splice(w._x_pendingModelUpdates.indexOf(tt),1)})}b&&d.push(z(t,"keydown",e,w=>{w.key==="Enter"&&y(w)})),L=()=>d.forEach(w=>w())}else{let d=t.tagName.toLowerCase()==="select"||["checkbox","radio"].includes(t.type)?"change":"input";L=z(t,d,e,y=>{l(Qt(t,e,y,c()))})}if(e.includes("fill")&&([void 0,null,""].includes(c())||yt(t)&&Array.isArray(c())||t.tagName.toLowerCase()==="select"&&t.multiple)&&l(Qt(t,e,{target:t},c())),t._x_removeModelListeners||(t._x_removeModelListeners={}),t._x_removeModelListeners.default=L,i(()=>t._x_removeModelListeners.default()),t.form){let d=z(t.form,"reset",[],y=>{st(()=>t._x_model&&t._x_model.set(Qt(t,e,{target:t},c())))});i(()=>d())}t._x_model={get(){return c()},set(d){l(d)},setWithModifiers:Be(e,l)},t._x_forceModelUpdate=d=>{d===void 0&&typeof r=="string"&&r.match(/\./)&&(d=""),m(()=>{yt(t)?Array.isArray(d)?t.checked=d.some(y=>y==t.value):t.checked=!!d:jt(t)?typeof d=="boolean"?t.checked=xt(t.value)===d:t.checked=t.value==d:gt(t,"value",d)})},n(()=>{let d=c();e.includes("unintrusive")&&document.activeElement.isSameNode(t)||t._x_forceModelUpdate(d)})});function Qt(t,e,r,n){return m(()=>{if(r instanceof CustomEvent&&r.detail!==void 0)return r.detail!==null&&r.detail!==void 0?r.detail:r.target.value;if(yt(t))if(Array.isArray(n)){let i=null;return e.includes("number")?i=ze(r.target.value):e.includes("boolean")?i=xt(r.target.value):i=r.target.value,r.target.checked?n.includes(i)?n:n.concat([i]):n.filter(o=>!ro(o,i))}else return r.target.checked;else{if(t.tagName.toLowerCase()==="select"&&t.multiple)return e.includes("number")?Array.from(r.target.selectedOptions).map(i=>{let o=i.value||i.text;return ze(o)}):e.includes("boolean")?Array.from(r.target.selectedOptions).map(i=>{let o=i.value||i.text;return xt(o)}):Array.from(r.target.selectedOptions).map(i=>i.value||i.text);{let i;return jt(t)?r.target.checked?i=r.target.value:i=n:i=r.target.value,e.includes("number")?ze(i):e.includes("boolean")?xt(i):e.includes("trim")?i.trim():i}}})}function ze(t){let e=t?parseFloat(t):null;return no(e)?e:t}function ro(t,e){return t==e}function no(t){return!Array.isArray(t)&&!isNaN(t)}function Rn(t){return t!==null&&typeof t=="object"&&typeof t.get=="function"&&typeof t.set=="function"}p("cloak",t=>queueMicrotask(()=>m(()=>t.removeAttribute(O("cloak")))));It(()=>`[${O("init")}]`);p("init",v((t,{expression:e},{evaluate:r})=>typeof e=="string"?!!e.trim()&&r(e,{},!1):r(e,{},!1)));p("text",(t,{expression:e},{effect:r,evaluateLater:n})=>{let i=n(e);r(()=>{i(o=>{m(()=>{t.textContent=o})})})});p("html",(t,{expression:e},{effect:r,evaluateLater:n})=>{let i=n(e);r(()=>{i(o=>{m(()=>{t.innerHTML=o??"",t._x_ignoreSelf=!0,S(t),delete t._x_ignoreSelf})})})});ot(Nt(":",Pt(O("bind:"))));var Nn=(t,{value:e,modifiers:r,expression:n,original:i},{effect:o,cleanup:s})=>{if(!e){let c={};Qr(c),_(t,n)(u=>{Oe(t,u,i)},{scope:c});return}if(e==="key")return io(t,n);if(t._x_inlineBindings&&t._x_inlineBindings[e]&&t._x_inlineBindings[e].extract)return;let a=_(t,n);o(()=>a(c=>{c===void 0&&typeof n=="string"&&n.match(/\./)&&(c=""),m(()=>gt(t,e,c,r))})),s(()=>{t._x_undoAddedClasses&&t._x_undoAddedClasses(),t._x_undoAddedStyles&&t._x_undoAddedStyles()})};Nn.inline=(t,{value:e,modifiers:r,expression:n})=>{e&&(t._x_inlineBindings||(t._x_inlineBindings={}),t._x_inlineBindings[e]={expression:n,extract:!1})};p("bind",Nn);function io(t,e){t._x_keyExpression=e}Dt(()=>`[${O("data")}]`);p("data",(t,{expression:e},{cleanup:r})=>{if(oo(t))return;e=e===""?"{}":e;let n={};H(n,t);let i={};rn(i,n);let o=T(t,e,{scope:i});(o===void 0||o===!0)&&(o={}),H(o,t);let s=C(o);rt(s);let a=N(t,s);s.init&&T(t,s.init),r(()=>{s.destroy&&T(t,s.destroy),a()})});V((t,e)=>{t._x_dataStack&&(e._x_dataStack=t._x_dataStack,e.setAttribute("data-has-alpine-state",!0))});function oo(t){return k?Lt?!0:t.hasAttribute("data-has-alpine-state"):!1}p("show",(t,{modifiers:e,expression:r},{effect:n})=>{let i=_(t,r);t._x_doHide||(t._x_doHide=()=>{m(()=>{t.style.setProperty("display","none",e.includes("important")?"important":void 0)})}),t._x_doShow||(t._x_doShow=()=>{m(()=>{t.style.length===1&&t.style.display==="none"?t.removeAttribute("style"):t.style.removeProperty("display")})});let o=()=>{t._x_doHide(),t._x_isShown=!1},s=()=>{t._x_doShow(),t._x_isShown=!0},a=()=>setTimeout(s),c=ht(f=>f?s():o(),f=>{typeof t._x_toggleAndCascadeWithTransitions=="function"?t._x_toggleAndCascadeWithTransitions(t,f,s,o):f?a():o()}),l,u=!0;n(()=>i(f=>{!u&&f===l||(e.includes("immediate")&&(f?a():o()),c(f),l=f,u=!1)}))});p("for",(t,{expression:e},{effect:r,cleanup:n})=>{let i=co(e),o=_(t,i.items),s=_(t,t._x_keyExpression||"index");t._x_lookup=new Map,r(()=>ao(t,i,o,s)),n(()=>{t._x_lookup.forEach(a=>m(()=>{I(a),a.remove()})),delete t._x_lookup})});function so(t){return e=>{Object.entries(e).forEach(([r,n])=>{t[r]=n})}}function ao(t,e,r,n){r(i=>{uo(i)&&(i=Array.from({length:i},(l,u)=>u+1)),i==null&&(i=[]),i instanceof Set&&(i=Array.from(i)),i instanceof Map&&(i=Array.from(i));let o=t._x_lookup,s=new Map;t._x_lookup=s;let a=fo(i),c=Object.entries(i).map(([l,u])=>{a||(l=parseInt(l));let f=lo(e,u,l,i),b;return n(g=>{typeof g=="object"&&E("x-for key cannot be an object, it must be a string or an integer",t),o.has(g)&&(s.set(g,o.get(g)),o.delete(g)),b=g},{scope:{index:l,...f}}),[b,f]});m(()=>{o.forEach(f=>{I(f),f.remove()});let l=new Set,u=t;c.forEach(([f,b])=>{if(s.has(f)){let d=s.get(f);d._x_refreshXForScope(b),u.nextElementSibling!==d&&(u.nextElementSibling&&d.replaceWith(u.nextElementSibling),u.after(d)),u=d,d._x_currentIfEl&&(d.nextElementSibling!==d._x_currentIfEl&&u.after(d._x_currentIfEl),u=d._x_currentIfEl);return}t.content.children.length>1&&E("x-for templates require a single root element, additional elements will be ignored.",t);let g=document.importNode(t.content,!0).firstElementChild,L=C(b);N(g,L,t),g._x_refreshXForScope=so(L),s.set(f,g),l.add(g),u.after(g),u=g}),v(()=>l.forEach(f=>S(f)))()})})}function co(t){let e=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,r=/^\s*\(|\)\s*$/g,n=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,i=t.match(n);if(!i)return;let o={};o.items=i[2].trim();let s=i[1].replace(r,"").trim(),a=s.match(e);return a?(o.item=s.replace(e,"").trim(),o.index=a[1].trim(),a[2]&&(o.collection=a[2].trim())):o.item=s,o}function lo(t,e,r,n){let i={};return/^\[.*\]$/.test(t.item)&&Array.isArray(e)?t.item.replace("[","").replace("]","").split(",").map(s=>s.trim()).forEach((s,a)=>{i[s]=e[a]}):/^\{.*\}$/.test(t.item)&&!Array.isArray(e)&&typeof e=="object"?t.item.replace("{","").replace("}","").split(",").map(s=>s.trim()).forEach(s=>{i[s]=e[s]}):i[t.item]=e,t.index&&(i[t.index]=r),t.collection&&(i[t.collection]=n),i}function uo(t){return typeof t!="object"&&!isNaN(t)}function fo(t){return typeof t=="object"&&!Array.isArray(t)}function Pn(){}Pn.inline=(t,{expression:e},{cleanup:r})=>{let n=Y(t);n&&(n._x_refs||(n._x_refs={}),n._x_refs[e]=t,r(()=>delete n._x_refs[e]))};p("ref",Pn);p("if",(t,{expression:e},{effect:r,cleanup:n})=>{t.tagName.toLowerCase()!=="template"&&E("x-if can only be used on a <template> tag",t);let i=_(t,e),o=()=>{if(t._x_currentIfEl)return t._x_currentIfEl;let a=t.content.cloneNode(!0).firstElementChild;return N(a,{},t),m(()=>{t.after(a),v(()=>S(a))()}),t._x_currentIfEl=a,t._x_undoIf=()=>{m(()=>{I(a),a.remove()}),delete t._x_currentIfEl},a},s=()=>{t._x_undoIf&&(t._x_undoIf(),delete t._x_undoIf)};r(()=>i(a=>{a?o():s()})),n(()=>t._x_undoIf&&t._x_undoIf())});p("id",(t,{expression:e},{evaluate:r})=>{r(e).forEach(i=>vn(t,i))});V((t,e)=>{t._x_ids&&(e._x_ids=t._x_ids)});ot(Nt("@",Pt(O("on:"))));p("on",v((t,{value:e,modifiers:r,expression:n},{cleanup:i})=>{let o=n?_(t,n):()=>{};t.tagName.toLowerCase()==="template"&&(t._x_forwardEvents||(t._x_forwardEvents=[]),t._x_forwardEvents.includes(e)||t._x_forwardEvents.push(e));let s=z(t,e,r,a=>{o(()=>{},{scope:{$event:a},params:[a]})});i(()=>s())}));te("Collapse","collapse","collapse");te("Intersect","intersect","intersect");te("Focus","trap","focus");te("Mask","mask","mask");function te(t,e,r){p(e,n=>E(`You can't use [x-${e}] without first installing the "${t}" plugin here: https://alpinejs.dev/plugins/${r}`,n))}B.setEvaluator(mr);B.setRawEvaluator(_r);B.setReactivityEngine({reactive:Xt,effect:fn,release:dn,raw:h});var He=B;window.Alpine=He;queueMicrotask(()=>{He.start()});})();