sessiongraph 0.1.9 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PRIVACY.md +1 -1
- package/README.md +19 -5
- package/dist/assets/{index-BVJmULd-.js → index-Bn0u7W0k.js} +1 -1
- package/dist/assets/index-C9rv5Uuu.js +163 -0
- package/dist/assets/{index-7IkZaZQy.css → index-To7WPdy6.css} +1 -1
- package/dist/assets/scene-DHluV79M.js +49 -0
- package/dist/index.html +2 -2
- package/dist/sources/LICENSE-APACHE-2.0.txt +201 -0
- package/dist/sources/LICENSE-MIT.txt +22 -0
- package/dist/sources/NOTICE.txt +17 -0
- package/dist/sources/cline.svg +1 -0
- package/dist/sources/continue.svg +2 -0
- package/dist/sources/copilot.svg +1 -0
- package/dist/sources/gemini.svg +1 -0
- package/dist/sources/kilo.svg +1 -0
- package/dist/sources/pi.svg +1 -0
- package/dist/sources/qwen.svg +1 -0
- package/dist/sources/roo.svg +1 -0
- package/dist-server/server.mjs +719 -150
- package/docs/guide.md +40 -19
- package/docs/v1.0.0.md +31 -0
- package/docs/v1.0.1.md +25 -0
- package/package.json +7 -7
- package/dist/assets/index-0ZTrNFWY.js +0 -165
- package/dist/assets/scene-BmLcylTN.js +0 -49
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/scene-BmLcylTN.js","assets/three-B4kj4iLH.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&s(i)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();const Rc="modulepreload",Pc=function(e){return"/"+e},pi={},La=function(t,n,s){let r=Promise.resolve();if(n&&n.length>0){let c=function(l){return Promise.all(l.map(p=>Promise.resolve(p).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),a=i?.nonce||i?.getAttribute("nonce");r=c(n.map(l=>{if(l=Pc(l),l in pi)return;pi[l]=!0;const p=l.endsWith(".css"),f=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${f}`))return;const g=document.createElement("link");if(g.rel=p?"stylesheet":Rc,p||(g.as="script"),g.crossOrigin="",g.href=l,a&&g.setAttribute("nonce",a),document.head.appendChild(g),p)return new Promise((u,h)=>{g.addEventListener("load",u),g.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(i){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i}return r.then(i=>{for(const a of i||[])a.status==="rejected"&&o(a.reason);return t().catch(o)})};const Ma=(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=Ma(...r);s.appendChild(o)}),s};var Da=([e,t,n])=>Ma(e,t,n);const Vc=e=>Array.from(e.attributes).reduce((t,n)=>(t[n.name]=n.value,t),{}),Nc=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:"",Fc=e=>e.flatMap(Nc).map(n=>n.trim()).filter(Boolean).filter((n,s,r)=>r.indexOf(n)===s).join(" "),Hc=e=>e.replace(/(\w)(\w*)(_|-|\s*)/g,(t,n,s)=>n.toUpperCase()+s.toLowerCase()),gi=(e,{nameAttr:t,icons:n,attrs:s})=>{const r=e.getAttribute(t);if(r==null)return;const o=Hc(r),i=n[o];if(!i)return console.warn(`${e.outerHTML} icon name was not found in the provided icons object.`);const a=Vc(e),[c,l,p]=i,f={...l,"data-lucide":r,...s,...a},g=Fc(["lucide",`lucide-${r}`,a,s]);g&&Object.assign(f,{class:g});const u=Da([c,f,p]);return e.parentNode?.replaceChild(u,e)};const Y={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 _c=["svg",Y,[["path",{d:"M5 12h14"}],["path",{d:"m12 5 7 7-7 7"}]]];const Bc=["svg",Y,[["path",{d:"M7 7h10v10"}],["path",{d:"M7 17 17 7"}]]];const Wc=["svg",Y,[["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 jc=["svg",Y,[["path",{d:"m6 9 6 6 6-6"}]]];const Uc=["svg",Y,[["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 qc=["svg",Y,[["circle",{cx:"12",cy:"12",r:"10"}],["polyline",{points:"12 6 12 12 16 14"}]]];const Gc=["svg",Y,[["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 Yc=["svg",Y,[["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 Kc=["svg",Y,[["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 zc=["svg",Y,[["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 Zc=["svg",Y,[["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 Jc=["svg",Y,[["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 Xc=["svg",Y,[["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 Qc=["svg",Y,[["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 ed=["svg",Y,[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56"}]]];const td=["svg",Y,[["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 nd=["svg",Y,[["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 sd=["svg",Y,[["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 rd=["svg",Y,[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M15 3v18"}]]];const od=["svg",Y,[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}],["path",{d:"M3 9h18"}],["path",{d:"M9 21V9"}]]];const id=["svg",Y,[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1"}]]];const ad=["svg",Y,[["polygon",{points:"6 3 20 12 6 21 6 3"}]]];const ld=["svg",Y,[["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 cd=["svg",Y,[["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 dd=["svg",Y,[["circle",{cx:"11",cy:"11",r:"8"}],["path",{d:"m21 21-4.3-4.3"}]]];const ud=["svg",Y,[["path",{d:"M20 7h-9"}],["path",{d:"M14 17H5"}],["circle",{cx:"17",cy:"17",r:"3"}],["circle",{cx:"7",cy:"7",r:"3"}]]];const fd=["svg",Y,[["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 Ra=["svg",Y,[["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 hd=["svg",Y,[["polyline",{points:"4 17 10 11 4 5"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19"}]]];const Pa=["svg",Y,[["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 pd=["svg",Y,[["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 gd=["svg",Y,[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]]];const md=({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=>gi(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=>gi(o,{nameAttr:"icon-name",icons:e,attrs:n})))}},mi=["#b0e9d6","#8eaff4","#d7a1f1","#eac594","#8cdbdf","#e7a3b8","#a8ca91"];function $n(e){let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return t=Math.imul(t^t>>>16,2246822507),t=Math.imul(t^t>>>13,3266489909),t^=t>>>16,(t>>>0)/4294967295}function jn(e){return e.replace(/\/$/,"").split("/").at(-1)||"/"}const sn=e=>Math.max(e.created,e.activity?.lastMessageAt||e.created),vi=(e,t)=>(e-t.start)/Math.max(1,t.end-t.start)*300-150,Va=(e,t)=>[t,e.position[1],e.position[2]],xv=(e,t)=>[Va(e,Math.max(e.startPosition[0],Math.min(t.startPosition[0],e.position[0]))),t.startPosition];function vd(e,t){if(!e.length)return{nodes:[],edges:[],lanes:[],start:0,end:0};const n=[...e].sort((h,d)=>h.created-d.created||h.id.localeCompare(d.id)),s=n[0].created,r=n.reduce((h,d)=>Math.max(h,sn(d)),s+36e5),o=new Map;for(const h of n){const d=`${h.projectID}:${h.directory}`,m=o.get(d)||[];m.push(h),o.set(d,m)}const i=[...o].sort((h,d)=>d[1].length-h[1].length||h[0].localeCompare(d[0])),a=[],c=[];i.forEach(([h,d],m)=>{const b=m*2.399963,I=m===0?0:15+Math.sqrt(m)*14,M=Math.cos(b)*I,R=Math.sin(b)*I*.7,x=mi[m%mi.length],A=t.find(C=>C.id===d[0].projectID),y=d[0].directory,E={key:h,label:jn(y),color:x,kind:A?.worktrees.includes(y)?"worktree":"directory",y:M,z:R,nodes:[]};for(const C of d){const O=vi(sn(C),{start:s,end:r}),w=vi(C.created,{start:s,end:r}),L=$n(C.id),V=!!(C.parentID||C.forkID)?12:6,H=Math.sin((w+150)/65+m*.7)*3.5,K={session:C,position:[O,M+H+(L-.5)*V,R+($n(C.id+"z")-.5)*V],startPosition:[w,0,0],color:x,radius:.35+Math.min(.65,Math.log10(1+(C.tokens||0))*.08)};c.push(K),E.nodes.push(K)}a.push(E)});const l=new Set(n.map(h=>h.id)),p=[];for(const h of n)h.forkID&&l.has(h.forkID)?p.push({from:h.forkID,to:h.id,kind:"fork"}):h.parentID&&l.has(h.parentID)&&p.push({from:h.parentID,to:h.id,kind:"child"});const f=new Map(c.map(h=>[h.session.id,h])),g=new Set;function u(h,d=new Set){const m=h.session.id;if(g.has(m)||d.has(m))return;d.add(m);const b=h.session.forkID||h.session.parentID,I=b?f.get(b):void 0;if(I&&I.session.directory===h.session.directory){u(I,d);const M=$n(m+"branch")>.5?1:-1;h.position[1]=I.position[1]+M*(9+$n(m)*15),h.position[2]=I.position[2]+($n(m+"depth")-.5)*18}g.add(m)}return n.forEach(h=>u(f.get(h.id))),c.forEach(h=>{h.startPosition=Va(h,h.startPosition[0])}),{nodes:c,edges:p,lanes:a,start:s,end:r}}function yd(){const e=new AbortController,t={signal:e.signal};let n,s=innerWidth<760;function r(l,p,f){const g=Math.max(12,Math.min(p,innerWidth-l.offsetWidth-12)),u=Math.max(72,Math.min(f,innerHeight-l.offsetHeight-12));Object.assign(l.style,{left:`${g}px`,top:`${u}px`,right:"auto",bottom:"auto",transform:"none"}),l.dataset.positioned="true"}function o(){if(!n)return;const{panel:l,handle:p,pointerID:f}=n;n=void 0,l.classList.remove("dragging"),p.hasPointerCapture(f)&&p.releasePointerCapture(f)}document.addEventListener("pointerdown",l=>{if(l.button!==0)return;const p=l.target,f=p.closest(".floating-panel");if(!f)return;document.querySelectorAll(".floating-panel").forEach(h=>h.classList.toggle("front",h===f));const g=p.closest("[data-drag-panel]");if(!g)return;f.querySelectorAll(".custom-dates[open]").forEach(h=>{h.open=!1}),l.preventDefault(),g.focus({preventScroll:!0});const u=f.getBoundingClientRect();n={panel:f,handle:g,pointerID:l.pointerId,x:l.clientX,y:l.clientY,left:u.left,top:u.top},g.setPointerCapture(l.pointerId),f.classList.add("dragging")},t),document.addEventListener("pointermove",l=>{!n||l.pointerId!==n.pointerID||r(n.panel,n.left+l.clientX-n.x,n.top+l.clientY-n.y)},t),document.addEventListener("pointerup",o,t),document.addEventListener("pointercancel",o,t),document.addEventListener("lostpointercapture",o,t),document.addEventListener("keydown",l=>{const f=l.target.closest("[data-drag-panel]")?.closest(".floating-panel");if(!f||!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(l.key))return;l.preventDefault();const g=f.getBoundingClientRect(),u=l.shiftKey?40:10;r(f,g.left+(l.key==="ArrowLeft"?-u:l.key==="ArrowRight"?u:0),g.top+(l.key==="ArrowUp"?-u:l.key==="ArrowDown"?u:0))},t);const i=[...document.querySelectorAll(".floating-panel")],a=l=>{if(l.hidden||!l.dataset.positioned)return;const p=l.getBoundingClientRect();r(l,p.left,p.top)},c=new ResizeObserver(l=>l.forEach(p=>a(p.target)));return i.forEach(l=>c.observe(l)),window.addEventListener("resize",()=>{o(),s!==innerWidth<760?(s=innerWidth<760,i.forEach(l=>{l.removeAttribute("style"),delete l.dataset.positioned})):i.forEach(a)},t),()=>{o(),e.abort(),c.disconnect()}}const bd=2,yi=e=>JSON.stringify([bd,e.revision,e.updated,e.created,e.projectID,e.directory]),rn=e=>e.normalize("NFKD").replace(new RegExp("\\p{M}","gu"),"").toLowerCase(),To=e=>rn(e).match(/[\p{L}\p{N}]+/gu)||[],wd=e=>To(e).join(" ");function Ed(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=rn(r[2].replace(/^"|"$/g,""));if(i==="in"){const c={title:["title"],files:["files"],messages:["body"],tools:["tools"]};t.fields=c[a],t.fields||(t.error="Use in:title, in:files, in:messages, or in:tools.")}else i==="is"&&!["fork","child","root","archived"].includes(a)?t.error="Use is:fork, is:child, is:root, or is:archived.":["after","before"].includes(i)&&(!/^\d{4}-\d{2}-\d{2}$/.test(a)||!Number.isFinite(Date.parse(a))||new Date(a).toISOString().slice(0,10)!==a)?t.error="Use a valid date in YYYY-MM-DD format.":t.filters.push([i,a]);continue}const o=s.replace(/^"|"$/g,"");s.startsWith('"')&&s.endsWith('"')&&t.phrases.push(wd(o)),n.push(o)}return t.text=n.join(" "),t.terms=To(t.text).slice(0,12),t.text=t.terms.join(" "),t}function xd(e,t,n=220){const s=rn(e),r=t.reduce((i,a)=>{const c=s.indexOf(a);return c<0?i:Math.min(i,c)},1/0),o=Number.isFinite(r)?Math.max(0,r-55):0;return`${o?"…":""}${e.slice(o,o+n).replace(/\s+/g," ").trim()}${e.length>o+n?"…":""}`}const je=e=>({opencode:"OpenCode","claude-code":"Claude Code",codex:"Codex",cursor:"Cursor"})[e||"opencode"]||e||"Unknown",Ue=e=>{const t={opencode:"opencode","claude-code":"claude",codex:"openai",cursor:"cursor"}[e||""]||"generic";return`<span class="source-icon source-icon-${t}" aria-hidden="true" style="--source-icon:url('/sources/${t}.svg')"></span>`},$e=e=>e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]);function In(e,t){const n=new Set(t.map(rn));let s=0,r="";for(const o of e.matchAll(/[\p{L}\p{N}]+/gu)){r+=$e(e.slice(s,o.index));const i=rn(o[0]),a=[...n].some(c=>i.startsWith(c));r+=a?`<mark>${$e(o[0])}</mark>`:$e(o[0]),s=o.index+o[0].length}return r+$e(e.slice(s))}function Sd(e,t=()=>{},n){const s=new Worker(new URL("/assets/worker-YMPBjASm.js",import.meta.url),{type:"module"}),r=new AbortController,o={signal:r.signal},i=document.createElement("dialog");i.className="search-dialog",i.setAttribute("aria-label","Search sessions"),i.innerHTML=`
|
|
6
|
-
<div class="search-command"><span class="search-command-icon" aria-hidden="true">⌕</span><input id="session-query" type="search" placeholder="Search sessions, messages, files…" autocomplete="off" spellcheck="false" role="combobox" aria-label="Search all sessions" aria-autocomplete="list" aria-expanded="true" aria-controls="search-results"/><button class="icon-button search-close" aria-label="Close search" title="Close (Esc)">×</button></div>
|
|
7
|
-
<div class="search-options"><select id="search-scope" aria-label="Search scope" title="Switch scope (Alt+S)"><option value="all">All history</option><option value="view">Current view</option></select><button id="search-conversations" class="search-chip" aria-label="Index conversations" aria-pressed="true" title="Pause or resume background indexing. Indexed messages, tools, and files remain searchable.">Conversations</button><span id="search-index-state" role="status">Loading index…</span></div>
|
|
8
|
-
<div class="search-body"><div id="search-results" class="search-results" role="listbox" aria-label="Matching sessions"><div class="search-results-inner"></div></div><aside id="search-preview" class="search-preview" aria-label="Session preview"></aside></div>
|
|
9
|
-
<div class="search-footer"><span id="search-result-status" role="status">Loading sessions…</span><button id="search-more" hidden>More results</button><details class="search-syntax"><summary title="Search filters and cache">Filters</summary><div><code>project:sessiongraph</code><code>model:claude</code><code>in:files package.json</code><code>is:fork</code><code>after:2026-09-01</code><code>"exact phrase"</code><button id="search-clear-cache" title="Clear saved search text and pause indexing. Titles remain searchable; enable Conversations to rebuild.">Clear saved index</button></div></details><span class="search-keys"><kbd>↑↓</kbd> navigate <kbd>↵</kbd> open</span></div>`,document.body.append(i);const a=v=>i.querySelector(v),c=a("#session-query"),l=a("#search-results"),p=a(".search-results-inner"),f=a("#search-preview"),g=a("#search-scope");let u=new Map,h=new Map,d,m=[],b=0,I=0,M=0,R=80,x=0,A=0,y=0,E=!1,C=!1,O=!0,w,L=null,D,V=0,H="",K="",se=!1;const Z=new Map,z=86,xe=v=>s.postMessage(v);function xn(){if(!w)return;const v=a("#search-index-state");v.textContent=w.storage==="restoring"?"Restoring saved index…":w.complete===w.total&&w.total?`Conversations ready${w.storage==="local"?" · saved locally":""}`:`${w.indexed.toLocaleString()} / ${w.total.toLocaleString()} conversations${O?w.active?" · indexing":" · partial":" · paused"}`,v.title=`Titles and metadata cover all ${w.total.toLocaleString()} imported sessions. ${w.complete.toLocaleString()} conversations have all supported text indexed. ${w.failed?`${w.failed} unavailable; toggle Conversations to retry. `:""}${w.limited?"Large histories are sampled; missing matches may be in unindexed text. ":""}${w.storage==="memory"?"Saving unavailable; search continues in memory.":`Saved in local SQLite. ${w.restored.toLocaleString()} conversations restored; unchanged pages are reused. Clear saved index under Filters. Imported sessions remain saved.`}`}function Ye(){if(p.style.height=`${m.length*z}px`,!m.length){p.innerHTML=`<div class="search-empty">${$e(K||(E?"Searching…":c.value?"No matching sessions":"No sessions available"))}</div>`,c.removeAttribute("aria-activedescendant");return}const v=Math.max(0,Math.floor(l.scrollTop/z)-3),$=Math.min(m.length,v+Math.ceil(l.clientHeight/z)+7);p.innerHTML=m.slice(v,$).map((N,Q)=>{const B=v+Q,j=u.get(N.id);if(!j)return"";const ie=`${je(j.source)} · ${h.get(j.projectID)||j.directory.split("/").at(-1)||"Global"} · ${new Date(j.updated).toLocaleDateString(void 0,{month:"short",day:"numeric"})}`;return`<div id="search-hit-${B}" class="search-result ${B===b?"active":""}" role="option" aria-selected="${B===b}" aria-posinset="${B+1}" aria-setsize="${I}" data-result-index="${B}" style="top:${B*z}px"><div class="search-result-title">${In(j.title,N.terms)}</div><div class="search-result-meta"><span>${Ue(j.source)}${$e(ie)}</span><span class="match-kind">${$e(N.source)}</span></div>${N.excerpt?`<div class="search-result-excerpt">${In(N.excerpt,N.terms)}</div>`:`<div class="search-result-excerpt">${$e(j.model)}</div>`}</div>`}).join(""),b>=v&&b<$?c.setAttribute("aria-activedescendant",`search-hit-${b}`):c.removeAttribute("aria-activedescendant")}function Ke(v,$=!1,N=!1){const Q=m[b],B=Q&&u.get(Q.id);if(!B){f.innerHTML="";return}const j=Q.terms.length?Q.terms:To(Ed(c.value).text),ie=v?.fragments.filter(re=>{const Ne=rn(re.text);return j.length&&j.every(Fe=>Ne.includes(Fe))}).slice(0,4)||[],Me=v?.fragments.filter(re=>["You","Assistant"].includes(re.kind)).slice(0,5).reverse()||[],Ve=ie.length?ie:Me;if(f.innerHTML=`<div class="search-preview-heading"><span>${$e(h.get(B.projectID)||"Session")}</span><h2>${In(B.title,j)}</h2><p>${$e(B.model)} · ${new Date(B.created).toLocaleDateString()}</p><button class="secondary-button search-open">Explore session <span aria-hidden="true">↗</span></button></div>${Q.excerpt?`<section class="search-preview-section"><h3>Matching passage</h3><p>${In(Q.excerpt,j)}</p></section>`:""}<section class="search-preview-section"><h3>${ie.length?"Matching context":"Recent conversation"}</h3>${$?'<p class="preview-loading">Loading preview…</p>':N?'<p>Preview unavailable.</p><button class="text-button preview-retry">Retry</button>':Ve.length?Ve.map(re=>`<article><span>${$e(re.kind)}</span><p>${In(xd(re.text,j,360),j)}</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>`,f.querySelector(".search-open")?.addEventListener("click",Sn,o),n){const re=document.createElement("button");re.className="text-button search-launch",re.innerHTML=`${Ue(B.source)}Open in ${$e(je(B.source))} ↗`,re.addEventListener("click",()=>n(B),o),f.querySelector(".search-preview-heading")?.append(re)}f.querySelector(".preview-retry")?.addEventListener("click",()=>{H="",kt()},o)}function kt(){const v=m[b],$=v&&u.get(v.id),N=$?`${$.id}:${yi($)}:${c.value}`:"";if(N===H)return;if(H=N,window.clearTimeout(V),D?.abort(),!$){Ke();return}const Q=`${$.id}:${yi($)}`,B=Z.get(Q);if(B){Ke(B);return}Ke(void 0,!0),V=window.setTimeout(async()=>{const j=new AbortController;D=j;try{const ie=await fetch(`/api/sessiongraph/session/${encodeURIComponent($.id)}/content?updated=${$.updated}`,{signal:j.signal});if(!ie.ok)throw new Error("Preview unavailable");const Me=await ie.json();if(j.signal.aborted||N!==H)return;Z.size>=25&&Z.delete(Z.keys().next().value),Z.set(Q,Me),Ke(Me)}catch{!j.signal.aborted&&N===H&&Ke(void 0,!1,!0)}},90)}function Ut(){cancelAnimationFrame(x),E=!0,c.setAttribute("aria-busy","true");const v=++M;A=performance.now(),x=requestAnimationFrame(()=>xe({type:"query",request:v,text:c.value,viewOnly:g.value==="view",limit:R}))}function yt(){b=0,se=!1,R=80,l.scrollTop=0,H="",Ut()}function At(v){if(!m.length)return;se=!0,b=Math.max(0,Math.min(m.length-1,b+v));const $=b*z;$<l.scrollTop?l.scrollTop=$:$+z>l.scrollTop+l.clientHeight&&(l.scrollTop=$+z-l.clientHeight),Ye(),kt()}function bt(){i.close(),t(!1),D?.abort(),window.clearTimeout(V),H="",L?.focus({preventScroll:!0})}function Sn(){const v=m[b];!v||E||(bt(),e(v.id))}function T(){i.open||(L=document.activeElement,i.showModal()),t(!0),c.focus({preventScroll:!0}),c.select(),Ut(),O&&xe({type:"warm",enabled:!0})}s.onmessage=v=>{const $=v.data;if($.type==="status"){w=$.status,xn();return}if($.type==="error"){K=$.message,E=!1,c.setAttribute("aria-busy","false"),Ye();return}if($.request!==M)return;const N=m[b]?.id;y=E?performance.now()-A:y,E=!1,c.setAttribute("aria-busy","false"),m=$.hits,I=$.total,K=$.error||"",b=Math.max(0,Math.min(m.length-1,se&&N?m.findIndex(Q=>Q.id===N):0)),a("#search-result-status").textContent=K||`${I.toLocaleString()} ${c.value?"matches":"sessions"} · ${Math.round($.elapsed)} ms`,a("#search-more").hidden=m.length>=I||R>=250,i.open&&(Ye(),kt())},s.onerror=()=>{K="Search could not start. Reload to retry.",E=!1,Ye()},c.addEventListener("input",()=>{C||yt()},o),c.addEventListener("compositionstart",()=>{C=!0},o),c.addEventListener("compositionend",()=>{C=!1,yt()},o),g.addEventListener("change",yt,o),l.addEventListener("scroll",Ye,o),l.addEventListener("click",v=>{const $=v.target.closest("[data-result-index]");$&&(b=Number($.dataset.resultIndex),se=!0,Ye(),kt(),c.focus())},o),l.addEventListener("dblclick",Sn,o),a("#search-more").addEventListener("click",()=>{R=Math.min(250,R+80),Ut()},o),a("#search-conversations").addEventListener("click",()=>{O=!O,a("#search-conversations").setAttribute("aria-pressed",String(O)),xe({type:"warm",enabled:O}),xn()},o),a("#search-clear-cache").addEventListener("click",()=>{O=!1,a("#search-conversations").setAttribute("aria-pressed","false"),Z.clear(),H="",D?.abort(),window.clearTimeout(V),a(".search-syntax").open=!1,xe({type:"clear-cache"}),c.focus()},o),a(".search-close").addEventListener("click",bt,o),i.addEventListener("cancel",v=>{v.preventDefault(),bt()},o),i.addEventListener("keydown",v=>{v.stopPropagation(),!(C||v.isComposing)&&((v.key==="ArrowDown"||v.key==="ArrowUp")&&(v.preventDefault(),At(v.key==="ArrowDown"?1:-1)),(v.key==="PageDown"||v.key==="PageUp")&&(v.preventDefault(),At((v.key==="PageDown"?1:-1)*Math.max(1,Math.floor(l.clientHeight/z)))),v.key==="Enter"&&v.target===c&&(v.preventDefault(),Sn()),v.key==="Escape"&&(v.preventDefault(),bt()),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 $=v.target,N=$.isContentEditable||$.closest('input:not([type="range"]):not([type="checkbox"]):not([type="radio"]), textarea, select');(v.key==="/"&&!N&&!v.ctrlKey&&!v.metaKey&&!v.altKey||v.key.toLowerCase()==="k"&&(v.metaKey||v.ctrlKey))&&(v.preventDefault(),T())},o);const S=new ResizeObserver(()=>{i.open&&Ye()});return S.observe(l),{open:T,setData(v){d!==v.sourceID&&(Z.clear(),H="",D?.abort(),window.clearTimeout(V)),d=v.sourceID,u=new Map(v.sessions.map($=>[$.id,$])),h=new Map(v.projects.map($=>[$.id,$.name])),xe({type:"data",sessions:v.sessions,projects:v.projects,sourceID:d})},setScope(v){xe({type:"scope",ids:v})},diagnostics:()=>({open:i.open,query:c.value,matches:I,renderedRows:p.querySelectorAll('[role="option"]').length,roundTripMs:y,pending:E,index:w}),dispose(){s.terminate(),r.abort(),S.disconnect(),D?.abort(),window.clearTimeout(V),cancelAnimationFrame(x),i.remove()}}}const Vn=[{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"}],br=e=>Vn.some(t=>t.id===e),Na=e=>/^ses[a-zA-Z0-9_-]+$/.test(e);function $d(e,t){if(!Na(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 Jt=(e,t=[])=>({parts:(...n)=>{if(Id(t))return Jt(e,n);throw new Error("createAnatomy().parts(...) should only be called once. Did you mean to use .extendWith(...) ?")},extendWith:(...n)=>Jt(e,[...t,...n]),omit:(...n)=>Jt(e,t.filter(s=>!n.includes(s))),rename:n=>Jt(n,t),keys:()=>t,build:()=>[...new Set(t)].reduce((n,s)=>Object.assign(n,{[s]:{selector:[`&[data-scope="${qt(e)}"][data-part="${qt(s)}"]`,`& [data-scope="${qt(e)}"][data-part="${qt(s)}"]`].join(", "),attrs:{"data-scope":qt(e),"data-part":qt(s)}}}),{})}),qt=e=>e.replace(/([A-Z])([A-Z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase(),Id=e=>e.length===0,Td=Jt("select").parts("label","positioner","trigger","indicator","clearTrigger","item","itemText","itemIndicator","itemGroup","itemGroupLabel","list","content","root","control","valueText"),pe=Td.build(),Cd=Object.defineProperty,kd=(e,t,n)=>t in e?Cd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_=(e,t,n)=>kd(e,typeof t!="symbol"?t+"":t,n);function Ad(e){return e==null?[]:Array.isArray(e)?e:[e]}var Od=e=>e[e.length-1],Ld=(e,t)=>e.indexOf(t)!==-1,Md=(e,...t)=>e.concat(t),Dd=(e,...t)=>e.filter(n=>!t.includes(n)),bi=(e,t)=>Ld(e,t)?Dd(e,t):Md(e,t);function wi(e,t){return e.reduce((n,s,r)=>(r%t===0?n.push([s]):Od(n)?.push(s),n),[])}var Ei=e=>e?.constructor.name==="Array",Rd=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!mn(e[n],t[n]))return!1;return!0},mn=(e,t)=>{if(Object.is(e,t))return!0;if(e==null&&t!=null||e!=null&&t==null)return!1;if(typeof e?.isEqual=="function"&&typeof t?.isEqual=="function")return e.isEqual(t);if(typeof e=="function"&&typeof t=="function")return e.toString()===t.toString();if(Ei(e)&&Ei(t))return Rd(Array.from(e),Array.from(t));if(typeof e!="object"||typeof t!="object")return!1;const n=Object.keys(t??Object.create(null)),s=n.length;if(Object.keys(e).length!==s)return!1;for(let r=0;r<s;r++)if(!Reflect.has(e,n[r]))return!1;for(let r=0;r<s;r++){const o=n[r];if(!mn(e[o],t[o]))return!1}return!0},Pd=e=>Array.isArray(e),Fa=e=>e!=null&&typeof e=="object",wr=e=>Fa(e)&&!Pd(e),Vd=e=>typeof e=="string",Je=e=>typeof e=="function",Nd=e=>e==null,Cs=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Fd=e=>Object.prototype.toString.call(e),Ha=Function.prototype.toString,Hd=Ha.call(Object),Nn=e=>{if(!Fa(e)||Fd(e)!="[object Object]"||Wd(e))return!1;const t=Object.getPrototypeOf(e);if(t===null)return!0;const n=Cs(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Ha.call(n)==Hd},_d=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,Bd=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,Wd=e=>_d(e)||Bd(e),xi=(e,...t)=>(typeof e=="function"?e(...t):e)??void 0,jd=e=>e(),_a=()=>{},Hs=(...e)=>(...t)=>{e.forEach(function(n){n?.(...t)})};function zr(e,t,...n){if(e in t){const r=t[e];return Je(r)?r(...n):r}const s=new Error(`No matching key: ${JSON.stringify(e)} in ${JSON.stringify(Object.keys(t))}`);throw Error.captureStackTrace?.(s,zr),s}var{min:Ud,max:qd}=Math,Gd=e=>Number.isNaN(e),Ba=e=>Gd(e)?0:e,Er=(e,t,n)=>{const s=Ba(e),r=t==null||s>=t,o=n==null||s<=n;return r&&o},Yd=(e,t,n)=>Ud(qd(Ba(e),t),n);function Co(e){if(!Nn(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]=Co(r))}return n}function Wa(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 ks(...e){e.length===1?e[0]:e[1],e.length===2&&e[0]}function Si(...e){e.length===1?e[0]:e[1],e.length===2&&e[0]}function Qs(e,t){if(e==null)throw new Error(t())}var As={itemToValue(e){return typeof e=="string"?e:wr(e)&&Cs(e,"value")?e.value:""},itemToString(e){return typeof e=="string"?e:wr(e)&&Cs(e,"label")?e.label:As.itemToValue(e)},isItemDisabled(e){return wr(e)&&Cs(e,"disabled")?!!e.disabled:!1}},ja=class Ua{constructor(t){_(this,"options",t),_(this,"items"),_(this,"indexMap",null),_(this,"copy",n=>new Ua({...this.options,items:n??[...this.items]})),_(this,"isEqual",n=>mn(this.items,n.items)),_(this,"setItems",n=>this.copy(n)),_(this,"getValues",(n=this.items)=>{const s=[];for(const r of n){const o=this.getItemValue(r);o!=null&&s.push(o)}return s}),_(this,"find",n=>{if(n==null)return null;const s=this.indexOf(n);return s!==-1?this.at(s):null}),_(this,"findMany",n=>{const s=[];for(const r of n){const o=this.find(r);o!=null&&s.push(o)}return s}),_(this,"at",n=>{if(!this.options.groupBy&&!this.options.groupSort)return this.items[n]??null;let s=0;const r=this.group();for(const[,o]of r)for(const i of o){if(s===n)return i;s++}return null}),_(this,"sortFn",(n,s)=>{const r=this.indexOf(n),o=this.indexOf(s);return(r??0)-(o??0)}),_(this,"sort",n=>[...n].sort(this.sortFn.bind(this))),_(this,"getItemValue",n=>n==null?null:this.options.itemToValue?.(n)??As.itemToValue(n)),_(this,"getItemDisabled",n=>n==null?!1:this.options.isItemDisabled?.(n)??As.isItemDisabled(n)),_(this,"stringifyItem",n=>n==null?null:this.options.itemToString?.(n)??As.itemToString(n)),_(this,"stringify",n=>n==null?null:this.stringifyItem(this.find(n))),_(this,"stringifyItems",(n,s=", ")=>{const r=[];for(const o of n){const i=this.stringifyItem(o);i!=null&&r.push(i)}return r.join(s)}),_(this,"stringifyMany",(n,s)=>this.stringifyItems(this.findMany(n),s)),_(this,"has",n=>this.indexOf(n)!==-1),_(this,"hasItem",n=>n==null?!1:this.has(this.getItemValue(n))),_(this,"group",()=>{const{groupBy:n,groupSort:s}=this.options;if(!n)return[["",[...this.items]]];const r=new Map;this.items.forEach((i,a)=>{const c=n(i,a);r.has(c)||r.set(c,[]),r.get(c).push(i)});let o=Array.from(r.entries());return s&&o.sort(([i],[a])=>{if(typeof s=="function")return s(i,a);if(Array.isArray(s)){const c=s.indexOf(i),l=s.indexOf(a);return c===-1?1:l===-1?-1:c-l}return s==="asc"?i.localeCompare(a):s==="desc"?a.localeCompare(i):0}),o}),_(this,"getNextValue",(n,s=1,r=!1)=>{let o=this.indexOf(n);if(o===-1)return null;for(o=r?Math.min(o+s,this.size-1):o+s;o<=this.size&&this.getItemDisabled(this.at(o));)o++;return this.getItemValue(this.at(o))}),_(this,"getPreviousValue",(n,s=1,r=!1)=>{let o=this.indexOf(n);if(o===-1)return null;for(o=r?Math.max(o-s,0):o-s;o>=0&&this.getItemDisabled(this.at(o));)o--;return this.getItemValue(this.at(o))}),_(this,"indexOf",n=>{if(n==null)return-1;if(!this.options.groupBy&&!this.options.groupSort)return this.items.findIndex(s=>this.getItemValue(s)===n);if(!this.indexMap){this.indexMap=new Map;let s=0;const r=this.group();for(const[,o]of r)for(const i of o){const a=this.getItemValue(i);a!=null&&this.indexMap.set(a,s),s++}}return this.indexMap.get(n)??-1}),_(this,"getByText",(n,s)=>{const r=s!=null?this.indexOf(s):-1,o=n.length===1;for(let i=0;i<this.items.length;i++){const a=this.items[(r+i+1)%this.items.length];if(!(o&&this.getItemValue(a)===s)&&!this.getItemDisabled(a)&&Kd(this.stringifyItem(a),n))return a}}),_(this,"search",(n,s)=>{const{state:r,currentValue:o,timeout:i=350}=s,a=r.keysSoFar+n,l=a.length>1&&Array.from(a).every(h=>h===a[0])?a[0]:a,p=this.getByText(l,o),f=this.getItemValue(p);function g(){clearTimeout(r.timer),r.timer=-1}function u(h){r.keysSoFar=h,g(),h!==""&&(r.timer=+setTimeout(()=>{u(""),g()},i))}return u(a),f}),_(this,"update",(n,s)=>{let r=this.indexOf(n);return r===-1?this:this.copy([...this.items.slice(0,r),s,...this.items.slice(r+1)])}),_(this,"upsert",(n,s,r="append")=>{let o=this.indexOf(n);return o===-1?(r==="append"?this.append:this.prepend)(s):this.copy([...this.items.slice(0,o),s,...this.items.slice(o+1)])}),_(this,"insert",(n,...s)=>this.copy(Tn(this.items,n,...s))),_(this,"insertBefore",(n,...s)=>{let r=this.indexOf(n);if(r===-1)if(this.items.length===0)r=0;else return this;return this.copy(Tn(this.items,r,...s))}),_(this,"insertAfter",(n,...s)=>{let r=this.indexOf(n);if(r===-1)if(this.items.length===0)r=0;else return this;return this.copy(Tn(this.items,r+1,...s))}),_(this,"prepend",(...n)=>this.copy(Tn(this.items,0,...n))),_(this,"append",(...n)=>this.copy(Tn(this.items,this.items.length,...n))),_(this,"filter",n=>{const s=this.items.filter((r,o)=>n(this.stringifyItem(r),o,r));return this.copy(s)}),_(this,"remove",(...n)=>{const s=n.map(r=>typeof r=="string"?r:this.getItemValue(r));return this.copy(this.items.filter(r=>{const o=this.getItemValue(r);return o==null?!1:!s.includes(o)}))}),_(this,"move",(n,s)=>{const r=this.indexOf(n);return r===-1?this:this.copy(as(this.items,[r],s))}),_(this,"moveBefore",(n,...s)=>{let r=this.items.findIndex(i=>this.getItemValue(i)===n);if(r===-1)return this;let o=s.map(i=>this.items.findIndex(a=>this.getItemValue(a)===i)).sort((i,a)=>i-a);return this.copy(as(this.items,o,r))}),_(this,"moveAfter",(n,...s)=>{let r=this.items.findIndex(i=>this.getItemValue(i)===n);if(r===-1)return this;let o=s.map(i=>this.items.findIndex(a=>this.getItemValue(a)===i)).sort((i,a)=>i-a);return this.copy(as(this.items,o,r+1))}),_(this,"reorder",(n,s)=>this.copy(as(this.items,[n],s))),_(this,"compareValue",(n,s)=>{const r=this.indexOf(n),o=this.indexOf(s);return r<o?-1:r>o?1:0}),_(this,"range",(n,s)=>{let r=[],o=n;for(;o!=null;){if(this.find(o)&&r.push(o),o===s)return r;o=this.getNextValue(o)}return[]}),_(this,"getValueRange",(n,s)=>n&&s?this.compareValue(n,s)<=0?this.range(n,s):this.range(s,n):[]),_(this,"toString",()=>{let n="";for(const s of this.items){const r=this.getItemValue(s),o=this.stringifyItem(s),i=this.getItemDisabled(s),a=[r,o,i].filter(Boolean).join(":");n+=a+","}return n}),_(this,"toJSON",()=>({size:this.size,first:this.firstValue,last:this.lastValue})),this.items=[...t.items]}get size(){return this.items.length}get firstValue(){let t=0;for(;this.getItemDisabled(this.at(t));)t++;return this.getItemValue(this.at(t))}get lastValue(){let t=this.size-1;for(;this.getItemDisabled(this.at(t));)t--;return this.getItemValue(this.at(t))}*[Symbol.iterator](){yield*this.items}},Kd=(e,t)=>!!e?.toLowerCase().startsWith(t.toLowerCase());function Tn(e,t,...n){return[...e.slice(0,t),...n,...e.slice(t)]}function as(e,t,n){t=[...t].sort((r,o)=>r-o);const s=t.map(r=>e[r]);for(let r=t.length-1;r>=0;r--)e=[...e.slice(0,t[r]),...e.slice(t[r]+1)];return n=Math.max(0,n-t.filter(r=>r<n).length),[...e.slice(0,n),...s,...e.slice(n)]}function qa({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 Ga({selectedItemMap:e,values:t,selectedItems:n,collection:s}){const r=new Map(e);for(const i of n){const a=s.getItemValue(i);a!=null&&r.set(a,i)}const o=new Set(t);for(const i of r.keys())o.has(i)||r.delete(i);return r}function ls({values:e,collection:t,selectedItemMap:n}){const s=qa({values:e,collection:t,selectedItemMap:n}),r=Ga({selectedItemMap:n,values:e,selectedItems:s,collection:t});return{selectedItems:s,nextSelectedItemMap:r}}function zd({selectedItems:e,collection:t}){return Ga({selectedItemMap:new Map,values:e.map(n=>t.getItemValue(n)).filter(Boolean),selectedItems:e,collection:t})}var _s=e=>new ja(e);_s.empty=()=>new ja({items:[]});var Zd=Object.defineProperty,Jd=(e,t,n)=>t in e?Zd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xr=(e,t,n)=>Jd(e,typeof t!="symbol"?t+"":t,n),Xd=(e,t)=>e.map((n,s)=>e[(Math.max(t,0)+s)%e.length]),Bs=()=>{},er=e=>typeof e=="object"&&e!==null,P=e=>e?"":void 0,ue=e=>e?"true":void 0,Qd=1,eu=9,tu=11,ce=e=>er(e)&&e.nodeType===Qd&&typeof e.nodeName=="string",ko=e=>er(e)&&e.nodeType===eu,nu=e=>er(e)&&e===e.window,Ya=e=>ce(e)?e.localName||"":"#document";function su(e){return["html","body","#document"].includes(Ya(e))}var Ka=e=>er(e)&&e.nodeType!==void 0,on=e=>Ka(e)&&e.nodeType===tu&&"host"in e,za=e=>ce(e)&&e.localName==="input",ru=e=>ce(e)?e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0:!1;function Zr(e){if(!e)return!1;const t=e.getRootNode();return tr(t)===e}var ou=/(textarea|select)/;function iu(e){if(e==null||!ce(e))return!1;try{return za(e)&&e.selectionStart!=null||ou.test(e.localName)||e.isContentEditable||e.getAttribute("contenteditable")==="true"||e.getAttribute("contenteditable")===""}catch{return!1}}function an(e,t){if(!e||!t||!ce(e)||!Ka(t))return!1;if(ce(t)&&e===t||e.contains(t))return!0;const n=t.getRootNode?.();if(n&&on(n)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function Le(e){return ko(e)?e:nu(e)?e.document:e?.ownerDocument??document}function au(e){return Le(e).documentElement}function he(e){return on(e)?he(e.host):ko(e)?e.defaultView??window:ce(e)?e.ownerDocument?.defaultView??window:window}function tr(e){let t=e.activeElement;for(;t?.shadowRoot;){const n=t.shadowRoot.activeElement;if(!n||n===t)break;t=n}return t}function $i(e,t){return!e||e===Le(e).body?!1:!t.some(n=>an(n,e))}function lu(e){if(Ya(e)==="html")return e;const t=e.assignedSlot||e.parentNode||on(e)&&e.host||au(e);return on(t)?t.host:t}function cu(e){let t;try{if(t=e.getRootNode({composed:!0}),ko(t)||on(t))return t}catch{}return e.ownerDocument??document}var Sr=new WeakMap;function Za(e){return Sr.has(e)||Sr.set(e,he(e).getComputedStyle(e)),Sr.get(e)}var Ao=()=>typeof document<"u";function du(){return navigator.userAgentData?.platform??navigator.platform}function uu(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}var Oo=e=>Ao()&&e.test(du()),fu=e=>Ao()&&e.test(uu()),hu=/^iPhone/i,pu=/^iPad/i,gu=/^Mac/i,mu=/Android/i,Ii=()=>Ao()&&!!navigator.maxTouchPoints,vu=()=>Oo(hu),yu=()=>Oo(pu)||Lo()&&navigator.maxTouchPoints>1,Ja=()=>vu()||yu(),Lo=()=>Oo(gu),bu=()=>fu(mu),wu=new Set(["menu","listbox","dialog","grid","tree","region","application"]),Eu=e=>wu.has(e),xu=e=>e.getAttribute("aria-controls")?.split(" ")||[];function Su(e,t){const n=new Set,s=cu(e),r=o=>{const i=o.querySelectorAll("[aria-controls]");for(const a of i){if(a.getAttribute("aria-expanded")!=="true")continue;const c=xu(a);for(const l of c){if(!l||n.has(l))continue;n.add(l);const p=s.getElementById(l);if(p){const f=p.getAttribute("role"),g=p.getAttribute("aria-modal")==="true";if(f&&Eu(f)&&!g&&(p===t||p.contains(t)||r(p)))return!0}}}return!1};return r(e)}function $u(e){return e.composedPath?.()??e.nativeEvent?.composedPath?.()}function ut(e){return $u(e)?.[0]??e.target}function Iu(e){return Mo(e).isComposing||e.keyCode===229}function Tu(e){return e.pointerType===""&&e.isTrusted?!0:bu()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}var Cu=e=>e.button===2||Lo()&&e.ctrlKey&&e.button===0,ku={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"},Ti={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft"};function Jr(e,t={}){const{dir:n="ltr",orientation:s="horizontal"}=t;let r=e.key;return r=ku[r]??r,n==="rtl"&&s==="horizontal"&&r in Ti&&(r=Ti[r]),r}function Mo(e){return e.nativeEvent??e}var Os=(e,t,n,s)=>{const r=typeof e=="function"?e():e;return r?.addEventListener(t,n,s),()=>{r?.removeEventListener(t,n,s)}};function Au(e,t){const{type:n="HTMLInputElement",property:s="value"}=t,r=he(e)[n].prototype;return Object.getOwnPropertyDescriptor(r,s)??{}}function Ou(e){if(e.localName==="input")return"HTMLInputElement";if(e.localName==="textarea")return"HTMLTextAreaElement";if(e.localName==="select")return"HTMLSelectElement"}function cs(e,t,n="value"){if(!e)return;const s=Ou(e);s&&Au(e,{type:s,property:n}).set?.call(e,t),e.setAttribute(n,t)}function Lu(e){return e.matches("textarea, input, select, button")}function Mu(e,t){if(!e)return;const n=Lu(e)?e.form:e.closest("form"),s=r=>{r.defaultPrevented||t()};return n?.addEventListener("reset",s,{passive:!0}),()=>n?.removeEventListener("reset",s)}function Du(e,t){const n=e?.closest("fieldset");if(!n)return;t(n.disabled);const s=he(n),r=new s.MutationObserver(()=>t(n.disabled));return r.observe(n,{attributes:!0,attributeFilter:["disabled"]}),()=>r.disconnect()}function Ru(e,t){if(!e)return;const{onFieldsetDisabledChange:n,onFormReset:s}=t,r=[Mu(e,s),Du(e,n)];return()=>r.forEach(o=>o?.())}var Xa=Symbol.for("zag.changeEvent");function Qa(e){return Object.prototype.hasOwnProperty.call(e,Xa)}function Pu(e){return Qa(e)||Object.defineProperty(e,Xa,{value:!0}),e}var Vu=e=>ce(e)&&e.tagName==="IFRAME";function Nu(e){const t=e.getAttribute("tabindex");return t?parseInt(t,10):NaN}var Fu=e=>Nu(e)<0;function Hu(e){return za(e)&&e.type==="radio"}function _u(e){if(!Hu(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&&nr(o)),r=s.find(o=>o.checked);return r?r===e:s[0]===e}function Bu(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 Wu(e,t,n){const s=[...e],r=[...e],o=new Set,i=new Map;e.forEach((c,l)=>i.set(c,l));let a=0;for(;a<r.length;){const c=r[a++];if(!c||o.has(c))continue;o.add(c);const l=Bu(c,t);if(l){const p=Array.from(l.querySelectorAll(Do)).filter(n),f=i.get(c);if(f!==void 0){const g=f+1;s.splice(g,0,...p),p.forEach((u,h)=>{i.set(u,g+h)});for(let u=g+p.length;u<s.length;u++)i.set(s[u],u)}else{const g=s.length;s.push(...p),p.forEach((u,h)=>{i.set(u,g+h)})}r.push(...p)}}return s}var Do="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 nr(e){return!ce(e)||e.closest("[inert]")?!1:e.matches(Do)&&ru(e)}function Ro(e,t={}){if(!e)return[];const{includeContainer:n,getShadowRoot:s}=t,r=Array.from(e.querySelectorAll(Do));n&&$r(e)&&r.unshift(e);const o=[];for(const i of r)if($r(i)){if(Vu(i)&&i.contentDocument){const a=i.contentDocument.body;o.push(...Ro(a,{getShadowRoot:s}));continue}o.push(i)}if(s){const i=Wu(o,s,$r);return!i.length&&n?r:i}return!o.length&&n?r:o}function $r(e){return ce(e)&&e.tabIndex>0?!0:!nr(e)||Fu(e)?!1:_u(e)}function ju(e,t={}){const n=Ro(e,t),s=n[0]||null,r=n[n.length-1]||null;return[s,r]}function Uu(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=Ro(t).filter(a=>s?s(a):!0).find(a=>!a.hasAttribute("data-no-autofocus"))),o||t||void 0)}function qu(e){const t=e.currentTarget;if(!t)return!1;const[n,s]=ju(t);return!(Zr(n)&&e.shiftKey||Zr(s)&&!e.shiftKey||!n&&!s)}var el=class tl{constructor(){xr(this,"id",null),xr(this,"fn_cleanup"),xr(this,"cleanup",()=>{this.cancel()})}static create(){return new tl}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 fe(e){const t=el.create();return t.request(e),t.cleanup}function nl(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 Ir=new WeakMap;function Gu(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 Yu(e){const t=Gu(e),n=JSON.stringify(t);return{observe(s,r){const o=he(s);if(typeof o.MutationObserver!="function")return Bs;const i=Ir.get(s)??new Map;let a=i.get(n);if(!a){const l=new Set,p=new o.MutationObserver(f=>{for(const g of[...l])if(l.has(g))try{g(f)}catch(u){o.queueMicrotask(()=>{throw u})}});p.observe(s,t),a={observer:p,listeners:l},i.set(n,a),Ir.set(s,i)}const c=l=>r(l);return a.listeners.add(c),()=>{!a.listeners.delete(c)||a.listeners.size>0||(a.observer.disconnect(),i.delete(n),i.size===0&&Ir.delete(s))}}}}function Ku(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 zu(e,t){const n=fe,s=[];return s.push(n(()=>{const r=typeof e=="function"?e():e;s.push(Ku(r,t))})),()=>{s.forEach(r=>r?.())}}function Xr(e){const t=lu(e);return su(t)?Le(t).body:ce(t)&&Xu(t)?t:Xr(t)}var Zu=/auto|scroll|overlay|hidden|clip/,Ju=new Set(["inline","contents"]);function Xu(e){const t=he(e),{overflow:n,overflowX:s,overflowY:r,display:o}=t.getComputedStyle(e);return Zu.test(n+r+s)&&!Ju.has(o)}var Ci=/auto|scroll|overlay|hidden/;function Qu(e,t={}){const{axis:n}=t,{overflowX:s,overflowY:r}=he(e).getComputedStyle(e),o=n!=="y"&&Ci.test(s)&&e.scrollWidth>e.clientWidth,i=n!=="x"&&Ci.test(r)&&e.scrollHeight>e.clientHeight;return o||i}var Xt="default",Qr="",Ls=new WeakMap;function ef(e={}){const{target:t,doc:n}=e,s=n??document,r=s.documentElement;return Ja()?(Xt==="default"&&(Qr=r.style.webkitUserSelect,r.style.webkitUserSelect="none"),Xt="disabled"):t&&(Ls.set(t,t.style.userSelect),t.style.userSelect="none"),()=>sl({target:t,doc:s})}function sl(e={}){const{target:t,doc:n}=e,r=(n??document).documentElement;if(Ja()){if(Xt!=="disabled")return;Xt="restoring",setTimeout(()=>{nl(()=>{Xt==="restoring"&&(r.style.webkitUserSelect==="none"&&(r.style.webkitUserSelect=Qr||""),Qr="",Xt="default")})},300)}else if(t&&Ls.has(t)){const o=Ls.get(t);t.style.userSelect==="none"&&(t.style.userSelect=o??""),t.getAttribute("style")===""&&t.removeAttribute("style"),Ls.delete(t)}}function tf(e={}){const{defer:t,target:n,...s}=e,r=t?fe:i=>i(),o=[];return o.push(r(()=>{const i=typeof n=="function"?n():n;o.push(ef({...s,target:i}))})),()=>{o.forEach(i=>i?.())}}function nf(e,t){return Array.from(e?.querySelectorAll(t)??[])}function sf(e,t){return e?.querySelector(t)??null}var Po=e=>e.id;function rf(e,t,n=Po){return e.find(s=>n(s)===t)}function of(e,t,n=Po){const s=rf(e,t,n);return s?e.indexOf(s):-1}function af(e,t){const{rootEl:n,...s}=t||{};!e||!n||Qu(n)&&e.scrollIntoView(s)}var ki,lf=()=>ki??(ki=new Intl.Collator(void 0,{usage:"search",sensitivity:"base"})),cf=e=>e.normalize("NFC").trim(),df=e=>cf(e.dataset?.valuetext??e.textContent??""),uf=(e,t)=>{const n=t.normalize("NFC");return lf().compare(e.slice(0,n.length),n)===0};function ff(e,t,n,s=Po){const r=n?of(e,n,s):-1;let o=n?Xd(e,r):e;return t.length===1&&(o=o.filter(a=>s(a)!==n)),o.find(a=>uf(df(a),t))}function hf(e,t){if(!e)return Bs;const n=Object.keys(t).reduce((s,r)=>(s[r]=e.style.getPropertyValue(r),s),{});return pf(n,t)?Bs:(Object.assign(e.style,t),()=>{Object.assign(e.style,n),e.style.length===0&&e.removeAttribute("style")})}function pf(e,t){return Object.keys(e).every(n=>e[n]===t[n])}function gf(e,t){const{state:n,activeId:s,key:r,timeout:o=350,itemToId:i}=t,a=n.keysSoFar+r,l=a.length>1&&Array.from(a).every(h=>h===a[0])?a[0]:a;let p=e.slice();const f=ff(p,l,s,i);function g(){clearTimeout(n.timer),n.timer=-1}function u(h){n.keysSoFar=h,g(),h!==""&&(n.timer=+setTimeout(()=>{u(""),g()},o))}return u(a),f}var eo=Object.assign(gf,{defaultOptions:{keysSoFar:"",timer:-1},isValidEvent:mf});function mf(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey}var vf={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 yf(e,t,n){const{signal:s}=t;return[new Promise((i,a)=>{const c=setTimeout(()=>{a(new Error(`Timeout of ${n}ms exceeded`))},n);s.addEventListener("abort",()=>{clearTimeout(c),a(new DOMException("Promise aborted","AbortError"))}),e.then(l=>{s.aborted||(clearTimeout(c),i(l))}).catch(l=>{s.aborted||(clearTimeout(c),a(l))})}),()=>t.abort()]}function bf(e,t){const{timeout:n,rootNode:s}=t,r=he(s),o=Le(s),i=new r.AbortController;let a;const c=yf(new Promise(p=>{const f=e();if(f){p(f);return}a=new r.MutationObserver(()=>{const g=e();g&&g.isConnected&&(a?.disconnect(),p(g))}),a.observe(o.body,{childList:!0,subtree:!0})}),i,n),l=()=>a?.disconnect();return c[0].then(l,l),c}var wf=Yu({});function Ef(e,t,n={}){const{defer:s,onMissing:r,getRootNode:o}=n,i=()=>typeof e=="function"?e():e,a=[],c=l=>{if(!l)return r?.();a.push(t(l))};if(!s)c(i());else{let l=!1;a.push(()=>{l=!0}),queueMicrotask(()=>{if(l)return;const p=i();if(p){c(p);return}let f=!1;const g=m=>{l||f||(f=!0,h(),d(),c(m))},u=o?.(),h=u?wf.observe(u,()=>{const m=i();m&&g(m)}):Bs,d=fe(()=>g(i()));a.push(h,d)})}return()=>{a.forEach(l=>l?.())}}function xf(e){return!(e.metaKey||!Lo()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}var Sf=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),$f=["a[href]","audio[controls]","button","details","embed","iframe","img[controls]","img[usemap]","input","select","textarea","video[controls]"].join(",");function If(e,t,n){const s=n?ut(n):null,r=Le(s),o=he(s),i=tr(r);return e=e||i instanceof o.HTMLInputElement&&!Sf.has(i?.type)||i instanceof o.HTMLTextAreaElement||i instanceof o.HTMLElement&&i.isContentEditable,!(e&&t==="keyboard"&&n instanceof o.KeyboardEvent&&!Reflect.has(Cf,n.key))}var ft=null,to=new Set,Ws=new Map,Nt=!1,xt=null,no=!1,Tr=null,Tf=!1,Cf={Tab:!0,Escape:!0};function sr(e,t){for(let n of to)n(e,t)}function js(e){xt=null,Nt=!0,xf(e)&&(ft="keyboard",sr("keyboard",e))}function Ie(e){(e.type==="pointermove"||e.type==="mousemove")&&e.isTrusted&&Tr?.x===e.clientX&&Tr?.y===e.clientY||(Tr={x:e.clientX,y:e.clientY},ft="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(xt=null,Nt=!0,sr("pointer",e)))}function rl(e){if(Tu(e)){xt=null,Nt=!0,ft="virtual";return}xt=null;const t=ut(e),n=t?.closest("label"),s=n?.control;if(!n||!s||s.matches(":disabled"))return;const r=t?.closest($f);r&&n.contains(r)&&r!==s||s!==tr(n.ownerDocument)&&(xt=s)}function ol(e){const t=ut(e),n=t===xt;t===he(t)||t===Le(t)||Tf||!e.isTrusted||(!Nt&&!n&&!no&&(ft="virtual",sr("virtual",e)),Nt=!1,xt=null,no=!1)}function il(){Nt=!1,xt=null,no=!0}function kf(e){try{return e.focus}catch{return}}function Af(e){const t=e.HTMLElement.prototype;try{let s=function(){Nt=!0,(r??i.call(this)).apply(this,arguments)};var n=s;const r=kf(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 Of(e){if(typeof window>"u"||Ws.get(he(e)))return;const t=he(e),n=Le(e),s=Af(t);n.addEventListener("keydown",js,!0),n.addEventListener("keyup",js,!0),n.addEventListener("click",rl,!0),t.addEventListener("focus",ol,!0),t.addEventListener("blur",il,!1),typeof t.PointerEvent<"u"?(n.addEventListener("pointerdown",Ie,!0),n.addEventListener("pointermove",Ie,!0),n.addEventListener("pointerup",Ie,!0)):(n.addEventListener("mousedown",Ie,!0),n.addEventListener("mousemove",Ie,!0),n.addEventListener("mouseup",Ie,!0)),t.addEventListener("beforeunload",()=>{Lf(e)},{once:!0}),Ws.set(t,s)}var Lf=(e,t)=>{const n=he(e),s=Le(e),r=Ws.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",rl,!0),n.removeEventListener("focus",ol,!0),n.removeEventListener("blur",il,!1),typeof n.PointerEvent<"u"?(s.removeEventListener("pointerdown",Ie,!0),s.removeEventListener("pointermove",Ie,!0),s.removeEventListener("pointerup",Ie,!0)):(s.removeEventListener("mousedown",Ie,!0),s.removeEventListener("mousemove",Ie,!0),s.removeEventListener("mouseup",Ie,!0)),Ws.delete(n)}};function so(){return ft}function Mf(e){ft=e,sr(e,null)}function Ai(){return ft==="keyboard"||ft==="virtual"}function Df(e={}){const{isTextInput:t,autoFocus:n,onChange:s,root:r}=e;Of(r),s?.({isFocusVisible:n||Ai(),modality:ft});const o=(i,a)=>{If(!!t,i,a)&&s?.({isFocusVisible:Ai(),modality:i})};return to.add(o),()=>{to.delete(o)}}const Rf=["top","right","bottom","left"],$t=Math.min,st=Math.max,Us=Math.round,ds=Math.floor,rt=e=>({x:e,y:e}),Pf={left:"right",right:"left",bottom:"top",top:"bottom"};function al(e,t,n){return st(e,$t(t,n))}function ht(e,t){return typeof e=="function"?e(t):e}function It(e){return e.split("-")[0]}function vn(e){return e.split("-")[1]}function Vo(e){return e==="x"?"y":"x"}function No(e){return e==="y"?"height":"width"}function _e(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Fo(e){return Vo(_e(e))}function Vf(e,t,n){n===void 0&&(n=!1);const s=vn(e),r=Fo(e),o=No(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 Nf(e){const t=qs(e);return[ro(e),t,ro(t)]}function ro(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Oi=["left","right"],Li=["right","left"],Ff=["top","bottom"],Hf=["bottom","top"];function _f(e,t,n){switch(e){case"top":case"bottom":return n?t?Li:Oi:t?Oi:Li;case"left":case"right":return t?Ff:Hf;default:return[]}}function Bf(e,t,n,s){const r=vn(e);let o=_f(It(e),n==="start",s);return r&&(o=o.map(i=>i+"-"+r),t&&(o=o.concat(o.map(ro)))),o}function qs(e){const t=It(e);return Pf[t]+e.slice(t.length)}function Wf(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 ll(e){return typeof e!="number"?Wf(e):{top:e,right:e,bottom:e,left:e}}function Gs(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 Mi(e,t,n){let{reference:s,floating:r}=e;const o=_e(t),i=Fo(t),a=No(i),c=It(t),l=o==="y",p=s.x+s.width/2-r.width/2,f=s.y+s.height/2-r.height/2,g=s[a]/2-r[a]/2;let u;switch(c){case"top":u={x:p,y:s.y-r.height};break;case"bottom":u={x:p,y:s.y+s.height};break;case"right":u={x:s.x+s.width,y:f};break;case"left":u={x:s.x-r.width,y:f};break;default:u={x:s.x,y:s.y}}const h=vn(t);return h&&(u[i]+=g*(h==="end"?1:-1)*(n&&l?-1:1)),u}async function jf(e,t){var n;t===void 0&&(t={});const{x:s,y:r,platform:o,rects:i,elements:a,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:p="viewport",elementContext:f="floating",altBoundary:g=!1,padding:u=0}=ht(t,e),h=ll(u),m=a[g?f==="floating"?"reference":"floating":f],b=Gs(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(m)))==null||n?m:m.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:l,rootBoundary:p,strategy:c})),I=f==="floating"?{x:s,y:r,width:i.floating.width,height:i.floating.height}:i.reference,M=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),R=await(o.isElement==null?void 0:o.isElement(M))&&await(o.getScale==null?void 0:o.getScale(M))||{x:1,y:1},x=Gs(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:I,offsetParent:M,strategy:c}):I);return{top:(b.top-x.top+h.top)/R.y,bottom:(x.bottom-b.bottom+h.bottom)/R.y,left:(b.left-x.left+h.left)/R.x,right:(x.right-b.right+h.right)/R.x}}const Uf=50,qf=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:o=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:jf},c=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:p,y:f}=Mi(l,s,c),g=s,u=0;const h={};for(let d=0;d<o.length;d++){const m=o[d];if(!m)continue;const{name:b,fn:I}=m,{x:M,y:R,data:x,reset:A}=await I({x:p,y:f,initialPlacement:s,placement:g,strategy:r,middlewareData:h,rects:l,platform:a,elements:{reference:e,floating:t}});p=M??p,f=R??f,h[b]={...h[b],...x},A&&u<Uf&&(u++,typeof A=="object"&&(A.placement&&(g=A.placement),A.rects&&(l=A.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):A.rects),{x:p,y:f}=Mi(l,g,c)),d=-1)}return{x:p,y:f,placement:g,strategy:r,middlewareData:h}},Gf=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:r,rects:o,platform:i,elements:a,middlewareData:c}=t,{element:l,padding:p=0}=ht(e,t)||{};if(l==null)return{};const f=ll(p),g={x:n,y:s},u=Fo(r),h=No(u),d=await i.getDimensions(l),m=u==="y",b=m?"top":"left",I=m?"bottom":"right",M=m?"clientHeight":"clientWidth",R=o.reference[h]+o.reference[u]-g[u]-o.floating[h],x=g[u]-o.reference[u],A=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l));let y=A?A[M]:0;(!y||!await(i.isElement==null?void 0:i.isElement(A)))&&(y=a.floating[M]||o.floating[h]);const E=R/2-x/2,C=y/2-d[h]/2-1,O=$t(f[b],C),w=$t(f[I],C),L=y-d[h]-w,D=y/2-d[h]/2+E,V=al(O,D,L),H=!c.arrow&&vn(r)!=null&&D!==V&&o.reference[h]/2-(D<O?O:w)-d[h]/2<0,K=H?D<O?D-O:D-L:0;return{[u]:g[u]+K,data:{[u]:V,centerOffset:D-V-K,...H&&{alignmentOffset:K}},reset:H}}}),Yf=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:r,middlewareData:o,rects:i,initialPlacement:a,platform:c,elements:l}=t,{mainAxis:p=!0,crossAxis:f=!0,fallbackPlacements:g,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:d=!0,...m}=ht(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const b=It(r),I=_e(a),M=It(a)===a,R=await(c.isRTL==null?void 0:c.isRTL(l.floating)),x=g||(M||!d?[qs(a)]:Nf(a)),A=h!=="none";!g&&A&&x.push(...Bf(a,d,h,R));const y=[a,...x],E=await c.detectOverflow(t,m),C=[];let O=((s=o.flip)==null?void 0:s.overflows)||[];if(p&&C.push(E[b]),f){const V=Vf(r,i,R);C.push(E[V[0]],E[V[1]])}if(O=[...O,{placement:r,overflows:C}],!C.every(V=>V<=0)){var w,L;const V=(((w=o.flip)==null?void 0:w.index)||0)+1,H=y[V];if(H&&(!(f==="alignment"?I!==_e(H):!1)||O.every(Z=>_e(Z.placement)===I?Z.overflows[0]>0:!0)))return{data:{index:V,overflows:O},reset:{placement:H}};let K=(L=O.filter(se=>se.overflows[0]<=0).sort((se,Z)=>se.overflows[1]-Z.overflows[1])[0])==null?void 0:L.placement;if(!K)switch(u){case"bestFit":{var D;const se=(D=O.filter(Z=>{if(A){const z=_e(Z.placement);return z===I||z==="y"}return!0}).map(Z=>[Z.placement,Z.overflows.filter(z=>z>0).reduce((z,xe)=>z+xe,0)]).sort((Z,z)=>Z[1]-z[1])[0])==null?void 0:D[0];se&&(K=se);break}case"initialPlacement":K=a;break}if(r!==K)return{reset:{placement:K}}}return{}}}};function Di(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ri(e){return Rf.some(t=>e[t]>=0)}const Kf=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:r="referenceHidden",...o}=ht(e,t);switch(r){case"referenceHidden":{const i=await s.detectOverflow(t,{...o,elementContext:"reference"}),a=Di(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Ri(a)}}}case"escaped":{const i=await s.detectOverflow(t,{...o,altBoundary:!0}),a=Di(i,n.floating);return{data:{escapedOffsets:a,escaped:Ri(a)}}}default:return{}}}}},cl=new Set(["left","top"]);async function zf(e,t){const{placement:n,platform:s,elements:r}=e,o=await(s.isRTL==null?void 0:s.isRTL(r.floating)),i=It(n),a=vn(n),c=_e(n)==="y",l=cl.has(i)?-1:1,p=o&&c?-1:1,f=ht(t,e);let{mainAxis:g,crossAxis:u,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof h=="number"&&(u=a==="end"?h*-1:h),c?{x:u*p,y:g*l}:{x:g*l,y:u*p}}const Zf=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:r,y:o,placement:i,middlewareData:a}=t,c=await zf(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:r+c.x,y:o+c.y,data:{...c,placement:i}}}}},Jf=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:r,platform:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:c={fn:I=>{let{x:M,y:R}=I;return{x:M,y:R}}},...l}=ht(e,t),p={x:n,y:s},f=await o.detectOverflow(t,l),g=_e(r),u=Vo(g);let h=p[u],d=p[g];const m=(I,M)=>al(M+f[I==="y"?"top":"left"],M,M-f[I==="y"?"bottom":"right"]);i&&(h=m(u,h)),a&&(d=m(g,d));const b=c.fn({...t,[u]:h,[g]:d});return{...b,data:{x:b.x-n,y:b.y-s,enabled:{[u]:i,[g]:a}}}}}},Xf=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,s;const{x:r,y:o,placement:i,rects:a,middlewareData:c}=t,{offset:l=0,mainAxis:p=!0,crossAxis:f=!0}=ht(e,t),g={x:r,y:o},u=_e(i),h=Vo(u);let d=g[h],m=g[u];const b=ht(l,t),I=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:(n=b.mainAxis)!=null?n:0,crossAxis:(s=b.crossAxis)!=null?s:0};if(p){const x=h==="y"?"height":"width",A=a.reference[h]-a.floating[x]+I.mainAxis,y=a.reference[h]+a.reference[x]-I.mainAxis;d<A?d=A:d>y&&(d=y)}if(f){var M,R;const x=h==="y"?"width":"height",A=cl.has(It(i)),y=a.reference[u]-a.floating[x]+(A&&((M=c.offset)==null?void 0:M[u])||0)+(A?0:I.crossAxis),E=a.reference[u]+a.reference[x]+(A?0:((R=c.offset)==null?void 0:R[u])||0)-(A?I.crossAxis:0);m<y?m=y:m>E&&(m=E)}return{[h]:d,[u]:m}}}},Qf=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:s,platform:r,elements:o}=t,{apply:i=()=>{},...a}=ht(e,t),c=await r.detectOverflow(t,a),l=It(n),p=vn(n),f=_e(n)==="y",{width:g,height:u}=s.floating;let h,d;l==="top"||l==="bottom"?(h=l,d=p===(await(r.isRTL==null?void 0:r.isRTL(o.floating))?"start":"end")?"left":"right"):(d=l,h=p==="end"?"top":"bottom");const m=u-c.top-c.bottom,b=g-c.left-c.right,I=$t(u-c[h],m),M=$t(g-c[d],b),R=t.middlewareData.shift,x=!R;let A=I,y=M;R!=null&&R.enabled.x&&(y=b),R!=null&&R.enabled.y&&(A=m),x&&!p&&(f?y=g-2*st(c.left,c.right):A=u-2*st(c.top,c.bottom)),await i({...t,availableWidth:y,availableHeight:A});const E=await r.getDimensions(o.floating);return g!==E.width||u!==E.height?{reset:{rects:!0}}:{}}}};function rr(){return typeof window<"u"}function yn(e){return dl(e)?(e.nodeName||"").toLowerCase():"#document"}function be(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function mt(e){var t;return(t=(dl(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function dl(e){return rr()?e instanceof Node||e instanceof be(e).Node:!1}function qe(e){return rr()?e instanceof Element||e instanceof be(e).Element:!1}function Tt(e){return rr()?e instanceof HTMLElement||e instanceof be(e).HTMLElement:!1}function Pi(e){return!rr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof be(e).ShadowRoot}function or(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=Ge(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&r!=="inline"&&r!=="contents"}function eh(e){return/^(table|td|th)$/.test(yn(e))}function ir(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/,nh=/paint|layout|strict|content/,Ot=e=>!!e&&e!=="none";let Cr;function Ho(e){const t=qe(e)?Ge(e):e;return Ot(t.transform)||Ot(t.translate)||Ot(t.scale)||Ot(t.rotate)||Ot(t.perspective)||!_o()&&(Ot(t.backdropFilter)||Ot(t.filter))||th.test(t.willChange||"")||nh.test(t.contain||"")}function sh(e){let t=Ft(e);for(;Tt(t)&&!Gn(t);){if(Ho(t))return t;if(ir(t))return null;t=Ft(t)}return null}function _o(){return Cr==null&&(Cr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Cr}function Gn(e){return/^(html|body|#document)$/.test(yn(e))}function Ge(e){return be(e).getComputedStyle(e)}function ar(e){return qe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ft(e){if(yn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Pi(e)&&e.host||mt(e);return Pi(t)?t.host:t}function ul(e){const t=Ft(e);return Gn(t)?(e.ownerDocument||e).body:Tt(t)&&or(t)?t:ul(t)}function Yn(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=ul(e),o=r===((s=e.ownerDocument)==null?void 0:s.body),i=be(r);if(o){const a=oo(i);return t.concat(i,i.visualViewport||[],or(r)?r:[],a&&n?Yn(a):[])}else return t.concat(r,Yn(r,[],n))}function oo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function fl(e){const t=Ge(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=Tt(e),o=r?e.offsetWidth:n,i=r?e.offsetHeight:s,a=Us(n)!==o||Us(s)!==i;return a&&(n=o,s=i),{width:n,height:s,$:a}}function Bo(e){return qe(e)?e:e.contextElement}function en(e){const t=Bo(e);if(!Tt(t))return rt(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:o}=fl(t);let i=(o?Us(n.width):n.width)/s,a=(o?Us(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const rh=rt(0);function hl(e){const t=be(e);return!_o()||!t.visualViewport?rh:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function oh(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===be(e)}function Ht(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=Bo(e);let i=rt(1);t&&(s?qe(s)&&(i=en(s)):i=en(e));const a=oh(o,n,s)?hl(o):rt(0);let c=(r.left+a.x)/i.x,l=(r.top+a.y)/i.y,p=r.width/i.x,f=r.height/i.y;if(o&&s){const g=be(o),u=qe(s)?be(s):s;let h=g,d=oo(h);for(;d&&u!==h;){const m=en(d),b=d.getBoundingClientRect(),I=Ge(d),M=b.left+(d.clientLeft+parseFloat(I.paddingLeft))*m.x,R=b.top+(d.clientTop+parseFloat(I.paddingTop))*m.y;c*=m.x,l*=m.y,p*=m.x,f*=m.y,c+=M,l+=R,h=be(d),d=oo(h)}}return Gs({width:p,height:f,x:c,y:l})}function lr(e,t){const n=ar(e).scrollLeft;return t?t.left+n:Ht(mt(e)).left+n}function pl(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-lr(e,n),r=n.top+t.scrollTop;return{x:s,y:r}}function ih(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const o=r==="fixed",i=mt(s),a=t?ir(t.floating):!1;if(s===i||a&&o)return n;let c={scrollLeft:0,scrollTop:0},l=rt(1);const p=rt(0),f=Tt(s);if((f||!o)&&((yn(s)!=="body"||or(i))&&(c=ar(s)),f)){const u=Ht(s);l=en(s),p.x=u.x+s.clientLeft,p.y=u.y+s.clientTop}const g=i&&!f&&!o?pl(i,c):rt(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+p.x+g.x,y:n.y*l.y-c.scrollTop*l.y+p.y+g.y}}function ah(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function lh(e){const t=ar(e),n=e.ownerDocument.body,s=st(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=st(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-t.scrollLeft+lr(e);const i=-t.scrollTop;return Ge(n).direction==="rtl"&&(o+=st(e.clientWidth,n.clientWidth)-s),{width:s,height:r,x:o,y:i}}const ch=25;function dh(e,t,n){n===void 0&&(n="viewport");const s=n==="layoutViewport",r=be(e),o=mt(e),i=r.visualViewport;let a=o.clientWidth,c=o.clientHeight,l=0,p=0;if(i){const g=!_o()||t==="fixed";s?g||(l=-i.offsetLeft,p=-i.offsetTop):(a=i.width,c=i.height,g&&(l=i.offsetLeft,p=i.offsetTop))}if(lr(o)<=0){const g=o.ownerDocument,u=g.body,h=getComputedStyle(u),d=g.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,m=Math.abs(o.clientWidth-u.clientWidth-d),b=getComputedStyle(o).scrollbarGutter==="stable both-edges"?m/2:m;b<=ch&&(a-=b)}return{width:a,height:c,x:l,y:p}}function uh(e,t){const n=Ht(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,o=en(e),i=e.clientWidth*o.x,a=e.clientHeight*o.y,c=r*o.x,l=s*o.y;return{width:i,height:a,x:c,y:l}}function Vi(e,t,n){let s;if(t==="viewport"||t==="layoutViewport")s=dh(e,n,t);else if(t==="document")s=lh(mt(e));else if(qe(t))s=uh(t,n);else{const r=hl(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Gs(s)}function fh(e,t){const n=t.get(e);if(n)return n;let s=Yn(e,[],!1).filter(a=>qe(a)&&yn(a)!=="body"),r=null;const o=Ge(e).position==="fixed";let i=o?Ft(e):e;for(;qe(i)&&!Gn(i);){const a=Ge(i),c=Ho(i),l=r?r.position:o?"fixed":"";!c&&(l==="fixed"||l==="absolute"&&a.position==="static")?s=s.filter(f=>f!==i):r=a,i=Ft(i)}return t.set(e,s),s}function hh(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const i=[...n==="clippingAncestors"?ir(t)?[]:fh(t,this._c):[].concat(n),s],a=Vi(t,i[0],r);let c=a.top,l=a.right,p=a.bottom,f=a.left;for(let g=1;g<i.length;g++){const u=Vi(t,i[g],r);c=st(u.top,c),l=$t(u.right,l),p=$t(u.bottom,p),f=st(u.left,f)}return{width:l-f,height:p-c,x:f,y:c}}function ph(e){const{width:t,height:n}=fl(e);return{width:t,height:n}}function gh(e,t,n){const s=Tt(t),r=mt(t),o=n==="fixed",i=Ht(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const c=rt(0);if((s||!o)&&((yn(t)!=="body"||or(r))&&(a=ar(t)),s)){const g=Ht(t,!0,o,t);c.x=g.x+t.clientLeft,c.y=g.y+t.clientTop}!s&&r&&(c.x=lr(r));const l=r&&!s&&!o?pl(r,a):rt(0),p=i.left+a.scrollLeft-c.x-l.x,f=i.top+a.scrollTop-c.y-l.y;return{x:p,y:f,width:i.width,height:i.height}}function kr(e){return Ge(e).position==="static"}function Ni(e,t){if(!Tt(e)||Ge(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return mt(e)===n&&(n=n.ownerDocument.body),n}function gl(e,t){const n=be(e);if(ir(e))return n;if(!Tt(e)){let r=Ft(e);for(;r&&!Gn(r);){if(qe(r)&&!kr(r))return r;r=Ft(r)}return n}let s=Ni(e,t);for(;s&&eh(s)&&kr(s);)s=Ni(s,t);return s&&Gn(s)&&kr(s)&&!Ho(s)?n:s||sh(e)||n}const mh=async function(e){const t=this.getOffsetParent||gl,n=this.getDimensions,s=await n(e.floating);return{reference:gh(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function vh(e){return Ge(e).direction==="rtl"}const yh={convertOffsetParentRelativeRectToViewportRelativeRect:ih,getDocumentElement:mt,getClippingRect:hh,getOffsetParent:gl,getElementRects:mh,getClientRects:ah,getDimensions:ph,getScale:en,isElement:qe,isRTL:vh};function ml(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function bh(e,t,n){let s=null,r;const o=mt(e);function i(){var p;clearTimeout(r),(p=s)==null||p.disconnect(),s=null}function a(p,f){p===void 0&&(p=!1),f===void 0&&(f=1),i();const g=e.getBoundingClientRect(),{left:u,top:h,width:d,height:m}=g;if(p||t(),!d||!m)return;const b=ds(h),I=ds(o.clientWidth-(u+d)),M=ds(o.clientHeight-(h+m)),R=ds(u),A={rootMargin:-b+"px "+-I+"px "+-M+"px "+-R+"px",threshold:st(0,$t(1,f))||1};let y=!0;function E(C){const O=C[0].intersectionRatio;if(!ml(g,e.getBoundingClientRect()))return a();if(O!==f){if(!y)return a();O?a(!1,O):r=setTimeout(()=>{a(!1,1e-7)},1e3)}y=!1}try{s=new IntersectionObserver(E,{...A,root:o.ownerDocument})}catch{s=new IntersectionObserver(E,A)}s.observe(e)}const c=be(e),l=()=>a(n);return c.addEventListener("resize",l),a(!0),()=>{c.removeEventListener("resize",l),i()}}function wh(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:r=!0,ancestorResize:o=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,l=Bo(e),p=r||o?[...l?Yn(l):[],...t?Yn(t):[]]:[];p.forEach(b=>{r&&b.addEventListener("scroll",n),o&&b.addEventListener("resize",n)});const f=l&&a?bh(l,n,o):null;let g=-1,u=null;i&&(u=new ResizeObserver(b=>{let[I]=b;I&&I.target===l&&u&&t&&(u.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var M;(M=u)==null||M.observe(t)})),n()}),l&&!c&&u.observe(l),t&&u.observe(t));let h,d=c?Ht(e):null;c&&m();function m(){const b=Ht(e);d&&!ml(d,b)&&n(),d=b,h=requestAnimationFrame(m)}return n(),()=>{var b;p.forEach(I=>{r&&I.removeEventListener("scroll",n),o&&I.removeEventListener("resize",n)}),f?.(),(b=u)==null||b.disconnect(),u=null,c&&cancelAnimationFrame(h)}}const Eh=Zf,xh=Jf,Sh=Yf,$h=Qf,Ih=Kf,Th=Gf,Ch=Xf,kh=(e,t,n)=>{const s=new Map,r=n??{},o={...yh,...r.platform,_c:s};return qf(e,t,{...r,platform:o})};function Fi(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 Ah(e){if(!e)return Fi();const{x:t,y:n,width:s,height:r}=e;return Fi(t,n,s,r)}function Oh(e,t){return{contextElement:ce(e)?e:e?.contextElement,getBoundingClientRect:()=>{const n=e,s=t?.(n);return s||!n?Ah(s):n.getBoundingClientRect()}}}var Cn=e=>({variable:e,reference:`var(${e})`}),Xe={arrowSize:Cn("--arrow-size"),arrowSizeHalf:Cn("--arrow-size-half"),arrowBg:Cn("--arrow-background"),transformOrigin:Cn("--transform-origin"),arrowOffset:Cn("--arrow-offset")},Lh=e=>e==="top"||e==="bottom"?"y":"x";function Mh(e,t){return{name:"transformOrigin",fn(n){const{elements:s,middlewareData:r,placement:o,rects:i,y:a}=n,c=o.split("-")[0],l=Lh(c),p=r.arrow?.x||0,f=r.arrow?.y||0,g=t?.clientWidth||0,u=t?.clientHeight||0,h=p+g/2,d=f+u/2,m=Math.abs(r.shift?.y||0),b=i.reference.height/2,I=u/2,M=e.offset?.mainAxis??e.gutter,R=typeof M=="number"?M+I:M??I,x=m>R,A={top:`${h}px calc(100% + ${R}px)`,bottom:`${h}px ${-R}px`,left:`calc(100% + ${R}px) ${d}px`,right:`${-R}px ${d}px`}[c],y=`${h}px ${i.reference.y+b-a}px`,E=!!e.overlap&&l==="y"&&x;return s.floating.style.setProperty(Xe.transformOrigin.variable,E?y:A),{data:{transformOrigin:E?y:A}}}}}var Dh={name:"rects",fn({rects:e}){return{data:e}}},Rh=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% + ${Xe.arrowOffset.reference})`}),{}}}};function Ph(e){const[t,n]=e.split("-");return{side:t,align:n,hasAlign:n!=null}}function vl(e){return e.split("-")[0]}var Vh={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 Hi(e,t){const n=e.devicePixelRatio||1;return Math.round(t*n)/n}function Qt(e,t){return e!=null&&Math.abs(e-t)<.5}function cr(e){return typeof e=="function"?e():e==="clipping-ancestors"?"clippingAncestors":e}function Nh(e,t,n){const s=e||t.createElement("div");return Th({element:s,padding:n.arrowPadding})}function Fh(e,t){if(!Nd(t.offset??t.gutter))return Eh(({placement:n})=>{const s=(e?.clientHeight||0)/2,r=t.offset?.mainAxis??t.gutter,o=typeof r=="number"?r+s:r??s,{hasAlign:i}=Ph(n),a=i?void 0:t.shift,c=t.offset?.crossAxis??a;return Co({crossAxis:c,mainAxis:o,alignmentAxis:t.shift})})}function Hh(e){if(e.flip)return Sh(()=>{const t=cr(e.boundary);return{...t?{boundary:t}:void 0,padding:e.overflowPadding,fallbackPlacements:e.flip===!0?void 0:e.flip}})}function _h(e){if(!(!e.slide&&!e.overlap))return xh(()=>{const t=cr(e.boundary);return{...t?{boundary:t}:void 0,mainAxis:e.slide,crossAxis:e.overlap,padding:e.overflowPadding,limiter:Ch()}})}function Bh(e){if(e.sizeMiddleware===!1&&!e.sameWidth&&!e.fitViewport)return;let t,n,s,r;return $h(()=>{const o=cr(e.boundary);return{padding:e.overflowPadding,...o?{boundary:o}:void 0,apply({elements:i,rects:a,availableHeight:c,availableWidth:l}){const p=i.floating,f=Math.round(a.reference.width),g=Math.round(a.reference.height);l=Math.floor(l),c=Math.floor(c),Qt(t,f)||(p.style.setProperty("--reference-width",`${f}px`),t=f),Qt(n,g)||(p.style.setProperty("--reference-height",`${g}px`),n=g),Qt(s,l)||(p.style.setProperty("--available-width",`${l}px`),s=l),Qt(r,c)||(p.style.setProperty("--available-height",`${c}px`),r=c)}}})}function Wh(e){if(e.hideWhenDetached)return Ih(()=>({strategy:"referenceHidden",boundary:cr(e.boundary)??"clippingAncestors"}))}function jh(e){return e?e===!0?{ancestorResize:!0,ancestorScroll:!0,elementResize:!0,layoutShift:!0}:e:{}}var Uh=["transform","visibility","pointer-events","--x","--y","--z-index","z-index","--reference-width","--reference-height","--available-width","--available-height","--transform-origin"],qh=["top","right","bottom","left"],Fn=new WeakSet;function Gh(e,t){const n=e.style.getPropertyValue("z-index"),s=Fn.has(e),r=s&&n==="var(--z-index)";s&&!r&&Fn.delete(e);const o=Za(t).zIndex;if(o==="auto"){r&&(e.style.removeProperty("z-index"),Fn.delete(e));return}n&&!r||(e.style.setProperty("--z-index",o),e.style.setProperty("z-index","var(--z-index)"),Fn.add(e))}function _i(e,t){if(!e)return _a;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 Bi(e){return e==null?null:ce(e)?e:typeof e=="object"&&e&&"contextElement"in e&&e.contextElement?e.contextElement:e}function Yh(e,t,n={}){const s=()=>(typeof t=="function"?t():t)??null,r=()=>{const O=typeof e=="function"?e():e;return n.getAnchorElement?.()??O},o=()=>{const O=r();return!O&&!n.getAnchorRect?null:Oh(O,n.getAnchorRect)},i=Object.assign({},Vh,n);let a=[],c=null,l,p;function f(O){if(l?.(),p?.(),c=O,i.restoreStyles){const L=_i(O,Uh);l=()=>{L(),Fn.delete(O)}}else l=void 0;const w=O.querySelector("[data-part=arrow]");p=i.restoreStyles?_i(w,qh):void 0,a=[Fh(w,i),Hh(i),_h(i),Nh(w,O.ownerDocument,i),Rh(w),Mh({gutter:i.gutter,offset:i.offset,overlap:i.overlap},w),Bh(i),Wh(i),Dh]}const{placement:g,strategy:u,onComplete:h,onPositioned:d}=i;let m,b,I=!1,M,R,x=_a;const A=jh(i.listeners);function y(){if(!i.listeners)return;const O=r(),w=o(),L=s();if(!w||!L)return;(Bi(O)!==Bi(M)||L!==R)&&(x(),M=O,R=L,x=wh(w,L,C,A))}async function E(){y();const O=s();if(!O)return;O!==c&&(f(O),I=!1);const w=o();if(!w)return;const L=await kh(w,O,{placement:g,middleware:a,strategy:u}),D=he(O),V=Hi(D,L.x),H=Hi(D,L.y);if(h?.({...L,x:V,y:H}),i.applyStyles!==!1&&(Qt(m,V)||(O.style.setProperty("--x",`${V}px`),m=V),Qt(b,H)||(O.style.setProperty("--y",`${H}px`),b=H),i.hideWhenDetached&&(L.middlewareData.hide?.referenceHidden?(O.style.setProperty("visibility","hidden"),O.style.setProperty("pointer-events","none")):(O.style.removeProperty("visibility"),O.style.removeProperty("pointer-events"))),!I)){const K=O.firstElementChild;K&&(Gh(O,K),I=!0)}}async function C(){n.updatePosition?(await n.updatePosition({updatePosition:E,floatingElement:s()}),d?.({placed:!0})):await E()}return C(),()=>{x(),p?.(),l?.(),d?.({placed:!1})}}function io(e,t,n={}){const{defer:s,...r}=n,o=s?fe:a=>a(),i=[];return i.push(o(()=>{i.push(Yh(e,t,r))})),()=>{i.forEach(a=>a?.())}}var Kh={bottom:"rotate(45deg)",left:"rotate(135deg)",top:"rotate(225deg)",right:"rotate(315deg)"};function yl(e={}){const{placement:t,sameWidth:n,fitViewport:s,strategy:r="absolute",applyStyles:o=!0}=e;return{arrow:{position:"absolute",width:Xe.arrowSize.reference,height:Xe.arrowSize.reference,[Xe.arrowSizeHalf.variable]:`calc(${Xe.arrowSize.reference} / 2)`,[Xe.arrowOffset.variable]:`calc(${Xe.arrowSizeHalf.reference} * -1)`},arrowTip:{transform:t?Kh[t.split("-")[0]]:void 0,background:Xe.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 zh=e=>e.ids?.root??`select:${e.id}`,ao=e=>e.ids?.content??`select:${e.id}:content`,lo=e=>e.ids?.trigger??`select:${e.id}:trigger`,bl=e=>e.ids?.clearTrigger??`select:${e.id}:clear-trigger`,us=e=>e.ids?.label??`select:${e.id}:label`,Zh=e=>e.ids?.control??`select:${e.id}:control`,co=(e,t)=>e.ids?.item?.(t)??`select:${e.id}:option:${t}`,uo=e=>e.ids?.hiddenSelect??`select:${e.id}:select`,wl=e=>e.ids?.positioner??`select:${e.id}:positioner`,Jh=(e,t)=>e.ids?.itemGroup?.(t)??`select:${e.id}:optgroup:${t}`,Wi=(e,t)=>e.ids?.itemGroupLabel?.(t)??`select:${e.id}:optgroup-label:${t}`,Ar=e=>e.getById(uo(e)),kn=e=>e.getById(ao(e)),Rt=e=>e.getById(lo(e)),Xh=e=>e.getById(bl(e)),Or=e=>e.getById(wl(e)),Lr=(e,t)=>t==null?null:e.getById(co(e,t)),Qh={clearTriggerLabel:"Clear value"};function ep(e,t){const{context:n,prop:s,scope:r,state:o,computed:i,send:a}=e,c=Wa(Qh,s("translations")),l=s("disabled")||n.get("fieldsetDisabled"),p=!!s("invalid"),f=!!s("required"),g=!!s("readOnly"),u=s("composite"),h=s("collection"),d=o.hasTag("open"),m=o.matches("focused"),b=n.get("highlightedValue"),I=n.get("highlightedItem"),M=i("selectedItems"),R=n.get("currentPlacement"),x=R?vl(R):void 0,A=i("isTypingAhead"),y=i("isInteractive"),E=b?co(r,b):void 0;function C(w){const L=h.getItemDisabled(w.item),D=h.getItemValue(w.item);return Qs(D,()=>`[zag-js] No value found for item ${JSON.stringify(w.item)}`),{value:D,disabled:!!(l||L),highlighted:b===D,selected:n.get("value").includes(D)}}const O=yl({...s("positioning"),placement:R});return{open:d,focused:m,empty:n.get("value").length===0,highlightedItem:I,highlightedValue:b,selectedItems:M,hasSelectedItems:i("hasSelectedItems"),value:n.get("value"),valueAsString:i("valueAsString"),collection:h,multiple:!!s("multiple"),disabled:!!l,reposition(w={}){a({type:"POSITIONING.SET",options:w})},focus(){Rt(r)?.focus({preventScroll:!0})},setOpen(w){a({type:w?"OPEN":"CLOSE",replaces:"open"})},selectValue(w){a({type:"ITEM.SELECT",value:w})},setValue(w){a({type:"VALUE.SET",value:w})},selectAll(){a({type:"VALUE.SET",value:h.getValues()})},setHighlightValue(w){a({type:"HIGHLIGHTED_VALUE.SET",value:w})},clearHighlightValue(){a({type:"HIGHLIGHTED_VALUE.CLEAR"})},clearValue(w){a(w?{type:"ITEM.CLEAR",value:w}:{type:"VALUE.CLEAR"})},getItemState:C,getRootProps(){return t.element({...pe.root.attrs,dir:s("dir"),id:zh(r),"data-invalid":P(p),"data-readonly":P(g)})},getLabelProps(){return t.label({dir:s("dir"),id:us(r),...pe.label.attrs,"data-disabled":P(l),"data-invalid":P(p),"data-readonly":P(g),"data-required":P(f),htmlFor:uo(r),onClick(w){w.defaultPrevented||l||Rt(r)?.focus({preventScroll:!0})}})},getControlProps(){return t.element({...pe.control.attrs,dir:s("dir"),id:Zh(r),"data-state":d?"open":"closed","data-focus":P(m),"data-disabled":P(l),"data-invalid":P(p)})},getValueTextProps(){return t.element({...pe.valueText.attrs,dir:s("dir"),"data-disabled":P(l),"data-invalid":P(p),"data-focus":P(m)})},getTriggerProps(){return t.button({id:lo(r),disabled:l,dir:s("dir"),type:"button",role:"combobox","aria-controls":ao(r),"aria-expanded":d,"aria-haspopup":"listbox","data-state":d?"open":"closed","aria-invalid":p,"aria-required":f,"aria-labelledby":us(r),...pe.trigger.attrs,"data-disabled":P(l),"data-invalid":P(p),"data-readonly":P(g),"data-placement":R,"data-side":x,"data-placeholder-shown":P(!i("hasSelectedItems")),onClick(w){y&&(w.defaultPrevented||a({type:"TRIGGER.CLICK"}))},onFocus(){a({type:"TRIGGER.FOCUS"})},onBlur(){a({type:"TRIGGER.BLUR"})},onKeyDown(w){if(w.defaultPrevented||!y)return;const D={ArrowUp(){a({type:"TRIGGER.ARROW_UP"})},ArrowDown(V){a({type:V.altKey?"OPEN":"TRIGGER.ARROW_DOWN"})},ArrowLeft(){a({type:"TRIGGER.ARROW_LEFT"})},ArrowRight(){a({type:"TRIGGER.ARROW_RIGHT"})},Home(){a({type:"TRIGGER.HOME"})},End(){a({type:"TRIGGER.END"})},Enter(){a({type:"TRIGGER.ENTER"})},Space(V){a(A?{type:"TRIGGER.TYPEAHEAD",key:V.key}:{type:"TRIGGER.ENTER"})}}[Jr(w,{dir:s("dir"),orientation:"vertical"})];if(D){D(w),w.preventDefault();return}eo.isValidEvent(w)&&(a({type:"TRIGGER.TYPEAHEAD",key:w.key}),w.preventDefault())}})},getIndicatorProps(){return t.element({...pe.indicator.attrs,dir:s("dir"),"aria-hidden":!0,"data-state":d?"open":"closed","data-disabled":P(l),"data-invalid":P(p),"data-readonly":P(g)})},getItemProps(w){const L=C(w);return t.element({id:co(r,L.value),role:"option",...pe.item.attrs,dir:s("dir"),"data-value":L.value,"aria-selected":L.selected,"data-state":L.selected?"checked":"unchecked","data-highlighted":P(L.highlighted),"data-disabled":P(L.disabled),"aria-disabled":ue(L.disabled),onPointerMove(D){L.disabled||D.pointerType!=="mouse"||so()==="pointer"&&L.value!==b&&a({type:"ITEM.POINTER_MOVE",value:L.value})},onClick(D){D.defaultPrevented||L.disabled||a({type:"ITEM.CLICK",src:"pointerup",value:L.value})},onPointerLeave(D){L.disabled||w.persistFocus||D.pointerType==="mouse"&&so()==="pointer"&&a({type:"ITEM.POINTER_LEAVE"})}})},getItemTextProps(w){const L=C(w);return t.element({...pe.itemText.attrs,"data-state":L.selected?"checked":"unchecked","data-disabled":P(L.disabled),"data-highlighted":P(L.highlighted)})},getItemIndicatorProps(w){const L=C(w);return t.element({"aria-hidden":!0,...pe.itemIndicator.attrs,"data-state":L.selected?"checked":"unchecked",hidden:!L.selected})},getItemGroupLabelProps(w){const{htmlFor:L}=w;return t.element({...pe.itemGroupLabel.attrs,id:Wi(r,L),dir:s("dir"),role:"presentation"})},getItemGroupProps(w){const{id:L}=w;return t.element({...pe.itemGroup.attrs,"data-disabled":P(l),id:Jh(r,L),"aria-labelledby":Wi(r,L),role:"group",dir:s("dir")})},getClearTriggerProps(){return t.button({...pe.clearTrigger.attrs,id:bl(r),type:"button","aria-label":c.clearTriggerLabel,"data-invalid":P(p),disabled:l,hidden:!i("hasSelectedItems"),dir:s("dir"),onClick(w){w.defaultPrevented||a({type:"CLEAR.CLICK"})}})},getHiddenSelectProps(){const w=n.get("value"),L=s("multiple")?w:w?.[0],D=V=>{const H=Mo(V);Qa(H)||a({type:"VALUE.SET",value:tp(V.currentTarget)})};return t.select({name:s("name"),form:s("form"),disabled:l,multiple:s("multiple"),required:s("required"),"aria-hidden":!0,id:uo(r),defaultValue:L,style:vf,tabIndex:-1,autoComplete:s("autoComplete"),onChange:D,onInput:D,onFocus(){Rt(r)?.focus({preventScroll:!0})},"aria-labelledby":us(r)})},getPositionerProps(){return t.element({...pe.positioner.attrs,dir:s("dir"),id:wl(r),style:O.floating})},getContentProps(){return t.element({hidden:!d,dir:s("dir"),id:ao(r),role:u?"listbox":"dialog",...pe.content.attrs,"data-state":d?"open":"closed","data-placement":R,"data-side":x,"data-activedescendant":E,"aria-activedescendant":u?E:void 0,"aria-multiselectable":s("multiple")&&u?!0:void 0,"aria-labelledby":us(r),tabIndex:0,onKeyDown(w){if(!y||!an(w.currentTarget,ut(w)))return;if(w.key==="Tab"&&!qu(w)){w.preventDefault();return}const L={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){A?a({type:"CONTENT.TYPEAHEAD",key:H.key}):L.Enter?.()}},D=L[Jr(w)];if(D){D(w),w.preventDefault();return}const V=ut(w);iu(V)||eo.isValidEvent(w)&&(a({type:"CONTENT.TYPEAHEAD",key:w.key}),w.preventDefault())}})},getListProps(){return t.element({...pe.list.attrs,tabIndex:0,role:u?void 0:"listbox","aria-labelledby":lo(r),"aria-activedescendant":u?void 0:E,"aria-multiselectable":!u&&s("multiple")?!0:void 0})}}}var tp=e=>e.multiple?Array.from(e.selectedOptions,t=>t.value):e.value?[e.value]:[];function np(e,t,n){let s=[],r;return o=>{const i=e(o);return(i.length!==s.length||i.some((c,l)=>!mn(s[l],c)))&&(s=i,r=t(i,o)),r}}function sp(){const e=new Map;return{claim(t){const n=Symbol(t);return e.set(t,n),n},isReplaced(t,n){return e.get(t)!==n}}}var Ct=".",El="#",ji=new WeakMap,xl=new WeakMap;function fo(e){return e.join(Ct)}function rp(e){return e.includes(Ct)}function Sl(e){return e.startsWith(El)}function op(e){return e.startsWith(Ct)}function ip(e){return Sl(e)?e.slice(El.length):e}function ho(e,t){return e?`${e}${Ct}${t}`:t}function ap(e){const t=new Map,n=new Map,s=(r,o)=>{t.set(r,o);const i=o.id;i&&(n.has(i)&&Si(`[zag-js] Duplicate state id: "${i}"`),n.set(i,r));const a=o.states;if(a){Qs(o.initial,()=>`[zag-js] Compound state "${r}" has child states but no "initial" property`),o.initial in a||Si(`[zag-js] Compound state "${r}" has initial "${String(o.initial)}" which is not a child state`);for(const[c,l]of Object.entries(a)){if(!l)continue;const p=ho(r,c);s(p,l)}}};for(const[r,o]of Object.entries(e.states))o&&s(r,o);return{index:t,idIndex:n}}function Xn(e){const t=ji.get(e);if(t)return t;const{index:n,idIndex:s}=ap(e);return ji.set(e,n),xl.set(e,s),n}function lp(e,t){return Xn(e),xl.get(e)?.get(t)}function Wo(e){return e?String(e).split(Ct).filter(Boolean):[]}function Ys(e,t){if(!t)return[];const n=Xn(e),s=Wo(t),r=[],o=[];for(const i of s){o.push(i);const a=fo(o),c=n.get(a);if(!c)break;r.push({path:a,state:c})}return r}function An(e,t){const n=Xn(e),s=Wo(t);if(!s.length)return t;const r=[];for(const a of s){r.push(a);const c=fo(r);if(!n.has(c))return t}let o=fo(r),i=n.get(o);for(;i?.initial;){const a=`${o}${Ct}${i.initial}`,c=n.get(a);if(!c)break;o=a,i=c}return o}function Ui(e,t){return Xn(e).has(t)}function qi(e,t,n){const s=String(t);if(Sl(s)){const r=ip(s),o=lp(e,r);return Qs(o,()=>`[zag-js] Unknown state id: "${r}"`),An(e,o)}if(op(s)&&n){const r=ho(n,s.slice(1));return An(e,r)}if(!rp(s)&&n){const r=Wo(n);for(let o=r.length-1;o>=1;o--){const i=r.slice(0,o).join(Ct),a=ho(i,s);if(Ui(e,a))return An(e,a)}if(Ui(e,s))return An(e,s)}return An(e,s)}function cp(e,t,n){const s=Ys(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 dp(e,t,n,s){const r=t?Ys(e,t):[],o=Ys(e,n);let i=0;for(;i<r.length&&i<o.length&&r[i]?.path===o[i]?.path;)i+=1;let a=r.slice(i).reverse(),c=o.slice(i);const l=r[r.length-1]?.path===o[o.length-1]?.path;return s&&l&&(a=r.slice().reverse(),c=o),{exiting:a,entering:c}}function up(e,t){return e?e===t||e.startsWith(`${t}${Ct}`):!1}function fp(e,t,n){return Ys(e,t).some(s=>s.state.tags?.includes(n))}function $l(){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 Il(e){return Xn(e),e}var Hn=(e=>(e.NotStarted="Not Started",e.Started="Started",e.Stopped="Stopped",e))(Hn||{}),fs="__init__";function hp(e){const t=()=>e.getRootNode?.()??document,n=()=>Le(t());return{...e,getRootNode:t,getDoc:n,getWin:()=>n().defaultView??window,getActiveElement:()=>tr(t()),isActiveElement:Zr,getById:i=>t().getElementById(i)}}function pp(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 gp(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 Gi="pointerdown.outside",Yi="focus.outside";function mp(e){for(const t of e)if(ce(t)&&nr(t))return!0;return!1}var Tl=e=>"clientY"in e;function vp(e,t){if(!Tl(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 yp(e,t){return e.y<=t.y&&t.y<=e.y+e.height&&e.x<=t.x&&t.x<=e.x+e.width}function Ki(e,t){if(!t||!Tl(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 yp(i,a)?s||o:!1}function bp(e,t){const{exclude:n,onFocusOutside:s,onPointerDownOutside:r,onInteractOutside:o,defer:i,followControlledElements:a=!0}=t;if(!e)return;const c=Le(e),l=he(e),p=pp(l),f=gp(l);function g(x,A){if(!ce(A)||!A.isConnected||an(e,A)||vp(e,x)||a&&Su(e,A))return!1;const y=c.querySelector(`[aria-controls="${e.id}"]`);if(y){const C=Xr(y);if(Ki(x,C))return!1}const E=Xr(e);return Ki(x,E)?!1:!n?.(A)}const u=new Set,h=on(e?.getRootNode());let d=!1;function m(x){d=!0;const A=()=>{d=!1};c.addEventListener("pointerup",A,{once:!0}),l.addEventListener("pointerup",A,{once:!0});function y(E){const C=i&&!Ii()?fe:L=>L(),O=E??x,w=O?.composedPath?.()??[O?.target];C(()=>{const L=h?w[0]:ut(x);if(!(!e||!g(x,L))){if(r||o){const D=Hs(r,o);e.addEventListener(Gi,D,{once:!0})}zi(e,Gi,{bubbles:!1,cancelable:!0,detail:{originalEvent:O,contextmenu:Cu(O),focusable:mp(w),target:L}})}})}x.pointerType==="touch"?(u.forEach(E=>E()),u.add(Os(c,"click",y,{once:!0})),u.add(f.addEventListener("click",y,{once:!0})),u.add(p.addEventListener("click",y,{once:!0}))):y()}const b=new Set,I=setTimeout(()=>{b.add(Os(c,"pointerdown",m,!0)),b.add(f.addEventListener("pointerdown",m,!0)),b.add(p.addEventListener("pointerdown",m,!0))},0),M=el.create();function R(x){if(d)return;(i?y=>M.request(y):y=>y())(()=>{const y=x?.composedPath?.()??[x?.target],E=h?y[0]:ut(x);if(!(!e||!g(x,E))){if(s||o){const C=Hs(s,o);e.addEventListener(Yi,C,{once:!0})}zi(e,Yi,{bubbles:!1,cancelable:!0,detail:{originalEvent:x,contextmenu:!1,focusable:nr(E),target:E}})}})}return Ii()||(b.add(Os(c,"focusin",R,!0)),b.add(f.addEventListener("focusin",R,!0)),b.add(p.addEventListener("focusin",R,!0))),()=>{clearTimeout(I),M.cancel(),u.forEach(x=>x()),b.forEach(x=>x())}}function wp(e,t){const{defer:n}=t,s=n?fe:o=>o(),r=[];return r.push(s(()=>{const o=typeof e=="function"?e():e;r.push(bp(o,t))})),()=>{r.forEach(o=>o?.())}}function zi(e,t,n){const s=e.ownerDocument.defaultView||window,r=new s.CustomEvent(t,n);return e.dispatchEvent(r)}function Ep(e,t){const n=s=>{s.key==="Escape"&&(s.isComposing||t?.(s))};return Os(Le(e),"keydown",n,{capture:!0})}var Zi="layer:request-dismiss",ye={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=>an(s.node,t))||this.recentlyRemoved.size>0)},isInBranch(e){return Array.from(this.branches).some(t=>an(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&&xp(r)}),this.recentlyRemoved.add(e),nl(()=>this.recentlyRemoved.delete(e)),t<this.count()-1&&this.getNestedLayers(e).forEach(r=>ye.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)=>{Ji(e,t,e.node),e.styleTargets?.forEach(n=>{const s=n();if(!s||s===e.node)return;Ji(e,t,s);const{zIndex:r}=Za(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];$p(e,Zi,r=>{s.requestDismiss?.(r),r.defaultPrevented||s?.dismiss()}),Sp(e,Zi,{originalLayer:e,targetLayer:t,originalIndex:n,targetIndex:t?this.indexOf(t):-1}),this.syncLayers()},clear(){this.remove(this.layers[0].node)}};function Ji(e,t,n){n.style.setProperty("--layer-index",`${t}`),n.removeAttribute("data-nested"),n.removeAttribute("data-has-nested"),ye.getParentLayerOfType(e.node,e.type)&&n.setAttribute("data-nested",e.type);const r=ye.countNestedLayersOfType(e.node,e.type);r>0&&n.setAttribute("data-has-nested",e.type),n.style.setProperty("--nested-layer-count",`${r}`)}function xp(e){e.style.removeProperty("--layer-index"),e.style.removeProperty("--nested-layer-count"),e.removeAttribute("data-nested"),e.removeAttribute("data-has-nested")}function Sp(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 $p(e,t,n){e.addEventListener(t,n,{once:!0})}var Mr=new WeakMap,Un=new WeakMap;function Ip(e){return ye.isBelowPointerBlockingLayer(e)?"none":"auto"}function Cl(e){const t=Ip(e);e.style.pointerEvents!==t&&(e.style.pointerEvents=t)}function Tp(e){if(Un.has(e))return;const t=he(e);if(typeof t.MutationObserver>"u")return;const n=new t.MutationObserver(()=>{Un.has(e)&&Cl(e)});n.observe(e,{attributes:!0,attributeFilter:["style"]}),Un.set(e,n)}function Xi(){ye.layers.forEach(({node:e})=>{Cl(e),Tp(e)})}function Cp(e){const t=Un.get(e);t&&(t.disconnect(),Un.delete(e)),e.style.pointerEvents=""}function kp(e,t){const n=Le(e),s=[];return ye.hasPointerBlockingLayer()&&!n.body.hasAttribute("data-inert")&&(Mr.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]=bf(()=>{const a=r();return ce(a)?a:null},{timeout:1e3});o.then(a=>s.push(hf(a,{pointerEvents:"auto"}))),s.push(i)}),()=>{ye.hasPointerBlockingLayer()||(queueMicrotask(()=>{const r=n.body;if(!r)return;const o=Mr.get(r);o!==void 0&&(r.style.pointerEvents=o,Mr.delete(r)),r.removeAttribute("data-inert"),r.style.length===0&&r.removeAttribute("style")}),s.forEach(r=>r()))}}function Ap(e,t){const{onDismiss:n,onRequestDismiss:s,pointerBlocking:r,exclude:o,debug:i,type:a="dialog",layerStyleTargets:c}=t,l={dismiss:n,node:e,type:a,pointerBlocking:r,requestDismiss:s,styleTargets:c};ye.add(l),Xi();function p(d){const m=ut(d.detail.originalEvent);ye.isBelowPointerBlockingLayer(e)||ye.isInBranch(m)||(t.onPointerDownOutside?.(d),t.onInteractOutside?.(d),!d.defaultPrevented&&(i&&console.log("onPointerDownOutside:",d.detail.originalEvent),n?.(d)))}function f(d){const m=ut(d.detail.originalEvent);ye.isInBranch(m)||(t.onFocusOutside?.(d),t.onInteractOutside?.(d),!d.defaultPrevented&&(i&&console.log("onFocusOutside:",d.detail.originalEvent),n?.(d)))}function g(d){ye.isTopMost(e)&&(t.onEscapeKeyDown?.(d),!d.defaultPrevented&&n&&(d.preventDefault(),n(d)))}function u(d){const m=typeof o=="function"?o():o,b=Array.isArray(m)?m:[m],I=t.persistentElements?.map(M=>M()).filter(ce);return I&&b.push(...I),b.some(M=>an(M,d))||ye.isInNestedLayer(e,d)}const h=[r?kp(e,t.persistentElements):void 0,Ep(e,g),wp(e,{exclude:u,onFocusOutside:f,onPointerDownOutside:p,defer:t.defer})];return()=>{ye.remove(e),Xi(),Cp(e),h.forEach(d=>d?.())}}function kl(e,t){const{warnOnMissingNode:n=!0}=t;return Ef(e,s=>Ap(s,t),{defer:t.defer,getRootNode:t.getRootNode,onMissing:n?()=>ks("[@zag-js/dismissable] node is `null` or `undefined`"):void 0})}var{and:On,not:Lt,or:Op}=$l(),Lp=Il({props({props:e}){return{loopFocus:!1,closeOnSelect:!e.multiple,composite:!0,defaultValue:[],...e,collection:e.collection??_s.empty(),positioning:{placement:"bottom-start",gutter:8,...e.positioning}}},context({prop:e,bindable:t,getContext:n}){const s=e("value")??e("defaultValue")??[],r=e("collection").findMany(s);return{value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:mn,onChange(o){const i=n(),a=e("collection"),c=i.get("selectedItemMap"),l=ls({values:o,collection:a,selectedItemMap:c}),p=e("value")??o,f=p===o?l:ls({values:p,collection:a,selectedItemMap:l.nextSelectedItemMap});return i.set("selectedItemMap",f.nextSelectedItemMap),e("onValueChange")?.({value:o,items:l.selectedItems})}})),highlightedValue:t(()=>({defaultValue:e("defaultHighlightedValue")||null,value:e("highlightedValue"),onChange(o){e("onHighlightChange")?.({highlightedValue:o,highlightedItem:e("collection").find(o),highlightedIndex:e("collection").indexOf(o)})}})),currentPlacement:t(()=>({defaultValue:void 0})),fieldsetDisabled:t(()=>({defaultValue:!1})),highlightedItem:t(()=>({defaultValue:null})),selectedItemMap:t(()=>({defaultValue:zd({selectedItems:r,collection:e("collection")})}))}},refs(){return{typeahead:{...eo.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})=>qa({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:Op("isTriggerArrowDownEvent","isTriggerEnterEvent"),target:"open",actions:["setInitialFocus","highlightComputedFirstItem"]},{target:"open",actions:["setInitialFocus"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen"]}],"TRIGGER.BLUR":{target:"idle"},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightFirstSelectedItem"]}],"TRIGGER.ENTER":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedFirstItem"]}],"TRIGGER.ARROW_UP":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedLastItem"]}],"TRIGGER.ARROW_DOWN":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["setInitialFocus","invokeOnOpen","highlightComputedFirstItem"]}],"TRIGGER.ARROW_LEFT":[{guard:On(Lt("multiple"),"hasSelectedItems"),actions:["selectPreviousItem"]},{guard:Lt("multiple"),actions:["selectLastItem"]}],"TRIGGER.ARROW_RIGHT":[{guard:On(Lt("multiple"),"hasSelectedItems"),actions:["selectNextItem"]},{guard:Lt("multiple"),actions:["selectFirstItem"]}],"TRIGGER.HOME":{guard:Lt("multiple"),actions:["selectFirstItem"]},"TRIGGER.END":{guard:Lt("multiple"),actions:["selectLastItem"]},"TRIGGER.TYPEAHEAD":{guard:Lt("multiple"),actions:["selectMatchingItem"]}}},open:{tags:["open"],exit:["scrollContentToTop"],effects:["trackDismissableElement","trackFocusVisible","computePlacement","scrollToHighlightedItem"],on:{"CONTROLLED.CLOSE":[{guard:"restoreFocus",target:"focused",actions:["focusTriggerEl","clearHighlightedItem"]},{target:"idle",actions:["clearHighlightedItem"]}],CLOSE:[{guard:"isOpenControlled",actions:["invokeOnClose"]},{guard:"restoreFocus",target:"focused",actions:["invokeOnClose","focusTriggerEl","clearHighlightedItem"]},{target:"idle",actions:["invokeOnClose","clearHighlightedItem"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose","clearHighlightedItem"]}],"ITEM.CLICK":[{guard:On("closeOnSelect","isOpenControlled"),actions:["selectHighlightedItem","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectHighlightedItem","invokeOnClose","focusTriggerEl","clearHighlightedItem"]},{actions:["selectHighlightedItem"]}],"CONTENT.HOME":{actions:["highlightFirstItem"]},"CONTENT.END":{actions:["highlightLastItem"]},"CONTENT.ARROW_DOWN":[{guard:On("hasHighlightedItem","loop","isLastItemHighlighted"),actions:["highlightFirstItem"]},{guard:"hasHighlightedItem",actions:["highlightNextItem"]},{actions:["highlightFirstItem"]}],"CONTENT.ARROW_UP":[{guard:On("hasHighlightedItem","loop","isFirstItemHighlighted"),actions:["highlightLastItem"]},{guard:"hasHighlightedItem",actions:["highlightPreviousItem"]},{actions:["highlightLastItem"]}],"CONTENT.TYPEAHEAD":{actions:["highlightMatchingItem"]},"ITEM.POINTER_MOVE":{actions:["highlightItem"]},"ITEM.POINTER_LEAVE":{actions:["clearHighlightedItem"]},"POSITIONING.SET":{actions:["reposition"]}}}},implementations:{guards:{loop:({prop:e})=>!!e("loopFocus"),multiple:({prop:e})=>!!e("multiple"),hasSelectedItems:({computed:e})=>!!e("hasSelectedItems"),hasHighlightedItem:({context:e})=>e.get("highlightedValue")!=null,isFirstItemHighlighted:({context:e,prop:t})=>e.get("highlightedValue")===t("collection").firstValue,isLastItemHighlighted:({context:e,prop:t})=>e.get("highlightedValue")===t("collection").lastValue,closeOnSelect:({prop:e,event:t})=>!!(t.closeOnSelect??e("closeOnSelect")),restoreFocus:({event:e})=>Qi(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 Df({root:e.getRootNode?.()})},trackFormControlState({context:e,scope:t}){return Ru(Ar(t),{onFieldsetDisabledChange(n){e.set("fieldsetDisabled",n)},onFormReset(){const n=e.initial("value");e.set("value",n)}})},trackDismissableElement({scope:e,send:t,prop:n}){const s=()=>kn(e);let r=!0;return kl(s,{type:"listbox",defer:!0,getRootNode:e.getRootNode,layerStyleTargets:[()=>Or(e)],exclude:[Rt(e),Xh(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),io(()=>Rt(n),()=>Or(n),{defer:!0,...s,onComplete(i){e.set("currentPlacement",i.placement)}})},scrollToHighlightedItem({context:e,prop:t,scope:n}){const s=a=>{const c=e.get("highlightedValue");if(c==null||so()==="pointer")return;const p=kn(n),f=t("scrollToIndexFn");if(f){const u=t("collection").indexOf(c);f?.({index:u,immediate:a,getElement:()=>Lr(n,c)});return}const g=Lr(n,c);af(g,{rootEl:p,block:"nearest"})},r=fe(()=>{Mf("virtual"),s(!0)}),i=zu(()=>kn(n),{attributes:["data-activedescendant"],callback(){s(!1)}});return()=>{r(),i()}}},actions:{reposition({context:e,prop:t,scope:n,event:s}){const r=()=>Or(n);io(Rt(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}){fe(()=>{const t=Uu({root:kn(e)});t&&t.focus({preventScroll:!0})})},focusTriggerEl({event:e,scope:t}){if(!Qi(e))return;const n=Mp(e);fe(()=>{Rt(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")?bi(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")?bi(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:()=>Lr(t,n)})}else kn(t)?.scrollTo(0,0)},invokeOnOpen({prop:e,context:t}){e("onOpenChange")?.({open:!0,value:t.get("value")})},invokeOnClose({prop:e,context:t}){e("onOpenChange")?.({open:!1,value:t.get("value")})},syncSelectElement({context:e,prop:t,scope:n}){const s=Ar(n);if(s){if(e.get("value").length===0&&!t("multiple")){s.selectedIndex=-1;return}for(const r of s.options)r.selected=e.get("value").includes(r.value)}},syncCollection({context:e,prop:t}){const n=t("collection"),s=n.find(e.get("highlightedValue"));s&&e.set("highlightedItem",s);const r=ls({values:e.get("value"),collection:n,selectedItemMap:e.get("selectedItemMap")});e.set("selectedItemMap",r.nextSelectedItemMap)},syncSelectedItems({context:e,prop:t}){const n=ls({values:e.get("value"),collection:t("collection"),selectedItemMap:e.get("selectedItemMap")});e.set("selectedItemMap",n.nextSelectedItemMap)},syncHighlightedItem({context:e,prop:t}){const n=t("collection"),s=e.get("highlightedValue"),r=s?n.find(s):null;e.set("highlightedItem",r)},dispatchChangeEvent({scope:e}){queueMicrotask(()=>{const t=Ar(e);if(!t)return;const n=e.getWin(),s=new n.Event("change",{bubbles:!0,composed:!0});t.dispatchEvent(Pu(s))})}}}});function Qi(e){const t=e.restoreFocus??e.previousEvent?.restoreFocus;return t==null||!!t}function Mp(e){return e.focusVisible??e.previousEvent?.focusVisible?{preventScroll:!0,focusVisible:!0}:{preventScroll:!0}}function Dp(e){return new Proxy({},{get(t,n){return n==="style"?s=>e({style:s}).style:e}})}var Rp=Object.defineProperty,Pp=(e,t,n)=>t in e?Rp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U=(e,t,n)=>Pp(e,typeof t!="symbol"?t+"":t,n),ea={onFocus:"onFocusin",onBlur:"onFocusout",onChange:"onInput",onDoubleClick:"onDblclick",htmlFor:"for",className:"class",defaultValue:"value",defaultChecked:"checked"},Vp=new Set(["viewBox","preserveAspectRatio"]),Al=Dp(e=>Object.entries(e).reduce((t,[n,s])=>{if(s===void 0)return t;n in ea&&(n=ea[n]);const r=Vp.has(n)?n:n.toLowerCase();return t[r]=s,t},{})),hs=new WeakMap,ta=new Set(["value","checked","selected"]),Np=new Set(["viewBox","preserveAspectRatio","clipPath","clipRule","fillRule","strokeWidth","strokeLinecap","strokeLinejoin","strokeDasharray","strokeDashoffset","strokeMiterlimit"]),Fp=e=>e.tagName==="svg"||e.namespaceURI==="http://www.w3.org/2000/svg",ps=(e,t)=>Fp(e)&&Np.has(t)?t:t.toLowerCase(),Dr=e=>e.startsWith("--")?e:e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),na=(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(Dr(r));for(const r in n){const o=n[r];o==null?s.removeProperty(Dr(r)):s.setProperty(Dr(r),String(o))}}};function ne(e,t,n){const s="default";let r=hs.get(e);r||(r=new Map,hs.set(e,r));const o=r.get(s)||{},i=Object.keys(t),a=(d,m)=>{e.addEventListener(d.toLowerCase(),m)},c=(d,m)=>{e.removeEventListener(d.toLowerCase(),m)},l=d=>d.startsWith("on"),p=d=>!d.startsWith("on"),f=d=>a(d.substring(2),t[d]),g=d=>c(d.substring(2),t[d]),u=d=>{const m=t[d],b=o[d];if(m!==b){if(d==="class"){e.className=m??"";return}if(d==="style"){na(e,b,m);return}if(ta.has(d)){e[d]=m??"";return}if(typeof m=="boolean"&&!d.includes("aria-")){e.toggleAttribute(ps(e,d),m);return}if(d==="children"){e.innerHTML=m;return}if(m!=null){e.setAttribute(ps(e,d),m);return}e.removeAttribute(ps(e,d))}};for(const d in o)t[d]==null&&(d==="class"?e.className="":d==="style"?na(e,o[d],void 0):ta.has(d)?e[d]="":e.removeAttribute(ps(e,d)));return Object.keys(o).filter(l).forEach(d=>{c(d.substring(2),o[d])}),i.filter(l).forEach(f),i.filter(p).forEach(u),r.set(s,t),function(){i.filter(l).forEach(g);const m=hs.get(e);m&&(m.delete(s),m.size===0&&hs.delete(e))}}function Hp(){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 Ol(e,t){const n=Hp();return n?(n[e]||(n[e]=t()),n[e]):t()}var Ms=Ol("__zag__refSet",()=>new WeakSet),_p=e=>typeof e=="object"&&e!==null&&"$$typeof"in e&&"props"in e,Bp=e=>typeof e=="object"&&e!==null&&"__v_isVNode"in e,Wp=e=>typeof e=="object"&&e!==null&&"nodeType"in e&&typeof e.nodeName=="string",jp=e=>_p(e)||Bp(e)||Wp(e),po=e=>e!==null&&typeof e=="object",sa=e=>po(e)&&!Ms.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!jp(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 Up=Symbol(),ra=Object.getPrototypeOf,go=new WeakMap,qp=e=>e&&(go.has(e)?go.get(e):ra(e)===Object.prototype||ra(e)===Array.prototype),Gp=e=>qp(e)&&e[Up]||null,oa=(e,t=!0)=>{go.set(e,t)};var Dt=Ol("__zag__proxyStateMap",()=>new WeakMap),Yp=(e=Object.is,t=(a,c)=>new Proxy(a,c),n=new WeakMap,s=(a,c)=>{const l=n.get(a);if(l?.[0]===c)return l[1];const p=Array.isArray(a)?[]:Object.create(Object.getPrototypeOf(a));return oa(p,!0),n.set(a,[c,p]),Reflect.ownKeys(a).forEach(f=>{const g=Reflect.get(a,f);Ms.has(g)?(oa(g,!1),p[f]=g):Dt.has(g)?p[f]=zp(g):p[f]=g}),Object.freeze(p)},r=new WeakMap,o=[1,1],i=a=>{if(!po(a))throw new Error("object required");const c=r.get(a);if(c)return c;let l=o[0];const p=new Set,f=(y,E=++o[0])=>{l!==E&&(l=E,p.forEach(C=>C(y,E)))};let g=o[1];const u=(y=++o[1])=>(g!==y&&!p.size&&(g=y,d.forEach(([E])=>{const C=E[1](y);C>l&&(l=C)})),l),h=y=>(E,C)=>{const O=[...E];O[1]=[y,...O[1]],f(O,C)},d=new Map,m=(y,E)=>{if(p.size){const C=E[3](h(y));d.set(y,[E,C])}else d.set(y,[E])},b=y=>{const E=d.get(y);E&&(d.delete(y),E[1]?.())},I=y=>(p.add(y),p.size===1&&d.forEach(([C,O],w)=>{const L=C[3](h(w));d.set(w,[C,L])}),()=>{p.delete(y),p.size===0&&d.forEach(([C,O],w)=>{O&&(O(),d.set(w,[C]))})}),M=Array.isArray(a)?[]:Object.create(Object.getPrototypeOf(a)),x=t(M,{deleteProperty(y,E){const C=Reflect.get(y,E);b(E);const O=Reflect.deleteProperty(y,E);return O&&f(["delete",[E],C]),O},set(y,E,C,O){const w=Reflect.has(y,E),L=Reflect.get(y,E,O);if(w&&(e(L,C)||r.has(C)&&e(L,r.get(C))))return!0;b(E),po(C)&&(C=Gp(C)||C);let D=C;if(!Object.getOwnPropertyDescriptor(y,E)?.set){!Dt.has(C)&&sa(C)&&(D=Ll(C));const V=!Ms.has(D)&&Dt.get(D);V&&m(E,V)}return Reflect.set(y,E,D,O),f(["set",[E],C,L]),!0}});r.set(a,x);const A=[M,u,s,I];return Dt.set(x,A),Reflect.ownKeys(a).forEach(y=>{const E=Object.getOwnPropertyDescriptor(a,y);E.get||E.set?Object.defineProperty(M,y,E):x[y]=a[y]}),x})=>[i,Dt,Ms,e,t,sa,n,s,r,o],[Kp]=Yp();function Ll(e={}){return Kp(e)}function ia(e,t,n){const s=Dt.get(e);let r;const o=[],i=s[3];let a=!1;const l=i(p=>{o.push(p),r||(r=Promise.resolve().then(()=>{r=void 0,a&&t(o.splice(0))}))});return a=!0,()=>{a=!1,l()}}function zp(e){const t=Dt.get(e),[n,s,r]=t;return r(n,s())}function Ks(e){const t=e().value??e().defaultValue;e().debug&&console.log(`[bindable > ${e().debug}] initial`,t);const n=e().isEqual??Object.is,s=Ll({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=Je(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)}}}Ks.cleanup=e=>{};Ks.ref=e=>{let t=e;return{get:()=>t,set:n=>{t=n}}};function Zp(e){const t={current:e};return{get(n){return t.current[n]},set(n,s){t.current[n]=s}}}var{defineProperty:Jp,getOwnPropertyDescriptor:Xp,getOwnPropertyDescriptors:aa}=Object;function _n(e,t){if(Object.is(e,t))return e;if(!Nn(e)||!Nn(t))return t===void 0?e:t;let n=e;const s=(r,o)=>{n===e&&(n=Object.defineProperties({},aa(e))),Jp(n,r,o)};for(const[r,o]of Object.entries(aa(t))){if(!o.enumerable)continue;if(o.get){s(r,o);continue}const i=o.value;if(i===void 0)continue;const a=!!Xp(e,r)?.get,c=e[r],l=Nn(c)&&Nn(i)?_n(c,i):i;!a&&Object.is(c,l)||s(r,{value:l,writable:!0,enumerable:!0,configurable:!0})}return n}var Ml=class{constructor(e,t={}){U(this,"machine",e),U(this,"scope"),U(this,"context"),U(this,"prop"),U(this,"state"),U(this,"refs"),U(this,"computed"),U(this,"event",{type:""}),U(this,"previousEvent",{type:""}),U(this,"effects",new Map),U(this,"replaceTracker",sp()),U(this,"transition",null),U(this,"cleanups",[]),U(this,"subscriptions",[]),U(this,"userProps"),U(this,"userPropsSources",[]),U(this,"getUserProps",()=>{let f=this.userProps;for(const g of this.userPropsSources){const u=xi(g);f=f?_n(f,u):u}return f}),U(this,"getEvent",()=>({...this.event,current:()=>this.event,previous:()=>this.previousEvent})),U(this,"getState",()=>({...this.state,matches:(...f)=>f.some(g=>up(this.state.get(),g)),hasTag:f=>fp(this.machine,this.state.get(),f)})),U(this,"debug",(...f)=>{this.machine.debug&&console.log(...f)}),U(this,"notify",()=>{this.publish()}),U(this,"send",f=>{if(this.status!==Hn.Started)return;const g=f?.replaces,u=g?this.replaceTracker.claim(g):void 0;queueMicrotask(()=>{if(!f||g&&u&&this.replaceTracker.isReplaced(g,u))return;this.previousEvent=this.event,this.event=f,this.debug("send",f);let h=this.state.get();const d=f.type,{transitions:m,source:b}=cp(this.machine,h,d),I=this.choose(m);if(!I)return;this.transition=I;const M=qi(this.machine,I.target??h,b);this.debug("transition",I),M!==h?this.state.set(M):I.reenter?this.state.invoke(h,h):this.action(I.actions)})}),U(this,"action",f=>{const g=Je(f)?f(this.getParams()):f;if(!g)return;const u=g.map(h=>{const d=this.machine.implementations?.actions?.[h];return d||ks(`[zag-js] No implementation found for action "${JSON.stringify(h)}"`),d});for(const h of u)h?.(this.getParams())}),U(this,"guard",f=>{if(Je(f))return f(this.getParams());const g=this.machine.implementations?.guards?.[f];return g||ks(`[zag-js] No implementation found for guard "${JSON.stringify(f)}"`),g?.(this.getParams())}),U(this,"effect",f=>{const g=Je(f)?f(this.getParams()):f;if(!g)return;const u=g.map(d=>{const m=this.machine.implementations?.effects?.[d];return m||ks(`[zag-js] No implementation found for effect "${JSON.stringify(d)}"`),m}),h=[];for(const d of u){const m=d?.(this.getParams());m&&h.push(m)}return()=>h.forEach(d=>d?.())}),U(this,"choose",f=>Ad(f).find(g=>{let u=!g.guard;return Vd(g.guard)?u=!!this.guard(g.guard):Je(g.guard)&&(u=g.guard(this.getParams())),u})),U(this,"subscribe",f=>(this.subscriptions.push(f),()=>{const g=this.subscriptions.indexOf(f);g>-1&&this.subscriptions.splice(g,1)})),U(this,"status",Hn.NotStarted),U(this,"publish",()=>{this.callTrackers(),this.subscriptions.forEach(f=>f(this.service))}),U(this,"trackers",[]),U(this,"setupTrackers",()=>{this.machine.watch?.(this.getParams())}),U(this,"callTrackers",()=>{this.trackers.forEach(({deps:f,fn:g})=>{const u=f.map(h=>h());mn(g.prev,u)||(g(),g.prev=u)})}),U(this,"getParams",()=>({state:this.getState(),context:this.context,event:this.getEvent(),prop:this.prop,send:this.send,action:this.action,guard:this.guard,track:(f,g)=>{g.prev=f.map(u=>u()),this.trackers.push({deps:f,fn:g})},refs:this.refs,computed:this.computed,flush:jd,scope:this.scope,choose:this.choose})),Je(t)?this.userPropsSources.push(t):this.userProps=t;const{id:n,ids:s,getRootNode:r}=xi(t);this.scope=hp({id:n,ids:s,getRootNode:r});const o=f=>{const g=this.getUserProps();return(e.props?.({props:Co(g),scope:this.scope})??g)[f]};this.prop=o;const i=e.context?.({prop:o,bindable:Ks,scope:this.scope,flush(f){queueMicrotask(f)},getContext(){return a},getComputed(){return c},getRefs(){return l},getEvent:this.getEvent.bind(this)});i&&Object.values(i).forEach(f=>{const g=ia(f.ref,()=>this.notify());this.cleanups.push(g)});const a={get(f){return i?.[f].get()},set(f,g){i?.[f].set(g)},initial(f){return i?.[f].initial},hash(f){const g=i?.[f].get();return i?.[f].hash(g)}};this.context=a;const c=f=>(Qs(e.computed,()=>"[zag-js] No computed object found on machine"),e.computed[f]({context:a,event:this.getEvent(),prop:o,refs:this.refs,scope:this.scope,computed:c}));this.computed=c;const l=Zp(e.refs?.({prop:o,context:a})??{});this.refs=l;const p=Ks(()=>({defaultValue:qi(e,e.initialState({prop:o})),onChange:(f,g)=>{const{exiting:u,entering:h}=dp(this.machine,g,f,this.transition?.reenter);if(u.forEach(d=>{this.effects.get(d.path)?.(),this.effects.delete(d.path)}),u.forEach(d=>{this.action(d.state?.exit)}),this.action(this.transition?.actions),h.forEach(d=>{const m=this.effect(d.state?.effects);if(m){const b=this.effects.get(d.path);this.effects.set(d.path,b?Hs(b,m):m)}}),g===fs){this.action(e.entry);const d=this.effect(e.effects);if(d){const m=this.effects.get(fs);this.effects.set(fs,m?Hs(m,d):d)}}h.forEach(d=>{this.action(d.state?.entry)})}}));this.state=p,this.cleanups.push(ia(this.state.ref,()=>this.notify()))}updateProps(e){const t=this.userPropsSources;if(Je(e))t.push(e);else if(t.length===0)this.userProps=_n(this.userProps,e);else{const n=t.length-1,s=t[n];if(Je(s)){const r=_n({},e);r&&Object.keys(r).length>0&&t.push(r)}else t[n]=_n(s,e)}this.notify()}start(){this.status=Hn.Started,this.debug("initializing..."),this.state.invoke(this.state.initial,fs),this.setupTrackers()}stop(){this.effects.forEach(e=>e?.()),this.effects.clear(),this.transition=null,this.action(this.machine.exit),this.cleanups.forEach(e=>e()),this.cleanups=[],this.subscriptions=[],this.status=Hn.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 Qp='<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m4 6 4 4 4-4"/></svg>',wt=new Map;let eg=0;function tg(e){const t=document.createElement("span");t.className="ui-select",t.innerHTML=`<button type="button" class="ui-select-trigger"><span></span>${Qp}</button><div class="ui-select-positioner" popover="manual"><div class="ui-select-menu"></div></div>`,e.after(t),e.hidden=!0;const n=t.querySelector("button"),s=n.querySelector("span"),r=t.querySelector(".ui-select-positioner"),o=t.querySelector(".ui-select-menu");let i=[],a="",c=e.value,l=e.disabled;const p=new Ml(Lp,{id:`select-${++eg}`,collection:_s({items:i}),defaultValue:[c],disabled:l,positioning:{placement:"bottom-start",strategy:"fixed",sameWidth:!0,gutter:6},onValueChange({value:d}){e.value!==d[0]&&(c=e.value=d[0]??"",e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})))}}),f=()=>ep(p.service,Al);function g(){const d=f();ne(t,d.getRootProps()),ne(n,{...d.getTriggerProps(),"aria-label":e.getAttribute("aria-label")||e.labels?.[0]?.textContent?.trim(),"aria-labelledby":void 0}),ne(r,d.getPositionerProps()),ne(o,{...d.getContentProps(),"aria-label":e.getAttribute("aria-label"),"aria-labelledby":void 0});const m=e.selectedOptions[0]?.textContent||"Choose…";s.textContent!==m&&(s.textContent=m),i.forEach((b,I)=>{const M=o.children[I];ne(M,d.getItemProps({item:b}))}),r.hidden=!d.open,d.open&&!r.matches(":popover-open")&&r.showPopover?.(),!d.open&&r.matches(":popover-open")&&r.hidePopover?.()}function u(){const d=Array.from(e.options,b=>({value:b.value,label:b.text,disabled:b.disabled})),m=JSON.stringify(d);m!==a&&(a=m,i=d,o.replaceChildren(...i.map(b=>{const I=document.createElement("div");return I.className="ui-select-option",I.textContent=b.label,I})),p.updateProps({collection:_s({items:i})})),c!==e.value&&(c=e.value,f().setValue([c])),l!==e.disabled&&(l=e.disabled,p.updateProps({disabled:l})),g()}t.addEventListener("keydown",d=>d.stopPropagation()),e.addEventListener("change",u);const h=p.subscribe(g);return p.start(),u(),{sync:u,focus:()=>n.focus(),dispose(){e.removeEventListener("change",u),h(),p.stop(),t.remove(),e.hidden=!1}}}function ln(e=document){for(const[t,n]of wt)t.isConnected||(n.dispose(),wt.delete(t));for(const t of e.querySelectorAll("select:not([data-native])"))wt.has(t)?wt.get(t).sync():wt.set(t,tg(t))}function ng(e){ln(e.parentElement),wt.get(e)?.focus()}function sg(){const e=new MutationObserver(t=>{t.some(n=>n.target instanceof Element&&(n.target.matches("select, option")||[...n.addedNodes,...n.removedNodes].some(s=>s instanceof Element&&(s.matches("select")||s.querySelector("select")))))&&ln()});return e.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["disabled"]}),ln(),()=>{e.disconnect();for(const t of wt.values())t.dispose();wt.clear()}}function rg(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
|
-
${Vn.map(w=>`<option value="${w.id}">${w.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=w=>t.querySelector(w),o=r("select"),i=r(".launch-directory"),a=r(".launch-web-link"),c=r(".launch-command"),l=r(".launch-terminal"),p=r(".launch-copy"),f=r(".launch-status");let g,u=0,h=0,d,m,b,I,M,R=null;function x(){h++,m?.abort(),clearTimeout(M),b=void 0,c.value="",l.disabled=p.disabled=!0,r(".launch-summary").hidden=!0,r(".launch-availability").textContent=""}function A(){t.close(),u++,d?.abort(),x(),e(),R?.focus({preventScroll:!0})}async function y(w){try{await navigator.clipboard.writeText(w),f.textContent="Command copied."}catch{f.textContent=`Copy this command: ${w}`,w===c.value&&(c.focus(),c.select())}}function E(){if(a.hidden=!0,a.removeAttribute("href"),g&&I?.webBaseUrl)try{a.href=$d(I.webBaseUrl,g.nativeID||g.id),a.hidden=!1}catch{}f.textContent=I?a.hidden?"OpenCode is unavailable. Choose another app to use the saved conversation.":"":"Finding OpenCode…"}function C(w){const L=Vn.find(D=>D.id===o.value)?.name||je(o.value);c.value=w.command,p.disabled=!1,l.disabled=!w.terminalAvailable,l.textContent=`${w.mode==="resume"?"Resume in":"Open in"} ${L} ↗`,r(".launch-summary").hidden=!1,r(".launch-mode").textContent=w.mode==="resume"?"Resume original session":"New session · saved context",r(".launch-hint").textContent=w.mode==="resume"?`Continue this conversation in ${L}.`:`${L} will read the saved conversation, recap where you left off, and ask what to do next.${w.context?.partial?" Some history is missing or shortened.":""}`,r(".launch-context").hidden=!w.context,r(".launch-coverage").textContent=w.context?.note||"",r(".launch-context-path").textContent=w.context?.path||"",r(".launch-availability").textContent=w.targetAvailable?w.terminalAvailable?"":"Automatic terminal opening is unavailable. Run the copied command in your terminal.":`${L} CLI was not found. Install it, then run the copied command.`,f.textContent=""}async function O(){if(x(),!g||!t.open)return;const w=o.value==="web";if(r(".launch-web").hidden=!w,r(".launch-cli").hidden=w,w){E();return}if(!br(o.value))return;const L=h;m=new AbortController,f.textContent="Preparing command…";try{const D=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 D.json();if(!D.ok)throw new Error(V.error||"Could not prepare this session.");if(h!==L)return;b=V,C(b)}catch(D){h===L&&(c.placeholder="Command unavailable",f.textContent=D instanceof Error?D.message:"Could not prepare this session.")}}return o.addEventListener("change",()=>{try{localStorage.setItem("sessiongraph.open-target",o.value)}catch{}O()},s),i.addEventListener("input",()=>{x(),f.textContent="Checking working directory…",M=setTimeout(()=>{O()},300)},s),i.addEventListener("change",()=>{O()},s),r(".dialog-close").addEventListener("click",A,s),t.addEventListener("cancel",w=>{w.preventDefault(),A()},s),t.addEventListener("keydown",w=>{w.stopPropagation()},s),p.addEventListener("click",()=>{b&&y(b.command)},s),r(".launch-copy-pair").addEventListener("click",()=>{y("opencode pair")},s),l.addEventListener("click",async()=>{if(!g||!b||l.disabled)return;const w=u;l.disabled=o.disabled=i.disabled=!0,f.textContent="Opening Terminal…";try{const L=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:b.directory})}),D=await L.json();if(!L.ok)throw new Error(D.error||"Could not open Terminal.");u===w&&(f.textContent="Session sent to Terminal.")}catch(L){u===w&&(f.textContent=L instanceof Error?L.message:"Could not open Terminal. Copy the command instead.")}finally{u===w&&(o.disabled=i.disabled=!1,l.disabled=!b?.terminalAvailable)}},s),{async open(w){g=w;const L=++u;d?.abort(),d=new AbortController,I=void 0,x(),t.open||(R=document.activeElement),r(".launch-title").textContent=`${je(w.source)} · ${w.title}`,i.value=w.directory,i.disabled=o.disabled=!1,o.value=br(w.source)?w.source:"opencode";const D=(!w.source||w.source==="opencode")&&Na(w.nativeID||w.id);o.querySelector('[value="web"]').disabled=!D;for(const V of Vn)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");(br(V)||V==="web"&&D)&&(o.value=V)}catch{}c.placeholder="Preparing command…",r(".launch-context").open=!1,t.open||t.showModal(),e(),ng(o),O();try{const V=await fetch(`/api/sessiongraph/session/${encodeURIComponent(w.id)}/connection`,{signal:d.signal});if(!V.ok)throw new Error("Connection unavailable");const H=await V.json();if(u!==L)return;I=H;for(const K of Vn){const se=H.targets.some(Z=>Z.id===K.id&&Z.available);o.querySelector(`[value="${K.id}"]`).textContent=`${K.name}${se?"":" · CLI not found"}`}o.value==="web"&&E()}catch{u===L&&o.value==="web"&&(f.textContent="OpenCode is unavailable. Choose another app to use the saved conversation.")}},dispose(){u++,d?.abort(),x(),n.abort(),t.remove()}}}const Ln=e=>e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]);function og(e,t){const n=document.createElement("dialog");n.className="imports-dialog",n.setAttribute("aria-labelledby","imports-heading"),n.innerHTML='<button class="icon-button dialog-close" aria-label="Close sources">×</button><span class="eyebrow">SessionGraph</span><h2 id="imports-heading">Explore & 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(n);const s=x=>n.querySelector(x);let r=!1,o=0,i=!1,a=null,c=!1,l=!1,p=!1;const f=new AbortController;let g=!1,u=0,h;async function d(x,A){const y=await fetch(`/api/sessiongraph/${x}`,{...A,signal:AbortSignal.any([f.signal,AbortSignal.timeout(3e4)])}),E=await y.json();if(y.status===409&&x==="import"&&A?.method==="POST")return d("import");if(!y.ok)throw new Error(E.error||"Import unavailable.");return E}function m(x){r=x.running,s(".import-start").disabled=r,n.querySelectorAll("input").forEach(y=>{y.disabled=r}),s(".imports-progress").textContent=r?`${je(x.source)} · ${x.imported.toLocaleString()} imported · ${x.unchanged.toLocaleString()} unchanged${x.discovered?` / ${x.discovered.toLocaleString()} found`:" · discovering…"}`:`${x.imported.toLocaleString()} imported · ${x.unchanged.toLocaleString()} already up to date${x.failed?` · ${x.failed} unavailable`:""}`,s(".import-start").textContent=r?"Importing…":"Import updates ↗",s(".imports-notes").hidden=!x.errors.length;const A=new Map;x.errors.forEach(y=>A.set(y,(A.get(y)||0)+1)),s(".imports-notes div").innerHTML=[...A].map(([y,E])=>`<p>${Ln(y)}${E>1?` (${E} occurrences)`:""}</p>`).join(""),document.dispatchEvent(new CustomEvent("sessiongraph-import-status",{detail:x}))}async function b(){if(!(i||l)){o=0,l=!0;try{const x=await d("import");if(i)return;if(m(x),x.running)o=window.setTimeout(b,1e3);else{const A=h;h=void 0,await e(p),!i&&A===u&&n.open&&!x.failed&&!x.errors.length&&n.close()}}catch(x){I(x)}finally{l=!1}}}function I(x){if(i)return;h=void 0;const A=x instanceof Error?x.message:"Import unavailable.";m({running:!1,discovered:0,imported:0,unchanged:0,failed:1,errors:[A]}),s(".imports-progress").textContent=A}async function M(x,A=!1){if(!(i||A&&n.open)){if(r||c||l||o){!A&&!n.open&&R();return}c=!0,p=A,r=!0,s(".import-start").disabled=!0,h=g&&n.open&&x!==void 0?u:void 0;try{const y=await d("import",{method:"POST",headers:{"Content-Type":"application/json","X-SessionGraph-Action":"import"},body:JSON.stringify(A?{automatic:!0}:{sources:x})});if(i)return;m(y),window.clearTimeout(o),o=window.setTimeout(b,100)}catch(y){I(y)}finally{c=!1}}}async function R(x=!1){g=x,u++,a=document.activeElement,s("#imports-heading").textContent=x?"Explore & visualize all your LLM sessions":"Your session sources.",n.open||n.showModal(),t(),s(".import-sources").textContent="Finding local session sources…";try{const A=await d("sources");s(".import-sources").innerHTML=A.sources.map(E=>`<label class="import-source" data-source="${Ln(E.id)}"><input type="checkbox" value="${Ln(E.id)}" ${E.selected||x&&E.available?"checked":""} ${r?"disabled":""}/><span class="source-symbol">${Ue(E.id)}</span><span><strong>${Ln(E.name)}</strong><small>${Ln(E.description)}</small><small class="source-imported">${E.sessions?`${E.sessions.toLocaleString()} saved · `:""}${E.lastImport?`Last import ${new Date(E.lastImport).toLocaleString()}`:"Not imported yet"}</small></span><span class="source-detected ${E.available?"detected":""}">${E.available?"Detected":"Not found"}</span></label>`).join("");const y=await d("import");y.running?(m(y),window.clearTimeout(o),o=window.setTimeout(b,1e3)):x||m(y)}catch(A){s(".import-sources").textContent=A instanceof Error?A.message:"Could not detect sources."}}return s(".import-start").addEventListener("click",()=>{M([...n.querySelectorAll("input:checked")].map(x=>x.value))}),s(".dialog-close").addEventListener("click",()=>n.close()),n.addEventListener("close",()=>{u++,h=void 0,t(),a?.focus()}),n.addEventListener("keydown",x=>x.stopPropagation()),{open:R,sources:async()=>(await d("sources")).sources,select:x=>M(x),get busy(){return r||c||l||!!o},refresh:(x=!1)=>M(void 0,x),resume:()=>{p=!0,r=!0,window.clearTimeout(o),b()},dispose:()=>{i=!0,f.abort(),window.clearTimeout(o),n.remove()}}}const ig=6e4,ag=3e4;class lg{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<ag)){this.checking=!0,this.activity();try{await this.options.refresh()}finally{this.checking=!1}}}dispose(){this.disposed=!0}}class cg{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 dg=Object.freeze({sourceID:"",projectID:"",directory:"",days:90,fromDate:"",toDate:"",includeChildren:!0,includeArchived:!0}),ug=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 fg(e){const t={...dg};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"])ug(n[s])&&(t[s]=n[s]);return t.fromDate&&t.toDate&&t.fromDate>t.toDate&&(t.fromDate="",t.toDate=""),t}const dr=Object.freeze({autoImport:!0,muted:!1,clickSounds:!0,clickVolume:35,motion:"system",view:"3d",density:"comfortable",panelOpacity:90,quality:"balanced",bloom:32,stars:!0,labels:!0,nodeScale:100,focusDimming:!0,trails:"all",trailOpacity:34,trailFlow:!1,trailSpeed:25,relationships:!0,messageDots:!0,playbackSpeed:1}),jo="sessiongraph.preferences",la={motion:["system","on","off"],view:["3d","2d"],density:["comfortable","compact"],quality:["performance","balanced","high"],trails:["all","selected","off"]},ca={clickVolume:[0,100],panelOpacity:[55,100],bloom:[0,75],nodeScale:[60,180],trailOpacity:[0,100],trailSpeed:[10,100],playbackSpeed:[.25,3]};function ur(e){const t={...dr};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 la)la[s].includes(r)&&Object.assign(t,{[s]:r});else if(s in ca){const[o,i]=ca[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 Dl(e){try{const t=JSON.parse(e.getItem(jo)||e.getItem("session-atlas.preferences")||"null");return ur(t?.version===1?t.values:void 0)}catch{return{...dr}}}function Rl(e,t){try{return e.setItem(jo,JSON.stringify({version:1,values:ur(t)})),!0}catch{return!1}}const mo=(e,t)=>e.motion==="on"||e.motion==="system"&&!t,ze=[["interface","Interface",od],["sources","Sources",Kc],["audio","Sound",Pa],["graphics","Graphics",Ra],["trails","Trails & playback",sd],["privacy","Privacy",td]],gs=e=>e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]),Ze=(e,t,n)=>`<label class="setting-row"><span><strong>${t}</strong><small>${n}</small></span><input type="checkbox" role="switch" data-pref="${e}" aria-label="${t}"/></label>`,Mt=(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>`,Mn=(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 hg(e){const t=document.createElement("dialog");t.className="settings-dialog",t.setAttribute("aria-labelledby","settings-title"),t.innerHTML=`<header class="settings-heading"><div><h2 id="settings-title">Settings</h2><p>Import, appearance, and playback preferences.</p></div><button class="icon-button settings-close" aria-label="Close settings">×</button></header>
|
|
30
|
-
<div class="settings-layout"><nav class="settings-tabs" role="tablist" aria-label="Settings categories">${ze.map(([u,h,d],m)=>`<button role="tab" id="settings-tab-${u}" aria-controls="settings-${u}" aria-selected="${!m}" tabindex="${m?-1:0}" data-tab="${u}">${Da([d[0],{...d[1],"aria-hidden":"true","stroke-width":1.5},d[2]]).outerHTML}${h}</button>`).join("")}</nav>
|
|
31
|
-
<div class="settings-content">
|
|
32
|
-
<section id="settings-interface" role="tabpanel" aria-labelledby="settings-tab-interface"><h3>Interface</h3><p class="settings-description">View preferences and filters are saved with your library.</p>
|
|
33
|
-
${Mn("view","Default view","Switch between depth and a flat timeline.",[["3d","3D galaxy"],["2d","2D timeline"]])}
|
|
34
|
-
${Mn("motion","Motion","Camera transitions, reveals, and ambient movement.",[["system","Follow system"],["on","On"],["off","Off"]])}
|
|
35
|
-
${Mn("density","Session list","Adjust spacing between sessions.",[["comfortable","Comfortable"],["compact","Compact"]])}
|
|
36
|
-
${Mt("panelOpacity","Panel opacity","Adjust panel background transparency.",55,100)}
|
|
37
|
-
<div class="settings-note"><span>Restore the default panel layout.</span><button class="secondary-button settings-reset-panels">Reset panel positions</button></div>
|
|
38
|
-
</section>
|
|
39
|
-
<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>
|
|
40
|
-
${Ze("autoImport","Auto-import sessions","Check selected sources on startup, on return, and every minute while visible.")}
|
|
41
|
-
<div class="settings-sources-list import-sources"></div>
|
|
42
|
-
<div class="settings-import-progress" role="status"></div>
|
|
43
|
-
<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>
|
|
44
|
-
</section>
|
|
45
|
-
<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>
|
|
46
|
-
${Ze("muted","Mute all sound","Silence everything. Your volume levels are kept.")}
|
|
47
|
-
${Ze("clickSounds","Interaction sounds","A soft tick for controls; a chime for sessions.")}
|
|
48
|
-
${Mt("clickVolume","Interaction volume","Adjust interaction sound volume.",0,100)}
|
|
49
|
-
<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>
|
|
50
|
-
<p class="settings-footnote">Audio pauses while this tab is hidden. The speaker button on the map is a quick mute.</p>
|
|
51
|
-
</section>
|
|
52
|
-
<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>
|
|
53
|
-
${Mn("quality","Render quality","Performance uses 1× resolution and skips post-process effects.",[["performance","Performance"],["balanced","Balanced"],["high","High fidelity"]])}
|
|
54
|
-
${Mt("bloom","Glow strength","Soft light around bright nodes; disabled in Performance.",0,75)}
|
|
55
|
-
${Mt("nodeScale","Node size","Scale the lights without changing their positions.",60,180)}
|
|
56
|
-
${Ze("stars","Starfield","A faint field of stars behind the timeline.")}
|
|
57
|
-
${Ze("labels","Map labels","Directory names and the selected session title.")}
|
|
58
|
-
${Ze("focusDimming","Focus dimming","Dim surrounding nodes when a session is selected.")}
|
|
59
|
-
</section>
|
|
60
|
-
<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>
|
|
61
|
-
${Mn("trails","Session trails","Choose how much history to draw on the map.",[["all","All sessions"],["selected","Selected session"],["off","Hidden"]])}
|
|
62
|
-
${Mt("trailOpacity","Trail brightness","Fade lifetime trails into the background.",0,100)}
|
|
63
|
-
${Ze("trailFlow","Flowing trails","A decorative pulse along each lifetime; respects Motion.")}
|
|
64
|
-
${Mt("trailSpeed","Flow speed","How quickly the light travels along the trails.",10,100)}
|
|
65
|
-
${Ze("relationships","Relationship links","Show recorded fork and child connections.")}
|
|
66
|
-
${Ze("messageDots","Message & event dots","Clickable user, assistant, tool, and event markers on the selected trail.")}
|
|
67
|
-
${Mt("playbackSpeed","Playback speed","1× plays the full timeline in 30 seconds.",.25,3,"×",.25)}
|
|
68
|
-
<p class="settings-footnote">Flow is decorative. Message dots reflect saved timestamps; visual settings never alter your history.</p>
|
|
69
|
-
</section>
|
|
70
|
-
<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>
|
|
71
|
-
<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>
|
|
72
|
-
<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>
|
|
73
|
-
<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>
|
|
74
|
-
<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>
|
|
75
|
-
</section>
|
|
76
|
-
</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};let r=null,o=0,i=!1,a=!1,c="interface";const l=()=>{t.querySelectorAll(".settings-source, .settings-import").forEach(u=>{u.disabled=i||a}),t.querySelector(".settings-source")||(t.querySelector(".settings-import").disabled=!0)};async function p(){const u=++o;i=!0,l();const h=t.querySelector(".settings-sources-list");h.textContent="Finding local session sources…";try{const d=await e.getSources();if(n.signal.aborted||u!==o)return;h.innerHTML=d.map(m=>`<label class="import-source"><input class="settings-source" type="checkbox" value="${gs(m.id)}" ${m.selected?"checked":""}/><span class="source-symbol">${Ue(m.id)}</span><span><strong>${gs(m.name)}</strong><small>${gs(m.description)}</small><small class="source-imported">${m.sessions.toLocaleString()} saved${m.error?` · ${gs(m.error)}`:""}</small></span><span class="source-detected ${m.available?"detected":""}">${m.available?"Detected":"Not found"}</span></label>`).join("")}catch(d){if(n.signal.aborted||u!==o)return;h.textContent=d instanceof Error?d.message:"Could not detect sources.";const m=document.createElement("button");m.className="secondary-button",m.textContent="Retry",m.addEventListener("click",()=>{p()},s),h.append(m)}finally{u===o&&!n.signal.aborted&&(i=!1,l(),t.querySelector(".settings-import").disabled||=!h.querySelector("input"))}}t.querySelector(".settings-import").addEventListener("click",async()=>{const u=[...t.querySelectorAll(".settings-source:checked")].map(h=>h.value);a=!0,l(),t.querySelector(".settings-import-progress").textContent="Starting import…";try{await e.importSources(u)}catch(h){a=!1,l(),t.querySelector(".settings-import-progress").textContent=h instanceof Error?h.message:"Import unavailable."}},s);const f=()=>t.close();for(const u of[".settings-close",".settings-done"])t.querySelector(u).addEventListener("click",f,s);t.addEventListener("close",()=>{e.visibility(),r?.focus({preventScroll:!0})},s),t.addEventListener("keydown",u=>{u.stopPropagation()},s);function g(u){c=u;for(const[h]of ze){const d=t.querySelector(`[data-tab="${h}"]`);d.setAttribute("aria-selected",String(h===u)),d.tabIndex=h===u?0:-1,t.querySelector(`#settings-${h}`).hidden=h!==u}t.querySelector(".settings-content").scrollTop=0,c==="sources"&&p()}for(const u of t.querySelectorAll("[data-tab]"))u.addEventListener("click",()=>g(u.dataset.tab),s),u.addEventListener("keydown",h=>{const d=ze.findIndex(([b])=>b===u.dataset.tab),m=h.key==="Home"?0:h.key==="End"?ze.length-1:["ArrowRight","ArrowDown"].includes(h.key)?(d+1)%ze.length:["ArrowLeft","ArrowUp"].includes(h.key)?(d+ze.length-1)%ze.length:-1;m<0||(h.preventDefault(),g(ze[m][0]),t.querySelector(`[data-tab="${ze[m][0]}"]`).focus())},s);return t.addEventListener("input",u=>{const h=u.target,d=h.dataset.pref;if(!d)return;const m=h.type==="checkbox"?h.checked:h.type==="range"?Number(h.value):h.value;e.change({[d]:m})},s),t.querySelector(".settings-preview").addEventListener("click",e.previewSound,s),t.querySelector(".settings-reset").addEventListener("click",()=>e.change({...dr}),s),t.querySelector(".settings-reset-panels").addEventListener("click",e.resetPanels,s),{open(){t.open||(r=document.activeElement,t.showModal(),e.visibility(),t.querySelector('[aria-selected="true"]').focus(),c==="sources"&&p())},importStatus(u){const h=a;a=u.running,l(),t.querySelector(".settings-import-progress").textContent=u.running?`Importing · ${u.imported.toLocaleString()} saved`:`${u.imported.toLocaleString()} imported · ${u.unchanged.toLocaleString()} unchanged${u.failed?` · ${u.failed} unavailable`:""}${u.errors.length?` · ${u.errors[0]}`:""}`,h&&!u.running&&t.open&&c==="sources"&&p()},render(u,h,d="saved"){for(const m of t.querySelectorAll("[data-pref]")){const b=m.dataset.pref;m.type==="checkbox"?m.checked=!!u[b]:m.value=String(u[b]);const I=t.querySelector(`[data-output="${b}"]`);I&&(I.value=`${u[b]}${I.dataset.unit}`),m.disabled=b==="bloom"&&u.quality==="performance"||b==="trailSpeed"&&(!u.trailFlow||u.trails==="off"||u.motion==="off")}t.querySelector(".settings-save-status").textContent=d==="saving"?"Saving preferences…":d==="error"?"Changes applied; could not save to the local library.":h?"Saved on this device · changes apply live.":"Applied for this visit; storage is unavailable.",t.querySelector(".settings-preview").disabled=u.muted||!u.clickSounds||!u.clickVolume,ln(t)},audioStatus(u){t.querySelector(".settings-audio-status").textContent=u},dispose(){n.abort(),t.remove()}}}class pg{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 Pl=e=>e.kind==="message"?e.role==="user"?"#b0e9d6":"#9bbcff":e.kind.startsWith("tool_")?"#eac594":"#d7a1f1",Vl=e=>e.kind==="message"?e.role==="user"?"You":e.role==="assistant"?"Assistant":"Message":{tool_call:"Tool call",tool_result:"Tool result",reasoning:"Reasoning",compaction:"Compaction",file_change:"File change",error:"Error",event:"Event"}[e.kind],de=e=>e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]),gg=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"medium"}),Rr=e=>e===null?"Time not recorded":gg.format(e),Pr=e=>`<span class="event-badge" style="--event-color:${Pl(e)}">${Vl(e)}</span>`;function mg(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 & events</h2><button class="icon-button event-close" aria-label="Close message details">×</button></header>
|
|
77
|
-
<div class="event-detail-nav"><button class="secondary-button" data-step="previous" aria-label="Previous event" title="Previous event (← / ↑)">← Previous</button><span class="event-position" role="status"></span><button class="secondary-button" data-step="next" aria-label="Next event" title="Next event (→ / ↓)">Next →</button></div>
|
|
78
|
-
<div class="event-scroll"><article class="event-content" aria-label="Event details" tabindex="0"></article>
|
|
79
|
-
<details class="event-browser"><summary>Browse saved events <span class="event-count"></span></summary>
|
|
80
|
-
<div class="event-toolbar"><label>Show <select aria-label="Event filter"><option value="all">All activity</option><option value="messages">Messages</option><option value="tools">Tool calls & results</option><option value="events">Other events</option><option value="untimed">Without timestamps</option></select></label></div>
|
|
81
|
-
<nav class="event-list" aria-label="Session events"></nav><div class="event-pagination"><button class="secondary-button" data-page="previous">← Earlier page</button><button class="secondary-button" data-page="next">Later page →</button></div>
|
|
82
|
-
</details>
|
|
83
|
-
</div><footer class="event-footer"><details><summary>History coverage</summary><p class="event-coverage"></p></details><button class="text-button event-reload">Reload</button></footer>`,e.append(s);const r=y=>s.querySelector(y),o=new AbortController;let i,a,c,l="all",p,f=!1,g,u,h={};const d=y=>`<button class="event-row" data-event="${de(y.id)}" aria-current="${c?.selected?.id===y.id?"true":"false"}"><span class="event-row-top">${Pr(y)}<small>#${y.ordinal+1}${y.status==="failed"?" · failed":""}</small></span><strong>${de(y.name)}</strong><span class="event-preview">${de(y.preview||"No text recorded")}</span><time>${Rr(y.time)}</time></button>`;function m(){!c||!r(".event-browser").open||(r(".event-list").innerHTML=c.items.map(d).join("")||'<p class="event-empty">No saved items in this view.</p>')}function b(){if(!c)return;ln(s),r(".event-count").textContent=`${c.total.toLocaleString()} items${c.partial?" · partial coverage":""}`,m();for(const C of["previous","next"])r(`[data-page="${C}"]`).disabled=!c[`${C}Cursor`];r(".event-coverage").textContent=c.note||(c.partial?"Saved history is incomplete or still awaiting import.":"Saved local history. Missing timestamps are never inferred.");const y=c.selected;r(".event-position").textContent=y?`#${y.ordinal+1}`:"No items";for(const C of["previous","next"])r(`[data-step="${C}"]`).disabled=!c[`${C}Item`];if(!y){r(".event-content").innerHTML='<div class="event-empty"><h3>Nothing here yet.</h3><p>Choose another filter or refresh the source import.</p></div>',n.select(null);return}n.select(y);const E=(C,O)=>O?`<section class="event-payload"><h4>${C}</h4><pre>${de(O)}</pre></section>`:"";r(".event-content").innerHTML=`<div class="event-detail-heading">${Pr(y)}${y.status?`<span class="event-status ${y.status==="failed"?"failed":""}">${de(y.status)}</span>`:""}<h3>${de(y.name)}</h3><p>${Rr(y.time)}${y.timeSource==="message"?" · parent message timestamp":""}</p>${y.endTime?`<p>Completed ${Rr(y.endTime)}</p>`:""}${y.time===null?"<p>No timestamp · this item has no map position.</p>":y.time<a.created||y.time>Math.max(a.created,a.activity?.lastMessageAt||a.created)?"<p>Outside this session’s plotted lifetime.</p>":""}</div>
|
|
84
|
-
${y.partial?'<p class="event-warning">Some content is shortened, missing, or unsupported in this import.</p>':""}
|
|
85
|
-
${E("Message / event",y.text)}${E("Input",y.input)}${E("Output",y.output)}
|
|
86
|
-
${!y.text&&!y.input&&!y.output?'<p class="event-empty">No text payload was recorded.</p>':""}
|
|
87
|
-
${y.kind==="tool_call"||y.kind==="tool_result"?`<section class="event-correlations"><h4>Linked tool activity</h4>${c.related.length?c.related.map(C=>`<button class="event-link" data-linked="${de(C.id)}">${Pr(C)}<span>${de(C.name)}</span><small>#${C.ordinal+1} →</small></button>`).join(""):"<p>No matching call or result was saved. A call alone does not confirm execution.</p>"}${c.relatedPartial?"<p>Showing the first 20 linked items.</p>":""}</section>`:""}
|
|
88
|
-
<details class="event-provenance"><summary>Source details</summary><dl><dt>Source</dt><dd>${de(je(a?.source))}</dd><dt>Message ID</dt><dd>${de(y.messageID)}</dd>${y.nativeID?`<dt>Native event ID</dt><dd>${de(y.nativeID)}</dd>`:""}${y.nativeType?`<dt>Native type</dt><dd>${de(y.nativeType)}</dd>`:""}${y.callID?`<dt>Tool correlation ID</dt><dd>${de(y.callID)}</dd>`:""}${y.parentID?`<dt>Native parent reference</dt><dd>${de(y.parentID)}</dd>`:""}<dt>Timestamp source</dt><dd>${de(y.timeSource)}</dd></dl></details>`}async function I(y={}){if(!a)return;clearTimeout(u),i?.abort();const E=new AbortController;i=E,h=y,f=!0,s.setAttribute("aria-busy","true"),r(".event-position").textContent="Loading…";for(const D of s.querySelectorAll("[data-step], [data-page]"))D.disabled=!0;const C=r(".event-list").scrollTop,O=c?.offset,w=document.activeElement,L=w instanceof HTMLElement?w.dataset:void 0;try{const D=await t.read(a.id,{filter:l,...y,...p?{revision:p}:{}},E.signal);if(E.signal.aborted)return;c=D,p=c.revision,b(),r(".event-list").scrollTop=c.offset===O?C:0,r(".event-scroll").scrollTop=0;const V=L?.event?`[data-event="${L.event}"]`:"";V&&(document.activeElement===w||!w?.isConnected&&document.activeElement===document.body)&&s.querySelector(V)?.focus({preventScroll:!0}),clearTimeout(u),u=setTimeout(()=>{g?.abort(),g=new AbortController;for(const H of[c?.previousItem,c?.nextItem])H&&t.read(a.id,{item:H,filter:l,revision:p},g.signal).catch(()=>{})},60)}catch(D){if(E.signal.aborted)return;c=void 0,r(".event-position").textContent="Unavailable",r(".event-content").innerHTML=`<div class="event-empty"><h3>Could not load this history.</h3><p>${de(D instanceof Error?D.message:"Please retry.")}</p><button class="secondary-button" data-retry>Retry</button> <button class="secondary-button" data-reload>Reload current history</button></div>`}finally{i===E&&(f=!1,s.removeAttribute("aria-busy"))}}const M=()=>{t.clear(),p=void 0,c=void 0,I()},R=()=>!s.hidden&&!e.hidden,x=()=>{clearTimeout(u),g?.abort(),i?.abort(),i=void 0,f=!1,c=void 0,s.hidden=!0,s.removeAttribute("aria-busy"),e.classList.remove("has-events"),n.select(null)},A=y=>{if(f)return;const E=y==="next"?c?.nextItem:c?.previousItem;E&&I({item:E})};return s.addEventListener("click",y=>{const E=y.target.closest("button");if(E){if(E.dataset.event&&I({item:E.dataset.event}),E.dataset.linked&&(l="all",r("select").value=l,I({item:E.dataset.linked})),E.dataset.step&&A(E.dataset.step==="next"?"next":"previous"),E.dataset.page){const C=E.dataset.page==="next"?c?.nextCursor:c?.previousCursor;C&&I({cursor:C})}E.hasAttribute("data-retry")&&I(h),(E.hasAttribute("data-reload")||E.classList.contains("event-reload"))&&M(),E.classList.contains("event-close")&&(x(),document.querySelector("#scene canvas")?.focus({preventScroll:!0}))}},{signal:o.signal}),r("select").addEventListener("change",()=>{l=r("select").value,I()},{signal:o.signal}),r(".event-browser").addEventListener("toggle",m,{signal:o.signal}),{close:x,handleKey(y){return!R()||y.defaultPrevented||y.metaKey||y.ctrlKey||y.altKey||y.shiftKey||document.querySelector("dialog[open]")||y.target.closest('input, select, textarea, [contenteditable="true"], [data-drag-panel], #explorer')?!1:y.key==="Escape"?(y.preventDefault(),x(),document.querySelector("#scene canvas")?.focus({preventScroll:!0}),!0):["ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(y.key)?(y.preventDefault(),A(y.key==="ArrowLeft"||y.key==="ArrowUp"?"previous":"next"),!0):!1},open(y,E,C){clearTimeout(u),g?.abort();const O=a?.id===y.id;a=y,p=C,c=void 0,l="all",r("select").value=l,r(".event-list").replaceChildren(),r(".event-content").innerHTML='<p class="event-empty">Loading saved history…</p>',r(".event-coverage").textContent="Loading coverage…",O||(r(".event-browser").open=!1),s.hidden=!1,e.classList.add("has-events"),I(E?{item:E}:{})},dispose(){clearTimeout(u),g?.abort(),i?.abort(),o.abort(),s.remove()}}}function vg(e,t,n){const s=new Map;let r,o,i,a,c=0,l=0,p=1;const f=document.createElement("strong"),g=document.createElement("pre"),u=document.createElement("span"),h=()=>{clearTimeout(i),o?.abort(),o=void 0,r=void 0,a=void 0,e.hidden=!0,e.classList.remove("message-tooltip")};function d(b,I){if(!a)return;const M=`${Vl(a)} · ${a.name}`,R=b||"No text recorded.",x=[I,p>1?`${p} nearby items`:"","Click to focus and read · ← / → to navigate"].filter(Boolean).join(" · ");f.textContent!==M&&(f.textContent=M),g.textContent!==R&&(g.textContent=R),u.textContent!==x&&(u.textContent=x),f.parentElement!==e&&e.replaceChildren(f,g,u),e.classList.add("message-tooltip"),e.hidden=!1,e.style.setProperty("--event-color",Pl(a));const A=e.offsetWidth,y=e.offsetHeight,E=t.getBoundingClientRect(),C=[...document.querySelectorAll(".floating-panel:not([hidden]), .app-header, .map-controls")].map(L=>L.getBoundingClientRect()),w=[l+18,l-y-18].flatMap(L=>[c+18,c-A-18].map(D=>{D=Math.max(8,Math.min(D,t.clientWidth-A-8)),L=Math.max(8,Math.min(L,t.clientHeight-y-8));const V=E.left+D,H=E.top+L,K=C.reduce((se,Z)=>se+Math.max(0,Math.min(V+A,Z.right+8)-Math.max(V,Z.left-8))*Math.max(0,Math.min(H+y,Z.bottom+8)-Math.max(H,Z.top-8)),0);return{left:D,top:L,overlap:K}})).reduce((L,D)=>D.overlap<L.overlap?D:L);e.style.left=`${w.left}px`,e.style.top=`${w.top}px`}function m(b){const I=[b.text,b.input?`Input
|
|
89
|
-
${b.input}`:"",b.output?`Output
|
|
90
|
-
${b.output}`:""].filter(Boolean).join(`
|
|
91
|
-
|
|
92
|
-
`);return{text:I.slice(0,1800),shortened:I.length>1800||!!b.partial}}return{clear:h,show(b,I,M,R,x,A){const y=`${I}:${M}:${b.id}`,E=r!==y;E&&h(),r=y,a=b,c=x,l=A,p=R;const C=s.get(y);d(C?.text||b.preview,C?C.shortened?"Content preview":"":"Loading message…"),!(!E||C)&&(i=setTimeout(async()=>{const O=new AbortController;o=O;try{const w=await n.read(I,{item:b.id,revision:M},O.signal);if(O.signal.aborted||r!==y||w.selected?.id!==b.id)return;const L=m(w.selected);s.set(y,L),s.size>20&&s.delete(s.keys().next().value),d(L.text,L.shortened?"Content preview":"")}catch{!O.signal.aborted&&r===y&&d(b.preview,"Saved excerpt · open for details")}},120))},dispose(){h(),s.clear()}}}class yg{constructor(t=(...n)=>fetch(...n)){this.request=t}request;pages=new Map;pending=new Map;characters=0;generation=0;clear(){this.generation++,this.pages.clear(),this.characters=0;for(const t of this.pending.values())t.controller.abort();this.pending.clear()}read(t,n={},s){if(s?.aborted)return Promise.reject(s.reason);const r=n.filter||"all",o=JSON.stringify([t,n.revision,r,n.item,n.cursor]),i=n.revision?this.pages.get(o):void 0;if(i)return this.pages.delete(o),this.pages.set(o,i),Promise.resolve(i.page);let a=this.pending.get(o);if(!a){const l=new AbortController,p=this.generation,f=new URLSearchParams({filter:r,...n}),g=this.request(`/api/sessiongraph/session/${encodeURIComponent(t)}/events?${f}`,{signal:AbortSignal.any([l.signal,AbortSignal.timeout(3e4)])}).then(async d=>{const m=await d.json();if(!d.ok)throw d.status===409&&this.clear(),new Error(m.error||"Could not load events.");if(l.signal.aborted||p!==this.generation)throw new DOMException("Request cancelled","AbortError");if(m.sessionID!==t||n.revision&&m.revision!==n.revision)throw new Error("Saved history changed. Reload the event explorer.");const b=JSON.stringify([t,m.revision,r,n.item,n.cursor]),I=JSON.stringify(m).length;for(this.characters-=this.pages.get(b)?.characters||0,this.pages.delete(b),this.pages.set(b,{page:m,characters:I}),this.characters+=I;this.pages.size>20||this.characters>2e6;){const M=this.pages.keys().next().value;this.characters-=this.pages.get(M).characters,this.pages.delete(M)}return m});a={controller:l,promise:g,readers:0},this.pending.set(o,a);const u=a,h=()=>{this.pending.get(o)===u&&this.pending.delete(o)};g.then(h,h)}const c=a;return c.readers++,new Promise((l,p)=>{const f=()=>{u(),p(s.reason)};let g=!1;const u=()=>{g||(g=!0,s?.removeEventListener("abort",f),--c.readers===0&&this.pending.get(o)===c&&(this.pending.delete(o),c.controller.abort()))};s?.addEventListener("abort",f,{once:!0}),c.promise.then(h=>{g||(u(),l(h))},h=>{g||(u(),p(h))})})}}function oe(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 zt(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 ms,Gt,Se,Yt,vs,Vr,ys;const da="__TAURI_TO_IPC_KEY__";function bg(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class Sv{constructor(t){ms.add(this),Gt.set(this,void 0),Se.set(this,0),Yt.set(this,[]),vs.set(this,void 0),zt(this,Gt,t||(()=>{})),this.id=bg(n=>{const s=n.index;if("end"in n){s==oe(this,Se,"f")?this.cleanupCallback():zt(this,vs,s);return}const r=n.message;if(s==oe(this,Se,"f")){for(oe(this,ms,"m",Vr).call(this,r),zt(this,Se,oe(this,Se,"f")+1);oe(this,Se,"f")in oe(this,Yt,"f");){const o=oe(this,Yt,"f")[oe(this,Se,"f")];oe(this,ms,"m",Vr).call(this,o),delete oe(this,Yt,"f")[oe(this,Se,"f")],zt(this,Se,oe(this,Se,"f")+1)}oe(this,Se,"f")===oe(this,vs,"f")&&this.cleanupCallback()}else oe(this,Yt,"f")[s]=r})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(t){zt(this,Gt,t)}get onmessage(){return oe(this,Gt,"f")}[(Gt=new WeakMap,Se=new WeakMap,Yt=new WeakMap,vs=new WeakMap,ms=new WeakSet,Vr=function(n){try{oe(this,Gt,"f").call(this,n)}catch(s){queueMicrotask(()=>{throw s})}},da)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[da]()}}async function Nl(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}class $v{get rid(){return oe(this,ys,"f")}constructor(t){ys.set(this,void 0),zt(this,ys,t)}async close(){return Nl("plugin:resources|close",{rid:this.rid})}async[(ys=new WeakMap,Symbol.asyncDispose)](){await this.close()}}function wg(){return!!(globalThis||window).isTauri}async function Eg(){await Nl("plugin:process|restart")}class xg{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 Sg='<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>',$g='<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 Ig(e){const t=document.createElement("button");t.className="desktop-update glass",t.hidden=!0,t.type="button";const n=document.createElement("span");n.className="sr-only",n.role="status",n.setAttribute("aria-live","polite"),document.querySelector("#app").append(t,n);let s="";const r=l=>{const p=["downloading","installing","restarting"].includes(l.phase),f=l.phase==="ready"||l.phase==="error"&&l.retry!=="download",g=l.phase==="downloading"?l.progress===void 0?"Downloading":`${l.progress}%`:l.phase==="installing"?"Installing":l.phase==="restarting"?"Restarting":f?"Restart":l.phase==="error"?"Retry update":"Update",u=l.phase==="error"?`${l.retry==="restart"?"Could not restart SessionGraph.":`Could not ${l.retry==="download"?"download or verify":"install"} the update.`} ${l.error||""} Click to try again.`:l.phase==="restarting"?`Restarting SessionGraph ${l.version}`:f?`Restart to install SessionGraph ${l.version}`:`Update to SessionGraph ${l.version}`;t.hidden=l.phase==="hidden",t.disabled=p,t.dataset.phase=l.phase,t.setAttribute("aria-busy",String(p)),t.setAttribute("aria-label",u),t.title=u;const h=`${f||l.phase==="restarting"?$g:Sg}<span>${g}</span>`;t.innerHTML!==h&&(t.innerHTML=h);const d=l.phase==="hidden"?"":l.phase==="downloading"?`Downloading SessionGraph ${l.version}`:u;d!==s&&(n.textContent=d,s=d)},o=new xg(e,r);t.addEventListener("click",()=>{o.activate()});const i=()=>{document.visibilityState==="visible"&&navigator.onLine&&o.check()},a=window.setTimeout(i,1e4),c=window.setInterval(i,240*6e4);return document.addEventListener("visibilitychange",i),window.addEventListener("online",i),{check:()=>o.check(),dispose(){clearTimeout(a),clearInterval(c),o.dispose(),t.remove(),n.remove(),document.removeEventListener("visibilitychange",i),window.removeEventListener("online",i)}}}function Tg(){return wg()?Ig({async check(){const{check:e}=await La(async()=>{const{check:n}=await import("./index-BVJmULd-.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 Eg()}}):{dispose(){}}}var Cg=Jt("date-picker").parts("clearTrigger","content","control","input","label","monthSelect","nextTrigger","positioner","presetTrigger","prevTrigger","rangeText","root","table","tableBody","tableCell","tableCellTrigger","tableHead","tableHeader","tableRow","trigger","view","viewControl","viewTrigger","yearSelect"),J=Cg.build();function Nr(e,t){return e-t*Math.floor(e/t)}const Fl=1721426;function bs(e,t,n,s){t=Uo(e,t);let r=t-1,o=-2;return n<=2?o=0:Ds(t)&&(o=-1),Fl-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*n-362)/12+o+s)}function Ds(e){return e%4===0&&(e%100!==0||e%400===0)}function Uo(e,t){return e==="BC"?1-t:t}function kg(e){let t="AD";return e<=0&&(t="BC",e=1-e),[t,e]}const Ag={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 cn{fromJulianDay(t){let n=t,s=n-Fl,r=Math.floor(s/146097),o=Nr(s,146097),i=Math.floor(o/36524),a=Nr(o,36524),c=Math.floor(a/1461),l=Nr(a,1461),p=Math.floor(l/365),f=r*400+i*100+c*4+p+(i!==4&&p!==4?1:0),[g,u]=kg(f),h=n-bs(g,u,1,1),d=2;n<bs(g,u,3,1)?d=0:Ds(u)&&(d=1);let m=Math.floor(((h+d)*12+373)/367),b=n-bs(g,u,m,1)+1;return new Pe(g,u,m,b)}toJulianDay(t){return bs(t.era,t.year,t.month,t.day)}getDaysInMonth(t){return Ag[Ds(t.year)?"leapyear":"standard"][t.month-1]}getMonthsInYear(t){return 12}getDaysInYear(t){return Ds(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 Og={"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 we(e,t){return t=le(t,e.calendar),e.era===t.era&&e.year===t.year&&e.month===t.month&&e.day===t.day}function Lg(e,t){return t=le(t,e.calendar),e=et(e),t=et(t),e.era===t.era&&e.year===t.year&&e.month===t.month}function Mg(e,t){return t=le(t,e.calendar),e=Kn(e),t=Kn(t),e.era===t.era&&e.year===t.year}function Dg(e,t){return fr(e.calendar,t.calendar)&&we(e,t)}function Dn(e,t){return fr(e.calendar,t.calendar)&&Lg(e,t)}function Rn(e,t){return fr(e.calendar,t.calendar)&&Mg(e,t)}function fr(e,t){return e.isEqual?.(t)??t.isEqual?.(e)??e.identifier===t.identifier}function Rg(e,t){return we(e,hr(t))}const Pg={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6};function Hl(e,t,n){let s=e.calendar.toJulianDay(e),r=n?Pg[n]:Hg(t),o=Math.ceil(s+1-r)%7;return o<0&&(o+=7),o}function _l(e){return tt(Date.now(),e)}function hr(e){return Pt(_l(e))}function Bl(e,t){return e.calendar.toJulianDay(e)-t.calendar.toJulianDay(t)}function Vg(e,t){return ua(e)-ua(t)}function ua(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Fr=null,Ng=!1;function qo(){return Fr==null&&(Fr=new Intl.DateTimeFormat().resolvedOptions().timeZone),Fr}function Wl(){return Ng}function et(e){return e.subtract({days:e.day-1})}function vo(e){return e.add({days:e.calendar.getDaysInMonth(e)-e.day})}function Kn(e){return et(e.subtract({months:e.month-1}))}function Fg(e){return vo(e.add({months:e.calendar.getMonthsInYear(e)-e.month}))}function St(e,t,n){let s=Hl(e,t,n);return e.subtract({days:s})}function fa(e,t,n){return St(e,t,n).add({days:6})}const ha=new Map,Hr=new Map;function jl(e){if(Intl.Locale){let n=ha.get(e);return n||(n=new Intl.Locale(e).maximize().region,n&&ha.set(e,n)),n}let t=e.split("-")[1];return t==="u"?void 0:t}function Hg(e){let t=Hr.get(e);if(!t){if(Intl.Locale){let s=new Intl.Locale(e);if("getWeekInfo"in s&&(t=s.getWeekInfo(),t))return Hr.set(e,t),t.firstDay}let n=jl(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&&Og[n]||0};Hr.set(e,t)}return t.firstDay}function _g(e,t,n){let s=e.calendar.getDaysInMonth(e);return Math.ceil((Hl(et(e),t,n)+s)/7)}function Ul(e,t){return e&&t?e.compare(t)<=0?e:t:e||t}function ql(e,t){return e&&t?e.compare(t)>=0?e:t:e||t}const Bg={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 Wg(e,t){let n=e.calendar.toJulianDay(e),s=Math.ceil(n+1)%7;s<0&&(s+=7);let r=jl(t),[o,i]=Bg[r]||[6,0];return s===o||s===i}function dn(e){e=le(e,new cn);let t=Uo(e.era,e.year);return Gl(t,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function Gl(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 yo(e,t){if(t==="UTC")return 0;if(e>0&&t===qo()&&!Wl())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:s,day:r,hour:o,minute:i,second:a}=Yl(e,t);return Gl(n,s,r,o,i,a,0)-Math.floor(e/1e3)*1e3}const pa=new Map;function Yl(e,t){let n=pa.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"}),pa.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 ga=864e5;function jg(e,t,n,s){return(n===s?[n]:[n,s]).filter(o=>Ug(e,t,o))}function Ug(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 Qe(e,t,n="compatible"){let s=Ae(e);if(t==="UTC")return dn(s);if(t===qo()&&n==="compatible"&&!Wl()){s=le(s,new cn);let c=new Date,l=Uo(s.era,s.year);return c.setFullYear(l,s.month-1,s.day),c.setHours(s.hour,s.minute,s.second,s.millisecond),c.getTime()}let r=dn(s),o=yo(r-ga,t),i=yo(r+ga,t),a=jg(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 Kl(e,t,n="compatible"){return new Date(Qe(e,t,n))}function tt(e,t){let n=yo(e,t),s=new Date(e+n),r=s.getUTCFullYear(),o=s.getUTCMonth()+1,i=s.getUTCDate(),a=s.getUTCHours(),c=s.getUTCMinutes(),l=s.getUTCSeconds(),p=s.getUTCMilliseconds();return new zn(r<1?"BC":"AD",r<1?-r+1:r,o,i,t,n,a,c,l,p)}function Pt(e){return new Pe(e.calendar,e.era,e.year,e.month,e.day)}function Ae(e,t){let n=0,s=0,r=0,o=0;if("timeZone"in e)({hour:n,minute:s,second:r,millisecond:o}=e);else if("hour"in e&&!t)return e;return t&&({hour:n,minute:s,second:r,millisecond:o}=t),new Zs(e.calendar,e.era,e.year,e.month,e.day,n,s,r,o)}function le(e,t){if(fr(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,_t(s),s}function zl(e,t,n){if(e instanceof zn)return e.timeZone===t?e:Gg(e,t);let s=Qe(e,t,n);return tt(s,t)}function qg(e){let t=dn(e)-e.offset;return new Date(t)}function Gg(e,t){let n=dn(e)-e.offset;return le(tt(n,t),e.calendar)}const Pn=36e5;function pr(e,t){let n=e.copy(),s="hour"in n?Zg(n,t):0;bo(n,t.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=t.months||0,wo(n),Zl(n),n.day+=(t.weeks||0)*7,n.day+=t.days||0,n.day+=s,Yg(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 bo(e,t){e.calendar.isInverseEra?.(e)&&(t=-t),e.year+=t}function wo(e){for(;e.month<1;)bo(e,-1),e.month+=e.calendar.getMonthsInYear(e);let t=0;for(;e.month>(t=e.calendar.getMonthsInYear(e));)e.month-=t,bo(e,1)}function Yg(e){for(;e.day<1;)e.month--,wo(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,wo(e)}function Zl(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 _t(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),Zl(e)}function Jl(e){let t={};for(let n in e)typeof e[n]=="number"&&(t[n]=-e[n]);return t}function Xl(e,t){return pr(e,Jl(t))}function Go(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),_t(n),n}function zs(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),zg(n),n}function Kg(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=ws(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=ws(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=ws(e.minute,60);let t=Math.floor(e.hour/24);return e.hour=ws(e.hour,24),t}function zg(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 ws(e,t){let n=e%t;return n<0&&(n+=t),n}function Zg(e,t){return e.hour+=t.hours||0,e.minute+=t.minutes||0,e.second+=t.seconds||0,e.millisecond+=t.milliseconds||0,Kg(e)}function Yo(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=nt(i,n,0,o.length-1,s?.round),r.era=o[i],_t(r);break}case"year":r.calendar.isInverseEra?.(r)&&(n=-n),r.year=nt(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=nt(e.month,n,1,e.calendar.getMonthsInYear(e),s?.round);break;case"day":r.day=nt(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),_t(r),r}function Ql(e,t,n,s){let r=e.copy();switch(t){case"hour":{let o=e.hour,i=0,a=23;if(s?.hourCycle===12){let c=o>=12;i=c?12:0,a=c?23:11}r.hour=nt(o,n,i,a,s?.round);break}case"minute":r.minute=nt(e.minute,n,0,59,s?.round);break;case"second":r.second=nt(e.second,n,0,59,s?.round);break;case"millisecond":r.millisecond=nt(e.millisecond,n,0,999,s?.round);break;default:throw new Error("Unsupported field "+t)}return r}function nt(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 ec(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=pr(Ae(e),{years:t.years,months:t.months,weeks:t.weeks,days:t.days});n=Qe(r,e.timeZone)}else n=dn(e)-e.offset;n+=t.milliseconds||0,n+=(t.seconds||0)*1e3,n+=(t.minutes||0)*6e4,n+=(t.hours||0)*36e5;let s=tt(n,e.timeZone);return le(s,e.calendar)}function Jg(e,t){return ec(e,Jl(t))}function Xg(e,t,n,s){switch(t){case"hour":{let r=0,o=23;if(s?.hourCycle===12){let h=e.hour>=12;r=h?12:0,o=h?23:11}let i=Ae(e),a=le(zs(i,{hour:r}),new cn),c=[Qe(a,e.timeZone,"earlier"),Qe(a,e.timeZone,"later")].filter(h=>tt(h,e.timeZone).day===a.day)[0],l=le(zs(i,{hour:o}),new cn),p=[Qe(l,e.timeZone,"earlier"),Qe(l,e.timeZone,"later")].filter(h=>tt(h,e.timeZone).day===l.day).pop(),f=dn(e)-e.offset,g=Math.floor(f/Pn),u=f%Pn;return f=nt(g,n,Math.floor(c/Pn),Math.floor(p/Pn),s?.round)*Pn+u,le(tt(f,e.timeZone),e.calendar)}case"minute":case"second":case"millisecond":return Ql(e,t,n,s);case"era":case"year":case"month":case"day":{let r=Yo(Ae(e),t,n,s),o=Qe(r,e.timeZone);return le(tt(o,e.timeZone),e.calendar)}default:throw new Error("Unsupported field "+t)}}function Qg(e,t,n){let s=Ae(e),r=zs(Go(s,t),t);if(r.compare(s)===0)return e;let o=Qe(r,e.timeZone,n);return le(tt(o,e.timeZone),e.calendar)}const em=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,tm=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function nm(e){let t=e.match(em);if(!t)throw tm.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let n=new Pe(_r(t[1],0,9999),_r(t[2],1,12),1);return n.day=_r(t[3],1,n.calendar.getDaysInMonth(n)),n}function _r(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 sm(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 tc(e){let t=le(e,new cn),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 nc(e){return`${tc(e)}T${sm(e)}`}function rm(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 om(e){return`${nc(e)}${rm(e.offset)}[${e.timeZone}]`}function Ko(e){let t=typeof e[0]=="object"?e.shift():new cn,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 Pe{#e;constructor(...t){let[n,s,r,o,i]=Ko(t);this.calendar=n,this.era=s,this.year=r,this.month=o,this.day=i,_t(this)}copy(){return this.era?new Pe(this.calendar,this.era,this.year,this.month,this.day):new Pe(this.calendar,this.year,this.month,this.day)}add(t){return pr(this,t)}subtract(t){return Xl(this,t)}set(t){return Go(this,t)}cycle(t,n,s){return Yo(this,t,n,s)}toDate(t){return Kl(this,t)}toString(){return tc(this)}compare(t){return Bl(this,t)}}class Zs{#e;constructor(...t){let[n,s,r,o,i]=Ko(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,_t(this)}copy(){return this.era?new Zs(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new Zs(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(t){return pr(this,t)}subtract(t){return Xl(this,t)}set(t){return Go(zs(this,t),t)}cycle(t,n,s){switch(t){case"era":case"year":case"month":case"day":return Yo(this,t,n,s);default:return Ql(this,t,n,s)}}toDate(t,n){return Kl(this,t,n)}toString(){return nc(this)}compare(t){let n=Bl(this,t);return n===0?Vg(this,Ae(t)):n}}class zn{#e;constructor(...t){let[n,s,r,o,i]=Ko(t),a=t.shift(),c=t.shift();this.calendar=n,this.era=s,this.year=r,this.month=o,this.day=i,this.timeZone=a,this.offset=c,this.hour=t.shift()||0,this.minute=t.shift()||0,this.second=t.shift()||0,this.millisecond=t.shift()||0,_t(this)}copy(){return this.era?new zn(this.calendar,this.era,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond):new zn(this.calendar,this.year,this.month,this.day,this.timeZone,this.offset,this.hour,this.minute,this.second,this.millisecond)}add(t){return ec(this,t)}subtract(t){return Jg(this,t)}set(t,n){return Qg(this,t,n)}cycle(t,n,s){return Xg(this,t,n,s)}toDate(){return qg(this)}toString(){return om(this)}toAbsoluteString(){return this.toDate().toISOString()}compare(t){return this.toDate().getTime()-zl(t,this.timeZone).toDate().getTime()}}let Br=new Map;class Ce{constructor(t,n={}){this.formatter=sc(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 lm()&&(this.resolvedHourCycle||(this.resolvedHourCycle=cm(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 im={true:{ja:"h11"},false:{}};function sc(e,t={}){if(typeof t.hour12=="boolean"&&am()){t={...t};let r=im[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(Br.has(n))return Br.get(n);let s=new Intl.DateTimeFormat(e,t);return Br.set(n,s),s}let Wr=null;function am(){return Wr==null&&(Wr=new Intl.DateTimeFormat("en-US",{hour:"numeric",hour12:!1}).format(new Date(2020,2,3,0))==="24"),Wr}let jr=null;function lm(){return jr==null&&(jr=new Intl.DateTimeFormat("fr",{hour:"numeric",hour12:!1}).resolvedOptions().hourCycle==="h12"),jr}function cm(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=sc(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 dm(e,t,n,s,r){const o={};for(let a in t){const c=a,l=t[c];l!=null&&(o[c]=Math.floor(l/2),o[c]>0&&l%2===0&&o[c]--)}const i=jt(e,t,n).subtract(o);return Qn(e,i,t,n,s,r)}function jt(e,t,n,s,r){let o=e;return t.years?o=Kn(e):t.months?o=et(e):t.weeks&&(o=St(e,n)),Qn(e,o,t,n,s,r)}function zo(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=jt(e,t,n).subtract(o);return Qn(e,i,t,n,s,r)}function Qn(e,t,n,s,r,o){return r&&e.compare(r)>=0&&(t=ql(t,jt(Pt(r),n,s))),o&&e.compare(o)<=0&&(t=Ul(t,zo(Pt(o),n,s))),t}function Te(e,t,n){const s=Pt(e),r=t?Pt(t):void 0,o=n?Pt(n):void 0;let i=s;return r&&(i=ql(i,r)),o&&(i=Ul(i,o)),i.compare(s)===0?e:"hour"in e?e.set({year:i.year,month:i.month,day:i.day}):i}function ma(e,t,n,s,r,o){switch(t){case"start":return jt(e,n,s,r,o);case"end":return zo(e,n,s,r,o);default:return dm(e,n,s,r,o)}}function Et(e,t){return e==null||t==null?e===t:!("hour"in e)&&!("hour"in t)?we(e,t):Ae(e).compare(Ae(t))===0}function va(e,t,n,s,r){return e?t?.(e,n)?!0:He(e,s,r):!1}function He(e,t,n){return t!=null&&e.compare(t)<0||n!=null&&e.compare(n)>0}function um(e,t,n){const s=e.subtract({days:1});return we(s,e)||He(s,t,n)}function fm(e,t,n){const s=e.add({days:1});return we(s,e)||He(s,t,n)}function Zo(e){let t={...e};for(let n in t)t[n]=1;return t}function rc(e,t){let n={...t};return n.days?n.days--:n.days=-1,e.add(n)}function oc(e){if(!e)return;const t=e.calendar.identifier;return t==="gregory"||t==="iso8601"?e.era==="BC"?"short":void 0:"short"}function ic(e,t,n){const s=n??Ae(hr(t));return new Ce(e,{weekday:"long",month:"long",year:"numeric",day:"numeric",era:oc(s),calendar:s.calendar.identifier,timeZone:t})}function ya(e,t,n){const s=n??hr(t);return new Ce(e,{month:"long",year:"numeric",era:oc(s),calendar:s.calendar.identifier,timeZone:t})}function hm(e,t,n,s,r){let o=n.formatRangeToParts(e.toDate(r),t.toDate(r)),i=-1;for(let l=0;l<o.length;l++){let p=o[l];if(p.source==="shared"&&p.type==="literal")i=l;else if(p.source==="endRange")break}let a="",c="";for(let l=0;l<o.length;l++)l<i?a+=o[l].value:l>i&&(c+=o[l].value);return s(a,c)}function Es(e,t,n,s){if(!e)return"";let r=e,o=t??e,i=ic(n,s);return we(r,o)?i.format(r.toDate(s)):hm(r,o,i,(a,c)=>`${a} – ${c}`,s)}var pm=["sun","mon","tue","wed","thu","fri","sat"];function ac(e){return e!=null?pm[e]:void 0}function lc(e,t,n){const s=ac(n);return St(e,t,s)}function cc(e,t,n,s){const r=t.add({weeks:e}),o=[];let i=lc(r,n,s);for(;o.length<7;){o.push(i);let a=i.add({days:1});if(we(i,a))break;i=a}return o}function gm(e,t,n,s){const r=ac(s),o=n??_g(e,t,r);return[...new Array(o).keys()].map(a=>cc(a,e,t,s))}function mm(e,t){const n=new Ce(e,{weekday:"long",timeZone:t}),s=new Ce(e,{weekday:"short",timeZone:t}),r=new Ce(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 vm(e,t,n,s){const r=lc(e,s,t),o=[...new Array(7).keys()],i=mm(s,n);return o.map(a=>i(r.add({days:a})))}function ym(e,t="long",n){if(!n||n.calendar.identifier==="gregory"||n.calendar.identifier==="iso8601"){const i=new Date(2021,0,1),a=[];for(let c=0;c<12;c++)a.push(i.toLocaleString(e,{month:t})),i.setMonth(i.getMonth()+1);return a}const s=n.calendar.getMonthsInYear(n),r=new Ce(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 ba(e,t){const n=St(e,t,"mon"),s=n.year,r=n.set({month:1,day:4}),o=St(r,t,"mon"),i=n.calendar.toJulianDay(n),a=o.calendar.toJulianDay(o);if(i>=a)return 1+Math.floor((i-a)/7);const c=n.set({year:s-1,month:1,day:4}),l=St(c,t,"mon"),p=l.calendar.toJulianDay(l);return 1+Math.floor((i-p)/7)}function bm(e){const t=[];for(let n=e.from;n<=e.to;n+=1)t.push(n);return t}var wm=1900,Em=2099;function xm(e,t,n){const s=e.calendar,r=t?.year??le(new Pe(wm,1,1),s).year,o=n?.year??le(new Pe(Em,12,31),s).year;return{from:r,to:o}}var Sm=10;function $m(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+Sm?(r-100).toString():r.toString()}return e}}function tn(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 qn(e,t){const n=hr(e??qo());return t?le(n,t):n}function es(e,t,n,s){return function(o){const{startDate:i,focusedDate:a}=o,c=rc(i,e);return He(a,n,s)?{startDate:i,focusedDate:Te(a,n,s),endDate:c}:a.compare(i)<0?{startDate:zo(a,e,t,n,s),focusedDate:Te(a,n,s),endDate:c}:a.compare(c)>0?{startDate:jt(a,e,t,n,s),endDate:c,focusedDate:Te(a,n,s)}:{startDate:i,endDate:c,focusedDate:Te(a,n,s)}}}function dc(e,t,n,s,r,o){const i=es(n,s,r,o),a=t.add(n);return i({focusedDate:e.add(n),startDate:jt(Qn(e,a,n,s,r,o),n,s)})}function uc(e,t,n,s,r,o){const i=es(n,s,r,o);let a=t.subtract(n);return i({focusedDate:e.subtract(n),startDate:jt(Qn(e,a,n,s,r,o),n,s)})}function Im(e,t,n,s,r,o,i){const a=es(s,r,o,i);if(!n&&!s.days)return a({focusedDate:e.add(Zo(s)),startDate:t});if(s.days)return dc(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 Tm(e,t,n,s,r,o,i){const a=es(s,r,o,i);if(!n&&!s.days)return a({focusedDate:e.subtract(Zo(s)),startDate:t});if(s.days)return uc(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 Cm(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 km=(e,t)=>t?Cm(t).includes(e):/\d/.test(e),fc=(e,t,n)=>!e||e.length!==1?!0:km(e,n)||t.includes(e),Am=(e,t,n)=>e.split("").filter(s=>fc(s,t,n)).join(""),Ea=new Map;function Om(e){let t=Ea.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:"/",Ea.set(e,t),t}var xa=e=>e!=null&&e.length===4,Lm=e=>e!=null&&parseFloat(e)<=12,Mm=e=>e!=null&&parseFloat(e)<=31;function Dm(e,t,n){const s=Rm(t,n);let{year:r,month:o,day:i}=Pm(s,e)??{};if(r!=null||o!=null||i!=null){const l=new Date;r||(r=l.getFullYear().toString()),o||(o=(l.getMonth()+1).toString()),i||(i=l.getDate().toString())}if(xa(r)||(r=$m(r)),xa(r)&&Lm(o)&&Mm(i))return new Pe(+r,+o,+i);const c=Date.parse(e);if(!isNaN(c)){const l=new Date(c);return new Pe(l.getFullYear(),l.getMonth()+1,l.getDate())}}function Rm(e,t){return new Ce(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 Pm(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 Sa(e,t,n){const s=Pt(_l(n));switch(e){case"thisWeek":return[St(s,t),fa(s,t)];case"thisMonth":return[et(s),s];case"thisQuarter":return[et(s).add({months:-((s.month-1)%3)}),s];case"thisYear":return[Kn(s),s];case"last3Days":return[s.add({days:-2}),s];case"last7Days":return[s.add({days:-6}),s];case"last14Days":return[s.add({days:-13}),s];case"last30Days":return[s.add({days:-29}),s];case"last90Days":return[s.add({days:-89}),s];case"lastMonth":return[et(s.add({months:-1})),vo(s.add({months:-1}))];case"lastQuarter":return[et(s.add({months:-((s.month-1)%3)-3})),vo(s.add({months:-((s.month-1)%3)-1}))];case"lastWeek":return[St(s,t).add({weeks:-1}),fa(s,t).add({weeks:-1})];case"lastYear":return[Kn(s.add({years:-1})),Fg(s.add({years:-1}))];default:throw new Error(`Invalid date range preset: ${e}`)}}var Vm=(e,t)=>e.ids?.label?.(t)??`datepicker:${e.id}:label:${t}`,Nm=e=>e.ids?.root??`datepicker:${e.id}`,Fm=(e,t)=>e.ids?.table?.(t)??`datepicker:${e.id}:table:${t}`,Eo=e=>e.ids?.content??`datepicker:${e.id}:content`,Ur=(e,t)=>e.ids?.cellTrigger?.(t)??`datepicker:${e.id}:cell-trigger:${t}`,Hm=(e,t)=>e.ids?.prevTrigger?.(t)??`datepicker:${e.id}:prev:${t}`,_m=(e,t)=>e.ids?.nextTrigger?.(t)??`datepicker:${e.id}:next:${t}`,Bm=(e,t)=>e.ids?.viewTrigger?.(t)??`datepicker:${e.id}:view:${t}`,hc=e=>e.ids?.clearTrigger??`datepicker:${e.id}:clear`,pc=e=>e.ids?.control??`datepicker:${e.id}:control`,$a=(e,t)=>e.ids?.input?.(t)??`datepicker:${e.id}:input:${t}`,gc=e=>e.ids?.trigger??`datepicker:${e.id}:trigger`,mc=e=>e.ids?.positioner??`datepicker:${e.id}:positioner`,vc=e=>e.ids?.monthSelect??`datepicker:${e.id}:month-select`,yc=e=>e.ids?.yearSelect??`datepicker:${e.id}:year-select`,Ia=(e,t)=>sf(Zt(e),`[data-part=table-cell-trigger][data-view=${t}][data-focus]:not([data-outside-range])`),Rs=e=>e.getById(gc(e)),Zt=e=>e.getById(Eo(e)),Bn=e=>nf(bc(e),"[data-part=input]"),Wm=e=>e.getById(yc(e)),jm=e=>e.getById(vc(e)),Um=e=>e.getById(hc(e)),Ta=e=>e.getById(mc(e)),bc=e=>e.getById(pc(e)),Ca=e=>{const t=Bn(e);if(t.length===0){Rs(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 Ps(e){const[t,n]=e;let s;return!t||!n?s=e:s=t.compare(n)<=0?e:[n,t],s}function Kt(e,t){const[n,s]=t;return!n||!s?!1:n.compare(e)<=0&&s.compare(e)>=0}function xs(e){return e.slice().filter(t=>t!=null).sort((t,n)=>t.compare(n))}function qm(e,t){return new Ce(e).formatToParts(new Date).map(n=>t[n.type]??n.value).join("")}var ka=e=>!Number.isNaN(e.day)&&!Number.isNaN(e.month)&&!Number.isNaN(e.year),Gm={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 zr(e,{year:"Switch to previous decade",month:"Switch to previous year",day:"Switch to previous month"})},nextTrigger(e){return zr(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 ot(e,t){return e?e==="day"?0:e==="month"?1:2:t||0}function Jo(e){return e===0?"day":e===1?"month":"year"}function Xo(e,t,n){return Jo(Yd(ot(e,0),ot(t,0),ot(n,2)))}function Ym(e,t){return ot(e,0)>ot(t,0)}function Km(e,t){return ot(e,0)<ot(t,0)}function wc(e,t,n){const s=ot(e,0)+1;return Xo(Jo(s),t,n)}function zm(e,t,n){const s=ot(e,0)-1;return Xo(Jo(s),t,n)}var Zm=["day","month","year"];function Jm(e){Zm.forEach(t=>e(t))}var Xm=np(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 f=tn(n.year),g=f.at(0).toString(),u=f.at(-1).toString();return{start:g,end:u,formatted:`${g} - ${u}`}}if(e==="month"){const f=new Ce(r,{year:"numeric",timeZone:o,calendar:n.calendar.identifier}),g=f.format(n.toDate(o)),u=f.format(s.toDate(o)),h=i==="range"?`${g} - ${u}`:g;return{start:g,end:u,formatted:h}}const a=new Ce(r,{month:"long",year:"numeric",timeZone:o,calendar:n.calendar.identifier}),c=a.format(n.toDate(o)),l=a.format(s.toDate(o)),p=i==="range"?`${c} - ${l}`:c;return{start:c,end:l,formatted:p}});function Qm(e,t){const{state:n,context:s,prop:r,send:o,computed:i,scope:a}=e,c=s.get("startValue"),l=i("endValue"),p=s.get("value"),f=s.get("focusedValue"),g=s.get("hoveredValue"),u=g?Ps([p[0],g]):[],h=!!r("disabled"),d=!!r("readOnly"),m=!!r("invalid"),b=i("isInteractive"),I=p.length===0,M=r("min"),R=r("max"),x=r("locale"),A=r("timeZone"),y=r("startOfWeek"),E=n.matches("focused"),C=n.matches("open"),O=r("selectionMode")==="range",w=r("selectionMode")==="multiple",L=r("isDateUnavailable"),D=r("maxSelectedDates"),V=w&&D!=null&&p.length>=D,H=s.get("currentPlacement"),K=H?vl(H):void 0,se=yl({...r("positioning"),placement:H}),Z=Om(x),z=Wa(Gm,r("translations"));function xe(T=c){const S=r("fixedWeeks")?6:void 0;return gm(T,x,S,y)}function xn(T={}){const{format:S}=T;return ym(x,S,f).map((v,$)=>{const N=$+1,Q=f.set({month:N}),B=He(Q,M,R);return{label:v,value:N,disabled:B}})}function Ye(){const T=xm(f,M,R);return bm(T).map(v=>({label:v.toString(),value:v,disabled:!Er(v,M?.year,R?.year)}))}function Ke(T){return va(T,L,x,M,R)}function kt(T){const S=c??qn(A,f.calendar);o({type:"FOCUS.SET",value:S.set({month:T})})}function Ut(T){const S=c??qn(A,f.calendar);o({type:"FOCUS.SET",value:S.set({year:T})})}function yt(T){const{value:S,disabled:v}=T,$=f.set({year:S}),Q=!tn(c.year).includes(S),B=Er(S,M?.year,R?.year),j=O&&Kt($,p),ie=O&&p[0]&&Rn($,p[0]),Me=O&&p[1]&&Rn($,p[1]),Ve=O&&u.length>0,re=Ve&&Kt($,u),Ne=Ve&&u[0]&&Rn($,u[0]),Fe=Ve&&u[1]&&Rn($,u[1]),rs={focused:f.year===T.value,selectable:B,outsideRange:Q,selected:!!p.find(os=>os&&os.year===S),valueText:S.toString(),inRange:j||re,firstInRange:!!ie,lastInRange:!!Me,inHoveredRange:!!re,firstInHoveredRange:!!Ne,lastInHoveredRange:!!Fe,value:$,get disabled(){return v||!rs.selectable}};return rs}function At(T){const{value:S,disabled:v}=T,$=f.set({month:S}),N=ya(x,A,f),Q=O&&Kt($,p),B=O&&p[0]&&Dn($,p[0]),j=O&&p[1]&&Dn($,p[1]),ie=O&&u.length>0,Me=ie&&Kt($,u),Ve=ie&&u[0]&&Dn($,u[0]),re=ie&&u[1]&&Dn($,u[1]),Ne={focused:f.month===T.value,selectable:!He($,M,R),selected:!!p.find(Fe=>Fe&&Fe.month===S&&Fe.year===f.year),valueText:N.format($.toDate(A)),inRange:Q||Me,firstInRange:!!B,lastInRange:!!j,inHoveredRange:!!Me,firstInHoveredRange:!!Ve,lastInHoveredRange:!!re,outsideRange:!1,value:$,get disabled(){return v||!Ne.selectable}};return Ne}function bt(T){const{value:S,disabled:v,visibleRange:$=i("visibleRange")}=T,N=ic(x,A,f),Q=Zo(i("visibleDuration")),B=r("outsideDaySelectable"),j=$.start.add(Q).subtract({days:1}),ie=He(S,$.start,j),Me=O&&Kt(S,p),Ve=O&&p[0]&&we(S,p[0]),re=O&&p[1]&&we(S,p[1]),Ne=O&&u.length>0,Fe=Ne&&Kt(S,u),rs=Ne&&u[0]&&we(S,u[0]),os=Ne&&u[1]&&we(S,u[1]),fi=p.some(hi=>hi!=null&&we(S,hi)),is={invalid:He(S,M,R),disabled:v||!B&&ie||He(S,M,R)||V&&!fi,selected:fi,unavailable:va(S,L,x,M,R)&&!v,outsideRange:ie,today:Rg(S,A),weekend:Wg(S,x),value:S,valueText:N.format(S.toDate(A)),get focused(){return f!=null&&we(S,f)&&(!is.outsideRange||B)},get selectable(){return!is.disabled&&!is.unavailable},inRange:Me||Fe,firstInRange:Ve,lastInRange:re,inHoveredRange:Fe,firstInHoveredRange:rs,lastInHoveredRange:os};return is}function Sn(T){const{view:S="day",id:v}=T;return[S,v].filter(Boolean).join(" ")}return{focused:E,open:C,disabled:h,invalid:m,readOnly:d,inline:!!r("inline"),numOfMonths:r("numOfMonths"),showWeekNumbers:!!r("showWeekNumbers"),selectionMode:r("selectionMode"),maxSelectedDates:D,isMaxSelected:V,view:s.get("view"),getRangePresetValue(T){return Sa(T,x,A)},getWeekNumber(T){const S=T[0];return S?ba(S,x):0},getDaysInWeek(T,S=c){return cc(T,S,x,y)},getOffset(T){const S=c.add(T),v=l.add(T),$=ya(x,A,f);return{visibleRange:{start:S,end:v},weeks:xe(S),visibleRangeText:{start:$.format(S.toDate(A)),end:$.format(v.toDate(A))}}},getMonthWeeks:xe,isUnavailable:Ke,weeks:xe(),weekDays:vm(c,y,A,x),visibleRangeText:i("visibleRangeText"),value:p,valueAsDate:p.filter(T=>T!=null).map(T=>T.toDate(A)),valueAsString:i("valueAsString"),focusedValue:f,focusedValueAsDate:f?.toDate(A),focusedValueAsString:r("format")(f,{locale:x,timeZone:A}),visibleRange:i("visibleRange"),selectToday(){const T=Te(qn(A,f.calendar),M,R);o({type:"VALUE.SET",value:[T]})},setValue(T){const S=T.map(v=>Te(v,M,R));o({type:"VALUE.SET",value:S})},setTime(T,S=0){const v=Array.from(p);let $=v[S];$&&("hour"in $||($=Ae($)),$=$.set({hour:T.hour??("hour"in $?$.hour:0),minute:T.minute??("minute"in $?$.minute:0),second:T.second??("second"in $?$.second:0),millisecond:T.millisecond??("millisecond"in $?$.millisecond:0)}),v[S]=Te($,M,R),o({type:"VALUE.SET",value:v}))},clearValue(T={}){const{focus:S=!0}=T;o({type:"VALUE.CLEAR",focus:S})},setFocusedValue(T){o({type:"FOCUS.SET",value:T})},setOpen(T){r("inline")||o({type:T?"OPEN":"CLOSE",replaces:"open"})},focusMonth:kt,focusYear:Ut,getYears:Ye,getMonths:xn,getYearsGrid(T={}){const{columns:S=1}=T,v=tn(c.year).map($=>({label:$.toString(),value:$,disabled:!Er($,M?.year,R?.year)}));return wi(v,S)},getDecade(){const T=tn(c.year);return{start:T.at(0),end:T.at(-1)}},getMonthsGrid(T={}){const{columns:S=1,format:v}=T;return wi(xn({format:v}),S)},format(T,S={month:"long",year:"numeric"}){return new Ce(x,{...S,calendar:T.calendar.identifier}).format(T.toDate(A))},setView(T){o({type:"VIEW.SET",view:T})},goToNext(){o({type:"GOTO.NEXT",view:s.get("view")})},goToPrev(){o({type:"GOTO.PREV",view:s.get("view")})},getRootProps(){return t.element({...J.root.attrs,dir:r("dir"),id:Nm(a),"data-state":C?"open":"closed","data-disabled":P(h),"data-readonly":P(d),"data-empty":P(I)})},getLabelProps(T={}){const{index:S=0}=T;return t.label({...J.label.attrs,id:Vm(a,S),dir:r("dir"),htmlFor:$a(a,S),"data-state":C?"open":"closed","data-index":S,"data-disabled":P(h),"data-readonly":P(d),"data-invalid":P(m)})},getControlProps(){return t.element({...J.control.attrs,dir:r("dir"),id:pc(a),"data-disabled":P(h),"data-placeholder-shown":P(I),"data-invalid":P(m)})},getRangeTextProps(){return t.element({...J.rangeText.attrs,dir:r("dir")})},getContentProps(){return t.element({...J.content.attrs,hidden:!C,dir:r("dir"),"data-state":C?"open":"closed","data-placement":H,"data-side":K,"data-inline":P(r("inline")),id:Eo(a),tabIndex:-1,role:"application","aria-label":z.content})},getTableProps(T={}){const{view:S="day",columns:v=S==="day"?7:4}=T,$=Sn(T);return t.element({...J.table.attrs,role:"grid","data-columns":v,"aria-label":i("visibleRangeText").formatted,id:Fm(a,$),"aria-readonly":ue(d),"aria-disabled":ue(h),"aria-multiselectable":ue(r("selectionMode")!=="single"),"data-view":S,dir:r("dir"),tabIndex:-1,onKeyDown(N){if(N.defaultPrevented||h)return;const Q={Enter(){b&&(S==="day"&&Ke(f)||S==="month"&&!At({value:f.month}).selectable||S==="year"&&!yt({value:f.year}).selectable||o({type:"TABLE.ENTER",view:S,columns:v,focus:!0}))},Space(j){Q.Enter?.()},ArrowLeft(){o({type:"TABLE.ARROW_LEFT",view:S,columns:v,focus:!0})},ArrowRight(){o({type:"TABLE.ARROW_RIGHT",view:S,columns:v,focus:!0})},ArrowUp(){o({type:"TABLE.ARROW_UP",view:S,columns:v,focus:!0})},ArrowDown(){o({type:"TABLE.ARROW_DOWN",view:S,columns:v,focus:!0})},PageUp(j){o({type:"TABLE.PAGE_UP",larger:j.shiftKey,view:S,columns:v,focus:!0})},PageDown(j){o({type:"TABLE.PAGE_DOWN",larger:j.shiftKey,view:S,columns:v,focus:!0})},Home(){o({type:"TABLE.HOME",view:S,columns:v,focus:!0})},End(){o({type:"TABLE.END",view:S,columns:v,focus:!0})}},B=Q[Jr(N,{dir:r("dir")})];B&&(B(N),N.preventDefault(),N.stopPropagation())},onPointerLeave(){o({type:"TABLE.POINTER_LEAVE"})},onPointerDown(){o({type:"TABLE.POINTER_DOWN",view:S})},onPointerUp(){o({type:"TABLE.POINTER_UP",view:S})}})},getTableHeadProps(T={}){const{view:S="day"}=T;return t.element({...J.tableHead.attrs,"aria-hidden":!0,dir:r("dir"),"data-view":S,"data-disabled":P(h)})},getTableHeaderProps(T={}){const{view:S="day"}=T;return t.element({...J.tableHeader.attrs,dir:r("dir"),"data-view":S,"data-disabled":P(h)})},getTableBodyProps(T={}){const{view:S="day"}=T;return t.element({...J.tableBody.attrs,"data-view":S,"data-disabled":P(h)})},getTableRowProps(T={}){const{view:S="day"}=T;return t.element({...J.tableRow.attrs,"aria-disabled":ue(h),"data-disabled":P(h),"data-view":S})},getWeekNumberHeaderCellProps(T={}){const{view:S="day"}=T;return t.element({...J.tableCell.attrs,scope:"col","aria-label":z.weekColumnHeader,"data-view":S,"data-type":"week-number","data-disabled":P(h)})},getWeekNumberCellProps(T){const{weekIndex:S,week:v}=T,$=v[0]?ba(v[0],x):0;return t.element({...J.tableCell.attrs,role:"rowheader","aria-label":z.weekNumberCell?.($),"data-view":"day","data-week-index":S,"data-type":"week-number","data-disabled":P(h)})},getDayTableCellState:bt,getDayTableCellProps(T){const{value:S}=T,v=bt(T);return t.element({...J.tableCell.attrs,role:"gridcell","aria-disabled":ue(!v.selectable),"aria-selected":v.selected||v.inRange,"aria-invalid":ue(v.invalid),"aria-current":v.today?"date":void 0,"data-value":S.toString()})},getDayTableCellTriggerProps(T){const{value:S}=T,v=bt(T);return t.element({...J.tableCellTrigger.attrs,id:Ur(a,S.toString()),role:"button",dir:r("dir"),tabIndex:h?-1:v.focused?0:-1,"aria-label":z.dayCell(v),"aria-disabled":ue(!v.selectable),"aria-invalid":ue(v.invalid),"data-disabled":P(!v.selectable),"data-selectable":P(v.selectable),"data-selected":P(v.selected),"data-value":S.toString(),"data-view":"day","data-today":P(v.today),"data-focus":P(v.focused),"data-unavailable":P(v.unavailable),"data-range-start":P(v.firstInRange),"data-range-end":P(v.lastInRange),"data-in-range":P(v.inRange),"data-outside-range":P(v.outsideRange),"data-weekend":P(v.weekend),"data-in-hover-range":P(v.inHoveredRange),"data-hover-range-start":P(v.firstInHoveredRange),"data-hover-range-end":P(v.lastInHoveredRange),onClick($){$.defaultPrevented||b&&v.selectable&&o({type:"CELL.CLICK",cell:"day",value:S})},onPointerMove:O?$=>{if($.pointerType==="touch"||!v.selectable)return;const N=!a.isActiveElement($.currentTarget);g&&Dg(S,g)||o({type:"CELL.POINTER_MOVE",cell:"day",value:S,focus:N,outsideRange:v.outsideRange})}:void 0})},getMonthTableCellState:At,getMonthTableCellProps(T){const{value:S,columns:v}=T,$=At(T);return t.element({...J.tableCell.attrs,dir:r("dir"),colSpan:v,role:"gridcell","aria-selected":ue($.selected||$.inRange),"data-selected":P($.selected),"aria-disabled":ue(!$.selectable),"data-value":S})},getMonthTableCellTriggerProps(T){const{value:S}=T,v=At(T);return t.element({...J.tableCellTrigger.attrs,id:Ur(a,S.toString()),role:"button",dir:r("dir"),tabIndex:h?-1:v.focused?0:-1,"aria-label":v.valueText,"aria-disabled":ue(!v.selectable),"data-disabled":P(!v.selectable),"data-selectable":P(v.selectable),"data-selected":P(v.selected),"data-value":S,"data-view":"month","data-focus":P(v.focused),"data-outside-range":P(v.outsideRange),"data-range-start":P(v.firstInRange),"data-range-end":P(v.lastInRange),"data-in-range":P(v.inRange),"data-in-hover-range":P(v.inHoveredRange),"data-hover-range-start":P(v.firstInHoveredRange),"data-hover-range-end":P(v.lastInHoveredRange),onClick($){$.defaultPrevented||b&&v.selectable&&o({type:"CELL.CLICK",cell:"month",value:S})},onPointerMove:O?$=>{if($.pointerType==="touch"||!v.selectable)return;const N=!a.isActiveElement($.currentTarget);g&&v.value&&Dn(v.value,g)||o({type:"CELL.POINTER_MOVE",cell:"month",value:v.value,focus:N})}:void 0})},getYearTableCellState:yt,getYearTableCellProps(T){const{value:S,columns:v}=T,$=yt(T);return t.element({...J.tableCell.attrs,dir:r("dir"),colSpan:v,role:"gridcell","aria-selected":ue($.selected||$.inRange),"data-selected":P($.selected),"aria-disabled":ue(!$.selectable),"data-value":S})},getYearTableCellTriggerProps(T){const{value:S}=T,v=yt(T);return t.element({...J.tableCellTrigger.attrs,id:Ur(a,S.toString()),role:"button",dir:r("dir"),tabIndex:h?-1:v.focused?0:-1,"aria-label":v.valueText,"aria-disabled":ue(!v.selectable),"data-disabled":P(!v.selectable),"data-selectable":P(v.selectable),"data-selected":P(v.selected),"data-value":S,"data-view":"year","data-focus":P(v.focused),"data-outside-range":P(v.outsideRange),"data-range-start":P(v.firstInRange),"data-range-end":P(v.lastInRange),"data-in-range":P(v.inRange),"data-in-hover-range":P(v.inHoveredRange),"data-hover-range-start":P(v.firstInHoveredRange),"data-hover-range-end":P(v.lastInHoveredRange),onClick($){$.defaultPrevented||b&&v.selectable&&o({type:"CELL.CLICK",cell:"year",value:S})},onPointerMove:O?$=>{if($.pointerType==="touch"||!v.selectable||v.outsideRange)return;const N=!a.isActiveElement($.currentTarget);g&&v.value&&Rn(v.value,g)||o({type:"CELL.POINTER_MOVE",cell:"year",value:v.value,focus:N})}:void 0})},getNextTriggerProps(T={}){const{view:S="day"}=T,v=h||!i("isNextVisibleRangeValid");return t.button({...J.nextTrigger.attrs,dir:r("dir"),id:_m(a,S),type:"button","aria-label":z.nextTrigger(S),disabled:v,"data-disabled":P(v),onClick($){$.defaultPrevented||o({type:"GOTO.NEXT",view:S})}})},getPrevTriggerProps(T={}){const{view:S="day"}=T,v=h||!i("isPrevVisibleRangeValid");return t.button({...J.prevTrigger.attrs,dir:r("dir"),id:Hm(a,S),type:"button","aria-label":z.prevTrigger(S),disabled:v,"data-disabled":P(v),onClick($){$.defaultPrevented||o({type:"GOTO.PREV",view:S})}})},getClearTriggerProps(){return t.button({...J.clearTrigger.attrs,id:hc(a),dir:r("dir"),type:"button","aria-label":z.clearTrigger,hidden:!p.length,onClick(T){T.defaultPrevented||b&&o({type:"VALUE.CLEAR"})}})},getTriggerProps(){return t.button({...J.trigger.attrs,id:gc(a),dir:r("dir"),type:"button","data-placement":H,"data-side":K,"aria-label":z.trigger(C),"aria-controls":Eo(a),"aria-expanded":C,"data-state":C?"open":"closed","data-placeholder-shown":P(I),"aria-haspopup":"grid",disabled:h,onClick(T){T.defaultPrevented||b&&o({type:"TRIGGER.CLICK"})}})},getViewProps(T={}){const{view:S="day"}=T;return t.element({...J.view.attrs,"data-view":S,hidden:s.get("view")!==S})},getViewTriggerProps(T={}){const{view:S="day"}=T,v=wc(S,r("minView"),r("maxView")),$=v!==S,N=h||!$;return t.button({...J.viewTrigger.attrs,"data-view":S,dir:r("dir"),id:Bm(a,S),type:"button",disabled:N,"data-disabled":P(N),"aria-label":z.viewTrigger(S,$?v:void 0),onClick(Q){Q.defaultPrevented||b&&o({type:"VIEW.TOGGLE",src:"viewTrigger"})}})},getViewControlProps(T={}){const{view:S="day"}=T;return t.element({...J.viewControl.attrs,"data-view":S,dir:r("dir")})},getInputProps(T={}){const{index:S=0,fixOnBlur:v=!0}=T;return t.input({...J.input.attrs,id:$a(a,S),autoComplete:"off",autoCorrect:"off",spellCheck:"false",dir:r("dir"),name:r("name"),"data-index":S,"data-state":C?"open":"closed","data-placeholder-shown":P(I),readOnly:d,disabled:h,required:r("required"),"aria-invalid":ue(m),"data-invalid":P(m),placeholder:r("placeholder")||qm(x,z.placeholder(x)),defaultValue:i("valueAsString")[S],onBeforeInput($){const{data:N}=Mo($);fc(N,Z,x)||$.preventDefault()},onClick($){$.defaultPrevented||r("openOnClick")&&b&&o({type:"OPEN",src:"input.click"})},onFocus(){o({type:"INPUT.FOCUS",index:S})},onBlur($){const N=$.currentTarget.value.trim();o({type:"INPUT.BLUR",value:N,index:S,fixOnBlur:v})},onKeyDown($){if($.defaultPrevented||!b)return;const Q={Enter(B){Iu(B)||Ke(f)||B.currentTarget.value.trim()!==""&&o({type:"INPUT.ENTER",value:B.currentTarget.value,index:S})}}[$.key];Q&&(Q($),$.preventDefault())},onInput($){const N=$.currentTarget.value;o({type:"INPUT.CHANGE",value:Am(N,Z,x),index:S})}})},getMonthSelectProps(){return t.select({...J.monthSelect.attrs,id:vc(a),"aria-label":z.monthSelect,disabled:h,dir:r("dir"),defaultValue:c.month,onChange(T){kt(Number(T.currentTarget.value))}})},getYearSelectProps(){return t.select({...J.yearSelect.attrs,id:yc(a),disabled:h,"aria-label":z.yearSelect,dir:r("dir"),defaultValue:c.year,onChange(T){Ut(Number(T.currentTarget.value))}})},getPositionerProps(){return t.element({id:mc(a),...J.positioner.attrs,dir:r("dir"),style:se.floating})},getPresetTriggerProps(T){const S=Array.isArray(T.value)?T.value:Sa(T.value,x,A),v=S.filter($=>$!=null).map($=>$.toDate(A).toDateString());return t.button({...J.presetTrigger.attrs,"aria-label":z.presetTrigger(v),type:"button",onClick($){$.defaultPrevented||b&&o({type:"PRESET.CLICK",value:S})}})}}}var qr="__live-region-debug__",ev="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;",tv=100,nv=200,sv={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 rv(e={}){const{level:t="polite",document:n=document,root:s,delay:r=0,debug:o=!1}=e,i=n.defaultView??window,a=()=>(typeof s=="function"?s():s)??n.body;let c;function l(){if(!o)return;let m=n.getElementById(qr);return m||(m=n.createElement("div"),m.id=qr,m.dataset.liveAnnouncerDebug="true",m.setAttribute("aria-hidden","true"),m.style.cssText=ev,a().appendChild(m),m)}function p(){const m=n.createElement("span");return m.dataset.liveAnnouncer="true",m.setAttribute("aria-live",t),m.setAttribute("aria-atomic","true"),m.setAttribute("role",t==="assertive"?"alert":"status"),Object.assign(m.style,sv),a().appendChild(m),f=Date.now()+nv,m}let f=0,g=p();function u(){i.clearTimeout(c),c=void 0}function h(m,b=r){u(),g?.isConnected||(g=p());const I=g;I.textContent="",c=i.setTimeout(()=>{c=void 0,I.textContent=m;const M=l();M&&(M.textContent=m)},Math.max(b,tv,f-Date.now()))}function d(){u(),g?.remove(),g=null,o&&n.getElementById(qr)?.remove()}return{announce:h,cancel:u,destroy:d,toJSON(){return"live-region"}}}var{and:ge}=$l();function ov(e,t){if(e?.length!==t?.length)return!1;const n=Math.max(e.length,t.length);for(let s=0;s<n;s++)if(!Et(e[s],t[s]))return!1;return!0}function Ss(e,t){return e.map(n=>n==null?"":t("format")(n,{locale:t("locale"),timeZone:t("timeZone")}))}var iv=Il({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 h=new Intl.DateTimeFormat(t).resolvedOptions().calendar;h!=="gregory"&&h!=="iso8601"&&(o=e.createCalendar(h))}const i=u=>!o||u.calendar.identifier===o.identifier?u:le(u,o),a=e.defaultValue?xs(e.defaultValue).map(u=>Te(i(u),e.min,e.max)):void 0,c=e.value?xs(e.value).map(u=>Te(i(u),e.min,e.max)):void 0;let l=e.focusedValue||e.defaultFocusedValue||c?.[0]||a?.[0]||qn(n,o);l=Te(i(l),e.min,e.max);const p=e.minView||"day",f=e.maxView||"year",g=Xo(e.defaultView||e.view||p,p,f);return{locale:t,numOfMonths:r,timeZone:n,selectionMode:s,minView:p,maxView:f,outsideDaySelectable:!1,closeOnSelect:!0,format(u,{locale:h,timeZone:d}){return new Ce(h,{timeZone:d,day:"2-digit",month:"2-digit",year:"numeric",calendar:o?.identifier}).format(u.toDate(d))},parse(u,{locale:h,timeZone:d}){return Dm(u,h,d)},...e,focusedValue:typeof e.focusedValue>"u"?void 0:l,defaultFocusedValue:l,value:c,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:Et,hash:s=>s.toString(),sync:!0,onChange(s){const r=n(),o=r.get("view"),i=r.get("value"),a=Ss(i,e);e("onFocusChange")?.({value:i,valueAsString:a,view:o,focusedValue:s})}})),value:t(()=>({defaultValue:e("defaultValue"),value:e("value"),isEqual:ov,hash:s=>s.map(r=>r?.toString()??"").join(","),onChange(s){const r=n(),o=Ss(s,e);e("onValueChange")?.({value:s,valueAsString:o,view:r.get("view")})}})),inputValue:t(()=>({defaultValue:""})),activeIndex:t(()=>({defaultValue:0,sync:!0})),hoveredValue:t(()=>({defaultValue:null,isEqual:Et})),view:t(()=>({defaultValue:e("defaultView"),value:e("view"),onChange(s){e("onViewChange")?.({view:s})}})),startValue:t(()=>{const s=e("focusedValue")||e("defaultFocusedValue");return{defaultValue:ma(s,"start",{months:e("numOfMonths")},e("locale")),isEqual:Et,hash:r=>r.toString()}}),currentPlacement:t(()=>({defaultValue:void 0})),restoreFocus:t(()=>({defaultValue:!1}))}},computed:{isInteractive:({prop:e})=>!e("disabled")&&!e("readOnly"),visibleDuration:({prop:e})=>({months:e("numOfMonths")}),endValue:({context:e,computed:t})=>rc(e.get("startValue"),t("visibleDuration")),visibleRange:({context:e,computed:t})=>({start:e.get("startValue"),end:t("endValue")}),visibleRangeText:({context:e,prop:t,computed:n})=>Xm({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})=>!um(e.get("startValue"),t("min"),t("max")),isNextVisibleRangeValid:({prop:e,computed:t})=>!fm(t("endValue"),e("min"),e("max")),valueAsString:({context:e,prop:t})=>Ss(e.get("value"),t)},effects:["setupLiveRegion"],watch({track:e,prop:t,context:n,action:s,computed:r}){e([()=>t("locale")],()=>{s(["setStartValue","syncInputElement"])}),e([()=>n.hash("focusedValue")],()=>{s(["setStartValue","focusActiveCellIfNeeded","setHoveredValueIfKeyboard"])}),e([()=>n.hash("startValue")],()=>{s(["syncMonthSelectElement","syncYearSelectElement","invokeOnVisibleRangeChange"])}),e([()=>n.get("inputValue")],()=>{s(["syncInputValue"])}),e([()=>n.hash("value")],()=>{s(["syncInputElement"])}),e([()=>r("valueAsString").toString()],()=>{s(["announceValueText"])}),e([()=>n.get("view")],()=>{s(["focusActiveCell"])}),e([()=>t("open")],()=>{s(["toggleVisibility"])})},on:{"VALUE.SET":{actions:["setDateValue","setFocusedDate"]},"VIEW.SET":{actions:["setView"]},"FOCUS.SET":{actions:["setFocusedDate"]},"VALUE.CLEAR":{actions:["clearDateValue","clearFocusedDate","setActiveIndexToStart","clearHoveredDate","focusFirstInputElement"]},"INPUT.CHANGE":[{guard:"isInputValueEmpty",actions:["setInputValue","clearDateValue","clearFocusedDate"]},{actions:["setInputValue","focusParsedDate"]}],"INPUT.ENTER":{actions:["focusParsedDate","selectFocusedDate"]},"INPUT.FOCUS":{actions:["setActiveIndex"]},"INPUT.BLUR":[{guard:"shouldFixOnBlur",actions:["setActiveIndexToStart","selectParsedDate"]},{actions:["setActiveIndexToStart"]}],"PRESET.CLICK":[{guard:"isOpenControlled",actions:["setDateValue","setFocusedDate","invokeOnClose"]},{target:"focused",actions:["setDateValue","setFocusedDate","focusInputElement"]}],"GOTO.NEXT":[{guard:"isYearView",actions:["focusNextDecade","announceVisibleRange"]},{guard:"isMonthView",actions:["focusNextYear","announceVisibleRange"]},{actions:["focusNextPage"]}],"GOTO.PREV":[{guard:"isYearView",actions:["focusPreviousDecade","announceVisibleRange"]},{guard:"isMonthView",actions:["focusPreviousYear","announceVisibleRange"]},{actions:["focusPreviousPage"]}]},states:{idle:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell"]},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}]}},focused:{tags:["closed"],on:{"CONTROLLED.OPEN":{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell"]},"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}],OPEN:[{guard:"isOpenControlled",actions:["invokeOnOpen"]},{target:"open",actions:["resetView","focusFirstSelectedDate","focusActiveCell","invokeOnOpen"]}]}},open:{tags:["open"],entry:["resumeRangeSelection"],effects:["trackDismissableElement","trackPositioning"],exit:["clearHoveredDate"],on:{"CONTROLLED.CLOSE":[{guard:ge("shouldRestoreFocus","isInteractOutsideEvent"),target:"focused",actions:["restoreFocusToTrigger"]},{guard:"shouldRestoreFocus",target:"focused",actions:["restoreFocusToInput"]},{target:"idle"}],"CELL.CLICK":[{guard:"isAboveMinView",actions:["setFocusedValueForView","setPreviousView"]},{guard:ge("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","resetSelection","setActiveIndexToEnd"]},{guard:ge("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","setRestoreFocus"]},{guard:ge("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","restoreFocusToInput"]},{guard:ge("isRangePicker","isSelectingEndDate"),actions:["setFocusedDate","setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setFocusedDate","setSelectedDate","setActiveIndexToEnd"]},{guard:ge("isMultiPicker","canSelectDate"),actions:["setFocusedDate","toggleSelectedDate"]},{guard:"isMultiPicker",actions:["setFocusedDate"]},{guard:ge("closeOnSelect","isOpenControlled"),actions:["setFocusedDate","setSelectedDate","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["setFocusedDate","setSelectedDate","invokeOnClose","restoreFocusToInput"]},{actions:["setFocusedDate","setSelectedDate"]}],"CELL.POINTER_MOVE":[{guard:ge("isRangePicker","isSelectingEndDate","isDayPointerMoveOutsideVisibleMonth"),actions:["setHoveredDate"]},{guard:ge("isRangePicker","isSelectingEndDate"),actions:["setHoveredDate","setFocusedDate"]}],"TABLE.POINTER_LEAVE":{guard:"isRangePicker",actions:["clearHoveredDate"]},"TABLE.POINTER_DOWN":{actions:["disableTextSelection"]},"TABLE.POINTER_UP":{actions:["enableTextSelection"]},"TABLE.ESCAPE":[{guard:"isOpenControlled",actions:["focusFirstSelectedDate","invokeOnClose"]},{target:"focused",actions:["focusFirstSelectedDate","invokeOnClose","restoreFocusToTrigger"]}],"TABLE.ENTER":[{guard:"isAboveMinView",actions:["setPreviousView"]},{guard:ge("isRangePicker","hasSelectedRange"),actions:["setActiveIndexToStart","resetSelection","setActiveIndexToEnd","focusNextDay"]},{guard:ge("isRangePicker","isSelectingEndDate","closeOnSelect","isOpenControlled"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose"]},{guard:ge("isRangePicker","isSelectingEndDate","closeOnSelect"),target:"focused",actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate","invokeOnClose","restoreFocusToInput"]},{guard:ge("isRangePicker","isSelectingEndDate"),actions:["setSelectedDate","setActiveIndexToStart","clearHoveredDate"]},{guard:"isRangePicker",actions:["setSelectedDate","setActiveIndexToEnd","focusNextDay"]},{guard:ge("isMultiPicker","canSelectDate"),actions:["toggleSelectedDate"]},{guard:"isMultiPicker"},{guard:ge("closeOnSelect","isOpenControlled"),actions:["selectFocusedDate","invokeOnClose"]},{guard:"closeOnSelect",target:"focused",actions:["selectFocusedDate","invokeOnClose","restoreFocusToInput"]},{actions:["selectFocusedDate"]}],"TABLE.ARROW_RIGHT":[{guard:"isMonthView",actions:["focusNextMonth"]},{guard:"isYearView",actions:["focusNextYear"]},{actions:["focusNextDay","setHoveredDate"]}],"TABLE.ARROW_LEFT":[{guard:"isMonthView",actions:["focusPreviousMonth"]},{guard:"isYearView",actions:["focusPreviousYear"]},{actions:["focusPreviousDay"]}],"TABLE.ARROW_UP":[{guard:"isMonthView",actions:["focusPreviousMonthColumn"]},{guard:"isYearView",actions:["focusPreviousYearColumn"]},{actions:["focusPreviousWeek"]}],"TABLE.ARROW_DOWN":[{guard:"isMonthView",actions:["focusNextMonthColumn"]},{guard:"isYearView",actions:["focusNextYearColumn"]},{actions:["focusNextWeek"]}],"TABLE.PAGE_UP":{actions:["focusPreviousSection"]},"TABLE.PAGE_DOWN":{actions:["focusNextSection"]},"TABLE.HOME":[{guard:"isMonthView",actions:["focusFirstMonth"]},{guard:"isYearView",actions:["focusFirstYear"]},{actions:["focusSectionStart"]}],"TABLE.END":[{guard:"isMonthView",actions:["focusLastMonth"]},{guard:"isYearView",actions:["focusLastYear"]},{actions:["focusSectionEnd"]}],"TRIGGER.CLICK":[{guard:"isOpenControlled",actions:["invokeOnClose"]},{target:"focused",actions:["invokeOnClose"]}],"VIEW.TOGGLE":{actions:["setNextView"]},INTERACT_OUTSIDE:[{guard:"isOpenControlled",actions:["setActiveIndexToStart","invokeOnClose"]},{guard:"shouldRestoreFocus",target:"focused",actions:["setActiveIndexToStart","invokeOnClose","restoreFocusToTrigger"]},{target:"idle",actions:["setActiveIndexToStart","invokeOnClose"]}],CLOSE:[{guard:"isOpenControlled",actions:["setActiveIndexToStart","invokeOnClose"]},{target:"idle",actions:["setActiveIndexToStart","invokeOnClose"]}]}}},implementations:{guards:{isAboveMinView:({context:e,prop:t})=>Ym(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=Wn(e,s.value??t.get("focusedValue"));return o.some(c=>Et(c,i))?!0:o.length<r},shouldRestoreFocus:({context:e})=>!!e.get("restoreFocus"),isSelectingEndDate:({context:e})=>e.get("activeIndex")===1,closeOnSelect:({prop:e})=>!!e("closeOnSelect"),isOpenControlled:({prop:e})=>e("open")!=null||!!e("inline"),isInteractOutsideEvent:({event:e})=>e.previousEvent?.type==="INTERACT_OUTSIDE",isInputValueEmpty:({event:e})=>e.value.trim()==="",shouldFixOnBlur:({event:e})=>!!e.fixOnBlur,isDayPointerMoveOutsideVisibleMonth:({event:e})=>e.cell==="day"&&e.outsideRange===!0},effects:{trackPositioning({context:e,prop:t,scope:n}){if(t("inline"))return;e.get("currentPlacement")||e.set("currentPlacement",t("positioning").placement);const s=bc(n);return io(s,()=>Ta(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",rv({level:"assertive",document:n})),()=>t.get("announcer")?.destroy?.()},trackDismissableElement({scope:e,send:t,context:n,prop:s}){return s("inline")?void 0:kl(()=>Zt(e),{type:"popover",defer:!0,getRootNode:e.getRootNode,layerStyleTargets:[()=>Ta(e)],exclude:[...Bn(e),Rs(e),Um(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=wc(e.get("view"),t("minView"),t("maxView"));e.set("view",n)},setPreviousView({context:e,prop:t}){const n=zm(e.get("view"),t("minView"),t("maxView"));e.set("view",n)},setView({context:e,event:t}){e.set("view",t.view)},setRestoreFocus({context:e}){e.set("restoreFocus",!0)},announceValueText({context:e,prop:t,refs:n}){const s=e.get("value"),r=t("locale"),o=t("timeZone");let i;if(t("selectionMode")==="range"){const[a,c]=s;a&&c?i=Es(a,c,r,o):a?i=Es(a,null,r,o):c?i=Es(c,null,r,o):i=""}else i=s.map(a=>Es(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}){tf({target:Zt(e),doc:e.getDoc()})},enableTextSelection({scope:e}){sl({doc:e.getDoc(),target:Zt(e)})},focusFirstSelectedDate(e){const{context:t}=e;t.get("value").length&&te(e,t.get("value")[0])},syncInputElement({scope:e,computed:t}){fe(()=>{Bn(e).forEach((s,r)=>{cs(s,t("valueAsString")[r]||"")})})},setFocusedDate(e){const{event:t}=e,n=Array.isArray(t.value)?t.value[0]:t.value;te(e,n)},setFocusedValueForView(e){const{context:t,event:n}=e;te(e,t.get("focusedValue").set({[t.get("view")]:n.value}))},focusNextMonth(e){const{context:t}=e;te(e,t.get("focusedValue").add({months:1}))},focusPreviousMonth(e){const{context:t}=e;te(e,t.get("focusedValue").subtract({months:1}))},setDateValue({context:e,event:t,prop:n}){if(!Array.isArray(t.value))return;const s=t.value.map(r=>Te(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=Wn(e,n.value??t.get("focusedValue"));s[r]=$s(o,i),t.set("value",Ps(s))},resetSelection(e){const{context:t,event:n}=e,s=t.get("value")[0],r=Wn(e,n.value??t.get("focusedValue"));t.set("value",[$s(s,r)])},toggleSelectedDate(e){const{context:t,event:n}=e,s=Wn(e,n.value??t.get("focusedValue")),r=t.get("value"),o=r.findIndex(i=>Et(i,s));if(o===-1){const i=[...r,s];t.set("value",xs(i))}else{const i=Array.from(r);i.splice(o,1),t.set("value",xs(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]=$s(r,o),e.set("value",Ps(n));const i=t("valueAsString");e.set("inputValue",i[s])},focusPreviousDay(e){const{context:t}=e,n=t.get("focusedValue").subtract({days:1});te(e,n)},focusNextDay(e){const{context:t}=e,n=t.get("focusedValue").add({days:1});te(e,n)},focusPreviousWeek(e){const{context:t}=e,n=t.get("focusedValue").subtract({weeks:1});te(e,n)},focusNextWeek(e){const{context:t}=e,n=t.get("focusedValue").add({weeks:1});te(e,n)},focusNextPage(e){const{context:t,computed:n,prop:s}=e,r=dc(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),s("locale"),s("min"),s("max"));Is(e,r)},focusPreviousPage(e){const{context:t,computed:n,prop:s}=e,r=uc(t.get("focusedValue"),t.get("startValue"),n("visibleDuration"),s("locale"),s("min"),s("max"));Is(e,r)},focusSectionStart(e){const{context:t}=e;te(e,t.get("startValue").copy())},focusSectionEnd(e){const{computed:t}=e;te(e,t("endValue").copy())},focusNextSection(e){const{context:t,event:n,computed:s,prop:r}=e,o=Im(t.get("focusedValue"),t.get("startValue"),n.larger,s("visibleDuration"),r("locale"),r("min"),r("max"));o&&Is(e,o)},focusPreviousSection(e){const{context:t,event:n,computed:s,prop:r}=e,o=Tm(t.get("focusedValue"),t.get("startValue"),n.larger,s("visibleDuration"),r("locale"),r("min"),r("max"));o&&Is(e,o)},focusNextYear(e){const{context:t}=e,n=t.get("focusedValue").add({years:1});te(e,n)},focusPreviousYear(e){const{context:t}=e,n=t.get("focusedValue").subtract({years:1});te(e,n)},focusNextDecade(e){const{context:t}=e,n=t.get("focusedValue").add({years:10});te(e,n)},focusPreviousDecade(e){const{context:t}=e,n=t.get("focusedValue").subtract({years:10});te(e,n)},clearFocusedDate(e){const{context:t,prop:n}=e,s=t.get("focusedValue").calendar;te(e,qn(n("timeZone"),s))},focusPreviousMonthColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").subtract({months:n.columns});te(e,s)},focusNextMonthColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").add({months:n.columns});te(e,s)},focusPreviousYearColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").subtract({years:n.columns});te(e,s)},focusNextYearColumn(e){const{context:t,event:n}=e,s=t.get("focusedValue").add({years:n.columns});te(e,s)},focusFirstMonth(e){const{context:t}=e,n=t.get("focusedValue"),s=n.calendar.getMinimumMonthInYear?.(n)??1;te(e,n.set({month:s}))},focusLastMonth(e){const{context:t}=e,n=t.get("focusedValue"),s=n.calendar.getMonthsInYear(n);te(e,n.set({month:s}))},focusFirstYear(e){const{context:t}=e,n=tn(t.get("focusedValue").year),s=t.get("focusedValue").set({year:n[0]});te(e,s)},focusLastYear(e){const{context:t}=e,n=tn(t.get("focusedValue").year),s=t.get("focusedValue").set({year:n[n.length-1]});te(e,s)},setActiveIndex({context:e,event:t}){e.set("activeIndex",t.index)},setActiveIndexToEnd({context:e}){e.set("activeIndex",1)},setActiveIndexToStart({context:e}){e.set("activeIndex",0)},resumeRangeSelection({context:e,prop:t}){t("selectionMode")==="range"&&e.get("value").length===1&&e.set("activeIndex",1)},focusActiveCell({scope:e,context:t,event:n}){n.src!=="input.click"&&fe(()=>{const s=t.get("view");Ia(e,s)?.focus({preventScroll:!0})})},focusActiveCellIfNeeded({scope:e,context:t,event:n}){n.focus&&fe(()=>{const s=t.get("view");Ia(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=Zt(e),s=av(t);fe(()=>{$i(e.getActiveElement(),[n])||Rs(e)?.focus(s)})},focusFirstInputElement({scope:e,event:t}){t.focus!==!1&&fe(()=>{const[n]=Bn(e);(n??Rs(e))?.focus({preventScroll:!0})})},focusInputElement({scope:e}){fe(()=>Ca(e))},restoreFocusToInput({scope:e}){const t=Zt(e);fe(()=>{$i(e.getActiveElement(),[t])||Ca(e)})},syncMonthSelectElement({scope:e,context:t}){const n=jm(e);cs(n,t.get("startValue").month.toString())},syncYearSelectElement({scope:e,context:t}){const n=Wm(e);cs(n,t.get("startValue").year.toString())},setInputValue({context:e,event:t}){e.get("activeIndex")===t.index&&e.set("inputValue",t.value)},syncInputValue({scope:e,context:t,event:n}){queueMicrotask(()=>{const s=Bn(e),r=n.index??t.get("activeIndex");cs(s[r],t.get("inputValue"))})},focusParsedDate(e){const{event:t,prop:n}=e;if(t.index==null)return;const r=n("parse")(t.value,{locale:n("locale"),timeZone:n("timeZone")});!r||!ka(r)||te(e,r)},selectParsedDate({context:e,event:t,prop:n}){if(t.index==null)return;let r=n("parse")(t.value,{locale:n("locale"),timeZone:n("timeZone")});if((!r||!ka(r))&&t.value&&(r=e.get("focusedValue").copy()),!r)return;r=Te(r,n("min"),n("max"));const o=Array.from(e.get("value"));o[t.index]=$s(o[t.index],r);const i=Ps(o);e.set("value",i);const a=Ss(i,n);e.set("inputValue",a[t.index])},resetView({context:e}){e.set("view",e.initial("view"))},setStartValue({context:e,computed:t,prop:n}){const s=e.get("focusedValue");if(!He(s,e.get("startValue"),t("endValue")))return;const o=ma(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})}}}}),Wn=(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 Jm(i=>{Km(i,s("minView"))&&(o=o.set({[i]:i==="day"?1:0}))}),o},$s=(e,t)=>{if(!e||!("hour"in e))return t;const n="timeZone"in e;let s=t;return"hour"in t||(n?s=zl(Ae(t),e.timeZone):s=Ae(t)),s.set({hour:e.hour,minute:e.minute,second:e.second,millisecond:e.millisecond})};function te(e,t){const{context:n,prop:s,computed:r}=e;if(!t)return;const o=Wn(e,t);if(Et(n.get("focusedValue"),o))return;const a=es(r("visibleDuration"),s("locale"),s("min"),s("max"))({focusedDate:o,startDate:n.get("startValue")});n.set("startValue",a.startDate),n.set("focusedValue",a.focusedDate)}function Is(e,t){const{context:n}=e;n.set("startValue",t.startDate);const s=n.get("focusedValue");Et(s,t.focusedDate)||n.set("focusedValue",t.focusedDate)}function av(e){return e.focusVisible??e.previousEvent?.focusVisible?{preventScroll:!0,focusVisible:!0}:{preventScroll:!0}}function Ec(e){return Array.isArray(e)?e.map(t=>Ec(t)):e instanceof Date?new Pe(e.getFullYear(),e.getMonth()+1,e.getDate()):nm(e)}const Gr=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>`,Yr=e=>{try{return/^\d{4}-\d{2}-\d{2}$/.test(e)?Ec(e):void 0}catch{return}};function lv(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>
|
|
93
|
-
<div class="date-positioner" popover="manual"><section class="date-popover">
|
|
94
|
-
<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>
|
|
95
|
-
<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>
|
|
96
|
-
<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>
|
|
97
|
-
<div class="date-calendar"><div class="date-navigation"><button type="button" class="icon-button date-prev">${Gr("left")}</button><button type="button" class="date-view"></button><button type="button" class="icon-button date-next">${Gr("right")}</button></div><div class="date-grids"></div></div>
|
|
98
|
-
<footer class="date-footer"><span class="date-status" role="status"></span><button id="apply-dates" class="primary-button" type="button">Apply range ${Gr("right")}</button></footer>
|
|
99
|
-
</section></div>`;const s=d=>e.querySelector(d),r=s(".date-trigger"),o=s(".date-positioner"),i=s(".date-popover"),a=[s("#from-date"),s("#to-date")],c=s("#apply-dates"),l=new Ml(iv,{id:"timeline-dates",selectionMode:"range",closeOnSelect:!1,fixedWeeks:!0,outsideDaySelectable:!0,locale:navigator.language,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,format:d=>d.toString(),parse:Yr,placeholder:"YYYY-MM-DD",positioning:{placement:"top-end",strategy:"fixed",gutter:12,slide:!0},onOpenChange({open:d}){d&&n()}}),p=()=>Qm(l.service,Al),f=["day","month","year"].map(d=>{const m=document.createElement("table");m.dataset.calendarView=d;const b=m.createTHead(),I=b.insertRow();if(d==="day")for(let A=0;A<7;A++)I.append(document.createElement("th"));const M=m.createTBody(),R=d==="day"?6:4,x=d==="day"?7:3;for(let A=0;A<R;A++){const y=M.insertRow();for(let E=0;E<x;E++){const C=document.createElement("button");C.type="button",y.insertCell().append(C)}}return s(".date-grids").append(m),{view:d,table:m,head:b,body:M}});function g(){const d=a.map(I=>Yr(I.value)),m=!!(d[0]&&d[1]&&d[0].compare(d[1])<=0);c.disabled=!m;for(const[I,M]of a.entries())M.setAttribute("aria-invalid",String(!!M.value&&!d[I]));const b=m?"Both dates included":"Choose a start and end date";s(".date-status").textContent!==b&&(s(".date-status").textContent=b)}function u(){const d=p();ne(e,d.getRootProps()),ne(s(".date-control"),d.getControlProps()),ne(r,{...d.getTriggerProps(),"aria-label":"Custom date range"}),ne(o,d.getPositionerProps()),ne(i,{...d.getContentProps(),"aria-label":"Custom date range"}),a.forEach((I,M)=>ne(I,{...d.getInputProps({index:M}),"aria-label":M?"To date":"From date"})),ne(s(".date-prev"),d.getPrevTriggerProps({view:d.view})),ne(s(".date-next"),d.getNextTriggerProps({view:d.view}));const m=d.view==="day"?d.visibleRangeText.start:d.view==="month"?String(d.visibleRange.start.year):`${d.getDecade().start} – ${d.getDecade().end}`,b=s(".date-view");ne(b,d.getViewTriggerProps({view:d.view})),b.textContent!==m&&(b.textContent=m);for(const{view:I,table:M,head:R,body:x}of f){M.hidden=d.view!==I,ne(M,d.getTableProps({view:I,columns:I==="day"?7:3})),ne(R,d.getTableHeaderProps({view:I})),ne(x,d.getTableBodyProps({view:I})),I==="day"&&d.weekDays.forEach((y,E)=>{const C=R.rows[0].cells[E];C.scope="col",C.setAttribute("aria-label",y.long),C.textContent!==y.short&&(C.textContent=y.short)});const A=I==="day"?d.weeks:I==="month"?d.getMonthsGrid({columns:3,format:"short"}):d.getYearsGrid({columns:3});Array.from(x.rows).forEach((y,E)=>{ne(y,d.getTableRowProps({view:I})),Array.from(y.cells).forEach((C,O)=>{const w=A[E]?.[O],L=C.firstElementChild;if(C.hidden=!w,!!w)if(I==="day"){const D=d.weeks[E][O];ne(C,d.getDayTableCellProps({value:D})),ne(L,d.getDayTableCellTriggerProps({value:D})),L.textContent!==String(D.day)&&(L.textContent=String(D.day))}else{const D=w;ne(C,I==="month"?d.getMonthTableCellProps({...D,columns:3}):d.getYearTableCellProps({...D,columns:3})),ne(L,I==="month"?d.getMonthTableCellTriggerProps({...D}):d.getYearTableCellTriggerProps({...D})),L.textContent!==D.label&&(L.textContent=D.label)}})})}o.hidden=!d.open,d.open&&!o.matches(":popover-open")&&o.showPopover?.(),!d.open&&o.matches(":popover-open")&&o.hidePopover?.(),r.classList.toggle("active",d.open),g()}s(".date-close").addEventListener("click",()=>p().setOpen(!1));for(const d of e.querySelectorAll("[data-preset]"))d.addEventListener("click",()=>{const m=p(),b=m.getRangePresetValue(d.dataset.preset);m.setValue(b),m.setFocusedValue(b[0]),m.setView("day")});c.addEventListener("click",()=>{g(),c.disabled||(t(a[0].value,a[1].value),p().setOpen(!1))}),i.addEventListener("input",g),e.addEventListener("keydown",d=>d.stopPropagation());const h=l.subscribe(u);return l.start(),u(),{setRange(d,m){const b=[d,m].map(Yr).filter(I=>I!==void 0);p().setValue(b),b[0]&&p().setFocusedValue(b[0])},dispose(){h(),l.stop(),e.replaceChildren()}}}const cv={Search:dd,GitFork:Xc,GitBranch:Jc,Folder:Zc,ArrowUpRight:Bc,ArrowRight:_c,X:gd,Box:Wc,RotateCcw:cd,RefreshCw:ld,Play:ad,Pause:id,ChevronDown:jc,FileCode2:zc,Terminal:hd,Copy:Gc,Crosshair:Yc,CircleHelp:Uc,SlidersHorizontal:fd,LoaderCircle:ed,Network:nd,Clock:qc,Sparkles:Ra,Grip:Qc,PanelRight:rd,Settings2:ud,Volume2:Pa,VolumeX:pd},Oe=()=>{md({icons:cv,attrs:{"stroke-width":1.5}}),ln()},F=(e,t="")=>`<i data-lucide="${e}" class="${t}" aria-hidden="true"></i>`,k=e=>document.querySelector(e),G=e=>e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]),dv=e=>Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}).format(e),Be=e=>e.toLocaleString("en"),uv=[new Intl.DateTimeFormat("en",{month:"short",day:"numeric"}),new Intl.DateTimeFormat("en",{month:"short",day:"numeric",year:"numeric"})],fv=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}),hv=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}),un=(e,t=!1)=>uv[Number(t)].format(e),fn=e=>fv.format(e),Aa=e=>{const t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`};let X,ae={nodes:[],edges:[],lanes:[],start:0,end:0},De=[],Qo=[],xc=new Set,Vs=new Map,Zn=new Map,Sc=new Map,ee,$c=!0,Ts,W=new URLSearchParams(location.search).get("session"),Ee,Re,Ns=0,pt="",it="",We="",at=90,lt="",ct="",hn=!0,pn=!0,nn=60,Fs=0,xo,So,ei=0,gn=!1,me=1,$o=0;const pv=3e4;let q={...dr},Bt=!0,gr,dt,Jn=!1,Io="";try{q=Dl(localStorage)}catch{Bt=!1}const Js=matchMedia("(prefers-reduced-motion: reduce)");k("#app").innerHTML=`
|
|
100
|
-
<main class="map" aria-label="Session map">
|
|
101
|
-
<h1 class="sr-only">SessionGraph — Explore & visualize all your LLM sessions</h1>
|
|
102
|
-
<div id="scene"></div>
|
|
103
|
-
<div class="canvas-vignette"></div>
|
|
104
|
-
<div id="graph-message" class="graph-message"><div class="loading-orbit"><span></span><span></span><span></span></div><h3>Loading sessions…</h3></div>
|
|
105
|
-
<div id="tooltip" class="node-tooltip" hidden></div>
|
|
106
|
-
</main>
|
|
107
|
-
<header class="app-header glass">
|
|
108
|
-
<a class="brand" href="/" aria-label="SessionGraph home" title="Explore & visualize all your LLM sessions"><img src="/favicon.svg" alt=""/><span>SessionGraph<span class="brand-dot">.</span></span></a>
|
|
109
|
-
<span class="connection" role="status" title="Connecting"><span class="status-dot"></span><span id="connection-label" class="sr-only">Connecting</span></span>
|
|
110
|
-
<span class="toolbar-divider"></span>
|
|
111
|
-
<button class="toolbar-button" id="toggle-explorer" aria-label="Toggle sessions" aria-controls="explorer" aria-expanded="true" title="Sessions">${F("search")}<span>Sessions</span></button>
|
|
112
|
-
</header>
|
|
113
|
-
<nav class="map-controls glass" aria-label="Map controls">
|
|
114
|
-
<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>
|
|
115
|
-
<span class="toolbar-divider"></span>
|
|
116
|
-
<button class="icon-button" id="reset-camera" aria-label="Fit view" title="Fit view (F)">${F("crosshair")}</button>
|
|
117
|
-
<button class="icon-button" id="toggle-timeline" aria-label="Toggle timeline" aria-controls="timeline" aria-expanded="true" title="Timeline">${F("clock")}</button>
|
|
118
|
-
<button class="icon-button" id="toggle-inspector" aria-label="Toggle session details" aria-controls="inspector" aria-expanded="false" title="Session details" hidden>${F("panel-right")}</button>
|
|
119
|
-
<button class="icon-button" id="help" aria-label="Help" title="Help">${F("circle-help")}</button>
|
|
120
|
-
<button class="icon-button" id="mute-audio" aria-label="Mute sound" title="Mute sound" aria-pressed="false" data-sound="none">${F("volume-2")}</button>
|
|
121
|
-
<button class="icon-button" id="open-settings" aria-label="Settings" title="Settings" aria-haspopup="dialog">${F("settings-2")}</button>
|
|
122
|
-
</nav>
|
|
123
|
-
<aside class="sidebar floating-panel glass" id="explorer" aria-label="Sessions">
|
|
124
|
-
<div class="panel-heading"><button class="panel-handle" data-drag-panel="explorer" aria-label="Move sessions panel" title="Drag to move · Arrow keys to reposition">${F("grip")}<span>Sessions</span><span class="small-badge" id="list-count">—</span></button><button class="icon-button" id="refresh" aria-label="Refresh sessions" title="Refresh sessions">${F("refresh-cw")}</button><button class="icon-button" id="close-explorer" aria-label="Close sessions">${F("x")}</button></div>
|
|
125
|
-
<button class="search-box search-trigger" id="search" aria-label="Search all sessions">${F("search")}<span>Search everything…</span><kbd>/</kbd></button>
|
|
126
|
-
<div class="filters">
|
|
127
|
-
<div class="filter-row"><div class="select-wrap"><span id="source-filter-icon">${Ue()}</span><select id="source" aria-label="Session source"><option value="">All sources</option></select>${F("chevron-down")}</div><button class="icon-button" id="manage-sources" aria-label="Manage sources" title="Import sources">${F("sliders-horizontal")}</button></div>
|
|
128
|
-
<div class="select-wrap">${F("folder")}<select id="project" aria-label="Project"><option value="">All projects</option></select>${F("chevron-down")}</div>
|
|
129
|
-
<div class="select-wrap">${F("git-branch")}<select id="directory" aria-label="Worktree or directory"><option value="">All directories</option></select>${F("chevron-down")}</div>
|
|
130
|
-
<div class="filter-toggles"><label><input type="checkbox" id="children" checked/><span>Child sessions</span></label><label><input type="checkbox" id="archived" checked/><span>Archived</span></label></div>
|
|
131
|
-
</div>
|
|
132
|
-
<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>
|
|
133
|
-
</aside>
|
|
134
|
-
<div class="inspector-stack floating-panel" id="inspector" hidden><aside class="inspector glass" id="session-inspector" aria-label="Session details"></aside></div>
|
|
135
|
-
<section class="timeline-panel floating-panel glass" id="timeline" aria-label="Timeline controls">
|
|
136
|
-
<div class="timeline-top"><button class="panel-handle" data-drag-panel="timeline" aria-label="Move timeline panel" title="Drag to move · Arrow keys to reposition">${F("grip")}<span id="date-label">Timeline</span></button><div class="range-buttons" role="group" aria-label="Date range"><button data-days="7">7D</button><button data-days="30">30D</button><button data-days="90" class="active">90D</button><button data-days="0">All</button></div><div class="custom-dates"></div><button class="icon-button" id="close-timeline" aria-label="Close timeline">${F("x")}</button></div>
|
|
137
|
-
<div class="timeline-track"><button id="play" class="play-button" aria-label="Play timeline">${F("play")}</button><div class="histogram-wrap"><div id="histogram" class="histogram"></div><input id="scrubber" type="range" min="0" max="1000" value="1000" aria-label="Timeline playback position"/><div class="timeline-cursor" id="timeline-cursor"></div></div><div class="playback-date" id="playback-date">—</div></div>
|
|
138
|
-
</section>
|
|
139
|
-
<dialog id="help-dialog" aria-labelledby="help-title"><button class="icon-button dialog-close" id="close-help" aria-label="Close help">${F("x")}</button><h2 id="help-title">Explore the map</h2><div class="help-rows"><div><span>Orbit</span><kbd>Drag</kbd></div><div><span>Zoom</span><kbd>Scroll / pinch</kbd></div><div><span>Pan</span><kbd>Right-drag</kbd></div><div><span>Fit view</span><kbd>F</kbd></div><div><span>Search everything</span><kbd>/ · ⌘/Ctrl K</kbd></div><div><span>Hide / restore panels</span><kbd>H</kbd></div><div><span>Clear selection</span><kbd>Esc</kbd></div></div>
|
|
140
|
-
<div class="graph-legend"><span><i class="legend-node"></i>Latest message</span><span><i class="legend-node message"></i>Message / event</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>
|
|
141
|
-
<p>Time runs left to right. A session's trail begins at creation and ends at its latest saved message. Select it to reveal clickable messages, tools, and events. Untimed items remain available in the event explorer. Directory colors group sessions; only fork and child links represent ancestry.</p><button class="secondary-button motion-button" id="motion" aria-pressed="true">${F("sparkles")}Animate map</button></dialog>
|
|
142
|
-
<div id="toast" class="toast" role="status" hidden></div>
|
|
143
|
-
<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>
|
|
144
|
-
`;Oe();yd();Tg();sg();const Ic=lv(k(".custom-dates"),(e,t)=>{lt=e,ct=t,vt(!0)},ve),bn=()=>{const e=!!document.querySelector("dialog[open]");e&&gn&&ve(),ee?.setSuspended(e)},ti=new yg,Vt=vg(k("#tooltip"),k("#scene"),ti),mr=mg(k("#inspector"),ti,{select:e=>{Vt.clear(),ee?.selectEvent(e?.id||null),e&&(ve(),me=1,wn(),ee?.focusEvent(e))}});function ni(e){const t=X?.sessions.find(n=>n.id===W);t&&(Vt.clear(),ve(),ke("inspector",!0),mr.open(t,e,e?Re?.revision:void 0))}const ts=hg({change:vr,visibility:bn,previewSound:()=>{Xs.play("select")},getSources:()=>gt.sources(),importSources:e=>gt.select(e),resetPanels:()=>{document.querySelectorAll(".floating-panel").forEach(e=>{e.removeAttribute("style"),delete e.dataset.positioned})}}),Xs=new pg(q,ts.audioStatus);function ns(){ee?.applyPreferences(q),Xs.configure(q),document.documentElement.dataset.density=q.density,document.documentElement.dataset.motion=String(mo(q,Js.matches)),document.documentElement.style.setProperty("--panel-opacity",`${q.panelOpacity}%`),k("#motion").setAttribute("aria-pressed",String(mo(q,Js.matches)));for(const t of["2d","3d"]){const n=k(`#view-${t}`);n.classList.toggle("active",q.view===t),n.setAttribute("aria-pressed",String(q.view===t))}const e=k("#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=F(q.muted?"volume-x":"volume-2"),ts.render(q,Bt||Jn,dt?.state||"saved"),Oe()}function vr(e){const t=e.autoImport!==void 0&&e.autoImport!==q.autoImport;q=ur({...q,...e});try{Bt=Rl(localStorage,q)}catch{Bt=!1}ns(),si({preferences:{...q},...t?{autoImport:q.autoImport}:{}})}function si(e){dt?.save(e)}function gv(){return{sourceID:it,projectID:pt,directory:We,days:at,fromDate:lt,toDate:ct,includeChildren:hn,includeArchived:pn}}k("#open-settings").addEventListener("click",ts.open);k("#mute-audio").addEventListener("click",()=>vr({muted:!q.muted}));const mv=()=>ns();Js.addEventListener("change",mv);const vv=e=>{if(e.key===jo)try{q={...Dl(localStorage),autoImport:q.autoImport},ns()}catch{}};window.addEventListener("storage",vv);ns();dt=new cg(async e=>{if(!(await fetch("/api/sessiongraph/settings",{method:"POST",headers:{"Content-Type":"application/json","X-SessionGraph-Action":"settings"},body:JSON.stringify(e),signal:AbortSignal.timeout(15e3),keepalive:!0})).ok)throw new Error("Could not save library settings.")},e=>{ts.render(q,Bt||Jn,e),e==="error"&&Wt("Changes applied, but could not save to the local library. Retrying when you return."),e==="saved"&&gr?.check()});const Tc=rg(bn),gt=og(e=>li(e),bn);gr=new lg({eligible:()=>q.autoImport&&!dt?.pending&&document.visibilityState==="visible"&&!!(X&&!X.onboarding&&X.sources?.some(e=>e.selected)),busy:()=>gt.busy||!!document.querySelector("dialog[open]"),refresh:()=>gt.refresh(!0)});const ri=new AbortController,ss=()=>{document.visibilityState==="visible"&&(dt?.state==="error"&&dt.flush(),gr?.check())};window.addEventListener("focus",ss,{signal:ri.signal});document.addEventListener("visibilitychange",ss,{signal:ri.signal});window.setInterval(ss,ig);k("#manage-sources").addEventListener("click",()=>{gt.open()});document.addEventListener("sessiongraph-import-status",e=>{const t=e.detail;gr?.activity(),ts.importStatus(t),k("#refresh").classList.toggle("spinning",t.running),k(".connection").title=t.running?`Importing ${je(t.source)} · ${t.imported} sessions saved`:t.failed?"Import unavailable · open Manage sources for details":"Local library · SQLite"},{signal:ri.signal});const oi=Sd(En,bn,e=>{Tc.open(e)});k("#search").addEventListener("click",oi.open);function ke(e,t){const n=k(`#${e}`);n.hidden=!t,e==="timeline"&&!t&&gn&&ve(),k(`#toggle-${e}`).setAttribute("aria-expanded",String(t)),t&&innerWidth<760&&e!=="timeline"&&ke(e==="explorer"?"inspector":"explorer",!1)}ke("explorer",innerWidth>=760);let Kr=[];for(const e of["explorer","timeline","inspector"])k(`#toggle-${e}`).addEventListener("click",()=>ke(e,k(`#${e}`).hidden));k("#close-explorer").addEventListener("click",()=>{ke("explorer",!1),k("#toggle-explorer").focus()});k("#close-timeline").addEventListener("click",()=>{ve(),ke("timeline",!1),k("#toggle-timeline").focus()});function Wt(e){k("#toast").textContent=e,k("#toast").hidden=!1,window.setTimeout(()=>{k("#toast").hidden=!0},3500)}function ii(){ke("inspector",!1),mr.close(),Vt.clear(),k("#session-inspector").replaceChildren(),k("#toggle-inspector").hidden=!0}ii();async function yv(){try{const{TimelineScene:e}=await La(async()=>{const{TimelineScene:t}=await import("./scene-BmLcylTN.js");return{TimelineScene:t}},__vite__mapDeps([0,1]));ee=new e(k("#scene"),{onSelect:t=>{Xs.play("select"),En(t)},onPlaybackInterrupt:ve,onEvent:t=>{Xs.play("select"),ni(t)},onEventHover:(t,n,s,r)=>{Ts=void 0,t&&W&&Re?Vt.show(t,W,Re.revision,n,s,r):Vt.clear()},onHover:(t,n,s)=>{const r=k("#tooltip");r.classList.contains("message-tooltip")&&(Vt.clear(),Ts=void 0),r.hidden!==!t&&(r.hidden=!t),t&&(Ts!==t.session&&(Ts=t.session,r.innerHTML=`<strong>${G(t.session.title)}</strong><span>${G(je(t.session.source))} · ${t.session.activity?.lastMessageAt?`Last message ${fn(t.session.activity.lastMessageAt)}`:"Message time unavailable"}<br>Started ${fn(t.session.created)}</span>`),r.style.left=`${Math.min(n+18,k("#scene").clientWidth-280)}px`,r.style.top=`${Math.max(8,Math.min(s-32,k("#scene").clientHeight-110))}px`)}}),ee.applyPreferences(q),X&&(ee.setGraph(ae,!0),W&&(ee.select(W),ee.focus(W)),Ee&&ee.setFiles(Ee.files),Re&&ee.setEvents(Re.items))}catch(e){console.error("[sessiongraph] Graphics initialization failed",e),Wt("3D requires WebGL. You can still browse sessions in the list.")}finally{$c=!1,X&&Cc()}}yv();k("#scene").addEventListener("scene-error",e=>Wt(e.detail));async function ai(e,t){const n=AbortSignal.timeout(18e4),s=await fetch(e,{signal:t?AbortSignal.any([t,n]):n}),r=await s.json();if(!s.ok)throw new Error(r.error||"Request failed.");return r}async function li(e=!1){const t=k("#refresh");t.disabled=!0,t.classList.add("spinning");try{const n=dt?.revision,s=await ai("/api/sessiongraph"),r=X,o=W?Vs.get(W):void 0;if(X=s,!dt?.pending&&n===dt?.revision){q={...ur(s.preferences||q),autoImport:s.autoImport!==!1};try{Bt=Rl(localStorage,q)}catch{Bt=!1}if(!Jn){const a=fg(s.viewState);({sourceID:it,projectID:pt,directory:We,days:at,fromDate:lt,toDate:ct,includeChildren:hn,includeArchived:pn}=a),k("#children").checked=hn,k("#archived").checked=pn,Io=JSON.stringify(a),s.preferences||si({preferences:{...q}})}ns()}if(Jn=!0,e&&r&&JSON.stringify(r.sessions)===JSON.stringify(s.sessions)&&JSON.stringify(r.projects)===JSON.stringify(s.projects))return;ti.clear(),Vs=new Map(X.sessions.map(a=>[a.id,a])),k("#source").innerHTML='<option value="">All sources</option>'+(X.sources||[]).map(a=>`<option value="${G(a.id)}">${G(a.name)} · ${a.sessions.toLocaleString()}</option>`).join(""),k("#source").value=it,k("#source-filter-icon").innerHTML=Ue(it),oi.setData(X),k("#connection-label").textContent="Local library",k(".connection").classList.add("connected"),k(".connection").title=`Connected · ${Be(X.sessions.length)} sessions`;const i=new Map;if(X.sessions.forEach(a=>i.set(a.projectID,(i.get(a.projectID)||0)+1)),k("#project").innerHTML='<option value="">All projects</option>'+[...X.projects].filter(a=>i.has(a.id)).sort((a,c)=>(i.get(c.id)||0)-(i.get(a.id)||0)).map(a=>`<option value="${G(a.id)}">${G(a.name)} · ${Be(i.get(a.id)||0)}</option>`).join(""),k("#project").value=pt,ci(),W&&!e){const a=X.sessions.find(c=>c.id===W);a&&a.created<Date.now()-at*864e5&&(at=0)}if(vt(!e,e),W&&!e)En(W);else if(W){const a=Vs.get(W);if(a&&JSON.stringify(o)!==JSON.stringify(a)){const c=k(".detail-scroll")?.scrollTop||0;Ee=void 0,Re=void 0,Mc(a,!1),k(".detail-scroll").scrollTop=c,yr(a.id),ui(a)}}else ii();!e&&X.warnings.length&&Wt(X.warnings.join(" ")),!e&&X.onboarding&>.open(!0)}catch(n){if(e&&X){k(".connection").title="Library refresh unavailable · retry with Refresh sessions";return}k("#connection-label").textContent="Connection unavailable",k(".connection").title="Connection unavailable",k(".connection").classList.remove("connected"),k("#graph-message").hidden=!1,k("#graph-message").innerHTML=`${F("terminal")}<h3>Local library unavailable</h3><p>${G(n instanceof Error?n.message:"Unable to connect.")}</p><button class="primary-button" id="retry">Retry ${F("arrow-right")}</button>`,k("#retry").addEventListener("click",()=>{li().then(ss)}),X||(k("#session-list").innerHTML='<p class="empty-list">Your sessions will appear here once connected.</p>',k("#list-count").textContent="Offline"),Oe()}finally{t.disabled=!1,t.classList.remove("spinning")}}function ci(){const e=X?.sessions.filter(s=>!pt||s.projectID===pt)||[],t=[...new Set(e.map(s=>s.directory))].sort((s,r)=>jn(s).localeCompare(jn(r))),n=new Set(X?.projects.flatMap(s=>s.worktrees));k("#directory").innerHTML='<option value="">All directories</option>'+t.map(s=>`<option value="${G(s)}">${n.has(s)?"⑂ ":""}${G(jn(s))}</option>`).join(""),t.includes(We)||(We=""),k("#directory").value=We}function vt(e=!1,t=!1){if(!X)return;t||(ve(),me=1,nn=60);const n=k("#session-list").scrollTop,s=document.activeElement?.closest("[data-session]")?.dataset.session,r=Date.now(),o=lt?new Date(`${lt}T00:00:00`).getTime():at?r-at*864e5:0,i=ct?new Date(`${ct}T23:59:59.999`).getTime():1/0;De=X.sessions.filter(l=>(!it||l.source===it)&&(!pt||l.projectID===pt)&&(!We||l.directory===We)&&(hn||!l.parentID||!!l.forkID)&&(pn||!l.archived)&&l.created>=o&&l.created<=i),Qo=[...De].sort((l,p)=>sn(p)-sn(l)),xc=new Set(De.map(l=>l.id)),oi.setScope(De.map(l=>l.id)),ae=vd(De,X.projects),Sc=new Map(ae.nodes.map(l=>[l.session.id,l.color])),ee?.setCutoff(me),ee?.setGraph(ae,e),Cc(),document.querySelectorAll("[data-days]").forEach(l=>l.classList.toggle("active",!lt&&!ct&&Number(l.dataset.days)===at)),di(),t&&(k("#session-list").scrollTop=n,s&&Zn.get(s)?.focus({preventScroll:!0})),bv(),W&&!De.some(l=>l.id===W)?Lc():W&&Ee&&ee?.setFiles(Ee.files),W&&Re&&ee?.setEvents(Re.items),Oe();const a=gv(),c=JSON.stringify(a);Jn&&c!==Io&&(Io=c,si({viewState:a}))}function Cc(){const e=k("#graph-message");e.hidden=!!(De.length&&ee),De.length?ee||(e.innerHTML=$c?"<h3>Preparing the map…</h3>":`${F("box")}<h3>WebGL is unavailable.</h3><p>You can explore every session and its file details in the list.</p>`):e.innerHTML=`${F("search")}<h3>No matching sessions</h3><button class="text-button" id="clear-filters">Reset filters ${F("rotate-ccw")}</button>`,k("#clear-filters")?.addEventListener("click",kc),Oe()}function kc(){it="",k("#source").value="",k("#source-filter-icon").innerHTML=Ue(),pt="",We="",at=0,lt="",ct="",hn=!0,pn=!0,k("#project").value="",k("#children").checked=!0,k("#archived").checked=!0,Ic.setRange("",""),ci(),vt(!0)}function di(){k("#list-count").textContent=Be(De.length);const e=Qo;let t="";k("#session-list").innerHTML=e.slice(0,nn).map(n=>{const s=sn(n),r=un(s),o=r!==t?`<div class="list-date">${r}<span>${new Date(s).getFullYear()}</span></div>`:"";return t=r,`${o}<button class="session-card ${W===n.id?"selected":""}" data-session="${G(n.id)}" aria-pressed="${W===n.id}" title="${G(n.title)}"><span class="session-dot" style="--node-color:${Sc.get(n.id)}"></span><span class="session-card-body"><span class="session-title">${G(n.title)}</span><span class="session-meta">${n.forkID?F("git-fork"):n.parentID?F("network"):""}<span class="source-badge" data-source="${G(n.source||"opencode")}">${Ue(n.source)}${G(je(n.source))}</span><span title="${n.activity?.lastMessageAt?"Latest saved message":"Session created; message time unavailable"}">${hv.format(s)}</span></span></span></button>`}).join("")+(e.length>nn?`<button id="more-sessions" class="load-more">Show more sessions ${F("chevron-down")}</button>`:e.length?"":'<p class="empty-list">No sessions match your filters.</p>'),k("#more-sessions")?.addEventListener("click",()=>{nn+=100;const n=k("#session-list").scrollTop;di(),k("#session-list").scrollTop=n,Oe()}),Zn=new Map([...k("#session-list").querySelectorAll(".session-card")].map(n=>[n.dataset.session,n])),Oe()}function Ac(e){for(const t of[e,W]){const n=t?Zn.get(t):void 0;n&&(n.classList.toggle("selected",t===W),n.setAttribute("aria-pressed",String(t===W)))}}function bv(){const e=new Array(70).fill(0),t=Math.max(1,ae.end-ae.start);for(const s of De)e[Math.min(69,Math.floor((sn(s)-ae.start)/t*70))]++;const n=Math.max(...e,1);k("#histogram").innerHTML=e.map(s=>`<span style="height:${Math.max(4,s/n*100)}%;opacity:${s?.8:.15}" title="${s} session endpoints"></span>`).join(""),k("#date-label").textContent=ae.start?`${un(ae.start)} — ${un(ae.end,!0)}`:"No sessions",ae.start&&Ic.setRange(lt||Aa(ae.start),ct||Aa(ae.end)),wn()}function wn(){k("#scrubber").value=String(Math.round(me*1e3)),k("#timeline-cursor").style.left=`${me*100}%`,k("#histogram").style.setProperty("--progress",`${me*100}%`),k("#playback-date").textContent=ae.start?un(ae.start+(ae.end-ae.start)*me):"—",ee?.setCutoff(me)}function ve(){gn=!1,ee?.setPlaying(!1),cancelAnimationFrame(ei),k("#play").innerHTML=F("play"),k("#play").setAttribute("aria-label","Play timeline"),Oe()}function Oc(e){if(!gn)return;const t=Math.min(e-$o,100);$o=e,document.hidden||(me=Math.min(1,me+t*q.playbackSpeed/pv)),wn(),me>=1?ve():ei=requestAnimationFrame(Oc)}function Lc(){const e=W;xo?.abort(),So?.abort(),k("#file-legend").hidden=!0,Fs++,Ns++,W=null,Ee=void 0,Re=void 0,ee?.select(null),history.replaceState(null,"",location.pathname),ii(),Ac(e)}function wv(e){const t=e.forkID?[{id:e.forkID,label:"Forked from",kind:"git-fork"}]:e.parentID?[{id:e.parentID,label:"Parent",kind:"network"}]:[],n=X.sessions.filter(r=>r.forkID===e.id||!r.forkID&&r.parentID===e.id),s=[...t,...n.map(r=>({id:r.id,label:r.forkID?"Fork":"Child",kind:r.forkID?"git-fork":"network"}))];return s.length?`<section class="detail-section"><div class="section-label">Connections<span>${s.length}</span></div>${s.map(r=>{const o=X.sessions.find(i=>i.id===r.id);return`<button class="relation" data-related="${G(r.id)}" ${o?"":"disabled"}>${F(r.kind)}<span><small>${r.label}</small><strong>${G(o?.title||"Session no longer available")}</strong></span>${F("arrow-up-right")}</button>`}).join("")}</section>`:""}function Mc(e,t=!0){const n=X.projects.find(o=>o.id===e.projectID),s=e.forkID?"Fork":e.parentID?"Child session":"Session",r=n?.worktrees.includes(e.directory);k("#session-inspector").innerHTML=`
|
|
145
|
-
<div class="panel-heading"><button class="panel-handle" data-drag-panel="inspector" aria-label="Move session details panel" title="Drag to move · Arrow keys to reposition">${F("grip")}<span>${s}</span></button><button id="close-inspector" class="icon-button" aria-label="Close session details">${F("x")}</button></div>
|
|
146
|
-
<div class="detail-scroll">
|
|
147
|
-
<div class="detail-title"><span class="source-badge" data-source="${G(e.source||"opencode")}">${Ue(e.source)}${G(je(e.source))}</span><h2>${G(e.title)}</h2><span class="detail-date">${fn(e.created)}</span></div>
|
|
148
|
-
<div class="detail-actions"><button id="open-session" class="secondary-button">${F("arrow-up-right")}Open session</button><button id="focus-session" class="icon-button" title="Focus node" aria-label="Focus node">${F("crosshair")}</button><button id="copy-id" class="icon-button" title="Copy session ID" aria-label="Copy session ID">${F("copy")}</button></div>
|
|
149
|
-
<section id="message-detail" class="detail-section"></section>
|
|
150
|
-
<div id="file-detail"><section class="detail-section"><div class="section-label">Changed files</div><div class="detail-loading">${F("loader-circle","spinning")}Loading changes…</div></section></div>
|
|
151
|
-
${wv(e)}
|
|
152
|
-
<details class="more-details detail-section"><summary>Session info ${F("chevron-down")}</summary><dl class="metadata"><div><dt>Project</dt><dd>${G(n?.name||"Unknown")}</dd></div><div><dt>Model</dt><dd>${G(e.model)}</dd></div><div><dt>Agent</dt><dd>${G(e.agent||"Unknown")}</dd></div><div><dt>Tokens incl. cache</dt><dd>${e.tokens===null?"Not recorded":dv(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>${un(e.updated)}</dd></div><div><dt>Imported</dt><dd>${e.coverage?.importedAt?un(e.coverage.importedAt):"Pending"}</dd></div></dl><div class="directory-card"><span>${r?"Worktree":"Directory"}</span><code>${G(e.directory)}</code></div></details>
|
|
153
|
-
</div>
|
|
154
|
-
`,k("#toggle-inspector").hidden=!1,t&&ke("inspector",!0),k("#close-inspector").addEventListener("click",()=>{ke("inspector",!1),k("#toggle-inspector").focus()}),k("#focus-session").addEventListener("click",()=>{ve(),ee?.focus(e.id)}),k("#open-session").addEventListener("click",()=>{Tc.open(e)}),k("#copy-id").addEventListener("click",async()=>{try{await navigator.clipboard.writeText(e.nativeID||e.id),Wt("Session ID copied")}catch{Wt(e.nativeID||e.id)}}),Dc(e),Oe()}function Dc(e,t){const n=t?.items.filter(r=>r.kind==="message"&&r.time===e.activity?.lastMessageAt).length||0,s=t?[`${Be(t.items.length-n)} of ${Be(t.total)} saved events plotted. Click a dot to explore.`,n?"The session sphere represents the latest message; read it in the explorer.":"",t.untimed?`${Be(t.untimed)} have no recorded timestamp; browse them in the explorer.`:"",t.outsideLifetime?`${Be(t.outsideLifetime)} fall outside this lifetime; available in the explorer.`:"",t.limited?"Map shows the latest 2,000 timed events. The explorer pages through all saved items.":"",t.partial?"Partial history.":"","Nearby items can overlap; use Previous / Next in the explorer."].filter(Boolean):["Loading message & event markers…"];k("#message-detail").innerHTML=`<div class="section-label">Session timeline</div><dl class="metadata">
|
|
155
|
-
<div><dt>Trail starts</dt><dd>${fn(e.created)}</dd></div>
|
|
156
|
-
<div><dt>Node · last message</dt><dd>${e.activity?.lastMessageAt?fn(e.activity.lastMessageAt):"Unknown · at session start"}</dd></div>
|
|
157
|
-
</dl><div class="event-key"><span style="--event-color:#fff"><i></i>Messages & events · hover to preview</span></div><p class="coverage-note">${s.map(G).join("<br>")}</p><button class="secondary-button explore-events">Explore messages & events ${F("arrow-right")}</button>${t?.note?`<details class="more-details history-coverage"><summary>History coverage ${F("chevron-down")}</summary><p class="coverage-note">${G(t.note)}</p></details>`:""}`,k(".explore-events").addEventListener("click",()=>ni()),Oe()}async function ui(e){const t=++Ns;So?.abort();const n=new AbortController;So=n;try{const s=await ai(`/api/sessiongraph/session/${encodeURIComponent(e.id)}/event-markers`,n.signal);if(n.signal.aborted||t!==Ns||W!==e.id)return;Re=s,ee?.setEvents(s.items),Dc(e,s)}catch{if(n.signal.aborted||t!==Ns||W!==e.id)return;k("#message-detail").innerHTML='<div class="section-label">Session timeline</div><p class="coverage-note">Event timing unavailable.</p><button class="secondary-button explore-events">Explore messages & events</button><button class="load-more" id="retry-timeline">Retry event markers</button>',k(".explore-events").addEventListener("click",()=>ni()),k("#retry-timeline").addEventListener("click",()=>{ui(e)})}}function Ev(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 Oa(e){const t=e.files;k("#file-legend").hidden=!t.length,k("#file-detail").innerHTML=`
|
|
158
|
-
<section class="detail-section"><div class="section-label">Changed files<span>${Be(t.length)}${e.partial?"+":""}</span></div>
|
|
159
|
-
${t.length?`<ul class="file-list">${t.map(n=>`<li title="${G(n.path)} · ${n.source}">${F("file-code-2")}<div><strong>${G(jn(n.path))}</strong>${n.path.includes("/")?`<span>${G(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>'}
|
|
160
|
-
<p class="coverage-note">${Be(e.messagesScanned)} messages · ${e.partial?"Partial history":"Imported history"}${e.snapshotSteps?"":"<br>No snapshots; recorded tool/file-change evidence only."}${t.length>80?"<br>80 files shown on the map.":""}</p>
|
|
161
|
-
${e.note?`<p class="coverage-note">${G(e.note)}</p>`:""}
|
|
162
|
-
${e.nextCursor?`<button id="load-earlier" class="load-more">Load earlier messages ${F("arrow-right")}</button>`:""}</section>
|
|
163
|
-
${e.locations.length?`<details class="more-details detail-section"><summary>Directory moves ${F("chevron-down")}</summary>${e.locations.map(n=>`<div class="location-entry"><span>${fn(n.time)}</span><code>${G(n.directory)}</code></div>`).join("")}</details>`:""}
|
|
164
|
-
${e.tools.length?`<details class="more-details detail-section"><summary>Tools used <span>${Be(e.tools.reduce((n,s)=>n+s.count,0))}</span>${F("chevron-down")}</summary><div class="tools-list">${e.tools.slice(0,12).map(n=>`<div><span>${G(n.name)}</span><strong>${n.count}</strong></div>`).join("")}</div></details>`:""}
|
|
165
|
-
`,k("#load-earlier")?.addEventListener("click",()=>yr(e.id,e.nextCursor||void 0)),ee?.setFiles(t),Oe()}async function yr(e,t){const n=++Fs;xo?.abort();const s=new AbortController;xo=s;const r=k("#load-earlier");r&&(r.disabled=!0,r.textContent="Scanning earlier messages…");try{const o=await ai(`/api/sessiongraph/session/${encodeURIComponent(e)}${t?`?cursor=${encodeURIComponent(t)}`:""}`,s.signal);if(s.signal.aborted||n!==Fs||W!==e)return;Ee=t&&Ee?Ev(Ee,o):o,Oa(Ee)}catch(o){if(s.signal.aborted||n!==Fs||W!==e)return;Ee?(Oa(Ee),Wt("Could not load earlier history. Try again.")):(k("#file-detail").innerHTML=`<section class="detail-section"><div class="section-label">Changed files</div><p class="coverage-note">${G(o instanceof Error?o.message:"Details unavailable.")}</p><button class="load-more" id="retry-detail">Retry file details</button></section>`,k("#retry-detail").addEventListener("click",()=>yr(e)))}}function En(e){const t=Vs.get(e);if(!t)return;const n=W;mr.close(),Vt.clear(),xc.has(e)||kc(),ve(),me=1,wn(),W=e,Ee=void 0,Re=void 0,k("#file-legend").hidden=!0,history.replaceState(null,"",`?session=${encodeURIComponent(e)}`),ee?.select(e),Mc(t),ee?.focus(e),Ac(n),yr(e),ui(t)}k("#session-list").addEventListener("click",e=>{const t=e.target.closest("[data-session]");t?.dataset.session&&En(t.dataset.session)});k("#inspector").addEventListener("click",e=>{const t=e.target.closest("[data-related]");t?.dataset.related&&En(t.dataset.related)});k("#project").addEventListener("change",e=>{pt=e.target.value,We="",ci(),vt(!0)});k("#source").addEventListener("change",e=>{it=e.target.value,k("#source-filter-icon").innerHTML=Ue(it),vt(!0)});k("#directory").addEventListener("change",e=>{We=e.target.value,vt(!0)});k("#children").addEventListener("change",e=>{hn=e.target.checked,vt()});k("#archived").addEventListener("change",e=>{pn=e.target.checked,vt()});document.querySelectorAll("[data-days]").forEach(e=>e.addEventListener("click",()=>{at=Number(e.dataset.days),lt="",ct="",vt(!0)}));k("#reset-camera").addEventListener("click",()=>{ve(),ee?.reset()});k("#refresh").addEventListener("click",()=>{X?.onboarding?gt.open(!0):gt.refresh()});k("#scrubber").addEventListener("input",e=>{ve(),me=Number(e.target.value)/1e3,wn()});k("#play").addEventListener("click",()=>{if(De.length){if(gn)return ve();me>=1&&(me=0),wn(),gn=!0,ee?.setPlaying(!0),$o=performance.now(),k("#play").innerHTML=F("pause"),k("#play").setAttribute("aria-label","Pause timeline"),Oe(),ei=requestAnimationFrame(Oc)}});for(const e of[!1,!0])k(`#view-${e?"2d":"3d"}`).addEventListener("click",()=>vr({view:e?"2d":"3d"}));k("#motion").addEventListener("click",()=>vr({motion:mo(q,Js.matches)?"off":"on"}));k("#help").addEventListener("click",()=>{k("#help-dialog").showModal(),bn()});k("#help-dialog").addEventListener("close",bn);k("#close-help").addEventListener("click",()=>k("#help-dialog").close());document.addEventListener("keydown",e=>{if(!e.defaultPrevented&&!document.querySelector("dialog[open]")&&!mr.handleKey(e)){if(e.key==="Escape"){W?Lc():ke("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=Qo,s=n.findIndex(i=>i.id===W),r=e.key==="ArrowLeft"||e.key==="ArrowUp"?-1:1,o=n[Math.max(0,Math.min(n.length-1,s+r))];o&&(e.preventDefault(),En(o.id),t.closest(".session-card")&&(Zn.has(o.id)||(nn=Math.min(n.length,nn+100),di()),Zn.get(o.id)?.focus({preventScroll:!0})));return}}if(e.key.toLowerCase()==="f"&&(ve(),ee?.reset()),e.key.toLowerCase()==="h"){const t=["explorer","timeline","inspector"].filter(n=>!k(`#${n}`).hidden);t.length?(Kr=t,t.forEach(n=>ke(n,!1))):(Kr.length?Kr:["explorer","timeline"]).forEach(n=>{(n!=="inspector"||W)&&ke(n,!0)})}}}});li().then(()=>{X?.importing?gt.resume():ss()});export{Sv as C,dr as D,zc as F,$v as R,dd as S,hd as T,xv as a,Va as b,Da as c,Y as d,$n as h,Nl as i,mo as m,vi as t};
|