@playwright-opentelemetry/trace-viewer 0.3.2 → 0.3.4

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.
@@ -8,7 +8,7 @@ End: ${s(o())}`,l=()=>Object.entries(t.attributes).filter(([u])=>u!=="test.step.
8
8
  ${A()?"w-1 cursor-col-resize hover:bg-blue-400/50":"h-1 cursor-row-resize hover:bg-blue-400/50"}
9
9
  ${i()?"bg-blue-500":"bg-gray-300"}
10
10
  flex-shrink-0 transition-colors
11
- `,I={[A()?"width":"height"]:`${100-s()}%`};return p!==h.e&&Tt(c,h.e=p),h.t=Wr(g,E,h.t),B!==h.a&&we(d,"aria-orientation",h.a=B),C!==h.o&&we(d,"aria-valuenow",h.o=C),x!==h.i&&Tt(d,h.i=x),h.n=Wr(f,I,h.n),h},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),c})()}fn(["mousedown"]);function lp(e,t,n){if(t<=0)return[];if(e.length===0)return Array(t).fill(null);const r=[...e].sort((i,a)=>i.timestamp-a.timestamp),s=n??{startMs:r[0].timestamp,endMs:r[r.length-1].timestamp};return r.filter(i=>i.timestamp>=s.startMs&&i.timestamp<=s.endMs).length===0?Ap(r,t,s):up(r,t,s)}function cp(e){return{startMs:e.visibleStartMs,endMs:e.visibleEndMs}}function Ap(e,t,n){let r=null;for(const s of e)s.timestamp<n.startMs&&(!r||s.timestamp>r.timestamp)&&(r=s);return r?Array(t).fill(r):Array(t).fill(null)}function up(e,t,n){const r=n.endMs-n.startMs;if(r<=0){const i=Zi(e,n.startMs);return Array(t).fill(i)}const s=r/t,o=[];for(let i=0;i<t;i++){const a=n.startMs+i*s,l=n.startMs+(i+1)*s,u=(a+l)/2,A=i===t-1,c=e.filter(g=>A?g.timestamp>=a&&g.timestamp<=l:g.timestamp>=a&&g.timestamp<l);if(c.length>0){const g=c.reduce((d,f)=>{const m=Math.abs(d.timestamp-u);return Math.abs(f.timestamp-u)<m?f:d});o.push(g)}else{const g=Zi(e,a);o.push(g)}}return o}function Zi(e,t){let n=null;for(const r of e)r.timestamp<=t&&(!n||r.timestamp>n.timestamp)&&(n=r);return n}var gp=P('<div class="h-full bg-gray-50 overflow-hidden p-2"><div class="flex gap-2 h-full">'),dp=P('<div class="flex items-center justify-center w-full text-gray-400 text-sm">Resize panel to view screenshots'),fp=P('<div class="flex items-center justify-center w-full text-gray-400 text-sm">No screenshots available'),hp=P('<div class="flex items-center justify-center w-full text-gray-400 text-sm">No screenshots in this time range'),mp=P('<div class="flex-shrink-0 h-full aspect-video">'),pp=P('<div class="flex-shrink-0 h-full aspect-video bg-white rounded border border-gray-200 overflow-hidden shadow-sm"><img class="w-full h-full object-contain"loading=lazy>',!0,!1,!1);function ea(e){let t;const[n,r]=K(0),s=_(()=>e.screenshots.map(a=>({timestamp:a.timestamp-e.testStartTimeMs,original:a})));ze(()=>{if(!t)return;const a=new ResizeObserver(l=>{for(const u of l){const A=u.contentRect.height,c=u.contentRect.width;if(A>0&&c>0){const f=(A-16)*(16/9),m=8,h=Math.floor((c+m)/(f+m));r(Math.max(0,h))}}});a.observe(t),Te(()=>{a.disconnect()})});const o=_(()=>{const a=cp(e.viewport);return lp(s(),n(),a).map(u=>u?u.original:null)}),i=_(()=>o().some(a=>a!==null));return(()=>{var a=gp(),l=a.firstChild,u=t;return typeof u=="function"?hn(u,a):t=a,O(l,v(Z,{get when(){return n()>0},get fallback(){return v(Z,{get when(){return e.screenshots.length>0},get fallback(){return fp()},get children(){return dp()}})},get children(){return v(Z,{get when(){return i()},get fallback(){return hp()},get children(){return v(_e,{get each(){return o()},children:A=>v(Z,{when:A,get fallback(){return mp()},children:c=>(()=>{var g=pp(),d=g.firstChild;return g.addEventListener("mouseleave",()=>e.onScreenshotHover?.(null)),g.addEventListener("mouseenter",()=>e.onScreenshotHover?.(c().url)),we(d,"draggable",!1),$(f=>{var m=c().url,h=`Screenshot at ${c().timestamp}`;return m!==f.e&&we(d,"src",f.e=m),h!==f.t&&we(d,"alt",f.t=h),f},{e:void 0,t:void 0}),g})()})})}})}})),a})()}const Ep=[100,200,250,500,1e3,2e3,5e3,1e4,15e3,3e4,6e4,12e4,3e5,6e5];function ta(e){if(e===0)return"0s";const t=e/1e3;if(t<1)return`${Math.round(e)}ms`;if(t<60){if(t===Math.floor(t))return`${t}s`;const s=Math.round(t*10)/10;return s===Math.floor(s)?`${s}s`:`${s}s`}const n=Math.floor(t/60),r=Math.round(t%60);return r===0?`${n}m`:`${n}m ${r}s`}function Bp(e,t=60){if(e<=0)return 0;const n=Math.floor(e/t)+1;return Math.max(2,n)}function Ip(e,t){if(e<=0||t<2)return e>0?e:1e3;for(const s of Ep)if(Math.floor(e/s)+1<=t)return s;const n=e/(t-1),r=10**Math.floor(Math.log10(n));return Math.ceil(n/r)*r}function vp(e,t){if(e<=0)return[{position:0,timeMs:0,label:"0s"}];const n=[];for(let s=0;s<=e;s+=t)n.push({position:s/e,timeMs:s,label:ta(s)});const r=n[n.length-1];return r&&r.timeMs<e&&(e-r.timeMs<=t*.5&&n.pop(),n.push({position:1,timeMs:e,label:ta(e)})),n}function na(e,t,n=60){const r=Bp(t,n),s=Ip(e,r),o=vp(e,s);return{intervalMs:s,ticks:o}}var wp=P('<div class="absolute top-0 bottom-0 bg-gray-300/30 pointer-events-none"style=left:0%>'),Cp=P('<div class="absolute top-0 bottom-0 bg-gray-300/30 pointer-events-none"style=right:0%>'),yp=P('<div class="absolute top-0 bottom-0 bg-blue-500/10 border-y border-blue-400/50">'),ra=P('<div class="absolute top-0 bottom-0 w-1.5 bg-blue-500 hover:bg-blue-600 cursor-ew-resize z-10 transition-colors"style=transform:translateX(-50%)><div class="absolute inset-y-1 left-0.5 w-px bg-blue-300">'),xp=P('<div class="relative h-6 bg-gray-50 border-b border-gray-200 flex-shrink-0 select-none">'),bp=P('<div class="absolute top-0 bottom-0 flex items-center pointer-events-none"><div class="w-px h-5 bg-gray-300"></div><span class="text-[10px] text-gray-500 whitespace-nowrap pl-1">'),Sp=P('<div class="absolute top-0 bottom-0 w-px bg-blue-500 pointer-events-none z-50">');const sa=.01;function Dp(e){let t;const[n,r]=K([]),[s,o]=K(null);ze(()=>{if(!t)return;const f=new ResizeObserver(m=>{for(const h of m){const p=h.contentRect.width;if(p>0){const E=na(e.durationMs,p);r(E.ticks)}}});f.observe(t),Te(()=>{f.disconnect()})}),ze(()=>{if(t){const f=t.getBoundingClientRect().width;if(f>0){const m=na(e.durationMs,f);r(m.ticks)}}});const i=()=>Gs(e.viewport.visibleStartMs,e.viewport)*100,a=()=>Gs(e.viewport.visibleEndMs,e.viewport)*100,l=()=>a()-i(),u=()=>{if(e.hoverPosition===null)return null;const f=on(e.hoverPosition,e.viewport);return Gs(f,e.viewport)*100},A=f=>m=>{if(m.preventDefault(),m.stopPropagation(),!t)return;const h=t.getBoundingClientRect().width;o({mode:f,startMouseX:m.clientX,containerWidth:h,initialViewport:{...e.viewport}})},c=f=>{const m=s();if(!m||!e.onViewportChange)return;const E=(f.clientX-m.startMouseX)/m.containerWidth*m.initialViewport.totalDurationMs;let B;switch(m.mode){case"left-handle":{const C=m.initialViewport.visibleStartMs+E,x=0,I=m.initialViewport.visibleEndMs-m.initialViewport.totalDurationMs*sa;B={...m.initialViewport,visibleStartMs:Math.max(x,Math.min(I,C))};break}case"right-handle":{const C=m.initialViewport.visibleEndMs+E,x=m.initialViewport.visibleStartMs+m.initialViewport.totalDurationMs*sa,I=m.initialViewport.totalDurationMs;B={...m.initialViewport,visibleEndMs:Math.max(x,Math.min(I,C))};break}case"pan":{const C=m.initialViewport.visibleEndMs-m.initialViewport.visibleStartMs;let x=m.initialViewport.visibleStartMs+E,I=m.initialViewport.visibleEndMs+E;x<0&&(x=0,I=C),I>m.initialViewport.totalDurationMs&&(I=m.initialViewport.totalDurationMs,x=I-C),B={...m.initialViewport,visibleStartMs:x,visibleEndMs:I};break}}e.onViewportChange(To(B))},g=()=>{o(null)};dn(()=>{const f=h=>c(h),m=()=>g();document.addEventListener("mousemove",f),document.addEventListener("mouseup",m),Te(()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",m)})});const d=()=>{const f=s();if(f)return f.mode==="pan"?"grabbing":"ew-resize"};return(()=>{var f=xp(),m=t;return typeof m=="function"?hn(m,f):t=f,O(f,v(Z,{get when(){return!fh(e.viewport)},get children(){return[(()=>{var h=wp();return $(p=>V(h,"width",`${i()}%`)),h})(),(()=>{var h=Cp();return $(p=>V(h,"left",`${a()}%`)),h})(),(()=>{var h=yp();return Dn(h,"mousedown",A("pan"),!0),$(p=>{var E=`${i()}%`,B=`${l()}%`,C=s()?.mode==="pan"?"grabbing":"grab";return E!==p.e&&V(h,"left",p.e=E),B!==p.t&&V(h,"width",p.t=B),C!==p.a&&V(h,"cursor",p.a=C),p},{e:void 0,t:void 0,a:void 0}),h})(),(()=>{var h=ra();return Dn(h,"mousedown",A("left-handle"),!0),$(p=>V(h,"left",`${i()}%`)),h})(),(()=>{var h=ra();return Dn(h,"mousedown",A("right-handle"),!0),$(p=>V(h,"left",`${a()}%`)),h})()]}}),null),O(f,v(_e,{get each(){return n()},children:(h,p)=>{const E=()=>p()===n().length-1;return(()=>{var B=bp(),C=B.firstChild,x=C.nextSibling;return O(x,()=>h.label),$(I=>{var w=`${h.position*100}%`,y=E()?"absolute":"relative",S=E()?"1px":void 0;return w!==I.e&&V(B,"left",I.e=w),y!==I.t&&V(x,"position",I.t=y),S!==I.a&&V(x,"right",I.a=S),I},{e:void 0,t:void 0,a:void 0}),B})()}}),null),O(f,v(Z,{get when(){return u()},keyed:!0,children:h=>(()=>{var p=Sp();return V(p,"left",`${h}%`),p})()}),null),$(h=>V(f,"cursor",d())),f})()}fn(["mousedown"]);var an=(e,t=[])=>({parts:(...n)=>{if(Qp(t))return an(e,n);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...n)=>an(e,[...t,...n]),omit:(...n)=>an(e,t.filter(r=>!n.includes(r))),rename:n=>an(n,t),keys:()=>t,build:()=>[...new Set(t)].reduce((n,r)=>Object.assign(n,{[r]:{selector:[`&[data-scope="${yn(e)}"][data-part="${yn(r)}"]`,`& [data-scope="${yn(e)}"][data-part="${yn(r)}"]`].join(", "),attrs:{"data-scope":yn(e),"data-part":yn(r)}}}),{})}),yn=e=>e.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),Qp=e=>e.length===0,Op=an("fieldset").parts("root","errorText","helperText","legend"),br=Op.build(),Mp=e=>typeof e=="function",oa=(e,t)=>{for(const n of e)Mp(n)&&n(t)};function ds(...e){let t=null;return ze(()=>{oa(e,t)}),n=>{t=n,oa(e,n)}}var gt=()=>(e,t)=>An(e,t);function Tp(e){return e==null?[]:Array.isArray(e)?e:[e]}var Rp=(e,t)=>e.indexOf(t)!==-1,Fp=(e,...t)=>e.concat(t),Ec=(e,...t)=>e.filter(n=>!t.includes(n)),ia=(e,t)=>Rp(e,t)?Ec(e,t):Fp(e,t),aa=e=>e?.constructor.name==="Array",Pp=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!hr(e[n],t[n]))return!1;return!0},hr=(e,t)=>{if(Object.is(e,t))return!0;if(e==null&&t!=null||e!=null&&t==null)return!1;if(typeof e?.isEqual=="function"&&typeof t?.isEqual=="function")return e.isEqual(t);if(typeof e=="function"&&typeof t=="function")return e.toString()===t.toString();if(aa(e)&&aa(t))return Pp(Array.from(e),Array.from(t));if(typeof e!="object"||typeof t!="object")return!1;const n=Object.keys(t??Object.create(null)),r=n.length;for(let s=0;s<r;s++)if(!Reflect.has(e,n[s]))return!1;for(let s=0;s<r;s++){const o=n[s];if(!hr(e[o],t[o]))return!1}return!0},kp=e=>Array.isArray(e),_p=e=>e===!0||e===!1,Bc=e=>e!=null&&typeof e=="object",kr=e=>Bc(e)&&!kp(e),Np=e=>typeof e=="number"&&!Number.isNaN(e),Rn=e=>typeof e=="string",it=e=>typeof e=="function",Lp=e=>e==null,tr=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Yp=e=>Object.prototype.toString.call(e),Ic=Function.prototype.toString,Gp=Ic.call(Object),Hp=e=>{if(!Bc(e)||Yp(e)!="[object Object]"||Kp(e))return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const n=tr(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Ic.call(n)==Gp},Up=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,Vp=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,Kp=e=>Up(e)||Vp(e),Wp=()=>{},Eo=(...e)=>(...t)=>{e.forEach(function(n){n?.(...t)})};function bt(e,t,...n){if(e in t){const s=t[e];return it(s)?s(...n):s}const r=new Error(`No matching key: ${JSON.stringify(e)} in ${JSON.stringify(Object.keys(t))}`);throw Error.captureStackTrace?.(r,bt),r}function Fo(e){if(!Hp(e)||e===void 0)return e;const t=Reflect.ownKeys(e).filter(r=>typeof r=="string"),n={};for(const r of t){const s=e[r];s!==void 0&&(n[r]=Fo(s))}return n}function Bo(...e){e.length===1?e[0]:e[1],e.length===2&&e[0]}function vc(e,t){if(e==null)throw new Error(t())}var zp=Object.defineProperty,$p=(e,t,n)=>t in e?zp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ws=(e,t,n)=>$p(e,typeof t!="symbol"?t+"":t,n);function jp(e){if(!e)return;const t=e.selectionStart??0,n=e.selectionEnd??0;Math.abs(n-t)===0&&t===0&&e.setSelectionRange(e.value.length,e.value.length)}var qp=()=>{},fs=e=>typeof e=="object"&&e!==null,q=e=>e?"":void 0,_r=e=>e?"true":void 0,Jp=1,Xp=9,Zp=11,st=e=>fs(e)&&e.nodeType===Jp&&typeof e.nodeName=="string",Po=e=>fs(e)&&e.nodeType===Xp,eE=e=>fs(e)&&e===e.window,wc=e=>st(e)?e.localName||"":"#document";function tE(e){return["html","body","#document"].includes(wc(e))}var nE=e=>fs(e)&&e.nodeType!==void 0,Ln=e=>nE(e)&&e.nodeType===Zp&&"host"in e,rE=e=>!!e?.matches("a[href]"),sE=e=>st(e)?e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0:!1;function oE(e){if(!e)return!1;const t=e.getRootNode();return Cc(t)===e}function ts(e,t){if(!e||!t||!st(e)||!st(t))return!1;const n=t.getRootNode?.();if(e===t||e.contains(t))return!0;if(n&&Ln(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function qt(e){return Po(e)?e:eE(e)?e.document:e?.ownerDocument??document}function iE(e){return qt(e).documentElement}function Pt(e){return Ln(e)?Pt(e.host):Po(e)?e.defaultView??window:st(e)?e.ownerDocument?.defaultView??window:window}function Cc(e){let t=e.activeElement;for(;t?.shadowRoot;){const n=t.shadowRoot.activeElement;if(!n||n===t)break;t=n}return t}function aE(e){if(wc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ln(e)&&e.host||iE(e);return Ln(t)?t.host:t}function lE(e){let t;try{if(t=e.getRootNode({composed:!0}),Po(t)||Ln(t))return t}catch{}return e.ownerDocument??document}var zs=new WeakMap;function ko(e){return zs.has(e)||zs.set(e,Pt(e).getComputedStyle(e)),zs.get(e)}var cE=new Set(["menu","listbox","dialog","grid","tree","region"]),AE=e=>cE.has(e),uE=e=>e.getAttribute("aria-controls")?.split(" ")||[];function gE(e,t){const n=new Set,r=lE(e),s=o=>{const i=o.querySelectorAll("[aria-controls]");for(const a of i){if(a.getAttribute("aria-expanded")!=="true")continue;const l=uE(a);for(const u of l){if(!u||n.has(u))continue;n.add(u);const A=r.getElementById(u);if(A){const c=A.getAttribute("role"),g=A.getAttribute("aria-modal")==="true";if(c&&AE(c)&&!g&&(A===t||A.contains(t)||s(A)))return!0}}}return!1};return s(e)}var _o=()=>typeof document<"u";function dE(){return navigator.userAgentData?.platform??navigator.platform}function fE(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}var hE=e=>_o()&&e.test(dE()),mE=e=>_o()&&e.test(fE()),la=()=>_o()&&!!navigator.maxTouchPoints,yc=()=>hE(/^Mac/i),pE=()=>mE(/Firefox/i);function EE(e){return e.composedPath?.()??e.nativeEvent?.composedPath?.()}function Yn(e){return EE(e)?.[0]??e.target}function BE(e){const t=e.currentTarget;if(!t||!t.matches("a[href], button[type='submit'], input[type='submit']"))return!1;const r=e.button===1,s=wE(e);return r||s}function IE(e){const t=e.currentTarget;if(!t)return!1;const n=t.localName;return e.altKey?n==="a"||n==="button"&&t.type==="submit"||n==="input"&&t.type==="submit":!1}function vE(e){return yE(e).isComposing||e.keyCode===229}function wE(e){return yc()?e.metaKey:e.ctrlKey}var Sr=e=>e.button===0,xc=e=>e.button===2||yc()&&e.ctrlKey&&e.button===0,CE={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"},ca={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft"};function Aa(e,t={}){const{dir:n="ltr",orientation:r="horizontal"}=t;let s=e.key;return s=CE[s]??s,n==="rtl"&&r==="horizontal"&&s in ca&&(s=ca[s]),s}function yE(e){return e.nativeEvent??e}var Nr=(e,t,n,r)=>{const s=typeof e=="function"?e():e;return s?.addEventListener(t,n,r),()=>{s?.removeEventListener(t,n,r)}},xE="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";function bc(e){return!st(e)||e.closest("[inert]")?!1:e.matches(xE)&&sE(e)}var bE=class Sc{constructor(){Ws(this,"id",null),Ws(this,"fn_cleanup"),Ws(this,"cleanup",()=>{this.cancel()})}static create(){return new Sc}request(t){this.cancel(),this.id=globalThis.requestAnimationFrame(()=>{this.id=null,this.fn_cleanup=t?.()})}cancel(){this.id!==null&&(globalThis.cancelAnimationFrame(this.id),this.id=null),this.fn_cleanup?.(),this.fn_cleanup=void 0}isActive(){return this.id!==null}};function Se(e){const t=bE.create();return t.request(e),t.cleanup}function Dc(e){const t=new Set;function n(r){const s=globalThis.requestAnimationFrame(r);t.add(()=>globalThis.cancelAnimationFrame(s))}return n(()=>n(e)),function(){t.forEach(s=>s())}}function SE(e,t,n){const r=Se(()=>{e.removeEventListener(t,s,!0),n()}),s=()=>{r(),n()};return e.addEventListener(t,s,{once:!0,capture:!0}),r}function DE(e,t){if(!e)return;const{attributes:n,callback:r}=t,s=e.ownerDocument.defaultView||window,o=new s.MutationObserver(i=>{for(const a of i)a.type==="attributes"&&a.attributeName&&n.includes(a.attributeName)&&r(a)});return o.observe(e,{attributes:!0,attributeFilter:n}),()=>o.disconnect()}function QE(e,t){const{defer:n}=t,r=n?Se:o=>o(),s=[];return s.push(r(()=>{const o=typeof e=="function"?e():e;s.push(DE(o,t))})),()=>{s.forEach(o=>o?.())}}function OE(e){const t=()=>{const n=Pt(e);e.dispatchEvent(new n.MouseEvent("click"))};pE()?SE(e,"keyup",t):queueMicrotask(t)}function Io(e){const t=aE(e);return tE(t)?qt(t).body:st(t)&&Qc(t)?t:Io(t)}var ME=/auto|scroll|overlay|hidden|clip/,TE=new Set(["inline","contents"]);function Qc(e){const t=Pt(e),{overflow:n,overflowX:r,overflowY:s,display:o}=t.getComputedStyle(e);return ME.test(n+s+r)&&!TE.has(o)}function RE(e){return e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth}function ua(e,t){const{rootEl:n,...r}=t||{};!e||!n||!Qc(n)||!RE(n)||e.scrollIntoView(r)}function FE(e,t){return e?.querySelector(t)??null}function Oc(e,t){if(!e)return qp;const n=Object.keys(t).reduce((r,s)=>(r[s]=e.style.getPropertyValue(s),r),{});return Object.assign(e.style,t),()=>{Object.assign(e.style,n),e.style.length===0&&e.removeAttribute("style")}}function PE(e,t,n){const{signal:r}=t;return[new Promise((i,a)=>{const l=setTimeout(()=>{a(new Error(`Timeout of ${n}ms exceeded`))},n);r.addEventListener("abort",()=>{clearTimeout(l),a(new Error("Promise aborted"))}),e.then(u=>{r.aborted||(clearTimeout(l),i(u))}).catch(u=>{r.aborted||(clearTimeout(l),a(u))})}),()=>t.abort()]}function kE(e,t){const{timeout:n,rootNode:r}=t,s=Pt(r),o=qt(r),i=new s.AbortController;return PE(new Promise(a=>{const l=e();if(l){a(l);return}const u=new s.MutationObserver(()=>{const A=e();A&&A.isConnected&&(u.disconnect(),a(A))});u.observe(o.body,{childList:!0,subtree:!0})}),i,n)}var _E=(...e)=>e.map(t=>t?.trim?.()).filter(Boolean).join(" "),NE=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g,ga=e=>{const t={};let n;for(;n=NE.exec(e);)t[n[1]]=n[2];return t},LE=(e,t)=>{if(Rn(e)){if(Rn(t))return`${e};${t}`;e=ga(e)}else Rn(t)&&(t=ga(t));return Object.assign({},e??{},t??{})};function YE(...e){let t={};for(let n of e){if(!n)continue;for(let s in t){if(s.startsWith("on")&&typeof t[s]=="function"&&typeof n[s]=="function"){t[s]=Eo(n[s],t[s]);continue}if(s==="className"||s==="class"){t[s]=_E(t[s],n[s]);continue}if(s==="style"){t[s]=LE(t[s],n[s]);continue}t[s]=n[s]!==void 0?n[s]:t[s]}for(let s in n)t[s]===void 0&&(t[s]=n[s]);const r=Object.getOwnPropertySymbols(n);for(let s of r)t[s]=n[s]}return t}function GE(){return{and:(...e)=>function(n){return e.every(r=>n.guard(r))},or:(...e)=>function(n){return e.some(r=>n.guard(r))},not:e=>function(n){return!n.guard(e)}}}function HE(){return{guards:GE(),createMachine:e=>e,choose:e=>function({choose:n}){return n(e)?.actions}}}var xn=(e=>(e.NotStarted="Not Started",e.Started="Started",e.Stopped="Stopped",e))(xn||{}),$s="__init__";function UE(e){const t=()=>e.getRootNode?.()??document,n=()=>qt(t());return{...e,getRootNode:t,getDoc:n,getWin:()=>n().defaultView??window,getActiveElement:()=>Cc(t()),isActiveElement:oE,getById:i=>t().getElementById(i)}}function VE(e){return new Proxy({},{get(t,n){return n==="style"?r=>e({style:r}).style:e}})}var mr=()=>e=>Array.from(new Set(e));function ns(e){const t=e().value??e().defaultValue,n=e().isEqual??Object.is,[r,s]=K(t),o=_(()=>e().value!=null),i={current:r()},a={current:void 0};ze(()=>{const A=o()?e().value:r();a.current=A,i.current=A});const l=A=>{const c=a.current,g=it(A)?A(i.current):A;e().debug&&console.log(`[bindable > ${e().debug}] setValue`,{next:g,prev:c}),o()||s(g),n(g,c)||e().onChange?.(g,c)};function u(){const A=o()?e().value:r;return it(A)?A():A}return{initial:t,ref:i,get:u,set:l,invoke(A,c){e().onChange?.(A,c)},hash(A){return e().hash?.(A)??String(A)}}}ns.cleanup=e=>{Te(()=>e())};ns.ref=e=>{let t=e;return{get:()=>t,set:n=>{t=n}}};function KE(e){const t={current:e};return{get(n){return t.current[n]},set(n,r){t.current[n]=r}}}function js(e){return it(e)?e():e}var WE=(e,t)=>{let n=[],r=!0;ze(()=>{if(r){n=e.map(o=>js(o)),r=!1;return}let s=!1;for(let o=0;o<e.length;o++)if(!hr(n[o],js(e[o]))){s=!0;break}s&&(n=e.map(o=>js(o)),t())})};function Mc(e,t={}){const n=_(()=>{const{id:y,ids:S,getRootNode:Q}=qs(t);return UE({id:y,ids:S,getRootNode:Q})}),r=(...y)=>{e.debug&&console.log(...y)},s=_(()=>e.props?.({props:Fo(qs(t)),scope:n()})??qs(t)),o=zE(s),i=e.context?.({prop:o,bindable:ns,get scope(){return n()},flush:da,getContext(){return a},getComputed(){return C},getRefs(){return f},getEvent(){return g()}}),a={get(y){return i?.[y].get()},set(y,S){i?.[y].set(S)},initial(y){return i?.[y].initial},hash(y){const S=i?.[y].get();return i?.[y].hash(S)}},l={current:new Map},u={current:null},A={current:null},c={current:{type:""}},g=()=>de(c.current,{current(){return c.current},previous(){return A.current}}),d=()=>de(x,{matches(...y){const S=x.get();return y.includes(S)},hasTag(y){const S=x.get();return!!e.states[S]?.tags?.includes(y)}}),f=KE(e.refs?.({prop:o,context:a})??{}),m=()=>({state:d(),context:a,event:g(),prop:o,send:w,action:h,guard:p,track:WE,refs:f,computed:C,flush:da,get scope(){return n()},choose:B}),h=y=>{const S=it(y)?y(m()):y;if(!S)return;const Q=S.map(D=>{const R=e.implementations?.actions?.[D];return R||Bo(`[zag-js] No implementation found for action "${JSON.stringify(D)}"`),R});for(const D of Q)D?.(m())},p=y=>it(y)?y(m()):e.implementations?.guards?.[y](m()),E=y=>{const S=it(y)?y(m()):y;if(!S)return;const Q=S.map(R=>{const T=e.implementations?.effects?.[R];return T||Bo(`[zag-js] No implementation found for effect "${JSON.stringify(R)}"`),T}),D=[];for(const R of Q){const T=R?.(m());T&&D.push(T)}return()=>D.forEach(R=>R?.())},B=y=>Tp(y).find(S=>{let Q=!S.guard;return Rn(S.guard)?Q=!!p(S.guard):it(S.guard)&&(Q=S.guard(m())),Q}),C=y=>{vc(e.computed,()=>"[zag-js] No computed object found on machine");const S=e.computed[y];return S({context:a,event:c.current,prop:o,refs:f,scope:n(),computed:C})},x=ns(()=>({defaultValue:e.initialState({prop:o}),onChange(y,S){S&&(l.current.get(S)?.(),l.current.delete(S)),S&&h(e.states[S]?.exit),h(u.current?.actions);const Q=E(e.states[y]?.effects);if(Q&&l.current.set(y,Q),S===$s){h(e.entry);const D=E(e.effects);D&&l.current.set($s,D)}h(e.states[y]?.entry)}}));let I=xn.NotStarted;dn(()=>{const y=I===xn.Started;I=xn.Started,r(y?"rehydrating...":"initializing..."),x.invoke(x.initial,$s)}),Te(()=>{r("unmounting..."),I=xn.Stopped,l.current.forEach(S=>S?.()),l.current=new Map,u.current=null,h(e.exit)});const w=y=>{queueMicrotask(()=>{if(I!==xn.Started)return;A.current=c.current,c.current=y;let S=De(()=>x.get());const Q=e.states[S].on?.[y.type]??e.on?.[y.type],D=B(Q);if(!D)return;u.current=D;const R=D.target??S;r("transition",y.type,D.target||S,`(${D.actions})`);const T=R!==S;T?x.set(R):D.reenter&&!T?x.invoke(S,S):h(D.actions)})};return e.watch?.(m()),{state:d(),send:w,context:a,prop:o,get scope(){return n()},refs:f,computed:C,event:g(),getStatus:()=>I}}function da(e){e()}function qs(e){return it(e)?e():e}function zE(e){return function(n){return e()[n]}}function ne(...e){const t={};for(let n=0;n<e.length;n++){let r=e[n];if(typeof r=="function"&&(r=r()),r){const s=Object.getOwnPropertyDescriptors(r);for(const o in s)o in t||Object.defineProperty(t,o,{enumerable:!0,get(){let i={};if(o==="style"||o==="class"||o==="className"||o.startsWith("on")){for(let a=0;a<e.length;a++){let l=e[a];typeof l=="function"&&(l=l()),i=YE(i,{[o]:(l||{})[o]})}return i[o]}for(let a=e.length-1;a>=0;a--){let l,u=e[a];if(typeof u=="function"&&(u=u()),l=(u||{})[o],l!==void 0)return l}}})}}return t}var fa={onFocus:"onFocusIn",onBlur:"onFocusOut",onDoubleClick:"onDblClick",onChange:"onInput",defaultChecked:"checked",defaultValue:"value",htmlFor:"for",className:"class"},$E=e=>e.startsWith("--")?e:tB(e);function jE(e){return e in fa?fa[e]:e}var qE=VE(e=>{const t={};for(const n in e){const r=e[n];if(!(n==="readOnly"&&r===!1)){if(n==="style"&&kr(r)){t.style=JE(r);continue}if(n==="children"){Rn(r)&&(t.textContent=r);continue}t[jE(n)]=r}}return t});function JE(e){let t={};for(const n in e){const r=e[n];!Rn(r)&&!Np(r)||(t[$E(n)]=r)}return t}var XE=/[A-Z]/g,ZE=/^ms-/;function eB(e){return"-"+e.toLowerCase()}var Js={};function tB(e){if(Js.hasOwnProperty(e))return Js[e];var t=e.replace(XE,eB);return Js[e]=ZE.test(t)?"-"+t:t}var Xs=e=>n=>{const[r,s]=An(n,["asChild"]);if(r.asChild){const o=i=>{const[,a]=An(s,["ref"]);return ne(a,i)};return r.asChild(o)}return v(tl,de({component:e},s))};function nB(){const e=new Map;return new Proxy(Xs,{apply(t,n,r){return Xs(r[0])},get(t,n){const r=n;return e.has(r)||e.set(r,Xs(r)),e.get(r)}})}var oe=nB(),rB=e=>typeof e=="function",No=(e,...t)=>rB(e)?e(...t):e;function sB(e,t){return`${e} returned \`undefined\`. Seems you forgot to wrap component within ${t}`}function wt(e={}){const{strict:t=!0,hookName:n="useContext",providerName:r="Provider",errorMessage:s,defaultValue:o}=e,i=as(o);function a(){const l=yo(i);if(!l&&t){const u=new Error(s??sB(n,r));throw u.name="ContextError",tr(Error,"captureStackTrace")&&it(Error.captureStackTrace)&&Error.captureStackTrace(u,a),u}return l}return[i.Provider,a,i]}var[Ow,Lo]=wt({hookName:"useEnvironmentContext",providerName:"<EnvironmentProvider />",strict:!1,defaultValue:()=>({getRootNode:()=>document,getDocument:()=>document,getWindow:()=>window})}),oB=Object.defineProperty,Yo=(e,t)=>{for(var n in t)oB(e,n,{get:t[n],enumerable:!0})},[Tc,pr]=wt({hookName:"useFieldsetContext",providerName:"<FieldsetProvider />",strict:!1}),iB=e=>e.children(pr()),aB=e=>{const t=pr(),n=ne(()=>t().getErrorTextProps(),e);return v(Z,{get when(){return t().invalid},get children(){return v(oe.span,n)}})},lB=e=>{const t=pr(),n=ne(()=>t().getHelperTextProps(),e);return v(oe.span,n)},cB=e=>{const t=pr(),n=ne(()=>t().getLegendProps(),e);return v(oe.legend,n)},AB=e=>{const t=Lo(),n=de({disabled:!1,invalid:!1},No(e)),[r,s]=K(void 0),o=n.id??ls(),i=`fieldset::${o}::legend`,a=`fieldset::${o}::error-text`,l=`fieldset::${o}::helper-text`,[u,A]=K(!1),[c,g]=K(!1);dn(()=>{const E=r();if(!E)return;const B=()=>{const I=t().getRootNode();A(!!I.getElementById(a)),g(!!I.getElementById(l))};B();const C=t().getWindow(),x=new C.MutationObserver(B);x.observe(E,{childList:!0,subtree:!0}),Te(()=>x.disconnect())});const d=_(()=>{const E=[];return u()&&n.invalid&&E.push(a),c()&&E.push(l),E}),f=()=>({...br.root.attrs,disabled:n.disabled,"data-disabled":q(n.disabled),"data-invalid":q(n.invalid),"aria-labelledby":i,"aria-describedby":d().join(" ")||void 0}),m=()=>({id:i,...br.legend.attrs,"data-disabled":q(n.disabled),"data-invalid":q(n.invalid)}),h=()=>({id:l,...br.helperText.attrs}),p=()=>({id:a,...br.errorText.attrs,"aria-live":"polite"});return _(()=>({refs:{rootRef:s},ids:{legend:i,errorText:a,helperText:l},disabled:n.disabled,invalid:n.invalid,getRootProps:f,getLegendProps:m,getHelperTextProps:h,getErrorTextProps:p}))},Rc=e=>{const[t,n]=gt()(e,["id","disabled","invalid"]),r=AB(t),s=ne(()=>r().getRootProps(),n);return v(Tc,{value:r,get children(){return v(oe.fieldset,de(s,{ref(o){var i=ds(r().refs.rootRef,e.ref);typeof i=="function"&&i(o)}}))}})};Rc.displayName="FieldsetRoot";var uB=e=>{const[{value:t},n]=gt()(e,["value"]),r=ne(()=>t().getRootProps(),n);return v(Tc,{value:t,get children(){return v(oe.fieldset,r)}})},gB={};Yo(gB,{Context:()=>iB,ErrorText:()=>aB,HelperText:()=>lB,Legend:()=>cB,Root:()=>Rc,RootProvider:()=>uB});var dB=an("field").parts("root","errorText","helperText","input","label","select","textarea","requiredIndicator"),Gt=dB.build(),fB=e=>{if(!e)return;const t=ko(e),n=Pt(e),r=qt(e),s=()=>{requestAnimationFrame(()=>{e.style.height="auto";let u;t.boxSizing==="content-box"?u=e.scrollHeight-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):u=e.scrollHeight+parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),t.maxHeight!=="none"&&u>parseFloat(t.maxHeight)?(t.overflowY==="hidden"&&(e.style.overflowY="scroll"),u=parseFloat(t.maxHeight)):t.overflowY!=="hidden"&&(e.style.overflowY="hidden"),e.style.height=`${u}px`})};e.addEventListener("input",s),e.form?.addEventListener("reset",s);const o=Object.getPrototypeOf(e),i=Object.getOwnPropertyDescriptor(o,"value");Object.defineProperty(e,"value",{...i,set(){i?.set?.apply(this,arguments),s()}});const a=new n.ResizeObserver(()=>{requestAnimationFrame(()=>s())});a.observe(e);const l=new n.MutationObserver(()=>s());return l.observe(e,{attributes:!0,attributeFilter:["rows","placeholder"]}),r.fonts?.addEventListener("loadingdone",s),()=>{e.removeEventListener("input",s),e.form?.removeEventListener("reset",s),r.fonts?.removeEventListener("loadingdone",s),a.disconnect(),l.disconnect()}},[Fc,Ct]=wt({hookName:"useFieldContext",providerName:"<FieldProvider />",strict:!1}),hB=e=>e.children(Ct()),mB=e=>{const t=Ct(),n=ne(()=>t().getErrorTextProps(),e);return v(Z,{get when(){return t?.().invalid},get children(){return v(oe.span,n)}})},pB=e=>{const t=Ct(),n=ne(()=>t().getHelperTextProps(),e);return v(oe.span,n)},EB=e=>{const t=Ct(),n=ne(()=>t?.().getInputProps(),e);return v(oe.input,n)},BB=e=>{const t=Ct(),n=ne(()=>t?.().getLabelProps(),e);return v(oe.label,n)},IB=e=>{const t=Ct(),n=ne(()=>t().getRequiredIndicatorProps(),e);return v(Z,{get when(){return t().required},get fallback(){return e.fallback},get children(){return v(oe.span,de(n,{get children(){return e.children??"*"}}))}})},vB=e=>{const t=pr(),n=Lo(),r=de({disabled:!!t?.().disabled,required:!1,invalid:!1,readOnly:!1},e),[s,o]=K(!1),[i,a]=K(!1),l=r.id??ls(),[u,A]=K(void 0),c=r.ids?.control??`field::${l}`,g=r.ids?.errorText??`field::${l}::error-text`,d=r.ids?.helperText??`field::${l}::helper-text`,f=r.ids?.label??`field::${l}::label`;dn(()=>{const S=u();if(!S)return;const Q=()=>{const T=n().getRootNode();o(!!T.getElementById(g)),a(!!T.getElementById(d))};Q();const D=n().getWindow(),R=new D.MutationObserver(Q);R.observe(S,{childList:!0,subtree:!0}),Te(()=>R.disconnect())});const m=()=>({...Gt.root.attrs,id:c,role:"group","data-disabled":q(r.disabled),"data-invalid":q(r.invalid),"data-readonly":q(r.readOnly)}),h=()=>({...Gt.label.attrs,id:f,"data-disabled":q(r.disabled),"data-invalid":q(r.invalid),"data-readonly":q(r.readOnly),"data-required":q(r.required),htmlFor:l}),p=_(()=>{const S=[];return s()&&r.invalid&&S.push(g),i()&&S.push(d),S}),E=()=>({"aria-describedby":p().join(" ")||void 0,"aria-invalid":_r(r.invalid),"data-invalid":q(r.invalid),"data-required":q(r.required),"data-readonly":q(r.readOnly),id:l,required:r.required,disabled:r.disabled,readOnly:r.readOnly||void 0}),B=()=>({...E(),...Gt.input.attrs}),C=()=>({...E(),...Gt.textarea.attrs}),x=()=>({...E(),...Gt.select.attrs}),I=()=>({id:d,...Gt.helperText.attrs,"data-disabled":q(r.disabled)}),w=()=>({id:g,...Gt.errorText.attrs,"aria-live":"polite"}),y=()=>({"aria-hidden":!0,...Gt.requiredIndicator.attrs});return _(()=>({ariaDescribedby:p().join(" "),ids:{control:l,label:f,errorText:g,helperText:d},refs:{rootRef:A},disabled:r.disabled,invalid:r.invalid,readOnly:r.readOnly,required:r.required,getLabelProps:h,getRootProps:m,getInputProps:B,getTextareaProps:C,getSelectProps:x,getHelperTextProps:I,getErrorTextProps:w,getRequiredIndicatorProps:y}))},wB=e=>{const[t,n]=gt()(e,["id","ids","disabled","invalid","readOnly","required"]),r=vB(t),s=ne(()=>r().getRootProps(),n);return v(Fc,{value:r,get children(){return v(oe.div,de(s,{ref(o){var i=ds(r().refs.rootRef,e.ref);typeof i=="function"&&i(o)}}))}})},CB=e=>{const[{value:t},n]=gt()(e,["value"]),r=ne(()=>t().getRootProps(),n);return v(Fc,{value:t,get children(){return v(oe.div,r)}})},yB=e=>{const t=Ct(),n=ne(()=>t?.().getSelectProps(),e);return v(oe.select,n)},xB=e=>{const t=Ct();let n;const[r,s]=An(e,["autoresize"]),o=ne(()=>t?.().getTextareaProps(),()=>({style:{resize:r.autoresize?"none":void 0}}),s);return dn(()=>{if(!r.autoresize)return;const i=fB(n);Te(()=>i?.())}),v(oe.textarea,de(o,{ref(i){var a=ds(l=>n=l,e.ref);typeof a=="function"&&a(i)}}))},bB={};Yo(bB,{Context:()=>hB,ErrorText:()=>mB,HelperText:()=>pB,Input:()=>EB,Label:()=>BB,RequiredIndicator:()=>IB,Root:()=>wB,RootProvider:()=>CB,Select:()=>yB,Textarea:()=>xB});var SB=Object.defineProperty,DB=(e,t,n)=>t in e?SB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,W=(e,t,n)=>DB(e,typeof t!="symbol"?t+"":t,n),Lr={itemToValue(e){return typeof e=="string"?e:kr(e)&&tr(e,"value")?e.value:""},itemToString(e){return typeof e=="string"?e:kr(e)&&tr(e,"label")?e.label:Lr.itemToValue(e)},isItemDisabled(e){return kr(e)&&tr(e,"disabled")?!!e.disabled:!1}},Go=class Pc{constructor(t){this.options=t,W(this,"items"),W(this,"indexMap",null),W(this,"copy",n=>new Pc({...this.options,items:n??[...this.items]})),W(this,"isEqual",n=>hr(this.items,n.items)),W(this,"setItems",n=>this.copy(n)),W(this,"getValues",(n=this.items)=>{const r=[];for(const s of n){const o=this.getItemValue(s);o!=null&&r.push(o)}return r}),W(this,"find",n=>{if(n==null)return null;const r=this.indexOf(n);return r!==-1?this.at(r):null}),W(this,"findMany",n=>{const r=[];for(const s of n){const o=this.find(s);o!=null&&r.push(o)}return r}),W(this,"at",n=>{if(!this.options.groupBy&&!this.options.groupSort)return this.items[n]??null;let r=0;const s=this.group();for(const[,o]of s)for(const i of o){if(r===n)return i;r++}return null}),W(this,"sortFn",(n,r)=>{const s=this.indexOf(n),o=this.indexOf(r);return(s??0)-(o??0)}),W(this,"sort",n=>[...n].sort(this.sortFn.bind(this))),W(this,"getItemValue",n=>n==null?null:this.options.itemToValue?.(n)??Lr.itemToValue(n)),W(this,"getItemDisabled",n=>n==null?!1:this.options.isItemDisabled?.(n)??Lr.isItemDisabled(n)),W(this,"stringifyItem",n=>n==null?null:this.options.itemToString?.(n)??Lr.itemToString(n)),W(this,"stringify",n=>n==null?null:this.stringifyItem(this.find(n))),W(this,"stringifyItems",(n,r=", ")=>{const s=[];for(const o of n){const i=this.stringifyItem(o);i!=null&&s.push(i)}return s.join(r)}),W(this,"stringifyMany",(n,r)=>this.stringifyItems(this.findMany(n),r)),W(this,"has",n=>this.indexOf(n)!==-1),W(this,"hasItem",n=>n==null?!1:this.has(this.getItemValue(n))),W(this,"group",()=>{const{groupBy:n,groupSort:r}=this.options;if(!n)return[["",[...this.items]]];const s=new Map;this.items.forEach((i,a)=>{const l=n(i,a);s.has(l)||s.set(l,[]),s.get(l).push(i)});let o=Array.from(s.entries());return r&&o.sort(([i],[a])=>{if(typeof r=="function")return r(i,a);if(Array.isArray(r)){const l=r.indexOf(i),u=r.indexOf(a);return l===-1?1:u===-1?-1:l-u}return r==="asc"?i.localeCompare(a):r==="desc"?a.localeCompare(i):0}),o}),W(this,"getNextValue",(n,r=1,s=!1)=>{let o=this.indexOf(n);if(o===-1)return null;for(o=s?Math.min(o+r,this.size-1):o+r;o<=this.size&&this.getItemDisabled(this.at(o));)o++;return this.getItemValue(this.at(o))}),W(this,"getPreviousValue",(n,r=1,s=!1)=>{let o=this.indexOf(n);if(o===-1)return null;for(o=s?Math.max(o-r,0):o-r;o>=0&&this.getItemDisabled(this.at(o));)o--;return this.getItemValue(this.at(o))}),W(this,"indexOf",n=>{if(n==null)return-1;if(!this.options.groupBy&&!this.options.groupSort)return this.items.findIndex(r=>this.getItemValue(r)===n);if(!this.indexMap){this.indexMap=new Map;let r=0;const s=this.group();for(const[,o]of s)for(const i of o){const a=this.getItemValue(i);a!=null&&this.indexMap.set(a,r),r++}}return this.indexMap.get(n)??-1}),W(this,"getByText",(n,r)=>{const s=r!=null?this.indexOf(r):-1,o=n.length===1;for(let i=0;i<this.items.length;i++){const a=this.items[(s+i+1)%this.items.length];if(!(o&&this.getItemValue(a)===r)&&!this.getItemDisabled(a)&&QB(this.stringifyItem(a),n))return a}}),W(this,"search",(n,r)=>{const{state:s,currentValue:o,timeout:i=350}=r,a=s.keysSoFar+n,u=a.length>1&&Array.from(a).every(f=>f===a[0])?a[0]:a,A=this.getByText(u,o),c=this.getItemValue(A);function g(){clearTimeout(s.timer),s.timer=-1}function d(f){s.keysSoFar=f,g(),f!==""&&(s.timer=+setTimeout(()=>{d(""),g()},i))}return d(a),c}),W(this,"update",(n,r)=>{let s=this.indexOf(n);return s===-1?this:this.copy([...this.items.slice(0,s),r,...this.items.slice(s+1)])}),W(this,"upsert",(n,r,s="append")=>{let o=this.indexOf(n);return o===-1?(s==="append"?this.append:this.prepend)(r):this.copy([...this.items.slice(0,o),r,...this.items.slice(o+1)])}),W(this,"insert",(n,...r)=>this.copy($n(this.items,n,...r))),W(this,"insertBefore",(n,...r)=>{let s=this.indexOf(n);if(s===-1)if(this.items.length===0)s=0;else return this;return this.copy($n(this.items,s,...r))}),W(this,"insertAfter",(n,...r)=>{let s=this.indexOf(n);if(s===-1)if(this.items.length===0)s=0;else return this;return this.copy($n(this.items,s+1,...r))}),W(this,"prepend",(...n)=>this.copy($n(this.items,0,...n))),W(this,"append",(...n)=>this.copy($n(this.items,this.items.length,...n))),W(this,"filter",n=>{const r=this.items.filter((s,o)=>n(this.stringifyItem(s),o,s));return this.copy(r)}),W(this,"remove",(...n)=>{const r=n.map(s=>typeof s=="string"?s:this.getItemValue(s));return this.copy(this.items.filter(s=>{const o=this.getItemValue(s);return o==null?!1:!r.includes(o)}))}),W(this,"move",(n,r)=>{const s=this.indexOf(n);return s===-1?this:this.copy(Dr(this.items,[s],r))}),W(this,"moveBefore",(n,...r)=>{let s=this.items.findIndex(i=>this.getItemValue(i)===n);if(s===-1)return this;let o=r.map(i=>this.items.findIndex(a=>this.getItemValue(a)===i)).sort((i,a)=>i-a);return this.copy(Dr(this.items,o,s))}),W(this,"moveAfter",(n,...r)=>{let s=this.items.findIndex(i=>this.getItemValue(i)===n);if(s===-1)return this;let o=r.map(i=>this.items.findIndex(a=>this.getItemValue(a)===i)).sort((i,a)=>i-a);return this.copy(Dr(this.items,o,s+1))}),W(this,"reorder",(n,r)=>this.copy(Dr(this.items,[n],r))),W(this,"compareValue",(n,r)=>{const s=this.indexOf(n),o=this.indexOf(r);return s<o?-1:s>o?1:0}),W(this,"range",(n,r)=>{let s=[],o=n;for(;o!=null;){if(this.find(o)&&s.push(o),o===r)return s;o=this.getNextValue(o)}return[]}),W(this,"getValueRange",(n,r)=>n&&r?this.compareValue(n,r)<=0?this.range(n,r):this.range(r,n):[]),W(this,"toString",()=>{let n="";for(const r of this.items){const s=this.getItemValue(r),o=this.stringifyItem(r),i=this.getItemDisabled(r),a=[s,o,i].filter(Boolean).join(":");n+=a+","}return n}),W(this,"toJSON",()=>({size:this.size,first:this.firstValue,last:this.lastValue})),this.items=[...t.items]}get size(){return this.items.length}get firstValue(){let t=0;for(;this.getItemDisabled(this.at(t));)t++;return this.getItemValue(this.at(t))}get lastValue(){let t=this.size-1;for(;this.getItemDisabled(this.at(t));)t--;return this.getItemValue(this.at(t))}*[Symbol.iterator](){yield*this.items}},QB=(e,t)=>!!e?.toLowerCase().startsWith(t.toLowerCase());function $n(e,t,...n){return[...e.slice(0,t),...n,...e.slice(t)]}function Dr(e,t,n){t=[...t].sort((s,o)=>s-o);const r=t.map(s=>e[s]);for(let s=t.length-1;s>=0;s--)e=[...e.slice(0,t[s]),...e.slice(t[s]+1)];return n=Math.max(0,n-t.filter(s=>s<n).length),[...e.slice(0,n),...r,...e.slice(n)]}const OB=["top","right","bottom","left"],zt=Math.min,Je=Math.max,rs=Math.round,Qr=Math.floor,pt=e=>({x:e,y:e}),MB={left:"right",right:"left",bottom:"top",top:"bottom"},TB={start:"end",end:"start"};function vo(e,t,n){return Je(e,zt(t,n))}function Rt(e,t){return typeof e=="function"?e(t):e}function Ft(e){return e.split("-")[0]}function Vn(e){return e.split("-")[1]}function Ho(e){return e==="x"?"y":"x"}function Uo(e){return e==="y"?"height":"width"}const RB=new Set(["top","bottom"]);function ft(e){return RB.has(Ft(e))?"y":"x"}function Vo(e){return Ho(ft(e))}function FB(e,t,n){n===void 0&&(n=!1);const r=Vn(e),s=Vo(e),o=Uo(s);let i=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=ss(i)),[i,ss(i)]}function PB(e){const t=ss(e);return[wo(e),t,wo(t)]}function wo(e){return e.replace(/start|end/g,t=>TB[t])}const ha=["left","right"],ma=["right","left"],kB=["top","bottom"],_B=["bottom","top"];function NB(e,t,n){switch(e){case"top":case"bottom":return n?t?ma:ha:t?ha:ma;case"left":case"right":return t?kB:_B;default:return[]}}function LB(e,t,n,r){const s=Vn(e);let o=NB(Ft(e),n==="start",r);return s&&(o=o.map(i=>i+"-"+s),t&&(o=o.concat(o.map(wo)))),o}function ss(e){return e.replace(/left|right|bottom|top/g,t=>MB[t])}function YB(e){return{top:0,right:0,bottom:0,left:0,...e}}function kc(e){return typeof e!="number"?YB(e):{top:e,right:e,bottom:e,left:e}}function os(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function pa(e,t,n){let{reference:r,floating:s}=e;const o=ft(t),i=Vo(t),a=Uo(i),l=Ft(t),u=o==="y",A=r.x+r.width/2-s.width/2,c=r.y+r.height/2-s.height/2,g=r[a]/2-s[a]/2;let d;switch(l){case"top":d={x:A,y:r.y-s.height};break;case"bottom":d={x:A,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:c};break;case"left":d={x:r.x-s.width,y:c};break;default:d={x:r.x,y:r.y}}switch(Vn(t)){case"start":d[i]-=g*(n&&u?-1:1);break;case"end":d[i]+=g*(n&&u?-1:1);break}return d}const GB=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:i}=n,a=o.filter(Boolean),l=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:A,y:c}=pa(u,r,l),g=r,d={},f=0;for(let m=0;m<a.length;m++){const{name:h,fn:p}=a[m],{x:E,y:B,data:C,reset:x}=await p({x:A,y:c,initialPlacement:r,placement:g,strategy:s,middlewareData:d,rects:u,platform:i,elements:{reference:e,floating:t}});A=E??A,c=B??c,d={...d,[h]:{...d[h],...C}},x&&f<=50&&(f++,typeof x=="object"&&(x.placement&&(g=x.placement),x.rects&&(u=x.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):x.rects),{x:A,y:c}=pa(u,g,l)),m=-1)}return{x:A,y:c,placement:g,strategy:s,middlewareData:d}};async function cr(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:i,elements:a,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:A="viewport",elementContext:c="floating",altBoundary:g=!1,padding:d=0}=Rt(t,e),f=kc(d),h=a[g?c==="floating"?"reference":"floating":c],p=os(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(h)))==null||n?h:h.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:u,rootBoundary:A,strategy:l})),E=c==="floating"?{x:r,y:s,width:i.floating.width,height:i.floating.height}:i.reference,B=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),C=await(o.isElement==null?void 0:o.isElement(B))?await(o.getScale==null?void 0:o.getScale(B))||{x:1,y:1}:{x:1,y:1},x=os(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:E,offsetParent:B,strategy:l}):E);return{top:(p.top-x.top+f.top)/C.y,bottom:(x.bottom-p.bottom+f.bottom)/C.y,left:(p.left-x.left+f.left)/C.x,right:(x.right-p.right+f.right)/C.x}}const HB=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:o,platform:i,elements:a,middlewareData:l}=t,{element:u,padding:A=0}=Rt(e,t)||{};if(u==null)return{};const c=kc(A),g={x:n,y:r},d=Vo(s),f=Uo(d),m=await i.getDimensions(u),h=d==="y",p=h?"top":"left",E=h?"bottom":"right",B=h?"clientHeight":"clientWidth",C=o.reference[f]+o.reference[d]-g[d]-o.floating[f],x=g[d]-o.reference[d],I=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let w=I?I[B]:0;(!w||!await(i.isElement==null?void 0:i.isElement(I)))&&(w=a.floating[B]||o.floating[f]);const y=C/2-x/2,S=w/2-m[f]/2-1,Q=zt(c[p],S),D=zt(c[E],S),R=Q,T=w-m[f]-D,G=w/2-m[f]/2+y,re=vo(R,G,T),ue=!l.arrow&&Vn(s)!=null&&G!==re&&o.reference[f]/2-(G<R?Q:D)-m[f]/2<0,ie=ue?G<R?G-R:G-T:0;return{[d]:g[d]+ie,data:{[d]:re,centerOffset:G-re-ie,...ue&&{alignmentOffset:ie}},reset:ue}}}),UB=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:i,initialPlacement:a,platform:l,elements:u}=t,{mainAxis:A=!0,crossAxis:c=!0,fallbackPlacements:g,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:m=!0,...h}=Rt(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const p=Ft(s),E=ft(a),B=Ft(a)===a,C=await(l.isRTL==null?void 0:l.isRTL(u.floating)),x=g||(B||!m?[ss(a)]:PB(a)),I=f!=="none";!g&&I&&x.push(...LB(a,m,f,C));const w=[a,...x],y=await cr(t,h),S=[];let Q=((r=o.flip)==null?void 0:r.overflows)||[];if(A&&S.push(y[p]),c){const G=FB(s,i,C);S.push(y[G[0]],y[G[1]])}if(Q=[...Q,{placement:s,overflows:S}],!S.every(G=>G<=0)){var D,R;const G=(((D=o.flip)==null?void 0:D.index)||0)+1,re=w[G];if(re&&(!(c==="alignment"?E!==ft(re):!1)||Q.every(Ce=>ft(Ce.placement)===E?Ce.overflows[0]>0:!0)))return{data:{index:G,overflows:Q},reset:{placement:re}};let ue=(R=Q.filter(ie=>ie.overflows[0]<=0).sort((ie,Ce)=>ie.overflows[1]-Ce.overflows[1])[0])==null?void 0:R.placement;if(!ue)switch(d){case"bestFit":{var T;const ie=(T=Q.filter(Ce=>{if(I){const fe=ft(Ce.placement);return fe===E||fe==="y"}return!0}).map(Ce=>[Ce.placement,Ce.overflows.filter(fe=>fe>0).reduce((fe,He)=>fe+He,0)]).sort((Ce,fe)=>Ce[1]-fe[1])[0])==null?void 0:T[0];ie&&(ue=ie);break}case"initialPlacement":ue=a;break}if(s!==ue)return{reset:{placement:ue}}}return{}}}};function Ea(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ba(e){return OB.some(t=>e[t]>=0)}const VB=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...s}=Rt(e,t);switch(r){case"referenceHidden":{const o=await cr(t,{...s,elementContext:"reference"}),i=Ea(o,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Ba(i)}}}case"escaped":{const o=await cr(t,{...s,altBoundary:!0}),i=Ea(o,n.floating);return{data:{escapedOffsets:i,escaped:Ba(i)}}}default:return{}}}}},_c=new Set(["left","top"]);async function KB(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),i=Ft(n),a=Vn(n),l=ft(n)==="y",u=_c.has(i)?-1:1,A=o&&l?-1:1,c=Rt(t,e);let{mainAxis:g,crossAxis:d,alignmentAxis:f}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return a&&typeof f=="number"&&(d=a==="end"?f*-1:f),l?{x:d*A,y:g*u}:{x:g*u,y:d*A}}const WB=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:i,middlewareData:a}=t,l=await KB(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+l.x,y:o+l.y,data:{...l,placement:i}}}}},zB=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:a={fn:h=>{let{x:p,y:E}=h;return{x:p,y:E}}},...l}=Rt(e,t),u={x:n,y:r},A=await cr(t,l),c=ft(Ft(s)),g=Ho(c);let d=u[g],f=u[c];if(o){const h=g==="y"?"top":"left",p=g==="y"?"bottom":"right",E=d+A[h],B=d-A[p];d=vo(E,d,B)}if(i){const h=c==="y"?"top":"left",p=c==="y"?"bottom":"right",E=f+A[h],B=f-A[p];f=vo(E,f,B)}const m=a.fn({...t,[g]:d,[c]:f});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[g]:o,[c]:i}}}}}},$B=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:o,middlewareData:i}=t,{offset:a=0,mainAxis:l=!0,crossAxis:u=!0}=Rt(e,t),A={x:n,y:r},c=ft(s),g=Ho(c);let d=A[g],f=A[c];const m=Rt(a,t),h=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const B=g==="y"?"height":"width",C=o.reference[g]-o.floating[B]+h.mainAxis,x=o.reference[g]+o.reference[B]-h.mainAxis;d<C?d=C:d>x&&(d=x)}if(u){var p,E;const B=g==="y"?"width":"height",C=_c.has(Ft(s)),x=o.reference[c]-o.floating[B]+(C&&((p=i.offset)==null?void 0:p[c])||0)+(C?0:h.crossAxis),I=o.reference[c]+o.reference[B]+(C?0:((E=i.offset)==null?void 0:E[c])||0)-(C?h.crossAxis:0);f<x?f=x:f>I&&(f=I)}return{[g]:d,[c]:f}}}},jB=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:o,platform:i,elements:a}=t,{apply:l=()=>{},...u}=Rt(e,t),A=await cr(t,u),c=Ft(s),g=Vn(s),d=ft(s)==="y",{width:f,height:m}=o.floating;let h,p;c==="top"||c==="bottom"?(h=c,p=g===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(p=c,h=g==="end"?"top":"bottom");const E=m-A.top-A.bottom,B=f-A.left-A.right,C=zt(m-A[h],E),x=zt(f-A[p],B),I=!t.middlewareData.shift;let w=C,y=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(y=B),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(w=E),I&&!g){const Q=Je(A.left,0),D=Je(A.right,0),R=Je(A.top,0),T=Je(A.bottom,0);d?y=f-2*(Q!==0||D!==0?Q+D:Je(A.left,A.right)):w=m-2*(R!==0||T!==0?R+T:Je(A.top,A.bottom))}await l({...t,availableWidth:y,availableHeight:w});const S=await i.getDimensions(a.floating);return f!==S.width||m!==S.height?{reset:{rects:!0}}:{}}}};function hs(){return typeof window<"u"}function Kn(e){return Nc(e)?(e.nodeName||"").toLowerCase():"#document"}function Xe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function yt(e){var t;return(t=(Nc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Nc(e){return hs()?e instanceof Node||e instanceof Xe(e).Node:!1}function At(e){return hs()?e instanceof Element||e instanceof Xe(e).Element:!1}function Et(e){return hs()?e instanceof HTMLElement||e instanceof Xe(e).HTMLElement:!1}function Ia(e){return!hs()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Xe(e).ShadowRoot}const qB=new Set(["inline","contents"]);function Er(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=ut(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!qB.has(s)}const JB=new Set(["table","td","th"]);function XB(e){return JB.has(Kn(e))}const ZB=[":popover-open",":modal"];function ms(e){return ZB.some(t=>{try{return e.matches(t)}catch{return!1}})}const eI=["transform","translate","scale","rotate","perspective"],tI=["transform","translate","scale","rotate","perspective","filter"],nI=["paint","layout","strict","content"];function Ko(e){const t=Wo(),n=At(e)?ut(e):e;return eI.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||tI.some(r=>(n.willChange||"").includes(r))||nI.some(r=>(n.contain||"").includes(r))}function rI(e){let t=$t(e);for(;Et(t)&&!Gn(t);){if(Ko(t))return t;if(ms(t))return null;t=$t(t)}return null}function Wo(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const sI=new Set(["html","body","#document"]);function Gn(e){return sI.has(Kn(e))}function ut(e){return Xe(e).getComputedStyle(e)}function ps(e){return At(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function $t(e){if(Kn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ia(e)&&e.host||yt(e);return Ia(t)?t.host:t}function Lc(e){const t=$t(e);return Gn(t)?e.ownerDocument?e.ownerDocument.body:e.body:Et(t)&&Er(t)?t:Lc(t)}function Ar(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=Lc(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),i=Xe(s);if(o){const a=Co(i);return t.concat(i,i.visualViewport||[],Er(s)?s:[],a&&n?Ar(a):[])}return t.concat(s,Ar(s,[],n))}function Co(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Yc(e){const t=ut(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Et(e),o=s?e.offsetWidth:n,i=s?e.offsetHeight:r,a=rs(n)!==o||rs(r)!==i;return a&&(n=o,r=i),{width:n,height:r,$:a}}function zo(e){return At(e)?e:e.contextElement}function Fn(e){const t=zo(e);if(!Et(t))return pt(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=Yc(t);let i=(o?rs(n.width):n.width)/r,a=(o?rs(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const oI=pt(0);function Gc(e){const t=Xe(e);return!Wo()||!t.visualViewport?oI:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function iI(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Xe(e)?!1:t}function gn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=zo(e);let i=pt(1);t&&(r?At(r)&&(i=Fn(r)):i=Fn(e));const a=iI(o,n,r)?Gc(o):pt(0);let l=(s.left+a.x)/i.x,u=(s.top+a.y)/i.y,A=s.width/i.x,c=s.height/i.y;if(o){const g=Xe(o),d=r&&At(r)?Xe(r):r;let f=g,m=Co(f);for(;m&&r&&d!==f;){const h=Fn(m),p=m.getBoundingClientRect(),E=ut(m),B=p.left+(m.clientLeft+parseFloat(E.paddingLeft))*h.x,C=p.top+(m.clientTop+parseFloat(E.paddingTop))*h.y;l*=h.x,u*=h.y,A*=h.x,c*=h.y,l+=B,u+=C,f=Xe(m),m=Co(f)}}return os({width:A,height:c,x:l,y:u})}function Es(e,t){const n=ps(e).scrollLeft;return t?t.left+n:gn(yt(e)).left+n}function Hc(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Es(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function aI(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",i=yt(r),a=t?ms(t.floating):!1;if(r===i||a&&o)return n;let l={scrollLeft:0,scrollTop:0},u=pt(1);const A=pt(0),c=Et(r);if((c||!c&&!o)&&((Kn(r)!=="body"||Er(i))&&(l=ps(r)),Et(r))){const d=gn(r);u=Fn(r),A.x=d.x+r.clientLeft,A.y=d.y+r.clientTop}const g=i&&!c&&!o?Hc(i,l):pt(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+A.x+g.x,y:n.y*u.y-l.scrollTop*u.y+A.y+g.y}}function lI(e){return Array.from(e.getClientRects())}function cI(e){const t=yt(e),n=ps(e),r=e.ownerDocument.body,s=Je(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Je(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Es(e);const a=-n.scrollTop;return ut(r).direction==="rtl"&&(i+=Je(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:i,y:a}}const va=25;function AI(e,t){const n=Xe(e),r=yt(e),s=n.visualViewport;let o=r.clientWidth,i=r.clientHeight,a=0,l=0;if(s){o=s.width,i=s.height;const A=Wo();(!A||A&&t==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}const u=Es(r);if(u<=0){const A=r.ownerDocument,c=A.body,g=getComputedStyle(c),d=A.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,f=Math.abs(r.clientWidth-c.clientWidth-d);f<=va&&(o-=f)}else u<=va&&(o+=u);return{width:o,height:i,x:a,y:l}}const uI=new Set(["absolute","fixed"]);function gI(e,t){const n=gn(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=Et(e)?Fn(e):pt(1),i=e.clientWidth*o.x,a=e.clientHeight*o.y,l=s*o.x,u=r*o.y;return{width:i,height:a,x:l,y:u}}function wa(e,t,n){let r;if(t==="viewport")r=AI(e,n);else if(t==="document")r=cI(yt(e));else if(At(t))r=gI(t,n);else{const s=Gc(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return os(r)}function Uc(e,t){const n=$t(e);return n===t||!At(n)||Gn(n)?!1:ut(n).position==="fixed"||Uc(n,t)}function dI(e,t){const n=t.get(e);if(n)return n;let r=Ar(e,[],!1).filter(a=>At(a)&&Kn(a)!=="body"),s=null;const o=ut(e).position==="fixed";let i=o?$t(e):e;for(;At(i)&&!Gn(i);){const a=ut(i),l=Ko(i);!l&&a.position==="fixed"&&(s=null),(o?!l&&!s:!l&&a.position==="static"&&!!s&&uI.has(s.position)||Er(i)&&!l&&Uc(e,i))?r=r.filter(A=>A!==i):s=a,i=$t(i)}return t.set(e,r),r}function fI(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const i=[...n==="clippingAncestors"?ms(t)?[]:dI(t,this._c):[].concat(n),r],a=i[0],l=i.reduce((u,A)=>{const c=wa(t,A,s);return u.top=Je(c.top,u.top),u.right=zt(c.right,u.right),u.bottom=zt(c.bottom,u.bottom),u.left=Je(c.left,u.left),u},wa(t,a,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function hI(e){const{width:t,height:n}=Yc(e);return{width:t,height:n}}function mI(e,t,n){const r=Et(t),s=yt(t),o=n==="fixed",i=gn(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=pt(0);function u(){l.x=Es(s)}if(r||!r&&!o)if((Kn(t)!=="body"||Er(s))&&(a=ps(t)),r){const d=gn(t,!0,o,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}else s&&u();o&&!r&&s&&u();const A=s&&!r&&!o?Hc(s,a):pt(0),c=i.left+a.scrollLeft-l.x-A.x,g=i.top+a.scrollTop-l.y-A.y;return{x:c,y:g,width:i.width,height:i.height}}function Zs(e){return ut(e).position==="static"}function Ca(e,t){if(!Et(e)||ut(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return yt(e)===n&&(n=n.ownerDocument.body),n}function Vc(e,t){const n=Xe(e);if(ms(e))return n;if(!Et(e)){let s=$t(e);for(;s&&!Gn(s);){if(At(s)&&!Zs(s))return s;s=$t(s)}return n}let r=Ca(e,t);for(;r&&XB(r)&&Zs(r);)r=Ca(r,t);return r&&Gn(r)&&Zs(r)&&!Ko(r)?n:r||rI(e)||n}const pI=async function(e){const t=this.getOffsetParent||Vc,n=this.getDimensions,r=await n(e.floating);return{reference:mI(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function EI(e){return ut(e).direction==="rtl"}const BI={convertOffsetParentRelativeRectToViewportRelativeRect:aI,getDocumentElement:yt,getClippingRect:fI,getOffsetParent:Vc,getElementRects:pI,getClientRects:lI,getDimensions:hI,getScale:Fn,isElement:At,isRTL:EI};function Kc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function II(e,t){let n=null,r;const s=yt(e);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const u=e.getBoundingClientRect(),{left:A,top:c,width:g,height:d}=u;if(a||t(),!g||!d)return;const f=Qr(c),m=Qr(s.clientWidth-(A+g)),h=Qr(s.clientHeight-(c+d)),p=Qr(A),B={rootMargin:-f+"px "+-m+"px "+-h+"px "+-p+"px",threshold:Je(0,zt(1,l))||1};let C=!0;function x(I){const w=I[0].intersectionRatio;if(w!==l){if(!C)return i();w?i(!1,w):r=setTimeout(()=>{i(!1,1e-7)},1e3)}w===1&&!Kc(u,e.getBoundingClientRect())&&i(),C=!1}try{n=new IntersectionObserver(x,{...B,root:s.ownerDocument})}catch{n=new IntersectionObserver(x,B)}n.observe(e)}return i(!0),o}function vI(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=zo(e),A=s||o?[...u?Ar(u):[],...Ar(t)]:[];A.forEach(p=>{s&&p.addEventListener("scroll",n,{passive:!0}),o&&p.addEventListener("resize",n)});const c=u&&a?II(u,n):null;let g=-1,d=null;i&&(d=new ResizeObserver(p=>{let[E]=p;E&&E.target===u&&d&&(d.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var B;(B=d)==null||B.observe(t)})),n()}),u&&!l&&d.observe(u),d.observe(t));let f,m=l?gn(e):null;l&&h();function h(){const p=gn(e);m&&!Kc(m,p)&&n(),m=p,f=requestAnimationFrame(h)}return n(),()=>{var p;A.forEach(E=>{s&&E.removeEventListener("scroll",n),o&&E.removeEventListener("resize",n)}),c?.(),(p=d)==null||p.disconnect(),d=null,l&&cancelAnimationFrame(f)}}const wI=WB,CI=zB,yI=UB,xI=jB,bI=VB,SI=HB,DI=$B,QI=(e,t,n)=>{const r=new Map,s={platform:BI,...n},o={...s.platform,_c:r};return GB(e,t,{...s,platform:o})};function ya(e=0,t=0,n=0,r=0){if(typeof DOMRect=="function")return new DOMRect(e,t,n,r);const s={x:e,y:t,width:n,height:r,top:t,right:e+n,bottom:t+r,left:e};return{...s,toJSON:()=>s}}function OI(e){if(!e)return ya();const{x:t,y:n,width:r,height:s}=e;return ya(t,n,r,s)}function MI(e,t){return{contextElement:st(e)?e:e?.contextElement,getBoundingClientRect:()=>{const n=e,r=t?.(n);return r||!n?OI(r):n.getBoundingClientRect()}}}var jn=e=>({variable:e,reference:`var(${e})`}),Dt={arrowSize:jn("--arrow-size"),arrowSizeHalf:jn("--arrow-size-half"),arrowBg:jn("--arrow-background"),transformOrigin:jn("--transform-origin"),arrowOffset:jn("--arrow-offset")},TI=e=>e==="top"||e==="bottom"?"y":"x";function RI(e,t){return{name:"transformOrigin",fn(n){const{elements:r,middlewareData:s,placement:o,rects:i,y:a}=n,l=o.split("-")[0],u=TI(l),A=s.arrow?.x||0,c=s.arrow?.y||0,g=t?.clientWidth||0,d=t?.clientHeight||0,f=A+g/2,m=c+d/2,h=Math.abs(s.shift?.y||0),p=i.reference.height/2,E=d/2,B=e.offset?.mainAxis??e.gutter,C=typeof B=="number"?B+E:B??E,x=h>C,I={top:`${f}px calc(100% + ${C}px)`,bottom:`${f}px ${-C}px`,left:`calc(100% + ${C}px) ${m}px`,right:`${-C}px ${m}px`}[l],w=`${f}px ${i.reference.y+p-a}px`,y=!!e.overlap&&u==="y"&&x;return r.floating.style.setProperty(Dt.transformOrigin.variable,y?w:I),{data:{transformOrigin:y?w:I}}}}}var FI={name:"rects",fn({rects:e}){return{data:e}}},PI=e=>{if(e)return{name:"shiftArrow",fn({placement:t,middlewareData:n}){if(!n.arrow)return{};const{x:r,y:s}=n.arrow,o=t.split("-")[0];return Object.assign(e.style,{left:r!=null?`${r}px`:"",top:s!=null?`${s}px`:"",[o]:`calc(100% + ${Dt.arrowOffset.reference})`}),{}}}};function kI(e){const[t,n]=e.split("-");return{side:t,align:n,hasAlign:n!=null}}var _I={strategy:"absolute",placement:"bottom",listeners:!0,gutter:8,flip:!0,slide:!0,overlap:!1,sameWidth:!1,fitViewport:!1,overflowPadding:8,arrowPadding:4};function xa(e,t){const n=e.devicePixelRatio||1;return Math.round(t*n)/n}function $o(e){return typeof e=="function"?e():e==="clipping-ancestors"?"clippingAncestors":e}function NI(e,t,n){const r=e||t.createElement("div");return SI({element:r,padding:n.arrowPadding})}function LI(e,t){if(!Lp(t.offset??t.gutter))return wI(({placement:n})=>{const r=(e?.clientHeight||0)/2,s=t.offset?.mainAxis??t.gutter,o=typeof s=="number"?s+r:s??r,{hasAlign:i}=kI(n),a=i?void 0:t.shift,l=t.offset?.crossAxis??a;return Fo({crossAxis:l,mainAxis:o,alignmentAxis:t.shift})})}function YI(e){if(!e.flip)return;const t=$o(e.boundary);return yI({...t?{boundary:t}:void 0,padding:e.overflowPadding,fallbackPlacements:e.flip===!0?void 0:e.flip})}function GI(e){if(!e.slide&&!e.overlap)return;const t=$o(e.boundary);return CI({...t?{boundary:t}:void 0,mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:DI()})}function HI(e){return xI({padding:e.overflowPadding,apply({elements:t,rects:n,availableHeight:r,availableWidth:s}){const o=t.floating,i=Math.round(n.reference.width),a=Math.round(n.reference.height);s=Math.floor(s),r=Math.floor(r),o.style.setProperty("--reference-width",`${i}px`),o.style.setProperty("--reference-height",`${a}px`),o.style.setProperty("--available-width",`${s}px`),o.style.setProperty("--available-height",`${r}px`)}})}function UI(e){if(e.hideWhenDetached)return bI({strategy:"referenceHidden",boundary:$o(e.boundary)??"clippingAncestors"})}function VI(e){return e?e===!0?{ancestorResize:!0,ancestorScroll:!0,elementResize:!0,layoutShift:!0}:e:{}}function KI(e,t,n={}){const r=n.getAnchorElement?.()??e,s=MI(r,n.getAnchorRect);if(!t||!s)return;const o=Object.assign({},_I,n),i=t.querySelector("[data-part=arrow]"),a=[LI(i,o),YI(o),GI(o),NI(i,t.ownerDocument,o),PI(i),RI({gutter:o.gutter,offset:o.offset,overlap:o.overlap},i),HI(o),UI(o),FI],{placement:l,strategy:u,onComplete:A,onPositioned:c}=o,g=async()=>{if(!s||!t)return;const h=await QI(s,t,{placement:l,middleware:a,strategy:u});A?.(h),c?.({placed:!0});const p=Pt(t),E=xa(p,h.x),B=xa(p,h.y);t.style.setProperty("--x",`${E}px`),t.style.setProperty("--y",`${B}px`),o.hideWhenDetached&&(h.middlewareData.hide?.referenceHidden?(t.style.setProperty("visibility","hidden"),t.style.setProperty("pointer-events","none")):(t.style.removeProperty("visibility"),t.style.removeProperty("pointer-events")));const C=t.firstElementChild;if(C){const x=ko(C);t.style.setProperty("--z-index",x.zIndex)}},d=async()=>{n.updatePosition?(await n.updatePosition({updatePosition:g,floatingElement:t}),c?.({placed:!0})):await g()},f=VI(o.listeners),m=o.listeners?vI(s,t,d,f):Wp;return d(),()=>{m?.(),c?.({placed:!1})}}function ba(e,t,n={}){const{defer:r,...s}=n,o=r?Se:a=>a(),i=[];return i.push(o(()=>{const a=typeof e=="function"?e():e,l=typeof t=="function"?t():t;i.push(KI(a,l,s))})),()=>{i.forEach(a=>a?.())}}var WI={bottom:"rotate(45deg)",left:"rotate(135deg)",top:"rotate(225deg)",right:"rotate(315deg)"};function zI(e={}){const{placement:t,sameWidth:n,fitViewport:r,strategy:s="absolute"}=e;return{arrow:{position:"absolute",width:Dt.arrowSize.reference,height:Dt.arrowSize.reference,[Dt.arrowSizeHalf.variable]:`calc(${Dt.arrowSize.reference} / 2)`,[Dt.arrowOffset.variable]:`calc(${Dt.arrowSizeHalf.reference} * -1)`},arrowTip:{transform:t?WI[t.split("-")[0]]:void 0,background:Dt.arrowBg.reference,top:"0",left:"0",width:"100%",height:"100%",position:"absolute",zIndex:"inherit"},floating:{position:s,isolation:"isolate",minWidth:n?void 0:"max-content",width:n?"var(--reference-width)":void 0,maxWidth:r?"var(--available-width)":void 0,maxHeight:r?"var(--available-height)":void 0,pointerEvents:t?void 0:"none",top:"0px",left:"0px",transform:t?"translate3d(var(--x), var(--y), 0)":"translate3d(0, -100vh, 0)",zIndex:"var(--z-index)"}}}function $I(e){const t={each(n){for(let r=0;r<e.frames?.length;r+=1){const s=e.frames[r];s&&n(s)}},addEventListener(n,r,s){return t.each(o=>{try{o.document.addEventListener(n,r,s)}catch{}}),()=>{try{t.removeEventListener(n,r,s)}catch{}}},removeEventListener(n,r,s){t.each(o=>{try{o.document.removeEventListener(n,r,s)}catch{}})}};return t}function jI(e){const t=e.frameElement!=null?e.parent:null;return{addEventListener:(n,r,s)=>{try{t?.addEventListener(n,r,s)}catch{}return()=>{try{t?.removeEventListener(n,r,s)}catch{}}},removeEventListener:(n,r,s)=>{try{t?.removeEventListener(n,r,s)}catch{}}}}var Sa="pointerdown.outside",Da="focus.outside";function qI(e){for(const t of e)if(st(t)&&bc(t))return!0;return!1}var Wc=e=>"clientY"in e;function JI(e,t){if(!Wc(t)||!e)return!1;const n=e.getBoundingClientRect();return n.width===0||n.height===0?!1:n.top<=t.clientY&&t.clientY<=n.top+n.height&&n.left<=t.clientX&&t.clientX<=n.left+n.width}function XI(e,t){return e.y<=t.y&&t.y<=e.y+e.height&&e.x<=t.x&&t.x<=e.x+e.width}function Qa(e,t){if(!t||!Wc(e))return!1;const n=t.scrollHeight>t.clientHeight,r=n&&e.clientX>t.offsetLeft+t.clientWidth,s=t.scrollWidth>t.clientWidth,o=s&&e.clientY>t.offsetTop+t.clientHeight,i={x:t.offsetLeft,y:t.offsetTop,width:t.clientWidth+(n?16:0),height:t.clientHeight+(s?16:0)},a={x:e.clientX,y:e.clientY};return XI(i,a)?r||o:!1}function ZI(e,t){const{exclude:n,onFocusOutside:r,onPointerDownOutside:s,onInteractOutside:o,defer:i,followControlledElements:a=!0}=t;if(!e)return;const l=qt(e),u=Pt(e),A=$I(u),c=jI(u);function g(B,C){if(!st(C)||!C.isConnected||ts(e,C)||JI(e,B)||a&&gE(e,C))return!1;const x=l.querySelector(`[aria-controls="${e.id}"]`);if(x){const w=Io(x);if(Qa(B,w))return!1}const I=Io(e);return Qa(B,I)?!1:!n?.(C)}const d=new Set,f=Ln(e?.getRootNode());function m(B){function C(x){const I=i&&!la()?Se:S=>S(),w=x??B,y=w?.composedPath?.()??[w?.target];I(()=>{const S=f?y[0]:Yn(B);if(!(!e||!g(B,S))){if(s||o){const Q=Eo(s,o);e.addEventListener(Sa,Q,{once:!0})}Oa(e,Sa,{bubbles:!1,cancelable:!0,detail:{originalEvent:w,contextmenu:xc(w),focusable:qI(y),target:S}})}})}B.pointerType==="touch"?(d.forEach(x=>x()),d.add(Nr(l,"click",C,{once:!0})),d.add(c.addEventListener("click",C,{once:!0})),d.add(A.addEventListener("click",C,{once:!0}))):C()}const h=new Set,p=setTimeout(()=>{h.add(Nr(l,"pointerdown",m,!0)),h.add(c.addEventListener("pointerdown",m,!0)),h.add(A.addEventListener("pointerdown",m,!0))},0);function E(B){(i?Se:x=>x())(()=>{const x=B?.composedPath?.()??[B?.target],I=f?x[0]:Yn(B);if(!(!e||!g(B,I))){if(r||o){const w=Eo(r,o);e.addEventListener(Da,w,{once:!0})}Oa(e,Da,{bubbles:!1,cancelable:!0,detail:{originalEvent:B,contextmenu:!1,focusable:bc(I),target:I}})}})}return la()||(h.add(Nr(l,"focusin",E,!0)),h.add(c.addEventListener("focusin",E,!0)),h.add(A.addEventListener("focusin",E,!0))),()=>{clearTimeout(p),d.forEach(B=>B()),h.forEach(B=>B())}}function ev(e,t){const{defer:n}=t,r=n?Se:o=>o(),s=[];return s.push(r(()=>{const o=typeof e=="function"?e():e;s.push(ZI(o,t))})),()=>{s.forEach(o=>o?.())}}function Oa(e,t,n){const r=e.ownerDocument.defaultView||window,s=new r.CustomEvent(t,n);return e.dispatchEvent(s)}function tv(e,t){const n=r=>{r.key==="Escape"&&(r.isComposing||t?.(r))};return Nr(qt(e),"keydown",n,{capture:!0})}var Ma="layer:request-dismiss",tt={layers:[],branches:[],count(){return this.layers.length},pointerBlockingLayers(){return this.layers.filter(e=>e.pointerBlocking)},topMostPointerBlockingLayer(){return[...this.pointerBlockingLayers()].slice(-1)[0]},hasPointerBlockingLayer(){return this.pointerBlockingLayers().length>0},isBelowPointerBlockingLayer(e){const t=this.indexOf(e),n=this.topMostPointerBlockingLayer()?this.indexOf(this.topMostPointerBlockingLayer()?.node):-1;return t<n},isTopMost(e){return this.layers[this.count()-1]?.node===e},getNestedLayers(e){return Array.from(this.layers).slice(this.indexOf(e)+1)},getLayersByType(e){return this.layers.filter(t=>t.type===e)},getNestedLayersByType(e,t){const n=this.indexOf(e);return n===-1?[]:this.layers.slice(n+1).filter(r=>r.type===t)},getParentLayerOfType(e,t){const n=this.indexOf(e);if(!(n<=0))return this.layers.slice(0,n).reverse().find(r=>r.type===t)},countNestedLayersOfType(e,t){return this.getNestedLayersByType(e,t).length},isInNestedLayer(e,t){return this.getNestedLayers(e).some(n=>ts(n.node,t))},isInBranch(e){return Array.from(this.branches).some(t=>ts(t,e))},add(e){this.layers.push(e),this.syncLayers()},addBranch(e){this.branches.push(e)},remove(e){const t=this.indexOf(e);t<0||(t<this.count()-1&&this.getNestedLayers(e).forEach(r=>tt.dismiss(r.node,e)),this.layers.splice(t,1),this.syncLayers())},removeBranch(e){const t=this.branches.indexOf(e);t>=0&&this.branches.splice(t,1)},syncLayers(){this.layers.forEach((e,t)=>{e.node.style.setProperty("--layer-index",`${t}`),e.node.removeAttribute("data-nested"),e.node.removeAttribute("data-has-nested"),this.getParentLayerOfType(e.node,e.type)&&e.node.setAttribute("data-nested",e.type);const r=this.countNestedLayersOfType(e.node,e.type);r>0&&e.node.setAttribute("data-has-nested",e.type),e.node.style.setProperty("--nested-layer-count",`${r}`)})},indexOf(e){return this.layers.findIndex(t=>t.node===e)},dismiss(e,t){const n=this.indexOf(e);if(n===-1)return;const r=this.layers[n];rv(e,Ma,s=>{r.requestDismiss?.(s),s.defaultPrevented||r?.dismiss()}),nv(e,Ma,{originalLayer:e,targetLayer:t,originalIndex:n,targetIndex:t?this.indexOf(t):-1}),this.syncLayers()},clear(){this.remove(this.layers[0].node)}};function nv(e,t,n){const r=e.ownerDocument.defaultView||window,s=new r.CustomEvent(t,{cancelable:!0,bubbles:!0,detail:n});return e.dispatchEvent(s)}function rv(e,t,n){e.addEventListener(t,n,{once:!0})}var Ta;function Ra(){tt.layers.forEach(({node:e})=>{e.style.pointerEvents=tt.isBelowPointerBlockingLayer(e)?"none":"auto"})}function sv(e){e.style.pointerEvents=""}function ov(e,t){const n=qt(e),r=[];return tt.hasPointerBlockingLayer()&&!n.body.hasAttribute("data-inert")&&(Ta=document.body.style.pointerEvents,queueMicrotask(()=>{n.body.style.pointerEvents="none",n.body.setAttribute("data-inert","")})),t?.forEach(s=>{const[o,i]=kE(()=>{const a=s();return st(a)?a:null},{timeout:1e3});o.then(a=>r.push(Oc(a,{pointerEvents:"auto"}))),r.push(i)}),()=>{tt.hasPointerBlockingLayer()||(queueMicrotask(()=>{n.body.style.pointerEvents=Ta,n.body.removeAttribute("data-inert"),n.body.style.length===0&&n.body.removeAttribute("style")}),r.forEach(s=>s()))}}function iv(e,t){const{warnOnMissingNode:n=!0}=t;if(n&&!e){Bo("[@zag-js/dismissable] node is `null` or `undefined`");return}if(!e)return;const{onDismiss:r,onRequestDismiss:s,pointerBlocking:o,exclude:i,debug:a,type:l="dialog"}=t,u={dismiss:r,node:e,type:l,pointerBlocking:o,requestDismiss:s};tt.add(u),Ra();function A(m){const h=Yn(m.detail.originalEvent);tt.isBelowPointerBlockingLayer(e)||tt.isInBranch(h)||(t.onPointerDownOutside?.(m),t.onInteractOutside?.(m),!m.defaultPrevented&&(a&&console.log("onPointerDownOutside:",m.detail.originalEvent),r?.()))}function c(m){const h=Yn(m.detail.originalEvent);tt.isInBranch(h)||(t.onFocusOutside?.(m),t.onInteractOutside?.(m),!m.defaultPrevented&&(a&&console.log("onFocusOutside:",m.detail.originalEvent),r?.()))}function g(m){tt.isTopMost(e)&&(t.onEscapeKeyDown?.(m),!m.defaultPrevented&&r&&(m.preventDefault(),r()))}function d(m){if(!e)return!1;const h=typeof i=="function"?i():i,p=Array.isArray(h)?h:[h],E=t.persistentElements?.map(B=>B()).filter(st);return E&&p.push(...E),p.some(B=>ts(B,m))||tt.isInNestedLayer(e,m)}const f=[o?ov(e,t.persistentElements):void 0,tv(e,g),ev(e,{exclude:d,onFocusOutside:c,onPointerDownOutside:A,defer:t.defer})];return()=>{tt.remove(e),Ra(),sv(e),f.forEach(m=>m?.())}}function av(e,t){const{defer:n}=t,r=n?Se:o=>o(),s=[];return s.push(r(()=>{const o=it(e)?e():e;s.push(iv(o,t))})),()=>{s.forEach(o=>o?.())}}var zc=an("combobox").parts("root","clearTrigger","content","control","input","item","itemGroup","itemGroupLabel","itemIndicator","itemText","label","list","positioner","trigger"),We=zc.build(),$c=e=>new Go(e);$c.empty=()=>new Go({items:[]});var lv=e=>e.ids?.root??`combobox:${e.id}`,eo=e=>e.ids?.label??`combobox:${e.id}:label`,jc=e=>e.ids?.control??`combobox:${e.id}:control`,Yr=e=>e.ids?.input??`combobox:${e.id}:input`,Gr=e=>e.ids?.content??`combobox:${e.id}:content`,qc=e=>e.ids?.positioner??`combobox:${e.id}:popper`,Jc=e=>e.ids?.trigger??`combobox:${e.id}:toggle-btn`,Xc=e=>e.ids?.clearTrigger??`combobox:${e.id}:clear-btn`,cv=(e,t)=>e.ids?.itemGroup?.(t)??`combobox:${e.id}:optgroup:${t}`,Fa=(e,t)=>e.ids?.itemGroupLabel?.(t)??`combobox:${e.id}:optgroup-label:${t}`,Pa=(e,t)=>e.ids?.item?.(t)??`combobox:${e.id}:option:${t}`,nn=e=>e.getById(Gr(e)),ln=e=>e.getById(Yr(e)),ka=e=>e.getById(qc(e)),_a=e=>e.getById(jc(e)),nr=e=>e.getById(Jc(e)),Av=e=>e.getById(Xc(e)),bn=(e,t)=>{if(t==null)return null;const n=`[role=option][data-value="${CSS.escape(t)}"]`;return FE(nn(e),n)},Na=e=>{const t=ln(e);e.isActiveElement(t)||t?.focus({preventScroll:!0})},uv=e=>{const t=nr(e);e.isActiveElement(t)||t?.focus({preventScroll:!0})};function gv(e,t){const{context:n,prop:r,state:s,send:o,scope:i,computed:a,event:l}=e,u=r("translations"),A=r("collection"),c=!!r("disabled"),g=a("isInteractive"),d=!!r("invalid"),f=!!r("required"),m=!!r("readOnly"),h=s.hasTag("open"),p=s.hasTag("focused"),E=r("composite"),B=n.get("highlightedValue"),C=zI({...r("positioning"),placement:n.get("currentPlacement")});function x(I){const w=A.getItemDisabled(I.item),y=A.getItemValue(I.item);return vc(y,()=>`[zag-js] No value found for item ${JSON.stringify(I.item)}`),{value:y,disabled:!!(w||w),highlighted:B===y,selected:n.get("value").includes(y)}}return{focused:p,open:h,inputValue:n.get("inputValue"),highlightedValue:B,highlightedItem:n.get("highlightedItem"),value:n.get("value"),valueAsString:a("valueAsString"),hasSelectedItems:a("hasSelectedItems"),selectedItems:n.get("selectedItems"),collection:r("collection"),multiple:!!r("multiple"),disabled:!!c,syncSelectedItems(){o({type:"SELECTED_ITEMS.SYNC"})},reposition(I={}){o({type:"POSITIONING.SET",options:I})},setHighlightValue(I){o({type:"HIGHLIGHTED_VALUE.SET",value:I})},clearHighlightValue(){o({type:"HIGHLIGHTED_VALUE.CLEAR"})},selectValue(I){o({type:"ITEM.SELECT",value:I})},setValue(I){o({type:"VALUE.SET",value:I})},setInputValue(I,w="script"){o({type:"INPUT_VALUE.SET",value:I,src:w})},clearValue(I){I!=null?o({type:"ITEM.CLEAR",value:I}):o({type:"VALUE.CLEAR"})},focus(){ln(i)?.focus()},setOpen(I,w="script"){s.hasTag("open")!==I&&o({type:I?"OPEN":"CLOSE",src:w})},getRootProps(){return t.element({...We.root.attrs,dir:r("dir"),id:lv(i),"data-invalid":q(d),"data-readonly":q(m)})},getLabelProps(){return t.label({...We.label.attrs,dir:r("dir"),htmlFor:Yr(i),id:eo(i),"data-readonly":q(m),"data-disabled":q(c),"data-invalid":q(d),"data-required":q(f),"data-focus":q(p),onClick(I){E||(I.preventDefault(),nr(i)?.focus({preventScroll:!0}))}})},getControlProps(){return t.element({...We.control.attrs,dir:r("dir"),id:jc(i),"data-state":h?"open":"closed","data-focus":q(p),"data-disabled":q(c),"data-invalid":q(d)})},getPositionerProps(){return t.element({...We.positioner.attrs,dir:r("dir"),id:qc(i),style:C.floating})},getInputProps(){return t.input({...We.input.attrs,dir:r("dir"),"aria-invalid":_r(d),"data-invalid":q(d),"data-autofocus":q(r("autoFocus")),name:r("name"),form:r("form"),disabled:c,required:r("required"),autoComplete:"off",autoCorrect:"off",autoCapitalize:"none",spellCheck:"false",readOnly:m,placeholder:r("placeholder"),id:Yr(i),type:"text",role:"combobox",defaultValue:n.get("inputValue"),"aria-autocomplete":a("autoComplete")?"both":"list","aria-controls":Gr(i),"aria-expanded":h,"data-state":h?"open":"closed","aria-activedescendant":B?Pa(i,B):void 0,onClick(I){I.defaultPrevented||r("openOnClick")&&g&&o({type:"INPUT.CLICK",src:"input-click"})},onFocus(){c||o({type:"INPUT.FOCUS"})},onBlur(){c||o({type:"INPUT.BLUR"})},onChange(I){o({type:"INPUT.CHANGE",value:I.currentTarget.value,src:"input-change"})},onKeyDown(I){if(I.defaultPrevented||!g||I.ctrlKey||I.shiftKey||vE(I))return;const w=r("openOnKeyPress"),y=I.ctrlKey||I.metaKey||I.shiftKey,S=!0,Q={ArrowDown(T){!w&&!h||(o({type:T.altKey?"OPEN":"INPUT.ARROW_DOWN",keypress:S,src:"arrow-key"}),T.preventDefault())},ArrowUp(){!w&&!h||(o({type:I.altKey?"CLOSE":"INPUT.ARROW_UP",keypress:S,src:"arrow-key"}),I.preventDefault())},Home(T){y||(o({type:"INPUT.HOME",keypress:S}),h&&T.preventDefault())},End(T){y||(o({type:"INPUT.END",keypress:S}),h&&T.preventDefault())},Enter(T){o({type:"INPUT.ENTER",keypress:S,src:"item-select"});const G=a("isCustomValue")&&r("allowCustomValue"),re=B!=null,ue=r("alwaysSubmitOnEnter");if(h&&!G&&!ue&&re&&T.preventDefault(),B==null)return;const ie=bn(i,B);rE(ie)&&r("navigate")?.({value:B,node:ie,href:ie.href})},Escape(){o({type:"INPUT.ESCAPE",keypress:S,src:"escape-key"}),I.preventDefault()}},D=Aa(I,{dir:r("dir")}),R=Q[D];R?.(I)}})},getTriggerProps(I={}){return t.button({...We.trigger.attrs,dir:r("dir"),id:Jc(i),"aria-haspopup":E?"listbox":"dialog",type:"button",tabIndex:I.focusable?void 0:-1,"aria-label":u.triggerLabel,"aria-expanded":h,"data-state":h?"open":"closed","aria-controls":h?Gr(i):void 0,disabled:c,"data-invalid":q(d),"data-focusable":q(I.focusable),"data-readonly":q(m),"data-disabled":q(c),onFocus(){I.focusable&&o({type:"INPUT.FOCUS",src:"trigger"})},onClick(w){w.defaultPrevented||g&&Sr(w)&&o({type:"TRIGGER.CLICK",src:"trigger-click"})},onPointerDown(w){g&&w.pointerType!=="touch"&&Sr(w)&&(w.preventDefault(),queueMicrotask(()=>{ln(i)?.focus({preventScroll:!0})}))},onKeyDown(w){if(w.defaultPrevented||E)return;const y={ArrowDown(){o({type:"INPUT.ARROW_DOWN",src:"arrow-key"})},ArrowUp(){o({type:"INPUT.ARROW_UP",src:"arrow-key"})}},S=Aa(w,{dir:r("dir")}),Q=y[S];Q&&(Q(w),w.preventDefault())}})},getContentProps(){return t.element({...We.content.attrs,dir:r("dir"),id:Gr(i),role:E?"listbox":"dialog",tabIndex:-1,hidden:!h,"data-state":h?"open":"closed","data-placement":n.get("currentPlacement"),"aria-labelledby":eo(i),"aria-multiselectable":r("multiple")&&E?!0:void 0,"data-empty":q(A.size===0),onPointerDown(I){Sr(I)&&I.preventDefault()}})},getListProps(){return t.element({...We.list.attrs,role:E?void 0:"listbox","data-empty":q(A.size===0),"aria-labelledby":eo(i),"aria-multiselectable":r("multiple")&&!E?!0:void 0})},getClearTriggerProps(){return t.button({...We.clearTrigger.attrs,dir:r("dir"),id:Xc(i),type:"button",tabIndex:-1,disabled:c,"data-invalid":q(d),"aria-label":u.clearTriggerLabel,"aria-controls":Yr(i),hidden:!n.get("value").length,onPointerDown(I){Sr(I)&&I.preventDefault()},onClick(I){I.defaultPrevented||g&&o({type:"VALUE.CLEAR",src:"clear-trigger"})}})},getItemState:x,getItemProps(I){const w=x(I),y=w.value;return t.element({...We.item.attrs,dir:r("dir"),id:Pa(i,y),role:"option",tabIndex:-1,"data-highlighted":q(w.highlighted),"data-state":w.selected?"checked":"unchecked","aria-selected":_r(w.highlighted),"aria-disabled":_r(w.disabled),"data-disabled":q(w.disabled),"data-value":w.value,onPointerMove(){w.disabled||w.highlighted||o({type:"ITEM.POINTER_MOVE",value:y})},onPointerLeave(){I.persistFocus||w.disabled||!l.previous()?.type.includes("POINTER")||o({type:"ITEM.POINTER_LEAVE",value:y})},onClick(S){IE(S)||BE(S)||xc(S)||w.disabled||o({type:"ITEM.CLICK",src:"item-select",value:y})}})},getItemTextProps(I){const w=x(I);return t.element({...We.itemText.attrs,dir:r("dir"),"data-state":w.selected?"checked":"unchecked","data-disabled":q(w.disabled),"data-highlighted":q(w.highlighted)})},getItemIndicatorProps(I){const w=x(I);return t.element({"aria-hidden":!0,...We.itemIndicator.attrs,dir:r("dir"),"data-state":w.selected?"checked":"unchecked",hidden:!w.selected})},getItemGroupProps(I){const{id:w}=I;return t.element({...We.itemGroup.attrs,dir:r("dir"),id:cv(i,w),"aria-labelledby":Fa(i,w),"data-empty":q(A.size===0),role:"group"})},getItemGroupLabelProps(I){const{htmlFor:w}=I;return t.element({...We.itemGroupLabel.attrs,dir:r("dir"),id:Fa(i,w),role:"presentation"})}}}var{guards:dv,createMachine:fv,choose:hv}=HE(),{and:be,not:je}=dv,mv=fv({props({props:e}){return{loopFocus:!0,openOnClick:!1,defaultValue:[],defaultInputValue:"",closeOnSelect:!e.multiple,allowCustomValue:!1,alwaysSubmitOnEnter:!1,inputBehavior:"none",selectionBehavior:e.multiple?"clear":"replace",openOnKeyPress:!0,openOnChange:!0,composite:!0,navigate({node:t}){OE(t)},collection:$c.empty(),...e,positioning:{placement:"bottom",sameWidth:!0,...e.positioning},translations:{triggerLabel:"Toggle suggestions",clearTriggerLabel:"Clear value",...e.translations}}},initialState({prop:e}){return e("open")||e("defaultOpen")?"suggesting":"idle"},context({prop:e,bindable:t,getContext:n,getEvent:r}){return{currentPlacement:t(()=>({defaultValue:void 0})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:hr,hash(s){return s.join(",")},onChange(s){const o=n(),i=o.get("selectedItems"),a=e("collection"),l=s.map(u=>i.find(c=>a.getItemValue(c)===u)||a.find(u));o.set("selectedItems",l),e("onValueChange")?.({value:s,items:l})}})),highlightedValue:t(()=>({defaultValue:e("defaultHighlightedValue")||null,value:e("highlightedValue"),onChange(s){const o=e("collection").find(s);e("onHighlightChange")?.({highlightedValue:s,highlightedItem:o})}})),inputValue:t(()=>{let s=e("inputValue")||e("defaultInputValue");const o=e("value")||e("defaultValue");if(!s.trim()&&!e("multiple")){const i=e("collection").stringifyMany(o);s=bt(e("selectionBehavior"),{preserve:s||i,replace:i,clear:""})}return{defaultValue:s,value:e("inputValue"),onChange(i){const a=r(),l=(a.previousEvent||a).src;e("onInputValueChange")?.({inputValue:i,reason:l})}}}),highlightedItem:t(()=>{const s=e("highlightedValue");return{defaultValue:e("collection").find(s)}}),selectedItems:t(()=>{const s=e("value")||e("defaultValue")||[];return{defaultValue:e("collection").findMany(s)}})}},computed:{isInputValueEmpty:({context:e})=>e.get("inputValue").length===0,isInteractive:({prop:e})=>!(e("readOnly")||e("disabled")),autoComplete:({prop:e})=>e("inputBehavior")==="autocomplete",autoHighlight:({prop:e})=>e("inputBehavior")==="autohighlight",hasSelectedItems:({context:e})=>e.get("value").length>0,valueAsString:({context:e,prop:t})=>t("collection").stringifyItems(e.get("selectedItems")),isCustomValue:({context:e,computed:t})=>e.get("inputValue")!==t("valueAsString")},watch({context:e,prop:t,track:n,action:r,send:s}){n([()=>e.hash("value")],()=>{r(["syncSelectedItems"])}),n([()=>e.get("inputValue")],()=>{r(["syncInputValue"])}),n([()=>e.get("highlightedValue")],()=>{r(["syncHighlightedItem","autofillInputValue"])}),n([()=>t("open")],()=>{r(["toggleVisibility"])}),n([()=>t("collection").toString()],()=>{s({type:"CHILDREN_CHANGE"})})},on:{"SELECTED_ITEMS.SYNC":{actions:["syncSelectedItems"]},"HIGHLIGHTED_VALUE.SET":{actions:["setHighlightedValue"]},"HIGHLIGHTED_VALUE.CLEAR":{actions:["clearHighlightedValue"]},"ITEM.SELECT":{actions:["selectItem"]},"ITEM.CLEAR":{actions:["clearItem"]},"VALUE.SET":{actions:["setValue"]},"INPUT_VALUE.SET":{actions:["setInputValue"]},"POSITIONING.SET":{actions:["reposition"]}},entry:hv([{guard:"autoFocus",actions:["setInitialFocus"]}]),states:{idle:{tags:["idle","closed"],entry:["scrollContentToTop","clearHighlightedValue"],on:{"CONTROLLED.OPEN":{target:"interacting"},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]}],"INPUT.CLICK":[{guard:"isOpenControlled",actions:["highlightFirstSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["highlightFirstSelectedItem","invokeOnOpen"]}],"INPUT.FOCUS":{target:"focused"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"interacting",actions:["invokeOnOpen"]}],"VALUE.CLEAR":{target:"focused",actions:["clearInputValue","clearSelectedItems","setInitialFocus"]}}},focused:{tags:["focused","closed"],entry:["scrollContentToTop","clearHighlightedValue"],on:{"CONTROLLED.OPEN":[{guard:"isChangeEvent",target:"suggesting"},{target:"interacting"}],"INPUT.CHANGE":[{guard:be("isOpenControlled","openOnChange"),actions:["setInputValue","invokeOnOpen","highlightFirstItemIfNeeded"]},{guard:"openOnChange",target:"suggesting",actions:["setInputValue","invokeOnOpen","highlightFirstItemIfNeeded"]},{actions:["setInputValue"]}],"LAYER.INTERACT_OUTSIDE":{target:"idle"},"INPUT.ESCAPE":{guard:be("isCustomValue",je("allowCustomValue")),actions:["revertInputValue"]},"INPUT.BLUR":{target:"idle"},"INPUT.CLICK":[{guard:"isOpenControlled",actions:["highlightFirstSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["highlightFirstSelectedItem","invokeOnOpen"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]}],"INPUT.ARROW_DOWN":[{guard:be("isOpenControlled","autoComplete"),actions:["invokeOnOpen"]},{guard:"autoComplete",target:"interacting",actions:["invokeOnOpen"]},{guard:"isOpenControlled",actions:["highlightFirstOrSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["highlightFirstOrSelectedItem","invokeOnOpen"]}],"INPUT.ARROW_UP":[{guard:"autoComplete",target:"interacting",actions:["invokeOnOpen"]},{guard:"autoComplete",target:"interacting",actions:["invokeOnOpen"]},{target:"interacting",actions:["highlightLastOrSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["highlightLastOrSelectedItem","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"interacting",actions:["invokeOnOpen"]}],"VALUE.CLEAR":{actions:["clearInputValue","clearSelectedItems"]}}},interacting:{tags:["open","focused"],entry:["setInitialFocus"],effects:["scrollToHighlightedItem","trackDismissableLayer","trackPlacement"],on:{"CONTROLLED.CLOSE":[{guard:"restoreFocus",target:"focused",actions:["setFinalFocus"]},{target:"idle"}],CHILDREN_CHANGE:[{guard:"isHighlightedItemRemoved",actions:["clearHighlightedValue"]},{actions:["scrollToHighlightedItem"]}],"INPUT.HOME":{actions:["highlightFirstItem"]},"INPUT.END":{actions:["highlightLastItem"]},"INPUT.ARROW_DOWN":[{guard:be("autoComplete","isLastItemHighlighted"),actions:["clearHighlightedValue","scrollContentToTop"]},{actions:["highlightNextItem"]}],"INPUT.ARROW_UP":[{guard:be("autoComplete","isFirstItemHighlighted"),actions:["clearHighlightedValue"]},{actions:["highlightPrevItem"]}],"INPUT.ENTER":[{guard:be("isOpenControlled","isCustomValue",je("hasHighlightedItem"),je("allowCustomValue")),actions:["revertInputValue","invokeOnClose"]},{guard:be("isCustomValue",je("hasHighlightedItem"),je("allowCustomValue")),target:"focused",actions:["revertInputValue","invokeOnClose"]},{guard:be("isOpenControlled","closeOnSelect"),actions:["selectHighlightedItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectHighlightedItem","invokeOnClose","setFinalFocus"]},{actions:["selectHighlightedItem"]}],"INPUT.CHANGE":[{guard:"autoComplete",target:"suggesting",actions:["setInputValue"]},{target:"suggesting",actions:["clearHighlightedValue","setInputValue"]}],"ITEM.POINTER_MOVE":{actions:["setHighlightedValue"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedValue"]},"ITEM.CLICK":[{guard:be("isOpenControlled","closeOnSelect"),actions:["selectItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectItem","invokeOnClose","setFinalFocus"]},{actions:["selectItem"]}],"LAYER.ESCAPE":[{guard:be("isOpenControlled","autoComplete"),actions:["syncInputValue","invokeOnClose"]},{guard:"autoComplete",target:"focused",actions:["syncInputValue","invokeOnClose"]},{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose","setFinalFocus"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose"]}],"LAYER.INTERACT_OUTSIDE":[{guard:be("isOpenControlled","isCustomValue",je("allowCustomValue")),actions:["revertInputValue","invokeOnClose"]},{guard:be("isCustomValue",je("allowCustomValue")),target:"idle",actions:["revertInputValue","invokeOnClose"]},{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"idle",actions:["invokeOnClose"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose","setFinalFocus"]}],"VALUE.CLEAR":[{guard:"isOpenControlled",actions:["clearInputValue","clearSelectedItems","invokeOnClose"]},{target:"focused",actions:["clearInputValue","clearSelectedItems","invokeOnClose","setFinalFocus"]}]}},suggesting:{tags:["open","focused"],effects:["trackDismissableLayer","scrollToHighlightedItem","trackPlacement"],entry:["setInitialFocus"],on:{"CONTROLLED.CLOSE":[{guard:"restoreFocus",target:"focused",actions:["setFinalFocus"]},{target:"idle"}],CHILDREN_CHANGE:[{guard:be("isHighlightedItemRemoved","hasCollectionItems","autoHighlight"),actions:["clearHighlightedValue","highlightFirstItem"]},{guard:"isHighlightedItemRemoved",actions:["clearHighlightedValue"]},{guard:"autoHighlight",actions:["highlightFirstItem"]}],"INPUT.ARROW_DOWN":{target:"interacting",actions:["highlightNextItem"]},"INPUT.ARROW_UP":{target:"interacting",actions:["highlightPrevItem"]},"INPUT.HOME":{target:"interacting",actions:["highlightFirstItem"]},"INPUT.END":{target:"interacting",actions:["highlightLastItem"]},"INPUT.ENTER":[{guard:be("isOpenControlled","isCustomValue",je("hasHighlightedItem"),je("allowCustomValue")),actions:["revertInputValue","invokeOnClose"]},{guard:be("isCustomValue",je("hasHighlightedItem"),je("allowCustomValue")),target:"focused",actions:["revertInputValue","invokeOnClose"]},{guard:be("isOpenControlled","closeOnSelect"),actions:["selectHighlightedItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectHighlightedItem","invokeOnClose","setFinalFocus"]},{actions:["selectHighlightedItem"]}],"INPUT.CHANGE":{actions:["setInputValue"]},"LAYER.ESCAPE":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose"]}],"ITEM.POINTER_MOVE":{target:"interacting",actions:["setHighlightedValue"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedValue"]},"LAYER.INTERACT_OUTSIDE":[{guard:be("isOpenControlled","isCustomValue",je("allowCustomValue")),actions:["revertInputValue","invokeOnClose"]},{guard:be("isCustomValue",je("allowCustomValue")),target:"idle",actions:["revertInputValue","invokeOnClose"]},{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"idle",actions:["invokeOnClose"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose"]}],"ITEM.CLICK":[{guard:be("isOpenControlled","closeOnSelect"),actions:["selectItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectItem","invokeOnClose","setFinalFocus"]},{actions:["selectItem"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose","setFinalFocus"]}],"VALUE.CLEAR":[{guard:"isOpenControlled",actions:["clearInputValue","clearSelectedItems","invokeOnClose"]},{target:"focused",actions:["clearInputValue","clearSelectedItems","invokeOnClose","setFinalFocus"]}]}}},implementations:{guards:{isInputValueEmpty:({computed:e})=>e("isInputValueEmpty"),autoComplete:({computed:e,prop:t})=>e("autoComplete")&&!t("multiple"),autoHighlight:({computed:e})=>e("autoHighlight"),isFirstItemHighlighted:({prop:e,context:t})=>e("collection").firstValue===t.get("highlightedValue"),isLastItemHighlighted:({prop:e,context:t})=>e("collection").lastValue===t.get("highlightedValue"),isCustomValue:({computed:e})=>e("isCustomValue"),allowCustomValue:({prop:e})=>!!e("allowCustomValue"),hasHighlightedItem:({context:e})=>e.get("highlightedValue")!=null,closeOnSelect:({prop:e})=>!!e("closeOnSelect"),isOpenControlled:({prop:e})=>e("open")!=null,openOnChange:({prop:e,context:t})=>{const n=e("openOnChange");return _p(n)?n:!!n?.({inputValue:t.get("inputValue")})},restoreFocus:({event:e})=>{const t=e.restoreFocus??e.previousEvent?.restoreFocus;return t==null?!0:!!t},isChangeEvent:({event:e})=>e.previousEvent?.type==="INPUT.CHANGE",autoFocus:({prop:e})=>!!e("autoFocus"),isHighlightedItemRemoved:({prop:e,context:t})=>!e("collection").has(t.get("highlightedValue")),hasCollectionItems:({prop:e})=>e("collection").size>0},effects:{trackDismissableLayer({send:e,prop:t,scope:n}){return t("disableLayer")?void 0:av(()=>nn(n),{type:"listbox",defer:!0,exclude:()=>[ln(n),nr(n),Av(n)],onFocusOutside:t("onFocusOutside"),onPointerDownOutside:t("onPointerDownOutside"),onInteractOutside:t("onInteractOutside"),onEscapeKeyDown(s){s.preventDefault(),s.stopPropagation(),e({type:"LAYER.ESCAPE",src:"escape-key"})},onDismiss(){e({type:"LAYER.INTERACT_OUTSIDE",src:"interact-outside",restoreFocus:!1})}})},trackPlacement({context:e,prop:t,scope:n}){const r=()=>_a(n)||nr(n),s=()=>ka(n);return e.set("currentPlacement",t("positioning").placement),ba(r,s,{...t("positioning"),defer:!0,onComplete(o){e.set("currentPlacement",o.placement)}})},scrollToHighlightedItem({context:e,prop:t,scope:n,event:r}){const s=ln(n);let o=[];const i=u=>{const A=r.current().type.includes("POINTER"),c=e.get("highlightedValue");if(A||!c)return;const g=nn(n),d=t("scrollToIndexFn");if(d){const h=t("collection").indexOf(c);d({index:h,immediate:u,getElement:()=>bn(n,c)});return}const f=bn(n,c),m=Se(()=>{ua(f,{rootEl:g,block:"nearest"})});o.push(m)},a=Se(()=>i(!0));o.push(a);const l=QE(s,{attributes:["aria-activedescendant"],callback:()=>i(!1)});return o.push(l),()=>{o.forEach(u=>u())}}},actions:{reposition({context:e,prop:t,scope:n,event:r}){ba(()=>_a(n),()=>ka(n),{...t("positioning"),...r.options,defer:!0,listeners:!1,onComplete(i){e.set("currentPlacement",i.placement)}})},setHighlightedValue({context:e,event:t}){t.value!=null&&e.set("highlightedValue",t.value)},clearHighlightedValue({context:e}){e.set("highlightedValue",null)},selectHighlightedItem(e){const{context:t,prop:n}=e,r=n("collection"),s=t.get("highlightedValue");if(!s||!r.has(s))return;const o=n("multiple")?ia(t.get("value"),s):[s];n("onSelect")?.({value:o,itemValue:s}),t.set("value",o);const i=bt(n("selectionBehavior"),{preserve:t.get("inputValue"),replace:r.stringifyMany(o),clear:""});t.set("inputValue",i)},scrollToHighlightedItem({context:e,prop:t,scope:n}){Dc(()=>{const r=e.get("highlightedValue");if(r==null)return;const s=bn(n,r),o=nn(n),i=t("scrollToIndexFn");if(i){const a=t("collection").indexOf(r);i({index:a,immediate:!0,getElement:()=>bn(n,r)});return}ua(s,{rootEl:o,block:"nearest"})})},selectItem(e){const{context:t,event:n,flush:r,prop:s}=e;n.value!=null&&r(()=>{const o=s("multiple")?ia(t.get("value"),n.value):[n.value];s("onSelect")?.({value:o,itemValue:n.value}),t.set("value",o);const i=bt(s("selectionBehavior"),{preserve:t.get("inputValue"),replace:s("collection").stringifyMany(o),clear:""});t.set("inputValue",i)})},clearItem(e){const{context:t,event:n,flush:r,prop:s}=e;n.value!=null&&r(()=>{const o=Ec(t.get("value"),n.value);t.set("value",o);const i=bt(s("selectionBehavior"),{preserve:t.get("inputValue"),replace:s("collection").stringifyMany(o),clear:""});t.set("inputValue",i)})},setInitialFocus({scope:e}){Se(()=>{Na(e)})},setFinalFocus({scope:e}){Se(()=>{nr(e)?.dataset.focusable==null?Na(e):uv(e)})},syncInputValue({context:e,scope:t,event:n}){const r=ln(t);r&&(r.value=e.get("inputValue"),queueMicrotask(()=>{n.current().type!=="INPUT.CHANGE"&&jp(r)}))},setInputValue({context:e,event:t}){e.set("inputValue",t.value)},clearInputValue({context:e}){e.set("inputValue","")},revertInputValue({context:e,prop:t,computed:n}){const r=t("selectionBehavior"),s=bt(r,{replace:n("hasSelectedItems")?n("valueAsString"):"",preserve:e.get("inputValue"),clear:""});e.set("inputValue",s)},setValue(e){const{context:t,flush:n,event:r,prop:s}=e;n(()=>{t.set("value",r.value);const o=bt(s("selectionBehavior"),{preserve:t.get("inputValue"),replace:s("collection").stringifyMany(r.value),clear:""});t.set("inputValue",o)})},clearSelectedItems(e){const{context:t,flush:n,prop:r}=e;n(()=>{t.set("value",[]);const s=bt(r("selectionBehavior"),{preserve:t.get("inputValue"),replace:r("collection").stringifyMany([]),clear:""});t.set("inputValue",s)})},scrollContentToTop({prop:e,scope:t}){const n=e("scrollToIndexFn");if(n){const r=e("collection").firstValue;n({index:0,immediate:!0,getElement:()=>bn(t,r)})}else{const r=nn(t);if(!r)return;r.scrollTop=0}},invokeOnOpen({prop:e,event:t,context:n}){const r=La(t);e("onOpenChange")?.({open:!0,reason:r,value:n.get("value")})},invokeOnClose({prop:e,event:t,context:n}){const r=La(t);e("onOpenChange")?.({open:!1,reason:r,value:n.get("value")})},highlightFirstItem({context:e,prop:t,scope:n}){(nn(n)?queueMicrotask:Se)(()=>{const s=t("collection").firstValue;s&&e.set("highlightedValue",s)})},highlightFirstItemIfNeeded({computed:e,action:t}){e("autoHighlight")&&t(["highlightFirstItem"])},highlightLastItem({context:e,prop:t,scope:n}){(nn(n)?queueMicrotask:Se)(()=>{const s=t("collection").lastValue;s&&e.set("highlightedValue",s)})},highlightNextItem({context:e,prop:t}){let n=null;const r=e.get("highlightedValue"),s=t("collection");r?(n=s.getNextValue(r),!n&&t("loopFocus")&&(n=s.firstValue)):n=s.firstValue,n&&e.set("highlightedValue",n)},highlightPrevItem({context:e,prop:t}){let n=null;const r=e.get("highlightedValue"),s=t("collection");r?(n=s.getPreviousValue(r),!n&&t("loopFocus")&&(n=s.lastValue)):n=s.lastValue,n&&e.set("highlightedValue",n)},highlightFirstSelectedItem({context:e,prop:t}){Se(()=>{const[n]=t("collection").sort(e.get("value"));n&&e.set("highlightedValue",n)})},highlightFirstOrSelectedItem({context:e,prop:t,computed:n}){Se(()=>{let r=null;n("hasSelectedItems")?r=t("collection").sort(e.get("value"))[0]:r=t("collection").firstValue,r&&e.set("highlightedValue",r)})},highlightLastOrSelectedItem({context:e,prop:t,computed:n}){Se(()=>{const r=t("collection");let s=null;n("hasSelectedItems")?s=r.sort(e.get("value"))[0]:s=r.lastValue,s&&e.set("highlightedValue",s)})},autofillInputValue({context:e,computed:t,prop:n,event:r,scope:s}){const o=ln(s),i=n("collection");if(!t("autoComplete")||!o||!r.keypress)return;const a=i.stringify(e.get("highlightedValue"));Se(()=>{o.value=a||e.get("inputValue")})},syncSelectedItems(e){queueMicrotask(()=>{const{context:t,prop:n}=e,r=n("collection"),s=t.get("value"),o=s.map(a=>t.get("selectedItems").find(u=>r.getItemValue(u)===a)||r.find(a));t.set("selectedItems",o);const i=bt(n("selectionBehavior"),{preserve:t.get("inputValue"),replace:r.stringifyMany(s),clear:""});t.set("inputValue",i)})},syncHighlightedItem({context:e,prop:t}){const n=t("collection").find(e.get("highlightedValue"));e.set("highlightedItem",n)},toggleVisibility({event:e,send:t,prop:n}){t({type:n("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:e})}}}});function La(e){return(e.previousEvent||e).src}mr()(["allowCustomValue","autoFocus","closeOnSelect","collection","composite","defaultHighlightedValue","defaultInputValue","defaultOpen","defaultValue","dir","disabled","disableLayer","form","getRootNode","highlightedValue","id","ids","inputBehavior","inputValue","invalid","loopFocus","multiple","name","navigate","onFocusOutside","onHighlightChange","onInputValueChange","onInteractOutside","onOpenChange","onOpenChange","onPointerDownOutside","onSelect","onValueChange","open","openOnChange","openOnClick","openOnKeyPress","placeholder","positioning","readOnly","required","scrollToIndexFn","selectionBehavior","translations","value","alwaysSubmitOnEnter"]);mr()(["htmlFor"]);mr()(["id"]);mr()(["item","persistFocus"]);var pv=zc.extendWith("empty");wt({hookName:"useRenderStrategyContext",providerName:"<RenderStrategyProvider />"});var Ev=e=>gt()(e,["lazyMount","unmountOnExit"]);function Bv(e,t){const{state:n,send:r,context:s}=e,o=n.matches("mounted","unmountSuspended");return{skip:!s.get("initial"),present:o,setNode(i){i&&r({type:"NODE.SET",node:i})},unmount(){r({type:"UNMOUNT"})}}}var Iv={props({props:e}){return{...e,present:!!e.present}},initialState({prop:e}){return e("present")?"mounted":"unmounted"},refs(){return{node:null,styles:null}},context({bindable:e}){return{unmountAnimationName:e(()=>({defaultValue:null})),prevAnimationName:e(()=>({defaultValue:null})),present:e(()=>({defaultValue:!1})),initial:e(()=>({sync:!0,defaultValue:!1}))}},exit:["cleanupNode"],watch({track:e,prop:t,send:n}){e([()=>t("present")],()=>{n({type:"PRESENCE.CHANGED"})})},on:{"NODE.SET":{actions:["setupNode"]},"PRESENCE.CHANGED":{actions:["setInitial","syncPresence"]}},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:e})=>{e.get("initial")||queueMicrotask(()=>{e.set("initial",!0)})},invokeOnExitComplete:({prop:e,refs:t})=>{e("onExitComplete")?.();const n=t.get("node");if(!n)return;const r=Pt(n),s=new r.CustomEvent("exitcomplete",{bubbles:!1});n.dispatchEvent(s)},setupNode:({refs:e,event:t})=>{e.get("node")!==t.node&&(e.set("node",t.node),e.set("styles",ko(t.node)))},cleanupNode:({refs:e})=>{e.set("node",null),e.set("styles",null)},syncPresence:({context:e,refs:t,send:n,prop:r})=>{const s=r("present");if(s)return n({type:"MOUNT",src:"presence.changed"});const o=t.get("node");if(!s&&o?.ownerDocument.visibilityState==="hidden")return n({type:"UNMOUNT",src:"visibilitychange"});Se(()=>{const i=Or(t.get("styles"));e.set("unmountAnimationName",i),i==="none"||i===e.get("prevAnimationName")||t.get("styles")?.display==="none"||t.get("styles")?.animationDuration==="0s"?n({type:"UNMOUNT",src:"presence.changed"}):n({type:"UNMOUNT.SUSPEND"})})},setPrevAnimationName:({context:e,refs:t})=>{Se(()=>{e.set("prevAnimationName",Or(t.get("styles")))})},clearPrevAnimationName:({context:e})=>{e.set("prevAnimationName",null)}},effects:{trackAnimationEvents:({context:e,refs:t,send:n,prop:r})=>{const s=t.get("node");if(!s)return;const o=u=>{(u.composedPath?.()?.[0]??u.target)===s&&e.set("prevAnimationName",Or(t.get("styles")))},i=u=>{const A=Or(t.get("styles"));Yn(u)===s&&A===e.get("unmountAnimationName")&&!r("present")&&n({type:"UNMOUNT",src:"animationend"})},a=u=>{Yn(u)===s&&!r("present")&&n({type:"UNMOUNT",src:"animationcancel"})};s.addEventListener("animationstart",o),s.addEventListener("animationcancel",a),s.addEventListener("animationend",i);const l=Oc(s,{animationFillMode:"forwards"});return()=>{s.removeEventListener("animationstart",o),s.removeEventListener("animationcancel",a),s.removeEventListener("animationend",i),Dc(()=>l())}}}}};function Or(e){return e?.animationName||"none"}mr()(["onExitComplete","present","immediate"]);var Zc=e=>gt()(e,["immediate","lazyMount","onExitComplete","present","skipAnimationOnMount","unmountOnExit"]),eA=e=>{const[t,n]=Ev(No(e)),[r,s]=K(!1),o=Mc(Iv,e),i=_(()=>Bv(o));ze(()=>{i().present&&s(!0)});const a=l=>{l&&o.send({type:"NODE.SET",node:l})};return _(()=>({unmounted:!i().present&&!r()&&t.lazyMount||t.unmountOnExit&&!i().present&&r(),present:i().present,ref:a,presenceProps:{hidden:!i().present,"data-state":i().skip&&n.skipAnimationOnMount?void 0:n.present?"open":"closed"}}))},[tA,nA]=wt({hookName:"usePresenceContext",providerName:"<PresenceProvider />"}),[Mw,vv]=wt({hookName:"useEnvironmentContext",providerName:"<EnvironmentProvider />",strict:!1,defaultValue:()=>({dir:"ltr",locale:"en-US"})}),[rA,Ge]=wt({hookName:"useComboboxContext",providerName:"<ComboboxProvider />"}),wv=e=>{const t=Ge(),n=ne(()=>t().getClearTriggerProps(),e);return v(oe.button,n)},Cv=e=>{const t=Ge(),n=nA(),r=ne(()=>t().getContentProps(),()=>n().presenceProps,e);return v(Z,{get when(){return!n().unmounted},get children(){return v(oe.div,de(r,{ref(s){var o=ds(n().ref,e.ref);typeof o=="function"&&o(s)}}))}})},yv=pv.build(),xv=e=>{const t=Ge(),n=_(()=>t().collection.size);return v(Z,{get when(){return n()===0},get children(){return v(oe.div,de(()=>yv.empty.attrs,e,{role:"presentation"}))}})},bv=e=>e.children(Ge()),Sv=e=>{const t=Ge(),n=ne(()=>t().getControlProps(),e);return v(oe.div,n)},Dv=e=>{const t=Ge(),n=ne(()=>t().getInputProps(),e),r=Ct();return v(oe.input,de({get"aria-describedby"(){return r?.().ariaDescribedby}},n))},[Qv,Ov]=wt({hookName:"useComboboxItemContext",providerName:"<ComboboxItemProvider />"}),[Mv,sA]=wt({hookName:"useComboboxItemPropsContext",providerName:"<ComboboxItemPropsProvider />"}),Tv=e=>{const[t,n]=gt()(e,["item","persistFocus"]),r=Ge(),s=ne(()=>r().getItemProps(t),n),o=_(()=>r().getItemState(t));return v(Mv,{value:t,get children(){return v(Qv,{value:o,get children(){return v(oe.div,s)}})}})},Rv=e=>e.children(Ov()),[Fv,Pv]=wt({hookName:"useComboboxItemGroupPropsContext",providerName:"<ComboboxItemGroupPropsProvider />"}),kv=e=>{const[t,n]=gt()(e,["id"]),r=Ge(),s=ne({id:ls()},t),o=ne(()=>r().getItemGroupProps(s),n);return v(Fv,{value:s,get children(){return v(oe.div,o)}})},_v=e=>{const t=Ge(),n=Pv(),r=ne(()=>t().getItemGroupLabelProps({htmlFor:n.id}),e);return v(oe.div,r)},Nv=e=>{const t=Ge(),n=sA(),r=ne(()=>t().getItemIndicatorProps(n),e);return v(oe.div,r)},Lv=e=>{const t=Ge(),n=sA(),r=ne(()=>t().getItemTextProps(n),e);return v(oe.span,r)},Yv=e=>{const t=Ge(),n=ne(()=>t().getLabelProps(),e);return v(oe.label,n)},Gv=e=>{const t=Ge(),n=ne(()=>t().getListProps(),e);return v(oe.div,n)},Hv=e=>{const t=Ge(),n=nA(),r=ne(()=>t().getPositionerProps(),e);return v(Z,{get when(){return!n().unmounted},get children(){return v(oe.div,r)}})},Uv=e=>{const t=vv(),n=Lo(),r=ls(),s=Ct(),o=_(()=>({id:r,ids:{label:s?.().ids.label,input:s?.().ids.control},disabled:s?.().disabled,readOnly:s?.().readOnly,required:s?.().required,invalid:s?.().invalid,dir:t().dir,getRootNode:n().getRootNode,...No(e)})),i=Mc(mv,o);return _(()=>gv(i,qE))},Vv=e=>{const[t,n]=Zc(e),[r,s]=gt()(n,["allowCustomValue","alwaysSubmitOnEnter","autoFocus","closeOnSelect","collection","composite","defaultHighlightedValue","defaultInputValue","defaultOpen","defaultValue","disabled","disableLayer","form","highlightedValue","id","ids","inputBehavior","inputValue","invalid","loopFocus","multiple","name","navigate","onFocusOutside","onHighlightChange","onInputValueChange","onInteractOutside","onOpenChange","onPointerDownOutside","onValueChange","onSelect","open","openOnChange","openOnClick","openOnKeyPress","placeholder","positioning","readOnly","required","scrollToIndexFn","selectionBehavior","translations","value"]),o=Uv(r),i=eA(ne(t,()=>({present:o().open}))),a=ne(()=>o().getRootProps(),s);return v(rA,{value:o,get children(){return v(tA,{value:i,get children(){return v(oe.div,a)}})}})},Kv=e=>{const[t,n]=Zc(e),[{value:r},s]=gt()(n,["value"]),o=eA(ne(t,()=>({present:r().open}))),i=ne(()=>r().getRootProps(),s);return v(rA,{value:r,get children(){return v(tA,{value:o,get children(){return v(oe.div,i)}})}})},Wv=e=>{const[t,n]=gt()(e,["focusable"]),r=Ge(),s=ne(()=>r().getTriggerProps(t),n);return v(oe.button,s)},St={};Yo(St,{ClearTrigger:()=>wv,Content:()=>Cv,Context:()=>bv,Control:()=>Sv,Empty:()=>xv,Input:()=>Dv,Item:()=>Tv,ItemContext:()=>Rv,ItemGroup:()=>kv,ItemGroupLabel:()=>_v,ItemIndicator:()=>Nv,ItemText:()=>Lv,Label:()=>Yv,List:()=>Gv,Positioner:()=>Hv,Root:()=>Vv,RootProvider:()=>Kv,Trigger:()=>Wv});var Ya=e=>new Go(e);function zv(e){const t=_(()=>{const A=typeof e=="function"?e():e;return An(A,["initialItems","filter","limit"])}),n=()=>{const[A]=t();return A.initialItems},[r,s]=K(n()),[o,i]=K(""),a=A=>{s(A),i("")},l=A=>{const[,c]=t();return Ya({...c,items:A})};return{collection:_(()=>{const[A,c]=t(),g=A.filter;let d=r();o()&&g&&(d=l(r()).filter((m,h,p)=>g(m,o(),p)).items);const f=A.limit==null?d:d.slice(0,A.limit);return Ya({...c,items:f})}),filter:(A="")=>{i(A)},set:A=>{a(A)},reset:()=>{const[A]=t();a(A.initialItems)},clear:()=>{a([])},insert:(A,...c)=>{const g=l(r()).insert(A,...c).items;a(g)},insertBefore:(A,...c)=>{const g=l(r()).insertBefore(A,...c).items;a(g)},insertAfter:(A,...c)=>{const g=l(r()).insertAfter(A,...c).items;a(g)},remove:(...A)=>{const c=l(r()).remove(...A).items;a(c)},move:(A,c)=>{const g=l(r()).move(A,c).items;a(g)},moveBefore:(A,...c)=>{const g=l(r()).moveBefore(A,...c).items;a(g)},moveAfter:(A,...c)=>{const g=l(r()).moveAfter(A,...c).items;a(g)},reorder:(A,c)=>{const g=l(r()).reorder(A,c).items;a(g)},append:(...A)=>{const c=l(r()).append(...A).items;a(c)},upsert:(A,c,g="append")=>{const d=l(r()).upsert(A,c,g).items;a(d)},prepend:(...A)=>{const c=l(r()).prepend(...A).items;a(c)},update:(A,c)=>{const g=l(r()).update(A,c).items;a(g)}}}var $v=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],jv=e=>v(vt,de(e,{iconNode:$v,name:"search"})),qv=jv,Jv=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Xv=e=>v(vt,de(e,{iconNode:Jv,name:"x"})),Zv=Xv,to=P("<span>"),ew=P('<span class="bg-yellow-200 font-semibold">'),tw=P('<div class="absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none">'),nw=P('<div class="absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none"><kbd class="px-1.5 py-0.5 text-xs font-mono text-gray-400 bg-gray-100 border border-gray-300 rounded">/'),rw=P('<div class="px-4 py-2 text-xs text-gray-400 bg-gray-50 border-t border-gray-200">Showing 50 of <!> results'),sw=P('<div class="px-4 py-3 text-sm text-gray-500">No results found'),ow=P('<div class="text-xs text-gray-500 mt-0.5 truncate">');const Ga=50;function iw(e,t){if(t.length===0)return(()=>{var s=to();return O(s,e),s})();const n=[];let r=0;for(const[s,o]of t)s>r&&n.push((()=>{var i=to();return O(i,()=>e.slice(r,s)),i})()),n.push((()=>{var i=ew();return O(i,()=>e.slice(s,o+1)),i})()),r=o+1;return r<e.length&&n.push((()=>{var s=to();return O(s,()=>e.slice(r)),s})()),n}function Ha(e,t){return new Set(["kind","name","title","serviceName"]).has(e)?t:`${e}: ${t}`}function aw(e){const[t,n]=K(e.query),[r,s]=K(!1),[o,i]=K(!1);let a,l;ze(()=>n(e.query)),ze(()=>{t().length>0&&e.results.length>0?s(!0):s(!1)});const{collection:u,set:A}=zv({initialItems:[],itemToString:h=>Ha(h.key,h.value),itemToValue:h=>`${h.spanId}-${h.key}`});ze(()=>A(e.results.slice(0,Ga)));const c=h=>{h.reason==="input-change"&&(n(h.inputValue),a&&clearTimeout(a),a=window.setTimeout(()=>{e.onQueryChange(h.inputValue)},200))},g=h=>{h.open||(s(!1),e.onResultHover?.(null))},d=h=>{const p=h.items[0];p&&(e.onResultSelect(p.spanId),s(!1),e.onResultHover?.(null))},f=h=>{e.onResultHover?.(h.highlightedItem?.spanId??null)},m=()=>{n(""),s(!1),a&&clearTimeout(a),e.onClear(),e.onResultHover?.(null)};return dn(()=>{const h=p=>{p.key==="/"&&!o()&&!(p.target instanceof HTMLInputElement)&&!(p.target instanceof HTMLTextAreaElement)&&(p.preventDefault(),l?.focus())};document.addEventListener("keydown",h),Te(()=>document.removeEventListener("keydown",h))}),Te(()=>{a&&clearTimeout(a)}),v(St.Root,{get collection(){return u()},get inputValue(){return t()},onInputValueChange:c,onOpenChange:g,onValueChange:d,onHighlightChange:f,get open(){return r()},allowCustomValue:!0,selectionBehavior:"preserve",multiple:!1,get children(){return[v(St.Control,{class:"relative flex items-center",get children(){return[(()=>{var h=tw();return O(h,v(qv,{size:16,class:"text-gray-400"})),h})(),v(St.Input,{ref(h){var p=l;typeof p=="function"?p(h):l=h},onFocus:()=>i(!0),onBlur:()=>i(!1),class:`w-full pl-9 pr-8 py-1.5 text-sm border border-gray-300 rounded-md
11
+ `,I={[A()?"width":"height"]:`${100-s()}%`};return p!==h.e&&Tt(c,h.e=p),h.t=Wr(g,E,h.t),B!==h.a&&we(d,"aria-orientation",h.a=B),C!==h.o&&we(d,"aria-valuenow",h.o=C),x!==h.i&&Tt(d,h.i=x),h.n=Wr(f,I,h.n),h},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),c})()}fn(["mousedown"]);function lp(e,t,n){if(t<=0)return[];if(e.length===0)return Array(t).fill(null);const r=[...e].sort((i,a)=>i.timestamp-a.timestamp),s=n??{startMs:r[0].timestamp,endMs:r[r.length-1].timestamp};return r.filter(i=>i.timestamp>=s.startMs&&i.timestamp<=s.endMs).length===0?Ap(r,t,s):up(r,t,s)}function cp(e){return{startMs:e.visibleStartMs,endMs:e.visibleEndMs}}function Ap(e,t,n){let r=null;for(const s of e)s.timestamp<n.startMs&&(!r||s.timestamp>r.timestamp)&&(r=s);return r?Array(t).fill(r):Array(t).fill(null)}function up(e,t,n){const r=n.endMs-n.startMs;if(r<=0){const i=Zi(e,n.startMs);return Array(t).fill(i)}const s=r/t,o=[];for(let i=0;i<t;i++){const a=n.startMs+i*s,l=n.startMs+(i+1)*s,u=(a+l)/2,A=i===t-1,c=e.filter(g=>A?g.timestamp>=a&&g.timestamp<=l:g.timestamp>=a&&g.timestamp<l);if(c.length>0){const g=c.reduce((d,f)=>{const m=Math.abs(d.timestamp-u);return Math.abs(f.timestamp-u)<m?f:d});o.push(g)}else{const g=Zi(e,a);o.push(g)}}return o}function Zi(e,t){let n=null;for(const r of e)r.timestamp<=t&&(!n||r.timestamp>n.timestamp)&&(n=r);return n}var gp=P('<div class="h-full bg-gray-50 overflow-hidden p-2"data-testid=screenshot-filmstrip><div class="flex gap-2 h-full">'),dp=P('<div class="flex items-center justify-center w-full text-gray-400 text-sm">Resize panel to view screenshots'),fp=P('<div class="flex items-center justify-center w-full text-gray-400 text-sm">No screenshots available'),hp=P('<div class="flex items-center justify-center w-full text-gray-400 text-sm">No screenshots in this time range'),mp=P('<div class="flex-shrink-0 h-full aspect-video">'),pp=P('<div class="flex-shrink-0 h-full aspect-video bg-white rounded border border-gray-200 overflow-hidden shadow-sm"><img class="w-full h-full object-contain"loading=lazy data-testid=screenshot-filmstrip-image>',!0,!1,!1);function ea(e){let t;const[n,r]=K(0),s=_(()=>e.screenshots.map(a=>({timestamp:a.timestamp-e.testStartTimeMs,original:a})));ze(()=>{if(!t)return;const a=new ResizeObserver(l=>{for(const u of l){const A=u.contentRect.height,c=u.contentRect.width;if(A>0&&c>0){const f=(A-16)*(16/9),m=8,h=Math.floor((c+m)/(f+m));r(Math.max(0,h))}}});a.observe(t),Te(()=>{a.disconnect()})});const o=_(()=>{const a=cp(e.viewport);return lp(s(),n(),a).map(u=>u?u.original:null)}),i=_(()=>o().some(a=>a!==null));return(()=>{var a=gp(),l=a.firstChild,u=t;return typeof u=="function"?hn(u,a):t=a,O(l,v(Z,{get when(){return n()>0},get fallback(){return v(Z,{get when(){return e.screenshots.length>0},get fallback(){return fp()},get children(){return dp()}})},get children(){return v(Z,{get when(){return i()},get fallback(){return hp()},get children(){return v(_e,{get each(){return o()},children:A=>v(Z,{when:A,get fallback(){return mp()},children:c=>(()=>{var g=pp(),d=g.firstChild;return g.addEventListener("mouseleave",()=>e.onScreenshotHover?.(null)),g.addEventListener("mouseenter",()=>e.onScreenshotHover?.(c().url)),we(d,"draggable",!1),$(f=>{var m=c().url,h=`Screenshot at ${c().timestamp}`;return m!==f.e&&we(d,"src",f.e=m),h!==f.t&&we(d,"alt",f.t=h),f},{e:void 0,t:void 0}),g})()})})}})}})),a})()}const Ep=[100,200,250,500,1e3,2e3,5e3,1e4,15e3,3e4,6e4,12e4,3e5,6e5];function ta(e){if(e===0)return"0s";const t=e/1e3;if(t<1)return`${Math.round(e)}ms`;if(t<60){if(t===Math.floor(t))return`${t}s`;const s=Math.round(t*10)/10;return s===Math.floor(s)?`${s}s`:`${s}s`}const n=Math.floor(t/60),r=Math.round(t%60);return r===0?`${n}m`:`${n}m ${r}s`}function Bp(e,t=60){if(e<=0)return 0;const n=Math.floor(e/t)+1;return Math.max(2,n)}function Ip(e,t){if(e<=0||t<2)return e>0?e:1e3;for(const s of Ep)if(Math.floor(e/s)+1<=t)return s;const n=e/(t-1),r=10**Math.floor(Math.log10(n));return Math.ceil(n/r)*r}function vp(e,t){if(e<=0)return[{position:0,timeMs:0,label:"0s"}];const n=[];for(let s=0;s<=e;s+=t)n.push({position:s/e,timeMs:s,label:ta(s)});const r=n[n.length-1];return r&&r.timeMs<e&&(e-r.timeMs<=t*.5&&n.pop(),n.push({position:1,timeMs:e,label:ta(e)})),n}function na(e,t,n=60){const r=Bp(t,n),s=Ip(e,r),o=vp(e,s);return{intervalMs:s,ticks:o}}var wp=P('<div class="absolute top-0 bottom-0 bg-gray-300/30 pointer-events-none"style=left:0%>'),Cp=P('<div class="absolute top-0 bottom-0 bg-gray-300/30 pointer-events-none"style=right:0%>'),yp=P('<div class="absolute top-0 bottom-0 bg-blue-500/10 border-y border-blue-400/50">'),ra=P('<div class="absolute top-0 bottom-0 w-1.5 bg-blue-500 hover:bg-blue-600 cursor-ew-resize z-10 transition-colors"style=transform:translateX(-50%)><div class="absolute inset-y-1 left-0.5 w-px bg-blue-300">'),xp=P('<div class="relative h-6 bg-gray-50 border-b border-gray-200 flex-shrink-0 select-none">'),bp=P('<div class="absolute top-0 bottom-0 flex items-center pointer-events-none"><div class="w-px h-5 bg-gray-300"></div><span class="text-[10px] text-gray-500 whitespace-nowrap pl-1">'),Sp=P('<div class="absolute top-0 bottom-0 w-px bg-blue-500 pointer-events-none z-50">');const sa=.01;function Dp(e){let t;const[n,r]=K([]),[s,o]=K(null);ze(()=>{if(!t)return;const f=new ResizeObserver(m=>{for(const h of m){const p=h.contentRect.width;if(p>0){const E=na(e.durationMs,p);r(E.ticks)}}});f.observe(t),Te(()=>{f.disconnect()})}),ze(()=>{if(t){const f=t.getBoundingClientRect().width;if(f>0){const m=na(e.durationMs,f);r(m.ticks)}}});const i=()=>Gs(e.viewport.visibleStartMs,e.viewport)*100,a=()=>Gs(e.viewport.visibleEndMs,e.viewport)*100,l=()=>a()-i(),u=()=>{if(e.hoverPosition===null)return null;const f=on(e.hoverPosition,e.viewport);return Gs(f,e.viewport)*100},A=f=>m=>{if(m.preventDefault(),m.stopPropagation(),!t)return;const h=t.getBoundingClientRect().width;o({mode:f,startMouseX:m.clientX,containerWidth:h,initialViewport:{...e.viewport}})},c=f=>{const m=s();if(!m||!e.onViewportChange)return;const E=(f.clientX-m.startMouseX)/m.containerWidth*m.initialViewport.totalDurationMs;let B;switch(m.mode){case"left-handle":{const C=m.initialViewport.visibleStartMs+E,x=0,I=m.initialViewport.visibleEndMs-m.initialViewport.totalDurationMs*sa;B={...m.initialViewport,visibleStartMs:Math.max(x,Math.min(I,C))};break}case"right-handle":{const C=m.initialViewport.visibleEndMs+E,x=m.initialViewport.visibleStartMs+m.initialViewport.totalDurationMs*sa,I=m.initialViewport.totalDurationMs;B={...m.initialViewport,visibleEndMs:Math.max(x,Math.min(I,C))};break}case"pan":{const C=m.initialViewport.visibleEndMs-m.initialViewport.visibleStartMs;let x=m.initialViewport.visibleStartMs+E,I=m.initialViewport.visibleEndMs+E;x<0&&(x=0,I=C),I>m.initialViewport.totalDurationMs&&(I=m.initialViewport.totalDurationMs,x=I-C),B={...m.initialViewport,visibleStartMs:x,visibleEndMs:I};break}}e.onViewportChange(To(B))},g=()=>{o(null)};dn(()=>{const f=h=>c(h),m=()=>g();document.addEventListener("mousemove",f),document.addEventListener("mouseup",m),Te(()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",m)})});const d=()=>{const f=s();if(f)return f.mode==="pan"?"grabbing":"ew-resize"};return(()=>{var f=xp(),m=t;return typeof m=="function"?hn(m,f):t=f,O(f,v(Z,{get when(){return!fh(e.viewport)},get children(){return[(()=>{var h=wp();return $(p=>V(h,"width",`${i()}%`)),h})(),(()=>{var h=Cp();return $(p=>V(h,"left",`${a()}%`)),h})(),(()=>{var h=yp();return Dn(h,"mousedown",A("pan"),!0),$(p=>{var E=`${i()}%`,B=`${l()}%`,C=s()?.mode==="pan"?"grabbing":"grab";return E!==p.e&&V(h,"left",p.e=E),B!==p.t&&V(h,"width",p.t=B),C!==p.a&&V(h,"cursor",p.a=C),p},{e:void 0,t:void 0,a:void 0}),h})(),(()=>{var h=ra();return Dn(h,"mousedown",A("left-handle"),!0),$(p=>V(h,"left",`${i()}%`)),h})(),(()=>{var h=ra();return Dn(h,"mousedown",A("right-handle"),!0),$(p=>V(h,"left",`${a()}%`)),h})()]}}),null),O(f,v(_e,{get each(){return n()},children:(h,p)=>{const E=()=>p()===n().length-1;return(()=>{var B=bp(),C=B.firstChild,x=C.nextSibling;return O(x,()=>h.label),$(I=>{var w=`${h.position*100}%`,y=E()?"absolute":"relative",S=E()?"1px":void 0;return w!==I.e&&V(B,"left",I.e=w),y!==I.t&&V(x,"position",I.t=y),S!==I.a&&V(x,"right",I.a=S),I},{e:void 0,t:void 0,a:void 0}),B})()}}),null),O(f,v(Z,{get when(){return u()},keyed:!0,children:h=>(()=>{var p=Sp();return V(p,"left",`${h}%`),p})()}),null),$(h=>V(f,"cursor",d())),f})()}fn(["mousedown"]);var an=(e,t=[])=>({parts:(...n)=>{if(Qp(t))return an(e,n);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...n)=>an(e,[...t,...n]),omit:(...n)=>an(e,t.filter(r=>!n.includes(r))),rename:n=>an(n,t),keys:()=>t,build:()=>[...new Set(t)].reduce((n,r)=>Object.assign(n,{[r]:{selector:[`&[data-scope="${yn(e)}"][data-part="${yn(r)}"]`,`& [data-scope="${yn(e)}"][data-part="${yn(r)}"]`].join(", "),attrs:{"data-scope":yn(e),"data-part":yn(r)}}}),{})}),yn=e=>e.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),Qp=e=>e.length===0,Op=an("fieldset").parts("root","errorText","helperText","legend"),br=Op.build(),Mp=e=>typeof e=="function",oa=(e,t)=>{for(const n of e)Mp(n)&&n(t)};function ds(...e){let t=null;return ze(()=>{oa(e,t)}),n=>{t=n,oa(e,n)}}var gt=()=>(e,t)=>An(e,t);function Tp(e){return e==null?[]:Array.isArray(e)?e:[e]}var Rp=(e,t)=>e.indexOf(t)!==-1,Fp=(e,...t)=>e.concat(t),Ec=(e,...t)=>e.filter(n=>!t.includes(n)),ia=(e,t)=>Rp(e,t)?Ec(e,t):Fp(e,t),aa=e=>e?.constructor.name==="Array",Pp=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!hr(e[n],t[n]))return!1;return!0},hr=(e,t)=>{if(Object.is(e,t))return!0;if(e==null&&t!=null||e!=null&&t==null)return!1;if(typeof e?.isEqual=="function"&&typeof t?.isEqual=="function")return e.isEqual(t);if(typeof e=="function"&&typeof t=="function")return e.toString()===t.toString();if(aa(e)&&aa(t))return Pp(Array.from(e),Array.from(t));if(typeof e!="object"||typeof t!="object")return!1;const n=Object.keys(t??Object.create(null)),r=n.length;for(let s=0;s<r;s++)if(!Reflect.has(e,n[s]))return!1;for(let s=0;s<r;s++){const o=n[s];if(!hr(e[o],t[o]))return!1}return!0},kp=e=>Array.isArray(e),_p=e=>e===!0||e===!1,Bc=e=>e!=null&&typeof e=="object",kr=e=>Bc(e)&&!kp(e),Np=e=>typeof e=="number"&&!Number.isNaN(e),Rn=e=>typeof e=="string",it=e=>typeof e=="function",Lp=e=>e==null,tr=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Yp=e=>Object.prototype.toString.call(e),Ic=Function.prototype.toString,Gp=Ic.call(Object),Hp=e=>{if(!Bc(e)||Yp(e)!="[object Object]"||Kp(e))return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const n=tr(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Ic.call(n)==Gp},Up=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,Vp=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,Kp=e=>Up(e)||Vp(e),Wp=()=>{},Eo=(...e)=>(...t)=>{e.forEach(function(n){n?.(...t)})};function bt(e,t,...n){if(e in t){const s=t[e];return it(s)?s(...n):s}const r=new Error(`No matching key: ${JSON.stringify(e)} in ${JSON.stringify(Object.keys(t))}`);throw Error.captureStackTrace?.(r,bt),r}function Fo(e){if(!Hp(e)||e===void 0)return e;const t=Reflect.ownKeys(e).filter(r=>typeof r=="string"),n={};for(const r of t){const s=e[r];s!==void 0&&(n[r]=Fo(s))}return n}function Bo(...e){e.length===1?e[0]:e[1],e.length===2&&e[0]}function vc(e,t){if(e==null)throw new Error(t())}var zp=Object.defineProperty,$p=(e,t,n)=>t in e?zp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ws=(e,t,n)=>$p(e,typeof t!="symbol"?t+"":t,n);function jp(e){if(!e)return;const t=e.selectionStart??0,n=e.selectionEnd??0;Math.abs(n-t)===0&&t===0&&e.setSelectionRange(e.value.length,e.value.length)}var qp=()=>{},fs=e=>typeof e=="object"&&e!==null,q=e=>e?"":void 0,_r=e=>e?"true":void 0,Jp=1,Xp=9,Zp=11,st=e=>fs(e)&&e.nodeType===Jp&&typeof e.nodeName=="string",Po=e=>fs(e)&&e.nodeType===Xp,eE=e=>fs(e)&&e===e.window,wc=e=>st(e)?e.localName||"":"#document";function tE(e){return["html","body","#document"].includes(wc(e))}var nE=e=>fs(e)&&e.nodeType!==void 0,Ln=e=>nE(e)&&e.nodeType===Zp&&"host"in e,rE=e=>!!e?.matches("a[href]"),sE=e=>st(e)?e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0:!1;function oE(e){if(!e)return!1;const t=e.getRootNode();return Cc(t)===e}function ts(e,t){if(!e||!t||!st(e)||!st(t))return!1;const n=t.getRootNode?.();if(e===t||e.contains(t))return!0;if(n&&Ln(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function qt(e){return Po(e)?e:eE(e)?e.document:e?.ownerDocument??document}function iE(e){return qt(e).documentElement}function Pt(e){return Ln(e)?Pt(e.host):Po(e)?e.defaultView??window:st(e)?e.ownerDocument?.defaultView??window:window}function Cc(e){let t=e.activeElement;for(;t?.shadowRoot;){const n=t.shadowRoot.activeElement;if(!n||n===t)break;t=n}return t}function aE(e){if(wc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ln(e)&&e.host||iE(e);return Ln(t)?t.host:t}function lE(e){let t;try{if(t=e.getRootNode({composed:!0}),Po(t)||Ln(t))return t}catch{}return e.ownerDocument??document}var zs=new WeakMap;function ko(e){return zs.has(e)||zs.set(e,Pt(e).getComputedStyle(e)),zs.get(e)}var cE=new Set(["menu","listbox","dialog","grid","tree","region"]),AE=e=>cE.has(e),uE=e=>e.getAttribute("aria-controls")?.split(" ")||[];function gE(e,t){const n=new Set,r=lE(e),s=o=>{const i=o.querySelectorAll("[aria-controls]");for(const a of i){if(a.getAttribute("aria-expanded")!=="true")continue;const l=uE(a);for(const u of l){if(!u||n.has(u))continue;n.add(u);const A=r.getElementById(u);if(A){const c=A.getAttribute("role"),g=A.getAttribute("aria-modal")==="true";if(c&&AE(c)&&!g&&(A===t||A.contains(t)||s(A)))return!0}}}return!1};return s(e)}var _o=()=>typeof document<"u";function dE(){return navigator.userAgentData?.platform??navigator.platform}function fE(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}var hE=e=>_o()&&e.test(dE()),mE=e=>_o()&&e.test(fE()),la=()=>_o()&&!!navigator.maxTouchPoints,yc=()=>hE(/^Mac/i),pE=()=>mE(/Firefox/i);function EE(e){return e.composedPath?.()??e.nativeEvent?.composedPath?.()}function Yn(e){return EE(e)?.[0]??e.target}function BE(e){const t=e.currentTarget;if(!t||!t.matches("a[href], button[type='submit'], input[type='submit']"))return!1;const r=e.button===1,s=wE(e);return r||s}function IE(e){const t=e.currentTarget;if(!t)return!1;const n=t.localName;return e.altKey?n==="a"||n==="button"&&t.type==="submit"||n==="input"&&t.type==="submit":!1}function vE(e){return yE(e).isComposing||e.keyCode===229}function wE(e){return yc()?e.metaKey:e.ctrlKey}var Sr=e=>e.button===0,xc=e=>e.button===2||yc()&&e.ctrlKey&&e.button===0,CE={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"},ca={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft"};function Aa(e,t={}){const{dir:n="ltr",orientation:r="horizontal"}=t;let s=e.key;return s=CE[s]??s,n==="rtl"&&r==="horizontal"&&s in ca&&(s=ca[s]),s}function yE(e){return e.nativeEvent??e}var Nr=(e,t,n,r)=>{const s=typeof e=="function"?e():e;return s?.addEventListener(t,n,r),()=>{s?.removeEventListener(t,n,r)}},xE="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";function bc(e){return!st(e)||e.closest("[inert]")?!1:e.matches(xE)&&sE(e)}var bE=class Sc{constructor(){Ws(this,"id",null),Ws(this,"fn_cleanup"),Ws(this,"cleanup",()=>{this.cancel()})}static create(){return new Sc}request(t){this.cancel(),this.id=globalThis.requestAnimationFrame(()=>{this.id=null,this.fn_cleanup=t?.()})}cancel(){this.id!==null&&(globalThis.cancelAnimationFrame(this.id),this.id=null),this.fn_cleanup?.(),this.fn_cleanup=void 0}isActive(){return this.id!==null}};function Se(e){const t=bE.create();return t.request(e),t.cleanup}function Dc(e){const t=new Set;function n(r){const s=globalThis.requestAnimationFrame(r);t.add(()=>globalThis.cancelAnimationFrame(s))}return n(()=>n(e)),function(){t.forEach(s=>s())}}function SE(e,t,n){const r=Se(()=>{e.removeEventListener(t,s,!0),n()}),s=()=>{r(),n()};return e.addEventListener(t,s,{once:!0,capture:!0}),r}function DE(e,t){if(!e)return;const{attributes:n,callback:r}=t,s=e.ownerDocument.defaultView||window,o=new s.MutationObserver(i=>{for(const a of i)a.type==="attributes"&&a.attributeName&&n.includes(a.attributeName)&&r(a)});return o.observe(e,{attributes:!0,attributeFilter:n}),()=>o.disconnect()}function QE(e,t){const{defer:n}=t,r=n?Se:o=>o(),s=[];return s.push(r(()=>{const o=typeof e=="function"?e():e;s.push(DE(o,t))})),()=>{s.forEach(o=>o?.())}}function OE(e){const t=()=>{const n=Pt(e);e.dispatchEvent(new n.MouseEvent("click"))};pE()?SE(e,"keyup",t):queueMicrotask(t)}function Io(e){const t=aE(e);return tE(t)?qt(t).body:st(t)&&Qc(t)?t:Io(t)}var ME=/auto|scroll|overlay|hidden|clip/,TE=new Set(["inline","contents"]);function Qc(e){const t=Pt(e),{overflow:n,overflowX:r,overflowY:s,display:o}=t.getComputedStyle(e);return ME.test(n+s+r)&&!TE.has(o)}function RE(e){return e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth}function ua(e,t){const{rootEl:n,...r}=t||{};!e||!n||!Qc(n)||!RE(n)||e.scrollIntoView(r)}function FE(e,t){return e?.querySelector(t)??null}function Oc(e,t){if(!e)return qp;const n=Object.keys(t).reduce((r,s)=>(r[s]=e.style.getPropertyValue(s),r),{});return Object.assign(e.style,t),()=>{Object.assign(e.style,n),e.style.length===0&&e.removeAttribute("style")}}function PE(e,t,n){const{signal:r}=t;return[new Promise((i,a)=>{const l=setTimeout(()=>{a(new Error(`Timeout of ${n}ms exceeded`))},n);r.addEventListener("abort",()=>{clearTimeout(l),a(new Error("Promise aborted"))}),e.then(u=>{r.aborted||(clearTimeout(l),i(u))}).catch(u=>{r.aborted||(clearTimeout(l),a(u))})}),()=>t.abort()]}function kE(e,t){const{timeout:n,rootNode:r}=t,s=Pt(r),o=qt(r),i=new s.AbortController;return PE(new Promise(a=>{const l=e();if(l){a(l);return}const u=new s.MutationObserver(()=>{const A=e();A&&A.isConnected&&(u.disconnect(),a(A))});u.observe(o.body,{childList:!0,subtree:!0})}),i,n)}var _E=(...e)=>e.map(t=>t?.trim?.()).filter(Boolean).join(" "),NE=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g,ga=e=>{const t={};let n;for(;n=NE.exec(e);)t[n[1]]=n[2];return t},LE=(e,t)=>{if(Rn(e)){if(Rn(t))return`${e};${t}`;e=ga(e)}else Rn(t)&&(t=ga(t));return Object.assign({},e??{},t??{})};function YE(...e){let t={};for(let n of e){if(!n)continue;for(let s in t){if(s.startsWith("on")&&typeof t[s]=="function"&&typeof n[s]=="function"){t[s]=Eo(n[s],t[s]);continue}if(s==="className"||s==="class"){t[s]=_E(t[s],n[s]);continue}if(s==="style"){t[s]=LE(t[s],n[s]);continue}t[s]=n[s]!==void 0?n[s]:t[s]}for(let s in n)t[s]===void 0&&(t[s]=n[s]);const r=Object.getOwnPropertySymbols(n);for(let s of r)t[s]=n[s]}return t}function GE(){return{and:(...e)=>function(n){return e.every(r=>n.guard(r))},or:(...e)=>function(n){return e.some(r=>n.guard(r))},not:e=>function(n){return!n.guard(e)}}}function HE(){return{guards:GE(),createMachine:e=>e,choose:e=>function({choose:n}){return n(e)?.actions}}}var xn=(e=>(e.NotStarted="Not Started",e.Started="Started",e.Stopped="Stopped",e))(xn||{}),$s="__init__";function UE(e){const t=()=>e.getRootNode?.()??document,n=()=>qt(t());return{...e,getRootNode:t,getDoc:n,getWin:()=>n().defaultView??window,getActiveElement:()=>Cc(t()),isActiveElement:oE,getById:i=>t().getElementById(i)}}function VE(e){return new Proxy({},{get(t,n){return n==="style"?r=>e({style:r}).style:e}})}var mr=()=>e=>Array.from(new Set(e));function ns(e){const t=e().value??e().defaultValue,n=e().isEqual??Object.is,[r,s]=K(t),o=_(()=>e().value!=null),i={current:r()},a={current:void 0};ze(()=>{const A=o()?e().value:r();a.current=A,i.current=A});const l=A=>{const c=a.current,g=it(A)?A(i.current):A;e().debug&&console.log(`[bindable > ${e().debug}] setValue`,{next:g,prev:c}),o()||s(g),n(g,c)||e().onChange?.(g,c)};function u(){const A=o()?e().value:r;return it(A)?A():A}return{initial:t,ref:i,get:u,set:l,invoke(A,c){e().onChange?.(A,c)},hash(A){return e().hash?.(A)??String(A)}}}ns.cleanup=e=>{Te(()=>e())};ns.ref=e=>{let t=e;return{get:()=>t,set:n=>{t=n}}};function KE(e){const t={current:e};return{get(n){return t.current[n]},set(n,r){t.current[n]=r}}}function js(e){return it(e)?e():e}var WE=(e,t)=>{let n=[],r=!0;ze(()=>{if(r){n=e.map(o=>js(o)),r=!1;return}let s=!1;for(let o=0;o<e.length;o++)if(!hr(n[o],js(e[o]))){s=!0;break}s&&(n=e.map(o=>js(o)),t())})};function Mc(e,t={}){const n=_(()=>{const{id:y,ids:S,getRootNode:Q}=qs(t);return UE({id:y,ids:S,getRootNode:Q})}),r=(...y)=>{e.debug&&console.log(...y)},s=_(()=>e.props?.({props:Fo(qs(t)),scope:n()})??qs(t)),o=zE(s),i=e.context?.({prop:o,bindable:ns,get scope(){return n()},flush:da,getContext(){return a},getComputed(){return C},getRefs(){return f},getEvent(){return g()}}),a={get(y){return i?.[y].get()},set(y,S){i?.[y].set(S)},initial(y){return i?.[y].initial},hash(y){const S=i?.[y].get();return i?.[y].hash(S)}},l={current:new Map},u={current:null},A={current:null},c={current:{type:""}},g=()=>de(c.current,{current(){return c.current},previous(){return A.current}}),d=()=>de(x,{matches(...y){const S=x.get();return y.includes(S)},hasTag(y){const S=x.get();return!!e.states[S]?.tags?.includes(y)}}),f=KE(e.refs?.({prop:o,context:a})??{}),m=()=>({state:d(),context:a,event:g(),prop:o,send:w,action:h,guard:p,track:WE,refs:f,computed:C,flush:da,get scope(){return n()},choose:B}),h=y=>{const S=it(y)?y(m()):y;if(!S)return;const Q=S.map(D=>{const R=e.implementations?.actions?.[D];return R||Bo(`[zag-js] No implementation found for action "${JSON.stringify(D)}"`),R});for(const D of Q)D?.(m())},p=y=>it(y)?y(m()):e.implementations?.guards?.[y](m()),E=y=>{const S=it(y)?y(m()):y;if(!S)return;const Q=S.map(R=>{const T=e.implementations?.effects?.[R];return T||Bo(`[zag-js] No implementation found for effect "${JSON.stringify(R)}"`),T}),D=[];for(const R of Q){const T=R?.(m());T&&D.push(T)}return()=>D.forEach(R=>R?.())},B=y=>Tp(y).find(S=>{let Q=!S.guard;return Rn(S.guard)?Q=!!p(S.guard):it(S.guard)&&(Q=S.guard(m())),Q}),C=y=>{vc(e.computed,()=>"[zag-js] No computed object found on machine");const S=e.computed[y];return S({context:a,event:c.current,prop:o,refs:f,scope:n(),computed:C})},x=ns(()=>({defaultValue:e.initialState({prop:o}),onChange(y,S){S&&(l.current.get(S)?.(),l.current.delete(S)),S&&h(e.states[S]?.exit),h(u.current?.actions);const Q=E(e.states[y]?.effects);if(Q&&l.current.set(y,Q),S===$s){h(e.entry);const D=E(e.effects);D&&l.current.set($s,D)}h(e.states[y]?.entry)}}));let I=xn.NotStarted;dn(()=>{const y=I===xn.Started;I=xn.Started,r(y?"rehydrating...":"initializing..."),x.invoke(x.initial,$s)}),Te(()=>{r("unmounting..."),I=xn.Stopped,l.current.forEach(S=>S?.()),l.current=new Map,u.current=null,h(e.exit)});const w=y=>{queueMicrotask(()=>{if(I!==xn.Started)return;A.current=c.current,c.current=y;let S=De(()=>x.get());const Q=e.states[S].on?.[y.type]??e.on?.[y.type],D=B(Q);if(!D)return;u.current=D;const R=D.target??S;r("transition",y.type,D.target||S,`(${D.actions})`);const T=R!==S;T?x.set(R):D.reenter&&!T?x.invoke(S,S):h(D.actions)})};return e.watch?.(m()),{state:d(),send:w,context:a,prop:o,get scope(){return n()},refs:f,computed:C,event:g(),getStatus:()=>I}}function da(e){e()}function qs(e){return it(e)?e():e}function zE(e){return function(n){return e()[n]}}function ne(...e){const t={};for(let n=0;n<e.length;n++){let r=e[n];if(typeof r=="function"&&(r=r()),r){const s=Object.getOwnPropertyDescriptors(r);for(const o in s)o in t||Object.defineProperty(t,o,{enumerable:!0,get(){let i={};if(o==="style"||o==="class"||o==="className"||o.startsWith("on")){for(let a=0;a<e.length;a++){let l=e[a];typeof l=="function"&&(l=l()),i=YE(i,{[o]:(l||{})[o]})}return i[o]}for(let a=e.length-1;a>=0;a--){let l,u=e[a];if(typeof u=="function"&&(u=u()),l=(u||{})[o],l!==void 0)return l}}})}}return t}var fa={onFocus:"onFocusIn",onBlur:"onFocusOut",onDoubleClick:"onDblClick",onChange:"onInput",defaultChecked:"checked",defaultValue:"value",htmlFor:"for",className:"class"},$E=e=>e.startsWith("--")?e:tB(e);function jE(e){return e in fa?fa[e]:e}var qE=VE(e=>{const t={};for(const n in e){const r=e[n];if(!(n==="readOnly"&&r===!1)){if(n==="style"&&kr(r)){t.style=JE(r);continue}if(n==="children"){Rn(r)&&(t.textContent=r);continue}t[jE(n)]=r}}return t});function JE(e){let t={};for(const n in e){const r=e[n];!Rn(r)&&!Np(r)||(t[$E(n)]=r)}return t}var XE=/[A-Z]/g,ZE=/^ms-/;function eB(e){return"-"+e.toLowerCase()}var Js={};function tB(e){if(Js.hasOwnProperty(e))return Js[e];var t=e.replace(XE,eB);return Js[e]=ZE.test(t)?"-"+t:t}var Xs=e=>n=>{const[r,s]=An(n,["asChild"]);if(r.asChild){const o=i=>{const[,a]=An(s,["ref"]);return ne(a,i)};return r.asChild(o)}return v(tl,de({component:e},s))};function nB(){const e=new Map;return new Proxy(Xs,{apply(t,n,r){return Xs(r[0])},get(t,n){const r=n;return e.has(r)||e.set(r,Xs(r)),e.get(r)}})}var oe=nB(),rB=e=>typeof e=="function",No=(e,...t)=>rB(e)?e(...t):e;function sB(e,t){return`${e} returned \`undefined\`. Seems you forgot to wrap component within ${t}`}function wt(e={}){const{strict:t=!0,hookName:n="useContext",providerName:r="Provider",errorMessage:s,defaultValue:o}=e,i=as(o);function a(){const l=yo(i);if(!l&&t){const u=new Error(s??sB(n,r));throw u.name="ContextError",tr(Error,"captureStackTrace")&&it(Error.captureStackTrace)&&Error.captureStackTrace(u,a),u}return l}return[i.Provider,a,i]}var[Ow,Lo]=wt({hookName:"useEnvironmentContext",providerName:"<EnvironmentProvider />",strict:!1,defaultValue:()=>({getRootNode:()=>document,getDocument:()=>document,getWindow:()=>window})}),oB=Object.defineProperty,Yo=(e,t)=>{for(var n in t)oB(e,n,{get:t[n],enumerable:!0})},[Tc,pr]=wt({hookName:"useFieldsetContext",providerName:"<FieldsetProvider />",strict:!1}),iB=e=>e.children(pr()),aB=e=>{const t=pr(),n=ne(()=>t().getErrorTextProps(),e);return v(Z,{get when(){return t().invalid},get children(){return v(oe.span,n)}})},lB=e=>{const t=pr(),n=ne(()=>t().getHelperTextProps(),e);return v(oe.span,n)},cB=e=>{const t=pr(),n=ne(()=>t().getLegendProps(),e);return v(oe.legend,n)},AB=e=>{const t=Lo(),n=de({disabled:!1,invalid:!1},No(e)),[r,s]=K(void 0),o=n.id??ls(),i=`fieldset::${o}::legend`,a=`fieldset::${o}::error-text`,l=`fieldset::${o}::helper-text`,[u,A]=K(!1),[c,g]=K(!1);dn(()=>{const E=r();if(!E)return;const B=()=>{const I=t().getRootNode();A(!!I.getElementById(a)),g(!!I.getElementById(l))};B();const C=t().getWindow(),x=new C.MutationObserver(B);x.observe(E,{childList:!0,subtree:!0}),Te(()=>x.disconnect())});const d=_(()=>{const E=[];return u()&&n.invalid&&E.push(a),c()&&E.push(l),E}),f=()=>({...br.root.attrs,disabled:n.disabled,"data-disabled":q(n.disabled),"data-invalid":q(n.invalid),"aria-labelledby":i,"aria-describedby":d().join(" ")||void 0}),m=()=>({id:i,...br.legend.attrs,"data-disabled":q(n.disabled),"data-invalid":q(n.invalid)}),h=()=>({id:l,...br.helperText.attrs}),p=()=>({id:a,...br.errorText.attrs,"aria-live":"polite"});return _(()=>({refs:{rootRef:s},ids:{legend:i,errorText:a,helperText:l},disabled:n.disabled,invalid:n.invalid,getRootProps:f,getLegendProps:m,getHelperTextProps:h,getErrorTextProps:p}))},Rc=e=>{const[t,n]=gt()(e,["id","disabled","invalid"]),r=AB(t),s=ne(()=>r().getRootProps(),n);return v(Tc,{value:r,get children(){return v(oe.fieldset,de(s,{ref(o){var i=ds(r().refs.rootRef,e.ref);typeof i=="function"&&i(o)}}))}})};Rc.displayName="FieldsetRoot";var uB=e=>{const[{value:t},n]=gt()(e,["value"]),r=ne(()=>t().getRootProps(),n);return v(Tc,{value:t,get children(){return v(oe.fieldset,r)}})},gB={};Yo(gB,{Context:()=>iB,ErrorText:()=>aB,HelperText:()=>lB,Legend:()=>cB,Root:()=>Rc,RootProvider:()=>uB});var dB=an("field").parts("root","errorText","helperText","input","label","select","textarea","requiredIndicator"),Gt=dB.build(),fB=e=>{if(!e)return;const t=ko(e),n=Pt(e),r=qt(e),s=()=>{requestAnimationFrame(()=>{e.style.height="auto";let u;t.boxSizing==="content-box"?u=e.scrollHeight-(parseFloat(t.paddingTop)+parseFloat(t.paddingBottom)):u=e.scrollHeight+parseFloat(t.borderTopWidth)+parseFloat(t.borderBottomWidth),t.maxHeight!=="none"&&u>parseFloat(t.maxHeight)?(t.overflowY==="hidden"&&(e.style.overflowY="scroll"),u=parseFloat(t.maxHeight)):t.overflowY!=="hidden"&&(e.style.overflowY="hidden"),e.style.height=`${u}px`})};e.addEventListener("input",s),e.form?.addEventListener("reset",s);const o=Object.getPrototypeOf(e),i=Object.getOwnPropertyDescriptor(o,"value");Object.defineProperty(e,"value",{...i,set(){i?.set?.apply(this,arguments),s()}});const a=new n.ResizeObserver(()=>{requestAnimationFrame(()=>s())});a.observe(e);const l=new n.MutationObserver(()=>s());return l.observe(e,{attributes:!0,attributeFilter:["rows","placeholder"]}),r.fonts?.addEventListener("loadingdone",s),()=>{e.removeEventListener("input",s),e.form?.removeEventListener("reset",s),r.fonts?.removeEventListener("loadingdone",s),a.disconnect(),l.disconnect()}},[Fc,Ct]=wt({hookName:"useFieldContext",providerName:"<FieldProvider />",strict:!1}),hB=e=>e.children(Ct()),mB=e=>{const t=Ct(),n=ne(()=>t().getErrorTextProps(),e);return v(Z,{get when(){return t?.().invalid},get children(){return v(oe.span,n)}})},pB=e=>{const t=Ct(),n=ne(()=>t().getHelperTextProps(),e);return v(oe.span,n)},EB=e=>{const t=Ct(),n=ne(()=>t?.().getInputProps(),e);return v(oe.input,n)},BB=e=>{const t=Ct(),n=ne(()=>t?.().getLabelProps(),e);return v(oe.label,n)},IB=e=>{const t=Ct(),n=ne(()=>t().getRequiredIndicatorProps(),e);return v(Z,{get when(){return t().required},get fallback(){return e.fallback},get children(){return v(oe.span,de(n,{get children(){return e.children??"*"}}))}})},vB=e=>{const t=pr(),n=Lo(),r=de({disabled:!!t?.().disabled,required:!1,invalid:!1,readOnly:!1},e),[s,o]=K(!1),[i,a]=K(!1),l=r.id??ls(),[u,A]=K(void 0),c=r.ids?.control??`field::${l}`,g=r.ids?.errorText??`field::${l}::error-text`,d=r.ids?.helperText??`field::${l}::helper-text`,f=r.ids?.label??`field::${l}::label`;dn(()=>{const S=u();if(!S)return;const Q=()=>{const T=n().getRootNode();o(!!T.getElementById(g)),a(!!T.getElementById(d))};Q();const D=n().getWindow(),R=new D.MutationObserver(Q);R.observe(S,{childList:!0,subtree:!0}),Te(()=>R.disconnect())});const m=()=>({...Gt.root.attrs,id:c,role:"group","data-disabled":q(r.disabled),"data-invalid":q(r.invalid),"data-readonly":q(r.readOnly)}),h=()=>({...Gt.label.attrs,id:f,"data-disabled":q(r.disabled),"data-invalid":q(r.invalid),"data-readonly":q(r.readOnly),"data-required":q(r.required),htmlFor:l}),p=_(()=>{const S=[];return s()&&r.invalid&&S.push(g),i()&&S.push(d),S}),E=()=>({"aria-describedby":p().join(" ")||void 0,"aria-invalid":_r(r.invalid),"data-invalid":q(r.invalid),"data-required":q(r.required),"data-readonly":q(r.readOnly),id:l,required:r.required,disabled:r.disabled,readOnly:r.readOnly||void 0}),B=()=>({...E(),...Gt.input.attrs}),C=()=>({...E(),...Gt.textarea.attrs}),x=()=>({...E(),...Gt.select.attrs}),I=()=>({id:d,...Gt.helperText.attrs,"data-disabled":q(r.disabled)}),w=()=>({id:g,...Gt.errorText.attrs,"aria-live":"polite"}),y=()=>({"aria-hidden":!0,...Gt.requiredIndicator.attrs});return _(()=>({ariaDescribedby:p().join(" "),ids:{control:l,label:f,errorText:g,helperText:d},refs:{rootRef:A},disabled:r.disabled,invalid:r.invalid,readOnly:r.readOnly,required:r.required,getLabelProps:h,getRootProps:m,getInputProps:B,getTextareaProps:C,getSelectProps:x,getHelperTextProps:I,getErrorTextProps:w,getRequiredIndicatorProps:y}))},wB=e=>{const[t,n]=gt()(e,["id","ids","disabled","invalid","readOnly","required"]),r=vB(t),s=ne(()=>r().getRootProps(),n);return v(Fc,{value:r,get children(){return v(oe.div,de(s,{ref(o){var i=ds(r().refs.rootRef,e.ref);typeof i=="function"&&i(o)}}))}})},CB=e=>{const[{value:t},n]=gt()(e,["value"]),r=ne(()=>t().getRootProps(),n);return v(Fc,{value:t,get children(){return v(oe.div,r)}})},yB=e=>{const t=Ct(),n=ne(()=>t?.().getSelectProps(),e);return v(oe.select,n)},xB=e=>{const t=Ct();let n;const[r,s]=An(e,["autoresize"]),o=ne(()=>t?.().getTextareaProps(),()=>({style:{resize:r.autoresize?"none":void 0}}),s);return dn(()=>{if(!r.autoresize)return;const i=fB(n);Te(()=>i?.())}),v(oe.textarea,de(o,{ref(i){var a=ds(l=>n=l,e.ref);typeof a=="function"&&a(i)}}))},bB={};Yo(bB,{Context:()=>hB,ErrorText:()=>mB,HelperText:()=>pB,Input:()=>EB,Label:()=>BB,RequiredIndicator:()=>IB,Root:()=>wB,RootProvider:()=>CB,Select:()=>yB,Textarea:()=>xB});var SB=Object.defineProperty,DB=(e,t,n)=>t in e?SB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,W=(e,t,n)=>DB(e,typeof t!="symbol"?t+"":t,n),Lr={itemToValue(e){return typeof e=="string"?e:kr(e)&&tr(e,"value")?e.value:""},itemToString(e){return typeof e=="string"?e:kr(e)&&tr(e,"label")?e.label:Lr.itemToValue(e)},isItemDisabled(e){return kr(e)&&tr(e,"disabled")?!!e.disabled:!1}},Go=class Pc{constructor(t){this.options=t,W(this,"items"),W(this,"indexMap",null),W(this,"copy",n=>new Pc({...this.options,items:n??[...this.items]})),W(this,"isEqual",n=>hr(this.items,n.items)),W(this,"setItems",n=>this.copy(n)),W(this,"getValues",(n=this.items)=>{const r=[];for(const s of n){const o=this.getItemValue(s);o!=null&&r.push(o)}return r}),W(this,"find",n=>{if(n==null)return null;const r=this.indexOf(n);return r!==-1?this.at(r):null}),W(this,"findMany",n=>{const r=[];for(const s of n){const o=this.find(s);o!=null&&r.push(o)}return r}),W(this,"at",n=>{if(!this.options.groupBy&&!this.options.groupSort)return this.items[n]??null;let r=0;const s=this.group();for(const[,o]of s)for(const i of o){if(r===n)return i;r++}return null}),W(this,"sortFn",(n,r)=>{const s=this.indexOf(n),o=this.indexOf(r);return(s??0)-(o??0)}),W(this,"sort",n=>[...n].sort(this.sortFn.bind(this))),W(this,"getItemValue",n=>n==null?null:this.options.itemToValue?.(n)??Lr.itemToValue(n)),W(this,"getItemDisabled",n=>n==null?!1:this.options.isItemDisabled?.(n)??Lr.isItemDisabled(n)),W(this,"stringifyItem",n=>n==null?null:this.options.itemToString?.(n)??Lr.itemToString(n)),W(this,"stringify",n=>n==null?null:this.stringifyItem(this.find(n))),W(this,"stringifyItems",(n,r=", ")=>{const s=[];for(const o of n){const i=this.stringifyItem(o);i!=null&&s.push(i)}return s.join(r)}),W(this,"stringifyMany",(n,r)=>this.stringifyItems(this.findMany(n),r)),W(this,"has",n=>this.indexOf(n)!==-1),W(this,"hasItem",n=>n==null?!1:this.has(this.getItemValue(n))),W(this,"group",()=>{const{groupBy:n,groupSort:r}=this.options;if(!n)return[["",[...this.items]]];const s=new Map;this.items.forEach((i,a)=>{const l=n(i,a);s.has(l)||s.set(l,[]),s.get(l).push(i)});let o=Array.from(s.entries());return r&&o.sort(([i],[a])=>{if(typeof r=="function")return r(i,a);if(Array.isArray(r)){const l=r.indexOf(i),u=r.indexOf(a);return l===-1?1:u===-1?-1:l-u}return r==="asc"?i.localeCompare(a):r==="desc"?a.localeCompare(i):0}),o}),W(this,"getNextValue",(n,r=1,s=!1)=>{let o=this.indexOf(n);if(o===-1)return null;for(o=s?Math.min(o+r,this.size-1):o+r;o<=this.size&&this.getItemDisabled(this.at(o));)o++;return this.getItemValue(this.at(o))}),W(this,"getPreviousValue",(n,r=1,s=!1)=>{let o=this.indexOf(n);if(o===-1)return null;for(o=s?Math.max(o-r,0):o-r;o>=0&&this.getItemDisabled(this.at(o));)o--;return this.getItemValue(this.at(o))}),W(this,"indexOf",n=>{if(n==null)return-1;if(!this.options.groupBy&&!this.options.groupSort)return this.items.findIndex(r=>this.getItemValue(r)===n);if(!this.indexMap){this.indexMap=new Map;let r=0;const s=this.group();for(const[,o]of s)for(const i of o){const a=this.getItemValue(i);a!=null&&this.indexMap.set(a,r),r++}}return this.indexMap.get(n)??-1}),W(this,"getByText",(n,r)=>{const s=r!=null?this.indexOf(r):-1,o=n.length===1;for(let i=0;i<this.items.length;i++){const a=this.items[(s+i+1)%this.items.length];if(!(o&&this.getItemValue(a)===r)&&!this.getItemDisabled(a)&&QB(this.stringifyItem(a),n))return a}}),W(this,"search",(n,r)=>{const{state:s,currentValue:o,timeout:i=350}=r,a=s.keysSoFar+n,u=a.length>1&&Array.from(a).every(f=>f===a[0])?a[0]:a,A=this.getByText(u,o),c=this.getItemValue(A);function g(){clearTimeout(s.timer),s.timer=-1}function d(f){s.keysSoFar=f,g(),f!==""&&(s.timer=+setTimeout(()=>{d(""),g()},i))}return d(a),c}),W(this,"update",(n,r)=>{let s=this.indexOf(n);return s===-1?this:this.copy([...this.items.slice(0,s),r,...this.items.slice(s+1)])}),W(this,"upsert",(n,r,s="append")=>{let o=this.indexOf(n);return o===-1?(s==="append"?this.append:this.prepend)(r):this.copy([...this.items.slice(0,o),r,...this.items.slice(o+1)])}),W(this,"insert",(n,...r)=>this.copy($n(this.items,n,...r))),W(this,"insertBefore",(n,...r)=>{let s=this.indexOf(n);if(s===-1)if(this.items.length===0)s=0;else return this;return this.copy($n(this.items,s,...r))}),W(this,"insertAfter",(n,...r)=>{let s=this.indexOf(n);if(s===-1)if(this.items.length===0)s=0;else return this;return this.copy($n(this.items,s+1,...r))}),W(this,"prepend",(...n)=>this.copy($n(this.items,0,...n))),W(this,"append",(...n)=>this.copy($n(this.items,this.items.length,...n))),W(this,"filter",n=>{const r=this.items.filter((s,o)=>n(this.stringifyItem(s),o,s));return this.copy(r)}),W(this,"remove",(...n)=>{const r=n.map(s=>typeof s=="string"?s:this.getItemValue(s));return this.copy(this.items.filter(s=>{const o=this.getItemValue(s);return o==null?!1:!r.includes(o)}))}),W(this,"move",(n,r)=>{const s=this.indexOf(n);return s===-1?this:this.copy(Dr(this.items,[s],r))}),W(this,"moveBefore",(n,...r)=>{let s=this.items.findIndex(i=>this.getItemValue(i)===n);if(s===-1)return this;let o=r.map(i=>this.items.findIndex(a=>this.getItemValue(a)===i)).sort((i,a)=>i-a);return this.copy(Dr(this.items,o,s))}),W(this,"moveAfter",(n,...r)=>{let s=this.items.findIndex(i=>this.getItemValue(i)===n);if(s===-1)return this;let o=r.map(i=>this.items.findIndex(a=>this.getItemValue(a)===i)).sort((i,a)=>i-a);return this.copy(Dr(this.items,o,s+1))}),W(this,"reorder",(n,r)=>this.copy(Dr(this.items,[n],r))),W(this,"compareValue",(n,r)=>{const s=this.indexOf(n),o=this.indexOf(r);return s<o?-1:s>o?1:0}),W(this,"range",(n,r)=>{let s=[],o=n;for(;o!=null;){if(this.find(o)&&s.push(o),o===r)return s;o=this.getNextValue(o)}return[]}),W(this,"getValueRange",(n,r)=>n&&r?this.compareValue(n,r)<=0?this.range(n,r):this.range(r,n):[]),W(this,"toString",()=>{let n="";for(const r of this.items){const s=this.getItemValue(r),o=this.stringifyItem(r),i=this.getItemDisabled(r),a=[s,o,i].filter(Boolean).join(":");n+=a+","}return n}),W(this,"toJSON",()=>({size:this.size,first:this.firstValue,last:this.lastValue})),this.items=[...t.items]}get size(){return this.items.length}get firstValue(){let t=0;for(;this.getItemDisabled(this.at(t));)t++;return this.getItemValue(this.at(t))}get lastValue(){let t=this.size-1;for(;this.getItemDisabled(this.at(t));)t--;return this.getItemValue(this.at(t))}*[Symbol.iterator](){yield*this.items}},QB=(e,t)=>!!e?.toLowerCase().startsWith(t.toLowerCase());function $n(e,t,...n){return[...e.slice(0,t),...n,...e.slice(t)]}function Dr(e,t,n){t=[...t].sort((s,o)=>s-o);const r=t.map(s=>e[s]);for(let s=t.length-1;s>=0;s--)e=[...e.slice(0,t[s]),...e.slice(t[s]+1)];return n=Math.max(0,n-t.filter(s=>s<n).length),[...e.slice(0,n),...r,...e.slice(n)]}const OB=["top","right","bottom","left"],zt=Math.min,Je=Math.max,rs=Math.round,Qr=Math.floor,pt=e=>({x:e,y:e}),MB={left:"right",right:"left",bottom:"top",top:"bottom"},TB={start:"end",end:"start"};function vo(e,t,n){return Je(e,zt(t,n))}function Rt(e,t){return typeof e=="function"?e(t):e}function Ft(e){return e.split("-")[0]}function Vn(e){return e.split("-")[1]}function Ho(e){return e==="x"?"y":"x"}function Uo(e){return e==="y"?"height":"width"}const RB=new Set(["top","bottom"]);function ft(e){return RB.has(Ft(e))?"y":"x"}function Vo(e){return Ho(ft(e))}function FB(e,t,n){n===void 0&&(n=!1);const r=Vn(e),s=Vo(e),o=Uo(s);let i=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=ss(i)),[i,ss(i)]}function PB(e){const t=ss(e);return[wo(e),t,wo(t)]}function wo(e){return e.replace(/start|end/g,t=>TB[t])}const ha=["left","right"],ma=["right","left"],kB=["top","bottom"],_B=["bottom","top"];function NB(e,t,n){switch(e){case"top":case"bottom":return n?t?ma:ha:t?ha:ma;case"left":case"right":return t?kB:_B;default:return[]}}function LB(e,t,n,r){const s=Vn(e);let o=NB(Ft(e),n==="start",r);return s&&(o=o.map(i=>i+"-"+s),t&&(o=o.concat(o.map(wo)))),o}function ss(e){return e.replace(/left|right|bottom|top/g,t=>MB[t])}function YB(e){return{top:0,right:0,bottom:0,left:0,...e}}function kc(e){return typeof e!="number"?YB(e):{top:e,right:e,bottom:e,left:e}}function os(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function pa(e,t,n){let{reference:r,floating:s}=e;const o=ft(t),i=Vo(t),a=Uo(i),l=Ft(t),u=o==="y",A=r.x+r.width/2-s.width/2,c=r.y+r.height/2-s.height/2,g=r[a]/2-s[a]/2;let d;switch(l){case"top":d={x:A,y:r.y-s.height};break;case"bottom":d={x:A,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:c};break;case"left":d={x:r.x-s.width,y:c};break;default:d={x:r.x,y:r.y}}switch(Vn(t)){case"start":d[i]-=g*(n&&u?-1:1);break;case"end":d[i]+=g*(n&&u?-1:1);break}return d}const GB=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:i}=n,a=o.filter(Boolean),l=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:A,y:c}=pa(u,r,l),g=r,d={},f=0;for(let m=0;m<a.length;m++){const{name:h,fn:p}=a[m],{x:E,y:B,data:C,reset:x}=await p({x:A,y:c,initialPlacement:r,placement:g,strategy:s,middlewareData:d,rects:u,platform:i,elements:{reference:e,floating:t}});A=E??A,c=B??c,d={...d,[h]:{...d[h],...C}},x&&f<=50&&(f++,typeof x=="object"&&(x.placement&&(g=x.placement),x.rects&&(u=x.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):x.rects),{x:A,y:c}=pa(u,g,l)),m=-1)}return{x:A,y:c,placement:g,strategy:s,middlewareData:d}};async function cr(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:i,elements:a,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:A="viewport",elementContext:c="floating",altBoundary:g=!1,padding:d=0}=Rt(t,e),f=kc(d),h=a[g?c==="floating"?"reference":"floating":c],p=os(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(h)))==null||n?h:h.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:u,rootBoundary:A,strategy:l})),E=c==="floating"?{x:r,y:s,width:i.floating.width,height:i.floating.height}:i.reference,B=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),C=await(o.isElement==null?void 0:o.isElement(B))?await(o.getScale==null?void 0:o.getScale(B))||{x:1,y:1}:{x:1,y:1},x=os(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:E,offsetParent:B,strategy:l}):E);return{top:(p.top-x.top+f.top)/C.y,bottom:(x.bottom-p.bottom+f.bottom)/C.y,left:(p.left-x.left+f.left)/C.x,right:(x.right-p.right+f.right)/C.x}}const HB=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:o,platform:i,elements:a,middlewareData:l}=t,{element:u,padding:A=0}=Rt(e,t)||{};if(u==null)return{};const c=kc(A),g={x:n,y:r},d=Vo(s),f=Uo(d),m=await i.getDimensions(u),h=d==="y",p=h?"top":"left",E=h?"bottom":"right",B=h?"clientHeight":"clientWidth",C=o.reference[f]+o.reference[d]-g[d]-o.floating[f],x=g[d]-o.reference[d],I=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let w=I?I[B]:0;(!w||!await(i.isElement==null?void 0:i.isElement(I)))&&(w=a.floating[B]||o.floating[f]);const y=C/2-x/2,S=w/2-m[f]/2-1,Q=zt(c[p],S),D=zt(c[E],S),R=Q,T=w-m[f]-D,G=w/2-m[f]/2+y,re=vo(R,G,T),ue=!l.arrow&&Vn(s)!=null&&G!==re&&o.reference[f]/2-(G<R?Q:D)-m[f]/2<0,ie=ue?G<R?G-R:G-T:0;return{[d]:g[d]+ie,data:{[d]:re,centerOffset:G-re-ie,...ue&&{alignmentOffset:ie}},reset:ue}}}),UB=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:i,initialPlacement:a,platform:l,elements:u}=t,{mainAxis:A=!0,crossAxis:c=!0,fallbackPlacements:g,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:m=!0,...h}=Rt(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const p=Ft(s),E=ft(a),B=Ft(a)===a,C=await(l.isRTL==null?void 0:l.isRTL(u.floating)),x=g||(B||!m?[ss(a)]:PB(a)),I=f!=="none";!g&&I&&x.push(...LB(a,m,f,C));const w=[a,...x],y=await cr(t,h),S=[];let Q=((r=o.flip)==null?void 0:r.overflows)||[];if(A&&S.push(y[p]),c){const G=FB(s,i,C);S.push(y[G[0]],y[G[1]])}if(Q=[...Q,{placement:s,overflows:S}],!S.every(G=>G<=0)){var D,R;const G=(((D=o.flip)==null?void 0:D.index)||0)+1,re=w[G];if(re&&(!(c==="alignment"?E!==ft(re):!1)||Q.every(Ce=>ft(Ce.placement)===E?Ce.overflows[0]>0:!0)))return{data:{index:G,overflows:Q},reset:{placement:re}};let ue=(R=Q.filter(ie=>ie.overflows[0]<=0).sort((ie,Ce)=>ie.overflows[1]-Ce.overflows[1])[0])==null?void 0:R.placement;if(!ue)switch(d){case"bestFit":{var T;const ie=(T=Q.filter(Ce=>{if(I){const fe=ft(Ce.placement);return fe===E||fe==="y"}return!0}).map(Ce=>[Ce.placement,Ce.overflows.filter(fe=>fe>0).reduce((fe,He)=>fe+He,0)]).sort((Ce,fe)=>Ce[1]-fe[1])[0])==null?void 0:T[0];ie&&(ue=ie);break}case"initialPlacement":ue=a;break}if(s!==ue)return{reset:{placement:ue}}}return{}}}};function Ea(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ba(e){return OB.some(t=>e[t]>=0)}const VB=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...s}=Rt(e,t);switch(r){case"referenceHidden":{const o=await cr(t,{...s,elementContext:"reference"}),i=Ea(o,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Ba(i)}}}case"escaped":{const o=await cr(t,{...s,altBoundary:!0}),i=Ea(o,n.floating);return{data:{escapedOffsets:i,escaped:Ba(i)}}}default:return{}}}}},_c=new Set(["left","top"]);async function KB(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),i=Ft(n),a=Vn(n),l=ft(n)==="y",u=_c.has(i)?-1:1,A=o&&l?-1:1,c=Rt(t,e);let{mainAxis:g,crossAxis:d,alignmentAxis:f}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return a&&typeof f=="number"&&(d=a==="end"?f*-1:f),l?{x:d*A,y:g*u}:{x:g*u,y:d*A}}const WB=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:i,middlewareData:a}=t,l=await KB(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+l.x,y:o+l.y,data:{...l,placement:i}}}}},zB=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s}=t,{mainAxis:o=!0,crossAxis:i=!1,limiter:a={fn:h=>{let{x:p,y:E}=h;return{x:p,y:E}}},...l}=Rt(e,t),u={x:n,y:r},A=await cr(t,l),c=ft(Ft(s)),g=Ho(c);let d=u[g],f=u[c];if(o){const h=g==="y"?"top":"left",p=g==="y"?"bottom":"right",E=d+A[h],B=d-A[p];d=vo(E,d,B)}if(i){const h=c==="y"?"top":"left",p=c==="y"?"bottom":"right",E=f+A[h],B=f-A[p];f=vo(E,f,B)}const m=a.fn({...t,[g]:d,[c]:f});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[g]:o,[c]:i}}}}}},$B=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:o,middlewareData:i}=t,{offset:a=0,mainAxis:l=!0,crossAxis:u=!0}=Rt(e,t),A={x:n,y:r},c=ft(s),g=Ho(c);let d=A[g],f=A[c];const m=Rt(a,t),h=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const B=g==="y"?"height":"width",C=o.reference[g]-o.floating[B]+h.mainAxis,x=o.reference[g]+o.reference[B]-h.mainAxis;d<C?d=C:d>x&&(d=x)}if(u){var p,E;const B=g==="y"?"width":"height",C=_c.has(Ft(s)),x=o.reference[c]-o.floating[B]+(C&&((p=i.offset)==null?void 0:p[c])||0)+(C?0:h.crossAxis),I=o.reference[c]+o.reference[B]+(C?0:((E=i.offset)==null?void 0:E[c])||0)-(C?h.crossAxis:0);f<x?f=x:f>I&&(f=I)}return{[g]:d,[c]:f}}}},jB=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:o,platform:i,elements:a}=t,{apply:l=()=>{},...u}=Rt(e,t),A=await cr(t,u),c=Ft(s),g=Vn(s),d=ft(s)==="y",{width:f,height:m}=o.floating;let h,p;c==="top"||c==="bottom"?(h=c,p=g===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(p=c,h=g==="end"?"top":"bottom");const E=m-A.top-A.bottom,B=f-A.left-A.right,C=zt(m-A[h],E),x=zt(f-A[p],B),I=!t.middlewareData.shift;let w=C,y=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(y=B),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(w=E),I&&!g){const Q=Je(A.left,0),D=Je(A.right,0),R=Je(A.top,0),T=Je(A.bottom,0);d?y=f-2*(Q!==0||D!==0?Q+D:Je(A.left,A.right)):w=m-2*(R!==0||T!==0?R+T:Je(A.top,A.bottom))}await l({...t,availableWidth:y,availableHeight:w});const S=await i.getDimensions(a.floating);return f!==S.width||m!==S.height?{reset:{rects:!0}}:{}}}};function hs(){return typeof window<"u"}function Kn(e){return Nc(e)?(e.nodeName||"").toLowerCase():"#document"}function Xe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function yt(e){var t;return(t=(Nc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Nc(e){return hs()?e instanceof Node||e instanceof Xe(e).Node:!1}function At(e){return hs()?e instanceof Element||e instanceof Xe(e).Element:!1}function Et(e){return hs()?e instanceof HTMLElement||e instanceof Xe(e).HTMLElement:!1}function Ia(e){return!hs()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Xe(e).ShadowRoot}const qB=new Set(["inline","contents"]);function Er(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=ut(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!qB.has(s)}const JB=new Set(["table","td","th"]);function XB(e){return JB.has(Kn(e))}const ZB=[":popover-open",":modal"];function ms(e){return ZB.some(t=>{try{return e.matches(t)}catch{return!1}})}const eI=["transform","translate","scale","rotate","perspective"],tI=["transform","translate","scale","rotate","perspective","filter"],nI=["paint","layout","strict","content"];function Ko(e){const t=Wo(),n=At(e)?ut(e):e;return eI.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||tI.some(r=>(n.willChange||"").includes(r))||nI.some(r=>(n.contain||"").includes(r))}function rI(e){let t=$t(e);for(;Et(t)&&!Gn(t);){if(Ko(t))return t;if(ms(t))return null;t=$t(t)}return null}function Wo(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const sI=new Set(["html","body","#document"]);function Gn(e){return sI.has(Kn(e))}function ut(e){return Xe(e).getComputedStyle(e)}function ps(e){return At(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function $t(e){if(Kn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ia(e)&&e.host||yt(e);return Ia(t)?t.host:t}function Lc(e){const t=$t(e);return Gn(t)?e.ownerDocument?e.ownerDocument.body:e.body:Et(t)&&Er(t)?t:Lc(t)}function Ar(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=Lc(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),i=Xe(s);if(o){const a=Co(i);return t.concat(i,i.visualViewport||[],Er(s)?s:[],a&&n?Ar(a):[])}return t.concat(s,Ar(s,[],n))}function Co(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Yc(e){const t=ut(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Et(e),o=s?e.offsetWidth:n,i=s?e.offsetHeight:r,a=rs(n)!==o||rs(r)!==i;return a&&(n=o,r=i),{width:n,height:r,$:a}}function zo(e){return At(e)?e:e.contextElement}function Fn(e){const t=zo(e);if(!Et(t))return pt(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=Yc(t);let i=(o?rs(n.width):n.width)/r,a=(o?rs(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const oI=pt(0);function Gc(e){const t=Xe(e);return!Wo()||!t.visualViewport?oI:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function iI(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Xe(e)?!1:t}function gn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=zo(e);let i=pt(1);t&&(r?At(r)&&(i=Fn(r)):i=Fn(e));const a=iI(o,n,r)?Gc(o):pt(0);let l=(s.left+a.x)/i.x,u=(s.top+a.y)/i.y,A=s.width/i.x,c=s.height/i.y;if(o){const g=Xe(o),d=r&&At(r)?Xe(r):r;let f=g,m=Co(f);for(;m&&r&&d!==f;){const h=Fn(m),p=m.getBoundingClientRect(),E=ut(m),B=p.left+(m.clientLeft+parseFloat(E.paddingLeft))*h.x,C=p.top+(m.clientTop+parseFloat(E.paddingTop))*h.y;l*=h.x,u*=h.y,A*=h.x,c*=h.y,l+=B,u+=C,f=Xe(m),m=Co(f)}}return os({width:A,height:c,x:l,y:u})}function Es(e,t){const n=ps(e).scrollLeft;return t?t.left+n:gn(yt(e)).left+n}function Hc(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Es(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function aI(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",i=yt(r),a=t?ms(t.floating):!1;if(r===i||a&&o)return n;let l={scrollLeft:0,scrollTop:0},u=pt(1);const A=pt(0),c=Et(r);if((c||!c&&!o)&&((Kn(r)!=="body"||Er(i))&&(l=ps(r)),Et(r))){const d=gn(r);u=Fn(r),A.x=d.x+r.clientLeft,A.y=d.y+r.clientTop}const g=i&&!c&&!o?Hc(i,l):pt(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+A.x+g.x,y:n.y*u.y-l.scrollTop*u.y+A.y+g.y}}function lI(e){return Array.from(e.getClientRects())}function cI(e){const t=yt(e),n=ps(e),r=e.ownerDocument.body,s=Je(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Je(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Es(e);const a=-n.scrollTop;return ut(r).direction==="rtl"&&(i+=Je(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:i,y:a}}const va=25;function AI(e,t){const n=Xe(e),r=yt(e),s=n.visualViewport;let o=r.clientWidth,i=r.clientHeight,a=0,l=0;if(s){o=s.width,i=s.height;const A=Wo();(!A||A&&t==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}const u=Es(r);if(u<=0){const A=r.ownerDocument,c=A.body,g=getComputedStyle(c),d=A.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,f=Math.abs(r.clientWidth-c.clientWidth-d);f<=va&&(o-=f)}else u<=va&&(o+=u);return{width:o,height:i,x:a,y:l}}const uI=new Set(["absolute","fixed"]);function gI(e,t){const n=gn(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=Et(e)?Fn(e):pt(1),i=e.clientWidth*o.x,a=e.clientHeight*o.y,l=s*o.x,u=r*o.y;return{width:i,height:a,x:l,y:u}}function wa(e,t,n){let r;if(t==="viewport")r=AI(e,n);else if(t==="document")r=cI(yt(e));else if(At(t))r=gI(t,n);else{const s=Gc(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return os(r)}function Uc(e,t){const n=$t(e);return n===t||!At(n)||Gn(n)?!1:ut(n).position==="fixed"||Uc(n,t)}function dI(e,t){const n=t.get(e);if(n)return n;let r=Ar(e,[],!1).filter(a=>At(a)&&Kn(a)!=="body"),s=null;const o=ut(e).position==="fixed";let i=o?$t(e):e;for(;At(i)&&!Gn(i);){const a=ut(i),l=Ko(i);!l&&a.position==="fixed"&&(s=null),(o?!l&&!s:!l&&a.position==="static"&&!!s&&uI.has(s.position)||Er(i)&&!l&&Uc(e,i))?r=r.filter(A=>A!==i):s=a,i=$t(i)}return t.set(e,r),r}function fI(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const i=[...n==="clippingAncestors"?ms(t)?[]:dI(t,this._c):[].concat(n),r],a=i[0],l=i.reduce((u,A)=>{const c=wa(t,A,s);return u.top=Je(c.top,u.top),u.right=zt(c.right,u.right),u.bottom=zt(c.bottom,u.bottom),u.left=Je(c.left,u.left),u},wa(t,a,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function hI(e){const{width:t,height:n}=Yc(e);return{width:t,height:n}}function mI(e,t,n){const r=Et(t),s=yt(t),o=n==="fixed",i=gn(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=pt(0);function u(){l.x=Es(s)}if(r||!r&&!o)if((Kn(t)!=="body"||Er(s))&&(a=ps(t)),r){const d=gn(t,!0,o,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}else s&&u();o&&!r&&s&&u();const A=s&&!r&&!o?Hc(s,a):pt(0),c=i.left+a.scrollLeft-l.x-A.x,g=i.top+a.scrollTop-l.y-A.y;return{x:c,y:g,width:i.width,height:i.height}}function Zs(e){return ut(e).position==="static"}function Ca(e,t){if(!Et(e)||ut(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return yt(e)===n&&(n=n.ownerDocument.body),n}function Vc(e,t){const n=Xe(e);if(ms(e))return n;if(!Et(e)){let s=$t(e);for(;s&&!Gn(s);){if(At(s)&&!Zs(s))return s;s=$t(s)}return n}let r=Ca(e,t);for(;r&&XB(r)&&Zs(r);)r=Ca(r,t);return r&&Gn(r)&&Zs(r)&&!Ko(r)?n:r||rI(e)||n}const pI=async function(e){const t=this.getOffsetParent||Vc,n=this.getDimensions,r=await n(e.floating);return{reference:mI(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function EI(e){return ut(e).direction==="rtl"}const BI={convertOffsetParentRelativeRectToViewportRelativeRect:aI,getDocumentElement:yt,getClippingRect:fI,getOffsetParent:Vc,getElementRects:pI,getClientRects:lI,getDimensions:hI,getScale:Fn,isElement:At,isRTL:EI};function Kc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function II(e,t){let n=null,r;const s=yt(e);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const u=e.getBoundingClientRect(),{left:A,top:c,width:g,height:d}=u;if(a||t(),!g||!d)return;const f=Qr(c),m=Qr(s.clientWidth-(A+g)),h=Qr(s.clientHeight-(c+d)),p=Qr(A),B={rootMargin:-f+"px "+-m+"px "+-h+"px "+-p+"px",threshold:Je(0,zt(1,l))||1};let C=!0;function x(I){const w=I[0].intersectionRatio;if(w!==l){if(!C)return i();w?i(!1,w):r=setTimeout(()=>{i(!1,1e-7)},1e3)}w===1&&!Kc(u,e.getBoundingClientRect())&&i(),C=!1}try{n=new IntersectionObserver(x,{...B,root:s.ownerDocument})}catch{n=new IntersectionObserver(x,B)}n.observe(e)}return i(!0),o}function vI(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=zo(e),A=s||o?[...u?Ar(u):[],...Ar(t)]:[];A.forEach(p=>{s&&p.addEventListener("scroll",n,{passive:!0}),o&&p.addEventListener("resize",n)});const c=u&&a?II(u,n):null;let g=-1,d=null;i&&(d=new ResizeObserver(p=>{let[E]=p;E&&E.target===u&&d&&(d.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var B;(B=d)==null||B.observe(t)})),n()}),u&&!l&&d.observe(u),d.observe(t));let f,m=l?gn(e):null;l&&h();function h(){const p=gn(e);m&&!Kc(m,p)&&n(),m=p,f=requestAnimationFrame(h)}return n(),()=>{var p;A.forEach(E=>{s&&E.removeEventListener("scroll",n),o&&E.removeEventListener("resize",n)}),c?.(),(p=d)==null||p.disconnect(),d=null,l&&cancelAnimationFrame(f)}}const wI=WB,CI=zB,yI=UB,xI=jB,bI=VB,SI=HB,DI=$B,QI=(e,t,n)=>{const r=new Map,s={platform:BI,...n},o={...s.platform,_c:r};return GB(e,t,{...s,platform:o})};function ya(e=0,t=0,n=0,r=0){if(typeof DOMRect=="function")return new DOMRect(e,t,n,r);const s={x:e,y:t,width:n,height:r,top:t,right:e+n,bottom:t+r,left:e};return{...s,toJSON:()=>s}}function OI(e){if(!e)return ya();const{x:t,y:n,width:r,height:s}=e;return ya(t,n,r,s)}function MI(e,t){return{contextElement:st(e)?e:e?.contextElement,getBoundingClientRect:()=>{const n=e,r=t?.(n);return r||!n?OI(r):n.getBoundingClientRect()}}}var jn=e=>({variable:e,reference:`var(${e})`}),Dt={arrowSize:jn("--arrow-size"),arrowSizeHalf:jn("--arrow-size-half"),arrowBg:jn("--arrow-background"),transformOrigin:jn("--transform-origin"),arrowOffset:jn("--arrow-offset")},TI=e=>e==="top"||e==="bottom"?"y":"x";function RI(e,t){return{name:"transformOrigin",fn(n){const{elements:r,middlewareData:s,placement:o,rects:i,y:a}=n,l=o.split("-")[0],u=TI(l),A=s.arrow?.x||0,c=s.arrow?.y||0,g=t?.clientWidth||0,d=t?.clientHeight||0,f=A+g/2,m=c+d/2,h=Math.abs(s.shift?.y||0),p=i.reference.height/2,E=d/2,B=e.offset?.mainAxis??e.gutter,C=typeof B=="number"?B+E:B??E,x=h>C,I={top:`${f}px calc(100% + ${C}px)`,bottom:`${f}px ${-C}px`,left:`calc(100% + ${C}px) ${m}px`,right:`${-C}px ${m}px`}[l],w=`${f}px ${i.reference.y+p-a}px`,y=!!e.overlap&&u==="y"&&x;return r.floating.style.setProperty(Dt.transformOrigin.variable,y?w:I),{data:{transformOrigin:y?w:I}}}}}var FI={name:"rects",fn({rects:e}){return{data:e}}},PI=e=>{if(e)return{name:"shiftArrow",fn({placement:t,middlewareData:n}){if(!n.arrow)return{};const{x:r,y:s}=n.arrow,o=t.split("-")[0];return Object.assign(e.style,{left:r!=null?`${r}px`:"",top:s!=null?`${s}px`:"",[o]:`calc(100% + ${Dt.arrowOffset.reference})`}),{}}}};function kI(e){const[t,n]=e.split("-");return{side:t,align:n,hasAlign:n!=null}}var _I={strategy:"absolute",placement:"bottom",listeners:!0,gutter:8,flip:!0,slide:!0,overlap:!1,sameWidth:!1,fitViewport:!1,overflowPadding:8,arrowPadding:4};function xa(e,t){const n=e.devicePixelRatio||1;return Math.round(t*n)/n}function $o(e){return typeof e=="function"?e():e==="clipping-ancestors"?"clippingAncestors":e}function NI(e,t,n){const r=e||t.createElement("div");return SI({element:r,padding:n.arrowPadding})}function LI(e,t){if(!Lp(t.offset??t.gutter))return wI(({placement:n})=>{const r=(e?.clientHeight||0)/2,s=t.offset?.mainAxis??t.gutter,o=typeof s=="number"?s+r:s??r,{hasAlign:i}=kI(n),a=i?void 0:t.shift,l=t.offset?.crossAxis??a;return Fo({crossAxis:l,mainAxis:o,alignmentAxis:t.shift})})}function YI(e){if(!e.flip)return;const t=$o(e.boundary);return yI({...t?{boundary:t}:void 0,padding:e.overflowPadding,fallbackPlacements:e.flip===!0?void 0:e.flip})}function GI(e){if(!e.slide&&!e.overlap)return;const t=$o(e.boundary);return CI({...t?{boundary:t}:void 0,mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:DI()})}function HI(e){return xI({padding:e.overflowPadding,apply({elements:t,rects:n,availableHeight:r,availableWidth:s}){const o=t.floating,i=Math.round(n.reference.width),a=Math.round(n.reference.height);s=Math.floor(s),r=Math.floor(r),o.style.setProperty("--reference-width",`${i}px`),o.style.setProperty("--reference-height",`${a}px`),o.style.setProperty("--available-width",`${s}px`),o.style.setProperty("--available-height",`${r}px`)}})}function UI(e){if(e.hideWhenDetached)return bI({strategy:"referenceHidden",boundary:$o(e.boundary)??"clippingAncestors"})}function VI(e){return e?e===!0?{ancestorResize:!0,ancestorScroll:!0,elementResize:!0,layoutShift:!0}:e:{}}function KI(e,t,n={}){const r=n.getAnchorElement?.()??e,s=MI(r,n.getAnchorRect);if(!t||!s)return;const o=Object.assign({},_I,n),i=t.querySelector("[data-part=arrow]"),a=[LI(i,o),YI(o),GI(o),NI(i,t.ownerDocument,o),PI(i),RI({gutter:o.gutter,offset:o.offset,overlap:o.overlap},i),HI(o),UI(o),FI],{placement:l,strategy:u,onComplete:A,onPositioned:c}=o,g=async()=>{if(!s||!t)return;const h=await QI(s,t,{placement:l,middleware:a,strategy:u});A?.(h),c?.({placed:!0});const p=Pt(t),E=xa(p,h.x),B=xa(p,h.y);t.style.setProperty("--x",`${E}px`),t.style.setProperty("--y",`${B}px`),o.hideWhenDetached&&(h.middlewareData.hide?.referenceHidden?(t.style.setProperty("visibility","hidden"),t.style.setProperty("pointer-events","none")):(t.style.removeProperty("visibility"),t.style.removeProperty("pointer-events")));const C=t.firstElementChild;if(C){const x=ko(C);t.style.setProperty("--z-index",x.zIndex)}},d=async()=>{n.updatePosition?(await n.updatePosition({updatePosition:g,floatingElement:t}),c?.({placed:!0})):await g()},f=VI(o.listeners),m=o.listeners?vI(s,t,d,f):Wp;return d(),()=>{m?.(),c?.({placed:!1})}}function ba(e,t,n={}){const{defer:r,...s}=n,o=r?Se:a=>a(),i=[];return i.push(o(()=>{const a=typeof e=="function"?e():e,l=typeof t=="function"?t():t;i.push(KI(a,l,s))})),()=>{i.forEach(a=>a?.())}}var WI={bottom:"rotate(45deg)",left:"rotate(135deg)",top:"rotate(225deg)",right:"rotate(315deg)"};function zI(e={}){const{placement:t,sameWidth:n,fitViewport:r,strategy:s="absolute"}=e;return{arrow:{position:"absolute",width:Dt.arrowSize.reference,height:Dt.arrowSize.reference,[Dt.arrowSizeHalf.variable]:`calc(${Dt.arrowSize.reference} / 2)`,[Dt.arrowOffset.variable]:`calc(${Dt.arrowSizeHalf.reference} * -1)`},arrowTip:{transform:t?WI[t.split("-")[0]]:void 0,background:Dt.arrowBg.reference,top:"0",left:"0",width:"100%",height:"100%",position:"absolute",zIndex:"inherit"},floating:{position:s,isolation:"isolate",minWidth:n?void 0:"max-content",width:n?"var(--reference-width)":void 0,maxWidth:r?"var(--available-width)":void 0,maxHeight:r?"var(--available-height)":void 0,pointerEvents:t?void 0:"none",top:"0px",left:"0px",transform:t?"translate3d(var(--x), var(--y), 0)":"translate3d(0, -100vh, 0)",zIndex:"var(--z-index)"}}}function $I(e){const t={each(n){for(let r=0;r<e.frames?.length;r+=1){const s=e.frames[r];s&&n(s)}},addEventListener(n,r,s){return t.each(o=>{try{o.document.addEventListener(n,r,s)}catch{}}),()=>{try{t.removeEventListener(n,r,s)}catch{}}},removeEventListener(n,r,s){t.each(o=>{try{o.document.removeEventListener(n,r,s)}catch{}})}};return t}function jI(e){const t=e.frameElement!=null?e.parent:null;return{addEventListener:(n,r,s)=>{try{t?.addEventListener(n,r,s)}catch{}return()=>{try{t?.removeEventListener(n,r,s)}catch{}}},removeEventListener:(n,r,s)=>{try{t?.removeEventListener(n,r,s)}catch{}}}}var Sa="pointerdown.outside",Da="focus.outside";function qI(e){for(const t of e)if(st(t)&&bc(t))return!0;return!1}var Wc=e=>"clientY"in e;function JI(e,t){if(!Wc(t)||!e)return!1;const n=e.getBoundingClientRect();return n.width===0||n.height===0?!1:n.top<=t.clientY&&t.clientY<=n.top+n.height&&n.left<=t.clientX&&t.clientX<=n.left+n.width}function XI(e,t){return e.y<=t.y&&t.y<=e.y+e.height&&e.x<=t.x&&t.x<=e.x+e.width}function Qa(e,t){if(!t||!Wc(e))return!1;const n=t.scrollHeight>t.clientHeight,r=n&&e.clientX>t.offsetLeft+t.clientWidth,s=t.scrollWidth>t.clientWidth,o=s&&e.clientY>t.offsetTop+t.clientHeight,i={x:t.offsetLeft,y:t.offsetTop,width:t.clientWidth+(n?16:0),height:t.clientHeight+(s?16:0)},a={x:e.clientX,y:e.clientY};return XI(i,a)?r||o:!1}function ZI(e,t){const{exclude:n,onFocusOutside:r,onPointerDownOutside:s,onInteractOutside:o,defer:i,followControlledElements:a=!0}=t;if(!e)return;const l=qt(e),u=Pt(e),A=$I(u),c=jI(u);function g(B,C){if(!st(C)||!C.isConnected||ts(e,C)||JI(e,B)||a&&gE(e,C))return!1;const x=l.querySelector(`[aria-controls="${e.id}"]`);if(x){const w=Io(x);if(Qa(B,w))return!1}const I=Io(e);return Qa(B,I)?!1:!n?.(C)}const d=new Set,f=Ln(e?.getRootNode());function m(B){function C(x){const I=i&&!la()?Se:S=>S(),w=x??B,y=w?.composedPath?.()??[w?.target];I(()=>{const S=f?y[0]:Yn(B);if(!(!e||!g(B,S))){if(s||o){const Q=Eo(s,o);e.addEventListener(Sa,Q,{once:!0})}Oa(e,Sa,{bubbles:!1,cancelable:!0,detail:{originalEvent:w,contextmenu:xc(w),focusable:qI(y),target:S}})}})}B.pointerType==="touch"?(d.forEach(x=>x()),d.add(Nr(l,"click",C,{once:!0})),d.add(c.addEventListener("click",C,{once:!0})),d.add(A.addEventListener("click",C,{once:!0}))):C()}const h=new Set,p=setTimeout(()=>{h.add(Nr(l,"pointerdown",m,!0)),h.add(c.addEventListener("pointerdown",m,!0)),h.add(A.addEventListener("pointerdown",m,!0))},0);function E(B){(i?Se:x=>x())(()=>{const x=B?.composedPath?.()??[B?.target],I=f?x[0]:Yn(B);if(!(!e||!g(B,I))){if(r||o){const w=Eo(r,o);e.addEventListener(Da,w,{once:!0})}Oa(e,Da,{bubbles:!1,cancelable:!0,detail:{originalEvent:B,contextmenu:!1,focusable:bc(I),target:I}})}})}return la()||(h.add(Nr(l,"focusin",E,!0)),h.add(c.addEventListener("focusin",E,!0)),h.add(A.addEventListener("focusin",E,!0))),()=>{clearTimeout(p),d.forEach(B=>B()),h.forEach(B=>B())}}function ev(e,t){const{defer:n}=t,r=n?Se:o=>o(),s=[];return s.push(r(()=>{const o=typeof e=="function"?e():e;s.push(ZI(o,t))})),()=>{s.forEach(o=>o?.())}}function Oa(e,t,n){const r=e.ownerDocument.defaultView||window,s=new r.CustomEvent(t,n);return e.dispatchEvent(s)}function tv(e,t){const n=r=>{r.key==="Escape"&&(r.isComposing||t?.(r))};return Nr(qt(e),"keydown",n,{capture:!0})}var Ma="layer:request-dismiss",tt={layers:[],branches:[],count(){return this.layers.length},pointerBlockingLayers(){return this.layers.filter(e=>e.pointerBlocking)},topMostPointerBlockingLayer(){return[...this.pointerBlockingLayers()].slice(-1)[0]},hasPointerBlockingLayer(){return this.pointerBlockingLayers().length>0},isBelowPointerBlockingLayer(e){const t=this.indexOf(e),n=this.topMostPointerBlockingLayer()?this.indexOf(this.topMostPointerBlockingLayer()?.node):-1;return t<n},isTopMost(e){return this.layers[this.count()-1]?.node===e},getNestedLayers(e){return Array.from(this.layers).slice(this.indexOf(e)+1)},getLayersByType(e){return this.layers.filter(t=>t.type===e)},getNestedLayersByType(e,t){const n=this.indexOf(e);return n===-1?[]:this.layers.slice(n+1).filter(r=>r.type===t)},getParentLayerOfType(e,t){const n=this.indexOf(e);if(!(n<=0))return this.layers.slice(0,n).reverse().find(r=>r.type===t)},countNestedLayersOfType(e,t){return this.getNestedLayersByType(e,t).length},isInNestedLayer(e,t){return this.getNestedLayers(e).some(n=>ts(n.node,t))},isInBranch(e){return Array.from(this.branches).some(t=>ts(t,e))},add(e){this.layers.push(e),this.syncLayers()},addBranch(e){this.branches.push(e)},remove(e){const t=this.indexOf(e);t<0||(t<this.count()-1&&this.getNestedLayers(e).forEach(r=>tt.dismiss(r.node,e)),this.layers.splice(t,1),this.syncLayers())},removeBranch(e){const t=this.branches.indexOf(e);t>=0&&this.branches.splice(t,1)},syncLayers(){this.layers.forEach((e,t)=>{e.node.style.setProperty("--layer-index",`${t}`),e.node.removeAttribute("data-nested"),e.node.removeAttribute("data-has-nested"),this.getParentLayerOfType(e.node,e.type)&&e.node.setAttribute("data-nested",e.type);const r=this.countNestedLayersOfType(e.node,e.type);r>0&&e.node.setAttribute("data-has-nested",e.type),e.node.style.setProperty("--nested-layer-count",`${r}`)})},indexOf(e){return this.layers.findIndex(t=>t.node===e)},dismiss(e,t){const n=this.indexOf(e);if(n===-1)return;const r=this.layers[n];rv(e,Ma,s=>{r.requestDismiss?.(s),s.defaultPrevented||r?.dismiss()}),nv(e,Ma,{originalLayer:e,targetLayer:t,originalIndex:n,targetIndex:t?this.indexOf(t):-1}),this.syncLayers()},clear(){this.remove(this.layers[0].node)}};function nv(e,t,n){const r=e.ownerDocument.defaultView||window,s=new r.CustomEvent(t,{cancelable:!0,bubbles:!0,detail:n});return e.dispatchEvent(s)}function rv(e,t,n){e.addEventListener(t,n,{once:!0})}var Ta;function Ra(){tt.layers.forEach(({node:e})=>{e.style.pointerEvents=tt.isBelowPointerBlockingLayer(e)?"none":"auto"})}function sv(e){e.style.pointerEvents=""}function ov(e,t){const n=qt(e),r=[];return tt.hasPointerBlockingLayer()&&!n.body.hasAttribute("data-inert")&&(Ta=document.body.style.pointerEvents,queueMicrotask(()=>{n.body.style.pointerEvents="none",n.body.setAttribute("data-inert","")})),t?.forEach(s=>{const[o,i]=kE(()=>{const a=s();return st(a)?a:null},{timeout:1e3});o.then(a=>r.push(Oc(a,{pointerEvents:"auto"}))),r.push(i)}),()=>{tt.hasPointerBlockingLayer()||(queueMicrotask(()=>{n.body.style.pointerEvents=Ta,n.body.removeAttribute("data-inert"),n.body.style.length===0&&n.body.removeAttribute("style")}),r.forEach(s=>s()))}}function iv(e,t){const{warnOnMissingNode:n=!0}=t;if(n&&!e){Bo("[@zag-js/dismissable] node is `null` or `undefined`");return}if(!e)return;const{onDismiss:r,onRequestDismiss:s,pointerBlocking:o,exclude:i,debug:a,type:l="dialog"}=t,u={dismiss:r,node:e,type:l,pointerBlocking:o,requestDismiss:s};tt.add(u),Ra();function A(m){const h=Yn(m.detail.originalEvent);tt.isBelowPointerBlockingLayer(e)||tt.isInBranch(h)||(t.onPointerDownOutside?.(m),t.onInteractOutside?.(m),!m.defaultPrevented&&(a&&console.log("onPointerDownOutside:",m.detail.originalEvent),r?.()))}function c(m){const h=Yn(m.detail.originalEvent);tt.isInBranch(h)||(t.onFocusOutside?.(m),t.onInteractOutside?.(m),!m.defaultPrevented&&(a&&console.log("onFocusOutside:",m.detail.originalEvent),r?.()))}function g(m){tt.isTopMost(e)&&(t.onEscapeKeyDown?.(m),!m.defaultPrevented&&r&&(m.preventDefault(),r()))}function d(m){if(!e)return!1;const h=typeof i=="function"?i():i,p=Array.isArray(h)?h:[h],E=t.persistentElements?.map(B=>B()).filter(st);return E&&p.push(...E),p.some(B=>ts(B,m))||tt.isInNestedLayer(e,m)}const f=[o?ov(e,t.persistentElements):void 0,tv(e,g),ev(e,{exclude:d,onFocusOutside:c,onPointerDownOutside:A,defer:t.defer})];return()=>{tt.remove(e),Ra(),sv(e),f.forEach(m=>m?.())}}function av(e,t){const{defer:n}=t,r=n?Se:o=>o(),s=[];return s.push(r(()=>{const o=it(e)?e():e;s.push(iv(o,t))})),()=>{s.forEach(o=>o?.())}}var zc=an("combobox").parts("root","clearTrigger","content","control","input","item","itemGroup","itemGroupLabel","itemIndicator","itemText","label","list","positioner","trigger"),We=zc.build(),$c=e=>new Go(e);$c.empty=()=>new Go({items:[]});var lv=e=>e.ids?.root??`combobox:${e.id}`,eo=e=>e.ids?.label??`combobox:${e.id}:label`,jc=e=>e.ids?.control??`combobox:${e.id}:control`,Yr=e=>e.ids?.input??`combobox:${e.id}:input`,Gr=e=>e.ids?.content??`combobox:${e.id}:content`,qc=e=>e.ids?.positioner??`combobox:${e.id}:popper`,Jc=e=>e.ids?.trigger??`combobox:${e.id}:toggle-btn`,Xc=e=>e.ids?.clearTrigger??`combobox:${e.id}:clear-btn`,cv=(e,t)=>e.ids?.itemGroup?.(t)??`combobox:${e.id}:optgroup:${t}`,Fa=(e,t)=>e.ids?.itemGroupLabel?.(t)??`combobox:${e.id}:optgroup-label:${t}`,Pa=(e,t)=>e.ids?.item?.(t)??`combobox:${e.id}:option:${t}`,nn=e=>e.getById(Gr(e)),ln=e=>e.getById(Yr(e)),ka=e=>e.getById(qc(e)),_a=e=>e.getById(jc(e)),nr=e=>e.getById(Jc(e)),Av=e=>e.getById(Xc(e)),bn=(e,t)=>{if(t==null)return null;const n=`[role=option][data-value="${CSS.escape(t)}"]`;return FE(nn(e),n)},Na=e=>{const t=ln(e);e.isActiveElement(t)||t?.focus({preventScroll:!0})},uv=e=>{const t=nr(e);e.isActiveElement(t)||t?.focus({preventScroll:!0})};function gv(e,t){const{context:n,prop:r,state:s,send:o,scope:i,computed:a,event:l}=e,u=r("translations"),A=r("collection"),c=!!r("disabled"),g=a("isInteractive"),d=!!r("invalid"),f=!!r("required"),m=!!r("readOnly"),h=s.hasTag("open"),p=s.hasTag("focused"),E=r("composite"),B=n.get("highlightedValue"),C=zI({...r("positioning"),placement:n.get("currentPlacement")});function x(I){const w=A.getItemDisabled(I.item),y=A.getItemValue(I.item);return vc(y,()=>`[zag-js] No value found for item ${JSON.stringify(I.item)}`),{value:y,disabled:!!(w||w),highlighted:B===y,selected:n.get("value").includes(y)}}return{focused:p,open:h,inputValue:n.get("inputValue"),highlightedValue:B,highlightedItem:n.get("highlightedItem"),value:n.get("value"),valueAsString:a("valueAsString"),hasSelectedItems:a("hasSelectedItems"),selectedItems:n.get("selectedItems"),collection:r("collection"),multiple:!!r("multiple"),disabled:!!c,syncSelectedItems(){o({type:"SELECTED_ITEMS.SYNC"})},reposition(I={}){o({type:"POSITIONING.SET",options:I})},setHighlightValue(I){o({type:"HIGHLIGHTED_VALUE.SET",value:I})},clearHighlightValue(){o({type:"HIGHLIGHTED_VALUE.CLEAR"})},selectValue(I){o({type:"ITEM.SELECT",value:I})},setValue(I){o({type:"VALUE.SET",value:I})},setInputValue(I,w="script"){o({type:"INPUT_VALUE.SET",value:I,src:w})},clearValue(I){I!=null?o({type:"ITEM.CLEAR",value:I}):o({type:"VALUE.CLEAR"})},focus(){ln(i)?.focus()},setOpen(I,w="script"){s.hasTag("open")!==I&&o({type:I?"OPEN":"CLOSE",src:w})},getRootProps(){return t.element({...We.root.attrs,dir:r("dir"),id:lv(i),"data-invalid":q(d),"data-readonly":q(m)})},getLabelProps(){return t.label({...We.label.attrs,dir:r("dir"),htmlFor:Yr(i),id:eo(i),"data-readonly":q(m),"data-disabled":q(c),"data-invalid":q(d),"data-required":q(f),"data-focus":q(p),onClick(I){E||(I.preventDefault(),nr(i)?.focus({preventScroll:!0}))}})},getControlProps(){return t.element({...We.control.attrs,dir:r("dir"),id:jc(i),"data-state":h?"open":"closed","data-focus":q(p),"data-disabled":q(c),"data-invalid":q(d)})},getPositionerProps(){return t.element({...We.positioner.attrs,dir:r("dir"),id:qc(i),style:C.floating})},getInputProps(){return t.input({...We.input.attrs,dir:r("dir"),"aria-invalid":_r(d),"data-invalid":q(d),"data-autofocus":q(r("autoFocus")),name:r("name"),form:r("form"),disabled:c,required:r("required"),autoComplete:"off",autoCorrect:"off",autoCapitalize:"none",spellCheck:"false",readOnly:m,placeholder:r("placeholder"),id:Yr(i),type:"text",role:"combobox",defaultValue:n.get("inputValue"),"aria-autocomplete":a("autoComplete")?"both":"list","aria-controls":Gr(i),"aria-expanded":h,"data-state":h?"open":"closed","aria-activedescendant":B?Pa(i,B):void 0,onClick(I){I.defaultPrevented||r("openOnClick")&&g&&o({type:"INPUT.CLICK",src:"input-click"})},onFocus(){c||o({type:"INPUT.FOCUS"})},onBlur(){c||o({type:"INPUT.BLUR"})},onChange(I){o({type:"INPUT.CHANGE",value:I.currentTarget.value,src:"input-change"})},onKeyDown(I){if(I.defaultPrevented||!g||I.ctrlKey||I.shiftKey||vE(I))return;const w=r("openOnKeyPress"),y=I.ctrlKey||I.metaKey||I.shiftKey,S=!0,Q={ArrowDown(T){!w&&!h||(o({type:T.altKey?"OPEN":"INPUT.ARROW_DOWN",keypress:S,src:"arrow-key"}),T.preventDefault())},ArrowUp(){!w&&!h||(o({type:I.altKey?"CLOSE":"INPUT.ARROW_UP",keypress:S,src:"arrow-key"}),I.preventDefault())},Home(T){y||(o({type:"INPUT.HOME",keypress:S}),h&&T.preventDefault())},End(T){y||(o({type:"INPUT.END",keypress:S}),h&&T.preventDefault())},Enter(T){o({type:"INPUT.ENTER",keypress:S,src:"item-select"});const G=a("isCustomValue")&&r("allowCustomValue"),re=B!=null,ue=r("alwaysSubmitOnEnter");if(h&&!G&&!ue&&re&&T.preventDefault(),B==null)return;const ie=bn(i,B);rE(ie)&&r("navigate")?.({value:B,node:ie,href:ie.href})},Escape(){o({type:"INPUT.ESCAPE",keypress:S,src:"escape-key"}),I.preventDefault()}},D=Aa(I,{dir:r("dir")}),R=Q[D];R?.(I)}})},getTriggerProps(I={}){return t.button({...We.trigger.attrs,dir:r("dir"),id:Jc(i),"aria-haspopup":E?"listbox":"dialog",type:"button",tabIndex:I.focusable?void 0:-1,"aria-label":u.triggerLabel,"aria-expanded":h,"data-state":h?"open":"closed","aria-controls":h?Gr(i):void 0,disabled:c,"data-invalid":q(d),"data-focusable":q(I.focusable),"data-readonly":q(m),"data-disabled":q(c),onFocus(){I.focusable&&o({type:"INPUT.FOCUS",src:"trigger"})},onClick(w){w.defaultPrevented||g&&Sr(w)&&o({type:"TRIGGER.CLICK",src:"trigger-click"})},onPointerDown(w){g&&w.pointerType!=="touch"&&Sr(w)&&(w.preventDefault(),queueMicrotask(()=>{ln(i)?.focus({preventScroll:!0})}))},onKeyDown(w){if(w.defaultPrevented||E)return;const y={ArrowDown(){o({type:"INPUT.ARROW_DOWN",src:"arrow-key"})},ArrowUp(){o({type:"INPUT.ARROW_UP",src:"arrow-key"})}},S=Aa(w,{dir:r("dir")}),Q=y[S];Q&&(Q(w),w.preventDefault())}})},getContentProps(){return t.element({...We.content.attrs,dir:r("dir"),id:Gr(i),role:E?"listbox":"dialog",tabIndex:-1,hidden:!h,"data-state":h?"open":"closed","data-placement":n.get("currentPlacement"),"aria-labelledby":eo(i),"aria-multiselectable":r("multiple")&&E?!0:void 0,"data-empty":q(A.size===0),onPointerDown(I){Sr(I)&&I.preventDefault()}})},getListProps(){return t.element({...We.list.attrs,role:E?void 0:"listbox","data-empty":q(A.size===0),"aria-labelledby":eo(i),"aria-multiselectable":r("multiple")&&!E?!0:void 0})},getClearTriggerProps(){return t.button({...We.clearTrigger.attrs,dir:r("dir"),id:Xc(i),type:"button",tabIndex:-1,disabled:c,"data-invalid":q(d),"aria-label":u.clearTriggerLabel,"aria-controls":Yr(i),hidden:!n.get("value").length,onPointerDown(I){Sr(I)&&I.preventDefault()},onClick(I){I.defaultPrevented||g&&o({type:"VALUE.CLEAR",src:"clear-trigger"})}})},getItemState:x,getItemProps(I){const w=x(I),y=w.value;return t.element({...We.item.attrs,dir:r("dir"),id:Pa(i,y),role:"option",tabIndex:-1,"data-highlighted":q(w.highlighted),"data-state":w.selected?"checked":"unchecked","aria-selected":_r(w.highlighted),"aria-disabled":_r(w.disabled),"data-disabled":q(w.disabled),"data-value":w.value,onPointerMove(){w.disabled||w.highlighted||o({type:"ITEM.POINTER_MOVE",value:y})},onPointerLeave(){I.persistFocus||w.disabled||!l.previous()?.type.includes("POINTER")||o({type:"ITEM.POINTER_LEAVE",value:y})},onClick(S){IE(S)||BE(S)||xc(S)||w.disabled||o({type:"ITEM.CLICK",src:"item-select",value:y})}})},getItemTextProps(I){const w=x(I);return t.element({...We.itemText.attrs,dir:r("dir"),"data-state":w.selected?"checked":"unchecked","data-disabled":q(w.disabled),"data-highlighted":q(w.highlighted)})},getItemIndicatorProps(I){const w=x(I);return t.element({"aria-hidden":!0,...We.itemIndicator.attrs,dir:r("dir"),"data-state":w.selected?"checked":"unchecked",hidden:!w.selected})},getItemGroupProps(I){const{id:w}=I;return t.element({...We.itemGroup.attrs,dir:r("dir"),id:cv(i,w),"aria-labelledby":Fa(i,w),"data-empty":q(A.size===0),role:"group"})},getItemGroupLabelProps(I){const{htmlFor:w}=I;return t.element({...We.itemGroupLabel.attrs,dir:r("dir"),id:Fa(i,w),role:"presentation"})}}}var{guards:dv,createMachine:fv,choose:hv}=HE(),{and:be,not:je}=dv,mv=fv({props({props:e}){return{loopFocus:!0,openOnClick:!1,defaultValue:[],defaultInputValue:"",closeOnSelect:!e.multiple,allowCustomValue:!1,alwaysSubmitOnEnter:!1,inputBehavior:"none",selectionBehavior:e.multiple?"clear":"replace",openOnKeyPress:!0,openOnChange:!0,composite:!0,navigate({node:t}){OE(t)},collection:$c.empty(),...e,positioning:{placement:"bottom",sameWidth:!0,...e.positioning},translations:{triggerLabel:"Toggle suggestions",clearTriggerLabel:"Clear value",...e.translations}}},initialState({prop:e}){return e("open")||e("defaultOpen")?"suggesting":"idle"},context({prop:e,bindable:t,getContext:n,getEvent:r}){return{currentPlacement:t(()=>({defaultValue:void 0})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:hr,hash(s){return s.join(",")},onChange(s){const o=n(),i=o.get("selectedItems"),a=e("collection"),l=s.map(u=>i.find(c=>a.getItemValue(c)===u)||a.find(u));o.set("selectedItems",l),e("onValueChange")?.({value:s,items:l})}})),highlightedValue:t(()=>({defaultValue:e("defaultHighlightedValue")||null,value:e("highlightedValue"),onChange(s){const o=e("collection").find(s);e("onHighlightChange")?.({highlightedValue:s,highlightedItem:o})}})),inputValue:t(()=>{let s=e("inputValue")||e("defaultInputValue");const o=e("value")||e("defaultValue");if(!s.trim()&&!e("multiple")){const i=e("collection").stringifyMany(o);s=bt(e("selectionBehavior"),{preserve:s||i,replace:i,clear:""})}return{defaultValue:s,value:e("inputValue"),onChange(i){const a=r(),l=(a.previousEvent||a).src;e("onInputValueChange")?.({inputValue:i,reason:l})}}}),highlightedItem:t(()=>{const s=e("highlightedValue");return{defaultValue:e("collection").find(s)}}),selectedItems:t(()=>{const s=e("value")||e("defaultValue")||[];return{defaultValue:e("collection").findMany(s)}})}},computed:{isInputValueEmpty:({context:e})=>e.get("inputValue").length===0,isInteractive:({prop:e})=>!(e("readOnly")||e("disabled")),autoComplete:({prop:e})=>e("inputBehavior")==="autocomplete",autoHighlight:({prop:e})=>e("inputBehavior")==="autohighlight",hasSelectedItems:({context:e})=>e.get("value").length>0,valueAsString:({context:e,prop:t})=>t("collection").stringifyItems(e.get("selectedItems")),isCustomValue:({context:e,computed:t})=>e.get("inputValue")!==t("valueAsString")},watch({context:e,prop:t,track:n,action:r,send:s}){n([()=>e.hash("value")],()=>{r(["syncSelectedItems"])}),n([()=>e.get("inputValue")],()=>{r(["syncInputValue"])}),n([()=>e.get("highlightedValue")],()=>{r(["syncHighlightedItem","autofillInputValue"])}),n([()=>t("open")],()=>{r(["toggleVisibility"])}),n([()=>t("collection").toString()],()=>{s({type:"CHILDREN_CHANGE"})})},on:{"SELECTED_ITEMS.SYNC":{actions:["syncSelectedItems"]},"HIGHLIGHTED_VALUE.SET":{actions:["setHighlightedValue"]},"HIGHLIGHTED_VALUE.CLEAR":{actions:["clearHighlightedValue"]},"ITEM.SELECT":{actions:["selectItem"]},"ITEM.CLEAR":{actions:["clearItem"]},"VALUE.SET":{actions:["setValue"]},"INPUT_VALUE.SET":{actions:["setInputValue"]},"POSITIONING.SET":{actions:["reposition"]}},entry:hv([{guard:"autoFocus",actions:["setInitialFocus"]}]),states:{idle:{tags:["idle","closed"],entry:["scrollContentToTop","clearHighlightedValue"],on:{"CONTROLLED.OPEN":{target:"interacting"},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]}],"INPUT.CLICK":[{guard:"isOpenControlled",actions:["highlightFirstSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["highlightFirstSelectedItem","invokeOnOpen"]}],"INPUT.FOCUS":{target:"focused"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"interacting",actions:["invokeOnOpen"]}],"VALUE.CLEAR":{target:"focused",actions:["clearInputValue","clearSelectedItems","setInitialFocus"]}}},focused:{tags:["focused","closed"],entry:["scrollContentToTop","clearHighlightedValue"],on:{"CONTROLLED.OPEN":[{guard:"isChangeEvent",target:"suggesting"},{target:"interacting"}],"INPUT.CHANGE":[{guard:be("isOpenControlled","openOnChange"),actions:["setInputValue","invokeOnOpen","highlightFirstItemIfNeeded"]},{guard:"openOnChange",target:"suggesting",actions:["setInputValue","invokeOnOpen","highlightFirstItemIfNeeded"]},{actions:["setInputValue"]}],"LAYER.INTERACT_OUTSIDE":{target:"idle"},"INPUT.ESCAPE":{guard:be("isCustomValue",je("allowCustomValue")),actions:["revertInputValue"]},"INPUT.BLUR":{target:"idle"},"INPUT.CLICK":[{guard:"isOpenControlled",actions:["highlightFirstSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["highlightFirstSelectedItem","invokeOnOpen"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["setInitialFocus","highlightFirstSelectedItem","invokeOnOpen"]}],"INPUT.ARROW_DOWN":[{guard:be("isOpenControlled","autoComplete"),actions:["invokeOnOpen"]},{guard:"autoComplete",target:"interacting",actions:["invokeOnOpen"]},{guard:"isOpenControlled",actions:["highlightFirstOrSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["highlightFirstOrSelectedItem","invokeOnOpen"]}],"INPUT.ARROW_UP":[{guard:"autoComplete",target:"interacting",actions:["invokeOnOpen"]},{guard:"autoComplete",target:"interacting",actions:["invokeOnOpen"]},{target:"interacting",actions:["highlightLastOrSelectedItem","invokeOnOpen"]},{target:"interacting",actions:["highlightLastOrSelectedItem","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"interacting",actions:["invokeOnOpen"]}],"VALUE.CLEAR":{actions:["clearInputValue","clearSelectedItems"]}}},interacting:{tags:["open","focused"],entry:["setInitialFocus"],effects:["scrollToHighlightedItem","trackDismissableLayer","trackPlacement"],on:{"CONTROLLED.CLOSE":[{guard:"restoreFocus",target:"focused",actions:["setFinalFocus"]},{target:"idle"}],CHILDREN_CHANGE:[{guard:"isHighlightedItemRemoved",actions:["clearHighlightedValue"]},{actions:["scrollToHighlightedItem"]}],"INPUT.HOME":{actions:["highlightFirstItem"]},"INPUT.END":{actions:["highlightLastItem"]},"INPUT.ARROW_DOWN":[{guard:be("autoComplete","isLastItemHighlighted"),actions:["clearHighlightedValue","scrollContentToTop"]},{actions:["highlightNextItem"]}],"INPUT.ARROW_UP":[{guard:be("autoComplete","isFirstItemHighlighted"),actions:["clearHighlightedValue"]},{actions:["highlightPrevItem"]}],"INPUT.ENTER":[{guard:be("isOpenControlled","isCustomValue",je("hasHighlightedItem"),je("allowCustomValue")),actions:["revertInputValue","invokeOnClose"]},{guard:be("isCustomValue",je("hasHighlightedItem"),je("allowCustomValue")),target:"focused",actions:["revertInputValue","invokeOnClose"]},{guard:be("isOpenControlled","closeOnSelect"),actions:["selectHighlightedItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectHighlightedItem","invokeOnClose","setFinalFocus"]},{actions:["selectHighlightedItem"]}],"INPUT.CHANGE":[{guard:"autoComplete",target:"suggesting",actions:["setInputValue"]},{target:"suggesting",actions:["clearHighlightedValue","setInputValue"]}],"ITEM.POINTER_MOVE":{actions:["setHighlightedValue"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedValue"]},"ITEM.CLICK":[{guard:be("isOpenControlled","closeOnSelect"),actions:["selectItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectItem","invokeOnClose","setFinalFocus"]},{actions:["selectItem"]}],"LAYER.ESCAPE":[{guard:be("isOpenControlled","autoComplete"),actions:["syncInputValue","invokeOnClose"]},{guard:"autoComplete",target:"focused",actions:["syncInputValue","invokeOnClose"]},{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose","setFinalFocus"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose"]}],"LAYER.INTERACT_OUTSIDE":[{guard:be("isOpenControlled","isCustomValue",je("allowCustomValue")),actions:["revertInputValue","invokeOnClose"]},{guard:be("isCustomValue",je("allowCustomValue")),target:"idle",actions:["revertInputValue","invokeOnClose"]},{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"idle",actions:["invokeOnClose"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose","setFinalFocus"]}],"VALUE.CLEAR":[{guard:"isOpenControlled",actions:["clearInputValue","clearSelectedItems","invokeOnClose"]},{target:"focused",actions:["clearInputValue","clearSelectedItems","invokeOnClose","setFinalFocus"]}]}},suggesting:{tags:["open","focused"],effects:["trackDismissableLayer","scrollToHighlightedItem","trackPlacement"],entry:["setInitialFocus"],on:{"CONTROLLED.CLOSE":[{guard:"restoreFocus",target:"focused",actions:["setFinalFocus"]},{target:"idle"}],CHILDREN_CHANGE:[{guard:be("isHighlightedItemRemoved","hasCollectionItems","autoHighlight"),actions:["clearHighlightedValue","highlightFirstItem"]},{guard:"isHighlightedItemRemoved",actions:["clearHighlightedValue"]},{guard:"autoHighlight",actions:["highlightFirstItem"]}],"INPUT.ARROW_DOWN":{target:"interacting",actions:["highlightNextItem"]},"INPUT.ARROW_UP":{target:"interacting",actions:["highlightPrevItem"]},"INPUT.HOME":{target:"interacting",actions:["highlightFirstItem"]},"INPUT.END":{target:"interacting",actions:["highlightLastItem"]},"INPUT.ENTER":[{guard:be("isOpenControlled","isCustomValue",je("hasHighlightedItem"),je("allowCustomValue")),actions:["revertInputValue","invokeOnClose"]},{guard:be("isCustomValue",je("hasHighlightedItem"),je("allowCustomValue")),target:"focused",actions:["revertInputValue","invokeOnClose"]},{guard:be("isOpenControlled","closeOnSelect"),actions:["selectHighlightedItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectHighlightedItem","invokeOnClose","setFinalFocus"]},{actions:["selectHighlightedItem"]}],"INPUT.CHANGE":{actions:["setInputValue"]},"LAYER.ESCAPE":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose"]}],"ITEM.POINTER_MOVE":{target:"interacting",actions:["setHighlightedValue"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedValue"]},"LAYER.INTERACT_OUTSIDE":[{guard:be("isOpenControlled","isCustomValue",je("allowCustomValue")),actions:["revertInputValue","invokeOnClose"]},{guard:be("isCustomValue",je("allowCustomValue")),target:"idle",actions:["revertInputValue","invokeOnClose"]},{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"idle",actions:["invokeOnClose"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose"]}],"ITEM.CLICK":[{guard:be("isOpenControlled","closeOnSelect"),actions:["selectItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectItem","invokeOnClose","setFinalFocus"]},{actions:["selectItem"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose","setFinalFocus"]}],"VALUE.CLEAR":[{guard:"isOpenControlled",actions:["clearInputValue","clearSelectedItems","invokeOnClose"]},{target:"focused",actions:["clearInputValue","clearSelectedItems","invokeOnClose","setFinalFocus"]}]}}},implementations:{guards:{isInputValueEmpty:({computed:e})=>e("isInputValueEmpty"),autoComplete:({computed:e,prop:t})=>e("autoComplete")&&!t("multiple"),autoHighlight:({computed:e})=>e("autoHighlight"),isFirstItemHighlighted:({prop:e,context:t})=>e("collection").firstValue===t.get("highlightedValue"),isLastItemHighlighted:({prop:e,context:t})=>e("collection").lastValue===t.get("highlightedValue"),isCustomValue:({computed:e})=>e("isCustomValue"),allowCustomValue:({prop:e})=>!!e("allowCustomValue"),hasHighlightedItem:({context:e})=>e.get("highlightedValue")!=null,closeOnSelect:({prop:e})=>!!e("closeOnSelect"),isOpenControlled:({prop:e})=>e("open")!=null,openOnChange:({prop:e,context:t})=>{const n=e("openOnChange");return _p(n)?n:!!n?.({inputValue:t.get("inputValue")})},restoreFocus:({event:e})=>{const t=e.restoreFocus??e.previousEvent?.restoreFocus;return t==null?!0:!!t},isChangeEvent:({event:e})=>e.previousEvent?.type==="INPUT.CHANGE",autoFocus:({prop:e})=>!!e("autoFocus"),isHighlightedItemRemoved:({prop:e,context:t})=>!e("collection").has(t.get("highlightedValue")),hasCollectionItems:({prop:e})=>e("collection").size>0},effects:{trackDismissableLayer({send:e,prop:t,scope:n}){return t("disableLayer")?void 0:av(()=>nn(n),{type:"listbox",defer:!0,exclude:()=>[ln(n),nr(n),Av(n)],onFocusOutside:t("onFocusOutside"),onPointerDownOutside:t("onPointerDownOutside"),onInteractOutside:t("onInteractOutside"),onEscapeKeyDown(s){s.preventDefault(),s.stopPropagation(),e({type:"LAYER.ESCAPE",src:"escape-key"})},onDismiss(){e({type:"LAYER.INTERACT_OUTSIDE",src:"interact-outside",restoreFocus:!1})}})},trackPlacement({context:e,prop:t,scope:n}){const r=()=>_a(n)||nr(n),s=()=>ka(n);return e.set("currentPlacement",t("positioning").placement),ba(r,s,{...t("positioning"),defer:!0,onComplete(o){e.set("currentPlacement",o.placement)}})},scrollToHighlightedItem({context:e,prop:t,scope:n,event:r}){const s=ln(n);let o=[];const i=u=>{const A=r.current().type.includes("POINTER"),c=e.get("highlightedValue");if(A||!c)return;const g=nn(n),d=t("scrollToIndexFn");if(d){const h=t("collection").indexOf(c);d({index:h,immediate:u,getElement:()=>bn(n,c)});return}const f=bn(n,c),m=Se(()=>{ua(f,{rootEl:g,block:"nearest"})});o.push(m)},a=Se(()=>i(!0));o.push(a);const l=QE(s,{attributes:["aria-activedescendant"],callback:()=>i(!1)});return o.push(l),()=>{o.forEach(u=>u())}}},actions:{reposition({context:e,prop:t,scope:n,event:r}){ba(()=>_a(n),()=>ka(n),{...t("positioning"),...r.options,defer:!0,listeners:!1,onComplete(i){e.set("currentPlacement",i.placement)}})},setHighlightedValue({context:e,event:t}){t.value!=null&&e.set("highlightedValue",t.value)},clearHighlightedValue({context:e}){e.set("highlightedValue",null)},selectHighlightedItem(e){const{context:t,prop:n}=e,r=n("collection"),s=t.get("highlightedValue");if(!s||!r.has(s))return;const o=n("multiple")?ia(t.get("value"),s):[s];n("onSelect")?.({value:o,itemValue:s}),t.set("value",o);const i=bt(n("selectionBehavior"),{preserve:t.get("inputValue"),replace:r.stringifyMany(o),clear:""});t.set("inputValue",i)},scrollToHighlightedItem({context:e,prop:t,scope:n}){Dc(()=>{const r=e.get("highlightedValue");if(r==null)return;const s=bn(n,r),o=nn(n),i=t("scrollToIndexFn");if(i){const a=t("collection").indexOf(r);i({index:a,immediate:!0,getElement:()=>bn(n,r)});return}ua(s,{rootEl:o,block:"nearest"})})},selectItem(e){const{context:t,event:n,flush:r,prop:s}=e;n.value!=null&&r(()=>{const o=s("multiple")?ia(t.get("value"),n.value):[n.value];s("onSelect")?.({value:o,itemValue:n.value}),t.set("value",o);const i=bt(s("selectionBehavior"),{preserve:t.get("inputValue"),replace:s("collection").stringifyMany(o),clear:""});t.set("inputValue",i)})},clearItem(e){const{context:t,event:n,flush:r,prop:s}=e;n.value!=null&&r(()=>{const o=Ec(t.get("value"),n.value);t.set("value",o);const i=bt(s("selectionBehavior"),{preserve:t.get("inputValue"),replace:s("collection").stringifyMany(o),clear:""});t.set("inputValue",i)})},setInitialFocus({scope:e}){Se(()=>{Na(e)})},setFinalFocus({scope:e}){Se(()=>{nr(e)?.dataset.focusable==null?Na(e):uv(e)})},syncInputValue({context:e,scope:t,event:n}){const r=ln(t);r&&(r.value=e.get("inputValue"),queueMicrotask(()=>{n.current().type!=="INPUT.CHANGE"&&jp(r)}))},setInputValue({context:e,event:t}){e.set("inputValue",t.value)},clearInputValue({context:e}){e.set("inputValue","")},revertInputValue({context:e,prop:t,computed:n}){const r=t("selectionBehavior"),s=bt(r,{replace:n("hasSelectedItems")?n("valueAsString"):"",preserve:e.get("inputValue"),clear:""});e.set("inputValue",s)},setValue(e){const{context:t,flush:n,event:r,prop:s}=e;n(()=>{t.set("value",r.value);const o=bt(s("selectionBehavior"),{preserve:t.get("inputValue"),replace:s("collection").stringifyMany(r.value),clear:""});t.set("inputValue",o)})},clearSelectedItems(e){const{context:t,flush:n,prop:r}=e;n(()=>{t.set("value",[]);const s=bt(r("selectionBehavior"),{preserve:t.get("inputValue"),replace:r("collection").stringifyMany([]),clear:""});t.set("inputValue",s)})},scrollContentToTop({prop:e,scope:t}){const n=e("scrollToIndexFn");if(n){const r=e("collection").firstValue;n({index:0,immediate:!0,getElement:()=>bn(t,r)})}else{const r=nn(t);if(!r)return;r.scrollTop=0}},invokeOnOpen({prop:e,event:t,context:n}){const r=La(t);e("onOpenChange")?.({open:!0,reason:r,value:n.get("value")})},invokeOnClose({prop:e,event:t,context:n}){const r=La(t);e("onOpenChange")?.({open:!1,reason:r,value:n.get("value")})},highlightFirstItem({context:e,prop:t,scope:n}){(nn(n)?queueMicrotask:Se)(()=>{const s=t("collection").firstValue;s&&e.set("highlightedValue",s)})},highlightFirstItemIfNeeded({computed:e,action:t}){e("autoHighlight")&&t(["highlightFirstItem"])},highlightLastItem({context:e,prop:t,scope:n}){(nn(n)?queueMicrotask:Se)(()=>{const s=t("collection").lastValue;s&&e.set("highlightedValue",s)})},highlightNextItem({context:e,prop:t}){let n=null;const r=e.get("highlightedValue"),s=t("collection");r?(n=s.getNextValue(r),!n&&t("loopFocus")&&(n=s.firstValue)):n=s.firstValue,n&&e.set("highlightedValue",n)},highlightPrevItem({context:e,prop:t}){let n=null;const r=e.get("highlightedValue"),s=t("collection");r?(n=s.getPreviousValue(r),!n&&t("loopFocus")&&(n=s.lastValue)):n=s.lastValue,n&&e.set("highlightedValue",n)},highlightFirstSelectedItem({context:e,prop:t}){Se(()=>{const[n]=t("collection").sort(e.get("value"));n&&e.set("highlightedValue",n)})},highlightFirstOrSelectedItem({context:e,prop:t,computed:n}){Se(()=>{let r=null;n("hasSelectedItems")?r=t("collection").sort(e.get("value"))[0]:r=t("collection").firstValue,r&&e.set("highlightedValue",r)})},highlightLastOrSelectedItem({context:e,prop:t,computed:n}){Se(()=>{const r=t("collection");let s=null;n("hasSelectedItems")?s=r.sort(e.get("value"))[0]:s=r.lastValue,s&&e.set("highlightedValue",s)})},autofillInputValue({context:e,computed:t,prop:n,event:r,scope:s}){const o=ln(s),i=n("collection");if(!t("autoComplete")||!o||!r.keypress)return;const a=i.stringify(e.get("highlightedValue"));Se(()=>{o.value=a||e.get("inputValue")})},syncSelectedItems(e){queueMicrotask(()=>{const{context:t,prop:n}=e,r=n("collection"),s=t.get("value"),o=s.map(a=>t.get("selectedItems").find(u=>r.getItemValue(u)===a)||r.find(a));t.set("selectedItems",o);const i=bt(n("selectionBehavior"),{preserve:t.get("inputValue"),replace:r.stringifyMany(s),clear:""});t.set("inputValue",i)})},syncHighlightedItem({context:e,prop:t}){const n=t("collection").find(e.get("highlightedValue"));e.set("highlightedItem",n)},toggleVisibility({event:e,send:t,prop:n}){t({type:n("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:e})}}}});function La(e){return(e.previousEvent||e).src}mr()(["allowCustomValue","autoFocus","closeOnSelect","collection","composite","defaultHighlightedValue","defaultInputValue","defaultOpen","defaultValue","dir","disabled","disableLayer","form","getRootNode","highlightedValue","id","ids","inputBehavior","inputValue","invalid","loopFocus","multiple","name","navigate","onFocusOutside","onHighlightChange","onInputValueChange","onInteractOutside","onOpenChange","onOpenChange","onPointerDownOutside","onSelect","onValueChange","open","openOnChange","openOnClick","openOnKeyPress","placeholder","positioning","readOnly","required","scrollToIndexFn","selectionBehavior","translations","value","alwaysSubmitOnEnter"]);mr()(["htmlFor"]);mr()(["id"]);mr()(["item","persistFocus"]);var pv=zc.extendWith("empty");wt({hookName:"useRenderStrategyContext",providerName:"<RenderStrategyProvider />"});var Ev=e=>gt()(e,["lazyMount","unmountOnExit"]);function Bv(e,t){const{state:n,send:r,context:s}=e,o=n.matches("mounted","unmountSuspended");return{skip:!s.get("initial"),present:o,setNode(i){i&&r({type:"NODE.SET",node:i})},unmount(){r({type:"UNMOUNT"})}}}var Iv={props({props:e}){return{...e,present:!!e.present}},initialState({prop:e}){return e("present")?"mounted":"unmounted"},refs(){return{node:null,styles:null}},context({bindable:e}){return{unmountAnimationName:e(()=>({defaultValue:null})),prevAnimationName:e(()=>({defaultValue:null})),present:e(()=>({defaultValue:!1})),initial:e(()=>({sync:!0,defaultValue:!1}))}},exit:["cleanupNode"],watch({track:e,prop:t,send:n}){e([()=>t("present")],()=>{n({type:"PRESENCE.CHANGED"})})},on:{"NODE.SET":{actions:["setupNode"]},"PRESENCE.CHANGED":{actions:["setInitial","syncPresence"]}},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:e})=>{e.get("initial")||queueMicrotask(()=>{e.set("initial",!0)})},invokeOnExitComplete:({prop:e,refs:t})=>{e("onExitComplete")?.();const n=t.get("node");if(!n)return;const r=Pt(n),s=new r.CustomEvent("exitcomplete",{bubbles:!1});n.dispatchEvent(s)},setupNode:({refs:e,event:t})=>{e.get("node")!==t.node&&(e.set("node",t.node),e.set("styles",ko(t.node)))},cleanupNode:({refs:e})=>{e.set("node",null),e.set("styles",null)},syncPresence:({context:e,refs:t,send:n,prop:r})=>{const s=r("present");if(s)return n({type:"MOUNT",src:"presence.changed"});const o=t.get("node");if(!s&&o?.ownerDocument.visibilityState==="hidden")return n({type:"UNMOUNT",src:"visibilitychange"});Se(()=>{const i=Or(t.get("styles"));e.set("unmountAnimationName",i),i==="none"||i===e.get("prevAnimationName")||t.get("styles")?.display==="none"||t.get("styles")?.animationDuration==="0s"?n({type:"UNMOUNT",src:"presence.changed"}):n({type:"UNMOUNT.SUSPEND"})})},setPrevAnimationName:({context:e,refs:t})=>{Se(()=>{e.set("prevAnimationName",Or(t.get("styles")))})},clearPrevAnimationName:({context:e})=>{e.set("prevAnimationName",null)}},effects:{trackAnimationEvents:({context:e,refs:t,send:n,prop:r})=>{const s=t.get("node");if(!s)return;const o=u=>{(u.composedPath?.()?.[0]??u.target)===s&&e.set("prevAnimationName",Or(t.get("styles")))},i=u=>{const A=Or(t.get("styles"));Yn(u)===s&&A===e.get("unmountAnimationName")&&!r("present")&&n({type:"UNMOUNT",src:"animationend"})},a=u=>{Yn(u)===s&&!r("present")&&n({type:"UNMOUNT",src:"animationcancel"})};s.addEventListener("animationstart",o),s.addEventListener("animationcancel",a),s.addEventListener("animationend",i);const l=Oc(s,{animationFillMode:"forwards"});return()=>{s.removeEventListener("animationstart",o),s.removeEventListener("animationcancel",a),s.removeEventListener("animationend",i),Dc(()=>l())}}}}};function Or(e){return e?.animationName||"none"}mr()(["onExitComplete","present","immediate"]);var Zc=e=>gt()(e,["immediate","lazyMount","onExitComplete","present","skipAnimationOnMount","unmountOnExit"]),eA=e=>{const[t,n]=Ev(No(e)),[r,s]=K(!1),o=Mc(Iv,e),i=_(()=>Bv(o));ze(()=>{i().present&&s(!0)});const a=l=>{l&&o.send({type:"NODE.SET",node:l})};return _(()=>({unmounted:!i().present&&!r()&&t.lazyMount||t.unmountOnExit&&!i().present&&r(),present:i().present,ref:a,presenceProps:{hidden:!i().present,"data-state":i().skip&&n.skipAnimationOnMount?void 0:n.present?"open":"closed"}}))},[tA,nA]=wt({hookName:"usePresenceContext",providerName:"<PresenceProvider />"}),[Mw,vv]=wt({hookName:"useEnvironmentContext",providerName:"<EnvironmentProvider />",strict:!1,defaultValue:()=>({dir:"ltr",locale:"en-US"})}),[rA,Ge]=wt({hookName:"useComboboxContext",providerName:"<ComboboxProvider />"}),wv=e=>{const t=Ge(),n=ne(()=>t().getClearTriggerProps(),e);return v(oe.button,n)},Cv=e=>{const t=Ge(),n=nA(),r=ne(()=>t().getContentProps(),()=>n().presenceProps,e);return v(Z,{get when(){return!n().unmounted},get children(){return v(oe.div,de(r,{ref(s){var o=ds(n().ref,e.ref);typeof o=="function"&&o(s)}}))}})},yv=pv.build(),xv=e=>{const t=Ge(),n=_(()=>t().collection.size);return v(Z,{get when(){return n()===0},get children(){return v(oe.div,de(()=>yv.empty.attrs,e,{role:"presentation"}))}})},bv=e=>e.children(Ge()),Sv=e=>{const t=Ge(),n=ne(()=>t().getControlProps(),e);return v(oe.div,n)},Dv=e=>{const t=Ge(),n=ne(()=>t().getInputProps(),e),r=Ct();return v(oe.input,de({get"aria-describedby"(){return r?.().ariaDescribedby}},n))},[Qv,Ov]=wt({hookName:"useComboboxItemContext",providerName:"<ComboboxItemProvider />"}),[Mv,sA]=wt({hookName:"useComboboxItemPropsContext",providerName:"<ComboboxItemPropsProvider />"}),Tv=e=>{const[t,n]=gt()(e,["item","persistFocus"]),r=Ge(),s=ne(()=>r().getItemProps(t),n),o=_(()=>r().getItemState(t));return v(Mv,{value:t,get children(){return v(Qv,{value:o,get children(){return v(oe.div,s)}})}})},Rv=e=>e.children(Ov()),[Fv,Pv]=wt({hookName:"useComboboxItemGroupPropsContext",providerName:"<ComboboxItemGroupPropsProvider />"}),kv=e=>{const[t,n]=gt()(e,["id"]),r=Ge(),s=ne({id:ls()},t),o=ne(()=>r().getItemGroupProps(s),n);return v(Fv,{value:s,get children(){return v(oe.div,o)}})},_v=e=>{const t=Ge(),n=Pv(),r=ne(()=>t().getItemGroupLabelProps({htmlFor:n.id}),e);return v(oe.div,r)},Nv=e=>{const t=Ge(),n=sA(),r=ne(()=>t().getItemIndicatorProps(n),e);return v(oe.div,r)},Lv=e=>{const t=Ge(),n=sA(),r=ne(()=>t().getItemTextProps(n),e);return v(oe.span,r)},Yv=e=>{const t=Ge(),n=ne(()=>t().getLabelProps(),e);return v(oe.label,n)},Gv=e=>{const t=Ge(),n=ne(()=>t().getListProps(),e);return v(oe.div,n)},Hv=e=>{const t=Ge(),n=nA(),r=ne(()=>t().getPositionerProps(),e);return v(Z,{get when(){return!n().unmounted},get children(){return v(oe.div,r)}})},Uv=e=>{const t=vv(),n=Lo(),r=ls(),s=Ct(),o=_(()=>({id:r,ids:{label:s?.().ids.label,input:s?.().ids.control},disabled:s?.().disabled,readOnly:s?.().readOnly,required:s?.().required,invalid:s?.().invalid,dir:t().dir,getRootNode:n().getRootNode,...No(e)})),i=Mc(mv,o);return _(()=>gv(i,qE))},Vv=e=>{const[t,n]=Zc(e),[r,s]=gt()(n,["allowCustomValue","alwaysSubmitOnEnter","autoFocus","closeOnSelect","collection","composite","defaultHighlightedValue","defaultInputValue","defaultOpen","defaultValue","disabled","disableLayer","form","highlightedValue","id","ids","inputBehavior","inputValue","invalid","loopFocus","multiple","name","navigate","onFocusOutside","onHighlightChange","onInputValueChange","onInteractOutside","onOpenChange","onPointerDownOutside","onValueChange","onSelect","open","openOnChange","openOnClick","openOnKeyPress","placeholder","positioning","readOnly","required","scrollToIndexFn","selectionBehavior","translations","value"]),o=Uv(r),i=eA(ne(t,()=>({present:o().open}))),a=ne(()=>o().getRootProps(),s);return v(rA,{value:o,get children(){return v(tA,{value:i,get children(){return v(oe.div,a)}})}})},Kv=e=>{const[t,n]=Zc(e),[{value:r},s]=gt()(n,["value"]),o=eA(ne(t,()=>({present:r().open}))),i=ne(()=>r().getRootProps(),s);return v(rA,{value:r,get children(){return v(tA,{value:o,get children(){return v(oe.div,i)}})}})},Wv=e=>{const[t,n]=gt()(e,["focusable"]),r=Ge(),s=ne(()=>r().getTriggerProps(t),n);return v(oe.button,s)},St={};Yo(St,{ClearTrigger:()=>wv,Content:()=>Cv,Context:()=>bv,Control:()=>Sv,Empty:()=>xv,Input:()=>Dv,Item:()=>Tv,ItemContext:()=>Rv,ItemGroup:()=>kv,ItemGroupLabel:()=>_v,ItemIndicator:()=>Nv,ItemText:()=>Lv,Label:()=>Yv,List:()=>Gv,Positioner:()=>Hv,Root:()=>Vv,RootProvider:()=>Kv,Trigger:()=>Wv});var Ya=e=>new Go(e);function zv(e){const t=_(()=>{const A=typeof e=="function"?e():e;return An(A,["initialItems","filter","limit"])}),n=()=>{const[A]=t();return A.initialItems},[r,s]=K(n()),[o,i]=K(""),a=A=>{s(A),i("")},l=A=>{const[,c]=t();return Ya({...c,items:A})};return{collection:_(()=>{const[A,c]=t(),g=A.filter;let d=r();o()&&g&&(d=l(r()).filter((m,h,p)=>g(m,o(),p)).items);const f=A.limit==null?d:d.slice(0,A.limit);return Ya({...c,items:f})}),filter:(A="")=>{i(A)},set:A=>{a(A)},reset:()=>{const[A]=t();a(A.initialItems)},clear:()=>{a([])},insert:(A,...c)=>{const g=l(r()).insert(A,...c).items;a(g)},insertBefore:(A,...c)=>{const g=l(r()).insertBefore(A,...c).items;a(g)},insertAfter:(A,...c)=>{const g=l(r()).insertAfter(A,...c).items;a(g)},remove:(...A)=>{const c=l(r()).remove(...A).items;a(c)},move:(A,c)=>{const g=l(r()).move(A,c).items;a(g)},moveBefore:(A,...c)=>{const g=l(r()).moveBefore(A,...c).items;a(g)},moveAfter:(A,...c)=>{const g=l(r()).moveAfter(A,...c).items;a(g)},reorder:(A,c)=>{const g=l(r()).reorder(A,c).items;a(g)},append:(...A)=>{const c=l(r()).append(...A).items;a(c)},upsert:(A,c,g="append")=>{const d=l(r()).upsert(A,c,g).items;a(d)},prepend:(...A)=>{const c=l(r()).prepend(...A).items;a(c)},update:(A,c)=>{const g=l(r()).update(A,c).items;a(g)}}}var $v=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],jv=e=>v(vt,de(e,{iconNode:$v,name:"search"})),qv=jv,Jv=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Xv=e=>v(vt,de(e,{iconNode:Jv,name:"x"})),Zv=Xv,to=P("<span>"),ew=P('<span class="bg-yellow-200 font-semibold">'),tw=P('<div class="absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none">'),nw=P('<div class="absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none"><kbd class="px-1.5 py-0.5 text-xs font-mono text-gray-400 bg-gray-100 border border-gray-300 rounded">/'),rw=P('<div class="px-4 py-2 text-xs text-gray-400 bg-gray-50 border-t border-gray-200">Showing 50 of <!> results'),sw=P('<div class="px-4 py-3 text-sm text-gray-500">No results found'),ow=P('<div class="text-xs text-gray-500 mt-0.5 truncate">');const Ga=50;function iw(e,t){if(t.length===0)return(()=>{var s=to();return O(s,e),s})();const n=[];let r=0;for(const[s,o]of t)s>r&&n.push((()=>{var i=to();return O(i,()=>e.slice(r,s)),i})()),n.push((()=>{var i=ew();return O(i,()=>e.slice(s,o+1)),i})()),r=o+1;return r<e.length&&n.push((()=>{var s=to();return O(s,()=>e.slice(r)),s})()),n}function Ha(e,t){return new Set(["kind","name","title","serviceName"]).has(e)?t:`${e}: ${t}`}function aw(e){const[t,n]=K(e.query),[r,s]=K(!1),[o,i]=K(!1);let a,l;ze(()=>n(e.query)),ze(()=>{t().length>0&&e.results.length>0?s(!0):s(!1)});const{collection:u,set:A}=zv({initialItems:[],itemToString:h=>Ha(h.key,h.value),itemToValue:h=>`${h.spanId}-${h.key}`});ze(()=>A(e.results.slice(0,Ga)));const c=h=>{h.reason==="input-change"&&(n(h.inputValue),a&&clearTimeout(a),a=window.setTimeout(()=>{e.onQueryChange(h.inputValue)},200))},g=h=>{h.open||(s(!1),e.onResultHover?.(null))},d=h=>{const p=h.items[0];p&&(e.onResultSelect(p.spanId),s(!1),e.onResultHover?.(null))},f=h=>{e.onResultHover?.(h.highlightedItem?.spanId??null)},m=()=>{n(""),s(!1),a&&clearTimeout(a),e.onClear(),e.onResultHover?.(null)};return dn(()=>{const h=p=>{p.key==="/"&&!o()&&!(p.target instanceof HTMLInputElement)&&!(p.target instanceof HTMLTextAreaElement)&&(p.preventDefault(),l?.focus())};document.addEventListener("keydown",h),Te(()=>document.removeEventListener("keydown",h))}),Te(()=>{a&&clearTimeout(a)}),v(St.Root,{get collection(){return u()},get inputValue(){return t()},onInputValueChange:c,onOpenChange:g,onValueChange:d,onHighlightChange:f,get open(){return r()},allowCustomValue:!0,selectionBehavior:"preserve",multiple:!1,get children(){return[v(St.Control,{class:"relative flex items-center",get children(){return[(()=>{var h=tw();return O(h,v(qv,{size:16,class:"text-gray-400"})),h})(),v(St.Input,{ref(h){var p=l;typeof p=="function"?p(h):l=h},onFocus:()=>i(!0),onBlur:()=>i(!1),class:`w-full pl-9 pr-8 py-1.5 text-sm border border-gray-300 rounded-md
12
12
  bg-gray-50 focus:bg-white
13
13
  focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent`,get placeholder(){return e.placeholder||"Search spans..."}}),v(Z,{get when(){return Ot(()=>!o())()&&!t()},get children(){return nw()}}),v(Z,{get when(){return t()},get children(){return v(St.ClearTrigger,{onClick:m,class:"absolute right-2 top-1/2 -translate-y-1/2 p-1 hover:bg-gray-200 rounded",title:"Clear search",get children(){return v(Zv,{size:14,class:"text-gray-500"})}})}})]}}),v(zA,{get children(){return v(St.Positioner,{get children(){return v(St.Content,{class:"mt-1 bg-white border border-gray-300 rounded-md shadow-lg max-h-96 overflow-y-auto z-50",get children(){return v(Z,{get when(){return u().items.length>0},get fallback(){return v(Z,{get when(){return t()},get children(){return sw()}})},get children(){return[v(_e,{get each(){return u().items},children:h=>v(St.Item,{item:h,class:`w-full text-left px-4 py-2 border-b border-gray-100 last:border-b-0
14
14
  data-[highlighted]:bg-blue-50 cursor-pointer`,get children(){return[v(St.ItemText,{class:"text-sm font-mono",get children(){return iw(Ha(h.key,h.value),h.ranges)}}),(()=>{var p=ow();return O(p,()=>h.spanTitle),p})()]}})}),v(Z,{get when(){return e.results.length>Ga},get children(){var h=rw(),p=h.firstChild,E=p.nextSibling;return E.nextSibling,O(h,()=>e.results.length,E),h}})]}})}})}})}})]}})}var lw=P('<div class="flex-shrink-0 border-b border-gray-200 bg-white px-4 py-3"><div class="flex items-center gap-4"><span></span><div class="flex-1 min-w-0"><div class="flex items-baseline gap-2"><span data-testid=test-name class="font-semibold text-gray-900 truncate"></span></div><div class="flex items-center gap-3 text-xs text-gray-500"><span class="font-mono truncate">:</span><span class=text-gray-300>|</span><span class=font-mono>ms</span><span></span></div></div><div class=w-80></div><div class="flex-shrink-0 text-right min-w-[140px]">'),cw=P('<span class="text-gray-500 text-sm truncate"> <span class=text-gray-400>›'),Aw=P('<div><div class="text-sm font-mono text-gray-300">--</div><div class="text-xs font-mono text-gray-200">--'),uw=P('<div><div class="text-sm font-mono text-blue-600">ms</div><div class="text-xs font-mono text-gray-400">');function gw(e){const{testInfo:t}=e,n=pc(),r=()=>{const u=BigInt(t.startTimeUnixNano),A=BigInt(t.endTimeUnixNano);return Number((A-u)/BigInt(1e6))},s=()=>{switch(t.status){case"passed":return"text-green-600";case"failed":return"text-red-600";case"skipped":return"text-yellow-600";case"timedOut":return"text-orange-600";case"interrupted":return"text-orange-600";default:return"text-gray-500"}},o=()=>{switch(t.status){case"passed":return"✓";case"failed":return"✗";case"skipped":return"○";case"timedOut":return"⏱";case"interrupted":return"⚠";default:return"?"}},i=()=>{const u=BigInt(t.startTimeUnixNano),A=Number(u/BigInt(1e6));return new Date(A)},a=u=>{const A=new Date(i().getTime()+u),c=A.toLocaleDateString(void 0,{month:"short",day:"numeric"}),g=A.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),d=A.getMilliseconds().toString().padStart(3,"0");return`${c}, ${g}.${d}`},l=u=>{e.onSpanSelect?.(u)};return(()=>{var u=lw(),A=u.firstChild,c=A.firstChild,g=c.nextSibling,d=g.firstChild,f=d.firstChild,m=d.nextSibling,h=m.firstChild,p=h.firstChild,E=h.nextSibling,B=E.nextSibling,C=B.firstChild,x=B.nextSibling,I=g.nextSibling,w=I.nextSibling;return O(c,o),O(d,(()=>{var y=Ot(()=>t.describes.length>0);return()=>y()&&(()=>{var S=cw(),Q=S.firstChild;return O(S,()=>t.describes.join(" › "),Q),S})()})(),f),O(f,()=>t.name),O(h,()=>t.file,p),O(h,()=>t.line,null),O(B,r,C),O(x,()=>t.status),O(I,v(aw,{get results(){return n.results()},get query(){return n.query()},get onQueryChange(){return n.setQuery},get onClear(){return n.clearSearch},onResultSelect:l,get onResultHover(){return e.onSpanHover}})),O(w,v(Z,{get when(){return e.hoverTimeMs()},get fallback(){return Aw()},children:y=>(()=>{var S=uw(),Q=S.firstChild,D=Q.firstChild,R=Q.nextSibling;return O(Q,()=>Math.round(y()),D),O(R,()=>a(y())),S})()})),$(y=>{var S=`text-xl ${s()}`,Q=s();return S!==y.e&&Tt(c,y.e=S),Q!==y.t&&Tt(x,y.t=Q),y},{e:void 0,t:void 0}),u})()}var dw=P("<div class=h-full>"),fw=P('<div class="flex-shrink-0 border-t border-gray-300">'),hw=P('<div class="absolute top-0 bottom-0 bg-blue-500/20 border-x-2 border-blue-500 pointer-events-none z-40">'),mw=P('<div class="absolute top-0 bottom-0 w-px bg-blue-400 pointer-events-none z-45">'),pw=P('<div class="absolute top-0 bottom-0 w-px bg-blue-500 pointer-events-none z-50">'),Ew=P('<div class="flex flex-col h-full relative"><div class="flex-1 min-h-0 relative flex flex-col"><div class="flex-1 min-h-0">'),Bw=P('<div class="absolute top-0 bottom-0 bg-blue-600 pointer-events-none z-50"style=width:3px;margin-left:-1px>'),Iw=P('<div class="flex flex-col h-full w-full bg-white text-gray-900"><div class="flex-1 min-h-0">');const Mr={screenshots:"Screenshots",steps:"Steps Timeline",browser:"Browser Spans",external:"External Spans"},Tr={screenshots:"No screenshots were captured during this test",steps:"No test steps were recorded",browser:"No browser spans were captured",external:"No external spans were captured"},vw=.2,ww=50;function no(e){return e.map(t=>({id:t.id,name:t.title,startOffset:t.startOffsetMs,duration:t.durationMs,parentId:t.parentId}))}function Cw(e){const t=lh(()=>e.traceInfo),n=()=>t.totalDurationMs(),r=()=>{const s=BigInt(e.traceInfo.testInfo.startTimeUnixNano);return Number(s/BigInt(1e6))};return v(hh,{durationMs:n,testStartTimeMs:r,get children(){return v(ep,{spans:()=>[...t.steps(),...t.browserSpans(),...t.externalSpans()],get children(){return v(Gm,{steps:()=>t.steps(),spans:()=>[...t.browserSpans(),...t.externalSpans()],get screenshots(){return e.traceInfo.screenshots},testStartTimeMs:r,get children(){return v(yw,{get traceInfo(){return e.traceInfo},traceData:t,testStartTimeMs:r})}})}})}})}function yw(e){const{viewport:t,setViewport:n,zoomToRange:r,pan:s,reset:o}=fr(),[i,a]=K(null),[l,u]=K(null),[A,c]=K(null),[g,d]=K(null),[f,m]=K(null),[h,p]=K(null);let E;const B=_(()=>{const b=e.traceData.steps();return b.length===0?0:Tn(no(b)).totalRows}),C=_(()=>{const b=e.traceData.browserSpans();return b.length===0?0:Tn(no(b)).totalRows}),x=_(()=>{const b=e.traceData.externalSpans();return b.length===0?0:Tn(no(b)).totalRows}),I=()=>e.traceInfo.screenshots.length>0,w=()=>B()>0,y=()=>C()>0,S=()=>x()>0,Q=_(()=>{const b=[];return I()||b.push({id:"screenshots",title:Mr.screenshots,tooltip:Tr.screenshots}),w()||b.push({id:"steps",title:Mr.steps,tooltip:Tr.steps}),y()||b.push({id:"browser",title:Mr.browser,tooltip:Tr.browser}),S()||b.push({id:"external",title:Mr.external,tooltip:Tr.external}),b}),D=_(()=>{const b=ip({stepsDepth:B(),browserDepth:C(),externalDepth:x()}),M=[];return w()&&b.steps!==void 0&&M.push({id:"steps",initialSize:b.steps,minSize:15}),y()&&b.browser!==void 0&&M.push({id:"browser",initialSize:b.browser,minSize:15}),S()&&b.external!==void 0&&M.push({id:"external",initialSize:b.external,minSize:15}),M}),R=()=>D().length>0,T=b=>{if(b.button!==0||!E)return;const M=b.target,k=window.getComputedStyle(M);if(k.cursor==="col-resize"||k.cursor==="row-resize")return;const L=E.getBoundingClientRect(),F=(b.clientX-L.left)/L.width;F>=0&&F<=1&&m({startPosition:F,currentPosition:F})},G=b=>{if(!E)return;const M=E.getBoundingClientRect(),k=(b.clientX-M.left)/M.width,L=f();if(L){const j=Math.max(0,Math.min(1,k));m({startPosition:L.startPosition,currentPosition:j})}const F=b.target,H=window.getComputedStyle(F);if(H.cursor==="col-resize"||H.cursor==="row-resize"){a(null);return}k>=0&&k<=1?a(k):a(null)},re=()=>{const b=f();if(b){const M=on(Math.min(b.startPosition,b.currentPosition),t()),k=on(Math.max(b.startPosition,b.currentPosition),t()),F=(t().visibleEndMs-t().visibleStartMs)*.02;k-M>F?r(M,k):(u(b.startPosition),d(A())),m(null)}},ue=()=>{a(null)};dn(()=>{const b=()=>re();document.addEventListener("mouseup",b),Te(()=>{document.removeEventListener("mouseup",b)})});const ie=b=>{n(b)},Ce=b=>{if(!E)return;if(Math.abs(b.deltaX)>Math.abs(b.deltaY)){b.preventDefault();const k=t().visibleEndMs-t().visibleStartMs,L=b.deltaX*vw*k/100;s(L)}},fe=()=>{u(null),d(null),o()},He=b=>{b&&c({type:"screenshot",id:b})},ot=b=>{b&&c({type:"step",id:b})},Ze=b=>{b&&c({type:"span",id:b})},kt=b=>{const k=[...e.traceData.steps(),...e.traceData.browserSpans(),...e.traceData.externalSpans()].find(L=>L.id===b);if(k){const L=lt(k.startOffsetMs,t()),F=Math.max(0,Math.min(1,L));u(F);const H=k.name==="playwright.test"||k.name==="playwright.test.step";d({type:H?"step":"span",id:b})}},_t=b=>{if(p(b),!b){a(null),c(null);return}const k=[...e.traceData.steps(),...e.traceData.browserSpans(),...e.traceData.externalSpans()].find(L=>L.id===b);if(k){if(us(k.startOffsetMs,k.startOffsetMs+k.durationMs,t())){const H=lt(k.startOffsetMs,t());a(Math.max(0,Math.min(1,H)))}const F=k.name==="playwright.test"||k.name==="playwright.test.step";c({type:F?"step":"span",id:b})}},N=()=>{const b=i();return b===null?null:on(b,t())},U=()=>{const b=l();return b===null?null:on(b,t())},X=()=>{const b=l(),M=i();if(b===null||M===null||!E)return!1;const k=E.getBoundingClientRect().width,L=b*k,F=M*k;return Math.abs(F-L)<=ww},ee=_(()=>{const b=N();return b===null?null:es(b,e.traceData.steps(),[...e.traceData.browserSpans(),...e.traceData.externalSpans()],e.traceInfo.screenshots,e.testStartTimeMs())}),Y=_(()=>{const b=U();return b===null?null:es(b,e.traceData.steps(),[...e.traceData.browserSpans(),...e.traceData.externalSpans()],e.traceInfo.screenshots,e.testStartTimeMs())}),z=()=>l()!==null&&(i()===null||X())?Y():ee(),se=()=>l()!==null&&(i()===null||X())?U():N(),xe=()=>l()!==null?i()===null||X()?g():A()??g():A(),Re=()=>{const b=f();return b?Math.min(b.startPosition,b.currentPosition)*100:0},ge=()=>{const b=f();return b?Math.abs(b.currentPosition-b.startPosition)*100:0},Ee=()=>{const b=pc(),M=L=>{switch(L){case"steps":return v(Nm,{get steps(){return e.traceData.steps()},onStepHover:ot,get matchedSpanIds(){return b.matchedSpanIds()},get hoveredSearchSpanId(){return h()}});case"browser":return v(em,{get spans(){return e.traceData.browserSpans()},onSpanHover:Ze,get matchedSpanIds(){return b.matchedSpanIds()},get hoveredSearchSpanId(){return h()}});case"external":return v(Dm,{get spans(){return e.traceData.externalSpans()},onSpanHover:Ze,get matchedSpanIds(){return b.matchedSpanIds()},get hoveredSearchSpanId(){return h()}});default:return null}},k=D().map(L=>({...L,content:M(L.id)}));return k.length===0?null:k.length===1?(()=>{var L=dw();return O(L,()=>k[0].content),L})():v(sp,{direction:"vertical",panels:k})},Be=()=>(()=>{var b=Ew(),M=b.firstChild,k=M.firstChild;b.$$dblclick=fe,b.addEventListener("wheel",Ce),b.addEventListener("mouseleave",ue),b.$$mousemove=G,b.$$mousedown=T;var L=E;return typeof L=="function"?hn(L,b):E=b,O(b,v(Z,{get when(){return e.traceData.isLoading()},get children(){return v(Om,{get loaded(){return e.traceData.progress().loaded},get total(){return e.traceData.progress().total}})}}),M),O(b,v(Dp,{get durationMs(){return e.traceData.totalDurationMs()},get viewport(){return t()},get hoverPosition(){return i()},onViewportChange:ie}),M),O(k,v(Z,{get when(){return Ot(()=>!!I())()&&R()},get fallback(){return v(Z,{get when(){return I()},get fallback(){return v(Z,{get when(){return R()},get children(){return v(Ee,{})}})},get children(){return v(ea,{get screenshots(){return e.traceInfo.screenshots},get viewport(){return t()},get testStartTimeMs(){return e.testStartTimeMs()},onScreenshotHover:He})}})},get children(){return v(Xi,{direction:"vertical",initialFirstPanelSize:12,minFirstPanelSize:7,maxFirstPanelSize:40,get firstPanel(){return v(ea,{get screenshots(){return e.traceInfo.screenshots},get viewport(){return t()},get testStartTimeMs(){return e.testStartTimeMs()},onScreenshotHover:He})},get secondPanel(){return v(Ee,{})}})}})),O(M,v(Z,{get when(){return Q().length>0},get children(){var F=fw();return O(F,v(_e,{get each(){return Q()},children:H=>v(Tm,{get title(){return H.title},disabled:!0,get disabledTooltip(){return H.tooltip}})})),F}}),null),O(M,v(Z,{get when(){return f()},get children(){var F=hw();return $(H=>{var j=`${Re()}%`,he=`${ge()}%`;return j!==H.e&&V(F,"left",H.e=j),he!==H.t&&V(F,"width",H.t=he),H},{e:void 0,t:void 0}),F}}),null),O(M,v(Z,{get when(){return l()},keyed:!0,children:F=>(()=>{var H=Bw();return V(H,"left",`${F*100}%`),H})()}),null),O(M,v(Z,{get when(){return Ot(()=>i()!==null&&l()!==null)()&&!X()},keyed:!0,get children(){var F=mw();return $(H=>V(F,"left",`${i()*100}%`)),F}}),null),O(M,v(Z,{get when(){return Ot(()=>i()!==null)()&&l()===null},keyed:!0,get children(){var F=pw();return $(H=>V(F,"left",`${i()*100}%`)),F}}),null),$(F=>V(b,"cursor",f()?"crosshair":void 0)),b})();return(()=>{var b=Iw(),M=b.firstChild;return O(b,v(gw,{get testInfo(){return e.traceInfo.testInfo},hoverTimeMs:se,onSpanSelect:kt,onSpanHover:_t}),M),O(M,v(Xi,{direction:"horizontal",initialFirstPanelSize:75,minFirstPanelSize:50,maxFirstPanelSize:90,get firstPanel(){return v(Be,{})},get secondPanel(){return v(Im,{get traceInfo(){return e.traceInfo},get hoveredElements(){return z()},get testStartTimeMs(){return e.testStartTimeMs()},get focusedElement(){return xe()}})}})),b})()}fn(["mousedown","mousemove","dblclick"]);var xw=P('<div class="flex h-screen w-screen">'),bw=P("<div><h1>Error</h1><p></p><button type=button>Try Again");function Sw(){const[e,t]=yf();return v(SA,{fallback:(n,r)=>(()=>{var s=bw(),o=s.firstChild,i=o.nextSibling,a=i.nextSibling;return O(i,()=>n.message),Dn(a,"click",r,!0),s})(),get children(){var n=xw();return O(n,v(Z,{get when(){return e()},get fallback(){return v(qA,{setTraceSource:t})},children:r=>v(vf,{get source(){return r()},children:s=>v(Cw,{traceInfo:s})})})),n}})}fn(["click"]);const oA=document.getElementById("root");if(!oA)throw new Error("Root element not found");NA(()=>v(Sw,{}),oA);
package/dist/index.html CHANGED
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/assets/traceviewer-Ccrh8m-6.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Playwright OpenTelemetry Trace Viewer</title>
8
- <script type="module" crossorigin src="/assets/index-Bi9aZ9qp.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-BOOvGlP8.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-CKa3IAGr.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playwright-opentelemetry/trace-viewer",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "type": "module",
5
5
  "description": "Playwright OpenTelemetry Trace Viewer - A web application for viewing Playwright Opentelemetry test traces",
6
6
  "bin": "./bin/serve.js",
@@ -40,13 +40,13 @@
40
40
  "vite-plugin-pwa": "^1.2.0",
41
41
  "vite-plugin-solid": "^2.11.10",
42
42
  "vitest": "^3.2.4",
43
- "@playwright-opentelemetry/trace-api": "0.3.2"
43
+ "@playwright-opentelemetry/trace-api": "0.3.4"
44
44
  },
45
45
  "scripts": {
46
46
  "dev": "vite",
47
47
  "build": "tsc && vite build",
48
48
  "preview": "vite preview",
49
- "test:e2e": "pnpm --filter ../reporter build && playwright test",
49
+ "test:e2e": "playwright test",
50
50
  "deploy": "pnpx wrangler deploy"
51
51
  }
52
52
  }