sessiongraph-app-win32-x64 1.0.13 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/payload/SessionGraph.exe +0 -0
- package/payload/resources/server.mjs +636 -323
- package/payload/resources/web/assets/external-links-BmBkCsrt.js +1 -0
- package/payload/resources/web/assets/index-B1kyvo41.js +175 -0
- package/payload/resources/web/assets/index-BLM-0yG6.js +1 -0
- package/payload/resources/web/assets/{index-CJb-F0VY.js → index-D4P4hbvc.js} +1 -1
- package/payload/resources/web/assets/index-Du0_nVjH.css +1 -0
- package/payload/resources/web/assets/{index-HzUuskn3.js → index-Kotmn42s.js} +1 -1
- package/payload/resources/web/assets/publishing-CEvQPkO1.css +1 -0
- package/payload/resources/web/assets/publishing-D9CqkbeB.js +23 -0
- package/payload/resources/web/assets/scene-CTHyYtma.js +139 -0
- package/payload/resources/web/assets/share-Cw1E-ED9.js +7 -0
- package/payload/resources/web/index.html +2 -2
- package/payload/resources/web/sources/NOTICE.txt +4 -4
- package/payload/resources/web/assets/external-links-BcKDmn29.js +0 -1
- package/payload/resources/web/assets/index-CDA8pT1Q.js +0 -170
- package/payload/resources/web/assets/index-DYhIhreE.js +0 -1
- package/payload/resources/web/assets/index-cVgPCrFV.css +0 -1
- package/payload/resources/web/assets/publishing-CpVLG7_B.js +0 -25
- package/payload/resources/web/assets/publishing-VJhUmdPH.css +0 -1
- package/payload/resources/web/assets/scene-BkoCsbA8.js +0 -139
- package/payload/resources/web/assets/share-CS1dKayZ.js +0 -7
- package/payload/resources/web/sources/hindsight.svg +0 -1
- package/payload/resources/web/sources/lmstudio.svg +0 -1
- package/payload/resources/web/sources/reasonix.svg +0 -1
- package/payload/resources/web/sources/trae.svg +0 -1
- package/payload/resources/web/sources/warp.svg +0 -1
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/scene-CTHyYtma.js","assets/three-D_1Qt16u.js","assets/share-Cw1E-ED9.js","assets/external-links-BmBkCsrt.js","assets/publishing-D9CqkbeB.js","assets/publishing-CEvQPkO1.css"])))=>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 od="modulepreload",id=function(e){return"/"+e},Vi={},dr=function(t,n,s){let r=Promise.resolve();if(n&&n.length>0){let l=function(c){return Promise.all(c.map(f=>Promise.resolve(f).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=l(n.map(c=>{if(c=id(c),c in Vi)return;Vi[c]=!0;const f=c.endsWith(".css"),u=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const g=document.createElement("link");if(g.rel=f?"stylesheet":od,f||(g.as="script"),g.crossOrigin="",g.href=c,a&&g.setAttribute("nonce",a),document.head.appendChild(g),f)return new Promise((h,p)=>{g.addEventListener("load",h),g.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}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 ec=(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=ec(...r);s.appendChild(o)}),s};var Wo=([e,t,n])=>ec(e,t,n);const ad=e=>Array.from(e.attributes).reduce((t,n)=>(t[n.name]=n.value,t),{}),cd=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:"",ld=e=>e.flatMap(cd).map(n=>n.trim()).filter(Boolean).filter((n,s,r)=>r.indexOf(n)===s).join(" "),dd=e=>e.replace(/(\w)(\w*)(_|-|\s*)/g,(t,n,s)=>n.toUpperCase()+s.toLowerCase()),Ni=(e,{nameAttr:t,icons:n,attrs:s})=>{const r=e.getAttribute(t);if(r==null)return;const o=dd(r),i=n[o];if(!i)return console.warn(`${e.outerHTML} icon name was not found in the provided icons object.`);const a=ad(e),[l,c,f]=i,u={...c,"data-lucide":r,...s,...a},g=ld(["lucide",`lucide-${r}`,a,s]);g&&Object.assign(u,{class:g});const h=Wo([l,u,f]);return e.parentNode?.replaceChild(h,e)};const K={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 ud=["svg",K,[["path",{d:"M5 12h14"}],["path",{d:"m12 5 7 7-7 7"}]]];const fd=["svg",K,[["path",{d:"M7 7h10v10"}],["path",{d:"M7 17 17 7"}]]];const hd=["svg",K,[["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 pd=["svg",K,[["path",{d:"m6 9 6 6 6-6"}]]];const gd=["svg",K,[["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 md=["svg",K,[["circle",{cx:"12",cy:"12",r:"10"}],["polyline",{points:"12 6 12 12 16 14"}]]];const vd=["svg",K,[["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 yd=["svg",K,[["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 bd=["svg",K,[["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 wd=["svg",K,[["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 Ed=["svg",K,[["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 xd=["svg",K,[["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 Sd=["svg",K,[["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 $d=["svg",K,[["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 Id=["svg",K,[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56"}]]];const Cd=["svg",K,[["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 Td=["svg",K,[["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 kd=["svg",K,[["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 Ad=["svg",K,[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M15 3v18"}]]];const Ld=["svg",K,[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M3 9h18"}],["path",{d:"M9 21V9"}]]];const Od=["svg",K,[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1"}]]];const Ms=["svg",K,[["polygon",{points:"6 3 20 12 6 21 6 3"}]]];const Md=["svg",K,[["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 Dd=["svg",K,[["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 Rd=["svg",K,[["circle",{cx:"11",cy:"11",r:"8"}],["path",{d:"m21 21-4.3-4.3"}]]];const Pd=["svg",K,[["path",{d:"M20 7h-9"}],["path",{d:"M14 17H5"}],["circle",{cx:"17",cy:"17",r:"3"}],["circle",{cx:"7",cy:"7",r:"3"}]]];const Vd=["svg",K,[["circle",{cx:"18",cy:"5",r:"3"}],["circle",{cx:"6",cy:"12",r:"3"}],["circle",{cx:"18",cy:"19",r:"3"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49"}]]];const Nd=["svg",K,[["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 tc=["svg",K,[["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 Fd=["svg",K,[["polyline",{points:"4 17 10 11 4 5"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19"}]]];const nc=["svg",K,[["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 Hd=["svg",K,[["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 _d=["svg",K,[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]]];const Bd=({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=>Ni(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=>Ni(o,{nameAttr:"icon-name",icons:e,attrs:n})))}},Fi=["#b0e9d6","#8eaff4","#d7a1f1","#eac594","#8cdbdf","#e7a3b8","#a8ca91"];function Cn(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 Kn(e){return Gs(e).split("/").at(-1)||"/"}const Gs=e=>(/^(?:[a-z]:[\\/]|\\\\)/i.test(e)?e.replace(/\\/g,"/"):e).replace(/\/+$/,"")||(e.startsWith("/")?"/":""),Tn=e=>e.directory?JSON.stringify(["directory",Gs(e.directory)]):JSON.stringify(["project",e.source||"opencode",e.projectID||e.id]),dn=e=>Math.max(e.created,e.activity?.lastMessageAt||e.created),lo=(e,t)=>{const n=t.timeFrame||t;return(e-n.start)/Math.max(1,n.end-n.start)*300-150},sy=(e,t)=>lo(t.start+(t.end-t.start)*e,t),Uo=(e,t)=>[t,e.position[1],e.position[2]],jd=(e,t)=>Uo(e,Math.max(e.startPosition[0],Math.min(t,e.position[0]))),ry=(e,t,n,s=0,r=[1,0,0])=>{const o=jd(e,t);return[o[0]+r[0]*(n+s),o[1]+r[1]*(n+s),o[2]+r[2]*(n+s)]},oy=(e,t)=>[Uo(e,Math.max(e.startPosition[0],Math.min(t.startPosition[0],e.position[0]))),t.startPosition];function Wd(e,t,n){if(!e.length)return{nodes:[],edges:[],lanes:[],start:0,end:0};const s=[...e].sort((E,O)=>E.created-O.created||E.id.localeCompare(O.id)),r=s[0].created,o=s.reduce((E,O)=>Math.max(E,dn(O)),r+36e5),i=n?.nodes.length?n.timeFrame||{start:n.start,end:n.end}:{start:r,end:o},a=new Map;for(const E of s){const O=Tn(E),M=a.get(O)||[];M.push(E),a.set(O,M)}const l=[...a].sort((E,O)=>O[1].length-E[1].length||E[0].localeCompare(O[0])),c=new Map(n?.lanes.map((E,O)=>[E.key,E.slot??O]));let f=Math.max(-1,...c.values())+1;for(const[E]of l)c.has(E)||c.set(E,f++);l.sort((E,O)=>c.get(E[0])-c.get(O[0]));const u=[],g=[],h=new Set(t.flatMap(E=>E.worktrees.map(Gs)));l.forEach(([E,O])=>{const M=c.get(E),D=M*2.399963,w=M===0?0:15+Math.sqrt(M)*14,S=Math.cos(D)*w,x=Math.sin(D)*w*.7,k=Fi[M%Fi.length],b=t.find(V=>V.id===O[0].projectID),A=O[0].directory,R={key:E,slot:M,label:A?Kn(A):b?.name||O[0].projectID||"Unknown directory",color:k,kind:A&&h.has(Gs(A))?"worktree":"directory",y:S,z:x,nodes:[]};for(const V of O){const H=lo(dn(V),i),Z=lo(V.created,i),re=Cn(V.id),W=!!(V.parentID||V.forkID)?12:6,we=Math.sin((Z+150)/65+M*.7)*3.5,Dt=typeof V.tokens=="number"&&Number.isFinite(V.tokens)?Math.max(0,V.tokens):0,Ce={session:V,position:[H,S+we+(re-.5)*W,x+(Cn(V.id+"z")-.5)*W],startPosition:[Z,0,0],color:k,radius:.35+Math.min(.9,Math.log10(1+Dt)*.11)};g.push(Ce),R.nodes.push(Ce)}u.push(R)});const p=new Set(s.map(E=>E.id)),d=[];for(const E of s)E.forkID&&p.has(E.forkID)?d.push({from:E.forkID,to:E.id,kind:"fork"}):E.parentID&&p.has(E.parentID)&&d.push({from:E.parentID,to:E.id,kind:"child"});const m=new Map(g.map(E=>[E.session.id,E])),y=new Set;for(const E of n?.nodes||[]){const O=m.get(E.session.id);O&&Tn(O.session)===Tn(E.session)&&(O.position[1]=E.position[1],O.position[2]=E.position[2],y.add(O.session.id))}function $(E){const O=[],M=new Set;let D=E;for(;D&&!y.has(D.session.id)&&!M.has(D.session.id);){M.add(D.session.id);const w=D.session.forkID||D.session.parentID,S=w?m.get(w):void 0,x=S&&Tn(S.session)===Tn(D.session)?S:void 0;O.push({node:D,parent:x}),D=x}for(const{node:w,parent:S}of O.reverse()){const x=w.session.id;if(S){const k=Cn(x+"branch")>.5?1:-1;w.position[1]=S.position[1]+k*(9+Cn(x)*15),w.position[2]=S.position[2]+(Cn(x+"depth")-.5)*18}y.add(x)}}return s.forEach(E=>$(m.get(E.id))),g.forEach(E=>{E.startPosition=Uo(E,E.startPosition[0])}),{nodes:g,edges:d,lanes:u,start:r,end:o,timeFrame:i}}function Ud(){const e=new AbortController,t={signal:e.signal};let n,s=innerWidth<760;function r(c,f,u){const g=Math.max(12,Math.min(f,innerWidth-c.offsetWidth-12)),h=Math.max(72,Math.min(u,innerHeight-c.offsetHeight-12));Object.assign(c.style,{left:`${g}px`,top:`${h}px`,right:"auto",bottom:"auto",transform:"none"}),c.dataset.positioned="true"}function o(){if(!n)return;const{panel:c,handle:f,pointerID:u}=n;n=void 0,c.classList.remove("dragging"),f.hasPointerCapture(u)&&f.releasePointerCapture(u)}document.addEventListener("pointerdown",c=>{if(c.button!==0)return;const f=c.target,u=f.closest(".floating-panel");if(!u)return;document.querySelectorAll(".floating-panel").forEach(p=>p.classList.toggle("front",p===u));const g=f.closest("[data-drag-panel]");if(!g)return;u.querySelectorAll(".custom-dates[open]").forEach(p=>{p.open=!1}),c.preventDefault(),g.focus({preventScroll:!0});const h=u.getBoundingClientRect();n={panel:u,handle:g,pointerID:c.pointerId,x:c.clientX,y:c.clientY,left:h.left,top:h.top},g.setPointerCapture(c.pointerId),u.classList.add("dragging")},t),document.addEventListener("pointermove",c=>{!n||c.pointerId!==n.pointerID||r(n.panel,n.left+c.clientX-n.x,n.top+c.clientY-n.y)},t),document.addEventListener("pointerup",o,t),document.addEventListener("pointercancel",o,t),document.addEventListener("lostpointercapture",o,t),document.addEventListener("keydown",c=>{const u=c.target.closest("[data-drag-panel]")?.closest(".floating-panel");if(!u||!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(c.key))return;c.preventDefault();const g=u.getBoundingClientRect(),h=c.shiftKey?40:10;r(u,g.left+(c.key==="ArrowLeft"?-h:c.key==="ArrowRight"?h:0),g.top+(c.key==="ArrowUp"?-h:c.key==="ArrowDown"?h:0))},t);const i=[...document.querySelectorAll(".floating-panel")],a=c=>{if(c.hidden||!c.dataset.positioned)return;const f=c.getBoundingClientRect();r(c,f.left,f.top)},l=new ResizeObserver(c=>c.forEach(f=>a(f.target)));return i.forEach(c=>l.observe(c)),window.addEventListener("resize",()=>{o(),s!==innerWidth<760?(s=innerWidth<760,i.forEach(c=>{c.removeAttribute("style"),delete c.dataset.positioned})):i.forEach(a)},t),()=>{o(),e.abort(),l.disconnect()}}const qd=2,Hi=e=>JSON.stringify([qd,e.revision,e.updated,e.created,e.projectID,e.directory]),un=e=>e.normalize("NFKD").replace(new RegExp("\\p{M}","gu"),"").toLowerCase(),qo=e=>un(e).match(/[\p{L}\p{N}]+/gu)||[],Gd=e=>qo(e).join(" ");function Yd(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=un(r[2].replace(/^"|"$/g,""));if(i==="in"){const l={title:["title"],files:["files"],messages:["body"],tools:["tools"]};t.fields=l[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(Gd(o)),n.push(o)}return t.text=n.join(" "),t.terms=qo(t.text).slice(0,12),t.text=t.terms.join(" "),t}function Kd(e,t,n=220){const s=un(e),r=t.reduce((i,a)=>{const l=s.indexOf(a);return l<0?i:Math.min(i,l)},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 ur={opencode:{name:"OpenCode",icon:"opencode"},"claude-code":{name:"Claude Code",icon:"claude"},codex:{name:"Codex",icon:"openai"},"t3-code":{name:"T3 Code",icon:"t3"},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"},"copilot-chat":{name:"GitHub Copilot Chat (VS Code)",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"},"prime-agent":{name:"Prime Agent",icon:"prime"},omp:{name:"Oh My Pi",icon:"pi"},senpi:{name:"Senpi / OmO Native",icon:"senpi"},kimchi:{name:"Kimchi",icon:"kimchi"},gajae:{name:"Gajae-Code",icon:"gajae"},openclaw:{name:"OpenClaw",icon:"openclaw"},hermes:{name:"Hermes Agent",icon:"hermes"},amp:{name:"Amp",icon:"amp"},droid:{name:"Factory Droid",icon:"droid"},codebuff:{name:"Codebuff",icon:"codebuff"},freebuff:{name:"Freebuff",icon:"freebuff"},kimi:{name:"Kimi CLI / Code",icon:"kimi"},grok:{name:"Grok Build",icon:"grok"},jcode:{name:"Jcode",icon:"jcode"},"cherry-studio":{name:"Cherry Studio",icon:"cherry"},"command-code":{name:"Command Code",icon:"commandcode"},zcode:{name:"ZCode",icon:"zcode"},codebuddy:{name:"CodeBuddy",icon:"codebuddy"},workbuddy:{name:"WorkBuddy",icon:"codebuddy"},proma:{name:"Proma",icon:"proma"},"deepseek-harness":{name:"DeepSeek Harness",icon:"deepseek"},aside:{name:"Aside",icon:"aside"},vibe:{name:"Mistral Vibe",icon:"mistral"},muse:{name:"Muse Code",icon:"muse"},junie:{name:"Junie",icon:"junie"},augment:{name:"Augment Code",icon:"augment"},fx:{name:"Fx",icon:"fx"},"minimax-code":{name:"MiniMax Code",icon:"minimax"},opencodereview:{name:"OpenCodeReview",icon:"opencode"},goose:{name:"Goose",icon:"goose"},zed:{name:"Zed Agent",icon:"zed"},devin:{name:"Devin CLI",icon:"devin"},"devin-desktop":{name:"Devin Desktop",icon:"devin"},crush:{name:"Crush",icon:"crush"},octofriend:{name:"Octofriend",icon:"octofriend"},"kilo-cli":{name:"Kilo CLI",icon:"kilo"},"mimo-code":{name:"MiMo Code",icon:"mimo"},"mimo-desktop":{name:"Xiaomi MiMo AI",icon:"mimo"},unsloth:{name:"Unsloth Studio",icon:"unsloth"},kiro:{name:"Kiro",icon:"kiro"},mux:{name:"Mux",icon:"mux"},antigravity:{name:"Antigravity",icon:"antigravity"},"antigravity-cli":{name:"Antigravity CLI",icon:"antigravity"},"antigravity-extension":{name:"Antigravity IDE Extension",icon:"antigravity"}},Me=e=>ur[e||"opencode"]?.name||e||"Unknown",iy=e=>typeof e=="string"&&Object.hasOwn(ur,e),Ye=e=>{const t=ur[e||""]?.icon||"generic";return`<span class="source-icon source-icon-${t}" aria-hidden="true" style="--source-icon:url('/sources/${t}.svg')"></span>`};function ay(e,t="/sources"){const n=ur[e||""]?.icon||"generic",s=document.createElement("span");return s.className=`source-icon source-icon-${n}`,s.setAttribute("aria-hidden","true"),s.style.setProperty("--source-icon",`url('${t}/${n}.svg')`),s}const sc=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)),Vt=e=>e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]);function rc(e,{checked:t=e.selected,disabled:n=!1,settings:s=!1}={}){const r=e.available?"Detected":"Not detected",o=e.capabilities.history?"":"Metadata only",i=[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="${Vt(e.id)}" title="${Vt(i)}"><input ${s?'class="settings-source"':""} type="checkbox" value="${Vt(e.id)}" aria-label="${Vt(e.name)}" aria-description="${Vt(`${r}. ${e.sessions.toLocaleString()} saved sessions. ${i}`)}" ${t?"checked":""} ${n?"disabled":""}/><span class="source-symbol">${Ye(e.id)}</span><span class="source-copy"><strong>${Vt(e.name)}</strong><small class="source-meta"><span class="source-detected ${e.available?"detected":""}">${r}</span><span>${e.sessions.toLocaleString()} saved</span>${o?`<span>${o}</span>`:""}</small>${e.error?`<small class="source-error">${Vt(e.error)}</small>`:""}</span></label>`}const ke=e=>e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]);function kn(e,t){const n=new Set(t.map(un));let s=0,r="";for(const o of e.matchAll(/[\p{L}\p{N}]+/gu)){r+=ke(e.slice(s,o.index));const i=un(o[0]),a=[...n].some(l=>i.startsWith(l));r+=a?`<mark>${ke(o[0])}</mark>`:ke(o[0]),s=o.index+o[0].length}return r+ke(e.slice(s))}function zd(e,t=()=>{},n){const s=new Worker(new URL("/assets/worker-C10U_apJ.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),l=a("#session-query"),c=a("#search-results"),f=a(".search-results-inner"),u=a("#search-preview"),g=a("#search-scope");let h=new Map,p=new Map,d,m=[],y=0,$=0,E=0,O=80,M=0,D=0,w=0,S=!1,x=!1,k=!0,b,A=null,R,V=0,H="",Z="",re=!1;const J=new Map,W=86,we=v=>s.postMessage(v);function Dt(){if(!b)return;const v=a("#search-index-state");v.textContent=b.storage==="restoring"?"Restoring saved index…":b.complete===b.total&&b.total?`Conversations ready${b.storage==="local"?" · saved locally":""}`:`${b.indexed.toLocaleString()} / ${b.total.toLocaleString()} conversations${k?b.active?" · indexing":" · partial":" · paused"}`,v.title=`Titles and metadata cover all ${b.total.toLocaleString()} imported sessions. ${b.complete.toLocaleString()} conversations have all supported text indexed. ${b.failed?`${b.failed} unavailable; toggle Conversations to retry. `:""}${b.limited?"Large histories are sampled; missing matches may be in unindexed text. ":""}${b.storage==="memory"?"Saving unavailable; search continues in memory.":`Saved in local SQLite. ${b.restored.toLocaleString()} conversations restored; unchanged pages are reused. Clear saved index under Filters. Imported sessions remain saved.`}`}function Ce(){if(f.style.height=`${m.length*W}px`,!m.length){f.innerHTML=`<div class="search-empty">${ke(Z||(S?"Searching…":l.value?"No matching sessions":"No sessions available"))}</div>`,l.removeAttribute("aria-activedescendant");return}const v=Math.max(0,Math.floor(c.scrollTop/W)-3),C=Math.min(m.length,v+Math.ceil(c.clientHeight/W)+7);f.innerHTML=m.slice(v,C).map((F,Q)=>{const U=v+Q,G=h.get(F.id);if(!G)return"";const de=`${Me(G.source)} · ${p.get(G.projectID)||G.directory.split("/").at(-1)||"Global"} · ${new Date(G.updated).toLocaleDateString(void 0,{month:"short",day:"numeric"})}`;return`<div id="search-hit-${U}" class="search-result ${U===y?"active":""}" role="option" aria-selected="${U===y}" aria-posinset="${U+1}" aria-setsize="${$}" data-result-index="${U}" style="top:${U*W}px"><div class="search-result-title">${kn(G.title,F.terms)}</div><div class="search-result-meta"><span>${Ye(G.source)}${ke(de)}</span><span class="match-kind">${ke(F.source)}</span></div>${F.excerpt?`<div class="search-result-excerpt">${kn(F.excerpt,F.terms)}</div>`:`<div class="search-result-excerpt">${ke(G.model)}</div>`}</div>`}).join(""),y>=v&&y<C?l.setAttribute("aria-activedescendant",`search-hit-${y}`):l.removeAttribute("aria-activedescendant")}function Je(v,C=!1,F=!1){const Q=m[y],U=Q&&h.get(Q.id);if(!U){u.innerHTML="";return}const G=Q.terms.length?Q.terms:qo(Yd(l.value).text),de=v?.fragments.filter(ie=>{const _e=un(ie.text);return G.length&&G.every(Be=>_e.includes(Be))}).slice(0,4)||[],Ve=v?.fragments.filter(ie=>["You","Assistant"].includes(ie.kind)).slice(0,5).reverse()||[],He=de.length?de:Ve;if(u.innerHTML=`<div class="search-preview-heading"><span>${ke(p.get(U.projectID)||"Session")}</span><h2>${kn(U.title,G)}</h2><p>${ke(U.model)} · ${new Date(U.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>${kn(Q.excerpt,G)}</p></section>`:""}<section class="search-preview-section"><h3>${de.length?"Matching context":"Recent conversation"}</h3>${C?'<p class="preview-loading">Loading preview…</p>':F?'<p>Preview unavailable.</p><button class="text-button preview-retry">Retry</button>':He.length?He.map(ie=>`<article><span>${ke(ie.kind)}</span><p>${kn(Kd(ie.text,G,360),G)}</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",In,o),n){const ie=document.createElement("button");ie.className="text-button search-launch",ie.innerHTML=`${Ye(U.source)}Open in ${ke(Me(U.source))} ↗`,ie.addEventListener("click",()=>n(U),o),u.querySelector(".search-preview-heading")?.append(ie)}u.querySelector(".preview-retry")?.addEventListener("click",()=>{H="",Rt()},o)}function Rt(){const v=m[y],C=v&&h.get(v.id),F=C?`${C.id}:${Hi(C)}:${l.value}`:"";if(F===H)return;if(H=F,window.clearTimeout(V),R?.abort(),!C){Je();return}const Q=`${C.id}:${Hi(C)}`,U=J.get(Q);if(U){Je(U);return}Je(void 0,!0),V=window.setTimeout(async()=>{const G=new AbortController;R=G;try{const de=await fetch(`/api/sessiongraph/session/${encodeURIComponent(C.id)}/content?updated=${C.updated}`,{signal:G.signal});if(!de.ok)throw new Error("Preview unavailable");const Ve=await de.json();if(G.signal.aborted||F!==H)return;J.size>=25&&J.delete(J.keys().next().value),J.set(Q,Ve),Je(Ve)}catch{!G.signal.aborted&&F===H&&Je(void 0,!1,!0)}},90)}function Zt(){cancelAnimationFrame(M),S=!0,l.setAttribute("aria-busy","true");const v=++E;D=performance.now(),M=requestAnimationFrame(()=>we({type:"query",request:v,text:l.value,viewOnly:g.value==="view",limit:O}))}function wt(){y=0,re=!1,O=80,c.scrollTop=0,H="",Zt()}function Pt(v){if(!m.length)return;re=!0,y=Math.max(0,Math.min(m.length-1,y+v));const C=y*W;C<c.scrollTop?c.scrollTop=C:C+W>c.scrollTop+c.clientHeight&&(c.scrollTop=C+W-c.clientHeight),Ce(),Rt()}function Et(){i.close(),t(!1),R?.abort(),window.clearTimeout(V),H="",A?.focus({preventScroll:!0})}function In(){const v=m[y];!v||S||(Et(),e(v.id))}function L(){i.open||(A=document.activeElement,i.showModal()),t(!0),l.focus({preventScroll:!0}),l.select(),Zt(),k&&we({type:"warm",enabled:!0})}s.onmessage=v=>{const C=v.data;if(C.type==="status"){b=C.status,Dt();return}if(C.type==="error"){Z=C.message,S=!1,l.setAttribute("aria-busy","false"),Ce();return}if(C.request!==E)return;const F=m[y]?.id;w=S?performance.now()-D:w,S=!1,l.setAttribute("aria-busy","false"),m=C.hits,$=C.total,Z=C.error||"",y=Math.max(0,Math.min(m.length-1,re&&F?m.findIndex(Q=>Q.id===F):0)),a("#search-result-status").textContent=Z||`${$.toLocaleString()} ${l.value?"matches":"sessions"} · ${Math.round(C.elapsed)} ms`,a("#search-more").hidden=m.length>=$||O>=250,i.open&&(Ce(),Rt())},s.onerror=()=>{Z="Search could not start. Reload to retry.",S=!1,Ce()},l.addEventListener("input",()=>{x||wt()},o),l.addEventListener("compositionstart",()=>{x=!0},o),l.addEventListener("compositionend",()=>{x=!1,wt()},o),g.addEventListener("change",wt,o),c.addEventListener("scroll",Ce,o),c.addEventListener("click",v=>{const C=v.target.closest("[data-result-index]");C&&(y=Number(C.dataset.resultIndex),re=!0,Ce(),Rt(),l.focus())},o),c.addEventListener("dblclick",In,o),a("#search-more").addEventListener("click",()=>{O=Math.min(250,O+80),Zt()},o),a("#search-conversations").addEventListener("click",()=>{k=!k,a("#search-conversations").setAttribute("aria-pressed",String(k)),we({type:"warm",enabled:k}),Dt()},o),a("#search-clear-cache").addEventListener("click",()=>{k=!1,a("#search-conversations").setAttribute("aria-pressed","false"),J.clear(),H="",R?.abort(),window.clearTimeout(V),a(".search-syntax").open=!1,we({type:"clear-cache"}),l.focus()},o),a(".search-close").addEventListener("click",Et,o),i.addEventListener("cancel",v=>{v.preventDefault(),Et()},o),i.addEventListener("keydown",v=>{v.stopPropagation(),!(x||v.isComposing)&&((v.key==="ArrowDown"||v.key==="ArrowUp")&&(v.preventDefault(),Pt(v.key==="ArrowDown"?1:-1)),(v.key==="PageDown"||v.key==="PageUp")&&(v.preventDefault(),Pt((v.key==="PageDown"?1:-1)*Math.max(1,Math.floor(c.clientHeight/W)))),v.key==="Enter"&&v.target===l&&(v.preventDefault(),In()),v.key==="Escape"&&(v.preventDefault(),Et()),v.key.toLowerCase()==="s"&&v.altKey&&(v.preventDefault(),g.value=g.value==="view"?"all":"view",g.dispatchEvent(new Event("change",{bubbles:!0}))))},o),document.addEventListener("keydown",v=>{if(i.open||document.querySelector("dialog[open]"))return;const C=v.target,F=C.isContentEditable||C.closest('input:not([type="range"]):not([type="checkbox"]):not([type="radio"]), textarea, select');(v.key==="/"&&!F&&!v.ctrlKey&&!v.metaKey&&!v.altKey||v.key.toLowerCase()==="k"&&(v.metaKey||v.ctrlKey))&&(v.preventDefault(),L())},o);const I=new ResizeObserver(()=>{i.open&&Ce()});return I.observe(c),{open:L,setData(v){d!==v.sourceID&&(J.clear(),H="",R?.abort(),window.clearTimeout(V)),d=v.sourceID,h=new Map(v.sessions.map(C=>[C.id,C])),p=new Map(v.projects.map(C=>[C.id,C.name])),we({type:"data",sessions:v.sessions,projects:v.projects,sourceID:d})},setScope(v){we({type:"scope",ids:v})},diagnostics:()=>({open:i.open,query:l.value,matches:$,renderedRows:f.querySelectorAll('[role="option"]').length,roundTripMs:w,pending:S,index:b}),dispose(){s.terminate(),r.abort(),I.disconnect(),R?.abort(),window.clearTimeout(V),cancelAnimationFrame(M),i.remove()}}}const _n=[{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"}],Dr=e=>_n.some(t=>t.id===e),oc=e=>/^ses[a-zA-Z0-9_-]+$/.test(e);function Zd(e,t){if(!oc(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 sn=(e,t=[])=>({parts:(...n)=>{if(Jd(t))return sn(e,n);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...n)=>sn(e,[...t,...n]),omit:(...n)=>sn(e,t.filter(s=>!n.includes(s))),rename:n=>sn(n,t),keys:()=>t,build:()=>[...new Set(t)].reduce((n,s)=>Object.assign(n,{[s]:{selector:[`&[data-scope="${Jt(e)}"][data-part="${Jt(s)}"]`,`& [data-scope="${Jt(e)}"][data-part="${Jt(s)}"]`].join(", "),attrs:{"data-scope":Jt(e),"data-part":Jt(s)}}}),{})}),Jt=e=>e.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),Jd=e=>e.length===0,Xd=sn("select").parts("label","positioner","trigger","indicator","clearTrigger","item","itemText","itemIndicator","itemGroup","itemGroupLabel","list","content","root","control","valueText"),ye=Xd.build(),Qd=Object.defineProperty,eu=(e,t,n)=>t in e?Qd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_=(e,t,n)=>eu(e,typeof t!="symbol"?t+"":t,n);function tu(e){return e==null?[]:Array.isArray(e)?e:[e]}var nu=e=>e[e.length-1],su=(e,t)=>e.indexOf(t)!==-1,ru=(e,...t)=>e.concat(t),ou=(e,...t)=>e.filter(n=>!t.includes(n)),_i=(e,t)=>su(e,t)?ou(e,t):ru(e,t);function Bi(e,t){return e.reduce((n,s,r)=>(r%t===0?n.push([s]):nu(n)?.push(s),n),[])}var ji=e=>e?.constructor.name==="Array",iu=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!bn(e[n],t[n]))return!1;return!0},bn=(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(ji(e)&&ji(t))return iu(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(!bn(e[o],t[o]))return!1}return!0},au=e=>Array.isArray(e),ic=e=>e!=null&&typeof e=="object",Rr=e=>ic(e)&&!au(e),cu=e=>typeof e=="string",tt=e=>typeof e=="function",lu=e=>e==null,Ds=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),du=e=>Object.prototype.toString.call(e),ac=Function.prototype.toString,uu=ac.call(Object),Bn=e=>{if(!ic(e)||du(e)!="[object Object]"||pu(e))return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const n=Ds(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&ac.call(n)==uu},fu=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,hu=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,pu=e=>fu(e)||hu(e),Wi=(e,...t)=>(typeof e=="function"?e(...t):e)??void 0,gu=e=>e(),cc=()=>{},Ys=(...e)=>(...t)=>{e.forEach(function(n){n?.(...t)})};function uo(e,t,...n){if(e in t){const r=t[e];return tt(r)?r(...n):r}const s=new Error(`No matching key: ${JSON.stringify(e)} in ${JSON.stringify(Object.keys(t))}`);throw Error.captureStackTrace?.(s,uo),s}var{min:mu,max:vu}=Math,yu=e=>Number.isNaN(e),lc=e=>yu(e)?0:e,Pr=(e,t,n)=>{const s=lc(e),r=t==null||s>=t,o=n==null||s<=n;return r&&o},bu=(e,t,n)=>mu(vu(lc(e),t),n);function Go(e){if(!Bn(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]=Go(r))}return n}function dc(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 Rs(...e){e.length===1?e[0]:e[1],e.length===2&&e[0]}function Ui(...e){e.length===1?e[0]:e[1],e.length===2&&e[0]}function fr(e,t){if(e==null)throw new Error(t())}var Ps={itemToValue(e){return typeof e=="string"?e:Rr(e)&&Ds(e,"value")?e.value:""},itemToString(e){return typeof e=="string"?e:Rr(e)&&Ds(e,"label")?e.label:Ps.itemToValue(e)},isItemDisabled(e){return Rr(e)&&Ds(e,"disabled")?!!e.disabled:!1}},uc=class fc{constructor(t){_(this,"options",t),_(this,"items"),_(this,"indexMap",null),_(this,"copy",n=>new fc({...this.options,items:n??[...this.items]})),_(this,"isEqual",n=>bn(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)??Ps.itemToValue(n)),_(this,"getItemDisabled",n=>n==null?!1:this.options.isItemDisabled?.(n)??Ps.isItemDisabled(n)),_(this,"stringifyItem",n=>n==null?null:this.options.itemToString?.(n)??Ps.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 l=n(i,a);r.has(l)||r.set(l,[]),r.get(l).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 l=s.indexOf(i),c=s.indexOf(a);return l===-1?1:c===-1?-1:l-c}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)&&wu(this.stringifyItem(a),n))return a}}),_(this,"search",(n,s)=>{const{state:r,currentValue:o,timeout:i=350}=s,a=r.keysSoFar+n,c=a.length>1&&Array.from(a).every(p=>p===a[0])?a[0]:a,f=this.getByText(c,o),u=this.getItemValue(f);function g(){clearTimeout(r.timer),r.timer=-1}function h(p){r.keysSoFar=p,g(),p!==""&&(r.timer=+setTimeout(()=>{h(""),g()},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(An(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(An(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(An(this.items,r+1,...s))}),_(this,"prepend",(...n)=>this.copy(An(this.items,0,...n))),_(this,"append",(...n)=>this.copy(An(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(ps(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(ps(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(ps(this.items,o,r+1))}),_(this,"reorder",(n,s)=>this.copy(ps(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}},wu=(e,t)=>!!e?.toLowerCase().startsWith(t.toLowerCase());function An(e,t,...n){return[...e.slice(0,t),...n,...e.slice(t)]}function ps(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 hc({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 pc({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 gs({values:e,collection:t,selectedItemMap:n}){const s=hc({values:e,collection:t,selectedItemMap:n}),r=pc({selectedItemMap:n,values:e,selectedItems:s,collection:t});return{selectedItems:s,nextSelectedItemMap:r}}function Eu({selectedItems:e,collection:t}){return pc({selectedItemMap:new Map,values:e.map(n=>t.getItemValue(n)).filter(Boolean),selectedItems:e,collection:t})}var Ks=e=>new uc(e);Ks.empty=()=>new uc({items:[]});var xu=Object.defineProperty,Su=(e,t,n)=>t in e?xu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vr=(e,t,n)=>Su(e,typeof t!="symbol"?t+"":t,n),$u=(e,t)=>e.map((n,s)=>e[(Math.max(t,0)+s)%e.length]),zs=()=>{},hr=e=>typeof e=="object"&&e!==null,P=e=>e?"":void 0,he=e=>e?"true":void 0,Iu=1,Cu=9,Tu=11,fe=e=>hr(e)&&e.nodeType===Iu&&typeof e.nodeName=="string",Yo=e=>hr(e)&&e.nodeType===Cu,ku=e=>hr(e)&&e===e.window,gc=e=>fe(e)?e.localName||"":"#document";function Au(e){return["html","body","#document"].includes(gc(e))}var mc=e=>hr(e)&&e.nodeType!==void 0,fn=e=>mc(e)&&e.nodeType===Tu&&"host"in e,vc=e=>fe(e)&&e.localName==="input",Lu=e=>fe(e)?e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0:!1;function fo(e){if(!e)return!1;const t=e.getRootNode();return pr(t)===e}var Ou=/(textarea|select)/;function Mu(e){if(e==null||!fe(e))return!1;try{return vc(e)&&e.selectionStart!=null||Ou.test(e.localName)||e.isContentEditable||e.getAttribute("contenteditable")==="true"||e.getAttribute("contenteditable")===""}catch{return!1}}function hn(e,t){if(!e||!t||!fe(e)||!mc(t))return!1;if(fe(t)&&e===t||e.contains(t))return!0;const n=t.getRootNode?.();if(n&&fn(n)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function Pe(e){return Yo(e)?e:ku(e)?e.document:e?.ownerDocument??document}function Du(e){return Pe(e).documentElement}function me(e){return fn(e)?me(e.host):Yo(e)?e.defaultView??window:fe(e)?e.ownerDocument?.defaultView??window:window}function pr(e){let t=e.activeElement;for(;t?.shadowRoot;){const n=t.shadowRoot.activeElement;if(!n||n===t)break;t=n}return t}function qi(e,t){return!e||e===Pe(e).body?!1:!t.some(n=>hn(n,e))}function Ru(e){if(gc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||fn(e)&&e.host||Du(e);return fn(t)?t.host:t}function Pu(e){let t;try{if(t=e.getRootNode({composed:!0}),Yo(t)||fn(t))return t}catch{}return e.ownerDocument??document}var Nr=new WeakMap;function yc(e){return Nr.has(e)||Nr.set(e,me(e).getComputedStyle(e)),Nr.get(e)}var Ko=()=>typeof document<"u";function Vu(){return navigator.userAgentData?.platform??navigator.platform}function Nu(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}var zo=e=>Ko()&&e.test(Vu()),Fu=e=>Ko()&&e.test(Nu()),Hu=/^iPhone/i,_u=/^iPad/i,Bu=/^Mac/i,ju=/Android/i,Gi=()=>Ko()&&!!navigator.maxTouchPoints,Wu=()=>zo(Hu),Uu=()=>zo(_u)||Zo()&&navigator.maxTouchPoints>1,bc=()=>Wu()||Uu(),Zo=()=>zo(Bu),qu=()=>Fu(ju),Gu=new Set(["menu","listbox","dialog","grid","tree","region","application"]),Yu=e=>Gu.has(e),Ku=e=>e.getAttribute("aria-controls")?.split(" ")||[];function zu(e,t){const n=new Set,s=Pu(e),r=o=>{const i=o.querySelectorAll("[aria-controls]");for(const a of i){if(a.getAttribute("aria-expanded")!=="true")continue;const l=Ku(a);for(const c of l){if(!c||n.has(c))continue;n.add(c);const f=s.getElementById(c);if(f){const u=f.getAttribute("role"),g=f.getAttribute("aria-modal")==="true";if(u&&Yu(u)&&!g&&(f===t||f.contains(t)||r(f)))return!0}}}return!1};return r(e)}function Zu(e){return e.composedPath?.()??e.nativeEvent?.composedPath?.()}function pt(e){return Zu(e)?.[0]??e.target}function Ju(e){return Jo(e).isComposing||e.keyCode===229}function Xu(e){return e.pointerType===""&&e.isTrusted?!0:qu()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}var Qu=e=>e.button===2||Zo()&&e.ctrlKey&&e.button===0,ef={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"},Yi={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft"};function ho(e,t={}){const{dir:n="ltr",orientation:s="horizontal"}=t;let r=e.key;return r=ef[r]??r,n==="rtl"&&s==="horizontal"&&r in Yi&&(r=Yi[r]),r}function Jo(e){return e.nativeEvent??e}var Vs=(e,t,n,s)=>{const r=typeof e=="function"?e():e;return r?.addEventListener(t,n,s),()=>{r?.removeEventListener(t,n,s)}};function tf(e,t){const{type:n="HTMLInputElement",property:s="value"}=t,r=me(e)[n].prototype;return Object.getOwnPropertyDescriptor(r,s)??{}}function nf(e){if(e.localName==="input")return"HTMLInputElement";if(e.localName==="textarea")return"HTMLTextAreaElement";if(e.localName==="select")return"HTMLSelectElement"}function ms(e,t,n="value"){if(!e)return;const s=nf(e);s&&tf(e,{type:s,property:n}).set?.call(e,t),e.setAttribute(n,t)}function sf(e){return e.matches("textarea, input, select, button")}function rf(e,t){if(!e)return;const n=sf(e)?e.form:e.closest("form"),s=r=>{r.defaultPrevented||t()};return n?.addEventListener("reset",s,{passive:!0}),()=>n?.removeEventListener("reset",s)}function of(e,t){const n=e?.closest("fieldset");if(!n)return;t(n.disabled);const s=me(n),r=new s.MutationObserver(()=>t(n.disabled));return r.observe(n,{attributes:!0,attributeFilter:["disabled"]}),()=>r.disconnect()}function af(e,t){if(!e)return;const{onFieldsetDisabledChange:n,onFormReset:s}=t,r=[rf(e,s),of(e,n)];return()=>r.forEach(o=>o?.())}var wc=Symbol.for("zag.changeEvent");function Ec(e){return Object.prototype.hasOwnProperty.call(e,wc)}function cf(e){return Ec(e)||Object.defineProperty(e,wc,{value:!0}),e}var lf=e=>fe(e)&&e.tagName==="IFRAME";function df(e){const t=e.getAttribute("tabindex");return t?parseInt(t,10):NaN}var uf=e=>df(e)<0;function ff(e){return vc(e)&&e.type==="radio"}function hf(e){if(!ff(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&&gr(o)),r=s.find(o=>o.checked);return r?r===e:s[0]===e}function pf(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 gf(e,t,n){const s=[...e],r=[...e],o=new Set,i=new Map;e.forEach((l,c)=>i.set(l,c));let a=0;for(;a<r.length;){const l=r[a++];if(!l||o.has(l))continue;o.add(l);const c=pf(l,t);if(c){const f=Array.from(c.querySelectorAll(Xo)).filter(n),u=i.get(l);if(u!==void 0){const g=u+1;s.splice(g,0,...f),f.forEach((h,p)=>{i.set(h,g+p)});for(let h=g+f.length;h<s.length;h++)i.set(s[h],h)}else{const g=s.length;s.push(...f),f.forEach((h,p)=>{i.set(h,g+p)})}r.push(...f)}}return s}var Xo="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 gr(e){return!fe(e)||e.closest("[inert]")?!1:e.matches(Xo)&&Lu(e)}function Qo(e,t={}){if(!e)return[];const{includeContainer:n,getShadowRoot:s}=t,r=Array.from(e.querySelectorAll(Xo));n&&Fr(e)&&r.unshift(e);const o=[];for(const i of r)if(Fr(i)){if(lf(i)&&i.contentDocument){const a=i.contentDocument.body;o.push(...Qo(a,{getShadowRoot:s}));continue}o.push(i)}if(s){const i=gf(o,s,Fr);return!i.length&&n?r:i}return!o.length&&n?r:o}function Fr(e){return fe(e)&&e.tabIndex>0?!0:!gr(e)||uf(e)?!1:hf(e)}function mf(e,t={}){const n=Qo(e,t),s=n[0]||null,r=n[n.length-1]||null;return[s,r]}function vf(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=Qo(t).filter(a=>s?s(a):!0).find(a=>!a.hasAttribute("data-no-autofocus"))),o||t||void 0)}function yf(e){const t=e.currentTarget;if(!t)return!1;const[n,s]=mf(t);return!(fo(n)&&e.shiftKey||fo(s)&&!e.shiftKey||!n&&!s)}var xc=class Sc{constructor(){Vr(this,"id",null),Vr(this,"fn_cleanup"),Vr(this,"cleanup",()=>{this.cancel()})}static create(){return new Sc}request(t){this.cancel(),this.id=globalThis.requestAnimationFrame(()=>{this.id=null,this.fn_cleanup=t?.()})}cancel(){this.id!==null&&(globalThis.cancelAnimationFrame(this.id),this.id=null),this.fn_cleanup?.(),this.fn_cleanup=void 0}isActive(){return this.id!==null}};function pe(e){const t=xc.create();return t.request(e),t.cleanup}function $c(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 Hr=new WeakMap;function bf(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 wf(e){const t=bf(e),n=JSON.stringify(t);return{observe(s,r){const o=me(s);if(typeof o.MutationObserver!="function")return zs;const i=Hr.get(s)??new Map;let a=i.get(n);if(!a){const c=new Set,f=new o.MutationObserver(u=>{for(const g of[...c])if(c.has(g))try{g(u)}catch(h){o.queueMicrotask(()=>{throw h})}});f.observe(s,t),a={observer:f,listeners:c},i.set(n,a),Hr.set(s,i)}const l=c=>r(c);return a.listeners.add(l),()=>{!a.listeners.delete(l)||a.listeners.size>0||(a.observer.disconnect(),i.delete(n),i.size===0&&Hr.delete(s))}}}}function Ef(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 xf(e,t){const n=pe,s=[];return s.push(n(()=>{const r=typeof e=="function"?e():e;s.push(Ef(r,t))})),()=>{s.forEach(r=>r?.())}}function po(e){const t=Ru(e);return Au(t)?Pe(t).body:fe(t)&&If(t)?t:po(t)}var Sf=/auto|scroll|overlay|hidden|clip/,$f=new Set(["inline","contents"]);function If(e){const t=me(e),{overflow:n,overflowX:s,overflowY:r,display:o}=t.getComputedStyle(e);return Sf.test(n+r+s)&&!$f.has(o)}var Ki=/auto|scroll|overlay|hidden/;function Cf(e,t={}){const{axis:n}=t,{overflowX:s,overflowY:r}=me(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 rn="default",go="",Ns=new WeakMap;function Tf(e={}){const{target:t,doc:n}=e,s=n??document,r=s.documentElement;return bc()?(rn==="default"&&(go=r.style.webkitUserSelect,r.style.webkitUserSelect="none"),rn="disabled"):t&&(Ns.set(t,t.style.userSelect),t.style.userSelect="none"),()=>Ic({target:t,doc:s})}function Ic(e={}){const{target:t,doc:n}=e,r=(n??document).documentElement;if(bc()){if(rn!=="disabled")return;rn="restoring",setTimeout(()=>{$c(()=>{rn==="restoring"&&(r.style.webkitUserSelect==="none"&&(r.style.webkitUserSelect=go||""),go="",rn="default")})},300)}else if(t&&Ns.has(t)){const o=Ns.get(t);t.style.userSelect==="none"&&(t.style.userSelect=o??""),t.getAttribute("style")===""&&t.removeAttribute("style"),Ns.delete(t)}}function kf(e={}){const{defer:t,target:n,...s}=e,r=t?pe:i=>i(),o=[];return o.push(r(()=>{const i=typeof n=="function"?n():n;o.push(Tf({...s,target:i}))})),()=>{o.forEach(i=>i?.())}}function Af(e,t){return Array.from(e?.querySelectorAll(t)??[])}function Lf(e,t){return e?.querySelector(t)??null}var ei=e=>e.id;function Of(e,t,n=ei){return e.find(s=>n(s)===t)}function Mf(e,t,n=ei){const s=Of(e,t,n);return s?e.indexOf(s):-1}function Df(e,t){const{rootEl:n,...s}=t||{};!e||!n||Cf(n)&&e.scrollIntoView(s)}var zi,Rf=()=>zi??(zi=new Intl.Collator(void 0,{usage:"search",sensitivity:"base"})),Pf=e=>e.normalize("NFC").trim(),Vf=e=>Pf(e.dataset?.valuetext??e.textContent??""),Nf=(e,t)=>{const n=t.normalize("NFC");return Rf().compare(e.slice(0,n.length),n)===0};function Ff(e,t,n,s=ei){const r=n?Mf(e,n,s):-1;let o=n?$u(e,r):e;return t.length===1&&(o=o.filter(a=>s(a)!==n)),o.find(a=>Nf(Vf(a),t))}function Hf(e,t){if(!e)return zs;const n=Object.keys(t).reduce((s,r)=>(s[r]=e.style.getPropertyValue(r),s),{});return _f(n,t)?zs:(Object.assign(e.style,t),()=>{Object.assign(e.style,n),e.style.length===0&&e.removeAttribute("style")})}function _f(e,t){return Object.keys(e).every(n=>e[n]===t[n])}function Bf(e,t){const{state:n,activeId:s,key:r,timeout:o=350,itemToId:i}=t,a=n.keysSoFar+r,c=a.length>1&&Array.from(a).every(p=>p===a[0])?a[0]:a;let f=e.slice();const u=Ff(f,c,s,i);function g(){clearTimeout(n.timer),n.timer=-1}function h(p){n.keysSoFar=p,g(),p!==""&&(n.timer=+setTimeout(()=>{h(""),g()},o))}return h(a),u}var mo=Object.assign(Bf,{defaultOptions:{keysSoFar:"",timer:-1},isValidEvent:jf});function jf(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey}var Wf={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 Uf(e,t,n){const{signal:s}=t;return[new Promise((i,a)=>{const l=setTimeout(()=>{a(new Error(`Timeout of ${n}ms exceeded`))},n);s.addEventListener("abort",()=>{clearTimeout(l),a(new DOMException("Promise aborted","AbortError"))}),e.then(c=>{s.aborted||(clearTimeout(l),i(c))}).catch(c=>{s.aborted||(clearTimeout(l),a(c))})}),()=>t.abort()]}function qf(e,t){const{timeout:n,rootNode:s}=t,r=me(s),o=Pe(s),i=new r.AbortController;let a;const l=Uf(new Promise(f=>{const u=e();if(u){f(u);return}a=new r.MutationObserver(()=>{const g=e();g&&g.isConnected&&(a?.disconnect(),f(g))}),a.observe(o.body,{childList:!0,subtree:!0})}),i,n),c=()=>a?.disconnect();return l[0].then(c,c),l}var Gf=wf({});function Yf(e,t,n={}){const{defer:s,onMissing:r,getRootNode:o}=n,i=()=>typeof e=="function"?e():e,a=[],l=c=>{if(!c)return r?.();a.push(t(c))};if(!s)l(i());else{let c=!1;a.push(()=>{c=!0}),queueMicrotask(()=>{if(c)return;const f=i();if(f){l(f);return}let u=!1;const g=m=>{c||u||(u=!0,p(),d(),l(m))},h=o?.(),p=h?Gf.observe(h,()=>{const m=i();m&&g(m)}):zs,d=pe(()=>g(i()));a.push(p,d)})}return()=>{a.forEach(c=>c?.())}}function Kf(e){return!(e.metaKey||!Zo()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}var zf=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),Zf=["a[href]","audio[controls]","button","details","embed","iframe","img[controls]","img[usemap]","input","select","textarea","video[controls]"].join(",");function Jf(e,t,n){const s=n?pt(n):null,r=Pe(s),o=me(s),i=pr(r);return e=e||i instanceof o.HTMLInputElement&&!zf.has(i?.type)||i instanceof o.HTMLTextAreaElement||i instanceof o.HTMLElement&&i.isContentEditable,!(e&&t==="keyboard"&&n instanceof o.KeyboardEvent&&!Reflect.has(Qf,n.key))}var gt=null,vo=new Set,Zs=new Map,Wt=!1,$t=null,yo=!1,_r=null,Xf=!1,Qf={Tab:!0,Escape:!0};function mr(e,t){for(let n of vo)n(e,t)}function Js(e){$t=null,Wt=!0,Kf(e)&&(gt="keyboard",mr("keyboard",e))}function Ae(e){(e.type==="pointermove"||e.type==="mousemove")&&e.isTrusted&&_r?.x===e.clientX&&_r?.y===e.clientY||(_r={x:e.clientX,y:e.clientY},gt="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&($t=null,Wt=!0,mr("pointer",e)))}function Cc(e){if(Xu(e)){$t=null,Wt=!0,gt="virtual";return}$t=null;const t=pt(e),n=t?.closest("label"),s=n?.control;if(!n||!s||s.matches(":disabled"))return;const r=t?.closest(Zf);r&&n.contains(r)&&r!==s||s!==pr(n.ownerDocument)&&($t=s)}function Tc(e){const t=pt(e),n=t===$t;t===me(t)||t===Pe(t)||Xf||!e.isTrusted||(!Wt&&!n&&!yo&&(gt="virtual",mr("virtual",e)),Wt=!1,$t=null,yo=!1)}function kc(){Wt=!1,$t=null,yo=!0}function eh(e){try{return e.focus}catch{return}}function th(e){const t=e.HTMLElement.prototype;try{let s=function(){Wt=!0,(r??i.call(this)).apply(this,arguments)};var n=s;const r=eh(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 nh(e){if(typeof window>"u"||Zs.get(me(e)))return;const t=me(e),n=Pe(e),s=th(t);n.addEventListener("keydown",Js,!0),n.addEventListener("keyup",Js,!0),n.addEventListener("click",Cc,!0),t.addEventListener("focus",Tc,!0),t.addEventListener("blur",kc,!1),typeof t.PointerEvent<"u"?(n.addEventListener("pointerdown",Ae,!0),n.addEventListener("pointermove",Ae,!0),n.addEventListener("pointerup",Ae,!0)):(n.addEventListener("mousedown",Ae,!0),n.addEventListener("mousemove",Ae,!0),n.addEventListener("mouseup",Ae,!0)),t.addEventListener("beforeunload",()=>{sh(e)},{once:!0}),Zs.set(t,s)}var sh=(e,t)=>{const n=me(e),s=Pe(e),r=Zs.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",Cc,!0),n.removeEventListener("focus",Tc,!0),n.removeEventListener("blur",kc,!1),typeof n.PointerEvent<"u"?(s.removeEventListener("pointerdown",Ae,!0),s.removeEventListener("pointermove",Ae,!0),s.removeEventListener("pointerup",Ae,!0)):(s.removeEventListener("mousedown",Ae,!0),s.removeEventListener("mousemove",Ae,!0),s.removeEventListener("mouseup",Ae,!0)),Zs.delete(n)}};function bo(){return gt}function rh(e){gt=e,mr(e,null)}function Zi(){return gt==="keyboard"||gt==="virtual"}function oh(e={}){const{isTextInput:t,autoFocus:n,onChange:s,root:r}=e;nh(r),s?.({isFocusVisible:n||Zi(),modality:gt});const o=(i,a)=>{Jf(!!t,i,a)&&s?.({isFocusVisible:Zi(),modality:i})};return vo.add(o),()=>{vo.delete(o)}}const ih=["top","right","bottom","left"],Tt=Math.min,at=Math.max,Xs=Math.round,vs=Math.floor,ct=e=>({x:e,y:e}),ah={left:"right",right:"left",bottom:"top",top:"bottom"};function Ac(e,t,n){return at(e,Tt(t,n))}function mt(e,t){return typeof e=="function"?e(t):e}function kt(e){return e.split("-")[0]}function wn(e){return e.split("-")[1]}function ti(e){return e==="x"?"y":"x"}function ni(e){return e==="y"?"height":"width"}function We(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function si(e){return ti(We(e))}function ch(e,t,n){n===void 0&&(n=!1);const s=wn(e),r=si(e),o=ni(r);let i=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(i=Qs(i)),[i,Qs(i)]}function lh(e){const t=Qs(e);return[wo(e),t,wo(t)]}function wo(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ji=["left","right"],Xi=["right","left"],dh=["top","bottom"],uh=["bottom","top"];function fh(e,t,n){switch(e){case"top":case"bottom":return n?t?Xi:Ji:t?Ji:Xi;case"left":case"right":return t?dh:uh;default:return[]}}function hh(e,t,n,s){const r=wn(e);let o=fh(kt(e),n==="start",s);return r&&(o=o.map(i=>i+"-"+r),t&&(o=o.concat(o.map(wo)))),o}function Qs(e){const t=kt(e);return ah[t]+e.slice(t.length)}function ph(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 Lc(e){return typeof e!="number"?ph(e):{top:e,right:e,bottom:e,left:e}}function er(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 Qi(e,t,n){let{reference:s,floating:r}=e;const o=We(t),i=si(t),a=ni(i),l=kt(t),c=o==="y",f=s.x+s.width/2-r.width/2,u=s.y+s.height/2-r.height/2,g=s[a]/2-r[a]/2;let h;switch(l){case"top":h={x:f,y:s.y-r.height};break;case"bottom":h={x:f,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 p=wn(t);return p&&(h[i]+=g*(p==="end"?1:-1)*(n&&c?-1:1)),h}async function gh(e,t){var n;t===void 0&&(t={});const{x:s,y:r,platform:o,rects:i,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:g=!1,padding:h=0}=mt(t,e),p=Lc(h),m=a[g?u==="floating"?"reference":"floating":u],y=er(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:c,rootBoundary:f,strategy:l})),$=u==="floating"?{x:s,y:r,width:i.floating.width,height:i.floating.height}:i.reference,E=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),O=await(o.isElement==null?void 0:o.isElement(E))&&await(o.getScale==null?void 0:o.getScale(E))||{x:1,y:1},M=er(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:$,offsetParent:E,strategy:l}):$);return{top:(y.top-M.top+p.top)/O.y,bottom:(M.bottom-y.bottom+p.bottom)/O.y,left:(y.left-M.left+p.left)/O.x,right:(M.right-y.right+p.right)/O.x}}const mh=50,vh=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:o=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:gh},l=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:f,y:u}=Qi(c,s,l),g=s,h=0;const p={};for(let d=0;d<o.length;d++){const m=o[d];if(!m)continue;const{name:y,fn:$}=m,{x:E,y:O,data:M,reset:D}=await $({x:f,y:u,initialPlacement:s,placement:g,strategy:r,middlewareData:p,rects:c,platform:a,elements:{reference:e,floating:t}});f=E??f,u=O??u,p[y]={...p[y],...M},D&&h<mh&&(h++,typeof D=="object"&&(D.placement&&(g=D.placement),D.rects&&(c=D.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):D.rects),{x:f,y:u}=Qi(c,g,l)),d=-1)}return{x:f,y:u,placement:g,strategy:r,middlewareData:p}},yh=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:r,rects:o,platform:i,elements:a,middlewareData:l}=t,{element:c,padding:f=0}=mt(e,t)||{};if(c==null)return{};const u=Lc(f),g={x:n,y:s},h=si(r),p=ni(h),d=await i.getDimensions(c),m=h==="y",y=m?"top":"left",$=m?"bottom":"right",E=m?"clientHeight":"clientWidth",O=o.reference[p]+o.reference[h]-g[h]-o.floating[p],M=g[h]-o.reference[h],D=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c));let w=D?D[E]:0;(!w||!await(i.isElement==null?void 0:i.isElement(D)))&&(w=a.floating[E]||o.floating[p]);const S=O/2-M/2,x=w/2-d[p]/2-1,k=Tt(u[y],x),b=Tt(u[$],x),A=w-d[p]-b,R=w/2-d[p]/2+S,V=Ac(k,R,A),H=!l.arrow&&wn(r)!=null&&R!==V&&o.reference[p]/2-(R<k?k:b)-d[p]/2<0,Z=H?R<k?R-k:R-A:0;return{[h]:g[h]+Z,data:{[h]:V,centerOffset:R-V-Z,...H&&{alignmentOffset:Z}},reset:H}}}),bh=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:l,elements:c}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:g,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:d=!0,...m}=mt(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const y=kt(r),$=We(a),E=kt(a)===a,O=await(l.isRTL==null?void 0:l.isRTL(c.floating)),M=g||(E||!d?[Qs(a)]:lh(a)),D=p!=="none";!g&&D&&M.push(...hh(a,d,p,O));const w=[a,...M],S=await l.detectOverflow(t,m),x=[];let k=((s=o.flip)==null?void 0:s.overflows)||[];if(f&&x.push(S[y]),u){const V=ch(r,i,O);x.push(S[V[0]],S[V[1]])}if(k=[...k,{placement:r,overflows:x}],!x.every(V=>V<=0)){var b,A;const V=(((b=o.flip)==null?void 0:b.index)||0)+1,H=w[V];if(H&&(!(u==="alignment"?$!==We(H):!1)||k.every(J=>We(J.placement)===$?J.overflows[0]>0:!0)))return{data:{index:V,overflows:k},reset:{placement:H}};let Z=(A=k.filter(re=>re.overflows[0]<=0).sort((re,J)=>re.overflows[1]-J.overflows[1])[0])==null?void 0:A.placement;if(!Z)switch(h){case"bestFit":{var R;const re=(R=k.filter(J=>{if(D){const W=We(J.placement);return W===$||W==="y"}return!0}).map(J=>[J.placement,J.overflows.filter(W=>W>0).reduce((W,we)=>W+we,0)]).sort((J,W)=>J[1]-W[1])[0])==null?void 0:R[0];re&&(Z=re);break}case"initialPlacement":Z=a;break}if(r!==Z)return{reset:{placement:Z}}}return{}}}};function ea(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ta(e){return ih.some(t=>e[t]>=0)}const wh=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:r="referenceHidden",...o}=mt(e,t);switch(r){case"referenceHidden":{const i=await s.detectOverflow(t,{...o,elementContext:"reference"}),a=ea(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:ta(a)}}}case"escaped":{const i=await s.detectOverflow(t,{...o,altBoundary:!0}),a=ea(i,n.floating);return{data:{escapedOffsets:a,escaped:ta(a)}}}default:return{}}}}},Oc=new Set(["left","top"]);async function Eh(e,t){const{placement:n,platform:s,elements:r}=e,o=await(s.isRTL==null?void 0:s.isRTL(r.floating)),i=kt(n),a=wn(n),l=We(n)==="y",c=Oc.has(i)?-1:1,f=o&&l?-1:1,u=mt(t,e);let{mainAxis:g,crossAxis:h,alignmentAxis:p}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),l?{x:h*f,y:g*c}:{x:g*c,y:h*f}}const xh=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,l=await Eh(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:r+l.x,y:o+l.y,data:{...l,placement:i}}}}},Sh=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:l={fn:$=>{let{x:E,y:O}=$;return{x:E,y:O}}},...c}=mt(e,t),f={x:n,y:s},u=await o.detectOverflow(t,c),g=We(r),h=ti(g);let p=f[h],d=f[g];const m=($,E)=>Ac(E+u[$==="y"?"top":"left"],E,E-u[$==="y"?"bottom":"right"]);i&&(p=m(h,p)),a&&(d=m(g,d));const y=l.fn({...t,[h]:p,[g]:d});return{...y,data:{x:y.x-n,y:y.y-s,enabled:{[h]:i,[g]:a}}}}}},$h=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,s;const{x:r,y:o,placement:i,rects:a,middlewareData:l}=t,{offset:c=0,mainAxis:f=!0,crossAxis:u=!0}=mt(e,t),g={x:r,y:o},h=We(i),p=ti(h);let d=g[p],m=g[h];const y=mt(c,t),$=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:(n=y.mainAxis)!=null?n:0,crossAxis:(s=y.crossAxis)!=null?s:0};if(f){const M=p==="y"?"height":"width",D=a.reference[p]-a.floating[M]+$.mainAxis,w=a.reference[p]+a.reference[M]-$.mainAxis;d<D?d=D:d>w&&(d=w)}if(u){var E,O;const M=p==="y"?"width":"height",D=Oc.has(kt(i)),w=a.reference[h]-a.floating[M]+(D&&((E=l.offset)==null?void 0:E[h])||0)+(D?0:$.crossAxis),S=a.reference[h]+a.reference[M]+(D?0:((O=l.offset)==null?void 0:O[h])||0)-(D?$.crossAxis:0);m<w?m=w:m>S&&(m=S)}return{[p]:d,[h]:m}}}},Ih=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}=mt(e,t),l=await r.detectOverflow(t,a),c=kt(n),f=wn(n),u=We(n)==="y",{width:g,height:h}=s.floating;let p,d;c==="top"||c==="bottom"?(p=c,d=f===(await(r.isRTL==null?void 0:r.isRTL(o.floating))?"start":"end")?"left":"right"):(d=c,p=f==="end"?"top":"bottom");const m=h-l.top-l.bottom,y=g-l.left-l.right,$=Tt(h-l[p],m),E=Tt(g-l[d],y),O=t.middlewareData.shift,M=!O;let D=$,w=E;O!=null&&O.enabled.x&&(w=y),O!=null&&O.enabled.y&&(D=m),M&&!f&&(u?w=g-2*at(l.left,l.right):D=h-2*at(l.top,l.bottom)),await i({...t,availableWidth:w,availableHeight:D});const S=await r.getDimensions(o.floating);return g!==S.width||h!==S.height?{reset:{rects:!0}}:{}}}};function vr(){return typeof window<"u"}function En(e){return Mc(e)?(e.nodeName||"").toLowerCase():"#document"}function Se(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function bt(e){var t;return(t=(Mc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Mc(e){return vr()?e instanceof Node||e instanceof Se(e).Node:!1}function Ke(e){return vr()?e instanceof Element||e instanceof Se(e).Element:!1}function Lt(e){return vr()?e instanceof HTMLElement||e instanceof Se(e).HTMLElement:!1}function na(e){return!vr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Se(e).ShadowRoot}function yr(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=ze(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&r!=="inline"&&r!=="contents"}function Ch(e){return/^(table|td|th)$/.test(En(e))}function br(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Th=/transform|translate|scale|rotate|perspective|filter/,kh=/paint|layout|strict|content/,Nt=e=>!!e&&e!=="none";let Br;function ri(e){const t=Ke(e)?ze(e):e;return Nt(t.transform)||Nt(t.translate)||Nt(t.scale)||Nt(t.rotate)||Nt(t.perspective)||!oi()&&(Nt(t.backdropFilter)||Nt(t.filter))||Th.test(t.willChange||"")||kh.test(t.contain||"")}function Ah(e){let t=Ut(e);for(;Lt(t)&&!Xn(t);){if(ri(t))return t;if(br(t))return null;t=Ut(t)}return null}function oi(){return Br==null&&(Br=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Br}function Xn(e){return/^(html|body|#document)$/.test(En(e))}function ze(e){return Se(e).getComputedStyle(e)}function wr(e){return Ke(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ut(e){if(En(e)==="html")return e;const t=e.assignedSlot||e.parentNode||na(e)&&e.host||bt(e);return na(t)?t.host:t}function Dc(e){const t=Ut(e);return Xn(t)?(e.ownerDocument||e).body:Lt(t)&&yr(t)?t:Dc(t)}function Qn(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Dc(e),o=r===((s=e.ownerDocument)==null?void 0:s.body),i=Se(r);if(o){const a=Eo(i);return t.concat(i,i.visualViewport||[],yr(r)?r:[],a&&n?Qn(a):[])}else return t.concat(r,Qn(r,[],n))}function Eo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Rc(e){const t=ze(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=Lt(e),o=r?e.offsetWidth:n,i=r?e.offsetHeight:s,a=Xs(n)!==o||Xs(s)!==i;return a&&(n=o,s=i),{width:n,height:s,$:a}}function ii(e){return Ke(e)?e:e.contextElement}function an(e){const t=ii(e);if(!Lt(t))return ct(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:o}=Rc(t);let i=(o?Xs(n.width):n.width)/s,a=(o?Xs(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Lh=ct(0);function Pc(e){const t=Se(e);return!oi()||!t.visualViewport?Lh:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Oh(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Se(e)}function qt(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=ii(e);let i=ct(1);t&&(s?Ke(s)&&(i=an(s)):i=an(e));const a=Oh(o,n,s)?Pc(o):ct(0);let l=(r.left+a.x)/i.x,c=(r.top+a.y)/i.y,f=r.width/i.x,u=r.height/i.y;if(o&&s){const g=Se(o),h=Ke(s)?Se(s):s;let p=g,d=Eo(p);for(;d&&h!==p;){const m=an(d),y=d.getBoundingClientRect(),$=ze(d),E=y.left+(d.clientLeft+parseFloat($.paddingLeft))*m.x,O=y.top+(d.clientTop+parseFloat($.paddingTop))*m.y;l*=m.x,c*=m.y,f*=m.x,u*=m.y,l+=E,c+=O,p=Se(d),d=Eo(p)}}return er({width:f,height:u,x:l,y:c})}function Er(e,t){const n=wr(e).scrollLeft;return t?t.left+n:qt(bt(e)).left+n}function Vc(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-Er(e,n),r=n.top+t.scrollTop;return{x:s,y:r}}function Mh(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const o=r==="fixed",i=bt(s),a=t?br(t.floating):!1;if(s===i||a&&o)return n;let l={scrollLeft:0,scrollTop:0},c=ct(1);const f=ct(0),u=Lt(s);if((u||!o)&&((En(s)!=="body"||yr(i))&&(l=wr(s)),u)){const h=qt(s);c=an(s),f.x=h.x+s.clientLeft,f.y=h.y+s.clientTop}const g=i&&!u&&!o?Vc(i,l):ct(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+f.x+g.x,y:n.y*c.y-l.scrollTop*c.y+f.y+g.y}}function Dh(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Rh(e){const t=wr(e),n=e.ownerDocument.body,s=at(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=at(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-t.scrollLeft+Er(e);const i=-t.scrollTop;return ze(n).direction==="rtl"&&(o+=at(e.clientWidth,n.clientWidth)-s),{width:s,height:r,x:o,y:i}}const Ph=25;function Vh(e,t,n){n===void 0&&(n="viewport");const s=n==="layoutViewport",r=Se(e),o=bt(e),i=r.visualViewport;let a=o.clientWidth,l=o.clientHeight,c=0,f=0;if(i){const g=!oi()||t==="fixed";s?g||(c=-i.offsetLeft,f=-i.offsetTop):(a=i.width,l=i.height,g&&(c=i.offsetLeft,f=i.offsetTop))}if(Er(o)<=0){const g=o.ownerDocument,h=g.body,p=getComputedStyle(h),d=g.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,m=Math.abs(o.clientWidth-h.clientWidth-d),y=getComputedStyle(o).scrollbarGutter==="stable both-edges"?m/2:m;y<=Ph&&(a-=y)}return{width:a,height:l,x:c,y:f}}function Nh(e,t){const n=qt(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,o=an(e),i=e.clientWidth*o.x,a=e.clientHeight*o.y,l=r*o.x,c=s*o.y;return{width:i,height:a,x:l,y:c}}function sa(e,t,n){let s;if(t==="viewport"||t==="layoutViewport")s=Vh(e,n,t);else if(t==="document")s=Rh(bt(e));else if(Ke(t))s=Nh(t,n);else{const r=Pc(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return er(s)}function Fh(e,t){const n=t.get(e);if(n)return n;let s=Qn(e,[],!1).filter(a=>Ke(a)&&En(a)!=="body"),r=null;const o=ze(e).position==="fixed";let i=o?Ut(e):e;for(;Ke(i)&&!Xn(i);){const a=ze(i),l=ri(i),c=r?r.position:o?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&a.position==="static")?s=s.filter(u=>u!==i):r=a,i=Ut(i)}return t.set(e,s),s}function Hh(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const i=[...n==="clippingAncestors"?br(t)?[]:Fh(t,this._c):[].concat(n),s],a=sa(t,i[0],r);let l=a.top,c=a.right,f=a.bottom,u=a.left;for(let g=1;g<i.length;g++){const h=sa(t,i[g],r);l=at(h.top,l),c=Tt(h.right,c),f=Tt(h.bottom,f),u=at(h.left,u)}return{width:c-u,height:f-l,x:u,y:l}}function _h(e){const{width:t,height:n}=Rc(e);return{width:t,height:n}}function Bh(e,t,n){const s=Lt(t),r=bt(t),o=n==="fixed",i=qt(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const l=ct(0);if((s||!o)&&((En(t)!=="body"||yr(r))&&(a=wr(t)),s)){const g=qt(t,!0,o,t);l.x=g.x+t.clientLeft,l.y=g.y+t.clientTop}!s&&r&&(l.x=Er(r));const c=r&&!s&&!o?Vc(r,a):ct(0),f=i.left+a.scrollLeft-l.x-c.x,u=i.top+a.scrollTop-l.y-c.y;return{x:f,y:u,width:i.width,height:i.height}}function jr(e){return ze(e).position==="static"}function ra(e,t){if(!Lt(e)||ze(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return bt(e)===n&&(n=n.ownerDocument.body),n}function Nc(e,t){const n=Se(e);if(br(e))return n;if(!Lt(e)){let r=Ut(e);for(;r&&!Xn(r);){if(Ke(r)&&!jr(r))return r;r=Ut(r)}return n}let s=ra(e,t);for(;s&&Ch(s)&&jr(s);)s=ra(s,t);return s&&Xn(s)&&jr(s)&&!ri(s)?n:s||Ah(e)||n}const jh=async function(e){const t=this.getOffsetParent||Nc,n=this.getDimensions,s=await n(e.floating);return{reference:Bh(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Wh(e){return ze(e).direction==="rtl"}const Uh={convertOffsetParentRelativeRectToViewportRelativeRect:Mh,getDocumentElement:bt,getClippingRect:Hh,getOffsetParent:Nc,getElementRects:jh,getClientRects:Dh,getDimensions:_h,getScale:an,isElement:Ke,isRTL:Wh};function Fc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function qh(e,t,n){let s=null,r;const o=bt(e);function i(){var f;clearTimeout(r),(f=s)==null||f.disconnect(),s=null}function a(f,u){f===void 0&&(f=!1),u===void 0&&(u=1),i();const g=e.getBoundingClientRect(),{left:h,top:p,width:d,height:m}=g;if(f||t(),!d||!m)return;const y=vs(p),$=vs(o.clientWidth-(h+d)),E=vs(o.clientHeight-(p+m)),O=vs(h),D={rootMargin:-y+"px "+-$+"px "+-E+"px "+-O+"px",threshold:at(0,Tt(1,u))||1};let w=!0;function S(x){const k=x[0].intersectionRatio;if(!Fc(g,e.getBoundingClientRect()))return a();if(k!==u){if(!w)return a();k?a(!1,k):r=setTimeout(()=>{a(!1,1e-7)},1e3)}w=!1}try{s=new IntersectionObserver(S,{...D,root:o.ownerDocument})}catch{s=new IntersectionObserver(S,D)}s.observe(e)}const l=Se(e),c=()=>a(n);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),i()}}function Gh(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:l=!1}=s,c=ii(e),f=r||o?[...c?Qn(c):[],...t?Qn(t):[]]:[];f.forEach(y=>{r&&y.addEventListener("scroll",n),o&&y.addEventListener("resize",n)});const u=c&&a?qh(c,n,o):null;let g=-1,h=null;i&&(h=new ResizeObserver(y=>{let[$]=y;$&&$.target===c&&h&&t&&(h.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var E;(E=h)==null||E.observe(t)})),n()}),c&&!l&&h.observe(c),t&&h.observe(t));let p,d=l?qt(e):null;l&&m();function m(){const y=qt(e);d&&!Fc(d,y)&&n(),d=y,p=requestAnimationFrame(m)}return n(),()=>{var y;f.forEach($=>{r&&$.removeEventListener("scroll",n),o&&$.removeEventListener("resize",n)}),u?.(),(y=h)==null||y.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const Yh=xh,Kh=Sh,zh=bh,Zh=Ih,Jh=wh,Xh=yh,Qh=$h,ep=(e,t,n)=>{const s=new Map,r=n??{},o={...Uh,...r.platform,_c:s};return vh(e,t,{...r,platform:o})};function oa(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 tp(e){if(!e)return oa();const{x:t,y:n,width:s,height:r}=e;return oa(t,n,s,r)}function np(e,t){return{contextElement:fe(e)?e:e?.contextElement,getBoundingClientRect:()=>{const n=e,s=t?.(n);return s||!n?tp(s):n.getBoundingClientRect()}}}var Ln=e=>({variable:e,reference:`var(${e})`}),nt={arrowSize:Ln("--arrow-size"),arrowSizeHalf:Ln("--arrow-size-half"),arrowBg:Ln("--arrow-background"),transformOrigin:Ln("--transform-origin"),arrowOffset:Ln("--arrow-offset")},sp=e=>e==="top"||e==="bottom"?"y":"x";function rp(e,t){return{name:"transformOrigin",fn(n){const{elements:s,middlewareData:r,placement:o,rects:i,y:a}=n,l=o.split("-")[0],c=sp(l),f=r.arrow?.x||0,u=r.arrow?.y||0,g=t?.clientWidth||0,h=t?.clientHeight||0,p=f+g/2,d=u+h/2,m=Math.abs(r.shift?.y||0),y=i.reference.height/2,$=h/2,E=e.offset?.mainAxis??e.gutter,O=typeof E=="number"?E+$:E??$,M=m>O,D={top:`${p}px calc(100% + ${O}px)`,bottom:`${p}px ${-O}px`,left:`calc(100% + ${O}px) ${d}px`,right:`${-O}px ${d}px`}[l],w=`${p}px ${i.reference.y+y-a}px`,S=!!e.overlap&&c==="y"&&M;return s.floating.style.setProperty(nt.transformOrigin.variable,S?w:D),{data:{transformOrigin:S?w:D}}}}}var op={name:"rects",fn({rects:e}){return{data:e}}},ip=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% + ${nt.arrowOffset.reference})`}),{}}}};function ap(e){const[t,n]=e.split("-");return{side:t,align:n,hasAlign:n!=null}}function Hc(e){return e.split("-")[0]}var cp={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 ia(e,t){const n=e.devicePixelRatio||1;return Math.round(t*n)/n}function on(e,t){return e!=null&&Math.abs(e-t)<.5}function xr(e){return typeof e=="function"?e():e==="clipping-ancestors"?"clippingAncestors":e}function lp(e,t,n){const s=e||t.createElement("div");return Xh({element:s,padding:n.arrowPadding})}function dp(e,t){if(!lu(t.offset??t.gutter))return Yh(({placement:n})=>{const s=(e?.clientHeight||0)/2,r=t.offset?.mainAxis??t.gutter,o=typeof r=="number"?r+s:r??s,{hasAlign:i}=ap(n),a=i?void 0:t.shift,l=t.offset?.crossAxis??a;return Go({crossAxis:l,mainAxis:o,alignmentAxis:t.shift})})}function up(e){if(e.flip)return zh(()=>{const t=xr(e.boundary);return{...t?{boundary:t}:void 0,padding:e.overflowPadding,fallbackPlacements:e.flip===!0?void 0:e.flip}})}function fp(e){if(!(!e.slide&&!e.overlap))return Kh(()=>{const t=xr(e.boundary);return{...t?{boundary:t}:void 0,mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:Qh()}})}function hp(e){if(e.sizeMiddleware===!1&&!e.sameWidth&&!e.fitViewport)return;let t,n,s,r;return Zh(()=>{const o=xr(e.boundary);return{padding:e.overflowPadding,...o?{boundary:o}:void 0,apply({elements:i,rects:a,availableHeight:l,availableWidth:c}){const f=i.floating,u=Math.round(a.reference.width),g=Math.round(a.reference.height);c=Math.floor(c),l=Math.floor(l),on(t,u)||(f.style.setProperty("--reference-width",`${u}px`),t=u),on(n,g)||(f.style.setProperty("--reference-height",`${g}px`),n=g),on(s,c)||(f.style.setProperty("--available-width",`${c}px`),s=c),on(r,l)||(f.style.setProperty("--available-height",`${l}px`),r=l)}}})}function pp(e){if(e.hideWhenDetached)return Jh(()=>({strategy:"referenceHidden",boundary:xr(e.boundary)??"clippingAncestors"}))}function gp(e){return e?e===!0?{ancestorResize:!0,ancestorScroll:!0,elementResize:!0,layoutShift:!0}:e:{}}var mp=["transform","visibility","pointer-events","--x","--y","--z-index","z-index","--reference-width","--reference-height","--available-width","--available-height","--transform-origin"],vp=["top","right","bottom","left"],jn=new WeakSet;function yp(e,t){const n=e.style.getPropertyValue("z-index"),s=jn.has(e),r=s&&n==="var(--z-index)";s&&!r&&jn.delete(e);const o=yc(t).zIndex;if(o==="auto"){r&&(e.style.removeProperty("z-index"),jn.delete(e));return}n&&!r||(e.style.setProperty("--z-index",o),e.style.setProperty("z-index","var(--z-index)"),jn.add(e))}function aa(e,t){if(!e)return cc;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 ca(e){return e==null?null:fe(e)?e:typeof e=="object"&&e&&"contextElement"in e&&e.contextElement?e.contextElement:e}function bp(e,t,n={}){const s=()=>(typeof t=="function"?t():t)??null,r=()=>{const k=typeof e=="function"?e():e;return n.getAnchorElement?.()??k},o=()=>{const k=r();return!k&&!n.getAnchorRect?null:np(k,n.getAnchorRect)},i=Object.assign({},cp,n);let a=[],l=null,c,f;function u(k){if(c?.(),f?.(),l=k,i.restoreStyles){const A=aa(k,mp);c=()=>{A(),jn.delete(k)}}else c=void 0;const b=k.querySelector("[data-part=arrow]");f=i.restoreStyles?aa(b,vp):void 0,a=[dp(b,i),up(i),fp(i),lp(b,k.ownerDocument,i),ip(b),rp({gutter:i.gutter,offset:i.offset,overlap:i.overlap},b),hp(i),pp(i),op]}const{placement:g,strategy:h,onComplete:p,onPositioned:d}=i;let m,y,$=!1,E,O,M=cc;const D=gp(i.listeners);function w(){if(!i.listeners)return;const k=r(),b=o(),A=s();if(!b||!A)return;(ca(k)!==ca(E)||A!==O)&&(M(),E=k,O=A,M=Gh(b,A,x,D))}async function S(){w();const k=s();if(!k)return;k!==l&&(u(k),$=!1);const b=o();if(!b)return;const A=await ep(b,k,{placement:g,middleware:a,strategy:h}),R=me(k),V=ia(R,A.x),H=ia(R,A.y);if(p?.({...A,x:V,y:H}),i.applyStyles!==!1&&(on(m,V)||(k.style.setProperty("--x",`${V}px`),m=V),on(y,H)||(k.style.setProperty("--y",`${H}px`),y=H),i.hideWhenDetached&&(A.middlewareData.hide?.referenceHidden?(k.style.setProperty("visibility","hidden"),k.style.setProperty("pointer-events","none")):(k.style.removeProperty("visibility"),k.style.removeProperty("pointer-events"))),!$)){const Z=k.firstElementChild;Z&&(yp(k,Z),$=!0)}}async function x(){n.updatePosition?(await n.updatePosition({updatePosition:S,floatingElement:s()}),d?.({placed:!0})):await S()}return x(),()=>{M(),f?.(),c?.(),d?.({placed:!1})}}function xo(e,t,n={}){const{defer:s,...r}=n,o=s?pe:a=>a(),i=[];return i.push(o(()=>{i.push(bp(e,t,r))})),()=>{i.forEach(a=>a?.())}}var wp={bottom:"rotate(45deg)",left:"rotate(135deg)",top:"rotate(225deg)",right:"rotate(315deg)"};function _c(e={}){const{placement:t,sameWidth:n,fitViewport:s,strategy:r="absolute",applyStyles:o=!0}=e;return{arrow:{position:"absolute",width:nt.arrowSize.reference,height:nt.arrowSize.reference,[nt.arrowSizeHalf.variable]:`calc(${nt.arrowSize.reference} / 2)`,[nt.arrowOffset.variable]:`calc(${nt.arrowSizeHalf.reference} * -1)`},arrowTip:{transform:t?wp[t.split("-")[0]]:void 0,background:nt.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 Ep=e=>e.ids?.root??`select:${e.id}`,So=e=>e.ids?.content??`select:${e.id}:content`,$o=e=>e.ids?.trigger??`select:${e.id}:trigger`,Bc=e=>e.ids?.clearTrigger??`select:${e.id}:clear-trigger`,ys=e=>e.ids?.label??`select:${e.id}:label`,xp=e=>e.ids?.control??`select:${e.id}:control`,Io=(e,t)=>e.ids?.item?.(t)??`select:${e.id}:option:${t}`,Co=e=>e.ids?.hiddenSelect??`select:${e.id}:select`,jc=e=>e.ids?.positioner??`select:${e.id}:positioner`,Sp=(e,t)=>e.ids?.itemGroup?.(t)??`select:${e.id}:optgroup:${t}`,la=(e,t)=>e.ids?.itemGroupLabel?.(t)??`select:${e.id}:optgroup-label:${t}`,Wr=e=>e.getById(Co(e)),On=e=>e.getById(So(e)),Bt=e=>e.getById($o(e)),$p=e=>e.getById(Bc(e)),Ur=e=>e.getById(jc(e)),qr=(e,t)=>t==null?null:e.getById(Io(e,t)),Ip={clearTriggerLabel:"Clear value"};function Cp(e,t){const{context:n,prop:s,scope:r,state:o,computed:i,send:a}=e,l=dc(Ip,s("translations")),c=s("disabled")||n.get("fieldsetDisabled"),f=!!s("invalid"),u=!!s("required"),g=!!s("readOnly"),h=s("composite"),p=s("collection"),d=o.hasTag("open"),m=o.matches("focused"),y=n.get("highlightedValue"),$=n.get("highlightedItem"),E=i("selectedItems"),O=n.get("currentPlacement"),M=O?Hc(O):void 0,D=i("isTypingAhead"),w=i("isInteractive"),S=y?Io(r,y):void 0;function x(b){const A=p.getItemDisabled(b.item),R=p.getItemValue(b.item);return fr(R,()=>`[zag-js] No value found for item ${JSON.stringify(b.item)}`),{value:R,disabled:!!(c||A),highlighted:y===R,selected:n.get("value").includes(R)}}const k=_c({...s("positioning"),placement:O});return{open:d,focused:m,empty:n.get("value").length===0,highlightedItem:$,highlightedValue:y,selectedItems:E,hasSelectedItems:i("hasSelectedItems"),value:n.get("value"),valueAsString:i("valueAsString"),collection:p,multiple:!!s("multiple"),disabled:!!c,reposition(b={}){a({type:"POSITIONING.SET",options:b})},focus(){Bt(r)?.focus({preventScroll:!0})},setOpen(b){a({type:b?"OPEN":"CLOSE",replaces:"open"})},selectValue(b){a({type:"ITEM.SELECT",value:b})},setValue(b){a({type:"VALUE.SET",value:b})},selectAll(){a({type:"VALUE.SET",value:p.getValues()})},setHighlightValue(b){a({type:"HIGHLIGHTED_VALUE.SET",value:b})},clearHighlightValue(){a({type:"HIGHLIGHTED_VALUE.CLEAR"})},clearValue(b){a(b?{type:"ITEM.CLEAR",value:b}:{type:"VALUE.CLEAR"})},getItemState:x,getRootProps(){return t.element({...ye.root.attrs,dir:s("dir"),id:Ep(r),"data-invalid":P(f),"data-readonly":P(g)})},getLabelProps(){return t.label({dir:s("dir"),id:ys(r),...ye.label.attrs,"data-disabled":P(c),"data-invalid":P(f),"data-readonly":P(g),"data-required":P(u),htmlFor:Co(r),onClick(b){b.defaultPrevented||c||Bt(r)?.focus({preventScroll:!0})}})},getControlProps(){return t.element({...ye.control.attrs,dir:s("dir"),id:xp(r),"data-state":d?"open":"closed","data-focus":P(m),"data-disabled":P(c),"data-invalid":P(f)})},getValueTextProps(){return t.element({...ye.valueText.attrs,dir:s("dir"),"data-disabled":P(c),"data-invalid":P(f),"data-focus":P(m)})},getTriggerProps(){return t.button({id:$o(r),disabled:c,dir:s("dir"),type:"button",role:"combobox","aria-controls":So(r),"aria-expanded":d,"aria-haspopup":"listbox","data-state":d?"open":"closed","aria-invalid":f,"aria-required":u,"aria-labelledby":ys(r),...ye.trigger.attrs,"data-disabled":P(c),"data-invalid":P(f),"data-readonly":P(g),"data-placement":O,"data-side":M,"data-placeholder-shown":P(!i("hasSelectedItems")),onClick(b){w&&(b.defaultPrevented||a({type:"TRIGGER.CLICK"}))},onFocus(){a({type:"TRIGGER.FOCUS"})},onBlur(){a({type:"TRIGGER.BLUR"})},onKeyDown(b){if(b.defaultPrevented||!w)return;const R={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(D?{type:"TRIGGER.TYPEAHEAD",key:V.key}:{type:"TRIGGER.ENTER"})}}[ho(b,{dir:s("dir"),orientation:"vertical"})];if(R){R(b),b.preventDefault();return}mo.isValidEvent(b)&&(a({type:"TRIGGER.TYPEAHEAD",key:b.key}),b.preventDefault())}})},getIndicatorProps(){return t.element({...ye.indicator.attrs,dir:s("dir"),"aria-hidden":!0,"data-state":d?"open":"closed","data-disabled":P(c),"data-invalid":P(f),"data-readonly":P(g)})},getItemProps(b){const A=x(b);return t.element({id:Io(r,A.value),role:"option",...ye.item.attrs,dir:s("dir"),"data-value":A.value,"aria-selected":A.selected,"data-state":A.selected?"checked":"unchecked","data-highlighted":P(A.highlighted),"data-disabled":P(A.disabled),"aria-disabled":he(A.disabled),onPointerMove(R){A.disabled||R.pointerType!=="mouse"||bo()==="pointer"&&A.value!==y&&a({type:"ITEM.POINTER_MOVE",value:A.value})},onClick(R){R.defaultPrevented||A.disabled||a({type:"ITEM.CLICK",src:"pointerup",value:A.value})},onPointerLeave(R){A.disabled||b.persistFocus||R.pointerType==="mouse"&&bo()==="pointer"&&a({type:"ITEM.POINTER_LEAVE"})}})},getItemTextProps(b){const A=x(b);return t.element({...ye.itemText.attrs,"data-state":A.selected?"checked":"unchecked","data-disabled":P(A.disabled),"data-highlighted":P(A.highlighted)})},getItemIndicatorProps(b){const A=x(b);return t.element({"aria-hidden":!0,...ye.itemIndicator.attrs,"data-state":A.selected?"checked":"unchecked",hidden:!A.selected})},getItemGroupLabelProps(b){const{htmlFor:A}=b;return t.element({...ye.itemGroupLabel.attrs,id:la(r,A),dir:s("dir"),role:"presentation"})},getItemGroupProps(b){const{id:A}=b;return t.element({...ye.itemGroup.attrs,"data-disabled":P(c),id:Sp(r,A),"aria-labelledby":la(r,A),role:"group",dir:s("dir")})},getClearTriggerProps(){return t.button({...ye.clearTrigger.attrs,id:Bc(r),type:"button","aria-label":l.clearTriggerLabel,"data-invalid":P(f),disabled:c,hidden:!i("hasSelectedItems"),dir:s("dir"),onClick(b){b.defaultPrevented||a({type:"CLEAR.CLICK"})}})},getHiddenSelectProps(){const b=n.get("value"),A=s("multiple")?b:b?.[0],R=V=>{const H=Jo(V);Ec(H)||a({type:"VALUE.SET",value:Tp(V.currentTarget)})};return t.select({name:s("name"),form:s("form"),disabled:c,multiple:s("multiple"),required:s("required"),"aria-hidden":!0,id:Co(r),defaultValue:A,style:Wf,tabIndex:-1,autoComplete:s("autoComplete"),onChange:R,onInput:R,onFocus(){Bt(r)?.focus({preventScroll:!0})},"aria-labelledby":ys(r)})},getPositionerProps(){return t.element({...ye.positioner.attrs,dir:s("dir"),id:jc(r),style:k.floating})},getContentProps(){return t.element({hidden:!d,dir:s("dir"),id:So(r),role:h?"listbox":"dialog",...ye.content.attrs,"data-state":d?"open":"closed","data-placement":O,"data-side":M,"data-activedescendant":S,"aria-activedescendant":h?S:void 0,"aria-multiselectable":s("multiple")&&h?!0:void 0,"aria-labelledby":ys(r),tabIndex:0,onKeyDown(b){if(!w||!hn(b.currentTarget,pt(b)))return;if(b.key==="Tab"&&!yf(b)){b.preventDefault();return}const A={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){D?a({type:"CONTENT.TYPEAHEAD",key:H.key}):A.Enter?.()}},R=A[ho(b)];if(R){R(b),b.preventDefault();return}const V=pt(b);Mu(V)||mo.isValidEvent(b)&&(a({type:"CONTENT.TYPEAHEAD",key:b.key}),b.preventDefault())}})},getListProps(){return t.element({...ye.list.attrs,tabIndex:0,role:h?void 0:"listbox","aria-labelledby":$o(r),"aria-activedescendant":h?void 0:S,"aria-multiselectable":!h&&s("multiple")?!0:void 0})}}}var Tp=e=>e.multiple?Array.from(e.selectedOptions,t=>t.value):e.value?[e.value]:[];function kp(e,t,n){let s=[],r;return o=>{const i=e(o);return(i.length!==s.length||i.some((l,c)=>!bn(s[c],l)))&&(s=i,r=t(i,o)),r}}function Ap(){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 Ot=".",Wc="#",da=new WeakMap,Uc=new WeakMap;function To(e){return e.join(Ot)}function Lp(e){return e.includes(Ot)}function qc(e){return e.startsWith(Wc)}function Op(e){return e.startsWith(Ot)}function Mp(e){return qc(e)?e.slice(Wc.length):e}function ko(e,t){return e?`${e}${Ot}${t}`:t}function Dp(e){const t=new Map,n=new Map,s=(r,o)=>{t.set(r,o);const i=o.id;i&&(n.has(i)&&Ui(`[zag-js] Duplicate state id: "${i}"`),n.set(i,r));const a=o.states;if(a){fr(o.initial,()=>`[zag-js] Compound state "${r}" has child states but no "initial" property`),o.initial in a||Ui(`[zag-js] Compound state "${r}" has initial "${String(o.initial)}" which is not a child state`);for(const[l,c]of Object.entries(a)){if(!c)continue;const f=ko(r,l);s(f,c)}}};for(const[r,o]of Object.entries(e.states))o&&s(r,o);return{index:t,idIndex:n}}function os(e){const t=da.get(e);if(t)return t;const{index:n,idIndex:s}=Dp(e);return da.set(e,n),Uc.set(e,s),n}function Rp(e,t){return os(e),Uc.get(e)?.get(t)}function ai(e){return e?String(e).split(Ot).filter(Boolean):[]}function tr(e,t){if(!t)return[];const n=os(e),s=ai(t),r=[],o=[];for(const i of s){o.push(i);const a=To(o),l=n.get(a);if(!l)break;r.push({path:a,state:l})}return r}function Mn(e,t){const n=os(e),s=ai(t);if(!s.length)return t;const r=[];for(const a of s){r.push(a);const l=To(r);if(!n.has(l))return t}let o=To(r),i=n.get(o);for(;i?.initial;){const a=`${o}${Ot}${i.initial}`,l=n.get(a);if(!l)break;o=a,i=l}return o}function ua(e,t){return os(e).has(t)}function fa(e,t,n){const s=String(t);if(qc(s)){const r=Mp(s),o=Rp(e,r);return fr(o,()=>`[zag-js] Unknown state id: "${r}"`),Mn(e,o)}if(Op(s)&&n){const r=ko(n,s.slice(1));return Mn(e,r)}if(!Lp(s)&&n){const r=ai(n);for(let o=r.length-1;o>=1;o--){const i=r.slice(0,o).join(Ot),a=ko(i,s);if(ua(e,a))return Mn(e,a)}if(ua(e,s))return Mn(e,s)}return Mn(e,s)}function Pp(e,t,n){const s=tr(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 Vp(e,t,n,s){const r=t?tr(e,t):[],o=tr(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(),l=o.slice(i);const c=r[r.length-1]?.path===o[o.length-1]?.path;return s&&c&&(a=r.slice().reverse(),l=o),{exiting:a,entering:l}}function Np(e,t){return e?e===t||e.startsWith(`${t}${Ot}`):!1}function Fp(e,t,n){return tr(e,t).some(s=>s.state.tags?.includes(n))}function Gc(){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 Yc(e){return os(e),e}var Wn=(e=>(e.NotStarted="Not Started",e.Started="Started",e.Stopped="Stopped",e))(Wn||{}),bs="__init__";function Hp(e){const t=()=>e.getRootNode?.()??document,n=()=>Pe(t());return{...e,getRootNode:t,getDoc:n,getWin:()=>n().defaultView??window,getActiveElement:()=>pr(t()),isActiveElement:fo,getById:i=>t().getElementById(i)}}function _p(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 Bp(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 ha="pointerdown.outside",pa="focus.outside";function jp(e){for(const t of e)if(fe(t)&&gr(t))return!0;return!1}var Kc=e=>"clientY"in e;function Wp(e,t){if(!Kc(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 Up(e,t){return e.y<=t.y&&t.y<=e.y+e.height&&e.x<=t.x&&t.x<=e.x+e.width}function ga(e,t){if(!t||!Kc(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 Up(i,a)?s||o:!1}function qp(e,t){const{exclude:n,onFocusOutside:s,onPointerDownOutside:r,onInteractOutside:o,defer:i,followControlledElements:a=!0}=t;if(!e)return;const l=Pe(e),c=me(e),f=_p(c),u=Bp(c);function g(M,D){if(!fe(D)||!D.isConnected||hn(e,D)||Wp(e,M)||a&&zu(e,D))return!1;const w=l.querySelector(`[aria-controls="${e.id}"]`);if(w){const x=po(w);if(ga(M,x))return!1}const S=po(e);return ga(M,S)?!1:!n?.(D)}const h=new Set,p=fn(e?.getRootNode());let d=!1;function m(M){d=!0;const D=()=>{d=!1};l.addEventListener("pointerup",D,{once:!0}),c.addEventListener("pointerup",D,{once:!0});function w(S){const x=i&&!Gi()?pe:A=>A(),k=S??M,b=k?.composedPath?.()??[k?.target];x(()=>{const A=p?b[0]:pt(M);if(!(!e||!g(M,A))){if(r||o){const R=Ys(r,o);e.addEventListener(ha,R,{once:!0})}ma(e,ha,{bubbles:!1,cancelable:!0,detail:{originalEvent:k,contextmenu:Qu(k),focusable:jp(b),target:A}})}})}M.pointerType==="touch"?(h.forEach(S=>S()),h.add(Vs(l,"click",w,{once:!0})),h.add(u.addEventListener("click",w,{once:!0})),h.add(f.addEventListener("click",w,{once:!0}))):w()}const y=new Set,$=setTimeout(()=>{y.add(Vs(l,"pointerdown",m,!0)),y.add(u.addEventListener("pointerdown",m,!0)),y.add(f.addEventListener("pointerdown",m,!0))},0),E=xc.create();function O(M){if(d)return;(i?w=>E.request(w):w=>w())(()=>{const w=M?.composedPath?.()??[M?.target],S=p?w[0]:pt(M);if(!(!e||!g(M,S))){if(s||o){const x=Ys(s,o);e.addEventListener(pa,x,{once:!0})}ma(e,pa,{bubbles:!1,cancelable:!0,detail:{originalEvent:M,contextmenu:!1,focusable:gr(S),target:S}})}})}return Gi()||(y.add(Vs(l,"focusin",O,!0)),y.add(u.addEventListener("focusin",O,!0)),y.add(f.addEventListener("focusin",O,!0))),()=>{clearTimeout($),E.cancel(),h.forEach(M=>M()),y.forEach(M=>M())}}function Gp(e,t){const{defer:n}=t,s=n?pe:o=>o(),r=[];return r.push(s(()=>{const o=typeof e=="function"?e():e;r.push(qp(o,t))})),()=>{r.forEach(o=>o?.())}}function ma(e,t,n){const s=e.ownerDocument.defaultView||window,r=new s.CustomEvent(t,n);return e.dispatchEvent(r)}function Yp(e,t){const n=s=>{s.key==="Escape"&&(s.isComposing||t?.(s))};return Vs(Pe(e),"keydown",n,{capture:!0})}var va="layer:request-dismiss",xe={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=>hn(s.node,t))||this.recentlyRemoved.size>0)},isInBranch(e){return Array.from(this.branches).some(t=>hn(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&&Kp(r)}),this.recentlyRemoved.add(e),$c(()=>this.recentlyRemoved.delete(e)),t<this.count()-1&&this.getNestedLayers(e).forEach(r=>xe.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)=>{ya(e,t,e.node),e.styleTargets?.forEach(n=>{const s=n();if(!s||s===e.node)return;ya(e,t,s);const{zIndex:r}=yc(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];Zp(e,va,r=>{s.requestDismiss?.(r),r.defaultPrevented||s?.dismiss()}),zp(e,va,{originalLayer:e,targetLayer:t,originalIndex:n,targetIndex:t?this.indexOf(t):-1}),this.syncLayers()},clear(){this.remove(this.layers[0].node)}};function ya(e,t,n){n.style.setProperty("--layer-index",`${t}`),n.removeAttribute("data-nested"),n.removeAttribute("data-has-nested"),xe.getParentLayerOfType(e.node,e.type)&&n.setAttribute("data-nested",e.type);const r=xe.countNestedLayersOfType(e.node,e.type);r>0&&n.setAttribute("data-has-nested",e.type),n.style.setProperty("--nested-layer-count",`${r}`)}function Kp(e){e.style.removeProperty("--layer-index"),e.style.removeProperty("--nested-layer-count"),e.removeAttribute("data-nested"),e.removeAttribute("data-has-nested")}function zp(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 Zp(e,t,n){e.addEventListener(t,n,{once:!0})}var Gr=new WeakMap,zn=new WeakMap;function Jp(e){return xe.isBelowPointerBlockingLayer(e)?"none":"auto"}function zc(e){const t=Jp(e);e.style.pointerEvents!==t&&(e.style.pointerEvents=t)}function Xp(e){if(zn.has(e))return;const t=me(e);if(typeof t.MutationObserver>"u")return;const n=new t.MutationObserver(()=>{zn.has(e)&&zc(e)});n.observe(e,{attributes:!0,attributeFilter:["style"]}),zn.set(e,n)}function ba(){xe.layers.forEach(({node:e})=>{zc(e),Xp(e)})}function Qp(e){const t=zn.get(e);t&&(t.disconnect(),zn.delete(e)),e.style.pointerEvents=""}function eg(e,t){const n=Pe(e),s=[];return xe.hasPointerBlockingLayer()&&!n.body.hasAttribute("data-inert")&&(Gr.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]=qf(()=>{const a=r();return fe(a)?a:null},{timeout:1e3});o.then(a=>s.push(Hf(a,{pointerEvents:"auto"}))),s.push(i)}),()=>{xe.hasPointerBlockingLayer()||(queueMicrotask(()=>{const r=n.body;if(!r)return;const o=Gr.get(r);o!==void 0&&(r.style.pointerEvents=o,Gr.delete(r)),r.removeAttribute("data-inert"),r.style.length===0&&r.removeAttribute("style")}),s.forEach(r=>r()))}}function tg(e,t){const{onDismiss:n,onRequestDismiss:s,pointerBlocking:r,exclude:o,debug:i,type:a="dialog",layerStyleTargets:l}=t,c={dismiss:n,node:e,type:a,pointerBlocking:r,requestDismiss:s,styleTargets:l};xe.add(c),ba();function f(d){const m=pt(d.detail.originalEvent);xe.isBelowPointerBlockingLayer(e)||xe.isInBranch(m)||(t.onPointerDownOutside?.(d),t.onInteractOutside?.(d),!d.defaultPrevented&&(i&&console.log("onPointerDownOutside:",d.detail.originalEvent),n?.(d)))}function u(d){const m=pt(d.detail.originalEvent);xe.isInBranch(m)||(t.onFocusOutside?.(d),t.onInteractOutside?.(d),!d.defaultPrevented&&(i&&console.log("onFocusOutside:",d.detail.originalEvent),n?.(d)))}function g(d){xe.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],$=t.persistentElements?.map(E=>E()).filter(fe);return $&&y.push(...$),y.some(E=>hn(E,d))||xe.isInNestedLayer(e,d)}const p=[r?eg(e,t.persistentElements):void 0,Yp(e,g),Gp(e,{exclude:h,onFocusOutside:u,onPointerDownOutside:f,defer:t.defer})];return()=>{xe.remove(e),ba(),Qp(e),p.forEach(d=>d?.())}}function Zc(e,t){const{warnOnMissingNode:n=!0}=t;return Yf(e,s=>tg(s,t),{defer:t.defer,getRootNode:t.getRootNode,onMissing:n?()=>Rs("[@zag-js/dismissable] node is `null` or `undefined`"):void 0})}var{and:Dn,not:Ft,or:ng}=Gc(),sg=Yc({props({props:e}){return{loopFocus:!1,closeOnSelect:!e.multiple,composite:!0,defaultValue:[],...e,collection:e.collection??Ks.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:bn,onChange(o){const i=n(),a=e("collection"),l=i.get("selectedItemMap"),c=gs({values:o,collection:a,selectedItemMap:l}),f=e("value")??o,u=f===o?c:gs({values:f,collection:a,selectedItemMap:c.nextSelectedItemMap});return i.set("selectedItemMap",u.nextSelectedItemMap),e("onValueChange")?.({value:o,items:c.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:Eu({selectedItems:r,collection:e("collection")})}))}},refs(){return{typeahead:{...mo.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})=>hc({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:ng("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:Dn(Ft("multiple"),"hasSelectedItems"),actions:["selectPreviousItem"]},{guard:Ft("multiple"),actions:["selectLastItem"]}],"TRIGGER.ARROW_RIGHT":[{guard:Dn(Ft("multiple"),"hasSelectedItems"),actions:["selectNextItem"]},{guard:Ft("multiple"),actions:["selectFirstItem"]}],"TRIGGER.HOME":{guard:Ft("multiple"),actions:["selectFirstItem"]},"TRIGGER.END":{guard:Ft("multiple"),actions:["selectLastItem"]},"TRIGGER.TYPEAHEAD":{guard:Ft("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:Dn("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:Dn("hasHighlightedItem","loop","isLastItemHighlighted"),actions:["highlightFirstItem"]},{guard:"hasHighlightedItem",actions:["highlightNextItem"]},{actions:["highlightFirstItem"]}],"CONTENT.ARROW_UP":[{guard:Dn("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})=>wa(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 oh({root:e.getRootNode?.()})},trackFormControlState({context:e,scope:t}){return af(Wr(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=()=>On(e);let r=!0;return Zc(s,{type:"listbox",defer:!0,getRootNode:e.getRootNode,layerStyleTargets:[()=>Ur(e)],exclude:[Bt(e),$p(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),xo(()=>Bt(n),()=>Ur(n),{defer:!0,...s,onComplete(i){e.set("currentPlacement",i.placement)}})},scrollToHighlightedItem({context:e,prop:t,scope:n}){const s=a=>{const l=e.get("highlightedValue");if(l==null||bo()==="pointer")return;const f=On(n),u=t("scrollToIndexFn");if(u){const h=t("collection").indexOf(l);u?.({index:h,immediate:a,getElement:()=>qr(n,l)});return}const g=qr(n,l);Df(g,{rootEl:f,block:"nearest"})},r=pe(()=>{rh("virtual"),s(!0)}),i=xf(()=>On(n),{attributes:["data-activedescendant"],callback(){s(!1)}});return()=>{r(),i()}}},actions:{reposition({context:e,prop:t,scope:n,event:s}){const r=()=>Ur(n);xo(Bt(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}){pe(()=>{const t=vf({root:On(e)});t&&t.focus({preventScroll:!0})})},focusTriggerEl({event:e,scope:t}){if(!wa(e))return;const n=rg(e);pe(()=>{Bt(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")?_i(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")?_i(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:()=>qr(t,n)})}else On(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=Wr(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=gs({values:e.get("value"),collection:n,selectedItemMap:e.get("selectedItemMap")});e.set("selectedItemMap",r.nextSelectedItemMap)},syncSelectedItems({context:e,prop:t}){const n=gs({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=Wr(e);if(!t)return;const n=e.getWin(),s=new n.Event("change",{bubbles:!0,composed:!0});t.dispatchEvent(cf(s))})}}}});function wa(e){const t=e.restoreFocus??e.previousEvent?.restoreFocus;return t==null||!!t}function rg(e){return e.focusVisible??e.previousEvent?.focusVisible?{preventScroll:!0,focusVisible:!0}:{preventScroll:!0}}function og(e){return new Proxy({},{get(t,n){return n==="style"?s=>e({style:s}).style:e}})}var ig=Object.defineProperty,ag=(e,t,n)=>t in e?ig(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Y=(e,t,n)=>ag(e,typeof t!="symbol"?t+"":t,n),Ea={onFocus:"onFocusin",onBlur:"onFocusout",onChange:"onInput",onDoubleClick:"onDblclick",htmlFor:"for",className:"class",defaultValue:"value",defaultChecked:"checked"},cg=new Set(["viewBox","preserveAspectRatio"]),Jc=og(e=>Object.entries(e).reduce((t,[n,s])=>{if(s===void 0)return t;n in Ea&&(n=Ea[n]);const r=cg.has(n)?n:n.toLowerCase();return t[r]=s,t},{})),ws=new WeakMap,xa=new Set(["value","checked","selected"]),lg=new Set(["viewBox","preserveAspectRatio","clipPath","clipRule","fillRule","strokeWidth","strokeLinecap","strokeLinejoin","strokeDasharray","strokeDashoffset","strokeMiterlimit"]),dg=e=>e.tagName==="svg"||e.namespaceURI==="http://www.w3.org/2000/svg",Es=(e,t)=>dg(e)&&lg.has(t)?t:t.toLowerCase(),Yr=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(Yr(r));for(const r in n){const o=n[r];o==null?s.removeProperty(Yr(r)):s.setProperty(Yr(r),String(o))}}};function se(e,t,n){const s="default";let r=ws.get(e);r||(r=new Map,ws.set(e,r));const o=r.get(s)||{},i=Object.keys(t),a=(d,m)=>{e.addEventListener(d.toLowerCase(),m)},l=(d,m)=>{e.removeEventListener(d.toLowerCase(),m)},c=d=>d.startsWith("on"),f=d=>!d.startsWith("on"),u=d=>a(d.substring(2),t[d]),g=d=>l(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(xa.has(d)){e[d]=m??"";return}if(typeof m=="boolean"&&!d.includes("aria-")){e.toggleAttribute(Es(e,d),m);return}if(d==="children"){e.innerHTML=m;return}if(m!=null){e.setAttribute(Es(e,d),m);return}e.removeAttribute(Es(e,d))}};for(const d in o)t[d]==null&&(d==="class"?e.className="":d==="style"?Sa(e,o[d],void 0):xa.has(d)?e[d]="":e.removeAttribute(Es(e,d)));return Object.keys(o).filter(c).forEach(d=>{l(d.substring(2),o[d])}),i.filter(c).forEach(u),i.filter(f).forEach(h),r.set(s,t),function(){i.filter(c).forEach(g);const m=ws.get(e);m&&(m.delete(s),m.size===0&&ws.delete(e))}}function ug(){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 Xc(e,t){const n=ug();return n?(n[e]||(n[e]=t()),n[e]):t()}var Fs=Xc("__zag__refSet",()=>new WeakSet),fg=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,hg=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,pg=e=>typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeName=="string",gg=e=>fg(e)||hg(e)||pg(e),Ao=e=>e!==null&&typeof e=="object",$a=e=>Ao(e)&&!Fs.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!gg(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 mg=Symbol(),Ia=Object.getPrototypeOf,Lo=new WeakMap,vg=e=>e&&(Lo.has(e)?Lo.get(e):Ia(e)===Object.prototype||Ia(e)===Array.prototype),yg=e=>vg(e)&&e[mg]||null,Ca=(e,t=!0)=>{Lo.set(e,t)};var _t=Xc("__zag__proxyStateMap",()=>new WeakMap),bg=(e=Object.is,t=(a,l)=>new Proxy(a,l),n=new WeakMap,s=(a,l)=>{const c=n.get(a);if(c?.[0]===l)return c[1];const f=Array.isArray(a)?[]:Object.create(Object.getPrototypeOf(a));return Ca(f,!0),n.set(a,[l,f]),Reflect.ownKeys(a).forEach(u=>{const g=Reflect.get(a,u);Fs.has(g)?(Ca(g,!1),f[u]=g):_t.has(g)?f[u]=Eg(g):f[u]=g}),Object.freeze(f)},r=new WeakMap,o=[1,1],i=a=>{if(!Ao(a))throw new Error("object required");const l=r.get(a);if(l)return l;let c=o[0];const f=new Set,u=(w,S=++o[0])=>{c!==S&&(c=S,f.forEach(x=>x(w,S)))};let g=o[1];const h=(w=++o[1])=>(g!==w&&!f.size&&(g=w,d.forEach(([S])=>{const x=S[1](w);x>c&&(c=x)})),c),p=w=>(S,x)=>{const k=[...S];k[1]=[w,...k[1]],u(k,x)},d=new Map,m=(w,S)=>{if(f.size){const x=S[3](p(w));d.set(w,[S,x])}else d.set(w,[S])},y=w=>{const S=d.get(w);S&&(d.delete(w),S[1]?.())},$=w=>(f.add(w),f.size===1&&d.forEach(([x,k],b)=>{const A=x[3](p(b));d.set(b,[x,A])}),()=>{f.delete(w),f.size===0&&d.forEach(([x,k],b)=>{k&&(k(),d.set(b,[x]))})}),E=Array.isArray(a)?[]:Object.create(Object.getPrototypeOf(a)),M=t(E,{deleteProperty(w,S){const x=Reflect.get(w,S);y(S);const k=Reflect.deleteProperty(w,S);return k&&u(["delete",[S],x]),k},set(w,S,x,k){const b=Reflect.has(w,S),A=Reflect.get(w,S,k);if(b&&(e(A,x)||r.has(x)&&e(A,r.get(x))))return!0;y(S),Ao(x)&&(x=yg(x)||x);let R=x;if(!Object.getOwnPropertyDescriptor(w,S)?.set){!_t.has(x)&&$a(x)&&(R=Qc(x));const V=!Fs.has(R)&&_t.get(R);V&&m(S,V)}return Reflect.set(w,S,R,k),u(["set",[S],x,A]),!0}});r.set(a,M);const D=[E,h,s,$];return _t.set(M,D),Reflect.ownKeys(a).forEach(w=>{const S=Object.getOwnPropertyDescriptor(a,w);S.get||S.set?Object.defineProperty(E,w,S):M[w]=a[w]}),M})=>[i,_t,Fs,e,t,$a,n,s,r,o],[wg]=bg();function Qc(e={}){return wg(e)}function Ta(e,t,n){const s=_t.get(e);let r;const o=[],i=s[3];let a=!1;const c=i(f=>{o.push(f),r||(r=Promise.resolve().then(()=>{r=void 0,a&&t(o.splice(0))}))});return a=!0,()=>{a=!1,c()}}function Eg(e){const t=_t.get(e),[n,s,r]=t;return r(n,s())}function nr(e){const t=e().value??e().defaultValue;e().debug&&console.log(`[bindable > ${e().debug}] initial`,t);const n=e().isEqual??Object.is,s=Qc({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=tt(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)}}}nr.cleanup=e=>{};nr.ref=e=>{let t=e;return{get:()=>t,set:n=>{t=n}}};function xg(e){const t={current:e};return{get(n){return t.current[n]},set(n,s){t.current[n]=s}}}var{defineProperty:Sg,getOwnPropertyDescriptor:$g,getOwnPropertyDescriptors:ka}=Object;function Un(e,t){if(Object.is(e,t))return e;if(!Bn(e)||!Bn(t))return t===void 0?e:t;let n=e;const s=(r,o)=>{n===e&&(n=Object.defineProperties({},ka(e))),Sg(n,r,o)};for(const[r,o]of Object.entries(ka(t))){if(!o.enumerable)continue;if(o.get){s(r,o);continue}const i=o.value;if(i===void 0)continue;const a=!!$g(e,r)?.get,l=e[r],c=Bn(l)&&Bn(i)?Un(l,i):i;!a&&Object.is(l,c)||s(r,{value:c,writable:!0,enumerable:!0,configurable:!0})}return n}var el=class{constructor(e,t={}){Y(this,"machine",e),Y(this,"scope"),Y(this,"context"),Y(this,"prop"),Y(this,"state"),Y(this,"refs"),Y(this,"computed"),Y(this,"event",{type:""}),Y(this,"previousEvent",{type:""}),Y(this,"effects",new Map),Y(this,"replaceTracker",Ap()),Y(this,"transition",null),Y(this,"cleanups",[]),Y(this,"subscriptions",[]),Y(this,"userProps"),Y(this,"userPropsSources",[]),Y(this,"getUserProps",()=>{let u=this.userProps;for(const g of this.userPropsSources){const h=Wi(g);u=u?Un(u,h):h}return u}),Y(this,"getEvent",()=>({...this.event,current:()=>this.event,previous:()=>this.previousEvent})),Y(this,"getState",()=>({...this.state,matches:(...u)=>u.some(g=>Np(this.state.get(),g)),hasTag:u=>Fp(this.machine,this.state.get(),u)})),Y(this,"debug",(...u)=>{this.machine.debug&&console.log(...u)}),Y(this,"notify",()=>{this.publish()}),Y(this,"send",u=>{if(this.status!==Wn.Started)return;const g=u?.replaces,h=g?this.replaceTracker.claim(g):void 0;queueMicrotask(()=>{if(!u||g&&h&&this.replaceTracker.isReplaced(g,h))return;this.previousEvent=this.event,this.event=u,this.debug("send",u);let p=this.state.get();const d=u.type,{transitions:m,source:y}=Pp(this.machine,p,d),$=this.choose(m);if(!$)return;this.transition=$;const E=fa(this.machine,$.target??p,y);this.debug("transition",$),E!==p?this.state.set(E):$.reenter?this.state.invoke(p,p):this.action($.actions)})}),Y(this,"action",u=>{const g=tt(u)?u(this.getParams()):u;if(!g)return;const h=g.map(p=>{const d=this.machine.implementations?.actions?.[p];return d||Rs(`[zag-js] No implementation found for action "${JSON.stringify(p)}"`),d});for(const p of h)p?.(this.getParams())}),Y(this,"guard",u=>{if(tt(u))return u(this.getParams());const g=this.machine.implementations?.guards?.[u];return g||Rs(`[zag-js] No implementation found for guard "${JSON.stringify(u)}"`),g?.(this.getParams())}),Y(this,"effect",u=>{const g=tt(u)?u(this.getParams()):u;if(!g)return;const h=g.map(d=>{const m=this.machine.implementations?.effects?.[d];return m||Rs(`[zag-js] No implementation found for effect "${JSON.stringify(d)}"`),m}),p=[];for(const d of h){const m=d?.(this.getParams());m&&p.push(m)}return()=>p.forEach(d=>d?.())}),Y(this,"choose",u=>tu(u).find(g=>{let h=!g.guard;return cu(g.guard)?h=!!this.guard(g.guard):tt(g.guard)&&(h=g.guard(this.getParams())),h})),Y(this,"subscribe",u=>(this.subscriptions.push(u),()=>{const g=this.subscriptions.indexOf(u);g>-1&&this.subscriptions.splice(g,1)})),Y(this,"status",Wn.NotStarted),Y(this,"publish",()=>{this.callTrackers(),this.subscriptions.forEach(u=>u(this.service))}),Y(this,"trackers",[]),Y(this,"setupTrackers",()=>{this.machine.watch?.(this.getParams())}),Y(this,"callTrackers",()=>{this.trackers.forEach(({deps:u,fn:g})=>{const h=u.map(p=>p());bn(g.prev,h)||(g(),g.prev=h)})}),Y(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,g)=>{g.prev=u.map(h=>h()),this.trackers.push({deps:u,fn:g})},refs:this.refs,computed:this.computed,flush:gu,scope:this.scope,choose:this.choose})),tt(t)?this.userPropsSources.push(t):this.userProps=t;const{id:n,ids:s,getRootNode:r}=Wi(t);this.scope=Hp({id:n,ids:s,getRootNode:r});const o=u=>{const g=this.getUserProps();return(e.props?.({props:Go(g),scope:this.scope})??g)[u]};this.prop=o;const i=e.context?.({prop:o,bindable:nr,scope:this.scope,flush(u){queueMicrotask(u)},getContext(){return a},getComputed(){return l},getRefs(){return c},getEvent:this.getEvent.bind(this)});i&&Object.values(i).forEach(u=>{const g=Ta(u.ref,()=>this.notify());this.cleanups.push(g)});const a={get(u){return i?.[u].get()},set(u,g){i?.[u].set(g)},initial(u){return i?.[u].initial},hash(u){const g=i?.[u].get();return i?.[u].hash(g)}};this.context=a;const l=u=>(fr(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:l}));this.computed=l;const c=xg(e.refs?.({prop:o,context:a})??{});this.refs=c;const f=nr(()=>({defaultValue:fa(e,e.initialState({prop:o})),onChange:(u,g)=>{const{exiting:h,entering:p}=Vp(this.machine,g,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),p.forEach(d=>{const m=this.effect(d.state?.effects);if(m){const y=this.effects.get(d.path);this.effects.set(d.path,y?Ys(y,m):m)}}),g===bs){this.action(e.entry);const d=this.effect(e.effects);if(d){const m=this.effects.get(bs);this.effects.set(bs,m?Ys(m,d):d)}}p.forEach(d=>{this.action(d.state?.entry)})}}));this.state=f,this.cleanups.push(Ta(this.state.ref,()=>this.notify()))}updateProps(e){const t=this.userPropsSources;if(tt(e))t.push(e);else if(t.length===0)this.userProps=Un(this.userProps,e);else{const n=t.length-1,s=t[n];if(tt(s)){const r=Un({},e);r&&Object.keys(r).length>0&&t.push(r)}else t[n]=Un(s,e)}this.notify()}start(){this.status=Wn.Started,this.debug("initializing..."),this.state.invoke(this.state.initial,bs),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=Wn.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 Ig='<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>',xt=new Map;let Cg=0;function Tg(e){const t=document.createElement("span");t.className="ui-select",t.innerHTML=`<button type="button" class="ui-select-trigger"><span></span>${Ig}</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="",l=e.value,c=e.disabled;const f=new el(sg,{id:`select-${++Cg}`,collection:Ks({items:i}),defaultValue:[l],disabled:c,positioning:{placement:"bottom-start",strategy:"fixed",sameWidth:!0,gutter:6},onValueChange({value:d}){e.value!==d[0]&&(l=e.value=d[0]??"",e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})))}}),u=()=>Cp(f.service,Jc);function g(){const d=u();se(t,d.getRootProps()),se(n,{...d.getTriggerProps(),"aria-label":e.getAttribute("aria-label")||e.labels?.[0]?.textContent?.trim(),"aria-labelledby":void 0}),se(r,d.getPositionerProps()),se(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,$)=>{const E=o.children[$];se(E,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 $=document.createElement("div");return $.className="ui-select-option",$.textContent=y.label,$})),f.updateProps({collection:Ks({items:i})})),l!==e.value&&(l=e.value,u().setValue([l])),c!==e.disabled&&(c=e.disabled,f.updateProps({disabled:c})),g()}t.addEventListener("keydown",d=>d.stopPropagation()),e.addEventListener("change",h);const p=f.subscribe(g);return f.start(),h(),{sync:h,focus:()=>n.focus(),dispose(){e.removeEventListener("change",h),p(),f.stop(),t.remove(),e.hidden=!1}}}function es(e=document){for(const[t,n]of xt)t.isConnected||(n.dispose(),xt.delete(t));for(const t of e.querySelectorAll("select:not([data-native])"))xt.has(t)?xt.get(t).sync():xt.set(t,Tg(t))}function kg(e){es(e.parentElement),xt.get(e)?.focus()}function Ag(e=document.body){const t=new MutationObserver(n=>{n.some(s=>s.target instanceof Element&&(s.target.matches("select, option")||[...s.addedNodes,...s.removedNodes].some(r=>r instanceof Element&&(r.matches("select")||r.querySelector("select")))))&&es(e)});return t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["disabled"]}),es(e),()=>{t.disconnect();for(const[n,s]of xt)(e.contains(n)||!n.isConnected)&&(s.dispose(),xt.delete(n))}}function Lg(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
|
+
${_n.map(b=>`<option value="${b.id}">${b.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=b=>t.querySelector(b),o=r("select"),i=r(".launch-directory"),a=r(".launch-web-link"),l=r(".launch-command"),c=r(".launch-terminal"),f=r(".launch-copy"),u=r(".launch-status");let g,h=0,p=0,d,m,y,$,E,O=null;function M(){p++,m?.abort(),clearTimeout(E),y=void 0,l.value="",c.disabled=f.disabled=!0,r(".launch-summary").hidden=!0,r(".launch-availability").textContent=""}function D(){t.close(),h++,d?.abort(),M(),e(),O?.focus({preventScroll:!0})}async function w(b){try{await navigator.clipboard.writeText(b),u.textContent="Command copied."}catch{u.textContent=`Copy this command: ${b}`,b===l.value&&(l.focus(),l.select())}}function S(){if(a.hidden=!0,a.removeAttribute("href"),g&&$?.webBaseUrl)try{a.href=Zd($.webBaseUrl,g.nativeID||g.id),a.hidden=!1}catch{}u.textContent=$?a.hidden?"OpenCode is unavailable. Choose another app to use the saved conversation.":"":"Finding OpenCode…"}function x(b){const A=_n.find(R=>R.id===o.value)?.name||Me(o.value);l.value=b.command,f.disabled=!1,c.disabled=!b.terminalAvailable,c.textContent=`${b.mode==="resume"?"Resume in":"Open in"} ${A} ↗`,r(".launch-summary").hidden=!1,r(".launch-mode").textContent=b.mode==="resume"?"Resume original session":"New session · saved context",r(".launch-hint").textContent=b.mode==="resume"?`Continue this conversation in ${A}.`:`Start in ${A} with the saved conversation.`,r(".launch-context").hidden=!b.context,r(".launch-coverage").textContent=b.context?`${b.context.messages.toLocaleString()} / ${b.context.totalMessages.toLocaleString()} messages${b.context.partial?" · Partial history":""}`:"",r(".launch-context-path").textContent=b.context?.path||"",r(".launch-availability").textContent=b.targetAvailable?b.terminalAvailable?"":"Automatic terminal opening is unavailable. Run the copied command in your terminal.":`${A} CLI was not found. Install it, then run the copied command.`,u.textContent=""}async function k(){if(M(),!g||!t.open)return;const b=o.value==="web";if(r(".launch-web").hidden=!b,r(".launch-cli").hidden=b,b){S();return}if(!Dr(o.value))return;const A=p;m=new AbortController,u.textContent="Preparing command…";try{const R=await fetch(`/api/sessiongraph/session/${encodeURIComponent(g.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 R.json();if(!R.ok)throw new Error(V.error||"Could not prepare this session.");if(p!==A)return;y=V,x(y)}catch(R){p===A&&(l.placeholder="Command unavailable",u.textContent=R instanceof Error?R.message:"Could not prepare this session.")}}return o.addEventListener("change",()=>{try{localStorage.setItem("sessiongraph.open-target",o.value)}catch{}k()},s),i.addEventListener("input",()=>{M(),u.textContent="Checking working directory…",E=setTimeout(()=>{k()},300)},s),i.addEventListener("change",()=>{k()},s),r(".dialog-close").addEventListener("click",D,s),t.addEventListener("cancel",b=>{b.preventDefault(),D()},s),t.addEventListener("keydown",b=>{b.stopPropagation()},s),f.addEventListener("click",()=>{y&&w(y.command)},s),r(".launch-copy-pair").addEventListener("click",()=>{w("opencode pair")},s),c.addEventListener("click",async()=>{if(!g||!y||c.disabled)return;const b=h;c.disabled=o.disabled=i.disabled=!0,u.textContent="Opening Terminal…";try{const A=await fetch(`/api/sessiongraph/session/${encodeURIComponent(g.id)}/open-terminal`,{method:"POST",headers:{"Content-Type":"application/json","X-SessionGraph-Action":"open-terminal"},body:JSON.stringify({target:o.value,directory:y.directory})}),R=await A.json();if(!A.ok)throw new Error(R.error||"Could not open Terminal.");h===b&&(u.textContent="Session sent to Terminal.")}catch(A){h===b&&(u.textContent=A instanceof Error?A.message:"Could not open Terminal. Copy the command instead.")}finally{h===b&&(o.disabled=i.disabled=!1,c.disabled=!y?.terminalAvailable)}},s),{async open(b){g=b;const A=++h;d?.abort(),d=new AbortController,$=void 0,M(),t.open||(O=document.activeElement),r(".launch-title").textContent=`${Me(b.source)} · ${b.title}`,i.value=b.directory,i.disabled=o.disabled=!1,o.value=Dr(b.source)?b.source:"opencode";const R=(!b.source||b.source==="opencode")&&oc(b.nativeID||b.id);o.querySelector('[value="web"]').disabled=!R;for(const V of _n)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");(Dr(V)||V==="web"&&R)&&(o.value=V)}catch{}l.placeholder="Preparing command…",r(".launch-context").open=!1,t.open||t.showModal(),e(),kg(o),k();try{const V=await fetch(`/api/sessiongraph/session/${encodeURIComponent(b.id)}/connection`,{signal:d.signal});if(!V.ok)throw new Error("Connection unavailable");const H=await V.json();if(h!==A)return;$=H;for(const Z of _n){const re=H.targets.some(J=>J.id===Z.id&&J.available);o.querySelector(`[value="${Z.id}"]`).textContent=`${Z.name}${re?"":" · CLI not found"}`}o.value==="web"&&S()}catch{h===A&&o.value==="web"&&(u.textContent="OpenCode is unavailable. Choose another app to use the saved conversation.")}},dispose(){h++,d?.abort(),M(),n.abort(),t.remove()}}}const Og=e=>e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]);function Mg(e,t,n){const s=document.createElement("dialog");s.className="imports-dialog",s.setAttribute("aria-labelledby","imports-heading"),s.innerHTML='<button class="icon-button dialog-close" aria-label="Close sources">×</button><span class="eyebrow">SessionGraph</span><h2 id="imports-heading">Explore & 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 & 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(s);const r=x=>s.querySelector(x);let o=!1,i=0,a=!1,l=null,c=!1,f=!1,u=!1;const g=new AbortController;let h=!1,p=0,d=!1,m=!1,y=!1;function $(){const x=s.querySelectorAll("input:checked").length;r(".import-start").disabled=o||c||d,r(".import-start").textContent=o||c?"Importing…":d?"Finding sources…":m?h?x?"Import & continue →":"Continue without importing →":"Import updates ↗":"Try again",s.querySelectorAll("input").forEach(k=>{k.disabled=o||c})}async function E(x,k){const b=await fetch(`/api/sessiongraph/${x}`,{...k,signal:AbortSignal.any([g.signal,AbortSignal.timeout(3e4)])}),A=await b.json();if(b.status===409&&x==="import"&&k?.method==="POST")return E("import");if(!b.ok)throw new Error(A.error||"Import unavailable.");return A}function O(x){o=x.running,$(),r(".imports-progress").textContent=o?`${x.source?Me(x.source):"Importing"} · ${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`:""}`,r(".imports-notes").hidden=!x.errors.length;const k=new Map;x.errors.forEach(b=>k.set(b,(k.get(b)||0)+1)),r(".imports-notes div").innerHTML=[...k].map(([b,A])=>`<p>${Og(b)}${A>1?` (${A} occurrences)`:""}</p>`).join(""),document.dispatchEvent(new CustomEvent("sessiongraph-import-status",{detail:x}))}async function M(){if(!(a||f)){i=0,f=!0;try{const x=await E("import");if(a)return;if(O(x),x.running)i=window.setTimeout(M,1e3);else{const k=y;y=!1,await e(u),!a&&k&&n(x.failed?"Import finished with some unavailable history. Open Manage sources for details or to retry.":x.imported+x.unchanged?"Your sessions are ready to explore.":"No conversations found. You can choose other sources in Manage sources.")}}catch(x){D(x)}finally{f=!1}}}function D(x){if(a)return;y=!1;const k=x instanceof Error?x.message:"Import unavailable.";O({running:!1,discovered:0,imported:0,unchanged:0,failed:1,errors:[k]}),r(".imports-progress").textContent=k,s.open||n(`${k} Open Manage sources to retry.`)}async function w(x,k=!1){if(a||k&&s.open)return;if(o||c||f||i){!k&&!s.open&&S();return}c=!0,u=k,o=!0,$();const b=h&&s.open&&x!==void 0,A=p;try{const R=await E("import",{method:"POST",headers:{"Content-Type":"application/json","X-SessionGraph-Action":"import"},body:JSON.stringify(k?{automatic:!0}:{sources:x})});if(a||(O(R),b&&(y=!!x?.length,p===A&&s.open&&s.close(),x?.length&&n("Import started. You can explore the map as soon as your sessions are ready."),await e(!0)),a))return;window.clearTimeout(i),i=window.setTimeout(M,100)}catch(R){D(R)}finally{c=!1,a||$()}}async function S(x=!1){h=x;const k=++p;d=!0,m=!1,l=document.activeElement,r("#imports-heading").textContent=x?"Explore & visualize all your LLM sessions":"Your session sources.",r("footer > span").textContent=x?"You can change sources later.":"Saved locally in SQLite",x&&(r(".imports-progress").textContent="Detected conversation sources are selected for you.",r(".imports-notes").hidden=!0),$(),s.open||s.showModal(),t(),r(".import-sources").textContent="Finding local session sources…";try{const b=await E("sources");if(a||k!==p)return;r(".import-sources").innerHTML=sc(b.sources).map(R=>rc(R,{checked:R.selected||x&&R.available&&R.capabilities.history,disabled:o})).join(""),m=!0,x&&!s.querySelector("input:checked")&&(r(".imports-progress").textContent="No conversation sources selected. You can choose sources now or add them later.");const A=await E("import");if(a||k!==p)return;A.running?(O(A),window.clearTimeout(i),i=window.setTimeout(M,1e3)):x||O(A)}catch(b){!a&&k===p&&(m=!1,r(".import-sources").textContent=b instanceof Error?b.message:"Could not detect sources.")}finally{!a&&k===p&&(d=!1,$())}}return r(".import-sources").addEventListener("change",$),r(".import-start").addEventListener("click",()=>{m?w([...s.querySelectorAll("input:checked")].map(x=>x.value)):S(h)}),r(".dialog-close").addEventListener("click",()=>s.close()),s.addEventListener("close",()=>{p++,d=!1,t(),l?.focus()}),s.addEventListener("keydown",x=>x.stopPropagation()),{open:S,sources:async()=>(await E("sources")).sources,select:x=>w(x),get busy(){return o||c||f||!!i},refresh:(x=!1)=>w(void 0,x),resume:()=>{u=!0,o=!0,window.clearTimeout(i),M()},dispose:()=>{a=!0,g.abort(),window.clearTimeout(i),s.remove()}}}const Dg=6e4,Rg=3e4;class Pg{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<Rg)){this.checking=!0,this.activity();try{await this.options.refresh()}finally{this.checking=!1}}}dispose(){this.disposed=!0}}class Vg{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 Ng=Object.freeze({sourceID:"",projectID:"",directory:"",days:0,fromDate:"",toDate:"",includeChildren:!0,includeArchived:!1}),Fg=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 Hg(e){const t={...Ng};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"])Fg(n[s])&&(t[s]=n[s]);return t.fromDate&&t.toDate&&t.fromDate>t.toDate&&(t.fromDate="",t.toDate=""),t}const _g=e=>typeof e=="number"&&Number.isSafeInteger(e)&&e>=0;function tl(e,t={}){const n=e.filter(a=>(t.allSources||["opencode","continue"].includes(a.source||"opencode"))&&_g(a.tokens)),s=n.filter(a=>Number.isFinite(a.activity?.lastMessageAt)&&a.activity.lastMessageAt>0).sort((a,l)=>Math.max(a.created,a.activity.lastMessageAt)-Math.max(l.created,l.activity.lastMessageAt)),r=[],o=[0];for(const a of s)r.push(Math.max(a.created,a.activity.lastMessageAt)),o.push(o.at(-1)+a.tokens);const i=n.reduce((a,l)=>a+l.tokens,0);return{recorded:n.length,missing:e.length-n.length,untimed:n.length-s.length,at(a,l=!1){if(l)return{tokens:i,sessions:n.length};let c=0,f=r.length;for(;c<f;){const u=c+f>>>1;r[u]<=a?c=u+1:f=u}return{tokens:o[c],sessions:c}}}}const ci=15e3,sr=5e3,nl=1e3,li=30,Oo=ci/1e3*li,cy=(ci+sr+nl)/1e3*li,ly=e=>Math.min(1,e/(Oo-1)),dy=e=>e<Oo?null:Math.min(1,(e-Oo+1)/(sr/1e3*li));function uy(e){const t=Math.max(0,Math.min(1,e)),n=.08,s=.35,r=1-(n+s)/2,o=i=>i**3-i**4/2;return t<n?n*o(t/n)/r:t>1-s?1-s*o((1-t)/s)/r:(t-n/2)/r}const Bg=new Intl.DateTimeFormat("en",{month:"short",year:"numeric"}),jg=new Intl.DateTimeFormat("en",{month:"short",day:"numeric",year:"numeric"}),Wg=(e,t)=>(t>=90*864e5?Bg:jg).format(e);function Ug(e,t,n,s=70){const r=new Array(s).fill(0),o=Math.max(1,n-t);for(const i of e)r[Math.max(0,Math.min(s-1,Math.floor((i-t)/o*s)))]++;return r}function sl(e){const t=e.map(n=>n.created).sort((n,s)=>n-s);return(n,s=!1)=>{if(s)return t.length;let r=0,o=t.length;for(;r<o;){const i=r+o>>>1;t[i]<=n?r=i+1:o=i}return r}}function qg(e,t={}){const n=r=>`data-playback="${r}"${t[r]?` id="${t[r]}"`:""}`,s=Wo([Ms[0],{...Ms[1],"aria-hidden":"true","stroke-width":1.5},Ms[2]]).outerHTML;return`<div class="timeline-top">${e}</div>
|
|
30
|
+
<div class="timeline-track"><button type="button" class="play-button" ${n("play")} aria-label="Play timeline">${s}</button><div class="histogram-wrap"><div class="histogram" ${n("histogram")} aria-hidden="true"></div><input ${n("scrubber")} type="range" min="0" max="1000" value="1000" aria-label="Timeline playback position"><div class="timeline-cursor" ${n("cursor")}></div></div><output class="playback-date" ${n("date")}>—</output></div>
|
|
31
|
+
<div class="playback-period" ${n("period")} aria-label="Playback position">—</div>
|
|
32
|
+
<div class="playback-summary" ${n("summary")} hidden><span><strong ${n("sessions")}>0</strong><span>Sessions</span></span><span data-token-total><strong ${n("tokens")}>—</strong><span>Burnt tokens</span></span><small ${n("coverage")}></small></div>`}function Gg(e,t){return!t||e.source===t||!!(e.source==="t3-code"&&e.linkedSessionIDs?.some(n=>n.startsWith(`${t}:`)))}const Sr=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}),di="sessiongraph.preferences",Aa={motion:["system","on","off"],view:["3d","2d"],density:["comfortable","compact"],quality:["performance","balanced","high"],trails:["all","selected","off"]},La={clickVolume:[0,100],panelOpacity:[55,100],bloom:[0,75],nodeScale:[60,180],trailOpacity:[0,100],trailSpeed:[10,100],playbackSpeed:[.25,3]};function $r(e){const t={...Sr};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 Aa)Aa[s].includes(r)&&Object.assign(t,{[s]:r});else if(s in La){const[o,i]=La[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 rl(e){try{const t=JSON.parse(e.getItem(di)||e.getItem("session-atlas.preferences")||"null");return $r(t?.version===1?t.values:void 0)}catch{return{...Sr}}}function ol(e,t){try{return e.setItem(di,JSON.stringify({version:1,values:$r(t)})),!0}catch{return!1}}const Mo=(e,t)=>e.motion==="on"||e.motion==="system"&&!t,Xe=[["interface","Interface",Ld],["sources","Sources",bd],["audio","Sound",nc],["graphics","Graphics",tc],["trails","Trails & playback",kd],["privacy","Privacy",Cd]],Qe=(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>`,Ht=(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>`,Rn=(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 Yg(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>
|
|
33
|
+
<div class="settings-layout"><nav class="settings-tabs" role="tablist" aria-label="Settings categories">${Xe.map(([p,d,m],y)=>`<button role="tab" id="settings-tab-${p}" aria-controls="settings-${p}" aria-selected="${!y}" tabindex="${y?-1:0}" data-tab="${p}">${Wo([m[0],{...m[1],"aria-hidden":"true","stroke-width":1.5},m[2]]).outerHTML}${d}</button>`).join("")}</nav>
|
|
34
|
+
<div class="settings-content">
|
|
35
|
+
<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>
|
|
36
|
+
${Rn("view","Default view","Switch between depth and a flat timeline.",[["3d","3D galaxy"],["2d","2D timeline"]])}
|
|
37
|
+
${Rn("motion","Motion","Camera transitions, reveals, and ambient movement.",[["system","Follow system"],["on","On"],["off","Off"]])}
|
|
38
|
+
${Rn("density","Session list","Adjust spacing between sessions.",[["comfortable","Comfortable"],["compact","Compact"]])}
|
|
39
|
+
<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>
|
|
40
|
+
${Ht("panelOpacity","Panel opacity","Adjust panel background transparency.",55,100)}
|
|
41
|
+
<div class="settings-note"><span>Restore the default panel layout.</span><button class="secondary-button settings-reset-panels">Reset panel positions</button></div>
|
|
42
|
+
</section>
|
|
43
|
+
<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>
|
|
44
|
+
${Qe("autoImport","Auto-import sessions","Check selected sources on startup, on return, and every minute while visible.")}
|
|
45
|
+
<div class="settings-sources-list import-sources"></div>
|
|
46
|
+
<div class="settings-import-progress" role="status"></div>
|
|
47
|
+
<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>
|
|
48
|
+
</section>
|
|
49
|
+
<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>
|
|
50
|
+
${Qe("muted","Mute all sound","Silence everything. Your volume levels are kept.")}
|
|
51
|
+
${Qe("clickSounds","Interaction sounds","A soft tick for controls; a chime for sessions.")}
|
|
52
|
+
${Ht("clickVolume","Interaction volume","Adjust interaction sound volume.",0,100)}
|
|
53
|
+
<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>
|
|
54
|
+
<p class="settings-footnote">Audio pauses while this tab is hidden. The speaker button on the map is a quick mute.</p>
|
|
55
|
+
</section>
|
|
56
|
+
<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>
|
|
57
|
+
${Rn("quality","Render quality","Performance uses 1× resolution and skips post-process effects.",[["performance","Performance"],["balanced","Balanced"],["high","High fidelity"]])}
|
|
58
|
+
${Ht("bloom","Glow strength","Soft light around bright nodes; disabled in Performance.",0,75)}
|
|
59
|
+
${Ht("nodeScale","Node size","Scale the lights without changing their positions.",60,180)}
|
|
60
|
+
${Qe("stars","Starfield","A faint field of stars behind the timeline.")}
|
|
61
|
+
${Qe("labels","Map labels","Directory names and the selected session title.")}
|
|
62
|
+
${Qe("focusDimming","Focus dimming","Dim surrounding nodes when a session is selected.")}
|
|
63
|
+
</section>
|
|
64
|
+
<section id="settings-trails" role="tabpanel" aria-labelledby="settings-tab-trails" hidden><h3>Trails & playback</h3><p class="settings-description">Trails start at creation and end at the latest recorded message.</p>
|
|
65
|
+
${Rn("trails","Session trails","Choose how much history to draw on the map.",[["all","All sessions"],["selected","Selected session"],["off","Hidden"]])}
|
|
66
|
+
${Ht("trailOpacity","Trail brightness","Fade lifetime trails into the background.",0,100)}
|
|
67
|
+
${Qe("trailFlow","Flowing trails","A decorative pulse along each lifetime; respects Motion.")}
|
|
68
|
+
${Ht("trailSpeed","Flow speed","How quickly the light travels along the trails.",10,100)}
|
|
69
|
+
${Qe("relationships","Relationship links","Show recorded fork and child connections.")}
|
|
70
|
+
${Qe("messageDots","Message dots","User and assistant messages, colored to match the selected session.")}
|
|
71
|
+
${Ht("playbackSpeed","Playback speed","1× plays the full timeline in 15 seconds.",.25,3,"×",.25)}
|
|
72
|
+
<p class="settings-footnote">Flow is decorative. Message dots reflect saved timestamps; visual settings never alter your history.</p>
|
|
73
|
+
</section>
|
|
74
|
+
<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>
|
|
75
|
+
<div class="settings-note"><span><strong>Public profile</strong><br>Choose which usage fields to share. Nothing uploads until you review a preview and publish.</span><button class="secondary-button settings-publishing">Publishing settings</button></div>
|
|
76
|
+
<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>
|
|
77
|
+
<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>
|
|
78
|
+
<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>
|
|
79
|
+
<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>
|
|
80
|
+
</section>
|
|
81
|
+
</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,l=!1,c="interface";const f=()=>{t.querySelectorAll(".settings-source, .settings-import").forEach(p=>{p.disabled=a||l}),t.querySelector(".settings-source")||(t.querySelector(".settings-import").disabled=!0)};async function u(){const p=++i;a=!0,f();const d=t.querySelector(".settings-sources-list");d.textContent="Finding local session sources…";try{const m=await e.getSources();if(n.signal.aborted||p!==i)return;d.innerHTML=sc(m).map(y=>rc(y,{settings:!0})).join("")}catch(m){if(n.signal.aborted||p!==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{p===i&&!n.signal.aborted&&(a=!1,f(),t.querySelector(".settings-import").disabled||=!d.querySelector("input"))}}t.querySelector(".settings-import").addEventListener("click",async()=>{const p=[...t.querySelectorAll(".settings-source:checked")].map(d=>d.value);l=!0,f(),t.querySelector(".settings-import-progress").textContent="Starting import…";try{await e.importSources(p)}catch(d){l=!1,f(),t.querySelector(".settings-import-progress").textContent=d instanceof Error?d.message:"Import unavailable."}},s);const g=()=>t.close();t.querySelector(".settings-publishing").addEventListener("click",()=>{t.close(),e.publishing()},s);for(const p of[".settings-close",".settings-done"])t.querySelector(p).addEventListener("click",g,s);t.addEventListener("close",()=>{e.visibility(),o?.focus({preventScroll:!0})},s),t.addEventListener("keydown",p=>{p.stopPropagation()},s);function h(p){c=p;for(const[d]of Xe){const m=t.querySelector(`[data-tab="${d}"]`);m.setAttribute("aria-selected",String(d===p)),m.tabIndex=d===p?0:-1,t.querySelector(`#settings-${d}`).hidden=d!==p}t.querySelector(".settings-content").scrollTop=0,c==="sources"&&u()}for(const p of t.querySelectorAll("[data-tab]"))p.addEventListener("click",()=>h(p.dataset.tab),s),p.addEventListener("keydown",d=>{const m=Xe.findIndex(([$])=>$===p.dataset.tab),y=d.key==="Home"?0:d.key==="End"?Xe.length-1:["ArrowRight","ArrowDown"].includes(d.key)?(m+1)%Xe.length:["ArrowLeft","ArrowUp"].includes(d.key)?(m+Xe.length-1)%Xe.length:-1;y<0||(d.preventDefault(),h(Xe[y][0]),t.querySelector(`[data-tab="${Xe[y][0]}"]`).focus())},s);return t.addEventListener("input",p=>{const d=p.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({...Sr})},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(),c==="sources"&&u())},importStatus(p){const d=l;l=p.running,f(),t.querySelector(".settings-import-progress").textContent=p.running?`Importing · ${p.imported.toLocaleString()} saved`:`${p.imported.toLocaleString()} imported · ${p.unchanged.toLocaleString()} unchanged${p.failed?` · ${p.failed} unavailable`:""}${p.errors.length?` · ${p.errors[0]}`:""}`,d&&!p.running&&t.open&&c==="sources"&&u()},render(p,d,m="saved"){r.checked=e.getArchived();for(const y of t.querySelectorAll("[data-pref]")){const $=y.dataset.pref;y.type==="checkbox"?y.checked=!!p[$]:y.value=String(p[$]);const E=t.querySelector(`[data-output="${$}"]`);E&&(E.value=`${p[$]}${E.dataset.unit}`),y.disabled=$==="bloom"&&p.quality==="performance"||$==="trailSpeed"&&(!p.trailFlow||p.trails==="off"||p.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=p.muted||!p.clickSounds||!p.clickVolume,es(t)},audioStatus(p){t.querySelector(".settings-audio-status").textContent=p},dispose(){n.abort(),t.remove()}}}class Kg{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 fy=e=>e.kind==="message"&&(e.role==="user"||e.role==="assistant"),il=e=>e.kind==="commit"?"#ffd580":e.kind==="message"?e.role==="user"?"#b0e9d6":"#9bbcff":e.kind.startsWith("tool_")?"#eac594":"#d7a1f1",al=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",commit:"Commit"}[e.kind],Ee=e=>e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]),zg=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"medium"}),Oa=e=>e===null?"Time not recorded":zg.format(e),Ma=e=>`<span class="event-badge" style="--event-color:${il(e)}">${al(e)}</span>`;function Zg(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>
|
|
82
|
+
<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>
|
|
83
|
+
<div class="event-scroll"><article class="event-content" aria-label="Message details" tabindex="0"></article>
|
|
84
|
+
<details class="event-browser"><summary>Browse messages <span class="event-count"></span></summary>
|
|
85
|
+
<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>
|
|
86
|
+
</details>
|
|
87
|
+
</div><footer class="event-footer"><span class="event-coverage"></span><button class="text-button event-reload">Reload</button></footer>`,e.append(s);const r=w=>s.querySelector(w),o=new AbortController;let i,a,l,c,f="messages",u=!1,g,h,p={};const d=(w,S)=>`<button class="event-row" data-event="${Ee(w.id)}" aria-current="${l?.selected?.id===w.id?"true":"false"}"><span class="event-row-top">${Ma(w)}<small>#${l.offset+S+1}</small></span><span class="event-preview">${Ee(w.preview||"No text recorded")}</span><time>${Oa(w.time)}</time></button>`;function m(){!l||!r(".event-browser").open||(r(".event-list").innerHTML=l.items.map(d).join("")||'<p class="event-empty">No saved messages.</p>')}function y(){if(!l)return;r(".event-count").textContent=`${l.total.toLocaleString()} ${f==="tools"?"tool events":"messages"}${l.partial?" · partial coverage":""}`,m();for(const S of["previous","next"])r(`[data-page="${S}"]`).disabled=!l[`${S}Cursor`];r(".event-coverage").textContent=l.partial?"Partial history":"Saved locally";const w=l.selected;r(".event-position").textContent=w?`${l.offset+l.items.findIndex(S=>S.id===w.id)+1} / ${l.total}`:"No messages";for(const S of["previous","next"])r(`[data-step="${S}"]`).disabled=!l[`${S}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">${Ma(w)}<h3>${Ee(w.name)}</h3><p>${Oa(w.time)}</p></div>
|
|
88
|
+
${w.partial?'<p class="event-warning">Partial message</p>':""}
|
|
89
|
+
${w.text?`<section class="event-payload"><pre>${Ee(w.text)}</pre></section>`:""}
|
|
90
|
+
${w.input?`<section class="event-payload"><h4>Input</h4><pre>${Ee(w.input)}</pre></section>`:""}
|
|
91
|
+
${w.output?`<section class="event-payload"><h4>Result</h4><pre>${Ee(w.output)}</pre></section>`:""}
|
|
92
|
+
${w.cwd?`<p>Execution directory: <code>${Ee(w.cwd)}</code></p>`:""}${w.exitCode!==void 0?`<p>Exit code: ${w.exitCode}</p>`:""}
|
|
93
|
+
${l.related.length?`<section><h4>Related execution events</h4>${l.related.map(S=>`<button class="event-row" data-event="${Ee(S.id)}">${Ee(S.name)} · ${Ee(S.preview)}</button>`).join("")}</section>`:""}
|
|
94
|
+
<details class="event-provenance"><summary>Source details</summary><dl><dt>Source</dt><dd>${Ee(Me(a?.source))}</dd><dt>Message ID</dt><dd>${Ee(w.messageID)}</dd><dt>Timestamp source</dt><dd>${Ee(w.timeSource)}</dd></dl></details>`}async function $(w={}){if(!a)return;clearTimeout(h),i?.abort();const S=new AbortController;i=S,p=w,u=!0,s.setAttribute("aria-busy","true"),r(".event-position").textContent="Loading…";for(const R of s.querySelectorAll("[data-step], [data-page]"))R.disabled=!0;const x=r(".event-list").scrollTop,k=l?.offset,b=document.activeElement,A=b instanceof HTMLElement?b.dataset:void 0;try{const R=await t.read(a.id,{filter:f,...w,...c?{revision:c}:{}},S.signal);if(S.signal.aborted)return;l=R,c=l.revision,y(),r(".event-list").scrollTop=l.offset===k?x:0,r(".event-scroll").scrollTop=0;const V=A?.event?`[data-event="${A.event}"]`:"";V&&(document.activeElement===b||!b?.isConnected&&document.activeElement===document.body)&&s.querySelector(V)?.focus({preventScroll:!0}),clearTimeout(h),h=setTimeout(()=>{g?.abort(),g=new AbortController;for(const H of[l?.previousItem,l?.nextItem])H&&t.read(a.id,{item:H,filter:f,revision:c},g.signal).catch(()=>{})},60)}catch(R){if(S.signal.aborted)return;l=void 0,r(".event-position").textContent="Unavailable",r(".event-content").innerHTML=`<div class="event-empty"><h3>Could not load this history.</h3><p>${Ee(R instanceof Error?R.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===S&&(u=!1,s.removeAttribute("aria-busy"))}}const E=()=>{t.clear(),c=void 0,l=void 0,$()},O=()=>!s.hidden&&!e.hidden,M=()=>{clearTimeout(h),g?.abort(),i?.abort(),i=void 0,u=!1,l=void 0,s.hidden=!0,s.removeAttribute("aria-busy"),e.classList.remove("has-events"),n.select(null)},D=w=>{if(u)return;const S=w==="next"?l?.nextItem:l?.previousItem;S&&$({item:S})};return s.addEventListener("click",w=>{const S=w.target.closest("button");if(S){if(S.dataset.event&&$({item:S.dataset.event}),S.dataset.step&&D(S.dataset.step==="next"?"next":"previous"),S.dataset.page){const x=S.dataset.page==="next"?l?.nextCursor:l?.previousCursor;x&&$({cursor:x})}S.hasAttribute("data-retry")&&$(p),(S.hasAttribute("data-reload")||S.classList.contains("event-reload"))&&E(),S.classList.contains("event-close")&&(M(),document.querySelector("#scene canvas")?.focus({preventScroll:!0}))}},{signal:o.signal}),r(".event-browser").addEventListener("toggle",m,{signal:o.signal}),{close:M,handleKey(w){return!O()||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(),M(),document.querySelector("#scene canvas")?.focus({preventScroll:!0}),!0):["ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(w.key)?(w.preventDefault(),D(w.key==="ArrowLeft"||w.key==="ArrowUp"?"previous":"next"),!0):!1},open(w,S,x,k="messages"){clearTimeout(h),g?.abort();const b=a?.id===w.id;a=w,c=x,l=void 0,f=k,r("#event-title").textContent=`${Me(w.source)} ${f==="tools"?"execution evidence":"messages"}`,r(".event-browser summary").firstChild.textContent=f==="tools"?"Browse tool events ":"Browse messages ",r(".event-list").replaceChildren(),r(".event-content").innerHTML='<p class="event-empty">Loading saved history…</p>',r(".event-coverage").textContent="Loading coverage…",b||(r(".event-browser").open=!1),s.hidden=!1,e.classList.add("has-events"),$(S?{item:S}:{})},dispose(){clearTimeout(h),g?.abort(),i?.abort(),o.abort(),s.remove()}}}function Jg(e,t,n){const s=new Map;let r,o,i,a,l=0,c=0,f=1;const u=document.createElement("strong"),g=document.createElement("pre"),h=document.createElement("span"),p=()=>{clearTimeout(i),o?.abort(),o=void 0,r=void 0,a=void 0,e.hidden=!0,e.classList.remove("message-tooltip")};function d(y,$){if(!a)return;const E=`${al(a)} · ${a.name}`,O=y||"No text recorded.",M=[$,f>1?`${f} nearby items`:"","Click to focus and read · ← / → to navigate"].filter(Boolean).join(" · ");u.textContent!==E&&(u.textContent=E),g.textContent!==O&&(g.textContent=O),h.textContent!==M&&(h.textContent=M),u.parentElement!==e&&e.replaceChildren(u,g,h),e.classList.add("message-tooltip"),e.hidden=!1,e.style.setProperty("--event-color",il(a));const D=e.offsetWidth,w=e.offsetHeight,S=t.getBoundingClientRect(),x=[...document.querySelectorAll(".floating-panel:not([hidden]), .app-header, .map-controls")].map(A=>A.getBoundingClientRect()),b=[c+18,c-w-18].flatMap(A=>[l+18,l-D-18].map(R=>{R=Math.max(8,Math.min(R,t.clientWidth-D-8)),A=Math.max(8,Math.min(A,t.clientHeight-w-8));const V=S.left+R,H=S.top+A,Z=x.reduce((re,J)=>re+Math.max(0,Math.min(V+D,J.right+8)-Math.max(V,J.left-8))*Math.max(0,Math.min(H+w,J.bottom+8)-Math.max(H,J.top-8)),0);return{left:R,top:A,overlap:Z}})).reduce((A,R)=>R.overlap<A.overlap?R:A);e.style.left=`${b.left}px`,e.style.top=`${b.top}px`}function m(y){const $=[y.text,y.input?`Input
|
|
95
|
+
${y.input}`:"",y.output?`Output
|
|
96
|
+
${y.output}`:""].filter(Boolean).join(`
|
|
97
|
+
|
|
98
|
+
`);return{text:$.slice(0,1800),shortened:$.length>1800||!!y.partial}}return{clear:p,show(y,$,E,O,M,D){const w=`${$}:${E}:${y.id}`,S=r!==w;S&&p(),r=w,a=y,l=M,c=D,f=O;const x=s.get(w);d(x?.text||y.preview,x?x.shortened?"Content preview":"":"Loading message…"),!(!S||x)&&(i=setTimeout(async()=>{const k=new AbortController;o=k;try{const b=await n.read($,{item:y.id,revision:E,filter:y.kind==="commit"?"tools":"messages"},k.signal);if(k.signal.aborted||r!==w||b.selected?.id!==y.id)return;const A=m(b.selected);s.set(w,A),s.size>20&&s.delete(s.keys().next().value),d(A.text,A.shortened?"Content preview":"")}catch{!k.signal.aborted&&r===w&&d(y.preview,"Saved excerpt · open for details")}},120))},dispose(){p(),s.clear()}}}const Xg=e=>e.length!==40&&e.length!==64;function Qg(e,t,n){const s=new AbortController,r=document.createElement("div");r.className="section-label",r.textContent="Recorded commits";const o=document.createElement("p");o.className="coverage-note",o.textContent="Loading commit index…";const i=document.createElement("div"),a=document.createElement("button");a.className="load-more",a.hidden=!0,e.replaceChildren(r,o,i,a);let l,c;async function f(){a.disabled=!0;try{const u=new URLSearchParams({limit:"30",...l?{cursor:l}:{}}),g=await fetch(`/api/sessiongraph/session/${encodeURIComponent(t)}/commits?${u}`,{signal:s.signal}),h=await g.json();if(!g.ok)throw new Error(h.error||"Commit index unavailable.");if(s.signal.aborted)return;c=h.revision,o.textContent=`${h.coverage.count===null?"Unknown commit history":`${h.total} confirmed recorded operation${h.total===1?"":"s"}`} · ${h.coverage.state}. ${h.coverage.note}`;for(const p of h.items){const d=document.createElement("button");d.className="relation";const m=document.createElement("span"),y=document.createElement("strong"),$=document.createElement("small");y.textContent=`${p.sha.slice(0,12)} · ${p.operation}`,$.textContent=`${p.occurredAt===null?"Time not recorded":new Date(p.occurredAt).toLocaleString()} · ${p.repositoryPath}`,d.title=`${p.sha}${Xg(p.sha)?" (abbreviated)":""} — inspect execution evidence`,m.append(y,$),d.append(m),d.addEventListener("click",()=>n(p.evidenceEventID,c),{signal:s.signal}),i.append(d)}l=h.nextCursor||void 0,a.hidden=!l,a.textContent="Load more commits"}catch(u){if(s.signal.aborted)return;o.textContent=u instanceof Error?u.message:"Commit index unavailable.",l=void 0,i.replaceChildren(),a.hidden=!1,a.textContent="Reload commits"}finally{a.disabled=!1}}return a.addEventListener("click",()=>{f()},{signal:s.signal}),f(),()=>s.abort()}class em{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 c=new AbortController,f=this.generation,u=new URLSearchParams({filter:r,...n}),g=this.request(`/api/sessiongraph/session/${encodeURIComponent(t)}/events?${u}`,{signal:AbortSignal.any([c.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(c.signal.aborted||f!==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]),$=JSON.stringify(m).length;for(this.characters-=this.pages.get(y)?.characters||0,this.pages.delete(y),this.pages.set(y,{page:m,characters:$}),this.characters+=$;this.pages.size>20||this.characters>2e6;){const E=this.pages.keys().next().value;this.characters-=this.pages.get(E).characters,this.pages.delete(E)}return m});a={controller:c,promise:g,readers:0},this.pending.set(o,a);const h=a,p=()=>{this.pending.get(o)===h&&this.pending.delete(o)};g.then(p,p)}const l=a;return l.readers++,new Promise((c,f)=>{const u=()=>{h(),f(s.reason)};let g=!1;const h=()=>{g||(g=!0,s?.removeEventListener("abort",u),--l.readers===0&&this.pending.get(o)===l&&(this.pending.delete(o),l.controller.abort()))};s?.addEventListener("abort",u,{once:!0}),l.promise.then(p=>{g||(h(),c(p))},p=>{g||(h(),f(p))})})}}function ae(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 tn(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 xs,Xt,Te,Qt,Ss,Kr,$s;const Da="__TAURI_TO_IPC_KEY__";function tm(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class hy{constructor(t){xs.add(this),Xt.set(this,void 0),Te.set(this,0),Qt.set(this,[]),Ss.set(this,void 0),tn(this,Xt,t||(()=>{})),this.id=tm(n=>{const s=n.index;if("end"in n){s==ae(this,Te,"f")?this.cleanupCallback():tn(this,Ss,s);return}const r=n.message;if(s==ae(this,Te,"f")){for(ae(this,xs,"m",Kr).call(this,r),tn(this,Te,ae(this,Te,"f")+1);ae(this,Te,"f")in ae(this,Qt,"f");){const o=ae(this,Qt,"f")[ae(this,Te,"f")];ae(this,xs,"m",Kr).call(this,o),delete ae(this,Qt,"f")[ae(this,Te,"f")],tn(this,Te,ae(this,Te,"f")+1)}ae(this,Te,"f")===ae(this,Ss,"f")&&this.cleanupCallback()}else ae(this,Qt,"f")[s]=r})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(t){tn(this,Xt,t)}get onmessage(){return ae(this,Xt,"f")}[(Xt=new WeakMap,Te=new WeakMap,Qt=new WeakMap,Ss=new WeakMap,xs=new WeakSet,Kr=function(n){try{ae(this,Xt,"f").call(this,n)}catch(s){queueMicrotask(()=>{throw s})}},Da)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[Da]()}}async function cl(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}class py{get rid(){return ae(this,$s,"f")}constructor(t){$s.set(this,void 0),tn(this,$s,t)}async close(){return cl("plugin:resources|close",{rid:this.rid})}async[($s=new WeakMap,Symbol.asyncDispose)](){await this.close()}}function nm(){return!!(globalThis||window).isTauri}async function sm(){await cl("plugin:process|restart")}class rm{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 om='<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>',im='<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 am(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=c=>{const f=["downloading","installing","restarting"].includes(c.phase),u=c.phase==="ready"||c.phase==="error"&&c.retry!=="download",g=c.phase==="downloading"?c.progress===void 0?"Downloading":`${c.progress}%`:c.phase==="installing"?"Installing":c.phase==="restarting"?"Restarting":u?"Restart":c.phase==="error"?"Retry update":"Update",h=c.phase==="error"?`${c.retry==="restart"?"Could not restart SessionGraph.":`Could not ${c.retry==="download"?"download or verify":"install"} the update.`} ${c.error||""} Click to try again.`:c.phase==="restarting"?`Restarting SessionGraph ${c.version}`:u?`Restart to install SessionGraph ${c.version}`:`Update to SessionGraph ${c.version}`;t.hidden=c.phase==="hidden",t.disabled=f,t.dataset.phase=c.phase,t.setAttribute("aria-busy",String(f)),t.setAttribute("aria-label",h),t.title=h;const p=`${u||c.phase==="restarting"?im:om}<span>${g}</span>`;t.innerHTML!==p&&(t.innerHTML=p);const d=c.phase==="hidden"?"":c.phase==="downloading"?`Downloading SessionGraph ${c.version}`:h;d!==s&&(n.textContent=d,s=d)},o=new rm(e,r);t.addEventListener("click",()=>{o.activate()});const i=()=>{document.visibilityState==="visible"&&navigator.onLine&&o.check()},a=window.setTimeout(i,1e4),l=window.setInterval(i,240*6e4);return document.addEventListener("visibilitychange",i),window.addEventListener("online",i),{check:()=>o.check(),dispose(){clearTimeout(a),clearInterval(l),o.dispose(),t.remove(),n.remove(),document.removeEventListener("visibilitychange",i),window.removeEventListener("online",i)}}}function cm(){return nm()?am({async check(){const{check:e}=await dr(async()=>{const{check:n}=await import("./index-BLM-0yG6.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 sm()}}):{dispose(){}}}var lm=sn("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"),X=lm.build();function zr(e,t){return e-t*Math.floor(e/t)}const ll=1721426;function Is(e,t,n,s){t=ui(e,t);let r=t-1,o=-2;return n<=2?o=0:Hs(t)&&(o=-1),ll-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*n-362)/12+o+s)}function Hs(e){return e%4===0&&(e%100!==0||e%400===0)}function ui(e,t){return e==="BC"?1-t:t}function dm(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}const um={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 pn{fromJulianDay(t){let n=t,s=n-ll,r=Math.floor(s/146097),o=zr(s,146097),i=Math.floor(o/36524),a=zr(o,36524),l=Math.floor(a/1461),c=zr(a,1461),f=Math.floor(c/365),u=r*400+i*100+l*4+f+(i!==4&&f!==4?1:0),[g,h]=dm(u),p=n-Is(g,h,1,1),d=2;n<Is(g,h,3,1)?d=0:Hs(h)&&(d=1);let m=Math.floor(((p+d)*12+373)/367),y=n-Is(g,h,m,1)+1;return new Ne(g,h,m,y)}toJulianDay(t){return Is(t.era,t.year,t.month,t.day)}getDaysInMonth(t){return um[Hs(t.year)?"leapyear":"standard"][t.month-1]}getMonthsInYear(t){return 12}getDaysInYear(t){return Hs(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 fm={"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 $e(e,t){return t=ue(t,e.calendar),e.era===t.era&&e.year===t.year&&e.month===t.month&&e.day===t.day}function hm(e,t){return t=ue(t,e.calendar),e=rt(e),t=rt(t),e.era===t.era&&e.year===t.year&&e.month===t.month}function pm(e,t){return t=ue(t,e.calendar),e=ts(e),t=ts(t),e.era===t.era&&e.year===t.year}function gm(e,t){return Ir(e.calendar,t.calendar)&&$e(e,t)}function Pn(e,t){return Ir(e.calendar,t.calendar)&&hm(e,t)}function Vn(e,t){return Ir(e.calendar,t.calendar)&&pm(e,t)}function Ir(e,t){return e.isEqual?.(t)??t.isEqual?.(e)??e.identifier===t.identifier}function mm(e,t){return $e(e,Cr(t))}const vm={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6};function dl(e,t,n){let s=e.calendar.toJulianDay(e),r=n?vm[n]:Em(t),o=Math.ceil(s+1-r)%7;return o<0&&(o+=7),o}function ul(e){return ot(Date.now(),e)}function Cr(e){return jt(ul(e))}function fl(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function ym(e,t){return Ra(e)-Ra(t)}function Ra(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Zr=null,bm=!1;function fi(){return Zr==null&&(Zr=new Intl.DateTimeFormat().resolvedOptions().timeZone),Zr}function hl(){return bm}function rt(e){return e.subtract({days:e.day-1})}function Do(e){return e.add({days:e.calendar.getDaysInMonth(e)-e.day})}function ts(e){return rt(e.subtract({months:e.month-1}))}function wm(e){return Do(e.add({months:e.calendar.getMonthsInYear(e)-e.month}))}function It(e,t,n){let s=dl(e,t,n);return e.subtract({days:s})}function Pa(e,t,n){return It(e,t,n).add({days:6})}const Va=new Map,Jr=new Map;function pl(e){if(Intl.Locale){let n=Va.get(e);return n||(n=new Intl.Locale(e).maximize().region,n&&Va.set(e,n)),n}let t=e.split("-")[1];return t==="u"?void 0:t}function Em(e){let t=Jr.get(e);if(!t){if(Intl.Locale){let s=new Intl.Locale(e);if("getWeekInfo"in s&&(t=s.getWeekInfo(),t))return Jr.set(e,t),t.firstDay}let n=pl(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&&fm[n]||0};Jr.set(e,t)}return t.firstDay}function xm(e,t,n){let s=e.calendar.getDaysInMonth(e);return Math.ceil((dl(rt(e),t,n)+s)/7)}function gl(e,t){return e&&t?e.compare(t)<=0?e:t:e||t}function ml(e,t){return e&&t?e.compare(t)>=0?e:t:e||t}const Sm={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 $m(e,t){let n=e.calendar.toJulianDay(e),s=Math.ceil(n+1)%7;s<0&&(s+=7);let r=pl(t),[o,i]=Sm[r]||[6,0];return s===o||s===i}function gn(e){e=ue(e,new pn);let t=ui(e.era,e.year);return vl(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function vl(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 Ro(e,t){if(t==="UTC")return 0;if(e>0&&t===fi()&&!hl())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:s,day:r,hour:o,minute:i,second:a}=yl(e,t);return vl(n,s,r,o,i,a,0)-Math.floor(e/1e3)*1e3}const Na=new Map;function yl(e,t){let n=Na.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"}),Na.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 Fa=864e5;function Im(e,t,n,s){return(n===s?[n]:[n,s]).filter(o=>Cm(e,t,o))}function Cm(e,t,n){let s=yl(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 st(e,t,n="compatible"){let s=De(e);if(t==="UTC")return gn(s);if(t===fi()&&n==="compatible"&&!hl()){s=ue(s,new pn);let l=new Date,c=ui(s.era,s.year);return l.setFullYear(c,s.month-1,s.day),l.setHours(s.hour,s.minute,s.second,s.millisecond),l.getTime()}let r=gn(s),o=Ro(r-Fa,t),i=Ro(r+Fa,t),a=Im(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 bl(e,t,n="compatible"){return new Date(st(e,t,n))}function ot(e,t){let n=Ro(e,t),s=new Date(e+n),r=s.getUTCFullYear(),o=s.getUTCMonth()+1,i=s.getUTCDate(),a=s.getUTCHours(),l=s.getUTCMinutes(),c=s.getUTCSeconds(),f=s.getUTCMilliseconds();return new ns(r<1?"BC":"AD",r<1?-r+1:r,o,i,t,n,a,l,c,f)}function jt(e){return new Ne(e.calendar,e.era,e.year,e.month,e.day)}function De(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 or(e.calendar,e.era,e.year,e.month,e.day,n,s,r,o)}function ue(e,t){if(Ir(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,Gt(s),s}function wl(e,t,n){if(e instanceof ns)return e.timeZone===t?e:km(e,t);let s=st(e,t,n);return ot(s,t)}function Tm(e){let t=gn(e)-e.offset;return new Date(t)}function km(e,t){let n=gn(e)-e.offset;return ue(ot(n,t),e.calendar)}const Nn=36e5;function Tr(e,t){let n=e.copy(),s="hour"in n?Mm(n,t):0;Po(n,t.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=t.months||0,Vo(n),El(n),n.day+=(t.weeks||0)*7,n.day+=t.days||0,n.day+=s,Am(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 Po(e,t){e.calendar.isInverseEra?.(e)&&(t=-t),e.year+=t}function Vo(e){for(;e.month<1;)Po(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,Po(e,1)}function Am(e){for(;e.day<1;)e.month--,Vo(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,Vo(e)}function El(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 Gt(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),El(e)}function xl(e){let t={};for(let n in e)typeof e[n]=="number"&&(t[n]=-e[n]);return t}function Sl(e,t){return Tr(e,xl(t))}function hi(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),Gt(n),n}function rr(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),Om(n),n}function Lm(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=Cs(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=Cs(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=Cs(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=Cs(e.hour,24),t}function Om(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 Cs(e,t){let n=e%t;return n<0&&(n+=t),n}function Mm(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,Lm(e)}function pi(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=it(i,n,0,o.length-1,s?.round),r.era=o[i],Gt(r);break}case"year":r.calendar.isInverseEra?.(r)&&(n=-n),r.year=it(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=it(e.month,n,1,e.calendar.getMonthsInYear(e),s?.round);break;case"day":r.day=it(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),Gt(r),r}function $l(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 l=o>=12;i=l?12:0,a=l?23:11}r.hour=it(o,n,i,a,s?.round);break}case"minute":r.minute=it(e.minute,n,0,59,s?.round);break;case"second":r.second=it(e.second,n,0,59,s?.round);break;case"millisecond":r.millisecond=it(e.millisecond,n,0,999,s?.round);break;default:throw new Error("Unsupported field "+t)}return r}function it(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 Il(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=Tr(De(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days});n=st(r,e.timeZone)}else n=gn(e)-e.offset;n+=t.milliseconds||0,n+=(t.seconds||0)*1e3,n+=(t.minutes||0)*6e4,n+=(t.hours||0)*36e5;let s=ot(n,e.timeZone);return ue(s,e.calendar)}function Dm(e,t){return Il(e,xl(t))}function Rm(e,t,n,s){switch(t){case"hour":{let r=0,o=23;if(s?.hourCycle===12){let p=e.hour>=12;r=p?12:0,o=p?23:11}let i=De(e),a=ue(rr(i,{hour:r}),new pn),l=[st(a,e.timeZone,"earlier"),st(a,e.timeZone,"later")].filter(p=>ot(p,e.timeZone).day===a.day)[0],c=ue(rr(i,{hour:o}),new pn),f=[st(c,e.timeZone,"earlier"),st(c,e.timeZone,"later")].filter(p=>ot(p,e.timeZone).day===c.day).pop(),u=gn(e)-e.offset,g=Math.floor(u/Nn),h=u%Nn;return u=it(g,n,Math.floor(l/Nn),Math.floor(f/Nn),s?.round)*Nn+h,ue(ot(u,e.timeZone),e.calendar)}case"minute":case"second":case"millisecond":return $l(e,t,n,s);case"era":case"year":case"month":case"day":{let r=pi(De(e),t,n,s),o=st(r,e.timeZone);return ue(ot(o,e.timeZone),e.calendar)}default:throw new Error("Unsupported field "+t)}}function Pm(e,t,n){let s=De(e),r=rr(hi(s,t),t);if(r.compare(s)===0)return e;let o=st(r,e.timeZone,n);return ue(ot(o,e.timeZone),e.calendar)}const Vm=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,Nm=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function Fm(e){let t=e.match(Vm);if(!t)throw Nm.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let n=new Ne(Xr(t[1],0,9999),Xr(t[2],1,12),1);return n.day=Xr(t[3],1,n.calendar.getDaysInMonth(n)),n}function Xr(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 Hm(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 Cl(e){let t=ue(e,new pn),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 Tl(e){return`${Cl(e)}T${Hm(e)}`}function _m(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 Bm(e){return`${Tl(e)}${_m(e.offset)}[${e.timeZone}]`}function gi(e){let t=typeof e[0]=="object"?e.shift():new pn,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 Ne{#e;constructor(...t){let[n,s,r,o,i]=gi(t);this.calendar=n,this.era=s,this.year=r,this.month=o,this.day=i,Gt(this)}copy(){return this.era?new Ne(this.calendar,this.era,this.year,this.month,this.day):new Ne(this.calendar,this.year,this.month,this.day)}add(t){return Tr(this,t)}subtract(t){return Sl(this,t)}set(t){return hi(this,t)}cycle(t,n,s){return pi(this,t,n,s)}toDate(t){return bl(this,t)}toString(){return Cl(this)}compare(t){return fl(this,t)}}class or{#e;constructor(...t){let[n,s,r,o,i]=gi(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,Gt(this)}copy(){return this.era?new or(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new or(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(t){return Tr(this,t)}subtract(t){return Sl(this,t)}set(t){return hi(rr(this,t),t)}cycle(t,n,s){switch(t){case"era":case"year":case"month":case"day":return pi(this,t,n,s);default:return $l(this,t,n,s)}}toDate(t,n){return bl(this,t,n)}toString(){return Tl(this)}compare(t){let n=fl(this,t);return n===0?ym(this,De(t)):n}}class ns{#e;constructor(...t){let[n,s,r,o,i]=gi(t),a=t.shift(),l=t.shift();this.calendar=n,this.era=s,this.year=r,this.month=o,this.day=i,this.timeZone=a,this.offset=l,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,Gt(this)}copy(){return this.era?new ns(this.calendar,this.era,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond):new ns(this.calendar,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond)}add(t){return Il(this,t)}subtract(t){return Dm(this,t)}set(t,n){return Pm(this,t,n)}cycle(t,n,s){return Rm(this,t,n,s)}toDate(){return Tm(this)}toString(){return Bm(this)}toAbsoluteString(){return this.toDate().toISOString()}compare(t){return this.toDate().getTime()-wl(t,this.timeZone).toDate().getTime()}}let Qr=new Map;class Oe{constructor(t,n={}){this.formatter=kl(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=qm(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 jm={true:{ja:"h11"},false:{}};function kl(e,t={}){if(typeof t.hour12=="boolean"&&Wm()){t={...t};let r=jm[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(Qr.has(n))return Qr.get(n);let s=new Intl.DateTimeFormat(e,t);return Qr.set(n,s),s}let eo=null;function Wm(){return eo==null&&(eo=new Intl.DateTimeFormat("en-US",{hour:"numeric",hour12:!1}).format(new Date(2020,2,3,0))==="24"),eo}let to=null;function Um(){return to==null&&(to=new Intl.DateTimeFormat("fr",{hour:"numeric",hour12:!1}).resolvedOptions().hourCycle==="h12"),to}function qm(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=kl(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 Gm(e,t,n,s,r){const o={};for(let a in t){const l=a,c=t[l];c!=null&&(o[l]=Math.floor(c/2),o[l]>0&&c%2===0&&o[l]--)}const i=zt(e,t,n).subtract(o);return is(e,i,t,n,s,r)}function zt(e,t,n,s,r){let o=e;return t.years?o=ts(e):t.months?o=rt(e):t.weeks&&(o=It(e,n)),is(e,o,t,n,s,r)}function mi(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=zt(e,t,n).subtract(o);return is(e,i,t,n,s,r)}function is(e,t,n,s,r,o){return r&&e.compare(r)>=0&&(t=ml(t,zt(jt(r),n,s))),o&&e.compare(o)<=0&&(t=gl(t,mi(jt(o),n,s))),t}function Le(e,t,n){const s=jt(e),r=t?jt(t):void 0,o=n?jt(n):void 0;let i=s;return r&&(i=ml(i,r)),o&&(i=gl(i,o)),i.compare(s)===0?e:"hour"in e?e.set({year:i.year,month:i.month,day:i.day}):i}function Ha(e,t,n,s,r,o){switch(t){case"start":return zt(e,n,s,r,o);case"end":return mi(e,n,s,r,o);default:return Gm(e,n,s,r,o)}}function St(e,t){return e==null||t==null?e===t:!("hour"in e)&&!("hour"in t)?$e(e,t):De(e).compare(De(t))===0}function _a(e,t,n,s,r){return e?t?.(e,n)?!0:je(e,s,r):!1}function je(e,t,n){return t!=null&&e.compare(t)<0||n!=null&&e.compare(n)>0}function Ym(e,t,n){const s=e.subtract({days:1});return $e(s,e)||je(s,t,n)}function Km(e,t,n){const s=e.add({days:1});return $e(s,e)||je(s,t,n)}function vi(e){let t={...e};for(let n in t)t[n]=1;return t}function Al(e,t){let n={...t};return n.days?n.days--:n.days=-1,e.add(n)}function Ll(e){if(!e)return;const t=e.calendar.identifier;return t==="gregory"||t==="iso8601"?e.era==="BC"?"short":void 0:"short"}function Ol(e,t,n){const s=n??De(Cr(t));return new Oe(e,{weekday:"long",month:"long",year:"numeric",day:"numeric",era:Ll(s),calendar:s.calendar.identifier,timeZone:t})}function Ba(e,t,n){const s=n??Cr(t);return new Oe(e,{month:"long",year:"numeric",era:Ll(s),calendar:s.calendar.identifier,timeZone:t})}function zm(e,t,n,s,r){let o=n.formatRangeToParts(e.toDate(r),t.toDate(r)),i=-1;for(let c=0;c<o.length;c++){let f=o[c];if(f.source==="shared"&&f.type==="literal")i=c;else if(f.source==="endRange")break}let a="",l="";for(let c=0;c<o.length;c++)c<i?a+=o[c].value:c>i&&(l+=o[c].value);return s(a,l)}function Ts(e,t,n,s){if(!e)return"";let r=e,o=t??e,i=Ol(n,s);return $e(r,o)?i.format(r.toDate(s)):zm(r,o,i,(a,l)=>`${a} – ${l}`,s)}var Zm=["sun","mon","tue","wed","thu","fri","sat"];function Ml(e){return e!=null?Zm[e]:void 0}function Dl(e,t,n){const s=Ml(n);return It(e,t,s)}function Rl(e,t,n,s){const r=t.add({weeks:e}),o=[];let i=Dl(r,n,s);for(;o.length<7;){o.push(i);let a=i.add({days:1});if($e(i,a))break;i=a}return o}function Jm(e,t,n,s){const r=Ml(s),o=n??xm(e,t,r);return[...new Array(o).keys()].map(a=>Rl(a,e,t,s))}function Xm(e,t){const n=new Oe(e,{weekday:"long",timeZone:t}),s=new Oe(e,{weekday:"short",timeZone:t}),r=new Oe(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 Qm(e,t,n,s){const r=Dl(e,s,t),o=[...new Array(7).keys()],i=Xm(s,n);return o.map(a=>i(r.add({days:a})))}function ev(e,t="long",n){if(!n||n.calendar.identifier==="gregory"||n.calendar.identifier==="iso8601"){const i=new Date(2021,0,1),a=[];for(let l=0;l<12;l++)a.push(i.toLocaleString(e,{month:t})),i.setMonth(i.getMonth()+1);return a}const s=n.calendar.getMonthsInYear(n),r=new Oe(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 ja(e,t){const n=It(e,t,"mon"),s=n.year,r=n.set({month:1,day:4}),o=It(r,t,"mon"),i=n.calendar.toJulianDay(n),a=o.calendar.toJulianDay(o);if(i>=a)return 1+Math.floor((i-a)/7);const l=n.set({year:s-1,month:1,day:4}),c=It(l,t,"mon"),f=c.calendar.toJulianDay(c);return 1+Math.floor((i-f)/7)}function tv(e){const t=[];for(let n=e.from;n<=e.to;n+=1)t.push(n);return t}var nv=1900,sv=2099;function rv(e,t,n){const s=e.calendar,r=t?.year??ue(new Ne(nv,1,1),s).year,o=n?.year??ue(new Ne(sv,12,31),s).year;return{from:r,to:o}}var ov=10;function iv(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+ov?(r-100).toString():r.toString()}return e}}function cn(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 Zn(e,t){const n=Cr(e??fi());return t?ue(n,t):n}function as(e,t,n,s){return function(o){const{startDate:i,focusedDate:a}=o,l=Al(i,e);return je(a,n,s)?{startDate:i,focusedDate:Le(a,n,s),endDate:l}:a.compare(i)<0?{startDate:mi(a,e,t,n,s),focusedDate:Le(a,n,s),endDate:l}:a.compare(l)>0?{startDate:zt(a,e,t,n,s),endDate:l,focusedDate:Le(a,n,s)}:{startDate:i,endDate:l,focusedDate:Le(a,n,s)}}}function Pl(e,t,n,s,r,o){const i=as(n,s,r,o),a=t.add(n);return i({focusedDate:e.add(n),startDate:zt(is(e,a,n,s,r,o),n,s)})}function Vl(e,t,n,s,r,o){const i=as(n,s,r,o);let a=t.subtract(n);return i({focusedDate:e.subtract(n),startDate:zt(is(e,a,n,s,r,o),n,s)})}function av(e,t,n,s,r,o,i){const a=as(s,r,o,i);if(!n&&!s.days)return a({focusedDate:e.add(vi(s)),startDate:t});if(s.days)return Pl(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 cv(e,t,n,s,r,o,i){const a=as(s,r,o,i);if(!n&&!s.days)return a({focusedDate:e.subtract(vi(s)),startDate:t});if(s.days)return Vl(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 Wa=new Map;function lv(e){let t=Wa.get(e);return t!=null||(t="0123456789"+new Intl.NumberFormat(e,{useGrouping:!1}).format(1234567890),Wa.set(e,t)),t}var dv=(e,t)=>t?lv(t).includes(e):/\d/.test(e),Nl=(e,t,n)=>!e||e.length!==1?!0:dv(e,n)||t.includes(e),uv=(e,t,n)=>e.split("").filter(s=>Nl(s,t,n)).join(""),Ua=new Map;function fv(e){let t=Ua.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:"/",Ua.set(e,t),t}var qa=e=>e!=null&&e.length===4,hv=e=>e!=null&&parseFloat(e)<=12,pv=e=>e!=null&&parseFloat(e)<=31;function gv(e,t,n){const s=mv(t,n);let{year:r,month:o,day:i}=vv(s,e)??{};if(r!=null||o!=null||i!=null){const c=new Date;r||(r=c.getFullYear().toString()),o||(o=(c.getMonth()+1).toString()),i||(i=c.getDate().toString())}if(qa(r)||(r=iv(r)),qa(r)&&hv(o)&&pv(i))return new Ne(+r,+o,+i);const l=Date.parse(e);if(!isNaN(l)){const c=new Date(l);return new Ne(c.getFullYear(),c.getMonth()+1,c.getDate())}}function mv(e,t){return new Oe(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 vv(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 Ga(e,t,n){const s=jt(ul(n));switch(e){case"thisWeek":return[It(s,t),Pa(s,t)];case"thisMonth":return[rt(s),s];case"thisQuarter":return[rt(s).add({months:-((s.month-1)%3)}),s];case"thisYear":return[ts(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[rt(s.add({months:-1})),Do(s.add({months:-1}))];case"lastQuarter":return[rt(s.add({months:-((s.month-1)%3)-3})),Do(s.add({months:-((s.month-1)%3)-1}))];case"lastWeek":return[It(s,t).add({weeks:-1}),Pa(s,t).add({weeks:-1})];case"lastYear":return[ts(s.add({years:-1})),wm(s.add({years:-1}))];default:throw new Error(`Invalid date range preset: ${e}`)}}var yv=(e,t)=>e.ids?.label?.(t)??`datepicker:${e.id}:label:${t}`,bv=e=>e.ids?.root??`datepicker:${e.id}`,wv=(e,t)=>e.ids?.table?.(t)??`datepicker:${e.id}:table:${t}`,No=e=>e.ids?.content??`datepicker:${e.id}:content`,no=(e,t)=>e.ids?.cellTrigger?.(t)??`datepicker:${e.id}:cell-trigger:${t}`,Ev=(e,t)=>e.ids?.prevTrigger?.(t)??`datepicker:${e.id}:prev:${t}`,xv=(e,t)=>e.ids?.nextTrigger?.(t)??`datepicker:${e.id}:next:${t}`,Sv=(e,t)=>e.ids?.viewTrigger?.(t)??`datepicker:${e.id}:view:${t}`,Fl=e=>e.ids?.clearTrigger??`datepicker:${e.id}:clear`,Hl=e=>e.ids?.control??`datepicker:${e.id}:control`,Ya=(e,t)=>e.ids?.input?.(t)??`datepicker:${e.id}:input:${t}`,_l=e=>e.ids?.trigger??`datepicker:${e.id}:trigger`,Bl=e=>e.ids?.positioner??`datepicker:${e.id}:positioner`,jl=e=>e.ids?.monthSelect??`datepicker:${e.id}:month-select`,Wl=e=>e.ids?.yearSelect??`datepicker:${e.id}:year-select`,Ka=(e,t)=>Lf(nn(e),`[data-part=table-cell-trigger][data-view=${t}][data-focus]:not([data-outside-range])`),_s=e=>e.getById(_l(e)),nn=e=>e.getById(No(e)),qn=e=>Af(Ul(e),"[data-part=input]"),$v=e=>e.getById(Wl(e)),Iv=e=>e.getById(jl(e)),Cv=e=>e.getById(Fl(e)),za=e=>e.getById(Bl(e)),Ul=e=>e.getById(Hl(e)),Za=e=>{const t=qn(e);if(t.length===0){_s(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 Bs(e){const[t,n]=e;let s;return!t||!n?s=e:s=t.compare(n)<=0?e:[n,t],s}function en(e,t){const[n,s]=t;return!n||!s?!1:n.compare(e)<=0&&s.compare(e)>=0}function ks(e){return e.slice().filter(t=>t!=null).sort((t,n)=>t.compare(n))}function Tv(e,t){return new Oe(e).formatToParts(new Date).map(n=>t[n.type]??n.value).join("")}var Ja=e=>!Number.isNaN(e.day)&&!Number.isNaN(e.month)&&!Number.isNaN(e.year),kv={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 uo(e,{year:"Switch to previous decade",month:"Switch to previous year",day:"Switch to previous month"})},nextTrigger(e){return uo(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 lt(e,t){return e?e==="day"?0:e==="month"?1:2:t||0}function yi(e){return e===0?"day":e===1?"month":"year"}function bi(e,t,n){return yi(bu(lt(e,0),lt(t,0),lt(n,2)))}function Av(e,t){return lt(e,0)>lt(t,0)}function Lv(e,t){return lt(e,0)<lt(t,0)}function ql(e,t,n){const s=lt(e,0)+1;return bi(yi(s),t,n)}function Ov(e,t,n){const s=lt(e,0)-1;return bi(yi(s),t,n)}var Mv=["day","month","year"];function Dv(e){Mv.forEach(t=>e(t))}var Rv=kp(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=cn(n.year),g=u.at(0).toString(),h=u.at(-1).toString();return{start:g,end:h,formatted:`${g} - ${h}`}}if(e==="month"){const u=new Oe(r,{year:"numeric",timeZone:o,calendar:n.calendar.identifier}),g=u.format(n.toDate(o)),h=u.format(s.toDate(o)),p=i==="range"?`${g} - ${h}`:g;return{start:g,end:h,formatted:p}}const a=new Oe(r,{month:"long",year:"numeric",timeZone:o,calendar:n.calendar.identifier}),l=a.format(n.toDate(o)),c=a.format(s.toDate(o)),f=i==="range"?`${l} - ${c}`:l;return{start:l,end:c,formatted:f}});function Pv(e,t){const{state:n,context:s,prop:r,send:o,computed:i,scope:a}=e,l=s.get("startValue"),c=i("endValue"),f=s.get("value"),u=s.get("focusedValue"),g=s.get("hoveredValue"),h=g?Bs([f[0],g]):[],p=!!r("disabled"),d=!!r("readOnly"),m=!!r("invalid"),y=i("isInteractive"),$=f.length===0,E=r("min"),O=r("max"),M=r("locale"),D=r("timeZone"),w=r("startOfWeek"),S=n.matches("focused"),x=n.matches("open"),k=r("selectionMode")==="range",b=r("selectionMode")==="multiple",A=r("isDateUnavailable"),R=r("maxSelectedDates"),V=b&&R!=null&&f.length>=R,H=s.get("currentPlacement"),Z=H?Hc(H):void 0,re=_c({...r("positioning"),placement:H}),J=fv(M),W=dc(kv,r("translations"));function we(L=l){const I=r("fixedWeeks")?6:void 0;return Jm(L,M,I,w)}function Dt(L={}){const{format:I}=L;return ev(M,I,u).map((v,C)=>{const F=C+1,Q=u.set({month:F}),U=je(Q,E,O);return{label:v,value:F,disabled:U}})}function Ce(){const L=rv(u,E,O);return tv(L).map(v=>({label:v.toString(),value:v,disabled:!Pr(v,E?.year,O?.year)}))}function Je(L){return _a(L,A,M,E,O)}function Rt(L){const I=l??Zn(D,u.calendar);o({type:"FOCUS.SET",value:I.set({month:L})})}function Zt(L){const I=l??Zn(D,u.calendar);o({type:"FOCUS.SET",value:I.set({year:L})})}function wt(L){const{value:I,disabled:v}=L,C=u.set({year:I}),Q=!cn(l.year).includes(I),U=Pr(I,E?.year,O?.year),G=k&&en(C,f),de=k&&f[0]&&Vn(C,f[0]),Ve=k&&f[1]&&Vn(C,f[1]),He=k&&h.length>0,ie=He&&en(C,h),_e=He&&h[0]&&Vn(C,h[0]),Be=He&&h[1]&&Vn(C,h[1]),us={focused:u.year===L.value,selectable:U,outsideRange:Q,selected:!!f.find(fs=>fs&&fs.year===I),valueText:I.toString(),inRange:G||ie,firstInRange:!!de,lastInRange:!!Ve,inHoveredRange:!!ie,firstInHoveredRange:!!_e,lastInHoveredRange:!!Be,value:C,get disabled(){return v||!us.selectable}};return us}function Pt(L){const{value:I,disabled:v}=L,C=u.set({month:I}),F=Ba(M,D,u),Q=k&&en(C,f),U=k&&f[0]&&Pn(C,f[0]),G=k&&f[1]&&Pn(C,f[1]),de=k&&h.length>0,Ve=de&&en(C,h),He=de&&h[0]&&Pn(C,h[0]),ie=de&&h[1]&&Pn(C,h[1]),_e={focused:u.month===L.value,selectable:!je(C,E,O),selected:!!f.find(Be=>Be&&Be.month===I&&Be.year===u.year),valueText:F.format(C.toDate(D)),inRange:Q||Ve,firstInRange:!!U,lastInRange:!!G,inHoveredRange:!!Ve,firstInHoveredRange:!!He,lastInHoveredRange:!!ie,outsideRange:!1,value:C,get disabled(){return v||!_e.selectable}};return _e}function Et(L){const{value:I,disabled:v,visibleRange:C=i("visibleRange")}=L,F=Ol(M,D,u),Q=vi(i("visibleDuration")),U=r("outsideDaySelectable"),G=C.start.add(Q).subtract({days:1}),de=je(I,C.start,G),Ve=k&&en(I,f),He=k&&f[0]&&$e(I,f[0]),ie=k&&f[1]&&$e(I,f[1]),_e=k&&h.length>0,Be=_e&&en(I,h),us=_e&&h[0]&&$e(I,h[0]),fs=_e&&h[1]&&$e(I,h[1]),Ri=f.some(Pi=>Pi!=null&&$e(I,Pi)),hs={invalid:je(I,E,O),disabled:v||!U&&de||je(I,E,O)||V&&!Ri,selected:Ri,unavailable:_a(I,A,M,E,O)&&!v,outsideRange:de,today:mm(I,D),weekend:$m(I,M),value:I,valueText:F.format(I.toDate(D)),get focused(){return u!=null&&$e(I,u)&&(!hs.outsideRange||U)},get selectable(){return!hs.disabled&&!hs.unavailable},inRange:Ve||Be,firstInRange:He,lastInRange:ie,inHoveredRange:Be,firstInHoveredRange:us,lastInHoveredRange:fs};return hs}function In(L){const{view:I="day",id:v}=L;return[I,v].filter(Boolean).join(" ")}return{focused:S,open:x,disabled:p,invalid:m,readOnly:d,inline:!!r("inline"),numOfMonths:r("numOfMonths"),showWeekNumbers:!!r("showWeekNumbers"),selectionMode:r("selectionMode"),maxSelectedDates:R,isMaxSelected:V,view:s.get("view"),getRangePresetValue(L){return Ga(L,M,D)},getWeekNumber(L){const I=L[0];return I?ja(I,M):0},getDaysInWeek(L,I=l){return Rl(L,I,M,w)},getOffset(L){const I=l.add(L),v=c.add(L),C=Ba(M,D,u);return{visibleRange:{start:I,end:v},weeks:we(I),visibleRangeText:{start:C.format(I.toDate(D)),end:C.format(v.toDate(D))}}},getMonthWeeks:we,isUnavailable:Je,weeks:we(),weekDays:Qm(l,w,D,M),visibleRangeText:i("visibleRangeText"),value:f,valueAsDate:f.filter(L=>L!=null).map(L=>L.toDate(D)),valueAsString:i("valueAsString"),focusedValue:u,focusedValueAsDate:u?.toDate(D),focusedValueAsString:r("format")(u,{locale:M,timeZone:D}),visibleRange:i("visibleRange"),selectToday(){const L=Le(Zn(D,u.calendar),E,O);o({type:"VALUE.SET",value:[L]})},setValue(L){const I=L.map(v=>Le(v,E,O));o({type:"VALUE.SET",value:I})},setTime(L,I=0){const v=Array.from(f);let C=v[I];C&&("hour"in C||(C=De(C)),C=C.set({hour:L.hour??("hour"in C?C.hour:0),minute:L.minute??("minute"in C?C.minute:0),second:L.second??("second"in C?C.second:0),millisecond:L.millisecond??("millisecond"in C?C.millisecond:0)}),v[I]=Le(C,E,O),o({type:"VALUE.SET",value:v}))},clearValue(L={}){const{focus:I=!0}=L;o({type:"VALUE.CLEAR",focus:I})},setFocusedValue(L){o({type:"FOCUS.SET",value:L})},setOpen(L){r("inline")||o({type:L?"OPEN":"CLOSE",replaces:"open"})},focusMonth:Rt,focusYear:Zt,getYears:Ce,getMonths:Dt,getYearsGrid(L={}){const{columns:I=1}=L,v=cn(l.year).map(C=>({label:C.toString(),value:C,disabled:!Pr(C,E?.year,O?.year)}));return Bi(v,I)},getDecade(){const L=cn(l.year);return{start:L.at(0),end:L.at(-1)}},getMonthsGrid(L={}){const{columns:I=1,format:v}=L;return Bi(Dt({format:v}),I)},format(L,I={month:"long",year:"numeric"}){return new Oe(M,{...I,calendar:L.calendar.identifier}).format(L.toDate(D))},setView(L){o({type:"VIEW.SET",view:L})},goToNext(){o({type:"GOTO.NEXT",view:s.get("view")})},goToPrev(){o({type:"GOTO.PREV",view:s.get("view")})},getRootProps(){return t.element({...X.root.attrs,dir:r("dir"),id:bv(a),"data-state":x?"open":"closed","data-disabled":P(p),"data-readonly":P(d),"data-empty":P($)})},getLabelProps(L={}){const{index:I=0}=L;return t.label({...X.label.attrs,id:yv(a,I),dir:r("dir"),htmlFor:Ya(a,I),"data-state":x?"open":"closed","data-index":I,"data-disabled":P(p),"data-readonly":P(d),"data-invalid":P(m)})},getControlProps(){return t.element({...X.control.attrs,dir:r("dir"),id:Hl(a),"data-disabled":P(p),"data-placeholder-shown":P($),"data-invalid":P(m)})},getRangeTextProps(){return t.element({...X.rangeText.attrs,dir:r("dir")})},getContentProps(){return t.element({...X.content.attrs,hidden:!x,dir:r("dir"),"data-state":x?"open":"closed","data-placement":H,"data-side":Z,"data-inline":P(r("inline")),id:No(a),tabIndex:-1,role:"application","aria-label":W.content})},getTableProps(L={}){const{view:I="day",columns:v=I==="day"?7:4}=L,C=In(L);return t.element({...X.table.attrs,role:"grid","data-columns":v,"aria-label":i("visibleRangeText").formatted,id:wv(a,C),"aria-readonly":he(d),"aria-disabled":he(p),"aria-multiselectable":he(r("selectionMode")!=="single"),"data-view":I,dir:r("dir"),tabIndex:-1,onKeyDown(F){if(F.defaultPrevented||p)return;const Q={Enter(){y&&(I==="day"&&Je(u)||I==="month"&&!Pt({value:u.month}).selectable||I==="year"&&!wt({value:u.year}).selectable||o({type:"TABLE.ENTER",view:I,columns:v,focus:!0}))},Space(G){Q.Enter?.()},ArrowLeft(){o({type:"TABLE.ARROW_LEFT",view:I,columns:v,focus:!0})},ArrowRight(){o({type:"TABLE.ARROW_RIGHT",view:I,columns:v,focus:!0})},ArrowUp(){o({type:"TABLE.ARROW_UP",view:I,columns:v,focus:!0})},ArrowDown(){o({type:"TABLE.ARROW_DOWN",view:I,columns:v,focus:!0})},PageUp(G){o({type:"TABLE.PAGE_UP",larger:G.shiftKey,view:I,columns:v,focus:!0})},PageDown(G){o({type:"TABLE.PAGE_DOWN",larger:G.shiftKey,view:I,columns:v,focus:!0})},Home(){o({type:"TABLE.HOME",view:I,columns:v,focus:!0})},End(){o({type:"TABLE.END",view:I,columns:v,focus:!0})}},U=Q[ho(F,{dir:r("dir")})];U&&(U(F),F.preventDefault(),F.stopPropagation())},onPointerLeave(){o({type:"TABLE.POINTER_LEAVE"})},onPointerDown(){o({type:"TABLE.POINTER_DOWN",view:I})},onPointerUp(){o({type:"TABLE.POINTER_UP",view:I})}})},getTableHeadProps(L={}){const{view:I="day"}=L;return t.element({...X.tableHead.attrs,"aria-hidden":!0,dir:r("dir"),"data-view":I,"data-disabled":P(p)})},getTableHeaderProps(L={}){const{view:I="day"}=L;return t.element({...X.tableHeader.attrs,dir:r("dir"),"data-view":I,"data-disabled":P(p)})},getTableBodyProps(L={}){const{view:I="day"}=L;return t.element({...X.tableBody.attrs,"data-view":I,"data-disabled":P(p)})},getTableRowProps(L={}){const{view:I="day"}=L;return t.element({...X.tableRow.attrs,"aria-disabled":he(p),"data-disabled":P(p),"data-view":I})},getWeekNumberHeaderCellProps(L={}){const{view:I="day"}=L;return t.element({...X.tableCell.attrs,scope:"col","aria-label":W.weekColumnHeader,"data-view":I,"data-type":"week-number","data-disabled":P(p)})},getWeekNumberCellProps(L){const{weekIndex:I,week:v}=L,C=v[0]?ja(v[0],M):0;return t.element({...X.tableCell.attrs,role:"rowheader","aria-label":W.weekNumberCell?.(C),"data-view":"day","data-week-index":I,"data-type":"week-number","data-disabled":P(p)})},getDayTableCellState:Et,getDayTableCellProps(L){const{value:I}=L,v=Et(L);return t.element({...X.tableCell.attrs,role:"gridcell","aria-disabled":he(!v.selectable),"aria-selected":v.selected||v.inRange,"aria-invalid":he(v.invalid),"aria-current":v.today?"date":void 0,"data-value":I.toString()})},getDayTableCellTriggerProps(L){const{value:I}=L,v=Et(L);return t.element({...X.tableCellTrigger.attrs,id:no(a,I.toString()),role:"button",dir:r("dir"),tabIndex:p?-1:v.focused?0:-1,"aria-label":W.dayCell(v),"aria-disabled":he(!v.selectable),"aria-invalid":he(v.invalid),"data-disabled":P(!v.selectable),"data-selectable":P(v.selectable),"data-selected":P(v.selected),"data-value":I.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(C){C.defaultPrevented||y&&v.selectable&&o({type:"CELL.CLICK",cell:"day",value:I})},onPointerMove:k?C=>{if(C.pointerType==="touch"||!v.selectable)return;const F=!a.isActiveElement(C.currentTarget);g&&gm(I,g)||o({type:"CELL.POINTER_MOVE",cell:"day",value:I,focus:F,outsideRange:v.outsideRange})}:void 0})},getMonthTableCellState:Pt,getMonthTableCellProps(L){const{value:I,columns:v}=L,C=Pt(L);return t.element({...X.tableCell.attrs,dir:r("dir"),colSpan:v,role:"gridcell","aria-selected":he(C.selected||C.inRange),"data-selected":P(C.selected),"aria-disabled":he(!C.selectable),"data-value":I})},getMonthTableCellTriggerProps(L){const{value:I}=L,v=Pt(L);return t.element({...X.tableCellTrigger.attrs,id:no(a,I.toString()),role:"button",dir:r("dir"),tabIndex:p?-1:v.focused?0:-1,"aria-label":v.valueText,"aria-disabled":he(!v.selectable),"data-disabled":P(!v.selectable),"data-selectable":P(v.selectable),"data-selected":P(v.selected),"data-value":I,"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(C){C.defaultPrevented||y&&v.selectable&&o({type:"CELL.CLICK",cell:"month",value:I})},onPointerMove:k?C=>{if(C.pointerType==="touch"||!v.selectable)return;const F=!a.isActiveElement(C.currentTarget);g&&v.value&&Pn(v.value,g)||o({type:"CELL.POINTER_MOVE",cell:"month",value:v.value,focus:F})}:void 0})},getYearTableCellState:wt,getYearTableCellProps(L){const{value:I,columns:v}=L,C=wt(L);return t.element({...X.tableCell.attrs,dir:r("dir"),colSpan:v,role:"gridcell","aria-selected":he(C.selected||C.inRange),"data-selected":P(C.selected),"aria-disabled":he(!C.selectable),"data-value":I})},getYearTableCellTriggerProps(L){const{value:I}=L,v=wt(L);return t.element({...X.tableCellTrigger.attrs,id:no(a,I.toString()),role:"button",dir:r("dir"),tabIndex:p?-1:v.focused?0:-1,"aria-label":v.valueText,"aria-disabled":he(!v.selectable),"data-disabled":P(!v.selectable),"data-selectable":P(v.selectable),"data-selected":P(v.selected),"data-value":I,"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(C){C.defaultPrevented||y&&v.selectable&&o({type:"CELL.CLICK",cell:"year",value:I})},onPointerMove:k?C=>{if(C.pointerType==="touch"||!v.selectable||v.outsideRange)return;const F=!a.isActiveElement(C.currentTarget);g&&v.value&&Vn(v.value,g)||o({type:"CELL.POINTER_MOVE",cell:"year",value:v.value,focus:F})}:void 0})},getNextTriggerProps(L={}){const{view:I="day"}=L,v=p||!i("isNextVisibleRangeValid");return t.button({...X.nextTrigger.attrs,dir:r("dir"),id:xv(a,I),type:"button","aria-label":W.nextTrigger(I),disabled:v,"data-disabled":P(v),onClick(C){C.defaultPrevented||o({type:"GOTO.NEXT",view:I})}})},getPrevTriggerProps(L={}){const{view:I="day"}=L,v=p||!i("isPrevVisibleRangeValid");return t.button({...X.prevTrigger.attrs,dir:r("dir"),id:Ev(a,I),type:"button","aria-label":W.prevTrigger(I),disabled:v,"data-disabled":P(v),onClick(C){C.defaultPrevented||o({type:"GOTO.PREV",view:I})}})},getClearTriggerProps(){return t.button({...X.clearTrigger.attrs,id:Fl(a),dir:r("dir"),type:"button","aria-label":W.clearTrigger,hidden:!f.length,onClick(L){L.defaultPrevented||y&&o({type:"VALUE.CLEAR"})}})},getTriggerProps(){return t.button({...X.trigger.attrs,id:_l(a),dir:r("dir"),type:"button","data-placement":H,"data-side":Z,"aria-label":W.trigger(x),"aria-controls":No(a),"aria-expanded":x,"data-state":x?"open":"closed","data-placeholder-shown":P($),"aria-haspopup":"grid",disabled:p,onClick(L){L.defaultPrevented||y&&o({type:"TRIGGER.CLICK"})}})},getViewProps(L={}){const{view:I="day"}=L;return t.element({...X.view.attrs,"data-view":I,hidden:s.get("view")!==I})},getViewTriggerProps(L={}){const{view:I="day"}=L,v=ql(I,r("minView"),r("maxView")),C=v!==I,F=p||!C;return t.button({...X.viewTrigger.attrs,"data-view":I,dir:r("dir"),id:Sv(a,I),type:"button",disabled:F,"data-disabled":P(F),"aria-label":W.viewTrigger(I,C?v:void 0),onClick(Q){Q.defaultPrevented||y&&o({type:"VIEW.TOGGLE",src:"viewTrigger"})}})},getViewControlProps(L={}){const{view:I="day"}=L;return t.element({...X.viewControl.attrs,"data-view":I,dir:r("dir")})},getInputProps(L={}){const{index:I=0,fixOnBlur:v=!0}=L;return t.input({...X.input.attrs,id:Ya(a,I),autoComplete:"off",autoCorrect:"off",spellCheck:"false",dir:r("dir"),name:r("name"),"data-index":I,"data-state":x?"open":"closed","data-placeholder-shown":P($),readOnly:d,disabled:p,required:r("required"),"aria-invalid":he(m),"data-invalid":P(m),placeholder:r("placeholder")||Tv(M,W.placeholder(M)),defaultValue:i("valueAsString")[I],onBeforeInput(C){const{data:F}=Jo(C);Nl(F,J,M)||C.preventDefault()},onClick(C){C.defaultPrevented||r("openOnClick")&&y&&o({type:"OPEN",src:"input.click"})},onFocus(){o({type:"INPUT.FOCUS",index:I})},onBlur(C){const F=C.currentTarget.value.trim();o({type:"INPUT.BLUR",value:F,index:I,fixOnBlur:v})},onKeyDown(C){if(C.defaultPrevented||!y)return;const Q={Enter(U){Ju(U)||Je(u)||U.currentTarget.value.trim()!==""&&o({type:"INPUT.ENTER",value:U.currentTarget.value,index:I})}}[C.key];Q&&(Q(C),C.preventDefault())},onInput(C){const F=C.currentTarget.value;o({type:"INPUT.CHANGE",value:uv(F,J,M),index:I})}})},getMonthSelectProps(){return t.select({...X.monthSelect.attrs,id:jl(a),"aria-label":W.monthSelect,disabled:p,dir:r("dir"),defaultValue:l.month,onChange(L){Rt(Number(L.currentTarget.value))}})},getYearSelectProps(){return t.select({...X.yearSelect.attrs,id:Wl(a),disabled:p,"aria-label":W.yearSelect,dir:r("dir"),defaultValue:l.year,onChange(L){Zt(Number(L.currentTarget.value))}})},getPositionerProps(){return t.element({id:Bl(a),...X.positioner.attrs,dir:r("dir"),style:re.floating})},getPresetTriggerProps(L){const I=Array.isArray(L.value)?L.value:Ga(L.value,M,D),v=I.filter(C=>C!=null).map(C=>C.toDate(D).toDateString());return t.button({...X.presetTrigger.attrs,"aria-label":W.presetTrigger(v),type:"button",onClick(C){C.defaultPrevented||y&&o({type:"PRESET.CLICK",value:I})}})}}}var so="__live-region-debug__",Vv="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;",Nv=100,Fv=200,Hv={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 _v(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 l;function c(){if(!o)return;let m=n.getElementById(so);return m||(m=n.createElement("div"),m.id=so,m.dataset.liveAnnouncerDebug="true",m.setAttribute("aria-hidden","true"),m.style.cssText=Vv,a().appendChild(m),m)}function f(){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,Hv),a().appendChild(m),u=Date.now()+Fv,m}let u=0,g=f();function h(){i.clearTimeout(l),l=void 0}function p(m,y=r){h(),g?.isConnected||(g=f());const $=g;$.textContent="",l=i.setTimeout(()=>{l=void 0,$.textContent=m;const E=c();E&&(E.textContent=m)},Math.max(y,Nv,u-Date.now()))}function d(){h(),g?.remove(),g=null,o&&n.getElementById(so)?.remove()}return{announce:p,cancel:h,destroy:d,toJSON(){return"live-region"}}}var{and:be}=Gc();function Bv(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(!St(e[s],t[s]))return!1;return!0}function As(e,t){return e.map(n=>n==null?"":t("format")(n,{locale:t("locale"),timeZone:t("timeZone")}))}var jv=Yc({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 p=new Intl.DateTimeFormat(t).resolvedOptions().calendar;p!=="gregory"&&p!=="iso8601"&&(o=e.createCalendar(p))}const i=h=>!o||h.calendar.identifier===o.identifier?h:ue(h,o),a=e.defaultValue?ks(e.defaultValue).map(h=>Le(i(h),e.min,e.max)):void 0,l=e.value?ks(e.value).map(h=>Le(i(h),e.min,e.max)):void 0;let c=e.focusedValue||e.defaultFocusedValue||l?.[0]||a?.[0]||Zn(n,o);c=Le(i(c),e.min,e.max);const f=e.minView||"day",u=e.maxView||"year",g=bi(e.defaultView||e.view||f,f,u);return{locale:t,numOfMonths:r,timeZone:n,selectionMode:s,minView:f,maxView:u,outsideDaySelectable:!1,closeOnSelect:!0,format(h,{locale:p,timeZone:d}){return new Oe(p,{timeZone:d,day:"2-digit",month:"2-digit",year:"numeric",calendar:o?.identifier}).format(h.toDate(d))},parse(h,{locale:p,timeZone:d}){return gv(h,p,d)},...e,focusedValue:typeof e.focusedValue>"u"?void 0:c,defaultFocusedValue:c,value:l,defaultValue:a??[],defaultView:g,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:St,hash:s=>s.toString(),sync:!0,onChange(s){const r=n(),o=r.get("view"),i=r.get("value"),a=As(i,e);e("onFocusChange")?.({value:i,valueAsString:a,view:o,focusedValue:s})}})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:Bv,hash:s=>s.map(r=>r?.toString()??"").join(","),onChange(s){const r=n(),o=As(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:St})),view:t(()=>({defaultValue:e("defaultView"),value:e("view"),onChange(s){e("onViewChange")?.({view:s})}})),startValue:t(()=>{const s=e("focusedValue")||e("defaultFocusedValue");return{defaultValue:Ha(s,"start",{months:e("numOfMonths")},e("locale")),isEqual:St,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})=>Al(e.get("startValue"),t("visibleDuration")),visibleRange:({context:e,computed:t})=>({start:e.get("startValue"),end:t("endValue")}),visibleRangeText:({context:e,prop:t,computed:n})=>Rv({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})=>!Ym(e.get("startValue"),t("min"),t("max")),isNextVisibleRangeValid:({prop:e,computed:t})=>!Km(t("endValue"),e("min"),e("max")),valueAsString:({context:e,prop:t})=>As(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:be("shouldRestoreFocus","isInteractOutsideEvent"),target:"focused",actions:["restoreFocusToTrigger"]},{guard:"shouldRestoreFocus",target:"focused",actions:["restoreFocusToInput"]},{target:"idle"}],"CELL.CLICK":[{guard:"isAboveMinView",actions:["setFocusedValueForView","setPreviousView"]},{guard:be("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","resetSelection","setActiveIndexToEnd"]},{guard:be("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","setRestoreFocus"]},{guard:be("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","restoreFocusToInput"]},{guard:be("isRangePicker","isSelectingEndDate"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setFocusedDate","setSelectedDate","setActiveIndexToEnd"]},{guard:be("isMultiPicker","canSelectDate"),actions:["setFocusedDate","toggleSelectedDate"]},{guard:"isMultiPicker",actions:["setFocusedDate"]},{guard:be("closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["setFocusedDate","setSelectedDate","invokeOnClose","restoreFocusToInput"]},{actions:["setFocusedDate","setSelectedDate"]}],"CELL.POINTER_MOVE":[{guard:be("isRangePicker","isSelectingEndDate","isDayPointerMoveOutsideVisibleMonth"),actions:["setHoveredDate"]},{guard:be("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:be("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","resetSelection","setActiveIndexToEnd","focusNextDay"]},{guard:be("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose"]},{guard:be("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","restoreFocusToInput"]},{guard:be("isRangePicker","isSelectingEndDate"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setSelectedDate","setActiveIndexToEnd","focusNextDay"]},{guard:be("isMultiPicker","canSelectDate"),actions:["toggleSelectedDate"]},{guard:"isMultiPicker"},{guard:be("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})=>Av(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=Gn(e,s.value??t.get("focusedValue"));return o.some(l=>St(l,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=Ul(n);return xo(s,()=>za(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",_v({level:"assertive",document:n})),()=>t.get("announcer")?.destroy?.()},trackDismissableElement({scope:e,send:t,context:n,prop:s}){return s("inline")?void 0:Zc(()=>nn(e),{type:"popover",defer:!0,getRootNode:e.getRootNode,layerStyleTargets:[()=>za(e)],exclude:[...qn(e),_s(e),Cv(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=ql(e.get("view"),t("minView"),t("maxView"));e.set("view",n)},setPreviousView({context:e,prop:t}){const n=Ov(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,l]=s;a&&l?i=Ts(a,l,r,o):a?i=Ts(a,null,r,o):l?i=Ts(l,null,r,o):i=""}else i=s.map(a=>Ts(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}){kf({target:nn(e),doc:e.getDoc()})},enableTextSelection({scope:e}){Ic({doc:e.getDoc(),target:nn(e)})},focusFirstSelectedDate(e){const{context:t}=e;t.get("value").length&&ne(e,t.get("value")[0])},syncInputElement({scope:e,computed:t}){pe(()=>{qn(e).forEach((s,r)=>{ms(s,t("valueAsString")[r]||"")})})},setFocusedDate(e){const{event:t}=e,n=Array.isArray(t.value)?t.value[0]:t.value;ne(e,n)},setFocusedValueForView(e){const{context:t,event:n}=e;ne(e,t.get("focusedValue").set({[t.get("view")]:n.value}))},focusNextMonth(e){const{context:t}=e;ne(e,t.get("focusedValue").add({months:1}))},focusPreviousMonth(e){const{context:t}=e;ne(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=>Le(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=Gn(e,n.value??t.get("focusedValue"));s[r]=Ls(o,i),t.set("value",Bs(s))},resetSelection(e){const{context:t,event:n}=e,s=t.get("value")[0],r=Gn(e,n.value??t.get("focusedValue"));t.set("value",[Ls(s,r)])},toggleSelectedDate(e){const{context:t,event:n}=e,s=Gn(e,n.value??t.get("focusedValue")),r=t.get("value"),o=r.findIndex(i=>St(i,s));if(o===-1){const i=[...r,s];t.set("value",ks(i))}else{const i=Array.from(r);i.splice(o,1),t.set("value",ks(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]=Ls(r,o),e.set("value",Bs(n));const i=t("valueAsString");e.set("inputValue",i[s])},focusPreviousDay(e){const{context:t}=e,n=t.get("focusedValue").subtract({days:1});ne(e,n)},focusNextDay(e){const{context:t}=e,n=t.get("focusedValue").add({days:1});ne(e,n)},focusPreviousWeek(e){const{context:t}=e,n=t.get("focusedValue").subtract({weeks:1});ne(e,n)},focusNextWeek(e){const{context:t}=e,n=t.get("focusedValue").add({weeks:1});ne(e,n)},focusNextPage(e){const{context:t,computed:n,prop:s}=e,r=Pl(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),s("locale"),s("min"),s("max"));Os(e,r)},focusPreviousPage(e){const{context:t,computed:n,prop:s}=e,r=Vl(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),s("locale"),s("min"),s("max"));Os(e,r)},focusSectionStart(e){const{context:t}=e;ne(e,t.get("startValue").copy())},focusSectionEnd(e){const{computed:t}=e;ne(e,t("endValue").copy())},focusNextSection(e){const{context:t,event:n,computed:s,prop:r}=e,o=av(t.get("focusedValue"),t.get("startValue"),n.larger,s("visibleDuration"),r("locale"),r("min"),r("max"));o&&Os(e,o)},focusPreviousSection(e){const{context:t,event:n,computed:s,prop:r}=e,o=cv(t.get("focusedValue"),t.get("startValue"),n.larger,s("visibleDuration"),r("locale"),r("min"),r("max"));o&&Os(e,o)},focusNextYear(e){const{context:t}=e,n=t.get("focusedValue").add({years:1});ne(e,n)},focusPreviousYear(e){const{context:t}=e,n=t.get("focusedValue").subtract({years:1});ne(e,n)},focusNextDecade(e){const{context:t}=e,n=t.get("focusedValue").add({years:10});ne(e,n)},focusPreviousDecade(e){const{context:t}=e,n=t.get("focusedValue").subtract({years:10});ne(e,n)},clearFocusedDate(e){const{context:t,prop:n}=e,s=t.get("focusedValue").calendar;ne(e,Zn(n("timeZone"),s))},focusPreviousMonthColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").subtract({months:n.columns});ne(e,s)},focusNextMonthColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").add({months:n.columns});ne(e,s)},focusPreviousYearColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").subtract({years:n.columns});ne(e,s)},focusNextYearColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").add({years:n.columns});ne(e,s)},focusFirstMonth(e){const{context:t}=e,n=t.get("focusedValue"),s=n.calendar.getMinimumMonthInYear?.(n)??1;ne(e,n.set({month:s}))},focusLastMonth(e){const{context:t}=e,n=t.get("focusedValue"),s=n.calendar.getMonthsInYear(n);ne(e,n.set({month:s}))},focusFirstYear(e){const{context:t}=e,n=cn(t.get("focusedValue").year),s=t.get("focusedValue").set({year:n[0]});ne(e,s)},focusLastYear(e){const{context:t}=e,n=cn(t.get("focusedValue").year),s=t.get("focusedValue").set({year:n[n.length-1]});ne(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"&&pe(()=>{const s=t.get("view");Ka(e,s)?.focus({preventScroll:!0})})},focusActiveCellIfNeeded({scope:e,context:t,event:n}){n.focus&&pe(()=>{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=nn(e),s=Wv(t);pe(()=>{qi(e.getActiveElement(),[n])||_s(e)?.focus(s)})},focusFirstInputElement({scope:e,event:t}){t.focus!==!1&&pe(()=>{const[n]=qn(e);(n??_s(e))?.focus({preventScroll:!0})})},focusInputElement({scope:e}){pe(()=>Za(e))},restoreFocusToInput({scope:e}){const t=nn(e);pe(()=>{qi(e.getActiveElement(),[t])||Za(e)})},syncMonthSelectElement({scope:e,context:t}){const n=Iv(e);ms(n,t.get("startValue").month.toString())},syncYearSelectElement({scope:e,context:t}){const n=$v(e);ms(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=qn(e),r=n.index??t.get("activeIndex");ms(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||!Ja(r)||ne(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||!Ja(r))&&t.value&&(r=e.get("focusedValue").copy()),!r)return;r=Le(r,n("min"),n("max"));const o=Array.from(e.get("value"));o[t.index]=Ls(o[t.index],r);const i=Bs(o);e.set("value",i);const a=As(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(!je(s,e.get("startValue"),t("endValue")))return;const o=Ha(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})}}}}),Gn=(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 Dv(i=>{Lv(i,s("minView"))&&(o=o.set({[i]:i==="day"?1:0}))}),o},Ls=(e,t)=>{if(!e||!("hour"in e))return t;const n="timeZone"in e;let s=t;return"hour"in t||(n?s=wl(De(t),e.timeZone):s=De(t)),s.set({hour:e.hour,minute:e.minute,second:e.second,millisecond:e.millisecond})};function ne(e,t){const{context:n,prop:s,computed:r}=e;if(!t)return;const o=Gn(e,t);if(St(n.get("focusedValue"),o))return;const a=as(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 Os(e,t){const{context:n}=e;n.set("startValue",t.startDate);const s=n.get("focusedValue");St(s,t.focusedDate)||n.set("focusedValue",t.focusedDate)}function Wv(e){return e.focusVisible??e.previousEvent?.focusVisible?{preventScroll:!0,focusVisible:!0}:{preventScroll:!0}}function Gl(e){return Array.isArray(e)?e.map(t=>Gl(t)):e instanceof Date?new Ne(e.getFullYear(),e.getMonth()+1,e.getDate()):Fm(e)}const ro=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>`,oo=e=>{try{return/^\d{4}-\d{2}-\d{2}$/.test(e)?Gl(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>
|
|
99
|
+
<div class="date-positioner" popover="manual"><section class="date-popover">
|
|
100
|
+
<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>
|
|
101
|
+
<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>
|
|
102
|
+
<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>
|
|
103
|
+
<div class="date-calendar"><div class="date-navigation"><button type="button" class="icon-button date-prev">${ro("left")}</button><button type="button" class="date-view"></button><button type="button" class="icon-button date-next">${ro("right")}</button></div><div class="date-grids"></div></div>
|
|
104
|
+
<footer class="date-footer"><span class="date-status" role="status"></span><button id="apply-dates" class="primary-button" type="button">Apply range ${ro("right")}</button></footer>
|
|
105
|
+
</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")],l=s("#apply-dates"),c=new el(jv,{id:"timeline-dates",selectionMode:"range",closeOnSelect:!1,fixedWeeks:!0,outsideDaySelectable:!0,locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,format:d=>d.toString(),parse:oo,placeholder:"YYYY-MM-DD",positioning:{placement:"top-end",strategy:"fixed",gutter:12,slide:!0},onOpenChange({open:d}){d&&n()}}),f=()=>Pv(c.service,Jc),u=["day","month","year"].map(d=>{const m=document.createElement("table");m.dataset.calendarView=d;const y=m.createTHead(),$=y.insertRow();if(d==="day")for(let D=0;D<7;D++)$.append(document.createElement("th"));const E=m.createTBody(),O=d==="day"?6:4,M=d==="day"?7:3;for(let D=0;D<O;D++){const w=E.insertRow();for(let S=0;S<M;S++){const x=document.createElement("button");x.type="button",w.insertCell().append(x)}}return s(".date-grids").append(m),{view:d,table:m,head:y,body:E}});function g(){const d=a.map($=>oo($.value)),m=!!(d[0]&&d[1]&&d[0].compare(d[1])<=0);l.disabled=!m;for(const[$,E]of a.entries())E.setAttribute("aria-invalid",String(!!E.value&&!d[$]));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=f();se(e,d.getRootProps()),se(s(".date-control"),d.getControlProps()),se(r,{...d.getTriggerProps(),"aria-label":"Custom date range"}),se(o,d.getPositionerProps()),se(i,{...d.getContentProps(),"aria-label":"Custom date range"}),a.forEach(($,E)=>se($,{...d.getInputProps({index:E}),"aria-label":E?"To date":"From date"})),se(s(".date-prev"),d.getPrevTriggerProps({view:d.view})),se(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");se(y,d.getViewTriggerProps({view:d.view})),y.textContent!==m&&(y.textContent=m);for(const{view:$,table:E,head:O,body:M}of u){E.hidden=d.view!==$,se(E,d.getTableProps({view:$,columns:$==="day"?7:3})),se(O,d.getTableHeaderProps({view:$})),se(M,d.getTableBodyProps({view:$})),$==="day"&&d.weekDays.forEach((w,S)=>{const x=O.rows[0].cells[S];x.scope="col",x.setAttribute("aria-label",w.long),x.textContent!==w.short&&(x.textContent=w.short)});const D=$==="day"?d.weeks:$==="month"?d.getMonthsGrid({columns:3,format:"short"}):d.getYearsGrid({columns:3});Array.from(M.rows).forEach((w,S)=>{se(w,d.getTableRowProps({view:$})),Array.from(w.cells).forEach((x,k)=>{const b=D[S]?.[k],A=x.firstElementChild;if(x.hidden=!b,!!b)if($==="day"){const R=d.weeks[S][k];se(x,d.getDayTableCellProps({value:R})),se(A,d.getDayTableCellTriggerProps({value:R})),A.textContent!==String(R.day)&&(A.textContent=String(R.day))}else{const R=b;se(x,$==="month"?d.getMonthTableCellProps({...R,columns:3}):d.getYearTableCellProps({...R,columns:3})),se(A,$==="month"?d.getMonthTableCellTriggerProps({...R}):d.getYearTableCellTriggerProps({...R})),A.textContent!==R.label&&(A.textContent=R.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),g()}s(".date-close").addEventListener("click",()=>f().setOpen(!1));for(const d of e.querySelectorAll("[data-preset]"))d.addEventListener("click",()=>{const m=f(),y=m.getRangePresetValue(d.dataset.preset);m.setValue(y),m.setFocusedValue(y[0]),m.setView("day")});l.addEventListener("click",()=>{g(),l.disabled||(t(a[0].value,a[1].value),f().setOpen(!1))}),i.addEventListener("input",g),e.addEventListener("keydown",d=>d.stopPropagation());const p=c.subscribe(h);return c.start(),h(),{setRange(d,m){const y=[d,m].map(oo).filter($=>$!==void 0);f().setValue(y),y[0]&&f().setFocusedValue(y[0])},dispose(){p(),c.stop(),e.replaceChildren()}}}const qv={Search:Rd,GitFork:Sd,GitBranch:xd,Folder:Ed,ArrowUpRight:fd,ArrowRight:ud,X:_d,Box:hd,RotateCcw:Dd,RefreshCw:Md,Play:Ms,Pause:Od,ChevronDown:pd,FileCode2:wd,Terminal:Fd,Copy:vd,Crosshair:yd,CircleHelp:gd,SlidersHorizontal:Nd,LoaderCircle:Id,Network:Td,Clock:md,Sparkles:tc,Grip:$d,PanelRight:Ad,Settings2:Pd,Volume2:nc,VolumeX:Hd,Share2:Vd},Re=()=>{Bd({icons:qv,attrs:{"stroke-width":1.5}}),es()},N=(e,t="")=>`<i data-lucide="${e}" class="${t}" aria-hidden="true"></i>`,T=e=>document.querySelector(e),z=e=>e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]),Yl=e=>Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}).format(e),ge=e=>e.toLocaleString("en"),Gv=[new Intl.DateTimeFormat("en",{month:"short",day:"numeric"}),new Intl.DateTimeFormat("en",{month:"short",day:"numeric",year:"numeric"})],Yv=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}),Kv=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}),mn=(e,t=!1)=>Gv[Number(t)].format(e),vn=e=>Yv.format(e),Xa=e=>{const t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`};let j,te={nodes:[],edges:[],lanes:[],start:0,end:0},ce=[],wi=[],Kl=new Set,js=new Map,ss=new Map,zl=new Map,ee,Zl=!0,Yn,B=new URLSearchParams(location.search).get("session"),Ue,Ie,Ws=0,vt="",Ct="",qe="",dt=0,ut="",ft="",yn=!0,Yt=!1,ln=60,Us=0,Fo,Ho,Ei=0,At=!1,oe=1,ir=0,Jn=0,et=tl([]),_o="",Jl=sl([]),qs,io,ao,Fn=0,Hn=!1,q={...Sr},Kt=!0,kr,ht,rs=!1,Bo="";try{q=rl(localStorage)}catch{Kt=!1}const ar=matchMedia("(prefers-reduced-motion: reduce)");T("#app").innerHTML=`
|
|
106
|
+
<main class="map" aria-label="Session map">
|
|
107
|
+
<h1 class="sr-only">SessionGraph — Explore & visualize all your LLM sessions</h1>
|
|
108
|
+
<div id="scene"></div>
|
|
109
|
+
<div class="canvas-vignette"></div>
|
|
110
|
+
<div id="graph-message" class="graph-message"><div class="loading-orbit"><span></span><span></span><span></span></div><h3>Loading sessions…</h3></div>
|
|
111
|
+
<div id="tooltip" class="node-tooltip" hidden></div>
|
|
112
|
+
</main>
|
|
113
|
+
<header class="app-header glass">
|
|
114
|
+
<a class="brand" href="/" aria-label="SessionGraph home" title="Explore & visualize all your LLM sessions"><img src="/brand/mark.svg" alt=""/><span>SessionGraph</span></a>
|
|
115
|
+
<span class="connection" role="status" title="Connecting"><span class="status-dot"></span><span id="connection-label" class="sr-only">Connecting</span></span>
|
|
116
|
+
<span class="toolbar-divider"></span>
|
|
117
|
+
<button class="toolbar-button" id="toggle-explorer" aria-label="Toggle sessions" aria-controls="explorer" aria-expanded="true" title="Sessions">${N("search")}<span>Sessions</span></button>
|
|
118
|
+
</header>
|
|
119
|
+
<nav class="map-controls glass" aria-label="Map controls">
|
|
120
|
+
<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>
|
|
121
|
+
<span class="toolbar-divider"></span>
|
|
122
|
+
<button class="icon-button" id="reset-camera" aria-label="Fit view" title="Fit view (F)">${N("crosshair")}</button>
|
|
123
|
+
<button class="icon-button" id="toggle-timeline" aria-label="Toggle timeline" aria-controls="timeline" aria-expanded="true" title="Timeline">${N("clock")}</button>
|
|
124
|
+
<button class="icon-button" id="toggle-inspector" aria-label="Toggle session details" aria-controls="inspector" aria-expanded="false" title="Session details" hidden>${N("panel-right")}</button>
|
|
125
|
+
<button class="icon-button" id="help" aria-label="Help" title="Help">${N("circle-help")}</button>
|
|
126
|
+
<button class="icon-button" id="mute-audio" aria-label="Mute sound" title="Mute sound" aria-pressed="false" data-sound="none">${N("volume-2")}</button>
|
|
127
|
+
<button class="icon-button" id="open-settings" aria-label="Settings" title="Settings" aria-haspopup="dialog">${N("settings-2")}</button>
|
|
128
|
+
<button class="icon-button" id="open-publishing" aria-label="Share SessionGraph" title="Share SessionGraph" aria-haspopup="dialog">${N("share-2")}</button>
|
|
129
|
+
</nav>
|
|
130
|
+
<aside class="sidebar floating-panel glass" id="explorer" aria-label="Sessions">
|
|
131
|
+
<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">${N("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">${N("refresh-cw")}</button><button class="icon-button" id="close-explorer" aria-label="Close sessions">${N("x")}</button></div>
|
|
132
|
+
<button class="search-box search-trigger" id="search" aria-label="Search all sessions">${N("search")}<span>Search everything…</span><kbd>/</kbd></button>
|
|
133
|
+
<div class="filters">
|
|
134
|
+
<div class="filter-row"><div class="select-wrap"><span id="source-filter-icon">${Ye()}</span><select id="source" aria-label="Session source"><option value="">All sources</option></select>${N("chevron-down")}</div><button class="icon-button" id="manage-sources" aria-label="Manage sources" title="Import sources">${N("sliders-horizontal")}</button></div>
|
|
135
|
+
<div class="select-wrap">${N("folder")}<select id="project" aria-label="Project"><option value="">All projects</option></select>${N("chevron-down")}</div>
|
|
136
|
+
<div class="select-wrap">${N("git-branch")}<select id="directory" aria-label="Worktree or directory"><option value="">All directories</option></select>${N("chevron-down")}</div>
|
|
137
|
+
<div class="filter-toggles"><label><input type="checkbox" id="children" checked/><span>Child sessions</span></label></div>
|
|
138
|
+
</div>
|
|
139
|
+
<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>
|
|
140
|
+
</aside>
|
|
141
|
+
<div class="inspector-stack floating-panel" id="inspector" hidden><aside class="inspector glass" id="session-inspector" aria-label="Session details"></aside></div>
|
|
142
|
+
<div class="timeline-dock floating-panel" id="timeline">
|
|
143
|
+
<div class="playback-share"><button id="share-playback" class="primary-button" disabled>${N("share-2")}Share SessionGraph</button></div>
|
|
144
|
+
<section class="timeline-panel glass timeline-controls" aria-label="Timeline controls">
|
|
145
|
+
${qg(`<button class="panel-handle" data-drag-panel="timeline" aria-label="Move timeline panel" title="Drag to move · Arrow keys to reposition">${N("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">${N("x")}</button>`,{play:"play",histogram:"histogram",scrubber:"scrubber",cursor:"timeline-cursor",date:"playback-date",period:"playback-period",summary:"playback-summary",sessions:"playback-sessions",tokens:"playback-tokens",coverage:"playback-token-coverage"})}
|
|
146
|
+
</section>
|
|
147
|
+
</div>
|
|
148
|
+
<dialog id="help-dialog" aria-labelledby="help-title"><button class="icon-button dialog-close" id="close-help" aria-label="Close help">${N("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>
|
|
149
|
+
<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>
|
|
150
|
+
<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">${N("sparkles")}Animate map</button></dialog>
|
|
151
|
+
<div id="toast" class="toast" role="status" hidden></div>
|
|
152
|
+
<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>
|
|
153
|
+
`;Re();Ud();cm();Ag();const Xl=Uv(T(".custom-dates"),(e,t)=>{ut=e,ft=t,Fe(!0)},ve),Mt=()=>{const e=!!document.querySelector("dialog[open]");e&&At&&ve(),ee?.setSuspended(e)},xi=new em,Ge=Jg(T("#tooltip"),T("#scene"),xi);let jo;const xn=Zg(T("#inspector"),xi,{select:e=>{const t=e?.sessionID===B?e:null;Ge.clear(),ee?.selectEvent(t?.id||null),t&&!At&&(oe=1,Sn(),ee?.focusEvent(Ie?.items.find(n=>n.id===t.id)||t))}});function Si(e){const t=j?.sessions.find(n=>n.id===B);t&&(Ge.clear(),ve(),le("inspector",!0),xn.open(t,e,e?Ie?.revision:void 0,Ie?.items.find(n=>n.id===e)?.kind==="commit"?"tools":"messages"))}const cs=Yg({publishing:Mr,change:Ar,getArchived:()=>Yt,changeArchived:e=>{Yt=e,Fe()},visibility:Mt,previewSound:()=>{cr.play("select")},getSources:()=>Ze.sources(),importSources:e=>Ze.select(e),resetPanels:()=>{document.querySelectorAll(".floating-panel").forEach(e=>{e.removeAttribute("style"),delete e.dataset.positioned})}}),cr=new Kg(q,cs.audioStatus);function ls(){ee?.applyPreferences(q),cr.configure(q),document.documentElement.dataset.density=q.density,document.documentElement.dataset.motion=String(Mo(q,ar.matches)),document.documentElement.style.setProperty("--panel-opacity",`${q.panelOpacity}%`),T("#motion").setAttribute("aria-pressed",String(Mo(q,ar.matches)));for(const t of["2d","3d"]){const n=T(`#view-${t}`);n.classList.toggle("active",q.view===t),n.setAttribute("aria-pressed",String(q.view===t))}const e=T("#mute-audio");e.setAttribute("aria-pressed",String(q.muted)),e.setAttribute("aria-label",q.muted?"Unmute sound":"Mute sound"),e.title=q.muted?"Unmute sound":"Mute sound",e.innerHTML=N(q.muted?"volume-x":"volume-2"),cs.render(q,Kt||rs,ht?.state||"saved"),Re()}function Ar(e){const t=e.autoImport!==void 0&&e.autoImport!==q.autoImport;q=$r({...q,...e});try{Kt=ol(localStorage,q)}catch{Kt=!1}ls(),$i({preferences:{...q},...t?{autoImport:q.autoImport}:{}})}function $i(e){ht?.save(e)}function zv(){return{sourceID:Ct,projectID:vt,directory:qe,days:dt,fromDate:ut,toDate:ft,includeChildren:yn,includeArchived:Yt}}T("#open-settings").addEventListener("click",cs.open);T("#mute-audio").addEventListener("click",()=>Ar({muted:!q.muted}));const Zv=()=>ls();ar.addEventListener("change",Zv);const Jv=e=>{if(e.key===di)try{q={...rl(localStorage),autoImport:q.autoImport},ls()}catch{}};window.addEventListener("storage",Jv);ls();ht=new Vg(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=>{cs.render(q,Kt||rs,e),e==="error"&&yt("Changes applied, but could not save to the local library. Retrying when you return."),e==="saved"&&kr?.check()});const Ql=Lg(Mt),Ze=Mg(e=>ki(e),Mt,yt);kr=new Pg({eligible:()=>q.autoImport&&!ht?.pending&&document.visibilityState==="visible"&&!!(j&&!j.onboarding&&j.sources?.some(e=>e.selected)),busy:()=>Ze.busy||!!document.querySelector("dialog[open]"),refresh:()=>Ze.refresh(!0)});const Lr=new AbortController,ds=()=>{document.visibilityState==="visible"&&(ht?.state==="error"&&ht.flush(),kr?.check())};window.addEventListener("focus",ds,{signal:Lr.signal});document.addEventListener("visibilitychange",ds,{signal:Lr.signal});window.setInterval(ds,Dg);T("#manage-sources").addEventListener("click",()=>{Ze.open()});document.addEventListener("sessiongraph-import-status",e=>{const t=e.detail;kr?.activity(),cs.importStatus(t),j&&(j.importing=t.running),ce.length||Or(),T("#refresh").classList.toggle("spinning",t.running),T(".connection").title=t.running?`Importing ${Me(t.source)} · ${t.imported} sessions saved`:t.failed?"Import unavailable · open Manage sources for details":"Local library · SQLite"},{signal:Lr.signal});const Ii=zd($n,Mt,e=>{Ql.open(e)});T("#search").addEventListener("click",Ii.open);function le(e,t){At&&(e==="timeline"?!t:t)&&ve();const n=T(`#${e}`);n.hidden=!t,T(`#toggle-${e}`).setAttribute("aria-expanded",String(t)),t&&innerWidth<760&&e!=="timeline"&&le(e==="explorer"?"inspector":"explorer",!1)}le("explorer",innerWidth>=760);let co=[];for(const e of["explorer","timeline","inspector"])T(`#toggle-${e}`).addEventListener("click",()=>le(e,T(`#${e}`).hidden));T("#close-explorer").addEventListener("click",()=>{le("explorer",!1),T("#toggle-explorer").focus()});T("#close-timeline").addEventListener("click",()=>{ve(),le("timeline",!1),T("#toggle-timeline").focus()});function yt(e){T("#toast").textContent=e,T("#toast").hidden=!1,window.setTimeout(()=>{T("#toast").hidden=!0},3500)}function Ci(){jo?.(),le("inspector",!1),xn.close(),Ge.clear(),T("#session-inspector").replaceChildren(),T("#toggle-inspector").hidden=!0}Ci();async function Xv(){try{const{TimelineScene:e}=await dr(async()=>{const{TimelineScene:t}=await import("./scene-CTHyYtma.js");return{TimelineScene:t}},__vite__mapDeps([0,1]));ee=new e(T("#scene"),{onSelect:t=>{t?(cr.play("select"),$n(t)):Mi()},onPlaybackInterrupt:ve,onEvent:t=>{cr.play("select"),Si(t)},onEventHover:(t,n,s,r)=>{Yn=void 0,t&&B&&Ie?Ge.show(t,B,Ie.revision,n,s,r):Ge.clear()},onHover:(t,n,s)=>{const r=T("#tooltip");r.classList.contains("message-tooltip")&&(Ge.clear(),Yn=void 0),r.hidden!==!t&&(r.hidden=!t),t&&(Yn!==t.session&&(Yn=t.session,r.innerHTML=`<strong>${z(t.session.title)}</strong><span>${z(Me(t.session.source))} · ${t.session.activity?.lastMessageAt?`Last message ${vn(t.session.activity.lastMessageAt)}`:"Message time unavailable"}<br>Started ${vn(t.session.created)}</span>`),r.style.left=`${Math.min(n+18,T("#scene").clientWidth-280)}px`,r.style.top=`${Math.max(8,Math.min(s-32,T("#scene").clientHeight-110))}px`)}},{panels:[T("#explorer"),T("#inspector"),T("#timeline")]}),ee.applyPreferences(q),j&&(ee.setGraph(te,!0),B&&(ee.select(B),ee.focus(B)),Ue&&ee.setFiles(Ue.files),Ie&&ee.setEvents(Ie.items))}catch(e){console.error("[sessiongraph] Graphics initialization failed",e),yt("3D requires WebGL. You can still browse sessions in the list.")}finally{Zl=!1,j&&Or()}}Xv();T("#scene").addEventListener("scene-error",e=>yt(e.detail));async function Ti(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 ki(e=!1){const t=T("#refresh");t.disabled=!0,t.classList.add("spinning");try{const n=ht?.revision,s=await Ti("/api/sessiongraph"),r=j,o=B?js.get(B):void 0,i=!!(r&&te.nodes.length);if(j=s,!ht?.pending&&n===ht?.revision){q={...$r(s.preferences||q),autoImport:s.autoImport!==!1};try{Kt=ol(localStorage,q)}catch{Kt=!1}if(!rs){const l=Hg(s.viewState);({sourceID:Ct,projectID:vt,directory:qe,days:dt,fromDate:ut,toDate:ft,includeChildren:yn,includeArchived:Yt}=l),T("#children").checked=yn,Bo=JSON.stringify(l),s.preferences||$i({preferences:{...q}})}ls()}if(rs=!0,T("#connection-label").textContent="Local library",T(".connection").classList.add("connected"),T(".connection").title=`Connected · ${ge(j.sessions.length)} sessions`,r&&JSON.stringify(r.sessions)===JSON.stringify(s.sessions)&&JSON.stringify(r.projects)===JSON.stringify(s.projects)){Or();return}xi.clear(),js=new Map(j.sessions.map(l=>[l.id,l])),T("#source").innerHTML='<option value="">All sources</option>'+(j.sources||[]).map(l=>`<option value="${z(l.id)}">${z(l.name)} · ${l.sessions.toLocaleString()}</option>`).join(""),T("#source").value=Ct,T("#source-filter-icon").innerHTML=Ye(Ct),Ii.setData(j);const a=new Map;if(j.sessions.forEach(l=>a.set(l.projectID,(a.get(l.projectID)||0)+1)),T("#project").innerHTML='<option value="">All projects</option>'+[...j.projects].filter(l=>a.has(l.id)).sort((l,c)=>(a.get(c.id)||0)-(a.get(l.id)||0)).map(l=>`<option value="${z(l.id)}">${z(l.name)} · ${ge(a.get(l.id)||0)}</option>`).join(""),T("#project").value=vt,Ai(),B&&!r){const l=j.sessions.find(c=>c.id===B);l&&l.created<Date.now()-dt*864e5&&(dt=0),l?.archived&&(Yt=!0)}if(Fe(!i,i),B&&!r)$n(B);else if(B){const l=js.get(B);if(l&&JSON.stringify(o)!==JSON.stringify(l)){const c=T(".detail-scroll")?.scrollTop||0;Ue=void 0,Ie=void 0,sd(l,!1),T(".detail-scroll").scrollTop=c,lr(l.id),Di(l)}}else Ci();!e&&j.warnings.length&&yt(j.warnings.join(" ")),!e&&j.onboarding&&Ze.open(!0)}catch(n){if(e&&j){T(".connection").title="Library refresh unavailable · retry with Refresh sessions";return}T("#connection-label").textContent="Connection unavailable",T(".connection").title="Connection unavailable",T(".connection").classList.remove("connected"),T("#graph-message").hidden=!1,T("#graph-message").innerHTML=`${N("terminal")}<h3>Local library unavailable</h3><p>${z(n instanceof Error?n.message:"Unable to connect.")}</p><button class="primary-button" id="retry">Retry ${N("arrow-right")}</button>`,T("#retry").addEventListener("click",()=>{ki().then(ds)}),j||(T("#session-list").innerHTML='<p class="empty-list">Your sessions will appear here once connected.</p>',T("#list-count").textContent="Offline"),Re()}finally{t.disabled=!1,t.classList.remove("spinning")}}function Ai(){const e=j?.sessions.filter(s=>!vt||s.projectID===vt)||[],t=[...new Set(e.map(s=>s.directory))].sort((s,r)=>Kn(s).localeCompare(Kn(r))),n=new Set(j?.projects.flatMap(s=>s.worktrees));T("#directory").innerHTML='<option value="">All directories</option>'+t.map(s=>`<option value="${z(s)}">${n.has(s)?"⑂ ":""}${z(Kn(s))}</option>`).join(""),t.includes(qe)||(qe=""),T("#directory").value=qe}function Fe(e=!1,t=!1){if(!j)return;t||(ve(),oe=1,ln=60);const n=T("#session-list").scrollTop,s=document.activeElement?.closest("[data-session]")?.dataset.session,r=Date.now(),o=ut?new Date(`${ut}T00:00:00`).getTime():dt?r-dt*864e5:0,i=ft?new Date(`${ft}T23:59:59.999`).getTime():1/0;ce=j.sessions.filter(c=>Gg(c,Ct)&&(!vt||c.projectID===vt)&&(!qe||c.directory===qe)&&(yn||!c.parentID||!!c.forkID)&&(Yt||!c.archived)&&c.created>=o&&c.created<=i),wi=[...ce].sort((c,f)=>dn(f)-dn(c)),Kl=new Set(ce.map(c=>c.id)),Ii.setScope(ce.map(c=>c.id)),te=Wd(ce,j.projects,t?te:void 0),zl=new Map(te.nodes.map(c=>[c.session.id,c.color])),ee?.setCutoff(oe),ee?.setGraph(te,e,t),Or(),document.querySelectorAll("[data-days]").forEach(c=>c.classList.toggle("active",!ut&&!ft&&Number(c.dataset.days)===dt)),Oi(),t&&(T("#session-list").scrollTop=n,s&&ss.get(s)?.focus({preventScroll:!0})),Qv(),B&&!ce.some(c=>c.id===B)?Mi():B&&Ue&&ee?.setFiles(Ue.files),B&&Ie&&ee?.setEvents(Ie.items),Re();const a=zv(),l=JSON.stringify(a);rs&&l!==Bo&&(Bo=l,$i({viewState:a}))}function Or(){Li();const e=T("#graph-message");e.hidden=!!(ce.length&&ee),ce.length?ee||(e.innerHTML=Zl?"<h3>Preparing the map…</h3>":`${N("box")}<h3>WebGL is unavailable.</h3><p>You can explore every session and its file details in the list.</p>`):e.innerHTML=j?.importing?'<div class="loading-orbit"><span></span><span></span><span></span></div><h3>Importing your sessions…</h3><p>Your map will appear when the import finishes.</p>':j&&!j.sessions.length?`${N("folder")}<h3>Your map starts here</h3><p>Choose a source with saved conversations to get started.</p><button class="primary-button" id="empty-sources">Choose sources ${N("arrow-right")}</button>`:`${N("search")}<h3>No matching sessions</h3><button class="text-button" id="clear-filters">Reset filters ${N("rotate-ccw")}</button>`,T("#clear-filters")?.addEventListener("click",()=>ed()),T("#empty-sources")?.addEventListener("click",()=>{Ze.open()}),Re()}function Li(e=!1){const t=!!(ce.length&&ee);(e||!t)&&(window.clearTimeout(Fn),Fn=0,Hn=!1),T(".playback-share").classList.toggle("ready",Hn&&t),T("#share-playback").disabled=!Hn||!t,t&&!Hn&&!Fn&&(Fn=window.setTimeout(()=>{Fn=0,Hn=!0,Li()},1e3))}function ed(e){Ct="",T("#source").value="",T("#source-filter-icon").innerHTML=Ye(),vt="",qe="",dt=0,ut="",ft="",yn=!0,Yt=e?.archived===!0,T("#project").value="",T("#children").checked=!0,Xl.setRange("",""),Ai(),Fe(!0)}function Oi(){T("#list-count").textContent=ge(ce.length);const e=wi;let t="";T("#session-list").innerHTML=e.slice(0,ln).map(n=>{const s=dn(n),r=mn(s),o=r!==t?`<div class="list-date">${r}<span>${new Date(s).getFullYear()}</span></div>`:"";return t=r,`${o}<button class="session-card ${B===n.id?"selected":""}" data-session="${z(n.id)}" aria-pressed="${B===n.id}" title="${z(n.title)}"><span class="session-dot" style="--node-color:${zl.get(n.id)}"></span><span class="session-card-body"><span class="session-title">${z(n.title)}</span><span class="session-meta">${n.forkID?N("git-fork"):n.parentID?N("network"):""}<span class="source-badge" data-source="${z(n.source||"opencode")}">${Ye(n.source)}${z(Me(n.source))}</span><span title="${n.activity?.lastMessageAt?"Latest saved message":"Session created; message time unavailable"}">${Kv.format(s)}</span></span></span></button>`}).join("")+(e.length>ln?`<button id="more-sessions" class="load-more">Show more sessions ${N("chevron-down")}</button>`:e.length?"":'<p class="empty-list">No sessions match your filters.</p>'),T("#more-sessions")?.addEventListener("click",()=>{ln+=100;const n=T("#session-list").scrollTop;Oi(),T("#session-list").scrollTop=n,Re()}),ss=new Map([...T("#session-list").querySelectorAll(".session-card")].map(n=>[n.dataset.session,n])),Re()}function td(e){for(const t of[e,B]){const n=t?ss.get(t):void 0;n&&(n.classList.toggle("selected",t===B),n.setAttribute("aria-pressed",String(t===B)))}}function Qv(){et=tl(ce),Jl=sl(ce),_o="";const e=Ug(ce.map(dn),te.start,te.end),t=Math.max(...e,1);T("#histogram").innerHTML=e.map(n=>`<span style="height:${Math.max(4,n/t*100)}%;opacity:${n?.8:.15}" title="${n} session endpoints"></span>`).join(""),T("#date-label").textContent=te.start?`${mn(te.start,new Date(te.start).getFullYear()!==new Date(te.end).getFullYear())} — ${mn(te.end,!0)}`:"No sessions",te.start&&Xl.setRange(ut||Xa(te.start),ft||Xa(te.end)),Sn()}function Sn(){T("#scrubber").value=String(Math.round(oe*1e3)),T("#timeline-cursor").style.left=`${oe*100}%`,T("#histogram").style.setProperty("--progress",`${oe*100}%`);const e=te.start+(te.end-te.start)*oe;T("#playback-date").textContent=te.start?mn(e,new Date(te.start).getFullYear()!==new Date(te.end).getFullYear()):"—";const t=te.nodes.length?Wg(e,te.end-te.start):"—";T("#playback-period").textContent!==t&&(T("#playback-period").textContent=t);const n=et.at(e,oe>=1),s=Jl(e,oe>=1),r=`${n.tokens}:${n.sessions}:${s}`;r!==_o&&(_o=r,T("#playback-summary").hidden=ce.length===0,T("#playback-sessions").textContent=ge(s),T("#playback-tokens").textContent=et.recorded?Yl(n.tokens):"—",T("#playback-token-coverage").textContent=et.recorded?`${ge(n.sessions)} / ${ge(et.recorded)} with recorded usage`:"Usage unavailable",T("#playback-summary").title=`${ge(s)} sessions started. ${et.recorded?`${ge(n.tokens)} burnt tokens`:"Token usage unavailable"}. Token totals are added at the latest saved message, including cache where reported. ${ge(et.missing)} sessions have no supported recorded count.${et.untimed?` ${ge(et.untimed)} totals have no message timestamp and are included only at the end.`:""}`),ee?.setCutoff(oe)}function ve(){if(At=!1,Jn=0,T("#app").classList.remove("playback-mode"),qs){const e=qs;qs=void 0,le("explorer",e.explorer),le("inspector",e.inspector&&!!B)}ee?.setPlaying(!1),cancelAnimationFrame(Ei),T("#play").innerHTML=N("play"),T("#play").setAttribute("aria-label","Play timeline"),Re()}function nd(e){if(!At)return;const t=Math.max(0,e-ir);ir=e,document.hidden||(oe<1?oe=Math.min(1,oe+t*q.playbackSpeed/ci):Jn+=t),Sn(),ee?.setPlaybackOutro(oe>=1?Math.min(1,Jn/sr):null),oe>=1&&Jn>=sr+nl?ve():Ei=requestAnimationFrame(nd)}function Mi(){const e=B;Fo?.abort(),Ho?.abort(),T("#file-legend").hidden=!0,Us++,Ws++,B=null,Ue=void 0,Ie=void 0,ee?.select(null),history.replaceState(null,"",location.pathname),Ci(),td(e)}function ey(e){const t=e.forkID?[{id:e.forkID,label:"Forked from",kind:"git-fork"}]:e.parentID?[{id:e.parentID,label:"Parent",kind:"network"}]:[],n=j.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=j.sessions.find(i=>i.id===r.id);return`<button class="relation" data-related="${z(r.id)}" ${o?"":"disabled"}>${N(r.kind)}<span><small>${r.label}</small><strong>${z(o?.title||"Session no longer available")}</strong></span>${N("arrow-up-right")}</button>`}).join("")}</section>`:""}function sd(e,t=!0){const n=j.projects.find(o=>o.id===e.projectID),s=e.forkID?"Fork":e.parentID?"Child session":"Session",r=n?.worktrees.includes(e.directory);T("#session-inspector").innerHTML=`
|
|
154
|
+
<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">${N("grip")}<span>${s}</span></button><button id="close-inspector" class="icon-button" aria-label="Close session details">${N("x")}</button></div>
|
|
155
|
+
<div class="detail-scroll">
|
|
156
|
+
<div class="detail-title"><span class="source-badge" data-source="${z(e.source||"opencode")}">${Ye(e.source)}${z(Me(e.source))}</span><h2>${z(e.title)}</h2><span class="detail-date">${vn(e.created)}</span></div>
|
|
157
|
+
<div class="detail-actions"><button id="open-session" class="secondary-button">${N("arrow-up-right")}Open session</button><button id="focus-session" class="icon-button" title="Focus node" aria-label="Focus node">${N("crosshair")}</button><button id="copy-id" class="icon-button" title="Copy session ID" aria-label="Copy session ID">${N("copy")}</button></div>
|
|
158
|
+
<section id="message-detail" class="detail-section"></section>
|
|
159
|
+
<section id="commit-detail" class="detail-section"></section>
|
|
160
|
+
${e.linkedSessionIDs?.length?`<section class="detail-section"><div class="section-label">Linked provider history</div><p class="coverage-note">One conversation on the map. Each source keeps its own saved history${e.coverage?.history==="partial"?"; the T3 copy is partial":""}.</p>${e.linkedSessionIDs.map(o=>`<button class="relation" data-history="${z(o)}">${Ye(o.split(":")[0])}<span><small>Saved provider copy</small><strong>${z(Me(o.split(":")[0]))}</strong></span>${N("arrow-up-right")}</button>`).join("")}</section>`:""}
|
|
161
|
+
<div id="file-detail"><section class="detail-section"><div class="section-label">Changed files</div><div class="detail-loading">${N("loader-circle","spinning")}Loading changes…</div></section></div>
|
|
162
|
+
${ey(e)}
|
|
163
|
+
<details class="more-details detail-section"><summary>Session info ${N("chevron-down")}</summary><dl class="metadata"><div><dt>Project</dt><dd>${z(n?.name||"Unknown")}</dd></div><div><dt>Model</dt><dd>${z(e.model)}</dd></div><div><dt>Agent</dt><dd>${z(e.agent||"Unknown")}</dd></div><div><dt>Tokens incl. cache</dt><dd>${e.tokens===null?"Not recorded":Yl(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>${mn(e.updated)}</dd></div><div><dt>Imported</dt><dd>${e.coverage?.importedAt?mn(e.coverage.importedAt):"Pending"}</dd></div></dl><div class="directory-card"><span>${r?"Worktree":"Directory"}</span><code>${z(e.directory)}</code></div></details>
|
|
164
|
+
</div>
|
|
165
|
+
`,T("#toggle-inspector").hidden=!1,t&&le("inspector",!0),T("#close-inspector").addEventListener("click",()=>{le("inspector",!1),T("#toggle-inspector").focus()}),T("#focus-session").addEventListener("click",()=>{ve(),ee?.focus(e.id)}),T("#open-session").addEventListener("click",()=>{Ql.open(e)}),T("#copy-id").addEventListener("click",async()=>{try{await navigator.clipboard.writeText(e.nativeID||e.id),yt("Session ID copied")}catch{yt(e.nativeID||e.id)}}),rd(e),jo?.(),jo=Qg(T("#commit-detail"),e.id,(o,i)=>{Ge.clear(),ve(),xn.open(e,o,i,"tools")}),Re()}function rd(e,t){const n=t?[`${ge(t.total)} messages · ${ge(t.items.filter(s=>s.kind==="commit").length)} commit markers`,t.limited?"Map limit reached":"",t.partial?"Partial history":""].filter(Boolean):["Loading messages…"];T("#message-detail").innerHTML=`<div class="section-label">Session timeline</div><dl class="metadata">
|
|
166
|
+
<div><dt>Trail starts</dt><dd>${vn(e.created)}</dd></div>
|
|
167
|
+
<div><dt>Node · last message</dt><dd>${e.activity?.lastMessageAt?vn(e.activity.lastMessageAt):"Unknown · at session start"}</dd></div>
|
|
168
|
+
</dl><div class="event-key"><span style="--event-color:#ffffff"><i></i>User & assistant messages</span></div><p class="coverage-note">${n.map(z).join(" · ")}</p><button class="secondary-button explore-events">Explore messages ${N("arrow-right")}</button>`,T(".explore-events").addEventListener("click",()=>Si()),Re()}async function Di(e,t=!1){const n=++Ws;Ho?.abort();const s=new AbortController;Ho=s;try{const r=await Ti(`/api/sessiongraph/session/${encodeURIComponent(e.id)}/event-markers`,s.signal);if(s.signal.aborted||n!==Ws||B!==e.id)return;Ie=r,ee?.setEvents(r.items,t),rd(e,r)}catch{if(s.signal.aborted||n!==Ws||B!==e.id)return;T("#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>',T(".explore-events").addEventListener("click",()=>Si()),T("#retry-timeline").addEventListener("click",()=>{Di(e)})}}function ty(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 Qa(e){const t=e.files;T("#file-legend").hidden=!t.length,T("#file-detail").innerHTML=`
|
|
169
|
+
<section class="detail-section"><div class="section-label">Changed files<span>${ge(t.length)}${e.partial?"+":""}</span></div>
|
|
170
|
+
${t.length?`<ul class="file-list">${t.map(n=>`<li title="${z(n.path)} · ${n.source}">${N("file-code-2")}<div><strong>${z(Kn(n.path))}</strong>${n.path.includes("/")?`<span>${z(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>'}
|
|
171
|
+
<p class="coverage-note">${ge(e.messagesScanned)} messages${e.partial?" · Partial history":""}${e.snapshotSteps?"":" · Snapshots unavailable"}${t.length>80?" · 80 files on map":""}</p>
|
|
172
|
+
${e.nextCursor?'<p class="coverage-note" id="history-loading" role="status">Loading full history…</p>':""}</section>
|
|
173
|
+
${e.locations.length?`<details class="more-details detail-section"><summary>Directory moves ${N("chevron-down")}</summary>${e.locations.map(n=>`<div class="location-entry"><span>${vn(n.time)}</span><code>${z(n.directory)}</code></div>`).join("")}</details>`:""}
|
|
174
|
+
${e.tools.length?`<details class="more-details detail-section"><summary>Tools used <span>${ge(e.tools.reduce((n,s)=>n+s.count,0))}</span>${N("chevron-down")}</summary><div class="tools-list">${e.tools.slice(0,12).map(n=>`<div><span>${z(n.name)}</span><strong>${n.count}</strong></div>`).join("")}</div></details>`:""}
|
|
175
|
+
`,ee?.setFiles(t),Re()}async function lr(e){const t=++Us;Fo?.abort();const n=new AbortController;Fo=n;let s,r;const o=new Set;try{do{const i=await Ti(`/api/sessiongraph/session/${encodeURIComponent(e)}${s?`?cursor=${encodeURIComponent(s)}`:""}`,n.signal);if(n.signal.aborted||t!==Us||B!==e)return;if(r&&i.revision!==r.revision)throw new Error("History changed. Retry to load the latest version.");if(r=r?ty(r,i):i,Ue=r,!s||!i.nextCursor?Qa(r):T("#history-loading")&&(T("#history-loading").textContent=`Loading full history… ${ge(r.messagesScanned)} messages`),s=i.nextCursor||void 0,s&&o.has(s))throw new Error("History could not be loaded. Please retry.");s&&o.add(s)}while(s)}catch(i){if(n.signal.aborted||t!==Us||B!==e)return;if(Ue){Qa(Ue);const a=T("#history-loading");a&&(a.innerHTML='History loading interrupted. <button class="text-button" id="retry-detail">Retry</button>'),T("#retry-detail")?.addEventListener("click",()=>{lr(e)})}else T("#file-detail").innerHTML=`<section class="detail-section"><div class="section-label">Changed files</div><p class="coverage-note">${z(i instanceof Error?i.message:"Details unavailable.")}</p><button class="load-more" id="retry-detail">Retry file details</button></section>`,T("#retry-detail").addEventListener("click",()=>lr(e))}}function $n(e){const t=js.get(e);if(!t)return;const n=B;xn.close(),Ge.clear(),Kl.has(e)||ed(t),ve(),oe=1,Sn(),B=e,Ue=void 0,Ie=void 0,T("#file-legend").hidden=!0,history.replaceState(null,"",`?session=${encodeURIComponent(e)}`),ee?.select(e),sd(t),ee?.focus(e),td(n),lr(e),Di(t,!0)}T("#session-list").addEventListener("click",e=>{const t=e.target.closest("[data-session]");t?.dataset.session&&$n(t.dataset.session)});T("#inspector").addEventListener("click",e=>{const t=e.target.closest("[data-history]")?.dataset.history;if(t){Ge.clear(),ve(),le("inspector",!0),xn.open({id:t,source:t.split(":")[0]});return}const n=e.target.closest("[data-related]");n?.dataset.related&&$n(n.dataset.related)});T("#project").addEventListener("change",e=>{vt=e.target.value,qe="",Ai(),Fe(!0)});T("#source").addEventListener("change",e=>{Ct=e.target.value,T("#source-filter-icon").innerHTML=Ye(Ct),Fe(!0)});T("#directory").addEventListener("change",e=>{qe=e.target.value,Fe(!0)});T("#children").addEventListener("change",e=>{yn=e.target.checked,Fe()});document.querySelectorAll("[data-days]").forEach(e=>e.addEventListener("click",()=>{dt=Number(e.dataset.days),ut="",ft="",Fe(!0)}));T("#reset-camera").addEventListener("click",()=>Fe(!0));T("#refresh").addEventListener("click",()=>{j?.onboarding?Ze.open(!0):Ze.refresh()});T("#scrubber").addEventListener("input",e=>{ve(),oe=Number(e.target.value)/1e3,Sn()});T("#play").addEventListener("click",()=>{if(ce.length){if(At)return ve();oe>=1&&(oe=0),Sn(),qs={explorer:!T("#explorer").hidden,inspector:!T("#inspector").hidden},le("explorer",!1),le("inspector",!1),le("timeline",!0),Ge.clear(),Yn=void 0,T("#app").classList.add("playback-mode"),Li(!0),At=!0,Jn=0,ee?.setPlaying(!0),ir=performance.now(),T("#play").innerHTML=N("pause"),T("#play").setAttribute("aria-label","Pause timeline"),Re(),Ei=requestAnimationFrame(nd)}});document.addEventListener("visibilitychange",()=>{ir=performance.now()},{signal:Lr.signal});async function ny(){const e=T("#share-playback");e.disabled=!0;try{if(!io){const{createPlaybackShare:t}=await dr(async()=>{const{createPlaybackShare:n}=await import("./share-Cw1E-ED9.js");return{createPlaybackShare:n}},__vite__mapDeps([2,0,1,3]));io=t(Mt,()=>{Mr()})}te.nodes.length&&io.open(te,q)}catch{yt("Could not open video sharing. Please try again.")}finally{e.disabled=!ce.length||!ee}}async function Mr(){try{if(!ao){const{createPublishing:e}=await dr(async()=>{const{createPublishing:t}=await import("./publishing-D9CqkbeB.js");return{createPublishing:t}},__vite__mapDeps([4,3,0,1,5]));ao=e(Mt,()=>{ny()})}await ao.open(ce.map(e=>e.id))}catch{yt("Could not open publishing. Please try again.")}}T("#share-playback").addEventListener("click",Mr);T("#open-publishing").addEventListener("click",Mr);for(const e of[!1,!0])T(`#view-${e?"2d":"3d"}`).addEventListener("click",()=>Ar({view:e?"2d":"3d"}));T("#motion").addEventListener("click",()=>Ar({motion:Mo(q,ar.matches)?"off":"on"}));T("#help").addEventListener("click",()=>{T("#help-dialog").showModal(),Mt()});T("#help-dialog").addEventListener("close",Mt);T("#close-help").addEventListener("click",()=>T("#help-dialog").close());document.addEventListener("keydown",e=>{if(!e.defaultPrevented&&!document.querySelector("dialog[open]")){if(At&&e.key==="Escape"){e.preventDefault(),ve();return}if(!xn.handleKey(e)){if(e.key==="Escape"){B?Mi():le("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=wi,s=n.findIndex(i=>i.id===B),r=e.key==="ArrowLeft"||e.key==="ArrowUp"?-1:1,o=n[Math.max(0,Math.min(n.length-1,s+r))];o&&(e.preventDefault(),$n(o.id),t.closest(".session-card")&&(ss.has(o.id)||(ln=Math.min(n.length,ln+100),Oi()),ss.get(o.id)?.focus({preventScroll:!0})));return}}if(e.key.toLowerCase()==="f"&&Fe(!0),e.key.toLowerCase()==="h"){ve();const t=["explorer","timeline","inspector"].filter(n=>!T(`#${n}`).hidden);t.length?(co=t,t.forEach(n=>le(n,!1))):(co.length?co:["explorer","timeline"]).forEach(n=>{(n!=="inspector"||B)&&le(n,!0)})}}}}});ki().then(()=>{j?.importing?Ze.resume():ds()});export{Od as A,hd as B,md as C,Sr as D,cl as E,Ed as F,Sd as G,Cn as H,sy as I,jd as J,ry as K,uy as L,oy as M,Td as N,fy as O,Ms as P,lo as Q,Dd as R,Vd as S,Fd as T,py as U,hy as V,_d as X,dr as _,sl as a,cy as b,Wo as c,ly as d,li as e,dy as f,Wg as g,K as h,nm as i,iy as j,qg as k,Tn as l,Wd as m,Me as n,Mo as o,tl as p,Ag as q,ay as r,dn as s,Ug as t,ci as u,_g as v,sr as w,nl as x,tc as y,yd as z};
|