morpheus-cli 0.9.3 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/http/routers/smiths.js +14 -4
- package/dist/runtime/oracle.js +5 -0
- package/dist/ui/assets/{AuditDashboard-C1f6Hbdw.js → AuditDashboard-DliJ1CX0.js} +1 -1
- package/dist/ui/assets/{Chat-5AeRYuRj.js → Chat-BNtutgja.js} +1 -1
- package/dist/ui/assets/{Chronos-BrKldYVw.js → Chronos-3C8RPZcl.js} +1 -1
- package/dist/ui/assets/{ConfirmationModal-DsbS3XkJ.js → ConfirmationModal-ZQPBeJ2Z.js} +1 -1
- package/dist/ui/assets/{Dashboard-DvrTXLdo.js → Dashboard-CqkHzr2F.js} +1 -1
- package/dist/ui/assets/{DeleteConfirmationModal-BfSjv04R.js → DeleteConfirmationModal-CioxFWn_.js} +1 -1
- package/dist/ui/assets/{Logs-B0ZYWs5x.js → Logs-DBVanS0O.js} +1 -1
- package/dist/ui/assets/{MCPManager-BwHGTeNs.js → MCPManager-vXfL3P2U.js} +1 -1
- package/dist/ui/assets/{ModelPricing-CYhGRQr8.js → ModelPricing-DyfdunLT.js} +1 -1
- package/dist/ui/assets/{Notifications-BYMAtVMq.js → Notifications-VL-vep6d.js} +1 -1
- package/dist/ui/assets/{SatiMemories-I1vsYtP2.js → SatiMemories-jaadkW0U.js} +1 -1
- package/dist/ui/assets/{SessionAudit-BCecQWde.js → SessionAudit-BsXrWlwz.js} +1 -1
- package/dist/ui/assets/{Settings-Cu4D-7tb.js → Settings-B4eezRcg.js} +1 -1
- package/dist/ui/assets/{Skills-lGU3I5DO.js → Skills-DE3zziXL.js} +1 -1
- package/dist/ui/assets/Smiths-pmogN1mU.js +1 -0
- package/dist/ui/assets/{Tasks-Bz92GPWK.js → Tasks-Bs8s34Jc.js} +1 -1
- package/dist/ui/assets/{TrinityDatabases-BUY-3j7Q.js → TrinityDatabases-D7uihcdp.js} +1 -1
- package/dist/ui/assets/{UsageStats-Dr5eSgJc.js → UsageStats-B9gePLZ0.js} +1 -1
- package/dist/ui/assets/{WebhookManager-DIASAC-1.js → WebhookManager-B2L3rCLM.js} +1 -1
- package/dist/ui/assets/{audit-CcAEDbZh.js → audit-Cggeu9mM.js} +1 -1
- package/dist/ui/assets/{chronos-2Z9E96_1.js → chronos-D3-sWhfU.js} +1 -1
- package/dist/ui/assets/{config-DdfK4DX6.js → config-CBqRUPgn.js} +1 -1
- package/dist/ui/assets/{index-Dpd1Mkgp.js → index-zKplfrXZ.js} +2 -2
- package/dist/ui/assets/{mcp-BWMt8aY7.js → mcp-uL1R9hyA.js} +1 -1
- package/dist/ui/assets/{skills-D7JjK7JH.js → skills-jmw8yTJs.js} +1 -1
- package/dist/ui/assets/{stats-DoIhtLot.js → stats-HOms6GnM.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/dist/ui/sw.js +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/Smiths-DnEH3nID.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,m}from"./vendor-motion-C3CZ8ZlO.js";import{r as o}from"./vendor-react-DikRIOlj.js";import{u as M}from"./vendor-utils-D4NnWbOU.js";import{h as u,D as j,d as z,e as v,j as N}from"./index-Dpd1Mkgp.js";import{i as F,a6 as E,w as I,z as R}from"./vendor-icons-DMd9RGvJ.js";const g={list:()=>u.get("/model-pricing"),upsert:a=>u.post("/model-pricing",a),update:(a,s,p)=>u.put(`/model-pricing/${encodeURIComponent(a)}/${encodeURIComponent(s)}`,p),delete:(a,s)=>u.delete(`/model-pricing/${encodeURIComponent(a)}/${encodeURIComponent(s)}`)},T={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.05}}},_={hidden:{opacity:0,y:10},show:{opacity:1,y:0}},A=["anthropic","openai","google","openrouter","ollama","other"],w=()=>({provider:"",model:"",input_price_per_1m:0,output_price_per_1m:0,audio_cost_per_second:null}),V=()=>{const{data:a=[],mutate:s}=M("/api/model-pricing",()=>g.list()),[p,n]=o.useState(!1),[l,b]=o.useState(null),[t,i]=o.useState(w()),[d,c]=o.useState(null),[h,y]=o.useState(null),[k,f]=o.useState(!1),x=(r,D)=>{y({type:r,message:D}),setTimeout(()=>y(null),3e3)},C=()=>{b(null),i(w()),n(!0)},$=r=>{b(r),i({...r}),n(!0)},S=async()=>{if(!(!t.provider.trim()||!t.model.trim())){f(!0);try{await g.upsert(t),await s(),n(!1),x("success",l?"Pricing updated.":"Pricing created.")}catch{x("error","Failed to save pricing entry.")}finally{f(!1)}}},P=async()=>{if(d)try{await g.delete(d.provider,d.model),await s(),c(null),x("success","Pricing entry deleted.")}catch{x("error","Failed to delete pricing entry.")}};return e.jsxs(m.div,{variants:T,initial:"hidden",animate:"show",className:"space-y-6",children:[e.jsxs(m.div,{variants:_,className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:e.jsx(F,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Model Pricing"}),e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary mt-0.5",children:"Manage per-model pricing to estimate LLM costs in Usage Stats."})]})]}),e.jsxs("button",{onClick:C,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-azure-primary dark:bg-matrix-primary text-white dark:text-matrix-highlight text-sm font-medium hover:opacity-90 transition-opacity",children:[e.jsx(E,{className:"w-4 h-4"})," Add Pricing"]})]}),h&&e.jsx(m.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},className:`px-4 py-3 rounded-lg text-sm font-medium border ${h.type==="success"?"bg-green-50 dark:bg-green-900/20 border-green-300 dark:border-green-700 text-green-800 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 border-red-300 dark:border-red-700 text-red-800 dark:text-red-400"}`,children:h.message}),e.jsx(m.div,{variants:_,className:"rounded-lg border border-azure-border dark:border-matrix-primary overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-azure-surface dark:bg-zinc-900 border-b border-azure-border dark:border-matrix-primary",children:e.jsx("tr",{children:["Provider","Model","Input ($/1M tokens)","Output ($/1M tokens)","Audio ($/s)","Actions"].map(r=>e.jsx("th",{className:"px-4 py-3 text-left font-semibold text-azure-text-secondary dark:text-matrix-secondary",children:r},r))})}),e.jsx("tbody",{children:a.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-4 py-8 text-center text-azure-text-secondary dark:text-matrix-secondary",children:'No pricing entries. Click "Add Pricing" to get started.'})}):a.map(r=>e.jsxs("tr",{className:"border-b border-azure-border dark:border-matrix-primary/30 hover:bg-azure-surface/50 dark:hover:bg-zinc-800/50 transition-colors",children:[e.jsx("td",{className:"px-4 py-3 text-azure-text-primary dark:text-matrix-text capitalize",children:r.provider}),e.jsx("td",{className:"px-4 py-3 font-mono text-azure-text-primary dark:text-matrix-highlight text-xs",children:r.model}),e.jsxs("td",{className:"px-4 py-3 text-azure-text-primary dark:text-matrix-text",children:["$",r.input_price_per_1m.toFixed(4)]}),e.jsxs("td",{className:"px-4 py-3 text-azure-text-primary dark:text-matrix-text",children:["$",r.output_price_per_1m.toFixed(4)]}),e.jsx("td",{className:"px-4 py-3 text-azure-text-primary dark:text-matrix-text",children:r.audio_cost_per_second!=null?`$${r.audio_cost_per_second.toFixed(6)}`:e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-secondary/40",children:"—"})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>$(r),className:"p-1.5 rounded hover:bg-azure-border dark:hover:bg-matrix-primary/30 text-azure-text-secondary dark:text-matrix-secondary hover:text-azure-primary dark:hover:text-matrix-highlight transition-colors",title:"Edit",children:e.jsx(I,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>c(r),className:"p-1.5 rounded hover:bg-red-50 dark:hover:bg-red-900/20 text-azure-text-secondary dark:text-matrix-secondary hover:text-red-600 dark:hover:text-red-400 transition-colors",title:"Delete",children:e.jsx(R,{className:"w-4 h-4"})})]})})]},`${r.provider}/${r.model}`))})]})}),e.jsx(j,{open:p,onOpenChange:n,children:e.jsxs(z,{children:[e.jsx(v,{children:e.jsx(N,{children:l?"Edit Pricing":"Add Pricing"})}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-azure-text-secondary dark:text-matrix-secondary mb-1",children:"Provider"}),l?e.jsx("p",{className:"px-3 py-2 rounded-lg bg-azure-bg dark:bg-zinc-900 text-azure-text-primary dark:text-matrix-secondary text-sm capitalize",children:t.provider}):e.jsxs("select",{value:t.provider,onChange:r=>i({...t,provider:r.target.value}),className:"w-full px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-black text-azure-text-primary dark:text-matrix-secondary text-sm focus:outline-none focus:ring-1 focus:ring-azure-primary dark:focus:ring-matrix-highlight focus:border-azure-primary dark:focus:border-matrix-highlight",children:[e.jsx("option",{value:"",children:"Select provider..."}),A.map(r=>e.jsx("option",{value:r,children:r},r))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-azure-text-secondary dark:text-matrix-secondary mb-1",children:"Model"}),l?e.jsx("p",{className:"px-3 py-2 rounded-lg bg-azure-bg dark:bg-zinc-900 text-azure-text-primary dark:text-matrix-secondary text-sm font-mono",children:t.model}):e.jsx("input",{type:"text",value:t.model,onChange:r=>i({...t,model:r.target.value}),placeholder:"e.g. gpt-4o",className:"w-full px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-black text-azure-text-primary dark:text-matrix-secondary text-sm focus:outline-none focus:ring-1 focus:ring-azure-primary dark:focus:ring-matrix-highlight focus:border-azure-primary dark:focus:border-matrix-highlight"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-azure-text-secondary dark:text-matrix-secondary mb-1",children:"Input price / 1M tokens ($)"}),e.jsx("input",{type:"number",min:0,step:.001,value:t.input_price_per_1m,onChange:r=>i({...t,input_price_per_1m:parseFloat(r.target.value)||0}),className:"w-full px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-black text-azure-text-primary dark:text-matrix-secondary text-sm focus:outline-none focus:ring-1 focus:ring-azure-primary dark:focus:ring-matrix-highlight focus:border-azure-primary dark:focus:border-matrix-highlight"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-azure-text-secondary dark:text-matrix-secondary mb-1",children:"Output price / 1M tokens ($)"}),e.jsx("input",{type:"number",min:0,step:.001,value:t.output_price_per_1m,onChange:r=>i({...t,output_price_per_1m:parseFloat(r.target.value)||0}),className:"w-full px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-black text-azure-text-primary dark:text-matrix-secondary text-sm focus:outline-none focus:ring-1 focus:ring-azure-primary dark:focus:ring-matrix-highlight focus:border-azure-primary dark:focus:border-matrix-highlight"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-azure-text-secondary dark:text-matrix-secondary mb-1",children:["Audio price / second ($)",e.jsx("span",{className:"ml-2 text-[11px] font-normal text-azure-text-secondary/60 dark:text-matrix-secondary/40",children:"for Whisper/audio-only models · leave blank for token-based"})]}),e.jsx("input",{type:"number",min:0,step:1e-6,placeholder:"e.g. 0.0001 (Whisper = $0.006/min)",value:t.audio_cost_per_second??"",onChange:r=>i({...t,audio_cost_per_second:r.target.value===""?null:parseFloat(r.target.value)}),className:"w-full px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-black text-azure-text-primary dark:text-matrix-secondary text-sm focus:outline-none focus:ring-1 focus:ring-azure-primary dark:focus:ring-matrix-highlight focus:border-azure-primary dark:focus:border-matrix-highlight placeholder-azure-text-secondary/40 dark:placeholder-matrix-secondary/30"})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:()=>n(!1),className:"px-4 py-2 rounded-lg border border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary text-sm hover:bg-azure-surface dark:hover:bg-zinc-800 transition-colors",children:"Cancel"}),e.jsx("button",{onClick:S,disabled:k||!t.provider.trim()||!t.model.trim(),className:"px-4 py-2 rounded-lg bg-azure-primary dark:bg-matrix-primary text-white dark:text-matrix-highlight text-sm font-medium hover:opacity-90 disabled:opacity-50 transition-opacity",children:k?"Saving...":"Save"})]})]})]})}),e.jsx(j,{open:!!d,onOpenChange:r=>!r&&c(null),children:e.jsxs(z,{children:[e.jsx(v,{children:e.jsx(N,{children:"Delete Pricing Entry"})}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("p",{className:"text-sm text-azure-text-primary dark:text-matrix-text",children:["Are you sure you want to delete the pricing for"," ",e.jsxs("span",{className:"font-mono font-semibold text-azure-primary dark:text-matrix-highlight",children:[d?.provider,"/",d?.model]}),"? This cannot be undone."]}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx("button",{onClick:()=>c(null),className:"px-4 py-2 rounded-lg border border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary text-sm hover:bg-azure-surface dark:hover:bg-zinc-800 transition-colors",children:"Cancel"}),e.jsx("button",{onClick:P,className:"px-4 py-2 rounded-lg bg-red-600 text-white text-sm font-medium hover:bg-red-700 transition-colors",children:"Delete"})]})]})]})})]})};export{V as ModelPricing};
|
|
1
|
+
import{j as e,m}from"./vendor-motion-C3CZ8ZlO.js";import{r as o}from"./vendor-react-DikRIOlj.js";import{u as M}from"./vendor-utils-D4NnWbOU.js";import{h as u,D as j,d as z,e as v,j as N}from"./index-zKplfrXZ.js";import{i as F,a6 as E,w as I,z as R}from"./vendor-icons-DMd9RGvJ.js";const g={list:()=>u.get("/model-pricing"),upsert:a=>u.post("/model-pricing",a),update:(a,s,p)=>u.put(`/model-pricing/${encodeURIComponent(a)}/${encodeURIComponent(s)}`,p),delete:(a,s)=>u.delete(`/model-pricing/${encodeURIComponent(a)}/${encodeURIComponent(s)}`)},T={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.05}}},_={hidden:{opacity:0,y:10},show:{opacity:1,y:0}},A=["anthropic","openai","google","openrouter","ollama","other"],w=()=>({provider:"",model:"",input_price_per_1m:0,output_price_per_1m:0,audio_cost_per_second:null}),V=()=>{const{data:a=[],mutate:s}=M("/api/model-pricing",()=>g.list()),[p,n]=o.useState(!1),[l,b]=o.useState(null),[t,i]=o.useState(w()),[d,c]=o.useState(null),[h,y]=o.useState(null),[k,f]=o.useState(!1),x=(r,D)=>{y({type:r,message:D}),setTimeout(()=>y(null),3e3)},C=()=>{b(null),i(w()),n(!0)},$=r=>{b(r),i({...r}),n(!0)},S=async()=>{if(!(!t.provider.trim()||!t.model.trim())){f(!0);try{await g.upsert(t),await s(),n(!1),x("success",l?"Pricing updated.":"Pricing created.")}catch{x("error","Failed to save pricing entry.")}finally{f(!1)}}},P=async()=>{if(d)try{await g.delete(d.provider,d.model),await s(),c(null),x("success","Pricing entry deleted.")}catch{x("error","Failed to delete pricing entry.")}};return e.jsxs(m.div,{variants:T,initial:"hidden",animate:"show",className:"space-y-6",children:[e.jsxs(m.div,{variants:_,className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:e.jsx(F,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Model Pricing"}),e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary mt-0.5",children:"Manage per-model pricing to estimate LLM costs in Usage Stats."})]})]}),e.jsxs("button",{onClick:C,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-azure-primary dark:bg-matrix-primary text-white dark:text-matrix-highlight text-sm font-medium hover:opacity-90 transition-opacity",children:[e.jsx(E,{className:"w-4 h-4"})," Add Pricing"]})]}),h&&e.jsx(m.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},className:`px-4 py-3 rounded-lg text-sm font-medium border ${h.type==="success"?"bg-green-50 dark:bg-green-900/20 border-green-300 dark:border-green-700 text-green-800 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 border-red-300 dark:border-red-700 text-red-800 dark:text-red-400"}`,children:h.message}),e.jsx(m.div,{variants:_,className:"rounded-lg border border-azure-border dark:border-matrix-primary overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-azure-surface dark:bg-zinc-900 border-b border-azure-border dark:border-matrix-primary",children:e.jsx("tr",{children:["Provider","Model","Input ($/1M tokens)","Output ($/1M tokens)","Audio ($/s)","Actions"].map(r=>e.jsx("th",{className:"px-4 py-3 text-left font-semibold text-azure-text-secondary dark:text-matrix-secondary",children:r},r))})}),e.jsx("tbody",{children:a.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-4 py-8 text-center text-azure-text-secondary dark:text-matrix-secondary",children:'No pricing entries. Click "Add Pricing" to get started.'})}):a.map(r=>e.jsxs("tr",{className:"border-b border-azure-border dark:border-matrix-primary/30 hover:bg-azure-surface/50 dark:hover:bg-zinc-800/50 transition-colors",children:[e.jsx("td",{className:"px-4 py-3 text-azure-text-primary dark:text-matrix-text capitalize",children:r.provider}),e.jsx("td",{className:"px-4 py-3 font-mono text-azure-text-primary dark:text-matrix-highlight text-xs",children:r.model}),e.jsxs("td",{className:"px-4 py-3 text-azure-text-primary dark:text-matrix-text",children:["$",r.input_price_per_1m.toFixed(4)]}),e.jsxs("td",{className:"px-4 py-3 text-azure-text-primary dark:text-matrix-text",children:["$",r.output_price_per_1m.toFixed(4)]}),e.jsx("td",{className:"px-4 py-3 text-azure-text-primary dark:text-matrix-text",children:r.audio_cost_per_second!=null?`$${r.audio_cost_per_second.toFixed(6)}`:e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-secondary/40",children:"—"})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>$(r),className:"p-1.5 rounded hover:bg-azure-border dark:hover:bg-matrix-primary/30 text-azure-text-secondary dark:text-matrix-secondary hover:text-azure-primary dark:hover:text-matrix-highlight transition-colors",title:"Edit",children:e.jsx(I,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>c(r),className:"p-1.5 rounded hover:bg-red-50 dark:hover:bg-red-900/20 text-azure-text-secondary dark:text-matrix-secondary hover:text-red-600 dark:hover:text-red-400 transition-colors",title:"Delete",children:e.jsx(R,{className:"w-4 h-4"})})]})})]},`${r.provider}/${r.model}`))})]})}),e.jsx(j,{open:p,onOpenChange:n,children:e.jsxs(z,{children:[e.jsx(v,{children:e.jsx(N,{children:l?"Edit Pricing":"Add Pricing"})}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-azure-text-secondary dark:text-matrix-secondary mb-1",children:"Provider"}),l?e.jsx("p",{className:"px-3 py-2 rounded-lg bg-azure-bg dark:bg-zinc-900 text-azure-text-primary dark:text-matrix-secondary text-sm capitalize",children:t.provider}):e.jsxs("select",{value:t.provider,onChange:r=>i({...t,provider:r.target.value}),className:"w-full px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-black text-azure-text-primary dark:text-matrix-secondary text-sm focus:outline-none focus:ring-1 focus:ring-azure-primary dark:focus:ring-matrix-highlight focus:border-azure-primary dark:focus:border-matrix-highlight",children:[e.jsx("option",{value:"",children:"Select provider..."}),A.map(r=>e.jsx("option",{value:r,children:r},r))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-azure-text-secondary dark:text-matrix-secondary mb-1",children:"Model"}),l?e.jsx("p",{className:"px-3 py-2 rounded-lg bg-azure-bg dark:bg-zinc-900 text-azure-text-primary dark:text-matrix-secondary text-sm font-mono",children:t.model}):e.jsx("input",{type:"text",value:t.model,onChange:r=>i({...t,model:r.target.value}),placeholder:"e.g. gpt-4o",className:"w-full px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-black text-azure-text-primary dark:text-matrix-secondary text-sm focus:outline-none focus:ring-1 focus:ring-azure-primary dark:focus:ring-matrix-highlight focus:border-azure-primary dark:focus:border-matrix-highlight"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-azure-text-secondary dark:text-matrix-secondary mb-1",children:"Input price / 1M tokens ($)"}),e.jsx("input",{type:"number",min:0,step:.001,value:t.input_price_per_1m,onChange:r=>i({...t,input_price_per_1m:parseFloat(r.target.value)||0}),className:"w-full px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-black text-azure-text-primary dark:text-matrix-secondary text-sm focus:outline-none focus:ring-1 focus:ring-azure-primary dark:focus:ring-matrix-highlight focus:border-azure-primary dark:focus:border-matrix-highlight"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-azure-text-secondary dark:text-matrix-secondary mb-1",children:"Output price / 1M tokens ($)"}),e.jsx("input",{type:"number",min:0,step:.001,value:t.output_price_per_1m,onChange:r=>i({...t,output_price_per_1m:parseFloat(r.target.value)||0}),className:"w-full px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-black text-azure-text-primary dark:text-matrix-secondary text-sm focus:outline-none focus:ring-1 focus:ring-azure-primary dark:focus:ring-matrix-highlight focus:border-azure-primary dark:focus:border-matrix-highlight"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-azure-text-secondary dark:text-matrix-secondary mb-1",children:["Audio price / second ($)",e.jsx("span",{className:"ml-2 text-[11px] font-normal text-azure-text-secondary/60 dark:text-matrix-secondary/40",children:"for Whisper/audio-only models · leave blank for token-based"})]}),e.jsx("input",{type:"number",min:0,step:1e-6,placeholder:"e.g. 0.0001 (Whisper = $0.006/min)",value:t.audio_cost_per_second??"",onChange:r=>i({...t,audio_cost_per_second:r.target.value===""?null:parseFloat(r.target.value)}),className:"w-full px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-black text-azure-text-primary dark:text-matrix-secondary text-sm focus:outline-none focus:ring-1 focus:ring-azure-primary dark:focus:ring-matrix-highlight focus:border-azure-primary dark:focus:border-matrix-highlight placeholder-azure-text-secondary/40 dark:placeholder-matrix-secondary/30"})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:()=>n(!1),className:"px-4 py-2 rounded-lg border border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary text-sm hover:bg-azure-surface dark:hover:bg-zinc-800 transition-colors",children:"Cancel"}),e.jsx("button",{onClick:S,disabled:k||!t.provider.trim()||!t.model.trim(),className:"px-4 py-2 rounded-lg bg-azure-primary dark:bg-matrix-primary text-white dark:text-matrix-highlight text-sm font-medium hover:opacity-90 disabled:opacity-50 transition-opacity",children:k?"Saving...":"Save"})]})]})]})}),e.jsx(j,{open:!!d,onOpenChange:r=>!r&&c(null),children:e.jsxs(z,{children:[e.jsx(v,{children:e.jsx(N,{children:"Delete Pricing Entry"})}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("p",{className:"text-sm text-azure-text-primary dark:text-matrix-text",children:["Are you sure you want to delete the pricing for"," ",e.jsxs("span",{className:"font-mono font-semibold text-azure-primary dark:text-matrix-highlight",children:[d?.provider,"/",d?.model]}),"? This cannot be undone."]}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx("button",{onClick:()=>c(null),className:"px-4 py-2 rounded-lg border border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-secondary text-sm hover:bg-azure-surface dark:hover:bg-zinc-800 transition-colors",children:"Cancel"}),e.jsx("button",{onClick:P,className:"px-4 py-2 rounded-lg bg-red-600 text-white text-sm font-medium hover:bg-red-700 transition-colors",children:"Delete"})]})]})]})})]})};export{V as ModelPricing};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,m as n}from"./vendor-motion-C3CZ8ZlO.js";import{r as i,L as P}from"./vendor-react-DikRIOlj.js";import{u as S}from"./vendor-utils-D4NnWbOU.js";import{w as y,D as _,e as D,j as R}from"./index-
|
|
1
|
+
import{j as e,m as n}from"./vendor-motion-C3CZ8ZlO.js";import{r as i,L as P}from"./vendor-react-DikRIOlj.js";import{u as S}from"./vendor-utils-D4NnWbOU.js";import{w as y,D as _,e as D,j as R}from"./index-zKplfrXZ.js";import{P as O}from"./Pagination-oTGieBLM.js";import{B as k,a8 as A,a9 as F,aa as B,_ as L,p as W,q as E,g as J}from"./vendor-icons-DMd9RGvJ.js";const M={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.05}}},g={hidden:{opacity:0,y:10},show:{opacity:1,y:0}},j=({status:r})=>r==="completed"?e.jsxs("div",{className:"flex items-center gap-1.5 text-green-600 dark:text-green-400",children:[e.jsx(W,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xs",children:"Completed"})]}):r==="failed"?e.jsxs("div",{className:"flex items-center gap-1.5 text-red-600 dark:text-red-400",children:[e.jsx(E,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xs",children:"Failed"})]}):e.jsxs("div",{className:"flex items-center gap-1.5 text-yellow-600 dark:text-yellow-400",children:[e.jsx(J,{className:"w-4 h-4 animate-pulse"}),e.jsx("span",{className:"text-xs",children:"Pending"})]}),x=r=>new Date(r).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),U=r=>{try{return JSON.stringify(JSON.parse(r),null,2)}catch{return r}},X=()=>{const[r,f]=i.useState(!1),[c,N]=i.useState("all"),[m,d]=i.useState(1),[h,v]=i.useState(20),[a,u]=i.useState(null),{data:s,mutate:z}=S(["/webhooks/notifications",r,c,m,h],()=>y.listNotifications({unreadOnly:r,status:c,page:m,per_page:h}),{refreshInterval:5e3}),o=s?.data??[],l=o.filter(t=>!t.read).length,b=async t=>{t.length!==0&&(await y.markRead(t),await z())},w=()=>{const t=o.filter(p=>!p.read).map(p=>p.id);b(t)},C=async t=>{u(t),t.read||await b([t.id])};return e.jsxs(n.div,{variants:M,initial:"hidden",animate:"show",className:"space-y-6",children:[e.jsxs(n.div,{variants:g,className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:[e.jsx(k,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"}),l>0&&e.jsx("span",{className:"absolute -top-1.5 -right-1.5 bg-red-500 text-white text-[10px] font-bold rounded-full w-4 h-4 flex items-center justify-center leading-none",children:l>9?"9+":l})]}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Notifications"}),e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary mt-0.5",children:"Webhook execution results from the Oracle agent."})]})]}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsxs(P,{to:"/webhooks",className:"flex items-center gap-2 text-sm text-azure-text-secondary dark:text-matrix-dim hover:text-azure-primary dark:hover:text-matrix-highlight transition-colors",children:[e.jsx(A,{className:"w-4 h-4"}),"Back to Webhooks"]}),e.jsxs("select",{value:c,onChange:t=>{N(t.target.value),d(1)},className:"px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary bg-white dark:bg-black text-azure-text-secondary dark:text-matrix-dim text-sm focus:outline-none focus:border-azure-primary dark:focus:border-matrix-highlight",children:[e.jsx("option",{value:"all",children:"All statuses"}),e.jsx("option",{value:"completed",children:"Completed"}),e.jsx("option",{value:"failed",children:"Failed"}),e.jsx("option",{value:"pending",children:"Pending"})]}),e.jsxs("button",{onClick:()=>{f(!r),d(1)},className:`flex items-center gap-2 px-3 py-2 rounded-lg border text-sm transition-colors ${r?"border-azure-primary dark:border-matrix-highlight bg-azure-active dark:bg-matrix-primary/20 text-azure-primary dark:text-matrix-highlight":"border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-dim hover:bg-azure-surface dark:hover:bg-zinc-800"}`,children:[e.jsx(F,{className:"w-4 h-4"}),"Unread only"]}),l>0&&e.jsxs("button",{onClick:w,className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-azure-border dark:border-matrix-primary text-sm text-azure-text-secondary dark:text-matrix-dim hover:bg-azure-surface dark:hover:bg-zinc-800 transition-colors",children:[e.jsx(B,{className:"w-4 h-4"}),"Mark all read"]})]})]}),e.jsx(n.div,{variants:g,className:"rounded-lg border border-azure-border dark:border-matrix-primary overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-azure-surface dark:bg-zinc-900 border-b border-azure-border dark:border-matrix-primary",children:e.jsx("tr",{children:["","Webhook","Status","Created","Completed","Actions"].map(t=>e.jsx("th",{className:"px-4 py-3 text-left font-semibold text-azure-text-secondary dark:text-matrix-dim",children:t},t))})}),e.jsx("tbody",{children:o.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-4 py-10 text-center text-azure-text-secondary dark:text-matrix-dim",children:r?"No unread notifications.":"No notifications yet."})}):o.map(t=>e.jsxs("tr",{className:`border-b border-azure-border dark:border-matrix-primary/30 hover:bg-azure-surface/50 dark:hover:bg-zinc-800/50 transition-colors ${t.read?"":"bg-blue-50/40 dark:bg-blue-900/10"}`,children:[e.jsx("td",{className:"px-4 py-3 w-6",children:!t.read&&e.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-blue-500 dark:bg-matrix-highlight"})}),e.jsx("td",{className:"px-4 py-3 font-mono font-medium text-azure-text-primary dark:text-matrix-text",children:t.webhook_name}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(j,{status:t.status})}),e.jsx("td",{className:"px-4 py-3 text-xs text-azure-text-secondary dark:text-matrix-dim whitespace-nowrap",children:x(t.created_at)}),e.jsx("td",{className:"px-4 py-3 text-xs text-azure-text-secondary dark:text-matrix-dim whitespace-nowrap",children:t.completed_at?x(t.completed_at):"—"}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("button",{onClick:()=>C(t),title:"View details",className:"p-1.5 rounded hover:bg-azure-border dark:hover:bg-matrix-primary/30 text-azure-text-secondary dark:text-matrix-dim hover:text-azure-primary dark:hover:text-matrix-highlight transition-colors",children:e.jsx(L,{className:"w-4 h-4"})})})]},t.id))})]})})}),s&&s.total_pages>1&&e.jsx(n.div,{variants:g,children:e.jsx("div",{className:"rounded-lg border border-azure-border dark:border-matrix-primary bg-white dark:bg-black",children:e.jsx(O,{page:m,totalPages:s.total_pages,perPage:h,total:s.total,onPageChange:d,onPerPageChange:t=>{v(t),d(1)}})})}),e.jsxs(_,{open:!!a,onOpenChange:t=>!t&&u(null),children:[e.jsx(D,{children:e.jsxs(R,{className:"text-azure-text-primary dark:text-matrix-highlight flex items-center gap-2",children:[e.jsx(k,{className:"w-4 h-4"}),a?.webhook_name]})}),a&&e.jsxs("div",{className:"p-6 space-y-4 overflow-y-auto max-h-[65vh]",children:[e.jsxs("div",{className:"flex items-center gap-4 text-xs text-azure-text-secondary dark:text-matrix-dim",children:[e.jsx(j,{status:a.status}),e.jsx("span",{children:x(a.created_at)}),a.completed_at&&e.jsxs("span",{children:["→ ",x(a.completed_at)]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-azure-text-secondary dark:text-matrix-dim mb-1.5",children:"Received Payload"}),e.jsx("pre",{className:"bg-azure-bg dark:bg-zinc-950 rounded-lg p-3 text-xs font-mono overflow-auto max-h-44 text-azure-text-primary dark:text-matrix-text border border-azure-border dark:border-matrix-primary/30 whitespace-pre-wrap",children:U(a.payload)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-azure-text-secondary dark:text-matrix-dim mb-1.5",children:"Agent Result"}),e.jsx("div",{className:"bg-azure-bg dark:bg-zinc-950 rounded-lg p-3 text-xs font-mono overflow-auto max-h-64 text-azure-text-primary dark:text-matrix-text border border-azure-border dark:border-matrix-primary/30 whitespace-pre-wrap",children:a.result??e.jsx("span",{className:"text-yellow-600 dark:text-yellow-400 animate-pulse",children:"Processing…"})})]}),e.jsx("div",{className:"flex justify-end pt-2",children:e.jsx("button",{onClick:()=>u(null),className:"px-4 py-2 rounded-lg border border-azure-border dark:border-matrix-primary text-azure-text-secondary dark:text-matrix-dim text-sm hover:bg-azure-surface dark:hover:bg-zinc-800 transition-colors",children:"Close"})})]})]})]})};export{X as Notifications};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./vendor-motion-C3CZ8ZlO.js";import{r as i}from"./vendor-react-DikRIOlj.js";import{B as j,h as N}from"./index-Dpd1Mkgp.js";import{M as de,D as oe}from"./DeleteConfirmationModal-BfSjv04R.js";import{V as xe,Y as me,Z as H,g as ue,_ as O,$ as he,a0 as ge,A as pe,z as B,a1 as fe}from"./vendor-icons-DMd9RGvJ.js";import{P as je}from"./Pagination-oTGieBLM.js";import"./vendor-utils-D4NnWbOU.js";const ye=({className:r,...a})=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{className:`w-full caption-bottom text-sm ${r}`,...a})}),be=({...r})=>e.jsx("thead",{...r}),ke=({...r})=>e.jsx("tbody",{...r}),M=({...r})=>e.jsx("tr",{className:"border-b border-azure-border dark:border-matrix-primary/30 transition-colors hover:bg-azure-hover/50 dark:hover:bg-matrix-primary/10",...r}),f=({className:r,...a})=>e.jsx("th",{className:`h-12 px-4 text-left align-middle font-medium text-azure-text-secondary dark:text-matrix-secondary/70 [&:has([role=checkbox])]:pr-0 ${r}`,...a}),g=({className:r,...a})=>e.jsx("td",{className:`p-4 align-middle [&:has([role=checkbox])]:pr-0 ${r}`,...a}),F=({checked:r,onCheckedChange:a,className:s,...n})=>{const l=x=>{a&&a(x.target.checked),n.onChange&&n.onChange(x)};return e.jsx("input",{type:"checkbox",checked:r,onChange:l,className:`h-4 w-4 rounded border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-black text-azure-primary dark:text-matrix-highlight focus:ring-azure-primary dark:focus:ring-matrix-highlight ${s||""}`,...n})},v=({className:r,variant:a="default",...s})=>{const l=`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-zinc-950 focus:ring-offset-2 dark:focus:ring-zinc-300 ${a==="destructive"?"border-transparent bg-red-500 text-zinc-50 dark:bg-red-900 dark:text-zinc-50":a==="secondary"?"border-transparent bg-azure-surface dark:bg-zinc-800 text-azure-text-secondary dark:text-matrix-secondary":a==="outline"?"text-azure-text-primary dark:text-matrix-secondary border-azure-border dark:border-matrix-primary":"border-transparent bg-azure-primary dark:bg-matrix-highlight text-azure-text-inverse dark:text-black"} ${r||""}`;return e.jsx("div",{className:l,...s})},T=({className:r,...a})=>e.jsx("div",{className:`rounded-lg border border-azure-border dark:border-matrix-primary/30 bg-azure-surface dark:bg-zinc-900 text-azure-text-primary dark:text-matrix-secondary shadow-sm ${r||""}`,...a}),I=({className:r,...a})=>e.jsx("div",{className:`flex flex-col space-y-1.5 p-6 ${r||""}`,...a}),Ne=({className:r,...a})=>e.jsx("h3",{className:`text-2xl font-semibold leading-none tracking-tight ${r||""}`,...a}),A=({className:r,...a})=>e.jsx("div",{className:`p-6 pt-0 ${r||""}`,...a}),ve=({className:r,variant:a="default",...s})=>{const l=`relative w-full rounded-lg border p-4 ${a==="destructive"?"border-red-500/50 text-red-700 dark:border-red-900/50 dark:text-red-300":"border-azure-border dark:border-matrix-primary"} ${r||""}`;return e.jsx("div",{className:l,...s})},ze=({className:r,...a})=>e.jsx("div",{className:`text-sm [&_p]:leading-relaxed ${r||""}`,...a}),we=({isOpen:r,onClose:a,memory:s})=>s?e.jsx(de,{isOpen:r,onClose:a,title:"Memory Details",size:"lg",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xe,{className:"w-4 h-4 text-azure-text-secondary dark:text-matrix-tertiary"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm",children:"Category"})]}),e.jsx("div",{children:e.jsx(v,{variant:"outline",children:s.category})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(me,{className:"w-4 h-4 text-azure-text-secondary dark:text-matrix-tertiary"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm",children:"Importance"})]}),e.jsx("div",{children:e.jsx(v,{variant:s.importance==="critical"?"destructive":s.importance==="high"?"default":s.importance==="medium"?"secondary":"outline",children:s.importance})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"w-4 h-4 text-azure-text-secondary dark:text-matrix-tertiary"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm",children:"Created"})]}),e.jsx("div",{className:"text-azure-text-primary dark:text-matrix-secondary",children:new Date(s.created_at).toLocaleString()}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ue,{className:"w-4 h-4 text-azure-text-secondary dark:text-matrix-tertiary"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm",children:"Updated"})]}),e.jsx("div",{className:"text-azure-text-primary dark:text-matrix-secondary",children:new Date(s.updated_at).toLocaleString()}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{className:"w-4 h-4 text-azure-text-secondary dark:text-matrix-tertiary"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm",children:"Access Count"})]}),e.jsx("div",{className:"text-azure-text-primary dark:text-matrix-secondary",children:s.access_count}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(he,{className:"w-4 h-4 text-azure-text-secondary dark:text-matrix-tertiary"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm",children:"Hash"})]}),e.jsx("div",{className:"text-azure-text-primary dark:text-matrix-secondary break-all text-sm",children:s.hash}),s.source&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ge,{className:"w-4 h-4 text-azure-text-secondary dark:text-matrix-tertiary"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm",children:"Source"})]}),e.jsx("div",{className:"text-azure-text-primary dark:text-matrix-secondary",children:s.source})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm mb-2",children:"Summary"}),e.jsx("p",{className:"text-azure-text-primary dark:text-matrix-secondary bg-azure-surface dark:bg-zinc-900 p-3 rounded-md",children:s.summary})]}),s.details&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm mb-2",children:"Details"}),e.jsx("div",{className:"text-azure-text-primary dark:text-matrix-secondary bg-azure-surface dark:bg-zinc-900 p-3 rounded-md whitespace-pre-wrap",children:s.details})]}),e.jsx("div",{className:"flex justify-end pt-4",children:e.jsx(j,{onClick:a,children:"Close"})})]})}):null,Ce=()=>{const[r,a]=i.useState(!1),[s,n]=i.useState(null),l=i.useCallback(o=>(a(!0),n(null),N.get(o).then(c=>c).catch(c=>{throw n(c.message||"An error occurred"),c}).finally(()=>{a(!1)})),[]),x=i.useCallback((o,c)=>(a(!0),n(null),N.post(o,c).then(d=>d).catch(d=>{throw n(d.message||"An error occurred"),d}).finally(()=>{a(!1)})),[]),m=i.useCallback((o,c)=>(a(!0),n(null),N.post(o,c).then(d=>d).catch(d=>{throw n(d.message||"An error occurred"),d}).finally(()=>{a(!1)})),[]),z=i.useCallback(o=>(a(!0),n(null),N.delete(o).then(c=>c).catch(c=>{throw n(c.message||"An error occurred"),c}).finally(()=>{a(!1)})),[]);return{get:l,post:x,put:m,del:z,loading:r,error:s}},_e=()=>{const[r,a]=i.useState([]),[s,n]=i.useState(!0),[l,x]=i.useState([]),[m,z]=i.useState(""),[o,c]=i.useState("all"),[d,R]=i.useState("all"),[u,y]=i.useState(1),[h,U]=i.useState(20),[V,q]=i.useState(0),[$,Y]=i.useState(1),[P,b]=i.useState(null),[Z,w]=i.useState(!1),[G,J]=i.useState(null),[K,_]=i.useState(!1),[E,L]=i.useState(null),[Q,C]=i.useState(!1),{get:W,del:X,post:ee}=Ce(),S=i.useCallback(async(t=u,D=h)=>{try{n(!0);const p=new URLSearchParams({page:String(t),per_page:String(D)});o!=="all"&&p.set("category",o),d!=="all"&&p.set("importance",d),m.trim()&&p.set("search",m.trim());const k=await W(`/sati/memories?${p}`);a(k.data??k),q(k.total??0),Y(k.total_pages??1),b(null)}catch(p){b("Failed to load memories. Please try again."),console.error("Error fetching memories:",p)}finally{n(!1)}},[u,h,o,d,m]);i.useEffect(()=>{S(u,h)},[u,h,o,d,m]);const te=()=>{l.length===r.length?x([]):x(r.map(t=>t.id))},re=t=>{l.includes(t)?x(l.filter(D=>D!==t)):x([...l,t])},ae=async()=>{if(l.length!==0)try{await ee("/sati/memories/bulk-delete",{ids:l}),await S(u,h),x([]),w(!1)}catch(t){b("Failed to delete memories. Please try again."),console.error("Error deleting memories:",t)}},se=t=>{L(t),C(!0)},ie=async()=>{if(E)try{await X(`/sati/memories/${E}`),await S(u,h)}catch(t){b("Failed to delete memory. Please try again."),console.error("Error deleting memory:",t)}finally{L(null),C(!1)}},le=t=>{J(t),_(!0)},ne=["preference","project","identity","constraint","context","personal_data","languages","favorite_things","relationships","pets","naming","professional_profile"],ce=["low","medium","high"];return s&&r.length===0?e.jsx(T,{className:"w-full",children:e.jsx(A,{className:"flex justify-center items-center h-64",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-azure-primary dark:border-matrix-highlight"})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:e.jsx(pe,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Sati Memories"}),e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary",children:"View and manage long-term memories stored by Sati."})]})]}),l.length>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm text-azure-text-muted dark:text-matrix-secondary",children:[l.length," selected"]}),e.jsxs(j,{variant:"destructive",size:"sm",onClick:()=>w(!0),disabled:l.length===0,children:[e.jsx(B,{className:"w-4 h-4 mr-1"}),"Delete Selected"]})]})]}),P&&e.jsx(ve,{variant:"destructive",children:e.jsx(ze,{children:P})}),e.jsxs(T,{children:[e.jsx(I,{className:"border-b border-azure-border dark:border-matrix-primary",children:e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4",children:[e.jsxs("div",{className:"flex flex-col relative w-full",children:[e.jsx(fe,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-azure-text-secondary dark:text-matrix-secondary w-4 h-4"}),e.jsx("input",{type:"text",placeholder:"Search memories...",value:m,onChange:t=>{z(t.target.value),y(1)},className:"w-full pl-10 pr-4 py-2 bg-azure-surface dark:bg-black border border-azure-border dark:border-matrix-primary rounded-md text-azure-text-primary dark:text-matrix-secondary focus:outline-none focus:ring-2 focus:ring-azure-primary dark:focus:ring-matrix-highlight"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[e.jsxs("select",{value:o,onChange:t=>{c(t.target.value),y(1)},className:"px-3 py-2 bg-azure-surface dark:bg-black border border-azure-border dark:border-matrix-primary rounded-md text-azure-text-primary dark:text-matrix-secondary focus:outline-none focus:ring-2 focus:ring-azure-primary dark:focus:ring-matrix-highlight flex-grow",children:[e.jsx("option",{value:"all",children:"All Categories"}),ne.map(t=>e.jsx("option",{value:t,children:t},t))]}),e.jsxs("select",{value:d,onChange:t=>{R(t.target.value),y(1)},className:"px-3 py-2 bg-azure-surface dark:bg-black border border-azure-border dark:border-matrix-primary rounded-md text-azure-text-primary dark:text-matrix-secondary focus:outline-none focus:ring-2 focus:ring-azure-primary dark:focus:ring-matrix-highlight flex-grow",children:[e.jsx("option",{value:"all",children:"All Importance"}),ce.map(t=>e.jsx("option",{value:t,children:t},t))]})]})]})}),e.jsx(A,{className:"p-0",children:e.jsxs(ye,{children:[e.jsx(be,{children:e.jsxs(M,{className:"hover:bg-transparent",children:[e.jsx(f,{className:"w-12",children:e.jsx(F,{checked:r.length>0&&l.length===r.length,onCheckedChange:te})}),e.jsx(f,{children:"Summary"}),e.jsx(f,{children:"Category"}),e.jsx(f,{children:"Importance"}),e.jsx(f,{children:"Created"}),e.jsx(f,{className:"w-32",children:"Actions"})]})}),e.jsx(ke,{children:r.length===0?e.jsx(M,{children:e.jsx(g,{colSpan:6,className:"text-center py-8 text-azure-text-secondary dark:text-matrix-secondary",children:s?"Loading memories...":"No memories found"})}):r.map(t=>e.jsxs(M,{children:[e.jsx(g,{children:e.jsx(F,{checked:l.includes(t.id),onCheckedChange:()=>re(t.id)})}),e.jsx(g,{className:"font-medium max-w-xs truncate",children:t.summary}),e.jsx(g,{children:e.jsx(v,{variant:"outline",children:t.category})}),e.jsx(g,{children:e.jsx(v,{variant:t.importance==="critical"?"destructive":t.importance==="high"?"default":t.importance==="medium"?"secondary":"outline",children:t.importance})}),e.jsx(g,{children:e.jsxs("div",{className:"flex items-center gap-1 text-azure-text-secondary dark:text-matrix-secondary",children:[e.jsx(H,{className:"w-4 h-4"}),new Date(t.created_at).toLocaleDateString()]})}),e.jsx(g,{children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx(j,{variant:"ghost",size:"sm",onClick:()=>le(t),className:"text-blue-500 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",children:e.jsx(O,{className:"w-4 h-4"})}),e.jsx(j,{variant:"ghost",size:"sm",onClick:()=>se(t.id),className:"text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",children:e.jsx(B,{className:"w-4 h-4"})})]})})]},t.id))})]})}),$>1&&e.jsx(je,{page:u,totalPages:$,perPage:h,total:V,onPageChange:y,onPerPageChange:t=>{U(t),y(1)}})]}),Z&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs(T,{className:"w-full max-w-md mx-4",children:[e.jsx(I,{children:e.jsx(Ne,{children:"Delete Memories"})}),e.jsxs(A,{children:[e.jsxs("p",{className:"mb-4",children:["Are you sure you want to delete ",l.length," ","memory(ies)? This action cannot be undone."]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(j,{variant:"outline",onClick:()=>w(!1),children:"Cancel"}),e.jsx(j,{variant:"destructive",onClick:ae,children:"Delete"})]})]})]})}),e.jsx(we,{isOpen:K,onClose:()=>_(!1),memory:G}),e.jsx(oe,{isOpen:Q,onClose:()=>C(!1),onConfirm:ie,title:"Confirm Memory Deletion",message:"Are you sure you want to delete this memory? This action cannot be undone.",confirmButtonText:"Delete Memory",cancelButtonText:"Cancel"})]})};export{_e as SatiMemories};
|
|
1
|
+
import{j as e}from"./vendor-motion-C3CZ8ZlO.js";import{r as i}from"./vendor-react-DikRIOlj.js";import{B as j,h as N}from"./index-zKplfrXZ.js";import{M as de,D as oe}from"./DeleteConfirmationModal-CioxFWn_.js";import{V as xe,Y as me,Z as H,g as ue,_ as O,$ as he,a0 as ge,A as pe,z as B,a1 as fe}from"./vendor-icons-DMd9RGvJ.js";import{P as je}from"./Pagination-oTGieBLM.js";import"./vendor-utils-D4NnWbOU.js";const ye=({className:r,...a})=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{className:`w-full caption-bottom text-sm ${r}`,...a})}),be=({...r})=>e.jsx("thead",{...r}),ke=({...r})=>e.jsx("tbody",{...r}),M=({...r})=>e.jsx("tr",{className:"border-b border-azure-border dark:border-matrix-primary/30 transition-colors hover:bg-azure-hover/50 dark:hover:bg-matrix-primary/10",...r}),f=({className:r,...a})=>e.jsx("th",{className:`h-12 px-4 text-left align-middle font-medium text-azure-text-secondary dark:text-matrix-secondary/70 [&:has([role=checkbox])]:pr-0 ${r}`,...a}),g=({className:r,...a})=>e.jsx("td",{className:`p-4 align-middle [&:has([role=checkbox])]:pr-0 ${r}`,...a}),F=({checked:r,onCheckedChange:a,className:s,...n})=>{const l=x=>{a&&a(x.target.checked),n.onChange&&n.onChange(x)};return e.jsx("input",{type:"checkbox",checked:r,onChange:l,className:`h-4 w-4 rounded border-azure-border dark:border-matrix-primary bg-azure-surface dark:bg-black text-azure-primary dark:text-matrix-highlight focus:ring-azure-primary dark:focus:ring-matrix-highlight ${s||""}`,...n})},v=({className:r,variant:a="default",...s})=>{const l=`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-zinc-950 focus:ring-offset-2 dark:focus:ring-zinc-300 ${a==="destructive"?"border-transparent bg-red-500 text-zinc-50 dark:bg-red-900 dark:text-zinc-50":a==="secondary"?"border-transparent bg-azure-surface dark:bg-zinc-800 text-azure-text-secondary dark:text-matrix-secondary":a==="outline"?"text-azure-text-primary dark:text-matrix-secondary border-azure-border dark:border-matrix-primary":"border-transparent bg-azure-primary dark:bg-matrix-highlight text-azure-text-inverse dark:text-black"} ${r||""}`;return e.jsx("div",{className:l,...s})},T=({className:r,...a})=>e.jsx("div",{className:`rounded-lg border border-azure-border dark:border-matrix-primary/30 bg-azure-surface dark:bg-zinc-900 text-azure-text-primary dark:text-matrix-secondary shadow-sm ${r||""}`,...a}),I=({className:r,...a})=>e.jsx("div",{className:`flex flex-col space-y-1.5 p-6 ${r||""}`,...a}),Ne=({className:r,...a})=>e.jsx("h3",{className:`text-2xl font-semibold leading-none tracking-tight ${r||""}`,...a}),A=({className:r,...a})=>e.jsx("div",{className:`p-6 pt-0 ${r||""}`,...a}),ve=({className:r,variant:a="default",...s})=>{const l=`relative w-full rounded-lg border p-4 ${a==="destructive"?"border-red-500/50 text-red-700 dark:border-red-900/50 dark:text-red-300":"border-azure-border dark:border-matrix-primary"} ${r||""}`;return e.jsx("div",{className:l,...s})},ze=({className:r,...a})=>e.jsx("div",{className:`text-sm [&_p]:leading-relaxed ${r||""}`,...a}),we=({isOpen:r,onClose:a,memory:s})=>s?e.jsx(de,{isOpen:r,onClose:a,title:"Memory Details",size:"lg",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xe,{className:"w-4 h-4 text-azure-text-secondary dark:text-matrix-tertiary"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm",children:"Category"})]}),e.jsx("div",{children:e.jsx(v,{variant:"outline",children:s.category})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(me,{className:"w-4 h-4 text-azure-text-secondary dark:text-matrix-tertiary"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm",children:"Importance"})]}),e.jsx("div",{children:e.jsx(v,{variant:s.importance==="critical"?"destructive":s.importance==="high"?"default":s.importance==="medium"?"secondary":"outline",children:s.importance})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"w-4 h-4 text-azure-text-secondary dark:text-matrix-tertiary"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm",children:"Created"})]}),e.jsx("div",{className:"text-azure-text-primary dark:text-matrix-secondary",children:new Date(s.created_at).toLocaleString()}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ue,{className:"w-4 h-4 text-azure-text-secondary dark:text-matrix-tertiary"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm",children:"Updated"})]}),e.jsx("div",{className:"text-azure-text-primary dark:text-matrix-secondary",children:new Date(s.updated_at).toLocaleString()}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{className:"w-4 h-4 text-azure-text-secondary dark:text-matrix-tertiary"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm",children:"Access Count"})]}),e.jsx("div",{className:"text-azure-text-primary dark:text-matrix-secondary",children:s.access_count}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(he,{className:"w-4 h-4 text-azure-text-secondary dark:text-matrix-tertiary"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm",children:"Hash"})]}),e.jsx("div",{className:"text-azure-text-primary dark:text-matrix-secondary break-all text-sm",children:s.hash}),s.source&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ge,{className:"w-4 h-4 text-azure-text-secondary dark:text-matrix-tertiary"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm",children:"Source"})]}),e.jsx("div",{className:"text-azure-text-primary dark:text-matrix-secondary",children:s.source})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm mb-2",children:"Summary"}),e.jsx("p",{className:"text-azure-text-primary dark:text-matrix-secondary bg-azure-surface dark:bg-zinc-900 p-3 rounded-md",children:s.summary})]}),s.details&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-azure-text-secondary dark:text-matrix-tertiary text-sm mb-2",children:"Details"}),e.jsx("div",{className:"text-azure-text-primary dark:text-matrix-secondary bg-azure-surface dark:bg-zinc-900 p-3 rounded-md whitespace-pre-wrap",children:s.details})]}),e.jsx("div",{className:"flex justify-end pt-4",children:e.jsx(j,{onClick:a,children:"Close"})})]})}):null,Ce=()=>{const[r,a]=i.useState(!1),[s,n]=i.useState(null),l=i.useCallback(o=>(a(!0),n(null),N.get(o).then(c=>c).catch(c=>{throw n(c.message||"An error occurred"),c}).finally(()=>{a(!1)})),[]),x=i.useCallback((o,c)=>(a(!0),n(null),N.post(o,c).then(d=>d).catch(d=>{throw n(d.message||"An error occurred"),d}).finally(()=>{a(!1)})),[]),m=i.useCallback((o,c)=>(a(!0),n(null),N.post(o,c).then(d=>d).catch(d=>{throw n(d.message||"An error occurred"),d}).finally(()=>{a(!1)})),[]),z=i.useCallback(o=>(a(!0),n(null),N.delete(o).then(c=>c).catch(c=>{throw n(c.message||"An error occurred"),c}).finally(()=>{a(!1)})),[]);return{get:l,post:x,put:m,del:z,loading:r,error:s}},_e=()=>{const[r,a]=i.useState([]),[s,n]=i.useState(!0),[l,x]=i.useState([]),[m,z]=i.useState(""),[o,c]=i.useState("all"),[d,R]=i.useState("all"),[u,y]=i.useState(1),[h,U]=i.useState(20),[V,q]=i.useState(0),[$,Y]=i.useState(1),[P,b]=i.useState(null),[Z,w]=i.useState(!1),[G,J]=i.useState(null),[K,_]=i.useState(!1),[E,L]=i.useState(null),[Q,C]=i.useState(!1),{get:W,del:X,post:ee}=Ce(),S=i.useCallback(async(t=u,D=h)=>{try{n(!0);const p=new URLSearchParams({page:String(t),per_page:String(D)});o!=="all"&&p.set("category",o),d!=="all"&&p.set("importance",d),m.trim()&&p.set("search",m.trim());const k=await W(`/sati/memories?${p}`);a(k.data??k),q(k.total??0),Y(k.total_pages??1),b(null)}catch(p){b("Failed to load memories. Please try again."),console.error("Error fetching memories:",p)}finally{n(!1)}},[u,h,o,d,m]);i.useEffect(()=>{S(u,h)},[u,h,o,d,m]);const te=()=>{l.length===r.length?x([]):x(r.map(t=>t.id))},re=t=>{l.includes(t)?x(l.filter(D=>D!==t)):x([...l,t])},ae=async()=>{if(l.length!==0)try{await ee("/sati/memories/bulk-delete",{ids:l}),await S(u,h),x([]),w(!1)}catch(t){b("Failed to delete memories. Please try again."),console.error("Error deleting memories:",t)}},se=t=>{L(t),C(!0)},ie=async()=>{if(E)try{await X(`/sati/memories/${E}`),await S(u,h)}catch(t){b("Failed to delete memory. Please try again."),console.error("Error deleting memory:",t)}finally{L(null),C(!1)}},le=t=>{J(t),_(!0)},ne=["preference","project","identity","constraint","context","personal_data","languages","favorite_things","relationships","pets","naming","professional_profile"],ce=["low","medium","high"];return s&&r.length===0?e.jsx(T,{className:"w-full",children:e.jsx(A,{className:"flex justify-center items-center h-64",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-azure-primary dark:border-matrix-highlight"})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:e.jsx(pe,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Sati Memories"}),e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary",children:"View and manage long-term memories stored by Sati."})]})]}),l.length>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm text-azure-text-muted dark:text-matrix-secondary",children:[l.length," selected"]}),e.jsxs(j,{variant:"destructive",size:"sm",onClick:()=>w(!0),disabled:l.length===0,children:[e.jsx(B,{className:"w-4 h-4 mr-1"}),"Delete Selected"]})]})]}),P&&e.jsx(ve,{variant:"destructive",children:e.jsx(ze,{children:P})}),e.jsxs(T,{children:[e.jsx(I,{className:"border-b border-azure-border dark:border-matrix-primary",children:e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4",children:[e.jsxs("div",{className:"flex flex-col relative w-full",children:[e.jsx(fe,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-azure-text-secondary dark:text-matrix-secondary w-4 h-4"}),e.jsx("input",{type:"text",placeholder:"Search memories...",value:m,onChange:t=>{z(t.target.value),y(1)},className:"w-full pl-10 pr-4 py-2 bg-azure-surface dark:bg-black border border-azure-border dark:border-matrix-primary rounded-md text-azure-text-primary dark:text-matrix-secondary focus:outline-none focus:ring-2 focus:ring-azure-primary dark:focus:ring-matrix-highlight"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[e.jsxs("select",{value:o,onChange:t=>{c(t.target.value),y(1)},className:"px-3 py-2 bg-azure-surface dark:bg-black border border-azure-border dark:border-matrix-primary rounded-md text-azure-text-primary dark:text-matrix-secondary focus:outline-none focus:ring-2 focus:ring-azure-primary dark:focus:ring-matrix-highlight flex-grow",children:[e.jsx("option",{value:"all",children:"All Categories"}),ne.map(t=>e.jsx("option",{value:t,children:t},t))]}),e.jsxs("select",{value:d,onChange:t=>{R(t.target.value),y(1)},className:"px-3 py-2 bg-azure-surface dark:bg-black border border-azure-border dark:border-matrix-primary rounded-md text-azure-text-primary dark:text-matrix-secondary focus:outline-none focus:ring-2 focus:ring-azure-primary dark:focus:ring-matrix-highlight flex-grow",children:[e.jsx("option",{value:"all",children:"All Importance"}),ce.map(t=>e.jsx("option",{value:t,children:t},t))]})]})]})}),e.jsx(A,{className:"p-0",children:e.jsxs(ye,{children:[e.jsx(be,{children:e.jsxs(M,{className:"hover:bg-transparent",children:[e.jsx(f,{className:"w-12",children:e.jsx(F,{checked:r.length>0&&l.length===r.length,onCheckedChange:te})}),e.jsx(f,{children:"Summary"}),e.jsx(f,{children:"Category"}),e.jsx(f,{children:"Importance"}),e.jsx(f,{children:"Created"}),e.jsx(f,{className:"w-32",children:"Actions"})]})}),e.jsx(ke,{children:r.length===0?e.jsx(M,{children:e.jsx(g,{colSpan:6,className:"text-center py-8 text-azure-text-secondary dark:text-matrix-secondary",children:s?"Loading memories...":"No memories found"})}):r.map(t=>e.jsxs(M,{children:[e.jsx(g,{children:e.jsx(F,{checked:l.includes(t.id),onCheckedChange:()=>re(t.id)})}),e.jsx(g,{className:"font-medium max-w-xs truncate",children:t.summary}),e.jsx(g,{children:e.jsx(v,{variant:"outline",children:t.category})}),e.jsx(g,{children:e.jsx(v,{variant:t.importance==="critical"?"destructive":t.importance==="high"?"default":t.importance==="medium"?"secondary":"outline",children:t.importance})}),e.jsx(g,{children:e.jsxs("div",{className:"flex items-center gap-1 text-azure-text-secondary dark:text-matrix-secondary",children:[e.jsx(H,{className:"w-4 h-4"}),new Date(t.created_at).toLocaleDateString()]})}),e.jsx(g,{children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx(j,{variant:"ghost",size:"sm",onClick:()=>le(t),className:"text-blue-500 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",children:e.jsx(O,{className:"w-4 h-4"})}),e.jsx(j,{variant:"ghost",size:"sm",onClick:()=>se(t.id),className:"text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",children:e.jsx(B,{className:"w-4 h-4"})})]})})]},t.id))})]})}),$>1&&e.jsx(je,{page:u,totalPages:$,perPage:h,total:V,onPageChange:y,onPerPageChange:t=>{U(t),y(1)}})]}),Z&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs(T,{className:"w-full max-w-md mx-4",children:[e.jsx(I,{children:e.jsx(Ne,{children:"Delete Memories"})}),e.jsxs(A,{children:[e.jsxs("p",{className:"mb-4",children:["Are you sure you want to delete ",l.length," ","memory(ies)? This action cannot be undone."]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(j,{variant:"outline",onClick:()=>w(!1),children:"Cancel"}),e.jsx(j,{variant:"destructive",onClick:ae,children:"Delete"})]})]})]})}),e.jsx(we,{isOpen:K,onClose:()=>_(!1),memory:G}),e.jsx(oe,{isOpen:Q,onClose:()=>C(!1),onConfirm:ie,title:"Confirm Memory Deletion",message:"Are you sure you want to delete this memory? This action cannot be undone.",confirmButtonText:"Delete Memory",cancelButtonText:"Cancel"})]})};export{_e as SatiMemories};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./vendor-motion-C3CZ8ZlO.js";import{r as b,f as U,c as I}from"./vendor-react-DikRIOlj.js";import{u as F}from"./audit-CcAEDbZh.js";import{E as N,q as P,F as O,J as A,m as $,g as T,I as J,ai as D,as as R,G as B,o as M,a6 as G,w as V,y as W,aj as Z,i as q,at as H,au as X,O as K,a8 as Q,av as Y,r as ee,a2 as te}from"./vendor-icons-DMd9RGvJ.js";import"./vendor-utils-D4NnWbOU.js";import"./index-Dpd1Mkgp.js";const re={llm_call:e.jsx(R,{size:16}),tool_call:e.jsx(N,{size:16}),mcp_tool:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M3.49994 11.7501L11.6717 3.57855C12.7762 2.47398 14.5672 2.47398 15.6717 3.57855C16.7762 4.68312 16.7762 6.47398 15.6717 7.57855M15.6717 7.57855L9.49994 13.7501M15.6717 7.57855C16.7762 6.47398 18.5672 6.47398 19.6717 7.57855C20.7762 8.68312 20.7762 10.474 19.6717 11.5785L12.7072 18.543C12.3167 18.9335 12.3167 19.5667 12.7072 19.9572L13.9999 21.2499",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M17.4999 9.74921L11.3282 15.921C10.2237 17.0255 8.43272 17.0255 7.32823 15.921C6.22373 14.8164 6.22373 13.0255 7.32823 11.921L13.4999 5.74939",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),task_created:e.jsx(D,{size:16}),task_completed:e.jsx(O,{size:16}),skill_executed:e.jsx(J,{size:16}),chronos_job:e.jsx(T,{size:16}),memory_recovery:e.jsx($,{size:16}),memory_persist:e.jsx($,{size:16}),telephonist:e.jsx(A,{size:16})},se={llm_call:"text-blue-400 dark:text-blue-400",tool_call:"text-amber-500 dark:text-amber-400",mcp_tool:"text-orange-500 dark:text-orange-400",task_created:"text-gray-500 dark:text-matrix-secondary",task_completed:"text-green-600 dark:text-matrix-highlight",skill_executed:"text-teal-600 dark:text-teal-400",chronos_job:"text-orange-500 dark:text-orange-400",memory_recovery:"text-emerald-600 dark:text-emerald-400",memory_persist:"text-violet-600 dark:text-violet-400",telephonist:"text-rose-500 dark:text-rose-400"},ae={llm_call:"border-blue-300 dark:border-blue-500/40",tool_call:"border-amber-300 dark:border-amber-500/40",mcp_tool:"border-purple-300 dark:border-purple-500/40",task_created:"border-gray-300 dark:border-matrix-primary/40",task_completed:"border-green-300 dark:border-matrix-highlight/40",skill_executed:"border-teal-300 dark:border-teal-500/40",chronos_job:"border-orange-300 dark:border-orange-500/40",memory_recovery:"border-emerald-300 dark:border-emerald-500/40",memory_persist:"border-violet-300 dark:border-violet-500/40",telephonist:"border-rose-300 dark:border-rose-500/40"},ne={oracle:"🔮",apoc:"🧑🔬",neo:"🥷",trinity:"👩💻",smith:"🤖",keymaker:"🗝️",chronos:"⏰",sati:"🧠",telephonist:"📞"},oe={oracle:"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300",apoc:"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",neo:"bg-purple-100 text-purple-700 dark:bg-purple-900/40 dark:text-purple-300",trinity:"bg-teal-100 text-teal-700 dark:bg-teal-900/40 dark:text-teal-300",smith:"bg-gray-200 text-gray-700 dark:bg-gray-700/60 dark:text-gray-300",keymaker:"bg-pink-100 text-pink-700 dark:bg-pink-900/40 dark:text-pink-300",chronos:"bg-orange-100 text-orange-700 dark:bg-orange-900/40 dark:text-orange-300",sati:"bg-purple-100 text-purple-700 dark:bg-purple-900/40 dark:text-purple-300",telephonist:"bg-rose-100 text-rose-700 dark:bg-rose-900/40 dark:text-rose-300"};function ie(t){return t==null?"—":t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`}function le(t){return t==null||t===0?"—":t<1e-4?"<$0.0001":`$${t.toFixed(4)}`}function de(t,r){if(t==null&&r==null)return"";const l=t??0,n=r??0;return`↑${l.toLocaleString()} ↓${n.toLocaleString()}`}function S(t){return typeof t=="string"?t:JSON.stringify(t,null,2)}function xe({parsedMeta:t,eventType:r}){const l=r==="tool_call"||r==="mcp_tool",{args:n,result:o,...m}=t;if(r==="memory_persist"){const x=Array.isArray(t.inclusions)?t.inclusions:[],d=Array.isArray(t.edits)?t.edits:[],a=Array.isArray(t.deletions)?t.deletions:[];return x.length===0&&d.length===0&&a.length===0?e.jsx("p",{className:"text-[11px] text-gray-400 dark:text-matrix-secondary/50 italic",children:"No memory changes recorded."}):e.jsxs("div",{className:"space-y-2.5",children:[x.length>0&&e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-gray-400 dark:text-matrix-secondary/50 mb-1 flex items-center gap-1",children:[e.jsx(G,{size:10,className:"text-green-500 dark:text-green-400"})," new memories (",x.length,")"]}),e.jsx("div",{className:"space-y-1",children:x.map((s,c)=>e.jsxs("div",{className:"text-[11px] font-mono text-gray-600 dark:text-matrix-secondary bg-gray-50 dark:bg-zinc-900 rounded px-2 py-1.5 flex items-start gap-2",children:[e.jsx("span",{className:"flex-shrink-0 text-[10px] uppercase font-bold text-violet-500 dark:text-violet-400 bg-violet-50 dark:bg-violet-900/30 px-1 rounded",children:s.category??"?"}),e.jsx("span",{className:"flex-1 break-words",children:s.summary??"—"}),s.importance!=null&&e.jsxs("span",{className:"flex-shrink-0 text-[10px] text-gray-400 dark:text-matrix-secondary/50",children:["imp:",s.importance]})]},c))})]}),d.length>0&&e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-gray-400 dark:text-matrix-secondary/50 mb-1 flex items-center gap-1",children:[e.jsx(V,{size:10,className:"text-amber-500 dark:text-amber-400"})," edited memories (",d.length,")"]}),e.jsx("div",{className:"space-y-1",children:d.map((s,c)=>e.jsxs("div",{className:"text-[11px] font-mono text-gray-600 dark:text-matrix-secondary bg-gray-50 dark:bg-zinc-900 rounded px-2 py-1.5",children:[s.id&&e.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-matrix-secondary/50 mr-2",children:["#",s.id]}),s.summary&&e.jsx("span",{className:"break-words",children:s.summary}),s.reason&&e.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-matrix-secondary/50 ml-2",children:["— ",s.reason]})]},c))})]}),a.length>0&&e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-gray-400 dark:text-matrix-secondary/50 mb-1 flex items-center gap-1",children:[e.jsx(W,{size:10,className:"text-red-500 dark:text-red-400"})," archived memories (",a.length,")"]}),e.jsx("div",{className:"space-y-1",children:a.map((s,c)=>e.jsxs("div",{className:"text-[11px] font-mono text-gray-600 dark:text-matrix-secondary bg-gray-50 dark:bg-zinc-900 rounded px-2 py-1.5",children:[s.id&&e.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-matrix-secondary/50 mr-2",children:["#",s.id]}),s.reason&&e.jsx("span",{className:"break-words",children:s.reason})]},c))})]})]})}return l&&(n!==void 0||o!==void 0)?e.jsxs("div",{className:"space-y-2",children:[n!==void 0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-gray-400 dark:text-matrix-secondary/50 mb-1",children:"args"}),e.jsx("pre",{className:"text-[11px] font-mono text-gray-600 dark:text-matrix-secondary bg-gray-50 dark:bg-zinc-900 rounded p-2 overflow-x-auto whitespace-pre-wrap break-words max-h-40 overflow-y-auto",children:S(n)})]}),o!==void 0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-gray-400 dark:text-matrix-secondary/50 mb-1",children:"result"}),e.jsx("pre",{className:"text-[11px] font-mono text-gray-600 dark:text-matrix-secondary bg-gray-50 dark:bg-zinc-900 rounded p-2 overflow-x-auto whitespace-pre-wrap break-words max-h-48 overflow-y-auto",children:S(o)})]}),Object.keys(m).length>0&&e.jsx("pre",{className:"text-[11px] font-mono text-gray-600 dark:text-matrix-secondary bg-gray-50 dark:bg-zinc-900 rounded p-2 overflow-x-auto whitespace-pre-wrap break-words",children:JSON.stringify(m,null,2)})]}):e.jsx("pre",{className:"text-[11px] font-mono text-gray-600 dark:text-matrix-secondary bg-gray-50 dark:bg-zinc-900 rounded p-2 overflow-x-auto whitespace-pre-wrap break-words max-h-48 overflow-y-auto",children:JSON.stringify(t,null,2)})}const L=({event:t})=>{const[r,l]=b.useState(!1),n=re[t.event_type]??e.jsx(N,{size:14}),o=se[t.event_type]??"text-gray-500",m=ae[t.event_type]??"border-gray-300 dark:border-matrix-primary/40",x=t.agent?oe[t.agent]??"bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300":null,d=t.agent?ne[t.agent]:void 0,a=d?`${t.agent?.toUpperCase()} ${d}`:t.agent?.toUpperCase()||null,s=(()=>{try{return t.metadata?typeof t.metadata=="object"?t.metadata:JSON.parse(t.metadata):null}catch{return null}})(),c=s!==null&&Object.keys(s).length>0,i=t.event_type==="memory_recovery"?`${s?.memories_count??0} memories retrieved`:t.event_type==="memory_persist"?(()=>{const h=s?.inclusions_count??0,p=s?.edits_count??0,u=s?.deletions_count??0,y=[];return h&&y.push(`+${h} new`),p&&y.push(`~${p} edited`),u&&y.push(`-${u} archived`),y.length>0?y.join(", "):"memory persisted"})():t.event_type==="telephonist"?(()=>{const h=s?.audio_duration_seconds,p=s?.text_preview,u=h!=null?`${h}s`:"",y=typeof p=="string"&&p?`"${p.length>60?p.slice(0,60)+"…":p}"`:"";return[u,y].filter(Boolean).join(" · ")||"audio transcription"})():t.tool_name??t.model??t.event_type,g=t.event_type==="telephonist",v=s?.audio_duration_seconds,k=g?v!=null?`🎵 ${v}s audio`:"":de(t.input_tokens,t.output_tokens),f=le(t.estimated_cost_usd),_=ie(t.duration_ms),w=t.status==="error"?e.jsx(P,{size:14,className:"text-red-500 flex-shrink-0"}):t.status==="success"?e.jsx(O,{size:14,className:"text-green-500 dark:text-matrix-highlight flex-shrink-0"}):null,C=e.jsx("span",{className:`flex-shrink-0 w-3.5 flex items-center justify-center transition-colors ${c?"text-gray-300 dark:text-matrix-secondary/30 hover:text-gray-500 dark:hover:text-matrix-secondary cursor-pointer":"text-transparent pointer-events-none"}`,children:r?e.jsx(B,{size:12}):e.jsx(M,{size:12})}),z=()=>{c&&l(h=>!h)};return e.jsxs("div",{className:"py-2 px-3 rounded-lg hover:bg-gray-50 dark:hover:bg-zinc-900/60 transition-colors border-b border-gray-100 dark:border-matrix-primary/20 last:border-0",children:[e.jsxs("div",{className:"flex flex-col gap-0.5 md:hidden",children:[e.jsxs("div",{className:`flex items-center gap-2 min-w-0 ${c?"cursor-pointer":""}`,onClick:z,children:[C,e.jsx("span",{className:`flex-shrink-0 ${o}`,children:n}),x&&e.jsx("span",{className:`flex-shrink-0 text-xs font-semibold px-1.5 py-0.5 rounded ${x}`,children:a}),e.jsx("span",{className:"flex-1 text-sm text-gray-700 dark:text-matrix-secondary font-mono break-all leading-snug",children:i}),w]}),e.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0 pl-5 text-[11px] text-gray-400 dark:text-matrix-secondary/60 font-mono",children:[k&&e.jsx("span",{children:k}),e.jsx("span",{children:_}),f!=="—"&&e.jsx("span",{className:"text-gray-600 dark:text-matrix-secondary",children:f})]})]}),e.jsxs("div",{className:`hidden md:flex items-center gap-3 ${c?"cursor-pointer":""}`,onClick:z,children:[C,e.jsx("span",{className:`flex-shrink-0 ${o}`,children:n}),x&&e.jsx("span",{className:`flex-shrink-0 text-xs font-semibold px-1.5 py-0.5 rounded ${x}`,children:a}),e.jsx("span",{className:"flex-1 text-sm truncate text-gray-700 dark:text-matrix-secondary font-mono",children:i}),k&&e.jsx("span",{className:"text-xs text-gray-400 dark:text-matrix-secondary/60 font-mono whitespace-nowrap",children:k}),e.jsx("span",{className:"text-xs text-gray-400 dark:text-matrix-secondary/60 font-mono w-16 text-right whitespace-nowrap",children:_}),w,e.jsx("span",{className:"text-xs text-gray-400 dark:text-matrix-secondary/60 font-mono w-20 text-right whitespace-nowrap",children:f})]}),r&&c&&s&&e.jsx("div",{className:`mt-1.5 ml-5 pl-3 border-l-2 ${m}`,children:e.jsx(xe,{parsedMeta:s,eventType:t.event_type})})]})},ce=({events:t,page:r,pageSize:l,totalCount:n,onPageChange:o})=>{const m=Math.ceil(n/l),x=r*l+1,d=Math.min(r*l+t.length,n);if(t.length===0)return e.jsx("div",{className:"flex items-center justify-center h-40 text-gray-400 dark:text-matrix-secondary/50 text-sm",children:"No audit events for this session."});const a=[],s=new Map;for(const i of t)if(i.task_id){const g=s.get(i.task_id)??[];g.push(i),s.set(i.task_id,g)}const c=new Set;for(const i of t)i.task_id?c.has(i.task_id)||(c.add(i.task_id),a.push({taskId:i.task_id,events:s.get(i.task_id)})):a.push({taskId:null,events:[i]});return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"hidden md:flex items-center gap-3 px-3 py-1 text-xs text-gray-400 dark:text-matrix-secondary/60 border-b border-gray-200 dark:border-matrix-primary/30 font-mono",children:[e.jsx("span",{className:"w-4"}),e.jsx("span",{className:"w-14 flex-shrink-0",children:"agent"}),e.jsx("span",{className:"flex-1",children:"event / tool / model"}),e.jsx("span",{className:"w-28 text-right",children:"tokens ↑↓"}),e.jsx("span",{className:"w-16 text-right",children:"duration"}),e.jsx("span",{className:"w-4"}),e.jsx("span",{className:"w-20 text-right",children:"cost"})]}),e.jsx("div",{className:"flex flex-col",children:a.map(i=>i.taskId?e.jsxs("div",{className:"mb-1",children:[e.jsxs("div",{className:"px-3 py-1 text-xs text-gray-400 dark:text-matrix-secondary/50 font-mono border-l-2 border-blue-300 dark:border-matrix-primary/60 ml-1 mb-0.5",children:["task: ",i.taskId.slice(0,8),"…"]}),e.jsx("div",{className:"pl-4",children:i.events.map(g=>e.jsx(L,{event:g},g.id))})]},i.taskId):e.jsx(L,{event:i.events[0]},i.events[0].id))}),m>1&&e.jsxs("div",{className:"flex items-center justify-between pt-3 border-t border-gray-200 dark:border-matrix-primary/30 mt-2",children:[e.jsxs("span",{className:"text-xs text-gray-400 dark:text-matrix-secondary/60",children:[x,"–",d," of ",n," events"]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>o(r-1),disabled:r===0,className:"p-1 rounded text-gray-400 dark:text-matrix-secondary hover:text-gray-700 dark:hover:text-matrix-highlight disabled:opacity-30 transition-colors",children:e.jsx(Z,{size:16})}),e.jsxs("span",{className:"text-xs self-center text-gray-500 dark:text-matrix-secondary font-mono px-2",children:[r+1," / ",m]}),e.jsx("button",{onClick:()=>o(r+1),disabled:r>=m-1,className:"p-1 rounded text-gray-400 dark:text-matrix-secondary hover:text-gray-700 dark:hover:text-matrix-highlight disabled:opacity-30 transition-colors",children:e.jsx(M,{size:16})})]})]})]})};function j(t){return t===0?"$0.00":t<1e-4?"<$0.0001":`$${t.toFixed(4)}`}function me(t){return t<1e3?`${t}ms`:t<6e4?`${(t/1e3).toFixed(1)}s`:`${(t/6e4).toFixed(1)}m`}const pe=({summary:t})=>e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-matrix-primary p-4 bg-white dark:bg-black",children:[e.jsxs("h3",{className:"text-sm font-semibold text-gray-700 dark:text-matrix-highlight mb-3 flex items-center gap-2",children:[e.jsx(q,{size:14})," Total Cost"]}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-matrix-highlight font-mono",children:j(t.totalCostUsd)}),e.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 text-xs text-gray-500 dark:text-matrix-secondary",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(R,{size:12,className:"text-blue-400"}),e.jsxs("span",{children:[t.llmCallCount," LLM calls"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(N,{size:12,className:"text-amber-400"}),e.jsxs("span",{children:[t.toolCallCount," tool calls"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 col-span-2",children:[e.jsx(T,{size:12,className:"text-gray-400"}),e.jsxs("span",{children:[me(t.totalDurationMs)," total duration"]})]}),t.totalAudioSeconds>0&&e.jsxs("div",{className:"flex items-center gap-1.5 col-span-2",children:[e.jsx(A,{size:12,className:"text-rose-400"}),e.jsxs("span",{children:[t.totalAudioSeconds.toFixed(1),"s audio"]})]})]})]}),t.byAgent.length>0&&e.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-matrix-primary p-4 bg-white dark:bg-black",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-700 dark:text-matrix-highlight mb-3",children:"By Agent"}),e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-gray-400 dark:text-matrix-secondary/60 border-b border-gray-100 dark:border-matrix-primary/30",children:[e.jsx("th",{className:"text-left pb-1.5",children:"Agent"}),e.jsx("th",{className:"text-right pb-1.5",children:"Calls"}),e.jsx("th",{className:"text-right pb-1.5",children:"Tokens"}),e.jsx("th",{className:"text-right pb-1.5",children:"Cost"})]})}),e.jsx("tbody",{children:t.byAgent.map(r=>e.jsxs("tr",{className:"border-b border-gray-50 dark:border-matrix-primary/10 last:border-0",children:[e.jsx("td",{className:"py-1.5 text-gray-700 dark:text-matrix-secondary font-semibold",children:r.agent}),e.jsx("td",{className:"py-1.5 text-right text-gray-500 dark:text-matrix-secondary/70 font-mono",children:r.llmCalls}),e.jsx("td",{className:"py-1.5 text-right text-gray-500 dark:text-matrix-secondary/70 font-mono",children:(r.inputTokens+r.outputTokens).toLocaleString()}),e.jsx("td",{className:"py-1.5 text-right text-gray-700 dark:text-matrix-highlight font-mono",children:j(r.estimatedCostUsd)})]},r.agent))})]})]}),t.byModel.length>0&&e.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-matrix-primary p-4 bg-white dark:bg-black",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-700 dark:text-matrix-highlight mb-3",children:"By Model"}),e.jsx("div",{className:"flex flex-col gap-2",children:t.byModel.map(r=>e.jsxs("div",{className:"border-b border-gray-50 dark:border-matrix-primary/10 last:border-0 pb-2 last:pb-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-0.5",children:[e.jsx("span",{className:"text-xs font-mono text-gray-700 dark:text-matrix-secondary break-all leading-snug",children:r.model}),e.jsx("span",{className:"text-xs font-mono text-gray-700 dark:text-matrix-highlight whitespace-nowrap shrink-0",children:j(r.estimatedCostUsd)})]}),e.jsxs("div",{className:"text-[11px] text-gray-400 dark:text-matrix-secondary/60 font-mono flex flex-wrap gap-x-3",children:[e.jsxs("span",{children:[r.calls," calls"]}),e.jsxs("span",{children:["in ",r.inputTokens.toLocaleString()]}),e.jsxs("span",{children:["out ",r.outputTokens.toLocaleString()]})]})]},`${r.provider}/${r.model}`))})]})]});function ge(t,r){const l=new Blob([JSON.stringify(r,null,2)],{type:"application/json"}),n=URL.createObjectURL(l),o=document.createElement("a");o.href=n,o.download=`audit-${t.slice(0,8)}.json`,o.click(),URL.revokeObjectURL(n)}function he(t,r){const l=["id","created_at","event_type","agent","tool_name","provider","model","input_tokens","output_tokens","duration_ms","status","estimated_cost_usd"],n=r.events.map(a=>[a.id,new Date(a.created_at).toISOString(),a.event_type,a.agent??"",a.tool_name??"",a.provider??"",a.model??"",a.input_tokens??"",a.output_tokens??"",a.duration_ms??"",a.status??"",a.estimated_cost_usd??""].map(s=>`"${String(s).replace(/"/g,'""')}"`).join(",")),o=[l.join(","),...n].join(`
|
|
1
|
+
import{j as e}from"./vendor-motion-C3CZ8ZlO.js";import{r as b,f as U,c as I}from"./vendor-react-DikRIOlj.js";import{u as F}from"./audit-Cggeu9mM.js";import{E as N,q as P,F as O,J as A,m as $,g as T,I as J,ai as D,as as R,G as B,o as M,a6 as G,w as V,y as W,aj as Z,i as q,at as H,au as X,O as K,a8 as Q,av as Y,r as ee,a2 as te}from"./vendor-icons-DMd9RGvJ.js";import"./vendor-utils-D4NnWbOU.js";import"./index-zKplfrXZ.js";const re={llm_call:e.jsx(R,{size:16}),tool_call:e.jsx(N,{size:16}),mcp_tool:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M3.49994 11.7501L11.6717 3.57855C12.7762 2.47398 14.5672 2.47398 15.6717 3.57855C16.7762 4.68312 16.7762 6.47398 15.6717 7.57855M15.6717 7.57855L9.49994 13.7501M15.6717 7.57855C16.7762 6.47398 18.5672 6.47398 19.6717 7.57855C20.7762 8.68312 20.7762 10.474 19.6717 11.5785L12.7072 18.543C12.3167 18.9335 12.3167 19.5667 12.7072 19.9572L13.9999 21.2499",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M17.4999 9.74921L11.3282 15.921C10.2237 17.0255 8.43272 17.0255 7.32823 15.921C6.22373 14.8164 6.22373 13.0255 7.32823 11.921L13.4999 5.74939",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),task_created:e.jsx(D,{size:16}),task_completed:e.jsx(O,{size:16}),skill_executed:e.jsx(J,{size:16}),chronos_job:e.jsx(T,{size:16}),memory_recovery:e.jsx($,{size:16}),memory_persist:e.jsx($,{size:16}),telephonist:e.jsx(A,{size:16})},se={llm_call:"text-blue-400 dark:text-blue-400",tool_call:"text-amber-500 dark:text-amber-400",mcp_tool:"text-orange-500 dark:text-orange-400",task_created:"text-gray-500 dark:text-matrix-secondary",task_completed:"text-green-600 dark:text-matrix-highlight",skill_executed:"text-teal-600 dark:text-teal-400",chronos_job:"text-orange-500 dark:text-orange-400",memory_recovery:"text-emerald-600 dark:text-emerald-400",memory_persist:"text-violet-600 dark:text-violet-400",telephonist:"text-rose-500 dark:text-rose-400"},ae={llm_call:"border-blue-300 dark:border-blue-500/40",tool_call:"border-amber-300 dark:border-amber-500/40",mcp_tool:"border-purple-300 dark:border-purple-500/40",task_created:"border-gray-300 dark:border-matrix-primary/40",task_completed:"border-green-300 dark:border-matrix-highlight/40",skill_executed:"border-teal-300 dark:border-teal-500/40",chronos_job:"border-orange-300 dark:border-orange-500/40",memory_recovery:"border-emerald-300 dark:border-emerald-500/40",memory_persist:"border-violet-300 dark:border-violet-500/40",telephonist:"border-rose-300 dark:border-rose-500/40"},ne={oracle:"🔮",apoc:"🧑🔬",neo:"🥷",trinity:"👩💻",smith:"🤖",keymaker:"🗝️",chronos:"⏰",sati:"🧠",telephonist:"📞"},oe={oracle:"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300",apoc:"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",neo:"bg-purple-100 text-purple-700 dark:bg-purple-900/40 dark:text-purple-300",trinity:"bg-teal-100 text-teal-700 dark:bg-teal-900/40 dark:text-teal-300",smith:"bg-gray-200 text-gray-700 dark:bg-gray-700/60 dark:text-gray-300",keymaker:"bg-pink-100 text-pink-700 dark:bg-pink-900/40 dark:text-pink-300",chronos:"bg-orange-100 text-orange-700 dark:bg-orange-900/40 dark:text-orange-300",sati:"bg-purple-100 text-purple-700 dark:bg-purple-900/40 dark:text-purple-300",telephonist:"bg-rose-100 text-rose-700 dark:bg-rose-900/40 dark:text-rose-300"};function ie(t){return t==null?"—":t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`}function le(t){return t==null||t===0?"—":t<1e-4?"<$0.0001":`$${t.toFixed(4)}`}function de(t,r){if(t==null&&r==null)return"";const l=t??0,n=r??0;return`↑${l.toLocaleString()} ↓${n.toLocaleString()}`}function S(t){return typeof t=="string"?t:JSON.stringify(t,null,2)}function xe({parsedMeta:t,eventType:r}){const l=r==="tool_call"||r==="mcp_tool",{args:n,result:o,...m}=t;if(r==="memory_persist"){const x=Array.isArray(t.inclusions)?t.inclusions:[],d=Array.isArray(t.edits)?t.edits:[],a=Array.isArray(t.deletions)?t.deletions:[];return x.length===0&&d.length===0&&a.length===0?e.jsx("p",{className:"text-[11px] text-gray-400 dark:text-matrix-secondary/50 italic",children:"No memory changes recorded."}):e.jsxs("div",{className:"space-y-2.5",children:[x.length>0&&e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-gray-400 dark:text-matrix-secondary/50 mb-1 flex items-center gap-1",children:[e.jsx(G,{size:10,className:"text-green-500 dark:text-green-400"})," new memories (",x.length,")"]}),e.jsx("div",{className:"space-y-1",children:x.map((s,c)=>e.jsxs("div",{className:"text-[11px] font-mono text-gray-600 dark:text-matrix-secondary bg-gray-50 dark:bg-zinc-900 rounded px-2 py-1.5 flex items-start gap-2",children:[e.jsx("span",{className:"flex-shrink-0 text-[10px] uppercase font-bold text-violet-500 dark:text-violet-400 bg-violet-50 dark:bg-violet-900/30 px-1 rounded",children:s.category??"?"}),e.jsx("span",{className:"flex-1 break-words",children:s.summary??"—"}),s.importance!=null&&e.jsxs("span",{className:"flex-shrink-0 text-[10px] text-gray-400 dark:text-matrix-secondary/50",children:["imp:",s.importance]})]},c))})]}),d.length>0&&e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-gray-400 dark:text-matrix-secondary/50 mb-1 flex items-center gap-1",children:[e.jsx(V,{size:10,className:"text-amber-500 dark:text-amber-400"})," edited memories (",d.length,")"]}),e.jsx("div",{className:"space-y-1",children:d.map((s,c)=>e.jsxs("div",{className:"text-[11px] font-mono text-gray-600 dark:text-matrix-secondary bg-gray-50 dark:bg-zinc-900 rounded px-2 py-1.5",children:[s.id&&e.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-matrix-secondary/50 mr-2",children:["#",s.id]}),s.summary&&e.jsx("span",{className:"break-words",children:s.summary}),s.reason&&e.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-matrix-secondary/50 ml-2",children:["— ",s.reason]})]},c))})]}),a.length>0&&e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-gray-400 dark:text-matrix-secondary/50 mb-1 flex items-center gap-1",children:[e.jsx(W,{size:10,className:"text-red-500 dark:text-red-400"})," archived memories (",a.length,")"]}),e.jsx("div",{className:"space-y-1",children:a.map((s,c)=>e.jsxs("div",{className:"text-[11px] font-mono text-gray-600 dark:text-matrix-secondary bg-gray-50 dark:bg-zinc-900 rounded px-2 py-1.5",children:[s.id&&e.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-matrix-secondary/50 mr-2",children:["#",s.id]}),s.reason&&e.jsx("span",{className:"break-words",children:s.reason})]},c))})]})]})}return l&&(n!==void 0||o!==void 0)?e.jsxs("div",{className:"space-y-2",children:[n!==void 0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-gray-400 dark:text-matrix-secondary/50 mb-1",children:"args"}),e.jsx("pre",{className:"text-[11px] font-mono text-gray-600 dark:text-matrix-secondary bg-gray-50 dark:bg-zinc-900 rounded p-2 overflow-x-auto whitespace-pre-wrap break-words max-h-40 overflow-y-auto",children:S(n)})]}),o!==void 0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-gray-400 dark:text-matrix-secondary/50 mb-1",children:"result"}),e.jsx("pre",{className:"text-[11px] font-mono text-gray-600 dark:text-matrix-secondary bg-gray-50 dark:bg-zinc-900 rounded p-2 overflow-x-auto whitespace-pre-wrap break-words max-h-48 overflow-y-auto",children:S(o)})]}),Object.keys(m).length>0&&e.jsx("pre",{className:"text-[11px] font-mono text-gray-600 dark:text-matrix-secondary bg-gray-50 dark:bg-zinc-900 rounded p-2 overflow-x-auto whitespace-pre-wrap break-words",children:JSON.stringify(m,null,2)})]}):e.jsx("pre",{className:"text-[11px] font-mono text-gray-600 dark:text-matrix-secondary bg-gray-50 dark:bg-zinc-900 rounded p-2 overflow-x-auto whitespace-pre-wrap break-words max-h-48 overflow-y-auto",children:JSON.stringify(t,null,2)})}const L=({event:t})=>{const[r,l]=b.useState(!1),n=re[t.event_type]??e.jsx(N,{size:14}),o=se[t.event_type]??"text-gray-500",m=ae[t.event_type]??"border-gray-300 dark:border-matrix-primary/40",x=t.agent?oe[t.agent]??"bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300":null,d=t.agent?ne[t.agent]:void 0,a=d?`${t.agent?.toUpperCase()} ${d}`:t.agent?.toUpperCase()||null,s=(()=>{try{return t.metadata?typeof t.metadata=="object"?t.metadata:JSON.parse(t.metadata):null}catch{return null}})(),c=s!==null&&Object.keys(s).length>0,i=t.event_type==="memory_recovery"?`${s?.memories_count??0} memories retrieved`:t.event_type==="memory_persist"?(()=>{const h=s?.inclusions_count??0,p=s?.edits_count??0,u=s?.deletions_count??0,y=[];return h&&y.push(`+${h} new`),p&&y.push(`~${p} edited`),u&&y.push(`-${u} archived`),y.length>0?y.join(", "):"memory persisted"})():t.event_type==="telephonist"?(()=>{const h=s?.audio_duration_seconds,p=s?.text_preview,u=h!=null?`${h}s`:"",y=typeof p=="string"&&p?`"${p.length>60?p.slice(0,60)+"…":p}"`:"";return[u,y].filter(Boolean).join(" · ")||"audio transcription"})():t.tool_name??t.model??t.event_type,g=t.event_type==="telephonist",v=s?.audio_duration_seconds,k=g?v!=null?`🎵 ${v}s audio`:"":de(t.input_tokens,t.output_tokens),f=le(t.estimated_cost_usd),_=ie(t.duration_ms),w=t.status==="error"?e.jsx(P,{size:14,className:"text-red-500 flex-shrink-0"}):t.status==="success"?e.jsx(O,{size:14,className:"text-green-500 dark:text-matrix-highlight flex-shrink-0"}):null,C=e.jsx("span",{className:`flex-shrink-0 w-3.5 flex items-center justify-center transition-colors ${c?"text-gray-300 dark:text-matrix-secondary/30 hover:text-gray-500 dark:hover:text-matrix-secondary cursor-pointer":"text-transparent pointer-events-none"}`,children:r?e.jsx(B,{size:12}):e.jsx(M,{size:12})}),z=()=>{c&&l(h=>!h)};return e.jsxs("div",{className:"py-2 px-3 rounded-lg hover:bg-gray-50 dark:hover:bg-zinc-900/60 transition-colors border-b border-gray-100 dark:border-matrix-primary/20 last:border-0",children:[e.jsxs("div",{className:"flex flex-col gap-0.5 md:hidden",children:[e.jsxs("div",{className:`flex items-center gap-2 min-w-0 ${c?"cursor-pointer":""}`,onClick:z,children:[C,e.jsx("span",{className:`flex-shrink-0 ${o}`,children:n}),x&&e.jsx("span",{className:`flex-shrink-0 text-xs font-semibold px-1.5 py-0.5 rounded ${x}`,children:a}),e.jsx("span",{className:"flex-1 text-sm text-gray-700 dark:text-matrix-secondary font-mono break-all leading-snug",children:i}),w]}),e.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0 pl-5 text-[11px] text-gray-400 dark:text-matrix-secondary/60 font-mono",children:[k&&e.jsx("span",{children:k}),e.jsx("span",{children:_}),f!=="—"&&e.jsx("span",{className:"text-gray-600 dark:text-matrix-secondary",children:f})]})]}),e.jsxs("div",{className:`hidden md:flex items-center gap-3 ${c?"cursor-pointer":""}`,onClick:z,children:[C,e.jsx("span",{className:`flex-shrink-0 ${o}`,children:n}),x&&e.jsx("span",{className:`flex-shrink-0 text-xs font-semibold px-1.5 py-0.5 rounded ${x}`,children:a}),e.jsx("span",{className:"flex-1 text-sm truncate text-gray-700 dark:text-matrix-secondary font-mono",children:i}),k&&e.jsx("span",{className:"text-xs text-gray-400 dark:text-matrix-secondary/60 font-mono whitespace-nowrap",children:k}),e.jsx("span",{className:"text-xs text-gray-400 dark:text-matrix-secondary/60 font-mono w-16 text-right whitespace-nowrap",children:_}),w,e.jsx("span",{className:"text-xs text-gray-400 dark:text-matrix-secondary/60 font-mono w-20 text-right whitespace-nowrap",children:f})]}),r&&c&&s&&e.jsx("div",{className:`mt-1.5 ml-5 pl-3 border-l-2 ${m}`,children:e.jsx(xe,{parsedMeta:s,eventType:t.event_type})})]})},ce=({events:t,page:r,pageSize:l,totalCount:n,onPageChange:o})=>{const m=Math.ceil(n/l),x=r*l+1,d=Math.min(r*l+t.length,n);if(t.length===0)return e.jsx("div",{className:"flex items-center justify-center h-40 text-gray-400 dark:text-matrix-secondary/50 text-sm",children:"No audit events for this session."});const a=[],s=new Map;for(const i of t)if(i.task_id){const g=s.get(i.task_id)??[];g.push(i),s.set(i.task_id,g)}const c=new Set;for(const i of t)i.task_id?c.has(i.task_id)||(c.add(i.task_id),a.push({taskId:i.task_id,events:s.get(i.task_id)})):a.push({taskId:null,events:[i]});return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"hidden md:flex items-center gap-3 px-3 py-1 text-xs text-gray-400 dark:text-matrix-secondary/60 border-b border-gray-200 dark:border-matrix-primary/30 font-mono",children:[e.jsx("span",{className:"w-4"}),e.jsx("span",{className:"w-14 flex-shrink-0",children:"agent"}),e.jsx("span",{className:"flex-1",children:"event / tool / model"}),e.jsx("span",{className:"w-28 text-right",children:"tokens ↑↓"}),e.jsx("span",{className:"w-16 text-right",children:"duration"}),e.jsx("span",{className:"w-4"}),e.jsx("span",{className:"w-20 text-right",children:"cost"})]}),e.jsx("div",{className:"flex flex-col",children:a.map(i=>i.taskId?e.jsxs("div",{className:"mb-1",children:[e.jsxs("div",{className:"px-3 py-1 text-xs text-gray-400 dark:text-matrix-secondary/50 font-mono border-l-2 border-blue-300 dark:border-matrix-primary/60 ml-1 mb-0.5",children:["task: ",i.taskId.slice(0,8),"…"]}),e.jsx("div",{className:"pl-4",children:i.events.map(g=>e.jsx(L,{event:g},g.id))})]},i.taskId):e.jsx(L,{event:i.events[0]},i.events[0].id))}),m>1&&e.jsxs("div",{className:"flex items-center justify-between pt-3 border-t border-gray-200 dark:border-matrix-primary/30 mt-2",children:[e.jsxs("span",{className:"text-xs text-gray-400 dark:text-matrix-secondary/60",children:[x,"–",d," of ",n," events"]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>o(r-1),disabled:r===0,className:"p-1 rounded text-gray-400 dark:text-matrix-secondary hover:text-gray-700 dark:hover:text-matrix-highlight disabled:opacity-30 transition-colors",children:e.jsx(Z,{size:16})}),e.jsxs("span",{className:"text-xs self-center text-gray-500 dark:text-matrix-secondary font-mono px-2",children:[r+1," / ",m]}),e.jsx("button",{onClick:()=>o(r+1),disabled:r>=m-1,className:"p-1 rounded text-gray-400 dark:text-matrix-secondary hover:text-gray-700 dark:hover:text-matrix-highlight disabled:opacity-30 transition-colors",children:e.jsx(M,{size:16})})]})]})]})};function j(t){return t===0?"$0.00":t<1e-4?"<$0.0001":`$${t.toFixed(4)}`}function me(t){return t<1e3?`${t}ms`:t<6e4?`${(t/1e3).toFixed(1)}s`:`${(t/6e4).toFixed(1)}m`}const pe=({summary:t})=>e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-matrix-primary p-4 bg-white dark:bg-black",children:[e.jsxs("h3",{className:"text-sm font-semibold text-gray-700 dark:text-matrix-highlight mb-3 flex items-center gap-2",children:[e.jsx(q,{size:14})," Total Cost"]}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-matrix-highlight font-mono",children:j(t.totalCostUsd)}),e.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 text-xs text-gray-500 dark:text-matrix-secondary",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(R,{size:12,className:"text-blue-400"}),e.jsxs("span",{children:[t.llmCallCount," LLM calls"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(N,{size:12,className:"text-amber-400"}),e.jsxs("span",{children:[t.toolCallCount," tool calls"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 col-span-2",children:[e.jsx(T,{size:12,className:"text-gray-400"}),e.jsxs("span",{children:[me(t.totalDurationMs)," total duration"]})]}),t.totalAudioSeconds>0&&e.jsxs("div",{className:"flex items-center gap-1.5 col-span-2",children:[e.jsx(A,{size:12,className:"text-rose-400"}),e.jsxs("span",{children:[t.totalAudioSeconds.toFixed(1),"s audio"]})]})]})]}),t.byAgent.length>0&&e.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-matrix-primary p-4 bg-white dark:bg-black",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-700 dark:text-matrix-highlight mb-3",children:"By Agent"}),e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-gray-400 dark:text-matrix-secondary/60 border-b border-gray-100 dark:border-matrix-primary/30",children:[e.jsx("th",{className:"text-left pb-1.5",children:"Agent"}),e.jsx("th",{className:"text-right pb-1.5",children:"Calls"}),e.jsx("th",{className:"text-right pb-1.5",children:"Tokens"}),e.jsx("th",{className:"text-right pb-1.5",children:"Cost"})]})}),e.jsx("tbody",{children:t.byAgent.map(r=>e.jsxs("tr",{className:"border-b border-gray-50 dark:border-matrix-primary/10 last:border-0",children:[e.jsx("td",{className:"py-1.5 text-gray-700 dark:text-matrix-secondary font-semibold",children:r.agent}),e.jsx("td",{className:"py-1.5 text-right text-gray-500 dark:text-matrix-secondary/70 font-mono",children:r.llmCalls}),e.jsx("td",{className:"py-1.5 text-right text-gray-500 dark:text-matrix-secondary/70 font-mono",children:(r.inputTokens+r.outputTokens).toLocaleString()}),e.jsx("td",{className:"py-1.5 text-right text-gray-700 dark:text-matrix-highlight font-mono",children:j(r.estimatedCostUsd)})]},r.agent))})]})]}),t.byModel.length>0&&e.jsxs("div",{className:"rounded-lg border border-gray-200 dark:border-matrix-primary p-4 bg-white dark:bg-black",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-700 dark:text-matrix-highlight mb-3",children:"By Model"}),e.jsx("div",{className:"flex flex-col gap-2",children:t.byModel.map(r=>e.jsxs("div",{className:"border-b border-gray-50 dark:border-matrix-primary/10 last:border-0 pb-2 last:pb-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-0.5",children:[e.jsx("span",{className:"text-xs font-mono text-gray-700 dark:text-matrix-secondary break-all leading-snug",children:r.model}),e.jsx("span",{className:"text-xs font-mono text-gray-700 dark:text-matrix-highlight whitespace-nowrap shrink-0",children:j(r.estimatedCostUsd)})]}),e.jsxs("div",{className:"text-[11px] text-gray-400 dark:text-matrix-secondary/60 font-mono flex flex-wrap gap-x-3",children:[e.jsxs("span",{children:[r.calls," calls"]}),e.jsxs("span",{children:["in ",r.inputTokens.toLocaleString()]}),e.jsxs("span",{children:["out ",r.outputTokens.toLocaleString()]})]})]},`${r.provider}/${r.model}`))})]})]});function ge(t,r){const l=new Blob([JSON.stringify(r,null,2)],{type:"application/json"}),n=URL.createObjectURL(l),o=document.createElement("a");o.href=n,o.download=`audit-${t.slice(0,8)}.json`,o.click(),URL.revokeObjectURL(n)}function he(t,r){const l=["id","created_at","event_type","agent","tool_name","provider","model","input_tokens","output_tokens","duration_ms","status","estimated_cost_usd"],n=r.events.map(a=>[a.id,new Date(a.created_at).toISOString(),a.event_type,a.agent??"",a.tool_name??"",a.provider??"",a.model??"",a.input_tokens??"",a.output_tokens??"",a.duration_ms??"",a.status??"",a.estimated_cost_usd??""].map(s=>`"${String(s).replace(/"/g,'""')}"`).join(",")),o=[l.join(","),...n].join(`
|
|
2
2
|
`),m=new Blob([o],{type:"text/csv"}),x=URL.createObjectURL(m),d=document.createElement("a");d.href=x,d.download=`audit-${t.slice(0,8)}.csv`,d.click(),URL.revokeObjectURL(x)}const ye=({sessionId:t,data:r})=>{const[l,n]=b.useState(!1);return r?e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>n(!l),className:"flex items-center gap-1.5 text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-matrix-primary text-gray-600 dark:text-matrix-secondary hover:text-gray-900 dark:hover:text-matrix-highlight hover:border-gray-300 dark:hover:border-matrix-highlight transition-colors",children:[e.jsx(H,{size:14}),"Export",e.jsx(B,{size:12})]}),l&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>n(!1)}),e.jsxs("div",{className:"absolute right-0 top-full mt-1 z-20 bg-white dark:bg-black border border-gray-200 dark:border-matrix-primary rounded-lg shadow-xl min-w-[140px] py-1",children:[e.jsxs("button",{onClick:()=>{ge(t,r),n(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-matrix-secondary hover:bg-gray-50 dark:hover:bg-zinc-900 transition-colors",children:[e.jsx(X,{size:14,className:"text-blue-500"}),"Export JSON"]}),e.jsxs("button",{onClick:()=>{he(t,r),n(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-matrix-secondary hover:bg-gray-50 dark:hover:bg-zinc-900 transition-colors",children:[e.jsx(K,{size:14,className:"text-green-500"}),"Export CSV"]})]})]})]}):null},E=100,ve=()=>{const{id:t}=U(),r=I(),[l,n]=b.useState(0),{data:o,error:m,isLoading:x}=F(t??null,l,E),d=b.useRef(null),[a,s]=b.useState(()=>typeof window<"u"?window.innerWidth>=768:!0);return b.useEffect(()=>{d.current&&(d.current.scrollTop=d.current.scrollHeight)},[o]),e.jsxs("div",{className:"flex flex-col h-full bg-gray-50 dark:bg-black",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-matrix-primary bg-white dark:bg-black flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>r(-1),className:"p-1.5 rounded-lg text-gray-400 dark:text-matrix-secondary hover:text-gray-700 dark:hover:text-matrix-highlight hover:bg-gray-100 dark:hover:bg-zinc-900 transition-colors",children:e.jsx(Q,{size:18})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900 dark:text-matrix-highlight",children:"Session Audit"}),e.jsx("p",{className:"text-xs text-gray-400 dark:text-matrix-secondary/60 font-mono",children:t})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>s(c=>!c),className:"p-1.5 rounded-lg text-gray-400 dark:text-matrix-secondary hover:text-gray-700 dark:hover:text-matrix-highlight hover:bg-gray-100 dark:hover:bg-zinc-900 transition-colors md:hidden",title:"Toggle summary panel",children:e.jsx(Y,{size:18})}),e.jsx(ye,{sessionId:t??"",data:o})]})]}),e.jsxs("div",{className:"flex-1 flex overflow-hidden relative",children:[a&&e.jsx("div",{className:"fixed inset-0 bg-black/40 z-20 md:hidden",onClick:()=>s(!1)}),e.jsxs("div",{ref:d,className:"flex-[6] overflow-y-auto p-6 custom-scrollbar",children:[x&&e.jsxs("div",{className:"flex items-center justify-center h-40 gap-2 text-gray-400 dark:text-matrix-secondary",children:[e.jsx(ee,{size:18,className:"animate-spin"}),"Loading audit events…"]}),m&&e.jsxs("div",{className:"flex items-center gap-2 text-red-500 dark:text-red-400 p-4 rounded-lg border border-red-200 dark:border-red-800 bg-red-50 dark:bg-red-900/20",children:[e.jsx(te,{size:16}),"Failed to load audit events: ",m.message]}),o&&e.jsx(ce,{events:o.events,page:l,pageSize:E,totalCount:o.summary.llmCallCount+o.summary.toolCallCount,onPageChange:n})]}),e.jsx("div",{className:`
|
|
3
3
|
fixed top-16 bottom-0 right-0 z-40 w-72
|
|
4
4
|
md:relative md:inset-auto md:z-auto md:w-auto md:flex-[4] md:translate-x-0
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as s}from"./vendor-motion-C3CZ8ZlO.js";import{r as I}from"./vendor-react-DikRIOlj.js";import{u as de,Z as gr,m as me}from"./vendor-utils-D4NnWbOU.js";import{u as br,c as vr}from"./chronos-2Z9E96_1.js";import{T as w,S as K}from"./SelectInput-KVLsnfra.js";import{c as V,N as M,S as H}from"./config-DdfK4DX6.js";import{C as yr}from"./ConfirmationModal-DsbS3XkJ.js";import{h as xr}from"./index-Dpd1Mkgp.js";import{d as _r,X as kr,N as wr}from"./vendor-icons-DMd9RGvJ.js";function L({title:e,description:t,children:r}){return s.jsxs("div",{className:"border border-azure-border dark:border-matrix-primary rounded-lg p-6 bg-azure-surface/50 dark:bg-matrix-base/50",children:[s.jsxs("div",{className:"mb-4",children:[s.jsx("h3",{className:"text-lg font-medium text-azure-text-primary dark:text-matrix-highlight",children:e}),t&&s.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary mt-1",children:t})]}),s.jsx("div",{className:"space-y-4",children:r})]})}function p(e,t,r){function n(l,d){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:d,constr:a,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,d);const m=a.prototype,f=Object.keys(m);for(let u=0;u<f.length;u++){const h=f[u];h in l||(l[h]=m[h].bind(l))}}const o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(l){var d;const m=r?.Parent?new i:this;n(m,l),(d=m._zod).deferred??(d.deferred=[]);for(const f of m._zod.deferred)f();return m}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:l=>r?.Parent&&l instanceof r.Parent?!0:l?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}class ye extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class $t extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Ot={};function ie(e){return Ot}function Ct(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Ke(e,t){return typeof t=="bigint"?t.toString():t}function Re(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Ge(e){return e==null}function qe(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function zr(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){const d=n.match(/\d?e-(\d?)/);d?.[1]&&(o=Number.parseInt(d[1]))}const i=r>o?r:o,a=Number.parseInt(e.toFixed(i).replace(".","")),l=Number.parseInt(t.toFixed(i).replace(".",""));return a%l/10**i}const at=Symbol("evaluating");function z(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==at)return n===void 0&&(n=at,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function pe(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function le(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function it(e){return JSON.stringify(e)}function jr(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Zt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ne(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Sr=Re(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function xe(e){if(Ne(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(Ne(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function At(e){return xe(e)?{...e}:Array.isArray(e)?[...e]:e}const Nr=new Set(["string","number","symbol"]);function _e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ce(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function b(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function $r(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Or={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Cr(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=le(e._zod.def,{get shape(){const a={};for(const l in t){if(!(l in r.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&(a[l]=r.shape[l])}return pe(this,"shape",a),a},checks:[]});return ce(e,i)}function Zr(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=le(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const l in t){if(!(l in r.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&delete a[l]}return pe(this,"shape",a),a},checks:[]});return ce(e,i)}function Ar(e,t){if(!xe(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const i=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=le(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return pe(this,"shape",i),i}});return ce(e,o)}function Tr(e,t){if(!xe(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=le(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return pe(this,"shape",n),n}});return ce(e,r)}function Er(e,t){const r=le(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return pe(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return ce(e,r)}function Ir(e,t,r){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=le(t._zod.def,{get shape(){const l=t._zod.def.shape,d={...l};if(r)for(const m in r){if(!(m in l))throw new Error(`Unrecognized key: "${m}"`);r[m]&&(d[m]=e?new e({type:"optional",innerType:l[m]}):l[m])}else for(const m in l)d[m]=e?new e({type:"optional",innerType:l[m]}):l[m];return pe(this,"shape",d),d},checks:[]});return ce(t,a)}function Pr(e,t,r){const n=le(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(r)for(const a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return pe(this,"shape",i),i}});return ce(t,n)}function be(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function ve(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Ce(e){return typeof e=="string"?e:e?.message}function se(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const o=Ce(e.inst?._zod.def?.error?.(e))??Ce(t?.error?.(e))??Ce(r.customError?.(e))??Ce(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Ye(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function $e(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const Tt=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ke,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Et=p("$ZodError",Tt),It=p("$ZodError",Tt,{Parent:Error});function Rr(e,t=r=>r.message){const r={},n=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Dr(e,t=r=>r.message){const r={_errors:[]},n=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let a=r,l=0;for(;l<i.path.length;){const d=i.path[l];l===i.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(t(i))):a[d]=a[d]||{_errors:[]},a=a[d],l++}}};return n(e),r}const Xe=e=>(t,r,n,o)=>{const i=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new ye;if(a.issues.length){const l=new(o?.Err??e)(a.issues.map(d=>se(d,i,ie())));throw Zt(l,o?.callee),l}return a.value},He=e=>async(t,r,n,o)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){const l=new(o?.Err??e)(a.issues.map(d=>se(d,i,ie())));throw Zt(l,o?.callee),l}return a.value},De=e=>(t,r,n)=>{const o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new ye;return i.issues.length?{success:!1,error:new(e??Et)(i.issues.map(a=>se(a,o,ie())))}:{success:!0,data:i.value}},Mr=De(It),Me=e=>async(t,r,n)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>se(a,o,ie())))}:{success:!0,data:i.value}},Ur=Me(It),Jr=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Xe(e)(t,r,o)},Lr=e=>(t,r,n)=>Xe(e)(t,r,n),Fr=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return He(e)(t,r,o)},Br=e=>async(t,r,n)=>He(e)(t,r,n),Kr=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return De(e)(t,r,o)},Vr=e=>(t,r,n)=>De(e)(t,r,n),Wr=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Me(e)(t,r,o)},Gr=e=>async(t,r,n)=>Me(e)(t,r,n),qr=/^[cC][^\s-]{8,}$/,Yr=/^[0-9a-z]+$/,Xr=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Hr=/^[0-9a-vA-V]{20}$/,Qr=/^[A-Za-z0-9]{27}$/,en=/^[a-zA-Z0-9_-]{21}$/,tn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,rn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,st=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,nn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,on="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function an(){return new RegExp(on,"u")}const sn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ln=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,cn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,un=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,dn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Pt=/^[A-Za-z0-9_-]*$/,mn=/^\+[1-9]\d{6,14}$/,Rt="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",pn=new RegExp(`^${Rt}$`);function Dt(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function fn(e){return new RegExp(`^${Dt(e)}$`)}function hn(e){const t=Dt({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Rt}T(?:${n})$`)}const gn=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},bn=/^-?\d+$/,Mt=/^-?\d+(?:\.\d+)?$/,vn=/^(?:true|false)$/i,yn=/^[^A-Z]*$/,xn=/^[^a-z]*$/,B=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Ut={number:"number",bigint:"bigint",object:"date"},Jt=p("$ZodCheckLessThan",(e,t)=>{B.init(e,t);const r=Ut[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Lt=p("$ZodCheckGreaterThan",(e,t)=>{B.init(e,t);const r=Ut[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),_n=p("$ZodCheckMultipleOf",(e,t)=>{B.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):zr(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),kn=p("$ZodCheckNumberFormat",(e,t)=>{B.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Or[t.format];e._zod.onattach.push(a=>{const l=a._zod.bag;l.format=t.format,l.minimum=o,l.maximum=i,r&&(l.pattern=bn)}),e._zod.check=a=>{const l=a.value;if(r){if(!Number.isInteger(l)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}l<o&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),l>i&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),wn=p("$ZodCheckMaxLength",(e,t)=>{var r;B.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Ge(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const a=Ye(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),zn=p("$ZodCheckMinLength",(e,t)=>{var r;B.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Ge(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const a=Ye(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),jn=p("$ZodCheckLengthEquals",(e,t)=>{var r;B.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Ge(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{const o=n.value,i=o.length;if(i===t.length)return;const a=Ye(o),l=i>t.length;n.issues.push({origin:a,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ue=p("$ZodCheckStringFormat",(e,t)=>{var r,n;B.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Sn=p("$ZodCheckRegex",(e,t)=>{Ue.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Nn=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=yn),Ue.init(e,t)}),$n=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=xn),Ue.init(e,t)}),On=p("$ZodCheckIncludes",(e,t)=>{B.init(e,t);const r=_e(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Cn=p("$ZodCheckStartsWith",(e,t)=>{B.init(e,t);const r=new RegExp(`^${_e(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Zn=p("$ZodCheckEndsWith",(e,t)=>{B.init(e,t);const r=new RegExp(`.*${_e(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),An=p("$ZodCheckOverwrite",(e,t)=>{B.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Tn{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
|
|
1
|
+
import{j as s}from"./vendor-motion-C3CZ8ZlO.js";import{r as I}from"./vendor-react-DikRIOlj.js";import{u as de,Z as gr,m as me}from"./vendor-utils-D4NnWbOU.js";import{u as br,c as vr}from"./chronos-D3-sWhfU.js";import{T as w,S as K}from"./SelectInput-KVLsnfra.js";import{c as V,N as M,S as H}from"./config-CBqRUPgn.js";import{C as yr}from"./ConfirmationModal-ZQPBeJ2Z.js";import{h as xr}from"./index-zKplfrXZ.js";import{d as _r,X as kr,N as wr}from"./vendor-icons-DMd9RGvJ.js";function L({title:e,description:t,children:r}){return s.jsxs("div",{className:"border border-azure-border dark:border-matrix-primary rounded-lg p-6 bg-azure-surface/50 dark:bg-matrix-base/50",children:[s.jsxs("div",{className:"mb-4",children:[s.jsx("h3",{className:"text-lg font-medium text-azure-text-primary dark:text-matrix-highlight",children:e}),t&&s.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary mt-1",children:t})]}),s.jsx("div",{className:"space-y-4",children:r})]})}function p(e,t,r){function n(l,d){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:d,constr:a,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,d);const m=a.prototype,f=Object.keys(m);for(let u=0;u<f.length;u++){const h=f[u];h in l||(l[h]=m[h].bind(l))}}const o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(l){var d;const m=r?.Parent?new i:this;n(m,l),(d=m._zod).deferred??(d.deferred=[]);for(const f of m._zod.deferred)f();return m}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:l=>r?.Parent&&l instanceof r.Parent?!0:l?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}class ye extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class $t extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Ot={};function ie(e){return Ot}function Ct(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Ke(e,t){return typeof t=="bigint"?t.toString():t}function Re(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Ge(e){return e==null}function qe(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function zr(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){const d=n.match(/\d?e-(\d?)/);d?.[1]&&(o=Number.parseInt(d[1]))}const i=r>o?r:o,a=Number.parseInt(e.toFixed(i).replace(".","")),l=Number.parseInt(t.toFixed(i).replace(".",""));return a%l/10**i}const at=Symbol("evaluating");function z(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==at)return n===void 0&&(n=at,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function pe(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function le(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function it(e){return JSON.stringify(e)}function jr(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Zt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ne(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Sr=Re(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function xe(e){if(Ne(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(Ne(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function At(e){return xe(e)?{...e}:Array.isArray(e)?[...e]:e}const Nr=new Set(["string","number","symbol"]);function _e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ce(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function b(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function $r(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Or={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Cr(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=le(e._zod.def,{get shape(){const a={};for(const l in t){if(!(l in r.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&(a[l]=r.shape[l])}return pe(this,"shape",a),a},checks:[]});return ce(e,i)}function Zr(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=le(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const l in t){if(!(l in r.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&delete a[l]}return pe(this,"shape",a),a},checks:[]});return ce(e,i)}function Ar(e,t){if(!xe(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const i=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=le(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return pe(this,"shape",i),i}});return ce(e,o)}function Tr(e,t){if(!xe(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=le(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return pe(this,"shape",n),n}});return ce(e,r)}function Er(e,t){const r=le(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return pe(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return ce(e,r)}function Ir(e,t,r){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=le(t._zod.def,{get shape(){const l=t._zod.def.shape,d={...l};if(r)for(const m in r){if(!(m in l))throw new Error(`Unrecognized key: "${m}"`);r[m]&&(d[m]=e?new e({type:"optional",innerType:l[m]}):l[m])}else for(const m in l)d[m]=e?new e({type:"optional",innerType:l[m]}):l[m];return pe(this,"shape",d),d},checks:[]});return ce(t,a)}function Pr(e,t,r){const n=le(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(r)for(const a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return pe(this,"shape",i),i}});return ce(t,n)}function be(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function ve(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Ce(e){return typeof e=="string"?e:e?.message}function se(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const o=Ce(e.inst?._zod.def?.error?.(e))??Ce(t?.error?.(e))??Ce(r.customError?.(e))??Ce(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Ye(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function $e(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const Tt=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ke,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Et=p("$ZodError",Tt),It=p("$ZodError",Tt,{Parent:Error});function Rr(e,t=r=>r.message){const r={},n=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Dr(e,t=r=>r.message){const r={_errors:[]},n=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let a=r,l=0;for(;l<i.path.length;){const d=i.path[l];l===i.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(t(i))):a[d]=a[d]||{_errors:[]},a=a[d],l++}}};return n(e),r}const Xe=e=>(t,r,n,o)=>{const i=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new ye;if(a.issues.length){const l=new(o?.Err??e)(a.issues.map(d=>se(d,i,ie())));throw Zt(l,o?.callee),l}return a.value},He=e=>async(t,r,n,o)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){const l=new(o?.Err??e)(a.issues.map(d=>se(d,i,ie())));throw Zt(l,o?.callee),l}return a.value},De=e=>(t,r,n)=>{const o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new ye;return i.issues.length?{success:!1,error:new(e??Et)(i.issues.map(a=>se(a,o,ie())))}:{success:!0,data:i.value}},Mr=De(It),Me=e=>async(t,r,n)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>se(a,o,ie())))}:{success:!0,data:i.value}},Ur=Me(It),Jr=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Xe(e)(t,r,o)},Lr=e=>(t,r,n)=>Xe(e)(t,r,n),Fr=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return He(e)(t,r,o)},Br=e=>async(t,r,n)=>He(e)(t,r,n),Kr=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return De(e)(t,r,o)},Vr=e=>(t,r,n)=>De(e)(t,r,n),Wr=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Me(e)(t,r,o)},Gr=e=>async(t,r,n)=>Me(e)(t,r,n),qr=/^[cC][^\s-]{8,}$/,Yr=/^[0-9a-z]+$/,Xr=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Hr=/^[0-9a-vA-V]{20}$/,Qr=/^[A-Za-z0-9]{27}$/,en=/^[a-zA-Z0-9_-]{21}$/,tn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,rn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,st=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,nn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,on="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function an(){return new RegExp(on,"u")}const sn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ln=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,cn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,un=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,dn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Pt=/^[A-Za-z0-9_-]*$/,mn=/^\+[1-9]\d{6,14}$/,Rt="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",pn=new RegExp(`^${Rt}$`);function Dt(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function fn(e){return new RegExp(`^${Dt(e)}$`)}function hn(e){const t=Dt({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Rt}T(?:${n})$`)}const gn=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},bn=/^-?\d+$/,Mt=/^-?\d+(?:\.\d+)?$/,vn=/^(?:true|false)$/i,yn=/^[^A-Z]*$/,xn=/^[^a-z]*$/,B=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Ut={number:"number",bigint:"bigint",object:"date"},Jt=p("$ZodCheckLessThan",(e,t)=>{B.init(e,t);const r=Ut[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Lt=p("$ZodCheckGreaterThan",(e,t)=>{B.init(e,t);const r=Ut[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),_n=p("$ZodCheckMultipleOf",(e,t)=>{B.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):zr(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),kn=p("$ZodCheckNumberFormat",(e,t)=>{B.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Or[t.format];e._zod.onattach.push(a=>{const l=a._zod.bag;l.format=t.format,l.minimum=o,l.maximum=i,r&&(l.pattern=bn)}),e._zod.check=a=>{const l=a.value;if(r){if(!Number.isInteger(l)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}l<o&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),l>i&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),wn=p("$ZodCheckMaxLength",(e,t)=>{var r;B.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Ge(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const a=Ye(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),zn=p("$ZodCheckMinLength",(e,t)=>{var r;B.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Ge(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const a=Ye(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),jn=p("$ZodCheckLengthEquals",(e,t)=>{var r;B.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!Ge(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{const o=n.value,i=o.length;if(i===t.length)return;const a=Ye(o),l=i>t.length;n.issues.push({origin:a,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ue=p("$ZodCheckStringFormat",(e,t)=>{var r,n;B.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Sn=p("$ZodCheckRegex",(e,t)=>{Ue.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Nn=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=yn),Ue.init(e,t)}),$n=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=xn),Ue.init(e,t)}),On=p("$ZodCheckIncludes",(e,t)=>{B.init(e,t);const r=_e(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Cn=p("$ZodCheckStartsWith",(e,t)=>{B.init(e,t);const r=new RegExp(`^${_e(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Zn=p("$ZodCheckEndsWith",(e,t)=>{B.init(e,t);const r=new RegExp(`.*${_e(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),An=p("$ZodCheckOverwrite",(e,t)=>{B.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Tn{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
|
|
2
2
|
`).filter(a=>a),o=Math.min(...n.map(a=>a.length-a.trimStart().length)),i=n.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(const a of i)this.content.push(a)}compile(){const t=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,o.join(`
|
|
3
3
|
`))}}const En={major:4,minor:3,patch:6},Z=p("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=En;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const o of n)for(const i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(a,l,d)=>{let m=be(a),f;for(const u of l){if(u._zod.def.when){if(!u._zod.def.when(a))continue}else if(m)continue;const h=a.issues.length,g=u._zod.check(a);if(g instanceof Promise&&d?.async===!1)throw new ye;if(f||g instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await g,a.issues.length!==h&&(m||(m=be(a,h)))});else{if(a.issues.length===h)continue;m||(m=be(a,h))}}return f?f.then(()=>a):a},i=(a,l,d)=>{if(be(a))return a.aborted=!0,a;const m=o(l,n,d);if(m instanceof Promise){if(d.async===!1)throw new ye;return m.then(f=>e._zod.parse(f,d))}return e._zod.parse(m,d)};e._zod.run=(a,l)=>{if(l.skipChecks)return e._zod.parse(a,l);if(l.direction==="backward"){const m=e._zod.parse({value:a.value,issues:[]},{...l,skipChecks:!0});return m instanceof Promise?m.then(f=>i(f,a,l)):i(m,a,l)}const d=e._zod.parse(a,l);if(d instanceof Promise){if(l.async===!1)throw new ye;return d.then(m=>o(m,n,l))}return o(d,n,l)}}z(e,"~standard",()=>({validate:o=>{try{const i=Mr(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Ur(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),Qe=p("$ZodString",(e,t)=>{Z.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??gn(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),O=p("$ZodStringFormat",(e,t)=>{Ue.init(e,t),Qe.init(e,t)}),In=p("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=rn),O.init(e,t)}),Pn=p("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=st(n))}else t.pattern??(t.pattern=st());O.init(e,t)}),Rn=p("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=nn),O.init(e,t)}),Dn=p("$ZodURL",(e,t)=>{O.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Mn=p("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=an()),O.init(e,t)}),Un=p("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=en),O.init(e,t)}),Jn=p("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=qr),O.init(e,t)}),Ln=p("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Yr),O.init(e,t)}),Fn=p("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Xr),O.init(e,t)}),Bn=p("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Hr),O.init(e,t)}),Kn=p("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Qr),O.init(e,t)}),Vn=p("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=hn(t)),O.init(e,t)}),Wn=p("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=pn),O.init(e,t)}),Gn=p("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=fn(t)),O.init(e,t)}),qn=p("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=tn),O.init(e,t)}),Yn=p("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=sn),O.init(e,t),e._zod.bag.format="ipv4"}),Xn=p("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ln),O.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Hn=p("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=cn),O.init(e,t)}),Qn=p("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=un),O.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[o,i]=n;if(!i)throw new Error;const a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Ft(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const eo=p("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=dn),O.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Ft(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function to(e){if(!Pt.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ft(r)}const ro=p("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Pt),O.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{to(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),no=p("$ZodE164",(e,t)=>{t.pattern??(t.pattern=mn),O.init(e,t)});function oo(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const ao=p("$ZodJWT",(e,t)=>{O.init(e,t),e._zod.check=r=>{oo(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Bt=p("$ZodNumber",(e,t)=>{Z.init(e,t),e._zod.pattern=e._zod.bag.pattern??Mt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;const i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),io=p("$ZodNumberFormat",(e,t)=>{kn.init(e,t),Bt.init(e,t)}),so=p("$ZodBoolean",(e,t)=>{Z.init(e,t),e._zod.pattern=vn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}const o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),lo=p("$ZodUnknown",(e,t)=>{Z.init(e,t),e._zod.parse=r=>r}),co=p("$ZodNever",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function lt(e,t,r){e.issues.length&&t.issues.push(...ve(r,e.issues)),t.value[r]=e.value}const uo=p("$ZodArray",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);const i=[];for(let a=0;a<o.length;a++){const l=o[a],d=t.element._zod.run({value:l,issues:[]},n);d instanceof Promise?i.push(d.then(m=>lt(m,r,a))):lt(d,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function Ee(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...ve(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Kt(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const r=$r(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Vt(e,t,r,n,o,i){const a=[],l=o.keySet,d=o.catchall._zod,m=d.def.type,f=d.optout==="optional";for(const u in t){if(l.has(u))continue;if(m==="never"){a.push(u);continue}const h=d.run({value:t[u],issues:[]},n);h instanceof Promise?e.push(h.then(g=>Ee(g,r,u,t,f))):Ee(h,r,u,t,f)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}const mo=p("$ZodObject",(e,t)=>{if(Z.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const l=t.shape;Object.defineProperty(t,"shape",{get:()=>{const d={...l};return Object.defineProperty(t,"shape",{value:d}),d}})}const n=Re(()=>Kt(t));z(e._zod,"propValues",()=>{const l=t.shape,d={};for(const m in l){const f=l[m]._zod;if(f.values){d[m]??(d[m]=new Set);for(const u of f.values)d[m].add(u)}}return d});const o=Ne,i=t.catchall;let a;e._zod.parse=(l,d)=>{a??(a=n.value);const m=l.value;if(!o(m))return l.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),l;l.value={};const f=[],u=a.shape;for(const h of a.keys){const g=u[h],$=g._zod.optout==="optional",v=g._zod.run({value:m[h],issues:[]},d);v instanceof Promise?f.push(v.then(Q=>Ee(Q,l,h,m,$))):Ee(v,l,h,m,$)}return i?Vt(f,m,l,d,n.value,e):f.length?Promise.all(f).then(()=>l):l}}),po=p("$ZodObjectJIT",(e,t)=>{mo.init(e,t);const r=e._zod.parse,n=Re(()=>Kt(t)),o=h=>{const g=new Tn(["shape","payload","ctx"]),$=n.value,v=_=>{const D=it(_);return`shape[${D}]._zod.run({ value: input[${D}], issues: [] }, ctx)`};g.write("const input = payload.value;");const Q=Object.create(null);let C=0;for(const _ of $.keys)Q[_]=`key_${C++}`;g.write("const newResult = {};");for(const _ of $.keys){const D=Q[_],E=it(_),re=h[_]?._zod?.optout==="optional";g.write(`const ${D} = ${v(_)};`),re?g.write(`
|
|
4
4
|
if (${D}.issues.length) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,m as n}from"./vendor-motion-C3CZ8ZlO.js";import{r as s}from"./vendor-react-DikRIOlj.js";import{u as Z}from"./vendor-utils-D4NnWbOU.js";import{s as l}from"./skills-D7JjK7JH.js";import{D as K,e as O,j as V}from"./index-Dpd1Mkgp.js";import{W as y,ak as u,Q as b,a2 as F,F as W,V as L,U as I,_ as q,a3 as A,a4 as B,X as H,al as M}from"./vendor-icons-DMd9RGvJ.js";const U={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.05}}},g={hidden:{opacity:0,y:8},show:{opacity:1,y:0}};function Q({skill:r,onToggle:i,onView:d}){return e.jsxs(n.div,{variants:g,className:`rounded-lg border flex flex-col transition-all ${r.enabled?"border-azure-primary/50 dark:border-matrix-primary bg-white dark:bg-zinc-900 shadow-sm":"border-azure-border dark:border-matrix-primary/30 bg-azure-surface/50 dark:bg-zinc-900 shadow-sm"}`,children:[e.jsxs("div",{className:"p-4 flex items-start gap-3 flex-1",children:[e.jsx("div",{className:`w-9 h-9 rounded-lg flex items-center justify-center shrink-0 ${r.enabled?"bg-azure-primary/10 dark:bg-matrix-highlight/10":"bg-azure-surface dark:bg-zinc-900"}`,children:e.jsx(y,{className:`w-4 h-4 ${r.enabled?"text-azure-primary dark:text-matrix-highlight":"text-azure-text-secondary dark:text-matrix-tertiary"}`})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:`font-semibold truncate ${r.enabled?"text-azure-text dark:text-matrix-highlight":"text-azure-text-secondary dark:text-matrix-secondary"}`,children:r.name}),r.version&&e.jsxs("span",{className:"text-[10px] font-mono text-azure-text-secondary dark:text-matrix-tertiary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 rounded px-1.5 py-0.5 shrink-0",children:["v",r.version]}),!r.enabled&&e.jsx("span",{className:"text-[10px] font-medium text-zinc-400 dark:text-zinc-500 bg-zinc-100 dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-700 rounded px-1.5 py-0.5 shrink-0",children:"disabled"})]}),e.jsx("p",{className:`text-sm mt-1.5 line-clamp-2 leading-relaxed ${r.enabled?"text-azure-text-secondary dark:text-matrix-secondary":"text-azure-text-secondary/70 dark:text-matrix-tertiary"}`,children:r.description}),r.tags&&r.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-3",children:r.tags.map(t=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-[10px] font-medium rounded border border-azure-primary/20 dark:border-matrix-primary/40 bg-azure-primary/5 dark:bg-matrix-primary/10 text-azure-primary dark:text-matrix-secondary",children:[e.jsx(L,{className:"w-2.5 h-2.5"}),t]},t))})]})]}),e.jsxs("div",{className:"px-4 py-3 border-t border-azure-border dark:border-matrix-primary/30 flex items-center justify-between gap-2",children:[r.author?e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-azure-text-secondary dark:text-matrix-tertiary min-w-0",children:[e.jsx(I,{className:"w-3 h-3 shrink-0"}),e.jsx("span",{className:"truncate",children:r.author})]}):e.jsx("div",{}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{onClick:d,className:"p-1.5 rounded border border-azure-border dark:border-matrix-primary/50 text-azure-text-secondary dark:text-matrix-tertiary hover:text-azure-primary dark:hover:text-matrix-highlight hover:border-azure-primary dark:hover:border-matrix-highlight transition-colors",title:"View details",children:e.jsx(q,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:i,className:`p-1.5 rounded border transition-colors ${r.enabled?"border-emerald-300 dark:border-emerald-700/60 text-emerald-500 dark:text-emerald-400 hover:bg-emerald-50 dark:hover:bg-emerald-900/20":"border-azure-border dark:border-matrix-primary/40 text-zinc-400 dark:text-zinc-600 hover:text-azure-text dark:hover:text-matrix-secondary hover:border-azure-border dark:hover:border-matrix-primary"}`,title:r.enabled?"Disable skill":"Enable skill",children:r.enabled?e.jsx(A,{className:"w-4 h-4"}):e.jsx(B,{className:"w-4 h-4"})})]})]})]})}function X({skill:r,open:i,onOpenChange:d}){return!i||!r?null:e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>d(!1)}),e.jsxs("div",{className:"relative bg-white dark:bg-black border border-azure-border dark:border-matrix-primary rounded-lg shadow-xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 px-5 py-4 border-b border-azure-border dark:border-matrix-primary shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 flex items-center justify-center shrink-0",children:e.jsx(y,{className:"w-4 h-4 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h2",{className:"text-base font-semibold text-azure-text dark:text-matrix-highlight truncate",children:r.name}),r.version&&e.jsxs("span",{className:"text-[10px] font-mono text-azure-text-secondary dark:text-matrix-tertiary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 rounded px-1.5 py-0.5 shrink-0",children:["v",r.version]})]}),r.author&&e.jsxs("div",{className:"flex items-center gap-1 mt-0.5 text-xs text-azure-text-secondary dark:text-matrix-tertiary",children:[e.jsx(I,{className:"w-3 h-3 shrink-0"}),r.author]})]})]}),e.jsx("button",{onClick:()=>d(!1),className:"p-1.5 rounded text-azure-text-secondary dark:text-matrix-tertiary hover:text-azure-text dark:hover:text-matrix-highlight hover:bg-azure-surface dark:hover:bg-zinc-900 transition-colors shrink-0",children:e.jsx(H,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"overflow-y-auto flex-1 p-5 space-y-5",children:[r.description&&e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary leading-relaxed",children:r.description}),e.jsx("div",{className:"flex flex-col gap-2",children:e.jsxs("div",{className:"flex items-start gap-2 text-xs text-azure-text-secondary dark:text-matrix-tertiary",children:[e.jsx(M,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),e.jsx("span",{className:"break-all font-mono text-azure-text dark:text-matrix-secondary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 rounded px-2 py-0.5",children:r.path})]})}),r.tags&&r.tags.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-2",children:"Tags"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:r.tags.map(t=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-[10px] font-medium rounded border border-azure-primary/20 dark:border-matrix-primary/40 bg-azure-primary/5 dark:bg-matrix-primary/10 text-azure-primary dark:text-matrix-secondary",children:[e.jsx(L,{className:"w-2.5 h-2.5"}),t]},t))})]}),r.examples&&r.examples.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-2",children:"Examples"}),e.jsx("ul",{className:"space-y-1.5",children:r.examples.map((t,x)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm text-azure-text-secondary dark:text-matrix-secondary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/30 rounded px-3 py-2",children:[e.jsxs("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary font-mono text-xs mt-0.5 shrink-0",children:[x+1,"."]}),t]},x))})]}),r.content&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-2",children:"SKILL.md"}),e.jsx("pre",{className:"rounded-lg bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 p-4 text-xs text-azure-text-secondary dark:text-matrix-secondary overflow-auto max-h-72 whitespace-pre-wrap leading-relaxed font-mono",children:r.content})]})]})]})]})}function ae(){const[r,i]=s.useState(null),[d,t]=s.useState(!1),[x,N]=s.useState(!1),[o,v]=s.useState(!1),[c,k]=s.useState(null),[w,f]=s.useState(null),j=s.useRef(null),{data:S,mutate:z,isLoading:D}=Z("/skills",()=>l.fetchSkills(),{refreshInterval:1e4}),m=S?.skills??[],E=S?.enabled??0,R=async()=>{await l.reloadSkills(),z()},T=async a=>{a.enabled?await l.disableSkill(a.name):await l.enableSkill(a.name),z()},$=async a=>{t(!0);try{const p=await l.fetchSkill(a.name);i(p)}finally{t(!1)}},P=async a=>{const p=a.target.files?.[0];if(p){k(null),f(null),v(!0);try{const h=await l.uploadSkill(p);f(`Skill "${h.skill.name}" uploaded successfully!`),z(),j.current&&(j.current.value="")}catch(h){k({error:h.message||"Upload failed",details:h.details})}finally{v(!1)}}},C=()=>{k(null),f(null),N(!0)};return e.jsxs(n.div,{variants:U,initial:"hidden",animate:"show",className:"space-y-6",children:[e.jsxs(n.div,{variants:g,className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:e.jsx(y,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Skills"}),e.jsxs("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary",children:[m.length," skill",m.length!==1?"s":"",", ",E," enabled"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:C,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-azure-primary dark:border-matrix-primary text-azure-primary dark:text-matrix-primary font-medium hover:bg-azure-primary/10 dark:hover:bg-matrix-primary/10 transition-colors",children:[e.jsx(u,{className:"w-4 h-4"}),"Upload"]}),e.jsxs("button",{onClick:R,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-azure-primary dark:bg-matrix-primary text-white dark:text-black font-medium hover:opacity-90 transition-opacity",children:[e.jsx(b,{className:"w-4 h-4"}),"Reload"]})]})]}),D?e.jsxs(n.div,{variants:g,className:"text-center py-12",children:[e.jsx(b,{className:"w-8 h-8 animate-spin mx-auto text-azure-text-secondary dark:text-matrix-dim"}),e.jsx("p",{className:"mt-2 text-azure-text-secondary dark:text-matrix-dim",children:"Loading skills..."})]}):m.length===0?e.jsxs(n.div,{variants:g,className:"rounded-lg border border-dashed border-azure-border dark:border-matrix-primary p-8 text-center",children:[e.jsx(y,{className:"w-12 h-12 mx-auto text-azure-text-tertiary dark:text-matrix-dim"}),e.jsx("h3",{className:"mt-4 text-lg font-medium text-azure-text-primary dark:text-matrix-highlight",children:"No skills found"}),e.jsxs("p",{className:"mt-2 text-azure-text-secondary dark:text-matrix-secondary max-w-md mx-auto",children:["Upload a skill ZIP or add skills manually to"," ",e.jsx("code",{className:"bg-azure-hover dark:bg-zinc-800 px-1 rounded",children:"~/.morpheus/skills/"}),". Each skill folder must contain a"," ",e.jsx("code",{className:"bg-azure-hover dark:bg-zinc-800 px-1 rounded",children:"SKILL.md"})," file with frontmatter."]}),e.jsxs("button",{onClick:C,className:"mt-4 inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-azure-primary dark:bg-matrix-primary text-white dark:text-black font-medium hover:opacity-90 transition-opacity",children:[e.jsx(u,{className:"w-4 h-4"}),"Upload Skill"]})]}):e.jsx(n.div,{variants:U,initial:"hidden",animate:"show",className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:m.map(a=>e.jsx(Q,{skill:a,onToggle:()=>T(a),onView:()=>$(a)},a.name))}),e.jsx(X,{skill:r,open:!!r,onOpenChange:a=>!a&&i(null)}),e.jsxs(K,{open:x,onOpenChange:N,children:[e.jsx(O,{children:e.jsx(V,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(u,{className:"w-5 h-5"}),"Upload Skill"]})})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-azure-text-secondary dark:text-matrix-secondary text-sm",children:["Upload a ZIP file containing your skill folder. The ZIP must have exactly one folder at root level with a valid ",e.jsx("code",{className:"bg-azure-hover dark:bg-zinc-800 px-1 rounded",children:"SKILL.md"})," file."]}),e.jsxs("div",{className:"border-2 border-dashed border-azure-border dark:border-matrix-primary rounded-lg p-6",children:[e.jsx("input",{ref:j,type:"file",accept:".zip,application/zip,application/x-zip-compressed",onChange:P,disabled:o,className:"hidden",id:"skill-upload-input"}),e.jsxs("label",{htmlFor:"skill-upload-input",className:`flex flex-col items-center gap-2 cursor-pointer ${o?"opacity-50 cursor-not-allowed":""}`,children:[o?e.jsx(b,{className:"w-8 h-8 animate-spin text-azure-primary dark:text-matrix-primary"}):e.jsx(u,{className:"w-8 h-8 text-azure-text-tertiary dark:text-matrix-dim"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-secondary",children:o?"Uploading...":"Click to select ZIP file"})]})]}),c&&e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",children:[e.jsx(F,{className:"w-5 h-5 text-red-600 dark:text-red-400 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200",children:c.error}),c.details&&e.jsx("p",{className:"text-xs text-red-600 dark:text-red-300 mt-1",children:c.details})]})]}),w&&e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800",children:[e.jsx(W,{className:"w-5 h-5 text-green-600 dark:text-green-400"}),e.jsx("p",{className:"text-sm text-green-800 dark:text-green-200",children:w})]}),e.jsxs("div",{className:"rounded-lg bg-azure-hover dark:bg-zinc-900 p-3",children:[e.jsx("h4",{className:"text-sm font-medium text-azure-text-primary dark:text-matrix-highlight mb-2",children:"ZIP Structure Example"}),e.jsx("pre",{className:"text-xs text-azure-text-secondary dark:text-matrix-secondary",children:`my-skill.zip
|
|
1
|
+
import{j as e,m as n}from"./vendor-motion-C3CZ8ZlO.js";import{r as s}from"./vendor-react-DikRIOlj.js";import{u as Z}from"./vendor-utils-D4NnWbOU.js";import{s as l}from"./skills-jmw8yTJs.js";import{D as K,e as O,j as V}from"./index-zKplfrXZ.js";import{W as y,ak as u,Q as b,a2 as F,F as W,V as L,U as I,_ as q,a3 as A,a4 as B,X as H,al as M}from"./vendor-icons-DMd9RGvJ.js";const U={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.05}}},g={hidden:{opacity:0,y:8},show:{opacity:1,y:0}};function Q({skill:r,onToggle:i,onView:d}){return e.jsxs(n.div,{variants:g,className:`rounded-lg border flex flex-col transition-all ${r.enabled?"border-azure-primary/50 dark:border-matrix-primary bg-white dark:bg-zinc-900 shadow-sm":"border-azure-border dark:border-matrix-primary/30 bg-azure-surface/50 dark:bg-zinc-900 shadow-sm"}`,children:[e.jsxs("div",{className:"p-4 flex items-start gap-3 flex-1",children:[e.jsx("div",{className:`w-9 h-9 rounded-lg flex items-center justify-center shrink-0 ${r.enabled?"bg-azure-primary/10 dark:bg-matrix-highlight/10":"bg-azure-surface dark:bg-zinc-900"}`,children:e.jsx(y,{className:`w-4 h-4 ${r.enabled?"text-azure-primary dark:text-matrix-highlight":"text-azure-text-secondary dark:text-matrix-tertiary"}`})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:`font-semibold truncate ${r.enabled?"text-azure-text dark:text-matrix-highlight":"text-azure-text-secondary dark:text-matrix-secondary"}`,children:r.name}),r.version&&e.jsxs("span",{className:"text-[10px] font-mono text-azure-text-secondary dark:text-matrix-tertiary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 rounded px-1.5 py-0.5 shrink-0",children:["v",r.version]}),!r.enabled&&e.jsx("span",{className:"text-[10px] font-medium text-zinc-400 dark:text-zinc-500 bg-zinc-100 dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-700 rounded px-1.5 py-0.5 shrink-0",children:"disabled"})]}),e.jsx("p",{className:`text-sm mt-1.5 line-clamp-2 leading-relaxed ${r.enabled?"text-azure-text-secondary dark:text-matrix-secondary":"text-azure-text-secondary/70 dark:text-matrix-tertiary"}`,children:r.description}),r.tags&&r.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-3",children:r.tags.map(t=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-[10px] font-medium rounded border border-azure-primary/20 dark:border-matrix-primary/40 bg-azure-primary/5 dark:bg-matrix-primary/10 text-azure-primary dark:text-matrix-secondary",children:[e.jsx(L,{className:"w-2.5 h-2.5"}),t]},t))})]})]}),e.jsxs("div",{className:"px-4 py-3 border-t border-azure-border dark:border-matrix-primary/30 flex items-center justify-between gap-2",children:[r.author?e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-azure-text-secondary dark:text-matrix-tertiary min-w-0",children:[e.jsx(I,{className:"w-3 h-3 shrink-0"}),e.jsx("span",{className:"truncate",children:r.author})]}):e.jsx("div",{}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{onClick:d,className:"p-1.5 rounded border border-azure-border dark:border-matrix-primary/50 text-azure-text-secondary dark:text-matrix-tertiary hover:text-azure-primary dark:hover:text-matrix-highlight hover:border-azure-primary dark:hover:border-matrix-highlight transition-colors",title:"View details",children:e.jsx(q,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:i,className:`p-1.5 rounded border transition-colors ${r.enabled?"border-emerald-300 dark:border-emerald-700/60 text-emerald-500 dark:text-emerald-400 hover:bg-emerald-50 dark:hover:bg-emerald-900/20":"border-azure-border dark:border-matrix-primary/40 text-zinc-400 dark:text-zinc-600 hover:text-azure-text dark:hover:text-matrix-secondary hover:border-azure-border dark:hover:border-matrix-primary"}`,title:r.enabled?"Disable skill":"Enable skill",children:r.enabled?e.jsx(A,{className:"w-4 h-4"}):e.jsx(B,{className:"w-4 h-4"})})]})]})]})}function X({skill:r,open:i,onOpenChange:d}){return!i||!r?null:e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>d(!1)}),e.jsxs("div",{className:"relative bg-white dark:bg-black border border-azure-border dark:border-matrix-primary rounded-lg shadow-xl w-full max-w-2xl max-h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 px-5 py-4 border-b border-azure-border dark:border-matrix-primary shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 flex items-center justify-center shrink-0",children:e.jsx(y,{className:"w-4 h-4 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h2",{className:"text-base font-semibold text-azure-text dark:text-matrix-highlight truncate",children:r.name}),r.version&&e.jsxs("span",{className:"text-[10px] font-mono text-azure-text-secondary dark:text-matrix-tertiary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 rounded px-1.5 py-0.5 shrink-0",children:["v",r.version]})]}),r.author&&e.jsxs("div",{className:"flex items-center gap-1 mt-0.5 text-xs text-azure-text-secondary dark:text-matrix-tertiary",children:[e.jsx(I,{className:"w-3 h-3 shrink-0"}),r.author]})]})]}),e.jsx("button",{onClick:()=>d(!1),className:"p-1.5 rounded text-azure-text-secondary dark:text-matrix-tertiary hover:text-azure-text dark:hover:text-matrix-highlight hover:bg-azure-surface dark:hover:bg-zinc-900 transition-colors shrink-0",children:e.jsx(H,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"overflow-y-auto flex-1 p-5 space-y-5",children:[r.description&&e.jsx("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-secondary leading-relaxed",children:r.description}),e.jsx("div",{className:"flex flex-col gap-2",children:e.jsxs("div",{className:"flex items-start gap-2 text-xs text-azure-text-secondary dark:text-matrix-tertiary",children:[e.jsx(M,{className:"w-3.5 h-3.5 shrink-0 mt-0.5"}),e.jsx("span",{className:"break-all font-mono text-azure-text dark:text-matrix-secondary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 rounded px-2 py-0.5",children:r.path})]})}),r.tags&&r.tags.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-2",children:"Tags"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:r.tags.map(t=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 text-[10px] font-medium rounded border border-azure-primary/20 dark:border-matrix-primary/40 bg-azure-primary/5 dark:bg-matrix-primary/10 text-azure-primary dark:text-matrix-secondary",children:[e.jsx(L,{className:"w-2.5 h-2.5"}),t]},t))})]}),r.examples&&r.examples.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-2",children:"Examples"}),e.jsx("ul",{className:"space-y-1.5",children:r.examples.map((t,x)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm text-azure-text-secondary dark:text-matrix-secondary bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/30 rounded px-3 py-2",children:[e.jsxs("span",{className:"text-azure-text-secondary dark:text-matrix-tertiary font-mono text-xs mt-0.5 shrink-0",children:[x+1,"."]}),t]},x))})]}),r.content&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-azure-text-secondary dark:text-matrix-tertiary mb-2",children:"SKILL.md"}),e.jsx("pre",{className:"rounded-lg bg-azure-surface dark:bg-zinc-900 border border-azure-border dark:border-matrix-primary/40 p-4 text-xs text-azure-text-secondary dark:text-matrix-secondary overflow-auto max-h-72 whitespace-pre-wrap leading-relaxed font-mono",children:r.content})]})]})]})]})}function ae(){const[r,i]=s.useState(null),[d,t]=s.useState(!1),[x,N]=s.useState(!1),[o,v]=s.useState(!1),[c,k]=s.useState(null),[w,f]=s.useState(null),j=s.useRef(null),{data:S,mutate:z,isLoading:D}=Z("/skills",()=>l.fetchSkills(),{refreshInterval:1e4}),m=S?.skills??[],E=S?.enabled??0,R=async()=>{await l.reloadSkills(),z()},T=async a=>{a.enabled?await l.disableSkill(a.name):await l.enableSkill(a.name),z()},$=async a=>{t(!0);try{const p=await l.fetchSkill(a.name);i(p)}finally{t(!1)}},P=async a=>{const p=a.target.files?.[0];if(p){k(null),f(null),v(!0);try{const h=await l.uploadSkill(p);f(`Skill "${h.skill.name}" uploaded successfully!`),z(),j.current&&(j.current.value="")}catch(h){k({error:h.message||"Upload failed",details:h.details})}finally{v(!1)}}},C=()=>{k(null),f(null),N(!0)};return e.jsxs(n.div,{variants:U,initial:"hidden",animate:"show",className:"space-y-6",children:[e.jsxs(n.div,{variants:g,className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-azure-primary/10 dark:bg-matrix-highlight/10 border border-azure-primary/20 dark:border-matrix-highlight/30 flex items-center justify-center",children:e.jsx(y,{className:"w-5 h-5 text-azure-primary dark:text-matrix-highlight"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-azure-text dark:text-matrix-highlight",children:"Skills"}),e.jsxs("p",{className:"text-sm text-azure-text-secondary dark:text-matrix-tertiary",children:[m.length," skill",m.length!==1?"s":"",", ",E," enabled"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:C,className:"flex items-center gap-2 px-4 py-2 rounded-lg border border-azure-primary dark:border-matrix-primary text-azure-primary dark:text-matrix-primary font-medium hover:bg-azure-primary/10 dark:hover:bg-matrix-primary/10 transition-colors",children:[e.jsx(u,{className:"w-4 h-4"}),"Upload"]}),e.jsxs("button",{onClick:R,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-azure-primary dark:bg-matrix-primary text-white dark:text-black font-medium hover:opacity-90 transition-opacity",children:[e.jsx(b,{className:"w-4 h-4"}),"Reload"]})]})]}),D?e.jsxs(n.div,{variants:g,className:"text-center py-12",children:[e.jsx(b,{className:"w-8 h-8 animate-spin mx-auto text-azure-text-secondary dark:text-matrix-dim"}),e.jsx("p",{className:"mt-2 text-azure-text-secondary dark:text-matrix-dim",children:"Loading skills..."})]}):m.length===0?e.jsxs(n.div,{variants:g,className:"rounded-lg border border-dashed border-azure-border dark:border-matrix-primary p-8 text-center",children:[e.jsx(y,{className:"w-12 h-12 mx-auto text-azure-text-tertiary dark:text-matrix-dim"}),e.jsx("h3",{className:"mt-4 text-lg font-medium text-azure-text-primary dark:text-matrix-highlight",children:"No skills found"}),e.jsxs("p",{className:"mt-2 text-azure-text-secondary dark:text-matrix-secondary max-w-md mx-auto",children:["Upload a skill ZIP or add skills manually to"," ",e.jsx("code",{className:"bg-azure-hover dark:bg-zinc-800 px-1 rounded",children:"~/.morpheus/skills/"}),". Each skill folder must contain a"," ",e.jsx("code",{className:"bg-azure-hover dark:bg-zinc-800 px-1 rounded",children:"SKILL.md"})," file with frontmatter."]}),e.jsxs("button",{onClick:C,className:"mt-4 inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-azure-primary dark:bg-matrix-primary text-white dark:text-black font-medium hover:opacity-90 transition-opacity",children:[e.jsx(u,{className:"w-4 h-4"}),"Upload Skill"]})]}):e.jsx(n.div,{variants:U,initial:"hidden",animate:"show",className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:m.map(a=>e.jsx(Q,{skill:a,onToggle:()=>T(a),onView:()=>$(a)},a.name))}),e.jsx(X,{skill:r,open:!!r,onOpenChange:a=>!a&&i(null)}),e.jsxs(K,{open:x,onOpenChange:N,children:[e.jsx(O,{children:e.jsx(V,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(u,{className:"w-5 h-5"}),"Upload Skill"]})})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-azure-text-secondary dark:text-matrix-secondary text-sm",children:["Upload a ZIP file containing your skill folder. The ZIP must have exactly one folder at root level with a valid ",e.jsx("code",{className:"bg-azure-hover dark:bg-zinc-800 px-1 rounded",children:"SKILL.md"})," file."]}),e.jsxs("div",{className:"border-2 border-dashed border-azure-border dark:border-matrix-primary rounded-lg p-6",children:[e.jsx("input",{ref:j,type:"file",accept:".zip,application/zip,application/x-zip-compressed",onChange:P,disabled:o,className:"hidden",id:"skill-upload-input"}),e.jsxs("label",{htmlFor:"skill-upload-input",className:`flex flex-col items-center gap-2 cursor-pointer ${o?"opacity-50 cursor-not-allowed":""}`,children:[o?e.jsx(b,{className:"w-8 h-8 animate-spin text-azure-primary dark:text-matrix-primary"}):e.jsx(u,{className:"w-8 h-8 text-azure-text-tertiary dark:text-matrix-dim"}),e.jsx("span",{className:"text-azure-text-secondary dark:text-matrix-secondary",children:o?"Uploading...":"Click to select ZIP file"})]})]}),c&&e.jsxs("div",{className:"flex items-start gap-2 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",children:[e.jsx(F,{className:"w-5 h-5 text-red-600 dark:text-red-400 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-red-800 dark:text-red-200",children:c.error}),c.details&&e.jsx("p",{className:"text-xs text-red-600 dark:text-red-300 mt-1",children:c.details})]})]}),w&&e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800",children:[e.jsx(W,{className:"w-5 h-5 text-green-600 dark:text-green-400"}),e.jsx("p",{className:"text-sm text-green-800 dark:text-green-200",children:w})]}),e.jsxs("div",{className:"rounded-lg bg-azure-hover dark:bg-zinc-900 p-3",children:[e.jsx("h4",{className:"text-sm font-medium text-azure-text-primary dark:text-matrix-highlight mb-2",children:"ZIP Structure Example"}),e.jsx("pre",{className:"text-xs text-azure-text-secondary dark:text-matrix-secondary",children:`my-skill.zip
|
|
2
2
|
└── my-skill/
|
|
3
3
|
├── SKILL.md (required)
|
|
4
4
|
├── scripts/ (optional)
|