@zazz-ui/core 0.14.2 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AUTHORING.md CHANGED
@@ -147,6 +147,8 @@ A region whose content depends on the page, such as a section sidebar, should no
147
147
  </html>
148
148
  ```
149
149
 
150
+ If the page also runs htmx or a client router, put `data-ui-navigation="off"` on the regions that library drives (the nearest `data-ui-navigation` ancestor wins), and call `Zazz.refresh(element)` after it inserts markup (`htmx.onLoad((el) => Zazz.refresh(el))`). Back and Forward into or out of an entry the page pushed with `history.pushState()`, or to one a script gave `history.state` (htmx's `{ htmx: true }`), are left to the page.
151
+
150
152
  `<ui-debug>` lists the persisted elements on each page and warns about a missing or duplicate id, nested persisted elements, and `data-ui-persist` on a page without the opt-in. It checks `data-ui-persist-scroll` the same way, and flags one that sits on or inside a `data-ui-persist` element, which already keeps its scroll.
151
153
 
152
154
  ## Theme
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
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.15.0 (2026-11-18)
4
+
5
+ ### base
6
+
7
+ - **BREAKING** With `data-ui-navigation="swap"`, Back and Forward swap only between entries the swap made. An entry the page pushed with `history.pushState()` (htmx's `hx-push-url` and `hx-boost`, a client router) is left to the page, going into it and coming out of it, and so is any entry a script gave `history.state` (htmx stamps the first entry it swaps on with `{ htmx: true }`). Swapping those raced the library's own restore. A page that pushes URLs without restoring them on `popstate` must now restore them itself.
8
+ - `data-ui-navigation="off"` on an ancestor of a link or form leaves its navigation to the browser (a full load, unless another library handles the click first). The nearest `data-ui-navigation` ancestor decides, so `swap` inside an opted-out region opts back in. It needs `NavigateEvent.sourceElement`; without it the attribute has no effect.
9
+ - New `Zazz.refresh(element)`, also `window.Zazz` and a named export of the entry module: runs the refresh hooks (reveal, attribute-form carousels, select-all checkboxes, sticky states, the drawer page indent) over markup another library inserted, the element itself included. With no argument it refreshes the whole body. For htmx: `htmx.onLoad((el) => Zazz.refresh(el))`.
10
+ - The swap remembers its history entries in `sessionStorage` (`zazz:navigation-entries`), so Back and Forward between swapped pages still swap after a reload.
11
+
12
+ ## 0.14.3 (2026-11-18)
13
+
14
+ ### base
15
+
16
+ - `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.
17
+
3
18
  ## 0.14.2 (2026-11-17)
4
19
 
5
20
  ### drawer
package/README.md CHANGED
@@ -4,7 +4,7 @@ Zazz is a CSS and vanilla JavaScript UI kit that does not require a build step.
4
4
 
5
5
  Docs: <https://zazz.sh> (guides, a [quick start](https://zazz.sh/docs/quick-start/), and an [API reference](https://zazz.sh/api/) generated from this package's data).
6
6
 
7
- **Zazz is in alpha (0.14).** The markup contract can change in any minor release before 1.0, and 0.5 and later are not compatible with 0.4; see [`CHANGELOG.md`](./CHANGELOG.md) for every breaking change and its migration note.
7
+ **Zazz is in alpha (0.15).** The markup contract can change in any minor release before 1.0, and 0.5 and later are not compatible with 0.4; see [`CHANGELOG.md`](./CHANGELOG.md) for every breaking change and its migration note.
8
8
 
9
9
  ## Install
10
10
 
@@ -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.2/dist/zazz.css" />
23
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@zazz-ui/core@0.15.0/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.2/dist/zazz.js"></script>
35
+ <script type="module" src="https://cdn.jsdelivr.net/npm/@zazz-ui/core@0.15.0/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.
@@ -0,0 +1 @@
1
+ import{a as e}from"./zazz-element-D1KYRPlU.js";const t=`data-ui-stuck`,n={top:`bottom`,right:`left`,bottom:`top`,left:`right`};let r=[],i,a=0;function o(e){for(let t=e.parentElement;t&&t!==document.body;t=t.parentElement){let{overflowX:e,overflowY:n}=getComputedStyle(t);if(/auto|scroll|hidden/.test(e+n))return t}return null}function s(e,{writingMode:t,direction:r}){let i=!t.startsWith(`horizontal`),a=i?t.endsWith(`lr`)?`left`:`right`:`top`,o=i?r===`rtl`?`bottom`:`top`:r===`rtl`?`right`:`left`,s=[];return e===a&&s.push(`block-start`),e===n[a]&&s.push(`block-end`),e===o&&s.push(`inline-start`),e===n[o]&&s.push(`inline-end`),s}function c(e,t){if(t.position!==`sticky`)return[];let n=o(e),r=n??document.scrollingElement??document.documentElement,i=n?(()=>{let e=n.getBoundingClientRect(),t=e.top+n.clientTop,r=e.left+n.clientLeft;return{top:t,left:r,bottom:t+n.clientHeight,right:r+n.clientWidth}})():{top:0,left:0,bottom:innerHeight,right:innerWidth},a=e.getBoundingClientRect(),s=r.scrollHeight-r.clientHeight,c=r.scrollWidth-r.clientWidth,l=getComputedStyle(r).direction===`rtl`,u=r.scrollLeft,d={top:r.scrollTop>0,bottom:r.scrollTop<s-.5,left:l?u>-c+.5:u>0,right:l?u<0:u<c-.5},f={top:a.top-i.top,bottom:i.bottom-a.bottom,left:a.left-i.left,right:i.right-a.right};return Object.keys(f).filter(e=>{let n=t[e];return n!==`auto`&&d[e]&&Math.abs(f[e]-Number.parseFloat(n))<1})}function l(){a=0;for(let e of r){let n=getComputedStyle(e),r=c(e,n).flatMap(e=>[e,...s(e,n)]).join(` `);r?e.getAttribute(t)!==r&&e.setAttribute(t,r):e.removeAttribute(t)}}function u(){a||=requestAnimationFrame(l)}function d(){if(i){for(let e of r)e.isConnected||e.removeAttribute(t);r=[...document.querySelectorAll(`[style*=": sticky"], [style*="--stuck-state:"]`)].filter(e=>e.querySelector(`[style*="--stuck:"]`)),u()}}function f(){return typeof CSS<`u`&&CSS.supports(`container-type`,`scroll-state`)}function p({force:e=!1}={}){if(i||!e&&f())return;i=new AbortController;let t={passive:!0,capture:!0,signal:i.signal};document.addEventListener(`scroll`,u,t),window.addEventListener(`resize`,u,t),d()}typeof window<`u`&&typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>p(),{once:!0}):p(),e(d));export{};
package/dist/sri.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "dist/csp-LRx1fynI.js": "sha384-s1Kg/1/tQobRsTf5BpAR3XeNmA3AkU7xfe6xdKivdk22yxstCs1ets32NeMMp9Av",
3
- "dist/scroll-state-C8mA5gq6.js": "sha384-m9uzgIAkSnk8Es+jgCbChIYFu4rPyr00IB7lrAR/8dcsPc3u75VA7Wq5LIEAvXpT",
3
+ "dist/scroll-state-D5Q3aRca.js": "sha384-ndrmIXoKRAH28dhO0GfgC1PGvOsRfTGIxGVvir3SFMGSq3+bSR0fiLtlhqOjgKRW",
4
+ "dist/zazz-element-D1KYRPlU.js": "sha384-7y5TQT4cko75zxEEldC7svWQSBZLYA8mdqrpOfnjClJSsmFlng8LOxeHzNgGD0IB",
4
5
  "dist/zazz.css": "sha384-X3Ks/hnhbGlszTutdOp54Jq2DR4xYNU51XBFmwc8N5BAxaFaA41gFouYgyezeaup",
