@zazz-ui/core 0.14.1 → 0.14.3

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  Notable changes to `@zazz-ui/core`, grouped by primitive or base scope under each version. The grouping is load-bearing: the `zazz-ui` CLI's `update` and `diff` print only the slice that touches the files you've vendored. Breaking entries are flagged **BREAKING** with a one-line migration note. During 0.x, a minor bump means at least one breaking entry (ADR-0010 has the full definition of "breaking").
2
2
 
3
+ ## 0.14.3 (2026-11-18)
4
+
5
+ ### base
6
+
7
+ - `findHeadBlock` and the head-block comparison in `head.ts` (behind the language server's head-block fixes and the CLI) no longer use regexes that CodeQL flags as polynomial on long whitespace runs. Results are unchanged.
8
+
9
+ ## 0.14.2 (2026-11-17)
10
+
11
+ ### drawer
12
+
13
+ - A drawer removed from the page while open lets go of the page. With `data-ui-navigation="swap"`, following a link inside an open drawer replaces the body without closing it, and the drawer kept holding the page at its old scroll position: the next page could not be scrolled, and jittered on iOS, until a reload. The drawer now unbinds as soon as it is gone.
14
+
3
15
  ## 0.14.1 (2026-11-16)
4
16
 
5
17
  ### base
package/README.md CHANGED
@@ -20,7 +20,7 @@ import "@zazz-ui/core"; // custom elements and shared behaviors
20
20
  From a CDN, the script needs an import map for its one dependency and the Interest Invokers polyfill:
21
21
 
22
22
  ```html
23
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@zazz-ui/core@0.14.1/dist/zazz.css" />
23
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@zazz-ui/core@0.14.3/dist/zazz.css" />
24
24
  <script type="importmap">
25
25
  {
26
26
  "imports": {
@@ -32,7 +32,7 @@ From a CDN, the script needs an import map for its one dependency and the Intere
32
32
  type="module"
33
33
  src="https://cdn.jsdelivr.net/npm/invokers@2.2.2/dist/esm/production/interest.js"
34
34
  ></script>
35
- <script type="module" src="https://cdn.jsdelivr.net/npm/@zazz-ui/core@0.14.1/dist/zazz.js"></script>
35
+ <script type="module" src="https://cdn.jsdelivr.net/npm/@zazz-ui/core@0.14.3/dist/zazz.js"></script>
36
36
  ```
37
37
 
38
38
  Use an exact version in CDN URLs. Under a strict `script-src`, give the import map and the theme script the response's nonce (`buildHead({ nonce })` does); the docs' [security page](https://zazz.sh/docs/install/security/) has the full policy, including `style-src-attr` for the utilities. The [installation guide](https://zazz.sh/docs/install/installation/) has the complete `<head>`, with fonts, the theme script, a per-primitive variant, and integrity hashes on every URL; `buildHead({ cdn: { version } })` from `@zazz-ui/core/head` returns the same markup. Each release also includes `dist/sri.json` with the SHA-384 hash of every published file.
package/dist/sri.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "dist/csp-LRx1fynI.js": "sha384-s1Kg/1/tQobRsTf5BpAR3XeNmA3AkU7xfe6xdKivdk22yxstCs1ets32NeMMp9Av",
3
3
  "dist/scroll-state-C8mA5gq6.js": "sha384-m9uzgIAkSnk8Es+jgCbChIYFu4rPyr00IB7lrAR/8dcsPc3u75VA7Wq5LIEAvXpT",
4
4
  "dist/zazz.css": "sha384-X3Ks/hnhbGlszTutdOp54Jq2DR4xYNU51XBFmwc8N5BAxaFaA41gFouYgyezeaup",
5
- "dist/zazz.js": "sha384-jelEcxiPSJyr3q1G0ar4H+WqQi4yeryXgxBSTPleeJbt7XUIA9T37YxP1zX+gF9X",
5
+ "dist/zazz.js": "sha384-j8tXatpYHPHBIc5jA1Iic/VZOhkAHI8oQhJPsIlDn5OX6mhg+7l+tr5+Yz3Af+U+",
6
6
  "src/base/_breakpoints.css": "sha384-vsvdoL+ZjTa5gyCiMp4DlNIbr9rxkLqfQjZ+W3YTp2Apuuu+1/Dd68ACtcBOip3v",
7
7
  "src/base/_defaults.css": "sha384-B0qvVNCJK5NWeEuEdB89lHXg9fIpKkU/wPCvONGtmhfFdEw8SclyssDYW2dWly3X",
8
8
  "src/base/_layers.css": "sha384-+muc9Umj4iangP79BNjiCidmgTfGe7w41/GR/ZW14yuBb+b5MnrPpWrYu99Ontr8",
@@ -71,7 +71,7 @@
71
71
  "src/base/utilities.js": "sha384-/bREfylmbbEKfS1OMLpBtTP8dZZ4YVgJuXmY5k7bT15b2G0m0ijJyni9bJu0YgaP",
72
72
  "src/base/utils.js": "sha384-LYgZQdVhTZM9VrjMl/pn8005MC3zL6kqOodJEs4Xi0fPysol71QaYnq9egqgrUfh",
73
73
  "src/base/zazz-element.js": "sha384-dTk+HZujh1qWzZBaxgcZA1t01lvr311gYirU4RGX8utXCpTEGWGfiE28XGjBIAos",
74
- "src/head.js": "sha384-a1tYQhmmp7O/q6gEhWsRRuXzwEqByLKl5dAkbUkKf7HaPBqjpL4NeW2tc6Kt0yR6",
74
+ "src/head.js": "sha384-qsFhpXZXDDB5uTe1cZoUHo+Swt85lXYGdPK8G0d9qRiSJBwNgfmSRjH10MJUEUxH",
75
75
  "src/index.css": "sha384-mLMa5WjyDJiRcvPK0LtP83sWR2GPTC7Koay4v7F1iR5NgU4o/T/q2Uab7GCJKLh9",
76
76
  "src/index.js": "sha384-tKxj7/ptI/LHsCebZAPCQPAtgmVoUEnwfTcBPRBlOfb86vQJM98GNaG4P+jtGR+S",
77
77
  "src/manifest.js": "sha384-SK7NTDFsKfOYUSrAAPSat0MpAga/4RgGb0PnfVEB/wMLYlLGh6zW2VJCQRL4fycV",
@@ -97,7 +97,7 @@
97
97
  "src/primitives/debug/debug.js": "sha384-H08opwyN2A/u/KyWvKK9Je1f5WGQVt/jMtmxhIzSnIQWwp64fQUGkXCWH84staf1",
98
98
  "src/primitives/dialog/dialog.css": "sha384-tSOXoba6KjNz6klFZDhXaC2dJ/5DUGV2WLITrvAS2br8hj7UAMytVfCWSoToO/gL",
99
99
  "src/primitives/drawer/drawer.css": "sha384-O87VnBShYz7okzr66Iwg6VLs9/SCWbdC94dTAgIyBv9ArPlSLwOElSET9rYqyoCg",
100
- "src/primitives/drawer/drawer.js": "sha384-c6pq592zMjFHym9frvZSzwwXi9uqtL4tJ5g6NqcJSC8zMIYtKuZvXGvFGkPEj3Bz",
100
+ "src/primitives/drawer/drawer.js": "sha384-G/Q2txn7Pio4aZU4tzD5roRefEDuTWpGHfIg6LCpNQ6WoI85Dk/jB/uFDBrToBRd",
101
101
  "src/primitives/fields/fields.css": "sha384-PnYmFQjZvLpVcJPqRNIPz+IZ2CULEpO8G54JBkf2a5B0/FusnVjH7z4Qd9Cu1l+i",
102
102
  "src/primitives/group/group.css": "sha384-lGS+9BCaqRZLOx0AXGldNW01V1cbPnFc6tZuy7jAUpwyeupUfGQgyA90e7Ms561f",
103
103
  "src/primitives/input-group/input-group.css": "sha384-eN+6WekPj1IHDS6G+pmRyAmzdNnb6ZkpsKwl2iCMUJQtaYyKI41rwz375NCmTOpk",
package/dist/zazz.js CHANGED
@@ -1 +1 @@
1
- import{Signal as e}from"signal-polyfill";function t(e){if(e===`true`)return!0;if(e===`false`)return!1;if(!Number.isNaN(Number(e))&&e.trim()!==``)return Number(e);if(e.startsWith(`[`)&&e.endsWith(`]`))try{return JSON.parse(e)}catch{return e}return e}const n={parseValue:t,parseDataAttributes:(e,n)=>{let r={};for(let i of e.attributes)if(i.name.startsWith(n)){let e=i.name.replace(n,``).replace(/-([a-z])/g,(e,t)=>t.toUpperCase());r[e]=t(i.value)}return r}};typeof window<`u`&&(window.Utils=n);var r=class extends HTMLElement{#e=null;connectedCallback(){this.#e||(this.#e=new AbortController,this.setup(this.#e.signal))}connectedMoveCallback(){}disconnectedCallback(){this.#e?.abort(),this.#e=null,this.teardown?.()}};function i(e,t){typeof window<`u`&&(customElements.get(e)||customElements.define(e,t))}const a=[];function o(e){a.push(e)}function s(e){for(let t of a)t(e)}function c(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()}const l=typeof CSS<`u`&&CSS.supports(`top`,`calc(sibling-index() * 1px)`);function u(e){let t=e.trim();return t?/^-?\d*\.?\d+ms$/.test(t)?parseFloat(t):/^-?\d*\.?\d+s$/.test(t)?parseFloat(t)*1e3:parseInt(t,10)||0:0}var d=class e{static#e(){return{margin:`0px`,threshold:.2,duration:c(`--ui-reveal-global-duration`)||`1000ms`,ease:c(`--ui-reveal-global-timing-function`)||`cubic-bezier(0.4, 0, 0.2, 1)`,wait:u(c(`--ui-reveal-global-wait`)),distance:c(`--ui-reveal-global-distance`)||`2rem`,step:c(`--ui-reveal-global-stagger-step`)||`120ms`,grow:parseFloat(c(`--ui-reveal-global-grow`))||.97,shrink:parseFloat(c(`--ui-reveal-global-shrink`))||1.03}}static get defaultConfig(){return e.#e()}#t=/* @__PURE__ */ new Map;config;constructor(t={}){this.config={...e.defaultConfig,...t.config},this.init()}#n(e){let t=JSON.stringify(e),n=this.#t.get(t);return n||(n=new IntersectionObserver((e,t)=>{e.forEach(e=>{e.isIntersecting&&(e.target.setAttribute(`data-reveal-state`,`in-view`),t.unobserve(e.target))})},e),this.#t.set(t,n)),n}#r(e){let t=e.dataset.revealMargin||this.config.margin,n=parseFloat(e.dataset.revealThreshold||this.config.threshold.toString());return{rootMargin:t,threshold:Math.min(Math.max(n,0),1)}}#i(e){let t=e.toString().trim();return/^-?\d*\.?\d+(ms|s)$/.test(t)?t:`${Math.max(0,parseInt(t,10)||0)}ms`}#a(e,t){Object.entries(t).forEach(([t,n])=>{n!=null&&e.style.setProperty(t,n.toString())})}#o(e){let t=e.dataset,n=this.#r(e),r=this.#n(n),i=t.revealStep?Math.max(0,u(t.revealStep)):null,a=t.revealWait?Math.max(0,u(t.revealWait)):null,o={duration:t.revealDuration?Math.max(0,parseInt(t.revealDuration,10)||0):this.config.duration,ease:t.revealEase||this.config.ease,distance:t.revealDistance||this.config.distance,order:t.revealOrder},s=Array.from(e.children),c=o.order===`reversed`?s.reverse():s;this.#a(e,{"--ui-reveal-stagger-base":a===null?null:`${a}ms`,"--ui-reveal-stagger-step":i===null?null:`${i}ms`});let d=0,f=0;if(!l){let t=getComputedStyle(e),n=(e,n)=>Math.max(0,u(t.getPropertyValue(e)||t.getPropertyValue(n)));d=n(`--ui-reveal-stagger-base`,`--ui-reveal-global-wait`),f=n(`--ui-reveal-stagger-step`,`--ui-reveal-global-stagger-step`)}c.forEach((e,n)=>{e instanceof HTMLElement&&(this.#a(e,{"--ui-reveal-duration":this.#i(o.duration),"--ui-reveal-ease":o.ease,"--ui-reveal-wait":l?null:`${d+f*n}ms`,"--ui-reveal-distance":o.distance,"--ui-reveal-scale":t.revealScale||null}),r.observe(e))})}#s(e){let t=e.dataset,n=this.#r(e),r=this.#n(n),i=t.revealDuration?Math.max(0,parseInt(t.revealDuration,10)||0):null,a=t.revealWait?Math.max(0,parseInt(t.revealWait,10)||0):null;this.#a(e,{"--ui-reveal-duration":i===null?null:this.#i(i),"--ui-reveal-wait":a===null?null:this.#i(a),"--ui-reveal-ease":t.revealEase||null,"--ui-reveal-distance":t.revealDistance||null,"--ui-reveal-scale":t.revealScale||null}),r.observe(e)}init(){this.#t.forEach(e=>e.disconnect()),this.#t.clear();let e=document.documentElement.style;e.setProperty(`--ui-reveal-global-duration`,this.#i(this.config.duration)),e.setProperty(`--ui-reveal-global-timing-function`,this.config.ease),e.setProperty(`--ui-reveal-global-wait`,this.#i(this.config.wait)),e.setProperty(`--ui-reveal-global-distance`,this.config.distance),e.setProperty(`--ui-reveal-global-grow`,this.config.grow.toString()),e.setProperty(`--ui-reveal-global-shrink`,this.config.shrink.toString()),e.setProperty(`--ui-reveal-global-stagger-step`,this.#i(this.config.step)),document.querySelectorAll(`[data-reveal]`).forEach(e=>{e instanceof HTMLElement&&this.#s(e)}),document.querySelectorAll(`[data-reveal-each]`).forEach(e=>{e instanceof HTMLElement&&this.#o(e)})}refresh(){this.init()}};if(typeof window<`u`&&typeof document<`u`){let e=null,t=()=>{e||=new d};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,t):t(),o(()=>d.getAutoInstance()?.refresh()),d.disableAutoInit=()=>{e=`disabled`},d.getAutoInstance=()=>e===`disabled`?null:e}typeof window<`u`&&(window.Reveal=d);function f(e,t){e.dispatchEvent(new Event(t,{bubbles:!0}))}function p(){if(typeof HTMLDialogElement>`u`||!(`closedBy`in HTMLDialogElement.prototype))return!1;let e=document.createElement(`dialog`);return e.setAttribute(`closedby`,`any`),e.closedBy===`any`}function m(e){let t=e.target;if(!(t instanceof HTMLDialogElement)||!t.open||t.getAttribute(`closedby`)!==`any`)return null;let{clientX:n,clientY:r}=e,i=t.getBoundingClientRect();return n<i.left||n>i.right||r<i.top||r>i.bottom?t:null}function h(){let e=null;document.addEventListener(`pointerdown`,t=>{e=m(t)},!0),document.addEventListener(`pointerup`,t=>{let n=m(t);n&&n===e&&(typeof n.requestClose==`function`?n.requestClose():n.close()),e=null},!0)}const g=function(){g._bound||(g._bound=!0,new MutationObserver(function(e){for(let t of e)t.type===`attributes`&&t.attributeName===`open`&&t.target instanceof HTMLDialogElement&&t.target.hasAttribute(`open`)&&f(t.target,`zazz:dialog-open`)}).observe(document.documentElement,{attributes:!0,attributeFilter:[`open`],subtree:!0}),document.addEventListener(`close`,function(e){e.target instanceof HTMLDialogElement&&f(e.target,`zazz:dialog-close`)},!0),p()||h())};typeof window<`u`&&typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,g):g());function _(){let e=[];return{add(t,n,r){e.push({time:t,x:n,y:r}),e=e.filter(e=>t-e.time<=100)},velocity(){let t=e[0],n=e.at(-1);if(!t||!n)return{x:0,y:0};let r=n.time-t.time;return r<=0?{x:0,y:0}:{x:(n.x-t.x)/r,y:(n.y-t.y)/r}}}}function ee(e,t,n=.55){if(t<=0||e===0)return 0;let r=Math.abs(e);return Math.sign(e)*(r*t*n)/(t+n*r)}function te(e){let{offset:t,velocity:n,distance:r,velocityThreshold:i}=e;return t<=0?!1:n>i||t>=r&&n>-i}function ne(e){let{stops:t,position:n,velocity:r,active:i,size:a,sequential:o=!1}=e,{closeRatio:s=.25,flick:c=.4,fling:l=2}=e,u=t.length-1;if(u<0)return-1;let d=Math.abs(r),f=r>0;if(!o&&d>l)return f?-1:u;let p=t[Math.min(Math.max(i,0),u)]??0;if(d>c&&Math.abs(n-p)<a*.4)return f?i-1:Math.min(u,i+1);let m=t[0]??0;if(n>m)return n-m>=(a-m)*s&&r>-c?-1:0;let h=0;for(let e=1;e<=u;e++)Math.abs((t[e]??0)-n)<Math.abs((t[h]??0)-n)&&(h=e);return h}function v(e,t,n){let r=Math.abs(t);return r===0||n<=0?Math.max(0,n):Math.min(n,Math.max(Math.min(120,n),Math.abs(e)/r))}function y(e){return getComputedStyle(e).transitionDuration.split(`,`).reduce((e,t)=>Math.max(e,Number.parseFloat(t)||0),0)*1e3}function re(e){let[t=0,n=0]=getComputedStyle(e).translate.split(/\s+/).map(e=>Number.parseFloat(e)||0);return{x:t,y:n}}function ie(){let e=e=>{e.preventDefault(),e.stopPropagation()};document.addEventListener(`click`,e,{capture:!0,once:!0}),window.setTimeout(()=>document.removeEventListener(`click`,e,{capture:!0}),50)}function ae(e,t){let{signal:n}=t;if(n.aborted)return;let r=null,i=(e,t)=>{let n=e.axis===`x`,r=e.tracker.velocity();return{axis:e.axis,offset:n?t.clientX-e.originX:t.clientY-e.originY,velocity:n?r.x:r.y,startX:e.startX,startY:e.startY,target:e.target,pointerType:e.pointerType,event:t}},a=()=>{document.removeEventListener(`pointermove`,s),document.removeEventListener(`pointerup`,c),document.removeEventListener(`pointercancel`,l),r=null},o=e=>{if(r||!e.isPrimary||e.pointerType===`mouse`&&e.button!==0)return;let n=e.target;if(!(n instanceof Element)||n.closest(`input, select, textarea, [contenteditable]:not([contenteditable="false"]), [data-ui-no-drag]`))return;let i=_();i.add(e.timeStamp,e.clientX,e.clientY),r={phase:`pending`,pointerId:e.pointerId,pointerType:e.pointerType,target:n,startX:e.clientX,startY:e.clientY,originX:e.clientX,originY:e.clientY,axis:t.axis===`x`?`x`:`y`,tracker:i,selection:document.getSelection()?.toString()??``},document.addEventListener(`pointermove`,s),document.addEventListener(`pointerup`,c),document.addEventListener(`pointercancel`,l)},s=n=>{let a=r;if(a&&n.pointerId===a.pointerId){if(a.tracker.add(n.timeStamp,n.clientX,n.clientY),a.phase===`pending`){let r=n.clientX-a.startX,o=n.clientY-a.startY,s=t.slop??(a.pointerType===`mouse`?6:0);if(r===0&&o===0||Math.hypot(r,o)<s)return;let c=Math.abs(r)>Math.abs(o)?`x`:`y`;a.axis=t.axis===`both`?c:t.axis;let l=document.getSelection()?.toString()??``,u=l.length>0&&l!==a.selection;if(c!==a.axis||u||t.canStart&&!t.canStart(i(a,n))){a.phase=`rejected`;return}a.phase=`dragging`,a.originX=n.clientX,a.originY=n.clientY;try{e.setPointerCapture(a.pointerId)}catch{}t.onStart?.(i(a,n))}else a.phase===`dragging`&&t.onMove(i(a,n))}},c=e=>{let n=r;n&&e.pointerId===n.pointerId&&(n.tracker.add(e.timeStamp,e.clientX,e.clientY),a(),n.phase===`dragging`&&(ie(),t.onEnd(i(n,e))))},l=e=>{let n=r;n&&e.pointerId===n.pointerId&&(a(),n.phase===`dragging`&&(t.onCancel??t.onEnd)(i(n,e)))};e.addEventListener(`pointerdown`,o,{signal:n}),e.addEventListener(`touchmove`,e=>{r?.phase===`dragging`&&e.cancelable&&e.preventDefault()},{passive:!1,signal:n}),n.addEventListener(`abort`,()=>{let e=r;if(!e||(a(),e.phase!==`dragging`))return;let n=new PointerEvent(`pointercancel`,{pointerId:e.pointerId,clientX:e.originX,clientY:e.originY});(t.onCancel??t.onEnd)(i(e,n))},{once:!0})}function b(e,t,n){let r=(e.getAttribute(`data-carousel-state`)??``).split(/\s+/).filter(Boolean);if(r.includes(t)===n)return;let i=n?[...r,t]:r.filter(e=>e!==t);i.length?e.setAttribute(`data-carousel-state`,i.join(` `)):e.removeAttribute(`data-carousel-state`)}function oe(e,t=.0025){return Math.sign(e)*e*e/(2*t)}function x(e,t){let n=0,r=1/0;return e.forEach((e,i)=>{let a=Math.abs(e.pos-t);a<r&&(r=a,n=i)}),n}function se(e,t,n=Math.floor(e/2)){return Array.from({length:e},(r,i)=>((i-t+n)%e+e)%e)}function ce(e,t){return Math.max(1,Math.floor((e-Math.max(1,t))/2))}function le(e,t,n){let r=Math.min(t.first,n.first),i=Math.max(t.last,n.last);if(r>=0&&i<=e-1)return 0;let a=i-r+1;return a>e?null:Math.floor((e-a)/2)-r}function ue(e,t,n,r,i=!1){let a=x(e,n);return a===t&&Math.abs(r)>.3&&(a=t+(r>0?-1:1)),i||(a=Math.min(t+1,Math.max(t-1,a))),Math.min(e.length-1,Math.max(0,a))}function de(e){let t=(e.getAttribute(`data-carousel-plugins`)??``).split(/[\s,]+/),r=t.includes(`auto-scroll`)?`auto-scroll`:t.includes(`autoplay`)?`autoplay`:null;if(!r)return null;let i=n.parseDataAttributes(e,r===`autoplay`?`data-carousel-autoplay-`:`data-carousel-auto-scroll-`),a=(e,t)=>typeof e==`number`&&e>=0?e:t;return{mode:r,delay:a(i.delay,4e3),speed:a(i.speed,2),startDelay:a(i.startDelay,1e3),backward:i.direction===`backward`,playOnInit:i.playOnInit!==!1,stopOnInteraction:i.stopOnInteraction!==!1,stopOnMouseEnter:i.stopOnMouseEnter===!0,stopOnLastSnap:i.stopOnLastSnap===!0}}function S(e,t,r,i={}){let a=t.querySelector(`[data-carousel-slot~="container"]`);if(!a)return null;let o=[...a.querySelectorAll(`:scope > [data-carousel-slot~="slide"]`)],{prefix:s=`data-carousel-`,defaults:c={},controls:l=!0}=i,u=n.parseDataAttributes(e,s),d=(e,t)=>typeof e==`boolean`?e:t,f={loop:d(u.loop,c.loop??!1)&&o.length>=3,draggable:d(u.draggable,!0),dragFree:d(u.dragFree,c.dragFree??!1),skipSnaps:d(u.skipSnaps,!1),startSnap:typeof u.startSnap==`number`?u.startSnap:0,vertical:u.axis===`y`},p=null,m=1,h={back:0,ahead:0},g=-1,_=null,te=null,ne=/* @__PURE__ */ new Set,v=o.map(()=>0),y=!1,re=!1,ie=null,S=!1,C=!1,w=window.matchMedia(`(prefers-reduced-motion: reduce)`),fe=e=>e||w.matches?`auto`:`smooth`,T=f.vertical,pe=!T&&getComputedStyle(t).direction===`rtl`,me=pe?-1:1,E=()=>T?t.scrollTop:t.scrollLeft*me,D=e=>{T?t.scrollTop=e:t.scrollLeft=e*me},he=(e,n)=>t.scrollTo(T?{top:e,behavior:n}:{left:e*me,behavior:n}),O=()=>T?t.clientHeight:t.clientWidth,k=()=>Math.max(0,(T?t.scrollHeight:t.scrollWidth)-O()),ge=e=>Math.min(k(),Math.max(0,e)),_e=(e,t)=>T?e.top-t.top:pe?t.right-e.right:e.left-t.left,ve=e=>T?e.height:e.width,ye=e=>T?e:e*me,A=e=>{y||re?D(e):(b(t,`jumping`,!0),D(e),b(t,`jumping`,!1))},be=e=>{y=e,b(t,`gliding`,e)},xe=()=>{let e=t.getBoundingClientRect(),n=getComputedStyle(t),r=Number.parseFloat(T?n.scrollPaddingBlockStart:n.scrollPaddingInlineStart)||0,i=Number.parseFloat(T?n.scrollPaddingBlockEnd:n.scrollPaddingInlineEnd)||0,a=k(),s=O(),c=E(),l=0,u=`start`,d=o.map((t,n)=>{let o=t.getBoundingClientRect(),d=ve(o);n===0&&(l=d);let f=_e(o,e)+c,p=getComputedStyle(t).scrollSnapAlign.split(` `),m=T?p[0]:p.at(-1);n===0&&(u=m??`start`);let h=m===`center`?f+d/2-s/2:m===`end`?f+d-s+i:f-r;return{index:n,pos:Math.round(Math.min(a,Math.max(0,h)))}});m=l>0?Math.max(1,Math.round(s/l)):1;let f=m-1,p=+(l*m<s-1);h=u===`center`?{back:Math.floor(m/2)+p,ahead:Math.floor(m/2)+p}:u===`end`?{back:f,ahead:0}:{back:0,ahead:f},d.sort((e,t)=>e.pos-t.pos);let g=[];for(let{index:e,pos:t}of d){let n=g.at(-1);n&&Math.abs(n.pos-t)<1?n.slides.push(e):g.push({pos:t,slides:[e]})}return g},j=()=>p??=xe(),Se=()=>{p=null},Ce=()=>(j(),m),M=e=>f.loop?j()[e]?.slides[0]??0:e,we=e=>Math.max(0,j().findIndex(t=>t.slides.includes(e))),N=[],Te=l?e.querySelector(`[data-carousel-slot~="dots"]`):null,Ee=Te?.querySelector(`[data-carousel-slot~="dot"]`)?.cloneNode(!0),De=()=>{if(!Te||!(Ee instanceof HTMLElement))return;let e=f.loop?o.length:j().length;if(e!==N.length&&(Te.replaceChildren(),N=[],!(e<=1))){for(let t=0;t<e;t++){let e=Ee.cloneNode(!0);e.addEventListener(`click`,()=>{Q.interact(),Q.goTo(t)},{signal:r}),N.push(e)}Te.append(...N)}},Oe=e=>{let t=M(e),n=new Set(j()[e]?.slides??[]);o.forEach((e,t)=>b(e,`snapped`,n.has(t))),N.forEach((e,n)=>b(e,`active`,n===t))},P=t=>{t!==g&&(g=t,Oe(t),e.dispatchEvent(new CustomEvent(`zazz:carousel-select`,{detail:{index:M(t)}})))},ke=()=>{if(!f.loop)return;let e=j()[g]?.slides[0]??0,t=v[e]??0;o.forEach((n,r)=>{n.inert=(v[r]<t?r>e:r<e)&&!ne.has(r)})},F=0,Ae=(e,n,r=!0)=>{if(e.every((e,t)=>e===v[t]))return;let i=o[n],a=t.getBoundingClientRect(),s=_e(i.getBoundingClientRect(),a),c=r?++F:F;r&&(re=!0,b(t,`settling`,!0)),o.forEach((t,n)=>{v[n]!==e[n]&&(t.style.order=String(e[n]))}),v=e;let l=_e(i.getBoundingClientRect(),a)-s;A(E()+l),Se(),r&&requestAnimationFrame(()=>requestAnimationFrame(()=>{if(c!==F)return;re=!1,b(t,`settling`,!1);let e=ie;ie=null,e?.()}))},I=(e,t=!0)=>Ae(se(o.length,e,ce(o.length,Ce())),e,t),je=()=>{let e=t.getBoundingClientRect(),n=O(),r=1/0,i=-1/0;return o.forEach((t,a)=>{let o=t.getBoundingClientRect(),s=_e(o,e);s+ve(o)<=1||s>=n-1||(r=Math.min(r,v[a]),i=Math.max(i,v[a]))}),{first:r,last:i}},L=0,Me=()=>{Pe.has(`pointer`)&&(Fe=!0),L||=requestAnimationFrame(()=>{L=0,_==null&&!S&&P(x(j(),E()))})},R=()=>{if(S||C||Y)return;let e=_==null?null:j()[_];if(e&&Math.abs(E()-e.pos)>1)return;_=null;let t=x(j(),E());y&&!f.dragFree&&Math.abs(E()-j()[t].pos)>1?z(t):(be(!1),P(t),f.loop&&(I(j()[g]?.slides[0]??0),g=x(j(),E()),ke()),Ve())};if(t.addEventListener(`scroll`,Me,{passive:!0,signal:r}),`onscrollend`in window)t.addEventListener(`scrollend`,R,{signal:r});else{let e=0;t.addEventListener(`scroll`,()=>{clearTimeout(e),e=window.setTimeout(R,120)},{passive:!0,signal:r}),r.addEventListener(`abort`,()=>clearTimeout(e),{once:!0})}let z=(e,t,n=null)=>{Je();let r=j(),i=Math.min(r.length-1,Math.max(0,e));if(re){_=i,te=n,P(i),ie=()=>z(e,t,n);return}let a=r[i]?.pos??0;Math.abs(E()-a)<1?R():(_=i,te=n,P(i),t?(A(a),R()):he(a,fe()))},Ne=e=>{let t=_??g;if(!f.loop){z(t+e);return}let n=o.length,r=(_==null?null:te)??M(t),i=(r+e+n)%n,a=v[r]+e,s=je(),c=le(n,s,{first:a-h.back,last:a+h.ahead});if(c!=null){if(c){let e=M(Math.max(0,g));_=null,Ae(v.map(e=>((e+c)%n+n)%n),Math.max(0,v.indexOf(s.first))),g=we(e),ke()}z(we(i),!1,i)}},B=l?de(e):null,V=!1,Pe=/* @__PURE__ */ new Set,Fe=!1,Ie=!0,Le=!1,H=0,U=0,Re=0,W=0,ze=()=>{H=0;let e=_??g;!f.loop&&e>=j().length-1?B?.stopOnLastSnap?(V=!1,q()):z(0):Ne(1)},Be=e=>{if(!B)return;U=requestAnimationFrame(Be);let t=Re?Math.min(50,e-Re):0;Re=e,W+=(B.backward?-B.speed:B.speed)*t/16.666666666666668;let n=Math.trunc(W);if(!n)return;W-=n;let r=E()+n;if(!f.loop&&(r<=0||r>=k())){D(ge(r)),V=!1,q();return}D(r);let i=x(j(),E());P(i),f.loop&&(I(j()[i]?.slides[0]??0,!1),g=x(j(),E()))},G=()=>{clearTimeout(H),cancelAnimationFrame(U),H=0,U=0,C&&(C=!1,R())},K=()=>{B&&(H=B.mode===`autoplay`?window.setTimeout(ze,B.delay):window.setTimeout(()=>{H=0,_=null,be(!0),C=!0,Re=0,W=0,U=requestAnimationFrame(Be)},B.startDelay))};function q(t=!1){let n=!!B&&V&&Pe.size===0&&Ie&&!document.hidden&&k()>0&&j().length>1;B&&b(e,`playing`,V),(n!==Le||t)&&(Le=n,G(),n&&K())}function Ve(){B&&(Pe.delete(`pointer`)?q():Le&&B.mode===`autoplay`&&(clearTimeout(H),H=window.setTimeout(ze,B.delay)))}let He=e=>{B&&V&&(B.stopOnInteraction?V=!1:Pe.add(e),e===`pointer`&&(Fe=!1,C&&(cancelAnimationFrame(U),U=0,C=!1,be(!1))),q())},Ue=e=>{Pe.delete(e)&&q()},We=t.closest(`[data-carousel-keyboard="false"]`)!==null,Ge=e=>{e instanceof KeyboardEvent&&e.key.startsWith(`Arrow`)&&!We||e instanceof MouseEvent&&e.button!==0||(He(`pointer`),_=null,Je()&&R())};for(let e of[`pointerdown`,`wheel`,`touchstart`,`keydown`])t.addEventListener(e,Ge,{passive:!0,signal:r});B&&(t.addEventListener(`pointerup`,()=>{Fe||Ue(`pointer`)},{signal:r}),t.addEventListener(`focusin`,e=>{e.target!==t&&He(`focus`)},{signal:r}),t.addEventListener(`focusout`,e=>{e.relatedTarget instanceof Node&&t.contains(e.relatedTarget)||Ue(`focus`)},{signal:r}),B.stopOnMouseEnter&&(e.addEventListener(`mouseenter`,()=>He(`hover`),{signal:r}),e.addEventListener(`mouseleave`,()=>Ue(`hover`),{signal:r})),document.addEventListener(`visibilitychange`,()=>q(),{signal:r}));let Ke=0,qe=0,J=e=>{S=e,b(t,`dragging`,e)},Y=0,Je=()=>Y?(cancelAnimationFrame(Y),Y=0,!0):!1,X=e=>{let t=E(),n=ge(t-oe(e)),r=n-t;if(w.matches||Math.abs(r)<1){R();return}let i=Math.min(.02,Math.abs(e)/Math.abs(r)),a=performance.now(),o=e=>{let t=r*Math.exp(-i*Math.max(0,e-a));Math.abs(t)<.5?(Y=0,D(n),R()):(D(n-t),Y=requestAnimationFrame(o))};Y=requestAnimationFrame(o)},Z=e=>{J(!1),a.style.translate&&E()>=k()-1&&a.addEventListener(`transitionend`,()=>{!S&&!Y&&_==null&&A(k())},{once:!0,signal:r}),a.style.translate=``;let t=E()-oe(e);f.dragFree?X(e):z(ue(j(),qe,t,e,f.skipSnaps))};f.draggable&&(ae(t,{axis:T?`y`:`x`,signal:r,canStart:({pointerType:e})=>e===`mouse`&&k()>0,onStart:()=>{_=null,Je(),Ke=E(),qe=x(j(),Ke),be(!0),J(!0)},onMove:({offset:e})=>{let t=Ke-ye(e),n=ge(t);A(n);let r=ee(n-t,O()/4);a.style.translate=r?T?`0 ${r}px`:`${r*me}px 0`:``},onEnd:({velocity:e})=>Z(ye(e)),onCancel:()=>Z(0)}),t.addEventListener(`dragstart`,e=>e.preventDefault(),{signal:r}));let Ye=new IntersectionObserver(e=>{ne=new Set(ne);for(let t of e){let e=o.indexOf(t.target);t.isIntersecting?ne.add(e):ne.delete(e),b(t.target,`in-view`,t.isIntersecting)}ke()},{root:t,rootMargin:T?`-1px 0px`:`0px -1px`});o.forEach(e=>Ye.observe(e));let Xe=B?new IntersectionObserver(([e])=>{Ie=e?.isIntersecting??!0,q()}):null;Xe?.observe(e);let Ze=new ResizeObserver(()=>{Se(),De(),_==null&&!S&&!C&&P(x(j(),E())),Oe(g),q()});Ze.observe(t),o.forEach(e=>Ze.observe(e));let Q={goTo(e,t){z(f.loop?we(e):e,t,f.loop?e:null)},goToNext:()=>Ne(1),goToPrev:()=>Ne(-1),selectedSnap:()=>M(Math.max(0,g)),snapList:()=>j().map(e=>e.pos),revealSlide(e,n){let r=o[e];if(!r)return;let i=E(),a=_e(r.getBoundingClientRect(),t.getBoundingClientRect())+i,s=a+ve(r.getBoundingClientRect()),c=ge(a<i?a:s>i+O()?s-O():i);Math.abs(c-i)<1||(n?A(c):he(c,fe()))},play(){V=!0,q()},stop(){V=!1,q()},isPlaying:()=>Le,interact(){B&&V&&(B.stopOnInteraction?(V=!1,q()):q(!0))},vertical:T,rtl:pe};if(l)for(let[t,n]of[[`prev`,-1],[`next`,1]])e.querySelector(`[data-carousel-slot~="${t}"]`)?.addEventListener(`click`,()=>{Q.interact(),Ne(n)},{signal:r});b(t,`free`,f.dragFree),De(),f.loop&&I(f.startSnap%o.length,!1);let Qe=f.loop?we(f.startSnap):f.startSnap;return A(j()[Qe]?.pos??0),P(x(j(),E())),ke(),B&&(V=B.playOnInit&&!(B.mode===`auto-scroll`&&w.matches),q()),r.addEventListener(`abort`,()=>{cancelAnimationFrame(L),cancelAnimationFrame(Y),clearTimeout(H),cancelAnimationFrame(U),Ye.disconnect(),Xe?.disconnect(),Ze.disconnect(),S&&J(!1);for(let e of[`gliding`,`settling`,`free`])b(t,e,!1);b(e,`playing`,!1),a.style.translate=``;for(let e of o)e.style.order=``,e.inert=!1,b(e,`in-view`,!1),b(e,`snapped`,!1);Ee&&Te?.replaceChildren(Ee),delete e._carousel},{once:!0}),e._carousel=Q,Q}function C(e,t,n,r){let i=n.querySelector(`[data-carousel-slot~="viewport"]`);if(!i)return null;let a=S(n,i,r,{prefix:`data-carousel-thumbs-`,defaults:{dragFree:!0},controls:!1});if(!a)return null;let o=[...i.querySelectorAll(`[data-carousel-slot~="container"] > [data-carousel-slot~="slide"]`)];o.forEach((t,n)=>t.addEventListener(`click`,()=>{e.interact(),e.goTo(n)},{signal:r}));let s=(e,t)=>{o.forEach((t,n)=>{b(t,`active`,n===e),n===e?t.setAttribute(`aria-current`,`true`):t.removeAttribute(`aria-current`)}),a.revealSlide(e,t)};return t.addEventListener(`zazz:carousel-select`,e=>s(e.detail.index),{signal:r}),s(e.selectedSnap(),!0),r.addEventListener(`abort`,()=>{for(let e of o)b(e,`active`,!1),e.removeAttribute(`aria-current`)},{once:!0}),a}const w=`:is(ui-carousel, [data-ui~="carousel"])`;function fe(e){if(e.hasAttribute(`data-carousel-init`)||e.closest(`dialog:not([open])`)||e.matches(`[data-carousel-slot~="thumbs"]`))return;let t=e.querySelector(`[data-carousel-slot~="thumbs"]`),n=e.querySelector(t?`[data-carousel-slot~="viewport"]:not([data-carousel-slot~="thumbs"] *)`:`[data-carousel-slot~="viewport"]`);if(!n)return;e.setAttribute(`data-carousel-init`,``),n.hasAttribute(`tabindex`)||n.setAttribute(`tabindex`,`0`);let r=new AbortController;e._carouselController=r;let i=S(e,n,r.signal);i&&t&&C(i,e,t,r.signal)}function T(e){for(let t of(e??document).querySelectorAll(w))t.closest(`ui-carousel`)||fe(t)}function pe(){document.addEventListener(`zazz:dialog-open`,e=>{if(!(e.target instanceof HTMLDialogElement))return;let t=e.target;T(t);for(let e of t.querySelectorAll(w)){let t=e.getAttribute(`data-carousel-start-index`);t!=null&&e._carousel&&(e._carousel.goTo(Number(t),!0),e.removeAttribute(`data-carousel-start-index`));let n=e.querySelector(`[data-carousel-slot~="viewport"]`);n instanceof HTMLElement&&n.focus({preventScroll:!0})}})}function me(){let e=e=>!!e?._carousel&&e.getAttribute(`data-carousel-keyboard`)!==`false`,t=document.querySelector(`dialog[open]`)?.querySelector(`${w}[data-carousel-init]`);if(e(t))return t;let n=document.activeElement?.closest(`${w}[data-carousel-init]`);return e(n)?n:null}function E(){document.addEventListener(`keydown`,e=>{if(!e.key.startsWith(`Arrow`)||e.defaultPrevented)return;let t=e.target;if(!(t instanceof HTMLElement)||t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t.isContentEditable)return;let n=me()?._carousel;if(!n)return;let[r,i]=n.vertical?[`ArrowUp`,`ArrowDown`]:n.rtl?[`ArrowRight`,`ArrowLeft`]:[`ArrowLeft`,`ArrowRight`];(e.key===r||e.key===i)&&(e.preventDefault(),n.interact(),e.key===r?n.goToPrev():n.goToNext())})}function D(){document.addEventListener(`click`,e=>{if(!(e.target instanceof HTMLElement))return;let t=e.target.closest(`[data-carousel-start], [data-carousel-slot~='slide'][commandfor]`);if(!t)return;let n=t.getAttribute(`data-carousel-start`);if(n==null){let e=t.closest(w)?._carousel;e&&(n=String(e.selectedSnap()))}let r=t.getAttribute(`commandfor`),i=r?document.getElementById(r)?.querySelector(w):null;i&&n!=null&&(i._carousel?i._carousel.goTo(Number(n),!0):i.setAttribute(`data-carousel-start-index`,n))})}const he={init:T,initRoot:fe};if(typeof window<`u`&&typeof document<`u`){o(e=>T(e));let e=()=>{T(),pe(),D(),E()};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,e):e(),window.Carousel=he}const O=.1,k=.999,ge=/[\\/_+.#"@[({&]/,_e=/[\\/_+.#"@[({&]/g,ve=/[\s-]/,ye=/[\s-]/g;function A(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?1:.99;let s=`${i},${a}`,c=o[s];if(c!==void 0)return c;let l=r.charAt(a),u=n.indexOf(l,i),d=0;for(;u>=0;){let s=A(e,t,n,r,u+1,a+1,o);if(s>d){if(u===i)s*=1;else if(ge.test(e.charAt(u-1))){s*=.8;let t=e.slice(i,u-1).match(_e);t&&i>0&&(s*=k**t.length)}else if(ve.test(e.charAt(u-1))){s*=.9;let t=e.slice(i,u-1).match(ye);t&&i>0&&(s*=k**t.length)}else s*=.17,i>0&&(s*=k**(u-i));e.charAt(u)!==t.charAt(a)&&(s*=.9999)}if(s<O&&n.charAt(u-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(u-1)!==r.charAt(a)){let i=A(e,t,n,r,u+1,a+2,o);i*O>s&&(s=i*O)}s>d&&(d=s),u=n.indexOf(l,u+1)}return o[s]=d,d}function be(e){return e.toLowerCase().replace(ye,` `)}function xe(e,t,n=[]){let r=n.length>0?`${e} ${n.join(` `)}`:e;return A(r,t,be(r),be(t),0,0,{})}Symbol.dispose??=Symbol(`Symbol.dispose`);function j(t,n){return new e.State(t,n)}function Se(t,n){return new e.Computed(t,n)}let Ce=!0;const M=new e.subtle.Watcher(()=>{Ce&&(Ce=!1,queueMicrotask(we))});function we(){Ce=!0;for(let e of M.getPending())e.get();M.watch()}function N(t,n={}){let r,i=!1,a=new e.Computed(()=>{typeof r==`function`&&r(),r=t()});M.watch(a),a.get();let o=()=>{i||(i=!0,M.unwatch(a),typeof r==`function`&&r(),r=void 0)};return n.signal?.addEventListener(`abort`,o,{once:!0}),Object.assign(o,{[Symbol.dispose]:o})}typeof window<`u`&&(window.Signals={state:j,computed:Se,effect:N});function Te(e,t){let n=e.trim();return t.map((e,t)=>{let r=n===``?1:xe(e.value,n,e.keywords);return{index:t,score:r,hidden:r<=0}})}function Ee(e,t,n){if(n===0)return-1;switch(t){case`ArrowDown`:return e<0?0:(e+1)%n;case`ArrowUp`:return e<0?n-1:(e-1+n)%n;case`Home`:return 0;case`End`:return n-1;default:return e}}let De=0;var Oe=class extends r{partSelector(e){return`[data-${this.slotPrefix}-slot~="${e}"]`}config(e){return this.getAttribute(`data-${this.slotPrefix}-${e}`)}managesPanel=!0;openOnFocus=!0;get sortByScore(){return this.config(`sort`)===`score`}autoHighlight=!1;get filtersItems(){return this.config(`filter`)!==`none`}get ordersByScore(){return this.sortByScore&&this.filtersItems}searchInput=null;panel=null;query=j(``);open=j(!1);activeIndex=j(-1);itemsVersion=j(0);setup(e){let t=this.slotPrefix,n=this.querySelector(this.partSelector(`panel`)),r=this.querySelector(`input[role="combobox"]`)??this.querySelector(this.partSelector(`input`));if(!(n instanceof HTMLElement)||!(r instanceof HTMLInputElement))return;this.panel=n,this.searchInput=r;let i=n.querySelector(this.partSelector(`list`));i instanceof HTMLElement&&(i.id||=`ui-${t}-list-${++De}`,r.setAttribute(`aria-controls`,i.id));let a=this.partSelector(`item`),o=e=>e instanceof Element&&(e.matches(a)||e.querySelector(a)!==null),s=new MutationObserver(e=>{e.some(e=>[...e.addedNodes,...e.removedNodes].some(o))&&(this.itemsVersion.set(this.itemsVersion.get()+1),this.autoHighlight&&this.activeIndex.set(0))});s.observe(i??n,{childList:!0,subtree:!0}),e.addEventListener(`abort`,()=>s.disconnect(),{once:!0}),r.addEventListener(`input`,()=>{this.query.set(r.value),this.activeIndex.set(this.autoHighlight?0:-1),this.managesPanel&&!this.#n()&&this.open.set(r.value.length>=this.#t())},{signal:e}),r.addEventListener(`keydown`,e=>this.#i(e),{signal:e}),this.#n()?(this.open.set(!0),r.setAttribute(`aria-expanded`,`true`)):this.managesPanel?(this.openOnFocus&&r.addEventListener(`focus`,()=>{r.value.length>=this.#t()&&this.open.set(!0)},{signal:e}),document.addEventListener(`pointerdown`,e=>{e.target instanceof Node&&(this.contains(e.target)||this.open.set(!1))},{signal:e}),this.addEventListener(`focusout`,e=>{let t=e.relatedTarget;t instanceof Node&&this.contains(t)||this.open.set(!1)},{signal:e})):n instanceof HTMLDialogElement?(this.addEventListener(`zazz:dialog-open`,e=>{e.target===n&&(this.open.set(!0),r.focus())},{signal:e}),this.addEventListener(`zazz:dialog-close`,e=>{e.target===n&&this.open.set(!1)},{signal:e})):n.addEventListener(`toggle`,e=>{let t=e.newState===`open`;this.open.set(t),t&&r.focus()},{signal:e}),n.addEventListener(`mousedown`,e=>{e.target instanceof Element&&(e.target.closest(`input, textarea, select, [contenteditable]`)||e.target.closest(this.partSelector(`list`))&&e.preventDefault())},{signal:e}),n.addEventListener(`click`,e=>{if(!(e.target instanceof Element))return;let t=e.target.closest(this.partSelector(`item`));t&&!t.hidden&&this.commit(t,`pointer`)},{signal:e}),this.#n()||(this.managesPanel?N(()=>{let e=this.open.get();r.setAttribute(`aria-expanded`,String(e)),e&&!this.#r()?n.showPopover():!e&&this.#r()&&n.hidePopover(),e||this.activeIndex.set(-1)},{signal:e}):N(()=>{r.setAttribute(`aria-expanded`,String(this.open.get()))},{signal:e})),N(()=>{let e=this.open.get(),n=this.query.get(),i=this.activeIndex.get();if(!e&&this.managesPanel&&!this.#n()){r.removeAttribute(`aria-activedescendant`);return}let{items:a,ranked:o,visible:s}=this.#e(n),c=this.ordersByScore;for(let e of o){let t=a[e.index];t.hidden=e.hidden,c?t.style.order=String(-Math.round(e.score*1e3)):t.style.order&&t.style.removeProperty(`order`)}s.forEach((e,n)=>{e.id||=`ui-${t}-item-${++De}`,n===i?e.setAttribute(`data-${this.slotPrefix}-state`,`highlighted`):e.removeAttribute(`data-${this.slotPrefix}-state`)});let l=i>=0?s[i]:void 0;l?(r.setAttribute(`aria-activedescendant`,l.id),l.scrollIntoView({block:`nearest`})):r.removeAttribute(`aria-activedescendant`)},{signal:e})}items(){let e=this.panel;return e?Array.from(e.querySelectorAll(this.partSelector(`item`))).filter(e=>e instanceof HTMLElement):[]}visibleItems(e,t){let n=t.filter(e=>!e.hidden);return this.ordersByScore&&n.sort((e,t)=>t.score-e.score||e.index-t.index),n.map(t=>e[t.index])}#e(e){this.itemsVersion.get();let t=this.items(),n=Te(this.filtersItems?e:``,t.map(e=>({value:this.itemValue(e),keywords:(e.getAttribute(`data-${this.slotPrefix}-keywords`)??``).split(/\s+/).filter(Boolean)})));return{items:t,ranked:n,visible:this.visibleItems(t,n)}}itemValue(e){let t=e.getAttribute(`data-${this.slotPrefix}-value`);if(t!==null)return t;if(!e.querySelector(`kbd, ui-kbd-group`))return e.textContent?.trim()??``;let n=e.cloneNode(!0);for(let e of n.querySelectorAll(`kbd, ui-kbd-group`))e.remove();return n.textContent?.trim()??``}clearQuery(){let e=this.searchInput;e&&(e.value=``,this.query.set(``))}#t(){let e=Number(this.config(`min-length`));return Number.isFinite(e)&&e>0?e:0}#n(){return this.managesPanel&&this.panel!==null&&!this.panel.hasAttribute(`popover`)}#r(){return this.panel?.matches(`:popover-open`)??!1}#i(e){let t=this.searchInput;if(t){if(e.key===`Escape`&&this.managesPanel)this.open.get()&&!this.#n()?(e.preventDefault(),this.open.set(!1)):t.value&&(e.preventDefault(),this.clearQuery());else if([`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)){if((e.key===`Home`||e.key===`End`)&&this.activeIndex.get()<0)return;e.preventDefault(),this.managesPanel&&!this.open.get()&&this.open.set(!0);let t=this.#e(this.query.get()).visible.length;this.activeIndex.set(Ee(this.activeIndex.get(),e.key,t))}else if(e.key===`Enter`){let t=this.activeIndex.get(),n=t>=0?this.#e(this.query.get()).visible[t]:void 0;n&&(e.preventDefault(),this.commit(n,`keyboard`))}}}};i(`ui-autocomplete`,class extends Oe{slotPrefix=`autocomplete`;commit(e,t){let n=this.searchInput;n&&(n.value=this.itemValue(e),this.query.set(n.value),this.open.set(!1),n.focus(),n.dispatchEvent(new Event(`change`,{bubbles:!0})))}});const P=`data-checkbox-controls`;function ke(e){let t=e.filter(Boolean).length;return t===0?`none`:t===e.length?`all`:`some`}function F(e){let t=e.getAttribute(P);if(!t)return[];let n=(e.form??e.ownerDocument).querySelectorAll(`input[type="checkbox"]`);return Array.from(n).filter(n=>n.name===t&&n!==e)}function Ae(e){if(!e.name)return null;let t=(e.form??e.ownerDocument).querySelectorAll(`input[type="checkbox"][${P}]`);for(let n of t)if(n.getAttribute(P)===e.name&&n!==e)return n;return null}const I=/* @__PURE__ */ new Map;function je(e){I.get(e)?.members.set(F(e).map(e=>e.checked))}function L(e){let t=j(F(e).map(e=>e.checked)),n=Se(()=>ke(t.get())),r=N(()=>{let r=n.get(),i=t.get();e.checked=r===`all`,e.indeterminate=r===`some`,F(e).forEach((e,t)=>{let n=e.closest(`tr`);n&&(i[t]?n.setAttribute(`data-table-state`,`selected`):n.getAttribute(`data-table-state`)===`selected`&&n.removeAttribute(`data-table-state`))})});I.set(e,{members:t,dispose:r})}function Me(e){let t=e.target;if(!(t instanceof HTMLInputElement)||t.type!==`checkbox`)return;if(t.hasAttribute(P)){I.has(t)||L(t);for(let e of F(t))e.checked=t.checked;je(t);return}let n=Ae(t);n&&(I.has(n)||L(n),je(n))}function R(e=document){for(let[e,t]of I)e.isConnected||(t.dispose(),I.delete(e));let t=e.querySelectorAll(`input[type="checkbox"][${P}]`);for(let e of t)I.has(e)?je(e):L(e)}typeof window<`u`&&typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>R()):R(),document.addEventListener(`change`,Me),o(R));let z=null;function Ne(){return z||(z=document.createElement(`template`),z.innerHTML=`<span data-ui="badge" data-combobox-slot="tag"><span data-combobox-slot="tag-label"></span><button type="button" tabindex="-1" data-combobox-slot="tag-remove"></button></span>`),z}function B(e,t,n){return n?{value:``,clear:!1}:e===``?{value:``,clear:!0}:{value:t,clear:!1}}function V(e,t){return e.replace(`{label}`,t)}i(`ui-combobox`,class extends Oe{slotPrefix=`combobox`;openOnFocus=!1;#e=``;#t=``;#n=[];#r=``;setup(e){super.setup(e);let t=this.searchInput;if(!t)return;let n=this.#i();this.#t=t.getAttribute(`placeholder`)??``,n&&this.querySelector(`[data-combobox-slot~="list"]`)?.setAttribute(`aria-multiselectable`,`true`);let r=this.#u();if(r!==null&&r.value!==``&&this.#o().length===0&&this.items().find(e=>this.#c(e)===r.value)?.setAttribute(`aria-selected`,`true`),n)for(let e of this.items())e.getAttribute(`aria-selected`)!==`true`&&e.setAttribute(`aria-selected`,`false`);this.#n=this.#o().map(e=>this.#c(e)),this.#e=n?``:this.#s()??``,t.value=this.#e,this.#d(!1);let i=t.closest(`[data-combobox-slot~="control"]`);t.addEventListener(`click`,()=>this.#a(),{signal:e}),i?.addEventListener(`mousedown`,e=>{e.target instanceof Element&&e.target!==t&&(e.preventDefault(),t.focus(),e.target.closest(`[data-combobox-slot~="trigger"], [data-combobox-slot~="tag"]`)||this.#a())},{signal:e}),i?.addEventListener(`click`,e=>{if(!(e.target instanceof Element))return;let n=e.target.closest(`[data-combobox-slot~="tag-remove"]`);if(!n)return;e.preventDefault();let r=n.closest(`[data-combobox-slot~="tag"]`)?.getAttribute(`data-combobox-value`);this.#l(this.items().find(e=>this.#c(e)===r)),t.focus()},{signal:e});let a=this.querySelector(`[data-combobox-slot~="trigger"]`);a instanceof HTMLElement&&a.addEventListener(`click`,()=>{this.open.get()?this.open.set(!1):this.#a()},{signal:e}),n&&t.addEventListener(`keydown`,e=>{if(e.key!==`Backspace`||t.value!==``)return;let n=this.#o().at(-1);n&&(e.preventDefault(),this.#l(n))},{signal:e}),this.addEventListener(`focusout`,e=>{let n=e.relatedTarget;if(n instanceof Node&&this.contains(n))return;let r=B(t.value,this.#e,this.#i());t.value=r.value,this.query.set(``),r.clear&&this.#m()},{signal:e}),(r??t).form?.addEventListener(`reset`,()=>queueMicrotask(()=>this.#h()),{signal:e})}teardown(){for(let e of this.querySelectorAll(`[data-combobox-slot~="tag"], [data-combobox-state~="stamped"]`))e.remove();this.searchInput&&(this.searchInput.placeholder=this.#t)}itemValue(e){return e.textContent?.trim()??``}clearQuery(){let e=this.searchInput;e&&(e.value=this.#i()?``:this.#e,this.query.set(``))}commit(e,t){let n=this.searchInput;if(n){if(this.#i())e.setAttribute(`aria-selected`,String(e.getAttribute(`aria-selected`)!==`true`)),n.value=``,this.query.set(``),this.activeIndex.set(this.items().indexOf(e)),this.#d(!0),n.focus();else{this.#e=this.itemValue(e),n.value=this.#e,this.query.set(``);for(let e of this.items())e.removeAttribute(`aria-selected`);e.setAttribute(`aria-selected`,`true`),this.#d(!0),n.focus(),this.panel?.hasAttribute(`popover`)?this.open.set(!1):n.select()}}}#i(){return this.config(`variant`)===`multiselect`}#a(){let e=this.searchInput;if(e&&!this.open.get()){if(this.#i())e.value=``,this.activeIndex.set(-1);else{e.value=this.#e;let t=this.#o()[0];this.activeIndex.set(t?this.items().indexOf(t):-1),e.value!==``&&e.select()}this.query.set(``),this.open.set(!0)}}#o(){return this.items().filter(e=>e.getAttribute(`aria-selected`)===`true`)}#s(){let e=this.#o()[0];return e?this.itemValue(e):void 0}#c(e){return e.getAttribute(`data-combobox-value`)??this.itemValue(e)}#l(e){e&&(e.setAttribute(`aria-selected`,`false`),this.#d(!0))}#u(){let e=this.querySelector(`[data-combobox-slot~="value"]:not([data-combobox-state~="stamped"])`);return e instanceof HTMLInputElement?e:null}#d(e){let t=this.searchInput,n=this.#o().map(e=>this.#c(e)),r=JSON.stringify(n),i=r!==this.#r;this.#r=r,t&&this.#i()&&this.#p(t);let a=this.#u();if(!a)return;a.value=n[0]??``;for(let e of this.querySelectorAll(`[data-combobox-state~="stamped"]`))e.remove();let o=a;for(let e of n.slice(1)){let t=document.createElement(`input`);t.type=`hidden`,t.setAttribute(`data-combobox-slot`,`value`),t.setAttribute(`data-combobox-state`,`stamped`),a.name&&(t.name=a.name),t.value=e,o.after(t),o=t}e&&i&&a.dispatchEvent(new Event(`change`,{bubbles:!0}))}#f(){let e=this.querySelector(`[data-combobox-slot~="tag-template"]`),t=(e instanceof HTMLTemplateElement?e:Ne()).content.firstElementChild;return t instanceof HTMLElement?t:null}#p(e){let t=e.closest(`[data-combobox-slot~="control"]`);if(!t)return;for(let e of t.querySelectorAll(`[data-combobox-slot~="tag"]`))e.remove();let n=this.#f();if(!n)return;let r=this.config(`label-remove`)??`Remove {label}`,i=this.#o().map(e=>{let t=this.itemValue(e),i=n.cloneNode(!0);if(i.setAttribute(`data-combobox-value`,this.#c(e)),!i.matches(`[data-combobox-slot~="tag"]`)){let e=i.getAttribute(`data-combobox-slot`);i.setAttribute(`data-combobox-slot`,e?`${e} tag`:`tag`)}let a=i.querySelector(`[data-combobox-slot~="tag-label"]`);return a?a.textContent=t:i.prepend(document.createTextNode(t)),i.querySelector(`[data-combobox-slot~="tag-remove"]`)?.setAttribute(`aria-label`,V(r,t)),i});e.before(...i),e.placeholder=i.length>0?``:this.#t}#m(e=!0){this.#e=``;let t=this.#i();for(let e of this.items())t?e.setAttribute(`aria-selected`,`false`):e.removeAttribute(`aria-selected`);this.searchInput&&(this.searchInput.value=``),this.query.set(``),this.#d(e)}get value(){let e=this.#o()[0];return e?this.#c(e):``}set value(e){let t=this.items().find(t=>this.#c(t)===e);if(!t){this.#m(!1);return}let n=this.#i();for(let e of this.items())n?e.setAttribute(`aria-selected`,`false`):e.removeAttribute(`aria-selected`);t.setAttribute(`aria-selected`,`true`),this.#e=n?``:this.itemValue(t);let r=this.searchInput;r&&(r.value=this.#e),this.query.set(``),this.#d(!1)}#h(){let e=this.searchInput;if(!e)return;let t=this.#i();for(let e of this.items()){let n=this.#n.includes(this.#c(e));t?e.setAttribute(`aria-selected`,String(n)):n?e.setAttribute(`aria-selected`,`true`):e.removeAttribute(`aria-selected`)}this.#e=t?``:this.#s()??``,e.value=this.#e,this.query.set(``),this.#d(!0)}});function Pe(e){let t=e.split(`+`).map(e=>e.trim().toLowerCase()).filter(e=>e.length>0);if(t.length===0)return null;let n={key:``,ctrl:!1,alt:!1,shift:!1,meta:!1,mod:!1};for(let e of t.slice(0,-1))switch(e){case`mod`:n.mod=!0;break;case`ctrl`:case`control`:n.ctrl=!0;break;case`alt`:case`option`:n.alt=!0;break;case`shift`:n.shift=!0;break;case`meta`:case`cmd`:case`super`:n.meta=!0;break;default:return null}return n.key=t[t.length-1],n}function Fe(){return typeof navigator>`u`?!1:/mac|iphone|ipad|ipod/i.test(navigator.platform||navigator.userAgent)}function Ie(e,t,n=Fe()){let r=t.meta||t.mod&&n,i=t.ctrl||t.mod&&!n;return e.metaKey!==r||e.ctrlKey!==i||e.altKey!==t.alt||e.shiftKey!==t.shift?!1:e.key.toLowerCase()===t.key}function Le(e){return e instanceof HTMLElement?e.isContentEditable?!0:e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement:!1}function H(e){return!e.ctrl&&!e.alt&&!e.meta&&!e.mod}function U(e,t,n={}){let r=Pe(e);return!r||typeof document>`u`?!1:(document.addEventListener(`keydown`,e=>{e.defaultPrevented||e.repeat||H(r)&&Le(e.target)||Ie(e,r)&&(e.preventDefault(),t(e))},{signal:n.signal}),!0)}i(`ui-command`,class extends Oe{slotPrefix=`command`;managesPanel=!1;autoHighlight=!0;get sortByScore(){return this.config(`sort`)!==`document`}setup(e){super.setup(e);let t=this.searchInput,n=this.panel;if(!t||!n)return;let r=this.getAttribute(`data-command-hotkey`);r&&U(r,()=>this.#n(),{signal:e});for(let t of this.items()){let n=t.getAttribute(`data-command-hotkey`);n&&U(n,()=>this.#t(t,!0),{signal:e})}let i=()=>{t.value=``,this.query.set(``),this.activeIndex.set(0)};n instanceof HTMLDialogElement?this.addEventListener(`zazz:dialog-close`,e=>{e.target===n&&i()},{signal:e}):n.addEventListener(`toggle`,e=>{e.newState===`closed`&&i()},{signal:e})}commit(e,t){this.#e||this.#t(e,t===`keyboard`)}#e=!1;#t(e,t){if(this.dispatchEvent(new CustomEvent(`zazz:command-select`,{bubbles:!0,detail:{item:e,value:this.itemValue(e)}})),t){this.#e=!0;try{e.click()}finally{this.#e=!1}}e.hasAttribute(`data-command-stay-open`)||this.#r()}#n(){let e=this.panel;e&&(e instanceof HTMLDialogElement?e.open?e.close():e.showModal():e.togglePopover())}#r(){let e=this.panel;e&&(e instanceof HTMLDialogElement?e.open&&e.close():e.matches(`:popover-open`)&&e.hidePopover())}});var Re=class extends r{setup(e){let t=this.closest(`dialog`);t&&!t.open?t.addEventListener(`zazz:dialog-open`,()=>this.init(),{signal:e}):this.init()}teardown(){this._carouselController?.abort(),delete this._carouselController,this.removeAttribute(`data-carousel-init`)}init(){he.initRoot(this)}get api(){return this._carousel??null}};i(`ui-carousel`,Re);const W=1e3,ze=`dialog[data-ui~="drawer"]`,Be=`[data-drawer-slot~="handle"]`,G=`data-drawer-indent-state`;function K(e,t,n,r){let i=new Set((e.getAttribute(t)??``).split(/\s+/).filter(Boolean));i.has(n)!==r&&(r?i.add(n):i.delete(n),i.size?e.setAttribute(t,[...i].join(` `)):e.removeAttribute(t))}function q(e,t,n){K(e,`data-drawer-state`,t,n)}function Ve(e,t){q(e,`dragging`,t)}function He(e){Ve(e,!1),e.style.removeProperty(`translate`),e.style.removeProperty(`--_drawer-backdrop`)}function Ue(e,t){let n=e.getAttribute(`data-drawer-snap`)?.trim();if(!n)return[0];let r=Number.parseFloat(getComputedStyle(document.documentElement).fontSize)||16,i=/* @__PURE__ */ new Set;for(let e of n.split(/\s+/)){let n=Number.parseFloat(e);if(!Number.isFinite(n)||n<=0)continue;let a=n*t;e.endsWith(`rem`)?a=n*r:(e.endsWith(`px`)||n>1)&&(a=n),i.add(Math.round(t-Math.min(t,Math.max(1,a))))}return i.size?[...i].sort((e,t)=>t-e):[0]}function We(e){try{let t=e.animate([{opacity:1},{opacity:0}],{pseudoElement:`::backdrop`,duration:W,fill:`both`});return t.pause(),t}catch{return null}}function Ge(e){return getComputedStyle(e).getPropertyValue(`--_drawer-mode`).trim()===`1`}function Ke(e){if(e.scrollHeight<=e.clientHeight)return!1;let t=getComputedStyle(e).overflowY;return t===`auto`||t===`scroll`}function qe(e,t,n,r){if(!Ge(e))return!1;let i=e.getBoundingClientRect();if(t.startY<i.top||t.startX<i.left||t.startX>i.right)return!1;if(t.target.closest(Be)||r)return!0;let a=t.offset>0;for(let n=t.target;n&&e.contains(n);n=n.parentElement)if(Ke(n)&&(n.scrollTop>0||!a))return!1;return performance.now()-n>=100}const J=[];function Y(){for(let e=J.length-1;e>=0;e--){let t=J[e];t.isConnected&&t.open||J.splice(e,1)}J.forEach((e,t)=>{let n=J.length-1-t;q(e,`following`,!1),q(e,`stacked`,n>0),q(e,`nested`,t>0),n>0?e.style.setProperty(`--_drawer-depth`,String(n)):e.style.removeProperty(`--_drawer-depth`)}),Xe(J.length>0)}function Je(e,t,n){let r=J.indexOf(e);for(let e=0;e<r;e++){let i=J[e];i.style.setProperty(`--_drawer-depth`,String(r-e-t)),q(i,`following`,n)}}let X=null,Z=null;function Ye(e){let t=e.getBoundingClientRect(),n=e.offsetWidth||1,r=Number.parseFloat(getComputedStyle(e).getPropertyValue(`--_drawer-indent-inset`))||0,i=Math.max(0,-t.top),a=Math.max(0,e.offsetHeight-i-window.innerHeight);e.style.setProperty(`--_drawer-indent-scale`,String(Math.max(0,1-r*2/n))),e.style.setProperty(`--_drawer-indent-top`,`${i}px`),e.style.setProperty(`--_drawer-indent-bottom`,`${a}px`)}function Xe(e){X&&!X.isConnected&&(Z?.(),X=null);let t=X??document.querySelector(`ui-drawer-indent, [data-ui~="drawer-indent"]`);if(!t)return;if(e){Z?.(),X!==t&&(Ye(t),X=t),K(t,G,`on`,!0),K(t,G,`active`,!0);return}if(!X||Z)return;K(t,G,`dragging`,!1),t.style.removeProperty(`--_drawer-indent-amount`),K(t,G,`active`,!1);let n=()=>{Z?.(),t.removeAttribute(G);for(let e of[`scale`,`top`,`bottom`])t.style.removeProperty(`--_drawer-indent-${e}`);X=null},r=y(t);if(r<=0){n();return}let i=e=>{e.target===t&&e.propertyName===`scale`&&n()},a=window.setTimeout(n,r+100);t.addEventListener(`transitionend`,i),Z=()=>{window.clearTimeout(a),t.removeEventListener(`transitionend`,i),Z=null}}function Ze(e,t){X&&(K(X,G,`dragging`,t),t?X.style.setProperty(`--_drawer-indent-amount`,String(1-e)):X.style.removeProperty(`--_drawer-indent-amount`))}const Q=`--_drawer-keyboard`,Qe=/^(?:button|checkbox|color|file|hidden|image|radio|range|reset|submit|date|datetime-local|month|time|week)$/;function $e(e){return e instanceof HTMLTextAreaElement?!e.readOnly:e instanceof HTMLInputElement?!e.readOnly&&!Qe.test(e.type):e instanceof HTMLElement&&e.isContentEditable}function et(){let e=window.visualViewport;if(!e||Math.abs(e.scale-1)>.01)return 0;let t=Math.max(0,e.offsetTop)+e.height;return Math.max(0,Math.round(window.innerHeight-Math.min(window.innerHeight,t)))}function tt(e,t,n){let r=window.visualViewport;if(!r)return;let i=()=>J[J.length-1]===e,a=window.scrollX,o=window.scrollY,s=0,c=0,l=()=>{s=0;let t=i()?et():0;t!==c&&(c=t,t>0?e.style.setProperty(Q,`${t}px`):e.style.removeProperty(Q),n())},u=()=>{s||=requestAnimationFrame(l)},d=t=>{if(!e.contains(t)||document.activeElement!==t)return;let n=t.parentElement;for(;n&&e.contains(n)&&!Ke(n);)n=n.parentElement;if(!n||!e.contains(n))return;let i=n.getBoundingClientRect(),a=t.getBoundingClientRect(),o=Math.min(i.bottom,r.offsetTop+r.height)-16,s=Math.max(i.top,r.offsetTop)+16,c=0;if(a.bottom>o&&(c=a.bottom-o),a.top-c<s&&(c=a.top-s),Math.abs(c)<1)return;let l=matchMedia(`(prefers-reduced-motion: reduce)`).matches;n.scrollBy({top:c,behavior:l?`instant`:`smooth`})};r.addEventListener(`resize`,u,{signal:t}),r.addEventListener(`scroll`,u,{signal:t}),window.addEventListener(`scroll`,()=>{!i()||window.scrollX===a&&window.scrollY===o||window.scrollTo({left:a,top:o,behavior:`instant`})},{passive:!0,signal:t}),e.addEventListener(`focusin`,e=>{let n=e.target;if(n instanceof Element&&$e(n)&&i())for(let e of[100,350]){let r=window.setTimeout(()=>{l(),d(n)},e);t.addEventListener(`abort`,()=>window.clearTimeout(r),{once:!0})}},{signal:t}),t.addEventListener(`abort`,()=>{cancelAnimationFrame(s),e.style.removeProperty(Q)}),l()}const nt=/* @__PURE__ */ new WeakMap,rt=/* @__PURE__ */ new WeakMap;function it(e){if(nt.has(e))return;let t=new AbortController,{signal:n}=t;rt.get(e)?.cancel(),rt.delete(e),He(e);let r=e.hasAttribute(`data-drawer-snap`),i=0,a=0,o=1,s=0,c=[0],l=0,u=null,d=null,f=()=>{s=Math.max(0,-Number.parseFloat(getComputedStyle(e).marginBlockEnd)||0),o=Math.max(1,e.offsetHeight-s),c=r?Ue(e,o):[0],l=Math.min(l,c.length-1)},p=()=>{if(!r)return;let t=l===c.length-1;e.style.setProperty(`--_drawer-snap`,`${c[l]??0}px`),q(e,`expanded`,t),q(e,`partial`,!t)},m=(t,n)=>{Je(e,t,n),J.length===1&&J[0]===e&&Ze(t,n)},h=(t,n)=>{e.style.removeProperty(`--_drawer-backdrop`);let r=u;if(!r)return;let i=()=>{t||u!==r||r.playState!==`finished`||(r.cancel(),rt.delete(e),u=null)},a=Number(r.currentTime)||0,o=t?W-a:a;n<=0||o<=0?(r.playbackRate=t?1:-1,r.finish(),i()):(r.playbackRate=(t?1:-1)*o/n,r.play(),r.finished.then(i,()=>{}))},g=t=>{let n=Math.min(Math.max(t,0),c.length-1),r=n!==l;l=n,p(),Ve(e,!1),h(!1,y(e)),e.style.removeProperty(`translate`),m(0,!1),r&&e.dispatchEvent(new CustomEvent(`zazz:drawer-snap`,{bubbles:!0,detail:{index:l,value:o-(c[l]??0)}}))},_=()=>g(l),te=()=>{e.open&&(typeof e.requestClose==`function`?e.requestClose():e.close(),e.open&&(J.length===1&&Xe(!0),_()))},v=t=>{if(e.style.translate=`0 ${o+s}px`,h(!0,t),Je(e,1,!1),J.length===1&&J[0]===e&&Xe(!1),t<=0){te();return}let n=t=>{t.target===e&&t.propertyName===`translate`&&r()},r=()=>{d?.(),te()},i=window.setTimeout(r,t+100);e.addEventListener(`transitionend`,n),d=()=>{window.clearTimeout(i),e.removeEventListener(`transitionend`,n),d=null}};nt.set(e,{controller:t,snapTo:g}),Ge(e)&&(f(),p(),J.push(e),Y(),tt(e,n,()=>{f(),p()})),n.addEventListener(`abort`,()=>{d?.(),u?.playState===`paused`&&(u.cancel(),rt.delete(e))}),e.addEventListener(`scroll`,()=>{i=performance.now()},{capture:!0,passive:!0,signal:n}),e.addEventListener(`click`,e=>{c.length<2||!(e.target instanceof Element)||e.target.closest(Be)&&g((l+1)%c.length)},{signal:n}),window.addEventListener(`resize`,()=>{J.includes(e)&&(f(),p())},{signal:n}),ae(e,{axis:`y`,signal:n,canStart:t=>qe(e,t,i,l<c.length-1),onStart:()=>{d&&J.length===1&&Xe(!0),d?.(),a=re(e).y,f(),u||(u=We(e),u&&rt.set(e,u)),u?.pause(),Ve(e,!0)},onMove:({offset:t})=>{let n=a+t,r=c[c.length-1]??0,i=n>=r?n:r+ee(n-r,s+r);e.style.translate=`0 ${i}px`;let l=c[0]??0,d=Math.min(1,Math.max(0,(i-l)/Math.max(1,o-l)));u?u.currentTime=d*W:e.style.setProperty(`--_drawer-backdrop`,String(1-d)),m(d,!0)},onEnd:({offset:t,velocity:n})=>{let r=ne({stops:c,position:a+t,velocity:n,active:l,size:o,closeRatio:.25,flick:.4,fling:2,sequential:e.hasAttribute(`data-drawer-snap-sequential`)});Ve(e,!1),r<0?v(y(e)):g(r)},onCancel:_})}function at(e){nt.get(e)?.controller.abort(),nt.delete(e),e.removeAttribute(`data-drawer-state`),e.style.removeProperty(`--_drawer-depth`);let t=J.indexOf(e);t<0||(J.splice(t,1),Y())}const ot=function(){if(!ot._bound){ot._bound=!0,document.addEventListener(`zazz:dialog-open`,e=>{e.target instanceof HTMLDialogElement&&e.target.matches(ze)&&it(e.target)}),document.addEventListener(`zazz:dialog-close`,e=>{e.target instanceof HTMLDialogElement&&at(e.target)}),window.addEventListener(`resize`,()=>{X&&Ye(X)});for(let e of document.querySelectorAll(`${ze}[open]`))it(e)}};typeof window<`u`&&typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,ot):ot()),i(`ui-lightbox`,class extends r{setup(e){let t=this.querySelector(`dialog`);t instanceof HTMLDialogElement&&(this.addEventListener(`zazz:dialog-open`,e=>{e.target===t&&this.#t(t)},{signal:e}),this.addEventListener(`zazz:dialog-close`,e=>{e.target===t&&this.#n(t)},{signal:e}))}#e(){return this.querySelector(`[data-lightbox-slot~="gallery"] :is(ui-carousel, [data-ui~="carousel"])`)}#t(e){let t=e.querySelector(`:is(ui-carousel, [data-ui~="carousel"])`);if(!t)return;t instanceof Re&&t.init();let n=t._carousel,r=this.#e()?._carousel;n&&r&&n.goTo(r.selectedSnap(),!0);let i=t.querySelector(`[data-carousel-slot~="viewport"]`);i instanceof HTMLElement&&i.focus({preventScroll:!0})}#n(e){let t=e.querySelector(`:is(ui-carousel, [data-ui~="carousel"])`)?._carousel,n=this.#e()?._carousel;t&&n&&n.goTo(t.selectedSnap())}}),i(`ui-menu`,class extends r{setup(e){this.addEventListener(`keydown`,e=>this.#n(e),{signal:e})}#e(){let e=this.querySelector(`:scope > [data-menu-slot~="popover"]`);return e instanceof HTMLElement?e:null}#t(e){return Array.from(e.querySelectorAll(`a[href], button`)).filter(e=>e instanceof HTMLElement).filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-disabled`)!==`true`&&e.closest(`ui-menu, [data-ui~="menu"]`)===this)}#n(e){if(![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest(`ui-menu, [data-ui~="menu"]`)!==this)return;let n=this.#e();if(!n)return;let r=t.parentElement===this&&(t.hasAttribute(`popovertarget`)||t.hasAttribute(`interestfor`)),i=n.matches(`:popover-open`);if(r&&!i&&(e.key===`ArrowDown`||e.key===`ArrowUp`)){e.preventDefault(),n.showPopover();let t=this.#t(n);t[e.key===`ArrowDown`?0:t.length-1]?.focus();return}if(!i||!n.contains(t))return;let a=this.#t(n);if(a.length===0)return;let o=a.indexOf(t),s;switch(e.key){case`ArrowDown`:s=o===-1?0:(o+1)%a.length;break;case`ArrowUp`:s=o===-1?a.length-1:(o-1+a.length)%a.length;break;case`Home`:s=0;break;case`End`:s=a.length-1;break;default:return}e.preventDefault(),a[s].focus()}});function st(e,t){if(!e)return[t];let n=e.split(`-`).map(e=>Number.parseInt(e,10)).filter(e=>Number.isFinite(e)&&e>0);return n.reduce((e,t)=>e+t,0)===t&&n.length>0?n:[t]}function ct(e,t,n){let r;switch(t){case`numeric`:r=/[^0-9]/g;break;case`alpha`:r=/[^a-zA-Z]/g;break;case`alphanumeric`:r=/[^a-zA-Z0-9]/g;break;case`none`:r=/\s/g}return e.replace(r,``).slice(0,n)}function lt(e,t,n,r,i){let a=r?Math.min(n,t-1):-1;return Array.from({length:t},(t,n)=>{let r=e.charAt(n);return{char:r===``?``:i?`•`:r,filled:r!==``,active:n===a}})}function ut(e,t){return t>0&&e.length===t}i(`ui-otp`,class extends r{#e=null;#t=``;setup(e){let t=this.querySelector(`input`);if(!(t instanceof HTMLInputElement))return;let n=t.maxLength>0?t.maxLength:6,r=this.getAttribute(`data-otp-type`)??`numeric`,i=this.hasAttribute(`data-otp-mask`),a=st(this.getAttribute(`data-otp-groups`),n),o=this.#n(a);this.setAttribute(`data-otp-ready`,``);let s=j(ct(t.value,r,n)),c=j(t.selectionStart??0),l=j(document.activeElement===t);t.addEventListener(`input`,()=>{let e=ct(t.value,r,n);t.value!==e&&(t.value=e),s.set(e),c.set(t.selectionStart??e.length)},{signal:e}),document.addEventListener(`selectionchange`,()=>{document.activeElement===t&&c.set(t.selectionStart??0)},{signal:e}),t.addEventListener(`focus`,()=>l.set(!0),{signal:e}),t.addEventListener(`blur`,()=>l.set(!1),{signal:e}),o.addEventListener(`pointerdown`,e=>{let r=e.target instanceof Element?e.target.closest(`[data-otp-index]`):null;e.preventDefault(),t.focus();let i=r?Number(r.getAttribute(`data-otp-index`)):n,a=Math.min(i,t.value.length);t.setSelectionRange(a,a),c.set(a)},{signal:e}),N(()=>{let e=lt(s.get(),n,c.get(),l.get(),i),r=o.querySelectorAll(`[data-otp-index]`);e.forEach((e,t)=>{let n=r[t];if(!(n instanceof HTMLElement))return;n.textContent=e.char;let i=[e.filled&&`filled`,e.active&&`active`].filter(Boolean).join(` `);i?n.setAttribute(`data-otp-state`,i):n.removeAttribute(`data-otp-state`)});let a=ut(s.get(),n);a?this.setAttribute(`data-otp-complete`,``):this.removeAttribute(`data-otp-complete`),a&&this.hasAttribute(`data-otp-auto-submit`)&&this.#t!==s.get()&&(this.#t=s.get(),t.form?.requestSubmit())},{signal:e})}teardown(){this.#e?.remove(),this.#e=null,this.removeAttribute(`data-otp-ready`),this.removeAttribute(`data-otp-complete`)}#n(e){let t=document.createElement(`div`);t.setAttribute(`data-otp-slot`,`rail`),t.setAttribute(`aria-hidden`,`true`);let n=0;return e.forEach((e,r)=>{if(r>0){let e=document.createElement(`span`);e.setAttribute(`data-otp-slot`,`separator`),e.setAttribute(`aria-role`,`presentation`),e.textContent=`–`,t.append(e)}for(let r=0;r<e;r++){let e=document.createElement(`span`);e.setAttribute(`data-otp-slot`,`cell`),e.setAttribute(`data-otp-index`,String(n++)),t.append(e)}}),this.append(t),this.#e=t,t}});function dt(e,t,n){return{type:e?`text`:`password`,ariaPressed:e?`true`:`false`,ariaLabel:e?n:t}}i(`ui-password`,class extends r{setup(e){let t=this.querySelector(`input[type="password"], input[type="text"]`),n=this.querySelector(`[data-password-group-slot~="toggle"]`);if(!(t instanceof HTMLInputElement)||!(n instanceof HTMLElement))return;let r=j(t.type===`text`);n.addEventListener(`click`,()=>r.set(!r.get()),{signal:e}),N(()=>{let e=this.getAttribute(`data-password-group-label-show`)||`Show password`,i=this.getAttribute(`data-password-group-label-hide`)||`Hide password`,a=dt(r.get(),e,i);t.type=a.type,n.setAttribute(`aria-pressed`,a.ariaPressed),n.setAttribute(`aria-label`,a.ariaLabel)},{signal:e})}});function ft(e,t,n){return e.length===0?t:e.length===1?e[0]:`${e[0]} ${n.replace(`{n}`,String(e.length-1))}`}let pt=0;i(`ui-multiselect`,class extends r{#e=[];#t=null;setup(e){let t=this.querySelector(`select[multiple]`);if(!(t instanceof HTMLSelectElement))return;this.#t=t;let n=this.getAttribute(`data-multiselect-placeholder`)??`Select…`,r=this.getAttribute(`data-multiselect-label-more`)??`(+{n} more)`,{trigger:i,label:a,panel:o,checkboxes:s}=this.#n(t);t.setAttribute(`data-multiselect-state`,`enhanced`);let c=()=>Array.from(t.selectedOptions).map(e=>e.label),l=j(c());s.forEach((n,r)=>{n.addEventListener(`change`,()=>{let e=t.options[r];e&&(e.selected=n.checked),l.set(c()),t.dispatchEvent(new Event(`change`,{bubbles:!0}))},{signal:e})}),t.addEventListener(`change`,()=>l.set(c()),{signal:e}),t.form?.addEventListener(`reset`,()=>queueMicrotask(()=>l.set(c())),{signal:e}),o.addEventListener(`toggle`,e=>{i.setAttribute(`aria-expanded`,String(e.newState===`open`))},{signal:e}),N(()=>{l.get(),a.textContent=ft(c(),n,r),s.forEach((e,n)=>{let r=t.options[n];r&&e.checked!==r.selected&&(e.checked=r.selected)})},{signal:e})}teardown(){for(let e of this.#e)e.remove();this.#e=[],this.#t?.removeAttribute(`data-multiselect-state`),this.#t=null}#n(e){let t=`ui-multiselect-panel-${++pt}`,n=document.createElement(`button`);n.type=`button`,n.dataset.ui=`select`,n.setAttribute(`data-multiselect-slot`,`trigger`),n.setAttribute(`popovertarget`,t),n.setAttribute(`aria-expanded`,`false`);let r=document.createElement(`span`);r.setAttribute(`data-multiselect-slot`,`label`);let i=document.createElement(`span`);i.setAttribute(`data-multiselect-slot`,`icon`),i.setAttribute(`aria-hidden`,`true`),n.append(r,i);let a=document.createElement(`div`);a.id=t,a.setAttribute(`data-multiselect-slot`,`panel`),a.setAttribute(`popover`,`auto`);let o=this.getAttribute(`data-multiselect-side`),s=this.getAttribute(`data-multiselect-align`);o&&a.setAttribute(`data-popover-side`,o),s&&a.setAttribute(`data-popover-align`,s);let c=[];for(let[n,r]of Array.from(e.options).entries()){let e=document.createElement(`label`);e.setAttribute(`data-multiselect-slot`,`option`);let i=document.createElement(`input`);i.type=`checkbox`,i.id=`${t}-${n}`,i.checked=r.selected,i.disabled=r.disabled,e.append(i,document.createTextNode(r.label)),a.append(e),c.push(i)}return e.after(n,a),this.#e=[n,a],{trigger:n,label:r,panel:a,checkboxes:c}}}),i(`ui-tabs`,class extends r{setup(e){this.addEventListener(`keydown`,e=>this.#e(e),{signal:e})}#e(e){let t=e.target;if(!(t instanceof HTMLInputElement)||t.type!==`radio`)return;let n=t.closest(`[role="tablist"], [data-tabs-slot~="list"]`);if(!n||n.closest(`ui-tabs, [data-ui~="tabs"]`)!==this)return;let r=Array.from(n.querySelectorAll(`input[type="radio"]`)).filter(e=>e instanceof HTMLInputElement).filter(e=>!e.disabled);if(r.length<2)return;let i=this.getAttribute(`data-tabs-orientation`)===`vertical`,a=i?`ArrowUp`:`ArrowLeft`,o=i?`ArrowDown`:`ArrowRight`,s=r.indexOf(t);if(s===-1)return;let c;switch(e.key){case a:c=(s-1+r.length)%r.length;break;case o:c=(s+1)%r.length;break;case`Home`:c=0;break;case`End`:c=r.length-1;break;default:return}e.preventDefault();let l=r[c];l.checked=!0,l.focus(),l.dispatchEvent(new Event(`change`,{bubbles:!0}))}});function mt(){var e=typeof SuppressedError==`function`?SuppressedError:function(e,t){var n=Error();return n.name=`SuppressedError`,n.error=e,n.suppressed=t,n},t={},n=[];function r(e,t){if(t!=null){if(Object(t)!==t)throw TypeError(`using declarations can only be used with objects, functions, null, or undefined.`);if(e)var r=t[Symbol.asyncDispose||Symbol.for(`Symbol.asyncDispose`)];if(r===void 0&&(r=t[Symbol.dispose||Symbol.for(`Symbol.dispose`)],e))var i=r;if(typeof r!=`function`)throw TypeError(`Object is not disposable.`);i&&(r=function(){try{i.call(t)}catch(e){return Promise.reject(e)}}),n.push({v:t,d:r,a:e})}else e&&n.push({d:t,a:e});return t}return{e:t,u:r.bind(null,!1),a:r.bind(null,!0),d:function(){var r,i=this.e,a=0;function o(){for(;r=n.pop();)try{if(!r.a&&a===1)return a=0,n.push(r),Promise.resolve().then(o);if(r.d){var e=r.d.call(r.v);if(r.a)return a|=2,Promise.resolve(e).then(o,s)}else a|=1}catch(e){return s(e)}if(a===1)return i===t?Promise.resolve():Promise.reject(i);if(i!==t)throw i}function s(n){return i=i===t?n:new e(n,i),o()}return o()}}}Symbol.dispose??=Symbol(`Symbol.dispose`);const ht=[`success`,`info`,`warning`,`destructive`],gt={success:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"/></svg>`,info:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z" clip-rule="evenodd"/></svg>`,warning:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z" clip-rule="evenodd"/></svg>`,destructive:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"/></svg>`,close:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>`};function _t(e){for(let t of e)t.style.blockSize=`auto`;return{[Symbol.dispose](){for(let t of e)t.style.removeProperty(`block-size`)}}}function vt(e){let t=e.length,n=Array.from({length:t}),r=0;for(let i=t-1;i>=0;i--){let a=t-1-i;n[i]={stackIndex:a,offsetPx:r,zIndex:t-a,front:a===0,visible:a<3},r+=e[i]}return{toasts:n,frontToastHeightPx:t>0?e[t-1]:null}}function $(e,t,n){let r=(e.getAttribute(`data-toaster-state`)??``).split(/\s+/).filter(Boolean),i=n?[.../* @__PURE__ */ new Set([...r,t])]:r.filter(e=>e!==t);i.length?e.setAttribute(`data-toaster-state`,i.join(` `)):e.removeAttribute(`data-toaster-state`)}function yt(e){return e.matches(`[data-toaster-state~="removed"]`)}var bt=class extends r{#e=/* @__PURE__ */ new Map;#t=0;#n=0;#r=null;#i=0;#a=j(!1);#o=j(typeof document<`u`&&document.hidden);#s=j(!1);#c=Se(()=>this.#a.get()||this.#o.get()||this.#s.get());#l=null;#u=j([]);#d=Se(()=>vt(this.#u.get().map(e=>e.height)));setup(e){if(this.#l=e,this.hasAttribute(`popover`)||this.setAttribute(`popover`,`manual`),this.hasAttribute(`role`)||this.setAttribute(`role`,`region`),this.hasAttribute(`aria-label`)||this.setAttribute(`aria-label`,`Notifications`),this.hasAttribute(`tabindex`)||this.setAttribute(`tabindex`,`-1`),!this.querySelector(`[data-toaster-slot~="list"]`)){let e=document.createElement(`ol`);e.setAttribute(`data-toaster-slot`,`list`),e.setAttribute(`aria-live`,`polite`),e.setAttribute(`aria-relevant`,`additions text`),e.setAttribute(`aria-atomic`,`false`),this.append(e)}this.addEventListener(`command`,e=>this.#f(e),{signal:e}),this.addEventListener(`mouseenter`,()=>this.#y(!0),{signal:e}),this.addEventListener(`mouseleave`,()=>this.#b(),{signal:e}),this.addEventListener(`focusin`,()=>this.#y(!0),{signal:e}),this.addEventListener(`focusout`,()=>this.#b(),{signal:e}),document.addEventListener(`visibilitychange`,()=>this.#o.set(document.hidden),{signal:e}),window.addEventListener(`resize`,()=>{cancelAnimationFrame(this.#n),this.#n=requestAnimationFrame(()=>this.#g())},{signal:e}),N(()=>{$(this,`expanded`,this.#a.get())},{signal:e}),N(()=>{this.#c.get()?this.#C():this.#w()},{signal:e}),N(()=>{let e=this.#u.get(),{toasts:t,frontToastHeightPx:n}=this.#d.get();for(let n=0;n<e.length;n++){let{node:r,height:i}=e[n],a=t[n];$(r,`front`,a.front),$(r,`visible`,a.visible),r.style.zIndex=String(a.zIndex),r.style.setProperty(`--toasts-before`,String(a.stackIndex)),r.style.setProperty(`--initial-height`,`${i}px`),r.style.setProperty(`--offset`,`calc(${a.offsetPx}px + var(--ui-toaster-gap) * ${a.stackIndex})`)}n!==null&&this.style.setProperty(`--front-toast-height`,`${n}px`)},{signal:e})}teardown(){cancelAnimationFrame(this.#n),window.clearTimeout(this.#i);for(let e of this.#e.values())clearTimeout(e.timeoutId);this.#e.clear()}addToast(e={}){let t=`toast-${++this.#t}`,n=this.#_();this.#T();let r=this.#p(e,t);return n.append(r),this.#m(r,t),this.#g(),this.#x(t,e.duration??4e3),t}dismiss(e){if(e===void 0){this.dismissAll();return}let t=this.#_().querySelector(`[data-toaster-id="${CSS.escape(e)}"]`);if(!(t instanceof HTMLElement)||yt(t))return;let n=this.#e.get(e);n&&clearTimeout(n.timeoutId),this.#e.delete(e),$(t,`removed`,!0);let r=document.activeElement;r instanceof HTMLElement&&t.contains(r)&&r.matches(`:focus-visible`)&&this.#v().filter(e=>!yt(e)).at(-1)?.focus({preventScroll:!0}),this.#g(),this.#D(t)}dismissAll(){for(let e of this.#v()){let t=e.dataset.toasterId;t&&this.dismiss(t)}}#f(e){let t=e.command;if(typeof t!=`string`||!t.startsWith(`--toast`))return;let n=this.#r;if(n&&n.source===e.source&&n.command===t)return;this.#r={source:e.source,command:t},window.setTimeout(()=>{this.#r=null},0);let r=e.source,i={},a=t.slice(8);if(ht.includes(a)&&(i.variant=a),r instanceof HTMLElement){let{toasterTitle:e,toasterDescription:t,toasterVariant:n,toasterDuration:a,toasterCloseButton:o}=r.dataset;if(e&&(i.title=e),t&&(i.description=t),!i.variant&&n&&ht.includes(n)&&(i.variant=n),a!==void 0){let e=a.trim()===``?NaN:Number(a);Number.isNaN(e)||(i.duration=e)}o!==void 0&&(i.closeButton=o!==`false`)}this.addToast(i)}#p(e,t){let n=document.createElement(`li`);if(n.setAttribute(`data-toaster-slot`,`toast`),n.dataset.toasterId=t,n.tabIndex=0,e.variant&&(n.dataset.toasterVariant=e.variant),e.variant){let t=document.createElement(`span`);t.setAttribute(`data-toaster-slot`,`icon`),t.setAttribute(`aria-hidden`,`true`),t.innerHTML=gt[e.variant],n.append(t)}let r=document.createElement(`div`);if(r.setAttribute(`data-toaster-slot`,`content`),e.title){let t=document.createElement(`div`);t.setAttribute(`data-toaster-slot`,`title`),t.textContent=e.title,r.append(t)}if(e.description){let t=document.createElement(`div`);t.setAttribute(`data-toaster-slot`,`description`),t.textContent=e.description,r.append(t)}n.append(r);let i=e.action;if(i){let e=document.createElement(`button`);e.type=`button`,e.dataset.ui=`button`,e.setAttribute(`data-toaster-slot`,`action`),e.dataset.buttonSize=`sm`,e.textContent=i.label,e.addEventListener(`click`,e=>{i.onClick?.(e),e.defaultPrevented||this.dismiss(t)}),n.append(e)}if(e.closeButton!==!1){let e=document.createElement(`button`);e.type=`button`,e.dataset.ui=`button`,e.setAttribute(`data-toaster-slot`,`close`),e.dataset.buttonVariant=`ghost`,e.dataset.buttonSize=`icon-sm`,e.setAttribute(`aria-label`,`Close notification`),e.innerHTML=gt.close,e.addEventListener(`click`,()=>this.dismiss(t)),n.append(e)}return n}#m(e,t){if(!this.#l)return;let n=0,r=(t,n)=>{let r=typeof n==`number`?`${n}px`:n;e.style.translate=t===`x`?`${r} 0`:`0 ${r}`},i=()=>{$(e,`swiping`,!1),e.style.removeProperty(`translate`),this.#s.set(!1),this.#b()};ae(e,{axis:`both`,signal:this.#l,canStart:()=>!yt(e)&&(this.#a.get()||e.matches(`[data-toaster-state~="front"]`)),onStart:({axis:t})=>{let r=re(e);n=t===`x`?r.x:r.y,$(e,`swiping`,!0),this.#s.set(!0)},onMove:({axis:e,offset:t})=>{let i=n+t,a=this.#h(e);r(e,a===0||Math.sign(i)===a?i:ee(i,24))},onEnd:({axis:a,offset:o,velocity:s})=>{let c=n+o,l=this.#h(a)||Math.sign(c)||1;if(!te({offset:c*l,velocity:s*l,distance:45,velocityThreshold:.11})){i();return}$(e,`swiped`,!0),$(e,`swiping`,!1);let u=v(a===`x`?e.offsetWidth:e.offsetHeight,s,y(e));e.style.transitionDuration=`${u}ms`,r(a,`calc(${c}px + ${l*100}%)`),this.#s.set(!1),this.dismiss(t),this.#b()},onCancel:i})}#h(e){let t=this.getAttribute(`data-toaster-position`)??`bottom-end`;if(e===`y`)return t.startsWith(`top`)?-1:1;if(t.endsWith(`center`))return 0;let n=t.endsWith(`start`)?-1:1;return getComputedStyle(this).direction===`rtl`?-n:n}#g(){try{var e=mt();let t=this.#v().filter(e=>!yt(e));e.u(_t(t));let n=t.map(e=>({node:e,height:e.offsetHeight}));this.#u.set(n)}catch(t){e.e=t}finally{e.d()}}#_(){let e=this.querySelector(`[data-toaster-slot~="list"]`);return e instanceof HTMLOListElement||(e=document.createElement(`ol`),e.setAttribute(`data-toaster-slot`,`list`),this.append(e)),e}#v(){return Array.from(this.#_().children).filter(e=>e instanceof HTMLElement).filter(e=>e.matches(`[data-toaster-slot~="toast"]`))}#y(e){e&&window.clearTimeout(this.#i),this.#a.set(e)}#b(){window.clearTimeout(this.#i),this.#i=window.setTimeout(()=>{let e=document.activeElement,t=e instanceof Node&&this.contains(e);!this.matches(`:hover`)&&!t&&this.#y(!1)},100)}#x(e,t){if(t===1/0||Number.isNaN(t))return;let n={remaining:t,startedAt:0,timeoutId:0};this.#e.set(e,n),this.#c.get()||this.#S(e,n)}#S(e,t){t.startedAt=Date.now(),t.timeoutId=window.setTimeout(()=>this.dismiss(e),t.remaining)}#C(){for(let e of this.#e.values())e.timeoutId&&(clearTimeout(e.timeoutId),e.timeoutId=0,e.remaining=Math.max(0,e.remaining-(Date.now()-e.startedAt)))}#w(){if(!this.#c.get())for(let[e,t]of this.#e)t.timeoutId||this.#S(e,t)}#T(){try{this.matches(`:popover-open`)||this.showPopover()}catch{}}#E(){try{this.matches(`:popover-open`)&&this.hidePopover()}catch{}}#D(e){let t=!1,n=()=>{t||(t=!0,e.remove(),this.#v().length===0&&(this.#y(!1),this.#E()))};e.addEventListener(`transitionend`,t=>{t.target===e&&n()}),window.setTimeout(n,Math.max(600,y(e)+100))}};function xt(e){let t=e instanceof Element?e:typeof e==`string`?document.getElementById(e):document.querySelector(`ui-toaster, [data-ui~="toaster"]`);return t instanceof bt?t:(console.warn('Toaster: no <ui-toaster> found. Add `<ui-toaster popover="manual"></ui-toaster>` to the page.'),null)}function St(e){return typeof e==`string`?{title:e}:e??{}}const Ct={toast(e){let t=St(e),n=xt(t.region);return n?n.addToast(t):null},success(e,t){return Ct.toast({...t,title:e,variant:`success`})},info(e,t){return Ct.toast({...t,title:e,variant:`info`})},warning(e,t){return Ct.toast({...t,title:e,variant:`warning`})},error(e,t){return Ct.toast({...t,title:e,variant:`destructive`})},dismiss(e){for(let t of document.querySelectorAll(`ui-toaster, [data-ui~="toaster"]`))t instanceof bt&&t.dismiss(e)}};i(`ui-toaster`,bt),typeof window<`u`&&(window.Toaster=Ct);function wt(e){return e.documentElement.getAttribute(`data-ui-navigation`)===`swap`}function Tt(e){let t=[];for(let n of[e,...e.querySelectorAll(`*`)])(n.scrollTop||n.scrollLeft)&&t.push([n,n.scrollTop,n.scrollLeft]);return t}function Et(e,t){let n=/* @__PURE__ */ new Map;for(let e of t.querySelectorAll(`a[href], area[href]`)){let t=e.getAttribute(`href`);n.set(t,[...n.get(t)??[],e])}for(let t of e.querySelectorAll(`a[href], area[href]`)){let e=(n.get(t.getAttribute(`href`))?.shift())?.getAttribute(`aria-current`);e==null?t.removeAttribute(`aria-current`):t.setAttribute(`aria-current`,e)}}function Dt(e){let t=document.body,n=/* @__PURE__ */ new Map,r=[];for(let e of t.querySelectorAll(`[data-ui-persist]`)){let t=e.getAttribute(`data-ui-persist`);t&&!n.has(t)&&n.set(t,e)}for(let e of n.values())r.push(...Tt(e));let i=/* @__PURE__ */ new Map;for(let e of t.querySelectorAll(`[data-ui-persist-scroll]`)){let t=e.getAttribute(`data-ui-persist-scroll`);t&&!i.has(t)&&i.set(t,[e.scrollTop,e.scrollLeft])}let a=document.importNode(e,!0),o=[];for(let e of a.querySelectorAll(`[data-ui-persist]`)){let t=n.get(e.getAttribute(`data-ui-persist`)??``);t&&o.push([e,t])}for(let e of a.querySelectorAll(`[data-ui-persist-scroll]`)){let t=e.getAttribute(`data-ui-persist-scroll`)??``,n=i.get(t);i.delete(t),n&&r.push([e,...n])}t.before(a);for(let[e,t]of o){let n=e.parentNode;n&&(Et(t,e),typeof n.moveBefore==`function`?n.moveBefore(t,e):n.insertBefore(t,e),e.remove())}t.remove();for(let[e,t,n]of r)e.scrollTo({top:t,left:n,behavior:`instant`});return a}async function Ot(e,t){let n=document.head,r=/* @__PURE__ */ new Set;for(let e of n.querySelectorAll(`link[rel~="stylesheet"][href]`))r.add(e.href);let i=/* @__PURE__ */ new Set;for(let e of n.querySelectorAll(`style`))i.add(e.textContent??``);let a=[];for(let o of e.head.querySelectorAll(`link[rel~="stylesheet"][href], style`)){if(o.localName===`style`){let e=o.textContent??``;if(i.has(e))continue;i.add(e),n.append(document.importNode(o,!0));continue}let e=new URL(o.getAttribute(`href`)??``,t).href;if(r.has(e))continue;r.add(e);let s=document.importNode(o,!0);s.href=e,a.push(new Promise(e=>{s.addEventListener(`load`,()=>e(),{once:!0}),s.addEventListener(`error`,()=>e(),{once:!0})})),n.append(s)}if(a.length===0)return;let o=0;await Promise.race([Promise.all(a),new Promise(e=>o=window.setTimeout(e,3e3))]),window.clearTimeout(o)}function kt(e){let t=e.querySelector(`main`),n=t?.querySelector(`h1`)??t??e;n instanceof HTMLElement&&(n.hasAttribute(`tabindex`)||(n.tabIndex=-1),n.focus({preventScroll:!0}))}let At=0,jt=``;function Mt(){let e=document.documentElement.style;At++===0&&(jt=e.scrollBehavior,e.scrollBehavior=`auto`);let t=!0;return()=>{t&&(t=!1,--At===0&&(e.scrollBehavior=jt))}}function Nt(e){return new URL(e,location.href).origin===location.origin}function Pt(e){let t=/\.([a-z0-9]+)$/i.exec(new URL(e,location.href).pathname)?.[1];return!t||/^x?html?$/i.test(t)}if(`navigation`in window){let e=null;function t(t){e=t,location.replace(t)}window.navigation.addEventListener(`navigate`,n=>{e!==null&&n.destination.url===e?e=null:wt(document)&&n.canIntercept&&n.navigationType!==`reload`&&(!n.destination.sameDocument||n.navigationType===`traverse`)&&!n.hashChange&&n.downloadRequest===null&&n.formData===null&&Nt(n.destination.url)&&Pt(n.destination.url)&&n.intercept({async handler(){let e;try{let t=await fetch(n.destination.url,{signal:n.signal});if(!t.ok)throw Error(t.statusText);if(!t.headers.get(`content-type`)?.includes(`html`))throw Error(`not a page`);e=new DOMParser().parseFromString(await t.text(),`text/html`)}catch{if(n.signal.aborted)return;t(n.destination.url);return}if(n.signal.aborted)return;if(!wt(e)||!(e.body instanceof HTMLElement)){t(n.destination.url);return}if(await Ot(e,n.destination.url),n.signal.aborted)return;let r=document.body,i=()=>{r=Dt(e.body),document.title=e.title,n.scroll()},a=Mt();if(document.startViewTransition)try{await document.startViewTransition(i).finished}finally{a()}else try{i()}finally{requestAnimationFrame(()=>requestAnimationFrame(a))}s(r),kt(r)}})})}else wt(document)&&console.warn(`Navigation API not supported: data-ui-navigation falls back to full page loads.`);typeof CSS<`u`&&!CSS.supports(`container-type`,`scroll-state`)&&import(`./scroll-state-C8mA5gq6.js`);function Ft(){for(let e of document.querySelectorAll(`[style]`))if(e.getAttribute(`style`)?.includes(`:`)&&e.style.length===0)return!0;return!1}if(typeof document<`u`){let e=()=>{Ft()&&import(`./csp-LRx1fynI.js`)};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,e):e()}export{o as t};
1
+ import{Signal as e}from"signal-polyfill";function t(e){if(e===`true`)return!0;if(e===`false`)return!1;if(!Number.isNaN(Number(e))&&e.trim()!==``)return Number(e);if(e.startsWith(`[`)&&e.endsWith(`]`))try{return JSON.parse(e)}catch{return e}return e}const n={parseValue:t,parseDataAttributes:(e,n)=>{let r={};for(let i of e.attributes)if(i.name.startsWith(n)){let e=i.name.replace(n,``).replace(/-([a-z])/g,(e,t)=>t.toUpperCase());r[e]=t(i.value)}return r}};typeof window<`u`&&(window.Utils=n);var r=class extends HTMLElement{#e=null;connectedCallback(){this.#e||(this.#e=new AbortController,this.setup(this.#e.signal))}connectedMoveCallback(){}disconnectedCallback(){this.#e?.abort(),this.#e=null,this.teardown?.()}};function i(e,t){typeof window<`u`&&(customElements.get(e)||customElements.define(e,t))}const a=[];function o(e){a.push(e)}function s(e){for(let t of a)t(e)}function c(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()}const l=typeof CSS<`u`&&CSS.supports(`top`,`calc(sibling-index() * 1px)`);function u(e){let t=e.trim();return t?/^-?\d*\.?\d+ms$/.test(t)?parseFloat(t):/^-?\d*\.?\d+s$/.test(t)?parseFloat(t)*1e3:parseInt(t,10)||0:0}var d=class e{static#e(){return{margin:`0px`,threshold:.2,duration:c(`--ui-reveal-global-duration`)||`1000ms`,ease:c(`--ui-reveal-global-timing-function`)||`cubic-bezier(0.4, 0, 0.2, 1)`,wait:u(c(`--ui-reveal-global-wait`)),distance:c(`--ui-reveal-global-distance`)||`2rem`,step:c(`--ui-reveal-global-stagger-step`)||`120ms`,grow:parseFloat(c(`--ui-reveal-global-grow`))||.97,shrink:parseFloat(c(`--ui-reveal-global-shrink`))||1.03}}static get defaultConfig(){return e.#e()}#t=/* @__PURE__ */ new Map;config;constructor(t={}){this.config={...e.defaultConfig,...t.config},this.init()}#n(e){let t=JSON.stringify(e),n=this.#t.get(t);return n||(n=new IntersectionObserver((e,t)=>{e.forEach(e=>{e.isIntersecting&&(e.target.setAttribute(`data-reveal-state`,`in-view`),t.unobserve(e.target))})},e),this.#t.set(t,n)),n}#r(e){let t=e.dataset.revealMargin||this.config.margin,n=parseFloat(e.dataset.revealThreshold||this.config.threshold.toString());return{rootMargin:t,threshold:Math.min(Math.max(n,0),1)}}#i(e){let t=e.toString().trim();return/^-?\d*\.?\d+(ms|s)$/.test(t)?t:`${Math.max(0,parseInt(t,10)||0)}ms`}#a(e,t){Object.entries(t).forEach(([t,n])=>{n!=null&&e.style.setProperty(t,n.toString())})}#o(e){let t=e.dataset,n=this.#r(e),r=this.#n(n),i=t.revealStep?Math.max(0,u(t.revealStep)):null,a=t.revealWait?Math.max(0,u(t.revealWait)):null,o={duration:t.revealDuration?Math.max(0,parseInt(t.revealDuration,10)||0):this.config.duration,ease:t.revealEase||this.config.ease,distance:t.revealDistance||this.config.distance,order:t.revealOrder},s=Array.from(e.children),c=o.order===`reversed`?s.reverse():s;this.#a(e,{"--ui-reveal-stagger-base":a===null?null:`${a}ms`,"--ui-reveal-stagger-step":i===null?null:`${i}ms`});let d=0,f=0;if(!l){let t=getComputedStyle(e),n=(e,n)=>Math.max(0,u(t.getPropertyValue(e)||t.getPropertyValue(n)));d=n(`--ui-reveal-stagger-base`,`--ui-reveal-global-wait`),f=n(`--ui-reveal-stagger-step`,`--ui-reveal-global-stagger-step`)}c.forEach((e,n)=>{e instanceof HTMLElement&&(this.#a(e,{"--ui-reveal-duration":this.#i(o.duration),"--ui-reveal-ease":o.ease,"--ui-reveal-wait":l?null:`${d+f*n}ms`,"--ui-reveal-distance":o.distance,"--ui-reveal-scale":t.revealScale||null}),r.observe(e))})}#s(e){let t=e.dataset,n=this.#r(e),r=this.#n(n),i=t.revealDuration?Math.max(0,parseInt(t.revealDuration,10)||0):null,a=t.revealWait?Math.max(0,parseInt(t.revealWait,10)||0):null;this.#a(e,{"--ui-reveal-duration":i===null?null:this.#i(i),"--ui-reveal-wait":a===null?null:this.#i(a),"--ui-reveal-ease":t.revealEase||null,"--ui-reveal-distance":t.revealDistance||null,"--ui-reveal-scale":t.revealScale||null}),r.observe(e)}init(){this.#t.forEach(e=>e.disconnect()),this.#t.clear();let e=document.documentElement.style;e.setProperty(`--ui-reveal-global-duration`,this.#i(this.config.duration)),e.setProperty(`--ui-reveal-global-timing-function`,this.config.ease),e.setProperty(`--ui-reveal-global-wait`,this.#i(this.config.wait)),e.setProperty(`--ui-reveal-global-distance`,this.config.distance),e.setProperty(`--ui-reveal-global-grow`,this.config.grow.toString()),e.setProperty(`--ui-reveal-global-shrink`,this.config.shrink.toString()),e.setProperty(`--ui-reveal-global-stagger-step`,this.#i(this.config.step)),document.querySelectorAll(`[data-reveal]`).forEach(e=>{e instanceof HTMLElement&&this.#s(e)}),document.querySelectorAll(`[data-reveal-each]`).forEach(e=>{e instanceof HTMLElement&&this.#o(e)})}refresh(){this.init()}};if(typeof window<`u`&&typeof document<`u`){let e=null,t=()=>{e||=new d};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,t):t(),o(()=>d.getAutoInstance()?.refresh()),d.disableAutoInit=()=>{e=`disabled`},d.getAutoInstance=()=>e===`disabled`?null:e}typeof window<`u`&&(window.Reveal=d);function f(e,t){e.dispatchEvent(new Event(t,{bubbles:!0}))}function p(){if(typeof HTMLDialogElement>`u`||!(`closedBy`in HTMLDialogElement.prototype))return!1;let e=document.createElement(`dialog`);return e.setAttribute(`closedby`,`any`),e.closedBy===`any`}function m(e){let t=e.target;if(!(t instanceof HTMLDialogElement)||!t.open||t.getAttribute(`closedby`)!==`any`)return null;let{clientX:n,clientY:r}=e,i=t.getBoundingClientRect();return n<i.left||n>i.right||r<i.top||r>i.bottom?t:null}function h(){let e=null;document.addEventListener(`pointerdown`,t=>{e=m(t)},!0),document.addEventListener(`pointerup`,t=>{let n=m(t);n&&n===e&&(typeof n.requestClose==`function`?n.requestClose():n.close()),e=null},!0)}const g=function(){g._bound||(g._bound=!0,new MutationObserver(function(e){for(let t of e)t.type===`attributes`&&t.attributeName===`open`&&t.target instanceof HTMLDialogElement&&t.target.hasAttribute(`open`)&&f(t.target,`zazz:dialog-open`)}).observe(document.documentElement,{attributes:!0,attributeFilter:[`open`],subtree:!0}),document.addEventListener(`close`,function(e){e.target instanceof HTMLDialogElement&&f(e.target,`zazz:dialog-close`)},!0),p()||h())};typeof window<`u`&&typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,g):g());function _(){let e=[];return{add(t,n,r){e.push({time:t,x:n,y:r}),e=e.filter(e=>t-e.time<=100)},velocity(){let t=e[0],n=e.at(-1);if(!t||!n)return{x:0,y:0};let r=n.time-t.time;return r<=0?{x:0,y:0}:{x:(n.x-t.x)/r,y:(n.y-t.y)/r}}}}function ee(e,t,n=.55){if(t<=0||e===0)return 0;let r=Math.abs(e);return Math.sign(e)*(r*t*n)/(t+n*r)}function te(e){let{offset:t,velocity:n,distance:r,velocityThreshold:i}=e;return t<=0?!1:n>i||t>=r&&n>-i}function ne(e){let{stops:t,position:n,velocity:r,active:i,size:a,sequential:o=!1}=e,{closeRatio:s=.25,flick:c=.4,fling:l=2}=e,u=t.length-1;if(u<0)return-1;let d=Math.abs(r),f=r>0;if(!o&&d>l)return f?-1:u;let p=t[Math.min(Math.max(i,0),u)]??0;if(d>c&&Math.abs(n-p)<a*.4)return f?i-1:Math.min(u,i+1);let m=t[0]??0;if(n>m)return n-m>=(a-m)*s&&r>-c?-1:0;let h=0;for(let e=1;e<=u;e++)Math.abs((t[e]??0)-n)<Math.abs((t[h]??0)-n)&&(h=e);return h}function v(e,t,n){let r=Math.abs(t);return r===0||n<=0?Math.max(0,n):Math.min(n,Math.max(Math.min(120,n),Math.abs(e)/r))}function y(e){return getComputedStyle(e).transitionDuration.split(`,`).reduce((e,t)=>Math.max(e,Number.parseFloat(t)||0),0)*1e3}function re(e){let[t=0,n=0]=getComputedStyle(e).translate.split(/\s+/).map(e=>Number.parseFloat(e)||0);return{x:t,y:n}}function ie(){let e=e=>{e.preventDefault(),e.stopPropagation()};document.addEventListener(`click`,e,{capture:!0,once:!0}),window.setTimeout(()=>document.removeEventListener(`click`,e,{capture:!0}),50)}function ae(e,t){let{signal:n}=t;if(n.aborted)return;let r=null,i=(e,t)=>{let n=e.axis===`x`,r=e.tracker.velocity();return{axis:e.axis,offset:n?t.clientX-e.originX:t.clientY-e.originY,velocity:n?r.x:r.y,startX:e.startX,startY:e.startY,target:e.target,pointerType:e.pointerType,event:t}},a=()=>{document.removeEventListener(`pointermove`,s),document.removeEventListener(`pointerup`,c),document.removeEventListener(`pointercancel`,l),r=null},o=e=>{if(r||!e.isPrimary||e.pointerType===`mouse`&&e.button!==0)return;let n=e.target;if(!(n instanceof Element)||n.closest(`input, select, textarea, [contenteditable]:not([contenteditable="false"]), [data-ui-no-drag]`))return;let i=_();i.add(e.timeStamp,e.clientX,e.clientY),r={phase:`pending`,pointerId:e.pointerId,pointerType:e.pointerType,target:n,startX:e.clientX,startY:e.clientY,originX:e.clientX,originY:e.clientY,axis:t.axis===`x`?`x`:`y`,tracker:i,selection:document.getSelection()?.toString()??``},document.addEventListener(`pointermove`,s),document.addEventListener(`pointerup`,c),document.addEventListener(`pointercancel`,l)},s=n=>{let a=r;if(a&&n.pointerId===a.pointerId){if(a.tracker.add(n.timeStamp,n.clientX,n.clientY),a.phase===`pending`){let r=n.clientX-a.startX,o=n.clientY-a.startY,s=t.slop??(a.pointerType===`mouse`?6:0);if(r===0&&o===0||Math.hypot(r,o)<s)return;let c=Math.abs(r)>Math.abs(o)?`x`:`y`;a.axis=t.axis===`both`?c:t.axis;let l=document.getSelection()?.toString()??``,u=l.length>0&&l!==a.selection;if(c!==a.axis||u||t.canStart&&!t.canStart(i(a,n))){a.phase=`rejected`;return}a.phase=`dragging`,a.originX=n.clientX,a.originY=n.clientY;try{e.setPointerCapture(a.pointerId)}catch{}t.onStart?.(i(a,n))}else a.phase===`dragging`&&t.onMove(i(a,n))}},c=e=>{let n=r;n&&e.pointerId===n.pointerId&&(n.tracker.add(e.timeStamp,e.clientX,e.clientY),a(),n.phase===`dragging`&&(ie(),t.onEnd(i(n,e))))},l=e=>{let n=r;n&&e.pointerId===n.pointerId&&(a(),n.phase===`dragging`&&(t.onCancel??t.onEnd)(i(n,e)))};e.addEventListener(`pointerdown`,o,{signal:n}),e.addEventListener(`touchmove`,e=>{r?.phase===`dragging`&&e.cancelable&&e.preventDefault()},{passive:!1,signal:n}),n.addEventListener(`abort`,()=>{let e=r;if(!e||(a(),e.phase!==`dragging`))return;let n=new PointerEvent(`pointercancel`,{pointerId:e.pointerId,clientX:e.originX,clientY:e.originY});(t.onCancel??t.onEnd)(i(e,n))},{once:!0})}function b(e,t,n){let r=(e.getAttribute(`data-carousel-state`)??``).split(/\s+/).filter(Boolean);if(r.includes(t)===n)return;let i=n?[...r,t]:r.filter(e=>e!==t);i.length?e.setAttribute(`data-carousel-state`,i.join(` `)):e.removeAttribute(`data-carousel-state`)}function oe(e,t=.0025){return Math.sign(e)*e*e/(2*t)}function x(e,t){let n=0,r=1/0;return e.forEach((e,i)=>{let a=Math.abs(e.pos-t);a<r&&(r=a,n=i)}),n}function se(e,t,n=Math.floor(e/2)){return Array.from({length:e},(r,i)=>((i-t+n)%e+e)%e)}function ce(e,t){return Math.max(1,Math.floor((e-Math.max(1,t))/2))}function le(e,t,n){let r=Math.min(t.first,n.first),i=Math.max(t.last,n.last);if(r>=0&&i<=e-1)return 0;let a=i-r+1;return a>e?null:Math.floor((e-a)/2)-r}function ue(e,t,n,r,i=!1){let a=x(e,n);return a===t&&Math.abs(r)>.3&&(a=t+(r>0?-1:1)),i||(a=Math.min(t+1,Math.max(t-1,a))),Math.min(e.length-1,Math.max(0,a))}function de(e){let t=(e.getAttribute(`data-carousel-plugins`)??``).split(/[\s,]+/),r=t.includes(`auto-scroll`)?`auto-scroll`:t.includes(`autoplay`)?`autoplay`:null;if(!r)return null;let i=n.parseDataAttributes(e,r===`autoplay`?`data-carousel-autoplay-`:`data-carousel-auto-scroll-`),a=(e,t)=>typeof e==`number`&&e>=0?e:t;return{mode:r,delay:a(i.delay,4e3),speed:a(i.speed,2),startDelay:a(i.startDelay,1e3),backward:i.direction===`backward`,playOnInit:i.playOnInit!==!1,stopOnInteraction:i.stopOnInteraction!==!1,stopOnMouseEnter:i.stopOnMouseEnter===!0,stopOnLastSnap:i.stopOnLastSnap===!0}}function S(e,t,r,i={}){let a=t.querySelector(`[data-carousel-slot~="container"]`);if(!a)return null;let o=[...a.querySelectorAll(`:scope > [data-carousel-slot~="slide"]`)],{prefix:s=`data-carousel-`,defaults:c={},controls:l=!0}=i,u=n.parseDataAttributes(e,s),d=(e,t)=>typeof e==`boolean`?e:t,f={loop:d(u.loop,c.loop??!1)&&o.length>=3,draggable:d(u.draggable,!0),dragFree:d(u.dragFree,c.dragFree??!1),skipSnaps:d(u.skipSnaps,!1),startSnap:typeof u.startSnap==`number`?u.startSnap:0,vertical:u.axis===`y`},p=null,m=1,h={back:0,ahead:0},g=-1,_=null,te=null,ne=/* @__PURE__ */ new Set,v=o.map(()=>0),y=!1,re=!1,ie=null,S=!1,C=!1,w=window.matchMedia(`(prefers-reduced-motion: reduce)`),fe=e=>e||w.matches?`auto`:`smooth`,T=f.vertical,pe=!T&&getComputedStyle(t).direction===`rtl`,me=pe?-1:1,E=()=>T?t.scrollTop:t.scrollLeft*me,D=e=>{T?t.scrollTop=e:t.scrollLeft=e*me},he=(e,n)=>t.scrollTo(T?{top:e,behavior:n}:{left:e*me,behavior:n}),O=()=>T?t.clientHeight:t.clientWidth,k=()=>Math.max(0,(T?t.scrollHeight:t.scrollWidth)-O()),ge=e=>Math.min(k(),Math.max(0,e)),_e=(e,t)=>T?e.top-t.top:pe?t.right-e.right:e.left-t.left,ve=e=>T?e.height:e.width,ye=e=>T?e:e*me,A=e=>{y||re?D(e):(b(t,`jumping`,!0),D(e),b(t,`jumping`,!1))},be=e=>{y=e,b(t,`gliding`,e)},xe=()=>{let e=t.getBoundingClientRect(),n=getComputedStyle(t),r=Number.parseFloat(T?n.scrollPaddingBlockStart:n.scrollPaddingInlineStart)||0,i=Number.parseFloat(T?n.scrollPaddingBlockEnd:n.scrollPaddingInlineEnd)||0,a=k(),s=O(),c=E(),l=0,u=`start`,d=o.map((t,n)=>{let o=t.getBoundingClientRect(),d=ve(o);n===0&&(l=d);let f=_e(o,e)+c,p=getComputedStyle(t).scrollSnapAlign.split(` `),m=T?p[0]:p.at(-1);n===0&&(u=m??`start`);let h=m===`center`?f+d/2-s/2:m===`end`?f+d-s+i:f-r;return{index:n,pos:Math.round(Math.min(a,Math.max(0,h)))}});m=l>0?Math.max(1,Math.round(s/l)):1;let f=m-1,p=+(l*m<s-1);h=u===`center`?{back:Math.floor(m/2)+p,ahead:Math.floor(m/2)+p}:u===`end`?{back:f,ahead:0}:{back:0,ahead:f},d.sort((e,t)=>e.pos-t.pos);let g=[];for(let{index:e,pos:t}of d){let n=g.at(-1);n&&Math.abs(n.pos-t)<1?n.slides.push(e):g.push({pos:t,slides:[e]})}return g},j=()=>p??=xe(),Se=()=>{p=null},Ce=()=>(j(),m),M=e=>f.loop?j()[e]?.slides[0]??0:e,we=e=>Math.max(0,j().findIndex(t=>t.slides.includes(e))),N=[],Te=l?e.querySelector(`[data-carousel-slot~="dots"]`):null,Ee=Te?.querySelector(`[data-carousel-slot~="dot"]`)?.cloneNode(!0),De=()=>{if(!Te||!(Ee instanceof HTMLElement))return;let e=f.loop?o.length:j().length;if(e!==N.length&&(Te.replaceChildren(),N=[],!(e<=1))){for(let t=0;t<e;t++){let e=Ee.cloneNode(!0);e.addEventListener(`click`,()=>{Q.interact(),Q.goTo(t)},{signal:r}),N.push(e)}Te.append(...N)}},Oe=e=>{let t=M(e),n=new Set(j()[e]?.slides??[]);o.forEach((e,t)=>b(e,`snapped`,n.has(t))),N.forEach((e,n)=>b(e,`active`,n===t))},P=t=>{t!==g&&(g=t,Oe(t),e.dispatchEvent(new CustomEvent(`zazz:carousel-select`,{detail:{index:M(t)}})))},ke=()=>{if(!f.loop)return;let e=j()[g]?.slides[0]??0,t=v[e]??0;o.forEach((n,r)=>{n.inert=(v[r]<t?r>e:r<e)&&!ne.has(r)})},F=0,Ae=(e,n,r=!0)=>{if(e.every((e,t)=>e===v[t]))return;let i=o[n],a=t.getBoundingClientRect(),s=_e(i.getBoundingClientRect(),a),c=r?++F:F;r&&(re=!0,b(t,`settling`,!0)),o.forEach((t,n)=>{v[n]!==e[n]&&(t.style.order=String(e[n]))}),v=e;let l=_e(i.getBoundingClientRect(),a)-s;A(E()+l),Se(),r&&requestAnimationFrame(()=>requestAnimationFrame(()=>{if(c!==F)return;re=!1,b(t,`settling`,!1);let e=ie;ie=null,e?.()}))},I=(e,t=!0)=>Ae(se(o.length,e,ce(o.length,Ce())),e,t),je=()=>{let e=t.getBoundingClientRect(),n=O(),r=1/0,i=-1/0;return o.forEach((t,a)=>{let o=t.getBoundingClientRect(),s=_e(o,e);s+ve(o)<=1||s>=n-1||(r=Math.min(r,v[a]),i=Math.max(i,v[a]))}),{first:r,last:i}},L=0,Me=()=>{Pe.has(`pointer`)&&(Fe=!0),L||=requestAnimationFrame(()=>{L=0,_==null&&!S&&P(x(j(),E()))})},R=()=>{if(S||C||Y)return;let e=_==null?null:j()[_];if(e&&Math.abs(E()-e.pos)>1)return;_=null;let t=x(j(),E());y&&!f.dragFree&&Math.abs(E()-j()[t].pos)>1?z(t):(be(!1),P(t),f.loop&&(I(j()[g]?.slides[0]??0),g=x(j(),E()),ke()),Ve())};if(t.addEventListener(`scroll`,Me,{passive:!0,signal:r}),`onscrollend`in window)t.addEventListener(`scrollend`,R,{signal:r});else{let e=0;t.addEventListener(`scroll`,()=>{clearTimeout(e),e=window.setTimeout(R,120)},{passive:!0,signal:r}),r.addEventListener(`abort`,()=>clearTimeout(e),{once:!0})}let z=(e,t,n=null)=>{Je();let r=j(),i=Math.min(r.length-1,Math.max(0,e));if(re){_=i,te=n,P(i),ie=()=>z(e,t,n);return}let a=r[i]?.pos??0;Math.abs(E()-a)<1?R():(_=i,te=n,P(i),t?(A(a),R()):he(a,fe()))},Ne=e=>{let t=_??g;if(!f.loop){z(t+e);return}let n=o.length,r=(_==null?null:te)??M(t),i=(r+e+n)%n,a=v[r]+e,s=je(),c=le(n,s,{first:a-h.back,last:a+h.ahead});if(c!=null){if(c){let e=M(Math.max(0,g));_=null,Ae(v.map(e=>((e+c)%n+n)%n),Math.max(0,v.indexOf(s.first))),g=we(e),ke()}z(we(i),!1,i)}},B=l?de(e):null,V=!1,Pe=/* @__PURE__ */ new Set,Fe=!1,Ie=!0,Le=!1,H=0,U=0,Re=0,W=0,ze=()=>{H=0;let e=_??g;!f.loop&&e>=j().length-1?B?.stopOnLastSnap?(V=!1,q()):z(0):Ne(1)},Be=e=>{if(!B)return;U=requestAnimationFrame(Be);let t=Re?Math.min(50,e-Re):0;Re=e,W+=(B.backward?-B.speed:B.speed)*t/16.666666666666668;let n=Math.trunc(W);if(!n)return;W-=n;let r=E()+n;if(!f.loop&&(r<=0||r>=k())){D(ge(r)),V=!1,q();return}D(r);let i=x(j(),E());P(i),f.loop&&(I(j()[i]?.slides[0]??0,!1),g=x(j(),E()))},G=()=>{clearTimeout(H),cancelAnimationFrame(U),H=0,U=0,C&&(C=!1,R())},K=()=>{B&&(H=B.mode===`autoplay`?window.setTimeout(ze,B.delay):window.setTimeout(()=>{H=0,_=null,be(!0),C=!0,Re=0,W=0,U=requestAnimationFrame(Be)},B.startDelay))};function q(t=!1){let n=!!B&&V&&Pe.size===0&&Ie&&!document.hidden&&k()>0&&j().length>1;B&&b(e,`playing`,V),(n!==Le||t)&&(Le=n,G(),n&&K())}function Ve(){B&&(Pe.delete(`pointer`)?q():Le&&B.mode===`autoplay`&&(clearTimeout(H),H=window.setTimeout(ze,B.delay)))}let He=e=>{B&&V&&(B.stopOnInteraction?V=!1:Pe.add(e),e===`pointer`&&(Fe=!1,C&&(cancelAnimationFrame(U),U=0,C=!1,be(!1))),q())},Ue=e=>{Pe.delete(e)&&q()},We=t.closest(`[data-carousel-keyboard="false"]`)!==null,Ge=e=>{e instanceof KeyboardEvent&&e.key.startsWith(`Arrow`)&&!We||e instanceof MouseEvent&&e.button!==0||(He(`pointer`),_=null,Je()&&R())};for(let e of[`pointerdown`,`wheel`,`touchstart`,`keydown`])t.addEventListener(e,Ge,{passive:!0,signal:r});B&&(t.addEventListener(`pointerup`,()=>{Fe||Ue(`pointer`)},{signal:r}),t.addEventListener(`focusin`,e=>{e.target!==t&&He(`focus`)},{signal:r}),t.addEventListener(`focusout`,e=>{e.relatedTarget instanceof Node&&t.contains(e.relatedTarget)||Ue(`focus`)},{signal:r}),B.stopOnMouseEnter&&(e.addEventListener(`mouseenter`,()=>He(`hover`),{signal:r}),e.addEventListener(`mouseleave`,()=>Ue(`hover`),{signal:r})),document.addEventListener(`visibilitychange`,()=>q(),{signal:r}));let Ke=0,qe=0,J=e=>{S=e,b(t,`dragging`,e)},Y=0,Je=()=>Y?(cancelAnimationFrame(Y),Y=0,!0):!1,X=e=>{let t=E(),n=ge(t-oe(e)),r=n-t;if(w.matches||Math.abs(r)<1){R();return}let i=Math.min(.02,Math.abs(e)/Math.abs(r)),a=performance.now(),o=e=>{let t=r*Math.exp(-i*Math.max(0,e-a));Math.abs(t)<.5?(Y=0,D(n),R()):(D(n-t),Y=requestAnimationFrame(o))};Y=requestAnimationFrame(o)},Z=e=>{J(!1),a.style.translate&&E()>=k()-1&&a.addEventListener(`transitionend`,()=>{!S&&!Y&&_==null&&A(k())},{once:!0,signal:r}),a.style.translate=``;let t=E()-oe(e);f.dragFree?X(e):z(ue(j(),qe,t,e,f.skipSnaps))};f.draggable&&(ae(t,{axis:T?`y`:`x`,signal:r,canStart:({pointerType:e})=>e===`mouse`&&k()>0,onStart:()=>{_=null,Je(),Ke=E(),qe=x(j(),Ke),be(!0),J(!0)},onMove:({offset:e})=>{let t=Ke-ye(e),n=ge(t);A(n);let r=ee(n-t,O()/4);a.style.translate=r?T?`0 ${r}px`:`${r*me}px 0`:``},onEnd:({velocity:e})=>Z(ye(e)),onCancel:()=>Z(0)}),t.addEventListener(`dragstart`,e=>e.preventDefault(),{signal:r}));let Ye=new IntersectionObserver(e=>{ne=new Set(ne);for(let t of e){let e=o.indexOf(t.target);t.isIntersecting?ne.add(e):ne.delete(e),b(t.target,`in-view`,t.isIntersecting)}ke()},{root:t,rootMargin:T?`-1px 0px`:`0px -1px`});o.forEach(e=>Ye.observe(e));let Xe=B?new IntersectionObserver(([e])=>{Ie=e?.isIntersecting??!0,q()}):null;Xe?.observe(e);let Ze=new ResizeObserver(()=>{Se(),De(),_==null&&!S&&!C&&P(x(j(),E())),Oe(g),q()});Ze.observe(t),o.forEach(e=>Ze.observe(e));let Q={goTo(e,t){z(f.loop?we(e):e,t,f.loop?e:null)},goToNext:()=>Ne(1),goToPrev:()=>Ne(-1),selectedSnap:()=>M(Math.max(0,g)),snapList:()=>j().map(e=>e.pos),revealSlide(e,n){let r=o[e];if(!r)return;let i=E(),a=_e(r.getBoundingClientRect(),t.getBoundingClientRect())+i,s=a+ve(r.getBoundingClientRect()),c=ge(a<i?a:s>i+O()?s-O():i);Math.abs(c-i)<1||(n?A(c):he(c,fe()))},play(){V=!0,q()},stop(){V=!1,q()},isPlaying:()=>Le,interact(){B&&V&&(B.stopOnInteraction?(V=!1,q()):q(!0))},vertical:T,rtl:pe};if(l)for(let[t,n]of[[`prev`,-1],[`next`,1]])e.querySelector(`[data-carousel-slot~="${t}"]`)?.addEventListener(`click`,()=>{Q.interact(),Ne(n)},{signal:r});b(t,`free`,f.dragFree),De(),f.loop&&I(f.startSnap%o.length,!1);let Qe=f.loop?we(f.startSnap):f.startSnap;return A(j()[Qe]?.pos??0),P(x(j(),E())),ke(),B&&(V=B.playOnInit&&!(B.mode===`auto-scroll`&&w.matches),q()),r.addEventListener(`abort`,()=>{cancelAnimationFrame(L),cancelAnimationFrame(Y),clearTimeout(H),cancelAnimationFrame(U),Ye.disconnect(),Xe?.disconnect(),Ze.disconnect(),S&&J(!1);for(let e of[`gliding`,`settling`,`free`])b(t,e,!1);b(e,`playing`,!1),a.style.translate=``;for(let e of o)e.style.order=``,e.inert=!1,b(e,`in-view`,!1),b(e,`snapped`,!1);Ee&&Te?.replaceChildren(Ee),delete e._carousel},{once:!0}),e._carousel=Q,Q}function C(e,t,n,r){let i=n.querySelector(`[data-carousel-slot~="viewport"]`);if(!i)return null;let a=S(n,i,r,{prefix:`data-carousel-thumbs-`,defaults:{dragFree:!0},controls:!1});if(!a)return null;let o=[...i.querySelectorAll(`[data-carousel-slot~="container"] > [data-carousel-slot~="slide"]`)];o.forEach((t,n)=>t.addEventListener(`click`,()=>{e.interact(),e.goTo(n)},{signal:r}));let s=(e,t)=>{o.forEach((t,n)=>{b(t,`active`,n===e),n===e?t.setAttribute(`aria-current`,`true`):t.removeAttribute(`aria-current`)}),a.revealSlide(e,t)};return t.addEventListener(`zazz:carousel-select`,e=>s(e.detail.index),{signal:r}),s(e.selectedSnap(),!0),r.addEventListener(`abort`,()=>{for(let e of o)b(e,`active`,!1),e.removeAttribute(`aria-current`)},{once:!0}),a}const w=`:is(ui-carousel, [data-ui~="carousel"])`;function fe(e){if(e.hasAttribute(`data-carousel-init`)||e.closest(`dialog:not([open])`)||e.matches(`[data-carousel-slot~="thumbs"]`))return;let t=e.querySelector(`[data-carousel-slot~="thumbs"]`),n=e.querySelector(t?`[data-carousel-slot~="viewport"]:not([data-carousel-slot~="thumbs"] *)`:`[data-carousel-slot~="viewport"]`);if(!n)return;e.setAttribute(`data-carousel-init`,``),n.hasAttribute(`tabindex`)||n.setAttribute(`tabindex`,`0`);let r=new AbortController;e._carouselController=r;let i=S(e,n,r.signal);i&&t&&C(i,e,t,r.signal)}function T(e){for(let t of(e??document).querySelectorAll(w))t.closest(`ui-carousel`)||fe(t)}function pe(){document.addEventListener(`zazz:dialog-open`,e=>{if(!(e.target instanceof HTMLDialogElement))return;let t=e.target;T(t);for(let e of t.querySelectorAll(w)){let t=e.getAttribute(`data-carousel-start-index`);t!=null&&e._carousel&&(e._carousel.goTo(Number(t),!0),e.removeAttribute(`data-carousel-start-index`));let n=e.querySelector(`[data-carousel-slot~="viewport"]`);n instanceof HTMLElement&&n.focus({preventScroll:!0})}})}function me(){let e=e=>!!e?._carousel&&e.getAttribute(`data-carousel-keyboard`)!==`false`,t=document.querySelector(`dialog[open]`)?.querySelector(`${w}[data-carousel-init]`);if(e(t))return t;let n=document.activeElement?.closest(`${w}[data-carousel-init]`);return e(n)?n:null}function E(){document.addEventListener(`keydown`,e=>{if(!e.key.startsWith(`Arrow`)||e.defaultPrevented)return;let t=e.target;if(!(t instanceof HTMLElement)||t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t.isContentEditable)return;let n=me()?._carousel;if(!n)return;let[r,i]=n.vertical?[`ArrowUp`,`ArrowDown`]:n.rtl?[`ArrowRight`,`ArrowLeft`]:[`ArrowLeft`,`ArrowRight`];(e.key===r||e.key===i)&&(e.preventDefault(),n.interact(),e.key===r?n.goToPrev():n.goToNext())})}function D(){document.addEventListener(`click`,e=>{if(!(e.target instanceof HTMLElement))return;let t=e.target.closest(`[data-carousel-start], [data-carousel-slot~='slide'][commandfor]`);if(!t)return;let n=t.getAttribute(`data-carousel-start`);if(n==null){let e=t.closest(w)?._carousel;e&&(n=String(e.selectedSnap()))}let r=t.getAttribute(`commandfor`),i=r?document.getElementById(r)?.querySelector(w):null;i&&n!=null&&(i._carousel?i._carousel.goTo(Number(n),!0):i.setAttribute(`data-carousel-start-index`,n))})}const he={init:T,initRoot:fe};if(typeof window<`u`&&typeof document<`u`){o(e=>T(e));let e=()=>{T(),pe(),D(),E()};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,e):e(),window.Carousel=he}const O=.1,k=.999,ge=/[\\/_+.#"@[({&]/,_e=/[\\/_+.#"@[({&]/g,ve=/[\s-]/,ye=/[\s-]/g;function A(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?1:.99;let s=`${i},${a}`,c=o[s];if(c!==void 0)return c;let l=r.charAt(a),u=n.indexOf(l,i),d=0;for(;u>=0;){let s=A(e,t,n,r,u+1,a+1,o);if(s>d){if(u===i)s*=1;else if(ge.test(e.charAt(u-1))){s*=.8;let t=e.slice(i,u-1).match(_e);t&&i>0&&(s*=k**t.length)}else if(ve.test(e.charAt(u-1))){s*=.9;let t=e.slice(i,u-1).match(ye);t&&i>0&&(s*=k**t.length)}else s*=.17,i>0&&(s*=k**(u-i));e.charAt(u)!==t.charAt(a)&&(s*=.9999)}if(s<O&&n.charAt(u-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(u-1)!==r.charAt(a)){let i=A(e,t,n,r,u+1,a+2,o);i*O>s&&(s=i*O)}s>d&&(d=s),u=n.indexOf(l,u+1)}return o[s]=d,d}function be(e){return e.toLowerCase().replace(ye,` `)}function xe(e,t,n=[]){let r=n.length>0?`${e} ${n.join(` `)}`:e;return A(r,t,be(r),be(t),0,0,{})}Symbol.dispose??=Symbol(`Symbol.dispose`);function j(t,n){return new e.State(t,n)}function Se(t,n){return new e.Computed(t,n)}let Ce=!0;const M=new e.subtle.Watcher(()=>{Ce&&(Ce=!1,queueMicrotask(we))});function we(){Ce=!0;for(let e of M.getPending())e.get();M.watch()}function N(t,n={}){let r,i=!1,a=new e.Computed(()=>{typeof r==`function`&&r(),r=t()});M.watch(a),a.get();let o=()=>{i||(i=!0,M.unwatch(a),typeof r==`function`&&r(),r=void 0)};return n.signal?.addEventListener(`abort`,o,{once:!0}),Object.assign(o,{[Symbol.dispose]:o})}typeof window<`u`&&(window.Signals={state:j,computed:Se,effect:N});function Te(e,t){let n=e.trim();return t.map((e,t)=>{let r=n===``?1:xe(e.value,n,e.keywords);return{index:t,score:r,hidden:r<=0}})}function Ee(e,t,n){if(n===0)return-1;switch(t){case`ArrowDown`:return e<0?0:(e+1)%n;case`ArrowUp`:return e<0?n-1:(e-1+n)%n;case`Home`:return 0;case`End`:return n-1;default:return e}}let De=0;var Oe=class extends r{partSelector(e){return`[data-${this.slotPrefix}-slot~="${e}"]`}config(e){return this.getAttribute(`data-${this.slotPrefix}-${e}`)}managesPanel=!0;openOnFocus=!0;get sortByScore(){return this.config(`sort`)===`score`}autoHighlight=!1;get filtersItems(){return this.config(`filter`)!==`none`}get ordersByScore(){return this.sortByScore&&this.filtersItems}searchInput=null;panel=null;query=j(``);open=j(!1);activeIndex=j(-1);itemsVersion=j(0);setup(e){let t=this.slotPrefix,n=this.querySelector(this.partSelector(`panel`)),r=this.querySelector(`input[role="combobox"]`)??this.querySelector(this.partSelector(`input`));if(!(n instanceof HTMLElement)||!(r instanceof HTMLInputElement))return;this.panel=n,this.searchInput=r;let i=n.querySelector(this.partSelector(`list`));i instanceof HTMLElement&&(i.id||=`ui-${t}-list-${++De}`,r.setAttribute(`aria-controls`,i.id));let a=this.partSelector(`item`),o=e=>e instanceof Element&&(e.matches(a)||e.querySelector(a)!==null),s=new MutationObserver(e=>{e.some(e=>[...e.addedNodes,...e.removedNodes].some(o))&&(this.itemsVersion.set(this.itemsVersion.get()+1),this.autoHighlight&&this.activeIndex.set(0))});s.observe(i??n,{childList:!0,subtree:!0}),e.addEventListener(`abort`,()=>s.disconnect(),{once:!0}),r.addEventListener(`input`,()=>{this.query.set(r.value),this.activeIndex.set(this.autoHighlight?0:-1),this.managesPanel&&!this.#n()&&this.open.set(r.value.length>=this.#t())},{signal:e}),r.addEventListener(`keydown`,e=>this.#i(e),{signal:e}),this.#n()?(this.open.set(!0),r.setAttribute(`aria-expanded`,`true`)):this.managesPanel?(this.openOnFocus&&r.addEventListener(`focus`,()=>{r.value.length>=this.#t()&&this.open.set(!0)},{signal:e}),document.addEventListener(`pointerdown`,e=>{e.target instanceof Node&&(this.contains(e.target)||this.open.set(!1))},{signal:e}),this.addEventListener(`focusout`,e=>{let t=e.relatedTarget;t instanceof Node&&this.contains(t)||this.open.set(!1)},{signal:e})):n instanceof HTMLDialogElement?(this.addEventListener(`zazz:dialog-open`,e=>{e.target===n&&(this.open.set(!0),r.focus())},{signal:e}),this.addEventListener(`zazz:dialog-close`,e=>{e.target===n&&this.open.set(!1)},{signal:e})):n.addEventListener(`toggle`,e=>{let t=e.newState===`open`;this.open.set(t),t&&r.focus()},{signal:e}),n.addEventListener(`mousedown`,e=>{e.target instanceof Element&&(e.target.closest(`input, textarea, select, [contenteditable]`)||e.target.closest(this.partSelector(`list`))&&e.preventDefault())},{signal:e}),n.addEventListener(`click`,e=>{if(!(e.target instanceof Element))return;let t=e.target.closest(this.partSelector(`item`));t&&!t.hidden&&this.commit(t,`pointer`)},{signal:e}),this.#n()||(this.managesPanel?N(()=>{let e=this.open.get();r.setAttribute(`aria-expanded`,String(e)),e&&!this.#r()?n.showPopover():!e&&this.#r()&&n.hidePopover(),e||this.activeIndex.set(-1)},{signal:e}):N(()=>{r.setAttribute(`aria-expanded`,String(this.open.get()))},{signal:e})),N(()=>{let e=this.open.get(),n=this.query.get(),i=this.activeIndex.get();if(!e&&this.managesPanel&&!this.#n()){r.removeAttribute(`aria-activedescendant`);return}let{items:a,ranked:o,visible:s}=this.#e(n),c=this.ordersByScore;for(let e of o){let t=a[e.index];t.hidden=e.hidden,c?t.style.order=String(-Math.round(e.score*1e3)):t.style.order&&t.style.removeProperty(`order`)}s.forEach((e,n)=>{e.id||=`ui-${t}-item-${++De}`,n===i?e.setAttribute(`data-${this.slotPrefix}-state`,`highlighted`):e.removeAttribute(`data-${this.slotPrefix}-state`)});let l=i>=0?s[i]:void 0;l?(r.setAttribute(`aria-activedescendant`,l.id),l.scrollIntoView({block:`nearest`})):r.removeAttribute(`aria-activedescendant`)},{signal:e})}items(){let e=this.panel;return e?Array.from(e.querySelectorAll(this.partSelector(`item`))).filter(e=>e instanceof HTMLElement):[]}visibleItems(e,t){let n=t.filter(e=>!e.hidden);return this.ordersByScore&&n.sort((e,t)=>t.score-e.score||e.index-t.index),n.map(t=>e[t.index])}#e(e){this.itemsVersion.get();let t=this.items(),n=Te(this.filtersItems?e:``,t.map(e=>({value:this.itemValue(e),keywords:(e.getAttribute(`data-${this.slotPrefix}-keywords`)??``).split(/\s+/).filter(Boolean)})));return{items:t,ranked:n,visible:this.visibleItems(t,n)}}itemValue(e){let t=e.getAttribute(`data-${this.slotPrefix}-value`);if(t!==null)return t;if(!e.querySelector(`kbd, ui-kbd-group`))return e.textContent?.trim()??``;let n=e.cloneNode(!0);for(let e of n.querySelectorAll(`kbd, ui-kbd-group`))e.remove();return n.textContent?.trim()??``}clearQuery(){let e=this.searchInput;e&&(e.value=``,this.query.set(``))}#t(){let e=Number(this.config(`min-length`));return Number.isFinite(e)&&e>0?e:0}#n(){return this.managesPanel&&this.panel!==null&&!this.panel.hasAttribute(`popover`)}#r(){return this.panel?.matches(`:popover-open`)??!1}#i(e){let t=this.searchInput;if(t){if(e.key===`Escape`&&this.managesPanel)this.open.get()&&!this.#n()?(e.preventDefault(),this.open.set(!1)):t.value&&(e.preventDefault(),this.clearQuery());else if([`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)){if((e.key===`Home`||e.key===`End`)&&this.activeIndex.get()<0)return;e.preventDefault(),this.managesPanel&&!this.open.get()&&this.open.set(!0);let t=this.#e(this.query.get()).visible.length;this.activeIndex.set(Ee(this.activeIndex.get(),e.key,t))}else if(e.key===`Enter`){let t=this.activeIndex.get(),n=t>=0?this.#e(this.query.get()).visible[t]:void 0;n&&(e.preventDefault(),this.commit(n,`keyboard`))}}}};i(`ui-autocomplete`,class extends Oe{slotPrefix=`autocomplete`;commit(e,t){let n=this.searchInput;n&&(n.value=this.itemValue(e),this.query.set(n.value),this.open.set(!1),n.focus(),n.dispatchEvent(new Event(`change`,{bubbles:!0})))}});const P=`data-checkbox-controls`;function ke(e){let t=e.filter(Boolean).length;return t===0?`none`:t===e.length?`all`:`some`}function F(e){let t=e.getAttribute(P);if(!t)return[];let n=(e.form??e.ownerDocument).querySelectorAll(`input[type="checkbox"]`);return Array.from(n).filter(n=>n.name===t&&n!==e)}function Ae(e){if(!e.name)return null;let t=(e.form??e.ownerDocument).querySelectorAll(`input[type="checkbox"][${P}]`);for(let n of t)if(n.getAttribute(P)===e.name&&n!==e)return n;return null}const I=/* @__PURE__ */ new Map;function je(e){I.get(e)?.members.set(F(e).map(e=>e.checked))}function L(e){let t=j(F(e).map(e=>e.checked)),n=Se(()=>ke(t.get())),r=N(()=>{let r=n.get(),i=t.get();e.checked=r===`all`,e.indeterminate=r===`some`,F(e).forEach((e,t)=>{let n=e.closest(`tr`);n&&(i[t]?n.setAttribute(`data-table-state`,`selected`):n.getAttribute(`data-table-state`)===`selected`&&n.removeAttribute(`data-table-state`))})});I.set(e,{members:t,dispose:r})}function Me(e){let t=e.target;if(!(t instanceof HTMLInputElement)||t.type!==`checkbox`)return;if(t.hasAttribute(P)){I.has(t)||L(t);for(let e of F(t))e.checked=t.checked;je(t);return}let n=Ae(t);n&&(I.has(n)||L(n),je(n))}function R(e=document){for(let[e,t]of I)e.isConnected||(t.dispose(),I.delete(e));let t=e.querySelectorAll(`input[type="checkbox"][${P}]`);for(let e of t)I.has(e)?je(e):L(e)}typeof window<`u`&&typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>R()):R(),document.addEventListener(`change`,Me),o(R));let z=null;function Ne(){return z||(z=document.createElement(`template`),z.innerHTML=`<span data-ui="badge" data-combobox-slot="tag"><span data-combobox-slot="tag-label"></span><button type="button" tabindex="-1" data-combobox-slot="tag-remove"></button></span>`),z}function B(e,t,n){return n?{value:``,clear:!1}:e===``?{value:``,clear:!0}:{value:t,clear:!1}}function V(e,t){return e.replace(`{label}`,t)}i(`ui-combobox`,class extends Oe{slotPrefix=`combobox`;openOnFocus=!1;#e=``;#t=``;#n=[];#r=``;setup(e){super.setup(e);let t=this.searchInput;if(!t)return;let n=this.#i();this.#t=t.getAttribute(`placeholder`)??``,n&&this.querySelector(`[data-combobox-slot~="list"]`)?.setAttribute(`aria-multiselectable`,`true`);let r=this.#u();if(r!==null&&r.value!==``&&this.#o().length===0&&this.items().find(e=>this.#c(e)===r.value)?.setAttribute(`aria-selected`,`true`),n)for(let e of this.items())e.getAttribute(`aria-selected`)!==`true`&&e.setAttribute(`aria-selected`,`false`);this.#n=this.#o().map(e=>this.#c(e)),this.#e=n?``:this.#s()??``,t.value=this.#e,this.#d(!1);let i=t.closest(`[data-combobox-slot~="control"]`);t.addEventListener(`click`,()=>this.#a(),{signal:e}),i?.addEventListener(`mousedown`,e=>{e.target instanceof Element&&e.target!==t&&(e.preventDefault(),t.focus(),e.target.closest(`[data-combobox-slot~="trigger"], [data-combobox-slot~="tag"]`)||this.#a())},{signal:e}),i?.addEventListener(`click`,e=>{if(!(e.target instanceof Element))return;let n=e.target.closest(`[data-combobox-slot~="tag-remove"]`);if(!n)return;e.preventDefault();let r=n.closest(`[data-combobox-slot~="tag"]`)?.getAttribute(`data-combobox-value`);this.#l(this.items().find(e=>this.#c(e)===r)),t.focus()},{signal:e});let a=this.querySelector(`[data-combobox-slot~="trigger"]`);a instanceof HTMLElement&&a.addEventListener(`click`,()=>{this.open.get()?this.open.set(!1):this.#a()},{signal:e}),n&&t.addEventListener(`keydown`,e=>{if(e.key!==`Backspace`||t.value!==``)return;let n=this.#o().at(-1);n&&(e.preventDefault(),this.#l(n))},{signal:e}),this.addEventListener(`focusout`,e=>{let n=e.relatedTarget;if(n instanceof Node&&this.contains(n))return;let r=B(t.value,this.#e,this.#i());t.value=r.value,this.query.set(``),r.clear&&this.#m()},{signal:e}),(r??t).form?.addEventListener(`reset`,()=>queueMicrotask(()=>this.#h()),{signal:e})}teardown(){for(let e of this.querySelectorAll(`[data-combobox-slot~="tag"], [data-combobox-state~="stamped"]`))e.remove();this.searchInput&&(this.searchInput.placeholder=this.#t)}itemValue(e){return e.textContent?.trim()??``}clearQuery(){let e=this.searchInput;e&&(e.value=this.#i()?``:this.#e,this.query.set(``))}commit(e,t){let n=this.searchInput;if(n){if(this.#i())e.setAttribute(`aria-selected`,String(e.getAttribute(`aria-selected`)!==`true`)),n.value=``,this.query.set(``),this.activeIndex.set(this.items().indexOf(e)),this.#d(!0),n.focus();else{this.#e=this.itemValue(e),n.value=this.#e,this.query.set(``);for(let e of this.items())e.removeAttribute(`aria-selected`);e.setAttribute(`aria-selected`,`true`),this.#d(!0),n.focus(),this.panel?.hasAttribute(`popover`)?this.open.set(!1):n.select()}}}#i(){return this.config(`variant`)===`multiselect`}#a(){let e=this.searchInput;if(e&&!this.open.get()){if(this.#i())e.value=``,this.activeIndex.set(-1);else{e.value=this.#e;let t=this.#o()[0];this.activeIndex.set(t?this.items().indexOf(t):-1),e.value!==``&&e.select()}this.query.set(``),this.open.set(!0)}}#o(){return this.items().filter(e=>e.getAttribute(`aria-selected`)===`true`)}#s(){let e=this.#o()[0];return e?this.itemValue(e):void 0}#c(e){return e.getAttribute(`data-combobox-value`)??this.itemValue(e)}#l(e){e&&(e.setAttribute(`aria-selected`,`false`),this.#d(!0))}#u(){let e=this.querySelector(`[data-combobox-slot~="value"]:not([data-combobox-state~="stamped"])`);return e instanceof HTMLInputElement?e:null}#d(e){let t=this.searchInput,n=this.#o().map(e=>this.#c(e)),r=JSON.stringify(n),i=r!==this.#r;this.#r=r,t&&this.#i()&&this.#p(t);let a=this.#u();if(!a)return;a.value=n[0]??``;for(let e of this.querySelectorAll(`[data-combobox-state~="stamped"]`))e.remove();let o=a;for(let e of n.slice(1)){let t=document.createElement(`input`);t.type=`hidden`,t.setAttribute(`data-combobox-slot`,`value`),t.setAttribute(`data-combobox-state`,`stamped`),a.name&&(t.name=a.name),t.value=e,o.after(t),o=t}e&&i&&a.dispatchEvent(new Event(`change`,{bubbles:!0}))}#f(){let e=this.querySelector(`[data-combobox-slot~="tag-template"]`),t=(e instanceof HTMLTemplateElement?e:Ne()).content.firstElementChild;return t instanceof HTMLElement?t:null}#p(e){let t=e.closest(`[data-combobox-slot~="control"]`);if(!t)return;for(let e of t.querySelectorAll(`[data-combobox-slot~="tag"]`))e.remove();let n=this.#f();if(!n)return;let r=this.config(`label-remove`)??`Remove {label}`,i=this.#o().map(e=>{let t=this.itemValue(e),i=n.cloneNode(!0);if(i.setAttribute(`data-combobox-value`,this.#c(e)),!i.matches(`[data-combobox-slot~="tag"]`)){let e=i.getAttribute(`data-combobox-slot`);i.setAttribute(`data-combobox-slot`,e?`${e} tag`:`tag`)}let a=i.querySelector(`[data-combobox-slot~="tag-label"]`);return a?a.textContent=t:i.prepend(document.createTextNode(t)),i.querySelector(`[data-combobox-slot~="tag-remove"]`)?.setAttribute(`aria-label`,V(r,t)),i});e.before(...i),e.placeholder=i.length>0?``:this.#t}#m(e=!0){this.#e=``;let t=this.#i();for(let e of this.items())t?e.setAttribute(`aria-selected`,`false`):e.removeAttribute(`aria-selected`);this.searchInput&&(this.searchInput.value=``),this.query.set(``),this.#d(e)}get value(){let e=this.#o()[0];return e?this.#c(e):``}set value(e){let t=this.items().find(t=>this.#c(t)===e);if(!t){this.#m(!1);return}let n=this.#i();for(let e of this.items())n?e.setAttribute(`aria-selected`,`false`):e.removeAttribute(`aria-selected`);t.setAttribute(`aria-selected`,`true`),this.#e=n?``:this.itemValue(t);let r=this.searchInput;r&&(r.value=this.#e),this.query.set(``),this.#d(!1)}#h(){let e=this.searchInput;if(!e)return;let t=this.#i();for(let e of this.items()){let n=this.#n.includes(this.#c(e));t?e.setAttribute(`aria-selected`,String(n)):n?e.setAttribute(`aria-selected`,`true`):e.removeAttribute(`aria-selected`)}this.#e=t?``:this.#s()??``,e.value=this.#e,this.query.set(``),this.#d(!0)}});function Pe(e){let t=e.split(`+`).map(e=>e.trim().toLowerCase()).filter(e=>e.length>0);if(t.length===0)return null;let n={key:``,ctrl:!1,alt:!1,shift:!1,meta:!1,mod:!1};for(let e of t.slice(0,-1))switch(e){case`mod`:n.mod=!0;break;case`ctrl`:case`control`:n.ctrl=!0;break;case`alt`:case`option`:n.alt=!0;break;case`shift`:n.shift=!0;break;case`meta`:case`cmd`:case`super`:n.meta=!0;break;default:return null}return n.key=t[t.length-1],n}function Fe(){return typeof navigator>`u`?!1:/mac|iphone|ipad|ipod/i.test(navigator.platform||navigator.userAgent)}function Ie(e,t,n=Fe()){let r=t.meta||t.mod&&n,i=t.ctrl||t.mod&&!n;return e.metaKey!==r||e.ctrlKey!==i||e.altKey!==t.alt||e.shiftKey!==t.shift?!1:e.key.toLowerCase()===t.key}function Le(e){return e instanceof HTMLElement?e.isContentEditable?!0:e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement:!1}function H(e){return!e.ctrl&&!e.alt&&!e.meta&&!e.mod}function U(e,t,n={}){let r=Pe(e);return!r||typeof document>`u`?!1:(document.addEventListener(`keydown`,e=>{e.defaultPrevented||e.repeat||H(r)&&Le(e.target)||Ie(e,r)&&(e.preventDefault(),t(e))},{signal:n.signal}),!0)}i(`ui-command`,class extends Oe{slotPrefix=`command`;managesPanel=!1;autoHighlight=!0;get sortByScore(){return this.config(`sort`)!==`document`}setup(e){super.setup(e);let t=this.searchInput,n=this.panel;if(!t||!n)return;let r=this.getAttribute(`data-command-hotkey`);r&&U(r,()=>this.#n(),{signal:e});for(let t of this.items()){let n=t.getAttribute(`data-command-hotkey`);n&&U(n,()=>this.#t(t,!0),{signal:e})}let i=()=>{t.value=``,this.query.set(``),this.activeIndex.set(0)};n instanceof HTMLDialogElement?this.addEventListener(`zazz:dialog-close`,e=>{e.target===n&&i()},{signal:e}):n.addEventListener(`toggle`,e=>{e.newState===`closed`&&i()},{signal:e})}commit(e,t){this.#e||this.#t(e,t===`keyboard`)}#e=!1;#t(e,t){if(this.dispatchEvent(new CustomEvent(`zazz:command-select`,{bubbles:!0,detail:{item:e,value:this.itemValue(e)}})),t){this.#e=!0;try{e.click()}finally{this.#e=!1}}e.hasAttribute(`data-command-stay-open`)||this.#r()}#n(){let e=this.panel;e&&(e instanceof HTMLDialogElement?e.open?e.close():e.showModal():e.togglePopover())}#r(){let e=this.panel;e&&(e instanceof HTMLDialogElement?e.open&&e.close():e.matches(`:popover-open`)&&e.hidePopover())}});var Re=class extends r{setup(e){let t=this.closest(`dialog`);t&&!t.open?t.addEventListener(`zazz:dialog-open`,()=>this.init(),{signal:e}):this.init()}teardown(){this._carouselController?.abort(),delete this._carouselController,this.removeAttribute(`data-carousel-init`)}init(){he.initRoot(this)}get api(){return this._carousel??null}};i(`ui-carousel`,Re);const W=1e3,ze=`dialog[data-ui~="drawer"]`,Be=`[data-drawer-slot~="handle"]`,G=`data-drawer-indent-state`;function K(e,t,n,r){let i=new Set((e.getAttribute(t)??``).split(/\s+/).filter(Boolean));i.has(n)!==r&&(r?i.add(n):i.delete(n),i.size?e.setAttribute(t,[...i].join(` `)):e.removeAttribute(t))}function q(e,t,n){K(e,`data-drawer-state`,t,n)}function Ve(e,t){q(e,`dragging`,t)}function He(e){Ve(e,!1),e.style.removeProperty(`translate`),e.style.removeProperty(`--_drawer-backdrop`)}function Ue(e,t){let n=e.getAttribute(`data-drawer-snap`)?.trim();if(!n)return[0];let r=Number.parseFloat(getComputedStyle(document.documentElement).fontSize)||16,i=/* @__PURE__ */ new Set;for(let e of n.split(/\s+/)){let n=Number.parseFloat(e);if(!Number.isFinite(n)||n<=0)continue;let a=n*t;e.endsWith(`rem`)?a=n*r:(e.endsWith(`px`)||n>1)&&(a=n),i.add(Math.round(t-Math.min(t,Math.max(1,a))))}return i.size?[...i].sort((e,t)=>t-e):[0]}function We(e){try{let t=e.animate([{opacity:1},{opacity:0}],{pseudoElement:`::backdrop`,duration:W,fill:`both`});return t.pause(),t}catch{return null}}function Ge(e){return getComputedStyle(e).getPropertyValue(`--_drawer-mode`).trim()===`1`}function Ke(e){if(e.scrollHeight<=e.clientHeight)return!1;let t=getComputedStyle(e).overflowY;return t===`auto`||t===`scroll`}function qe(e,t,n,r){if(!Ge(e))return!1;let i=e.getBoundingClientRect();if(t.startY<i.top||t.startX<i.left||t.startX>i.right)return!1;if(t.target.closest(Be)||r)return!0;let a=t.offset>0;for(let n=t.target;n&&e.contains(n);n=n.parentElement)if(Ke(n)&&(n.scrollTop>0||!a))return!1;return performance.now()-n>=100}const J=[];function Y(){for(let e=J.length-1;e>=0;e--){let t=J[e];t.isConnected&&t.open||(J.splice(e,1),at(t))}J.forEach((e,t)=>{let n=J.length-1-t;q(e,`following`,!1),q(e,`stacked`,n>0),q(e,`nested`,t>0),n>0?e.style.setProperty(`--_drawer-depth`,String(n)):e.style.removeProperty(`--_drawer-depth`)}),Xe(J.length>0)}function Je(e,t,n){let r=J.indexOf(e);for(let e=0;e<r;e++){let i=J[e];i.style.setProperty(`--_drawer-depth`,String(r-e-t)),q(i,`following`,n)}}let X=null,Z=null;function Ye(e){let t=e.getBoundingClientRect(),n=e.offsetWidth||1,r=Number.parseFloat(getComputedStyle(e).getPropertyValue(`--_drawer-indent-inset`))||0,i=Math.max(0,-t.top),a=Math.max(0,e.offsetHeight-i-window.innerHeight);e.style.setProperty(`--_drawer-indent-scale`,String(Math.max(0,1-r*2/n))),e.style.setProperty(`--_drawer-indent-top`,`${i}px`),e.style.setProperty(`--_drawer-indent-bottom`,`${a}px`)}function Xe(e){X&&!X.isConnected&&(Z?.(),X=null);let t=X??document.querySelector(`ui-drawer-indent, [data-ui~="drawer-indent"]`);if(!t)return;if(e){Z?.(),X!==t&&(Ye(t),X=t),K(t,G,`on`,!0),K(t,G,`active`,!0);return}if(!X||Z)return;K(t,G,`dragging`,!1),t.style.removeProperty(`--_drawer-indent-amount`),K(t,G,`active`,!1);let n=()=>{Z?.(),t.removeAttribute(G);for(let e of[`scale`,`top`,`bottom`])t.style.removeProperty(`--_drawer-indent-${e}`);X=null},r=y(t);if(r<=0){n();return}let i=e=>{e.target===t&&e.propertyName===`scale`&&n()},a=window.setTimeout(n,r+100);t.addEventListener(`transitionend`,i),Z=()=>{window.clearTimeout(a),t.removeEventListener(`transitionend`,i),Z=null}}function Ze(e,t){X&&(K(X,G,`dragging`,t),t?X.style.setProperty(`--_drawer-indent-amount`,String(1-e)):X.style.removeProperty(`--_drawer-indent-amount`))}const Q=`--_drawer-keyboard`,Qe=/^(?:button|checkbox|color|file|hidden|image|radio|range|reset|submit|date|datetime-local|month|time|week)$/;function $e(e){return e instanceof HTMLTextAreaElement?!e.readOnly:e instanceof HTMLInputElement?!e.readOnly&&!Qe.test(e.type):e instanceof HTMLElement&&e.isContentEditable}function et(){let e=window.visualViewport;if(!e||Math.abs(e.scale-1)>.01)return 0;let t=Math.max(0,e.offsetTop)+e.height;return Math.max(0,Math.round(window.innerHeight-Math.min(window.innerHeight,t)))}function tt(e,t,n,r){let i=window.visualViewport;if(!i)return;let a=()=>n()&&J[J.length-1]===e,o=window.scrollX,s=window.scrollY,c=0,l=0,u=()=>{c=0;let t=a()?et():0;t!==l&&(l=t,t>0?e.style.setProperty(Q,`${t}px`):e.style.removeProperty(Q),r())},d=()=>{c||=requestAnimationFrame(u)},f=t=>{if(!e.contains(t)||document.activeElement!==t)return;let n=t.parentElement;for(;n&&e.contains(n)&&!Ke(n);)n=n.parentElement;if(!n||!e.contains(n))return;let r=n.getBoundingClientRect(),a=t.getBoundingClientRect(),o=Math.min(r.bottom,i.offsetTop+i.height)-16,s=Math.max(r.top,i.offsetTop)+16,c=0;if(a.bottom>o&&(c=a.bottom-o),a.top-c<s&&(c=a.top-s),Math.abs(c)<1)return;let l=matchMedia(`(prefers-reduced-motion: reduce)`).matches;n.scrollBy({top:c,behavior:l?`instant`:`smooth`})};i.addEventListener(`resize`,d,{signal:t}),i.addEventListener(`scroll`,d,{signal:t}),window.addEventListener(`scroll`,()=>{!a()||window.scrollX===o&&window.scrollY===s||window.scrollTo({left:o,top:s,behavior:`instant`})},{passive:!0,signal:t}),e.addEventListener(`focusin`,e=>{let n=e.target;if(n instanceof Element&&$e(n)&&a())for(let e of[100,350]){let r=window.setTimeout(()=>{u(),f(n)},e);t.addEventListener(`abort`,()=>window.clearTimeout(r),{once:!0})}},{signal:t}),t.addEventListener(`abort`,()=>{cancelAnimationFrame(c),e.style.removeProperty(Q)}),u()}const nt=/* @__PURE__ */ new WeakMap,rt=/* @__PURE__ */ new WeakMap;function it(e){if(nt.has(e))return;let t=new AbortController,{signal:n}=t;rt.get(e)?.cancel(),rt.delete(e),He(e);let r=e.hasAttribute(`data-drawer-snap`),i=0,a=0,o=1,s=0,c=[0],l=0,u=null,d=null,f=()=>{s=Math.max(0,-Number.parseFloat(getComputedStyle(e).marginBlockEnd)||0),o=Math.max(1,e.offsetHeight-s),c=r?Ue(e,o):[0],l=Math.min(l,c.length-1)},p=()=>{if(!r)return;let t=l===c.length-1;e.style.setProperty(`--_drawer-snap`,`${c[l]??0}px`),q(e,`expanded`,t),q(e,`partial`,!t)},m=(t,n)=>{Je(e,t,n),J.length===1&&J[0]===e&&Ze(t,n)},h=(t,n)=>{e.style.removeProperty(`--_drawer-backdrop`);let r=u;if(!r)return;let i=()=>{t||u!==r||r.playState!==`finished`||(r.cancel(),rt.delete(e),u=null)},a=Number(r.currentTime)||0,o=t?W-a:a;n<=0||o<=0?(r.playbackRate=t?1:-1,r.finish(),i()):(r.playbackRate=(t?1:-1)*o/n,r.play(),r.finished.then(i,()=>{}))},g=t=>{let n=Math.min(Math.max(t,0),c.length-1),r=n!==l;l=n,p(),Ve(e,!1),h(!1,y(e)),e.style.removeProperty(`translate`),m(0,!1),r&&e.dispatchEvent(new CustomEvent(`zazz:drawer-snap`,{bubbles:!0,detail:{index:l,value:o-(c[l]??0)}}))},_=()=>g(l),te=()=>{e.open&&(typeof e.requestClose==`function`?e.requestClose():e.close(),e.open&&(J.length===1&&Xe(!0),_()))},v=t=>{if(e.style.translate=`0 ${o+s}px`,h(!0,t),Je(e,1,!1),J.length===1&&J[0]===e&&Xe(!1),t<=0){te();return}let n=t=>{t.target===e&&t.propertyName===`translate`&&r()},r=()=>{d?.(),te()},i=window.setTimeout(r,t+100);e.addEventListener(`transitionend`,n),d=()=>{window.clearTimeout(i),e.removeEventListener(`transitionend`,n),d=null}},ie=()=>e.isConnected&&e.open?!0:(ot(e),!1);nt.set(e,{controller:t,snapTo:g}),Ge(e)&&(f(),p(),J.push(e),Y(),tt(e,n,ie,()=>{f(),p()})),n.addEventListener(`abort`,()=>{d?.(),u?.playState===`paused`&&(u.cancel(),rt.delete(e))}),e.addEventListener(`scroll`,()=>{i=performance.now()},{capture:!0,passive:!0,signal:n}),e.addEventListener(`click`,e=>{c.length<2||!(e.target instanceof Element)||e.target.closest(Be)&&g((l+1)%c.length)},{signal:n}),window.addEventListener(`resize`,()=>{ie()&&J.includes(e)&&(f(),p())},{signal:n}),ae(e,{axis:`y`,signal:n,canStart:t=>qe(e,t,i,l<c.length-1),onStart:()=>{d&&J.length===1&&Xe(!0),d?.(),a=re(e).y,f(),u||(u=We(e),u&&rt.set(e,u)),u?.pause(),Ve(e,!0)},onMove:({offset:t})=>{let n=a+t,r=c[c.length-1]??0,i=n>=r?n:r+ee(n-r,s+r);e.style.translate=`0 ${i}px`;let l=c[0]??0,d=Math.min(1,Math.max(0,(i-l)/Math.max(1,o-l)));u?u.currentTime=d*W:e.style.setProperty(`--_drawer-backdrop`,String(1-d)),m(d,!0)},onEnd:({offset:t,velocity:n})=>{let r=ne({stops:c,position:a+t,velocity:n,active:l,size:o,closeRatio:.25,flick:.4,fling:2,sequential:e.hasAttribute(`data-drawer-snap-sequential`)});Ve(e,!1),r<0?v(y(e)):g(r)},onCancel:_})}function at(e){nt.get(e)?.controller.abort(),nt.delete(e),e.removeAttribute(`data-drawer-state`),e.style.removeProperty(`--_drawer-depth`)}function ot(e){at(e);let t=J.indexOf(e);t<0||(J.splice(t,1),Y())}const st=function(){if(!st._bound){st._bound=!0,document.addEventListener(`zazz:dialog-open`,e=>{e.target instanceof HTMLDialogElement&&e.target.matches(ze)&&it(e.target)}),document.addEventListener(`zazz:dialog-close`,e=>{e.target instanceof HTMLDialogElement&&ot(e.target)}),window.addEventListener(`resize`,()=>{X&&Ye(X)}),o(()=>Y());for(let e of document.querySelectorAll(`${ze}[open]`))it(e)}};typeof window<`u`&&typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,st):st()),i(`ui-lightbox`,class extends r{setup(e){let t=this.querySelector(`dialog`);t instanceof HTMLDialogElement&&(this.addEventListener(`zazz:dialog-open`,e=>{e.target===t&&this.#t(t)},{signal:e}),this.addEventListener(`zazz:dialog-close`,e=>{e.target===t&&this.#n(t)},{signal:e}))}#e(){return this.querySelector(`[data-lightbox-slot~="gallery"] :is(ui-carousel, [data-ui~="carousel"])`)}#t(e){let t=e.querySelector(`:is(ui-carousel, [data-ui~="carousel"])`);if(!t)return;t instanceof Re&&t.init();let n=t._carousel,r=this.#e()?._carousel;n&&r&&n.goTo(r.selectedSnap(),!0);let i=t.querySelector(`[data-carousel-slot~="viewport"]`);i instanceof HTMLElement&&i.focus({preventScroll:!0})}#n(e){let t=e.querySelector(`:is(ui-carousel, [data-ui~="carousel"])`)?._carousel,n=this.#e()?._carousel;t&&n&&n.goTo(t.selectedSnap())}}),i(`ui-menu`,class extends r{setup(e){this.addEventListener(`keydown`,e=>this.#n(e),{signal:e})}#e(){let e=this.querySelector(`:scope > [data-menu-slot~="popover"]`);return e instanceof HTMLElement?e:null}#t(e){return Array.from(e.querySelectorAll(`a[href], button`)).filter(e=>e instanceof HTMLElement).filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-disabled`)!==`true`&&e.closest(`ui-menu, [data-ui~="menu"]`)===this)}#n(e){if(![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest(`ui-menu, [data-ui~="menu"]`)!==this)return;let n=this.#e();if(!n)return;let r=t.parentElement===this&&(t.hasAttribute(`popovertarget`)||t.hasAttribute(`interestfor`)),i=n.matches(`:popover-open`);if(r&&!i&&(e.key===`ArrowDown`||e.key===`ArrowUp`)){e.preventDefault(),n.showPopover();let t=this.#t(n);t[e.key===`ArrowDown`?0:t.length-1]?.focus();return}if(!i||!n.contains(t))return;let a=this.#t(n);if(a.length===0)return;let o=a.indexOf(t),s;switch(e.key){case`ArrowDown`:s=o===-1?0:(o+1)%a.length;break;case`ArrowUp`:s=o===-1?a.length-1:(o-1+a.length)%a.length;break;case`Home`:s=0;break;case`End`:s=a.length-1;break;default:return}e.preventDefault(),a[s].focus()}});function ct(e,t){if(!e)return[t];let n=e.split(`-`).map(e=>Number.parseInt(e,10)).filter(e=>Number.isFinite(e)&&e>0);return n.reduce((e,t)=>e+t,0)===t&&n.length>0?n:[t]}function lt(e,t,n){let r;switch(t){case`numeric`:r=/[^0-9]/g;break;case`alpha`:r=/[^a-zA-Z]/g;break;case`alphanumeric`:r=/[^a-zA-Z0-9]/g;break;case`none`:r=/\s/g}return e.replace(r,``).slice(0,n)}function ut(e,t,n,r,i){let a=r?Math.min(n,t-1):-1;return Array.from({length:t},(t,n)=>{let r=e.charAt(n);return{char:r===``?``:i?`•`:r,filled:r!==``,active:n===a}})}function dt(e,t){return t>0&&e.length===t}i(`ui-otp`,class extends r{#e=null;#t=``;setup(e){let t=this.querySelector(`input`);if(!(t instanceof HTMLInputElement))return;let n=t.maxLength>0?t.maxLength:6,r=this.getAttribute(`data-otp-type`)??`numeric`,i=this.hasAttribute(`data-otp-mask`),a=ct(this.getAttribute(`data-otp-groups`),n),o=this.#n(a);this.setAttribute(`data-otp-ready`,``);let s=j(lt(t.value,r,n)),c=j(t.selectionStart??0),l=j(document.activeElement===t);t.addEventListener(`input`,()=>{let e=lt(t.value,r,n);t.value!==e&&(t.value=e),s.set(e),c.set(t.selectionStart??e.length)},{signal:e}),document.addEventListener(`selectionchange`,()=>{document.activeElement===t&&c.set(t.selectionStart??0)},{signal:e}),t.addEventListener(`focus`,()=>l.set(!0),{signal:e}),t.addEventListener(`blur`,()=>l.set(!1),{signal:e}),o.addEventListener(`pointerdown`,e=>{let r=e.target instanceof Element?e.target.closest(`[data-otp-index]`):null;e.preventDefault(),t.focus();let i=r?Number(r.getAttribute(`data-otp-index`)):n,a=Math.min(i,t.value.length);t.setSelectionRange(a,a),c.set(a)},{signal:e}),N(()=>{let e=ut(s.get(),n,c.get(),l.get(),i),r=o.querySelectorAll(`[data-otp-index]`);e.forEach((e,t)=>{let n=r[t];if(!(n instanceof HTMLElement))return;n.textContent=e.char;let i=[e.filled&&`filled`,e.active&&`active`].filter(Boolean).join(` `);i?n.setAttribute(`data-otp-state`,i):n.removeAttribute(`data-otp-state`)});let a=dt(s.get(),n);a?this.setAttribute(`data-otp-complete`,``):this.removeAttribute(`data-otp-complete`),a&&this.hasAttribute(`data-otp-auto-submit`)&&this.#t!==s.get()&&(this.#t=s.get(),t.form?.requestSubmit())},{signal:e})}teardown(){this.#e?.remove(),this.#e=null,this.removeAttribute(`data-otp-ready`),this.removeAttribute(`data-otp-complete`)}#n(e){let t=document.createElement(`div`);t.setAttribute(`data-otp-slot`,`rail`),t.setAttribute(`aria-hidden`,`true`);let n=0;return e.forEach((e,r)=>{if(r>0){let e=document.createElement(`span`);e.setAttribute(`data-otp-slot`,`separator`),e.setAttribute(`aria-role`,`presentation`),e.textContent=`–`,t.append(e)}for(let r=0;r<e;r++){let e=document.createElement(`span`);e.setAttribute(`data-otp-slot`,`cell`),e.setAttribute(`data-otp-index`,String(n++)),t.append(e)}}),this.append(t),this.#e=t,t}});function ft(e,t,n){return{type:e?`text`:`password`,ariaPressed:e?`true`:`false`,ariaLabel:e?n:t}}i(`ui-password`,class extends r{setup(e){let t=this.querySelector(`input[type="password"], input[type="text"]`),n=this.querySelector(`[data-password-group-slot~="toggle"]`);if(!(t instanceof HTMLInputElement)||!(n instanceof HTMLElement))return;let r=j(t.type===`text`);n.addEventListener(`click`,()=>r.set(!r.get()),{signal:e}),N(()=>{let e=this.getAttribute(`data-password-group-label-show`)||`Show password`,i=this.getAttribute(`data-password-group-label-hide`)||`Hide password`,a=ft(r.get(),e,i);t.type=a.type,n.setAttribute(`aria-pressed`,a.ariaPressed),n.setAttribute(`aria-label`,a.ariaLabel)},{signal:e})}});function pt(e,t,n){return e.length===0?t:e.length===1?e[0]:`${e[0]} ${n.replace(`{n}`,String(e.length-1))}`}let mt=0;i(`ui-multiselect`,class extends r{#e=[];#t=null;setup(e){let t=this.querySelector(`select[multiple]`);if(!(t instanceof HTMLSelectElement))return;this.#t=t;let n=this.getAttribute(`data-multiselect-placeholder`)??`Select…`,r=this.getAttribute(`data-multiselect-label-more`)??`(+{n} more)`,{trigger:i,label:a,panel:o,checkboxes:s}=this.#n(t);t.setAttribute(`data-multiselect-state`,`enhanced`);let c=()=>Array.from(t.selectedOptions).map(e=>e.label),l=j(c());s.forEach((n,r)=>{n.addEventListener(`change`,()=>{let e=t.options[r];e&&(e.selected=n.checked),l.set(c()),t.dispatchEvent(new Event(`change`,{bubbles:!0}))},{signal:e})}),t.addEventListener(`change`,()=>l.set(c()),{signal:e}),t.form?.addEventListener(`reset`,()=>queueMicrotask(()=>l.set(c())),{signal:e}),o.addEventListener(`toggle`,e=>{i.setAttribute(`aria-expanded`,String(e.newState===`open`))},{signal:e}),N(()=>{l.get(),a.textContent=pt(c(),n,r),s.forEach((e,n)=>{let r=t.options[n];r&&e.checked!==r.selected&&(e.checked=r.selected)})},{signal:e})}teardown(){for(let e of this.#e)e.remove();this.#e=[],this.#t?.removeAttribute(`data-multiselect-state`),this.#t=null}#n(e){let t=`ui-multiselect-panel-${++mt}`,n=document.createElement(`button`);n.type=`button`,n.dataset.ui=`select`,n.setAttribute(`data-multiselect-slot`,`trigger`),n.setAttribute(`popovertarget`,t),n.setAttribute(`aria-expanded`,`false`);let r=document.createElement(`span`);r.setAttribute(`data-multiselect-slot`,`label`);let i=document.createElement(`span`);i.setAttribute(`data-multiselect-slot`,`icon`),i.setAttribute(`aria-hidden`,`true`),n.append(r,i);let a=document.createElement(`div`);a.id=t,a.setAttribute(`data-multiselect-slot`,`panel`),a.setAttribute(`popover`,`auto`);let o=this.getAttribute(`data-multiselect-side`),s=this.getAttribute(`data-multiselect-align`);o&&a.setAttribute(`data-popover-side`,o),s&&a.setAttribute(`data-popover-align`,s);let c=[];for(let[n,r]of Array.from(e.options).entries()){let e=document.createElement(`label`);e.setAttribute(`data-multiselect-slot`,`option`);let i=document.createElement(`input`);i.type=`checkbox`,i.id=`${t}-${n}`,i.checked=r.selected,i.disabled=r.disabled,e.append(i,document.createTextNode(r.label)),a.append(e),c.push(i)}return e.after(n,a),this.#e=[n,a],{trigger:n,label:r,panel:a,checkboxes:c}}}),i(`ui-tabs`,class extends r{setup(e){this.addEventListener(`keydown`,e=>this.#e(e),{signal:e})}#e(e){let t=e.target;if(!(t instanceof HTMLInputElement)||t.type!==`radio`)return;let n=t.closest(`[role="tablist"], [data-tabs-slot~="list"]`);if(!n||n.closest(`ui-tabs, [data-ui~="tabs"]`)!==this)return;let r=Array.from(n.querySelectorAll(`input[type="radio"]`)).filter(e=>e instanceof HTMLInputElement).filter(e=>!e.disabled);if(r.length<2)return;let i=this.getAttribute(`data-tabs-orientation`)===`vertical`,a=i?`ArrowUp`:`ArrowLeft`,o=i?`ArrowDown`:`ArrowRight`,s=r.indexOf(t);if(s===-1)return;let c;switch(e.key){case a:c=(s-1+r.length)%r.length;break;case o:c=(s+1)%r.length;break;case`Home`:c=0;break;case`End`:c=r.length-1;break;default:return}e.preventDefault();let l=r[c];l.checked=!0,l.focus(),l.dispatchEvent(new Event(`change`,{bubbles:!0}))}});function ht(){var e=typeof SuppressedError==`function`?SuppressedError:function(e,t){var n=Error();return n.name=`SuppressedError`,n.error=e,n.suppressed=t,n},t={},n=[];function r(e,t){if(t!=null){if(Object(t)!==t)throw TypeError(`using declarations can only be used with objects, functions, null, or undefined.`);if(e)var r=t[Symbol.asyncDispose||Symbol.for(`Symbol.asyncDispose`)];if(r===void 0&&(r=t[Symbol.dispose||Symbol.for(`Symbol.dispose`)],e))var i=r;if(typeof r!=`function`)throw TypeError(`Object is not disposable.`);i&&(r=function(){try{i.call(t)}catch(e){return Promise.reject(e)}}),n.push({v:t,d:r,a:e})}else e&&n.push({d:t,a:e});return t}return{e:t,u:r.bind(null,!1),a:r.bind(null,!0),d:function(){var r,i=this.e,a=0;function o(){for(;r=n.pop();)try{if(!r.a&&a===1)return a=0,n.push(r),Promise.resolve().then(o);if(r.d){var e=r.d.call(r.v);if(r.a)return a|=2,Promise.resolve(e).then(o,s)}else a|=1}catch(e){return s(e)}if(a===1)return i===t?Promise.resolve():Promise.reject(i);if(i!==t)throw i}function s(n){return i=i===t?n:new e(n,i),o()}return o()}}}Symbol.dispose??=Symbol(`Symbol.dispose`);const gt=[`success`,`info`,`warning`,`destructive`],_t={success:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"/></svg>`,info:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z" clip-rule="evenodd"/></svg>`,warning:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z" clip-rule="evenodd"/></svg>`,destructive:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"/></svg>`,close:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>`};function vt(e){for(let t of e)t.style.blockSize=`auto`;return{[Symbol.dispose](){for(let t of e)t.style.removeProperty(`block-size`)}}}function yt(e){let t=e.length,n=Array.from({length:t}),r=0;for(let i=t-1;i>=0;i--){let a=t-1-i;n[i]={stackIndex:a,offsetPx:r,zIndex:t-a,front:a===0,visible:a<3},r+=e[i]}return{toasts:n,frontToastHeightPx:t>0?e[t-1]:null}}function $(e,t,n){let r=(e.getAttribute(`data-toaster-state`)??``).split(/\s+/).filter(Boolean),i=n?[.../* @__PURE__ */ new Set([...r,t])]:r.filter(e=>e!==t);i.length?e.setAttribute(`data-toaster-state`,i.join(` `)):e.removeAttribute(`data-toaster-state`)}function bt(e){return e.matches(`[data-toaster-state~="removed"]`)}var xt=class extends r{#e=/* @__PURE__ */ new Map;#t=0;#n=0;#r=null;#i=0;#a=j(!1);#o=j(typeof document<`u`&&document.hidden);#s=j(!1);#c=Se(()=>this.#a.get()||this.#o.get()||this.#s.get());#l=null;#u=j([]);#d=Se(()=>yt(this.#u.get().map(e=>e.height)));setup(e){if(this.#l=e,this.hasAttribute(`popover`)||this.setAttribute(`popover`,`manual`),this.hasAttribute(`role`)||this.setAttribute(`role`,`region`),this.hasAttribute(`aria-label`)||this.setAttribute(`aria-label`,`Notifications`),this.hasAttribute(`tabindex`)||this.setAttribute(`tabindex`,`-1`),!this.querySelector(`[data-toaster-slot~="list"]`)){let e=document.createElement(`ol`);e.setAttribute(`data-toaster-slot`,`list`),e.setAttribute(`aria-live`,`polite`),e.setAttribute(`aria-relevant`,`additions text`),e.setAttribute(`aria-atomic`,`false`),this.append(e)}this.addEventListener(`command`,e=>this.#f(e),{signal:e}),this.addEventListener(`mouseenter`,()=>this.#y(!0),{signal:e}),this.addEventListener(`mouseleave`,()=>this.#b(),{signal:e}),this.addEventListener(`focusin`,()=>this.#y(!0),{signal:e}),this.addEventListener(`focusout`,()=>this.#b(),{signal:e}),document.addEventListener(`visibilitychange`,()=>this.#o.set(document.hidden),{signal:e}),window.addEventListener(`resize`,()=>{cancelAnimationFrame(this.#n),this.#n=requestAnimationFrame(()=>this.#g())},{signal:e}),N(()=>{$(this,`expanded`,this.#a.get())},{signal:e}),N(()=>{this.#c.get()?this.#C():this.#w()},{signal:e}),N(()=>{let e=this.#u.get(),{toasts:t,frontToastHeightPx:n}=this.#d.get();for(let n=0;n<e.length;n++){let{node:r,height:i}=e[n],a=t[n];$(r,`front`,a.front),$(r,`visible`,a.visible),r.style.zIndex=String(a.zIndex),r.style.setProperty(`--toasts-before`,String(a.stackIndex)),r.style.setProperty(`--initial-height`,`${i}px`),r.style.setProperty(`--offset`,`calc(${a.offsetPx}px + var(--ui-toaster-gap) * ${a.stackIndex})`)}n!==null&&this.style.setProperty(`--front-toast-height`,`${n}px`)},{signal:e})}teardown(){cancelAnimationFrame(this.#n),window.clearTimeout(this.#i);for(let e of this.#e.values())clearTimeout(e.timeoutId);this.#e.clear()}addToast(e={}){let t=`toast-${++this.#t}`,n=this.#_();this.#T();let r=this.#p(e,t);return n.append(r),this.#m(r,t),this.#g(),this.#x(t,e.duration??4e3),t}dismiss(e){if(e===void 0){this.dismissAll();return}let t=this.#_().querySelector(`[data-toaster-id="${CSS.escape(e)}"]`);if(!(t instanceof HTMLElement)||bt(t))return;let n=this.#e.get(e);n&&clearTimeout(n.timeoutId),this.#e.delete(e),$(t,`removed`,!0);let r=document.activeElement;r instanceof HTMLElement&&t.contains(r)&&r.matches(`:focus-visible`)&&this.#v().filter(e=>!bt(e)).at(-1)?.focus({preventScroll:!0}),this.#g(),this.#D(t)}dismissAll(){for(let e of this.#v()){let t=e.dataset.toasterId;t&&this.dismiss(t)}}#f(e){let t=e.command;if(typeof t!=`string`||!t.startsWith(`--toast`))return;let n=this.#r;if(n&&n.source===e.source&&n.command===t)return;this.#r={source:e.source,command:t},window.setTimeout(()=>{this.#r=null},0);let r=e.source,i={},a=t.slice(8);if(gt.includes(a)&&(i.variant=a),r instanceof HTMLElement){let{toasterTitle:e,toasterDescription:t,toasterVariant:n,toasterDuration:a,toasterCloseButton:o}=r.dataset;if(e&&(i.title=e),t&&(i.description=t),!i.variant&&n&&gt.includes(n)&&(i.variant=n),a!==void 0){let e=a.trim()===``?NaN:Number(a);Number.isNaN(e)||(i.duration=e)}o!==void 0&&(i.closeButton=o!==`false`)}this.addToast(i)}#p(e,t){let n=document.createElement(`li`);if(n.setAttribute(`data-toaster-slot`,`toast`),n.dataset.toasterId=t,n.tabIndex=0,e.variant&&(n.dataset.toasterVariant=e.variant),e.variant){let t=document.createElement(`span`);t.setAttribute(`data-toaster-slot`,`icon`),t.setAttribute(`aria-hidden`,`true`),t.innerHTML=_t[e.variant],n.append(t)}let r=document.createElement(`div`);if(r.setAttribute(`data-toaster-slot`,`content`),e.title){let t=document.createElement(`div`);t.setAttribute(`data-toaster-slot`,`title`),t.textContent=e.title,r.append(t)}if(e.description){let t=document.createElement(`div`);t.setAttribute(`data-toaster-slot`,`description`),t.textContent=e.description,r.append(t)}n.append(r);let i=e.action;if(i){let e=document.createElement(`button`);e.type=`button`,e.dataset.ui=`button`,e.setAttribute(`data-toaster-slot`,`action`),e.dataset.buttonSize=`sm`,e.textContent=i.label,e.addEventListener(`click`,e=>{i.onClick?.(e),e.defaultPrevented||this.dismiss(t)}),n.append(e)}if(e.closeButton!==!1){let e=document.createElement(`button`);e.type=`button`,e.dataset.ui=`button`,e.setAttribute(`data-toaster-slot`,`close`),e.dataset.buttonVariant=`ghost`,e.dataset.buttonSize=`icon-sm`,e.setAttribute(`aria-label`,`Close notification`),e.innerHTML=_t.close,e.addEventListener(`click`,()=>this.dismiss(t)),n.append(e)}return n}#m(e,t){if(!this.#l)return;let n=0,r=(t,n)=>{let r=typeof n==`number`?`${n}px`:n;e.style.translate=t===`x`?`${r} 0`:`0 ${r}`},i=()=>{$(e,`swiping`,!1),e.style.removeProperty(`translate`),this.#s.set(!1),this.#b()};ae(e,{axis:`both`,signal:this.#l,canStart:()=>!bt(e)&&(this.#a.get()||e.matches(`[data-toaster-state~="front"]`)),onStart:({axis:t})=>{let r=re(e);n=t===`x`?r.x:r.y,$(e,`swiping`,!0),this.#s.set(!0)},onMove:({axis:e,offset:t})=>{let i=n+t,a=this.#h(e);r(e,a===0||Math.sign(i)===a?i:ee(i,24))},onEnd:({axis:a,offset:o,velocity:s})=>{let c=n+o,l=this.#h(a)||Math.sign(c)||1;if(!te({offset:c*l,velocity:s*l,distance:45,velocityThreshold:.11})){i();return}$(e,`swiped`,!0),$(e,`swiping`,!1);let u=v(a===`x`?e.offsetWidth:e.offsetHeight,s,y(e));e.style.transitionDuration=`${u}ms`,r(a,`calc(${c}px + ${l*100}%)`),this.#s.set(!1),this.dismiss(t),this.#b()},onCancel:i})}#h(e){let t=this.getAttribute(`data-toaster-position`)??`bottom-end`;if(e===`y`)return t.startsWith(`top`)?-1:1;if(t.endsWith(`center`))return 0;let n=t.endsWith(`start`)?-1:1;return getComputedStyle(this).direction===`rtl`?-n:n}#g(){try{var e=ht();let t=this.#v().filter(e=>!bt(e));e.u(vt(t));let n=t.map(e=>({node:e,height:e.offsetHeight}));this.#u.set(n)}catch(t){e.e=t}finally{e.d()}}#_(){let e=this.querySelector(`[data-toaster-slot~="list"]`);return e instanceof HTMLOListElement||(e=document.createElement(`ol`),e.setAttribute(`data-toaster-slot`,`list`),this.append(e)),e}#v(){return Array.from(this.#_().children).filter(e=>e instanceof HTMLElement).filter(e=>e.matches(`[data-toaster-slot~="toast"]`))}#y(e){e&&window.clearTimeout(this.#i),this.#a.set(e)}#b(){window.clearTimeout(this.#i),this.#i=window.setTimeout(()=>{let e=document.activeElement,t=e instanceof Node&&this.contains(e);!this.matches(`:hover`)&&!t&&this.#y(!1)},100)}#x(e,t){if(t===1/0||Number.isNaN(t))return;let n={remaining:t,startedAt:0,timeoutId:0};this.#e.set(e,n),this.#c.get()||this.#S(e,n)}#S(e,t){t.startedAt=Date.now(),t.timeoutId=window.setTimeout(()=>this.dismiss(e),t.remaining)}#C(){for(let e of this.#e.values())e.timeoutId&&(clearTimeout(e.timeoutId),e.timeoutId=0,e.remaining=Math.max(0,e.remaining-(Date.now()-e.startedAt)))}#w(){if(!this.#c.get())for(let[e,t]of this.#e)t.timeoutId||this.#S(e,t)}#T(){try{this.matches(`:popover-open`)||this.showPopover()}catch{}}#E(){try{this.matches(`:popover-open`)&&this.hidePopover()}catch{}}#D(e){let t=!1,n=()=>{t||(t=!0,e.remove(),this.#v().length===0&&(this.#y(!1),this.#E()))};e.addEventListener(`transitionend`,t=>{t.target===e&&n()}),window.setTimeout(n,Math.max(600,y(e)+100))}};function St(e){let t=e instanceof Element?e:typeof e==`string`?document.getElementById(e):document.querySelector(`ui-toaster, [data-ui~="toaster"]`);return t instanceof xt?t:(console.warn('Toaster: no <ui-toaster> found. Add `<ui-toaster popover="manual"></ui-toaster>` to the page.'),null)}function Ct(e){return typeof e==`string`?{title:e}:e??{}}const wt={toast(e){let t=Ct(e),n=St(t.region);return n?n.addToast(t):null},success(e,t){return wt.toast({...t,title:e,variant:`success`})},info(e,t){return wt.toast({...t,title:e,variant:`info`})},warning(e,t){return wt.toast({...t,title:e,variant:`warning`})},error(e,t){return wt.toast({...t,title:e,variant:`destructive`})},dismiss(e){for(let t of document.querySelectorAll(`ui-toaster, [data-ui~="toaster"]`))t instanceof xt&&t.dismiss(e)}};i(`ui-toaster`,xt),typeof window<`u`&&(window.Toaster=wt);function Tt(e){return e.documentElement.getAttribute(`data-ui-navigation`)===`swap`}function Et(e){let t=[];for(let n of[e,...e.querySelectorAll(`*`)])(n.scrollTop||n.scrollLeft)&&t.push([n,n.scrollTop,n.scrollLeft]);return t}function Dt(e,t){let n=/* @__PURE__ */ new Map;for(let e of t.querySelectorAll(`a[href], area[href]`)){let t=e.getAttribute(`href`);n.set(t,[...n.get(t)??[],e])}for(let t of e.querySelectorAll(`a[href], area[href]`)){let e=(n.get(t.getAttribute(`href`))?.shift())?.getAttribute(`aria-current`);e==null?t.removeAttribute(`aria-current`):t.setAttribute(`aria-current`,e)}}function Ot(e){let t=document.body,n=/* @__PURE__ */ new Map,r=[];for(let e of t.querySelectorAll(`[data-ui-persist]`)){let t=e.getAttribute(`data-ui-persist`);t&&!n.has(t)&&n.set(t,e)}for(let e of n.values())r.push(...Et(e));let i=/* @__PURE__ */ new Map;for(let e of t.querySelectorAll(`[data-ui-persist-scroll]`)){let t=e.getAttribute(`data-ui-persist-scroll`);t&&!i.has(t)&&i.set(t,[e.scrollTop,e.scrollLeft])}let a=document.importNode(e,!0),o=[];for(let e of a.querySelectorAll(`[data-ui-persist]`)){let t=n.get(e.getAttribute(`data-ui-persist`)??``);t&&o.push([e,t])}for(let e of a.querySelectorAll(`[data-ui-persist-scroll]`)){let t=e.getAttribute(`data-ui-persist-scroll`)??``,n=i.get(t);i.delete(t),n&&r.push([e,...n])}t.before(a);for(let[e,t]of o){let n=e.parentNode;n&&(Dt(t,e),typeof n.moveBefore==`function`?n.moveBefore(t,e):n.insertBefore(t,e),e.remove())}t.remove();for(let[e,t,n]of r)e.scrollTo({top:t,left:n,behavior:`instant`});return a}async function kt(e,t){let n=document.head,r=/* @__PURE__ */ new Set;for(let e of n.querySelectorAll(`link[rel~="stylesheet"][href]`))r.add(e.href);let i=/* @__PURE__ */ new Set;for(let e of n.querySelectorAll(`style`))i.add(e.textContent??``);let a=[];for(let o of e.head.querySelectorAll(`link[rel~="stylesheet"][href], style`)){if(o.localName===`style`){let e=o.textContent??``;if(i.has(e))continue;i.add(e),n.append(document.importNode(o,!0));continue}let e=new URL(o.getAttribute(`href`)??``,t).href;if(r.has(e))continue;r.add(e);let s=document.importNode(o,!0);s.href=e,a.push(new Promise(e=>{s.addEventListener(`load`,()=>e(),{once:!0}),s.addEventListener(`error`,()=>e(),{once:!0})})),n.append(s)}if(a.length===0)return;let o=0;await Promise.race([Promise.all(a),new Promise(e=>o=window.setTimeout(e,3e3))]),window.clearTimeout(o)}function At(e){let t=e.querySelector(`main`),n=t?.querySelector(`h1`)??t??e;n instanceof HTMLElement&&(n.hasAttribute(`tabindex`)||(n.tabIndex=-1),n.focus({preventScroll:!0}))}let jt=0,Mt=``;function Nt(){let e=document.documentElement.style;jt++===0&&(Mt=e.scrollBehavior,e.scrollBehavior=`auto`);let t=!0;return()=>{t&&(t=!1,--jt===0&&(e.scrollBehavior=Mt))}}function Pt(e){return new URL(e,location.href).origin===location.origin}function Ft(e){let t=/\.([a-z0-9]+)$/i.exec(new URL(e,location.href).pathname)?.[1];return!t||/^x?html?$/i.test(t)}if(`navigation`in window){let e=null;function t(t){e=t,location.replace(t)}window.navigation.addEventListener(`navigate`,n=>{e!==null&&n.destination.url===e?e=null:Tt(document)&&n.canIntercept&&n.navigationType!==`reload`&&(!n.destination.sameDocument||n.navigationType===`traverse`)&&!n.hashChange&&n.downloadRequest===null&&n.formData===null&&Pt(n.destination.url)&&Ft(n.destination.url)&&n.intercept({async handler(){let e;try{let t=await fetch(n.destination.url,{signal:n.signal});if(!t.ok)throw Error(t.statusText);if(!t.headers.get(`content-type`)?.includes(`html`))throw Error(`not a page`);e=new DOMParser().parseFromString(await t.text(),`text/html`)}catch{if(n.signal.aborted)return;t(n.destination.url);return}if(n.signal.aborted)return;if(!Tt(e)||!(e.body instanceof HTMLElement)){t(n.destination.url);return}if(await kt(e,n.destination.url),n.signal.aborted)return;let r=document.body,i=()=>{r=Ot(e.body),document.title=e.title,n.scroll()},a=Nt();if(document.startViewTransition)try{await document.startViewTransition(i).finished}finally{a()}else try{i()}finally{requestAnimationFrame(()=>requestAnimationFrame(a))}s(r),At(r)}})})}else Tt(document)&&console.warn(`Navigation API not supported: data-ui-navigation falls back to full page loads.`);typeof CSS<`u`&&!CSS.supports(`container-type`,`scroll-state`)&&import(`./scroll-state-C8mA5gq6.js`);function It(){for(let e of document.querySelectorAll(`[style]`))if(e.getAttribute(`style`)?.includes(`:`)&&e.style.length===0)return!0;return!1}if(typeof document<`u`){let e=()=>{It()&&import(`./csp-LRx1fynI.js`)};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,e):e()}export{o as t};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zazz-ui/core",
3
- "version": "0.14.1",
3
+ "version": "0.14.3",
4
4
  "description": "Zazz Design Framework — a zero-build, semantic-token CSS + vanilla JS UI kit built on modern web standards.",
5
5
  "keywords": [
6
6
  "cascade-layers",
@@ -74,8 +74,8 @@
74
74
  "happy-dom": "^21.0.3",
75
75
  "playwright": "1.64.1",
76
76
  "typescript": "^7.0.2",
77
- "vite": "npm:@voidzero-dev/vite-plus-core@1.5.1",
78
- "vite-plus": "1.5.1",
77
+ "vite": "npm:@voidzero-dev/vite-plus-core@8.3.8000",
78
+ "vite-plus": "1.7.0",
79
79
  "vitest": "5.1.0"
80
80
  },
81
81
  "scripts": {
package/src/head.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"head.d.ts","sourceRoot":"","sources":["head.ts"],"names":[],"mappings":"AA6BA,wDAAwD;AACxD,UAAU,aAAa;IACrB,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAwCD;;;;;;GAMG;AACH,iBAAS,MAAM,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAE1C;AAED;;;;;GAKG;AACH,QAAA,MAAM,gBAAgB,EAAE,SAAS,aAAa,EAO7C,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,SAAS,EAAE,SAAS,aAAa,EAOtC,CAAC;AAuFF,iEAAiE;AACjE,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,+BAA+B;AAC/B,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC;IAC1C,kFAAkF;IAClF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,OAAO,GAAE,WAAgB,GAAG,MAAM,CAsD3D;AAgID,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AAC/C,YAAY,EAAE,aAAa,EAAE,CAAC;AAI9B;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IACxB,oCAAoC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,WAAW,CAAC;IACrB,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;CAChB;AAKD,yEAAyE;AACzE,wBAAgB,UAAU,CAAC,OAAO,GAAE,WAAgB,GAAG,MAAM,CAI5D;AAED,+FAA+F;AAC/F,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAgBjE;AAcD;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,WAAW,GACpB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAa1D;AAED,0FAA0F;AAC1F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,CAG1F"}
1
+ {"version":3,"file":"head.d.ts","sourceRoot":"","sources":["head.ts"],"names":[],"mappings":"AA6BA,wDAAwD;AACxD,UAAU,aAAa;IACrB,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAwCD;;;;;;GAMG;AACH,iBAAS,MAAM,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAE1C;AAED;;;;;GAKG;AACH,QAAA,MAAM,gBAAgB,EAAE,SAAS,aAAa,EAO7C,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,SAAS,EAAE,SAAS,aAAa,EAOtC,CAAC;AAuFF,iEAAiE;AACjE,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,+BAA+B;AAC/B,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC;IAC1C,kFAAkF;IAClF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,OAAO,GAAE,WAAgB,GAAG,MAAM,CAsD3D;AAgID,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AAC/C,YAAY,EAAE,aAAa,EAAE,CAAC;AAI9B;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IACxB,oCAAoC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,WAAW,CAAC;IACrB,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;CAChB;AAKD,yEAAyE;AACzE,wBAAgB,UAAU,CAAC,OAAO,GAAE,WAAgB,GAAG,MAAM,CAI5D;AAED,+FAA+F;AAC/F,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAiBjE;AAgBD;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,WAAW,GACpB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAa1D;AAED,0FAA0F;AAC1F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,CAG1F"}
package/src/head.js CHANGED
@@ -330,7 +330,8 @@ export function findHeadBlock(html) {
330
330
  return undefined;
331
331
  }
332
332
  }
333
- const indent = /(?:^|\n)([ \t]*)$/.exec(html.slice(0, open.index))?.[1] ?? "";
333
+ const before = html.slice(html.lastIndexOf("\n", open.index - 1) + 1, open.index);
334
+ const indent = /^[ \t]*$/.test(before) ? before : "";
334
335
  return { markerStart: open.index, start, end, options, indent };
335
336
  }
336
337
  /**
@@ -338,11 +339,11 @@ export function findHeadBlock(html) {
338
339
  * void elements, and those differences don't make a head block out of date.
339
340
  */
340
341
  function normalizeHead(html) {
341
- return html
342
+ return (html
342
343
  .replace(/\s+/g, " ")
343
- .replace(/\s*\/>/g, ">")
344
- .replace(/\s+>/g, ">")
345
- .trim();
344
+ // Whitespace is one space by now, so ` ?` covers what `\s*` would.
345
+ .replace(/ ?\/?>/g, ">")
346
+ .trim());
346
347
  }
347
348
  /**
348
349
  * @description The edit that renders `head` between the page's markers,
package/src/head.ts CHANGED
@@ -516,7 +516,8 @@ export function findHeadBlock(html: string): HeadBlock | undefined {
516
516
  return undefined;
517
517
  }
518
518
  }
519
- const indent = /(?:^|\n)([ \t]*)$/.exec(html.slice(0, open.index))?.[1] ?? "";
519
+ const before = html.slice(html.lastIndexOf("\n", open.index - 1) + 1, open.index);
520
+ const indent = /^[ \t]*$/.test(before) ? before : "";
520
521
  return { markerStart: open.index, start, end, options, indent };
521
522
  }
522
523
 
@@ -525,11 +526,13 @@ export function findHeadBlock(html: string): HeadBlock | undefined {
525
526
  * void elements, and those differences don't make a head block out of date.
526
527
  */
527
528
  function normalizeHead(html: string): string {
528
- return html
529
- .replace(/\s+/g, " ")
530
- .replace(/\s*\/>/g, ">")
531
- .replace(/\s+>/g, ">")
532
- .trim();
529
+ return (
530
+ html
531
+ .replace(/\s+/g, " ")
532
+ // Whitespace is one space by now, so ` ?` covers what `\s*` would.
533
+ .replace(/ ?\/?>/g, ">")
534
+ .trim()
535
+ );
533
536
  }
534
537
 
535
538
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["drawer.ts"],"names":[],"mappings":"AAqgBA;;;;GAIG;AACH,iBAAS,UAAU,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CA2OnD;AAcD;;;;;GAKG;AACH,iBAAS,UAAU,CAAC,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAElE;AAED,UAAU,aAAa;IACrB,IAAI,IAAI,CAAC;IACT,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;GAGG;AACH,QAAA,MAAM,WAAW,EAAE,aAqBlB,CAAC;AAWF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["drawer.ts"],"names":[],"mappings":"AAghBA;;;;GAIG;AACH,iBAAS,UAAU,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAsPnD;AAmBD;;;;;GAKG;AACH,iBAAS,UAAU,CAAC,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAElE;AAED,UAAU,aAAa;IACrB,IAAI,IAAI,CAAC;IACT,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;GAGG;AACH,QAAA,MAAM,WAAW,EAAE,aAwBlB,CAAC;AAWF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC"}
@@ -65,6 +65,7 @@
65
65
  * </dialog>
66
66
  */
67
67
  import { currentTranslate, maxTransitionMs, pickSnap, rubberBand, trackDrag, } from "../../base/gesture.js";
68
+ import { registerRefresh } from "../../base/zazz-element.js";
68
69
  // --- Tuning ---
69
70
  /** Share of the drawer's visible height, at its lowest stop, that dismisses on its own. */
70
71
  const CLOSE_RATIO = 0.25;
@@ -215,15 +216,18 @@ const stack = [];
215
216
  /**
216
217
  * @description Writes each open drawer's place in the stack: how many drawers
217
218
  * sit in front of it (`--_drawer-depth`, `stacked`) and whether it opened over
218
- * another (`nested`). Runs when a drawer opens or closes, never per frame.
219
+ * another (`nested`). Runs when a drawer opens or closes and after a
220
+ * navigation swap, never per frame.
219
221
  * @private
220
222
  */
221
223
  function restack() {
222
224
  // a drawer removed from the page while open never reports its close
223
225
  for (let index = stack.length - 1; index >= 0; index--) {
224
226
  const dialog = stack[index];
225
- if (!dialog.isConnected || !dialog.open)
226
- stack.splice(index, 1);
227
+ if (dialog.isConnected && dialog.open)
228
+ continue;
229
+ stack.splice(index, 1);
230
+ release(dialog);
227
231
  }
228
232
  stack.forEach((dialog, index) => {
229
233
  const depth = stack.length - 1 - index;
@@ -385,18 +389,20 @@ function keyboardInset() {
385
389
  * to `--_drawer-keyboard` (drawer.css pads the sheet by it, so its
386
390
  * content ends at the keyboard's top edge), holds the page at its scroll
387
391
  * position, and scrolls a focused field into the part of its scrolling slot
388
- * that is still visible.
392
+ * that is still visible. All of it stops once `alive` says the drawer is gone:
393
+ * a hold on the page that outlived its drawer would pin the next page.
389
394
  *
390
395
  * @param dialog - The drawer.
391
396
  * @param signal - Aborts when the drawer closes.
397
+ * @param alive - Whether the drawer is still open on the page; unbinds it when not.
392
398
  * @param onChange - Runs after the inset changes, once the new padding is in place.
393
399
  * @private
394
400
  */
395
- function trackKeyboard(dialog, signal, onChange) {
401
+ function trackKeyboard(dialog, signal, alive, onChange) {
396
402
  const viewport = window.visualViewport;
397
403
  if (!viewport)
398
404
  return;
399
- const front = () => stack[stack.length - 1] === dialog;
405
+ const front = () => alive() && stack[stack.length - 1] === dialog;
400
406
  const pageX = window.scrollX;
401
407
  const pageY = window.scrollY;
402
408
  let frame = 0;
@@ -616,13 +622,24 @@ function bindDrawer(dialog) {
616
622
  cancelClose = null;
617
623
  };
618
624
  };
625
+ /**
626
+ * Whether the drawer is still open on the page. A drawer removed while open
627
+ * (a navigation swap replaces the body) fires no `close`, so whatever it
628
+ * bound outside itself asks this first, and the first to ask unbinds it.
629
+ */
630
+ const alive = () => {
631
+ if (dialog.isConnected && dialog.open)
632
+ return true;
633
+ unbindDrawer(dialog);
634
+ return false;
635
+ };
619
636
  bound.set(dialog, { controller, snapTo });
620
637
  if (inDrawerMode(dialog)) {
621
638
  measure();
622
639
  place();
623
640
  stack.push(dialog);
624
641
  restack();
625
- trackKeyboard(dialog, signal, () => {
642
+ trackKeyboard(dialog, signal, alive, () => {
626
643
  measure();
627
644
  place();
628
645
  });
@@ -646,7 +663,7 @@ function bindDrawer(dialog) {
646
663
  snapTo((active + 1) % stops.length);
647
664
  }, { signal });
648
665
  window.addEventListener("resize", () => {
649
- if (!stack.includes(dialog))
666
+ if (!alive() || !stack.includes(dialog))
650
667
  return;
651
668
  measure();
652
669
  place();
@@ -706,12 +723,16 @@ function bindDrawer(dialog) {
706
723
  onCancel: rest,
707
724
  });
708
725
  }
709
- /** Unbinds a drawer that closed. */
710
- function unbindDrawer(dialog) {
726
+ /** Drops everything a drawer bound and wrote; its place in the stack is the caller's. */
727
+ function release(dialog) {
711
728
  bound.get(dialog)?.controller.abort();
712
729
  bound.delete(dialog);
713
730
  dialog.removeAttribute("data-drawer-state");
714
731
  dialog.style.removeProperty("--_drawer-depth");
732
+ }
733
+ /** Unbinds a drawer that closed or left the page. */
734
+ function unbindDrawer(dialog) {
735
+ release(dialog);
715
736
  const index = stack.indexOf(dialog);
716
737
  if (index < 0)
717
738
  return;
@@ -748,6 +769,8 @@ const initDrawers = function () {
748
769
  if (indented)
749
770
  measureIndent(indented);
750
771
  });
772
+ // a navigation swap removes open drawers without a close: let go of them
773
+ registerRefresh(() => restack());
751
774
  // drawers that were already open when the script loaded
752
775
  for (const dialog of document.querySelectorAll(`${DRAWER}[open]`)) {
753
776
  bindDrawer(dialog);
@@ -74,6 +74,7 @@ import {
74
74
  trackDrag,
75
75
  } from "../../base/gesture.ts";
76
76
  import type { DragState } from "../../base/gesture.ts";
77
+ import { registerRefresh } from "../../base/zazz-element.ts";
77
78
 
78
79
  // --- Tuning ---
79
80
 
@@ -240,14 +241,17 @@ const stack: HTMLDialogElement[] = [];
240
241
  /**
241
242
  * @description Writes each open drawer's place in the stack: how many drawers
242
243
  * sit in front of it (`--_drawer-depth`, `stacked`) and whether it opened over
243
- * another (`nested`). Runs when a drawer opens or closes, never per frame.
244
+ * another (`nested`). Runs when a drawer opens or closes and after a
245
+ * navigation swap, never per frame.
244
246
  * @private
245
247
  */
246
248
  function restack(): void {
247
249
  // a drawer removed from the page while open never reports its close
248
250
  for (let index = stack.length - 1; index >= 0; index--) {
249
251
  const dialog = stack[index]!;
250
- if (!dialog.isConnected || !dialog.open) stack.splice(index, 1);
252
+ if (dialog.isConnected && dialog.open) continue;
253
+ stack.splice(index, 1);
254
+ release(dialog);
251
255
  }
252
256
  stack.forEach((dialog, index) => {
253
257
  const depth = stack.length - 1 - index;
@@ -415,17 +419,24 @@ function keyboardInset(): number {
415
419
  * to `--_drawer-keyboard` (drawer.css pads the sheet by it, so its
416
420
  * content ends at the keyboard's top edge), holds the page at its scroll
417
421
  * position, and scrolls a focused field into the part of its scrolling slot
418
- * that is still visible.
422
+ * that is still visible. All of it stops once `alive` says the drawer is gone:
423
+ * a hold on the page that outlived its drawer would pin the next page.
419
424
  *
420
425
  * @param dialog - The drawer.
421
426
  * @param signal - Aborts when the drawer closes.
427
+ * @param alive - Whether the drawer is still open on the page; unbinds it when not.
422
428
  * @param onChange - Runs after the inset changes, once the new padding is in place.
423
429
  * @private
424
430
  */
425
- function trackKeyboard(dialog: HTMLDialogElement, signal: AbortSignal, onChange: () => void): void {
431
+ function trackKeyboard(
432
+ dialog: HTMLDialogElement,
433
+ signal: AbortSignal,
434
+ alive: () => boolean,
435
+ onChange: () => void,
436
+ ): void {
426
437
  const viewport = window.visualViewport;
427
438
  if (!viewport) return;
428
- const front = () => stack[stack.length - 1] === dialog;
439
+ const front = () => alive() && stack[stack.length - 1] === dialog;
429
440
  const pageX = window.scrollX;
430
441
  const pageY = window.scrollY;
431
442
  let frame = 0;
@@ -658,13 +669,24 @@ function bindDrawer(dialog: HTMLDialogElement): void {
658
669
  };
659
670
  };
660
671
 
672
+ /**
673
+ * Whether the drawer is still open on the page. A drawer removed while open
674
+ * (a navigation swap replaces the body) fires no `close`, so whatever it
675
+ * bound outside itself asks this first, and the first to ask unbinds it.
676
+ */
677
+ const alive = () => {
678
+ if (dialog.isConnected && dialog.open) return true;
679
+ unbindDrawer(dialog);
680
+ return false;
681
+ };
682
+
661
683
  bound.set(dialog, { controller, snapTo });
662
684
  if (inDrawerMode(dialog)) {
663
685
  measure();
664
686
  place();
665
687
  stack.push(dialog);
666
688
  restack();
667
- trackKeyboard(dialog, signal, () => {
689
+ trackKeyboard(dialog, signal, alive, () => {
668
690
  measure();
669
691
  place();
670
692
  });
@@ -700,7 +722,7 @@ function bindDrawer(dialog: HTMLDialogElement): void {
700
722
  window.addEventListener(
701
723
  "resize",
702
724
  () => {
703
- if (!stack.includes(dialog)) return;
725
+ if (!alive() || !stack.includes(dialog)) return;
704
726
  measure();
705
727
  place();
706
728
  },
@@ -757,12 +779,17 @@ function bindDrawer(dialog: HTMLDialogElement): void {
757
779
  });
758
780
  }
759
781
 
760
- /** Unbinds a drawer that closed. */
761
- function unbindDrawer(dialog: HTMLDialogElement): void {
782
+ /** Drops everything a drawer bound and wrote; its place in the stack is the caller's. */
783
+ function release(dialog: HTMLDialogElement): void {
762
784
  bound.get(dialog)?.controller.abort();
763
785
  bound.delete(dialog);
764
786
  dialog.removeAttribute("data-drawer-state");
765
787
  dialog.style.removeProperty("--_drawer-depth");
788
+ }
789
+
790
+ /** Unbinds a drawer that closed or left the page. */
791
+ function unbindDrawer(dialog: HTMLDialogElement): void {
792
+ release(dialog);
766
793
  const index = stack.indexOf(dialog);
767
794
  if (index < 0) return;
768
795
  stack.splice(index, 1);
@@ -805,6 +832,9 @@ const initDrawers: InitDrawersFn = function () {
805
832
  if (indented) measureIndent(indented);
806
833
  });
807
834
 
835
+ // a navigation swap removes open drawers without a close: let go of them
836
+ registerRefresh(() => restack());
837
+
808
838
  // drawers that were already open when the script loaded
809
839
  for (const dialog of document.querySelectorAll<HTMLDialogElement>(`${DRAWER}[open]`)) {
810
840
  bindDrawer(dialog);