fastrmemory 0.4.0 → 0.5.0

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.
Files changed (38) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +2 -2
  3. package/.cursor/mcp.json +1 -1
  4. package/.cursor/skills/fastr-setup/SKILL.md +4 -4
  5. package/.cursor/skills/skills.json +1 -1
  6. package/README.md +72 -31
  7. package/dist/bin/fastr.js +9 -3
  8. package/dist/bin/fastr.js.map +1 -1
  9. package/dist/src/installer/mcp-command.d.ts +19 -0
  10. package/dist/src/installer/mcp-command.d.ts.map +1 -0
  11. package/dist/src/installer/mcp-command.js +57 -0
  12. package/dist/src/installer/mcp-command.js.map +1 -0
  13. package/dist/src/installer/mcp-init.d.ts +16 -0
  14. package/dist/src/installer/mcp-init.d.ts.map +1 -1
  15. package/dist/src/installer/mcp-init.js +32 -10
  16. package/dist/src/installer/mcp-init.js.map +1 -1
  17. package/dist/src/installer/setup.d.ts +1 -12
  18. package/dist/src/installer/setup.d.ts.map +1 -1
  19. package/dist/src/installer/setup.js +2 -31
  20. package/dist/src/installer/setup.js.map +1 -1
  21. package/dist/src/ui/server.d.ts.map +1 -1
  22. package/dist/src/ui/server.js +10 -0
  23. package/dist/src/ui/server.js.map +1 -1
  24. package/dist-ui/assets/{ActionsPage-B3quzFNF.js → ActionsPage-CI-IRMeS.js} +1 -1
  25. package/dist-ui/assets/{GraphPage-DetiATmC.js → GraphPage-BdYMF7yz.js} +1 -1
  26. package/dist-ui/assets/{ObservatoryPage-QIGMwENf.js → ObservatoryPage-BG_vg8B9.js} +1 -1
  27. package/dist-ui/assets/{TreemapPage-C7uLZd37.js → TreemapPage-CZreyyLA.js} +1 -1
  28. package/dist-ui/assets/index-Ca9pma3Q.css +1 -0
  29. package/dist-ui/assets/{index-DWAH--Fu.js → index-MlNuiu0T.js} +17 -17
  30. package/dist-ui/assets/{maximize-2-BebkGbZA.js → maximize-2-_nvSvCC7.js} +1 -1
  31. package/dist-ui/build-manifest.json +11 -11
  32. package/dist-ui/index.html +2 -2
  33. package/llms-install.md +3 -3
  34. package/package.json +1 -1
  35. package/server.json +1 -1
  36. package/skills/fastr-setup/SKILL.md +4 -4
  37. package/skills/skills.json +1 -1
  38. package/dist-ui/assets/index-BJnPINTu.css +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ActionsPage-B3quzFNF.js","assets/vendor-wVc5lIPn.js","assets/query-fe9kutlk.js","assets/maximize-2-BebkGbZA.js","assets/GraphPage-DetiATmC.js","assets/ObservatoryPage-QIGMwENf.js","assets/three-CjKLTR5c.js","assets/TreemapPage-C7uLZd37.js"])))=>i.map(i=>d[i]);
2
- import{R as x,a as Hr,r as p,j as e,T as Wr,b as Gr,c as Ur,d as Kr,e as Yr,f as Xr,S as wn,D as kn,g as Nn,h as Cn,i as _n,k as Sn,l as Mn,m as zn,n as Qr,o as Jr,p as Zr,q as ea,s as ta,t as sa,u as na,v as ra,w as aa,x as oa,L as ia,y as la,z as ca,A as da,B as ua,C as ma,E as ha,F as fa,G as pa,H as xa,I as ga,J as ba,K as ya,_ as et,M as va,N as ja,O as wa,P as ka,Q as Na,U as Ca,V as _a,W as Sa,X as Ma,Y as za,Z as Ea,$ as Ta,a0 as Aa,a1 as $a,a2 as Da}from"./vendor-wVc5lIPn.js";import{Q as Ia,u as pe,k as Kt,a as ws,b as En,c as La}from"./query-fe9kutlk.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();const Ra="modulepreload",Pa=function(t){return"/"+t},Ws={},Yt=function(s,n,r){let a=Promise.resolve();if(n&&n.length>0){let l=function(u){return Promise.all(u.map(m=>Promise.resolve(m).then(i=>({status:"fulfilled",value:i}),i=>({status:"rejected",reason:i}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),d=c?.nonce||c?.getAttribute("nonce");a=l(n.map(u=>{if(u=Pa(u),u in Ws)return;Ws[u]=!0;const m=u.endsWith(".css"),i=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${i}`))return;const h=document.createElement("link");if(h.rel=m?"stylesheet":Ra,m||(h.as="script"),h.crossOrigin="",h.href=u,d&&h.setAttribute("nonce",d),document.head.appendChild(h),m)return new Promise((g,C)=>{h.addEventListener("load",g),h.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${u}`)))})}))}function o(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return a.then(l=>{for(const c of l||[])c.status==="rejected"&&o(c.reason);return s().catch(o)})};function Oa(t){if(typeof document>"u")return;let s=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",s.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}const Fa=t=>{switch(t){case"success":return Va;case"info":return Wa;case"warning":return Ha;case"error":return Ga;default:return null}},Ba=Array(12).fill(0),qa=({visible:t,className:s})=>x.createElement("div",{className:["sonner-loading-wrapper",s].filter(Boolean).join(" "),"data-visible":t},x.createElement("div",{className:"sonner-spinner"},Ba.map((n,r)=>x.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),Va=x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},x.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Ha=x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},x.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Wa=x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},x.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Ga=x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},x.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Ua=x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},x.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),x.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Ka=()=>{const[t,s]=x.useState(document.hidden);return x.useEffect(()=>{const n=()=>{s(document.hidden)};return document.addEventListener("visibilitychange",n),()=>document.removeEventListener("visibilitychange",n)},[]),t};let Ya=1;const Xa=100,Gs=t=>{var s;return typeof t?.id=="number"||(t==null||(s=t.id)==null?void 0:s.length)>0?t.id:Ya++};class Qa{constructor(){this.subscribe=s=>(this.subscribers.push(s),this.getActiveToasts().forEach(n=>s(n)),()=>{const n=this.subscribers.indexOf(s);this.subscribers.splice(n,1)}),this.publish=s=>{this.subscribers.forEach(n=>n(s))},this.addToast=s=>{this.publish(s),this.toasts=[...this.toasts,s],this.trimHistory()},this.trimHistory=()=>{let s=this.toasts.length-Xa;s<=0||(this.toasts=this.toasts.filter(n=>s>0&&this.dismissedToasts.has(n.id)?(this.dismissedToasts.delete(n.id),s--,!1):!0))},this.create=s=>{const{message:n,...r}=s,a=Gs(s),o=this.pendingDismissals.get(a);o!==void 0&&(cancelAnimationFrame(o),this.pendingDismissals.delete(a),this.dismissedToasts.delete(a));const l=this.dismissedToasts.has(a),c=s.dismissible===void 0?!0:s.dismissible;return l&&(this.dismissedToasts.delete(a),this.toasts=this.toasts.filter(u=>u.id!==a)),(l?void 0:this.toasts.find(u=>u.id===a))?this.toasts=this.toasts.map(u=>u.id===a?(this.publish({...u,...s,id:a,title:n}),{...u,...s,id:a,dismissible:c,title:n}):u):this.addToast({title:n,...r,dismissible:c,id:a}),a},this.dismiss=s=>{if(s==null)return this.getActiveToasts().forEach(r=>{this.dismissedToasts.add(r.id),this.subscribers.forEach(a=>a({id:r.id,dismiss:!0}))}),s;this.dismissedToasts.add(s);const n=this.pendingDismissals.get(s);return n!==void 0&&cancelAnimationFrame(n),this.pendingDismissals.set(s,requestAnimationFrame(()=>{this.pendingDismissals.delete(s),this.subscribers.forEach(r=>r({id:s,dismiss:!0}))})),s},this.message=(s,n)=>this.create({...n,message:s,type:void 0}),this.error=(s,n)=>this.create({...n,message:s,type:"error"}),this.success=(s,n)=>this.create({...n,type:"success",message:s}),this.info=(s,n)=>this.create({...n,type:"info",message:s}),this.warning=(s,n)=>this.create({...n,type:"warning",message:s}),this.loading=(s,n)=>this.create({...n,type:"loading",message:s}),this.promise=(s,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:s,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const a=Promise.resolve(s instanceof Function?s():s);let o=r!==void 0,l;const c=a.then(async u=>{if(l=["resolve",u],x.isValidElement(u))o=!1,this.create({id:r,type:"default",message:u});else if(Za(u)&&!u.ok){o=!1;const i=typeof n.error=="function"?await n.error(`HTTP error! status: ${u.status}`):n.error,h=typeof n.description=="function"?await n.description(`HTTP error! status: ${u.status}`):n.description,C=typeof i=="object"&&!x.isValidElement(i)?i:{message:i};this.create({id:r,type:"error",description:h,...C})}else if(u instanceof Error){o=!1;const i=typeof n.error=="function"?await n.error(u):n.error,h=typeof n.description=="function"?await n.description(u):n.description,C=typeof i=="object"&&!x.isValidElement(i)?i:{message:i};this.create({id:r,type:"error",description:h,...C})}else if(n.success!==void 0){o=!1;const i=typeof n.success=="function"?await n.success(u):n.success,h=typeof n.description=="function"?await n.description(u):n.description,C=typeof i=="object"&&!x.isValidElement(i)?i:{message:i};this.create({id:r,type:"success",description:h,...C})}}).catch(async u=>{if(l=["reject",u],n.error!==void 0){o=!1;const m=typeof n.error=="function"?await n.error(u):n.error,i=typeof n.description=="function"?await n.description(u):n.description,g=typeof m=="object"&&!x.isValidElement(m)?m:{message:m};this.create({id:r,type:"error",description:i,...g})}}).finally(()=>{o&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),d=()=>new Promise((u,m)=>c.then(()=>l[0]==="reject"?m(l[1]):u(l[1])).catch(m));return typeof r!="string"&&typeof r!="number"?{unwrap:d}:Object.assign(r,{unwrap:d})},this.custom=(s,n)=>{const r=Gs(n);return this.create({...n,jsx:s(r),id:r,type:void 0}),r},this.getActiveToasts=()=>this.toasts.filter(s=>!this.dismissedToasts.has(s.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}}const he=new Qa,Ja=(t,s)=>he.message(t,s),Za=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",eo=Ja,to=()=>he.toasts,so=()=>he.getActiveToasts(),ie=Object.assign(eo,{success:he.success,info:he.info,warning:he.warning,error:he.error,custom:he.custom,message:he.message,promise:he.promise,dismiss:he.dismiss,loading:he.loading},{getHistory:to,getToasts:so});Oa("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Pt(t){return t.label!==void 0}const no=3,ro="24px",ao="16px",Us=4e3,oo=356,io=14,lo=45,co=200;function ze(...t){return t.filter(Boolean).join(" ")}function uo(t){const[s,n]=t.split("-"),r=[];return s&&r.push(s),n&&r.push(n),r}const mo=t=>{var s,n,r,a,o,l,c,d,u;const{invert:m,toast:i,unstyled:h,interacting:g,setHeights:C,visibleToasts:_,heights:S,index:y,toasts:F,expanded:L,removeToast:B,defaultRichColors:U,closeButton:W,style:V,cancelButtonStyle:j,actionButtonStyle:q,className:ge="",descriptionClassName:ue="",duration:K,position:T,gap:H,expandByDefault:Y,classNames:f,icons:M,closeButtonAriaLabel:O="Close toast"}=t,[R,k]=x.useState(null),[be,je]=x.useState(null),[Ie,P]=x.useState(!1),[$,D]=x.useState(!1),[Z,we]=x.useState(!1),[E,Be]=x.useState(!1),[Le,Ce]=x.useState(!1),[Re,qe]=x.useState(0),[Dr,Is]=x.useState(0),wt=x.useRef(i.duration||K||Us),Ls=x.useRef(null),Pe=x.useRef(null),Ir=y===0,Lr=y+1<=_,oe=i.type,Rs=oe??"default",nt=i.dismissible!==!1,Rr=i.className||"",Pr=i.descriptionClassName||"",Rt=x.useMemo(()=>S.findIndex(z=>z.toastId===i.id)||0,[S,i.id]),Or=x.useMemo(()=>{var z;return(z=i.closeButton)!=null?z:W},[i.closeButton,W]),Ps=x.useMemo(()=>i.duration||K||Us,[i.duration,K]),ss=x.useRef(0),rt=x.useRef(0),Os=x.useRef(0),at=x.useRef(null),[Fr,Br]=T.split("-"),Fs=x.useMemo(()=>S.reduce((z,J,se)=>se>=Rt?z:z+J.height,0),[S,Rt]),Bs=Ka(),_e=x.useMemo(()=>{var z;return(z=t.swipeDirections)!=null?z:uo(T)},[t.swipeDirections,T]),qr=i.invert||m,ns=oe==="loading";rt.current=x.useMemo(()=>Rt*H+Fs,[Rt,Fs]),x.useEffect(()=>{wt.current=Ps},[Ps]),x.useEffect(()=>{P(!0)},[]),x.useEffect(()=>{const z=Pe.current;if(z){const J=z.getBoundingClientRect().height;return Is(J),C(se=>[{toastId:i.id,height:J,position:i.position},...se]),()=>C(se=>se.filter(me=>me.toastId!==i.id))}},[C,i.id]),x.useLayoutEffect(()=>{if(!Ie)return;const z=Pe.current,J=z.style.height;z.style.height="auto";const se=z.getBoundingClientRect().height;z.style.height=J,Is(se),C(me=>me.find(ee=>ee.toastId===i.id)?me.map(ee=>ee.toastId===i.id?{...ee,height:se}:ee):[{toastId:i.id,height:se,position:i.position},...me])},[Ie,i.title,i.description,C,i.id,i.jsx,i.action,i.cancel]);const Ve=x.useCallback(()=>{D(!0),qe(rt.current),C(z=>z.filter(J=>J.toastId!==i.id)),setTimeout(()=>{B(i)},co)},[i,B,C,rt]);x.useEffect(()=>{if(i.promise&&oe==="loading"||i.duration===1/0||i.type==="loading")return;let z;return L||g||Bs?(()=>{if(Os.current<ss.current){const me=new Date().getTime()-ss.current;wt.current=wt.current-me}Os.current=new Date().getTime()})():(()=>{wt.current!==1/0&&(ss.current=new Date().getTime(),z=setTimeout(()=>{i.onAutoClose==null||i.onAutoClose.call(i,i),Ve()},wt.current))})(),()=>clearTimeout(z)},[L,g,i,oe,Bs,Ve]),x.useEffect(()=>{i.delete&&(Ve(),i.onDismiss==null||i.onDismiss.call(i,i))},[Ve,i.delete]);function qs(){var z;if(M?.loading){var J;return x.createElement("div",{className:ze(f?.loader,i==null||(J=i.classNames)==null?void 0:J.loader,"sonner-loader"),"data-visible":oe==="loading"},M.loading)}return x.createElement(qa,{className:ze(f?.loader,i==null||(z=i.classNames)==null?void 0:z.loader),visible:oe==="loading"})}const Vr=i.icon||M?.[oe]||Fa(oe);var Vs,Hs;return x.createElement("li",{tabIndex:0,ref:Pe,className:ze(ge,Rr,f?.toast,i==null||(s=i.classNames)==null?void 0:s.toast,f?.[Rs],i==null||(n=i.classNames)==null?void 0:n[Rs]),"data-sonner-toast":"","data-rich-colors":(Vs=i.richColors)!=null?Vs:U,"data-styled":!(i.jsx||i.unstyled||h),"data-mounted":Ie,"data-promise":!!i.promise,"data-swiped":Le,"data-removed":$,"data-visible":Lr,"data-y-position":Fr,"data-x-position":Br,"data-index":y,"data-front":Ir,"data-swiping":Z,"data-dismissible":nt,"data-type":oe,"data-invert":qr,"data-swipe-out":E,"data-swipe-direction":be,"data-expanded":!!(L||Y&&Ie),"data-testid":i.testId,style:{"--index":y,"--toasts-before":y,"--z-index":F.length-y,"--offset":`${$?Re:rt.current}px`,"--initial-height":Y?"auto":`${Dr}px`,...V,...i.style},onDragEnd:()=>{we(!1),k(null),at.current=null},onPointerDown:z=>{z.button!==2&&(ns||!nt||(Ls.current=new Date,qe(rt.current),z.target.setPointerCapture(z.pointerId),z.target.tagName!=="BUTTON"&&(we(!0),at.current={x:z.clientX,y:z.clientY})))},onPointerUp:()=>{var z,J,se;if(E||!nt)return;at.current=null;const me=Number(((z=Pe.current)==null?void 0:z.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),kt=Number(((J=Pe.current)==null?void 0:J.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),ee=new Date().getTime()-((se=Ls.current)==null?void 0:se.getTime()),ye=R==="x"?me:kt,Se=Math.abs(ye)/ee;if((R==="x"?_e.includes(me>0?"right":"left"):_e.includes(kt>0?"bottom":"top"))&&(Math.abs(ye)>=lo||Se>.11)){qe(rt.current),i.onDismiss==null||i.onDismiss.call(i,i),je(R==="x"?me>0?"right":"left":kt>0?"down":"up"),Ve(),Be(!0);return}else{var Me,as;(Me=Pe.current)==null||Me.style.setProperty("--swipe-amount-x","0px"),(as=Pe.current)==null||as.style.setProperty("--swipe-amount-y","0px")}Ce(!1),we(!1),k(null)},onPointerMove:z=>{var J,se,me;if(!at.current||!nt||((J=window.getSelection())==null?void 0:J.toString().length)>0)return;const ee=z.clientY-at.current.y,ye=z.clientX-at.current.x;!R&&(Math.abs(ye)>1||Math.abs(ee)>1)&&k(Math.abs(ye)>Math.abs(ee)?"x":"y");let Se={x:0,y:0};const rs=Me=>1/(1.5+Math.abs(Me)/20);if(R==="y"){if(_e.includes("top")||_e.includes("bottom"))if(_e.includes("top")&&ee<0||_e.includes("bottom")&&ee>0)Se.y=ee;else{const Me=ee*rs(ee);Se.y=Math.abs(Me)<Math.abs(ee)?Me:ee}}else if(R==="x"&&(_e.includes("left")||_e.includes("right")))if(_e.includes("left")&&ye<0||_e.includes("right")&&ye>0)Se.x=ye;else{const Me=ye*rs(ye);Se.x=Math.abs(Me)<Math.abs(ye)?Me:ye}(Math.abs(Se.x)>0||Math.abs(Se.y)>0)&&Ce(!0),(se=Pe.current)==null||se.style.setProperty("--swipe-amount-x",`${Se.x}px`),(me=Pe.current)==null||me.style.setProperty("--swipe-amount-y",`${Se.y}px`)}},Or&&!i.jsx&&oe!=="loading"?x.createElement("button",{"aria-label":O,"data-disabled":ns,"data-close-button":!0,onClick:ns||!nt?()=>{}:()=>{Ve(),i.onDismiss==null||i.onDismiss.call(i,i)},className:ze(f?.closeButton,i==null||(r=i.classNames)==null?void 0:r.closeButton)},(Hs=M?.close)!=null?Hs:Ua):null,(oe||i.icon||i.promise)&&i.icon!==null&&(M?.[oe]!==null||i.icon)?x.createElement("div",{"data-icon":"",className:ze(f?.icon,i==null||(a=i.classNames)==null?void 0:a.icon)},oe==="loading"?i.icon||qs():i.promise?qs():null,oe!=="loading"?Vr:null):null,x.createElement("div",{"data-content":"",className:ze(f?.content,i==null||(o=i.classNames)==null?void 0:o.content)},x.createElement("div",{"data-title":"",className:ze(f?.title,i==null||(l=i.classNames)==null?void 0:l.title)},i.jsx?i.jsx:typeof i.title=="function"?i.title():i.title),i.description?x.createElement("div",{"data-description":"",className:ze(ue,Pr,f?.description,i==null||(c=i.classNames)==null?void 0:c.description)},typeof i.description=="function"?i.description():i.description):null),x.isValidElement(i.cancel)?i.cancel:i.cancel&&Pt(i.cancel)?x.createElement("button",{"data-button":!0,"data-cancel":!0,style:i.cancelButtonStyle||j,onClick:z=>{Pt(i.cancel)&&nt&&(i.cancel.onClick==null||i.cancel.onClick.call(i.cancel,z),Ve())},className:ze(f?.cancelButton,i==null||(d=i.classNames)==null?void 0:d.cancelButton)},i.cancel.label):null,x.isValidElement(i.action)?i.action:i.action&&Pt(i.action)?x.createElement("button",{"data-button":!0,"data-action":!0,style:i.actionButtonStyle||q,onClick:z=>{Pt(i.action)&&(i.action.onClick==null||i.action.onClick.call(i.action,z),!z.defaultPrevented&&Ve())},className:ze(f?.actionButton,i==null||(u=i.classNames)==null?void 0:u.actionButton)},i.action.label):null)};function Ks(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function ho(t,s){const n={};return[t,s].forEach((r,a)=>{const o=a===1,l=o?"--mobile-offset":"--offset",c=o?ao:ro;function d(u){["top","right","bottom","left"].forEach(m=>{n[`${l}-${m}`]=typeof u=="number"?`${u}px`:u})}typeof r=="number"||typeof r=="string"?d(r):typeof r=="object"?["top","right","bottom","left"].forEach(u=>{r[u]===void 0?n[`${l}-${u}`]=c:n[`${l}-${u}`]=typeof r[u]=="number"?`${r[u]}px`:r[u]}):d(c)}),n}const fo=x.forwardRef(function(s,n){const{id:r,invert:a,position:o="bottom-right",hotkey:l=["altKey","KeyT"],expand:c,closeButton:d,className:u,offset:m,mobileOffset:i,theme:h="light",richColors:g,duration:C,style:_,visibleToasts:S=no,toastOptions:y,dir:F=Ks(),gap:L=io,icons:B,customAriaLabel:U,containerAriaLabel:W="Notifications"}=s,[V,j]=x.useState([]),q=x.useMemo(()=>r?V.filter(P=>P.toasterId===r):V.filter(P=>!P.toasterId),[V,r]),ge=x.useMemo(()=>Array.from(new Set([o].concat(q.filter(P=>P.position).map(P=>P.position)))),[q,o]),[ue,K]=x.useState([]),[T,H]=x.useState(!1),[Y,f]=x.useState(!1),[M,O]=x.useState(h!=="system"?h:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),R=x.useRef(null),k=l.join("+").replace(/Key/g,"").replace(/Digit/g,""),be=x.useRef(null),je=x.useRef(!1),Ie=x.useCallback(P=>{j($=>{var D;return(D=$.find(Z=>Z.id===P.id))!=null&&D.delete||he.dismiss(P.id),$.filter(({id:Z})=>Z!==P.id)})},[]);return x.useEffect(()=>he.subscribe(P=>{if(P.dismiss){requestAnimationFrame(()=>{j($=>$.map(D=>D.id===P.id?{...D,delete:!0}:D))});return}setTimeout(()=>{Hr.flushSync(()=>{j($=>{const D=$.findIndex(Z=>Z.id===P.id);return D!==-1?[...$.slice(0,D),{...$[D],...P},...$.slice(D+1)]:[P,...$]})})})}),[]),x.useEffect(()=>{if(h!=="system"){O(h);return}if(h==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?O("dark"):O("light")),typeof window>"u")return;const P=window.matchMedia("(prefers-color-scheme: dark)");try{P.addEventListener("change",({matches:$})=>{O($?"dark":"light")})}catch{P.addListener(({matches:D})=>{try{O(D?"dark":"light")}catch(Z){console.error(Z)}})}},[h]),x.useEffect(()=>{V.length<=1&&H(!1)},[V]),x.useEffect(()=>{const P=$=>{var D;if(l.length>0&&l.every(E=>$[E]||$.code===E)){var we;H(!0),(we=R.current)==null||we.focus()}$.code==="Escape"&&(document.activeElement===R.current||(D=R.current)!=null&&D.contains(document.activeElement))&&H(!1)};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[l]),x.useEffect(()=>{if(R.current)return()=>{be.current&&(be.current.focus({preventScroll:!0}),be.current=null,je.current=!1)}},[R.current]),x.createElement("section",{ref:n,"aria-label":U??`${W} ${k}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},ge.map((P,$)=>{var D;const[Z,we]=P.split("-");return q.length?x.createElement("ol",{key:P,dir:F==="auto"?Ks():F,tabIndex:-1,ref:R,className:u,"data-sonner-toaster":!0,"data-sonner-theme":M,"data-y-position":Z,"data-x-position":we,style:{"--front-toast-height":`${((D=ue[0])==null?void 0:D.height)||0}px`,"--width":`${oo}px`,"--gap":`${L}px`,..._,...ho(m,i)},onBlur:E=>{je.current&&!E.currentTarget.contains(E.relatedTarget)&&(je.current=!1,be.current&&(be.current.focus({preventScroll:!0}),be.current=null))},onFocus:E=>{E.target instanceof HTMLElement&&E.target.dataset.dismissible==="false"||je.current||(je.current=!0,be.current=E.relatedTarget)},onMouseEnter:()=>H(!0),onMouseMove:()=>H(!0),onMouseLeave:()=>{Y||H(!1)},onDragEnd:()=>H(!1),onPointerDown:E=>{E.target instanceof HTMLElement&&E.target.dataset.dismissible==="false"||f(!0)},onPointerUp:()=>f(!1)},q.filter(E=>!E.position&&$===0||E.position===P).map((E,Be)=>{var Le,Ce;return x.createElement(mo,{key:E.id,icons:B,index:Be,toast:E,defaultRichColors:g,duration:(Le=y?.duration)!=null?Le:C,className:y?.className,descriptionClassName:y?.descriptionClassName,invert:a,visibleToasts:S,closeButton:(Ce=y?.closeButton)!=null?Ce:d,interacting:Y,position:P,style:y?.style,unstyled:y?.unstyled,classNames:y?.classNames,cancelButtonStyle:y?.cancelButtonStyle,actionButtonStyle:y?.actionButtonStyle,closeButtonAriaLabel:y?.closeButtonAriaLabel,removeToast:Ie,toasts:q.filter(Re=>Re.position==E.position),heights:ue.filter(Re=>Re.position==E.position),setHeights:K,expandByDefault:c,gap:L,expanded:T,swipeDirections:s.swipeDirections})})):null}))}),Tn="fastr-theme",An=p.createContext(null);function po(){try{const t=localStorage.getItem(Tn);if(t==="light"||t==="dark"||t==="system")return t}catch{}return"system"}function xo(){return typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}function go({children:t}){const[s,n]=p.useState(po),[r,a]=p.useState(xo);p.useEffect(()=>{if(!window.matchMedia)return;const d=window.matchMedia("(prefers-color-scheme: dark)"),u=()=>a(d.matches);return d.addEventListener("change",u),()=>d.removeEventListener("change",u)},[]);const o=s==="system"?r?"dark":"light":s;p.useLayoutEffect(()=>{document.documentElement.classList.toggle("dark",o==="dark")},[o]);const l=p.useCallback(d=>{n(d);try{localStorage.setItem(Tn,d)}catch{}},[]),c=p.useMemo(()=>({mode:s,resolved:o,setMode:l}),[s,o,l]);return e.jsx(An.Provider,{value:c,children:t})}function Xt(){const t=p.useContext(An);if(!t)throw new Error("useTheme must be used inside ThemeProvider");return t}function Yd(t,s="#888"){return typeof window>"u"?s:getComputedStyle(document.documentElement).getPropertyValue(t).trim()||s}function bo(t){const{resolved:s}=Xt();return e.jsx(fo,{theme:s,className:"toaster group",containerAriaLabel:"Notifications",style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)"},...t})}function $n(t){var s,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(s=0;s<a;s++)t[s]&&(n=$n(t[s]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function Dn(){for(var t,s,n=0,r="",a=arguments.length;n<a;n++)(t=arguments[n])&&(s=$n(t))&&(r&&(r+=" "),r+=s);return r}const yo=(t,s)=>{const n=new Array(t.length+s.length);for(let r=0;r<t.length;r++)n[r]=t[r];for(let r=0;r<s.length;r++)n[t.length+r]=s[r];return n},vo=(t,s)=>({classGroupId:t,validator:s}),In=(t=new Map,s=null,n)=>({nextPart:t,validators:s,classGroupId:n}),Ht="-",Ys=[],jo="arbitrary..",wo=t=>{const s=No(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return ko(l);const c=l.split(Ht),d=c[0]===""&&c.length>1?1:0;return Ln(c,d,s)},getConflictingClassGroupIds:(l,c)=>{if(c){const d=r[l],u=n[l];return d?u?yo(u,d):d:u||Ys}return n[l]||Ys}}},Ln=(t,s,n)=>{if(t.length-s===0)return n.classGroupId;const a=t[s],o=n.nextPart.get(a);if(o){const u=Ln(t,s+1,o);if(u)return u}const l=n.validators;if(l===null)return;const c=s===0?t.join(Ht):t.slice(s).join(Ht),d=l.length;for(let u=0;u<d;u++){const m=l[u];if(m.validator(c))return m.classGroupId}},ko=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const s=t.slice(1,-1),n=s.indexOf(":"),r=s.slice(0,n);return r?jo+r:void 0})(),No=t=>{const{theme:s,classGroups:n}=t;return Co(n,s)},Co=(t,s)=>{const n=In();for(const r in t){const a=t[r];ks(a,n,r,s)}return n},ks=(t,s,n,r)=>{const a=t.length;for(let o=0;o<a;o++){const l=t[o];_o(l,s,n,r)}},_o=(t,s,n,r)=>{if(typeof t=="string"){So(t,s,n);return}if(typeof t=="function"){Mo(t,s,n,r);return}zo(t,s,n,r)},So=(t,s,n)=>{const r=t===""?s:Rn(s,t);r.classGroupId=n},Mo=(t,s,n,r)=>{if(Eo(t)){ks(t(r),s,n,r);return}s.validators===null&&(s.validators=[]),s.validators.push(vo(n,t))},zo=(t,s,n,r)=>{const a=Object.entries(t),o=a.length;for(let l=0;l<o;l++){const[c,d]=a[l];ks(d,Rn(s,c),n,r)}},Rn=(t,s)=>{let n=t;const r=s.split(Ht),a=r.length;for(let o=0;o<a;o++){const l=r[o];let c=n.nextPart.get(l);c||(c=In(),n.nextPart.set(l,c)),n=c}return n},Eo=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,To=t=>{if(t<1)return{get:()=>{},set:()=>{}};let s=0,n=Object.create(null),r=Object.create(null);const a=(o,l)=>{n[o]=l,s++,s>t&&(s=0,r=n,n=Object.create(null))};return{get(o){let l=n[o];if(l!==void 0)return l;if((l=r[o])!==void 0)return a(o,l),l},set(o,l){o in n?n[o]=l:a(o,l)}}},hs="!",Xs=":",Ao=[],Qs=(t,s,n,r,a)=>({modifiers:t,hasImportantModifier:s,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),$o=t=>{const{prefix:s,experimentalParseClassName:n}=t;let r=a=>{const o=[];let l=0,c=0,d=0,u;const m=a.length;for(let _=0;_<m;_++){const S=a[_];if(l===0&&c===0){if(S===Xs){o.push(a.slice(d,_)),d=_+1;continue}if(S==="/"){u=_;continue}}S==="["?l++:S==="]"?l--:S==="("?c++:S===")"&&c--}const i=o.length===0?a:a.slice(d);let h=i,g=!1;i.endsWith(hs)?(h=i.slice(0,-1),g=!0):i.startsWith(hs)&&(h=i.slice(1),g=!0);const C=u&&u>d?u-d:void 0;return Qs(o,g,h,C)};if(s){const a=s+Xs,o=r;r=l=>l.startsWith(a)?o(l.slice(a.length)):Qs(Ao,!1,l,void 0,!0)}if(n){const a=r;r=o=>n({className:o,parseClassName:a})}return r},Do=t=>{const s=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{s.set(n,1e6+r)}),n=>{const r=[];let a=[];for(let o=0;o<n.length;o++){const l=n[o],c=l[0]==="[",d=s.has(l);c||d?(a.length>0&&(a.sort(),r.push(...a),a=[]),r.push(l)):a.push(l)}return a.length>0&&(a.sort(),r.push(...a)),r}},Io=t=>({cache:To(t.cacheSize),parseClassName:$o(t),sortModifiers:Do(t),postfixLookupClassGroupIds:Lo(t),...wo(t)}),Lo=t=>{const s=Object.create(null),n=t.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)s[n[r]]=!0;return s},Ro=/\s+/,Po=(t,s)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:o,postfixLookupClassGroupIds:l}=s,c=[],d=t.trim().split(Ro);let u="";for(let m=d.length-1;m>=0;m-=1){const i=d[m],{isExternal:h,modifiers:g,hasImportantModifier:C,baseClassName:_,maybePostfixModifierPosition:S}=n(i);if(h){u=i+(u.length>0?" "+u:u);continue}let y=!!S,F;if(y){const V=_.substring(0,S);F=r(V);const j=F&&l[F]?r(_):void 0;j&&j!==F&&(F=j,y=!1)}else F=r(_);if(!F){if(!y){u=i+(u.length>0?" "+u:u);continue}if(F=r(_),!F){u=i+(u.length>0?" "+u:u);continue}y=!1}const L=g.length===0?"":g.length===1?g[0]:o(g).join(":"),B=C?L+hs:L,U=B+F;if(c.indexOf(U)>-1)continue;c.push(U);const W=a(F,y);for(let V=0;V<W.length;++V){const j=W[V];c.push(B+j)}u=i+(u.length>0?" "+u:u)}return u},Oo=(...t)=>{let s=0,n,r,a="";for(;s<t.length;)(n=t[s++])&&(r=Pn(n))&&(a&&(a+=" "),a+=r);return a},Pn=t=>{if(typeof t=="string")return t;let s,n="";for(let r=0;r<t.length;r++)t[r]&&(s=Pn(t[r]))&&(n&&(n+=" "),n+=s);return n},Fo=(t,...s)=>{let n,r,a,o;const l=d=>{const u=s.reduce((m,i)=>i(m),t());return n=Io(u),r=n.cache.get,a=n.cache.set,o=c,c(d)},c=d=>{const u=r(d);if(u)return u;const m=Po(d,n);return a(d,m),m};return o=l,(...d)=>o(Oo(...d))},Bo=[],X=t=>{const s=n=>n[t]||Bo;return s.isThemeGetter=!0,s.themeKey=t,s},On=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Fn=/^\((?:(\w[\w-]*):)?(.+)\)$/i,qo=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Vo=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ho=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Wo=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,Go=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Uo=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,He=t=>qo.test(t),A=t=>!!t&&!Number.isNaN(Number(t)),Ee=t=>!!t&&Number.isInteger(Number(t)),os=t=>t.endsWith("%")&&A(t.slice(0,-1)),Oe=t=>Vo.test(t),Bn=()=>!0,Ko=t=>Ho.test(t)&&!Wo.test(t),Ns=()=>!1,Yo=t=>Go.test(t),Xo=t=>Uo.test(t),Qo=t=>!v(t)&&!w(t),Jo=t=>t.startsWith("@container")&&(t[10]==="/"&&t[11]!==void 0||t[11]==="s"&&t[16]!==void 0&&t.startsWith("-size/",10)||t[11]==="n"&&t[18]!==void 0&&t.startsWith("-normal/",10)),Zo=t=>Ke(t,Hn,Ns),v=t=>On.test(t),Xe=t=>Ke(t,Wn,Ko),Js=t=>Ke(t,ii,A),ei=t=>Ke(t,Un,Bn),ti=t=>Ke(t,Gn,Ns),Zs=t=>Ke(t,qn,Ns),si=t=>Ke(t,Vn,Xo),Ot=t=>Ke(t,Kn,Yo),w=t=>Fn.test(t),Nt=t=>tt(t,Wn),ni=t=>tt(t,Gn),en=t=>tt(t,qn),ri=t=>tt(t,Hn),ai=t=>tt(t,Vn),Ft=t=>tt(t,Kn,!0),oi=t=>tt(t,Un,!0),Ke=(t,s,n)=>{const r=On.exec(t);return r?r[1]?s(r[1]):n(r[2]):!1},tt=(t,s,n=!1)=>{const r=Fn.exec(t);return r?r[1]?s(r[1]):n:!1},qn=t=>t==="position"||t==="percentage",Vn=t=>t==="image"||t==="url",Hn=t=>t==="length"||t==="size"||t==="bg-size",Wn=t=>t==="length",ii=t=>t==="number",Gn=t=>t==="family-name",Un=t=>t==="number"||t==="weight",Kn=t=>t==="shadow",li=()=>{const t=X("color"),s=X("font"),n=X("text"),r=X("font-weight"),a=X("tracking"),o=X("leading"),l=X("breakpoint"),c=X("container"),d=X("spacing"),u=X("radius"),m=X("shadow"),i=X("inset-shadow"),h=X("text-shadow"),g=X("drop-shadow"),C=X("blur"),_=X("perspective"),S=X("aspect"),y=X("ease"),F=X("animate"),L=()=>["auto","avoid","all","avoid-page","page","left","right","column"],B=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],U=()=>[...B(),w,v],W=()=>["auto","hidden","clip","visible","scroll"],V=()=>["auto","contain","none"],j=()=>[w,v,d],q=()=>[He,"full","auto",...j()],ge=()=>[Ee,"none","subgrid",w,v],ue=()=>["auto",{span:["full",Ee,w,v]},Ee,w,v],K=()=>[Ee,"auto",w,v],T=()=>["auto","min","max","fr",w,v],H=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Y=()=>["start","end","center","stretch","center-safe","end-safe"],f=()=>["auto",...j()],M=()=>[He,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],O=()=>[c,He,"screen","full","dvw","lvw","svw","min","max","fit",...j()],R=()=>[He,"screen","full","lh","dvh","lvh","svh","min","max","fit",...j()],k=()=>[t,w,v],be=()=>[...B(),en,Zs,{position:[w,v]}],je=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Ie=()=>["auto","cover","contain",ri,Zo,{size:[w,v]}],P=()=>[os,Nt,Xe],$=()=>["","none","full",u,w,v],D=()=>["",A,Nt,Xe],Z=()=>["solid","dashed","dotted","double"],we=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],E=()=>[A,os,en,Zs],Be=()=>["","none",C,w,v],Le=()=>["none",A,w,v],Ce=()=>["none",A,w,v],Re=()=>[A,w,v],qe=()=>[He,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Oe],breakpoint:[Oe],color:[Bn],container:[Oe],"drop-shadow":[Oe],ease:["in","out","in-out"],font:[Qo],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Oe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Oe],shadow:[Oe],spacing:["px",A],text:[Oe],"text-shadow":[Oe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",He,v,w,S]}],container:["container"],"container-type":[{"@container":["","normal","size",w,v]}],"container-named":[Jo],columns:[{columns:[A,"auto",v,w,c]}],"break-after":[{"break-after":L()}],"break-before":[{"break-before":L()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:U()}],overflow:[{overflow:W()}],"overflow-x":[{"overflow-x":W()}],"overflow-y":[{"overflow-y":W()}],overscroll:[{overscroll:V()}],"overscroll-x":[{"overscroll-x":V()}],"overscroll-y":[{"overscroll-y":V()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:q()}],"inset-x":[{"inset-x":q()}],"inset-y":[{"inset-y":q()}],start:[{"inset-s":q(),start:q()}],end:[{"inset-e":q(),end:q()}],"inset-bs":[{"inset-bs":q()}],"inset-be":[{"inset-be":q()}],top:[{top:q()}],right:[{right:q()}],bottom:[{bottom:q()}],left:[{left:q()}],visibility:["visible","invisible","collapse"],z:[{z:[Ee,"auto",w,v]}],basis:[{basis:[He,"full","auto",c,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[A,He,"auto","initial","none",v]}],grow:[{grow:["",A,w,v]}],shrink:[{shrink:["",A,w,v]}],order:[{order:[Ee,"first","last","none",w,v]}],"grid-cols":[{"grid-cols":ge()}],"col-start-end":[{col:ue()}],"col-start":[{"col-start":K()}],"col-end":[{"col-end":K()}],"grid-rows":[{"grid-rows":ge()}],"row-start-end":[{row:ue()}],"row-start":[{"row-start":K()}],"row-end":[{"row-end":K()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":T()}],"auto-rows":[{"auto-rows":T()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...H(),"normal"]}],"justify-items":[{"justify-items":[...Y(),"normal"]}],"justify-self":[{"justify-self":["auto",...Y()]}],"align-content":[{content:["normal",...H()]}],"align-items":[{items:[...Y(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Y(),{baseline:["","last"]}]}],"place-content":[{"place-content":H()}],"place-items":[{"place-items":[...Y(),"baseline"]}],"place-self":[{"place-self":["auto",...Y()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pbs:[{pbs:j()}],pbe:[{pbe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:f()}],mx:[{mx:f()}],my:[{my:f()}],ms:[{ms:f()}],me:[{me:f()}],mbs:[{mbs:f()}],mbe:[{mbe:f()}],mt:[{mt:f()}],mr:[{mr:f()}],mb:[{mb:f()}],ml:[{ml:f()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:M()}],"inline-size":[{inline:["auto",...O()]}],"min-inline-size":[{"min-inline":["auto",...O()]}],"max-inline-size":[{"max-inline":["none",...O()]}],"block-size":[{block:["auto",...R()]}],"min-block-size":[{"min-block":["auto",...R()]}],"max-block-size":[{"max-block":["none",...R()]}],w:[{w:[c,"screen",...M()]}],"min-w":[{"min-w":[c,"screen","none",...M()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[l]},...M()]}],h:[{h:["screen","lh",...M()]}],"min-h":[{"min-h":["screen","lh","none",...M()]}],"max-h":[{"max-h":["screen","lh","none",...M()]}],"font-size":[{text:["base",n,Nt,Xe]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,oi,ei]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",os,v]}],"font-family":[{font:[ni,ti,s]}],"font-features":[{"font-features":[v]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,w,v]}],"line-clamp":[{"line-clamp":[A,"none",w,Js]}],leading:[{leading:["none",o,...j()]}],"list-image":[{"list-image":["none",w,v]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",w,v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:k()}],"text-color":[{text:k()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Z(),"wavy"]}],"text-decoration-thickness":[{decoration:[A,"from-font","auto",w,Xe]}],"text-decoration-color":[{decoration:k()}],"underline-offset":[{"underline-offset":[A,"auto",w,v]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"tab-size":[{tab:[Ee,w,v]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",w,v]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",w,v]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:be()}],"bg-repeat":[{bg:je()}],"bg-size":[{bg:Ie()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ee,w,v],radial:["",w,v],conic:["",Ee,w,v]},ai,si]}],"bg-color":[{bg:k()}],"gradient-from-pos":[{from:P()}],"gradient-via-pos":[{via:P()}],"gradient-to-pos":[{to:P()}],"gradient-from":[{from:k()}],"gradient-via":[{via:k()}],"gradient-to":[{to:k()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:D()}],"border-w-x":[{"border-x":D()}],"border-w-y":[{"border-y":D()}],"border-w-s":[{"border-s":D()}],"border-w-e":[{"border-e":D()}],"border-w-bs":[{"border-bs":D()}],"border-w-be":[{"border-be":D()}],"border-w-t":[{"border-t":D()}],"border-w-r":[{"border-r":D()}],"border-w-b":[{"border-b":D()}],"border-w-l":[{"border-l":D()}],"divide-x":[{"divide-x":D()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":D()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Z(),"hidden","none"]}],"divide-style":[{divide:[...Z(),"hidden","none"]}],"border-color":[{border:k()}],"border-color-x":[{"border-x":k()}],"border-color-y":[{"border-y":k()}],"border-color-s":[{"border-s":k()}],"border-color-e":[{"border-e":k()}],"border-color-bs":[{"border-bs":k()}],"border-color-be":[{"border-be":k()}],"border-color-t":[{"border-t":k()}],"border-color-r":[{"border-r":k()}],"border-color-b":[{"border-b":k()}],"border-color-l":[{"border-l":k()}],"divide-color":[{divide:k()}],"outline-style":[{outline:[...Z(),"none","hidden"]}],"outline-offset":[{"outline-offset":[A,w,v]}],"outline-w":[{outline:["",A,Nt,Xe]}],"outline-color":[{outline:k()}],shadow:[{shadow:["","inner","none",m,Ft,Ot]}],"shadow-color":[{shadow:k()}],"inset-shadow":[{"inset-shadow":["none",i,Ft,Ot]}],"inset-shadow-color":[{"inset-shadow":k()}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:k()}],"ring-offset-w":[{"ring-offset":[A,Xe]}],"ring-offset-color":[{"ring-offset":k()}],"inset-ring-w":[{"inset-ring":D()}],"inset-ring-color":[{"inset-ring":k()}],"text-shadow":[{"text-shadow":["none",h,Ft,Ot]}],"text-shadow-color":[{"text-shadow":k()}],opacity:[{opacity:[A,w,v]}],"mix-blend":[{"mix-blend":[...we(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":we()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[A]}],"mask-image-linear-from-pos":[{"mask-linear-from":E()}],"mask-image-linear-to-pos":[{"mask-linear-to":E()}],"mask-image-linear-from-color":[{"mask-linear-from":k()}],"mask-image-linear-to-color":[{"mask-linear-to":k()}],"mask-image-t-from-pos":[{"mask-t-from":E()}],"mask-image-t-to-pos":[{"mask-t-to":E()}],"mask-image-t-from-color":[{"mask-t-from":k()}],"mask-image-t-to-color":[{"mask-t-to":k()}],"mask-image-r-from-pos":[{"mask-r-from":E()}],"mask-image-r-to-pos":[{"mask-r-to":E()}],"mask-image-r-from-color":[{"mask-r-from":k()}],"mask-image-r-to-color":[{"mask-r-to":k()}],"mask-image-b-from-pos":[{"mask-b-from":E()}],"mask-image-b-to-pos":[{"mask-b-to":E()}],"mask-image-b-from-color":[{"mask-b-from":k()}],"mask-image-b-to-color":[{"mask-b-to":k()}],"mask-image-l-from-pos":[{"mask-l-from":E()}],"mask-image-l-to-pos":[{"mask-l-to":E()}],"mask-image-l-from-color":[{"mask-l-from":k()}],"mask-image-l-to-color":[{"mask-l-to":k()}],"mask-image-x-from-pos":[{"mask-x-from":E()}],"mask-image-x-to-pos":[{"mask-x-to":E()}],"mask-image-x-from-color":[{"mask-x-from":k()}],"mask-image-x-to-color":[{"mask-x-to":k()}],"mask-image-y-from-pos":[{"mask-y-from":E()}],"mask-image-y-to-pos":[{"mask-y-to":E()}],"mask-image-y-from-color":[{"mask-y-from":k()}],"mask-image-y-to-color":[{"mask-y-to":k()}],"mask-image-radial":[{"mask-radial":[w,v]}],"mask-image-radial-from-pos":[{"mask-radial-from":E()}],"mask-image-radial-to-pos":[{"mask-radial-to":E()}],"mask-image-radial-from-color":[{"mask-radial-from":k()}],"mask-image-radial-to-color":[{"mask-radial-to":k()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":B()}],"mask-image-conic-pos":[{"mask-conic":[A]}],"mask-image-conic-from-pos":[{"mask-conic-from":E()}],"mask-image-conic-to-pos":[{"mask-conic-to":E()}],"mask-image-conic-from-color":[{"mask-conic-from":k()}],"mask-image-conic-to-color":[{"mask-conic-to":k()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:be()}],"mask-repeat":[{mask:je()}],"mask-size":[{mask:Ie()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",w,v]}],filter:[{filter:["","none",w,v]}],blur:[{blur:Be()}],brightness:[{brightness:[A,w,v]}],contrast:[{contrast:[A,w,v]}],"drop-shadow":[{"drop-shadow":["","none",g,Ft,Ot]}],"drop-shadow-color":[{"drop-shadow":k()}],grayscale:[{grayscale:["",A,w,v]}],"hue-rotate":[{"hue-rotate":[A,w,v]}],invert:[{invert:["",A,w,v]}],saturate:[{saturate:[A,w,v]}],sepia:[{sepia:["",A,w,v]}],"backdrop-filter":[{"backdrop-filter":["","none",w,v]}],"backdrop-blur":[{"backdrop-blur":Be()}],"backdrop-brightness":[{"backdrop-brightness":[A,w,v]}],"backdrop-contrast":[{"backdrop-contrast":[A,w,v]}],"backdrop-grayscale":[{"backdrop-grayscale":["",A,w,v]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[A,w,v]}],"backdrop-invert":[{"backdrop-invert":["",A,w,v]}],"backdrop-opacity":[{"backdrop-opacity":[A,w,v]}],"backdrop-saturate":[{"backdrop-saturate":[A,w,v]}],"backdrop-sepia":[{"backdrop-sepia":["",A,w,v]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",w,v]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[A,"initial",w,v]}],ease:[{ease:["linear","initial",y,w,v]}],delay:[{delay:[A,w,v]}],animate:[{animate:["none",F,w,v]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[_,w,v]}],"perspective-origin":[{"perspective-origin":U()}],rotate:[{rotate:Le()}],"rotate-x":[{"rotate-x":Le()}],"rotate-y":[{"rotate-y":Le()}],"rotate-z":[{"rotate-z":Le()}],scale:[{scale:Ce()}],"scale-x":[{"scale-x":Ce()}],"scale-y":[{"scale-y":Ce()}],"scale-z":[{"scale-z":Ce()}],"scale-3d":["scale-3d"],skew:[{skew:Re()}],"skew-x":[{"skew-x":Re()}],"skew-y":[{"skew-y":Re()}],transform:[{transform:[w,v,"","none","gpu","cpu"]}],"transform-origin":[{origin:U()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:qe()}],"translate-x":[{"translate-x":qe()}],"translate-y":[{"translate-y":qe()}],"translate-z":[{"translate-z":qe()}],"translate-none":["translate-none"],zoom:[{zoom:[Ee,w,v]}],accent:[{accent:k()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:k()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",w,v]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":k()}],"scrollbar-track-color":[{"scrollbar-track":k()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mbs":[{"scroll-mbs":j()}],"scroll-mbe":[{"scroll-mbe":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pbs":[{"scroll-pbs":j()}],"scroll-pbe":[{"scroll-pbe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",w,v]}],fill:[{fill:["none",...k()]}],"stroke-w":[{stroke:[A,Nt,Xe,Js]}],stroke:[{stroke:["none",...k()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["start","end","right","left"],"inset-y":["inset-bs","inset-be","top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["ps","pe","pr","pl"],py:["pbs","pbe","pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["ms","me","mr","ml"],my:["mbs","mbe","mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-s","border-w-e","border-w-r","border-w-l"],"border-w-y":["border-w-bs","border-w-be","border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-s","border-color-e","border-color-r","border-color-l"],"border-color-y":["border-color-bs","border-color-be","border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-ms","scroll-me","scroll-mr","scroll-ml"],"scroll-my":["scroll-mbs","scroll-mbe","scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-ps","scroll-pe","scroll-pr","scroll-pl"],"scroll-py":["scroll-pbs","scroll-pbe","scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},ci=Fo(li);function b(...t){return ci(Dn(t))}function di(t){const s=t;if(!s||!s.tagName)return!1;const n=s.tagName;return n==="INPUT"||n==="TEXTAREA"||n==="SELECT"||s.isContentEditable}function ui({delayDuration:t=200,...s}){return e.jsx(Xr,{"data-slot":"tooltip-provider",delayDuration:t,...s})}function Tt(t){return e.jsx(Wr,{"data-slot":"tooltip",...t})}function At(t){return e.jsx(Gr,{"data-slot":"tooltip-trigger",...t})}function $t({className:t,sideOffset:s=4,children:n,...r}){return e.jsx(Ur,{children:e.jsxs(Kr,{"data-slot":"tooltip-content",sideOffset:s,className:b("z-50 w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",t),...r,children:[n,e.jsx(Yr,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"})]})})}/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ActionsPage-CI-IRMeS.js","assets/vendor-wVc5lIPn.js","assets/query-fe9kutlk.js","assets/maximize-2-_nvSvCC7.js","assets/GraphPage-BdYMF7yz.js","assets/ObservatoryPage-BG_vg8B9.js","assets/three-CjKLTR5c.js","assets/TreemapPage-CZreyyLA.js"])))=>i.map(i=>d[i]);
2
+ import{R as x,a as Vr,r as p,j as e,T as Wr,b as Gr,c as Ur,d as Kr,e as Yr,f as Xr,S as wn,D as kn,g as Nn,h as Cn,i as Sn,k as _n,l as Mn,m as zn,n as Qr,o as Jr,p as Zr,q as ea,s as ta,t as sa,u as na,v as ra,w as aa,x as oa,L as ia,y as la,z as ca,A as da,B as ua,C as ma,E as ha,F as fa,G as pa,H as xa,I as ga,J as ba,K as ya,_ as et,M as va,N as ja,O as wa,P as ka,Q as Na,U as Ca,V as Sa,W as _a,X as Ma,Y as za,Z as Ea,$ as Ta,a0 as Aa,a1 as $a,a2 as Da}from"./vendor-wVc5lIPn.js";import{Q as Ia,u as pe,k as Yt,a as ws,b as En,c as La}from"./query-fe9kutlk.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();const Ra="modulepreload",Pa=function(t){return"/"+t},Ws={},Xt=function(s,n,r){let a=Promise.resolve();if(n&&n.length>0){let l=function(u){return Promise.all(u.map(m=>Promise.resolve(m).then(i=>({status:"fulfilled",value:i}),i=>({status:"rejected",reason:i}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),d=c?.nonce||c?.getAttribute("nonce");a=l(n.map(u=>{if(u=Pa(u),u in Ws)return;Ws[u]=!0;const m=u.endsWith(".css"),i=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${i}`))return;const h=document.createElement("link");if(h.rel=m?"stylesheet":Ra,m||(h.as="script"),h.crossOrigin="",h.href=u,d&&h.setAttribute("nonce",d),document.head.appendChild(h),m)return new Promise((g,C)=>{h.addEventListener("load",g),h.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${u}`)))})}))}function o(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return a.then(l=>{for(const c of l||[])c.status==="rejected"&&o(c.reason);return s().catch(o)})};function Oa(t){if(typeof document>"u")return;let s=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",s.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}const Fa=t=>{switch(t){case"success":return Ha;case"info":return Wa;case"warning":return Va;case"error":return Ga;default:return null}},Ba=Array(12).fill(0),qa=({visible:t,className:s})=>x.createElement("div",{className:["sonner-loading-wrapper",s].filter(Boolean).join(" "),"data-visible":t},x.createElement("div",{className:"sonner-spinner"},Ba.map((n,r)=>x.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),Ha=x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},x.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Va=x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},x.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Wa=x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},x.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Ga=x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},x.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Ua=x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},x.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),x.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Ka=()=>{const[t,s]=x.useState(document.hidden);return x.useEffect(()=>{const n=()=>{s(document.hidden)};return document.addEventListener("visibilitychange",n),()=>document.removeEventListener("visibilitychange",n)},[]),t};let Ya=1;const Xa=100,Gs=t=>{var s;return typeof t?.id=="number"||(t==null||(s=t.id)==null?void 0:s.length)>0?t.id:Ya++};class Qa{constructor(){this.subscribe=s=>(this.subscribers.push(s),this.getActiveToasts().forEach(n=>s(n)),()=>{const n=this.subscribers.indexOf(s);this.subscribers.splice(n,1)}),this.publish=s=>{this.subscribers.forEach(n=>n(s))},this.addToast=s=>{this.publish(s),this.toasts=[...this.toasts,s],this.trimHistory()},this.trimHistory=()=>{let s=this.toasts.length-Xa;s<=0||(this.toasts=this.toasts.filter(n=>s>0&&this.dismissedToasts.has(n.id)?(this.dismissedToasts.delete(n.id),s--,!1):!0))},this.create=s=>{const{message:n,...r}=s,a=Gs(s),o=this.pendingDismissals.get(a);o!==void 0&&(cancelAnimationFrame(o),this.pendingDismissals.delete(a),this.dismissedToasts.delete(a));const l=this.dismissedToasts.has(a),c=s.dismissible===void 0?!0:s.dismissible;return l&&(this.dismissedToasts.delete(a),this.toasts=this.toasts.filter(u=>u.id!==a)),(l?void 0:this.toasts.find(u=>u.id===a))?this.toasts=this.toasts.map(u=>u.id===a?(this.publish({...u,...s,id:a,title:n}),{...u,...s,id:a,dismissible:c,title:n}):u):this.addToast({title:n,...r,dismissible:c,id:a}),a},this.dismiss=s=>{if(s==null)return this.getActiveToasts().forEach(r=>{this.dismissedToasts.add(r.id),this.subscribers.forEach(a=>a({id:r.id,dismiss:!0}))}),s;this.dismissedToasts.add(s);const n=this.pendingDismissals.get(s);return n!==void 0&&cancelAnimationFrame(n),this.pendingDismissals.set(s,requestAnimationFrame(()=>{this.pendingDismissals.delete(s),this.subscribers.forEach(r=>r({id:s,dismiss:!0}))})),s},this.message=(s,n)=>this.create({...n,message:s,type:void 0}),this.error=(s,n)=>this.create({...n,message:s,type:"error"}),this.success=(s,n)=>this.create({...n,type:"success",message:s}),this.info=(s,n)=>this.create({...n,type:"info",message:s}),this.warning=(s,n)=>this.create({...n,type:"warning",message:s}),this.loading=(s,n)=>this.create({...n,type:"loading",message:s}),this.promise=(s,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:s,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const a=Promise.resolve(s instanceof Function?s():s);let o=r!==void 0,l;const c=a.then(async u=>{if(l=["resolve",u],x.isValidElement(u))o=!1,this.create({id:r,type:"default",message:u});else if(Za(u)&&!u.ok){o=!1;const i=typeof n.error=="function"?await n.error(`HTTP error! status: ${u.status}`):n.error,h=typeof n.description=="function"?await n.description(`HTTP error! status: ${u.status}`):n.description,C=typeof i=="object"&&!x.isValidElement(i)?i:{message:i};this.create({id:r,type:"error",description:h,...C})}else if(u instanceof Error){o=!1;const i=typeof n.error=="function"?await n.error(u):n.error,h=typeof n.description=="function"?await n.description(u):n.description,C=typeof i=="object"&&!x.isValidElement(i)?i:{message:i};this.create({id:r,type:"error",description:h,...C})}else if(n.success!==void 0){o=!1;const i=typeof n.success=="function"?await n.success(u):n.success,h=typeof n.description=="function"?await n.description(u):n.description,C=typeof i=="object"&&!x.isValidElement(i)?i:{message:i};this.create({id:r,type:"success",description:h,...C})}}).catch(async u=>{if(l=["reject",u],n.error!==void 0){o=!1;const m=typeof n.error=="function"?await n.error(u):n.error,i=typeof n.description=="function"?await n.description(u):n.description,g=typeof m=="object"&&!x.isValidElement(m)?m:{message:m};this.create({id:r,type:"error",description:i,...g})}}).finally(()=>{o&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),d=()=>new Promise((u,m)=>c.then(()=>l[0]==="reject"?m(l[1]):u(l[1])).catch(m));return typeof r!="string"&&typeof r!="number"?{unwrap:d}:Object.assign(r,{unwrap:d})},this.custom=(s,n)=>{const r=Gs(n);return this.create({...n,jsx:s(r),id:r,type:void 0}),r},this.getActiveToasts=()=>this.toasts.filter(s=>!this.dismissedToasts.has(s.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}}const he=new Qa,Ja=(t,s)=>he.message(t,s),Za=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",eo=Ja,to=()=>he.toasts,so=()=>he.getActiveToasts(),ie=Object.assign(eo,{success:he.success,info:he.info,warning:he.warning,error:he.error,custom:he.custom,message:he.message,promise:he.promise,dismiss:he.dismiss,loading:he.loading},{getHistory:to,getToasts:so});Oa("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Ot(t){return t.label!==void 0}const no=3,ro="24px",ao="16px",Us=4e3,oo=356,io=14,lo=45,co=200;function ze(...t){return t.filter(Boolean).join(" ")}function uo(t){const[s,n]=t.split("-"),r=[];return s&&r.push(s),n&&r.push(n),r}const mo=t=>{var s,n,r,a,o,l,c,d,u;const{invert:m,toast:i,unstyled:h,interacting:g,setHeights:C,visibleToasts:S,heights:_,index:y,toasts:F,expanded:L,removeToast:B,defaultRichColors:U,closeButton:W,style:H,cancelButtonStyle:j,actionButtonStyle:q,className:ge="",descriptionClassName:ue="",duration:K,position:T,gap:V,expandByDefault:Y,classNames:f,icons:M,closeButtonAriaLabel:O="Close toast"}=t,[R,k]=x.useState(null),[be,je]=x.useState(null),[Ie,P]=x.useState(!1),[$,D]=x.useState(!1),[Z,we]=x.useState(!1),[E,Be]=x.useState(!1),[Le,Ce]=x.useState(!1),[Re,qe]=x.useState(0),[Dr,Is]=x.useState(0),wt=x.useRef(i.duration||K||Us),Ls=x.useRef(null),Pe=x.useRef(null),Ir=y===0,Lr=y+1<=S,oe=i.type,Rs=oe??"default",nt=i.dismissible!==!1,Rr=i.className||"",Pr=i.descriptionClassName||"",Pt=x.useMemo(()=>_.findIndex(z=>z.toastId===i.id)||0,[_,i.id]),Or=x.useMemo(()=>{var z;return(z=i.closeButton)!=null?z:W},[i.closeButton,W]),Ps=x.useMemo(()=>i.duration||K||Us,[i.duration,K]),ss=x.useRef(0),rt=x.useRef(0),Os=x.useRef(0),at=x.useRef(null),[Fr,Br]=T.split("-"),Fs=x.useMemo(()=>_.reduce((z,J,se)=>se>=Pt?z:z+J.height,0),[_,Pt]),Bs=Ka(),Se=x.useMemo(()=>{var z;return(z=t.swipeDirections)!=null?z:uo(T)},[t.swipeDirections,T]),qr=i.invert||m,ns=oe==="loading";rt.current=x.useMemo(()=>Pt*V+Fs,[Pt,Fs]),x.useEffect(()=>{wt.current=Ps},[Ps]),x.useEffect(()=>{P(!0)},[]),x.useEffect(()=>{const z=Pe.current;if(z){const J=z.getBoundingClientRect().height;return Is(J),C(se=>[{toastId:i.id,height:J,position:i.position},...se]),()=>C(se=>se.filter(me=>me.toastId!==i.id))}},[C,i.id]),x.useLayoutEffect(()=>{if(!Ie)return;const z=Pe.current,J=z.style.height;z.style.height="auto";const se=z.getBoundingClientRect().height;z.style.height=J,Is(se),C(me=>me.find(ee=>ee.toastId===i.id)?me.map(ee=>ee.toastId===i.id?{...ee,height:se}:ee):[{toastId:i.id,height:se,position:i.position},...me])},[Ie,i.title,i.description,C,i.id,i.jsx,i.action,i.cancel]);const He=x.useCallback(()=>{D(!0),qe(rt.current),C(z=>z.filter(J=>J.toastId!==i.id)),setTimeout(()=>{B(i)},co)},[i,B,C,rt]);x.useEffect(()=>{if(i.promise&&oe==="loading"||i.duration===1/0||i.type==="loading")return;let z;return L||g||Bs?(()=>{if(Os.current<ss.current){const me=new Date().getTime()-ss.current;wt.current=wt.current-me}Os.current=new Date().getTime()})():(()=>{wt.current!==1/0&&(ss.current=new Date().getTime(),z=setTimeout(()=>{i.onAutoClose==null||i.onAutoClose.call(i,i),He()},wt.current))})(),()=>clearTimeout(z)},[L,g,i,oe,Bs,He]),x.useEffect(()=>{i.delete&&(He(),i.onDismiss==null||i.onDismiss.call(i,i))},[He,i.delete]);function qs(){var z;if(M?.loading){var J;return x.createElement("div",{className:ze(f?.loader,i==null||(J=i.classNames)==null?void 0:J.loader,"sonner-loader"),"data-visible":oe==="loading"},M.loading)}return x.createElement(qa,{className:ze(f?.loader,i==null||(z=i.classNames)==null?void 0:z.loader),visible:oe==="loading"})}const Hr=i.icon||M?.[oe]||Fa(oe);var Hs,Vs;return x.createElement("li",{tabIndex:0,ref:Pe,className:ze(ge,Rr,f?.toast,i==null||(s=i.classNames)==null?void 0:s.toast,f?.[Rs],i==null||(n=i.classNames)==null?void 0:n[Rs]),"data-sonner-toast":"","data-rich-colors":(Hs=i.richColors)!=null?Hs:U,"data-styled":!(i.jsx||i.unstyled||h),"data-mounted":Ie,"data-promise":!!i.promise,"data-swiped":Le,"data-removed":$,"data-visible":Lr,"data-y-position":Fr,"data-x-position":Br,"data-index":y,"data-front":Ir,"data-swiping":Z,"data-dismissible":nt,"data-type":oe,"data-invert":qr,"data-swipe-out":E,"data-swipe-direction":be,"data-expanded":!!(L||Y&&Ie),"data-testid":i.testId,style:{"--index":y,"--toasts-before":y,"--z-index":F.length-y,"--offset":`${$?Re:rt.current}px`,"--initial-height":Y?"auto":`${Dr}px`,...H,...i.style},onDragEnd:()=>{we(!1),k(null),at.current=null},onPointerDown:z=>{z.button!==2&&(ns||!nt||(Ls.current=new Date,qe(rt.current),z.target.setPointerCapture(z.pointerId),z.target.tagName!=="BUTTON"&&(we(!0),at.current={x:z.clientX,y:z.clientY})))},onPointerUp:()=>{var z,J,se;if(E||!nt)return;at.current=null;const me=Number(((z=Pe.current)==null?void 0:z.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),kt=Number(((J=Pe.current)==null?void 0:J.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),ee=new Date().getTime()-((se=Ls.current)==null?void 0:se.getTime()),ye=R==="x"?me:kt,_e=Math.abs(ye)/ee;if((R==="x"?Se.includes(me>0?"right":"left"):Se.includes(kt>0?"bottom":"top"))&&(Math.abs(ye)>=lo||_e>.11)){qe(rt.current),i.onDismiss==null||i.onDismiss.call(i,i),je(R==="x"?me>0?"right":"left":kt>0?"down":"up"),He(),Be(!0);return}else{var Me,as;(Me=Pe.current)==null||Me.style.setProperty("--swipe-amount-x","0px"),(as=Pe.current)==null||as.style.setProperty("--swipe-amount-y","0px")}Ce(!1),we(!1),k(null)},onPointerMove:z=>{var J,se,me;if(!at.current||!nt||((J=window.getSelection())==null?void 0:J.toString().length)>0)return;const ee=z.clientY-at.current.y,ye=z.clientX-at.current.x;!R&&(Math.abs(ye)>1||Math.abs(ee)>1)&&k(Math.abs(ye)>Math.abs(ee)?"x":"y");let _e={x:0,y:0};const rs=Me=>1/(1.5+Math.abs(Me)/20);if(R==="y"){if(Se.includes("top")||Se.includes("bottom"))if(Se.includes("top")&&ee<0||Se.includes("bottom")&&ee>0)_e.y=ee;else{const Me=ee*rs(ee);_e.y=Math.abs(Me)<Math.abs(ee)?Me:ee}}else if(R==="x"&&(Se.includes("left")||Se.includes("right")))if(Se.includes("left")&&ye<0||Se.includes("right")&&ye>0)_e.x=ye;else{const Me=ye*rs(ye);_e.x=Math.abs(Me)<Math.abs(ye)?Me:ye}(Math.abs(_e.x)>0||Math.abs(_e.y)>0)&&Ce(!0),(se=Pe.current)==null||se.style.setProperty("--swipe-amount-x",`${_e.x}px`),(me=Pe.current)==null||me.style.setProperty("--swipe-amount-y",`${_e.y}px`)}},Or&&!i.jsx&&oe!=="loading"?x.createElement("button",{"aria-label":O,"data-disabled":ns,"data-close-button":!0,onClick:ns||!nt?()=>{}:()=>{He(),i.onDismiss==null||i.onDismiss.call(i,i)},className:ze(f?.closeButton,i==null||(r=i.classNames)==null?void 0:r.closeButton)},(Vs=M?.close)!=null?Vs:Ua):null,(oe||i.icon||i.promise)&&i.icon!==null&&(M?.[oe]!==null||i.icon)?x.createElement("div",{"data-icon":"",className:ze(f?.icon,i==null||(a=i.classNames)==null?void 0:a.icon)},oe==="loading"?i.icon||qs():i.promise?qs():null,oe!=="loading"?Hr:null):null,x.createElement("div",{"data-content":"",className:ze(f?.content,i==null||(o=i.classNames)==null?void 0:o.content)},x.createElement("div",{"data-title":"",className:ze(f?.title,i==null||(l=i.classNames)==null?void 0:l.title)},i.jsx?i.jsx:typeof i.title=="function"?i.title():i.title),i.description?x.createElement("div",{"data-description":"",className:ze(ue,Pr,f?.description,i==null||(c=i.classNames)==null?void 0:c.description)},typeof i.description=="function"?i.description():i.description):null),x.isValidElement(i.cancel)?i.cancel:i.cancel&&Ot(i.cancel)?x.createElement("button",{"data-button":!0,"data-cancel":!0,style:i.cancelButtonStyle||j,onClick:z=>{Ot(i.cancel)&&nt&&(i.cancel.onClick==null||i.cancel.onClick.call(i.cancel,z),He())},className:ze(f?.cancelButton,i==null||(d=i.classNames)==null?void 0:d.cancelButton)},i.cancel.label):null,x.isValidElement(i.action)?i.action:i.action&&Ot(i.action)?x.createElement("button",{"data-button":!0,"data-action":!0,style:i.actionButtonStyle||q,onClick:z=>{Ot(i.action)&&(i.action.onClick==null||i.action.onClick.call(i.action,z),!z.defaultPrevented&&He())},className:ze(f?.actionButton,i==null||(u=i.classNames)==null?void 0:u.actionButton)},i.action.label):null)};function Ks(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function ho(t,s){const n={};return[t,s].forEach((r,a)=>{const o=a===1,l=o?"--mobile-offset":"--offset",c=o?ao:ro;function d(u){["top","right","bottom","left"].forEach(m=>{n[`${l}-${m}`]=typeof u=="number"?`${u}px`:u})}typeof r=="number"||typeof r=="string"?d(r):typeof r=="object"?["top","right","bottom","left"].forEach(u=>{r[u]===void 0?n[`${l}-${u}`]=c:n[`${l}-${u}`]=typeof r[u]=="number"?`${r[u]}px`:r[u]}):d(c)}),n}const fo=x.forwardRef(function(s,n){const{id:r,invert:a,position:o="bottom-right",hotkey:l=["altKey","KeyT"],expand:c,closeButton:d,className:u,offset:m,mobileOffset:i,theme:h="light",richColors:g,duration:C,style:S,visibleToasts:_=no,toastOptions:y,dir:F=Ks(),gap:L=io,icons:B,customAriaLabel:U,containerAriaLabel:W="Notifications"}=s,[H,j]=x.useState([]),q=x.useMemo(()=>r?H.filter(P=>P.toasterId===r):H.filter(P=>!P.toasterId),[H,r]),ge=x.useMemo(()=>Array.from(new Set([o].concat(q.filter(P=>P.position).map(P=>P.position)))),[q,o]),[ue,K]=x.useState([]),[T,V]=x.useState(!1),[Y,f]=x.useState(!1),[M,O]=x.useState(h!=="system"?h:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),R=x.useRef(null),k=l.join("+").replace(/Key/g,"").replace(/Digit/g,""),be=x.useRef(null),je=x.useRef(!1),Ie=x.useCallback(P=>{j($=>{var D;return(D=$.find(Z=>Z.id===P.id))!=null&&D.delete||he.dismiss(P.id),$.filter(({id:Z})=>Z!==P.id)})},[]);return x.useEffect(()=>he.subscribe(P=>{if(P.dismiss){requestAnimationFrame(()=>{j($=>$.map(D=>D.id===P.id?{...D,delete:!0}:D))});return}setTimeout(()=>{Vr.flushSync(()=>{j($=>{const D=$.findIndex(Z=>Z.id===P.id);return D!==-1?[...$.slice(0,D),{...$[D],...P},...$.slice(D+1)]:[P,...$]})})})}),[]),x.useEffect(()=>{if(h!=="system"){O(h);return}if(h==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?O("dark"):O("light")),typeof window>"u")return;const P=window.matchMedia("(prefers-color-scheme: dark)");try{P.addEventListener("change",({matches:$})=>{O($?"dark":"light")})}catch{P.addListener(({matches:D})=>{try{O(D?"dark":"light")}catch(Z){console.error(Z)}})}},[h]),x.useEffect(()=>{H.length<=1&&V(!1)},[H]),x.useEffect(()=>{const P=$=>{var D;if(l.length>0&&l.every(E=>$[E]||$.code===E)){var we;V(!0),(we=R.current)==null||we.focus()}$.code==="Escape"&&(document.activeElement===R.current||(D=R.current)!=null&&D.contains(document.activeElement))&&V(!1)};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[l]),x.useEffect(()=>{if(R.current)return()=>{be.current&&(be.current.focus({preventScroll:!0}),be.current=null,je.current=!1)}},[R.current]),x.createElement("section",{ref:n,"aria-label":U??`${W} ${k}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},ge.map((P,$)=>{var D;const[Z,we]=P.split("-");return q.length?x.createElement("ol",{key:P,dir:F==="auto"?Ks():F,tabIndex:-1,ref:R,className:u,"data-sonner-toaster":!0,"data-sonner-theme":M,"data-y-position":Z,"data-x-position":we,style:{"--front-toast-height":`${((D=ue[0])==null?void 0:D.height)||0}px`,"--width":`${oo}px`,"--gap":`${L}px`,...S,...ho(m,i)},onBlur:E=>{je.current&&!E.currentTarget.contains(E.relatedTarget)&&(je.current=!1,be.current&&(be.current.focus({preventScroll:!0}),be.current=null))},onFocus:E=>{E.target instanceof HTMLElement&&E.target.dataset.dismissible==="false"||je.current||(je.current=!0,be.current=E.relatedTarget)},onMouseEnter:()=>V(!0),onMouseMove:()=>V(!0),onMouseLeave:()=>{Y||V(!1)},onDragEnd:()=>V(!1),onPointerDown:E=>{E.target instanceof HTMLElement&&E.target.dataset.dismissible==="false"||f(!0)},onPointerUp:()=>f(!1)},q.filter(E=>!E.position&&$===0||E.position===P).map((E,Be)=>{var Le,Ce;return x.createElement(mo,{key:E.id,icons:B,index:Be,toast:E,defaultRichColors:g,duration:(Le=y?.duration)!=null?Le:C,className:y?.className,descriptionClassName:y?.descriptionClassName,invert:a,visibleToasts:_,closeButton:(Ce=y?.closeButton)!=null?Ce:d,interacting:Y,position:P,style:y?.style,unstyled:y?.unstyled,classNames:y?.classNames,cancelButtonStyle:y?.cancelButtonStyle,actionButtonStyle:y?.actionButtonStyle,closeButtonAriaLabel:y?.closeButtonAriaLabel,removeToast:Ie,toasts:q.filter(Re=>Re.position==E.position),heights:ue.filter(Re=>Re.position==E.position),setHeights:K,expandByDefault:c,gap:L,expanded:T,swipeDirections:s.swipeDirections})})):null}))}),Tn="fastr-theme",An=p.createContext(null);function po(){try{const t=localStorage.getItem(Tn);if(t==="light"||t==="dark"||t==="system")return t}catch{}return"system"}function xo(){return typeof window<"u"&&!!window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}function go({children:t}){const[s,n]=p.useState(po),[r,a]=p.useState(xo);p.useEffect(()=>{if(!window.matchMedia)return;const d=window.matchMedia("(prefers-color-scheme: dark)"),u=()=>a(d.matches);return d.addEventListener("change",u),()=>d.removeEventListener("change",u)},[]);const o=s==="system"?r?"dark":"light":s;p.useLayoutEffect(()=>{document.documentElement.classList.toggle("dark",o==="dark")},[o]);const l=p.useCallback(d=>{n(d);try{localStorage.setItem(Tn,d)}catch{}},[]),c=p.useMemo(()=>({mode:s,resolved:o,setMode:l}),[s,o,l]);return e.jsx(An.Provider,{value:c,children:t})}function Qt(){const t=p.useContext(An);if(!t)throw new Error("useTheme must be used inside ThemeProvider");return t}function Yd(t,s="#888"){return typeof window>"u"?s:getComputedStyle(document.documentElement).getPropertyValue(t).trim()||s}function bo(t){const{resolved:s}=Qt();return e.jsx(fo,{theme:s,className:"toaster group",containerAriaLabel:"Notifications",style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)"},...t})}function $n(t){var s,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(s=0;s<a;s++)t[s]&&(n=$n(t[s]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function Dn(){for(var t,s,n=0,r="",a=arguments.length;n<a;n++)(t=arguments[n])&&(s=$n(t))&&(r&&(r+=" "),r+=s);return r}const yo=(t,s)=>{const n=new Array(t.length+s.length);for(let r=0;r<t.length;r++)n[r]=t[r];for(let r=0;r<s.length;r++)n[t.length+r]=s[r];return n},vo=(t,s)=>({classGroupId:t,validator:s}),In=(t=new Map,s=null,n)=>({nextPart:t,validators:s,classGroupId:n}),Wt="-",Ys=[],jo="arbitrary..",wo=t=>{const s=No(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return ko(l);const c=l.split(Wt),d=c[0]===""&&c.length>1?1:0;return Ln(c,d,s)},getConflictingClassGroupIds:(l,c)=>{if(c){const d=r[l],u=n[l];return d?u?yo(u,d):d:u||Ys}return n[l]||Ys}}},Ln=(t,s,n)=>{if(t.length-s===0)return n.classGroupId;const a=t[s],o=n.nextPart.get(a);if(o){const u=Ln(t,s+1,o);if(u)return u}const l=n.validators;if(l===null)return;const c=s===0?t.join(Wt):t.slice(s).join(Wt),d=l.length;for(let u=0;u<d;u++){const m=l[u];if(m.validator(c))return m.classGroupId}},ko=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const s=t.slice(1,-1),n=s.indexOf(":"),r=s.slice(0,n);return r?jo+r:void 0})(),No=t=>{const{theme:s,classGroups:n}=t;return Co(n,s)},Co=(t,s)=>{const n=In();for(const r in t){const a=t[r];ks(a,n,r,s)}return n},ks=(t,s,n,r)=>{const a=t.length;for(let o=0;o<a;o++){const l=t[o];So(l,s,n,r)}},So=(t,s,n,r)=>{if(typeof t=="string"){_o(t,s,n);return}if(typeof t=="function"){Mo(t,s,n,r);return}zo(t,s,n,r)},_o=(t,s,n)=>{const r=t===""?s:Rn(s,t);r.classGroupId=n},Mo=(t,s,n,r)=>{if(Eo(t)){ks(t(r),s,n,r);return}s.validators===null&&(s.validators=[]),s.validators.push(vo(n,t))},zo=(t,s,n,r)=>{const a=Object.entries(t),o=a.length;for(let l=0;l<o;l++){const[c,d]=a[l];ks(d,Rn(s,c),n,r)}},Rn=(t,s)=>{let n=t;const r=s.split(Wt),a=r.length;for(let o=0;o<a;o++){const l=r[o];let c=n.nextPart.get(l);c||(c=In(),n.nextPart.set(l,c)),n=c}return n},Eo=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,To=t=>{if(t<1)return{get:()=>{},set:()=>{}};let s=0,n=Object.create(null),r=Object.create(null);const a=(o,l)=>{n[o]=l,s++,s>t&&(s=0,r=n,n=Object.create(null))};return{get(o){let l=n[o];if(l!==void 0)return l;if((l=r[o])!==void 0)return a(o,l),l},set(o,l){o in n?n[o]=l:a(o,l)}}},hs="!",Xs=":",Ao=[],Qs=(t,s,n,r,a)=>({modifiers:t,hasImportantModifier:s,baseClassName:n,maybePostfixModifierPosition:r,isExternal:a}),$o=t=>{const{prefix:s,experimentalParseClassName:n}=t;let r=a=>{const o=[];let l=0,c=0,d=0,u;const m=a.length;for(let S=0;S<m;S++){const _=a[S];if(l===0&&c===0){if(_===Xs){o.push(a.slice(d,S)),d=S+1;continue}if(_==="/"){u=S;continue}}_==="["?l++:_==="]"?l--:_==="("?c++:_===")"&&c--}const i=o.length===0?a:a.slice(d);let h=i,g=!1;i.endsWith(hs)?(h=i.slice(0,-1),g=!0):i.startsWith(hs)&&(h=i.slice(1),g=!0);const C=u&&u>d?u-d:void 0;return Qs(o,g,h,C)};if(s){const a=s+Xs,o=r;r=l=>l.startsWith(a)?o(l.slice(a.length)):Qs(Ao,!1,l,void 0,!0)}if(n){const a=r;r=o=>n({className:o,parseClassName:a})}return r},Do=t=>{const s=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{s.set(n,1e6+r)}),n=>{const r=[];let a=[];for(let o=0;o<n.length;o++){const l=n[o],c=l[0]==="[",d=s.has(l);c||d?(a.length>0&&(a.sort(),r.push(...a),a=[]),r.push(l)):a.push(l)}return a.length>0&&(a.sort(),r.push(...a)),r}},Io=t=>({cache:To(t.cacheSize),parseClassName:$o(t),sortModifiers:Do(t),postfixLookupClassGroupIds:Lo(t),...wo(t)}),Lo=t=>{const s=Object.create(null),n=t.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)s[n[r]]=!0;return s},Ro=/\s+/,Po=(t,s)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:o,postfixLookupClassGroupIds:l}=s,c=[],d=t.trim().split(Ro);let u="";for(let m=d.length-1;m>=0;m-=1){const i=d[m],{isExternal:h,modifiers:g,hasImportantModifier:C,baseClassName:S,maybePostfixModifierPosition:_}=n(i);if(h){u=i+(u.length>0?" "+u:u);continue}let y=!!_,F;if(y){const H=S.substring(0,_);F=r(H);const j=F&&l[F]?r(S):void 0;j&&j!==F&&(F=j,y=!1)}else F=r(S);if(!F){if(!y){u=i+(u.length>0?" "+u:u);continue}if(F=r(S),!F){u=i+(u.length>0?" "+u:u);continue}y=!1}const L=g.length===0?"":g.length===1?g[0]:o(g).join(":"),B=C?L+hs:L,U=B+F;if(c.indexOf(U)>-1)continue;c.push(U);const W=a(F,y);for(let H=0;H<W.length;++H){const j=W[H];c.push(B+j)}u=i+(u.length>0?" "+u:u)}return u},Oo=(...t)=>{let s=0,n,r,a="";for(;s<t.length;)(n=t[s++])&&(r=Pn(n))&&(a&&(a+=" "),a+=r);return a},Pn=t=>{if(typeof t=="string")return t;let s,n="";for(let r=0;r<t.length;r++)t[r]&&(s=Pn(t[r]))&&(n&&(n+=" "),n+=s);return n},Fo=(t,...s)=>{let n,r,a,o;const l=d=>{const u=s.reduce((m,i)=>i(m),t());return n=Io(u),r=n.cache.get,a=n.cache.set,o=c,c(d)},c=d=>{const u=r(d);if(u)return u;const m=Po(d,n);return a(d,m),m};return o=l,(...d)=>o(Oo(...d))},Bo=[],X=t=>{const s=n=>n[t]||Bo;return s.isThemeGetter=!0,s.themeKey=t,s},On=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Fn=/^\((?:(\w[\w-]*):)?(.+)\)$/i,qo=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Ho=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Vo=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Wo=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,Go=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Uo=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ve=t=>qo.test(t),A=t=>!!t&&!Number.isNaN(Number(t)),Ee=t=>!!t&&Number.isInteger(Number(t)),os=t=>t.endsWith("%")&&A(t.slice(0,-1)),Oe=t=>Ho.test(t),Bn=()=>!0,Ko=t=>Vo.test(t)&&!Wo.test(t),Ns=()=>!1,Yo=t=>Go.test(t),Xo=t=>Uo.test(t),Qo=t=>!v(t)&&!w(t),Jo=t=>t.startsWith("@container")&&(t[10]==="/"&&t[11]!==void 0||t[11]==="s"&&t[16]!==void 0&&t.startsWith("-size/",10)||t[11]==="n"&&t[18]!==void 0&&t.startsWith("-normal/",10)),Zo=t=>Ke(t,Vn,Ns),v=t=>On.test(t),Xe=t=>Ke(t,Wn,Ko),Js=t=>Ke(t,ii,A),ei=t=>Ke(t,Un,Bn),ti=t=>Ke(t,Gn,Ns),Zs=t=>Ke(t,qn,Ns),si=t=>Ke(t,Hn,Xo),Ft=t=>Ke(t,Kn,Yo),w=t=>Fn.test(t),Nt=t=>tt(t,Wn),ni=t=>tt(t,Gn),en=t=>tt(t,qn),ri=t=>tt(t,Vn),ai=t=>tt(t,Hn),Bt=t=>tt(t,Kn,!0),oi=t=>tt(t,Un,!0),Ke=(t,s,n)=>{const r=On.exec(t);return r?r[1]?s(r[1]):n(r[2]):!1},tt=(t,s,n=!1)=>{const r=Fn.exec(t);return r?r[1]?s(r[1]):n:!1},qn=t=>t==="position"||t==="percentage",Hn=t=>t==="image"||t==="url",Vn=t=>t==="length"||t==="size"||t==="bg-size",Wn=t=>t==="length",ii=t=>t==="number",Gn=t=>t==="family-name",Un=t=>t==="number"||t==="weight",Kn=t=>t==="shadow",li=()=>{const t=X("color"),s=X("font"),n=X("text"),r=X("font-weight"),a=X("tracking"),o=X("leading"),l=X("breakpoint"),c=X("container"),d=X("spacing"),u=X("radius"),m=X("shadow"),i=X("inset-shadow"),h=X("text-shadow"),g=X("drop-shadow"),C=X("blur"),S=X("perspective"),_=X("aspect"),y=X("ease"),F=X("animate"),L=()=>["auto","avoid","all","avoid-page","page","left","right","column"],B=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],U=()=>[...B(),w,v],W=()=>["auto","hidden","clip","visible","scroll"],H=()=>["auto","contain","none"],j=()=>[w,v,d],q=()=>[Ve,"full","auto",...j()],ge=()=>[Ee,"none","subgrid",w,v],ue=()=>["auto",{span:["full",Ee,w,v]},Ee,w,v],K=()=>[Ee,"auto",w,v],T=()=>["auto","min","max","fr",w,v],V=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Y=()=>["start","end","center","stretch","center-safe","end-safe"],f=()=>["auto",...j()],M=()=>[Ve,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],O=()=>[c,Ve,"screen","full","dvw","lvw","svw","min","max","fit",...j()],R=()=>[Ve,"screen","full","lh","dvh","lvh","svh","min","max","fit",...j()],k=()=>[t,w,v],be=()=>[...B(),en,Zs,{position:[w,v]}],je=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Ie=()=>["auto","cover","contain",ri,Zo,{size:[w,v]}],P=()=>[os,Nt,Xe],$=()=>["","none","full",u,w,v],D=()=>["",A,Nt,Xe],Z=()=>["solid","dashed","dotted","double"],we=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],E=()=>[A,os,en,Zs],Be=()=>["","none",C,w,v],Le=()=>["none",A,w,v],Ce=()=>["none",A,w,v],Re=()=>[A,w,v],qe=()=>[Ve,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Oe],breakpoint:[Oe],color:[Bn],container:[Oe],"drop-shadow":[Oe],ease:["in","out","in-out"],font:[Qo],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Oe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Oe],shadow:[Oe],spacing:["px",A],text:[Oe],"text-shadow":[Oe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ve,v,w,_]}],container:["container"],"container-type":[{"@container":["","normal","size",w,v]}],"container-named":[Jo],columns:[{columns:[A,"auto",v,w,c]}],"break-after":[{"break-after":L()}],"break-before":[{"break-before":L()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:U()}],overflow:[{overflow:W()}],"overflow-x":[{"overflow-x":W()}],"overflow-y":[{"overflow-y":W()}],overscroll:[{overscroll:H()}],"overscroll-x":[{"overscroll-x":H()}],"overscroll-y":[{"overscroll-y":H()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:q()}],"inset-x":[{"inset-x":q()}],"inset-y":[{"inset-y":q()}],start:[{"inset-s":q(),start:q()}],end:[{"inset-e":q(),end:q()}],"inset-bs":[{"inset-bs":q()}],"inset-be":[{"inset-be":q()}],top:[{top:q()}],right:[{right:q()}],bottom:[{bottom:q()}],left:[{left:q()}],visibility:["visible","invisible","collapse"],z:[{z:[Ee,"auto",w,v]}],basis:[{basis:[Ve,"full","auto",c,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[A,Ve,"auto","initial","none",v]}],grow:[{grow:["",A,w,v]}],shrink:[{shrink:["",A,w,v]}],order:[{order:[Ee,"first","last","none",w,v]}],"grid-cols":[{"grid-cols":ge()}],"col-start-end":[{col:ue()}],"col-start":[{"col-start":K()}],"col-end":[{"col-end":K()}],"grid-rows":[{"grid-rows":ge()}],"row-start-end":[{row:ue()}],"row-start":[{"row-start":K()}],"row-end":[{"row-end":K()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":T()}],"auto-rows":[{"auto-rows":T()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...V(),"normal"]}],"justify-items":[{"justify-items":[...Y(),"normal"]}],"justify-self":[{"justify-self":["auto",...Y()]}],"align-content":[{content:["normal",...V()]}],"align-items":[{items:[...Y(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Y(),{baseline:["","last"]}]}],"place-content":[{"place-content":V()}],"place-items":[{"place-items":[...Y(),"baseline"]}],"place-self":[{"place-self":["auto",...Y()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pbs:[{pbs:j()}],pbe:[{pbe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:f()}],mx:[{mx:f()}],my:[{my:f()}],ms:[{ms:f()}],me:[{me:f()}],mbs:[{mbs:f()}],mbe:[{mbe:f()}],mt:[{mt:f()}],mr:[{mr:f()}],mb:[{mb:f()}],ml:[{ml:f()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:M()}],"inline-size":[{inline:["auto",...O()]}],"min-inline-size":[{"min-inline":["auto",...O()]}],"max-inline-size":[{"max-inline":["none",...O()]}],"block-size":[{block:["auto",...R()]}],"min-block-size":[{"min-block":["auto",...R()]}],"max-block-size":[{"max-block":["none",...R()]}],w:[{w:[c,"screen",...M()]}],"min-w":[{"min-w":[c,"screen","none",...M()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[l]},...M()]}],h:[{h:["screen","lh",...M()]}],"min-h":[{"min-h":["screen","lh","none",...M()]}],"max-h":[{"max-h":["screen","lh","none",...M()]}],"font-size":[{text:["base",n,Nt,Xe]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,oi,ei]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",os,v]}],"font-family":[{font:[ni,ti,s]}],"font-features":[{"font-features":[v]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,w,v]}],"line-clamp":[{"line-clamp":[A,"none",w,Js]}],leading:[{leading:["none",o,...j()]}],"list-image":[{"list-image":["none",w,v]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",w,v]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:k()}],"text-color":[{text:k()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Z(),"wavy"]}],"text-decoration-thickness":[{decoration:[A,"from-font","auto",w,Xe]}],"text-decoration-color":[{decoration:k()}],"underline-offset":[{"underline-offset":[A,"auto",w,v]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"tab-size":[{tab:[Ee,w,v]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",w,v]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",w,v]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:be()}],"bg-repeat":[{bg:je()}],"bg-size":[{bg:Ie()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ee,w,v],radial:["",w,v],conic:["",Ee,w,v]},ai,si]}],"bg-color":[{bg:k()}],"gradient-from-pos":[{from:P()}],"gradient-via-pos":[{via:P()}],"gradient-to-pos":[{to:P()}],"gradient-from":[{from:k()}],"gradient-via":[{via:k()}],"gradient-to":[{to:k()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:D()}],"border-w-x":[{"border-x":D()}],"border-w-y":[{"border-y":D()}],"border-w-s":[{"border-s":D()}],"border-w-e":[{"border-e":D()}],"border-w-bs":[{"border-bs":D()}],"border-w-be":[{"border-be":D()}],"border-w-t":[{"border-t":D()}],"border-w-r":[{"border-r":D()}],"border-w-b":[{"border-b":D()}],"border-w-l":[{"border-l":D()}],"divide-x":[{"divide-x":D()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":D()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Z(),"hidden","none"]}],"divide-style":[{divide:[...Z(),"hidden","none"]}],"border-color":[{border:k()}],"border-color-x":[{"border-x":k()}],"border-color-y":[{"border-y":k()}],"border-color-s":[{"border-s":k()}],"border-color-e":[{"border-e":k()}],"border-color-bs":[{"border-bs":k()}],"border-color-be":[{"border-be":k()}],"border-color-t":[{"border-t":k()}],"border-color-r":[{"border-r":k()}],"border-color-b":[{"border-b":k()}],"border-color-l":[{"border-l":k()}],"divide-color":[{divide:k()}],"outline-style":[{outline:[...Z(),"none","hidden"]}],"outline-offset":[{"outline-offset":[A,w,v]}],"outline-w":[{outline:["",A,Nt,Xe]}],"outline-color":[{outline:k()}],shadow:[{shadow:["","inner","none",m,Bt,Ft]}],"shadow-color":[{shadow:k()}],"inset-shadow":[{"inset-shadow":["none",i,Bt,Ft]}],"inset-shadow-color":[{"inset-shadow":k()}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:k()}],"ring-offset-w":[{"ring-offset":[A,Xe]}],"ring-offset-color":[{"ring-offset":k()}],"inset-ring-w":[{"inset-ring":D()}],"inset-ring-color":[{"inset-ring":k()}],"text-shadow":[{"text-shadow":["none",h,Bt,Ft]}],"text-shadow-color":[{"text-shadow":k()}],opacity:[{opacity:[A,w,v]}],"mix-blend":[{"mix-blend":[...we(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":we()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[A]}],"mask-image-linear-from-pos":[{"mask-linear-from":E()}],"mask-image-linear-to-pos":[{"mask-linear-to":E()}],"mask-image-linear-from-color":[{"mask-linear-from":k()}],"mask-image-linear-to-color":[{"mask-linear-to":k()}],"mask-image-t-from-pos":[{"mask-t-from":E()}],"mask-image-t-to-pos":[{"mask-t-to":E()}],"mask-image-t-from-color":[{"mask-t-from":k()}],"mask-image-t-to-color":[{"mask-t-to":k()}],"mask-image-r-from-pos":[{"mask-r-from":E()}],"mask-image-r-to-pos":[{"mask-r-to":E()}],"mask-image-r-from-color":[{"mask-r-from":k()}],"mask-image-r-to-color":[{"mask-r-to":k()}],"mask-image-b-from-pos":[{"mask-b-from":E()}],"mask-image-b-to-pos":[{"mask-b-to":E()}],"mask-image-b-from-color":[{"mask-b-from":k()}],"mask-image-b-to-color":[{"mask-b-to":k()}],"mask-image-l-from-pos":[{"mask-l-from":E()}],"mask-image-l-to-pos":[{"mask-l-to":E()}],"mask-image-l-from-color":[{"mask-l-from":k()}],"mask-image-l-to-color":[{"mask-l-to":k()}],"mask-image-x-from-pos":[{"mask-x-from":E()}],"mask-image-x-to-pos":[{"mask-x-to":E()}],"mask-image-x-from-color":[{"mask-x-from":k()}],"mask-image-x-to-color":[{"mask-x-to":k()}],"mask-image-y-from-pos":[{"mask-y-from":E()}],"mask-image-y-to-pos":[{"mask-y-to":E()}],"mask-image-y-from-color":[{"mask-y-from":k()}],"mask-image-y-to-color":[{"mask-y-to":k()}],"mask-image-radial":[{"mask-radial":[w,v]}],"mask-image-radial-from-pos":[{"mask-radial-from":E()}],"mask-image-radial-to-pos":[{"mask-radial-to":E()}],"mask-image-radial-from-color":[{"mask-radial-from":k()}],"mask-image-radial-to-color":[{"mask-radial-to":k()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":B()}],"mask-image-conic-pos":[{"mask-conic":[A]}],"mask-image-conic-from-pos":[{"mask-conic-from":E()}],"mask-image-conic-to-pos":[{"mask-conic-to":E()}],"mask-image-conic-from-color":[{"mask-conic-from":k()}],"mask-image-conic-to-color":[{"mask-conic-to":k()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:be()}],"mask-repeat":[{mask:je()}],"mask-size":[{mask:Ie()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",w,v]}],filter:[{filter:["","none",w,v]}],blur:[{blur:Be()}],brightness:[{brightness:[A,w,v]}],contrast:[{contrast:[A,w,v]}],"drop-shadow":[{"drop-shadow":["","none",g,Bt,Ft]}],"drop-shadow-color":[{"drop-shadow":k()}],grayscale:[{grayscale:["",A,w,v]}],"hue-rotate":[{"hue-rotate":[A,w,v]}],invert:[{invert:["",A,w,v]}],saturate:[{saturate:[A,w,v]}],sepia:[{sepia:["",A,w,v]}],"backdrop-filter":[{"backdrop-filter":["","none",w,v]}],"backdrop-blur":[{"backdrop-blur":Be()}],"backdrop-brightness":[{"backdrop-brightness":[A,w,v]}],"backdrop-contrast":[{"backdrop-contrast":[A,w,v]}],"backdrop-grayscale":[{"backdrop-grayscale":["",A,w,v]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[A,w,v]}],"backdrop-invert":[{"backdrop-invert":["",A,w,v]}],"backdrop-opacity":[{"backdrop-opacity":[A,w,v]}],"backdrop-saturate":[{"backdrop-saturate":[A,w,v]}],"backdrop-sepia":[{"backdrop-sepia":["",A,w,v]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",w,v]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[A,"initial",w,v]}],ease:[{ease:["linear","initial",y,w,v]}],delay:[{delay:[A,w,v]}],animate:[{animate:["none",F,w,v]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,w,v]}],"perspective-origin":[{"perspective-origin":U()}],rotate:[{rotate:Le()}],"rotate-x":[{"rotate-x":Le()}],"rotate-y":[{"rotate-y":Le()}],"rotate-z":[{"rotate-z":Le()}],scale:[{scale:Ce()}],"scale-x":[{"scale-x":Ce()}],"scale-y":[{"scale-y":Ce()}],"scale-z":[{"scale-z":Ce()}],"scale-3d":["scale-3d"],skew:[{skew:Re()}],"skew-x":[{"skew-x":Re()}],"skew-y":[{"skew-y":Re()}],transform:[{transform:[w,v,"","none","gpu","cpu"]}],"transform-origin":[{origin:U()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:qe()}],"translate-x":[{"translate-x":qe()}],"translate-y":[{"translate-y":qe()}],"translate-z":[{"translate-z":qe()}],"translate-none":["translate-none"],zoom:[{zoom:[Ee,w,v]}],accent:[{accent:k()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:k()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",w,v]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":k()}],"scrollbar-track-color":[{"scrollbar-track":k()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mbs":[{"scroll-mbs":j()}],"scroll-mbe":[{"scroll-mbe":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pbs":[{"scroll-pbs":j()}],"scroll-pbe":[{"scroll-pbe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",w,v]}],fill:[{fill:["none",...k()]}],"stroke-w":[{stroke:[A,Nt,Xe,Js]}],stroke:[{stroke:["none",...k()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["start","end","right","left"],"inset-y":["inset-bs","inset-be","top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["ps","pe","pr","pl"],py:["pbs","pbe","pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["ms","me","mr","ml"],my:["mbs","mbe","mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-s","border-w-e","border-w-r","border-w-l"],"border-w-y":["border-w-bs","border-w-be","border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-s","border-color-e","border-color-r","border-color-l"],"border-color-y":["border-color-bs","border-color-be","border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-ms","scroll-me","scroll-mr","scroll-ml"],"scroll-my":["scroll-mbs","scroll-mbe","scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-ps","scroll-pe","scroll-pr","scroll-pl"],"scroll-py":["scroll-pbs","scroll-pbe","scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},ci=Fo(li);function b(...t){return ci(Dn(t))}function di(t){const s=t;if(!s||!s.tagName)return!1;const n=s.tagName;return n==="INPUT"||n==="TEXTAREA"||n==="SELECT"||s.isContentEditable}function ui({delayDuration:t=200,...s}){return e.jsx(Xr,{"data-slot":"tooltip-provider",delayDuration:t,...s})}function Tt(t){return e.jsx(Wr,{"data-slot":"tooltip",...t})}function At(t){return e.jsx(Gr,{"data-slot":"tooltip-trigger",...t})}function $t({className:t,sideOffset:s=4,children:n,...r}){return e.jsx(Ur,{children:e.jsxs(Kr,{"data-slot":"tooltip-content",sideOffset:s,className:b("z-50 w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",t),...r,children:[n,e.jsx(Yr,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"})]})})}/**
3
3
  * @license lucide-react v0.475.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
@@ -54,7 +54,7 @@ import{R as x,a as Hr,r as p,j as e,T as Wr,b as Gr,c as Ur,d as Kr,e as Yr,f as
54
54
  *
55
55
  * This source code is licensed under the ISC license.
56
56
  * See the LICENSE file in the root directory of this source tree.
57
- */const _i=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],Si=N("Boxes",_i);/**
57
+ */const Si=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],_i=N("Boxes",Si);/**
58
58
  * @license lucide-react v0.475.0 - ISC
59
59
  *
60
60
  * This source code is licensed under the ISC license.
@@ -99,12 +99,12 @@ import{R as x,a as Hr,r as p,j as e,T as Wr,b as Gr,c as Ur,d as Kr,e as Yr,f as
99
99
  *
100
100
  * This source code is licensed under the ISC license.
101
101
  * See the LICENSE file in the root directory of this source tree.
102
- */const qi=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],Vi=N("Clock",qi);/**
102
+ */const qi=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],Hi=N("Clock",qi);/**
103
103
  * @license lucide-react v0.475.0 - ISC
104
104
  *
105
105
  * This source code is licensed under the ISC license.
106
106
  * See the LICENSE file in the root directory of this source tree.
107
- */const Hi=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],Wi=N("Command",Hi);/**
107
+ */const Vi=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],Wi=N("Command",Vi);/**
108
108
  * @license lucide-react v0.475.0 - ISC
109
109
  *
110
110
  * This source code is licensed under the ISC license.
@@ -214,12 +214,12 @@ import{R as x,a as Hr,r as p,j as e,T as Wr,b as Gr,c as Ur,d as Kr,e as Yr,f as
214
214
  *
215
215
  * This source code is licensed under the ISC license.
216
216
  * See the LICENSE file in the root directory of this source tree.
217
- */const Cl=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],_s=N("Moon",Cl);/**
217
+ */const Cl=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],Ss=N("Moon",Cl);/**
218
218
  * @license lucide-react v0.475.0 - ISC
219
219
  *
220
220
  * This source code is licensed under the ISC license.
221
221
  * See the LICENSE file in the root directory of this source tree.
222
- */const _l=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M10.4 21.9a10 10 0 0 0 9.941-15.416",key:"eohfx2"}],["path",{d:"M13.5 2.1a10 10 0 0 0-9.841 15.416",key:"19pvbm"}]],Sl=N("Orbit",_l);/**
222
+ */const Sl=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M10.4 21.9a10 10 0 0 0 9.941-15.416",key:"eohfx2"}],["path",{d:"M13.5 2.1a10 10 0 0 0-9.841 15.416",key:"19pvbm"}]],_l=N("Orbit",Sl);/**
223
223
  * @license lucide-react v0.475.0 - ISC
224
224
  *
225
225
  * This source code is licensed under the ISC license.
@@ -229,12 +229,12 @@ import{R as x,a as Hr,r as p,j as e,T as Wr,b as Gr,c as Ur,d as Kr,e as Yr,f as
229
229
  *
230
230
  * This source code is licensed under the ISC license.
231
231
  * See the LICENSE file in the root directory of this source tree.
232
- */const zl=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],Wt=N("Pin",zl);/**
232
+ */const zl=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],Gt=N("Pin",zl);/**
233
233
  * @license lucide-react v0.475.0 - ISC
234
234
  *
235
235
  * This source code is licensed under the ISC license.
236
236
  * See the LICENSE file in the root directory of this source tree.
237
- */const El=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ss=N("Plus",El);/**
237
+ */const El=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],_s=N("Plus",El);/**
238
238
  * @license lucide-react v0.475.0 - ISC
239
239
  *
240
240
  * This source code is licensed under the ISC license.
@@ -279,17 +279,17 @@ import{R as x,a as Hr,r as p,j as e,T as Wr,b as Gr,c as Ur,d as Kr,e as Yr,f as
279
279
  *
280
280
  * This source code is licensed under the ISC license.
281
281
  * See the LICENSE file in the root directory of this source tree.
282
- */const ql=[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]],Vl=N("Stethoscope",ql);/**
282
+ */const ql=[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]],Hl=N("Stethoscope",ql);/**
283
283
  * @license lucide-react v0.475.0 - ISC
284
284
  *
285
285
  * This source code is licensed under the ISC license.
286
286
  * See the LICENSE file in the root directory of this source tree.
287
- */const Hl=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],zs=N("Sun",Hl);/**
287
+ */const Vl=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],zs=N("Sun",Vl);/**
288
288
  * @license lucide-react v0.475.0 - ISC
289
289
  *
290
290
  * This source code is licensed under the ISC license.
291
291
  * See the LICENSE file in the root directory of this source tree.
292
- */const Wl=[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}],["polyline",{points:"14.5 6.5 18 3 21 3 21 6 17.5 9.5",key:"hbey2j"}],["line",{x1:"5",x2:"9",y1:"14",y2:"18",key:"1hf58s"}],["line",{x1:"7",x2:"4",y1:"17",y2:"20",key:"pidxm4"}],["line",{x1:"3",x2:"5",y1:"19",y2:"21",key:"1pehsh"}]],Qt=N("Swords",Wl);/**
292
+ */const Wl=[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}],["polyline",{points:"14.5 6.5 18 3 21 3 21 6 17.5 9.5",key:"hbey2j"}],["line",{x1:"5",x2:"9",y1:"14",y2:"18",key:"1hf58s"}],["line",{x1:"7",x2:"4",y1:"17",y2:"20",key:"pidxm4"}],["line",{x1:"3",x2:"5",y1:"19",y2:"21",key:"1pehsh"}]],Jt=N("Swords",Wl);/**
293
293
  * @license lucide-react v0.475.0 - ISC
294
294
  *
295
295
  * This source code is licensed under the ISC license.
@@ -304,7 +304,7 @@ import{R as x,a as Hr,r as p,j as e,T as Wr,b as Gr,c as Ur,d as Kr,e as Yr,f as
304
304
  *
305
305
  * This source code is licensed under the ISC license.
306
306
  * See the LICENSE file in the root directory of this source tree.
307
- */const Yl=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Jt=N("TriangleAlert",Yl);/**
307
+ */const Yl=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],It=N("TriangleAlert",Yl);/**
308
308
  * @license lucide-react v0.475.0 - ISC
309
309
  *
310
310
  * This source code is licensed under the ISC license.
@@ -319,11 +319,11 @@ import{R as x,a as Hr,r as p,j as e,T as Wr,b as Gr,c as Ur,d as Kr,e as Yr,f as
319
319
  *
320
320
  * This source code is licensed under the ISC license.
321
321
  * See the LICENSE file in the root directory of this source tree.
322
- */const Zl=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],ec=N("Zap",Zl),nn=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,rn=Dn,nr=(t,s)=>n=>{var r;if(s?.variants==null)return rn(t,n?.class,n?.className);const{variants:a,defaultVariants:o}=s,l=Object.keys(a).map(u=>{const m=n?.[u],i=o?.[u];if(m===null)return null;const h=nn(m)||nn(i);return a[u][h]}),c=n&&Object.entries(n).reduce((u,m)=>{let[i,h]=m;return h===void 0||(u[i]=h),u},{}),d=s==null||(r=s.compoundVariants)===null||r===void 0?void 0:r.reduce((u,m)=>{let{class:i,className:h,...g}=m;return Object.entries(g).every(C=>{let[_,S]=C;return Array.isArray(S)?S.includes({...o,...c}[_]):{...o,...c}[_]===S})?[...u,i,h]:u},[]);return rn(t,l,d,n?.class,n?.className)},es=nr("inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",outline:"border bg-card shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/20 dark:border-input dark:hover:bg-input/40",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/60",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",xs:"h-7 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8"}},defaultVariants:{variant:"default",size:"default"}});function I({className:t,variant:s,size:n,asChild:r=!1,...a}){const o=r?wn:"button";return e.jsx(o,{"data-slot":"button",className:b(es({variant:s,size:n,className:t})),...a})}function rr(t){return e.jsx(kn,{"data-slot":"sheet",...t})}function tc(t){return e.jsx(Mn,{"data-slot":"sheet-portal",...t})}function sc({className:t,...s}){return e.jsx(zn,{"data-slot":"sheet-overlay",className:b("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s})}function ar({className:t,children:s,side:n="right",showCloseButton:r=!0,...a}){return e.jsxs(tc,{children:[e.jsx(sc,{}),e.jsxs(Nn,{"data-slot":"sheet-content",className:b("fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-300",n==="right"&&"inset-y-0 right-0 h-full w-full border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-xl",n==="left"&&"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",n==="top"&&"inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",n==="bottom"&&"inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",t),...a,children:[s,r&&e.jsxs(Cn,{className:"absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[e.jsx(Zt,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function nc({className:t,...s}){return e.jsx("div",{"data-slot":"sheet-header",className:b("flex flex-col gap-1.5 p-4",t),...s})}function zt({className:t,...s}){return e.jsx(_n,{"data-slot":"sheet-title",className:b("font-semibold text-foreground",t),...s})}function or({className:t,...s}){return e.jsx(Sn,{"data-slot":"sheet-description",className:b("text-sm text-muted-foreground",t),...s})}function ir(t){return e.jsx(Qr,{"data-slot":"dropdown-menu",...t})}function lr(t){return e.jsx(Jr,{"data-slot":"dropdown-menu-trigger",...t})}function cr({className:t,sideOffset:s=4,...n}){return e.jsx(Zr,{children:e.jsx(ea,{"data-slot":"dropdown-menu-content",sideOffset:s,className:b("z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",t),...n})})}function rc({className:t,inset:s,variant:n="default",...r}){return e.jsx(oa,{"data-slot":"dropdown-menu-item","data-inset":s,"data-variant":n,className:b("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",t),...r})}function ac(t){return e.jsx(na,{"data-slot":"dropdown-menu-radio-group",...t})}function is({className:t,children:s,...n}){return e.jsxs(ra,{"data-slot":"dropdown-menu-radio-item",className:b("relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n,children:[e.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:e.jsx(aa,{children:e.jsx(Oi,{className:"size-2 fill-current"})})}),s]})}function dr({className:t,inset:s,...n}){return e.jsx(ta,{"data-slot":"dropdown-menu-label","data-inset":s,className:b("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),...n})}function ur({className:t,...s}){return e.jsx(sa,{"data-slot":"dropdown-menu-separator",className:b("-mx-1 my-1 h-px bg-border",t),...s})}function mr(t){return e.jsx(kn,{"data-slot":"dialog",...t})}function oc(t){return e.jsx(Mn,{"data-slot":"dialog-portal",...t})}function ic({className:t,...s}){return e.jsx(zn,{"data-slot":"dialog-overlay",className:b("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s})}function hr({className:t,children:s,showCloseButton:n=!0,...r}){return e.jsxs(oc,{"data-slot":"dialog-portal",children:[e.jsx(ic,{}),e.jsxs(Nn,{"data-slot":"dialog-content",className:b("fixed top-[50%] left-[50%] z-50 grid max-h-[calc(100dvh-2rem)] w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 overflow-y-auto rounded-lg border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:max-w-lg",t),...r,children:[s,n&&e.jsxs(Cn,{"data-slot":"dialog-close",className:"absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[e.jsx(Zt,{}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function lc({className:t,...s}){return e.jsx("div",{"data-slot":"dialog-header",className:b("flex flex-col gap-2 text-center sm:text-left",t),...s})}function cc({className:t,...s}){return e.jsx("div",{"data-slot":"dialog-footer",className:b("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...s})}function fr({className:t,...s}){return e.jsx(_n,{"data-slot":"dialog-title",className:b("text-lg leading-none font-semibold",t),...s})}function pr({className:t,...s}){return e.jsx(Sn,{"data-slot":"dialog-description",className:b("text-sm text-muted-foreground",t),...s})}function We({className:t,type:s,...n}){return e.jsx("input",{type:s,"data-slot":"input",className:b("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30","focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",t),...n})}function Ze({className:t,...s}){return e.jsx(ia,{"data-slot":"label",className:b("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...s})}function ct(t){return e.jsx(la,{"data-slot":"select",...t})}function dt(t){return e.jsx(ua,{"data-slot":"select-value",...t})}function ut({className:t,size:s="default",children:n,...r}){return e.jsxs(ca,{"data-slot":"select-trigger","data-size":s,className:b("flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",t),...r,children:[n,e.jsx(da,{asChild:!0,children:e.jsx(Cs,{className:"size-4 opacity-50"})})]})}function mt({className:t,children:s,position:n="popper",...r}){return e.jsx(ma,{children:e.jsxs(ha,{"data-slot":"select-content",className:b("relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[e.jsx(fa,{className:"flex cursor-default items-center justify-center py-1",children:e.jsx(Ti,{className:"size-4"})}),e.jsx(pa,{className:b("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:s}),e.jsx(xa,{className:"flex cursor-default items-center justify-center py-1",children:e.jsx(Cs,{className:"size-4"})})]})})}function G({className:t,children:s,...n}){return e.jsxs(ga,{"data-slot":"select-item",className:b("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n,children:[e.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:e.jsx(ba,{children:e.jsx(Et,{className:"size-4"})})}),e.jsx(ya,{children:s})]})}function dc({className:t,...s}){return e.jsx("textarea",{"data-slot":"textarea",className:b("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive md:text-sm dark:bg-input/30",t),...s})}class gs extends Error{constructor(s,n){super(n),this.status=s,this.name="ApiError"}}async function ne(t,s={}){let n;try{n=await fetch(t,{...s,headers:{Accept:"application/json",...s.headers||{}}})}catch(r){throw r?.name==="AbortError"?r:new gs(0,"Cannot reach the FastrMemory server. Is `fastrmemory ui` still running?")}if(!n.ok){let r=`${n.status} ${n.statusText}`;try{const a=await n.json();a?.error&&(r=String(a.error))}catch{}throw new gs(n.status,r)}return await n.json()}function ot(t,s,n=!1){return ne(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s),keepalive:n})}function it(t){const s=new URLSearchParams;for(const[r,a]of Object.entries(t))a!=null&&a!==""&&s.set(r,String(a));const n=s.toString();return n?`?${n}`:""}const Q={status:t=>ne("/api/status",{signal:t}),memories:t=>ne("/api/memories",{signal:t}),search:(t,s)=>ne(`/api/search${it({...t})}`,{signal:s}),memory:(t,s)=>ne(`/api/memories/${encodeURIComponent(t)}`,{signal:s}),history:(t,s)=>ne(`/api/memories/${encodeURIComponent(t)}/history`,{signal:s}),traps:(t,s)=>ne(`/api/traps${it({files:t.join(",")})}`,{signal:s}),actions:t=>ne("/api/actions",{signal:t}),conflicts:t=>ne("/api/conflicts",{signal:t}),timeline:(t=30,s)=>ne(`/api/timeline${it({limit:t})}`,{signal:s}),replay:(t,s,n)=>ne(`/api/replay${it({from:t,to:s})}`,{signal:n}),graph:(t,s)=>ne(`/api/graph${it({file:t})}`,{signal:s}),entities:t=>ne("/api/entities",{signal:t}),explain:(t,s)=>ne(`/api/search/explain${it({q:t})}`,{signal:s}),health:t=>ne("/api/health",{signal:t}),version:t=>ne("/api/version",{signal:t}),heal:t=>ot("/api/health/heal",{dryRun:t}),createMemory:t=>ot("/api/memories",t),pin:(t,s,n=!1)=>ot("/api/memories/pin",{memoryId:t,pinned:s},n),forget:(t,s=!1)=>ot("/api/memories/forget",{memoryId:t,reason:"User requested forget via Fastr Dashboard"},s),resolveConflict:(t,s,n,r=!1)=>ot("/api/conflicts/resolve",{conflictId:t,keepMemoryId:s,forgetLoser:n,reason:"Resolved via Fastr Dashboard"},r),seedActions:()=>ot("/api/actions/seed",{})},uc=["home","memories","traps","conflicts","actions","graph","observatory","treemap","search","replay","health","settings"],mc={overview:"home",dag:"actions",rrf:"search"};function xr(t){const s=t.replace(/^#\/?/,""),[n,r=""]=s.split("?"),a=n.split("/").filter(Boolean).map(m=>{try{return decodeURIComponent(m)}catch{return m}}),o=a[0]||"home",l=uc.includes(o)?o:mc[o]??"home",c=new URLSearchParams(r),d=a[1]??null,u=l==="memories"&&d?d:c.get("m");return{name:l,id:d,query:c,memoryId:u}}let an=null,on=xr("");function Gt(){const t=window.location.hash;return t!==an&&(an=t,on=xr(t)),on}function hc(t){return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)}function st(){return p.useSyncExternalStore(hc,Gt,Gt)}function gt(t,s,n){let r=`#/${t==="home"?"":t}`;if(s&&(r+=`/${encodeURIComponent(s)}`),n){const a=new URLSearchParams;for(const[l,c]of Object.entries(n))c&&a.set(l,c);const o=a.toString();o&&(r+=`?${o}`)}return r}function le(t,s,n){const r=gt(t,s,n);window.location.hash!==r&&(window.location.hash=r)}function De(t){const s=Gt();if(s.name==="memories")le("memories",t,Object.fromEntries(s.query));else{const n=Object.fromEntries(s.query);le(s.name,s.id,{...n,m:t})}}function gr(){const t=Gt(),s=Object.fromEntries(t.query);delete s.m,t.name==="memories"?le("memories",null,s):le(t.name,t.id,s)}function fc(t){return`${window.location.origin}${window.location.pathname}${gt("memories",t)}`}const br=new Ia({defaultOptions:{queries:{staleTime:5e3,refetchOnWindowFocus:!1,retry:(t,s)=>s instanceof gs&&s.status>=400&&s.status<500?!1:t<2}}}),xe={status:["status"],memories:["memories"],search:t=>["search",t],memory:t=>["memory",t],history:t=>["memory",t,"history"],traps:t=>["traps",t],actions:["actions"],conflicts:["conflicts"],timeline:t=>["timeline",t],replay:(t,s)=>["replay",t,s],graph:t=>["graph",t??""],entities:["entities"],explain:t=>["explain",t],health:["health"]},ln=6e3,Ge=new Map;let bs=[];const ys=new Set;function Es(){bs=Array.from(Ge.values()).map(t=>t.op),ys.forEach(t=>t())}function yr(t,s=!1){switch(t.type){case"pin":return Promise.all(t.memoryIds.map(n=>Q.pin(n,t.pinned,s)));case"forget":return Promise.all(t.memoryIds.map(n=>Q.forget(n,s)));case"resolve":return Q.resolveConflict(t.conflictId,t.keepMemoryId,t.forgetLoser,s)}}async function pc(t){const s=Ge.get(t);if(!(!s||s.phase==="committing")){s.phase="committing",s.timer=null;try{await yr(s.op),await br.invalidateQueries()}catch(n){ie.error(`Could not apply: ${s.op.label}`,{description:n.message})}finally{Ge.delete(t),Es()}}}let xc=0;function ls(t){const s=`op_${Date.now().toString(36)}_${(xc++).toString(36)}`,n={...t,id:s};return Ge.set(s,{op:n,phase:"waiting",timer:setTimeout(()=>void pc(s),ln)}),Es(),ie(n.label,{id:s,duration:ln,description:"Applies in 6 seconds. Press Ctrl+Z to undo.",action:{label:"Undo",onClick:()=>vr(s)}}),s}function vr(t){const s=Ge.get(t);return!s||s.phase!=="waiting"?!1:(s.timer&&clearTimeout(s.timer),Ge.delete(t),Es(),ie.dismiss(t),ie.success(`Undone: ${s.op.label}`,{duration:2500}),!0)}function gc(){const t=Array.from(Ge.values()).filter(n=>n.phase==="waiting"),s=t[t.length-1];return s?vr(s.op.id):!1}function bc(){for(const t of Ge.values())t.phase==="waiting"&&(t.timer&&clearTimeout(t.timer),t.phase="committing",yr(t.op,!0).catch(()=>{}))}function yc(t){return ys.add(t),()=>ys.delete(t)}function It(){return p.useSyncExternalStore(yc,()=>bs,()=>bs)}function Ts(t,s){if(!t)return[];if(s.length===0)return t;const n=new Set,r=new Map;for(const o of s)o.type==="forget"&&o.memoryIds.forEach(l=>n.add(l)),o.type==="pin"&&o.memoryIds.forEach(l=>r.set(l,o.pinned?1:0));const a=[];for(const o of t){if(n.has(o.id))continue;const l=r.get(o.id);a.push(l===void 0?o:{...o,pinned:l})}return a}function vc(t,s){if(!t)return[];const n=new Set,r=new Set;for(const a of s)a.type==="resolve"&&n.add(a.conflictId),a.type==="forget"&&a.memoryIds.forEach(o=>r.add(o));return n.size===0&&r.size===0?t:t.filter(a=>!n.has(a.id)&&!r.has(a.memory_a_id)&&!r.has(a.memory_b_id))}function jc(t,s){return t.some(n=>n.type==="forget"&&n.memoryIds.includes(s))}function wc(t,s){let n;for(const r of t)r.type==="pin"&&r.memoryIds.includes(s)&&(n=r.pinned);return n}function vt(){return pe({queryKey:xe.status,queryFn:({signal:t})=>Q.status(t)})}function jr(){const t=It(),s=pe({queryKey:xe.memories,queryFn:({signal:r})=>Q.memories(r)}),n=p.useMemo(()=>s.data?Ts(s.data,t):void 0,[s.data,t]);return{...s,data:n}}function wr(t){const s=It(),n=pe({queryKey:xe.search(t),queryFn:({signal:a})=>Q.search(t,a),placeholderData:Kt}),r=p.useMemo(()=>n.data?{...n.data,results:Ts(n.data.results,s)}:void 0,[n.data,s]);return{...n,data:r}}function kc(t){return pe({queryKey:xe.memory(t??""),queryFn:({signal:s})=>Q.memory(t,s),enabled:!!t})}function Nc(t){return pe({queryKey:xe.history(t??""),queryFn:({signal:s})=>Q.history(t,s),enabled:!!t})}function Cc(t){const s=It(),n=pe({queryKey:xe.traps(t),queryFn:({signal:a})=>Q.traps(t,a),placeholderData:Kt}),r=p.useMemo(()=>n.data?{...n.data,traps:Ts(n.data.traps,s)}:void 0,[n.data,s]);return{...n,data:r}}function Xd(){return pe({queryKey:xe.actions,queryFn:({signal:t})=>Q.actions(t)})}function kr(){const t=It(),s=pe({queryKey:xe.conflicts,queryFn:({signal:r})=>Q.conflicts(r)}),n=p.useMemo(()=>s.data?vc(s.data,t):void 0,[s.data,t]);return{...s,data:n}}function _c(t=30){return pe({queryKey:xe.timeline(t),queryFn:({signal:s})=>Q.timeline(t,s)})}function Sc(t,s){return pe({queryKey:xe.replay(t,s),queryFn:({signal:n})=>Q.replay(t,s,n),enabled:!!(t&&s)})}function Qd(t){return pe({queryKey:xe.graph(t),queryFn:({signal:s})=>Q.graph(t,s),placeholderData:Kt})}function Mc(t){return pe({queryKey:xe.explain(t),queryFn:({signal:s})=>Q.explain(t,s),enabled:t.trim().length>0,placeholderData:Kt})}function zc(){return pe({queryKey:xe.health,queryFn:({signal:t})=>Q.health(t),staleTime:3e4})}const Ec=[{value:"rule",label:"Rule"},{value:"error_trap",label:"Error trap (2.0x recall boost)"},{value:"decision",label:"Decision"},{value:"workflow",label:"Workflow"}];function Nr({open:t,onOpenChange:s,defaultKind:n="rule"}){const r=ws(),a=vt(),[o,l]=p.useState(""),[c,d]=p.useState(""),[u,m]=p.useState("general"),[i,h]=p.useState(n),[g,C]=p.useState("");p.useEffect(()=>{t&&h(n)},[t,n]);const _=En({mutationFn:()=>Q.createMemory({title:o.trim(),content:c.trim(),module:u.trim()||"general",kind:i,files:g.split(/[,\n]/).map(y=>y.trim()).filter(Boolean)}),onSuccess:y=>{ie.success(`Saved ${y.kind==="error_trap"?"error trap":y.kind}`,{description:y.title,action:{label:"Open",onClick:()=>De(y.id)}}),l(""),d(""),C(""),s(!1),r.invalidateQueries()}}),S=y=>{y.preventDefault(),!(!o.trim()||!c.trim())&&_.mutate()};return e.jsx(mr,{open:t,onOpenChange:s,children:e.jsx(hr,{className:"sm:max-w-xl",children:e.jsxs("form",{onSubmit:S,className:"grid gap-4",children:[e.jsxs(lc,{children:[e.jsx(fr,{children:"Record a memory"}),e.jsx(pr,{children:"Memories created here are stored as verified and are immediately available to agents through fastr_recall."})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(Ze,{htmlFor:"mem-title",children:"Title"}),e.jsx(We,{id:"mem-title",required:!0,autoFocus:!0,value:o,onChange:y=>l(y.target.value),placeholder:"e.g. Always use big-endian for the binary protocol"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(Ze,{htmlFor:"mem-content",children:"Content"}),e.jsx(dc,{id:"mem-content",required:!0,rows:5,className:"max-h-64",value:c,onChange:y=>d(y.target.value),placeholder:"Explain the pattern, gotcha or fix. Markdown is supported."})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(Ze,{htmlFor:"mem-module",children:"Module"}),e.jsx(We,{id:"mem-module",list:"mem-module-options",value:u,onChange:y=>m(y.target.value),placeholder:"auth, api, db..."}),e.jsx("datalist",{id:"mem-module-options",children:(a.data?.modules??[]).map(y=>e.jsx("option",{value:y},y))})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(Ze,{htmlFor:"mem-kind",children:"Kind"}),e.jsxs(ct,{value:i,onValueChange:y=>h(y),children:[e.jsx(ut,{id:"mem-kind",className:"w-full",children:e.jsx(dt,{})}),e.jsx(mt,{children:Ec.map(y=>e.jsx(G,{value:y.value,children:y.label},y.value))})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(Ze,{htmlFor:"mem-files",children:"Linked files"}),e.jsx(We,{id:"mem-files",value:g,onChange:y=>C(y.target.value),placeholder:"src/auth.ts, src/server.ts","aria-describedby":"mem-files-hint"}),e.jsx("p",{id:"mem-files-hint",className:"text-xs text-muted-foreground",children:"Comma separated. Linked files let agents find this memory with fastr_trap_recall before editing them."})]}),_.isError&&e.jsx("p",{role:"alert",className:"rounded-md bg-risk-weak px-3 py-2 text-sm text-risk",children:_.error.message}),e.jsxs(cc,{children:[e.jsx(I,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsxs(I,{type:"submit",disabled:_.isPending||!o.trim()||!c.trim(),children:[_.isPending&&e.jsx(xs,{className:"animate-spin","aria-hidden":!0}),"Save memory"]})]})]})})})}function Tc({className:t,...s}){return e.jsx(et,{"data-slot":"command",className:b("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...s})}function Ac({title:t="Command Palette",description:s="Search for a command to run...",children:n,className:r,commandProps:a,...o}){return e.jsx(mr,{...o,children:e.jsxs(hr,{className:b("top-[15%] translate-y-0 overflow-hidden p-0 sm:max-w-xl",r),showCloseButton:!1,children:[e.jsx(fr,{className:"sr-only",children:t}),e.jsx(pr,{className:"sr-only",children:s}),e.jsx(Tc,{className:"**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-2.5 [&_[cmdk-item]_svg]:h-4 [&_[cmdk-item]_svg]:w-4",...a,children:n})]})})}function $c({className:t,...s}){return e.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[e.jsx(xt,{className:"size-4 shrink-0 opacity-50"}),e.jsx(et.Input,{"data-slot":"command-input",className:b("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...s})]})}function Dc({className:t,...s}){return e.jsx(et.List,{"data-slot":"command-list",className:b("max-h-[min(400px,60dvh)] scroll-py-1 overflow-x-hidden overflow-y-auto",t),...s})}function Ic(t){return e.jsx(et.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...t})}function cs({className:t,...s}){return e.jsx(et.Group,{"data-slot":"command-group",className:b("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...s})}function Lc({className:t,...s}){return e.jsx(et.Separator,{"data-slot":"command-separator",className:b("-mx-1 h-px bg-border",t),...s})}function Ct({className:t,...s}){return e.jsx(et.Item,{"data-slot":"command-item",className:b("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",t),...s})}const Rc=nr("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden whitespace-nowrap rounded-md border px-2 py-0.5 text-xs font-medium transition-[color,box-shadow] [&>svg]:pointer-events-none [&>svg]:size-3 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-white",outline:"text-foreground",brand:"border-transparent bg-brand-weak text-brand",trap:"border-transparent bg-trap-weak text-trap",risk:"border-transparent bg-risk-weak text-risk",success:"border-transparent bg-success-weak text-success",pinned:"border-transparent bg-pinned-weak text-pinned",muted:"border-transparent bg-muted text-muted-foreground"}},defaultVariants:{variant:"default"}});function te({className:t,variant:s,asChild:n=!1,...r}){const a=n?wn:"span";return e.jsx(a,{"data-slot":"badge",className:b(Rc({variant:s}),t),...r})}function ht({className:t,...s}){return e.jsx("div",{"data-slot":"skeleton","aria-hidden":!0,className:b("animate-pulse rounded-md bg-muted",t),...s})}const Cr={trap:"An error trap records a bug and its fix. Traps get a 2.0x recall boost so agents see them before repeating the mistake.",staging:"Staging memories were recorded by an agent but not yet verified. They graduate to verified when an agent calls fastr_handoff with verifyStaging: true.",verified:"Verified memories are trusted rules. They get a 1.25x multiplier in recall ranking.",superseded:"Superseded memories were replaced by a newer version (or forgotten). They stay in history but are no longer recalled.",reward:"Reward score starts at 1.0 and moves with fastr_feedback (+0.2 good, -0.5 bad, range 0.1 to 3.0). It multiplies recall ranking; at 0.2 or below a memory goes dormant.",recall:"How many times agents retrieved this memory through fastr_recall.",rrf:"Reciprocal Rank Fusion merges three ranked lists (BM25 keywords, vector similarity, graph spreading) with score = sum of 1/(60 + rank).",frontier:"Frontier tasks are actions whose dependencies are all done, so an agent can claim them right now.",conflict:"A conflict is a pair of active memories that contradict each other. Resolve it by keeping one, or keep both and lower the other reward.",provenance:"A SHA-256 signature over the memory author, content and timestamp. Verification fails if the stored text was edited outside FastrMemory.",embedding:"Share of memories with a local vector embedding. Memories without one can only be found by keywords and graph links.",spool:"When the database is locked, writes are queued in a spool file and committed on the next successful write.",pinned:"Pinned memories sort to the top of memory lists so they stay in view.",supersession:"Each superseded version points to the memory that replaced it. The chain shows how a rule evolved."};function _r(t){if(!t)return null;const s=/[zZ]|[+-]\d\d:?\d\d$/.test(t)?t:`${t.replace(" ","T")}Z`,n=new Date(s);return Number.isNaN(n.getTime())?null:n}const Qe=typeof Intl<"u"?new Intl.RelativeTimeFormat(void 0,{numeric:"auto"}):null;function Ae(t){const s=_r(t);if(!s)return"—";const n=Math.round((s.getTime()-Date.now())/1e3),r=Math.abs(n);return Qe?r<45?Qe.format(n,"second"):r<2700?Qe.format(Math.round(n/60),"minute"):r<64800?Qe.format(Math.round(n/3600),"hour"):r<2592e3?Qe.format(Math.round(n/86400),"day"):r<31536e3?Qe.format(Math.round(n/2592e3),"month"):Qe.format(Math.round(n/31536e3),"year"):s.toLocaleString()}function Ut(t){const s=_r(t);return s?s.toLocaleString():"—"}const Pc={rule:"Rule",decision:"Decision",error_trap:"Trap",workflow:"Workflow"};function ts(t){return t==null||Number.isNaN(t)?"—":`${t.toFixed(2)}x`}function Ne(t,s,n=`${s}s`){return`${t.toLocaleString()} ${t===1?s:n}`}function fe({k:t,children:s,className:n}){return e.jsxs(Tt,{children:[e.jsx(At,{asChild:!0,children:e.jsx("button",{type:"button",className:b("inline-flex cursor-help items-center gap-1 rounded-sm underline decoration-muted-foreground/50 decoration-dotted underline-offset-4 outline-none focus-visible:ring-2 focus-visible:ring-ring/50",n),children:s})}),e.jsx($t,{className:"max-w-72",children:Cr[t]})]})}function Oc({k:t,label:s}){return e.jsxs(Tt,{children:[e.jsx(At,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`What is ${s}?`,className:"inline-flex size-5 items-center justify-center rounded-full text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50",children:e.jsx(Ii,{className:"size-3.5","aria-hidden":!0})})}),e.jsx($t,{className:"max-w-72",children:Cr[t]})]})}function jt({kind:t,className:s}){const n=t==="error_trap"?"trap":t==="decision"?"pinned":t==="workflow"?"success":"brand";return e.jsx(te,{variant:n,className:b("font-mono text-[10px] tracking-wide uppercase",s),children:Pc[t]??t})}function Lt({status:t}){const s=t==="verified"?"success":t==="staging"?"trap":t==="superseded"?"muted":"secondary";return e.jsx(te,{variant:s,className:"text-[10px] capitalize",children:t})}function Ye({title:t,description:s,actions:n,icon:r}){return e.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("h1",{className:"flex items-center gap-2 text-xl font-semibold tracking-tight",children:[r&&e.jsx(r,{className:"size-5 text-brand","aria-hidden":!0}),t]}),s&&e.jsx("p",{className:"mt-1 max-w-3xl text-sm text-muted-foreground",children:s})]}),n&&e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:n})]})}function Ue({icon:t,title:s,children:n,action:r,className:a}){return e.jsxs("div",{className:b("flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed px-6 py-12 text-center",a),children:[e.jsx("div",{className:"flex size-11 items-center justify-center rounded-full bg-muted",children:e.jsx(t,{className:"size-5 text-muted-foreground","aria-hidden":!0})}),e.jsxs("div",{className:"max-w-md",children:[e.jsx("h3",{className:"font-medium",children:s}),n&&e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:n})]}),r]})}function $e({error:t,onRetry:s,className:n}){const r=t instanceof Error?t.message:String(t??"Unknown error");return e.jsxs("div",{role:"alert",className:b("flex flex-col items-center justify-center gap-3 rounded-xl border border-risk/40 bg-risk-weak px-6 py-10 text-center",n),children:[e.jsx(Jt,{className:"size-6 text-risk","aria-hidden":!0}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium",children:"Could not load this data"}),e.jsx("p",{className:"mt-1 text-sm break-all text-muted-foreground",children:r})]}),s&&e.jsxs(I,{variant:"outline",size:"sm",onClick:s,children:[e.jsx(yt,{"aria-hidden":!0})," Retry"]})]})}function Te({rows:t=6,className:s}){return e.jsx("div",{className:b("flex flex-col gap-2",s),"aria-busy":"true","aria-label":"Loading",children:Array.from({length:t},(n,r)=>e.jsx(ht,{className:"h-10 w-full"},r))})}function ke({label:t,value:s,hint:n,tone:r="default",onClick:a,loading:o}){const l={default:"text-foreground",trap:"text-trap",risk:"text-risk",success:"text-success",brand:"text-brand"}[r],c=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:t}),o?e.jsx(ht,{className:"mt-2 h-7 w-16"}):e.jsx("div",{className:b("mt-1 font-mono text-2xl font-semibold tabular-nums",l),children:s}),n&&e.jsx("div",{className:"mt-1 truncate text-xs text-muted-foreground",children:n})]}),d="min-w-0 rounded-xl border bg-card p-4 text-left shadow-xs";return a?e.jsx("button",{type:"button",onClick:a,className:b(d,"transition-colors outline-none hover:bg-accent/50 focus-visible:ring-[3px] focus-visible:ring-ring/50"),children:c}):e.jsx("div",{className:d,children:c})}const Sr=[{label:"Overview",items:[{route:"home",label:"Home",icon:Jn}]},{label:"Knowledge",items:[{route:"memories",label:"Memories",icon:ps,count:t=>t.activeCount},{route:"traps",label:"Traps",icon:Dt,count:t=>t.trapsCount,tone:"trap"},{route:"conflicts",label:"Conflicts",icon:Qt,count:t=>t.conflictsCount,tone:"risk"}]},{label:"Work",items:[{route:"actions",label:"Actions",icon:ol,count:t=>t.actionsCount}]},{label:"Explore",items:[{route:"graph",label:"Graph",icon:Si,count:t=>t.graphNodesCount},{route:"observatory",label:"3D Observatory",icon:Sl},{route:"treemap",label:"Treemap",icon:pl},{route:"search",label:"Search Lab",icon:xt},{route:"replay",label:"Replay",icon:ft}]},{label:"System",items:[{route:"health",label:"Health",icon:Qn},{route:"settings",label:"Settings",icon:tr}]}],Fc=Sr.flatMap(t=>t.items);function As(t,s=250){const[n,r]=p.useState(t);return p.useEffect(()=>{const a=setTimeout(()=>r(t),s);return()=>clearTimeout(a)},[t,s]),n}const Mr=p.createContext(null),Bc=["memory_created","memory_updated","trap_logged","conflict_detected","conflict_resolved","action_created","action_claimed","action_completed","action_updated","sync_complete"],qc=8e3;function cn(t,s){try{const n=localStorage.getItem(t);return n===null?s:JSON.parse(n)}catch{return s}}function dn(t,s){try{localStorage.setItem(t,JSON.stringify(s))}catch{}}function Vc({children:t}){const s=ws(),[n,r]=p.useState("connecting"),[a,o]=p.useState(null),[l,c]=p.useState(null),[d,u]=p.useState(null),[m,i]=p.useState(()=>document.hidden),[h,g]=p.useState(()=>cn("fastr-live-polling",!0)),[C,_]=p.useState(()=>cn("fastr-live-interval",2e3)),[S,y]=p.useState(()=>Date.now()),F=p.useRef(null),L=p.useRef(null),[B,U]=p.useState(0),W=p.useCallback(()=>{L.current||(L.current=setTimeout(()=>{L.current=null,c(Date.now()),s.invalidateQueries({predicate:T=>T.queryKey[0]!=="explain"})},150))},[s]),V=p.useCallback(async()=>{try{const T=await Q.version();o(Date.now()),u(null),F.current!==null&&F.current!==T.version&&W(),F.current=T.version}catch(T){u(T.message)}},[W]);p.useEffect(()=>{const T=()=>i(document.hidden);return document.addEventListener("visibilitychange",T),()=>document.removeEventListener("visibilitychange",T)},[]),p.useEffect(()=>{if(!h||m)return;V();const T=setInterval(()=>void V(),Math.max(1e3,C));return()=>clearInterval(T)},[h,m,C,V]),p.useEffect(()=>{const T=setInterval(()=>y(Date.now()),1e3);return()=>clearInterval(T)},[]),p.useEffect(()=>{let T=null,H=null,Y=!1;const f=()=>{if(!Y){r("connecting"),T=new EventSource("/api/stream"),T.onopen=()=>!Y&&r("live"),T.onerror=()=>{Y||(r("offline"),T?.close(),H=setTimeout(f,3e3))};for(const M of Bc)T.addEventListener(M,O=>{let R={};try{R=JSON.parse(O.data)}catch{}W(),M==="trap_logged"?ie.warning(`Error trap logged: ${String(R.title??"untitled")}`):M==="action_claimed"?ie.info(`${String(R.claimedBy??"An agent")} claimed ${String(R.title??R.actionId??"a task")}`):M==="action_completed"?ie.success(`Action completed: ${String(R.title??R.actionId??"")}`):M==="conflict_detected"&&ie.warning("New memory conflict detected")})}};return f(),()=>{Y=!0,H&&clearTimeout(H),T?.close()}},[W,B]);const j=p.useCallback(()=>{F.current=null,U(T=>T+1),V(),s.invalidateQueries()},[V,s]),q=p.useCallback(T=>{g(T),dn("fastr-live-polling",T)},[]),ge=p.useCallback(T=>{_(T),dn("fastr-live-interval",T)},[]);let ue;!h||m?ue=n==="live"?"live":"paused":a===null?ue=d?"stale":"connecting":ue=S-a>Math.max(qc,C*3)?"stale":"live";const K={health:ue,sse:n,lastSyncAt:a,lastChangeAt:l,lastError:d,pollingEnabled:h,intervalMs:C,setPollingEnabled:q,setIntervalMs:ge,resync:j};return e.jsx(Mr.Provider,{value:K,children:t})}function $s(){const t=p.useContext(Mr);if(!t)throw new Error("useLiveSync must be used inside LiveSyncProvider");return t}function Hc({open:t,onOpenChange:s,onCreate:n}){const[r,a]=p.useState(""),o=As(r.trim(),200),l=wr({q:o,limit:8}),{resolved:c,setMode:d}=Xt(),{resync:u}=$s();p.useEffect(()=>{t||a("")},[t]);const m=S=>{s(!1),requestAnimationFrame(S)},i=o?l.data?.results??[]:[],h=Fc.filter(S=>!o||S.label.toLowerCase().includes(o.toLowerCase())),g=i[0]?`memory-${i[0].id}`:h[0]?`page-${h[0].route}`:o?"":"action-create",[C,_]=p.useState(g);return p.useEffect(()=>_(g),[g]),e.jsxs(Ac,{open:t,onOpenChange:s,title:"Command palette",description:"Search memories or jump to a page",commandProps:{shouldFilter:!1,value:C,onValueChange:_},children:[e.jsx($c,{placeholder:"Search memories or type a page name…",value:r,onValueChange:a}),e.jsxs(Dc,{children:[e.jsx(Ic,{children:l.isFetching?"Searching…":"No matches."}),i.length>0&&e.jsx(cs,{heading:"Memories",children:i.map(S=>e.jsxs(Ct,{value:`memory-${S.id}`,onSelect:()=>m(()=>De(S.id)),children:[e.jsx(jt,{kind:S.kind}),e.jsx("span",{className:"truncate",children:S.title}),e.jsx("span",{className:"ml-auto shrink-0 font-mono text-[11px] text-muted-foreground",children:S.module})]},S.id))}),h.length>0&&e.jsx(cs,{heading:"Pages",children:h.map(S=>e.jsxs(Ct,{value:`page-${S.route}`,onSelect:()=>m(()=>le(S.route)),children:[e.jsx(S.icon,{"aria-hidden":!0}),S.label]},S.route))}),!o&&e.jsxs(e.Fragment,{children:[e.jsx(Lc,{}),e.jsxs(cs,{heading:"Actions",children:[e.jsxs(Ct,{value:"action-create",onSelect:()=>m(n),children:[e.jsx(Ss,{"aria-hidden":!0})," New memory"]}),e.jsxs(Ct,{value:"action-resync",onSelect:()=>m(u),children:[e.jsx(yt,{"aria-hidden":!0})," Resync with the database"]}),e.jsxs(Ct,{value:"action-theme",onSelect:()=>m(()=>d(c==="dark"?"light":"dark")),children:[c==="dark"?e.jsx(zs,{"aria-hidden":!0}):e.jsx(_s,{"aria-hidden":!0})," Switch to ",c==="dark"?"light":"dark"," theme"]})]})]})]})]})}function un({onNavigate:t}){const s=st(),{data:n}=vt();return e.jsx("nav",{"aria-label":"Main",className:"flex flex-col gap-5 px-3 py-4",children:Sr.map(r=>e.jsxs("div",{children:[e.jsx("div",{className:"mb-1.5 px-2 text-[11px] font-medium tracking-wide text-muted-foreground uppercase",children:r.label}),e.jsx("ul",{className:"flex flex-col gap-0.5",children:r.items.map(a=>{const o=s.name===a.route,l=n&&a.count?a.count(n):void 0,c=a.icon;return e.jsx("li",{children:e.jsxs("a",{href:gt(a.route),onClick:t,"aria-current":o?"page":void 0,className:b("flex h-8 items-center gap-2.5 rounded-md px-2 text-sm outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring/50",o?"bg-sidebar-accent font-medium text-sidebar-accent-foreground":"text-sidebar-foreground/80 hover:bg-sidebar-accent/60 hover:text-sidebar-foreground"),children:[e.jsx(c,{className:"size-4 shrink-0","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:a.label}),l!==void 0&&e.jsx("span",{className:b("ml-auto font-mono text-xs tabular-nums",l>0&&a.tone==="trap"&&"text-trap",l>0&&a.tone==="risk"&&"text-risk",!(l>0&&a.tone)&&"text-muted-foreground"),children:l})]})},a.route)})})]},r.label))})}function mn(){const{data:t}=vt();return e.jsxs("a",{href:gt("home"),className:"flex min-w-0 items-center gap-2.5 rounded-md outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:[e.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-brand text-white",children:e.jsx(ec,{className:"size-4","aria-hidden":!0})}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block text-sm leading-tight font-semibold",children:"FastrMemory"}),e.jsx("span",{className:"block truncate font-mono text-[11px] leading-tight text-muted-foreground",children:t?.projectName??"Loading…"})]})]})}function Wc(){const t=$s(),s={live:"Live",stale:"Stale",connecting:"Connecting",paused:"Paused"}[t.health],n={live:"bg-success",stale:"bg-risk",connecting:"bg-trap",paused:"bg-muted-foreground"}[t.health],r=t.health==="stale"?`No update from the server${t.lastSyncAt?` since ${Ae(new Date(t.lastSyncAt).toISOString())}`:""}${t.lastError?`: ${t.lastError}`:""}. Click to resync.`:t.health==="paused"?"Background polling is paused (tab hidden or disabled in Settings). Click to resync now.":`Watching the database for changes from agents, the CLI and this dashboard${t.lastChangeAt?` · last change ${Ae(new Date(t.lastChangeAt).toISOString())}`:""}. Click to resync.`;return e.jsxs(Tt,{children:[e.jsx(At,{asChild:!0,children:e.jsxs(I,{variant:"outline",size:"sm",onClick:t.resync,"aria-label":`Sync status: ${s}. Resync`,className:"gap-2",children:[e.jsxs("span",{className:"relative flex size-2",children:[t.health==="live"&&e.jsx("span",{className:b("absolute inline-flex size-full animate-ping rounded-full opacity-60 motion-reduce:hidden",n)}),e.jsx("span",{className:b("relative inline-flex size-2 rounded-full",n)})]}),e.jsx("span",{className:"hidden sm:inline",children:s}),t.health==="stale"&&e.jsx(yt,{className:"size-3.5","aria-hidden":!0})]})}),e.jsx($t,{className:"max-w-72",children:r})]})}function Gc(){const{mode:t,resolved:s,setMode:n}=Xt(),r=t==="system"?Zn:s==="dark"?_s:zs;return e.jsxs(ir,{children:[e.jsxs(Tt,{children:[e.jsx(At,{asChild:!0,children:e.jsx(lr,{asChild:!0,children:e.jsx(I,{variant:"ghost",size:"icon","aria-label":"Change theme",children:e.jsx(r,{"aria-hidden":!0})})})}),e.jsx($t,{children:"Theme"})]}),e.jsxs(cr,{align:"end",children:[e.jsx(dr,{children:"Theme"}),e.jsx(ur,{}),e.jsxs(ac,{value:t,onValueChange:a=>n(a),children:[e.jsx(is,{value:"light",children:"Light"}),e.jsx(is,{value:"dark",children:"Dark"}),e.jsx(is,{value:"system",children:"System"})]})]})]})}function Uc({children:t}){const s=st(),[n,r]=p.useState(!1),[a,o]=p.useState(!1),[l,c]=p.useState(!1),d=p.useRef(null);return p.useEffect(()=>{const u=m=>{const i=m.metaKey||m.ctrlKey;if(i&&m.key.toLowerCase()==="k"){m.preventDefault(),o(h=>!h);return}if(!di(m.target)){if(i&&!m.shiftKey&&m.key.toLowerCase()==="z"){gc()&&m.preventDefault();return}!i&&!m.altKey&&m.key==="/"&&(m.preventDefault(),o(!0))}};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[]),p.useEffect(()=>{d.current?.focus({preventScroll:!0}),d.current?.scrollTo?.({top:0})},[s.name]),e.jsxs("div",{className:"flex h-dvh overflow-hidden bg-canvas text-foreground",children:[e.jsx("a",{href:"#main",onClick:u=>{u.preventDefault(),d.current?.focus()},className:"sr-only z-50 rounded-md bg-background px-3 py-2 focus:not-sr-only focus:absolute focus:top-2 focus:left-2",children:"Skip to content"}),e.jsxs("aside",{className:"hidden w-60 shrink-0 flex-col border-r bg-sidebar md:flex",children:[e.jsx("div",{className:"flex h-14 items-center border-b px-4",children:e.jsx(mn,{})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx(un,{})})]}),e.jsx(rr,{open:n,onOpenChange:r,children:e.jsxs(ar,{side:"left",className:"w-72 gap-0 bg-sidebar p-0",children:[e.jsx(zt,{className:"sr-only",children:"Navigation"}),e.jsx(or,{className:"sr-only",children:"Dashboard sections"}),e.jsx("div",{className:"flex h-14 items-center border-b px-4",children:e.jsx(mn,{})}),e.jsx("div",{className:"overflow-y-auto",children:e.jsx(un,{onNavigate:()=>r(!1)})})]})}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsxs("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b bg-background/80 px-3 backdrop-blur sm:px-5",children:[e.jsx(I,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":"Open navigation",onClick:()=>r(!0),children:e.jsx(jl,{"aria-hidden":!0})}),e.jsxs("button",{type:"button",onClick:()=>o(!0),className:"flex h-9 min-w-0 flex-1 items-center gap-2 rounded-md border bg-card px-3 text-left text-sm text-muted-foreground shadow-xs outline-none hover:bg-accent/50 focus-visible:ring-[3px] focus-visible:ring-ring/50 sm:max-w-md",children:[e.jsx(Wi,{className:"size-4 shrink-0","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:"Search memories, jump to a page…"}),e.jsx("kbd",{className:"ml-auto hidden rounded border bg-muted px-1.5 font-mono text-[10px] sm:inline",children:"Ctrl K"})]}),e.jsxs("div",{className:"ml-auto flex items-center gap-1.5",children:[e.jsx(Wc,{}),e.jsx(Gc,{}),e.jsxs(I,{size:"sm",onClick:()=>c(!0),"aria-label":"New memory",children:[e.jsx(Ss,{"aria-hidden":!0}),e.jsx("span",{className:"hidden sm:inline",children:"New memory"})]})]})]}),e.jsx("main",{id:"main",ref:d,tabIndex:-1,className:"min-h-0 flex-1 overflow-y-auto outline-none",children:e.jsx("div",{className:"mx-auto w-full max-w-7xl px-4 py-5 sm:px-6 sm:py-6",children:t})})]}),e.jsx(Hc,{open:a,onOpenChange:o,onCreate:()=>c(!0)}),e.jsx(Nr,{open:l,onOpenChange:c})]})}function Kc({className:t,...s}){return e.jsx(va,{"data-slot":"tabs",className:b("flex flex-col gap-2",t),...s})}function Yc({className:t,...s}){return e.jsx(ja,{"data-slot":"tabs-list",className:b("inline-flex h-9 w-fit items-center justify-center rounded-lg bg-muted p-[3px] text-muted-foreground",t),...s})}function ds({className:t,...s}){return e.jsx(wa,{"data-slot":"tabs-trigger",className:b("inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:shadow-sm dark:text-muted-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:data-[state=active]:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...s})}function us({className:t,...s}){return e.jsx(ka,{"data-slot":"tabs-content",className:b("flex-1 outline-none",t),...s})}async function zr(t){try{return await navigator.clipboard.writeText(t),!0}catch{try{const s=document.createElement("textarea");s.value=t,s.setAttribute("readonly",""),s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select();const n=document.execCommand("copy");return document.body.removeChild(s),n}catch{return!1}}}function bt({text:t,label:s,description:n,className:r,size:a,variant:o="outline"}){const[l,c]=p.useState(!1),d=n??(s?`Copy ${s}`:"Copy to clipboard"),u=async i=>{i.stopPropagation(),await zr(t)?(c(!0),setTimeout(()=>c(!1),1600)):ie.error("Clipboard is not available in this browser")},m=e.jsxs(I,{type:"button",variant:o,size:a??(s?"xs":"icon-sm"),onClick:u,"aria-label":s?void 0:d,className:b(l&&"text-success",r),children:[l?e.jsx(Et,{"aria-hidden":!0}):e.jsx(Ui,{"aria-hidden":!0}),s&&e.jsx("span",{children:l?"Copied":s}),e.jsx("span",{className:"sr-only","aria-live":"polite",children:l?"Copied to clipboard":""})]});return s?m:e.jsxs(Tt,{children:[e.jsx(At,{asChild:!0,children:m}),e.jsx($t,{children:d})]})}function Je(t){return t.split(/(`[^`]+`|\*\*[^*]+\*\*|\*[^*\s][^*]*\*)/g).map((n,r)=>n.length>1&&n.startsWith("`")&&n.endsWith("`")?e.jsx("code",{className:"rounded border bg-muted px-1.5 py-0.5 font-mono text-[0.85em] text-brand",children:n.slice(1,-1)},r):n.length>3&&n.startsWith("**")&&n.endsWith("**")?e.jsx("strong",{className:"font-semibold",children:n.slice(2,-2)},r):n.length>2&&n.startsWith("*")&&n.endsWith("*")?e.jsx("em",{children:n.slice(1,-1)},r):n)}function Er({content:t,className:s}){const n=p.useMemo(()=>{const r=[];if(!t)return r;const a=t.split(`
322
+ */const Zl=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],ec=N("Zap",Zl),nn=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,rn=Dn,nr=(t,s)=>n=>{var r;if(s?.variants==null)return rn(t,n?.class,n?.className);const{variants:a,defaultVariants:o}=s,l=Object.keys(a).map(u=>{const m=n?.[u],i=o?.[u];if(m===null)return null;const h=nn(m)||nn(i);return a[u][h]}),c=n&&Object.entries(n).reduce((u,m)=>{let[i,h]=m;return h===void 0||(u[i]=h),u},{}),d=s==null||(r=s.compoundVariants)===null||r===void 0?void 0:r.reduce((u,m)=>{let{class:i,className:h,...g}=m;return Object.entries(g).every(C=>{let[S,_]=C;return Array.isArray(_)?_.includes({...o,...c}[S]):{...o,...c}[S]===_})?[...u,i,h]:u},[]);return rn(t,l,d,n?.class,n?.className)},es=nr("inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",outline:"border bg-card shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/20 dark:border-input dark:hover:bg-input/40",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/60",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",xs:"h-7 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8"}},defaultVariants:{variant:"default",size:"default"}});function I({className:t,variant:s,size:n,asChild:r=!1,...a}){const o=r?wn:"button";return e.jsx(o,{"data-slot":"button",className:b(es({variant:s,size:n,className:t})),...a})}function rr(t){return e.jsx(kn,{"data-slot":"sheet",...t})}function tc(t){return e.jsx(Mn,{"data-slot":"sheet-portal",...t})}function sc({className:t,...s}){return e.jsx(zn,{"data-slot":"sheet-overlay",className:b("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s})}function ar({className:t,children:s,side:n="right",showCloseButton:r=!0,...a}){return e.jsxs(tc,{children:[e.jsx(sc,{}),e.jsxs(Nn,{"data-slot":"sheet-content",className:b("fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-300",n==="right"&&"inset-y-0 right-0 h-full w-full border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-xl",n==="left"&&"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",n==="top"&&"inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",n==="bottom"&&"inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",t),...a,children:[s,r&&e.jsxs(Cn,{className:"absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[e.jsx(Zt,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function nc({className:t,...s}){return e.jsx("div",{"data-slot":"sheet-header",className:b("flex flex-col gap-1.5 p-4",t),...s})}function zt({className:t,...s}){return e.jsx(Sn,{"data-slot":"sheet-title",className:b("font-semibold text-foreground",t),...s})}function or({className:t,...s}){return e.jsx(_n,{"data-slot":"sheet-description",className:b("text-sm text-muted-foreground",t),...s})}function ir(t){return e.jsx(Qr,{"data-slot":"dropdown-menu",...t})}function lr(t){return e.jsx(Jr,{"data-slot":"dropdown-menu-trigger",...t})}function cr({className:t,sideOffset:s=4,...n}){return e.jsx(Zr,{children:e.jsx(ea,{"data-slot":"dropdown-menu-content",sideOffset:s,className:b("z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",t),...n})})}function rc({className:t,inset:s,variant:n="default",...r}){return e.jsx(oa,{"data-slot":"dropdown-menu-item","data-inset":s,"data-variant":n,className:b("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",t),...r})}function ac(t){return e.jsx(na,{"data-slot":"dropdown-menu-radio-group",...t})}function is({className:t,children:s,...n}){return e.jsxs(ra,{"data-slot":"dropdown-menu-radio-item",className:b("relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n,children:[e.jsx("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:e.jsx(aa,{children:e.jsx(Oi,{className:"size-2 fill-current"})})}),s]})}function dr({className:t,inset:s,...n}){return e.jsx(ta,{"data-slot":"dropdown-menu-label","data-inset":s,className:b("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),...n})}function ur({className:t,...s}){return e.jsx(sa,{"data-slot":"dropdown-menu-separator",className:b("-mx-1 my-1 h-px bg-border",t),...s})}function mr(t){return e.jsx(kn,{"data-slot":"dialog",...t})}function oc(t){return e.jsx(Mn,{"data-slot":"dialog-portal",...t})}function ic({className:t,...s}){return e.jsx(zn,{"data-slot":"dialog-overlay",className:b("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s})}function hr({className:t,children:s,showCloseButton:n=!0,...r}){return e.jsxs(oc,{"data-slot":"dialog-portal",children:[e.jsx(ic,{}),e.jsxs(Nn,{"data-slot":"dialog-content",className:b("fixed top-[50%] left-[50%] z-50 grid max-h-[calc(100dvh-2rem)] w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 overflow-y-auto rounded-lg border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:max-w-lg",t),...r,children:[s,n&&e.jsxs(Cn,{"data-slot":"dialog-close",className:"absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[e.jsx(Zt,{}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function lc({className:t,...s}){return e.jsx("div",{"data-slot":"dialog-header",className:b("flex flex-col gap-2 text-center sm:text-left",t),...s})}function cc({className:t,...s}){return e.jsx("div",{"data-slot":"dialog-footer",className:b("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...s})}function fr({className:t,...s}){return e.jsx(Sn,{"data-slot":"dialog-title",className:b("text-lg leading-none font-semibold",t),...s})}function pr({className:t,...s}){return e.jsx(_n,{"data-slot":"dialog-description",className:b("text-sm text-muted-foreground",t),...s})}function We({className:t,type:s,...n}){return e.jsx("input",{type:s,"data-slot":"input",className:b("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30","focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",t),...n})}function Ze({className:t,...s}){return e.jsx(ia,{"data-slot":"label",className:b("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...s})}function ct(t){return e.jsx(la,{"data-slot":"select",...t})}function dt(t){return e.jsx(ua,{"data-slot":"select-value",...t})}function ut({className:t,size:s="default",children:n,...r}){return e.jsxs(ca,{"data-slot":"select-trigger","data-size":s,className:b("flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",t),...r,children:[n,e.jsx(da,{asChild:!0,children:e.jsx(Cs,{className:"size-4 opacity-50"})})]})}function mt({className:t,children:s,position:n="popper",...r}){return e.jsx(ma,{children:e.jsxs(ha,{"data-slot":"select-content",className:b("relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[e.jsx(fa,{className:"flex cursor-default items-center justify-center py-1",children:e.jsx(Ti,{className:"size-4"})}),e.jsx(pa,{className:b("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:s}),e.jsx(xa,{className:"flex cursor-default items-center justify-center py-1",children:e.jsx(Cs,{className:"size-4"})})]})})}function G({className:t,children:s,...n}){return e.jsxs(ga,{"data-slot":"select-item",className:b("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n,children:[e.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:e.jsx(ba,{children:e.jsx(Et,{className:"size-4"})})}),e.jsx(ya,{children:s})]})}function dc({className:t,...s}){return e.jsx("textarea",{"data-slot":"textarea",className:b("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive md:text-sm dark:bg-input/30",t),...s})}class gs extends Error{constructor(s,n){super(n),this.status=s,this.name="ApiError"}}async function ne(t,s={}){let n;try{n=await fetch(t,{...s,headers:{Accept:"application/json",...s.headers||{}}})}catch(r){throw r?.name==="AbortError"?r:new gs(0,"Cannot reach the FastrMemory server. Is `fastrmemory ui` still running?")}if(!n.ok){let r=`${n.status} ${n.statusText}`;try{const a=await n.json();a?.error&&(r=String(a.error))}catch{}throw new gs(n.status,r)}return await n.json()}function ot(t,s,n=!1){return ne(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s),keepalive:n})}function it(t){const s=new URLSearchParams;for(const[r,a]of Object.entries(t))a!=null&&a!==""&&s.set(r,String(a));const n=s.toString();return n?`?${n}`:""}const Q={status:t=>ne("/api/status",{signal:t}),memories:t=>ne("/api/memories",{signal:t}),search:(t,s)=>ne(`/api/search${it({...t})}`,{signal:s}),memory:(t,s)=>ne(`/api/memories/${encodeURIComponent(t)}`,{signal:s}),history:(t,s)=>ne(`/api/memories/${encodeURIComponent(t)}/history`,{signal:s}),traps:(t,s)=>ne(`/api/traps${it({files:t.join(",")})}`,{signal:s}),actions:t=>ne("/api/actions",{signal:t}),conflicts:t=>ne("/api/conflicts",{signal:t}),timeline:(t=30,s)=>ne(`/api/timeline${it({limit:t})}`,{signal:s}),replay:(t,s,n)=>ne(`/api/replay${it({from:t,to:s})}`,{signal:n}),graph:(t,s)=>ne(`/api/graph${it({file:t})}`,{signal:s}),entities:t=>ne("/api/entities",{signal:t}),explain:(t,s)=>ne(`/api/search/explain${it({q:t})}`,{signal:s}),health:t=>ne("/api/health",{signal:t}),version:t=>ne("/api/version",{signal:t}),heal:t=>ot("/api/health/heal",{dryRun:t}),createMemory:t=>ot("/api/memories",t),pin:(t,s,n=!1)=>ot("/api/memories/pin",{memoryId:t,pinned:s},n),forget:(t,s=!1)=>ot("/api/memories/forget",{memoryId:t,reason:"User requested forget via Fastr Dashboard"},s),resolveConflict:(t,s,n,r=!1)=>ot("/api/conflicts/resolve",{conflictId:t,keepMemoryId:s,forgetLoser:n,reason:"Resolved via Fastr Dashboard"},r),seedActions:()=>ot("/api/actions/seed",{})},uc=["home","memories","traps","conflicts","actions","graph","observatory","treemap","search","replay","health","settings"],mc={overview:"home",dag:"actions",rrf:"search"};function xr(t){const s=t.replace(/^#\/?/,""),[n,r=""]=s.split("?"),a=n.split("/").filter(Boolean).map(m=>{try{return decodeURIComponent(m)}catch{return m}}),o=a[0]||"home",l=uc.includes(o)?o:mc[o]??"home",c=new URLSearchParams(r),d=a[1]??null,u=l==="memories"&&d?d:c.get("m");return{name:l,id:d,query:c,memoryId:u}}let an=null,on=xr("");function Ut(){const t=window.location.hash;return t!==an&&(an=t,on=xr(t)),on}function hc(t){return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)}function st(){return p.useSyncExternalStore(hc,Ut,Ut)}function gt(t,s,n){let r=`#/${t==="home"?"":t}`;if(s&&(r+=`/${encodeURIComponent(s)}`),n){const a=new URLSearchParams;for(const[l,c]of Object.entries(n))c&&a.set(l,c);const o=a.toString();o&&(r+=`?${o}`)}return r}function le(t,s,n){const r=gt(t,s,n);window.location.hash!==r&&(window.location.hash=r)}function De(t){const s=Ut();if(s.name==="memories")le("memories",t,Object.fromEntries(s.query));else{const n=Object.fromEntries(s.query);le(s.name,s.id,{...n,m:t})}}function gr(){const t=Ut(),s=Object.fromEntries(t.query);delete s.m,t.name==="memories"?le("memories",null,s):le(t.name,t.id,s)}function fc(t){return`${window.location.origin}${window.location.pathname}${gt("memories",t)}`}const br=new Ia({defaultOptions:{queries:{staleTime:5e3,refetchOnWindowFocus:!1,retry:(t,s)=>s instanceof gs&&s.status>=400&&s.status<500?!1:t<2}}}),xe={status:["status"],memories:["memories"],search:t=>["search",t],memory:t=>["memory",t],history:t=>["memory",t,"history"],traps:t=>["traps",t],actions:["actions"],conflicts:["conflicts"],timeline:t=>["timeline",t],replay:(t,s)=>["replay",t,s],graph:t=>["graph",t??""],entities:["entities"],explain:t=>["explain",t],health:["health"]},ln=6e3,Ge=new Map;let bs=[];const ys=new Set;function Es(){bs=Array.from(Ge.values()).map(t=>t.op),ys.forEach(t=>t())}function yr(t,s=!1){switch(t.type){case"pin":return Promise.all(t.memoryIds.map(n=>Q.pin(n,t.pinned,s)));case"forget":return Promise.all(t.memoryIds.map(n=>Q.forget(n,s)));case"resolve":return Q.resolveConflict(t.conflictId,t.keepMemoryId,t.forgetLoser,s)}}async function pc(t){const s=Ge.get(t);if(!(!s||s.phase==="committing")){s.phase="committing",s.timer=null;try{await yr(s.op),await br.invalidateQueries()}catch(n){ie.error(`Could not apply: ${s.op.label}`,{description:n.message})}finally{Ge.delete(t),Es()}}}let xc=0;function ls(t){const s=`op_${Date.now().toString(36)}_${(xc++).toString(36)}`,n={...t,id:s};return Ge.set(s,{op:n,phase:"waiting",timer:setTimeout(()=>void pc(s),ln)}),Es(),ie(n.label,{id:s,duration:ln,description:"Applies in 6 seconds. Press Ctrl+Z to undo.",action:{label:"Undo",onClick:()=>vr(s)}}),s}function vr(t){const s=Ge.get(t);return!s||s.phase!=="waiting"?!1:(s.timer&&clearTimeout(s.timer),Ge.delete(t),Es(),ie.dismiss(t),ie.success(`Undone: ${s.op.label}`,{duration:2500}),!0)}function gc(){const t=Array.from(Ge.values()).filter(n=>n.phase==="waiting"),s=t[t.length-1];return s?vr(s.op.id):!1}function bc(){for(const t of Ge.values())t.phase==="waiting"&&(t.timer&&clearTimeout(t.timer),t.phase="committing",yr(t.op,!0).catch(()=>{}))}function yc(t){return ys.add(t),()=>ys.delete(t)}function Lt(){return p.useSyncExternalStore(yc,()=>bs,()=>bs)}function Ts(t,s){if(!t)return[];if(s.length===0)return t;const n=new Set,r=new Map;for(const o of s)o.type==="forget"&&o.memoryIds.forEach(l=>n.add(l)),o.type==="pin"&&o.memoryIds.forEach(l=>r.set(l,o.pinned?1:0));const a=[];for(const o of t){if(n.has(o.id))continue;const l=r.get(o.id);a.push(l===void 0?o:{...o,pinned:l})}return a}function vc(t,s){if(!t)return[];const n=new Set,r=new Set;for(const a of s)a.type==="resolve"&&n.add(a.conflictId),a.type==="forget"&&a.memoryIds.forEach(o=>r.add(o));return n.size===0&&r.size===0?t:t.filter(a=>!n.has(a.id)&&!r.has(a.memory_a_id)&&!r.has(a.memory_b_id))}function jc(t,s){return t.some(n=>n.type==="forget"&&n.memoryIds.includes(s))}function wc(t,s){let n;for(const r of t)r.type==="pin"&&r.memoryIds.includes(s)&&(n=r.pinned);return n}function vt(){return pe({queryKey:xe.status,queryFn:({signal:t})=>Q.status(t)})}function jr(){const t=Lt(),s=pe({queryKey:xe.memories,queryFn:({signal:r})=>Q.memories(r)}),n=p.useMemo(()=>s.data?Ts(s.data,t):void 0,[s.data,t]);return{...s,data:n}}function wr(t){const s=Lt(),n=pe({queryKey:xe.search(t),queryFn:({signal:a})=>Q.search(t,a),placeholderData:Yt}),r=p.useMemo(()=>n.data?{...n.data,results:Ts(n.data.results,s)}:void 0,[n.data,s]);return{...n,data:r}}function kc(t){return pe({queryKey:xe.memory(t??""),queryFn:({signal:s})=>Q.memory(t,s),enabled:!!t})}function Nc(t){return pe({queryKey:xe.history(t??""),queryFn:({signal:s})=>Q.history(t,s),enabled:!!t})}function Cc(t){const s=Lt(),n=pe({queryKey:xe.traps(t),queryFn:({signal:a})=>Q.traps(t,a),placeholderData:Yt}),r=p.useMemo(()=>n.data?{...n.data,traps:Ts(n.data.traps,s)}:void 0,[n.data,s]);return{...n,data:r}}function Xd(){return pe({queryKey:xe.actions,queryFn:({signal:t})=>Q.actions(t)})}function kr(){const t=Lt(),s=pe({queryKey:xe.conflicts,queryFn:({signal:r})=>Q.conflicts(r)}),n=p.useMemo(()=>s.data?vc(s.data,t):void 0,[s.data,t]);return{...s,data:n}}function Sc(t=30){return pe({queryKey:xe.timeline(t),queryFn:({signal:s})=>Q.timeline(t,s)})}function _c(t,s){return pe({queryKey:xe.replay(t,s),queryFn:({signal:n})=>Q.replay(t,s,n),enabled:!!(t&&s)})}function Qd(t){return pe({queryKey:xe.graph(t),queryFn:({signal:s})=>Q.graph(t,s),placeholderData:Yt})}function Mc(t){return pe({queryKey:xe.explain(t),queryFn:({signal:s})=>Q.explain(t,s),enabled:t.trim().length>0,placeholderData:Yt})}function zc(){return pe({queryKey:xe.health,queryFn:({signal:t})=>Q.health(t),staleTime:3e4})}const Ec=[{value:"rule",label:"Rule"},{value:"error_trap",label:"Error trap (2.0x recall boost)"},{value:"decision",label:"Decision"},{value:"workflow",label:"Workflow"}];function Nr({open:t,onOpenChange:s,defaultKind:n="rule"}){const r=ws(),a=vt(),[o,l]=p.useState(""),[c,d]=p.useState(""),[u,m]=p.useState("general"),[i,h]=p.useState(n),[g,C]=p.useState("");p.useEffect(()=>{t&&h(n)},[t,n]);const S=En({mutationFn:()=>Q.createMemory({title:o.trim(),content:c.trim(),module:u.trim()||"general",kind:i,files:g.split(/[,\n]/).map(y=>y.trim()).filter(Boolean)}),onSuccess:y=>{ie.success(`Saved ${y.kind==="error_trap"?"error trap":y.kind}`,{description:y.title,action:{label:"Open",onClick:()=>De(y.id)}}),l(""),d(""),C(""),s(!1),r.invalidateQueries()}}),_=y=>{y.preventDefault(),!(!o.trim()||!c.trim())&&S.mutate()};return e.jsx(mr,{open:t,onOpenChange:s,children:e.jsx(hr,{className:"sm:max-w-xl",children:e.jsxs("form",{onSubmit:_,className:"grid gap-4",children:[e.jsxs(lc,{children:[e.jsx(fr,{children:"Record a memory"}),e.jsx(pr,{children:"Memories created here are stored as verified and are immediately available to agents through fastr_recall."})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(Ze,{htmlFor:"mem-title",children:"Title"}),e.jsx(We,{id:"mem-title",required:!0,autoFocus:!0,value:o,onChange:y=>l(y.target.value),placeholder:"e.g. Always use big-endian for the binary protocol"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(Ze,{htmlFor:"mem-content",children:"Content"}),e.jsx(dc,{id:"mem-content",required:!0,rows:5,className:"max-h-64",value:c,onChange:y=>d(y.target.value),placeholder:"Explain the pattern, gotcha or fix. Markdown is supported."})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(Ze,{htmlFor:"mem-module",children:"Module"}),e.jsx(We,{id:"mem-module",list:"mem-module-options",value:u,onChange:y=>m(y.target.value),placeholder:"auth, api, db..."}),e.jsx("datalist",{id:"mem-module-options",children:(a.data?.modules??[]).map(y=>e.jsx("option",{value:y},y))})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(Ze,{htmlFor:"mem-kind",children:"Kind"}),e.jsxs(ct,{value:i,onValueChange:y=>h(y),children:[e.jsx(ut,{id:"mem-kind",className:"w-full",children:e.jsx(dt,{})}),e.jsx(mt,{children:Ec.map(y=>e.jsx(G,{value:y.value,children:y.label},y.value))})]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(Ze,{htmlFor:"mem-files",children:"Linked files"}),e.jsx(We,{id:"mem-files",value:g,onChange:y=>C(y.target.value),placeholder:"src/auth.ts, src/server.ts","aria-describedby":"mem-files-hint"}),e.jsx("p",{id:"mem-files-hint",className:"text-xs text-muted-foreground",children:"Comma separated. Linked files let agents find this memory with fastr_trap_recall before editing them."})]}),S.isError&&e.jsx("p",{role:"alert",className:"rounded-md bg-risk-weak px-3 py-2 text-sm text-risk",children:S.error.message}),e.jsxs(cc,{children:[e.jsx(I,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsxs(I,{type:"submit",disabled:S.isPending||!o.trim()||!c.trim(),children:[S.isPending&&e.jsx(xs,{className:"animate-spin","aria-hidden":!0}),"Save memory"]})]})]})})})}function Tc({className:t,...s}){return e.jsx(et,{"data-slot":"command",className:b("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...s})}function Ac({title:t="Command Palette",description:s="Search for a command to run...",children:n,className:r,commandProps:a,...o}){return e.jsx(mr,{...o,children:e.jsxs(hr,{className:b("top-[15%] translate-y-0 overflow-hidden p-0 sm:max-w-xl",r),showCloseButton:!1,children:[e.jsx(fr,{className:"sr-only",children:t}),e.jsx(pr,{className:"sr-only",children:s}),e.jsx(Tc,{className:"**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-2.5 [&_[cmdk-item]_svg]:h-4 [&_[cmdk-item]_svg]:w-4",...a,children:n})]})})}function $c({className:t,...s}){return e.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[e.jsx(xt,{className:"size-4 shrink-0 opacity-50"}),e.jsx(et.Input,{"data-slot":"command-input",className:b("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...s})]})}function Dc({className:t,...s}){return e.jsx(et.List,{"data-slot":"command-list",className:b("max-h-[min(400px,60dvh)] scroll-py-1 overflow-x-hidden overflow-y-auto",t),...s})}function Ic(t){return e.jsx(et.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...t})}function cs({className:t,...s}){return e.jsx(et.Group,{"data-slot":"command-group",className:b("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...s})}function Lc({className:t,...s}){return e.jsx(et.Separator,{"data-slot":"command-separator",className:b("-mx-1 h-px bg-border",t),...s})}function Ct({className:t,...s}){return e.jsx(et.Item,{"data-slot":"command-item",className:b("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",t),...s})}const Rc=nr("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden whitespace-nowrap rounded-md border px-2 py-0.5 text-xs font-medium transition-[color,box-shadow] [&>svg]:pointer-events-none [&>svg]:size-3 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-white",outline:"text-foreground",brand:"border-transparent bg-brand-weak text-brand",trap:"border-transparent bg-trap-weak text-trap",risk:"border-transparent bg-risk-weak text-risk",success:"border-transparent bg-success-weak text-success",pinned:"border-transparent bg-pinned-weak text-pinned",muted:"border-transparent bg-muted text-muted-foreground"}},defaultVariants:{variant:"default"}});function te({className:t,variant:s,asChild:n=!1,...r}){const a=n?wn:"span";return e.jsx(a,{"data-slot":"badge",className:b(Rc({variant:s}),t),...r})}function ht({className:t,...s}){return e.jsx("div",{"data-slot":"skeleton","aria-hidden":!0,className:b("animate-pulse rounded-md bg-muted",t),...s})}const Cr={trap:"An error trap records a bug and its fix. Traps get a 2.0x recall boost so agents see them before repeating the mistake.",staging:"Staging memories were recorded by an agent but not yet verified. They graduate to verified when an agent calls fastr_handoff with verifyStaging: true.",verified:"Verified memories are trusted rules. They get a 1.25x multiplier in recall ranking.",superseded:"Superseded memories were replaced by a newer version (or forgotten). They stay in history but are no longer recalled.",reward:"Reward score starts at 1.0 and moves with fastr_feedback (+0.2 good, -0.5 bad, range 0.1 to 3.0). It multiplies recall ranking; at 0.2 or below a memory goes dormant.",recall:"How many times agents retrieved this memory through fastr_recall.",rrf:"Reciprocal Rank Fusion merges three ranked lists (BM25 keywords, vector similarity, graph spreading) with score = sum of 1/(60 + rank).",frontier:"Frontier tasks are actions whose dependencies are all done, so an agent can claim them right now.",conflict:"A conflict is a pair of active memories that contradict each other. Resolve it by keeping one, or keep both and lower the other reward.",provenance:"A SHA-256 signature over the memory author, content and timestamp. Verification fails if the stored text was edited outside FastrMemory.",embedding:"Share of memories with a local vector embedding. Memories without one can only be found by keywords and graph links.",spool:"When the database is locked, writes are queued in a spool file and committed on the next successful write.",pinned:"Pinned memories sort to the top of memory lists so they stay in view.",supersession:"Each superseded version points to the memory that replaced it. The chain shows how a rule evolved."};function Sr(t){if(!t)return null;const s=/[zZ]|[+-]\d\d:?\d\d$/.test(t)?t:`${t.replace(" ","T")}Z`,n=new Date(s);return Number.isNaN(n.getTime())?null:n}const Qe=typeof Intl<"u"?new Intl.RelativeTimeFormat(void 0,{numeric:"auto"}):null;function Ae(t){const s=Sr(t);if(!s)return"—";const n=Math.round((s.getTime()-Date.now())/1e3),r=Math.abs(n);return Qe?r<45?Qe.format(n,"second"):r<2700?Qe.format(Math.round(n/60),"minute"):r<64800?Qe.format(Math.round(n/3600),"hour"):r<2592e3?Qe.format(Math.round(n/86400),"day"):r<31536e3?Qe.format(Math.round(n/2592e3),"month"):Qe.format(Math.round(n/31536e3),"year"):s.toLocaleString()}function Kt(t){const s=Sr(t);return s?s.toLocaleString():"—"}const Pc={rule:"Rule",decision:"Decision",error_trap:"Trap",workflow:"Workflow"};function ts(t){return t==null||Number.isNaN(t)?"—":`${t.toFixed(2)}x`}function Ne(t,s,n=`${s}s`){return`${t.toLocaleString()} ${t===1?s:n}`}function fe({k:t,children:s,className:n}){return e.jsxs(Tt,{children:[e.jsx(At,{asChild:!0,children:e.jsx("button",{type:"button",className:b("inline-flex cursor-help items-center gap-1 rounded-sm underline decoration-muted-foreground/50 decoration-dotted underline-offset-4 outline-none focus-visible:ring-2 focus-visible:ring-ring/50",n),children:s})}),e.jsx($t,{className:"max-w-72",children:Cr[t]})]})}function Oc({k:t,label:s}){return e.jsxs(Tt,{children:[e.jsx(At,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`What is ${s}?`,className:"inline-flex size-5 items-center justify-center rounded-full text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50",children:e.jsx(Ii,{className:"size-3.5","aria-hidden":!0})})}),e.jsx($t,{className:"max-w-72",children:Cr[t]})]})}function jt({kind:t,className:s}){const n=t==="error_trap"?"trap":t==="decision"?"pinned":t==="workflow"?"success":"brand";return e.jsx(te,{variant:n,className:b("font-mono text-[10px] tracking-wide uppercase",s),children:Pc[t]??t})}function Rt({status:t}){const s=t==="verified"?"success":t==="staging"?"trap":t==="superseded"?"muted":"secondary";return e.jsx(te,{variant:s,className:"text-[10px] capitalize",children:t})}function Ye({title:t,description:s,actions:n,icon:r}){return e.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("h1",{className:"flex items-center gap-2 text-xl font-semibold tracking-tight",children:[r&&e.jsx(r,{className:"size-5 text-brand","aria-hidden":!0}),t]}),s&&e.jsx("p",{className:"mt-1 max-w-3xl text-sm text-muted-foreground",children:s})]}),n&&e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:n})]})}function Ue({icon:t,title:s,children:n,action:r,className:a}){return e.jsxs("div",{className:b("flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed px-6 py-12 text-center",a),children:[e.jsx("div",{className:"flex size-11 items-center justify-center rounded-full bg-muted",children:e.jsx(t,{className:"size-5 text-muted-foreground","aria-hidden":!0})}),e.jsxs("div",{className:"max-w-md",children:[e.jsx("h3",{className:"font-medium",children:s}),n&&e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:n})]}),r]})}function $e({error:t,onRetry:s,className:n}){const r=t instanceof Error?t.message:String(t??"Unknown error");return e.jsxs("div",{role:"alert",className:b("flex flex-col items-center justify-center gap-3 rounded-xl border border-risk/40 bg-risk-weak px-6 py-10 text-center",n),children:[e.jsx(It,{className:"size-6 text-risk","aria-hidden":!0}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium",children:"Could not load this data"}),e.jsx("p",{className:"mt-1 text-sm break-all text-muted-foreground",children:r})]}),s&&e.jsxs(I,{variant:"outline",size:"sm",onClick:s,children:[e.jsx(yt,{"aria-hidden":!0})," Retry"]})]})}function Te({rows:t=6,className:s}){return e.jsx("div",{className:b("flex flex-col gap-2",s),"aria-busy":"true","aria-label":"Loading",children:Array.from({length:t},(n,r)=>e.jsx(ht,{className:"h-10 w-full"},r))})}function ke({label:t,value:s,hint:n,tone:r="default",onClick:a,loading:o}){const l={default:"text-foreground",trap:"text-trap",risk:"text-risk",success:"text-success",brand:"text-brand"}[r],c=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:t}),o?e.jsx(ht,{className:"mt-2 h-7 w-16"}):e.jsx("div",{className:b("mt-1 font-mono text-2xl font-semibold tabular-nums",l),children:s}),n&&e.jsx("div",{className:"mt-1 truncate text-xs text-muted-foreground",children:n})]}),d="min-w-0 rounded-xl border bg-card p-4 text-left shadow-xs";return a?e.jsx("button",{type:"button",onClick:a,className:b(d,"transition-colors outline-none hover:bg-accent/50 focus-visible:ring-[3px] focus-visible:ring-ring/50"),children:c}):e.jsx("div",{className:d,children:c})}const _r=[{label:"Overview",items:[{route:"home",label:"Home",icon:Jn}]},{label:"Knowledge",items:[{route:"memories",label:"Memories",icon:ps,count:t=>t.activeCount},{route:"traps",label:"Traps",icon:Dt,count:t=>t.trapsCount,tone:"trap"},{route:"conflicts",label:"Conflicts",icon:Jt,count:t=>t.conflictsCount,tone:"risk"}]},{label:"Work",items:[{route:"actions",label:"Actions",icon:ol,count:t=>t.actionsCount}]},{label:"Explore",items:[{route:"graph",label:"Graph",icon:_i,count:t=>t.graphNodesCount},{route:"observatory",label:"3D Observatory",icon:_l},{route:"treemap",label:"Treemap",icon:pl},{route:"search",label:"Search Lab",icon:xt},{route:"replay",label:"Replay",icon:ft}]},{label:"System",items:[{route:"health",label:"Health",icon:Qn},{route:"settings",label:"Settings",icon:tr}]}],Fc=_r.flatMap(t=>t.items);function As(t,s=250){const[n,r]=p.useState(t);return p.useEffect(()=>{const a=setTimeout(()=>r(t),s);return()=>clearTimeout(a)},[t,s]),n}const Mr=p.createContext(null),Bc=["memory_created","memory_updated","trap_logged","conflict_detected","conflict_resolved","action_created","action_claimed","action_completed","action_updated","sync_complete"],qc=8e3;function cn(t,s){try{const n=localStorage.getItem(t);return n===null?s:JSON.parse(n)}catch{return s}}function dn(t,s){try{localStorage.setItem(t,JSON.stringify(s))}catch{}}function Hc({children:t}){const s=ws(),[n,r]=p.useState("connecting"),[a,o]=p.useState(null),[l,c]=p.useState(null),[d,u]=p.useState(null),[m,i]=p.useState(()=>document.hidden),[h,g]=p.useState(()=>cn("fastr-live-polling",!0)),[C,S]=p.useState(()=>cn("fastr-live-interval",2e3)),[_,y]=p.useState(()=>Date.now()),F=p.useRef(null),L=p.useRef(null),[B,U]=p.useState(0),W=p.useCallback(()=>{L.current||(L.current=setTimeout(()=>{L.current=null,c(Date.now()),s.invalidateQueries({predicate:T=>T.queryKey[0]!=="explain"})},150))},[s]),H=p.useCallback(async()=>{try{const T=await Q.version();o(Date.now()),u(null),F.current!==null&&F.current!==T.version&&W(),F.current=T.version}catch(T){u(T.message)}},[W]);p.useEffect(()=>{const T=()=>i(document.hidden);return document.addEventListener("visibilitychange",T),()=>document.removeEventListener("visibilitychange",T)},[]),p.useEffect(()=>{if(!h||m)return;H();const T=setInterval(()=>void H(),Math.max(1e3,C));return()=>clearInterval(T)},[h,m,C,H]),p.useEffect(()=>{const T=setInterval(()=>y(Date.now()),1e3);return()=>clearInterval(T)},[]),p.useEffect(()=>{let T=null,V=null,Y=!1;const f=()=>{if(!Y){r("connecting"),T=new EventSource("/api/stream"),T.onopen=()=>!Y&&r("live"),T.onerror=()=>{Y||(r("offline"),T?.close(),V=setTimeout(f,3e3))};for(const M of Bc)T.addEventListener(M,O=>{let R={};try{R=JSON.parse(O.data)}catch{}W(),M==="trap_logged"?ie.warning(`Error trap logged: ${String(R.title??"untitled")}`):M==="action_claimed"?ie.info(`${String(R.claimedBy??"An agent")} claimed ${String(R.title??R.actionId??"a task")}`):M==="action_completed"?ie.success(`Action completed: ${String(R.title??R.actionId??"")}`):M==="conflict_detected"&&ie.warning("New memory conflict detected")})}};return f(),()=>{Y=!0,V&&clearTimeout(V),T?.close()}},[W,B]);const j=p.useCallback(()=>{F.current=null,U(T=>T+1),H(),s.invalidateQueries()},[H,s]),q=p.useCallback(T=>{g(T),dn("fastr-live-polling",T)},[]),ge=p.useCallback(T=>{S(T),dn("fastr-live-interval",T)},[]);let ue;!h||m?ue=n==="live"?"live":"paused":a===null?ue=d?"stale":"connecting":ue=_-a>Math.max(qc,C*3)?"stale":"live";const K={health:ue,sse:n,lastSyncAt:a,lastChangeAt:l,lastError:d,pollingEnabled:h,intervalMs:C,setPollingEnabled:q,setIntervalMs:ge,resync:j};return e.jsx(Mr.Provider,{value:K,children:t})}function $s(){const t=p.useContext(Mr);if(!t)throw new Error("useLiveSync must be used inside LiveSyncProvider");return t}function Vc({open:t,onOpenChange:s,onCreate:n}){const[r,a]=p.useState(""),o=As(r.trim(),200),l=wr({q:o,limit:8}),{resolved:c,setMode:d}=Qt(),{resync:u}=$s();p.useEffect(()=>{t||a("")},[t]);const m=_=>{s(!1),requestAnimationFrame(_)},i=o?l.data?.results??[]:[],h=Fc.filter(_=>!o||_.label.toLowerCase().includes(o.toLowerCase())),g=i[0]?`memory-${i[0].id}`:h[0]?`page-${h[0].route}`:o?"":"action-create",[C,S]=p.useState(g);return p.useEffect(()=>S(g),[g]),e.jsxs(Ac,{open:t,onOpenChange:s,title:"Command palette",description:"Search memories or jump to a page",commandProps:{shouldFilter:!1,value:C,onValueChange:S},children:[e.jsx($c,{placeholder:"Search memories or type a page name…",value:r,onValueChange:a}),e.jsxs(Dc,{children:[e.jsx(Ic,{children:l.isFetching?"Searching…":"No matches."}),i.length>0&&e.jsx(cs,{heading:"Memories",children:i.map(_=>e.jsxs(Ct,{value:`memory-${_.id}`,onSelect:()=>m(()=>De(_.id)),children:[e.jsx(jt,{kind:_.kind}),e.jsx("span",{className:"truncate",children:_.title}),e.jsx("span",{className:"ml-auto shrink-0 font-mono text-[11px] text-muted-foreground",children:_.module})]},_.id))}),h.length>0&&e.jsx(cs,{heading:"Pages",children:h.map(_=>e.jsxs(Ct,{value:`page-${_.route}`,onSelect:()=>m(()=>le(_.route)),children:[e.jsx(_.icon,{"aria-hidden":!0}),_.label]},_.route))}),!o&&e.jsxs(e.Fragment,{children:[e.jsx(Lc,{}),e.jsxs(cs,{heading:"Actions",children:[e.jsxs(Ct,{value:"action-create",onSelect:()=>m(n),children:[e.jsx(_s,{"aria-hidden":!0})," New memory"]}),e.jsxs(Ct,{value:"action-resync",onSelect:()=>m(u),children:[e.jsx(yt,{"aria-hidden":!0})," Resync with the database"]}),e.jsxs(Ct,{value:"action-theme",onSelect:()=>m(()=>d(c==="dark"?"light":"dark")),children:[c==="dark"?e.jsx(zs,{"aria-hidden":!0}):e.jsx(Ss,{"aria-hidden":!0})," Switch to ",c==="dark"?"light":"dark"," theme"]})]})]})]})]})}function un({onNavigate:t}){const s=st(),{data:n}=vt();return e.jsx("nav",{"aria-label":"Main",className:"flex flex-col gap-5 px-3 py-4",children:_r.map(r=>e.jsxs("div",{children:[e.jsx("div",{className:"mb-1.5 px-2 text-[11px] font-medium tracking-wide text-muted-foreground uppercase",children:r.label}),e.jsx("ul",{className:"flex flex-col gap-0.5",children:r.items.map(a=>{const o=s.name===a.route,l=n&&a.count?a.count(n):void 0,c=a.icon;return e.jsx("li",{children:e.jsxs("a",{href:gt(a.route),onClick:t,"aria-current":o?"page":void 0,className:b("flex h-8 items-center gap-2.5 rounded-md px-2 text-sm outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring/50",o?"bg-sidebar-accent font-medium text-sidebar-accent-foreground":"text-sidebar-foreground/80 hover:bg-sidebar-accent/60 hover:text-sidebar-foreground"),children:[e.jsx(c,{className:"size-4 shrink-0","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:a.label}),l!==void 0&&e.jsx("span",{className:b("ml-auto font-mono text-xs tabular-nums",l>0&&a.tone==="trap"&&"text-trap",l>0&&a.tone==="risk"&&"text-risk",!(l>0&&a.tone)&&"text-muted-foreground"),children:l})]})},a.route)})})]},r.label))})}function mn(){const{data:t}=vt();return e.jsxs("a",{href:gt("home"),className:"flex min-w-0 items-center gap-2.5 rounded-md outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:[e.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-brand text-white",children:e.jsx(ec,{className:"size-4","aria-hidden":!0})}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block text-sm leading-tight font-semibold",children:"FastrMemory"}),e.jsx("span",{className:"block truncate font-mono text-[11px] leading-tight text-muted-foreground",children:t?.projectName??"Loading…"})]})]})}function Wc(){const t=$s(),s={live:"Live",stale:"Stale",connecting:"Connecting",paused:"Paused"}[t.health],n={live:"bg-success",stale:"bg-risk",connecting:"bg-trap",paused:"bg-muted-foreground"}[t.health],r=t.health==="stale"?`No update from the server${t.lastSyncAt?` since ${Ae(new Date(t.lastSyncAt).toISOString())}`:""}${t.lastError?`: ${t.lastError}`:""}. Click to resync.`:t.health==="paused"?"Background polling is paused (tab hidden or disabled in Settings). Click to resync now.":`Watching the database for changes from agents, the CLI and this dashboard${t.lastChangeAt?` · last change ${Ae(new Date(t.lastChangeAt).toISOString())}`:""}. Click to resync.`;return e.jsxs(Tt,{children:[e.jsx(At,{asChild:!0,children:e.jsxs(I,{variant:"outline",size:"sm",onClick:t.resync,"aria-label":`Sync status: ${s}. Resync`,className:"gap-2",children:[e.jsxs("span",{className:"relative flex size-2",children:[t.health==="live"&&e.jsx("span",{className:b("absolute inline-flex size-full animate-ping rounded-full opacity-60 motion-reduce:hidden",n)}),e.jsx("span",{className:b("relative inline-flex size-2 rounded-full",n)})]}),e.jsx("span",{className:"hidden sm:inline",children:s}),t.health==="stale"&&e.jsx(yt,{className:"size-3.5","aria-hidden":!0})]})}),e.jsx($t,{className:"max-w-72",children:r})]})}function Gc(){const{mode:t,resolved:s,setMode:n}=Qt(),r=t==="system"?Zn:s==="dark"?Ss:zs;return e.jsxs(ir,{children:[e.jsxs(Tt,{children:[e.jsx(At,{asChild:!0,children:e.jsx(lr,{asChild:!0,children:e.jsx(I,{variant:"ghost",size:"icon","aria-label":"Change theme",children:e.jsx(r,{"aria-hidden":!0})})})}),e.jsx($t,{children:"Theme"})]}),e.jsxs(cr,{align:"end",children:[e.jsx(dr,{children:"Theme"}),e.jsx(ur,{}),e.jsxs(ac,{value:t,onValueChange:a=>n(a),children:[e.jsx(is,{value:"light",children:"Light"}),e.jsx(is,{value:"dark",children:"Dark"}),e.jsx(is,{value:"system",children:"System"})]})]})]})}function Uc({children:t}){const s=st(),[n,r]=p.useState(!1),[a,o]=p.useState(!1),[l,c]=p.useState(!1),d=p.useRef(null);return p.useEffect(()=>{const u=m=>{const i=m.metaKey||m.ctrlKey;if(i&&m.key.toLowerCase()==="k"){m.preventDefault(),o(h=>!h);return}if(!di(m.target)){if(i&&!m.shiftKey&&m.key.toLowerCase()==="z"){gc()&&m.preventDefault();return}!i&&!m.altKey&&m.key==="/"&&(m.preventDefault(),o(!0))}};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[]),p.useEffect(()=>{d.current?.focus({preventScroll:!0}),d.current?.scrollTo?.({top:0})},[s.name]),e.jsxs("div",{className:"flex h-dvh overflow-hidden bg-canvas text-foreground",children:[e.jsx("a",{href:"#main",onClick:u=>{u.preventDefault(),d.current?.focus()},className:"sr-only z-50 rounded-md bg-background px-3 py-2 focus:not-sr-only focus:absolute focus:top-2 focus:left-2",children:"Skip to content"}),e.jsxs("aside",{className:"hidden w-60 shrink-0 flex-col border-r bg-sidebar md:flex",children:[e.jsx("div",{className:"flex h-14 items-center border-b px-4",children:e.jsx(mn,{})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx(un,{})})]}),e.jsx(rr,{open:n,onOpenChange:r,children:e.jsxs(ar,{side:"left",className:"w-72 gap-0 bg-sidebar p-0",children:[e.jsx(zt,{className:"sr-only",children:"Navigation"}),e.jsx(or,{className:"sr-only",children:"Dashboard sections"}),e.jsx("div",{className:"flex h-14 items-center border-b px-4",children:e.jsx(mn,{})}),e.jsx("div",{className:"overflow-y-auto",children:e.jsx(un,{onNavigate:()=>r(!1)})})]})}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsxs("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b bg-background/80 px-3 backdrop-blur sm:px-5",children:[e.jsx(I,{variant:"ghost",size:"icon",className:"md:hidden","aria-label":"Open navigation",onClick:()=>r(!0),children:e.jsx(jl,{"aria-hidden":!0})}),e.jsxs("button",{type:"button",onClick:()=>o(!0),className:"flex h-9 min-w-0 flex-1 items-center gap-2 rounded-md border bg-card px-3 text-left text-sm text-muted-foreground shadow-xs outline-none hover:bg-accent/50 focus-visible:ring-[3px] focus-visible:ring-ring/50 sm:max-w-md",children:[e.jsx(Wi,{className:"size-4 shrink-0","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:"Search memories, jump to a page…"}),e.jsx("kbd",{className:"ml-auto hidden rounded border bg-muted px-1.5 font-mono text-[10px] sm:inline",children:"Ctrl K"})]}),e.jsxs("div",{className:"ml-auto flex items-center gap-1.5",children:[e.jsx(Wc,{}),e.jsx(Gc,{}),e.jsxs(I,{size:"sm",onClick:()=>c(!0),"aria-label":"New memory",children:[e.jsx(_s,{"aria-hidden":!0}),e.jsx("span",{className:"hidden sm:inline",children:"New memory"})]})]})]}),e.jsx("main",{id:"main",ref:d,tabIndex:-1,className:"min-h-0 flex-1 overflow-y-auto outline-none",children:e.jsx("div",{className:"mx-auto w-full max-w-7xl px-4 py-5 sm:px-6 sm:py-6",children:t})})]}),e.jsx(Vc,{open:a,onOpenChange:o,onCreate:()=>c(!0)}),e.jsx(Nr,{open:l,onOpenChange:c})]})}function Kc({className:t,...s}){return e.jsx(va,{"data-slot":"tabs",className:b("flex flex-col gap-2",t),...s})}function Yc({className:t,...s}){return e.jsx(ja,{"data-slot":"tabs-list",className:b("inline-flex h-9 w-fit items-center justify-center rounded-lg bg-muted p-[3px] text-muted-foreground",t),...s})}function ds({className:t,...s}){return e.jsx(wa,{"data-slot":"tabs-trigger",className:b("inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:shadow-sm dark:text-muted-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:data-[state=active]:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...s})}function us({className:t,...s}){return e.jsx(ka,{"data-slot":"tabs-content",className:b("flex-1 outline-none",t),...s})}async function zr(t){try{return await navigator.clipboard.writeText(t),!0}catch{try{const s=document.createElement("textarea");s.value=t,s.setAttribute("readonly",""),s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select();const n=document.execCommand("copy");return document.body.removeChild(s),n}catch{return!1}}}function bt({text:t,label:s,description:n,className:r,size:a,variant:o="outline"}){const[l,c]=p.useState(!1),d=n??(s?`Copy ${s}`:"Copy to clipboard"),u=async i=>{i.stopPropagation(),await zr(t)?(c(!0),setTimeout(()=>c(!1),1600)):ie.error("Clipboard is not available in this browser")},m=e.jsxs(I,{type:"button",variant:o,size:a??(s?"xs":"icon-sm"),onClick:u,"aria-label":s?void 0:d,className:b(l&&"text-success",r),children:[l?e.jsx(Et,{"aria-hidden":!0}):e.jsx(Ui,{"aria-hidden":!0}),s&&e.jsx("span",{children:l?"Copied":s}),e.jsx("span",{className:"sr-only","aria-live":"polite",children:l?"Copied to clipboard":""})]});return s?m:e.jsxs(Tt,{children:[e.jsx(At,{asChild:!0,children:m}),e.jsx($t,{children:d})]})}function Je(t){return t.split(/(`[^`]+`|\*\*[^*]+\*\*|\*[^*\s][^*]*\*)/g).map((n,r)=>n.length>1&&n.startsWith("`")&&n.endsWith("`")?e.jsx("code",{className:"rounded border bg-muted px-1.5 py-0.5 font-mono text-[0.85em] text-brand",children:n.slice(1,-1)},r):n.length>3&&n.startsWith("**")&&n.endsWith("**")?e.jsx("strong",{className:"font-semibold",children:n.slice(2,-2)},r):n.length>2&&n.startsWith("*")&&n.endsWith("*")?e.jsx("em",{children:n.slice(1,-1)},r):n)}function Er({content:t,className:s}){const n=p.useMemo(()=>{const r=[];if(!t)return r;const a=t.split(`
323
323
  `);let o=!1,l="",c=[];return a.forEach((d,u)=>{const m=d.trim();if(m.startsWith("```")){if(o){const i=c.join(`
324
324
  `);r.push(e.jsxs("div",{className:"my-2 overflow-hidden rounded-lg border bg-muted/60",children:[e.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-1 font-mono text-[11px] text-muted-foreground",children:[e.jsx("span",{children:l||"code"}),e.jsx(bt,{text:i,label:"Copy",variant:"ghost"})]}),e.jsx("pre",{className:"overflow-x-auto p-3 font-mono text-xs leading-relaxed",children:e.jsx("code",{children:i})})]},`code-${u}`)),c=[],l="",o=!1}else o=!0,l=m.slice(3).trim();return}if(o){c.push(d);return}if(d.startsWith("### "))r.push(e.jsx("h4",{className:"mt-3 mb-1 text-sm font-semibold",children:Je(d.slice(4))},u));else if(d.startsWith("## "))r.push(e.jsx("h3",{className:"mt-3 mb-1 text-[15px] font-semibold",children:Je(d.slice(3))},u));else if(d.startsWith("# "))r.push(e.jsx("h2",{className:"mt-3 mb-1.5 text-base font-bold",children:Je(d.slice(2))},u));else if(m.startsWith("- ")||m.startsWith("* "))r.push(e.jsxs("div",{className:"my-1 flex gap-2 text-sm leading-relaxed",children:[e.jsx("span",{"aria-hidden":!0,className:"font-bold text-brand",children:"•"}),e.jsx("div",{children:Je(m.slice(2))})]},u));else if(/^\d+\.\s+/.test(m)){const i=m.match(/^(\d+)\.\s+(.*)$/);r.push(e.jsxs("div",{className:"my-1 flex gap-2 text-sm leading-relaxed",children:[e.jsxs("span",{className:"font-mono font-semibold text-brand",children:[i[1],"."]}),e.jsx("div",{children:Je(i[2])})]},u))}else m.startsWith("> ")?r.push(e.jsx("blockquote",{className:"my-2 rounded-r-md border-l-2 border-brand bg-brand-weak px-3 py-1.5 text-sm",children:Je(m.slice(2))},u)):m?r.push(e.jsx("p",{className:"my-1 text-sm leading-relaxed",children:Je(d)},u)):r.push(e.jsx("div",{className:"h-2"},u))}),o&&c.length&&r.push(e.jsx("pre",{className:"my-2 overflow-x-auto rounded-lg border bg-muted/60 p-3 font-mono text-xs",children:e.jsx("code",{children:c.join(`
325
- `)})},"code-unclosed")),r},[t]);return e.jsx("div",{className:b("break-words",s),children:n})}const Xc=4e6;function hn(t){return t.match(/\s+|[^\s]+/g)??[]}function Qc(t,s){let n=0;for(;n<t.length&&n<s.length&&t[n]===s[n];)n++;let r=t.length,a=s.length;for(;r>n&&a>n&&t[r-1]===s[a-1];)r--,a--;const o=t.slice(0,n),l=t.slice(r),c=t.slice(n,r),d=s.slice(n,a),u=c.length,m=d.length,i=[],h=(g,C)=>{const _=i[i.length-1];_&&_.type===g?_.text+=C:i.push({type:g,text:C})};if(o.forEach(g=>h("same",g)),(u+1)*(m+1)>Xc)c.forEach(g=>h("removed",g)),d.forEach(g=>h("added",g));else{const g=Array.from({length:u+1},()=>new Uint32Array(m+1));for(let S=u-1;S>=0;S--)for(let y=m-1;y>=0;y--)g[S][y]=c[S]===d[y]?g[S+1][y+1]+1:Math.max(g[S+1][y],g[S][y+1]);let C=0,_=0;for(;C<u&&_<m;)c[C]===d[_]?(h("same",c[C]),C++,_++):g[C+1][_]>=g[C][_+1]?h("removed",c[C++]):h("added",d[_++]);for(;C<u;)h("removed",c[C++]);for(;_<m;)h("added",d[_++])}return l.forEach(g=>h("same",g)),i}function Tr(t,s){return Qc(hn(t??""),hn(s??""))}function Jc(t){let s=0,n=0;for(const r of t){const a=r.text.trim()?r.text.trim().split(/\s+/).length:0;r.type==="added"&&(s+=a),r.type==="removed"&&(n+=a)}return{added:s,removed:n}}const Zc="rounded-sm bg-success-weak text-success underline decoration-success/60 decoration-1 underline-offset-2",ed="rounded-sm bg-risk-weak text-risk line-through decoration-risk/70";function fn({before:t,after:s,className:n}){const r=p.useMemo(()=>Tr(t,s),[t,s]),a=p.useMemo(()=>Jc(r),[r]);return e.jsxs("div",{className:n,children:[e.jsxs("div",{className:"mb-2 flex gap-3 font-mono text-xs",children:[e.jsxs("span",{className:"text-success",children:["+",a.added," words"]}),e.jsxs("span",{className:"text-risk",children:["-",a.removed," words"]})]}),e.jsx("p",{className:"text-sm leading-relaxed whitespace-pre-wrap break-words",children:r.map((o,l)=>e.jsx(vs,{op:o},l))})]})}function vs({op:t}){return t.type==="same"?e.jsx("span",{children:t.text}):t.type==="added"?e.jsxs("ins",{className:Zc,children:[e.jsx("span",{className:"sr-only",children:"[added: "}),t.text,e.jsx("span",{className:"sr-only",children:"]"})]}):e.jsxs("del",{className:ed,children:[e.jsx("span",{className:"sr-only",children:"[removed: "}),t.text,e.jsx("span",{className:"sr-only",children:"]"})]})}function td({left:t,right:s,leftLabel:n,rightLabel:r}){const a=p.useMemo(()=>Tr(t,s),[t,s]);return e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsx(pn,{label:n,children:a.map((o,l)=>o.type==="added"?null:o.type==="removed"?e.jsx(vs,{op:o},l):e.jsx("span",{children:o.text},l))}),e.jsx(pn,{label:r,children:a.map((o,l)=>o.type==="removed"?null:o.type==="added"?e.jsx(vs,{op:o},l):e.jsx("span",{children:o.text},l))})]})}function pn({label:t,children:s,className:n}){return e.jsxs("div",{className:b("min-w-0 rounded-lg border bg-muted/40 p-3",n),children:[e.jsx("div",{className:"mb-2 text-xs font-medium text-muted-foreground",children:t}),e.jsx("p",{className:"text-sm leading-relaxed whitespace-pre-wrap break-words",children:s})]})}function Ds(){const t=p.useCallback((r,a)=>{if(r.length===0)return;const o=r.length===1?`${a?"Pinned":"Unpinned"} "${r[0].title}"`:`${a?"Pinned":"Unpinned"} ${Ne(r.length,"memory","memories")}`;ls({type:"pin",memoryIds:r.map(l=>l.id),pinned:a,label:o})},[]),s=p.useCallback(r=>{if(r.length===0)return;const a=r.length===1?`Forgot "${r[0].title}"`:`Forgot ${Ne(r.length,"memory","memories")}`;ls({type:"forget",memoryIds:r.map(o=>o.id),label:a})},[]),n=p.useCallback((r,a,o,l)=>{ls({type:"resolve",conflictId:r,keepMemoryId:a,forgetLoser:o,label:l})},[]);return{setPinned:t,forget:s,resolveConflict:n}}function sd(){const s=st().memoryId;return e.jsx(rr,{open:!!s,onOpenChange:n=>!n&&gr(),children:e.jsx(ar,{side:"right",className:"w-full gap-0 p-0 sm:max-w-2xl",children:s?e.jsx(rd,{id:s}):e.jsx(zt,{className:"sr-only",children:"Memory"})})})}function Bt(t,s){return`${t} ${JSON.stringify(s)}`}function nd(t){return`"${t.replace(/(["\\$`])/g,"\\$1")}"`}function rd({id:t}){const s=kc(t),n=Nc(t),r=It(),{setPinned:a,forget:o}=Ds(),[l,c]=p.useState("content");if(p.useEffect(()=>c("content"),[t]),s.isLoading)return e.jsxs("div",{className:"flex flex-col gap-3 p-6","aria-busy":"true",children:[e.jsxs(zt,{className:"sr-only",children:["Loading memory ",t]}),e.jsx(ht,{className:"h-4 w-40"}),e.jsx(ht,{className:"h-7 w-3/4"}),e.jsx(ht,{className:"mt-4 h-40 w-full"})]});if(s.isError||!s.data)return e.jsxs("div",{className:"p-6",children:[e.jsxs(zt,{className:"mb-4",children:["Memory ",t]}),e.jsx($e,{error:s.error??"Not found",onRetry:()=>void s.refetch()})]});const d=s.data,m=wc(r,d.id)??!!d.pinned,i=jc(r,d.id),h=d.status==="superseded"||d.status==="dormant"||d.valid_to!==null,g=n.data?.chain??[],C=[{label:"Memory ID",value:d.id},{label:"Permalink",value:fc(d.id)},{label:"MCP: fastr_recall",value:Bt("fastr_recall",{query:d.title,module:d.module})},{label:"MCP: fastr_feedback (good)",value:Bt("fastr_feedback",{memoryId:d.id,outcome:"good"})},{label:"MCP: fastr_verify_provenance",value:Bt("fastr_verify_provenance",{memoryId:d.id})},...d.linked_files.length?[{label:"MCP: fastr_trap_recall",value:Bt("fastr_trap_recall",{files:d.linked_files})}]:[],{label:"CLI: fastrmemory recall",value:`fastrmemory recall ${nd(d.title)} -m ${d.module}`},{label:"Content (markdown)",value:d.content}];return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsxs(nc,{className:"gap-2 border-b px-5 pt-5 pb-4 pr-12",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("code",{className:"truncate font-mono text-xs text-brand",children:d.id}),e.jsx(bt,{text:d.id,description:"Copy memory ID",variant:"ghost"}),e.jsx(jt,{kind:d.kind}),e.jsx(Lt,{status:d.status}),m&&e.jsxs(te,{variant:"pinned",className:"text-[10px]",children:[e.jsx(Wt,{"aria-hidden":!0})," Pinned"]}),i&&e.jsx(te,{variant:"risk",className:"text-[10px]",children:"Forgetting..."})]}),e.jsx(zt,{className:"text-lg leading-snug",children:d.title}),e.jsxs(or,{children:[d.module," · recorded ",Ae(d.created_at)," by @",d.agent_id||"default"]}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-2",children:[e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>a([d],!m),disabled:h||i,children:[m?e.jsx(er,{"aria-hidden":!0}):e.jsx(Wt,{"aria-hidden":!0}),m?"Unpin":"Pin"]}),e.jsxs(I,{size:"sm",variant:"outline",className:"text-risk hover:text-risk",onClick:()=>{o([d]),gr()},disabled:h||i,children:[e.jsx(sr,{"aria-hidden":!0})," Forget"]}),e.jsxs(ir,{children:[e.jsx(lr,{asChild:!0,children:e.jsxs(I,{size:"sm",variant:"outline",children:[e.jsx(Bi,{"aria-hidden":!0})," Copy ",e.jsx(Cs,{"aria-hidden":!0,className:"opacity-60"})]})}),e.jsxs(cr,{align:"start",className:"w-64",children:[e.jsx(dr,{className:"text-xs text-muted-foreground",children:"Copy to clipboard"}),e.jsx(ur,{}),C.map(_=>e.jsx(rc,{onSelect:async()=>{await zr(_.value)?ie.success(`Copied ${_.label}`):ie.error("Clipboard is not available")},children:_.label},_.label))]})]})]})]}),e.jsxs(Kc,{value:l,onValueChange:c,className:"min-h-0 flex-1 gap-0",children:[e.jsx("div",{className:"border-b px-5 py-2",children:e.jsxs(Yc,{children:[e.jsx(ds,{value:"content",children:"Content"}),e.jsx(ds,{value:"details",children:"Details"}),e.jsxs(ds,{value:"history",children:["History",g.length>1?` (${g.length})`:""]})]})}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-4",children:[e.jsxs(us,{value:"content",className:"flex flex-col gap-4",children:[h&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 px-3 py-2 text-sm text-muted-foreground",children:["This version is ",e.jsx(fe,{k:"superseded",children:d.status}),d.superseded_reason?`: ${d.superseded_reason}`:".",d.superseded_by_id&&e.jsxs(e.Fragment,{children:[" ",e.jsx("button",{type:"button",className:"text-brand underline-offset-4 hover:underline",onClick:()=>De(d.superseded_by_id),children:"Open the replacement"})]})]}),e.jsx(Er,{content:d.content}),e.jsx(ad,{files:d.linked_files})]}),e.jsx(us,{value:"details",children:e.jsx(od,{memory:d,pinned:m})}),e.jsx(us,{value:"history",children:n.isLoading?e.jsx(ht,{className:"h-32 w-full"}):n.isError?e.jsx($e,{error:n.error,onRetry:()=>void n.refetch()}):e.jsx(id,{chain:g,currentId:d.id})})]})]})]})}function ad({files:t}){return e.jsxs("section",{"aria-labelledby":"linked-files-h",children:[e.jsxs("h3",{id:"linked-files-h",className:"mb-2 flex items-center gap-1.5 text-xs font-medium text-muted-foreground uppercase",children:[e.jsx(bl,{className:"size-3.5","aria-hidden":!0})," Linked files (",t.length,")"]}),t.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Project-wide: not linked to specific files."}):e.jsx("ul",{className:"flex flex-wrap gap-1.5",children:t.map(s=>e.jsx("li",{children:e.jsxs(te,{variant:"outline",className:"max-w-full font-mono text-[11px]",children:[e.jsx(Xn,{"aria-hidden":!0}),e.jsx("span",{className:"truncate",children:s})]})},s))})]})}function od({memory:t,pinned:s}){const n=[{label:"Module",value:e.jsx("span",{className:"font-mono",children:t.module})},{label:e.jsx(fe,{k:t.status==="staging"?"staging":t.status==="verified"?"verified":"superseded",children:"Status"}),value:e.jsx(Lt,{status:t.status})},{label:e.jsx(fe,{k:"reward",children:"Reward"}),value:e.jsx("span",{className:"font-mono",children:ts(t.reward_score)})},{label:e.jsx(fe,{k:"recall",children:"Recall count"}),value:e.jsx("span",{className:"font-mono",children:t.retrieval_count??0})},{label:e.jsx(fe,{k:"pinned",children:"Pinned"}),value:s?"Yes":"No"},{label:e.jsx(fe,{k:"embedding",children:"Embedded"}),value:t.embedded?"Yes":"No (keyword and graph recall only)"},{label:"Author",value:e.jsxs("span",{className:"font-mono",children:["@",t.agent_id||"default"]})},{label:"Created",value:e.jsx("span",{title:t.created_at,children:Ut(t.created_at)})},{label:"Valid until",value:t.valid_to?Ut(t.valid_to):"Current"},{label:"Last recalled",value:t.last_recalled_at?Ae(t.last_recalled_at):"Never"}],r=t.provenance;return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("dl",{className:"grid grid-cols-1 gap-x-6 gap-y-3 sm:grid-cols-2",children:n.map((a,o)=>e.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5 border-b pb-2",children:[e.jsx("dt",{className:"text-xs text-muted-foreground",children:a.label}),e.jsx("dd",{className:"text-sm break-words",children:a.value})]},o))}),e.jsxs("div",{className:b("rounded-lg border p-3",r?.verified?"border-success/40 bg-success-weak":"bg-muted/40"),children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[r?.verified?e.jsx(Ms,{className:"size-4 text-success","aria-hidden":!0}):e.jsx(Rl,{className:"size-4 text-muted-foreground","aria-hidden":!0}),e.jsx(fe,{k:"provenance",children:"Provenance"}),": ",r?r.verified?"signature verified":"not verified":"unknown"]}),r&&e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:r.reason}),t.provenance_hash&&e.jsx("code",{className:"mt-2 block font-mono text-[11px] break-all text-muted-foreground",children:t.provenance_hash})]})]})}function id({chain:t,currentId:s}){const n=Math.max(0,t.findIndex(c=>c.id===s)),[r,a]=p.useState(n);if(p.useEffect(()=>a(n),[n]),t.length<=1)return e.jsxs("div",{className:"rounded-lg border border-dashed p-6 text-center text-sm text-muted-foreground",children:[e.jsx(nl,{className:"mx-auto mb-2 size-5","aria-hidden":!0}),"No other versions. When an agent calls fastr_supersede on this memory, the old and new versions are linked here and you can diff them word by word. ",e.jsx(Oc,{k:"supersession",label:"supersession"})]});const o=t[r],l=r>0?t[r-1]:null;return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("ol",{className:"relative flex flex-col gap-1 border-l pl-4","aria-label":"Version chain, oldest first",children:t.map((c,d)=>e.jsxs("li",{className:"relative",children:[e.jsx("span",{"aria-hidden":!0,className:b("absolute top-3 -left-[21px] size-2.5 rounded-full border-2 border-background",c.valid_to?"bg-muted-foreground/50":"bg-success")}),e.jsxs("button",{type:"button",onClick:()=>a(d),"aria-current":d===r?"true":void 0,className:b("flex w-full flex-col items-start rounded-md px-2 py-1.5 text-left text-sm outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring/50",d===r&&"bg-accent"),children:[e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:"font-medium",children:["v",d+1]}),e.jsx("code",{className:"font-mono text-[11px] text-muted-foreground",children:c.id}),c.id===s&&e.jsx(te,{variant:"brand",className:"text-[10px]",children:"viewing"}),!c.valid_to&&e.jsx(te,{variant:"success",className:"text-[10px]",children:"current"})]}),e.jsxs("span",{className:"line-clamp-1 text-xs text-muted-foreground",children:[c.title," · ",Ae(c.created_at)]})]})]},c.id))}),e.jsxs("section",{className:"rounded-lg border p-3","aria-live":"polite",children:[e.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[e.jsx("h3",{className:"text-sm font-medium",children:l?`Changes in v${r+1} (vs v${r})`:`v${r+1} is the original version`}),o.id!==s&&e.jsxs(I,{size:"xs",variant:"outline",onClick:()=>De(o.id),children:["Open v",r+1]})]}),l?e.jsxs("div",{className:"flex flex-col gap-3",children:[l.title!==o.title&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-1 text-xs text-muted-foreground uppercase",children:"Title"}),e.jsx(fn,{before:l.title,after:o.title})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-1 text-xs text-muted-foreground uppercase",children:"Content"}),e.jsx(fn,{before:l.content,after:o.content})]}),l.superseded_reason&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Reason recorded: ",l.superseded_reason]})]}):e.jsx(Er,{content:o.content})]})]})}function ld(t){const s=t instanceof Error?t.message:String(t);return/dynamically imported module|Importing a module script failed|Failed to fetch|ChunkLoadError/i.test(s)}class cd extends p.Component{state={error:null};static getDerivedStateFromError(s){return{error:s}}componentDidUpdate(s){s.resetKey!==this.props.resetKey&&this.state.error&&this.setState({error:null})}render(){const{error:s}=this.state;if(!s)return this.props.children;const n=ld(s);return e.jsxs("div",{role:"alert",className:"flex flex-col items-center gap-3 rounded-xl border border-risk/40 bg-risk-weak px-6 py-12 text-center",children:[e.jsx(Jt,{className:"size-6 text-risk","aria-hidden":!0}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-medium",children:n?"The dashboard was updated":"This page crashed"}),e.jsx("p",{className:"mt-1 max-w-md text-sm text-muted-foreground",children:n?"Reload to get the new version.":s.message||"Unexpected error while rendering this page."})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(I,{size:"sm",onClick:()=>window.location.reload(),children:[e.jsx(yt,{"aria-hidden":!0})," Reload"]}),!n&&e.jsx(I,{size:"sm",variant:"outline",onClick:()=>this.setState({error:null}),children:"Try again"})]})]})}}function re({className:t,...s}){return e.jsx("div",{"data-slot":"card",className:b("flex flex-col gap-4 rounded-xl border bg-card py-5 text-card-foreground shadow-xs",t),...s})}function ce({className:t,...s}){return e.jsx("div",{"data-slot":"card-header",className:b("grid auto-rows-min grid-rows-[auto_auto] items-start gap-1 px-5 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-4",t),...s})}function de({className:t,...s}){return e.jsx("div",{"data-slot":"card-title",className:b("leading-none font-semibold",t),...s})}function Fe({className:t,...s}){return e.jsx("div",{"data-slot":"card-description",className:b("text-sm text-muted-foreground",t),...s})}function dd({className:t,...s}){return e.jsx("div",{"data-slot":"card-action",className:b("col-start-2 row-span-2 row-start-1 self-start justify-self-end",t),...s})}function ae({className:t,...s}){return e.jsx("div",{"data-slot":"card-content",className:b("px-5",t),...s})}function ud(t){return e.jsx(Na,{"data-slot":"alert-dialog",...t})}function md(t){return e.jsx(Ea,{"data-slot":"alert-dialog-portal",...t})}function hd({className:t,...s}){return e.jsx(Ta,{"data-slot":"alert-dialog-overlay",className:b("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s})}function fd({className:t,...s}){return e.jsxs(md,{children:[e.jsx(hd,{}),e.jsx(Ca,{"data-slot":"alert-dialog-content",className:b("fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:max-w-lg",t),...s})]})}function pd({className:t,...s}){return e.jsx("div",{"data-slot":"alert-dialog-header",className:b("flex flex-col gap-2 text-center sm:text-left",t),...s})}function xd({className:t,...s}){return e.jsx("div",{"data-slot":"alert-dialog-footer",className:b("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...s})}function gd({className:t,...s}){return e.jsx(_a,{"data-slot":"alert-dialog-title",className:b("text-lg font-semibold",t),...s})}function bd({className:t,...s}){return e.jsx(Sa,{"data-slot":"alert-dialog-description",className:b("text-sm text-muted-foreground",t),...s})}function yd({className:t,...s}){return e.jsx(za,{className:b(es(),t),...s})}function vd({className:t,...s}){return e.jsx(Ma,{className:b(es({variant:"outline"}),t),...s})}function jd({request:t,onOpenChange:s}){return e.jsx(ud,{open:t!==null,onOpenChange:s,children:e.jsxs(fd,{children:[e.jsxs(pd,{children:[e.jsx(gd,{children:t?.title}),e.jsx(bd,{asChild:!0,children:e.jsx("div",{children:t?.description})})]}),e.jsxs(xd,{children:[e.jsx(vd,{children:"Cancel"}),e.jsx(yd,{className:t?.destructive?es({variant:"destructive"}):void 0,onClick:()=>t?.onConfirm(),children:t?.confirmLabel})]})]})})}function Ar(){const[t,s]=p.useState(null);return{confirm:s,element:e.jsx(jd,{request:t,onOpenChange:r=>!r&&s(null)})}}function ms(t,s){return t?`"${t.title}"`:s}function $r({conflict:t,memoryA:s,memoryB:n,compact:r=!1,onResolved:a}){const{resolveConflict:o}=Ds(),{confirm:l,element:c}=Ar(),d=s??t.memory_a??null,u=n??t.memory_b??null,m=i=>{const h=i==="b"?t.memory_b_id:t.memory_a_id,g=i==="b"?d:u,C=i==="b"?t.memory_a_id:t.memory_b_id,_=i==="b"?u:d;l({title:i==="both"?"Keep both memories?":`Keep memory ${i.toUpperCase()}?`,description:i==="both"?e.jsxs(e.Fragment,{children:["Both stay active. The reward score of ",ms(u,t.memory_b_id)," drops by 0.4 so A ranks higher in recall."]}):e.jsxs(e.Fragment,{children:[ms(_,h)," stays active. ",ms(g,C)," is marked superseded by it and stops being recalled. You can undo for 6 seconds."]}),confirmLabel:i==="both"?"Keep both":`Keep ${i.toUpperCase()}`,destructive:i!=="both",onConfirm:()=>{o(t.id,h,i!=="both",i==="both"?`Kept both sides of conflict #${t.id}`:`Resolved conflict #${t.id} (kept ${i.toUpperCase()})`),a?.()}})};return e.jsxs("article",{className:b("rounded-xl border border-l-4 border-l-risk bg-card shadow-xs",r?"p-3":"p-4 sm:p-5"),children:[e.jsxs("header",{className:"mb-3 flex flex-wrap items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[e.jsxs(te,{variant:"risk",children:[e.jsx(Dt,{"aria-hidden":!0})," Conflict #",t.id]}),e.jsxs(te,{variant:"muted",className:"font-mono",children:[(t.score*100).toFixed(0),"% similar"]}),e.jsx("span",{className:"text-sm font-medium",children:t.reason})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{title:t.created_at,children:Ae(t.created_at)}),e.jsx(bt,{text:`# Conflict ${t.id}
325
+ `)})},"code-unclosed")),r},[t]);return e.jsx("div",{className:b("break-words",s),children:n})}const Xc=4e6;function hn(t){return t.match(/\s+|[^\s]+/g)??[]}function Qc(t,s){let n=0;for(;n<t.length&&n<s.length&&t[n]===s[n];)n++;let r=t.length,a=s.length;for(;r>n&&a>n&&t[r-1]===s[a-1];)r--,a--;const o=t.slice(0,n),l=t.slice(r),c=t.slice(n,r),d=s.slice(n,a),u=c.length,m=d.length,i=[],h=(g,C)=>{const S=i[i.length-1];S&&S.type===g?S.text+=C:i.push({type:g,text:C})};if(o.forEach(g=>h("same",g)),(u+1)*(m+1)>Xc)c.forEach(g=>h("removed",g)),d.forEach(g=>h("added",g));else{const g=Array.from({length:u+1},()=>new Uint32Array(m+1));for(let _=u-1;_>=0;_--)for(let y=m-1;y>=0;y--)g[_][y]=c[_]===d[y]?g[_+1][y+1]+1:Math.max(g[_+1][y],g[_][y+1]);let C=0,S=0;for(;C<u&&S<m;)c[C]===d[S]?(h("same",c[C]),C++,S++):g[C+1][S]>=g[C][S+1]?h("removed",c[C++]):h("added",d[S++]);for(;C<u;)h("removed",c[C++]);for(;S<m;)h("added",d[S++])}return l.forEach(g=>h("same",g)),i}function Tr(t,s){return Qc(hn(t??""),hn(s??""))}function Jc(t){let s=0,n=0;for(const r of t){const a=r.text.trim()?r.text.trim().split(/\s+/).length:0;r.type==="added"&&(s+=a),r.type==="removed"&&(n+=a)}return{added:s,removed:n}}const Zc="rounded-sm bg-success-weak text-success underline decoration-success/60 decoration-1 underline-offset-2",ed="rounded-sm bg-risk-weak text-risk line-through decoration-risk/70";function fn({before:t,after:s,className:n}){const r=p.useMemo(()=>Tr(t,s),[t,s]),a=p.useMemo(()=>Jc(r),[r]);return e.jsxs("div",{className:n,children:[e.jsxs("div",{className:"mb-2 flex gap-3 font-mono text-xs",children:[e.jsxs("span",{className:"text-success",children:["+",a.added," words"]}),e.jsxs("span",{className:"text-risk",children:["-",a.removed," words"]})]}),e.jsx("p",{className:"text-sm leading-relaxed whitespace-pre-wrap break-words",children:r.map((o,l)=>e.jsx(vs,{op:o},l))})]})}function vs({op:t}){return t.type==="same"?e.jsx("span",{children:t.text}):t.type==="added"?e.jsxs("ins",{className:Zc,children:[e.jsx("span",{className:"sr-only",children:"[added: "}),t.text,e.jsx("span",{className:"sr-only",children:"]"})]}):e.jsxs("del",{className:ed,children:[e.jsx("span",{className:"sr-only",children:"[removed: "}),t.text,e.jsx("span",{className:"sr-only",children:"]"})]})}function td({left:t,right:s,leftLabel:n,rightLabel:r}){const a=p.useMemo(()=>Tr(t,s),[t,s]);return e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsx(pn,{label:n,children:a.map((o,l)=>o.type==="added"?null:o.type==="removed"?e.jsx(vs,{op:o},l):e.jsx("span",{children:o.text},l))}),e.jsx(pn,{label:r,children:a.map((o,l)=>o.type==="removed"?null:o.type==="added"?e.jsx(vs,{op:o},l):e.jsx("span",{children:o.text},l))})]})}function pn({label:t,children:s,className:n}){return e.jsxs("div",{className:b("min-w-0 rounded-lg border bg-muted/40 p-3",n),children:[e.jsx("div",{className:"mb-2 text-xs font-medium text-muted-foreground",children:t}),e.jsx("p",{className:"text-sm leading-relaxed whitespace-pre-wrap break-words",children:s})]})}function Ds(){const t=p.useCallback((r,a)=>{if(r.length===0)return;const o=r.length===1?`${a?"Pinned":"Unpinned"} "${r[0].title}"`:`${a?"Pinned":"Unpinned"} ${Ne(r.length,"memory","memories")}`;ls({type:"pin",memoryIds:r.map(l=>l.id),pinned:a,label:o})},[]),s=p.useCallback(r=>{if(r.length===0)return;const a=r.length===1?`Forgot "${r[0].title}"`:`Forgot ${Ne(r.length,"memory","memories")}`;ls({type:"forget",memoryIds:r.map(o=>o.id),label:a})},[]),n=p.useCallback((r,a,o,l)=>{ls({type:"resolve",conflictId:r,keepMemoryId:a,forgetLoser:o,label:l})},[]);return{setPinned:t,forget:s,resolveConflict:n}}function sd(){const s=st().memoryId;return e.jsx(rr,{open:!!s,onOpenChange:n=>!n&&gr(),children:e.jsx(ar,{side:"right",className:"w-full gap-0 p-0 sm:max-w-2xl",children:s?e.jsx(rd,{id:s}):e.jsx(zt,{className:"sr-only",children:"Memory"})})})}function qt(t,s){return`${t} ${JSON.stringify(s)}`}function nd(t){return`"${t.replace(/(["\\$`])/g,"\\$1")}"`}function rd({id:t}){const s=kc(t),n=Nc(t),r=Lt(),{setPinned:a,forget:o}=Ds(),[l,c]=p.useState("content");if(p.useEffect(()=>c("content"),[t]),s.isLoading)return e.jsxs("div",{className:"flex flex-col gap-3 p-6","aria-busy":"true",children:[e.jsxs(zt,{className:"sr-only",children:["Loading memory ",t]}),e.jsx(ht,{className:"h-4 w-40"}),e.jsx(ht,{className:"h-7 w-3/4"}),e.jsx(ht,{className:"mt-4 h-40 w-full"})]});if(s.isError||!s.data)return e.jsxs("div",{className:"p-6",children:[e.jsxs(zt,{className:"mb-4",children:["Memory ",t]}),e.jsx($e,{error:s.error??"Not found",onRetry:()=>void s.refetch()})]});const d=s.data,m=wc(r,d.id)??!!d.pinned,i=jc(r,d.id),h=d.status==="superseded"||d.status==="dormant"||d.valid_to!==null,g=n.data?.chain??[],C=[{label:"Memory ID",value:d.id},{label:"Permalink",value:fc(d.id)},{label:"MCP: fastr_recall",value:qt("fastr_recall",{query:d.title,module:d.module})},{label:"MCP: fastr_feedback (good)",value:qt("fastr_feedback",{memoryId:d.id,outcome:"good"})},{label:"MCP: fastr_verify_provenance",value:qt("fastr_verify_provenance",{memoryId:d.id})},...d.linked_files.length?[{label:"MCP: fastr_trap_recall",value:qt("fastr_trap_recall",{files:d.linked_files})}]:[],{label:"CLI: fastrmemory recall",value:`fastrmemory recall ${nd(d.title)} -m ${d.module}`},{label:"Content (markdown)",value:d.content}];return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsxs(nc,{className:"gap-2 border-b px-5 pt-5 pb-4 pr-12",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("code",{className:"truncate font-mono text-xs text-brand",children:d.id}),e.jsx(bt,{text:d.id,description:"Copy memory ID",variant:"ghost"}),e.jsx(jt,{kind:d.kind}),e.jsx(Rt,{status:d.status}),m&&e.jsxs(te,{variant:"pinned",className:"text-[10px]",children:[e.jsx(Gt,{"aria-hidden":!0})," Pinned"]}),i&&e.jsx(te,{variant:"risk",className:"text-[10px]",children:"Forgetting..."})]}),e.jsx(zt,{className:"text-lg leading-snug",children:d.title}),e.jsxs(or,{children:[d.module," · recorded ",Ae(d.created_at)," by @",d.agent_id||"default"]}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-2",children:[e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>a([d],!m),disabled:h||i,children:[m?e.jsx(er,{"aria-hidden":!0}):e.jsx(Gt,{"aria-hidden":!0}),m?"Unpin":"Pin"]}),e.jsxs(I,{size:"sm",variant:"outline",className:"text-risk hover:text-risk",onClick:()=>{o([d]),gr()},disabled:h||i,children:[e.jsx(sr,{"aria-hidden":!0})," Forget"]}),e.jsxs(ir,{children:[e.jsx(lr,{asChild:!0,children:e.jsxs(I,{size:"sm",variant:"outline",children:[e.jsx(Bi,{"aria-hidden":!0})," Copy ",e.jsx(Cs,{"aria-hidden":!0,className:"opacity-60"})]})}),e.jsxs(cr,{align:"start",className:"w-64",children:[e.jsx(dr,{className:"text-xs text-muted-foreground",children:"Copy to clipboard"}),e.jsx(ur,{}),C.map(S=>e.jsx(rc,{onSelect:async()=>{await zr(S.value)?ie.success(`Copied ${S.label}`):ie.error("Clipboard is not available")},children:S.label},S.label))]})]})]})]}),e.jsxs(Kc,{value:l,onValueChange:c,className:"min-h-0 flex-1 gap-0",children:[e.jsx("div",{className:"border-b px-5 py-2",children:e.jsxs(Yc,{children:[e.jsx(ds,{value:"content",children:"Content"}),e.jsx(ds,{value:"details",children:"Details"}),e.jsxs(ds,{value:"history",children:["History",g.length>1?` (${g.length})`:""]})]})}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-4",children:[e.jsxs(us,{value:"content",className:"flex flex-col gap-4",children:[h&&e.jsxs("div",{className:"rounded-lg border bg-muted/50 px-3 py-2 text-sm text-muted-foreground",children:["This version is ",e.jsx(fe,{k:"superseded",children:d.status}),d.superseded_reason?`: ${d.superseded_reason}`:".",d.superseded_by_id&&e.jsxs(e.Fragment,{children:[" ",e.jsx("button",{type:"button",className:"text-brand underline-offset-4 hover:underline",onClick:()=>De(d.superseded_by_id),children:"Open the replacement"})]})]}),e.jsx(Er,{content:d.content}),e.jsx(ad,{files:d.linked_files})]}),e.jsx(us,{value:"details",children:e.jsx(od,{memory:d,pinned:m})}),e.jsx(us,{value:"history",children:n.isLoading?e.jsx(ht,{className:"h-32 w-full"}):n.isError?e.jsx($e,{error:n.error,onRetry:()=>void n.refetch()}):e.jsx(id,{chain:g,currentId:d.id})})]})]})]})}function ad({files:t}){return e.jsxs("section",{"aria-labelledby":"linked-files-h",children:[e.jsxs("h3",{id:"linked-files-h",className:"mb-2 flex items-center gap-1.5 text-xs font-medium text-muted-foreground uppercase",children:[e.jsx(bl,{className:"size-3.5","aria-hidden":!0})," Linked files (",t.length,")"]}),t.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Project-wide: not linked to specific files."}):e.jsx("ul",{className:"flex flex-wrap gap-1.5",children:t.map(s=>e.jsx("li",{children:e.jsxs(te,{variant:"outline",className:"max-w-full font-mono text-[11px]",children:[e.jsx(Xn,{"aria-hidden":!0}),e.jsx("span",{className:"truncate",children:s})]})},s))})]})}function od({memory:t,pinned:s}){const n=[{label:"Module",value:e.jsx("span",{className:"font-mono",children:t.module})},{label:e.jsx(fe,{k:t.status==="staging"?"staging":t.status==="verified"?"verified":"superseded",children:"Status"}),value:e.jsx(Rt,{status:t.status})},{label:e.jsx(fe,{k:"reward",children:"Reward"}),value:e.jsx("span",{className:"font-mono",children:ts(t.reward_score)})},{label:e.jsx(fe,{k:"recall",children:"Recall count"}),value:e.jsx("span",{className:"font-mono",children:t.retrieval_count??0})},{label:e.jsx(fe,{k:"pinned",children:"Pinned"}),value:s?"Yes":"No"},{label:e.jsx(fe,{k:"embedding",children:"Embedded"}),value:t.embedded?"Yes":"No (keyword and graph recall only)"},{label:"Author",value:e.jsxs("span",{className:"font-mono",children:["@",t.agent_id||"default"]})},{label:"Created",value:e.jsx("span",{title:t.created_at,children:Kt(t.created_at)})},{label:"Valid until",value:t.valid_to?Kt(t.valid_to):"Current"},{label:"Last recalled",value:t.last_recalled_at?Ae(t.last_recalled_at):"Never"}],r=t.provenance;return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("dl",{className:"grid grid-cols-1 gap-x-6 gap-y-3 sm:grid-cols-2",children:n.map((a,o)=>e.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5 border-b pb-2",children:[e.jsx("dt",{className:"text-xs text-muted-foreground",children:a.label}),e.jsx("dd",{className:"text-sm break-words",children:a.value})]},o))}),e.jsxs("div",{className:b("rounded-lg border p-3",r?.verified?"border-success/40 bg-success-weak":"bg-muted/40"),children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[r?.verified?e.jsx(Ms,{className:"size-4 text-success","aria-hidden":!0}):e.jsx(Rl,{className:"size-4 text-muted-foreground","aria-hidden":!0}),e.jsx(fe,{k:"provenance",children:"Provenance"}),": ",r?r.verified?"signature verified":"not verified":"unknown"]}),r&&e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:r.reason}),t.provenance_hash&&e.jsx("code",{className:"mt-2 block font-mono text-[11px] break-all text-muted-foreground",children:t.provenance_hash})]})]})}function id({chain:t,currentId:s}){const n=Math.max(0,t.findIndex(c=>c.id===s)),[r,a]=p.useState(n);if(p.useEffect(()=>a(n),[n]),t.length<=1)return e.jsxs("div",{className:"rounded-lg border border-dashed p-6 text-center text-sm text-muted-foreground",children:[e.jsx(nl,{className:"mx-auto mb-2 size-5","aria-hidden":!0}),"No other versions. When an agent calls fastr_supersede on this memory, the old and new versions are linked here and you can diff them word by word. ",e.jsx(Oc,{k:"supersession",label:"supersession"})]});const o=t[r],l=r>0?t[r-1]:null;return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("ol",{className:"relative flex flex-col gap-1 border-l pl-4","aria-label":"Version chain, oldest first",children:t.map((c,d)=>e.jsxs("li",{className:"relative",children:[e.jsx("span",{"aria-hidden":!0,className:b("absolute top-3 -left-[21px] size-2.5 rounded-full border-2 border-background",c.valid_to?"bg-muted-foreground/50":"bg-success")}),e.jsxs("button",{type:"button",onClick:()=>a(d),"aria-current":d===r?"true":void 0,className:b("flex w-full flex-col items-start rounded-md px-2 py-1.5 text-left text-sm outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring/50",d===r&&"bg-accent"),children:[e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:"font-medium",children:["v",d+1]}),e.jsx("code",{className:"font-mono text-[11px] text-muted-foreground",children:c.id}),c.id===s&&e.jsx(te,{variant:"brand",className:"text-[10px]",children:"viewing"}),!c.valid_to&&e.jsx(te,{variant:"success",className:"text-[10px]",children:"current"})]}),e.jsxs("span",{className:"line-clamp-1 text-xs text-muted-foreground",children:[c.title," · ",Ae(c.created_at)]})]})]},c.id))}),e.jsxs("section",{className:"rounded-lg border p-3","aria-live":"polite",children:[e.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[e.jsx("h3",{className:"text-sm font-medium",children:l?`Changes in v${r+1} (vs v${r})`:`v${r+1} is the original version`}),o.id!==s&&e.jsxs(I,{size:"xs",variant:"outline",onClick:()=>De(o.id),children:["Open v",r+1]})]}),l?e.jsxs("div",{className:"flex flex-col gap-3",children:[l.title!==o.title&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-1 text-xs text-muted-foreground uppercase",children:"Title"}),e.jsx(fn,{before:l.title,after:o.title})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-1 text-xs text-muted-foreground uppercase",children:"Content"}),e.jsx(fn,{before:l.content,after:o.content})]}),l.superseded_reason&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Reason recorded: ",l.superseded_reason]})]}):e.jsx(Er,{content:o.content})]})]})}function ld(t){const s=t instanceof Error?t.message:String(t);return/dynamically imported module|Importing a module script failed|Failed to fetch|ChunkLoadError/i.test(s)}class cd extends p.Component{state={error:null};static getDerivedStateFromError(s){return{error:s}}componentDidUpdate(s){s.resetKey!==this.props.resetKey&&this.state.error&&this.setState({error:null})}render(){const{error:s}=this.state;if(!s)return this.props.children;const n=ld(s);return e.jsxs("div",{role:"alert",className:"flex flex-col items-center gap-3 rounded-xl border border-risk/40 bg-risk-weak px-6 py-12 text-center",children:[e.jsx(It,{className:"size-6 text-risk","aria-hidden":!0}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-medium",children:n?"The dashboard was updated":"This page crashed"}),e.jsx("p",{className:"mt-1 max-w-md text-sm text-muted-foreground",children:n?"Reload to get the new version.":s.message||"Unexpected error while rendering this page."})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(I,{size:"sm",onClick:()=>window.location.reload(),children:[e.jsx(yt,{"aria-hidden":!0})," Reload"]}),!n&&e.jsx(I,{size:"sm",variant:"outline",onClick:()=>this.setState({error:null}),children:"Try again"})]})]})}}function re({className:t,...s}){return e.jsx("div",{"data-slot":"card",className:b("flex flex-col gap-4 rounded-xl border bg-card py-5 text-card-foreground shadow-xs",t),...s})}function ce({className:t,...s}){return e.jsx("div",{"data-slot":"card-header",className:b("grid auto-rows-min grid-rows-[auto_auto] items-start gap-1 px-5 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-4",t),...s})}function de({className:t,...s}){return e.jsx("div",{"data-slot":"card-title",className:b("leading-none font-semibold",t),...s})}function Fe({className:t,...s}){return e.jsx("div",{"data-slot":"card-description",className:b("text-sm text-muted-foreground",t),...s})}function dd({className:t,...s}){return e.jsx("div",{"data-slot":"card-action",className:b("col-start-2 row-span-2 row-start-1 self-start justify-self-end",t),...s})}function ae({className:t,...s}){return e.jsx("div",{"data-slot":"card-content",className:b("px-5",t),...s})}function ud(t){return e.jsx(Na,{"data-slot":"alert-dialog",...t})}function md(t){return e.jsx(Ea,{"data-slot":"alert-dialog-portal",...t})}function hd({className:t,...s}){return e.jsx(Ta,{"data-slot":"alert-dialog-overlay",className:b("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s})}function fd({className:t,...s}){return e.jsxs(md,{children:[e.jsx(hd,{}),e.jsx(Ca,{"data-slot":"alert-dialog-content",className:b("fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:max-w-lg",t),...s})]})}function pd({className:t,...s}){return e.jsx("div",{"data-slot":"alert-dialog-header",className:b("flex flex-col gap-2 text-center sm:text-left",t),...s})}function xd({className:t,...s}){return e.jsx("div",{"data-slot":"alert-dialog-footer",className:b("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...s})}function gd({className:t,...s}){return e.jsx(Sa,{"data-slot":"alert-dialog-title",className:b("text-lg font-semibold",t),...s})}function bd({className:t,...s}){return e.jsx(_a,{"data-slot":"alert-dialog-description",className:b("text-sm text-muted-foreground",t),...s})}function yd({className:t,...s}){return e.jsx(za,{className:b(es(),t),...s})}function vd({className:t,...s}){return e.jsx(Ma,{className:b(es({variant:"outline"}),t),...s})}function jd({request:t,onOpenChange:s}){return e.jsx(ud,{open:t!==null,onOpenChange:s,children:e.jsxs(fd,{children:[e.jsxs(pd,{children:[e.jsx(gd,{children:t?.title}),e.jsx(bd,{asChild:!0,children:e.jsx("div",{children:t?.description})})]}),e.jsxs(xd,{children:[e.jsx(vd,{children:"Cancel"}),e.jsx(yd,{className:t?.destructive?es({variant:"destructive"}):void 0,onClick:()=>t?.onConfirm(),children:t?.confirmLabel})]})]})})}function Ar(){const[t,s]=p.useState(null);return{confirm:s,element:e.jsx(jd,{request:t,onOpenChange:r=>!r&&s(null)})}}function ms(t,s){return t?`"${t.title}"`:s}function $r({conflict:t,memoryA:s,memoryB:n,compact:r=!1,onResolved:a}){const{resolveConflict:o}=Ds(),{confirm:l,element:c}=Ar(),d=s??t.memory_a??null,u=n??t.memory_b??null,m=i=>{const h=i==="b"?t.memory_b_id:t.memory_a_id,g=i==="b"?d:u,C=i==="b"?t.memory_a_id:t.memory_b_id,S=i==="b"?u:d;l({title:i==="both"?"Keep both memories?":`Keep memory ${i.toUpperCase()}?`,description:i==="both"?e.jsxs(e.Fragment,{children:["Both stay active. The reward score of ",ms(u,t.memory_b_id)," drops by 0.4 so A ranks higher in recall."]}):e.jsxs(e.Fragment,{children:[ms(S,h)," stays active. ",ms(g,C)," is marked superseded by it and stops being recalled. You can undo for 6 seconds."]}),confirmLabel:i==="both"?"Keep both":`Keep ${i.toUpperCase()}`,destructive:i!=="both",onConfirm:()=>{o(t.id,h,i!=="both",i==="both"?`Kept both sides of conflict #${t.id}`:`Resolved conflict #${t.id} (kept ${i.toUpperCase()})`),a?.()}})};return e.jsxs("article",{className:b("rounded-xl border border-l-4 border-l-risk bg-card shadow-xs",r?"p-3":"p-4 sm:p-5"),children:[e.jsxs("header",{className:"mb-3 flex flex-wrap items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[e.jsxs(te,{variant:"risk",children:[e.jsx(Dt,{"aria-hidden":!0})," Conflict #",t.id]}),e.jsxs(te,{variant:"muted",className:"font-mono",children:[(t.score*100).toFixed(0),"% similar"]}),e.jsx("span",{className:"text-sm font-medium",children:t.reason})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{title:t.created_at,children:Ae(t.created_at)}),e.jsx(bt,{text:`# Conflict ${t.id}
326
326
  Memory A: ${t.memory_a_id}
327
327
  Memory B: ${t.memory_b_id}
328
- Reason: ${t.reason}`,description:"Copy conflict report",variant:"ghost"})]})]}),e.jsx(td,{left:d?.content??"(memory A is no longer available)",right:u?.content??"(memory B is no longer available)",leftLabel:e.jsx(xn,{side:"A",id:t.memory_a_id,memory:d}),rightLabel:e.jsx(xn,{side:"B",id:t.memory_b_id,memory:u})}),e.jsxs("footer",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(I,{size:"sm",onClick:()=>m("a"),children:[e.jsx(Et,{"aria-hidden":!0})," Keep A"]}),e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>m("b"),children:[e.jsx(Et,{"aria-hidden":!0})," Keep B"]}),e.jsxs(I,{size:"sm",variant:"ghost",onClick:()=>m("both"),children:[e.jsx(Bl,{"aria-hidden":!0})," Keep both"]})]}),c]})}function xn({side:t,id:s,memory:n}){return e.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:"font-semibold text-foreground",children:t}),e.jsx("button",{type:"button",onClick:()=>De(s),className:"min-w-0 truncate text-left text-foreground underline-offset-4 outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring/50",children:n?.title??s}),e.jsx("code",{className:"font-mono text-[10px]",children:s})]})}function gn({m:t,right:s}){return e.jsxs("button",{type:"button",onClick:()=>De(t.id),className:"flex w-full min-w-0 items-center gap-3 rounded-md px-2 py-2 text-left outline-none hover:bg-accent/60 focus-visible:ring-2 focus-visible:ring-ring/50",children:[e.jsx(jt,{kind:t.kind}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:t.title}),s]})}function wd(){const t=vt(),s=jr(),n=_c(12),r=kr(),a=t.data,o=(s.data??[]).filter(c=>c.status==="staging").slice(0,6),l=[...s.data??[]].filter(c=>c.reward_score<1).sort((c,d)=>c.reward_score-d.reward_score).slice(0,5);return e.jsxs("div",{children:[e.jsx(Ye,{icon:Jn,title:a?a.projectName:"Home",description:"What your agents have learned in this project, what needs review, and what changed recently."}),t.isError?e.jsx($e,{error:t.error,onRetry:()=>t.refetch(),className:"mb-6"}):e.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-3 lg:grid-cols-4",children:[e.jsx(ke,{loading:t.isLoading,label:"Active memories",value:a?.activeCount??0,hint:a?`${a.status.stagingCount} staging · ${a.modulesCount} modules`:void 0,onClick:()=>le("memories")}),e.jsx(ke,{loading:t.isLoading,label:"Error traps",value:a?.trapsCount??0,tone:a&&a.trapsCount>0?"trap":"default",hint:"2.0x recall boost",onClick:()=>le("traps")}),e.jsx(ke,{loading:t.isLoading,label:"Open conflicts",value:a?.conflictsCount??0,tone:a&&a.conflictsCount>0?"risk":"success",hint:a&&a.conflictsCount===0?"All rules consistent":"Needs a decision",onClick:()=>le("conflicts")}),e.jsx(ke,{loading:t.isLoading,label:"Ready tasks",value:a?.frontierCount??0,tone:"brand",hint:a?`${a.actionsCount} actions total`:void 0,onClick:()=>le("actions")})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-5",children:[e.jsxs(re,{className:"min-w-0 lg:col-span-3",children:[e.jsxs(ce,{children:[e.jsxs(de,{className:"flex items-center gap-2",children:[e.jsx(Vi,{className:"size-4 text-muted-foreground","aria-hidden":!0})," Recent activity"]}),e.jsx(Fe,{children:"Newest memories, traps and supersessions."})]}),e.jsx(ae,{children:n.isLoading?e.jsx(Te,{rows:6}):n.isError?e.jsx($e,{error:n.error,onRetry:()=>n.refetch()}):(n.data??[]).length===0?e.jsxs(Ue,{icon:Ol,title:"No memories yet",children:["Agents add memories through ",e.jsx("code",{className:"font-mono",children:"fastr_remember"})," and"," ",e.jsx("code",{className:"font-mono",children:"fastr_trap_log"}),", or you can add one with ",e.jsx("b",{children:"New memory"}),"."]}):e.jsx("ol",{className:"flex flex-col",children:(n.data??[]).map(c=>e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>De(c.id),className:"flex w-full min-w-0 items-center gap-3 rounded-md px-2 py-2 text-left outline-none hover:bg-accent/60 focus-visible:ring-2 focus-visible:ring-ring/50",children:[e.jsx(jt,{kind:c.kind}),e.jsx("span",{className:`min-w-0 flex-1 truncate text-sm ${c.status==="superseded"?"text-muted-foreground line-through":""}`,children:c.title}),e.jsx("span",{className:"hidden font-mono text-[11px] text-muted-foreground sm:inline",children:c.module}),e.jsx("span",{className:"shrink-0 text-right text-xs whitespace-nowrap text-muted-foreground",children:Ae(c.createdAt)})]})},c.id))})})]}),e.jsxs("div",{className:"flex min-w-0 flex-col gap-4 lg:col-span-2",children:[e.jsxs(re,{children:[e.jsxs(ce,{children:[e.jsxs(de,{className:"flex items-center gap-2",children:[e.jsx(ul,{className:"size-4 text-muted-foreground","aria-hidden":!0})," Awaiting verification"]}),e.jsxs(Fe,{children:[e.jsx(fe,{k:"staging",children:"Staging"})," memories agents recorded but nobody confirmed yet."]}),e.jsx(dd,{children:e.jsx(I,{variant:"ghost",size:"xs",asChild:!0,children:e.jsxs("a",{href:gt("memories",null,{status:"staging"}),children:["All ",e.jsx(tn,{"aria-hidden":!0})]})})})]}),e.jsx(ae,{children:s.isLoading?e.jsx(Te,{rows:3}):o.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Nothing waiting. Every recorded memory is verified."}):o.map(c=>e.jsx(gn,{m:c,right:e.jsx(Lt,{status:c.status})},c.id))})]}),e.jsxs(re,{children:[e.jsxs(ce,{children:[e.jsxs(de,{className:"flex items-center gap-2",children:[e.jsx(Kl,{className:"size-4 text-muted-foreground","aria-hidden":!0})," Low reward"]}),e.jsxs(Fe,{children:["Memories agents rated as unhelpful (",e.jsx(fe,{k:"reward",children:"reward"})," below 1.0x)."]})]}),e.jsx(ae,{children:s.isLoading?e.jsx(Te,{rows:3}):l.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No memory has negative feedback."}):l.map(c=>e.jsx(gn,{m:c,right:e.jsx("span",{className:"font-mono text-xs text-risk tabular-nums",children:ts(c.reward_score)})},c.id))})]})]})]}),(r.data??[]).length>0&&e.jsxs("section",{className:"mt-6","aria-labelledby":"home-conflicts",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxs("h2",{id:"home-conflicts",className:"flex items-center gap-2 font-semibold",children:[e.jsx(Qt,{className:"size-4 text-risk","aria-hidden":!0})," Open conflicts"]}),e.jsx(I,{variant:"ghost",size:"xs",asChild:!0,children:e.jsxs("a",{href:gt("conflicts"),children:["All conflicts ",e.jsx(tn,{"aria-hidden":!0})]})})]}),e.jsx("div",{className:"grid gap-3",children:(r.data??[]).slice(0,2).map(c=>e.jsx($r,{conflict:c,compact:!0},c.id))})]})]})}function js({className:t,...s}){return e.jsx(Aa,{"data-slot":"checkbox",className:b("peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground dark:bg-input/30 dark:data-[state=checked]:bg-primary dark:data-[state=indeterminate]:bg-primary",t),...s,children:e.jsx($a,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current",children:s.checked==="indeterminate"?e.jsx(kl,{className:"size-3.5"}):e.jsx(Et,{className:"size-3.5"})})})}const ve="__all",_t=52,bn=200;function kd(t,s,n){if(s==="relevance")return[...t].sort((o,l)=>l.pinned-o.pinned||(l.score??0)-(o.score??0)||l.created_at.localeCompare(o.created_at));const r=n==="asc"?1:-1,a=o=>{switch(s){case"title":return o.title.toLowerCase();case"module":return o.module.toLowerCase();case"reward":return o.reward_score;case"recalls":return o.retrieval_count;case"created":return o.created_at}};return[...t].sort((o,l)=>{const c=a(o),d=a(l);return(c<d?-1:c>d?1:0)*r})}function St({label:t,k:s,sort:n,onSort:r,className:a}){const o=n.key===s,l=o?n.dir==="asc"?Ci:bi:ji;return e.jsxs("button",{type:"button",onClick:()=>r(s),"aria-label":`Sort by ${t}`,"aria-pressed":o,className:b("inline-flex items-center gap-1 rounded-sm outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50",o&&"text-foreground",a),children:[t,e.jsx(l,{className:"size-3","aria-hidden":!0})]})}function Nd(){const t=st(),s=vt(),n=t.query.get("q")??"",r=t.query.get("kind")??"",a=t.query.get("module")??"",o=t.query.get("status")??"",l=t.query.get("pinned")??"",[c,d]=p.useState(n),u=As(c.trim(),250),[m,i]=p.useState({key:"relevance",dir:"desc"}),[h,g]=p.useState(new Set),{setPinned:C,forget:_}=Ds(),{confirm:S,element:y}=Ar(),F=p.useCallback(f=>{const M=Object.fromEntries(t.query);for(const[O,R]of Object.entries(f))R?M[O]=R:delete M[O];le("memories",t.name==="memories"?t.id:null,M)},[t]);p.useEffect(()=>{u!==n&&F({q:u})},[u]);const L=wr({q:n,kind:r,module:a,status:o,pinned:l,limit:2e3}),B=p.useMemo(()=>kd(L.data?.results??[],m.key,m.dir),[L.data,m]);p.useEffect(()=>{g(f=>{const M=new Set(B.map(R=>R.id)),O=new Set([...f].filter(R=>M.has(R)));return O.size===f.size?f:O})},[B]);const U=f=>i(M=>M.key===f?{key:f,dir:M.dir==="asc"?"desc":"asc"}:{key:f,dir:f==="title"||f==="module"?"asc":"desc"}),W=B.filter(f=>h.has(f.id)),V=B.length>0&&h.size===B.length,j=f=>g(M=>{const O=new Set(M);return O.has(f)?O.delete(f):O.add(f),O}),q=p.useRef(null),[ge,ue]=p.useState({start:0,end:bn}),K=B.length>bn;p.useEffect(()=>{const f=q.current;if(!f||!K)return;const M=()=>{const O=Math.max(0,Math.floor(f.scrollTop/_t)-10),R=Math.min(B.length,O+Math.ceil(f.clientHeight/_t)+20);ue(k=>k.start===O&&k.end===R?k:{start:O,end:R})};return M(),f.addEventListener("scroll",M,{passive:!0}),window.addEventListener("resize",M),()=>{f.removeEventListener("scroll",M),window.removeEventListener("resize",M)}},[K,B.length]);const T=K?B.slice(ge.start,ge.end):B,H=!!(n||r||a||o||l),Y=s.data?.modules??[];return e.jsxs("div",{children:[y,e.jsx(Ye,{icon:ps,title:"Memories",description:"Rules, decisions, workflows and error traps your agents recall. Search uses the same hybrid ranking agents get from fastr_recall."}),e.jsxs("div",{className:"mb-3 flex flex-col gap-2 lg:flex-row lg:items-center",children:[e.jsxs("div",{className:"relative min-w-0 flex-1",children:[e.jsx(xt,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground","aria-hidden":!0}),e.jsx(We,{value:c,onChange:f=>d(f.target.value),placeholder:"Search titles, content, files…","aria-label":"Search memories",className:"pl-9"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:flex",children:[e.jsxs(ct,{value:r||ve,onValueChange:f=>F({kind:f===ve?"":f}),children:[e.jsx(ut,{className:"w-full sm:w-36","aria-label":"Filter by kind",children:e.jsx(dt,{})}),e.jsxs(mt,{children:[e.jsx(G,{value:ve,children:"All kinds"}),e.jsx(G,{value:"rule",children:"Rules"}),e.jsx(G,{value:"error_trap",children:"Traps"}),e.jsx(G,{value:"decision",children:"Decisions"}),e.jsx(G,{value:"workflow",children:"Workflows"})]})]}),e.jsxs(ct,{value:a||ve,onValueChange:f=>F({module:f===ve?"":f}),children:[e.jsx(ut,{className:"w-full sm:w-40","aria-label":"Filter by module",children:e.jsx(dt,{})}),e.jsxs(mt,{children:[e.jsx(G,{value:ve,children:"All modules"}),Y.map(f=>e.jsx(G,{value:f,children:f},f))]})]}),e.jsxs(ct,{value:o||ve,onValueChange:f=>F({status:f===ve?"":f}),children:[e.jsx(ut,{className:"w-full sm:w-36","aria-label":"Filter by status",children:e.jsx(dt,{})}),e.jsxs(mt,{children:[e.jsx(G,{value:ve,children:"Active"}),e.jsx(G,{value:"verified",children:"Verified"}),e.jsx(G,{value:"staging",children:"Staging"}),e.jsx(G,{value:"superseded",children:"Superseded"}),e.jsx(G,{value:"dormant",children:"Dormant"})]})]}),e.jsxs(ct,{value:l||ve,onValueChange:f=>F({pinned:f===ve?"":f}),children:[e.jsx(ut,{className:"w-full sm:w-32","aria-label":"Filter by pinned",children:e.jsx(dt,{})}),e.jsxs(mt,{children:[e.jsx(G,{value:ve,children:"Any pin"}),e.jsx(G,{value:"1",children:"Pinned"}),e.jsx(G,{value:"0",children:"Not pinned"})]})]})]})]}),e.jsx("div",{className:"mb-2 flex min-h-8 flex-wrap items-center gap-2 text-sm text-muted-foreground",children:h.size>0?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"font-medium text-foreground",children:[h.size," selected"]}),e.jsxs(I,{size:"xs",variant:"outline",onClick:()=>C(W,!0),children:[e.jsx(Wt,{"aria-hidden":!0})," Pin"]}),e.jsxs(I,{size:"xs",variant:"outline",onClick:()=>C(W,!1),children:[e.jsx(er,{"aria-hidden":!0})," Unpin"]}),e.jsxs(I,{size:"xs",variant:"outline",className:"text-risk",onClick:()=>S({title:`Forget ${Ne(W.length,"memory","memories")}?`,description:"They stop being recalled by agents and move to history (superseded). You can undo for 6 seconds.",confirmLabel:"Forget",destructive:!0,onConfirm:()=>{_(W),g(new Set)}}),children:[e.jsx(sr,{"aria-hidden":!0})," Forget"]}),e.jsx(I,{size:"xs",variant:"ghost",onClick:()=>g(new Set),children:"Clear selection"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("span",{"aria-live":"polite",children:[L.isPlaceholderData&&L.isFetching?"Searching… · ":"",L.data?Ne(L.data.total,"memory","memories"):"…",L.data&&L.data.mode==="search"?` matching "${L.data.query}"`:"",L.data?` · ${L.data.tookMs} ms`:""]}),H&&e.jsxs(I,{size:"xs",variant:"ghost",onClick:()=>{d(""),le("memories",t.id,{})},children:[e.jsx(Zt,{"aria-hidden":!0})," Clear filters"]})]})}),L.isLoading?e.jsx(Te,{rows:8}):L.isError?e.jsx($e,{error:L.error,onRetry:()=>L.refetch()}):B.length===0?e.jsx(Ue,{icon:H?xt:ps,title:H?"No memories match":"No memories yet",action:H?e.jsx(I,{variant:"outline",size:"sm",onClick:()=>{d(""),le("memories",null,{})},children:"Clear filters"}):void 0,children:H?"Try fewer words or remove a filter. Search matches whole words in titles, content and modules.":"Agents record memories with fastr_remember and fastr_trap_log. You can also add one with New memory."}):e.jsxs("div",{className:b("overflow-hidden rounded-xl border bg-card transition-opacity",L.isPlaceholderData&&L.isFetching&&"opacity-60"),"aria-busy":L.isFetching,children:[e.jsxs("div",{role:"row",className:"grid grid-cols-[2rem_minmax(0,1fr)_5.5rem] items-center gap-3 border-b bg-muted/40 px-3 py-2 text-xs font-medium text-muted-foreground md:grid-cols-[2rem_minmax(0,1fr)_8rem_6rem_5rem_4.5rem_6.5rem]",children:[e.jsx(js,{checked:V?!0:h.size>0?"indeterminate":!1,onCheckedChange:f=>g(f?new Set(B.map(M=>M.id)):new Set),"aria-label":"Select all memories"}),e.jsx(St,{label:m.key==="relevance"&&n?"Title (by relevance)":"Title",k:"title",sort:m,onSort:U}),e.jsx(St,{label:"Module",k:"module",sort:m,onSort:U,className:"hidden md:inline-flex"}),e.jsx("span",{className:"hidden md:block",children:"Status"}),e.jsx(St,{label:"Reward",k:"reward",sort:m,onSort:U,className:"hidden md:inline-flex"}),e.jsx(St,{label:"Recalls",k:"recalls",sort:m,onSort:U,className:"hidden md:inline-flex"}),e.jsx(St,{label:"Created",k:"created",sort:m,onSort:U,className:"justify-self-end"})]}),e.jsx("div",{ref:q,className:b(K&&"max-h-[70vh] overflow-y-auto"),children:e.jsx("ul",{style:K?{height:B.length*_t,position:"relative"}:void 0,children:T.map((f,M)=>e.jsxs("li",{style:K?{position:"absolute",top:(ge.start+M)*_t,left:0,right:0,height:_t}:void 0,className:b("grid grid-cols-[2rem_minmax(0,1fr)_5.5rem] items-center gap-3 border-b px-3 py-2.5 text-sm last:border-b-0 md:grid-cols-[2rem_minmax(0,1fr)_8rem_6rem_5rem_4.5rem_6.5rem]",h.has(f.id)&&"bg-accent/50",f.kind==="error_trap"&&"border-l-2 border-l-trap"),children:[e.jsx(js,{checked:h.has(f.id),onCheckedChange:()=>j(f.id),"aria-label":`Select ${f.title}`}),e.jsxs("button",{type:"button",onClick:()=>De(f.id),className:"flex min-w-0 items-center gap-2 rounded-sm text-left outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:[e.jsx(jt,{kind:f.kind,className:"shrink-0"}),f.pinned?e.jsx(Wt,{className:"size-3.5 shrink-0 text-pinned","aria-label":"Pinned"}):null,e.jsx("span",{className:"truncate font-medium hover:underline",children:f.title})]}),e.jsx("span",{className:"hidden truncate font-mono text-xs text-muted-foreground md:block",children:f.module}),e.jsx("span",{className:"hidden md:block",children:e.jsx(Lt,{status:f.status})}),e.jsx("span",{className:b("hidden font-mono text-xs tabular-nums md:block",f.reward_score<1?"text-risk":"text-muted-foreground"),children:ts(f.reward_score)}),e.jsx("span",{className:"hidden font-mono text-xs text-muted-foreground tabular-nums md:block",children:f.retrieval_count}),e.jsx("span",{className:"justify-self-end text-xs whitespace-nowrap text-muted-foreground",children:Ae(f.created_at)})]},f.id))})})]})]})}const Mt="(not linked to a file)";function Cd({t}){return e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>De(t.id),className:"flex w-full min-w-0 flex-col gap-1 rounded-md px-3 py-2.5 text-left outline-none hover:bg-accent/60 focus-visible:ring-2 focus-visible:ring-ring/50",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(Dt,{className:"size-4 shrink-0 text-trap","aria-hidden":!0}),e.jsx("span",{className:"truncate text-sm font-medium",children:t.title}),e.jsx("span",{className:"ml-auto shrink-0",children:e.jsx(Lt,{status:t.status})})]}),e.jsx("span",{className:"line-clamp-2 pl-6 text-xs text-muted-foreground",children:t.content}),e.jsxs("span",{className:"pl-6 font-mono text-[11px] text-muted-foreground",children:[t.module," · reward ",ts(t.reward_score)," · ",Ae(t.created_at)]})]})})}function _d(){const s=st().query.get("files")??"",n=p.useMemo(()=>s.split(",").map(i=>i.trim()).filter(Boolean),[s]),[r,a]=p.useState(s.replace(/,/g,`
329
- `)),[o,l]=p.useState(!1),c=Cc(n),d=p.useMemo(()=>{const i=new Map;for(const h of c.data?.traps??[]){const g=n.length>0?h.matched_files.length?h.matched_files:[Mt]:h.linked_files.length?h.linked_files:[Mt];for(const C of g){const _=i.get(C)??[];_.push(h),i.set(C,_)}}return[...i.entries()].sort((h,g)=>h[0]===Mt?1:g[0]===Mt?-1:g[1].length-h[1].length||h[0].localeCompare(g[0]))},[c.data,n]),u=i=>{i.preventDefault();const h=r.split(/[\n,]/).map(g=>g.trim()).filter(Boolean);le("traps",null,{files:h.join(",")})},m=c.data?.traps.length??0;return e.jsxs("div",{children:[e.jsx(Nr,{open:o,onOpenChange:l,defaultKind:"error_trap"}),e.jsx(Ye,{icon:Dt,title:"Error traps",description:e.jsxs(e.Fragment,{children:["Bugs agents already hit and how they were fixed. ",e.jsx(fe,{k:"trap",children:"Traps"})," are checked before an agent edits a linked file (fastr_trap_recall and the PreToolUse hook)."]}),actions:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>l(!0),children:[e.jsx(Ss,{"aria-hidden":!0})," Log a trap"]})}),e.jsxs(re,{className:"mb-5",children:[e.jsxs(ce,{children:[e.jsxs(de,{className:"flex items-center gap-2 text-base",children:[e.jsx(el,{className:"size-4 text-muted-foreground","aria-hidden":!0})," Check files before editing"]}),e.jsx(Fe,{children:"The same lookup an agent runs before it edits these files. One path per line, relative to the project root."})]}),e.jsxs(ae,{children:[e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(We,{value:r,onChange:i=>a(i.target.value),placeholder:"src/auth/jwt.ts, src/db/schema.ts","aria-label":"Files to check",className:"font-mono"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(I,{type:"submit",children:"Check"}),n.length>0&&e.jsxs(I,{type:"button",variant:"ghost",onClick:()=>{a(""),le("traps")},children:[e.jsx(Zt,{"aria-hidden":!0})," Show all"]})]})]}),n.length>0&&c.data&&e.jsx("p",{className:`mt-3 text-sm ${m>0?"text-trap":"text-success"}`,role:"status",children:m>0?`${Ne(m,"trap")} protect ${Ne(n.length,"file")}. Read them before editing.`:`No active traps for ${Ne(n.length,"file")}. Safe to edit.`})]})]}),c.isLoading||c.isFetching&&m===0?e.jsx(Te,{rows:6}):c.isError?e.jsx($e,{error:c.error,onRetry:()=>c.refetch()}):m===0?e.jsx(Ue,{icon:Ms,title:n.length?"No traps for these files":"No error traps yet",children:n.length?"Nothing recorded for these paths. Paths must match how traps were linked (project-relative, forward slashes).":"When an agent diagnoses a bug it calls fastr_trap_log, and the lesson shows up here with the files it protects."}):e.jsx("div",{className:"grid gap-4 lg:grid-cols-2",children:d.map(([i,h])=>e.jsxs(re,{className:"min-w-0 gap-2 py-4",children:[e.jsx(ce,{className:"px-4",children:e.jsxs(de,{className:"flex min-w-0 items-center gap-2 text-sm",children:[e.jsx(Xn,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),e.jsx("span",{className:`truncate font-mono ${i===Mt?"text-muted-foreground italic":""}`,children:i}),e.jsx("span",{className:"ml-auto shrink-0 font-mono text-xs text-trap",children:h.length})]})}),e.jsx(ae,{className:"px-1",children:e.jsx("ul",{children:h.map(g=>e.jsx(Cd,{t:g},`${i}-${g.id}`))})})]},i))})]})}function Sd(){const t=kr(),s=t.data??[];return e.jsxs("div",{children:[e.jsx(Ye,{icon:Qt,title:"Conflicts",description:e.jsxs(e.Fragment,{children:["Pairs of active memories that contradict each other. Agents may follow either one until you decide."," ",e.jsx(fe,{k:"conflict",children:"How resolution works"})]})}),t.isLoading||t.isFetching&&s.length===0?e.jsx(Te,{rows:4}):t.isError?e.jsx($e,{error:t.error,onRetry:()=>t.refetch()}):s.length===0?e.jsx(Ue,{icon:Ms,title:"No open conflicts",children:"FastrMemory compares each new memory with recent ones in the same module. Contradictions show up here with a word-level diff."}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mb-3 text-sm text-muted-foreground","aria-live":"polite",children:Ne(s.length,"open conflict")}),e.jsx("div",{className:"flex flex-col gap-4",children:s.map(n=>e.jsx($r,{conflict:n},n.id))})]})]})}const Md={integrity:"Back up .fastr/fastr.db, then run `fastrmemory heal`. If integrity errors remain, restore from a snapshot.",fts5:'The keyword index is out of sync with memories. "Heal" rebuilds it from the memories table.',file_links:'Some file links point to memories that no longer exist. "Heal" removes the dangling links.',actions:'Some action dependencies reference missing actions. "Heal" prunes the broken edges.',storage:'Write-ahead log or storage issue. "Heal" checkpoints the WAL and reclaims space.'};function zd({severity:t}){return t==="error"?e.jsx(Ri,{className:"size-4 shrink-0 text-risk","aria-label":"Error"}):t==="warning"?e.jsx(Jt,{className:"size-4 shrink-0 text-trap","aria-label":"Warning"}):e.jsx(hl,{className:"size-4 shrink-0 text-brand","aria-label":"Info"})}function Ed(){const t=zc(),s=ws(),n=En({mutationFn:o=>Q.heal(o),onSuccess:o=>{o.dryRun?ie.info(o.actionsTaken.length?`Heal would: ${o.actionsTaken.join(" · ")}`:"Nothing to heal."):(ie.success(`Healed ${o.fixedCount} issue${o.fixedCount===1?"":"s"}`,{description:o.remainingIssues?`${o.remainingIssues} issue(s) need manual attention.`:"Database is consistent."}),s.invalidateQueries())},onError:o=>ie.error("Heal failed",{description:o.message})}),r=t.data,a=r?.report;return e.jsxs("div",{children:[e.jsx(Ye,{icon:Qn,title:"Health",description:"Integrity of the SQLite store, the keyword index, file links and the action graph, plus search coverage.",actions:e.jsxs(e.Fragment,{children:[e.jsxs(I,{variant:"outline",size:"sm",onClick:()=>t.refetch(),disabled:t.isFetching,children:[t.isFetching?e.jsx(xs,{className:"animate-spin","aria-hidden":!0}):e.jsx(Vl,{"aria-hidden":!0})," Re-run diagnosis"]}),e.jsx(I,{variant:"outline",size:"sm",onClick:()=>n.mutate(!0),disabled:n.isPending||!a,children:"Preview heal"}),e.jsxs(I,{size:"sm",onClick:()=>n.mutate(!1),disabled:n.isPending||!a||a.fixableIssues===0,children:[n.isPending?e.jsx(xs,{className:"animate-spin","aria-hidden":!0}):e.jsx(Ql,{"aria-hidden":!0})," Heal"]})]})}),t.isLoading?e.jsx(Te,{rows:6}):t.isError?e.jsx($e,{error:t.error,onRetry:()=>t.refetch()}):r&&a?e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("div",{role:"status",className:`flex items-center gap-3 rounded-xl border p-4 ${a.healthy?"border-success/40 bg-success-weak":"border-trap/40 bg-trap-weak"}`,children:[a.healthy?e.jsx($i,{className:"size-5 text-success","aria-hidden":!0}):e.jsx(Jt,{className:"size-5 text-trap","aria-hidden":!0}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium",children:a.healthy?"All checks passed":`${a.totalIssues} issue${a.totalIssues===1?"":"s"} found`}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Checked ",Ut(a.timestamp)," · ",a.fixableIssues," fixable automatically"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[e.jsx(ke,{label:"Memories",value:a.metrics.memoryCount,hint:`${a.metrics.ftsRowCount} keyword index rows`}),e.jsx(ke,{label:e.jsx(fe,{k:"embedding",children:"Embedding coverage"}),value:`${r.status.embeddingCoveragePercent}%`,tone:r.status.embeddingCoveragePercent>0?"success":"default",hint:r.status.embeddingCoveragePercent===0?"Keyword + graph search only":"Vector search active"}),e.jsx(ke,{label:e.jsx(fe,{k:"spool",children:"Write spool"}),value:r.status.pendingSpoolCount,tone:r.status.pendingSpoolCount>0?"trap":"success",hint:r.status.pendingSpoolCount>0?"Queued while the DB was locked":"Nothing queued"}),e.jsx(ke,{label:"Journal mode",value:a.metrics.walMode.toUpperCase(),hint:`${a.metrics.fileLinkCount} file links`})]}),e.jsxs(re,{children:[e.jsxs(ce,{children:[e.jsx(de,{children:"Issues"}),e.jsx(Fe,{children:'Each issue lists a suggested fix. "Heal" applies the safe automatic repairs.'})]}),e.jsx(ae,{children:a.issues.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No issues."}):e.jsx("ul",{className:"flex flex-col gap-3",children:a.issues.map((o,l)=>e.jsxs("li",{className:"rounded-lg border p-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(zd,{severity:o.severity}),e.jsx("span",{className:"text-sm font-medium",children:o.description}),e.jsx(te,{variant:"muted",className:"font-mono text-[10px]",children:o.category}),o.affectedCount>0&&e.jsxs(te,{variant:"outline",children:[o.affectedCount," affected"]}),o.fixable&&e.jsx(te,{variant:"success",children:"auto-fixable"})]}),e.jsx("p",{className:"mt-1.5 pl-6 text-xs text-muted-foreground",children:Md[o.category]})]},l))})})]}),n.data&&!n.data.dryRun&&n.data.actionsTaken.length>0&&e.jsxs(re,{children:[e.jsx(ce,{children:e.jsx(de,{children:"Last heal"})}),e.jsx(ae,{children:e.jsx("ul",{className:"list-disc pl-5 text-sm",children:n.data.actionsTaken.map((o,l)=>e.jsx("li",{children:o},l))})})]}),e.jsxs(re,{children:[e.jsx(ce,{children:e.jsxs(de,{className:"flex items-center gap-2",children:[e.jsx(Yi,{className:"size-4 text-muted-foreground","aria-hidden":!0})," Storage"]})}),e.jsxs(ae,{className:"flex flex-col gap-2 text-sm",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"shrink-0 text-muted-foreground",children:"Database"}),e.jsx("code",{className:"min-w-0 truncate font-mono text-xs",children:r.dbPath}),e.jsx(bt,{text:r.dbPath,description:"Copy database path",variant:"ghost"})]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"shrink-0 text-muted-foreground",children:"Spool file"}),e.jsx("code",{className:"min-w-0 truncate font-mono text-xs",children:r.spool.path})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["CLI equivalents: ",e.jsx("code",{className:"font-mono",children:"fastrmemory diagnose"})," and ",e.jsx("code",{className:"font-mono",children:"fastrmemory heal"}),"."]})]})]})]}):null]})}const Td=[{value:"light",label:"Light",icon:zs},{value:"dark",label:"Dark",icon:_s},{value:"system",label:"System",icon:Zn}];function Ad(t,s){const n=new Blob([JSON.stringify(s,null,2)],{type:"application/json"}),r=URL.createObjectURL(n),a=document.createElement("a");a.href=r,a.download=t,document.body.appendChild(a),a.click(),a.remove(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}function $d(){const{mode:t,setMode:s}=Xt(),n=$s(),r=vt(),a=jr(),o=r.data,l=JSON.stringify({mcpServers:{fastrmemory:{command:"npx",args:["-y","github:atifjubaer/fastrmemory","mcp"]}}},null,2);return e.jsxs("div",{className:"flex max-w-3xl flex-col gap-4",children:[e.jsx(Ye,{icon:tr,title:"Settings",description:"Dashboard preferences are stored in this browser only."}),e.jsxs(re,{children:[e.jsx(ce,{children:e.jsx(de,{children:"Appearance"})}),e.jsx(ae,{children:e.jsx("div",{role:"radiogroup","aria-label":"Theme",className:"grid grid-cols-3 gap-2",children:Td.map(c=>e.jsxs("button",{type:"button",role:"radio","aria-checked":t===c.value,onClick:()=>s(c.value),className:b("flex flex-col items-center gap-2 rounded-lg border p-3 text-sm outline-none transition-colors hover:bg-accent/50 focus-visible:ring-[3px] focus-visible:ring-ring/50",t===c.value&&"border-brand bg-brand-weak"),children:[e.jsx(c.icon,{className:"size-5","aria-hidden":!0}),c.label]},c.value))})})]}),e.jsxs(re,{children:[e.jsxs(ce,{children:[e.jsx(de,{children:"Live updates"}),e.jsx(Fe,{children:"Agents write through their own MCP server process, so the dashboard polls the database version to pick up their changes."})]}),e.jsxs(ae,{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(js,{id:"live-polling",checked:n.pollingEnabled,onCheckedChange:c=>n.setPollingEnabled(!!c)}),e.jsx(Ze,{htmlFor:"live-polling",children:"Watch for changes from agents and the CLI"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx(Ze,{htmlFor:"live-interval",children:"Check every"}),e.jsxs(ct,{value:String(n.intervalMs),onValueChange:c=>n.setIntervalMs(Number(c)),disabled:!n.pollingEnabled,children:[e.jsx(ut,{id:"live-interval",className:"w-32",children:e.jsx(dt,{})}),e.jsxs(mt,{children:[e.jsx(G,{value:"1000",children:"1 second"}),e.jsx(G,{value:"2000",children:"2 seconds"}),e.jsx(G,{value:"5000",children:"5 seconds"}),e.jsx(G,{value:"15000",children:"15 seconds"})]})]}),e.jsxs(I,{variant:"outline",size:"sm",onClick:n.resync,children:[e.jsx(yt,{"aria-hidden":!0})," Resync now"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Status: ",n.health," · stream ",n.sse,n.lastSyncAt?` · last check ${Ae(new Date(n.lastSyncAt).toISOString())}`:""]})]})]}),e.jsxs(re,{children:[e.jsx(ce,{children:e.jsx(de,{children:"Project"})}),e.jsxs(ae,{className:"flex flex-col gap-2 text-sm",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"w-24 shrink-0 text-muted-foreground",children:"Name"}),e.jsx("span",{className:"truncate",children:o?.projectName??"…"})]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"w-24 shrink-0 text-muted-foreground",children:"Project ID"}),e.jsx("code",{className:"truncate font-mono text-xs",children:o?.projectId??"…"}),o&&e.jsx(bt,{text:o.projectId,description:"Copy project ID",variant:"ghost"})]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"w-24 shrink-0 text-muted-foreground",children:"Database"}),e.jsx("code",{className:"min-w-0 truncate font-mono text-xs",children:o?.dbPath??"…"})]}),e.jsx("div",{className:"mt-2",children:e.jsxs(I,{variant:"outline",size:"sm",disabled:!a.data,onClick:()=>Ad(`fastrmemory-${o?.projectName??"export"}-memories.json`,a.data),children:[e.jsx(Qi,{"aria-hidden":!0})," Export active memories (JSON)"]})})]})]}),e.jsxs(re,{children:[e.jsxs(ce,{children:[e.jsx(de,{children:"Connect an agent"}),e.jsxs(Fe,{children:["Run ",e.jsx("code",{className:"font-mono",children:"fastrmemory hook install"})," in the project for Claude Code (MCP server + hooks), or add this to an MCP client config."]})]}),e.jsx(ae,{children:e.jsxs("div",{className:"relative",children:[e.jsx("pre",{className:"overflow-x-auto rounded-lg border bg-muted/50 p-3 font-mono text-xs",children:l}),e.jsx(bt,{text:l,description:"Copy MCP config",variant:"ghost",className:"absolute top-2 right-2"})]})})]})]})}const yn=[{key:"rankA",label:"BM25",className:"bg-brand"},{key:"rankB",label:"Vector",className:"bg-success"},{key:"rankC",label:"Graph",className:"bg-pinned"}];function Dd({rank:t}){return t>0?e.jsxs("span",{className:"font-mono tabular-nums",children:["#",t]}):e.jsx("span",{className:"text-muted-foreground",children:"—"})}function Id(){const s=st().query.get("q")??"",[n,r]=p.useState(s),a=As(n.trim(),300),o=Mc(a);p.useEffect(()=>{a!==s&&le("search",null,{q:a})},[a]);const l=o.data?.results??[],c=Math.max(...l.map(d=>d.score),1e-4);return e.jsxs("div",{children:[e.jsx(Ye,{icon:sn,title:"Search Lab",description:e.jsxs(e.Fragment,{children:["See exactly how recall ranks memories for a query: each stream's rank and the fused ",e.jsx(fe,{k:"rrf",children:"RRF"})," score, including the trap and verified boosts."]})}),e.jsxs("div",{className:"relative mb-4",children:[e.jsx(xt,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground","aria-hidden":!0}),e.jsx(We,{value:n,onChange:d=>r(d.target.value),placeholder:"Type a query an agent might ask, e.g. jwt expiration","aria-label":"Query",className:"pl-9",autoFocus:!0})]}),a?o.isLoading?e.jsx(Te,{rows:5}):o.isError?e.jsx($e,{error:o.error,onRetry:()=>o.refetch()}):l.length===0?e.jsx(Ue,{icon:xt,title:"No memory matched",children:"None of the streams found a match. Agents would get an empty recall for this query."}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"mb-2 text-sm text-muted-foreground","aria-live":"polite",children:[l.length," result",l.length===1?"":"s"," · ",o.data?.totalTimeMs," ms end to end · ~",o.data?.totalTokens," tokens returned to the agent"]}),e.jsx("div",{className:"overflow-x-auto rounded-xl border bg-card",children:e.jsxs("table",{className:"w-full min-w-[640px] text-sm",children:[e.jsx("thead",{className:"border-b bg-muted/40 text-xs text-muted-foreground",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"#"}),e.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Memory"}),yn.map(d=>e.jsx("th",{className:"px-3 py-2 text-left font-medium",children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:`size-2 rounded-full ${d.className}`,"aria-hidden":!0}),d.label]})},d.key)),e.jsx("th",{className:"w-48 px-3 py-2 text-left font-medium",children:"Fused score"})]})}),e.jsx("tbody",{children:l.map((d,u)=>e.jsxs("tr",{className:"border-b last:border-b-0",children:[e.jsx("td",{className:"px-3 py-2.5 font-mono text-xs text-muted-foreground",children:u+1}),e.jsx("td",{className:"w-full max-w-0 px-3 py-2.5",children:e.jsxs("button",{type:"button",onClick:()=>De(d.id),className:"flex w-full min-w-0 max-w-full items-center gap-2 rounded-sm text-left outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring/50",children:[e.jsx(jt,{kind:d.kind,className:"shrink-0"}),e.jsx("span",{className:"truncate",children:d.title})]})}),yn.map(m=>e.jsx("td",{className:"px-3 py-2.5 text-xs",children:e.jsx(Dd,{rank:d[m.key]})},m.key)),e.jsx("td",{className:"px-3 py-2.5",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-1.5 flex-1 overflow-hidden rounded-full bg-muted","aria-hidden":!0,children:e.jsx("div",{className:"h-full rounded-full bg-brand",style:{width:`${d.score/c*100}%`}})}),e.jsx("span",{className:"w-14 text-right font-mono text-xs tabular-nums",children:d.score.toFixed(4)})]})})]},d.id))})]})})]}):e.jsx(Ue,{icon:sn,title:"Enter a query",children:"Results show which of the three streams (keywords, vectors, file graph) found each memory and the final ranking agents receive."})]})}const pt=8;function lt({label:t,value:s,hint:n}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] font-medium text-muted-foreground",children:t}),e.jsx("div",{className:"mt-0.5 font-mono text-sm tabular-nums",children:s}),n&&e.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:n})]})}function vn({label:t,snapshot:s}){return e.jsxs(re,{children:[e.jsxs(ce,{children:[e.jsxs(de,{className:"flex items-center gap-2",children:[e.jsx(ft,{className:"size-4 text-brand","aria-hidden":!0}),t]}),e.jsxs(Fe,{children:[e.jsx("span",{className:"font-mono text-xs",children:s.at}),e.jsx("span",{className:"ml-2 text-xs",children:Ut(s.at)})]})]}),e.jsxs(ae,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[e.jsx(lt,{label:"Active",value:String(s.active.length)}),e.jsx(lt,{label:"History",value:String(s.historyCount)}),e.jsx(lt,{label:"Events",value:s.eventCount.toLocaleString()}),e.jsx(lt,{label:"Conflicts",value:String(s.conflictCount)})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 border-t pt-3",children:[e.jsx(lt,{label:"Tokens",value:s.tokenCount.toLocaleString()}),e.jsx(lt,{label:"Content hash",value:s.contentHash.slice(0,12),hint:s.contentHash})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-[11px] font-medium tracking-wide text-muted-foreground uppercase",children:"Active set"}),s.active.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No active memories at this timestamp."}):e.jsx("ul",{className:"space-y-1.5",children:s.active.slice(0,pt).map(n=>e.jsxs("li",{className:"flex min-w-0 items-center gap-2 rounded-md border bg-muted/20 px-2 py-1.5",children:[e.jsx(te,{variant:"outline",className:"shrink-0 font-mono text-[10px]",children:n.kind}),e.jsx("span",{className:"truncate text-sm",children:n.title}),e.jsx("span",{className:"ml-auto shrink-0 font-mono text-[10px] text-muted-foreground",children:n.module})]},n.id))}),s.active.length>pt&&e.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:["+",s.active.length-pt," more active memories"]})]})]})]})}function Ld({entries:t,empty:s}){return t.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:s}):e.jsxs(e.Fragment,{children:[e.jsx("ul",{className:"space-y-1.5",children:t.slice(0,pt).map(n=>e.jsxs("li",{className:"flex min-w-0 items-center gap-2 rounded-md border bg-muted/20 px-2 py-1.5",children:[e.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:n.id}),e.jsx("span",{className:"truncate text-sm",children:n.title}),e.jsx(te,{variant:"muted",className:"ml-auto shrink-0 font-mono text-[10px]",children:n.kind}),e.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:n.module})]},n.id))}),t.length>pt&&e.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:["+",t.length-pt," more"]})]})}function qt({title:t,icon:s,entries:n,empty:r}){return e.jsxs(re,{children:[e.jsx(ce,{children:e.jsxs(de,{className:"flex items-center gap-2",children:[e.jsx(s,{className:"size-4 text-muted-foreground","aria-hidden":!0}),t,e.jsx(te,{variant:"muted",children:n.length})]})}),e.jsx(ae,{children:e.jsx(Ld,{entries:n,empty:r})})]})}function Rd({data:t,isLoading:s=!1,error:n,onRetry:r}){if(s)return e.jsx(Te,{rows:8});if(n)return e.jsx($e,{error:n,onRetry:r});if(!t)return e.jsx(Ue,{icon:ft,title:"Choose a replay window",children:"Pick a start and end timestamp to reconstruct the active memory set at each point and compare what changed."});if(!(t.from.active.length>0||t.to.active.length>0||t.diff.added.length>0||t.diff.superseded.length>0||t.diff.stillActive.length>0||t.diff.changed.length>0||t.diff.conflicts.length>0))return e.jsx(Ue,{icon:ft,title:"No memories in this window",children:"No active memories existed at either timestamp. Move the range or add memories first."});const o=t.diff.tokenDelta,l=`${o>=0?"+":""}${o.toLocaleString()}`;return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsx(ke,{label:"Token delta",value:l,hint:o===0?"No token change":o>0?"The active set grew":"The active set shrank",tone:o>0?"brand":o<0?"risk":"default"}),e.jsx(ke,{label:"Added memories",value:String(t.diff.added.length),hint:"Present in the end snapshot only"}),e.jsx(ke,{label:"Open conflicts",value:String(t.diff.conflicts.length),hint:"Both sides active at the end",tone:t.diff.conflicts.length>0?"risk":"default"})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsx(vn,{label:"Start snapshot",snapshot:t.from}),e.jsx(vn,{label:"End snapshot",snapshot:t.to})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 pt-1",children:[e.jsxs("h2",{className:"flex items-center gap-2 text-base font-semibold",children:[e.jsx(fs,{className:"size-4 text-brand","aria-hidden":!0}),"Memory diff"]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[Ne(t.diff.added.length,"addition"),", ",Ne(t.diff.superseded.length,"supersession"),","," ",Ne(t.diff.changed.length,"change")]})]}),t.diff.newTrapIds.length>0&&e.jsxs("div",{className:"flex items-start gap-2 rounded-xl border border-trap/40 bg-trap-weak px-4 py-3 text-sm text-trap",role:"status",children:[e.jsx(Dt,{className:"mt-0.5 size-4 shrink-0","aria-hidden":!0}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"New error traps in the end snapshot"}),e.jsx("p",{className:"mt-0.5 font-mono text-xs",children:t.diff.newTrapIds.join(", ")})]})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsx(qt,{title:"Added",icon:ki,entries:t.diff.added,empty:"No memories were added in this window."}),e.jsx(qt,{title:"Superseded",icon:xi,entries:t.diff.superseded,empty:"No memories were superseded in this window."}),e.jsx(qt,{title:"Changed",icon:fs,entries:t.diff.changed,empty:"No active memory changed its content or metadata."}),e.jsx(qt,{title:"Still active",icon:ft,entries:t.diff.stillActive,empty:"No memories stayed active across both snapshots."})]}),e.jsxs(re,{children:[e.jsxs(ce,{children:[e.jsxs(de,{className:"flex items-center gap-2",children:[e.jsx(Qt,{className:"size-4 text-muted-foreground","aria-hidden":!0}),"Open conflicts",e.jsx(te,{variant:t.diff.conflicts.length>0?"risk":"muted",children:t.diff.conflicts.length})]}),e.jsx(Fe,{children:"Conflicts are open at the end snapshot and both memories are still active."})]}),e.jsx(ae,{children:t.diff.conflicts.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No open conflicts between active memories."}):e.jsx("ul",{className:"space-y-2",children:t.diff.conflicts.map(c=>e.jsxs("li",{className:"rounded-md border bg-muted/20 px-3 py-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:["#",c.id]}),e.jsx("span",{className:"text-sm",children:c.reason}),e.jsxs(te,{variant:"risk",className:"ml-auto font-mono text-[10px]",children:["score ",c.score]})]}),e.jsxs("p",{className:"mt-1 font-mono text-[10px] text-muted-foreground",children:[c.memoryAId," vs ",c.memoryBId]})]},c.id))})})]})]})}const Pd=1440*60*1e3;function Vt(t){return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,16)}function jn(t){const s=new Date;return{from:new Date(s.getTime()-t*Pd).toISOString(),to:s.toISOString()}}function Od(){const[t]=p.useState(()=>jn(7)),[s,n]=p.useState(()=>Vt(new Date(t.from))),[r,a]=p.useState(()=>Vt(new Date(t.to))),[o,l]=p.useState(t),[c,d]=p.useState(null),u=Sc(o.from,o.to),m=()=>{const h=new Date(s),g=new Date(r);if(Number.isNaN(h.getTime())||Number.isNaN(g.getTime())){d("Enter a valid start and end timestamp.");return}if(h.getTime()>g.getTime()){d("The start timestamp must be before or equal to the end timestamp.");return}d(null),l({from:h.toISOString(),to:g.toISOString()})},i=h=>{const g=jn(h);n(Vt(new Date(g.from))),a(Vt(new Date(g.to))),d(null),l(g)};return e.jsxs("div",{children:[e.jsx(Ye,{icon:ft,title:"Replay & Diff",description:"Reconstruct the active memory set at two timestamps, inspect the snapshots, and review every addition, supersession, change, and open conflict between them.",actions:e.jsxs(I,{variant:"outline",size:"sm",onClick:()=>u.refetch(),disabled:u.isFetching,children:[e.jsx(yt,{className:u.isFetching?"animate-spin":void 0,"aria-hidden":!0}),"Refresh"]})}),e.jsx(re,{className:"mb-5",children:e.jsxs(ae,{className:"pt-5",children:[e.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-end",children:[e.jsxs("label",{className:"grid gap-1.5 text-xs font-medium text-muted-foreground",children:["From",e.jsx(We,{type:"datetime-local",value:s,onChange:h=>n(h.target.value),className:"w-full lg:w-[220px]"})]}),e.jsxs("label",{className:"grid gap-1.5 text-xs font-medium text-muted-foreground",children:["To",e.jsx(We,{type:"datetime-local",value:r,onChange:h=>a(h.target.value),className:"w-full lg:w-[220px]"})]}),e.jsxs(I,{onClick:m,disabled:u.isFetching,children:[e.jsx(fs,{"aria-hidden":!0}),"Compare"]}),e.jsxs("div",{className:"flex gap-2 lg:ml-auto",children:[e.jsx(I,{variant:"outline",size:"sm",onClick:()=>i(7),children:"7 days"}),e.jsx(I,{variant:"outline",size:"sm",onClick:()=>i(30),children:"30 days"})]})]}),c&&e.jsx("p",{className:"mt-2 text-sm text-risk",role:"alert",children:c}),e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Replay reads the bi-temporal columns directly. It does not write memories, events, or conflicts."})]})}),e.jsx(Rd,{data:u.data,isLoading:u.isLoading,error:u.isError?u.error:null,onRetry:()=>u.refetch()})]})}const Fd=p.lazy(()=>Yt(()=>import("./ActionsPage-B3quzFNF.js"),__vite__mapDeps([0,1,2,3]))),Bd=p.lazy(()=>Yt(()=>import("./GraphPage-DetiATmC.js"),__vite__mapDeps([4,1,3,2]))),qd=p.lazy(()=>Yt(()=>import("./ObservatoryPage-QIGMwENf.js"),__vite__mapDeps([5,1,6,2]))),Vd=p.lazy(()=>Yt(()=>import("./TreemapPage-C7uLZd37.js"),__vite__mapDeps([7,1,2]))),Hd={home:wd,memories:Nd,traps:_d,conflicts:Sd,actions:Fd,graph:Bd,observatory:qd,treemap:Vd,search:Id,replay:Od,health:Ed,settings:$d};function Wd(){const t=st(),s=Hd[t.name];return e.jsx(cd,{resetKey:t.name,children:e.jsx(p.Suspense,{fallback:e.jsx(Te,{rows:8}),children:e.jsx(s,{})})})}function Gd(){return p.useEffect(()=>{const t=()=>bc();return window.addEventListener("pagehide",t),()=>window.removeEventListener("pagehide",t)},[]),e.jsx(go,{children:e.jsx(La,{client:br,children:e.jsx(ui,{delayDuration:250,children:e.jsxs(Vc,{children:[e.jsx(Uc,{children:e.jsx(Wd,{})}),e.jsx(sd,{}),e.jsx(bo,{position:"bottom-right",closeButton:!0})]})})})})}Da.createRoot(document.getElementById("root")).render(e.jsx(x.StrictMode,{children:e.jsx(Gd,{})}));export{pl as A,I as B,re as C,$e as E,Xn as F,ol as G,We as I,xs as L,Sl as O,Ye as P,Te as S,fe as T,Zt as X,b as a,Xd as b,N as c,Ue as d,Ol as e,te as f,Q as g,ce as h,de as i,ae as j,As as k,Qd as l,Si as m,le as n,De as o,Xt as p,Yd as q,Ae as r,jr as s,ie as t,st as u,kr as v,gt as w,Kc as x,Yc as y,ds as z};
328
+ Reason: ${t.reason}`,description:"Copy conflict report",variant:"ghost"})]})]}),e.jsx(td,{left:d?.content??"(memory A is no longer available)",right:u?.content??"(memory B is no longer available)",leftLabel:e.jsx(xn,{side:"A",id:t.memory_a_id,memory:d}),rightLabel:e.jsx(xn,{side:"B",id:t.memory_b_id,memory:u})}),e.jsxs("footer",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(I,{size:"sm",onClick:()=>m("a"),children:[e.jsx(Et,{"aria-hidden":!0})," Keep A"]}),e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>m("b"),children:[e.jsx(Et,{"aria-hidden":!0})," Keep B"]}),e.jsxs(I,{size:"sm",variant:"ghost",onClick:()=>m("both"),children:[e.jsx(Bl,{"aria-hidden":!0})," Keep both"]})]}),c]})}function xn({side:t,id:s,memory:n}){return e.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:"font-semibold text-foreground",children:t}),e.jsx("button",{type:"button",onClick:()=>De(s),className:"min-w-0 truncate text-left text-foreground underline-offset-4 outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring/50",children:n?.title??s}),e.jsx("code",{className:"font-mono text-[10px]",children:s})]})}function gn({m:t,right:s}){return e.jsxs("button",{type:"button",onClick:()=>De(t.id),className:"flex w-full min-w-0 items-center gap-3 rounded-md px-2 py-2 text-left outline-none hover:bg-accent/60 focus-visible:ring-2 focus-visible:ring-ring/50",children:[e.jsx(jt,{kind:t.kind}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:t.title}),s]})}function wd(){const t=vt(),s=jr(),n=Sc(12),r=kr(),a=t.data,o=(s.data??[]).filter(c=>c.status==="staging").slice(0,6),l=[...s.data??[]].filter(c=>c.reward_score<1).sort((c,d)=>c.reward_score-d.reward_score).slice(0,5);return e.jsxs("div",{children:[e.jsx(Ye,{icon:Jn,title:a?a.projectName:"Home",description:"What your agents have learned in this project, what needs review, and what changed recently."}),t.isError?e.jsx($e,{error:t.error,onRetry:()=>t.refetch(),className:"mb-6"}):e.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-3 lg:grid-cols-4",children:[e.jsx(ke,{loading:t.isLoading,label:"Active memories",value:a?.activeCount??0,hint:a?`${a.status.stagingCount} staging · ${a.modulesCount} modules`:void 0,onClick:()=>le("memories")}),e.jsx(ke,{loading:t.isLoading,label:"Error traps",value:a?.trapsCount??0,tone:a&&a.trapsCount>0?"trap":"default",hint:"2.0x recall boost",onClick:()=>le("traps")}),e.jsx(ke,{loading:t.isLoading,label:"Open conflicts",value:a?.conflictsCount??0,tone:a&&a.conflictsCount>0?"risk":"success",hint:a&&a.conflictsCount===0?"All rules consistent":"Needs a decision",onClick:()=>le("conflicts")}),e.jsx(ke,{loading:t.isLoading,label:"Ready tasks",value:a?.frontierCount??0,tone:"brand",hint:a?`${a.actionsCount} actions total`:void 0,onClick:()=>le("actions")})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-5",children:[e.jsxs(re,{className:"min-w-0 lg:col-span-3",children:[e.jsxs(ce,{children:[e.jsxs(de,{className:"flex items-center gap-2",children:[e.jsx(Hi,{className:"size-4 text-muted-foreground","aria-hidden":!0})," Recent activity"]}),e.jsx(Fe,{children:"Newest memories, traps and supersessions."})]}),e.jsx(ae,{children:n.isLoading?e.jsx(Te,{rows:6}):n.isError?e.jsx($e,{error:n.error,onRetry:()=>n.refetch()}):(n.data??[]).length===0?e.jsxs(Ue,{icon:Ol,title:"No memories yet",children:["Agents add memories through ",e.jsx("code",{className:"font-mono",children:"fastr_remember"})," and"," ",e.jsx("code",{className:"font-mono",children:"fastr_trap_log"}),", or you can add one with ",e.jsx("b",{children:"New memory"}),"."]}):e.jsx("ol",{className:"flex flex-col",children:(n.data??[]).map(c=>e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>De(c.id),className:"flex w-full min-w-0 items-center gap-3 rounded-md px-2 py-2 text-left outline-none hover:bg-accent/60 focus-visible:ring-2 focus-visible:ring-ring/50",children:[e.jsx(jt,{kind:c.kind}),e.jsx("span",{className:`min-w-0 flex-1 truncate text-sm ${c.status==="superseded"?"text-muted-foreground line-through":""}`,children:c.title}),e.jsx("span",{className:"hidden font-mono text-[11px] text-muted-foreground sm:inline",children:c.module}),e.jsx("span",{className:"shrink-0 text-right text-xs whitespace-nowrap text-muted-foreground",children:Ae(c.createdAt)})]})},c.id))})})]}),e.jsxs("div",{className:"flex min-w-0 flex-col gap-4 lg:col-span-2",children:[e.jsxs(re,{children:[e.jsxs(ce,{children:[e.jsxs(de,{className:"flex items-center gap-2",children:[e.jsx(ul,{className:"size-4 text-muted-foreground","aria-hidden":!0})," Awaiting verification"]}),e.jsxs(Fe,{children:[e.jsx(fe,{k:"staging",children:"Staging"})," memories agents recorded but nobody confirmed yet."]}),e.jsx(dd,{children:e.jsx(I,{variant:"ghost",size:"xs",asChild:!0,children:e.jsxs("a",{href:gt("memories",null,{status:"staging"}),children:["All ",e.jsx(tn,{"aria-hidden":!0})]})})})]}),e.jsx(ae,{children:s.isLoading?e.jsx(Te,{rows:3}):o.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Nothing waiting. Every recorded memory is verified."}):o.map(c=>e.jsx(gn,{m:c,right:e.jsx(Rt,{status:c.status})},c.id))})]}),e.jsxs(re,{children:[e.jsxs(ce,{children:[e.jsxs(de,{className:"flex items-center gap-2",children:[e.jsx(Kl,{className:"size-4 text-muted-foreground","aria-hidden":!0})," Low reward"]}),e.jsxs(Fe,{children:["Memories agents rated as unhelpful (",e.jsx(fe,{k:"reward",children:"reward"})," below 1.0x)."]})]}),e.jsx(ae,{children:s.isLoading?e.jsx(Te,{rows:3}):l.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No memory has negative feedback."}):l.map(c=>e.jsx(gn,{m:c,right:e.jsx("span",{className:"font-mono text-xs text-risk tabular-nums",children:ts(c.reward_score)})},c.id))})]})]})]}),(r.data??[]).length>0&&e.jsxs("section",{className:"mt-6","aria-labelledby":"home-conflicts",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxs("h2",{id:"home-conflicts",className:"flex items-center gap-2 font-semibold",children:[e.jsx(Jt,{className:"size-4 text-risk","aria-hidden":!0})," Open conflicts"]}),e.jsx(I,{variant:"ghost",size:"xs",asChild:!0,children:e.jsxs("a",{href:gt("conflicts"),children:["All conflicts ",e.jsx(tn,{"aria-hidden":!0})]})})]}),e.jsx("div",{className:"grid gap-3",children:(r.data??[]).slice(0,2).map(c=>e.jsx($r,{conflict:c,compact:!0},c.id))})]})]})}function js({className:t,...s}){return e.jsx(Aa,{"data-slot":"checkbox",className:b("peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground dark:bg-input/30 dark:data-[state=checked]:bg-primary dark:data-[state=indeterminate]:bg-primary",t),...s,children:e.jsx($a,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current",children:s.checked==="indeterminate"?e.jsx(kl,{className:"size-3.5"}):e.jsx(Et,{className:"size-3.5"})})})}const ve="__all",St=52,bn=200;function kd(t,s,n){if(s==="relevance")return[...t].sort((o,l)=>l.pinned-o.pinned||(l.score??0)-(o.score??0)||l.created_at.localeCompare(o.created_at));const r=n==="asc"?1:-1,a=o=>{switch(s){case"title":return o.title.toLowerCase();case"module":return o.module.toLowerCase();case"reward":return o.reward_score;case"recalls":return o.retrieval_count;case"created":return o.created_at}};return[...t].sort((o,l)=>{const c=a(o),d=a(l);return(c<d?-1:c>d?1:0)*r})}function _t({label:t,k:s,sort:n,onSort:r,className:a}){const o=n.key===s,l=o?n.dir==="asc"?Ci:bi:ji;return e.jsxs("button",{type:"button",onClick:()=>r(s),"aria-label":`Sort by ${t}`,"aria-pressed":o,className:b("inline-flex items-center gap-1 rounded-sm outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50",o&&"text-foreground",a),children:[t,e.jsx(l,{className:"size-3","aria-hidden":!0})]})}function Nd(){const t=st(),s=vt(),n=t.query.get("q")??"",r=t.query.get("kind")??"",a=t.query.get("module")??"",o=t.query.get("status")??"",l=t.query.get("pinned")??"",[c,d]=p.useState(n),u=As(c.trim(),250),[m,i]=p.useState({key:"relevance",dir:"desc"}),[h,g]=p.useState(new Set),{setPinned:C,forget:S}=Ds(),{confirm:_,element:y}=Ar(),F=p.useCallback(f=>{const M=Object.fromEntries(t.query);for(const[O,R]of Object.entries(f))R?M[O]=R:delete M[O];le("memories",t.name==="memories"?t.id:null,M)},[t]);p.useEffect(()=>{u!==n&&F({q:u})},[u]);const L=wr({q:n,kind:r,module:a,status:o,pinned:l,limit:2e3}),B=p.useMemo(()=>kd(L.data?.results??[],m.key,m.dir),[L.data,m]);p.useEffect(()=>{g(f=>{const M=new Set(B.map(R=>R.id)),O=new Set([...f].filter(R=>M.has(R)));return O.size===f.size?f:O})},[B]);const U=f=>i(M=>M.key===f?{key:f,dir:M.dir==="asc"?"desc":"asc"}:{key:f,dir:f==="title"||f==="module"?"asc":"desc"}),W=B.filter(f=>h.has(f.id)),H=B.length>0&&h.size===B.length,j=f=>g(M=>{const O=new Set(M);return O.has(f)?O.delete(f):O.add(f),O}),q=p.useRef(null),[ge,ue]=p.useState({start:0,end:bn}),K=B.length>bn;p.useEffect(()=>{const f=q.current;if(!f||!K)return;const M=()=>{const O=Math.max(0,Math.floor(f.scrollTop/St)-10),R=Math.min(B.length,O+Math.ceil(f.clientHeight/St)+20);ue(k=>k.start===O&&k.end===R?k:{start:O,end:R})};return M(),f.addEventListener("scroll",M,{passive:!0}),window.addEventListener("resize",M),()=>{f.removeEventListener("scroll",M),window.removeEventListener("resize",M)}},[K,B.length]);const T=K?B.slice(ge.start,ge.end):B,V=!!(n||r||a||o||l),Y=s.data?.modules??[];return e.jsxs("div",{children:[y,e.jsx(Ye,{icon:ps,title:"Memories",description:"Rules, decisions, workflows and error traps your agents recall. Search uses the same hybrid ranking agents get from fastr_recall."}),e.jsxs("div",{className:"mb-3 flex flex-col gap-2 lg:flex-row lg:items-center",children:[e.jsxs("div",{className:"relative min-w-0 flex-1",children:[e.jsx(xt,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground","aria-hidden":!0}),e.jsx(We,{value:c,onChange:f=>d(f.target.value),placeholder:"Search titles, content, files…","aria-label":"Search memories",className:"pl-9"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:flex",children:[e.jsxs(ct,{value:r||ve,onValueChange:f=>F({kind:f===ve?"":f}),children:[e.jsx(ut,{className:"w-full sm:w-36","aria-label":"Filter by kind",children:e.jsx(dt,{})}),e.jsxs(mt,{children:[e.jsx(G,{value:ve,children:"All kinds"}),e.jsx(G,{value:"rule",children:"Rules"}),e.jsx(G,{value:"error_trap",children:"Traps"}),e.jsx(G,{value:"decision",children:"Decisions"}),e.jsx(G,{value:"workflow",children:"Workflows"})]})]}),e.jsxs(ct,{value:a||ve,onValueChange:f=>F({module:f===ve?"":f}),children:[e.jsx(ut,{className:"w-full sm:w-40","aria-label":"Filter by module",children:e.jsx(dt,{})}),e.jsxs(mt,{children:[e.jsx(G,{value:ve,children:"All modules"}),Y.map(f=>e.jsx(G,{value:f,children:f},f))]})]}),e.jsxs(ct,{value:o||ve,onValueChange:f=>F({status:f===ve?"":f}),children:[e.jsx(ut,{className:"w-full sm:w-36","aria-label":"Filter by status",children:e.jsx(dt,{})}),e.jsxs(mt,{children:[e.jsx(G,{value:ve,children:"Active"}),e.jsx(G,{value:"verified",children:"Verified"}),e.jsx(G,{value:"staging",children:"Staging"}),e.jsx(G,{value:"superseded",children:"Superseded"}),e.jsx(G,{value:"dormant",children:"Dormant"})]})]}),e.jsxs(ct,{value:l||ve,onValueChange:f=>F({pinned:f===ve?"":f}),children:[e.jsx(ut,{className:"w-full sm:w-32","aria-label":"Filter by pinned",children:e.jsx(dt,{})}),e.jsxs(mt,{children:[e.jsx(G,{value:ve,children:"Any pin"}),e.jsx(G,{value:"1",children:"Pinned"}),e.jsx(G,{value:"0",children:"Not pinned"})]})]})]})]}),e.jsx("div",{className:"mb-2 flex min-h-8 flex-wrap items-center gap-2 text-sm text-muted-foreground",children:h.size>0?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"font-medium text-foreground",children:[h.size," selected"]}),e.jsxs(I,{size:"xs",variant:"outline",onClick:()=>C(W,!0),children:[e.jsx(Gt,{"aria-hidden":!0})," Pin"]}),e.jsxs(I,{size:"xs",variant:"outline",onClick:()=>C(W,!1),children:[e.jsx(er,{"aria-hidden":!0})," Unpin"]}),e.jsxs(I,{size:"xs",variant:"outline",className:"text-risk",onClick:()=>_({title:`Forget ${Ne(W.length,"memory","memories")}?`,description:"They stop being recalled by agents and move to history (superseded). You can undo for 6 seconds.",confirmLabel:"Forget",destructive:!0,onConfirm:()=>{S(W),g(new Set)}}),children:[e.jsx(sr,{"aria-hidden":!0})," Forget"]}),e.jsx(I,{size:"xs",variant:"ghost",onClick:()=>g(new Set),children:"Clear selection"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("span",{"aria-live":"polite",children:[L.isPlaceholderData&&L.isFetching?"Searching… · ":"",L.data?Ne(L.data.total,"memory","memories"):"…",L.data&&L.data.mode==="search"?` matching "${L.data.query}"`:"",L.data?` · ${L.data.tookMs} ms`:""]}),V&&e.jsxs(I,{size:"xs",variant:"ghost",onClick:()=>{d(""),le("memories",t.id,{})},children:[e.jsx(Zt,{"aria-hidden":!0})," Clear filters"]})]})}),L.isLoading?e.jsx(Te,{rows:8}):L.isError?e.jsx($e,{error:L.error,onRetry:()=>L.refetch()}):B.length===0?e.jsx(Ue,{icon:V?xt:ps,title:V?"No memories match":"No memories yet",action:V?e.jsx(I,{variant:"outline",size:"sm",onClick:()=>{d(""),le("memories",null,{})},children:"Clear filters"}):void 0,children:V?"Try fewer words or remove a filter. Search matches whole words in titles, content and modules.":"Agents record memories with fastr_remember and fastr_trap_log. You can also add one with New memory."}):e.jsxs("div",{className:b("overflow-hidden rounded-xl border bg-card transition-opacity",L.isPlaceholderData&&L.isFetching&&"opacity-60"),"aria-busy":L.isFetching,children:[e.jsxs("div",{role:"row",className:"grid grid-cols-[2rem_minmax(0,1fr)_5.5rem] items-center gap-3 border-b bg-muted/40 px-3 py-2 text-xs font-medium text-muted-foreground md:grid-cols-[2rem_minmax(0,1fr)_8rem_6rem_5rem_4.5rem_6.5rem]",children:[e.jsx(js,{checked:H?!0:h.size>0?"indeterminate":!1,onCheckedChange:f=>g(f?new Set(B.map(M=>M.id)):new Set),"aria-label":"Select all memories"}),e.jsx(_t,{label:m.key==="relevance"&&n?"Title (by relevance)":"Title",k:"title",sort:m,onSort:U}),e.jsx(_t,{label:"Module",k:"module",sort:m,onSort:U,className:"hidden md:inline-flex"}),e.jsx("span",{className:"hidden md:block",children:"Status"}),e.jsx(_t,{label:"Reward",k:"reward",sort:m,onSort:U,className:"hidden md:inline-flex"}),e.jsx(_t,{label:"Recalls",k:"recalls",sort:m,onSort:U,className:"hidden md:inline-flex"}),e.jsx(_t,{label:"Created",k:"created",sort:m,onSort:U,className:"justify-self-end"})]}),e.jsx("div",{ref:q,className:b(K&&"max-h-[70vh] overflow-y-auto"),children:e.jsx("ul",{style:K?{height:B.length*St,position:"relative"}:void 0,children:T.map((f,M)=>e.jsxs("li",{style:K?{position:"absolute",top:(ge.start+M)*St,left:0,right:0,height:St}:void 0,className:b("grid grid-cols-[2rem_minmax(0,1fr)_5.5rem] items-center gap-3 border-b px-3 py-2.5 text-sm last:border-b-0 md:grid-cols-[2rem_minmax(0,1fr)_8rem_6rem_5rem_4.5rem_6.5rem]",h.has(f.id)&&"bg-accent/50",f.kind==="error_trap"&&"border-l-2 border-l-trap"),children:[e.jsx(js,{checked:h.has(f.id),onCheckedChange:()=>j(f.id),"aria-label":`Select ${f.title}`}),e.jsxs("button",{type:"button",onClick:()=>De(f.id),className:"flex min-w-0 items-center gap-2 rounded-sm text-left outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:[e.jsx(jt,{kind:f.kind,className:"shrink-0"}),f.pinned?e.jsx(Gt,{className:"size-3.5 shrink-0 text-pinned","aria-label":"Pinned"}):null,e.jsx("span",{className:"truncate font-medium hover:underline",children:f.title})]}),e.jsx("span",{className:"hidden truncate font-mono text-xs text-muted-foreground md:block",children:f.module}),e.jsx("span",{className:"hidden md:block",children:e.jsx(Rt,{status:f.status})}),e.jsx("span",{className:b("hidden font-mono text-xs tabular-nums md:block",f.reward_score<1?"text-risk":"text-muted-foreground"),children:ts(f.reward_score)}),e.jsx("span",{className:"hidden font-mono text-xs text-muted-foreground tabular-nums md:block",children:f.retrieval_count}),e.jsx("span",{className:"justify-self-end text-xs whitespace-nowrap text-muted-foreground",children:Ae(f.created_at)})]},f.id))})})]})]})}const Mt="(not linked to a file)";function Cd({t}){return e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>De(t.id),className:"flex w-full min-w-0 flex-col gap-1 rounded-md px-3 py-2.5 text-left outline-none hover:bg-accent/60 focus-visible:ring-2 focus-visible:ring-ring/50",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(Dt,{className:"size-4 shrink-0 text-trap","aria-hidden":!0}),e.jsx("span",{className:"truncate text-sm font-medium",children:t.title}),e.jsx("span",{className:"ml-auto shrink-0",children:e.jsx(Rt,{status:t.status})})]}),e.jsx("span",{className:"line-clamp-2 pl-6 text-xs text-muted-foreground",children:t.content}),e.jsxs("span",{className:"pl-6 font-mono text-[11px] text-muted-foreground",children:[t.module," · reward ",ts(t.reward_score)," · ",Ae(t.created_at)]})]})})}function Sd(){const s=st().query.get("files")??"",n=p.useMemo(()=>s.split(",").map(i=>i.trim()).filter(Boolean),[s]),[r,a]=p.useState(s.replace(/,/g,`
329
+ `)),[o,l]=p.useState(!1),c=Cc(n),d=p.useMemo(()=>{const i=new Map;for(const h of c.data?.traps??[]){const g=n.length>0?h.matched_files.length?h.matched_files:[Mt]:h.linked_files.length?h.linked_files:[Mt];for(const C of g){const S=i.get(C)??[];S.push(h),i.set(C,S)}}return[...i.entries()].sort((h,g)=>h[0]===Mt?1:g[0]===Mt?-1:g[1].length-h[1].length||h[0].localeCompare(g[0]))},[c.data,n]),u=i=>{i.preventDefault();const h=r.split(/[\n,]/).map(g=>g.trim()).filter(Boolean);le("traps",null,{files:h.join(",")})},m=c.data?.traps.length??0;return e.jsxs("div",{children:[e.jsx(Nr,{open:o,onOpenChange:l,defaultKind:"error_trap"}),e.jsx(Ye,{icon:Dt,title:"Error traps",description:e.jsxs(e.Fragment,{children:["Bugs agents already hit and how they were fixed. ",e.jsx(fe,{k:"trap",children:"Traps"})," are checked before an agent edits a linked file (fastr_trap_recall and the PreToolUse hook)."]}),actions:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>l(!0),children:[e.jsx(_s,{"aria-hidden":!0})," Log a trap"]})}),e.jsxs(re,{className:"mb-5",children:[e.jsxs(ce,{children:[e.jsxs(de,{className:"flex items-center gap-2 text-base",children:[e.jsx(el,{className:"size-4 text-muted-foreground","aria-hidden":!0})," Check files before editing"]}),e.jsx(Fe,{children:"The same lookup an agent runs before it edits these files. One path per line, relative to the project root."})]}),e.jsxs(ae,{children:[e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(We,{value:r,onChange:i=>a(i.target.value),placeholder:"src/auth/jwt.ts, src/db/schema.ts","aria-label":"Files to check",className:"font-mono"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(I,{type:"submit",children:"Check"}),n.length>0&&e.jsxs(I,{type:"button",variant:"ghost",onClick:()=>{a(""),le("traps")},children:[e.jsx(Zt,{"aria-hidden":!0})," Show all"]})]})]}),n.length>0&&c.data&&e.jsx("p",{className:`mt-3 text-sm ${m>0?"text-trap":"text-success"}`,role:"status",children:m>0?`${Ne(m,"trap")} protect ${Ne(n.length,"file")}. Read them before editing.`:`No active traps for ${Ne(n.length,"file")}. Safe to edit.`})]})]}),c.isLoading||c.isFetching&&m===0?e.jsx(Te,{rows:6}):c.isError?e.jsx($e,{error:c.error,onRetry:()=>c.refetch()}):m===0?e.jsx(Ue,{icon:Ms,title:n.length?"No traps for these files":"No error traps yet",children:n.length?"Nothing recorded for these paths. Paths must match how traps were linked (project-relative, forward slashes).":"When an agent diagnoses a bug it calls fastr_trap_log, and the lesson shows up here with the files it protects."}):e.jsx("div",{className:"grid gap-4 lg:grid-cols-2",children:d.map(([i,h])=>e.jsxs(re,{className:"min-w-0 gap-2 py-4",children:[e.jsx(ce,{className:"px-4",children:e.jsxs(de,{className:"flex min-w-0 items-center gap-2 text-sm",children:[e.jsx(Xn,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),e.jsx("span",{className:`truncate font-mono ${i===Mt?"text-muted-foreground italic":""}`,children:i}),e.jsx("span",{className:"ml-auto shrink-0 font-mono text-xs text-trap",children:h.length})]})}),e.jsx(ae,{className:"px-1",children:e.jsx("ul",{children:h.map(g=>e.jsx(Cd,{t:g},`${i}-${g.id}`))})})]},i))})]})}function _d(){const t=kr(),s=t.data??[];return e.jsxs("div",{children:[e.jsx(Ye,{icon:Jt,title:"Conflicts",description:e.jsxs(e.Fragment,{children:["Pairs of active memories that contradict each other. Agents may follow either one until you decide."," ",e.jsx(fe,{k:"conflict",children:"How resolution works"})]})}),t.isLoading||t.isFetching&&s.length===0?e.jsx(Te,{rows:4}):t.isError?e.jsx($e,{error:t.error,onRetry:()=>t.refetch()}):s.length===0?e.jsx(Ue,{icon:Ms,title:"No open conflicts",children:"FastrMemory compares each new memory with recent ones in the same module. Contradictions show up here with a word-level diff."}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mb-3 text-sm text-muted-foreground","aria-live":"polite",children:Ne(s.length,"open conflict")}),e.jsx("div",{className:"flex flex-col gap-4",children:s.map(n=>e.jsx($r,{conflict:n},n.id))})]})]})}const Md={integrity:"Back up .fastr/fastr.db, then run `fastrmemory heal`. If integrity errors remain, restore from a snapshot.",fts5:'The keyword index is out of sync with memories. "Heal" rebuilds it from the memories table.',file_links:'Some file links point to memories that no longer exist. "Heal" removes the dangling links.',actions:'Some action dependencies reference missing actions. "Heal" prunes the broken edges.',storage:'Write-ahead log or storage issue. "Heal" checkpoints the WAL and reclaims space.'};function zd({severity:t}){return t==="error"?e.jsx(Ri,{className:"size-4 shrink-0 text-risk","aria-label":"Error"}):t==="warning"?e.jsx(It,{className:"size-4 shrink-0 text-trap","aria-label":"Warning"}):e.jsx(hl,{className:"size-4 shrink-0 text-brand","aria-label":"Info"})}function Ed(){const t=zc(),s=ws(),n=En({mutationFn:o=>Q.heal(o),onSuccess:o=>{o.dryRun?ie.info(o.actionsTaken.length?`Heal would: ${o.actionsTaken.join(" · ")}`:"Nothing to heal."):(ie.success(`Healed ${o.fixedCount} issue${o.fixedCount===1?"":"s"}`,{description:o.remainingIssues?`${o.remainingIssues} issue(s) need manual attention.`:"Database is consistent."}),s.invalidateQueries())},onError:o=>ie.error("Heal failed",{description:o.message})}),r=t.data,a=r?.report;return e.jsxs("div",{children:[e.jsx(Ye,{icon:Qn,title:"Health",description:"Integrity of the SQLite store, the keyword index, file links and the action graph, plus search coverage.",actions:e.jsxs(e.Fragment,{children:[e.jsxs(I,{variant:"outline",size:"sm",onClick:()=>t.refetch(),disabled:t.isFetching,children:[t.isFetching?e.jsx(xs,{className:"animate-spin","aria-hidden":!0}):e.jsx(Hl,{"aria-hidden":!0})," Re-run diagnosis"]}),e.jsx(I,{variant:"outline",size:"sm",onClick:()=>n.mutate(!0),disabled:n.isPending||!a,children:"Preview heal"}),e.jsxs(I,{size:"sm",onClick:()=>n.mutate(!1),disabled:n.isPending||!a||a.fixableIssues===0,children:[n.isPending?e.jsx(xs,{className:"animate-spin","aria-hidden":!0}):e.jsx(Ql,{"aria-hidden":!0})," Heal"]})]})}),t.isLoading?e.jsx(Te,{rows:6}):t.isError?e.jsx($e,{error:t.error,onRetry:()=>t.refetch()}):r&&a?e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("div",{role:"status",className:`flex items-center gap-3 rounded-xl border p-4 ${a.healthy?"border-success/40 bg-success-weak":"border-trap/40 bg-trap-weak"}`,children:[a.healthy?e.jsx($i,{className:"size-5 text-success","aria-hidden":!0}):e.jsx(It,{className:"size-5 text-trap","aria-hidden":!0}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium",children:a.healthy?"All checks passed":`${a.totalIssues} issue${a.totalIssues===1?"":"s"} found`}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Checked ",Kt(a.timestamp)," · ",a.fixableIssues," fixable automatically"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[e.jsx(ke,{label:"Memories",value:a.metrics.memoryCount,hint:`${a.metrics.ftsRowCount} keyword index rows`}),e.jsx(ke,{label:e.jsx(fe,{k:"embedding",children:"Embedding coverage"}),value:`${r.status.embeddingCoveragePercent}%`,tone:r.status.embeddingCoveragePercent>0?"success":"default",hint:r.status.embeddingCoveragePercent===0?"Keyword + graph search only":"Vector search active"}),e.jsx(ke,{label:e.jsx(fe,{k:"spool",children:"Write spool"}),value:r.status.pendingSpoolCount,tone:r.status.pendingSpoolCount>0?"trap":"success",hint:r.status.pendingSpoolCount>0?"Queued while the DB was locked":"Nothing queued"}),e.jsx(ke,{label:"Journal mode",value:a.metrics.walMode.toUpperCase(),hint:`${a.metrics.fileLinkCount} file links`})]}),e.jsxs(re,{children:[e.jsxs(ce,{children:[e.jsx(de,{children:"Issues"}),e.jsx(Fe,{children:'Each issue lists a suggested fix. "Heal" applies the safe automatic repairs.'})]}),e.jsx(ae,{children:a.issues.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No issues."}):e.jsx("ul",{className:"flex flex-col gap-3",children:a.issues.map((o,l)=>e.jsxs("li",{className:"rounded-lg border p-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(zd,{severity:o.severity}),e.jsx("span",{className:"text-sm font-medium",children:o.description}),e.jsx(te,{variant:"muted",className:"font-mono text-[10px]",children:o.category}),o.affectedCount>0&&e.jsxs(te,{variant:"outline",children:[o.affectedCount," affected"]}),o.fixable&&e.jsx(te,{variant:"success",children:"auto-fixable"})]}),e.jsx("p",{className:"mt-1.5 pl-6 text-xs text-muted-foreground",children:Md[o.category]})]},l))})})]}),n.data&&!n.data.dryRun&&n.data.actionsTaken.length>0&&e.jsxs(re,{children:[e.jsx(ce,{children:e.jsx(de,{children:"Last heal"})}),e.jsx(ae,{children:e.jsx("ul",{className:"list-disc pl-5 text-sm",children:n.data.actionsTaken.map((o,l)=>e.jsx("li",{children:o},l))})})]}),e.jsxs(re,{children:[e.jsx(ce,{children:e.jsxs(de,{className:"flex items-center gap-2",children:[e.jsx(Yi,{className:"size-4 text-muted-foreground","aria-hidden":!0})," Storage"]})}),e.jsxs(ae,{className:"flex flex-col gap-2 text-sm",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"shrink-0 text-muted-foreground",children:"Database"}),e.jsx("code",{className:"min-w-0 truncate font-mono text-xs",children:r.dbPath}),e.jsx(bt,{text:r.dbPath,description:"Copy database path",variant:"ghost"})]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"shrink-0 text-muted-foreground",children:"Spool file"}),e.jsx("code",{className:"min-w-0 truncate font-mono text-xs",children:r.spool.path})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["CLI equivalents: ",e.jsx("code",{className:"font-mono",children:"fastrmemory diagnose"})," and ",e.jsx("code",{className:"font-mono",children:"fastrmemory heal"}),"."]})]})]})]}):null]})}const Td=[{value:"light",label:"Light",icon:zs},{value:"dark",label:"Dark",icon:Ss},{value:"system",label:"System",icon:Zn}];function Ad(t,s){const n=new Blob([JSON.stringify(s,null,2)],{type:"application/json"}),r=URL.createObjectURL(n),a=document.createElement("a");a.href=r,a.download=t,document.body.appendChild(a),a.click(),a.remove(),setTimeout(()=>URL.revokeObjectURL(r),1e3)}function $d(){const{mode:t,setMode:s}=Qt(),n=$s(),r=vt(),a=jr(),o=r.data,l=o?JSON.stringify({mcpServers:{fastrmemory:o.mcp}},null,2):"Loading MCP config…";return e.jsxs("div",{className:"flex max-w-3xl flex-col gap-4",children:[e.jsx(Ye,{icon:tr,title:"Settings",description:"Dashboard preferences are stored in this browser only."}),e.jsxs(re,{children:[e.jsx(ce,{children:e.jsx(de,{children:"Appearance"})}),e.jsx(ae,{children:e.jsx("div",{role:"radiogroup","aria-label":"Theme",className:"grid grid-cols-3 gap-2",children:Td.map(c=>e.jsxs("button",{type:"button",role:"radio","aria-checked":t===c.value,onClick:()=>s(c.value),className:b("flex flex-col items-center gap-2 rounded-lg border p-3 text-sm outline-none transition-colors hover:bg-accent/50 focus-visible:ring-[3px] focus-visible:ring-ring/50",t===c.value&&"border-brand bg-brand-weak"),children:[e.jsx(c.icon,{className:"size-5","aria-hidden":!0}),c.label]},c.value))})})]}),e.jsxs(re,{children:[e.jsxs(ce,{children:[e.jsx(de,{children:"Live updates"}),e.jsx(Fe,{children:"Agents write through their own MCP server process, so the dashboard polls the database version to pick up their changes."})]}),e.jsxs(ae,{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(js,{id:"live-polling",checked:n.pollingEnabled,onCheckedChange:c=>n.setPollingEnabled(!!c)}),e.jsx(Ze,{htmlFor:"live-polling",children:"Watch for changes from agents and the CLI"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx(Ze,{htmlFor:"live-interval",children:"Check every"}),e.jsxs(ct,{value:String(n.intervalMs),onValueChange:c=>n.setIntervalMs(Number(c)),disabled:!n.pollingEnabled,children:[e.jsx(ut,{id:"live-interval",className:"w-32",children:e.jsx(dt,{})}),e.jsxs(mt,{children:[e.jsx(G,{value:"1000",children:"1 second"}),e.jsx(G,{value:"2000",children:"2 seconds"}),e.jsx(G,{value:"5000",children:"5 seconds"}),e.jsx(G,{value:"15000",children:"15 seconds"})]})]}),e.jsxs(I,{variant:"outline",size:"sm",onClick:n.resync,children:[e.jsx(yt,{"aria-hidden":!0})," Resync now"]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Status: ",n.health," · stream ",n.sse,n.lastSyncAt?` · last check ${Ae(new Date(n.lastSyncAt).toISOString())}`:""]})]})]}),e.jsxs(re,{children:[e.jsx(ce,{children:e.jsx(de,{children:"Project"})}),e.jsxs(ae,{className:"flex flex-col gap-2 text-sm",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"w-24 shrink-0 text-muted-foreground",children:"Name"}),e.jsx("span",{className:"truncate",children:o?.projectName??"…"})]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"w-24 shrink-0 text-muted-foreground",children:"Project ID"}),e.jsx("code",{className:"truncate font-mono text-xs",children:o?.projectId??"…"}),o&&e.jsx(bt,{text:o.projectId,description:"Copy project ID",variant:"ghost"})]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"w-24 shrink-0 text-muted-foreground",children:"Project root"}),e.jsx("code",{className:"min-w-0 truncate font-mono text-xs",children:o?.projectRoot??"…"})]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"w-24 shrink-0 text-muted-foreground",children:"Database"}),e.jsx("code",{className:"min-w-0 truncate font-mono text-xs",children:o?.dbPath??"…"})]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"w-24 shrink-0 text-muted-foreground",children:"Server version"}),e.jsx("code",{className:"font-mono text-xs",children:o?.version??"…"})]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"w-24 shrink-0 text-muted-foreground",children:"MCP source"}),e.jsx("span",{className:"text-xs",children:o?.mcpSource==="source"?"Source checkout":o?.mcpSource==="installed"?"Installed CLI":o?.mcpSource==="registry"?"npm registry":"…"})]}),o?.isHomeProject&&e.jsxs("div",{className:"mt-2 flex gap-2 rounded-md border border-amber-500/40 bg-amber-500/10 p-3 text-xs text-amber-900 dark:text-amber-200",children:[e.jsx(It,{className:"mt-0.5 size-4 shrink-0 text-amber-500","aria-hidden":!0}),e.jsxs("div",{children:["This dashboard is running from your home directory. Stop it and run"," ",e.jsx("code",{className:"font-mono",children:"fastr ui"})," from the repository root; otherwise MCP clients will store memories in ",e.jsx("code",{className:"font-mono",children:o.dbPath}),"."]})]}),e.jsx("div",{className:"mt-2",children:e.jsxs(I,{variant:"outline",size:"sm",disabled:!a.data,onClick:()=>Ad(`fastrmemory-${o?.projectName??"export"}-memories.json`,a.data),children:[e.jsx(Qi,{"aria-hidden":!0})," Export active memories (JSON)"]})})]})]}),e.jsxs(re,{children:[e.jsxs(ce,{children:[e.jsx(de,{children:"Connect an agent"}),e.jsxs(Fe,{children:["Run ",e.jsx("code",{className:"font-mono",children:"fastr mcp init --client <client> --scope project"})," in this repository, or copy this config. ",e.jsx("code",{className:"font-mono",children:"fastr setup"})," also installs skills and"," ",e.jsx("code",{className:"font-mono",children:"AGENTS.md"}),"; ",e.jsx("code",{className:"font-mono",children:"fastr hook install"})," adds lifecycle hooks."]})]}),e.jsxs(ae,{children:[e.jsxs("div",{className:"relative",children:[e.jsx("pre",{className:"overflow-x-auto rounded-lg border bg-muted/50 p-3 font-mono text-xs",children:l}),o&&e.jsx(bt,{text:l,description:"Copy MCP config",variant:"ghost",className:"absolute top-2 right-2"})]}),e.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:["Uses the source checkout when the dashboard runs from the repo, the installed CLI when launched from a global install, and the pinned npm package in an ephemeral npx environment. On Windows the registry config uses ",e.jsx("code",{className:"font-mono",children:"cmd /c npx"}),". Add ",e.jsx("code",{className:"font-mono",children:"--profile core"})," ","before ",e.jsx("code",{className:"font-mono",children:"--project"})," for the smaller 12-tool surface."]})]})]})]})}const yn=[{key:"rankA",label:"BM25",className:"bg-brand"},{key:"rankB",label:"Vector",className:"bg-success"},{key:"rankC",label:"Graph",className:"bg-pinned"}];function Dd({rank:t}){return t>0?e.jsxs("span",{className:"font-mono tabular-nums",children:["#",t]}):e.jsx("span",{className:"text-muted-foreground",children:"—"})}function Id(){const s=st().query.get("q")??"",[n,r]=p.useState(s),a=As(n.trim(),300),o=Mc(a);p.useEffect(()=>{a!==s&&le("search",null,{q:a})},[a]);const l=o.data?.results??[],c=Math.max(...l.map(d=>d.score),1e-4);return e.jsxs("div",{children:[e.jsx(Ye,{icon:sn,title:"Search Lab",description:e.jsxs(e.Fragment,{children:["See exactly how recall ranks memories for a query: each stream's rank and the fused ",e.jsx(fe,{k:"rrf",children:"RRF"})," score, including the trap and verified boosts."]})}),e.jsxs("div",{className:"relative mb-4",children:[e.jsx(xt,{className:"pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground","aria-hidden":!0}),e.jsx(We,{value:n,onChange:d=>r(d.target.value),placeholder:"Type a query an agent might ask, e.g. jwt expiration","aria-label":"Query",className:"pl-9",autoFocus:!0})]}),a?o.isLoading?e.jsx(Te,{rows:5}):o.isError?e.jsx($e,{error:o.error,onRetry:()=>o.refetch()}):l.length===0?e.jsx(Ue,{icon:xt,title:"No memory matched",children:"None of the streams found a match. Agents would get an empty recall for this query."}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"mb-2 text-sm text-muted-foreground","aria-live":"polite",children:[l.length," result",l.length===1?"":"s"," · ",o.data?.totalTimeMs," ms end to end · ~",o.data?.totalTokens," tokens returned to the agent"]}),e.jsx("div",{className:"overflow-x-auto rounded-xl border bg-card",children:e.jsxs("table",{className:"w-full min-w-[640px] text-sm",children:[e.jsx("thead",{className:"border-b bg-muted/40 text-xs text-muted-foreground",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"#"}),e.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Memory"}),yn.map(d=>e.jsx("th",{className:"px-3 py-2 text-left font-medium",children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:`size-2 rounded-full ${d.className}`,"aria-hidden":!0}),d.label]})},d.key)),e.jsx("th",{className:"w-48 px-3 py-2 text-left font-medium",children:"Fused score"})]})}),e.jsx("tbody",{children:l.map((d,u)=>e.jsxs("tr",{className:"border-b last:border-b-0",children:[e.jsx("td",{className:"px-3 py-2.5 font-mono text-xs text-muted-foreground",children:u+1}),e.jsx("td",{className:"w-full max-w-0 px-3 py-2.5",children:e.jsxs("button",{type:"button",onClick:()=>De(d.id),className:"flex w-full min-w-0 max-w-full items-center gap-2 rounded-sm text-left outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring/50",children:[e.jsx(jt,{kind:d.kind,className:"shrink-0"}),e.jsx("span",{className:"truncate",children:d.title})]})}),yn.map(m=>e.jsx("td",{className:"px-3 py-2.5 text-xs",children:e.jsx(Dd,{rank:d[m.key]})},m.key)),e.jsx("td",{className:"px-3 py-2.5",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-1.5 flex-1 overflow-hidden rounded-full bg-muted","aria-hidden":!0,children:e.jsx("div",{className:"h-full rounded-full bg-brand",style:{width:`${d.score/c*100}%`}})}),e.jsx("span",{className:"w-14 text-right font-mono text-xs tabular-nums",children:d.score.toFixed(4)})]})})]},d.id))})]})})]}):e.jsx(Ue,{icon:sn,title:"Enter a query",children:"Results show which of the three streams (keywords, vectors, file graph) found each memory and the final ranking agents receive."})]})}const pt=8;function lt({label:t,value:s,hint:n}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] font-medium text-muted-foreground",children:t}),e.jsx("div",{className:"mt-0.5 font-mono text-sm tabular-nums",children:s}),n&&e.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:n})]})}function vn({label:t,snapshot:s}){return e.jsxs(re,{children:[e.jsxs(ce,{children:[e.jsxs(de,{className:"flex items-center gap-2",children:[e.jsx(ft,{className:"size-4 text-brand","aria-hidden":!0}),t]}),e.jsxs(Fe,{children:[e.jsx("span",{className:"font-mono text-xs",children:s.at}),e.jsx("span",{className:"ml-2 text-xs",children:Kt(s.at)})]})]}),e.jsxs(ae,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[e.jsx(lt,{label:"Active",value:String(s.active.length)}),e.jsx(lt,{label:"History",value:String(s.historyCount)}),e.jsx(lt,{label:"Events",value:s.eventCount.toLocaleString()}),e.jsx(lt,{label:"Conflicts",value:String(s.conflictCount)})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 border-t pt-3",children:[e.jsx(lt,{label:"Tokens",value:s.tokenCount.toLocaleString()}),e.jsx(lt,{label:"Content hash",value:s.contentHash.slice(0,12),hint:s.contentHash})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-[11px] font-medium tracking-wide text-muted-foreground uppercase",children:"Active set"}),s.active.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No active memories at this timestamp."}):e.jsx("ul",{className:"space-y-1.5",children:s.active.slice(0,pt).map(n=>e.jsxs("li",{className:"flex min-w-0 items-center gap-2 rounded-md border bg-muted/20 px-2 py-1.5",children:[e.jsx(te,{variant:"outline",className:"shrink-0 font-mono text-[10px]",children:n.kind}),e.jsx("span",{className:"truncate text-sm",children:n.title}),e.jsx("span",{className:"ml-auto shrink-0 font-mono text-[10px] text-muted-foreground",children:n.module})]},n.id))}),s.active.length>pt&&e.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:["+",s.active.length-pt," more active memories"]})]})]})]})}function Ld({entries:t,empty:s}){return t.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:s}):e.jsxs(e.Fragment,{children:[e.jsx("ul",{className:"space-y-1.5",children:t.slice(0,pt).map(n=>e.jsxs("li",{className:"flex min-w-0 items-center gap-2 rounded-md border bg-muted/20 px-2 py-1.5",children:[e.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:n.id}),e.jsx("span",{className:"truncate text-sm",children:n.title}),e.jsx(te,{variant:"muted",className:"ml-auto shrink-0 font-mono text-[10px]",children:n.kind}),e.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:n.module})]},n.id))}),t.length>pt&&e.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:["+",t.length-pt," more"]})]})}function Ht({title:t,icon:s,entries:n,empty:r}){return e.jsxs(re,{children:[e.jsx(ce,{children:e.jsxs(de,{className:"flex items-center gap-2",children:[e.jsx(s,{className:"size-4 text-muted-foreground","aria-hidden":!0}),t,e.jsx(te,{variant:"muted",children:n.length})]})}),e.jsx(ae,{children:e.jsx(Ld,{entries:n,empty:r})})]})}function Rd({data:t,isLoading:s=!1,error:n,onRetry:r}){if(s)return e.jsx(Te,{rows:8});if(n)return e.jsx($e,{error:n,onRetry:r});if(!t)return e.jsx(Ue,{icon:ft,title:"Choose a replay window",children:"Pick a start and end timestamp to reconstruct the active memory set at each point and compare what changed."});if(!(t.from.active.length>0||t.to.active.length>0||t.diff.added.length>0||t.diff.superseded.length>0||t.diff.stillActive.length>0||t.diff.changed.length>0||t.diff.conflicts.length>0))return e.jsx(Ue,{icon:ft,title:"No memories in this window",children:"No active memories existed at either timestamp. Move the range or add memories first."});const o=t.diff.tokenDelta,l=`${o>=0?"+":""}${o.toLocaleString()}`;return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[e.jsx(ke,{label:"Token delta",value:l,hint:o===0?"No token change":o>0?"The active set grew":"The active set shrank",tone:o>0?"brand":o<0?"risk":"default"}),e.jsx(ke,{label:"Added memories",value:String(t.diff.added.length),hint:"Present in the end snapshot only"}),e.jsx(ke,{label:"Open conflicts",value:String(t.diff.conflicts.length),hint:"Both sides active at the end",tone:t.diff.conflicts.length>0?"risk":"default"})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsx(vn,{label:"Start snapshot",snapshot:t.from}),e.jsx(vn,{label:"End snapshot",snapshot:t.to})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 pt-1",children:[e.jsxs("h2",{className:"flex items-center gap-2 text-base font-semibold",children:[e.jsx(fs,{className:"size-4 text-brand","aria-hidden":!0}),"Memory diff"]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[Ne(t.diff.added.length,"addition"),", ",Ne(t.diff.superseded.length,"supersession"),","," ",Ne(t.diff.changed.length,"change")]})]}),t.diff.newTrapIds.length>0&&e.jsxs("div",{className:"flex items-start gap-2 rounded-xl border border-trap/40 bg-trap-weak px-4 py-3 text-sm text-trap",role:"status",children:[e.jsx(Dt,{className:"mt-0.5 size-4 shrink-0","aria-hidden":!0}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"New error traps in the end snapshot"}),e.jsx("p",{className:"mt-0.5 font-mono text-xs",children:t.diff.newTrapIds.join(", ")})]})]}),e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsx(Ht,{title:"Added",icon:ki,entries:t.diff.added,empty:"No memories were added in this window."}),e.jsx(Ht,{title:"Superseded",icon:xi,entries:t.diff.superseded,empty:"No memories were superseded in this window."}),e.jsx(Ht,{title:"Changed",icon:fs,entries:t.diff.changed,empty:"No active memory changed its content or metadata."}),e.jsx(Ht,{title:"Still active",icon:ft,entries:t.diff.stillActive,empty:"No memories stayed active across both snapshots."})]}),e.jsxs(re,{children:[e.jsxs(ce,{children:[e.jsxs(de,{className:"flex items-center gap-2",children:[e.jsx(Jt,{className:"size-4 text-muted-foreground","aria-hidden":!0}),"Open conflicts",e.jsx(te,{variant:t.diff.conflicts.length>0?"risk":"muted",children:t.diff.conflicts.length})]}),e.jsx(Fe,{children:"Conflicts are open at the end snapshot and both memories are still active."})]}),e.jsx(ae,{children:t.diff.conflicts.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No open conflicts between active memories."}):e.jsx("ul",{className:"space-y-2",children:t.diff.conflicts.map(c=>e.jsxs("li",{className:"rounded-md border bg-muted/20 px-3 py-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:["#",c.id]}),e.jsx("span",{className:"text-sm",children:c.reason}),e.jsxs(te,{variant:"risk",className:"ml-auto font-mono text-[10px]",children:["score ",c.score]})]}),e.jsxs("p",{className:"mt-1 font-mono text-[10px] text-muted-foreground",children:[c.memoryAId," vs ",c.memoryBId]})]},c.id))})})]})]})}const Pd=1440*60*1e3;function Vt(t){return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,16)}function jn(t){const s=new Date;return{from:new Date(s.getTime()-t*Pd).toISOString(),to:s.toISOString()}}function Od(){const[t]=p.useState(()=>jn(7)),[s,n]=p.useState(()=>Vt(new Date(t.from))),[r,a]=p.useState(()=>Vt(new Date(t.to))),[o,l]=p.useState(t),[c,d]=p.useState(null),u=_c(o.from,o.to),m=()=>{const h=new Date(s),g=new Date(r);if(Number.isNaN(h.getTime())||Number.isNaN(g.getTime())){d("Enter a valid start and end timestamp.");return}if(h.getTime()>g.getTime()){d("The start timestamp must be before or equal to the end timestamp.");return}d(null),l({from:h.toISOString(),to:g.toISOString()})},i=h=>{const g=jn(h);n(Vt(new Date(g.from))),a(Vt(new Date(g.to))),d(null),l(g)};return e.jsxs("div",{children:[e.jsx(Ye,{icon:ft,title:"Replay & Diff",description:"Reconstruct the active memory set at two timestamps, inspect the snapshots, and review every addition, supersession, change, and open conflict between them.",actions:e.jsxs(I,{variant:"outline",size:"sm",onClick:()=>u.refetch(),disabled:u.isFetching,children:[e.jsx(yt,{className:u.isFetching?"animate-spin":void 0,"aria-hidden":!0}),"Refresh"]})}),e.jsx(re,{className:"mb-5",children:e.jsxs(ae,{className:"pt-5",children:[e.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-end",children:[e.jsxs("label",{className:"grid gap-1.5 text-xs font-medium text-muted-foreground",children:["From",e.jsx(We,{type:"datetime-local",value:s,onChange:h=>n(h.target.value),className:"w-full lg:w-[220px]"})]}),e.jsxs("label",{className:"grid gap-1.5 text-xs font-medium text-muted-foreground",children:["To",e.jsx(We,{type:"datetime-local",value:r,onChange:h=>a(h.target.value),className:"w-full lg:w-[220px]"})]}),e.jsxs(I,{onClick:m,disabled:u.isFetching,children:[e.jsx(fs,{"aria-hidden":!0}),"Compare"]}),e.jsxs("div",{className:"flex gap-2 lg:ml-auto",children:[e.jsx(I,{variant:"outline",size:"sm",onClick:()=>i(7),children:"7 days"}),e.jsx(I,{variant:"outline",size:"sm",onClick:()=>i(30),children:"30 days"})]})]}),c&&e.jsx("p",{className:"mt-2 text-sm text-risk",role:"alert",children:c}),e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Replay reads the bi-temporal columns directly. It does not write memories, events, or conflicts."})]})}),e.jsx(Rd,{data:u.data,isLoading:u.isLoading,error:u.isError?u.error:null,onRetry:()=>u.refetch()})]})}const Fd=p.lazy(()=>Xt(()=>import("./ActionsPage-CI-IRMeS.js"),__vite__mapDeps([0,1,2,3]))),Bd=p.lazy(()=>Xt(()=>import("./GraphPage-BdYMF7yz.js"),__vite__mapDeps([4,1,3,2]))),qd=p.lazy(()=>Xt(()=>import("./ObservatoryPage-BG_vg8B9.js"),__vite__mapDeps([5,1,6,2]))),Hd=p.lazy(()=>Xt(()=>import("./TreemapPage-CZreyyLA.js"),__vite__mapDeps([7,1,2]))),Vd={home:wd,memories:Nd,traps:Sd,conflicts:_d,actions:Fd,graph:Bd,observatory:qd,treemap:Hd,search:Id,replay:Od,health:Ed,settings:$d};function Wd(){const t=st(),s=Vd[t.name];return e.jsx(cd,{resetKey:t.name,children:e.jsx(p.Suspense,{fallback:e.jsx(Te,{rows:8}),children:e.jsx(s,{})})})}function Gd(){return p.useEffect(()=>{const t=()=>bc();return window.addEventListener("pagehide",t),()=>window.removeEventListener("pagehide",t)},[]),e.jsx(go,{children:e.jsx(La,{client:br,children:e.jsx(ui,{delayDuration:250,children:e.jsxs(Hc,{children:[e.jsx(Uc,{children:e.jsx(Wd,{})}),e.jsx(sd,{}),e.jsx(bo,{position:"bottom-right",closeButton:!0})]})})})})}Da.createRoot(document.getElementById("root")).render(e.jsx(x.StrictMode,{children:e.jsx(Gd,{})}));export{pl as A,I as B,re as C,$e as E,Xn as F,ol as G,We as I,xs as L,_l as O,Ye as P,Te as S,fe as T,Zt as X,b as a,Xd as b,N as c,Ue as d,Ol as e,te as f,Q as g,ce as h,de as i,ae as j,As as k,Qd as l,_i as m,le as n,De as o,Qt as p,Yd as q,Ae as r,jr as s,ie as t,st as u,kr as v,gt as w,Kc as x,Yc as y,ds as z};