5
- "dist/zazz.js": "sha384-j8tXatpYHPHBIc5jA1Iic/VZOhkAHI8oQhJPsIlDn5OX6mhg+7l+tr5+Yz3Af+U+",
6
+ "dist/zazz.js": "sha384-fdK7/zg68detgxrLnLQHvBtFgPxREpdyB679pQQRFJ1PxXW/ZZri1u1gN5Tmyerr",
6
7
  "src/base/_breakpoints.css": "sha384-vsvdoL+ZjTa5gyCiMp4DlNIbr9rxkLqfQjZ+W3YTp2Apuuu+1/Dd68ACtcBOip3v",
7
8
  "src/base/_defaults.css": "sha384-B0qvVNCJK5NWeEuEdB89lHXg9fIpKkU/wPCvONGtmhfFdEw8SclyssDYW2dWly3X",
8
9
  "src/base/_layers.css": "sha384-+muc9Umj4iangP79BNjiCidmgTfGe7w41/GR/ZW14yuBb+b5MnrPpWrYu99Ontr8",
@@ -62,7 +63,7 @@
62
63
  "src/base/gesture.js": "sha384-43cNAXoiBk1ThbxgglTRJryv3crJvbP+wUDcdWOp9YGJGnH/oG3CdEmjV0Ftfm72",
63
64
  "src/base/hotkeys.js": "sha384-THU0JbWwkM9QAVJ2BwF5rwGHOIhCPLKHxfhmixYyyCBU0eNRi9kz6VxfNGaj8D8O",
64
65
  "src/base/kit-styling.js": "sha384-9b+AADFSMagkBZnofRinoF5NX9jNI8lmIRt0x8iam7X/cTM1ecU13j+p9NBoufTM",
65
- "src/base/navigation.js": "sha384-JWy/CrNzTkdI/TIL2KtRTgq5fFajcAqAgf9wJbgVUnRM346ZGSbJ/xXHOc2A4hgU",
66
+ "src/base/navigation.js": "sha384-peFuwYvtmPEtZR/b4K4Dcej5zKmKl5wtoqYbSL7F3oG60LleUXC3LBcti4nQ1czJ",
66
67
  "src/base/reveal.js": "sha384-UYiDoNgXsINWTIabv/STaj1+zfP3OSe1vBgkxTWup51l0HQE1PgsRtQDpPAHOPHC",
67
68
  "src/base/scroll-state.js": "sha384-ql6E3qGCmO5nKrmORbRCrU9bVlbIpcYvQq+zr26VZhRNHdnqNuJGH9mK0hXy1vG1",
68
69
  "src/base/signals.js": "sha384-N4p17bKbP9wixbRP1y8qH7XQ+FGKNzyFLMd63FCDE8qz3UKRx8csEQTLGodDCRBi",
@@ -70,10 +71,10 @@
70
71
  "src/base/typeahead.js": "sha384-jh0mIkDn2KiL9y+7vBq8hPXymo+yXd0d4PG4dUHq29B3NEvOmnxinqaxTyoPWUiV",
71
72
  "src/base/utilities.js": "sha384-/bREfylmbbEKfS1OMLpBtTP8dZZ4YVgJuXmY5k7bT15b2G0m0ijJyni9bJu0YgaP",
72
73
  "src/base/utils.js": "sha384-LYgZQdVhTZM9VrjMl/pn8005MC3zL6kqOodJEs4Xi0fPysol71QaYnq9egqgrUfh",
73
- "src/base/zazz-element.js": "sha384-dTk+HZujh1qWzZBaxgcZA1t01lvr311gYirU4RGX8utXCpTEGWGfiE28XGjBIAos",
74
- "src/head.js": "sha384-a1tYQhmmp7O/q6gEhWsRRuXzwEqByLKl5dAkbUkKf7HaPBqjpL4NeW2tc6Kt0yR6",
74
+ "src/base/zazz-element.js": "sha384-V1zlYqvu5n0tPt0Ts8I4N06v0pSpA0Sbl9V/ayxJH8PBDJoqsrFrziGKt+IXqOQn",
75
+ "src/head.js": "sha384-qsFhpXZXDDB5uTe1cZoUHo+Swt85lXYGdPK8G0d9qRiSJBwNgfmSRjH10MJUEUxH",
75
76
  "src/index.css": "sha384-mLMa5WjyDJiRcvPK0LtP83sWR2GPTC7Koay4v7F1iR5NgU4o/T/q2Uab7GCJKLh9",
