sessiongraph-app-win32-x64 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,163 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/scene-DHluV79M.js","assets/three-B4kj4iLH.js"])))=>i.map(i=>d[i]);
2
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&s(i)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();const Vc="modulepreload",Nc=function(e){return"/"+e},mi={},Ra=function(t,n,s){let r=Promise.resolve();if(n&&n.length>0){let c=function(l){return Promise.all(l.map(p=>Promise.resolve(p).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),a=i?.nonce||i?.getAttribute("nonce");r=c(n.map(l=>{if(l=Nc(l),l in mi)return;mi[l]=!0;const p=l.endsWith(".css"),u=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const f=document.createElement("link");if(f.rel=p?"stylesheet":Vc,p||(f.as="script"),f.crossOrigin="",f.href=l,a&&f.setAttribute("nonce",a),document.head.appendChild(f),p)return new Promise((h,g)=>{f.addEventListener("load",h),f.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(i){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i}return r.then(i=>{for(const a of i||[])a.status==="rejected"&&o(a.reason);return t().catch(o)})};const Pa=(e,t,n=[])=>{const s=document.createElementNS("http://www.w3.org/2000/svg",e);return Object.keys(t).forEach(r=>{s.setAttribute(r,String(t[r]))}),n.length&&n.forEach(r=>{const o=Pa(...r);s.appendChild(o)}),s};var Va=([e,t,n])=>Pa(e,t,n);const Fc=e=>Array.from(e.attributes).reduce((t,n)=>(t[n.name]=n.value,t),{}),Hc=e=>typeof e=="string"?e:!e||!e.class?"":e.class&&typeof e.class=="string"?e.class.split(" "):e.class&&Array.isArray(e.class)?e.class:"",_c=e=>e.flatMap(Hc).map(n=>n.trim()).filter(Boolean).filter((n,s,r)=>r.indexOf(n)===s).join(" "),Bc=e=>e.replace(/(\w)(\w*)(_|-|\s*)/g,(t,n,s)=>n.toUpperCase()+s.toLowerCase()),vi=(e,{nameAttr:t,icons:n,attrs:s})=>{const r=e.getAttribute(t);if(r==null)return;const o=Bc(r),i=n[o];if(!i)return console.warn(`${e.outerHTML} icon name was not found in the provided icons object.`);const a=Fc(e),[c,l,p]=i,u={...l,"data-lucide":r,...s,...a},f=_c(["lucide",`lucide-${r}`,a,s]);f&&Object.assign(u,{class:f});const h=Va([c,u,p]);return e.parentNode?.replaceChild(h,e)};const z={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const jc=["svg",z,[["path",{d:"M5 12h14"}],["path",{d:"m12 5 7 7-7 7"}]]];const Wc=["svg",z,[["path",{d:"M7 7h10v10"}],["path",{d:"M7 17 17 7"}]]];const Uc=["svg",z,[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}],["path",{d:"m3.3 7 8.7 5 8.7-5"}],["path",{d:"M12 22V12"}]]];const qc=["svg",z,[["path",{d:"m6 9 6 6 6-6"}]]];const Gc=["svg",z,[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}],["path",{d:"M12 17h.01"}]]];const Yc=["svg",z,[["circle",{cx:"12",cy:"12",r:"10"}],["polyline",{points:"12 6 12 12 16 14"}]]];const Kc=["svg",z,[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}]]];const zc=["svg",z,[["circle",{cx:"12",cy:"12",r:"10"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18"}]]];const Zc=["svg",z,[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5"}],["path",{d:"M3 12A9 3 0 0 0 21 12"}]]];const Jc=["svg",z,[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}],["path",{d:"m5 12-3 3 3 3"}],["path",{d:"m9 18 3-3-3-3"}]]];const Xc=["svg",z,[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"}]]];const Qc=["svg",z,[["line",{x1:"6",x2:"6",y1:"3",y2:"15"}],["circle",{cx:"18",cy:"6",r:"3"}],["circle",{cx:"6",cy:"18",r:"3"}],["path",{d:"M18 9a9 9 0 0 1-9 9"}]]];const ed=["svg",z,[["circle",{cx:"12",cy:"18",r:"3"}],["circle",{cx:"6",cy:"6",r:"3"}],["circle",{cx:"18",cy:"6",r:"3"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9"}],["path",{d:"M12 12v3"}]]];const td=["svg",z,[["circle",{cx:"12",cy:"5",r:"1"}],["circle",{cx:"19",cy:"5",r:"1"}],["circle",{cx:"5",cy:"5",r:"1"}],["circle",{cx:"12",cy:"12",r:"1"}],["circle",{cx:"19",cy:"12",r:"1"}],["circle",{cx:"5",cy:"12",r:"1"}],["circle",{cx:"12",cy:"19",r:"1"}],["circle",{cx:"19",cy:"19",r:"1"}],["circle",{cx:"5",cy:"19",r:"1"}]]];const nd=["svg",z,[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56"}]]];const sd=["svg",z,[["circle",{cx:"12",cy:"16",r:"1"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3"}]]];const rd=["svg",z,[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"}],["path",{d:"M12 12V8"}]]];const od=["svg",z,[["circle",{cx:"12",cy:"12",r:"3"}],["circle",{cx:"19",cy:"5",r:"2"}],["circle",{cx:"5",cy:"19",r:"2"}],["path",{d:"M10.4 21.9a10 10 0 0 0 9.941-15.416"}],["path",{d:"M13.5 2.1a10 10 0 0 0-9.841 15.416"}]]];const id=["svg",z,[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M15 3v18"}]]];const ad=["svg",z,[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M3 9h18"}],["path",{d:"M9 21V9"}]]];const ld=["svg",z,[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1"}]]];const cd=["svg",z,[["polygon",{points:"6 3 20 12 6 21 6 3"}]]];const dd=["svg",z,[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}],["path",{d:"M8 16H3v5"}]]];const ud=["svg",z,[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}],["path",{d:"M3 3v5h5"}]]];const fd=["svg",z,[["circle",{cx:"11",cy:"11",r:"8"}],["path",{d:"m21 21-4.3-4.3"}]]];const hd=["svg",z,[["path",{d:"M20 7h-9"}],["path",{d:"M14 17H5"}],["circle",{cx:"17",cy:"17",r:"3"}],["circle",{cx:"7",cy:"7",r:"3"}]]];const pd=["svg",z,[["line",{x1:"21",x2:"14",y1:"4",y2:"4"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22"}]]];const Na=["svg",z,[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"}],["path",{d:"M20 3v4"}],["path",{d:"M22 5h-4"}],["path",{d:"M4 17v2"}],["path",{d:"M5 18H3"}]]];const gd=["svg",z,[["polyline",{points:"4 17 10 11 4 5"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19"}]]];const Fa=["svg",z,[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"}],["path",{d:"M16 9a5 5 0 0 1 0 6"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728"}]]];const md=["svg",z,[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15"}]]];const vd=["svg",z,[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]]];const yd=({icons:e={},nameAttr:t="data-lucide",attrs:n={}}={})=>{if(!Object.values(e).length)throw new Error(`Please provide an icons object.
3
+ If you want to use all the icons you can import it like:
4
+ \`import { createIcons, icons } from 'lucide';
5
+ lucide.createIcons({icons});\``);if(typeof document>"u")throw new Error("`createIcons()` only works in a browser environment.");const s=document.querySelectorAll(`[${t}]`);if(Array.from(s).forEach(r=>vi(r,{nameAttr:t,icons:e,attrs:n})),t==="data-lucide"){const r=document.querySelectorAll("[icon-name]");r.length>0&&(console.warn("[Lucide] Some icons were found with the now deprecated icon-name attribute. These will still be replaced for backwards compatibility, but will no longer be supported in v1.0 and you should switch to data-lucide"),Array.from(r).forEach(o=>vi(o,{nameAttr:"icon-name",icons:e,attrs:n})))}},yi=["#b0e9d6","#8eaff4","#d7a1f1","#eac594","#8cdbdf","#e7a3b8","#a8ca91"];function $n(e){let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return t=Math.imul(t^t>>>16,2246822507),t=Math.imul(t^t>>>13,3266489909),t^=t>>>16,(t>>>0)/4294967295}function jn(e){return e.replace(/\/$/,"").split("/").at(-1)||"/"}const on=e=>Math.max(e.created,e.activity?.lastMessageAt||e.created),Gr=(e,t)=>{const n=t.timeFrame||t;return(e-n.start)/Math.max(1,n.end-n.start)*300-150},Iv=(e,t)=>Gr(t.start+(t.end-t.start)*e,t),$o=(e,t)=>[t,e.position[1],e.position[2]],Tv=(e,t)=>$o(e,Math.max(e.startPosition[0],Math.min(t,e.position[0]))),Cv=(e,t)=>[$o(e,Math.max(e.startPosition[0],Math.min(t.startPosition[0],e.position[0]))),t.startPosition];function bd(e,t,n){if(!e.length)return{nodes:[],edges:[],lanes:[],start:0,end:0};const s=[...e].sort((b,T)=>b.created-T.created||b.id.localeCompare(T.id)),r=s[0].created,o=s.reduce((b,T)=>Math.max(b,on(T)),r+36e5),i=n?.nodes.length?n.timeFrame||{start:n.start,end:n.end}:{start:r,end:o},a=new Map;for(const b of s){const T=`${b.projectID}:${b.directory}`,M=a.get(T)||[];M.push(b),a.set(T,M)}const c=[...a].sort((b,T)=>T[1].length-b[1].length||b[0].localeCompare(T[0])),l=new Map(n?.lanes.map((b,T)=>[b.key,b.slot??T]));let p=Math.max(-1,...l.values())+1;for(const[b]of c)l.has(b)||l.set(b,p++);c.sort((b,T)=>l.get(b[0])-l.get(T[0]));const u=[],f=[];c.forEach(([b,T])=>{const M=l.get(b),x=M*2.399963,C=M===0?0:15+Math.sqrt(M)*14,w=Math.cos(x)*C,$=Math.sin(x)*C*.7,R=yi[M%yi.length],L=t.find(D=>D.id===T[0].projectID),E=T[0].directory,O={key:b,slot:M,label:jn(E),color:R,kind:L?.worktrees.includes(E)?"worktree":"directory",y:w,z:$,nodes:[]};for(const D of T){const V=Gr(on(D),i),H=Gr(D.created,i),Z=$n(D.id),W=!!(D.parentID||D.forkID)?12:6,U=Math.sin((H+150)/65+M*.7)*3.5,he={session:D,position:[V,w+U+(Z-.5)*W,$+($n(D.id+"z")-.5)*W],startPosition:[H,0,0],color:R,radius:.35+Math.min(.65,Math.log10(1+(D.tokens||0))*.08)};f.push(he),O.nodes.push(he)}u.push(O)});const h=new Set(s.map(b=>b.id)),g=[];for(const b of s)b.forkID&&h.has(b.forkID)?g.push({from:b.forkID,to:b.id,kind:"fork"}):b.parentID&&h.has(b.parentID)&&g.push({from:b.parentID,to:b.id,kind:"child"});const d=new Map(f.map(b=>[b.session.id,b])),m=new Set;for(const b of n?.nodes||[]){const T=d.get(b.session.id);T&&T.session.projectID===b.session.projectID&&T.session.directory===b.session.directory&&(T.position[1]=b.position[1],T.position[2]=b.position[2],m.add(T.session.id))}function y(b,T=new Set){const M=b.session.id;if(m.has(M)||T.has(M))return;T.add(M);const x=b.session.forkID||b.session.parentID,C=x?d.get(x):void 0;if(C&&C.session.directory===b.session.directory){y(C,T);const w=$n(M+"branch")>.5?1:-1;b.position[1]=C.position[1]+w*(9+$n(M)*15),b.position[2]=C.position[2]+($n(M+"depth")-.5)*18}m.add(M)}return s.forEach(b=>y(d.get(b.id))),f.forEach(b=>{b.startPosition=$o(b,b.startPosition[0])}),{nodes:f,edges:g,lanes:u,start:r,end:o,timeFrame:i}}function wd(){const e=new AbortController,t={signal:e.signal};let n,s=innerWidth<760;function r(l,p,u){const f=Math.max(12,Math.min(p,innerWidth-l.offsetWidth-12)),h=Math.max(72,Math.min(u,innerHeight-l.offsetHeight-12));Object.assign(l.style,{left:`${f}px`,top:`${h}px`,right:"auto",bottom:"auto",transform:"none"}),l.dataset.positioned="true"}function o(){if(!n)return;const{panel:l,handle:p,pointerID:u}=n;n=void 0,l.classList.remove("dragging"),p.hasPointerCapture(u)&&p.releasePointerCapture(u)}document.addEventListener("pointerdown",l=>{if(l.button!==0)return;const p=l.target,u=p.closest(".floating-panel");if(!u)return;document.querySelectorAll(".floating-panel").forEach(g=>g.classList.toggle("front",g===u));const f=p.closest("[data-drag-panel]");if(!f)return;u.querySelectorAll(".custom-dates[open]").forEach(g=>{g.open=!1}),l.preventDefault(),f.focus({preventScroll:!0});const h=u.getBoundingClientRect();n={panel:u,handle:f,pointerID:l.pointerId,x:l.clientX,y:l.clientY,left:h.left,top:h.top},f.setPointerCapture(l.pointerId),u.classList.add("dragging")},t),document.addEventListener("pointermove",l=>{!n||l.pointerId!==n.pointerID||r(n.panel,n.left+l.clientX-n.x,n.top+l.clientY-n.y)},t),document.addEventListener("pointerup",o,t),document.addEventListener("pointercancel",o,t),document.addEventListener("lostpointercapture",o,t),document.addEventListener("keydown",l=>{const u=l.target.closest("[data-drag-panel]")?.closest(".floating-panel");if(!u||!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(l.key))return;l.preventDefault();const f=u.getBoundingClientRect(),h=l.shiftKey?40:10;r(u,f.left+(l.key==="ArrowLeft"?-h:l.key==="ArrowRight"?h:0),f.top+(l.key==="ArrowUp"?-h:l.key==="ArrowDown"?h:0))},t);const i=[...document.querySelectorAll(".floating-panel")],a=l=>{if(l.hidden||!l.dataset.positioned)return;const p=l.getBoundingClientRect();r(l,p.left,p.top)},c=new ResizeObserver(l=>l.forEach(p=>a(p.target)));return i.forEach(l=>c.observe(l)),window.addEventListener("resize",()=>{o(),s!==innerWidth<760?(s=innerWidth<760,i.forEach(l=>{l.removeAttribute("style"),delete l.dataset.positioned})):i.forEach(a)},t),()=>{o(),e.abort(),c.disconnect()}}const Ed=2,bi=e=>JSON.stringify([Ed,e.revision,e.updated,e.created,e.projectID,e.directory]),an=e=>e.normalize("NFKD").replace(new RegExp("\\p{M}","gu"),"").toLowerCase(),Io=e=>an(e).match(/[\p{L}\p{N}]+/gu)||[],xd=e=>Io(e).join(" ");function Sd(e){const t={text:"",terms:[],phrases:[],filters:[]},n=[];for(const s of e.slice(0,300).match(/(?:[^\s"]+|"[^"]*")+/g)||[]){const r=/^(source|project|dir|model|is|after|before|in):(.+)$/i.exec(s);if(r){const i=r[1].toLowerCase(),a=an(r[2].replace(/^"|"$/g,""));if(i==="in"){const c={title:["title"],files:["files"],messages:["body"],tools:["tools"]};t.fields=c[a],t.fields||(t.error="Use in:title, in:files, in:messages, or in:tools.")}else i==="is"&&!["fork","child","root","archived"].includes(a)?t.error="Use is:fork, is:child, is:root, or is:archived.":["after","before"].includes(i)&&(!/^\d{4}-\d{2}-\d{2}$/.test(a)||!Number.isFinite(Date.parse(a))||new Date(a).toISOString().slice(0,10)!==a)?t.error="Use a valid date in YYYY-MM-DD format.":t.filters.push([i,a]);continue}const o=s.replace(/^"|"$/g,"");s.startsWith('"')&&s.endsWith('"')&&t.phrases.push(xd(o)),n.push(o)}return t.text=n.join(" "),t.terms=Io(t.text).slice(0,12),t.text=t.terms.join(" "),t}function $d(e,t,n=220){const s=an(e),r=t.reduce((i,a)=>{const c=s.indexOf(a);return c<0?i:Math.min(i,c)},1/0),o=Number.isFinite(r)?Math.max(0,r-55):0;return`${o?"…":""}${e.slice(o,o+n).replace(/\s+/g," ").trim()}${e.length>o+n?"…":""}`}const Ha={opencode:{name:"OpenCode",icon:"opencode"},"claude-code":{name:"Claude Code",icon:"claude"},codex:{name:"Codex",icon:"openai"},cursor:{name:"Cursor",icon:"cursor"},gemini:{name:"Gemini CLI",icon:"gemini"},"qwen-code":{name:"Qwen Code",icon:"qwen"},pi:{name:"Pi",icon:"pi"},copilot:{name:"GitHub Copilot CLI",icon:"copilot"},cline:{name:"Cline",icon:"cline"},"roo-code":{name:"Roo Code",icon:"roo"},"kilo-code":{name:"Kilo Code",icon:"kilo"},continue:{name:"Continue",icon:"continue"}},We=e=>Ha[e||"opencode"]?.name||e||"Unknown",dt=e=>{const t=Ha[e||""]?.icon||"generic";return`<span class="source-icon source-icon-${t}" aria-hidden="true" style="--source-icon:url('/sources/${t}.svg')"></span>`},_a=e=>[...e].sort((t,n)=>Number(n.selected||n.available||n.sessions>0)-Number(t.selected||t.available||t.sessions>0)||t.name.localeCompare(n.name)),Ot=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]);function Ba(e,{checked:t=e.selected,disabled:n=!1,settings:s=!1}={}){const r=e.available?"Detected":"Not detected",o=[e.description,e.lastImport?`Last import ${new Date(e.lastImport).toLocaleString()}`:"Not imported yet",e.error].filter(Boolean).join(" · ");return`<label class="import-source" data-source="${Ot(e.id)}" title="${Ot(o)}"><input ${s?'class="settings-source"':""} type="checkbox" value="${Ot(e.id)}" aria-label="${Ot(e.name)}" aria-description="${Ot(`${r}. ${e.sessions.toLocaleString()} saved sessions. ${o}`)}" ${t?"checked":""} ${n?"disabled":""}/><span class="source-symbol">${dt(e.id)}</span><span class="source-copy"><strong>${Ot(e.name)}</strong><small class="source-meta"><span class="source-detected ${e.available?"detected":""}">${r}</span><span>${e.sessions.toLocaleString()} saved</span></small>${e.error?`<small class="source-error">${Ot(e.error)}</small>`:""}</span></label>`}const Se=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]);function In(e,t){const n=new Set(t.map(an));let s=0,r="";for(const o of e.matchAll(/[\p{L}\p{N}]+/gu)){r+=Se(e.slice(s,o.index));const i=an(o[0]),a=[...n].some(c=>i.startsWith(c));r+=a?`<mark>${Se(o[0])}</mark>`:Se(o[0]),s=o.index+o[0].length}return r+Se(e.slice(s))}function Id(e,t=()=>{},n){const s=new Worker(new URL("/assets/worker-YMPBjASm.js",import.meta.url),{type:"module"}),r=new AbortController,o={signal:r.signal},i=document.createElement("dialog");i.className="search-dialog",i.setAttribute("aria-label","Search sessions"),i.innerHTML=`
6
+ <div class="search-command"><span class="search-command-icon" aria-hidden="true">⌕</span><input id="session-query" type="search" placeholder="Search sessions, messages, files…" autocomplete="off" spellcheck="false" role="combobox" aria-label="Search all sessions" aria-autocomplete="list" aria-expanded="true" aria-controls="search-results"/><button class="icon-button search-close" aria-label="Close search" title="Close (Esc)">×</button></div>
7
+ <div class="search-options"><select id="search-scope" aria-label="Search scope" title="Switch scope (Alt+S)"><option value="all">All history</option><option value="view">Current view</option></select><button id="search-conversations" class="search-chip" aria-label="Index conversations" aria-pressed="true" title="Pause or resume background indexing. Indexed messages, tools, and files remain searchable.">Conversations</button><span id="search-index-state" role="status">Loading index…</span></div>
8
+ <div class="search-body"><div id="search-results" class="search-results" role="listbox" aria-label="Matching sessions"><div class="search-results-inner"></div></div><aside id="search-preview" class="search-preview" aria-label="Session preview"></aside></div>
9
+ <div class="search-footer"><span id="search-result-status" role="status">Loading sessions…</span><button id="search-more" hidden>More results</button><details class="search-syntax"><summary title="Search filters and cache">Filters</summary><div><code>project:sessiongraph</code><code>model:claude</code><code>in:files package.json</code><code>is:fork</code><code>after:2026-09-01</code><code>"exact phrase"</code><button id="search-clear-cache" title="Clear saved search text and pause indexing. Titles remain searchable; enable Conversations to rebuild.">Clear saved index</button></div></details><span class="search-keys"><kbd>↑↓</kbd> navigate <kbd>↵</kbd> open</span></div>`,document.body.append(i);const a=v=>i.querySelector(v),c=a("#session-query"),l=a("#search-results"),p=a(".search-results-inner"),u=a("#search-preview"),f=a("#search-scope");let h=new Map,g=new Map,d,m=[],y=0,b=0,T=0,M=80,x=0,C=0,w=0,$=!1,R=!1,L=!0,E,O=null,D,V=0,H="",Z="",se=!1;const W=new Map,U=86,he=v=>s.postMessage(v);function xn(){if(!E)return;const v=a("#search-index-state");v.textContent=E.storage==="restoring"?"Restoring saved index…":E.complete===E.total&&E.total?`Conversations ready${E.storage==="local"?" · saved locally":""}`:`${E.indexed.toLocaleString()} / ${E.total.toLocaleString()} conversations${L?E.active?" · indexing":" · partial":" · paused"}`,v.title=`Titles and metadata cover all ${E.total.toLocaleString()} imported sessions. ${E.complete.toLocaleString()} conversations have all supported text indexed. ${E.failed?`${E.failed} unavailable; toggle Conversations to retry. `:""}${E.limited?"Large histories are sampled; missing matches may be in unindexed text. ":""}${E.storage==="memory"?"Saving unavailable; search continues in memory.":`Saved in local SQLite. ${E.restored.toLocaleString()} conversations restored; unchanged pages are reused. Clear saved index under Filters. Imported sessions remain saved.`}`}function Ge(){if(p.style.height=`${m.length*U}px`,!m.length){p.innerHTML=`<div class="search-empty">${Se(Z||($?"Searching…":c.value?"No matching sessions":"No sessions available"))}</div>`,c.removeAttribute("aria-activedescendant");return}const v=Math.max(0,Math.floor(l.scrollTop/U)-3),I=Math.min(m.length,v+Math.ceil(l.clientHeight/U)+7);p.innerHTML=m.slice(v,I).map((N,Q)=>{const B=v+Q,q=h.get(N.id);if(!q)return"";const ae=`${We(q.source)} · ${g.get(q.projectID)||q.directory.split("/").at(-1)||"Global"} · ${new Date(q.updated).toLocaleDateString(void 0,{month:"short",day:"numeric"})}`;return`<div id="search-hit-${B}" class="search-result ${B===y?"active":""}" role="option" aria-selected="${B===y}" aria-posinset="${B+1}" aria-setsize="${b}" data-result-index="${B}" style="top:${B*U}px"><div class="search-result-title">${In(q.title,N.terms)}</div><div class="search-result-meta"><span>${dt(q.source)}${Se(ae)}</span><span class="match-kind">${Se(N.source)}</span></div>${N.excerpt?`<div class="search-result-excerpt">${In(N.excerpt,N.terms)}</div>`:`<div class="search-result-excerpt">${Se(q.model)}</div>`}</div>`}).join(""),y>=v&&y<I?c.setAttribute("aria-activedescendant",`search-hit-${y}`):c.removeAttribute("aria-activedescendant")}function Ye(v,I=!1,N=!1){const Q=m[y],B=Q&&h.get(Q.id);if(!B){u.innerHTML="";return}const q=Q.terms.length?Q.terms:Io(Sd(c.value).text),ae=v?.fragments.filter(oe=>{const Ne=an(oe.text);return q.length&&q.every(Fe=>Ne.includes(Fe))}).slice(0,4)||[],Le=v?.fragments.filter(oe=>["You","Assistant"].includes(oe.kind)).slice(0,5).reverse()||[],Ve=ae.length?ae:Le;if(u.innerHTML=`<div class="search-preview-heading"><span>${Se(g.get(B.projectID)||"Session")}</span><h2>${In(B.title,q)}</h2><p>${Se(B.model)} · ${new Date(B.created).toLocaleDateString()}</p><button class="secondary-button search-open">Explore session <span aria-hidden="true">↗</span></button></div>${Q.excerpt?`<section class="search-preview-section"><h3>Matching passage</h3><p>${In(Q.excerpt,q)}</p></section>`:""}<section class="search-preview-section"><h3>${ae.length?"Matching context":"Recent conversation"}</h3>${I?'<p class="preview-loading">Loading preview…</p>':N?'<p>Preview unavailable.</p><button class="text-button preview-retry">Retry</button>':Ve.length?Ve.map(oe=>`<article><span>${Se(oe.kind)}</span><p>${In($d(oe.text,q,360),q)}</p></article>`).join(""):"<p>No conversation text in this batch.</p>"}${v&&(v.nextCursor||v.truncated)?'<p class="preview-coverage">Recent messages · partial preview</p>':""}</section>`,u.querySelector(".search-open")?.addEventListener("click",Sn,o),n){const oe=document.createElement("button");oe.className="text-button search-launch",oe.innerHTML=`${dt(B.source)}Open in ${Se(We(B.source))} ↗`,oe.addEventListener("click",()=>n(B),o),u.querySelector(".search-preview-heading")?.append(oe)}u.querySelector(".preview-retry")?.addEventListener("click",()=>{H="",kt()},o)}function kt(){const v=m[y],I=v&&h.get(v.id),N=I?`${I.id}:${bi(I)}:${c.value}`:"";if(N===H)return;if(H=N,window.clearTimeout(V),D?.abort(),!I){Ye();return}const Q=`${I.id}:${bi(I)}`,B=W.get(Q);if(B){Ye(B);return}Ye(void 0,!0),V=window.setTimeout(async()=>{const q=new AbortController;D=q;try{const ae=await fetch(`/api/sessiongraph/session/${encodeURIComponent(I.id)}/content?updated=${I.updated}`,{signal:q.signal});if(!ae.ok)throw new Error("Preview unavailable");const Le=await ae.json();if(q.signal.aborted||N!==H)return;W.size>=25&&W.delete(W.keys().next().value),W.set(Q,Le),Ye(Le)}catch{!q.signal.aborted&&N===H&&Ye(void 0,!1,!0)}},90)}function Gt(){cancelAnimationFrame(x),$=!0,c.setAttribute("aria-busy","true");const v=++T;C=performance.now(),x=requestAnimationFrame(()=>he({type:"query",request:v,text:c.value,viewOnly:f.value==="view",limit:M}))}function vt(){y=0,se=!1,M=80,l.scrollTop=0,H="",Gt()}function At(v){if(!m.length)return;se=!0,y=Math.max(0,Math.min(m.length-1,y+v));const I=y*U;I<l.scrollTop?l.scrollTop=I:I+U>l.scrollTop+l.clientHeight&&(l.scrollTop=I+U-l.clientHeight),Ge(),kt()}function yt(){i.close(),t(!1),D?.abort(),window.clearTimeout(V),H="",O?.focus({preventScroll:!0})}function Sn(){const v=m[y];!v||$||(yt(),e(v.id))}function k(){i.open||(O=document.activeElement,i.showModal()),t(!0),c.focus({preventScroll:!0}),c.select(),Gt(),L&&he({type:"warm",enabled:!0})}s.onmessage=v=>{const I=v.data;if(I.type==="status"){E=I.status,xn();return}if(I.type==="error"){Z=I.message,$=!1,c.setAttribute("aria-busy","false"),Ge();return}if(I.request!==T)return;const N=m[y]?.id;w=$?performance.now()-C:w,$=!1,c.setAttribute("aria-busy","false"),m=I.hits,b=I.total,Z=I.error||"",y=Math.max(0,Math.min(m.length-1,se&&N?m.findIndex(Q=>Q.id===N):0)),a("#search-result-status").textContent=Z||`${b.toLocaleString()} ${c.value?"matches":"sessions"} · ${Math.round(I.elapsed)} ms`,a("#search-more").hidden=m.length>=b||M>=250,i.open&&(Ge(),kt())},s.onerror=()=>{Z="Search could not start. Reload to retry.",$=!1,Ge()},c.addEventListener("input",()=>{R||vt()},o),c.addEventListener("compositionstart",()=>{R=!0},o),c.addEventListener("compositionend",()=>{R=!1,vt()},o),f.addEventListener("change",vt,o),l.addEventListener("scroll",Ge,o),l.addEventListener("click",v=>{const I=v.target.closest("[data-result-index]");I&&(y=Number(I.dataset.resultIndex),se=!0,Ge(),kt(),c.focus())},o),l.addEventListener("dblclick",Sn,o),a("#search-more").addEventListener("click",()=>{M=Math.min(250,M+80),Gt()},o),a("#search-conversations").addEventListener("click",()=>{L=!L,a("#search-conversations").setAttribute("aria-pressed",String(L)),he({type:"warm",enabled:L}),xn()},o),a("#search-clear-cache").addEventListener("click",()=>{L=!1,a("#search-conversations").setAttribute("aria-pressed","false"),W.clear(),H="",D?.abort(),window.clearTimeout(V),a(".search-syntax").open=!1,he({type:"clear-cache"}),c.focus()},o),a(".search-close").addEventListener("click",yt,o),i.addEventListener("cancel",v=>{v.preventDefault(),yt()},o),i.addEventListener("keydown",v=>{v.stopPropagation(),!(R||v.isComposing)&&((v.key==="ArrowDown"||v.key==="ArrowUp")&&(v.preventDefault(),At(v.key==="ArrowDown"?1:-1)),(v.key==="PageDown"||v.key==="PageUp")&&(v.preventDefault(),At((v.key==="PageDown"?1:-1)*Math.max(1,Math.floor(l.clientHeight/U)))),v.key==="Enter"&&v.target===c&&(v.preventDefault(),Sn()),v.key==="Escape"&&(v.preventDefault(),yt()),v.key.toLowerCase()==="s"&&v.altKey&&(v.preventDefault(),f.value=f.value==="view"?"all":"view",f.dispatchEvent(new Event("change",{bubbles:!0}))))},o),document.addEventListener("keydown",v=>{if(i.open||document.querySelector("dialog[open]"))return;const I=v.target,N=I.isContentEditable||I.closest('input:not([type="range"]):not([type="checkbox"]):not([type="radio"]), textarea, select');(v.key==="/"&&!N&&!v.ctrlKey&&!v.metaKey&&!v.altKey||v.key.toLowerCase()==="k"&&(v.metaKey||v.ctrlKey))&&(v.preventDefault(),k())},o);const S=new ResizeObserver(()=>{i.open&&Ge()});return S.observe(l),{open:k,setData(v){d!==v.sourceID&&(W.clear(),H="",D?.abort(),window.clearTimeout(V)),d=v.sourceID,h=new Map(v.sessions.map(I=>[I.id,I])),g=new Map(v.projects.map(I=>[I.id,I.name])),he({type:"data",sessions:v.sessions,projects:v.projects,sourceID:d})},setScope(v){he({type:"scope",ids:v})},diagnostics:()=>({open:i.open,query:c.value,matches:b,renderedRows:p.querySelectorAll('[role="option"]').length,roundTripMs:w,pending:$,index:E}),dispose(){s.terminate(),r.abort(),S.disconnect(),D?.abort(),window.clearTimeout(V),cancelAnimationFrame(x),i.remove()}}}const Pn=[{id:"opencode",name:"OpenCode",command:"opencode"},{id:"claude-code",name:"Claude Code",command:"claude"},{id:"codex",name:"Codex",command:"codex"},{id:"cursor",name:"Cursor Agent",command:"cursor-agent"},{id:"gemini",name:"Gemini CLI",command:"gemini"},{id:"qwen-code",name:"Qwen Code",command:"qwen"},{id:"pi",name:"Pi",command:"pi"},{id:"copilot",name:"GitHub Copilot CLI",command:"copilot"}],yr=e=>Pn.some(t=>t.id===e),ja=e=>/^ses[a-zA-Z0-9_-]+$/.test(e);function Td(e,t){if(!ja(t))throw new Error("Invalid session ID.");const n=new URL(e);if(!["http:","https:"].includes(n.protocol)||n.username||n.password)throw new Error("Invalid OpenCode URL.");const s=btoa(String.fromCharCode(...new TextEncoder().encode(n.origin))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return`${n.origin}/server/${s}/session/${encodeURIComponent(t)}`}var Qt=(e,t=[])=>({parts:(...n)=>{if(Cd(t))return Qt(e,n);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...n)=>Qt(e,[...t,...n]),omit:(...n)=>Qt(e,t.filter(s=>!n.includes(s))),rename:n=>Qt(n,t),keys:()=>t,build:()=>[...new Set(t)].reduce((n,s)=>Object.assign(n,{[s]:{selector:[`&[data-scope="${Yt(e)}"][data-part="${Yt(s)}"]`,`& [data-scope="${Yt(e)}"][data-part="${Yt(s)}"]`].join(", "),attrs:{"data-scope":Yt(e),"data-part":Yt(s)}}}),{})}),Yt=e=>e.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),Cd=e=>e.length===0,kd=Qt("select").parts("label","positioner","trigger","indicator","clearTrigger","item","itemText","itemIndicator","itemGroup","itemGroupLabel","list","content","root","control","valueText"),pe=kd.build(),Ad=Object.defineProperty,Od=(e,t,n)=>t in e?Ad(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_=(e,t,n)=>Od(e,typeof t!="symbol"?t+"":t,n);function Ld(e){return e==null?[]:Array.isArray(e)?e:[e]}var Md=e=>e[e.length-1],Dd=(e,t)=>e.indexOf(t)!==-1,Rd=(e,...t)=>e.concat(t),Pd=(e,...t)=>e.filter(n=>!t.includes(n)),wi=(e,t)=>Dd(e,t)?Pd(e,t):Rd(e,t);function Ei(e,t){return e.reduce((n,s,r)=>(r%t===0?n.push([s]):Md(n)?.push(s),n),[])}var xi=e=>e?.constructor.name==="Array",Vd=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!mn(e[n],t[n]))return!1;return!0},mn=(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(xi(e)&&xi(t))return Vd(Array.from(e),Array.from(t));if(typeof e!="object"||typeof t!="object")return!1;const n=Object.keys(t??Object.create(null)),s=n.length;if(Object.keys(e).length!==s)return!1;for(let r=0;r<s;r++)if(!Reflect.has(e,n[r]))return!1;for(let r=0;r<s;r++){const o=n[r];if(!mn(e[o],t[o]))return!1}return!0},Nd=e=>Array.isArray(e),Wa=e=>e!=null&&typeof e=="object",br=e=>Wa(e)&&!Nd(e),Fd=e=>typeof e=="string",Ze=e=>typeof e=="function",Hd=e=>e==null,Ts=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),_d=e=>Object.prototype.toString.call(e),Ua=Function.prototype.toString,Bd=Ua.call(Object),Vn=e=>{if(!Wa(e)||_d(e)!="[object Object]"||Ud(e))return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const n=Ts(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Ua.call(n)==Bd},jd=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,Wd=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,Ud=e=>jd(e)||Wd(e),Si=(e,...t)=>(typeof e=="function"?e(...t):e)??void 0,qd=e=>e(),qa=()=>{},Fs=(...e)=>(...t)=>{e.forEach(function(n){n?.(...t)})};function Yr(e,t,...n){if(e in t){const r=t[e];return Ze(r)?r(...n):r}const s=new Error(`No matching key: ${JSON.stringify(e)} in ${JSON.stringify(Object.keys(t))}`);throw Error.captureStackTrace?.(s,Yr),s}var{min:Gd,max:Yd}=Math,Kd=e=>Number.isNaN(e),Ga=e=>Kd(e)?0:e,wr=(e,t,n)=>{const s=Ga(e),r=t==null||s>=t,o=n==null||s<=n;return r&&o},zd=(e,t,n)=>Gd(Yd(Ga(e),t),n);function To(e){if(!Vn(e)||e===void 0)return e;const t=Reflect.ownKeys(e).filter(s=>typeof s=="string"),n={};for(const s of t){const r=e[s];r!==void 0&&(n[s]=To(r))}return n}function Ya(e,t){if(!t)return e;const n={...e},s=t;for(const r in s){const o=s[r];o!==void 0&&(n[r]=o)}return n}function Cs(...e){e.length===1?e[0]:e[1],e.length===2&&e[0]}function $i(...e){e.length===1?e[0]:e[1],e.length===2&&e[0]}function Xs(e,t){if(e==null)throw new Error(t())}var ks={itemToValue(e){return typeof e=="string"?e:br(e)&&Ts(e,"value")?e.value:""},itemToString(e){return typeof e=="string"?e:br(e)&&Ts(e,"label")?e.label:ks.itemToValue(e)},isItemDisabled(e){return br(e)&&Ts(e,"disabled")?!!e.disabled:!1}},Ka=class za{constructor(t){_(this,"options",t),_(this,"items"),_(this,"indexMap",null),_(this,"copy",n=>new za({...this.options,items:n??[...this.items]})),_(this,"isEqual",n=>mn(this.items,n.items)),_(this,"setItems",n=>this.copy(n)),_(this,"getValues",(n=this.items)=>{const s=[];for(const r of n){const o=this.getItemValue(r);o!=null&&s.push(o)}return s}),_(this,"find",n=>{if(n==null)return null;const s=this.indexOf(n);return s!==-1?this.at(s):null}),_(this,"findMany",n=>{const s=[];for(const r of n){const o=this.find(r);o!=null&&s.push(o)}return s}),_(this,"at",n=>{if(!this.options.groupBy&&!this.options.groupSort)return this.items[n]??null;let s=0;const r=this.group();for(const[,o]of r)for(const i of o){if(s===n)return i;s++}return null}),_(this,"sortFn",(n,s)=>{const r=this.indexOf(n),o=this.indexOf(s);return(r??0)-(o??0)}),_(this,"sort",n=>[...n].sort(this.sortFn.bind(this))),_(this,"getItemValue",n=>n==null?null:this.options.itemToValue?.(n)??ks.itemToValue(n)),_(this,"getItemDisabled",n=>n==null?!1:this.options.isItemDisabled?.(n)??ks.isItemDisabled(n)),_(this,"stringifyItem",n=>n==null?null:this.options.itemToString?.(n)??ks.itemToString(n)),_(this,"stringify",n=>n==null?null:this.stringifyItem(this.find(n))),_(this,"stringifyItems",(n,s=", ")=>{const r=[];for(const o of n){const i=this.stringifyItem(o);i!=null&&r.push(i)}return r.join(s)}),_(this,"stringifyMany",(n,s)=>this.stringifyItems(this.findMany(n),s)),_(this,"has",n=>this.indexOf(n)!==-1),_(this,"hasItem",n=>n==null?!1:this.has(this.getItemValue(n))),_(this,"group",()=>{const{groupBy:n,groupSort:s}=this.options;if(!n)return[["",[...this.items]]];const r=new Map;this.items.forEach((i,a)=>{const c=n(i,a);r.has(c)||r.set(c,[]),r.get(c).push(i)});let o=Array.from(r.entries());return s&&o.sort(([i],[a])=>{if(typeof s=="function")return s(i,a);if(Array.isArray(s)){const c=s.indexOf(i),l=s.indexOf(a);return c===-1?1:l===-1?-1:c-l}return s==="asc"?i.localeCompare(a):s==="desc"?a.localeCompare(i):0}),o}),_(this,"getNextValue",(n,s=1,r=!1)=>{let o=this.indexOf(n);if(o===-1)return null;for(o=r?Math.min(o+s,this.size-1):o+s;o<=this.size&&this.getItemDisabled(this.at(o));)o++;return this.getItemValue(this.at(o))}),_(this,"getPreviousValue",(n,s=1,r=!1)=>{let o=this.indexOf(n);if(o===-1)return null;for(o=r?Math.max(o-s,0):o-s;o>=0&&this.getItemDisabled(this.at(o));)o--;return this.getItemValue(this.at(o))}),_(this,"indexOf",n=>{if(n==null)return-1;if(!this.options.groupBy&&!this.options.groupSort)return this.items.findIndex(s=>this.getItemValue(s)===n);if(!this.indexMap){this.indexMap=new Map;let s=0;const r=this.group();for(const[,o]of r)for(const i of o){const a=this.getItemValue(i);a!=null&&this.indexMap.set(a,s),s++}}return this.indexMap.get(n)??-1}),_(this,"getByText",(n,s)=>{const r=s!=null?this.indexOf(s):-1,o=n.length===1;for(let i=0;i<this.items.length;i++){const a=this.items[(r+i+1)%this.items.length];if(!(o&&this.getItemValue(a)===s)&&!this.getItemDisabled(a)&&Zd(this.stringifyItem(a),n))return a}}),_(this,"search",(n,s)=>{const{state:r,currentValue:o,timeout:i=350}=s,a=r.keysSoFar+n,l=a.length>1&&Array.from(a).every(g=>g===a[0])?a[0]:a,p=this.getByText(l,o),u=this.getItemValue(p);function f(){clearTimeout(r.timer),r.timer=-1}function h(g){r.keysSoFar=g,f(),g!==""&&(r.timer=+setTimeout(()=>{h(""),f()},i))}return h(a),u}),_(this,"update",(n,s)=>{let r=this.indexOf(n);return r===-1?this:this.copy([...this.items.slice(0,r),s,...this.items.slice(r+1)])}),_(this,"upsert",(n,s,r="append")=>{let o=this.indexOf(n);return o===-1?(r==="append"?this.append:this.prepend)(s):this.copy([...this.items.slice(0,o),s,...this.items.slice(o+1)])}),_(this,"insert",(n,...s)=>this.copy(Tn(this.items,n,...s))),_(this,"insertBefore",(n,...s)=>{let r=this.indexOf(n);if(r===-1)if(this.items.length===0)r=0;else return this;return this.copy(Tn(this.items,r,...s))}),_(this,"insertAfter",(n,...s)=>{let r=this.indexOf(n);if(r===-1)if(this.items.length===0)r=0;else return this;return this.copy(Tn(this.items,r+1,...s))}),_(this,"prepend",(...n)=>this.copy(Tn(this.items,0,...n))),_(this,"append",(...n)=>this.copy(Tn(this.items,this.items.length,...n))),_(this,"filter",n=>{const s=this.items.filter((r,o)=>n(this.stringifyItem(r),o,r));return this.copy(s)}),_(this,"remove",(...n)=>{const s=n.map(r=>typeof r=="string"?r:this.getItemValue(r));return this.copy(this.items.filter(r=>{const o=this.getItemValue(r);return o==null?!1:!s.includes(o)}))}),_(this,"move",(n,s)=>{const r=this.indexOf(n);return r===-1?this:this.copy(as(this.items,[r],s))}),_(this,"moveBefore",(n,...s)=>{let r=this.items.findIndex(i=>this.getItemValue(i)===n);if(r===-1)return this;let o=s.map(i=>this.items.findIndex(a=>this.getItemValue(a)===i)).sort((i,a)=>i-a);return this.copy(as(this.items,o,r))}),_(this,"moveAfter",(n,...s)=>{let r=this.items.findIndex(i=>this.getItemValue(i)===n);if(r===-1)return this;let o=s.map(i=>this.items.findIndex(a=>this.getItemValue(a)===i)).sort((i,a)=>i-a);return this.copy(as(this.items,o,r+1))}),_(this,"reorder",(n,s)=>this.copy(as(this.items,[n],s))),_(this,"compareValue",(n,s)=>{const r=this.indexOf(n),o=this.indexOf(s);return r<o?-1:r>o?1:0}),_(this,"range",(n,s)=>{let r=[],o=n;for(;o!=null;){if(this.find(o)&&r.push(o),o===s)return r;o=this.getNextValue(o)}return[]}),_(this,"getValueRange",(n,s)=>n&&s?this.compareValue(n,s)<=0?this.range(n,s):this.range(s,n):[]),_(this,"toString",()=>{let n="";for(const s of this.items){const r=this.getItemValue(s),o=this.stringifyItem(s),i=this.getItemDisabled(s),a=[r,o,i].filter(Boolean).join(":");n+=a+","}return n}),_(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}},Zd=(e,t)=>!!e?.toLowerCase().startsWith(t.toLowerCase());function Tn(e,t,...n){return[...e.slice(0,t),...n,...e.slice(t)]}function as(e,t,n){t=[...t].sort((r,o)=>r-o);const s=t.map(r=>e[r]);for(let r=t.length-1;r>=0;r--)e=[...e.slice(0,t[r]),...e.slice(t[r]+1)];return n=Math.max(0,n-t.filter(r=>r<n).length),[...e.slice(0,n),...s,...e.slice(n)]}function Za({values:e,collection:t,selectedItemMap:n}){const s=[];for(const r of e){const o=t.find(r)??n.get(r);o!=null&&s.push(o)}return s}function Ja({selectedItemMap:e,values:t,selectedItems:n,collection:s}){const r=new Map(e);for(const i of n){const a=s.getItemValue(i);a!=null&&r.set(a,i)}const o=new Set(t);for(const i of r.keys())o.has(i)||r.delete(i);return r}function ls({values:e,collection:t,selectedItemMap:n}){const s=Za({values:e,collection:t,selectedItemMap:n}),r=Ja({selectedItemMap:n,values:e,selectedItems:s,collection:t});return{selectedItems:s,nextSelectedItemMap:r}}function Jd({selectedItems:e,collection:t}){return Ja({selectedItemMap:new Map,values:e.map(n=>t.getItemValue(n)).filter(Boolean),selectedItems:e,collection:t})}var Hs=e=>new Ka(e);Hs.empty=()=>new Ka({items:[]});var Xd=Object.defineProperty,Qd=(e,t,n)=>t in e?Xd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Er=(e,t,n)=>Qd(e,typeof t!="symbol"?t+"":t,n),eu=(e,t)=>e.map((n,s)=>e[(Math.max(t,0)+s)%e.length]),_s=()=>{},Qs=e=>typeof e=="object"&&e!==null,P=e=>e?"":void 0,de=e=>e?"true":void 0,tu=1,nu=9,su=11,ce=e=>Qs(e)&&e.nodeType===tu&&typeof e.nodeName=="string",Co=e=>Qs(e)&&e.nodeType===nu,ru=e=>Qs(e)&&e===e.window,Xa=e=>ce(e)?e.localName||"":"#document";function ou(e){return["html","body","#document"].includes(Xa(e))}var Qa=e=>Qs(e)&&e.nodeType!==void 0,ln=e=>Qa(e)&&e.nodeType===su&&"host"in e,el=e=>ce(e)&&e.localName==="input",iu=e=>ce(e)?e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0:!1;function Kr(e){if(!e)return!1;const t=e.getRootNode();return er(t)===e}var au=/(textarea|select)/;function lu(e){if(e==null||!ce(e))return!1;try{return el(e)&&e.selectionStart!=null||au.test(e.localName)||e.isContentEditable||e.getAttribute("contenteditable")==="true"||e.getAttribute("contenteditable")===""}catch{return!1}}function cn(e,t){if(!e||!t||!ce(e)||!Qa(t))return!1;if(ce(t)&&e===t||e.contains(t))return!0;const n=t.getRootNode?.();if(n&&ln(n)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function Oe(e){return Co(e)?e:ru(e)?e.document:e?.ownerDocument??document}function cu(e){return Oe(e).documentElement}function fe(e){return ln(e)?fe(e.host):Co(e)?e.defaultView??window:ce(e)?e.ownerDocument?.defaultView??window:window}function er(e){let t=e.activeElement;for(;t?.shadowRoot;){const n=t.shadowRoot.activeElement;if(!n||n===t)break;t=n}return t}function Ii(e,t){return!e||e===Oe(e).body?!1:!t.some(n=>cn(n,e))}function du(e){if(Xa(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ln(e)&&e.host||cu(e);return ln(t)?t.host:t}function uu(e){let t;try{if(t=e.getRootNode({composed:!0}),Co(t)||ln(t))return t}catch{}return e.ownerDocument??document}var xr=new WeakMap;function tl(e){return xr.has(e)||xr.set(e,fe(e).getComputedStyle(e)),xr.get(e)}var ko=()=>typeof document<"u";function fu(){return navigator.userAgentData?.platform??navigator.platform}function hu(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}var Ao=e=>ko()&&e.test(fu()),pu=e=>ko()&&e.test(hu()),gu=/^iPhone/i,mu=/^iPad/i,vu=/^Mac/i,yu=/Android/i,Ti=()=>ko()&&!!navigator.maxTouchPoints,bu=()=>Ao(gu),wu=()=>Ao(mu)||Oo()&&navigator.maxTouchPoints>1,nl=()=>bu()||wu(),Oo=()=>Ao(vu),Eu=()=>pu(yu),xu=new Set(["menu","listbox","dialog","grid","tree","region","application"]),Su=e=>xu.has(e),$u=e=>e.getAttribute("aria-controls")?.split(" ")||[];function Iu(e,t){const n=new Set,s=uu(e),r=o=>{const i=o.querySelectorAll("[aria-controls]");for(const a of i){if(a.getAttribute("aria-expanded")!=="true")continue;const c=$u(a);for(const l of c){if(!l||n.has(l))continue;n.add(l);const p=s.getElementById(l);if(p){const u=p.getAttribute("role"),f=p.getAttribute("aria-modal")==="true";if(u&&Su(u)&&!f&&(p===t||p.contains(t)||r(p)))return!0}}}return!1};return r(e)}function Tu(e){return e.composedPath?.()??e.nativeEvent?.composedPath?.()}function ut(e){return Tu(e)?.[0]??e.target}function Cu(e){return Lo(e).isComposing||e.keyCode===229}function ku(e){return e.pointerType===""&&e.isTrusted?!0:Eu()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}var Au=e=>e.button===2||Oo()&&e.ctrlKey&&e.button===0,Ou={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"},Ci={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft"};function zr(e,t={}){const{dir:n="ltr",orientation:s="horizontal"}=t;let r=e.key;return r=Ou[r]??r,n==="rtl"&&s==="horizontal"&&r in Ci&&(r=Ci[r]),r}function Lo(e){return e.nativeEvent??e}var As=(e,t,n,s)=>{const r=typeof e=="function"?e():e;return r?.addEventListener(t,n,s),()=>{r?.removeEventListener(t,n,s)}};function Lu(e,t){const{type:n="HTMLInputElement",property:s="value"}=t,r=fe(e)[n].prototype;return Object.getOwnPropertyDescriptor(r,s)??{}}function Mu(e){if(e.localName==="input")return"HTMLInputElement";if(e.localName==="textarea")return"HTMLTextAreaElement";if(e.localName==="select")return"HTMLSelectElement"}function cs(e,t,n="value"){if(!e)return;const s=Mu(e);s&&Lu(e,{type:s,property:n}).set?.call(e,t),e.setAttribute(n,t)}function Du(e){return e.matches("textarea, input, select, button")}function Ru(e,t){if(!e)return;const n=Du(e)?e.form:e.closest("form"),s=r=>{r.defaultPrevented||t()};return n?.addEventListener("reset",s,{passive:!0}),()=>n?.removeEventListener("reset",s)}function Pu(e,t){const n=e?.closest("fieldset");if(!n)return;t(n.disabled);const s=fe(n),r=new s.MutationObserver(()=>t(n.disabled));return r.observe(n,{attributes:!0,attributeFilter:["disabled"]}),()=>r.disconnect()}function Vu(e,t){if(!e)return;const{onFieldsetDisabledChange:n,onFormReset:s}=t,r=[Ru(e,s),Pu(e,n)];return()=>r.forEach(o=>o?.())}var sl=Symbol.for("zag.changeEvent");function rl(e){return Object.prototype.hasOwnProperty.call(e,sl)}function Nu(e){return rl(e)||Object.defineProperty(e,sl,{value:!0}),e}var Fu=e=>ce(e)&&e.tagName==="IFRAME";function Hu(e){const t=e.getAttribute("tabindex");return t?parseInt(t,10):NaN}var _u=e=>Hu(e)<0;function Bu(e){return el(e)&&e.type==="radio"}function ju(e){if(!Bu(e)||!e.name||e.checked)return!0;const t=`input[type="radio"][name="${CSS.escape(e.name)}"]`,n=e.form??e.ownerDocument,s=Array.from(n.querySelectorAll(t)).filter(o=>o.form===e.form&&tr(o)),r=s.find(o=>o.checked);return r?r===e:s[0]===e}function Wu(e,t){if(!t)return null;if(t===!0)return e.shadowRoot||null;const n=t(e);return(n===!0?e.shadowRoot:n)||null}function Uu(e,t,n){const s=[...e],r=[...e],o=new Set,i=new Map;e.forEach((c,l)=>i.set(c,l));let a=0;for(;a<r.length;){const c=r[a++];if(!c||o.has(c))continue;o.add(c);const l=Wu(c,t);if(l){const p=Array.from(l.querySelectorAll(Mo)).filter(n),u=i.get(c);if(u!==void 0){const f=u+1;s.splice(f,0,...p),p.forEach((h,g)=>{i.set(h,f+g)});for(let h=f+p.length;h<s.length;h++)i.set(s[h],h)}else{const f=s.length;s.push(...p),p.forEach((h,g)=>{i.set(h,f+g)})}r.push(...p)}}return s}var Mo="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 tr(e){return!ce(e)||e.closest("[inert]")?!1:e.matches(Mo)&&iu(e)}function Do(e,t={}){if(!e)return[];const{includeContainer:n,getShadowRoot:s}=t,r=Array.from(e.querySelectorAll(Mo));n&&Sr(e)&&r.unshift(e);const o=[];for(const i of r)if(Sr(i)){if(Fu(i)&&i.contentDocument){const a=i.contentDocument.body;o.push(...Do(a,{getShadowRoot:s}));continue}o.push(i)}if(s){const i=Uu(o,s,Sr);return!i.length&&n?r:i}return!o.length&&n?r:o}function Sr(e){return ce(e)&&e.tabIndex>0?!0:!tr(e)||_u(e)?!1:ju(e)}function qu(e,t={}){const n=Do(e,t),s=n[0]||null,r=n[n.length-1]||null;return[s,r]}function Gu(e){const{root:t,getInitialEl:n,filter:s,enabled:r=!0}=e;if(!r)return!1;let o=typeof n=="function"?n():n;return o===!1?!1:(o||(o=t?.matches("[data-autofocus],[autofocus]")?t:t?.querySelector("[data-autofocus],[autofocus]")),o||(o=Do(t).filter(a=>s?s(a):!0).find(a=>!a.hasAttribute("data-no-autofocus"))),o||t||void 0)}function Yu(e){const t=e.currentTarget;if(!t)return!1;const[n,s]=qu(t);return!(Kr(n)&&e.shiftKey||Kr(s)&&!e.shiftKey||!n&&!s)}var ol=class il{constructor(){Er(this,"id",null),Er(this,"fn_cleanup"),Er(this,"cleanup",()=>{this.cancel()})}static create(){return new il}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 ue(e){const t=ol.create();return t.request(e),t.cleanup}function al(e){const t=new Set;function n(s){const r=globalThis.requestAnimationFrame(s);t.add(()=>globalThis.cancelAnimationFrame(r))}return n(()=>n(e)),function(){t.forEach(r=>r())}}var $r=new WeakMap;function Ku(e){const t={childList:!0,subtree:!0,attributes:e.attributes??(e.attributeOldValue!==void 0||e.attributeFilter!==void 0),characterData:e.characterData??e.characterDataOldValue!==void 0,attributeOldValue:!!e.attributeOldValue,characterDataOldValue:!!e.characterDataOldValue};return e.attributeFilter!==void 0&&(t.attributeFilter=[...new Set(e.attributeFilter)].sort()),t}function zu(e){const t=Ku(e),n=JSON.stringify(t);return{observe(s,r){const o=fe(s);if(typeof o.MutationObserver!="function")return _s;const i=$r.get(s)??new Map;let a=i.get(n);if(!a){const l=new Set,p=new o.MutationObserver(u=>{for(const f of[...l])if(l.has(f))try{f(u)}catch(h){o.queueMicrotask(()=>{throw h})}});p.observe(s,t),a={observer:p,listeners:l},i.set(n,a),$r.set(s,i)}const c=l=>r(l);return a.listeners.add(c),()=>{!a.listeners.delete(c)||a.listeners.size>0||(a.observer.disconnect(),i.delete(n),i.size===0&&$r.delete(s))}}}}function Zu(e,t){if(!e)return;const{attributes:n,callback:s}=t,r=e.ownerDocument.defaultView||window,o=new r.MutationObserver(i=>{for(const a of i)a.type==="attributes"&&a.attributeName&&n.includes(a.attributeName)&&s(a)});return o.observe(e,{attributes:!0,attributeFilter:n}),()=>o.disconnect()}function Ju(e,t){const n=ue,s=[];return s.push(n(()=>{const r=typeof e=="function"?e():e;s.push(Zu(r,t))})),()=>{s.forEach(r=>r?.())}}function Zr(e){const t=du(e);return ou(t)?Oe(t).body:ce(t)&&ef(t)?t:Zr(t)}var Xu=/auto|scroll|overlay|hidden|clip/,Qu=new Set(["inline","contents"]);function ef(e){const t=fe(e),{overflow:n,overflowX:s,overflowY:r,display:o}=t.getComputedStyle(e);return Xu.test(n+r+s)&&!Qu.has(o)}var ki=/auto|scroll|overlay|hidden/;function tf(e,t={}){const{axis:n}=t,{overflowX:s,overflowY:r}=fe(e).getComputedStyle(e),o=n!=="y"&&ki.test(s)&&e.scrollWidth>e.clientWidth,i=n!=="x"&&ki.test(r)&&e.scrollHeight>e.clientHeight;return o||i}var en="default",Jr="",Os=new WeakMap;function nf(e={}){const{target:t,doc:n}=e,s=n??document,r=s.documentElement;return nl()?(en==="default"&&(Jr=r.style.webkitUserSelect,r.style.webkitUserSelect="none"),en="disabled"):t&&(Os.set(t,t.style.userSelect),t.style.userSelect="none"),()=>ll({target:t,doc:s})}function ll(e={}){const{target:t,doc:n}=e,r=(n??document).documentElement;if(nl()){if(en!=="disabled")return;en="restoring",setTimeout(()=>{al(()=>{en==="restoring"&&(r.style.webkitUserSelect==="none"&&(r.style.webkitUserSelect=Jr||""),Jr="",en="default")})},300)}else if(t&&Os.has(t)){const o=Os.get(t);t.style.userSelect==="none"&&(t.style.userSelect=o??""),t.getAttribute("style")===""&&t.removeAttribute("style"),Os.delete(t)}}function sf(e={}){const{defer:t,target:n,...s}=e,r=t?ue:i=>i(),o=[];return o.push(r(()=>{const i=typeof n=="function"?n():n;o.push(nf({...s,target:i}))})),()=>{o.forEach(i=>i?.())}}function rf(e,t){return Array.from(e?.querySelectorAll(t)??[])}function of(e,t){return e?.querySelector(t)??null}var Ro=e=>e.id;function af(e,t,n=Ro){return e.find(s=>n(s)===t)}function lf(e,t,n=Ro){const s=af(e,t,n);return s?e.indexOf(s):-1}function cf(e,t){const{rootEl:n,...s}=t||{};!e||!n||tf(n)&&e.scrollIntoView(s)}var Ai,df=()=>Ai??(Ai=new Intl.Collator(void 0,{usage:"search",sensitivity:"base"})),uf=e=>e.normalize("NFC").trim(),ff=e=>uf(e.dataset?.valuetext??e.textContent??""),hf=(e,t)=>{const n=t.normalize("NFC");return df().compare(e.slice(0,n.length),n)===0};function pf(e,t,n,s=Ro){const r=n?lf(e,n,s):-1;let o=n?eu(e,r):e;return t.length===1&&(o=o.filter(a=>s(a)!==n)),o.find(a=>hf(ff(a),t))}function gf(e,t){if(!e)return _s;const n=Object.keys(t).reduce((s,r)=>(s[r]=e.style.getPropertyValue(r),s),{});return mf(n,t)?_s:(Object.assign(e.style,t),()=>{Object.assign(e.style,n),e.style.length===0&&e.removeAttribute("style")})}function mf(e,t){return Object.keys(e).every(n=>e[n]===t[n])}function vf(e,t){const{state:n,activeId:s,key:r,timeout:o=350,itemToId:i}=t,a=n.keysSoFar+r,l=a.length>1&&Array.from(a).every(g=>g===a[0])?a[0]:a;let p=e.slice();const u=pf(p,l,s,i);function f(){clearTimeout(n.timer),n.timer=-1}function h(g){n.keysSoFar=g,f(),g!==""&&(n.timer=+setTimeout(()=>{h(""),f()},o))}return h(a),u}var Xr=Object.assign(vf,{defaultOptions:{keysSoFar:"",timer:-1},isValidEvent:yf});function yf(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey}var bf={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"};function wf(e,t,n){const{signal:s}=t;return[new Promise((i,a)=>{const c=setTimeout(()=>{a(new Error(`Timeout of ${n}ms exceeded`))},n);s.addEventListener("abort",()=>{clearTimeout(c),a(new DOMException("Promise aborted","AbortError"))}),e.then(l=>{s.aborted||(clearTimeout(c),i(l))}).catch(l=>{s.aborted||(clearTimeout(c),a(l))})}),()=>t.abort()]}function Ef(e,t){const{timeout:n,rootNode:s}=t,r=fe(s),o=Oe(s),i=new r.AbortController;let a;const c=wf(new Promise(p=>{const u=e();if(u){p(u);return}a=new r.MutationObserver(()=>{const f=e();f&&f.isConnected&&(a?.disconnect(),p(f))}),a.observe(o.body,{childList:!0,subtree:!0})}),i,n),l=()=>a?.disconnect();return c[0].then(l,l),c}var xf=zu({});function Sf(e,t,n={}){const{defer:s,onMissing:r,getRootNode:o}=n,i=()=>typeof e=="function"?e():e,a=[],c=l=>{if(!l)return r?.();a.push(t(l))};if(!s)c(i());else{let l=!1;a.push(()=>{l=!0}),queueMicrotask(()=>{if(l)return;const p=i();if(p){c(p);return}let u=!1;const f=m=>{l||u||(u=!0,g(),d(),c(m))},h=o?.(),g=h?xf.observe(h,()=>{const m=i();m&&f(m)}):_s,d=ue(()=>f(i()));a.push(g,d)})}return()=>{a.forEach(l=>l?.())}}function $f(e){return!(e.metaKey||!Oo()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}var If=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),Tf=["a[href]","audio[controls]","button","details","embed","iframe","img[controls]","img[usemap]","input","select","textarea","video[controls]"].join(",");function Cf(e,t,n){const s=n?ut(n):null,r=Oe(s),o=fe(s),i=er(r);return e=e||i instanceof o.HTMLInputElement&&!If.has(i?.type)||i instanceof o.HTMLTextAreaElement||i instanceof o.HTMLElement&&i.isContentEditable,!(e&&t==="keyboard"&&n instanceof o.KeyboardEvent&&!Reflect.has(Af,n.key))}var ft=null,Qr=new Set,Bs=new Map,Ft=!1,xt=null,eo=!1,Ir=null,kf=!1,Af={Tab:!0,Escape:!0};function nr(e,t){for(let n of Qr)n(e,t)}function js(e){xt=null,Ft=!0,$f(e)&&(ft="keyboard",nr("keyboard",e))}function $e(e){(e.type==="pointermove"||e.type==="mousemove")&&e.isTrusted&&Ir?.x===e.clientX&&Ir?.y===e.clientY||(Ir={x:e.clientX,y:e.clientY},ft="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(xt=null,Ft=!0,nr("pointer",e)))}function cl(e){if(ku(e)){xt=null,Ft=!0,ft="virtual";return}xt=null;const t=ut(e),n=t?.closest("label"),s=n?.control;if(!n||!s||s.matches(":disabled"))return;const r=t?.closest(Tf);r&&n.contains(r)&&r!==s||s!==er(n.ownerDocument)&&(xt=s)}function dl(e){const t=ut(e),n=t===xt;t===fe(t)||t===Oe(t)||kf||!e.isTrusted||(!Ft&&!n&&!eo&&(ft="virtual",nr("virtual",e)),Ft=!1,xt=null,eo=!1)}function ul(){Ft=!1,xt=null,eo=!0}function Of(e){try{return e.focus}catch{return}}function Lf(e){const t=e.HTMLElement.prototype;try{let s=function(){Ft=!0,(r??i.call(this)).apply(this,arguments)};var n=s;const r=Of(t),o=r?void 0:Object.getOwnPropertyDescriptor(t,"focus"),i=o?.get;return!r&&!i?{focus:void 0}:(Object.defineProperty(e.HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:s}),{focus:r,descriptor:o})}catch{return{focus:void 0}}}function Mf(e){if(typeof window>"u"||Bs.get(fe(e)))return;const t=fe(e),n=Oe(e),s=Lf(t);n.addEventListener("keydown",js,!0),n.addEventListener("keyup",js,!0),n.addEventListener("click",cl,!0),t.addEventListener("focus",dl,!0),t.addEventListener("blur",ul,!1),typeof t.PointerEvent<"u"?(n.addEventListener("pointerdown",$e,!0),n.addEventListener("pointermove",$e,!0),n.addEventListener("pointerup",$e,!0)):(n.addEventListener("mousedown",$e,!0),n.addEventListener("mousemove",$e,!0),n.addEventListener("mouseup",$e,!0)),t.addEventListener("beforeunload",()=>{Df(e)},{once:!0}),Bs.set(t,s)}var Df=(e,t)=>{const n=fe(e),s=Oe(e),r=Bs.get(n);if(r){if(r.focus||r.descriptor)try{Object.defineProperty(n.HTMLElement.prototype,"focus",r.descriptor??{configurable:!0,writable:!0,value:r.focus})}catch{}s.removeEventListener("keydown",js,!0),s.removeEventListener("keyup",js,!0),s.removeEventListener("click",cl,!0),n.removeEventListener("focus",dl,!0),n.removeEventListener("blur",ul,!1),typeof n.PointerEvent<"u"?(s.removeEventListener("pointerdown",$e,!0),s.removeEventListener("pointermove",$e,!0),s.removeEventListener("pointerup",$e,!0)):(s.removeEventListener("mousedown",$e,!0),s.removeEventListener("mousemove",$e,!0),s.removeEventListener("mouseup",$e,!0)),Bs.delete(n)}};function to(){return ft}function Rf(e){ft=e,nr(e,null)}function Oi(){return ft==="keyboard"||ft==="virtual"}function Pf(e={}){const{isTextInput:t,autoFocus:n,onChange:s,root:r}=e;Mf(r),s?.({isFocusVisible:n||Oi(),modality:ft});const o=(i,a)=>{Cf(!!t,i,a)&&s?.({isFocusVisible:Oi(),modality:i})};return Qr.add(o),()=>{Qr.delete(o)}}const Vf=["top","right","bottom","left"],$t=Math.min,nt=Math.max,Ws=Math.round,ds=Math.floor,st=e=>({x:e,y:e}),Nf={left:"right",right:"left",bottom:"top",top:"bottom"};function fl(e,t,n){return nt(e,$t(t,n))}function ht(e,t){return typeof e=="function"?e(t):e}function It(e){return e.split("-")[0]}function vn(e){return e.split("-")[1]}function Po(e){return e==="x"?"y":"x"}function Vo(e){return e==="y"?"height":"width"}function _e(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function No(e){return Po(_e(e))}function Ff(e,t,n){n===void 0&&(n=!1);const s=vn(e),r=No(e),o=Vo(r);let i=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=Us(i)),[i,Us(i)]}function Hf(e){const t=Us(e);return[no(e),t,no(t)]}function no(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Li=["left","right"],Mi=["right","left"],_f=["top","bottom"],Bf=["bottom","top"];function jf(e,t,n){switch(e){case"top":case"bottom":return n?t?Mi:Li:t?Li:Mi;case"left":case"right":return t?_f:Bf;default:return[]}}function Wf(e,t,n,s){const r=vn(e);let o=jf(It(e),n==="start",s);return r&&(o=o.map(i=>i+"-"+r),t&&(o=o.concat(o.map(no)))),o}function Us(e){const t=It(e);return Nf[t]+e.slice(t.length)}function Uf(e){var t,n,s,r;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(s=e.bottom)!=null?s:0,left:(r=e.left)!=null?r:0}}function hl(e){return typeof e!="number"?Uf(e):{top:e,right:e,bottom:e,left:e}}function qs(e){const{x:t,y:n,width:s,height:r}=e;return{width:s,height:r,top:n,left:t,right:t+s,bottom:n+r,x:t,y:n}}function Di(e,t,n){let{reference:s,floating:r}=e;const o=_e(t),i=No(t),a=Vo(i),c=It(t),l=o==="y",p=s.x+s.width/2-r.width/2,u=s.y+s.height/2-r.height/2,f=s[a]/2-r[a]/2;let h;switch(c){case"top":h={x:p,y:s.y-r.height};break;case"bottom":h={x:p,y:s.y+s.height};break;case"right":h={x:s.x+s.width,y:u};break;case"left":h={x:s.x-r.width,y:u};break;default:h={x:s.x,y:s.y}}const g=vn(t);return g&&(h[i]+=f*(g==="end"?1:-1)*(n&&l?-1:1)),h}async function qf(e,t){var n;t===void 0&&(t={});const{x:s,y:r,platform:o,rects:i,elements:a,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:p="viewport",elementContext:u="floating",altBoundary:f=!1,padding:h=0}=ht(t,e),g=hl(h),m=a[f?u==="floating"?"reference":"floating":u],y=qs(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(m)))==null||n?m:m.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:l,rootBoundary:p,strategy:c})),b=u==="floating"?{x:s,y:r,width:i.floating.width,height:i.floating.height}:i.reference,T=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),M=await(o.isElement==null?void 0:o.isElement(T))&&await(o.getScale==null?void 0:o.getScale(T))||{x:1,y:1},x=qs(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:T,strategy:c}):b);return{top:(y.top-x.top+g.top)/M.y,bottom:(x.bottom-y.bottom+g.bottom)/M.y,left:(y.left-x.left+g.left)/M.x,right:(x.right-y.right+g.right)/M.x}}const Gf=50,Yf=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:o=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:qf},c=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:p,y:u}=Di(l,s,c),f=s,h=0;const g={};for(let d=0;d<o.length;d++){const m=o[d];if(!m)continue;const{name:y,fn:b}=m,{x:T,y:M,data:x,reset:C}=await b({x:p,y:u,initialPlacement:s,placement:f,strategy:r,middlewareData:g,rects:l,platform:a,elements:{reference:e,floating:t}});p=T??p,u=M??u,g[y]={...g[y],...x},C&&h<Gf&&(h++,typeof C=="object"&&(C.placement&&(f=C.placement),C.rects&&(l=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):C.rects),{x:p,y:u}=Di(l,f,c)),d=-1)}return{x:p,y:u,placement:f,strategy:r,middlewareData:g}},Kf=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:r,rects:o,platform:i,elements:a,middlewareData:c}=t,{element:l,padding:p=0}=ht(e,t)||{};if(l==null)return{};const u=hl(p),f={x:n,y:s},h=No(r),g=Vo(h),d=await i.getDimensions(l),m=h==="y",y=m?"top":"left",b=m?"bottom":"right",T=m?"clientHeight":"clientWidth",M=o.reference[g]+o.reference[h]-f[h]-o.floating[g],x=f[h]-o.reference[h],C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l));let w=C?C[T]:0;(!w||!await(i.isElement==null?void 0:i.isElement(C)))&&(w=a.floating[T]||o.floating[g]);const $=M/2-x/2,R=w/2-d[g]/2-1,L=$t(u[y],R),E=$t(u[b],R),O=w-d[g]-E,D=w/2-d[g]/2+$,V=fl(L,D,O),H=!c.arrow&&vn(r)!=null&&D!==V&&o.reference[g]/2-(D<L?L:E)-d[g]/2<0,Z=H?D<L?D-L:D-O:0;return{[h]:f[h]+Z,data:{[h]:V,centerOffset:D-V-Z,...H&&{alignmentOffset:Z}},reset:H}}}),zf=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:r,middlewareData:o,rects:i,initialPlacement:a,platform:c,elements:l}=t,{mainAxis:p=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:d=!0,...m}=ht(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const y=It(r),b=_e(a),T=It(a)===a,M=await(c.isRTL==null?void 0:c.isRTL(l.floating)),x=f||(T||!d?[Us(a)]:Hf(a)),C=g!=="none";!f&&C&&x.push(...Wf(a,d,g,M));const w=[a,...x],$=await c.detectOverflow(t,m),R=[];let L=((s=o.flip)==null?void 0:s.overflows)||[];if(p&&R.push($[y]),u){const V=Ff(r,i,M);R.push($[V[0]],$[V[1]])}if(L=[...L,{placement:r,overflows:R}],!R.every(V=>V<=0)){var E,O;const V=(((E=o.flip)==null?void 0:E.index)||0)+1,H=w[V];if(H&&(!(u==="alignment"?b!==_e(H):!1)||L.every(W=>_e(W.placement)===b?W.overflows[0]>0:!0)))return{data:{index:V,overflows:L},reset:{placement:H}};let Z=(O=L.filter(se=>se.overflows[0]<=0).sort((se,W)=>se.overflows[1]-W.overflows[1])[0])==null?void 0:O.placement;if(!Z)switch(h){case"bestFit":{var D;const se=(D=L.filter(W=>{if(C){const U=_e(W.placement);return U===b||U==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(U=>U>0).reduce((U,he)=>U+he,0)]).sort((W,U)=>W[1]-U[1])[0])==null?void 0:D[0];se&&(Z=se);break}case"initialPlacement":Z=a;break}if(r!==Z)return{reset:{placement:Z}}}return{}}}};function Ri(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Pi(e){return Vf.some(t=>e[t]>=0)}const Zf=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:r="referenceHidden",...o}=ht(e,t);switch(r){case"referenceHidden":{const i=await s.detectOverflow(t,{...o,elementContext:"reference"}),a=Ri(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Pi(a)}}}case"escaped":{const i=await s.detectOverflow(t,{...o,altBoundary:!0}),a=Ri(i,n.floating);return{data:{escapedOffsets:a,escaped:Pi(a)}}}default:return{}}}}},pl=new Set(["left","top"]);async function Jf(e,t){const{placement:n,platform:s,elements:r}=e,o=await(s.isRTL==null?void 0:s.isRTL(r.floating)),i=It(n),a=vn(n),c=_e(n)==="y",l=pl.has(i)?-1:1,p=o&&c?-1:1,u=ht(t,e);let{mainAxis:f,crossAxis:h,alignmentAxis:g}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof g=="number"&&(h=a==="end"?g*-1:g),c?{x:h*p,y:f*l}:{x:f*l,y:h*p}}const Xf=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:r,y:o,placement:i,middlewareData:a}=t,c=await Jf(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:r+c.x,y:o+c.y,data:{...c,placement:i}}}}},Qf=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:r,platform:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:c={fn:b=>{let{x:T,y:M}=b;return{x:T,y:M}}},...l}=ht(e,t),p={x:n,y:s},u=await o.detectOverflow(t,l),f=_e(r),h=Po(f);let g=p[h],d=p[f];const m=(b,T)=>fl(T+u[b==="y"?"top":"left"],T,T-u[b==="y"?"bottom":"right"]);i&&(g=m(h,g)),a&&(d=m(f,d));const y=c.fn({...t,[h]:g,[f]:d});return{...y,data:{x:y.x-n,y:y.y-s,enabled:{[h]:i,[f]:a}}}}}},eh=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,s;const{x:r,y:o,placement:i,rects:a,middlewareData:c}=t,{offset:l=0,mainAxis:p=!0,crossAxis:u=!0}=ht(e,t),f={x:r,y:o},h=_e(i),g=Po(h);let d=f[g],m=f[h];const y=ht(l,t),b=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:(n=y.mainAxis)!=null?n:0,crossAxis:(s=y.crossAxis)!=null?s:0};if(p){const x=g==="y"?"height":"width",C=a.reference[g]-a.floating[x]+b.mainAxis,w=a.reference[g]+a.reference[x]-b.mainAxis;d<C?d=C:d>w&&(d=w)}if(u){var T,M;const x=g==="y"?"width":"height",C=pl.has(It(i)),w=a.reference[h]-a.floating[x]+(C&&((T=c.offset)==null?void 0:T[h])||0)+(C?0:b.crossAxis),$=a.reference[h]+a.reference[x]+(C?0:((M=c.offset)==null?void 0:M[h])||0)-(C?b.crossAxis:0);m<w?m=w:m>$&&(m=$)}return{[g]:d,[h]:m}}}},th=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:s,platform:r,elements:o}=t,{apply:i=()=>{},...a}=ht(e,t),c=await r.detectOverflow(t,a),l=It(n),p=vn(n),u=_e(n)==="y",{width:f,height:h}=s.floating;let g,d;l==="top"||l==="bottom"?(g=l,d=p===(await(r.isRTL==null?void 0:r.isRTL(o.floating))?"start":"end")?"left":"right"):(d=l,g=p==="end"?"top":"bottom");const m=h-c.top-c.bottom,y=f-c.left-c.right,b=$t(h-c[g],m),T=$t(f-c[d],y),M=t.middlewareData.shift,x=!M;let C=b,w=T;M!=null&&M.enabled.x&&(w=y),M!=null&&M.enabled.y&&(C=m),x&&!p&&(u?w=f-2*nt(c.left,c.right):C=h-2*nt(c.top,c.bottom)),await i({...t,availableWidth:w,availableHeight:C});const $=await r.getDimensions(o.floating);return f!==$.width||h!==$.height?{reset:{rects:!0}}:{}}}};function sr(){return typeof window<"u"}function yn(e){return gl(e)?(e.nodeName||"").toLowerCase():"#document"}function ye(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function mt(e){var t;return(t=(gl(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function gl(e){return sr()?e instanceof Node||e instanceof ye(e).Node:!1}function Ue(e){return sr()?e instanceof Element||e instanceof ye(e).Element:!1}function Tt(e){return sr()?e instanceof HTMLElement||e instanceof ye(e).HTMLElement:!1}function Vi(e){return!sr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ye(e).ShadowRoot}function rr(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=qe(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&r!=="inline"&&r!=="contents"}function nh(e){return/^(table|td|th)$/.test(yn(e))}function or(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const sh=/transform|translate|scale|rotate|perspective|filter/,rh=/paint|layout|strict|content/,Lt=e=>!!e&&e!=="none";let Tr;function Fo(e){const t=Ue(e)?qe(e):e;return Lt(t.transform)||Lt(t.translate)||Lt(t.scale)||Lt(t.rotate)||Lt(t.perspective)||!Ho()&&(Lt(t.backdropFilter)||Lt(t.filter))||sh.test(t.willChange||"")||rh.test(t.contain||"")}function oh(e){let t=Ht(e);for(;Tt(t)&&!qn(t);){if(Fo(t))return t;if(or(t))return null;t=Ht(t)}return null}function Ho(){return Tr==null&&(Tr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Tr}function qn(e){return/^(html|body|#document)$/.test(yn(e))}function qe(e){return ye(e).getComputedStyle(e)}function ir(e){return Ue(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ht(e){if(yn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Vi(e)&&e.host||mt(e);return Vi(t)?t.host:t}function ml(e){const t=Ht(e);return qn(t)?(e.ownerDocument||e).body:Tt(t)&&rr(t)?t:ml(t)}function Gn(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=ml(e),o=r===((s=e.ownerDocument)==null?void 0:s.body),i=ye(r);if(o){const a=so(i);return t.concat(i,i.visualViewport||[],rr(r)?r:[],a&&n?Gn(a):[])}else return t.concat(r,Gn(r,[],n))}function so(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function vl(e){const t=qe(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=Tt(e),o=r?e.offsetWidth:n,i=r?e.offsetHeight:s,a=Ws(n)!==o||Ws(s)!==i;return a&&(n=o,s=i),{width:n,height:s,$:a}}function _o(e){return Ue(e)?e:e.contextElement}function nn(e){const t=_o(e);if(!Tt(t))return st(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:o}=vl(t);let i=(o?Ws(n.width):n.width)/s,a=(o?Ws(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const ih=st(0);function yl(e){const t=ye(e);return!Ho()||!t.visualViewport?ih:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ah(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===ye(e)}function _t(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=_o(e);let i=st(1);t&&(s?Ue(s)&&(i=nn(s)):i=nn(e));const a=ah(o,n,s)?yl(o):st(0);let c=(r.left+a.x)/i.x,l=(r.top+a.y)/i.y,p=r.width/i.x,u=r.height/i.y;if(o&&s){const f=ye(o),h=Ue(s)?ye(s):s;let g=f,d=so(g);for(;d&&h!==g;){const m=nn(d),y=d.getBoundingClientRect(),b=qe(d),T=y.left+(d.clientLeft+parseFloat(b.paddingLeft))*m.x,M=y.top+(d.clientTop+parseFloat(b.paddingTop))*m.y;c*=m.x,l*=m.y,p*=m.x,u*=m.y,c+=T,l+=M,g=ye(d),d=so(g)}}return qs({width:p,height:u,x:c,y:l})}function ar(e,t){const n=ir(e).scrollLeft;return t?t.left+n:_t(mt(e)).left+n}function bl(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-ar(e,n),r=n.top+t.scrollTop;return{x:s,y:r}}function lh(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const o=r==="fixed",i=mt(s),a=t?or(t.floating):!1;if(s===i||a&&o)return n;let c={scrollLeft:0,scrollTop:0},l=st(1);const p=st(0),u=Tt(s);if((u||!o)&&((yn(s)!=="body"||rr(i))&&(c=ir(s)),u)){const h=_t(s);l=nn(s),p.x=h.x+s.clientLeft,p.y=h.y+s.clientTop}const f=i&&!u&&!o?bl(i,c):st(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+p.x+f.x,y:n.y*l.y-c.scrollTop*l.y+p.y+f.y}}function ch(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function dh(e){const t=ir(e),n=e.ownerDocument.body,s=nt(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=nt(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-t.scrollLeft+ar(e);const i=-t.scrollTop;return qe(n).direction==="rtl"&&(o+=nt(e.clientWidth,n.clientWidth)-s),{width:s,height:r,x:o,y:i}}const uh=25;function fh(e,t,n){n===void 0&&(n="viewport");const s=n==="layoutViewport",r=ye(e),o=mt(e),i=r.visualViewport;let a=o.clientWidth,c=o.clientHeight,l=0,p=0;if(i){const f=!Ho()||t==="fixed";s?f||(l=-i.offsetLeft,p=-i.offsetTop):(a=i.width,c=i.height,f&&(l=i.offsetLeft,p=i.offsetTop))}if(ar(o)<=0){const f=o.ownerDocument,h=f.body,g=getComputedStyle(h),d=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,m=Math.abs(o.clientWidth-h.clientWidth-d),y=getComputedStyle(o).scrollbarGutter==="stable both-edges"?m/2:m;y<=uh&&(a-=y)}return{width:a,height:c,x:l,y:p}}function hh(e,t){const n=_t(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,o=nn(e),i=e.clientWidth*o.x,a=e.clientHeight*o.y,c=r*o.x,l=s*o.y;return{width:i,height:a,x:c,y:l}}function Ni(e,t,n){let s;if(t==="viewport"||t==="layoutViewport")s=fh(e,n,t);else if(t==="document")s=dh(mt(e));else if(Ue(t))s=hh(t,n);else{const r=yl(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return qs(s)}function ph(e,t){const n=t.get(e);if(n)return n;let s=Gn(e,[],!1).filter(a=>Ue(a)&&yn(a)!=="body"),r=null;const o=qe(e).position==="fixed";let i=o?Ht(e):e;for(;Ue(i)&&!qn(i);){const a=qe(i),c=Fo(i),l=r?r.position:o?"fixed":"";!c&&(l==="fixed"||l==="absolute"&&a.position==="static")?s=s.filter(u=>u!==i):r=a,i=Ht(i)}return t.set(e,s),s}function gh(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const i=[...n==="clippingAncestors"?or(t)?[]:ph(t,this._c):[].concat(n),s],a=Ni(t,i[0],r);let c=a.top,l=a.right,p=a.bottom,u=a.left;for(let f=1;f<i.length;f++){const h=Ni(t,i[f],r);c=nt(h.top,c),l=$t(h.right,l),p=$t(h.bottom,p),u=nt(h.left,u)}return{width:l-u,height:p-c,x:u,y:c}}function mh(e){const{width:t,height:n}=vl(e);return{width:t,height:n}}function vh(e,t,n){const s=Tt(t),r=mt(t),o=n==="fixed",i=_t(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const c=st(0);if((s||!o)&&((yn(t)!=="body"||rr(r))&&(a=ir(t)),s)){const f=_t(t,!0,o,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}!s&&r&&(c.x=ar(r));const l=r&&!s&&!o?bl(r,a):st(0),p=i.left+a.scrollLeft-c.x-l.x,u=i.top+a.scrollTop-c.y-l.y;return{x:p,y:u,width:i.width,height:i.height}}function Cr(e){return qe(e).position==="static"}function Fi(e,t){if(!Tt(e)||qe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return mt(e)===n&&(n=n.ownerDocument.body),n}function wl(e,t){const n=ye(e);if(or(e))return n;if(!Tt(e)){let r=Ht(e);for(;r&&!qn(r);){if(Ue(r)&&!Cr(r))return r;r=Ht(r)}return n}let s=Fi(e,t);for(;s&&nh(s)&&Cr(s);)s=Fi(s,t);return s&&qn(s)&&Cr(s)&&!Fo(s)?n:s||oh(e)||n}const yh=async function(e){const t=this.getOffsetParent||wl,n=this.getDimensions,s=await n(e.floating);return{reference:vh(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function bh(e){return qe(e).direction==="rtl"}const wh={convertOffsetParentRelativeRectToViewportRelativeRect:lh,getDocumentElement:mt,getClippingRect:gh,getOffsetParent:wl,getElementRects:yh,getClientRects:ch,getDimensions:mh,getScale:nn,isElement:Ue,isRTL:bh};function El(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Eh(e,t,n){let s=null,r;const o=mt(e);function i(){var p;clearTimeout(r),(p=s)==null||p.disconnect(),s=null}function a(p,u){p===void 0&&(p=!1),u===void 0&&(u=1),i();const f=e.getBoundingClientRect(),{left:h,top:g,width:d,height:m}=f;if(p||t(),!d||!m)return;const y=ds(g),b=ds(o.clientWidth-(h+d)),T=ds(o.clientHeight-(g+m)),M=ds(h),C={rootMargin:-y+"px "+-b+"px "+-T+"px "+-M+"px",threshold:nt(0,$t(1,u))||1};let w=!0;function $(R){const L=R[0].intersectionRatio;if(!El(f,e.getBoundingClientRect()))return a();if(L!==u){if(!w)return a();L?a(!1,L):r=setTimeout(()=>{a(!1,1e-7)},1e3)}w=!1}try{s=new IntersectionObserver($,{...C,root:o.ownerDocument})}catch{s=new IntersectionObserver($,C)}s.observe(e)}const c=ye(e),l=()=>a(n);return c.addEventListener("resize",l),a(!0),()=>{c.removeEventListener("resize",l),i()}}function xh(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:r=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,l=_o(e),p=r||o?[...l?Gn(l):[],...t?Gn(t):[]]:[];p.forEach(y=>{r&&y.addEventListener("scroll",n),o&&y.addEventListener("resize",n)});const u=l&&a?Eh(l,n,o):null;let f=-1,h=null;i&&(h=new ResizeObserver(y=>{let[b]=y;b&&b.target===l&&h&&t&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var T;(T=h)==null||T.observe(t)})),n()}),l&&!c&&h.observe(l),t&&h.observe(t));let g,d=c?_t(e):null;c&&m();function m(){const y=_t(e);d&&!El(d,y)&&n(),d=y,g=requestAnimationFrame(m)}return n(),()=>{var y;p.forEach(b=>{r&&b.removeEventListener("scroll",n),o&&b.removeEventListener("resize",n)}),u?.(),(y=h)==null||y.disconnect(),h=null,c&&cancelAnimationFrame(g)}}const Sh=Xf,$h=Qf,Ih=zf,Th=th,Ch=Zf,kh=Kf,Ah=eh,Oh=(e,t,n)=>{const s=new Map,r=n??{},o={...wh,...r.platform,_c:s};return Yf(e,t,{...r,platform:o})};function Hi(e=0,t=0,n=0,s=0){if(typeof DOMRect=="function")return new DOMRect(e,t,n,s);const r={x:e,y:t,width:n,height:s,top:t,right:e+n,bottom:t+s,left:e};return{...r,toJSON:()=>r}}function Lh(e){if(!e)return Hi();const{x:t,y:n,width:s,height:r}=e;return Hi(t,n,s,r)}function Mh(e,t){return{contextElement:ce(e)?e:e?.contextElement,getBoundingClientRect:()=>{const n=e,s=t?.(n);return s||!n?Lh(s):n.getBoundingClientRect()}}}var Cn=e=>({variable:e,reference:`var(${e})`}),Je={arrowSize:Cn("--arrow-size"),arrowSizeHalf:Cn("--arrow-size-half"),arrowBg:Cn("--arrow-background"),transformOrigin:Cn("--transform-origin"),arrowOffset:Cn("--arrow-offset")},Dh=e=>e==="top"||e==="bottom"?"y":"x";function Rh(e,t){return{name:"transformOrigin",fn(n){const{elements:s,middlewareData:r,placement:o,rects:i,y:a}=n,c=o.split("-")[0],l=Dh(c),p=r.arrow?.x||0,u=r.arrow?.y||0,f=t?.clientWidth||0,h=t?.clientHeight||0,g=p+f/2,d=u+h/2,m=Math.abs(r.shift?.y||0),y=i.reference.height/2,b=h/2,T=e.offset?.mainAxis??e.gutter,M=typeof T=="number"?T+b:T??b,x=m>M,C={top:`${g}px calc(100% + ${M}px)`,bottom:`${g}px ${-M}px`,left:`calc(100% + ${M}px) ${d}px`,right:`${-M}px ${d}px`}[c],w=`${g}px ${i.reference.y+y-a}px`,$=!!e.overlap&&l==="y"&&x;return s.floating.style.setProperty(Je.transformOrigin.variable,$?w:C),{data:{transformOrigin:$?w:C}}}}}var Ph={name:"rects",fn({rects:e}){return{data:e}}},Vh=e=>{if(e)return{name:"shiftArrow",fn({placement:t,middlewareData:n}){if(!n.arrow)return{};const{x:s,y:r}=n.arrow,o=t.split("-")[0];return Object.assign(e.style,{left:s!=null?`${s}px`:"",top:r!=null?`${r}px`:"",[o]:`calc(100% + ${Je.arrowOffset.reference})`}),{}}}};function Nh(e){const[t,n]=e.split("-");return{side:t,align:n,hasAlign:n!=null}}function xl(e){return e.split("-")[0]}var Fh={strategy:"absolute",placement:"bottom",listeners:!0,restoreStyles:!1,applyStyles:!0,gutter:8,flip:!0,slide:!0,overlap:!1,sameWidth:!1,fitViewport:!1,overflowPadding:8,arrowPadding:4};function _i(e,t){const n=e.devicePixelRatio||1;return Math.round(t*n)/n}function tn(e,t){return e!=null&&Math.abs(e-t)<.5}function lr(e){return typeof e=="function"?e():e==="clipping-ancestors"?"clippingAncestors":e}function Hh(e,t,n){const s=e||t.createElement("div");return kh({element:s,padding:n.arrowPadding})}function _h(e,t){if(!Hd(t.offset??t.gutter))return Sh(({placement:n})=>{const s=(e?.clientHeight||0)/2,r=t.offset?.mainAxis??t.gutter,o=typeof r=="number"?r+s:r??s,{hasAlign:i}=Nh(n),a=i?void 0:t.shift,c=t.offset?.crossAxis??a;return To({crossAxis:c,mainAxis:o,alignmentAxis:t.shift})})}function Bh(e){if(e.flip)return Ih(()=>{const t=lr(e.boundary);return{...t?{boundary:t}:void 0,padding:e.overflowPadding,fallbackPlacements:e.flip===!0?void 0:e.flip}})}function jh(e){if(!(!e.slide&&!e.overlap))return $h(()=>{const t=lr(e.boundary);return{...t?{boundary:t}:void 0,mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:Ah()}})}function Wh(e){if(e.sizeMiddleware===!1&&!e.sameWidth&&!e.fitViewport)return;let t,n,s,r;return Th(()=>{const o=lr(e.boundary);return{padding:e.overflowPadding,...o?{boundary:o}:void 0,apply({elements:i,rects:a,availableHeight:c,availableWidth:l}){const p=i.floating,u=Math.round(a.reference.width),f=Math.round(a.reference.height);l=Math.floor(l),c=Math.floor(c),tn(t,u)||(p.style.setProperty("--reference-width",`${u}px`),t=u),tn(n,f)||(p.style.setProperty("--reference-height",`${f}px`),n=f),tn(s,l)||(p.style.setProperty("--available-width",`${l}px`),s=l),tn(r,c)||(p.style.setProperty("--available-height",`${c}px`),r=c)}}})}function Uh(e){if(e.hideWhenDetached)return Ch(()=>({strategy:"referenceHidden",boundary:lr(e.boundary)??"clippingAncestors"}))}function qh(e){return e?e===!0?{ancestorResize:!0,ancestorScroll:!0,elementResize:!0,layoutShift:!0}:e:{}}var Gh=["transform","visibility","pointer-events","--x","--y","--z-index","z-index","--reference-width","--reference-height","--available-width","--available-height","--transform-origin"],Yh=["top","right","bottom","left"],Nn=new WeakSet;function Kh(e,t){const n=e.style.getPropertyValue("z-index"),s=Nn.has(e),r=s&&n==="var(--z-index)";s&&!r&&Nn.delete(e);const o=tl(t).zIndex;if(o==="auto"){r&&(e.style.removeProperty("z-index"),Nn.delete(e));return}n&&!r||(e.style.setProperty("--z-index",o),e.style.setProperty("z-index","var(--z-index)"),Nn.add(e))}function Bi(e,t){if(!e)return qa;const n=new Map(t.map(s=>[s,e.style.getPropertyValue(s)]));return()=>{n.forEach((s,r)=>{s?e.style.setProperty(r,s):e.style.removeProperty(r)}),e.style.length===0&&e.removeAttribute("style")}}function ji(e){return e==null?null:ce(e)?e:typeof e=="object"&&e&&"contextElement"in e&&e.contextElement?e.contextElement:e}function zh(e,t,n={}){const s=()=>(typeof t=="function"?t():t)??null,r=()=>{const L=typeof e=="function"?e():e;return n.getAnchorElement?.()??L},o=()=>{const L=r();return!L&&!n.getAnchorRect?null:Mh(L,n.getAnchorRect)},i=Object.assign({},Fh,n);let a=[],c=null,l,p;function u(L){if(l?.(),p?.(),c=L,i.restoreStyles){const O=Bi(L,Gh);l=()=>{O(),Nn.delete(L)}}else l=void 0;const E=L.querySelector("[data-part=arrow]");p=i.restoreStyles?Bi(E,Yh):void 0,a=[_h(E,i),Bh(i),jh(i),Hh(E,L.ownerDocument,i),Vh(E),Rh({gutter:i.gutter,offset:i.offset,overlap:i.overlap},E),Wh(i),Uh(i),Ph]}const{placement:f,strategy:h,onComplete:g,onPositioned:d}=i;let m,y,b=!1,T,M,x=qa;const C=qh(i.listeners);function w(){if(!i.listeners)return;const L=r(),E=o(),O=s();if(!E||!O)return;(ji(L)!==ji(T)||O!==M)&&(x(),T=L,M=O,x=xh(E,O,R,C))}async function $(){w();const L=s();if(!L)return;L!==c&&(u(L),b=!1);const E=o();if(!E)return;const O=await Oh(E,L,{placement:f,middleware:a,strategy:h}),D=fe(L),V=_i(D,O.x),H=_i(D,O.y);if(g?.({...O,x:V,y:H}),i.applyStyles!==!1&&(tn(m,V)||(L.style.setProperty("--x",`${V}px`),m=V),tn(y,H)||(L.style.setProperty("--y",`${H}px`),y=H),i.hideWhenDetached&&(O.middlewareData.hide?.referenceHidden?(L.style.setProperty("visibility","hidden"),L.style.setProperty("pointer-events","none")):(L.style.removeProperty("visibility"),L.style.removeProperty("pointer-events"))),!b)){const Z=L.firstElementChild;Z&&(Kh(L,Z),b=!0)}}async function R(){n.updatePosition?(await n.updatePosition({updatePosition:$,floatingElement:s()}),d?.({placed:!0})):await $()}return R(),()=>{x(),p?.(),l?.(),d?.({placed:!1})}}function ro(e,t,n={}){const{defer:s,...r}=n,o=s?ue:a=>a(),i=[];return i.push(o(()=>{i.push(zh(e,t,r))})),()=>{i.forEach(a=>a?.())}}var Zh={bottom:"rotate(45deg)",left:"rotate(135deg)",top:"rotate(225deg)",right:"rotate(315deg)"};function Sl(e={}){const{placement:t,sameWidth:n,fitViewport:s,strategy:r="absolute",applyStyles:o=!0}=e;return{arrow:{position:"absolute",width:Je.arrowSize.reference,height:Je.arrowSize.reference,[Je.arrowSizeHalf.variable]:`calc(${Je.arrowSize.reference} / 2)`,[Je.arrowOffset.variable]:`calc(${Je.arrowSizeHalf.reference} * -1)`},arrowTip:{transform:t?Zh[t.split("-")[0]]:void 0,background:Je.arrowBg.reference,top:"0",left:"0",width:"100%",height:"100%",position:"absolute",zIndex:"inherit"},floating:{position:r,isolation:"isolate",minWidth:n?void 0:"max-content",width:n?"var(--reference-width)":void 0,maxWidth:s?"var(--available-width)":void 0,maxHeight:s?"var(--available-height)":void 0,pointerEvents:t?void 0:"none",top:"0px",left:"0px",transform:t?"translate3d(var(--x, 0), var(--y, -100vh), 0)":"translate3d(0, -100vh, 0)",zIndex:o===!1?"var(--z-index)":void 0}}}var Jh=e=>e.ids?.root??`select:${e.id}`,oo=e=>e.ids?.content??`select:${e.id}:content`,io=e=>e.ids?.trigger??`select:${e.id}:trigger`,$l=e=>e.ids?.clearTrigger??`select:${e.id}:clear-trigger`,us=e=>e.ids?.label??`select:${e.id}:label`,Xh=e=>e.ids?.control??`select:${e.id}:control`,ao=(e,t)=>e.ids?.item?.(t)??`select:${e.id}:option:${t}`,lo=e=>e.ids?.hiddenSelect??`select:${e.id}:select`,Il=e=>e.ids?.positioner??`select:${e.id}:positioner`,Qh=(e,t)=>e.ids?.itemGroup?.(t)??`select:${e.id}:optgroup:${t}`,Wi=(e,t)=>e.ids?.itemGroupLabel?.(t)??`select:${e.id}:optgroup-label:${t}`,kr=e=>e.getById(lo(e)),kn=e=>e.getById(oo(e)),Pt=e=>e.getById(io(e)),ep=e=>e.getById($l(e)),Ar=e=>e.getById(Il(e)),Or=(e,t)=>t==null?null:e.getById(ao(e,t)),tp={clearTriggerLabel:"Clear value"};function np(e,t){const{context:n,prop:s,scope:r,state:o,computed:i,send:a}=e,c=Ya(tp,s("translations")),l=s("disabled")||n.get("fieldsetDisabled"),p=!!s("invalid"),u=!!s("required"),f=!!s("readOnly"),h=s("composite"),g=s("collection"),d=o.hasTag("open"),m=o.matches("focused"),y=n.get("highlightedValue"),b=n.get("highlightedItem"),T=i("selectedItems"),M=n.get("currentPlacement"),x=M?xl(M):void 0,C=i("isTypingAhead"),w=i("isInteractive"),$=y?ao(r,y):void 0;function R(E){const O=g.getItemDisabled(E.item),D=g.getItemValue(E.item);return Xs(D,()=>`[zag-js] No value found for item ${JSON.stringify(E.item)}`),{value:D,disabled:!!(l||O),highlighted:y===D,selected:n.get("value").includes(D)}}const L=Sl({...s("positioning"),placement:M});return{open:d,focused:m,empty:n.get("value").length===0,highlightedItem:b,highlightedValue:y,selectedItems:T,hasSelectedItems:i("hasSelectedItems"),value:n.get("value"),valueAsString:i("valueAsString"),collection:g,multiple:!!s("multiple"),disabled:!!l,reposition(E={}){a({type:"POSITIONING.SET",options:E})},focus(){Pt(r)?.focus({preventScroll:!0})},setOpen(E){a({type:E?"OPEN":"CLOSE",replaces:"open"})},selectValue(E){a({type:"ITEM.SELECT",value:E})},setValue(E){a({type:"VALUE.SET",value:E})},selectAll(){a({type:"VALUE.SET",value:g.getValues()})},setHighlightValue(E){a({type:"HIGHLIGHTED_VALUE.SET",value:E})},clearHighlightValue(){a({type:"HIGHLIGHTED_VALUE.CLEAR"})},clearValue(E){a(E?{type:"ITEM.CLEAR",value:E}:{type:"VALUE.CLEAR"})},getItemState:R,getRootProps(){return t.element({...pe.root.attrs,dir:s("dir"),id:Jh(r),"data-invalid":P(p),"data-readonly":P(f)})},getLabelProps(){return t.label({dir:s("dir"),id:us(r),...pe.label.attrs,"data-disabled":P(l),"data-invalid":P(p),"data-readonly":P(f),"data-required":P(u),htmlFor:lo(r),onClick(E){E.defaultPrevented||l||Pt(r)?.focus({preventScroll:!0})}})},getControlProps(){return t.element({...pe.control.attrs,dir:s("dir"),id:Xh(r),"data-state":d?"open":"closed","data-focus":P(m),"data-disabled":P(l),"data-invalid":P(p)})},getValueTextProps(){return t.element({...pe.valueText.attrs,dir:s("dir"),"data-disabled":P(l),"data-invalid":P(p),"data-focus":P(m)})},getTriggerProps(){return t.button({id:io(r),disabled:l,dir:s("dir"),type:"button",role:"combobox","aria-controls":oo(r),"aria-expanded":d,"aria-haspopup":"listbox","data-state":d?"open":"closed","aria-invalid":p,"aria-required":u,"aria-labelledby":us(r),...pe.trigger.attrs,"data-disabled":P(l),"data-invalid":P(p),"data-readonly":P(f),"data-placement":M,"data-side":x,"data-placeholder-shown":P(!i("hasSelectedItems")),onClick(E){w&&(E.defaultPrevented||a({type:"TRIGGER.CLICK"}))},onFocus(){a({type:"TRIGGER.FOCUS"})},onBlur(){a({type:"TRIGGER.BLUR"})},onKeyDown(E){if(E.defaultPrevented||!w)return;const D={ArrowUp(){a({type:"TRIGGER.ARROW_UP"})},ArrowDown(V){a({type:V.altKey?"OPEN":"TRIGGER.ARROW_DOWN"})},ArrowLeft(){a({type:"TRIGGER.ARROW_LEFT"})},ArrowRight(){a({type:"TRIGGER.ARROW_RIGHT"})},Home(){a({type:"TRIGGER.HOME"})},End(){a({type:"TRIGGER.END"})},Enter(){a({type:"TRIGGER.ENTER"})},Space(V){a(C?{type:"TRIGGER.TYPEAHEAD",key:V.key}:{type:"TRIGGER.ENTER"})}}[zr(E,{dir:s("dir"),orientation:"vertical"})];if(D){D(E),E.preventDefault();return}Xr.isValidEvent(E)&&(a({type:"TRIGGER.TYPEAHEAD",key:E.key}),E.preventDefault())}})},getIndicatorProps(){return t.element({...pe.indicator.attrs,dir:s("dir"),"aria-hidden":!0,"data-state":d?"open":"closed","data-disabled":P(l),"data-invalid":P(p),"data-readonly":P(f)})},getItemProps(E){const O=R(E);return t.element({id:ao(r,O.value),role:"option",...pe.item.attrs,dir:s("dir"),"data-value":O.value,"aria-selected":O.selected,"data-state":O.selected?"checked":"unchecked","data-highlighted":P(O.highlighted),"data-disabled":P(O.disabled),"aria-disabled":de(O.disabled),onPointerMove(D){O.disabled||D.pointerType!=="mouse"||to()==="pointer"&&O.value!==y&&a({type:"ITEM.POINTER_MOVE",value:O.value})},onClick(D){D.defaultPrevented||O.disabled||a({type:"ITEM.CLICK",src:"pointerup",value:O.value})},onPointerLeave(D){O.disabled||E.persistFocus||D.pointerType==="mouse"&&to()==="pointer"&&a({type:"ITEM.POINTER_LEAVE"})}})},getItemTextProps(E){const O=R(E);return t.element({...pe.itemText.attrs,"data-state":O.selected?"checked":"unchecked","data-disabled":P(O.disabled),"data-highlighted":P(O.highlighted)})},getItemIndicatorProps(E){const O=R(E);return t.element({"aria-hidden":!0,...pe.itemIndicator.attrs,"data-state":O.selected?"checked":"unchecked",hidden:!O.selected})},getItemGroupLabelProps(E){const{htmlFor:O}=E;return t.element({...pe.itemGroupLabel.attrs,id:Wi(r,O),dir:s("dir"),role:"presentation"})},getItemGroupProps(E){const{id:O}=E;return t.element({...pe.itemGroup.attrs,"data-disabled":P(l),id:Qh(r,O),"aria-labelledby":Wi(r,O),role:"group",dir:s("dir")})},getClearTriggerProps(){return t.button({...pe.clearTrigger.attrs,id:$l(r),type:"button","aria-label":c.clearTriggerLabel,"data-invalid":P(p),disabled:l,hidden:!i("hasSelectedItems"),dir:s("dir"),onClick(E){E.defaultPrevented||a({type:"CLEAR.CLICK"})}})},getHiddenSelectProps(){const E=n.get("value"),O=s("multiple")?E:E?.[0],D=V=>{const H=Lo(V);rl(H)||a({type:"VALUE.SET",value:sp(V.currentTarget)})};return t.select({name:s("name"),form:s("form"),disabled:l,multiple:s("multiple"),required:s("required"),"aria-hidden":!0,id:lo(r),defaultValue:O,style:bf,tabIndex:-1,autoComplete:s("autoComplete"),onChange:D,onInput:D,onFocus(){Pt(r)?.focus({preventScroll:!0})},"aria-labelledby":us(r)})},getPositionerProps(){return t.element({...pe.positioner.attrs,dir:s("dir"),id:Il(r),style:L.floating})},getContentProps(){return t.element({hidden:!d,dir:s("dir"),id:oo(r),role:h?"listbox":"dialog",...pe.content.attrs,"data-state":d?"open":"closed","data-placement":M,"data-side":x,"data-activedescendant":$,"aria-activedescendant":h?$:void 0,"aria-multiselectable":s("multiple")&&h?!0:void 0,"aria-labelledby":us(r),tabIndex:0,onKeyDown(E){if(!w||!cn(E.currentTarget,ut(E)))return;if(E.key==="Tab"&&!Yu(E)){E.preventDefault();return}const O={ArrowUp(){a({type:"CONTENT.ARROW_UP"})},ArrowDown(){a({type:"CONTENT.ARROW_DOWN"})},Home(){a({type:"CONTENT.HOME"})},End(){a({type:"CONTENT.END"})},Enter(){a({type:"ITEM.CLICK",src:"keydown.enter"})},Space(H){C?a({type:"CONTENT.TYPEAHEAD",key:H.key}):O.Enter?.()}},D=O[zr(E)];if(D){D(E),E.preventDefault();return}const V=ut(E);lu(V)||Xr.isValidEvent(E)&&(a({type:"CONTENT.TYPEAHEAD",key:E.key}),E.preventDefault())}})},getListProps(){return t.element({...pe.list.attrs,tabIndex:0,role:h?void 0:"listbox","aria-labelledby":io(r),"aria-activedescendant":h?void 0:$,"aria-multiselectable":!h&&s("multiple")?!0:void 0})}}}var sp=e=>e.multiple?Array.from(e.selectedOptions,t=>t.value):e.value?[e.value]:[];function rp(e,t,n){let s=[],r;return o=>{const i=e(o);return(i.length!==s.length||i.some((c,l)=>!mn(s[l],c)))&&(s=i,r=t(i,o)),r}}function op(){const e=new Map;return{claim(t){const n=Symbol(t);return e.set(t,n),n},isReplaced(t,n){return e.get(t)!==n}}}var Ct=".",Tl="#",Ui=new WeakMap,Cl=new WeakMap;function co(e){return e.join(Ct)}function ip(e){return e.includes(Ct)}function kl(e){return e.startsWith(Tl)}function ap(e){return e.startsWith(Ct)}function lp(e){return kl(e)?e.slice(Tl.length):e}function uo(e,t){return e?`${e}${Ct}${t}`:t}function cp(e){const t=new Map,n=new Map,s=(r,o)=>{t.set(r,o);const i=o.id;i&&(n.has(i)&&$i(`[zag-js] Duplicate state id: "${i}"`),n.set(i,r));const a=o.states;if(a){Xs(o.initial,()=>`[zag-js] Compound state "${r}" has child states but no "initial" property`),o.initial in a||$i(`[zag-js] Compound state "${r}" has initial "${String(o.initial)}" which is not a child state`);for(const[c,l]of Object.entries(a)){if(!l)continue;const p=uo(r,c);s(p,l)}}};for(const[r,o]of Object.entries(e.states))o&&s(r,o);return{index:t,idIndex:n}}function Xn(e){const t=Ui.get(e);if(t)return t;const{index:n,idIndex:s}=cp(e);return Ui.set(e,n),Cl.set(e,s),n}function dp(e,t){return Xn(e),Cl.get(e)?.get(t)}function Bo(e){return e?String(e).split(Ct).filter(Boolean):[]}function Gs(e,t){if(!t)return[];const n=Xn(e),s=Bo(t),r=[],o=[];for(const i of s){o.push(i);const a=co(o),c=n.get(a);if(!c)break;r.push({path:a,state:c})}return r}function An(e,t){const n=Xn(e),s=Bo(t);if(!s.length)return t;const r=[];for(const a of s){r.push(a);const c=co(r);if(!n.has(c))return t}let o=co(r),i=n.get(o);for(;i?.initial;){const a=`${o}${Ct}${i.initial}`,c=n.get(a);if(!c)break;o=a,i=c}return o}function qi(e,t){return Xn(e).has(t)}function Gi(e,t,n){const s=String(t);if(kl(s)){const r=lp(s),o=dp(e,r);return Xs(o,()=>`[zag-js] Unknown state id: "${r}"`),An(e,o)}if(ap(s)&&n){const r=uo(n,s.slice(1));return An(e,r)}if(!ip(s)&&n){const r=Bo(n);for(let o=r.length-1;o>=1;o--){const i=r.slice(0,o).join(Ct),a=uo(i,s);if(qi(e,a))return An(e,a)}if(qi(e,s))return An(e,s)}return An(e,s)}function up(e,t,n){const s=Gs(e,t);for(let o=s.length-1;o>=0;o--){const a=s[o]?.state.on?.[n];if(a)return{transitions:a,source:s[o]?.path}}return{transitions:e.on?.[n],source:void 0}}function fp(e,t,n,s){const r=t?Gs(e,t):[],o=Gs(e,n);let i=0;for(;i<r.length&&i<o.length&&r[i]?.path===o[i]?.path;)i+=1;let a=r.slice(i).reverse(),c=o.slice(i);const l=r[r.length-1]?.path===o[o.length-1]?.path;return s&&l&&(a=r.slice().reverse(),c=o),{exiting:a,entering:c}}function hp(e,t){return e?e===t||e.startsWith(`${t}${Ct}`):!1}function pp(e,t,n){return Gs(e,t).some(s=>s.state.tags?.includes(n))}function Al(){return{and:(...e)=>function(n){return e.every(s=>n.guard(s))},or:(...e)=>function(n){return e.some(s=>n.guard(s))},not:e=>function(n){return!n.guard(e)}}}function Ol(e){return Xn(e),e}var Fn=(e=>(e.NotStarted="Not Started",e.Started="Started",e.Stopped="Stopped",e))(Fn||{}),fs="__init__";function gp(e){const t=()=>e.getRootNode?.()??document,n=()=>Oe(t());return{...e,getRootNode:t,getDoc:n,getWin:()=>n().defaultView??window,getActiveElement:()=>er(t()),isActiveElement:Kr,getById:i=>t().getElementById(i)}}function mp(e){const t={each(n){for(let s=0;s<e.frames?.length;s+=1){const r=e.frames[s];r&&n(r)}},addEventListener(n,s,r){return t.each(o=>{try{o.document.addEventListener(n,s,r)}catch{}}),()=>{try{t.removeEventListener(n,s,r)}catch{}}},removeEventListener(n,s,r){t.each(o=>{try{o.document.removeEventListener(n,s,r)}catch{}})}};return t}function vp(e){const t=e.frameElement!=null?e.parent:null;return{addEventListener:(n,s,r)=>{try{t?.addEventListener(n,s,r)}catch{}return()=>{try{t?.removeEventListener(n,s,r)}catch{}}},removeEventListener:(n,s,r)=>{try{t?.removeEventListener(n,s,r)}catch{}}}}var Yi="pointerdown.outside",Ki="focus.outside";function yp(e){for(const t of e)if(ce(t)&&tr(t))return!0;return!1}var Ll=e=>"clientY"in e;function bp(e,t){if(!Ll(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 wp(e,t){return e.y<=t.y&&t.y<=e.y+e.height&&e.x<=t.x&&t.x<=e.x+e.width}function zi(e,t){if(!t||!Ll(e))return!1;const n=t.scrollHeight>t.clientHeight,s=n&&e.clientX>t.offsetLeft+t.clientWidth,r=t.scrollWidth>t.clientWidth,o=r&&e.clientY>t.offsetTop+t.clientHeight,i={x:t.offsetLeft,y:t.offsetTop,width:t.clientWidth+(n?16:0),height:t.clientHeight+(r?16:0)},a={x:e.clientX,y:e.clientY};return wp(i,a)?s||o:!1}function Ep(e,t){const{exclude:n,onFocusOutside:s,onPointerDownOutside:r,onInteractOutside:o,defer:i,followControlledElements:a=!0}=t;if(!e)return;const c=Oe(e),l=fe(e),p=mp(l),u=vp(l);function f(x,C){if(!ce(C)||!C.isConnected||cn(e,C)||bp(e,x)||a&&Iu(e,C))return!1;const w=c.querySelector(`[aria-controls="${e.id}"]`);if(w){const R=Zr(w);if(zi(x,R))return!1}const $=Zr(e);return zi(x,$)?!1:!n?.(C)}const h=new Set,g=ln(e?.getRootNode());let d=!1;function m(x){d=!0;const C=()=>{d=!1};c.addEventListener("pointerup",C,{once:!0}),l.addEventListener("pointerup",C,{once:!0});function w($){const R=i&&!Ti()?ue:O=>O(),L=$??x,E=L?.composedPath?.()??[L?.target];R(()=>{const O=g?E[0]:ut(x);if(!(!e||!f(x,O))){if(r||o){const D=Fs(r,o);e.addEventListener(Yi,D,{once:!0})}Zi(e,Yi,{bubbles:!1,cancelable:!0,detail:{originalEvent:L,contextmenu:Au(L),focusable:yp(E),target:O}})}})}x.pointerType==="touch"?(h.forEach($=>$()),h.add(As(c,"click",w,{once:!0})),h.add(u.addEventListener("click",w,{once:!0})),h.add(p.addEventListener("click",w,{once:!0}))):w()}const y=new Set,b=setTimeout(()=>{y.add(As(c,"pointerdown",m,!0)),y.add(u.addEventListener("pointerdown",m,!0)),y.add(p.addEventListener("pointerdown",m,!0))},0),T=ol.create();function M(x){if(d)return;(i?w=>T.request(w):w=>w())(()=>{const w=x?.composedPath?.()??[x?.target],$=g?w[0]:ut(x);if(!(!e||!f(x,$))){if(s||o){const R=Fs(s,o);e.addEventListener(Ki,R,{once:!0})}Zi(e,Ki,{bubbles:!1,cancelable:!0,detail:{originalEvent:x,contextmenu:!1,focusable:tr($),target:$}})}})}return Ti()||(y.add(As(c,"focusin",M,!0)),y.add(u.addEventListener("focusin",M,!0)),y.add(p.addEventListener("focusin",M,!0))),()=>{clearTimeout(b),T.cancel(),h.forEach(x=>x()),y.forEach(x=>x())}}function xp(e,t){const{defer:n}=t,s=n?ue:o=>o(),r=[];return r.push(s(()=>{const o=typeof e=="function"?e():e;r.push(Ep(o,t))})),()=>{r.forEach(o=>o?.())}}function Zi(e,t,n){const s=e.ownerDocument.defaultView||window,r=new s.CustomEvent(t,n);return e.dispatchEvent(r)}function Sp(e,t){const n=s=>{s.key==="Escape"&&(s.isComposing||t?.(s))};return As(Oe(e),"keydown",n,{capture:!0})}var Ji="layer:request-dismiss",ve={layers:[],branches:[],recentlyRemoved:new Set,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(s=>s.type===t)},getParentLayerOfType(e,t){const n=this.indexOf(e);if(!(n<=0))return this.layers.slice(0,n).reverse().find(s=>s.type===t)},countNestedLayersOfType(e,t){return this.getNestedLayersByType(e,t).length},isInNestedLayer(e,t){return!!(this.getNestedLayers(e).some(s=>cn(s.node,t))||this.recentlyRemoved.size>0)},isInBranch(e){return Array.from(this.branches).some(t=>cn(t,e))},add(e){const t=this.indexOf(e.node);t!==-1&&this.layers.splice(t,1),this.layers.push(e),this.syncLayers()},addBranch(e){this.branches.push(e)},remove(e){const t=this.indexOf(e);if(t<0)return;this.layers[t].styleTargets?.forEach(s=>{const r=s();r&&$p(r)}),this.recentlyRemoved.add(e),al(()=>this.recentlyRemoved.delete(e)),t<this.count()-1&&this.getNestedLayers(e).forEach(r=>ve.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)=>{Xi(e,t,e.node),e.styleTargets?.forEach(n=>{const s=n();if(!s||s===e.node)return;Xi(e,t,s);const{zIndex:r}=tl(e.node);s.style.setProperty("--z-index",r)})})},indexOf(e){return this.layers.findIndex(t=>t.node===e)},dismiss(e,t){const n=this.indexOf(e);if(n===-1)return;const s=this.layers[n];Tp(e,Ji,r=>{s.requestDismiss?.(r),r.defaultPrevented||s?.dismiss()}),Ip(e,Ji,{originalLayer:e,targetLayer:t,originalIndex:n,targetIndex:t?this.indexOf(t):-1}),this.syncLayers()},clear(){this.remove(this.layers[0].node)}};function Xi(e,t,n){n.style.setProperty("--layer-index",`${t}`),n.removeAttribute("data-nested"),n.removeAttribute("data-has-nested"),ve.getParentLayerOfType(e.node,e.type)&&n.setAttribute("data-nested",e.type);const r=ve.countNestedLayersOfType(e.node,e.type);r>0&&n.setAttribute("data-has-nested",e.type),n.style.setProperty("--nested-layer-count",`${r}`)}function $p(e){e.style.removeProperty("--layer-index"),e.style.removeProperty("--nested-layer-count"),e.removeAttribute("data-nested"),e.removeAttribute("data-has-nested")}function Ip(e,t,n){const s=e.ownerDocument.defaultView||window,r=new s.CustomEvent(t,{cancelable:!0,bubbles:!0,detail:n});return e.dispatchEvent(r)}function Tp(e,t,n){e.addEventListener(t,n,{once:!0})}var Lr=new WeakMap,Wn=new WeakMap;function Cp(e){return ve.isBelowPointerBlockingLayer(e)?"none":"auto"}function Ml(e){const t=Cp(e);e.style.pointerEvents!==t&&(e.style.pointerEvents=t)}function kp(e){if(Wn.has(e))return;const t=fe(e);if(typeof t.MutationObserver>"u")return;const n=new t.MutationObserver(()=>{Wn.has(e)&&Ml(e)});n.observe(e,{attributes:!0,attributeFilter:["style"]}),Wn.set(e,n)}function Qi(){ve.layers.forEach(({node:e})=>{Ml(e),kp(e)})}function Ap(e){const t=Wn.get(e);t&&(t.disconnect(),Wn.delete(e)),e.style.pointerEvents=""}function Op(e,t){const n=Oe(e),s=[];return ve.hasPointerBlockingLayer()&&!n.body.hasAttribute("data-inert")&&(Lr.set(n.body,n.body.style.pointerEvents),queueMicrotask(()=>{const r=n.body;r&&(r.style.pointerEvents="none",r.setAttribute("data-inert",""))})),t?.forEach(r=>{const[o,i]=Ef(()=>{const a=r();return ce(a)?a:null},{timeout:1e3});o.then(a=>s.push(gf(a,{pointerEvents:"auto"}))),s.push(i)}),()=>{ve.hasPointerBlockingLayer()||(queueMicrotask(()=>{const r=n.body;if(!r)return;const o=Lr.get(r);o!==void 0&&(r.style.pointerEvents=o,Lr.delete(r)),r.removeAttribute("data-inert"),r.style.length===0&&r.removeAttribute("style")}),s.forEach(r=>r()))}}function Lp(e,t){const{onDismiss:n,onRequestDismiss:s,pointerBlocking:r,exclude:o,debug:i,type:a="dialog",layerStyleTargets:c}=t,l={dismiss:n,node:e,type:a,pointerBlocking:r,requestDismiss:s,styleTargets:c};ve.add(l),Qi();function p(d){const m=ut(d.detail.originalEvent);ve.isBelowPointerBlockingLayer(e)||ve.isInBranch(m)||(t.onPointerDownOutside?.(d),t.onInteractOutside?.(d),!d.defaultPrevented&&(i&&console.log("onPointerDownOutside:",d.detail.originalEvent),n?.(d)))}function u(d){const m=ut(d.detail.originalEvent);ve.isInBranch(m)||(t.onFocusOutside?.(d),t.onInteractOutside?.(d),!d.defaultPrevented&&(i&&console.log("onFocusOutside:",d.detail.originalEvent),n?.(d)))}function f(d){ve.isTopMost(e)&&(t.onEscapeKeyDown?.(d),!d.defaultPrevented&&n&&(d.preventDefault(),n(d)))}function h(d){const m=typeof o=="function"?o():o,y=Array.isArray(m)?m:[m],b=t.persistentElements?.map(T=>T()).filter(ce);return b&&y.push(...b),y.some(T=>cn(T,d))||ve.isInNestedLayer(e,d)}const g=[r?Op(e,t.persistentElements):void 0,Sp(e,f),xp(e,{exclude:h,onFocusOutside:u,onPointerDownOutside:p,defer:t.defer})];return()=>{ve.remove(e),Qi(),Ap(e),g.forEach(d=>d?.())}}function Dl(e,t){const{warnOnMissingNode:n=!0}=t;return Sf(e,s=>Lp(s,t),{defer:t.defer,getRootNode:t.getRootNode,onMissing:n?()=>Cs("[@zag-js/dismissable] node is `null` or `undefined`"):void 0})}var{and:On,not:Mt,or:Mp}=Al(),Dp=Ol({props({props:e}){return{loopFocus:!1,closeOnSelect:!e.multiple,composite:!0,defaultValue:[],...e,collection:e.collection??Hs.empty(),positioning:{placement:"bottom-start",gutter:8,...e.positioning}}},context({prop:e,bindable:t,getContext:n}){const s=e("value")??e("defaultValue")??[],r=e("collection").findMany(s);return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:mn,onChange(o){const i=n(),a=e("collection"),c=i.get("selectedItemMap"),l=ls({values:o,collection:a,selectedItemMap:c}),p=e("value")??o,u=p===o?l:ls({values:p,collection:a,selectedItemMap:l.nextSelectedItemMap});return i.set("selectedItemMap",u.nextSelectedItemMap),e("onValueChange")?.({value:o,items:l.selectedItems})}})),highlightedValue:t(()=>({defaultValue:e("defaultHighlightedValue")||null,value:e("highlightedValue"),onChange(o){e("onHighlightChange")?.({highlightedValue:o,highlightedItem:e("collection").find(o),highlightedIndex:e("collection").indexOf(o)})}})),currentPlacement:t(()=>({defaultValue:void 0})),fieldsetDisabled:t(()=>({defaultValue:!1})),highlightedItem:t(()=>({defaultValue:null})),selectedItemMap:t(()=>({defaultValue:Jd({selectedItems:r,collection:e("collection")})}))}},refs(){return{typeahead:{...Xr.defaultOptions}}},computed:{hasSelectedItems:({context:e})=>e.get("value").length>0,isTypingAhead:({refs:e})=>e.get("typeahead").keysSoFar!=="",isDisabled:({prop:e,context:t})=>!!e("disabled")||!!t.get("fieldsetDisabled"),isInteractive:({prop:e})=>!(e("disabled")||e("readOnly")),selectedItems:({context:e,prop:t})=>Za({values:e.get("value"),collection:t("collection"),selectedItemMap:e.get("selectedItemMap")}),valueAsString:({computed:e,prop:t})=>t("collection").stringifyItems(e("selectedItems"))},initialState({prop:e}){return e("open")||e("defaultOpen")?"open":"idle"},entry:["syncSelectElement"],watch({context:e,prop:t,track:n,action:s}){n([()=>e.get("value").toString()],()=>{s(["syncSelectedItems","syncSelectElement","dispatchChangeEvent"])}),n([()=>t("open")],()=>{s(["toggleVisibility"])}),n([()=>e.get("highlightedValue")],()=>{s(["syncHighlightedItem"])}),n([()=>t("collection").toString()],()=>{s(["syncCollection"])})},on:{"HIGHLIGHTED_VALUE.SET":{actions:["setHighlightedItem"]},"HIGHLIGHTED_VALUE.CLEAR":{actions:["clearHighlightedItem"]},"ITEM.SELECT":{actions:["selectItem"]},"ITEM.CLEAR":{actions:["clearItem"]},"VALUE.SET":{actions:["setSelectedItems"]},"VALUE.CLEAR":{actions:["clearSelectedItems"]},"CLEAR.CLICK":{actions:["clearSelectedItems","focusTriggerEl"]}},effects:["trackFormControlState"],states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":[{guard:"isTriggerClickEvent",target:"open",actions:["setInitialFocus","highlightFirstSelectedItem"]},{target:"open",actions:["setInitialFocus"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["invokeOnOpen","setInitialFocus","highlightFirstSelectedItem"]}],"TRIGGER.FOCUS":{target:"focused"},OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen"]}]}},focused:{tags:["closed"],on:{"CONTROLLED.OPEN":[{guard:"isTriggerClickEvent",target:"open",actions:["setInitialFocus","highlightFirstSelectedItem"]},{guard:"isTriggerArrowUpEvent",target:"open",actions:["setInitialFocus","highlightComputedLastItem"]},{guard:Mp("isTriggerArrowDownEvent","isTriggerEnterEvent"),target:"open",actions:["setInitialFocus","highlightComputedFirstItem"]},{target:"open",actions:["setInitialFocus"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen"]}],"TRIGGER.BLUR":{target:"idle"},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightFirstSelectedItem"]}],"TRIGGER.ENTER":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedFirstItem"]}],"TRIGGER.ARROW_UP":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedLastItem"]}],"TRIGGER.ARROW_DOWN":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedFirstItem"]}],"TRIGGER.ARROW_LEFT":[{guard:On(Mt("multiple"),"hasSelectedItems"),actions:["selectPreviousItem"]},{guard:Mt("multiple"),actions:["selectLastItem"]}],"TRIGGER.ARROW_RIGHT":[{guard:On(Mt("multiple"),"hasSelectedItems"),actions:["selectNextItem"]},{guard:Mt("multiple"),actions:["selectFirstItem"]}],"TRIGGER.HOME":{guard:Mt("multiple"),actions:["selectFirstItem"]},"TRIGGER.END":{guard:Mt("multiple"),actions:["selectLastItem"]},"TRIGGER.TYPEAHEAD":{guard:Mt("multiple"),actions:["selectMatchingItem"]}}},open:{tags:["open"],exit:["scrollContentToTop"],effects:["trackDismissableElement","trackFocusVisible","computePlacement","scrollToHighlightedItem"],on:{"CONTROLLED.CLOSE":[{guard:"restoreFocus",target:"focused",actions:["focusTriggerEl","clearHighlightedItem"]},{target:"idle",actions:["clearHighlightedItem"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{guard:"restoreFocus",target:"focused",actions:["invokeOnClose","focusTriggerEl","clearHighlightedItem"]},{target:"idle",actions:["invokeOnClose","clearHighlightedItem"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose","clearHighlightedItem"]}],"ITEM.CLICK":[{guard:On("closeOnSelect","isOpenControlled"),actions:["selectHighlightedItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectHighlightedItem","invokeOnClose","focusTriggerEl","clearHighlightedItem"]},{actions:["selectHighlightedItem"]}],"CONTENT.HOME":{actions:["highlightFirstItem"]},"CONTENT.END":{actions:["highlightLastItem"]},"CONTENT.ARROW_DOWN":[{guard:On("hasHighlightedItem","loop","isLastItemHighlighted"),actions:["highlightFirstItem"]},{guard:"hasHighlightedItem",actions:["highlightNextItem"]},{actions:["highlightFirstItem"]}],"CONTENT.ARROW_UP":[{guard:On("hasHighlightedItem","loop","isFirstItemHighlighted"),actions:["highlightLastItem"]},{guard:"hasHighlightedItem",actions:["highlightPreviousItem"]},{actions:["highlightLastItem"]}],"CONTENT.TYPEAHEAD":{actions:["highlightMatchingItem"]},"ITEM.POINTER_MOVE":{actions:["highlightItem"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedItem"]},"POSITIONING.SET":{actions:["reposition"]}}}},implementations:{guards:{loop:({prop:e})=>!!e("loopFocus"),multiple:({prop:e})=>!!e("multiple"),hasSelectedItems:({computed:e})=>!!e("hasSelectedItems"),hasHighlightedItem:({context:e})=>e.get("highlightedValue")!=null,isFirstItemHighlighted:({context:e,prop:t})=>e.get("highlightedValue")===t("collection").firstValue,isLastItemHighlighted:({context:e,prop:t})=>e.get("highlightedValue")===t("collection").lastValue,closeOnSelect:({prop:e,event:t})=>!!(t.closeOnSelect??e("closeOnSelect")),restoreFocus:({event:e})=>ea(e),isOpenControlled:({prop:e})=>e("open")!==void 0,isTriggerClickEvent:({event:e})=>e.previousEvent?.type==="TRIGGER.CLICK",isTriggerEnterEvent:({event:e})=>e.previousEvent?.type==="TRIGGER.ENTER",isTriggerArrowUpEvent:({event:e})=>e.previousEvent?.type==="TRIGGER.ARROW_UP",isTriggerArrowDownEvent:({event:e})=>e.previousEvent?.type==="TRIGGER.ARROW_DOWN"},effects:{trackFocusVisible({scope:e}){return Pf({root:e.getRootNode?.()})},trackFormControlState({context:e,scope:t}){return Vu(kr(t),{onFieldsetDisabledChange(n){e.set("fieldsetDisabled",n)},onFormReset(){const n=e.initial("value");e.set("value",n)}})},trackDismissableElement({scope:e,send:t,prop:n}){const s=()=>kn(e);let r=!0;return Dl(s,{type:"listbox",defer:!0,getRootNode:e.getRootNode,layerStyleTargets:[()=>Ar(e)],exclude:[Pt(e),ep(e)],onFocusOutside:n("onFocusOutside"),onPointerDownOutside:n("onPointerDownOutside"),onInteractOutside(o){n("onInteractOutside")?.(o),r=!(o.detail.focusable||o.detail.contextmenu)},onDismiss(o){t({type:"CLOSE",src:"interact-outside",restoreFocus:r,focusVisible:o?.type==="keydown"})}})},computePlacement({context:e,prop:t,scope:n}){const s=t("positioning");return e.set("currentPlacement",s.placement),ro(()=>Pt(n),()=>Ar(n),{defer:!0,...s,onComplete(i){e.set("currentPlacement",i.placement)}})},scrollToHighlightedItem({context:e,prop:t,scope:n}){const s=a=>{const c=e.get("highlightedValue");if(c==null||to()==="pointer")return;const p=kn(n),u=t("scrollToIndexFn");if(u){const h=t("collection").indexOf(c);u?.({index:h,immediate:a,getElement:()=>Or(n,c)});return}const f=Or(n,c);cf(f,{rootEl:p,block:"nearest"})},r=ue(()=>{Rf("virtual"),s(!0)}),i=Ju(()=>kn(n),{attributes:["data-activedescendant"],callback(){s(!1)}});return()=>{r(),i()}}},actions:{reposition({context:e,prop:t,scope:n,event:s}){const r=()=>Ar(n);ro(Pt(n),r,{...t("positioning"),...s.options,defer:!0,listeners:!1,onComplete(o){e.set("currentPlacement",o.placement)}})},toggleVisibility({send:e,prop:t,event:n}){e({type:t("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:n})},highlightPreviousItem({context:e,prop:t}){const n=e.get("highlightedValue");if(n==null)return;const s=t("collection").getPreviousValue(n,1,t("loopFocus"));s!=null&&e.set("highlightedValue",s)},highlightNextItem({context:e,prop:t}){const n=e.get("highlightedValue");if(n==null)return;const s=t("collection").getNextValue(n,1,t("loopFocus"));s!=null&&e.set("highlightedValue",s)},highlightFirstItem({context:e,prop:t}){const n=t("collection").firstValue;e.set("highlightedValue",n)},highlightLastItem({context:e,prop:t}){const n=t("collection").lastValue;e.set("highlightedValue",n)},setInitialFocus({scope:e}){ue(()=>{const t=Gu({root:kn(e)});t&&t.focus({preventScroll:!0})})},focusTriggerEl({event:e,scope:t}){if(!ea(e))return;const n=Rp(e);ue(()=>{Pt(t)?.focus(n)})},selectHighlightedItem({context:e,prop:t,event:n}){let s=n.value??e.get("highlightedValue");if(s==null||!t("collection").has(s))return;t("onSelect")?.({value:s}),s=t("deselectable")&&!t("multiple")&&e.get("value").includes(s)?null:s,e.set("value",o=>s==null?[]:t("multiple")?wi(o,s):[s])},highlightComputedFirstItem({context:e,prop:t,computed:n}){const s=t("collection"),r=n("hasSelectedItems")?s.sort(e.get("value"))[0]:s.firstValue;e.set("highlightedValue",r)},highlightComputedLastItem({context:e,prop:t,computed:n}){const s=t("collection"),r=n("hasSelectedItems")?s.sort(e.get("value"))[0]:s.lastValue;e.set("highlightedValue",r)},highlightFirstSelectedItem({context:e,prop:t,computed:n}){if(!n("hasSelectedItems"))return;const s=t("collection").sort(e.get("value"))[0];e.set("highlightedValue",s)},highlightItem({context:e,event:t}){e.set("highlightedValue",t.value)},highlightMatchingItem({context:e,prop:t,event:n,refs:s}){const r=t("collection").search(n.key,{state:s.get("typeahead"),currentValue:e.get("highlightedValue")});r!=null&&e.set("highlightedValue",r)},setHighlightedItem({context:e,event:t}){e.set("highlightedValue",t.value)},clearHighlightedItem({context:e}){e.set("highlightedValue",null)},selectItem({context:e,prop:t,event:n}){t("onSelect")?.({value:n.value});const r=t("deselectable")&&!t("multiple")&&e.get("value").includes(n.value)?null:n.value;e.set("value",o=>r==null?[]:t("multiple")?wi(o,r):[r])},clearItem({context:e,event:t}){e.set("value",n=>n.filter(s=>s!==t.value))},setSelectedItems({context:e,event:t}){e.set("value",t.value)},clearSelectedItems({context:e}){e.set("value",[])},selectPreviousItem({context:e,prop:t}){const[n]=e.get("value"),s=t("collection").getPreviousValue(n);s&&e.set("value",[s])},selectNextItem({context:e,prop:t}){const[n]=e.get("value"),s=t("collection").getNextValue(n);s&&e.set("value",[s])},selectFirstItem({context:e,prop:t}){const n=t("collection").firstValue;n&&e.set("value",[n])},selectLastItem({context:e,prop:t}){const n=t("collection").lastValue;n&&e.set("value",[n])},selectMatchingItem({context:e,prop:t,event:n,refs:s}){const r=t("collection").search(n.key,{state:s.get("typeahead"),currentValue:e.get("value")[0]});r!=null&&e.set("value",[r])},scrollContentToTop({prop:e,scope:t}){if(e("scrollToIndexFn")){const n=e("collection").firstValue;e("scrollToIndexFn")?.({index:0,immediate:!0,getElement:()=>Or(t,n)})}else kn(t)?.scrollTo(0,0)},invokeOnOpen({prop:e,context:t}){e("onOpenChange")?.({open:!0,value:t.get("value")})},invokeOnClose({prop:e,context:t}){e("onOpenChange")?.({open:!1,value:t.get("value")})},syncSelectElement({context:e,prop:t,scope:n}){const s=kr(n);if(s){if(e.get("value").length===0&&!t("multiple")){s.selectedIndex=-1;return}for(const r of s.options)r.selected=e.get("value").includes(r.value)}},syncCollection({context:e,prop:t}){const n=t("collection"),s=n.find(e.get("highlightedValue"));s&&e.set("highlightedItem",s);const r=ls({values:e.get("value"),collection:n,selectedItemMap:e.get("selectedItemMap")});e.set("selectedItemMap",r.nextSelectedItemMap)},syncSelectedItems({context:e,prop:t}){const n=ls({values:e.get("value"),collection:t("collection"),selectedItemMap:e.get("selectedItemMap")});e.set("selectedItemMap",n.nextSelectedItemMap)},syncHighlightedItem({context:e,prop:t}){const n=t("collection"),s=e.get("highlightedValue"),r=s?n.find(s):null;e.set("highlightedItem",r)},dispatchChangeEvent({scope:e}){queueMicrotask(()=>{const t=kr(e);if(!t)return;const n=e.getWin(),s=new n.Event("change",{bubbles:!0,composed:!0});t.dispatchEvent(Nu(s))})}}}});function ea(e){const t=e.restoreFocus??e.previousEvent?.restoreFocus;return t==null||!!t}function Rp(e){return e.focusVisible??e.previousEvent?.focusVisible?{preventScroll:!0,focusVisible:!0}:{preventScroll:!0}}function Pp(e){return new Proxy({},{get(t,n){return n==="style"?s=>e({style:s}).style:e}})}var Vp=Object.defineProperty,Np=(e,t,n)=>t in e?Vp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,G=(e,t,n)=>Np(e,typeof t!="symbol"?t+"":t,n),ta={onFocus:"onFocusin",onBlur:"onFocusout",onChange:"onInput",onDoubleClick:"onDblclick",htmlFor:"for",className:"class",defaultValue:"value",defaultChecked:"checked"},Fp=new Set(["viewBox","preserveAspectRatio"]),Rl=Pp(e=>Object.entries(e).reduce((t,[n,s])=>{if(s===void 0)return t;n in ta&&(n=ta[n]);const r=Fp.has(n)?n:n.toLowerCase();return t[r]=s,t},{})),hs=new WeakMap,na=new Set(["value","checked","selected"]),Hp=new Set(["viewBox","preserveAspectRatio","clipPath","clipRule","fillRule","strokeWidth","strokeLinecap","strokeLinejoin","strokeDasharray","strokeDashoffset","strokeMiterlimit"]),_p=e=>e.tagName==="svg"||e.namespaceURI==="http://www.w3.org/2000/svg",ps=(e,t)=>_p(e)&&Hp.has(t)?t:t.toLowerCase(),Mr=e=>e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),sa=(e,t,n)=>{if(typeof n=="string"){e.setAttribute("style",n);return}if(n==null&&typeof t=="string"){e.removeAttribute("style");return}const s=e.style;if(s!=null){for(const r in t)n?.[r]==null&&s.removeProperty(Mr(r));for(const r in n){const o=n[r];o==null?s.removeProperty(Mr(r)):s.setProperty(Mr(r),String(o))}}};function ne(e,t,n){const s="default";let r=hs.get(e);r||(r=new Map,hs.set(e,r));const o=r.get(s)||{},i=Object.keys(t),a=(d,m)=>{e.addEventListener(d.toLowerCase(),m)},c=(d,m)=>{e.removeEventListener(d.toLowerCase(),m)},l=d=>d.startsWith("on"),p=d=>!d.startsWith("on"),u=d=>a(d.substring(2),t[d]),f=d=>c(d.substring(2),t[d]),h=d=>{const m=t[d],y=o[d];if(m!==y){if(d==="class"){e.className=m??"";return}if(d==="style"){sa(e,y,m);return}if(na.has(d)){e[d]=m??"";return}if(typeof m=="boolean"&&!d.includes("aria-")){e.toggleAttribute(ps(e,d),m);return}if(d==="children"){e.innerHTML=m;return}if(m!=null){e.setAttribute(ps(e,d),m);return}e.removeAttribute(ps(e,d))}};for(const d in o)t[d]==null&&(d==="class"?e.className="":d==="style"?sa(e,o[d],void 0):na.has(d)?e[d]="":e.removeAttribute(ps(e,d)));return Object.keys(o).filter(l).forEach(d=>{c(d.substring(2),o[d])}),i.filter(l).forEach(u),i.filter(p).forEach(h),r.set(s,t),function(){i.filter(l).forEach(f);const m=hs.get(e);m&&(m.delete(s),m.size===0&&hs.delete(e))}}function Bp(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global}function Pl(e,t){const n=Bp();return n?(n[e]||(n[e]=t()),n[e]):t()}var Ls=Pl("__zag__refSet",()=>new WeakSet),jp=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,Wp=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,Up=e=>typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeName=="string",qp=e=>jp(e)||Wp(e)||Up(e),fo=e=>e!==null&&typeof e=="object",ra=e=>fo(e)&&!Ls.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!qp(e)&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer)&&!(e instanceof Promise)&&!(e instanceof File)&&!(e instanceof Blob)&&!(e instanceof AbortController);const Gp=Symbol(),oa=Object.getPrototypeOf,ho=new WeakMap,Yp=e=>e&&(ho.has(e)?ho.get(e):oa(e)===Object.prototype||oa(e)===Array.prototype),Kp=e=>Yp(e)&&e[Gp]||null,ia=(e,t=!0)=>{ho.set(e,t)};var Rt=Pl("__zag__proxyStateMap",()=>new WeakMap),zp=(e=Object.is,t=(a,c)=>new Proxy(a,c),n=new WeakMap,s=(a,c)=>{const l=n.get(a);if(l?.[0]===c)return l[1];const p=Array.isArray(a)?[]:Object.create(Object.getPrototypeOf(a));return ia(p,!0),n.set(a,[c,p]),Reflect.ownKeys(a).forEach(u=>{const f=Reflect.get(a,u);Ls.has(f)?(ia(f,!1),p[u]=f):Rt.has(f)?p[u]=Jp(f):p[u]=f}),Object.freeze(p)},r=new WeakMap,o=[1,1],i=a=>{if(!fo(a))throw new Error("object required");const c=r.get(a);if(c)return c;let l=o[0];const p=new Set,u=(w,$=++o[0])=>{l!==$&&(l=$,p.forEach(R=>R(w,$)))};let f=o[1];const h=(w=++o[1])=>(f!==w&&!p.size&&(f=w,d.forEach(([$])=>{const R=$[1](w);R>l&&(l=R)})),l),g=w=>($,R)=>{const L=[...$];L[1]=[w,...L[1]],u(L,R)},d=new Map,m=(w,$)=>{if(p.size){const R=$[3](g(w));d.set(w,[$,R])}else d.set(w,[$])},y=w=>{const $=d.get(w);$&&(d.delete(w),$[1]?.())},b=w=>(p.add(w),p.size===1&&d.forEach(([R,L],E)=>{const O=R[3](g(E));d.set(E,[R,O])}),()=>{p.delete(w),p.size===0&&d.forEach(([R,L],E)=>{L&&(L(),d.set(E,[R]))})}),T=Array.isArray(a)?[]:Object.create(Object.getPrototypeOf(a)),x=t(T,{deleteProperty(w,$){const R=Reflect.get(w,$);y($);const L=Reflect.deleteProperty(w,$);return L&&u(["delete",[$],R]),L},set(w,$,R,L){const E=Reflect.has(w,$),O=Reflect.get(w,$,L);if(E&&(e(O,R)||r.has(R)&&e(O,r.get(R))))return!0;y($),fo(R)&&(R=Kp(R)||R);let D=R;if(!Object.getOwnPropertyDescriptor(w,$)?.set){!Rt.has(R)&&ra(R)&&(D=Vl(R));const V=!Ls.has(D)&&Rt.get(D);V&&m($,V)}return Reflect.set(w,$,D,L),u(["set",[$],R,O]),!0}});r.set(a,x);const C=[T,h,s,b];return Rt.set(x,C),Reflect.ownKeys(a).forEach(w=>{const $=Object.getOwnPropertyDescriptor(a,w);$.get||$.set?Object.defineProperty(T,w,$):x[w]=a[w]}),x})=>[i,Rt,Ls,e,t,ra,n,s,r,o],[Zp]=zp();function Vl(e={}){return Zp(e)}function aa(e,t,n){const s=Rt.get(e);let r;const o=[],i=s[3];let a=!1;const l=i(p=>{o.push(p),r||(r=Promise.resolve().then(()=>{r=void 0,a&&t(o.splice(0))}))});return a=!0,()=>{a=!1,l()}}function Jp(e){const t=Rt.get(e),[n,s,r]=t;return r(n,s())}function Ys(e){const t=e().value??e().defaultValue;e().debug&&console.log(`[bindable > ${e().debug}] initial`,t);const n=e().isEqual??Object.is,s=Vl({value:t}),r=()=>e().value!==void 0;return{initial:t,ref:s,get(){return r()?e().value:s.value},set(o){const i=r()?e().value:s.value,a=Ze(o)?o(i):o;e().debug&&console.log(`[bindable > ${e().debug}] setValue`,{next:a,prev:i}),r()||(s.value=a),n(a,i)||e().onChange?.(a,i)},invoke(o,i){e().onChange?.(o,i)},hash(o){return e().hash?.(o)??String(o)}}}Ys.cleanup=e=>{};Ys.ref=e=>{let t=e;return{get:()=>t,set:n=>{t=n}}};function Xp(e){const t={current:e};return{get(n){return t.current[n]},set(n,s){t.current[n]=s}}}var{defineProperty:Qp,getOwnPropertyDescriptor:eg,getOwnPropertyDescriptors:la}=Object;function Hn(e,t){if(Object.is(e,t))return e;if(!Vn(e)||!Vn(t))return t===void 0?e:t;let n=e;const s=(r,o)=>{n===e&&(n=Object.defineProperties({},la(e))),Qp(n,r,o)};for(const[r,o]of Object.entries(la(t))){if(!o.enumerable)continue;if(o.get){s(r,o);continue}const i=o.value;if(i===void 0)continue;const a=!!eg(e,r)?.get,c=e[r],l=Vn(c)&&Vn(i)?Hn(c,i):i;!a&&Object.is(c,l)||s(r,{value:l,writable:!0,enumerable:!0,configurable:!0})}return n}var Nl=class{constructor(e,t={}){G(this,"machine",e),G(this,"scope"),G(this,"context"),G(this,"prop"),G(this,"state"),G(this,"refs"),G(this,"computed"),G(this,"event",{type:""}),G(this,"previousEvent",{type:""}),G(this,"effects",new Map),G(this,"replaceTracker",op()),G(this,"transition",null),G(this,"cleanups",[]),G(this,"subscriptions",[]),G(this,"userProps"),G(this,"userPropsSources",[]),G(this,"getUserProps",()=>{let u=this.userProps;for(const f of this.userPropsSources){const h=Si(f);u=u?Hn(u,h):h}return u}),G(this,"getEvent",()=>({...this.event,current:()=>this.event,previous:()=>this.previousEvent})),G(this,"getState",()=>({...this.state,matches:(...u)=>u.some(f=>hp(this.state.get(),f)),hasTag:u=>pp(this.machine,this.state.get(),u)})),G(this,"debug",(...u)=>{this.machine.debug&&console.log(...u)}),G(this,"notify",()=>{this.publish()}),G(this,"send",u=>{if(this.status!==Fn.Started)return;const f=u?.replaces,h=f?this.replaceTracker.claim(f):void 0;queueMicrotask(()=>{if(!u||f&&h&&this.replaceTracker.isReplaced(f,h))return;this.previousEvent=this.event,this.event=u,this.debug("send",u);let g=this.state.get();const d=u.type,{transitions:m,source:y}=up(this.machine,g,d),b=this.choose(m);if(!b)return;this.transition=b;const T=Gi(this.machine,b.target??g,y);this.debug("transition",b),T!==g?this.state.set(T):b.reenter?this.state.invoke(g,g):this.action(b.actions)})}),G(this,"action",u=>{const f=Ze(u)?u(this.getParams()):u;if(!f)return;const h=f.map(g=>{const d=this.machine.implementations?.actions?.[g];return d||Cs(`[zag-js] No implementation found for action "${JSON.stringify(g)}"`),d});for(const g of h)g?.(this.getParams())}),G(this,"guard",u=>{if(Ze(u))return u(this.getParams());const f=this.machine.implementations?.guards?.[u];return f||Cs(`[zag-js] No implementation found for guard "${JSON.stringify(u)}"`),f?.(this.getParams())}),G(this,"effect",u=>{const f=Ze(u)?u(this.getParams()):u;if(!f)return;const h=f.map(d=>{const m=this.machine.implementations?.effects?.[d];return m||Cs(`[zag-js] No implementation found for effect "${JSON.stringify(d)}"`),m}),g=[];for(const d of h){const m=d?.(this.getParams());m&&g.push(m)}return()=>g.forEach(d=>d?.())}),G(this,"choose",u=>Ld(u).find(f=>{let h=!f.guard;return Fd(f.guard)?h=!!this.guard(f.guard):Ze(f.guard)&&(h=f.guard(this.getParams())),h})),G(this,"subscribe",u=>(this.subscriptions.push(u),()=>{const f=this.subscriptions.indexOf(u);f>-1&&this.subscriptions.splice(f,1)})),G(this,"status",Fn.NotStarted),G(this,"publish",()=>{this.callTrackers(),this.subscriptions.forEach(u=>u(this.service))}),G(this,"trackers",[]),G(this,"setupTrackers",()=>{this.machine.watch?.(this.getParams())}),G(this,"callTrackers",()=>{this.trackers.forEach(({deps:u,fn:f})=>{const h=u.map(g=>g());mn(f.prev,h)||(f(),f.prev=h)})}),G(this,"getParams",()=>({state:this.getState(),context:this.context,event:this.getEvent(),prop:this.prop,send:this.send,action:this.action,guard:this.guard,track:(u,f)=>{f.prev=u.map(h=>h()),this.trackers.push({deps:u,fn:f})},refs:this.refs,computed:this.computed,flush:qd,scope:this.scope,choose:this.choose})),Ze(t)?this.userPropsSources.push(t):this.userProps=t;const{id:n,ids:s,getRootNode:r}=Si(t);this.scope=gp({id:n,ids:s,getRootNode:r});const o=u=>{const f=this.getUserProps();return(e.props?.({props:To(f),scope:this.scope})??f)[u]};this.prop=o;const i=e.context?.({prop:o,bindable:Ys,scope:this.scope,flush(u){queueMicrotask(u)},getContext(){return a},getComputed(){return c},getRefs(){return l},getEvent:this.getEvent.bind(this)});i&&Object.values(i).forEach(u=>{const f=aa(u.ref,()=>this.notify());this.cleanups.push(f)});const a={get(u){return i?.[u].get()},set(u,f){i?.[u].set(f)},initial(u){return i?.[u].initial},hash(u){const f=i?.[u].get();return i?.[u].hash(f)}};this.context=a;const c=u=>(Xs(e.computed,()=>"[zag-js] No computed object found on machine"),e.computed[u]({context:a,event:this.getEvent(),prop:o,refs:this.refs,scope:this.scope,computed:c}));this.computed=c;const l=Xp(e.refs?.({prop:o,context:a})??{});this.refs=l;const p=Ys(()=>({defaultValue:Gi(e,e.initialState({prop:o})),onChange:(u,f)=>{const{exiting:h,entering:g}=fp(this.machine,f,u,this.transition?.reenter);if(h.forEach(d=>{this.effects.get(d.path)?.(),this.effects.delete(d.path)}),h.forEach(d=>{this.action(d.state?.exit)}),this.action(this.transition?.actions),g.forEach(d=>{const m=this.effect(d.state?.effects);if(m){const y=this.effects.get(d.path);this.effects.set(d.path,y?Fs(y,m):m)}}),f===fs){this.action(e.entry);const d=this.effect(e.effects);if(d){const m=this.effects.get(fs);this.effects.set(fs,m?Fs(m,d):d)}}g.forEach(d=>{this.action(d.state?.entry)})}}));this.state=p,this.cleanups.push(aa(this.state.ref,()=>this.notify()))}updateProps(e){const t=this.userPropsSources;if(Ze(e))t.push(e);else if(t.length===0)this.userProps=Hn(this.userProps,e);else{const n=t.length-1,s=t[n];if(Ze(s)){const r=Hn({},e);r&&Object.keys(r).length>0&&t.push(r)}else t[n]=Hn(s,e)}this.notify()}start(){this.status=Fn.Started,this.debug("initializing..."),this.state.invoke(this.state.initial,fs),this.setupTrackers()}stop(){this.effects.forEach(e=>e?.()),this.effects.clear(),this.transition=null,this.action(this.machine.exit),this.cleanups.forEach(e=>e()),this.cleanups=[],this.subscriptions=[],this.status=Fn.Stopped,this.debug("unmounting...")}get service(){return{state:this.getState(),send:this.send,context:this.context,prop:this.prop,scope:this.scope,refs:this.refs,computed:this.computed,event:this.getEvent(),getStatus:()=>this.status}}};const tg='<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m4 6 4 4 4-4"/></svg>',wt=new Map;let ng=0;function sg(e){const t=document.createElement("span");t.className="ui-select",t.innerHTML=`<button type="button" class="ui-select-trigger"><span></span>${tg}</button><div class="ui-select-positioner" popover="manual"><div class="ui-select-menu"></div></div>`,e.after(t),e.hidden=!0;const n=t.querySelector("button"),s=n.querySelector("span"),r=t.querySelector(".ui-select-positioner"),o=t.querySelector(".ui-select-menu");let i=[],a="",c=e.value,l=e.disabled;const p=new Nl(Dp,{id:`select-${++ng}`,collection:Hs({items:i}),defaultValue:[c],disabled:l,positioning:{placement:"bottom-start",strategy:"fixed",sameWidth:!0,gutter:6},onValueChange({value:d}){e.value!==d[0]&&(c=e.value=d[0]??"",e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})))}}),u=()=>np(p.service,Rl);function f(){const d=u();ne(t,d.getRootProps()),ne(n,{...d.getTriggerProps(),"aria-label":e.getAttribute("aria-label")||e.labels?.[0]?.textContent?.trim(),"aria-labelledby":void 0}),ne(r,d.getPositionerProps()),ne(o,{...d.getContentProps(),"aria-label":e.getAttribute("aria-label"),"aria-labelledby":void 0});const m=e.selectedOptions[0]?.textContent||"Choose…";s.textContent!==m&&(s.textContent=m),i.forEach((y,b)=>{const T=o.children[b];ne(T,d.getItemProps({item:y}))}),r.hidden=!d.open,d.open&&!r.matches(":popover-open")&&r.showPopover?.(),!d.open&&r.matches(":popover-open")&&r.hidePopover?.()}function h(){const d=Array.from(e.options,y=>({value:y.value,label:y.text,disabled:y.disabled})),m=JSON.stringify(d);m!==a&&(a=m,i=d,o.replaceChildren(...i.map(y=>{const b=document.createElement("div");return b.className="ui-select-option",b.textContent=y.label,b})),p.updateProps({collection:Hs({items:i})})),c!==e.value&&(c=e.value,u().setValue([c])),l!==e.disabled&&(l=e.disabled,p.updateProps({disabled:l})),f()}t.addEventListener("keydown",d=>d.stopPropagation()),e.addEventListener("change",h);const g=p.subscribe(f);return p.start(),h(),{sync:h,focus:()=>n.focus(),dispose(){e.removeEventListener("change",h),g(),p.stop(),t.remove(),e.hidden=!1}}}function Yn(e=document){for(const[t,n]of wt)t.isConnected||(n.dispose(),wt.delete(t));for(const t of e.querySelectorAll("select:not([data-native])"))wt.has(t)?wt.get(t).sync():wt.set(t,sg(t))}function rg(e){Yn(e.parentElement),wt.get(e)?.focus()}function og(){const e=new MutationObserver(t=>{t.some(n=>n.target instanceof Element&&(n.target.matches("select, option")||[...n.addedNodes,...n.removedNodes].some(s=>s instanceof Element&&(s.matches("select")||s.querySelector("select")))))&&Yn()});return e.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["disabled"]}),Yn(),()=>{e.disconnect();for(const t of wt.values())t.dispose();wt.clear()}}function ig(e){const t=document.createElement("dialog");t.className="launch-dialog",t.setAttribute("aria-labelledby","launch-heading"),t.innerHTML=`
10
+ <button class="icon-button dialog-close" aria-label="Close open session">×</button>
11
+ <h2 id="launch-heading">Open session</h2><p class="launch-title"></p>
12
+ <label class="launch-destination">Open in<select aria-label="Open in">
13
+ ${Pn.map(E=>`<option value="${E.id}">${E.name}</option>`).join("")}
14
+ <option value="web">OpenCode · Web browser</option>
15
+ </select></label>
16
+ <section class="launch-web" hidden>
17
+ <a class="primary-button launch-web-link" target="_blank" rel="noopener noreferrer" hidden>Open in browser ↗</a>
18
+ <details class="launch-pairing"><summary>First time connecting?</summary><p>Run <code>opencode pair</code> in your terminal and open its pairing link once. Then open this session again.</p><button class="text-button launch-copy-pair">Copy pairing command</button></details>
19
+ </section>
20
+ <section class="launch-cli">
21
+ <label class="launch-directory-label">Working directory<input class="launch-directory" aria-label="Working directory" spellcheck="false" autocomplete="off"/></label>
22
+ <div class="launch-summary" hidden><strong class="launch-mode"></strong><p class="launch-hint"></p>
23
+ <details class="launch-context" hidden><summary>Saved context</summary><p class="launch-coverage"></p><code class="launch-context-path"></code></details>
24
+ </div>
25
+ <input class="launch-command" aria-label="CLI command" readonly spellcheck="false" placeholder="Preparing command…"/>
26
+ <div class="launch-actions"><button class="primary-button launch-terminal" disabled>Open Terminal ↗</button><button class="secondary-button launch-copy" disabled>Copy command</button></div>
27
+ <p class="launch-availability"></p>
28
+ </section>
29
+ <p class="launch-status" role="status"></p>`,document.body.append(t);const n=new AbortController,s={signal:n.signal},r=E=>t.querySelector(E),o=r("select"),i=r(".launch-directory"),a=r(".launch-web-link"),c=r(".launch-command"),l=r(".launch-terminal"),p=r(".launch-copy"),u=r(".launch-status");let f,h=0,g=0,d,m,y,b,T,M=null;function x(){g++,m?.abort(),clearTimeout(T),y=void 0,c.value="",l.disabled=p.disabled=!0,r(".launch-summary").hidden=!0,r(".launch-availability").textContent=""}function C(){t.close(),h++,d?.abort(),x(),e(),M?.focus({preventScroll:!0})}async function w(E){try{await navigator.clipboard.writeText(E),u.textContent="Command copied."}catch{u.textContent=`Copy this command: ${E}`,E===c.value&&(c.focus(),c.select())}}function $(){if(a.hidden=!0,a.removeAttribute("href"),f&&b?.webBaseUrl)try{a.href=Td(b.webBaseUrl,f.nativeID||f.id),a.hidden=!1}catch{}u.textContent=b?a.hidden?"OpenCode is unavailable. Choose another app to use the saved conversation.":"":"Finding OpenCode…"}function R(E){const O=Pn.find(D=>D.id===o.value)?.name||We(o.value);c.value=E.command,p.disabled=!1,l.disabled=!E.terminalAvailable,l.textContent=`${E.mode==="resume"?"Resume in":"Open in"} ${O} ↗`,r(".launch-summary").hidden=!1,r(".launch-mode").textContent=E.mode==="resume"?"Resume original session":"New session · saved context",r(".launch-hint").textContent=E.mode==="resume"?`Continue this conversation in ${O}.`:`${O} will read the saved conversation, recap where you left off, and ask what to do next.${E.context?.partial?" Some history is missing or shortened.":""}`,r(".launch-context").hidden=!E.context,r(".launch-coverage").textContent=E.context?.note||"",r(".launch-context-path").textContent=E.context?.path||"",r(".launch-availability").textContent=E.targetAvailable?E.terminalAvailable?"":"Automatic terminal opening is unavailable. Run the copied command in your terminal.":`${O} CLI was not found. Install it, then run the copied command.`,u.textContent=""}async function L(){if(x(),!f||!t.open)return;const E=o.value==="web";if(r(".launch-web").hidden=!E,r(".launch-cli").hidden=E,E){$();return}if(!yr(o.value))return;const O=g;m=new AbortController,u.textContent="Preparing command…";try{const D=await fetch(`/api/sessiongraph/session/${encodeURIComponent(f.id)}/prepare-launch`,{method:"POST",signal:m.signal,headers:{"Content-Type":"application/json","X-SessionGraph-Action":"prepare-launch"},body:JSON.stringify({target:o.value,directory:i.value})}),V=await D.json();if(!D.ok)throw new Error(V.error||"Could not prepare this session.");if(g!==O)return;y=V,R(y)}catch(D){g===O&&(c.placeholder="Command unavailable",u.textContent=D instanceof Error?D.message:"Could not prepare this session.")}}return o.addEventListener("change",()=>{try{localStorage.setItem("sessiongraph.open-target",o.value)}catch{}L()},s),i.addEventListener("input",()=>{x(),u.textContent="Checking working directory…",T=setTimeout(()=>{L()},300)},s),i.addEventListener("change",()=>{L()},s),r(".dialog-close").addEventListener("click",C,s),t.addEventListener("cancel",E=>{E.preventDefault(),C()},s),t.addEventListener("keydown",E=>{E.stopPropagation()},s),p.addEventListener("click",()=>{y&&w(y.command)},s),r(".launch-copy-pair").addEventListener("click",()=>{w("opencode pair")},s),l.addEventListener("click",async()=>{if(!f||!y||l.disabled)return;const E=h;l.disabled=o.disabled=i.disabled=!0,u.textContent="Opening Terminal…";try{const O=await fetch(`/api/sessiongraph/session/${encodeURIComponent(f.id)}/open-terminal`,{method:"POST",headers:{"Content-Type":"application/json","X-SessionGraph-Action":"open-terminal"},body:JSON.stringify({target:o.value,directory:y.directory})}),D=await O.json();if(!O.ok)throw new Error(D.error||"Could not open Terminal.");h===E&&(u.textContent="Session sent to Terminal.")}catch(O){h===E&&(u.textContent=O instanceof Error?O.message:"Could not open Terminal. Copy the command instead.")}finally{h===E&&(o.disabled=i.disabled=!1,l.disabled=!y?.terminalAvailable)}},s),{async open(E){f=E;const O=++h;d?.abort(),d=new AbortController,b=void 0,x(),t.open||(M=document.activeElement),r(".launch-title").textContent=`${We(E.source)} · ${E.title}`,i.value=E.directory,i.disabled=o.disabled=!1,o.value=yr(E.source)?E.source:"opencode";const D=(!E.source||E.source==="opencode")&&ja(E.nativeID||E.id);o.querySelector('[value="web"]').disabled=!D;for(const V of Pn)o.querySelector(`[value="${V.id}"]`).textContent=V.name;try{const V=localStorage.getItem("sessiongraph.open-target")||localStorage.getItem("session-atlas.open-target")||localStorage.getItem("atlas.open-target");(yr(V)||V==="web"&&D)&&(o.value=V)}catch{}c.placeholder="Preparing command…",r(".launch-context").open=!1,t.open||t.showModal(),e(),rg(o),L();try{const V=await fetch(`/api/sessiongraph/session/${encodeURIComponent(E.id)}/connection`,{signal:d.signal});if(!V.ok)throw new Error("Connection unavailable");const H=await V.json();if(h!==O)return;b=H;for(const Z of Pn){const se=H.targets.some(W=>W.id===Z.id&&W.available);o.querySelector(`[value="${Z.id}"]`).textContent=`${Z.name}${se?"":" · CLI not found"}`}o.value==="web"&&$()}catch{h===O&&o.value==="web"&&(u.textContent="OpenCode is unavailable. Choose another app to use the saved conversation.")}},dispose(){h++,d?.abort(),x(),n.abort(),t.remove()}}}const ag=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]);function lg(e,t){const n=document.createElement("dialog");n.className="imports-dialog",n.setAttribute("aria-labelledby","imports-heading"),n.innerHTML='<button class="icon-button dialog-close" aria-label="Close sources">×</button><span class="eyebrow">SessionGraph</span><h2 id="imports-heading">Explore &amp; visualize all your LLM sessions</h2><p class="imports-intro">Your history stays local. Choose the apps to read; import, search, and visualization run on this computer. No account, cloud sync, or telemetry.</p><details class="privacy-disclosure"><summary>Local data &amp; network access</summary><p>Imports are read-only and never start an AI agent. Desktop update checks contact GitHub without session content. Explicitly continuing a session opens another harness, which may contact its model provider.</p><p>Saved history and handoff files are not encrypted by SessionGraph. Your device permissions and backups affect who can access them.</p></details><div class="import-sources"></div><div class="imports-progress" role="status"></div><details class="imports-notes" hidden><summary>Import details</summary><div></div></details><footer><span>Saved locally in SQLite</span><button class="primary-button import-start">Import sessions <span>↗</span></button></footer>',document.body.append(n);const s=x=>n.querySelector(x);let r=!1,o=0,i=!1,a=null,c=!1,l=!1,p=!1;const u=new AbortController;let f=!1,h=0,g;async function d(x,C){const w=await fetch(`/api/sessiongraph/${x}`,{...C,signal:AbortSignal.any([u.signal,AbortSignal.timeout(3e4)])}),$=await w.json();if(w.status===409&&x==="import"&&C?.method==="POST")return d("import");if(!w.ok)throw new Error($.error||"Import unavailable.");return $}function m(x){r=x.running,s(".import-start").disabled=r,n.querySelectorAll("input").forEach(w=>{w.disabled=r}),s(".imports-progress").textContent=r?`${We(x.source)} · ${x.imported.toLocaleString()} imported · ${x.unchanged.toLocaleString()} unchanged${x.discovered?` / ${x.discovered.toLocaleString()} found`:" · discovering…"}`:`${x.imported.toLocaleString()} imported · ${x.unchanged.toLocaleString()} already up to date${x.failed?` · ${x.failed} unavailable`:""}`,s(".import-start").textContent=r?"Importing…":"Import updates ↗",s(".imports-notes").hidden=!x.errors.length;const C=new Map;x.errors.forEach(w=>C.set(w,(C.get(w)||0)+1)),s(".imports-notes div").innerHTML=[...C].map(([w,$])=>`<p>${ag(w)}${$>1?` (${$} occurrences)`:""}</p>`).join(""),document.dispatchEvent(new CustomEvent("sessiongraph-import-status",{detail:x}))}async function y(){if(!(i||l)){o=0,l=!0;try{const x=await d("import");if(i)return;if(m(x),x.running)o=window.setTimeout(y,1e3);else{const C=g;g=void 0,await e(p),!i&&C===h&&n.open&&!x.failed&&!x.errors.length&&n.close()}}catch(x){b(x)}finally{l=!1}}}function b(x){if(i)return;g=void 0;const C=x instanceof Error?x.message:"Import unavailable.";m({running:!1,discovered:0,imported:0,unchanged:0,failed:1,errors:[C]}),s(".imports-progress").textContent=C}async function T(x,C=!1){if(!(i||C&&n.open)){if(r||c||l||o){!C&&!n.open&&M();return}c=!0,p=C,r=!0,s(".import-start").disabled=!0,g=f&&n.open&&x!==void 0?h:void 0;try{const w=await d("import",{method:"POST",headers:{"Content-Type":"application/json","X-SessionGraph-Action":"import"},body:JSON.stringify(C?{automatic:!0}:{sources:x})});if(i)return;m(w),window.clearTimeout(o),o=window.setTimeout(y,100)}catch(w){b(w)}finally{c=!1}}}async function M(x=!1){f=x,h++,a=document.activeElement,s("#imports-heading").textContent=x?"Explore & visualize all your LLM sessions":"Your session sources.",n.open||n.showModal(),t(),s(".import-sources").textContent="Finding local session sources…";try{const C=await d("sources");s(".import-sources").innerHTML=_a(C.sources).map($=>Ba($,{checked:$.selected||x&&$.available,disabled:r})).join("");const w=await d("import");w.running?(m(w),window.clearTimeout(o),o=window.setTimeout(y,1e3)):x||m(w)}catch(C){s(".import-sources").textContent=C instanceof Error?C.message:"Could not detect sources."}}return s(".import-start").addEventListener("click",()=>{T([...n.querySelectorAll("input:checked")].map(x=>x.value))}),s(".dialog-close").addEventListener("click",()=>n.close()),n.addEventListener("close",()=>{h++,g=void 0,t(),a?.focus()}),n.addEventListener("keydown",x=>x.stopPropagation()),{open:M,sources:async()=>(await d("sources")).sources,select:x=>T(x),get busy(){return r||c||l||!!o},refresh:(x=!1)=>T(void 0,x),resume:()=>{p=!0,r=!0,window.clearTimeout(o),y()},dispose:()=>{i=!0,u.abort(),window.clearTimeout(o),n.remove()}}}const cg=6e4,dg=3e4;class ug{constructor(t,n=Date.now){this.options=t,this.now=n}options;now;lastActivity=-1/0;checking=!1;disposed=!1;activity(){this.lastActivity=this.now()}async check(){if(!(this.disposed||this.checking||!this.options.eligible()||this.options.busy()||this.now()-this.lastActivity<dg)){this.checking=!0,this.activity();try{await this.options.refresh()}finally{this.checking=!1}}}dispose(){this.disposed=!0}}class fg{constructor(t,n){this.write=t,this.changed=n}write;changed;revision=0;state="saved";queued;task;disposed=!1;get pending(){return!!(this.queued||this.task)}set(t){this.state=t,this.disposed||this.changed(t)}save(t){this.disposed||(this.revision++,this.queued={...this.queued,...t},this.set("saving"),this.flush())}flush(){if(this.task)return this.task;if(this.disposed||!this.queued)return Promise.resolve();const t=this.queued;return this.queued=void 0,this.set("saving"),this.task=Promise.resolve().then(()=>this.write(t)).then(()=>{if(this.task=void 0,this.queued)return this.flush();this.set("saved")},()=>{this.queued={...t,...this.queued},this.task=void 0,this.set("error")}),this.task}dispose(){this.disposed=!0}}const hg=Object.freeze({sourceID:"",projectID:"",directory:"",days:0,fromDate:"",toDate:"",includeChildren:!0,includeArchived:!1}),pg=e=>typeof e=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(e)&&Number.isFinite(Date.parse(e))&&new Date(e).toISOString().slice(0,10)===e;function gg(e){const t={...hg};if(!e||typeof e!="object"||Array.isArray(e))return t;const n=e;for(const s of["sourceID","projectID","directory"])typeof n[s]=="string"&&n[s].length<=4096&&(t[s]=n[s]);[0,7,30,90].includes(n.days)&&(t.days=n.days);for(const s of["includeChildren","includeArchived"])typeof n[s]=="boolean"&&(t[s]=n[s]);for(const s of["fromDate","toDate"])pg(n[s])&&(t[s]=n[s]);return t.fromDate&&t.toDate&&t.fromDate>t.toDate&&(t.fromDate="",t.toDate=""),t}const cr=Object.freeze({autoImport:!0,muted:!1,clickSounds:!0,clickVolume:35,motion:"system",view:"3d",density:"comfortable",panelOpacity:90,quality:"balanced",bloom:32,stars:!0,labels:!0,nodeScale:100,focusDimming:!0,trails:"all",trailOpacity:34,trailFlow:!1,trailSpeed:25,relationships:!0,messageDots:!0,playbackSpeed:1}),jo="sessiongraph.preferences",ca={motion:["system","on","off"],view:["3d","2d"],density:["comfortable","compact"],quality:["performance","balanced","high"],trails:["all","selected","off"]},da={clickVolume:[0,100],panelOpacity:[55,100],bloom:[0,75],nodeScale:[60,180],trailOpacity:[0,100],trailSpeed:[10,100],playbackSpeed:[.25,3]};function dr(e){const t={...cr};if(!e||typeof e!="object"||Array.isArray(e))return t;const n=e;for(const s of Object.keys(t)){const r=n[s];if(s in ca)ca[s].includes(r)&&Object.assign(t,{[s]:r});else if(s in da){const[o,i]=da[s];typeof r=="number"&&Number.isFinite(r)&&Object.assign(t,{[s]:Math.max(o,Math.min(i,r))})}else typeof r=="boolean"&&Object.assign(t,{[s]:r})}return t}function Fl(e){try{const t=JSON.parse(e.getItem(jo)||e.getItem("session-atlas.preferences")||"null");return dr(t?.version===1?t.values:void 0)}catch{return{...cr}}}function Hl(e,t){try{return e.setItem(jo,JSON.stringify({version:1,values:dr(t)})),!0}catch{return!1}}const po=(e,t)=>e.motion==="on"||e.motion==="system"&&!t,Ke=[["interface","Interface",ad],["sources","Sources",Zc],["audio","Sound",Fa],["graphics","Graphics",Na],["trails","Trails & playback",od],["privacy","Privacy",sd]],ze=(e,t,n)=>`<label class="setting-row"><span><strong>${t}</strong><small>${n}</small></span><input type="checkbox" role="switch" data-pref="${e}" aria-label="${t}"/></label>`,Dt=(e,t,n,s,r,o="%",i=1)=>`<label class="setting-row setting-range"><span><strong>${t}</strong><small>${n}</small></span><span class="setting-slider"><input type="range" data-pref="${e}" aria-label="${t}" min="${s}" max="${r}" step="${i}"/><output data-output="${e}" data-unit="${o}"></output></span></label>`,Ln=(e,t,n,s)=>`<label class="setting-row"><span><strong>${t}</strong><small>${n}</small></span><select data-pref="${e}" aria-label="${t}">${s.map(([r,o])=>`<option value="${r}">${o}</option>`).join("")}</select></label>`;function mg(e){const t=document.createElement("dialog");t.className="settings-dialog",t.setAttribute("aria-labelledby","settings-title"),t.innerHTML=`<header class="settings-heading"><div><h2 id="settings-title">Settings</h2><p>Import, appearance, and playback preferences.</p></div><button class="icon-button settings-close" aria-label="Close settings">×</button></header>
30
+ <div class="settings-layout"><nav class="settings-tabs" role="tablist" aria-label="Settings categories">${Ke.map(([g,d,m],y)=>`<button role="tab" id="settings-tab-${g}" aria-controls="settings-${g}" aria-selected="${!y}" tabindex="${y?-1:0}" data-tab="${g}">${Va([m[0],{...m[1],"aria-hidden":"true","stroke-width":1.5},m[2]]).outerHTML}${d}</button>`).join("")}</nav>
31
+ <div class="settings-content">
32
+ <section id="settings-interface" role="tabpanel" aria-labelledby="settings-tab-interface"><h3>Interface</h3><p class="settings-description">View preferences and filters are saved with your library.</p>
33
+ ${Ln("view","Default view","Switch between depth and a flat timeline.",[["3d","3D galaxy"],["2d","2D timeline"]])}
34
+ ${Ln("motion","Motion","Camera transitions, reveals, and ambient movement.",[["system","Follow system"],["on","On"],["off","Off"]])}
35
+ ${Ln("density","Session list","Adjust spacing between sessions.",[["comfortable","Comfortable"],["compact","Compact"]])}
36
+ <label class="setting-row"><span><strong>Show archived sessions</strong><small>Include archived history in the map and session list.</small></span><input class="settings-archived" type="checkbox" role="switch" aria-label="Show archived sessions"/></label>
37
+ ${Dt("panelOpacity","Panel opacity","Adjust panel background transparency.",55,100)}
38
+ <div class="settings-note"><span>Restore the default panel layout.</span><button class="secondary-button settings-reset-panels">Reset panel positions</button></div>
39
+ </section>
40
+ <section id="settings-sources" role="tabpanel" aria-labelledby="settings-tab-sources" hidden><h3>Sources</h3><p class="settings-description">Choose the local apps to import. Importing is read-only.</p>
41
+ ${ze("autoImport","Auto-import sessions","Check selected sources on startup, on return, and every minute while visible.")}
42
+ <div class="settings-sources-list import-sources"></div>
43
+ <div class="settings-import-progress" role="status"></div>
44
+ <div class="settings-note"><span>Source changes apply when you import. Previously saved history is kept.</span><button class="secondary-button settings-import" disabled>Import selected sources</button></div>
45
+ </section>
46
+ <section id="settings-audio" role="tabpanel" aria-labelledby="settings-tab-audio" hidden><h3>Sound</h3><p class="settings-description">Interaction sounds are synthesized locally.</p>
47
+ ${ze("muted","Mute all sound","Silence everything. Your volume levels are kept.")}
48
+ ${ze("clickSounds","Interaction sounds","A soft tick for controls; a chime for sessions.")}
49
+ ${Dt("clickVolume","Interaction volume","Adjust interaction sound volume.",0,100)}
50
+ <div class="settings-note"><span class="settings-audio-status" role="status">Sound starts after your first interaction.</span><button class="secondary-button settings-preview" data-sound="none">Preview chime</button></div>
51
+ <p class="settings-footnote">Audio pauses while this tab is hidden. The speaker button on the map is a quick mute.</p>
52
+ </section>
53
+ <section id="settings-graphics" role="tabpanel" aria-labelledby="settings-tab-graphics" hidden><h3>Graphics</h3><p class="settings-description">Adjust rendering quality and map appearance.</p>
54
+ ${Ln("quality","Render quality","Performance uses 1× resolution and skips post-process effects.",[["performance","Performance"],["balanced","Balanced"],["high","High fidelity"]])}
55
+ ${Dt("bloom","Glow strength","Soft light around bright nodes; disabled in Performance.",0,75)}
56
+ ${Dt("nodeScale","Node size","Scale the lights without changing their positions.",60,180)}
57
+ ${ze("stars","Starfield","A faint field of stars behind the timeline.")}
58
+ ${ze("labels","Map labels","Directory names and the selected session title.")}
59
+ ${ze("focusDimming","Focus dimming","Dim surrounding nodes when a session is selected.")}
60
+ </section>
61
+ <section id="settings-trails" role="tabpanel" aria-labelledby="settings-tab-trails" hidden><h3>Trails &amp; playback</h3><p class="settings-description">Trails start at creation and end at the latest recorded message.</p>
62
+ ${Ln("trails","Session trails","Choose how much history to draw on the map.",[["all","All sessions"],["selected","Selected session"],["off","Hidden"]])}
63
+ ${Dt("trailOpacity","Trail brightness","Fade lifetime trails into the background.",0,100)}
64
+ ${ze("trailFlow","Flowing trails","A decorative pulse along each lifetime; respects Motion.")}
65
+ ${Dt("trailSpeed","Flow speed","How quickly the light travels along the trails.",10,100)}
66
+ ${ze("relationships","Relationship links","Show recorded fork and child connections.")}
67
+ ${ze("messageDots","Message dots","User and assistant messages, colored to match the selected session.")}
68
+ ${Dt("playbackSpeed","Playback speed","1× plays the full timeline in 30 seconds.",.25,3,"×",.25)}
69
+ <p class="settings-footnote">Flow is decorative. Message dots reflect saved timestamps; visual settings never alter your history.</p>
70
+ </section>
71
+ <section id="settings-privacy" role="tabpanel" aria-labelledby="settings-tab-privacy" hidden><h3>Privacy</h3><p class="settings-description">Local storage and network access.</p>
72
+ <div class="setting-row"><span><strong>Processed on this computer</strong><small>Importing, indexing, search, and visualization run locally. Imports read your selected sources without changing them or starting an AI agent.</small></span></div>
73
+ <div class="setting-row"><span><strong>Update checks use the internet</strong><small>Desktop update checks and downloads contact GitHub without session content. npm installation contacts its registry. These services receive ordinary connection metadata, including your public IP address.</small></span></div>
74
+ <div class="setting-row"><span><strong>Continuing a session is your choice</strong><small>Explicitly launching another harness lets it read the selected context. It may contact its model provider under its own privacy settings.</small></span></div>
75
+ <div class="setting-row"><span><strong>Local storage is not encrypted by SessionGraph</strong><small>Saved conversations, search text, and handoff files rely on your device's access controls. Disk encryption and backup or sync settings affect confidentiality. Deselecting a source keeps previously imported history.</small></span></div>
76
+ </section>
77
+ </div></div><footer class="settings-footer"><span class="settings-save-status" role="status">Changes save automatically on this device.</span><button class="text-button settings-reset">Restore defaults</button><button class="primary-button settings-done">Done</button></footer>`,document.body.append(t);const n=new AbortController,s={signal:n.signal},r=t.querySelector(".settings-archived");r.addEventListener("change",()=>e.changeArchived(r.checked),s);let o=null,i=0,a=!1,c=!1,l="interface";const p=()=>{t.querySelectorAll(".settings-source, .settings-import").forEach(g=>{g.disabled=a||c}),t.querySelector(".settings-source")||(t.querySelector(".settings-import").disabled=!0)};async function u(){const g=++i;a=!0,p();const d=t.querySelector(".settings-sources-list");d.textContent="Finding local session sources…";try{const m=await e.getSources();if(n.signal.aborted||g!==i)return;d.innerHTML=_a(m).map(y=>Ba(y,{settings:!0})).join("")}catch(m){if(n.signal.aborted||g!==i)return;d.textContent=m instanceof Error?m.message:"Could not detect sources.";const y=document.createElement("button");y.className="secondary-button",y.textContent="Retry",y.addEventListener("click",()=>{u()},s),d.append(y)}finally{g===i&&!n.signal.aborted&&(a=!1,p(),t.querySelector(".settings-import").disabled||=!d.querySelector("input"))}}t.querySelector(".settings-import").addEventListener("click",async()=>{const g=[...t.querySelectorAll(".settings-source:checked")].map(d=>d.value);c=!0,p(),t.querySelector(".settings-import-progress").textContent="Starting import…";try{await e.importSources(g)}catch(d){c=!1,p(),t.querySelector(".settings-import-progress").textContent=d instanceof Error?d.message:"Import unavailable."}},s);const f=()=>t.close();for(const g of[".settings-close",".settings-done"])t.querySelector(g).addEventListener("click",f,s);t.addEventListener("close",()=>{e.visibility(),o?.focus({preventScroll:!0})},s),t.addEventListener("keydown",g=>{g.stopPropagation()},s);function h(g){l=g;for(const[d]of Ke){const m=t.querySelector(`[data-tab="${d}"]`);m.setAttribute("aria-selected",String(d===g)),m.tabIndex=d===g?0:-1,t.querySelector(`#settings-${d}`).hidden=d!==g}t.querySelector(".settings-content").scrollTop=0,l==="sources"&&u()}for(const g of t.querySelectorAll("[data-tab]"))g.addEventListener("click",()=>h(g.dataset.tab),s),g.addEventListener("keydown",d=>{const m=Ke.findIndex(([b])=>b===g.dataset.tab),y=d.key==="Home"?0:d.key==="End"?Ke.length-1:["ArrowRight","ArrowDown"].includes(d.key)?(m+1)%Ke.length:["ArrowLeft","ArrowUp"].includes(d.key)?(m+Ke.length-1)%Ke.length:-1;y<0||(d.preventDefault(),h(Ke[y][0]),t.querySelector(`[data-tab="${Ke[y][0]}"]`).focus())},s);return t.addEventListener("input",g=>{const d=g.target,m=d.dataset.pref;if(!m)return;const y=d.type==="checkbox"?d.checked:d.type==="range"?Number(d.value):d.value;e.change({[m]:y})},s),t.querySelector(".settings-preview").addEventListener("click",e.previewSound,s),t.querySelector(".settings-reset").addEventListener("click",()=>{e.changeArchived(!1),e.change({...cr})},s),t.querySelector(".settings-reset-panels").addEventListener("click",e.resetPanels,s),{open(){t.open||(r.checked=e.getArchived(),o=document.activeElement,t.showModal(),e.visibility(),t.querySelector('[aria-selected="true"]').focus(),l==="sources"&&u())},importStatus(g){const d=c;c=g.running,p(),t.querySelector(".settings-import-progress").textContent=g.running?`Importing · ${g.imported.toLocaleString()} saved`:`${g.imported.toLocaleString()} imported · ${g.unchanged.toLocaleString()} unchanged${g.failed?` · ${g.failed} unavailable`:""}${g.errors.length?` · ${g.errors[0]}`:""}`,d&&!g.running&&t.open&&l==="sources"&&u()},render(g,d,m="saved"){r.checked=e.getArchived();for(const y of t.querySelectorAll("[data-pref]")){const b=y.dataset.pref;y.type==="checkbox"?y.checked=!!g[b]:y.value=String(g[b]);const T=t.querySelector(`[data-output="${b}"]`);T&&(T.value=`${g[b]}${T.dataset.unit}`),y.disabled=b==="bloom"&&g.quality==="performance"||b==="trailSpeed"&&(!g.trailFlow||g.trails==="off"||g.motion==="off")}t.querySelector(".settings-save-status").textContent=m==="saving"?"Saving preferences…":m==="error"?"Changes applied; could not save to the local library.":d?"Saved on this device · changes apply live.":"Applied for this visit; storage is unavailable.",t.querySelector(".settings-preview").disabled=g.muted||!g.clickSounds||!g.clickVolume,Yn(t)},audioStatus(g){t.querySelector(".settings-audio-status").textContent=g},dispose(){n.abort(),t.remove()}}}class vg{constructor(t,n){this.preferences=t,this.status=n;const s={signal:this.events.signal};document.addEventListener("click",r=>{if(!r.isTrusted)return;const o=r.target?.closest('button, a[href], summary, input[type="checkbox"], [role="option"]');!o||o.matches(":disabled")||o.closest('[data-sound="none"], [data-drag-panel]')||this.play(o.matches('[data-session], [data-related], [role="option"]')?"select":"click")},s),document.addEventListener("change",r=>{r.isTrusted&&r.target?.matches('select, input[type="range"]')&&this.play("click")},s),document.addEventListener("pointerdown",r=>{r.isTrusted&&(this.interacted=!0,this.unlock())},{...s,passive:!0}),document.addEventListener("keydown",r=>{r.isTrusted&&!r.repeat&&["Enter"," ","ArrowUp","ArrowDown"].includes(r.key)&&(this.interacted=!0,this.unlock())},s),document.addEventListener("visibilitychange",()=>this.sync(),s),window.addEventListener("pagehide",()=>{this.active=!1,this.sync()},s),window.addEventListener("pageshow",()=>{this.active=!0,this.sync()},s)}preferences;status;context;master;analyser;voices=new Set;events=new AbortController;disposed=!1;unavailable=!1;clicks=0;lastClick=0;suspendTimer;active=!0;interacted=!1;enabled(){return!this.preferences.muted&&this.preferences.clickSounds&&this.preferences.clickVolume>0}async unlock(){if(!(this.disposed||document.hidden||!this.active||!this.enabled()))try{if(!this.context){this.context=new AudioContext,this.master=this.context.createGain(),this.master.gain.value=0;const t=this.context.createDynamicsCompressor();t.threshold.value=-12,t.ratio.value=6,this.analyser=this.context.createAnalyser(),this.analyser.fftSize=256,this.master.connect(t).connect(this.analyser).connect(this.context.destination),this.context.addEventListener("statechange",()=>this.report(),{signal:this.events.signal})}this.context.state==="suspended"&&await this.context.resume(),this.disposed||this.sync()}catch{this.unavailable=!0,this.report()}}ramp(t,n,s=.15){const r=this.context.currentTime;t.cancelScheduledValues(r),t.setTargetAtTime(n,r,s)}cleanup(t){t.nodes.forEach(n=>n.disconnect()),this.voices.delete(t)}sync(){clearTimeout(this.suspendTimer);const t=this.context;if(!t||this.disposed){this.report();return}const n=this.enabled()&&!document.hidden&&this.active;if(n&&t.state==="suspended"&&t.resume().catch(()=>{this.unavailable=!0,this.report()}),this.ramp(this.master.gain,n?.7:0,.035),!n){const s=()=>{for(const r of this.voices)r.sources.forEach(o=>{try{o.stop()}catch{}}),this.cleanup(r);t.suspend().catch(()=>{})};document.hidden||!this.active?s():this.suspendTimer=setTimeout(s,180)}this.report()}report(){this.status(this.unavailable?"Audio is unavailable in this browser.":this.preferences.muted?"All sound is muted.":document.hidden||!this.active?"Audio paused while the app is hidden.":this.context?.state==="running"?"Audio is ready · pauses automatically in the background.":"Click a control or preview to start audio.")}configure(t){this.preferences=t,this.sync(),!this.context&&this.interacted&&this.unlock()}async play(t="click"){await this.unlock();const n=this.context;if(this.disposed||!n||n.state!=="running"||document.hidden||!this.active||this.preferences.muted||!this.preferences.clickSounds||!this.preferences.clickVolume||performance.now()-this.lastClick<45)return;this.lastClick=performance.now(),this.clicks++;const s=n.createGain(),r=n.createOscillator(),o=n.currentTime;r.type="sine",r.frequency.setValueAtTime(t==="select"?660:900,o),r.frequency.exponentialRampToValueAtTime(t==="select"?990:420,o+.065),s.gain.setValueAtTime(0,o),s.gain.linearRampToValueAtTime(this.preferences.clickVolume/100*.12,o+.004),s.gain.exponentialRampToValueAtTime(1e-4,o+(t==="select"?.19:.065)),r.connect(s).connect(this.master);const i={gain:s,sources:[r],nodes:[r,s]};this.voices.add(i),r.onended=()=>this.cleanup(i),r.start(),r.stop(o+.22)}diagnostics(){const t=new Float32Array(256);return this.analyser?.getFloatTimeDomainData(t),{state:this.context?.state||"unstarted",muted:this.preferences.muted,voices:this.voices.size,clicks:this.clicks,rms:Math.sqrt(t.reduce((n,s)=>n+s*s,0)/t.length)}}dispose(){this.disposed=!0,this.events.abort(),clearTimeout(this.suspendTimer);for(const t of this.voices)t.sources.forEach(n=>{try{n.stop()}catch{}}),this.cleanup(t);this.context?.close().catch(()=>{})}}const kv=e=>e.kind==="message"&&(e.role==="user"||e.role==="assistant"),_l=e=>e.kind==="message"?e.role==="user"?"#b0e9d6":"#9bbcff":e.kind.startsWith("tool_")?"#eac594":"#d7a1f1",Bl=e=>e.kind==="message"?e.role==="user"?"You":e.role==="assistant"?"Assistant":"Message":{tool_call:"Tool call",tool_result:"Tool result",reasoning:"Reasoning",compaction:"Compaction",file_change:"File change",error:"Error",event:"Event"}[e.kind],bt=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]),yg=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"medium"}),ua=e=>e===null?"Time not recorded":yg.format(e),fa=e=>`<span class="event-badge" style="--event-color:${_l(e)}">${Bl(e)}</span>`;function bg(e,t,n){const s=document.createElement("aside");s.className="event-panel glass",s.id="message-panel",s.hidden=!0,s.setAttribute("aria-labelledby","event-title"),s.innerHTML=`<header class="event-heading"><h2 id="event-title">Messages</h2><button class="icon-button event-close" aria-label="Close message details">×</button></header>
78
+ <div class="event-detail-nav"><button class="secondary-button" data-step="previous" aria-label="Previous message" title="Previous message (← / ↑)">← Previous</button><span class="event-position" role="status"></span><button class="secondary-button" data-step="next" aria-label="Next message" title="Next message (→ / ↓)">Next →</button></div>
79
+ <div class="event-scroll"><article class="event-content" aria-label="Message details" tabindex="0"></article>
80
+ <details class="event-browser"><summary>Browse messages <span class="event-count"></span></summary>
81
+ <nav class="event-list" aria-label="Session messages"></nav><div class="event-pagination"><button class="secondary-button" data-page="previous">← Earlier page</button><button class="secondary-button" data-page="next">Later page →</button></div>
82
+ </details>
83
+ </div><footer class="event-footer"><details><summary>History coverage</summary><p class="event-coverage"></p></details><button class="text-button event-reload">Reload</button></footer>`,e.append(s);const r=w=>s.querySelector(w),o=new AbortController;let i,a,c,l;const p="messages";let u=!1,f,h,g={};const d=(w,$)=>`<button class="event-row" data-event="${bt(w.id)}" aria-current="${c?.selected?.id===w.id?"true":"false"}"><span class="event-row-top">${fa(w)}<small>#${c.offset+$+1}</small></span><span class="event-preview">${bt(w.preview||"No text recorded")}</span><time>${ua(w.time)}</time></button>`;function m(){!c||!r(".event-browser").open||(r(".event-list").innerHTML=c.items.map(d).join("")||'<p class="event-empty">No saved messages.</p>')}function y(){if(!c)return;r(".event-count").textContent=`${c.total.toLocaleString()} messages${c.partial?" · partial coverage":""}`,m();for(const $ of["previous","next"])r(`[data-page="${$}"]`).disabled=!c[`${$}Cursor`];r(".event-coverage").textContent=c.note||(c.partial?"Saved history is incomplete or still awaiting import.":"Saved local history. Missing timestamps are never inferred.");const w=c.selected;r(".event-position").textContent=w?`${c.offset+c.items.findIndex($=>$.id===w.id)+1} / ${c.total}`:"No messages";for(const $ of["previous","next"])r(`[data-step="${$}"]`).disabled=!c[`${$}Item`];if(!w){r(".event-content").innerHTML='<div class="event-empty"><h3>No messages yet.</h3><p>Refresh the source to import saved user and assistant messages.</p></div>',n.select(null);return}n.select(w),r(".event-content").innerHTML=`<div class="event-detail-heading">${fa(w)}<h3>${bt(w.name)}</h3><p>${ua(w.time)}</p>${w.time===null?"<p>No timestamp · this message has no map position.</p>":w.time<a.created||w.time>Math.max(a.created,a.activity?.lastMessageAt||a.created)?"<p>Outside this session’s plotted lifetime.</p>":""}</div>
84
+ ${w.partial?'<p class="event-warning">Some content is shortened, missing, or unsupported in this import.</p>':""}
85
+ ${w.text?`<section class="event-payload"><pre>${bt(w.text)}</pre></section>`:'<p class="event-empty">No message text was recorded.</p>'}
86
+ <details class="event-provenance"><summary>Source details</summary><dl><dt>Source</dt><dd>${bt(We(a?.source))}</dd><dt>Message ID</dt><dd>${bt(w.messageID)}</dd><dt>Timestamp source</dt><dd>${bt(w.timeSource)}</dd></dl></details>`}async function b(w={}){if(!a)return;clearTimeout(h),i?.abort();const $=new AbortController;i=$,g=w,u=!0,s.setAttribute("aria-busy","true"),r(".event-position").textContent="Loading…";for(const D of s.querySelectorAll("[data-step], [data-page]"))D.disabled=!0;const R=r(".event-list").scrollTop,L=c?.offset,E=document.activeElement,O=E instanceof HTMLElement?E.dataset:void 0;try{const D=await t.read(a.id,{filter:p,...w,...l?{revision:l}:{}},$.signal);if($.signal.aborted)return;c=D,l=c.revision,y(),r(".event-list").scrollTop=c.offset===L?R:0,r(".event-scroll").scrollTop=0;const V=O?.event?`[data-event="${O.event}"]`:"";V&&(document.activeElement===E||!E?.isConnected&&document.activeElement===document.body)&&s.querySelector(V)?.focus({preventScroll:!0}),clearTimeout(h),h=setTimeout(()=>{f?.abort(),f=new AbortController;for(const H of[c?.previousItem,c?.nextItem])H&&t.read(a.id,{item:H,filter:p,revision:l},f.signal).catch(()=>{})},60)}catch(D){if($.signal.aborted)return;c=void 0,r(".event-position").textContent="Unavailable",r(".event-content").innerHTML=`<div class="event-empty"><h3>Could not load this history.</h3><p>${bt(D instanceof Error?D.message:"Please retry.")}</p><button class="secondary-button" data-retry>Retry</button> <button class="secondary-button" data-reload>Reload current history</button></div>`}finally{i===$&&(u=!1,s.removeAttribute("aria-busy"))}}const T=()=>{t.clear(),l=void 0,c=void 0,b()},M=()=>!s.hidden&&!e.hidden,x=()=>{clearTimeout(h),f?.abort(),i?.abort(),i=void 0,u=!1,c=void 0,s.hidden=!0,s.removeAttribute("aria-busy"),e.classList.remove("has-events"),n.select(null)},C=w=>{if(u)return;const $=w==="next"?c?.nextItem:c?.previousItem;$&&b({item:$})};return s.addEventListener("click",w=>{const $=w.target.closest("button");if($){if($.dataset.event&&b({item:$.dataset.event}),$.dataset.step&&C($.dataset.step==="next"?"next":"previous"),$.dataset.page){const R=$.dataset.page==="next"?c?.nextCursor:c?.previousCursor;R&&b({cursor:R})}$.hasAttribute("data-retry")&&b(g),($.hasAttribute("data-reload")||$.classList.contains("event-reload"))&&T(),$.classList.contains("event-close")&&(x(),document.querySelector("#scene canvas")?.focus({preventScroll:!0}))}},{signal:o.signal}),r(".event-browser").addEventListener("toggle",m,{signal:o.signal}),{close:x,handleKey(w){return!M()||w.defaultPrevented||w.metaKey||w.ctrlKey||w.altKey||w.shiftKey||document.querySelector("dialog[open]")||w.target.closest('input, select, textarea, [contenteditable="true"], [data-drag-panel], #explorer')?!1:w.key==="Escape"?(w.preventDefault(),x(),document.querySelector("#scene canvas")?.focus({preventScroll:!0}),!0):["ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(w.key)?(w.preventDefault(),C(w.key==="ArrowLeft"||w.key==="ArrowUp"?"previous":"next"),!0):!1},open(w,$,R){clearTimeout(h),f?.abort();const L=a?.id===w.id;a=w,l=R,c=void 0,r(".event-list").replaceChildren(),r(".event-content").innerHTML='<p class="event-empty">Loading saved history…</p>',r(".event-coverage").textContent="Loading coverage…",L||(r(".event-browser").open=!1),s.hidden=!1,e.classList.add("has-events"),b($?{item:$}:{})},dispose(){clearTimeout(h),f?.abort(),i?.abort(),o.abort(),s.remove()}}}function wg(e,t,n){const s=new Map;let r,o,i,a,c=0,l=0,p=1;const u=document.createElement("strong"),f=document.createElement("pre"),h=document.createElement("span"),g=()=>{clearTimeout(i),o?.abort(),o=void 0,r=void 0,a=void 0,e.hidden=!0,e.classList.remove("message-tooltip")};function d(y,b){if(!a)return;const T=`${Bl(a)} · ${a.name}`,M=y||"No text recorded.",x=[b,p>1?`${p} nearby items`:"","Click to focus and read · ← / → to navigate"].filter(Boolean).join(" · ");u.textContent!==T&&(u.textContent=T),f.textContent!==M&&(f.textContent=M),h.textContent!==x&&(h.textContent=x),u.parentElement!==e&&e.replaceChildren(u,f,h),e.classList.add("message-tooltip"),e.hidden=!1,e.style.setProperty("--event-color",_l(a));const C=e.offsetWidth,w=e.offsetHeight,$=t.getBoundingClientRect(),R=[...document.querySelectorAll(".floating-panel:not([hidden]), .app-header, .map-controls")].map(O=>O.getBoundingClientRect()),E=[l+18,l-w-18].flatMap(O=>[c+18,c-C-18].map(D=>{D=Math.max(8,Math.min(D,t.clientWidth-C-8)),O=Math.max(8,Math.min(O,t.clientHeight-w-8));const V=$.left+D,H=$.top+O,Z=R.reduce((se,W)=>se+Math.max(0,Math.min(V+C,W.right+8)-Math.max(V,W.left-8))*Math.max(0,Math.min(H+w,W.bottom+8)-Math.max(H,W.top-8)),0);return{left:D,top:O,overlap:Z}})).reduce((O,D)=>D.overlap<O.overlap?D:O);e.style.left=`${E.left}px`,e.style.top=`${E.top}px`}function m(y){const b=[y.text,y.input?`Input
87
+ ${y.input}`:"",y.output?`Output
88
+ ${y.output}`:""].filter(Boolean).join(`
89
+
90
+ `);return{text:b.slice(0,1800),shortened:b.length>1800||!!y.partial}}return{clear:g,show(y,b,T,M,x,C){const w=`${b}:${T}:${y.id}`,$=r!==w;$&&g(),r=w,a=y,c=x,l=C,p=M;const R=s.get(w);d(R?.text||y.preview,R?R.shortened?"Content preview":"":"Loading message…"),!(!$||R)&&(i=setTimeout(async()=>{const L=new AbortController;o=L;try{const E=await n.read(b,{item:y.id,revision:T,filter:"messages"},L.signal);if(L.signal.aborted||r!==w||E.selected?.id!==y.id)return;const O=m(E.selected);s.set(w,O),s.size>20&&s.delete(s.keys().next().value),d(O.text,O.shortened?"Content preview":"")}catch{!L.signal.aborted&&r===w&&d(y.preview,"Saved excerpt · open for details")}},120))},dispose(){g(),s.clear()}}}class Eg{constructor(t=(...n)=>fetch(...n)){this.request=t}request;pages=new Map;pending=new Map;characters=0;generation=0;clear(){this.generation++,this.pages.clear(),this.characters=0;for(const t of this.pending.values())t.controller.abort();this.pending.clear()}read(t,n={},s){if(s?.aborted)return Promise.reject(s.reason);const r=n.filter||"all",o=JSON.stringify([t,n.revision,r,n.item,n.cursor]),i=n.revision?this.pages.get(o):void 0;if(i)return this.pages.delete(o),this.pages.set(o,i),Promise.resolve(i.page);let a=this.pending.get(o);if(!a){const l=new AbortController,p=this.generation,u=new URLSearchParams({filter:r,...n}),f=this.request(`/api/sessiongraph/session/${encodeURIComponent(t)}/events?${u}`,{signal:AbortSignal.any([l.signal,AbortSignal.timeout(3e4)])}).then(async d=>{const m=await d.json();if(!d.ok)throw d.status===409&&this.clear(),new Error(m.error||"Could not load events.");if(l.signal.aborted||p!==this.generation)throw new DOMException("Request cancelled","AbortError");if(m.sessionID!==t||n.revision&&m.revision!==n.revision)throw new Error("Saved history changed. Reload the event explorer.");const y=JSON.stringify([t,m.revision,r,n.item,n.cursor]),b=JSON.stringify(m).length;for(this.characters-=this.pages.get(y)?.characters||0,this.pages.delete(y),this.pages.set(y,{page:m,characters:b}),this.characters+=b;this.pages.size>20||this.characters>2e6;){const T=this.pages.keys().next().value;this.characters-=this.pages.get(T).characters,this.pages.delete(T)}return m});a={controller:l,promise:f,readers:0},this.pending.set(o,a);const h=a,g=()=>{this.pending.get(o)===h&&this.pending.delete(o)};f.then(g,g)}const c=a;return c.readers++,new Promise((l,p)=>{const u=()=>{h(),p(s.reason)};let f=!1;const h=()=>{f||(f=!0,s?.removeEventListener("abort",u),--c.readers===0&&this.pending.get(o)===c&&(this.pending.delete(o),c.controller.abort()))};s?.addEventListener("abort",u,{once:!0}),c.promise.then(g=>{f||(h(),l(g))},g=>{f||(h(),p(g))})})}}function ie(e,t,n,s){if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?s:n==="a"?s.call(e):s?s.value:t.get(e)}function Jt(e,t,n,s,r){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var gs,Kt,xe,zt,ms,Dr,vs;const ha="__TAURI_TO_IPC_KEY__";function xg(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class Av{constructor(t){gs.add(this),Kt.set(this,void 0),xe.set(this,0),zt.set(this,[]),ms.set(this,void 0),Jt(this,Kt,t||(()=>{})),this.id=xg(n=>{const s=n.index;if("end"in n){s==ie(this,xe,"f")?this.cleanupCallback():Jt(this,ms,s);return}const r=n.message;if(s==ie(this,xe,"f")){for(ie(this,gs,"m",Dr).call(this,r),Jt(this,xe,ie(this,xe,"f")+1);ie(this,xe,"f")in ie(this,zt,"f");){const o=ie(this,zt,"f")[ie(this,xe,"f")];ie(this,gs,"m",Dr).call(this,o),delete ie(this,zt,"f")[ie(this,xe,"f")],Jt(this,xe,ie(this,xe,"f")+1)}ie(this,xe,"f")===ie(this,ms,"f")&&this.cleanupCallback()}else ie(this,zt,"f")[s]=r})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(t){Jt(this,Kt,t)}get onmessage(){return ie(this,Kt,"f")}[(Kt=new WeakMap,xe=new WeakMap,zt=new WeakMap,ms=new WeakMap,gs=new WeakSet,Dr=function(n){try{ie(this,Kt,"f").call(this,n)}catch(s){queueMicrotask(()=>{throw s})}},ha)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[ha]()}}async function jl(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}class Ov{get rid(){return ie(this,vs,"f")}constructor(t){vs.set(this,void 0),Jt(this,vs,t)}async close(){return jl("plugin:resources|close",{rid:this.rid})}async[(vs=new WeakMap,Symbol.asyncDispose)](){await this.close()}}function Sg(){return!!(globalThis||window).isTauri}async function $g(){await jl("plugin:process|restart")}class Ig{constructor(t,n,s=Date.now){this.backend=t,this.changed=n,this.now=s}backend;changed;now;state={phase:"hidden"};release;busy=!1;disposed=!1;downloaded=!1;installed=!1;lastCheck=-1/0;set(t){this.disposed||(this.state=t,this.changed(t))}async close(){const t=this.release;this.release=void 0,await t?.close().catch(()=>{})}async check(){if(!(this.disposed||this.busy||this.release||this.now()-this.lastCheck<5*6e4)){this.busy=!0,this.lastCheck=this.now();try{this.release=await this.backend.check()||void 0,this.release&&this.set({phase:"available",version:this.release.version})}catch{}finally{this.busy=!1,this.disposed&&await this.close()}}}async activate(){if(this.disposed||this.busy||!this.release)return;this.busy=!0;const{version:t}=this.release;let n=this.installed?"restart":this.downloaded?"install":"download";try{if(!this.downloaded){let s,r=0;this.set({phase:"downloading",version:t}),await this.release.download(o=>{o.event==="Started"&&(s=o.data.contentLength,r=0),o.event==="Progress"&&(r+=o.data.chunkLength),this.set({phase:"downloading",version:t,progress:s&&s>0?Math.min(99,Math.floor(r/s*100)):void 0})}),this.downloaded=!0,this.set({phase:"ready",version:t});return}if(this.installed||(this.set({phase:"installing",version:t}),await this.release.install(),this.installed=!0),this.disposed)return;n="restart",this.set({phase:"restarting",version:t}),await this.backend.restart()}catch(s){this.set({phase:"error",version:t,retry:n,error:String(s instanceof Error?s.message:s).slice(0,300)})}finally{this.busy=!1,this.disposed&&await this.close()}}dispose(){this.disposed=!0,this.busy||this.close()}}const Tg='<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><path d="M8 2v9m-3-3 3 3 3-3M3 13h10"/></svg>',Cg='<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" aria-hidden="true"><path d="M13 7a5 5 0 1 0-.8 4M13 2v5H8"/></svg>';function kg(e){const t=document.createElement("button");t.className="desktop-update glass",t.hidden=!0,t.type="button";const n=document.createElement("span");n.className="sr-only",n.role="status",n.setAttribute("aria-live","polite"),document.querySelector("#app").append(t,n);let s="";const r=l=>{const p=["downloading","installing","restarting"].includes(l.phase),u=l.phase==="ready"||l.phase==="error"&&l.retry!=="download",f=l.phase==="downloading"?l.progress===void 0?"Downloading":`${l.progress}%`:l.phase==="installing"?"Installing":l.phase==="restarting"?"Restarting":u?"Restart":l.phase==="error"?"Retry update":"Update",h=l.phase==="error"?`${l.retry==="restart"?"Could not restart SessionGraph.":`Could not ${l.retry==="download"?"download or verify":"install"} the update.`} ${l.error||""} Click to try again.`:l.phase==="restarting"?`Restarting SessionGraph ${l.version}`:u?`Restart to install SessionGraph ${l.version}`:`Update to SessionGraph ${l.version}`;t.hidden=l.phase==="hidden",t.disabled=p,t.dataset.phase=l.phase,t.setAttribute("aria-busy",String(p)),t.setAttribute("aria-label",h),t.title=h;const g=`${u||l.phase==="restarting"?Cg:Tg}<span>${f}</span>`;t.innerHTML!==g&&(t.innerHTML=g);const d=l.phase==="hidden"?"":l.phase==="downloading"?`Downloading SessionGraph ${l.version}`:h;d!==s&&(n.textContent=d,s=d)},o=new Ig(e,r);t.addEventListener("click",()=>{o.activate()});const i=()=>{document.visibilityState==="visible"&&navigator.onLine&&o.check()},a=window.setTimeout(i,1e4),c=window.setInterval(i,240*6e4);return document.addEventListener("visibilitychange",i),window.addEventListener("online",i),{check:()=>o.check(),dispose(){clearTimeout(a),clearInterval(c),o.dispose(),t.remove(),n.remove(),document.removeEventListener("visibilitychange",i),window.removeEventListener("online",i)}}}function Ag(){return Sg()?kg({async check(){const{check:e}=await Ra(async()=>{const{check:n}=await import("./index-Bn0u7W0k.js");return{check:n}},[]),t=await e({timeout:15e3});return t&&{version:t.version,download:n=>t.download(n,{timeout:10*6e4}),install:()=>t.install({restartAfterInstall:!0}),close:()=>t.close()}},async restart(){await $g()}}):{dispose(){}}}var Og=Qt("date-picker").parts("clearTrigger","content","control","input","label","monthSelect","nextTrigger","positioner","presetTrigger","prevTrigger","rangeText","root","table","tableBody","tableCell","tableCellTrigger","tableHead","tableHeader","tableRow","trigger","view","viewControl","viewTrigger","yearSelect"),J=Og.build();function Rr(e,t){return e-t*Math.floor(e/t)}const Wl=1721426;function ys(e,t,n,s){t=Wo(e,t);let r=t-1,o=-2;return n<=2?o=0:Ms(t)&&(o=-1),Wl-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*n-362)/12+o+s)}function Ms(e){return e%4===0&&(e%100!==0||e%400===0)}function Wo(e,t){return e==="BC"?1-t:t}function Lg(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}const Mg={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]};class dn{fromJulianDay(t){let n=t,s=n-Wl,r=Math.floor(s/146097),o=Rr(s,146097),i=Math.floor(o/36524),a=Rr(o,36524),c=Math.floor(a/1461),l=Rr(a,1461),p=Math.floor(l/365),u=r*400+i*100+c*4+p+(i!==4&&p!==4?1:0),[f,h]=Lg(u),g=n-ys(f,h,1,1),d=2;n<ys(f,h,3,1)?d=0:Ms(h)&&(d=1);let m=Math.floor(((g+d)*12+373)/367),y=n-ys(f,h,m,1)+1;return new Re(f,h,m,y)}toJulianDay(t){return ys(t.era,t.year,t.month,t.day)}getDaysInMonth(t){return Mg[Ms(t.year)?"leapyear":"standard"][t.month-1]}getMonthsInYear(t){return 12}getDaysInYear(t){return Ms(t.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(t){return 9999}getEras(){return["BC","AD"]}isInverseEra(t){return t.era==="BC"}balanceDate(t){t.year<=0&&(t.era=t.era==="BC"?"AD":"BC",t.year=1-t.year)}constructor(){this.identifier="gregory"}}const Dg={"001":1,AD:1,AE:6,AF:6,AI:1,AL:1,AM:1,AN:1,AR:1,AT:1,AU:1,AX:1,AZ:1,BA:1,BE:1,BG:1,BH:6,BM:1,BN:1,BY:1,CH:1,CL:1,CM:1,CN:1,CR:1,CY:1,CZ:1,DE:1,DJ:6,DK:1,DZ:6,EC:1,EE:1,EG:6,ES:1,FI:1,FJ:1,FO:1,FR:1,GB:1,GE:1,GF:1,GP:1,GR:1,HR:1,HU:1,IE:1,IQ:6,IR:6,IS:1,IT:1,JO:6,KG:1,KW:6,KZ:1,LB:1,LI:1,LK:1,LT:1,LU:1,LV:1,LY:6,MC:1,MD:1,ME:1,MK:1,MN:1,MQ:1,MV:5,MY:1,NL:1,NO:1,NZ:1,OM:6,PL:1,QA:6,RE:1,RO:1,RS:1,RU:1,SD:6,SE:1,SI:1,SK:1,SM:1,SY:6,TJ:1,TM:1,TR:1,UA:1,UY:1,UZ:1,VA:1,VN:1,XK:1};function be(e,t){return t=le(t,e.calendar),e.era===t.era&&e.year===t.year&&e.month===t.month&&e.day===t.day}function Rg(e,t){return t=le(t,e.calendar),e=Qe(e),t=Qe(t),e.era===t.era&&e.year===t.year&&e.month===t.month}function Pg(e,t){return t=le(t,e.calendar),e=Kn(e),t=Kn(t),e.era===t.era&&e.year===t.year}function Vg(e,t){return ur(e.calendar,t.calendar)&&be(e,t)}function Mn(e,t){return ur(e.calendar,t.calendar)&&Rg(e,t)}function Dn(e,t){return ur(e.calendar,t.calendar)&&Pg(e,t)}function ur(e,t){return e.isEqual?.(t)??t.isEqual?.(e)??e.identifier===t.identifier}function Ng(e,t){return be(e,fr(t))}const Fg={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6};function Ul(e,t,n){let s=e.calendar.toJulianDay(e),r=n?Fg[n]:jg(t),o=Math.ceil(s+1-r)%7;return o<0&&(o+=7),o}function ql(e){return et(Date.now(),e)}function fr(e){return Vt(ql(e))}function Gl(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function Hg(e,t){return pa(e)-pa(t)}function pa(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Pr=null,_g=!1;function Uo(){return Pr==null&&(Pr=new Intl.DateTimeFormat().resolvedOptions().timeZone),Pr}function Yl(){return _g}function Qe(e){return e.subtract({days:e.day-1})}function go(e){return e.add({days:e.calendar.getDaysInMonth(e)-e.day})}function Kn(e){return Qe(e.subtract({months:e.month-1}))}function Bg(e){return go(e.add({months:e.calendar.getMonthsInYear(e)-e.month}))}function St(e,t,n){let s=Ul(e,t,n);return e.subtract({days:s})}function ga(e,t,n){return St(e,t,n).add({days:6})}const ma=new Map,Vr=new Map;function Kl(e){if(Intl.Locale){let n=ma.get(e);return n||(n=new Intl.Locale(e).maximize().region,n&&ma.set(e,n)),n}let t=e.split("-")[1];return t==="u"?void 0:t}function jg(e){let t=Vr.get(e);if(!t){if(Intl.Locale){let s=new Intl.Locale(e);if("getWeekInfo"in s&&(t=s.getWeekInfo(),t))return Vr.set(e,t),t.firstDay}let n=Kl(e);if(e.includes("-fw-")){let s=e.split("-fw-")[1].split("-")[0];s==="mon"?t={firstDay:1}:s==="tue"?t={firstDay:2}:s==="wed"?t={firstDay:3}:s==="thu"?t={firstDay:4}:s==="fri"?t={firstDay:5}:s==="sat"?t={firstDay:6}:t={firstDay:0}}else e.includes("-ca-iso8601")?t={firstDay:1}:t={firstDay:n&&Dg[n]||0};Vr.set(e,t)}return t.firstDay}function Wg(e,t,n){let s=e.calendar.getDaysInMonth(e);return Math.ceil((Ul(Qe(e),t,n)+s)/7)}function zl(e,t){return e&&t?e.compare(t)<=0?e:t:e||t}function Zl(e,t){return e&&t?e.compare(t)>=0?e:t:e||t}const Ug={AF:[4,5],AE:[5,6],BH:[5,6],DZ:[5,6],EG:[5,6],IL:[5,6],IQ:[5,6],IR:[5,5],JO:[5,6],KW:[5,6],LY:[5,6],OM:[5,6],QA:[5,6],SA:[5,6],SD:[5,6],SY:[5,6],YE:[5,6]};function qg(e,t){let n=e.calendar.toJulianDay(e),s=Math.ceil(n+1)%7;s<0&&(s+=7);let r=Kl(t),[o,i]=Ug[r]||[6,0];return s===o||s===i}function un(e){e=le(e,new dn);let t=Wo(e.era,e.year);return Jl(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function Jl(e,t,n,s,r,o,i){let a=new Date;return a.setUTCHours(s,r,o,i),a.setUTCFullYear(e,t-1,n),a.getTime()}function mo(e,t){if(t==="UTC")return 0;if(e>0&&t===Uo()&&!Yl())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:s,day:r,hour:o,minute:i,second:a}=Xl(e,t);return Jl(n,s,r,o,i,a,0)-Math.floor(e/1e3)*1e3}const va=new Map;function Xl(e,t){let n=va.get(t);n||(n=new Intl.DateTimeFormat("en-US",{timeZone:t,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),va.set(t,n));let s=n.formatToParts(new Date(e)),r={};for(let o of s)o.type!=="literal"&&(r[o.type]=o.value);return{year:r.era==="BC"||r.era==="B"?-r.year+1:+r.year,month:+r.month,day:+r.day,hour:r.hour==="24"?0:+r.hour,minute:+r.minute,second:+r.second}}const ya=864e5;function Gg(e,t,n,s){return(n===s?[n]:[n,s]).filter(o=>Yg(e,t,o))}function Yg(e,t,n){let s=Xl(n,t);return e.year===s.year&&e.month===s.month&&e.day===s.day&&e.hour===s.hour&&e.minute===s.minute&&e.second===s.second}function Xe(e,t,n="compatible"){let s=ke(e);if(t==="UTC")return un(s);if(t===Uo()&&n==="compatible"&&!Yl()){s=le(s,new dn);let c=new Date,l=Wo(s.era,s.year);return c.setFullYear(l,s.month-1,s.day),c.setHours(s.hour,s.minute,s.second,s.millisecond),c.getTime()}let r=un(s),o=mo(r-ya,t),i=mo(r+ya,t),a=Gg(s,t,r-o,r-i);if(a.length===1)return a[0];if(a.length>1)switch(n){case"compatible":case"earlier":return a[0];case"later":return a[a.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(n){case"earlier":return Math.min(r-o,r-i);case"compatible":case"later":return Math.max(r-o,r-i);case"reject":throw new RangeError("No such absolute time found")}}function Ql(e,t,n="compatible"){return new Date(Xe(e,t,n))}function et(e,t){let n=mo(e,t),s=new Date(e+n),r=s.getUTCFullYear(),o=s.getUTCMonth()+1,i=s.getUTCDate(),a=s.getUTCHours(),c=s.getUTCMinutes(),l=s.getUTCSeconds(),p=s.getUTCMilliseconds();return new zn(r<1?"BC":"AD",r<1?-r+1:r,o,i,t,n,a,c,l,p)}function Vt(e){return new Re(e.calendar,e.era,e.year,e.month,e.day)}function ke(e,t){let n=0,s=0,r=0,o=0;if("timeZone"in e)({hour:n,minute:s,second:r,millisecond:o}=e);else if("hour"in e&&!t)return e;return t&&({hour:n,minute:s,second:r,millisecond:o}=t),new zs(e.calendar,e.era,e.year,e.month,e.day,n,s,r,o)}function le(e,t){if(ur(e.calendar,t))return e;let n=t.fromJulianDay(e.calendar.toJulianDay(e)),s=e.copy();return s.calendar=t,s.era=n.era,s.year=n.year,s.month=n.month,s.day=n.day,Bt(s),s}function ec(e,t,n){if(e instanceof zn)return e.timeZone===t?e:zg(e,t);let s=Xe(e,t,n);return et(s,t)}function Kg(e){let t=un(e)-e.offset;return new Date(t)}function zg(e,t){let n=un(e)-e.offset;return le(et(n,t),e.calendar)}const Rn=36e5;function hr(e,t){let n=e.copy(),s="hour"in n?Qg(n,t):0;vo(n,t.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=t.months||0,yo(n),tc(n),n.day+=(t.weeks||0)*7,n.day+=t.days||0,n.day+=s,Zg(n),n.calendar.balanceDate&&n.calendar.balanceDate(n),n.year<1&&(n.year=1,n.month=1,n.day=1);let r=n.calendar.getYearsInEra(n);if(n.year>r){let i=n.calendar.isInverseEra?.(n);n.year=r,n.month=i?1:n.calendar.getMonthsInYear(n),n.day=i?1:n.calendar.getDaysInMonth(n)}n.month<1&&(n.month=1,n.day=1);let o=n.calendar.getMonthsInYear(n);return n.month>o&&(n.month=o,n.day=n.calendar.getDaysInMonth(n)),n.day=Math.max(1,Math.min(n.calendar.getDaysInMonth(n),n.day)),n}function vo(e,t){e.calendar.isInverseEra?.(e)&&(t=-t),e.year+=t}function yo(e){for(;e.month<1;)vo(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,vo(e,1)}function Zg(e){for(;e.day<1;)e.month--,yo(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,yo(e)}function tc(e){e.month=Math.max(1,Math.min(e.calendar.getMonthsInYear(e),e.month)),e.day=Math.max(1,Math.min(e.calendar.getDaysInMonth(e),e.day))}function Bt(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),tc(e)}function nc(e){let t={};for(let n in e)typeof e[n]=="number"&&(t[n]=-e[n]);return t}function sc(e,t){return hr(e,nc(t))}function qo(e,t){let n=e.copy();return t.era!=null&&(n.era=t.era),t.year!=null&&(n.year=t.year),t.month!=null&&(n.month=t.month),t.day!=null&&(n.day=t.day),Bt(n),n}function Ks(e,t){let n=e.copy();return t.hour!=null&&(n.hour=t.hour),t.minute!=null&&(n.minute=t.minute),t.second!=null&&(n.second=t.second),t.millisecond!=null&&(n.millisecond=t.millisecond),Xg(n),n}function Jg(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=bs(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=bs(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=bs(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=bs(e.hour,24),t}function Xg(e){e.millisecond=Math.max(0,Math.min(e.millisecond,999)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function bs(e,t){let n=e%t;return n<0&&(n+=t),n}function Qg(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,Jg(e)}function Go(e,t,n,s){let r=e.copy();switch(t){case"era":{let o=e.calendar.getEras(),i=o.indexOf(e.era);if(i<0)throw new Error("Invalid era: "+e.era);i=tt(i,n,0,o.length-1,s?.round),r.era=o[i],Bt(r);break}case"year":r.calendar.isInverseEra?.(r)&&(n=-n),r.year=tt(e.year,n,-1/0,9999,s?.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=tt(e.month,n,1,e.calendar.getMonthsInYear(e),s?.round);break;case"day":r.day=tt(e.day,n,1,e.calendar.getDaysInMonth(e),s?.round);break;default:throw new Error("Unsupported field "+t)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),Bt(r),r}function rc(e,t,n,s){let r=e.copy();switch(t){case"hour":{let o=e.hour,i=0,a=23;if(s?.hourCycle===12){let c=o>=12;i=c?12:0,a=c?23:11}r.hour=tt(o,n,i,a,s?.round);break}case"minute":r.minute=tt(e.minute,n,0,59,s?.round);break;case"second":r.second=tt(e.second,n,0,59,s?.round);break;case"millisecond":r.millisecond=tt(e.millisecond,n,0,999,s?.round);break;default:throw new Error("Unsupported field "+t)}return r}function tt(e,t,n,s,r=!1){if(r){e+=Math.sign(t),e<n&&(e=s);let o=Math.abs(t);t>0?e=Math.ceil(e/o)*o:e=Math.floor(e/o)*o,e>s&&(e=n)}else e+=t,e<n?e=s-(n-e-1):e>s&&(e=n+(e-s-1));return e}function oc(e,t){let n;if(t.years!=null&&t.years!==0||t.months!=null&&t.months!==0||t.weeks!=null&&t.weeks!==0||t.days!=null&&t.days!==0){let r=hr(ke(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days});n=Xe(r,e.timeZone)}else n=un(e)-e.offset;n+=t.milliseconds||0,n+=(t.seconds||0)*1e3,n+=(t.minutes||0)*6e4,n+=(t.hours||0)*36e5;let s=et(n,e.timeZone);return le(s,e.calendar)}function em(e,t){return oc(e,nc(t))}function tm(e,t,n,s){switch(t){case"hour":{let r=0,o=23;if(s?.hourCycle===12){let g=e.hour>=12;r=g?12:0,o=g?23:11}let i=ke(e),a=le(Ks(i,{hour:r}),new dn),c=[Xe(a,e.timeZone,"earlier"),Xe(a,e.timeZone,"later")].filter(g=>et(g,e.timeZone).day===a.day)[0],l=le(Ks(i,{hour:o}),new dn),p=[Xe(l,e.timeZone,"earlier"),Xe(l,e.timeZone,"later")].filter(g=>et(g,e.timeZone).day===l.day).pop(),u=un(e)-e.offset,f=Math.floor(u/Rn),h=u%Rn;return u=tt(f,n,Math.floor(c/Rn),Math.floor(p/Rn),s?.round)*Rn+h,le(et(u,e.timeZone),e.calendar)}case"minute":case"second":case"millisecond":return rc(e,t,n,s);case"era":case"year":case"month":case"day":{let r=Go(ke(e),t,n,s),o=Xe(r,e.timeZone);return le(et(o,e.timeZone),e.calendar)}default:throw new Error("Unsupported field "+t)}}function nm(e,t,n){let s=ke(e),r=Ks(qo(s,t),t);if(r.compare(s)===0)return e;let o=Xe(r,e.timeZone,n);return le(et(o,e.timeZone),e.calendar)}const sm=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,rm=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function om(e){let t=e.match(sm);if(!t)throw rm.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let n=new Re(Nr(t[1],0,9999),Nr(t[2],1,12),1);return n.day=Nr(t[3],1,n.calendar.getDaysInMonth(n)),n}function Nr(e,t,n){let s=Number(e);if(s<t||s>n)throw new RangeError(`Value out of range: ${t} <= ${s} <= ${n}`);return s}function im(e){return`${String(e.hour).padStart(2,"0")}:${String(e.minute).padStart(2,"0")}:${String(e.second).padStart(2,"0")}${e.millisecond?String(e.millisecond/1e3).slice(1):""}`}function ic(e){let t=le(e,new dn),n;return t.era==="BC"?n=t.year===1?"0000":"-"+String(Math.abs(1-t.year)).padStart(6,"00"):n=String(t.year).padStart(4,"0"),`${n}-${String(t.month).padStart(2,"0")}-${String(t.day).padStart(2,"0")}`}function ac(e){return`${ic(e)}T${im(e)}`}function am(e){let t=Math.sign(e)<0?"-":"+";e=Math.abs(e);let n=Math.floor(e/36e5),s=Math.floor(e%36e5/6e4),r=Math.floor(e%36e5%6e4/1e3),o=`${t}${String(n).padStart(2,"0")}:${String(s).padStart(2,"0")}`;return r!==0&&(o+=`:${String(r).padStart(2,"0")}`),o}function lm(e){return`${ac(e)}${am(e.offset)}[${e.timeZone}]`}function Yo(e){let t=typeof e[0]=="object"?e.shift():new dn,n;if(typeof e[0]=="string")n=e.shift();else{let i=t.getEras();n=i[i.length-1]}let s=e.shift(),r=e.shift(),o=e.shift();return[t,n,s,r,o]}class Re{#e;constructor(...t){let[n,s,r,o,i]=Yo(t);this.calendar=n,this.era=s,this.year=r,this.month=o,this.day=i,Bt(this)}copy(){return this.era?new Re(this.calendar,this.era,this.year,this.month,this.day):new Re(this.calendar,this.year,this.month,this.day)}add(t){return hr(this,t)}subtract(t){return sc(this,t)}set(t){return qo(this,t)}cycle(t,n,s){return Go(this,t,n,s)}toDate(t){return Ql(this,t)}toString(){return ic(this)}compare(t){return Gl(this,t)}}class zs{#e;constructor(...t){let[n,s,r,o,i]=Yo(t);this.calendar=n,this.era=s,this.year=r,this.month=o,this.day=i,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,Bt(this)}copy(){return this.era?new zs(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new zs(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(t){return hr(this,t)}subtract(t){return sc(this,t)}set(t){return qo(Ks(this,t),t)}cycle(t,n,s){switch(t){case"era":case"year":case"month":case"day":return Go(this,t,n,s);default:return rc(this,t,n,s)}}toDate(t,n){return Ql(this,t,n)}toString(){return ac(this)}compare(t){let n=Gl(this,t);return n===0?Hg(this,ke(t)):n}}class zn{#e;constructor(...t){let[n,s,r,o,i]=Yo(t),a=t.shift(),c=t.shift();this.calendar=n,this.era=s,this.year=r,this.month=o,this.day=i,this.timeZone=a,this.offset=c,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,Bt(this)}copy(){return this.era?new zn(this.calendar,this.era,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond):new zn(this.calendar,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond)}add(t){return oc(this,t)}subtract(t){return em(this,t)}set(t,n){return nm(this,t,n)}cycle(t,n,s){return tm(this,t,n,s)}toDate(){return Kg(this)}toString(){return lm(this)}toAbsoluteString(){return this.toDate().toISOString()}compare(t){return this.toDate().getTime()-ec(t,this.timeZone).toDate().getTime()}}let Fr=new Map;class Te{constructor(t,n={}){this.formatter=lc(t,n),this.options=n}format(t){return this.formatter.format(t)}formatToParts(t){return this.formatter.formatToParts(t)}formatRange(t,n){if(typeof this.formatter.formatRange=="function")return this.formatter.formatRange(t,n);if(n<t)throw new RangeError("End date must be >= start date");return`${this.formatter.format(t)} – ${this.formatter.format(n)}`}formatRangeToParts(t,n){if(typeof this.formatter.formatRangeToParts=="function")return this.formatter.formatRangeToParts(t,n);if(n<t)throw new RangeError("End date must be >= start date");let s=this.formatter.formatToParts(t),r=this.formatter.formatToParts(n);return[...s.map(o=>({...o,source:"startRange"})),{type:"literal",value:" – ",source:"shared"},...r.map(o=>({...o,source:"endRange"}))]}resolvedOptions(){let t=this.formatter.resolvedOptions();return um()&&(this.resolvedHourCycle||(this.resolvedHourCycle=fm(t.locale,this.options)),t.hourCycle=this.resolvedHourCycle,t.hour12=this.resolvedHourCycle==="h11"||this.resolvedHourCycle==="h12"),t.calendar==="ethiopic-amete-alem"&&(t.calendar="ethioaa"),t}}const cm={true:{ja:"h11"},false:{}};function lc(e,t={}){if(typeof t.hour12=="boolean"&&dm()){t={...t};let r=cm[String(t.hour12)][e.split("-")[0]],o=t.hour12?"h12":"h23";t.hourCycle=r??o,delete t.hour12}let n=e+(t?Object.entries(t).sort((r,o)=>r[0]<o[0]?-1:1).join():"");if(Fr.has(n))return Fr.get(n);let s=new Intl.DateTimeFormat(e,t);return Fr.set(n,s),s}let Hr=null;function dm(){return Hr==null&&(Hr=new Intl.DateTimeFormat("en-US",{hour:"numeric",hour12:!1}).format(new Date(2020,2,3,0))==="24"),Hr}let _r=null;function um(){return _r==null&&(_r=new Intl.DateTimeFormat("fr",{hour:"numeric",hour12:!1}).resolvedOptions().hourCycle==="h12"),_r}function fm(e,t){if(!t.timeStyle&&!t.hour)return;e=e.replace(/(-u-)?-nu-[a-zA-Z0-9]+/,""),e+=(e.includes("-u-")?"":"-u")+"-nu-latn";let n=lc(e,{...t,timeZone:void 0}),s=parseInt(n.formatToParts(new Date(2020,2,3,0)).find(o=>o.type==="hour").value,10),r=parseInt(n.formatToParts(new Date(2020,2,3,23)).find(o=>o.type==="hour").value,10);if(s===0&&r===23)return"h23";if(s===24&&r===23)return"h24";if(s===0&&r===11)return"h11";if(s===12&&r===11)return"h12";throw new Error("Unexpected hour cycle result")}function hm(e,t,n,s,r){const o={};for(let a in t){const c=a,l=t[c];l!=null&&(o[c]=Math.floor(l/2),o[c]>0&&l%2===0&&o[c]--)}const i=qt(e,t,n).subtract(o);return Qn(e,i,t,n,s,r)}function qt(e,t,n,s,r){let o=e;return t.years?o=Kn(e):t.months?o=Qe(e):t.weeks&&(o=St(e,n)),Qn(e,o,t,n,s,r)}function Ko(e,t,n,s,r){let o={...t};o.days?o.days--:o.weeks?o.weeks--:o.months?o.months--:o.years&&o.years--;let i=qt(e,t,n).subtract(o);return Qn(e,i,t,n,s,r)}function Qn(e,t,n,s,r,o){return r&&e.compare(r)>=0&&(t=Zl(t,qt(Vt(r),n,s))),o&&e.compare(o)<=0&&(t=zl(t,Ko(Vt(o),n,s))),t}function Ie(e,t,n){const s=Vt(e),r=t?Vt(t):void 0,o=n?Vt(n):void 0;let i=s;return r&&(i=Zl(i,r)),o&&(i=zl(i,o)),i.compare(s)===0?e:"hour"in e?e.set({year:i.year,month:i.month,day:i.day}):i}function ba(e,t,n,s,r,o){switch(t){case"start":return qt(e,n,s,r,o);case"end":return Ko(e,n,s,r,o);default:return hm(e,n,s,r,o)}}function Et(e,t){return e==null||t==null?e===t:!("hour"in e)&&!("hour"in t)?be(e,t):ke(e).compare(ke(t))===0}function wa(e,t,n,s,r){return e?t?.(e,n)?!0:He(e,s,r):!1}function He(e,t,n){return t!=null&&e.compare(t)<0||n!=null&&e.compare(n)>0}function pm(e,t,n){const s=e.subtract({days:1});return be(s,e)||He(s,t,n)}function gm(e,t,n){const s=e.add({days:1});return be(s,e)||He(s,t,n)}function zo(e){let t={...e};for(let n in t)t[n]=1;return t}function cc(e,t){let n={...t};return n.days?n.days--:n.days=-1,e.add(n)}function dc(e){if(!e)return;const t=e.calendar.identifier;return t==="gregory"||t==="iso8601"?e.era==="BC"?"short":void 0:"short"}function uc(e,t,n){const s=n??ke(fr(t));return new Te(e,{weekday:"long",month:"long",year:"numeric",day:"numeric",era:dc(s),calendar:s.calendar.identifier,timeZone:t})}function Ea(e,t,n){const s=n??fr(t);return new Te(e,{month:"long",year:"numeric",era:dc(s),calendar:s.calendar.identifier,timeZone:t})}function mm(e,t,n,s,r){let o=n.formatRangeToParts(e.toDate(r),t.toDate(r)),i=-1;for(let l=0;l<o.length;l++){let p=o[l];if(p.source==="shared"&&p.type==="literal")i=l;else if(p.source==="endRange")break}let a="",c="";for(let l=0;l<o.length;l++)l<i?a+=o[l].value:l>i&&(c+=o[l].value);return s(a,c)}function ws(e,t,n,s){if(!e)return"";let r=e,o=t??e,i=uc(n,s);return be(r,o)?i.format(r.toDate(s)):mm(r,o,i,(a,c)=>`${a} – ${c}`,s)}var vm=["sun","mon","tue","wed","thu","fri","sat"];function fc(e){return e!=null?vm[e]:void 0}function hc(e,t,n){const s=fc(n);return St(e,t,s)}function pc(e,t,n,s){const r=t.add({weeks:e}),o=[];let i=hc(r,n,s);for(;o.length<7;){o.push(i);let a=i.add({days:1});if(be(i,a))break;i=a}return o}function ym(e,t,n,s){const r=fc(s),o=n??Wg(e,t,r);return[...new Array(o).keys()].map(a=>pc(a,e,t,s))}function bm(e,t){const n=new Te(e,{weekday:"long",timeZone:t}),s=new Te(e,{weekday:"short",timeZone:t}),r=new Te(e,{weekday:"narrow",timeZone:t});return o=>{const i=o instanceof Date?o:o.toDate(t);return{value:o,short:s.format(i),long:n.format(i),narrow:r.format(i)}}}function wm(e,t,n,s){const r=hc(e,s,t),o=[...new Array(7).keys()],i=bm(s,n);return o.map(a=>i(r.add({days:a})))}function Em(e,t="long",n){if(!n||n.calendar.identifier==="gregory"||n.calendar.identifier==="iso8601"){const i=new Date(2021,0,1),a=[];for(let c=0;c<12;c++)a.push(i.toLocaleString(e,{month:t})),i.setMonth(i.getMonth()+1);return a}const s=n.calendar.getMonthsInYear(n),r=new Te(e,{month:t,calendar:n.calendar.identifier}),o=[];for(let i=1;i<=s;i++){const a=n.set({month:i});o.push(r.format(a.toDate("UTC")))}return o}function xa(e,t){const n=St(e,t,"mon"),s=n.year,r=n.set({month:1,day:4}),o=St(r,t,"mon"),i=n.calendar.toJulianDay(n),a=o.calendar.toJulianDay(o);if(i>=a)return 1+Math.floor((i-a)/7);const c=n.set({year:s-1,month:1,day:4}),l=St(c,t,"mon"),p=l.calendar.toJulianDay(l);return 1+Math.floor((i-p)/7)}function xm(e){const t=[];for(let n=e.from;n<=e.to;n+=1)t.push(n);return t}var Sm=1900,$m=2099;function Im(e,t,n){const s=e.calendar,r=t?.year??le(new Re(Sm,1,1),s).year,o=n?.year??le(new Re($m,12,31),s).year;return{from:r,to:o}}var Tm=10;function Cm(e){if(e){if(e.length===3)return e.padEnd(4,"0");if(e.length===2){const t=new Date().getFullYear(),n=Math.floor(t/100)*100,s=parseInt(e.slice(-2),10),r=n+s;return r>t+Tm?(r-100).toString():r.toString()}return e}}function sn(e){const t=e-e%10,n=[];for(let s=0;s<10;s+=1){const r=t+s;n.push(r)}return n}function Un(e,t){const n=fr(e??Uo());return t?le(n,t):n}function es(e,t,n,s){return function(o){const{startDate:i,focusedDate:a}=o,c=cc(i,e);return He(a,n,s)?{startDate:i,focusedDate:Ie(a,n,s),endDate:c}:a.compare(i)<0?{startDate:Ko(a,e,t,n,s),focusedDate:Ie(a,n,s),endDate:c}:a.compare(c)>0?{startDate:qt(a,e,t,n,s),endDate:c,focusedDate:Ie(a,n,s)}:{startDate:i,endDate:c,focusedDate:Ie(a,n,s)}}}function gc(e,t,n,s,r,o){const i=es(n,s,r,o),a=t.add(n);return i({focusedDate:e.add(n),startDate:qt(Qn(e,a,n,s,r,o),n,s)})}function mc(e,t,n,s,r,o){const i=es(n,s,r,o);let a=t.subtract(n);return i({focusedDate:e.subtract(n),startDate:qt(Qn(e,a,n,s,r,o),n,s)})}function km(e,t,n,s,r,o,i){const a=es(s,r,o,i);if(!n&&!s.days)return a({focusedDate:e.add(zo(s)),startDate:t});if(s.days)return gc(e,t,s,r,o,i);if(s.weeks)return a({focusedDate:e.add({months:1}),startDate:t});if(s.months||s.years)return a({focusedDate:e.add({years:1}),startDate:t})}function Am(e,t,n,s,r,o,i){const a=es(s,r,o,i);if(!n&&!s.days)return a({focusedDate:e.subtract(zo(s)),startDate:t});if(s.days)return mc(e,t,s,r,o,i);if(s.weeks)return a({focusedDate:e.subtract({months:1}),startDate:t});if(s.months||s.years)return a({focusedDate:e.subtract({years:1}),startDate:t})}var Sa=new Map;function Om(e){let t=Sa.get(e);return t!=null||(t="0123456789"+new Intl.NumberFormat(e,{useGrouping:!1}).format(1234567890),Sa.set(e,t)),t}var Lm=(e,t)=>t?Om(t).includes(e):/\d/.test(e),vc=(e,t,n)=>!e||e.length!==1?!0:Lm(e,n)||t.includes(e),Mm=(e,t,n)=>e.split("").filter(s=>vc(s,t,n)).join(""),$a=new Map;function Dm(e){let t=$a.get(e);if(t!=null)return t;const s=new Intl.DateTimeFormat(e).formatToParts(new Date).find(r=>r.type==="literal");return t=s?s.value:"/",$a.set(e,t),t}var Ia=e=>e!=null&&e.length===4,Rm=e=>e!=null&&parseFloat(e)<=12,Pm=e=>e!=null&&parseFloat(e)<=31;function Vm(e,t,n){const s=Nm(t,n);let{year:r,month:o,day:i}=Fm(s,e)??{};if(r!=null||o!=null||i!=null){const l=new Date;r||(r=l.getFullYear().toString()),o||(o=(l.getMonth()+1).toString()),i||(i=l.getDate().toString())}if(Ia(r)||(r=Cm(r)),Ia(r)&&Rm(o)&&Pm(i))return new Re(+r,+o,+i);const c=Date.parse(e);if(!isNaN(c)){const l=new Date(c);return new Re(l.getFullYear(),l.getMonth()+1,l.getDate())}}function Nm(e,t){return new Te(e,{day:"numeric",month:"numeric",year:"numeric",timeZone:t}).formatToParts(new Date(2e3,11,25)).map(({type:r,value:o})=>r==="literal"?`${o}?`:`((?!=<${r}>)\\d+)?`).join("")}function Fm(e,t){const n=t.match(e);return e.toString().match(/<(.+?)>/g)?.map(s=>{const r=s.match(/<(.+)>/);return!r||r.length<=0?null:s.match(/<(.+)>/)?.[1]}).reduce((s,r,o)=>(r&&(n&&n.length>o?s[r]=n[o+1]:s[r]=null),s),{})}function Ta(e,t,n){const s=Vt(ql(n));switch(e){case"thisWeek":return[St(s,t),ga(s,t)];case"thisMonth":return[Qe(s),s];case"thisQuarter":return[Qe(s).add({months:-((s.month-1)%3)}),s];case"thisYear":return[Kn(s),s];case"last3Days":return[s.add({days:-2}),s];case"last7Days":return[s.add({days:-6}),s];case"last14Days":return[s.add({days:-13}),s];case"last30Days":return[s.add({days:-29}),s];case"last90Days":return[s.add({days:-89}),s];case"lastMonth":return[Qe(s.add({months:-1})),go(s.add({months:-1}))];case"lastQuarter":return[Qe(s.add({months:-((s.month-1)%3)-3})),go(s.add({months:-((s.month-1)%3)-1}))];case"lastWeek":return[St(s,t).add({weeks:-1}),ga(s,t).add({weeks:-1})];case"lastYear":return[Kn(s.add({years:-1})),Bg(s.add({years:-1}))];default:throw new Error(`Invalid date range preset: ${e}`)}}var Hm=(e,t)=>e.ids?.label?.(t)??`datepicker:${e.id}:label:${t}`,_m=e=>e.ids?.root??`datepicker:${e.id}`,Bm=(e,t)=>e.ids?.table?.(t)??`datepicker:${e.id}:table:${t}`,bo=e=>e.ids?.content??`datepicker:${e.id}:content`,Br=(e,t)=>e.ids?.cellTrigger?.(t)??`datepicker:${e.id}:cell-trigger:${t}`,jm=(e,t)=>e.ids?.prevTrigger?.(t)??`datepicker:${e.id}:prev:${t}`,Wm=(e,t)=>e.ids?.nextTrigger?.(t)??`datepicker:${e.id}:next:${t}`,Um=(e,t)=>e.ids?.viewTrigger?.(t)??`datepicker:${e.id}:view:${t}`,yc=e=>e.ids?.clearTrigger??`datepicker:${e.id}:clear`,bc=e=>e.ids?.control??`datepicker:${e.id}:control`,Ca=(e,t)=>e.ids?.input?.(t)??`datepicker:${e.id}:input:${t}`,wc=e=>e.ids?.trigger??`datepicker:${e.id}:trigger`,Ec=e=>e.ids?.positioner??`datepicker:${e.id}:positioner`,xc=e=>e.ids?.monthSelect??`datepicker:${e.id}:month-select`,Sc=e=>e.ids?.yearSelect??`datepicker:${e.id}:year-select`,ka=(e,t)=>of(Xt(e),`[data-part=table-cell-trigger][data-view=${t}][data-focus]:not([data-outside-range])`),Ds=e=>e.getById(wc(e)),Xt=e=>e.getById(bo(e)),_n=e=>rf($c(e),"[data-part=input]"),qm=e=>e.getById(Sc(e)),Gm=e=>e.getById(xc(e)),Ym=e=>e.getById(yc(e)),Aa=e=>e.getById(Ec(e)),$c=e=>e.getById(bc(e)),Oa=e=>{const t=_n(e);if(t.length===0){Ds(e)?.focus({preventScroll:!0});return}const n=t.findLastIndex(o=>o.value!==""),s=Math.max(n,0),r=t[s];r?.focus({preventScroll:!0}),r?.setSelectionRange(r.value.length,r.value.length)};function Rs(e){const[t,n]=e;let s;return!t||!n?s=e:s=t.compare(n)<=0?e:[n,t],s}function Zt(e,t){const[n,s]=t;return!n||!s?!1:n.compare(e)<=0&&s.compare(e)>=0}function Es(e){return e.slice().filter(t=>t!=null).sort((t,n)=>t.compare(n))}function Km(e,t){return new Te(e).formatToParts(new Date).map(n=>t[n.type]??n.value).join("")}var La=e=>!Number.isNaN(e.day)&&!Number.isNaN(e.month)&&!Number.isNaN(e.year),zm={dayCell(e){return e.unavailable?`Not available. ${e.valueText}`:e.firstInRange?`Starting range from ${e.valueText}`:e.lastInRange?`Range ending at ${e.valueText}`:e.inRange?`In range. ${e.valueText}`:e.selected?`Selected date. ${e.valueText}`:`Choose ${e.valueText}`},trigger(e){return e?"Close calendar":"Open calendar"},viewTrigger(e,t){return t?`Switch to ${t} view`:`${e} view`},presetTrigger(e){const[t="",n=""]=e;return`select ${t} to ${n}`},prevTrigger(e){return Yr(e,{year:"Switch to previous decade",month:"Switch to previous year",day:"Switch to previous month"})},nextTrigger(e){return Yr(e,{year:"Switch to next decade",month:"Switch to next year",day:"Switch to next month"})},placeholder(){return{day:"dd",month:"mm",year:"yyyy"}},content:"calendar",monthSelect:"Select month",yearSelect:"Select year",clearTrigger:"Clear selected dates",weekColumnHeader:"Wk",weekNumberCell(e){return`Week ${e}`}};function rt(e,t){return e?e==="day"?0:e==="month"?1:2:t||0}function Zo(e){return e===0?"day":e===1?"month":"year"}function Jo(e,t,n){return Zo(zd(rt(e,0),rt(t,0),rt(n,2)))}function Zm(e,t){return rt(e,0)>rt(t,0)}function Jm(e,t){return rt(e,0)<rt(t,0)}function Ic(e,t,n){const s=rt(e,0)+1;return Jo(Zo(s),t,n)}function Xm(e,t,n){const s=rt(e,0)-1;return Jo(Zo(s),t,n)}var Qm=["day","month","year"];function ev(e){Qm.forEach(t=>e(t))}var tv=rp(e=>[e.view,e.startValue.toString(),e.endValue.toString(),e.locale,e.timeZone,e.selectionMode],([e],t)=>{const{startValue:n,endValue:s,locale:r,timeZone:o,selectionMode:i}=t;if(e==="year"){const u=sn(n.year),f=u.at(0).toString(),h=u.at(-1).toString();return{start:f,end:h,formatted:`${f} - ${h}`}}if(e==="month"){const u=new Te(r,{year:"numeric",timeZone:o,calendar:n.calendar.identifier}),f=u.format(n.toDate(o)),h=u.format(s.toDate(o)),g=i==="range"?`${f} - ${h}`:f;return{start:f,end:h,formatted:g}}const a=new Te(r,{month:"long",year:"numeric",timeZone:o,calendar:n.calendar.identifier}),c=a.format(n.toDate(o)),l=a.format(s.toDate(o)),p=i==="range"?`${c} - ${l}`:c;return{start:c,end:l,formatted:p}});function nv(e,t){const{state:n,context:s,prop:r,send:o,computed:i,scope:a}=e,c=s.get("startValue"),l=i("endValue"),p=s.get("value"),u=s.get("focusedValue"),f=s.get("hoveredValue"),h=f?Rs([p[0],f]):[],g=!!r("disabled"),d=!!r("readOnly"),m=!!r("invalid"),y=i("isInteractive"),b=p.length===0,T=r("min"),M=r("max"),x=r("locale"),C=r("timeZone"),w=r("startOfWeek"),$=n.matches("focused"),R=n.matches("open"),L=r("selectionMode")==="range",E=r("selectionMode")==="multiple",O=r("isDateUnavailable"),D=r("maxSelectedDates"),V=E&&D!=null&&p.length>=D,H=s.get("currentPlacement"),Z=H?xl(H):void 0,se=Sl({...r("positioning"),placement:H}),W=Dm(x),U=Ya(zm,r("translations"));function he(k=c){const S=r("fixedWeeks")?6:void 0;return ym(k,x,S,w)}function xn(k={}){const{format:S}=k;return Em(x,S,u).map((v,I)=>{const N=I+1,Q=u.set({month:N}),B=He(Q,T,M);return{label:v,value:N,disabled:B}})}function Ge(){const k=Im(u,T,M);return xm(k).map(v=>({label:v.toString(),value:v,disabled:!wr(v,T?.year,M?.year)}))}function Ye(k){return wa(k,O,x,T,M)}function kt(k){const S=c??Un(C,u.calendar);o({type:"FOCUS.SET",value:S.set({month:k})})}function Gt(k){const S=c??Un(C,u.calendar);o({type:"FOCUS.SET",value:S.set({year:k})})}function vt(k){const{value:S,disabled:v}=k,I=u.set({year:S}),Q=!sn(c.year).includes(S),B=wr(S,T?.year,M?.year),q=L&&Zt(I,p),ae=L&&p[0]&&Dn(I,p[0]),Le=L&&p[1]&&Dn(I,p[1]),Ve=L&&h.length>0,oe=Ve&&Zt(I,h),Ne=Ve&&h[0]&&Dn(I,h[0]),Fe=Ve&&h[1]&&Dn(I,h[1]),rs={focused:u.year===k.value,selectable:B,outsideRange:Q,selected:!!p.find(os=>os&&os.year===S),valueText:S.toString(),inRange:q||oe,firstInRange:!!ae,lastInRange:!!Le,inHoveredRange:!!oe,firstInHoveredRange:!!Ne,lastInHoveredRange:!!Fe,value:I,get disabled(){return v||!rs.selectable}};return rs}function At(k){const{value:S,disabled:v}=k,I=u.set({month:S}),N=Ea(x,C,u),Q=L&&Zt(I,p),B=L&&p[0]&&Mn(I,p[0]),q=L&&p[1]&&Mn(I,p[1]),ae=L&&h.length>0,Le=ae&&Zt(I,h),Ve=ae&&h[0]&&Mn(I,h[0]),oe=ae&&h[1]&&Mn(I,h[1]),Ne={focused:u.month===k.value,selectable:!He(I,T,M),selected:!!p.find(Fe=>Fe&&Fe.month===S&&Fe.year===u.year),valueText:N.format(I.toDate(C)),inRange:Q||Le,firstInRange:!!B,lastInRange:!!q,inHoveredRange:!!Le,firstInHoveredRange:!!Ve,lastInHoveredRange:!!oe,outsideRange:!1,value:I,get disabled(){return v||!Ne.selectable}};return Ne}function yt(k){const{value:S,disabled:v,visibleRange:I=i("visibleRange")}=k,N=uc(x,C,u),Q=zo(i("visibleDuration")),B=r("outsideDaySelectable"),q=I.start.add(Q).subtract({days:1}),ae=He(S,I.start,q),Le=L&&Zt(S,p),Ve=L&&p[0]&&be(S,p[0]),oe=L&&p[1]&&be(S,p[1]),Ne=L&&h.length>0,Fe=Ne&&Zt(S,h),rs=Ne&&h[0]&&be(S,h[0]),os=Ne&&h[1]&&be(S,h[1]),pi=p.some(gi=>gi!=null&&be(S,gi)),is={invalid:He(S,T,M),disabled:v||!B&&ae||He(S,T,M)||V&&!pi,selected:pi,unavailable:wa(S,O,x,T,M)&&!v,outsideRange:ae,today:Ng(S,C),weekend:qg(S,x),value:S,valueText:N.format(S.toDate(C)),get focused(){return u!=null&&be(S,u)&&(!is.outsideRange||B)},get selectable(){return!is.disabled&&!is.unavailable},inRange:Le||Fe,firstInRange:Ve,lastInRange:oe,inHoveredRange:Fe,firstInHoveredRange:rs,lastInHoveredRange:os};return is}function Sn(k){const{view:S="day",id:v}=k;return[S,v].filter(Boolean).join(" ")}return{focused:$,open:R,disabled:g,invalid:m,readOnly:d,inline:!!r("inline"),numOfMonths:r("numOfMonths"),showWeekNumbers:!!r("showWeekNumbers"),selectionMode:r("selectionMode"),maxSelectedDates:D,isMaxSelected:V,view:s.get("view"),getRangePresetValue(k){return Ta(k,x,C)},getWeekNumber(k){const S=k[0];return S?xa(S,x):0},getDaysInWeek(k,S=c){return pc(k,S,x,w)},getOffset(k){const S=c.add(k),v=l.add(k),I=Ea(x,C,u);return{visibleRange:{start:S,end:v},weeks:he(S),visibleRangeText:{start:I.format(S.toDate(C)),end:I.format(v.toDate(C))}}},getMonthWeeks:he,isUnavailable:Ye,weeks:he(),weekDays:wm(c,w,C,x),visibleRangeText:i("visibleRangeText"),value:p,valueAsDate:p.filter(k=>k!=null).map(k=>k.toDate(C)),valueAsString:i("valueAsString"),focusedValue:u,focusedValueAsDate:u?.toDate(C),focusedValueAsString:r("format")(u,{locale:x,timeZone:C}),visibleRange:i("visibleRange"),selectToday(){const k=Ie(Un(C,u.calendar),T,M);o({type:"VALUE.SET",value:[k]})},setValue(k){const S=k.map(v=>Ie(v,T,M));o({type:"VALUE.SET",value:S})},setTime(k,S=0){const v=Array.from(p);let I=v[S];I&&("hour"in I||(I=ke(I)),I=I.set({hour:k.hour??("hour"in I?I.hour:0),minute:k.minute??("minute"in I?I.minute:0),second:k.second??("second"in I?I.second:0),millisecond:k.millisecond??("millisecond"in I?I.millisecond:0)}),v[S]=Ie(I,T,M),o({type:"VALUE.SET",value:v}))},clearValue(k={}){const{focus:S=!0}=k;o({type:"VALUE.CLEAR",focus:S})},setFocusedValue(k){o({type:"FOCUS.SET",value:k})},setOpen(k){r("inline")||o({type:k?"OPEN":"CLOSE",replaces:"open"})},focusMonth:kt,focusYear:Gt,getYears:Ge,getMonths:xn,getYearsGrid(k={}){const{columns:S=1}=k,v=sn(c.year).map(I=>({label:I.toString(),value:I,disabled:!wr(I,T?.year,M?.year)}));return Ei(v,S)},getDecade(){const k=sn(c.year);return{start:k.at(0),end:k.at(-1)}},getMonthsGrid(k={}){const{columns:S=1,format:v}=k;return Ei(xn({format:v}),S)},format(k,S={month:"long",year:"numeric"}){return new Te(x,{...S,calendar:k.calendar.identifier}).format(k.toDate(C))},setView(k){o({type:"VIEW.SET",view:k})},goToNext(){o({type:"GOTO.NEXT",view:s.get("view")})},goToPrev(){o({type:"GOTO.PREV",view:s.get("view")})},getRootProps(){return t.element({...J.root.attrs,dir:r("dir"),id:_m(a),"data-state":R?"open":"closed","data-disabled":P(g),"data-readonly":P(d),"data-empty":P(b)})},getLabelProps(k={}){const{index:S=0}=k;return t.label({...J.label.attrs,id:Hm(a,S),dir:r("dir"),htmlFor:Ca(a,S),"data-state":R?"open":"closed","data-index":S,"data-disabled":P(g),"data-readonly":P(d),"data-invalid":P(m)})},getControlProps(){return t.element({...J.control.attrs,dir:r("dir"),id:bc(a),"data-disabled":P(g),"data-placeholder-shown":P(b),"data-invalid":P(m)})},getRangeTextProps(){return t.element({...J.rangeText.attrs,dir:r("dir")})},getContentProps(){return t.element({...J.content.attrs,hidden:!R,dir:r("dir"),"data-state":R?"open":"closed","data-placement":H,"data-side":Z,"data-inline":P(r("inline")),id:bo(a),tabIndex:-1,role:"application","aria-label":U.content})},getTableProps(k={}){const{view:S="day",columns:v=S==="day"?7:4}=k,I=Sn(k);return t.element({...J.table.attrs,role:"grid","data-columns":v,"aria-label":i("visibleRangeText").formatted,id:Bm(a,I),"aria-readonly":de(d),"aria-disabled":de(g),"aria-multiselectable":de(r("selectionMode")!=="single"),"data-view":S,dir:r("dir"),tabIndex:-1,onKeyDown(N){if(N.defaultPrevented||g)return;const Q={Enter(){y&&(S==="day"&&Ye(u)||S==="month"&&!At({value:u.month}).selectable||S==="year"&&!vt({value:u.year}).selectable||o({type:"TABLE.ENTER",view:S,columns:v,focus:!0}))},Space(q){Q.Enter?.()},ArrowLeft(){o({type:"TABLE.ARROW_LEFT",view:S,columns:v,focus:!0})},ArrowRight(){o({type:"TABLE.ARROW_RIGHT",view:S,columns:v,focus:!0})},ArrowUp(){o({type:"TABLE.ARROW_UP",view:S,columns:v,focus:!0})},ArrowDown(){o({type:"TABLE.ARROW_DOWN",view:S,columns:v,focus:!0})},PageUp(q){o({type:"TABLE.PAGE_UP",larger:q.shiftKey,view:S,columns:v,focus:!0})},PageDown(q){o({type:"TABLE.PAGE_DOWN",larger:q.shiftKey,view:S,columns:v,focus:!0})},Home(){o({type:"TABLE.HOME",view:S,columns:v,focus:!0})},End(){o({type:"TABLE.END",view:S,columns:v,focus:!0})}},B=Q[zr(N,{dir:r("dir")})];B&&(B(N),N.preventDefault(),N.stopPropagation())},onPointerLeave(){o({type:"TABLE.POINTER_LEAVE"})},onPointerDown(){o({type:"TABLE.POINTER_DOWN",view:S})},onPointerUp(){o({type:"TABLE.POINTER_UP",view:S})}})},getTableHeadProps(k={}){const{view:S="day"}=k;return t.element({...J.tableHead.attrs,"aria-hidden":!0,dir:r("dir"),"data-view":S,"data-disabled":P(g)})},getTableHeaderProps(k={}){const{view:S="day"}=k;return t.element({...J.tableHeader.attrs,dir:r("dir"),"data-view":S,"data-disabled":P(g)})},getTableBodyProps(k={}){const{view:S="day"}=k;return t.element({...J.tableBody.attrs,"data-view":S,"data-disabled":P(g)})},getTableRowProps(k={}){const{view:S="day"}=k;return t.element({...J.tableRow.attrs,"aria-disabled":de(g),"data-disabled":P(g),"data-view":S})},getWeekNumberHeaderCellProps(k={}){const{view:S="day"}=k;return t.element({...J.tableCell.attrs,scope:"col","aria-label":U.weekColumnHeader,"data-view":S,"data-type":"week-number","data-disabled":P(g)})},getWeekNumberCellProps(k){const{weekIndex:S,week:v}=k,I=v[0]?xa(v[0],x):0;return t.element({...J.tableCell.attrs,role:"rowheader","aria-label":U.weekNumberCell?.(I),"data-view":"day","data-week-index":S,"data-type":"week-number","data-disabled":P(g)})},getDayTableCellState:yt,getDayTableCellProps(k){const{value:S}=k,v=yt(k);return t.element({...J.tableCell.attrs,role:"gridcell","aria-disabled":de(!v.selectable),"aria-selected":v.selected||v.inRange,"aria-invalid":de(v.invalid),"aria-current":v.today?"date":void 0,"data-value":S.toString()})},getDayTableCellTriggerProps(k){const{value:S}=k,v=yt(k);return t.element({...J.tableCellTrigger.attrs,id:Br(a,S.toString()),role:"button",dir:r("dir"),tabIndex:g?-1:v.focused?0:-1,"aria-label":U.dayCell(v),"aria-disabled":de(!v.selectable),"aria-invalid":de(v.invalid),"data-disabled":P(!v.selectable),"data-selectable":P(v.selectable),"data-selected":P(v.selected),"data-value":S.toString(),"data-view":"day","data-today":P(v.today),"data-focus":P(v.focused),"data-unavailable":P(v.unavailable),"data-range-start":P(v.firstInRange),"data-range-end":P(v.lastInRange),"data-in-range":P(v.inRange),"data-outside-range":P(v.outsideRange),"data-weekend":P(v.weekend),"data-in-hover-range":P(v.inHoveredRange),"data-hover-range-start":P(v.firstInHoveredRange),"data-hover-range-end":P(v.lastInHoveredRange),onClick(I){I.defaultPrevented||y&&v.selectable&&o({type:"CELL.CLICK",cell:"day",value:S})},onPointerMove:L?I=>{if(I.pointerType==="touch"||!v.selectable)return;const N=!a.isActiveElement(I.currentTarget);f&&Vg(S,f)||o({type:"CELL.POINTER_MOVE",cell:"day",value:S,focus:N,outsideRange:v.outsideRange})}:void 0})},getMonthTableCellState:At,getMonthTableCellProps(k){const{value:S,columns:v}=k,I=At(k);return t.element({...J.tableCell.attrs,dir:r("dir"),colSpan:v,role:"gridcell","aria-selected":de(I.selected||I.inRange),"data-selected":P(I.selected),"aria-disabled":de(!I.selectable),"data-value":S})},getMonthTableCellTriggerProps(k){const{value:S}=k,v=At(k);return t.element({...J.tableCellTrigger.attrs,id:Br(a,S.toString()),role:"button",dir:r("dir"),tabIndex:g?-1:v.focused?0:-1,"aria-label":v.valueText,"aria-disabled":de(!v.selectable),"data-disabled":P(!v.selectable),"data-selectable":P(v.selectable),"data-selected":P(v.selected),"data-value":S,"data-view":"month","data-focus":P(v.focused),"data-outside-range":P(v.outsideRange),"data-range-start":P(v.firstInRange),"data-range-end":P(v.lastInRange),"data-in-range":P(v.inRange),"data-in-hover-range":P(v.inHoveredRange),"data-hover-range-start":P(v.firstInHoveredRange),"data-hover-range-end":P(v.lastInHoveredRange),onClick(I){I.defaultPrevented||y&&v.selectable&&o({type:"CELL.CLICK",cell:"month",value:S})},onPointerMove:L?I=>{if(I.pointerType==="touch"||!v.selectable)return;const N=!a.isActiveElement(I.currentTarget);f&&v.value&&Mn(v.value,f)||o({type:"CELL.POINTER_MOVE",cell:"month",value:v.value,focus:N})}:void 0})},getYearTableCellState:vt,getYearTableCellProps(k){const{value:S,columns:v}=k,I=vt(k);return t.element({...J.tableCell.attrs,dir:r("dir"),colSpan:v,role:"gridcell","aria-selected":de(I.selected||I.inRange),"data-selected":P(I.selected),"aria-disabled":de(!I.selectable),"data-value":S})},getYearTableCellTriggerProps(k){const{value:S}=k,v=vt(k);return t.element({...J.tableCellTrigger.attrs,id:Br(a,S.toString()),role:"button",dir:r("dir"),tabIndex:g?-1:v.focused?0:-1,"aria-label":v.valueText,"aria-disabled":de(!v.selectable),"data-disabled":P(!v.selectable),"data-selectable":P(v.selectable),"data-selected":P(v.selected),"data-value":S,"data-view":"year","data-focus":P(v.focused),"data-outside-range":P(v.outsideRange),"data-range-start":P(v.firstInRange),"data-range-end":P(v.lastInRange),"data-in-range":P(v.inRange),"data-in-hover-range":P(v.inHoveredRange),"data-hover-range-start":P(v.firstInHoveredRange),"data-hover-range-end":P(v.lastInHoveredRange),onClick(I){I.defaultPrevented||y&&v.selectable&&o({type:"CELL.CLICK",cell:"year",value:S})},onPointerMove:L?I=>{if(I.pointerType==="touch"||!v.selectable||v.outsideRange)return;const N=!a.isActiveElement(I.currentTarget);f&&v.value&&Dn(v.value,f)||o({type:"CELL.POINTER_MOVE",cell:"year",value:v.value,focus:N})}:void 0})},getNextTriggerProps(k={}){const{view:S="day"}=k,v=g||!i("isNextVisibleRangeValid");return t.button({...J.nextTrigger.attrs,dir:r("dir"),id:Wm(a,S),type:"button","aria-label":U.nextTrigger(S),disabled:v,"data-disabled":P(v),onClick(I){I.defaultPrevented||o({type:"GOTO.NEXT",view:S})}})},getPrevTriggerProps(k={}){const{view:S="day"}=k,v=g||!i("isPrevVisibleRangeValid");return t.button({...J.prevTrigger.attrs,dir:r("dir"),id:jm(a,S),type:"button","aria-label":U.prevTrigger(S),disabled:v,"data-disabled":P(v),onClick(I){I.defaultPrevented||o({type:"GOTO.PREV",view:S})}})},getClearTriggerProps(){return t.button({...J.clearTrigger.attrs,id:yc(a),dir:r("dir"),type:"button","aria-label":U.clearTrigger,hidden:!p.length,onClick(k){k.defaultPrevented||y&&o({type:"VALUE.CLEAR"})}})},getTriggerProps(){return t.button({...J.trigger.attrs,id:wc(a),dir:r("dir"),type:"button","data-placement":H,"data-side":Z,"aria-label":U.trigger(R),"aria-controls":bo(a),"aria-expanded":R,"data-state":R?"open":"closed","data-placeholder-shown":P(b),"aria-haspopup":"grid",disabled:g,onClick(k){k.defaultPrevented||y&&o({type:"TRIGGER.CLICK"})}})},getViewProps(k={}){const{view:S="day"}=k;return t.element({...J.view.attrs,"data-view":S,hidden:s.get("view")!==S})},getViewTriggerProps(k={}){const{view:S="day"}=k,v=Ic(S,r("minView"),r("maxView")),I=v!==S,N=g||!I;return t.button({...J.viewTrigger.attrs,"data-view":S,dir:r("dir"),id:Um(a,S),type:"button",disabled:N,"data-disabled":P(N),"aria-label":U.viewTrigger(S,I?v:void 0),onClick(Q){Q.defaultPrevented||y&&o({type:"VIEW.TOGGLE",src:"viewTrigger"})}})},getViewControlProps(k={}){const{view:S="day"}=k;return t.element({...J.viewControl.attrs,"data-view":S,dir:r("dir")})},getInputProps(k={}){const{index:S=0,fixOnBlur:v=!0}=k;return t.input({...J.input.attrs,id:Ca(a,S),autoComplete:"off",autoCorrect:"off",spellCheck:"false",dir:r("dir"),name:r("name"),"data-index":S,"data-state":R?"open":"closed","data-placeholder-shown":P(b),readOnly:d,disabled:g,required:r("required"),"aria-invalid":de(m),"data-invalid":P(m),placeholder:r("placeholder")||Km(x,U.placeholder(x)),defaultValue:i("valueAsString")[S],onBeforeInput(I){const{data:N}=Lo(I);vc(N,W,x)||I.preventDefault()},onClick(I){I.defaultPrevented||r("openOnClick")&&y&&o({type:"OPEN",src:"input.click"})},onFocus(){o({type:"INPUT.FOCUS",index:S})},onBlur(I){const N=I.currentTarget.value.trim();o({type:"INPUT.BLUR",value:N,index:S,fixOnBlur:v})},onKeyDown(I){if(I.defaultPrevented||!y)return;const Q={Enter(B){Cu(B)||Ye(u)||B.currentTarget.value.trim()!==""&&o({type:"INPUT.ENTER",value:B.currentTarget.value,index:S})}}[I.key];Q&&(Q(I),I.preventDefault())},onInput(I){const N=I.currentTarget.value;o({type:"INPUT.CHANGE",value:Mm(N,W,x),index:S})}})},getMonthSelectProps(){return t.select({...J.monthSelect.attrs,id:xc(a),"aria-label":U.monthSelect,disabled:g,dir:r("dir"),defaultValue:c.month,onChange(k){kt(Number(k.currentTarget.value))}})},getYearSelectProps(){return t.select({...J.yearSelect.attrs,id:Sc(a),disabled:g,"aria-label":U.yearSelect,dir:r("dir"),defaultValue:c.year,onChange(k){Gt(Number(k.currentTarget.value))}})},getPositionerProps(){return t.element({id:Ec(a),...J.positioner.attrs,dir:r("dir"),style:se.floating})},getPresetTriggerProps(k){const S=Array.isArray(k.value)?k.value:Ta(k.value,x,C),v=S.filter(I=>I!=null).map(I=>I.toDate(C).toDateString());return t.button({...J.presetTrigger.attrs,"aria-label":U.presetTrigger(v),type:"button",onClick(I){I.defaultPrevented||y&&o({type:"PRESET.CLICK",value:S})}})}}}var jr="__live-region-debug__",sv="position:fixed;inset-inline:0;bottom:0;z-index:2147483647;padding:12px 16px;background:black;color:white;font-size:14px;line-height:20px;text-align:center;pointer-events:none;",rv=100,ov=200,iv={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"};function av(e={}){const{level:t="polite",document:n=document,root:s,delay:r=0,debug:o=!1}=e,i=n.defaultView??window,a=()=>(typeof s=="function"?s():s)??n.body;let c;function l(){if(!o)return;let m=n.getElementById(jr);return m||(m=n.createElement("div"),m.id=jr,m.dataset.liveAnnouncerDebug="true",m.setAttribute("aria-hidden","true"),m.style.cssText=sv,a().appendChild(m),m)}function p(){const m=n.createElement("span");return m.dataset.liveAnnouncer="true",m.setAttribute("aria-live",t),m.setAttribute("aria-atomic","true"),m.setAttribute("role",t==="assertive"?"alert":"status"),Object.assign(m.style,iv),a().appendChild(m),u=Date.now()+ov,m}let u=0,f=p();function h(){i.clearTimeout(c),c=void 0}function g(m,y=r){h(),f?.isConnected||(f=p());const b=f;b.textContent="",c=i.setTimeout(()=>{c=void 0,b.textContent=m;const T=l();T&&(T.textContent=m)},Math.max(y,rv,u-Date.now()))}function d(){h(),f?.remove(),f=null,o&&n.getElementById(jr)?.remove()}return{announce:g,cancel:h,destroy:d,toJSON(){return"live-region"}}}var{and:ge}=Al();function lv(e,t){if(e?.length!==t?.length)return!1;const n=Math.max(e.length,t.length);for(let s=0;s<n;s++)if(!Et(e[s],t[s]))return!1;return!0}function xs(e,t){return e.map(n=>n==null?"":t("format")(n,{locale:t("locale"),timeZone:t("timeZone")}))}var cv=Ol({props({props:e}){const t=e.locale||"en-US",n=e.timeZone||"UTC",s=e.selectionMode||"single",r=e.numOfMonths||1;let o;if(e.createCalendar){const g=new Intl.DateTimeFormat(t).resolvedOptions().calendar;g!=="gregory"&&g!=="iso8601"&&(o=e.createCalendar(g))}const i=h=>!o||h.calendar.identifier===o.identifier?h:le(h,o),a=e.defaultValue?Es(e.defaultValue).map(h=>Ie(i(h),e.min,e.max)):void 0,c=e.value?Es(e.value).map(h=>Ie(i(h),e.min,e.max)):void 0;let l=e.focusedValue||e.defaultFocusedValue||c?.[0]||a?.[0]||Un(n,o);l=Ie(i(l),e.min,e.max);const p=e.minView||"day",u=e.maxView||"year",f=Jo(e.defaultView||e.view||p,p,u);return{locale:t,numOfMonths:r,timeZone:n,selectionMode:s,minView:p,maxView:u,outsideDaySelectable:!1,closeOnSelect:!0,format(h,{locale:g,timeZone:d}){return new Te(g,{timeZone:d,day:"2-digit",month:"2-digit",year:"numeric",calendar:o?.identifier}).format(h.toDate(d))},parse(h,{locale:g,timeZone:d}){return Vm(h,g,d)},...e,focusedValue:typeof e.focusedValue>"u"?void 0:l,defaultFocusedValue:l,value:c,defaultValue:a??[],defaultView:f,positioning:{placement:"bottom",...e.positioning}}},initialState({prop:e}){return e("inline")||(e("open")??e("defaultOpen"))?"open":"idle"},refs(){return{announcer:void 0}},context({prop:e,bindable:t,getContext:n}){return{focusedValue:t(()=>({defaultValue:e("defaultFocusedValue"),value:e("focusedValue"),isEqual:Et,hash:s=>s.toString(),sync:!0,onChange(s){const r=n(),o=r.get("view"),i=r.get("value"),a=xs(i,e);e("onFocusChange")?.({value:i,valueAsString:a,view:o,focusedValue:s})}})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:lv,hash:s=>s.map(r=>r?.toString()??"").join(","),onChange(s){const r=n(),o=xs(s,e);e("onValueChange")?.({value:s,valueAsString:o,view:r.get("view")})}})),inputValue:t(()=>({defaultValue:""})),activeIndex:t(()=>({defaultValue:0,sync:!0})),hoveredValue:t(()=>({defaultValue:null,isEqual:Et})),view:t(()=>({defaultValue:e("defaultView"),value:e("view"),onChange(s){e("onViewChange")?.({view:s})}})),startValue:t(()=>{const s=e("focusedValue")||e("defaultFocusedValue");return{defaultValue:ba(s,"start",{months:e("numOfMonths")},e("locale")),isEqual:Et,hash:r=>r.toString()}}),currentPlacement:t(()=>({defaultValue:void 0})),restoreFocus:t(()=>({defaultValue:!1}))}},computed:{isInteractive:({prop:e})=>!e("disabled")&&!e("readOnly"),visibleDuration:({prop:e})=>({months:e("numOfMonths")}),endValue:({context:e,computed:t})=>cc(e.get("startValue"),t("visibleDuration")),visibleRange:({context:e,computed:t})=>({start:e.get("startValue"),end:t("endValue")}),visibleRangeText:({context:e,prop:t,computed:n})=>tv({view:e.get("view"),startValue:e.get("startValue"),endValue:n("endValue"),locale:t("locale"),timeZone:t("timeZone"),selectionMode:t("selectionMode")}),isPrevVisibleRangeValid:({context:e,prop:t})=>!pm(e.get("startValue"),t("min"),t("max")),isNextVisibleRangeValid:({prop:e,computed:t})=>!gm(t("endValue"),e("min"),e("max")),valueAsString:({context:e,prop:t})=>xs(e.get("value"),t)},effects:["setupLiveRegion"],watch({track:e,prop:t,context:n,action:s,computed:r}){e([()=>t("locale")],()=>{s(["setStartValue","syncInputElement"])}),e([()=>n.hash("focusedValue")],()=>{s(["setStartValue","focusActiveCellIfNeeded","setHoveredValueIfKeyboard"])}),e([()=>n.hash("startValue")],()=>{s(["syncMonthSelectElement","syncYearSelectElement","invokeOnVisibleRangeChange"])}),e([()=>n.get("inputValue")],()=>{s(["syncInputValue"])}),e([()=>n.hash("value")],()=>{s(["syncInputElement"])}),e([()=>r("valueAsString").toString()],()=>{s(["announceValueText"])}),e([()=>n.get("view")],()=>{s(["focusActiveCell"])}),e([()=>t("open")],()=>{s(["toggleVisibility"])})},on:{"VALUE.SET":{actions:["setDateValue","setFocusedDate"]},"VIEW.SET":{actions:["setView"]},"FOCUS.SET":{actions:["setFocusedDate"]},"VALUE.CLEAR":{actions:["clearDateValue","clearFocusedDate","setActiveIndexToStart","clearHoveredDate","focusFirstInputElement"]},"INPUT.CHANGE":[{guard:"isInputValueEmpty",actions:["setInputValue","clearDateValue","clearFocusedDate"]},{actions:["setInputValue","focusParsedDate"]}],"INPUT.ENTER":{actions:["focusParsedDate","selectFocusedDate"]},"INPUT.FOCUS":{actions:["setActiveIndex"]},"INPUT.BLUR":[{guard:"shouldFixOnBlur",actions:["setActiveIndexToStart","selectParsedDate"]},{actions:["setActiveIndexToStart"]}],"PRESET.CLICK":[{guard:"isOpenControlled",actions:["setDateValue","setFocusedDate","invokeOnClose"]},{target:"focused",actions:["setDateValue","setFocusedDate","focusInputElement"]}],"GOTO.NEXT":[{guard:"isYearView",actions:["focusNextDecade","announceVisibleRange"]},{guard:"isMonthView",actions:["focusNextYear","announceVisibleRange"]},{actions:["focusNextPage"]}],"GOTO.PREV":[{guard:"isYearView",actions:["focusPreviousDecade","announceVisibleRange"]},{guard:"isMonthView",actions:["focusPreviousYear","announceVisibleRange"]},{actions:["focusPreviousPage"]}]},states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell"]},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}]}},focused:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell"]},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}]}},open:{tags:["open"],entry:["resumeRangeSelection"],effects:["trackDismissableElement","trackPositioning"],exit:["clearHoveredDate"],on:{"CONTROLLED.CLOSE":[{guard:ge("shouldRestoreFocus","isInteractOutsideEvent"),target:"focused",actions:["restoreFocusToTrigger"]},{guard:"shouldRestoreFocus",target:"focused",actions:["restoreFocusToInput"]},{target:"idle"}],"CELL.CLICK":[{guard:"isAboveMinView",actions:["setFocusedValueForView","setPreviousView"]},{guard:ge("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","resetSelection","setActiveIndexToEnd"]},{guard:ge("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","setRestoreFocus"]},{guard:ge("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","restoreFocusToInput"]},{guard:ge("isRangePicker","isSelectingEndDate"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setFocusedDate","setSelectedDate","setActiveIndexToEnd"]},{guard:ge("isMultiPicker","canSelectDate"),actions:["setFocusedDate","toggleSelectedDate"]},{guard:"isMultiPicker",actions:["setFocusedDate"]},{guard:ge("closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["setFocusedDate","setSelectedDate","invokeOnClose","restoreFocusToInput"]},{actions:["setFocusedDate","setSelectedDate"]}],"CELL.POINTER_MOVE":[{guard:ge("isRangePicker","isSelectingEndDate","isDayPointerMoveOutsideVisibleMonth"),actions:["setHoveredDate"]},{guard:ge("isRangePicker","isSelectingEndDate"),actions:["setHoveredDate","setFocusedDate"]}],"TABLE.POINTER_LEAVE":{guard:"isRangePicker",actions:["clearHoveredDate"]},"TABLE.POINTER_DOWN":{actions:["disableTextSelection"]},"TABLE.POINTER_UP":{actions:["enableTextSelection"]},"TABLE.ESCAPE":[{guard:"isOpenControlled",actions:["focusFirstSelectedDate","invokeOnClose"]},{target:"focused",actions:["focusFirstSelectedDate","invokeOnClose","restoreFocusToTrigger"]}],"TABLE.ENTER":[{guard:"isAboveMinView",actions:["setPreviousView"]},{guard:ge("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","resetSelection","setActiveIndexToEnd","focusNextDay"]},{guard:ge("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose"]},{guard:ge("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","restoreFocusToInput"]},{guard:ge("isRangePicker","isSelectingEndDate"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setSelectedDate","setActiveIndexToEnd","focusNextDay"]},{guard:ge("isMultiPicker","canSelectDate"),actions:["toggleSelectedDate"]},{guard:"isMultiPicker"},{guard:ge("closeOnSelect","isOpenControlled"),actions:["selectFocusedDate","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectFocusedDate","invokeOnClose","restoreFocusToInput"]},{actions:["selectFocusedDate"]}],"TABLE.ARROW_RIGHT":[{guard:"isMonthView",actions:["focusNextMonth"]},{guard:"isYearView",actions:["focusNextYear"]},{actions:["focusNextDay","setHoveredDate"]}],"TABLE.ARROW_LEFT":[{guard:"isMonthView",actions:["focusPreviousMonth"]},{guard:"isYearView",actions:["focusPreviousYear"]},{actions:["focusPreviousDay"]}],"TABLE.ARROW_UP":[{guard:"isMonthView",actions:["focusPreviousMonthColumn"]},{guard:"isYearView",actions:["focusPreviousYearColumn"]},{actions:["focusPreviousWeek"]}],"TABLE.ARROW_DOWN":[{guard:"isMonthView",actions:["focusNextMonthColumn"]},{guard:"isYearView",actions:["focusNextYearColumn"]},{actions:["focusNextWeek"]}],"TABLE.PAGE_UP":{actions:["focusPreviousSection"]},"TABLE.PAGE_DOWN":{actions:["focusNextSection"]},"TABLE.HOME":[{guard:"isMonthView",actions:["focusFirstMonth"]},{guard:"isYearView",actions:["focusFirstYear"]},{actions:["focusSectionStart"]}],"TABLE.END":[{guard:"isMonthView",actions:["focusLastMonth"]},{guard:"isYearView",actions:["focusLastYear"]},{actions:["focusSectionEnd"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose"]}],"VIEW.TOGGLE":{actions:["setNextView"]},INTERACT_OUTSIDE:[{guard:"isOpenControlled",actions:["setActiveIndexToStart","invokeOnClose"]},{guard:"shouldRestoreFocus",target:"focused",actions:["setActiveIndexToStart","invokeOnClose","restoreFocusToTrigger"]},{target:"idle",actions:["setActiveIndexToStart","invokeOnClose"]}],CLOSE:[{guard:"isOpenControlled",actions:["setActiveIndexToStart","invokeOnClose"]},{target:"idle",actions:["setActiveIndexToStart","invokeOnClose"]}]}}},implementations:{guards:{isAboveMinView:({context:e,prop:t})=>Zm(e.get("view"),t("minView")),isDayView:({context:e,event:t})=>(t.view||e.get("view"))==="day",isMonthView:({context:e,event:t})=>(t.view||e.get("view"))==="month",isYearView:({context:e,event:t})=>(t.view||e.get("view"))==="year",isRangePicker:({prop:e})=>e("selectionMode")==="range",hasSelectedRange:({context:e})=>e.get("value").length===2,isMultiPicker:({prop:e})=>e("selectionMode")==="multiple",canSelectDate:e=>{const{context:t,prop:n,event:s}=e,r=n("maxSelectedDates");if(r==null)return!0;const o=t.get("value"),i=Bn(e,s.value??t.get("focusedValue"));return o.some(c=>Et(c,i))?!0:o.length<r},shouldRestoreFocus:({context:e})=>!!e.get("restoreFocus"),isSelectingEndDate:({context:e})=>e.get("activeIndex")===1,closeOnSelect:({prop:e})=>!!e("closeOnSelect"),isOpenControlled:({prop:e})=>e("open")!=null||!!e("inline"),isInteractOutsideEvent:({event:e})=>e.previousEvent?.type==="INTERACT_OUTSIDE",isInputValueEmpty:({event:e})=>e.value.trim()==="",shouldFixOnBlur:({event:e})=>!!e.fixOnBlur,isDayPointerMoveOutsideVisibleMonth:({event:e})=>e.cell==="day"&&e.outsideRange===!0},effects:{trackPositioning({context:e,prop:t,scope:n}){if(t("inline"))return;e.get("currentPlacement")||e.set("currentPlacement",t("positioning").placement);const s=$c(n);return ro(s,()=>Aa(n),{...t("positioning"),defer:!0,onComplete(o){e.set("currentPlacement",o.placement)}})},setupLiveRegion({scope:e,refs:t}){const n=e.getDoc();return t.set("announcer",av({level:"assertive",document:n})),()=>t.get("announcer")?.destroy?.()},trackDismissableElement({scope:e,send:t,context:n,prop:s}){return s("inline")?void 0:Dl(()=>Xt(e),{type:"popover",defer:!0,getRootNode:e.getRootNode,layerStyleTargets:[()=>Aa(e)],exclude:[..._n(e),Ds(e),Ym(e)],onInteractOutside(o){n.set("restoreFocus",!o.detail.focusable)},onDismiss(){t({type:"INTERACT_OUTSIDE"})},onEscapeKeyDown(o){o.preventDefault(),t({type:"TABLE.ESCAPE",src:"dismissable",focusVisible:!0})}})}},actions:{setNextView({context:e,prop:t}){const n=Ic(e.get("view"),t("minView"),t("maxView"));e.set("view",n)},setPreviousView({context:e,prop:t}){const n=Xm(e.get("view"),t("minView"),t("maxView"));e.set("view",n)},setView({context:e,event:t}){e.set("view",t.view)},setRestoreFocus({context:e}){e.set("restoreFocus",!0)},announceValueText({context:e,prop:t,refs:n}){const s=e.get("value"),r=t("locale"),o=t("timeZone");let i;if(t("selectionMode")==="range"){const[a,c]=s;a&&c?i=ws(a,c,r,o):a?i=ws(a,null,r,o):c?i=ws(c,null,r,o):i=""}else i=s.map(a=>ws(a,null,r,o)).filter(Boolean).join(",");n.get("announcer")?.announce(i,3e3)},announceVisibleRange({computed:e,refs:t}){const{formatted:n}=e("visibleRangeText");t.get("announcer")?.announce(n)},disableTextSelection({scope:e}){sf({target:Xt(e),doc:e.getDoc()})},enableTextSelection({scope:e}){ll({doc:e.getDoc(),target:Xt(e)})},focusFirstSelectedDate(e){const{context:t}=e;t.get("value").length&&te(e,t.get("value")[0])},syncInputElement({scope:e,computed:t}){ue(()=>{_n(e).forEach((s,r)=>{cs(s,t("valueAsString")[r]||"")})})},setFocusedDate(e){const{event:t}=e,n=Array.isArray(t.value)?t.value[0]:t.value;te(e,n)},setFocusedValueForView(e){const{context:t,event:n}=e;te(e,t.get("focusedValue").set({[t.get("view")]:n.value}))},focusNextMonth(e){const{context:t}=e;te(e,t.get("focusedValue").add({months:1}))},focusPreviousMonth(e){const{context:t}=e;te(e,t.get("focusedValue").subtract({months:1}))},setDateValue({context:e,event:t,prop:n}){if(!Array.isArray(t.value))return;const s=t.value.map(r=>Ie(r,n("min"),n("max")));e.set("value",s)},clearDateValue({context:e}){e.set("value",[])},setSelectedDate(e){const{context:t,event:n}=e,s=Array.from(t.get("value")),r=t.get("activeIndex"),o=s[r],i=Bn(e,n.value??t.get("focusedValue"));s[r]=Ss(o,i),t.set("value",Rs(s))},resetSelection(e){const{context:t,event:n}=e,s=t.get("value")[0],r=Bn(e,n.value??t.get("focusedValue"));t.set("value",[Ss(s,r)])},toggleSelectedDate(e){const{context:t,event:n}=e,s=Bn(e,n.value??t.get("focusedValue")),r=t.get("value"),o=r.findIndex(i=>Et(i,s));if(o===-1){const i=[...r,s];t.set("value",Es(i))}else{const i=Array.from(r);i.splice(o,1),t.set("value",Es(i))}},setHoveredDate({context:e,event:t}){e.set("hoveredValue",t.value)},clearHoveredDate({context:e}){e.set("hoveredValue",null)},selectFocusedDate({context:e,computed:t}){const n=Array.from(e.get("value")),s=e.get("activeIndex"),r=n[s],o=e.get("focusedValue").copy();n[s]=Ss(r,o),e.set("value",Rs(n));const i=t("valueAsString");e.set("inputValue",i[s])},focusPreviousDay(e){const{context:t}=e,n=t.get("focusedValue").subtract({days:1});te(e,n)},focusNextDay(e){const{context:t}=e,n=t.get("focusedValue").add({days:1});te(e,n)},focusPreviousWeek(e){const{context:t}=e,n=t.get("focusedValue").subtract({weeks:1});te(e,n)},focusNextWeek(e){const{context:t}=e,n=t.get("focusedValue").add({weeks:1});te(e,n)},focusNextPage(e){const{context:t,computed:n,prop:s}=e,r=gc(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),s("locale"),s("min"),s("max"));$s(e,r)},focusPreviousPage(e){const{context:t,computed:n,prop:s}=e,r=mc(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),s("locale"),s("min"),s("max"));$s(e,r)},focusSectionStart(e){const{context:t}=e;te(e,t.get("startValue").copy())},focusSectionEnd(e){const{computed:t}=e;te(e,t("endValue").copy())},focusNextSection(e){const{context:t,event:n,computed:s,prop:r}=e,o=km(t.get("focusedValue"),t.get("startValue"),n.larger,s("visibleDuration"),r("locale"),r("min"),r("max"));o&&$s(e,o)},focusPreviousSection(e){const{context:t,event:n,computed:s,prop:r}=e,o=Am(t.get("focusedValue"),t.get("startValue"),n.larger,s("visibleDuration"),r("locale"),r("min"),r("max"));o&&$s(e,o)},focusNextYear(e){const{context:t}=e,n=t.get("focusedValue").add({years:1});te(e,n)},focusPreviousYear(e){const{context:t}=e,n=t.get("focusedValue").subtract({years:1});te(e,n)},focusNextDecade(e){const{context:t}=e,n=t.get("focusedValue").add({years:10});te(e,n)},focusPreviousDecade(e){const{context:t}=e,n=t.get("focusedValue").subtract({years:10});te(e,n)},clearFocusedDate(e){const{context:t,prop:n}=e,s=t.get("focusedValue").calendar;te(e,Un(n("timeZone"),s))},focusPreviousMonthColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").subtract({months:n.columns});te(e,s)},focusNextMonthColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").add({months:n.columns});te(e,s)},focusPreviousYearColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").subtract({years:n.columns});te(e,s)},focusNextYearColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").add({years:n.columns});te(e,s)},focusFirstMonth(e){const{context:t}=e,n=t.get("focusedValue"),s=n.calendar.getMinimumMonthInYear?.(n)??1;te(e,n.set({month:s}))},focusLastMonth(e){const{context:t}=e,n=t.get("focusedValue"),s=n.calendar.getMonthsInYear(n);te(e,n.set({month:s}))},focusFirstYear(e){const{context:t}=e,n=sn(t.get("focusedValue").year),s=t.get("focusedValue").set({year:n[0]});te(e,s)},focusLastYear(e){const{context:t}=e,n=sn(t.get("focusedValue").year),s=t.get("focusedValue").set({year:n[n.length-1]});te(e,s)},setActiveIndex({context:e,event:t}){e.set("activeIndex",t.index)},setActiveIndexToEnd({context:e}){e.set("activeIndex",1)},setActiveIndexToStart({context:e}){e.set("activeIndex",0)},resumeRangeSelection({context:e,prop:t}){t("selectionMode")==="range"&&e.get("value").length===1&&e.set("activeIndex",1)},focusActiveCell({scope:e,context:t,event:n}){n.src!=="input.click"&&ue(()=>{const s=t.get("view");ka(e,s)?.focus({preventScroll:!0})})},focusActiveCellIfNeeded({scope:e,context:t,event:n}){n.focus&&ue(()=>{const s=t.get("view");ka(e,s)?.focus({preventScroll:!0})})},setHoveredValueIfKeyboard({context:e,event:t,prop:n}){!(t.type.startsWith("TABLE.ARROW")||["TABLE.ENTER","TABLE.HOME","TABLE.END","TABLE.PAGE_UP","TABLE.PAGE_DOWN"].includes(t.type))||n("selectionMode")!=="range"||e.get("activeIndex")===0||e.set("hoveredValue",e.get("focusedValue").copy())},restoreFocusToTrigger({scope:e,event:t}){const n=Xt(e),s=dv(t);ue(()=>{Ii(e.getActiveElement(),[n])||Ds(e)?.focus(s)})},focusFirstInputElement({scope:e,event:t}){t.focus!==!1&&ue(()=>{const[n]=_n(e);(n??Ds(e))?.focus({preventScroll:!0})})},focusInputElement({scope:e}){ue(()=>Oa(e))},restoreFocusToInput({scope:e}){const t=Xt(e);ue(()=>{Ii(e.getActiveElement(),[t])||Oa(e)})},syncMonthSelectElement({scope:e,context:t}){const n=Gm(e);cs(n,t.get("startValue").month.toString())},syncYearSelectElement({scope:e,context:t}){const n=qm(e);cs(n,t.get("startValue").year.toString())},setInputValue({context:e,event:t}){e.get("activeIndex")===t.index&&e.set("inputValue",t.value)},syncInputValue({scope:e,context:t,event:n}){queueMicrotask(()=>{const s=_n(e),r=n.index??t.get("activeIndex");cs(s[r],t.get("inputValue"))})},focusParsedDate(e){const{event:t,prop:n}=e;if(t.index==null)return;const r=n("parse")(t.value,{locale:n("locale"),timeZone:n("timeZone")});!r||!La(r)||te(e,r)},selectParsedDate({context:e,event:t,prop:n}){if(t.index==null)return;let r=n("parse")(t.value,{locale:n("locale"),timeZone:n("timeZone")});if((!r||!La(r))&&t.value&&(r=e.get("focusedValue").copy()),!r)return;r=Ie(r,n("min"),n("max"));const o=Array.from(e.get("value"));o[t.index]=Ss(o[t.index],r);const i=Rs(o);e.set("value",i);const a=xs(i,n);e.set("inputValue",a[t.index])},resetView({context:e}){e.set("view",e.initial("view"))},setStartValue({context:e,computed:t,prop:n}){const s=e.get("focusedValue");if(!He(s,e.get("startValue"),t("endValue")))return;const o=ba(s,"start",{months:n("numOfMonths")},n("locale"));e.set("startValue",o)},invokeOnOpen({prop:e,context:t}){e("inline")||e("onOpenChange")?.({open:!0,value:t.get("value")})},invokeOnClose({prop:e,context:t}){e("inline")||e("onOpenChange")?.({open:!1,value:t.get("value")})},invokeOnVisibleRangeChange({prop:e,context:t,computed:n}){e("onVisibleRangeChange")?.({view:t.get("view"),visibleRange:n("visibleRange")})},toggleVisibility({event:e,send:t,prop:n}){t({type:n("open")?"CONTROLLED.OPEN":"CONTROLLED.CLOSE",previousEvent:e})}}}}),Bn=(e,t)=>{const{context:n,prop:s}=e,r=n.get("view");let o=typeof t=="number"?n.get("focusedValue").set({[r]:t}):t;return ev(i=>{Jm(i,s("minView"))&&(o=o.set({[i]:i==="day"?1:0}))}),o},Ss=(e,t)=>{if(!e||!("hour"in e))return t;const n="timeZone"in e;let s=t;return"hour"in t||(n?s=ec(ke(t),e.timeZone):s=ke(t)),s.set({hour:e.hour,minute:e.minute,second:e.second,millisecond:e.millisecond})};function te(e,t){const{context:n,prop:s,computed:r}=e;if(!t)return;const o=Bn(e,t);if(Et(n.get("focusedValue"),o))return;const a=es(r("visibleDuration"),s("locale"),s("min"),s("max"))({focusedDate:o,startDate:n.get("startValue")});n.set("startValue",a.startDate),n.set("focusedValue",a.focusedDate)}function $s(e,t){const{context:n}=e;n.set("startValue",t.startDate);const s=n.get("focusedValue");Et(s,t.focusedDate)||n.set("focusedValue",t.focusedDate)}function dv(e){return e.focusVisible??e.previousEvent?.focusVisible?{preventScroll:!0,focusVisible:!0}:{preventScroll:!0}}function Tc(e){return Array.isArray(e)?e.map(t=>Tc(t)):e instanceof Date?new Re(e.getFullYear(),e.getMonth()+1,e.getDate()):om(e)}const Wr=e=>`<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="${e==="left"?"m10 4-4 4 4 4":"m6 4 4 4-4 4"}"/></svg>`,Ur=e=>{try{return/^\d{4}-\d{2}-\d{2}$/.test(e)?Tc(e):void 0}catch{return}};function uv(e,t,n){e.innerHTML=`<div class="date-control"><button class="icon-button date-trigger" type="button" aria-label="Custom date range" title="Custom date range"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><rect x="3" y="5" width="18" height="16" rx="3"/><path d="M7 3v4m10-4v4M3 11h18m-12 5h4"/></svg></button></div>
91
+ <div class="date-positioner" popover="manual"><section class="date-popover">
92
+ <header class="date-heading"><div><span class="eyebrow">FOCUS YOUR TIMELINE</span><h2>Date range</h2></div><button type="button" class="icon-button date-close" aria-label="Close date range">×</button></header>
93
+ <div class="date-fields"><label>From<input id="from-date" aria-label="From date" autocomplete="off" spellcheck="false" placeholder="YYYY-MM-DD"/></label><span aria-hidden="true">→</span><label>To<input id="to-date" aria-label="To date" autocomplete="off" spellcheck="false" placeholder="YYYY-MM-DD"/></label></div>
94
+ <div class="date-presets"><button type="button" data-preset="last7Days">Last 7 days</button><button type="button" data-preset="last30Days">Last 30 days</button><button type="button" data-preset="thisMonth">This month</button></div>
95
+ <div class="date-calendar"><div class="date-navigation"><button type="button" class="icon-button date-prev">${Wr("left")}</button><button type="button" class="date-view"></button><button type="button" class="icon-button date-next">${Wr("right")}</button></div><div class="date-grids"></div></div>
96
+ <footer class="date-footer"><span class="date-status" role="status"></span><button id="apply-dates" class="primary-button" type="button">Apply range ${Wr("right")}</button></footer>
97
+ </section></div>`;const s=d=>e.querySelector(d),r=s(".date-trigger"),o=s(".date-positioner"),i=s(".date-popover"),a=[s("#from-date"),s("#to-date")],c=s("#apply-dates"),l=new Nl(cv,{id:"timeline-dates",selectionMode:"range",closeOnSelect:!1,fixedWeeks:!0,outsideDaySelectable:!0,locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,format:d=>d.toString(),parse:Ur,placeholder:"YYYY-MM-DD",positioning:{placement:"top-end",strategy:"fixed",gutter:12,slide:!0},onOpenChange({open:d}){d&&n()}}),p=()=>nv(l.service,Rl),u=["day","month","year"].map(d=>{const m=document.createElement("table");m.dataset.calendarView=d;const y=m.createTHead(),b=y.insertRow();if(d==="day")for(let C=0;C<7;C++)b.append(document.createElement("th"));const T=m.createTBody(),M=d==="day"?6:4,x=d==="day"?7:3;for(let C=0;C<M;C++){const w=T.insertRow();for(let $=0;$<x;$++){const R=document.createElement("button");R.type="button",w.insertCell().append(R)}}return s(".date-grids").append(m),{view:d,table:m,head:y,body:T}});function f(){const d=a.map(b=>Ur(b.value)),m=!!(d[0]&&d[1]&&d[0].compare(d[1])<=0);c.disabled=!m;for(const[b,T]of a.entries())T.setAttribute("aria-invalid",String(!!T.value&&!d[b]));const y=m?"Both dates included":"Choose a start and end date";s(".date-status").textContent!==y&&(s(".date-status").textContent=y)}function h(){const d=p();ne(e,d.getRootProps()),ne(s(".date-control"),d.getControlProps()),ne(r,{...d.getTriggerProps(),"aria-label":"Custom date range"}),ne(o,d.getPositionerProps()),ne(i,{...d.getContentProps(),"aria-label":"Custom date range"}),a.forEach((b,T)=>ne(b,{...d.getInputProps({index:T}),"aria-label":T?"To date":"From date"})),ne(s(".date-prev"),d.getPrevTriggerProps({view:d.view})),ne(s(".date-next"),d.getNextTriggerProps({view:d.view}));const m=d.view==="day"?d.visibleRangeText.start:d.view==="month"?String(d.visibleRange.start.year):`${d.getDecade().start} – ${d.getDecade().end}`,y=s(".date-view");ne(y,d.getViewTriggerProps({view:d.view})),y.textContent!==m&&(y.textContent=m);for(const{view:b,table:T,head:M,body:x}of u){T.hidden=d.view!==b,ne(T,d.getTableProps({view:b,columns:b==="day"?7:3})),ne(M,d.getTableHeaderProps({view:b})),ne(x,d.getTableBodyProps({view:b})),b==="day"&&d.weekDays.forEach((w,$)=>{const R=M.rows[0].cells[$];R.scope="col",R.setAttribute("aria-label",w.long),R.textContent!==w.short&&(R.textContent=w.short)});const C=b==="day"?d.weeks:b==="month"?d.getMonthsGrid({columns:3,format:"short"}):d.getYearsGrid({columns:3});Array.from(x.rows).forEach((w,$)=>{ne(w,d.getTableRowProps({view:b})),Array.from(w.cells).forEach((R,L)=>{const E=C[$]?.[L],O=R.firstElementChild;if(R.hidden=!E,!!E)if(b==="day"){const D=d.weeks[$][L];ne(R,d.getDayTableCellProps({value:D})),ne(O,d.getDayTableCellTriggerProps({value:D})),O.textContent!==String(D.day)&&(O.textContent=String(D.day))}else{const D=E;ne(R,b==="month"?d.getMonthTableCellProps({...D,columns:3}):d.getYearTableCellProps({...D,columns:3})),ne(O,b==="month"?d.getMonthTableCellTriggerProps({...D}):d.getYearTableCellTriggerProps({...D})),O.textContent!==D.label&&(O.textContent=D.label)}})})}o.hidden=!d.open,d.open&&!o.matches(":popover-open")&&o.showPopover?.(),!d.open&&o.matches(":popover-open")&&o.hidePopover?.(),r.classList.toggle("active",d.open),f()}s(".date-close").addEventListener("click",()=>p().setOpen(!1));for(const d of e.querySelectorAll("[data-preset]"))d.addEventListener("click",()=>{const m=p(),y=m.getRangePresetValue(d.dataset.preset);m.setValue(y),m.setFocusedValue(y[0]),m.setView("day")});c.addEventListener("click",()=>{f(),c.disabled||(t(a[0].value,a[1].value),p().setOpen(!1))}),i.addEventListener("input",f),e.addEventListener("keydown",d=>d.stopPropagation());const g=l.subscribe(h);return l.start(),h(),{setRange(d,m){const y=[d,m].map(Ur).filter(b=>b!==void 0);p().setValue(y),y[0]&&p().setFocusedValue(y[0])},dispose(){g(),l.stop(),e.replaceChildren()}}}const fv={Search:fd,GitFork:ed,GitBranch:Qc,Folder:Xc,ArrowUpRight:Wc,ArrowRight:jc,X:vd,Box:Uc,RotateCcw:ud,RefreshCw:dd,Play:cd,Pause:ld,ChevronDown:qc,FileCode2:Jc,Terminal:gd,Copy:Kc,Crosshair:zc,CircleHelp:Gc,SlidersHorizontal:pd,LoaderCircle:nd,Network:rd,Clock:Yc,Sparkles:Na,Grip:td,PanelRight:id,Settings2:hd,Volume2:Fa,VolumeX:md},Ae=()=>{yd({icons:fv,attrs:{"stroke-width":1.5}}),Yn()},F=(e,t="")=>`<i data-lucide="${e}" class="${t}" aria-hidden="true"></i>`,A=e=>document.querySelector(e),K=e=>e.replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t]),hv=e=>Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}).format(e),Be=e=>e.toLocaleString("en"),pv=[new Intl.DateTimeFormat("en",{month:"short",day:"numeric"}),new Intl.DateTimeFormat("en",{month:"short",day:"numeric",year:"numeric"})],gv=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}),mv=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}),fn=(e,t=!1)=>pv[Number(t)].format(e),hn=e=>gv.format(e),Ma=e=>{const t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`};let X,re={nodes:[],edges:[],lanes:[],start:0,end:0},Me=[],Xo=[],Cc=new Set,Ps=new Map,Zn=new Map,Qo=new Map,ee,kc=!0,Is,j=new URLSearchParams(location.search).get("session"),we,De,Vs=0,pt="",ot="",je="",it=0,at="",lt="",pn=!0,jt=!1,rn=60,Ns=0,wo,Eo,ei=0,gn=!1,me=1,xo=0;const vv=3e4;let Y={...cr},Wt=!0,pr,ct,Jn=!1,So="";try{Y=Fl(localStorage)}catch{Wt=!1}const Zs=matchMedia("(prefers-reduced-motion: reduce)");A("#app").innerHTML=`
98
+ <main class="map" aria-label="Session map">
99
+ <h1 class="sr-only">SessionGraph — Explore &amp; visualize all your LLM sessions</h1>
100
+ <div id="scene"></div>
101
+ <div class="canvas-vignette"></div>
102
+ <div id="graph-message" class="graph-message"><div class="loading-orbit"><span></span><span></span><span></span></div><h3>Loading sessions…</h3></div>
103
+ <div id="tooltip" class="node-tooltip" hidden></div>
104
+ </main>
105
+ <header class="app-header glass">
106
+ <a class="brand" href="/" aria-label="SessionGraph home" title="Explore &amp; visualize all your LLM sessions"><img src="/favicon.svg" alt=""/><span>SessionGraph<span class="brand-dot">.</span></span></a>
107
+ <span class="connection" role="status" title="Connecting"><span class="status-dot"></span><span id="connection-label" class="sr-only">Connecting</span></span>
108
+ <span class="toolbar-divider"></span>
109
+ <button class="toolbar-button" id="toggle-explorer" aria-label="Toggle sessions" aria-controls="explorer" aria-expanded="true" title="Sessions">${F("search")}<span>Sessions</span></button>
110
+ </header>
111
+ <nav class="map-controls glass" aria-label="Map controls">
112
+ <div class="view-switch" role="group" aria-label="View mode"><button id="view-3d" class="active" aria-pressed="true">3D</button><button id="view-2d" aria-pressed="false">2D</button></div>
113
+ <span class="toolbar-divider"></span>
114
+ <button class="icon-button" id="reset-camera" aria-label="Fit view" title="Fit view (F)">${F("crosshair")}</button>
115
+ <button class="icon-button" id="toggle-timeline" aria-label="Toggle timeline" aria-controls="timeline" aria-expanded="true" title="Timeline">${F("clock")}</button>
116
+ <button class="icon-button" id="toggle-inspector" aria-label="Toggle session details" aria-controls="inspector" aria-expanded="false" title="Session details" hidden>${F("panel-right")}</button>
117
+ <button class="icon-button" id="help" aria-label="Help" title="Help">${F("circle-help")}</button>
118
+ <button class="icon-button" id="mute-audio" aria-label="Mute sound" title="Mute sound" aria-pressed="false" data-sound="none">${F("volume-2")}</button>
119
+ <button class="icon-button" id="open-settings" aria-label="Settings" title="Settings" aria-haspopup="dialog">${F("settings-2")}</button>
120
+ </nav>
121
+ <aside class="sidebar floating-panel glass" id="explorer" aria-label="Sessions">
122
+ <div class="panel-heading"><button class="panel-handle" data-drag-panel="explorer" aria-label="Move sessions panel" title="Drag to move · Arrow keys to reposition">${F("grip")}<span>Sessions</span><span class="small-badge" id="list-count">—</span></button><button class="icon-button" id="refresh" aria-label="Refresh sessions" title="Refresh sessions">${F("refresh-cw")}</button><button class="icon-button" id="close-explorer" aria-label="Close sessions">${F("x")}</button></div>
123
+ <button class="search-box search-trigger" id="search" aria-label="Search all sessions">${F("search")}<span>Search everything…</span><kbd>/</kbd></button>
124
+ <div class="filters">
125
+ <div class="filter-row"><div class="select-wrap"><span id="source-filter-icon">${dt()}</span><select id="source" aria-label="Session source"><option value="">All sources</option></select>${F("chevron-down")}</div><button class="icon-button" id="manage-sources" aria-label="Manage sources" title="Import sources">${F("sliders-horizontal")}</button></div>
126
+ <div class="select-wrap">${F("folder")}<select id="project" aria-label="Project"><option value="">All projects</option></select>${F("chevron-down")}</div>
127
+ <div class="select-wrap">${F("git-branch")}<select id="directory" aria-label="Worktree or directory"><option value="">All directories</option></select>${F("chevron-down")}</div>
128
+ <div class="filter-toggles"><label><input type="checkbox" id="children" checked/><span>Child sessions</span></label></div>
129
+ </div>
130
+ <nav class="session-list" id="session-list" aria-label="Sessions"><div class="list-loading">${[0,1,2,3,4].map(()=>'<div class="skeleton"></div>').join("")}</div></nav>
131
+ </aside>
132
+ <div class="inspector-stack floating-panel" id="inspector" hidden><aside class="inspector glass" id="session-inspector" aria-label="Session details"></aside></div>
133
+ <section class="timeline-panel floating-panel glass" id="timeline" aria-label="Timeline controls">
134
+ <div class="timeline-top"><button class="panel-handle" data-drag-panel="timeline" aria-label="Move timeline panel" title="Drag to move · Arrow keys to reposition">${F("grip")}<span id="date-label">Timeline</span></button><div class="range-buttons" role="group" aria-label="Date range"><button data-days="7">7D</button><button data-days="30">30D</button><button data-days="90">90D</button><button data-days="0" class="active">All</button></div><div class="custom-dates"></div><button class="icon-button" id="close-timeline" aria-label="Close timeline">${F("x")}</button></div>
135
+ <div class="timeline-track"><button id="play" class="play-button" aria-label="Play timeline">${F("play")}</button><div class="histogram-wrap"><div id="histogram" class="histogram"></div><input id="scrubber" type="range" min="0" max="1000" value="1000" aria-label="Timeline playback position"/><div class="timeline-cursor" id="timeline-cursor"></div></div><div class="playback-date" id="playback-date">—</div></div>
136
+ </section>
137
+ <dialog id="help-dialog" aria-labelledby="help-title"><button class="icon-button dialog-close" id="close-help" aria-label="Close help">${F("x")}</button><h2 id="help-title">Explore the map</h2><div class="help-rows"><div><span>Orbit</span><kbd>Drag</kbd></div><div><span>Zoom</span><kbd>Scroll / pinch</kbd></div><div><span>Pan</span><kbd>Right-drag</kbd></div><div><span>Fit view</span><kbd>F</kbd></div><div><span>Search everything</span><kbd>/ · ⌘/Ctrl K</kbd></div><div><span>Hide / restore panels</span><kbd>H</kbd></div><div><span>Clear selection</span><kbd>Esc</kbd></div></div>
138
+ <div class="graph-legend"><span><i class="legend-node"></i>Session orb</span><span><i class="legend-node message"></i>Message</span><span><i class="legend-line lane"></i>Session lifetime</span><span><i class="legend-line fork"></i>Fork</span><span><i class="legend-line child"></i>Child</span><span id="file-legend" hidden><i class="legend-file"></i>File</span></div>
139
+ <p>Time runs left to right. Each orb travels from session creation to its latest saved message, leaving a trail behind. Select it to explore user and assistant messages in matching colors. Messages without timestamps stay readable in the explorer. Click empty space to deselect. Directory colors group sessions; only fork and child links represent ancestry.</p><button class="secondary-button motion-button" id="motion" aria-pressed="true">${F("sparkles")}Animate map</button></dialog>
140
+ <div id="toast" class="toast" role="status" hidden></div>
141
+ <aside class="shortcut-hints" aria-label="Keyboard shortcuts"><span><kbd>/</kbd>Search</span><span><kbd>F</kbd>Fit view</span><span><kbd>H</kbd>Panels</span><span><kbd>Esc</kbd>Clear selection</span></aside>
142
+ `;Ae();wd();Ag();og();const Ac=uv(A(".custom-dates"),(e,t)=>{at=e,lt=t,Pe(!0)},Ee),bn=()=>{const e=!!document.querySelector("dialog[open]");e&&gn&&Ee(),ee?.setSuspended(e)},ti=new Eg,Nt=wg(A("#tooltip"),A("#scene"),ti),gr=bg(A("#inspector"),ti,{select:e=>{Nt.clear(),ee?.selectEvent(e?.id||null),e&&(Ee(),me=1,wn(),ee?.focusEvent(e))}});function ni(e){const t=X?.sessions.find(n=>n.id===j);t&&(Nt.clear(),Ee(),Ce("inspector",!0),gr.open(t,e,e?De?.revision:void 0))}const ts=mg({change:mr,getArchived:()=>jt,changeArchived:e=>{jt=e,Pe()},visibility:bn,previewSound:()=>{Js.play("select")},getSources:()=>gt.sources(),importSources:e=>gt.select(e),resetPanels:()=>{document.querySelectorAll(".floating-panel").forEach(e=>{e.removeAttribute("style"),delete e.dataset.positioned})}}),Js=new vg(Y,ts.audioStatus);function ns(){ee?.applyPreferences(Y),Js.configure(Y),document.documentElement.dataset.density=Y.density,document.documentElement.dataset.motion=String(po(Y,Zs.matches)),document.documentElement.style.setProperty("--panel-opacity",`${Y.panelOpacity}%`),A("#motion").setAttribute("aria-pressed",String(po(Y,Zs.matches)));for(const t of["2d","3d"]){const n=A(`#view-${t}`);n.classList.toggle("active",Y.view===t),n.setAttribute("aria-pressed",String(Y.view===t))}const e=A("#mute-audio");e.setAttribute("aria-pressed",String(Y.muted)),e.setAttribute("aria-label",Y.muted?"Unmute sound":"Mute sound"),e.title=Y.muted?"Unmute sound":"Mute sound",e.innerHTML=F(Y.muted?"volume-x":"volume-2"),ts.render(Y,Wt||Jn,ct?.state||"saved"),Ae()}function mr(e){const t=e.autoImport!==void 0&&e.autoImport!==Y.autoImport;Y=dr({...Y,...e});try{Wt=Hl(localStorage,Y)}catch{Wt=!1}ns(),si({preferences:{...Y},...t?{autoImport:Y.autoImport}:{}})}function si(e){ct?.save(e)}function yv(){return{sourceID:ot,projectID:pt,directory:je,days:it,fromDate:at,toDate:lt,includeChildren:pn,includeArchived:jt}}A("#open-settings").addEventListener("click",ts.open);A("#mute-audio").addEventListener("click",()=>mr({muted:!Y.muted}));const bv=()=>ns();Zs.addEventListener("change",bv);const wv=e=>{if(e.key===jo)try{Y={...Fl(localStorage),autoImport:Y.autoImport},ns()}catch{}};window.addEventListener("storage",wv);ns();ct=new fg(async e=>{if(!(await fetch("/api/sessiongraph/settings",{method:"POST",headers:{"Content-Type":"application/json","X-SessionGraph-Action":"settings"},body:JSON.stringify(e),signal:AbortSignal.timeout(15e3),keepalive:!0})).ok)throw new Error("Could not save library settings.")},e=>{ts.render(Y,Wt||Jn,e),e==="error"&&Ut("Changes applied, but could not save to the local library. Retrying when you return."),e==="saved"&&pr?.check()});const Oc=ig(bn),gt=lg(e=>li(e),bn);pr=new ug({eligible:()=>Y.autoImport&&!ct?.pending&&document.visibilityState==="visible"&&!!(X&&!X.onboarding&&X.sources?.some(e=>e.selected)),busy:()=>gt.busy||!!document.querySelector("dialog[open]"),refresh:()=>gt.refresh(!0)});const ri=new AbortController,ss=()=>{document.visibilityState==="visible"&&(ct?.state==="error"&&ct.flush(),pr?.check())};window.addEventListener("focus",ss,{signal:ri.signal});document.addEventListener("visibilitychange",ss,{signal:ri.signal});window.setInterval(ss,cg);A("#manage-sources").addEventListener("click",()=>{gt.open()});document.addEventListener("sessiongraph-import-status",e=>{const t=e.detail;pr?.activity(),ts.importStatus(t),A("#refresh").classList.toggle("spinning",t.running),A(".connection").title=t.running?`Importing ${We(t.source)} · ${t.imported} sessions saved`:t.failed?"Import unavailable · open Manage sources for details":"Local library · SQLite"},{signal:ri.signal});const oi=Id(En,bn,e=>{Oc.open(e)});A("#search").addEventListener("click",oi.open);function Ce(e,t){const n=A(`#${e}`);n.hidden=!t,e==="timeline"&&!t&&gn&&Ee(),A(`#toggle-${e}`).setAttribute("aria-expanded",String(t)),t&&innerWidth<760&&e!=="timeline"&&Ce(e==="explorer"?"inspector":"explorer",!1)}Ce("explorer",innerWidth>=760);let qr=[];for(const e of["explorer","timeline","inspector"])A(`#toggle-${e}`).addEventListener("click",()=>Ce(e,A(`#${e}`).hidden));A("#close-explorer").addEventListener("click",()=>{Ce("explorer",!1),A("#toggle-explorer").focus()});A("#close-timeline").addEventListener("click",()=>{Ee(),Ce("timeline",!1),A("#toggle-timeline").focus()});function Ut(e){A("#toast").textContent=e,A("#toast").hidden=!1,window.setTimeout(()=>{A("#toast").hidden=!0},3500)}function ii(){Ce("inspector",!1),gr.close(),Nt.clear(),A("#session-inspector").replaceChildren(),A("#toggle-inspector").hidden=!0}ii();async function Ev(){try{const{TimelineScene:e}=await Ra(async()=>{const{TimelineScene:t}=await import("./scene-DHluV79M.js");return{TimelineScene:t}},__vite__mapDeps([0,1]));ee=new e(A("#scene"),{onSelect:t=>{t?(Js.play("select"),En(t)):fi()},onPlaybackInterrupt:Ee,onEvent:t=>{Js.play("select"),ni(t)},onEventHover:(t,n,s,r)=>{Is=void 0,t&&j&&De?Nt.show(t,j,De.revision,n,s,r):Nt.clear()},onHover:(t,n,s)=>{const r=A("#tooltip");r.classList.contains("message-tooltip")&&(Nt.clear(),Is=void 0),r.hidden!==!t&&(r.hidden=!t),t&&(Is!==t.session&&(Is=t.session,r.innerHTML=`<strong>${K(t.session.title)}</strong><span>${K(We(t.session.source))} · ${t.session.activity?.lastMessageAt?`Last message ${hn(t.session.activity.lastMessageAt)}`:"Message time unavailable"}<br>Started ${hn(t.session.created)}</span>`),r.style.left=`${Math.min(n+18,A("#scene").clientWidth-280)}px`,r.style.top=`${Math.max(8,Math.min(s-32,A("#scene").clientHeight-110))}px`)}}),ee.applyPreferences(Y),X&&(ee.setGraph(re,!0),j&&(ee.select(j),ee.focus(j)),we&&ee.setFiles(we.files),De&&ee.setEvents(De.items))}catch(e){console.error("[sessiongraph] Graphics initialization failed",e),Ut("3D requires WebGL. You can still browse sessions in the list.")}finally{kc=!1,X&&di()}}Ev();A("#scene").addEventListener("scene-error",e=>Ut(e.detail));async function ai(e,t){const n=AbortSignal.timeout(18e4),s=await fetch(e,{signal:t?AbortSignal.any([t,n]):n}),r=await s.json();if(!s.ok)throw new Error(r.error||"Request failed.");return r}async function li(e=!1){const t=A("#refresh");t.disabled=!0,t.classList.add("spinning");try{const n=ct?.revision,s=await ai("/api/sessiongraph"),r=X,o=j?Ps.get(j):void 0,i=!!(r&&re.nodes.length);if(X=s,!ct?.pending&&n===ct?.revision){Y={...dr(s.preferences||Y),autoImport:s.autoImport!==!1};try{Wt=Hl(localStorage,Y)}catch{Wt=!1}if(!Jn){const c=gg(s.viewState);({sourceID:ot,projectID:pt,directory:je,days:it,fromDate:at,toDate:lt,includeChildren:pn,includeArchived:jt}=c),A("#children").checked=pn,So=JSON.stringify(c),s.preferences||si({preferences:{...Y}})}ns()}if(Jn=!0,A("#connection-label").textContent="Local library",A(".connection").classList.add("connected"),A(".connection").title=`Connected · ${Be(X.sessions.length)} sessions`,r&&JSON.stringify(r.sessions)===JSON.stringify(s.sessions)&&JSON.stringify(r.projects)===JSON.stringify(s.projects)){di();return}ti.clear(),Ps=new Map(X.sessions.map(c=>[c.id,c])),A("#source").innerHTML='<option value="">All sources</option>'+(X.sources||[]).map(c=>`<option value="${K(c.id)}">${K(c.name)} · ${c.sessions.toLocaleString()}</option>`).join(""),A("#source").value=ot,A("#source-filter-icon").innerHTML=dt(ot),oi.setData(X);const a=new Map;if(X.sessions.forEach(c=>a.set(c.projectID,(a.get(c.projectID)||0)+1)),A("#project").innerHTML='<option value="">All projects</option>'+[...X.projects].filter(c=>a.has(c.id)).sort((c,l)=>(a.get(l.id)||0)-(a.get(c.id)||0)).map(c=>`<option value="${K(c.id)}">${K(c.name)} · ${Be(a.get(c.id)||0)}</option>`).join(""),A("#project").value=pt,ci(),j&&!r){const c=X.sessions.find(l=>l.id===j);c&&c.created<Date.now()-it*864e5&&(it=0),c?.archived&&(jt=!0)}if(Pe(!i,i),j&&!r)En(j);else if(j){const c=Ps.get(j);if(c&&JSON.stringify(o)!==JSON.stringify(c)){const l=A(".detail-scroll")?.scrollTop||0;we=void 0,De=void 0,Rc(c,!1),A(".detail-scroll").scrollTop=l,vr(c.id),hi(c)}}else ii();!e&&X.warnings.length&&Ut(X.warnings.join(" ")),!e&&X.onboarding&&gt.open(!0)}catch(n){if(e&&X){A(".connection").title="Library refresh unavailable · retry with Refresh sessions";return}A("#connection-label").textContent="Connection unavailable",A(".connection").title="Connection unavailable",A(".connection").classList.remove("connected"),A("#graph-message").hidden=!1,A("#graph-message").innerHTML=`${F("terminal")}<h3>Local library unavailable</h3><p>${K(n instanceof Error?n.message:"Unable to connect.")}</p><button class="primary-button" id="retry">Retry ${F("arrow-right")}</button>`,A("#retry").addEventListener("click",()=>{li().then(ss)}),X||(A("#session-list").innerHTML='<p class="empty-list">Your sessions will appear here once connected.</p>',A("#list-count").textContent="Offline"),Ae()}finally{t.disabled=!1,t.classList.remove("spinning")}}function ci(){const e=X?.sessions.filter(s=>!pt||s.projectID===pt)||[],t=[...new Set(e.map(s=>s.directory))].sort((s,r)=>jn(s).localeCompare(jn(r))),n=new Set(X?.projects.flatMap(s=>s.worktrees));A("#directory").innerHTML='<option value="">All directories</option>'+t.map(s=>`<option value="${K(s)}">${n.has(s)?"⑂ ":""}${K(jn(s))}</option>`).join(""),t.includes(je)||(je=""),A("#directory").value=je}function Pe(e=!1,t=!1){if(!X)return;t||(Ee(),me=1,rn=60);const n=A("#session-list").scrollTop,s=document.activeElement?.closest("[data-session]")?.dataset.session,r=Date.now(),o=at?new Date(`${at}T00:00:00`).getTime():it?r-it*864e5:0,i=lt?new Date(`${lt}T23:59:59.999`).getTime():1/0;Me=X.sessions.filter(l=>(!ot||l.source===ot)&&(!pt||l.projectID===pt)&&(!je||l.directory===je)&&(pn||!l.parentID||!!l.forkID)&&(jt||!l.archived)&&l.created>=o&&l.created<=i),Xo=[...Me].sort((l,p)=>on(p)-on(l)),Cc=new Set(Me.map(l=>l.id)),oi.setScope(Me.map(l=>l.id)),re=bd(Me,X.projects,t?re:void 0),Qo=new Map(re.nodes.map(l=>[l.session.id,l.color])),ee?.setCutoff(me),ee?.setGraph(re,e,t),di(),document.querySelectorAll("[data-days]").forEach(l=>l.classList.toggle("active",!at&&!lt&&Number(l.dataset.days)===it)),ui(),t&&(A("#session-list").scrollTop=n,s&&Zn.get(s)?.focus({preventScroll:!0})),xv(),j&&!Me.some(l=>l.id===j)?fi():j&&we&&ee?.setFiles(we.files),j&&De&&ee?.setEvents(De.items),Ae();const a=yv(),c=JSON.stringify(a);Jn&&c!==So&&(So=c,si({viewState:a}))}function di(){const e=A("#graph-message");e.hidden=!!(Me.length&&ee),Me.length?ee||(e.innerHTML=kc?"<h3>Preparing the map…</h3>":`${F("box")}<h3>WebGL is unavailable.</h3><p>You can explore every session and its file details in the list.</p>`):e.innerHTML=`${F("search")}<h3>No matching sessions</h3><button class="text-button" id="clear-filters">Reset filters ${F("rotate-ccw")}</button>`,A("#clear-filters")?.addEventListener("click",()=>Lc()),Ae()}function Lc(e){ot="",A("#source").value="",A("#source-filter-icon").innerHTML=dt(),pt="",je="",it=0,at="",lt="",pn=!0,jt=e?.archived===!0,A("#project").value="",A("#children").checked=!0,Ac.setRange("",""),ci(),Pe(!0)}function ui(){A("#list-count").textContent=Be(Me.length);const e=Xo;let t="";A("#session-list").innerHTML=e.slice(0,rn).map(n=>{const s=on(n),r=fn(s),o=r!==t?`<div class="list-date">${r}<span>${new Date(s).getFullYear()}</span></div>`:"";return t=r,`${o}<button class="session-card ${j===n.id?"selected":""}" data-session="${K(n.id)}" aria-pressed="${j===n.id}" title="${K(n.title)}"><span class="session-dot" style="--node-color:${Qo.get(n.id)}"></span><span class="session-card-body"><span class="session-title">${K(n.title)}</span><span class="session-meta">${n.forkID?F("git-fork"):n.parentID?F("network"):""}<span class="source-badge" data-source="${K(n.source||"opencode")}">${dt(n.source)}${K(We(n.source))}</span><span title="${n.activity?.lastMessageAt?"Latest saved message":"Session created; message time unavailable"}">${mv.format(s)}</span></span></span></button>`}).join("")+(e.length>rn?`<button id="more-sessions" class="load-more">Show more sessions ${F("chevron-down")}</button>`:e.length?"":'<p class="empty-list">No sessions match your filters.</p>'),A("#more-sessions")?.addEventListener("click",()=>{rn+=100;const n=A("#session-list").scrollTop;ui(),A("#session-list").scrollTop=n,Ae()}),Zn=new Map([...A("#session-list").querySelectorAll(".session-card")].map(n=>[n.dataset.session,n])),Ae()}function Mc(e){for(const t of[e,j]){const n=t?Zn.get(t):void 0;n&&(n.classList.toggle("selected",t===j),n.setAttribute("aria-pressed",String(t===j)))}}function xv(){const e=new Array(70).fill(0),t=Math.max(1,re.end-re.start);for(const s of Me)e[Math.min(69,Math.floor((on(s)-re.start)/t*70))]++;const n=Math.max(...e,1);A("#histogram").innerHTML=e.map(s=>`<span style="height:${Math.max(4,s/n*100)}%;opacity:${s?.8:.15}" title="${s} session endpoints"></span>`).join(""),A("#date-label").textContent=re.start?`${fn(re.start)} — ${fn(re.end,!0)}`:"No sessions",re.start&&Ac.setRange(at||Ma(re.start),lt||Ma(re.end)),wn()}function wn(){A("#scrubber").value=String(Math.round(me*1e3)),A("#timeline-cursor").style.left=`${me*100}%`,A("#histogram").style.setProperty("--progress",`${me*100}%`),A("#playback-date").textContent=re.start?fn(re.start+(re.end-re.start)*me):"—",ee?.setCutoff(me)}function Ee(){gn=!1,ee?.setPlaying(!1),cancelAnimationFrame(ei),A("#play").innerHTML=F("play"),A("#play").setAttribute("aria-label","Play timeline"),Ae()}function Dc(e){if(!gn)return;const t=Math.min(e-xo,100);xo=e,document.hidden||(me=Math.min(1,me+t*Y.playbackSpeed/vv)),wn(),me>=1?Ee():ei=requestAnimationFrame(Dc)}function fi(){const e=j;wo?.abort(),Eo?.abort(),A("#file-legend").hidden=!0,Ns++,Vs++,j=null,we=void 0,De=void 0,ee?.select(null),history.replaceState(null,"",location.pathname),ii(),Mc(e)}function Sv(e){const t=e.forkID?[{id:e.forkID,label:"Forked from",kind:"git-fork"}]:e.parentID?[{id:e.parentID,label:"Parent",kind:"network"}]:[],n=X.sessions.filter(r=>r.forkID===e.id||!r.forkID&&r.parentID===e.id),s=[...t,...n.map(r=>({id:r.id,label:r.forkID?"Fork":"Child",kind:r.forkID?"git-fork":"network"}))];return s.length?`<section class="detail-section"><div class="section-label">Connections<span>${s.length}</span></div>${s.map(r=>{const o=X.sessions.find(i=>i.id===r.id);return`<button class="relation" data-related="${K(r.id)}" ${o?"":"disabled"}>${F(r.kind)}<span><small>${r.label}</small><strong>${K(o?.title||"Session no longer available")}</strong></span>${F("arrow-up-right")}</button>`}).join("")}</section>`:""}function Rc(e,t=!0){const n=X.projects.find(o=>o.id===e.projectID),s=e.forkID?"Fork":e.parentID?"Child session":"Session",r=n?.worktrees.includes(e.directory);A("#session-inspector").innerHTML=`
143
+ <div class="panel-heading"><button class="panel-handle" data-drag-panel="inspector" aria-label="Move session details panel" title="Drag to move · Arrow keys to reposition">${F("grip")}<span>${s}</span></button><button id="close-inspector" class="icon-button" aria-label="Close session details">${F("x")}</button></div>
144
+ <div class="detail-scroll">
145
+ <div class="detail-title"><span class="source-badge" data-source="${K(e.source||"opencode")}">${dt(e.source)}${K(We(e.source))}</span><h2>${K(e.title)}</h2><span class="detail-date">${hn(e.created)}</span></div>
146
+ <div class="detail-actions"><button id="open-session" class="secondary-button">${F("arrow-up-right")}Open session</button><button id="focus-session" class="icon-button" title="Focus node" aria-label="Focus node">${F("crosshair")}</button><button id="copy-id" class="icon-button" title="Copy session ID" aria-label="Copy session ID">${F("copy")}</button></div>
147
+ <section id="message-detail" class="detail-section"></section>
148
+ <div id="file-detail"><section class="detail-section"><div class="section-label">Changed files</div><div class="detail-loading">${F("loader-circle","spinning")}Loading changes…</div></section></div>
149
+ ${Sv(e)}
150
+ <details class="more-details detail-section"><summary>Session info ${F("chevron-down")}</summary><dl class="metadata"><div><dt>Project</dt><dd>${K(n?.name||"Unknown")}</dd></div><div><dt>Model</dt><dd>${K(e.model)}</dd></div><div><dt>Agent</dt><dd>${K(e.agent||"Unknown")}</dd></div><div><dt>Tokens incl. cache</dt><dd>${e.tokens===null?"Not recorded":hv(e.tokens)}</dd></div><div><dt>Recorded cost</dt><dd>${e.cost===null?"Not recorded":`$${e.cost.toFixed(2)}`}</dd></div><div><dt>Updated</dt><dd>${fn(e.updated)}</dd></div><div><dt>Imported</dt><dd>${e.coverage?.importedAt?fn(e.coverage.importedAt):"Pending"}</dd></div></dl><div class="directory-card"><span>${r?"Worktree":"Directory"}</span><code>${K(e.directory)}</code></div></details>
151
+ </div>
152
+ `,A("#toggle-inspector").hidden=!1,t&&Ce("inspector",!0),A("#close-inspector").addEventListener("click",()=>{Ce("inspector",!1),A("#toggle-inspector").focus()}),A("#focus-session").addEventListener("click",()=>{Ee(),ee?.focus(e.id)}),A("#open-session").addEventListener("click",()=>{Oc.open(e)}),A("#copy-id").addEventListener("click",async()=>{try{await navigator.clipboard.writeText(e.nativeID||e.id),Ut("Session ID copied")}catch{Ut(e.nativeID||e.id)}}),Pc(e),Ae()}function Pc(e,t){const n=t?.items.filter(r=>r.kind==="message"&&r.time===e.activity?.lastMessageAt).length||0,s=t?[`${Be(t.items.length-n)} of ${Be(t.total)} saved messages plotted. Click a dot to read.`,n?"The session sphere represents the latest message; read it in the explorer.":"",t.untimed?`${Be(t.untimed)} have no recorded timestamp; browse them in the explorer.`:"",t.outsideLifetime?`${Be(t.outsideLifetime)} fall outside this lifetime; available in the explorer.`:"",t.limited?"Map shows the latest 2,000 timed messages. The explorer pages through the full conversation.":"",t.partial?"Partial history.":"","Nearby messages can overlap; use Previous / Next in the explorer."].filter(Boolean):["Loading message markers…"];A("#message-detail").innerHTML=`<div class="section-label">Session timeline</div><dl class="metadata">
153
+ <div><dt>Trail starts</dt><dd>${hn(e.created)}</dd></div>
154
+ <div><dt>Node · last message</dt><dd>${e.activity?.lastMessageAt?hn(e.activity.lastMessageAt):"Unknown · at session start"}</dd></div>
155
+ </dl><div class="event-key"><span style="--event-color:${Qo.get(e.id)||"#b0e9d6"}"><i></i>User & assistant messages · hover to preview</span></div><p class="coverage-note">${s.map(K).join("<br>")}</p><button class="secondary-button explore-events">Explore messages ${F("arrow-right")}</button>${t?.note?`<details class="more-details history-coverage"><summary>History coverage ${F("chevron-down")}</summary><p class="coverage-note">${K(t.note)}</p></details>`:""}`,A(".explore-events").addEventListener("click",()=>ni()),Ae()}async function hi(e,t=!1){const n=++Vs;Eo?.abort();const s=new AbortController;Eo=s;try{const r=await ai(`/api/sessiongraph/session/${encodeURIComponent(e.id)}/event-markers`,s.signal);if(s.signal.aborted||n!==Vs||j!==e.id)return;De=r,ee?.setEvents(r.items,t),Pc(e,r)}catch{if(s.signal.aborted||n!==Vs||j!==e.id)return;A("#message-detail").innerHTML='<div class="section-label">Session timeline</div><p class="coverage-note">Message timing unavailable.</p><button class="secondary-button explore-events">Explore messages</button><button class="load-more" id="retry-timeline">Retry message markers</button>',A(".explore-events").addEventListener("click",()=>ni()),A("#retry-timeline").addEventListener("click",()=>{hi(e)})}}function $v(e,t){const n=new Map(e.files.map(r=>[r.path,{...r}]));for(const r of t.files){const o=n.get(r.path);n.set(r.path,{...r,steps:(o?.steps||0)+r.steps,source:o?.source==="snapshot"?"snapshot":r.source})}const s=new Map(e.tools.map(r=>[r.name,r.count]));return t.tools.forEach(r=>s.set(r.name,(s.get(r.name)||0)+r.count)),{...t,files:[...n.values()].sort((r,o)=>o.steps-r.steps||r.path.localeCompare(o.path)),tools:[...s].map(([r,o])=>({name:r,count:o})).sort((r,o)=>o.count-r.count),locations:[...e.locations,...t.locations],messagesScanned:e.messagesScanned+t.messagesScanned,snapshotSteps:e.snapshotSteps+t.snapshotSteps}}function Da(e){const t=e.files;A("#file-legend").hidden=!t.length,A("#file-detail").innerHTML=`
156
+ <section class="detail-section"><div class="section-label">Changed files<span>${Be(t.length)}${e.partial?"+":""}</span></div>
157
+ ${t.length?`<ul class="file-list">${t.map(n=>`<li title="${K(n.path)} · ${n.source}">${F("file-code-2")}<div><strong>${K(jn(n.path))}</strong>${n.path.includes("/")?`<span>${K(n.path.slice(0,n.path.lastIndexOf("/")))}</span>`:""}</div><small>${n.steps}×</small></li>`).join("")}</ul>`:'<div class="no-files"><p>No file changes found.</p></div>'}
158
+ <p class="coverage-note">${Be(e.messagesScanned)} messages · ${e.partial?"Partial history":"Imported history"}${e.snapshotSteps?"":"<br>No snapshots; recorded tool/file-change evidence only."}${t.length>80?"<br>80 files shown on the map.":""}</p>
159
+ ${e.note?`<p class="coverage-note">${K(e.note)}</p>`:""}
160
+ ${e.nextCursor?`<button id="load-earlier" class="load-more">Load earlier messages ${F("arrow-right")}</button>`:""}</section>
161
+ ${e.locations.length?`<details class="more-details detail-section"><summary>Directory moves ${F("chevron-down")}</summary>${e.locations.map(n=>`<div class="location-entry"><span>${hn(n.time)}</span><code>${K(n.directory)}</code></div>`).join("")}</details>`:""}
162
+ ${e.tools.length?`<details class="more-details detail-section"><summary>Tools used <span>${Be(e.tools.reduce((n,s)=>n+s.count,0))}</span>${F("chevron-down")}</summary><div class="tools-list">${e.tools.slice(0,12).map(n=>`<div><span>${K(n.name)}</span><strong>${n.count}</strong></div>`).join("")}</div></details>`:""}
163
+ `,A("#load-earlier")?.addEventListener("click",()=>vr(e.id,e.nextCursor||void 0)),ee?.setFiles(t),Ae()}async function vr(e,t){const n=++Ns;wo?.abort();const s=new AbortController;wo=s;const r=A("#load-earlier");r&&(r.disabled=!0,r.textContent="Scanning earlier messages…");try{const o=await ai(`/api/sessiongraph/session/${encodeURIComponent(e)}${t?`?cursor=${encodeURIComponent(t)}`:""}`,s.signal);if(s.signal.aborted||n!==Ns||j!==e)return;we=t&&we?$v(we,o):o,Da(we)}catch(o){if(s.signal.aborted||n!==Ns||j!==e)return;we?(Da(we),Ut("Could not load earlier history. Try again.")):(A("#file-detail").innerHTML=`<section class="detail-section"><div class="section-label">Changed files</div><p class="coverage-note">${K(o instanceof Error?o.message:"Details unavailable.")}</p><button class="load-more" id="retry-detail">Retry file details</button></section>`,A("#retry-detail").addEventListener("click",()=>vr(e)))}}function En(e){const t=Ps.get(e);if(!t)return;const n=j;gr.close(),Nt.clear(),Cc.has(e)||Lc(t),Ee(),me=1,wn(),j=e,we=void 0,De=void 0,A("#file-legend").hidden=!0,history.replaceState(null,"",`?session=${encodeURIComponent(e)}`),ee?.select(e),Rc(t),ee?.focus(e),Mc(n),vr(e),hi(t,!0)}A("#session-list").addEventListener("click",e=>{const t=e.target.closest("[data-session]");t?.dataset.session&&En(t.dataset.session)});A("#inspector").addEventListener("click",e=>{const t=e.target.closest("[data-related]");t?.dataset.related&&En(t.dataset.related)});A("#project").addEventListener("change",e=>{pt=e.target.value,je="",ci(),Pe(!0)});A("#source").addEventListener("change",e=>{ot=e.target.value,A("#source-filter-icon").innerHTML=dt(ot),Pe(!0)});A("#directory").addEventListener("change",e=>{je=e.target.value,Pe(!0)});A("#children").addEventListener("change",e=>{pn=e.target.checked,Pe()});document.querySelectorAll("[data-days]").forEach(e=>e.addEventListener("click",()=>{it=Number(e.dataset.days),at="",lt="",Pe(!0)}));A("#reset-camera").addEventListener("click",()=>Pe(!0));A("#refresh").addEventListener("click",()=>{X?.onboarding?gt.open(!0):gt.refresh()});A("#scrubber").addEventListener("input",e=>{Ee(),me=Number(e.target.value)/1e3,wn()});A("#play").addEventListener("click",()=>{if(Me.length){if(gn)return Ee();me>=1&&(me=0),wn(),gn=!0,ee?.setPlaying(!0),xo=performance.now(),A("#play").innerHTML=F("pause"),A("#play").setAttribute("aria-label","Pause timeline"),Ae(),ei=requestAnimationFrame(Dc)}});for(const e of[!1,!0])A(`#view-${e?"2d":"3d"}`).addEventListener("click",()=>mr({view:e?"2d":"3d"}));A("#motion").addEventListener("click",()=>mr({motion:po(Y,Zs.matches)?"off":"on"}));A("#help").addEventListener("click",()=>{A("#help-dialog").showModal(),bn()});A("#help-dialog").addEventListener("close",bn);A("#close-help").addEventListener("click",()=>A("#help-dialog").close());document.addEventListener("keydown",e=>{if(!e.defaultPrevented&&!document.querySelector("dialog[open]")&&!gr.handleKey(e)){if(e.key==="Escape"){j?fi():Ce("explorer",!1);return}if(!(e.target.matches("input, select, textarea")||e.metaKey||e.ctrlKey||e.altKey)){if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)&&!e.target.closest('[data-drag-panel], [contenteditable="true"]')){const t=e.target;if(t.matches("canvas, body, .session-card")||t.closest(".session-card")){const n=Xo,s=n.findIndex(i=>i.id===j),r=e.key==="ArrowLeft"||e.key==="ArrowUp"?-1:1,o=n[Math.max(0,Math.min(n.length-1,s+r))];o&&(e.preventDefault(),En(o.id),t.closest(".session-card")&&(Zn.has(o.id)||(rn=Math.min(n.length,rn+100),ui()),Zn.get(o.id)?.focus({preventScroll:!0})));return}}if(e.key.toLowerCase()==="f"&&Pe(!0),e.key.toLowerCase()==="h"){const t=["explorer","timeline","inspector"].filter(n=>!A(`#${n}`).hidden);t.length?(qr=t,t.forEach(n=>Ce(n,!1))):(qr.length?qr:["explorer","timeline"]).forEach(n=>{(n!=="inspector"||j)&&Ce(n,!0)})}}}});li().then(()=>{X?.importing?gt.resume():ss()});export{Av as C,cr as D,Ov as R,Cv as a,Tv as b,Va as c,z as d,$o as e,jl as f,$n as h,kv as i,po as m,Iv as p,Gr as t};