@venkat91/ark-ui-components
Version:
React component library built on Ark UI with TypeScript and Panda CSS
1 lines • 131 kB
JavaScript
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react/jsx-runtime"),E=require("react"),ye=require("react-dom"),Go={primary:"custom-button--primary",secondary:"custom-button--secondary",danger:"custom-button--danger"},Ko={sm:"custom-button--sm",md:"custom-button--md",lg:"custom-button--lg"},Xo=({children:t,variant:e="primary",size:n="md",loading:r=!1,leftIcon:o,rightIcon:i,className:s="",disabled:a,...l})=>v.jsx("button",{className:["custom-button",Go[e],Ko[n],s].join(" "),disabled:a||r,...l,children:r?v.jsx("span",{className:"custom-button__spinner","aria-label":"Loading"}):v.jsxs(v.Fragment,{children:[o&&v.jsx("span",{className:"custom-button__icon custom-button__icon--left",children:o}),t,i&&v.jsx("span",{className:"custom-button__icon custom-button__icon--right",children:i})]})});function Yo(t){return t?Array.isArray(t)?t:[t]:[]}var or=t=>t[0],ir=t=>t[t.length-1],En=t=>(t==null?void 0:t.constructor.name)==="Array",qo=(t,e)=>{if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!tn(t[n],e[n]))return!1;return!0},tn=(t,e)=>{if(Object.is(t,e))return!0;if(t==null&&e!=null||t!=null&&e==null)return!1;if(typeof(t==null?void 0:t.isEqual)=="function"&&typeof(e==null?void 0:e.isEqual)=="function")return t.isEqual(e);if(typeof t=="function"&&typeof e=="function")return t.toString()===e.toString();if(En(t)&&En(e))return qo(Array.from(t),Array.from(e));if(typeof t!="object"||typeof e!="object")return!1;const n=Object.keys(e??Object.create(null)),r=n.length;for(let o=0;o<r;o++)if(!Reflect.has(t,n[o]))return!1;for(let o=0;o<r;o++){const i=n[o];if(!tn(t[i],e[i]))return!1}return!0},ue=t=>typeof t=="string",kt=t=>typeof t=="function",Zo=t=>t==null,Jo=Function.prototype.toString;Jo.call(Object);var Qo=(t,...e)=>(typeof t=="function"?t(...e):t)??void 0,ti=t=>t(),ei=()=>{},Le=(...t)=>(...e)=>{t.forEach(function(n){n==null||n(...e)})},{floor:Tn,abs:ge,round:sr,min:ni,max:ri,pow:oi,sign:ii}=Math,Ut=t=>Number.isNaN(t),Kt=t=>Ut(t)?0:t,si=(t,e,n)=>t===0?n:e[t-1],ai=(t,e,n)=>t===e.length-1?n:e[t+1],ci=(t,e,n)=>Kt(t)>=e&&Kt(t)<=n,li=(t,e,n)=>sr((Kt(t)-e)/n)*n+e,Zt=(t,e,n)=>ni(ri(Kt(t),e),n),en=(t,e,n)=>(Kt(t)-e)/(n-e),ar=(t,e,n,r)=>Zt(li(t*(n-e)+e,e,r),e,n),oe=(t,e)=>{let n=t,r=e.toString(),o=r.indexOf("."),i=o>=0?r.length-o:0;if(i>0){let s=oi(10,i);n=sr(n*s)/s}return n},nn=(t,e,n,r)=>{e=Number(e),n=Number(n);let o=(t-(Ut(e)?0:e))%r,i=oe(ge(o)*2>=r?t+ii(o)*(r-ge(o)):t-o,r);return Ut(e)?!Ut(n)&&i>n&&(i=e+Tn(oe((n-e)/r,r))*r):i<e?i=e:!Ut(n)&&i>n&&(i=e+Tn(oe((n-e)/r,r))*r),oe(i,r)},zt=(t,e,n)=>t[e]===n?t:[...t.slice(0,e),n,...t.slice(e+1)];function cr(t,e){const n=si(t,e.values,e.min),r=ai(t,e.values,e.max);let o=e.values.slice();return function(s){let a=nn(s,n,r,e.step);return o=zt(o,t,s),o[t]=a,o}}function ui(t,e){const n=e.values[t]+e.step;return cr(t,e)(n)}function di(t,e){const n=e.values[t]-e.step;return cr(t,e)(n)}var fi=(t,e)=>{let n=t.findIndex(i=>e-i<0);if(n===0)return n;if(n===-1)return t.length-1;let r=t[n-1],o=t[n];return ge(r-e)<ge(o-e)?n-1:n},lr=(t,e,n,r)=>t.map((o,i)=>({min:i===0?e:t[i-1]+r,max:i===t.length-1?n:t[i+1]-r,value:o})),_e=(t,e)=>{const[n,r]=t,[o,i]=e;return s=>n===r||o===i?o:o+(i-o)/(r-n)*(s-n)},Pn=t=>t!=null?`${t}px`:void 0;function rn(t){if(!gi(t)||t===void 0)return t;const e=Reflect.ownKeys(t).filter(r=>typeof r=="string"),n={};for(const r of e){const o=t[r];o!==void 0&&(n[r]=rn(o))}return n}var gi=t=>t&&typeof t=="object"&&t.constructor===Object;function pi(t,e){const n={};for(const r of e){const o=t[r];o!==void 0&&(n[r]=o)}return n}function Ve(...t){const e=t.length===1?t[0]:t[1];(t.length===2?t[0]:!0)&&process.env.NODE_ENV!=="production"&&console.warn(e)}function mi(t,e){if(t==null)throw new Error(e())}var On=t=>Math.max(0,Math.min(1,t)),ur=()=>{},xe=t=>typeof t=="object"&&t!==null,A=t=>t?"":void 0,hi=t=>t?"true":void 0,bi=1,vi=9,yi=11,$=t=>xe(t)&&t.nodeType===bi&&typeof t.nodeName=="string",on=t=>xe(t)&&t.nodeType===vi,xi=t=>xe(t)&&t===t.window,dr=t=>$(t)?t.localName||"":"#document";function wi(t){return["html","body","#document"].includes(dr(t))}var Ei=t=>xe(t)&&t.nodeType!==void 0,Dt=t=>Ei(t)&&t.nodeType===yi&&"host"in t,Ti=t=>$(t)&&t.localName==="input",Pi=t=>!!(t!=null&&t.matches("a[href]")),Oi=t=>$(t)?t.offsetWidth>0||t.offsetHeight>0||t.getClientRects().length>0:!1,Ci=/(textarea|select)/;function Si(t){if(t==null||!$(t))return!1;try{return Ti(t)&&t.selectionStart!=null||Ci.test(t.localName)||t.isContentEditable||t.getAttribute("contenteditable")==="true"||t.getAttribute("contenteditable")===""}catch{return!1}}function Xt(t,e){var r;if(!t||!e||!$(t)||!$(e))return!1;const n=(r=e.getRootNode)==null?void 0:r.call(e);if(t===e||t.contains(e))return!0;if(n&&Dt(n)){let o=e;for(;o;){if(t===o)return!0;o=o.parentNode||o.host}}return!1}function lt(t){return on(t)?t:xi(t)?t.document:(t==null?void 0:t.ownerDocument)??document}function Ri(t){return lt(t).documentElement}function ut(t){var e;return Dt(t)?ut(t.host):on(t)?t.defaultView??window:$(t)?((e=t.ownerDocument)==null?void 0:e.defaultView)??window:window}function fr(t){let e=t.activeElement;for(;e!=null&&e.shadowRoot;){const n=e.shadowRoot.activeElement;if(n===e)break;e=n}return e}function Ni(t){if(dr(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Dt(t)&&t.host||Ri(t);return Dt(e)?e.host:e}var Ne=new WeakMap;function sn(t){return Ne.has(t)||Ne.set(t,ut(t).getComputedStyle(t)),Ne.get(t)}var we=()=>typeof document<"u";function Ai(){const t=navigator.userAgentData;return(t==null?void 0:t.platform)??navigator.platform}function ki(){const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(({brand:e,version:n})=>`${e}/${n}`).join(" "):navigator.userAgent}var an=t=>we()&&t.test(Ai()),Ii=t=>we()&&t.test(ki()),Fi=t=>we()&&t.test(navigator.vendor),Cn=()=>we()&&!!navigator.maxTouchPoints,Di=()=>an(/^iPhone/i),Li=()=>an(/^iPad/i)||cn()&&navigator.maxTouchPoints>1,Ee=()=>Di()||Li(),_i=()=>cn()||Ee(),cn=()=>an(/^Mac/i),gr=()=>_i()&&Fi(/apple/i),Vi=()=>Ii(/Firefox/i);function Bi(t){var e,n,r;return((e=t.composedPath)==null?void 0:e.call(t))??((r=(n=t.nativeEvent)==null?void 0:n.composedPath)==null?void 0:r.call(n))}function et(t){const e=Bi(t);return(e==null?void 0:e[0])??t.target}var Mi=t=>Xt(t.currentTarget,et(t));function $i(t){return Gi(t).isComposing||t.keyCode===229}var ji=t=>t.button===0,Wi=t=>t.button===2||cn()&&t.ctrlKey&&t.button===0,Hi=t=>t.ctrlKey||t.altKey||t.metaKey,Ui=t=>"touches"in t&&t.touches.length>0,zi={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"},Sn={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft"};function pr(t,e={}){const{dir:n="ltr",orientation:r="horizontal"}=e;let o=t.key;return o=zi[o]??o,n==="rtl"&&r==="horizontal"&&o in Sn&&(o=Sn[o]),o}function Gi(t){return t.nativeEvent??t}var Ki=new Set(["PageUp","PageDown"]),Xi=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function Yi(t){return t.ctrlKey||t.metaKey?.1:Ki.has(t.key)||t.shiftKey&&Xi.has(t.key)?10:1}function mr(t,e="client"){const n=Ui(t)?t.touches[0]||t.changedTouches[0]:t;return{x:n[`${e}X`],y:n[`${e}Y`]}}var H=(t,e,n,r)=>{const o=typeof t=="function"?t():t;return o==null||o.addEventListener(e,n,r),()=>{o==null||o.removeEventListener(e,n,r)}};function qi(t,e){const{type:n="HTMLInputElement",property:r="value"}=e,o=ut(t)[n].prototype;return Object.getOwnPropertyDescriptor(o,r)??{}}function Zi(t){if(t.localName==="input")return"HTMLInputElement";if(t.localName==="textarea")return"HTMLTextAreaElement";if(t.localName==="select")return"HTMLSelectElement"}function hr(t,e,n="value"){var o;if(!t)return;const r=Zi(t);r&&((o=qi(t,{type:r,property:n}).set)==null||o.call(t,e)),t.setAttribute(n,e)}function Ji(t,e){const{value:n,bubbles:r=!0}=e;if(!t)return;const o=ut(t);t instanceof o.HTMLInputElement&&(hr(t,`${n}`),t.dispatchEvent(new o.Event("input",{bubbles:r})))}function Qi(t){return ts(t)?t.form:t.closest("form")}function ts(t){return t.matches("textarea, input, select, button")}function es(t,e){if(!t)return;const n=Qi(t),r=o=>{o.defaultPrevented||e()};return n==null||n.addEventListener("reset",r,{passive:!0}),()=>n==null?void 0:n.removeEventListener("reset",r)}function ns(t,e){const n=t==null?void 0:t.closest("fieldset");if(!n)return;e(n.disabled);const r=ut(n),o=new r.MutationObserver(()=>e(n.disabled));return o.observe(n,{attributes:!0,attributeFilter:["disabled"]}),()=>o.disconnect()}function rs(t,e){if(!t)return;const{onFieldsetDisabledChange:n,onFormReset:r}=e,o=[es(t,r),ns(t,n)];return()=>o.forEach(i=>i==null?void 0:i())}var br=t=>$(t)&&t.tagName==="IFRAME",os=t=>!Number.isNaN(parseInt(t.getAttribute("tabindex")||"0",10)),is=t=>parseInt(t.getAttribute("tabindex")||"0",10)<0,ln="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false']), details > summary:first-of-type",un=(t,e=!1)=>{if(!t)return[];const n=Array.from(t.querySelectorAll(ln));(e==!0||e=="if-empty"&&n.length===0)&&$(t)&>(t)&&n.unshift(t);const o=n.filter(gt);return o.forEach((i,s)=>{if(br(i)&&i.contentDocument){const a=i.contentDocument.body;o.splice(s,1,...un(a))}}),o};function gt(t){return!t||t.closest("[inert]")?!1:t.matches(ln)&&Oi(t)}function Jt(t,e){if(!t)return[];const n=Array.from(t.querySelectorAll(ln)),r=n.filter(ft);return e&&ft(t)&&r.unshift(t),r.forEach((o,i)=>{if(br(o)&&o.contentDocument){const s=o.contentDocument.body,a=Jt(s);r.splice(i,1,...a)}}),!r.length&&e?n:r}function ft(t){return t!=null&&t.tabIndex>0?!0:gt(t)&&!is(t)}function ss(t,e){const n=Jt(t,e),r=n[0]||null,o=n[n.length-1]||null;return[r,o]}function as(t,e){const n=Jt(t),r=(t==null?void 0:t.ownerDocument)||document,o=e??r.activeElement;if(!o)return null;const i=n.indexOf(o);return n[i+1]||null}function Mt(t){return t.tabIndex<0&&(/^(audio|video|details)$/.test(t.localName)||Si(t))&&!os(t)?0:t.tabIndex}function Rn(t){const{root:e,getInitialEl:n,filter:r,enabled:o=!0}=t;if(!o)return;let i=null;if(i||(i=typeof n=="function"?n():n),i||(i=e==null?void 0:e.querySelector("[data-autofocus],[autofocus]")),!i){const s=Jt(e);i=r?s.filter(r)[0]:s[0]}return i||e||void 0}function dn(t){const e=new Set;function n(r){const o=globalThis.requestAnimationFrame(r);e.add(()=>globalThis.cancelAnimationFrame(o))}return n(()=>n(t)),function(){e.forEach(o=>o())}}function _(t){let e;const n=globalThis.requestAnimationFrame(()=>{e=t()});return()=>{globalThis.cancelAnimationFrame(n),e==null||e()}}function cs(t,e,n){const r=_(()=>{t.removeEventListener(e,o,!0),n()}),o=()=>{r(),n()};return t.addEventListener(e,o,{once:!0,capture:!0}),r}function ls(t){const e=()=>t.click();Vi()?cs(t,"keyup",e):queueMicrotask(e)}function Be(t){const e=Ni(t);return wi(e)?lt(e).body:$(e)&&ds(e)?e:Be(e)}var us=/auto|scroll|overlay|hidden|clip/;function ds(t){const e=ut(t),{overflow:n,overflowX:r,overflowY:o,display:i}=e.getComputedStyle(t);return us.test(n+o+r)&&!["inline","contents"].includes(i)}function fs(t,e){const{left:n,top:r,width:o,height:i}=e.getBoundingClientRect(),s={x:t.x-n,y:t.y-r},a={x:On(s.x/o),y:On(s.y/i)};function l(c={}){const{dir:d="ltr",orientation:g="horizontal",inverted:f}=c,u=typeof f=="object"?f.x:f,p=typeof f=="object"?f.y:f;return g==="horizontal"?d==="rtl"||u?1-a.x:a.x:p?1-a.y:a.y}return{offset:s,percent:a,getPercentValue:l}}var It="default",Me="",de=new WeakMap;function gs(t={}){const{target:e,doc:n}=t,r=n??document,o=r.documentElement;return Ee()?(It==="default"&&(Me=o.style.webkitUserSelect,o.style.webkitUserSelect="none"),It="disabled"):e&&(de.set(e,e.style.userSelect),e.style.userSelect="none"),()=>ps({target:e,doc:r})}function ps(t={}){const{target:e,doc:n}=t,o=(n??document).documentElement;if(Ee()){if(It!=="disabled")return;It="restoring",setTimeout(()=>{dn(()=>{It==="restoring"&&(o.style.webkitUserSelect==="none"&&(o.style.webkitUserSelect=Me||""),Me="",It="default")})},300)}else if(e&&de.has(e)){const i=de.get(e);e.style.userSelect==="none"&&(e.style.userSelect=i??""),e.getAttribute("style")===""&&e.removeAttribute("style"),de.delete(e)}}function ms(t={}){const{defer:e,target:n,...r}=t,o=e?_:s=>s(),i=[];return i.push(o(()=>{const s=typeof n=="function"?n():n;i.push(gs({...r,target:s}))})),()=>{i.forEach(s=>s==null?void 0:s())}}function hs(t,e){const{onPointerMove:n,onPointerUp:r}=e,i=[H(t,"pointermove",s=>{const a=mr(s),l=Math.sqrt(a.x**2+a.y**2),c=s.pointerType==="touch"?10:5;if(!(l<c)){if(s.pointerType==="mouse"&&s.button===0){r();return}n({point:a,event:s})}},!1),H(t,"pointerup",r,!1),H(t,"pointercancel",r,!1),H(t,"contextmenu",r,!1),ms({doc:t})];return()=>{i.forEach(s=>s())}}function bs(t,e={}){const{triggerElement:n,onFocus:r,onFocusEnter:o}=e,i=(t==null?void 0:t.ownerDocument)||document,s=i.body;function a(l){if(l.key!=="Tab")return;let c=null;const[d,g]=ss(t,!0),f=as(s,n),u=!d&&!g;l.shiftKey&&f===i.activeElement?(o==null||o(),c=g):l.shiftKey&&(i.activeElement===d||u)?c=n:!l.shiftKey&&i.activeElement===n?(o==null||o(),c=d):!l.shiftKey&&(i.activeElement===g||u)&&(c=f),c&&(l.preventDefault(),typeof r=="function"?r(c):c.focus())}return H(i,"keydown",a,!0)}function vs(t,e){const{defer:n,triggerElement:r,...o}=e,i=n?_:a=>a(),s=[];return s.push(i(()=>{const a=typeof t=="function"?t():t,l=typeof r=="function"?r():r;s.push(bs(a,{triggerElement:l,...o}))})),()=>{s.forEach(a=>a==null?void 0:a())}}function vr(t,e){return Array.from((t==null?void 0:t.querySelectorAll(e))??[])}var yr=t=>t.id;function xr(t,e,n=yr){return t.find(r=>n(r)===e)}function wr(t,e,n=yr){const r=xr(t,e,n);return r?t.indexOf(r):-1}function ys(t,e,n=!0){let r=wr(t,e);return r=n?(r+1)%t.length:Math.min(r+1,t.length-1),t[r]}function xs(t,e,n=!0){let r=wr(t,e);return r===-1?n?t[t.length-1]:null:(r=n?(r-1+t.length)%t.length:Math.max(0,r-1),t[r])}function Er(t,e){const{onEntry:n,measure:r,box:o="border-box"}=e,i=(Array.isArray(t)?t:[t]).filter($),s=ut(i[0]),a=c=>{const d=i.map(g=>r(g));n({rects:d,entries:c})};a([]);const l=new s.ResizeObserver(a);return i.forEach(c=>l.observe(c,{box:o})),()=>l.disconnect()}function pe(t,e){if(!t)return ur;const n=Object.keys(e).reduce((r,o)=>(r[o]=t.style.getPropertyValue(o),r),{});return Object.assign(t.style,e),()=>{Object.assign(t.style,n),t.style.length===0&&t.removeAttribute("style")}}function ws(t,e,n){if(!t)return ur;const r=t.style.getPropertyValue(e);return t.style.setProperty(e,n),()=>{t.style.setProperty(e,r),t.style.length===0&&t.removeAttribute("style")}}var Es=1e3/60;function Ts(t,e){const n=t();if($(n)&&n.isConnected)return e(n),()=>{};{const r=setInterval(()=>{const o=t();$(o)&&o.isConnected&&(e(o),clearInterval(r))},Es);return()=>clearInterval(r)}}function Ps(t,e){const n=[];return t==null||t.forEach(r=>{const o=Ts(r,e);n.push(o)}),()=>{n.forEach(r=>r())}}var Os=(...t)=>t.map(e=>{var n;return(n=e==null?void 0:e.trim)==null?void 0:n.call(e)}).filter(Boolean).join(" "),Cs=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g,Nn=t=>{const e={};let n;for(;n=Cs.exec(t);)e[n[1]]=n[2];return e},Ss=(t,e)=>{if(ue(t)){if(ue(e))return`${t};${e}`;t=Nn(t)}else ue(e)&&(e=Nn(e));return Object.assign({},t??{},e??{})};function k(...t){let e={};for(let n of t){for(let r in e){if(r.startsWith("on")&&typeof e[r]=="function"&&typeof n[r]=="function"){e[r]=Le(n[r],e[r]);continue}if(r==="className"||r==="class"){e[r]=Os(e[r],n[r]);continue}if(r==="style"){e[r]=Ss(e[r],n[r]);continue}e[r]=n[r]!==void 0?n[r]:e[r]}for(let r in n)e[r]===void 0&&(e[r]=n[r])}return e}function Rs(){return{and:(...t)=>function(n){return t.every(r=>n.guard(r))},or:(...t)=>function(n){return t.some(r=>n.guard(r))},not:t=>function(n){return!n.guard(t)}}}var At=(t=>(t.NotStarted="Not Started",t.Started="Started",t.Stopped="Stopped",t))(At||{}),Ae="__init__";function Ns(t){const e=()=>{var a;return((a=t.getRootNode)==null?void 0:a.call(t))??document},n=()=>lt(e()),r=()=>n().defaultView??window,o=()=>fr(e());return{...t,getRootNode:e,getDoc:n,getWin:r,getActiveElement:o,isActiveElement:a=>a===o(),getById:a=>e().getElementById(a)}}function As(t){return new Proxy({},{get(e,n){return n==="style"?r=>t({style:r}).style:t}})}var bt=()=>t=>Array.from(new Set(t)),Tr=typeof globalThis.document<"u"?E.useLayoutEffect:E.useEffect;function me(t){const e=t().value??t().defaultValue,n=t().isEqual??Object.is,[r]=E.useState(e),[o,i]=E.useState(r),s=t().value!==void 0,a=E.useRef(o);a.current=s?t().value:o;const l=E.useRef(a.current);Tr(()=>{l.current=a.current},[o,t().value]);const c=g=>{var p,m;const f=l.current,u=kt(g)?g(f):g;t().debug&&console.log(`[bindable > ${t().debug}] setValue`,{next:u,prev:f}),s||i(u),n(u,f)||(m=(p=t()).onChange)==null||m.call(p,u,f)};function d(){return s?t().value:o}return{initial:r,ref:a,get:d,set(g){(t().sync?ye.flushSync:ti)(()=>c(g))},invoke(g,f){var u,p;(p=(u=t()).onChange)==null||p.call(u,g,f)},hash(g){var f,u;return((u=(f=t()).hash)==null?void 0:u.call(f,g))??String(g)}}}me.cleanup=t=>{E.useEffect(()=>t,[])};me.ref=t=>{const e=E.useRef(t);return{get:()=>e.current,set:n=>{e.current=n}}};function ks(t){const e=E.useRef(t);return{get(n){return e.current[n]},set(n,r){e.current[n]=r}}}var Is=(t,e)=>{const n=E.useRef(!1),r=E.useRef(!1);E.useEffect(()=>{if(n.current&&r.current)return e();r.current=!0},[...(t??[]).map(o=>typeof o=="function"?o():o)]),E.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[])};function Qt(t,e={}){var z,W,U,F;const n=E.useMemo(()=>{const{id:T,ids:P,getRootNode:S}=e;return Ns({id:T,ids:P,getRootNode:S})},[e]),r=(...T)=>{t.debug&&console.log(...T)},o=((z=t.props)==null?void 0:z.call(t,{props:rn(e),scope:n}))??e,i=Fs(o),s=(W=t.context)==null?void 0:W.call(t,{prop:i,bindable:me,scope:n,flush:An,getContext(){return l},getComputed(){return b},getRefs(){return m}}),a=Pr(s),l={get(T){var P;return(P=a.current)==null?void 0:P[T].ref.current},set(T,P){var S;(S=a.current)==null||S[T].set(P)},initial(T){var P;return(P=a.current)==null?void 0:P[T].initial},hash(T){var S,R;const P=(S=a.current)==null?void 0:S[T].get();return(R=a.current)==null?void 0:R[T].hash(P)}},c=E.useRef(new Map),d=E.useRef(null),g=E.useRef(null),f=E.useRef({type:""}),u=()=>({...f.current,current(){return f.current},previous(){return g.current}}),p=()=>({...x,matches(...T){return T.includes(x.ref.current)},hasTag(T){var P,S;return!!((S=(P=t.states[x.ref.current])==null?void 0:P.tags)!=null&&S.includes(T))}}),m=ks(((U=t.refs)==null?void 0:U.call(t,{prop:i,context:l}))??{}),h=()=>({state:p(),context:l,event:u(),prop:i,send:M,action:y,guard:w,track:Is,refs:m,computed:b,flush:An,scope:n,choose:C}),y=T=>{const P=kt(T)?T(h()):T;if(!P)return;const S=P.map(R=>{var j,Y;const I=(Y=(j=t.implementations)==null?void 0:j.actions)==null?void 0:Y[R];return I||Ve(`[zag-js] No implementation found for action "${JSON.stringify(R)}"`),I});for(const R of S)R==null||R(h())},w=T=>{var P,S;return kt(T)?T(h()):(S=(P=t.implementations)==null?void 0:P.guards)==null?void 0:S[T](h())},O=T=>{const P=kt(T)?T(h()):T;if(!P)return;const S=P.map(I=>{var Y,X;const j=(X=(Y=t.implementations)==null?void 0:Y.effects)==null?void 0:X[I];return j||Ve(`[zag-js] No implementation found for effect "${JSON.stringify(I)}"`),j}),R=[];for(const I of S){const j=I==null?void 0:I(h());j&&R.push(j)}return()=>R.forEach(I=>I==null?void 0:I())},C=T=>Yo(T).find(P=>{let S=!P.guard;return ue(P.guard)?S=!!w(P.guard):kt(P.guard)&&(S=P.guard(h())),S}),b=T=>{mi(t.computed,()=>"[zag-js] No computed object found on machine");const P=t.computed[T];return P({context:l,event:u(),prop:i,refs:m,scope:n,computed:b})},x=me(()=>({defaultValue:t.initialState({prop:i}),onChange(T,P){var R,I,j,Y;if(P){const X=c.current.get(P);X==null||X(),c.current.delete(P)}P&&y((R=t.states[P])==null?void 0:R.exit),y((I=d.current)==null?void 0:I.actions);const S=O((j=t.states[T])==null?void 0:j.effects);if(S&&c.current.set(T,S),P===Ae){y(t.entry);const X=O(t.effects);X&&c.current.set(Ae,X)}y((Y=t.states[T])==null?void 0:Y.entry)}})),N=E.useRef(void 0),V=E.useRef(At.NotStarted);Tr(()=>{queueMicrotask(()=>{const S=V.current===At.Started;V.current=At.Started,r(S?"rehydrating...":"initializing...");const R=N.current??x.initial;x.invoke(R,S?x.get():Ae)});const T=c.current,P=x.ref.current;return()=>{r("unmounting..."),N.current=P,V.current=At.Stopped,T.forEach(S=>S==null?void 0:S()),c.current=new Map,d.current=null,queueMicrotask(()=>{y(t.exit)})}},[]);const B=()=>"ref"in x?x.ref.current:x.get(),M=T=>{queueMicrotask(()=>{var Y,X;if(V.current!==At.Started)return;g.current=f.current,f.current=T,r("send",T);let P=B();const S=((Y=t.states[P].on)==null?void 0:Y[T.type])??((X=t.on)==null?void 0:X[T.type]),R=C(S);if(!R)return;d.current=R;const I=R.target??P;r("transition",R);const j=I!==P;j?ye.flushSync(()=>x.set(I)):R.reenter&&!j?x.invoke(P,P):y(R.actions??[])})};return(F=t.watch)==null||F.call(t,h()),{state:p(),send:M,context:l,prop:i,scope:n,refs:m,computed:b,event:u(),getStatus:()=>V.current}}function Pr(t){const e=E.useRef(t);return e.current=t,e}function Fs(t){const e=Pr(t);return function(r){return e.current[r]}}function An(t){queueMicrotask(()=>{ye.flushSync(()=>t())})}var Te=As(t=>t);function te(...t){return e=>{const n=[];for(const r of t)if(typeof r=="function"){const o=r(e);typeof o=="function"&&n.push(o)}else r&&(r.current=e);if(n.length)return()=>{for(const r of n)r()}}}function Ds(t,e){return`${t} returned \`undefined\`. Seems you forgot to wrap component within ${e}`}function dt(t={}){const{name:e,strict:n=!0,hookName:r="useContext",providerName:o="Provider",errorMessage:i,defaultValue:s}=t,a=E.createContext(s);a.displayName=e;function l(){var d;const c=E.useContext(a);if(!c&&n){const g=new Error(i??Ds(r,o));throw g.name="ContextError",(d=Error.captureStackTrace)==null||d.call(Error,g,l),g}return c}return[a.Provider,l,a]}const Et=()=>(t,e)=>e.reduce((n,r)=>{const[o,i]=n,s=r;return i[s]!==void 0&&(o[s]=i[s]),delete i[s],[o,i]},[{},{...t}]),[Or,Cr]=dt({name:"RenderStrategyContext",hookName:"useRenderStrategyContext",providerName:"<RenderStrategyPropsProvider />"}),Sr=t=>Et()(t,["lazyMount","unmountOnExit"]);function Ls(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}const ke=t=>{const e=E.memo(E.forwardRef((n,r)=>{const{asChild:o,children:i,...s}=n;if(!o)return E.createElement(t,{...s,ref:r},i);const a=E.Children.only(i);if(!E.isValidElement(a))return null;const l=Ls(a);return E.cloneElement(a,{...k(s,a.props),ref:r?te(r,l):l})}));return e.displayName=t.displayName||t.name,e},_s=()=>{const t=new Map;return new Proxy(ke,{apply(e,n,r){return ke(r[0])},get(e,n){const r=n;return t.has(r)||t.set(r,ke(r)),t.get(r)}})},D=_s();function Vs(t,e){const{state:n,send:r,context:o}=t,i=n.matches("mounted","unmountSuspended");return{skip:!o.get("initial"),present:i,setNode(s){s&&r({type:"NODE.SET",node:s})},unmount(){r({type:"UNMOUNT"})}}}var Bs={props({props:t}){return{...t,present:!!t.present}},initialState({prop:t}){return t("present")?"mounted":"unmounted"},refs(){return{node:null,styles:null}},context({bindable:t}){return{unmountAnimationName:t(()=>({defaultValue:null})),prevAnimationName:t(()=>({defaultValue:null})),present:t(()=>({defaultValue:!1})),initial:t(()=>({sync:!0,defaultValue:!1}))}},exit:["clearInitial","cleanupNode"],watch({track:t,action:e,prop:n}){t([()=>n("present")],()=>{e(["setInitial","syncPresence"])})},on:{"NODE.SET":{actions:["setNode","setStyles"]}},states:{mounted:{on:{UNMOUNT:{target:"unmounted",actions:["clearPrevAnimationName","invokeOnExitComplete"]},"UNMOUNT.SUSPEND":{target:"unmountSuspended"}}},unmountSuspended:{effects:["trackAnimationEvents"],on:{MOUNT:{target:"mounted",actions:["setPrevAnimationName"]},UNMOUNT:{target:"unmounted",actions:["clearPrevAnimationName","invokeOnExitComplete"]}}},unmounted:{on:{MOUNT:{target:"mounted",actions:["setPrevAnimationName"]}}}},implementations:{actions:{setInitial:({context:t})=>{t.get("initial")||queueMicrotask(()=>{t.set("initial",!0)})},clearInitial:({context:t})=>{t.set("initial",!1)},cleanupNode:({refs:t})=>{t.set("node",null),t.set("styles",null)},invokeOnExitComplete:({prop:t})=>{var e;(e=t("onExitComplete"))==null||e()},setNode:({refs:t,event:e})=>{t.set("node",e.node)},setStyles:({refs:t,event:e})=>{t.set("styles",sn(e.node))},syncPresence:({context:t,refs:e,send:n,prop:r})=>{const o=r("present");if(o)return n({type:"MOUNT",src:"presence.changed"});const i=e.get("node");if(!o&&(i==null?void 0:i.ownerDocument.visibilityState)==="hidden")return n({type:"UNMOUNT",src:"visibilitychange"});_(()=>{var a,l;const s=ie(e.get("styles"));t.set("unmountAnimationName",s),s==="none"||s===t.get("prevAnimationName")||((a=e.get("styles"))==null?void 0:a.display)==="none"||((l=e.get("styles"))==null?void 0:l.animationDuration)==="0s"?n({type:"UNMOUNT",src:"presence.changed"}):n({type:"UNMOUNT.SUSPEND"})})},setPrevAnimationName:({context:t,refs:e})=>{_(()=>{t.set("prevAnimationName",ie(e.get("styles")))})},clearPrevAnimationName:({context:t})=>{t.set("prevAnimationName",null)}},effects:{trackAnimationEvents:({context:t,refs:e,send:n})=>{const r=e.get("node");if(!r)return;const o=a=>{var c,d;(((d=(c=a.composedPath)==null?void 0:c.call(a))==null?void 0:d[0])??a.target)===r&&t.set("prevAnimationName",ie(e.get("styles")))},i=a=>{const l=ie(e.get("styles"));et(a)===r&&l===t.get("unmountAnimationName")&&n({type:"UNMOUNT",src:"animationend"})};r.addEventListener("animationstart",o),r.addEventListener("animationcancel",i),r.addEventListener("animationend",i);const s=pe(r,{animationFillMode:"forwards"});return()=>{r.removeEventListener("animationstart",o),r.removeEventListener("animationcancel",i),r.removeEventListener("animationend",i),dn(()=>s())}}}}};function ie(t){return(t==null?void 0:t.animationName)||"none"}bt()(["onExitComplete","present","immediate"]);function Ms(t,e={}){const{sync:n=!1}=e,r=$s(t);return E.useCallback((...o)=>{var i;return n?queueMicrotask(()=>{var s;return(s=r.current)==null?void 0:s.call(r,...o)}):(i=r.current)==null?void 0:i.call(r,...o)},[n,r])}function $s(t){const e=E.useRef(t);return e.current=t,e}const Pe=(t={})=>{const{lazyMount:e,unmountOnExit:n,present:r,skipAnimationOnMount:o=!1,...i}=t,s=E.useRef(!1),a={...i,present:r,onExitComplete:Ms(t.onExitComplete)},l=Qt(Bs,a),c=Vs(l);c.present&&(s.current=!0);const d=!c.present&&!s.current&&e||n&&!c.present&&s.current,g=()=>({"data-state":c.skip&&o?void 0:r?"open":"closed",hidden:!c.present});return{ref:c.setNode,getPresenceProps:g,present:c.present,unmounted:d}},[js,Tt]=dt({name:"DialogContext",hookName:"useDialogContext",providerName:"<DialogProvider />"}),Rr=E.forwardRef((t,e)=>{const n=Tt(),r=Cr(),o=Pe({...r,present:n.open}),i=k(n.getBackdropProps(),o.getPresenceProps(),t);return o.unmounted?null:v.jsx(D.div,{...i,ref:te(o.ref,e)})});Rr.displayName="DialogBackdrop";const $e=E.forwardRef((t,e)=>{const n=Tt(),r=k(n.getCloseTriggerProps(),t);return v.jsx(D.button,{...r,ref:e})});$e.displayName="DialogCloseTrigger";const[fn,_t]=dt({name:"PresenceContext",hookName:"usePresenceContext",providerName:"<PresenceProvider />"}),Nr=E.forwardRef((t,e)=>{const n=Tt(),r=_t(),o=k(n.getContentProps(),r.getPresenceProps(),t);return r.unmounted?null:v.jsx(D.div,{...o,ref:te(r.ref,e)})});Nr.displayName="DialogContent";const Ar=E.forwardRef((t,e)=>{const n=Tt(),r=k(n.getDescriptionProps(),t);return v.jsx(D.div,{...r,ref:e})});Ar.displayName="DialogDescription";const kr=E.forwardRef((t,e)=>{const n=Tt(),r=k(n.getPositionerProps(),t);return _t().unmounted?null:v.jsx(D.div,{...r,ref:e})});kr.displayName="DialogPositioner";const Ir=t=>Et()(t,["immediate","lazyMount","onExitComplete","present","skipAnimationOnMount","unmountOnExit"]);var yt=(t,e=[])=>({parts:(...n)=>{if(Ws(e))return yt(t,n);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...n)=>yt(t,[...e,...n]),rename:n=>yt(n,e),keys:()=>e,build:()=>[...new Set(e)].reduce((n,r)=>Object.assign(n,{[r]:{selector:[`&[data-scope="${Ct(t)}"][data-part="${Ct(r)}"]`,`& [data-scope="${Ct(t)}"][data-part="${Ct(r)}"]`].join(", "),attrs:{"data-scope":Ct(t),"data-part":Ct(r)}}}),{})}),Ct=t=>t.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),Ws=t=>t.length===0,St=new WeakMap,se=new WeakMap,ae={},Ie=0,Fr=t=>t&&(t.host||Fr(t.parentNode)),Hs=(t,e)=>e.map(n=>{if(t.contains(n))return n;const r=Fr(n);return r&&t.contains(r)?r:(console.error("[zag-js > ariaHidden] target",n,"in not contained inside",t,". Doing nothing"),null)}).filter(n=>!!n),Us=t=>t.localName==="next-route-announcer"||t.localName==="script"||t.hasAttribute("aria-live")?!0:t.matches("[data-live-announcer]"),zs=(t,e)=>{const{parentNode:n,markerName:r,controlAttribute:o}=e,i=Hs(n,Array.isArray(t)?t:[t]);ae[r]||(ae[r]=new WeakMap);const s=ae[r],a=[],l=new Set,c=new Set(i),d=f=>{!f||l.has(f)||(l.add(f),d(f.parentNode))};i.forEach(d);const g=f=>{!f||c.has(f)||Array.prototype.forEach.call(f.children,u=>{if(l.has(u))g(u);else try{if(Us(u))return;const m=u.getAttribute(o)==="true",h=(St.get(u)||0)+1,y=(s.get(u)||0)+1;St.set(u,h),s.set(u,y),a.push(u),h===1&&m&&se.set(u,!0),y===1&&u.setAttribute(r,""),m||u.setAttribute(o,"true")}catch(p){console.error("[zag-js > ariaHidden] cannot operate on ",u,p)}})};return g(n),l.clear(),Ie++,()=>{a.forEach(f=>{const u=St.get(f)-1,p=s.get(f)-1;St.set(f,u),s.set(f,p),u||(se.has(f)||f.removeAttribute(o),se.delete(f)),p||f.removeAttribute(r)}),Ie--,Ie||(St=new WeakMap,St=new WeakMap,se=new WeakMap,ae={})}},Gs=t=>(Array.isArray(t)?t[0]:t).ownerDocument.body,Ks=(t,e=Gs(t),n="data-aria-hidden")=>{if(e)return zs(t,{parentNode:e,markerName:n,controlAttribute:"aria-hidden"})},Xs=t=>{const e=requestAnimationFrame(()=>t());return()=>cancelAnimationFrame(e)};function Dr(t,e={}){const{defer:n=!0}=e,r=n?Xs:i=>i(),o=[];return o.push(r(()=>{const s=(typeof t=="function"?t():t).filter(Boolean);s.length!==0&&o.push(Ks(s))})),()=>{o.forEach(i=>i==null?void 0:i())}}function Ys(t){const e={each(n){var r;for(let o=0;o<((r=t.frames)==null?void 0:r.length);o+=1){const i=t.frames[o];i&&n(i)}},addEventListener(n,r,o){return e.each(i=>{try{i.document.addEventListener(n,r,o)}catch{}}),()=>{try{e.removeEventListener(n,r,o)}catch{}}},removeEventListener(n,r,o){e.each(i=>{try{i.document.removeEventListener(n,r,o)}catch{}})}};return e}function qs(t){const e=t.frameElement!=null?t.parent:null;return{addEventListener:(n,r,o)=>{try{e==null||e.addEventListener(n,r,o)}catch{}return()=>{try{e==null||e.removeEventListener(n,r,o)}catch{}}},removeEventListener:(n,r,o)=>{try{e==null||e.removeEventListener(n,r,o)}catch{}}}}var kn="pointerdown.outside",In="focus.outside";function Zs(t){for(const e of t)if($(e)&>(e))return!0;return!1}var Lr=t=>"clientY"in t;function Js(t,e){if(!Lr(e)||!t)return!1;const n=t.getBoundingClientRect();return n.width===0||n.height===0?!1:n.top<=e.clientY&&e.clientY<=n.top+n.height&&n.left<=e.clientX&&e.clientX<=n.left+n.width}function Qs(t,e){return t.y<=e.y&&e.y<=t.y+t.height&&t.x<=e.x&&e.x<=t.x+t.width}function Fn(t,e){if(!e||!Lr(t))return!1;const n=e.scrollHeight>e.clientHeight,r=n&&t.clientX>e.offsetLeft+e.clientWidth,o=e.scrollWidth>e.clientWidth,i=o&&t.clientY>e.offsetTop+e.clientHeight,s={x:e.offsetLeft,y:e.offsetTop,width:e.clientWidth+(n?16:0),height:e.clientHeight+(o?16:0)},a={x:t.clientX,y:t.clientY};return Qs(s,a)?r||i:!1}function ta(t,e){const{exclude:n,onFocusOutside:r,onPointerDownOutside:o,onInteractOutside:i,defer:s}=e;if(!t)return;const a=lt(t),l=ut(t),c=Ys(l),d=qs(l);function g(w,O){if(!$(O)||!O.isConnected||Xt(t,O)||Js(t,w))return!1;const C=a.querySelector(`[aria-controls="${t.id}"]`);if(C){const x=Be(C);if(Fn(w,x))return!1}const b=Be(t);return Fn(w,b)?!1:!(n!=null&&n(O))}const f=new Set,u=Dt(t==null?void 0:t.getRootNode());function p(w){function O(C){var V;const b=s&&!Cn()?_:B=>B(),x=C??w,N=((V=x==null?void 0:x.composedPath)==null?void 0:V.call(x))??[x==null?void 0:x.target];b(()=>{const B=u?N[0]:et(w);if(!(!t||!g(w,B))){if(o||i){const M=Le(o,i);t.addEventListener(kn,M,{once:!0})}Dn(t,kn,{bubbles:!1,cancelable:!0,detail:{originalEvent:x,contextmenu:Wi(x),focusable:Zs(N),target:B}})}})}w.pointerType==="touch"?(f.forEach(C=>C()),f.add(H(a,"click",O,{once:!0})),f.add(d.addEventListener("click",O,{once:!0})),f.add(c.addEventListener("click",O,{once:!0}))):O()}const m=new Set,h=setTimeout(()=>{m.add(H(a,"pointerdown",p,!0)),m.add(d.addEventListener("pointerdown",p,!0)),m.add(c.addEventListener("pointerdown",p,!0))},0);function y(w){(s?_:C=>C())(()=>{const C=et(w);if(!(!t||!g(w,C))){if(r||i){const b=Le(r,i);t.addEventListener(In,b,{once:!0})}Dn(t,In,{bubbles:!1,cancelable:!0,detail:{originalEvent:w,contextmenu:!1,focusable:gt(C),target:C}})}})}return Cn()||(m.add(H(a,"focusin",y,!0)),m.add(d.addEventListener("focusin",y,!0)),m.add(c.addEventListener("focusin",y,!0))),()=>{clearTimeout(h),f.forEach(w=>w()),m.forEach(w=>w())}}function ea(t,e){const{defer:n}=e,r=n?_:i=>i(),o=[];return o.push(r(()=>{const i=typeof t=="function"?t():t;o.push(ta(i,e))})),()=>{o.forEach(i=>i==null?void 0:i())}}function Dn(t,e,n){const r=t.ownerDocument.defaultView||window,o=new r.CustomEvent(e,n);return t.dispatchEvent(o)}function na(t,e){const n=r=>{r.key==="Escape"&&(r.isComposing||e==null||e(r))};return H(lt(t),"keydown",n,{capture:!0})}var q={layers:[],branches:[],count(){return this.layers.length},pointerBlockingLayers(){return this.layers.filter(t=>t.pointerBlocking)},topMostPointerBlockingLayer(){return[...this.pointerBlockingLayers()].slice(-1)[0]},hasPointerBlockingLayer(){return this.pointerBlockingLayers().length>0},isBelowPointerBlockingLayer(t){var r;const e=this.indexOf(t),n=this.topMostPointerBlockingLayer()?this.indexOf((r=this.topMostPointerBlockingLayer())==null?void 0:r.node):-1;return e<n},isTopMost(t){const e=this.layers[this.count()-1];return(e==null?void 0:e.node)===t},getNestedLayers(t){return Array.from(this.layers).slice(this.indexOf(t)+1)},isInNestedLayer(t,e){return this.getNestedLayers(t).some(n=>Xt(n.node,e))},isInBranch(t){return Array.from(this.branches).some(e=>Xt(e,t))},add(t){const e=this.layers.push(t);t.node.style.setProperty("--layer-index",`${e}`)},addBranch(t){this.branches.push(t)},remove(t){const e=this.indexOf(t);e<0||(e<this.count()-1&&this.getNestedLayers(t).forEach(r=>r.dismiss()),this.layers.splice(e,1),t.style.removeProperty("--layer-index"))},removeBranch(t){const e=this.branches.indexOf(t);e>=0&&this.branches.splice(e,1)},indexOf(t){return this.layers.findIndex(e=>e.node===t)},dismiss(t){var e;(e=this.layers[this.indexOf(t)])==null||e.dismiss()},clear(){this.remove(this.layers[0].node)}},Ln;function _n(){q.layers.forEach(({node:t})=>{t.style.pointerEvents=q.isBelowPointerBlockingLayer(t)?"none":"auto"})}function ra(t){t.style.pointerEvents=""}function oa(t,e){const n=lt(t),r=[];if(q.hasPointerBlockingLayer()&&!n.body.hasAttribute("data-inert")&&(Ln=document.body.style.pointerEvents,queueMicrotask(()=>{n.body.style.pointerEvents="none",n.body.setAttribute("data-inert","")})),e){const o=Ps(e,i=>{r.push(pe(i,{pointerEvents:"auto"}))});r.push(o)}return()=>{q.hasPointerBlockingLayer()||(queueMicrotask(()=>{n.body.style.pointerEvents=Ln,n.body.removeAttribute("data-inert"),n.body.style.length===0&&n.body.removeAttribute("style")}),r.forEach(o=>o()))}}function ia(t,e){const{warnOnMissingNode:n=!0}=e;if(n&&!t){Ve("[@zag-js/dismissable] node is `null` or `undefined`");return}if(!t)return;const{onDismiss:r,pointerBlocking:o,exclude:i,debug:s}=e,a={dismiss:r,node:t,pointerBlocking:o};q.add(a),_n();function l(u){var m,h;const p=et(u.detail.originalEvent);q.isBelowPointerBlockingLayer(t)||q.isInBranch(p)||((m=e.onPointerDownOutside)==null||m.call(e,u),(h=e.onInteractOutside)==null||h.call(e,u),!u.defaultPrevented&&(s&&console.log("onPointerDownOutside:",u.detail.originalEvent),r==null||r()))}function c(u){var m,h;const p=et(u.detail.originalEvent);q.isInBranch(p)||((m=e.onFocusOutside)==null||m.call(e,u),(h=e.onInteractOutside)==null||h.call(e,u),!u.defaultPrevented&&(s&&console.log("onFocusOutside:",u.detail.originalEvent),r==null||r()))}function d(u){var p;q.isTopMost(t)&&((p=e.onEscapeKeyDown)==null||p.call(e,u),!u.defaultPrevented&&r&&(u.preventDefault(),r()))}function g(u){var y;if(!t)return!1;const p=typeof i=="function"?i():i,m=Array.isArray(p)?p:[p],h=(y=e.persistentElements)==null?void 0:y.map(w=>w()).filter($);return h&&m.push(...h),m.some(w=>Xt(w,u))||q.isInNestedLayer(t,u)}const f=[o?oa(t,e.persistentElements):void 0,na(t,d),ea(t,{exclude:g,onFocusOutside:c,onPointerDownOutside:l,defer:e.defer})];return()=>{q.remove(t),_n(),ra(t),f.forEach(u=>u==null?void 0:u())}}function _r(t,e){const{defer:n}=e,r=n?_:i=>i(),o=[];return o.push(r(()=>{const i=kt(t)?t():t;o.push(ia(i,e))})),()=>{o.forEach(i=>i==null?void 0:i())}}var sa=Object.defineProperty,aa=(t,e,n)=>e in t?sa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,L=(t,e,n)=>aa(t,typeof e!="symbol"?e+"":e,n),Vn={activateTrap(t,e){if(t.length>0){const r=t[t.length-1];r!==e&&r.pause()}const n=t.indexOf(e);n===-1||t.splice(n,1),t.push(e)},deactivateTrap(t,e){const n=t.indexOf(e);n!==-1&&t.splice(n,1),t.length>0&&t[t.length-1].unpause()}},ca=[],la=class{constructor(t,e){L(this,"trapStack"),L(this,"config"),L(this,"doc"),L(this,"state",{containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0}),L(this,"listenerCleanups",[]),L(this,"handleFocus",r=>{const o=et(r),i=this.findContainerIndex(o,r)>=0;if(i||on(o))i&&(this.state.mostRecentlyFocusedNode=o);else{r.stopImmediatePropagation();let s,a=!0;if(this.state.mostRecentlyFocusedNode)if(Mt(this.state.mostRecentlyFocusedNode)>0){const l=this.findContainerIndex(this.state.mostRecentlyFocusedNode),{tabbableNodes:c}=this.state.containerGroups[l];if(c.length>0){const d=c.findIndex(g=>g===this.state.mostRecentlyFocusedNode);d>=0&&(this.config.isKeyForward(this.state.recentNavEvent)?d+1<c.length&&(s=c[d+1],a=!1):d-1>=0&&(s=c[d-1],a=!1))}}else this.state.containerGroups.some(l=>l.tabbableNodes.some(c=>Mt(c)>0))||(a=!1);else a=!1;a&&(s=this.findNextNavNode({target:this.state.mostRecentlyFocusedNode,isBackward:this.config.isKeyBackward(this.state.recentNavEvent)})),s?this.tryFocus(s):this.tryFocus(this.state.mostRecentlyFocusedNode||this.getInitialFocusNode())}this.state.recentNavEvent=void 0}),L(this,"handlePointerDown",r=>{const o=et(r);if(!(this.findContainerIndex(o,r)>=0)){if(jt(this.config.clickOutsideDeactivates,r)){this.deactivate({returnFocus:this.config.returnFocusOnDeactivate});return}jt(this.config.allowOutsideClick,r)||r.preventDefault()}}),L(this,"handleClick",r=>{const o=et(r);this.findContainerIndex(o,r)>=0||jt(this.config.clickOutsideDeactivates,r)||jt(this.config.allowOutsideClick,r)||(r.preventDefault(),r.stopImmediatePropagation())}),L(this,"handleTabKey",r=>{if(this.config.isKeyForward(r)||this.config.isKeyBackward(r)){this.state.recentNavEvent=r;const o=this.config.isKeyBackward(r),i=this.findNextNavNode({event:r,isBackward:o});if(!i)return;$t(r)&&r.preventDefault(),this.tryFocus(i)}}),L(this,"handleEscapeKey",r=>{ua(r)&&jt(this.config.escapeDeactivates,r)!==!1&&(r.preventDefault(),this.deactivate())}),L(this,"_mutationObserver"),L(this,"setupMutationObserver",()=>{const r=this.doc.defaultView||window;this._mutationObserver=new r.MutationObserver(o=>{o.some(s=>Array.from(s.removedNodes).some(l=>l===this.state.mostRecentlyFocusedNode))&&this.tryFocus(this.getInitialFocusNode())})}),L(this,"updateObservedNodes",()=>{var r;(r=this._mutationObserver)==null||r.disconnect(),this.state.active&&!this.state.paused&&this.state.containers.map(o=>{var i;(i=this._mutationObserver)==null||i.observe(o,{subtree:!0,childList:!0})})}),L(this,"getInitialFocusNode",()=>{let r=this.getNodeForOption("initialFocus",{hasFallback:!0});if(r===!1)return!1;if(r===void 0||r&&!gt(r))if(this.findContainerIndex(this.doc.activeElement)>=0)r=this.doc.activeElement;else{const o=this.state.tabbableGroups[0];r=o&&o.firstTabbableNode||this.getNodeForOption("fallbackFocus")}else r===null&&(r=this.getNodeForOption("fallbackFocus"));if(!r)throw new Error("Your focus-trap needs to have at least one focusable element");return r.isConnected||(r=this.getNodeForOption("fallbackFocus")),r}),L(this,"tryFocus",r=>{if(r!==!1&&r!==fr(this.doc)){if(!r||!r.focus){this.tryFocus(this.getInitialFocusNode());return}r.focus({preventScroll:!!this.config.preventScroll}),this.state.mostRecentlyFocusedNode=r,da(r)&&r.select()}}),L(this,"deactivate",r=>{if(!this.state.active)return this;const o={onDeactivate:this.config.onDeactivate,onPostDeactivate:this.config.onPostDeactivate,checkCanReturnFocus:this.config.checkCanReturnFocus,...r};clearTimeout(this.state.delayInitialFocusTimer),this.state.delayInitialFocusTimer=void 0,this.removeListeners(),this.state.active=!1,this.state.paused=!1,this.updateObservedNodes(),Vn.deactivateTrap(this.trapStack,this);const i=this.getOption(o,"onDeactivate"),s=this.getOption(o,"onPostDeactivate"),a=this.getOption(o,"checkCanReturnFocus"),l=this.getOption(o,"returnFocus","returnFocusOnDeactivate");i==null||i();const c=()=>{Bn(()=>{if(l){const d=this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);this.tryFocus(d)}s==null||s()})};if(l&&a){const d=this.getReturnFocusNode(this.state.nodeFocusedBeforeActivation);return a(d).then(c,c),this}return c(),this}),L(this,"pause",r=>{if(this.state.paused||!this.state.active)return this;const o=this.getOption(r,"onPause"),i=this.getOption(r,"onPostPause");return this.state.paused=!0,o==null||o(),this.removeListeners(),this.updateObservedNodes(),i==null||i(),this}),L(this,"unpause",r=>{if(!this.state.paused||!this.state.active)return this;const o=this.getOption(r,"onUnpause"),i=this.getOption(r,"onPostUnpause");return this.state.paused=!1,o==null||o(),this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),i==null||i(),this}),L(this,"updateContainerElements",r=>(this.state.containers=Array.isArray(r)?r.filter(Boolean):[r].filter(Boolean),this.state.active&&this.updateTabbableNodes(),this.updateObservedNodes(),this)),L(this,"getReturnFocusNode",r=>{const o=this.getNodeForOption("setReturnFocus",{params:[r]});return o||(o===!1?!1:r)}),L(this,"getOption",(r,o,i)=>r&&r[o]!==void 0?r[o]:this.config[i||o]),L(this,"getNodeForOption",(r,{hasFallback:o=!1,params:i=[]}={})=>{let s=this.config[r];if(typeof s=="function"&&(s=s(...i)),s===!0&&(s=void 0),!s){if(s===void 0||s===!1)return s;throw new Error(`\`${r}\` was specified but was not a node, or did not return a node`)}let a=s;if(typeof s=="string"){try{a=this.doc.querySelector(s)}catch(l){throw new Error(`\`${r}\` appears to be an invalid selector; error="${l.message}"`)}if(!a&&!o)throw new Error(`\`${r}\` as selector refers to no known node`)}return a}),L(this,"findNextNavNode",r=>{const{event:o,isBackward:i=!1}=r,s=r.target||et(o);this.updateTabbableNodes();let a=null;if(this.state.tabbableGroups.length>0){const l=this.findContainerIndex(s,o),c=l>=0?this.state.containerGroups[l]:void 0;if(l<0)i?a=this.state.tabbableGroups[this.state.tabbableGroups.length-1].lastTabbableNode:a=this.state.tabbableGroups[0].firstTabbableNode;else if(i){let d=this.state.tabbableGroups.findIndex(({firstTabbableNode:g})=>s===g);if(d<0&&((c==null?void 0:c.container)===s||gt(s)&&!ft(s)&&!(c!=null&&c.nextTabbableNode(s,!1)))&&(d=l),d>=0){const g=d===0?this.state.tabbableGroups.length-1:d-1,f=this.state.tabbableGroups[g];a=Mt(s)>=0?f.lastTabbableNode:f.lastDomTabbableNode}else $t(o)||(a=c==null?void 0:c.nextTabbableNode(s,!1))}else{let d=this.state.tabbableGroups.findIndex(({lastTabbableNode:g})=>s===g);if(d<0&&((c==null?void 0:c.container)===s||gt(s)&&!ft(s)&&!(c!=null&&c.nextTabbableNode(s)))&&(d=l),d>=0){const g=d===this.state.tabbableGroups.length-1?0:d+1,f=this.state.tabbableGroups[g];a=Mt(s)>=0?f.firstTabbableNode:f.firstDomTabbableNode}else $t(o)||(a=c==null?void 0:c.nextTabbableNode(s))}}else a=this.getNodeForOption("fallbackFocus");return a}),this.trapStack=e.trapStack||ca;const n={returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward(r){return $t(r)&&!r.shiftKey},isKeyBackward(r){return $t(r)&&r.shiftKey},...e};this.doc=n.document||lt(Array.isArray(t)?t[0]:t),this.config=n,this.updateContainerElements(t),this.setupMutationObserver()}get active(){return this.state.active}get paused(){return this.state.paused}findContainerIndex(t,e){const n=typeof(e==null?void 0:e.composedPath)=="function"?e.composedPath():void 0;return this.state.containerGroups.findIndex(({container:r,tabbableNodes:o})=>r.contains(t)||(n==null?void 0:n.includes(r))||o.find(i=>i===t))}updateTabbableNodes(){if(this.state.containerGroups=this.state.containers.map(t=>{const e=Jt(t),n=un(t),r=e.length>0?e[0]:void 0,o=e.length>0?e[e.length-1]:void 0,i=n.find(c=>ft(c)),s=n.slice().reverse().find(c=>ft(c)),a=!!e.find(c=>Mt(c)>0);function l(c,d=!0){const g=e.indexOf(c);return g<0?d?n.slice(n.indexOf(c)+1).find(f=>ft(f)):n.slice(0,n.indexOf(c)).reverse().find(f=>ft(f)):e[g+(d?1:-1)]}return{container:t,tabbableNodes:e,focusableNodes:n,posTabIndexesFound:a,firstTabbableNode:r,lastTabbableNode:o,firstDomTabbableNode:i,lastDomTabbableNode:s,nextTabbableNode:l}}),this.state.tabbableGroups=this.state.containerGroups.filter(t=>t.tabbableNodes.length>0),this.state.tabbableGroups.length<=0&&!this.getNodeForOption("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(this.state.containerGroups.find(t=>t.posTabIndexesFound)&&this.state.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")}addListeners(){if(this.state.active)return Vn.activateTrap(this.trapStack,this),this.state.delayInitialFocusTimer=this.config.delayInitialFocus?Bn(()=>{this.tryFocus(this.getInitialFocusNode())}):this.tryFocus(this.getInitialFocusNode()),this.listenerCleanups.push(H(this.doc,"focusin",this.handleFocus,!0),H(this.doc,"mousedown",this.handlePointerDown,{capture:!0,passive:!1}),H(this.doc,"touchstart",this.handlePointerDown,{capture:!0,passive:!1}),H(this.doc,"click",this.handleClick,{capture:!0,passive:!1}),H(this.doc,"keydown",this.handleTabKey,{capture:!0,passive:!1}),H(this.doc,"keydown",this.handleEscapeKey)),this}removeListeners(){if(this.state.active)return this.listenerCleanups.forEach(t=>t()),this.listenerCleanups=[],this}activate(t){if(this.state.active)return this;const e=this.getOption(t,"onActivate"),n=this.getOption(t,"onPostActivate"),r=this.getOption(t,"checkCanFocusTrap");r||this.updateTabbableNodes(),this.state.active=!0,this.state.paused=!1,this.state.nodeFocusedBeforeActivation=this.doc.activeElement||null,e==null||e();const o=()=>{r&&this.updateTabbableNodes(),this.addListeners(),this.updateObservedNodes(),n==null||n()};return r?(r(this.state.containers.concat()).then(o,o),this):(o(),this)}},$t=t=>t.key==="Tab",jt=(t,...e)=>typeof t=="function"?t(...e):t,ua=t=>!t.isComposing&&t.key==="Escape",Bn=t=>setTimeout(t,0),da=t=>t.localName==="input"&&"select"in t&&typeof t.select=="function";function Vr(t,e={}){let n;const r=_(()=>{const o=typeof t=="function"?t():t;if(o){n=new la(o,{escapeDeactivates:!1,allowOutsideClick:!0,preventScroll:!0,returnFocusOnDeactivate:!0,delayInitialFocus:!1,fallbackFocus:o,...e,document:lt(o)});try{n.activate()}catch{}}});return function(){n==null||n.deactivate(),r()}}var Fe="data-scroll-lock";function fa(t){const e=t.getBoundingClientRect().left;return Math.round(e)+t.scrollLeft?"paddingLeft":"paddingRight"}function Br(t){const e=t??document,n=e.defaultView??window,{documentElement:r,body:o}=e;if(o.hasAttribute(Fe))return;o.setAttribute(Fe,"");const s=n.innerWidth-r.clientWidth,a=()=>ws(r,"--scrollbar-width",`${s}px`),l=fa(r),c=()=>pe(o,{overflow:"hidden",[l]:`${s}px`}),d=()=>{const{scrollX:f,scrollY:u,visualViewport:p}=n,m=(p==null?void 0:p.offsetLeft)??0,h=(p==null?void 0:p.offsetTop)??0,y=pe(o,{position:"fixed",overflow:"hidden",top:`${-(u-Math.floor(h))}px`,left:`${-(f-Math.floor(m))}px`,right:"0",[l]:`${s}px`});return()=>{y==null||y(),n.scrollTo({left:f,top:u,behavior:"instant"})}},g=[a(),Ee()?d():c()];return()=>{g.forEach(f=>f==null?void 0:f()),o.removeAttribute(Fe)}}var ga=yt("dialog").parts("trigger","backdrop","positioner","content","title","description","closeTrigger"),vt=ga.build(),Mr=t=>{var e;return((e=t.ids)==null?void 0:e.positioner)??`dialog:${t.id}:positioner`},$r=t=>{var e;return((e=t.ids)==null?void 0:e.backdrop)??`dialog:${t.id}:backdrop`},je=t=>{var e;return((e=t.ids)==null?void 0:e.content)??`dialog:${t.id}:content`},jr=t=>{var e;return((e=t.ids)==null?void 0:e.trigger)??`dialog:${t.id}:trigger`},We=t=>{var e;return((e=t.ids)==null?void 0:e.title)??`dialog:${t.id}:title`},He=t=>{var e;return((e=t.ids)==null?void 0:e.description)??`dialog:${t.id}:description`},Wr=t=>{var e;return((e=t.ids)==null?void 0:e.closeTrigger)??`dialog:${t.id}:close`},ce=t=>t.getById(je(t)),pa=t=>t.getById(Mr(t)),ma=t=>t.getById($r(t)),ha=t=>t.getById(jr(t)),ba=t=>t.getById(We(t)),va=t=>t.getById(He(t)),ya=t=>t.getById(Wr(t));function xa(t,e){const{state:n,send:r,context:o,prop:i,scope:s}=t,a=i("aria-label"),l=n.matches("open");return{open:l,setOpen(c){n.matches("open")!==c&&r({type:c?"OPEN":"CLOSE"})},getTriggerProps(){return e.button({...vt.trigger.attrs,dir:i("dir"),id:jr(s),"aria-haspopup":"dialog",type:"button","aria-expanded":l,"data-state":l?"open":"closed","aria-controls":je(s),onClick(c){c.defaultPrevented||r({type:"TOGGLE"})}})},getBackdropProps(){return e.element({...vt.backdrop.attrs,dir:i("dir"),hidden:!l,id:$r(s),"data-