76
- "src/index.js": "sha384-tKxj7/ptI/LHsCebZAPCQPAtgmVoUEnwfTcBPRBlOfb86vQJM98GNaG4P+jtGR+S",
77
+ "src/index.js": "sha384-RgLYTG8W0pqY5mOitIFeqaoejabS/Je9uu7lDJopbddVtZbVOZ5A32mctNA80ArW",
77
78
  "src/manifest.js": "sha384-SK7NTDFsKfOYUSrAAPSat0MpAga/4RgGb0PnfVEB/wMLYlLGh6zW2VJCQRL4fycV",
78
79
  "src/primitives/accordion/accordion.css": "sha384-e3cqAIMjloFAooyyZ1eVKClJ3eJTziFpUcgqRe8q3ZjZVw6VpALzKFQhgh6nmdt2",
79
80
  "src/primitives/alert-dialog/alert-dialog.css": "sha384-9m0LO7yTIgUFeP4UV4NrrbHRmRpfsTobK6PU+FZ0QnWuPeiU+gXvAVGyzaCAB72M",
@@ -0,0 +1 @@
1
+ var e=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 t(e,t){typeof window<`u`&&(customElements.get(e)||customElements.define(e,t))}const n=[];function r(e){n.push(e)}function i(e){for(let t of n)t(e)}function a(e){i(e?e.parentElement??e:document.body)}const o={refresh:a};typeof window<`u`&&(window.Zazz=o);export{r as a,i,e as n,t as r,o as t};
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),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};
1
+ import{a as e,i as t,n,r,t as i}from"./zazz-element-D1KYRPlU.js";import{Signal as a}from"signal-polyfill";function o(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 s={parseValue:o,parseDataAttributes:(e,t)=>{let n={};for(let r of e.attributes)if(r.name.startsWith(t)){let e=r.name.replace(t,``).replace(/-([a-z])/g,(e,t)=>t.toUpperCase());n[e]=o(r.value)}return n}};typeof window<`u`&&(window.Utils=s);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 t=null,n=()=>{t||=new d};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,n):n(),e(()=>d.getAutoInstance()?.refresh()),d.disableAutoInit=()=>{t=`disabled`},d.getAutoInstance=()=>t===`disabled`?null:t}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,]+/),n=t.includes(`auto-scroll`)?`auto-scroll`:t.includes(`autoplay`)?`autoplay`:null;if(!n)return null;let r=s.parseDataAttributes(e,n===`autoplay`?`data-carousel-autoplay-`:`data-carousel-auto-scroll-`),i=(e,t)=>typeof e==`number`&&e>=0?e:t;return{mode:n,delay:i(r.delay,4e3),speed:i(r.speed,2),startDelay:i(r.startDelay,1e3),backward:r.direction===`backward`,playOnInit:r.playOnInit!==!1,stopOnInteraction:r.stopOnInteraction!==!1,stopOnMouseEnter:r.stopOnMouseEnter===!0,stopOnLastSnap:r.stopOnLastSnap===!0}}function S(e,t,n,r={}){let i=t.querySelector(`[data-carousel-slot~="container"]`);if(!i)return null;let a=[...i.querySelectorAll(`:scope > [data-carousel-slot~="slide"]`)],{prefix:o=`data-carousel-`,defaults:c={},controls:l=!0}=r,u=s.parseDataAttributes(e,o),d=(e,t)=>typeof e==`boolean`?e:t,f={loop:d(u.loop,c.loop??!1)&&a.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=a.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,o=k(),s=O(),c=E(),l=0,u=`start`,d=a.map((t,n)=>{let a=t.getBoundingClientRect(),d=ve(a);n===0&&(l=d);let f=_e(a,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(o,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?a.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:n}),N.push(e)}Te.append(...N)}},Oe=e=>{let t=M(e),n=new Set(j()[e]?.slides??[]);a.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;a.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=a[n],o=t.getBoundingClientRect(),s=_e(i.getBoundingClientRect(),o),c=r?++F:F;r&&(re=!0,b(t,`settling`,!0)),a.forEach((t,n)=>{v[n]!==e[n]&&(t.style.order=String(e[n]))}),v=e;let l=_e(i.getBoundingClientRect(),o)-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(a.length,e,ce(a.length,Ce())),e,t),je=()=>{let e=t.getBoundingClientRect(),n=O(),r=1/0,i=-1/0;return a.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:n}),`onscrollend`in window)t.addEventListener(`scrollend`,R,{signal:n});else{let e=0;t.addEventListener(`scroll`,()=>{clearTimeout(e),e=window.setTimeout(R,120)},{passive:!0,signal:n}),n.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=a.length,r=(_==null?null:te)??M(t),i=(r+e+n)%n,o=v[r]+e,s=je(),c=le(n,s,{first:o-h.back,last:o+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:n});B&&(t.addEventListener(`pointerup`,()=>{Fe||Ue(`pointer`)},{signal:n}),t.addEventListener(`focusin`,e=>{e.target!==t&&He(`focus`)},{signal:n}),t.addEventListener(`focusout`,e=>{e.relatedTarget instanceof Node&&t.contains(e.relatedTarget)||Ue(`focus`)},{signal:n}),B.stopOnMouseEnter&&(e.addEventListener(`mouseenter`,()=>He(`hover`),{signal:n}),e.addEventListener(`mouseleave`,()=>Ue(`hover`),{signal:n})),document.addEventListener(`visibilitychange`,()=>q(),{signal:n}));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),i.style.translate&&E()>=k()-1&&i.addEventListener(`transitionend`,()=>{!S&&!Y&&_==null&&A(k())},{once:!0,signal:n}),i.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:n,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);i.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:n}));let Ye=new IntersectionObserver(e=>{ne=new Set(ne);for(let t of e){let e=a.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`});a.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),a.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=a[e];if(!r)return;let i=E(),o=_e(r.getBoundingClientRect(),t.getBoundingClientRect())+i,s=o+ve(r.getBoundingClientRect()),c=ge(o<i?o: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,r]of[[`prev`,-1],[`next`,1]])e.querySelector(`[data-carousel-slot~="${t}"]`)?.addEventListener(`click`,()=>{Q.interact(),Ne(r)},{signal:n});b(t,`free`,f.dragFree),De(),f.loop&&I(f.startSnap%a.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()),n.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),i.style.translate=``;for(let e of a)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`){e(e=>T(e));let t=()=>{T(),pe(),D(),E()};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,t):t(),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(e,t){return new a.State(e,t)}function Se(e,t){return new a.Computed(e,t)}let Ce=!0;const M=new a.subtle.Watcher(()=>{Ce&&(Ce=!1,queueMicrotask(we))});function we(){Ce=!0;for(let e of M.getPending())e.get();M.watch()}function N(e,t={}){let n,r=!1,i=new a.Computed(()=>{typeof n==`function`&&n(),n=e()});M.watch(i),i.get();let o=()=>{r||(r=!0,M.unwatch(i),typeof n==`function`&&n(),n=void 0)};return t.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 n{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`))}}}};r(`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),e(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)}r(`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)}r(`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 n{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}};r(`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)}),e(()=>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()),r(`ui-lightbox`,class extends n{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())}}),r(`ui-menu`,class extends n{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}r(`ui-otp`,class extends n{#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}}r(`ui-password`,class extends n{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;r(`ui-multiselect`,class extends n{#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}}}),r(`ui-tabs`,class extends n{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 n{#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)}};r(`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,n=`zazz:navigation-entries`,r=/* @__PURE__ */ new Set,i=e=>{if(!e)return!1;if(r.has(e))return!0;try{return JSON.parse(sessionStorage.getItem(n)??`[]`).includes(e)}catch{return!1}},a=e=>{if(e&&!i(e)){r.add(e);try{let t=JSON.parse(sessionStorage.getItem(n)??`[]`);sessionStorage.setItem(n,JSON.stringify([...t,e]))}catch{}}};a(window.navigation.currentEntry?.key);function o(t){e=t,location.replace(t)}window.navigation.addEventListener(`navigate`,n=>{e!==null&&n.destination.url===e?e=null:!Tt(document)||n.sourceElement?.closest(`[data-ui-navigation]`)?.getAttribute(`data-ui-navigation`)===`off`||n.destination.sameDocument&&n.navigationType===`traverse`&&!(i(n.destination.key)&&i(window.navigation.currentEntry?.key))||!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(){if(a(window.navigation.currentEntry?.key),n.navigationType===`traverse`&&(await new Promise(e=>setTimeout(e,0)),n.signal.aborted||history.state!=null))return;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;o(n.destination.url);return}if(n.signal.aborted)return;if(!Tt(e)||!(e.body instanceof HTMLElement)){o(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()},s=Nt();if(document.startViewTransition)try{await document.startViewTransition(i).finished}finally{s()}else try{i()}finally{requestAnimationFrame(()=>requestAnimationFrame(s))}t(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-D5Q3aRca.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{i as Zazz};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zazz-ui/core",
3
- "version": "0.14.2",
3
+ "version": "0.15.0",
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",
@@ -1 +1 @@
1
- {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["navigation.ts"],"names":[],"mappings":"AA8FA;;;;;;;;;GASG;AACH,iBAAS,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,CAgDhD;AAKD;;;;;;;;;GASG;AACH,iBAAe,WAAW,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsCpE;AA6JD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["navigation.ts"],"names":[],"mappings":"AAyGA;;;;;;;;;GASG;AACH,iBAAS,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,CAgDhD;AAKD;;;;;;;;;GASG;AACH,iBAAe,WAAW,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsCpE;AAkND,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC"}
@@ -35,6 +35,17 @@ import { refreshAll } from "./zazz-element.js";
35
35
  * `_view-transitions.css` then styles. Reloads, hash changes, downloads and
36
36
  * form posts are never intercepted.
37
37
  *
38
+ * Another library that drives navigation (htmx, Turbo, a client router) keeps
39
+ * its own. A link or form inside `data-ui-navigation="off"` gets the browser's
40
+ * default, and the nearest `data-ui-navigation` ancestor decides. Entries the
41
+ * page pushed with `history.pushState()` stay the page's: Back or Forward into
42
+ * or out of one is never swapped, so the library restores it on `popstate`.
43
+ * So does an entry the swap made once a script gives it `history.state` (htmx
44
+ * stamps the entry it first swaps on with `{ htmx: true }`): its Back and
45
+ * Forward are left to that script.
46
+ * Markup the library swaps in reaches the refresh hooks through
47
+ * `Zazz.refresh(scope)` (`base/zazz-element.ts`).
48
+ *
38
49
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Navigation_API
39
50
  * @see https://developer.mozilla.org/en-US/docs/Web/API/NavigateEvent/scroll
40
51
  */
@@ -262,6 +273,41 @@ if ("navigation" in window) {
262
273
  * leave Back pointing at a page that no longer exists.
263
274
  */
264
275
  let bypassUrl = null;
276
+ /**
277
+ * Keys of the history entries this module made: each one a document loaded
278
+ * into, and each one a swap committed. A same-document entry with any other
279
+ * key came from the page's own `history.pushState()` (htmx's `hx-push-url`,
280
+ * a router), and the page restores those itself on `popstate`. The keys live
281
+ * in `sessionStorage` because a reload keeps the older entries same-document
282
+ * with the new page; where storage is blocked they last as long as the page.
283
+ */
284
+ const ENTRIES = "zazz:navigation-entries";
285
+ const ownEntries = new Set();
286
+ const owns = (key) => {
287
+ if (!key)
288
+ return false;
289
+ if (ownEntries.has(key))
290
+ return true;
291
+ try {
292
+ return JSON.parse(sessionStorage.getItem(ENTRIES) ?? "[]").includes(key);
293
+ }
294
+ catch {
295
+ return false;
296
+ }
297
+ };
298
+ const own = (key) => {
299
+ if (!key || owns(key))
300
+ return;
301
+ ownEntries.add(key);
302
+ try {
303
+ const keys = JSON.parse(sessionStorage.getItem(ENTRIES) ?? "[]");
304
+ sessionStorage.setItem(ENTRIES, JSON.stringify([...keys, key]));
305
+ }
306
+ catch {
307
+ // Blocked or full storage: the in-memory set still covers this page.
308
+ }
309
+ };
310
+ own(window.navigation.currentEntry?.key);
265
311
  function fullLoad(url) {
266
312
  bypassUrl = url;
267
313
  location.replace(url);
@@ -275,7 +321,16 @@ if ("navigation" in window) {
275
321
  // push or replace is history.pushState() / replaceState(): the page is
276
322
  // updating its own URL (a filter, a share code), not leaving. Back and
277
323
  // Forward stay swaps: after one, every entry shares this document.
324
+ // Back and Forward are ours only between entries we made: a traversal into
325
+ // or out of an entry the page pushed is the page's to restore. A link,
326
+ // form or region under `data-ui-navigation="off"` (an htmx-boosted area, a
327
+ // client router's outlet) always gets the browser's default.
278
328
  if (!optedIn(document) ||
329
+ e.sourceElement?.closest("[data-ui-navigation]")?.getAttribute("data-ui-navigation") ===
330
+ "off" ||
331
+ (e.destination.sameDocument &&
332
+ e.navigationType === "traverse" &&
333
+ !(owns(e.destination.key) && owns(window.navigation.currentEntry?.key))) ||
279
334
  !e.canIntercept ||
280
335
  e.navigationType === "reload" ||
281
336
  (e.destination.sameDocument && e.navigationType !== "traverse") ||
@@ -288,6 +343,19 @@ if ("navigation" in window) {
288
343
  }
289
344
  e.intercept({
290
345
  async handler() {
346
+ // The navigation has committed: the current entry is the destination.
347
+ own(window.navigation.currentEntry?.key);
348
+ // Back or Forward to an entry carrying `history.state` goes to the script
349
+ // that wrote it. The swap never writes any, so a script stamped this
350
+ // entry to restore it: htmx's `{ htmx: true }`, which its own navigate
351
+ // handler swaps in. Swapping too would race it. WebKit updates
352
+ // `history.state` only at `popstate`, after the handler starts, so read
353
+ // it one task later.
354
+ if (e.navigationType === "traverse") {
355
+ await new Promise((settled) => setTimeout(settled, 0));
356
+ if (e.signal.aborted || history.state != null)
357
+ return;
358
+ }
291
359
  let doc;
292
360
  try {
293
361
  const res = await fetch(e.destination.url, { signal: e.signal });
@@ -37,6 +37,17 @@ import { refreshAll } from "./zazz-element.ts";
37
37
  * `_view-transitions.css` then styles. Reloads, hash changes, downloads and
38
38
  * form posts are never intercepted.
39
39
  *
40
+ * Another library that drives navigation (htmx, Turbo, a client router) keeps
41
+ * its own. A link or form inside `data-ui-navigation="off"` gets the browser's
42
+ * default, and the nearest `data-ui-navigation` ancestor decides. Entries the
43
+ * page pushed with `history.pushState()` stay the page's: Back or Forward into
44
+ * or out of one is never swapped, so the library restores it on `popstate`.
45
+ * So does an entry the swap made once a script gives it `history.state` (htmx
46
+ * stamps the entry it first swaps on with `{ htmx: true }`): its Back and
47
+ * Forward are left to that script.
48
+ * Markup the library swaps in reaches the refresh hooks through
49
+ * `Zazz.refresh(scope)` (`base/zazz-element.ts`).
50
+ *
40
51
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Navigation_API
41
52
  * @see https://developer.mozilla.org/en-US/docs/Web/API/NavigateEvent/scroll
42
53
  */
@@ -266,6 +277,37 @@ if ("navigation" in window) {
266
277
  */
267
278
  let bypassUrl: string | null = null;
268
279
 
280
+ /**
281
+ * Keys of the history entries this module made: each one a document loaded
282
+ * into, and each one a swap committed. A same-document entry with any other
283
+ * key came from the page's own `history.pushState()` (htmx's `hx-push-url`,
284
+ * a router), and the page restores those itself on `popstate`. The keys live
285
+ * in `sessionStorage` because a reload keeps the older entries same-document
286
+ * with the new page; where storage is blocked they last as long as the page.
287
+ */
288
+ const ENTRIES = "zazz:navigation-entries";
289
+ const ownEntries = new Set<string>();
290
+ const owns = (key: string | undefined): boolean => {
291
+ if (!key) return false;
292
+ if (ownEntries.has(key)) return true;
293
+ try {
294
+ return (JSON.parse(sessionStorage.getItem(ENTRIES) ?? "[]") as string[]).includes(key);
295
+ } catch {
296
+ return false;
297
+ }
298
+ };
299
+ const own = (key: string | undefined): void => {
300
+ if (!key || owns(key)) return;
301
+ ownEntries.add(key);
302
+ try {
303
+ const keys = JSON.parse(sessionStorage.getItem(ENTRIES) ?? "[]") as string[];
304
+ sessionStorage.setItem(ENTRIES, JSON.stringify([...keys, key]));
305
+ } catch {
306
+ // Blocked or full storage: the in-memory set still covers this page.
307
+ }
308
+ };
309
+ own(window.navigation.currentEntry?.key);
310
+
269
311
  function fullLoad(url: string): void {
270
312
  bypassUrl = url;
271
313
  location.replace(url);
@@ -281,8 +323,17 @@ if ("navigation" in window) {
281
323
  // push or replace is history.pushState() / replaceState(): the page is
282
324
  // updating its own URL (a filter, a share code), not leaving. Back and
283
325
  // Forward stay swaps: after one, every entry shares this document.
326
+ // Back and Forward are ours only between entries we made: a traversal into
327
+ // or out of an entry the page pushed is the page's to restore. A link,
328
+ // form or region under `data-ui-navigation="off"` (an htmx-boosted area, a
329
+ // client router's outlet) always gets the browser's default.
284
330
  if (
285
331
  !optedIn(document) ||
332
+ e.sourceElement?.closest("[data-ui-navigation]")?.getAttribute("data-ui-navigation") ===
333
+ "off" ||
334
+ (e.destination.sameDocument &&
335
+ e.navigationType === "traverse" &&
336
+ !(owns(e.destination.key) && owns(window.navigation.currentEntry?.key))) ||
286
337
  !e.canIntercept ||
287
338
  e.navigationType === "reload" ||
288
339
  (e.destination.sameDocument && e.navigationType !== "traverse") ||
@@ -297,6 +348,19 @@ if ("navigation" in window) {
297
348
 
298
349
  e.intercept({
299
350
  async handler() {
351
+ // The navigation has committed: the current entry is the destination.
352
+ own(window.navigation.currentEntry?.key);
353
+
354
+ // Back or Forward to an entry carrying `history.state` goes to the script
355
+ // that wrote it. The swap never writes any, so a script stamped this
356
+ // entry to restore it: htmx's `{ htmx: true }`, which its own navigate
357
+ // handler swaps in. Swapping too would race it. WebKit updates
358
+ // `history.state` only at `popstate`, after the handler starts, so read
359
+ // it one task later.
360
+ if (e.navigationType === "traverse") {
361
+ await new Promise((settled) => setTimeout(settled, 0));
362
+ if (e.signal.aborted || history.state != null) return;
363
+ }
300
364
  let doc: Document;
301
365
  try {
302
366
  const res = await fetch(e.destination.url, { signal: e.signal });
@@ -16,7 +16,8 @@
16
16
  * **The refresh registry** lets navigation.ts re-scan swapped content without
17
17
  * naming components: a module whose work is scoped to page content (reveal observer, class-form
18
18
  * carousel init) registers a refresh hook, and after a navigation swap the
19
- * navigation module calls `refreshAll(newMain)`.
19
+ * navigation module calls `refreshAll(newMain)`. Content another library swaps
20
+ * in reaches the same hooks through the public `Zazz.refresh(scope)`.
20
21
  * Custom elements do not need hooks: their lifecycle rides the swap natively.
21
22
  */
22
23
  /** Base class for Zazz HTML web components: lifecycle envelope only. */
@@ -46,5 +47,30 @@ type RefreshHook = (scope: Element) => void;
46
47
  declare function registerRefresh(hook: RefreshHook): void;
47
48
  /** @description Runs every registered refresh hook against a swapped-in scope. */
48
49
  declare function refreshAll(scope: Element): void;
49
- export { ZazzElement, defineZazzElement, registerRefresh, refreshAll };
50
+ /**
51
+ * @description Runs every refresh hook over `scope` and its descendants, or
52
+ * over the whole body without one. Hooks search below the scope they get, so
53
+ * they get the scope's parent: an element htmx swapped in whole (`outerHTML`)
54
+ * is itself found. Hooks are idempotent, so the siblings they also see are
55
+ * skipped.
56
+ *
57
+ * @param scope - The element whose markup changed.
58
+ */
59
+ declare function refresh(scope?: Element): void;
60
+ /**
61
+ * @namespace Zazz
62
+ * @description The runtime API for pages whose content changes without a Zazz
63
+ * navigation. After htmx, Turbo, or any script inserts markup, pass the new
64
+ * element to `refresh` so page-scoped behavior (reveal, attribute-form
65
+ * carousels, select-all checkboxes, sticky states, the drawer page indent)
66
+ * picks it up: `htmx.onLoad((el) => Zazz.refresh(el))`. A select-all group
67
+ * counts only the boxes it can see, so when rows change under a header box,
68
+ * pass the element that holds both.
69
+ *
70
+ * @property refresh - Runs every refresh hook over an element, or the body.
71
+ */
72
+ declare const Zazz: {
73
+ refresh: typeof refresh;
74
+ };
75
+ export { Zazz, ZazzElement, defineZazzElement, registerRefresh, refreshAll };
50
76
  //# sourceMappingURL=zazz-element.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"zazz-element.d.ts","sourceRoot":"","sources":["zazz-element.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,wEAAwE;AACxE,uBAAe,WAAY,SAAQ,WAAW;;IAG5C,iBAAiB,IAAI,IAAI,CAIxB;IAED;;;;OAIG;IACH,qBAAqB,IAAI,IAAI,CAAG;IAEhC,oBAAoB,IAAI,IAAI,CAI3B;IAED,6EAA6E;IAC7E,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAEpD,+EAA+E;IAC/E,SAAS,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC;CAC7B;AAED,uEAAuE;AACvE,iBAAS,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,wBAAwB,GAAG,IAAI,CAG3E;AAID,KAAK,WAAW,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;AAG5C;;;;GAIG;AACH,iBAAS,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAEhD;AAED,kFAAkF;AAClF,iBAAS,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAExC;AAED,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"zazz-element.d.ts","sourceRoot":"","sources":["zazz-element.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,wEAAwE;AACxE,uBAAe,WAAY,SAAQ,WAAW;;IAG5C,iBAAiB,IAAI,IAAI,CAIxB;IAED;;;;OAIG;IACH,qBAAqB,IAAI,IAAI,CAAG;IAEhC,oBAAoB,IAAI,IAAI,CAI3B;IAED,6EAA6E;IAC7E,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAEpD,+EAA+E;IAC/E,SAAS,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC;CAC7B;AAED,uEAAuE;AACvE,iBAAS,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,wBAAwB,GAAG,IAAI,CAG3E;AAID,KAAK,WAAW,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;AAG5C;;;;GAIG;AACH,iBAAS,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAEhD;AAED,kFAAkF;AAClF,iBAAS,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAExC;AAED;;;;;;;;GAQG;AACH,iBAAS,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAEtC;AAED;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,IAAI;;CAAc,CAAC;AAQzB,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAE,CAAC"}
@@ -17,7 +17,8 @@
17
17
  * **The refresh registry** lets navigation.ts re-scan swapped content without
18
18
  * naming components: a module whose work is scoped to page content (reveal observer, class-form
19
19
  * carousel init) registers a refresh hook, and after a navigation swap the
20
- * navigation module calls `refreshAll(newMain)`.
20
+ * navigation module calls `refreshAll(newMain)`. Content another library swaps
21
+ * in reaches the same hooks through the public `Zazz.refresh(scope)`.
21
22
  * Custom elements do not need hooks: their lifecycle rides the swap natively.
22
23
  */
23
24
  /** Base class for Zazz HTML web components: lifecycle envelope only. */
@@ -62,4 +63,34 @@ function refreshAll(scope) {
62
63
  for (const hook of refreshHooks)
63
64
  hook(scope);
64
65
  }
65
- export { ZazzElement, defineZazzElement, registerRefresh, refreshAll };
66
+ /**
67
+ * @description Runs every refresh hook over `scope` and its descendants, or
68
+ * over the whole body without one. Hooks search below the scope they get, so
69
+ * they get the scope's parent: an element htmx swapped in whole (`outerHTML`)
70
+ * is itself found. Hooks are idempotent, so the siblings they also see are
71
+ * skipped.
72
+ *
73
+ * @param scope - The element whose markup changed.
74
+ */
75
+ function refresh(scope) {
76
+ refreshAll(scope ? (scope.parentElement ?? scope) : document.body);
77
+ }
78
+ /**
79
+ * @namespace Zazz
80
+ * @description The runtime API for pages whose content changes without a Zazz
81
+ * navigation. After htmx, Turbo, or any script inserts markup, pass the new
82
+ * element to `refresh` so page-scoped behavior (reveal, attribute-form
83
+ * carousels, select-all checkboxes, sticky states, the drawer page indent)
84
+ * picks it up: `htmx.onLoad((el) => Zazz.refresh(el))`. A select-all group
85
+ * counts only the boxes it can see, so when rows change under a header box,
86
+ * pass the element that holds both.
87
+ *
88
+ * @property refresh - Runs every refresh hook over an element, or the body.
89
+ */
90
+ const Zazz = { refresh };
91
+ // Attach to window for the documented public API (`window.Zazz`), and export
92
+ // for module consumers (`index.ts` re-exports it).
93
+ if (typeof window !== "undefined") {
94
+ window.Zazz = Zazz;
95
+ }
96
+ export { Zazz, ZazzElement, defineZazzElement, registerRefresh, refreshAll };
@@ -18,7 +18,8 @@
18
18
  * **The refresh registry** lets navigation.ts re-scan swapped content without
19
19
  * naming components: a module whose work is scoped to page content (reveal observer, class-form
20
20
  * carousel init) registers a refresh hook, and after a navigation swap the
21
- * navigation module calls `refreshAll(newMain)`.
21
+ * navigation module calls `refreshAll(newMain)`. Content another library swaps
22
+ * in reaches the same hooks through the public `Zazz.refresh(scope)`.
22
23
  * Custom elements do not need hooks: their lifecycle rides the swap natively.
23
24
  */
24
25
 
@@ -77,4 +78,37 @@ function refreshAll(scope: Element): void {
77
78
  for (const hook of refreshHooks) hook(scope);
78
79
  }
79
80
 
80
- export { ZazzElement, defineZazzElement, registerRefresh, refreshAll };
81
+ /**
82
+ * @description Runs every refresh hook over `scope` and its descendants, or
83
+ * over the whole body without one. Hooks search below the scope they get, so
84
+ * they get the scope's parent: an element htmx swapped in whole (`outerHTML`)
85
+ * is itself found. Hooks are idempotent, so the siblings they also see are
86
+ * skipped.
87
+ *
88
+ * @param scope - The element whose markup changed.
89
+ */
90
+ function refresh(scope?: Element): void {
91
+ refreshAll(scope ? (scope.parentElement ?? scope) : document.body);
92
+ }
93
+
94
+ /**
95
+ * @namespace Zazz
96
+ * @description The runtime API for pages whose content changes without a Zazz
97
+ * navigation. After htmx, Turbo, or any script inserts markup, pass the new
98
+ * element to `refresh` so page-scoped behavior (reveal, attribute-form
99
+ * carousels, select-all checkboxes, sticky states, the drawer page indent)
100
+ * picks it up: `htmx.onLoad((el) => Zazz.refresh(el))`. A select-all group
101
+ * counts only the boxes it can see, so when rows change under a header box,
102
+ * pass the element that holds both.
103
+ *
104
+ * @property refresh - Runs every refresh hook over an element, or the body.
105
+ */
106
+ const Zazz = { refresh };
107
+
108
+ // Attach to window for the documented public API (`window.Zazz`), and export
109
+ // for module consumers (`index.ts` re-exports it).
110
+ if (typeof window !== "undefined") {
111
+ window.Zazz = Zazz;
112
+ }
113
+
114
+ export { Zazz, ZazzElement, defineZazzElement, registerRefresh, refreshAll };
package/src/globals.d.ts CHANGED
@@ -16,25 +16,6 @@ interface Element {
16
16
  _carouselController?: AbortController;
17
17
  }
18
18
 
19
- /** @see https://developer.mozilla.org/en-US/docs/Web/API/Navigation_API */
20
- interface NavigationDestination {
21
- url: string;
22
- }
23
-
24
- interface NavigateEvent extends Event {
25
- canIntercept: boolean;
26
- hashChange: boolean;
27
- downloadRequest: unknown;
28
- formData: FormData | null;
29
- destination: NavigationDestination;
30
- intercept(options: { handler: () => Promise<void> }): void;
31
- scroll(): void;
32
- }
33
-
34
- interface Navigation extends EventTarget {
35
- addEventListener(type: "navigate", listener: (event: NavigateEvent) => void): void;
36
- }
37
-
38
19
  /**
39
20
  * Invoker Commands API (command/commandfor). Native in Chromium 135+; the
40
21
  * invokers polyfill dispatches a compatible event. Declared here (as interface
@@ -109,8 +90,14 @@ interface SignalsNamespace {
109
90
  effect(callback: () => void | (() => void), options?: { signal?: AbortSignal }): () => void;
110
91
  }
111
92
 
93
+ interface ZazzNamespace {
94
+ /** Runs every refresh hook over `scope` and its descendants (the body without one): markup inserted without a Zazz navigation. */
95
+ refresh(scope?: Element): void;
96
+ }
97
+
112
98
  interface Window {
113
- navigation: Navigation;
99
+ /** Set by zazz-element.js — the runtime API for content other libraries swap in. */
100
+ Zazz: ZazzNamespace;
114
101
  Utils: UtilsNamespace;
115
102
  /** Set by signals.js — the TC39 signals wrapper (state/computed/effect). */
116
103
  Signals: SignalsNamespace;
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
  /**
package/src/index.d.ts CHANGED
@@ -34,4 +34,5 @@ import "./primitives/select/multiselect.ts";
34
34
  import "./primitives/tabs/tabs.ts";
35
35
  import "./primitives/toaster/toaster.ts";
36
36
  import "./base/navigation.ts";
37
+ export { Zazz } from "./base/zazz-element.ts";
37
38
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,iBAAiB,CAAC;AACzB,OAAO,kBAAkB,CAAC;AAC1B,OAAO,4BAA4B,CAAC;AACpC,OAAO,oBAAoB,CAAC;AAC5B,OAAO,2CAA2C,CAAC;AACnD,OAAO,mCAAmC,CAAC;AAC3C,OAAO,mCAAmC,CAAC;AAC3C,OAAO,iCAAiC,CAAC;AACzC,OAAO,mCAAmC,CAAC;AAC3C,OAAO,+BAA+B,CAAC;AACvC,OAAO,mCAAmC,CAAC;AAC3C,OAAO,2BAA2B,CAAC;AACnC,OAAO,yBAAyB,CAAC;AACjC,OAAO,+CAA+C,CAAC;AACvD,OAAO,oCAAoC,CAAC;AAC5C,OAAO,2BAA2B,CAAC;AACnC,OAAO,iCAAiC,CAAC;AACzC,OAAO,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,iBAAiB,CAAC;AACzB,OAAO,kBAAkB,CAAC;AAC1B,OAAO,4BAA4B,CAAC;AACpC,OAAO,oBAAoB,CAAC;AAC5B,OAAO,2CAA2C,CAAC;AACnD,OAAO,mCAAmC,CAAC;AAC3C,OAAO,mCAAmC,CAAC;AAC3C,OAAO,iCAAiC,CAAC;AACzC,OAAO,mCAAmC,CAAC;AAC3C,OAAO,+BAA+B,CAAC;AACvC,OAAO,mCAAmC,CAAC;AAC3C,OAAO,2BAA2B,CAAC;AACnC,OAAO,yBAAyB,CAAC;AACjC,OAAO,+CAA+C,CAAC;AACvD,OAAO,oCAAoC,CAAC;AAC5C,OAAO,2BAA2B,CAAC;AACnC,OAAO,iCAAiC,CAAC;AACzC,OAAO,sBAAsB,CAAC;AAI9B,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC"}
package/src/index.js CHANGED
@@ -34,6 +34,9 @@ import "./primitives/select/multiselect.js";
34
34
  import "./primitives/tabs/tabs.js";
35
35
  import "./primitives/toaster/toaster.js";
36
36
  import "./base/navigation.js";
37
+ // The runtime API (also `window.Zazz`): `Zazz.refresh(scope)` after another
38
+ // library swaps content in.
39
+ export { Zazz } from "./base/zazz-element.js";
37
40
  // The experimental `stuck` utility state reads container scroll-state queries;
38
41
  // where they are unsupported (Safari, Firefox), load the polyfill. Chromium never fetches it.
39
42
  if (typeof CSS !== "undefined" && !CSS.supports("container-type", "scroll-state")) {
package/src/index.ts CHANGED
@@ -36,6 +36,10 @@ import "./primitives/tabs/tabs.ts";
36
36
  import "./primitives/toaster/toaster.ts";
37
37
  import "./base/navigation.ts";
38
38
 
39
+ // The runtime API (also `window.Zazz`): `Zazz.refresh(scope)` after another
40
+ // library swaps content in.
41
+ export { Zazz } from "./base/zazz-element.ts";
42
+
39
43
  // The experimental `stuck` utility state reads container scroll-state queries;
40
44
  // where they are unsupported (Safari, Firefox), load the polyfill. Chromium never fetches it.
41
45
  if (typeof CSS !== "undefined" && !CSS.supports("container-type", "scroll-state")) {
@@ -1 +0,0 @@
1
- import{t as e}from"./zazz.js";const t=`data-ui-stuck`,n={top:`bottom`,right:`left`,bottom:`top`,left:`right`};let r=[],i,a=0;function o(e){for(let t=e.parentElement;t&&t!==document.body;t=t.parentElement){let{overflowX:e,overflowY:n}=getComputedStyle(t);if(/auto|scroll|hidden/.test(e+n))return t}return null}function s(e,{writingMode:t,direction:r}){let i=!t.startsWith(`horizontal`),a=i?t.endsWith(`lr`)?`left`:`right`:`top`,o=i?r===`rtl`?`bottom`:`top`:r===`rtl`?`right`:`left`,s=[];return e===a&&s.push(`block-start`),e===n[a]&&s.push(`block-end`),e===o&&s.push(`inline-start`),e===n[o]&&s.push(`inline-end`),s}function c(e,t){if(t.position!==`sticky`)return[];let n=o(e),r=n??document.scrollingElement??document.documentElement,i=n?(()=>{let e=n.getBoundingClientRect(),t=e.top+n.clientTop,r=e.left+n.clientLeft;return{top:t,left:r,bottom:t+n.clientHeight,right:r+n.clientWidth}})():{top:0,left:0,bottom:innerHeight,right:innerWidth},a=e.getBoundingClientRect(),s=r.scrollHeight-r.clientHeight,c=r.scrollWidth-r.clientWidth,l=getComputedStyle(r).direction===`rtl`,u=r.scrollLeft,d={top:r.scrollTop>0,bottom:r.scrollTop<s-.5,left:l?u>-c+.5:u>0,right:l?u<0:u<c-.5},f={top:a.top-i.top,bottom:i.bottom-a.bottom,left:a.left-i.left,right:i.right-a.right};return Object.keys(f).filter(e=>{let n=t[e];return n!==`auto`&&d[e]&&Math.abs(f[e]-Number.parseFloat(n))<1})}function l(){a=0;for(let e of r){let n=getComputedStyle(e),r=c(e,n).flatMap(e=>[e,...s(e,n)]).join(` `);r?e.getAttribute(t)!==r&&e.setAttribute(t,r):e.removeAttribute(t)}}function u(){a||=requestAnimationFrame(l)}function d(){if(i){for(let e of r)e.isConnected||e.removeAttribute(t);r=[...document.querySelectorAll(`[style*=": sticky"], [style*="--stuck-state:"]`)].filter(e=>e.querySelector(`[style*="--stuck:"]`)),u()}}function f(){return typeof CSS<`u`&&CSS.supports(`container-type`,`scroll-state`)}function p({force:e=!1}={}){if(i||!e&&f())return;i=new AbortController;let t={passive:!0,capture:!0,signal:i.signal};document.addEventListener(`scroll`,u,t),window.addEventListener(`resize`,u,t),d()}typeof window<`u`&&typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>p(),{once:!0}):p(),e(d));export{};