@standardagents/builder 0.12.7 → 0.12.9
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/built-in-routes.js +52 -5
- package/dist/built-in-routes.js.map +1 -1
- package/dist/client/assets/index.css +1 -1
- package/dist/client/index.js +29 -29
- package/dist/client/vendor.js +1 -1
- package/dist/client/vue.js +1 -1
- package/dist/index.js +115 -105
- package/dist/index.js.map +1 -1
- package/dist/plugin.js +115 -105
- package/dist/plugin.js.map +1 -1
- package/package.json +19 -20
package/dist/client/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import{d as ve,i as $r,c as U,t as ba,r as p,w as ge,o as Pe,a as Ye,p as xa,b as n,e as r,n as st,f as e,g as je,h as Le,j as ya,k as T,l as Ae,m as ne,q as w,s as j,F as fe,u as ke,v as X,x as C,y as Ke,z as q,A as Te,B as Ue,C as ka,D as wa,I as Cr,E as _a,G as $a,T as Sr,H as S,J as Qe,K as Ze,L as it,M as Be,N as Ca,O as Re,P as gt,Q as Tr,R as Ir,S as ut,U as bt,V as tr,W as kt,X as et,Y as zr,Z as Sa,_ as Vr,$ as Ne,a0 as Oe,a1 as Mr,a2 as nt,a3 as vt,a4 as Jt,a5 as rr,a6 as Ta,a7 as Yt,a8 as Ia,a9 as Er,aa as za,ab as Lr,ac as Pr,ad as Ar,ae as Va,af as Ma,ag as Ea,ah as La,ai as Pa,aj as Aa,ak as Nt,al as ja,am as Da,an as ar,ao as Oa,ap as Ra,aq as Ua,ar as Ba,as as Fa,at as jr,au as Na,av as qa,aw as Ha,ax as Wa,ay as Ka,az as Ja,aA as Ya,aB as Ga,aC as Za,aD as Xa,aE as Qa}from"./vue.js";import{a6 as eo,a7 as to,a8 as ro,a9 as Vt,aa as ao,r as Mt}from"./vendor.js";import{W as oo,a as no,e as or}from"./monaco.js";(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))i(l);new MutationObserver(l=>{for(const u of l)if(u.type==="childList")for(const s of u.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&i(s)}).observe(document,{childList:!0,subtree:!0});function a(l){const u={};return l.integrity&&(u.integrity=l.integrity),l.referrerPolicy&&(u.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?u.credentials="include":l.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(l){if(l.ep)return;l.ep=!0;const u=a(l);fetch(l.href,u)}})();var Dr=class{endpoint;token;constructor(t){this.endpoint=t.replace(/\/$/,""),this.token=typeof localStorage<"u"?localStorage.getItem("agentbuilder_auth_token"):null}getEndpoint(){return this.endpoint}async createThread(t){const o=await fetch(`${this.endpoint}/threads`,{method:"POST",headers:{...this.getHeaders(),"Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok)throw new Error(`Failed to create thread: ${o.statusText}`);return o.json()}async getThread(t){const o=await fetch(`${this.endpoint}/threads/${t}`,{method:"GET",headers:this.getHeaders()});if(!o.ok)throw new Error(`Failed to get thread: ${o.statusText}`);return o.json()}async getMessages(t,o={}){const a=new URLSearchParams;o.limit!==void 0&&a.set("limit",String(o.limit)),o.offset!==void 0&&a.set("offset",String(o.offset)),o.depth!==void 0&&a.set("depth",String(o.depth)),o.includeSilent!==void 0&&a.set("includeSilent",String(o.includeSilent));const i=a.toString(),l=`${this.endpoint}/threads/${t}/messages${i?`?${i}`:""}`,u=await fetch(l,{method:"GET",headers:this.getHeaders()});if(!u.ok)throw new Error(`Failed to get messages: ${u.statusText}`);return(await u.json()).messages||[]}async sendMessage(t,o){const a=await fetch(`${this.endpoint}/threads/${t}/messages`,{method:"POST",headers:{...this.getHeaders(),"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok)throw new Error(`Failed to send message: ${a.statusText}`);return a.json()}async stopExecution(t){const o=await fetch(`${this.endpoint}/threads/${t}/stop`,{method:"POST",headers:this.getHeaders()});if(!o.ok)throw new Error(`Failed to stop execution: ${o.statusText}`);await o.json()}async deleteMessage(t,o){const a=await fetch(`${this.endpoint}/threads/${t}/messages/${o}`,{method:"DELETE",headers:this.getHeaders()});if(!a.ok)throw new Error(`Failed to delete message: ${a.statusText}`);return a.json()}async uploadFile(t,o,a){const i=encodeURIComponent(o.name),l=`${this.endpoint}/threads/${t}/fs/${i}`;if(a?.thumbnail){const s=await this.fileToBase64(o),m=await fetch(l,{method:"POST",headers:{...this.getHeaders(),"Content-Type":"application/json"},body:JSON.stringify({data:s,mimeType:o.type,thumbnail:a.thumbnail,metadata:{width:a.width,height:a.height}})});if(!m.ok)throw new Error(`Failed to upload file: ${m.statusText}`);return m.json()}const u=await fetch(l,{method:"POST",headers:{...this.getHeaders(),"Content-Type":o.type},body:o});if(!u.ok)throw new Error(`Failed to upload file: ${u.statusText}`);return u.json()}fileToBase64(t){return new Promise((o,a)=>{const i=new FileReader;i.onload=()=>{const u=i.result.split(",")[1];o(u)},i.onerror=()=>a(new Error("Failed to read file")),i.readAsDataURL(t)})}getFileUrl(t,o){const i=(o.startsWith("/")?o.slice(1):o).split("/").map(l=>encodeURIComponent(l)).join("/");return`${this.endpoint}/threads/${t}/fs/${i}`}getThumbnailUrl(t,o){return`${this.getFileUrl(t,o)}?thumbnail=true`}async listFiles(t){const o=await fetch(`${this.endpoint}/threads/${t}/fs?find=**/*&type=file`,{method:"GET",headers:this.getHeaders()});if(!o.ok)throw new Error(`Failed to list files: ${o.statusText}`);return(await o.json()).files||[]}connectMessageWebSocket(t,o={},a={}){const i=new URLSearchParams;this.token&&i.set("token",this.token),a.includeSilent!==void 0&&i.set("includeSilent",String(a.includeSilent)),a.depth!==void 0&&i.set("depth",String(a.depth));const l=this.endpoint.startsWith("https")?"wss":"ws",s=`${this.endpoint.replace(/^https?/,l)}/threads/${t}/stream?${i.toString()}`,m=new WebSocket(s);return m.onopen=()=>{o.onOpen?.()},m.onmessage=h=>{try{if(typeof h.data=="string"&&h.data==="pong")return;const x=JSON.parse(h.data);switch(x.type){case"message_data":o.onMessage?.(x);break;case"message_chunk":o.onChunk?.(x);break;case"event":o.onEvent?.(x);break;case"error":o.onError?.(x);break}}catch(x){console.error("Failed to parse WebSocket message:",x)}},m.onerror=h=>{console.error("WebSocket error:",h),o.onError?.({type:"error",error:"WebSocket connection error"})},m.onclose=h=>{console.log(`[AgentBuilderClient] Message WebSocket closed - code: ${h.code}, reason: ${h.reason||"none"}, wasClean: ${h.wasClean}`),o.onClose?.()},m}connectLogWebSocket(t,o={}){const a=new URLSearchParams;this.token&&a.set("token",this.token);const i=this.endpoint.startsWith("https")?"wss":"ws",u=`${this.endpoint.replace(/^https?/,i)}/threads/${t}?${a.toString()}`,s=new WebSocket(u);return s.onopen=()=>{o.onOpen?.()},s.onmessage=m=>{try{if(typeof m.data=="string"&&m.data==="pong")return;const h=JSON.parse(m.data);switch(h.type){case"log_data":o.onLog?.(h);break;case"custom":o.onCustom?.(h);break;case"stopped_by_user":o.onStopped?.(h);break}}catch(h){console.error("Failed to parse WebSocket message:",h)}},s.onerror=m=>{console.error("WebSocket error:",m)},s.onclose=()=>{o.onClose?.()},s}getHeaders(){const t={};return this.token&&(t.Authorization=`Bearer ${this.token}`),t}},lo=class{client;threadId;callbacks;options;ws=null;status="disconnected";reconnectAttempts=0;reconnectTimeout=null;heartbeatInterval=null;isReconnecting=!1;shouldReconnect=!0;constructor(t,o,a={},i={}){this.client=t,this.threadId=o,this.callbacks=a,this.options={depth:i.depth??0,includeSilent:i.includeSilent??!1,heartbeatInterval:i.heartbeatInterval??3e4,maxReconnectDelay:i.maxReconnectDelay??3e4}}getStatus(){return this.status}getThreadId(){return this.threadId}connect(){this.ws&&this.ws.readyState!==WebSocket.CLOSED||(this.shouldReconnect=!0,this.isReconnecting=!1,this.setStatus("connecting"),this.ws=this.client.connectMessageWebSocket(this.threadId,{onOpen:()=>{this.setStatus("connected"),this.reconnectAttempts=0,this.isReconnecting=!1,this.startHeartbeat()},onMessage:t=>{this.callbacks.onMessage?.(t)},onChunk:t=>{this.callbacks.onChunk?.(t)},onEvent:t=>{this.callbacks.onEvent?.(t)},onError:t=>{this.callbacks.onError?.(t)},onClose:()=>{this.clearTimers(),this.scheduleReconnect()}},{depth:this.options.depth,includeSilent:this.options.includeSilent}))}disconnect(){this.shouldReconnect=!1,this.clearTimers(),this.ws&&(this.ws.close(),this.ws=null),this.reconnectAttempts=0,this.isReconnecting=!1,this.setStatus("disconnected")}updateCallbacks(t){this.callbacks={...this.callbacks,...t}}updateOptions(t){this.options={...this.options,...t}}setStatus(t){this.status!==t&&(this.status=t,this.callbacks.onStatusChange?.(t))}startHeartbeat(){this.clearHeartbeat(),this.heartbeatInterval=setInterval(()=>{this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send("ping")},this.options.heartbeatInterval)}clearHeartbeat(){this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}clearReconnectTimeout(){this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null)}clearTimers(){this.clearHeartbeat(),this.clearReconnectTimeout()}scheduleReconnect(){if(!this.shouldReconnect||this.isReconnecting){this.setStatus("disconnected");return}this.isReconnecting=!0,this.setStatus("reconnecting");const t=Math.min(1e3*Math.pow(2,this.reconnectAttempts),this.options.maxReconnectDelay);this.reconnectAttempts++,this.reconnectTimeout=setTimeout(()=>{this.shouldReconnect&&this.connect()},t)}};function nr(t){return t.toLowerCase().startsWith("image/")}var lr=256;function so(t){return new Promise((o,a)=>{const i=new Image,l=URL.createObjectURL(t);i.onload=()=>{URL.revokeObjectURL(l),o(i)},i.onerror=()=>{URL.revokeObjectURL(l),a(new Error("Failed to load image"))},i.src=l})}function io(t){const{width:o,height:a}=t,i=o/a;let l,u;i>1?(l=Math.min(lr,o),u=Math.floor(l/i)):(u=Math.min(lr,a),l=Math.floor(u*i));const s=document.createElement("canvas");s.width=l,s.height=u;const m=s.getContext("2d");if(!m)throw new Error("Failed to get canvas context");return m.drawImage(t,0,0,l,u),s.toDataURL("image/webp",.8).split(",")[1]}async function uo(t){const o=await so(t);return{thumbnail:io(o),width:o.width,height:o.height}}function co(){return`pending-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}function po(t){return new Promise((o,a)=>{const i=new FileReader;i.onload=()=>o(i.result),i.onerror=a,i.readAsDataURL(t)})}var mo=class{createPendingFile(t){return{id:co(),name:t.name,mimeType:t.type,size:t.size,isImage:nr(t.type),localPreviewUrl:null,status:"uploading"}}queueFiles(t){return Array.from(t).map(o=>({pending:this.createPendingFile(o),file:o}))}async executeUpload(t,o,a,i,l,u={}){const{generateThumbnail:s=!0,generatePreview:m=!0}=u,h=nr(o.type);h&&m&&po(o).then(x=>l({localPreviewUrl:x})).catch(x=>console.error("Failed to generate preview:",x));try{let x;if(h&&s)try{const f=await uo(o);x={thumbnail:f.thumbnail,width:f.width,height:f.height}}catch(f){console.warn("Failed to generate thumbnail:",f)}const c=await i.uploadFile(t,o,x);return l({id:c.id,status:"ready",path:c.path,width:c.width,height:c.height}),c}catch(x){throw l({status:"error",error:x instanceof Error?x.message:"Failed to upload file"}),x}}async executeUploads(t,o,a,i,l={}){const u=o.map(({pending:s,file:m})=>this.executeUpload(t,m,s.id,a,h=>i(s.id,h),l).catch(h=>h instanceof Error?h:new Error(String(h))));return Promise.all(u)}};function vo(t){if(t.length===0)return[];const o=[];let a=0;for(;a<t.length;){const i=t[a];if(i.role==="assistant"&&i.tool_calls){let l;try{l=JSON.parse(i.tool_calls)}catch{o.push(i),a++;continue}const u=[],s=[],m=[];let h=i.reasoning_content||null,x="completed";const c=i.id,f=i.created_at,y=i.depth;i.status==="pending"?x="pending":i.status==="failed"&&(x="failed"),i.content&&s.push(i.content);for(const _ of l)u.push({id:_.id||i.id,type:"tool_call",name:_.function?.name,content:_.function?.arguments||null,status:null,tool_call_id:_.id});let b=a+1;for(;b<t.length;){const _=t[b];if(_.role==="tool"){const L=_.tool_status||"pending";if(u.push({id:_.id,type:"tool_result",name:_.name||void 0,content:_.content,status:L,tool_call_id:_.tool_call_id||void 0}),_.attachments)try{let O;typeof _.attachments=="string"?O=JSON.parse(_.attachments):Array.isArray(_.attachments)?O=_.attachments:O=[],m.push(...O)}catch{}b++}else if(_.role==="assistant"&&_.tool_calls){let L;try{L=JSON.parse(_.tool_calls)}catch{break}_.status==="pending"?x="pending":_.status==="failed"&&x!=="pending"&&(x="failed"),_.content&&s.push(_.content),!h&&_.reasoning_content&&(h=_.reasoning_content);for(const O of L)u.push({id:O.id||_.id,type:"tool_call",name:O.function?.name,content:O.function?.arguments||null,status:null,tool_call_id:O.id});b++}else break}const v=new Set(u.filter(_=>_.type==="tool_call").map(_=>_.tool_call_id)),d=u.filter(_=>_.type==="tool_result"&&_.tool_call_id&&!v.has(_.tool_call_id));for(const _ of d){const L=u.indexOf(_),O=_.content?.match(/Tool not found: (\w+)/)?.[1]||"unknown_tool",W={id:`synthetic-${_.tool_call_id}`,type:"tool_call",name:O,content:null,status:_.status,tool_call_id:_.tool_call_id};u.splice(L,0,W)}for(const _ of u)if(_.type==="tool_call"&&_.tool_call_id&&_.status===null){const L=u.find(O=>O.type==="tool_result"&&O.tool_call_id===_.tool_call_id);L?_.status=L.status:_.status="pending"}const k=s.length>0?s.join(""):null,g={id:c,type:"workblock",content:k,reasoning_content:h,workItems:u,status:x,created_at:f,depth:y,attachments:m.length>0?m:void 0};o.push(g),a=b}else o.push(i),a++}return o}var Or=Symbol("StandardAgents"),Rr=Symbol("Thread"),fo={install(t,o){if(!o?.endpoint)throw new Error("StandardAgentsPlugin requires an endpoint option");const i={client:new Dr(o.endpoint),endpoint:o.endpoint};t.provide(Or,i)}};function ho(){const t=$r(Or);if(!t)throw new Error("useStandardAgents must be used within a component where StandardAgentsPlugin is installed");return t}var sr=new mo;function go(t){return new Promise((o,a)=>{const i=new FileReader;i.onload=()=>{const u=i.result.split(",")[1];o(u)},i.onerror=()=>a(new Error("Failed to read file")),i.readAsDataURL(t)})}function bo(t,o={}){const{preload:a=!0,live:i=!0,useWorkblocks:l=!1,depth:u=0,includeSilent:s=!1,endpoint:m}=o,h=U(()=>ba(t)),x=ho(),c=m?new Dr(m):x.client,f={preload:a,live:i,useWorkblocks:l,depth:u,includeSilent:s},y=p([]),b=p("disconnected"),v=p(a),d=p(null),k=p([]),g=p([]),_=p([]),L=U(()=>{const A=new Set(g.value.map(ce=>ce.path));return[...k.value.filter(ce=>!ce.path||!A.has(ce.path)),...g.value]}),O=new Map;let W=null;const J=U(()=>l?vo(y.value):y.value);async function z(){v.value=!0,d.value=null;try{const A=await c.getMessages(h.value,{depth:u,includeSilent:s});y.value=A}catch(A){d.value=A instanceof Error?A:new Error(String(A))}finally{v.value=!1}}async function P(){try{const A=await c.listFiles(h.value);g.value=A.filter(pe=>!pe.isDirectory).map(pe=>({id:pe.path,name:pe.name,path:pe.path,mimeType:pe.mimeType,size:pe.size,isImage:pe.mimeType.startsWith("image/"),status:"committed",localPreviewUrl:null}))}catch(A){console.error("Failed to load files:",A)}}function G(A){if(A.file.isDirectory)return;const pe={id:A.path,name:A.file.name,path:A.path,mimeType:A.file.mimeType,size:A.file.size,isImage:A.file.mimeType?.startsWith("image/")||!1,status:"committed",localPreviewUrl:null},ce=g.value.findIndex(ye=>ye.path===A.path);ce>=0?g.value[ce]=pe:g.value=[...g.value,pe]}function ee(A){if(A.file.isDirectory)return;const pe={id:A.path,name:A.file.name,path:A.path,mimeType:A.file.mimeType,size:A.file.size,isImage:A.file.mimeType?.startsWith("image/")||!1,status:"committed",localPreviewUrl:null},ce=g.value.findIndex(ye=>ye.path===A.path);ce>=0?g.value[ce]=pe:g.value=[...g.value,pe]}function ue(A){g.value=g.value.filter(pe=>pe.path!==A.path)}function me(){i&&(W=new lo(c,h.value,{onStatusChange:A=>{b.value=A},onMessage:A=>{if(A.type==="message_data"){const pe=y.value.findIndex(ce=>ce.id===A.data.id);pe>=0?y.value[pe]=A.data:y.value=[...y.value,A.data]}},onChunk:A=>{const pe=y.value.findIndex(ce=>ce.id===A.message_id);if(pe>=0){const ce=y.value[pe];y.value[pe]={...ce,content:(ce.content||"")+A.chunk}}},onEvent:A=>{A.eventType==="file_created"?G(A.data):A.eventType==="file_updated"?ee(A.data):A.eventType==="file_deleted"&&ue(A.data);const pe=O.get(A.eventType);pe&&pe.forEach(ce=>{try{ce(A.data)}catch(ye){console.error(`Error in event listener for "${A.eventType}":`,ye)}})},onError:A=>{d.value=A instanceof Error?A:new Error(String(A))}},{depth:u,includeSilent:s}),W.connect())}async function Q(A){const pe=`optimistic-${crypto.randomUUID()}`,ce=_.value.map(ae=>({id:ae.id,type:"file",path:"",name:ae.name,mimeType:ae.mimeType,size:ae.size,width:ae.width,height:ae.height,localPreviewUrl:ae.previewUrl||void 0})),ye={id:pe,role:A.role,content:A.content,attachments:ce.length>0?JSON.stringify(ce):null,created_at:Date.now()*1e3,status:"pending"};y.value=[...y.value,ye];const Me=[..._.value];_.value=[];try{const ae=await Promise.all(Me.map(async D=>({name:D.name,mimeType:D.mimeType,data:await go(D.file),width:D.width,height:D.height}))),I=await c.sendMessage(h.value,{...A,attachments:ae.length>0?ae:void 0});return y.value=y.value.filter(D=>D.id!==pe),Me.forEach(D=>{D.previewUrl&&URL.revokeObjectURL(D.previewUrl)}),I}catch(ae){throw _.value=Me,y.value=y.value.filter(I=>I.id!==pe),d.value=ae instanceof Error?ae:new Error(String(ae)),ae}}async function E(){try{await c.stopExecution(h.value)}catch(A){throw d.value=A instanceof Error?A:new Error(String(A)),A}}async function $(A){const pe=[...y.value];y.value=y.value.filter(ce=>ce.id!==A);try{await c.deleteMessage(h.value,A)}catch(ce){throw y.value=pe,d.value=ce instanceof Error?ce:new Error(String(ce)),ce}}function V(A){const pe=sr.queueFiles(A);k.value=[...k.value,...pe.map(ce=>ce.pending)];for(const{pending:ce,file:ye}of pe)sr.executeUpload(h.value,ye,ce.id,c,Me=>{k.value=k.value.map(ae=>ae.id===ce.id?{...ae,...Me}:ae)}).catch(()=>{})}function te(A){k.value=k.value.filter(pe=>pe.id!==A)}function B(A){return A.path?c.getFileUrl(h.value,A.path):""}function N(A){return A.path?c.getThumbnailUrl(h.value,A.path):""}function F(A){return A.isImage?A.localPreviewUrl?A.localPreviewUrl:A.path?N(A):null:null}function Y(A){const ce=(A instanceof FileList?Array.from(A):Array.isArray(A)?A:[A]).map(ye=>{const Me=ye.type.startsWith("image/");return{id:crypto.randomUUID(),file:ye,name:ye.name,mimeType:ye.type,size:ye.size,isImage:Me,previewUrl:Me?URL.createObjectURL(ye):null}});_.value=[..._.value,...ce]}function R(A){const pe=_.value.find(ce=>ce.id===A);pe?.previewUrl&&URL.revokeObjectURL(pe.previewUrl),_.value=_.value.filter(ce=>ce.id!==A)}function H(){_.value.forEach(A=>{A.previewUrl&&URL.revokeObjectURL(A.previewUrl)}),_.value=[]}function M(A,pe){return O.has(A)||O.set(A,new Set),O.get(A).add(pe),()=>{const ce=O.get(A);ce&&(ce.delete(pe),ce.size===0&&O.delete(A))}}function ie(){W?.disconnect(),W=null,b.value="disconnected"}return ge(h,(A,pe)=>{A!==pe&&(ie(),y.value=[],d.value=null,k.value=[],g.value=[],_.value.forEach(ce=>{ce.previewUrl&&URL.revokeObjectURL(ce.previewUrl)}),_.value=[],a&&z(),P(),me())}),Pe(()=>{a&&z(),P(),me()}),Ye(()=>{W?.disconnect(),O.clear(),_.value.forEach(A=>{A.previewUrl&&URL.revokeObjectURL(A.previewUrl)})}),{threadId:h,options:f,messages:y,workblocks:J,status:b,connectionStatus:b,isLoading:v,loading:v,error:d,sendMessage:Q,stopExecution:E,deleteMessage:$,onEvent:M,subscribeToEvent:M,files:L,addFiles:V,removeFile:te,getFileUrl:B,getThumbnailUrl:N,getPreviewUrl:F,attachments:_,addAttachment:Y,removeAttachment:R,clearAttachments:H}}var xo=ve({name:"ThreadProvider",props:{threadId:{type:String,required:!0},preload:{type:Boolean,default:void 0},live:{type:Boolean,default:void 0},useWorkblocks:{type:Boolean,default:void 0},depth:{type:Number,default:void 0},includeSilent:{type:Boolean,default:void 0},endpoint:{type:String,default:void 0}},setup(t,{slots:o}){const a={};t.preload!==void 0&&(a.preload=t.preload),t.live!==void 0&&(a.live=t.live),t.useWorkblocks!==void 0&&(a.useWorkblocks=t.useWorkblocks),t.depth!==void 0&&(a.depth=t.depth),t.includeSilent!==void 0&&(a.includeSilent=t.includeSilent),t.endpoint!==void 0&&(a.endpoint=t.endpoint);const i=bo(()=>t.threadId,a);return xa(Rr,i),()=>o.default?.()}});function Ur(){const t=$r(Rr);if(!t)throw new Error('useThread must be used within a <ThreadProvider>. Wrap your component with <ThreadProvider threadId="...">.');return t}function yo(t,o){const a=`${o.props.type}__${t}`,i=`formkit-${t}`,l=o.props.family?`family:${o.props.family}__${t}`:"",u=`${a}__${l}`;if(!(u in dt)){const s=dt[a]??ko[t]??{};s[i]=!0,l in dt?dt[u]={...dt[l],...s}:dt[u]=s}return dt[u]??{[i]:!0}}const dt={"family:button__wrapper":{"group-data-[disabled=true]:grayscale":!0},"family:button__input":{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"font-bold":!0,"rounded-sm":!0,"outline-hidden":!0,flex:!0,"!text-xs":!0,"px-7":!0,"py-3":!0,"items-center":!0,"mb-1.5":!0,"text-xs":!0,"ring-accent-400":!0,"focus-visible:ring-2":!0,"focus-visible:ring-offset-2":!0,"group-data-[disabled]:!cursor-not-allowed":!0,"shadow-none":!0,"group-data-[prefix-icon]:pl-5":!0,"group-data-[suffix-icon]:pr-5":!0,border:!0,"border-accent-500":!0,"text-accent-500":!0,"group-[&]/repeater:shadow-none":!0,"group-[&]/multistep:shadow-none":!0,"dark:border-accent-500":!0},"family:box__wrapper":{"inline-flex":!0,"items-center":!0,"mb-1":!0,"group-data-[multiple]:mb-0":!0},"family:box__legend":{block:!0,"text-zinc-700":!0,"text-xs":!0,"font-bold":!0,"dark:text-zinc-300":!0,"mb-2":!0},"family:box__input":{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,peer:!0,"pointer-events-none":!0,absolute:!0,"h-0":!0,"w-0":!0,"overflow-hidden":!0,"opacity-0":!0},"family:box__decorator":{"mr-1.5":!0,"bg-white":!0,"ring-accent-400":!0,"peer-checked:border-accent-500":!0,relative:!0,block:!0,"text-base":!0,"w-[1em]":!0,"aspect-[1/1]":!0,border:!0,"border-zinc-300":!0,"text-transparent":!0,"peer-checked:bg-accent-50":!0,"peer-checked:text-accent-500":!0,"peer-focus-visible:ring-2":!0,"peer-focus-visible:ring-offset-1":!0,"select-none":!0,"group-data-[disabled]:!cursor-not-allowed":!0,"peer-disabled:bg-zinc-100":!0,"group-data-[disabled]:grayscale":!0,"shadow-none":!0,"peer-disabled:cursor-not-allowed":!0,"group-[&]/repeater:shadow-none":!0,"group-[&]/multistep:shadow-none":!0,"dark:border-zinc-700":!0,"dark:bg-transparent":!0,"dark:ring-offset-accent-400":!0,"dark:peer-focus-visible:ring-1":!0,"dark:peer-disabled:bg-zinc-600/50":!0,"dark:peer-checked:bg-accent-800":!0,"dark:peer-checked:text-accent-300":!0},"family:box__decoratorIcon":{absolute:!0,"left-1/2":!0,"top-1/2":!0,flex:!0,"h-full":!0,"w-full":!0,"-translate-x-1/2":!0,"-translate-y-1/2":!0},"family:box__option":{"mb-1.5":!0,"last:mb-0":!0,"data-[disabled]:opacity-50":!0,"data-[disabled]:select-none":!0,"group-data-[disabled]:data-[disabled]:opacity-100":!0},"family:box__label":{block:!0,"text-zinc-700":!0,"text-xs":!0,"font-bold":!0,"mb-1":!0,"!mb-0":!0,"!font-normal":!0,"!text-sm":!0,"dark:text-zinc-300":!0},"family:box__optionHelp":{"text-zinc-500":!0,"text-[11px]":!0,"[line-height:1em]":!0,"-mt-1":!0,"mb-1.5":!0,"ml-[min(2em,1.7rem)]":!0,relative:!0,"left-px":!0},"family:box__help":{"text-zinc-500":!0,"text-[11px]":!0,"[line-height:1em]":!0,"dark:text-zinc-400":!0,"mb-1":!0,"group-data-[multiple]:mb-2":!0,"group-data-[multiple]:-mt-1.5":!0},"family:text__wrapper":{flex:!0,"flex-col":!0,"items-start":!0,"justify-start":!0,"mb-1.5":!0,"last:mb-0":!0},"family:text__label":{block:!0,"text-zinc-700":!0,"text-xs":!0,"font-bold":!0,"dark:text-zinc-300":!0,"!inline-flex":!0,"mb-1":!0},"family:text__inner":{"text-sm":!0,flex:!0,"items-center":!0,"w-full":!0,"py-2":!0,"px-3":!0,"rounded-sm":!0,border:!0,"border-zinc-300":!0,"bg-white":!0,"focus-within:ring-1":!0,"focus-within:!ring-accent-400":!0,"focus-within:!border-accent-400":!0,"group-data-[invalid]:border-red-400":!0,"group-data-[invalid]:ring-1":!0,"group-data-[invalid]:ring-red-400":!0,"group-data-[disabled]:bg-zinc-100":!0,"group-data-[disabled]:!cursor-not-allowed":!0,"shadow-none":!0,"group-[&]/repeater:shadow-none":!0,"group-[&]/multistep:shadow-none":!0,"dark:bg-transparent":!0,"dark:border-zinc-700":!0,"dark:group-data-[disabled]:bg-zinc-800/5":!0,"dark:group-data-[invalid]:border-red-400":!0,"dark:group-data-[invalid]:ring-red-400":!0},"family:text__input":{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"text-sm":!0,"text-zinc-700":!0,"min-w-0":!0,"min-h-[1.5em]":!0,grow:!0,"outline-hidden":!0,"bg-transparent":!0,"selection:bg-accent-100":!0,"placeholder:text-zinc-400":!0,"group-data-[disabled]:!cursor-not-allowed":!0,"dark:placeholder-zinc-400/50":!0,"dark:text-zinc-300":!0,"border-none":!0,"p-0":!0,"focus:ring-0":!0},"family:text__prefixIcon":{flex:!0,"items-center":!0,"-ml-1":!0,"mr-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"text-zinc-600":!0,"dark:text-zinc-300":!0},"family:text__suffixIcon":{flex:!0,"items-center":!0,"-mr-1":!0,"ml-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"text-zinc-600":!0,"dark:text-zinc-300":!0},"family:dropdown__wrapper":{"mb-1.5":!0},"family:dropdown__inner":{relative:!0,flex:!0,"items-center":!0,"w-full":!0,"py-2":!0,"px-3":!0,"text-sm":!0,"bg-white":!0,border:!0,"border-zinc-300":!0,"rounded-sm":!0,"group-data-[is-multiline]:!rounded-sm":!0,"focus-within:ring-1":!0,"focus-within:!ring-accent-400":!0,"focus-within:!border-accent-400":!0,"group-data-[invalid]:border-red-400":!0,"group-data-[invalid]:ring-1":!0,"group-data-[invalid]:ring-red-400":!0,"group-data-[disabled]:bg-zinc-100":!0,"group-data-[disabled]:!cursor-not-allowed":!0,"shadow-none":!0,"group-[&]/repeater:shadow-none":!0,"group-[&]/multistep:shadow-none":!0,"dark:bg-transparent":!0,"dark:border-zinc-700":!0,"dark:group-data-[disabled]:bg-zinc-700/40":!0,"dark:group-data-[invalid]:border-red-400":!0,"dark:group-data-[invalid]:ring-red-400":!0},"family:dropdown__input":{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,grow:!0,"p-2":!0,"pr-0":!0,"pl-3":!0,"text-sm":!0,"text-zinc-700":!0,"text-ellipsis":!0,"min-w-0":!0,"outline-hidden":!0,"bg-transparent":!0,"group-data-[disabled]:!cursor-not-allowed":!0,"group-data-[prefix-icon]:!pl-0":!0,"group-data-[suffix-icon]:!pr-0":!0,"placeholder:text-zinc-400":!0,"selection:bg-accent-100":!0,"dark:placeholder:text-zinc-500":!0,"dark:text-zinc-300":!0,"border-none":!0,"focus:ring-0":!0,"bg-none":!0},"family:dropdown__listboxButton":{"w-[2.5em]":!0,"self-stretch":!0,"text-sm":!0,flex:!0,"items-center":!0,"text-zinc-700":!0,"z-10":!0,"dark:text-zinc-300":!0,"data-[disabled]:cursor-not-allowed":!0},"family:dropdown__removeSelection":{"w-[2.5em]":!0,"self-stretch":!0,"text-sm":!0,flex:!0,"items-center":!0,"text-zinc-700":!0,"hover:text-red-400":!0,"z-10":!0,"dark:text-zinc-300":!0},"family:dropdown__controlLabel":{absolute:!0,"opacity-0":!0,"pointer-events-none":!0,"text-[0px]":!0},"family:dropdown__selectIcon":{"text-sm":!0,"inline-flex":!0,"justify-center":!0,"w-[2.5em]":!0,relative:!0,"my-auto":!0,"[&>svg]:w-[1em]":!0,"[&>svg]:mx-auto":!0},"family:dropdown__closeIcon":{"text-sm":!0,"w-[0.75em]":!0,relative:!0,"m-auto":!0},"family:dropdown__prefixIcon":{flex:!0,"items-center":!0,"-ml-1":!0,"mr-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"!ml-2":!0,"!mr-0":!0,"text-zinc-600":!0,"dark:text-zinc-300":!0},"family:dropdown__suffixIcon":{flex:!0,"items-center":!0,"-mr-1":!0,"ml-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"!mr-2":!0,"!ml-0":!0,"text-zinc-600":!0,"dark:text-zinc-300":!0},"family:dropdown__dropdownWrapper":{"rounded-sm":!0,"shadow-md":!0,"mt-1":!0,"overflow-clip":!0,"empty:hidden":!0,border:!0,"border-zinc-200":!0,"dark:border-zinc-700":!0,"group-data-[expanded]:opacity-100":!0,"group-data-[overscroll]:m-0":!0,"group-data-[overscroll]:shadow-none":!0,"group-data-[overscroll]:border-none":!0},"family:dropdown__listitemGroup":{"group/optgroup":!0,"last:pb-0":!0,"border-t":!0,"border-b":!0,"-mb-px":!0,"border-zinc-200":!0,"dark:border-zinc-700":!0},"family:dropdown__groupLabel":{block:!0,"pt-1.5":!0,"pb-1":!0,"px-2.5":!0,"font-bold":!0,"pointer-events-none":!0,"text-zinc-500":!0,"dark:text-zinc-500":!0},"family:dropdown__listbox":{"bg-white":!0,"rounded-sm":!0,"empty:hidden":!0,"dark:bg-zinc-800":!0,"group-data-[overscroll]:shadow-md":!0,"group-data-[overscroll]:border":!0,"group-data-[overscroll]:border-zinc-200":!0,"group-data-[overscroll]:dark:border-zinc-700":!0},"family:dropdown__listitem":{relative:!0,flex:!0,"items-center":!0,"px-2":!0,"py-1.5":!0,"first:pt-2":!0,"last:pb-2":!0,"text-zinc-700":!0,"text-sm":!0,"data-[is-active]:bg-accent-100":!0,"dark:text-zinc-200":!0,"dark:data-[is-active]:text-zinc-700":!0,"before:content-['']":!0,"before:absolute":!0,"before:inset-0":!0,"data-[is-active]:first:before:rounded-sm":!0,"data-[is-active]:first:before:rounded-b-none":!0,"data-[is-active]:last:before:rounded-sm":!0,"data-[is-active]:last:before:rounded-t-none":!0,"data-[is-active]:first:last:before:rounded-sm":!0,"data-[is-active]:before:ring-1":!0,"data-[is-active]:before:ring-accent-400":!0,"data-[is-active]:before:ring-inset":!0,"data-[is-active]:before:ring-offset-accent-100":!0,"group-[&]/optgroup:first:before:!rounded-none":!0,"group-[&]/optgroup:last:before:!rounded-none":!0},"family:dropdown__selectedIcon":{flex:!0,absolute:!0,"items-center":!0,"text-accent-500":!0,"left-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0},"family:dropdown__option":{"ml-[1.5em]":!0},"family:dropdown__loadMore":{"data-[is-active]:bg-accent-100":!0},"family:dropdown__loadMoreInner":{flex:!0,"text-xs":!0,"text-zinc-500":!0,"p-2":!0,"items-center":!0,"justify-center":!0,"[&>span]:mr-2":!0,"cursor-pointer":!0,"dark:text-zinc-200":!0,"dark:hover:text-accent-400":!0},"family:dropdown__selectionWrapper":{grow:!0,flex:!0,"items-center":!0,"text-zinc-700":!0},"family:dropdown__selection":{grow:!0,"text-zinc-700":!0,"group-data-[multiple]:p-2":!0,"dark:text-zinc-300":!0},"family:dropdown__tagsWrapper":{"w-full":!0},"family:dropdown__tagWrapper":{"group/tag":!0,"rounded-sm":!0,"mr-1":!0,"mb-1":!0,"outline-hidden":!0,"data-[active-selection=true]:ring-2":!0,"data-[active-selection=true]:ring-accent-400":!0},"family:dropdown__tags":{"inline-flex":!0,"flex-wrap":!0,"items-center":!0,"w-full":!0,"-mb-1":!0,"empty:mb-0":!0},"family:dropdown__tag":{flex:!0,"items-center":!0,"cursor-default":!0,"rounded-sm":!0,"text-xs":!0,"px-1.5":!0,"py-0.5":!0,"bg-accent-500":!0,"text-white":!0,"[&>[type=button]]:!w-[0.5em]":!0,"[&>[type=button]]:aspect-[1/1]":!0,"[&>[type=button]]:!text-inherit":!0,"[&>[type=button]]:cursor-pointer":!0,"group-data-[active-selection=true]/tag:bg-accent-300":!0,"group-data-[active-selection=true]/tag:text-zinc-700":!0},"family:dropdown__tagLabel":{"mr-1":!0},"family:dropdown__emptyMessage":{flex:!0,"items-center":!0,"px-2":!0,"py-1.5":!0,"first:pt-2":!0,"last:pb-2":!0,"text-zinc-700":!0,"text-xs":!0,"aria-selected:text-white":!0,"aria-selected:bg-accent-500":!0},button__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"bg-accent-50":!0,"hover:bg-accent-100":!0,"dark:text-accent-500":!0,"dark:bg-transparent":!0,"dark:hover:bg-accent-50/5":!0},checkbox__decorator:{"rounded-sm":!0},checkbox__decoratorIcon:{"max-w-[66.66%]":!0},color__inner:{"!w-auto":!0,"!p-1.5":!0,"!inline-flex":!0,"group-data-[prefix-icon]:border":!0,"group-data-[prefix-icon]:border-zinc-300":!0,"group-data-[suffix-icon]:border":!0,"group-data-[suffix-icon]:border-zinc-300":!0,"dark:group-data-[prefix-icon]:border-zinc-700":!0,"dark:group-data-[suffix-icon]:border-zinc-700":!0},color__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"!w-14":!0,"bg-transparent":!0,"cursor-pointer":!0,"rounded-sm":!0,"overflow-clip":!0,"[&::-webkit-color-swatch-wrapper]:p-0":!0,"[&::-webkit-color-swatch]:border-none":!0,"[&::-moz-color-swatch]:border-none":!0,"group-data-[prefix-icon]:mx-2":!0,"group-data-[suffix-icon]:mx-2":!0},color__prefixIcon:{flex:!0,"items-center":!0,"-ml-1":!0,"mr-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"group-data-[prefix-icon]:m-1.5":!0,"group-data-[prefix-icon]:mr-0":!0},color__suffixIcon:{flex:!0,"items-center":!0,"-mr-1":!0,"ml-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"group-data-[suffix-icon]:m-1.5":!0,"group-data-[prefix-icon]:ml-0":!0},date__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"focus:[&::-webkit-datetime-edit-day-field]:bg-accent-100":!0,"focus:[&::-webkit-datetime-edit-month-field]:bg-accent-100":!0,"focus:[&::-webkit-datetime-edit-year-field]:bg-accent-100":!0},"datetime-local__input":{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"focus:[&::-webkit-datetime-edit-day-field]:bg-accent-100":!0,"focus:[&::-webkit-datetime-edit-month-field]:bg-accent-100":!0,"focus:[&::-webkit-datetime-edit-year-field]:bg-accent-100":!0,"focus:[&::-webkit-datetime-edit-hour-field]:bg-accent-100":!0,"focus:[&::-webkit-datetime-edit-minute-field]:bg-accent-100":!0,"focus:[&::-webkit-datetime-edit-ampm-field]:bg-accent-100":!0},file__fileList:{"group/list":!0,peer:!0,"w-full":!0,"min-w-0":!0,"data-[has-multiple]:mb-[1.25em]":!0},file__fileItemIcon:{"h-[1em]":!0,"w-[1em]":!0,"mr-2":!0,"shrink-0":!0},file__fileItem:{flex:!0,"min-w-0":!0,"items-center":!0,"text-zinc-700":!0,"mb-1.5":!0,"last:mb-0":!0,"dark:text-zinc-300":!0},file__fileName:{truncate:!0,"min-w-0":!0,"w-full":!0,shrink:!0,"leading-5":!0,"group-data-[has-multiple]/list:text-xs":!0},file__fileRemove:{"right-2":!0,"ring-accent-400":!0,"rounded-sm":!0,"z-20":!0,flex:!0,"appearance-none":!0,"items-center":!0,"text-[0px]":!0,"outline-hidden":!0,"hover:!text-red-400":!0,"focus-visible:ring-2":!0,"group-data-[disabled]:pointer-events-none":!0,"group-data-[disabled]:!text-zinc-500":!0,"peer-data-[has-multiple]:absolute":!0,"peer-data-[has-multiple]:bottom-[max(0.5em,8px)]":!0,"peer-data-[has-multiple]:left-3":!0,"peer-data-[has-multiple]:text-accent-500":!0,"peer-data-[has-multiple]:text-[11px]":!0,"[line-height:1em]":!0,"peer-data-[has-multiple]:whitespace-nowrap":!0,"group-data-[prefix-icon]:peer-data-[has-multiple]:left-2":!0,"dark:hover:!text-red-400":!0},file__fileRemoveIcon:{block:!0,"text-base":!0,"w-[0.75em]":!0,relative:!0,"z-10":!0},file__inner:{relative:!0,"cursor-pointer":!0,"group-data-[has-multiple]:rounded-sm":!0},file__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"cursor-pointer":!0,"text-transparent":!0,absolute:!0,"inset-0":!0,"opacity-0":!0,"z-10":!0,"file:pointer-events-none":!0,"file:w-0":!0,"file:h-0":!0,"file:overflow-hidden":!0},file__noFiles:{flex:!0,"w-full":!0,"items-center":!0,"text-zinc-400":!0,"dark:text-zinc-500":!0},file__noFilesIcon:{"w-[1em]":!0,"mr-2":!0},form__form:{"group/form":!0},form__actions:{"":!0},form__summaryInner:{"group/summary":!0,border:!0,"border-zinc-300":!0,"bg-white":!0,"rounded-sm":!0,"py-2":!0,"px-3":!0,"shadow-none":!0,"dark:bg-transparent":!0,"dark:border-zinc-700":!0},form__summaryHeader:{"text-base":!0,"text-zinc-700":!0,"font-bold":!0,"mb-2":!0,"dark:text-zinc-300":!0},form__messages:{"":!0},form__message:{"text-red-500":!0,"mb-1.5":!0,"text-[11px]":!0,"[line-height:1em]":!0,"dark:text-red-400":!0,"group-[&]/summary:text-xs":!0},form__messageLink:{"group-[&]/summary:outline-hidden":!0,"group-[&]/summary:focus-visible:ring-2":!0,"group-[&]/summary:ring-accent-500":!0},month__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"focus:[&::-webkit-datetime-edit-month-field]:bg-accent-100":!0,"focus:[&::-webkit-datetime-edit-year-field]:bg-accent-100":!0},radio__decorator:{"rounded-full":!0},radio__decoratorIcon:{"max-w-[50%]":!0},range__inner:{relative:!0,"!border-none":!0,"!ring-0":!0,"!px-0":!0,"!bg-transparent":!0,"!shadow-none":!0},range__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"group/input":!0,"cursor-pointer":!0,"[&::-webkit-slider-runnable-track]:bg-zinc-300/50":!0,"[&::-webkit-slider-runnable-track]:h-[0.25em]":!0,"[&::-webkit-slider-runnable-track]:rounded-sm":!0,"dark:[&::-webkit-slider-runnable-track]:bg-zinc-600/50":!0,"[&::-webkit-slider-thumb]:appearance-none":!0,"[&::-webkit-slider-thumb]:w-[0.85em]":!0,"[&::-webkit-slider-thumb]:aspect-[1/1]":!0,"[&::-webkit-slider-thumb]:bg-accent-500":!0,"[&::-webkit-slider-thumb]:rounded-full":!0,"[&::-webkit-slider-thumb]:relative":!0,"[&::-webkit-slider-thumb]:top-1/2":!0,"[&::-webkit-slider-thumb]:-translate-y-1/2":!0,"[&::-webkit-slider-thumb]:group-data-[disabled]:bg-zinc-500":!0,"[&::-webkit-slider-thumb]:group-data-[disabled]:!ring-zinc-200":!0,"[&::-webkit-slider-thumb]:focus-visible:ring-2":!0,"[&::-webkit-slider-thumb]:focus:!ring-accent-400":!0,"[&::-webkit-slider-thumb]:focus:ring-offset-2":!0,"[&::-webkit-slider-thumb]:shadow-none":!0,"dark:[&::-webkit-slider-thumb]:group-data-[disabled]:!ring-zinc-700":!0,"dark:[&::-webkit-slider-thumb]:focus:ring-offset-zinc-700":!0,"[&::-moz-range-track]:bg-zinc-300/50":!0,"[&::-moz-range-track]:h-[0.25]":!0,"[&::-moz-range-track]:rounded-sm":!0,"dark:[&::-moz-range-track]:bg-zinc-600/50":!0,"[&::-moz-range-thumb]:appearance-none":!0,"[&::-moz-range-thumb]:border-none":!0,"[&::-moz-range-thumb]:w-[0.85em]":!0,"[&::-moz-range-thumb]:h-[0.85em]":!0,"[&::-moz-range-thumb]:bg-accent-500":!0,"[&::-moz-range-thumb]:rounded-full":!0,"[&::-moz-range-thumb]:group-data-[disabled]:bg-zinc-500":!0,"[&::-moz-range-thumb]:group-data-[disabled]:!ring-zinc-300":!0,"[&::-moz-range-thumb]:focus-visible:ring-2":!0,"[&::-moz-range-thumb]:focus:!ring-accent-400":!0,"[&::-moz-range-thumb]:focus:ring-offset-2":!0,"[&::-moz-range-thumb]:shadow-none":!0,"dark:[&::-moz-range-thumb]:group-data-[disabled]:!ring-zinc-500":!0,"dark:[&::-moz-range-thumb]:focus:ring-offset-zinc-700":!0},select__wrapper:{"mb-1.5":!0},select__inner:{relative:!0,flex:!0,"items-center":!0,"bg-white":!0,border:!0,"border-zinc-300":!0,"rounded-sm":!0,"focus-within:ring-1":!0,"focus-within:!ring-accent-400":!0,"focus-within:!border-accent-400":!0,"group-data-[invalid]:border-red-400":!0,"group-data-[invalid]:ring-1":!0,"group-data-[invalid]:ring-red-400":!0,"group-data-[disabled]:bg-zinc-100":!0,"group-data-[disabled]:!cursor-not-allowed":!0,"shadow-none":!0,"group-[&]/repeater:shadow-none":!0,"group-[&]/multistep:shadow-none":!0,"group-data-[multiple]:rounded-sm":!0,"dark:bg-transparent":!0,"dark:border-zinc-700":!0,"dark:group-data-[disabled]:bg-zinc-800/5":!0,"dark:group-data-[invalid]:border-red-400":!0,"dark:group-data-[invalid]:ring-red-400":!0},select__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,grow:!0,"p-2":!0,"py-2":!0,"px-3":!0,"pr-[2em]":!0,"text-sm":!0,"text-zinc-700":!0,"text-ellipsis":!0,"min-w-0":!0,"outline-hidden":!0,"bg-transparent":!0,"group-data-[disabled]:!cursor-not-allowed":!0,"group-data-[prefix-icon]:!pl-0":!0,"group-data-[suffix-icon]:!pr-0":!0,"data-[placeholder]:text-zinc-400":!0,"group-data-[multiple]:!p-0":!0,"selection:bg-accent-100":!0,"dark:data-[placeholder]:text-zinc-400/50":!0,"dark:text-zinc-300":!0,"border-none":!0,"focus:ring-0":!0,"bg-none":!0},select__selectIcon:{absolute:!0,"w-[1em]":!0,"text-zinc-700":!0,"pointer-events-none":!0,"right-2":!0,"group-data-[suffix-icon]:mr-[1.5em]":!0,"dark:text-zinc-300":!0},select__optGroup:{"bg-white":!0,"text-zinc-700":!0,"group/optgroup":!0,"group-data-[multiple]:px-1.5":!0,"pt-1.5":!0,"font-bold":!0,"text-xs":!0,"dark:bg-zinc-800":!0,"dark:text-zinc-300":!0},select__option:{"bg-white":!0,"text-zinc-700":!0,"group-data-[disabled]:opacity-50":!0,"group-data-[disabled]:select-none":!0,"group-data-[multiple]:checked:bg-accent-100":!0,"group-data-[multiple]:focus:bg-accent-100":!0,"group-data-[multiple]:text-xs":!0,"group-data-[multiple]:outline-hidden":!0,"group-data-[multiple]:border-none":!0,"group-data-[multiple]:py-1.5":!0,"group-data-[multiple]:px-2":!0,"dark:bg-zinc-800":!0,"dark:text-zinc-300":!0,"dark:group-data-[multiple]:focus:bg-accent-700":!0,"dark:group-data-[multiple]:checked:bg-accent-700":!0},select__prefixIcon:{flex:!0,"items-center":!0,"mr-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"ml-2":!0,"text-zinc-600":!0,"dark:text-zinc-300":!0},select__suffixIcon:{flex:!0,"items-center":!0,"ml-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"mr-2":!0,"text-zinc-600":!0,"dark:text-zinc-300":!0},submit__outer:{group:!0,"max-w-none":!0,"min-w-0":!0,grow:!0,"mb-4":!0,"data-[disabled]:select-none":!0,"text-sm":!0,"data-[disabled]:opacity-100":!0},submit__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"bg-accent-500":!0,"!text-white":!0,"active:text-accent-100":!0,"active:bg-accent-600":!0,"hover:bg-accent-600":!0,"disabled:border-zinc-300":!0,"disabled:bg-zinc-400":!0,"disabled:text-zinc-100":!0,"group-data-[disabled]:!cursor-not-allowed":!0,"dark:disabled:border-zinc-100":!0,"dark:disabled:bg-zinc-500":!0,"dark:disabled:text-zinc-200":!0,"dark:text-white":!0,"dark:ring-offset-accent-400":!0,"before:transition-all":!0,"group-data-[loading=true]/form:before:content['']":!0,"group-data-[loading=true]/form:before:block":!0,"group-data-[loading=true]/form:before:animate-spin":!0,"group-data-[loading=true]/form:before:w-5":!0,"group-data-[loading=true]/form:before:h-5":!0,"group-data-[loading=true]/form:before:rounded-full":!0,"group-data-[loading=true]/form:before:mr-3":!0,"group-data-[loading=true]/form:before:-ml-1.5":!0,"group-data-[loading=true]/form:before:border-2":!0,"group-data-[loading=true]/form:before:border-solid":!0,"group-data-[loading=true]/form:before:border-white":!0,"group-data-[loading=true]/form:before:border-r-transparent":!0},submit__prefixIcon:{flex:!0,"items-center":!0,"-ml-1":!0,"mr-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"text-zinc-100":!0},submit__suffixIcon:{flex:!0,"items-center":!0,"-mr-1":!0,"ml-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"text-zinc-100":!0},textarea__inner:{flex:!0,"items-center":!0,"mb-1.5":!0,"bg-white":!0,border:!0,"border-zinc-300":!0,"rounded-sm":!0,"focus-within:ring-1":!0,"focus-within:!ring-accent-400":!0,"focus-within:!border-accent-400":!0,"group-data-[invalid]:border-red-400":!0,"group-data-[invalid]:ring-1":!0,"group-data-[invalid]:ring-red-400":!0,"group-data-[disabled]:bg-zinc-100":!0,"shadow-none":!0,"group-[&]/repeater:shadow-none":!0,"group-[&]/multistep:shadow-none":!0,"dark:border-zinc-700":!0,"dark:group-data-[disabled]:bg-zinc-800/5":!0,"dark:group-data-[invalid]:border-red-400":!0,"dark:group-data-[invalid]:ring-red-400":!0,"dark:bg-transparent":!0},textarea__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"text-sm":!0,"h-24":!0,"text-zinc-700":!0,"min-w-0":!0,grow:!0,shrink:!0,"!py-2":!0,"!px-3":!0,"outline-hidden":!0,"bg-transparent":!0,"selection:bg-accent-100":!0,"placeholder:text-zinc-400":!0,"group-data-[disabled]:!cursor-not-allowed":!0,"dark:placeholder-zinc-400/50":!0,"dark:text-zinc-300":!0,"p-0":!0,"border-none":!0,"focus:ring-0":!0},textarea__prefixIcon:{flex:!0,"items-center":!0,"-ml-1":!0,"mr-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"!ml-2":!0,"!mr-0":!0,"text-zinc-600":!0,"dark:text-zinc-300":!0},textarea__suffixIcon:{flex:!0,"items-center":!0,"-mr-1":!0,"ml-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"!mr-2":!0,"!ml-0":!0,"text-zinc-600":!0,"dark:text-zinc-300":!0},time__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"focus:[&::-webkit-datetime-edit-hour-field]:bg-accent-100":!0,"focus:[&::-webkit-datetime-edit-minute-field]:bg-accent-100":!0,"focus:[&::-webkit-datetime-edit-ampm-field]:bg-accent-100":!0},week__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"focus:[&::-webkit-datetime-edit-week-field]:bg-accent-100":!0,"focus:[&::-webkit-datetime-edit-year-field]:bg-accent-100":!0},autocomplete__selections:{flex:!0,absolute:!0,"inset-0":!0,"group-data-[multiple]:static":!0,"group-data-[multiple]:block":!0,"group-data-[empty]:hidden":!0,"group-data-[multiple]:mt-1.5":!0},autocomplete__selectionWrapper:{"bg-zinc-100":!0,"rounded-sm":!0,"group-data-[multiple]:border":!0,"group-data-[multiple]:border-zinc-200":!0,"group-data-[multiple]:mb-1.5":!0,"outline-hidden":!0,"data-[active-selection=true]:ring-2":!0,"data-[active-selection=true]:ring-accent-400":!0,"dark:bg-zinc-600":!0,"dark:group-data-[multiple]:border-zinc-700":!0,"[&.formkit-dropZone]:opacity-25":!0,"[&.formkit-touchDropZone]:opacity-25":!0,"[&.formkit-touchDragging]:!flex":!0,"[&.formkit-longTouch]:opacity-25":!0},autocomplete__selection:{"rounded-sm":!0,just:!0,"pl-2":!0,"[&>*]:ml-0":!0,"dark:text-zinc-200":!0},colorpicker__outer:{group:!0,"max-w-none":!0,"min-w-0":!0,grow:!0,"mb-4":!0,"data-[disabled]:select-none":!0,"data-[disabled]:opacity-50":!0,"text-sm":!0,"data-[disabled]:cursor-not-allowed":!0,"data-[disabled]:pointer-events-none":!0},colorpicker__help:{"text-zinc-500":!0,"text-[11px]":!0,"[line-height:1em]":!0,"dark:text-zinc-400":!0,"group-data-[inline]:-mt-1":!0,"group-data-[inline]:mb-2":!0},colorpicker__inner:{relative:!0,"inline-flex":!0,"!w-auto":!0,"pl-2":!0,"group-data-[inline]:border-none":!0,"group-data-[inline]:shadow-none":!0,"group-data-[inline]:p-0":!0,"group-data-[inline]:bg-transparent":!0,"group-data-[inline]:outline-hidden":!0,"group-data-[inline]:!ring-0":!0,"group-data-[inline]:!w-full":!0,"group-data-[inline]:rounded-sm":!0},colorpicker__swatchPreview:{"w-full":!0,flex:!0,"justify-start":!0,"items-center":!0,"rounded-sm":!0,"text-sm":!0,"cursor-pointer":!0,"outline-hidden":!0},colorpicker__canvasSwatchPreviewWrapper:{relative:!0,"before:content-['']":!0,"before:absolute":!0,"before:inset-0":!0,"before:rounded-sm":!0,"before:shadow-[inset_0_0_0_1px_rgba(0,0,0,0.2)]":!0,"before:z-[2]":!0},colorpicker__canvasSwatchPreview:{"text-sm":!0,"rounded-sm":!0,"aspect-[1/1]":!0,"shrink-0":!0,grow:!0,"!w-[1.5em]":!0},colorpicker__valueString:{"text-sm":!0,"text-zinc-700":!0,"selection:bg-accent-100":!0,"font-mono":!0,"inline-block":!0,"ml-2":!0,"mr-1.5":!0,"dark:text-zinc-300":!0,"dark:selection:text-zinc-700":!0},colorpicker__panel:{absolute:!0,"left-0":!0,"top-full":!0,"z-[99]":!0,flex:!0,"w-[100vw]":!0,"max-w-[18.5em]":!0,"touch-manipulation":!0,"flex-col":!0,"rounded-sm":!0,border:!0,"bg-white":!0,"p-2":!0,"shadow-xs":!0,"group-data-[inline]:static":!0,"group-data-[inline]:max-w-none":!0,"border-zinc-300":!0,"group-data-[inline]:z-auto":!0,"group-data-[inline]:w-full":!0,"group-data-[inline]:shadow-none":!0,"group-data-[inline]:group-data-[disabled]:!cursor-not-allowed":!0,"group-data-[inline]:group-data-[disabled]:!pointer-events-none":!0,"group-data-[inline]:[&:has([id^=swatches]:first-child:last-child)]:w-auto":!0,"group-data-[inline]:[&:has([id^=swatches]:first-child:last-child)_[id^=swatches]>div]:w-[1.5em]":!0,"dark:bg-zinc-800":!0,"dark:border-zinc-700":!0,"dark:group-data-[inline]:bg-transparent":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:!fixed":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:top-auto":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:max-w-none":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:bottom-0":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:left-0":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:rounded-none":!0},colorpicker__panelClose:{flex:!0,"justify-end":!0,"items-center":!0,"text-zinc-600":!0,"mb-1.5":!0,"-mt-1":!0,"border-none":!0,"bg-none":!0,"border-b":!0,"border-zinc-200":!0,"w-[calc(100%+1rem)]":!0,"-ml-2":!0,"pt-0":!0,"pr-2":!0,"pb-1.5":!0,"pl-2":!0,"dark:border-zinc-800":!0},colorpicker__closeIcon:{"w-[2rem]":!0,"aspect-[1/1]":!0,"p-1":!0,"rounded-sm":!0,border:!0,"[&>svg]:w-full":!0,"[&>svg]:aspect-[1/1]":!0,"[&>svg]:max-w-none":!0,"[&>svg]:max-h-none":!0},colorpicker__controlGroup:{grid:!0,"[grid-template-areas:'a_a_a'_'b_c_e'_'b_d_e']":!0,"mb-2":!0},colorpicker__LS:{"[grid-area:a]":!0,relative:!0,"mb-2":!0},colorpicker__canvas:{block:!0,"w-full":!0},colorpicker__canvasLS:{"aspect-[2/1]":!0,"cursor-pointer":!0,"rounded-xs":!0},colorpicker__canvasHue:{"rounded-xs":!0},colorpicker__canvasAlpha:{"rounded-xs":!0},colorpicker__preview:{"rounded-sm":!0,"after:rounded-sm":!0,relative:!0,"inline-flex":!0,"aspect-[1/1]":!0,"overflow-hidden":!0,"[grid-area:b]":!0,"mr-2":!0,"after:absolute":!0,"after:left-0":!0,"after:top-0":!0,"after:h-full":!0,"after:w-full":!0,"after:shadow-[inset_0_0_0_1px_rgba(0,0,0,0.2)]":!0,"after:content-['']":!0,"w-[2em]":!0,"dark:after:shadow-[inset_0_0_0_1px_rgba(255,255,255,0.25)]":!0},colorpicker__hue:{"[grid-area:c]":!0,relative:!0,"inline-flex":!0,"h-3/4":!0},colorpicker__alpha:{"[grid-area:d]":!0,relative:!0,"inline-flex":!0,"h-3/4":!0},colorpicker__eyeDropper:{"[grid-area:e]":!0,"w-[2em]":!0,"ml-2":!0,"inline-flex":!0,"self-center":!0,"justify-center":!0,"justify-self-center":!0,"aspect-[1/1]":!0,"rounded-sm":!0,border:!0,"border-zinc-200":!0,"cursor-pointer":!0,"content-center":!0,"items-center":!0,"text-zinc-600":!0,"dark:border-zinc-800":!0},colorpicker__eyeDropperIcon:{"w-auto":!0,"[&>svg]:w-[1em]":!0,"dark:text-zinc-400":!0},colorpicker__control:{absolute:!0,"bg-white":!0,"shadow-[0_0_0_2px_rgba(255,255,255,1),0_0_0_3px_rgba(0,0,0,0.2)]":!0,"-translate-y-1/2":!0,"-translate-x-1/2":!0,"pointer-events-none":!0,"data-[prevent-focus-style]:shadow-[0_0_0_2px_rgba(255,255,255,1),0_0_0_3px_rgba(0,0,0,0.2)]":!0,"focus-visible:outline-hidden":!0,"focus-visible:ring-2":!0,"focus-visible:ring-offset-2":!0,"focus-visible:ring-accent-400":!0},colorpicker__controlLS:{"w-[10px]":!0,"h-[10px]":!0,"rounded-full":!0},colorpicker__controlHue:{"w-[4px]":!0,"h-[calc(100%-2px)]":!0,"top-1/2":!0,"rounded-sm":!0},colorpicker__controlAlpha:{"w-[4px]":!0,"h-[calc(100%-2px)]":!0,"top-1/2":!0,"rounded-sm":!0},colorpicker__formatField:{flex:!0,"items-center":!0,"justify-center":!0,grow:!0},colorpicker__colorField:{"bg-transparent":!0,"text-zinc-700":!0,border:!0,"border-zinc-200":!0,"dark:border-zinc-800":!0,"dark:text-zinc-300":!0,"dark:selection:text-zinc-700":!0},colorpicker__colorInputGroup:{flex:!0,"items-center":!0,"justify-center":!0,grow:!0},colorpicker__fieldGroup:{flex:!0,"flex-col":!0,"items-center":!0,"justify-center":!0,"w-full":!0,"mr-1":!0,"[&>input]:p-1":!0,"[&>input]:text-sm":!0,"[&>input]:text-zinc-700":!0,"[&>input]:selection:bg-accent-100":!0,"[&>input]:m-0":!0,"[&>input]:grow":!0,"[&>input]:shrink":!0,"[&>input]:w-full":!0,"[&>input]:border":!0,"[&>input]:border-zinc-200":!0,"[&>input]:rounded-sm":!0,"[&>input]:text-center":!0,"[&>input]:appearance-none":!0,"[&>input::-webkit-outer-spin-button]:appearance-none":!0,"[&>input::-webkit-inner-spin-button]:appearance-none":!0,"[&>input::-webkit-inner-spin-button]:m-0":!0,"[&>input:focus]:outline-hidden":!0,"[&>input:focus]:ring-1":!0,"[&>input:focus]:ring-accent-500":!0,"[&>input:focus]:border-accent-500":!0,"max-[431px]:[&>input]:text-base":!0},colorpicker__fieldLabel:{"text-xs":!0,"text-zinc-500":!0,"mt-1.5":!0,"dark:text-zinc-400":!0},colorpicker__formatSwitcher:{flex:!0,"justify-end":!0,"self-start":!0,uppercase:!0,"shrink-0":!0,"p-1":!0,"mt-0.5":!0,"text-zinc-600":!0,"rounded-sm":!0,"select-none":!0,"dark:text-zinc-400":!0},colorpicker__switchIcon:{"[&>svg]:w-3":!0},colorpicker__swatches:{"inline-flex":!0,"flex-wrap":!0,"w-full":!0,"justify-self-center":!0,"min-w-0":!0,"mx-auto":!0,"px-[1px]":!0,"pt-2":!0,"pb-2":!0,"mt-2":!0,"-mb-2":!0,"border-t":!0,"border-zinc-200":!0,"overflow-auto":!0,"max-h-[200px]":!0,"select-none":!0,"first:-mt-[3px]":!0,"first:last:-mb-[3px]":!0,"first:last:pb-[2px]":!0,"first:pt-px":!0,"first:border-t-0":!0,"dark:border-zinc-800":!0},colorpicker__swatchGroup:{flex:!0,"flex-wrap":!0,"w-full":!0,"mb-2":!0,"last:mb-0":!0},colorpicker__swatchGroupLabel:{"ml-1":!0,block:!0,"w-full":!0,"text-xs":!0,"text-zinc-500":!0,"dark:text-zinc-400":!0},colorpicker__swatch:{relative:!0,"text-sm":!0,"w-[calc((100%/10)-0.5em)]":!0,"max-w-[22px]":!0,"m-[0.16em]":!0,"cursor-pointer":!0,"before:content-['']":!0,"before:absolute":!0,"before:inset-0":!0,"before:rounded-sm":!0,"before:shadow-[inset_0_0_0_1px_rgba(0,0,0,0.2)]":!0,"before:pointer-events-none":!0,"before:z-[2]":!0,"dark:before:shadow-[inset_0_0_0_1px_rgba(255,255,255,0.25)]":!0,"data-[active=true]:after:content-['']":!0,"data-[active=true]:after:block":!0,"data-[active=true]:after:absolute":!0,"data-[active=true]:after:w-1.5":!0,"data-[active=true]:after:h-1.5":!0,"data-[active=true]:after:top-1/2":!0,"data-[active=true]:after:left-1/2":!0,"data-[active=true]:after:pointer-events-none":!0,"data-[active=true]:after:rounded-full":!0,"data-[active=true]:after:-translate-x-1/2":!0,"data-[active=true]:after:-translate-y-1/2":!0,"data-[active=true]:after:bg-white":!0,"data-[active=true]:after:z-[2]":!0,"data-[active=true]:after:ring-1":!0,"data-[active=true]:after:ring-[rgba(0,0,0,0.33)]":!0,"[&>canvas]:block":!0,"[&>canvas]:w-full":!0,"[&>canvas]:aspect-[1/1]":!0,"[&>canvas]:rounded-sm":!0,"[&>canvas:focus-visible]:outline-hidden":!0,"[&>canvas:focus-visible]:ring-2":!0,"[&>canvas:focus-visible]:ring-accent-400":!0,"[&>canvas:focus-visible]:ring-offset-2":!0,"[&>canvas:focus-visible]:ring-offset-white":!0,"dark:[&>canvas:focus-visible]:ring-offset-zinc-700":!0},datepicker__inner:{relative:!0},datepicker__removeSelection:{"self-stretch":!0,"text-sm":!0,flex:!0,"items-center":!0,"ml-1":!0,"mr-2":!0,"text-zinc-700":!0,"hover:text-red-400":!0,"z-10":!0,"dark:text-zinc-300":!0},datepicker__clearIcon:{"[&>svg]:w-[0.75em]":!0},datepicker__panelWrapper:{"group/panel":!0,absolute:!0,"min-w-[20em]":!0,"top-[calc(100%_+_0.5em)]":!0,"left-0":!0,"shadow-[0_0_1.25em_rgba(0,0,0,.25)]":!0,"rounded-sm":!0,"p-4":!0,"bg-white":!0,"z-10":!0,"dark:bg-zinc-800":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:!fixed":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:top-auto":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:max-w-none":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:bottom-0":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:left-0":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:rounded-none":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:w-full":!0},datepicker__panelHeader:{grid:!0,"grid-cols-[2.5em_1fr_2.5em]":!0,"justify-center":!0,"items-center":!0,"border-b-2":!0,"border-zinc-200":!0,"mb-2":!0,"pb-2.5":!0,"dark:border-zinc-700":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:grid-cols-[2.5em_1fr_2.5em_2.5em]":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:group-data-[panel=time]/panel:grid-cols-[2.5em_1fr_2.5em]":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:group-data-[panel=month]/panel:grid-cols-[2.5em_1fr_2.5em]":!0},datepicker__panelClose:{"aspect-[1/1]":!0,border:!0,"border-zinc-200":!0,"rounded-sm":!0,flex:!0,"items-center":!0,"justify-center":!0,"text-zinc-700":!0,"[&_svg]:w-[1.25em]":!0,"dark:text-zinc-300":!0,"dark:border-zinc-800":!0,"[@media(max-width:431px)_and_(hover:none)]:group-data-[panel=time]/panel:col-start-3":!0,"[@media(max-width:431px)_and_(hover:none)]:group-data-[panel=month]/panel:col-start-3":!0},datepicker__panel:{flex:!0,"justify-center":!0},datepicker__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"placeholder:text-zinc-400":!0},datepicker__monthsHeader:{flex:!0,"items-center":!0,"justify-center":!0,"col-start-2":!0,"col-end-2":!0},datepicker__timeHeader:{flex:!0,"items-center":!0,"justify-center":!0,"col-start-2":!0,"col-end-2":!0},datepicker__months:{grid:!0,"grid-cols-3":!0,"w-full":!0},datepicker__month:{"m-1.5":!0,"p-1.5":!0,"text-center":!0,"text-zinc-700":!0,"rounded-sm":!0,"bg-zinc-200":!0,"aria-selected:!bg-accent-500":!0,"aria-selected:!text-white":!0,"focus:outline":!0,"focus:outline-2":!0,"focus:outline-accent-500":!0,"focus:outline-offset-2":!0,"focus:bg-white":!0,"focus:text-zinc-700":!0,"data-[is-extra=true]:opacity-25":!0,"group-data-[disabled=true]:opacity-50":!0,"group-data-[disabled=true]:cursor-default":!0,"group-data-[disabled=true]:pointer-events-none":!0,"dark:bg-zinc-700":!0,"dark:text-zinc-300":!0},datepicker__yearsHeader:{flex:!0,"items-center":!0,"justify-center":!0,"text-zinc-700":!0,"col-start-2":!0,"col-end-2":!0,"dark:text-zinc-300":!0},datepicker__years:{grid:!0,"grid-cols-5":!0,"w-full":!0},datepicker__year:{"text-sm":!0,"text-center":!0,"text-zinc-700":!0,"items-center":!0,"m-1.5":!0,"p-1.5":!0,"rounded-sm":!0,"bg-zinc-200":!0,"aria-selected:!bg-accent-500":!0,"aria-selected:!text-white":!0,"focus:outline":!0,"focus:outline-2":!0,"focus:outline-accent-500":!0,"focus:outline-offset-2":!0,"focus:bg-white":!0,"data-[is-extra=true]:opacity-25":!0,"group-data-[disabled=true]:opacity-50":!0,"group-data-[disabled=true]:cursor-default":!0,"group-data-[disabled=true]:pointer-events-none":!0,"dark:bg-zinc-700":!0,"dark:text-zinc-300":!0},datepicker__weekDays:{grid:!0,"grid-cols-7":!0},datepicker__weekDay:{"w-[2.25em]":!0,"text-zinc-700":!0,"m-1.5":!0,"rounded-sm":!0,"font-medium":!0,lowercase:!0,"dark:text-zinc-500":!0},datepicker__calendarWeeks:{"":!0},datepicker__week:{grid:!0,"grid-cols-7":!0,"group-data-[disabled=true]:opacity-50":!0,"group-data-[disabled=true]:cursor-default":!0,"group-data-[disabled=true]:pointer-events-none":!0},datepicker__dayCell:{flex:!0,"items-center":!0,"justify-center":!0,"text-center":!0,"text-zinc-700":!0,"w-[2.25em]":!0,"h-[2.25em]":!0,"m-1":!0,"p-2":!0,"rounded-sm":!0,"bg-zinc-200":!0,"aria-selected:bg-accent-500":!0,"aria-selected:text-white":!0,"focus:outline":!0,"focus:outline-2":!0,"focus:outline-accent-500":!0,"focus:outline-offset-2":!0,"focus:bg-white":!0,"data-[is-extra=true]:opacity-25":!0,"data-[disabled=true]:opacity-50":!0,"data-[disabled=true]:cursor-default":!0,"data-[disabled=true]:pointer-events-none":!0,"dark:bg-zinc-600":!0,"dark:text-zinc-300":!0,"dark:aria-selected:bg-accent-500":!0,"dark:aria-selected:text-white":!0,"dark:focus:outline-accent-500":!0,"dark:focus:bg-zinc-200":!0,"dark:focus:text-zinc-700":!0},datepicker__timeInput:{"w-full":!0,"border-2":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"text-zinc-700":!0,"border-zinc-200":!0,"rounded-sm":!0,"p-1.5":!0,"my-2.5":!0,"focus-visible:outline-accent-500":!0,"dark:text-zinc-300":!0,"dark:bg-transparent":!0,"dark:border-zinc-700":!0},datepicker__daysHeader:{flex:!0,"items-center":!0,"justify-center":!0},datepicker__prev:{"mr-auto":!0,"px-2.5":!0,"py-0.5":!0,"hover:bg-zinc-100":!0,"rounded-sm":!0,"col-start-1":!0,"col-end-1":!0,"focus-visible:outline-hidden":!0,"focus-visible:ring-2":!0,"focus-visible:ring-accent-400":!0,"focus-visible:ring-offset-2":!0},datepicker__prevLabel:{hidden:!0},datepicker__prevIcon:{flex:!0,"w-[0.75em]":!0,"select-none":!0,"text-zinc-700":!0,"[&>svg]:w-full":!0,"dark:text-zinc-300":!0},datepicker__dayButton:{"appearance-none":!0,"text-zinc-700":!0,"cursor-pointer":!0,"px-2.5":!0,"py-0.5":!0,"border-2":!0,"border-zinc-200":!0,"rounded-sm":!0,"mx-1":!0,"hover:border-accent-500":!0,"focus-visible:outline-hidden":!0,"focus-visible:ring-2":!0,"focus-visible:ring-accent-400":!0,"focus-visible:ring-offset-2":!0,"dark:text-zinc-300":!0,"dark:border-zinc-700":!0,"dark:hover:border-accent-400":!0},datepicker__monthButton:{"appearance-none":!0,"text-zinc-700":!0,"cursor-pointer":!0,"px-2.5":!0,"py-0.5":!0,"border-2":!0,"border-zinc-200":!0,"rounded-sm":!0,"mx-1":!0,"hover:border-accent-500":!0,"focus-visible:outline-hidden":!0,"focus-visible:ring-2":!0,"focus-visible:ring-accent-400":!0,"focus-visible:ring-offset-2":!0,"dark:text-zinc-300":!0,"dark:border-zinc-700":!0,"dark:hover:border-accent-400":!0},datepicker__yearButton:{"appearance-none":!0,"text-zinc-700":!0,"cursor-pointer":!0,"px-2.5":!0,"py-0.5":!0,"border-2":!0,"border-zinc-200":!0,"rounded-sm":!0,"mx-1":!0,"hover:border-accent-500":!0,"focus-visible:outline-hidden":!0,"focus-visible:ring-2":!0,"focus-visible:ring-accent-400":!0,"focus-visible:ring-offset-2":!0,"dark:text-zinc-300":!0,"dark:border-zinc-700":!0,"dark:hover:border-accent-400":!0},datepicker__next:{"ml-auto":!0,"px-2.5":!0,"py-0.5":!0,"rounded-sm":!0,"hover:bg-zinc-100":!0,"hover:rounded-sm":!0,"col-start-3":!0,"col-end-3":!0,"focus-visible:outline-hidden":!0,"focus-visible:ring-2":!0,"focus-visible:ring-accent-400":!0,"focus-visible:ring-offset-2":!0},datepicker__nextLabel:{hidden:!0},datepicker__nextIcon:{flex:!0,"w-[0.75em]":!0,"select-none":!0,"text-zinc-700":!0,"[&>svg]:w-full":!0,"dark:text-zinc-300":!0},datepicker__openButton:{"appearance-none":!0,"border-0":!0,"bg-transparent":!0,flex:!0,"p-0":!0,"self-stretch":!0,"cursor-pointer":!0,"focus-visible:outline-hidden":!0,"focus-visible:ring-2":!0,"focus-visible:ring-accent-400":!0,"focus-visible:ring-offset-2":!0,"focus-visible:rounded-sm":!0},datepicker__calendarIcon:{"text-zinc-600":!0,"focus-visible:text-accent-500":!0,flex:!0,"w-[1em]":!0,"grow-0":!0,"shrink-0":!0,"self-stretch":!0,"select-none":!0,"[&>svg]:w-full":!0,"[&>svg]:m-auto":!0,"[&>svg]:max-h-[1em]":!0,"[&>svg]:max-w-[1em]":!0},dropdown__placeholder:{"text-zinc-400":!0,grow:!0,"dark:text-zinc-400/50":!0},dropdown__selector:{flex:!0,grow:!0,"justify-between":!0,"w-full":!0,"py-2":!0,"pl-3":!0,"pr-0":!0,"text-sm":!0,"text-zinc-700":!0,"text-left":!0,"group-data-[disabled]:!cursor-not-allowed":!0,"group-data-[prefix-icon]:!pl-0":!0,"group-data-[suffix-icon]:!pr-0":!0,"data-[placeholder]:text-zinc-400":!0,"selection:bg-accent-100":!0,"dark:data-[placeholder]:text-zinc-400/50":!0,"dark:text-zinc-300":!0},dropdown__selectIcon:{"shrink-0":!0},dropdown__selectionsWrapper:{"w-[85%]":!0,"overflow-hidden":!0},dropdown__selection:{"[&>*]:ml-0":!0},dropdown__selections:{"inline-flex":!0,"items-center":!0},dropdown__selectionsItem:{"whitespace-nowrap":!0,"mr-1":!0},dropdown__tagWrapper:{"[&.formkit-dropZone_.formkit-tag]:opacity-25":!0,"[&.formkit-touchDropZone_.formkit-tag]:opacity-25":!0},dropdown__truncationCount:{flex:!0,"items-center":!0,"justify-center":!0,"h-[1.5em]":!0,"rounded-sm":!0,"bg-zinc-400":!0,"text-white":!0,"whitespace-nowrap":!0,"text-[11px]":!0,"[line-height:1em]":!0,"tracking-tighter":!0,"leading-0":!0,"py-1":!0,"px-1":!0,"shrink-0":!0,"my-auto":!0},mask__inner:{relative:!0},mask__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"group-data-[has-overlay]:!caret-zinc-700":!0,"dark:group-data-[has-overlay]:!caret-zinc-300":!0},rating__inner:{"text-zinc-300":!0},rating__itemsWrapper:{relative:!0,"inline-flex":!0,"focus:border-accent-500":!0},rating__onItemRow:{"h-full":!0,"w-full":!0},rating__offItemRow:{"h-full":!0,"w-full":!0},rating__onItemWrapper:{"[&>*]:w-full":!0,"[&>*]:h-full":!0,"w-full":!0,"h-full":!0,"text-yellow-400":!0},rating__offItemWrapper:{"text-zinc-300":!0,"w-full":!0,"h-full":!0,"[&>*]:w-full":!0,"[&>*]:h-full":!0,"dark:text-zinc-600":!0},rating__ratingItem:{relative:!0,"focus-within:outline":!0,"focus-within:outline-accent-500":!0,"w-[1.5em]":!0,"h-[1.5em]":!0},rating__itemLabelInner:{"h-px":!0,"w-px":!0,"overflow-hidden":!0,absolute:!0,"white-space-nowrap":!0},rating__itemLabel:{absolute:!0,"h-full":!0},rating__ratingIcon:{"w-[1.5em]":!0,"h-[1.5em]":!0,flex:!0},rating__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"outline-hidden":!0},rating__messages:{"mt-1.5":!0},repeater__outer:{"min-w-0":!0,grow:!0,"mb-4":!0,"text-sm":!0,"group/repeater":!0,"max-w-full":!0},repeater__fieldset:{"min-w-0":!0},repeater__legend:{block:!0,"text-zinc-700":!0,"text-xs":!0,"font-bold":!0,"dark:text-zinc-300":!0,"mb-2":!0},repeater__content:{"min-w-0":!0,grow:!0,"p-5":!0,flex:!0,"flex-col":!0,"align-center":!0,"[&>div[data-type]]:max-w-none":!0,"[&>div[data-type]:last-child]:mb-0":!0},repeater__addButton:{"!mb-0":!0,"group-data-[disabled]/repeater:pointer-events-none":!0,"group-data-[disabled]/repeater:opacity-50":!0,"group-data-[disabled]/repeater:grayscale":!0},repeater__controlLabel:{absolute:!0,"opacity-0":!0,"pointer-events-none":!0,"text-[0px]":!0},repeater__controls:{flex:!0,"flex-col":!0,"items-center":!0,"justify-center":!0,"bg-zinc-50":!0,"p-2":!0,"[&>li]:aspect-[1/1]":!0,"dark:bg-zinc-800":!0,"rounded-sm":!0,"rounded-tl-none":!0,"rounded-bl-none":!0},repeater__downControl:{"w-[1.5em]":!0,"h-[1.5em]":!0,"my-1.5":!0,"mx-auto":!0,flex:!0,"items-center":!0,"appearance-none":!0,"justify-center":!0,"aspect-[1/1]":!0,"text-zinc-500":!0,"hover:text-accent-500":!0,"disabled:hover:text-inherit":!0,"disabled:opacity-25":!0,"disabled:!text-zinc-500":!0,"dark:text-zinc-300":!0,"dark:disabled:!text-zinc-300":!0,"dark:hover:text-accent-400":!0},repeater__upControl:{"w-[1.5em]":!0,"h-[1.5em]":!0,"my-1.5":!0,"mx-auto":!0,flex:!0,"items-center":!0,"appearance-none":!0,"justify-center":!0,"aspect-[1/1]":!0,"text-zinc-500":!0,"hover:text-accent-500":!0,"disabled:hover:text-inherit":!0,"disabled:opacity-25":!0,"disabled:!text-zinc-500":!0,"dark:text-zinc-300":!0,"dark:disabled:!text-zinc-300":!0,"dark:hover:text-accent-400":!0},repeater__removeControl:{"w-[1.5em]":!0,"h-[1.5em]":!0,"my-1.5":!0,"mx-auto":!0,flex:!0,"items-center":!0,"appearance-none":!0,"justify-center":!0,"aspect-[1/1]":!0,"text-zinc-500":!0,"hover:text-accent-500":!0,"disabled:hover:text-inherit":!0,"disabled:opacity-25":!0,"disabled:!text-zinc-500":!0,"dark:text-zinc-300":!0,"dark:disabled:!text-zinc-300":!0,"dark:hover:text-accent-400":!0},repeater__insertControl:{"w-[1.5em]":!0,"h-[1.5em]":!0,"my-1.5":!0,"mx-auto":!0,flex:!0,"items-center":!0,"appearance-none":!0,"justify-center":!0,"aspect-[1/1]":!0,"text-zinc-500":!0,"hover:text-accent-500":!0,"disabled:hover:text-inherit":!0,"disabled:opacity-25":!0,"disabled:!text-zinc-500":!0,"dark:text-zinc-300":!0,"dark:disabled:!text-zinc-300":!0,"dark:hover:text-accent-400":!0},repeater__help:{"text-zinc-500":!0,"text-[11px]":!0,"[line-height:1em]":!0,"dark:text-zinc-400":!0,"mb-2":!0,"-mt-1":!0},repeater__item:{flex:!0,relative:!0,"w-full":!0,"mb-2":!0,"bg-white":!0,border:!0,"border-zinc-200":!0,"rounded-sm":!0,"shadow-none":!0,"dark:border-zinc-700":!0,"dark:bg-transparent":!0,"[&.formkit-dropZone]:opacity-30":!0,"[&.formkit-dropZone]:blur-[2px]":!0},repeater__dragHandleWrapper:{relative:!0,"w-8":!0,"bg-zinc-50":!0,"rounded-sm":!0,"rounded-tr-none":!0,"rounded-br-none":!0,"dark:bg-zinc-800":!0},repeater__dragHandle:{"w-full":!0,"h-full":!0,flex:!0,absolute:!0,"top-0":!0,"left-0":!0,"cursor-grab":!0,"active:cursor-grabbing":!0},repeater__dragHandleIcon:{"w-2":!0,"m-auto":!0,"text-zinc-400":!0,"dark:text-zinc-600":!0,"[&>svg>path]:fill-current":!0},repeater__moveDownIcon:{block:!0,"w-[0.75em]":!0,"aspect-[1/1]":!0},repeater__moveUpIcon:{block:!0,"w-[0.75em]":!0,"aspect-[1/1]":!0},repeater__removeIcon:{block:!0,"w-[1.25em]":!0,"aspect-[1/1]":!0},repeater__addIcon:{block:!0,"w-[1.25em]":!0,"aspect-[1/1]":!0},slider__outer:{group:!0,"max-w-none":!0,"min-w-0":!0,grow:!0,"mb-4":!0,"data-[disabled]:select-none":!0,"data-[disabled]:opacity-50":!0,"text-sm":!0,"data-[disabled]:pointer-events-none":!0},slider__help:{"text-zinc-500":!0,"text-[11px]":!0,"[line-height:1em]":!0,"dark:text-zinc-400":!0,"-mt-0.5":!0,"mb-1.5":!0},slider__sliderInner:{flex:!0,"items-center":!0,"[&>[data-type=number]]:mb-0":!0,"[&>[data-type=number]]:ml-2.5":!0,"[&>[data-type=number]]:shrink":!0,"[&>[data-type=number]]:grow-0":!0,"[&[data-has-mark-labels=true]_[id^=track]]:mb-5":!0},slider__track:{grow:!0,relative:!0,"z-20":!0,"py-2.5":!0,"select-none":!0},slider__trackWrapper:{"px-[2px]":!0,"rounded-full":!0,"bg-zinc-300":!0,"dark:bg-zinc-500":!0},slider__trackInner:{"h-1.5":!0,"mx-0.5":!0,relative:!0},slider__prefixIcon:{flex:!0,"items-center":!0,"-ml-1":!0,"mr-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"text-zinc-600":!0,"dark:text-zinc-300":!0},slider__suffixIcon:{flex:!0,"items-center":!0,"-mr-1":!0,"ml-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"text-zinc-600":!0,"dark:text-zinc-300":!0},slider__fill:{"h-full":!0,"rounded-full":!0,absolute:!0,"top-0":!0,"-mx-1":!0,"bg-accent-500":!0,"group-data-[disabled]:bg-zinc-500":!0},slider__marks:{absolute:!0,"pointer-events-none":!0,"inset-0":!0},slider__mark:{absolute:!0,"top-1/2":!0,"w-[3px]":!0,"h-[3px]":!0,"rounded-full":!0,"-translate-x-1/2":!0,"-translate-y-1/2":!0,"bg-zinc-400":!0,"data-[active=true]:bg-white":!0},slider__markLabel:{absolute:!0,"top-[calc(100%+0.5em)]":!0,"left-1/2":!0,"text-zinc-400":!0,"text-[11px]":!0,"[line-height:1em]":!0,"-translate-x-1/2":!0},slider__handles:{"m-0":!0,"p-0":!0,"list-none":!0},slider__handle:{group:!0,"select-none":!0,"w-4":!0,"h-4":!0,"rounded-full":!0,"bg-white":!0,absolute:!0,"top-1/2":!0,"left-0":!0,"z-30":!0,"-translate-x-1/2":!0,"-translate-y-1/2":!0,"shadow-[inset_0_0_0_1px_rgba(0,0,0,0.1),0_1px_2px_0_rgba(0,0,0,0.5)]":!0,"focus-visible:outline-0":!0,"focus-visible:ring-2":!0,"ring-accent-500":!0,"data-[is-target=true]:z-20":!0,"dark:bg-zinc-200":!0},slider__tooltip:{absolute:!0,"bottom-full":!0,"left-1/2":!0,"-translate-x-1/2":!0,"-translate-y-[4px]":!0,"bg-accent-500":!0,"text-white":!0,"py-1":!0,"px-1.5":!0,"text-xs":!0,"leading-none":!0,"whitespace-nowrap":!0,"rounded-sm":!0,"opacity-0":!0,"pointer-events-none":!0,"transition-opacity":!0,'after:content-[""]':!0,"after:absolute":!0,"after:top-full":!0,"after:left-1/2":!0,"after:-translate-x-1/2":!0,"after:-translate-y-[1px]":!0,"after:border-4":!0,"after:border-transparent":!0,"after:border-t-accent-500":!0,"group-hover:opacity-100":!0,"group-focus-visible:opacity-100":!0,"group-data-[show-tooltip=true]:opacity-100":!0},slider__linkedValues:{flex:!0,"items-start":!0,"justify-between":!0},slider__minValue:{grow:!0,"!max-w-[45%]":!0,"mb-0":!0,"[&>div>div]:relative":!0,'[&>div>div::after]:content-[""]':!0,"[&>div>div::after]:absolute":!0,"[&>div>div::after]:top-1/2":!0,"[&>div>div::after]:left-[105.5%]":!0,"[&>div>div::after]:w-[12%]":!0,"[&>div>div::after]:h-[1px]":!0,"[&>div>div::after]:bg-zinc-300":!0,"dark:[&>div>div::after]:bg-zinc-700":!0},slider__maxValue:{grow:!0,"!max-w-[45%]":!0,"mb-0":!0,relative:!0},slider__chart:{relative:!0,"z-20":!0,"mb-2":!0,flex:!0,"justify-between":!0,"items-center":!0,"w-full":!0,"aspect-[3/1]":!0},slider__chartBar:{absolute:!0,"bottom-0":!0,"h-full":!0,"bg-zinc-400":!0,"data-[active=false]:bg-zinc-300":!0,"dark:bg-zinc-500":!0,"dark:data-[active=false]:bg-zinc-600":!0},taglist__inner:{"py-2":!0,"pr-0":!0,"pl-0":!0},taglist__tags:{"pl-3":!0},taglist__tagWrapper:{"[&.formkit-dropZone_.formkit-tag]:opacity-25":!0,"[&.formkit-touchDropZone_.formkit-tag]:opacity-25":!0},taglist__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"!p-0":!0,"!w-[0%]":!0,"min-w-[1em]":!0,"inline-block":!0,"-mt-1":!0,"first:mt-0":!0,"first:mb-1":!0},taglist__listboxButton:{"ml-auto":!0,"shrink-0":!0},toggle__outer:{group:!0,"min-w-0":!0,grow:!0,"mb-4":!0,"data-[disabled]:select-none":!0,"data-[disabled]:opacity-50":!0,"text-sm":!0,"max-w-none":!0},toggle__altLabel:{block:!0,"w-full":!0,"mb-1.5":!0,"font-bold":!0,"text-[11px]":!0,"[line-height:1em]":!0,"text-zinc-700":!0,"dark:text-zinc-300":!0},toggle__inner:{peer:!0,"inline-block":!0,"mr-2":!0},toggle__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,peer:!0,absolute:!0,"opacity-0":!0,"w-0":!0,"h-0":!0},toggle__label:{block:!0,"text-zinc-700":!0,"text-xs":!0,"font-bold":!0,"mb-1":!0,"dark:text-zinc-300":!0,"peer-first:font-normal":!0,"peer-first:mb-0":!0},toggle__innerLabel:{absolute:!0,"text-zinc-200":!0,"text-[10px]":!0,"font-bold":!0,"select-none":!0,"left-full":!0,"top-1/2":!0,"-translate-x-full":!0,"-translate-y-1/2":!0,"px-1":!0},toggle__thumb:{relative:!0,"p-0.5":!0,"left-0":!0,"aspect-[1/1]":!0,"rounded-full":!0,"transition-all":!0,"w-[1.25em]":!0,"bg-zinc-50":!0,"text-zinc-600":!0,"shadow-base":!0},toggle__track:{"p-0.5":!0,"min-w-[3em]":!0,relative:!0,"cursor-pointer":!0,"select-none":!0,"rounded-full":!0,"transition-all":!0,"bg-zinc-400":!0,"peer-checked:bg-accent-500":!0,"peer-checked:[&>div:last-child]:left-full":!0,"peer-checked:[&>div:last-child]:-translate-x-full":!0,"peer-checked:[&>div:first-child:not(:last-child)]:left-0":!0,"peer-checked:[&>div:first-child:not(:last-child)]:translate-x-0":!0,"shadow-none":!0,"peer-focus-visible:ring-2":!0,"peer-focus-visible:ring-accent-400":!0,"peer-focus-visible:ring-offset-2":!0,"dark:bg-zinc-500":!0},toggle__valueLabel:{"font-bold":!0,"text-[11px]":!0,"[line-height:1em]":!0,"text-zinc-700":!0,"dark:text-zinc-300":!0},toggle__wrapper:{flex:!0,"flex-wrap":!0,"items-center":!0,"mb-1.5":!0},togglebuttons__wrapper:{"mb-1.5":!0},togglebuttons__options:{"group/options":!0,"inline-flex":!0,"data-[vertical=true]:flex-col":!0},togglebuttons__option:{"group/option":!0},togglebuttons__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"!px-4":!0,"!mb-0":!0,relative:!0,"focus:z-10":!0,"group-data-[vertical=true]/options:w-full":!0,"justify-center":!0,"bg-accent-50":!0,"disabled:opacity-50":!0,"disabled:cursor-not-allowed":!0,"group-data-[disabled]:disabled:opacity-100":!0,"dark:bg-transparent":!0,"dark:disabled:bg-transparent":!0,"dark:disabled:text-accent-500":!0,"dark:text-accent-500":!0,"aria-[pressed=true]:bg-accent-500":!0,"aria-[pressed=true]:text-white":!0,"dark:aria-[pressed=true]:bg-accent-500":!0,"dark:aria-[pressed=true]:text-white":!0,"group-[&]/option:!rounded-none":!0,"group-data-[vertical=false]/options:group-first/option:!rounded-sm":!0,"group-data-[vertical=true]/options:group-first/option:!rounded-sm":!0,"group-data-[vertical=false]/options:group-first/option:!rounded-tr-none":!0,"group-data-[vertical=false]/options:group-first/option:!rounded-br-none":!0,"group-data-[vertical=true]/options:group-first/option:!rounded-bl-none":!0,"group-data-[vertical=true]/options:group-first/option:!rounded-br-none":!0,"group-data-[vertical=false]/options:group-last/option:!rounded-sm":!0,"group-data-[vertical=true]/options:group-last/option:!rounded-sm":!0,"group-data-[vertical=false]/options:group-last/option:!rounded-tl-none":!0,"group-data-[vertical=false]/options:group-last/option:!rounded-bl-none":!0,"group-data-[vertical=true]/options:group-last/option:!rounded-tl-none":!0,"group-data-[vertical=true]/options:group-last/option:!rounded-tr-none":!0,"group-data-[vertical=false]/options:group-[&]/option:!border-r-0":!0,"group-data-[vertical=false]/options:group-last/option:!border-r":!0,"group-data-[vertical=false]/options:group-[&]/option:aria-[pressed=true]:border-x-accent-500":!0,"group-data-[vertical=false]/options:group-first/option:aria-[pressed=true]:border-l-accent-500":!0,"group-data-[vertical=false]/options:group-last/option:aria-[pressed=true]:border-r-accent-500":!0,"dark:group-data-[vertical=false]/options:group-[&]/option:aria-[pressed=true]:border-x-accent-500":!0,"dark:group-data-[vertical=false]/options:group-first/option:aria-[pressed=true]:border-l-accent-500":!0,"dark:group-data-[vertical=false]/options:group-last/option:aria-[pressed=true]:border-r-accent-500":!0,"group-data-[vertical=true]/options:group-[&]/option:!border-b-0":!0,"group-data-[vertical=true]/options:group-last/option:!border-b":!0,"group-data-[vertical=true]/options:group-[&]/option:aria-[pressed=true]:border-y-accent-500":!0,"group-data-[vertical=true]/options:group-first/option:aria-[pressed=true]:border-t-accent-500":!0,"group-data-[vertical=true]/options:group-last/option:aria-[pressed=true]:border-b-accent-500":!0,"dark:group-data-[vertical=true]/options:group-[&]/option:aria-[pressed=true]:border-y-accent-500":!0,"dark:group-data-[vertical=true]/options:group-first/option:aria-[pressed=true]:border-t-accent-500":!0,"dark:group-data-[vertical=true]/options:group-last/option:aria-[pressed=true]:border-b-accent-500":!0},transferlist__outer:{group:!0,"min-w-0":!0,grow:!0,"mb-4":!0,"data-[disabled]:select-none":!0,"data-[disabled]:opacity-50":!0,"text-sm":!0,"max-w-none":!0,"[&_.dnd-placeholder]:bg-accent-500":!0,"[&_.dnd-placeholder]:text-white":!0},transferlist__wrapper:{flex:!0,"flex-col":!0,"sm:flex-row":!0,"justify-between":!0,"w-full":!0,"max-w-none":!0},transferlist__help:{"text-zinc-500":!0,"text-[11px]":!0,"[line-height:1em]":!0,"dark:text-zinc-400":!0,"pb-2":!0},transferlist__transferlist:{grow:!0,shrink:!0,"min-w-0":!0,"shadow-none":!0,"group-[&]/repeater:shadow-none":!0,"group-[&]/multistep:shadow-none":!0,"aspect-[4/5]":!0,flex:!0,"flex-col":!0,"h-[350px]":!0,border:!0,"border-zinc-200":!0,"rounded-sm":!0,"overflow-hidden":!0,"select-none":!0,"[&:has(:focus-visible)]:ring-1":!0,"[&:has(:focus-visible)]:ring-accent-400":!0,"dark:border-zinc-800":!0,"dark:bg-zinc-900/50":!0},transferlist__transferlistHeader:{flex:!0,"bg-zinc-100":!0,"text-zinc-600":!0,"text-xs":!0,"justify-between":!0,"items-center":!0,"border-b":!0,"border-zinc-200":!0,"py-2":!0,"px-2.5":!0,"dark:bg-zinc-700":!0,"dark:border-zinc-800":!0,"dark:text-zinc-400":!0},transferlist__transferlistHeaderItemCount:{"ml-auto":!0,"text-xs":!0,"min-w-[1.5em]":!0,"[line-height:1.5em]":!0,"px-2":!0,"text-center":!0,"rounded-lg":!0,"bg-zinc-200":!0,"text-zinc-700":!0,"dark:bg-zinc-500":!0,"dark:text-zinc-300":!0},transferlist__transferlistListItems:{"list-none":!0,"bg-white":!0,"h-full":!0,"overflow-x-hidden":!0,"overflow-y-auto":!0,"dark:bg-transparent":!0,"outline-hidden":!0},transferlist__transferlistListItem:{"py-2":!0,"px-2":!0,"text-zinc-700":!0,"ring-1":!0,"ring-zinc-200":!0,"aria-selected:bg-accent-100":!0,"data-[is-active=true]:bg-accent-100":!0,"data-[is-active=true]:ring-accent-200":!0,"aria-selected:ring-accent-200":!0,relative:!0,flex:!0,"cursor-pointer":!0,"items-center":!0,"bg-white":!0,"pl-[1.5em]":!0,"first:-mt-px":!0,"first:border-t":!0,"aria-selected:z-[2]":!0,"aria-selected:border-transparent":!0,"aria-selected:ring-1":!0,"data-[is-active=true]:z-[2]":!0,"data-[is-active=true]:border-transparent":!0,"data-[is-active=true]:ring-1":!0,"group-data-[is-max=true]:cursor-not-allowed":!0,"dark:bg-zinc-800":!0,"dark:text-zinc-300":!0,"dark:data-[is-active=true]:bg-accent-800":!0,"dark:aria-selected:bg-accent-800":!0,"dark:ring-zinc-700":!0,"dark:data-[is-active=true]:ring-accent-600":!0,"dark:aria-selected:ring-accent-600":!0,"[&.formkit-dropZone]:bg-accent-100":!0,"[&.formkit-selectionDropZone]:bg-accent-100":!0,"[&.formkit-touchDropZone]:bg-accent-100":!0,"[&.formkit-touchSelectionDropZone]:bg-accent-100":!0,"[&.formkit-longTouch]:bg-accent-100":!0,"dark:[&.formkit-dropZone]:bg-accent-900":!0,"dark:[&.formkit-selectionDropZone]:bg-accent-900":!0,"dark:[&.formkit-touchDropZone]:bg-accent-900":!0,"dark:[&.formkit-touchSelectionDropZone]:bg-accent-900":!0,"dark:[&.formkit-longTouch]:bg-accent-900":!0},transferlist__transferlistOption:{"text-xs":!0},transferlist__transferControls:{"inline-flex":!0,"grow-0":!0,shrink:!0,border:!0,"border-zinc-200":!0,"flex-row":!0,"sm:flex-col":!0,"justify-center":!0,"my-2":!0,"sm:my-auto":!0,"mx-auto":!0,"sm:mx-2":!0,"rounded-sm":!0,"overflow-clip":!0,"shadow-none":!0,"group-[&]/repeater:shadow-none":!0,"group-[&]/multistep:shadow-none":!0,"dark:border-zinc-800":!0},transferlist__sourceEmptyMessage:{"appearance-none":!0,"border-none":!0,"w-full":!0,"my-2":!0,"text-center":!0,"text-zinc-500":!0,italic:!0},transferlist__sourceListItems:{"group-data-[is-max=true]:opacity-50":!0},transferlist__targetEmptyMessage:{"appearance-none":!0,"border-none":!0,"w-full":!0,"my-2":!0,"text-center":!0,"text-zinc-500":!0,italic:!0},transferlist__emptyMessageInner:{flex:!0,"items-center":!0,"justify-center":!0,"p-2":!0,"text-sm":!0},transferlist__transferlistControls:{"bg-white":!0,"p-2":!0,"border-b":!0,"border-zinc-200":!0,"dark:bg-zinc-700":!0,"dark:border-zinc-700":!0},transferlist__transferlistSearch:{flex:!0,border:!0,"border-zinc-200":!0,"rounded-sm":!0,"items-center":!0,"text-zinc-700":!0,"selection:bg-accent-100":!0,"dark:border-zinc-800":!0,"dark:text-zinc-300":!0,"dark:selection:bg-accent-100":!0,"dark:selection:text-zinc-700":!0,"dark:bg-zinc-800":!0},transferlist__transferlistSearchInput:{"border-none":!0,"px-2":!0,"py-1.5":!0,"w-full":!0,"bg-transparent":!0,"outline-hidden":!0,"text-xs":!0},transferlist__transferlistSearchClear:{flex:!0,"w-[0.75em]":!0,"mr-2":!0,"[&_svg]:w-full":!0},transferlist__controlLabel:{absolute:!0,"opacity-0":!0,"pointer-events-none":!0,"text-[0px]":!0},transferlist__selectedIcon:{"w-[0.75em]":!0,absolute:!0,"left-[0.5em]":!0,"select-none":!0,"text-accent-500":!0,"dark:text-accent-400":!0},transferlist__transferlistButton:{"sm:w-5":!0,relative:!0,flex:!0,"justify-center":!0,"text-sm":!0,"shrink-0":!0,"box-content":!0,"text-zinc-700":!0,"disabled:bg-zinc-200":!0,"disabled:!text-zinc-400":!0,"bg-zinc-50":!0,"hover:text-accent-500":!0,"cursor-pointer":!0,"appearance-none":!0,"border-none":!0,"p-2.5":!0,"hover:z-10":!0,"disabled:cursor-not-allowed":!0,"disabled:opacity-50":!0,"disabled:hover:text-current":!0,"disabled:hover:outline-hidden":!0,"focus-visible:ring-1":!0,"focus-visible:ring-accent-400":!0,"focus-visible:z-10":!0,"dark:bg-zinc-800":!0,"dark:text-zinc-400":!0,"dark:disabled:!text-zinc-600":!0,"dark:disabled:bg-zinc-900":!0,"dark:disabled:hover:text-current":!0,"dark:disabled:hover:outline-hidden":!0,"dark:hover:text-accent-400":!0},transferlist__fastForwardIcon:{"w-4":!0,flex:!0,"select-none":!0,"[&>svg]:m-auto":!0,"[&>svg]:w-full":!0,"[&>svg]:max-w-[1rem]":!0,"[&>svg]:max-h-[1rem]":!0,"rotate-90":!0,"sm:rotate-0":!0},transferlist__moveRightIcon:{"w-4":!0,flex:!0,"select-none":!0,"[&>svg]:m-auto":!0,"[&>svg]:w-full":!0,"[&>svg]:max-w-[1rem]":!0,"[&>svg]:max-h-[1rem]":!0,"rotate-90":!0,"sm:rotate-0":!0},transferlist__moveLeftIcon:{"w-4":!0,flex:!0,"select-none":!0,"[&>svg]:m-auto":!0,"[&>svg]:w-full":!0,"[&>svg]:max-w-[1rem]":!0,"[&>svg]:max-h-[1rem]":!0,"rotate-90":!0,"sm:rotate-0":!0},transferlist__rewindIcon:{"w-4":!0,flex:!0,"select-none":!0,"[&>svg]:m-auto":!0,"[&>svg]:w-full":!0,"[&>svg]:max-w-[1rem]":!0,"[&>svg]:max-h-[1rem]":!0,"rotate-90":!0,"sm:rotate-0":!0},transferlist__messages:{"mt-2":!0},barcode__barcodeIcon:{"w-[1.5em]":!0,"text-zinc-700":!0,"cursor-pointer":!0,"dark:text-zinc-300":!0},barcode__dialog:{"border-none":!0,"outline-hidden":!0,"overflow-clip":!0,"p-0":!0,"bg-black":!0,"rounded-sm":!0,"w-[100%-2rem]":!0,"max-w-[30rem]":!0,"[&::backdrop]:bg-zinc-800/50":!0},barcode__video:{"w-full":!0,"aspect-[1/1]":!0,"object-cover":!0,block:!0,"pointer-events-none":!0},barcode__closeIcon:{"cursor-pointer":!0,absolute:!0,"bg-white":!0,"color-zinc-700":!0,"w-[1.5em]":!0,"h-[1.5em]":!0,"rounded-sm":!0,flex:!0,"top-2":!0,"right-2":!0,"z-20":!0,"[&>svg]:w-[1.25em]":!0,"[&>svg]:h-[1.25em]":!0,"[&>svg]:m-auto":!0},barcode__overlay:{"text-zinc-700":!0,"dark:text-zinc-300":!0,absolute:!0,"top-1/2":!0,"left-1/2":!0,"w-[min(20em,75%)]":!0,"aspect-[1/1]":!0,"-translate-x-1/2":!0,"-translate-y-1/2":!0,"rounded-sm":!0,"pointer-events-none":!0,"shadow-[0_0_0_999em_rgba(0,0,0,0.5)]":!0},barcode__overlayDecorators:{absolute:!0,"inset-0":!0,"z-10":!0},barcode__overlayDecoratorTopLeft:{absolute:!0,"w-[1.5rem]":!0,"h-[1.5rem]":!0,"rounded-sm":!0,"top-0":!0,"left-0":!0,"border-l-4":!0,"border-t-4":!0,"rounded-tr-none":!0,"rounded-bl-none":!0},barcode__overlayDecoratorTopRight:{absolute:!0,"w-[1.5rem]":!0,"h-[1.5rem]":!0,"rounded-sm":!0,"top-0":!0,"right-0":!0,"border-r-4":!0,"border-t-4":!0,"rounded-tl-none":!0,"rounded-br-none":!0},barcode__overlayDecoratorBottomRight:{absolute:!0,"w-[1.5rem]":!0,"h-[1.5rem]":!0,"rounded-sm":!0,"bottom-0":!0,"right-0":!0,"border-r-4":!0,"border-b-4":!0,"rounded-tr-none":!0,"rounded-bl-none":!0},barcode__overlayDecoratorBottomLeft:{absolute:!0,"w-[1.5rem]":!0,"h-[1.5rem]":!0,"rounded-sm":!0,"bottom-0":!0,"left-0":!0,"border-l-4":!0,"border-b-4":!0,"rounded-tl-none":!0,"rounded-br-none":!0},"multi-step__outer":{group:!0,"min-w-0":!0,grow:!0,"mb-4":!0,"data-[disabled]:select-none":!0,"data-[disabled]:opacity-50":!0,"text-sm":!0,"group/multistep":!0,"max-w-[32rem]":!0},"multi-step__wrapper":{"group/wrapper":!0,"data-[tab-style=tab]:shadow-none":!0,"data-[tab-style=tab]:rounded-sm":!0},"multi-step__tabs":{flex:!0,"items-center":!0,"group-data-[tab-style=tab]/wrapper:overflow-auto":!0,"group-data-[tab-style=tab]/wrapper:border":!0,"group-data-[tab-style=tab]/wrapper:border-b-0":!0,"group-data-[tab-style=tab]/wrapper:border-zinc-200":!0,"group-data-[tab-style=tab]/wrapper:rounded-sm":!0,"group-data-[tab-style=tab]/wrapper:rounded-bl-none":!0,"group-data-[tab-style=tab]/wrapper:rounded-br-none":!0,"dark:group-data-[tab-style=tab]/wrapper:border-zinc-800":!0,"group-data-[tab-style=progress]/wrapper:my-6":!0,"group-data-[tab-style=progress]/wrapper:justify-around":!0,"group-data-[tab-style=progress]/wrapper:overflow-visible":!0,"group-data-[tab-style=progress]/wrapper:group-data-[hide-labels=true]/wrapper:mb-3.5":!0},"multi-step__tab":{"group/tab":!0,"group-data-[tab-style=tab]/wrapper:relative":!0,"group-data-[tab-style=tab]/wrapper:flex":!0,"group-data-[tab-style=tab]/wrapper:grow":!0,"group-data-[tab-style=tab]/wrapper:text-xs":!0,"group-data-[tab-style=tab]/wrapper:items-center":!0,"group-data-[tab-style=tab]/wrapper:justify-center":!0,"group-data-[tab-style=tab]/wrapper:cursor-pointer":!0,"group-data-[tab-style=tab]/wrapper:text-zinc-700":!0,"group-data-[tab-style=tab]/wrapper:bg-zinc-100":!0,"group-data-[tab-style=tab]/wrapper:py-3.5":!0,"group-data-[tab-style=tab]/wrapper:px-4":!0,"group-data-[tab-style=tab]/wrapper:border-r":!0,"group-data-[tab-style=tab]/wrapper:border-b":!0,"group-data-[tab-style=tab]/wrapper:border-zinc-200":!0,"group-data-[tab-style=tab]/wrapper:last:border-r-0":!0,"group-data-[tab-style=tab]/wrapper:shadow-[inset_0_-0.5em_0.5em_-0.5em_rgba(0,0,0,0.1)]":!0,"group-data-[tab-style=tab]/wrapper:data-[active=true]:bg-white":!0,"group-data-[tab-style=tab]/wrapper:data-[active=true]:font-bold":!0,"group-data-[tab-style=tab]/wrapper:data-[active=true]:border-b-white":!0,"group-data-[tab-style=tab]/wrapper:data-[active=true]:z-10":!0,"group-data-[tab-style=tab]/wrapper:data-[active=true]:shadow-[0_0_0.5em_0_rgba(0,0,0,0.1)]":!0,"dark:group-data-[tab-style=tab]/wrapper:text-zinc-300":!0,"dark:group-data-[tab-style=tab]/wrapper:bg-zinc-950/20":!0,"dark:group-data-[tab-style=tab]/wrapper:data-[active=true]:bg-transparent":!0,"dark:group-data-[tab-style=tab]/wrapper:data-[active=true]:border-b-transparent":!0,"dark:group-data-[tab-style=tab]/wrapper:border-zinc-800":!0,"group-data-[tab-style=progress]/wrapper:flex":!0,"group-data-[tab-style=progress]/wrapper:flex-col":!0,"group-data-[tab-style=progress]/wrapper:items-center":!0,"group-data-[tab-style=progress]/wrapper:grow":!0,"group-data-[tab-style=progress]/wrapper:shrink-0":!0,"group-data-[tab-style=progress]/wrapper:relative":!0,"group-data-[tab-style=progress]/wrapper:before:block":!0,"group-data-[tab-style=progress]/wrapper:before:text-xs":!0,"group-data-[tab-style=progress]/wrapper:before:w-[1.25rem]":!0,"group-data-[tab-style=progress]/wrapper:before:h-[1.25rem]":!0,"group-data-[tab-style=progress]/wrapper:before:border-4":!0,"group-data-[tab-style=progress]/wrapper:before:border-zinc-300":!0,"group-data-[tab-style=progress]/wrapper:before:rounded-full":!0,"group-data-[tab-style=progress]/wrapper:before:bg-white":!0,"group-data-[tab-style=progress]/wrapper:before:z-10":!0,"dark:group-data-[tab-style=progress]/wrapper:before:border-zinc-800":!0,"dark:group-data-[tab-style=progress]/wrapper:before:bg-zinc-950":!0,"group-data-[tab-style=progress]/wrapper:after:block":!0,"group-data-[tab-style=progress]/wrapper:after:h-1":!0,"group-data-[tab-style=progress]/wrapper:after:w-full":!0,"group-data-[tab-style=progress]/wrapper:after:absolute":!0,"group-data-[tab-style=progress]/wrapper:after:top-[0.5em]":!0,"group-data-[tab-style=progress]/wrapper:after:left-[calc(50%+0.5em)]":!0,"group-data-[tab-style=progress]/wrapper:after:bg-zinc-300":!0,"group-data-[tab-style=progress]/wrapper:data-[valid=true]:data-[visited=true]:after:bg-accent-500":!0,"group-data-[tab-style=progress]/wrapper:last:after:hidden":!0,"dark:group-data-[tab-style=progress]/wrapper:after:bg-zinc-800":!0,"dark:group-data-[tab-style=progress]/wrapper:data-[valid=true]:data-[visited=true]:after:bg-accent-500":!0},"multi-step__tabLabel":{"group-data-[tab-style=progress]/wrapper:absolute":!0,"group-data-[tab-style=progress]/wrapper:text-zinc-800":!0,"group-data-[tab-style=progress]/wrapper:top-full":!0,"group-data-[tab-style=progress]/wrapper:w-full":!0,"group-data-[tab-style=progress]/wrapper:whitespace-nowrap":!0,"group-data-[tab-style=progress]/wrapper:text-[11px]":!0,"[line-height:1em]":!0,"dark:group-data-[tab-style=progress]/wrapper:text-zinc-300":!0},"multi-step__badge":{"bg-red-500":!0,absolute:!0,"font-mono":!0,"font-bold":!0,flex:!0,"items-center":!0,"justify-center":!0,"aspect-[1/1]":!0,"[line-height:1.25rem]":!0,"text-white":!0,"rounded-full":!0,"group-data-[valid=true]/tab:bg-accent-500":!0,"group-data-[tab-style=tab]/wrapper:text-[0.66rem]":!0,"group-data-[tab-style=tab]/wrapper:p-1.5":!0,"group-data-[tab-style=tab]/wrapper:w-5":!0,"group-data-[tab-style=tab]/wrapper:h-5":!0,"group-data-[tab-style=tab]/wrapper:top-1.5":!0,"group-data-[tab-style=tab]/wrapper:right-1.5":!0,"group-data-[tab-style=progress]/wrapper:w-[1.25rem]":!0,"group-data-[tab-style=progress]/wrapper:h-[1.25rem]":!0,"group-data-[tab-style=progress]/wrapper:p-1":!0,"group-data-[tab-style=progress]/wrapper:text-[10px]":!0,"group-data-[tab-style=progress]/wrapper:[line-height:0]":!0,"group-data-[tab-style=progress]/wrapper:z-10":!0},"multi-step__validStepIcon":{"w-full":!0,"h-full":!0,"mt-0.5":!0},"multi-step__steps":{"px-10":!0,"pt-8":!0,"pb-4":!0,"bg-white":!0,border:!0,"border-zinc-200":!0,"rounded-sm":!0,"dark:bg-transparent":!0,"dark:border-zinc-800":!0,"group-data-[tab-style=tab]/wrapper:border-t-0":!0,"group-data-[tab-style=tab]/wrapper:rounded-tl-none":!0,"group-data-[tab-style=tab]/wrapper:rounded-tr-none":!0,"group-data-[tab-style=progress]/wrapper:shadow-none":!0,"[&_[data-type]]:max-w-none":!0},step__stepActions:{flex:!0,"justify-between":!0,"[&>*]:grow-0":!0},step__stepPrevious:{"mr-1.5":!0},step__stepNext:{"ml-auto":!0}},ko={outer:{group:!0,"max-w-none":!0,"min-w-0":!0,grow:!0,"mb-4":!0,"data-[disabled]:select-none":!0,"data-[disabled]:opacity-50":!0,"text-sm":!0},label:{block:!0,"text-zinc-700":!0,"text-xs":!0,"font-bold":!0,"mb-1":!0,"dark:text-zinc-300":!0},legend:{block:!0,"text-zinc-700":!0,"text-xs":!0,"font-bold":!0,"dark:text-zinc-300":!0},input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0},prefixIcon:{flex:!0,"items-center":!0,"-ml-1":!0,"mr-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0},suffixIcon:{flex:!0,"items-center":!0,"-mr-1":!0,"ml-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0},loaderIcon:{"animate-spin":!0,flex:!0,"items-center":!0,"my-auto":!0,"ml-2":!0,"text-sm":!0,"text-zinc-500":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0},loadMoreInner:{flex:!0,"text-xs":!0,"text-zinc-500":!0,"p-2":!0,"items-center":!0,"justify-center":!0,"[&>span]:mr-2":!0},help:{"text-zinc-500":!0,"text-[11px]":!0,"[line-height:1em]":!0,"dark:text-zinc-400":!0},message:{"text-red-500":!0,"mb-1.5":!0,"text-[11px]":!0,"[line-height:1em]":!0,"dark:text-red-400":!0},overlay:{"text-zinc-700":!0,"dark:text-zinc-300":!0},overlayPlaceholder:{"text-zinc-400":!0,"dark:text-zinc-400/50":!0},overlayLiteral:{"text-zinc-700":!0,"dark:text-zinc-300":!0},overlayChar:{"text-zinc-700":!0,"dark:text-zinc-300":!0},overlayEnum:{"text-zinc-700":!0,"dark:text-zinc-300":!0},searchInput__input:{"w-full":!0,"bg-transparent":!0,border:!0,"border-zinc-200":!0,"dark:border-zinc-700":!0,"rounded-lg":!0,"focus:outline-none":!0,"focus:ring-2":!0,"focus:ring-accent-500/30":!0,"focus:border-accent-500":!0,"dark:focus:border-accent-400":!0,"transition-all":!0,"placeholder:text-zinc-400":!0,"disabled:opacity-50":!0,"disabled:cursor-not-allowed":!0,"pl-9":!0,"pr-9":!0,"py-2":!0,"text-sm":!0},"searchInput__input--sm":{"pl-7":!0,"pr-7":!0,"py-1.5":!0,"text-xs":!0},searchInput__icon:{absolute:!0,"left-3":!0,"top-1/2":!0,"-translate-y-1/2":!0,"text-zinc-400":!0,"w-4":!0,"h-4":!0},"searchInput__icon--sm":{"left-2":!0,"w-3.5":!0,"h-3.5":!0},searchInput__clearButton:{absolute:!0,"right-2.5":!0,"top-1/2":!0,"-translate-y-1/2":!0,"p-1":!0,"rounded-md":!0,"hover:bg-zinc-100":!0,"dark:hover:bg-zinc-800":!0,"transition-colors":!0},searchInput__clearIcon:{"w-3.5":!0,"h-3.5":!0,"text-zinc-400":!0,"hover:text-zinc-600":!0,"dark:hover:text-zinc-300":!0},selectSearch__button:{"w-full":!0,"min-w-[200px]":!0,"px-3":!0,"py-2":!0,"text-left":!0,"rounded-lg":!0,"focus:outline-none":!0,"focus:ring-2":!0,"focus:ring-accent-500/30":!0,"bg-transparent":!0,"disabled:opacity-50":!0,"disabled:cursor-not-allowed":!0,"text-sm":!0,"overflow-hidden":!0,"transition-colors":!0,border:!0,"border-zinc-200":!0,"dark:border-zinc-700":!0,"focus:border-accent-500":!0,"dark:focus:border-accent-400":!0}};function wo(t){const o=String(t.value||"");return o?/^[a-z][a-z0-9_]*$/.test(o):!0}function _o(t){const o=t.value;if(o===""||o===null||o===void 0)return!0;const a=Number(o);return a>0&&Number.isInteger(a)}function $o(t){const o=t.value;return o===""||o===null||o===void 0?!0:Number(o)>=0}function Co(t){const o=String(t.value||"");if(!o.trim())return!0;try{return JSON.parse(o),!0}catch{return!1}}function So(t){const o=String(t.value||"");if(!o)return!0;try{return new URL(o),!0}catch{return!1}}function To(t){const o=String(t.value||"");return o?o.length>=10&&!/\s/.test(o):!0}const Io={snakeCase:wo,positiveInteger:_o,nonNegative:$o,validJson:Co,validUrl:So,apiKey:To},zo={snakeCase({name:t}){return`${t} must be in snake_case format (lowercase letters, numbers, and underscores, starting with a letter).`},positiveInteger({name:t}){return`${t} must be a positive whole number.`},nonNegative({name:t}){return`${t} must be zero or greater.`},validJson({name:t}){return`${t} must be valid JSON.`},validUrl({name:t}){return`${t} must be a valid URL.`},apiKey({name:t}){return`${t} must be at least 10 characters with no spaces.`}},wt=ve({__name:"DropShadow",props:{offsetX:{default:8},offsetY:{default:8},intensity:{default:.5},pattern:{default:"crosshatch"}},setup(t){const o=t,a=p(),i=p(),l=p(),u=p(0),s=(c,f,y,b,v,d)=>{c.beginPath(),c.moveTo(f+d,y),c.lineTo(f+b-d,y),c.quadraticCurveTo(f+b,y,f+b,y+d),c.lineTo(f+b,y+v-d),c.quadraticCurveTo(f+b,y+v,f+b-d,y+v),c.lineTo(f+d,y+v),c.quadraticCurveTo(f,y+v,f,y+v-d),c.lineTo(f,y+d),c.quadraticCurveTo(f,y,f+d,y),c.closePath()},m=async()=>{if(await Le(),!a.value||!i.value||!l.value)return;const c=a.value.getContext("2d");if(!c)return;const f=l.value.getBoundingClientRect(),y=l.value.firstElementChild;if(y){const k=getComputedStyle(y);u.value=parseFloat(k.borderRadius)||0}const b=f.width+o.offsetX+4,v=f.height+o.offsetY+4;a.value.width=b,a.value.height=v,a.value.style.width=`${b}px`,a.value.style.height=`${v}px`,c.clearRect(0,0,a.value.width,a.value.height);const d=document.documentElement.classList.contains("dark");if(c.fillStyle=d?"#6b7280":"black",c.globalAlpha=o.intensity,c.save(),s(c,o.offsetX,o.offsetY,f.width,f.height,u.value),c.clip(),o.pattern==="crosshatch"){const k=d?4:3;c.lineWidth=1,c.strokeStyle=d?"#6b7280":"black";for(let g=-f.height;g<f.width;g+=k)c.beginPath(),c.moveTo(o.offsetX+g,o.offsetY),c.lineTo(o.offsetX+g+f.height,o.offsetY+f.height),c.stroke();for(let g=0;g<f.width+f.height;g+=k)c.beginPath(),c.moveTo(o.offsetX+g,o.offsetY+f.height),c.lineTo(o.offsetX+g-f.height,o.offsetY),c.stroke()}else if(o.pattern==="dots"){const g=d?3:2,_=[[0,8,2,10],[12,4,14,6],[3,11,1,9],[15,7,13,5]];for(let L=0;L<f.width;L+=g)for(let O=0;O<f.height;O+=g){const W=Math.floor(L/g)%4,J=Math.floor(O/g)%4;_[J][W]/16<o.intensity&&c.fillRect(o.offsetX+L,o.offsetY+O,1,1)}}else if(o.pattern==="diagonal"){const k=d?5:4;c.lineWidth=1,c.strokeStyle=d?"#6b7280":"black";for(let g=-f.height;g<f.width;g+=k)c.beginPath(),c.moveTo(o.offsetX+g,o.offsetY),c.lineTo(o.offsetX+g+f.height,o.offsetY+f.height),c.stroke()}c.restore()};let h=null,x=null;return Pe(()=>{h=new ResizeObserver(()=>{m()}),l.value&&h.observe(l.value),m(),x=new MutationObserver(()=>{m()}),x.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]})}),Ye(()=>{l.value&&h&&h.unobserve(l.value),x&&x.disconnect()}),ge(()=>[o.offsetX,o.offsetY,o.intensity,o.pattern],()=>{m()}),(c,f)=>(r(),n("div",{ref_key:"container",ref:i,class:"relative",style:st({paddingRight:`${t.offsetX}px`,paddingBottom:`${t.offsetY}px`})},[e("canvas",{ref_key:"canvas",ref:a,class:"absolute top-0 left-0 pointer-events-none"},null,512),e("div",{ref_key:"contentEl",ref:l,class:"relative"},[je(c.$slots,"default")],512)],4))}}),Vo={class:"prompt-input-container relative"},Mo=["contenteditable","data-placeholder"],Eo={class:"bg-white dark:bg-zinc-900 border border-zinc-300 dark:border-zinc-700 rounded-sm overflow-hidden min-w-[240px] max-w-[320px]"},Lo={key:0,class:"p-3 text-sm text-neutral-500"},Po={key:1,class:"p-3 text-sm text-neutral-500"},Ao={key:2,class:"max-h-[220px] overflow-y-auto"},jo=["onClick"],Do={class:"font-medium flex items-center gap-2"},Oo=["title"],Ro={key:0,class:"text-xs text-neutral-500 dark:text-neutral-400 mt-0.5"},Uo={key:1,class:"text-xs text-red-600 dark:text-red-400 mt-1"},Bo={class:"text-xs mt-1"},Fo=ve({__name:"PromptInput",props:{modelValue:{},search:{},placeholder:{default:"Type @ to insert variables or prompts..."},disabled:{type:Boolean,default:!1},maxLength:{},allowedTypes:{default:()=>["variable","prompt"]},editorClass:{}},emits:["update:modelValue","segment-click"],setup(t,{emit:o}){const a=t,i=o,l=p(),u=p(),s=ya({segments:a.modelValue&&a.modelValue.length?a.modelValue:[{type:"string",value:""}],dialogOpen:!1,dialogPosition:{x:0,y:0},searchQuery:"",searchResults:[],selectedIndex:0,isSearching:!1,atTriggerIndex:-1,isComposing:!1,ignoreNextWatch:!1}),m=()=>Math.random().toString(36).slice(2)+Date.now().toString(36),h=E=>E.type==="string"?"":`@${E.type==="variable"?E.label||E.value:E.label||E.id}`,x=()=>{const E=window.getSelection();if(!E||!E.rangeCount||!l.value)return null;const $=E.getRangeAt(0);let V=0;const te=Array.from(l.value.childNodes);for(let B=0;B<te.length;B++){const N=te[B];if(N===$.startContainer||N.contains?.($.startContainer)){if(N.nodeType===Node.TEXT_NODE)return{segmentIndex:V,offset:$.startOffset};if(N.nodeType===Node.ELEMENT_NODE&&N.classList?.contains("prompt-tag"))return{segmentIndex:V,offset:0}}(N.nodeType===Node.TEXT_NODE||N.nodeType===Node.ELEMENT_NODE&&N.classList?.contains("prompt-tag"))&&V++}return{segmentIndex:0,offset:0}},c=()=>{if(!l.value)return;const E=s.segments.map($=>{if($.type==="string")return($.value||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"<br>")||"";{const V=$._uid||($._uid=m()),te=h($),B=$.type==="variable"?{type:"variable",value:$.value,label:$.label,schema:$.schema,meta:$.meta}:{type:"prompt",id:$.id,label:$.label,schema:$.schema,meta:$.meta},N=encodeURIComponent(JSON.stringify(B)),F=$.type==="prompt"&&$.meta&&!$.meta.isValid,Y=F?'<span class="prompt-tag-warning" title="'+($.meta.validationMessage||"").replace(/"/g,""")+'">⚠️</span>':"";return`<span class="prompt-tag prompt-tag-clickable${F?" prompt-tag-invalid":""}" contenteditable="false" data-segment-uid="${V}" data-segment="${N}">${te}${Y}</span>`}}).join("");l.value.innerHTML=E||"<br>"},f=()=>{const E=[];for(const $ of s.segments)$.type==="string"&&E.length>0&&E[E.length-1].type==="string"?E[E.length-1].value+=$.value:E.push($);s.segments=E.length?E:[{type:"string",value:""}]},y=E=>{const $=E.dataset.segmentUid;let V=s.segments.find(te=>te._uid===$);if(!V){const te=E.dataset.segment;if(te)try{const B=JSON.parse(decodeURIComponent(te));B&&(B.type==="variable"||B.type==="prompt")&&(V=B.type==="variable"?{type:"variable",value:B.value,label:B.label,schema:B.schema,meta:B.meta,_uid:$}:{type:"prompt",id:B.id,label:B.label,schema:B.schema,meta:B.meta,_uid:$})}catch{}}return V||null},b=E=>{const $=E.target;if($.classList?.contains("prompt-tag")){const V=y($);V&&i("segment-click",V,E)}},v=E=>{if(s.isComposing)return;const $=E.target,V=[];let te="";const B=()=>{te.length>0&&(V.push({type:"string",value:te}),te="")},N=H=>{if(H.nodeType===Node.TEXT_NODE){const M=(H.textContent||"").replace(/\u00A0/g," ");te+=M;return}if(H.nodeType===Node.ELEMENT_NODE){const M=H;if(M.classList?.contains("prompt-tag")){B();const A=y(M);A&&V.push(A);return}if(M.tagName==="BR"){te+=`
|
|
2
|
-
`;return}const
|
|
3
|
-
`);return}},
|
|
4
|
-
`)}];
|
|
5
|
-
`)||R.length>s.searchQuery.length+5?g():(s.searchQuery=R,O(R))}else g()}else g()},k=async()=>{s.dialogOpen=!0,s.selectedIndex=0,await Le(),_()},g=()=>{s.dialogOpen=!1,s.searchResults=[],s.searchQuery="",s.atTriggerIndex=-1,s.isSearching=!1},_=()=>{if(!u.value||!l.value)return;const E=window.getSelection();if(!E||!E.rangeCount)return;const V=E.getRangeAt(0).getBoundingClientRect(),te=l.value.getBoundingClientRect();s.dialogPosition={x:V.left-te.left,y:V.bottom-te.top+4}};let L=null;const O=async E=>{if(!a.search){s.searchResults=[];return}L&&clearTimeout(L),s.isSearching=!0,L=setTimeout(async()=>{try{const $=await a.search(E);s.searchResults=($||[]).filter(V=>a.allowedTypes?.includes(V.type))}catch($){console.error("Search error:",$),s.searchResults=[]}finally{s.isSearching=!1}},200)},W=E=>E.type==="variable"?{type:"variable",value:E.value??E.id??"",label:E.label,schema:E.schema,_uid:m(),meta:E.meta}:{type:"prompt",id:E.id??E.value??"",label:E.label,schema:E.schema,_uid:m(),meta:E.meta},J=E=>{if(s.atTriggerIndex<0||!l.value)return;const $=window.getSelection();if(!$||!$.rangeCount)return;const V=$.getRangeAt(0);if(V.startContainer.nodeType!==Node.TEXT_NODE)return;const te=V.startContainer,B=te.data.slice(0,s.atTriggerIndex),N=te.data.slice(V.startOffset),F=document.createElement("span"),Y=W(E),R=Y.type==="prompt"&&Y.meta&&!Y.meta.isValid;F.className=`prompt-tag${R?" prompt-tag-invalid":""}`,F.setAttribute("contenteditable","false");const H=Y._uid||(Y._uid=m());F.dataset.segmentUid=H;const M=Y.type==="variable"?{type:"variable",value:Y.value,label:Y.label,schema:Y.schema}:{type:"prompt",id:Y.id,label:Y.label,schema:Y.schema};if(F.dataset.segment=encodeURIComponent(JSON.stringify(M)),F.textContent=h(Y),R){const ye=document.createElement("span");ye.className="prompt-tag-warning",ye.textContent="⚠️",ye.setAttribute("title",Y.meta.validationMessage||"Validation error"),F.appendChild(ye)}const ie=te.parentNode,A=document.createTextNode(N),pe=document.createTextNode(B);ie.insertBefore(pe,te),ie.insertBefore(F,te),ie.insertBefore(A,te),ie.removeChild(te),g(),v({target:l.value});const ce=window.getSelection();if(ce){const ye=document.createRange();ye.setStart(A,0),ye.collapse(!0),ce.removeAllRanges(),ce.addRange(ye)}l.value.focus()},z=E=>{if((E.key==="ArrowLeft"||E.key==="ArrowRight")&&setTimeout(()=>d(),0),s.dialogOpen)E.key==="ArrowDown"?(E.preventDefault(),s.selectedIndex=Math.min(s.selectedIndex+1,s.searchResults.length-1)):E.key==="ArrowUp"?(E.preventDefault(),s.selectedIndex=Math.max(s.selectedIndex-1,0)):E.key==="Enter"?(E.preventDefault(),s.searchResults[s.selectedIndex]&&J(s.searchResults[s.selectedIndex])):(E.key==="Escape"||E.key==="Esc")&&(E.preventDefault(),g());else if(E.key==="Backspace"||E.key==="Delete"){const $=x();if(E.key==="Backspace"){const V=window.getSelection();if(V&&V.rangeCount){const te=V.getRangeAt(0);if(te.collapsed&&te.startContainer.nodeType===Node.TEXT_NODE&&te.startOffset===0){let B=te.startContainer;for(;B&&B!==l.value;){const N=B.previousSibling;if(N&&N.nodeType===Node.ELEMENT_NODE&&N.classList?.contains("prompt-tag")){E.preventDefault(),N.parentNode?.removeChild(N),v({target:l.value});return}B=B.parentNode}}}}if(!$)return;if(E.key==="Backspace"&&$.offset===0&&$.segmentIndex>0)s.segments[$.segmentIndex-1].type!=="string"&&(E.preventDefault(),s.segments.splice($.segmentIndex-1,1),f(),ee(),c());else if(E.key==="Delete"&&$.segmentIndex<s.segments.length-1){const V=s.segments[$.segmentIndex];V.type==="string"&&(V.value?.length??0)===$.offset&&s.segments[$.segmentIndex+1].type!=="string"&&(E.preventDefault(),s.segments.splice($.segmentIndex+1,1),f(),ee(),c())}}},P=E=>{E.preventDefault();const $=E.clipboardData?.getData("text/plain")||"";document.execCommand("insertText",!1,$)},G=E=>{if(!s.dialogOpen)return;const $=u.value;$&&($.contains(E.target)||g())},ee=()=>{s.ignoreNextWatch=!0;const E=s.segments.map($=>{const{_uid:V,...te}=$||{};return te});i("update:modelValue",E)},ue=()=>{const E=window.getSelection();if(!E||!l.value)return;const $=E.anchorNode;$&&l.value.contains($)&&d()},me=E=>{(E.key==="Escape"||E.key==="Esc")&&s.dialogOpen&&(E.preventDefault(),g())};Pe(()=>{a.modelValue&&a.modelValue.length&&(s.segments=JSON.parse(JSON.stringify(a.modelValue))),c(),document.addEventListener("mousedown",G),document.addEventListener("selectionchange",ue),document.addEventListener("keydown",me,!0)}),Ye(()=>{document.removeEventListener("mousedown",G),document.removeEventListener("selectionchange",ue),document.removeEventListener("keydown",me,!0)}),ge(()=>a.modelValue,E=>{if(s.ignoreNextWatch){s.ignoreNextWatch=!1;return}E&&(s.segments=JSON.parse(JSON.stringify(E)),c())},{deep:!0});const Q=U(()=>{const E=["prompt-input-editor","min-h-[100px]",a.disabled?"opacity-50 cursor-not-allowed":""];return a.editorClass?[...E,a.editorClass,"!h-auto"]:[...E,"py-2 px-3","rounded-sm","border border-zinc-300 dark:border-zinc-700","bg-white dark:bg-transparent","text-sm text-zinc-700 dark:text-zinc-300","focus:outline-none focus:ring-1 focus:ring-accent-400 focus:border-accent-400"]});return(E,$)=>(r(),n("div",Vo,[e("div",{ref_key:"editorRef",ref:l,contenteditable:!t.disabled,onInput:v,onKeydown:z,onPaste:P,onClick:b,onKeyup:$[0]||($[0]=V=>{V.key==="Escape"?(V.preventDefault(),g()):(V.key==="ArrowLeft"||V.key==="ArrowRight")&&d()}),onCompositionstart:$[1]||($[1]=V=>s.isComposing=!0),onCompositionend:$[2]||($[2]=V=>s.isComposing=!1),class:ne(Q.value),"data-placeholder":t.placeholder},[Ae(e("div",null,[je(E.$slots,"segment",{segment:null},void 0,!0)],512),[[Ke,!1]])],42,Mo),s.dialogOpen?(r(),n("div",{key:0,ref_key:"dialogRef",ref:u,class:"absolute z-50",style:st({left:`${s.dialogPosition.x}px`,top:`${s.dialogPosition.y}px`})},[w(wt,{"offset-x":4,"offset-y":4,intensity:.3},{default:j(()=>[e("div",Eo,[s.isSearching?(r(),n("div",Lo," Searching... ")):s.searchResults.length===0?(r(),n("div",Po," No results found ")):(r(),n("div",Ao,[(r(!0),n(fe,null,ke(s.searchResults,(V,te)=>(r(),n("button",{key:V.id||V.value||te,type:"button",onClick:B=>J(V),class:ne(["w-full px-3 py-2 text-left text-sm","hover:bg-neutral-100 dark:hover:bg-neutral-900","focus:bg-neutral-100 dark:focus:bg-neutral-900 focus:outline-none",s.selectedIndex===te?"bg-neutral-100 dark:bg-neutral-900":""])},[e("div",Do,[X(C(V.label||V.id||V.value)+" ",1),V.type==="prompt"&&V.meta&&!V.meta.isValid?(r(),n("span",{key:0,title:V.meta.validationMessage,class:"text-red-500"},"⚠️",8,Oo)):T("",!0)]),V.description?(r(),n("div",Ro,C(V.description),1)):T("",!0),V.type==="prompt"&&V.meta&&!V.meta.isValid?(r(),n("div",Uo,C(V.meta.validationMessage),1)):T("",!0),e("div",Bo,[e("span",{class:ne(["inline-block px-1.5 py-0.5 rounded",V.type==="variable"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"bg-purple-100 dark:bg-purple-900 text-purple-700 dark:text-purple-300"])},C(V.type),3)])],10,jo))),128))]))])]),_:1})],4)):T("",!0)]))}}),Xe=(t,o)=>{const a=t.__vccOpts||t;for(const[i,l]of o)a[i]=l;return a},Gt=Xe(Fo,[["__scopeId","data-v-daddc895"]]),No=ve({__name:"PromptInputWrapper",props:{context:{}},emits:["segment-click"],setup(t,{emit:o}){const a=t,i=(b,v)=>{const d=a.context;return d[b]!==void 0?d[b]:d.attrs?.[b]!==void 0?d.attrs[b]:v},l=U(()=>a.context.classes??{}),u=U(()=>a.context._value??[]),s=b=>{a.context.node.input(b)},m=U(()=>i("search",void 0)),h=U(()=>i("placeholder","Type @ to insert variables or prompts...")),x=U(()=>i("maxLength",void 0)),c=U(()=>i("allowedTypes",["variable","prompt"])),f=U(()=>a.context.disabled??!1),y=(b,v)=>{const d=a.context;d.attrs?.["onSegment-click"]&&d.attrs["onSegment-click"](b,v)};return(b,v)=>(r(),q(Gt,{"model-value":u.value,search:m.value,placeholder:h.value,disabled:f.value,"max-length":x.value,"allowed-types":c.value,"editor-class":l.value.inner,"onUpdate:modelValue":s,onSegmentClick:y},null,8,["model-value","search","placeholder","disabled","max-length","allowed-types","editor-class"]))}}),qo={type:"input",family:"text",props:["search","placeholder","maxLength","allowedTypes"],schema:()=>[{$el:"label",if:"$label",attrs:{class:"$classes.label",for:"$id"},children:"$label"},{$el:"p",if:"$help",attrs:{class:"$classes.help"},children:"$help"},{$cmp:Te(No),props:{context:"$node.context"}}]},Ho={class:"inline-flex items-center justify-center"},Ee=ve({__name:"Loader",props:{size:{default:"md"}},setup(t){const o=t,a=U(()=>{switch(o.size){case"xs":return"w-3 h-3 border";case"sm":return"w-3.5 h-3.5 border";case"md":default:return"w-4 h-4 border-2"}});return(i,l)=>(r(),n("div",Ho,[e("div",{class:ne([a.value,"border-black/20 dark:border-white/20 border-t-black dark:border-t-white rounded-full animate-spin"])},null,2)]))}}),Wo=["type","disabled"],Ko="inline-flex items-center justify-center gap-2 font-medium rounded transition-all disabled:opacity-50 disabled:cursor-not-allowed",De=ve({__name:"UiButton",props:{variant:{default:"primary"},size:{default:"md"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},iconLeft:{},iconRight:{},fullWidth:{type:Boolean,default:!1},type:{default:"button"}},emits:["click"],setup(t,{emit:o}){const a=t,i=o,l=U(()=>{switch(a.variant){case"primary":return"bg-black text-white dark:bg-white dark:text-black hover:opacity-90";case"secondary":return"border-2 border-black dark:border-neutral-300 bg-white dark:bg-black text-black dark:text-white hover:bg-neutral-50 dark:hover:bg-neutral-900";case"ghost":return"border border-black dark:border-white hover:bg-black/5 dark:hover:bg-white/10";case"danger":return"border-2 border-red-600 bg-red-600 text-white hover:bg-red-700 hover:border-red-700";case"link":return"text-accent-600 dark:text-accent-400 hover:underline p-0";default:return""}}),u=U(()=>{if(a.variant==="link")return"text-sm";switch(a.size){case"xs":return"px-2 py-1 text-xs";case"sm":return"px-3 py-1.5 text-sm";case"md":return"px-4 py-2 text-sm";case"lg":return"px-6 py-3 text-base";default:return""}}),s=U(()=>a.size==="xs"||a.size==="sm"?"xs":"sm"),m=h=>{!a.disabled&&!a.loading&&i("click",h)};return(h,x)=>(r(),n("button",{type:t.type,disabled:t.disabled||t.loading,class:ne([Ko,l.value,u.value,t.fullWidth?"w-full":""]),onClick:m},[t.loading?(r(),q(Ee,{key:0,size:s.value},null,8,["size"])):t.iconLeft?(r(),q(Ue(t.iconLeft),{key:1,class:"w-4 h-4"})):T("",!0),je(h.$slots,"default"),t.iconRight&&!t.loading?(r(),q(Ue(t.iconRight),{key:2,class:"w-4 h-4"})):T("",!0)],10,Wo))}}),Jo=["disabled","aria-label","title"],Yo="inline-flex items-center justify-center rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed",Br=ve({__name:"UiIconButton",props:{icon:{},label:{},size:{default:"sm"},variant:{default:"default"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:o}){const a=t,i=o,l=U(()=>{switch(a.variant){case"default":return"hover:bg-black/10 dark:hover:bg-white/10";case"ghost":return"hover:bg-black/5 dark:hover:bg-white/5";case"danger":return"text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20";default:return""}}),u=U(()=>{switch(a.size){case"xs":return"p-0.5";case"sm":return"p-1";case"md":return"p-1.5";default:return""}}),s=U(()=>{switch(a.size){case"xs":return"w-3.5 h-3.5";case"sm":return"w-4 h-4";case"md":return"w-5 h-5";default:return""}}),m=h=>{!a.disabled&&!a.loading&&i("click",h)};return(h,x)=>(r(),n("button",{type:"button",disabled:t.disabled||t.loading,"aria-label":t.label,title:t.label,class:ne([Yo,l.value,u.value]),onClick:m},[t.loading?(r(),q(Ee,{key:0,size:"xs"})):(r(),q(Ue(t.icon),{key:1,class:ne(s.value)},null,8,["class"]))],10,Jo))}}),Go=["for"],Zo={key:0,class:"text-red-500 ml-0.5"},Fr=ve({__name:"UiLabel",props:{required:{type:Boolean,default:!1},htmlFor:{}},setup(t){return(o,a)=>(r(),n("label",{for:t.htmlFor,class:"block text-sm font-medium text-neutral-700 dark:text-neutral-300"},[je(o.$slots,"default"),t.required?(r(),n("span",Zo,"*")):T("",!0)],8,Go))}}),Xo={class:"text-xs text-red-500 dark:text-red-400"},tt=ve({__name:"UiErrorText",setup(t){return(o,a)=>(r(),n("p",Xo,[je(o.$slots,"default")]))}}),Qo={class:"text-xs text-neutral-500 dark:text-neutral-400"},Ie=ve({__name:"UiHelpText",setup(t){return(o,a)=>(r(),n("p",Qo,[je(o.$slots,"default")]))}}),en={class:"space-y-1.5"},ct=ve({__name:"UiFormField",props:{label:{},error:{},helpText:{},required:{type:Boolean,default:!1},htmlFor:{}},setup(t){return(o,a)=>(r(),n("div",en,[je(o.$slots,"label",{},()=>[t.label?(r(),q(Fr,{key:0,"html-for":t.htmlFor,required:t.required},{default:j(()=>[X(C(t.label),1)]),_:1},8,["html-for","required"])):T("",!0)]),je(o.$slots,"default"),je(o.$slots,"error",{},()=>[t.error?(r(),q(tt,{key:0},{default:j(()=>[X(C(t.error),1)]),_:1})):T("",!0)]),je(o.$slots,"help",{},()=>[t.helpText&&!t.error?(r(),q(Ie,{key:0},{default:j(()=>[X(C(t.helpText),1)]),_:1})):T("",!0)])]))}}),tn={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function rn(t,o){return r(),n("svg",tn,[...o[0]||(o[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const Pt=Te({name:"lucide-x",render:rn}),an={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function on(t,o){return r(),n("svg",an,[...o[0]||(o[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("circle",{cx:"12",cy:"12",r:"10"}),e("path",{d:"M12 16v-4m0-4h.01"})],-1)])])}Te({name:"lucide-info",render:on});const nn={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function ln(t,o){return r(),n("svg",nn,[...o[0]||(o[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("circle",{cx:"12",cy:"12",r:"10"}),e("path",{d:"m9 12l2 2l4-4"})],-1)])])}Te({name:"lucide-circle-check",render:ln});const sn={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function un(t,o){return r(),n("svg",sn,[...o[0]||(o[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m21.73 18l-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3M12 9v4m0 4h.01"},null,-1)])])}const ir=Te({name:"lucide-triangle-alert",render:un}),dn={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function cn(t,o){return r(),n("svg",dn,[...o[0]||(o[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("circle",{cx:"12",cy:"12",r:"10"}),e("path",{d:"m15 9l-6 6m0-6l6 6"})],-1)])])}Te({name:"lucide-circle-x",render:cn});const ft=ve({__name:"UiBadge",props:{variant:{default:"default"},size:{default:"sm"},pill:{type:Boolean,default:!1}},setup(t){const o=t,a=U(()=>{switch(o.variant){case"default":return"bg-neutral-100 dark:bg-neutral-800 text-neutral-700 dark:text-neutral-300";case"primary":return"bg-black dark:bg-white text-white dark:text-black";case"secondary":return"bg-neutral-200 dark:bg-neutral-700 text-neutral-600 dark:text-neutral-300";case"success":return"bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-300";case"warning":return"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-300";case"error":return"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300";case"accent":return"bg-accent-100 dark:bg-accent-900/30 text-accent-700 dark:text-accent-300";default:return""}}),i=U(()=>{switch(o.size){case"sm":return"px-2 py-0.5 text-xs";case"md":return"px-2.5 py-1 text-sm";default:return""}});return(l,u)=>(r(),n("span",{class:ne(["inline-flex items-center font-medium",a.value,i.value,t.pill?"rounded-full":"rounded"])},[je(l.$slots,"default")],2))}}),pn={key:0,class:"border-b border-neutral-200 dark:border-neutral-700"},mn={key:1,class:"border-t border-neutral-200 dark:border-neutral-700"},At=ve({__name:"UiDropdownPanel",props:{width:{},maxHeight:{},shadow:{type:[Boolean,Object],default:!0}},setup(t){const o=t,a=U(()=>o.shadow===!0?{offsetX:6,offsetY:6,intensity:.4}:o.shadow&&typeof o.shadow=="object"?o.shadow:null),i=U(()=>!!o.shadow),l=U(()=>["bg-white dark:bg-neutral-900 border border-neutral-300 dark:border-neutral-600 rounded-lg overflow-hidden",o.width]),u=U(()=>[o.maxHeight?"overflow-y-auto":"",o.maxHeight]);return(s,m)=>(r(),q(Ue(i.value?wt:"template"),ka(wa(i.value?a.value:{})),{default:j(()=>[e("div",{class:ne(l.value)},[s.$slots.header?(r(),n("div",pn,[je(s.$slots,"header")])):T("",!0),e("div",{class:ne(u.value)},[je(s.$slots,"default")],2),s.$slots.footer?(r(),n("div",mn,[je(s.$slots,"footer")])):T("",!0)],2)]),_:3},16))}}),vn={class:"flex items-start gap-3"},fn={class:"flex-1 text-sm"},Fe=ve({__name:"UiAlertBox",props:{variant:{default:"info"},showIcon:{type:Boolean,default:!0}},setup(t){const o=t,a=U(()=>{switch(o.variant){case"warning":return"bg-amber-50 dark:bg-amber-900/20 border-amber-200 dark:border-amber-800 text-amber-800 dark:text-amber-300";case"success":return"bg-emerald-50 dark:bg-emerald-900/20 border-emerald-200 dark:border-emerald-800 text-emerald-800 dark:text-emerald-300";case"error":return"bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800 text-red-800 dark:text-red-300";case"info":default:return"bg-neutral-50 dark:bg-neutral-900/50 border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300"}}),i=U(()=>{switch(o.variant){case"warning":return Sr;case"success":return $a;case"error":return _a;case"info":default:return Cr}}),l=U(()=>{switch(o.variant){case"warning":return"text-amber-500 dark:text-amber-400";case"success":return"text-emerald-500 dark:text-emerald-400";case"error":return"text-red-500 dark:text-red-400";case"info":default:return"text-neutral-500 dark:text-neutral-400"}});return(u,s)=>(r(),n("div",{class:ne(["px-4 py-3 border rounded-lg",a.value])},[e("div",vn,[t.showIcon?(r(),q(Ue(i.value),{key:0,class:ne(["w-5 h-5 mt-0.5 flex-shrink-0",l.value])},null,8,["class"])):T("",!0),e("div",fn,[je(u.$slots,"default")])])],2))}}),ur=ve({__name:"UiMenuItem",props:{active:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},as:{default:"button"}},emits:["click"],setup(t,{emit:o}){const a=t,i=o;function l(u){a.disabled||i("click",u)}return(u,s)=>(r(),q(Ue(t.as),{type:t.as==="button"?"button":void 0,disabled:t.as==="button"?t.disabled:void 0,onClick:l,class:ne(["w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition-colors",[t.disabled?"opacity-50 cursor-not-allowed":"hover:bg-neutral-100 dark:hover:bg-neutral-800 cursor-pointer",t.active?"bg-accent-50 dark:bg-accent-950/30":""]])},{default:j(()=>[je(u.$slots,"default")]),_:3},8,["type","disabled","class"]))}}),hn={class:"relative inline-flex group"},dr=ve({__name:"UiTooltip",props:{content:{},position:{default:"top"}},setup(t){const o=t,a=U(()=>{switch(o.position){case"bottom":return"top-full mt-2 left-1/2 -translate-x-1/2";case"left":return"right-full mr-2 top-1/2 -translate-y-1/2";case"right":return"left-full ml-2 top-1/2 -translate-y-1/2";case"top":default:return"bottom-full mb-2 left-1/2 -translate-x-1/2"}}),i=U(()=>{switch(o.position){case"bottom":return"bottom-full left-1/2 -translate-x-1/2 border-b-black dark:border-b-white border-t-transparent border-l-transparent border-r-transparent";case"left":return"left-full top-1/2 -translate-y-1/2 border-l-black dark:border-l-white border-t-transparent border-b-transparent border-r-transparent";case"right":return"right-full top-1/2 -translate-y-1/2 border-r-black dark:border-r-white border-t-transparent border-b-transparent border-l-transparent";case"top":default:return"top-full left-1/2 -translate-x-1/2 border-t-black dark:border-t-white border-b-transparent border-l-transparent border-r-transparent"}});return(l,u)=>(r(),n("div",hn,[je(l.$slots,"default"),e("div",{class:ne(["absolute z-50 px-3 py-2 text-xs whitespace-nowrap bg-black dark:bg-white text-white dark:text-black rounded opacity-0 invisible group-hover:opacity-100 group-hover:visible group-focus-within:opacity-100 group-focus-within:visible transition-opacity pointer-events-none",a.value]),role:"tooltip"},[X(C(t.content)+" ",1),e("div",{class:ne(["absolute border-4",i.value])},null,2)],2)]))}}),Nr=ve({__name:"UiCodeBlock",props:{inline:{type:Boolean,default:!0}},setup(t){return(o,a)=>(r(),q(Ue(t.inline?"code":"pre"),{class:ne(["font-mono text-xs bg-neutral-100 dark:bg-neutral-800 rounded",t.inline?"px-1.5 py-0.5":"px-3 py-2 overflow-x-auto"])},{default:j(()=>[je(o.$slots,"default")]),_:3},8,["class"]))}}),gn={key:0,class:"block text-zinc-700 dark:text-zinc-300 text-xs font-bold mb-1"},bn={key:0,class:"text-red-500"},xn=["disabled","aria-expanded"],yn={key:0,class:"flex items-center gap-2 text-zinc-400 flex-1 min-w-0"},kn=["src","alt"],wn={class:"block truncate"},_n={key:2,class:"block truncate text-zinc-400 flex-1 min-w-0"},$n=["placeholder"],Cn=["onClick","onMouseenter"],Sn=["src","alt"],Tn={key:1,class:"w-full h-full bg-zinc-200 dark:bg-zinc-700 rounded"},In={class:"flex-1 min-w-0"},Ge=ve({__name:"SelectInput",props:{modelValue:{},options:{},placeholder:{default:"Select an option"},searchPlaceholder:{default:"Search..."},label:{},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},error:{},required:{type:Boolean,default:!1},triggerClass:{},size:{default:"md"},activeHighlight:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:o}){const a=t,i=o,l=p(!1),u=p(""),s=p(),m=p(),h=p(),x=p(),c=p(-1),f=U(()=>a.options.find(G=>G.value===a.modelValue)),y=U(()=>{const G=a.activeHighlight&&f.value,ee=a.size==="sm"?"!text-xs !py-1 !px-2":"",ue=G?"!border-accent-500 !bg-accent-50 dark:!bg-accent-950/50 !text-accent-700 dark:!text-accent-300":"";return a.triggerClass?[a.triggerClass,"text-left cursor-pointer",ee,ue,a.error?"!border-red-500 dark:!border-red-400":""]:["w-full min-w-[200px] px-3 py-2 text-left rounded-lg focus:outline-none focus:ring-2 focus:ring-accent-500/30 bg-transparent disabled:opacity-50 disabled:cursor-not-allowed text-sm overflow-hidden transition-colors",ee,ue,a.error?"border border-red-500 dark:border-red-400 focus:border-red-500 dark:focus:border-red-400":"border border-zinc-200 dark:border-zinc-700 focus:border-accent-500 dark:focus:border-accent-400"]}),b=U(()=>{if(!u.value)return a.options;const G=u.value.toLowerCase();return a.options.filter(ee=>ee.label.toLowerCase().includes(G)||ee.value.toLowerCase().includes(G)||ee.description&&ee.description.toLowerCase().includes(G))});ge(b,()=>{c.value=-1});const v=()=>{a.disabled||(l.value?g():(l.value=!0,u.value="",c.value=-1,Le(()=>{if(x.value&&(x.value.setAttribute("popover","auto"),x.value.addEventListener("toggle",z),"showPopover"in x.value))try{x.value.showPopover()}catch{}_(),setTimeout(()=>s.value?.focus(),0)})))},d=G=>{i("update:modelValue",G.value),g(),u.value="",c.value=-1},k=G=>{G.stopPropagation(),i("update:modelValue","")},g=()=>{if(x.value){if("hidePopover"in x.value)try{x.value.hidePopover()}catch{}x.value.removeEventListener("toggle",z)}l.value=!1,c.value=-1},_=()=>{if(!h.value||!x.value)return;const G=h.value.getBoundingClientRect(),ee=window.innerWidth;x.value.style.position="fixed",x.value.style.top=`${G.bottom+8}px`,x.value.style.left=`${G.left}px`,x.value.style.margin="0",x.value.style.width="max-content";const ue=x.value.offsetWidth,me=G.width,Q=Math.min(400,ee-G.left-16),E=Math.max(me,Math.min(ue,Q));x.value.style.width=`${E}px`},L=G=>{m.value&&!m.value.contains(G.target)&&x.value&&!x.value.contains(G.target)&&g()},O=G=>{G.key==="Escape"&&l.value&&(g(),h.value?.focus())},W=G=>{if(!l.value)return;const ee=b.value;if(ee.length!==0)switch(G.key){case"ArrowDown":G.preventDefault(),c.value=c.value<ee.length-1?c.value+1:0,J();break;case"ArrowUp":G.preventDefault(),c.value=c.value>0?c.value-1:ee.length-1,J();break;case"Enter":G.preventDefault(),c.value>=0&&c.value<ee.length&&d(ee[c.value]);break}},J=()=>{Le(()=>{const G=x.value?.querySelector(".highlighted-option");G&&G.scrollIntoView({block:"nearest",behavior:"smooth"})})},z=G=>{G.target===x.value&&(l.value=G.newState==="open",l.value&&_())},P=()=>{l.value&&_()};return Pe(()=>{document.addEventListener("click",L),document.addEventListener("keydown",O),window.addEventListener("resize",P),window.addEventListener("scroll",P,!0)}),Ye(()=>{document.removeEventListener("click",L),document.removeEventListener("keydown",O),window.removeEventListener("resize",P),window.removeEventListener("scroll",P,!0)}),(G,ee)=>(r(),n("div",{ref_key:"dropdownRef",ref:m,class:"relative"},[t.label?(r(),n("label",gn,[X(C(t.label)+" ",1),t.required?(r(),n("span",bn,"*")):T("",!0)])):T("",!0),e("button",{ref_key:"buttonRef",ref:h,type:"button",onClick:v,disabled:t.disabled,"aria-expanded":l.value,"aria-haspopup":!0,class:ne(y.value)},[e("div",{class:ne(["flex items-center gap-1 w-full",t.size==="sm"?"min-h-[1.25em]":"min-h-[1.5em]"])},[t.loading?(r(),n("span",yn,[w(Ee,{size:"xs"}),ee[1]||(ee[1]=X(" Loading... ",-1))])):f.value?(r(),n("span",{key:1,class:ne(["flex items-center flex-1 min-w-0",t.size==="sm"?"gap-1.5":"gap-2"])},[f.value.icon?(r(),n("img",{key:0,src:f.value.icon,alt:f.value.label,class:ne(["flex-shrink-0",[t.size==="sm"?"w-4 h-4":"w-5 h-5",f.value.icon.startsWith("data:image/svg+xml")?"dark:invert":""]])},null,10,kn)):T("",!0),e("span",wn,C(f.value.label),1)],2)):(r(),n("span",_n,C(t.placeholder),1)),f.value&&!t.disabled?(r(),n("button",{key:3,type:"button",onClick:k,class:"flex-shrink-0 p-0.5 hover:bg-zinc-100 dark:hover:bg-zinc-800 rounded transition-colors","aria-label":"Clear selection"},[(r(),n("svg",{class:ne(["text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300",t.size==="sm"?"h-3 w-3":"h-4 w-4"]),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},[...ee[2]||(ee[2]=[e("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"},null,-1)])],2))])):T("",!0),(r(),n("svg",{class:ne(["text-zinc-400 flex-shrink-0",t.size==="sm"?"h-3.5 w-3.5":"h-5 w-5"]),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},[...ee[3]||(ee[3]=[e("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"},null,-1)])],2))],2)],10,xn),l.value?(r(),n("div",{key:1,ref_key:"popoverRef",ref:x,class:"dropdown-popover z-[9999]"},[w(S(At),{"max-height":t.size==="sm"?"max-h-48":"max-h-60",shadow:{offsetX:4,offsetY:4,intensity:.3}},{header:j(()=>[e("div",{class:ne(t.size==="sm"?"p-1.5":"p-2")},[Ae(e("input",{ref_key:"searchInput",ref:s,"onUpdate:modelValue":ee[0]||(ee[0]=ue=>u.value=ue),type:"text",placeholder:t.searchPlaceholder,onKeydown:W,class:ne(["w-full border border-zinc-300 dark:border-zinc-600 rounded-sm focus:outline-none focus:ring-1 focus:ring-accent-400 focus:border-accent-400 bg-transparent text-zinc-700 dark:text-zinc-200 placeholder:text-zinc-400 dark:placeholder:text-zinc-500",t.size==="sm"?"px-2 py-1 text-xs":"px-3 py-1.5 text-sm"])},null,42,$n),[[Qe,u.value]])],2)]),default:j(()=>[b.value.length===0?(r(),n("div",{key:0,class:ne(["text-zinc-500 dark:text-zinc-400",t.size==="sm"?"px-3 py-2 text-xs":"px-4 py-3 text-sm"])}," No options found ",2)):T("",!0),(r(!0),n(fe,null,ke(b.value,(ue,me)=>(r(),n("button",{key:ue.value,type:"button",onClick:Q=>d(ue),onMouseenter:Q=>c.value=me,class:ne(["w-full text-left hover:bg-zinc-100 dark:hover:bg-zinc-800 focus:bg-zinc-100 dark:focus:bg-zinc-800 focus:outline-none flex items-start",[t.size==="sm"?"px-2.5 py-1.5 gap-2":"px-4 py-2 gap-3",{"bg-zinc-50 dark:bg-zinc-900":ue.value===t.modelValue,"bg-zinc-100 dark:bg-zinc-800 highlighted-option":me===c.value}]])},[e("div",{class:ne(["flex-shrink-0 mt-0.5",t.size==="sm"?"w-4 h-4":"w-5 h-5"])},[ue.icon?(r(),n("img",{key:0,src:ue.icon,alt:ue.label,class:ne(["w-full h-full",ue.icon.startsWith("data:image/svg+xml")?"dark:invert":""])},null,10,Sn)):(r(),n("div",Tn))],2),e("div",In,[e("div",{class:ne(["font-medium text-black dark:text-white",t.size==="sm"?"text-xs":"text-sm"])},C(ue.label),3),ue.description?(r(),n("div",{key:0,class:ne(["text-zinc-500 dark:text-zinc-400 mt-0.5",t.size==="sm"?"text-[10px]":"text-xs"])},C(ue.description),3)):T("",!0)])],42,Cn))),128))]),_:1},8,["max-height"])],512)):T("",!0),t.error?(r(),q(S(tt),{key:2,class:"mt-1"},{default:j(()=>[X(C(t.error),1)]),_:1})):T("",!0)],512))}}),zn=["type","value","placeholder","disabled"],lt=ve({__name:"TextInput",props:{modelValue:{},label:{},placeholder:{},type:{default:"text"},error:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","focus","click"],setup(t,{expose:o,emit:a}){const i=t,l=a,u=p(null),s=U(()=>["w-full px-3 py-2.5 bg-neutral-50 dark:bg-neutral-950 border rounded-md text-sm","focus:outline-none focus:ring-2 focus:ring-neutral-400 dark:focus:ring-neutral-500 focus:border-transparent","transition-colors placeholder:text-neutral-400 dark:placeholder:text-neutral-500",i.error?"border-red-500 dark:border-red-400":"border-neutral-300 dark:border-neutral-800",i.disabled?"opacity-50 cursor-not-allowed":""]),m=c=>{const f=c.target;l("update:modelValue",f.value)},h=c=>{l("focus",c)},x=c=>{l("click",c)};return o({inputRef:u}),(c,f)=>(r(),q(S(ct),{label:t.label,error:t.error,required:t.required},{default:j(()=>[e("input",{ref_key:"inputRef",ref:u,type:t.type,value:t.modelValue,placeholder:t.placeholder,disabled:t.disabled,class:ne(s.value),onInput:m,onFocus:h,onClick:x},null,42,zn)]),_:1},8,["label","error","required"]))}}),Vn=["data-property-id","data-nested-property-id"],Mn={class:"p-3 space-y-3"},En={class:"flex items-start gap-2"},Ln={key:0,class:"drag-handle cursor-move text-neutral-400 hover:text-neutral-600 dark:text-neutral-600 dark:hover:text-neutral-400 mt-2"},Pn={class:"flex-1 grid grid-cols-1 md:grid-cols-3 gap-2"},An={class:"flex items-center gap-2 mt-2"},jn=["disabled"],Dn={key:0},On={key:0,class:"p-3 bg-neutral-50 dark:bg-neutral-900 rounded-lg space-y-2"},Rn={class:"flex items-center justify-between mb-2"},Un=["disabled"],Bn={key:0,class:"space-y-1"},Fn=["onClick","disabled"],Nn={key:1,class:"p-3 bg-neutral-50 dark:bg-neutral-900 rounded-lg"},qn={class:"text-xs font-medium text-neutral-600 dark:text-neutral-400 mb-2"},Hn={class:"space-y-2"},Wn={class:"flex items-center justify-between"},Kn=["disabled"],Jn={class:"space-y-2"},Yn={key:2,class:"p-3 bg-neutral-50 dark:bg-neutral-900 rounded-lg"},Gn={key:0,class:"mb-2"},Zn=["disabled"],Xn={key:1,class:"space-y-2"},Qn=ve({__name:"PropertyEditor",props:Ze({propertyId:{},isNested:{type:Boolean,default:!1},parentId:{},disabled:{type:Boolean,default:!1},enableDrag:{type:Boolean,default:!0}},{modelValue:{required:!0},modelModifiers:{}}),emits:Ze(["remove","description-keydown","add-top-level"],["update:modelValue"]),setup(t,{emit:o}){const a=t,i=o,l=it(t,"modelValue"),u=p(["object","array","enum","anyOf"].includes(l.value.type));p();const s=[{value:"string",label:"String",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z'/%3E%3C/svg%3E"},{value:"number",label:"Number",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M7 20l4-16m2 16l4-16M6 9h14M4 15h14'/%3E%3C/svg%3E"},{value:"boolean",label:"Boolean",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z'/%3E%3C/svg%3E"},{value:"object",label:"Object",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10'/%3E%3C/svg%3E"},{value:"array",label:"Array",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 6h16M4 10h16M4 14h16M4 18h16'/%3E%3C/svg%3E"},{value:"enum",label:"Enum",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4'/%3E%3C/svg%3E"},{value:"anyOf",label:"Any Of (Multiple Types)",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z'/%3E%3C/svg%3E"}],m=U(()=>["object","array","enum","anyOf"].includes(l.value.type));ge(()=>l.value.type,async(v,d)=>{if(["object","array","enum","anyOf"].includes(v)&&(u.value=!0,v==="anyOf"&&!l.value.anyOf&&(l.value.anyOf=[]),v==="object"&&!l.value.properties&&(l.value.properties=[{id:crypto.randomUUID(),name:"property1",type:"string",description:""}]),v==="array"&&!l.value.items&&(l.value.items={id:crypto.randomUUID(),name:"",type:"string",description:""}),v==="enum"&&!l.value.enum&&(l.value.enum=["value1"])),d!==void 0){await Le();const k=a.isNested?`[data-nested-property-id="${a.propertyId}"] input[placeholder="Description"]`:`[data-property-id="${a.propertyId}"] input[placeholder="Description"]`,g=document.querySelector(k);g&&g.focus()}},{immediate:!0,flush:"sync"});const h=v=>{v.shiftKey&&l.value.type==="object"&&l.value.properties?y():i("add-top-level")},x=()=>{l.value.items||(l.value.items={id:crypto.randomUUID(),name:"",type:"string",description:""})},c=()=>{l.value.enum||(l.value.enum=[]),l.value.enum.push(`value${l.value.enum.length+1}`)},f=v=>{l.value.enum&&l.value.enum.splice(v,1)},y=async()=>{const v={id:crypto.randomUUID(),name:l.value.type==="anyOf"?"":`property${(l.value.properties?.length||l.value.anyOf?.length||0)+1}`,type:"string",description:""};l.value.type==="anyOf"?(l.value.anyOf||(l.value.anyOf=[]),l.value.anyOf.push(v)):(l.value.properties||(l.value.properties=[]),l.value.properties.push(v)),await Le();const d=document.querySelector(`[data-nested-property-id="${v.id}"] input[placeholder="Property name"]`);d&&(d.focus(),d.select())},b=v=>{l.value.type==="anyOf"&&l.value.anyOf?l.value.anyOf=l.value.anyOf.filter(d=>d.id!==v):l.value.properties&&(l.value.properties=l.value.properties.filter(d=>d.id!==v))};return(v,d)=>{const k=Be("PropertyEditor",!0);return r(),n("div",{"data-property-id":t.isNested?void 0:t.propertyId,"data-nested-property-id":t.isNested?t.propertyId:void 0,class:ne(["border rounded-lg",t.isNested?"border-neutral-100 dark:border-neutral-900":"border-neutral-200 dark:border-neutral-800"])},[e("div",Mn,[e("div",En,[t.enableDrag?(r(),n("div",Ln,[...d[10]||(d[10]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 8h16M4 16h16"})],-1)])])):T("",!0),e("div",Pn,[w(lt,{modelValue:l.value.name,"onUpdate:modelValue":d[0]||(d[0]=g=>l.value.name=g),placeholder:"Property name",disabled:t.disabled},null,8,["modelValue","disabled"]),w(Ge,{modelValue:l.value.type,"onUpdate:modelValue":d[1]||(d[1]=g=>l.value.type=g),options:s,disabled:t.disabled},null,8,["modelValue","disabled"]),w(lt,{modelValue:l.value.description,"onUpdate:modelValue":d[2]||(d[2]=g=>l.value.description=g),placeholder:"Description",disabled:t.disabled,onKeydown:d[3]||(d[3]=Ca(Re(g=>h(g),["prevent"]),["enter"]))},null,8,["modelValue","disabled"])]),e("div",An,[m.value?(r(),n("button",{key:0,onClick:d[4]||(d[4]=g=>u.value=!u.value),type:"button",class:"p-1 hover:bg-neutral-100 dark:hover:bg-neutral-800 rounded transition-colors"},[(r(),n("svg",{class:ne(["w-4 h-4 transition-transform",u.value?"rotate-90":""]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...d[11]||(d[11]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"},null,-1)])],2))])):T("",!0),e("button",{onClick:d[5]||(d[5]=g=>v.$emit("remove")),type:"button",disabled:t.disabled,class:"p-1 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded transition-colors disabled:opacity-50"},[...d[12]||(d[12]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,jn)])]),u.value&&m.value?(r(),n("div",Dn,[l.value.type==="enum"?(r(),n("div",On,[e("div",Rn,[d[13]||(d[13]=e("h4",{class:"text-xs font-medium text-neutral-600 dark:text-neutral-400"}," Enum Values ",-1)),e("button",{onClick:c,type:"button",disabled:t.disabled,class:"px-2 py-0.5 text-xs bg-neutral-800 dark:bg-neutral-200 text-white dark:text-black rounded hover:bg-neutral-700 dark:hover:bg-neutral-300 transition-colors disabled:opacity-50"}," Add Value ",8,Un)]),l.value.enum?(r(),n("div",Bn,[(r(!0),n(fe,null,ke(l.value.enum,(g,_)=>(r(),n("div",{key:_,class:"flex items-center gap-2"},[w(lt,{modelValue:l.value.enum[_],"onUpdate:modelValue":L=>l.value.enum[_]=L,placeholder:"Enum value",disabled:t.disabled,class:"flex-1"},null,8,["modelValue","onUpdate:modelValue","disabled"]),e("button",{onClick:L=>f(_),type:"button",disabled:t.disabled,class:"p-1 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded transition-colors disabled:opacity-50"},[...d[14]||(d[14]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,Fn)]))),128))])):T("",!0)])):T("",!0),l.value.type==="object"||l.value.type==="anyOf"?(r(),n("div",Nn,[e("h4",qn,C(l.value.type==="anyOf"?"Type Options":"Nested Properties"),1),e("div",Hn,[e("div",Wn,[e("button",{onClick:y,type:"button",disabled:t.disabled,class:"px-2 py-0.5 text-xs bg-neutral-800 dark:bg-neutral-200 text-white dark:text-black rounded hover:bg-neutral-700 dark:hover:bg-neutral-300 transition-colors disabled:opacity-50"}," Add "+C(l.value.type==="anyOf"?"Type Option":"Property"),9,Kn)]),e("div",Jn,[(r(!0),n(fe,null,ke(l.value.type==="anyOf"?l.value.anyOf:l.value.properties,(g,_)=>(r(),q(k,{key:g.id,modelValue:(l.value.type==="anyOf"?l.value.anyOf:l.value.properties)[_],"onUpdate:modelValue":L=>(l.value.type==="anyOf"?l.value.anyOf:l.value.properties)[_]=L,"property-id":g.id,"is-nested":!0,"parent-id":t.propertyId,disabled:t.disabled,"enable-drag":!1,onRemove:L=>b(g.id),onAddTopLevel:d[6]||(d[6]=L=>i("add-top-level"))},null,8,["modelValue","onUpdate:modelValue","property-id","parent-id","disabled","onRemove"]))),128))])])])):T("",!0),l.value.type==="array"?(r(),n("div",Yn,[d[15]||(d[15]=e("h4",{class:"text-xs font-medium text-neutral-600 dark:text-neutral-400 mb-2"}," Array Item Type ",-1)),l.value.items?T("",!0):(r(),n("div",Gn,[e("button",{onClick:x,type:"button",disabled:t.disabled,class:"px-2 py-0.5 text-xs bg-neutral-800 dark:bg-neutral-200 text-white dark:text-black rounded hover:bg-neutral-700 dark:hover:bg-neutral-300 transition-colors disabled:opacity-50"}," Define Item Type ",8,Zn)])),l.value.items?(r(),n("div",Xn,[(r(),q(k,{key:`${l.value.items.id}-${l.value.items.type}`,modelValue:l.value.items,"onUpdate:modelValue":d[7]||(d[7]=g=>l.value.items=g),"property-id":l.value.items.id,"is-nested":!0,"parent-id":t.propertyId,disabled:t.disabled,"enable-drag":!1,onRemove:d[8]||(d[8]=g=>l.value.items=null),onAddTopLevel:d[9]||(d[9]=g=>i("add-top-level"))},null,8,["modelValue","property-id","parent-id","disabled"]))])):T("",!0)])):T("",!0)])):T("",!0)])],10,Vn)}}}),el={class:"space-y-2"},tl=["disabled"],rl=ve({__name:"PropertyList",props:Ze({disabled:{type:Boolean,default:!1},parentId:{},isNested:{type:Boolean,default:!1}},{modelValue:{required:!0,default:()=>[]},modelModifiers:{}}),emits:Ze(["add-property","description-keydown"],["update:modelValue"]),setup(t,{expose:o,emit:a}){const i=t,l=a,u=it(t,"modelValue"),s=p();let m=!1;Pe(async()=>{}),Ye(()=>{});const h=async()=>{if(m)return;m=!0;const c={id:crypto.randomUUID(),name:`property${u.value.length+1}`,type:"string",description:"",required:!1};u.value=[...u.value,c],await Le();const f=i.parentId?`[data-nested-property-id="${c.id}"]`:`[data-property-id="${c.id}"]`,y=document.querySelector(`${f} input[placeholder="Property name"]`);y&&(y.focus(),y.select()),l("add-property"),m=!1},x=c=>{u.value=u.value.filter(f=>f.id!==c)};return o({addProperty:h}),(c,f)=>(r(),n("div",el,[e("div",{ref_key:"dragAreaRef",ref:s,class:"space-y-2"},[(r(!0),n(fe,null,ke(u.value,y=>(r(),q(Qn,{key:y.id,modelValue:u.value[u.value.indexOf(y)],"onUpdate:modelValue":b=>u.value[u.value.indexOf(y)]=b,"property-id":y.id,"is-nested":t.isNested,"parent-id":t.parentId,disabled:t.disabled,"enable-drag":!t.isNested,onRemove:b=>x(y.id),onAddTopLevel:f[0]||(f[0]=b=>c.$emit("add-property"))},null,8,["modelValue","onUpdate:modelValue","property-id","is-nested","parent-id","disabled","enable-drag","onRemove"]))),128))],512),e("div",{class:ne(t.isNested?"mt-2":"mt-3 pt-3 border-t border-neutral-200 dark:border-neutral-800")},[e("button",{onClick:h,type:"button",disabled:t.disabled,class:ne(t.isNested?"px-2 py-1 text-xs bg-neutral-800 dark:bg-neutral-200 text-white dark:text-black rounded hover:bg-neutral-700 dark:hover:bg-neutral-300 transition-colors disabled:opacity-50":"w-full px-3 py-2 text-sm bg-neutral-50 dark:bg-neutral-900 hover:bg-neutral-100 dark:hover:bg-neutral-800 text-neutral-700 dark:text-neutral-300 rounded transition-colors disabled:opacity-50 border border-dashed border-neutral-300 dark:border-neutral-700")},[...f[1]||(f[1]=[e("span",{class:"flex items-center justify-center gap-2"},[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})]),X(" Add Property ")],-1)])],10,tl)],2)]))}}),al={class:"space-y-4"},ol={key:0,class:"flex items-center justify-between"},nl={class:"text-sm font-medium"},ll={key:0,class:"text-red-500"},sl={class:"space-y-2 border border-neutral-200 dark:border-neutral-800 rounded-lg p-4"},il={key:0,class:"flex items-center justify-between mb-2"},ul={key:1,class:"text-center py-12"},dl=["disabled"],cl={class:"mt-4 text-center"},pl={key:3,class:"mt-4"},ml={class:"bg-neutral-50 dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-800 rounded-lg p-4 overflow-x-auto"},vl={class:"text-xs leading-relaxed"},fl=["innerHTML"],qr=ve({__name:"JSONSchemaInput",props:Ze({label:{},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1}},{modelValue:{required:!0,default:()=>({type:"object",properties:{},required:[]})},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const o=it(t,"modelValue"),a=p([]),i=p(),l=p(!1),u=()=>{if(o.value?.properties){const v=[];o.value.required;for(const[d,k]of Object.entries(o.value.properties)){const g=k,_={id:crypto.randomUUID(),name:d,type:g.type||"string",description:g.description||""};g.enum&&(_.enum=g.enum),g.anyOf&&(_.type="anyOf",_.anyOf=s(g.anyOf)),g.type==="array"&&g.items&&(_.items=m(g.items)),g.type==="object"&&g.properties&&(_.properties=h(g.properties,g.required||[])),v.push(_)}a.value=v}},s=v=>v.map(d=>typeof d=="object"&&d.type?{id:crypto.randomUUID(),name:"",type:d.type,description:d.description||"",properties:d.properties?h(d.properties,d.required||[]):void 0,items:d.items?m(d.items):void 0,enum:d.enum}:{id:crypto.randomUUID(),name:"",type:"string",description:""}),m=v=>{const d={id:crypto.randomUUID(),name:"",type:v.type||"string",description:v.description||""};return v.enum&&(d.enum=v.enum),v.anyOf&&(d.type="anyOf",d.anyOf=s(v.anyOf)),v.type==="array"&&v.items&&(d.items=m(v.items)),v.type==="object"&&v.properties&&(d.properties=h(v.properties,v.required||[])),d},h=(v,d)=>{const k=[];for(const[g,_]of Object.entries(v)){const L=_,O={id:crypto.randomUUID(),name:g,type:L.type||"string",description:L.description||""};L.enum&&(O.enum=L.enum),L.anyOf&&(O.type="anyOf",O.anyOf=s(L.anyOf)),L.type==="array"&&L.items&&(O.items=m(L.items)),L.type==="object"&&L.properties&&(O.properties=h(L.properties,L.required||[])),k.push(O)}return k};u();const x=()=>{const v={type:"object",properties:{},required:[],additionalProperties:!1},{properties:d}=f(a.value);v.properties=d,v.required=Object.keys(d),o.value=v},c=v=>{const d={type:v.type==="anyOf"?void 0:v.type,description:v.description};if(v.type==="enum"&&v.enum&&(d.enum=v.enum,d.type="string"),v.type==="anyOf"&&v.anyOf&&(delete d.type,d.anyOf=v.anyOf.map(c)),v.type==="object"&&v.properties){const{properties:k}=f(v.properties);d.properties=k,d.required=Object.keys(k),d.additionalProperties=!1}return v.type==="array"&&v.items&&(d.items=c(v.items)),d},f=v=>{const d={},k=[];for(const g of v){const _={type:g.type==="anyOf"?void 0:g.type,description:g.description};if(k.push(g.name),g.type==="enum"&&g.enum&&(_.enum=g.enum,_.type="string"),g.type==="anyOf"&&g.anyOf&&g.anyOf.length>0&&(delete _.type,_.anyOf=g.anyOf.map(c)),g.type==="array"&&g.items&&(_.items=c(g.items)),g.type==="object"&&g.properties){const{properties:L}=f(g.properties);_.properties=L,_.required=Object.keys(L),_.additionalProperties=!1}d[g.name]=_}return{properties:d,required:k}};ge(a,()=>{x()},{deep:!0}),x();const y=U(()=>JSON.stringify(o.value,null,2).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"([^"]+)":/g,'<span class="text-blue-600 dark:text-blue-400">"$1"</span>:').replace(/:"([^"]*)"/g,':<span class="text-green-600 dark:text-green-400">"$1"</span>').replace(/:(\d+)/g,':<span class="text-yellow-600 dark:text-yellow-400">$1</span>').replace(/:(true|false)/g,':<span class="text-purple-600 dark:text-purple-400">$1</span>').replace(/:(null)/g,':<span class="text-red-600 dark:text-red-400">$1</span>')),b=async()=>{if(a.value.length===0){const v={id:crypto.randomUUID(),name:"property1",type:"string",description:""};a.value.push(v),await Le();const d=document.querySelector(`[data-property-id="${v.id}"] input[placeholder="Property name"]`);d&&(d.focus(),d.select())}else i.value&&i.value.addProperty()};return(v,d)=>(r(),n("div",al,[t.label?(r(),n("div",ol,[e("label",nl,[X(C(t.label)+" ",1),t.required?(r(),n("span",ll,"*")):T("",!0)])])):T("",!0),e("div",sl,[a.value.length>0?(r(),n("div",il,[...d[2]||(d[2]=[e("h3",{class:"text-sm font-medium text-neutral-700 dark:text-neutral-300"}," Properties ",-1)])])):T("",!0),a.value.length===0?(r(),n("div",ul,[d[4]||(d[4]=e("div",{class:"mb-4"},[e("svg",{class:"w-12 h-12 mx-auto text-neutral-400 dark:text-neutral-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})])],-1)),d[5]||(d[5]=e("p",{class:"text-neutral-500 dark:text-neutral-400 text-sm mb-4"}," No properties defined ",-1)),e("button",{onClick:b,type:"button",disabled:t.disabled,class:"px-4 py-2 bg-black dark:bg-white text-white dark:text-black rounded hover:bg-neutral-800 dark:hover:bg-neutral-200 transition-colors disabled:opacity-50 font-medium text-sm"},[...d[3]||(d[3]=[e("span",{class:"flex items-center gap-2"},[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})]),X(" Add Property ")],-1)])],8,dl)])):T("",!0),a.value.length>0?(r(),q(rl,{key:2,ref_key:"propertyListRef",ref:i,modelValue:a.value,"onUpdate:modelValue":d[0]||(d[0]=k=>a.value=k),disabled:t.disabled,onAddProperty:b},null,8,["modelValue","disabled"])):T("",!0),e("div",cl,[e("button",{onClick:d[1]||(d[1]=k=>l.value=!l.value),type:"button",class:"text-xs text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-neutral-100 hover:underline transition-colors"},C(l.value?"Hide":"Show")+" JSON Schema ",1)]),l.value?(r(),n("div",pl,[e("div",ml,[e("pre",vl,[e("code",{class:"font-mono",innerHTML:y.value},null,8,fl)])])])):T("",!0)])]))}}),hl=gt(Te(qr),{props:["label","disabled","required"],family:"text",features:[]}),gl={class:"space-y-2"},bl={key:0,class:"space-y-2"},xl={key:0,class:"block text-sm font-medium"},yl={key:0,class:"text-red-500"},kl=["src","alt"],wl={class:"flex-1 text-sm"},_l={key:0,class:"text-xs text-neutral-500 dark:text-neutral-400 ml-1"},$l=["onClick","aria-label"],ht=ve({__name:"MultipleSelectionsInput",props:Ze({label:{},placeholder:{default:"Select an option"},searchPlaceholder:{default:"Search..."},error:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},options:{},addLabel:{default:"Add another"},loading:{type:Boolean,default:!1}},{modelValue:{required:!0,default:()=>[]},modelModifiers:{}}),emits:Ze(["removeItem"],["update:modelValue"]),setup(t,{emit:o}){const a=t,i=o,l=it(t,"modelValue"),u=p();Tr(async()=>{u.value,await Le(),await Ir({parent:u,values:l,dragHandle:".drag-handle"})});const s=U(()=>Array.isArray(l.value)?l.value.length>0&&typeof l.value[0]=="object"?l.value:l.value.map(c=>{const f=a.options.find(y=>y.value===c);return{id:c,label:f?.label||c,description:f?.description,icon:f?.icon}}):[]),m=U(()=>{const c=s.value.map(f=>f.id);return a.options.filter(f=>!c.includes(f.value))}),h=c=>{if(!c)return;const f=a.options.find(y=>y.value===c);if(f)if(l.value.length===0||typeof l.value[0]=="string")l.value=[...l.value,c];else{const y={id:c,label:f.label,description:f.description,icon:f.icon};l.value=[...l.value,y]}},x=c=>{typeof l.value[0]=="string"?l.value=l.value.filter(f=>f!==c):l.value=l.value.filter(f=>f.id!==c),i("removeItem",c)};return(c,f)=>(r(),n("div",gl,[s.value.length>0?(r(),n("div",bl,[t.label?(r(),n("label",xl,[X(C(t.label)+" ",1),t.required?(r(),n("span",yl,"*")):T("",!0)])):T("",!0),e("div",{class:"space-y-1",ref_key:"dragAreaRef",ref:u},[(r(!0),n(fe,null,ke(s.value,y=>(r(),n("div",{key:y.id,class:ne(["flex items-center gap-2 px-3 py-2 bg-neutral-50 dark:bg-neutral-900 rounded border","border-neutral-200 dark:border-neutral-800",t.disabled?"opacity-50":""])},[f[1]||(f[1]=e("div",{class:"drag-handle cursor-move text-neutral-400 hover:text-neutral-600 dark:text-neutral-600 dark:hover:text-neutral-400"},[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 8h16M4 16h16"})])],-1)),y.icon?(r(),n("img",{key:0,src:y.icon,alt:y.label,class:"w-4 h-4 flex-shrink-0"},null,8,kl)):T("",!0),e("span",wl,[X(C(y.label)+" ",1),y.description?(r(),n("span",_l," ("+C(y.description)+") ",1)):T("",!0)]),t.disabled?T("",!0):(r(),n("button",{key:1,onClick:b=>x(y.id),type:"button",class:"p-1 hover:bg-neutral-200 dark:hover:bg-neutral-800 rounded transition-colors","aria-label":`Remove ${y.label}`},[...f[0]||(f[0]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,$l))],2))),128))],512)])):T("",!0),w(Ge,{"model-value":"","onUpdate:modelValue":h,label:s.value.length>0?t.addLabel:t.label,options:m.value,placeholder:t.placeholder,"search-placeholder":t.searchPlaceholder,disabled:t.disabled||m.value.length===0,loading:t.loading},null,8,["label","options","placeholder","search-placeholder","disabled","loading"]),t.error?(r(),q(S(tt),{key:1},{default:j(()=>[X(C(t.error),1)]),_:1})):T("",!0)]))}});function Cl(){return window.__AGENTBUILDER_CONFIG__||{mountPoint:"/agentbuilder"}}function _t(){return Cl().mountPoint}function he(t){const o=_t(),a=t.startsWith("/")?t:`/${t}`;return o==="/"?a:`${o}${a}`}const Sl=ve({__name:"ModelSelectorInput",props:Ze({label:{},placeholder:{default:"Select a model"},error:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},allowMultiple:{type:Boolean,default:!1}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const o=t,a=it(t,"modelValue"),i=p([]),l=p(!1),u=U(()=>i.value.map(h=>({value:h.id,label:h.name,description:h.provider_id||h.provider,icon:h.iconId}))),s=async()=>{l.value=!0;try{const h=await fetch(he("/api/models"));if(h.ok){const x=await h.json();i.value=x.models||[]}}catch(h){console.error("Error fetching models:",h)}finally{l.value=!1}},m=h=>{};return Pe(()=>{s()}),ge(()=>o.allowMultiple,()=>{o.allowMultiple&&typeof a.value=="string"?a.value=a.value?[a.value]:[]:!o.allowMultiple&&Array.isArray(a.value)&&(a.value=a.value[0]||"")}),(h,x)=>(r(),n(fe,null,[t.allowMultiple?(r(),q(ht,{key:0,modelValue:a.value,"onUpdate:modelValue":x[0]||(x[0]=c=>a.value=c),label:t.label,placeholder:t.placeholder,"search-placeholder":"Search models...",error:t.error,required:t.required,disabled:t.disabled,options:u.value,loading:l.value,"add-label":"Add another model",onRemoveItem:m},null,8,["modelValue","label","placeholder","error","required","disabled","options","loading"])):(r(),q(Ge,{key:1,modelValue:a.value,"onUpdate:modelValue":x[1]||(x[1]=c=>a.value=c),label:t.label,placeholder:t.placeholder,"search-placeholder":"Search models...",options:u.value,disabled:t.disabled,loading:l.value},null,8,["modelValue","label","placeholder","options","disabled","loading"])),!t.allowMultiple&&t.error?(r(),q(S(tt),{key:2,class:"mt-1"},{default:j(()=>[X(C(t.error),1)]),_:1})):T("",!0)],64))}}),Tl=ve({__name:"AgentSelectorInput",props:Ze({label:{default:"Handoff Agents"},placeholder:{default:"Select an agent"},error:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},allowMultiple:{type:Boolean,default:!0},agentType:{default:"ai_human"}},{modelValue:{required:!0,default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const o=t,a=it(t,"modelValue"),i=p([]),l=p(!1),u=U(()=>i.value.map(h=>({value:h.id,label:h.title,description:h.tool_description||`Handoff to ${h.title} agent`}))),s=async()=>{l.value=!0;try{const h=he(`/api/agents${o.agentType?`?type=${o.agentType}`:""}`),x=await fetch(h);if(x.ok){const c=await x.json();i.value=c.agents||[]}}catch(h){console.error("Error fetching agents:",h)}finally{l.value=!1}},m=h=>{};return Pe(()=>{s()}),ge(()=>o.allowMultiple,()=>{o.allowMultiple&&typeof a.value=="string"?a.value=a.value?[a.value]:[]:!o.allowMultiple&&Array.isArray(a.value)&&(a.value=a.value[0]||"")},{immediate:!0}),(h,x)=>(r(),n(fe,null,[t.allowMultiple?(r(),q(ht,{key:0,modelValue:a.value,"onUpdate:modelValue":x[0]||(x[0]=c=>a.value=c),label:t.label,placeholder:t.placeholder,"search-placeholder":"Search agents...",error:t.error,required:t.required,disabled:t.disabled,options:u.value,loading:l.value,"add-label":"Add another agent",onRemoveItem:m},null,8,["modelValue","label","placeholder","error","required","disabled","options","loading"])):(r(),q(Ge,{key:1,modelValue:a.value,"onUpdate:modelValue":x[1]||(x[1]=c=>a.value=c),label:t.label,placeholder:t.placeholder,"search-placeholder":"Search agents...",options:u.value,disabled:t.disabled,loading:l.value},null,8,["modelValue","label","placeholder","options","disabled","loading"])),!t.allowMultiple&&t.error?(r(),q(S(tt),{key:2,class:"mt-1"},{default:j(()=>[X(C(t.error),1)]),_:1})):T("",!0)],64))}}),Il=ve({__name:"ToolSelectorInput",props:Ze({label:{default:"Available Tools"},placeholder:{default:"Select a tool"},error:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},allowMultiple:{type:Boolean,default:!0}},{modelValue:{required:!0,default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const o=t,a=it(t,"modelValue"),i=p([]),l=p(!1),u=U(()=>i.value.map(h=>{let x=h.name;return h.type==="prompt"?x=`${h.name} (prompt)`:h.type==="mcp"&&(x=`${h.name} (mcp)`),{value:h.name,label:x,description:h.description}})),s=async()=>{l.value=!0;try{const h=await fetch(he("/api/tools"));if(h.ok){const x=await h.json();i.value=Object.entries(x).map(([c,f])=>({name:c,description:f.description||"",type:f.type,model:f.model}))}}catch(h){console.error("Error fetching tools:",h)}finally{l.value=!1}},m=h=>{};return Pe(()=>{s()}),ge(()=>o.allowMultiple,()=>{o.allowMultiple&&typeof a.value=="string"?a.value=a.value?[a.value]:[]:!o.allowMultiple&&Array.isArray(a.value)&&(a.value=a.value[0]||"")},{immediate:!0}),(h,x)=>(r(),n(fe,null,[t.allowMultiple?(r(),q(ht,{key:0,modelValue:a.value,"onUpdate:modelValue":x[0]||(x[0]=c=>a.value=c),label:t.label,placeholder:t.placeholder,"search-placeholder":"Search tools...",error:t.error,required:t.required,disabled:t.disabled,options:u.value,loading:l.value,"add-label":"Add another tool",onRemoveItem:m},null,8,["modelValue","label","placeholder","error","required","disabled","options","loading"])):(r(),q(Ge,{key:1,modelValue:a.value,"onUpdate:modelValue":x[1]||(x[1]=c=>a.value=c),label:t.label,placeholder:t.placeholder,"search-placeholder":"Search tools...",options:u.value,disabled:t.disabled,loading:l.value},null,8,["modelValue","label","placeholder","options","disabled","loading"])),!t.allowMultiple&&t.error?(r(),q(S(tt),{key:2,class:"mt-1"},{default:j(()=>[X(C(t.error),1)]),_:1})):T("",!0)],64))}}),zl=gt(Te(Sl),{props:["label","placeholder","error","required","disabled","allowMultiple"],family:"dropdown",features:[]}),Vl=gt(Te(Tl),{props:["label","placeholder","error","required","disabled","allowMultiple","agentType"],family:"dropdown",features:[]}),Ml=gt(Te(Il),{props:["label","placeholder","error","required","disabled","allowMultiple"],family:"dropdown",features:[]}),El={class:"space-y-4"},Ll={class:"flex items-start gap-2"},Pl={class:"flex-1"},Al=["onClick","disabled","title"],jl={key:0,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Dl={key:1,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Ol={key:0,class:"text-xs text-neutral-400 dark:text-neutral-500 mt-1"},Rl={key:0,class:"text-amber-500 dark:text-amber-400 ml-1"},Ul={class:"flex-1"},Bl={class:"flex-1"},Fl=["onClick","disabled"],Nl=["disabled"],Zt=ve({__name:"TenvPropertyList",props:{modelValue:{},inherited:{default:()=>[]},allowCustom:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:o}){const a=t,i=o,l=p(new Set),u=p([]),s=U(()=>new Set(a.inherited.map(d=>d.name)));ge(()=>a.modelValue,d=>{const k=Object.keys(d).filter(_=>!s.value.has(_)),g=new Set(u.value.map(_=>_.name));for(const _ of k)g.has(_)||u.value.push({id:crypto.randomUUID(),name:_,value:String(d[_]??"")})},{immediate:!0,deep:!0});const m=d=>{if(l.value.has(d)){l.value.delete(d);const k=a.inherited.find(g=>g.name===d);k&&h(d,k.value)}else l.value.add(d)},h=(d,k)=>{const g={...a.modelValue};k===void 0||k===""?delete g[d]:g[d]=k,i("update:modelValue",g)},x=d=>a.modelValue[d.name]!==void 0?String(a.modelValue[d.name]):d.value!==void 0?String(d.value):"",c=(d,k)=>{h(d.name,k||void 0)},f=()=>{u.value.push({id:crypto.randomUUID(),name:"",value:""})},y=d=>{const k=u.value.find(g=>g.id===d);if(k&&k.name){const g={...a.modelValue};delete g[k.name],i("update:modelValue",g)}u.value=u.value.filter(g=>g.id!==d)},b=(d,k,g)=>{const _=u.value.find(O=>O.id===d);if(!_)return;_.name=g;const L={...a.modelValue};k&&delete L[k],g&&_.value&&(L[g]=_.value),i("update:modelValue",L)},v=(d,k)=>{const g=u.value.find(_=>_.id===d);g&&(g.value=k,g.name&&h(g.name,k||void 0))};return(d,k)=>(r(),n("div",El,[(r(!0),n(fe,null,ke(t.inherited,g=>(r(),n("div",{key:g.name,class:"relative"},[e("div",Ll,[e("div",Pl,[w(lt,{"model-value":x(g),label:g.name,placeholder:g.description||"Enter value...",disabled:t.disabled||!l.value.has(g.name),required:g.required,"onUpdate:modelValue":_=>c(g,_)},null,8,["model-value","label","placeholder","disabled","required","onUpdate:modelValue"])]),e("button",{type:"button",onClick:_=>m(g.name),disabled:t.disabled,class:"mt-7 p-2 text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-300 transition-colors disabled:opacity-50",title:l.value.has(g.name)?"Lock (use inherited value)":"Unlock to override"},[l.value.has(g.name)?(r(),n("svg",Dl,[...k[1]||(k[1]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"},null,-1)])])):(r(),n("svg",jl,[...k[0]||(k[0]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"},null,-1)])]))],8,Al)]),g.source?(r(),n("p",Ol,[X(" From: "+C(g.source)+" ",1),g.required?(r(),n("span",Rl,"(required)")):T("",!0)])):T("",!0)]))),128)),(r(!0),n(fe,null,ke(u.value,g=>(r(),n("div",{key:g.id,class:"flex items-start gap-2"},[e("div",Ul,[w(lt,{"model-value":g.name,label:"Name",placeholder:"Variable name",disabled:t.disabled,"onUpdate:modelValue":_=>b(g.id,g.name,_)},null,8,["model-value","disabled","onUpdate:modelValue"])]),e("div",Bl,[w(lt,{"model-value":g.value,label:"Value",placeholder:"Variable value",disabled:t.disabled,"onUpdate:modelValue":_=>v(g.id,_)},null,8,["model-value","disabled","onUpdate:modelValue"])]),e("button",{type:"button",onClick:_=>y(g.id),disabled:t.disabled,class:"mt-7 p-2 text-red-400 hover:text-red-600 dark:hover:text-red-300 transition-colors disabled:opacity-50",title:"Remove"},[...k[2]||(k[2]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,Fl)]))),128)),t.allowCustom?(r(),n("button",{key:0,type:"button",onClick:f,disabled:t.disabled,class:"w-full px-3 py-2 text-sm bg-neutral-50 dark:bg-neutral-900 hover:bg-neutral-100 dark:hover:bg-neutral-800 text-neutral-700 dark:text-neutral-300 rounded transition-colors disabled:opacity-50 border border-dashed border-neutral-300 dark:border-neutral-700"},[...k[3]||(k[3]=[e("span",{class:"flex items-center justify-center gap-2"},[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})]),X(" Add custom variable ")],-1)])],8,Nl)):T("",!0)]))}}),ql=gt(Te(Zt),{props:["inherited","allowCustom","disabled"],family:"text",features:[]}),Hl={class:"space-y-3 mt-3 pt-3 border-t border-neutral-200 dark:border-neutral-700"},Wl={class:"space-y-2 pl-4 border-l-2 border-accent-200 dark:border-accent-700"},Kl={class:"space-y-2 pl-4 border-l-2 border-neutral-200 dark:border-neutral-700"},Jl=ve({__name:"PromptToolOptions",props:{toolName:{},toolConfig:{},toolType:{default:"prompt"},disabled:{type:Boolean}},emits:["update:option"],setup(t,{emit:o}){const a=t,i=o,l=p(null),u=p(!0),s=U(()=>l.value?.properties?Object.entries(l.value.properties).map(([x,c])=>({value:x,label:x,attrs:{description:c.description||c.type||""}})):[]),m=async()=>{try{let x=a.toolName;if(a.toolType==="handoff"||a.toolType==="subagent"){const f=await fetch(he(`/api/agents/${encodeURIComponent(a.toolName)}`));if(f.ok){if(x=(await f.json())?.agent?.side_a_agent_prompt,!x){u.value=!1;return}}else{u.value=!1;return}}const c=await fetch(he(`/api/prompts/${encodeURIComponent(x)}`));if(c.ok){const f=await c.json();f?.prompt?.required_schema&&(l.value=f.prompt.required_schema)}}catch(x){console.error("Error fetching prompt schema:",x)}finally{u.value=!1}};Pe(()=>{m()});const h=(x,c)=>{i("update:option",x,c)};return(x,c)=>{const f=Be("FormKit");return r(),n("div",Hl,[e("div",Wl,[c[5]||(c[5]=e("p",{class:"text-xs font-medium text-neutral-600 dark:text-neutral-400 mb-2"}," Initialization Options: ",-1)),w(f,{type:"selectSearch",value:t.toolConfig.init_user_message_property||"",onInput:c[0]||(c[0]=y=>h("init_user_message_property",y||null)),label:"User message property",placeholder:"Don't inject a user message",options:s.value,disabled:t.disabled||u.value||s.value.length===0,loading:u.value,help:"Select which argument property should be used as the most recent user message for this sub-prompt. If not set no additional user message will be injected.","outer-class":"$reset mb-2"},null,8,["value","options","disabled","loading"]),w(f,{type:"selectSearch",value:t.toolConfig.init_attachments_property||"",onInput:c[1]||(c[1]=y=>h("init_attachments_property",y||null)),label:"Attachments property",placeholder:"Don't attach files",options:s.value,disabled:t.disabled||u.value||s.value.length===0,loading:u.value,help:"Select which argument contains attachment path(s). Accepts a single path string or an array of paths.","outer-class":"$reset mb-0"},null,8,["value","options","disabled","loading"])]),e("div",Kl,[c[6]||(c[6]=e("p",{class:"text-xs font-medium text-neutral-600 dark:text-neutral-400 mb-2"}," Sub-Prompt Response Options: ",-1)),w(f,{type:"checkbox",value:t.toolConfig.include_text_response,onInput:c[2]||(c[2]=y=>h("include_text_response",y)),label:"Include text response",help:"Include the final text content from the sub-prompt",disabled:t.disabled,"outer-class":"$reset mb-1"},null,8,["value","disabled"]),w(f,{type:"checkbox",value:t.toolConfig.include_tool_calls,onInput:c[3]||(c[3]=y=>h("include_tool_calls",y)),label:"Include tool calls and responses",help:"Include tool calls executed by the sub-prompt and their responses",disabled:t.disabled,"outer-class":"$reset mb-1"},null,8,["value","disabled"]),w(f,{type:"checkbox",value:t.toolConfig.include_errors,onInput:c[4]||(c[4]=y=>h("include_errors",y)),label:"Include errors",help:"Include error information if the sub-prompt fails",disabled:t.disabled,"outer-class":"$reset mb-0"},null,8,["value","disabled"])])])}}});async function Je(t,o={}){const a=localStorage.getItem("auth_token"),i={"Content-Type":"application/json",...o.headers};a&&(i.Authorization=`Bearer ${a}`);const l=t.startsWith("/")?t:`/${t}`,u=await fetch(he(`/api${l}`),{...o,headers:i});if(u.status===401)throw localStorage.removeItem("auth_token"),window.location.href=he("/login"),new Error("Unauthorized");return u}const Yl={class:"space-y-4"},Gl={class:"block text-sm font-medium mb-2"},Zl={key:0,class:"text-red-500"},Xl={class:"flex items-start justify-between"},Ql={class:"flex items-center gap-2 flex-1"},es={class:"flex-1"},ts={key:0,class:"text-xs text-neutral-500 dark:text-neutral-400 font-normal"},rs={key:1,class:"text-xs text-neutral-500 dark:text-neutral-400 font-normal"},as={key:2,class:"text-xs text-neutral-500 dark:text-neutral-400 font-normal"},os={key:3,class:"text-xs text-neutral-500 dark:text-neutral-400 font-normal"},ns={key:4,class:"text-xs text-neutral-500 dark:text-neutral-400 font-normal"},ls={key:0,class:"text-xs text-neutral-600 dark:text-neutral-400 mt-1"},ss={key:1,class:"text-xs text-amber-600 dark:text-amber-400 mt-1 flex items-center gap-1"},is=["onClick","disabled","aria-label"],us={key:0,class:"mt-3 pt-3 border-t border-neutral-200 dark:border-neutral-700"},ds={class:"space-y-2"},cs={key:0,class:"text-xs text-amber-500 dark:text-amber-400 whitespace-nowrap",title:"Required at agent or thread level"},ps={key:0,class:"text-center py-8 text-sm text-neutral-500 dark:text-neutral-400 border border-dashed border-neutral-300 dark:border-neutral-600 rounded-lg"},Hr=ve({__name:"ToolSelectorWithOptions",props:Ze({label:{default:"Available Tools"},placeholder:{default:"Select a tool"},error:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},modelId:{},providerId:{}},{modelValue:{required:!0,default:()=>[]},modelModifiers:{}}),emits:Ze(["unavailable-tools"],["update:modelValue"]),setup(t,{expose:o,emit:a}){const i=t,l=it(t,"modelValue"),u=p([]),s=p([]),m=p(!1),h=p(!1),x=p(),c=p(""),f=U(()=>[...u.value,...s.value]),y=U(()=>new Set(f.value.map(Q=>k(Q)))),b=Q=>(Q.startsWith("provider:"),y.value.has(Q)),v=U(()=>l.value.filter(Q=>!b(Q.name)).map(Q=>Q.name)),d=a;ge(v,Q=>{Q.length>0&&d("unavailable-tools",Q)},{immediate:!0}),Tr(async()=>{x.value,await Le(),x.value&&l.value.length>0&&await Ir({parent:x,values:l,dragHandle:".drag-handle"})});const k=Q=>Q.type==="provider"?`provider:${Q.name}`:Q.type==="mcp"?`mcp:${Q.name}`:Q.name,g=Q=>Q.startsWith("provider:")?Q.slice(9):Q.startsWith("mcp:")?Q.slice(4):Q,_=Q=>Q.startsWith("provider:")?"provider":Q.startsWith("mcp:")?"mcp":"tool",L=U(()=>{const Q=new Set(l.value.map(E=>E.name));return f.value.filter(E=>!Q.has(k(E))).map(E=>{let $=E.name;return E.type==="prompt"?$=`${E.name} (prompt)`:E.type==="mcp"?$=`${E.name} (mcp)`:E.type==="provider"?$=`${E.name} (provider)`:E.type==="handoff"?$=`${E.name} (handoff agent)`:E.type==="subagent"&&($=`${E.name} (subagent)`),{value:k(E),label:$,attrs:{description:E.description}}})}),O=async()=>{m.value=!0;try{const Q=await Je("/tools");if(Q.ok){const E=await Q.json();u.value=Object.entries(E).map(([$,V])=>({name:$,description:V.description||"",type:V.type,model:V.model}))}}catch(Q){console.error("Error fetching tools:",Q)}finally{m.value=!1}},W=async()=>{if(!i.providerId||!i.modelId){s.value=[];return}h.value=!0;try{const Q=await Je(`/providers/${i.providerId}/tools?model=${encodeURIComponent(i.modelId)}`);if(Q.ok){const E=await Q.json();s.value=(E.tools||[]).map($=>({name:$.name,description:$.description||"",type:"provider",tenvs:$.tenvs||[]}))}else s.value=[]}catch(Q){console.error("Error fetching provider tools:",Q),s.value=[]}finally{h.value=!1}};ge([()=>i.providerId,()=>i.modelId],async([Q,E])=>{Q&&E?await W():s.value=[]},{immediate:!0});const J=Q=>{if(!Q||l.value.find(V=>V.name===Q))return;const E=P(Q),$={};if(E?.tenvs&&E.tenvs.length>0)for(const V of E.tenvs)$[V.name]="";l.value=[...l.value,{name:Q,include_text_response:!0,include_tool_calls:!0,include_errors:!0,init_user_message_property:null,init_attachments_property:null,...Object.keys($).length>0?{tenvs:$}:{}}],Le(()=>{c.value=""})},z=Q=>{l.value=l.value.filter(E=>E.name!==Q)},P=Q=>{const E=f.value.find($=>k($)===Q);return E||f.value.find($=>$.name===Q)},G=(Q,E,$)=>{l.value=l.value.map(V=>{if(V.name===Q){const te={...V.tenvs||{},[E]:$||void 0};for(const B of Object.keys(te))te[B]||delete te[B];return{...V,tenvs:Object.keys(te).length>0?te:void 0}}return V})},ee=(Q,E,$)=>{l.value=l.value.map(V=>V.name===Q?{...V,[E]:$}:V)};return o({removeUnavailableTools:()=>{l.value=l.value.filter(Q=>b(Q.name))},getAvailableToolsOnly:()=>l.value.filter(Q=>b(Q.name)),unavailableTools:v}),Pe(()=>{O()}),(Q,E)=>{const $=Be("FormKit");return r(),n("div",Yl,[e("div",null,[e("label",Gl,[X(C(t.label)+" ",1),t.required?(r(),n("span",Zl,"*")):T("",!0)]),l.value.length>0?(r(),n("div",{key:0,class:"space-y-3 mb-4",ref_key:"dragAreaRef",ref:x},[(r(!0),n(fe,null,ke(l.value,V=>(r(),n("div",{key:V.name,class:ne(["border rounded-lg p-4 transition-colors",b(V.name)?"border-neutral-300 dark:border-neutral-600":"border-amber-300 dark:border-amber-700 bg-amber-50 dark:bg-amber-900/20 opacity-75"])},[e("div",Xl,[e("div",Ql,[e("div",{class:ne(["drag-handle",b(V.name)?"cursor-move text-neutral-400 hover:text-neutral-600 dark:text-neutral-600 dark:hover:text-neutral-400":"cursor-not-allowed text-neutral-300 dark:text-neutral-700"])},[...E[1]||(E[1]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 8h16M4 16h16"})],-1)])],2),e("div",es,[e("h4",{class:ne(["font-medium text-sm",!b(V.name)&&"text-neutral-500 dark:text-neutral-400"])},[X(C(g(V.name))+" ",1),_(V.name)==="provider"?(r(),n("span",ts,"(provider)")):_(V.name)==="mcp"?(r(),n("span",rs,"(mcp)")):P(V.name)?.type==="prompt"?(r(),n("span",as,"(prompt)")):P(V.name)?.type==="handoff"?(r(),n("span",os,"(handoff agent)")):P(V.name)?.type==="subagent"?(r(),n("span",ns,"(subagent)")):T("",!0)],2),P(V.name)?.description?(r(),n("p",ls,C(P(V.name)?.description),1)):T("",!0),b(V.name)?T("",!0):(r(),n("p",ss,[...E[2]||(E[2]=[e("svg",{class:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})],-1),X(" Not available for selected model - will be removed on save ",-1)])]))])]),e("button",{onClick:te=>z(V.name),type:"button",disabled:t.disabled,class:"p-1 hover:bg-neutral-200 dark:hover:bg-neutral-800 rounded transition-colors text-neutral-500 hover:text-red-500","aria-label":`Remove ${g(V.name)}`},[...E[3]||(E[3]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,is)]),P(V.name)?.type==="provider"&&P(V.name)?.tenvs?.length?(r(),n("div",us,[E[4]||(E[4]=e("p",{class:"text-xs text-neutral-500 dark:text-neutral-400 mb-2 font-medium"},[X(" Environment Variables "),e("span",{class:"text-neutral-400"},"(optional at prompt level)")],-1)),e("div",ds,[(r(!0),n(fe,null,ke(P(V.name)?.tenvs,te=>(r(),n("div",{key:te.name,class:"flex items-center gap-2"},[w($,{type:"text",value:V.tenvs?.[te.name]||"",onInput:B=>G(V.name,te.name,B),label:te.name,placeholder:te.description||"Enter value...",disabled:t.disabled,"outer-class":"$reset flex-1 mb-0"},null,8,["value","onInput","label","placeholder","disabled"]),te.required?(r(),n("span",cs," required* ")):T("",!0)]))),128))])])):T("",!0),P(V.name)?.type==="prompt"||P(V.name)?.type==="handoff"||P(V.name)?.type==="subagent"?(r(),q(Jl,{key:1,"tool-name":V.name,"tool-config":V,"tool-type":P(V.name)?.type,disabled:t.disabled,"onUpdate:option":(te,B)=>ee(V.name,te,B)},null,8,["tool-name","tool-config","tool-type","disabled","onUpdate:option"])):T("",!0)],2))),128))],512)):T("",!0),w($,{type:"selectSearch",modelValue:c.value,"onUpdate:modelValue":E[0]||(E[0]=V=>c.value=V),onInput:J,placeholder:l.value.length>0?"Add another tool...":t.placeholder,"search-placeholder":"Search tools...",options:L.value,disabled:t.disabled||m.value||L.value.length===0,loading:m.value,"outer-class":"$reset"},null,8,["modelValue","placeholder","options","disabled","loading"]),t.error?(r(),q(S(tt),{key:1,class:"mt-1"},{default:j(()=>[X(C(t.error),1)]),_:1})):T("",!0)]),l.value.length===0&&!m.value&&L.value.length===0?(r(),n("div",ps," No tools available. Create tools in your agentbuilder/tools directory. ")):T("",!0)])}}}),ms=gt(Te(Hr),{props:["label","placeholder","error","required","disabled","modelId","providerId"],family:"dropdown",features:[]}),vs=ve({__name:"SelectInputWrapper",props:{context:{}},setup(t){const o=t,a=(b,v)=>{const d=o.context;return d[b]!==void 0?d[b]:d.attrs?.[b]!==void 0?d.attrs[b]:v},i=U(()=>o.context.classes??{}),l=U(()=>a("options",[])),u=U(()=>o.context._value??""),s=b=>{o.context.node.input(b)},m=U(()=>a("placeholder","Select an option")),h=U(()=>a("searchPlaceholder","Search...")),x=U(()=>a("loading",!1)),c=U(()=>o.context.disabled??!1),f=U(()=>a("size","md")),y=U(()=>a("activeHighlight",!1));return(b,v)=>(r(),q(Ge,{"model-value":u.value,options:l.value,placeholder:m.value,"search-placeholder":h.value,loading:x.value,disabled:c.value,"trigger-class":i.value.inner,size:f.value,"active-highlight":y.value,"onUpdate:modelValue":s},null,8,["model-value","options","placeholder","search-placeholder","loading","disabled","trigger-class","size","active-highlight"]))}}),fs={type:"input",family:"dropdown",props:["options","placeholder","searchPlaceholder","loading","size","activeHighlight"],schema:()=>[{$el:"label",if:"$label",attrs:{class:"$classes.label",for:"$id"},children:"$label"},{$cmp:Te(vs),props:{context:"$node.context"}}]},hs={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function gs(t,o){return r(),n("svg",hs,[...o[0]||(o[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"m21 21l-4.34-4.34"}),e("circle",{cx:"11",cy:"11",r:"8"})],-1)])])}const bs=Te({name:"lucide-search",render:gs}),xs=["data-suffix-icon"],ys=["id","value","placeholder","disabled"],ks=ve({__name:"SearchInputWrapper",props:{context:{}},setup(t){const o=t,a=(x,c)=>{const f=o.context;return f[x]!==void 0?f[x]:f.attrs?.[x]!==void 0?f.attrs[x]:c},i=U(()=>o.context.classes??{}),l=U(()=>o.context._value??""),u=x=>{const c=x.target.value;o.context.node.input(c)},s=()=>{o.context.node.input("")},m=U(()=>a("placeholder","Search...")),h=U(()=>o.context.disabled??!1);return(x,c)=>(r(),n("div",{class:ne(i.value.inner),"data-prefix-icon":"true","data-suffix-icon":!!l.value},[e("span",{class:ne(i.value.prefixIcon)},[w(S(bs))],2),e("input",{type:"text",id:t.context.id,value:l.value,onInput:u,placeholder:m.value,disabled:h.value,class:ne(i.value.input)},null,42,ys),l.value?(r(),n("button",{key:0,type:"button",onClick:s,class:ne([i.value.suffixIcon,"hover:text-zinc-600 dark:hover:text-zinc-300 cursor-pointer"])},[w(S(Pt))],2)):T("",!0)],10,xs))}}),ws={type:"input",family:"text",props:["placeholder","size"],schema:()=>[{$el:"label",if:"$label",attrs:{class:"$classes.label",for:"$id"},children:"$label"},{$cmp:Te(ks),props:{context:"$node.context"}}]},_s=ve({__name:"SortableMultiSelectWrapper",props:{context:{}},setup(t){const o=t,a=U(()=>o.context.options??[]),i=U(()=>o.context.placeholder??"Select an option"),l=U(()=>o.context.searchPlaceholder??"Search..."),u=U(()=>o.context.addLabel??"Add another"),s=U(()=>o.context.loading??!1),m=U(()=>o.context.disabled??!1),h=U({get:()=>o.context._value??[],set:x=>o.context.node.input(x)});return(x,c)=>(r(),q(ht,{modelValue:h.value,"onUpdate:modelValue":c[0]||(c[0]=f=>h.value=f),options:a.value,placeholder:i.value,"search-placeholder":l.value,"add-label":u.value,loading:s.value,disabled:m.value},null,8,["modelValue","options","placeholder","search-placeholder","add-label","loading","disabled"]))}}),$s={type:"input",family:"dropdown",props:["options","placeholder","searchPlaceholder","addLabel","loading"],schema:()=>[{$el:"label",if:"$label",attrs:{class:"$classes.label",for:"$id"},children:"$label"},{$cmp:Te(_s),props:{context:"$node.context"}}]},Cs={class:"flex items-center gap-2 py-1 pl-2 pr-1"},Ss={class:"flex-1 grid grid-cols-1 md:grid-cols-3 gap-2"},Ts={class:"flex items-center gap-0.5 shrink-0"},Is={key:1,class:"w-7"},zs={class:"pl-2 pb-1"},Vs={key:0},Ms={class:"space-y-1.5"},Es=["onClick"],Ls=["onClick"],Ps={key:1},As=["onClick"],js={key:2},Ds=["onClick"],Os={key:3},Rs={class:"flex items-center gap-2 py-1 pl-2 pr-1"},Us={class:"flex-1 grid grid-cols-1 md:grid-cols-2 gap-2"},Bs={class:"flex items-center gap-0.5 shrink-0"},Fs={key:1,class:"w-7"},Ns={class:"pl-2 pb-1"},qs={key:0},Hs={class:"space-y-1.5"},Ws=["onClick"],Ks=["onClick"],Js={key:1},Ys=["onClick"],Gs={key:2},Zs=["onClick"],Xs={key:3},Qs=["onClick"],ei=ve({__name:"SchemaPropertyRow",props:{typeOptions:{},depth:{},index:{}},emits:["remove"],setup(t){const o=t,a=p(!1),i=p("string"),l=p("string"),u=p(!1),s=v=>{i.value=v,x(v)&&(a.value=!0)},m=v=>{l.value=v,x(v)&&(u.value=!0)},h=v=>{v.value?.type&&(l.value=v.value.type,x(l.value)&&(u.value=!0)),v.on("input",({payload:d})=>{d?.type&&d.type!==l.value&&m(d.type)})},x=v=>["object","array","enum","anyOf"].includes(v),c=["#3b82f6","#8b5cf6","#ec4899","#f97316","#10b981"],f=U(()=>o.depth||0),y=v=>c[v%c.length],b=U(()=>y(f.value));return(v,d)=>{const k=Be("FormKit"),g=Be("SchemaPropertyRow",!0);return r(),q(k,{type:"group",index:t.index,onNode:d[3]||(d[3]=_=>{_.value?.type&&(i.value=_.value.type,x(i.value)&&(a.value=!0)),_.on("input",({payload:L})=>{L?.type&&L.type!==i.value&&s(L.type)})})},{default:j(({value:_})=>[e("div",{class:ne(["schema-row",f.value>0?"border-l-[3px] ml-2":""]),style:st(f.value>0?{borderColor:b.value}:{})},[e("div",Cs,[e("div",Ss,[w(k,{type:"text",name:"name",placeholder:"Property name","outer-class":"$reset"}),w(k,{type:"selectSearch",name:"type",options:t.typeOptions,placeholder:"Type","outer-class":"$reset",onInput:s},null,8,["options"]),w(k,{type:"text",name:"description",placeholder:"Description","outer-class":"$reset"})]),e("div",Ts,[x(i.value)?(r(),n("button",{key:0,onClick:d[0]||(d[0]=L=>a.value=!a.value),type:"button",class:"p-1.5 text-neutral-500 dark:text-white/70 hover:text-neutral-700 dark:hover:text-white hover:bg-neutral-100 dark:hover:bg-neutral-700 rounded transition-colors"},[(r(),n("svg",{class:ne(["w-4 h-4 transition-transform duration-150",a.value?"rotate-90":""]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...d[4]||(d[4]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"},null,-1)])],2))])):(r(),n("div",Is)),e("button",{onClick:d[1]||(d[1]=L=>v.$emit("remove")),type:"button",class:"p-1.5 text-neutral-500 dark:text-white/70 hover:text-red-500 dark:hover:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/30 rounded transition-colors"},[...d[5]||(d[5]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])])]),Ae(e("div",zs,[i.value==="enum"?(r(),n("div",Vs,[d[7]||(d[7]=e("div",{class:"text-[11px] font-medium text-neutral-400 uppercase tracking-wider mb-2"}," Enum Values ",-1)),w(k,{type:"list",name:"enumValues",dynamic:""},{default:j(({items:L,value:O,node:W})=>[e("div",Ms,[(r(!0),n(fe,null,ke(L,(J,z)=>(r(),n("div",{key:J,class:"flex items-center gap-2"},[w(k,{type:"group",index:z},{default:j(()=>[w(k,{type:"text",name:"value",placeholder:"Value","outer-class":"$reset flex-1"})]),_:1},8,["index"]),e("button",{onClick:P=>W.input(O.filter((G,ee)=>ee!==z)),type:"button",class:"p-1 text-neutral-500 dark:text-white/70 hover:text-red-500 dark:hover:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/30 rounded"},[...d[6]||(d[6]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,Es)]))),128))]),e("button",{onClick:J=>W.input((O||[]).concat({value:""})),type:"button",class:"mt-2 px-3 py-1.5 text-xs font-medium text-neutral-600 dark:text-neutral-400 bg-neutral-100 dark:bg-neutral-800 hover:bg-neutral-200 dark:hover:bg-neutral-700 rounded transition-colors"}," + Add Value ",8,Ls)]),_:1})])):T("",!0),i.value==="object"?(r(),n("div",Ps,[w(k,{type:"list",name:"properties",dynamic:""},{default:j(({items:L,value:O,node:W})=>[e("div",null,[(r(!0),n(fe,null,ke(L,(J,z)=>(r(),q(g,{key:J,index:z,"type-options":t.typeOptions,depth:f.value+1,onRemove:P=>W.input(O.filter((G,ee)=>ee!==z))},null,8,["index","type-options","depth","onRemove"]))),128))]),e("button",{onClick:J=>W.input((O||[]).concat({name:"",type:"string",description:""})),type:"button",class:"mt-2 px-3 py-1.5 text-xs font-medium text-neutral-600 dark:text-neutral-400 bg-neutral-100 dark:bg-neutral-800 hover:bg-neutral-200 dark:hover:bg-neutral-700 rounded transition-colors"}," + Add Nested Property ",8,As)]),_:1})])):T("",!0),i.value==="anyOf"?(r(),n("div",js,[d[8]||(d[8]=e("div",{class:"text-[11px] font-medium text-neutral-400 uppercase tracking-wider mb-2"}," Type Options ",-1)),w(k,{type:"list",name:"anyOfTypes",dynamic:""},{default:j(({items:L,value:O,node:W})=>[e("div",null,[(r(!0),n(fe,null,ke(L,(J,z)=>(r(),q(g,{key:J,index:z,"type-options":t.typeOptions,depth:f.value+1,onRemove:P=>W.input(O.filter((G,ee)=>ee!==z))},null,8,["index","type-options","depth","onRemove"]))),128))]),e("button",{onClick:J=>W.input((O||[]).concat({name:"",type:"string",description:""})),type:"button",class:"mt-2 px-3 py-1.5 text-xs font-medium text-neutral-600 dark:text-neutral-400 bg-neutral-100 dark:bg-neutral-800 hover:bg-neutral-200 dark:hover:bg-neutral-700 rounded transition-colors"}," + Add Type ",8,Ds)]),_:1})])):T("",!0),i.value==="array"?(r(),n("div",Os,[d[14]||(d[14]=e("div",{class:"text-[11px] font-medium text-neutral-400 uppercase tracking-wider mb-2"}," Array Item Type ",-1)),w(k,{type:"group",name:"items",onNode:h},{default:j(({value:L,node:O})=>[e("div",{class:"schema-row border-l-[3px] ml-2",style:st({borderColor:y(f.value+1)})},[e("div",Rs,[e("div",Us,[w(k,{type:"selectSearch",name:"type",options:t.typeOptions,placeholder:"Item type","outer-class":"$reset",onInput:m},null,8,["options"]),w(k,{type:"text",name:"description",placeholder:"Description","outer-class":"$reset"})]),e("div",Bs,[x(l.value)?(r(),n("button",{key:0,onClick:d[2]||(d[2]=W=>u.value=!u.value),type:"button",class:"p-1.5 text-neutral-500 dark:text-white/70 hover:text-neutral-700 dark:hover:text-white hover:bg-neutral-100 dark:hover:bg-neutral-700 rounded transition-colors"},[(r(),n("svg",{class:ne(["w-4 h-4 transition-transform duration-150",u.value?"rotate-90":""]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...d[9]||(d[9]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"},null,-1)])],2))])):(r(),n("div",Fs))])]),Ae(e("div",Ns,[l.value==="enum"?(r(),n("div",qs,[d[11]||(d[11]=e("div",{class:"text-[11px] font-medium text-neutral-400 uppercase tracking-wider mb-2"}," Enum Values ",-1)),w(k,{type:"list",name:"enumValues",dynamic:""},{default:j(({items:W,value:J,node:z})=>[e("div",Hs,[(r(!0),n(fe,null,ke(W,(P,G)=>(r(),n("div",{key:P,class:"flex items-center gap-2"},[w(k,{type:"group",index:G},{default:j(()=>[w(k,{type:"text",name:"value",placeholder:"Value","outer-class":"$reset flex-1"})]),_:1},8,["index"]),e("button",{onClick:ee=>z.input(J.filter((ue,me)=>me!==G)),type:"button",class:"p-1 text-neutral-500 dark:text-white/70 hover:text-red-500 dark:hover:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/30 rounded"},[...d[10]||(d[10]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,Ws)]))),128))]),e("button",{onClick:P=>z.input((J||[]).concat({value:""})),type:"button",class:"mt-2 px-3 py-1.5 text-xs font-medium text-neutral-600 dark:text-neutral-400 bg-neutral-100 dark:bg-neutral-800 hover:bg-neutral-200 dark:hover:bg-neutral-700 rounded transition-colors"}," + Add Value ",8,Ks)]),_:1})])):T("",!0),l.value==="object"?(r(),n("div",Js,[w(k,{type:"list",name:"properties",dynamic:""},{default:j(({items:W,value:J,node:z})=>[e("div",null,[(r(!0),n(fe,null,ke(W,(P,G)=>(r(),q(g,{key:P,index:G,"type-options":t.typeOptions,depth:f.value+2,onRemove:ee=>z.input(J.filter((ue,me)=>me!==G))},null,8,["index","type-options","depth","onRemove"]))),128))]),e("button",{onClick:P=>z.input((J||[]).concat({name:"",type:"string",description:""})),type:"button",class:"mt-2 px-3 py-1.5 text-xs font-medium text-neutral-600 dark:text-neutral-400 bg-neutral-100 dark:bg-neutral-800 hover:bg-neutral-200 dark:hover:bg-neutral-700 rounded transition-colors"}," + Add Nested Property ",8,Ys)]),_:1})])):T("",!0),l.value==="anyOf"?(r(),n("div",Gs,[d[12]||(d[12]=e("div",{class:"text-[11px] font-medium text-neutral-400 uppercase tracking-wider mb-2"}," Type Options ",-1)),w(k,{type:"list",name:"anyOfTypes",dynamic:""},{default:j(({items:W,value:J,node:z})=>[e("div",null,[(r(!0),n(fe,null,ke(W,(P,G)=>(r(),q(g,{key:P,index:G,"type-options":t.typeOptions,depth:f.value+2,onRemove:ee=>z.input(J.filter((ue,me)=>me!==G))},null,8,["index","type-options","depth","onRemove"]))),128))]),e("button",{onClick:P=>z.input((J||[]).concat({name:"",type:"string",description:""})),type:"button",class:"mt-2 px-3 py-1.5 text-xs font-medium text-neutral-600 dark:text-neutral-400 bg-neutral-100 dark:bg-neutral-800 hover:bg-neutral-200 dark:hover:bg-neutral-700 rounded transition-colors"}," + Add Type ",8,Zs)]),_:1})])):T("",!0),l.value==="array"?(r(),n("div",Xs,[d[13]||(d[13]=e("div",{class:"text-[11px] font-medium text-neutral-400 uppercase tracking-wider mb-2"}," Nested Array Item Type ",-1)),w(k,{type:"list",name:"items",dynamic:""},{default:j(({items:W,value:J,node:z})=>[e("div",null,[(r(!0),n(fe,null,ke(W,(P,G)=>(r(),q(g,{key:P,index:G,"type-options":t.typeOptions,depth:f.value+2,onRemove:ee=>z.input(J.filter((ue,me)=>me!==G))},null,8,["index","type-options","depth","onRemove"]))),128))]),e("button",{onClick:P=>z.input((J||[]).concat({type:"string",description:""})),type:"button",class:"mt-2 px-3 py-1.5 text-xs font-medium text-neutral-600 dark:text-neutral-400 bg-neutral-100 dark:bg-neutral-800 hover:bg-neutral-200 dark:hover:bg-neutral-700 rounded transition-colors"}," + Define Nested Item ",8,Qs)]),_:1})])):T("",!0)],512),[[Ke,u.value&&x(l.value)]])],4)]),_:1})])):T("",!0)],512),[[Ke,a.value&&x(i.value)]])],6)]),_:1},8,["index"])}}}),ti=Xe(ei,[["__scopeId","data-v-a52ecd3f"]]),ri={"data-schema-editor":"",class:"space-y-4"},ai={class:"space-y-2 border border-neutral-200 dark:border-neutral-800 rounded-lg p-4"},oi={key:0,class:"flex items-center justify-between mb-2"},ni={key:1,class:"text-center py-12"},li={class:"divide-y divide-neutral-100 dark:divide-neutral-800"},si={class:"mt-3 pt-3 border-t border-neutral-200 dark:border-neutral-800"},ii=["onClick"],ui={class:"mt-4 text-center"},di={key:3,class:"mt-4"},ci={class:"bg-neutral-50 dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-800 rounded-lg p-4 overflow-x-auto"},pi={class:"text-xs leading-relaxed"},mi=["innerHTML"],vi=ve({__name:"FormKitSchemaEditor",props:{context:{}},setup(t){const o=[{value:"string",label:"String",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z'/%3E%3C/svg%3E"},{value:"number",label:"Number",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M7 20l4-16m2 16l4-16M6 9h14M4 15h14'/%3E%3C/svg%3E"},{value:"boolean",label:"Boolean",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z'/%3E%3C/svg%3E"},{value:"object",label:"Object",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10'/%3E%3C/svg%3E"},{value:"array",label:"Array",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 6h16M4 10h16M4 14h16M4 18h16'/%3E%3C/svg%3E"},{value:"enum",label:"Enum",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4'/%3E%3C/svg%3E"},{value:"anyOf",label:"Any Of",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z'/%3E%3C/svg%3E"}],a=t,i=p(!1),l=x=>x?.properties?Object.entries(x.properties).map(([c,f])=>{const y={name:c,type:f.enum?"enum":f.anyOf?"anyOf":f.type||"string",description:f.description||""};return f.enum&&(y.enumValues=f.enum.map(b=>({value:b}))),f.anyOf&&(y.anyOfTypes=f.anyOf.map(b=>({type:b.type||"string",description:b.description||""}))),f.type==="object"&&f.properties&&(y.properties=l(f)),f.type==="array"&&f.items&&(y.items={type:f.items.type||"string",description:f.items.description||""},f.items.properties&&(y.items.properties=l(f.items))),y}):[],u=x=>{const c={type:"object",properties:{},required:[],additionalProperties:!1};for(const f of x||[]){if(!f.name)continue;const y={type:f.type==="enum"||f.type==="anyOf"?void 0:f.type,description:f.description||void 0};if(f.type==="enum"&&f.enumValues&&(y.type="string",y.enum=f.enumValues.map(b=>b.value)),f.type==="anyOf"&&f.anyOfTypes&&(y.anyOf=f.anyOfTypes.map(b=>({type:b.type,description:b.description||void 0}))),f.type==="object"&&f.properties){const b=u(f.properties);y.properties=b.properties,y.required=b.required,y.additionalProperties=!1}if(f.type==="array"&&f.items&&(y.items={type:f.items.type,description:f.items.description||void 0},f.items.properties)){const b=u(f.items.properties);y.items.properties=b.properties,y.items.required=b.required}Object.keys(y).forEach(b=>y[b]===void 0&&delete y[b]),c.properties[f.name]=y,c.required.push(f.name)}return c},s=U({get:()=>{const x=a.context._value;return l(x)},set:x=>{const c=u(x);a.context.node.input(c)}}),m=U(()=>{const x=a.context._value||{type:"object",properties:{},required:[]};return JSON.stringify(x,null,2).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"([^"]+)":/g,'<span class="text-blue-600 dark:text-blue-400">"$1"</span>:').replace(/:"([^"]*)"/g,':<span class="text-green-600 dark:text-green-400">"$1"</span>').replace(/:(\d+)/g,':<span class="text-yellow-600 dark:text-yellow-400">$1</span>').replace(/:(true|false)/g,':<span class="text-purple-600 dark:text-purple-400">$1</span>')}),h=()=>{s.value=[{name:"property1",type:"string",description:""}]};return(x,c)=>{const f=Be("FormKit");return r(),n("div",ri,[e("div",ai,[s.value.length>0?(r(),n("div",oi,[...c[3]||(c[3]=[e("h3",{class:"text-sm font-medium text-neutral-700 dark:text-neutral-300"}," Properties ",-1)])])):T("",!0),s.value.length===0?(r(),n("div",ni,[c[5]||(c[5]=e("div",{class:"mb-4"},[e("svg",{class:"w-12 h-12 mx-auto text-neutral-400 dark:text-neutral-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})])],-1)),c[6]||(c[6]=e("p",{class:"text-neutral-500 dark:text-neutral-400 text-sm mb-4"}," No properties defined ",-1)),e("button",{onClick:c[0]||(c[0]=y=>h()),type:"button",class:"px-4 py-2 bg-black dark:bg-white text-white dark:text-black rounded hover:bg-neutral-800 dark:hover:bg-neutral-200 transition-colors font-medium text-sm"},[...c[4]||(c[4]=[e("span",{class:"flex items-center gap-2"},[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})]),X(" Add Property ")],-1)])])])):T("",!0),s.value.length>0?(r(),q(f,{key:2,type:"list",value:s.value,onInput:c[1]||(c[1]=y=>s.value=y),dynamic:""},{default:j(({items:y,value:b,node:v})=>[e("div",li,[(r(!0),n(fe,null,ke(y,(d,k)=>(r(),q(ti,{key:d,index:k,"type-options":o,depth:0,onRemove:g=>v.input(b.filter((_,L)=>L!==k))},null,8,["index","onRemove"]))),128))]),e("div",si,[e("button",{onClick:d=>v.input(b.concat({name:`property${b.length+1}`,type:"string",description:""})),type:"button",class:"px-3 py-1.5 text-xs font-medium text-neutral-700 dark:text-neutral-300 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-600 rounded-md hover:bg-neutral-50 dark:hover:bg-neutral-700 transition-colors shadow-sm"}," + Add Property ",8,ii)])]),_:1},8,["value"])):T("",!0),e("div",ui,[e("button",{onClick:c[2]||(c[2]=y=>i.value=!i.value),type:"button",class:"text-xs font-medium text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-neutral-100 underline underline-offset-2 transition-colors"},C(i.value?"Hide":"Show")+" JSON Schema ",1)]),i.value?(r(),n("div",di,[e("div",ci,[e("pre",pi,[e("code",{class:"font-mono",innerHTML:m.value},null,8,mi)])])])):T("",!0)])])}}}),fi={type:"input",family:"text",props:["label","disabled","required"],schema:()=>[{$el:"label",if:"$label",attrs:{class:"$classes.label",for:"$id"},children:"$label"},{$cmp:Te(vi),props:{context:"$node.context"}}]},hi={promptInput:qo,jsonSchema:hl,modelSelector:zl,agentSelector:Vl,toolSelector:Ml,tenvPropertyList:ql,toolSelectorWithOptions:ms,selectSearch:fs,searchInput:ws,sortableMultiSelect:$s,schemaEditor:fi},gi=eo("fk-2d3e4e0bb",ro),bi={config:{rootClasses:yo},plugins:[gi],rules:Io,messages:{en:zo},inputs:hi,icons:{...to}},xi={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function yi(t,o){return r(),n("svg",xi,[...o[0]||(o[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M12 8V4H8"}),e("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),e("path",{d:"M2 14h2m16 0h2m-7-1v2m-6-2v2"})],-1)])])}const mt=Te({name:"lucide-bot",render:yi}),ki={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function wi(t,o){return r(),n("svg",ki,[...o[0]||(o[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"},null,-1)])])}const Et=Te({name:"lucide-message-square",render:wi}),_i={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function $i(t,o){return r(),n("svg",_i,[...o[0]||(o[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M12 20v2m0-20v2m5 16v2m0-20v2M2 12h2m-2 5h2M2 7h2m16 5h2m-2 5h2M20 7h2M7 20v2M7 2v2"}),e("rect",{width:"16",height:"16",x:"4",y:"4",rx:"2"}),e("rect",{width:"8",height:"8",x:"8",y:"8",rx:"1"})],-1)])])}const Ci=Te({name:"lucide-cpu",render:$i}),Si={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ti(t,o){return r(),n("svg",Si,[...o[0]||(o[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),e("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),e("path",{d:"M6 6h.01M6 18h.01"})],-1)])])}const Ii=Te({name:"lucide-server",render:Ti}),zi={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Vi(t,o){return r(),n("svg",zi,[...o[0]||(o[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"},null,-1)])])}const qt=Te({name:"lucide-wrench",render:Vi}),Mi={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ei(t,o){return r(),n("svg",Mi,[...o[0]||(o[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0a2.34 2.34 0 0 0 3.319 1.915a2.34 2.34 0 0 1 2.33 4.033a2.34 2.34 0 0 0 0 3.831a2.34 2.34 0 0 1-2.33 4.033a2.34 2.34 0 0 0-3.319 1.915a2.34 2.34 0 0 1-4.659 0a2.34 2.34 0 0 0-3.32-1.915a2.34 2.34 0 0 1-2.33-4.033a2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"}),e("circle",{cx:"12",cy:"12",r:"3"})],-1)])])}const Ht=Te({name:"lucide-settings",render:Ei}),Li={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Pi(t,o){return r(),n("svg",Li,[...o[0]||(o[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m15 18l-6-6l6-6"},null,-1)])])}const Wr=Te({name:"lucide-chevron-left",render:Pi}),Ai={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function ji(t,o){return r(),n("svg",Ai,[...o[0]||(o[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("circle",{cx:"12",cy:"12",r:"4"}),e("path",{d:"M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"})],-1)])])}const Di=Te({name:"lucide-sun",render:ji}),Oi={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ri(t,o){return r(),n("svg",Oi,[...o[0]||(o[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"},null,-1)])])}const Ui=Te({name:"lucide-moon",render:Ri}),Bi={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Fi(t,o){return r(),n("svg",Bi,[...o[0]||(o[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"},null,-1)])])}const Ni=Te({name:"lucide-activity",render:Fi}),qi={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Hi(t,o){return r(),n("svg",qi,[...o[0]||(o[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),e("path",{d:"M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3m-6 4.2h5.7"})],-1)])])}const Wi=Te({name:"lucide-function-square",render:Hi}),Ki={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ji(t,o){return r(),n("svg",Ki,[...o[0]||(o[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m16 17l5-5l-5-5m5 5H9m0 9H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"},null,-1)])])}const Yi=Te({name:"lucide-log-out",render:Ji}),Gi={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Zi(t,o){return r(),n("svg",Gi,[...o[0]||(o[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M16 3.128a4 4 0 0 1 0 7.744M22 21v-2a4 4 0 0 0-3-3.87"}),e("circle",{cx:"9",cy:"7",r:"4"})],-1)])])}const Xi=Te({name:"lucide-users",render:Zi}),Qi={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function eu(t,o){return r(),n("svg",Qi,[...o[0]||(o[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"m15.5 7.5l2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4m2-2l-9.6 9.6"}),e("circle",{cx:"7.5",cy:"15.5",r:"5.5"})],-1)])])}const tu=Te({name:"lucide-key",render:eu}),ru={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function au(t,o){return r(),n("svg",ru,[...o[0]||(o[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 7v14m-9-3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4a4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3a3 3 0 0 0-3-3z"},null,-1)])])}const ou=Te({name:"lucide-book-open",render:au}),nu={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function lu(t,o){return r(),n("svg",nu,[...o[0]||(o[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m-11 5L21 3m-3 10v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"},null,-1)])])}const su=Te({name:"lucide-external-link",render:lu}),Kr="agentbuilder-accent-theme",Jr=["amber","lime","emerald","sky","blue","indigo","purple","fuchsia","pink","white"],Wt=p("purple");let cr=!1;function Yr(t){typeof document>"u"||(t==="purple"?delete document.documentElement.dataset.accent:document.documentElement.dataset.accent=t)}function iu(t){try{localStorage.setItem(Kr,t)}catch{}}function uu(){try{const t=localStorage.getItem(Kr);if(t&&Jr.includes(t))return t}catch{}return"purple"}function Gr(){if(cr)return;cr=!0;const t=uu();Wt.value=t,Yr(t)}function du(){Gr();function t(o){Wt.value=o,Yr(o),iu(o)}return{theme:Wt,themes:Jr,setTheme:t}}const Zr="/agents/assets/img/agent-builder-logo-light.svg",Xr="/agents/assets/img/agent-builder-logo-dark.svg",cu="data:image/svg+xml,%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%20150%20150'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;'%3e%3cg%20id='Artboard1'%20transform='matrix(1,0,0,1,1,1)'%3e%3crect%20x='-1'%20y='-1'%20width='150'%20height='150'%20style='fill:none;'/%3e%3cg%20transform='matrix(1.034881,0,0,1.034881,4.124225,0)'%3e%3cpath%20d='M133.816,92.912L108.064,59.193C103.573,53.307%20101.473,45.937%20102.197,38.566L105.475,5.046L99.553,4.466L96.312,37.643C95.895,41.808%2091.44,44.27%2087.71,42.369L30.34,13.394L27.659,18.7L84.686,47.494C87.184,48.762%2087.076,52.347%2084.504,53.452L0.387,89.671L2.741,95.139L86.189,59.211C88.76,58.106%2091.422,60.587%2090.48,63.231L62.918,141.119L68.532,143.111L96.384,64.408C97.507,61.257%20101.672,60.605%20103.7,63.249L129.107,96.498L133.834,92.876L133.816,92.912Z'%20style='fill:rgb(31,41,55);fill-opacity:0.5;fill-rule:nonzero;'/%3e%3c/g%3e%3cg%20transform='matrix(1.034881,0,0,1.034881,4.124225,0)'%3e%3cpath%20d='M133.925,90.214L107.648,7.346C106.036,2.257%20100.875,-0.821%2095.624,0.193L32.64,12.344C29.959,12.869%2027.605,14.408%2026.066,16.6C25.523,17.36%2025.07,18.211%2024.744,19.117L0.622,86.284C-0.917,90.594%200.459,95.375%204.081,98.164L59.568,141.137C61.469,142.604%2063.733,143.346%2066.015,143.346C68.079,143.346%2070.144,142.731%2071.937,141.517L129.832,102.111C133.707,99.468%20135.355,94.687%20133.943,90.232L133.925,90.214ZM116.92,85.922L47.127,53.923C44.374,52.673%2043.994,48.925%2046.421,47.132L94.175,11.873C97.416,9.483%20102.034,10.95%20103.284,14.771C108.173,29.548%20118.64,62.054%20124.218,79.457C125.631,83.876%20121.121,87.859%20116.902,85.94L116.92,85.922ZM79.162,15.567L42.455,42.659C40.083,44.415%2036.696,43.057%2036.189,40.16L33.781,26.342C33.038,22.05%2035.845,17.94%2040.119,17.089C49.409,15.241%2065.254,12.145%2076.681,9.917C79.995,9.265%2081.879,13.557%2079.162,15.567ZM29.126,34.238L31.716,49.069C31.915,50.21%2031.607,51.388%2030.865,52.275L16.559,69.587C15.291,71.127%2012.846,69.732%2013.516,67.849L25.704,33.93C26.32,32.21%2028.8,32.427%2029.126,34.22L29.126,34.238ZM12.882,83.386L29.543,63.231C31.517,60.84%2035.356,61.547%2036.352,64.499L56.308,123.661C57.322,126.668%2053.809,129.149%2051.31,127.193C41.223,119.297%2024.4,106.132%2014.404,98.164C9.84,94.542%209.152,87.878%2012.864,83.386L12.882,83.386ZM63.498,126.305L43.161,66.002C42.056,62.706%2045.407,59.681%2048.576,61.13L117.337,92.677C121.375,94.524%20121.864,100.083%20118.206,102.6C107.358,110.061%2088.326,123.064%2076.826,130.815C71.991,134.074%2065.381,131.829%2063.516,126.305L63.498,126.305Z'%20style='fill:rgb(31,41,55);fill-rule:nonzero;'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",pu="data:image/svg+xml,%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%20150%20150'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;'%3e%3cg%20id='Artboard1'%20transform='matrix(1,0,0,1,1,1)'%3e%3crect%20x='-1'%20y='-1'%20width='150'%20height='150'%20style='fill:none;'/%3e%3cg%20transform='matrix(1.034881,0,0,1.034881,4.124225,0)'%3e%3cpath%20d='M133.816,92.912L108.064,59.193C103.573,53.307%20101.473,45.937%20102.197,38.566L105.475,5.046L99.553,4.466L96.312,37.643C95.895,41.808%2091.44,44.27%2087.71,42.369L30.34,13.394L27.659,18.7L84.686,47.494C87.184,48.762%2087.076,52.347%2084.504,53.452L0.387,89.671L2.741,95.139L86.189,59.211C88.76,58.106%2091.422,60.587%2090.48,63.231L62.918,141.119L68.532,143.111L96.384,64.408C97.507,61.257%20101.672,60.605%20103.7,63.249L129.107,96.498L133.834,92.876L133.816,92.912Z'%20style='fill:rgb(249,250,251);fill-opacity:0.5;fill-rule:nonzero;'/%3e%3c/g%3e%3cg%20transform='matrix(1.034881,0,0,1.034881,4.124225,0)'%3e%3cpath%20d='M133.925,90.214L107.648,7.346C106.036,2.257%20100.875,-0.821%2095.624,0.193L32.64,12.344C29.959,12.869%2027.605,14.408%2026.066,16.6C25.523,17.36%2025.07,18.211%2024.744,19.117L0.622,86.284C-0.917,90.594%200.459,95.375%204.081,98.164L59.568,141.137C61.469,142.604%2063.733,143.346%2066.015,143.346C68.079,143.346%2070.144,142.731%2071.937,141.517L129.832,102.111C133.707,99.468%20135.355,94.687%20133.943,90.232L133.925,90.214ZM116.92,85.922L47.127,53.923C44.374,52.673%2043.994,48.925%2046.421,47.132L94.175,11.873C97.416,9.483%20102.034,10.95%20103.284,14.771C108.173,29.548%20118.64,62.054%20124.218,79.457C125.631,83.876%20121.121,87.859%20116.902,85.94L116.92,85.922ZM79.162,15.567L42.455,42.659C40.083,44.415%2036.696,43.057%2036.189,40.16L33.781,26.342C33.038,22.05%2035.845,17.94%2040.119,17.089C49.409,15.241%2065.254,12.145%2076.681,9.917C79.995,9.265%2081.879,13.557%2079.162,15.567ZM29.126,34.238L31.716,49.069C31.915,50.21%2031.607,51.388%2030.865,52.275L16.559,69.587C15.291,71.127%2012.846,69.732%2013.516,67.849L25.704,33.93C26.32,32.21%2028.8,32.427%2029.126,34.22L29.126,34.238ZM12.882,83.386L29.543,63.231C31.517,60.84%2035.356,61.547%2036.352,64.499L56.308,123.661C57.322,126.668%2053.809,129.149%2051.31,127.193C41.223,119.297%2024.4,106.132%2014.404,98.164C9.84,94.542%209.152,87.878%2012.864,83.386L12.882,83.386ZM63.498,126.305L43.161,66.002C42.056,62.706%2045.407,59.681%2048.576,61.13L117.337,92.677C121.375,94.524%20121.864,100.083%20118.206,102.6C107.358,110.061%2088.326,123.064%2076.826,130.815C71.991,134.074%2065.381,131.829%2063.516,126.305L63.498,126.305Z'%20style='fill:rgb(249,250,251);fill-rule:nonzero;'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",mu=["src"],vu=["src"],fu={class:"flex-1 flex flex-col justify-between pt-2 pb-4"},hu={class:"flex flex-col gap-1 px-2"},gu={key:0},bu=["onClick","title"],xu={key:0,class:"flex-1 whitespace-nowrap overflow-hidden text-ellipsis text-left"},yu={key:0,class:"ml-4 space-y-0.5"},ku=["onClick"],wu={class:"whitespace-nowrap overflow-hidden text-ellipsis"},_u=["onClick","title"],$u={key:0,class:"whitespace-nowrap overflow-hidden text-ellipsis"},Cu={class:"flex flex-col gap-1 px-2"},Su=["title"],Tu={key:0,class:"flex-1 whitespace-nowrap overflow-hidden text-ellipsis"},Iu={class:"relative settings-menu-container"},zu={key:0,class:"absolute bottom-full mb-2 left-0 z-50"},Vu={class:"px-4 py-3 border-b border-neutral-200 dark:border-neutral-700"},Mu=["title"],Eu={class:"relative z-10 flex items-center justify-center w-8 h-full"},Lu={class:"relative z-10 flex items-center justify-center w-8 h-full"},Pu={class:"px-4 pt-3 pb-4 border-b border-neutral-200 dark:border-neutral-700"},Au={class:"grid grid-cols-5 gap-3"},ju=["onClick","title"],Du={key:0,class:"w-2 h-2 rounded-full bg-white shadow-sm"},Ou={key:0,class:"text-sm overflow-hidden whitespace-nowrap max-w-0 group-hover:max-w-[60px] group-hover:ml-2 transition-all duration-200"},Ru=ve({__name:"Sidebar",props:{isCollapsed:{type:Boolean},isDark:{type:Boolean}},emits:["toggle-sidebar","toggle-theme"],setup(t,{emit:o}){function a(ue){if(ue.startsWith("/src/")||ue.startsWith("data:"))return ue;const me=_t();return me==="/"?ue.replace("/agents/","/"):ue.replace("/agents/",`${me}/`)}const i=a(Zr),l=a(Xr),u=a(cu),s=a(pu),m=t,h=ut(),x=bt(),c=U(()=>h.name);function f(ue){const me=h.path;return me===ue.path||me.startsWith(ue.path+"/")}const y=U(()=>m.isDark?l:i),b=U(()=>m.isDark?s:u),v=[{id:"threads",label:"Threads",icon:Ni,path:"/threads"},{id:"agents",label:"Agents",icon:mt,path:"/agents"},{id:"prompts",label:"Prompts",icon:Et,path:"/prompts"},{id:"tools",label:"Tools",icon:qt,path:"/tools",hasSubnav:!0,subnav:[{id:"tools-functions",label:"Functions",icon:Wi,path:"/tools#functions"},{id:"tools-prompts",label:"Prompts",icon:Et,path:"/tools#prompts"},{id:"tools-agents",label:"Agents",icon:mt,path:"/tools#agents"}]},{id:"models",label:"Models",icon:Ci,path:"/models"},{id:"providers",label:"Providers",icon:Ii,path:"/providers"}],d=ue=>{x.push(ue)},k=ue=>{x.push(ue),_.value=!1},g=U(()=>typeof c.value=="string"&&(c.value==="tools"||c.value.startsWith("tools-"))),_=p(!1),{theme:L,themes:O,setTheme:W}=du(),J={amber:"bg-amber-500",lime:"bg-lime-500",emerald:"bg-emerald-500",sky:"bg-sky-500",blue:"bg-blue-500",indigo:"bg-indigo-500",purple:"bg-purple-500",fuchsia:"bg-fuchsia-500",pink:"bg-pink-500",white:"bg-neutral-400 dark:bg-neutral-500"},z=U(()=>c.value==="users"||c.value==="api-keys"),P=()=>{_.value=!_.value},G=()=>{localStorage.removeItem("auth_token"),x.push("/login")},ee=ue=>{const me=ue.target;_.value&&!me.closest(".settings-menu-container")&&(_.value=!1)};return Pe(()=>{document.addEventListener("click",ee)}),Ye(()=>{document.removeEventListener("click",ee)}),(ue,me)=>(r(),n("aside",{class:ne(["flex flex-col transition-all duration-300 pt-2.5",t.isCollapsed?"w-16":"w-60"])},[e("div",{class:ne(`flex items-center justify-between ${t.isCollapsed?"px-2 py-4":"p-4"}`)},[t.isCollapsed?T("",!0):(r(),n("img",{key:0,src:y.value,alt:"AgentBuilder",class:"h-8 mr-2 mt-0.5"},null,8,mu)),e("button",{onClick:me[0]||(me[0]=Q=>ue.$emit("toggle-sidebar")),class:ne(`p-1 rounded hover:bg-black/5 dark:hover:bg-white/10 transition-colors ${t.isCollapsed?"m-auto":"border border-black/20 dark:border-white/20 opacity-50 hover:opacity-100"}`),"aria-label":"Toggle sidebar"},[t.isCollapsed?(r(),n("img",{key:1,src:b.value,alt:"AgentBuilder",class:"w-7 h-7 m-auto"},null,8,vu)):(r(),q(S(Wr),{key:0,class:"w-5 h-5"}))],2)],2),e("nav",fu,[e("div",hu,[(r(),n(fe,null,ke(v,Q=>(r(),n(fe,{key:Q.id},[Q.hasSubnav?(r(),n("div",gu,[e("button",{onClick:E=>d(Q.path),class:ne(["flex items-center gap-3 px-3 py-3 rounded text-sm font-medium transition-all w-full",g.value?"bg-black text-white dark:bg-white dark:text-black":"hover:bg-black/5 dark:hover:bg-white/10",t.isCollapsed&&"justify-center"]),title:t.isCollapsed?Q.label:void 0},[(r(),q(Ue(Q.icon),{class:"w-5 h-5 flex-shrink-0"})),t.isCollapsed?T("",!0):(r(),n("span",xu,C(Q.label),1))],10,bu),!t.isCollapsed&&Q.subnav?(r(),n("div",yu,[(r(!0),n(fe,null,ke(Q.subnav,E=>(r(),n("button",{key:E.id,onClick:$=>d(E.path),class:ne(["flex items-center gap-3 px-3 py-1.5 text-sm transition-all w-full",c.value===E.id?"bg-black text-white dark:bg-white dark:text-black rounded":"hover:underline"])},[(r(),q(Ue(E.icon),{class:"w-4 h-4 flex-shrink-0"})),e("span",wu,C(E.label),1)],10,ku))),128))])):T("",!0)])):(r(),n("button",{key:1,onClick:E=>d(Q.path),class:ne(["flex items-center gap-3 px-3 py-3 rounded text-sm font-medium transition-all",f(Q)?"bg-black text-white dark:bg-white dark:text-black":"hover:bg-black/5 dark:hover:bg-white/10",t.isCollapsed&&"justify-center"]),title:t.isCollapsed?Q.label:void 0},[(r(),q(Ue(Q.icon),{class:"w-5 h-5 flex-shrink-0"})),t.isCollapsed?T("",!0):(r(),n("span",$u,C(Q.label),1))],10,_u))],64))),64))]),e("div",Cu,[e("a",{href:"https://docs.standardagentbuilder.com/",target:"_blank",rel:"noopener noreferrer",class:ne(["flex items-center gap-3 px-3 py-2 rounded text-sm transition-all","hover:bg-black/5 dark:hover:bg-white/10 text-neutral-600 dark:text-neutral-400 hover:text-black dark:hover:text-white",t.isCollapsed&&"justify-center"]),title:t.isCollapsed?"Documentation":void 0},[w(S(ou),{class:"w-5 h-5 flex-shrink-0"}),t.isCollapsed?T("",!0):(r(),n("span",Tu," Docs ")),t.isCollapsed?T("",!0):(r(),q(S(su),{key:1,class:"w-3 h-3 flex-shrink-0 opacity-50"}))],10,Su),e("div",{class:ne(["flex items-center gap-1 pt-2 mt-1 border-t border-black/10 dark:border-white/10",t.isCollapsed?"flex-col":"justify-between"])},[e("div",Iu,[e("button",{onClick:Re(P,["stop"]),class:ne(["p-2 rounded transition-colors flex items-center",_.value||z.value?"bg-black/10 dark:bg-white/10 text-black dark:text-white":"hover:bg-black/5 dark:hover:bg-white/10 text-neutral-600 dark:text-neutral-400 hover:text-black dark:hover:text-white"]),title:"Settings"},[w(S(Ht),{class:"w-5 h-5 flex-shrink-0"})],2),_.value?(r(),n("div",zu,[w(S(At),{width:"min-w-[200px]",shadow:{offsetX:6,offsetY:6,intensity:.4}},{default:j(()=>[e("div",Vu,[me[4]||(me[4]=e("div",{class:"text-xs font-bold text-neutral-600 dark:text-neutral-400 pb-3"}," Appearance ",-1)),e("button",{onClick:me[1]||(me[1]=Re(Q=>ue.$emit("toggle-theme"),["stop"])),class:"relative flex items-center h-7 rounded-full bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 transition-colors",title:t.isDark?"Switch to light mode":"Switch to dark mode"},[e("span",{class:ne(["absolute top-0.5 h-6 w-8 rounded-full bg-white dark:bg-black shadow-sm transition-transform duration-200",t.isDark?"translate-x-[calc(100%-2px)]":"translate-x-0.5"])},null,2),e("span",Eu,[w(S(Di),{class:ne(["w-4 h-4",t.isDark?"text-neutral-500":"text-black"])},null,8,["class"])]),e("span",Lu,[w(S(Ui),{class:ne(["w-4 h-4",t.isDark?"text-white":"text-neutral-400"])},null,8,["class"])])],8,Mu)]),e("div",Pu,[me[5]||(me[5]=e("div",{class:"text-xs font-bold text-neutral-600 dark:text-neutral-400 pb-3"}," Accent Color ",-1)),e("div",Au,[(r(!0),n(fe,null,ke(S(O),Q=>(r(),n("button",{key:Q,onClick:Re(E=>S(W)(Q),["stop"]),class:ne(["w-6 h-6 rounded-full transition-all flex items-center justify-center ring-1 ring-black/10 dark:ring-white/10",[J[Q],S(L)===Q?"ring-2 ring-black/50 dark:ring-white/50":"hover:scale-110"]]),title:Q.charAt(0).toUpperCase()+Q.slice(1)},[S(L)===Q?(r(),n("span",Du)):T("",!0)],10,ju))),128))])]),e("button",{onClick:me[2]||(me[2]=Q=>k("/settings/users")),class:ne(["flex items-center gap-3 px-4 py-2 text-sm transition-all w-full text-left",c.value==="users"?"bg-black text-white dark:bg-white dark:text-black":"hover:bg-black/5 dark:hover:bg-white/10"])},[w(S(Xi),{class:"w-4 h-4 flex-shrink-0"}),me[6]||(me[6]=e("span",{class:"whitespace-nowrap"},"Users",-1))],2),e("button",{onClick:me[3]||(me[3]=Q=>k("/settings/api-keys")),class:ne(["flex items-center gap-3 px-4 py-2 text-sm transition-all w-full text-left",c.value==="api-keys"?"bg-black text-white dark:bg-white dark:text-black":"hover:bg-black/5 dark:hover:bg-white/10"])},[w(S(tu),{class:"w-4 h-4 flex-shrink-0"}),me[7]||(me[7]=e("span",{class:"whitespace-nowrap"},"API Keys",-1))],2)]),_:1})])):T("",!0)]),e("button",{onClick:G,class:"group p-2 rounded hover:bg-red-500/10 transition-colors text-neutral-600 dark:text-neutral-400 hover:text-red-600 dark:hover:text-red-400 flex items-center",title:"Logout"},[w(S(Yi),{class:"w-5 h-5 flex-shrink-0"}),t.isCollapsed?T("",!0):(r(),n("span",Ou,"Logout"))])],2)])])],2))}}),Uu={class:"warning-banner-container"},Bu={key:0,class:"warning-banner flex items-center justify-between gap-3 px-4 py-2 bg-amber-50 dark:bg-amber-900/30 border-b border-amber-200 dark:border-amber-800 text-amber-800 dark:text-amber-200 text-sm"},Fu={class:"flex items-center gap-2"},Nu=["onClick"],qu=ve({__name:"WarningBanner",setup(t){const o=p([]),a=p(new Set),i=async()=>{if(localStorage.getItem("auth_token"))try{const h=await fetch(he("/api/diagnostics"));if(h.ok){const x=await h.json();o.value=x.warnings||[]}}catch{}},l=m=>{const h=`${m.type}:${m.details?.name||m.message}`;a.value.add(h)},u=m=>{const h=`${m.type}:${m.details?.name||m.message}`;return!a.value.has(h)},s=m=>{if(m.type==="duplicate_tool_name"){const h=m.details?.sources?.join(" and ")||"multiple sources";return`Duplicate tool name "${m.details?.name}" (defined as both ${h}). This may cause unexpected behavior.`}return m.message};return Pe(()=>{i()}),(m,h)=>(r(),n("div",Uu,[(r(!0),n(fe,null,ke(o.value,x=>(r(),n(fe,{key:`${x.type}:${x.details?.name}`},[u(x)?(r(),n("div",Bu,[e("div",Fu,[h[0]||(h[0]=e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4 flex-shrink-0",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z","clip-rule":"evenodd"})],-1)),e("span",null,C(s(x)),1)]),e("button",{onClick:c=>l(x),class:"text-amber-600 dark:text-amber-400 hover:text-amber-800 dark:hover:text-amber-200 p-1",title:"Dismiss"},[...h[1]||(h[1]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1)])],8,Nu)])):T("",!0)],64))),128))]))}}),Hu={key:2,class:"flex-1 overflow-auto my-3 mr-4 border border-neutral-300 dark:border-neutral-700 rounded-xl bg-white dark:bg-neutral-900 flex flex-col"},Wu={class:"flex-1 overflow-auto"},Ku=ve({__name:"App",setup(t){Gr();const o=ut(),a=p(!1),i=p(!1),l=U(()=>o.name!=="login"),u=()=>{a.value=!a.value},s=()=>{i.value=!i.value,i.value?(document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark")):(document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light"))};return Pe(()=>{const m=localStorage.getItem("theme");(m==="dark"||!m&&window.matchMedia("(prefers-color-scheme: dark)").matches)&&(i.value=!0,document.documentElement.classList.add("dark"))}),(m,h)=>(r(),n("div",{class:ne(["app-container relative flex h-screen font-sans bg-neutral-50/80 text-black dark:bg-black dark:text-white",{"is-dark":i.value}])},[l.value?(r(),q(Ru,{key:0,"is-collapsed":a.value,"is-dark":i.value,onToggleSidebar:u,onToggleTheme:s},null,8,["is-collapsed","is-dark"])):T("",!0),l.value?(r(),n("main",Hu,[w(qu),e("div",Wu,[w(S(tr))])])):(r(),q(S(tr),{key:1}))],2))}}),Ju=Xe(Ku,[["__scopeId","data-v-2125e5d3"]]),Yu={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Gu(t,o){return r(),n("svg",Yu,[...o[0]||(o[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10 11v6m4-6v6m5-11v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"},null,-1)])])}const Zu=Te({name:"lucide-trash-2",render:Gu}),Xu={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Qu(t,o){return r(),n("svg",Xu,[...o[0]||(o[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),e("path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"})],-1)])])}const ed=Te({name:"lucide-edit",render:Qu}),td={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function rd(t,o){return r(),n("svg",td,[...o[0]||(o[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),e("circle",{cx:"12",cy:"12",r:"3"})],-1)])])}const Kt=Te({name:"lucide-eye",render:rd}),ad={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function od(t,o){return r(),n("svg",ad,[...o[0]||(o[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m18 15l-6-6l-6 6"},null,-1)])])}const nd=Te({name:"lucide-chevron-up",render:od}),ld={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function sd(t,o){return r(),n("svg",ld,[...o[0]||(o[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 9l6 6l6-6"},null,-1)])])}const id=Te({name:"lucide-chevron-down",render:sd}),ud={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function dd(t,o){return r(),n("svg",ud,[...o[0]||(o[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m7 15l5 5l5-5M7 9l5-5l5 5"},null,-1)])])}const cd=Te({name:"lucide-chevrons-up-down",render:dd}),pd={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function md(t,o){return r(),n("svg",pd,[...o[0]||(o[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M22 12h-6l-2 3h-4l-2-3H2"}),e("path",{d:"M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11"})],-1)])])}const vd=Te({name:"lucide-inbox",render:md}),fd={key:0,class:"w-full max-w-md"},hd={class:"flex items-center justify-between p-4 border-b border-red-200 dark:border-red-900 flex-shrink-0"},gd={class:"text-xl font-bold text-red-600"},bd={class:"p-6"},xd={class:"text-neutral-700 dark:text-neutral-300 mb-6"},yd={class:"flex justify-end gap-3"},Xt=ve({__name:"ConfirmDialog",props:{modelValue:{type:Boolean},title:{default:"Confirm Action"},message:{default:"Are you sure you want to continue? You will lose any unsaved changes."},confirmText:{default:"Continue"},cancelText:{default:"Cancel"}},emits:["update:modelValue","confirm","cancel"],setup(t,{emit:o}){const a=t,i=o,l=()=>{i("update:modelValue",!1)},u=()=>{i("confirm"),l()},s=()=>{i("cancel"),l()},m=h=>{h.key==="Escape"&&a.modelValue&&s()};return ge(()=>a.modelValue,h=>{h?(document.addEventListener("keydown",m),document.body.style.overflow="hidden"):(document.removeEventListener("keydown",m),document.body.style.overflow="")}),(h,x)=>(r(),q(kt,{to:"body"},[w(et,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:j(()=>[t.modelValue?(r(),n("div",{key:0,class:"fixed inset-0 z-[60] flex items-center justify-center p-4 bg-white/80 dark:bg-black/80 backdrop-blur-sm dark:text-white",onClick:s},[w(et,{"enter-active-class":"transition-all duration-200","enter-from-class":"opacity-0 scale-95","enter-to-class":"opacity-100 scale-100","leave-active-class":"transition-all duration-200","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:j(()=>[t.modelValue?(r(),n("div",fd,[w(wt,{"offset-x":8,"offset-y":8,intensity:.35},{default:j(()=>[e("div",{class:"bg-white dark:bg-neutral-900 border border-red-400 dark:border-red-500 rounded-lg flex flex-col",onClick:x[0]||(x[0]=Re(()=>{},["stop"]))},[e("div",hd,[e("h2",gd,C(t.title),1),w(S(Br),{icon:S(Pt),label:"Close dialog",variant:"danger",onClick:s},null,8,["icon"])]),e("div",bd,[e("p",xd,C(t.message),1),e("div",yd,[w(S(De),{variant:"secondary",onClick:s},{default:j(()=>[X(C(t.cancelText),1)]),_:1}),w(S(De),{variant:"danger",onClick:u},{default:j(()=>[X(C(t.confirmText),1)]),_:1})])])])]),_:1})])):T("",!0)]),_:1})])):T("",!0)]),_:1})]))}}),kd={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function wd(t,o){return r(),n("svg",kd,[...o[0]||(o[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])])}const _d=Te({name:"lucide-chevron-right",render:wd}),$d={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Cd(t,o){return r(),n("svg",$d,[...o[0]||(o[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m11 17l-5-5l5-5m7 10l-5-5l5-5"},null,-1)])])}const Sd=Te({name:"lucide-chevrons-left",render:Cd}),Td={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Id(t,o){return r(),n("svg",Td,[...o[0]||(o[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 17l5-5l-5-5m7 10l5-5l-5-5"},null,-1)])])}const zd=Te({name:"lucide-chevrons-right",render:Id}),Vd={key:0,class:"flex flex-wrap items-center justify-between gap-4 px-4 py-2.5 text-sm bg-neutral-50 dark:bg-neutral-800/50 border-t border-neutral-300 dark:border-neutral-700"},Md={class:"text-neutral-500 dark:text-neutral-400 text-xs font-medium"},Ed={class:"text-neutral-700 dark:text-neutral-300"},Ld={class:"text-neutral-700 dark:text-neutral-300"},Pd={class:"text-neutral-700 dark:text-neutral-300"},Ad={class:"flex items-center gap-0.5"},jd=["disabled"],Dd=["disabled"],Od={class:"flex items-center gap-0.5 mx-1"},Rd={key:0,class:"px-2 text-neutral-400 dark:text-neutral-500 text-xs"},Ud=["onClick"],Bd=["disabled"],Fd=["disabled"],Nd={class:"flex items-center gap-2"},qd=["value"],Hd=["value"],Wd=ve({__name:"DataTablePagination",props:{page:{},pageSize:{},totalItems:{},pageSizeOptions:{default:()=>[10,25,50,100]}},emits:["update:page","update:pageSize"],setup(t,{emit:o}){const a=t,i=o,l=U(()=>Math.ceil(a.totalItems/a.pageSize)),u=U(()=>a.totalItems===0?0:(a.page-1)*a.pageSize+1),s=U(()=>Math.min(a.page*a.pageSize,a.totalItems)),m=U(()=>a.page>1),h=U(()=>a.page<l.value),x=U(()=>{const k=[],g=l.value,_=a.page;if(g<=7)for(let L=1;L<=g;L++)k.push(L);else{k.push(1),_>3&&k.push("...");const L=Math.max(2,_-1),O=Math.min(g-1,_+1);for(let W=L;W<=O;W++)k.includes(W)||k.push(W);_<g-2&&k.push("..."),k.includes(g)||k.push(g)}return k}),c=k=>{k>=1&&k<=l.value&&i("update:page",k)},f=()=>c(1),y=()=>c(a.page-1),b=()=>c(a.page+1),v=()=>c(l.value),d=k=>{const g=k.target;i("update:pageSize",parseInt(g.value,10)),i("update:page",1)};return(k,g)=>t.totalItems>0?(r(),n("div",Vd,[e("div",Md,[g[0]||(g[0]=X(" Showing ",-1)),e("span",Ed,C(u.value),1),g[1]||(g[1]=X(" to ",-1)),e("span",Ld,C(s.value),1),g[2]||(g[2]=X(" of ",-1)),e("span",Pd,C(t.totalItems),1)]),e("div",Ad,[e("button",{type:"button",onClick:f,disabled:!m.value,class:"p-1.5 rounded-md transition-all duration-150 hover:bg-neutral-200 dark:hover:bg-neutral-700 disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent",title:"First page"},[w(S(Sd),{class:"w-4 h-4 text-neutral-500 dark:text-neutral-400"})],8,jd),e("button",{type:"button",onClick:y,disabled:!m.value,class:"p-1.5 rounded-md transition-all duration-150 hover:bg-neutral-200 dark:hover:bg-neutral-700 disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent",title:"Previous page"},[w(S(Wr),{class:"w-4 h-4 text-neutral-500 dark:text-neutral-400"})],8,Dd),e("div",Od,[(r(!0),n(fe,null,ke(x.value,(_,L)=>(r(),n(fe,{key:L},[_==="..."?(r(),n("span",Rd," ... ")):(r(),n("button",{key:1,type:"button",onClick:O=>c(_),class:ne(["min-w-[1.75rem] px-2 py-1 rounded-md text-xs font-medium transition-all duration-150",_===t.page?"bg-accent-600 text-white shadow-sm":"text-neutral-600 dark:text-neutral-400 hover:bg-neutral-200 dark:hover:bg-neutral-700 hover:text-neutral-900 dark:hover:text-neutral-200"])},C(_),11,Ud))],64))),128))]),e("button",{type:"button",onClick:b,disabled:!h.value,class:"p-1.5 rounded-md transition-all duration-150 hover:bg-neutral-200 dark:hover:bg-neutral-700 disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent",title:"Next page"},[w(S(_d),{class:"w-4 h-4 text-neutral-500 dark:text-neutral-400"})],8,Bd),e("button",{type:"button",onClick:v,disabled:!h.value,class:"p-1.5 rounded-md transition-all duration-150 hover:bg-neutral-200 dark:hover:bg-neutral-700 disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent",title:"Last page"},[w(S(zd),{class:"w-4 h-4 text-neutral-500 dark:text-neutral-400"})],8,Fd)]),e("div",Nd,[e("select",{value:t.pageSize,onChange:d,class:"px-2 py-1 rounded-md border border-neutral-200 dark:border-neutral-700 bg-white dark:bg-neutral-800 text-xs font-medium text-neutral-700 dark:text-neutral-300 focus:outline-none focus:ring-2 focus:ring-accent-500/30 focus:border-accent-500 dark:focus:border-accent-400 cursor-pointer transition-all"},[(r(!0),n(fe,null,ke(t.pageSizeOptions,_=>(r(),n("option",{key:_,value:_},C(_),9,Hd))),128))],40,qd),g[3]||(g[3]=e("span",{class:"text-neutral-500 dark:text-neutral-400 text-xs"},"per page",-1))])])):T("",!0)}}),Kd={class:"w-full"},Jd={key:0,class:"flex flex-wrap items-start justify-between gap-4 mb-5"},Yd={class:"flex items-center gap-3"},Gd={class:"flex items-center gap-2"},Zd={key:0,class:"text-xl font-bold tracking-tight"},Xd={key:1,class:"text-xs font-mono text-neutral-400 dark:text-neutral-500"},Qd={key:0,class:"text-sm text-neutral-500 dark:text-neutral-400 mt-0.5"},ec={key:0,class:"flex items-center gap-2"},tc={key:1,class:"mb-4"},rc={class:"flex flex-wrap items-center gap-3"},ac={key:0,class:"flex-1 min-w-[200px] max-w-md"},oc={key:2,class:"flex items-center gap-2 ml-auto"},nc={class:"text-sm text-neutral-500 dark:text-neutral-400 font-medium"},lc={class:"flex items-center gap-1.5"},sc=["onClick"],ic={class:"rounded-xl border border-neutral-300 dark:border-neutral-700 overflow-hidden bg-white dark:bg-transparent"},uc={class:"overflow-x-auto"},dc={class:"w-full"},cc={class:"bg-neutral-50 dark:bg-neutral-800/50 border-b border-neutral-300 dark:border-neutral-700"},pc={key:0,class:"px-4 py-2.5 w-12"},mc={class:"flex items-center justify-center"},vc=["checked","indeterminate"],fc=["onClick"],hc={key:1,class:"px-4 py-2.5 text-right font-medium text-xs uppercase tracking-wide text-neutral-500 dark:text-neutral-400 w-24"},gc={class:"divide-y divide-neutral-200 dark:divide-neutral-800"},bc={key:0},xc=["colspan"],yc={class:"flex flex-col items-center justify-center gap-3 text-neutral-400"},kc={key:1},wc=["colspan"],_c={class:"flex flex-col items-center justify-center gap-3 text-neutral-400"},$c={class:"w-12 h-12 rounded-full bg-neutral-100 dark:bg-neutral-800 flex items-center justify-center"},Cc={class:"text-sm"},Sc=["onClick"],Tc={key:0,class:"absolute left-0 top-0 bottom-0 w-0.5 bg-accent-500"},Ic={class:"flex items-center justify-center"},zc=["checked","onChange"],Vc=["innerHTML"],Mc={class:"inline-flex gap-0.5"},Ec=["disabled","onClick","title"],Lc=["disabled","onClick","title"],ot=ve({__name:"DataTable",props:{columns:{},data:{},actions:{},emptyMessage:{default:"No data available"},loading:{type:Boolean,default:!1},title:{},description:{},primaryAction:{},sortable:{type:Boolean,default:!1},sortKey:{},sortDirection:{default:"asc"},searchable:{type:Boolean,default:!1},searchQuery:{default:""},searchPlaceholder:{default:"Search..."},paginated:{type:Boolean,default:!1},page:{default:1},pageSize:{default:10},totalItems:{default:0},pageSizeOptions:{default:()=>[10,25,50,100]},selectable:{type:Boolean,default:!1},selectedRows:{default:()=>[]},rowKey:{default:"id"},bulkActions:{default:()=>[]}},emits:["update:sortKey","update:sortDirection","sort","update:searchQuery","search","update:page","update:pageSize","page-change","update:selectedRows","selection-change","row-click"],setup(t,{emit:o}){const a=t,i=o,l=p(!1),u=p(""),s=p(null),m=I=>{if(typeof I!="string")return I;switch(I){case"edit":return ed;case"delete":return Zu;case"view":return Kt;default:return null}},h=(I,D)=>{const Z=I[D.key];return D.formatter?D.formatter(Z,I):Z??"-"},x=I=>{switch(I){case"center":return"text-center";case"right":return"text-right";default:return"text-left"}},c=(I,D)=>D.cellClass?typeof D.cellClass=="function"?D.cellClass(I):D.cellClass:"",f=async(I,D)=>{if(I.confirm){const Z=typeof I.confirmMessage=="function"?I.confirmMessage(D):I.confirmMessage||`Are you sure you want to ${I.label.toLowerCase()}?`;u.value=Z,s.value=async()=>{await I.handler(D)},l.value=!0}else await I.handler(D)},y=async()=>{s.value&&(await s.value(),s.value=null),l.value=!1},b=()=>{s.value=null,l.value=!1},v=(I,D)=>I.visible===void 0?!0:typeof I.visible=="function"?I.visible(D):I.visible,d=(I,D)=>I.disabled===void 0?!1:typeof I.disabled=="function"?I.disabled(D):I.disabled,k=p(null),g=p("asc"),_=U(()=>a.sortKey??k.value),L=U(()=>a.sortKey!==void 0?a.sortDirection:g.value),O=I=>a.sortable&&I.sortable===!0,W=I=>{if(!O(I))return;const D=I.key;let Z="asc";_.value===D&&(Z=L.value==="asc"?"desc":"asc"),k.value=D,g.value=Z,i("update:sortKey",D),i("update:sortDirection",Z),i("sort",{key:D,direction:Z})},J=I=>_.value!==I.key?cd:L.value==="asc"?nd:id,z=U(()=>{if(!_.value||!a.sortable)return $.value;const I=_.value,D=L.value;return[...$.value].sort((Z,K)=>{const oe=Z[I],se=K[I];if(oe==null&&se==null)return 0;if(oe==null)return D==="asc"?1:-1;if(se==null)return D==="asc"?-1:1;let be=0;return typeof oe=="string"&&typeof se=="string"?be=oe.localeCompare(se,void 0,{sensitivity:"base"}):typeof oe=="number"&&typeof se=="number"?be=oe-se:be=String(oe).localeCompare(String(se)),D==="asc"?be:-be})}),P=p(a.searchQuery),G=p({}),ee=zr(I=>{i("update:searchQuery",I),i("search",I)},300),ue=I=>{P.value=I,ee(I)},me=()=>{P.value="",i("update:searchQuery",""),i("search","")},Q=U(()=>a.columns.filter(I=>I.filterable===!0).map(I=>{const D=new Map;a.data.forEach(K=>{const oe=K[I.key];if(oe!=null){const se=I.formatter?I.formatter(oe,K):String(oe);if(!D.has(se)){const be=I.filterIcon?I.filterIcon(oe,K):void 0;D.set(se,{value:se,icon:be})}}});const Z=Array.from(D.entries()).sort((K,oe)=>K[0].localeCompare(oe[0]));return{key:I.key,label:I.label,options:Z.map(([K,oe])=>({value:K,label:K,icon:oe.icon}))}})),E=(I,D)=>{if(D===""){const{[I]:Z,...K}=G.value;G.value=K}else G.value={...G.value,[I]:D}},$=U(()=>{let I=a.data;const D=Object.entries(G.value);if(D.length>0&&(I=I.filter(Z=>D.every(([K,oe])=>{const se=a.columns.find(de=>de.key===K);if(!se)return!0;const be=Z[K];return be==null?!1:(se.formatter?se.formatter(be,Z):String(be))===oe}))),a.searchable&&P.value.trim()){const Z=P.value.toLowerCase().trim();I=I.filter(K=>a.columns.some(oe=>{if(oe.searchable===!1)return!1;const se=K[oe.key];return se==null?!1:(oe.formatter?oe.formatter(se,K):String(se)).toLowerCase().includes(Z)}))}return I}),V=U(()=>{let I=0;return P.value&&I++,I+=Object.keys(G.value).length,I}),te=()=>{me(),G.value={}},B=I=>I[a.rowKey],N=I=>{const D=B(I);return a.selectedRows.some(Z=>Z[a.rowKey]===D)},F=U(()=>z.value.length>0&&a.selectedRows.length===z.value.length),Y=U(()=>a.selectedRows.length>0&&a.selectedRows.length<z.value.length),R=I=>{const D=B(I);let Z;N(I)?Z=a.selectedRows.filter(K=>K[a.rowKey]!==D):Z=[...a.selectedRows,I],i("update:selectedRows",Z),i("selection-change",Z)},H=()=>{const I=F.value?[]:[...z.value];i("update:selectedRows",I),i("selection-change",I)},M=async I=>{if(I.confirm){const D=I.confirmMessage||`Are you sure you want to ${I.label.toLowerCase()} ${a.selectedRows.length} item(s)?`;u.value=D,s.value=async()=>{await I.handler(a.selectedRows)},l.value=!0}else await I.handler(a.selectedRows)},ie=I=>{i("update:page",I),i("page-change",I)},A=I=>{i("update:pageSize",I)},pe=U(()=>a.title||a.description||a.primaryAction),ce=U(()=>a.actions&&a.actions.length>0),ye=U(()=>a.actions?.filter(I=>I.variant!=="danger")||[]),Me=U(()=>a.actions?.filter(I=>I.variant==="danger")||[]),ae=U(()=>{let I=a.columns.length;return a.selectable&&I++,ce.value&&I++,I});return(I,D)=>{const Z=Be("FormKit");return r(),n("div",Kd,[pe.value?(r(),n("div",Jd,[e("div",Yd,[e("div",null,[e("div",Gd,[t.title?(r(),n("h2",Zd,C(t.title),1)):T("",!0),!t.loading&&t.data.length>0?(r(),n("span",Xd,[V.value>0&&$.value.length!==t.data.length?(r(),n(fe,{key:0},[X(" ("+C($.value.length)+" of "+C(t.data.length)+") ",1)],64)):(r(),n(fe,{key:1},[X(" ("+C(t.data.length)+") ",1)],64))])):T("",!0)]),t.description?(r(),n("p",Qd,C(t.description),1)):T("",!0)])]),t.primaryAction?(r(),n("div",ec,[je(I.$slots,"header-actions"),w(S(De),{onClick:t.primaryAction.handler},{default:j(()=>[t.primaryAction.icon?(r(),q(Ue(t.primaryAction.icon),{key:0,class:"w-4 h-4 mr-2"})):T("",!0),X(" "+C(t.primaryAction.label),1)]),_:1},8,["onClick"])])):T("",!0)])):T("",!0),t.searchable||Q.value.length>0?(r(),n("div",tc,[e("div",rc,[t.searchable?(r(),n("div",ac,[w(Z,{type:"searchInput",value:P.value,placeholder:t.searchPlaceholder,onInput:ue},null,8,["value","placeholder"])])):T("",!0),(r(!0),n(fe,null,ke(Q.value,K=>(r(),n("div",{key:K.key,class:"min-w-[220px]"},[w(Z,{type:"selectSearch",value:G.value[K.key]||"",options:K.options,placeholder:`All ${K.label}s`,onInput:oe=>E(K.key,oe)},null,8,["value","options","placeholder","onInput"])]))),128)),V.value>0?(r(),n("button",{key:1,type:"button",onClick:te,class:"px-3 py-2 text-sm font-medium text-neutral-500 hover:text-neutral-700 dark:text-neutral-400 dark:hover:text-neutral-200 transition-colors"}," Clear filters ")):T("",!0),t.selectable&&t.selectedRows.length>0&&t.bulkActions.length>0?(r(),n("div",oc,[e("span",nc,C(t.selectedRows.length)+" selected ",1),e("div",lc,[(r(!0),n(fe,null,ke(t.bulkActions,(K,oe)=>(r(),n("button",{key:oe,type:"button",onClick:se=>M(K),class:ne(["inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition-all duration-150",K.variant==="danger"?"bg-red-100 text-red-700 hover:bg-red-200 dark:bg-red-900/30 dark:text-red-400 dark:hover:bg-red-900/50":"bg-neutral-100 text-neutral-700 hover:bg-neutral-200 dark:bg-neutral-800 dark:text-neutral-300 dark:hover:bg-neutral-700"])},[(r(),q(Ue(K.icon),{class:"w-4 h-4"})),X(" "+C(K.label),1)],10,sc))),128))])])):T("",!0)])])):T("",!0),je(I.$slots,"toolbar"),e("div",ic,[e("div",uc,[e("table",dc,[e("thead",cc,[e("tr",null,[t.selectable?(r(),n("th",pc,[e("div",mc,[e("input",{type:"checkbox",checked:F.value,indeterminate:Y.value,onChange:H,class:"w-4 h-4 rounded border-neutral-300 dark:border-neutral-600 text-accent-600 focus:ring-accent-500 focus:ring-offset-0 cursor-pointer transition-colors"},null,40,vc)])])):T("",!0),(r(!0),n(fe,null,ke(t.columns,K=>(r(),n("th",{key:K.key,class:ne(["px-4 py-2.5 font-medium text-xs uppercase tracking-wide text-neutral-500 dark:text-neutral-400",x(K.align),K.width||"",O(K)?"cursor-pointer select-none group":""]),onClick:oe=>W(K)},[e("div",{class:ne(["inline-flex items-center gap-1",K.align==="right"?"flex-row-reverse":"",O(K)?"hover:text-neutral-700 dark:hover:text-neutral-200 transition-colors":""])},[e("span",null,C(K.label),1),O(K)?(r(),n("span",{key:0,class:ne(["inline-flex items-center justify-center w-5 h-5 rounded transition-all duration-150",_.value===K.key?"bg-accent-100 dark:bg-accent-900/50":"group-hover:bg-neutral-200 dark:group-hover:bg-neutral-700"])},[(r(),q(Ue(J(K)),{class:ne(["w-3.5 h-3.5",_.value===K.key?"text-accent-600 dark:text-accent-400":"text-neutral-400 dark:text-neutral-500"])},null,8,["class"]))],2)):T("",!0)],2)],10,fc))),128)),ce.value?(r(),n("th",hc," Actions ")):T("",!0)])]),e("tbody",gc,[t.loading?(r(),n("tr",bc,[e("td",{colspan:ae.value,class:"px-4 py-16"},[je(I.$slots,"loading",{},()=>[e("div",yc,[w(Ee,{size:"md"}),D[3]||(D[3]=e("span",{class:"text-sm"},"Loading data...",-1))])])],8,xc)])):z.value.length===0?(r(),n("tr",kc,[e("td",{colspan:ae.value,class:"px-4 py-16"},[je(I.$slots,"empty",{},()=>[e("div",_c,[e("div",$c,[w(S(vd),{class:"w-6 h-6"})]),e("p",Cc,C(t.emptyMessage),1),V.value>0?(r(),n("button",{key:0,onClick:te,type:"button",class:"text-xs text-accent-600 dark:text-accent-400 hover:underline font-medium"}," Clear filters ")):T("",!0)])])],8,wc)])):(r(!0),n(fe,{key:2},ke(z.value,(K,oe)=>(r(),n("tr",{key:K[t.rowKey]??oe,class:ne(["transition-all duration-150 cursor-pointer relative",N(K)?"bg-accent-50 dark:bg-accent-950/30":"hover:bg-neutral-50 dark:hover:bg-neutral-900/50"]),onClick:se=>i("row-click",K)},[N(K)?(r(),n("div",Tc)):T("",!0),t.selectable?(r(),n("td",{key:1,class:"px-4 py-3",onClick:D[0]||(D[0]=Re(()=>{},["stop"]))},[e("div",Ic,[e("input",{type:"checkbox",checked:N(K),onChange:se=>R(K),class:"w-4 h-4 rounded border-neutral-300 dark:border-neutral-600 text-accent-600 focus:ring-accent-500 focus:ring-offset-0 cursor-pointer transition-colors"},null,40,zc)])])):T("",!0),(r(!0),n(fe,null,ke(t.columns,se=>(r(),n("td",{key:se.key,class:ne(["px-4 py-3 text-sm",x(se.align),c(K,se),N(K)?"text-accent-900 dark:text-accent-100":"text-neutral-700 dark:text-neutral-300"])},[je(I.$slots,`cell-${se.key}`,{value:K[se.key],row:K,column:se},()=>[se.html?(r(),n("span",{key:0,innerHTML:h(K,se)},null,8,Vc)):(r(),n(fe,{key:1},[X(C(h(K,se)),1)],64))])],2))),128)),ce.value?(r(),n("td",{key:2,class:"px-4 py-3 text-right",onClick:D[1]||(D[1]=Re(()=>{},["stop"]))},[e("div",Mc,[(r(!0),n(fe,null,ke(ye.value,(se,be)=>Ae((r(),n("button",{key:`non-delete-${be}`,disabled:d(se,K),onClick:le=>f(se,K),class:ne(["p-1.5 rounded-md transition-all duration-150",d(se,K)?"opacity-30 cursor-not-allowed":"text-neutral-400 hover:text-neutral-700 hover:bg-neutral-100 dark:hover:text-neutral-200 dark:hover:bg-neutral-800"]),title:se.label},[(r(),q(Ue(m(se.icon)),{class:"w-4 h-4"}))],10,Ec)),[[Ke,v(se,K)]])),128)),je(I.$slots,"extra-actions",{row:K}),(r(!0),n(fe,null,ke(Me.value,(se,be)=>Ae((r(),n("button",{key:`delete-${be}`,disabled:d(se,K),onClick:le=>f(se,K),class:ne(["p-1.5 rounded-md transition-all duration-150",d(se,K)?"opacity-30 cursor-not-allowed":"text-neutral-400 hover:text-red-600 hover:bg-red-50 dark:hover:text-red-400 dark:hover:bg-red-900/30"]),title:se.label},[(r(),q(Ue(m(se.icon)),{class:"w-4 h-4"}))],10,Lc)),[[Ke,v(se,K)]])),128))])])):T("",!0)],10,Sc))),128))])])]),t.paginated?(r(),q(Wd,{key:0,page:t.page,"page-size":t.pageSize,"total-items":t.totalItems,"page-size-options":t.pageSizeOptions,"onUpdate:page":ie,"onUpdate:pageSize":A},null,8,["page","page-size","total-items","page-size-options"])):T("",!0)]),w(Xt,{modelValue:l.value,"onUpdate:modelValue":D[2]||(D[2]=K=>l.value=K),title:"Confirm Action",message:u.value,"confirm-text":"Confirm","cancel-text":"Cancel",onConfirm:y,onCancel:b},null,8,["modelValue","message"])])}}}),Pc={},Ac={xmlns:"http://www.w3.org/2000/svg",viewBox:"-12 -12 408 408",width:"1em",height:"1em",fill:"currentColor",stroke:"currentColor","stroke-width":"24","stroke-linejoin":"round","aria-hidden":"true"};function jc(t,o){return r(),n("svg",Ac,[...o[0]||(o[0]=[e("path",{d:"M384,171.75v9.75c-1.68,7.91-4.76,14.74-10.77,20.88l-113.42,115.85c-10.42,10.65-25.58,13.8-39.31,8.04-12.9-5.41-21.53-18.19-21.52-33.02l.03-43.8h-26.55c-32.35.02-67.19,7.63-94.92,24.63s-44.76,42.35-51.3,73.05c-1.42,6.68-5.61,11.51-12.38,12.08-6.37.54-11.26-3.83-13.86-9.7v-46.5c.42-1.2.55-2.61.71-4.61,7.99-103.74,94.18-186.48,198.25-192.75l.08-45.6c.02-14.6,8.87-27.11,21.33-32.38,13.91-5.89,29.05-2.63,39.51,8.05l112.3,114.71c6.23,6.36,9.94,13.03,11.82,21.33ZM211.97,223.41c7.34,0,13.01,5.78,13.01,12.84v56.98c.01,4.38,2.23,7.69,5.66,9.09,4.03,1.65,7.66.72,10.83-2.51l113.71-116.2c3.69-3.77,3.73-9.48.04-13.25l-113.69-116.21c-3.21-3.28-6.81-4.26-11.03-2.51-3.33,1.38-5.52,4.74-5.52,9.15l.03,56.96c0,7.8-5.62,13.53-13.58,13.54-48.85.09-95.31,19.31-130.18,53.54-26.49,26-45.26,59.26-51.99,96.82,34.96-40.83,86.25-56.16,137.95-58.21l44.76-.03Z"},null,-1)])])}const Dc=Xe(Pc,[["render",jc]]),Oc={},Rc={xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor"};function Uc(t,o){return r(),n("svg",Rc,[...o[0]||(o[0]=[e("path",{d:"M4 4h16v16H4V4zm2 2v12h4v-10h3v10h5V6H6z"},null,-1)])])}const Bc=Xe(Oc,[["render",Uc]]),Fc={class:"py-1"},Nc=ve({__name:"ShareDropdown",props:{packageId:{}},emits:["download","publish"],setup(t,{emit:o}){const a=o,i=p(null),l=p(null);function u(){if(!i.value||!l.value)return;const x=i.value.getBoundingClientRect();let f=x.right-160;const y=8;f<y&&(f=y),l.value.style.top=`${x.bottom+4}px`,l.value.style.left=`${f}px`}function s(){l.value&&(l.value.matches(":popover-open")?l.value.hidePopover():(u(),l.value.showPopover()))}function m(x){l.value?.hidePopover(),a(x)}function h(){l.value?.matches(":popover-open")&&u()}return Pe(()=>{window.addEventListener("scroll",h,!0),window.addEventListener("resize",h)}),Ye(()=>{window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h)}),(x,c)=>(r(),n(fe,null,[e("button",{ref_key:"triggerButton",ref:i,type:"button",onClick:s,class:"p-1.5 rounded-md transition-all duration-150 text-neutral-400 hover:text-neutral-700 hover:bg-neutral-100 dark:hover:text-neutral-200 dark:hover:bg-neutral-800",title:"Share"},[w(Dc,{class:"w-4 h-4"})],512),e("div",{ref_key:"popoverEl",ref:l,popover:"auto",class:"w-40 p-0 m-0 border-0 bg-transparent overflow-visible"},[w(S(At),{width:"w-40",shadow:{offsetX:4,offsetY:4,intensity:.3}},{default:j(()=>[e("div",Fc,[w(S(ur),{onClick:c[0]||(c[0]=f=>m("download"))},{default:j(()=>[w(S(Sa),{class:"w-4 h-4 text-neutral-500"}),c[2]||(c[2]=e("span",null,"Download",-1))]),_:1}),w(S(ur),{onClick:c[1]||(c[1]=f=>m("publish"))},{default:j(()=>[w(Bc,{class:"w-4 h-4 text-neutral-500"}),c[3]||(c[3]=e("span",null,"Publish",-1))]),_:1})])]),_:1})],512)],64))}}),qc={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Hc(t,o){return r(),n("svg",qc,[...o[0]||(o[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73zm1 .27V12"}),e("path",{d:"M3.29 7L12 12l8.71-5M7.5 4.27l9 5.15"})],-1)])])}const pr=Te({name:"lucide-package",render:Hc}),Wc={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Kc(t,o){return r(),n("svg",Wc,[...o[0]||(o[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M12 22v-9m3.17-10.79a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.66 1.66 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z"}),e("path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13"}),e("path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.64 1.64 0 0 0 1.63 0z"})],-1)])])}const Jc=Te({name:"lucide-package-open",render:Kc}),Yc={class:"flex items-center gap-2"},Gc=ve({__name:"AgentsDataTable",props:{title:{},description:{},primaryAction:{}},emits:["add","edit","delete","pack","unpack","publish"],setup(t,{expose:o,emit:a}){const i=a,l=p([]),u=p(!1),s=[{key:"title",label:"Title",width:"w-1/5",sortable:!0},{key:"type",label:"Type",width:"w-1/12",sortable:!0,formatter:b=>b==="dual_ai"?"Dual AI":"AI+Human"},{key:"side_a_agent_prompt_name",label:"Side A",width:"w-1/5",formatter:b=>b||"-"},{key:"side_b_agent_prompt_name",label:"Side B",width:"w-1/5",formatter:b=>b||"Human"},{key:"created_at",label:"Created",width:"w-1/6",sortable:!0,searchable:!1,formatter:b=>b?new Date(b*1e3).toLocaleDateString():"-"}],m=[{icon:pr,label:"Pack",handler:b=>i("pack",b),visible:b=>!b.packed},{icon:Jc,label:"Unpack",handler:b=>i("unpack",b),visible:b=>!!b.packed},{icon:"edit",label:"Edit",handler:b=>i("edit",b),visible:b=>!b.packed},{icon:"delete",label:"Delete",handler:async b=>{await x(b)},confirm:!0,confirmMessage:"Are you sure you want to delete this agent?",variant:"danger",visible:b=>!b.packed},{icon:"delete",label:"Delete Package",handler:async b=>{await c(b)},confirm:!0,confirmMessage:"Are you sure you want to delete this packed agent and all its contents?",variant:"danger",visible:b=>!!b.packed&&b.source==="local"}],h=async()=>{u.value=!0;try{const b=await fetch(he("/api/agents"));if(b.ok){const v=await b.json();l.value=v.agents||[]}}catch(b){console.error("Error fetching agents:",b)}finally{u.value=!1}},x=async b=>{try{const v=await fetch(he(`/api/agents/${encodeURIComponent(b.id)}`),{method:"DELETE"});if(v.ok)await h();else{const d=await v.json();alert(d.error||"Failed to delete agent")}}catch(v){console.error("Error deleting agent:",v),alert("Failed to delete agent")}},c=async b=>{if(b.packageId)try{const v=await fetch(he(`/api/pack/${encodeURIComponent(b.packageId)}`),{method:"DELETE"});if(v.ok)await h();else{const d=await v.json();alert(d.error||"Failed to delete packed agent")}}catch(v){console.error("Error deleting packed agent:",v),alert("Failed to delete packed agent")}},f=b=>{b.packageId&&(window.location.href=he(`/api/pack/${encodeURIComponent(b.packageId)}/download`))},y=b=>{i("publish",b)};return Pe(()=>{h()}),o({refresh:h}),(b,v)=>(r(),n("div",null,[w(ot,{title:t.title,description:t.description,"primary-action":t.primaryAction,columns:s,data:l.value,actions:m,loading:u.value,sortable:"",searchable:"","search-placeholder":"Search agents...","empty-message":"No agents available. Create your first agent to get started."},{"cell-title":j(({row:d})=>[e("div",Yc,[d.packed?(r(),q(S(pr),{key:0,class:"w-4 h-4 text-blue-500 flex-shrink-0",title:`Packed agent from ${d.packageId}`},null,8,["title"])):T("",!0),e("span",null,C(d.title),1)])]),"extra-actions":j(({row:d})=>[d.packed?(r(),q(Nc,{key:0,"package-id":d.packageId,onDownload:k=>f(d),onPublish:k=>y(d)},null,8,["package-id","onDownload","onPublish"])):T("",!0)]),_:1},8,["title","description","primary-action","data","loading"])]))}}),Zc={class:"flex items-center justify-between p-4 border-b border-neutral-200 dark:border-neutral-700 flex-shrink-0"},Xc={class:"text-xl font-bold"},Qc={key:0,class:"p-6 border-t border-neutral-200 dark:border-neutral-700 flex-shrink-0"},He=ve({__name:"Modal",props:{modelValue:{type:Boolean},title:{},width:{default:"max-w-lg"},minHeight:{default:"min-h-[24rem]"},hasChanges:{type:Boolean,default:void 0},contentPadding:{type:Boolean,default:!0}},emits:["update:modelValue","close"],setup(t,{emit:o}){const a=t,i=o,l=p(),u=p(!1),s=p(new Map),m=()=>l.value&&(l.value.querySelector("input")||l.value.querySelector("textarea")||l.value.querySelector("select")||l.value.querySelector("[contenteditable]")||l.value.querySelector(".monaco-editor")),h=()=>{if(!l.value)return;l.value.querySelectorAll(".monaco-editor-container").forEach(W=>{const J=W.__monacoEditor;if(J&&typeof J.getValue=="function"){const z=J.getValue();s.value.set(W,z)}})},x=()=>{if(!l.value)return!1;const O=l.value.querySelectorAll(".monaco-editor-container");for(const W of O){const J=W.__monacoEditor;if(J&&typeof J.getValue=="function"){const z=J.getValue(),P=s.value.get(W);if(P===void 0||(J.getRawOptions?.()||{}).readOnly===!0)continue;if(z!==P)return!0}}return!1},c=O=>{const W=O;return W.type==="checkbox"||W.type==="radio"?W.checked!==W.defaultChecked:(W.tagName==="SELECT",W.value!==W.defaultValue)},f=()=>{if(a.hasChanges!==void 0)return a.hasChanges;if(!l.value)return!1;if(x())return!0;const O=l.value.querySelectorAll("input, textarea, select");for(const W of O)if(c(W))return!0;return!1},y=()=>{m()&&f()?u.value=!0:b()},b=()=>{i("update:modelValue",!1),i("close")},v=()=>{u.value=!1,b()},d=()=>{u.value=!1},k=O=>{O.key==="Escape"&&a.modelValue&&(m()||b())};ge(()=>a.modelValue,async O=>{O?(document.addEventListener("keydown",k),document.body.style.overflow="hidden",await Le(),setTimeout(()=>{h()},100)):(document.removeEventListener("keydown",k),document.body.style.overflow="",s.value.clear())});const g=p(!1),_=O=>{g.value=O.target===O.currentTarget},L=O=>{O.target===O.currentTarget&&g.value&&(m()||b()),g.value=!1};return(O,W)=>(r(),q(kt,{to:"body"},[w(et,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:j(()=>[t.modelValue?(r(),n("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-white/80 dark:bg-black/80 backdrop-blur-sm dark:text-white",onMousedown:_,onClick:L},[w(et,{"enter-active-class":"transition-all duration-200","enter-from-class":"opacity-0 scale-95","enter-to-class":"opacity-100 scale-100","leave-active-class":"transition-all duration-200","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:j(()=>[t.modelValue?(r(),n("div",{key:0,class:ne(["w-full",t.width,"max-h-[85vh] flex flex-col"])},[w(wt,{"offset-x":8,"offset-y":8,intensity:.35},{default:j(()=>[e("div",{ref_key:"modalRef",ref:l,class:ne(["bg-white dark:bg-neutral-900 border border-neutral-300 dark:border-neutral-600 rounded-lg flex flex-col max-h-[85vh]",t.minHeight])},[e("div",Zc,[e("h2",Xc,C(t.title),1),w(S(Br),{icon:S(Pt),label:"Close modal",variant:"ghost",onClick:y},null,8,["icon"])]),e("div",{class:ne(["flex-1 min-h-0",t.contentPadding?"overflow-y-auto p-6":"overflow-hidden flex flex-col"])},[je(O.$slots,"default")],2),O.$slots.footer?(r(),n("div",Qc,[je(O.$slots,"footer")])):T("",!0)],2)]),_:3})],2)):T("",!0)]),_:3})],32)):T("",!0)]),_:3}),w(Xt,{modelValue:u.value,"onUpdate:modelValue":W[0]||(W[0]=J=>u.value=J),title:"Unsaved Changes",message:"You have unsaved changes that will be lost. Are you sure you want to close?","confirm-text":"Close Anyway","cancel-text":"Keep Editing",onConfirm:v,onCancel:d},null,8,["modelValue"])]))}}),e0=["id"],t0={class:"px-5 py-3 border-b border-neutral-100 dark:border-neutral-800"},r0={class:"text-sm font-semibold text-neutral-900 dark:text-neutral-100 flex items-center gap-2"},a0={class:"p-5"},o0={key:0,class:"px-5 py-3 border-t border-neutral-100 dark:border-neutral-800 bg-neutral-50 dark:bg-neutral-800/50"},rt=ve({__name:"ModalCard",props:{id:{},title:{},icon:{}},setup(t){return(o,a)=>(r(),n("section",{id:t.id,class:"bg-white dark:bg-neutral-900 rounded-lg border border-neutral-200 dark:border-neutral-700 overflow-hidden"},[e("div",t0,[e("h3",r0,[t.icon?(r(),q(Ue(t.icon),{key:0,class:"w-4 h-4 text-neutral-500"})):T("",!0),X(" "+C(t.title),1)])]),e("div",a0,[je(o.$slots,"default")]),o.$slots.footer?(r(),n("div",o0,[je(o.$slots,"footer")])):T("",!0)],8,e0))}}),n0={class:"flex flex-col gap-1 px-2"},l0=["onClick"],s0={class:"whitespace-nowrap overflow-hidden text-ellipsis"},Qr=ve({__name:"ModalTabs",props:{tabs:{},activeTab:{}},emits:["select"],setup(t,{emit:o}){const a=o;return(i,l)=>(r(),n("div",n0,[(r(!0),n(fe,null,ke(t.tabs,u=>(r(),n("button",{key:u.id,type:"button",onClick:Re(s=>a("select",u.id),["prevent"]),class:ne(["flex items-center gap-3 px-3 py-2.5 rounded text-sm font-medium transition-all w-full text-left",t.activeTab===u.id?"bg-black text-white dark:bg-white dark:text-black":"text-neutral-600 dark:text-neutral-400 hover:bg-black/5 dark:hover:bg-white/10"])},[(r(),q(Ue(u.icon),{class:"w-4 h-4 flex-shrink-0"})),e("span",s0,C(u.label),1)],10,l0))),128))]))}}),i0={class:"text-sm font-semibold text-neutral-900 dark:text-neutral-100 pl-3 border-l-2 border-neutral-300 dark:border-neutral-600"},xt=ve({__name:"ModalSubHeader",props:{title:{}},setup(t){return(o,a)=>(r(),n("h4",i0,C(t.title),1))}});function ea(t,o){const a=p(o[0]),i=()=>{const u=t.value;if(!u)return;const s=o.filter(f=>document.getElementById(`section-${f}`)!==null);if(s.length===0)return;if(u.scrollHeight-u.scrollTop-u.clientHeight<50){a.value=s[s.length-1];return}const h=u.getBoundingClientRect(),x=h.top+h.height*.3;let c=s[0];for(const f of s)document.getElementById(`section-${f}`).getBoundingClientRect().top<=x&&(c=f);a.value=c},l=u=>{const s=document.getElementById(`section-${u}`);if(s&&t.value){const m=t.value.getBoundingClientRect().top,h=s.getBoundingClientRect().top,x=t.value.scrollTop+(h-m);t.value.scrollTo({top:x,behavior:"smooth"})}};return ge(t,(u,s)=>{s&&s.removeEventListener("scroll",i),u&&(u.addEventListener("scroll",i),i())}),Vr(()=>{t.value?.removeEventListener("scroll",i)}),{activeTab:a,scrollToSection:l}}const u0={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function d0(t,o){return r(),n("svg",u0,[...o[0]||(o[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),e("path",{d:"M14 2v4a2 2 0 0 0 2 2h4M10 9H8m8 4H8m8 4H8"})],-1)])])}const Lt=Te({name:"lucide-file-text",render:d0}),c0={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function p0(t,o){return r(),n("svg",c0,[...o[0]||(o[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}),e("circle",{cx:"12",cy:"7",r:"4"})],-1)])])}const mr=Te({name:"lucide-user",render:p0}),m0={key:0,class:"min-h-[500px] flex items-center justify-center"},v0={class:"flex flex-1 min-h-0"},f0={class:"w-44 flex-shrink-0 border-r border-neutral-200 dark:border-neutral-700 py-4"},h0={class:"space-y-4"},g0={class:"space-y-5"},b0={class:"grid grid-cols-2 gap-4"},x0={key:0},y0={key:1},k0={key:2},w0={class:"space-y-5"},_0={class:"grid grid-cols-2 gap-4"},$0={class:"space-y-4 pt-4 border-t border-neutral-100 dark:border-neutral-800"},C0={key:0,class:"ml-6 mt-3 space-y-3"},S0={key:2},T0={class:"grid grid-cols-2 gap-4 pt-4 border-t border-neutral-100 dark:border-neutral-800"},I0={class:"space-y-5"},z0={class:"grid grid-cols-2 gap-4"},V0={class:"space-y-4 pt-4 border-t border-neutral-100 dark:border-neutral-800"},M0={key:0,class:"ml-6 mt-3 space-y-3"},E0={key:2},L0={class:"grid grid-cols-2 gap-4 pt-4 border-t border-neutral-100 dark:border-neutral-800"},P0={class:"space-y-3"},A0={key:0,class:"text-xs text-neutral-500"},j0={class:"flex justify-between"},D0=ve({__name:"AgentModal",props:{modelValue:{type:Boolean},editAgent:{},mode:{},apiError:{}},emits:["update:modelValue","save"],setup(t,{emit:o}){const a=t,i=o,l=U(()=>a.mode==="edit"),u=p(!1),s=p(null),m=["basics","side-a","side-b","env"],{activeTab:h,scrollToSection:x}=ea(s,m),c=U(()=>{const $e=[{id:"basics",label:"Basics",icon:Lt},{id:"side-a",label:"Side A",icon:mt},{id:"side-b",label:"Side B",icon:d.value==="ai_human"?mr:mt}];return(I.value.length>0||Object.keys(D.value).length>0)&&$e.push({id:"env",label:"Environment",icon:Ht}),$e}),f=p(""),y=p(""),b=p(""),v=p(""),d=p("dual_ai"),k=p(!1),g=p(""),_=p(""),L=p(null),O=p(""),W=p(""),J=p(""),z=p(""),P=p(!0),G=p(!1),ee=p(""),ue=p(""),me=p(""),Q=p(""),E=p(!1),$=p(null),V=p(""),te=p(""),B=p(""),N=p(""),F=p(""),Y=p(""),R=p(!0),H=p(!1),M=p(""),ie=p(""),A=p(""),pe=p(""),ce=p(null),ye=p(""),Me=p(""),ae=p(""),I=p([]),D=p({}),Z=p(!1),{data:K,execute:oe}=Ne(he("/api/prompts"),{immediate:!1}).json(),{data:se,execute:be}=Ne(he("/api/tools?schema=true"),{immediate:!1}).json(),le=p(null),de=p(!1),ze=p(null),we=p(!1),_e=p(!1),xe=U(()=>{if(!K.value)return[{value:"",label:"Select a prompt..."}];const $e=K.value?.prompts||[];return[{value:"",label:"None"},...$e.map(re=>({value:re.id,label:re.name}))]}),Ve=$e=>se.value?se.value[$e]:null,We=U(()=>!le.value||!le.value.tools?[{value:"",label:"None"}]:[{value:"",label:"None"},...le.value.tools.map($e=>{const re=typeof $e=="string"?$e:$e.name;return{value:re,label:re}})]),$t=U(()=>!ze.value||!ze.value.tools?[{value:"",label:"None"}]:[{value:"",label:"None"},...ze.value.tools.map($e=>{const re=typeof $e=="string"?$e:$e.name;return{value:re,label:re}})]),ia=U(()=>{if(!ee.value)return[];const $e=Ve(ee.value);return!$e||!$e.schema||!$e.schema.properties?[]:Object.keys($e.schema.properties).map(re=>({value:re,label:re}))}),ua=U(()=>{if(!M.value)return[];const $e=Ve(M.value);return!$e||!$e.schema||!$e.schema.properties?[]:Object.keys($e.schema.properties).map(re=>({value:re,label:re}))}),Ot=async()=>{const $e=[J.value,F.value].filter(Boolean);if($e.length===0){I.value=[];return}Z.value=!0;try{const re=[],Ce=new Set;for(const Se of $e){const qe=await Je(`/prompts/${encodeURIComponent(Se)}/tenvs`);if(qe.ok){const Rt=await qe.json();for(const at of Rt.tenvs||[])Ce.has(at.name)||(Ce.add(at.name),re.push({name:at.name,value:at.value,required:at.required,description:at.description,source:at.source}))}}I.value=re}catch(re){console.error("Error fetching tenvs from prompts:",re),I.value=[]}finally{Z.value=!1}},da=[{value:"dual_ai",label:"AI + AI (Subagent)"},{value:"ai_human",label:"AI + Human"}],ca=$e=>{let re=$e.toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_]/g,"");return!re.endsWith("_agent")&&re.length>0&&(re=re+"_agent"),re},pa=$e=>!$e||$e==="_agent"?(b.value="Name is required",!1):/^[a-z][a-z0-9_]*_agent$/.test($e)?(b.value="",!0):(b.value="Name must start with a letter",!1),Ct=()=>{y.value="",f.value="",b.value="",v.value="",d.value="dual_ai",k.value=!1,g.value="",_.value="",L.value=null,O.value="",W.value="",J.value="",z.value="",P.value=!0,G.value=!1,ee.value="",ue.value="",me.value="",Q.value="",E.value=!1,$.value=null,V.value="",te.value="",B.value="",le.value=null,N.value="",F.value="",Y.value="",R.value=!0,H.value=!1,M.value="",ie.value="",A.value="",pe.value="",ce.value=null,ye.value="",Me.value="",ae.value="",ze.value=null,I.value=[],D.value={}},ma=async()=>{if(a.editAgent?.id){u.value=!0,_e.value=!0;try{const $e=await fetch(he(`/api/agents/${encodeURIComponent(a.editAgent.id)}`));if($e.ok){const re=await $e.json(),Ce=re.agent||re;y.value=Ce.name||"",f.value=Ce.name||"",v.value=Ce.title||"",d.value=Ce.type||"dual_ai",k.value=Ce.expose_as_tool||!1,g.value=Ce.tool_description||"",L.value=Ce.max_session_turns;const Se=Ce.side_a_stop_tool||"",qe=Ce.side_a_stop_tool_response_property||"",Rt=Ce.side_b_stop_tool||"",at=Ce.side_b_stop_tool_response_property||"",ha=Ce.side_a_end_conversation_tool||"",ga=Ce.side_b_end_conversation_tool||"";W.value=Ce.side_a_label||"",N.value=Ce.side_b_label||"",J.value=Ce.side_a_agent_prompt||"",F.value=Ce.side_b_agent_prompt||"",P.value=!!Ce.side_a_stop_on_response,G.value=!!Ce.side_a_stop_tool,E.value=!!Ce.side_a_manual_stop_condition,$.value=Ce.side_a_max_steps,R.value=!!Ce.side_b_stop_on_response,H.value=!!Ce.side_b_stop_tool,ce.value=Ce.side_b_max_steps,await Le(),ee.value=Se,me.value=qe,M.value=Rt,A.value=at,te.value=ha,Me.value=ga,Ce.tenvs&&typeof Ce.tenvs=="object"&&(D.value=Ce.tenvs),await Ot()}}catch($e){console.error("Error loading agent data:",$e)}finally{u.value=!1,_e.value=!1}}},va=async()=>{b.value="",O.value="",z.value="",ue.value="",Q.value="",V.value="",B.value="",Y.value="",ie.value="",pe.value="",ye.value="",ae.value="";let $e=!1;pa(y.value)||($e=!0);const re=y.value;d.value==="dual_ai"&&L.value!==null&&L.value!==void 0&&L.value<=0&&(O.value="Max session turns must be a positive number",$e=!0),J.value||(z.value="Please select an agent prompt",$e=!0);const Ce=P.value||ee.value,Se=d.value==="ai_human"&&E.value;if(!Ce&&!Se&&(z.value="At least one stop condition is required (or check manual stop condition for ai_human agents)",$e=!0),ee.value&&!me.value&&(Q.value="Response property required when using stop tool",$e=!0),$.value!==null&&$.value<=0&&(V.value="Max steps must be a positive number",$e=!0),d.value==="dual_ai"&&!te.value&&!Me.value&&(B.value="At least one side must have an end conversation tool",ae.value="At least one side must have an end conversation tool",$e=!0),d.value==="dual_ai"&&(F.value||(Y.value="Please select an agent prompt",$e=!0),M.value&&!A.value&&(pe.value="Response property required when using stop tool",$e=!0),ce.value!==null&&ce.value<=0&&(ye.value="Max steps must be a positive number",$e=!0)),$e)return;const qe={name:re,title:v.value||null,type:d.value,expose_as_tool:k.value,tool_description:k.value?g.value:null,max_session_turns:d.value==="dual_ai"?L.value:null,side_a_label:W.value||null,side_a_agent_prompt:J.value,side_a_stop_on_response:P.value,side_a_stop_tool:ee.value||null,side_a_stop_tool_response_property:me.value||null,side_a_manual_stop_condition:E.value,side_a_max_steps:$.value,side_a_end_conversation_tool:te.value||null};d.value==="dual_ai"&&(qe.side_b_label=N.value||null,qe.side_b_agent_prompt=F.value,qe.side_b_stop_on_response=R.value,qe.side_b_stop_tool=M.value||null,qe.side_b_stop_tool_response_property=A.value||null,qe.side_b_max_steps=ce.value,qe.side_b_end_conversation_tool=Me.value||null),Object.keys(D.value).length>0&&(qe.tenvs=D.value),l.value&&a.editAgent?.id&&(qe.id=a.editAgent.id),i("save",qe)},fa=()=>{Ct(),i("update:modelValue",!1)};return ge(J,async $e=>{if(_e.value||(ee.value="",me.value=""),!$e){le.value=null;return}de.value=!0;try{const re=await fetch(he(`/api/prompts/${encodeURIComponent($e)}`));re.ok&&(le.value=await re.json())}catch(re){console.error("Error fetching Side A prompt:",re)}finally{de.value=!1}_e.value||await Ot()}),ge(F,async $e=>{if(_e.value||(M.value="",A.value=""),!$e){ze.value=null;return}we.value=!0;try{const re=await fetch(he(`/api/prompts/${encodeURIComponent($e)}`));re.ok&&(ze.value=await re.json())}catch(re){console.error("Error fetching Side B prompt:",re)}finally{we.value=!1}_e.value||await Ot()}),ge(G,$e=>{$e||(ee.value="",me.value="")}),ge(H,$e=>{$e||(M.value="",A.value="")}),ge(()=>a.modelValue,async $e=>{$e?(await Promise.all([oe(),be()]),l.value?(Ct(),await ma()):Ct()):Ct()}),($e,re)=>{const Ce=Be("FormKit");return r(),q(He,{"model-value":t.modelValue,"onUpdate:modelValue":re[26]||(re[26]=Se=>$e.$emit("update:modelValue",Se)),title:l.value?"Edit Agent":"Create Agent",width:"max-w-5xl","content-padding":!1},{footer:j(()=>[e("div",j0,[w(S(De),{variant:"ghost",size:"sm",onClick:fa},{default:j(()=>[...re[55]||(re[55]=[X(" Cancel ",-1)])]),_:1}),w(S(De),{variant:"primary",size:"sm",disabled:u.value,loading:u.value,onClick:va},{default:j(()=>[X(C(l.value?"Update Agent":"Create Agent"),1)]),_:1},8,["disabled","loading"])])]),default:j(()=>[u.value?(r(),n("div",m0,[...re[27]||(re[27]=[e("span",{class:"text-neutral-500"},"Loading agent data...",-1)])])):(r(),q(Ce,{key:1,type:"form",actions:!1,"form-class":"$reset flex-1 min-h-0 flex flex-col"},{default:j(()=>[e("div",v0,[e("nav",f0,[w(S(Qr),{tabs:c.value,"active-tab":S(h),onSelect:S(x)},null,8,["tabs","active-tab","onSelect"])]),e("div",{ref_key:"contentRef",ref:s,class:"flex-1 overflow-y-auto p-5 bg-neutral-100 dark:bg-neutral-950"},[e("div",h0,[t.apiError?(r(),q(S(Fe),{key:0,variant:"error"},{default:j(()=>[X(C(t.apiError),1)]),_:1})):T("",!0),w(S(rt),{id:"section-basics",title:"Basics",icon:S(Lt)},{default:j(()=>[e("div",g0,[e("div",null,[w(Ce,{type:"text",modelValue:y.value,"onUpdate:modelValue":re[0]||(re[0]=Se=>y.value=Se),label:"Agent Name",disabled:l.value,validation:"required","validation-messages":{required:"Name is required"},"outer-class":"$reset",onBlur:re[1]||(re[1]=Se=>y.value=ca(y.value))},null,8,["modelValue","disabled"]),b.value?(r(),q(S(Ie),{key:0,class:"mt-1 text-red-600 dark:text-red-400"},{default:j(()=>[X(C(b.value),1)]),_:1})):l.value?(r(),q(S(Ie),{key:2,class:"mt-1"},{default:j(()=>[...re[29]||(re[29]=[X(" Agent names cannot be changed after creation (used as foreign key for threads) ",-1)])]),_:1})):(r(),q(S(Ie),{key:1,class:"mt-1"},{default:j(()=>[...re[28]||(re[28]=[X(" Automatically formatted to snake_case with _agent suffix (e.g., research_agent) ",-1)])]),_:1}))]),e("div",b0,[e("div",null,[w(Ce,{type:"text",modelValue:v.value,"onUpdate:modelValue":re[2]||(re[2]=Se=>v.value=Se),label:"Display Title (Optional)","outer-class":"$reset"},null,8,["modelValue"]),w(S(Ie),{class:"mt-1"},{default:j(()=>[...re[30]||(re[30]=[X(" Human-readable title shown in the UI ",-1)])]),_:1})]),e("div",null,[w(Ce,{type:"selectSearch",modelValue:d.value,"onUpdate:modelValue":re[3]||(re[3]=Se=>d.value=Se),label:"Agent Type",options:da,"outer-class":"$reset"},null,8,["modelValue"]),w(S(Ie),{class:"mt-1"},{default:j(()=>[...re[31]||(re[31]=[X(" AI + AI or AI + Human conversation ",-1)])]),_:1})])]),d.value==="dual_ai"?(r(),n("div",x0,[w(Ce,{type:"checkbox",modelValue:k.value,"onUpdate:modelValue":re[4]||(re[4]=Se=>k.value=Se),label:"Expose as Tool","outer-class":"$reset"},null,8,["modelValue"]),w(S(Ie),{class:"mt-1"},{default:j(()=>[...re[32]||(re[32]=[X(" Make this subagent available as a tool that can be called by other prompts or agents ",-1)])]),_:1})])):T("",!0),k.value&&d.value==="dual_ai"?(r(),n("div",y0,[w(Ce,{type:"textarea",modelValue:g.value,"onUpdate:modelValue":re[5]||(re[5]=Se=>g.value=Se),label:"Tool Description",placeholder:"Describe what this agent does when called as a tool",rows:3,"outer-class":"$reset"},null,8,["modelValue"]),_.value?(r(),q(S(Ie),{key:0,class:"mt-1 text-red-600 dark:text-red-400"},{default:j(()=>[X(C(_.value),1)]),_:1})):(r(),q(S(Ie),{key:1,class:"mt-1"},{default:j(()=>[...re[33]||(re[33]=[X(" This description helps other agents understand when to use this agent ",-1)])]),_:1}))])):T("",!0),d.value==="dual_ai"?(r(),n("div",k0,[w(Ce,{type:"number",modelValue:L.value,"onUpdate:modelValue":re[6]||(re[6]=Se=>L.value=Se),label:"Max Session Turns",placeholder:"Unlimited","outer-class":"$reset"},null,8,["modelValue"]),O.value?(r(),q(S(Ie),{key:0,class:"mt-1 text-red-600 dark:text-red-400"},{default:j(()=>[X(C(O.value),1)]),_:1})):(r(),q(S(Ie),{key:1,class:"mt-1"},{default:j(()=>[...re[34]||(re[34]=[X(" Maximum number of back-and-forth exchanges between the two agents before the conversation ends ",-1)])]),_:1}))])):T("",!0)])]),_:1},8,["icon"]),w(S(rt),{id:"section-side-a",title:"Side A (AI)",icon:S(mt)},{default:j(()=>[e("div",w0,[e("div",_0,[e("div",null,[w(Ce,{type:"text",modelValue:W.value,"onUpdate:modelValue":re[7]||(re[7]=Se=>W.value=Se),label:"Side Label (Optional)",placeholder:"e.g., ATC, Pilot, Customer","outer-class":"$reset"},null,8,["modelValue"]),w(S(Ie),{class:"mt-1"},{default:j(()=>[...re[35]||(re[35]=[X(" Custom label for this side ",-1)])]),_:1})]),e("div",null,[w(Ce,{type:"selectSearch",modelValue:J.value,"onUpdate:modelValue":re[8]||(re[8]=Se=>J.value=Se),label:"Agent Prompt",options:xe.value,validation:"required","validation-messages":{required:"Please select an agent prompt"},"outer-class":"$reset"},null,8,["modelValue","options"]),z.value?(r(),q(S(Ie),{key:0,class:"mt-1 text-red-600 dark:text-red-400"},{default:j(()=>[X(C(z.value),1)]),_:1})):(r(),q(S(Ie),{key:1,class:"mt-1"},{default:j(()=>[...re[36]||(re[36]=[X(" Defines this agent's behavior ",-1)])]),_:1}))])]),e("div",$0,[w(S(xt),{title:"Stop Conditions"}),w(S(Ie),null,{default:j(()=>[...re[37]||(re[37]=[X(" Optional. If no stop conditions are set, the agent will continue until programmatically stopped or end conversation tool is called. ",-1)])]),_:1}),e("div",null,[w(Ce,{type:"checkbox",modelValue:P.value,"onUpdate:modelValue":re[9]||(re[9]=Se=>P.value=Se),label:"Stop when agent returns content","outer-class":"$reset"},null,8,["modelValue"]),w(S(Ie),{class:"ml-6"},{default:j(()=>[...re[38]||(re[38]=[X(" Agent stops when it returns a response without calling tools ",-1)])]),_:1})]),e("div",null,[w(Ce,{type:"checkbox",modelValue:G.value,"onUpdate:modelValue":re[10]||(re[10]=Se=>G.value=Se),label:"Stop on specific tool call","outer-class":"$reset"},null,8,["modelValue"]),G.value?(r(),n("div",C0,[w(Ce,{type:"selectSearch",modelValue:ee.value,"onUpdate:modelValue":re[11]||(re[11]=Se=>ee.value=Se),label:"Stop Tool",options:We.value,placeholder:"Select a tool...",disabled:de.value||!J.value,"outer-class":"$reset"},null,8,["modelValue","options","disabled"]),ue.value?(r(),q(S(Ie),{key:0,class:"text-red-600 dark:text-red-400"},{default:j(()=>[X(C(ue.value),1)]),_:1})):(r(),q(S(Ie),{key:1},{default:j(()=>[...re[39]||(re[39]=[X(" Agent stops when this tool is called ",-1)])]),_:1})),ee.value?(r(),n("div",S0,[w(Ce,{type:"selectSearch",modelValue:me.value,"onUpdate:modelValue":re[12]||(re[12]=Se=>me.value=Se),label:"Response Property",options:ia.value,placeholder:"Select property...","outer-class":"$reset"},null,8,["modelValue","options"]),Q.value?(r(),q(S(Ie),{key:0,class:"mt-1 text-red-600 dark:text-red-400"},{default:j(()=>[X(C(Q.value),1)]),_:1})):(r(),q(S(Ie),{key:1,class:"mt-1"},{default:j(()=>[...re[40]||(re[40]=[X(" Property from tool arguments to return as final response ",-1)])]),_:1}))])):T("",!0)])):T("",!0)]),d.value==="ai_human"&&!P.value&&!G.value?(r(),q(S(Fe),{key:0,variant:"warning",class:"mt-3"},{default:j(()=>[w(Ce,{type:"checkbox",modelValue:E.value,"onUpdate:modelValue":re[13]||(re[13]=Se=>E.value=Se),label:"I have manually implemented a stop condition","outer-class":"$reset"},null,8,["modelValue"]),re[41]||(re[41]=e("p",{class:"mt-2 text-xs"}," Warning: Only check this if you have implemented a custom stop condition in your code (e.g., via hooks or custom logic). Without a stop condition, the agent may run indefinitely. ",-1))]),_:1})):T("",!0)]),e("div",T0,[e("div",null,[w(Ce,{type:"number",modelValue:$.value,"onUpdate:modelValue":re[14]||(re[14]=Se=>$.value=Se),label:"Max Steps",placeholder:"Unlimited","outer-class":"$reset"},null,8,["modelValue"]),V.value?(r(),q(S(Ie),{key:0,class:"mt-1 text-red-600 dark:text-red-400"},{default:j(()=>[X(C(V.value),1)]),_:1})):(r(),q(S(Ie),{key:1,class:"mt-1"},{default:j(()=>[...re[42]||(re[42]=[X(" Safety limit before yielding ",-1)])]),_:1}))]),e("div",null,[w(Ce,{type:"selectSearch",modelValue:te.value,"onUpdate:modelValue":re[15]||(re[15]=Se=>te.value=Se),label:"End Conversation Tool",options:We.value,placeholder:"Select a tool...",disabled:de.value||!J.value,"outer-class":"$reset"},null,8,["modelValue","options","disabled"]),B.value?(r(),q(S(Ie),{key:0,class:"mt-1 text-red-600 dark:text-red-400"},{default:j(()=>[X(C(B.value),1)]),_:1})):(r(),q(S(Ie),{key:1,class:"mt-1"},{default:j(()=>[...re[43]||(re[43]=[X(" Ends entire conversation when called ",-1)])]),_:1}))])])])]),_:1},8,["icon"]),w(S(rt),{id:"section-side-b",title:d.value==="ai_human"?"Side B (Human)":"Side B (AI)",icon:d.value==="ai_human"?S(mr):S(mt)},{default:j(()=>[e("div",I0,[d.value==="ai_human"?(r(),n(fe,{key:0},[e("div",null,[w(Ce,{type:"text",modelValue:N.value,"onUpdate:modelValue":re[16]||(re[16]=Se=>N.value=Se),label:"Side Label (Optional)",placeholder:"e.g., Customer, User","outer-class":"$reset"},null,8,["modelValue"]),w(S(Ie),{class:"mt-1"},{default:j(()=>[...re[44]||(re[44]=[X(" Custom label for this side ",-1)])]),_:1})]),re[45]||(re[45]=e("div",{class:"flex flex-col items-center justify-center py-8 bg-neutral-50 dark:bg-neutral-800/50 rounded-lg"},[e("svg",{class:"w-16 h-16 mb-4 text-neutral-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})]),e("h5",{class:"font-medium text-lg mb-2 text-neutral-700 dark:text-neutral-300"},"Human User"),e("p",{class:"text-sm text-neutral-500 dark:text-neutral-400 text-center max-w-xs"}," This side of the conversation will be handled by a human user through the interface ")],-1))],64)):(r(),n(fe,{key:1},[e("div",z0,[e("div",null,[w(Ce,{type:"text",modelValue:N.value,"onUpdate:modelValue":re[17]||(re[17]=Se=>N.value=Se),label:"Side Label (Optional)",placeholder:"e.g., ATC, Pilot, Customer","outer-class":"$reset"},null,8,["modelValue"]),w(S(Ie),{class:"mt-1"},{default:j(()=>[...re[46]||(re[46]=[X(" Custom label for this side ",-1)])]),_:1})]),e("div",null,[w(Ce,{type:"selectSearch",modelValue:F.value,"onUpdate:modelValue":re[18]||(re[18]=Se=>F.value=Se),label:"Agent Prompt",options:xe.value,validation:"required","validation-messages":{required:"Please select an agent prompt"},"outer-class":"$reset"},null,8,["modelValue","options"]),Y.value?(r(),q(S(Ie),{key:0,class:"mt-1 text-red-600 dark:text-red-400"},{default:j(()=>[X(C(Y.value),1)]),_:1})):(r(),q(S(Ie),{key:1,class:"mt-1"},{default:j(()=>[...re[47]||(re[47]=[X(" Defines this agent's behavior ",-1)])]),_:1}))])]),e("div",V0,[w(S(xt),{title:"Stop Conditions"}),w(S(Ie),null,{default:j(()=>[...re[48]||(re[48]=[X(" Optional. If no stop conditions are set, the agent will continue until programmatically stopped or end conversation tool is called. ",-1)])]),_:1}),e("div",null,[w(Ce,{type:"checkbox",modelValue:R.value,"onUpdate:modelValue":re[19]||(re[19]=Se=>R.value=Se),label:"Stop when agent returns content","outer-class":"$reset"},null,8,["modelValue"]),w(S(Ie),{class:"ml-6"},{default:j(()=>[...re[49]||(re[49]=[X(" Agent stops when it returns a response without calling tools ",-1)])]),_:1})]),e("div",null,[w(Ce,{type:"checkbox",modelValue:H.value,"onUpdate:modelValue":re[20]||(re[20]=Se=>H.value=Se),label:"Stop on specific tool call","outer-class":"$reset"},null,8,["modelValue"]),H.value?(r(),n("div",M0,[w(Ce,{type:"selectSearch",modelValue:M.value,"onUpdate:modelValue":re[21]||(re[21]=Se=>M.value=Se),label:"Stop Tool",options:$t.value,placeholder:"Select a tool...",disabled:we.value||!F.value,"outer-class":"$reset"},null,8,["modelValue","options","disabled"]),ie.value?(r(),q(S(Ie),{key:0,class:"text-red-600 dark:text-red-400"},{default:j(()=>[X(C(ie.value),1)]),_:1})):(r(),q(S(Ie),{key:1},{default:j(()=>[...re[50]||(re[50]=[X(" Agent stops when this tool is called ",-1)])]),_:1})),M.value?(r(),n("div",E0,[w(Ce,{type:"selectSearch",modelValue:A.value,"onUpdate:modelValue":re[22]||(re[22]=Se=>A.value=Se),label:"Response Property",options:ua.value,placeholder:"Select property...","outer-class":"$reset"},null,8,["modelValue","options"]),pe.value?(r(),q(S(Ie),{key:0,class:"mt-1 text-red-600 dark:text-red-400"},{default:j(()=>[X(C(pe.value),1)]),_:1})):(r(),q(S(Ie),{key:1,class:"mt-1"},{default:j(()=>[...re[51]||(re[51]=[X(" Property from tool arguments to return as final response ",-1)])]),_:1}))])):T("",!0)])):T("",!0)])]),e("div",L0,[e("div",null,[w(Ce,{type:"number",modelValue:ce.value,"onUpdate:modelValue":re[23]||(re[23]=Se=>ce.value=Se),label:"Max Steps",placeholder:"Unlimited","outer-class":"$reset"},null,8,["modelValue"]),ye.value?(r(),q(S(Ie),{key:0,class:"mt-1 text-red-600 dark:text-red-400"},{default:j(()=>[X(C(ye.value),1)]),_:1})):(r(),q(S(Ie),{key:1,class:"mt-1"},{default:j(()=>[...re[52]||(re[52]=[X(" Safety limit before yielding ",-1)])]),_:1}))]),e("div",null,[w(Ce,{type:"selectSearch",modelValue:Me.value,"onUpdate:modelValue":re[24]||(re[24]=Se=>Me.value=Se),label:"End Conversation Tool",options:$t.value,placeholder:"Select a tool...",disabled:we.value||!F.value,"outer-class":"$reset"},null,8,["modelValue","options","disabled"]),ae.value?(r(),q(S(Ie),{key:0,class:"mt-1 text-red-600 dark:text-red-400"},{default:j(()=>[X(C(ae.value),1)]),_:1})):(r(),q(S(Ie),{key:1,class:"mt-1"},{default:j(()=>[...re[53]||(re[53]=[X(" Ends entire conversation when called ",-1)])]),_:1}))])])],64))])]),_:1},8,["title","icon"]),I.value.length>0||Object.keys(D.value).length>0?(r(),q(S(rt),{key:1,id:"section-env",title:"Environment",icon:S(Ht)},{default:j(()=>[e("div",P0,[re[54]||(re[54]=e("p",{class:"text-sm text-neutral-500 dark:text-neutral-400"}," Configure values for tools that require thread environment variables. Values from prompts are shown locked - click to unlock and override. ",-1)),Z.value?(r(),n("span",A0,"Loading...")):T("",!0),w(Zt,{modelValue:D.value,"onUpdate:modelValue":re[25]||(re[25]=Se=>D.value=Se),inherited:I.value,"allow-custom":!0,disabled:u.value},null,8,["modelValue","inherited","disabled"])])]),_:1},8,["icon"])):T("",!0)])],512)])]),_:1}))]),_:1},8,["model-value","title"])}}}),ta=ve({__name:"ExtractCopyToggle",props:{value:{},disabled:{type:Boolean}},emits:["update:value"],setup(t,{emit:o}){const a=o,i=l=>{a("update:value",l)};return(l,u)=>{const s=Be("FormKit");return r(),q(s,{type:"toggle",value:t.value,"on-value":"extract","off-value":"copy","on-value-label":"extract","off-value-label":"copy",disabled:t.disabled,classes:{outer:"$remove:mb-4",wrapper:"$remove:items-center flex-row-reverse justify-end items-center",inner:"h-5",track:"h-5 w-10 rounded-full",thumb:"h-4 w-4",valueLabel:"text-xs text-neutral-600 dark:text-neutral-400 mr-2 flex items-center font-normal"},onInput:i},null,8,["value","disabled"])}}}),O0={class:"font-mono text-sm"},R0={class:"flex items-center gap-2 py-1.5"},U0={class:"text-neutral-600 dark:text-neutral-400"},B0={class:"ml-auto"},ra=ve({name:"TreeChildren",props:{children:{type:Array,required:!0},getSelection:{type:Function,required:!0},setSelection:{type:Function,required:!0},isShared:{type:Function,required:!0},getTypeColor:{type:Function,required:!0}},setup(t){return()=>t.children.length===0?null:Oe("div",{class:"ml-4"},t.children.map((o,a)=>Oe("div",{class:"relative",key:o.uid},[a<t.children.length-1?Oe("div",{class:"absolute left-0 top-0 bottom-0 border-l border-neutral-300 dark:border-neutral-700"}):Oe("div",{class:"absolute left-0 top-0 h-3 border-l border-neutral-300 dark:border-neutral-700"}),Oe("div",{class:"absolute left-0 top-3 w-4 border-t border-neutral-300 dark:border-neutral-700"}),Oe("div",{class:"pl-5"},[Oe("div",{class:"flex items-center gap-2 py-1.5"},[Oe("span",{class:"text-neutral-600 dark:text-neutral-400"},o.name),Oe(ft,{variant:t.getTypeColor(o.type),size:"sm"},()=>o.type),t.isShared(o)?Oe("span",{class:"text-xs text-amber-600 dark:text-amber-400",title:`Used by: ${o.sharedWith.join(", ")}`},`(used in ${o.sharedWith.length} other${o.sharedWith.length>1?"s":""})`):null,o.isDuplicate?null:Oe("div",{class:"ml-auto"},[Oe(ta,{value:t.getSelection(o),disabled:t.isShared(o),"onUpdate:value":i=>t.setSelection(o,i),title:t.isShared(o)?"Cannot extract items shared with other agents":""})])]),o.children.length>0?Oe(ra,{children:o.children,getSelection:t.getSelection,setSelection:t.setSelection,isShared:t.isShared,getTypeColor:t.getTypeColor}):null])])))}}),F0=ve({__name:"DependencyTree",props:{analysis:{},selections:{}},emits:["update:selection"],setup(t,{emit:o}){const a=t,i=o,l=U(()=>{const c=a.analysis,f=[];let y=0;const b=(L,O)=>{for(const W of L){const J=`${O}:${W.name}`;f.push({...W,type:O,uid:`${J}:${y++}`})}};b(c.constituents.agents,"agent"),b(c.constituents.prompts,"prompt"),b(c.constituents.tools,"tool"),b(c.constituents.models,"model"),b(c.constituents.hooks,"hook");const v=new Map,d=`agent:${c.agent}`;for(const L of f){const O=L.parentKey||d;`${L.type}:${L.name}`===d&&!L.parentKey||(v.has(O)||v.set(O,[]),v.get(O).push(L))}const k=new Set,g=L=>{const O=`${L.type}:${L.name}`,W=k.has(O);k.add(O);const J=[],z=v.get(O)||[];for(const P of z)J.push(g(P));return{name:L.name,type:L.type,filePath:L.filePath,sharedWith:L.sharedWith,discoveredVia:L.discoveredVia,children:J,uid:L.uid,isDuplicate:W}},_=f.find(L=>L.type==="agent"&&L.name===c.agent&&!L.parentKey);return _?g(_):{name:c.agent,type:"agent",filePath:"",sharedWith:[],discoveredVia:"static",children:[],uid:"root",isDuplicate:!1}}),u=c=>`${c.type}:${c.name}`,s=c=>a.selections.get(u(c))||"extract",m=(c,f)=>{i("update:selection",u(c),f)},h=c=>c.sharedWith.length>0,x=c=>{switch(c){case"agent":return"accent";case"prompt":return"secondary";case"tool":return"success";case"model":return"warning";case"hook":return"default"}};return(c,f)=>(r(),n("div",O0,[e("div",R0,[e("span",U0,C(l.value.name),1),w(S(ft),{variant:x(l.value.type),size:"sm"},{default:j(()=>[X(C(l.value.type),1)]),_:1},8,["variant"]),e("div",B0,[w(ta,{value:s(l.value),"onUpdate:value":f[0]||(f[0]=y=>m(l.value,y))},null,8,["value"])])]),(r(),q(Ue(S(ra)),{children:l.value.children,"get-selection":s,"set-selection":m,"is-shared":h,"get-type-color":x},null,8,["children"]))]))}}),N0={key:0,class:"flex items-center justify-center py-12"},q0={key:1,class:"py-4"},H0={key:2,class:"py-4 space-y-4"},W0={class:"space-y-2"},K0={class:"text-sm opacity-80"},J0={class:"text-sm opacity-80"},Y0={key:3,class:"space-y-6"},G0={class:"space-y-4"},Z0={class:"grid grid-cols-2 gap-4"},X0={class:"col-span-2"},Q0=["value"],ep={class:"col-span-2"},tp={class:"col-span-2"},rp={key:0,class:"mt-3 space-y-3"},ap={class:"flex gap-2 border-b border-neutral-200 dark:border-neutral-700"},op={key:0},np=["innerHTML"],lp={class:"space-y-4"},sp={class:"list-disc list-inside space-y-1"},ip={class:"border border-neutral-200 dark:border-neutral-700 rounded-lg p-4 bg-neutral-50 dark:bg-neutral-900/50"},up={class:"flex justify-between"},dp=ve({__name:"PackModal",props:{modelValue:{type:Boolean},agent:{}},emits:["update:modelValue","packed"],setup(t,{emit:o}){Vt.setOptions({gfm:!0,breaks:!0});const a=[{value:"MIT",label:"MIT"},{value:"Apache-2.0",label:"Apache 2.0"},{value:"ISC",label:"ISC"},{value:"GPL-3.0",label:"GPL 3.0"},{value:"BSD-3-Clause",label:"BSD 3-Clause"},{value:"Unlicensed",label:"Unlicensed / Proprietary"}],i=t,l=o,u=U({get:()=>i.modelValue,set:N=>l("update:modelValue",N)}),s=p(null),m=p(!1),h=p(!1),x=p(null),c=p(null),f=p(""),y=p("1.0.0"),b=p("MIT"),v=p(""),d=p(""),k=p("edit"),g=p(!1),_=p(null),L=p(null),O=U(()=>d.value?Vt(d.value):""),W=p(new Map);ge(()=>i.modelValue,async N=>{N&&i.agent?await Promise.all([z(),P()]):J()});const J=()=>{s.value=null,x.value=null,c.value=null,W.value=new Map,f.value="",y.value="1.0.0",b.value="MIT",v.value="",d.value="",k.value="edit",g.value=!1,_.value=null,L.value=null},z=async()=>{if(i.agent){m.value=!0,x.value=null;try{const N=await fetch(he(`/api/pack/${i.agent.id}/analyze`)),F=await N.json();if(!N.ok){x.value=F.error||"Failed to analyze agent";return}if(s.value=F,F.generatedReadme)d.value=F.generatedReadme;else{const Y=G(i.agent?.id||"agent");d.value=ee(Y,i.agent?.id||"agent",F.agentDescription)}me(F)}catch(N){x.value=N instanceof Error?N.message:"Failed to analyze agent"}finally{m.value=!1}}},P=async()=>{if(i.agent)try{const N=await fetch(he(`/api/pack/${i.agent.id}/metadata`));if(N.ok){const F=await N.json();f.value=F.packageName,y.value=ue(F.version),b.value=F.license||"MIT",v.value=F.licenseOwner||""}else f.value=G(i.agent.id),y.value="1.0.0",b.value="MIT",v.value=""}catch{f.value=G(i.agent?.id||"agent"),y.value="1.0.0",b.value="MIT",v.value=""}},G=N=>`standardagent-${N.toLowerCase().replace(/_/g,"-")}`,ee=(N,F,Y)=>`# ${N}
|
|
1
|
+
import{d as fe,i as Ir,c as O,t as $a,r as m,w as xe,o as Pe,a as Ye,p as Ca,b as o,e as r,n as st,f as e,g as je,h as Le,j as Sa,k as T,l as Ae,m as oe,q as w,s as j,F as he,u as we,v as X,x as S,y as Ke,z as N,A as Te,B as Ue,C as Ta,D as Ia,I as zr,E as za,G as Ma,T as Mr,H as $,J as Qe,K as Ze,L as it,M as Be,N as Va,O as Oe,P as gt,Q as Vr,R as Er,S as ut,U as bt,V as nr,W as wt,X as et,Y as Lr,Z as Ea,_ as La,$ as Pr,a0 as Ne,a1 as Re,a2 as Ar,a3 as nt,a4 as vt,a5 as Gt,a6 as lr,a7 as Pa,a8 as Zt,a9 as Aa,aa as jr,ab as ja,ac as Dr,ad as Rr,ae as Or,af as Da,ag as Ra,ah as Oa,ai as Ua,aj as Ba,ak as Fa,al as Ht,am as Na,an as qa,ao as sr,ap as Ha,aq as Wa,ar as Ka,as as Ja,at as Ya,au as Ur,av as Ga,aw as Za,ax as Xa,ay as Qa,az as eo,aA as to,aB as ro,aC as ao,aD as oo,aE as no,aF as lo}from"./vue.js";import{a6 as so,a7 as io,a8 as uo,a9 as Vt,aa as co,r as Et}from"./vendor.js";import{W as po,a as mo,e as ir}from"./monaco.js";(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const d of l)if(d.type==="childList")for(const i of d.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&s(i)}).observe(document,{childList:!0,subtree:!0});function n(l){const d={};return l.integrity&&(d.integrity=l.integrity),l.referrerPolicy&&(d.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?d.credentials="include":l.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function s(l){if(l.ep)return;l.ep=!0;const d=n(l);fetch(l.href,d)}})();var Br=class{endpoint;token;constructor(t){this.endpoint=t.replace(/\/$/,""),this.token=typeof localStorage<"u"?localStorage.getItem("agentbuilder_auth_token"):null}getEndpoint(){return this.endpoint}async createThread(t){const a=await fetch(`${this.endpoint}/threads`,{method:"POST",headers:{...this.getHeaders(),"Content-Type":"application/json"},body:JSON.stringify(t)});if(!a.ok)throw new Error(`Failed to create thread: ${a.statusText}`);return a.json()}async getThread(t){const a=await fetch(`${this.endpoint}/threads/${t}`,{method:"GET",headers:this.getHeaders()});if(!a.ok)throw new Error(`Failed to get thread: ${a.statusText}`);return a.json()}async getMessages(t,a={}){const n=new URLSearchParams;a.limit!==void 0&&n.set("limit",String(a.limit)),a.offset!==void 0&&n.set("offset",String(a.offset)),a.depth!==void 0&&n.set("depth",String(a.depth)),a.includeSilent!==void 0&&n.set("includeSilent",String(a.includeSilent));const s=n.toString(),l=`${this.endpoint}/threads/${t}/messages${s?`?${s}`:""}`,d=await fetch(l,{method:"GET",headers:this.getHeaders()});if(!d.ok)throw new Error(`Failed to get messages: ${d.statusText}`);return(await d.json()).messages||[]}async sendMessage(t,a){const n=await fetch(`${this.endpoint}/threads/${t}/messages`,{method:"POST",headers:{...this.getHeaders(),"Content-Type":"application/json"},body:JSON.stringify(a)});if(!n.ok)throw new Error(`Failed to send message: ${n.statusText}`);return n.json()}async stopExecution(t){const a=await fetch(`${this.endpoint}/threads/${t}/stop`,{method:"POST",headers:this.getHeaders()});if(!a.ok)throw new Error(`Failed to stop execution: ${a.statusText}`);await a.json()}async deleteMessage(t,a){const n=await fetch(`${this.endpoint}/threads/${t}/messages/${a}`,{method:"DELETE",headers:this.getHeaders()});if(!n.ok)throw new Error(`Failed to delete message: ${n.statusText}`);return n.json()}async uploadFile(t,a,n){const s=encodeURIComponent(a.name),l=`${this.endpoint}/threads/${t}/fs/${s}`;if(n?.thumbnail){const i=await this.fileToBase64(a),c=await fetch(l,{method:"POST",headers:{...this.getHeaders(),"Content-Type":"application/json"},body:JSON.stringify({data:i,mimeType:a.type,thumbnail:n.thumbnail,metadata:{width:n.width,height:n.height}})});if(!c.ok)throw new Error(`Failed to upload file: ${c.statusText}`);return c.json()}const d=await fetch(l,{method:"POST",headers:{...this.getHeaders(),"Content-Type":a.type},body:a});if(!d.ok)throw new Error(`Failed to upload file: ${d.statusText}`);return d.json()}fileToBase64(t){return new Promise((a,n)=>{const s=new FileReader;s.onload=()=>{const d=s.result.split(",")[1];a(d)},s.onerror=()=>n(new Error("Failed to read file")),s.readAsDataURL(t)})}getFileUrl(t,a){const s=(a.startsWith("/")?a.slice(1):a).split("/").map(l=>encodeURIComponent(l)).join("/");return`${this.endpoint}/threads/${t}/fs/${s}`}getThumbnailUrl(t,a){return`${this.getFileUrl(t,a)}?thumbnail=true`}async listFiles(t){const a=await fetch(`${this.endpoint}/threads/${t}/fs?find=**/*&type=file`,{method:"GET",headers:this.getHeaders()});if(!a.ok)throw new Error(`Failed to list files: ${a.statusText}`);return(await a.json()).files||[]}connectMessageWebSocket(t,a={},n={}){const s=new URLSearchParams;this.token&&s.set("token",this.token),n.includeSilent!==void 0&&s.set("includeSilent",String(n.includeSilent)),n.depth!==void 0&&s.set("depth",String(n.depth));const l=this.endpoint.startsWith("https")?"wss":"ws",i=`${this.endpoint.replace(/^https?/,l)}/threads/${t}/stream?${s.toString()}`,c=new WebSocket(i);return c.onopen=()=>{a.onOpen?.()},c.onmessage=g=>{try{if(typeof g.data=="string"&&g.data==="pong")return;const y=JSON.parse(g.data);switch(y.type){case"message_data":a.onMessage?.(y);break;case"message_chunk":a.onChunk?.(y);break;case"event":a.onEvent?.(y);break;case"error":a.onError?.(y);break}}catch(y){console.error("Failed to parse WebSocket message:",y)}},c.onerror=g=>{console.error("WebSocket error:",g),a.onError?.({type:"error",error:"WebSocket connection error"})},c.onclose=g=>{console.log(`[AgentBuilderClient] Message WebSocket closed - code: ${g.code}, reason: ${g.reason||"none"}, wasClean: ${g.wasClean}`),a.onClose?.()},c}connectLogWebSocket(t,a={}){const n=new URLSearchParams;this.token&&n.set("token",this.token);const s=this.endpoint.startsWith("https")?"wss":"ws",d=`${this.endpoint.replace(/^https?/,s)}/threads/${t}?${n.toString()}`,i=new WebSocket(d);return i.onopen=()=>{a.onOpen?.()},i.onmessage=c=>{try{if(typeof c.data=="string"&&c.data==="pong")return;const g=JSON.parse(c.data);switch(g.type){case"log_data":a.onLog?.(g);break;case"custom":a.onCustom?.(g);break;case"stopped_by_user":a.onStopped?.(g);break}}catch(g){console.error("Failed to parse WebSocket message:",g)}},i.onerror=c=>{console.error("WebSocket error:",c)},i.onclose=()=>{a.onClose?.()},i}getHeaders(){const t={};return this.token&&(t.Authorization=`Bearer ${this.token}`),t}},vo=class{client;threadId;callbacks;options;ws=null;status="disconnected";reconnectAttempts=0;reconnectTimeout=null;heartbeatInterval=null;isReconnecting=!1;shouldReconnect=!0;constructor(t,a,n={},s={}){this.client=t,this.threadId=a,this.callbacks=n,this.options={depth:s.depth??0,includeSilent:s.includeSilent??!1,heartbeatInterval:s.heartbeatInterval??3e4,maxReconnectDelay:s.maxReconnectDelay??3e4}}getStatus(){return this.status}getThreadId(){return this.threadId}connect(){this.ws&&this.ws.readyState!==WebSocket.CLOSED||(this.shouldReconnect=!0,this.isReconnecting=!1,this.setStatus("connecting"),this.ws=this.client.connectMessageWebSocket(this.threadId,{onOpen:()=>{this.setStatus("connected"),this.reconnectAttempts=0,this.isReconnecting=!1,this.startHeartbeat()},onMessage:t=>{this.callbacks.onMessage?.(t)},onChunk:t=>{this.callbacks.onChunk?.(t)},onEvent:t=>{this.callbacks.onEvent?.(t)},onError:t=>{this.callbacks.onError?.(t)},onClose:()=>{this.clearTimers(),this.scheduleReconnect()}},{depth:this.options.depth,includeSilent:this.options.includeSilent}))}disconnect(){this.shouldReconnect=!1,this.clearTimers(),this.ws&&(this.ws.close(),this.ws=null),this.reconnectAttempts=0,this.isReconnecting=!1,this.setStatus("disconnected")}updateCallbacks(t){this.callbacks={...this.callbacks,...t}}updateOptions(t){this.options={...this.options,...t}}setStatus(t){this.status!==t&&(this.status=t,this.callbacks.onStatusChange?.(t))}startHeartbeat(){this.clearHeartbeat(),this.heartbeatInterval=setInterval(()=>{this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send("ping")},this.options.heartbeatInterval)}clearHeartbeat(){this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}clearReconnectTimeout(){this.reconnectTimeout&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null)}clearTimers(){this.clearHeartbeat(),this.clearReconnectTimeout()}scheduleReconnect(){if(!this.shouldReconnect||this.isReconnecting){this.setStatus("disconnected");return}this.isReconnecting=!0,this.setStatus("reconnecting");const t=Math.min(1e3*Math.pow(2,this.reconnectAttempts),this.options.maxReconnectDelay);this.reconnectAttempts++,this.reconnectTimeout=setTimeout(()=>{this.shouldReconnect&&this.connect()},t)}};function ur(t){return t.toLowerCase().startsWith("image/")}var dr=256;function fo(t){return new Promise((a,n)=>{const s=new Image,l=URL.createObjectURL(t);s.onload=()=>{URL.revokeObjectURL(l),a(s)},s.onerror=()=>{URL.revokeObjectURL(l),n(new Error("Failed to load image"))},s.src=l})}function ho(t){const{width:a,height:n}=t,s=a/n;let l,d;s>1?(l=Math.min(dr,a),d=Math.floor(l/s)):(d=Math.min(dr,n),l=Math.floor(d*s));const i=document.createElement("canvas");i.width=l,i.height=d;const c=i.getContext("2d");if(!c)throw new Error("Failed to get canvas context");return c.drawImage(t,0,0,l,d),i.toDataURL("image/webp",.8).split(",")[1]}async function go(t){const a=await fo(t);return{thumbnail:ho(a),width:a.width,height:a.height}}function bo(){return`pending-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}function xo(t){return new Promise((a,n)=>{const s=new FileReader;s.onload=()=>a(s.result),s.onerror=n,s.readAsDataURL(t)})}var yo=class{createPendingFile(t){return{id:bo(),name:t.name,mimeType:t.type,size:t.size,isImage:ur(t.type),localPreviewUrl:null,status:"uploading"}}queueFiles(t){return Array.from(t).map(a=>({pending:this.createPendingFile(a),file:a}))}async executeUpload(t,a,n,s,l,d={}){const{generateThumbnail:i=!0,generatePreview:c=!0}=d,g=ur(a.type);g&&c&&xo(a).then(y=>l({localPreviewUrl:y})).catch(y=>console.error("Failed to generate preview:",y));try{let y;if(g&&i)try{const f=await go(a);y={thumbnail:f.thumbnail,width:f.width,height:f.height}}catch(f){console.warn("Failed to generate thumbnail:",f)}const v=await s.uploadFile(t,a,y);return l({id:v.id,status:"ready",path:v.path,width:v.width,height:v.height}),v}catch(y){throw l({status:"error",error:y instanceof Error?y.message:"Failed to upload file"}),y}}async executeUploads(t,a,n,s,l={}){const d=a.map(({pending:i,file:c})=>this.executeUpload(t,c,i.id,n,g=>s(i.id,g),l).catch(g=>g instanceof Error?g:new Error(String(g))));return Promise.all(d)}};function ko(t){if(t.length===0)return[];const a=[];let n=0;for(;n<t.length;){const s=t[n];if(s.role==="assistant"&&s.tool_calls){let l;try{l=JSON.parse(s.tool_calls)}catch{a.push(s),n++;continue}const d=[],i=[],c=[];let g=s.reasoning_content||null,y="completed";const v=s.id,f=s.created_at,h=s.depth;s.status==="pending"?y="pending":s.status==="failed"&&(y="failed"),s.content&&i.push(s.content);for(const k of l)d.push({id:k.id||s.id,type:"tool_call",name:k.function?.name,content:k.function?.arguments||null,status:null,tool_call_id:k.id});let _=n+1;for(;_<t.length;){const k=t[_];if(k.role==="tool"){const M=k.tool_status||"pending";if(d.push({id:k.id,type:"tool_result",name:k.name||void 0,content:k.content,status:M,tool_call_id:k.tool_call_id||void 0}),k.attachments)try{let R;typeof k.attachments=="string"?R=JSON.parse(k.attachments):Array.isArray(k.attachments)?R=k.attachments:R=[],c.push(...R)}catch{}_++}else if(k.role==="assistant"&&k.tool_calls){let M;try{M=JSON.parse(k.tool_calls)}catch{break}k.status==="pending"?y="pending":k.status==="failed"&&y!=="pending"&&(y="failed"),k.content&&i.push(k.content),!g&&k.reasoning_content&&(g=k.reasoning_content);for(const R of M)d.push({id:R.id||k.id,type:"tool_call",name:R.function?.name,content:R.function?.arguments||null,status:null,tool_call_id:R.id});_++}else break}const b=new Set(d.filter(k=>k.type==="tool_call").map(k=>k.tool_call_id)),u=d.filter(k=>k.type==="tool_result"&&k.tool_call_id&&!b.has(k.tool_call_id));for(const k of u){const M=d.indexOf(k),R=k.content?.match(/Tool not found: (\w+)/)?.[1]||"unknown_tool",W={id:`synthetic-${k.tool_call_id}`,type:"tool_call",name:R,content:null,status:k.status,tool_call_id:k.tool_call_id};d.splice(M,0,W)}for(const k of d)if(k.type==="tool_call"&&k.tool_call_id&&k.status===null){const M=d.find(R=>R.type==="tool_result"&&R.tool_call_id===k.tool_call_id);M?k.status=M.status:k.status="pending"}const x=i.length>0?i.join(""):null,p={id:v,type:"workblock",content:x,reasoning_content:g,workItems:d,status:y,created_at:f,depth:h,attachments:c.length>0?c:void 0};a.push(p),n=_}else a.push(s),n++}return a}var Fr=Symbol("StandardAgents"),Nr=Symbol("Thread"),wo={install(t,a){if(!a?.endpoint)throw new Error("StandardAgentsPlugin requires an endpoint option");const s={client:new Br(a.endpoint),endpoint:a.endpoint};t.provide(Fr,s)}};function _o(){const t=Ir(Fr);if(!t)throw new Error("useStandardAgents must be used within a component where StandardAgentsPlugin is installed");return t}var cr=new yo;function $o(t){return new Promise((a,n)=>{const s=new FileReader;s.onload=()=>{const d=s.result.split(",")[1];a(d)},s.onerror=()=>n(new Error("Failed to read file")),s.readAsDataURL(t)})}function Co(t,a={}){const{preload:n=!0,live:s=!0,useWorkblocks:l=!1,depth:d=0,includeSilent:i=!1,endpoint:c}=a,g=O(()=>$a(t)),y=_o(),v=c?new Br(c):y.client,f={preload:n,live:s,useWorkblocks:l,depth:d,includeSilent:i},h=m([]),_=m("disconnected"),b=m(n),u=m(null),x=m([]),p=m([]),k=m([]),M=O(()=>{const A=new Set(p.value.map(ue=>ue.path));return[...x.value.filter(ue=>!ue.path||!A.has(ue.path)),...p.value]}),R=new Map;let W=null;const Z=O(()=>l?ko(h.value):h.value);async function V(){b.value=!0,u.value=null;try{const A=await v.getMessages(g.value,{depth:d,includeSilent:i});h.value=A}catch(A){u.value=A instanceof Error?A:new Error(String(A))}finally{b.value=!1}}async function P(){try{const A=await v.listFiles(g.value);p.value=A.filter(pe=>!pe.isDirectory).map(pe=>({id:pe.path,name:pe.name,path:pe.path,mimeType:pe.mimeType,size:pe.size,isImage:pe.mimeType.startsWith("image/"),status:"committed",localPreviewUrl:null}))}catch(A){console.error("Failed to load files:",A)}}function J(A){if(A.file.isDirectory)return;const pe={id:A.path,name:A.file.name,path:A.path,mimeType:A.file.mimeType,size:A.file.size,isImage:A.file.mimeType?.startsWith("image/")||!1,status:"committed",localPreviewUrl:null},ue=p.value.findIndex(ke=>ke.path===A.path);ue>=0?p.value[ue]=pe:p.value=[...p.value,pe]}function Q(A){if(A.file.isDirectory)return;const pe={id:A.path,name:A.file.name,path:A.path,mimeType:A.file.mimeType,size:A.file.size,isImage:A.file.mimeType?.startsWith("image/")||!1,status:"committed",localPreviewUrl:null},ue=p.value.findIndex(ke=>ke.path===A.path);ue>=0?p.value[ue]=pe:p.value=[...p.value,pe]}function le(A){p.value=p.value.filter(pe=>pe.path!==A.path)}function me(){s&&(W=new vo(v,g.value,{onStatusChange:A=>{_.value=A},onMessage:A=>{if(A.type==="message_data"){const pe=h.value.findIndex(ue=>ue.id===A.data.id);pe>=0?h.value[pe]=A.data:h.value=[...h.value,A.data]}},onChunk:A=>{const pe=h.value.findIndex(ue=>ue.id===A.message_id);if(pe>=0){const ue=h.value[pe];h.value[pe]={...ue,content:(ue.content||"")+A.chunk}}},onEvent:A=>{A.eventType==="file_created"?J(A.data):A.eventType==="file_updated"?Q(A.data):A.eventType==="file_deleted"&&le(A.data);const pe=R.get(A.eventType);pe&&pe.forEach(ue=>{try{ue(A.data)}catch(ke){console.error(`Error in event listener for "${A.eventType}":`,ke)}})},onError:A=>{u.value=A instanceof Error?A:new Error(String(A))}},{depth:d,includeSilent:i}),W.connect())}async function ee(A){const pe=`optimistic-${crypto.randomUUID()}`,ue=k.value.map(ae=>({id:ae.id,type:"file",path:"",name:ae.name,mimeType:ae.mimeType,size:ae.size,width:ae.width,height:ae.height,localPreviewUrl:ae.previewUrl||void 0})),ke={id:pe,role:A.role,content:A.content,attachments:ue.length>0?JSON.stringify(ue):null,created_at:Date.now()*1e3,status:"pending"};h.value=[...h.value,ke];const Ee=[...k.value];k.value=[];try{const ae=await Promise.all(Ee.map(async K=>({name:K.name,mimeType:K.mimeType,data:await $o(K.file),width:K.width,height:K.height}))),z=await v.sendMessage(g.value,{...A,attachments:ae.length>0?ae:void 0});return h.value=h.value.filter(K=>K.id!==pe),Ee.forEach(K=>{K.previewUrl&&URL.revokeObjectURL(K.previewUrl)}),z}catch(ae){throw k.value=Ee,h.value=h.value.filter(z=>z.id!==pe),u.value=ae instanceof Error?ae:new Error(String(ae)),ae}}async function L(){try{await v.stopExecution(g.value)}catch(A){throw u.value=A instanceof Error?A:new Error(String(A)),A}}async function C(A){const pe=[...h.value];h.value=h.value.filter(ue=>ue.id!==A);try{await v.deleteMessage(g.value,A)}catch(ue){throw h.value=pe,u.value=ue instanceof Error?ue:new Error(String(ue)),ue}}function I(A){const pe=cr.queueFiles(A);x.value=[...x.value,...pe.map(ue=>ue.pending)];for(const{pending:ue,file:ke}of pe)cr.executeUpload(g.value,ke,ue.id,v,Ee=>{x.value=x.value.map(ae=>ae.id===ue.id?{...ae,...Ee}:ae)}).catch(()=>{})}function re(A){x.value=x.value.filter(pe=>pe.id!==A)}function F(A){return A.path?v.getFileUrl(g.value,A.path):""}function B(A){return A.path?v.getThumbnailUrl(g.value,A.path):""}function q(A){return A.isImage?A.localPreviewUrl?A.localPreviewUrl:A.path?B(A):null:null}function Y(A){const ue=(A instanceof FileList?Array.from(A):Array.isArray(A)?A:[A]).map(ke=>{const Ee=ke.type.startsWith("image/");return{id:crypto.randomUUID(),file:ke,name:ke.name,mimeType:ke.type,size:ke.size,isImage:Ee,previewUrl:Ee?URL.createObjectURL(ke):null}});k.value=[...k.value,...ue]}function U(A){const pe=k.value.find(ue=>ue.id===A);pe?.previewUrl&&URL.revokeObjectURL(pe.previewUrl),k.value=k.value.filter(ue=>ue.id!==A)}function H(){k.value.forEach(A=>{A.previewUrl&&URL.revokeObjectURL(A.previewUrl)}),k.value=[]}function E(A,pe){return R.has(A)||R.set(A,new Set),R.get(A).add(pe),()=>{const ue=R.get(A);ue&&(ue.delete(pe),ue.size===0&&R.delete(A))}}function ne(){W?.disconnect(),W=null,_.value="disconnected"}return xe(g,(A,pe)=>{A!==pe&&(ne(),h.value=[],u.value=null,x.value=[],p.value=[],k.value.forEach(ue=>{ue.previewUrl&&URL.revokeObjectURL(ue.previewUrl)}),k.value=[],n&&V(),P(),me())}),Pe(()=>{n&&V(),P(),me()}),Ye(()=>{W?.disconnect(),R.clear(),k.value.forEach(A=>{A.previewUrl&&URL.revokeObjectURL(A.previewUrl)})}),{threadId:g,options:f,messages:h,workblocks:Z,status:_,connectionStatus:_,isLoading:b,loading:b,error:u,sendMessage:ee,stopExecution:L,deleteMessage:C,onEvent:E,subscribeToEvent:E,files:M,addFiles:I,removeFile:re,getFileUrl:F,getThumbnailUrl:B,getPreviewUrl:q,attachments:k,addAttachment:Y,removeAttachment:U,clearAttachments:H}}var So=fe({name:"ThreadProvider",props:{threadId:{type:String,required:!0},preload:{type:Boolean,default:void 0},live:{type:Boolean,default:void 0},useWorkblocks:{type:Boolean,default:void 0},depth:{type:Number,default:void 0},includeSilent:{type:Boolean,default:void 0},endpoint:{type:String,default:void 0}},setup(t,{slots:a}){const n={};t.preload!==void 0&&(n.preload=t.preload),t.live!==void 0&&(n.live=t.live),t.useWorkblocks!==void 0&&(n.useWorkblocks=t.useWorkblocks),t.depth!==void 0&&(n.depth=t.depth),t.includeSilent!==void 0&&(n.includeSilent=t.includeSilent),t.endpoint!==void 0&&(n.endpoint=t.endpoint);const s=Co(()=>t.threadId,n);return Ca(Nr,s),()=>a.default?.()}});function qr(){const t=Ir(Nr);if(!t)throw new Error('useThread must be used within a <ThreadProvider>. Wrap your component with <ThreadProvider threadId="...">.');return t}function To(t,a){const n=`${a.props.type}__${t}`,s=`formkit-${t}`,l=a.props.family?`family:${a.props.family}__${t}`:"",d=`${n}__${l}`;if(!(d in dt)){const i=dt[n]??Io[t]??{};i[s]=!0,l in dt?dt[d]={...dt[l],...i}:dt[d]=i}return dt[d]??{[s]:!0}}const dt={"family:button__wrapper":{"group-data-[disabled=true]:grayscale":!0},"family:button__input":{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"font-bold":!0,"rounded-sm":!0,"outline-hidden":!0,flex:!0,"!text-xs":!0,"px-7":!0,"py-3":!0,"items-center":!0,"mb-1.5":!0,"text-xs":!0,"ring-accent-400":!0,"focus-visible:ring-2":!0,"focus-visible:ring-offset-2":!0,"group-data-[disabled]:!cursor-not-allowed":!0,"shadow-none":!0,"group-data-[prefix-icon]:pl-5":!0,"group-data-[suffix-icon]:pr-5":!0,border:!0,"border-accent-500":!0,"text-accent-500":!0,"group-[&]/repeater:shadow-none":!0,"group-[&]/multistep:shadow-none":!0,"dark:border-accent-500":!0},"family:box__wrapper":{"inline-flex":!0,"items-center":!0,"mb-1":!0,"group-data-[multiple]:mb-0":!0},"family:box__legend":{block:!0,"text-zinc-700":!0,"text-xs":!0,"font-bold":!0,"dark:text-zinc-300":!0,"mb-2":!0},"family:box__input":{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,peer:!0,"pointer-events-none":!0,absolute:!0,"h-0":!0,"w-0":!0,"overflow-hidden":!0,"opacity-0":!0},"family:box__decorator":{"mr-1.5":!0,"bg-white":!0,"ring-accent-400":!0,"peer-checked:border-accent-500":!0,relative:!0,block:!0,"text-base":!0,"w-[1em]":!0,"aspect-[1/1]":!0,border:!0,"border-zinc-300":!0,"text-transparent":!0,"peer-checked:bg-accent-50":!0,"peer-checked:text-accent-500":!0,"peer-focus-visible:ring-2":!0,"peer-focus-visible:ring-offset-1":!0,"select-none":!0,"group-data-[disabled]:!cursor-not-allowed":!0,"peer-disabled:bg-zinc-100":!0,"group-data-[disabled]:grayscale":!0,"shadow-none":!0,"peer-disabled:cursor-not-allowed":!0,"group-[&]/repeater:shadow-none":!0,"group-[&]/multistep:shadow-none":!0,"dark:border-zinc-700":!0,"dark:bg-transparent":!0,"dark:ring-offset-accent-400":!0,"dark:peer-focus-visible:ring-1":!0,"dark:peer-disabled:bg-zinc-600/50":!0,"dark:peer-checked:bg-accent-800":!0,"dark:peer-checked:text-accent-300":!0},"family:box__decoratorIcon":{absolute:!0,"left-1/2":!0,"top-1/2":!0,flex:!0,"h-full":!0,"w-full":!0,"-translate-x-1/2":!0,"-translate-y-1/2":!0},"family:box__option":{"mb-1.5":!0,"last:mb-0":!0,"data-[disabled]:opacity-50":!0,"data-[disabled]:select-none":!0,"group-data-[disabled]:data-[disabled]:opacity-100":!0},"family:box__label":{block:!0,"text-zinc-700":!0,"text-xs":!0,"font-bold":!0,"mb-1":!0,"!mb-0":!0,"!font-normal":!0,"!text-sm":!0,"dark:text-zinc-300":!0},"family:box__optionHelp":{"text-zinc-500":!0,"text-[11px]":!0,"[line-height:1em]":!0,"-mt-1":!0,"mb-1.5":!0,"ml-[min(2em,1.7rem)]":!0,relative:!0,"left-px":!0},"family:box__help":{"text-zinc-500":!0,"text-[11px]":!0,"[line-height:1em]":!0,"dark:text-zinc-400":!0,"mb-1":!0,"group-data-[multiple]:mb-2":!0,"group-data-[multiple]:-mt-1.5":!0},"family:text__wrapper":{flex:!0,"flex-col":!0,"items-start":!0,"justify-start":!0,"mb-1.5":!0,"last:mb-0":!0},"family:text__label":{block:!0,"text-zinc-700":!0,"text-xs":!0,"font-bold":!0,"dark:text-zinc-300":!0,"!inline-flex":!0,"mb-1":!0},"family:text__inner":{"text-sm":!0,flex:!0,"items-center":!0,"w-full":!0,"py-2":!0,"px-3":!0,"rounded-sm":!0,border:!0,"border-zinc-300":!0,"bg-white":!0,"focus-within:ring-1":!0,"focus-within:!ring-accent-400":!0,"focus-within:!border-accent-400":!0,"group-data-[invalid]:border-red-400":!0,"group-data-[invalid]:ring-1":!0,"group-data-[invalid]:ring-red-400":!0,"group-data-[disabled]:bg-zinc-100":!0,"group-data-[disabled]:!cursor-not-allowed":!0,"shadow-none":!0,"group-[&]/repeater:shadow-none":!0,"group-[&]/multistep:shadow-none":!0,"dark:bg-transparent":!0,"dark:border-zinc-700":!0,"dark:group-data-[disabled]:bg-zinc-800/5":!0,"dark:group-data-[invalid]:border-red-400":!0,"dark:group-data-[invalid]:ring-red-400":!0},"family:text__input":{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"text-sm":!0,"text-zinc-700":!0,"min-w-0":!0,"min-h-[1.5em]":!0,grow:!0,"outline-hidden":!0,"bg-transparent":!0,"selection:bg-accent-100":!0,"placeholder:text-zinc-400":!0,"group-data-[disabled]:!cursor-not-allowed":!0,"dark:placeholder-zinc-400/50":!0,"dark:text-zinc-300":!0,"border-none":!0,"p-0":!0,"focus:ring-0":!0},"family:text__prefixIcon":{flex:!0,"items-center":!0,"-ml-1":!0,"mr-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"text-zinc-600":!0,"dark:text-zinc-300":!0},"family:text__suffixIcon":{flex:!0,"items-center":!0,"-mr-1":!0,"ml-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"text-zinc-600":!0,"dark:text-zinc-300":!0},"family:dropdown__wrapper":{"mb-1.5":!0},"family:dropdown__inner":{relative:!0,flex:!0,"items-center":!0,"w-full":!0,"py-2":!0,"px-3":!0,"text-sm":!0,"bg-white":!0,border:!0,"border-zinc-300":!0,"rounded-sm":!0,"group-data-[is-multiline]:!rounded-sm":!0,"focus-within:ring-1":!0,"focus-within:!ring-accent-400":!0,"focus-within:!border-accent-400":!0,"group-data-[invalid]:border-red-400":!0,"group-data-[invalid]:ring-1":!0,"group-data-[invalid]:ring-red-400":!0,"group-data-[disabled]:bg-zinc-100":!0,"group-data-[disabled]:!cursor-not-allowed":!0,"shadow-none":!0,"group-[&]/repeater:shadow-none":!0,"group-[&]/multistep:shadow-none":!0,"dark:bg-transparent":!0,"dark:border-zinc-700":!0,"dark:group-data-[disabled]:bg-zinc-700/40":!0,"dark:group-data-[invalid]:border-red-400":!0,"dark:group-data-[invalid]:ring-red-400":!0},"family:dropdown__input":{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,grow:!0,"p-2":!0,"pr-0":!0,"pl-3":!0,"text-sm":!0,"text-zinc-700":!0,"text-ellipsis":!0,"min-w-0":!0,"outline-hidden":!0,"bg-transparent":!0,"group-data-[disabled]:!cursor-not-allowed":!0,"group-data-[prefix-icon]:!pl-0":!0,"group-data-[suffix-icon]:!pr-0":!0,"placeholder:text-zinc-400":!0,"selection:bg-accent-100":!0,"dark:placeholder:text-zinc-500":!0,"dark:text-zinc-300":!0,"border-none":!0,"focus:ring-0":!0,"bg-none":!0},"family:dropdown__listboxButton":{"w-[2.5em]":!0,"self-stretch":!0,"text-sm":!0,flex:!0,"items-center":!0,"text-zinc-700":!0,"z-10":!0,"dark:text-zinc-300":!0,"data-[disabled]:cursor-not-allowed":!0},"family:dropdown__removeSelection":{"w-[2.5em]":!0,"self-stretch":!0,"text-sm":!0,flex:!0,"items-center":!0,"text-zinc-700":!0,"hover:text-red-400":!0,"z-10":!0,"dark:text-zinc-300":!0},"family:dropdown__controlLabel":{absolute:!0,"opacity-0":!0,"pointer-events-none":!0,"text-[0px]":!0},"family:dropdown__selectIcon":{"text-sm":!0,"inline-flex":!0,"justify-center":!0,"w-[2.5em]":!0,relative:!0,"my-auto":!0,"[&>svg]:w-[1em]":!0,"[&>svg]:mx-auto":!0},"family:dropdown__closeIcon":{"text-sm":!0,"w-[0.75em]":!0,relative:!0,"m-auto":!0},"family:dropdown__prefixIcon":{flex:!0,"items-center":!0,"-ml-1":!0,"mr-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"!ml-2":!0,"!mr-0":!0,"text-zinc-600":!0,"dark:text-zinc-300":!0},"family:dropdown__suffixIcon":{flex:!0,"items-center":!0,"-mr-1":!0,"ml-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"!mr-2":!0,"!ml-0":!0,"text-zinc-600":!0,"dark:text-zinc-300":!0},"family:dropdown__dropdownWrapper":{"rounded-sm":!0,"shadow-md":!0,"mt-1":!0,"overflow-clip":!0,"empty:hidden":!0,border:!0,"border-zinc-200":!0,"dark:border-zinc-700":!0,"group-data-[expanded]:opacity-100":!0,"group-data-[overscroll]:m-0":!0,"group-data-[overscroll]:shadow-none":!0,"group-data-[overscroll]:border-none":!0},"family:dropdown__listitemGroup":{"group/optgroup":!0,"last:pb-0":!0,"border-t":!0,"border-b":!0,"-mb-px":!0,"border-zinc-200":!0,"dark:border-zinc-700":!0},"family:dropdown__groupLabel":{block:!0,"pt-1.5":!0,"pb-1":!0,"px-2.5":!0,"font-bold":!0,"pointer-events-none":!0,"text-zinc-500":!0,"dark:text-zinc-500":!0},"family:dropdown__listbox":{"bg-white":!0,"rounded-sm":!0,"empty:hidden":!0,"dark:bg-zinc-800":!0,"group-data-[overscroll]:shadow-md":!0,"group-data-[overscroll]:border":!0,"group-data-[overscroll]:border-zinc-200":!0,"group-data-[overscroll]:dark:border-zinc-700":!0},"family:dropdown__listitem":{relative:!0,flex:!0,"items-center":!0,"px-2":!0,"py-1.5":!0,"first:pt-2":!0,"last:pb-2":!0,"text-zinc-700":!0,"text-sm":!0,"data-[is-active]:bg-accent-100":!0,"dark:text-zinc-200":!0,"dark:data-[is-active]:text-zinc-700":!0,"before:content-['']":!0,"before:absolute":!0,"before:inset-0":!0,"data-[is-active]:first:before:rounded-sm":!0,"data-[is-active]:first:before:rounded-b-none":!0,"data-[is-active]:last:before:rounded-sm":!0,"data-[is-active]:last:before:rounded-t-none":!0,"data-[is-active]:first:last:before:rounded-sm":!0,"data-[is-active]:before:ring-1":!0,"data-[is-active]:before:ring-accent-400":!0,"data-[is-active]:before:ring-inset":!0,"data-[is-active]:before:ring-offset-accent-100":!0,"group-[&]/optgroup:first:before:!rounded-none":!0,"group-[&]/optgroup:last:before:!rounded-none":!0},"family:dropdown__selectedIcon":{flex:!0,absolute:!0,"items-center":!0,"text-accent-500":!0,"left-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0},"family:dropdown__option":{"ml-[1.5em]":!0},"family:dropdown__loadMore":{"data-[is-active]:bg-accent-100":!0},"family:dropdown__loadMoreInner":{flex:!0,"text-xs":!0,"text-zinc-500":!0,"p-2":!0,"items-center":!0,"justify-center":!0,"[&>span]:mr-2":!0,"cursor-pointer":!0,"dark:text-zinc-200":!0,"dark:hover:text-accent-400":!0},"family:dropdown__selectionWrapper":{grow:!0,flex:!0,"items-center":!0,"text-zinc-700":!0},"family:dropdown__selection":{grow:!0,"text-zinc-700":!0,"group-data-[multiple]:p-2":!0,"dark:text-zinc-300":!0},"family:dropdown__tagsWrapper":{"w-full":!0},"family:dropdown__tagWrapper":{"group/tag":!0,"rounded-sm":!0,"mr-1":!0,"mb-1":!0,"outline-hidden":!0,"data-[active-selection=true]:ring-2":!0,"data-[active-selection=true]:ring-accent-400":!0},"family:dropdown__tags":{"inline-flex":!0,"flex-wrap":!0,"items-center":!0,"w-full":!0,"-mb-1":!0,"empty:mb-0":!0},"family:dropdown__tag":{flex:!0,"items-center":!0,"cursor-default":!0,"rounded-sm":!0,"text-xs":!0,"px-1.5":!0,"py-0.5":!0,"bg-accent-500":!0,"text-white":!0,"[&>[type=button]]:!w-[0.5em]":!0,"[&>[type=button]]:aspect-[1/1]":!0,"[&>[type=button]]:!text-inherit":!0,"[&>[type=button]]:cursor-pointer":!0,"group-data-[active-selection=true]/tag:bg-accent-300":!0,"group-data-[active-selection=true]/tag:text-zinc-700":!0},"family:dropdown__tagLabel":{"mr-1":!0},"family:dropdown__emptyMessage":{flex:!0,"items-center":!0,"px-2":!0,"py-1.5":!0,"first:pt-2":!0,"last:pb-2":!0,"text-zinc-700":!0,"text-xs":!0,"aria-selected:text-white":!0,"aria-selected:bg-accent-500":!0},button__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"bg-accent-50":!0,"hover:bg-accent-100":!0,"dark:text-accent-500":!0,"dark:bg-transparent":!0,"dark:hover:bg-accent-50/5":!0},checkbox__decorator:{"rounded-sm":!0},checkbox__decoratorIcon:{"max-w-[66.66%]":!0},color__inner:{"!w-auto":!0,"!p-1.5":!0,"!inline-flex":!0,"group-data-[prefix-icon]:border":!0,"group-data-[prefix-icon]:border-zinc-300":!0,"group-data-[suffix-icon]:border":!0,"group-data-[suffix-icon]:border-zinc-300":!0,"dark:group-data-[prefix-icon]:border-zinc-700":!0,"dark:group-data-[suffix-icon]:border-zinc-700":!0},color__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"!w-14":!0,"bg-transparent":!0,"cursor-pointer":!0,"rounded-sm":!0,"overflow-clip":!0,"[&::-webkit-color-swatch-wrapper]:p-0":!0,"[&::-webkit-color-swatch]:border-none":!0,"[&::-moz-color-swatch]:border-none":!0,"group-data-[prefix-icon]:mx-2":!0,"group-data-[suffix-icon]:mx-2":!0},color__prefixIcon:{flex:!0,"items-center":!0,"-ml-1":!0,"mr-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"group-data-[prefix-icon]:m-1.5":!0,"group-data-[prefix-icon]:mr-0":!0},color__suffixIcon:{flex:!0,"items-center":!0,"-mr-1":!0,"ml-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"group-data-[suffix-icon]:m-1.5":!0,"group-data-[prefix-icon]:ml-0":!0},date__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"focus:[&::-webkit-datetime-edit-day-field]:bg-accent-100":!0,"focus:[&::-webkit-datetime-edit-month-field]:bg-accent-100":!0,"focus:[&::-webkit-datetime-edit-year-field]:bg-accent-100":!0},"datetime-local__input":{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"focus:[&::-webkit-datetime-edit-day-field]:bg-accent-100":!0,"focus:[&::-webkit-datetime-edit-month-field]:bg-accent-100":!0,"focus:[&::-webkit-datetime-edit-year-field]:bg-accent-100":!0,"focus:[&::-webkit-datetime-edit-hour-field]:bg-accent-100":!0,"focus:[&::-webkit-datetime-edit-minute-field]:bg-accent-100":!0,"focus:[&::-webkit-datetime-edit-ampm-field]:bg-accent-100":!0},file__fileList:{"group/list":!0,peer:!0,"w-full":!0,"min-w-0":!0,"data-[has-multiple]:mb-[1.25em]":!0},file__fileItemIcon:{"h-[1em]":!0,"w-[1em]":!0,"mr-2":!0,"shrink-0":!0},file__fileItem:{flex:!0,"min-w-0":!0,"items-center":!0,"text-zinc-700":!0,"mb-1.5":!0,"last:mb-0":!0,"dark:text-zinc-300":!0},file__fileName:{truncate:!0,"min-w-0":!0,"w-full":!0,shrink:!0,"leading-5":!0,"group-data-[has-multiple]/list:text-xs":!0},file__fileRemove:{"right-2":!0,"ring-accent-400":!0,"rounded-sm":!0,"z-20":!0,flex:!0,"appearance-none":!0,"items-center":!0,"text-[0px]":!0,"outline-hidden":!0,"hover:!text-red-400":!0,"focus-visible:ring-2":!0,"group-data-[disabled]:pointer-events-none":!0,"group-data-[disabled]:!text-zinc-500":!0,"peer-data-[has-multiple]:absolute":!0,"peer-data-[has-multiple]:bottom-[max(0.5em,8px)]":!0,"peer-data-[has-multiple]:left-3":!0,"peer-data-[has-multiple]:text-accent-500":!0,"peer-data-[has-multiple]:text-[11px]":!0,"[line-height:1em]":!0,"peer-data-[has-multiple]:whitespace-nowrap":!0,"group-data-[prefix-icon]:peer-data-[has-multiple]:left-2":!0,"dark:hover:!text-red-400":!0},file__fileRemoveIcon:{block:!0,"text-base":!0,"w-[0.75em]":!0,relative:!0,"z-10":!0},file__inner:{relative:!0,"cursor-pointer":!0,"group-data-[has-multiple]:rounded-sm":!0},file__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"cursor-pointer":!0,"text-transparent":!0,absolute:!0,"inset-0":!0,"opacity-0":!0,"z-10":!0,"file:pointer-events-none":!0,"file:w-0":!0,"file:h-0":!0,"file:overflow-hidden":!0},file__noFiles:{flex:!0,"w-full":!0,"items-center":!0,"text-zinc-400":!0,"dark:text-zinc-500":!0},file__noFilesIcon:{"w-[1em]":!0,"mr-2":!0},form__form:{"group/form":!0},form__actions:{"":!0},form__summaryInner:{"group/summary":!0,border:!0,"border-zinc-300":!0,"bg-white":!0,"rounded-sm":!0,"py-2":!0,"px-3":!0,"shadow-none":!0,"dark:bg-transparent":!0,"dark:border-zinc-700":!0},form__summaryHeader:{"text-base":!0,"text-zinc-700":!0,"font-bold":!0,"mb-2":!0,"dark:text-zinc-300":!0},form__messages:{"":!0},form__message:{"text-red-500":!0,"mb-1.5":!0,"text-[11px]":!0,"[line-height:1em]":!0,"dark:text-red-400":!0,"group-[&]/summary:text-xs":!0},form__messageLink:{"group-[&]/summary:outline-hidden":!0,"group-[&]/summary:focus-visible:ring-2":!0,"group-[&]/summary:ring-accent-500":!0},month__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"focus:[&::-webkit-datetime-edit-month-field]:bg-accent-100":!0,"focus:[&::-webkit-datetime-edit-year-field]:bg-accent-100":!0},radio__decorator:{"rounded-full":!0},radio__decoratorIcon:{"max-w-[50%]":!0},range__inner:{relative:!0,"!border-none":!0,"!ring-0":!0,"!px-0":!0,"!bg-transparent":!0,"!shadow-none":!0},range__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"group/input":!0,"cursor-pointer":!0,"[&::-webkit-slider-runnable-track]:bg-zinc-300/50":!0,"[&::-webkit-slider-runnable-track]:h-[0.25em]":!0,"[&::-webkit-slider-runnable-track]:rounded-sm":!0,"dark:[&::-webkit-slider-runnable-track]:bg-zinc-600/50":!0,"[&::-webkit-slider-thumb]:appearance-none":!0,"[&::-webkit-slider-thumb]:w-[0.85em]":!0,"[&::-webkit-slider-thumb]:aspect-[1/1]":!0,"[&::-webkit-slider-thumb]:bg-accent-500":!0,"[&::-webkit-slider-thumb]:rounded-full":!0,"[&::-webkit-slider-thumb]:relative":!0,"[&::-webkit-slider-thumb]:top-1/2":!0,"[&::-webkit-slider-thumb]:-translate-y-1/2":!0,"[&::-webkit-slider-thumb]:group-data-[disabled]:bg-zinc-500":!0,"[&::-webkit-slider-thumb]:group-data-[disabled]:!ring-zinc-200":!0,"[&::-webkit-slider-thumb]:focus-visible:ring-2":!0,"[&::-webkit-slider-thumb]:focus:!ring-accent-400":!0,"[&::-webkit-slider-thumb]:focus:ring-offset-2":!0,"[&::-webkit-slider-thumb]:shadow-none":!0,"dark:[&::-webkit-slider-thumb]:group-data-[disabled]:!ring-zinc-700":!0,"dark:[&::-webkit-slider-thumb]:focus:ring-offset-zinc-700":!0,"[&::-moz-range-track]:bg-zinc-300/50":!0,"[&::-moz-range-track]:h-[0.25]":!0,"[&::-moz-range-track]:rounded-sm":!0,"dark:[&::-moz-range-track]:bg-zinc-600/50":!0,"[&::-moz-range-thumb]:appearance-none":!0,"[&::-moz-range-thumb]:border-none":!0,"[&::-moz-range-thumb]:w-[0.85em]":!0,"[&::-moz-range-thumb]:h-[0.85em]":!0,"[&::-moz-range-thumb]:bg-accent-500":!0,"[&::-moz-range-thumb]:rounded-full":!0,"[&::-moz-range-thumb]:group-data-[disabled]:bg-zinc-500":!0,"[&::-moz-range-thumb]:group-data-[disabled]:!ring-zinc-300":!0,"[&::-moz-range-thumb]:focus-visible:ring-2":!0,"[&::-moz-range-thumb]:focus:!ring-accent-400":!0,"[&::-moz-range-thumb]:focus:ring-offset-2":!0,"[&::-moz-range-thumb]:shadow-none":!0,"dark:[&::-moz-range-thumb]:group-data-[disabled]:!ring-zinc-500":!0,"dark:[&::-moz-range-thumb]:focus:ring-offset-zinc-700":!0},select__wrapper:{"mb-1.5":!0},select__inner:{relative:!0,flex:!0,"items-center":!0,"bg-white":!0,border:!0,"border-zinc-300":!0,"rounded-sm":!0,"focus-within:ring-1":!0,"focus-within:!ring-accent-400":!0,"focus-within:!border-accent-400":!0,"group-data-[invalid]:border-red-400":!0,"group-data-[invalid]:ring-1":!0,"group-data-[invalid]:ring-red-400":!0,"group-data-[disabled]:bg-zinc-100":!0,"group-data-[disabled]:!cursor-not-allowed":!0,"shadow-none":!0,"group-[&]/repeater:shadow-none":!0,"group-[&]/multistep:shadow-none":!0,"group-data-[multiple]:rounded-sm":!0,"dark:bg-transparent":!0,"dark:border-zinc-700":!0,"dark:group-data-[disabled]:bg-zinc-800/5":!0,"dark:group-data-[invalid]:border-red-400":!0,"dark:group-data-[invalid]:ring-red-400":!0},select__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,grow:!0,"p-2":!0,"py-2":!0,"px-3":!0,"pr-[2em]":!0,"text-sm":!0,"text-zinc-700":!0,"text-ellipsis":!0,"min-w-0":!0,"outline-hidden":!0,"bg-transparent":!0,"group-data-[disabled]:!cursor-not-allowed":!0,"group-data-[prefix-icon]:!pl-0":!0,"group-data-[suffix-icon]:!pr-0":!0,"data-[placeholder]:text-zinc-400":!0,"group-data-[multiple]:!p-0":!0,"selection:bg-accent-100":!0,"dark:data-[placeholder]:text-zinc-400/50":!0,"dark:text-zinc-300":!0,"border-none":!0,"focus:ring-0":!0,"bg-none":!0},select__selectIcon:{absolute:!0,"w-[1em]":!0,"text-zinc-700":!0,"pointer-events-none":!0,"right-2":!0,"group-data-[suffix-icon]:mr-[1.5em]":!0,"dark:text-zinc-300":!0},select__optGroup:{"bg-white":!0,"text-zinc-700":!0,"group/optgroup":!0,"group-data-[multiple]:px-1.5":!0,"pt-1.5":!0,"font-bold":!0,"text-xs":!0,"dark:bg-zinc-800":!0,"dark:text-zinc-300":!0},select__option:{"bg-white":!0,"text-zinc-700":!0,"group-data-[disabled]:opacity-50":!0,"group-data-[disabled]:select-none":!0,"group-data-[multiple]:checked:bg-accent-100":!0,"group-data-[multiple]:focus:bg-accent-100":!0,"group-data-[multiple]:text-xs":!0,"group-data-[multiple]:outline-hidden":!0,"group-data-[multiple]:border-none":!0,"group-data-[multiple]:py-1.5":!0,"group-data-[multiple]:px-2":!0,"dark:bg-zinc-800":!0,"dark:text-zinc-300":!0,"dark:group-data-[multiple]:focus:bg-accent-700":!0,"dark:group-data-[multiple]:checked:bg-accent-700":!0},select__prefixIcon:{flex:!0,"items-center":!0,"mr-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"ml-2":!0,"text-zinc-600":!0,"dark:text-zinc-300":!0},select__suffixIcon:{flex:!0,"items-center":!0,"ml-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"mr-2":!0,"text-zinc-600":!0,"dark:text-zinc-300":!0},submit__outer:{group:!0,"max-w-none":!0,"min-w-0":!0,grow:!0,"mb-4":!0,"data-[disabled]:select-none":!0,"text-sm":!0,"data-[disabled]:opacity-100":!0},submit__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"bg-accent-500":!0,"!text-white":!0,"active:text-accent-100":!0,"active:bg-accent-600":!0,"hover:bg-accent-600":!0,"disabled:border-zinc-300":!0,"disabled:bg-zinc-400":!0,"disabled:text-zinc-100":!0,"group-data-[disabled]:!cursor-not-allowed":!0,"dark:disabled:border-zinc-100":!0,"dark:disabled:bg-zinc-500":!0,"dark:disabled:text-zinc-200":!0,"dark:text-white":!0,"dark:ring-offset-accent-400":!0,"before:transition-all":!0,"group-data-[loading=true]/form:before:content['']":!0,"group-data-[loading=true]/form:before:block":!0,"group-data-[loading=true]/form:before:animate-spin":!0,"group-data-[loading=true]/form:before:w-5":!0,"group-data-[loading=true]/form:before:h-5":!0,"group-data-[loading=true]/form:before:rounded-full":!0,"group-data-[loading=true]/form:before:mr-3":!0,"group-data-[loading=true]/form:before:-ml-1.5":!0,"group-data-[loading=true]/form:before:border-2":!0,"group-data-[loading=true]/form:before:border-solid":!0,"group-data-[loading=true]/form:before:border-white":!0,"group-data-[loading=true]/form:before:border-r-transparent":!0},submit__prefixIcon:{flex:!0,"items-center":!0,"-ml-1":!0,"mr-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"text-zinc-100":!0},submit__suffixIcon:{flex:!0,"items-center":!0,"-mr-1":!0,"ml-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"text-zinc-100":!0},textarea__inner:{flex:!0,"items-center":!0,"mb-1.5":!0,"bg-white":!0,border:!0,"border-zinc-300":!0,"rounded-sm":!0,"focus-within:ring-1":!0,"focus-within:!ring-accent-400":!0,"focus-within:!border-accent-400":!0,"group-data-[invalid]:border-red-400":!0,"group-data-[invalid]:ring-1":!0,"group-data-[invalid]:ring-red-400":!0,"group-data-[disabled]:bg-zinc-100":!0,"shadow-none":!0,"group-[&]/repeater:shadow-none":!0,"group-[&]/multistep:shadow-none":!0,"dark:border-zinc-700":!0,"dark:group-data-[disabled]:bg-zinc-800/5":!0,"dark:group-data-[invalid]:border-red-400":!0,"dark:group-data-[invalid]:ring-red-400":!0,"dark:bg-transparent":!0},textarea__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"text-sm":!0,"h-24":!0,"text-zinc-700":!0,"min-w-0":!0,grow:!0,shrink:!0,"!py-2":!0,"!px-3":!0,"outline-hidden":!0,"bg-transparent":!0,"selection:bg-accent-100":!0,"placeholder:text-zinc-400":!0,"group-data-[disabled]:!cursor-not-allowed":!0,"dark:placeholder-zinc-400/50":!0,"dark:text-zinc-300":!0,"p-0":!0,"border-none":!0,"focus:ring-0":!0},textarea__prefixIcon:{flex:!0,"items-center":!0,"-ml-1":!0,"mr-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"!ml-2":!0,"!mr-0":!0,"text-zinc-600":!0,"dark:text-zinc-300":!0},textarea__suffixIcon:{flex:!0,"items-center":!0,"-mr-1":!0,"ml-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"!mr-2":!0,"!ml-0":!0,"text-zinc-600":!0,"dark:text-zinc-300":!0},time__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"focus:[&::-webkit-datetime-edit-hour-field]:bg-accent-100":!0,"focus:[&::-webkit-datetime-edit-minute-field]:bg-accent-100":!0,"focus:[&::-webkit-datetime-edit-ampm-field]:bg-accent-100":!0},week__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"focus:[&::-webkit-datetime-edit-week-field]:bg-accent-100":!0,"focus:[&::-webkit-datetime-edit-year-field]:bg-accent-100":!0},autocomplete__selections:{flex:!0,absolute:!0,"inset-0":!0,"group-data-[multiple]:static":!0,"group-data-[multiple]:block":!0,"group-data-[empty]:hidden":!0,"group-data-[multiple]:mt-1.5":!0},autocomplete__selectionWrapper:{"bg-zinc-100":!0,"rounded-sm":!0,"group-data-[multiple]:border":!0,"group-data-[multiple]:border-zinc-200":!0,"group-data-[multiple]:mb-1.5":!0,"outline-hidden":!0,"data-[active-selection=true]:ring-2":!0,"data-[active-selection=true]:ring-accent-400":!0,"dark:bg-zinc-600":!0,"dark:group-data-[multiple]:border-zinc-700":!0,"[&.formkit-dropZone]:opacity-25":!0,"[&.formkit-touchDropZone]:opacity-25":!0,"[&.formkit-touchDragging]:!flex":!0,"[&.formkit-longTouch]:opacity-25":!0},autocomplete__selection:{"rounded-sm":!0,just:!0,"pl-2":!0,"[&>*]:ml-0":!0,"dark:text-zinc-200":!0},colorpicker__outer:{group:!0,"max-w-none":!0,"min-w-0":!0,grow:!0,"mb-4":!0,"data-[disabled]:select-none":!0,"data-[disabled]:opacity-50":!0,"text-sm":!0,"data-[disabled]:cursor-not-allowed":!0,"data-[disabled]:pointer-events-none":!0},colorpicker__help:{"text-zinc-500":!0,"text-[11px]":!0,"[line-height:1em]":!0,"dark:text-zinc-400":!0,"group-data-[inline]:-mt-1":!0,"group-data-[inline]:mb-2":!0},colorpicker__inner:{relative:!0,"inline-flex":!0,"!w-auto":!0,"pl-2":!0,"group-data-[inline]:border-none":!0,"group-data-[inline]:shadow-none":!0,"group-data-[inline]:p-0":!0,"group-data-[inline]:bg-transparent":!0,"group-data-[inline]:outline-hidden":!0,"group-data-[inline]:!ring-0":!0,"group-data-[inline]:!w-full":!0,"group-data-[inline]:rounded-sm":!0},colorpicker__swatchPreview:{"w-full":!0,flex:!0,"justify-start":!0,"items-center":!0,"rounded-sm":!0,"text-sm":!0,"cursor-pointer":!0,"outline-hidden":!0},colorpicker__canvasSwatchPreviewWrapper:{relative:!0,"before:content-['']":!0,"before:absolute":!0,"before:inset-0":!0,"before:rounded-sm":!0,"before:shadow-[inset_0_0_0_1px_rgba(0,0,0,0.2)]":!0,"before:z-[2]":!0},colorpicker__canvasSwatchPreview:{"text-sm":!0,"rounded-sm":!0,"aspect-[1/1]":!0,"shrink-0":!0,grow:!0,"!w-[1.5em]":!0},colorpicker__valueString:{"text-sm":!0,"text-zinc-700":!0,"selection:bg-accent-100":!0,"font-mono":!0,"inline-block":!0,"ml-2":!0,"mr-1.5":!0,"dark:text-zinc-300":!0,"dark:selection:text-zinc-700":!0},colorpicker__panel:{absolute:!0,"left-0":!0,"top-full":!0,"z-[99]":!0,flex:!0,"w-[100vw]":!0,"max-w-[18.5em]":!0,"touch-manipulation":!0,"flex-col":!0,"rounded-sm":!0,border:!0,"bg-white":!0,"p-2":!0,"shadow-xs":!0,"group-data-[inline]:static":!0,"group-data-[inline]:max-w-none":!0,"border-zinc-300":!0,"group-data-[inline]:z-auto":!0,"group-data-[inline]:w-full":!0,"group-data-[inline]:shadow-none":!0,"group-data-[inline]:group-data-[disabled]:!cursor-not-allowed":!0,"group-data-[inline]:group-data-[disabled]:!pointer-events-none":!0,"group-data-[inline]:[&:has([id^=swatches]:first-child:last-child)]:w-auto":!0,"group-data-[inline]:[&:has([id^=swatches]:first-child:last-child)_[id^=swatches]>div]:w-[1.5em]":!0,"dark:bg-zinc-800":!0,"dark:border-zinc-700":!0,"dark:group-data-[inline]:bg-transparent":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:!fixed":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:top-auto":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:max-w-none":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:bottom-0":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:left-0":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:rounded-none":!0},colorpicker__panelClose:{flex:!0,"justify-end":!0,"items-center":!0,"text-zinc-600":!0,"mb-1.5":!0,"-mt-1":!0,"border-none":!0,"bg-none":!0,"border-b":!0,"border-zinc-200":!0,"w-[calc(100%+1rem)]":!0,"-ml-2":!0,"pt-0":!0,"pr-2":!0,"pb-1.5":!0,"pl-2":!0,"dark:border-zinc-800":!0},colorpicker__closeIcon:{"w-[2rem]":!0,"aspect-[1/1]":!0,"p-1":!0,"rounded-sm":!0,border:!0,"[&>svg]:w-full":!0,"[&>svg]:aspect-[1/1]":!0,"[&>svg]:max-w-none":!0,"[&>svg]:max-h-none":!0},colorpicker__controlGroup:{grid:!0,"[grid-template-areas:'a_a_a'_'b_c_e'_'b_d_e']":!0,"mb-2":!0},colorpicker__LS:{"[grid-area:a]":!0,relative:!0,"mb-2":!0},colorpicker__canvas:{block:!0,"w-full":!0},colorpicker__canvasLS:{"aspect-[2/1]":!0,"cursor-pointer":!0,"rounded-xs":!0},colorpicker__canvasHue:{"rounded-xs":!0},colorpicker__canvasAlpha:{"rounded-xs":!0},colorpicker__preview:{"rounded-sm":!0,"after:rounded-sm":!0,relative:!0,"inline-flex":!0,"aspect-[1/1]":!0,"overflow-hidden":!0,"[grid-area:b]":!0,"mr-2":!0,"after:absolute":!0,"after:left-0":!0,"after:top-0":!0,"after:h-full":!0,"after:w-full":!0,"after:shadow-[inset_0_0_0_1px_rgba(0,0,0,0.2)]":!0,"after:content-['']":!0,"w-[2em]":!0,"dark:after:shadow-[inset_0_0_0_1px_rgba(255,255,255,0.25)]":!0},colorpicker__hue:{"[grid-area:c]":!0,relative:!0,"inline-flex":!0,"h-3/4":!0},colorpicker__alpha:{"[grid-area:d]":!0,relative:!0,"inline-flex":!0,"h-3/4":!0},colorpicker__eyeDropper:{"[grid-area:e]":!0,"w-[2em]":!0,"ml-2":!0,"inline-flex":!0,"self-center":!0,"justify-center":!0,"justify-self-center":!0,"aspect-[1/1]":!0,"rounded-sm":!0,border:!0,"border-zinc-200":!0,"cursor-pointer":!0,"content-center":!0,"items-center":!0,"text-zinc-600":!0,"dark:border-zinc-800":!0},colorpicker__eyeDropperIcon:{"w-auto":!0,"[&>svg]:w-[1em]":!0,"dark:text-zinc-400":!0},colorpicker__control:{absolute:!0,"bg-white":!0,"shadow-[0_0_0_2px_rgba(255,255,255,1),0_0_0_3px_rgba(0,0,0,0.2)]":!0,"-translate-y-1/2":!0,"-translate-x-1/2":!0,"pointer-events-none":!0,"data-[prevent-focus-style]:shadow-[0_0_0_2px_rgba(255,255,255,1),0_0_0_3px_rgba(0,0,0,0.2)]":!0,"focus-visible:outline-hidden":!0,"focus-visible:ring-2":!0,"focus-visible:ring-offset-2":!0,"focus-visible:ring-accent-400":!0},colorpicker__controlLS:{"w-[10px]":!0,"h-[10px]":!0,"rounded-full":!0},colorpicker__controlHue:{"w-[4px]":!0,"h-[calc(100%-2px)]":!0,"top-1/2":!0,"rounded-sm":!0},colorpicker__controlAlpha:{"w-[4px]":!0,"h-[calc(100%-2px)]":!0,"top-1/2":!0,"rounded-sm":!0},colorpicker__formatField:{flex:!0,"items-center":!0,"justify-center":!0,grow:!0},colorpicker__colorField:{"bg-transparent":!0,"text-zinc-700":!0,border:!0,"border-zinc-200":!0,"dark:border-zinc-800":!0,"dark:text-zinc-300":!0,"dark:selection:text-zinc-700":!0},colorpicker__colorInputGroup:{flex:!0,"items-center":!0,"justify-center":!0,grow:!0},colorpicker__fieldGroup:{flex:!0,"flex-col":!0,"items-center":!0,"justify-center":!0,"w-full":!0,"mr-1":!0,"[&>input]:p-1":!0,"[&>input]:text-sm":!0,"[&>input]:text-zinc-700":!0,"[&>input]:selection:bg-accent-100":!0,"[&>input]:m-0":!0,"[&>input]:grow":!0,"[&>input]:shrink":!0,"[&>input]:w-full":!0,"[&>input]:border":!0,"[&>input]:border-zinc-200":!0,"[&>input]:rounded-sm":!0,"[&>input]:text-center":!0,"[&>input]:appearance-none":!0,"[&>input::-webkit-outer-spin-button]:appearance-none":!0,"[&>input::-webkit-inner-spin-button]:appearance-none":!0,"[&>input::-webkit-inner-spin-button]:m-0":!0,"[&>input:focus]:outline-hidden":!0,"[&>input:focus]:ring-1":!0,"[&>input:focus]:ring-accent-500":!0,"[&>input:focus]:border-accent-500":!0,"max-[431px]:[&>input]:text-base":!0},colorpicker__fieldLabel:{"text-xs":!0,"text-zinc-500":!0,"mt-1.5":!0,"dark:text-zinc-400":!0},colorpicker__formatSwitcher:{flex:!0,"justify-end":!0,"self-start":!0,uppercase:!0,"shrink-0":!0,"p-1":!0,"mt-0.5":!0,"text-zinc-600":!0,"rounded-sm":!0,"select-none":!0,"dark:text-zinc-400":!0},colorpicker__switchIcon:{"[&>svg]:w-3":!0},colorpicker__swatches:{"inline-flex":!0,"flex-wrap":!0,"w-full":!0,"justify-self-center":!0,"min-w-0":!0,"mx-auto":!0,"px-[1px]":!0,"pt-2":!0,"pb-2":!0,"mt-2":!0,"-mb-2":!0,"border-t":!0,"border-zinc-200":!0,"overflow-auto":!0,"max-h-[200px]":!0,"select-none":!0,"first:-mt-[3px]":!0,"first:last:-mb-[3px]":!0,"first:last:pb-[2px]":!0,"first:pt-px":!0,"first:border-t-0":!0,"dark:border-zinc-800":!0},colorpicker__swatchGroup:{flex:!0,"flex-wrap":!0,"w-full":!0,"mb-2":!0,"last:mb-0":!0},colorpicker__swatchGroupLabel:{"ml-1":!0,block:!0,"w-full":!0,"text-xs":!0,"text-zinc-500":!0,"dark:text-zinc-400":!0},colorpicker__swatch:{relative:!0,"text-sm":!0,"w-[calc((100%/10)-0.5em)]":!0,"max-w-[22px]":!0,"m-[0.16em]":!0,"cursor-pointer":!0,"before:content-['']":!0,"before:absolute":!0,"before:inset-0":!0,"before:rounded-sm":!0,"before:shadow-[inset_0_0_0_1px_rgba(0,0,0,0.2)]":!0,"before:pointer-events-none":!0,"before:z-[2]":!0,"dark:before:shadow-[inset_0_0_0_1px_rgba(255,255,255,0.25)]":!0,"data-[active=true]:after:content-['']":!0,"data-[active=true]:after:block":!0,"data-[active=true]:after:absolute":!0,"data-[active=true]:after:w-1.5":!0,"data-[active=true]:after:h-1.5":!0,"data-[active=true]:after:top-1/2":!0,"data-[active=true]:after:left-1/2":!0,"data-[active=true]:after:pointer-events-none":!0,"data-[active=true]:after:rounded-full":!0,"data-[active=true]:after:-translate-x-1/2":!0,"data-[active=true]:after:-translate-y-1/2":!0,"data-[active=true]:after:bg-white":!0,"data-[active=true]:after:z-[2]":!0,"data-[active=true]:after:ring-1":!0,"data-[active=true]:after:ring-[rgba(0,0,0,0.33)]":!0,"[&>canvas]:block":!0,"[&>canvas]:w-full":!0,"[&>canvas]:aspect-[1/1]":!0,"[&>canvas]:rounded-sm":!0,"[&>canvas:focus-visible]:outline-hidden":!0,"[&>canvas:focus-visible]:ring-2":!0,"[&>canvas:focus-visible]:ring-accent-400":!0,"[&>canvas:focus-visible]:ring-offset-2":!0,"[&>canvas:focus-visible]:ring-offset-white":!0,"dark:[&>canvas:focus-visible]:ring-offset-zinc-700":!0},datepicker__inner:{relative:!0},datepicker__removeSelection:{"self-stretch":!0,"text-sm":!0,flex:!0,"items-center":!0,"ml-1":!0,"mr-2":!0,"text-zinc-700":!0,"hover:text-red-400":!0,"z-10":!0,"dark:text-zinc-300":!0},datepicker__clearIcon:{"[&>svg]:w-[0.75em]":!0},datepicker__panelWrapper:{"group/panel":!0,absolute:!0,"min-w-[20em]":!0,"top-[calc(100%_+_0.5em)]":!0,"left-0":!0,"shadow-[0_0_1.25em_rgba(0,0,0,.25)]":!0,"rounded-sm":!0,"p-4":!0,"bg-white":!0,"z-10":!0,"dark:bg-zinc-800":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:!fixed":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:top-auto":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:max-w-none":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:bottom-0":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:left-0":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:rounded-none":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:w-full":!0},datepicker__panelHeader:{grid:!0,"grid-cols-[2.5em_1fr_2.5em]":!0,"justify-center":!0,"items-center":!0,"border-b-2":!0,"border-zinc-200":!0,"mb-2":!0,"pb-2.5":!0,"dark:border-zinc-700":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:grid-cols-[2.5em_1fr_2.5em_2.5em]":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:group-data-[panel=time]/panel:grid-cols-[2.5em_1fr_2.5em]":!0,"[@media(max-width:431px)_and_(hover:none)]:group-[&:not([data-inline])]:group-data-[panel=month]/panel:grid-cols-[2.5em_1fr_2.5em]":!0},datepicker__panelClose:{"aspect-[1/1]":!0,border:!0,"border-zinc-200":!0,"rounded-sm":!0,flex:!0,"items-center":!0,"justify-center":!0,"text-zinc-700":!0,"[&_svg]:w-[1.25em]":!0,"dark:text-zinc-300":!0,"dark:border-zinc-800":!0,"[@media(max-width:431px)_and_(hover:none)]:group-data-[panel=time]/panel:col-start-3":!0,"[@media(max-width:431px)_and_(hover:none)]:group-data-[panel=month]/panel:col-start-3":!0},datepicker__panel:{flex:!0,"justify-center":!0},datepicker__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"placeholder:text-zinc-400":!0},datepicker__monthsHeader:{flex:!0,"items-center":!0,"justify-center":!0,"col-start-2":!0,"col-end-2":!0},datepicker__timeHeader:{flex:!0,"items-center":!0,"justify-center":!0,"col-start-2":!0,"col-end-2":!0},datepicker__months:{grid:!0,"grid-cols-3":!0,"w-full":!0},datepicker__month:{"m-1.5":!0,"p-1.5":!0,"text-center":!0,"text-zinc-700":!0,"rounded-sm":!0,"bg-zinc-200":!0,"aria-selected:!bg-accent-500":!0,"aria-selected:!text-white":!0,"focus:outline":!0,"focus:outline-2":!0,"focus:outline-accent-500":!0,"focus:outline-offset-2":!0,"focus:bg-white":!0,"focus:text-zinc-700":!0,"data-[is-extra=true]:opacity-25":!0,"group-data-[disabled=true]:opacity-50":!0,"group-data-[disabled=true]:cursor-default":!0,"group-data-[disabled=true]:pointer-events-none":!0,"dark:bg-zinc-700":!0,"dark:text-zinc-300":!0},datepicker__yearsHeader:{flex:!0,"items-center":!0,"justify-center":!0,"text-zinc-700":!0,"col-start-2":!0,"col-end-2":!0,"dark:text-zinc-300":!0},datepicker__years:{grid:!0,"grid-cols-5":!0,"w-full":!0},datepicker__year:{"text-sm":!0,"text-center":!0,"text-zinc-700":!0,"items-center":!0,"m-1.5":!0,"p-1.5":!0,"rounded-sm":!0,"bg-zinc-200":!0,"aria-selected:!bg-accent-500":!0,"aria-selected:!text-white":!0,"focus:outline":!0,"focus:outline-2":!0,"focus:outline-accent-500":!0,"focus:outline-offset-2":!0,"focus:bg-white":!0,"data-[is-extra=true]:opacity-25":!0,"group-data-[disabled=true]:opacity-50":!0,"group-data-[disabled=true]:cursor-default":!0,"group-data-[disabled=true]:pointer-events-none":!0,"dark:bg-zinc-700":!0,"dark:text-zinc-300":!0},datepicker__weekDays:{grid:!0,"grid-cols-7":!0},datepicker__weekDay:{"w-[2.25em]":!0,"text-zinc-700":!0,"m-1.5":!0,"rounded-sm":!0,"font-medium":!0,lowercase:!0,"dark:text-zinc-500":!0},datepicker__calendarWeeks:{"":!0},datepicker__week:{grid:!0,"grid-cols-7":!0,"group-data-[disabled=true]:opacity-50":!0,"group-data-[disabled=true]:cursor-default":!0,"group-data-[disabled=true]:pointer-events-none":!0},datepicker__dayCell:{flex:!0,"items-center":!0,"justify-center":!0,"text-center":!0,"text-zinc-700":!0,"w-[2.25em]":!0,"h-[2.25em]":!0,"m-1":!0,"p-2":!0,"rounded-sm":!0,"bg-zinc-200":!0,"aria-selected:bg-accent-500":!0,"aria-selected:text-white":!0,"focus:outline":!0,"focus:outline-2":!0,"focus:outline-accent-500":!0,"focus:outline-offset-2":!0,"focus:bg-white":!0,"data-[is-extra=true]:opacity-25":!0,"data-[disabled=true]:opacity-50":!0,"data-[disabled=true]:cursor-default":!0,"data-[disabled=true]:pointer-events-none":!0,"dark:bg-zinc-600":!0,"dark:text-zinc-300":!0,"dark:aria-selected:bg-accent-500":!0,"dark:aria-selected:text-white":!0,"dark:focus:outline-accent-500":!0,"dark:focus:bg-zinc-200":!0,"dark:focus:text-zinc-700":!0},datepicker__timeInput:{"w-full":!0,"border-2":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"text-zinc-700":!0,"border-zinc-200":!0,"rounded-sm":!0,"p-1.5":!0,"my-2.5":!0,"focus-visible:outline-accent-500":!0,"dark:text-zinc-300":!0,"dark:bg-transparent":!0,"dark:border-zinc-700":!0},datepicker__daysHeader:{flex:!0,"items-center":!0,"justify-center":!0},datepicker__prev:{"mr-auto":!0,"px-2.5":!0,"py-0.5":!0,"hover:bg-zinc-100":!0,"rounded-sm":!0,"col-start-1":!0,"col-end-1":!0,"focus-visible:outline-hidden":!0,"focus-visible:ring-2":!0,"focus-visible:ring-accent-400":!0,"focus-visible:ring-offset-2":!0},datepicker__prevLabel:{hidden:!0},datepicker__prevIcon:{flex:!0,"w-[0.75em]":!0,"select-none":!0,"text-zinc-700":!0,"[&>svg]:w-full":!0,"dark:text-zinc-300":!0},datepicker__dayButton:{"appearance-none":!0,"text-zinc-700":!0,"cursor-pointer":!0,"px-2.5":!0,"py-0.5":!0,"border-2":!0,"border-zinc-200":!0,"rounded-sm":!0,"mx-1":!0,"hover:border-accent-500":!0,"focus-visible:outline-hidden":!0,"focus-visible:ring-2":!0,"focus-visible:ring-accent-400":!0,"focus-visible:ring-offset-2":!0,"dark:text-zinc-300":!0,"dark:border-zinc-700":!0,"dark:hover:border-accent-400":!0},datepicker__monthButton:{"appearance-none":!0,"text-zinc-700":!0,"cursor-pointer":!0,"px-2.5":!0,"py-0.5":!0,"border-2":!0,"border-zinc-200":!0,"rounded-sm":!0,"mx-1":!0,"hover:border-accent-500":!0,"focus-visible:outline-hidden":!0,"focus-visible:ring-2":!0,"focus-visible:ring-accent-400":!0,"focus-visible:ring-offset-2":!0,"dark:text-zinc-300":!0,"dark:border-zinc-700":!0,"dark:hover:border-accent-400":!0},datepicker__yearButton:{"appearance-none":!0,"text-zinc-700":!0,"cursor-pointer":!0,"px-2.5":!0,"py-0.5":!0,"border-2":!0,"border-zinc-200":!0,"rounded-sm":!0,"mx-1":!0,"hover:border-accent-500":!0,"focus-visible:outline-hidden":!0,"focus-visible:ring-2":!0,"focus-visible:ring-accent-400":!0,"focus-visible:ring-offset-2":!0,"dark:text-zinc-300":!0,"dark:border-zinc-700":!0,"dark:hover:border-accent-400":!0},datepicker__next:{"ml-auto":!0,"px-2.5":!0,"py-0.5":!0,"rounded-sm":!0,"hover:bg-zinc-100":!0,"hover:rounded-sm":!0,"col-start-3":!0,"col-end-3":!0,"focus-visible:outline-hidden":!0,"focus-visible:ring-2":!0,"focus-visible:ring-accent-400":!0,"focus-visible:ring-offset-2":!0},datepicker__nextLabel:{hidden:!0},datepicker__nextIcon:{flex:!0,"w-[0.75em]":!0,"select-none":!0,"text-zinc-700":!0,"[&>svg]:w-full":!0,"dark:text-zinc-300":!0},datepicker__openButton:{"appearance-none":!0,"border-0":!0,"bg-transparent":!0,flex:!0,"p-0":!0,"self-stretch":!0,"cursor-pointer":!0,"focus-visible:outline-hidden":!0,"focus-visible:ring-2":!0,"focus-visible:ring-accent-400":!0,"focus-visible:ring-offset-2":!0,"focus-visible:rounded-sm":!0},datepicker__calendarIcon:{"text-zinc-600":!0,"focus-visible:text-accent-500":!0,flex:!0,"w-[1em]":!0,"grow-0":!0,"shrink-0":!0,"self-stretch":!0,"select-none":!0,"[&>svg]:w-full":!0,"[&>svg]:m-auto":!0,"[&>svg]:max-h-[1em]":!0,"[&>svg]:max-w-[1em]":!0},dropdown__placeholder:{"text-zinc-400":!0,grow:!0,"dark:text-zinc-400/50":!0},dropdown__selector:{flex:!0,grow:!0,"justify-between":!0,"w-full":!0,"py-2":!0,"pl-3":!0,"pr-0":!0,"text-sm":!0,"text-zinc-700":!0,"text-left":!0,"group-data-[disabled]:!cursor-not-allowed":!0,"group-data-[prefix-icon]:!pl-0":!0,"group-data-[suffix-icon]:!pr-0":!0,"data-[placeholder]:text-zinc-400":!0,"selection:bg-accent-100":!0,"dark:data-[placeholder]:text-zinc-400/50":!0,"dark:text-zinc-300":!0},dropdown__selectIcon:{"shrink-0":!0},dropdown__selectionsWrapper:{"w-[85%]":!0,"overflow-hidden":!0},dropdown__selection:{"[&>*]:ml-0":!0},dropdown__selections:{"inline-flex":!0,"items-center":!0},dropdown__selectionsItem:{"whitespace-nowrap":!0,"mr-1":!0},dropdown__tagWrapper:{"[&.formkit-dropZone_.formkit-tag]:opacity-25":!0,"[&.formkit-touchDropZone_.formkit-tag]:opacity-25":!0},dropdown__truncationCount:{flex:!0,"items-center":!0,"justify-center":!0,"h-[1.5em]":!0,"rounded-sm":!0,"bg-zinc-400":!0,"text-white":!0,"whitespace-nowrap":!0,"text-[11px]":!0,"[line-height:1em]":!0,"tracking-tighter":!0,"leading-0":!0,"py-1":!0,"px-1":!0,"shrink-0":!0,"my-auto":!0},mask__inner:{relative:!0},mask__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"group-data-[has-overlay]:!caret-zinc-700":!0,"dark:group-data-[has-overlay]:!caret-zinc-300":!0},rating__inner:{"text-zinc-300":!0},rating__itemsWrapper:{relative:!0,"inline-flex":!0,"focus:border-accent-500":!0},rating__onItemRow:{"h-full":!0,"w-full":!0},rating__offItemRow:{"h-full":!0,"w-full":!0},rating__onItemWrapper:{"[&>*]:w-full":!0,"[&>*]:h-full":!0,"w-full":!0,"h-full":!0,"text-yellow-400":!0},rating__offItemWrapper:{"text-zinc-300":!0,"w-full":!0,"h-full":!0,"[&>*]:w-full":!0,"[&>*]:h-full":!0,"dark:text-zinc-600":!0},rating__ratingItem:{relative:!0,"focus-within:outline":!0,"focus-within:outline-accent-500":!0,"w-[1.5em]":!0,"h-[1.5em]":!0},rating__itemLabelInner:{"h-px":!0,"w-px":!0,"overflow-hidden":!0,absolute:!0,"white-space-nowrap":!0},rating__itemLabel:{absolute:!0,"h-full":!0},rating__ratingIcon:{"w-[1.5em]":!0,"h-[1.5em]":!0,flex:!0},rating__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"outline-hidden":!0},rating__messages:{"mt-1.5":!0},repeater__outer:{"min-w-0":!0,grow:!0,"mb-4":!0,"text-sm":!0,"group/repeater":!0,"max-w-full":!0},repeater__fieldset:{"min-w-0":!0},repeater__legend:{block:!0,"text-zinc-700":!0,"text-xs":!0,"font-bold":!0,"dark:text-zinc-300":!0,"mb-2":!0},repeater__content:{"min-w-0":!0,grow:!0,"p-5":!0,flex:!0,"flex-col":!0,"align-center":!0,"[&>div[data-type]]:max-w-none":!0,"[&>div[data-type]:last-child]:mb-0":!0},repeater__addButton:{"!mb-0":!0,"group-data-[disabled]/repeater:pointer-events-none":!0,"group-data-[disabled]/repeater:opacity-50":!0,"group-data-[disabled]/repeater:grayscale":!0},repeater__controlLabel:{absolute:!0,"opacity-0":!0,"pointer-events-none":!0,"text-[0px]":!0},repeater__controls:{flex:!0,"flex-col":!0,"items-center":!0,"justify-center":!0,"bg-zinc-50":!0,"p-2":!0,"[&>li]:aspect-[1/1]":!0,"dark:bg-zinc-800":!0,"rounded-sm":!0,"rounded-tl-none":!0,"rounded-bl-none":!0},repeater__downControl:{"w-[1.5em]":!0,"h-[1.5em]":!0,"my-1.5":!0,"mx-auto":!0,flex:!0,"items-center":!0,"appearance-none":!0,"justify-center":!0,"aspect-[1/1]":!0,"text-zinc-500":!0,"hover:text-accent-500":!0,"disabled:hover:text-inherit":!0,"disabled:opacity-25":!0,"disabled:!text-zinc-500":!0,"dark:text-zinc-300":!0,"dark:disabled:!text-zinc-300":!0,"dark:hover:text-accent-400":!0},repeater__upControl:{"w-[1.5em]":!0,"h-[1.5em]":!0,"my-1.5":!0,"mx-auto":!0,flex:!0,"items-center":!0,"appearance-none":!0,"justify-center":!0,"aspect-[1/1]":!0,"text-zinc-500":!0,"hover:text-accent-500":!0,"disabled:hover:text-inherit":!0,"disabled:opacity-25":!0,"disabled:!text-zinc-500":!0,"dark:text-zinc-300":!0,"dark:disabled:!text-zinc-300":!0,"dark:hover:text-accent-400":!0},repeater__removeControl:{"w-[1.5em]":!0,"h-[1.5em]":!0,"my-1.5":!0,"mx-auto":!0,flex:!0,"items-center":!0,"appearance-none":!0,"justify-center":!0,"aspect-[1/1]":!0,"text-zinc-500":!0,"hover:text-accent-500":!0,"disabled:hover:text-inherit":!0,"disabled:opacity-25":!0,"disabled:!text-zinc-500":!0,"dark:text-zinc-300":!0,"dark:disabled:!text-zinc-300":!0,"dark:hover:text-accent-400":!0},repeater__insertControl:{"w-[1.5em]":!0,"h-[1.5em]":!0,"my-1.5":!0,"mx-auto":!0,flex:!0,"items-center":!0,"appearance-none":!0,"justify-center":!0,"aspect-[1/1]":!0,"text-zinc-500":!0,"hover:text-accent-500":!0,"disabled:hover:text-inherit":!0,"disabled:opacity-25":!0,"disabled:!text-zinc-500":!0,"dark:text-zinc-300":!0,"dark:disabled:!text-zinc-300":!0,"dark:hover:text-accent-400":!0},repeater__help:{"text-zinc-500":!0,"text-[11px]":!0,"[line-height:1em]":!0,"dark:text-zinc-400":!0,"mb-2":!0,"-mt-1":!0},repeater__item:{flex:!0,relative:!0,"w-full":!0,"mb-2":!0,"bg-white":!0,border:!0,"border-zinc-200":!0,"rounded-sm":!0,"shadow-none":!0,"dark:border-zinc-700":!0,"dark:bg-transparent":!0,"[&.formkit-dropZone]:opacity-30":!0,"[&.formkit-dropZone]:blur-[2px]":!0},repeater__dragHandleWrapper:{relative:!0,"w-8":!0,"bg-zinc-50":!0,"rounded-sm":!0,"rounded-tr-none":!0,"rounded-br-none":!0,"dark:bg-zinc-800":!0},repeater__dragHandle:{"w-full":!0,"h-full":!0,flex:!0,absolute:!0,"top-0":!0,"left-0":!0,"cursor-grab":!0,"active:cursor-grabbing":!0},repeater__dragHandleIcon:{"w-2":!0,"m-auto":!0,"text-zinc-400":!0,"dark:text-zinc-600":!0,"[&>svg>path]:fill-current":!0},repeater__moveDownIcon:{block:!0,"w-[0.75em]":!0,"aspect-[1/1]":!0},repeater__moveUpIcon:{block:!0,"w-[0.75em]":!0,"aspect-[1/1]":!0},repeater__removeIcon:{block:!0,"w-[1.25em]":!0,"aspect-[1/1]":!0},repeater__addIcon:{block:!0,"w-[1.25em]":!0,"aspect-[1/1]":!0},slider__outer:{group:!0,"max-w-none":!0,"min-w-0":!0,grow:!0,"mb-4":!0,"data-[disabled]:select-none":!0,"data-[disabled]:opacity-50":!0,"text-sm":!0,"data-[disabled]:pointer-events-none":!0},slider__help:{"text-zinc-500":!0,"text-[11px]":!0,"[line-height:1em]":!0,"dark:text-zinc-400":!0,"-mt-0.5":!0,"mb-1.5":!0},slider__sliderInner:{flex:!0,"items-center":!0,"[&>[data-type=number]]:mb-0":!0,"[&>[data-type=number]]:ml-2.5":!0,"[&>[data-type=number]]:shrink":!0,"[&>[data-type=number]]:grow-0":!0,"[&[data-has-mark-labels=true]_[id^=track]]:mb-5":!0},slider__track:{grow:!0,relative:!0,"z-20":!0,"py-2.5":!0,"select-none":!0},slider__trackWrapper:{"px-[2px]":!0,"rounded-full":!0,"bg-zinc-300":!0,"dark:bg-zinc-500":!0},slider__trackInner:{"h-1.5":!0,"mx-0.5":!0,relative:!0},slider__prefixIcon:{flex:!0,"items-center":!0,"-ml-1":!0,"mr-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"text-zinc-600":!0,"dark:text-zinc-300":!0},slider__suffixIcon:{flex:!0,"items-center":!0,"-mr-1":!0,"ml-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0,"text-zinc-600":!0,"dark:text-zinc-300":!0},slider__fill:{"h-full":!0,"rounded-full":!0,absolute:!0,"top-0":!0,"-mx-1":!0,"bg-accent-500":!0,"group-data-[disabled]:bg-zinc-500":!0},slider__marks:{absolute:!0,"pointer-events-none":!0,"inset-0":!0},slider__mark:{absolute:!0,"top-1/2":!0,"w-[3px]":!0,"h-[3px]":!0,"rounded-full":!0,"-translate-x-1/2":!0,"-translate-y-1/2":!0,"bg-zinc-400":!0,"data-[active=true]:bg-white":!0},slider__markLabel:{absolute:!0,"top-[calc(100%+0.5em)]":!0,"left-1/2":!0,"text-zinc-400":!0,"text-[11px]":!0,"[line-height:1em]":!0,"-translate-x-1/2":!0},slider__handles:{"m-0":!0,"p-0":!0,"list-none":!0},slider__handle:{group:!0,"select-none":!0,"w-4":!0,"h-4":!0,"rounded-full":!0,"bg-white":!0,absolute:!0,"top-1/2":!0,"left-0":!0,"z-30":!0,"-translate-x-1/2":!0,"-translate-y-1/2":!0,"shadow-[inset_0_0_0_1px_rgba(0,0,0,0.1),0_1px_2px_0_rgba(0,0,0,0.5)]":!0,"focus-visible:outline-0":!0,"focus-visible:ring-2":!0,"ring-accent-500":!0,"data-[is-target=true]:z-20":!0,"dark:bg-zinc-200":!0},slider__tooltip:{absolute:!0,"bottom-full":!0,"left-1/2":!0,"-translate-x-1/2":!0,"-translate-y-[4px]":!0,"bg-accent-500":!0,"text-white":!0,"py-1":!0,"px-1.5":!0,"text-xs":!0,"leading-none":!0,"whitespace-nowrap":!0,"rounded-sm":!0,"opacity-0":!0,"pointer-events-none":!0,"transition-opacity":!0,'after:content-[""]':!0,"after:absolute":!0,"after:top-full":!0,"after:left-1/2":!0,"after:-translate-x-1/2":!0,"after:-translate-y-[1px]":!0,"after:border-4":!0,"after:border-transparent":!0,"after:border-t-accent-500":!0,"group-hover:opacity-100":!0,"group-focus-visible:opacity-100":!0,"group-data-[show-tooltip=true]:opacity-100":!0},slider__linkedValues:{flex:!0,"items-start":!0,"justify-between":!0},slider__minValue:{grow:!0,"!max-w-[45%]":!0,"mb-0":!0,"[&>div>div]:relative":!0,'[&>div>div::after]:content-[""]':!0,"[&>div>div::after]:absolute":!0,"[&>div>div::after]:top-1/2":!0,"[&>div>div::after]:left-[105.5%]":!0,"[&>div>div::after]:w-[12%]":!0,"[&>div>div::after]:h-[1px]":!0,"[&>div>div::after]:bg-zinc-300":!0,"dark:[&>div>div::after]:bg-zinc-700":!0},slider__maxValue:{grow:!0,"!max-w-[45%]":!0,"mb-0":!0,relative:!0},slider__chart:{relative:!0,"z-20":!0,"mb-2":!0,flex:!0,"justify-between":!0,"items-center":!0,"w-full":!0,"aspect-[3/1]":!0},slider__chartBar:{absolute:!0,"bottom-0":!0,"h-full":!0,"bg-zinc-400":!0,"data-[active=false]:bg-zinc-300":!0,"dark:bg-zinc-500":!0,"dark:data-[active=false]:bg-zinc-600":!0},taglist__inner:{"py-2":!0,"pr-0":!0,"pl-0":!0},taglist__tags:{"pl-3":!0},taglist__tagWrapper:{"[&.formkit-dropZone_.formkit-tag]:opacity-25":!0,"[&.formkit-touchDropZone_.formkit-tag]:opacity-25":!0},taglist__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"!p-0":!0,"!w-[0%]":!0,"min-w-[1em]":!0,"inline-block":!0,"-mt-1":!0,"first:mt-0":!0,"first:mb-1":!0},taglist__listboxButton:{"ml-auto":!0,"shrink-0":!0},toggle__outer:{group:!0,"min-w-0":!0,grow:!0,"mb-4":!0,"data-[disabled]:select-none":!0,"data-[disabled]:opacity-50":!0,"text-sm":!0,"max-w-none":!0},toggle__altLabel:{block:!0,"w-full":!0,"mb-1.5":!0,"font-bold":!0,"text-[11px]":!0,"[line-height:1em]":!0,"text-zinc-700":!0,"dark:text-zinc-300":!0},toggle__inner:{peer:!0,"inline-block":!0,"mr-2":!0},toggle__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,peer:!0,absolute:!0,"opacity-0":!0,"w-0":!0,"h-0":!0},toggle__label:{block:!0,"text-zinc-700":!0,"text-xs":!0,"font-bold":!0,"mb-1":!0,"dark:text-zinc-300":!0,"peer-first:font-normal":!0,"peer-first:mb-0":!0},toggle__innerLabel:{absolute:!0,"text-zinc-200":!0,"text-[10px]":!0,"font-bold":!0,"select-none":!0,"left-full":!0,"top-1/2":!0,"-translate-x-full":!0,"-translate-y-1/2":!0,"px-1":!0},toggle__thumb:{relative:!0,"p-0.5":!0,"left-0":!0,"aspect-[1/1]":!0,"rounded-full":!0,"transition-all":!0,"w-[1.25em]":!0,"bg-zinc-50":!0,"text-zinc-600":!0,"shadow-base":!0},toggle__track:{"p-0.5":!0,"min-w-[3em]":!0,relative:!0,"cursor-pointer":!0,"select-none":!0,"rounded-full":!0,"transition-all":!0,"bg-zinc-400":!0,"peer-checked:bg-accent-500":!0,"peer-checked:[&>div:last-child]:left-full":!0,"peer-checked:[&>div:last-child]:-translate-x-full":!0,"peer-checked:[&>div:first-child:not(:last-child)]:left-0":!0,"peer-checked:[&>div:first-child:not(:last-child)]:translate-x-0":!0,"shadow-none":!0,"peer-focus-visible:ring-2":!0,"peer-focus-visible:ring-accent-400":!0,"peer-focus-visible:ring-offset-2":!0,"dark:bg-zinc-500":!0},toggle__valueLabel:{"font-bold":!0,"text-[11px]":!0,"[line-height:1em]":!0,"text-zinc-700":!0,"dark:text-zinc-300":!0},toggle__wrapper:{flex:!0,"flex-wrap":!0,"items-center":!0,"mb-1.5":!0},togglebuttons__wrapper:{"mb-1.5":!0},togglebuttons__options:{"group/options":!0,"inline-flex":!0,"data-[vertical=true]:flex-col":!0},togglebuttons__option:{"group/option":!0},togglebuttons__input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0,"!px-4":!0,"!mb-0":!0,relative:!0,"focus:z-10":!0,"group-data-[vertical=true]/options:w-full":!0,"justify-center":!0,"bg-accent-50":!0,"disabled:opacity-50":!0,"disabled:cursor-not-allowed":!0,"group-data-[disabled]:disabled:opacity-100":!0,"dark:bg-transparent":!0,"dark:disabled:bg-transparent":!0,"dark:disabled:text-accent-500":!0,"dark:text-accent-500":!0,"aria-[pressed=true]:bg-accent-500":!0,"aria-[pressed=true]:text-white":!0,"dark:aria-[pressed=true]:bg-accent-500":!0,"dark:aria-[pressed=true]:text-white":!0,"group-[&]/option:!rounded-none":!0,"group-data-[vertical=false]/options:group-first/option:!rounded-sm":!0,"group-data-[vertical=true]/options:group-first/option:!rounded-sm":!0,"group-data-[vertical=false]/options:group-first/option:!rounded-tr-none":!0,"group-data-[vertical=false]/options:group-first/option:!rounded-br-none":!0,"group-data-[vertical=true]/options:group-first/option:!rounded-bl-none":!0,"group-data-[vertical=true]/options:group-first/option:!rounded-br-none":!0,"group-data-[vertical=false]/options:group-last/option:!rounded-sm":!0,"group-data-[vertical=true]/options:group-last/option:!rounded-sm":!0,"group-data-[vertical=false]/options:group-last/option:!rounded-tl-none":!0,"group-data-[vertical=false]/options:group-last/option:!rounded-bl-none":!0,"group-data-[vertical=true]/options:group-last/option:!rounded-tl-none":!0,"group-data-[vertical=true]/options:group-last/option:!rounded-tr-none":!0,"group-data-[vertical=false]/options:group-[&]/option:!border-r-0":!0,"group-data-[vertical=false]/options:group-last/option:!border-r":!0,"group-data-[vertical=false]/options:group-[&]/option:aria-[pressed=true]:border-x-accent-500":!0,"group-data-[vertical=false]/options:group-first/option:aria-[pressed=true]:border-l-accent-500":!0,"group-data-[vertical=false]/options:group-last/option:aria-[pressed=true]:border-r-accent-500":!0,"dark:group-data-[vertical=false]/options:group-[&]/option:aria-[pressed=true]:border-x-accent-500":!0,"dark:group-data-[vertical=false]/options:group-first/option:aria-[pressed=true]:border-l-accent-500":!0,"dark:group-data-[vertical=false]/options:group-last/option:aria-[pressed=true]:border-r-accent-500":!0,"group-data-[vertical=true]/options:group-[&]/option:!border-b-0":!0,"group-data-[vertical=true]/options:group-last/option:!border-b":!0,"group-data-[vertical=true]/options:group-[&]/option:aria-[pressed=true]:border-y-accent-500":!0,"group-data-[vertical=true]/options:group-first/option:aria-[pressed=true]:border-t-accent-500":!0,"group-data-[vertical=true]/options:group-last/option:aria-[pressed=true]:border-b-accent-500":!0,"dark:group-data-[vertical=true]/options:group-[&]/option:aria-[pressed=true]:border-y-accent-500":!0,"dark:group-data-[vertical=true]/options:group-first/option:aria-[pressed=true]:border-t-accent-500":!0,"dark:group-data-[vertical=true]/options:group-last/option:aria-[pressed=true]:border-b-accent-500":!0},transferlist__outer:{group:!0,"min-w-0":!0,grow:!0,"mb-4":!0,"data-[disabled]:select-none":!0,"data-[disabled]:opacity-50":!0,"text-sm":!0,"max-w-none":!0,"[&_.dnd-placeholder]:bg-accent-500":!0,"[&_.dnd-placeholder]:text-white":!0},transferlist__wrapper:{flex:!0,"flex-col":!0,"sm:flex-row":!0,"justify-between":!0,"w-full":!0,"max-w-none":!0},transferlist__help:{"text-zinc-500":!0,"text-[11px]":!0,"[line-height:1em]":!0,"dark:text-zinc-400":!0,"pb-2":!0},transferlist__transferlist:{grow:!0,shrink:!0,"min-w-0":!0,"shadow-none":!0,"group-[&]/repeater:shadow-none":!0,"group-[&]/multistep:shadow-none":!0,"aspect-[4/5]":!0,flex:!0,"flex-col":!0,"h-[350px]":!0,border:!0,"border-zinc-200":!0,"rounded-sm":!0,"overflow-hidden":!0,"select-none":!0,"[&:has(:focus-visible)]:ring-1":!0,"[&:has(:focus-visible)]:ring-accent-400":!0,"dark:border-zinc-800":!0,"dark:bg-zinc-900/50":!0},transferlist__transferlistHeader:{flex:!0,"bg-zinc-100":!0,"text-zinc-600":!0,"text-xs":!0,"justify-between":!0,"items-center":!0,"border-b":!0,"border-zinc-200":!0,"py-2":!0,"px-2.5":!0,"dark:bg-zinc-700":!0,"dark:border-zinc-800":!0,"dark:text-zinc-400":!0},transferlist__transferlistHeaderItemCount:{"ml-auto":!0,"text-xs":!0,"min-w-[1.5em]":!0,"[line-height:1.5em]":!0,"px-2":!0,"text-center":!0,"rounded-lg":!0,"bg-zinc-200":!0,"text-zinc-700":!0,"dark:bg-zinc-500":!0,"dark:text-zinc-300":!0},transferlist__transferlistListItems:{"list-none":!0,"bg-white":!0,"h-full":!0,"overflow-x-hidden":!0,"overflow-y-auto":!0,"dark:bg-transparent":!0,"outline-hidden":!0},transferlist__transferlistListItem:{"py-2":!0,"px-2":!0,"text-zinc-700":!0,"ring-1":!0,"ring-zinc-200":!0,"aria-selected:bg-accent-100":!0,"data-[is-active=true]:bg-accent-100":!0,"data-[is-active=true]:ring-accent-200":!0,"aria-selected:ring-accent-200":!0,relative:!0,flex:!0,"cursor-pointer":!0,"items-center":!0,"bg-white":!0,"pl-[1.5em]":!0,"first:-mt-px":!0,"first:border-t":!0,"aria-selected:z-[2]":!0,"aria-selected:border-transparent":!0,"aria-selected:ring-1":!0,"data-[is-active=true]:z-[2]":!0,"data-[is-active=true]:border-transparent":!0,"data-[is-active=true]:ring-1":!0,"group-data-[is-max=true]:cursor-not-allowed":!0,"dark:bg-zinc-800":!0,"dark:text-zinc-300":!0,"dark:data-[is-active=true]:bg-accent-800":!0,"dark:aria-selected:bg-accent-800":!0,"dark:ring-zinc-700":!0,"dark:data-[is-active=true]:ring-accent-600":!0,"dark:aria-selected:ring-accent-600":!0,"[&.formkit-dropZone]:bg-accent-100":!0,"[&.formkit-selectionDropZone]:bg-accent-100":!0,"[&.formkit-touchDropZone]:bg-accent-100":!0,"[&.formkit-touchSelectionDropZone]:bg-accent-100":!0,"[&.formkit-longTouch]:bg-accent-100":!0,"dark:[&.formkit-dropZone]:bg-accent-900":!0,"dark:[&.formkit-selectionDropZone]:bg-accent-900":!0,"dark:[&.formkit-touchDropZone]:bg-accent-900":!0,"dark:[&.formkit-touchSelectionDropZone]:bg-accent-900":!0,"dark:[&.formkit-longTouch]:bg-accent-900":!0},transferlist__transferlistOption:{"text-xs":!0},transferlist__transferControls:{"inline-flex":!0,"grow-0":!0,shrink:!0,border:!0,"border-zinc-200":!0,"flex-row":!0,"sm:flex-col":!0,"justify-center":!0,"my-2":!0,"sm:my-auto":!0,"mx-auto":!0,"sm:mx-2":!0,"rounded-sm":!0,"overflow-clip":!0,"shadow-none":!0,"group-[&]/repeater:shadow-none":!0,"group-[&]/multistep:shadow-none":!0,"dark:border-zinc-800":!0},transferlist__sourceEmptyMessage:{"appearance-none":!0,"border-none":!0,"w-full":!0,"my-2":!0,"text-center":!0,"text-zinc-500":!0,italic:!0},transferlist__sourceListItems:{"group-data-[is-max=true]:opacity-50":!0},transferlist__targetEmptyMessage:{"appearance-none":!0,"border-none":!0,"w-full":!0,"my-2":!0,"text-center":!0,"text-zinc-500":!0,italic:!0},transferlist__emptyMessageInner:{flex:!0,"items-center":!0,"justify-center":!0,"p-2":!0,"text-sm":!0},transferlist__transferlistControls:{"bg-white":!0,"p-2":!0,"border-b":!0,"border-zinc-200":!0,"dark:bg-zinc-700":!0,"dark:border-zinc-700":!0},transferlist__transferlistSearch:{flex:!0,border:!0,"border-zinc-200":!0,"rounded-sm":!0,"items-center":!0,"text-zinc-700":!0,"selection:bg-accent-100":!0,"dark:border-zinc-800":!0,"dark:text-zinc-300":!0,"dark:selection:bg-accent-100":!0,"dark:selection:text-zinc-700":!0,"dark:bg-zinc-800":!0},transferlist__transferlistSearchInput:{"border-none":!0,"px-2":!0,"py-1.5":!0,"w-full":!0,"bg-transparent":!0,"outline-hidden":!0,"text-xs":!0},transferlist__transferlistSearchClear:{flex:!0,"w-[0.75em]":!0,"mr-2":!0,"[&_svg]:w-full":!0},transferlist__controlLabel:{absolute:!0,"opacity-0":!0,"pointer-events-none":!0,"text-[0px]":!0},transferlist__selectedIcon:{"w-[0.75em]":!0,absolute:!0,"left-[0.5em]":!0,"select-none":!0,"text-accent-500":!0,"dark:text-accent-400":!0},transferlist__transferlistButton:{"sm:w-5":!0,relative:!0,flex:!0,"justify-center":!0,"text-sm":!0,"shrink-0":!0,"box-content":!0,"text-zinc-700":!0,"disabled:bg-zinc-200":!0,"disabled:!text-zinc-400":!0,"bg-zinc-50":!0,"hover:text-accent-500":!0,"cursor-pointer":!0,"appearance-none":!0,"border-none":!0,"p-2.5":!0,"hover:z-10":!0,"disabled:cursor-not-allowed":!0,"disabled:opacity-50":!0,"disabled:hover:text-current":!0,"disabled:hover:outline-hidden":!0,"focus-visible:ring-1":!0,"focus-visible:ring-accent-400":!0,"focus-visible:z-10":!0,"dark:bg-zinc-800":!0,"dark:text-zinc-400":!0,"dark:disabled:!text-zinc-600":!0,"dark:disabled:bg-zinc-900":!0,"dark:disabled:hover:text-current":!0,"dark:disabled:hover:outline-hidden":!0,"dark:hover:text-accent-400":!0},transferlist__fastForwardIcon:{"w-4":!0,flex:!0,"select-none":!0,"[&>svg]:m-auto":!0,"[&>svg]:w-full":!0,"[&>svg]:max-w-[1rem]":!0,"[&>svg]:max-h-[1rem]":!0,"rotate-90":!0,"sm:rotate-0":!0},transferlist__moveRightIcon:{"w-4":!0,flex:!0,"select-none":!0,"[&>svg]:m-auto":!0,"[&>svg]:w-full":!0,"[&>svg]:max-w-[1rem]":!0,"[&>svg]:max-h-[1rem]":!0,"rotate-90":!0,"sm:rotate-0":!0},transferlist__moveLeftIcon:{"w-4":!0,flex:!0,"select-none":!0,"[&>svg]:m-auto":!0,"[&>svg]:w-full":!0,"[&>svg]:max-w-[1rem]":!0,"[&>svg]:max-h-[1rem]":!0,"rotate-90":!0,"sm:rotate-0":!0},transferlist__rewindIcon:{"w-4":!0,flex:!0,"select-none":!0,"[&>svg]:m-auto":!0,"[&>svg]:w-full":!0,"[&>svg]:max-w-[1rem]":!0,"[&>svg]:max-h-[1rem]":!0,"rotate-90":!0,"sm:rotate-0":!0},transferlist__messages:{"mt-2":!0},barcode__barcodeIcon:{"w-[1.5em]":!0,"text-zinc-700":!0,"cursor-pointer":!0,"dark:text-zinc-300":!0},barcode__dialog:{"border-none":!0,"outline-hidden":!0,"overflow-clip":!0,"p-0":!0,"bg-black":!0,"rounded-sm":!0,"w-[100%-2rem]":!0,"max-w-[30rem]":!0,"[&::backdrop]:bg-zinc-800/50":!0},barcode__video:{"w-full":!0,"aspect-[1/1]":!0,"object-cover":!0,block:!0,"pointer-events-none":!0},barcode__closeIcon:{"cursor-pointer":!0,absolute:!0,"bg-white":!0,"color-zinc-700":!0,"w-[1.5em]":!0,"h-[1.5em]":!0,"rounded-sm":!0,flex:!0,"top-2":!0,"right-2":!0,"z-20":!0,"[&>svg]:w-[1.25em]":!0,"[&>svg]:h-[1.25em]":!0,"[&>svg]:m-auto":!0},barcode__overlay:{"text-zinc-700":!0,"dark:text-zinc-300":!0,absolute:!0,"top-1/2":!0,"left-1/2":!0,"w-[min(20em,75%)]":!0,"aspect-[1/1]":!0,"-translate-x-1/2":!0,"-translate-y-1/2":!0,"rounded-sm":!0,"pointer-events-none":!0,"shadow-[0_0_0_999em_rgba(0,0,0,0.5)]":!0},barcode__overlayDecorators:{absolute:!0,"inset-0":!0,"z-10":!0},barcode__overlayDecoratorTopLeft:{absolute:!0,"w-[1.5rem]":!0,"h-[1.5rem]":!0,"rounded-sm":!0,"top-0":!0,"left-0":!0,"border-l-4":!0,"border-t-4":!0,"rounded-tr-none":!0,"rounded-bl-none":!0},barcode__overlayDecoratorTopRight:{absolute:!0,"w-[1.5rem]":!0,"h-[1.5rem]":!0,"rounded-sm":!0,"top-0":!0,"right-0":!0,"border-r-4":!0,"border-t-4":!0,"rounded-tl-none":!0,"rounded-br-none":!0},barcode__overlayDecoratorBottomRight:{absolute:!0,"w-[1.5rem]":!0,"h-[1.5rem]":!0,"rounded-sm":!0,"bottom-0":!0,"right-0":!0,"border-r-4":!0,"border-b-4":!0,"rounded-tr-none":!0,"rounded-bl-none":!0},barcode__overlayDecoratorBottomLeft:{absolute:!0,"w-[1.5rem]":!0,"h-[1.5rem]":!0,"rounded-sm":!0,"bottom-0":!0,"left-0":!0,"border-l-4":!0,"border-b-4":!0,"rounded-tl-none":!0,"rounded-br-none":!0},"multi-step__outer":{group:!0,"min-w-0":!0,grow:!0,"mb-4":!0,"data-[disabled]:select-none":!0,"data-[disabled]:opacity-50":!0,"text-sm":!0,"group/multistep":!0,"max-w-[32rem]":!0},"multi-step__wrapper":{"group/wrapper":!0,"data-[tab-style=tab]:shadow-none":!0,"data-[tab-style=tab]:rounded-sm":!0},"multi-step__tabs":{flex:!0,"items-center":!0,"group-data-[tab-style=tab]/wrapper:overflow-auto":!0,"group-data-[tab-style=tab]/wrapper:border":!0,"group-data-[tab-style=tab]/wrapper:border-b-0":!0,"group-data-[tab-style=tab]/wrapper:border-zinc-200":!0,"group-data-[tab-style=tab]/wrapper:rounded-sm":!0,"group-data-[tab-style=tab]/wrapper:rounded-bl-none":!0,"group-data-[tab-style=tab]/wrapper:rounded-br-none":!0,"dark:group-data-[tab-style=tab]/wrapper:border-zinc-800":!0,"group-data-[tab-style=progress]/wrapper:my-6":!0,"group-data-[tab-style=progress]/wrapper:justify-around":!0,"group-data-[tab-style=progress]/wrapper:overflow-visible":!0,"group-data-[tab-style=progress]/wrapper:group-data-[hide-labels=true]/wrapper:mb-3.5":!0},"multi-step__tab":{"group/tab":!0,"group-data-[tab-style=tab]/wrapper:relative":!0,"group-data-[tab-style=tab]/wrapper:flex":!0,"group-data-[tab-style=tab]/wrapper:grow":!0,"group-data-[tab-style=tab]/wrapper:text-xs":!0,"group-data-[tab-style=tab]/wrapper:items-center":!0,"group-data-[tab-style=tab]/wrapper:justify-center":!0,"group-data-[tab-style=tab]/wrapper:cursor-pointer":!0,"group-data-[tab-style=tab]/wrapper:text-zinc-700":!0,"group-data-[tab-style=tab]/wrapper:bg-zinc-100":!0,"group-data-[tab-style=tab]/wrapper:py-3.5":!0,"group-data-[tab-style=tab]/wrapper:px-4":!0,"group-data-[tab-style=tab]/wrapper:border-r":!0,"group-data-[tab-style=tab]/wrapper:border-b":!0,"group-data-[tab-style=tab]/wrapper:border-zinc-200":!0,"group-data-[tab-style=tab]/wrapper:last:border-r-0":!0,"group-data-[tab-style=tab]/wrapper:shadow-[inset_0_-0.5em_0.5em_-0.5em_rgba(0,0,0,0.1)]":!0,"group-data-[tab-style=tab]/wrapper:data-[active=true]:bg-white":!0,"group-data-[tab-style=tab]/wrapper:data-[active=true]:font-bold":!0,"group-data-[tab-style=tab]/wrapper:data-[active=true]:border-b-white":!0,"group-data-[tab-style=tab]/wrapper:data-[active=true]:z-10":!0,"group-data-[tab-style=tab]/wrapper:data-[active=true]:shadow-[0_0_0.5em_0_rgba(0,0,0,0.1)]":!0,"dark:group-data-[tab-style=tab]/wrapper:text-zinc-300":!0,"dark:group-data-[tab-style=tab]/wrapper:bg-zinc-950/20":!0,"dark:group-data-[tab-style=tab]/wrapper:data-[active=true]:bg-transparent":!0,"dark:group-data-[tab-style=tab]/wrapper:data-[active=true]:border-b-transparent":!0,"dark:group-data-[tab-style=tab]/wrapper:border-zinc-800":!0,"group-data-[tab-style=progress]/wrapper:flex":!0,"group-data-[tab-style=progress]/wrapper:flex-col":!0,"group-data-[tab-style=progress]/wrapper:items-center":!0,"group-data-[tab-style=progress]/wrapper:grow":!0,"group-data-[tab-style=progress]/wrapper:shrink-0":!0,"group-data-[tab-style=progress]/wrapper:relative":!0,"group-data-[tab-style=progress]/wrapper:before:block":!0,"group-data-[tab-style=progress]/wrapper:before:text-xs":!0,"group-data-[tab-style=progress]/wrapper:before:w-[1.25rem]":!0,"group-data-[tab-style=progress]/wrapper:before:h-[1.25rem]":!0,"group-data-[tab-style=progress]/wrapper:before:border-4":!0,"group-data-[tab-style=progress]/wrapper:before:border-zinc-300":!0,"group-data-[tab-style=progress]/wrapper:before:rounded-full":!0,"group-data-[tab-style=progress]/wrapper:before:bg-white":!0,"group-data-[tab-style=progress]/wrapper:before:z-10":!0,"dark:group-data-[tab-style=progress]/wrapper:before:border-zinc-800":!0,"dark:group-data-[tab-style=progress]/wrapper:before:bg-zinc-950":!0,"group-data-[tab-style=progress]/wrapper:after:block":!0,"group-data-[tab-style=progress]/wrapper:after:h-1":!0,"group-data-[tab-style=progress]/wrapper:after:w-full":!0,"group-data-[tab-style=progress]/wrapper:after:absolute":!0,"group-data-[tab-style=progress]/wrapper:after:top-[0.5em]":!0,"group-data-[tab-style=progress]/wrapper:after:left-[calc(50%+0.5em)]":!0,"group-data-[tab-style=progress]/wrapper:after:bg-zinc-300":!0,"group-data-[tab-style=progress]/wrapper:data-[valid=true]:data-[visited=true]:after:bg-accent-500":!0,"group-data-[tab-style=progress]/wrapper:last:after:hidden":!0,"dark:group-data-[tab-style=progress]/wrapper:after:bg-zinc-800":!0,"dark:group-data-[tab-style=progress]/wrapper:data-[valid=true]:data-[visited=true]:after:bg-accent-500":!0},"multi-step__tabLabel":{"group-data-[tab-style=progress]/wrapper:absolute":!0,"group-data-[tab-style=progress]/wrapper:text-zinc-800":!0,"group-data-[tab-style=progress]/wrapper:top-full":!0,"group-data-[tab-style=progress]/wrapper:w-full":!0,"group-data-[tab-style=progress]/wrapper:whitespace-nowrap":!0,"group-data-[tab-style=progress]/wrapper:text-[11px]":!0,"[line-height:1em]":!0,"dark:group-data-[tab-style=progress]/wrapper:text-zinc-300":!0},"multi-step__badge":{"bg-red-500":!0,absolute:!0,"font-mono":!0,"font-bold":!0,flex:!0,"items-center":!0,"justify-center":!0,"aspect-[1/1]":!0,"[line-height:1.25rem]":!0,"text-white":!0,"rounded-full":!0,"group-data-[valid=true]/tab:bg-accent-500":!0,"group-data-[tab-style=tab]/wrapper:text-[0.66rem]":!0,"group-data-[tab-style=tab]/wrapper:p-1.5":!0,"group-data-[tab-style=tab]/wrapper:w-5":!0,"group-data-[tab-style=tab]/wrapper:h-5":!0,"group-data-[tab-style=tab]/wrapper:top-1.5":!0,"group-data-[tab-style=tab]/wrapper:right-1.5":!0,"group-data-[tab-style=progress]/wrapper:w-[1.25rem]":!0,"group-data-[tab-style=progress]/wrapper:h-[1.25rem]":!0,"group-data-[tab-style=progress]/wrapper:p-1":!0,"group-data-[tab-style=progress]/wrapper:text-[10px]":!0,"group-data-[tab-style=progress]/wrapper:[line-height:0]":!0,"group-data-[tab-style=progress]/wrapper:z-10":!0},"multi-step__validStepIcon":{"w-full":!0,"h-full":!0,"mt-0.5":!0},"multi-step__steps":{"px-10":!0,"pt-8":!0,"pb-4":!0,"bg-white":!0,border:!0,"border-zinc-200":!0,"rounded-sm":!0,"dark:bg-transparent":!0,"dark:border-zinc-800":!0,"group-data-[tab-style=tab]/wrapper:border-t-0":!0,"group-data-[tab-style=tab]/wrapper:rounded-tl-none":!0,"group-data-[tab-style=tab]/wrapper:rounded-tr-none":!0,"group-data-[tab-style=progress]/wrapper:shadow-none":!0,"[&_[data-type]]:max-w-none":!0},step__stepActions:{flex:!0,"justify-between":!0,"[&>*]:grow-0":!0},step__stepPrevious:{"mr-1.5":!0},step__stepNext:{"ml-auto":!0}},Io={outer:{group:!0,"max-w-none":!0,"min-w-0":!0,grow:!0,"mb-4":!0,"data-[disabled]:select-none":!0,"data-[disabled]:opacity-50":!0,"text-sm":!0},label:{block:!0,"text-zinc-700":!0,"text-xs":!0,"font-bold":!0,"mb-1":!0,"dark:text-zinc-300":!0},legend:{block:!0,"text-zinc-700":!0,"text-xs":!0,"font-bold":!0,"dark:text-zinc-300":!0},input:{"appearance-none":!0,"[color-scheme:light]":!0,"dark:[color-scheme:dark]":!0,"selection:bg-accent-100":!0,"selection:text-zinc-700":!0,"group-data-[has-overlay]:selection:!text-transparent":!0},prefixIcon:{flex:!0,"items-center":!0,"-ml-1":!0,"mr-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0},suffixIcon:{flex:!0,"items-center":!0,"-mr-1":!0,"ml-2":!0,"text-sm":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0},loaderIcon:{"animate-spin":!0,flex:!0,"items-center":!0,"my-auto":!0,"ml-2":!0,"text-sm":!0,"text-zinc-500":!0,"h-[1em]":!0,"w-[1em]":!0,"shrink-0":!0,"[&>svg]:w-full":!0},loadMoreInner:{flex:!0,"text-xs":!0,"text-zinc-500":!0,"p-2":!0,"items-center":!0,"justify-center":!0,"[&>span]:mr-2":!0},help:{"text-zinc-500":!0,"text-[11px]":!0,"[line-height:1em]":!0,"dark:text-zinc-400":!0},message:{"text-red-500":!0,"mb-1.5":!0,"text-[11px]":!0,"[line-height:1em]":!0,"dark:text-red-400":!0},overlay:{"text-zinc-700":!0,"dark:text-zinc-300":!0},overlayPlaceholder:{"text-zinc-400":!0,"dark:text-zinc-400/50":!0},overlayLiteral:{"text-zinc-700":!0,"dark:text-zinc-300":!0},overlayChar:{"text-zinc-700":!0,"dark:text-zinc-300":!0},overlayEnum:{"text-zinc-700":!0,"dark:text-zinc-300":!0},searchInput__input:{"w-full":!0,"bg-transparent":!0,border:!0,"border-zinc-200":!0,"dark:border-zinc-700":!0,"rounded-lg":!0,"focus:outline-none":!0,"focus:ring-2":!0,"focus:ring-accent-500/30":!0,"focus:border-accent-500":!0,"dark:focus:border-accent-400":!0,"transition-all":!0,"placeholder:text-zinc-400":!0,"disabled:opacity-50":!0,"disabled:cursor-not-allowed":!0,"pl-9":!0,"pr-9":!0,"py-2":!0,"text-sm":!0},"searchInput__input--sm":{"pl-7":!0,"pr-7":!0,"py-1.5":!0,"text-xs":!0},searchInput__icon:{absolute:!0,"left-3":!0,"top-1/2":!0,"-translate-y-1/2":!0,"text-zinc-400":!0,"w-4":!0,"h-4":!0},"searchInput__icon--sm":{"left-2":!0,"w-3.5":!0,"h-3.5":!0},searchInput__clearButton:{absolute:!0,"right-2.5":!0,"top-1/2":!0,"-translate-y-1/2":!0,"p-1":!0,"rounded-md":!0,"hover:bg-zinc-100":!0,"dark:hover:bg-zinc-800":!0,"transition-colors":!0},searchInput__clearIcon:{"w-3.5":!0,"h-3.5":!0,"text-zinc-400":!0,"hover:text-zinc-600":!0,"dark:hover:text-zinc-300":!0},selectSearch__button:{"w-full":!0,"min-w-[200px]":!0,"px-3":!0,"py-2":!0,"text-left":!0,"rounded-lg":!0,"focus:outline-none":!0,"focus:ring-2":!0,"focus:ring-accent-500/30":!0,"bg-transparent":!0,"disabled:opacity-50":!0,"disabled:cursor-not-allowed":!0,"text-sm":!0,"overflow-hidden":!0,"transition-colors":!0,border:!0,"border-zinc-200":!0,"dark:border-zinc-700":!0,"focus:border-accent-500":!0,"dark:focus:border-accent-400":!0}};function zo(t){const a=String(t.value||"");return a?/^[a-z][a-z0-9_]*$/.test(a):!0}function Mo(t){const a=t.value;if(a===""||a===null||a===void 0)return!0;const n=Number(a);return n>0&&Number.isInteger(n)}function Vo(t){const a=t.value;return a===""||a===null||a===void 0?!0:Number(a)>=0}function Eo(t){const a=String(t.value||"");if(!a.trim())return!0;try{return JSON.parse(a),!0}catch{return!1}}function Lo(t){const a=String(t.value||"");if(!a)return!0;try{return new URL(a),!0}catch{return!1}}function Po(t){const a=String(t.value||"");return a?a.length>=10&&!/\s/.test(a):!0}const Ao={snakeCase:zo,positiveInteger:Mo,nonNegative:Vo,validJson:Eo,validUrl:Lo,apiKey:Po},jo={snakeCase({name:t}){return`${t} must be in snake_case format (lowercase letters, numbers, and underscores, starting with a letter).`},positiveInteger({name:t}){return`${t} must be a positive whole number.`},nonNegative({name:t}){return`${t} must be zero or greater.`},validJson({name:t}){return`${t} must be valid JSON.`},validUrl({name:t}){return`${t} must be a valid URL.`},apiKey({name:t}){return`${t} must be at least 10 characters with no spaces.`}},_t=fe({__name:"DropShadow",props:{offsetX:{default:8},offsetY:{default:8},intensity:{default:.5},pattern:{default:"crosshatch"}},setup(t){const a=t,n=m(),s=m(),l=m(),d=m(0),i=(v,f,h,_,b,u)=>{v.beginPath(),v.moveTo(f+u,h),v.lineTo(f+_-u,h),v.quadraticCurveTo(f+_,h,f+_,h+u),v.lineTo(f+_,h+b-u),v.quadraticCurveTo(f+_,h+b,f+_-u,h+b),v.lineTo(f+u,h+b),v.quadraticCurveTo(f,h+b,f,h+b-u),v.lineTo(f,h+u),v.quadraticCurveTo(f,h,f+u,h),v.closePath()},c=async()=>{if(await Le(),!n.value||!s.value||!l.value)return;const v=n.value.getContext("2d");if(!v)return;const f=l.value.getBoundingClientRect(),h=l.value.firstElementChild;if(h){const x=getComputedStyle(h);d.value=parseFloat(x.borderRadius)||0}const _=f.width+a.offsetX+4,b=f.height+a.offsetY+4;n.value.width=_,n.value.height=b,n.value.style.width=`${_}px`,n.value.style.height=`${b}px`,v.clearRect(0,0,n.value.width,n.value.height);const u=document.documentElement.classList.contains("dark");if(v.fillStyle=u?"#6b7280":"black",v.globalAlpha=a.intensity,v.save(),i(v,a.offsetX,a.offsetY,f.width,f.height,d.value),v.clip(),a.pattern==="crosshatch"){const x=u?4:3;v.lineWidth=1,v.strokeStyle=u?"#6b7280":"black";for(let p=-f.height;p<f.width;p+=x)v.beginPath(),v.moveTo(a.offsetX+p,a.offsetY),v.lineTo(a.offsetX+p+f.height,a.offsetY+f.height),v.stroke();for(let p=0;p<f.width+f.height;p+=x)v.beginPath(),v.moveTo(a.offsetX+p,a.offsetY+f.height),v.lineTo(a.offsetX+p-f.height,a.offsetY),v.stroke()}else if(a.pattern==="dots"){const p=u?3:2,k=[[0,8,2,10],[12,4,14,6],[3,11,1,9],[15,7,13,5]];for(let M=0;M<f.width;M+=p)for(let R=0;R<f.height;R+=p){const W=Math.floor(M/p)%4,Z=Math.floor(R/p)%4;k[Z][W]/16<a.intensity&&v.fillRect(a.offsetX+M,a.offsetY+R,1,1)}}else if(a.pattern==="diagonal"){const x=u?5:4;v.lineWidth=1,v.strokeStyle=u?"#6b7280":"black";for(let p=-f.height;p<f.width;p+=x)v.beginPath(),v.moveTo(a.offsetX+p,a.offsetY),v.lineTo(a.offsetX+p+f.height,a.offsetY+f.height),v.stroke()}v.restore()};let g=null,y=null;return Pe(()=>{g=new ResizeObserver(()=>{c()}),l.value&&g.observe(l.value),c(),y=new MutationObserver(()=>{c()}),y.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]})}),Ye(()=>{l.value&&g&&g.unobserve(l.value),y&&y.disconnect()}),xe(()=>[a.offsetX,a.offsetY,a.intensity,a.pattern],()=>{c()}),(v,f)=>(r(),o("div",{ref_key:"container",ref:s,class:"relative",style:st({paddingRight:`${t.offsetX}px`,paddingBottom:`${t.offsetY}px`})},[e("canvas",{ref_key:"canvas",ref:n,class:"absolute top-0 left-0 pointer-events-none"},null,512),e("div",{ref_key:"contentEl",ref:l,class:"relative"},[je(v.$slots,"default")],512)],4))}}),Do={class:"prompt-input-container relative"},Ro=["contenteditable","data-placeholder"],Oo={class:"bg-white dark:bg-zinc-900 border border-zinc-300 dark:border-zinc-700 rounded-sm overflow-hidden min-w-[240px] max-w-[320px]"},Uo={key:0,class:"p-3 text-sm text-neutral-500"},Bo={key:1,class:"p-3 text-sm text-neutral-500"},Fo={key:2,class:"max-h-[220px] overflow-y-auto"},No=["onClick"],qo={class:"font-medium flex items-center gap-2"},Ho=["title"],Wo={key:0,class:"text-xs text-neutral-500 dark:text-neutral-400 mt-0.5"},Ko={key:1,class:"text-xs text-red-600 dark:text-red-400 mt-1"},Jo={class:"text-xs mt-1"},Yo=fe({__name:"PromptInput",props:{modelValue:{},search:{},placeholder:{default:"Type @ to insert variables or prompts..."},disabled:{type:Boolean,default:!1},maxLength:{},allowedTypes:{default:()=>["variable","prompt"]},editorClass:{}},emits:["update:modelValue","segment-click"],setup(t,{emit:a}){const n=t,s=a,l=m(),d=m(),i=Sa({segments:n.modelValue&&n.modelValue.length?n.modelValue:[{type:"string",value:""}],dialogOpen:!1,dialogPosition:{x:0,y:0},searchQuery:"",searchResults:[],selectedIndex:0,isSearching:!1,atTriggerIndex:-1,isComposing:!1,ignoreNextWatch:!1}),c=()=>Math.random().toString(36).slice(2)+Date.now().toString(36),g=L=>L.type==="string"?"":`@${L.type==="variable"?L.label||L.value:L.label||L.id}`,y=()=>{const L=window.getSelection();if(!L||!L.rangeCount||!l.value)return null;const C=L.getRangeAt(0);let I=0;const re=Array.from(l.value.childNodes);for(let F=0;F<re.length;F++){const B=re[F];if(B===C.startContainer||B.contains?.(C.startContainer)){if(B.nodeType===Node.TEXT_NODE)return{segmentIndex:I,offset:C.startOffset};if(B.nodeType===Node.ELEMENT_NODE&&B.classList?.contains("prompt-tag"))return{segmentIndex:I,offset:0}}(B.nodeType===Node.TEXT_NODE||B.nodeType===Node.ELEMENT_NODE&&B.classList?.contains("prompt-tag"))&&I++}return{segmentIndex:0,offset:0}},v=()=>{if(!l.value)return;const L=i.segments.map(C=>{if(C.type==="string")return(C.value||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"<br>")||"";{const I=C._uid||(C._uid=c()),re=g(C),F=C.type==="variable"?{type:"variable",value:C.value,label:C.label,schema:C.schema,meta:C.meta}:{type:"prompt",id:C.id,label:C.label,schema:C.schema,meta:C.meta},B=encodeURIComponent(JSON.stringify(F)),q=C.type==="prompt"&&C.meta&&!C.meta.isValid,Y=q?'<span class="prompt-tag-warning" title="'+(C.meta.validationMessage||"").replace(/"/g,""")+'">⚠️</span>':"";return`<span class="prompt-tag prompt-tag-clickable${q?" prompt-tag-invalid":""}" contenteditable="false" data-segment-uid="${I}" data-segment="${B}">${re}${Y}</span>`}}).join("");l.value.innerHTML=L||"<br>"},f=()=>{const L=[];for(const C of i.segments)C.type==="string"&&L.length>0&&L[L.length-1].type==="string"?L[L.length-1].value+=C.value:L.push(C);i.segments=L.length?L:[{type:"string",value:""}]},h=L=>{const C=L.dataset.segmentUid;let I=i.segments.find(re=>re._uid===C);if(!I){const re=L.dataset.segment;if(re)try{const F=JSON.parse(decodeURIComponent(re));F&&(F.type==="variable"||F.type==="prompt")&&(I=F.type==="variable"?{type:"variable",value:F.value,label:F.label,schema:F.schema,meta:F.meta,_uid:C}:{type:"prompt",id:F.id,label:F.label,schema:F.schema,meta:F.meta,_uid:C})}catch{}}return I||null},_=L=>{const C=L.target;if(C.classList?.contains("prompt-tag")){const I=h(C);I&&s("segment-click",I,L)}},b=L=>{if(i.isComposing)return;const C=L.target,I=[];let re="";const F=()=>{re.length>0&&(I.push({type:"string",value:re}),re="")},B=H=>{if(H.nodeType===Node.TEXT_NODE){const E=(H.textContent||"").replace(/\u00A0/g," ");re+=E;return}if(H.nodeType===Node.ELEMENT_NODE){const E=H;if(E.classList?.contains("prompt-tag")){F();const A=h(E);A&&I.push(A);return}if(E.tagName==="BR"){re+=`
|
|
2
|
+
`;return}const ne=Array.from(E.childNodes);for(const A of ne)B(A);(E.tagName==="DIV"||E.tagName==="P"||E.tagName==="LI")&&E.nextSibling&&(re+=`
|
|
3
|
+
`);return}},q=Array.from(C.childNodes);for(const H of q)B(H);F();const U=I.some(H=>H.type!=="string")?I:[{type:"string",value:(C.innerText||"").replace(/\r\n/g,`
|
|
4
|
+
`)}];i.segments=U.length?U:[{type:"string",value:""}],f(),u(),Q()},u=()=>{const L=window.getSelection();if(!L||!L.rangeCount||!l.value)return;const C=L.getRangeAt(0);if(C.startContainer.nodeType!==Node.TEXT_NODE){i.dialogOpen&&p();return}const re=C.startContainer.textContent||"",F=C.startOffset;if(F>0&&re[F-1]==="@")i.atTriggerIndex=F-1,i.searchQuery="",x(),R("");else if(i.dialogOpen&&i.atTriggerIndex>=0)if(C.startContainer.nodeType===Node.TEXT_NODE){const B=C.startContainer.textContent||"",q=C.startOffset;if(q<=i.atTriggerIndex){p();return}const Y=B.substring(0,q);if(Y.length>i.atTriggerIndex&&Y[i.atTriggerIndex]==="@"){const U=Y.substring(i.atTriggerIndex+1);U.includes(" ")||U.includes(`
|
|
5
|
+
`)||U.length>i.searchQuery.length+5?p():(i.searchQuery=U,R(U))}else p()}else p()},x=async()=>{i.dialogOpen=!0,i.selectedIndex=0,await Le(),k()},p=()=>{i.dialogOpen=!1,i.searchResults=[],i.searchQuery="",i.atTriggerIndex=-1,i.isSearching=!1},k=()=>{if(!d.value||!l.value)return;const L=window.getSelection();if(!L||!L.rangeCount)return;const I=L.getRangeAt(0).getBoundingClientRect(),re=l.value.getBoundingClientRect();i.dialogPosition={x:I.left-re.left,y:I.bottom-re.top+4}};let M=null;const R=async L=>{if(!n.search){i.searchResults=[];return}M&&clearTimeout(M),i.isSearching=!0,M=setTimeout(async()=>{try{const C=await n.search(L);i.searchResults=(C||[]).filter(I=>n.allowedTypes?.includes(I.type))}catch(C){console.error("Search error:",C),i.searchResults=[]}finally{i.isSearching=!1}},200)},W=L=>L.type==="variable"?{type:"variable",value:L.value??L.id??"",label:L.label,schema:L.schema,_uid:c(),meta:L.meta}:{type:"prompt",id:L.id??L.value??"",label:L.label,schema:L.schema,_uid:c(),meta:L.meta},Z=L=>{if(i.atTriggerIndex<0||!l.value)return;const C=window.getSelection();if(!C||!C.rangeCount)return;const I=C.getRangeAt(0);if(I.startContainer.nodeType!==Node.TEXT_NODE)return;const re=I.startContainer,F=re.data.slice(0,i.atTriggerIndex),B=re.data.slice(I.startOffset),q=document.createElement("span"),Y=W(L),U=Y.type==="prompt"&&Y.meta&&!Y.meta.isValid;q.className=`prompt-tag${U?" prompt-tag-invalid":""}`,q.setAttribute("contenteditable","false");const H=Y._uid||(Y._uid=c());q.dataset.segmentUid=H;const E=Y.type==="variable"?{type:"variable",value:Y.value,label:Y.label,schema:Y.schema}:{type:"prompt",id:Y.id,label:Y.label,schema:Y.schema};if(q.dataset.segment=encodeURIComponent(JSON.stringify(E)),q.textContent=g(Y),U){const ke=document.createElement("span");ke.className="prompt-tag-warning",ke.textContent="⚠️",ke.setAttribute("title",Y.meta.validationMessage||"Validation error"),q.appendChild(ke)}const ne=re.parentNode,A=document.createTextNode(B),pe=document.createTextNode(F);ne.insertBefore(pe,re),ne.insertBefore(q,re),ne.insertBefore(A,re),ne.removeChild(re),p(),b({target:l.value});const ue=window.getSelection();if(ue){const ke=document.createRange();ke.setStart(A,0),ke.collapse(!0),ue.removeAllRanges(),ue.addRange(ke)}l.value.focus()},V=L=>{if((L.key==="ArrowLeft"||L.key==="ArrowRight")&&setTimeout(()=>u(),0),i.dialogOpen)L.key==="ArrowDown"?(L.preventDefault(),i.selectedIndex=Math.min(i.selectedIndex+1,i.searchResults.length-1)):L.key==="ArrowUp"?(L.preventDefault(),i.selectedIndex=Math.max(i.selectedIndex-1,0)):L.key==="Enter"?(L.preventDefault(),i.searchResults[i.selectedIndex]&&Z(i.searchResults[i.selectedIndex])):(L.key==="Escape"||L.key==="Esc")&&(L.preventDefault(),p());else if(L.key==="Backspace"||L.key==="Delete"){const C=y();if(L.key==="Backspace"){const I=window.getSelection();if(I&&I.rangeCount){const re=I.getRangeAt(0);if(re.collapsed&&re.startContainer.nodeType===Node.TEXT_NODE&&re.startOffset===0){let F=re.startContainer;for(;F&&F!==l.value;){const B=F.previousSibling;if(B&&B.nodeType===Node.ELEMENT_NODE&&B.classList?.contains("prompt-tag")){L.preventDefault(),B.parentNode?.removeChild(B),b({target:l.value});return}F=F.parentNode}}}}if(!C)return;if(L.key==="Backspace"&&C.offset===0&&C.segmentIndex>0)i.segments[C.segmentIndex-1].type!=="string"&&(L.preventDefault(),i.segments.splice(C.segmentIndex-1,1),f(),Q(),v());else if(L.key==="Delete"&&C.segmentIndex<i.segments.length-1){const I=i.segments[C.segmentIndex];I.type==="string"&&(I.value?.length??0)===C.offset&&i.segments[C.segmentIndex+1].type!=="string"&&(L.preventDefault(),i.segments.splice(C.segmentIndex+1,1),f(),Q(),v())}}},P=L=>{L.preventDefault();const C=L.clipboardData?.getData("text/plain")||"";document.execCommand("insertText",!1,C)},J=L=>{if(!i.dialogOpen)return;const C=d.value;C&&(C.contains(L.target)||p())},Q=()=>{i.ignoreNextWatch=!0;const L=i.segments.map(C=>{const{_uid:I,...re}=C||{};return re});s("update:modelValue",L)},le=()=>{const L=window.getSelection();if(!L||!l.value)return;const C=L.anchorNode;C&&l.value.contains(C)&&u()},me=L=>{(L.key==="Escape"||L.key==="Esc")&&i.dialogOpen&&(L.preventDefault(),p())};Pe(()=>{n.modelValue&&n.modelValue.length&&(i.segments=JSON.parse(JSON.stringify(n.modelValue))),v(),document.addEventListener("mousedown",J),document.addEventListener("selectionchange",le),document.addEventListener("keydown",me,!0)}),Ye(()=>{document.removeEventListener("mousedown",J),document.removeEventListener("selectionchange",le),document.removeEventListener("keydown",me,!0)}),xe(()=>n.modelValue,L=>{if(i.ignoreNextWatch){i.ignoreNextWatch=!1;return}L&&(i.segments=JSON.parse(JSON.stringify(L)),v())},{deep:!0});const ee=O(()=>{const L=["prompt-input-editor","min-h-[100px]",n.disabled?"opacity-50 cursor-not-allowed":""];return n.editorClass?[...L,n.editorClass,"!h-auto"]:[...L,"py-2 px-3","rounded-sm","border border-zinc-300 dark:border-zinc-700","bg-white dark:bg-transparent","text-sm text-zinc-700 dark:text-zinc-300","focus:outline-none focus:ring-1 focus:ring-accent-400 focus:border-accent-400"]});return(L,C)=>(r(),o("div",Do,[e("div",{ref_key:"editorRef",ref:l,contenteditable:!t.disabled,onInput:b,onKeydown:V,onPaste:P,onClick:_,onKeyup:C[0]||(C[0]=I=>{I.key==="Escape"?(I.preventDefault(),p()):(I.key==="ArrowLeft"||I.key==="ArrowRight")&&u()}),onCompositionstart:C[1]||(C[1]=I=>i.isComposing=!0),onCompositionend:C[2]||(C[2]=I=>i.isComposing=!1),class:oe(ee.value),"data-placeholder":t.placeholder},[Ae(e("div",null,[je(L.$slots,"segment",{segment:null},void 0,!0)],512),[[Ke,!1]])],42,Ro),i.dialogOpen?(r(),o("div",{key:0,ref_key:"dialogRef",ref:d,class:"absolute z-50",style:st({left:`${i.dialogPosition.x}px`,top:`${i.dialogPosition.y}px`})},[w(_t,{"offset-x":4,"offset-y":4,intensity:.3},{default:j(()=>[e("div",Oo,[i.isSearching?(r(),o("div",Uo," Searching... ")):i.searchResults.length===0?(r(),o("div",Bo," No results found ")):(r(),o("div",Fo,[(r(!0),o(he,null,we(i.searchResults,(I,re)=>(r(),o("button",{key:I.id||I.value||re,type:"button",onClick:F=>Z(I),class:oe(["w-full px-3 py-2 text-left text-sm","hover:bg-neutral-100 dark:hover:bg-neutral-900","focus:bg-neutral-100 dark:focus:bg-neutral-900 focus:outline-none",i.selectedIndex===re?"bg-neutral-100 dark:bg-neutral-900":""])},[e("div",qo,[X(S(I.label||I.id||I.value)+" ",1),I.type==="prompt"&&I.meta&&!I.meta.isValid?(r(),o("span",{key:0,title:I.meta.validationMessage,class:"text-red-500"},"⚠️",8,Ho)):T("",!0)]),I.description?(r(),o("div",Wo,S(I.description),1)):T("",!0),I.type==="prompt"&&I.meta&&!I.meta.isValid?(r(),o("div",Ko,S(I.meta.validationMessage),1)):T("",!0),e("div",Jo,[e("span",{class:oe(["inline-block px-1.5 py-0.5 rounded",I.type==="variable"?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300":"bg-purple-100 dark:bg-purple-900 text-purple-700 dark:text-purple-300"])},S(I.type),3)])],10,No))),128))]))])]),_:1})],4)):T("",!0)]))}}),Xe=(t,a)=>{const n=t.__vccOpts||t;for(const[s,l]of a)n[s]=l;return n},Xt=Xe(Yo,[["__scopeId","data-v-daddc895"]]),Go=fe({__name:"PromptInputWrapper",props:{context:{}},emits:["segment-click"],setup(t,{emit:a}){const n=t,s=(_,b)=>{const u=n.context;return u[_]!==void 0?u[_]:u.attrs?.[_]!==void 0?u.attrs[_]:b},l=O(()=>n.context.classes??{}),d=O(()=>n.context._value??[]),i=_=>{n.context.node.input(_)},c=O(()=>s("search",void 0)),g=O(()=>s("placeholder","Type @ to insert variables or prompts...")),y=O(()=>s("maxLength",void 0)),v=O(()=>s("allowedTypes",["variable","prompt"])),f=O(()=>n.context.disabled??!1),h=(_,b)=>{const u=n.context;u.attrs?.["onSegment-click"]&&u.attrs["onSegment-click"](_,b)};return(_,b)=>(r(),N(Xt,{"model-value":d.value,search:c.value,placeholder:g.value,disabled:f.value,"max-length":y.value,"allowed-types":v.value,"editor-class":l.value.inner,"onUpdate:modelValue":i,onSegmentClick:h},null,8,["model-value","search","placeholder","disabled","max-length","allowed-types","editor-class"]))}}),Zo={type:"input",family:"text",props:["search","placeholder","maxLength","allowedTypes"],schema:()=>[{$el:"label",if:"$label",attrs:{class:"$classes.label",for:"$id"},children:"$label"},{$el:"p",if:"$help",attrs:{class:"$classes.help"},children:"$help"},{$cmp:Te(Go),props:{context:"$node.context"}}]},Xo={class:"inline-flex items-center justify-center"},Ve=fe({__name:"Loader",props:{size:{default:"md"}},setup(t){const a=t,n=O(()=>{switch(a.size){case"xs":return"w-3 h-3 border";case"sm":return"w-3.5 h-3.5 border";case"md":default:return"w-4 h-4 border-2"}});return(s,l)=>(r(),o("div",Xo,[e("div",{class:oe([n.value,"border-black/20 dark:border-white/20 border-t-black dark:border-t-white rounded-full animate-spin"])},null,2)]))}}),Qo=["type","disabled"],en="inline-flex items-center justify-center gap-2 font-medium rounded transition-all disabled:opacity-50 disabled:cursor-not-allowed",De=fe({__name:"UiButton",props:{variant:{default:"primary"},size:{default:"md"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},iconLeft:{},iconRight:{},fullWidth:{type:Boolean,default:!1},type:{default:"button"}},emits:["click"],setup(t,{emit:a}){const n=t,s=a,l=O(()=>{switch(n.variant){case"primary":return"bg-black text-white dark:bg-white dark:text-black hover:opacity-90";case"secondary":return"border-2 border-black dark:border-neutral-300 bg-white dark:bg-black text-black dark:text-white hover:bg-neutral-50 dark:hover:bg-neutral-900";case"ghost":return"border border-black dark:border-white hover:bg-black/5 dark:hover:bg-white/10";case"danger":return"border-2 border-red-600 bg-red-600 text-white hover:bg-red-700 hover:border-red-700";case"link":return"text-accent-600 dark:text-accent-400 hover:underline p-0";default:return""}}),d=O(()=>{if(n.variant==="link")return"text-sm";switch(n.size){case"xs":return"px-2 py-1 text-xs";case"sm":return"px-3 py-1.5 text-sm";case"md":return"px-4 py-2 text-sm";case"lg":return"px-6 py-3 text-base";default:return""}}),i=O(()=>n.size==="xs"||n.size==="sm"?"xs":"sm"),c=g=>{!n.disabled&&!n.loading&&s("click",g)};return(g,y)=>(r(),o("button",{type:t.type,disabled:t.disabled||t.loading,class:oe([en,l.value,d.value,t.fullWidth?"w-full":""]),onClick:c},[t.loading?(r(),N(Ve,{key:0,size:i.value},null,8,["size"])):t.iconLeft?(r(),N(Ue(t.iconLeft),{key:1,class:"w-4 h-4"})):T("",!0),je(g.$slots,"default"),t.iconRight&&!t.loading?(r(),N(Ue(t.iconRight),{key:2,class:"w-4 h-4"})):T("",!0)],10,Qo))}}),tn=["disabled","aria-label","title"],rn="inline-flex items-center justify-center rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed",Hr=fe({__name:"UiIconButton",props:{icon:{},label:{},size:{default:"sm"},variant:{default:"default"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:a}){const n=t,s=a,l=O(()=>{switch(n.variant){case"default":return"hover:bg-black/10 dark:hover:bg-white/10";case"ghost":return"hover:bg-black/5 dark:hover:bg-white/5";case"danger":return"text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20";default:return""}}),d=O(()=>{switch(n.size){case"xs":return"p-0.5";case"sm":return"p-1";case"md":return"p-1.5";default:return""}}),i=O(()=>{switch(n.size){case"xs":return"w-3.5 h-3.5";case"sm":return"w-4 h-4";case"md":return"w-5 h-5";default:return""}}),c=g=>{!n.disabled&&!n.loading&&s("click",g)};return(g,y)=>(r(),o("button",{type:"button",disabled:t.disabled||t.loading,"aria-label":t.label,title:t.label,class:oe([rn,l.value,d.value]),onClick:c},[t.loading?(r(),N(Ve,{key:0,size:"xs"})):(r(),N(Ue(t.icon),{key:1,class:oe(i.value)},null,8,["class"]))],10,tn))}}),an=["for"],on={key:0,class:"text-red-500 ml-0.5"},Wr=fe({__name:"UiLabel",props:{required:{type:Boolean,default:!1},htmlFor:{}},setup(t){return(a,n)=>(r(),o("label",{for:t.htmlFor,class:"block text-sm font-medium text-neutral-700 dark:text-neutral-300"},[je(a.$slots,"default"),t.required?(r(),o("span",on,"*")):T("",!0)],8,an))}}),nn={class:"text-xs text-red-500 dark:text-red-400"},tt=fe({__name:"UiErrorText",setup(t){return(a,n)=>(r(),o("p",nn,[je(a.$slots,"default")]))}}),ln={class:"text-xs text-neutral-500 dark:text-neutral-400"},ze=fe({__name:"UiHelpText",setup(t){return(a,n)=>(r(),o("p",ln,[je(a.$slots,"default")]))}}),sn={class:"space-y-1.5"},ct=fe({__name:"UiFormField",props:{label:{},error:{},helpText:{},required:{type:Boolean,default:!1},htmlFor:{}},setup(t){return(a,n)=>(r(),o("div",sn,[je(a.$slots,"label",{},()=>[t.label?(r(),N(Wr,{key:0,"html-for":t.htmlFor,required:t.required},{default:j(()=>[X(S(t.label),1)]),_:1},8,["html-for","required"])):T("",!0)]),je(a.$slots,"default"),je(a.$slots,"error",{},()=>[t.error?(r(),N(tt,{key:0},{default:j(()=>[X(S(t.error),1)]),_:1})):T("",!0)]),je(a.$slots,"help",{},()=>[t.helpText&&!t.error?(r(),N(ze,{key:0},{default:j(()=>[X(S(t.helpText),1)]),_:1})):T("",!0)])]))}}),un={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function dn(t,a){return r(),o("svg",un,[...a[0]||(a[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const At=Te({name:"lucide-x",render:dn}),cn={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function pn(t,a){return r(),o("svg",cn,[...a[0]||(a[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("circle",{cx:"12",cy:"12",r:"10"}),e("path",{d:"M12 16v-4m0-4h.01"})],-1)])])}Te({name:"lucide-info",render:pn});const mn={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function vn(t,a){return r(),o("svg",mn,[...a[0]||(a[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("circle",{cx:"12",cy:"12",r:"10"}),e("path",{d:"m9 12l2 2l4-4"})],-1)])])}Te({name:"lucide-circle-check",render:vn});const fn={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function hn(t,a){return r(),o("svg",fn,[...a[0]||(a[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m21.73 18l-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3M12 9v4m0 4h.01"},null,-1)])])}const pr=Te({name:"lucide-triangle-alert",render:hn}),gn={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function bn(t,a){return r(),o("svg",gn,[...a[0]||(a[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("circle",{cx:"12",cy:"12",r:"10"}),e("path",{d:"m15 9l-6 6m0-6l6 6"})],-1)])])}Te({name:"lucide-circle-x",render:bn});const ft=fe({__name:"UiBadge",props:{variant:{default:"default"},size:{default:"sm"},pill:{type:Boolean,default:!1}},setup(t){const a=t,n=O(()=>{switch(a.variant){case"default":return"bg-neutral-100 dark:bg-neutral-800 text-neutral-700 dark:text-neutral-300";case"primary":return"bg-black dark:bg-white text-white dark:text-black";case"secondary":return"bg-neutral-200 dark:bg-neutral-700 text-neutral-600 dark:text-neutral-300";case"success":return"bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-300";case"warning":return"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-300";case"error":return"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300";case"accent":return"bg-accent-100 dark:bg-accent-900/30 text-accent-700 dark:text-accent-300";default:return""}}),s=O(()=>{switch(a.size){case"sm":return"px-2 py-0.5 text-xs";case"md":return"px-2.5 py-1 text-sm";default:return""}});return(l,d)=>(r(),o("span",{class:oe(["inline-flex items-center font-medium",n.value,s.value,t.pill?"rounded-full":"rounded"])},[je(l.$slots,"default")],2))}}),xn={key:0,class:"border-b border-neutral-200 dark:border-neutral-700"},yn={key:1,class:"border-t border-neutral-200 dark:border-neutral-700"},jt=fe({__name:"UiDropdownPanel",props:{width:{},maxHeight:{},shadow:{type:[Boolean,Object],default:!0}},setup(t){const a=t,n=O(()=>a.shadow===!0?{offsetX:6,offsetY:6,intensity:.4}:a.shadow&&typeof a.shadow=="object"?a.shadow:null),s=O(()=>!!a.shadow),l=O(()=>["bg-white dark:bg-neutral-900 border border-neutral-300 dark:border-neutral-600 rounded-lg overflow-hidden",a.width]),d=O(()=>[a.maxHeight?"overflow-y-auto":"",a.maxHeight]);return(i,c)=>(r(),N(Ue(s.value?_t:"template"),Ta(Ia(s.value?n.value:{})),{default:j(()=>[e("div",{class:oe(l.value)},[i.$slots.header?(r(),o("div",xn,[je(i.$slots,"header")])):T("",!0),e("div",{class:oe(d.value)},[je(i.$slots,"default")],2),i.$slots.footer?(r(),o("div",yn,[je(i.$slots,"footer")])):T("",!0)],2)]),_:3},16))}}),kn={class:"flex items-start gap-3"},wn={class:"flex-1 text-sm"},Fe=fe({__name:"UiAlertBox",props:{variant:{default:"info"},showIcon:{type:Boolean,default:!0}},setup(t){const a=t,n=O(()=>{switch(a.variant){case"warning":return"bg-amber-50 dark:bg-amber-900/20 border-amber-200 dark:border-amber-800 text-amber-800 dark:text-amber-300";case"success":return"bg-emerald-50 dark:bg-emerald-900/20 border-emerald-200 dark:border-emerald-800 text-emerald-800 dark:text-emerald-300";case"error":return"bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800 text-red-800 dark:text-red-300";case"info":default:return"bg-neutral-50 dark:bg-neutral-900/50 border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300"}}),s=O(()=>{switch(a.variant){case"warning":return Mr;case"success":return Ma;case"error":return za;case"info":default:return zr}}),l=O(()=>{switch(a.variant){case"warning":return"text-amber-500 dark:text-amber-400";case"success":return"text-emerald-500 dark:text-emerald-400";case"error":return"text-red-500 dark:text-red-400";case"info":default:return"text-neutral-500 dark:text-neutral-400"}});return(d,i)=>(r(),o("div",{class:oe(["px-4 py-3 border rounded-lg",n.value])},[e("div",kn,[t.showIcon?(r(),N(Ue(s.value),{key:0,class:oe(["w-5 h-5 mt-0.5 flex-shrink-0",l.value])},null,8,["class"])):T("",!0),e("div",wn,[je(d.$slots,"default")])])],2))}}),mr=fe({__name:"UiMenuItem",props:{active:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},as:{default:"button"}},emits:["click"],setup(t,{emit:a}){const n=t,s=a;function l(d){n.disabled||s("click",d)}return(d,i)=>(r(),N(Ue(t.as),{type:t.as==="button"?"button":void 0,disabled:t.as==="button"?t.disabled:void 0,onClick:l,class:oe(["w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition-colors",[t.disabled?"opacity-50 cursor-not-allowed":"hover:bg-neutral-100 dark:hover:bg-neutral-800 cursor-pointer",t.active?"bg-accent-50 dark:bg-accent-950/30":""]])},{default:j(()=>[je(d.$slots,"default")]),_:3},8,["type","disabled","class"]))}}),_n={class:"relative inline-flex group"},vr=fe({__name:"UiTooltip",props:{content:{},position:{default:"top"}},setup(t){const a=t,n=O(()=>{switch(a.position){case"bottom":return"top-full mt-2 left-1/2 -translate-x-1/2";case"left":return"right-full mr-2 top-1/2 -translate-y-1/2";case"right":return"left-full ml-2 top-1/2 -translate-y-1/2";case"top":default:return"bottom-full mb-2 left-1/2 -translate-x-1/2"}}),s=O(()=>{switch(a.position){case"bottom":return"bottom-full left-1/2 -translate-x-1/2 border-b-black dark:border-b-white border-t-transparent border-l-transparent border-r-transparent";case"left":return"left-full top-1/2 -translate-y-1/2 border-l-black dark:border-l-white border-t-transparent border-b-transparent border-r-transparent";case"right":return"right-full top-1/2 -translate-y-1/2 border-r-black dark:border-r-white border-t-transparent border-b-transparent border-l-transparent";case"top":default:return"top-full left-1/2 -translate-x-1/2 border-t-black dark:border-t-white border-b-transparent border-l-transparent border-r-transparent"}});return(l,d)=>(r(),o("div",_n,[je(l.$slots,"default"),e("div",{class:oe(["absolute z-50 px-3 py-2 text-xs whitespace-nowrap bg-black dark:bg-white text-white dark:text-black rounded opacity-0 invisible group-hover:opacity-100 group-hover:visible group-focus-within:opacity-100 group-focus-within:visible transition-opacity pointer-events-none",n.value]),role:"tooltip"},[X(S(t.content)+" ",1),e("div",{class:oe(["absolute border-4",s.value])},null,2)],2)]))}}),Kr=fe({__name:"UiCodeBlock",props:{inline:{type:Boolean,default:!0}},setup(t){return(a,n)=>(r(),N(Ue(t.inline?"code":"pre"),{class:oe(["font-mono text-xs bg-neutral-100 dark:bg-neutral-800 rounded",t.inline?"px-1.5 py-0.5":"px-3 py-2 overflow-x-auto"])},{default:j(()=>[je(a.$slots,"default")]),_:3},8,["class"]))}}),$n={key:0,class:"block text-zinc-700 dark:text-zinc-300 text-xs font-bold mb-1"},Cn={key:0,class:"text-red-500"},Sn=["disabled","aria-expanded"],Tn={key:0,class:"flex items-center gap-2 text-zinc-400 flex-1 min-w-0"},In=["src","alt"],zn={class:"block truncate"},Mn={key:2,class:"block truncate text-zinc-400 flex-1 min-w-0"},Vn=["placeholder"],En=["onClick","onMouseenter"],Ln=["src","alt"],Pn={key:1,class:"w-full h-full bg-zinc-200 dark:bg-zinc-700 rounded"},An={class:"flex-1 min-w-0"},Ge=fe({__name:"SelectInput",props:{modelValue:{},options:{},placeholder:{default:"Select an option"},searchPlaceholder:{default:"Search..."},label:{},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},error:{},required:{type:Boolean,default:!1},triggerClass:{},size:{default:"md"},activeHighlight:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:a}){const n=t,s=a,l=m(!1),d=m(""),i=m(),c=m(),g=m(),y=m(),v=m(-1),f=O(()=>n.options.find(J=>J.value===n.modelValue)),h=O(()=>{const J=n.activeHighlight&&f.value,Q=n.size==="sm"?"!text-xs !py-1 !px-2":"",le=J?"!border-accent-500 !bg-accent-50 dark:!bg-accent-950/50 !text-accent-700 dark:!text-accent-300":"";return n.triggerClass?[n.triggerClass,"text-left cursor-pointer",Q,le,n.error?"!border-red-500 dark:!border-red-400":""]:["w-full min-w-[200px] px-3 py-2 text-left rounded-lg focus:outline-none focus:ring-2 focus:ring-accent-500/30 bg-transparent disabled:opacity-50 disabled:cursor-not-allowed text-sm overflow-hidden transition-colors",Q,le,n.error?"border border-red-500 dark:border-red-400 focus:border-red-500 dark:focus:border-red-400":"border border-zinc-200 dark:border-zinc-700 focus:border-accent-500 dark:focus:border-accent-400"]}),_=O(()=>{if(!d.value)return n.options;const J=d.value.toLowerCase();return n.options.filter(Q=>Q.label.toLowerCase().includes(J)||Q.value.toLowerCase().includes(J)||Q.description&&Q.description.toLowerCase().includes(J))});xe(_,()=>{v.value=-1});const b=()=>{n.disabled||(l.value?p():(l.value=!0,d.value="",v.value=-1,Le(()=>{if(y.value&&(y.value.setAttribute("popover","auto"),y.value.addEventListener("toggle",V),"showPopover"in y.value))try{y.value.showPopover()}catch{}k(),setTimeout(()=>i.value?.focus(),0)})))},u=J=>{s("update:modelValue",J.value),p(),d.value="",v.value=-1},x=J=>{J.stopPropagation(),s("update:modelValue","")},p=()=>{if(y.value){if("hidePopover"in y.value)try{y.value.hidePopover()}catch{}y.value.removeEventListener("toggle",V)}l.value=!1,v.value=-1},k=()=>{if(!g.value||!y.value)return;const J=g.value.getBoundingClientRect(),Q=window.innerWidth;y.value.style.position="fixed",y.value.style.top=`${J.bottom+8}px`,y.value.style.left=`${J.left}px`,y.value.style.margin="0",y.value.style.width="max-content";const le=y.value.offsetWidth,me=J.width,ee=Math.min(400,Q-J.left-16),L=Math.max(me,Math.min(le,ee));y.value.style.width=`${L}px`},M=J=>{c.value&&!c.value.contains(J.target)&&y.value&&!y.value.contains(J.target)&&p()},R=J=>{J.key==="Escape"&&l.value&&(p(),g.value?.focus())},W=J=>{if(!l.value)return;const Q=_.value;if(Q.length!==0)switch(J.key){case"ArrowDown":J.preventDefault(),v.value=v.value<Q.length-1?v.value+1:0,Z();break;case"ArrowUp":J.preventDefault(),v.value=v.value>0?v.value-1:Q.length-1,Z();break;case"Enter":J.preventDefault(),v.value>=0&&v.value<Q.length&&u(Q[v.value]);break}},Z=()=>{Le(()=>{const J=y.value?.querySelector(".highlighted-option");J&&J.scrollIntoView({block:"nearest",behavior:"smooth"})})},V=J=>{J.target===y.value&&(l.value=J.newState==="open",l.value&&k())},P=()=>{l.value&&k()};return Pe(()=>{document.addEventListener("click",M),document.addEventListener("keydown",R),window.addEventListener("resize",P),window.addEventListener("scroll",P,!0)}),Ye(()=>{document.removeEventListener("click",M),document.removeEventListener("keydown",R),window.removeEventListener("resize",P),window.removeEventListener("scroll",P,!0)}),(J,Q)=>(r(),o("div",{ref_key:"dropdownRef",ref:c,class:"relative"},[t.label?(r(),o("label",$n,[X(S(t.label)+" ",1),t.required?(r(),o("span",Cn,"*")):T("",!0)])):T("",!0),e("button",{ref_key:"buttonRef",ref:g,type:"button",onClick:b,disabled:t.disabled,"aria-expanded":l.value,"aria-haspopup":!0,class:oe(h.value)},[e("div",{class:oe(["flex items-center gap-1 w-full",t.size==="sm"?"min-h-[1.25em]":"min-h-[1.5em]"])},[t.loading?(r(),o("span",Tn,[w(Ve,{size:"xs"}),Q[1]||(Q[1]=X(" Loading... ",-1))])):f.value?(r(),o("span",{key:1,class:oe(["flex items-center flex-1 min-w-0",t.size==="sm"?"gap-1.5":"gap-2"])},[f.value.icon?(r(),o("img",{key:0,src:f.value.icon,alt:f.value.label,class:oe(["flex-shrink-0",[t.size==="sm"?"w-4 h-4":"w-5 h-5",f.value.icon.startsWith("data:image/svg+xml")?"dark:invert":""]])},null,10,In)):T("",!0),e("span",zn,S(f.value.label),1)],2)):(r(),o("span",Mn,S(t.placeholder),1)),f.value&&!t.disabled?(r(),o("button",{key:3,type:"button",onClick:x,class:"flex-shrink-0 p-0.5 hover:bg-zinc-100 dark:hover:bg-zinc-800 rounded transition-colors","aria-label":"Clear selection"},[(r(),o("svg",{class:oe(["text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300",t.size==="sm"?"h-3 w-3":"h-4 w-4"]),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},[...Q[2]||(Q[2]=[e("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"},null,-1)])],2))])):T("",!0),(r(),o("svg",{class:oe(["text-zinc-400 flex-shrink-0",t.size==="sm"?"h-3.5 w-3.5":"h-5 w-5"]),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},[...Q[3]||(Q[3]=[e("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"},null,-1)])],2))],2)],10,Sn),l.value?(r(),o("div",{key:1,ref_key:"popoverRef",ref:y,class:"dropdown-popover z-[9999]"},[w($(jt),{"max-height":t.size==="sm"?"max-h-48":"max-h-60",shadow:{offsetX:4,offsetY:4,intensity:.3}},{header:j(()=>[e("div",{class:oe(t.size==="sm"?"p-1.5":"p-2")},[Ae(e("input",{ref_key:"searchInput",ref:i,"onUpdate:modelValue":Q[0]||(Q[0]=le=>d.value=le),type:"text",placeholder:t.searchPlaceholder,onKeydown:W,class:oe(["w-full border border-zinc-300 dark:border-zinc-600 rounded-sm focus:outline-none focus:ring-1 focus:ring-accent-400 focus:border-accent-400 bg-transparent text-zinc-700 dark:text-zinc-200 placeholder:text-zinc-400 dark:placeholder:text-zinc-500",t.size==="sm"?"px-2 py-1 text-xs":"px-3 py-1.5 text-sm"])},null,42,Vn),[[Qe,d.value]])],2)]),default:j(()=>[_.value.length===0?(r(),o("div",{key:0,class:oe(["text-zinc-500 dark:text-zinc-400",t.size==="sm"?"px-3 py-2 text-xs":"px-4 py-3 text-sm"])}," No options found ",2)):T("",!0),(r(!0),o(he,null,we(_.value,(le,me)=>(r(),o("button",{key:le.value,type:"button",onClick:ee=>u(le),onMouseenter:ee=>v.value=me,class:oe(["w-full text-left hover:bg-zinc-100 dark:hover:bg-zinc-800 focus:bg-zinc-100 dark:focus:bg-zinc-800 focus:outline-none flex items-start",[t.size==="sm"?"px-2.5 py-1.5 gap-2":"px-4 py-2 gap-3",{"bg-zinc-50 dark:bg-zinc-900":le.value===t.modelValue,"bg-zinc-100 dark:bg-zinc-800 highlighted-option":me===v.value}]])},[e("div",{class:oe(["flex-shrink-0 mt-0.5",t.size==="sm"?"w-4 h-4":"w-5 h-5"])},[le.icon?(r(),o("img",{key:0,src:le.icon,alt:le.label,class:oe(["w-full h-full",le.icon.startsWith("data:image/svg+xml")?"dark:invert":""])},null,10,Ln)):(r(),o("div",Pn))],2),e("div",An,[e("div",{class:oe(["font-medium text-black dark:text-white",t.size==="sm"?"text-xs":"text-sm"])},S(le.label),3),le.description?(r(),o("div",{key:0,class:oe(["text-zinc-500 dark:text-zinc-400 mt-0.5",t.size==="sm"?"text-[10px]":"text-xs"])},S(le.description),3)):T("",!0)])],42,En))),128))]),_:1},8,["max-height"])],512)):T("",!0),t.error?(r(),N($(tt),{key:2,class:"mt-1"},{default:j(()=>[X(S(t.error),1)]),_:1})):T("",!0)],512))}}),jn=["type","value","placeholder","disabled"],lt=fe({__name:"TextInput",props:{modelValue:{},label:{},placeholder:{},type:{default:"text"},error:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","focus","click"],setup(t,{expose:a,emit:n}){const s=t,l=n,d=m(null),i=O(()=>["w-full px-3 py-2.5 bg-neutral-50 dark:bg-neutral-950 border rounded-md text-sm","focus:outline-none focus:ring-2 focus:ring-neutral-400 dark:focus:ring-neutral-500 focus:border-transparent","transition-colors placeholder:text-neutral-400 dark:placeholder:text-neutral-500",s.error?"border-red-500 dark:border-red-400":"border-neutral-300 dark:border-neutral-800",s.disabled?"opacity-50 cursor-not-allowed":""]),c=v=>{const f=v.target;l("update:modelValue",f.value)},g=v=>{l("focus",v)},y=v=>{l("click",v)};return a({inputRef:d}),(v,f)=>(r(),N($(ct),{label:t.label,error:t.error,required:t.required},{default:j(()=>[e("input",{ref_key:"inputRef",ref:d,type:t.type,value:t.modelValue,placeholder:t.placeholder,disabled:t.disabled,class:oe(i.value),onInput:c,onFocus:g,onClick:y},null,42,jn)]),_:1},8,["label","error","required"]))}}),Dn=["data-property-id","data-nested-property-id"],Rn={class:"p-3 space-y-3"},On={class:"flex items-start gap-2"},Un={key:0,class:"drag-handle cursor-move text-neutral-400 hover:text-neutral-600 dark:text-neutral-600 dark:hover:text-neutral-400 mt-2"},Bn={class:"flex-1 grid grid-cols-1 md:grid-cols-3 gap-2"},Fn={class:"flex items-center gap-2 mt-2"},Nn=["disabled"],qn={key:0},Hn={key:0,class:"p-3 bg-neutral-50 dark:bg-neutral-900 rounded-lg space-y-2"},Wn={class:"flex items-center justify-between mb-2"},Kn=["disabled"],Jn={key:0,class:"space-y-1"},Yn=["onClick","disabled"],Gn={key:1,class:"p-3 bg-neutral-50 dark:bg-neutral-900 rounded-lg"},Zn={class:"text-xs font-medium text-neutral-600 dark:text-neutral-400 mb-2"},Xn={class:"space-y-2"},Qn={class:"flex items-center justify-between"},el=["disabled"],tl={class:"space-y-2"},rl={key:2,class:"p-3 bg-neutral-50 dark:bg-neutral-900 rounded-lg"},al={key:0,class:"mb-2"},ol=["disabled"],nl={key:1,class:"space-y-2"},ll=fe({__name:"PropertyEditor",props:Ze({propertyId:{},isNested:{type:Boolean,default:!1},parentId:{},disabled:{type:Boolean,default:!1},enableDrag:{type:Boolean,default:!0}},{modelValue:{required:!0},modelModifiers:{}}),emits:Ze(["remove","description-keydown","add-top-level"],["update:modelValue"]),setup(t,{emit:a}){const n=t,s=a,l=it(t,"modelValue"),d=m(["object","array","enum","anyOf"].includes(l.value.type));m();const i=[{value:"string",label:"String",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z'/%3E%3C/svg%3E"},{value:"number",label:"Number",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M7 20l4-16m2 16l4-16M6 9h14M4 15h14'/%3E%3C/svg%3E"},{value:"boolean",label:"Boolean",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z'/%3E%3C/svg%3E"},{value:"object",label:"Object",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10'/%3E%3C/svg%3E"},{value:"array",label:"Array",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 6h16M4 10h16M4 14h16M4 18h16'/%3E%3C/svg%3E"},{value:"enum",label:"Enum",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4'/%3E%3C/svg%3E"},{value:"anyOf",label:"Any Of (Multiple Types)",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='w-4 h-4' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z'/%3E%3C/svg%3E"}],c=O(()=>["object","array","enum","anyOf"].includes(l.value.type));xe(()=>l.value.type,async(b,u)=>{if(["object","array","enum","anyOf"].includes(b)&&(d.value=!0,b==="anyOf"&&!l.value.anyOf&&(l.value.anyOf=[]),b==="object"&&!l.value.properties&&(l.value.properties=[{id:crypto.randomUUID(),name:"property1",type:"string",description:""}]),b==="array"&&!l.value.items&&(l.value.items={id:crypto.randomUUID(),name:"",type:"string",description:""}),b==="enum"&&!l.value.enum&&(l.value.enum=["value1"])),u!==void 0){await Le();const x=n.isNested?`[data-nested-property-id="${n.propertyId}"] input[placeholder="Description"]`:`[data-property-id="${n.propertyId}"] input[placeholder="Description"]`,p=document.querySelector(x);p&&p.focus()}},{immediate:!0,flush:"sync"});const g=b=>{b.shiftKey&&l.value.type==="object"&&l.value.properties?h():s("add-top-level")},y=()=>{l.value.items||(l.value.items={id:crypto.randomUUID(),name:"",type:"string",description:""})},v=()=>{l.value.enum||(l.value.enum=[]),l.value.enum.push(`value${l.value.enum.length+1}`)},f=b=>{l.value.enum&&l.value.enum.splice(b,1)},h=async()=>{const b={id:crypto.randomUUID(),name:l.value.type==="anyOf"?"":`property${(l.value.properties?.length||l.value.anyOf?.length||0)+1}`,type:"string",description:""};l.value.type==="anyOf"?(l.value.anyOf||(l.value.anyOf=[]),l.value.anyOf.push(b)):(l.value.properties||(l.value.properties=[]),l.value.properties.push(b)),await Le();const u=document.querySelector(`[data-nested-property-id="${b.id}"] input[placeholder="Property name"]`);u&&(u.focus(),u.select())},_=b=>{l.value.type==="anyOf"&&l.value.anyOf?l.value.anyOf=l.value.anyOf.filter(u=>u.id!==b):l.value.properties&&(l.value.properties=l.value.properties.filter(u=>u.id!==b))};return(b,u)=>{const x=Be("PropertyEditor",!0);return r(),o("div",{"data-property-id":t.isNested?void 0:t.propertyId,"data-nested-property-id":t.isNested?t.propertyId:void 0,class:oe(["border rounded-lg",t.isNested?"border-neutral-100 dark:border-neutral-900":"border-neutral-200 dark:border-neutral-800"])},[e("div",Rn,[e("div",On,[t.enableDrag?(r(),o("div",Un,[...u[10]||(u[10]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 8h16M4 16h16"})],-1)])])):T("",!0),e("div",Bn,[w(lt,{modelValue:l.value.name,"onUpdate:modelValue":u[0]||(u[0]=p=>l.value.name=p),placeholder:"Property name",disabled:t.disabled},null,8,["modelValue","disabled"]),w(Ge,{modelValue:l.value.type,"onUpdate:modelValue":u[1]||(u[1]=p=>l.value.type=p),options:i,disabled:t.disabled},null,8,["modelValue","disabled"]),w(lt,{modelValue:l.value.description,"onUpdate:modelValue":u[2]||(u[2]=p=>l.value.description=p),placeholder:"Description",disabled:t.disabled,onKeydown:u[3]||(u[3]=Va(Oe(p=>g(p),["prevent"]),["enter"]))},null,8,["modelValue","disabled"])]),e("div",Fn,[c.value?(r(),o("button",{key:0,onClick:u[4]||(u[4]=p=>d.value=!d.value),type:"button",class:"p-1 hover:bg-neutral-100 dark:hover:bg-neutral-800 rounded transition-colors"},[(r(),o("svg",{class:oe(["w-4 h-4 transition-transform",d.value?"rotate-90":""]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...u[11]||(u[11]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"},null,-1)])],2))])):T("",!0),e("button",{onClick:u[5]||(u[5]=p=>b.$emit("remove")),type:"button",disabled:t.disabled,class:"p-1 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded transition-colors disabled:opacity-50"},[...u[12]||(u[12]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,Nn)])]),d.value&&c.value?(r(),o("div",qn,[l.value.type==="enum"?(r(),o("div",Hn,[e("div",Wn,[u[13]||(u[13]=e("h4",{class:"text-xs font-medium text-neutral-600 dark:text-neutral-400"}," Enum Values ",-1)),e("button",{onClick:v,type:"button",disabled:t.disabled,class:"px-2 py-0.5 text-xs bg-neutral-800 dark:bg-neutral-200 text-white dark:text-black rounded hover:bg-neutral-700 dark:hover:bg-neutral-300 transition-colors disabled:opacity-50"}," Add Value ",8,Kn)]),l.value.enum?(r(),o("div",Jn,[(r(!0),o(he,null,we(l.value.enum,(p,k)=>(r(),o("div",{key:k,class:"flex items-center gap-2"},[w(lt,{modelValue:l.value.enum[k],"onUpdate:modelValue":M=>l.value.enum[k]=M,placeholder:"Enum value",disabled:t.disabled,class:"flex-1"},null,8,["modelValue","onUpdate:modelValue","disabled"]),e("button",{onClick:M=>f(k),type:"button",disabled:t.disabled,class:"p-1 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded transition-colors disabled:opacity-50"},[...u[14]||(u[14]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,Yn)]))),128))])):T("",!0)])):T("",!0),l.value.type==="object"||l.value.type==="anyOf"?(r(),o("div",Gn,[e("h4",Zn,S(l.value.type==="anyOf"?"Type Options":"Nested Properties"),1),e("div",Xn,[e("div",Qn,[e("button",{onClick:h,type:"button",disabled:t.disabled,class:"px-2 py-0.5 text-xs bg-neutral-800 dark:bg-neutral-200 text-white dark:text-black rounded hover:bg-neutral-700 dark:hover:bg-neutral-300 transition-colors disabled:opacity-50"}," Add "+S(l.value.type==="anyOf"?"Type Option":"Property"),9,el)]),e("div",tl,[(r(!0),o(he,null,we(l.value.type==="anyOf"?l.value.anyOf:l.value.properties,(p,k)=>(r(),N(x,{key:p.id,modelValue:(l.value.type==="anyOf"?l.value.anyOf:l.value.properties)[k],"onUpdate:modelValue":M=>(l.value.type==="anyOf"?l.value.anyOf:l.value.properties)[k]=M,"property-id":p.id,"is-nested":!0,"parent-id":t.propertyId,disabled:t.disabled,"enable-drag":!1,onRemove:M=>_(p.id),onAddTopLevel:u[6]||(u[6]=M=>s("add-top-level"))},null,8,["modelValue","onUpdate:modelValue","property-id","parent-id","disabled","onRemove"]))),128))])])])):T("",!0),l.value.type==="array"?(r(),o("div",rl,[u[15]||(u[15]=e("h4",{class:"text-xs font-medium text-neutral-600 dark:text-neutral-400 mb-2"}," Array Item Type ",-1)),l.value.items?T("",!0):(r(),o("div",al,[e("button",{onClick:y,type:"button",disabled:t.disabled,class:"px-2 py-0.5 text-xs bg-neutral-800 dark:bg-neutral-200 text-white dark:text-black rounded hover:bg-neutral-700 dark:hover:bg-neutral-300 transition-colors disabled:opacity-50"}," Define Item Type ",8,ol)])),l.value.items?(r(),o("div",nl,[(r(),N(x,{key:`${l.value.items.id}-${l.value.items.type}`,modelValue:l.value.items,"onUpdate:modelValue":u[7]||(u[7]=p=>l.value.items=p),"property-id":l.value.items.id,"is-nested":!0,"parent-id":t.propertyId,disabled:t.disabled,"enable-drag":!1,onRemove:u[8]||(u[8]=p=>l.value.items=null),onAddTopLevel:u[9]||(u[9]=p=>s("add-top-level"))},null,8,["modelValue","property-id","parent-id","disabled"]))])):T("",!0)])):T("",!0)])):T("",!0)])],10,Dn)}}}),sl={class:"space-y-2"},il=["disabled"],ul=fe({__name:"PropertyList",props:Ze({disabled:{type:Boolean,default:!1},parentId:{},isNested:{type:Boolean,default:!1}},{modelValue:{required:!0,default:()=>[]},modelModifiers:{}}),emits:Ze(["add-property","description-keydown"],["update:modelValue"]),setup(t,{expose:a,emit:n}){const s=t,l=n,d=it(t,"modelValue"),i=m();let c=!1;Pe(async()=>{}),Ye(()=>{});const g=async()=>{if(c)return;c=!0;const v={id:crypto.randomUUID(),name:`property${d.value.length+1}`,type:"string",description:"",required:!1};d.value=[...d.value,v],await Le();const f=s.parentId?`[data-nested-property-id="${v.id}"]`:`[data-property-id="${v.id}"]`,h=document.querySelector(`${f} input[placeholder="Property name"]`);h&&(h.focus(),h.select()),l("add-property"),c=!1},y=v=>{d.value=d.value.filter(f=>f.id!==v)};return a({addProperty:g}),(v,f)=>(r(),o("div",sl,[e("div",{ref_key:"dragAreaRef",ref:i,class:"space-y-2"},[(r(!0),o(he,null,we(d.value,h=>(r(),N(ll,{key:h.id,modelValue:d.value[d.value.indexOf(h)],"onUpdate:modelValue":_=>d.value[d.value.indexOf(h)]=_,"property-id":h.id,"is-nested":t.isNested,"parent-id":t.parentId,disabled:t.disabled,"enable-drag":!t.isNested,onRemove:_=>y(h.id),onAddTopLevel:f[0]||(f[0]=_=>v.$emit("add-property"))},null,8,["modelValue","onUpdate:modelValue","property-id","is-nested","parent-id","disabled","enable-drag","onRemove"]))),128))],512),e("div",{class:oe(t.isNested?"mt-2":"mt-3 pt-3 border-t border-neutral-200 dark:border-neutral-800")},[e("button",{onClick:g,type:"button",disabled:t.disabled,class:oe(t.isNested?"px-2 py-1 text-xs bg-neutral-800 dark:bg-neutral-200 text-white dark:text-black rounded hover:bg-neutral-700 dark:hover:bg-neutral-300 transition-colors disabled:opacity-50":"w-full px-3 py-2 text-sm bg-neutral-50 dark:bg-neutral-900 hover:bg-neutral-100 dark:hover:bg-neutral-800 text-neutral-700 dark:text-neutral-300 rounded transition-colors disabled:opacity-50 border border-dashed border-neutral-300 dark:border-neutral-700")},[...f[1]||(f[1]=[e("span",{class:"flex items-center justify-center gap-2"},[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})]),X(" Add Property ")],-1)])],10,il)],2)]))}}),dl={class:"space-y-4"},cl={key:0,class:"flex items-center justify-between"},pl={class:"text-sm font-medium"},ml={key:0,class:"text-red-500"},vl={class:"space-y-2 border border-neutral-200 dark:border-neutral-800 rounded-lg p-4"},fl={key:0,class:"flex items-center justify-between mb-2"},hl={key:1,class:"text-center py-12"},gl=["disabled"],bl={class:"mt-4 text-center"},xl={key:3,class:"mt-4"},yl={class:"bg-neutral-50 dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-800 rounded-lg p-4 overflow-x-auto"},kl={class:"text-xs leading-relaxed"},wl=["innerHTML"],Jr=fe({__name:"JSONSchemaInput",props:Ze({label:{},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1}},{modelValue:{required:!0,default:()=>({type:"object",properties:{},required:[]})},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const a=it(t,"modelValue"),n=m([]),s=m(),l=m(!1),d=()=>{if(a.value?.properties){const b=[];a.value.required;for(const[u,x]of Object.entries(a.value.properties)){const p=x,k={id:crypto.randomUUID(),name:u,type:p.type||"string",description:p.description||""};p.enum&&(k.enum=p.enum),p.anyOf&&(k.type="anyOf",k.anyOf=i(p.anyOf)),p.type==="array"&&p.items&&(k.items=c(p.items)),p.type==="object"&&p.properties&&(k.properties=g(p.properties,p.required||[])),b.push(k)}n.value=b}},i=b=>b.map(u=>typeof u=="object"&&u.type?{id:crypto.randomUUID(),name:"",type:u.type,description:u.description||"",properties:u.properties?g(u.properties,u.required||[]):void 0,items:u.items?c(u.items):void 0,enum:u.enum}:{id:crypto.randomUUID(),name:"",type:"string",description:""}),c=b=>{const u={id:crypto.randomUUID(),name:"",type:b.type||"string",description:b.description||""};return b.enum&&(u.enum=b.enum),b.anyOf&&(u.type="anyOf",u.anyOf=i(b.anyOf)),b.type==="array"&&b.items&&(u.items=c(b.items)),b.type==="object"&&b.properties&&(u.properties=g(b.properties,b.required||[])),u},g=(b,u)=>{const x=[];for(const[p,k]of Object.entries(b)){const M=k,R={id:crypto.randomUUID(),name:p,type:M.type||"string",description:M.description||""};M.enum&&(R.enum=M.enum),M.anyOf&&(R.type="anyOf",R.anyOf=i(M.anyOf)),M.type==="array"&&M.items&&(R.items=c(M.items)),M.type==="object"&&M.properties&&(R.properties=g(M.properties,M.required||[])),x.push(R)}return x};d();const y=()=>{const b={type:"object",properties:{},required:[],additionalProperties:!1},{properties:u}=f(n.value);b.properties=u,b.required=Object.keys(u),a.value=b},v=b=>{const u={type:b.type==="anyOf"?void 0:b.type,description:b.description};if(b.type==="enum"&&b.enum&&(u.enum=b.enum,u.type="string"),b.type==="anyOf"&&b.anyOf&&(delete u.type,u.anyOf=b.anyOf.map(v)),b.type==="object"&&b.properties){const{properties:x}=f(b.properties);u.properties=x,u.required=Object.keys(x),u.additionalProperties=!1}return b.type==="array"&&b.items&&(u.items=v(b.items)),u},f=b=>{const u={},x=[];for(const p of b){const k={type:p.type==="anyOf"?void 0:p.type,description:p.description};if(x.push(p.name),p.type==="enum"&&p.enum&&(k.enum=p.enum,k.type="string"),p.type==="anyOf"&&p.anyOf&&p.anyOf.length>0&&(delete k.type,k.anyOf=p.anyOf.map(v)),p.type==="array"&&p.items&&(k.items=v(p.items)),p.type==="object"&&p.properties){const{properties:M}=f(p.properties);k.properties=M,k.required=Object.keys(M),k.additionalProperties=!1}u[p.name]=k}return{properties:u,required:x}};xe(n,()=>{y()},{deep:!0}),y();const h=O(()=>JSON.stringify(a.value,null,2).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"([^"]+)":/g,'<span class="text-blue-600 dark:text-blue-400">"$1"</span>:').replace(/:"([^"]*)"/g,':<span class="text-green-600 dark:text-green-400">"$1"</span>').replace(/:(\d+)/g,':<span class="text-yellow-600 dark:text-yellow-400">$1</span>').replace(/:(true|false)/g,':<span class="text-purple-600 dark:text-purple-400">$1</span>').replace(/:(null)/g,':<span class="text-red-600 dark:text-red-400">$1</span>')),_=async()=>{if(n.value.length===0){const b={id:crypto.randomUUID(),name:"property1",type:"string",description:""};n.value.push(b),await Le();const u=document.querySelector(`[data-property-id="${b.id}"] input[placeholder="Property name"]`);u&&(u.focus(),u.select())}else s.value&&s.value.addProperty()};return(b,u)=>(r(),o("div",dl,[t.label?(r(),o("div",cl,[e("label",pl,[X(S(t.label)+" ",1),t.required?(r(),o("span",ml,"*")):T("",!0)])])):T("",!0),e("div",vl,[n.value.length>0?(r(),o("div",fl,[...u[2]||(u[2]=[e("h3",{class:"text-sm font-medium text-neutral-700 dark:text-neutral-300"}," Properties ",-1)])])):T("",!0),n.value.length===0?(r(),o("div",hl,[u[4]||(u[4]=e("div",{class:"mb-4"},[e("svg",{class:"w-12 h-12 mx-auto text-neutral-400 dark:text-neutral-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})])],-1)),u[5]||(u[5]=e("p",{class:"text-neutral-500 dark:text-neutral-400 text-sm mb-4"}," No properties defined ",-1)),e("button",{onClick:_,type:"button",disabled:t.disabled,class:"px-4 py-2 bg-black dark:bg-white text-white dark:text-black rounded hover:bg-neutral-800 dark:hover:bg-neutral-200 transition-colors disabled:opacity-50 font-medium text-sm"},[...u[3]||(u[3]=[e("span",{class:"flex items-center gap-2"},[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})]),X(" Add Property ")],-1)])],8,gl)])):T("",!0),n.value.length>0?(r(),N(ul,{key:2,ref_key:"propertyListRef",ref:s,modelValue:n.value,"onUpdate:modelValue":u[0]||(u[0]=x=>n.value=x),disabled:t.disabled,onAddProperty:_},null,8,["modelValue","disabled"])):T("",!0),e("div",bl,[e("button",{onClick:u[1]||(u[1]=x=>l.value=!l.value),type:"button",class:"text-xs text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-neutral-100 hover:underline transition-colors"},S(l.value?"Hide":"Show")+" JSON Schema ",1)]),l.value?(r(),o("div",xl,[e("div",yl,[e("pre",kl,[e("code",{class:"font-mono",innerHTML:h.value},null,8,wl)])])])):T("",!0)])]))}}),_l=gt(Te(Jr),{props:["label","disabled","required"],family:"text",features:[]}),$l={class:"space-y-2"},Cl={key:0,class:"space-y-2"},Sl={key:0,class:"block text-sm font-medium"},Tl={key:0,class:"text-red-500"},Il=["src","alt"],zl={class:"flex-1 text-sm"},Ml={key:0,class:"text-xs text-neutral-500 dark:text-neutral-400 ml-1"},Vl=["onClick","aria-label"],ht=fe({__name:"MultipleSelectionsInput",props:Ze({label:{},placeholder:{default:"Select an option"},searchPlaceholder:{default:"Search..."},error:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},options:{},addLabel:{default:"Add another"},loading:{type:Boolean,default:!1}},{modelValue:{required:!0,default:()=>[]},modelModifiers:{}}),emits:Ze(["removeItem"],["update:modelValue"]),setup(t,{emit:a}){const n=t,s=a,l=it(t,"modelValue"),d=m();Vr(async()=>{d.value,await Le(),await Er({parent:d,values:l,dragHandle:".drag-handle"})});const i=O(()=>Array.isArray(l.value)?l.value.length>0&&typeof l.value[0]=="object"?l.value:l.value.map(v=>{const f=n.options.find(h=>h.value===v);return{id:v,label:f?.label||v,description:f?.description,icon:f?.icon}}):[]),c=O(()=>{const v=i.value.map(f=>f.id);return n.options.filter(f=>!v.includes(f.value))}),g=v=>{if(!v)return;const f=n.options.find(h=>h.value===v);if(f)if(l.value.length===0||typeof l.value[0]=="string")l.value=[...l.value,v];else{const h={id:v,label:f.label,description:f.description,icon:f.icon};l.value=[...l.value,h]}},y=v=>{typeof l.value[0]=="string"?l.value=l.value.filter(f=>f!==v):l.value=l.value.filter(f=>f.id!==v),s("removeItem",v)};return(v,f)=>(r(),o("div",$l,[i.value.length>0?(r(),o("div",Cl,[t.label?(r(),o("label",Sl,[X(S(t.label)+" ",1),t.required?(r(),o("span",Tl,"*")):T("",!0)])):T("",!0),e("div",{class:"space-y-1",ref_key:"dragAreaRef",ref:d},[(r(!0),o(he,null,we(i.value,h=>(r(),o("div",{key:h.id,class:oe(["flex items-center gap-2 px-3 py-2 bg-neutral-50 dark:bg-neutral-900 rounded border","border-neutral-200 dark:border-neutral-800",t.disabled?"opacity-50":""])},[f[1]||(f[1]=e("div",{class:"drag-handle cursor-move text-neutral-400 hover:text-neutral-600 dark:text-neutral-600 dark:hover:text-neutral-400"},[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 8h16M4 16h16"})])],-1)),h.icon?(r(),o("img",{key:0,src:h.icon,alt:h.label,class:"w-4 h-4 flex-shrink-0"},null,8,Il)):T("",!0),e("span",zl,[X(S(h.label)+" ",1),h.description?(r(),o("span",Ml," ("+S(h.description)+") ",1)):T("",!0)]),t.disabled?T("",!0):(r(),o("button",{key:1,onClick:_=>y(h.id),type:"button",class:"p-1 hover:bg-neutral-200 dark:hover:bg-neutral-800 rounded transition-colors","aria-label":`Remove ${h.label}`},[...f[0]||(f[0]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,Vl))],2))),128))],512)])):T("",!0),w(Ge,{"model-value":"","onUpdate:modelValue":g,label:i.value.length>0?t.addLabel:t.label,options:c.value,placeholder:t.placeholder,"search-placeholder":t.searchPlaceholder,disabled:t.disabled||c.value.length===0,loading:t.loading},null,8,["label","options","placeholder","search-placeholder","disabled","loading"]),t.error?(r(),N($(tt),{key:1},{default:j(()=>[X(S(t.error),1)]),_:1})):T("",!0)]))}});function Yr(){return window.__AGENTBUILDER_CONFIG__||{mountPoint:"/agentbuilder"}}function $t(){return Yr().mountPoint}function Dt(){return Yr().devMode===!0}function ge(t){const a=$t(),n=t.startsWith("/")?t:`/${t}`;return a==="/"?n:`${a}${n}`}const El=fe({__name:"ModelSelectorInput",props:Ze({label:{},placeholder:{default:"Select a model"},error:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},allowMultiple:{type:Boolean,default:!1}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const a=t,n=it(t,"modelValue"),s=m([]),l=m(!1),d=O(()=>s.value.map(g=>({value:g.id,label:g.name,description:g.provider_id||g.provider,icon:g.iconId}))),i=async()=>{l.value=!0;try{const g=await fetch(ge("/api/models"));if(g.ok){const y=await g.json();s.value=y.models||[]}}catch(g){console.error("Error fetching models:",g)}finally{l.value=!1}},c=g=>{};return Pe(()=>{i()}),xe(()=>a.allowMultiple,()=>{a.allowMultiple&&typeof n.value=="string"?n.value=n.value?[n.value]:[]:!a.allowMultiple&&Array.isArray(n.value)&&(n.value=n.value[0]||"")}),(g,y)=>(r(),o(he,null,[t.allowMultiple?(r(),N(ht,{key:0,modelValue:n.value,"onUpdate:modelValue":y[0]||(y[0]=v=>n.value=v),label:t.label,placeholder:t.placeholder,"search-placeholder":"Search models...",error:t.error,required:t.required,disabled:t.disabled,options:d.value,loading:l.value,"add-label":"Add another model",onRemoveItem:c},null,8,["modelValue","label","placeholder","error","required","disabled","options","loading"])):(r(),N(Ge,{key:1,modelValue:n.value,"onUpdate:modelValue":y[1]||(y[1]=v=>n.value=v),label:t.label,placeholder:t.placeholder,"search-placeholder":"Search models...",options:d.value,disabled:t.disabled,loading:l.value},null,8,["modelValue","label","placeholder","options","disabled","loading"])),!t.allowMultiple&&t.error?(r(),N($(tt),{key:2,class:"mt-1"},{default:j(()=>[X(S(t.error),1)]),_:1})):T("",!0)],64))}}),Ll=fe({__name:"AgentSelectorInput",props:Ze({label:{default:"Handoff Agents"},placeholder:{default:"Select an agent"},error:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},allowMultiple:{type:Boolean,default:!0},agentType:{default:"ai_human"}},{modelValue:{required:!0,default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const a=t,n=it(t,"modelValue"),s=m([]),l=m(!1),d=O(()=>s.value.map(g=>({value:g.id,label:g.title,description:g.tool_description||`Handoff to ${g.title} agent`}))),i=async()=>{l.value=!0;try{const g=ge(`/api/agents${a.agentType?`?type=${a.agentType}`:""}`),y=await fetch(g);if(y.ok){const v=await y.json();s.value=v.agents||[]}}catch(g){console.error("Error fetching agents:",g)}finally{l.value=!1}},c=g=>{};return Pe(()=>{i()}),xe(()=>a.allowMultiple,()=>{a.allowMultiple&&typeof n.value=="string"?n.value=n.value?[n.value]:[]:!a.allowMultiple&&Array.isArray(n.value)&&(n.value=n.value[0]||"")},{immediate:!0}),(g,y)=>(r(),o(he,null,[t.allowMultiple?(r(),N(ht,{key:0,modelValue:n.value,"onUpdate:modelValue":y[0]||(y[0]=v=>n.value=v),label:t.label,placeholder:t.placeholder,"search-placeholder":"Search agents...",error:t.error,required:t.required,disabled:t.disabled,options:d.value,loading:l.value,"add-label":"Add another agent",onRemoveItem:c},null,8,["modelValue","label","placeholder","error","required","disabled","options","loading"])):(r(),N(Ge,{key:1,modelValue:n.value,"onUpdate:modelValue":y[1]||(y[1]=v=>n.value=v),label:t.label,placeholder:t.placeholder,"search-placeholder":"Search agents...",options:d.value,disabled:t.disabled,loading:l.value},null,8,["modelValue","label","placeholder","options","disabled","loading"])),!t.allowMultiple&&t.error?(r(),N($(tt),{key:2,class:"mt-1"},{default:j(()=>[X(S(t.error),1)]),_:1})):T("",!0)],64))}}),Pl=fe({__name:"ToolSelectorInput",props:Ze({label:{default:"Available Tools"},placeholder:{default:"Select a tool"},error:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},allowMultiple:{type:Boolean,default:!0}},{modelValue:{required:!0,default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const a=t,n=it(t,"modelValue"),s=m([]),l=m(!1),d=O(()=>s.value.map(g=>{let y=g.name;return g.type==="prompt"?y=`${g.name} (prompt)`:g.type==="mcp"&&(y=`${g.name} (mcp)`),{value:g.name,label:y,description:g.description}})),i=async()=>{l.value=!0;try{const g=await fetch(ge("/api/tools"));if(g.ok){const y=await g.json();s.value=Object.entries(y).map(([v,f])=>({name:v,description:f.description||"",type:f.type,model:f.model}))}}catch(g){console.error("Error fetching tools:",g)}finally{l.value=!1}},c=g=>{};return Pe(()=>{i()}),xe(()=>a.allowMultiple,()=>{a.allowMultiple&&typeof n.value=="string"?n.value=n.value?[n.value]:[]:!a.allowMultiple&&Array.isArray(n.value)&&(n.value=n.value[0]||"")},{immediate:!0}),(g,y)=>(r(),o(he,null,[t.allowMultiple?(r(),N(ht,{key:0,modelValue:n.value,"onUpdate:modelValue":y[0]||(y[0]=v=>n.value=v),label:t.label,placeholder:t.placeholder,"search-placeholder":"Search tools...",error:t.error,required:t.required,disabled:t.disabled,options:d.value,loading:l.value,"add-label":"Add another tool",onRemoveItem:c},null,8,["modelValue","label","placeholder","error","required","disabled","options","loading"])):(r(),N(Ge,{key:1,modelValue:n.value,"onUpdate:modelValue":y[1]||(y[1]=v=>n.value=v),label:t.label,placeholder:t.placeholder,"search-placeholder":"Search tools...",options:d.value,disabled:t.disabled,loading:l.value},null,8,["modelValue","label","placeholder","options","disabled","loading"])),!t.allowMultiple&&t.error?(r(),N($(tt),{key:2,class:"mt-1"},{default:j(()=>[X(S(t.error),1)]),_:1})):T("",!0)],64))}}),Al=gt(Te(El),{props:["label","placeholder","error","required","disabled","allowMultiple"],family:"dropdown",features:[]}),jl=gt(Te(Ll),{props:["label","placeholder","error","required","disabled","allowMultiple","agentType"],family:"dropdown",features:[]}),Dl=gt(Te(Pl),{props:["label","placeholder","error","required","disabled","allowMultiple"],family:"dropdown",features:[]}),Rl={class:"space-y-4"},Ol={class:"flex items-start gap-2"},Ul={class:"flex-1"},Bl=["onClick","disabled","title"],Fl={key:0,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Nl={key:1,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ql={key:0,class:"text-xs text-neutral-400 dark:text-neutral-500 mt-1"},Hl={key:0,class:"text-amber-500 dark:text-amber-400 ml-1"},Wl={class:"flex-1"},Kl={class:"flex-1"},Jl=["onClick","disabled"],Yl=["disabled"],Qt=fe({__name:"TenvPropertyList",props:{modelValue:{},inherited:{default:()=>[]},allowCustom:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:a}){const n=t,s=a,l=m(new Set),d=m([]),i=O(()=>new Set(n.inherited.map(u=>u.name)));xe(()=>n.modelValue,u=>{const x=Object.keys(u).filter(k=>!i.value.has(k)),p=new Set(d.value.map(k=>k.name));for(const k of x)p.has(k)||d.value.push({id:crypto.randomUUID(),name:k,value:String(u[k]??"")})},{immediate:!0,deep:!0});const c=u=>{if(l.value.has(u)){l.value.delete(u);const x=n.inherited.find(p=>p.name===u);x&&g(u,x.value)}else l.value.add(u)},g=(u,x)=>{const p={...n.modelValue};x===void 0||x===""?delete p[u]:p[u]=x,s("update:modelValue",p)},y=u=>n.modelValue[u.name]!==void 0?String(n.modelValue[u.name]):u.value!==void 0?String(u.value):"",v=(u,x)=>{g(u.name,x||void 0)},f=()=>{d.value.push({id:crypto.randomUUID(),name:"",value:""})},h=u=>{const x=d.value.find(p=>p.id===u);if(x&&x.name){const p={...n.modelValue};delete p[x.name],s("update:modelValue",p)}d.value=d.value.filter(p=>p.id!==u)},_=(u,x,p)=>{const k=d.value.find(R=>R.id===u);if(!k)return;k.name=p;const M={...n.modelValue};x&&delete M[x],p&&k.value&&(M[p]=k.value),s("update:modelValue",M)},b=(u,x)=>{const p=d.value.find(k=>k.id===u);p&&(p.value=x,p.name&&g(p.name,x||void 0))};return(u,x)=>(r(),o("div",Rl,[(r(!0),o(he,null,we(t.inherited,p=>(r(),o("div",{key:p.name,class:"relative"},[e("div",Ol,[e("div",Ul,[w(lt,{"model-value":y(p),label:p.name,placeholder:p.description||"Enter value...",disabled:t.disabled||!l.value.has(p.name),required:p.required,"onUpdate:modelValue":k=>v(p,k)},null,8,["model-value","label","placeholder","disabled","required","onUpdate:modelValue"])]),e("button",{type:"button",onClick:k=>c(p.name),disabled:t.disabled,class:"mt-7 p-2 text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-300 transition-colors disabled:opacity-50",title:l.value.has(p.name)?"Lock (use inherited value)":"Unlock to override"},[l.value.has(p.name)?(r(),o("svg",Nl,[...x[1]||(x[1]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"},null,-1)])])):(r(),o("svg",Fl,[...x[0]||(x[0]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"},null,-1)])]))],8,Bl)]),p.source?(r(),o("p",ql,[X(" From: "+S(p.source)+" ",1),p.required?(r(),o("span",Hl,"(required)")):T("",!0)])):T("",!0)]))),128)),(r(!0),o(he,null,we(d.value,p=>(r(),o("div",{key:p.id,class:"flex items-start gap-2"},[e("div",Wl,[w(lt,{"model-value":p.name,label:"Name",placeholder:"Variable name",disabled:t.disabled,"onUpdate:modelValue":k=>_(p.id,p.name,k)},null,8,["model-value","disabled","onUpdate:modelValue"])]),e("div",Kl,[w(lt,{"model-value":p.value,label:"Value",placeholder:"Variable value",disabled:t.disabled,"onUpdate:modelValue":k=>b(p.id,k)},null,8,["model-value","disabled","onUpdate:modelValue"])]),e("button",{type:"button",onClick:k=>h(p.id),disabled:t.disabled,class:"mt-7 p-2 text-red-400 hover:text-red-600 dark:hover:text-red-300 transition-colors disabled:opacity-50",title:"Remove"},[...x[2]||(x[2]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,Jl)]))),128)),t.allowCustom?(r(),o("button",{key:0,type:"button",onClick:f,disabled:t.disabled,class:"w-full px-3 py-2 text-sm bg-neutral-50 dark:bg-neutral-900 hover:bg-neutral-100 dark:hover:bg-neutral-800 text-neutral-700 dark:text-neutral-300 rounded transition-colors disabled:opacity-50 border border-dashed border-neutral-300 dark:border-neutral-700"},[...x[3]||(x[3]=[e("span",{class:"flex items-center justify-center gap-2"},[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})]),X(" Add custom variable ")],-1)])],8,Yl)):T("",!0)]))}}),Gl=gt(Te(Qt),{props:["inherited","allowCustom","disabled"],family:"text",features:[]}),Zl={class:"space-y-3 mt-3 pt-3 border-t border-neutral-200 dark:border-neutral-700"},Xl={class:"space-y-2 pl-4 border-l-2 border-accent-200 dark:border-accent-700"},Ql={class:"space-y-2 pl-4 border-l-2 border-neutral-200 dark:border-neutral-700"},es=fe({__name:"PromptToolOptions",props:{toolName:{},toolConfig:{},toolType:{default:"prompt"},disabled:{type:Boolean}},emits:["update:option"],setup(t,{emit:a}){const n=t,s=a,l=m(null),d=m(!0),i=O(()=>l.value?.properties?Object.entries(l.value.properties).map(([y,v])=>({value:y,label:y,attrs:{description:v.description||v.type||""}})):[]),c=async()=>{try{let y=n.toolName;if(n.toolType==="handoff"||n.toolType==="subagent"){const f=await fetch(ge(`/api/agents/${encodeURIComponent(n.toolName)}`));if(f.ok){if(y=(await f.json())?.agent?.side_a_agent_prompt,!y){d.value=!1;return}}else{d.value=!1;return}}const v=await fetch(ge(`/api/prompts/${encodeURIComponent(y)}`));if(v.ok){const f=await v.json();f?.prompt?.required_schema&&(l.value=f.prompt.required_schema)}}catch(y){console.error("Error fetching prompt schema:",y)}finally{d.value=!1}};Pe(()=>{c()});const g=(y,v)=>{s("update:option",y,v)};return(y,v)=>{const f=Be("FormKit");return r(),o("div",Zl,[e("div",Xl,[v[5]||(v[5]=e("p",{class:"text-xs font-medium text-neutral-600 dark:text-neutral-400 mb-2"}," Initialization Options: ",-1)),w(f,{type:"selectSearch",value:t.toolConfig.init_user_message_property||"",onInput:v[0]||(v[0]=h=>g("init_user_message_property",h||null)),label:"User message property",placeholder:"Don't inject a user message",options:i.value,disabled:t.disabled||d.value||i.value.length===0,loading:d.value,help:"Select which argument property should be used as the most recent user message for this sub-prompt. If not set no additional user message will be injected.","outer-class":"$reset mb-2"},null,8,["value","options","disabled","loading"]),w(f,{type:"selectSearch",value:t.toolConfig.init_attachments_property||"",onInput:v[1]||(v[1]=h=>g("init_attachments_property",h||null)),label:"Attachments property",placeholder:"Don't attach files",options:i.value,disabled:t.disabled||d.value||i.value.length===0,loading:d.value,help:"Select which argument contains attachment path(s). Accepts a single path string or an array of paths.","outer-class":"$reset mb-0"},null,8,["value","options","disabled","loading"])]),e("div",Ql,[v[6]||(v[6]=e("p",{class:"text-xs font-medium text-neutral-600 dark:text-neutral-400 mb-2"}," Sub-Prompt Response Options: ",-1)),w(f,{type:"checkbox",value:t.toolConfig.include_text_response,onInput:v[2]||(v[2]=h=>g("include_text_response",h)),label:"Include text response",help:"Include the final text content from the sub-prompt",disabled:t.disabled,"outer-class":"$reset mb-1"},null,8,["value","disabled"]),w(f,{type:"checkbox",value:t.toolConfig.include_tool_calls,onInput:v[3]||(v[3]=h=>g("include_tool_calls",h)),label:"Include tool calls and responses",help:"Include tool calls executed by the sub-prompt and their responses",disabled:t.disabled,"outer-class":"$reset mb-1"},null,8,["value","disabled"]),w(f,{type:"checkbox",value:t.toolConfig.include_errors,onInput:v[4]||(v[4]=h=>g("include_errors",h)),label:"Include errors",help:"Include error information if the sub-prompt fails",disabled:t.disabled,"outer-class":"$reset mb-0"},null,8,["value","disabled"])])])}}});async function Je(t,a={}){const n=localStorage.getItem("auth_token"),s={"Content-Type":"application/json",...a.headers};n&&(s.Authorization=`Bearer ${n}`);const l=t.startsWith("/")?t:`/${t}`,d=await fetch(ge(`/api${l}`),{...a,headers:s});if(d.status===401)throw localStorage.removeItem("auth_token"),window.location.href=ge("/login"),new Error("Unauthorized");return d}const ts={class:"space-y-4"},rs={class:"block text-sm font-medium mb-2"},as={key:0,class:"text-red-500"},os={class:"flex items-start justify-between"},ns={class:"flex items-center gap-2 flex-1"},ls={class:"flex-1"},ss={key:0,class:"text-xs text-neutral-500 dark:text-neutral-400 font-normal"},is={key:1,class:"text-xs text-neutral-500 dark:text-neutral-400 font-normal"},us={key:2,class:"text-xs text-neutral-500 dark:text-neutral-400 font-normal"},ds={key:3,class:"text-xs text-neutral-500 dark:text-neutral-400 font-normal"},cs={key:4,class:"text-xs text-neutral-500 dark:text-neutral-400 font-normal"},ps={key:0,class:"text-xs text-neutral-600 dark:text-neutral-400 mt-1"},ms={key:1,class:"text-xs text-amber-600 dark:text-amber-400 mt-1 flex items-center gap-1"},vs=["onClick","disabled","aria-label"],fs={key:0,class:"mt-3 pt-3 border-t border-neutral-200 dark:border-neutral-700"},hs={class:"space-y-2"},gs={key:0,class:"text-xs text-amber-500 dark:text-amber-400 whitespace-nowrap",title:"Required at agent or thread level"},bs={key:0,class:"text-center py-8 text-sm text-neutral-500 dark:text-neutral-400 border border-dashed border-neutral-300 dark:border-neutral-600 rounded-lg"},Gr=fe({__name:"ToolSelectorWithOptions",props:Ze({label:{default:"Available Tools"},placeholder:{default:"Select a tool"},error:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},modelId:{},providerId:{}},{modelValue:{required:!0,default:()=>[]},modelModifiers:{}}),emits:Ze(["unavailable-tools"],["update:modelValue"]),setup(t,{expose:a,emit:n}){const s=t,l=it(t,"modelValue"),d=m([]),i=m([]),c=m(!1),g=m(!1),y=m(),v=m(""),f=O(()=>[...d.value,...i.value]),h=O(()=>new Set(f.value.map(ee=>x(ee)))),_=ee=>(ee.startsWith("provider:"),h.value.has(ee)),b=O(()=>l.value.filter(ee=>!_(ee.name)).map(ee=>ee.name)),u=n;xe(b,ee=>{ee.length>0&&u("unavailable-tools",ee)},{immediate:!0}),Vr(async()=>{y.value,await Le(),y.value&&l.value.length>0&&await Er({parent:y,values:l,dragHandle:".drag-handle"})});const x=ee=>ee.type==="provider"?`provider:${ee.name}`:ee.type==="mcp"?`mcp:${ee.name}`:ee.name,p=ee=>ee.startsWith("provider:")?ee.slice(9):ee.startsWith("mcp:")?ee.slice(4):ee,k=ee=>ee.startsWith("provider:")?"provider":ee.startsWith("mcp:")?"mcp":"tool",M=O(()=>{const ee=new Set(l.value.map(L=>L.name));return f.value.filter(L=>!ee.has(x(L))).map(L=>{let C=L.name;return L.type==="prompt"?C=`${L.name} (prompt)`:L.type==="mcp"?C=`${L.name} (mcp)`:L.type==="provider"?C=`${L.name} (provider)`:L.type==="handoff"?C=`${L.name} (handoff agent)`:L.type==="subagent"&&(C=`${L.name} (subagent)`),{value:x(L),label:C,attrs:{description:L.description}}})}),R=async()=>{c.value=!0;try{const ee=await Je("/tools");if(ee.ok){const L=await ee.json();d.value=Object.entries(L).map(([C,I])=>({name:C,description:I.description||"",type:I.type,model:I.model}))}}catch(ee){console.error("Error fetching tools:",ee)}finally{c.value=!1}},W=async()=>{if(!s.providerId||!s.modelId){i.value=[];return}g.value=!0;try{const ee=await Je(`/providers/${s.providerId}/tools?model=${encodeURIComponent(s.modelId)}`);if(ee.ok){const L=await ee.json();i.value=(L.tools||[]).map(C=>({name:C.name,description:C.description||"",type:"provider",tenvs:C.tenvs||[]}))}else i.value=[]}catch(ee){console.error("Error fetching provider tools:",ee),i.value=[]}finally{g.value=!1}};xe([()=>s.providerId,()=>s.modelId],async([ee,L])=>{ee&&L?await W():i.value=[]},{immediate:!0});const Z=ee=>{if(!ee||l.value.find(I=>I.name===ee))return;const L=P(ee),C={};if(L?.tenvs&&L.tenvs.length>0)for(const I of L.tenvs)C[I.name]="";l.value=[...l.value,{name:ee,include_text_response:!0,include_tool_calls:!0,include_errors:!0,init_user_message_property:null,init_attachments_property:null,...Object.keys(C).length>0?{tenvs:C}:{}}],Le(()=>{v.value=""})},V=ee=>{l.value=l.value.filter(L=>L.name!==ee)},P=ee=>{const L=f.value.find(C=>x(C)===ee);return L||f.value.find(C=>C.name===ee)},J=(ee,L,C)=>{l.value=l.value.map(I=>{if(I.name===ee){const re={...I.tenvs||{},[L]:C||void 0};for(const F of Object.keys(re))re[F]||delete re[F];return{...I,tenvs:Object.keys(re).length>0?re:void 0}}return I})},Q=(ee,L,C)=>{l.value=l.value.map(I=>I.name===ee?{...I,[L]:C}:I)};return a({removeUnavailableTools:()=>{l.value=l.value.filter(ee=>_(ee.name))},getAvailableToolsOnly:()=>l.value.filter(ee=>_(ee.name)),unavailableTools:b}),Pe(()=>{R()}),(ee,L)=>{const C=Be("FormKit");return r(),o("div",ts,[e("div",null,[e("label",rs,[X(S(t.label)+" ",1),t.required?(r(),o("span",as,"*")):T("",!0)]),l.value.length>0?(r(),o("div",{key:0,class:"space-y-3 mb-4",ref_key:"dragAreaRef",ref:y},[(r(!0),o(he,null,we(l.value,I=>(r(),o("div",{key:I.name,class:oe(["border rounded-lg p-4 transition-colors",_(I.name)?"border-neutral-300 dark:border-neutral-600":"border-amber-300 dark:border-amber-700 bg-amber-50 dark:bg-amber-900/20 opacity-75"])},[e("div",os,[e("div",ns,[e("div",{class:oe(["drag-handle",_(I.name)?"cursor-move text-neutral-400 hover:text-neutral-600 dark:text-neutral-600 dark:hover:text-neutral-400":"cursor-not-allowed text-neutral-300 dark:text-neutral-700"])},[...L[1]||(L[1]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 8h16M4 16h16"})],-1)])],2),e("div",ls,[e("h4",{class:oe(["font-medium text-sm",!_(I.name)&&"text-neutral-500 dark:text-neutral-400"])},[X(S(p(I.name))+" ",1),k(I.name)==="provider"?(r(),o("span",ss,"(provider)")):k(I.name)==="mcp"?(r(),o("span",is,"(mcp)")):P(I.name)?.type==="prompt"?(r(),o("span",us,"(prompt)")):P(I.name)?.type==="handoff"?(r(),o("span",ds,"(handoff agent)")):P(I.name)?.type==="subagent"?(r(),o("span",cs,"(subagent)")):T("",!0)],2),P(I.name)?.description?(r(),o("p",ps,S(P(I.name)?.description),1)):T("",!0),_(I.name)?T("",!0):(r(),o("p",ms,[...L[2]||(L[2]=[e("svg",{class:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})],-1),X(" Not available for selected model - will be removed on save ",-1)])]))])]),e("button",{onClick:re=>V(I.name),type:"button",disabled:t.disabled,class:"p-1 hover:bg-neutral-200 dark:hover:bg-neutral-800 rounded transition-colors text-neutral-500 hover:text-red-500","aria-label":`Remove ${p(I.name)}`},[...L[3]||(L[3]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,vs)]),P(I.name)?.type==="provider"&&P(I.name)?.tenvs?.length?(r(),o("div",fs,[L[4]||(L[4]=e("p",{class:"text-xs text-neutral-500 dark:text-neutral-400 mb-2 font-medium"},[X(" Environment Variables "),e("span",{class:"text-neutral-400"},"(optional at prompt level)")],-1)),e("div",hs,[(r(!0),o(he,null,we(P(I.name)?.tenvs,re=>(r(),o("div",{key:re.name,class:"flex items-center gap-2"},[w(C,{type:"text",value:I.tenvs?.[re.name]||"",onInput:F=>J(I.name,re.name,F),label:re.name,placeholder:re.description||"Enter value...",disabled:t.disabled,"outer-class":"$reset flex-1 mb-0"},null,8,["value","onInput","label","placeholder","disabled"]),re.required?(r(),o("span",gs," required* ")):T("",!0)]))),128))])])):T("",!0),P(I.name)?.type==="prompt"||P(I.name)?.type==="handoff"||P(I.name)?.type==="subagent"?(r(),N(es,{key:1,"tool-name":I.name,"tool-config":I,"tool-type":P(I.name)?.type,disabled:t.disabled,"onUpdate:option":(re,F)=>Q(I.name,re,F)},null,8,["tool-name","tool-config","tool-type","disabled","onUpdate:option"])):T("",!0)],2))),128))],512)):T("",!0),w(C,{type:"selectSearch",modelValue:v.value,"onUpdate:modelValue":L[0]||(L[0]=I=>v.value=I),onInput:Z,placeholder:l.value.length>0?"Add another tool...":t.placeholder,"search-placeholder":"Search tools...",options:M.value,disabled:t.disabled||c.value||M.value.length===0,loading:c.value,"outer-class":"$reset"},null,8,["modelValue","placeholder","options","disabled","loading"]),t.error?(r(),N($(tt),{key:1,class:"mt-1"},{default:j(()=>[X(S(t.error),1)]),_:1})):T("",!0)]),l.value.length===0&&!c.value&&M.value.length===0?(r(),o("div",bs," No tools available. Create tools in your agentbuilder/tools directory. ")):T("",!0)])}}}),xs=gt(Te(Gr),{props:["label","placeholder","error","required","disabled","modelId","providerId"],family:"dropdown",features:[]}),ys=fe({__name:"SelectInputWrapper",props:{context:{}},setup(t){const a=t,n=(_,b)=>{const u=a.context;return u[_]!==void 0?u[_]:u.attrs?.[_]!==void 0?u.attrs[_]:b},s=O(()=>a.context.classes??{}),l=O(()=>n("options",[])),d=O(()=>a.context._value??""),i=_=>{a.context.node.input(_)},c=O(()=>n("placeholder","Select an option")),g=O(()=>n("searchPlaceholder","Search...")),y=O(()=>n("loading",!1)),v=O(()=>a.context.disabled??!1),f=O(()=>n("size","md")),h=O(()=>n("activeHighlight",!1));return(_,b)=>(r(),N(Ge,{"model-value":d.value,options:l.value,placeholder:c.value,"search-placeholder":g.value,loading:y.value,disabled:v.value,"trigger-class":s.value.inner,size:f.value,"active-highlight":h.value,"onUpdate:modelValue":i},null,8,["model-value","options","placeholder","search-placeholder","loading","disabled","trigger-class","size","active-highlight"]))}}),ks={type:"input",family:"dropdown",props:["options","placeholder","searchPlaceholder","loading","size","activeHighlight"],schema:()=>[{$el:"label",if:"$label",attrs:{class:"$classes.label",for:"$id"},children:"$label"},{$cmp:Te(ys),props:{context:"$node.context"}}]},ws={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function _s(t,a){return r(),o("svg",ws,[...a[0]||(a[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"m21 21l-4.34-4.34"}),e("circle",{cx:"11",cy:"11",r:"8"})],-1)])])}const $s=Te({name:"lucide-search",render:_s}),Cs=["data-suffix-icon"],Ss=["id","value","placeholder","disabled"],Ts=fe({__name:"SearchInputWrapper",props:{context:{}},setup(t){const a=t,n=(y,v)=>{const f=a.context;return f[y]!==void 0?f[y]:f.attrs?.[y]!==void 0?f.attrs[y]:v},s=O(()=>a.context.classes??{}),l=O(()=>a.context._value??""),d=y=>{const v=y.target.value;a.context.node.input(v)},i=()=>{a.context.node.input("")},c=O(()=>n("placeholder","Search...")),g=O(()=>a.context.disabled??!1);return(y,v)=>(r(),o("div",{class:oe(s.value.inner),"data-prefix-icon":"true","data-suffix-icon":!!l.value},[e("span",{class:oe(s.value.prefixIcon)},[w($($s))],2),e("input",{type:"text",id:t.context.id,value:l.value,onInput:d,placeholder:c.value,disabled:g.value,class:oe(s.value.input)},null,42,Ss),l.value?(r(),o("button",{key:0,type:"button",onClick:i,class:oe([s.value.suffixIcon,"hover:text-zinc-600 dark:hover:text-zinc-300 cursor-pointer"])},[w($(At))],2)):T("",!0)],10,Cs))}}),Is={type:"input",family:"text",props:["placeholder","size"],schema:()=>[{$el:"label",if:"$label",attrs:{class:"$classes.label",for:"$id"},children:"$label"},{$cmp:Te(Ts),props:{context:"$node.context"}}]},zs=fe({__name:"SortableMultiSelectWrapper",props:{context:{}},setup(t){const a=t,n=O(()=>a.context.options??[]),s=O(()=>a.context.placeholder??"Select an option"),l=O(()=>a.context.searchPlaceholder??"Search..."),d=O(()=>a.context.addLabel??"Add another"),i=O(()=>a.context.loading??!1),c=O(()=>a.context.disabled??!1),g=O({get:()=>a.context._value??[],set:y=>a.context.node.input(y)});return(y,v)=>(r(),N(ht,{modelValue:g.value,"onUpdate:modelValue":v[0]||(v[0]=f=>g.value=f),options:n.value,placeholder:s.value,"search-placeholder":l.value,"add-label":d.value,loading:i.value,disabled:c.value},null,8,["modelValue","options","placeholder","search-placeholder","add-label","loading","disabled"]))}}),Ms={type:"input",family:"dropdown",props:["options","placeholder","searchPlaceholder","addLabel","loading"],schema:()=>[{$el:"label",if:"$label",attrs:{class:"$classes.label",for:"$id"},children:"$label"},{$cmp:Te(zs),props:{context:"$node.context"}}]},Vs={class:"flex items-center gap-2 py-1 pl-2 pr-1"},Es={class:"flex-1 grid grid-cols-1 md:grid-cols-3 gap-2"},Ls={class:"flex items-center gap-0.5 shrink-0"},Ps={key:1,class:"w-7"},As={class:"pl-2 pb-1"},js={key:0},Ds={class:"space-y-1.5"},Rs=["onClick"],Os=["onClick"],Us={key:1},Bs=["onClick"],Fs={key:2},Ns=["onClick"],qs={key:3},Hs={class:"flex items-center gap-2 py-1 pl-2 pr-1"},Ws={class:"flex-1 grid grid-cols-1 md:grid-cols-2 gap-2"},Ks={class:"flex items-center gap-0.5 shrink-0"},Js={key:1,class:"w-7"},Ys={class:"pl-2 pb-1"},Gs={key:0},Zs={class:"space-y-1.5"},Xs=["onClick"],Qs=["onClick"],ei={key:1},ti=["onClick"],ri={key:2},ai=["onClick"],oi={key:3},ni=["onClick"],li=fe({__name:"SchemaPropertyRow",props:{typeOptions:{},depth:{},index:{}},emits:["remove"],setup(t){const a=t,n=m(!1),s=m("string"),l=m("string"),d=m(!1),i=b=>{s.value=b,y(b)&&(n.value=!0)},c=b=>{l.value=b,y(b)&&(d.value=!0)},g=b=>{b.value?.type&&(l.value=b.value.type,y(l.value)&&(d.value=!0)),b.on("input",({payload:u})=>{u?.type&&u.type!==l.value&&c(u.type)})},y=b=>["object","array","enum","anyOf"].includes(b),v=["#3b82f6","#8b5cf6","#ec4899","#f97316","#10b981"],f=O(()=>a.depth||0),h=b=>v[b%v.length],_=O(()=>h(f.value));return(b,u)=>{const x=Be("FormKit"),p=Be("SchemaPropertyRow",!0);return r(),N(x,{type:"group",index:t.index,onNode:u[3]||(u[3]=k=>{k.value?.type&&(s.value=k.value.type,y(s.value)&&(n.value=!0)),k.on("input",({payload:M})=>{M?.type&&M.type!==s.value&&i(M.type)})})},{default:j(({value:k})=>[e("div",{class:oe(["schema-row",f.value>0?"border-l-[3px] ml-2":""]),style:st(f.value>0?{borderColor:_.value}:{})},[e("div",Vs,[e("div",Es,[w(x,{type:"text",name:"name",placeholder:"Property name","outer-class":"$reset"}),w(x,{type:"selectSearch",name:"type",options:t.typeOptions,placeholder:"Type","outer-class":"$reset",onInput:i},null,8,["options"]),w(x,{type:"text",name:"description",placeholder:"Description","outer-class":"$reset"})]),e("div",Ls,[y(s.value)?(r(),o("button",{key:0,onClick:u[0]||(u[0]=M=>n.value=!n.value),type:"button",class:"p-1.5 text-neutral-500 dark:text-white/70 hover:text-neutral-700 dark:hover:text-white hover:bg-neutral-100 dark:hover:bg-neutral-700 rounded transition-colors"},[(r(),o("svg",{class:oe(["w-4 h-4 transition-transform duration-150",n.value?"rotate-90":""]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...u[4]||(u[4]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"},null,-1)])],2))])):(r(),o("div",Ps)),e("button",{onClick:u[1]||(u[1]=M=>b.$emit("remove")),type:"button",class:"p-1.5 text-neutral-500 dark:text-white/70 hover:text-red-500 dark:hover:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/30 rounded transition-colors"},[...u[5]||(u[5]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])])]),Ae(e("div",As,[s.value==="enum"?(r(),o("div",js,[u[7]||(u[7]=e("div",{class:"text-[11px] font-medium text-neutral-400 uppercase tracking-wider mb-2"}," Enum Values ",-1)),w(x,{type:"list",name:"enumValues",dynamic:""},{default:j(({items:M,value:R,node:W})=>[e("div",Ds,[(r(!0),o(he,null,we(M,(Z,V)=>(r(),o("div",{key:Z,class:"flex items-center gap-2"},[w(x,{type:"group",index:V},{default:j(()=>[w(x,{type:"text",name:"value",placeholder:"Value","outer-class":"$reset flex-1"})]),_:1},8,["index"]),e("button",{onClick:P=>W.input(R.filter((J,Q)=>Q!==V)),type:"button",class:"p-1 text-neutral-500 dark:text-white/70 hover:text-red-500 dark:hover:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/30 rounded"},[...u[6]||(u[6]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,Rs)]))),128))]),e("button",{onClick:Z=>W.input((R||[]).concat({value:""})),type:"button",class:"mt-2 px-3 py-1.5 text-xs font-medium text-neutral-600 dark:text-neutral-400 bg-neutral-100 dark:bg-neutral-800 hover:bg-neutral-200 dark:hover:bg-neutral-700 rounded transition-colors"}," + Add Value ",8,Os)]),_:1})])):T("",!0),s.value==="object"?(r(),o("div",Us,[w(x,{type:"list",name:"properties",dynamic:""},{default:j(({items:M,value:R,node:W})=>[e("div",null,[(r(!0),o(he,null,we(M,(Z,V)=>(r(),N(p,{key:Z,index:V,"type-options":t.typeOptions,depth:f.value+1,onRemove:P=>W.input(R.filter((J,Q)=>Q!==V))},null,8,["index","type-options","depth","onRemove"]))),128))]),e("button",{onClick:Z=>W.input((R||[]).concat({name:"",type:"string",description:""})),type:"button",class:"mt-2 px-3 py-1.5 text-xs font-medium text-neutral-600 dark:text-neutral-400 bg-neutral-100 dark:bg-neutral-800 hover:bg-neutral-200 dark:hover:bg-neutral-700 rounded transition-colors"}," + Add Nested Property ",8,Bs)]),_:1})])):T("",!0),s.value==="anyOf"?(r(),o("div",Fs,[u[8]||(u[8]=e("div",{class:"text-[11px] font-medium text-neutral-400 uppercase tracking-wider mb-2"}," Type Options ",-1)),w(x,{type:"list",name:"anyOfTypes",dynamic:""},{default:j(({items:M,value:R,node:W})=>[e("div",null,[(r(!0),o(he,null,we(M,(Z,V)=>(r(),N(p,{key:Z,index:V,"type-options":t.typeOptions,depth:f.value+1,onRemove:P=>W.input(R.filter((J,Q)=>Q!==V))},null,8,["index","type-options","depth","onRemove"]))),128))]),e("button",{onClick:Z=>W.input((R||[]).concat({name:"",type:"string",description:""})),type:"button",class:"mt-2 px-3 py-1.5 text-xs font-medium text-neutral-600 dark:text-neutral-400 bg-neutral-100 dark:bg-neutral-800 hover:bg-neutral-200 dark:hover:bg-neutral-700 rounded transition-colors"}," + Add Type ",8,Ns)]),_:1})])):T("",!0),s.value==="array"?(r(),o("div",qs,[u[14]||(u[14]=e("div",{class:"text-[11px] font-medium text-neutral-400 uppercase tracking-wider mb-2"}," Array Item Type ",-1)),w(x,{type:"group",name:"items",onNode:g},{default:j(({value:M,node:R})=>[e("div",{class:"schema-row border-l-[3px] ml-2",style:st({borderColor:h(f.value+1)})},[e("div",Hs,[e("div",Ws,[w(x,{type:"selectSearch",name:"type",options:t.typeOptions,placeholder:"Item type","outer-class":"$reset",onInput:c},null,8,["options"]),w(x,{type:"text",name:"description",placeholder:"Description","outer-class":"$reset"})]),e("div",Ks,[y(l.value)?(r(),o("button",{key:0,onClick:u[2]||(u[2]=W=>d.value=!d.value),type:"button",class:"p-1.5 text-neutral-500 dark:text-white/70 hover:text-neutral-700 dark:hover:text-white hover:bg-neutral-100 dark:hover:bg-neutral-700 rounded transition-colors"},[(r(),o("svg",{class:oe(["w-4 h-4 transition-transform duration-150",d.value?"rotate-90":""]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...u[9]||(u[9]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"},null,-1)])],2))])):(r(),o("div",Js))])]),Ae(e("div",Ys,[l.value==="enum"?(r(),o("div",Gs,[u[11]||(u[11]=e("div",{class:"text-[11px] font-medium text-neutral-400 uppercase tracking-wider mb-2"}," Enum Values ",-1)),w(x,{type:"list",name:"enumValues",dynamic:""},{default:j(({items:W,value:Z,node:V})=>[e("div",Zs,[(r(!0),o(he,null,we(W,(P,J)=>(r(),o("div",{key:P,class:"flex items-center gap-2"},[w(x,{type:"group",index:J},{default:j(()=>[w(x,{type:"text",name:"value",placeholder:"Value","outer-class":"$reset flex-1"})]),_:1},8,["index"]),e("button",{onClick:Q=>V.input(Z.filter((le,me)=>me!==J)),type:"button",class:"p-1 text-neutral-500 dark:text-white/70 hover:text-red-500 dark:hover:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/30 rounded"},[...u[10]||(u[10]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,Xs)]))),128))]),e("button",{onClick:P=>V.input((Z||[]).concat({value:""})),type:"button",class:"mt-2 px-3 py-1.5 text-xs font-medium text-neutral-600 dark:text-neutral-400 bg-neutral-100 dark:bg-neutral-800 hover:bg-neutral-200 dark:hover:bg-neutral-700 rounded transition-colors"}," + Add Value ",8,Qs)]),_:1})])):T("",!0),l.value==="object"?(r(),o("div",ei,[w(x,{type:"list",name:"properties",dynamic:""},{default:j(({items:W,value:Z,node:V})=>[e("div",null,[(r(!0),o(he,null,we(W,(P,J)=>(r(),N(p,{key:P,index:J,"type-options":t.typeOptions,depth:f.value+2,onRemove:Q=>V.input(Z.filter((le,me)=>me!==J))},null,8,["index","type-options","depth","onRemove"]))),128))]),e("button",{onClick:P=>V.input((Z||[]).concat({name:"",type:"string",description:""})),type:"button",class:"mt-2 px-3 py-1.5 text-xs font-medium text-neutral-600 dark:text-neutral-400 bg-neutral-100 dark:bg-neutral-800 hover:bg-neutral-200 dark:hover:bg-neutral-700 rounded transition-colors"}," + Add Nested Property ",8,ti)]),_:1})])):T("",!0),l.value==="anyOf"?(r(),o("div",ri,[u[12]||(u[12]=e("div",{class:"text-[11px] font-medium text-neutral-400 uppercase tracking-wider mb-2"}," Type Options ",-1)),w(x,{type:"list",name:"anyOfTypes",dynamic:""},{default:j(({items:W,value:Z,node:V})=>[e("div",null,[(r(!0),o(he,null,we(W,(P,J)=>(r(),N(p,{key:P,index:J,"type-options":t.typeOptions,depth:f.value+2,onRemove:Q=>V.input(Z.filter((le,me)=>me!==J))},null,8,["index","type-options","depth","onRemove"]))),128))]),e("button",{onClick:P=>V.input((Z||[]).concat({name:"",type:"string",description:""})),type:"button",class:"mt-2 px-3 py-1.5 text-xs font-medium text-neutral-600 dark:text-neutral-400 bg-neutral-100 dark:bg-neutral-800 hover:bg-neutral-200 dark:hover:bg-neutral-700 rounded transition-colors"}," + Add Type ",8,ai)]),_:1})])):T("",!0),l.value==="array"?(r(),o("div",oi,[u[13]||(u[13]=e("div",{class:"text-[11px] font-medium text-neutral-400 uppercase tracking-wider mb-2"}," Nested Array Item Type ",-1)),w(x,{type:"list",name:"items",dynamic:""},{default:j(({items:W,value:Z,node:V})=>[e("div",null,[(r(!0),o(he,null,we(W,(P,J)=>(r(),N(p,{key:P,index:J,"type-options":t.typeOptions,depth:f.value+2,onRemove:Q=>V.input(Z.filter((le,me)=>me!==J))},null,8,["index","type-options","depth","onRemove"]))),128))]),e("button",{onClick:P=>V.input((Z||[]).concat({type:"string",description:""})),type:"button",class:"mt-2 px-3 py-1.5 text-xs font-medium text-neutral-600 dark:text-neutral-400 bg-neutral-100 dark:bg-neutral-800 hover:bg-neutral-200 dark:hover:bg-neutral-700 rounded transition-colors"}," + Define Nested Item ",8,ni)]),_:1})])):T("",!0)],512),[[Ke,d.value&&y(l.value)]])],4)]),_:1})])):T("",!0)],512),[[Ke,n.value&&y(s.value)]])],6)]),_:1},8,["index"])}}}),si=Xe(li,[["__scopeId","data-v-a52ecd3f"]]),ii={"data-schema-editor":"",class:"space-y-4"},ui={class:"space-y-2 border border-neutral-200 dark:border-neutral-800 rounded-lg p-4"},di={key:0,class:"flex items-center justify-between mb-2"},ci={key:1,class:"text-center py-12"},pi={class:"divide-y divide-neutral-100 dark:divide-neutral-800"},mi={class:"mt-3 pt-3 border-t border-neutral-200 dark:border-neutral-800"},vi=["onClick"],fi={class:"mt-4 text-center"},hi={key:3,class:"mt-4"},gi={class:"bg-neutral-50 dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-800 rounded-lg p-4 overflow-x-auto"},bi={class:"text-xs leading-relaxed"},xi=["innerHTML"],yi=fe({__name:"FormKitSchemaEditor",props:{context:{}},setup(t){const a=[{value:"string",label:"String",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z'/%3E%3C/svg%3E"},{value:"number",label:"Number",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M7 20l4-16m2 16l4-16M6 9h14M4 15h14'/%3E%3C/svg%3E"},{value:"boolean",label:"Boolean",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z'/%3E%3C/svg%3E"},{value:"object",label:"Object",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10'/%3E%3C/svg%3E"},{value:"array",label:"Array",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 6h16M4 10h16M4 14h16M4 18h16'/%3E%3C/svg%3E"},{value:"enum",label:"Enum",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4'/%3E%3C/svg%3E"},{value:"anyOf",label:"Any Of",icon:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z'/%3E%3C/svg%3E"}],n=t,s=m(!1),l=y=>y?.properties?Object.entries(y.properties).map(([v,f])=>{const h={name:v,type:f.enum?"enum":f.anyOf?"anyOf":f.type||"string",description:f.description||""};return f.enum&&(h.enumValues=f.enum.map(_=>({value:_}))),f.anyOf&&(h.anyOfTypes=f.anyOf.map(_=>({type:_.type||"string",description:_.description||""}))),f.type==="object"&&f.properties&&(h.properties=l(f)),f.type==="array"&&f.items&&(h.items={type:f.items.type||"string",description:f.items.description||""},f.items.properties&&(h.items.properties=l(f.items))),h}):[],d=y=>{const v={type:"object",properties:{},required:[],additionalProperties:!1};for(const f of y||[]){if(!f.name)continue;const h={type:f.type==="enum"||f.type==="anyOf"?void 0:f.type,description:f.description||void 0};if(f.type==="enum"&&f.enumValues&&(h.type="string",h.enum=f.enumValues.map(_=>_.value)),f.type==="anyOf"&&f.anyOfTypes&&(h.anyOf=f.anyOfTypes.map(_=>({type:_.type,description:_.description||void 0}))),f.type==="object"&&f.properties){const _=d(f.properties);h.properties=_.properties,h.required=_.required,h.additionalProperties=!1}if(f.type==="array"&&f.items&&(h.items={type:f.items.type,description:f.items.description||void 0},f.items.properties)){const _=d(f.items.properties);h.items.properties=_.properties,h.items.required=_.required}Object.keys(h).forEach(_=>h[_]===void 0&&delete h[_]),v.properties[f.name]=h,v.required.push(f.name)}return v},i=O({get:()=>{const y=n.context._value;return l(y)},set:y=>{const v=d(y);n.context.node.input(v)}}),c=O(()=>{const y=n.context._value||{type:"object",properties:{},required:[]};return JSON.stringify(y,null,2).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"([^"]+)":/g,'<span class="text-blue-600 dark:text-blue-400">"$1"</span>:').replace(/:"([^"]*)"/g,':<span class="text-green-600 dark:text-green-400">"$1"</span>').replace(/:(\d+)/g,':<span class="text-yellow-600 dark:text-yellow-400">$1</span>').replace(/:(true|false)/g,':<span class="text-purple-600 dark:text-purple-400">$1</span>')}),g=()=>{i.value=[{name:"property1",type:"string",description:""}]};return(y,v)=>{const f=Be("FormKit");return r(),o("div",ii,[e("div",ui,[i.value.length>0?(r(),o("div",di,[...v[3]||(v[3]=[e("h3",{class:"text-sm font-medium text-neutral-700 dark:text-neutral-300"}," Properties ",-1)])])):T("",!0),i.value.length===0?(r(),o("div",ci,[v[5]||(v[5]=e("div",{class:"mb-4"},[e("svg",{class:"w-12 h-12 mx-auto text-neutral-400 dark:text-neutral-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})])],-1)),v[6]||(v[6]=e("p",{class:"text-neutral-500 dark:text-neutral-400 text-sm mb-4"}," No properties defined ",-1)),e("button",{onClick:v[0]||(v[0]=h=>g()),type:"button",class:"px-4 py-2 bg-black dark:bg-white text-white dark:text-black rounded hover:bg-neutral-800 dark:hover:bg-neutral-200 transition-colors font-medium text-sm"},[...v[4]||(v[4]=[e("span",{class:"flex items-center gap-2"},[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})]),X(" Add Property ")],-1)])])])):T("",!0),i.value.length>0?(r(),N(f,{key:2,type:"list",value:i.value,onInput:v[1]||(v[1]=h=>i.value=h),dynamic:""},{default:j(({items:h,value:_,node:b})=>[e("div",pi,[(r(!0),o(he,null,we(h,(u,x)=>(r(),N(si,{key:u,index:x,"type-options":a,depth:0,onRemove:p=>b.input(_.filter((k,M)=>M!==x))},null,8,["index","onRemove"]))),128))]),e("div",mi,[e("button",{onClick:u=>b.input(_.concat({name:`property${_.length+1}`,type:"string",description:""})),type:"button",class:"px-3 py-1.5 text-xs font-medium text-neutral-700 dark:text-neutral-300 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-600 rounded-md hover:bg-neutral-50 dark:hover:bg-neutral-700 transition-colors shadow-sm"}," + Add Property ",8,vi)])]),_:1},8,["value"])):T("",!0),e("div",fi,[e("button",{onClick:v[2]||(v[2]=h=>s.value=!s.value),type:"button",class:"text-xs font-medium text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-neutral-100 underline underline-offset-2 transition-colors"},S(s.value?"Hide":"Show")+" JSON Schema ",1)]),s.value?(r(),o("div",hi,[e("div",gi,[e("pre",bi,[e("code",{class:"font-mono",innerHTML:c.value},null,8,xi)])])])):T("",!0)])])}}}),ki={type:"input",family:"text",props:["label","disabled","required"],schema:()=>[{$el:"label",if:"$label",attrs:{class:"$classes.label",for:"$id"},children:"$label"},{$cmp:Te(yi),props:{context:"$node.context"}}]},wi={promptInput:Zo,jsonSchema:_l,modelSelector:Al,agentSelector:jl,toolSelector:Dl,tenvPropertyList:Gl,toolSelectorWithOptions:xs,selectSearch:ks,searchInput:Is,sortableMultiSelect:Ms,schemaEditor:ki},_i=so("fk-2d3e4e0bb",uo),$i={config:{rootClasses:To},plugins:[_i],rules:Ao,messages:{en:jo},inputs:wi,icons:{...io}},Ci={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Si(t,a){return r(),o("svg",Ci,[...a[0]||(a[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M12 8V4H8"}),e("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),e("path",{d:"M2 14h2m16 0h2m-7-1v2m-6-2v2"})],-1)])])}const mt=Te({name:"lucide-bot",render:Si}),Ti={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ii(t,a){return r(),o("svg",Ti,[...a[0]||(a[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"},null,-1)])])}const Lt=Te({name:"lucide-message-square",render:Ii}),zi={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Mi(t,a){return r(),o("svg",zi,[...a[0]||(a[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M12 20v2m0-20v2m5 16v2m0-20v2M2 12h2m-2 5h2M2 7h2m16 5h2m-2 5h2M20 7h2M7 20v2M7 2v2"}),e("rect",{width:"16",height:"16",x:"4",y:"4",rx:"2"}),e("rect",{width:"8",height:"8",x:"8",y:"8",rx:"1"})],-1)])])}const Vi=Te({name:"lucide-cpu",render:Mi}),Ei={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Li(t,a){return r(),o("svg",Ei,[...a[0]||(a[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),e("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),e("path",{d:"M6 6h.01M6 18h.01"})],-1)])])}const Pi=Te({name:"lucide-server",render:Li}),Ai={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function ji(t,a){return r(),o("svg",Ai,[...a[0]||(a[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"},null,-1)])])}const Wt=Te({name:"lucide-wrench",render:ji}),Di={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ri(t,a){return r(),o("svg",Di,[...a[0]||(a[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0a2.34 2.34 0 0 0 3.319 1.915a2.34 2.34 0 0 1 2.33 4.033a2.34 2.34 0 0 0 0 3.831a2.34 2.34 0 0 1-2.33 4.033a2.34 2.34 0 0 0-3.319 1.915a2.34 2.34 0 0 1-4.659 0a2.34 2.34 0 0 0-3.32-1.915a2.34 2.34 0 0 1-2.33-4.033a2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"}),e("circle",{cx:"12",cy:"12",r:"3"})],-1)])])}const Kt=Te({name:"lucide-settings",render:Ri}),Oi={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ui(t,a){return r(),o("svg",Oi,[...a[0]||(a[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m15 18l-6-6l6-6"},null,-1)])])}const Zr=Te({name:"lucide-chevron-left",render:Ui}),Bi={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Fi(t,a){return r(),o("svg",Bi,[...a[0]||(a[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("circle",{cx:"12",cy:"12",r:"4"}),e("path",{d:"M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"})],-1)])])}const Ni=Te({name:"lucide-sun",render:Fi}),qi={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Hi(t,a){return r(),o("svg",qi,[...a[0]||(a[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"},null,-1)])])}const Wi=Te({name:"lucide-moon",render:Hi}),Ki={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ji(t,a){return r(),o("svg",Ki,[...a[0]||(a[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"},null,-1)])])}const Yi=Te({name:"lucide-activity",render:Ji}),Gi={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Zi(t,a){return r(),o("svg",Gi,[...a[0]||(a[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),e("path",{d:"M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3m-6 4.2h5.7"})],-1)])])}const Xi=Te({name:"lucide-function-square",render:Zi}),Qi={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function eu(t,a){return r(),o("svg",Qi,[...a[0]||(a[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m16 17l5-5l-5-5m5 5H9m0 9H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"},null,-1)])])}const tu=Te({name:"lucide-log-out",render:eu}),ru={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function au(t,a){return r(),o("svg",ru,[...a[0]||(a[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M16 3.128a4 4 0 0 1 0 7.744M22 21v-2a4 4 0 0 0-3-3.87"}),e("circle",{cx:"9",cy:"7",r:"4"})],-1)])])}const ou=Te({name:"lucide-users",render:au}),nu={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function lu(t,a){return r(),o("svg",nu,[...a[0]||(a[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"m15.5 7.5l2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4m2-2l-9.6 9.6"}),e("circle",{cx:"7.5",cy:"15.5",r:"5.5"})],-1)])])}const su=Te({name:"lucide-key",render:lu}),iu={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function uu(t,a){return r(),o("svg",iu,[...a[0]||(a[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 7v14m-9-3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4a4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3a3 3 0 0 0-3-3z"},null,-1)])])}const du=Te({name:"lucide-book-open",render:uu}),cu={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function pu(t,a){return r(),o("svg",cu,[...a[0]||(a[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m-11 5L21 3m-3 10v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"},null,-1)])])}const mu=Te({name:"lucide-external-link",render:pu}),Xr="agentbuilder-accent-theme",Qr=["amber","lime","emerald","sky","blue","indigo","purple","fuchsia","pink","white"],Jt=m("purple");let fr=!1;function ea(t){typeof document>"u"||(t==="purple"?delete document.documentElement.dataset.accent:document.documentElement.dataset.accent=t)}function vu(t){try{localStorage.setItem(Xr,t)}catch{}}function fu(){try{const t=localStorage.getItem(Xr);if(t&&Qr.includes(t))return t}catch{}return"purple"}function ta(){if(fr)return;fr=!0;const t=fu();Jt.value=t,ea(t)}function hu(){ta();function t(a){Jt.value=a,ea(a),vu(a)}return{theme:Jt,themes:Qr,setTheme:t}}const ra="/agents/assets/img/agent-builder-logo-light.svg",aa="/agents/assets/img/agent-builder-logo-dark.svg",gu="data:image/svg+xml,%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%20150%20150'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;'%3e%3cg%20id='Artboard1'%20transform='matrix(1,0,0,1,1,1)'%3e%3crect%20x='-1'%20y='-1'%20width='150'%20height='150'%20style='fill:none;'/%3e%3cg%20transform='matrix(1.034881,0,0,1.034881,4.124225,0)'%3e%3cpath%20d='M133.816,92.912L108.064,59.193C103.573,53.307%20101.473,45.937%20102.197,38.566L105.475,5.046L99.553,4.466L96.312,37.643C95.895,41.808%2091.44,44.27%2087.71,42.369L30.34,13.394L27.659,18.7L84.686,47.494C87.184,48.762%2087.076,52.347%2084.504,53.452L0.387,89.671L2.741,95.139L86.189,59.211C88.76,58.106%2091.422,60.587%2090.48,63.231L62.918,141.119L68.532,143.111L96.384,64.408C97.507,61.257%20101.672,60.605%20103.7,63.249L129.107,96.498L133.834,92.876L133.816,92.912Z'%20style='fill:rgb(31,41,55);fill-opacity:0.5;fill-rule:nonzero;'/%3e%3c/g%3e%3cg%20transform='matrix(1.034881,0,0,1.034881,4.124225,0)'%3e%3cpath%20d='M133.925,90.214L107.648,7.346C106.036,2.257%20100.875,-0.821%2095.624,0.193L32.64,12.344C29.959,12.869%2027.605,14.408%2026.066,16.6C25.523,17.36%2025.07,18.211%2024.744,19.117L0.622,86.284C-0.917,90.594%200.459,95.375%204.081,98.164L59.568,141.137C61.469,142.604%2063.733,143.346%2066.015,143.346C68.079,143.346%2070.144,142.731%2071.937,141.517L129.832,102.111C133.707,99.468%20135.355,94.687%20133.943,90.232L133.925,90.214ZM116.92,85.922L47.127,53.923C44.374,52.673%2043.994,48.925%2046.421,47.132L94.175,11.873C97.416,9.483%20102.034,10.95%20103.284,14.771C108.173,29.548%20118.64,62.054%20124.218,79.457C125.631,83.876%20121.121,87.859%20116.902,85.94L116.92,85.922ZM79.162,15.567L42.455,42.659C40.083,44.415%2036.696,43.057%2036.189,40.16L33.781,26.342C33.038,22.05%2035.845,17.94%2040.119,17.089C49.409,15.241%2065.254,12.145%2076.681,9.917C79.995,9.265%2081.879,13.557%2079.162,15.567ZM29.126,34.238L31.716,49.069C31.915,50.21%2031.607,51.388%2030.865,52.275L16.559,69.587C15.291,71.127%2012.846,69.732%2013.516,67.849L25.704,33.93C26.32,32.21%2028.8,32.427%2029.126,34.22L29.126,34.238ZM12.882,83.386L29.543,63.231C31.517,60.84%2035.356,61.547%2036.352,64.499L56.308,123.661C57.322,126.668%2053.809,129.149%2051.31,127.193C41.223,119.297%2024.4,106.132%2014.404,98.164C9.84,94.542%209.152,87.878%2012.864,83.386L12.882,83.386ZM63.498,126.305L43.161,66.002C42.056,62.706%2045.407,59.681%2048.576,61.13L117.337,92.677C121.375,94.524%20121.864,100.083%20118.206,102.6C107.358,110.061%2088.326,123.064%2076.826,130.815C71.991,134.074%2065.381,131.829%2063.516,126.305L63.498,126.305Z'%20style='fill:rgb(31,41,55);fill-rule:nonzero;'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",bu="data:image/svg+xml,%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%20150%20150'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;'%3e%3cg%20id='Artboard1'%20transform='matrix(1,0,0,1,1,1)'%3e%3crect%20x='-1'%20y='-1'%20width='150'%20height='150'%20style='fill:none;'/%3e%3cg%20transform='matrix(1.034881,0,0,1.034881,4.124225,0)'%3e%3cpath%20d='M133.816,92.912L108.064,59.193C103.573,53.307%20101.473,45.937%20102.197,38.566L105.475,5.046L99.553,4.466L96.312,37.643C95.895,41.808%2091.44,44.27%2087.71,42.369L30.34,13.394L27.659,18.7L84.686,47.494C87.184,48.762%2087.076,52.347%2084.504,53.452L0.387,89.671L2.741,95.139L86.189,59.211C88.76,58.106%2091.422,60.587%2090.48,63.231L62.918,141.119L68.532,143.111L96.384,64.408C97.507,61.257%20101.672,60.605%20103.7,63.249L129.107,96.498L133.834,92.876L133.816,92.912Z'%20style='fill:rgb(249,250,251);fill-opacity:0.5;fill-rule:nonzero;'/%3e%3c/g%3e%3cg%20transform='matrix(1.034881,0,0,1.034881,4.124225,0)'%3e%3cpath%20d='M133.925,90.214L107.648,7.346C106.036,2.257%20100.875,-0.821%2095.624,0.193L32.64,12.344C29.959,12.869%2027.605,14.408%2026.066,16.6C25.523,17.36%2025.07,18.211%2024.744,19.117L0.622,86.284C-0.917,90.594%200.459,95.375%204.081,98.164L59.568,141.137C61.469,142.604%2063.733,143.346%2066.015,143.346C68.079,143.346%2070.144,142.731%2071.937,141.517L129.832,102.111C133.707,99.468%20135.355,94.687%20133.943,90.232L133.925,90.214ZM116.92,85.922L47.127,53.923C44.374,52.673%2043.994,48.925%2046.421,47.132L94.175,11.873C97.416,9.483%20102.034,10.95%20103.284,14.771C108.173,29.548%20118.64,62.054%20124.218,79.457C125.631,83.876%20121.121,87.859%20116.902,85.94L116.92,85.922ZM79.162,15.567L42.455,42.659C40.083,44.415%2036.696,43.057%2036.189,40.16L33.781,26.342C33.038,22.05%2035.845,17.94%2040.119,17.089C49.409,15.241%2065.254,12.145%2076.681,9.917C79.995,9.265%2081.879,13.557%2079.162,15.567ZM29.126,34.238L31.716,49.069C31.915,50.21%2031.607,51.388%2030.865,52.275L16.559,69.587C15.291,71.127%2012.846,69.732%2013.516,67.849L25.704,33.93C26.32,32.21%2028.8,32.427%2029.126,34.22L29.126,34.238ZM12.882,83.386L29.543,63.231C31.517,60.84%2035.356,61.547%2036.352,64.499L56.308,123.661C57.322,126.668%2053.809,129.149%2051.31,127.193C41.223,119.297%2024.4,106.132%2014.404,98.164C9.84,94.542%209.152,87.878%2012.864,83.386L12.882,83.386ZM63.498,126.305L43.161,66.002C42.056,62.706%2045.407,59.681%2048.576,61.13L117.337,92.677C121.375,94.524%20121.864,100.083%20118.206,102.6C107.358,110.061%2088.326,123.064%2076.826,130.815C71.991,134.074%2065.381,131.829%2063.516,126.305L63.498,126.305Z'%20style='fill:rgb(249,250,251);fill-rule:nonzero;'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",xu=["src"],yu=["src"],ku={class:"flex-1 flex flex-col justify-between pt-2 pb-4"},wu={class:"flex flex-col gap-1 px-2"},_u={key:0},$u=["onClick","title"],Cu={key:0,class:"flex-1 whitespace-nowrap overflow-hidden text-ellipsis text-left"},Su={key:0,class:"ml-4 space-y-0.5"},Tu=["onClick"],Iu={class:"whitespace-nowrap overflow-hidden text-ellipsis"},zu=["onClick","title"],Mu={key:0,class:"whitespace-nowrap overflow-hidden text-ellipsis"},Vu={class:"flex flex-col gap-1 px-2"},Eu=["title"],Lu={key:0,class:"flex-1 whitespace-nowrap overflow-hidden text-ellipsis"},Pu={class:"relative settings-menu-container"},Au={key:0,class:"absolute bottom-full mb-2 left-0 z-50"},ju={class:"px-4 py-3 border-b border-neutral-200 dark:border-neutral-700"},Du=["title"],Ru={class:"relative z-10 flex items-center justify-center w-8 h-full"},Ou={class:"relative z-10 flex items-center justify-center w-8 h-full"},Uu={class:"px-4 pt-3 pb-4 border-b border-neutral-200 dark:border-neutral-700"},Bu={class:"grid grid-cols-5 gap-3"},Fu=["onClick","title"],Nu={key:0,class:"w-2 h-2 rounded-full bg-white shadow-sm"},qu={key:0,class:"text-sm overflow-hidden whitespace-nowrap max-w-0 group-hover:max-w-[60px] group-hover:ml-2 transition-all duration-200"},Hu=fe({__name:"Sidebar",props:{isCollapsed:{type:Boolean},isDark:{type:Boolean}},emits:["toggle-sidebar","toggle-theme"],setup(t,{emit:a}){function n(le){if(le.startsWith("/src/")||le.startsWith("data:"))return le;const me=$t();return me==="/"?le.replace("/agents/","/"):le.replace("/agents/",`${me}/`)}const s=n(ra),l=n(aa),d=n(gu),i=n(bu),c=t,g=ut(),y=bt(),v=O(()=>g.name);function f(le){const me=g.path;return me===le.path||me.startsWith(le.path+"/")}const h=O(()=>c.isDark?l:s),_=O(()=>c.isDark?i:d),b=[{id:"threads",label:"Threads",icon:Yi,path:"/threads"},{id:"agents",label:"Agents",icon:mt,path:"/agents"},{id:"prompts",label:"Prompts",icon:Lt,path:"/prompts"},{id:"tools",label:"Tools",icon:Wt,path:"/tools",hasSubnav:!0,subnav:[{id:"tools-functions",label:"Functions",icon:Xi,path:"/tools#functions"},{id:"tools-prompts",label:"Prompts",icon:Lt,path:"/tools#prompts"},{id:"tools-agents",label:"Agents",icon:mt,path:"/tools#agents"}]},{id:"models",label:"Models",icon:Vi,path:"/models"},{id:"providers",label:"Providers",icon:Pi,path:"/providers"}],u=le=>{y.push(le)},x=le=>{y.push(le),k.value=!1},p=O(()=>typeof v.value=="string"&&(v.value==="tools"||v.value.startsWith("tools-"))),k=m(!1),{theme:M,themes:R,setTheme:W}=hu(),Z={amber:"bg-amber-500",lime:"bg-lime-500",emerald:"bg-emerald-500",sky:"bg-sky-500",blue:"bg-blue-500",indigo:"bg-indigo-500",purple:"bg-purple-500",fuchsia:"bg-fuchsia-500",pink:"bg-pink-500",white:"bg-neutral-400 dark:bg-neutral-500"},V=O(()=>v.value==="users"||v.value==="api-keys"),P=()=>{k.value=!k.value},J=()=>{localStorage.removeItem("auth_token"),y.push("/login")},Q=le=>{const me=le.target;k.value&&!me.closest(".settings-menu-container")&&(k.value=!1)};return Pe(()=>{document.addEventListener("click",Q)}),Ye(()=>{document.removeEventListener("click",Q)}),(le,me)=>(r(),o("aside",{class:oe(["flex flex-col transition-all duration-300 pt-2.5",t.isCollapsed?"w-16":"w-60"])},[e("div",{class:oe(`flex items-center justify-between ${t.isCollapsed?"px-2 py-4":"p-4"}`)},[t.isCollapsed?T("",!0):(r(),o("img",{key:0,src:h.value,alt:"AgentBuilder",class:"h-8 mr-2 mt-0.5"},null,8,xu)),e("button",{onClick:me[0]||(me[0]=ee=>le.$emit("toggle-sidebar")),class:oe(`p-1 rounded hover:bg-black/5 dark:hover:bg-white/10 transition-colors ${t.isCollapsed?"m-auto":"border border-black/20 dark:border-white/20 opacity-50 hover:opacity-100"}`),"aria-label":"Toggle sidebar"},[t.isCollapsed?(r(),o("img",{key:1,src:_.value,alt:"AgentBuilder",class:"w-7 h-7 m-auto"},null,8,yu)):(r(),N($(Zr),{key:0,class:"w-5 h-5"}))],2)],2),e("nav",ku,[e("div",wu,[(r(),o(he,null,we(b,ee=>(r(),o(he,{key:ee.id},[ee.hasSubnav?(r(),o("div",_u,[e("button",{onClick:L=>u(ee.path),class:oe(["flex items-center gap-3 px-3 py-3 rounded text-sm font-medium transition-all w-full",p.value?"bg-black text-white dark:bg-white dark:text-black":"hover:bg-black/5 dark:hover:bg-white/10",t.isCollapsed&&"justify-center"]),title:t.isCollapsed?ee.label:void 0},[(r(),N(Ue(ee.icon),{class:"w-5 h-5 flex-shrink-0"})),t.isCollapsed?T("",!0):(r(),o("span",Cu,S(ee.label),1))],10,$u),!t.isCollapsed&&ee.subnav?(r(),o("div",Su,[(r(!0),o(he,null,we(ee.subnav,L=>(r(),o("button",{key:L.id,onClick:C=>u(L.path),class:oe(["flex items-center gap-3 px-3 py-1.5 text-sm transition-all w-full",v.value===L.id?"bg-black text-white dark:bg-white dark:text-black rounded":"hover:underline"])},[(r(),N(Ue(L.icon),{class:"w-4 h-4 flex-shrink-0"})),e("span",Iu,S(L.label),1)],10,Tu))),128))])):T("",!0)])):(r(),o("button",{key:1,onClick:L=>u(ee.path),class:oe(["flex items-center gap-3 px-3 py-3 rounded text-sm font-medium transition-all",f(ee)?"bg-black text-white dark:bg-white dark:text-black":"hover:bg-black/5 dark:hover:bg-white/10",t.isCollapsed&&"justify-center"]),title:t.isCollapsed?ee.label:void 0},[(r(),N(Ue(ee.icon),{class:"w-5 h-5 flex-shrink-0"})),t.isCollapsed?T("",!0):(r(),o("span",Mu,S(ee.label),1))],10,zu))],64))),64))]),e("div",Vu,[e("a",{href:"https://docs.standardagentbuilder.com/",target:"_blank",rel:"noopener noreferrer",class:oe(["flex items-center gap-3 px-3 py-2 rounded text-sm transition-all","hover:bg-black/5 dark:hover:bg-white/10 text-neutral-600 dark:text-neutral-400 hover:text-black dark:hover:text-white",t.isCollapsed&&"justify-center"]),title:t.isCollapsed?"Documentation":void 0},[w($(du),{class:"w-5 h-5 flex-shrink-0"}),t.isCollapsed?T("",!0):(r(),o("span",Lu," Docs ")),t.isCollapsed?T("",!0):(r(),N($(mu),{key:1,class:"w-3 h-3 flex-shrink-0 opacity-50"}))],10,Eu),e("div",{class:oe(["flex items-center gap-1 pt-2 mt-1 border-t border-black/10 dark:border-white/10",t.isCollapsed?"flex-col":"justify-between"])},[e("div",Pu,[e("button",{onClick:Oe(P,["stop"]),class:oe(["p-2 rounded transition-colors flex items-center",k.value||V.value?"bg-black/10 dark:bg-white/10 text-black dark:text-white":"hover:bg-black/5 dark:hover:bg-white/10 text-neutral-600 dark:text-neutral-400 hover:text-black dark:hover:text-white"]),title:"Settings"},[w($(Kt),{class:"w-5 h-5 flex-shrink-0"})],2),k.value?(r(),o("div",Au,[w($(jt),{width:"min-w-[200px]",shadow:{offsetX:6,offsetY:6,intensity:.4}},{default:j(()=>[e("div",ju,[me[4]||(me[4]=e("div",{class:"text-xs font-bold text-neutral-600 dark:text-neutral-400 pb-3"}," Appearance ",-1)),e("button",{onClick:me[1]||(me[1]=Oe(ee=>le.$emit("toggle-theme"),["stop"])),class:"relative flex items-center h-7 rounded-full bg-neutral-200 dark:bg-neutral-800 hover:bg-neutral-300 dark:hover:bg-neutral-700 transition-colors",title:t.isDark?"Switch to light mode":"Switch to dark mode"},[e("span",{class:oe(["absolute top-0.5 h-6 w-8 rounded-full bg-white dark:bg-black shadow-sm transition-transform duration-200",t.isDark?"translate-x-[calc(100%-2px)]":"translate-x-0.5"])},null,2),e("span",Ru,[w($(Ni),{class:oe(["w-4 h-4",t.isDark?"text-neutral-500":"text-black"])},null,8,["class"])]),e("span",Ou,[w($(Wi),{class:oe(["w-4 h-4",t.isDark?"text-white":"text-neutral-400"])},null,8,["class"])])],8,Du)]),e("div",Uu,[me[5]||(me[5]=e("div",{class:"text-xs font-bold text-neutral-600 dark:text-neutral-400 pb-3"}," Accent Color ",-1)),e("div",Bu,[(r(!0),o(he,null,we($(R),ee=>(r(),o("button",{key:ee,onClick:Oe(L=>$(W)(ee),["stop"]),class:oe(["w-6 h-6 rounded-full transition-all flex items-center justify-center ring-1 ring-black/10 dark:ring-white/10",[Z[ee],$(M)===ee?"ring-2 ring-black/50 dark:ring-white/50":"hover:scale-110"]]),title:ee.charAt(0).toUpperCase()+ee.slice(1)},[$(M)===ee?(r(),o("span",Nu)):T("",!0)],10,Fu))),128))])]),e("button",{onClick:me[2]||(me[2]=ee=>x("/settings/users")),class:oe(["flex items-center gap-3 px-4 py-2 text-sm transition-all w-full text-left",v.value==="users"?"bg-black text-white dark:bg-white dark:text-black":"hover:bg-black/5 dark:hover:bg-white/10"])},[w($(ou),{class:"w-4 h-4 flex-shrink-0"}),me[6]||(me[6]=e("span",{class:"whitespace-nowrap"},"Users",-1))],2),e("button",{onClick:me[3]||(me[3]=ee=>x("/settings/api-keys")),class:oe(["flex items-center gap-3 px-4 py-2 text-sm transition-all w-full text-left",v.value==="api-keys"?"bg-black text-white dark:bg-white dark:text-black":"hover:bg-black/5 dark:hover:bg-white/10"])},[w($(su),{class:"w-4 h-4 flex-shrink-0"}),me[7]||(me[7]=e("span",{class:"whitespace-nowrap"},"API Keys",-1))],2)]),_:1})])):T("",!0)]),e("button",{onClick:J,class:"group p-2 rounded hover:bg-red-500/10 transition-colors text-neutral-600 dark:text-neutral-400 hover:text-red-600 dark:hover:text-red-400 flex items-center",title:"Logout"},[w($(tu),{class:"w-5 h-5 flex-shrink-0"}),t.isCollapsed?T("",!0):(r(),o("span",qu,"Logout"))])],2)])])],2))}}),Wu={class:"warning-banner-container"},Ku={key:0,class:"warning-banner flex items-center justify-between gap-3 px-4 py-2 bg-amber-50 dark:bg-amber-900/30 border-b border-amber-200 dark:border-amber-800 text-amber-800 dark:text-amber-200 text-sm"},Ju={class:"flex items-center gap-2"},Yu=["onClick"],Gu=fe({__name:"WarningBanner",setup(t){const a=m([]),n=m(new Set),s=async()=>{if(localStorage.getItem("auth_token"))try{const g=await fetch(ge("/api/diagnostics"));if(g.ok){const y=await g.json();a.value=y.warnings||[]}}catch{}},l=c=>{const g=`${c.type}:${c.details?.name||c.message}`;n.value.add(g)},d=c=>{const g=`${c.type}:${c.details?.name||c.message}`;return!n.value.has(g)},i=c=>{if(c.type==="duplicate_tool_name"){const g=c.details?.sources?.join(" and ")||"multiple sources";return`Duplicate tool name "${c.details?.name}" (defined as both ${g}). This may cause unexpected behavior.`}return c.message};return Pe(()=>{s()}),(c,g)=>(r(),o("div",Wu,[(r(!0),o(he,null,we(a.value,y=>(r(),o(he,{key:`${y.type}:${y.details?.name}`},[d(y)?(r(),o("div",Ku,[e("div",Ju,[g[0]||(g[0]=e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4 flex-shrink-0",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z","clip-rule":"evenodd"})],-1)),e("span",null,S(i(y)),1)]),e("button",{onClick:v=>l(y),class:"text-amber-600 dark:text-amber-400 hover:text-amber-800 dark:hover:text-amber-200 p-1",title:"Dismiss"},[...g[1]||(g[1]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor"},[e("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1)])],8,Yu)])):T("",!0)],64))),128))]))}}),Zu={key:2,class:"flex-1 overflow-auto my-3 mr-4 border border-neutral-300 dark:border-neutral-700 rounded-xl bg-white dark:bg-neutral-900 flex flex-col"},Xu={class:"flex-1 overflow-auto"},Qu=fe({__name:"App",setup(t){ta();const a=ut(),n=m(!1),s=m(!1),l=O(()=>a.name!=="login"),d=()=>{n.value=!n.value},i=()=>{s.value=!s.value,s.value?(document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark")):(document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light"))};return Pe(()=>{const c=localStorage.getItem("theme");(c==="dark"||!c&&window.matchMedia("(prefers-color-scheme: dark)").matches)&&(s.value=!0,document.documentElement.classList.add("dark"))}),(c,g)=>(r(),o("div",{class:oe(["app-container relative flex h-screen font-sans bg-neutral-50/80 text-black dark:bg-black dark:text-white",{"is-dark":s.value}])},[l.value?(r(),N(Hu,{key:0,"is-collapsed":n.value,"is-dark":s.value,onToggleSidebar:d,onToggleTheme:i},null,8,["is-collapsed","is-dark"])):T("",!0),l.value?(r(),o("main",Zu,[w(Gu),e("div",Xu,[w($(nr))])])):(r(),N($(nr),{key:1}))],2))}}),ed=Xe(Qu,[["__scopeId","data-v-2125e5d3"]]),td={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function rd(t,a){return r(),o("svg",td,[...a[0]||(a[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10 11v6m4-6v6m5-11v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"},null,-1)])])}const ad=Te({name:"lucide-trash-2",render:rd}),od={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function nd(t,a){return r(),o("svg",od,[...a[0]||(a[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),e("path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"})],-1)])])}const ld=Te({name:"lucide-edit",render:nd}),sd={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function id(t,a){return r(),o("svg",sd,[...a[0]||(a[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),e("circle",{cx:"12",cy:"12",r:"3"})],-1)])])}const Yt=Te({name:"lucide-eye",render:id}),ud={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function dd(t,a){return r(),o("svg",ud,[...a[0]||(a[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m18 15l-6-6l-6 6"},null,-1)])])}const cd=Te({name:"lucide-chevron-up",render:dd}),pd={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function md(t,a){return r(),o("svg",pd,[...a[0]||(a[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 9l6 6l6-6"},null,-1)])])}const vd=Te({name:"lucide-chevron-down",render:md}),fd={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function hd(t,a){return r(),o("svg",fd,[...a[0]||(a[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m7 15l5 5l5-5M7 9l5-5l5 5"},null,-1)])])}const gd=Te({name:"lucide-chevrons-up-down",render:hd}),bd={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function xd(t,a){return r(),o("svg",bd,[...a[0]||(a[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M22 12h-6l-2 3h-4l-2-3H2"}),e("path",{d:"M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11"})],-1)])])}const yd=Te({name:"lucide-inbox",render:xd}),kd={key:0,class:"w-full max-w-md"},wd={class:"flex items-center justify-between p-4 border-b border-red-200 dark:border-red-900 flex-shrink-0"},_d={class:"text-xl font-bold text-red-600"},$d={class:"p-6"},Cd={class:"text-neutral-700 dark:text-neutral-300 mb-6"},Sd={class:"flex justify-end gap-3"},er=fe({__name:"ConfirmDialog",props:{modelValue:{type:Boolean},title:{default:"Confirm Action"},message:{default:"Are you sure you want to continue? You will lose any unsaved changes."},confirmText:{default:"Continue"},cancelText:{default:"Cancel"}},emits:["update:modelValue","confirm","cancel"],setup(t,{emit:a}){const n=t,s=a,l=()=>{s("update:modelValue",!1)},d=()=>{s("confirm"),l()},i=()=>{s("cancel"),l()},c=g=>{g.key==="Escape"&&n.modelValue&&i()};return xe(()=>n.modelValue,g=>{g?(document.addEventListener("keydown",c),document.body.style.overflow="hidden"):(document.removeEventListener("keydown",c),document.body.style.overflow="")}),(g,y)=>(r(),N(wt,{to:"body"},[w(et,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:j(()=>[t.modelValue?(r(),o("div",{key:0,class:"fixed inset-0 z-[60] flex items-center justify-center p-4 bg-white/80 dark:bg-black/80 backdrop-blur-sm dark:text-white",onClick:i},[w(et,{"enter-active-class":"transition-all duration-200","enter-from-class":"opacity-0 scale-95","enter-to-class":"opacity-100 scale-100","leave-active-class":"transition-all duration-200","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:j(()=>[t.modelValue?(r(),o("div",kd,[w(_t,{"offset-x":8,"offset-y":8,intensity:.35},{default:j(()=>[e("div",{class:"bg-white dark:bg-neutral-900 border border-red-400 dark:border-red-500 rounded-lg flex flex-col",onClick:y[0]||(y[0]=Oe(()=>{},["stop"]))},[e("div",wd,[e("h2",_d,S(t.title),1),w($(Hr),{icon:$(At),label:"Close dialog",variant:"danger",onClick:i},null,8,["icon"])]),e("div",$d,[e("p",Cd,S(t.message),1),e("div",Sd,[w($(De),{variant:"secondary",onClick:i},{default:j(()=>[X(S(t.cancelText),1)]),_:1}),w($(De),{variant:"danger",onClick:d},{default:j(()=>[X(S(t.confirmText),1)]),_:1})])])])]),_:1})])):T("",!0)]),_:1})])):T("",!0)]),_:1})]))}}),Td={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Id(t,a){return r(),o("svg",Td,[...a[0]||(a[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])])}const zd=Te({name:"lucide-chevron-right",render:Id}),Md={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Vd(t,a){return r(),o("svg",Md,[...a[0]||(a[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m11 17l-5-5l5-5m7 10l-5-5l5-5"},null,-1)])])}const Ed=Te({name:"lucide-chevrons-left",render:Vd}),Ld={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Pd(t,a){return r(),o("svg",Ld,[...a[0]||(a[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 17l5-5l-5-5m7 10l5-5l-5-5"},null,-1)])])}const Ad=Te({name:"lucide-chevrons-right",render:Pd}),jd={key:0,class:"flex flex-wrap items-center justify-between gap-4 px-4 py-2.5 text-sm bg-neutral-50 dark:bg-neutral-800/50 border-t border-neutral-300 dark:border-neutral-700"},Dd={class:"text-neutral-500 dark:text-neutral-400 text-xs font-medium"},Rd={class:"text-neutral-700 dark:text-neutral-300"},Od={class:"text-neutral-700 dark:text-neutral-300"},Ud={class:"text-neutral-700 dark:text-neutral-300"},Bd={class:"flex items-center gap-0.5"},Fd=["disabled"],Nd=["disabled"],qd={class:"flex items-center gap-0.5 mx-1"},Hd={key:0,class:"px-2 text-neutral-400 dark:text-neutral-500 text-xs"},Wd=["onClick"],Kd=["disabled"],Jd=["disabled"],Yd={class:"flex items-center gap-2"},Gd=["value"],Zd=["value"],Xd=fe({__name:"DataTablePagination",props:{page:{},pageSize:{},totalItems:{},pageSizeOptions:{default:()=>[10,25,50,100]}},emits:["update:page","update:pageSize"],setup(t,{emit:a}){const n=t,s=a,l=O(()=>Math.ceil(n.totalItems/n.pageSize)),d=O(()=>n.totalItems===0?0:(n.page-1)*n.pageSize+1),i=O(()=>Math.min(n.page*n.pageSize,n.totalItems)),c=O(()=>n.page>1),g=O(()=>n.page<l.value),y=O(()=>{const x=[],p=l.value,k=n.page;if(p<=7)for(let M=1;M<=p;M++)x.push(M);else{x.push(1),k>3&&x.push("...");const M=Math.max(2,k-1),R=Math.min(p-1,k+1);for(let W=M;W<=R;W++)x.includes(W)||x.push(W);k<p-2&&x.push("..."),x.includes(p)||x.push(p)}return x}),v=x=>{x>=1&&x<=l.value&&s("update:page",x)},f=()=>v(1),h=()=>v(n.page-1),_=()=>v(n.page+1),b=()=>v(l.value),u=x=>{const p=x.target;s("update:pageSize",parseInt(p.value,10)),s("update:page",1)};return(x,p)=>t.totalItems>0?(r(),o("div",jd,[e("div",Dd,[p[0]||(p[0]=X(" Showing ",-1)),e("span",Rd,S(d.value),1),p[1]||(p[1]=X(" to ",-1)),e("span",Od,S(i.value),1),p[2]||(p[2]=X(" of ",-1)),e("span",Ud,S(t.totalItems),1)]),e("div",Bd,[e("button",{type:"button",onClick:f,disabled:!c.value,class:"p-1.5 rounded-md transition-all duration-150 hover:bg-neutral-200 dark:hover:bg-neutral-700 disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent",title:"First page"},[w($(Ed),{class:"w-4 h-4 text-neutral-500 dark:text-neutral-400"})],8,Fd),e("button",{type:"button",onClick:h,disabled:!c.value,class:"p-1.5 rounded-md transition-all duration-150 hover:bg-neutral-200 dark:hover:bg-neutral-700 disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent",title:"Previous page"},[w($(Zr),{class:"w-4 h-4 text-neutral-500 dark:text-neutral-400"})],8,Nd),e("div",qd,[(r(!0),o(he,null,we(y.value,(k,M)=>(r(),o(he,{key:M},[k==="..."?(r(),o("span",Hd," ... ")):(r(),o("button",{key:1,type:"button",onClick:R=>v(k),class:oe(["min-w-[1.75rem] px-2 py-1 rounded-md text-xs font-medium transition-all duration-150",k===t.page?"bg-accent-600 text-white shadow-sm":"text-neutral-600 dark:text-neutral-400 hover:bg-neutral-200 dark:hover:bg-neutral-700 hover:text-neutral-900 dark:hover:text-neutral-200"])},S(k),11,Wd))],64))),128))]),e("button",{type:"button",onClick:_,disabled:!g.value,class:"p-1.5 rounded-md transition-all duration-150 hover:bg-neutral-200 dark:hover:bg-neutral-700 disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent",title:"Next page"},[w($(zd),{class:"w-4 h-4 text-neutral-500 dark:text-neutral-400"})],8,Kd),e("button",{type:"button",onClick:b,disabled:!g.value,class:"p-1.5 rounded-md transition-all duration-150 hover:bg-neutral-200 dark:hover:bg-neutral-700 disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent",title:"Last page"},[w($(Ad),{class:"w-4 h-4 text-neutral-500 dark:text-neutral-400"})],8,Jd)]),e("div",Yd,[e("select",{value:t.pageSize,onChange:u,class:"px-2 py-1 rounded-md border border-neutral-200 dark:border-neutral-700 bg-white dark:bg-neutral-800 text-xs font-medium text-neutral-700 dark:text-neutral-300 focus:outline-none focus:ring-2 focus:ring-accent-500/30 focus:border-accent-500 dark:focus:border-accent-400 cursor-pointer transition-all"},[(r(!0),o(he,null,we(t.pageSizeOptions,k=>(r(),o("option",{key:k,value:k},S(k),9,Zd))),128))],40,Gd),p[3]||(p[3]=e("span",{class:"text-neutral-500 dark:text-neutral-400 text-xs"},"per page",-1))])])):T("",!0)}}),Qd={class:"w-full"},ec={key:0,class:"flex flex-wrap items-start justify-between gap-4 mb-5"},tc={class:"flex items-center gap-3"},rc={class:"flex items-center gap-2"},ac={key:0,class:"text-xl font-bold tracking-tight"},oc={key:1,class:"text-xs font-mono text-neutral-400 dark:text-neutral-500"},nc={key:0,class:"text-sm text-neutral-500 dark:text-neutral-400 mt-0.5"},lc={key:0,class:"flex items-center gap-2"},sc={key:1,class:"mb-4"},ic={class:"flex flex-wrap items-center gap-3"},uc={key:0,class:"flex-1 min-w-[200px] max-w-md"},dc={key:2,class:"flex items-center gap-2 ml-auto"},cc={class:"text-sm text-neutral-500 dark:text-neutral-400 font-medium"},pc={class:"flex items-center gap-1.5"},mc=["onClick"],vc={class:"rounded-xl border border-neutral-300 dark:border-neutral-700 overflow-hidden bg-white dark:bg-transparent"},fc={class:"overflow-x-auto"},hc={class:"w-full"},gc={class:"bg-neutral-50 dark:bg-neutral-800/50 border-b border-neutral-300 dark:border-neutral-700"},bc={key:0,class:"px-4 py-2.5 w-12"},xc={class:"flex items-center justify-center"},yc=["checked","indeterminate"],kc=["onClick"],wc={key:1,class:"px-4 py-2.5 text-right font-medium text-xs uppercase tracking-wide text-neutral-500 dark:text-neutral-400 w-24"},_c={class:"divide-y divide-neutral-200 dark:divide-neutral-800"},$c={key:0},Cc=["colspan"],Sc={class:"flex flex-col items-center justify-center gap-3 text-neutral-400"},Tc={key:1},Ic=["colspan"],zc={class:"flex flex-col items-center justify-center gap-3 text-neutral-400"},Mc={class:"w-12 h-12 rounded-full bg-neutral-100 dark:bg-neutral-800 flex items-center justify-center"},Vc={class:"text-sm"},Ec=["onClick"],Lc={key:0,class:"absolute left-0 top-0 bottom-0 w-0.5 bg-accent-500"},Pc={class:"flex items-center justify-center"},Ac=["checked","onChange"],jc=["innerHTML"],Dc={class:"inline-flex gap-0.5"},Rc=["disabled","onClick","title"],Oc=["disabled","onClick","title"],ot=fe({__name:"DataTable",props:{columns:{},data:{},actions:{},emptyMessage:{default:"No data available"},loading:{type:Boolean,default:!1},title:{},description:{},primaryAction:{},sortable:{type:Boolean,default:!1},sortKey:{},sortDirection:{default:"asc"},searchable:{type:Boolean,default:!1},searchQuery:{default:""},searchPlaceholder:{default:"Search..."},paginated:{type:Boolean,default:!1},page:{default:1},pageSize:{default:10},totalItems:{default:0},pageSizeOptions:{default:()=>[10,25,50,100]},selectable:{type:Boolean,default:!1},selectedRows:{default:()=>[]},rowKey:{default:"id"},bulkActions:{default:()=>[]}},emits:["update:sortKey","update:sortDirection","sort","update:searchQuery","search","update:page","update:pageSize","page-change","update:selectedRows","selection-change","row-click"],setup(t,{emit:a}){const n=t,s=a,l=m(!1),d=m(""),i=m(null),c=z=>{if(typeof z!="string")return z;switch(z){case"edit":return ld;case"delete":return ad;case"view":return Yt;default:return null}},g=(z,K)=>{const ie=z[K.key];return K.formatter?K.formatter(ie,z):ie??"-"},y=z=>{switch(z){case"center":return"text-center";case"right":return"text-right";default:return"text-left"}},v=(z,K)=>K.cellClass?typeof K.cellClass=="function"?K.cellClass(z):K.cellClass:"",f=async(z,K)=>{if(z.confirm){const ie=typeof z.confirmMessage=="function"?z.confirmMessage(K):z.confirmMessage||`Are you sure you want to ${z.label.toLowerCase()}?`;d.value=ie,i.value=async()=>{await z.handler(K)},l.value=!0}else await z.handler(K)},h=async()=>{i.value&&(await i.value(),i.value=null),l.value=!1},_=()=>{i.value=null,l.value=!1},b=(z,K)=>z.visible===void 0?!0:typeof z.visible=="function"?z.visible(K):z.visible,u=(z,K)=>z.disabled===void 0?!1:typeof z.disabled=="function"?z.disabled(K):z.disabled,x=m(null),p=m("asc"),k=O(()=>n.sortKey??x.value),M=O(()=>n.sortKey!==void 0?n.sortDirection:p.value),R=z=>n.sortable&&z.sortable===!0,W=z=>{if(!R(z))return;const K=z.key;let ie="asc";k.value===K&&(ie=M.value==="asc"?"desc":"asc"),x.value=K,p.value=ie,s("update:sortKey",K),s("update:sortDirection",ie),s("sort",{key:K,direction:ie})},Z=z=>k.value!==z.key?gd:M.value==="asc"?cd:vd,V=O(()=>{if(!k.value||!n.sortable)return C.value;const z=k.value,K=M.value;return[...C.value].sort((ie,D)=>{const se=ie[z],G=D[z];if(se==null&&G==null)return 0;if(se==null)return K==="asc"?1:-1;if(G==null)return K==="asc"?-1:1;let ye=0;return typeof se=="string"&&typeof G=="string"?ye=se.localeCompare(G,void 0,{sensitivity:"base"}):typeof se=="number"&&typeof G=="number"?ye=se-G:ye=String(se).localeCompare(String(G)),K==="asc"?ye:-ye})}),P=m(n.searchQuery),J=m({}),Q=Lr(z=>{s("update:searchQuery",z),s("search",z)},300),le=z=>{P.value=z,Q(z)},me=()=>{P.value="",s("update:searchQuery",""),s("search","")},ee=O(()=>n.columns.filter(z=>z.filterable===!0).map(z=>{const K=new Map;n.data.forEach(D=>{const se=D[z.key];if(se!=null){const G=z.formatter?z.formatter(se,D):String(se);if(!K.has(G)){const ye=z.filterIcon?z.filterIcon(se,D):void 0;K.set(G,{value:G,icon:ye})}}});const ie=Array.from(K.entries()).sort((D,se)=>D[0].localeCompare(se[0]));return{key:z.key,label:z.label,options:ie.map(([D,se])=>({value:D,label:D,icon:se.icon}))}})),L=(z,K)=>{if(K===""){const{[z]:ie,...D}=J.value;J.value=D}else J.value={...J.value,[z]:K}},C=O(()=>{let z=n.data;const K=Object.entries(J.value);if(K.length>0&&(z=z.filter(ie=>K.every(([D,se])=>{const G=n.columns.find(de=>de.key===D);if(!G)return!0;const ye=ie[D];return ye==null?!1:(G.formatter?G.formatter(ye,ie):String(ye))===se}))),n.searchable&&P.value.trim()){const ie=P.value.toLowerCase().trim();z=z.filter(D=>n.columns.some(se=>{if(se.searchable===!1)return!1;const G=D[se.key];return G==null?!1:(se.formatter?se.formatter(G,D):String(G)).toLowerCase().includes(ie)}))}return z}),I=O(()=>{let z=0;return P.value&&z++,z+=Object.keys(J.value).length,z}),re=()=>{me(),J.value={}},F=z=>z[n.rowKey],B=z=>{const K=F(z);return n.selectedRows.some(ie=>ie[n.rowKey]===K)},q=O(()=>V.value.length>0&&n.selectedRows.length===V.value.length),Y=O(()=>n.selectedRows.length>0&&n.selectedRows.length<V.value.length),U=z=>{const K=F(z);let ie;B(z)?ie=n.selectedRows.filter(D=>D[n.rowKey]!==K):ie=[...n.selectedRows,z],s("update:selectedRows",ie),s("selection-change",ie)},H=()=>{const z=q.value?[]:[...V.value];s("update:selectedRows",z),s("selection-change",z)},E=async z=>{if(z.confirm){const K=z.confirmMessage||`Are you sure you want to ${z.label.toLowerCase()} ${n.selectedRows.length} item(s)?`;d.value=K,i.value=async()=>{await z.handler(n.selectedRows)},l.value=!0}else await z.handler(n.selectedRows)},ne=z=>{s("update:page",z),s("page-change",z)},A=z=>{s("update:pageSize",z)},pe=O(()=>n.title||n.description||n.primaryAction),ue=O(()=>n.actions&&n.actions.length>0),ke=O(()=>n.actions?.filter(z=>z.variant!=="danger")||[]),Ee=O(()=>n.actions?.filter(z=>z.variant==="danger")||[]),ae=O(()=>{let z=n.columns.length;return n.selectable&&z++,ue.value&&z++,z});return(z,K)=>{const ie=Be("FormKit");return r(),o("div",Qd,[pe.value?(r(),o("div",ec,[e("div",tc,[e("div",null,[e("div",rc,[t.title?(r(),o("h2",ac,S(t.title),1)):T("",!0),!t.loading&&t.data.length>0?(r(),o("span",oc,[I.value>0&&C.value.length!==t.data.length?(r(),o(he,{key:0},[X(" ("+S(C.value.length)+" of "+S(t.data.length)+") ",1)],64)):(r(),o(he,{key:1},[X(" ("+S(t.data.length)+") ",1)],64))])):T("",!0)]),t.description?(r(),o("p",nc,S(t.description),1)):T("",!0)])]),t.primaryAction?(r(),o("div",lc,[je(z.$slots,"header-actions"),w($(De),{onClick:t.primaryAction.handler},{default:j(()=>[t.primaryAction.icon?(r(),N(Ue(t.primaryAction.icon),{key:0,class:"w-4 h-4 mr-2"})):T("",!0),X(" "+S(t.primaryAction.label),1)]),_:1},8,["onClick"])])):T("",!0)])):T("",!0),t.searchable||ee.value.length>0?(r(),o("div",sc,[e("div",ic,[t.searchable?(r(),o("div",uc,[w(ie,{type:"searchInput",value:P.value,placeholder:t.searchPlaceholder,onInput:le},null,8,["value","placeholder"])])):T("",!0),(r(!0),o(he,null,we(ee.value,D=>(r(),o("div",{key:D.key,class:"min-w-[220px]"},[w(ie,{type:"selectSearch",value:J.value[D.key]||"",options:D.options,placeholder:`All ${D.label}s`,onInput:se=>L(D.key,se)},null,8,["value","options","placeholder","onInput"])]))),128)),I.value>0?(r(),o("button",{key:1,type:"button",onClick:re,class:"px-3 py-2 text-sm font-medium text-neutral-500 hover:text-neutral-700 dark:text-neutral-400 dark:hover:text-neutral-200 transition-colors"}," Clear filters ")):T("",!0),t.selectable&&t.selectedRows.length>0&&t.bulkActions.length>0?(r(),o("div",dc,[e("span",cc,S(t.selectedRows.length)+" selected ",1),e("div",pc,[(r(!0),o(he,null,we(t.bulkActions,(D,se)=>(r(),o("button",{key:se,type:"button",onClick:G=>E(D),class:oe(["inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition-all duration-150",D.variant==="danger"?"bg-red-100 text-red-700 hover:bg-red-200 dark:bg-red-900/30 dark:text-red-400 dark:hover:bg-red-900/50":"bg-neutral-100 text-neutral-700 hover:bg-neutral-200 dark:bg-neutral-800 dark:text-neutral-300 dark:hover:bg-neutral-700"])},[(r(),N(Ue(D.icon),{class:"w-4 h-4"})),X(" "+S(D.label),1)],10,mc))),128))])])):T("",!0)])])):T("",!0),je(z.$slots,"toolbar"),e("div",vc,[e("div",fc,[e("table",hc,[e("thead",gc,[e("tr",null,[t.selectable?(r(),o("th",bc,[e("div",xc,[e("input",{type:"checkbox",checked:q.value,indeterminate:Y.value,onChange:H,class:"w-4 h-4 rounded border-neutral-300 dark:border-neutral-600 text-accent-600 focus:ring-accent-500 focus:ring-offset-0 cursor-pointer transition-colors"},null,40,yc)])])):T("",!0),(r(!0),o(he,null,we(t.columns,D=>(r(),o("th",{key:D.key,class:oe(["px-4 py-2.5 font-medium text-xs uppercase tracking-wide text-neutral-500 dark:text-neutral-400",y(D.align),D.width||"",R(D)?"cursor-pointer select-none group":""]),onClick:se=>W(D)},[e("div",{class:oe(["inline-flex items-center gap-1",D.align==="right"?"flex-row-reverse":"",R(D)?"hover:text-neutral-700 dark:hover:text-neutral-200 transition-colors":""])},[e("span",null,S(D.label),1),R(D)?(r(),o("span",{key:0,class:oe(["inline-flex items-center justify-center w-5 h-5 rounded transition-all duration-150",k.value===D.key?"bg-accent-100 dark:bg-accent-900/50":"group-hover:bg-neutral-200 dark:group-hover:bg-neutral-700"])},[(r(),N(Ue(Z(D)),{class:oe(["w-3.5 h-3.5",k.value===D.key?"text-accent-600 dark:text-accent-400":"text-neutral-400 dark:text-neutral-500"])},null,8,["class"]))],2)):T("",!0)],2)],10,kc))),128)),ue.value?(r(),o("th",wc," Actions ")):T("",!0)])]),e("tbody",_c,[t.loading?(r(),o("tr",$c,[e("td",{colspan:ae.value,class:"px-4 py-16"},[je(z.$slots,"loading",{},()=>[e("div",Sc,[w(Ve,{size:"md"}),K[3]||(K[3]=e("span",{class:"text-sm"},"Loading data...",-1))])])],8,Cc)])):V.value.length===0?(r(),o("tr",Tc,[e("td",{colspan:ae.value,class:"px-4 py-16"},[je(z.$slots,"empty",{},()=>[e("div",zc,[e("div",Mc,[w($(yd),{class:"w-6 h-6"})]),e("p",Vc,S(t.emptyMessage),1),I.value>0?(r(),o("button",{key:0,onClick:re,type:"button",class:"text-xs text-accent-600 dark:text-accent-400 hover:underline font-medium"}," Clear filters ")):T("",!0)])])],8,Ic)])):(r(!0),o(he,{key:2},we(V.value,(D,se)=>(r(),o("tr",{key:D[t.rowKey]??se,class:oe(["transition-all duration-150 cursor-pointer relative",B(D)?"bg-accent-50 dark:bg-accent-950/30":"hover:bg-neutral-50 dark:hover:bg-neutral-900/50"]),onClick:G=>s("row-click",D)},[B(D)?(r(),o("div",Lc)):T("",!0),t.selectable?(r(),o("td",{key:1,class:"px-4 py-3",onClick:K[0]||(K[0]=Oe(()=>{},["stop"]))},[e("div",Pc,[e("input",{type:"checkbox",checked:B(D),onChange:G=>U(D),class:"w-4 h-4 rounded border-neutral-300 dark:border-neutral-600 text-accent-600 focus:ring-accent-500 focus:ring-offset-0 cursor-pointer transition-colors"},null,40,Ac)])])):T("",!0),(r(!0),o(he,null,we(t.columns,G=>(r(),o("td",{key:G.key,class:oe(["px-4 py-3 text-sm",y(G.align),v(D,G),B(D)?"text-accent-900 dark:text-accent-100":"text-neutral-700 dark:text-neutral-300"])},[je(z.$slots,`cell-${G.key}`,{value:D[G.key],row:D,column:G},()=>[G.html?(r(),o("span",{key:0,innerHTML:g(D,G)},null,8,jc)):(r(),o(he,{key:1},[X(S(g(D,G)),1)],64))])],2))),128)),ue.value?(r(),o("td",{key:2,class:"px-4 py-3 text-right",onClick:K[1]||(K[1]=Oe(()=>{},["stop"]))},[e("div",Dc,[(r(!0),o(he,null,we(ke.value,(G,ye)=>Ae((r(),o("button",{key:`non-delete-${ye}`,disabled:u(G,D),onClick:Se=>f(G,D),class:oe(["p-1.5 rounded-md transition-all duration-150",u(G,D)?"opacity-30 cursor-not-allowed":"text-neutral-400 hover:text-neutral-700 hover:bg-neutral-100 dark:hover:text-neutral-200 dark:hover:bg-neutral-800"]),title:G.label},[(r(),N(Ue(c(G.icon)),{class:"w-4 h-4"}))],10,Rc)),[[Ke,b(G,D)]])),128)),je(z.$slots,"extra-actions",{row:D}),(r(!0),o(he,null,we(Ee.value,(G,ye)=>Ae((r(),o("button",{key:`delete-${ye}`,disabled:u(G,D),onClick:Se=>f(G,D),class:oe(["p-1.5 rounded-md transition-all duration-150",u(G,D)?"opacity-30 cursor-not-allowed":"text-neutral-400 hover:text-red-600 hover:bg-red-50 dark:hover:text-red-400 dark:hover:bg-red-900/30"]),title:G.label},[(r(),N(Ue(c(G.icon)),{class:"w-4 h-4"}))],10,Oc)),[[Ke,b(G,D)]])),128))])])):T("",!0)],10,Ec))),128))])])]),t.paginated?(r(),N(Xd,{key:0,page:t.page,"page-size":t.pageSize,"total-items":t.totalItems,"page-size-options":t.pageSizeOptions,"onUpdate:page":ne,"onUpdate:pageSize":A},null,8,["page","page-size","total-items","page-size-options"])):T("",!0)]),w(er,{modelValue:l.value,"onUpdate:modelValue":K[2]||(K[2]=D=>l.value=D),title:"Confirm Action",message:d.value,"confirm-text":"Confirm","cancel-text":"Cancel",onConfirm:h,onCancel:_},null,8,["modelValue","message"])])}}}),Uc={},Bc={xmlns:"http://www.w3.org/2000/svg",viewBox:"-12 -12 408 408",width:"1em",height:"1em",fill:"currentColor",stroke:"currentColor","stroke-width":"24","stroke-linejoin":"round","aria-hidden":"true"};function Fc(t,a){return r(),o("svg",Bc,[...a[0]||(a[0]=[e("path",{d:"M384,171.75v9.75c-1.68,7.91-4.76,14.74-10.77,20.88l-113.42,115.85c-10.42,10.65-25.58,13.8-39.31,8.04-12.9-5.41-21.53-18.19-21.52-33.02l.03-43.8h-26.55c-32.35.02-67.19,7.63-94.92,24.63s-44.76,42.35-51.3,73.05c-1.42,6.68-5.61,11.51-12.38,12.08-6.37.54-11.26-3.83-13.86-9.7v-46.5c.42-1.2.55-2.61.71-4.61,7.99-103.74,94.18-186.48,198.25-192.75l.08-45.6c.02-14.6,8.87-27.11,21.33-32.38,13.91-5.89,29.05-2.63,39.51,8.05l112.3,114.71c6.23,6.36,9.94,13.03,11.82,21.33ZM211.97,223.41c7.34,0,13.01,5.78,13.01,12.84v56.98c.01,4.38,2.23,7.69,5.66,9.09,4.03,1.65,7.66.72,10.83-2.51l113.71-116.2c3.69-3.77,3.73-9.48.04-13.25l-113.69-116.21c-3.21-3.28-6.81-4.26-11.03-2.51-3.33,1.38-5.52,4.74-5.52,9.15l.03,56.96c0,7.8-5.62,13.53-13.58,13.54-48.85.09-95.31,19.31-130.18,53.54-26.49,26-45.26,59.26-51.99,96.82,34.96-40.83,86.25-56.16,137.95-58.21l44.76-.03Z"},null,-1)])])}const Nc=Xe(Uc,[["render",Fc]]),qc={},Hc={xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor"};function Wc(t,a){return r(),o("svg",Hc,[...a[0]||(a[0]=[e("path",{d:"M4 4h16v16H4V4zm2 2v12h4v-10h3v10h5V6H6z"},null,-1)])])}const Kc=Xe(qc,[["render",Wc]]),Jc={class:"py-1"},Yc=fe({__name:"ShareDropdown",props:{packageId:{}},emits:["download","publish"],setup(t,{emit:a}){const n=a,s=m(null),l=m(null);function d(){if(!s.value||!l.value)return;const y=s.value.getBoundingClientRect();let f=y.right-160;const h=8;f<h&&(f=h),l.value.style.top=`${y.bottom+4}px`,l.value.style.left=`${f}px`}function i(){l.value&&(l.value.matches(":popover-open")?l.value.hidePopover():(d(),l.value.showPopover()))}function c(y){l.value?.hidePopover(),n(y)}function g(){l.value?.matches(":popover-open")&&d()}return Pe(()=>{window.addEventListener("scroll",g,!0),window.addEventListener("resize",g)}),Ye(()=>{window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g)}),(y,v)=>(r(),o(he,null,[e("button",{ref_key:"triggerButton",ref:s,type:"button",onClick:i,class:"p-1.5 rounded-md transition-all duration-150 text-neutral-400 hover:text-neutral-700 hover:bg-neutral-100 dark:hover:text-neutral-200 dark:hover:bg-neutral-800",title:"Share"},[w(Nc,{class:"w-4 h-4"})],512),e("div",{ref_key:"popoverEl",ref:l,popover:"auto",class:"w-40 p-0 m-0 border-0 bg-transparent overflow-visible"},[w($(jt),{width:"w-40",shadow:{offsetX:4,offsetY:4,intensity:.3}},{default:j(()=>[e("div",Jc,[w($(mr),{onClick:v[0]||(v[0]=f=>c("download"))},{default:j(()=>[w($(Ea),{class:"w-4 h-4 text-neutral-500"}),v[2]||(v[2]=e("span",null,"Download",-1))]),_:1}),w($(mr),{onClick:v[1]||(v[1]=f=>c("publish"))},{default:j(()=>[w(Kc,{class:"w-4 h-4 text-neutral-500"}),v[3]||(v[3]=e("span",null,"Publish",-1))]),_:1})])]),_:1})],512)],64))}}),Gc={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Zc(t,a){return r(),o("svg",Gc,[...a[0]||(a[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73zm1 .27V12"}),e("path",{d:"M3.29 7L12 12l8.71-5M7.5 4.27l9 5.15"})],-1)])])}const hr=Te({name:"lucide-package",render:Zc}),Xc={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Qc(t,a){return r(),o("svg",Xc,[...a[0]||(a[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M12 22v-9m3.17-10.79a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.66 1.66 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z"}),e("path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13"}),e("path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.64 1.64 0 0 0 1.63 0z"})],-1)])])}const e0=Te({name:"lucide-package-open",render:Qc}),t0={class:"flex items-center gap-2"},r0=fe({__name:"AgentsDataTable",props:{title:{},description:{},primaryAction:{},readonly:{type:Boolean,default:!1}},emits:["add","edit","delete","pack","unpack","publish"],setup(t,{expose:a,emit:n}){const s=t,l=n,d=m([]),i=m(!1),c=[{key:"title",label:"Title",width:"w-1/5",sortable:!0},{key:"type",label:"Type",width:"w-1/12",sortable:!0,formatter:u=>u==="dual_ai"?"Dual AI":"AI+Human"},{key:"side_a_agent_prompt_name",label:"Side A",width:"w-1/5",formatter:u=>u||"-"},{key:"side_b_agent_prompt_name",label:"Side B",width:"w-1/5",formatter:u=>u||"Human"},{key:"created_at",label:"Created",width:"w-1/6",sortable:!0,searchable:!1,formatter:u=>u?new Date(u*1e3).toLocaleDateString():"-"}],g=[{icon:hr,label:"Pack",handler:u=>l("pack",u),visible:u=>!u.packed},{icon:e0,label:"Unpack",handler:u=>l("unpack",u),visible:u=>!!u.packed},{icon:"edit",label:"Edit",handler:u=>l("edit",u),visible:u=>!u.packed},{icon:"delete",label:"Delete",handler:async u=>{await f(u)},confirm:!0,confirmMessage:"Are you sure you want to delete this agent?",variant:"danger",visible:u=>!u.packed},{icon:"delete",label:"Delete Package",handler:async u=>{await h(u)},confirm:!0,confirmMessage:"Are you sure you want to delete this packed agent and all its contents?",variant:"danger",visible:u=>!!u.packed&&u.source==="local"}],y=O(()=>s.readonly?g.filter(u=>u.variant!=="danger"):g),v=async()=>{i.value=!0;try{const u=await fetch(ge("/api/agents"));if(u.ok){const x=await u.json();d.value=x.agents||[]}}catch(u){console.error("Error fetching agents:",u)}finally{i.value=!1}},f=async u=>{try{const x=await fetch(ge(`/api/agents/${encodeURIComponent(u.id)}`),{method:"DELETE"});if(x.ok)await v();else{const p=await x.json();alert(p.error||"Failed to delete agent")}}catch(x){console.error("Error deleting agent:",x),alert("Failed to delete agent")}},h=async u=>{if(u.packageId)try{const x=await fetch(ge(`/api/pack/${encodeURIComponent(u.packageId)}`),{method:"DELETE"});if(x.ok)await v();else{const p=await x.json();alert(p.error||"Failed to delete packed agent")}}catch(x){console.error("Error deleting packed agent:",x),alert("Failed to delete packed agent")}},_=u=>{u.packageId&&(window.location.href=ge(`/api/pack/${encodeURIComponent(u.packageId)}/download`))},b=u=>{l("publish",u)};return Pe(()=>{v()}),a({refresh:v}),(u,x)=>(r(),o("div",null,[w(ot,{title:t.title,description:t.description,"primary-action":t.primaryAction,columns:c,data:d.value,actions:y.value,loading:i.value,sortable:"",searchable:"","search-placeholder":"Search agents...","empty-message":"No agents available. Create your first agent to get started.",onRowClick:x[0]||(x[0]=p=>{p.packed||l("edit",p)})},La({"cell-title":j(({row:p})=>[e("div",t0,[p.packed?(r(),N($(hr),{key:0,class:"w-4 h-4 text-blue-500 flex-shrink-0",title:`Packed agent from ${p.packageId}`},null,8,["title"])):T("",!0),e("span",null,S(p.title),1)])]),_:2},[t.readonly?void 0:{name:"extra-actions",fn:j(({row:p})=>[p.packed?(r(),N(Yc,{key:0,"package-id":p.packageId,onDownload:k=>_(p),onPublish:k=>b(p)},null,8,["package-id","onDownload","onPublish"])):T("",!0)]),key:"0"}]),1032,["title","description","primary-action","data","actions","loading"])]))}}),a0={class:"flex items-center justify-between p-4 border-b border-neutral-200 dark:border-neutral-700 flex-shrink-0"},o0={class:"text-xl font-bold"},n0={key:0,class:"p-6 border-t border-neutral-200 dark:border-neutral-700 flex-shrink-0"},He=fe({__name:"Modal",props:{modelValue:{type:Boolean},title:{},width:{default:"max-w-lg"},minHeight:{default:"min-h-[24rem]"},hasChanges:{type:Boolean,default:void 0},contentPadding:{type:Boolean,default:!0}},emits:["update:modelValue","close"],setup(t,{emit:a}){const n=t,s=a,l=m(),d=m(!1),i=m(new Map),c=()=>l.value&&(l.value.querySelector("input")||l.value.querySelector("textarea")||l.value.querySelector("select")||l.value.querySelector("[contenteditable]")||l.value.querySelector(".monaco-editor")),g=()=>{if(!l.value)return;l.value.querySelectorAll(".monaco-editor-container").forEach(W=>{const Z=W.__monacoEditor;if(Z&&typeof Z.getValue=="function"){const V=Z.getValue();i.value.set(W,V)}})},y=()=>{if(!l.value)return!1;const R=l.value.querySelectorAll(".monaco-editor-container");for(const W of R){const Z=W.__monacoEditor;if(Z&&typeof Z.getValue=="function"){const V=Z.getValue(),P=i.value.get(W);if(P===void 0||(Z.getRawOptions?.()||{}).readOnly===!0)continue;if(V!==P)return!0}}return!1},v=R=>{const W=R;return W.type==="checkbox"||W.type==="radio"?W.checked!==W.defaultChecked:(W.tagName==="SELECT",W.value!==W.defaultValue)},f=()=>{if(n.hasChanges!==void 0)return n.hasChanges;if(!l.value)return!1;if(y())return!0;const R=l.value.querySelectorAll("input, textarea, select");for(const W of R)if(v(W))return!0;return!1},h=()=>{c()&&f()?d.value=!0:_()},_=()=>{s("update:modelValue",!1),s("close")},b=()=>{d.value=!1,_()},u=()=>{d.value=!1},x=R=>{R.key==="Escape"&&n.modelValue&&(c()||_())};xe(()=>n.modelValue,async R=>{R?(document.addEventListener("keydown",x),document.body.style.overflow="hidden",await Le(),setTimeout(()=>{g()},100)):(document.removeEventListener("keydown",x),document.body.style.overflow="",i.value.clear())});const p=m(!1),k=R=>{p.value=R.target===R.currentTarget},M=R=>{R.target===R.currentTarget&&p.value&&(c()||_()),p.value=!1};return(R,W)=>(r(),N(wt,{to:"body"},[w(et,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:j(()=>[t.modelValue?(r(),o("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-white/80 dark:bg-black/80 backdrop-blur-sm dark:text-white",onMousedown:k,onClick:M},[w(et,{"enter-active-class":"transition-all duration-200","enter-from-class":"opacity-0 scale-95","enter-to-class":"opacity-100 scale-100","leave-active-class":"transition-all duration-200","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:j(()=>[t.modelValue?(r(),o("div",{key:0,class:oe(["w-full",t.width,"max-h-[85vh] flex flex-col"])},[w(_t,{"offset-x":8,"offset-y":8,intensity:.35},{default:j(()=>[e("div",{ref_key:"modalRef",ref:l,class:oe(["bg-white dark:bg-neutral-900 border border-neutral-300 dark:border-neutral-600 rounded-lg flex flex-col max-h-[85vh]",t.minHeight])},[e("div",a0,[e("h2",o0,S(t.title),1),w($(Hr),{icon:$(At),label:"Close modal",variant:"ghost",onClick:h},null,8,["icon"])]),e("div",{class:oe(["flex-1 min-h-0",t.contentPadding?"overflow-y-auto p-6":"overflow-hidden flex flex-col"])},[je(R.$slots,"default")],2),R.$slots.footer?(r(),o("div",n0,[je(R.$slots,"footer")])):T("",!0)],2)]),_:3})],2)):T("",!0)]),_:3})],32)):T("",!0)]),_:3}),w(er,{modelValue:d.value,"onUpdate:modelValue":W[0]||(W[0]=Z=>d.value=Z),title:"Unsaved Changes",message:"You have unsaved changes that will be lost. Are you sure you want to close?","confirm-text":"Close Anyway","cancel-text":"Keep Editing",onConfirm:b,onCancel:u},null,8,["modelValue"])]))}}),l0=["id"],s0={class:"px-5 py-3 border-b border-neutral-100 dark:border-neutral-800"},i0={class:"text-sm font-semibold text-neutral-900 dark:text-neutral-100 flex items-center gap-2"},u0={class:"p-5"},d0={key:0,class:"px-5 py-3 border-t border-neutral-100 dark:border-neutral-800 bg-neutral-50 dark:bg-neutral-800/50"},rt=fe({__name:"ModalCard",props:{id:{},title:{},icon:{}},setup(t){return(a,n)=>(r(),o("section",{id:t.id,class:"bg-white dark:bg-neutral-900 rounded-lg border border-neutral-200 dark:border-neutral-700 overflow-hidden"},[e("div",s0,[e("h3",i0,[t.icon?(r(),N(Ue(t.icon),{key:0,class:"w-4 h-4 text-neutral-500"})):T("",!0),X(" "+S(t.title),1)])]),e("div",u0,[je(a.$slots,"default")]),a.$slots.footer?(r(),o("div",d0,[je(a.$slots,"footer")])):T("",!0)],8,l0))}}),c0={class:"flex flex-col gap-1 px-2"},p0=["onClick"],m0={class:"whitespace-nowrap overflow-hidden text-ellipsis"},oa=fe({__name:"ModalTabs",props:{tabs:{},activeTab:{}},emits:["select"],setup(t,{emit:a}){const n=a;return(s,l)=>(r(),o("div",c0,[(r(!0),o(he,null,we(t.tabs,d=>(r(),o("button",{key:d.id,type:"button",onClick:Oe(i=>n("select",d.id),["prevent"]),class:oe(["flex items-center gap-3 px-3 py-2.5 rounded text-sm font-medium transition-all w-full text-left",t.activeTab===d.id?"bg-black text-white dark:bg-white dark:text-black":"text-neutral-600 dark:text-neutral-400 hover:bg-black/5 dark:hover:bg-white/10"])},[(r(),N(Ue(d.icon),{class:"w-4 h-4 flex-shrink-0"})),e("span",m0,S(d.label),1)],10,p0))),128))]))}}),v0={class:"text-sm font-semibold text-neutral-900 dark:text-neutral-100 pl-3 border-l-2 border-neutral-300 dark:border-neutral-600"},xt=fe({__name:"ModalSubHeader",props:{title:{}},setup(t){return(a,n)=>(r(),o("h4",v0,S(t.title),1))}});function na(t,a){const n=m(a[0]),s=()=>{const d=t.value;if(!d)return;const i=a.filter(f=>document.getElementById(`section-${f}`)!==null);if(i.length===0)return;if(d.scrollHeight-d.scrollTop-d.clientHeight<50){n.value=i[i.length-1];return}const g=d.getBoundingClientRect(),y=g.top+g.height*.3;let v=i[0];for(const f of i)document.getElementById(`section-${f}`).getBoundingClientRect().top<=y&&(v=f);n.value=v},l=d=>{const i=document.getElementById(`section-${d}`);if(i&&t.value){const c=t.value.getBoundingClientRect().top,g=i.getBoundingClientRect().top,y=t.value.scrollTop+(g-c);t.value.scrollTo({top:y,behavior:"smooth"})}};return xe(t,(d,i)=>{i&&i.removeEventListener("scroll",s),d&&(d.addEventListener("scroll",s),s())}),Pr(()=>{t.value?.removeEventListener("scroll",s)}),{activeTab:n,scrollToSection:l}}const f0={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function h0(t,a){return r(),o("svg",f0,[...a[0]||(a[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),e("path",{d:"M14 2v4a2 2 0 0 0 2 2h4M10 9H8m8 4H8m8 4H8"})],-1)])])}const Pt=Te({name:"lucide-file-text",render:h0}),g0={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function b0(t,a){return r(),o("svg",g0,[...a[0]||(a[0]=[e("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[e("path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}),e("circle",{cx:"12",cy:"7",r:"4"})],-1)])])}const gr=Te({name:"lucide-user",render:b0}),x0={key:0,class:"min-h-[500px] flex items-center justify-center"},y0={class:"flex flex-1 min-h-0"},k0={class:"w-44 flex-shrink-0 border-r border-neutral-200 dark:border-neutral-700 py-4"},w0={class:"space-y-4"},_0={class:"space-y-5"},$0={class:"grid grid-cols-2 gap-4"},C0={key:0},S0={key:1},T0={key:2},I0={class:"space-y-5"},z0={class:"grid grid-cols-2 gap-4"},M0={class:"space-y-4 pt-4 border-t border-neutral-100 dark:border-neutral-800"},V0={key:0,class:"ml-6 mt-3 space-y-3"},E0={key:2},L0={class:"grid grid-cols-2 gap-4 pt-4 border-t border-neutral-100 dark:border-neutral-800"},P0={class:"space-y-5"},A0={class:"grid grid-cols-2 gap-4"},j0={class:"space-y-4 pt-4 border-t border-neutral-100 dark:border-neutral-800"},D0={key:0,class:"ml-6 mt-3 space-y-3"},R0={key:2},O0={class:"grid grid-cols-2 gap-4 pt-4 border-t border-neutral-100 dark:border-neutral-800"},U0={class:"space-y-3"},B0={key:0,class:"text-xs text-neutral-500"},F0={class:"flex justify-between"},N0=fe({__name:"AgentModal",props:{modelValue:{type:Boolean},editAgent:{},mode:{},apiError:{},readonly:{type:Boolean,default:!1}},emits:["update:modelValue","save"],setup(t,{expose:a,emit:n}){const s=t,l=n,d=O(()=>s.mode==="edit"),i=m(!1),c=m(null),g=["basics","side-a","side-b","env"],{activeTab:y,scrollToSection:v}=na(c,g),f=O(()=>{const _e=[{id:"basics",label:"Basics",icon:Pt},{id:"side-a",label:"Side A",icon:mt},{id:"side-b",label:"Side B",icon:x.value==="ai_human"?gr:mt}];return(K.value.length>0||Object.keys(ie.value).length>0)&&_e.push({id:"env",label:"Environment",icon:Kt}),_e}),h=m(""),_=m(""),b=m(""),u=m(""),x=m("dual_ai"),p=m(!1),k=m(""),M=m(""),R=m(null),W=m(""),Z=m(""),V=m(""),P=m(""),J=m(!0),Q=m(!1),le=m(""),me=m(""),ee=m(""),L=m(""),C=m(!1),I=m(null),re=m(""),F=m(""),B=m(""),q=m(""),Y=m(""),U=m(""),H=m(!0),E=m(!1),ne=m(""),A=m(""),pe=m(""),ue=m(""),ke=m(null),Ee=m(""),ae=m(""),z=m(""),K=m([]),ie=m({}),D=m(!1),{data:se,execute:G}=Ne(ge("/api/prompts"),{immediate:!1}).json(),{data:ye,execute:Se}=Ne(ge("/api/tools?schema=true"),{immediate:!1}).json(),de=m(null),ce=m(!1),Ie=m(null),ve=m(!1),be=m(!1),Me=O(()=>{if(!se.value)return[{value:"",label:"Select a prompt..."}];const _e=se.value?.prompts||[];return[{value:"",label:"None"},..._e.map(te=>({value:te.id,label:te.name}))]}),We=_e=>ye.value?ye.value[_e]:null,Ct=O(()=>!de.value||!de.value.tools?[{value:"",label:"None"}]:[{value:"",label:"None"},...de.value.tools.map(_e=>{const te=typeof _e=="string"?_e:_e.name;return{value:te,label:te}})]),ar=O(()=>!Ie.value||!Ie.value.tools?[{value:"",label:"None"}]:[{value:"",label:"None"},...Ie.value.tools.map(_e=>{const te=typeof _e=="string"?_e:_e.name;return{value:te,label:te}})]),ma=O(()=>{if(!le.value)return[];const _e=We(le.value);return!_e||!_e.schema||!_e.schema.properties?[]:Object.keys(_e.schema.properties).map(te=>({value:te,label:te}))}),va=O(()=>{if(!ne.value)return[];const _e=We(ne.value);return!_e||!_e.schema||!_e.schema.properties?[]:Object.keys(_e.schema.properties).map(te=>({value:te,label:te}))}),Ut=async()=>{const _e=[V.value,Y.value].filter(Boolean);if(_e.length===0){K.value=[];return}D.value=!0;try{const te=[],$e=new Set;for(const Ce of _e){const qe=await Je(`/prompts/${encodeURIComponent(Ce)}/tenvs`);if(qe.ok){const Bt=await qe.json();for(const at of Bt.tenvs||[])$e.has(at.name)||($e.add(at.name),te.push({name:at.name,value:at.value,required:at.required,description:at.description,source:at.source}))}}K.value=te}catch(te){console.error("Error fetching tenvs from prompts:",te),K.value=[]}finally{D.value=!1}},or=m(null),fa=_e=>{or.value=_e};a({formNode:or});const ha=[{value:"dual_ai",label:"AI + AI (Subagent)"},{value:"ai_human",label:"AI + Human"}],ga=_e=>{let te=_e.toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_]/g,"");return!te.endsWith("_agent")&&te.length>0&&(te=te+"_agent"),te},ba=_e=>!_e||_e==="_agent"?(b.value="Name is required",!1):/^[a-z][a-z0-9_]*_agent$/.test(_e)?(b.value="",!0):(b.value="Name must start with a letter",!1),St=()=>{_.value="",h.value="",b.value="",u.value="",x.value="dual_ai",p.value=!1,k.value="",M.value="",R.value=null,W.value="",Z.value="",V.value="",P.value="",J.value=!0,Q.value=!1,le.value="",me.value="",ee.value="",L.value="",C.value=!1,I.value=null,re.value="",F.value="",B.value="",de.value=null,q.value="",Y.value="",U.value="",H.value=!0,E.value=!1,ne.value="",A.value="",pe.value="",ue.value="",ke.value=null,Ee.value="",ae.value="",z.value="",Ie.value=null,K.value=[],ie.value={}},xa=async()=>{if(s.editAgent?.id){i.value=!0,be.value=!0;try{const _e=await fetch(ge(`/api/agents/${encodeURIComponent(s.editAgent.id)}`));if(_e.ok){const te=await _e.json(),$e=te.agent||te;_.value=$e.name||"",h.value=$e.name||"",u.value=$e.title||"",x.value=$e.type||"dual_ai",p.value=$e.expose_as_tool||!1,k.value=$e.tool_description||"",R.value=$e.max_session_turns;const Ce=$e.side_a_stop_tool||"",qe=$e.side_a_stop_tool_response_property||"",Bt=$e.side_b_stop_tool||"",at=$e.side_b_stop_tool_response_property||"",wa=$e.side_a_end_conversation_tool||"",_a=$e.side_b_end_conversation_tool||"";Z.value=$e.side_a_label||"",q.value=$e.side_b_label||"",V.value=$e.side_a_agent_prompt||"",Y.value=$e.side_b_agent_prompt||"",J.value=!!$e.side_a_stop_on_response,Q.value=!!$e.side_a_stop_tool,C.value=!!$e.side_a_manual_stop_condition,I.value=$e.side_a_max_steps,H.value=!!$e.side_b_stop_on_response,E.value=!!$e.side_b_stop_tool,ke.value=$e.side_b_max_steps,await Le(),le.value=Ce,ee.value=qe,ne.value=Bt,pe.value=at,F.value=wa,ae.value=_a,$e.tenvs&&typeof $e.tenvs=="object"&&(ie.value=$e.tenvs),await Ut()}}catch(_e){console.error("Error loading agent data:",_e)}finally{i.value=!1,be.value=!1}}},ya=async()=>{b.value="",W.value="",P.value="",me.value="",L.value="",re.value="",B.value="",U.value="",A.value="",ue.value="",Ee.value="",z.value="";let _e=!1;ba(_.value)||(_e=!0);const te=_.value;x.value==="dual_ai"&&R.value!==null&&R.value!==void 0&&R.value<=0&&(W.value="Max session turns must be a positive number",_e=!0),V.value||(P.value="Please select an agent prompt",_e=!0);const $e=J.value||le.value,Ce=x.value==="ai_human"&&C.value;if(!$e&&!Ce&&(P.value="At least one stop condition is required (or check manual stop condition for ai_human agents)",_e=!0),le.value&&!ee.value&&(L.value="Response property required when using stop tool",_e=!0),I.value!==null&&I.value<=0&&(re.value="Max steps must be a positive number",_e=!0),x.value==="dual_ai"&&!F.value&&!ae.value&&(B.value="At least one side must have an end conversation tool",z.value="At least one side must have an end conversation tool",_e=!0),x.value==="dual_ai"&&(Y.value||(U.value="Please select an agent prompt",_e=!0),ne.value&&!pe.value&&(ue.value="Response property required when using stop tool",_e=!0),ke.value!==null&&ke.value<=0&&(Ee.value="Max steps must be a positive number",_e=!0)),_e)return;const qe={name:te,title:u.value||null,type:x.value,expose_as_tool:p.value,tool_description:p.value?k.value:null,max_session_turns:x.value==="dual_ai"?R.value:null,side_a_label:Z.value||null,side_a_agent_prompt:V.value,side_a_stop_on_response:J.value,side_a_stop_tool:le.value||null,side_a_stop_tool_response_property:ee.value||null,side_a_manual_stop_condition:C.value,side_a_max_steps:I.value,side_a_end_conversation_tool:F.value||null};x.value==="dual_ai"&&(qe.side_b_label=q.value||null,qe.side_b_agent_prompt=Y.value,qe.side_b_stop_on_response=H.value,qe.side_b_stop_tool=ne.value||null,qe.side_b_stop_tool_response_property=pe.value||null,qe.side_b_max_steps=ke.value,qe.side_b_end_conversation_tool=ae.value||null),Object.keys(ie.value).length>0&&(qe.tenvs=ie.value),d.value&&s.editAgent?.id&&(qe.id=s.editAgent.id),l("save",qe)},ka=()=>{St(),l("update:modelValue",!1)};return xe(V,async _e=>{if(be.value||(le.value="",ee.value=""),!_e){de.value=null;return}ce.value=!0;try{const te=await fetch(ge(`/api/prompts/${encodeURIComponent(_e)}`));te.ok&&(de.value=await te.json())}catch(te){console.error("Error fetching Side A prompt:",te)}finally{ce.value=!1}be.value||await Ut()}),xe(Y,async _e=>{if(be.value||(ne.value="",pe.value=""),!_e){Ie.value=null;return}ve.value=!0;try{const te=await fetch(ge(`/api/prompts/${encodeURIComponent(_e)}`));te.ok&&(Ie.value=await te.json())}catch(te){console.error("Error fetching Side B prompt:",te)}finally{ve.value=!1}be.value||await Ut()}),xe(Q,_e=>{_e||(le.value="",ee.value="")}),xe(E,_e=>{_e||(ne.value="",pe.value="")}),xe(()=>s.modelValue,async _e=>{_e?(await Promise.all([G(),Se()]),d.value?(St(),await xa()):St()):St()}),(_e,te)=>{const $e=Be("FormKit");return r(),N(He,{"model-value":t.modelValue,"onUpdate:modelValue":te[26]||(te[26]=Ce=>_e.$emit("update:modelValue",Ce)),title:d.value?"Edit Agent":"Create Agent",width:"max-w-5xl","content-padding":!1},{footer:j(()=>[e("div",F0,[w($(De),{variant:"ghost",size:"sm",onClick:ka},{default:j(()=>[X(S(t.readonly?"Close":"Cancel"),1)]),_:1}),t.readonly?T("",!0):(r(),N($(De),{key:0,variant:"primary",size:"sm",disabled:i.value,loading:i.value,onClick:ya},{default:j(()=>[X(S(d.value?"Update Agent":"Create Agent"),1)]),_:1},8,["disabled","loading"]))])]),default:j(()=>[i.value?(r(),o("div",x0,[...te[27]||(te[27]=[e("span",{class:"text-neutral-500"},"Loading agent data...",-1)])])):(r(),N($e,{key:1,type:"form",actions:!1,disabled:t.readonly,onNode:fa,"form-class":"$reset flex-1 min-h-0 flex flex-col"},{default:j(()=>[e("div",y0,[e("nav",k0,[w($(oa),{tabs:f.value,"active-tab":$(y),onSelect:$(v)},null,8,["tabs","active-tab","onSelect"])]),e("div",{ref_key:"contentRef",ref:c,class:"flex-1 overflow-y-auto p-5 bg-neutral-100 dark:bg-neutral-950"},[e("div",w0,[t.apiError?(r(),N($(Fe),{key:0,variant:"error"},{default:j(()=>[X(S(t.apiError),1)]),_:1})):T("",!0),w($(rt),{id:"section-basics",title:"Basics",icon:$(Pt)},{default:j(()=>[e("div",_0,[e("div",null,[w($e,{type:"text",name:"name",modelValue:_.value,"onUpdate:modelValue":te[0]||(te[0]=Ce=>_.value=Ce),label:"Agent Name",disabled:d.value,validation:"required","validation-messages":{required:"Name is required"},"outer-class":"$reset",onBlur:te[1]||(te[1]=Ce=>_.value=ga(_.value))},null,8,["modelValue","disabled"]),b.value?(r(),N($(ze),{key:0,class:"mt-1 text-red-600 dark:text-red-400"},{default:j(()=>[X(S(b.value),1)]),_:1})):d.value?(r(),N($(ze),{key:2,class:"mt-1"},{default:j(()=>[...te[29]||(te[29]=[X(" Agent names cannot be changed after creation (used as foreign key for threads) ",-1)])]),_:1})):(r(),N($(ze),{key:1,class:"mt-1"},{default:j(()=>[...te[28]||(te[28]=[X(" Automatically formatted to snake_case with _agent suffix (e.g., research_agent) ",-1)])]),_:1}))]),e("div",$0,[e("div",null,[w($e,{type:"text",name:"title",modelValue:u.value,"onUpdate:modelValue":te[2]||(te[2]=Ce=>u.value=Ce),label:"Display Title (Optional)","outer-class":"$reset"},null,8,["modelValue"]),w($(ze),{class:"mt-1"},{default:j(()=>[...te[30]||(te[30]=[X(" Human-readable title shown in the UI ",-1)])]),_:1})]),e("div",null,[w($e,{type:"selectSearch",name:"type",modelValue:x.value,"onUpdate:modelValue":te[3]||(te[3]=Ce=>x.value=Ce),label:"Agent Type",options:ha,"outer-class":"$reset"},null,8,["modelValue"]),w($(ze),{class:"mt-1"},{default:j(()=>[...te[31]||(te[31]=[X(" AI + AI or AI + Human conversation ",-1)])]),_:1})])]),x.value==="dual_ai"?(r(),o("div",C0,[w($e,{type:"checkbox",modelValue:p.value,"onUpdate:modelValue":te[4]||(te[4]=Ce=>p.value=Ce),label:"Expose as Tool","outer-class":"$reset"},null,8,["modelValue"]),w($(ze),{class:"mt-1"},{default:j(()=>[...te[32]||(te[32]=[X(" Make this subagent available as a tool that can be called by other prompts or agents ",-1)])]),_:1})])):T("",!0),p.value&&x.value==="dual_ai"?(r(),o("div",S0,[w($e,{type:"textarea",name:"tool_description",modelValue:k.value,"onUpdate:modelValue":te[5]||(te[5]=Ce=>k.value=Ce),label:"Tool Description",placeholder:"Describe what this agent does when called as a tool",rows:3,"outer-class":"$reset"},null,8,["modelValue"]),M.value?(r(),N($(ze),{key:0,class:"mt-1 text-red-600 dark:text-red-400"},{default:j(()=>[X(S(M.value),1)]),_:1})):(r(),N($(ze),{key:1,class:"mt-1"},{default:j(()=>[...te[33]||(te[33]=[X(" This description helps other agents understand when to use this agent ",-1)])]),_:1}))])):T("",!0),x.value==="dual_ai"?(r(),o("div",T0,[w($e,{type:"number",name:"max_session_turns",modelValue:R.value,"onUpdate:modelValue":te[6]||(te[6]=Ce=>R.value=Ce),label:"Max Session Turns",placeholder:"Unlimited","outer-class":"$reset"},null,8,["modelValue"]),W.value?(r(),N($(ze),{key:0,class:"mt-1 text-red-600 dark:text-red-400"},{default:j(()=>[X(S(W.value),1)]),_:1})):(r(),N($(ze),{key:1,class:"mt-1"},{default:j(()=>[...te[34]||(te[34]=[X(" Maximum number of back-and-forth exchanges between the two agents before the conversation ends ",-1)])]),_:1}))])):T("",!0)])]),_:1},8,["icon"]),w($(rt),{id:"section-side-a",title:"Side A (AI)",icon:$(mt)},{default:j(()=>[e("div",I0,[e("div",z0,[e("div",null,[w($e,{type:"text",modelValue:Z.value,"onUpdate:modelValue":te[7]||(te[7]=Ce=>Z.value=Ce),label:"Side Label (Optional)",placeholder:"e.g., ATC, Pilot, Customer","outer-class":"$reset"},null,8,["modelValue"]),w($(ze),{class:"mt-1"},{default:j(()=>[...te[35]||(te[35]=[X(" Custom label for this side ",-1)])]),_:1})]),e("div",null,[w($e,{type:"selectSearch",name:"side_a_agent_prompt",modelValue:V.value,"onUpdate:modelValue":te[8]||(te[8]=Ce=>V.value=Ce),label:"Agent Prompt",options:Me.value,validation:"required","validation-messages":{required:"Please select an agent prompt"},"outer-class":"$reset"},null,8,["modelValue","options"]),P.value?(r(),N($(ze),{key:0,class:"mt-1 text-red-600 dark:text-red-400"},{default:j(()=>[X(S(P.value),1)]),_:1})):(r(),N($(ze),{key:1,class:"mt-1"},{default:j(()=>[...te[36]||(te[36]=[X(" Defines this agent's behavior ",-1)])]),_:1}))])]),e("div",M0,[w($(xt),{title:"Stop Conditions"}),w($(ze),null,{default:j(()=>[...te[37]||(te[37]=[X(" Optional. If no stop conditions are set, the agent will continue until programmatically stopped or end conversation tool is called. ",-1)])]),_:1}),e("div",null,[w($e,{type:"checkbox",modelValue:J.value,"onUpdate:modelValue":te[9]||(te[9]=Ce=>J.value=Ce),label:"Stop when agent returns content","outer-class":"$reset"},null,8,["modelValue"]),w($(ze),{class:"ml-6"},{default:j(()=>[...te[38]||(te[38]=[X(" Agent stops when it returns a response without calling tools ",-1)])]),_:1})]),e("div",null,[w($e,{type:"checkbox",modelValue:Q.value,"onUpdate:modelValue":te[10]||(te[10]=Ce=>Q.value=Ce),label:"Stop on specific tool call","outer-class":"$reset"},null,8,["modelValue"]),Q.value?(r(),o("div",V0,[w($e,{type:"selectSearch",modelValue:le.value,"onUpdate:modelValue":te[11]||(te[11]=Ce=>le.value=Ce),label:"Stop Tool",options:Ct.value,placeholder:"Select a tool...",disabled:ce.value||!V.value,"outer-class":"$reset"},null,8,["modelValue","options","disabled"]),me.value?(r(),N($(ze),{key:0,class:"text-red-600 dark:text-red-400"},{default:j(()=>[X(S(me.value),1)]),_:1})):(r(),N($(ze),{key:1},{default:j(()=>[...te[39]||(te[39]=[X(" Agent stops when this tool is called ",-1)])]),_:1})),le.value?(r(),o("div",E0,[w($e,{type:"selectSearch",modelValue:ee.value,"onUpdate:modelValue":te[12]||(te[12]=Ce=>ee.value=Ce),label:"Response Property",options:ma.value,placeholder:"Select property...","outer-class":"$reset"},null,8,["modelValue","options"]),L.value?(r(),N($(ze),{key:0,class:"mt-1 text-red-600 dark:text-red-400"},{default:j(()=>[X(S(L.value),1)]),_:1})):(r(),N($(ze),{key:1,class:"mt-1"},{default:j(()=>[...te[40]||(te[40]=[X(" Property from tool arguments to return as final response ",-1)])]),_:1}))])):T("",!0)])):T("",!0)]),x.value==="ai_human"&&!J.value&&!Q.value?(r(),N($(Fe),{key:0,variant:"warning",class:"mt-3"},{default:j(()=>[w($e,{type:"checkbox",modelValue:C.value,"onUpdate:modelValue":te[13]||(te[13]=Ce=>C.value=Ce),label:"I have manually implemented a stop condition","outer-class":"$reset"},null,8,["modelValue"]),te[41]||(te[41]=e("p",{class:"mt-2 text-xs"}," Warning: Only check this if you have implemented a custom stop condition in your code (e.g., via hooks or custom logic). Without a stop condition, the agent may run indefinitely. ",-1))]),_:1})):T("",!0)]),e("div",L0,[e("div",null,[w($e,{type:"number",name:"side_a_max_steps",modelValue:I.value,"onUpdate:modelValue":te[14]||(te[14]=Ce=>I.value=Ce),label:"Max Steps",placeholder:"Unlimited","outer-class":"$reset"},null,8,["modelValue"]),re.value?(r(),N($(ze),{key:0,class:"mt-1 text-red-600 dark:text-red-400"},{default:j(()=>[X(S(re.value),1)]),_:1})):(r(),N($(ze),{key:1,class:"mt-1"},{default:j(()=>[...te[42]||(te[42]=[X(" Safety limit before yielding ",-1)])]),_:1}))]),e("div",null,[w($e,{type:"selectSearch",modelValue:F.value,"onUpdate:modelValue":te[15]||(te[15]=Ce=>F.value=Ce),label:"End Conversation Tool",options:Ct.value,placeholder:"Select a tool...",disabled:ce.value||!V.value,"outer-class":"$reset"},null,8,["modelValue","options","disabled"]),B.value?(r(),N($(ze),{key:0,class:"mt-1 text-red-600 dark:text-red-400"},{default:j(()=>[X(S(B.value),1)]),_:1})):(r(),N($(ze),{key:1,class:"mt-1"},{default:j(()=>[...te[43]||(te[43]=[X(" Ends entire conversation when called ",-1)])]),_:1}))])])])]),_:1},8,["icon"]),w($(rt),{id:"section-side-b",title:x.value==="ai_human"?"Side B (Human)":"Side B (AI)",icon:x.value==="ai_human"?$(gr):$(mt)},{default:j(()=>[e("div",P0,[x.value==="ai_human"?(r(),o(he,{key:0},[e("div",null,[w($e,{type:"text",modelValue:q.value,"onUpdate:modelValue":te[16]||(te[16]=Ce=>q.value=Ce),label:"Side Label (Optional)",placeholder:"e.g., Customer, User","outer-class":"$reset"},null,8,["modelValue"]),w($(ze),{class:"mt-1"},{default:j(()=>[...te[44]||(te[44]=[X(" Custom label for this side ",-1)])]),_:1})]),te[45]||(te[45]=e("div",{class:"flex flex-col items-center justify-center py-8 bg-neutral-50 dark:bg-neutral-800/50 rounded-lg"},[e("svg",{class:"w-16 h-16 mb-4 text-neutral-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})]),e("h5",{class:"font-medium text-lg mb-2 text-neutral-700 dark:text-neutral-300"},"Human User"),e("p",{class:"text-sm text-neutral-500 dark:text-neutral-400 text-center max-w-xs"}," This side of the conversation will be handled by a human user through the interface ")],-1))],64)):(r(),o(he,{key:1},[e("div",A0,[e("div",null,[w($e,{type:"text",modelValue:q.value,"onUpdate:modelValue":te[17]||(te[17]=Ce=>q.value=Ce),label:"Side Label (Optional)",placeholder:"e.g., ATC, Pilot, Customer","outer-class":"$reset"},null,8,["modelValue"]),w($(ze),{class:"mt-1"},{default:j(()=>[...te[46]||(te[46]=[X(" Custom label for this side ",-1)])]),_:1})]),e("div",null,[w($e,{type:"selectSearch",name:"side_b_agent_prompt",modelValue:Y.value,"onUpdate:modelValue":te[18]||(te[18]=Ce=>Y.value=Ce),label:"Agent Prompt",options:Me.value,validation:"required","validation-messages":{required:"Please select an agent prompt"},"outer-class":"$reset"},null,8,["modelValue","options"]),U.value?(r(),N($(ze),{key:0,class:"mt-1 text-red-600 dark:text-red-400"},{default:j(()=>[X(S(U.value),1)]),_:1})):(r(),N($(ze),{key:1,class:"mt-1"},{default:j(()=>[...te[47]||(te[47]=[X(" Defines this agent's behavior ",-1)])]),_:1}))])]),e("div",j0,[w($(xt),{title:"Stop Conditions"}),w($(ze),null,{default:j(()=>[...te[48]||(te[48]=[X(" Optional. If no stop conditions are set, the agent will continue until programmatically stopped or end conversation tool is called. ",-1)])]),_:1}),e("div",null,[w($e,{type:"checkbox",modelValue:H.value,"onUpdate:modelValue":te[19]||(te[19]=Ce=>H.value=Ce),label:"Stop when agent returns content","outer-class":"$reset"},null,8,["modelValue"]),w($(ze),{class:"ml-6"},{default:j(()=>[...te[49]||(te[49]=[X(" Agent stops when it returns a response without calling tools ",-1)])]),_:1})]),e("div",null,[w($e,{type:"checkbox",modelValue:E.value,"onUpdate:modelValue":te[20]||(te[20]=Ce=>E.value=Ce),label:"Stop on specific tool call","outer-class":"$reset"},null,8,["modelValue"]),E.value?(r(),o("div",D0,[w($e,{type:"selectSearch",modelValue:ne.value,"onUpdate:modelValue":te[21]||(te[21]=Ce=>ne.value=Ce),label:"Stop Tool",options:ar.value,placeholder:"Select a tool...",disabled:ve.value||!Y.value,"outer-class":"$reset"},null,8,["modelValue","options","disabled"]),A.value?(r(),N($(ze),{key:0,class:"text-red-600 dark:text-red-400"},{default:j(()=>[X(S(A.value),1)]),_:1})):(r(),N($(ze),{key:1},{default:j(()=>[...te[50]||(te[50]=[X(" Agent stops when this tool is called ",-1)])]),_:1})),ne.value?(r(),o("div",R0,[w($e,{type:"selectSearch",modelValue:pe.value,"onUpdate:modelValue":te[22]||(te[22]=Ce=>pe.value=Ce),label:"Response Property",options:va.value,placeholder:"Select property...","outer-class":"$reset"},null,8,["modelValue","options"]),ue.value?(r(),N($(ze),{key:0,class:"mt-1 text-red-600 dark:text-red-400"},{default:j(()=>[X(S(ue.value),1)]),_:1})):(r(),N($(ze),{key:1,class:"mt-1"},{default:j(()=>[...te[51]||(te[51]=[X(" Property from tool arguments to return as final response ",-1)])]),_:1}))])):T("",!0)])):T("",!0)])]),e("div",O0,[e("div",null,[w($e,{type:"number",name:"side_b_max_steps",modelValue:ke.value,"onUpdate:modelValue":te[23]||(te[23]=Ce=>ke.value=Ce),label:"Max Steps",placeholder:"Unlimited","outer-class":"$reset"},null,8,["modelValue"]),Ee.value?(r(),N($(ze),{key:0,class:"mt-1 text-red-600 dark:text-red-400"},{default:j(()=>[X(S(Ee.value),1)]),_:1})):(r(),N($(ze),{key:1,class:"mt-1"},{default:j(()=>[...te[52]||(te[52]=[X(" Safety limit before yielding ",-1)])]),_:1}))]),e("div",null,[w($e,{type:"selectSearch",modelValue:ae.value,"onUpdate:modelValue":te[24]||(te[24]=Ce=>ae.value=Ce),label:"End Conversation Tool",options:ar.value,placeholder:"Select a tool...",disabled:ve.value||!Y.value,"outer-class":"$reset"},null,8,["modelValue","options","disabled"]),z.value?(r(),N($(ze),{key:0,class:"mt-1 text-red-600 dark:text-red-400"},{default:j(()=>[X(S(z.value),1)]),_:1})):(r(),N($(ze),{key:1,class:"mt-1"},{default:j(()=>[...te[53]||(te[53]=[X(" Ends entire conversation when called ",-1)])]),_:1}))])])],64))])]),_:1},8,["title","icon"]),K.value.length>0||Object.keys(ie.value).length>0?(r(),N($(rt),{key:1,id:"section-env",title:"Environment",icon:$(Kt)},{default:j(()=>[e("div",U0,[te[54]||(te[54]=e("p",{class:"text-sm text-neutral-500 dark:text-neutral-400"}," Configure values for tools that require thread environment variables. Values from prompts are shown locked - click to unlock and override. ",-1)),D.value?(r(),o("span",B0,"Loading...")):T("",!0),w(Qt,{modelValue:ie.value,"onUpdate:modelValue":te[25]||(te[25]=Ce=>ie.value=Ce),inherited:K.value,"allow-custom":!0,disabled:i.value},null,8,["modelValue","inherited","disabled"])])]),_:1},8,["icon"])):T("",!0)])],512)])]),_:1},8,["disabled"]))]),_:1},8,["model-value","title"])}}}),la=fe({__name:"ExtractCopyToggle",props:{value:{},disabled:{type:Boolean}},emits:["update:value"],setup(t,{emit:a}){const n=a,s=l=>{n("update:value",l)};return(l,d)=>{const i=Be("FormKit");return r(),N(i,{type:"toggle",value:t.value,"on-value":"extract","off-value":"copy","on-value-label":"extract","off-value-label":"copy",disabled:t.disabled,classes:{outer:"$remove:mb-4",wrapper:"$remove:items-center flex-row-reverse justify-end items-center",inner:"h-5",track:"h-5 w-10 rounded-full",thumb:"h-4 w-4",valueLabel:"text-xs text-neutral-600 dark:text-neutral-400 mr-2 flex items-center font-normal"},onInput:s},null,8,["value","disabled"])}}}),q0={class:"font-mono text-sm"},H0={class:"flex items-center gap-2 py-1.5"},W0={class:"text-neutral-600 dark:text-neutral-400"},K0={class:"ml-auto"},sa=fe({name:"TreeChildren",props:{children:{type:Array,required:!0},getSelection:{type:Function,required:!0},setSelection:{type:Function,required:!0},isShared:{type:Function,required:!0},getTypeColor:{type:Function,required:!0}},setup(t){return()=>t.children.length===0?null:Re("div",{class:"ml-4"},t.children.map((a,n)=>Re("div",{class:"relative",key:a.uid},[n<t.children.length-1?Re("div",{class:"absolute left-0 top-0 bottom-0 border-l border-neutral-300 dark:border-neutral-700"}):Re("div",{class:"absolute left-0 top-0 h-3 border-l border-neutral-300 dark:border-neutral-700"}),Re("div",{class:"absolute left-0 top-3 w-4 border-t border-neutral-300 dark:border-neutral-700"}),Re("div",{class:"pl-5"},[Re("div",{class:"flex items-center gap-2 py-1.5"},[Re("span",{class:"text-neutral-600 dark:text-neutral-400"},a.name),Re(ft,{variant:t.getTypeColor(a.type),size:"sm"},()=>a.type),t.isShared(a)?Re("span",{class:"text-xs text-amber-600 dark:text-amber-400",title:`Used by: ${a.sharedWith.join(", ")}`},`(used in ${a.sharedWith.length} other${a.sharedWith.length>1?"s":""})`):null,a.isDuplicate?null:Re("div",{class:"ml-auto"},[Re(la,{value:t.getSelection(a),disabled:t.isShared(a),"onUpdate:value":s=>t.setSelection(a,s),title:t.isShared(a)?"Cannot extract items shared with other agents":""})])]),a.children.length>0?Re(sa,{children:a.children,getSelection:t.getSelection,setSelection:t.setSelection,isShared:t.isShared,getTypeColor:t.getTypeColor}):null])])))}}),J0=fe({__name:"DependencyTree",props:{analysis:{},selections:{}},emits:["update:selection"],setup(t,{emit:a}){const n=t,s=a,l=O(()=>{const v=n.analysis,f=[];let h=0;const _=(M,R)=>{for(const W of M){const Z=`${R}:${W.name}`;f.push({...W,type:R,uid:`${Z}:${h++}`})}};_(v.constituents.agents,"agent"),_(v.constituents.prompts,"prompt"),_(v.constituents.tools,"tool"),_(v.constituents.models,"model"),_(v.constituents.hooks,"hook");const b=new Map,u=`agent:${v.agent}`;for(const M of f){const R=M.parentKey||u;`${M.type}:${M.name}`===u&&!M.parentKey||(b.has(R)||b.set(R,[]),b.get(R).push(M))}const x=new Set,p=M=>{const R=`${M.type}:${M.name}`,W=x.has(R);x.add(R);const Z=[],V=b.get(R)||[];for(const P of V)Z.push(p(P));return{name:M.name,type:M.type,filePath:M.filePath,sharedWith:M.sharedWith,discoveredVia:M.discoveredVia,children:Z,uid:M.uid,isDuplicate:W}},k=f.find(M=>M.type==="agent"&&M.name===v.agent&&!M.parentKey);return k?p(k):{name:v.agent,type:"agent",filePath:"",sharedWith:[],discoveredVia:"static",children:[],uid:"root",isDuplicate:!1}}),d=v=>`${v.type}:${v.name}`,i=v=>n.selections.get(d(v))||"extract",c=(v,f)=>{s("update:selection",d(v),f)},g=v=>v.sharedWith.length>0,y=v=>{switch(v){case"agent":return"accent";case"prompt":return"secondary";case"tool":return"success";case"model":return"warning";case"hook":return"default"}};return(v,f)=>(r(),o("div",q0,[e("div",H0,[e("span",W0,S(l.value.name),1),w($(ft),{variant:y(l.value.type),size:"sm"},{default:j(()=>[X(S(l.value.type),1)]),_:1},8,["variant"]),e("div",K0,[w(la,{value:i(l.value),"onUpdate:value":f[0]||(f[0]=h=>c(l.value,h))},null,8,["value"])])]),(r(),N(Ue($(sa)),{children:l.value.children,"get-selection":i,"set-selection":c,"is-shared":g,"get-type-color":y},null,8,["children"]))]))}}),Y0={key:0,class:"flex items-center justify-center py-12"},G0={key:1,class:"py-4"},Z0={key:2,class:"py-4 space-y-4"},X0={class:"space-y-2"},Q0={class:"text-sm opacity-80"},ep={class:"text-sm opacity-80"},tp={key:3,class:"space-y-6"},rp={class:"space-y-4"},ap={class:"grid grid-cols-2 gap-4"},op={class:"col-span-2"},np=["value"],lp={class:"col-span-2"},sp={class:"col-span-2"},ip={key:0,class:"mt-3 space-y-3"},up={class:"flex gap-2 border-b border-neutral-200 dark:border-neutral-700"},dp={key:0},cp=["innerHTML"],pp={class:"space-y-4"},mp={class:"list-disc list-inside space-y-1"},vp={class:"border border-neutral-200 dark:border-neutral-700 rounded-lg p-4 bg-neutral-50 dark:bg-neutral-900/50"},fp={class:"flex justify-between"},hp=fe({__name:"PackModal",props:{modelValue:{type:Boolean},agent:{}},emits:["update:modelValue","packed"],setup(t,{emit:a}){Vt.setOptions({gfm:!0,breaks:!0});const n=[{value:"MIT",label:"MIT"},{value:"Apache-2.0",label:"Apache 2.0"},{value:"ISC",label:"ISC"},{value:"GPL-3.0",label:"GPL 3.0"},{value:"BSD-3-Clause",label:"BSD 3-Clause"},{value:"Unlicensed",label:"Unlicensed / Proprietary"}],s=t,l=a,d=O({get:()=>s.modelValue,set:B=>l("update:modelValue",B)}),i=m(null),c=m(!1),g=m(!1),y=m(null),v=m(null),f=m(""),h=m("1.0.0"),_=m("MIT"),b=m(""),u=m(""),x=m("edit"),p=m(!1),k=m(null),M=m(null),R=O(()=>u.value?Vt(u.value):""),W=m(new Map);xe(()=>s.modelValue,async B=>{B&&s.agent?await Promise.all([V(),P()]):Z()});const Z=()=>{i.value=null,y.value=null,v.value=null,W.value=new Map,f.value="",h.value="1.0.0",_.value="MIT",b.value="",u.value="",x.value="edit",p.value=!1,k.value=null,M.value=null},V=async()=>{if(s.agent){c.value=!0,y.value=null;try{const B=await fetch(ge(`/api/pack/${s.agent.id}/analyze`)),q=await B.json();if(!B.ok){y.value=q.error||"Failed to analyze agent";return}if(i.value=q,q.generatedReadme)u.value=q.generatedReadme;else{const Y=J(s.agent?.id||"agent");u.value=Q(Y,s.agent?.id||"agent",q.agentDescription)}me(q)}catch(B){y.value=B instanceof Error?B.message:"Failed to analyze agent"}finally{c.value=!1}}},P=async()=>{if(s.agent)try{const B=await fetch(ge(`/api/pack/${s.agent.id}/metadata`));if(B.ok){const q=await B.json();f.value=q.packageName,h.value=le(q.version),_.value=q.license||"MIT",b.value=q.licenseOwner||""}else f.value=J(s.agent.id),h.value="1.0.0",_.value="MIT",b.value=""}catch{f.value=J(s.agent?.id||"agent"),h.value="1.0.0",_.value="MIT",b.value=""}},J=B=>`standardagent-${B.toLowerCase().replace(/_/g,"-")}`,Q=(B,q,Y)=>`# ${B}
|
|
6
6
|
|
|
7
7
|
${Y||"A Standard Agent package."}
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
11
11
|
\`\`\`bash
|
|
12
|
-
npm install ${
|
|
12
|
+
npm install ${B}
|
|
13
13
|
\`\`\`
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
@@ -22,39 +22,39 @@ This is a [Standard Agent](https://standardagentbuilder.com) package. To use it:
|
|
|
22
22
|
\`\`\`typescript
|
|
23
23
|
// Create a thread with this agent
|
|
24
24
|
const thread = await client.createThread({
|
|
25
|
-
agent_id: '${
|
|
25
|
+
agent_id: '${B}/${q}'
|
|
26
26
|
});
|
|
27
27
|
\`\`\`
|
|
28
28
|
|
|
29
29
|
## License
|
|
30
30
|
|
|
31
31
|
MIT
|
|
32
|
-
`,
|
|
32
|
+
`,le=B=>{const q=B.split(".");if(q.length<3)return`${B}.1`;const Y=parseInt(q[2],10);return`${q[0]}.${q[1]}.${Y+1}`},me=B=>{const q=new Map,Y=new Set;for(const U of B.constituents.agents){const H=`agent:${U.name}`;Y.has(H)||(Y.add(H),q.set(H,U.sharedWith.length>0?"copy":"extract"))}for(const U of B.constituents.prompts){const H=`prompt:${U.name}`;Y.has(H)||(Y.add(H),q.set(H,U.sharedWith.length>0?"copy":"extract"))}for(const U of B.constituents.tools){const H=`tool:${U.name}`;Y.has(H)||(Y.add(H),q.set(H,U.sharedWith.length>0?"copy":"extract"))}for(const U of B.constituents.models){const H=`model:${U.name}`;Y.has(H)||(Y.add(H),q.set(H,U.sharedWith.length>0?"copy":"extract"))}for(const U of B.constituents.hooks){const H=`hook:${U.name}`;Y.has(H)||(Y.add(H),q.set(H,U.sharedWith.length>0?"copy":"extract"))}W.value=q},ee=(B,q)=>{W.value.set(B,q),W.value=new Map(W.value)},L=B=>B?B.length>214?"Package name must be 214 characters or less":B.startsWith(".")||B.startsWith("_")?"Cannot start with . or _":B!==B.toLowerCase()?"Must be lowercase":/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(B)?null:"Only lowercase letters, numbers, hyphens, underscores, and dots":"Package name is required",C=B=>/^\d+\.\d+\.\d+(-[a-zA-Z0-9.-]+)?$/.test(B)?null:"Invalid version format (use X.Y.Z)";xe(f,B=>{k.value=L(B)}),xe(h,B=>{M.value=C(B)});const I=O(()=>!L(f.value)&&!C(h.value)),re=async()=>{if(!(!s.agent||!i.value)&&(k.value=L(f.value),M.value=C(h.value),!(k.value||M.value))){g.value=!0,y.value=null,v.value=null;try{const B=Array.from(W.value.entries()).map(([U,H])=>{const[E,ne]=U.split(":");let A="";const pe=E==="agent"?"agents":E+"s",ke=(i.value?.constituents[pe]||[]).find(Ee=>Ee.name===ne);return ke&&(A=ke.filePath),{name:ne,type:E,filePath:A,mode:H}}),q=await fetch(ge(`/api/pack/${s.agent.id}`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({itemSelections:B,packageName:f.value,version:h.value,license:_.value,licenseOwner:b.value,readme:u.value})}),Y=await q.json();if(!q.ok){y.value=Y.error||"Failed to pack agent";return}v.value={success:!0,outputPath:Y.outputPath,filesCreated:Y.filesCreated,packageId:Y.packageId},setTimeout(()=>{l("packed",{outputPath:Y.outputPath,packageId:Y.packageId})},1500)}catch(B){y.value=B instanceof Error?B.message:"Failed to pack agent"}finally{g.value=!1}}},F=()=>{d.value=!1};return(B,q)=>(r(),N(He,{modelValue:d.value,"onUpdate:modelValue":q[8]||(q[8]=Y=>d.value=Y),title:`Pack Agent: ${t.agent?.title||t.agent?.id||""}`,width:"max-w-2xl","min-height":"min-h-[20rem]"},{footer:j(()=>[e("div",fp,[w($(De),{variant:"ghost",onClick:F},{default:j(()=>[...q[15]||(q[15]=[X(" Cancel ",-1)])]),_:1}),w($(De),{variant:"primary",disabled:c.value||g.value||!i.value||v.value?.success||!I.value,onClick:re},{default:j(()=>[g.value?(r(),o(he,{key:0},[w(Ve,{size:"sm",class:"mr-2"}),q[16]||(q[16]=X(" Packing... ",-1))],64)):(r(),o(he,{key:1},[X(" Pack Agent ")],64))]),_:1},8,["disabled"])])]),default:j(()=>[c.value?(r(),o("div",Y0,[w(Ve,{size:"lg"})])):y.value&&!i.value?(r(),o("div",G0,[w($(Fe),{variant:"error"},{default:j(()=>[X(S(y.value),1)]),_:1})])):v.value?.success?(r(),o("div",Z0,[w($(Fe),{variant:"success"},{default:j(()=>[e("div",X0,[q[9]||(q[9]=e("p",{class:"font-medium"},"Agent packed successfully!",-1)),e("p",Q0," Output: "+S(v.value.outputPath),1),e("p",ep,S(v.value.filesCreated?.length)+" files created ",1)])]),_:1})])):i.value?(r(),o("div",tp,[e("div",rp,[q[11]||(q[11]=e("h3",{class:"text-sm font-semibold text-neutral-700 dark:text-neutral-300 uppercase tracking-wider"}," Package Details ",-1)),e("div",ap,[e("div",op,[w($(ct),{label:"Package Name",error:k.value||void 0,"help-text":"npm package name (lowercase, no spaces)",required:""},{default:j(()=>[Ae(e("input",{"onUpdate:modelValue":q[0]||(q[0]=Y=>f.value=Y),type:"text",class:oe(["w-full px-3 py-2 rounded-md border text-sm bg-white dark:bg-neutral-800 border-neutral-300 dark:border-neutral-600 text-neutral-900 dark:text-neutral-100 placeholder-neutral-400 dark:placeholder-neutral-500 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed",{"border-red-500 dark:border-red-500":k.value}]),placeholder:"standardagent-my-agent"},null,2),[[Qe,f.value]])]),_:1},8,["error"])]),w($(ct),{label:"Version",error:M.value||void 0,"help-text":"Semver format (X.Y.Z)",required:""},{default:j(()=>[Ae(e("input",{"onUpdate:modelValue":q[1]||(q[1]=Y=>h.value=Y),type:"text",class:oe(["w-full px-3 py-2 rounded-md border text-sm bg-white dark:bg-neutral-800 border-neutral-300 dark:border-neutral-600 text-neutral-900 dark:text-neutral-100 placeholder-neutral-400 dark:placeholder-neutral-500 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed",{"border-red-500 dark:border-red-500":M.value}]),placeholder:"1.0.0"},null,2),[[Qe,h.value]])]),_:1},8,["error"]),w($(ct),{label:"License"},{default:j(()=>[Ae(e("select",{"onUpdate:modelValue":q[2]||(q[2]=Y=>_.value=Y),class:"w-full px-3 py-2 rounded-md border text-sm bg-white dark:bg-neutral-800 border-neutral-300 dark:border-neutral-600 text-neutral-900 dark:text-neutral-100 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent"},[(r(),o(he,null,we(n,Y=>e("option",{key:Y.value,value:Y.value},S(Y.label),9,np)),64))],512),[[Ar,_.value]])]),_:1}),e("div",lp,[w($(ct),{label:"License Owner","help-text":"Copyright holder name (e.g., your name or company)"},{default:j(()=>[Ae(e("input",{"onUpdate:modelValue":q[3]||(q[3]=Y=>b.value=Y),type:"text",class:"w-full px-3 py-2 rounded-md border text-sm bg-white dark:bg-neutral-800 border-neutral-300 dark:border-neutral-600 text-neutral-900 dark:text-neutral-100 placeholder-neutral-400 dark:placeholder-neutral-500 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent",placeholder:"Your Name or Company"},null,512),[[Qe,b.value]])]),_:1})]),e("div",sp,[e("button",{type:"button",class:"flex items-center gap-2 text-sm font-medium text-neutral-700 dark:text-neutral-300 hover:text-neutral-900 dark:hover:text-neutral-100",onClick:q[4]||(q[4]=Y=>p.value=!p.value)},[(r(),N(Ue(p.value?$(nt):$(vt)),{class:"w-4 h-4"})),q[10]||(q[10]=X(" README ",-1))]),p.value?(r(),o("div",ip,[e("div",up,[e("button",{type:"button",class:oe(["px-3 py-1.5 text-sm font-medium border-b-2 -mb-px transition-colors",x.value==="edit"?"border-primary-500 text-primary-600 dark:text-primary-400":"border-transparent text-neutral-500 hover:text-neutral-700 dark:hover:text-neutral-300"]),onClick:q[5]||(q[5]=Y=>x.value="edit")}," Edit ",2),e("button",{type:"button",class:oe(["px-3 py-1.5 text-sm font-medium border-b-2 -mb-px transition-colors",x.value==="preview"?"border-primary-500 text-primary-600 dark:text-primary-400":"border-transparent text-neutral-500 hover:text-neutral-700 dark:hover:text-neutral-300"]),onClick:q[6]||(q[6]=Y=>x.value="preview")}," Preview ",2)]),x.value==="edit"?(r(),o("div",dp,[Ae(e("textarea",{"onUpdate:modelValue":q[7]||(q[7]=Y=>u.value=Y),rows:"10",class:"w-full px-3 py-2 rounded-md border text-sm font-mono bg-white dark:bg-neutral-800 border-neutral-300 dark:border-neutral-600 text-neutral-900 dark:text-neutral-100 placeholder-neutral-400 dark:placeholder-neutral-500 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent resize-y",placeholder:`# Package Name
|
|
33
33
|
|
|
34
|
-
Description...`},null,512),[[Qe,d.value]])])):(r(),n("div",{key:1,class:"prose prose-sm dark:prose-invert max-w-none p-4 rounded-md border border-neutral-200 dark:border-neutral-700 bg-white dark:bg-neutral-800 min-h-[200px] max-h-[400px] overflow-y-auto",innerHTML:O.value},null,8,np))])):T("",!0)])])]),F[14]||(F[14]=e("hr",{class:"border-neutral-200 dark:border-neutral-700"},null,-1)),e("div",lp,[F[13]||(F[13]=e("h3",{class:"text-sm font-semibold text-neutral-700 dark:text-neutral-300 uppercase tracking-wider"}," Items to Include ",-1)),w(S(Fe),{variant:"info"},{default:j(()=>[...F[12]||(F[12]=[e("div",{class:"space-y-1"},[e("p",null,[e("strong",null,"Extract"),X(": Moves the file into the package and removes it from your workspace. Use this for items only used by this agent. ")]),e("p",null,[e("strong",null,"Copy"),X(": Copies the file into the package but keeps the original. Required for items shared with other agents. ")])],-1)])]),_:1}),x.value?(r(),q(S(Fe),{key:0,variant:"error"},{default:j(()=>[X(C(x.value),1)]),_:1})):T("",!0),s.value.warnings.length>0?(r(),q(S(Fe),{key:1,variant:"warning"},{default:j(()=>[e("ul",sp,[(r(!0),n(fe,null,ke(s.value.warnings,Y=>(r(),n("li",{key:Y},C(Y),1))),128))])]),_:1})):T("",!0),e("div",ip,[w(F0,{analysis:s.value,selections:W.value,"onUpdate:selection":Q},null,8,["analysis","selections"])])])])):T("",!0)]),_:1},8,["modelValue","title"]))}}),cp={class:"font-mono text-sm"},pp={class:"mb-3 text-xs text-neutral-500 dark:text-neutral-400"},mp={class:"flex items-center gap-2 py-1.5"},vp={class:"text-neutral-600 dark:text-neutral-400"},fp={key:0,class:"ml-auto text-xs text-amber-600 dark:text-amber-400"},hp={key:1,class:"ml-auto text-xs text-emerald-600 dark:text-emerald-400"},gp={key:0,class:"text-center py-8 text-neutral-500 dark:text-neutral-400"},aa=ve({name:"TreeChildren",props:{children:{type:Array,required:!0},getTypeColor:{type:Function,required:!0}},setup(t){return()=>t.children.length===0?null:Oe("div",{class:"ml-4"},t.children.map((o,a)=>Oe("div",{class:"relative",key:o.uid},[a<t.children.length-1?Oe("div",{class:"absolute left-0 top-0 bottom-0 border-l border-neutral-300 dark:border-neutral-700"}):Oe("div",{class:"absolute left-0 top-0 h-3 border-l border-neutral-300 dark:border-neutral-700"}),Oe("div",{class:"absolute left-0 top-3 w-4 border-t border-neutral-300 dark:border-neutral-700"}),Oe("div",{class:"pl-5"},[Oe("div",{class:"flex items-center gap-2 py-1.5"},[Oe("span",{class:"text-neutral-600 dark:text-neutral-400"},o.name),Oe(ft,{variant:t.getTypeColor(o.type),size:"sm"},()=>o.type),o.isDuplicate?null:o.existsGlobally?Oe("span",{class:"ml-auto text-xs text-amber-600 dark:text-amber-400"},"already exists"):Oe("span",{class:"ml-auto text-xs text-emerald-600 dark:text-emerald-400"},"will unpack")]),o.children.length>0?Oe(aa,{children:o.children,getTypeColor:t.getTypeColor}):null])])))}}),bp=ve({__name:"UnpackTree",props:{analysis:{}},setup(t){const o=t,a=U(()=>{const s=o.analysis,m=[];let h=0;for(const v of s.items)m.push({...v,uid:`${v.type}:${v.name}:${h++}`});const x=new Map,c=[];for(const v of m)v.parentKey?(x.has(v.parentKey)||x.set(v.parentKey,[]),x.get(v.parentKey).push(v)):c.push(v);const f=new Set,y=v=>{const d=`${v.type}:${v.name}`,k=f.has(d);f.add(d);const g=[],_=x.get(d)||[];for(const L of _)g.push(y(L));return{name:v.name,type:v.type,existsGlobally:v.existsGlobally,action:v.action,children:g,uid:v.uid,isDuplicate:k}},b=[];for(const v of c)v.type==="agent"&&b.push(y(v));if(b.length===0)for(const v of c)b.push(y(v));return b}),i=s=>{switch(s){case"agent":return"accent";case"prompt":return"secondary";case"tool":return"success";case"model":return"warning";case"hook":return"default"}},l=U(()=>{const s=new Set;for(const m of o.analysis.items)s.add(`${m.type}:${m.name}`);return s.size}),u=U(()=>{const s=new Set;let m=0;for(const h of o.analysis.items){const x=`${h.type}:${h.name}`;s.has(x)||(s.add(x),h.existsGlobally||m++)}return m});return(s,m)=>(r(),n("div",cp,[e("div",pp,C(u.value)+" of "+C(l.value)+" items will be unpacked ",1),(r(!0),n(fe,null,ke(a.value,h=>(r(),n("div",{key:h.uid},[e("div",mp,[e("span",vp,C(h.name),1),w(S(ft),{variant:i(h.type),size:"sm"},{default:j(()=>[X(C(h.type),1)]),_:2},1032,["variant"]),h.existsGlobally?(r(),n("span",fp," already exists ")):(r(),n("span",hp," will unpack "))]),(r(),q(Ue(S(aa)),{children:h.children,"get-type-color":i},null,8,["children"]))]))),128)),a.value.length===0?(r(),n("div",gp," No items found in this package. ")):T("",!0)]))}}),xp={key:0,class:"flex items-center justify-center py-12"},yp={key:1,class:"py-4"},kp={key:2,class:"py-4"},wp={class:"space-y-2"},_p={class:"text-sm opacity-80"},$p={key:0,class:"text-sm opacity-80"},Cp={key:1,class:"text-sm opacity-80"},Sp={key:3,class:"space-y-4"},Tp={class:"text-sm text-neutral-600 dark:text-neutral-400"},Ip={class:"font-mono"},zp={class:"list-disc list-inside space-y-1"},Vp={class:"border border-neutral-200 dark:border-neutral-700 rounded-lg p-4 bg-neutral-50 dark:bg-neutral-900/50 max-h-80 overflow-y-auto"},Mp={key:2,class:"flex items-center gap-2"},Ep={class:"flex items-center gap-2 cursor-pointer"},Lp={class:"flex justify-between"},Pp=ve({__name:"UnpackModal",props:{modelValue:{type:Boolean},agent:{}},emits:["update:modelValue","unpacked"],setup(t,{emit:o}){const a=t,i=o,l=U({get:()=>a.modelValue,set:k=>i("update:modelValue",k)}),u=p(null),s=p(!1),m=p(!1),h=p(null),x=p(null),c=p(!1);ge(()=>a.modelValue,async k=>{k&&a.agent?.packageId?await f():(u.value=null,h.value=null,x.value=null,c.value=!1)});const f=async()=>{if(a.agent?.packageId){s.value=!0,h.value=null;try{const k=await fetch(he(`/api/unpack/${encodeURIComponent(a.agent.packageId)}/analyze`)),g=await k.json();if(!k.ok){h.value=g.error||"Failed to analyze package";return}u.value=g}catch(k){h.value=k instanceof Error?k.message:"Failed to analyze package"}finally{s.value=!1}}},y=async()=>{if(!(!a.agent?.packageId||!u.value)){m.value=!0,h.value=null,x.value=null;try{const k=u.value.items.filter((L,O,W)=>W.findIndex(J=>J.type===L.type&&J.name===L.name)===O).map(L=>({name:L.name,type:L.type,action:L.existsGlobally?"skip":"generate"})),g=await fetch(he(`/api/unpack/${encodeURIComponent(a.agent.packageId)}`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({itemSelections:k,deletePackage:c.value})}),_=await g.json();if(!g.ok){h.value=_.error||"Failed to unpack agent";return}x.value={success:!0,filesGenerated:_.filesGenerated,filesSkipped:_.filesSkipped,packageDeleted:_.packageDeleted},setTimeout(()=>{i("unpacked")},1500)}catch(k){h.value=k instanceof Error?k.message:"Failed to unpack agent"}finally{m.value=!1}}},b=()=>{l.value=!1},v=U(()=>{if(!u.value)return 0;const k=new Set;let g=0;for(const _ of u.value.items){const L=`${_.type}:${_.name}`;k.has(L)||(k.add(L),_.existsGlobally||g++)}return g}),d=U(()=>u.value?.source==="local");return(k,g)=>(r(),q(He,{modelValue:l.value,"onUpdate:modelValue":g[1]||(g[1]=_=>l.value=_),title:`Unpack: ${t.agent?.title||t.agent?.id||""}`,width:"max-w-2xl","min-height":"min-h-[20rem]"},{footer:j(()=>[e("div",Lp,[w(S(De),{variant:"ghost",onClick:b},{default:j(()=>[...g[6]||(g[6]=[X(" Cancel ",-1)])]),_:1}),w(S(De),{variant:"primary",disabled:s.value||m.value||!u.value||x.value?.success||v.value===0,onClick:y},{default:j(()=>[m.value?(r(),n(fe,{key:0},[w(Ee,{size:"sm",class:"mr-2"}),g[7]||(g[7]=X(" Unpacking... ",-1))],64)):(r(),n(fe,{key:1},[X(" Unpack "+C(v.value)+" "+C(v.value===1?"item":"items"),1)],64))]),_:1},8,["disabled"])])]),default:j(()=>[s.value?(r(),n("div",xp,[w(Ee,{size:"lg"})])):h.value&&!u.value?(r(),n("div",yp,[w(S(Fe),{variant:"error"},{default:j(()=>[X(C(h.value),1)]),_:1})])):x.value?.success?(r(),n("div",kp,[w(S(Fe),{variant:"success"},{default:j(()=>[e("div",wp,[g[2]||(g[2]=e("p",{class:"font-medium"},"Agent unpacked successfully!",-1)),e("p",_p,C(x.value.filesGenerated?.length||0)+" files unpacked ",1),(x.value.filesSkipped?.length||0)>0?(r(),n("p",$p,C(x.value.filesSkipped?.length)+" files skipped (already exist) ",1)):T("",!0),x.value.packageDeleted?(r(),n("p",Cp," Package was deleted from agents/packed/ ")):T("",!0)])]),_:1})])):u.value?(r(),n("div",Sp,[e("div",Tp,[e("p",null,[g[3]||(g[3]=X("Package: ",-1)),e("span",Ip,C(u.value.packageId),1),X(" v"+C(u.value.version),1)]),e("p",null,"Source: "+C(u.value.source==="npm"?"npm package":"local (agents/packed/)"),1)]),h.value?(r(),q(S(Fe),{key:0,variant:"error"},{default:j(()=>[X(C(h.value),1)]),_:1})):T("",!0),u.value.warnings.length>0?(r(),q(S(Fe),{key:1,variant:"warning"},{default:j(()=>[e("ul",zp,[(r(!0),n(fe,null,ke(u.value.warnings,_=>(r(),n("li",{key:_},C(_),1))),128))])]),_:1})):T("",!0),e("div",Vp,[w(bp,{analysis:u.value},null,8,["analysis"])]),d.value?(r(),n("div",Mp,[e("label",Ep,[Ae(e("input",{"onUpdate:modelValue":g[0]||(g[0]=_=>c.value=_),type:"checkbox",class:"w-4 h-4 rounded border-neutral-300 dark:border-neutral-600 text-primary-600 focus:ring-primary-500"},null,512),[[Jt,c.value]]),g[4]||(g[4]=e("span",{class:"text-sm text-neutral-700 dark:text-neutral-300"},"Delete package after unpacking",-1))]),g[5]||(g[5]=e("span",{class:"text-xs text-neutral-500"},"(removes from agents/packed/)",-1))])):T("",!0)])):T("",!0)]),_:1},8,["modelValue","title"]))}}),Ap={key:0,class:"space-y-4"},jp={class:"space-y-2"},Dp={class:"font-medium"},Op={key:0,class:"text-sm opacity-80"},Rp={key:1,class:"text-sm opacity-70"},Up={key:2,class:"text-sm"},Bp=["href"],Fp={key:0,class:"space-y-2"},Np={class:"text-xs bg-neutral-100 dark:bg-neutral-800 p-3 rounded-md overflow-x-auto max-h-40 whitespace-pre-wrap"},qp={key:1,class:"space-y-4"},Hp={class:"space-y-3"},Wp={key:0,class:"flex items-center gap-2 text-neutral-500"},Kp={key:2,class:"p-4 rounded-lg border border-neutral-200 dark:border-neutral-700 bg-neutral-50 dark:bg-neutral-900/50"},Jp={class:"flex items-center gap-3 mb-3"},Yp={class:"text-lg font-semibold text-neutral-900 dark:text-neutral-100"},Gp={key:0,class:"text-sm text-neutral-600 dark:text-neutral-400 mb-3"},Zp={key:1,class:"mt-3"},Xp=["innerHTML"],Qp={key:0,class:"border-neutral-200 dark:border-neutral-700"},em={key:1,class:"flex items-center gap-2 text-neutral-500"},tm={class:"space-y-2 text-sm"},rm={class:"bg-neutral-200 dark:bg-neutral-700 px-1 rounded"},am={class:"list-decimal list-inside space-y-1 ml-2"},om={class:"whitespace-pre-wrap text-sm"},nm={class:"space-y-2"},lm={class:"flex items-center gap-4"},sm={class:"flex items-center gap-2 cursor-pointer"},im={class:"flex items-center gap-2 cursor-pointer"},um={key:0},dm={key:0,class:"mt-1 text-xs text-red-500"},cm={class:"flex items-center gap-2 cursor-pointer"},pm={class:"flex justify-between"},mm="https://registry.npmjs.org",vm=ve({__name:"PublishModal",props:{modelValue:{type:Boolean},packageId:{},outputPath:{}},emits:["update:modelValue","published"],setup(t,{emit:o}){Vt.setOptions({gfm:!0,breaks:!0});const a=t,i=o,l=U({get:()=>a.modelValue,set:E=>i("update:modelValue",E)}),u=p(null),s=p(!1),m=p(null),h=p(!1),x=p(null),c=p(!1),f=U(()=>u.value?.readme?Vt(u.value.readme):""),y=p(""),b=p("default"),v=p(""),d=p(!1),k=p(!1),g=p(null),_=p(null),L=p(null),O=p(null),W=async()=>{s.value=!0,m.value=null;try{const E=await fetch(he(`/api/pack/${encodeURIComponent(a.packageId)}/packed-info`));if(E.ok)u.value=await E.json();else{const $=await E.json();m.value=$.error||"Failed to load package info"}}catch(E){console.error("Failed to fetch package info:",E),m.value=E instanceof Error?E.message:"Failed to load package info"}finally{s.value=!1}},J=async()=>{c.value=!0;try{const E=await fetch(he("/api/pack/npm-token-status"));E.ok&&(x.value=await E.json())}catch(E){console.error("Failed to fetch npm token status:",E)}finally{c.value=!1}};ge(()=>a.modelValue,E=>{E&&(y.value="",b.value="default",v.value="",d.value=!1,g.value=null,_.value=null,L.value=null,O.value=null,x.value=null,u.value=null,m.value=null,h.value=!1,W(),J())});const z=E=>x.value?.hasToken?null:!E||E.trim().length===0?"npm token is required":E.trim().length<10?"Token appears to be too short":null,P=E=>{if(!E)return null;try{return new URL(E).protocol!=="https:"?"Registry must use HTTPS":null}catch{return"Invalid URL format"}};ge(y,E=>{E&&(L.value=z(E))}),ge(v,E=>{b.value==="custom"&&E&&(O.value=P(E))}),ge(b,E=>{E==="default"?O.value=null:v.value&&(O.value=P(v.value))});const G=U(()=>b.value==="default"?mm:v.value),ee=U(()=>{const E=x.value?.hasToken||!z(y.value),$=b.value==="default"||!P(v.value);return E&&$}),ue=async()=>{if(x.value?.hasToken||(L.value=z(y.value)),b.value==="custom"&&(O.value=P(v.value)),!(L.value||O.value)){k.value=!0,g.value=null,_.value=null;try{const E={registry:G.value,dryRun:d.value};y.value.trim()&&(E.token=y.value.trim());const $=await fetch(he(`/api/pack/${encodeURIComponent(a.packageId)}/publish`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)}),V=await $.json();if(!$.ok){g.value=V.error||"Failed to publish package",V.output&&(g.value+=`
|
|
34
|
+
Description...`},null,512),[[Qe,u.value]])])):(r(),o("div",{key:1,class:"prose prose-sm dark:prose-invert max-w-none p-4 rounded-md border border-neutral-200 dark:border-neutral-700 bg-white dark:bg-neutral-800 min-h-[200px] max-h-[400px] overflow-y-auto",innerHTML:R.value},null,8,cp))])):T("",!0)])])]),q[14]||(q[14]=e("hr",{class:"border-neutral-200 dark:border-neutral-700"},null,-1)),e("div",pp,[q[13]||(q[13]=e("h3",{class:"text-sm font-semibold text-neutral-700 dark:text-neutral-300 uppercase tracking-wider"}," Items to Include ",-1)),w($(Fe),{variant:"info"},{default:j(()=>[...q[12]||(q[12]=[e("div",{class:"space-y-1"},[e("p",null,[e("strong",null,"Extract"),X(": Moves the file into the package and removes it from your workspace. Use this for items only used by this agent. ")]),e("p",null,[e("strong",null,"Copy"),X(": Copies the file into the package but keeps the original. Required for items shared with other agents. ")])],-1)])]),_:1}),y.value?(r(),N($(Fe),{key:0,variant:"error"},{default:j(()=>[X(S(y.value),1)]),_:1})):T("",!0),i.value.warnings.length>0?(r(),N($(Fe),{key:1,variant:"warning"},{default:j(()=>[e("ul",mp,[(r(!0),o(he,null,we(i.value.warnings,Y=>(r(),o("li",{key:Y},S(Y),1))),128))])]),_:1})):T("",!0),e("div",vp,[w(J0,{analysis:i.value,selections:W.value,"onUpdate:selection":ee},null,8,["analysis","selections"])])])])):T("",!0)]),_:1},8,["modelValue","title"]))}}),gp={class:"font-mono text-sm"},bp={class:"mb-3 text-xs text-neutral-500 dark:text-neutral-400"},xp={class:"flex items-center gap-2 py-1.5"},yp={class:"text-neutral-600 dark:text-neutral-400"},kp={key:0,class:"ml-auto text-xs text-amber-600 dark:text-amber-400"},wp={key:1,class:"ml-auto text-xs text-emerald-600 dark:text-emerald-400"},_p={key:0,class:"text-center py-8 text-neutral-500 dark:text-neutral-400"},ia=fe({name:"TreeChildren",props:{children:{type:Array,required:!0},getTypeColor:{type:Function,required:!0}},setup(t){return()=>t.children.length===0?null:Re("div",{class:"ml-4"},t.children.map((a,n)=>Re("div",{class:"relative",key:a.uid},[n<t.children.length-1?Re("div",{class:"absolute left-0 top-0 bottom-0 border-l border-neutral-300 dark:border-neutral-700"}):Re("div",{class:"absolute left-0 top-0 h-3 border-l border-neutral-300 dark:border-neutral-700"}),Re("div",{class:"absolute left-0 top-3 w-4 border-t border-neutral-300 dark:border-neutral-700"}),Re("div",{class:"pl-5"},[Re("div",{class:"flex items-center gap-2 py-1.5"},[Re("span",{class:"text-neutral-600 dark:text-neutral-400"},a.name),Re(ft,{variant:t.getTypeColor(a.type),size:"sm"},()=>a.type),a.isDuplicate?null:a.existsGlobally?Re("span",{class:"ml-auto text-xs text-amber-600 dark:text-amber-400"},"already exists"):Re("span",{class:"ml-auto text-xs text-emerald-600 dark:text-emerald-400"},"will unpack")]),a.children.length>0?Re(ia,{children:a.children,getTypeColor:t.getTypeColor}):null])])))}}),$p=fe({__name:"UnpackTree",props:{analysis:{}},setup(t){const a=t,n=O(()=>{const i=a.analysis,c=[];let g=0;for(const b of i.items)c.push({...b,uid:`${b.type}:${b.name}:${g++}`});const y=new Map,v=[];for(const b of c)b.parentKey?(y.has(b.parentKey)||y.set(b.parentKey,[]),y.get(b.parentKey).push(b)):v.push(b);const f=new Set,h=b=>{const u=`${b.type}:${b.name}`,x=f.has(u);f.add(u);const p=[],k=y.get(u)||[];for(const M of k)p.push(h(M));return{name:b.name,type:b.type,existsGlobally:b.existsGlobally,action:b.action,children:p,uid:b.uid,isDuplicate:x}},_=[];for(const b of v)b.type==="agent"&&_.push(h(b));if(_.length===0)for(const b of v)_.push(h(b));return _}),s=i=>{switch(i){case"agent":return"accent";case"prompt":return"secondary";case"tool":return"success";case"model":return"warning";case"hook":return"default"}},l=O(()=>{const i=new Set;for(const c of a.analysis.items)i.add(`${c.type}:${c.name}`);return i.size}),d=O(()=>{const i=new Set;let c=0;for(const g of a.analysis.items){const y=`${g.type}:${g.name}`;i.has(y)||(i.add(y),g.existsGlobally||c++)}return c});return(i,c)=>(r(),o("div",gp,[e("div",bp,S(d.value)+" of "+S(l.value)+" items will be unpacked ",1),(r(!0),o(he,null,we(n.value,g=>(r(),o("div",{key:g.uid},[e("div",xp,[e("span",yp,S(g.name),1),w($(ft),{variant:s(g.type),size:"sm"},{default:j(()=>[X(S(g.type),1)]),_:2},1032,["variant"]),g.existsGlobally?(r(),o("span",kp," already exists ")):(r(),o("span",wp," will unpack "))]),(r(),N(Ue($(ia)),{children:g.children,"get-type-color":s},null,8,["children"]))]))),128)),n.value.length===0?(r(),o("div",_p," No items found in this package. ")):T("",!0)]))}}),Cp={key:0,class:"flex items-center justify-center py-12"},Sp={key:1,class:"py-4"},Tp={key:2,class:"py-4"},Ip={class:"space-y-2"},zp={class:"text-sm opacity-80"},Mp={key:0,class:"text-sm opacity-80"},Vp={key:1,class:"text-sm opacity-80"},Ep={key:3,class:"space-y-4"},Lp={class:"text-sm text-neutral-600 dark:text-neutral-400"},Pp={class:"font-mono"},Ap={class:"list-disc list-inside space-y-1"},jp={class:"border border-neutral-200 dark:border-neutral-700 rounded-lg p-4 bg-neutral-50 dark:bg-neutral-900/50 max-h-80 overflow-y-auto"},Dp={key:2,class:"flex items-center gap-2"},Rp={class:"flex items-center gap-2 cursor-pointer"},Op={class:"flex justify-between"},Up=fe({__name:"UnpackModal",props:{modelValue:{type:Boolean},agent:{}},emits:["update:modelValue","unpacked"],setup(t,{emit:a}){const n=t,s=a,l=O({get:()=>n.modelValue,set:x=>s("update:modelValue",x)}),d=m(null),i=m(!1),c=m(!1),g=m(null),y=m(null),v=m(!1);xe(()=>n.modelValue,async x=>{x&&n.agent?.packageId?await f():(d.value=null,g.value=null,y.value=null,v.value=!1)});const f=async()=>{if(n.agent?.packageId){i.value=!0,g.value=null;try{const x=await fetch(ge(`/api/unpack/${encodeURIComponent(n.agent.packageId)}/analyze`)),p=await x.json();if(!x.ok){g.value=p.error||"Failed to analyze package";return}d.value=p}catch(x){g.value=x instanceof Error?x.message:"Failed to analyze package"}finally{i.value=!1}}},h=async()=>{if(!(!n.agent?.packageId||!d.value)){c.value=!0,g.value=null,y.value=null;try{const x=d.value.items.filter((M,R,W)=>W.findIndex(Z=>Z.type===M.type&&Z.name===M.name)===R).map(M=>({name:M.name,type:M.type,action:M.existsGlobally?"skip":"generate"})),p=await fetch(ge(`/api/unpack/${encodeURIComponent(n.agent.packageId)}`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({itemSelections:x,deletePackage:v.value})}),k=await p.json();if(!p.ok){g.value=k.error||"Failed to unpack agent";return}y.value={success:!0,filesGenerated:k.filesGenerated,filesSkipped:k.filesSkipped,packageDeleted:k.packageDeleted},setTimeout(()=>{s("unpacked")},1500)}catch(x){g.value=x instanceof Error?x.message:"Failed to unpack agent"}finally{c.value=!1}}},_=()=>{l.value=!1},b=O(()=>{if(!d.value)return 0;const x=new Set;let p=0;for(const k of d.value.items){const M=`${k.type}:${k.name}`;x.has(M)||(x.add(M),k.existsGlobally||p++)}return p}),u=O(()=>d.value?.source==="local");return(x,p)=>(r(),N(He,{modelValue:l.value,"onUpdate:modelValue":p[1]||(p[1]=k=>l.value=k),title:`Unpack: ${t.agent?.title||t.agent?.id||""}`,width:"max-w-2xl","min-height":"min-h-[20rem]"},{footer:j(()=>[e("div",Op,[w($(De),{variant:"ghost",onClick:_},{default:j(()=>[...p[6]||(p[6]=[X(" Cancel ",-1)])]),_:1}),w($(De),{variant:"primary",disabled:i.value||c.value||!d.value||y.value?.success||b.value===0,onClick:h},{default:j(()=>[c.value?(r(),o(he,{key:0},[w(Ve,{size:"sm",class:"mr-2"}),p[7]||(p[7]=X(" Unpacking... ",-1))],64)):(r(),o(he,{key:1},[X(" Unpack "+S(b.value)+" "+S(b.value===1?"item":"items"),1)],64))]),_:1},8,["disabled"])])]),default:j(()=>[i.value?(r(),o("div",Cp,[w(Ve,{size:"lg"})])):g.value&&!d.value?(r(),o("div",Sp,[w($(Fe),{variant:"error"},{default:j(()=>[X(S(g.value),1)]),_:1})])):y.value?.success?(r(),o("div",Tp,[w($(Fe),{variant:"success"},{default:j(()=>[e("div",Ip,[p[2]||(p[2]=e("p",{class:"font-medium"},"Agent unpacked successfully!",-1)),e("p",zp,S(y.value.filesGenerated?.length||0)+" files unpacked ",1),(y.value.filesSkipped?.length||0)>0?(r(),o("p",Mp,S(y.value.filesSkipped?.length)+" files skipped (already exist) ",1)):T("",!0),y.value.packageDeleted?(r(),o("p",Vp," Package was deleted from agents/packed/ ")):T("",!0)])]),_:1})])):d.value?(r(),o("div",Ep,[e("div",Lp,[e("p",null,[p[3]||(p[3]=X("Package: ",-1)),e("span",Pp,S(d.value.packageId),1),X(" v"+S(d.value.version),1)]),e("p",null,"Source: "+S(d.value.source==="npm"?"npm package":"local (agents/packed/)"),1)]),g.value?(r(),N($(Fe),{key:0,variant:"error"},{default:j(()=>[X(S(g.value),1)]),_:1})):T("",!0),d.value.warnings.length>0?(r(),N($(Fe),{key:1,variant:"warning"},{default:j(()=>[e("ul",Ap,[(r(!0),o(he,null,we(d.value.warnings,k=>(r(),o("li",{key:k},S(k),1))),128))])]),_:1})):T("",!0),e("div",jp,[w($p,{analysis:d.value},null,8,["analysis"])]),u.value?(r(),o("div",Dp,[e("label",Rp,[Ae(e("input",{"onUpdate:modelValue":p[0]||(p[0]=k=>v.value=k),type:"checkbox",class:"w-4 h-4 rounded border-neutral-300 dark:border-neutral-600 text-primary-600 focus:ring-primary-500"},null,512),[[Gt,v.value]]),p[4]||(p[4]=e("span",{class:"text-sm text-neutral-700 dark:text-neutral-300"},"Delete package after unpacking",-1))]),p[5]||(p[5]=e("span",{class:"text-xs text-neutral-500"},"(removes from agents/packed/)",-1))])):T("",!0)])):T("",!0)]),_:1},8,["modelValue","title"]))}}),Bp={key:0,class:"space-y-4"},Fp={class:"space-y-2"},Np={class:"font-medium"},qp={key:0,class:"text-sm opacity-80"},Hp={key:1,class:"text-sm opacity-70"},Wp={key:2,class:"text-sm"},Kp=["href"],Jp={key:0,class:"space-y-2"},Yp={class:"text-xs bg-neutral-100 dark:bg-neutral-800 p-3 rounded-md overflow-x-auto max-h-40 whitespace-pre-wrap"},Gp={key:1,class:"space-y-4"},Zp={class:"space-y-3"},Xp={key:0,class:"flex items-center gap-2 text-neutral-500"},Qp={key:2,class:"p-4 rounded-lg border border-neutral-200 dark:border-neutral-700 bg-neutral-50 dark:bg-neutral-900/50"},em={class:"flex items-center gap-3 mb-3"},tm={class:"text-lg font-semibold text-neutral-900 dark:text-neutral-100"},rm={key:0,class:"text-sm text-neutral-600 dark:text-neutral-400 mb-3"},am={key:1,class:"mt-3"},om=["innerHTML"],nm={key:0,class:"border-neutral-200 dark:border-neutral-700"},lm={key:1,class:"flex items-center gap-2 text-neutral-500"},sm={class:"space-y-2 text-sm"},im={class:"bg-neutral-200 dark:bg-neutral-700 px-1 rounded"},um={class:"list-decimal list-inside space-y-1 ml-2"},dm={class:"whitespace-pre-wrap text-sm"},cm={class:"space-y-2"},pm={class:"flex items-center gap-4"},mm={class:"flex items-center gap-2 cursor-pointer"},vm={class:"flex items-center gap-2 cursor-pointer"},fm={key:0},hm={key:0,class:"mt-1 text-xs text-red-500"},gm={class:"flex items-center gap-2 cursor-pointer"},bm={class:"flex justify-between"},xm="https://registry.npmjs.org",ym=fe({__name:"PublishModal",props:{modelValue:{type:Boolean},packageId:{},outputPath:{}},emits:["update:modelValue","published"],setup(t,{emit:a}){Vt.setOptions({gfm:!0,breaks:!0});const n=t,s=a,l=O({get:()=>n.modelValue,set:L=>s("update:modelValue",L)}),d=m(null),i=m(!1),c=m(null),g=m(!1),y=m(null),v=m(!1),f=O(()=>d.value?.readme?Vt(d.value.readme):""),h=m(""),_=m("default"),b=m(""),u=m(!1),x=m(!1),p=m(null),k=m(null),M=m(null),R=m(null),W=async()=>{i.value=!0,c.value=null;try{const L=await fetch(ge(`/api/pack/${encodeURIComponent(n.packageId)}/packed-info`));if(L.ok)d.value=await L.json();else{const C=await L.json();c.value=C.error||"Failed to load package info"}}catch(L){console.error("Failed to fetch package info:",L),c.value=L instanceof Error?L.message:"Failed to load package info"}finally{i.value=!1}},Z=async()=>{v.value=!0;try{const L=await fetch(ge("/api/pack/npm-token-status"));L.ok&&(y.value=await L.json())}catch(L){console.error("Failed to fetch npm token status:",L)}finally{v.value=!1}};xe(()=>n.modelValue,L=>{L&&(h.value="",_.value="default",b.value="",u.value=!1,p.value=null,k.value=null,M.value=null,R.value=null,y.value=null,d.value=null,c.value=null,g.value=!1,W(),Z())});const V=L=>y.value?.hasToken?null:!L||L.trim().length===0?"npm token is required":L.trim().length<10?"Token appears to be too short":null,P=L=>{if(!L)return null;try{return new URL(L).protocol!=="https:"?"Registry must use HTTPS":null}catch{return"Invalid URL format"}};xe(h,L=>{L&&(M.value=V(L))}),xe(b,L=>{_.value==="custom"&&L&&(R.value=P(L))}),xe(_,L=>{L==="default"?R.value=null:b.value&&(R.value=P(b.value))});const J=O(()=>_.value==="default"?xm:b.value),Q=O(()=>{const L=y.value?.hasToken||!V(h.value),C=_.value==="default"||!P(b.value);return L&&C}),le=async()=>{if(y.value?.hasToken||(M.value=V(h.value)),_.value==="custom"&&(R.value=P(b.value)),!(M.value||R.value)){x.value=!0,p.value=null,k.value=null;try{const L={registry:J.value,dryRun:u.value};h.value.trim()&&(L.token=h.value.trim());const C=await fetch(ge(`/api/pack/${encodeURIComponent(n.packageId)}/publish`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(L)}),I=await C.json();if(!C.ok){p.value=I.error||"Failed to publish package",I.output&&(p.value+=`
|
|
35
35
|
|
|
36
|
-
`+V.output);return}_.value={success:!0,packageName:V.packageName,version:V.version,output:V.output,url:V.url,tokenSource:V.tokenSource},d.value||i("published",{packageName:V.packageName,version:V.version,url:V.url})}catch(E){g.value=E instanceof Error?E.message:"Failed to publish package"}finally{k.value=!1}}},me=()=>{l.value=!1},Q=()=>d.value?"Dry run completed successfully!":"Package published successfully!";return(E,$)=>(r(),q(He,{modelValue:l.value,"onUpdate:modelValue":$[6]||($[6]=V=>l.value=V),title:"Publish to npm",width:"max-w-lg","min-height":"min-h-[16rem]"},{footer:j(()=>[e("div",pm,[w(S(De),{variant:"ghost",onClick:me},{default:j(()=>[X(C(_.value?.success?"Close":"Cancel"),1)]),_:1}),_.value?.success?T("",!0):(r(),q(S(De),{key:0,variant:"primary",disabled:k.value||c.value||!ee.value,onClick:ue},{default:j(()=>[k.value?(r(),n(fe,{key:0},[w(Ee,{size:"sm",class:"mr-2"}),$[22]||($[22]=X(" Publishing... ",-1))],64)):(r(),n(fe,{key:1},[X(C(d.value?"Validate":"Publish"),1)],64))]),_:1},8,["disabled"]))])]),default:j(()=>[_.value?.success?(r(),n("div",Ap,[w(S(Fe),{variant:d.value?"info":"success"},{default:j(()=>[e("div",jp,[e("p",Dp,C(Q()),1),_.value.packageName?(r(),n("p",Op," Package: "+C(_.value.packageName)+"@"+C(_.value.version),1)):T("",!0),_.value.tokenSource==="environment"?(r(),n("p",Rp," Token: from NPM_TOKEN environment variable ")):T("",!0),_.value.url&&!d.value?(r(),n("p",Up,[e("a",{href:_.value.url,target:"_blank",rel:"noopener noreferrer",class:"text-primary-600 dark:text-primary-400 hover:underline"}," View on npm ",8,Bp)])):T("",!0)])]),_:1},8,["variant"]),_.value.output?(r(),n("div",Fp,[$[7]||($[7]=e("p",{class:"text-sm font-medium text-neutral-700 dark:text-neutral-300"},"Output:",-1)),e("pre",Np,C(_.value.output),1)])):T("",!0)])):(r(),n("div",qp,[e("div",Hp,[s.value?(r(),n("div",Wp,[w(Ee,{size:"sm"}),$[8]||($[8]=e("span",{class:"text-sm"},"Loading package info...",-1))])):m.value?(r(),q(S(Fe),{key:1,variant:"error"},{default:j(()=>[X(C(m.value),1)]),_:1})):u.value?(r(),n("div",Kp,[e("div",Jp,[e("h3",Yp,C(u.value.packageName),1),w(S(ft),{variant:"secondary"},{default:j(()=>[X("v"+C(u.value.version),1)]),_:1}),u.value.license?(r(),q(S(ft),{key:0,variant:"default"},{default:j(()=>[X(C(u.value.license),1)]),_:1})):T("",!0)]),u.value.author?(r(),n("p",Gp," by "+C(u.value.author),1)):T("",!0),u.value.readme?(r(),n("div",Zp,[e("button",{type:"button",class:"flex items-center gap-2 text-sm font-medium text-neutral-600 dark:text-neutral-400 hover:text-neutral-800 dark:hover:text-neutral-200",onClick:$[0]||($[0]=V=>h.value=!h.value)},[(r(),q(Ue(h.value?S(nt):S(vt)),{class:"w-4 h-4"})),$[9]||($[9]=X(" README ",-1))]),h.value?(r(),n("div",{key:0,class:"mt-2 prose prose-sm dark:prose-invert max-w-none p-3 rounded-md border border-neutral-200 dark:border-neutral-700 bg-white dark:bg-neutral-800 max-h-[200px] overflow-y-auto",innerHTML:f.value},null,8,Xp)):T("",!0)])):T("",!0)])):T("",!0)]),u.value?(r(),n("hr",Qp)):T("",!0),c.value?(r(),n("div",em,[w(Ee,{size:"sm"}),$[10]||($[10]=e("span",{class:"text-sm"},"Checking npm token configuration...",-1))])):x.value?.hasToken?(r(),q(S(Fe),{key:2,variant:"success"},{default:j(()=>[...$[11]||($[11]=[e("p",{class:"text-sm"},[e("strong",null,"NPM_TOKEN found"),X(" in your environment. Your token will be used automatically. ")],-1)])]),_:1})):x.value&&!x.value.hasToken?(r(),q(S(Fe),{key:3,variant:"warning"},{default:j(()=>[e("div",tm,[$[17]||($[17]=e("p",null,[e("strong",null,"No NPM_TOKEN configured.")],-1)),e("p",null,[$[12]||($[12]=X("To publish packages, create an npm token and add it to your ",-1)),e("code",rm,C(x.value.envFile),1),$[13]||($[13]=X(" file:",-1))]),e("ol",am,[$[15]||($[15]=e("li",null,[X("Run: "),e("code",{class:"bg-neutral-200 dark:bg-neutral-700 px-1 rounded"},"npm token create")],-1)),e("li",null,[X("Add to "+C(x.value.envFile)+": ",1),$[14]||($[14]=e("code",{class:"bg-neutral-200 dark:bg-neutral-700 px-1 rounded"},"NPM_TOKEN=npm_xxxxx",-1))]),$[16]||($[16]=e("li",null,"Restart the dev server",-1))]),$[18]||($[18]=e("p",{class:"pt-2"},"Or enter a token below for this session only:",-1))])]),_:1})):T("",!0),g.value?(r(),q(S(Fe),{key:4,variant:"error"},{default:j(()=>[e("pre",om,C(g.value),1)]),_:1})):T("",!0),!x.value?.hasToken&&!c.value?(r(),q(S(ct),{key:5,label:"npm Token",error:L.value||void 0,"help-text":"Create a token at npmjs.com/settings/tokens",required:!x.value?.hasToken},{default:j(()=>[Ae(e("input",{"onUpdate:modelValue":$[1]||($[1]=V=>y.value=V),type:"password",autocomplete:"off",class:ne(["w-full px-3 py-2 rounded-md border text-sm font-mono bg-white dark:bg-neutral-800 border-neutral-300 dark:border-neutral-600 text-neutral-900 dark:text-neutral-100 placeholder-neutral-400 dark:placeholder-neutral-500 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent",{"border-red-500 dark:border-red-500":L.value}]),placeholder:"npm_xxxxxxxxxxxx"},null,2),[[Qe,y.value]])]),_:1},8,["error","required"])):T("",!0),w(S(ct),{label:"Registry"},{default:j(()=>[e("div",nm,[e("div",lm,[e("label",sm,[Ae(e("input",{"onUpdate:modelValue":$[2]||($[2]=V=>b.value=V),type:"radio",value:"default",class:"text-primary-500 focus:ring-primary-500"},null,512),[[rr,b.value]]),$[19]||($[19]=e("span",{class:"text-sm text-neutral-700 dark:text-neutral-300"},"npm (default)",-1))]),e("label",im,[Ae(e("input",{"onUpdate:modelValue":$[3]||($[3]=V=>b.value=V),type:"radio",value:"custom",class:"text-primary-500 focus:ring-primary-500"},null,512),[[rr,b.value]]),$[20]||($[20]=e("span",{class:"text-sm text-neutral-700 dark:text-neutral-300"},"Custom registry",-1))])]),b.value==="custom"?(r(),n("div",um,[Ae(e("input",{"onUpdate:modelValue":$[4]||($[4]=V=>v.value=V),type:"url",class:ne(["w-full px-3 py-2 rounded-md border text-sm bg-white dark:bg-neutral-800 border-neutral-300 dark:border-neutral-600 text-neutral-900 dark:text-neutral-100 placeholder-neutral-400 dark:placeholder-neutral-500 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent",{"border-red-500 dark:border-red-500":O.value}]),placeholder:"https://registry.example.com"},null,2),[[Qe,v.value]]),O.value?(r(),n("p",dm,C(O.value),1)):T("",!0)])):T("",!0)])]),_:1}),e("label",cm,[Ae(e("input",{"onUpdate:modelValue":$[5]||($[5]=V=>d.value=V),type:"checkbox",class:"rounded text-primary-500 focus:ring-primary-500"},null,512),[[Jt,d.value]]),$[21]||($[21]=e("span",{class:"text-sm text-neutral-700 dark:text-neutral-300"}," Dry run (validate without publishing) ",-1))])]))]),_:1},8,["modelValue"]))}}),fm={},hm={class:"p-8 w-full max-w-7xl mx-auto"};function gm(t,o){return r(),n("div",hm,[je(t.$slots,"default")])}const pt=Xe(fm,[["render",gm]]),bm={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function xm(t,o){return r(),n("svg",bm,[...o[0]||(o[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"},null,-1)])])}const jt=Te({name:"lucide-plus",render:xm}),ym=ve({__name:"AgentsView",setup(t){const o=bt(),a=ut(),i=p(!1),l=p("add"),u=p(null),s=p(null),m=p(null),h=p(!1),x=p(null),c=p(!1),f=p(null),y=p(!1),b=p(null);ge(()=>a.query.refresh,()=>{a.query.refresh&&(s.value?.refresh(),o.replace({path:"/agents",query:{}}))});const v=()=>{l.value="add",u.value=null,m.value=null,i.value=!0},d=z=>{l.value="edit",u.value=z,m.value=null,i.value=!0},k=async z=>{m.value=null;try{const P=l.value==="edit"&&u.value?.id,{originalName:G,...ee}=z,ue=he(P?`/api/agents/${encodeURIComponent(u.value.id)}`:"/api/agents"),Q=await fetch(ue,{method:P?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ee)});if(Q.ok)s.value?.refresh(),i.value=!1,u.value=null;else{const E=await Q.json();m.value=E.error||`Failed to ${P?"update":"create"} agent`}}catch(P){console.error(`Error ${l.value==="edit"?"updating":"creating"} agent:`,P),m.value=`Failed to ${l.value==="edit"?"update":"create"} agent`}},g=z=>{x.value=z,h.value=!0},_=()=>{h.value=!1,x.value=null,s.value?.refresh()},L=z=>{f.value=z,c.value=!0},O=()=>{c.value=!1,f.value=null,s.value?.refresh()},W=z=>{b.value=z,y.value=!0},J=()=>{y.value=!1,b.value=null};return(z,P)=>(r(),q(pt,null,{default:j(()=>[w(Gc,{ref_key:"dataTableRef",ref:s,title:"Agents",description:"Configure and manage your AI agents.","primary-action":{label:"Create Agent",icon:S(jt),handler:v},onAdd:v,onEdit:d,onPack:g,onUnpack:L,onPublish:W},null,8,["primary-action"]),w(D0,{modelValue:i.value,"onUpdate:modelValue":P[0]||(P[0]=G=>i.value=G),mode:l.value,editAgent:u.value,apiError:m.value,onSave:k},null,8,["modelValue","mode","editAgent","apiError"]),w(dp,{modelValue:h.value,"onUpdate:modelValue":P[1]||(P[1]=G=>h.value=G),agent:x.value,onPacked:_},null,8,["modelValue","agent"]),w(Pp,{modelValue:c.value,"onUpdate:modelValue":P[2]||(P[2]=G=>c.value=G),agent:f.value,onUnpacked:O},null,8,["modelValue","agent"]),w(vm,{modelValue:y.value,"onUpdate:modelValue":P[3]||(P[3]=G=>y.value=G),"package-id":b.value?.packageId??"","output-path":"agents/packed/"+(b.value?.packageId??""),onPublished:J},null,8,["modelValue","package-id","output-path"])]),_:1}))}});function km(t){const{limit:o=50,offset:a=0,agentId:i=null,userId:l=null,search:u=null,startDate:s=null,endDate:m=null,autoFetch:h=!0}=t||{},x=U(()=>{const L=new URLSearchParams,O=typeof o=="number"?o:o.value,W=typeof a=="number"?a:a.value,J=typeof i=="string"?i:i?.value,z=typeof l=="string"?l:l?.value,P=typeof u=="string"?u:u?.value,G=typeof s=="number"?s:s?.value,ee=typeof m=="number"?m:m?.value;return L.append("limit",O.toString()),L.append("offset",W.toString()),J&&L.append("agent_id",J),z&&L.append("user_id",z),P&&L.append("search",P),G&&L.append("startDate",G.toString()),ee&&L.append("endDate",ee.toString()),he(`/api/threads?${L.toString()}`)}),{data:c,error:f,isFetching:y,isFinished:b,execute:v,abort:d}=Ne(x,{immediate:h,refetch:!0}).get().json(),k=U(()=>c.value?.threads||[]),g=U(()=>c.value?.total||0),_=U(()=>c.value?.hasMore||!1);return{threads:k,total:g,hasMore:_,error:f,isFetching:y,isFinished:b,refetch:v,abort:d}}function Qt(t){const o=U(()=>!!(typeof t=="string"?t:t?.value)),a=U(()=>{const c=typeof t=="string"?t:t?.value;return he(c?`/api/threads/${c}`:"/api/threads/placeholder")}),{data:i,error:l,isFetching:u,isFinished:s,execute:m,abort:h}=Ne(a,{immediate:!1,refetch:!0}).get().json();return ge(o,c=>{c&&m()},{immediate:!0}),{thread:U(()=>i.value?{id:i.value.thread.id,agent_id:i.value.thread.agent_id,user_id:i.value.thread.user_id,tags:i.value.thread.tags||[],created_at:i.value.thread.created_at,agent:i.value.agent||{id:"",title:"Unknown",type:"unknown"},stats:i.value.stats}:null),error:l,isFetching:u,isFinished:s,refetch:m,abort:h}}function oa(){const t=he("/api/agents"),{data:o,error:a,isFetching:i,isFinished:l,execute:u}=Ne(t,{immediate:!0}).get().json();return{agents:U(()=>o.value?.agents||[]),error:a,isFetching:i,isFinished:l,refetch:u}}function wm(t){const{autoConnect:o=!0,onEvent:a}=t||{},i=p(null),l=p(!1),u=p(null);let s=0,m=null,h=null,x=!0;const c=3e4,f=3e4,y=()=>{m&&(clearTimeout(m),m=null),h&&(clearInterval(h),h=null)},b=()=>{h&&clearInterval(h),h=setInterval(()=>{i.value&&i.value.readyState===WebSocket.OPEN&&i.value.send("ping")},f)},v=()=>{if(!x)return;const _=Math.min(1e3*Math.pow(2,s),c);s++,console.log(`[AgentBuilderEvents] Scheduling reconnect in ${_}ms (attempt ${s})`),m=setTimeout(()=>{x&&d()},_)},d=()=>{i.value&&i.value.close();const _=window.location.protocol==="https:"?"wss:":"ws:",L=window.location.host;let O=`${_}//${L}${he("/api/events")}`;const W=localStorage.getItem("auth_token");W&&(O+=`?token=${encodeURIComponent(W)}`);try{i.value=new WebSocket(O),i.value.onopen=()=>{l.value=!0,u.value=null,s=0,b(),console.log("[AgentBuilderEvents] WebSocket connected")},i.value.onmessage=J=>{try{if(typeof J.data=="string"&&J.data==="pong")return;const z=JSON.parse(J.data);a&&a(z)}catch(z){console.error("[AgentBuilderEvents] Failed to parse WebSocket message:",z)}},i.value.onerror=J=>{u.value="WebSocket connection error",console.error("[AgentBuilderEvents] WebSocket error:",J)},i.value.onclose=()=>{l.value=!1,y(),console.log("[AgentBuilderEvents] WebSocket disconnected"),v()}}catch(J){u.value=J.message||"Failed to create WebSocket",console.error("[AgentBuilderEvents] WebSocket creation error:",J),v()}},k=()=>{x=!0,s=0,d()},g=()=>{x=!1,y(),i.value&&(i.value.close(),i.value=null),l.value=!1,s=0};return o&&k(),Ye(()=>{g()}),{wsConnected:l,wsError:u,connect:k,disconnect:g}}function _m(t){const a=Date.now()*1e3-t,i=Math.floor(a/1e6);if(i<60)return i===1?"1 second ago":`${i} seconds ago`;const l=Math.floor(i/60);if(l<60)return l===1?"1 minute ago":`${l} minutes ago`;const u=Math.floor(l/60);if(u<24)return u===1?"1 hour ago":`${u} hours ago`;const s=Math.floor(u/24);if(s<30)return s===1?"1 day ago":`${s} days ago`;const m=Math.floor(s/30);if(m<12)return m===1?"1 month ago":`${m} months ago`;const h=Math.floor(m/12);return h===1?"1 year ago":`${h} years ago`}function $m(t){const o=p("");let a=null;const i=()=>typeof t=="function"?t():typeof t=="number"?t:t.value,l=()=>{const u=i();o.value=_m(u);const m=Date.now()*1e3-u,h=Math.floor(m/1e6);a!==null&&(clearInterval(a),a=null),h<60?a=setInterval(l,1e3):h<3600?a=setInterval(l,6e4):h<86400&&(a=setInterval(l,6e5))};return l(),Ye(()=>{a!==null&&clearInterval(a)}),o}const yt=ve({__name:"TimeAgo",props:{timestamp:{}},setup(t){const o=t,a=$m(()=>o.timestamp);return(i,l)=>(r(),n("span",null,C(S(a)),1))}}),Cm={class:"relative inline-flex items-center"},Sm={key:0,class:"inline-block w-2 h-2 rounded-full bg-green-500 dark:bg-green-400"},Tm={key:1,class:"inline-block w-2 h-2 rounded-full bg-neutral-400 dark:bg-neutral-600"},Im={key:0},zm={key:1},er=ve({__name:"StatusDot",props:{connected:{type:Boolean},error:{type:Boolean}},setup(t){const o=p(!1),a=p(null);return(i,l)=>(r(),n("div",Cm,[e("span",{class:"p-0.5 cursor-default outline-none",tabindex:"-1",onMouseenter:l[0]||(l[0]=u=>o.value=!0),onMouseleave:l[1]||(l[1]=u=>o.value=!1)},[t.connected?(r(),n("span",Sm)):(r(),n("span",Tm))],32),w(et,{"enter-active-class":"transition-opacity duration-150","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-100","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:j(()=>[o.value?(r(),n("div",{key:0,ref_key:"popoverRef",ref:a,class:ne(["absolute top-full left-1/2 -translate-x-1/2 mt-1 px-2 py-1 text-xs rounded shadow-lg whitespace-nowrap z-50 border",{"bg-green-50 dark:bg-green-950 border-green-200 dark:border-green-800 text-green-700 dark:text-green-300":t.connected,"bg-neutral-50 dark:bg-neutral-900 border-neutral-200 dark:border-neutral-700 text-neutral-600 dark:text-neutral-400":!t.connected}])},[t.connected?(r(),n("span",Im,"Live - Connected")):(r(),n("span",zm,"Offline"))],2)):T("",!0)]),_:1})]))}}),Vm={class:"relative min-w-0"},Mm={class:"truncate flex-1 text-left"},Em={key:0},Lm=["onClick"],Pm={class:"border-t border-neutral-200 dark:border-neutral-700"},Am={class:"flex items-center justify-between"},jm={class:"space-y-4 date-filter-inputs"},Dm=ve({__name:"DateFilterDropdown",props:{startDate:{},endDate:{}},emits:["update:startDate","update:endDate"],setup(t,{emit:o}){const a=t,i=o,l=p(!1),u=p(!1),s=p(null),m=p(null),h=p(""),x=p(""),c=[{label:"All time",value:"all",getRange:()=>({startDate:null,endDate:null})},{label:"Today",value:"today",getRange:()=>{const z=new Date,P=new Date(z.getFullYear(),z.getMonth(),z.getDate());return{startDate:Math.floor(P.getTime()/1e3),endDate:null}}},{label:"Last 3 days",value:"3days",getRange:()=>{const z=new Date,P=new Date(z.getFullYear(),z.getMonth(),z.getDate()-2);return{startDate:Math.floor(P.getTime()/1e3),endDate:null}}},{label:"Last 7 days",value:"7days",getRange:()=>{const z=new Date,P=new Date(z.getFullYear(),z.getMonth(),z.getDate()-6);return{startDate:Math.floor(P.getTime()/1e3),endDate:null}}},{label:"Last 30 days",value:"30days",getRange:()=>{const z=new Date,P=new Date(z.getFullYear(),z.getMonth(),z.getDate()-29);return{startDate:Math.floor(P.getTime()/1e3),endDate:null}}}],f=U(()=>{if(!a.startDate&&!a.endDate)return"all";for(const z of c){const P=z.getRange();if(P.startDate===a.startDate&&P.endDate===a.endDate)return z.value}return"custom"}),y=U(()=>{if(!a.startDate&&!a.endDate)return"All time";const z=c.find(G=>G.value===f.value);if(z&&f.value!=="custom")return z.label;const P=G=>new Date(G*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric"});return a.startDate&&a.endDate?`${P(a.startDate)} - ${P(a.endDate)}`:a.startDate?`From ${P(a.startDate)}`:a.endDate?`Until ${P(a.endDate)}`:"Custom"}),b=U(()=>a.startDate!==null||a.endDate!==null);function v(){if(!s.value||!m.value)return;const z=s.value.getBoundingClientRect();m.value.style.position="fixed",m.value.style.top=`${z.bottom+8}px`,m.value.style.left=`${z.left}px`;const P=u.value?280:180;m.value.style.minWidth=`${z.width}px`,m.value.style.maxWidth=`${Math.max(z.width,P)}px`,m.value.style.width="auto",m.value.style.margin="0"}function d(){l.value?k():(l.value=!0,Le(()=>{if(m.value&&(m.value.setAttribute("popover","auto"),m.value.addEventListener("toggle",g),"showPopover"in m.value))try{m.value.showPopover()}catch{}v()}))}function k(){if(m.value){if("hidePopover"in m.value)try{m.value.hidePopover()}catch{}m.value.removeEventListener("toggle",g)}l.value=!1,u.value=!1}function g(z){z.target===m.value&&(l.value=z.newState==="open",l.value&&v())}function _(z){const P=z.getRange();i("update:startDate",P.startDate),i("update:endDate",P.endDate),k()}function L(){const z=h.value?Math.floor(new Date(h.value).getTime()/1e3):null,P=x.value?Math.floor(new Date(x.value+"T23:59:59").getTime()/1e3):null;i("update:startDate",z),i("update:endDate",P),k()}function O(z){z.stopPropagation(),i("update:startDate",null),i("update:endDate",null)}const W=z=>{const P=z.target;m.value&&!m.value.contains(P)&&s.value&&!s.value.contains(P)&&k()},J=z=>{z.key==="Escape"&&l.value&&(k(),s.value?.focus())};return Pe(()=>{document.addEventListener("click",W),document.addEventListener("keydown",J),window.addEventListener("resize",v),window.addEventListener("scroll",v,!0)}),Ye(()=>{document.removeEventListener("click",W),document.removeEventListener("keydown",J),window.removeEventListener("resize",v),window.removeEventListener("scroll",v,!0)}),ge(u,z=>{z&&(a.startDate&&(h.value=new Date(a.startDate*1e3).toISOString().split("T")[0]),a.endDate?x.value=new Date(a.endDate*1e3).toISOString().split("T")[0]:x.value=new Date().toISOString().split("T")[0]),Le(v)}),(z,P)=>{const G=Be("FormKit");return r(),n("div",Vm,[e("button",{ref_key:"triggerRef",ref:s,type:"button",onClick:d,class:ne(["w-full flex items-center gap-1 px-2 py-1 text-xs rounded-sm border transition-colors min-w-0 focus:outline-none focus:ring-2 focus:ring-accent-500/30",[b.value?"border-accent-500 bg-accent-50 dark:bg-accent-950/50 text-accent-700 dark:text-accent-300":"border-zinc-300 dark:border-zinc-600 hover:border-accent-400 dark:hover:border-accent-500 bg-white dark:bg-transparent text-zinc-700 dark:text-zinc-300"]])},[w(S(Ta),{size:14,class:"shrink-0 text-zinc-400"}),e("span",Mm,C(y.value),1),b.value?(r(),q(S(Yt),{key:0,size:14,class:"shrink-0 text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-200",onClick:O})):(r(),q(S(nt),{key:1,size:14,class:ne(["shrink-0 text-zinc-400",l.value?"rotate-180":""])},null,8,["class"]))],2),l.value?(r(),n("div",{key:0,ref_key:"popoverRef",ref:m,class:"dropdown-popover z-[9999]"},[w(S(At),{"max-height":u.value?void 0:"max-h-48",shadow:{offsetX:4,offsetY:4,intensity:.3}},{default:j(()=>[u.value?(r(),n("div",{key:1,class:"p-2.5 space-y-2.5",onClick:P[4]||(P[4]=Re(()=>{},["stop"]))},[e("div",Am,[P[6]||(P[6]=e("span",{class:"text-xs font-medium"},"Custom range",-1)),e("button",{type:"button",onClick:P[1]||(P[1]=Re(ee=>u.value=!1,["stop"])),class:"text-[10px] text-neutral-500 hover:text-black dark:hover:text-white"}," ← Back ")]),e("div",jm,[w(G,{modelValue:h.value,"onUpdate:modelValue":P[2]||(P[2]=ee=>h.value=ee),type:"datepicker",label:"From","picker-only":"",popover:"",format:"MMM D, YYYY","value-format":"YYYY-MM-DD",sequence:["day"]},null,8,["modelValue"]),w(G,{modelValue:x.value,"onUpdate:modelValue":P[3]||(P[3]=ee=>x.value=ee),type:"datepicker",label:"To","picker-only":"",popover:"",format:"MMM D, YYYY","value-format":"YYYY-MM-DD",sequence:["day"]},null,8,["modelValue"])]),e("button",{type:"button",onClick:L,class:"w-full py-1.5 text-xs font-medium bg-black dark:bg-white text-white dark:text-black rounded-sm hover:opacity-90 transition-opacity"}," Apply ")])):(r(),n("div",Em,[(r(),n(fe,null,ke(c,ee=>e("button",{key:ee.value,type:"button",onClick:ue=>_(ee),class:ne(["w-full px-2.5 py-1.5 text-left text-xs hover:bg-neutral-100 dark:hover:bg-neutral-800 transition-colors flex items-center gap-2",f.value===ee.value?"bg-accent-50 dark:bg-accent-950/30":""])},[e("span",{class:ne(["w-1.5 h-1.5 rounded-full border border-accent-500",f.value===ee.value?"bg-accent-500":""])},null,2),X(" "+C(ee.label),1)],10,Lm)),64)),e("div",Pm,[e("button",{type:"button",onClick:P[0]||(P[0]=Re(ee=>u.value=!0,["stop"])),class:ne(["w-full px-2.5 py-1.5 text-left text-xs hover:bg-neutral-100 dark:hover:bg-neutral-800 transition-colors flex items-center gap-2",f.value==="custom"?"bg-accent-50 dark:bg-accent-950/30":""])},[e("span",{class:ne(["w-1.5 h-1.5 rounded-full border border-accent-500",f.value==="custom"?"bg-accent-500":""])},null,2),P[5]||(P[5]=X(" Custom range... ",-1))],2)])]))]),_:1},8,["max-height"])],512)):T("",!0)])}}}),Om=Xe(Dm,[["__scopeId","data-v-88032ecc"]]),Rm={class:"flex flex-col flex-1 min-h-0 overflow-visible"},Um={class:"px-4 py-3 border-b border-neutral-300 dark:border-neutral-700"},Bm={class:"flex items-center justify-between"},Fm={class:"flex items-center gap-2"},Nm={key:0,class:"text-xs font-mono text-neutral-500 dark:text-neutral-400"},qm={class:"flex items-center gap-2"},Hm=["title"],Wm={key:0,class:"absolute -top-1 -right-1 w-3.5 h-3.5 flex items-center justify-center text-[8px] font-bold font-mono bg-accent-500 text-white rounded-full"},Km={key:0,class:"bg-neutral-100 dark:bg-neutral-950 border-b border-neutral-200 dark:border-neutral-800"},Jm={class:"p-2"},Ym={class:"bg-white dark:bg-neutral-900 rounded-lg border border-neutral-200 dark:border-neutral-800 p-2.5 space-y-2"},Gm={class:"flex items-center gap-2 w-full"},Zm={class:"flex-1 min-w-0"},Xm={key:0,class:"flex justify-end"},Qm={key:0,class:"p-4 flex justify-center"},ev={key:1,class:"p-4 text-red-600 dark:text-red-400"},tv={key:2,class:"text-neutral-500 dark:text-neutral-400 text-center py-12"},rv={key:1,class:"text-base"},av={key:3},ov=["id","onClick"],nv={class:"flex items-center gap-2 mb-1"},lv={class:"flex-shrink-0 text-neutral-400 dark:text-neutral-500 text-[10px]"},sv={class:"flex items-center gap-2"},iv={class:"text-[10px] text-neutral-400 dark:text-neutral-500 font-mono truncate max-w-[80px]"},uv={key:0,class:"flex flex-wrap gap-1 flex-1 min-w-0"},dv={key:0,class:"text-[10px] text-neutral-400"},cv={key:0,class:"p-3 flex justify-center"},pv={key:1,class:"p-3 text-center text-[10px] text-neutral-400 dark:text-neutral-500"},mv=50,vv=ve({__name:"ThreadListPane",props:{selectedThreadId:{}},emits:["selectThread","collapse","createThread","threadsLoaded"],setup(t,{expose:o,emit:a}){const i=a,l=p(!1),u=p(""),s=p(null),m=p(null),h=p(null),x=p(null),{agents:c,isFetching:f}=oa(),y=U(()=>c.value.map(Y=>({value:Y.name,label:Y.title||Y.name}))),b=p(0),v=p([]),d=p(!1),k=zr(Y=>{s.value=Y||null},300);ge(u,Y=>{k(Y)});const g=U(()=>{let Y=0;return s.value&&Y++,m.value&&Y++,(h.value||x.value)&&Y++,Y});function _(){u.value="",s.value=null,m.value=null,h.value=null,x.value=null}const{threads:L,total:O,hasMore:W,isFetching:J,isFinished:z,error:P,refetch:G}=km({limit:mv,offset:b,search:s,agentId:m,startDate:h,endDate:x});ge([s,m,h,x],()=>{b.value=0,v.value=[],d.value=!1}),ge(L,Y=>{if(b.value===0)v.value=[...Y];else{const R=new Set(v.value.map(M=>M.id)),H=Y.filter(M=>!R.has(M.id));v.value=[...v.value,...H]}d.value=!1});const ee=p([]),ue=p(new Set),me=U(()=>{const Y=v.value.filter(M=>!ue.value.has(M.id)),R=new Set(Y.map(M=>M.id));return[...ee.value.filter(M=>!R.has(M.id)&&!ue.value.has(M.id)),...Y].sort((M,ie)=>ie.created_at-M.created_at)}),Q=p(null);function E(){d.value||J.value||!W.value||(d.value=!0,b.value=v.value.length)}const{arrivedState:$}=Ia(Q,{offset:{bottom:100}});ge(()=>$.bottom,Y=>{Y&&W.value&&!J.value&&!d.value&&E()});const V=async Y=>{if(Y.type==="thread_created"){const R={id:Y.thread.id,agent_id:Y.thread.agent_name,user_id:Y.thread.user_id,tags:Y.thread.tags||[],created_at:Y.thread.created_at,agent:{name:Y.thread.agent_name,title:void 0,type:"ai_human"}};ee.value.unshift(R)}else Y.type==="thread_deleted"&&(ue.value.add(Y.threadId),ee.value=ee.value.filter(R=>R.id!==Y.threadId))},{wsConnected:te,wsError:B}=wm({onEvent:V});ge(()=>b.value,Y=>{Y===0&&(ee.value=[])});const N=p(!1);ge(()=>({threads:v.value,finished:z.value}),({threads:Y,finished:R})=>{R&&!N.value&&Y.length>0&&(N.value=!0,i("threadsLoaded",Y[0]?.id??null))},{immediate:!0}),o({refetch:G});const F=Y=>{i("selectThread",Y)};return(Y,R)=>{const H=Be("FormKit");return r(),n("div",Rm,[e("div",Um,[e("div",Bm,[e("div",Fm,[w(S(Er),{size:18,class:"shrink-0"}),R[7]||(R[7]=e("h2",{class:"text-base font-bold"},"Threads",-1)),!S(J)&&S(O)>0?(r(),n("span",Nm," ("+C(S(O))+") ",1)):T("",!0),w(er,{connected:S(te),error:S(B)},null,8,["connected","error"])]),e("div",qm,[e("button",{onClick:R[0]||(R[0]=M=>l.value=!l.value),type:"button",class:ne(["relative p-1 rounded transition-colors hover:bg-neutral-100 dark:hover:bg-neutral-900",[l.value||g.value>0?"text-accent-600 dark:text-accent-400":""]]),title:l.value?"Hide filters":"Show filters"},[w(S(za),{size:18}),g.value>0?(r(),n("span",Wm,C(g.value),1)):T("",!0)],10,Hm),e("button",{onClick:R[1]||(R[1]=M=>i("createThread")),type:"button",class:"px-2 py-1 text-xs bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity whitespace-nowrap"}," + New "),e("button",{onClick:R[2]||(R[2]=M=>i("collapse")),type:"button",class:"p-1 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",title:"Collapse pane"},[w(S(Lr),{size:20})])])])]),w(et,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0 -translate-y-2 max-h-0","enter-to-class":"opacity-100 translate-y-0 max-h-60","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100 translate-y-0 max-h-60","leave-to-class":"opacity-0 -translate-y-2 max-h-0"},{default:j(()=>[l.value?(r(),n("div",Km,[e("div",Jm,[e("div",Ym,[w(H,{type:"searchInput",modelValue:u.value,"onUpdate:modelValue":R[3]||(R[3]=M=>u.value=M),placeholder:"Search by tag or thread ID...",size:"sm"},null,8,["modelValue"]),e("div",Gm,[e("div",Zm,[w(H,{type:"selectSearch",size:"sm","active-highlight":"",value:m.value||"",options:y.value,placeholder:"All agents","search-placeholder":"Search agents...",loading:S(f),onInput:R[4]||(R[4]=M=>m.value=M||null)},null,8,["value","options","loading"])]),w(Om,{startDate:h.value,"onUpdate:startDate":R[5]||(R[5]=M=>h.value=M),endDate:x.value,"onUpdate:endDate":R[6]||(R[6]=M=>x.value=M),class:"flex-1 min-w-0"},null,8,["startDate","endDate"])]),g.value>0?(r(),n("div",Xm,[e("button",{onClick:_,type:"button",class:"text-xs font-mono text-neutral-500 hover:text-neutral-900 dark:hover:text-neutral-100 transition-colors"}," Clear all ")])):T("",!0)])])])):T("",!0)]),_:1}),e("div",{ref_key:"scrollContainerRef",ref:Q,class:"flex-1 overflow-y-auto text-xs min-h-0"},[S(J)&&v.value.length===0?(r(),n("div",Qm,[w(Ee)])):S(P)?(r(),n("div",ev," Error: "+C(S(P)),1)):me.value.length===0?(r(),n("div",tv,[g.value>0?(r(),n(fe,{key:0},[R[8]||(R[8]=e("p",{class:"text-base mb-2"},"No matching threads",-1)),e("button",{onClick:_,type:"button",class:"text-xs text-accent-600 dark:text-accent-400 hover:underline"}," Clear filters ")],64)):(r(),n("p",rv,"No threads found"))])):(r(),n("div",av,[(r(!0),n(fe,null,ke(me.value,M=>(r(),n("button",{key:M.id,id:`thread-${M.id}`,class:ne(["w-full text-left px-3 py-2.5 border-b border-neutral-200 dark:border-neutral-800 cursor-pointer transition-colors relative hover:bg-neutral-50 dark:hover:bg-neutral-800/50",{"bg-accent-50 dark:bg-accent-950/50 border-l-2 border-l-accent-500":t.selectedThreadId===M.id}]),onClick:ie=>F(M.id)},[e("div",nv,[e("span",{class:ne(["font-medium truncate flex-1 min-w-0",t.selectedThreadId===M.id?"text-accent-700 dark:text-accent-300":""])},C(M.agent.title||M.agent.name),3),e("span",lv,[w(yt,{timestamp:M.created_at*1e6},null,8,["timestamp"])])]),e("div",sv,[e("span",iv,C(M.id.slice(0,8)),1),M.tags.length>0?(r(),n("div",uv,[(r(!0),n(fe,null,ke(M.tags.slice(0,3),ie=>(r(),n("span",{key:ie,class:ne(["inline-block px-1.5 py-0.5 rounded text-[10px] truncate max-w-[60px]",t.selectedThreadId===M.id?"bg-accent-200 dark:bg-accent-900 text-accent-800 dark:text-accent-200":"bg-neutral-200 dark:bg-neutral-800 text-neutral-600 dark:text-neutral-400"])},C(ie),3))),128)),M.tags.length>3?(r(),n("span",dv," +"+C(M.tags.length-3),1)):T("",!0)])):T("",!0)])],10,ov))),128)),d.value||S(J)&&v.value.length>0?(r(),n("div",cv,[w(Ee)])):!S(W)&&me.value.length>0?(r(),n("div",pv," All "+C(S(O))+" threads loaded ",1)):T("",!0)]))],512)])}}});function fv(t,o={}){const a=p(null),i=p(!1),l=p(null);let u=null;try{u=Ur()}catch{}const s=u?.workblocks??U(()=>[]),m=u?.messages??p([]),h=U(()=>u?.status.value==="connected"),x=p(null);u?.loading??p(!1);const c=U(()=>m.value.some(B=>B.status==="pending")),f=p(!1),y=p(0),b=p(!1);function v(B){if(!a.value?.agent)return null;const N=a.value.agent,F=B==="assistant"?"A":"B";return F==="A"&&N.side_a_label?N.side_a_label:F==="B"&&N.side_b_label?N.side_b_label:null}function d(B){return{id:B.id||`att-${B.path||B.name||Math.random().toString(36).slice(2)}`,type:"file",path:B.path||"",name:B.name||B.path?.split("/").pop()||"attachment",mimeType:B.mimeType||B.mediaType||"application/octet-stream",width:B.width,height:B.height,description:B.description}}function k(B){if(B){if(Array.isArray(B))return B.length>0?B.map(d):void 0;try{const N=JSON.parse(B);return Array.isArray(N)&&N.length>0?N.map(d):void 0}catch(N){console.error("Failed to parse attachments:",N);return}}}function g(B,N){const F=[];B.reasoning_content&&F.push({id:`${B.id}-reasoning`,type:"reasoning",content:B.reasoning_content,created_at:B.created_at}),B.content&&F.push({id:`${B.id}-content`,type:"content",content:B.content,created_at:B.created_at});const Y=B.workItems.filter(A=>A.type==="tool_call"),R=B.workItems.filter(A=>A.type==="tool_result"),H=new Map;for(const A of R)A.tool_call_id&&H.set(A.tool_call_id,A);for(const A of Y){const pe=A.tool_call_id||A.id,ce=H.get(pe);let ye="pending";if(ce){const Me=(ce.content||"").toLowerCase(),ae=Me.includes("failed")||Me.includes("error"),I=Me.length<500;ye=ce.status==="error"||ae&&I?"failed":"success"}F.push({id:A.id,type:"tool_call",content:A.name||"",created_at:B.created_at,tool_name:A.name,tool_call_id:pe,tool_arguments:A.content||void 0,response:ce?.content||null,response_status:ye,response_log_id:null,log_id:null})}const M=F.some(A=>A.type==="tool_call"&&A.response_status==="pending"),ie=B.status!=="pending"&&!M;return{type:"work",id:B.id,role:"assistant",items:F,created_at:B.created_at,updated_at:B.created_at,isComplete:ie,sideLabel:v("assistant"),status:B.status}}const _=U(()=>{const B=[],F=s.value.filter(R=>(R.depth??0)===0);let Y=[];for(let R=0;R<F.length;R++){const H=F[R];if(B[B.length-1]?.role,H.type==="workblock"){const ie=g(H);B.push(ie);const A=H;A.attachments&&A.attachments.length>0&&Y.push(...A.attachments.map(d))}else{const ie=H,A=ie.role;if(ie.role==="tool")continue;const pe=k(ie.attachments);let ce;if((Y.length>0||pe)&&(ce=[...Y,...pe||[]],Y=[]),ie.content||A==="system"||ie.status==="pending"||ce?.length){const ye={type:"text",id:ie.id,role:A,content:ie.content||"",attachments:ce?.length?ce:void 0,created_at:ie.created_at,log_id:ie.log_id||null,sideLabel:v(A),isOptimistic:ie.isOptimistic,status:ie.status,silent:ie.silent};B.push(ye)}}}return B});async function L(){if(!t.value){a.value=null;return}try{const B=await fetch(he(`/api/threads/${t.value}`));B.ok&&(a.value=await B.json())}catch(B){console.error("Error fetching thread info:",B)}}async function O(B){if(t.value){if(u?.deleteMessage){await u.deleteMessage(B);return}try{if(!(await fetch(he(`/api/threads/${t.value}/messages/${B}`),{method:"DELETE"})).ok)throw new Error("Failed to delete message")}catch(N){throw N}}}async function W(B,N){if(t.value)try{if(!(await fetch(he(`/api/threads/${t.value}/messages/${B}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:N})})).ok)throw new Error("Failed to update message")}catch(F){throw F}}ge(t,async B=>{B?(i.value=!0,await L(),i.value=!1):a.value=null},{immediate:!0});const J=u?.sendMessage,z=u?.stopExecution,P=u?.attachments??p([]),G=u?.addAttachment??(()=>{}),ee=u?.removeAttachment??(()=>{}),ue=u?.clearAttachments??(()=>{});function me(){console.warn("loadMoreMessages is deprecated - SDK handles all messages")}function Q(){console.warn("connectWebSocket is deprecated - SDK handles WebSocket")}function E(){console.warn("disconnectWebSocket is deprecated - SDK handles WebSocket")}function $(){console.warn("addOptimisticMessage is deprecated - SDK handles optimistic updates")}function V(){console.warn("removeOptimisticMessage is deprecated - SDK handles optimistic updates")}async function te(){console.warn("refetch is deprecated - SDK handles message loading")}return{messages:_,threadInfo:a,isFetching:i,isLoadingMore:b,error:l,wsConnected:h,wsError:x,isExecuting:c,hasMore:f,totalMessages:y,sendMessage:J,stopThread:z,attachments:P,addAttachment:G,removeAttachment:ee,clearAttachments:ue,deleteMessageById:O,updateMessageContent:W,refetch:te,loadMoreMessages:me,connectWebSocket:Q,disconnectWebSocket:E,addOptimisticMessage:$,removeOptimisticMessage:V}}const hv={key:0,class:"absolute inset-0 flex items-center justify-center bg-neutral-100 dark:bg-neutral-800"},gv={key:1,class:"absolute inset-0 flex items-center justify-center bg-neutral-100 dark:bg-neutral-800 text-neutral-400"},bv=["src","alt"],xv={class:"absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center"},yv={key:0,class:"text-white text-[10px]"},kv={class:"text-xs text-neutral-600 dark:text-neutral-300 truncate max-w-[100px]"},wv=ve({__name:"FileAttachment",props:{attachment:{},threadId:{},showRemove:{type:Boolean}},emits:["remove"],setup(t,{emit:o}){const a=t,i=o,l=p(!0),u=p(!1),s=U(()=>a.attachment.mimeType.startsWith("image/")),m=U(()=>!!a.attachment.thumbnailBase64),h=U(()=>{if(!a.threadId||!a.attachment.path)return"";const v=a.attachment.path.startsWith("/")?a.attachment.path.slice(1):a.attachment.path;return he(`/api/threads/${a.threadId}/fs/${v}`)}),x=U(()=>s.value?a.attachment.thumbnailBase64?`data:image/webp;base64,${a.attachment.thumbnailBase64}`:h.value:"");function c(){l.value=!1,u.value=!1}function f(){l.value=!1,u.value=!0}function y(){i("remove",a.attachment.id)}function b(){h.value&&window.open(h.value,"_blank")}return(v,d)=>(r(),n("div",{class:ne(["relative group inline-flex items-center rounded-lg overflow-hidden border border-neutral-200 dark:border-neutral-700",{"w-[104px] h-[104px]":s.value,"px-2 py-1 bg-neutral-100 dark:bg-neutral-800":!s.value,"cursor-pointer":s.value&&h.value}]),onClick:d[0]||(d[0]=k=>s.value&&h.value?b():void 0)},[s.value?(r(),n(fe,{key:0},[l.value&&!u.value&&!m.value?(r(),n("div",hv,[...d[1]||(d[1]=[e("div",{class:"w-4 h-4 border-2 border-neutral-300 border-t-neutral-600 rounded-full animate-spin"},null,-1)])])):T("",!0),u.value&&!m.value?(r(),n("div",gv,[w(S(Pr),{size:24})])):T("",!0),Ae(e("img",{src:x.value||h.value,alt:t.attachment.name,class:"w-full h-full object-cover",onLoad:c,onError:f},null,40,bv),[[Ke,!l.value&&!u.value||m.value]]),e("div",xv,[h.value?(r(),n("span",yv,"Click to view")):T("",!0)])],64)):(r(),n(fe,{key:1},[w(S(Ar),{size:14,class:"text-neutral-500 mr-1 flex-shrink-0"}),e("span",kv,C(t.attachment.name),1)],64)),t.showRemove?(r(),n("button",{key:2,onClick:Re(y,["stop"]),class:"absolute -top-1 -right-1 w-4 h-4 rounded-full bg-red-500 text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity"},[w(S(Yt),{size:10})])):T("",!0)],2))}}),_v=["onMouseenter","onMouseleave","onClick"],$v=["onClick"],Cv={key:0,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"3",stroke:"currentColor",class:"w-3 h-3 text-white"},Sv={key:1,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2.5",stroke:"currentColor",class:"w-3 h-3 text-white"},Tv={key:0,class:"w-full text-center text-xs text-neutral-400 dark:text-neutral-500 py-1"},Iv=["contenteditable","onInput"],zv={key:1,class:"flex gap-1 items-center min-h-[1.5rem]"},Vv={key:0,class:"opacity-50"},Mv={key:1,class:"opacity-50 italic text-neutral-500 dark:text-neutral-400"},Ev={key:0,class:"flex flex-wrap gap-2"},Lv=["onClick","onMouseenter"],Pv={key:0,class:"space-y-1"},Av={class:"flex items-start gap-2"},jv={class:"flex-1 min-w-0"},Dv={key:0,class:"truncate opacity-80"},Ov={key:1,class:"italic opacity-60"},Rv={class:"flex items-center gap-2 pl-5 opacity-60"},Uv={class:"text-[10px]"},Bv={class:"text-[10px]"},Fv={key:1,class:"space-y-2"},Nv={class:"flex items-center gap-2 pb-1 border-b border-current opacity-70"},qv={class:"text-[10px] italic"},Hv={class:"text-[10px] ml-auto"},Wv={key:0,class:"space-y-1"},Kv=["onClick","onMouseenter"],Jv={class:"font-mono text-[11px] flex-shrink-0"},Yv={key:2,class:"text-[10px] opacity-60 px-2 truncate flex-1 min-w-0"},Gv={key:3,class:"text-[10px] text-green-600 dark:text-green-400 ml-auto flex-shrink-0"},Zv={key:0,class:"pl-4 space-y-2 text-[10px]"},Xv={key:0},Qv={class:"w-full border-collapse"},ef={class:"py-0.5 pr-2 opacity-65 align-top"},tf={class:"py-0.5 opacity-85 break-all"},rf={key:1},af=["onClick","onMouseenter"],of={class:"whitespace-pre-wrap break-all"},nf={key:1,class:"text-[10px]"},lf=["onClick"],sf={key:0,class:"mt-1 pl-4 whitespace-pre-wrap break-words opacity-80"},uf={key:2,class:"text-[10px] opacity-80 pl-4 pb-2 break-words"},df=ve({__name:"AgentMessages",props:{messages:{},threadId:{},selectedMessageId:{},selectedLogId:{},hoveredLogId:{},isEditMode:{type:Boolean},selectedForDelete:{},editedMessages:{}},emits:["messageClick","messageHover","selectionChange","messageEdit"],setup(t,{expose:o,emit:a}){const i=t,l=a;function u(R){const H=i.selectedForDelete?.has(R)??!1;l("selectionChange",R,!H)}function s(R,H){const ie=R.target.innerText;l("messageEdit",H,ie)}function m(R){return i.editedMessages?.has(R)??!1}const h=p(new Map);function x(R,H){H?h.value.set(R,H):h.value.delete(R)}function c(R){const H=i.messages.findIndex(M=>M.log_id===R);if(H<=0)return-1;for(let M=H-1;M>=0;M--){const ie=i.messages[M];if(ie.role==="user")return M;if(ie.role==="assistant"&&ie.log_id)break}return-1}function f(R){for(let H=0;H<i.messages.length;H++){const M=i.messages[H];if(M.log_id===R||M.type==="work"&&M.items&&M.items.some(pe=>pe.log_id===R||pe.response_log_id===R))return H}return-1}function y(R,H){const ie=f(R);if(ie===-1)return!1;const A=h.value.get(ie);if(!A)return!1;const pe=i.messages[ie];let ce=null;if(pe.role==="assistant"&&pe.log_id){const ae=c(pe.log_id);ce=ae!==-1?h.value.get(ae):null}const ye=H.getBoundingClientRect(),Me=A.getBoundingClientRect();if(Me.top<ye.top){const D=(ce||A).getBoundingClientRect().top-ye.top-10;H.scrollBy({top:D,behavior:"smooth"})}else if(Me.bottom>ye.bottom){const ae=Me.bottom-ye.bottom+10;H.scrollBy({top:ae,behavior:"smooth"})}else if(ce){const ae=ce.getBoundingClientRect();if(ae.top<ye.top){const I=ae.top-ye.top-10;H.scrollBy({top:I,behavior:"smooth"})}}return!0}function b(R){for(const H of i.messages){if(H.type!=="work")continue;if(H.items.some(A=>A.log_id===R||A.response_log_id===R))return!0}return!1}o({scrollToLogId:y,hasWorkblockForLogId:b});function v(R){const H=i.messages[R];if(H.log_id)return H.log_id;if(H.role==="user")for(let M=R+1;M<i.messages.length;M++){const ie=i.messages[M];if(ie.log_id)return ie.log_id;if(ie.role==="user")break}return null}function d(R,H){return H?v(R)===H:!1}function k(R){const H=v(R);H&&l("messageHover",H)}function g(R){v(R)&&l("messageHover",null)}function _(R){const H=i.messages[R],M=v(R);M&&l("messageClick",H.id,M)}const L=p(new Set),O=p(new Set),W=p(new Set);function J(R){L.value.has(R)?L.value.delete(R):L.value.add(R)}function z(R){O.value.has(R)?O.value.delete(R):O.value.add(R)}function P(R){W.value.has(R)?W.value.delete(R):W.value.add(R)}function G(R){if(!R)return{};try{return JSON.parse(R)}catch{return{raw:R}}}function ee(R){if(!R)return null;const H=G(R),M=Object.keys(H);if(M.length===0)return null;const ie=H[M[0]];return typeof ie=="string"?ie:JSON.stringify(ie)}function ue(R){return new Date(R/1e3).toLocaleTimeString()}function me(R){const H=Math.round(R/1e6);if(H<1)return"< 1s";if(H<60)return`${H}s`;const M=Math.floor(H/60),ie=H%60;return`${M}m ${ie}s`}function Q(R){if(R.status==="pending")return"...";if(!R.isComplete)return"Working...";let H;return R.request_sent_at&&R.response_completed_at?H=R.response_completed_at-R.request_sent_at:H=R.updated_at-R.created_at,`Worked for ${me(H)}`}function E(R){const H=R.filter(M=>M.type==="content");if(H.length===0){const M=R.filter(ie=>ie.type==="reasoning");return M.length>0?M[M.length-1].content:null}return H[H.length-1].content}function $(R){const M=R.trim().split(`
|
|
37
|
-
`)[0];return M.length>60?M.substring(0,60):M}function V(R){return i.selectedMessageId===R.id?!0:i.selectedLogId?R.items.some(H=>H.log_id===i.selectedLogId||H.response_log_id===i.selectedLogId):!1}function te(R){return!!(i.selectedLogId&&(R.log_id===i.selectedLogId||R.response_log_id===i.selectedLogId))}function B(R){return i.hoveredLogId?R.items.some(H=>H.log_id===i.hoveredLogId||H.response_log_id===i.hoveredLogId):!1}function N(R){return!!(i.hoveredLogId&&(R.log_id===i.hoveredLogId||R.response_log_id===i.hoveredLogId))}function F(R){const H=[];for(const M of R.items)M.log_id&&H.push(M.log_id),M.response_log_id&&H.push(M.response_log_id);return H}function Y(R){return R?R.trim():""}return(R,H)=>(r(),n("div",null,[(r(!0),n(fe,null,ke(t.messages,(M,ie)=>(r(),n("div",{key:M.id,ref_for:!0,ref:A=>x(ie,A),class:"flex items-center gap-2 pb-3",onMouseenter:A=>k(ie),onMouseleave:A=>g(ie),onClick:A=>t.isEditMode?u(M.id):_(ie)},[t.isEditMode&&M.role!=="system"?(r(),n("button",{key:0,onClick:Re(A=>u(M.id),["stop"]),class:ne(["flex-shrink-0 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-all",{"border-red-500 bg-red-500":t.selectedForDelete?.has(M.id),"border-green-500 bg-green-500":!t.selectedForDelete?.has(M.id)&&m(M.id),"border-neutral-400 dark:border-neutral-500 bg-transparent hover:border-neutral-500 dark:hover:border-neutral-400":!t.selectedForDelete?.has(M.id)&&!m(M.id)}])},[t.selectedForDelete?.has(M.id)?(r(),n("svg",Cv,[...H[4]||(H[4]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4.5 12.75l6 6 9-13.5"},null,-1)])])):m(M.id)?(r(),n("svg",Sv,[...H[5]||(H[5]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125"},null,-1)])])):T("",!0)],10,$v)):T("",!0),e("div",{class:ne(["flex-1 flex items-center gap-2 min-w-0",{"justify-start":M.role==="assistant","justify-end":M.role==="user","justify-center":M.role==="system","cursor-pointer":v(ie)&&!t.isEditMode}])},[M.type==="text"&&M.role==="system"&&M.content?.includes("Execution stopped")?(r(),n("div",Tv,C(M.content),1)):M.type==="text"?(r(),n("div",{key:1,class:ne(["max-w-[80%] flex flex-col gap-2",{"items-start":M.role==="assistant","items-end":M.role==="user"}])},[e("div",{class:ne(["rounded-2xl px-4 py-2 text-sm transition-all min-h-[2.5rem]",[M.silent?"bg-neutral-300 text-neutral-500 dark:bg-neutral-700 dark:text-neutral-400 opacity-70 border-2 border-dashed border-neutral-400 dark:border-neutral-500":!t.isEditMode&&M.role!=="user"&&d(ie,t.selectedLogId)?"bg-accent-200 text-accent-950 dark:bg-accent-200 dark:text-accent-950 ring-2 ring-accent-400 dark:ring-accent-400":M.role==="assistant"?"bg-neutral-800 text-white dark:bg-neutral-300 dark:text-black":M.role==="user"?"bg-neutral-200 text-black dark:bg-neutral-800 dark:text-white":"bg-neutral-100 text-neutral-600 dark:bg-neutral-900 dark:text-neutral-400 text-xs",{"opacity-60":M.isOptimistic},{"ring-2 ring-accent-400 dark:ring-accent-400 !bg-accent-200 !text-accent-950 dark:!bg-accent-200 dark:!text-accent-950":!t.isEditMode&&M.role!=="user"&&v(ie)&&!M.silent&&!d(ie,t.selectedLogId)&&d(ie,t.hoveredLogId)},{"ring-2 ring-green-500 dark:ring-green-400":t.isEditMode&&m(M.id),"border border-dashed border-neutral-400 dark:border-neutral-500":t.isEditMode&&M.role!=="system"&&!m(M.id)}]])},[M.content||t.isEditMode?(r(),n("div",{key:0,class:"whitespace-pre-wrap break-words text-sm outline-none",contenteditable:t.isEditMode&&M.role!=="system",onInput:A=>s(A,M.id),onClick:H[0]||(H[0]=A=>t.isEditMode&&A.stopPropagation())},C(Y(M.content)),41,Iv)):M.status==="pending"?(r(),n("div",zv,[...H[6]||(H[6]=[e("span",{class:"typing-dot",style:{"animation-delay":"0ms"}},null,-1),e("span",{class:"typing-dot",style:{"animation-delay":"150ms"}},null,-1),e("span",{class:"typing-dot",style:{"animation-delay":"300ms"}},null,-1)])])):T("",!0),M.status!=="pending"?(r(),n("div",{key:2,class:ne(["text-[10px] mt-1 opacity-50 flex gap-2",{"justify-start":M.role==="assistant","justify-end":M.role!=="assistant"}])},[M.sideLabel?(r(),n("span",Vv,C(M.sideLabel),1)):T("",!0),e("span",null,C(ue(M.created_at)),1),M.silent?(r(),n("span",Mv," silent ")):T("",!0)],2)):T("",!0)],2),M.attachments?.length&&t.threadId?(r(),n("div",Ev,[(r(!0),n(fe,null,ke(M.attachments,A=>(r(),q(wv,{key:A.id,attachment:A,threadId:t.threadId},null,8,["attachment","threadId"]))),128))])):T("",!0)],2)):M.type==="work"?(r(),n("div",{key:2,class:ne(["w-full rounded-lg px-3 py-2 text-xs transition-all border overflow-hidden",{"cursor-pointer":!t.isEditMode,"bg-neutral-50 text-neutral-700 border-neutral-200 dark:bg-neutral-900 dark:text-neutral-300 dark:border-neutral-700":M.role==="assistant"&&!M.silent,"bg-accent-50 text-accent-700 border-accent-200 dark:bg-accent-50 dark:text-accent-700 dark:border-accent-200":M.role==="user"&&!M.silent,"bg-neutral-200 text-neutral-500 border-neutral-400 dark:bg-neutral-800 dark:text-neutral-400 dark:border-neutral-600 opacity-70 border-dashed":M.silent,"ring-2 ring-accent-500":!t.isEditMode&&V(M),"ring-2 ring-accent-400":!t.isEditMode&&!V(M)&&B(M)}]),onClick:A=>!t.isEditMode&&(J(M.id),F(M)[0]&&l("messageClick",M.id,F(M)[0])),onMouseenter:A=>!t.isEditMode&&F(M)[0]&&l("messageHover",F(M)[0]),onMouseleave:H[3]||(H[3]=A=>!t.isEditMode&&l("messageHover",null))},[L.value.has(M.id)?(r(),n("div",Fv,[e("div",Nv,[w(S(nt),{size:14,class:"flex-shrink-0"}),e("span",qv,C(Q(M)),1),e("span",Hv,C(M.items.length)+" operation"+C(M.items.length!==1?"s":""),1)]),(r(!0),n(fe,null,ke(M.items,A=>(r(),n("div",{key:A.id,class:"mb-1"},[A.type==="tool_call"?(r(),n("div",Wv,[e("div",{onClick:Re(pe=>{z(A.id),A.log_id&&l("messageClick",M.id,A.log_id)},["stop"]),onMouseenter:Re(pe=>A.log_id&&l("messageHover",A.log_id),["stop"]),onMouseleave:H[1]||(H[1]=Re(pe=>l("messageHover",null),["stop"])),class:ne(["flex items-center gap-2 cursor-pointer hover:opacity-70 transition-opacity min-w-0",{"ring-1 ring-accent-500":te(A),"ring-1 ring-accent-400":!te(A)&&N(A)}])},[O.value.has(A.id)?(r(),q(S(nt),{key:1,size:12,class:"flex-shrink-0 opacity-50"})):(r(),q(S(vt),{key:0,size:12,class:"flex-shrink-0 opacity-50"})),e("span",Jv,C(A.tool_name),1),ee(A.tool_arguments)?(r(),n("span",Yv,C(ee(A.tool_arguments)),1)):T("",!0),A.response_status==="success"?(r(),n("span",Gv,"✓")):A.response_status==="failed"?(r(),q(S(Sr),{key:4,size:12,class:"ml-auto text-red-600 dark:text-red-400"})):T("",!0)],42,Kv),O.value.has(A.id)?(r(),n("div",Zv,[A.tool_arguments?(r(),n("div",Xv,[H[7]||(H[7]=e("div",{class:"font-semibold mb-1 opacity-70"},"Arguments:",-1)),e("table",Qv,[e("tbody",null,[(r(!0),n(fe,null,ke(G(A.tool_arguments),(pe,ce)=>(r(),n("tr",{key:ce,class:"border-b border-current border-opacity-10"},[e("td",ef,C(ce),1),e("td",tf,C(typeof pe=="object"?JSON.stringify(pe):pe),1)]))),128))])])])):T("",!0),A.response?(r(),n("div",rf,[H[8]||(H[8]=e("div",{class:"font-semibold mb-1 opacity-70"},"Response:",-1)),e("div",{class:ne(["opacity-80 cursor-pointer hover:opacity-100",{"ring-1 ring-accent-500":t.selectedLogId&&A.response_log_id===t.selectedLogId,"ring-1 ring-accent-400":t.hoveredLogId&&A.response_log_id===t.hoveredLogId&&A.response_log_id!==t.selectedLogId}]),onClick:Re(pe=>A.response_log_id&&l("messageClick",M.id,A.response_log_id),["stop"]),onMouseenter:Re(pe=>A.response_log_id&&l("messageHover",A.response_log_id),["stop"]),onMouseleave:H[2]||(H[2]=Re(pe=>l("messageHover",null),["stop"]))},[e("div",of,C(Y(A.response)),1)],42,af)])):T("",!0)])):T("",!0)])):A.type==="reasoning"?(r(),n("div",nf,[e("button",{onClick:Re(pe=>P(A.id),["stop"]),class:"flex items-center gap-1 opacity-70 hover:opacity-100 transition-opacity"},[W.value.has(A.id)?(r(),q(S(nt),{key:1,size:12,class:"flex-shrink-0"})):(r(),q(S(vt),{key:0,size:12,class:"flex-shrink-0"})),H[9]||(H[9]=e("span",{class:"font-semibold"},"Reasoning",-1))],8,lf),W.value.has(A.id)?(r(),n("div",sf,C(Y(A.content)),1)):T("",!0)])):A.type==="content"?(r(),n("div",uf,C(Y(A.content)),1)):T("",!0)]))),128))])):(r(),n("div",Pv,[e("div",Av,[w(S(vt),{size:14,class:"flex-shrink-0 mt-0.5 opacity-50"}),e("div",jv,[E(M.items)?(r(),n("div",Dv,C($(E(M.items)))+"... ",1)):(r(),n("div",Ov,C(Q(M)),1))])]),e("div",Rv,[e("span",Uv,C(M.items.length)+" operation"+C(M.items.length!==1?"s":""),1),e("span",Bv,"• "+C(Q(M)),1)])]))],42,Lv)):T("",!0)],2)],40,_v))),128))]))}}),cf=Xe(df,[["__scopeId","data-v-884a0fa7"]]),pf=["onClick"],mf=["value","placeholder","disabled"],vf=ve({__name:"TagInput",props:{modelValue:{},placeholder:{},disabled:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:o}){const a=t,i=o,l=p(""),u=p(null),s=f=>{const y=f.trim().toLowerCase();y&&!a.modelValue.includes(y)&&i("update:modelValue",[...a.modelValue,y]),l.value="",Le(()=>u.value?.focus())},m=f=>{const y=[...a.modelValue];y.splice(f,1),i("update:modelValue",y)},h=f=>{const y=f.target.value;if(y.includes(",")){const b=y.split(",");b.forEach((v,d)=>{d<b.length-1?s(v):l.value=v})}else l.value=y},x=f=>{f.key==="Enter"?(f.preventDefault(),s(l.value)):f.key==="Backspace"&&!l.value&&a.modelValue.length>0&&m(a.modelValue.length-1)},c=()=>{u.value?.focus()};return(f,y)=>(r(),n("div",{class:ne(["flex flex-wrap items-center gap-1.5 min-h-[32px] px-2 py-1.5 bg-white dark:bg-neutral-950 border border-neutral-200 dark:border-neutral-800 rounded-md cursor-text focus-within:ring-2 focus-within:ring-accent-500/20 focus-within:border-accent-500 transition-colors",{"opacity-50 cursor-not-allowed":t.disabled}]),onClick:c},[(r(!0),n(fe,null,ke(t.modelValue,(b,v)=>(r(),n("span",{key:b,class:"inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium bg-accent-100 dark:bg-accent-900/30 text-accent-700 dark:text-accent-300 rounded"},[X(C(b)+" ",1),t.disabled?T("",!0):(r(),n("button",{key:0,type:"button",onClick:Re(d=>m(v),["stop"]),class:"hover:text-accent-900 dark:hover:text-accent-100 transition-colors"},[w(S(Yt),{size:12})],8,pf))]))),128)),e("input",{ref_key:"inputRef",ref:u,type:"text",value:l.value,placeholder:t.modelValue.length===0?t.placeholder:"",disabled:t.disabled,class:"flex-1 min-w-[60px] bg-transparent border-none outline-none text-xs text-neutral-900 dark:text-neutral-100 placeholder:text-neutral-400 disabled:cursor-not-allowed",onInput:h,onKeydown:x},null,40,mf)],2))}}),ff={key:0,class:"overflow-hidden bg-neutral-100 dark:bg-neutral-950"},hf={class:"max-h-[500px] overflow-y-auto p-3 space-y-3"},gf={key:0,class:"flex justify-center py-6"},bf={key:1,class:"text-red-600 dark:text-red-400 text-center py-4 text-xs"},xf={class:"bg-white dark:bg-neutral-900 rounded-lg border border-neutral-200 dark:border-neutral-800 overflow-hidden"},yf={class:"p-3 space-y-2"},kf={class:"text-[10px] text-neutral-500 dark:text-neutral-400"},wf=["title"],_f={class:"flex-1 text-[11px] font-mono text-neutral-600 dark:text-neutral-400 truncate"},$f={class:"flex items-center gap-2"},Cf={class:"flex-1 flex items-center gap-1.5"},Sf={key:1,class:"text-xs text-neutral-700 dark:text-neutral-200"},Tf={class:"text-[9px] px-1.5 py-0.5 rounded bg-neutral-100 dark:bg-neutral-800 text-neutral-500 dark:text-neutral-400 uppercase tracking-wide shrink-0"},If={class:"flex items-start gap-2"},zf={class:"bg-white dark:bg-neutral-900 rounded-lg border border-neutral-200 dark:border-neutral-800 overflow-hidden"},Vf=["disabled"],Mf={key:0,class:"overflow-hidden border-t border-neutral-100 dark:border-neutral-800"},Ef={class:"p-3 space-y-3"},Lf={class:"flex gap-4 text-xs"},Pf={class:"ml-1 font-mono font-semibold text-neutral-800 dark:text-neutral-100"},Af={class:"ml-1 font-mono text-neutral-600 dark:text-neutral-400"},jf={key:0,class:"w-full text-[11px]"},Df=["title"],Of={class:"text-right py-1.5 font-mono text-neutral-600 dark:text-neutral-400"},Rf={class:"text-right py-1.5 font-mono text-neutral-600 dark:text-neutral-400"},Uf={class:"bg-white dark:bg-neutral-900 rounded-lg border border-neutral-200 dark:border-neutral-800 overflow-hidden"},Bf={key:0,class:"overflow-hidden border-t border-neutral-100 dark:border-neutral-800"},Ff={class:"p-3 space-y-3"},Nf={class:"flex items-center gap-2"},qf=["disabled"],Hf={class:"pt-2 border-t border-neutral-100 dark:border-neutral-800"},Wf=["disabled"],Kf=ve({__name:"MetadataSlidePane",props:{threadId:{},show:{type:Boolean}},emits:["close","threadDeleted","editThread","threadUpdated"],setup(t,{emit:o}){const a=t,i=o,{thread:l,isFetching:u,error:s,refetch:m}=Qt(U(()=>a.threadId)),{agents:h,isFetching:x}=oa(),c=p(!1),f=p(!1),y=p(!1),b=p(!1),v=p(!1),d=p(!1),k=p(!1),g=p(!1),_=p("a"),L=p(!1),O=p(""),W=p([]),J=p(!1),z=p(null),P=U(()=>h.value?h.value.filter(N=>N.type==="ai_human").map(N=>({value:N.id,label:N.title})):[]),G=U(()=>l.value?.agent.type==="ai_human"),ee=U(()=>l.value?.agent.type==="dual_ai"),ue=N=>new Date(N*1e3).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}),me=async()=>{l.value&&(await navigator.clipboard.writeText(l.value.id),L.value=!0,setTimeout(()=>{L.value=!1},2e3))},Q=async N=>{if(!(!a.threadId||!N||N===l.value?.agent.id)){y.value=!0;try{const F=await fetch(he(`/api/threads/${a.threadId}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent_id:N})});if(!F.ok){const Y=await F.json();throw new Error(Y.error||"Failed to update agent")}await m(),i("threadUpdated")}catch(F){console.error("Error updating agent:",F),O.value=l.value?.agent.id||""}finally{y.value=!1}}},E=async N=>{if(a.threadId){W.value=N,J.value=!0,b.value=!0;try{const F=await fetch(he(`/api/threads/${a.threadId}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tags:N})});if(!F.ok){const Y=await F.json();throw new Error(Y.error||"Failed to update tags")}i("threadUpdated")}catch(F){console.error("Error updating tags:",F),W.value=l.value?.tags||[]}finally{b.value=!1,J.value=!1}}},$=async()=>{if(v.value){v.value=!1;return}if(a.threadId){k.value=!0,v.value=!0;try{const N=await fetch(he(`/api/threads/${a.threadId}/cost`));if(!N.ok){const F=await N.json();throw new Error(F.error||"Failed to fetch cost breakdown")}z.value=await N.json()}catch(N){console.error("Error fetching cost breakdown:",N),v.value=!1}finally{k.value=!1}}},V=N=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:4,maximumFractionDigits:6}).format(N),te=async()=>{if(a.threadId){g.value=!0;try{const N=await fetch(he(`/api/threads/${a.threadId}/continue`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({side:_.value})});if(!N.ok){const F=await N.json();throw new Error(F.error||"Failed to continue execution")}}catch(N){console.error("Error continuing execution:",N)}finally{g.value=!1}}},B=async()=>{if(a.threadId){f.value=!0;try{const N=await fetch(he(`/api/threads/${a.threadId}`),{method:"DELETE"});if(!N.ok){const F=await N.json();throw new Error(F.error||"Failed to delete thread")}i("threadDeleted",a.threadId)}catch(N){console.error("Error deleting thread:",N)}finally{f.value=!1}}};return ge(()=>l.value,N=>{N&&(O.value=N.agent.id,J.value||(W.value=N.tags||[]))},{immediate:!0}),ge(()=>a.show,N=>{N||(v.value=!1,d.value=!1,z.value=null)}),ge(()=>a.threadId,()=>{v.value=!1,d.value=!1,z.value=null}),(N,F)=>{const Y=Be("FormKit");return r(),q(et,{"enter-active-class":"transition-all duration-300 ease-out","enter-from-class":"max-h-0 opacity-0","enter-to-class":"max-h-[500px] opacity-100","leave-active-class":"transition-all duration-200 ease-in","leave-from-class":"max-h-[500px] opacity-100","leave-to-class":"max-h-0 opacity-0"},{default:j(()=>[t.show&&t.threadId?(r(),n("div",ff,[e("div",hf,[S(u)?(r(),n("div",gf,[w(Ee)])):S(s)?(r(),n("div",bf," Error: "+C(S(s)),1)):S(l)?(r(),n(fe,{key:2},[e("div",xf,[e("div",yf,[e("div",kf,[F[5]||(F[5]=e("span",{class:"font-medium uppercase tracking-wide"},"Created",-1)),F[6]||(F[6]=e("span",{class:"mx-1"},"·",-1)),X(" "+C(ue(S(l).created_at)),1)]),e("div",{class:"flex items-center gap-1 px-2 py-1.5 bg-neutral-50 dark:bg-neutral-950 rounded border border-neutral-200 dark:border-neutral-800 cursor-pointer hover:border-neutral-300 dark:hover:border-neutral-700 transition-colors group",onClick:me,title:L.value?"Copied!":"Click to copy"},[e("code",_f,C(S(l).id),1),e("span",{class:ne(["shrink-0 transition-colors",L.value?"text-green-600 dark:text-green-400":"text-neutral-400 group-hover:text-neutral-600 dark:group-hover:text-neutral-300"])},[L.value?(r(),q(S(Va),{key:0,size:12})):(r(),q(S(Ma),{key:1,size:12}))],2)],8,wf),e("div",$f,[F[7]||(F[7]=e("label",{class:"shrink-0 text-[10px] font-medium text-neutral-500 dark:text-neutral-400 uppercase tracking-wide w-10"},"Agent",-1)),e("div",Cf,[G.value?(r(),q(Y,{key:0,type:"selectSearch",modelValue:O.value,"onUpdate:modelValue":F[0]||(F[0]=R=>O.value=R),options:P.value,loading:S(x)||y.value,disabled:y.value,size:"sm",placeholder:"Select...",onInput:Q,"outer-class":"!mb-0 flex-1"},null,8,["modelValue","options","loading","disabled"])):(r(),n("span",Sf,C(S(l).agent.title),1)),e("span",Tf,C(S(l).agent.type.replace("_"," ")),1)])]),e("div",If,[F[8]||(F[8]=e("label",{class:"shrink-0 text-[10px] font-medium text-neutral-500 dark:text-neutral-400 uppercase tracking-wide w-10 pt-2"},"Tags",-1)),w(vf,{"model-value":W.value,"onUpdate:modelValue":E,disabled:b.value,placeholder:"Add tags...",class:"flex-1"},null,8,["model-value","disabled"])])])]),e("div",zf,[e("button",{onClick:$,disabled:k.value,type:"button",class:"w-full flex items-center gap-2 px-3 py-2.5 text-left hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors disabled:opacity-50"},[w(S(Ea),{size:14,class:"shrink-0 text-neutral-400"}),F[9]||(F[9]=e("span",{class:"flex-1 text-xs font-medium text-neutral-700 dark:text-neutral-200"},"Usage & Cost",-1)),k.value?(r(),q(Ee,{key:0,size:"xs"})):(r(),q(S(nt),{key:1,size:14,class:ne(["shrink-0 text-neutral-400 transition-transform duration-200",{"-rotate-180":v.value}])},null,8,["class"]))],8,Vf),w(et,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0 max-h-0","enter-to-class":"opacity-100 max-h-[250px]","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100 max-h-[250px]","leave-to-class":"opacity-0 max-h-0"},{default:j(()=>[v.value&&z.value?(r(),n("div",Mf,[e("div",Ef,[e("div",Lf,[e("div",null,[F[10]||(F[10]=e("span",{class:"text-neutral-500 dark:text-neutral-400"},"Total:",-1)),e("span",Pf,C(V(z.value.totalCost)),1)]),e("div",null,[F[11]||(F[11]=e("span",{class:"text-neutral-500 dark:text-neutral-400"},"Per msg:",-1)),e("span",Af,C(V(z.value.avgCostPerMessage)),1)])]),z.value.modelBreakdown.length>0?(r(),n("table",jf,[F[12]||(F[12]=e("thead",null,[e("tr",{class:"border-b border-neutral-200 dark:border-neutral-800"},[e("th",{class:"text-left py-1.5 font-medium text-neutral-500 dark:text-neutral-400 uppercase text-[10px]"},"Model"),e("th",{class:"text-right py-1.5 font-medium text-neutral-500 dark:text-neutral-400 uppercase text-[10px] w-14"},"Reqs"),e("th",{class:"text-right py-1.5 font-medium text-neutral-500 dark:text-neutral-400 uppercase text-[10px]"},"Cost")])],-1)),e("tbody",null,[(r(!0),n(fe,null,ke(z.value.modelBreakdown,R=>(r(),n("tr",{key:R.modelName},[e("td",{class:"py-1.5 truncate max-w-[120px] text-neutral-700 dark:text-neutral-300",title:R.modelName},C(R.modelName),9,Df),e("td",Of,C(R.requestCount),1),e("td",Rf,C(V(R.totalCost)),1)]))),128))])])):T("",!0)])])):T("",!0)]),_:1})]),e("div",Uf,[e("button",{onClick:F[1]||(F[1]=R=>d.value=!d.value),type:"button",class:"w-full flex items-center gap-2 px-3 py-2.5 text-left hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors"},[w(S(La),{size:14,class:"shrink-0 text-neutral-400"}),F[13]||(F[13]=e("span",{class:"flex-1 text-xs font-medium text-neutral-700 dark:text-neutral-200"},"Developer Tools",-1)),w(S(nt),{size:14,class:ne(["shrink-0 text-neutral-400 transition-transform duration-200",{"-rotate-180":d.value}])},null,8,["class"])]),w(et,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0 max-h-0","enter-to-class":"opacity-100 max-h-[150px]","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100 max-h-[150px]","leave-to-class":"opacity-0 max-h-0"},{default:j(()=>[d.value?(r(),n("div",Bf,[e("div",Ff,[e("div",Nf,[ee.value?Ae((r(),n("select",{key:0,"onUpdate:modelValue":F[2]||(F[2]=R=>_.value=R),class:"text-xs px-2 py-1.5 border border-neutral-200 dark:border-neutral-700 rounded bg-white dark:bg-neutral-800 text-neutral-700 dark:text-neutral-300"},[...F[14]||(F[14]=[e("option",{value:"a"},"Side A",-1),e("option",{value:"b"},"Side B",-1)])],512)),[[Mr,_.value]]):T("",!0),e("button",{onClick:te,disabled:g.value,class:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium bg-neutral-800 dark:bg-neutral-200 text-white dark:text-neutral-900 rounded hover:bg-neutral-700 dark:hover:bg-neutral-300 transition-colors disabled:opacity-50"},[w(S(Pa),{size:12}),e("span",null,C(g.value?"Running...":"Continue"),1)],8,qf),F[15]||(F[15]=e("span",{class:"text-[10px] text-neutral-500 dark:text-neutral-400"},"Resume without new message",-1))]),e("div",Hf,[e("button",{onClick:F[3]||(F[3]=R=>c.value=!0),disabled:f.value,class:"flex items-center gap-1.5 text-xs font-medium text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 transition-colors disabled:opacity-50"},[w(S(Aa),{size:12}),e("span",null,C(f.value?"Deleting...":"Delete Thread"),1)],8,Wf)])])])):T("",!0)]),_:1})])],64)):T("",!0)]),w(Xt,{modelValue:c.value,"onUpdate:modelValue":F[4]||(F[4]=R=>c.value=R),title:"Delete Thread?",message:"This will permanently delete all messages, logs, and associated data. This action cannot be undone.","confirm-text":"Delete","cancel-text":"Cancel",onConfirm:B},null,8,["modelValue"])])):T("",!0)]),_:1})}}}),Jf=Xe(Kf,[["__scopeId","data-v-f3c52505"]]),Yf={key:0,class:"overflow-hidden bg-neutral-100 dark:bg-neutral-950"},Gf={class:"max-h-[400px] overflow-y-auto p-3 space-y-3"},Zf={class:"bg-white dark:bg-neutral-900 rounded-lg border border-neutral-200 dark:border-neutral-800 overflow-hidden"},Xf={class:"flex items-center justify-between px-3 py-2 border-b border-neutral-100 dark:border-neutral-800"},Qf={class:"flex items-center gap-2"},eh={class:"text-[10px] text-neutral-400"},th={class:"flex items-center gap-1"},rh={class:"p-2"},ah={key:0,class:"px-2 py-4 text-center text-neutral-400 text-xs"},oh=["onClick"],nh={class:"text-xs text-neutral-700 dark:text-neutral-300 truncate"},lh={class:"text-[10px] text-neutral-400 ml-auto"},sh=["href","onMouseenter"],ih={class:"shrink-0 text-neutral-400"},uh={class:"flex-1 min-w-0"},dh={class:"shrink-0 text-[10px] text-neutral-400 ml-auto"},ch={key:0,class:"text-blue-500"},ph={key:1,class:"text-red-500"},mh={key:2},vh=["href","onMouseenter"],fh={class:"shrink-0 text-neutral-400"},hh={class:"flex-1 min-w-0"},gh={class:"shrink-0 text-[10px] text-neutral-400 ml-auto"},bh={key:0,class:"text-blue-500"},xh={key:1,class:"text-red-500"},yh={key:2},kh=["src","alt"],wh=ve({__name:"FilesSlidePane",props:{threadId:{},show:{type:Boolean}},emits:["close"],setup(t,{emit:o}){const a=t;let i=null;try{i=Ur()}catch{}const l=i?.files??p([]),u=i?.addFiles??(()=>{}),s=p(null),m=p(new Set(["/attachments"])),h=p(null),x=p({x:0,y:0});function c(O){if(O===0)return"0 B";const W=1024,J=["B","KB","MB","GB"],z=Math.floor(Math.log(O)/Math.log(W));return parseFloat((O/Math.pow(W,z)).toFixed(1))+" "+J[z]}function f(O){const W=O.startsWith("/")?O.slice(1):O;return he(`/api/threads/${a.threadId}/fs/${W}`)}function y(O,W){return W?Pr:O.startsWith("audio/")?Oa:O.startsWith("video/")?Ra:O.startsWith("text/")?Ua:O.includes("javascript")||O.includes("json")||O.includes("xml")?Ba:Ar}function b(O){const W=O.target;W.files?.length&&(u(W.files),W.value="")}function v(){s.value?.click()}function d(O){m.value.has(O)?m.value.delete(O):m.value.add(O),m.value=new Set(m.value)}function k(O){x.value={x:O.clientX,y:O.clientY}}function g(O){h.value=O}const _=U(()=>{const O=[],W=new Map,J=[...l.value].sort((z,P)=>z.status==="uploading"&&P.status!=="uploading"?-1:P.status==="uploading"&&z.status!=="uploading"?1:(z.path||z.name).localeCompare(P.path||P.name));for(const z of J){const P=z.path||`/${z.name}`,G=P.split("/").filter(Boolean);if(G.length===1)O.push({type:"file",name:z.name,path:P,file:z});else{const ee="/"+G.slice(0,-1).join("/"),ue=G[G.length-2];if(!W.has(ee)){const me={type:"directory",name:ue,path:ee,children:[]};W.set(ee,me),O.push(me)}W.get(ee).children.push({type:"file",name:z.name,path:P,file:z})}}return O}),L=U(()=>l.value.length);return Pe(()=>{document.addEventListener("mousemove",k)}),Ye(()=>{document.removeEventListener("mousemove",k)}),(O,W)=>(r(),q(et,{"enter-active-class":"transition-all duration-300 ease-out","enter-from-class":"max-h-0 opacity-0","enter-to-class":"max-h-[400px] opacity-100","leave-active-class":"transition-all duration-200 ease-in","leave-from-class":"max-h-[400px] opacity-100","leave-to-class":"max-h-0 opacity-0"},{default:j(()=>[t.show?(r(),n("div",Yf,[e("div",Gf,[e("div",Zf,[e("div",Xf,[e("div",Qf,[w(S(Nt),{size:14,class:"text-neutral-400"}),W[3]||(W[3]=e("span",{class:"text-xs font-medium text-neutral-700 dark:text-neutral-200"},"Files",-1)),e("span",eh,C(L.value),1)]),e("div",th,[e("input",{ref_key:"fileInput",ref:s,type:"file",multiple:"",class:"hidden",onChange:b},null,544),e("button",{onClick:v,type:"button",class:"p-1 hover:bg-neutral-100 dark:hover:bg-neutral-700 rounded transition-colors text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-300",title:"Upload files"},[w(S(ja),{size:14})])])]),e("div",rh,[_.value.length===0?(r(),n("div",ah," No files yet ")):T("",!0),(r(!0),n(fe,null,ke(_.value,J=>(r(),n(fe,{key:J.path},[J.type==="directory"?(r(),n(fe,{key:0},[e("button",{onClick:z=>d(J.path),type:"button",class:"w-full flex items-center gap-1.5 px-2 py-1.5 hover:bg-neutral-50 dark:hover:bg-neutral-700/50 rounded transition-colors text-left"},[w(S(vt),{size:12,class:ne(["shrink-0 text-neutral-400 transition-transform",{"rotate-90":m.value.has(J.path)}])},null,8,["class"]),(r(),q(Ue(m.value.has(J.path)?S(Da):S(Nt)),{size:14,class:"shrink-0",style:{color:"var(--accent-500)"}})),e("span",nh,C(J.name),1),e("span",lh,C(J.children?.length),1)],8,oh),m.value.has(J.path)?(r(!0),n(fe,{key:0},ke(J.children,z=>(r(),n("a",{key:z.path,href:z.path?f(z.path):void 0,target:"_blank",rel:"noopener noreferrer",class:ne(["flex items-center gap-2 pl-7 pr-2 py-1 hover:bg-neutral-50 dark:hover:bg-neutral-700/50 rounded transition-colors cursor-pointer",{"pointer-events-none":z.file?.status==="uploading"}]),onMouseenter:P=>z.file?.isImage?g(z.path):null,onMouseleave:W[0]||(W[0]=P=>g(null))},[e("div",ih,[z.file?.status==="uploading"?(r(),q(S(ar),{key:0,size:12,class:"animate-spin"})):(r(),q(Ue(y(z.file?.mimeType||"",z.file?.isImage||!1)),{key:1,size:12}))]),e("div",uh,[e("div",{class:ne(["text-[11px] text-neutral-600 dark:text-neutral-400 truncate",{"opacity-50":z.file?.status==="uploading"}])},C(z.name),3)]),e("div",dh,[z.file?.status==="uploading"?(r(),n("span",ch,"...")):z.file?.status==="error"?(r(),n("span",ph,"err")):(r(),n("span",mh,C(c(z.file?.size||0)),1))])],42,sh))),128)):T("",!0)],64)):(r(),n("a",{key:1,href:J.path?f(J.path):void 0,target:"_blank",rel:"noopener noreferrer",class:ne(["flex items-center gap-2 px-2 py-1.5 hover:bg-neutral-50 dark:hover:bg-neutral-700/50 rounded transition-colors cursor-pointer",{"pointer-events-none":J.file?.status==="uploading"}]),onMouseenter:z=>J.file?.isImage?g(J.path):null,onMouseleave:W[1]||(W[1]=z=>g(null))},[e("div",fh,[J.file?.status==="uploading"?(r(),q(S(ar),{key:0,size:14,class:"animate-spin"})):(r(),q(Ue(y(J.file?.mimeType||"",J.file?.isImage||!1)),{key:1,size:14}))]),e("div",hh,[e("div",{class:ne(["text-xs text-neutral-600 dark:text-neutral-400 truncate",{"opacity-50":J.file?.status==="uploading"}])},C(J.name),3)]),e("div",gh,[J.file?.status==="uploading"?(r(),n("span",bh,"...")):J.file?.status==="error"?(r(),n("span",xh,"err")):(r(),n("span",yh,C(c(J.file?.size||0)),1))])],42,vh))],64))),128))])])]),(r(),q(kt,{to:"body"},[h.value?(r(),n("div",{key:0,class:"fixed z-50 bg-white dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 rounded-lg shadow-lg p-1 pointer-events-none",style:st({left:`${x.value.x+16}px`,top:`${x.value.y-80}px`})},[e("img",{src:f(h.value),alt:h.value,class:"max-w-[200px] max-h-[150px] rounded object-contain",onError:W[2]||(W[2]=J=>J.target.style.display="none")},null,40,kh)],4)):T("",!0)]))])):T("",!0)]),_:1}))}}),_h=["accept"],$h=["disabled"],Ch=ve({__name:"FileUpload",props:{isProcessing:{type:Boolean},accept:{}},emits:["filesSelected"],setup(t,{expose:o,emit:a}){const i=t,l=a,u=p(null),s=U(()=>i.accept||"image/*,.pdf,.txt,.md,.json,.csv");function m(){u.value?.click()}function h(c){const f=c.target;f.files&&f.files.length>0&&(l("filesSelected",f.files),f.value="")}function x(c){const f=c.clipboardData?.items;if(!f)return;const y=[];for(let b=0;b<f.length;b++){const v=f[b];if(v.kind==="file"){const d=v.getAsFile();d&&y.push(d)}}if(y.length>0){const b=new DataTransfer;y.forEach(v=>b.items.add(v)),l("filesSelected",b.files)}}return o({handlePaste:x}),(c,f)=>(r(),n(fe,null,[e("input",{ref_key:"fileInputRef",ref:u,type:"file",accept:s.value,multiple:"",class:"hidden",onChange:h},null,40,_h),e("button",{type:"button",onClick:m,class:ne(["p-1.5 hover:bg-neutral-100 dark:hover:bg-neutral-800 rounded-lg transition-colors text-neutral-500 hover:text-neutral-700 dark:hover:text-neutral-300",{"opacity-50 cursor-not-allowed":t.isProcessing}]),disabled:t.isProcessing,title:"Attach files"},[w(S(Fa),{size:18})],10,$h)],64))}}),Sh={class:"flex flex-col h-full"},Th={class:"px-4 py-3 border-b border-neutral-300 dark:border-neutral-700"},Ih={class:"flex items-center justify-between"},zh={class:"flex items-center gap-2"},Vh={class:"flex items-center gap-2"},Mh={class:"flex-1 flex flex-col overflow-hidden relative"},Eh={key:0,class:"text-neutral-500 dark:text-neutral-400 text-center py-8"},Lh={key:1,class:"flex justify-center py-2"},Ph={key:2,class:"flex justify-center py-8"},Ah={key:3,class:"text-red-600 dark:text-red-400 text-center py-8"},jh={key:4,class:"text-neutral-500 dark:text-neutral-400 text-center py-8"},Dh={key:1,class:"p-3 bg-white dark:bg-neutral-900 border-t border-neutral-300 dark:border-neutral-700"},Oh={class:"flex items-center justify-end gap-2"},Rh=["disabled"],Uh={key:2,class:"p-3 bg-white dark:bg-neutral-900 border-t border-neutral-300 dark:border-neutral-700"},Bh={key:0,class:"mb-2 flex flex-wrap gap-2"},Fh={key:0,class:"w-16 h-16 rounded-lg overflow-hidden border border-neutral-200 dark:border-neutral-700 bg-neutral-100 dark:bg-neutral-800"},Nh=["src","alt"],qh={key:1,class:"w-full h-full flex items-center justify-center"},Hh={key:1,class:"h-16 px-3 rounded-lg border border-neutral-200 dark:border-neutral-700 bg-neutral-100 dark:bg-neutral-800 flex items-center gap-2"},Wh=["title"],Kh=["onClick"],Jh={class:"flex items-start gap-2"},Yh={class:"flex-1 flex items-start gap-2 p-2 rounded-2xl border border-neutral-300 dark:border-neutral-700 bg-white dark:bg-neutral-900"},Gh=["disabled"],Zh=["disabled"],Xh={key:0,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",class:"w-4 h-4"},Qh={key:1,class:"w-4 h-4"},vr=ve({__name:"MessagesPane",props:{threadId:{},selectedMessageId:{},selectedLogId:{},hoveredLogId:{}},emits:["collapse","messageClick","messageHover","threadDeleted","editThread","logsDeleted","threadUpdated"],setup(t,{expose:o,emit:a}){const i=t,l=a,u=p(!1),s=()=>{u.value||(m.value=!1),u.value=!u.value},m=p(!1),h=()=>{m.value||(u.value=!1),m.value=!m.value},x=p(!1),c=p(new Set),f=p(new Map),y=()=>{x.value=!x.value,x.value||(c.value=new Set,f.value=new Map)},b=(_e,xe)=>{const Ve=new Set(c.value);xe?Ve.add(_e):Ve.delete(_e),c.value=Ve},v=(_e,xe)=>{const Ve=new Map(f.value);Ve.set(_e,xe),f.value=Ve},d=()=>{x.value=!1,c.value=new Set,f.value=new Map},k=U(()=>c.value.size),g=U(()=>{let _e=0;for(const[xe]of f.value)c.value.has(xe)||_e++;return _e}),_=U(()=>{const _e=k.value,xe=g.value;return _e>0&&xe>0?`Delete (${_e}), Update (${xe})`:_e>0?`Delete (${_e})`:xe>0?`Save changes (${xe})`:"Delete"}),L=U(()=>k.value>0||g.value>0),O=async()=>{if(!i.threadId||!L.value)return;const _e=[];for(const xe of c.value){const Ve=W.value.find(We=>We.id===xe);Ve&&"log_id"in Ve&&Ve.log_id&&_e.push(Ve.log_id)}try{for(const[xe,Ve]of f.value)c.value.has(xe)||await V(xe,Ve);for(const xe of c.value)await $(xe);_e.length>0&&l("logsDeleted",_e)}catch(xe){console.error("Error applying changes:",xe)}finally{d()}},{messages:W,threadInfo:J,isFetching:z,isLoadingMore:P,error:G,wsConnected:ee,wsError:ue,isExecuting:me,hasMore:Q,loadMoreMessages:E,deleteMessageById:$,updateMessageContent:V,stopThread:te,sendMessage:B,attachments:N,addAttachment:F,removeAttachment:Y}=fv(U(()=>i.threadId),{}),{thread:R}=Qt(U(()=>i.threadId)),H=U(()=>N.value.length>0),M=U(()=>!1),ie=p(null),A=_e=>{F(_e)},pe=p(null),ce=p(null);o({scrollToLogId:_e=>ce.value&&pe.value?ce.value.scrollToLogId(_e,pe.value):!1,hasWorkblockForLogId:_e=>ce.value?ce.value.hasWorkblockForLogId(_e):!1}),typeof window<"u"&&(window.__testLoadMoreMessages=E);const ae=p(""),I=p(null),D=p("B"),Z=p(!1),K=p(!1),oe=async()=>{await Le(),pe.value&&(pe.value.scrollTop=pe.value.scrollHeight)},se=async _e=>{_e.target.scrollTop<100&&Q.value&&!P.value&&!K.value&&(K.value=!0,await E(),K.value=!1)};ge(()=>W.value.length,async()=>{!P.value&&!K.value&&await oe()}),ge(()=>i.threadId,async _e=>{_e&&await oe()}),ge(z,async(_e,xe)=>{xe&&!_e&&await oe()});const be=U(()=>{const _e=J.value?.agent||R.value?.agent;if(!_e)return"ai A";const xe=_e.type;return D.value==="A"&&_e.side_a_label?_e.side_a_label:D.value==="B"&&_e.side_b_label?_e.side_b_label:xe==="ai_human"?D.value==="A"?"ai":"human":D.value==="A"?"ai A":"ai B"}),le=()=>{D.value=D.value==="A"?"B":"A"},de=async()=>{const _e=ae.value.trim().length>0,xe=H.value;if(!_e&&!xe||!i.threadId||Z.value||!B)return;const Ve=ae.value,We=D.value==="A"?"assistant":"user";ae.value="",I.value&&(I.value.style.height="auto",I.value.style.height="24px"),Z.value=!0;try{await B({role:We,content:Ve}),await oe()}catch($t){console.error("Error sending message:",$t)}finally{Z.value=!1,await Le(),I.value&&I.value.focus()}},ze=_e=>{_e.key==="Enter"&&!_e.shiftKey&&(_e.preventDefault(),de())},we=async()=>{if(i.threadId)try{await te()}catch(_e){console.error("Error stopping thread:",_e)}};return(_e,xe)=>(r(),n("div",Sh,[e("div",Th,[e("div",Ih,[e("div",zh,[w(S(jr),{size:18,class:"shrink-0"}),xe[11]||(xe[11]=e("h2",{class:"text-base font-bold"},"Messages",-1)),t.threadId?(r(),q(er,{key:0,connected:S(ee),error:S(ue)},null,8,["connected","error"])):T("",!0)]),e("div",Vh,[t.threadId?(r(),n("button",{key:0,onClick:h,type:"button",class:ne(["p-1 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",[m.value?"text-accent-600 dark:text-accent-400":""]]),title:"Toggle files"},[w(S(Nt),{size:20})],2)):T("",!0),t.threadId?(r(),n("button",{key:1,onClick:s,type:"button",class:ne(["p-1 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",[u.value?"text-accent-600 dark:text-accent-400":""]]),title:"Toggle thread info"},[w(S(Cr),{size:20})],2)):T("",!0),t.threadId&&S(W).length>0?(r(),n("button",{key:2,onClick:y,type:"button",class:ne(["p-1 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",{"bg-neutral-200 dark:bg-neutral-800":x.value}]),title:"Edit messages"},[w(S(Na),{size:20})],2)):T("",!0),e("button",{onClick:xe[0]||(xe[0]=Ve=>l("collapse")),type:"button",class:"p-1 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",title:"Collapse pane"},[w(S(Lr),{size:20})])])])]),e("div",Mh,[w(Jf,{"thread-id":t.threadId,show:u.value,onClose:xe[1]||(xe[1]=Ve=>u.value=!1),onThreadDeleted:xe[2]||(xe[2]=Ve=>l("threadDeleted",Ve)),onEditThread:xe[3]||(xe[3]=Ve=>l("editThread")),onThreadUpdated:xe[4]||(xe[4]=Ve=>l("threadUpdated"))},null,8,["thread-id","show"]),t.threadId?(r(),q(wh,{key:0,"thread-id":t.threadId,show:m.value,onClose:xe[5]||(xe[5]=Ve=>m.value=!1)},null,8,["thread-id","show"])):T("",!0),e("div",{ref_key:"messagesContainer",ref:pe,class:"flex-1 overflow-y-auto overflow-x-hidden p-4 space-y-4",onScroll:se},[t.threadId?T("",!0):(r(),n("div",Eh," Select a thread to view messages ")),S(P)?(r(),n("div",Lh,[w(Ee,{size:"sm"}),xe[12]||(xe[12]=e("span",{class:"ml-2 text-xs text-neutral-500"},"Loading older messages...",-1))])):S(z)?(r(),n("div",Ph,[w(Ee)])):S(G)?(r(),n("div",Ah," Error loading messages: "+C(S(G)),1)):t.threadId&&S(W).length===0?(r(),n("div",jh," No messages yet ")):(r(),q(cf,{key:5,ref_key:"agentMessagesRef",ref:ce,messages:S(W),threadId:t.threadId,selectedMessageId:t.selectedMessageId,selectedLogId:t.selectedLogId,hoveredLogId:t.hoveredLogId,isEditMode:x.value,selectedForDelete:c.value,editedMessages:f.value,onMessageClick:xe[6]||(xe[6]=(Ve,We)=>l("messageClick",Ve,We)),onMessageHover:xe[7]||(xe[7]=Ve=>l("messageHover",Ve)),onSelectionChange:b,onMessageEdit:v},null,8,["messages","threadId","selectedMessageId","selectedLogId","hoveredLogId","isEditMode","selectedForDelete","editedMessages"]))],544),t.threadId&&x.value?(r(),n("div",Dh,[e("div",Oh,[e("button",{onClick:d,class:"px-4 py-2 rounded-lg font-medium text-sm transition-colors bg-neutral-200 text-black hover:bg-neutral-300 dark:bg-neutral-700 dark:text-white dark:hover:bg-neutral-600"}," Cancel "),e("button",{onClick:O,disabled:!L.value,class:ne(["px-4 py-2 rounded-lg font-medium text-sm transition-colors",{"bg-red-600 text-white hover:bg-red-700":L.value&&k.value>0,"bg-black text-white hover:bg-neutral-800 dark:bg-white dark:text-black dark:hover:bg-neutral-200":L.value&&k.value===0,"bg-neutral-200 text-neutral-400 dark:bg-neutral-700 dark:text-neutral-500 cursor-not-allowed":!L.value}])},C(_.value),11,Rh)])])):t.threadId?(r(),n("div",Uh,[S(N).length>0?(r(),n("div",Bh,[(r(!0),n(fe,null,ke(S(N),Ve=>(r(),n("div",{key:Ve.id,class:"relative group"},[Ve.isImage?(r(),n("div",Fh,[Ve.previewUrl?(r(),n("img",{key:0,src:Ve.previewUrl,alt:Ve.name,class:"w-full h-full object-cover"},null,8,Nh)):(r(),n("div",qh,[...xe[13]||(xe[13]=[e("div",{class:"w-4 h-4 border-2 border-neutral-300 border-t-neutral-600 rounded-full animate-spin"},null,-1)])]))])):(r(),n("div",Hh,[e("span",{class:"text-xs text-neutral-600 dark:text-neutral-300 max-w-[80px] truncate",title:Ve.name},C(Ve.name),9,Wh)])),e("button",{onClick:Re(We=>S(Y)(Ve.id),["stop"]),class:"absolute -top-1 -right-1 w-4 h-4 rounded-full bg-neutral-600 dark:bg-neutral-500 text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity hover:bg-red-500"},[...xe[14]||(xe[14]=[e("span",{class:"text-[10px] font-bold leading-none"},"x",-1)])],8,Kh)]))),128))])):T("",!0),e("div",Jh,[e("button",{onClick:le,class:ne(["flex-shrink-0 px-2 h-7 rounded-md flex items-center justify-center font-medium text-xs transition-colors mt-2.5",{"bg-black text-white dark:bg-white dark:text-black":D.value==="A","bg-neutral-300 text-black dark:bg-neutral-600 dark:text-white":D.value==="B"}]),title:"Toggle between sides"},C(be.value),3),e("div",Yh,[w(Ch,{ref_key:"fileUploadRef",ref:ie,"is-processing":!1,onFilesSelected:A},null,512),Ae(e("textarea",{ref_key:"messageTextarea",ref:I,"onUpdate:modelValue":xe[8]||(xe[8]=Ve=>ae.value=Ve),onKeydown:ze,onPaste:xe[9]||(xe[9]=Ve=>ie.value?.handlePaste(Ve)),disabled:Z.value,placeholder:"Type a message...",rows:"1",class:"flex-1 bg-transparent text-black dark:text-white resize-none focus:outline-none disabled:opacity-50 mt-0.5",style:{"max-height":"120px","min-height":"24px"},onInput:xe[10]||(xe[10]=Ve=>{const We=Ve.target;We.style.height="auto",We.style.height=Math.min(We.scrollHeight,120)+"px"})},null,40,Gh),[[Qe,ae.value]]),S(me)?(r(),n("button",{key:1,id:"stop-thread-button",onClick:we,class:"flex-shrink-0 w-7 h-7 rounded-full flex items-center justify-center transition-all bg-red-600 text-white dark:bg-red-500 hover:bg-red-700 dark:hover:bg-red-600",title:"Stop execution"},[...xe[16]||(xe[16]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",class:"w-4 h-4"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})],-1)])])):(r(),n("button",{key:0,id:"send-message-button",onClick:de,disabled:!ae.value.trim()&&!H.value||Z.value||M.value,class:ne(["flex-shrink-0 w-7 h-7 rounded-full flex items-center justify-center transition-all",{"bg-black text-white dark:bg-white dark:text-black":(ae.value.trim()||H.value)&&!Z.value&&!M.value,"bg-neutral-200 text-neutral-400 dark:bg-neutral-700 dark:text-neutral-600":!ae.value.trim()&&!H.value||Z.value||M.value}]),title:"Send message (Enter)"},[Z.value?(r(),n("div",Qh,[w(Ee)])):(r(),n("svg",Xh,[...xe[15]||(xe[15]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18"},null,-1)])]))],10,Zh))])])])):T("",!0)])]))}});function eg(t,o){const{limit:a=100,offset:i=0,order:l="desc",autoFetch:u=!0,enableWebSocket:s=!1}=o||{};U(()=>!!(typeof t=="string"?t:t?.value));const m=U(()=>{const Y=typeof t=="string"?t:t?.value;if(!Y)return he("/api/threads/placeholder/logs");const R=new URLSearchParams,H=typeof a=="number"?a:a.value,M=typeof i=="number"?i:i.value,ie=typeof l=="string"?l:l.value;return R.append("limit",H.toString()),R.append("offset",M.toString()),R.append("order",ie),he(`/api/threads/${Y}/logs?${R.toString()}`)}),{data:h,error:x,isFetching:c,isFinished:f,execute:y,abort:b}=Ne(m,{immediate:!1}).get().json();ge([m,()=>u],([Y,R])=>{Y&&!Y.includes("placeholder")&&R&&y()},{immediate:!0});const v=U(()=>!x.value||x.value.toString().includes("aborted")||x.value.toString().includes("abort")?null:x.value),d=U(()=>h.value?.logs||[]),k=U(()=>h.value?.total||0),g=U(()=>h.value?.hasMore||!1),_=p(null),L=p(!1),O=p(null),W=p([]),J=new Map;let z=0,P=null,G=null,ee=!0,ue=null;const me=3e4,Q=3e4,E=()=>{P&&(clearTimeout(P),P=null),G&&(clearInterval(G),G=null)},$=()=>{G&&clearInterval(G),G=setInterval(()=>{_.value&&_.value.readyState===WebSocket.OPEN&&_.value.send("ping")},Q)},V=()=>{if(!ee||!s)return;const Y=Math.min(1e3*Math.pow(2,z),me);z++,console.log(`[Logs WebSocket] Scheduling reconnect in ${Y}ms (attempt ${z})`),P=setTimeout(()=>{ee&&te()},Y)},te=()=>{const Y=typeof t=="string"?t:t?.value;if(!Y||!s)return;_.value&&(ue=null,_.value.close()),z===0&&(W.value=[]);const R=window.location.protocol==="https:"?"wss:":"ws:",H=window.location.host;let M=`${R}//${H}${he(`/api/threads/${Y}/logs`)}`;const ie=localStorage.getItem("auth_token");ie&&(M+=`?token=${encodeURIComponent(ie)}`);try{const A=new WebSocket(M);_.value=A,ue=A,A.onopen=()=>{ue===A&&(L.value=!0,O.value=null,z=0,$(),console.log("[Logs WebSocket] Connected"))},A.onmessage=pe=>{if(ue===A&&pe.data!=="pong")try{const ce=JSON.parse(pe.data);if(ce.type==="log_data"){const ye=W.value.findIndex(ae=>ae.id===ce.log_id),Me=d.value.find(ae=>ae.id===ce.log_id);if(ye>=0){W.value[ye]={...W.value[ye],...ce.data};const ae=J.get(ce.log_id);ae&&(W.value[ye].queued_tools=ae,J.delete(ce.log_id))}else if(Me){const ae={...Me,...ce.data},I=J.get(ce.log_id);I&&(ae.queued_tools=I,J.delete(ce.log_id)),W.value.push(ae)}else{const ae={id:ce.log_id,...ce.data},I=J.get(ce.log_id);I&&(ae.queued_tools=I,J.delete(ce.log_id)),W.value.push(ae)}}else if(ce.type==="log_queued_tools"){const ye=W.value.findIndex(ae=>ae.id===ce.log_id),Me=d.value.find(ae=>ae.id===ce.log_id);ye>=0?W.value[ye]={...W.value[ye],queued_tools:ce.queued_tools}:Me?W.value.push({...Me,queued_tools:ce.queued_tools}):J.set(ce.log_id,ce.queued_tools)}}catch(ce){console.error("[Logs WebSocket] Failed to parse message:",ce)}},A.onerror=pe=>{ue===A&&(O.value="WebSocket connection error",console.error("[Logs WebSocket] Error:",pe))},A.onclose=()=>{ue===A&&(L.value=!1,E(),console.log("[Logs WebSocket] Disconnected"),V())}}catch(A){O.value=A.message||"Failed to create WebSocket",console.error("[Logs WebSocket] Creation error:",A),V()}},B=()=>{ee=!1,E(),ue=null,_.value&&(_.value.close(),_.value=null),L.value=!1,z=0,W.value=[],J.clear()},N=()=>{ee=!0,z=0,te()};return Ye(()=>{B()}),{logs:U(()=>{if(!s)return d.value;const Y=new Map;d.value.forEach(M=>Y.set(M.id,M)),W.value.forEach(M=>Y.set(M.id,M));const R=typeof l=="string"?l:l.value;return Array.from(Y.values()).sort((M,ie)=>R==="desc"?ie.created_at-M.created_at:M.created_at-ie.created_at)}),total:k,hasMore:g,error:v,isFetching:c,isFinished:f,refetch:y,abort:b,wsConnected:L,wsError:O,connectWebSocket:N,disconnectWebSocket:B}}function tg(t,o){const a=U(()=>{const m=t.value,h=o.value;return!m||!h?null:he(`/api/threads/${m}/logs/${h}`)}),{data:i,error:l,isFetching:u,execute:s}=Ne(a,{immediate:!1}).get().json();return ge([t,o],([m,h])=>{m&&h&&s()},{immediate:!0}),{logDetails:i,error:l,isFetching:u,refetch:s}}const rg=["disabled","title"],ag={key:1,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},og={key:2,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},ng={key:3},na=ve({__name:"CopyButton",props:{content:{},variant:{},size:{},disabled:{type:Boolean}},setup(t){const o=t,a=p(!1),i=p(!1),l=async()=>{a.value=!0;try{await navigator.clipboard.writeText(o.content),i.value=!0,setTimeout(()=>{i.value=!1},2e3)}catch(m){console.error("Failed to copy:",m),alert(`Failed to copy: ${m instanceof Error?m.message:"Unknown error"}`)}finally{a.value=!1}},u={xs:"p-1 text-xs",sm:"px-2 py-1 text-xs"},s={solid:"bg-black text-white dark:bg-white dark:text-black",ghost:"bg-white dark:bg-neutral-950 border border-neutral-300 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-900"};return(m,h)=>(r(),n("button",{onClick:l,disabled:a.value||t.disabled,class:ne([u[t.size||"sm"],s[t.variant||"solid"],"font-medium rounded hover:opacity-80 disabled:opacity-50 disabled:cursor-not-allowed transition-all"]),title:t.disabled?"No content to copy":i.value?"Copied!":"Copy to clipboard"},[a.value?(r(),q(Ee,{key:0,size:"xs"})):t.variant==="ghost"&&!i.value?(r(),n("svg",ag,[...h[0]||(h[0]=[e("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"},null,-1),e("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"},null,-1)])])):t.variant==="ghost"&&i.value?(r(),n("svg",og,[...h[1]||(h[1]=[e("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):(r(),n("span",ng,C(i.value?"Copied!":"Copy"),1))],10,rg))}}),Ut="__shiki_highlighter__";let St=null;async function lg(){return typeof window<"u"&&window[Ut]?window[Ut]:St||(St=ao({themes:["min-light","github-dark-high-contrast"],langs:["json","markdown"]}).then(t=>(typeof window<"u"&&(window[Ut]=t),t)),St)}const sg={class:"code-block"},ig={key:0,class:"text-xs text-neutral-500 p-2"},ug=["innerHTML"],Bt=ve({__name:"CodeBlock",props:{code:{},language:{}},setup(t){const o=t,a=p(""),i=p(!0),l=async()=>{const u=o.code??"";if(!u){a.value='<pre class="shiki"><code></code></pre>',i.value=!1;return}try{const s=await lg();if(o.language==="json"||o.language==="markdown")a.value=s.codeToHtml(u,{lang:o.language,themes:{light:"min-light",dark:"github-dark-high-contrast"}});else{const m=u.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");a.value=`<pre class="shiki shiki-text"><code>${m}</code></pre>`}}catch{const m=u.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");a.value=`<pre class="shiki"><code>${m}</code></pre>`}finally{i.value=!1}};return Pe(()=>{l()}),ge(()=>o.code,()=>{l()}),(u,s)=>(r(),n("div",sg,[i.value?(r(),n("div",ig,"Loading...")):(r(),n("div",{key:1,innerHTML:a.value,class:"code-content"},null,8,ug))]))}}),dg={class:"json-viewer relative bg-white dark:bg-neutral-900"},cg={key:0,class:"absolute top-[5px] right-[5px] z-10"},pg=["innerHTML"],mg=["src","alt"],vg=ve({__name:"JsonViewer",props:{json:{},threadId:{},showCopyButton:{type:Boolean}},setup(t){const o=t,a=p(null),i=p(null),l=y=>[".jpg",".jpeg",".png",".gif",".webp",".svg",".bmp"].some(v=>y.toLowerCase().endsWith(v)),u=y=>o.threadId?he(`/api/threads/${o.threadId}/fs${y}`):null,s=U(()=>{if(!o.json)return"";if(typeof o.json=="string")try{return JSON.stringify(JSON.parse(o.json),null,2)}catch{return o.json}return JSON.stringify(o.json,null,2)}),m=y=>y.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),h=(y,b=0)=>{const v=" ".repeat(b),d=k=>`<span class="json-punct">${k}</span>`;if(y===null)return'<span class="json-null">null</span>';if(typeof y=="boolean")return`<span class="json-boolean">${y}</span>`;if(typeof y=="number")return`<span class="json-number">${y}</span>`;if(typeof y=="string"){const k=m(y);return o.threadId&&l(y)&&y.startsWith("/attachments/")?`${d('"')}<span class="json-image-path" data-path="${m(y)}">${k}</span>${d('"')}`:`${d('"')}<span class="json-string">${k}</span>${d('"')}`}if(Array.isArray(y)){if(y.length===0)return`${d("[")}${d("]")}`;const k=y.map((g,_)=>{const L=_<y.length-1?d(","):"";return`${v} ${h(g,b+1)}${L}`});return`${d("[")}
|
|
38
|
-
${
|
|
36
|
+
`+I.output);return}k.value={success:!0,packageName:I.packageName,version:I.version,output:I.output,url:I.url,tokenSource:I.tokenSource},u.value||s("published",{packageName:I.packageName,version:I.version,url:I.url})}catch(L){p.value=L instanceof Error?L.message:"Failed to publish package"}finally{x.value=!1}}},me=()=>{l.value=!1},ee=()=>u.value?"Dry run completed successfully!":"Package published successfully!";return(L,C)=>(r(),N(He,{modelValue:l.value,"onUpdate:modelValue":C[6]||(C[6]=I=>l.value=I),title:"Publish to npm",width:"max-w-lg","min-height":"min-h-[16rem]"},{footer:j(()=>[e("div",bm,[w($(De),{variant:"ghost",onClick:me},{default:j(()=>[X(S(k.value?.success?"Close":"Cancel"),1)]),_:1}),k.value?.success?T("",!0):(r(),N($(De),{key:0,variant:"primary",disabled:x.value||v.value||!Q.value,onClick:le},{default:j(()=>[x.value?(r(),o(he,{key:0},[w(Ve,{size:"sm",class:"mr-2"}),C[22]||(C[22]=X(" Publishing... ",-1))],64)):(r(),o(he,{key:1},[X(S(u.value?"Validate":"Publish"),1)],64))]),_:1},8,["disabled"]))])]),default:j(()=>[k.value?.success?(r(),o("div",Bp,[w($(Fe),{variant:u.value?"info":"success"},{default:j(()=>[e("div",Fp,[e("p",Np,S(ee()),1),k.value.packageName?(r(),o("p",qp," Package: "+S(k.value.packageName)+"@"+S(k.value.version),1)):T("",!0),k.value.tokenSource==="environment"?(r(),o("p",Hp," Token: from NPM_TOKEN environment variable ")):T("",!0),k.value.url&&!u.value?(r(),o("p",Wp,[e("a",{href:k.value.url,target:"_blank",rel:"noopener noreferrer",class:"text-primary-600 dark:text-primary-400 hover:underline"}," View on npm ",8,Kp)])):T("",!0)])]),_:1},8,["variant"]),k.value.output?(r(),o("div",Jp,[C[7]||(C[7]=e("p",{class:"text-sm font-medium text-neutral-700 dark:text-neutral-300"},"Output:",-1)),e("pre",Yp,S(k.value.output),1)])):T("",!0)])):(r(),o("div",Gp,[e("div",Zp,[i.value?(r(),o("div",Xp,[w(Ve,{size:"sm"}),C[8]||(C[8]=e("span",{class:"text-sm"},"Loading package info...",-1))])):c.value?(r(),N($(Fe),{key:1,variant:"error"},{default:j(()=>[X(S(c.value),1)]),_:1})):d.value?(r(),o("div",Qp,[e("div",em,[e("h3",tm,S(d.value.packageName),1),w($(ft),{variant:"secondary"},{default:j(()=>[X("v"+S(d.value.version),1)]),_:1}),d.value.license?(r(),N($(ft),{key:0,variant:"default"},{default:j(()=>[X(S(d.value.license),1)]),_:1})):T("",!0)]),d.value.author?(r(),o("p",rm," by "+S(d.value.author),1)):T("",!0),d.value.readme?(r(),o("div",am,[e("button",{type:"button",class:"flex items-center gap-2 text-sm font-medium text-neutral-600 dark:text-neutral-400 hover:text-neutral-800 dark:hover:text-neutral-200",onClick:C[0]||(C[0]=I=>g.value=!g.value)},[(r(),N(Ue(g.value?$(nt):$(vt)),{class:"w-4 h-4"})),C[9]||(C[9]=X(" README ",-1))]),g.value?(r(),o("div",{key:0,class:"mt-2 prose prose-sm dark:prose-invert max-w-none p-3 rounded-md border border-neutral-200 dark:border-neutral-700 bg-white dark:bg-neutral-800 max-h-[200px] overflow-y-auto",innerHTML:f.value},null,8,om)):T("",!0)])):T("",!0)])):T("",!0)]),d.value?(r(),o("hr",nm)):T("",!0),v.value?(r(),o("div",lm,[w(Ve,{size:"sm"}),C[10]||(C[10]=e("span",{class:"text-sm"},"Checking npm token configuration...",-1))])):y.value?.hasToken?(r(),N($(Fe),{key:2,variant:"success"},{default:j(()=>[...C[11]||(C[11]=[e("p",{class:"text-sm"},[e("strong",null,"NPM_TOKEN found"),X(" in your environment. Your token will be used automatically. ")],-1)])]),_:1})):y.value&&!y.value.hasToken?(r(),N($(Fe),{key:3,variant:"warning"},{default:j(()=>[e("div",sm,[C[17]||(C[17]=e("p",null,[e("strong",null,"No NPM_TOKEN configured.")],-1)),e("p",null,[C[12]||(C[12]=X("To publish packages, create an npm token and add it to your ",-1)),e("code",im,S(y.value.envFile),1),C[13]||(C[13]=X(" file:",-1))]),e("ol",um,[C[15]||(C[15]=e("li",null,[X("Run: "),e("code",{class:"bg-neutral-200 dark:bg-neutral-700 px-1 rounded"},"npm token create")],-1)),e("li",null,[X("Add to "+S(y.value.envFile)+": ",1),C[14]||(C[14]=e("code",{class:"bg-neutral-200 dark:bg-neutral-700 px-1 rounded"},"NPM_TOKEN=npm_xxxxx",-1))]),C[16]||(C[16]=e("li",null,"Restart the dev server",-1))]),C[18]||(C[18]=e("p",{class:"pt-2"},"Or enter a token below for this session only:",-1))])]),_:1})):T("",!0),p.value?(r(),N($(Fe),{key:4,variant:"error"},{default:j(()=>[e("pre",dm,S(p.value),1)]),_:1})):T("",!0),!y.value?.hasToken&&!v.value?(r(),N($(ct),{key:5,label:"npm Token",error:M.value||void 0,"help-text":"Create a token at npmjs.com/settings/tokens",required:!y.value?.hasToken},{default:j(()=>[Ae(e("input",{"onUpdate:modelValue":C[1]||(C[1]=I=>h.value=I),type:"password",autocomplete:"off",class:oe(["w-full px-3 py-2 rounded-md border text-sm font-mono bg-white dark:bg-neutral-800 border-neutral-300 dark:border-neutral-600 text-neutral-900 dark:text-neutral-100 placeholder-neutral-400 dark:placeholder-neutral-500 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent",{"border-red-500 dark:border-red-500":M.value}]),placeholder:"npm_xxxxxxxxxxxx"},null,2),[[Qe,h.value]])]),_:1},8,["error","required"])):T("",!0),w($(ct),{label:"Registry"},{default:j(()=>[e("div",cm,[e("div",pm,[e("label",mm,[Ae(e("input",{"onUpdate:modelValue":C[2]||(C[2]=I=>_.value=I),type:"radio",value:"default",class:"text-primary-500 focus:ring-primary-500"},null,512),[[lr,_.value]]),C[19]||(C[19]=e("span",{class:"text-sm text-neutral-700 dark:text-neutral-300"},"npm (default)",-1))]),e("label",vm,[Ae(e("input",{"onUpdate:modelValue":C[3]||(C[3]=I=>_.value=I),type:"radio",value:"custom",class:"text-primary-500 focus:ring-primary-500"},null,512),[[lr,_.value]]),C[20]||(C[20]=e("span",{class:"text-sm text-neutral-700 dark:text-neutral-300"},"Custom registry",-1))])]),_.value==="custom"?(r(),o("div",fm,[Ae(e("input",{"onUpdate:modelValue":C[4]||(C[4]=I=>b.value=I),type:"url",class:oe(["w-full px-3 py-2 rounded-md border text-sm bg-white dark:bg-neutral-800 border-neutral-300 dark:border-neutral-600 text-neutral-900 dark:text-neutral-100 placeholder-neutral-400 dark:placeholder-neutral-500 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent",{"border-red-500 dark:border-red-500":R.value}]),placeholder:"https://registry.example.com"},null,2),[[Qe,b.value]]),R.value?(r(),o("p",hm,S(R.value),1)):T("",!0)])):T("",!0)])]),_:1}),e("label",gm,[Ae(e("input",{"onUpdate:modelValue":C[5]||(C[5]=I=>u.value=I),type:"checkbox",class:"rounded text-primary-500 focus:ring-primary-500"},null,512),[[Gt,u.value]]),C[21]||(C[21]=e("span",{class:"text-sm text-neutral-700 dark:text-neutral-300"}," Dry run (validate without publishing) ",-1))])]))]),_:1},8,["modelValue"]))}});function kt(t,a){return a?(a.clearErrors(!0),t.fieldErrors&&Object.keys(t.fieldErrors).length>0?(a.setErrors([],t.fieldErrors),!0):t.error?(a.setErrors([t.error]),!0):!1):!1}function km(t){t?.clearErrors(!0)}const wm={},_m={class:"p-8 w-full max-w-7xl mx-auto"};function $m(t,a){return r(),o("div",_m,[je(t.$slots,"default")])}const pt=Xe(wm,[["render",$m]]),Cm={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Sm(t,a){return r(),o("svg",Cm,[...a[0]||(a[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"},null,-1)])])}const Rt=Te({name:"lucide-plus",render:Sm}),Tm={key:0,class:"mb-5 rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/30 px-4 py-3 text-sm text-amber-800 dark:text-amber-200"},Im=fe({__name:"AgentsView",setup(t){const a=bt(),n=ut(),s=Dt(),l=m(!1),d=m("add"),i=m(null),c=m(null),g=m(null),y=m(null),v=m(!1),f=m(null),h=m(!1),_=m(null),b=m(!1),u=m(null);xe(()=>n.query.refresh,()=>{n.query.refresh&&(c.value?.refresh(),a.replace({path:"/agents",query:{}}))});const x=()=>{d.value="add",i.value=null,y.value=null,l.value=!0},p=J=>{d.value="edit",i.value=J,y.value=null,l.value=!0},k=async J=>{y.value=null;try{const Q=d.value==="edit"&&i.value?.id,{originalName:le,...me}=J,ee=ge(Q?`/api/agents/${encodeURIComponent(i.value.id)}`:"/api/agents"),C=await fetch(ee,{method:Q?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(me)});if(C.ok)c.value?.refresh(),l.value=!1,i.value=null;else{const I=await C.json();kt(I,g.value?.formNode)||(y.value=I.error||`Failed to ${Q?"update":"create"} agent`)}}catch(Q){console.error(`Error ${d.value==="edit"?"updating":"creating"} agent:`,Q),y.value=`Failed to ${d.value==="edit"?"update":"create"} agent`}},M=J=>{f.value=J,v.value=!0},R=()=>{v.value=!1,f.value=null,c.value?.refresh()},W=J=>{_.value=J,h.value=!0},Z=()=>{h.value=!1,_.value=null,c.value?.refresh()},V=J=>{u.value=J,b.value=!0},P=()=>{b.value=!1,u.value=null};return(J,Q)=>(r(),N(pt,null,{default:j(()=>[$(s)?T("",!0):(r(),o("div",Tm," Configuration is read-only in production. To make changes, edit your configuration files locally and deploy. ")),w(r0,{ref_key:"dataTableRef",ref:c,title:"Agents",description:"Configure and manage your AI agents.","primary-action":$(s)?{label:"Create Agent",icon:$(Rt),handler:x}:void 0,readonly:!$(s),onAdd:x,onEdit:p,onPack:M,onUnpack:W,onPublish:V},null,8,["primary-action","readonly"]),w(N0,{ref_key:"agentModalRef",ref:g,modelValue:l.value,"onUpdate:modelValue":Q[0]||(Q[0]=le=>l.value=le),mode:d.value,editAgent:i.value,apiError:y.value,readonly:!$(s),onSave:k},null,8,["modelValue","mode","editAgent","apiError","readonly"]),$(s)?(r(),o(he,{key:1},[w(hp,{modelValue:v.value,"onUpdate:modelValue":Q[1]||(Q[1]=le=>v.value=le),agent:f.value,onPacked:R},null,8,["modelValue","agent"]),w(Up,{modelValue:h.value,"onUpdate:modelValue":Q[2]||(Q[2]=le=>h.value=le),agent:_.value,onUnpacked:Z},null,8,["modelValue","agent"]),w(ym,{modelValue:b.value,"onUpdate:modelValue":Q[3]||(Q[3]=le=>b.value=le),"package-id":u.value?.packageId??"","output-path":"agents/packed/"+(u.value?.packageId??""),onPublished:P},null,8,["modelValue","package-id","output-path"])],64)):T("",!0)]),_:1}))}});function zm(t){const{limit:a=50,offset:n=0,agentId:s=null,userId:l=null,search:d=null,startDate:i=null,endDate:c=null,autoFetch:g=!0}=t||{},y=O(()=>{const M=new URLSearchParams,R=typeof a=="number"?a:a.value,W=typeof n=="number"?n:n.value,Z=typeof s=="string"?s:s?.value,V=typeof l=="string"?l:l?.value,P=typeof d=="string"?d:d?.value,J=typeof i=="number"?i:i?.value,Q=typeof c=="number"?c:c?.value;return M.append("limit",R.toString()),M.append("offset",W.toString()),Z&&M.append("agent_id",Z),V&&M.append("user_id",V),P&&M.append("search",P),J&&M.append("startDate",J.toString()),Q&&M.append("endDate",Q.toString()),ge(`/api/threads?${M.toString()}`)}),{data:v,error:f,isFetching:h,isFinished:_,execute:b,abort:u}=Ne(y,{immediate:g,refetch:!0}).get().json(),x=O(()=>v.value?.threads||[]),p=O(()=>v.value?.total||0),k=O(()=>v.value?.hasMore||!1);return{threads:x,total:p,hasMore:k,error:f,isFetching:h,isFinished:_,refetch:b,abort:u}}function tr(t){const a=O(()=>!!(typeof t=="string"?t:t?.value)),n=O(()=>{const v=typeof t=="string"?t:t?.value;return ge(v?`/api/threads/${v}`:"/api/threads/placeholder")}),{data:s,error:l,isFetching:d,isFinished:i,execute:c,abort:g}=Ne(n,{immediate:!1,refetch:!0}).get().json();return xe(a,v=>{v&&c()},{immediate:!0}),{thread:O(()=>s.value?{id:s.value.thread.id,agent_id:s.value.thread.agent_id,user_id:s.value.thread.user_id,tags:s.value.thread.tags||[],created_at:s.value.thread.created_at,agent:s.value.agent||{id:"",title:"Unknown",type:"unknown"},stats:s.value.stats}:null),error:l,isFetching:d,isFinished:i,refetch:c,abort:g}}function ua(){const t=ge("/api/agents"),{data:a,error:n,isFetching:s,isFinished:l,execute:d}=Ne(t,{immediate:!0}).get().json();return{agents:O(()=>a.value?.agents||[]),error:n,isFetching:s,isFinished:l,refetch:d}}function Mm(t){const{autoConnect:a=!0,onEvent:n}=t||{},s=m(null),l=m(!1),d=m(null);let i=0,c=null,g=null,y=!0;const v=3e4,f=3e4,h=()=>{c&&(clearTimeout(c),c=null),g&&(clearInterval(g),g=null)},_=()=>{g&&clearInterval(g),g=setInterval(()=>{s.value&&s.value.readyState===WebSocket.OPEN&&s.value.send("ping")},f)},b=()=>{if(!y)return;const k=Math.min(1e3*Math.pow(2,i),v);i++,console.log(`[AgentBuilderEvents] Scheduling reconnect in ${k}ms (attempt ${i})`),c=setTimeout(()=>{y&&u()},k)},u=()=>{s.value&&s.value.close();const k=window.location.protocol==="https:"?"wss:":"ws:",M=window.location.host;let R=`${k}//${M}${ge("/api/events")}`;const W=localStorage.getItem("auth_token");W&&(R+=`?token=${encodeURIComponent(W)}`);try{s.value=new WebSocket(R),s.value.onopen=()=>{l.value=!0,d.value=null,i=0,_(),console.log("[AgentBuilderEvents] WebSocket connected")},s.value.onmessage=Z=>{try{if(typeof Z.data=="string"&&Z.data==="pong")return;const V=JSON.parse(Z.data);n&&n(V)}catch(V){console.error("[AgentBuilderEvents] Failed to parse WebSocket message:",V)}},s.value.onerror=Z=>{d.value="WebSocket connection error",console.error("[AgentBuilderEvents] WebSocket error:",Z)},s.value.onclose=()=>{l.value=!1,h(),console.log("[AgentBuilderEvents] WebSocket disconnected"),b()}}catch(Z){d.value=Z.message||"Failed to create WebSocket",console.error("[AgentBuilderEvents] WebSocket creation error:",Z),b()}},x=()=>{y=!0,i=0,u()},p=()=>{y=!1,h(),s.value&&(s.value.close(),s.value=null),l.value=!1,i=0};return a&&x(),Ye(()=>{p()}),{wsConnected:l,wsError:d,connect:x,disconnect:p}}function Vm(t){const n=Date.now()*1e3-t,s=Math.floor(n/1e6);if(s<60)return s===1?"1 second ago":`${s} seconds ago`;const l=Math.floor(s/60);if(l<60)return l===1?"1 minute ago":`${l} minutes ago`;const d=Math.floor(l/60);if(d<24)return d===1?"1 hour ago":`${d} hours ago`;const i=Math.floor(d/24);if(i<30)return i===1?"1 day ago":`${i} days ago`;const c=Math.floor(i/30);if(c<12)return c===1?"1 month ago":`${c} months ago`;const g=Math.floor(c/12);return g===1?"1 year ago":`${g} years ago`}function Em(t){const a=m("");let n=null;const s=()=>typeof t=="function"?t():typeof t=="number"?t:t.value,l=()=>{const d=s();a.value=Vm(d);const c=Date.now()*1e3-d,g=Math.floor(c/1e6);n!==null&&(clearInterval(n),n=null),g<60?n=setInterval(l,1e3):g<3600?n=setInterval(l,6e4):g<86400&&(n=setInterval(l,6e5))};return l(),Ye(()=>{n!==null&&clearInterval(n)}),a}const yt=fe({__name:"TimeAgo",props:{timestamp:{}},setup(t){const a=t,n=Em(()=>a.timestamp);return(s,l)=>(r(),o("span",null,S($(n)),1))}}),Lm={class:"relative inline-flex items-center"},Pm={key:0,class:"inline-block w-2 h-2 rounded-full bg-green-500 dark:bg-green-400"},Am={key:1,class:"inline-block w-2 h-2 rounded-full bg-neutral-400 dark:bg-neutral-600"},jm={key:0},Dm={key:1},rr=fe({__name:"StatusDot",props:{connected:{type:Boolean},error:{type:Boolean}},setup(t){const a=m(!1),n=m(null);return(s,l)=>(r(),o("div",Lm,[e("span",{class:"p-0.5 cursor-default outline-none",tabindex:"-1",onMouseenter:l[0]||(l[0]=d=>a.value=!0),onMouseleave:l[1]||(l[1]=d=>a.value=!1)},[t.connected?(r(),o("span",Pm)):(r(),o("span",Am))],32),w(et,{"enter-active-class":"transition-opacity duration-150","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-100","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:j(()=>[a.value?(r(),o("div",{key:0,ref_key:"popoverRef",ref:n,class:oe(["absolute top-full left-1/2 -translate-x-1/2 mt-1 px-2 py-1 text-xs rounded shadow-lg whitespace-nowrap z-50 border",{"bg-green-50 dark:bg-green-950 border-green-200 dark:border-green-800 text-green-700 dark:text-green-300":t.connected,"bg-neutral-50 dark:bg-neutral-900 border-neutral-200 dark:border-neutral-700 text-neutral-600 dark:text-neutral-400":!t.connected}])},[t.connected?(r(),o("span",jm,"Live - Connected")):(r(),o("span",Dm,"Offline"))],2)):T("",!0)]),_:1})]))}}),Rm={class:"relative min-w-0"},Om={class:"truncate flex-1 text-left"},Um={key:0},Bm=["onClick"],Fm={class:"border-t border-neutral-200 dark:border-neutral-700"},Nm={class:"flex items-center justify-between"},qm={class:"space-y-4 date-filter-inputs"},Hm=fe({__name:"DateFilterDropdown",props:{startDate:{},endDate:{}},emits:["update:startDate","update:endDate"],setup(t,{emit:a}){const n=t,s=a,l=m(!1),d=m(!1),i=m(null),c=m(null),g=m(""),y=m(""),v=[{label:"All time",value:"all",getRange:()=>({startDate:null,endDate:null})},{label:"Today",value:"today",getRange:()=>{const V=new Date,P=new Date(V.getFullYear(),V.getMonth(),V.getDate());return{startDate:Math.floor(P.getTime()/1e3),endDate:null}}},{label:"Last 3 days",value:"3days",getRange:()=>{const V=new Date,P=new Date(V.getFullYear(),V.getMonth(),V.getDate()-2);return{startDate:Math.floor(P.getTime()/1e3),endDate:null}}},{label:"Last 7 days",value:"7days",getRange:()=>{const V=new Date,P=new Date(V.getFullYear(),V.getMonth(),V.getDate()-6);return{startDate:Math.floor(P.getTime()/1e3),endDate:null}}},{label:"Last 30 days",value:"30days",getRange:()=>{const V=new Date,P=new Date(V.getFullYear(),V.getMonth(),V.getDate()-29);return{startDate:Math.floor(P.getTime()/1e3),endDate:null}}}],f=O(()=>{if(!n.startDate&&!n.endDate)return"all";for(const V of v){const P=V.getRange();if(P.startDate===n.startDate&&P.endDate===n.endDate)return V.value}return"custom"}),h=O(()=>{if(!n.startDate&&!n.endDate)return"All time";const V=v.find(J=>J.value===f.value);if(V&&f.value!=="custom")return V.label;const P=J=>new Date(J*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric"});return n.startDate&&n.endDate?`${P(n.startDate)} - ${P(n.endDate)}`:n.startDate?`From ${P(n.startDate)}`:n.endDate?`Until ${P(n.endDate)}`:"Custom"}),_=O(()=>n.startDate!==null||n.endDate!==null);function b(){if(!i.value||!c.value)return;const V=i.value.getBoundingClientRect();c.value.style.position="fixed",c.value.style.top=`${V.bottom+8}px`,c.value.style.left=`${V.left}px`;const P=d.value?280:180;c.value.style.minWidth=`${V.width}px`,c.value.style.maxWidth=`${Math.max(V.width,P)}px`,c.value.style.width="auto",c.value.style.margin="0"}function u(){l.value?x():(l.value=!0,Le(()=>{if(c.value&&(c.value.setAttribute("popover","auto"),c.value.addEventListener("toggle",p),"showPopover"in c.value))try{c.value.showPopover()}catch{}b()}))}function x(){if(c.value){if("hidePopover"in c.value)try{c.value.hidePopover()}catch{}c.value.removeEventListener("toggle",p)}l.value=!1,d.value=!1}function p(V){V.target===c.value&&(l.value=V.newState==="open",l.value&&b())}function k(V){const P=V.getRange();s("update:startDate",P.startDate),s("update:endDate",P.endDate),x()}function M(){const V=g.value?Math.floor(new Date(g.value).getTime()/1e3):null,P=y.value?Math.floor(new Date(y.value+"T23:59:59").getTime()/1e3):null;s("update:startDate",V),s("update:endDate",P),x()}function R(V){V.stopPropagation(),s("update:startDate",null),s("update:endDate",null)}const W=V=>{const P=V.target;c.value&&!c.value.contains(P)&&i.value&&!i.value.contains(P)&&x()},Z=V=>{V.key==="Escape"&&l.value&&(x(),i.value?.focus())};return Pe(()=>{document.addEventListener("click",W),document.addEventListener("keydown",Z),window.addEventListener("resize",b),window.addEventListener("scroll",b,!0)}),Ye(()=>{document.removeEventListener("click",W),document.removeEventListener("keydown",Z),window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0)}),xe(d,V=>{V&&(n.startDate&&(g.value=new Date(n.startDate*1e3).toISOString().split("T")[0]),n.endDate?y.value=new Date(n.endDate*1e3).toISOString().split("T")[0]:y.value=new Date().toISOString().split("T")[0]),Le(b)}),(V,P)=>{const J=Be("FormKit");return r(),o("div",Rm,[e("button",{ref_key:"triggerRef",ref:i,type:"button",onClick:u,class:oe(["w-full flex items-center gap-1 px-2 py-1 text-xs rounded-sm border transition-colors min-w-0 focus:outline-none focus:ring-2 focus:ring-accent-500/30",[_.value?"border-accent-500 bg-accent-50 dark:bg-accent-950/50 text-accent-700 dark:text-accent-300":"border-zinc-300 dark:border-zinc-600 hover:border-accent-400 dark:hover:border-accent-500 bg-white dark:bg-transparent text-zinc-700 dark:text-zinc-300"]])},[w($(Pa),{size:14,class:"shrink-0 text-zinc-400"}),e("span",Om,S(h.value),1),_.value?(r(),N($(Zt),{key:0,size:14,class:"shrink-0 text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-200",onClick:R})):(r(),N($(nt),{key:1,size:14,class:oe(["shrink-0 text-zinc-400",l.value?"rotate-180":""])},null,8,["class"]))],2),l.value?(r(),o("div",{key:0,ref_key:"popoverRef",ref:c,class:"dropdown-popover z-[9999]"},[w($(jt),{"max-height":d.value?void 0:"max-h-48",shadow:{offsetX:4,offsetY:4,intensity:.3}},{default:j(()=>[d.value?(r(),o("div",{key:1,class:"p-2.5 space-y-2.5",onClick:P[4]||(P[4]=Oe(()=>{},["stop"]))},[e("div",Nm,[P[6]||(P[6]=e("span",{class:"text-xs font-medium"},"Custom range",-1)),e("button",{type:"button",onClick:P[1]||(P[1]=Oe(Q=>d.value=!1,["stop"])),class:"text-[10px] text-neutral-500 hover:text-black dark:hover:text-white"}," ← Back ")]),e("div",qm,[w(J,{modelValue:g.value,"onUpdate:modelValue":P[2]||(P[2]=Q=>g.value=Q),type:"datepicker",label:"From","picker-only":"",popover:"",format:"MMM D, YYYY","value-format":"YYYY-MM-DD",sequence:["day"]},null,8,["modelValue"]),w(J,{modelValue:y.value,"onUpdate:modelValue":P[3]||(P[3]=Q=>y.value=Q),type:"datepicker",label:"To","picker-only":"",popover:"",format:"MMM D, YYYY","value-format":"YYYY-MM-DD",sequence:["day"]},null,8,["modelValue"])]),e("button",{type:"button",onClick:M,class:"w-full py-1.5 text-xs font-medium bg-black dark:bg-white text-white dark:text-black rounded-sm hover:opacity-90 transition-opacity"}," Apply ")])):(r(),o("div",Um,[(r(),o(he,null,we(v,Q=>e("button",{key:Q.value,type:"button",onClick:le=>k(Q),class:oe(["w-full px-2.5 py-1.5 text-left text-xs hover:bg-neutral-100 dark:hover:bg-neutral-800 transition-colors flex items-center gap-2",f.value===Q.value?"bg-accent-50 dark:bg-accent-950/30":""])},[e("span",{class:oe(["w-1.5 h-1.5 rounded-full border border-accent-500",f.value===Q.value?"bg-accent-500":""])},null,2),X(" "+S(Q.label),1)],10,Bm)),64)),e("div",Fm,[e("button",{type:"button",onClick:P[0]||(P[0]=Oe(Q=>d.value=!0,["stop"])),class:oe(["w-full px-2.5 py-1.5 text-left text-xs hover:bg-neutral-100 dark:hover:bg-neutral-800 transition-colors flex items-center gap-2",f.value==="custom"?"bg-accent-50 dark:bg-accent-950/30":""])},[e("span",{class:oe(["w-1.5 h-1.5 rounded-full border border-accent-500",f.value==="custom"?"bg-accent-500":""])},null,2),P[5]||(P[5]=X(" Custom range... ",-1))],2)])]))]),_:1},8,["max-height"])],512)):T("",!0)])}}}),Wm=Xe(Hm,[["__scopeId","data-v-88032ecc"]]),Km={class:"flex flex-col flex-1 min-h-0 overflow-visible"},Jm={class:"px-4 py-3 border-b border-neutral-300 dark:border-neutral-700"},Ym={class:"flex items-center justify-between"},Gm={class:"flex items-center gap-2"},Zm={key:0,class:"text-xs font-mono text-neutral-500 dark:text-neutral-400"},Xm={class:"flex items-center gap-2"},Qm=["title"],ev={key:0,class:"absolute -top-1 -right-1 w-3.5 h-3.5 flex items-center justify-center text-[8px] font-bold font-mono bg-accent-500 text-white rounded-full"},tv={key:0,class:"bg-neutral-100 dark:bg-neutral-950 border-b border-neutral-200 dark:border-neutral-800"},rv={class:"p-2"},av={class:"bg-white dark:bg-neutral-900 rounded-lg border border-neutral-200 dark:border-neutral-800 p-2.5 space-y-2"},ov={class:"flex items-center gap-2 w-full"},nv={class:"flex-1 min-w-0"},lv={key:0,class:"flex justify-end"},sv={key:0,class:"p-4 flex justify-center"},iv={key:1,class:"p-4 text-red-600 dark:text-red-400"},uv={key:2,class:"text-neutral-500 dark:text-neutral-400 text-center py-12"},dv={key:1,class:"text-base"},cv={key:3},pv=["id","onClick"],mv={class:"flex items-center gap-2 mb-1"},vv={class:"flex-shrink-0 text-neutral-400 dark:text-neutral-500 text-[10px]"},fv={class:"flex items-center gap-2"},hv={class:"text-[10px] text-neutral-400 dark:text-neutral-500 font-mono truncate max-w-[80px]"},gv={key:0,class:"flex flex-wrap gap-1 flex-1 min-w-0"},bv={key:0,class:"text-[10px] text-neutral-400"},xv={key:0,class:"p-3 flex justify-center"},yv={key:1,class:"p-3 text-center text-[10px] text-neutral-400 dark:text-neutral-500"},kv=50,wv=fe({__name:"ThreadListPane",props:{selectedThreadId:{}},emits:["selectThread","collapse","createThread","threadsLoaded"],setup(t,{expose:a,emit:n}){const s=n,l=m(!1),d=m(""),i=m(null),c=m(null),g=m(null),y=m(null),{agents:v,isFetching:f}=ua(),h=O(()=>v.value.map(Y=>({value:Y.name,label:Y.title||Y.name}))),_=m(0),b=m([]),u=m(!1),x=Lr(Y=>{i.value=Y||null},300);xe(d,Y=>{x(Y)});const p=O(()=>{let Y=0;return i.value&&Y++,c.value&&Y++,(g.value||y.value)&&Y++,Y});function k(){d.value="",i.value=null,c.value=null,g.value=null,y.value=null}const{threads:M,total:R,hasMore:W,isFetching:Z,isFinished:V,error:P,refetch:J}=zm({limit:kv,offset:_,search:i,agentId:c,startDate:g,endDate:y});xe([i,c,g,y],()=>{_.value=0,b.value=[],u.value=!1}),xe(M,Y=>{if(_.value===0)b.value=[...Y];else{const U=new Set(b.value.map(E=>E.id)),H=Y.filter(E=>!U.has(E.id));b.value=[...b.value,...H]}u.value=!1});const Q=m([]),le=m(new Set),me=O(()=>{const Y=b.value.filter(E=>!le.value.has(E.id)),U=new Set(Y.map(E=>E.id));return[...Q.value.filter(E=>!U.has(E.id)&&!le.value.has(E.id)),...Y].sort((E,ne)=>ne.created_at-E.created_at)}),ee=m(null);function L(){u.value||Z.value||!W.value||(u.value=!0,_.value=b.value.length)}const{arrivedState:C}=Aa(ee,{offset:{bottom:100}});xe(()=>C.bottom,Y=>{Y&&W.value&&!Z.value&&!u.value&&L()});const I=async Y=>{if(Y.type==="thread_created"){const U={id:Y.thread.id,agent_id:Y.thread.agent_name,user_id:Y.thread.user_id,tags:Y.thread.tags||[],created_at:Y.thread.created_at,agent:{name:Y.thread.agent_name,title:void 0,type:"ai_human"}};Q.value.unshift(U)}else Y.type==="thread_deleted"&&(le.value.add(Y.threadId),Q.value=Q.value.filter(U=>U.id!==Y.threadId))},{wsConnected:re,wsError:F}=Mm({onEvent:I});xe(()=>_.value,Y=>{Y===0&&(Q.value=[])});const B=m(!1);xe(()=>({threads:b.value,finished:V.value}),({threads:Y,finished:U})=>{U&&!B.value&&Y.length>0&&(B.value=!0,s("threadsLoaded",Y[0]?.id??null))},{immediate:!0}),a({refetch:J});const q=Y=>{s("selectThread",Y)};return(Y,U)=>{const H=Be("FormKit");return r(),o("div",Km,[e("div",Jm,[e("div",Ym,[e("div",Gm,[w($(jr),{size:18,class:"shrink-0"}),U[7]||(U[7]=e("h2",{class:"text-base font-bold"},"Threads",-1)),!$(Z)&&$(R)>0?(r(),o("span",Zm," ("+S($(R))+") ",1)):T("",!0),w(rr,{connected:$(re),error:$(F)},null,8,["connected","error"])]),e("div",Xm,[e("button",{onClick:U[0]||(U[0]=E=>l.value=!l.value),type:"button",class:oe(["relative p-1 rounded transition-colors hover:bg-neutral-100 dark:hover:bg-neutral-900",[l.value||p.value>0?"text-accent-600 dark:text-accent-400":""]]),title:l.value?"Hide filters":"Show filters"},[w($(ja),{size:18}),p.value>0?(r(),o("span",ev,S(p.value),1)):T("",!0)],10,Qm),e("button",{onClick:U[1]||(U[1]=E=>s("createThread")),type:"button",class:"px-2 py-1 text-xs bg-black text-white dark:bg-white dark:text-black rounded font-medium hover:opacity-90 transition-opacity whitespace-nowrap"}," + New "),e("button",{onClick:U[2]||(U[2]=E=>s("collapse")),type:"button",class:"p-1 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",title:"Collapse pane"},[w($(Dr),{size:20})])])])]),w(et,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0 -translate-y-2 max-h-0","enter-to-class":"opacity-100 translate-y-0 max-h-60","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100 translate-y-0 max-h-60","leave-to-class":"opacity-0 -translate-y-2 max-h-0"},{default:j(()=>[l.value?(r(),o("div",tv,[e("div",rv,[e("div",av,[w(H,{type:"searchInput",modelValue:d.value,"onUpdate:modelValue":U[3]||(U[3]=E=>d.value=E),placeholder:"Search by tag or thread ID...",size:"sm"},null,8,["modelValue"]),e("div",ov,[e("div",nv,[w(H,{type:"selectSearch",size:"sm","active-highlight":"",value:c.value||"",options:h.value,placeholder:"All agents","search-placeholder":"Search agents...",loading:$(f),onInput:U[4]||(U[4]=E=>c.value=E||null)},null,8,["value","options","loading"])]),w(Wm,{startDate:g.value,"onUpdate:startDate":U[5]||(U[5]=E=>g.value=E),endDate:y.value,"onUpdate:endDate":U[6]||(U[6]=E=>y.value=E),class:"flex-1 min-w-0"},null,8,["startDate","endDate"])]),p.value>0?(r(),o("div",lv,[e("button",{onClick:k,type:"button",class:"text-xs font-mono text-neutral-500 hover:text-neutral-900 dark:hover:text-neutral-100 transition-colors"}," Clear all ")])):T("",!0)])])])):T("",!0)]),_:1}),e("div",{ref_key:"scrollContainerRef",ref:ee,class:"flex-1 overflow-y-auto text-xs min-h-0"},[$(Z)&&b.value.length===0?(r(),o("div",sv,[w(Ve)])):$(P)?(r(),o("div",iv," Error: "+S($(P)),1)):me.value.length===0?(r(),o("div",uv,[p.value>0?(r(),o(he,{key:0},[U[8]||(U[8]=e("p",{class:"text-base mb-2"},"No matching threads",-1)),e("button",{onClick:k,type:"button",class:"text-xs text-accent-600 dark:text-accent-400 hover:underline"}," Clear filters ")],64)):(r(),o("p",dv,"No threads found"))])):(r(),o("div",cv,[(r(!0),o(he,null,we(me.value,E=>(r(),o("button",{key:E.id,id:`thread-${E.id}`,class:oe(["w-full text-left px-3 py-2.5 border-b border-neutral-200 dark:border-neutral-800 cursor-pointer transition-colors relative hover:bg-neutral-50 dark:hover:bg-neutral-800/50",{"bg-accent-50 dark:bg-accent-950/50 border-l-2 border-l-accent-500":t.selectedThreadId===E.id}]),onClick:ne=>q(E.id)},[e("div",mv,[e("span",{class:oe(["font-medium truncate flex-1 min-w-0",t.selectedThreadId===E.id?"text-accent-700 dark:text-accent-300":""])},S(E.agent.title||E.agent.name),3),e("span",vv,[w(yt,{timestamp:E.created_at*1e6},null,8,["timestamp"])])]),e("div",fv,[e("span",hv,S(E.id.slice(0,8)),1),E.tags.length>0?(r(),o("div",gv,[(r(!0),o(he,null,we(E.tags.slice(0,3),ne=>(r(),o("span",{key:ne,class:oe(["inline-block px-1.5 py-0.5 rounded text-[10px] truncate max-w-[60px]",t.selectedThreadId===E.id?"bg-accent-200 dark:bg-accent-900 text-accent-800 dark:text-accent-200":"bg-neutral-200 dark:bg-neutral-800 text-neutral-600 dark:text-neutral-400"])},S(ne),3))),128)),E.tags.length>3?(r(),o("span",bv," +"+S(E.tags.length-3),1)):T("",!0)])):T("",!0)])],10,pv))),128)),u.value||$(Z)&&b.value.length>0?(r(),o("div",xv,[w(Ve)])):!$(W)&&me.value.length>0?(r(),o("div",yv," All "+S($(R))+" threads loaded ",1)):T("",!0)]))],512)])}}});function _v(t,a={}){const n=m(null),s=m(!1),l=m(null);let d=null;try{d=qr()}catch{}const i=d?.workblocks??O(()=>[]),c=d?.messages??m([]),g=O(()=>d?.status.value==="connected"),y=m(null);d?.loading??m(!1);const v=O(()=>c.value.some(F=>F.status==="pending")),f=m(!1),h=m(0),_=m(!1);function b(F){if(!n.value?.agent)return null;const B=n.value.agent,q=F==="assistant"?"A":"B";return q==="A"&&B.side_a_label?B.side_a_label:q==="B"&&B.side_b_label?B.side_b_label:null}function u(F){return{id:F.id||`att-${F.path||F.name||Math.random().toString(36).slice(2)}`,type:"file",path:F.path||"",name:F.name||F.path?.split("/").pop()||"attachment",mimeType:F.mimeType||F.mediaType||"application/octet-stream",width:F.width,height:F.height,description:F.description}}function x(F){if(F){if(Array.isArray(F))return F.length>0?F.map(u):void 0;try{const B=JSON.parse(F);return Array.isArray(B)&&B.length>0?B.map(u):void 0}catch(B){console.error("Failed to parse attachments:",B);return}}}function p(F,B){const q=[];F.reasoning_content&&q.push({id:`${F.id}-reasoning`,type:"reasoning",content:F.reasoning_content,created_at:F.created_at}),F.content&&q.push({id:`${F.id}-content`,type:"content",content:F.content,created_at:F.created_at});const Y=F.workItems.filter(A=>A.type==="tool_call"),U=F.workItems.filter(A=>A.type==="tool_result"),H=new Map;for(const A of U)A.tool_call_id&&H.set(A.tool_call_id,A);for(const A of Y){const pe=A.tool_call_id||A.id,ue=H.get(pe);let ke="pending";if(ue){const Ee=(ue.content||"").toLowerCase(),ae=Ee.includes("failed")||Ee.includes("error"),z=Ee.length<500;ke=ue.status==="error"||ae&&z?"failed":"success"}q.push({id:A.id,type:"tool_call",content:A.name||"",created_at:F.created_at,tool_name:A.name,tool_call_id:pe,tool_arguments:A.content||void 0,response:ue?.content||null,response_status:ke,response_log_id:null,log_id:null})}const E=q.some(A=>A.type==="tool_call"&&A.response_status==="pending"),ne=F.status!=="pending"&&!E;return{type:"work",id:F.id,role:"assistant",items:q,created_at:F.created_at,updated_at:F.created_at,isComplete:ne,sideLabel:b("assistant"),status:F.status}}const k=O(()=>{const F=[],q=i.value.filter(U=>(U.depth??0)===0);let Y=[];for(let U=0;U<q.length;U++){const H=q[U];if(F[F.length-1]?.role,H.type==="workblock"){const ne=p(H);F.push(ne);const A=H;A.attachments&&A.attachments.length>0&&Y.push(...A.attachments.map(u))}else{const ne=H,A=ne.role;if(ne.role==="tool")continue;const pe=x(ne.attachments);let ue;if((Y.length>0||pe)&&(ue=[...Y,...pe||[]],Y=[]),ne.content||A==="system"||ne.status==="pending"||ue?.length){const ke={type:"text",id:ne.id,role:A,content:ne.content||"",attachments:ue?.length?ue:void 0,created_at:ne.created_at,log_id:ne.log_id||null,sideLabel:b(A),isOptimistic:ne.isOptimistic,status:ne.status,silent:ne.silent};F.push(ke)}}}return F});async function M(){if(!t.value){n.value=null;return}try{const F=await fetch(ge(`/api/threads/${t.value}`));F.ok&&(n.value=await F.json())}catch(F){console.error("Error fetching thread info:",F)}}async function R(F){if(t.value){if(d?.deleteMessage){await d.deleteMessage(F);return}try{if(!(await fetch(ge(`/api/threads/${t.value}/messages/${F}`),{method:"DELETE"})).ok)throw new Error("Failed to delete message")}catch(B){throw B}}}async function W(F,B){if(t.value)try{if(!(await fetch(ge(`/api/threads/${t.value}/messages/${F}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:B})})).ok)throw new Error("Failed to update message")}catch(q){throw q}}xe(t,async F=>{F?(s.value=!0,await M(),s.value=!1):n.value=null},{immediate:!0});const Z=d?.sendMessage,V=d?.stopExecution,P=d?.attachments??m([]),J=d?.addAttachment??(()=>{}),Q=d?.removeAttachment??(()=>{}),le=d?.clearAttachments??(()=>{});function me(){console.warn("loadMoreMessages is deprecated - SDK handles all messages")}function ee(){console.warn("connectWebSocket is deprecated - SDK handles WebSocket")}function L(){console.warn("disconnectWebSocket is deprecated - SDK handles WebSocket")}function C(){console.warn("addOptimisticMessage is deprecated - SDK handles optimistic updates")}function I(){console.warn("removeOptimisticMessage is deprecated - SDK handles optimistic updates")}async function re(){console.warn("refetch is deprecated - SDK handles message loading")}return{messages:k,threadInfo:n,isFetching:s,isLoadingMore:_,error:l,wsConnected:g,wsError:y,isExecuting:v,hasMore:f,totalMessages:h,sendMessage:Z,stopThread:V,attachments:P,addAttachment:J,removeAttachment:Q,clearAttachments:le,deleteMessageById:R,updateMessageContent:W,refetch:re,loadMoreMessages:me,connectWebSocket:ee,disconnectWebSocket:L,addOptimisticMessage:C,removeOptimisticMessage:I}}const $v={key:0,class:"absolute inset-0 flex items-center justify-center bg-neutral-100 dark:bg-neutral-800"},Cv={key:1,class:"absolute inset-0 flex items-center justify-center bg-neutral-100 dark:bg-neutral-800 text-neutral-400"},Sv=["src","alt"],Tv={class:"absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center"},Iv={key:0,class:"text-white text-[10px]"},zv={class:"text-xs text-neutral-600 dark:text-neutral-300 truncate max-w-[100px]"},Mv=fe({__name:"FileAttachment",props:{attachment:{},threadId:{},showRemove:{type:Boolean}},emits:["remove"],setup(t,{emit:a}){const n=t,s=a,l=m(!0),d=m(!1),i=O(()=>n.attachment.mimeType.startsWith("image/")),c=O(()=>!!n.attachment.thumbnailBase64),g=O(()=>{if(!n.threadId||!n.attachment.path)return"";const b=n.attachment.path.startsWith("/")?n.attachment.path.slice(1):n.attachment.path;return ge(`/api/threads/${n.threadId}/fs/${b}`)}),y=O(()=>i.value?n.attachment.thumbnailBase64?`data:image/webp;base64,${n.attachment.thumbnailBase64}`:g.value:"");function v(){l.value=!1,d.value=!1}function f(){l.value=!1,d.value=!0}function h(){s("remove",n.attachment.id)}function _(){g.value&&window.open(g.value,"_blank")}return(b,u)=>(r(),o("div",{class:oe(["relative group inline-flex items-center rounded-lg overflow-hidden border border-neutral-200 dark:border-neutral-700",{"w-[104px] h-[104px]":i.value,"px-2 py-1 bg-neutral-100 dark:bg-neutral-800":!i.value,"cursor-pointer":i.value&&g.value}]),onClick:u[0]||(u[0]=x=>i.value&&g.value?_():void 0)},[i.value?(r(),o(he,{key:0},[l.value&&!d.value&&!c.value?(r(),o("div",$v,[...u[1]||(u[1]=[e("div",{class:"w-4 h-4 border-2 border-neutral-300 border-t-neutral-600 rounded-full animate-spin"},null,-1)])])):T("",!0),d.value&&!c.value?(r(),o("div",Cv,[w($(Rr),{size:24})])):T("",!0),Ae(e("img",{src:y.value||g.value,alt:t.attachment.name,class:"w-full h-full object-cover",onLoad:v,onError:f},null,40,Sv),[[Ke,!l.value&&!d.value||c.value]]),e("div",Tv,[g.value?(r(),o("span",Iv,"Click to view")):T("",!0)])],64)):(r(),o(he,{key:1},[w($(Or),{size:14,class:"text-neutral-500 mr-1 flex-shrink-0"}),e("span",zv,S(t.attachment.name),1)],64)),t.showRemove?(r(),o("button",{key:2,onClick:Oe(h,["stop"]),class:"absolute -top-1 -right-1 w-4 h-4 rounded-full bg-red-500 text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity"},[w($(Zt),{size:10})])):T("",!0)],2))}}),Vv=["onMouseenter","onMouseleave","onClick"],Ev=["onClick"],Lv={key:0,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"3",stroke:"currentColor",class:"w-3 h-3 text-white"},Pv={key:1,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2.5",stroke:"currentColor",class:"w-3 h-3 text-white"},Av={key:0,class:"w-full text-center text-xs text-neutral-400 dark:text-neutral-500 py-1"},jv=["contenteditable","onInput"],Dv={key:1,class:"flex gap-1 items-center min-h-[1.5rem]"},Rv={key:0,class:"opacity-50"},Ov={key:1,class:"opacity-50 italic text-neutral-500 dark:text-neutral-400"},Uv={key:0,class:"flex flex-wrap gap-2"},Bv=["onClick","onMouseenter"],Fv={key:0,class:"space-y-1"},Nv={class:"flex items-start gap-2"},qv={class:"flex-1 min-w-0"},Hv={key:0,class:"truncate opacity-80"},Wv={key:1,class:"italic opacity-60"},Kv={class:"flex items-center gap-2 pl-5 opacity-60"},Jv={class:"text-[10px]"},Yv={class:"text-[10px]"},Gv={key:1,class:"space-y-2"},Zv={class:"flex items-center gap-2 pb-1 border-b border-current opacity-70"},Xv={class:"text-[10px] italic"},Qv={class:"text-[10px] ml-auto"},ef={key:0,class:"space-y-1"},tf=["onClick","onMouseenter"],rf={class:"font-mono text-[11px] flex-shrink-0"},af={key:2,class:"text-[10px] opacity-60 px-2 truncate flex-1 min-w-0"},of={key:3,class:"text-[10px] text-green-600 dark:text-green-400 ml-auto flex-shrink-0"},nf={key:0,class:"pl-4 space-y-2 text-[10px]"},lf={key:0},sf={class:"w-full border-collapse"},uf={class:"py-0.5 pr-2 opacity-65 align-top"},df={class:"py-0.5 opacity-85 break-all"},cf={key:1},pf=["onClick","onMouseenter"],mf={class:"whitespace-pre-wrap break-all"},vf={key:1,class:"text-[10px]"},ff=["onClick"],hf={key:0,class:"mt-1 pl-4 whitespace-pre-wrap break-words opacity-80"},gf={key:2,class:"text-[10px] opacity-80 pl-4 pb-2 break-words"},bf=fe({__name:"AgentMessages",props:{messages:{},threadId:{},selectedMessageId:{},selectedLogId:{},hoveredLogId:{},isEditMode:{type:Boolean},selectedForDelete:{},editedMessages:{}},emits:["messageClick","messageHover","selectionChange","messageEdit"],setup(t,{expose:a,emit:n}){const s=t,l=n;function d(U){const H=s.selectedForDelete?.has(U)??!1;l("selectionChange",U,!H)}function i(U,H){const ne=U.target.innerText;l("messageEdit",H,ne)}function c(U){return s.editedMessages?.has(U)??!1}const g=m(new Map);function y(U,H){H?g.value.set(U,H):g.value.delete(U)}function v(U){const H=s.messages.findIndex(E=>E.log_id===U);if(H<=0)return-1;for(let E=H-1;E>=0;E--){const ne=s.messages[E];if(ne.role==="user")return E;if(ne.role==="assistant"&&ne.log_id)break}return-1}function f(U){for(let H=0;H<s.messages.length;H++){const E=s.messages[H];if(E.log_id===U||E.type==="work"&&E.items&&E.items.some(pe=>pe.log_id===U||pe.response_log_id===U))return H}return-1}function h(U,H){const ne=f(U);if(ne===-1)return!1;const A=g.value.get(ne);if(!A)return!1;const pe=s.messages[ne];let ue=null;if(pe.role==="assistant"&&pe.log_id){const ae=v(pe.log_id);ue=ae!==-1?g.value.get(ae):null}const ke=H.getBoundingClientRect(),Ee=A.getBoundingClientRect();if(Ee.top<ke.top){const K=(ue||A).getBoundingClientRect().top-ke.top-10;H.scrollBy({top:K,behavior:"smooth"})}else if(Ee.bottom>ke.bottom){const ae=Ee.bottom-ke.bottom+10;H.scrollBy({top:ae,behavior:"smooth"})}else if(ue){const ae=ue.getBoundingClientRect();if(ae.top<ke.top){const z=ae.top-ke.top-10;H.scrollBy({top:z,behavior:"smooth"})}}return!0}function _(U){for(const H of s.messages){if(H.type!=="work")continue;if(H.items.some(A=>A.log_id===U||A.response_log_id===U))return!0}return!1}a({scrollToLogId:h,hasWorkblockForLogId:_});function b(U){const H=s.messages[U];if(H.log_id)return H.log_id;if(H.role==="user")for(let E=U+1;E<s.messages.length;E++){const ne=s.messages[E];if(ne.log_id)return ne.log_id;if(ne.role==="user")break}return null}function u(U,H){return H?b(U)===H:!1}function x(U){const H=b(U);H&&l("messageHover",H)}function p(U){b(U)&&l("messageHover",null)}function k(U){const H=s.messages[U],E=b(U);E&&l("messageClick",H.id,E)}const M=m(new Set),R=m(new Set),W=m(new Set);function Z(U){M.value.has(U)?M.value.delete(U):M.value.add(U)}function V(U){R.value.has(U)?R.value.delete(U):R.value.add(U)}function P(U){W.value.has(U)?W.value.delete(U):W.value.add(U)}function J(U){if(!U)return{};try{return JSON.parse(U)}catch{return{raw:U}}}function Q(U){if(!U)return null;const H=J(U),E=Object.keys(H);if(E.length===0)return null;const ne=H[E[0]];return typeof ne=="string"?ne:JSON.stringify(ne)}function le(U){return new Date(U/1e3).toLocaleTimeString()}function me(U){const H=Math.round(U/1e6);if(H<1)return"< 1s";if(H<60)return`${H}s`;const E=Math.floor(H/60),ne=H%60;return`${E}m ${ne}s`}function ee(U){if(U.status==="pending")return"...";if(!U.isComplete)return"Working...";let H;return U.request_sent_at&&U.response_completed_at?H=U.response_completed_at-U.request_sent_at:H=U.updated_at-U.created_at,`Worked for ${me(H)}`}function L(U){const H=U.filter(E=>E.type==="content");if(H.length===0){const E=U.filter(ne=>ne.type==="reasoning");return E.length>0?E[E.length-1].content:null}return H[H.length-1].content}function C(U){const E=U.trim().split(`
|
|
37
|
+
`)[0];return E.length>60?E.substring(0,60):E}function I(U){return s.selectedMessageId===U.id?!0:s.selectedLogId?U.items.some(H=>H.log_id===s.selectedLogId||H.response_log_id===s.selectedLogId):!1}function re(U){return!!(s.selectedLogId&&(U.log_id===s.selectedLogId||U.response_log_id===s.selectedLogId))}function F(U){return s.hoveredLogId?U.items.some(H=>H.log_id===s.hoveredLogId||H.response_log_id===s.hoveredLogId):!1}function B(U){return!!(s.hoveredLogId&&(U.log_id===s.hoveredLogId||U.response_log_id===s.hoveredLogId))}function q(U){const H=[];for(const E of U.items)E.log_id&&H.push(E.log_id),E.response_log_id&&H.push(E.response_log_id);return H}function Y(U){return U?U.trim():""}return(U,H)=>(r(),o("div",null,[(r(!0),o(he,null,we(t.messages,(E,ne)=>(r(),o("div",{key:E.id,ref_for:!0,ref:A=>y(ne,A),class:"flex items-center gap-2 pb-3",onMouseenter:A=>x(ne),onMouseleave:A=>p(ne),onClick:A=>t.isEditMode?d(E.id):k(ne)},[t.isEditMode&&E.role!=="system"?(r(),o("button",{key:0,onClick:Oe(A=>d(E.id),["stop"]),class:oe(["flex-shrink-0 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-all",{"border-red-500 bg-red-500":t.selectedForDelete?.has(E.id),"border-green-500 bg-green-500":!t.selectedForDelete?.has(E.id)&&c(E.id),"border-neutral-400 dark:border-neutral-500 bg-transparent hover:border-neutral-500 dark:hover:border-neutral-400":!t.selectedForDelete?.has(E.id)&&!c(E.id)}])},[t.selectedForDelete?.has(E.id)?(r(),o("svg",Lv,[...H[4]||(H[4]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4.5 12.75l6 6 9-13.5"},null,-1)])])):c(E.id)?(r(),o("svg",Pv,[...H[5]||(H[5]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125"},null,-1)])])):T("",!0)],10,Ev)):T("",!0),e("div",{class:oe(["flex-1 flex items-center gap-2 min-w-0",{"justify-start":E.role==="assistant","justify-end":E.role==="user","justify-center":E.role==="system","cursor-pointer":b(ne)&&!t.isEditMode}])},[E.type==="text"&&E.role==="system"&&E.content?.includes("Execution stopped")?(r(),o("div",Av,S(E.content),1)):E.type==="text"?(r(),o("div",{key:1,class:oe(["max-w-[80%] flex flex-col gap-2",{"items-start":E.role==="assistant","items-end":E.role==="user"}])},[e("div",{class:oe(["rounded-2xl px-4 py-2 text-sm transition-all min-h-[2.5rem]",[E.silent?"bg-neutral-300 text-neutral-500 dark:bg-neutral-700 dark:text-neutral-400 opacity-70 border-2 border-dashed border-neutral-400 dark:border-neutral-500":!t.isEditMode&&E.role!=="user"&&u(ne,t.selectedLogId)?"bg-accent-200 text-accent-950 dark:bg-accent-200 dark:text-accent-950 ring-2 ring-accent-400 dark:ring-accent-400":E.role==="assistant"?"bg-neutral-800 text-white dark:bg-neutral-300 dark:text-black":E.role==="user"?"bg-neutral-200 text-black dark:bg-neutral-800 dark:text-white":"bg-neutral-100 text-neutral-600 dark:bg-neutral-900 dark:text-neutral-400 text-xs",{"opacity-60":E.isOptimistic},{"ring-2 ring-accent-400 dark:ring-accent-400 !bg-accent-200 !text-accent-950 dark:!bg-accent-200 dark:!text-accent-950":!t.isEditMode&&E.role!=="user"&&b(ne)&&!E.silent&&!u(ne,t.selectedLogId)&&u(ne,t.hoveredLogId)},{"ring-2 ring-green-500 dark:ring-green-400":t.isEditMode&&c(E.id),"border border-dashed border-neutral-400 dark:border-neutral-500":t.isEditMode&&E.role!=="system"&&!c(E.id)}]])},[E.content||t.isEditMode?(r(),o("div",{key:0,class:"whitespace-pre-wrap break-words text-sm outline-none",contenteditable:t.isEditMode&&E.role!=="system",onInput:A=>i(A,E.id),onClick:H[0]||(H[0]=A=>t.isEditMode&&A.stopPropagation())},S(Y(E.content)),41,jv)):E.status==="pending"?(r(),o("div",Dv,[...H[6]||(H[6]=[e("span",{class:"typing-dot",style:{"animation-delay":"0ms"}},null,-1),e("span",{class:"typing-dot",style:{"animation-delay":"150ms"}},null,-1),e("span",{class:"typing-dot",style:{"animation-delay":"300ms"}},null,-1)])])):T("",!0),E.status!=="pending"?(r(),o("div",{key:2,class:oe(["text-[10px] mt-1 opacity-50 flex gap-2",{"justify-start":E.role==="assistant","justify-end":E.role!=="assistant"}])},[E.sideLabel?(r(),o("span",Rv,S(E.sideLabel),1)):T("",!0),e("span",null,S(le(E.created_at)),1),E.silent?(r(),o("span",Ov," silent ")):T("",!0)],2)):T("",!0)],2),E.attachments?.length&&t.threadId?(r(),o("div",Uv,[(r(!0),o(he,null,we(E.attachments,A=>(r(),N(Mv,{key:A.id,attachment:A,threadId:t.threadId},null,8,["attachment","threadId"]))),128))])):T("",!0)],2)):E.type==="work"?(r(),o("div",{key:2,class:oe(["w-full rounded-lg px-3 py-2 text-xs transition-all border overflow-hidden",{"cursor-pointer":!t.isEditMode,"bg-neutral-50 text-neutral-700 border-neutral-200 dark:bg-neutral-900 dark:text-neutral-300 dark:border-neutral-700":E.role==="assistant"&&!E.silent,"bg-accent-50 text-accent-700 border-accent-200 dark:bg-accent-50 dark:text-accent-700 dark:border-accent-200":E.role==="user"&&!E.silent,"bg-neutral-200 text-neutral-500 border-neutral-400 dark:bg-neutral-800 dark:text-neutral-400 dark:border-neutral-600 opacity-70 border-dashed":E.silent,"ring-2 ring-accent-500":!t.isEditMode&&I(E),"ring-2 ring-accent-400":!t.isEditMode&&!I(E)&&F(E)}]),onClick:A=>!t.isEditMode&&(Z(E.id),q(E)[0]&&l("messageClick",E.id,q(E)[0])),onMouseenter:A=>!t.isEditMode&&q(E)[0]&&l("messageHover",q(E)[0]),onMouseleave:H[3]||(H[3]=A=>!t.isEditMode&&l("messageHover",null))},[M.value.has(E.id)?(r(),o("div",Gv,[e("div",Zv,[w($(nt),{size:14,class:"flex-shrink-0"}),e("span",Xv,S(ee(E)),1),e("span",Qv,S(E.items.length)+" operation"+S(E.items.length!==1?"s":""),1)]),(r(!0),o(he,null,we(E.items,A=>(r(),o("div",{key:A.id,class:"mb-1"},[A.type==="tool_call"?(r(),o("div",ef,[e("div",{onClick:Oe(pe=>{V(A.id),A.log_id&&l("messageClick",E.id,A.log_id)},["stop"]),onMouseenter:Oe(pe=>A.log_id&&l("messageHover",A.log_id),["stop"]),onMouseleave:H[1]||(H[1]=Oe(pe=>l("messageHover",null),["stop"])),class:oe(["flex items-center gap-2 cursor-pointer hover:opacity-70 transition-opacity min-w-0",{"ring-1 ring-accent-500":re(A),"ring-1 ring-accent-400":!re(A)&&B(A)}])},[R.value.has(A.id)?(r(),N($(nt),{key:1,size:12,class:"flex-shrink-0 opacity-50"})):(r(),N($(vt),{key:0,size:12,class:"flex-shrink-0 opacity-50"})),e("span",rf,S(A.tool_name),1),Q(A.tool_arguments)?(r(),o("span",af,S(Q(A.tool_arguments)),1)):T("",!0),A.response_status==="success"?(r(),o("span",of,"✓")):A.response_status==="failed"?(r(),N($(Mr),{key:4,size:12,class:"ml-auto text-red-600 dark:text-red-400"})):T("",!0)],42,tf),R.value.has(A.id)?(r(),o("div",nf,[A.tool_arguments?(r(),o("div",lf,[H[7]||(H[7]=e("div",{class:"font-semibold mb-1 opacity-70"},"Arguments:",-1)),e("table",sf,[e("tbody",null,[(r(!0),o(he,null,we(J(A.tool_arguments),(pe,ue)=>(r(),o("tr",{key:ue,class:"border-b border-current border-opacity-10"},[e("td",uf,S(ue),1),e("td",df,S(typeof pe=="object"?JSON.stringify(pe):pe),1)]))),128))])])])):T("",!0),A.response?(r(),o("div",cf,[H[8]||(H[8]=e("div",{class:"font-semibold mb-1 opacity-70"},"Response:",-1)),e("div",{class:oe(["opacity-80 cursor-pointer hover:opacity-100",{"ring-1 ring-accent-500":t.selectedLogId&&A.response_log_id===t.selectedLogId,"ring-1 ring-accent-400":t.hoveredLogId&&A.response_log_id===t.hoveredLogId&&A.response_log_id!==t.selectedLogId}]),onClick:Oe(pe=>A.response_log_id&&l("messageClick",E.id,A.response_log_id),["stop"]),onMouseenter:Oe(pe=>A.response_log_id&&l("messageHover",A.response_log_id),["stop"]),onMouseleave:H[2]||(H[2]=Oe(pe=>l("messageHover",null),["stop"]))},[e("div",mf,S(Y(A.response)),1)],42,pf)])):T("",!0)])):T("",!0)])):A.type==="reasoning"?(r(),o("div",vf,[e("button",{onClick:Oe(pe=>P(A.id),["stop"]),class:"flex items-center gap-1 opacity-70 hover:opacity-100 transition-opacity"},[W.value.has(A.id)?(r(),N($(nt),{key:1,size:12,class:"flex-shrink-0"})):(r(),N($(vt),{key:0,size:12,class:"flex-shrink-0"})),H[9]||(H[9]=e("span",{class:"font-semibold"},"Reasoning",-1))],8,ff),W.value.has(A.id)?(r(),o("div",hf,S(Y(A.content)),1)):T("",!0)])):A.type==="content"?(r(),o("div",gf,S(Y(A.content)),1)):T("",!0)]))),128))])):(r(),o("div",Fv,[e("div",Nv,[w($(vt),{size:14,class:"flex-shrink-0 mt-0.5 opacity-50"}),e("div",qv,[L(E.items)?(r(),o("div",Hv,S(C(L(E.items)))+"... ",1)):(r(),o("div",Wv,S(ee(E)),1))])]),e("div",Kv,[e("span",Jv,S(E.items.length)+" operation"+S(E.items.length!==1?"s":""),1),e("span",Yv,"• "+S(ee(E)),1)])]))],42,Bv)):T("",!0)],2)],40,Vv))),128))]))}}),xf=Xe(bf,[["__scopeId","data-v-884a0fa7"]]),yf=["onClick"],kf=["value","placeholder","disabled"],wf=fe({__name:"TagInput",props:{modelValue:{},placeholder:{},disabled:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:a}){const n=t,s=a,l=m(""),d=m(null),i=f=>{const h=f.trim().toLowerCase();h&&!n.modelValue.includes(h)&&s("update:modelValue",[...n.modelValue,h]),l.value="",Le(()=>d.value?.focus())},c=f=>{const h=[...n.modelValue];h.splice(f,1),s("update:modelValue",h)},g=f=>{const h=f.target.value;if(h.includes(",")){const _=h.split(",");_.forEach((b,u)=>{u<_.length-1?i(b):l.value=b})}else l.value=h},y=f=>{f.key==="Enter"?(f.preventDefault(),i(l.value)):f.key==="Backspace"&&!l.value&&n.modelValue.length>0&&c(n.modelValue.length-1)},v=()=>{d.value?.focus()};return(f,h)=>(r(),o("div",{class:oe(["flex flex-wrap items-center gap-1.5 min-h-[32px] px-2 py-1.5 bg-white dark:bg-neutral-950 border border-neutral-200 dark:border-neutral-800 rounded-md cursor-text focus-within:ring-2 focus-within:ring-accent-500/20 focus-within:border-accent-500 transition-colors",{"opacity-50 cursor-not-allowed":t.disabled}]),onClick:v},[(r(!0),o(he,null,we(t.modelValue,(_,b)=>(r(),o("span",{key:_,class:"inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium bg-accent-100 dark:bg-accent-900/30 text-accent-700 dark:text-accent-300 rounded"},[X(S(_)+" ",1),t.disabled?T("",!0):(r(),o("button",{key:0,type:"button",onClick:Oe(u=>c(b),["stop"]),class:"hover:text-accent-900 dark:hover:text-accent-100 transition-colors"},[w($(Zt),{size:12})],8,yf))]))),128)),e("input",{ref_key:"inputRef",ref:d,type:"text",value:l.value,placeholder:t.modelValue.length===0?t.placeholder:"",disabled:t.disabled,class:"flex-1 min-w-[60px] bg-transparent border-none outline-none text-xs text-neutral-900 dark:text-neutral-100 placeholder:text-neutral-400 disabled:cursor-not-allowed",onInput:g,onKeydown:y},null,40,kf)],2))}}),_f={key:0,class:"overflow-hidden bg-neutral-100 dark:bg-neutral-950"},$f={class:"max-h-[500px] overflow-y-auto p-3 space-y-3"},Cf={key:0,class:"flex justify-center py-6"},Sf={key:1,class:"text-red-600 dark:text-red-400 text-center py-4 text-xs"},Tf={class:"bg-white dark:bg-neutral-900 rounded-lg border border-neutral-200 dark:border-neutral-800 overflow-hidden"},If={class:"p-3 space-y-2"},zf={class:"text-[10px] text-neutral-500 dark:text-neutral-400"},Mf=["title"],Vf={class:"flex-1 text-[11px] font-mono text-neutral-600 dark:text-neutral-400 truncate"},Ef={class:"flex items-center gap-2"},Lf={class:"flex-1 flex items-center gap-1.5"},Pf={key:1,class:"text-xs text-neutral-700 dark:text-neutral-200"},Af={class:"text-[9px] px-1.5 py-0.5 rounded bg-neutral-100 dark:bg-neutral-800 text-neutral-500 dark:text-neutral-400 uppercase tracking-wide shrink-0"},jf={class:"flex items-start gap-2"},Df={class:"bg-white dark:bg-neutral-900 rounded-lg border border-neutral-200 dark:border-neutral-800 overflow-hidden"},Rf=["disabled"],Of={key:0,class:"overflow-hidden border-t border-neutral-100 dark:border-neutral-800"},Uf={class:"p-3 space-y-3"},Bf={class:"flex gap-4 text-xs"},Ff={class:"ml-1 font-mono font-semibold text-neutral-800 dark:text-neutral-100"},Nf={class:"ml-1 font-mono text-neutral-600 dark:text-neutral-400"},qf={key:0,class:"w-full text-[11px]"},Hf=["title"],Wf={class:"text-right py-1.5 font-mono text-neutral-600 dark:text-neutral-400"},Kf={class:"text-right py-1.5 font-mono text-neutral-600 dark:text-neutral-400"},Jf={class:"bg-white dark:bg-neutral-900 rounded-lg border border-neutral-200 dark:border-neutral-800 overflow-hidden"},Yf={key:0,class:"overflow-hidden border-t border-neutral-100 dark:border-neutral-800"},Gf={class:"p-3 space-y-3"},Zf={class:"flex items-center gap-2"},Xf=["disabled"],Qf={class:"pt-2 border-t border-neutral-100 dark:border-neutral-800"},eh=["disabled"],th=fe({__name:"MetadataSlidePane",props:{threadId:{},show:{type:Boolean}},emits:["close","threadDeleted","editThread","threadUpdated"],setup(t,{emit:a}){const n=t,s=a,{thread:l,isFetching:d,error:i,refetch:c}=tr(O(()=>n.threadId)),{agents:g,isFetching:y}=ua(),v=m(!1),f=m(!1),h=m(!1),_=m(!1),b=m(!1),u=m(!1),x=m(!1),p=m(!1),k=m("a"),M=m(!1),R=m(""),W=m([]),Z=m(!1),V=m(null),P=O(()=>g.value?g.value.filter(B=>B.type==="ai_human").map(B=>({value:B.id,label:B.title})):[]),J=O(()=>l.value?.agent.type==="ai_human"),Q=O(()=>l.value?.agent.type==="dual_ai"),le=B=>new Date(B*1e3).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}),me=async()=>{l.value&&(await navigator.clipboard.writeText(l.value.id),M.value=!0,setTimeout(()=>{M.value=!1},2e3))},ee=async B=>{if(!(!n.threadId||!B||B===l.value?.agent.id)){h.value=!0;try{const q=await fetch(ge(`/api/threads/${n.threadId}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent_id:B})});if(!q.ok){const Y=await q.json();throw new Error(Y.error||"Failed to update agent")}await c(),s("threadUpdated")}catch(q){console.error("Error updating agent:",q),R.value=l.value?.agent.id||""}finally{h.value=!1}}},L=async B=>{if(n.threadId){W.value=B,Z.value=!0,_.value=!0;try{const q=await fetch(ge(`/api/threads/${n.threadId}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tags:B})});if(!q.ok){const Y=await q.json();throw new Error(Y.error||"Failed to update tags")}s("threadUpdated")}catch(q){console.error("Error updating tags:",q),W.value=l.value?.tags||[]}finally{_.value=!1,Z.value=!1}}},C=async()=>{if(b.value){b.value=!1;return}if(n.threadId){x.value=!0,b.value=!0;try{const B=await fetch(ge(`/api/threads/${n.threadId}/cost`));if(!B.ok){const q=await B.json();throw new Error(q.error||"Failed to fetch cost breakdown")}V.value=await B.json()}catch(B){console.error("Error fetching cost breakdown:",B),b.value=!1}finally{x.value=!1}}},I=B=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:4,maximumFractionDigits:6}).format(B),re=async()=>{if(n.threadId){p.value=!0;try{const B=await fetch(ge(`/api/threads/${n.threadId}/continue`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({side:k.value})});if(!B.ok){const q=await B.json();throw new Error(q.error||"Failed to continue execution")}}catch(B){console.error("Error continuing execution:",B)}finally{p.value=!1}}},F=async()=>{if(n.threadId){f.value=!0;try{const B=await fetch(ge(`/api/threads/${n.threadId}`),{method:"DELETE"});if(!B.ok){const q=await B.json();throw new Error(q.error||"Failed to delete thread")}s("threadDeleted",n.threadId)}catch(B){console.error("Error deleting thread:",B)}finally{f.value=!1}}};return xe(()=>l.value,B=>{B&&(R.value=B.agent.id,Z.value||(W.value=B.tags||[]))},{immediate:!0}),xe(()=>n.show,B=>{B||(b.value=!1,u.value=!1,V.value=null)}),xe(()=>n.threadId,()=>{b.value=!1,u.value=!1,V.value=null}),(B,q)=>{const Y=Be("FormKit");return r(),N(et,{"enter-active-class":"transition-all duration-300 ease-out","enter-from-class":"max-h-0 opacity-0","enter-to-class":"max-h-[500px] opacity-100","leave-active-class":"transition-all duration-200 ease-in","leave-from-class":"max-h-[500px] opacity-100","leave-to-class":"max-h-0 opacity-0"},{default:j(()=>[t.show&&t.threadId?(r(),o("div",_f,[e("div",$f,[$(d)?(r(),o("div",Cf,[w(Ve)])):$(i)?(r(),o("div",Sf," Error: "+S($(i)),1)):$(l)?(r(),o(he,{key:2},[e("div",Tf,[e("div",If,[e("div",zf,[q[5]||(q[5]=e("span",{class:"font-medium uppercase tracking-wide"},"Created",-1)),q[6]||(q[6]=e("span",{class:"mx-1"},"·",-1)),X(" "+S(le($(l).created_at)),1)]),e("div",{class:"flex items-center gap-1 px-2 py-1.5 bg-neutral-50 dark:bg-neutral-950 rounded border border-neutral-200 dark:border-neutral-800 cursor-pointer hover:border-neutral-300 dark:hover:border-neutral-700 transition-colors group",onClick:me,title:M.value?"Copied!":"Click to copy"},[e("code",Vf,S($(l).id),1),e("span",{class:oe(["shrink-0 transition-colors",M.value?"text-green-600 dark:text-green-400":"text-neutral-400 group-hover:text-neutral-600 dark:group-hover:text-neutral-300"])},[M.value?(r(),N($(Da),{key:0,size:12})):(r(),N($(Ra),{key:1,size:12}))],2)],8,Mf),e("div",Ef,[q[7]||(q[7]=e("label",{class:"shrink-0 text-[10px] font-medium text-neutral-500 dark:text-neutral-400 uppercase tracking-wide w-10"},"Agent",-1)),e("div",Lf,[J.value?(r(),N(Y,{key:0,type:"selectSearch",modelValue:R.value,"onUpdate:modelValue":q[0]||(q[0]=U=>R.value=U),options:P.value,loading:$(y)||h.value,disabled:h.value,size:"sm",placeholder:"Select...",onInput:ee,"outer-class":"!mb-0 flex-1"},null,8,["modelValue","options","loading","disabled"])):(r(),o("span",Pf,S($(l).agent.title),1)),e("span",Af,S($(l).agent.type.replace("_"," ")),1)])]),e("div",jf,[q[8]||(q[8]=e("label",{class:"shrink-0 text-[10px] font-medium text-neutral-500 dark:text-neutral-400 uppercase tracking-wide w-10 pt-2"},"Tags",-1)),w(wf,{"model-value":W.value,"onUpdate:modelValue":L,disabled:_.value,placeholder:"Add tags...",class:"flex-1"},null,8,["model-value","disabled"])])])]),e("div",Df,[e("button",{onClick:C,disabled:x.value,type:"button",class:"w-full flex items-center gap-2 px-3 py-2.5 text-left hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors disabled:opacity-50"},[w($(Oa),{size:14,class:"shrink-0 text-neutral-400"}),q[9]||(q[9]=e("span",{class:"flex-1 text-xs font-medium text-neutral-700 dark:text-neutral-200"},"Usage & Cost",-1)),x.value?(r(),N(Ve,{key:0,size:"xs"})):(r(),N($(nt),{key:1,size:14,class:oe(["shrink-0 text-neutral-400 transition-transform duration-200",{"-rotate-180":b.value}])},null,8,["class"]))],8,Rf),w(et,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0 max-h-0","enter-to-class":"opacity-100 max-h-[250px]","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100 max-h-[250px]","leave-to-class":"opacity-0 max-h-0"},{default:j(()=>[b.value&&V.value?(r(),o("div",Of,[e("div",Uf,[e("div",Bf,[e("div",null,[q[10]||(q[10]=e("span",{class:"text-neutral-500 dark:text-neutral-400"},"Total:",-1)),e("span",Ff,S(I(V.value.totalCost)),1)]),e("div",null,[q[11]||(q[11]=e("span",{class:"text-neutral-500 dark:text-neutral-400"},"Per msg:",-1)),e("span",Nf,S(I(V.value.avgCostPerMessage)),1)])]),V.value.modelBreakdown.length>0?(r(),o("table",qf,[q[12]||(q[12]=e("thead",null,[e("tr",{class:"border-b border-neutral-200 dark:border-neutral-800"},[e("th",{class:"text-left py-1.5 font-medium text-neutral-500 dark:text-neutral-400 uppercase text-[10px]"},"Model"),e("th",{class:"text-right py-1.5 font-medium text-neutral-500 dark:text-neutral-400 uppercase text-[10px] w-14"},"Reqs"),e("th",{class:"text-right py-1.5 font-medium text-neutral-500 dark:text-neutral-400 uppercase text-[10px]"},"Cost")])],-1)),e("tbody",null,[(r(!0),o(he,null,we(V.value.modelBreakdown,U=>(r(),o("tr",{key:U.modelName},[e("td",{class:"py-1.5 truncate max-w-[120px] text-neutral-700 dark:text-neutral-300",title:U.modelName},S(U.modelName),9,Hf),e("td",Wf,S(U.requestCount),1),e("td",Kf,S(I(U.totalCost)),1)]))),128))])])):T("",!0)])])):T("",!0)]),_:1})]),e("div",Jf,[e("button",{onClick:q[1]||(q[1]=U=>u.value=!u.value),type:"button",class:"w-full flex items-center gap-2 px-3 py-2.5 text-left hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors"},[w($(Ua),{size:14,class:"shrink-0 text-neutral-400"}),q[13]||(q[13]=e("span",{class:"flex-1 text-xs font-medium text-neutral-700 dark:text-neutral-200"},"Developer Tools",-1)),w($(nt),{size:14,class:oe(["shrink-0 text-neutral-400 transition-transform duration-200",{"-rotate-180":u.value}])},null,8,["class"])]),w(et,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0 max-h-0","enter-to-class":"opacity-100 max-h-[150px]","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100 max-h-[150px]","leave-to-class":"opacity-0 max-h-0"},{default:j(()=>[u.value?(r(),o("div",Yf,[e("div",Gf,[e("div",Zf,[Q.value?Ae((r(),o("select",{key:0,"onUpdate:modelValue":q[2]||(q[2]=U=>k.value=U),class:"text-xs px-2 py-1.5 border border-neutral-200 dark:border-neutral-700 rounded bg-white dark:bg-neutral-800 text-neutral-700 dark:text-neutral-300"},[...q[14]||(q[14]=[e("option",{value:"a"},"Side A",-1),e("option",{value:"b"},"Side B",-1)])],512)),[[Ar,k.value]]):T("",!0),e("button",{onClick:re,disabled:p.value,class:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium bg-neutral-800 dark:bg-neutral-200 text-white dark:text-neutral-900 rounded hover:bg-neutral-700 dark:hover:bg-neutral-300 transition-colors disabled:opacity-50"},[w($(Ba),{size:12}),e("span",null,S(p.value?"Running...":"Continue"),1)],8,Xf),q[15]||(q[15]=e("span",{class:"text-[10px] text-neutral-500 dark:text-neutral-400"},"Resume without new message",-1))]),e("div",Qf,[e("button",{onClick:q[3]||(q[3]=U=>v.value=!0),disabled:f.value,class:"flex items-center gap-1.5 text-xs font-medium text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 transition-colors disabled:opacity-50"},[w($(Fa),{size:12}),e("span",null,S(f.value?"Deleting...":"Delete Thread"),1)],8,eh)])])])):T("",!0)]),_:1})])],64)):T("",!0)]),w(er,{modelValue:v.value,"onUpdate:modelValue":q[4]||(q[4]=U=>v.value=U),title:"Delete Thread?",message:"This will permanently delete all messages, logs, and associated data. This action cannot be undone.","confirm-text":"Delete","cancel-text":"Cancel",onConfirm:F},null,8,["modelValue"])])):T("",!0)]),_:1})}}}),rh=Xe(th,[["__scopeId","data-v-f3c52505"]]),ah={key:0,class:"overflow-hidden bg-neutral-100 dark:bg-neutral-950"},oh={class:"max-h-[400px] overflow-y-auto p-3 space-y-3"},nh={class:"bg-white dark:bg-neutral-900 rounded-lg border border-neutral-200 dark:border-neutral-800 overflow-hidden"},lh={class:"flex items-center justify-between px-3 py-2 border-b border-neutral-100 dark:border-neutral-800"},sh={class:"flex items-center gap-2"},ih={class:"text-[10px] text-neutral-400"},uh={class:"flex items-center gap-1"},dh={class:"p-2"},ch={key:0,class:"px-2 py-4 text-center text-neutral-400 text-xs"},ph=["onClick"],mh={class:"text-xs text-neutral-700 dark:text-neutral-300 truncate"},vh={class:"text-[10px] text-neutral-400 ml-auto"},fh=["href","onMouseenter"],hh={class:"shrink-0 text-neutral-400"},gh={class:"flex-1 min-w-0"},bh={class:"shrink-0 text-[10px] text-neutral-400 ml-auto"},xh={key:0,class:"text-blue-500"},yh={key:1,class:"text-red-500"},kh={key:2},wh=["href","onMouseenter"],_h={class:"shrink-0 text-neutral-400"},$h={class:"flex-1 min-w-0"},Ch={class:"shrink-0 text-[10px] text-neutral-400 ml-auto"},Sh={key:0,class:"text-blue-500"},Th={key:1,class:"text-red-500"},Ih={key:2},zh=["src","alt"],Mh=fe({__name:"FilesSlidePane",props:{threadId:{},show:{type:Boolean}},emits:["close"],setup(t,{emit:a}){const n=t;let s=null;try{s=qr()}catch{}const l=s?.files??m([]),d=s?.addFiles??(()=>{}),i=m(null),c=m(new Set(["/attachments"])),g=m(null),y=m({x:0,y:0});function v(R){if(R===0)return"0 B";const W=1024,Z=["B","KB","MB","GB"],V=Math.floor(Math.log(R)/Math.log(W));return parseFloat((R/Math.pow(W,V)).toFixed(1))+" "+Z[V]}function f(R){const W=R.startsWith("/")?R.slice(1):R;return ge(`/api/threads/${n.threadId}/fs/${W}`)}function h(R,W){return W?Rr:R.startsWith("audio/")?Ha:R.startsWith("video/")?Wa:R.startsWith("text/")?Ka:R.includes("javascript")||R.includes("json")||R.includes("xml")?Ja:Or}function _(R){const W=R.target;W.files?.length&&(d(W.files),W.value="")}function b(){i.value?.click()}function u(R){c.value.has(R)?c.value.delete(R):c.value.add(R),c.value=new Set(c.value)}function x(R){y.value={x:R.clientX,y:R.clientY}}function p(R){g.value=R}const k=O(()=>{const R=[],W=new Map,Z=[...l.value].sort((V,P)=>V.status==="uploading"&&P.status!=="uploading"?-1:P.status==="uploading"&&V.status!=="uploading"?1:(V.path||V.name).localeCompare(P.path||P.name));for(const V of Z){const P=V.path||`/${V.name}`,J=P.split("/").filter(Boolean);if(J.length===1)R.push({type:"file",name:V.name,path:P,file:V});else{const Q="/"+J.slice(0,-1).join("/"),le=J[J.length-2];if(!W.has(Q)){const me={type:"directory",name:le,path:Q,children:[]};W.set(Q,me),R.push(me)}W.get(Q).children.push({type:"file",name:V.name,path:P,file:V})}}return R}),M=O(()=>l.value.length);return Pe(()=>{document.addEventListener("mousemove",x)}),Ye(()=>{document.removeEventListener("mousemove",x)}),(R,W)=>(r(),N(et,{"enter-active-class":"transition-all duration-300 ease-out","enter-from-class":"max-h-0 opacity-0","enter-to-class":"max-h-[400px] opacity-100","leave-active-class":"transition-all duration-200 ease-in","leave-from-class":"max-h-[400px] opacity-100","leave-to-class":"max-h-0 opacity-0"},{default:j(()=>[t.show?(r(),o("div",ah,[e("div",oh,[e("div",nh,[e("div",lh,[e("div",sh,[w($(Ht),{size:14,class:"text-neutral-400"}),W[3]||(W[3]=e("span",{class:"text-xs font-medium text-neutral-700 dark:text-neutral-200"},"Files",-1)),e("span",ih,S(M.value),1)]),e("div",uh,[e("input",{ref_key:"fileInput",ref:i,type:"file",multiple:"",class:"hidden",onChange:_},null,544),e("button",{onClick:b,type:"button",class:"p-1 hover:bg-neutral-100 dark:hover:bg-neutral-700 rounded transition-colors text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-300",title:"Upload files"},[w($(Na),{size:14})])])]),e("div",dh,[k.value.length===0?(r(),o("div",ch," No files yet ")):T("",!0),(r(!0),o(he,null,we(k.value,Z=>(r(),o(he,{key:Z.path},[Z.type==="directory"?(r(),o(he,{key:0},[e("button",{onClick:V=>u(Z.path),type:"button",class:"w-full flex items-center gap-1.5 px-2 py-1.5 hover:bg-neutral-50 dark:hover:bg-neutral-700/50 rounded transition-colors text-left"},[w($(vt),{size:12,class:oe(["shrink-0 text-neutral-400 transition-transform",{"rotate-90":c.value.has(Z.path)}])},null,8,["class"]),(r(),N(Ue(c.value.has(Z.path)?$(qa):$(Ht)),{size:14,class:"shrink-0",style:{color:"var(--accent-500)"}})),e("span",mh,S(Z.name),1),e("span",vh,S(Z.children?.length),1)],8,ph),c.value.has(Z.path)?(r(!0),o(he,{key:0},we(Z.children,V=>(r(),o("a",{key:V.path,href:V.path?f(V.path):void 0,target:"_blank",rel:"noopener noreferrer",class:oe(["flex items-center gap-2 pl-7 pr-2 py-1 hover:bg-neutral-50 dark:hover:bg-neutral-700/50 rounded transition-colors cursor-pointer",{"pointer-events-none":V.file?.status==="uploading"}]),onMouseenter:P=>V.file?.isImage?p(V.path):null,onMouseleave:W[0]||(W[0]=P=>p(null))},[e("div",hh,[V.file?.status==="uploading"?(r(),N($(sr),{key:0,size:12,class:"animate-spin"})):(r(),N(Ue(h(V.file?.mimeType||"",V.file?.isImage||!1)),{key:1,size:12}))]),e("div",gh,[e("div",{class:oe(["text-[11px] text-neutral-600 dark:text-neutral-400 truncate",{"opacity-50":V.file?.status==="uploading"}])},S(V.name),3)]),e("div",bh,[V.file?.status==="uploading"?(r(),o("span",xh,"...")):V.file?.status==="error"?(r(),o("span",yh,"err")):(r(),o("span",kh,S(v(V.file?.size||0)),1))])],42,fh))),128)):T("",!0)],64)):(r(),o("a",{key:1,href:Z.path?f(Z.path):void 0,target:"_blank",rel:"noopener noreferrer",class:oe(["flex items-center gap-2 px-2 py-1.5 hover:bg-neutral-50 dark:hover:bg-neutral-700/50 rounded transition-colors cursor-pointer",{"pointer-events-none":Z.file?.status==="uploading"}]),onMouseenter:V=>Z.file?.isImage?p(Z.path):null,onMouseleave:W[1]||(W[1]=V=>p(null))},[e("div",_h,[Z.file?.status==="uploading"?(r(),N($(sr),{key:0,size:14,class:"animate-spin"})):(r(),N(Ue(h(Z.file?.mimeType||"",Z.file?.isImage||!1)),{key:1,size:14}))]),e("div",$h,[e("div",{class:oe(["text-xs text-neutral-600 dark:text-neutral-400 truncate",{"opacity-50":Z.file?.status==="uploading"}])},S(Z.name),3)]),e("div",Ch,[Z.file?.status==="uploading"?(r(),o("span",Sh,"...")):Z.file?.status==="error"?(r(),o("span",Th,"err")):(r(),o("span",Ih,S(v(Z.file?.size||0)),1))])],42,wh))],64))),128))])])]),(r(),N(wt,{to:"body"},[g.value?(r(),o("div",{key:0,class:"fixed z-50 bg-white dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 rounded-lg shadow-lg p-1 pointer-events-none",style:st({left:`${y.value.x+16}px`,top:`${y.value.y-80}px`})},[e("img",{src:f(g.value),alt:g.value,class:"max-w-[200px] max-h-[150px] rounded object-contain",onError:W[2]||(W[2]=Z=>Z.target.style.display="none")},null,40,zh)],4)):T("",!0)]))])):T("",!0)]),_:1}))}}),Vh=["accept"],Eh=["disabled"],Lh=fe({__name:"FileUpload",props:{isProcessing:{type:Boolean},accept:{}},emits:["filesSelected"],setup(t,{expose:a,emit:n}){const s=t,l=n,d=m(null),i=O(()=>s.accept||"image/*,.pdf,.txt,.md,.json,.csv");function c(){d.value?.click()}function g(v){const f=v.target;f.files&&f.files.length>0&&(l("filesSelected",f.files),f.value="")}function y(v){const f=v.clipboardData?.items;if(!f)return;const h=[];for(let _=0;_<f.length;_++){const b=f[_];if(b.kind==="file"){const u=b.getAsFile();u&&h.push(u)}}if(h.length>0){const _=new DataTransfer;h.forEach(b=>_.items.add(b)),l("filesSelected",_.files)}}return a({handlePaste:y}),(v,f)=>(r(),o(he,null,[e("input",{ref_key:"fileInputRef",ref:d,type:"file",accept:i.value,multiple:"",class:"hidden",onChange:g},null,40,Vh),e("button",{type:"button",onClick:c,class:oe(["p-1.5 hover:bg-neutral-100 dark:hover:bg-neutral-800 rounded-lg transition-colors text-neutral-500 hover:text-neutral-700 dark:hover:text-neutral-300",{"opacity-50 cursor-not-allowed":t.isProcessing}]),disabled:t.isProcessing,title:"Attach files"},[w($(Ya),{size:18})],10,Eh)],64))}}),Ph={class:"flex flex-col h-full"},Ah={class:"px-4 py-3 border-b border-neutral-300 dark:border-neutral-700"},jh={class:"flex items-center justify-between"},Dh={class:"flex items-center gap-2"},Rh={class:"flex items-center gap-2"},Oh={class:"flex-1 flex flex-col overflow-hidden relative"},Uh={key:0,class:"text-neutral-500 dark:text-neutral-400 text-center py-8"},Bh={key:1,class:"flex justify-center py-2"},Fh={key:2,class:"flex justify-center py-8"},Nh={key:3,class:"text-red-600 dark:text-red-400 text-center py-8"},qh={key:4,class:"text-neutral-500 dark:text-neutral-400 text-center py-8"},Hh={key:1,class:"p-3 bg-white dark:bg-neutral-900 border-t border-neutral-300 dark:border-neutral-700"},Wh={class:"flex items-center justify-end gap-2"},Kh=["disabled"],Jh={key:2,class:"p-3 bg-white dark:bg-neutral-900 border-t border-neutral-300 dark:border-neutral-700"},Yh={key:0,class:"mb-2 flex flex-wrap gap-2"},Gh={key:0,class:"w-16 h-16 rounded-lg overflow-hidden border border-neutral-200 dark:border-neutral-700 bg-neutral-100 dark:bg-neutral-800"},Zh=["src","alt"],Xh={key:1,class:"w-full h-full flex items-center justify-center"},Qh={key:1,class:"h-16 px-3 rounded-lg border border-neutral-200 dark:border-neutral-700 bg-neutral-100 dark:bg-neutral-800 flex items-center gap-2"},eg=["title"],tg=["onClick"],rg={class:"flex items-start gap-2"},ag={class:"flex-1 flex items-start gap-2 p-2 rounded-2xl border border-neutral-300 dark:border-neutral-700 bg-white dark:bg-neutral-900"},og=["disabled"],ng=["disabled"],lg={key:0,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",class:"w-4 h-4"},sg={key:1,class:"w-4 h-4"},br=fe({__name:"MessagesPane",props:{threadId:{},selectedMessageId:{},selectedLogId:{},hoveredLogId:{}},emits:["collapse","messageClick","messageHover","threadDeleted","editThread","logsDeleted","threadUpdated"],setup(t,{expose:a,emit:n}){const s=t,l=n,d=m(!1),i=()=>{d.value||(c.value=!1),d.value=!d.value},c=m(!1),g=()=>{c.value||(d.value=!1),c.value=!c.value},y=m(!1),v=m(new Set),f=m(new Map),h=()=>{y.value=!y.value,y.value||(v.value=new Set,f.value=new Map)},_=(ve,be)=>{const Me=new Set(v.value);be?Me.add(ve):Me.delete(ve),v.value=Me},b=(ve,be)=>{const Me=new Map(f.value);Me.set(ve,be),f.value=Me},u=()=>{y.value=!1,v.value=new Set,f.value=new Map},x=O(()=>v.value.size),p=O(()=>{let ve=0;for(const[be]of f.value)v.value.has(be)||ve++;return ve}),k=O(()=>{const ve=x.value,be=p.value;return ve>0&&be>0?`Delete (${ve}), Update (${be})`:ve>0?`Delete (${ve})`:be>0?`Save changes (${be})`:"Delete"}),M=O(()=>x.value>0||p.value>0),R=async()=>{if(!s.threadId||!M.value)return;const ve=[];for(const be of v.value){const Me=W.value.find(We=>We.id===be);Me&&"log_id"in Me&&Me.log_id&&ve.push(Me.log_id)}try{for(const[be,Me]of f.value)v.value.has(be)||await I(be,Me);for(const be of v.value)await C(be);ve.length>0&&l("logsDeleted",ve)}catch(be){console.error("Error applying changes:",be)}finally{u()}},{messages:W,threadInfo:Z,isFetching:V,isLoadingMore:P,error:J,wsConnected:Q,wsError:le,isExecuting:me,hasMore:ee,loadMoreMessages:L,deleteMessageById:C,updateMessageContent:I,stopThread:re,sendMessage:F,attachments:B,addAttachment:q,removeAttachment:Y}=_v(O(()=>s.threadId),{}),{thread:U}=tr(O(()=>s.threadId)),H=O(()=>B.value.length>0),E=O(()=>!1),ne=m(null),A=ve=>{q(ve)},pe=m(null),ue=m(null);a({scrollToLogId:ve=>ue.value&&pe.value?ue.value.scrollToLogId(ve,pe.value):!1,hasWorkblockForLogId:ve=>ue.value?ue.value.hasWorkblockForLogId(ve):!1}),typeof window<"u"&&(window.__testLoadMoreMessages=L);const ae=m(""),z=m(null),K=m("B"),ie=m(!1),D=m(!1),se=async()=>{await Le(),pe.value&&(pe.value.scrollTop=pe.value.scrollHeight)},G=async ve=>{ve.target.scrollTop<100&&ee.value&&!P.value&&!D.value&&(D.value=!0,await L(),D.value=!1)};xe(()=>W.value.length,async()=>{!P.value&&!D.value&&await se()}),xe(()=>s.threadId,async ve=>{ve&&await se()}),xe(V,async(ve,be)=>{be&&!ve&&await se()});const ye=O(()=>{const ve=Z.value?.agent||U.value?.agent;if(!ve)return"ai A";const be=ve.type;return K.value==="A"&&ve.side_a_label?ve.side_a_label:K.value==="B"&&ve.side_b_label?ve.side_b_label:be==="ai_human"?K.value==="A"?"ai":"human":K.value==="A"?"ai A":"ai B"}),Se=()=>{K.value=K.value==="A"?"B":"A"},de=async()=>{const ve=ae.value.trim().length>0,be=H.value;if(!ve&&!be||!s.threadId||ie.value||!F)return;const Me=ae.value,We=K.value==="A"?"assistant":"user";ae.value="",z.value&&(z.value.style.height="auto",z.value.style.height="24px"),ie.value=!0;try{await F({role:We,content:Me}),await se()}catch(Ct){console.error("Error sending message:",Ct)}finally{ie.value=!1,await Le(),z.value&&z.value.focus()}},ce=ve=>{ve.key==="Enter"&&!ve.shiftKey&&(ve.preventDefault(),de())},Ie=async()=>{if(s.threadId)try{await re()}catch(ve){console.error("Error stopping thread:",ve)}};return(ve,be)=>(r(),o("div",Ph,[e("div",Ah,[e("div",jh,[e("div",Dh,[w($(Ur),{size:18,class:"shrink-0"}),be[11]||(be[11]=e("h2",{class:"text-base font-bold"},"Messages",-1)),t.threadId?(r(),N(rr,{key:0,connected:$(Q),error:$(le)},null,8,["connected","error"])):T("",!0)]),e("div",Rh,[t.threadId?(r(),o("button",{key:0,onClick:g,type:"button",class:oe(["p-1 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",[c.value?"text-accent-600 dark:text-accent-400":""]]),title:"Toggle files"},[w($(Ht),{size:20})],2)):T("",!0),t.threadId?(r(),o("button",{key:1,onClick:i,type:"button",class:oe(["p-1 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",[d.value?"text-accent-600 dark:text-accent-400":""]]),title:"Toggle thread info"},[w($(zr),{size:20})],2)):T("",!0),t.threadId&&$(W).length>0?(r(),o("button",{key:2,onClick:h,type:"button",class:oe(["p-1 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",{"bg-neutral-200 dark:bg-neutral-800":y.value}]),title:"Edit messages"},[w($(Ga),{size:20})],2)):T("",!0),e("button",{onClick:be[0]||(be[0]=Me=>l("collapse")),type:"button",class:"p-1 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",title:"Collapse pane"},[w($(Dr),{size:20})])])])]),e("div",Oh,[w(rh,{"thread-id":t.threadId,show:d.value,onClose:be[1]||(be[1]=Me=>d.value=!1),onThreadDeleted:be[2]||(be[2]=Me=>l("threadDeleted",Me)),onEditThread:be[3]||(be[3]=Me=>l("editThread")),onThreadUpdated:be[4]||(be[4]=Me=>l("threadUpdated"))},null,8,["thread-id","show"]),t.threadId?(r(),N(Mh,{key:0,"thread-id":t.threadId,show:c.value,onClose:be[5]||(be[5]=Me=>c.value=!1)},null,8,["thread-id","show"])):T("",!0),e("div",{ref_key:"messagesContainer",ref:pe,class:"flex-1 overflow-y-auto overflow-x-hidden p-4 space-y-4",onScroll:G},[t.threadId?T("",!0):(r(),o("div",Uh," Select a thread to view messages ")),$(P)?(r(),o("div",Bh,[w(Ve,{size:"sm"}),be[12]||(be[12]=e("span",{class:"ml-2 text-xs text-neutral-500"},"Loading older messages...",-1))])):$(V)?(r(),o("div",Fh,[w(Ve)])):$(J)?(r(),o("div",Nh," Error loading messages: "+S($(J)),1)):t.threadId&&$(W).length===0?(r(),o("div",qh," No messages yet ")):(r(),N(xf,{key:5,ref_key:"agentMessagesRef",ref:ue,messages:$(W),threadId:t.threadId,selectedMessageId:t.selectedMessageId,selectedLogId:t.selectedLogId,hoveredLogId:t.hoveredLogId,isEditMode:y.value,selectedForDelete:v.value,editedMessages:f.value,onMessageClick:be[6]||(be[6]=(Me,We)=>l("messageClick",Me,We)),onMessageHover:be[7]||(be[7]=Me=>l("messageHover",Me)),onSelectionChange:_,onMessageEdit:b},null,8,["messages","threadId","selectedMessageId","selectedLogId","hoveredLogId","isEditMode","selectedForDelete","editedMessages"]))],544),t.threadId&&y.value?(r(),o("div",Hh,[e("div",Wh,[e("button",{onClick:u,class:"px-4 py-2 rounded-lg font-medium text-sm transition-colors bg-neutral-200 text-black hover:bg-neutral-300 dark:bg-neutral-700 dark:text-white dark:hover:bg-neutral-600"}," Cancel "),e("button",{onClick:R,disabled:!M.value,class:oe(["px-4 py-2 rounded-lg font-medium text-sm transition-colors",{"bg-red-600 text-white hover:bg-red-700":M.value&&x.value>0,"bg-black text-white hover:bg-neutral-800 dark:bg-white dark:text-black dark:hover:bg-neutral-200":M.value&&x.value===0,"bg-neutral-200 text-neutral-400 dark:bg-neutral-700 dark:text-neutral-500 cursor-not-allowed":!M.value}])},S(k.value),11,Kh)])])):t.threadId?(r(),o("div",Jh,[$(B).length>0?(r(),o("div",Yh,[(r(!0),o(he,null,we($(B),Me=>(r(),o("div",{key:Me.id,class:"relative group"},[Me.isImage?(r(),o("div",Gh,[Me.previewUrl?(r(),o("img",{key:0,src:Me.previewUrl,alt:Me.name,class:"w-full h-full object-cover"},null,8,Zh)):(r(),o("div",Xh,[...be[13]||(be[13]=[e("div",{class:"w-4 h-4 border-2 border-neutral-300 border-t-neutral-600 rounded-full animate-spin"},null,-1)])]))])):(r(),o("div",Qh,[e("span",{class:"text-xs text-neutral-600 dark:text-neutral-300 max-w-[80px] truncate",title:Me.name},S(Me.name),9,eg)])),e("button",{onClick:Oe(We=>$(Y)(Me.id),["stop"]),class:"absolute -top-1 -right-1 w-4 h-4 rounded-full bg-neutral-600 dark:bg-neutral-500 text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity hover:bg-red-500"},[...be[14]||(be[14]=[e("span",{class:"text-[10px] font-bold leading-none"},"x",-1)])],8,tg)]))),128))])):T("",!0),e("div",rg,[e("button",{onClick:Se,class:oe(["flex-shrink-0 px-2 h-7 rounded-md flex items-center justify-center font-medium text-xs transition-colors mt-2.5",{"bg-black text-white dark:bg-white dark:text-black":K.value==="A","bg-neutral-300 text-black dark:bg-neutral-600 dark:text-white":K.value==="B"}]),title:"Toggle between sides"},S(ye.value),3),e("div",ag,[w(Lh,{ref_key:"fileUploadRef",ref:ne,"is-processing":!1,onFilesSelected:A},null,512),Ae(e("textarea",{ref_key:"messageTextarea",ref:z,"onUpdate:modelValue":be[8]||(be[8]=Me=>ae.value=Me),onKeydown:ce,onPaste:be[9]||(be[9]=Me=>ne.value?.handlePaste(Me)),disabled:ie.value,placeholder:"Type a message...",rows:"1",class:"flex-1 bg-transparent text-black dark:text-white resize-none focus:outline-none disabled:opacity-50 mt-0.5",style:{"max-height":"120px","min-height":"24px"},onInput:be[10]||(be[10]=Me=>{const We=Me.target;We.style.height="auto",We.style.height=Math.min(We.scrollHeight,120)+"px"})},null,40,og),[[Qe,ae.value]]),$(me)?(r(),o("button",{key:1,id:"stop-thread-button",onClick:Ie,class:"flex-shrink-0 w-7 h-7 rounded-full flex items-center justify-center transition-all bg-red-600 text-white dark:bg-red-500 hover:bg-red-700 dark:hover:bg-red-600",title:"Stop execution"},[...be[16]||(be[16]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",class:"w-4 h-4"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5.25 7.5A2.25 2.25 0 017.5 5.25h9a2.25 2.25 0 012.25 2.25v9a2.25 2.25 0 01-2.25 2.25h-9a2.25 2.25 0 01-2.25-2.25v-9z"})],-1)])])):(r(),o("button",{key:0,id:"send-message-button",onClick:de,disabled:!ae.value.trim()&&!H.value||ie.value||E.value,class:oe(["flex-shrink-0 w-7 h-7 rounded-full flex items-center justify-center transition-all",{"bg-black text-white dark:bg-white dark:text-black":(ae.value.trim()||H.value)&&!ie.value&&!E.value,"bg-neutral-200 text-neutral-400 dark:bg-neutral-700 dark:text-neutral-600":!ae.value.trim()&&!H.value||ie.value||E.value}]),title:"Send message (Enter)"},[ie.value?(r(),o("div",sg,[w(Ve)])):(r(),o("svg",lg,[...be[15]||(be[15]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18"},null,-1)])]))],10,ng))])])])):T("",!0)])]))}});function ig(t,a){const{limit:n=100,offset:s=0,order:l="desc",autoFetch:d=!0,enableWebSocket:i=!1}=a||{};O(()=>!!(typeof t=="string"?t:t?.value));const c=O(()=>{const Y=typeof t=="string"?t:t?.value;if(!Y)return ge("/api/threads/placeholder/logs");const U=new URLSearchParams,H=typeof n=="number"?n:n.value,E=typeof s=="number"?s:s.value,ne=typeof l=="string"?l:l.value;return U.append("limit",H.toString()),U.append("offset",E.toString()),U.append("order",ne),ge(`/api/threads/${Y}/logs?${U.toString()}`)}),{data:g,error:y,isFetching:v,isFinished:f,execute:h,abort:_}=Ne(c,{immediate:!1}).get().json();xe([c,()=>d],([Y,U])=>{Y&&!Y.includes("placeholder")&&U&&h()},{immediate:!0});const b=O(()=>!y.value||y.value.toString().includes("aborted")||y.value.toString().includes("abort")?null:y.value),u=O(()=>g.value?.logs||[]),x=O(()=>g.value?.total||0),p=O(()=>g.value?.hasMore||!1),k=m(null),M=m(!1),R=m(null),W=m([]),Z=new Map;let V=0,P=null,J=null,Q=!0,le=null;const me=3e4,ee=3e4,L=()=>{P&&(clearTimeout(P),P=null),J&&(clearInterval(J),J=null)},C=()=>{J&&clearInterval(J),J=setInterval(()=>{k.value&&k.value.readyState===WebSocket.OPEN&&k.value.send("ping")},ee)},I=()=>{if(!Q||!i)return;const Y=Math.min(1e3*Math.pow(2,V),me);V++,console.log(`[Logs WebSocket] Scheduling reconnect in ${Y}ms (attempt ${V})`),P=setTimeout(()=>{Q&&re()},Y)},re=()=>{const Y=typeof t=="string"?t:t?.value;if(!Y||!i)return;k.value&&(le=null,k.value.close()),V===0&&(W.value=[]);const U=window.location.protocol==="https:"?"wss:":"ws:",H=window.location.host;let E=`${U}//${H}${ge(`/api/threads/${Y}/logs`)}`;const ne=localStorage.getItem("auth_token");ne&&(E+=`?token=${encodeURIComponent(ne)}`);try{const A=new WebSocket(E);k.value=A,le=A,A.onopen=()=>{le===A&&(M.value=!0,R.value=null,V=0,C(),console.log("[Logs WebSocket] Connected"))},A.onmessage=pe=>{if(le===A&&pe.data!=="pong")try{const ue=JSON.parse(pe.data);if(ue.type==="log_data"){const ke=W.value.findIndex(ae=>ae.id===ue.log_id),Ee=u.value.find(ae=>ae.id===ue.log_id);if(ke>=0){W.value[ke]={...W.value[ke],...ue.data};const ae=Z.get(ue.log_id);ae&&(W.value[ke].queued_tools=ae,Z.delete(ue.log_id))}else if(Ee){const ae={...Ee,...ue.data},z=Z.get(ue.log_id);z&&(ae.queued_tools=z,Z.delete(ue.log_id)),W.value.push(ae)}else{const ae={id:ue.log_id,...ue.data},z=Z.get(ue.log_id);z&&(ae.queued_tools=z,Z.delete(ue.log_id)),W.value.push(ae)}}else if(ue.type==="log_queued_tools"){const ke=W.value.findIndex(ae=>ae.id===ue.log_id),Ee=u.value.find(ae=>ae.id===ue.log_id);ke>=0?W.value[ke]={...W.value[ke],queued_tools:ue.queued_tools}:Ee?W.value.push({...Ee,queued_tools:ue.queued_tools}):Z.set(ue.log_id,ue.queued_tools)}}catch(ue){console.error("[Logs WebSocket] Failed to parse message:",ue)}},A.onerror=pe=>{le===A&&(R.value="WebSocket connection error",console.error("[Logs WebSocket] Error:",pe))},A.onclose=()=>{le===A&&(M.value=!1,L(),console.log("[Logs WebSocket] Disconnected"),I())}}catch(A){R.value=A.message||"Failed to create WebSocket",console.error("[Logs WebSocket] Creation error:",A),I()}},F=()=>{Q=!1,L(),le=null,k.value&&(k.value.close(),k.value=null),M.value=!1,V=0,W.value=[],Z.clear()},B=()=>{Q=!0,V=0,re()};return Ye(()=>{F()}),{logs:O(()=>{if(!i)return u.value;const Y=new Map;u.value.forEach(E=>Y.set(E.id,E)),W.value.forEach(E=>Y.set(E.id,E));const U=typeof l=="string"?l:l.value;return Array.from(Y.values()).sort((E,ne)=>U==="desc"?ne.created_at-E.created_at:E.created_at-ne.created_at)}),total:x,hasMore:p,error:b,isFetching:v,isFinished:f,refetch:h,abort:_,wsConnected:M,wsError:R,connectWebSocket:B,disconnectWebSocket:F}}function ug(t,a){const n=O(()=>{const c=t.value,g=a.value;return!c||!g?null:ge(`/api/threads/${c}/logs/${g}`)}),{data:s,error:l,isFetching:d,execute:i}=Ne(n,{immediate:!1}).get().json();return xe([t,a],([c,g])=>{c&&g&&i()},{immediate:!0}),{logDetails:s,error:l,isFetching:d,refetch:i}}const dg=["disabled","title"],cg={key:1,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},pg={key:2,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},mg={key:3},da=fe({__name:"CopyButton",props:{content:{},variant:{},size:{},disabled:{type:Boolean}},setup(t){const a=t,n=m(!1),s=m(!1),l=async()=>{n.value=!0;try{await navigator.clipboard.writeText(a.content),s.value=!0,setTimeout(()=>{s.value=!1},2e3)}catch(c){console.error("Failed to copy:",c),alert(`Failed to copy: ${c instanceof Error?c.message:"Unknown error"}`)}finally{n.value=!1}},d={xs:"p-1 text-xs",sm:"px-2 py-1 text-xs"},i={solid:"bg-black text-white dark:bg-white dark:text-black",ghost:"bg-white dark:bg-neutral-950 border border-neutral-300 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-900"};return(c,g)=>(r(),o("button",{onClick:l,disabled:n.value||t.disabled,class:oe([d[t.size||"sm"],i[t.variant||"solid"],"font-medium rounded hover:opacity-80 disabled:opacity-50 disabled:cursor-not-allowed transition-all"]),title:t.disabled?"No content to copy":s.value?"Copied!":"Copy to clipboard"},[n.value?(r(),N(Ve,{key:0,size:"xs"})):t.variant==="ghost"&&!s.value?(r(),o("svg",cg,[...g[0]||(g[0]=[e("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"},null,-1),e("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"},null,-1)])])):t.variant==="ghost"&&s.value?(r(),o("svg",pg,[...g[1]||(g[1]=[e("polyline",{points:"20 6 9 17 4 12"},null,-1)])])):(r(),o("span",mg,S(s.value?"Copied!":"Copy"),1))],10,dg))}}),Ft="__shiki_highlighter__";let Tt=null;async function vg(){return typeof window<"u"&&window[Ft]?window[Ft]:Tt||(Tt=co({themes:["min-light","github-dark-high-contrast"],langs:["json","markdown"]}).then(t=>(typeof window<"u"&&(window[Ft]=t),t)),Tt)}const fg={class:"code-block"},hg={key:0,class:"text-xs text-neutral-500 p-2"},gg=["innerHTML"],Nt=fe({__name:"CodeBlock",props:{code:{},language:{}},setup(t){const a=t,n=m(""),s=m(!0),l=async()=>{const d=a.code??"";if(!d){n.value='<pre class="shiki"><code></code></pre>',s.value=!1;return}try{const i=await vg();if(a.language==="json"||a.language==="markdown")n.value=i.codeToHtml(d,{lang:a.language,themes:{light:"min-light",dark:"github-dark-high-contrast"}});else{const c=d.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");n.value=`<pre class="shiki shiki-text"><code>${c}</code></pre>`}}catch{const c=d.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");n.value=`<pre class="shiki"><code>${c}</code></pre>`}finally{s.value=!1}};return Pe(()=>{l()}),xe(()=>a.code,()=>{l()}),(d,i)=>(r(),o("div",fg,[s.value?(r(),o("div",hg,"Loading...")):(r(),o("div",{key:1,innerHTML:n.value,class:"code-content"},null,8,gg))]))}}),bg={class:"json-viewer relative bg-white dark:bg-neutral-900"},xg={key:0,class:"absolute top-[5px] right-[5px] z-10"},yg=["innerHTML"],kg=["src","alt"],wg=fe({__name:"JsonViewer",props:{json:{},threadId:{},showCopyButton:{type:Boolean}},setup(t){const a=t,n=m(null),s=m(null),l=h=>[".jpg",".jpeg",".png",".gif",".webp",".svg",".bmp"].some(b=>h.toLowerCase().endsWith(b)),d=h=>a.threadId?ge(`/api/threads/${a.threadId}/fs${h}`):null,i=O(()=>{if(!a.json)return"";if(typeof a.json=="string")try{return JSON.stringify(JSON.parse(a.json),null,2)}catch{return a.json}return JSON.stringify(a.json,null,2)}),c=h=>h.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),g=(h,_=0)=>{const b=" ".repeat(_),u=x=>`<span class="json-punct">${x}</span>`;if(h===null)return'<span class="json-null">null</span>';if(typeof h=="boolean")return`<span class="json-boolean">${h}</span>`;if(typeof h=="number")return`<span class="json-number">${h}</span>`;if(typeof h=="string"){const x=c(h);return a.threadId&&l(h)&&h.startsWith("/attachments/")?`${u('"')}<span class="json-image-path" data-path="${c(h)}">${x}</span>${u('"')}`:`${u('"')}<span class="json-string">${x}</span>${u('"')}`}if(Array.isArray(h)){if(h.length===0)return`${u("[")}${u("]")}`;const x=h.map((p,k)=>{const M=k<h.length-1?u(","):"";return`${b} ${g(p,_+1)}${M}`});return`${u("[")}
|
|
38
|
+
${x.join(`
|
|
39
39
|
`)}
|
|
40
|
-
${
|
|
41
|
-
${
|
|
40
|
+
${b}${u("]")}`}if(typeof h=="object"){const x=Object.entries(h);if(x.length===0)return`${u("{")}${u("}")}`;const p=x.map(([k,M],R)=>{const W=R<x.length-1?u(","):"",Z=`${u('"')}<span class="json-key">${c(k)}</span>${u('"')}`;return`${b} ${Z}${u(":")} ${g(M,_+1)}${W}`});return`${u("{")}
|
|
41
|
+
${p.join(`
|
|
42
42
|
`)}
|
|
43
|
-
${v}${d("}")}`}return String(y)},x=U(()=>{if(!o.json)return'<span class="json-null">null</span>';let y;if(typeof o.json=="string")try{y=JSON.parse(o.json)}catch{return m(o.json)}else y=o.json;return h(y)}),c=y=>{const b=y.target;if(b.classList.contains("json-image-path")){const v=b.dataset.path;if(v&&o.threadId){a.value=v;const d=b.getBoundingClientRect();i.value={x:d.left,y:d.top}}}},f=y=>{y.target.classList.contains("json-image-path")&&(a.value=null,i.value=null)};return(y,b)=>(r(),n("div",dg,[t.showCopyButton?(r(),n("div",cg,[w(na,{content:s.value,variant:"ghost",size:"xs"},null,8,["content"])])):T("",!0),e("pre",{class:"text-xs font-mono p-3 overflow-x-auto",onMouseover:c,onMouseout:f,innerHTML:x.value},null,40,pg),(r(),q(kt,{to:"body"},[a.value&&i.value&&t.threadId?(r(),n("div",{key:0,class:"fixed z-50 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-600 rounded-lg shadow-lg p-1 pointer-events-none",style:st({left:`${i.value.x}px`,top:`${i.value.y-160}px`})},[e("img",{src:u(a.value),alt:a.value,class:"max-w-[200px] max-h-[150px] rounded object-contain",onError:b[0]||(b[0]=v=>v.target.style.display="none")},null,40,mg)],4)):T("",!0)]))]))}}),zt=Xe(vg,[["__scopeId","data-v-fc06e7bc"]]),fg={class:"text-xs font-semibold"},hg={key:0,class:"font-normal text-neutral-500 dark:text-neutral-400"},gg={class:"flex items-center gap-2"},bg={class:"text-neutral-500 text-xs"},Tt=ve({__name:"CollapsibleSection",props:{title:{},subtitle:{},sectionId:{},expanded:{type:Boolean},scrollContainer:{}},emits:["toggle"],setup(t,{expose:o,emit:a}){const i=t,l=a,u=p(null),s=p(!1),m=()=>{Le(()=>{if(!u.value||!i.scrollContainer){s.value=!1;return}const c=i.scrollContainer.clientHeight;s.value=u.value.scrollHeight>c*2})};ge(()=>i.expanded,c=>{c?m():s.value=!1});const h=()=>{if(u.value&&i.scrollContainer){const y=u.value.offsetTop-88;i.scrollContainer.scrollTo({top:Math.max(0,y),behavior:"smooth"})}},x=()=>{if(u.value&&i.scrollContainer){const c=u.value.offsetTop+u.value.offsetHeight,f=i.scrollContainer.clientHeight,y=c-f+10;i.scrollContainer.scrollTo({top:Math.max(0,y),behavior:"smooth"})}};return o({checkHeight:m,contentRef:u}),(c,f)=>(r(),n("div",null,[e("div",{class:"sticky top-[27px] z-5 w-full px-3 py-2 bg-neutral-50 dark:bg-neutral-950 flex items-center justify-between border border-neutral-300 dark:border-neutral-700 rounded cursor-pointer hover:bg-neutral-100 dark:hover:bg-neutral-950 transition-colors",onClick:f[0]||(f[0]=y=>l("toggle"))},[e("span",fg,[X(C(t.title)+" ",1),t.subtitle?(r(),n("span",hg,"("+C(t.subtitle)+")",1)):T("",!0)]),e("div",gg,[s.value&&t.expanded?(r(),n(fe,{key:0},[e("button",{onClick:Re(h,["stop"]),class:"text-[10px] text-neutral-500 hover:text-neutral-700 dark:hover:text-neutral-300"},"↑ Top"),e("button",{onClick:Re(x,["stop"]),class:"text-[10px] text-neutral-500 hover:text-neutral-700 dark:hover:text-neutral-300"},"↓ Bottom")],64)):T("",!0),e("span",bg,C(t.expanded?"▼":"▶"),1)])]),Ae(e("div",{ref_key:"contentRef",ref:u,class:"border-x border-b border-neutral-300 dark:border-neutral-700 rounded-b"},[je(c.$slots,"default")],512),[[Ke,t.expanded]])]))}}),xg={class:"flex items-center justify-between mb-3"},yg={class:"flex items-center gap-2"},kg={class:"flex items-center gap-1"},wg=["disabled"],_g=["disabled"],$g={class:"text-lg font-bold"},Cg={class:"flex items-center gap-2"},Sg=["disabled","title"],Tg={key:1},Ig={class:"@container border-b border-neutral-300 dark:border-neutral-700 pb-3"},zg={class:"hidden @[600px]:block"},Vg={class:"w-full text-xs"},Mg={class:"py-1 font-mono"},Eg={class:"py-1 font-mono"},Lg={key:1},Pg={class:"py-1 font-mono"},Ag={key:1},jg={class:"py-1 font-mono"},Dg={key:1},Og={class:"py-1 font-mono"},Rg={key:1},Ug={class:"py-1 font-mono text-xs"},Bg={class:"@[600px]:hidden space-y-2"},Fg={class:"w-full text-xs"},Ng={class:"py-1 font-mono"},qg={class:"py-1 font-mono"},Hg={key:1},Wg={class:"w-full text-xs"},Kg={class:"py-1 font-mono"},Jg={key:1},Yg={class:"py-1 font-mono"},Gg={key:1},Zg={class:"py-1 font-mono"},Xg={key:1},Qg={class:"py-1 font-mono text-xs"},eb={class:"sticky -top-4 z-10 bg-white dark:bg-neutral-900 border-b border-neutral-300 dark:border-neutral-700 mb-3 pt-3 -mx-4 px-4"},tb={class:"flex gap-4"},rb={key:0,class:"text-red-600 dark:text-red-400"},ab={class:"space-y-3"},ob={class:"space-y-2"},nb={class:"flex items-center gap-1 pb-2 mb-2 border-b border-neutral-200 dark:border-neutral-700"},lb=["onClick"],sb={key:1,class:"text-xs text-red-600 dark:text-red-400 ml-2"},ib=["onClick"],ub={class:"font-mono"},db={class:"text-neutral-500"},cb={class:"px-2 py-2 bg-white dark:bg-neutral-950 border-t border-neutral-200 dark:border-neutral-800"},pb={key:0,class:"text-xs text-neutral-600 dark:text-neutral-400 mb-2"},mb={class:"relative bg-white dark:bg-neutral-900"},vb={class:"absolute top-[5px] right-[5px]"},fb={key:0,class:"mb-4"},hb={class:"text-xs font-semibold text-red-600 dark:text-red-400 mb-1"},gb={class:"space-y-2"},bb={class:"px-2 py-1 bg-red-100 dark:bg-red-900/30 text-xs font-medium text-red-800 dark:text-red-200"},xb={class:"text-xs bg-red-50 dark:bg-red-950 p-2 overflow-x-auto text-red-900 dark:text-red-100"},yb={key:1,class:"mb-4"},kb={class:"text-xs font-semibold text-red-600 dark:text-red-400 mb-1"},wb={class:"text-xs bg-red-50 dark:bg-red-950 p-2 rounded overflow-x-auto text-red-900 dark:text-red-100 border border-red-300 dark:border-red-700"},_b={key:2,class:"mb-4"},$b={class:"w-full text-xs border border-neutral-300 dark:border-neutral-700 rounded"},Cb={class:"border-b border-neutral-200 dark:border-neutral-800"},Sb={class:"py-1 px-2 font-mono"},Tb={key:1},Ib={class:"border-b border-neutral-200 dark:border-neutral-800"},zb={class:"py-1 px-2 font-mono"},Vb={key:1},Mb={key:0,class:"border-b border-neutral-200 dark:border-neutral-800"},Eb={class:"py-1 px-2 font-mono"},Lb={key:1},Pb={class:"border-b border-neutral-200 dark:border-neutral-800"},Ab={class:"py-1 px-2 font-mono"},jb={key:1},Db={key:1,class:"border-b border-neutral-200 dark:border-neutral-800"},Ob={class:"py-1 px-2 font-mono text-accent-600 dark:text-accent-400"},Rb={class:"border-b border-neutral-200 dark:border-neutral-800"},Ub={class:"py-1 px-2 font-mono font-semibold"},Bb={key:1},Fb={class:"py-1 px-2 font-mono font-semibold"},Nb={key:1},qb={key:3,class:"mb-4"},Hb={class:"text-xs font-semibold mb-1"},Wb={class:"border border-neutral-300 dark:border-neutral-700 rounded overflow-hidden"},Kb=["onClick"],Jb={class:"flex items-center gap-2"},Yb={class:"font-mono"},Gb={key:0,class:"px-1.5 py-0.5 text-[10px] bg-emerald-100 dark:bg-emerald-900/40 text-emerald-700 dark:text-emerald-300 rounded font-medium border border-emerald-200 dark:border-emerald-800",title:"Programmatically called with state.queueTool()"},Zb={key:1,class:"px-1.5 py-0.5 text-[10px] bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 rounded font-medium"},Xb={class:"text-neutral-500"},Qb={key:0,class:"text-xs mb-2"},e1={class:"font-mono text-xs bg-white dark:bg-black p-1 rounded border border-emerald-200 dark:border-emerald-800"},t1={class:"text-xs mb-2"},r1={class:"font-mono text-xs bg-white dark:bg-black p-1 rounded border border-neutral-200 dark:border-neutral-800"},a1={class:"text-xs mb-2"},o1={class:"font-mono text-xs bg-white dark:bg-black p-1 rounded border border-neutral-200 dark:border-neutral-800"},n1={class:"text-xs mb-2"},l1={class:"rounded overflow-hidden border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-black"},s1={key:1,class:"text-xs"},i1={class:"text-xs overflow-x-auto bg-green-50 dark:bg-green-950/20 p-2 rounded border border-green-300 dark:border-green-700 whitespace-pre-wrap"},u1={key:2,class:"text-xs"},d1={class:"text-xs mb-2"},c1={class:"font-mono text-xs bg-white dark:bg-black p-1 rounded border border-purple-200 dark:border-purple-800"},p1={key:0,class:"text-sm mt-2"},m1={key:0,class:"text-neutral-600 dark:text-neutral-400"},v1={key:1,class:"text-neutral-600 dark:text-neutral-400"},f1=["href"],h1={key:2,class:"ml-4 mt-1 space-y-0.5"},g1=["href"],b1={key:0,class:"text-xs text-neutral-500"},x1={key:1,class:"text-sm text-neutral-600 dark:text-neutral-400 mt-2"},y1={key:0},k1={class:"font-mono text-xs"},w1={key:1},_1={key:2,class:"text-sm mt-2"},$1={class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800 overflow-x-auto"},C1={key:3,class:"text-sm mt-2"},S1={class:"font-medium text-neutral-600 dark:text-neutral-400 mb-1"},T1={key:4,class:"mb-4"},I1={class:"text-xs font-semibold mb-1"},z1={class:"border border-emerald-300 dark:border-emerald-700 rounded overflow-hidden bg-emerald-50 dark:bg-emerald-950/20"},V1={class:"p-2 flex flex-wrap gap-2"},M1=["src","alt"],E1={key:1,class:"w-[100px] h-[100px] flex items-center justify-center bg-emerald-100 dark:bg-emerald-900 rounded text-xs text-emerald-600 dark:text-emerald-400"},L1={key:5,class:"mb-4"},P1={class:"border border-accent-300 dark:border-accent-700 rounded overflow-hidden bg-accent-50 dark:bg-accent-950/20"},A1={class:"text-accent-600 dark:text-accent-400"},j1={key:6,class:"mb-4"},D1={class:"border border-purple-300 dark:border-purple-700 rounded overflow-hidden bg-purple-50 dark:bg-purple-950/20"},O1={class:"flex items-center gap-2"},R1={class:"px-1.5 py-0.5 text-[10px] bg-purple-200 dark:bg-purple-800 text-purple-700 dark:text-purple-300 rounded"},U1={class:"text-purple-600 dark:text-purple-400"},B1={class:"divide-y divide-purple-200 dark:divide-purple-800 border-t border-purple-300 dark:border-purple-700"},F1={class:"flex items-center gap-2 mb-1"},N1={class:"text-xs font-semibold text-purple-700 dark:text-purple-300"},q1={key:0,class:"text-xs font-mono text-purple-600 dark:text-purple-400"},H1={key:1,class:"text-xs text-purple-500 dark:text-purple-500"},W1={key:2,class:"text-xs text-purple-500 dark:text-purple-500"},K1={key:0,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},J1={class:"text-purple-900 dark:text-purple-100 whitespace-pre-wrap"},Y1={key:1,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},G1={class:"font-mono text-purple-700 dark:text-purple-300 break-all"},Z1={key:2,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},X1={class:"text-purple-900 dark:text-purple-100 whitespace-pre-wrap"},Q1={key:0,class:"mt-2 pt-2 border-t border-purple-200 dark:border-purple-800"},ex={class:"font-mono text-purple-700 dark:text-purple-300 text-xs break-all"},tx={key:3,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},rx={class:"text-purple-900 dark:text-purple-100 overflow-x-auto"},ax={key:7,class:"mb-4"},ox={class:"rounded overflow-hidden border border-neutral-300 dark:border-neutral-700"},nx=ve({__name:"LogDetails",props:{log:{},threadId:{},hasPrevious:{type:Boolean},hasNext:{type:Boolean}},emits:["close","previous","next"],setup(t,{emit:o}){const a=t,i=o,l=p("request"),u=p(new Set),s=p(new Set),m=p(!1),h=p(!1),x=p(!0),c=p(!0),f=p(null),y=p(null),b=p(null),v=p(null),d=p(null),k=p(new Set(["system_prompt","request_body","tools"])),g=ae=>a.threadId?ae.startsWith("data:")||ae.startsWith("http")?ae:he(`/api/threads/${a.threadId}/fs${ae}`):null,_=ae=>{if(!ae)return"N/A";try{return JSON.stringify(JSON.parse(ae),null,2)}catch{return ae}},L=U(()=>{if(!a.log.tools_schema)return[];try{const ae=JSON.parse(a.log.tools_schema);return Array.isArray(ae)?ae:[]}catch{return[]}}),O=U(()=>{if(!a.log.response_body)return[];try{const I=JSON.parse(a.log.response_body)?.choices?.[0]?.message?.tool_calls;return Array.isArray(I)?I:[]}catch{return[]}}),W=U(()=>{if(!a.log.tool_results)return new Map;try{const ae=JSON.parse(a.log.tool_results),I=new Map;return Array.isArray(ae)&&ae.forEach(D=>{D.tool_call_id&&I.set(D.tool_call_id,{content:D.content,status:D.status,tool_name:D.tool_name,timestamp:D.timestamp})}),I}catch{return new Map}}),J=U(()=>{if(!a.log.response_body)return[];try{const I=JSON.parse(a.log.response_body)?.choices?.[0]?.message?.reasoning_details;return Array.isArray(I)?I:[]}catch{return[]}}),z=U(()=>a.log.reasoning_content?a.log.reasoning_content.replace(/\\n/g,`
|
|
43
|
+
${b}${u("}")}`}return String(h)},y=O(()=>{if(!a.json)return'<span class="json-null">null</span>';let h;if(typeof a.json=="string")try{h=JSON.parse(a.json)}catch{return c(a.json)}else h=a.json;return g(h)}),v=h=>{const _=h.target;if(_.classList.contains("json-image-path")){const b=_.dataset.path;if(b&&a.threadId){n.value=b;const u=_.getBoundingClientRect();s.value={x:u.left,y:u.top}}}},f=h=>{h.target.classList.contains("json-image-path")&&(n.value=null,s.value=null)};return(h,_)=>(r(),o("div",bg,[t.showCopyButton?(r(),o("div",xg,[w(da,{content:i.value,variant:"ghost",size:"xs"},null,8,["content"])])):T("",!0),e("pre",{class:"text-xs font-mono p-3 overflow-x-auto",onMouseover:v,onMouseout:f,innerHTML:y.value},null,40,yg),(r(),N(wt,{to:"body"},[n.value&&s.value&&t.threadId?(r(),o("div",{key:0,class:"fixed z-50 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-600 rounded-lg shadow-lg p-1 pointer-events-none",style:st({left:`${s.value.x}px`,top:`${s.value.y-160}px`})},[e("img",{src:d(n.value),alt:n.value,class:"max-w-[200px] max-h-[150px] rounded object-contain",onError:_[0]||(_[0]=b=>b.target.style.display="none")},null,40,kg)],4)):T("",!0)]))]))}}),Mt=Xe(wg,[["__scopeId","data-v-fc06e7bc"]]),_g={class:"text-xs font-semibold"},$g={key:0,class:"font-normal text-neutral-500 dark:text-neutral-400"},Cg={class:"flex items-center gap-2"},Sg={class:"text-neutral-500 text-xs"},It=fe({__name:"CollapsibleSection",props:{title:{},subtitle:{},sectionId:{},expanded:{type:Boolean},scrollContainer:{}},emits:["toggle"],setup(t,{expose:a,emit:n}){const s=t,l=n,d=m(null),i=m(!1),c=()=>{Le(()=>{if(!d.value||!s.scrollContainer){i.value=!1;return}const v=s.scrollContainer.clientHeight;i.value=d.value.scrollHeight>v*2})};xe(()=>s.expanded,v=>{v?c():i.value=!1});const g=()=>{if(d.value&&s.scrollContainer){const h=d.value.offsetTop-88;s.scrollContainer.scrollTo({top:Math.max(0,h),behavior:"smooth"})}},y=()=>{if(d.value&&s.scrollContainer){const v=d.value.offsetTop+d.value.offsetHeight,f=s.scrollContainer.clientHeight,h=v-f+10;s.scrollContainer.scrollTo({top:Math.max(0,h),behavior:"smooth"})}};return a({checkHeight:c,contentRef:d}),(v,f)=>(r(),o("div",null,[e("div",{class:"sticky top-[27px] z-5 w-full px-3 py-2 bg-neutral-50 dark:bg-neutral-950 flex items-center justify-between border border-neutral-300 dark:border-neutral-700 rounded cursor-pointer hover:bg-neutral-100 dark:hover:bg-neutral-950 transition-colors",onClick:f[0]||(f[0]=h=>l("toggle"))},[e("span",_g,[X(S(t.title)+" ",1),t.subtitle?(r(),o("span",$g,"("+S(t.subtitle)+")",1)):T("",!0)]),e("div",Cg,[i.value&&t.expanded?(r(),o(he,{key:0},[e("button",{onClick:Oe(g,["stop"]),class:"text-[10px] text-neutral-500 hover:text-neutral-700 dark:hover:text-neutral-300"},"↑ Top"),e("button",{onClick:Oe(y,["stop"]),class:"text-[10px] text-neutral-500 hover:text-neutral-700 dark:hover:text-neutral-300"},"↓ Bottom")],64)):T("",!0),e("span",Sg,S(t.expanded?"▼":"▶"),1)])]),Ae(e("div",{ref_key:"contentRef",ref:d,class:"border-x border-b border-neutral-300 dark:border-neutral-700 rounded-b"},[je(v.$slots,"default")],512),[[Ke,t.expanded]])]))}}),Tg={class:"flex items-center justify-between mb-3"},Ig={class:"flex items-center gap-2"},zg={class:"flex items-center gap-1"},Mg=["disabled"],Vg=["disabled"],Eg={class:"text-lg font-bold"},Lg={class:"flex items-center gap-2"},Pg=["disabled","title"],Ag={key:1},jg={class:"@container border-b border-neutral-300 dark:border-neutral-700 pb-3"},Dg={class:"hidden @[600px]:block"},Rg={class:"w-full text-xs"},Og={class:"py-1 font-mono"},Ug={class:"py-1 font-mono"},Bg={key:1},Fg={class:"py-1 font-mono"},Ng={key:1},qg={class:"py-1 font-mono"},Hg={key:1},Wg={class:"py-1 font-mono"},Kg={key:1},Jg={class:"py-1 font-mono text-xs"},Yg={class:"@[600px]:hidden space-y-2"},Gg={class:"w-full text-xs"},Zg={class:"py-1 font-mono"},Xg={class:"py-1 font-mono"},Qg={key:1},eb={class:"w-full text-xs"},tb={class:"py-1 font-mono"},rb={key:1},ab={class:"py-1 font-mono"},ob={key:1},nb={class:"py-1 font-mono"},lb={key:1},sb={class:"py-1 font-mono text-xs"},ib={class:"sticky -top-4 z-10 bg-white dark:bg-neutral-900 border-b border-neutral-300 dark:border-neutral-700 mb-3 pt-3 -mx-4 px-4"},ub={class:"flex gap-4"},db={key:0,class:"text-red-600 dark:text-red-400"},cb={class:"space-y-3"},pb={class:"space-y-2"},mb={class:"flex items-center gap-1 pb-2 mb-2 border-b border-neutral-200 dark:border-neutral-700"},vb=["onClick"],fb={key:1,class:"text-xs text-red-600 dark:text-red-400 ml-2"},hb=["onClick"],gb={class:"font-mono"},bb={class:"text-neutral-500"},xb={class:"px-2 py-2 bg-white dark:bg-neutral-950 border-t border-neutral-200 dark:border-neutral-800"},yb={key:0,class:"text-xs text-neutral-600 dark:text-neutral-400 mb-2"},kb={class:"relative bg-white dark:bg-neutral-900"},wb={class:"absolute top-[5px] right-[5px]"},_b={key:0,class:"mb-4"},$b={class:"text-xs font-semibold text-red-600 dark:text-red-400 mb-1"},Cb={class:"space-y-2"},Sb={class:"px-2 py-1 bg-red-100 dark:bg-red-900/30 text-xs font-medium text-red-800 dark:text-red-200"},Tb={class:"text-xs bg-red-50 dark:bg-red-950 p-2 overflow-x-auto text-red-900 dark:text-red-100"},Ib={key:1,class:"mb-4"},zb={class:"text-xs font-semibold text-red-600 dark:text-red-400 mb-1"},Mb={class:"text-xs bg-red-50 dark:bg-red-950 p-2 rounded overflow-x-auto text-red-900 dark:text-red-100 border border-red-300 dark:border-red-700"},Vb={key:2,class:"mb-4"},Eb={class:"w-full text-xs border border-neutral-300 dark:border-neutral-700 rounded"},Lb={class:"border-b border-neutral-200 dark:border-neutral-800"},Pb={class:"py-1 px-2 font-mono"},Ab={key:1},jb={class:"border-b border-neutral-200 dark:border-neutral-800"},Db={class:"py-1 px-2 font-mono"},Rb={key:1},Ob={key:0,class:"border-b border-neutral-200 dark:border-neutral-800"},Ub={class:"py-1 px-2 font-mono"},Bb={key:1},Fb={class:"border-b border-neutral-200 dark:border-neutral-800"},Nb={class:"py-1 px-2 font-mono"},qb={key:1},Hb={key:1,class:"border-b border-neutral-200 dark:border-neutral-800"},Wb={class:"py-1 px-2 font-mono text-accent-600 dark:text-accent-400"},Kb={class:"border-b border-neutral-200 dark:border-neutral-800"},Jb={class:"py-1 px-2 font-mono font-semibold"},Yb={key:1},Gb={class:"py-1 px-2 font-mono font-semibold"},Zb={key:1},Xb={key:3,class:"mb-4"},Qb={class:"text-xs font-semibold mb-1"},e1={class:"border border-neutral-300 dark:border-neutral-700 rounded overflow-hidden"},t1=["onClick"],r1={class:"flex items-center gap-2"},a1={class:"font-mono"},o1={key:0,class:"px-1.5 py-0.5 text-[10px] bg-emerald-100 dark:bg-emerald-900/40 text-emerald-700 dark:text-emerald-300 rounded font-medium border border-emerald-200 dark:border-emerald-800",title:"Programmatically called with state.queueTool()"},n1={key:1,class:"px-1.5 py-0.5 text-[10px] bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 rounded font-medium"},l1={class:"text-neutral-500"},s1={key:0,class:"text-xs mb-2"},i1={class:"font-mono text-xs bg-white dark:bg-black p-1 rounded border border-emerald-200 dark:border-emerald-800"},u1={class:"text-xs mb-2"},d1={class:"font-mono text-xs bg-white dark:bg-black p-1 rounded border border-neutral-200 dark:border-neutral-800"},c1={class:"text-xs mb-2"},p1={class:"font-mono text-xs bg-white dark:bg-black p-1 rounded border border-neutral-200 dark:border-neutral-800"},m1={class:"text-xs mb-2"},v1={class:"rounded overflow-hidden border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-black"},f1={key:1,class:"text-xs"},h1={class:"text-xs overflow-x-auto bg-green-50 dark:bg-green-950/20 p-2 rounded border border-green-300 dark:border-green-700 whitespace-pre-wrap"},g1={key:2,class:"text-xs"},b1={class:"text-xs mb-2"},x1={class:"font-mono text-xs bg-white dark:bg-black p-1 rounded border border-purple-200 dark:border-purple-800"},y1={key:0,class:"text-sm mt-2"},k1={key:0,class:"text-neutral-600 dark:text-neutral-400"},w1={key:1,class:"text-neutral-600 dark:text-neutral-400"},_1=["href"],$1={key:2,class:"ml-4 mt-1 space-y-0.5"},C1=["href"],S1={key:0,class:"text-xs text-neutral-500"},T1={key:1,class:"text-sm text-neutral-600 dark:text-neutral-400 mt-2"},I1={key:0},z1={class:"font-mono text-xs"},M1={key:1},V1={key:2,class:"text-sm mt-2"},E1={class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800 overflow-x-auto"},L1={key:3,class:"text-sm mt-2"},P1={class:"font-medium text-neutral-600 dark:text-neutral-400 mb-1"},A1={key:4,class:"mb-4"},j1={class:"text-xs font-semibold mb-1"},D1={class:"border border-emerald-300 dark:border-emerald-700 rounded overflow-hidden bg-emerald-50 dark:bg-emerald-950/20"},R1={class:"p-2 flex flex-wrap gap-2"},O1=["src","alt"],U1={key:1,class:"w-[100px] h-[100px] flex items-center justify-center bg-emerald-100 dark:bg-emerald-900 rounded text-xs text-emerald-600 dark:text-emerald-400"},B1={key:5,class:"mb-4"},F1={class:"border border-accent-300 dark:border-accent-700 rounded overflow-hidden bg-accent-50 dark:bg-accent-950/20"},N1={class:"text-accent-600 dark:text-accent-400"},q1={key:6,class:"mb-4"},H1={class:"border border-purple-300 dark:border-purple-700 rounded overflow-hidden bg-purple-50 dark:bg-purple-950/20"},W1={class:"flex items-center gap-2"},K1={class:"px-1.5 py-0.5 text-[10px] bg-purple-200 dark:bg-purple-800 text-purple-700 dark:text-purple-300 rounded"},J1={class:"text-purple-600 dark:text-purple-400"},Y1={class:"divide-y divide-purple-200 dark:divide-purple-800 border-t border-purple-300 dark:border-purple-700"},G1={class:"flex items-center gap-2 mb-1"},Z1={class:"text-xs font-semibold text-purple-700 dark:text-purple-300"},X1={key:0,class:"text-xs font-mono text-purple-600 dark:text-purple-400"},Q1={key:1,class:"text-xs text-purple-500 dark:text-purple-500"},ex={key:2,class:"text-xs text-purple-500 dark:text-purple-500"},tx={key:0,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},rx={class:"text-purple-900 dark:text-purple-100 whitespace-pre-wrap"},ax={key:1,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},ox={class:"font-mono text-purple-700 dark:text-purple-300 break-all"},nx={key:2,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},lx={class:"text-purple-900 dark:text-purple-100 whitespace-pre-wrap"},sx={key:0,class:"mt-2 pt-2 border-t border-purple-200 dark:border-purple-800"},ix={class:"font-mono text-purple-700 dark:text-purple-300 text-xs break-all"},ux={key:3,class:"text-xs bg-white dark:bg-black p-2 rounded border border-purple-200 dark:border-purple-800"},dx={class:"text-purple-900 dark:text-purple-100 overflow-x-auto"},cx={key:7,class:"mb-4"},px={class:"rounded overflow-hidden border border-neutral-300 dark:border-neutral-700"},mx=fe({__name:"LogDetails",props:{log:{},threadId:{},hasPrevious:{type:Boolean},hasNext:{type:Boolean}},emits:["close","previous","next"],setup(t,{emit:a}){const n=t,s=a,l=m("request"),d=m(new Set),i=m(new Set),c=m(!1),g=m(!1),y=m(!0),v=m(!0),f=m(null),h=m(null),_=m(null),b=m(null),u=m(null),x=m(new Set(["system_prompt","request_body","tools"])),p=ae=>n.threadId?ae.startsWith("data:")||ae.startsWith("http")?ae:ge(`/api/threads/${n.threadId}/fs${ae}`):null,k=ae=>{if(!ae)return"N/A";try{return JSON.stringify(JSON.parse(ae),null,2)}catch{return ae}},M=O(()=>{if(!n.log.tools_schema)return[];try{const ae=JSON.parse(n.log.tools_schema);return Array.isArray(ae)?ae:[]}catch{return[]}}),R=O(()=>{if(!n.log.response_body)return[];try{const z=JSON.parse(n.log.response_body)?.choices?.[0]?.message?.tool_calls;return Array.isArray(z)?z:[]}catch{return[]}}),W=O(()=>{if(!n.log.tool_results)return new Map;try{const ae=JSON.parse(n.log.tool_results),z=new Map;return Array.isArray(ae)&&ae.forEach(K=>{K.tool_call_id&&z.set(K.tool_call_id,{content:K.content,status:K.status,tool_name:K.tool_name,timestamp:K.timestamp})}),z}catch{return new Map}}),Z=O(()=>{if(!n.log.response_body)return[];try{const z=JSON.parse(n.log.response_body)?.choices?.[0]?.message?.reasoning_details;return Array.isArray(z)?z:[]}catch{return[]}}),V=O(()=>n.log.reasoning_content?n.log.reasoning_content.replace(/\\n/g,`
|
|
44
44
|
`).replace(/\\t/g," ").replace(/\n{3,}/g,`
|
|
45
45
|
|
|
46
|
-
`).trim():""),P=
|
|
47
|
-
`;
|
|
48
|
-
`,
|
|
49
|
-
`,
|
|
50
|
-
`,
|
|
51
|
-
`):
|
|
52
|
-
`),Z+=` -d '${D.replace(/'/g,"'\\''")}'`,await navigator.clipboard.writeText(Z),h.value=!0,setTimeout(()=>{h.value=!1},2e3)}catch(ae){console.error("Failed to copy cURL command:",ae),alert(`Failed to copy cURL: ${ae instanceof Error?ae.message:"Unknown error"}`)}finally{m.value=!1}};return(ae,I)=>(r(),n("div",{ref_key:"scrollContainer",ref:f,class:"p-4 h-full overflow-y-auto"},[e("div",xg,[e("div",yg,[e("div",kg,[e("button",{onClick:I[0]||(I[0]=D=>i("previous")),disabled:!t.hasPrevious,class:"w-7 h-7 flex items-center justify-center rounded border border-neutral-300 dark:border-neutral-600 text-neutral-500 hover:text-neutral-700 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:text-neutral-200 dark:hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent dark:disabled:hover:bg-transparent transition-all","aria-label":"Previous log",title:"Previous log"},[...I[10]||(I[10]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("polyline",{points:"15 18 9 12 15 6"})],-1)])],8,wg),e("button",{onClick:I[1]||(I[1]=D=>i("next")),disabled:!t.hasNext,class:"w-7 h-7 flex items-center justify-center rounded border border-neutral-300 dark:border-neutral-600 text-neutral-500 hover:text-neutral-700 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:text-neutral-200 dark:hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent dark:disabled:hover:bg-transparent transition-all","aria-label":"Next log",title:"Next log"},[...I[11]||(I[11]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("polyline",{points:"9 18 15 12 9 6"})],-1)])],8,_g)]),e("h3",$g,C(t.log.prompt_name||t.log.model_name||t.log.model),1)]),e("div",Cg,[e("button",{onClick:Me,disabled:m.value||!t.log.request_body,class:"px-3 py-1 text-xs font-medium bg-black text-white dark:bg-white dark:text-black rounded hover:opacity-80 disabled:opacity-50 disabled:cursor-not-allowed transition-opacity",title:t.log.request_body?"Copy cURL command":"No request data available"},[m.value?(r(),q(Ee,{key:0,size:"xs"})):(r(),n("span",Tg,C(h.value?"Copied!":"Copy cURL"),1))],8,Sg),e("button",{onClick:I[2]||(I[2]=D=>i("close")),class:"w-7 h-7 flex items-center justify-center rounded border border-neutral-300 dark:border-neutral-600 text-neutral-500 hover:text-neutral-700 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:text-neutral-200 dark:hover:bg-neutral-800 transition-all","aria-label":"Close details",title:"Close"},[...I[12]||(I[12]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])])]),e("div",Ig,[e("div",zg,[e("table",Vg,[I[13]||(I[13]=e("thead",null,[e("tr",{class:"border-b border-neutral-200 dark:border-neutral-800"},[e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Status "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Provider "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Prompt "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Latency "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Tokens "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Cost "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Created ")])],-1)),e("tbody",null,[e("tr",null,[e("td",{class:ne(["py-1 font-mono",t.log.error?"text-red-600 dark:text-red-400":t.log.is_complete?"text-green-600 dark:text-green-400":"text-yellow-600 dark:text-yellow-400"])},C(t.log.error?"ERROR":t.log.is_complete?"SUCCESS":"LOADING"),3),e("td",Mg,C(t.log.actual_provider||t.log.provider),1),e("td",Eg,[!t.log.is_complete&&!t.log.prompt_name?(r(),q(Ee,{key:0,size:"xs"})):(r(),n("span",Lg,C(t.log.prompt_name||"—"),1))]),e("td",Pg,[!t.log.is_complete&&!t.log.latency_ms?(r(),q(Ee,{key:0,size:"xs"})):(r(),n("span",Ag,C(t.log.latency_ms?`${t.log.latency_ms}ms`:"—"),1))]),e("td",jg,[!t.log.is_complete&&!t.log.total_tokens?(r(),q(Ee,{key:0,size:"xs"})):(r(),n("span",Dg,C(t.log.total_tokens?`${t.log.input_tokens}/${t.log.output_tokens} (${t.log.total_tokens})`:"—"),1))]),e("td",Og,[!t.log.is_complete&&!t.log.cost_total?(r(),q(Ee,{key:0,size:"xs"})):(r(),n("span",Rg,C(t.log.cost_total?`$${t.log.cost_total.toFixed(6)}`:"—"),1))]),e("td",Ug,[w(yt,{timestamp:t.log.created_at},null,8,["timestamp"])])])])])]),e("div",Bg,[e("table",Fg,[I[14]||(I[14]=e("thead",null,[e("tr",{class:"border-b border-neutral-200 dark:border-neutral-800"},[e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Status "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Provider "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Prompt ")])],-1)),e("tbody",null,[e("tr",null,[e("td",{class:ne(["py-1 font-mono",t.log.error?"text-red-600 dark:text-red-400":t.log.is_complete?"text-green-600 dark:text-green-400":"text-yellow-600 dark:text-yellow-400"])},C(t.log.error?"ERROR":t.log.is_complete?"SUCCESS":"LOADING"),3),e("td",Ng,C(t.log.actual_provider||t.log.provider),1),e("td",qg,[!t.log.is_complete&&!t.log.prompt_name?(r(),q(Ee,{key:0,size:"xs"})):(r(),n("span",Hg,C(t.log.prompt_name||"—"),1))])])])]),e("table",Wg,[I[15]||(I[15]=e("thead",null,[e("tr",{class:"border-b border-neutral-200 dark:border-neutral-800"},[e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Latency "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Tokens "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Cost "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Created ")])],-1)),e("tbody",null,[e("tr",null,[e("td",Kg,[!t.log.is_complete&&!t.log.latency_ms?(r(),q(Ee,{key:0,size:"xs"})):(r(),n("span",Jg,C(t.log.latency_ms?`${t.log.latency_ms}ms`:"—"),1))]),e("td",Yg,[!t.log.is_complete&&!t.log.total_tokens?(r(),q(Ee,{key:0,size:"xs"})):(r(),n("span",Gg,C(t.log.total_tokens?`${t.log.input_tokens}/${t.log.output_tokens} (${t.log.total_tokens})`:"—"),1))]),e("td",Zg,[!t.log.is_complete&&!t.log.cost_total?(r(),q(Ee,{key:0,size:"xs"})):(r(),n("span",Xg,C(t.log.cost_total?`$${t.log.cost_total.toFixed(6)}`:"—"),1))]),e("td",Qg,[w(yt,{timestamp:t.log.created_at},null,8,["timestamp"])])])])])])]),e("div",eb,[e("div",tb,[e("button",{onClick:I[3]||(I[3]=D=>l.value="request"),class:ne(["pb-2 px-1 text-sm font-medium border-b-2 transition-colors",l.value==="request"?"border-black dark:border-white text-black dark:text-white":"border-transparent text-neutral-500 dark:text-neutral-400 hover:text-black dark:hover:text-white"])}," Request ",2),e("button",{onClick:I[4]||(I[4]=D=>l.value="response"),class:ne(["pb-2 px-1 text-sm font-medium border-b-2 transition-colors flex items-center gap-1",l.value==="response"?"border-black dark:border-white text-black dark:text-white":"border-transparent text-neutral-500 dark:text-neutral-400 hover:text-black dark:hover:text-white"])},[I[16]||(I[16]=X(" Response ",-1)),t.log.error||B.value.length>0?(r(),n("span",rb,"⚠")):T("",!0)],2)])]),e("div",ab,[Ae(e("div",ob,[e("div",nb,[I[17]||(I[17]=e("span",{class:"text-xs text-neutral-500 dark:text-neutral-400 mr-2"},"View as:",-1)),e("button",{onClick:I[5]||(I[5]=D=>N.value="standard"),class:ne(["px-2 py-1 text-xs rounded transition-colors",N.value==="standard"?"bg-black text-white dark:bg-white dark:text-black":"bg-neutral-100 dark:bg-neutral-800 text-neutral-600 dark:text-neutral-400 hover:bg-neutral-200 dark:hover:bg-neutral-700"])}," Standard Agents ",2),(r(),n(fe,null,ke(H,D=>e("button",{key:D,onClick:Z=>N.value=D,class:ne(["px-2 py-1 text-xs rounded transition-colors",N.value===D?"bg-black text-white dark:bg-white dark:text-black":"bg-neutral-100 dark:bg-neutral-800 text-neutral-600 dark:text-neutral-400 hover:bg-neutral-200 dark:hover:bg-neutral-700"])},C(A(D)),11,lb)),64)),Y.value?(r(),q(Ee,{key:0,size:"xs",class:"ml-2"})):T("",!0),R.value?(r(),n("span",sb,C(R.value),1)):T("",!0)]),L.value.length>0?(r(),q(Tt,{key:0,ref_key:"toolsSectionRef",ref:y,title:`Available Tools (${L.value.length})`,"section-id":"tools",expanded:te("tools"),"scroll-container":f.value,onToggle:I[6]||(I[6]=D=>V("tools"))},{default:j(()=>[(r(!0),n(fe,null,ke(L.value,(D,Z)=>(r(),n("div",{key:Z,class:"border-b border-neutral-200 dark:border-neutral-800 last:border-b-0"},[e("button",{onClick:K=>me(Z),class:"w-full px-2 py-1.5 text-left hover:bg-neutral-50 dark:hover:bg-neutral-900 transition-colors flex items-center justify-between text-xs"},[e("span",ub,C(D.function?.name||D.name||"Unknown"),1),e("span",db,C(u.value.has(Z)?"▼":"▶"),1)],8,ib),Ae(e("div",cb,[D.function?.description||D.description?(r(),n("div",pb,C(D.function?.description||D.description),1)):T("",!0),w(Bt,{code:JSON.stringify(D,null,2),language:"json"},null,8,["code"])],512),[[Ke,u.value.has(Z)]])]))),128))]),_:1},8,["title","expanded","scroll-container"])):T("",!0),t.log.message_history?(r(),q(Tt,{key:1,ref_key:"messagesSectionRef",ref:b,title:`Messages (${t.log.message_history_length||0} messages)`,subtitle:ye.value,"section-id":"messages",expanded:te("messages"),"scroll-container":f.value,onToggle:I[7]||(I[7]=D=>V("messages"))},{default:j(()=>[w(zt,{json:pe.value,"thread-id":t.threadId,"show-copy-button":""},null,8,["json","thread-id"])]),_:1},8,["title","subtitle","expanded","scroll-container"])):T("",!0),t.log.system_prompt?(r(),q(Tt,{key:2,ref_key:"systemPromptSectionRef",ref:v,title:"System Prompt","section-id":"system_prompt",expanded:te("system_prompt"),"scroll-container":f.value,onToggle:I[8]||(I[8]=D=>V("system_prompt"))},{default:j(()=>[e("div",mb,[w(Bt,{code:t.log.system_prompt,language:"markdown"},null,8,["code"]),e("div",vb,[w(na,{content:t.log.system_prompt,variant:"ghost",size:"xs"},null,8,["content"])])])]),_:1},8,["expanded","scroll-container"])):T("",!0),t.log.request_body?(r(),q(Tt,{key:3,ref_key:"requestBodySectionRef",ref:d,title:"Full Request Body",subtitle:ye.value,"section-id":"request_body",expanded:te("request_body"),"scroll-container":f.value,onToggle:I[9]||(I[9]=D=>V("request_body"))},{default:j(()=>[w(zt,{json:ce.value,"thread-id":t.threadId,"show-copy-button":""},null,8,["json","thread-id"])]),_:1},8,["subtitle","expanded","scroll-container"])):T("",!0)],512),[[Ke,l.value==="request"]]),Ae(e("div",null,[B.value.length>0?(r(),n("div",fb,[e("div",hb,C(B.value.length>1?`Errors (${B.value.length})`:"Error"),1),e("div",gb,[(r(!0),n(fe,null,ke(B.value,(D,Z)=>(r(),n("div",{key:Z,class:"border border-red-300 dark:border-red-700 rounded overflow-hidden"},[e("div",bb,C(D.type||"error"),1),e("pre",xb,C(D.message),1)]))),128))])])):t.log.error?(r(),n("div",yb,[e("div",kb," Error "+C(t.log.error_type?`(${t.log.error_type})`:""),1),e("pre",wb,C(t.log.error),1)])):T("",!0),t.log.is_complete||!t.log.error?(r(),n("div",_b,[I[25]||(I[25]=e("div",{class:"text-xs font-semibold mb-1"},"Response Stats",-1)),e("table",$b,[e("tbody",null,[e("tr",Cb,[I[18]||(I[18]=e("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Finish Reason ",-1)),e("td",Sb,[!t.log.is_complete&&!t.log.finish_reason?(r(),q(Ee,{key:0,size:"xs"})):(r(),n("span",Tb,C(t.log.finish_reason||"—"),1))])]),e("tr",Ib,[I[19]||(I[19]=e("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Input Tokens ",-1)),e("td",zb,[!t.log.is_complete&&!t.log.input_tokens?(r(),q(Ee,{key:0,size:"xs"})):(r(),n("span",Vb,C(t.log.input_tokens||"—"),1))])]),t.log.cached_tokens||!t.log.is_complete?(r(),n("tr",Mb,[I[20]||(I[20]=e("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Cached Tokens ",-1)),e("td",Eb,[!t.log.is_complete&&!t.log.cached_tokens?(r(),q(Ee,{key:0,size:"xs"})):(r(),n("span",Lb,C(t.log.cached_tokens||0),1))])])):T("",!0),e("tr",Pb,[I[21]||(I[21]=e("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Output Tokens ",-1)),e("td",Ab,[!t.log.is_complete&&!t.log.output_tokens?(r(),q(Ee,{key:0,size:"xs"})):(r(),n("span",jb,C(t.log.output_tokens||"—"),1))])]),t.log.reasoning_tokens&&t.log.reasoning_tokens>0?(r(),n("tr",Db,[I[22]||(I[22]=e("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Reasoning Tokens ",-1)),e("td",Ob,C(t.log.reasoning_tokens),1)])):T("",!0),e("tr",Rb,[I[23]||(I[23]=e("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Total Tokens ",-1)),e("td",Ub,[!t.log.is_complete&&!t.log.total_tokens?(r(),q(Ee,{key:0,size:"xs"})):(r(),n("span",Bb,C(t.log.total_tokens||"—"),1))])]),e("tr",null,[I[24]||(I[24]=e("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Total Cost ",-1)),e("td",Fb,[!t.log.is_complete&&!t.log.cost_total?(r(),q(Ee,{key:0,size:"xs"})):(r(),n("span",Nb,C(t.log.cost_total?`$${t.log.cost_total.toFixed(6)}`:"—"),1))])])])])])):T("",!0),ue.value.length>0?(r(),n("div",qb,[e("div",Hb," Tools Called ("+C(ue.value.length)+") ",1),e("div",Wb,[(r(!0),n(fe,null,ke(ue.value,D=>(r(),n("div",{key:D.id,class:"border-b border-neutral-200 dark:border-neutral-800 last:border-b-0"},[e("button",{onClick:Z=>Q(D.id),class:"w-full px-2 py-1.5 text-left hover:bg-neutral-50 dark:hover:bg-neutral-900 transition-colors flex items-center justify-between text-xs"},[e("div",Jb,[e("span",Yb,C(D.name),1),D.isQueued?(r(),n("span",Gb," programmatically invoked ")):T("",!0),D.isProvider?(r(),n("span",Zb," provider ")):T("",!0),D.isProvider&&D.status?(r(),n("span",{key:2,class:ne([D.status==="completed"?"text-green-600 dark:text-green-400":D.status==="failed"?"text-red-600 dark:text-red-400":"text-yellow-600 dark:text-yellow-400","text-[10px]"])},C(D.status),3)):T("",!0)]),e("span",Xb,C(s.value.has(D.id)?"▼":"▶"),1)],8,Kb),Ae(e("div",{class:ne(["px-2 py-2 border-t border-neutral-200 dark:border-neutral-800",D.isProvider?"bg-purple-50 dark:bg-purple-900/10":D.isQueued?"bg-emerald-50 dark:bg-emerald-900/10":"bg-white dark:bg-neutral-950"])},[D.isProvider?(r(),n(fe,{key:1},[e("div",d1,[I[32]||(I[32]=e("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Provider Tool ID ",-1)),e("div",c1,C(D.id),1)]),D.providerType==="web_search"&&D.result?.actions?(r(),n("div",p1,[(r(!0),n(fe,null,ke(D.result.actions,(Z,K)=>(r(),n("div",{key:K,class:"mb-2"},[Z.type==="search"?(r(),n("div",m1,[I[33]||(I[33]=e("span",{class:"font-medium"},"Searched:",-1)),X(' "'+C(Z.query)+'" ',1)])):T("",!0),Z.type==="open"?(r(),n("div",v1,[I[34]||(I[34]=e("span",{class:"font-medium"},"Opened:",-1)),e("a",{href:Z.url,target:"_blank",class:"text-blue-600 hover:underline ml-1"},C(Z.url),9,f1)])):T("",!0),Z.sources?.length?(r(),n("div",h1,[(r(!0),n(fe,null,ke(Z.sources.slice(0,5),(oe,se)=>(r(),n("a",{key:se,href:oe.url,target:"_blank",class:"block text-blue-600 hover:underline text-xs truncate"},C(oe.title||oe.url),9,g1))),128)),Z.sources.length>5?(r(),n("span",b1," ... and "+C(Z.sources.length-5)+" more ",1)):T("",!0)])):T("",!0)]))),128))])):T("",!0),D.providerType==="image_generation"?(r(),n("div",x1,[D.result?.imagePath?(r(),n("span",y1,[I[35]||(I[35]=X(" Stored at: ",-1)),e("span",k1,C(D.result.imagePath),1)])):(r(),n("span",w1," See Generated Images section below "))])):T("",!0),D.providerType==="code_interpreter"&&D.result?.output?(r(),n("div",_1,[I[36]||(I[36]=e("div",{class:"font-medium text-neutral-600 dark:text-neutral-400 mb-1"},"Output:",-1)),e("pre",$1,C(D.result.output),1)])):T("",!0),D.providerType==="file_search"&&D.result?.results?.length?(r(),n("div",C1,[e("div",S1," Found "+C(D.result.results.length)+" result(s) ",1)])):T("",!0)],64)):(r(),n(fe,{key:0},[D.isQueued&&D.queuedAt?(r(),n("div",Qb,[I[26]||(I[26]=e("div",{class:"font-semibold text-emerald-600 dark:text-emerald-400 mb-1"}," Invoked At ",-1)),e("div",e1,[w(yt,{timestamp:D.queuedAt},null,8,["timestamp"])])])):T("",!0),e("div",t1,[I[27]||(I[27]=e("div",{class:"font-semibold text-neutral-600 dark:text-neutral-400 mb-1"}," Tool Call ID ",-1)),e("div",r1,C(D.id),1)]),e("div",a1,[I[28]||(I[28]=e("div",{class:"font-semibold text-neutral-600 dark:text-neutral-400 mb-1"}," Function Name ",-1)),e("div",o1,C(D.function?.name),1)]),e("div",n1,[I[29]||(I[29]=e("div",{class:"font-semibold text-neutral-600 dark:text-neutral-400 mb-1"}," Arguments ",-1)),e("div",l1,[w(Bt,{code:_(D.function?.arguments||"{}"),language:"json"},null,8,["code"])])]),W.value.has(D.id)?(r(),n("div",s1,[I[30]||(I[30]=e("div",{class:"font-semibold text-green-600 dark:text-green-400 mb-1"}," Result ",-1)),e("pre",i1,C(W.value.get(D.id)?.content||"No content"),1)])):(r(),n("div",u1,[...I[31]||(I[31]=[e("div",{class:"font-semibold text-neutral-500 dark:text-neutral-500 mb-1"}," Result ",-1),e("div",{class:"text-xs text-neutral-500 dark:text-neutral-500 italic"}," No result available ",-1)])]))],64))],2),[[Ke,s.value.has(D.id)]])]))),128))])])):T("",!0),P.value.length>0?(r(),n("div",T1,[e("div",I1," Generated Images ("+C(P.value.length)+") ",1),e("div",z1,[I[37]||(I[37]=e("div",{class:"px-2 py-1.5 bg-emerald-100 dark:bg-emerald-900/30 text-xs text-emerald-800 dark:text-emerald-200 border-b border-emerald-300 dark:border-emerald-700"}," Images returned by the model ",-1)),e("div",V1,[(r(!0),n(fe,null,ke(P.value,(D,Z)=>(r(),n("div",{key:Z,class:"relative"},[D.image_url?.url?(r(),n("img",{key:0,src:g(D.image_url.url)||D.image_url.url,alt:`Generated image ${Z+1}`,class:"max-w-[300px] max-h-[300px] rounded border border-emerald-200 dark:border-emerald-800 object-contain"},null,8,M1)):(r(),n("div",E1," No URL "))]))),128))])])])):T("",!0),t.log.reasoning_content?(r(),n("div",L1,[e("div",P1,[e("button",{onClick:E,class:"w-full px-2 py-1.5 bg-accent-100 dark:bg-accent-900/30 text-xs text-accent-800 dark:text-accent-200 flex items-center justify-between hover:bg-accent-200 dark:hover:bg-accent-900/50 transition-colors"},[I[38]||(I[38]=e("div",{class:"flex items-center gap-2"},[e("span",{class:"font-semibold"},"Reasoning Content"),e("span",{class:"text-accent-600 dark:text-accent-400 font-normal"}," Internal reasoning output (not displayed to users) ")],-1)),e("span",A1,C(x.value?"▶":"▼"),1)]),Ae(e("pre",{class:"text-xs p-2 overflow-x-auto whitespace-pre-wrap max-h-96 text-accent-900 dark:text-accent-100 border-t border-accent-300 dark:border-accent-700"},C(z.value),513),[[Ke,!x.value]])])])):T("",!0),J.value.length>0?(r(),n("div",j1,[e("div",D1,[e("button",{onClick:$,class:"w-full px-2 py-1.5 bg-purple-100 dark:bg-purple-900/30 text-xs text-purple-800 dark:text-purple-200 flex items-center justify-between hover:bg-purple-200 dark:hover:bg-purple-900/50 transition-colors"},[e("div",O1,[I[39]||(I[39]=e("span",{class:"font-semibold"},"Reasoning Details",-1)),e("span",R1,C(J.value.length)+" blocks ",1),I[40]||(I[40]=e("span",{class:"text-purple-600 dark:text-purple-400 font-normal"}," Structured reasoning from OpenRouter ",-1))]),e("span",U1,C(c.value?"▶":"▼"),1)]),Ae(e("div",B1,[(r(!0),n(fe,null,ke(J.value,(D,Z)=>(r(),n("div",{key:Z,class:"p-2"},[e("div",F1,[e("span",N1,C(D.type||"unknown"),1),D.id?(r(),n("span",q1," ID: "+C(D.id),1)):T("",!0),D.format?(r(),n("span",H1," Format: "+C(D.format),1)):T("",!0),D.index!==void 0?(r(),n("span",W1," Index: "+C(D.index),1)):T("",!0)]),D.type==="reasoning.summary"&&D.summary?(r(),n("div",K1,[I[41]||(I[41]=e("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Summary: ",-1)),e("div",J1,C(D.summary),1)])):T("",!0),D.type==="reasoning.encrypted"&&D.data?(r(),n("div",Y1,[I[42]||(I[42]=e("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Encrypted Data: ",-1)),e("div",G1,C(D.data),1)])):T("",!0),D.type==="reasoning.text"&&D.text?(r(),n("div",Z1,[I[44]||(I[44]=e("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Reasoning Text: ",-1)),e("div",X1,C(D.text),1),D.signature?(r(),n("div",Q1,[I[43]||(I[43]=e("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Signature: ",-1)),e("div",ex,C(D.signature),1)])):T("",!0)])):T("",!0),["reasoning.summary","reasoning.encrypted","reasoning.text"].includes(D.type)?T("",!0):(r(),n("div",tx,[e("pre",rx,C(JSON.stringify(D,null,2)),1)]))]))),128))],512),[[Ke,!c.value]])])])):T("",!0),t.log.response_body?(r(),n("div",ax,[I[45]||(I[45]=e("div",{class:"text-xs font-semibold mb-1"},"Full Response Body",-1)),e("div",ox,[w(zt,{json:t.log.response_body,"thread-id":t.threadId,"show-copy-button":""},null,8,["json","thread-id"])])])):T("",!0)],512),[[Ke,l.value==="response"]])])],512))}}),lx={class:"flex flex-col h-full"},sx={class:"px-4 py-3 border-b border-neutral-300 dark:border-neutral-700"},ix={class:"flex items-center justify-between"},ux={class:"flex items-center gap-2"},dx={key:0,class:"text-neutral-500 dark:text-neutral-400 text-center py-12"},cx={key:1,class:"flex justify-center py-12"},px={key:2,class:"text-red-600 dark:text-red-400 text-center py-12"},mx={key:3,class:"text-neutral-500 dark:text-neutral-400 text-center py-12"},vx={key:4},fx={key:0,class:"border-b border-neutral-300 dark:border-neutral-700 bg-white dark:bg-black sticky top-0 z-10"},hx=["disabled"],gx={key:1},bx={key:2},xx={key:3},yx={class:"w-full text-sm"},kx=["onClick","onMouseenter"],wx={class:"px-3 py-2 text-xs"},_x={class:"flex items-center gap-1"},$x={key:0,class:"text-neutral-400 dark:text-neutral-600 mr-1"},Cx={key:3},Sx={class:"px-3 py-2"},Tx={class:"flex items-center gap-2"},Ix={key:0,class:"text-red-600 dark:text-red-400",title:"Error"},zx={class:"font-mono text-xs"},Vx={class:"px-3 py-2 font-mono text-xs"},Mx={key:1},Ex={key:1,class:"text-neutral-400"},Lx={key:2},Px={key:0,class:"text-emerald-600 dark:text-emerald-400",title:"Programmatically called with state.queueTool()"},Ax={key:1},jx={key:2},Dx={key:0,class:"log-details-panel relative shrink-0 bg-neutral-100 dark:bg-neutral-950 border-t border-neutral-300 dark:border-neutral-700 overflow-hidden"},Ox={class:"m-2 border h-[calc(100%-1rem)] border-neutral-300 shrink-0 dark:border-neutral-700 rounded-xl bg-white dark:bg-neutral-900 overflow-auto"},Rx={key:0,class:"flex flex-col items-center justify-center h-full gap-3 text-neutral-500 dark:text-neutral-400"},Ux={key:2,class:"absolute inset-0 bg-white/50 dark:bg-black/50 flex items-center justify-center"},fr=20,Bx=20,Fx=ve({__name:"LogsPane",props:{threadId:{},selectedLogId:{},hoveredLogId:{}},emits:["logClick","logHover","logsLoaded"],setup(t,{expose:o,emit:a}){const i=t,l=a,u=p(0),s=p(fr),{logs:m,hasMore:h,isFetching:x,error:c,wsConnected:f,wsError:y,connectWebSocket:b,disconnectWebSocket:v,refetch:d}=eg(U(()=>i.threadId),{limit:U(()=>s.value),offset:U(()=>u.value),enableWebSocket:!0,order:"desc"}),k=p([]),g=p(!0),_=p(null),L=p(null),O=p(!1),W=p(!1),J=p(new Map),z=async()=>{await Le(),L.value&&(L.value.scrollTop=L.value.scrollHeight)},P=p(null);ge(m,async K=>{if(u.value===0)k.value=[...K].reverse(),g.value&&k.value.length>0&&(await z(),g.value=!1);else{const oe=[...K].reverse(),se=new Map;k.value.forEach(be=>se.set(be.id,be)),oe.forEach(be=>se.set(be.id,be)),k.value=Array.from(se.values()).sort((be,le)=>be.created_at-le.created_at)}},{deep:!0,immediate:!0}),ge(x,(K,oe)=>{if(oe&&!K&&u.value===0&&i.threadId&&P.value!==i.threadId&&k.value.length>0){P.value=i.threadId;const se=k.value[k.value.length-1];l("logsLoaded",se?.id??null)}});const{logDetails:G,isFetching:ee}=tg(U(()=>i.threadId),U(()=>_.value)),ue=U(()=>{if(!_.value)return null;const oe=k.value.find(se=>se.id===_.value);return oe?G.value?{...G.value,...oe}:oe:null}),me=U(()=>_.value?Z.value.findIndex(K=>K.id===_.value):-1),Q=U(()=>me.value>0),E=U(()=>me.value>=0&&me.value<Z.value.length-1),$=()=>{if(Q.value){const K=Z.value[me.value-1];B(K)}},V=()=>{if(E.value){const K=Z.value[me.value+1];B(K)}},te=K=>{if(!L.value)return;const oe=J.value.get(K);if(!oe)return;const se=L.value,be=oe.getBoundingClientRect(),le=se.getBoundingClientRect(),de=se.querySelectorAll(".sticky");let ze=0;de.forEach(xe=>{ze+=xe.getBoundingClientRect().height}),ze+=16;const we=be.top<le.top+ze,_e=be.bottom>le.bottom;we?se.scrollBy({top:be.top-le.top-ze,behavior:"smooth"}):_e&&se.scrollBy({top:be.bottom-le.bottom,behavior:"smooth"})},B=K=>{l("logClick",K.id),_.value=K.id},N=(K,oe)=>{oe?J.value.set(K,oe):J.value.delete(K)};ge(_,async K=>{K&&(await Le(),te(K))}),ge(()=>i.selectedLogId,K=>{K&&(_.value=K)},{immediate:!0});const F=K=>{_.value=K},Y=async K=>{await Le();const oe=J.value.get(K);if(oe&&L.value){const se=L.value,be=oe.getBoundingClientRect(),le=se.getBoundingClientRect(),de=se.querySelector("thead"),ze=se.querySelector(":scope > div > div.sticky");let we=0;de&&(we+=de.getBoundingClientRect().height),ze&&(we+=ze.getBoundingClientRect().height),we+=40;const _e=be.top<le.top+we,xe=be.bottom>le.bottom;_e?se.scrollBy({top:be.top-le.top-we,behavior:"smooth"}):xe&&se.scrollBy({top:be.bottom-le.bottom,behavior:"smooth"})}},R=K=>{if(K.length===0)return;const oe=new Set(K);k.value=k.value.filter(se=>!oe.has(se.id))},H=p(!1),M=K=>k.value.some(oe=>oe.id===K),ie=K=>k.value.find(oe=>oe.id===K)??null,A=(K,oe=3e3)=>new Promise(se=>{const be=Date.now(),le=ge(k,()=>{k.value.length!==K&&(le(),se(!0))},{deep:!0}),de=setInterval(()=>{k.value.length!==K?(clearInterval(de),le(),se(!0)):Date.now()-be>oe&&(clearInterval(de),le(),se(!1))},50)});o({scrollToLog:Y,selectLogById:F,removeLogsByIds:R,loadUntilLogId:async K=>{if(M(K))return!0;if(!h.value)return!1;H.value=!0;const oe=100,se=50;try{let be=0;for(;h.value&&!M(K)&&be<se;){be++;const le=k.value.length;if(u.value+=s.value,s.value=oe,await d(),!await A(le))break}return M(K)}finally{H.value=!1}},hasLog:M,getLog:ie,setLoadingForLog:K=>{H.value=K},waitForLogRow:async(K,oe=2e3)=>{const se=Date.now();for(;Date.now()-se<oe;){if(J.value.has(K))return!0;if(!Z.value.some(le=>le.id===K)){await Le(),await new Promise(le=>setTimeout(le,16));continue}await Le(),await new Promise(le=>setTimeout(le,16))}return!1}});const Me=async()=>{if(W.value||!h.value||x.value)return;W.value=!0;const K=L.value?.scrollHeight||0;if(u.value+=s.value,s.value=Bx,await d(),await Le(),L.value){const oe=L.value.scrollHeight;L.value.scrollTop+=oe-K}W.value=!1};ge(()=>i.threadId,async K=>{K?(v(),b()):v(),u.value=0,s.value=fr,k.value=[],_.value=null,O.value=!1,g.value=!0},{immediate:!0}),ge(k,async()=>{O.value||await z()},{deep:!0});const ae=()=>{if(!L.value)return;const{scrollTop:K,scrollHeight:oe,clientHeight:se}=L.value,be=oe-K-se<50;O.value=!be},I=K=>{const oe=[];if(K.tools_called)try{const se=JSON.parse(K.tools_called);Array.isArray(se)&&oe.push(...se.map(be=>({name:be,isProgrammatic:!1})))}catch{}if(K.provider_tools)try{const se=JSON.parse(K.provider_tools);Array.isArray(se)&&oe.push(...se.map(be=>({name:be.type,isProgrammatic:!1})))}catch{}if(K.queued_tools)try{const se=JSON.parse(K.queued_tools);Array.isArray(se)&&oe.push(...se.map(be=>({name:be.function?.name||"unknown",isProgrammatic:!0})))}catch{}return oe},D=K=>K==null?"—":`$${K.toFixed(6)}`,Z=U(()=>{const K=new Map,oe=new Map;k.value.forEach(le=>{K.set(le.id,le);const de=le.parent_log_id;de&&(oe.has(de)||oe.set(de,[]),oe.get(de).push(le))});const se=[],be=(le,de)=>{se.push({...le,depth:de}),(oe.get(le.id)||[]).forEach(we=>{be(we,de+1)})};return k.value.forEach(le=>{le.parent_log_id||be(le,0)}),se});return(K,oe)=>(r(),n("div",lx,[e("div",sx,[e("div",ix,[e("div",ux,[w(S(qa),{size:18,class:"shrink-0"}),oe[3]||(oe[3]=e("h2",{class:"text-base font-bold"},"Logs",-1)),t.threadId?(r(),q(er,{key:0,connected:S(f),error:S(y)},null,8,["connected","error"])):T("",!0)])])]),e("div",{ref_key:"logsScrollContainer",ref:L,class:"logs-list-container flex-1 overflow-y-auto overflow-x-auto",onScroll:ae},[t.threadId?S(x)&&u.value===0?(r(),n("div",cx,[w(Ee)])):S(c)?(r(),n("div",px," Error loading logs: "+C(S(c)),1)):k.value.length===0?(r(),n("div",mx," No logs yet ")):(r(),n("div",vx,[S(h)?(r(),n("div",fx,[e("button",{onClick:Me,disabled:W.value||H.value,type:"button",class:"w-full px-3 py-2 text-xs font-medium text-neutral-700 dark:text-neutral-300 hover:bg-neutral-100 dark:hover:bg-neutral-900 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2"},[W.value||H.value?(r(),q(Ee,{key:0,size:"xs"})):T("",!0),H.value?(r(),n("span",gx,"Loading to find log...")):W.value?(r(),n("span",bx,"Loading older logs...")):(r(),n("span",xx,"Load previous logs"))],8,hx)])):T("",!0),e("table",yx,[e("thead",{class:ne(["border-b border-neutral-300 dark:border-neutral-700 sticky bg-white z-[10] dark:bg-black",{"top-0":!S(h),"top-[34px]":S(h)}])},[...oe[4]||(oe[4]=[e("tr",null,[e("th",{class:"text-left px-3 py-1.5 text-xs font-semibold"},"Prompt"),e("th",{class:"text-left px-3 py-1.5 text-xs font-semibold"},"Model"),e("th",{class:"text-left px-3 py-1.5 text-xs font-semibold"},"Cost"),e("th",{class:"text-left px-3 py-1.5 text-xs font-semibold"},"Tools Called"),e("th",{class:"text-right px-3 py-1.5 text-xs font-semibold"},"Called At")],-1)])],2),e("tbody",null,[(r(!0),n(fe,null,ke(Z.value,se=>(r(),n("tr",{key:se.id,ref_for:!0,ref:be=>N(se.id,be),class:ne(["border-b border-neutral-200 dark:border-neutral-800 cursor-pointer transition-colors relative",{"last:border-b-0":ue.value,"bg-red-50 dark:bg-red-950/20":se.error,"bg-accent-100 dark:bg-accent-900 dark:text-white":_.value===se.id,"ring-2 ring-inset ring-accent-400 dark:ring-accent-400":se.id===i.selectedLogId||se.id!==i.selectedLogId&&se.id===i.hoveredLogId}]),onClick:be=>B(se),onMouseenter:be=>l("logHover",se.id),onMouseleave:oe[0]||(oe[0]=be=>l("logHover",null))},[e("td",wx,[e("div",_x,[se.depth>0?(r(),n("span",$x,"└─")):T("",!0),se.retry_of_log_id?(r(),q(S(Ha),{key:1,size:14,class:"text-neutral-500 dark:text-neutral-400 flex-shrink-0"})):T("",!0),!se.is_complete&&!se.prompt_name?(r(),q(Ee,{key:2,size:"xs"})):(r(),n("span",Cx,C(se.prompt_name||"—"),1))])]),e("td",Sx,[e("div",Tx,[se.error?(r(),n("span",Ix," ✕ ")):T("",!0),e("span",zx,C(se.model_name||se.model),1)])]),e("td",Vx,[!se.is_complete&&!se.cost_total?(r(),q(Ee,{key:0,size:"xs"})):(r(),n("span",Mx,C(D(se.cost_total)),1))]),e("td",{class:ne(["px-3 py-2 text-xs",_.value===se.id?"text-neutral-800 dark:text-neutral-100":"text-neutral-600 dark:text-neutral-400"])},[!se.is_complete&&I(se).length===0?(r(),q(Ee,{key:0,size:"xs"})):I(se).length===0?(r(),n("span",Ex,"—")):(r(),n("span",Lx,[(r(!0),n(fe,null,ke(I(se),(be,le)=>(r(),n(fe,{key:le},[be.isProgrammatic?(r(),n("span",Px,[w(S(Wa),{size:11,class:"inline-block -mt-0.5 mr-0.5"}),X(C(be.name),1)])):(r(),n("span",Ax,C(be.name),1)),le<I(se).length-1?(r(),n("span",jx,", ")):T("",!0)],64))),128))]))],2),e("td",{class:ne(["px-3 py-2 text-right text-xs",_.value===se.id?"text-neutral-800 dark:text-neutral-100":"text-neutral-500 dark:text-neutral-500"])},[w(yt,{timestamp:se.created_at},null,8,["timestamp"])],2)],42,kx))),128))])])])):(r(),n("div",dx," Select a thread to view logs "))],544),w(et,{name:"slide-up",onAfterEnter:oe[2]||(oe[2]=()=>_.value&&te(_.value))},{default:j(()=>[ue.value||H.value&&_.value?(r(),n("div",Dx,[e("div",Ox,[H.value&&!ue.value?(r(),n("div",Rx,[w(Ee),oe[5]||(oe[5]=e("span",{class:"text-sm"},"Loading log...",-1))])):ue.value?(r(),q(nx,{key:1,log:ue.value,"thread-id":t.threadId,"has-previous":Q.value,"has-next":E.value,onClose:oe[1]||(oe[1]=se=>_.value=null),onPrevious:$,onNext:V},null,8,["log","thread-id","has-previous","has-next"])):T("",!0),S(ee)&&ue.value?(r(),n("div",Ux,[w(Ee)])):T("",!0)])])):T("",!0)]),_:1})]))}}),Nx=Xe(Fx,[["__scopeId","data-v-f8e4fdfe"]]),qx={class:"space-y-4"},Hx={key:0},Wx={key:1},Kx={key:1,class:"space-y-4 p-4 bg-neutral-50 dark:bg-neutral-900 rounded-lg"},Jx={key:2,class:"p-4 bg-neutral-50 dark:bg-neutral-900 rounded-lg text-center text-sm text-neutral-500"},Yx={key:3,class:"space-y-4"},Gx={key:0,class:"p-4 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-700 rounded-lg"},Zx={class:"space-y-3"},Xx={key:0,class:"text-xs text-amber-500 dark:text-amber-400 mt-1"},Qx={key:1,class:"p-4 bg-neutral-50 dark:bg-neutral-900 rounded-lg"},ey={key:4,class:"p-4 bg-neutral-50 dark:bg-neutral-900 rounded-lg text-center text-sm text-neutral-500"},ty={class:"flex justify-between"},ry=ve({__name:"CreateThreadModal",props:{modelValue:{type:Boolean},editThread:{}},emits:["update:modelValue","thread-created","thread-updated"],setup(t,{emit:o}){const a=t,i=o,l=U(()=>!!a.editThread),u=p(""),s=p(""),m=p({}),h=p(!1),x=p(""),c=p({}),f=p([]),y=p(!1),{data:b,isFetching:v,execute:d}=Ne(he("/api/agents"),{immediate:!1}).json(),k=U(()=>b.value?(b.value?.agents||[]).map(V=>({value:V.id,label:V.title})):[]),g=U(()=>!u.value||!b.value?null:(b.value?.agents||[]).find(V=>V.id===u.value)),{data:_,isFetching:L,execute:O}=Ne(U(()=>g.value?.side_a_system_prompt?he(`/api/prompts/${encodeURIComponent(g.value.side_a_system_prompt)}`):""),{immediate:!1}).json(),W=U(()=>{if(!_.value)return null;const $=_.value?.required_schema;if(!$)return null;try{return typeof $=="string"?JSON.parse($):$}catch{return null}}),J=U(()=>f.value.filter($=>$.required&&!$.value&&!c.value[$.name])),z=U(()=>f.value.filter($=>$.value!==void 0||!$.required)),P=U(()=>f.value.length>0),G=async $=>{if(!$){f.value=[],c.value={};return}y.value=!0;try{const V=await fetch(he(`/api/agents/${encodeURIComponent($)}/tenvs`));if(V.ok){const te=await V.json();f.value=te.tenvs||[],c.value=te.merged||{}}else f.value=[],c.value={}}catch(V){console.error("Error fetching agent tenvs:",V),f.value=[],c.value={}}finally{y.value=!1}},ee=U(()=>{const $=W.value;return!$||!$.properties?[]:Object.entries($.properties).map(([V,te])=>({name:V,type:te.type||"string",description:te.description||"",required:$.required?.includes(V)||!1,enum:te.enum}))});ge(u,async $=>{$&&g.value?.side_a_system_prompt?(await O(),m.value={}):m.value={},$?await G($):(f.value=[],c.value={})});const ue=()=>{u.value="",s.value="",m.value={},x.value="",c.value={},f.value=[]},me=()=>{a.editThread&&(u.value=a.editThread.agent_id,s.value=a.editThread.tags?.join(", ")||"")},Q=async()=>{if(!u.value){x.value="Please select an agent";return}if(!l.value&&ee.value.length>0){for(const $ of ee.value)if($.required&&!m.value[$.name]){x.value=`Please provide ${$.name}`;return}}if(!l.value&&J.value.length>0){for(const $ of J.value)if(!c.value[$.name]){x.value=`Please provide required environment variable: ${$.name}`;return}}h.value=!0,x.value="";try{const $=s.value.split(",").map(V=>V.trim()).filter(V=>V.length>0);if(l.value){const V=await fetch(he(`/api/threads/${a.editThread.id}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tags:$})});if(!V.ok){const te=await V.json();throw new Error(te.error||"Failed to update thread")}i("thread-updated"),ue(),i("update:modelValue",!1)}else{const V={agent_id:u.value,tags:$.length>0?$:void 0};Object.keys(m.value).length>0&&(V.data=m.value),Object.keys(c.value).length>0&&(V.tenvs=c.value);const te=await fetch(he("/api/threads"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(V)});if(!te.ok){const F=await te.json();throw new Error(F.error||"Failed to create thread")}const N=(await te.json()).threadId;if(!N)throw new Error("Thread created but ID not found in response");i("thread-created",N),ue(),i("update:modelValue",!1)}}catch($){console.error(`Error ${l.value?"updating":"creating"} thread:`,$),x.value=$.message||`Failed to ${l.value?"update":"create"} thread`}finally{h.value=!1}},E=()=>{ue(),i("update:modelValue",!1)};return ge(()=>a.modelValue,async $=>{$&&(await d(),ue(),l.value&&me())}),($,V)=>{const te=Be("FormKit");return r(),q(He,{"model-value":t.modelValue,"onUpdate:modelValue":V[3]||(V[3]=B=>$.$emit("update:modelValue",B)),title:l.value?"Edit Thread":"Create New Thread",width:"max-w-3xl"},{footer:j(()=>[e("div",ty,[w(S(De),{variant:"ghost",size:"sm",disabled:h.value,onClick:E},{default:j(()=>[...V[10]||(V[10]=[X(" Cancel ",-1)])]),_:1},8,["disabled"]),w(S(De),{variant:"primary",size:"sm",disabled:h.value||S(v),loading:h.value,onClick:Q},{default:j(()=>[l.value?(r(),n(fe,{key:0},[X(C(h.value?"Updating...":"Update Thread"),1)],64)):(r(),n(fe,{key:1},[X(C(h.value?"Creating...":"Create Thread"),1)],64))]),_:1},8,["disabled","loading"])])]),default:j(()=>[e("div",qx,[x.value?(r(),q(S(Fe),{key:0,variant:"error"},{default:j(()=>[X(C(x.value),1)]),_:1})):T("",!0),e("div",null,[w(te,{type:"selectSearch",modelValue:u.value,"onUpdate:modelValue":V[0]||(V[0]=B=>u.value=B),label:"Agent",options:k.value,disabled:S(v)||l.value,placeholder:"Select an agent...",validation:"required"},null,8,["modelValue","options","disabled"]),w(S(Ie),{class:"mt-1"},{default:j(()=>[l.value?(r(),n("span",Hx,"Agent cannot be changed after thread creation")):(r(),n("span",Wx,"Choose which agent will handle this conversation"))]),_:1})]),!l.value&&ee.value.length>0&&!S(L)?(r(),n("div",Kx,[V[4]||(V[4]=e("h4",{class:"text-sm font-medium text-neutral-700 dark:text-neutral-300"}," Required Information ",-1)),(r(!0),n(fe,null,ke(ee.value,B=>(r(),n("div",{key:B.name,class:"space-y-2"},[B.enum?(r(),q(te,{key:0,type:"selectSearch",modelValue:m.value[B.name],"onUpdate:modelValue":N=>m.value[B.name]=N,label:B.name,options:[{value:"",label:"Select..."},...B.enum.map(N=>({value:N,label:N}))],validation:B.required?"required":""},null,8,["modelValue","onUpdate:modelValue","label","options","validation"])):B.type==="string"?(r(),q(te,{key:1,type:"text",modelValue:m.value[B.name],"onUpdate:modelValue":N=>m.value[B.name]=N,label:B.name,placeholder:B.description,validation:B.required?"required":""},null,8,["modelValue","onUpdate:modelValue","label","placeholder","validation"])):B.type==="number"||B.type==="integer"?(r(),q(te,{key:2,type:"number",modelValue:m.value[B.name],"onUpdate:modelValue":N=>m.value[B.name]=N,label:B.name,placeholder:B.description,validation:B.required?"required":""},null,8,["modelValue","onUpdate:modelValue","label","placeholder","validation"])):B.type==="boolean"?(r(),q(te,{key:3,type:"checkbox",modelValue:m.value[B.name],"onUpdate:modelValue":N=>m.value[B.name]=N,label:B.name,validation:B.required?"required":""},null,8,["modelValue","onUpdate:modelValue","label","validation"])):(r(),q(te,{key:4,type:"textarea",modelValue:m.value[B.name],"onUpdate:modelValue":N=>m.value[B.name]=N,label:B.name,placeholder:B.description||`Enter ${B.name} (JSON format)`,validation:B.required?"required":"",rows:3},null,8,["modelValue","onUpdate:modelValue","label","placeholder","validation"])),B.description?(r(),q(S(Ie),{key:5,class:"mt-1"},{default:j(()=>[X(C(B.description),1)]),_:2},1024)):T("",!0)]))),128))])):T("",!0),!l.value&&S(L)?(r(),n("div",Jx," Loading agent requirements... ")):T("",!0),!l.value&&P.value&&!y.value?(r(),n("div",Yx,[J.value.length>0?(r(),n("div",Gx,[V[5]||(V[5]=e("h4",{class:"text-sm font-medium text-amber-800 dark:text-amber-200 mb-3"}," Required Environment Variables ",-1)),V[6]||(V[6]=e("p",{class:"text-xs text-amber-600 dark:text-amber-300 mb-3"}," These values are required by the agent's tools and must be provided. ",-1)),e("div",Zx,[(r(!0),n(fe,null,ke(J.value,B=>(r(),n("div",{key:B.name},[w(te,{type:"text","model-value":c.value[B.name]||"",onInput:N=>c.value[B.name]=N,label:B.name,placeholder:B.description||"Enter value...",validation:"required"},null,8,["model-value","onInput","label","placeholder"]),B.source?(r(),n("p",Xx," Required by: "+C(B.source),1)):T("",!0)]))),128))])])):T("",!0),z.value.length>0?(r(),n("div",Qx,[V[7]||(V[7]=e("h4",{class:"text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-3"}," Environment Configuration ",-1)),V[8]||(V[8]=e("p",{class:"text-xs text-neutral-500 dark:text-neutral-400 mb-3"}," Values inherited from the agent. Click the lock icon to override. ",-1)),w(Zt,{modelValue:c.value,"onUpdate:modelValue":V[1]||(V[1]=B=>c.value=B),inherited:z.value,"allow-custom":!0},null,8,["modelValue","inherited"])])):T("",!0)])):T("",!0),!l.value&&y.value?(r(),n("div",ey," Loading environment configuration... ")):T("",!0),e("div",null,[w(te,{type:"text",modelValue:s.value,"onUpdate:modelValue":V[2]||(V[2]=B=>s.value=B),label:"Tags",placeholder:"research, urgent, production"},null,8,["modelValue"]),w(S(Ie),{class:"mt-1"},{default:j(()=>[...V[9]||(V[9]=[X(" Comma-separated tags to help organize and search threads ",-1)])]),_:1})])])]),_:1},8,["model-value","title"])}}}),ay={class:"flex h-full overflow-hidden"},oy={key:0,class:"flex flex-col items-center p-4"},ny={key:0,class:"flex flex-col items-center p-4"},ly={class:"flex-1 overflow-hidden flex flex-col min-h-0"},hr=ve({__name:"ThreadsView",setup(t){const o=ut(),a=bt(),i=p(typeof o.params.id=="string"?o.params.id:null),l=p({threadList:!1,messages:!1}),u=p(!1),s=p(null),m=p(null),{thread:h}=Qt(U(()=>i.value)),x=p(null),c=p(null),f=p(null),y=p(null),b=p(null),v=$=>{y.value=$,b.value=$},d=$=>{const V=g.value,te=_.value;if(!V||!te)return null;if(V.hasWorkblockForLogId($))return $;let B=$;const N=10;for(let F=0;F<N&&B;F++){const Y=te.getLog(B);if(!Y)break;const R=Y.parent_log_id;if(!R)break;if(V.hasWorkblockForLogId(R))return R;B=R}return null},k=$=>{if(y.value=$,!$){b.value=null;return}b.value=d($)??$},g=p(null),_=p(null);ge(()=>o.params.id,$=>{i.value=typeof $=="string"?$:null,x.value=null,c.value=null,f.value=null});const L=$=>{a.push(`/threads/${$}`)},O=$=>{window.location.href="/threads"},W=()=>{h.value&&(s.value=h.value,u.value=!0)},J=()=>{s.value=null,u.value=!0},z=$=>{m.value?.refetch(),a.push(`/threads/${$}`)},P=()=>{m.value?.refetch()},G=$=>{l.value[$]=!l.value[$]},ee=async($,V)=>{if(x.value=$,!V){c.value=null,f.value=null;return}const te=_.value;if(!te){c.value=V,f.value=V;return}const B=!te.hasLog(V);if(B&&te.setLoadingForLog(!0),c.value=V,f.value=V,B&&!await te.loadUntilLogId(V)){console.warn(`Could not find log ${V} after loading all available logs`),te.setLoadingForLog(!1);return}if(!await te.waitForLogRow(V)){console.warn(`Log row ${V} not rendered in time`);return}te.scrollToLog(V),te.selectLogById(V)},ue=$=>{c.value=$,x.value=null;const V=g.value;if(!V){f.value=$;return}if(V.scrollToLogId($)){f.value=$;return}const te=d($);te&&te!==$&&V.scrollToLogId(te),f.value=te??$},me=$=>{$&&(c.value=$)},Q=$=>{_.value?.removeLogsByIds($)},E=$=>{$&&!i.value&&a.push(`/threads/${$}`)};return($,V)=>(r(),n("div",ay,[e("div",{class:ne([l.value.threadList?"w-[60px]":"w-[320px]","border-r border-neutral-300 dark:border-neutral-700 flex-shrink-0 transition-all duration-200 flex flex-col min-h-0"])},[l.value.threadList?(r(),n("div",oy,[e("button",{onClick:V[0]||(V[0]=te=>G("threadList")),class:"p-2 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",title:"Expand Threads pane"},[w(S(Er),{size:20})])])):(r(),q(vv,{key:1,ref_key:"threadListPaneRef",ref:m,"selected-thread-id":i.value,onSelectThread:L,onCollapse:V[1]||(V[1]=te=>G("threadList")),onCreateThread:J,onThreadsLoaded:E},null,8,["selected-thread-id"]))],2),e("div",{class:ne([l.value.messages?"w-[60px]":"w-[380px]","border-r border-neutral-300 dark:border-neutral-700 flex-shrink-0 overflow-hidden transition-all duration-200 flex flex-col min-h-0"])},[l.value.messages?(r(),n("div",ny,[e("button",{onClick:V[2]||(V[2]=te=>G("messages")),class:"p-2 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",title:"Expand Messages pane"},[w(S(jr),{size:20})])])):i.value?(r(),q(S(xo),{key:1,"thread-id":i.value,preload:!0,live:!0,"include-silent":!0,"use-workblocks":!0},{default:j(()=>[w(vr,{ref_key:"messagesPaneRef",ref:g,"thread-id":i.value,"selected-message-id":x.value,"selected-log-id":f.value,"hovered-log-id":b.value,onCollapse:V[3]||(V[3]=te=>G("messages")),onMessageClick:ee,onMessageHover:v,onThreadDeleted:O,onEditThread:W,onLogsDeleted:Q,onThreadUpdated:P},null,8,["thread-id","selected-message-id","selected-log-id","hovered-log-id"])]),_:1},8,["thread-id"])):l.value.messages?T("",!0):(r(),q(vr,{key:2,ref_key:"messagesPaneRef",ref:g,"thread-id":null,"selected-message-id":x.value,"selected-log-id":f.value,"hovered-log-id":b.value,onCollapse:V[4]||(V[4]=te=>G("messages")),onMessageClick:ee,onMessageHover:v,onThreadDeleted:O,onEditThread:W,onLogsDeleted:Q,onThreadUpdated:P},null,8,["selected-message-id","selected-log-id","hovered-log-id"]))],2),e("div",ly,[w(Nx,{ref_key:"logsPaneRef",ref:_,"thread-id":i.value,"selected-log-id":c.value,"hovered-log-id":y.value,onLogClick:ue,onLogHover:k,onLogsLoaded:me},null,8,["thread-id","selected-log-id","hovered-log-id"])]),w(ry,{modelValue:u.value,"onUpdate:modelValue":V[5]||(V[5]=te=>u.value=te),"edit-thread":s.value,onThreadCreated:z,onThreadUpdated:P},null,8,["modelValue","edit-thread"])]))}}),sy=ve({__name:"PromptsDataTable",props:{title:{},description:{},primaryAction:{}},emits:["add","edit","delete"],setup(t,{expose:o,emit:a}){const i=a,l=p([]),u=p(!1),s=[{key:"name",label:"Name",width:"w-1/4",sortable:!0},{key:"tool_description",label:"Description",width:"w-2/5"},{key:"model_name",label:"Model",width:"w-1/5",sortable:!0,filterable:!0,formatter:(c,f)=>c||f.model_id||"-",filterIcon:(c,f)=>f.model_provider?`/api/providers/${f.model_provider}/icon?model=${encodeURIComponent(f.model_id||"")}`:void 0},{key:"created_at",label:"Created",width:"w-1/6",sortable:!0,searchable:!1,formatter:c=>c?new Date(c*1e3).toLocaleDateString():"-"}],m=[{icon:"edit",label:"Edit",handler:c=>i("edit",c)},{icon:"delete",label:"Delete",handler:async c=>{await x(c)},confirm:!0,confirmMessage:"Are you sure you want to delete this prompt?",variant:"danger"}],h=async()=>{u.value=!0;try{const c=await fetch(he("/api/prompts"));if(c.ok){const f=await c.json();l.value=f.prompts||[]}}catch(c){console.error("Error fetching prompts:",c)}finally{u.value=!1}},x=async c=>{try{const f=await fetch(he(`/api/prompts/${encodeURIComponent(c.id)}`),{method:"DELETE"});if(f.ok)await h();else{const y=await f.json();alert(y.error||"Failed to delete prompt")}}catch(f){console.error("Error deleting prompt:",f),alert("Failed to delete prompt")}};return Pe(()=>{h()}),o({refresh:h}),(c,f)=>(r(),n("div",null,[w(ot,{title:t.title,description:t.description,"primary-action":t.primaryAction,columns:s,data:l.value,actions:m,loading:u.value,sortable:"",searchable:"","search-placeholder":"Search prompts...","empty-message":"No prompts available. Create your first prompt to get started."},null,8,["title","description","primary-action","data","loading"])]))}}),iy={class:"space-y-4"},uy={key:0,class:"mt-1 text-sm text-red-500"},dy={key:1,class:"-mt-2 text-sm text-neutral-500 dark:text-neutral-400"},cy={class:"px-1 py-0.5 bg-neutral-100 dark:bg-neutral-800 rounded"},py=ve({__name:"PromptBasicInfo",props:{name:{},toolDescription:{}},emits:["update:name","update:toolDescription"],setup(t,{emit:o}){const a=t,i=o,l=p(""),u=m=>{let h=m.replace(/[^a-zA-Z0-9\s_]/g,"");return h=h.trim().toLowerCase().replace(/\s+/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,""),h?/^[a-z][a-z0-9_]*$/.test(h)?l.value="":l.value="Name must start with a letter and contain only lowercase letters, numbers, and underscores":l.value="Name is required",h},s=m=>{const h=u(m);i("update:name",h)};return ge(()=>a.name,m=>{m&&u(m)},{immediate:!0}),(m,h)=>{const x=Be("FormKit");return r(),n("div",iy,[w(x,{type:"text",value:t.name,onInput:s,label:"Prompt Name",placeholder:"Enter a unique name (will be converted to snake_case)","outer-class":"$reset"},null,8,["value"]),l.value?(r(),n("p",uy,C(l.value),1)):t.name?(r(),n("p",dy,[h[1]||(h[1]=X(" Will be saved as: ",-1)),e("code",cy,C(t.name),1)])):T("",!0),w(x,{type:"textarea",value:t.toolDescription,onInput:h[0]||(h[0]=c=>i("update:toolDescription",c)),label:"Tool Description",placeholder:"Describe what this prompt does (shown when used as a tool)",rows:"3","outer-class":"$reset"},null,8,["value"])])}}}),my={class:"space-y-4"},vy=ve({__name:"PromptModelSelect",props:{modelValue:{}},emits:["update:modelValue"],setup(t,{emit:o}){const a=o,i=p([]),l=p(!1),u=U(()=>i.value.map(m=>({value:m.id,label:m.name,description:m.model||m.provider,icon:m.provider?`/api/providers/${m.provider}/icon?model=${encodeURIComponent(m.model||"")}`:void 0}))),s=async()=>{l.value=!0;try{const m=await fetch(he("/api/models"));if(m.ok){const h=await m.json();i.value=h.models||[]}}catch(m){console.error("Error fetching models:",m)}finally{l.value=!1}};return Pe(()=>{s()}),(m,h)=>{const x=Be("FormKit");return r(),n("div",my,[w(x,{type:"selectSearch",value:t.modelValue,onInput:h[0]||(h[0]=c=>a("update:modelValue",c)),options:u.value,label:"Model",placeholder:"Select a model for this prompt","search-placeholder":"Search models...",loading:l.value,"outer-class":"$reset"},null,8,["value","options","loading"])])}}});function gr(t,o){if(!o||!o.properties||Object.keys(o.properties).length===0)return!0;if(!t||!t.properties)return Object.keys(o.properties);const a=[],i=t.properties||{},l=o.properties||{};return(o.required||[]).forEach(s=>{s in i||a.push(s)}),Object.keys(l).forEach(s=>{!(s in i)&&!a.includes(s)&&a.push(s)}),a.length>0?a:!0}function br(t){return t.length===0?"":t.length===1?`Missing required field: ${t[0]}`:`Missing required fields: ${t.join(", ")}`}const fy=ve({__name:"PromptTemplate",props:{promptText:{},beforeTool:{},afterTool:{},requiredSchema:{},currentPromptName:{}},emits:["update:promptText","update:beforeTool","update:afterTool"],setup(t,{emit:o}){const a=t,i=o,l=p([]),u=p(!1),s=y=>y.type==="text"?{type:"string",value:y.content||""}:y.type==="include"?{type:"prompt",id:y.prompt||"",label:y.prompt||""}:y.type==="string"?{type:"string",value:y.value||""}:y.type==="prompt"?{type:"prompt",id:y.id||"",label:y.label||y.id||""}:y.type==="variable"?{type:"variable",value:y.value||"",label:y.label||y.value||""}:{type:"string",value:""},m=U(()=>{if(!a.promptText)return[{type:"string",value:""}];let y=[];try{const v=JSON.parse(a.promptText);Array.isArray(v)?y=v.map(s):y=[{type:"string",value:a.promptText}]}catch{y=[{type:"string",value:a.promptText}]}const b=a.requiredSchema?JSON.parse(a.requiredSchema):{};return y.map(v=>{if(v.type==="prompt"&&v.schema){const d=gr(b,v.schema),k=d===!0,g=k?[]:d;return{...v,meta:{isValid:k,missingFields:g,validationMessage:k?"":br(g)}}}return v})}),h=U(()=>{try{const y=JSON.parse(a.requiredSchema);if(y.properties&&typeof y.properties=="object")return Object.keys(y.properties)}catch{return[]}return[]}),x=async y=>{u.value=!0;try{const b=new URLSearchParams;y&&b.set("search",y);const v=await fetch(he(`/api/prompts${b.toString()?"?"+b.toString():""}`));if(v.ok){const d=await v.json();l.value=d.prompts||[]}}catch(b){console.error("Error fetching prompts:",b)}finally{u.value=!1}},c=async y=>{const b=[];return h.value.forEach(v=>{(!y||v.toLowerCase().includes(y.toLowerCase()))&&b.push({type:"variable",value:v,label:v,description:"Schema property"})}),y!==void 0&&await x(y),l.value.forEach(v=>{if(!(a.currentPromptName&&v.name===a.currentPromptName)&&(!y||v.name.toLowerCase().includes(y.toLowerCase()))){const d=a.requiredSchema?JSON.parse(a.requiredSchema):{},k=gr(d,v.required_schema),g=k===!0,_=g?[]:k;b.push({type:"prompt",id:v.name,label:v.name,description:v.tool_description||"Available prompt",schema:v.required_schema,meta:{isValid:g,missingFields:_,validationMessage:g?"":br(_)}})}}),b},f=y=>{const b=y.map(v=>{const{type:d,value:k,label:g,id:_,schema:L}=v;return d==="string"?{type:d,value:k||""}:d==="variable"?{type:d,value:k||"",label:g}:d==="prompt"?{type:d,id:_||"",label:g,schema:L}:v});i("update:promptText",JSON.stringify(b))};return Pe(()=>{x()}),(y,b)=>(r(),n("div",null,[w(Gt,{"model-value":m.value,"onUpdate:modelValue":f,search:c,placeholder:"Enter your prompt template... Type @ to insert variables or prompts"},null,8,["model-value"])]))}}),hy={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function gy(t,o){return r(),n("svg",hy,[...o[0]||(o[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2a2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1m8 0h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"},null,-1)])])}const xr=Te({name:"lucide-braces",render:gy}),by={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function xy(t,o){return r(),n("svg",by,[...o[0]||(o[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10 5H3m9 14H3M14 3v4m2 10v4m5-9h-9m9 7h-5m5-14h-7m-6 5v4m0-2H3"},null,-1)])])}const yr=Te({name:"lucide-sliders-horizontal",render:xy}),yy={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function ky(t,o){return r(),n("svg",yy,[...o[0]||(o[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"},null,-1)])])}const kr=Te({name:"lucide-zap",render:ky}),wy={key:0,class:"min-h-[500px] flex items-center justify-center"},_y={class:"flex flex-1 min-h-0"},$y={class:"w-44 flex-shrink-0 border-r border-neutral-200 dark:border-neutral-700 py-4"},Cy={class:"space-y-4"},Sy={class:"space-y-5"},Ty={key:0,class:"mb-4 py-6 px-4 border border-dashed border-neutral-300 dark:border-neutral-600 rounded-lg text-center"},Iy={key:0,class:"space-y-2 mb-4"},zy={class:"flex-1 min-w-0"},Vy={class:"font-medium text-sm"},My={class:"text-xs text-neutral-500 dark:text-neutral-400"},Ey=["onClick","aria-label"],Ly={key:2,class:"py-6 px-4 border border-dashed border-neutral-300 dark:border-neutral-600 rounded-lg text-center"},Py={key:3,class:"text-center py-3 text-xs text-neutral-400 dark:text-neutral-500"},Ay={class:"mb-6"},jy={class:"grid grid-cols-2 gap-6 items-start"},Dy={class:"flex flex-col"},Oy={class:"space-y-4 mb-6 mt-6 pt-6 border-t border-neutral-100 dark:border-neutral-800"},Ry={class:"pt-6 border-t border-neutral-100 dark:border-neutral-800"},Uy={class:"grid grid-cols-2 gap-6 mb-4"},By={class:"flex justify-between items-center"},Fy={class:"flex items-center gap-3"},la=ve({__name:"PromptModal",props:{modelValue:{type:Boolean},editPrompt:{},mode:{}},emits:["update:modelValue","save"],setup(t,{emit:o}){const a=t,i=o,l=U(()=>a.mode==="edit"),u=p(!1),s=p(null),m=["basics","schema","prompt","tools","hooks","behavior"],{activeTab:h,scrollToSection:x}=ea(s,m),c=[{id:"basics",label:"Basics",icon:Lt},{id:"schema",label:"Schema",icon:xr},{id:"prompt",label:"Prompt",icon:Et},{id:"tools",label:"Tools",icon:qt},{id:"hooks",label:"Hooks",icon:kr},{id:"behavior",label:"Behavior",icon:yr}],f=U(()=>z.value.length===1),y=p(""),b=p(null),v=p(""),d=p(""),k=p(""),g=p({type:"object",properties:{},required:[],additionalProperties:!1}),_=p(""),L=p(!1),O=p(!1),W=p(""),J=p(""),z=p([]),P=p(!1),G=p(null),ee=p("auto"),ue=p(""),me=p(null),Q=p(!1),E=p(!1),$=p([]),V=p([]),te=p(""),B=U(()=>{const D=new Set($.value);return V.value.filter(Z=>!D.has(Z.id)).map(Z=>({value:Z.id,label:Z.id,attrs:{description:Z.hook}}))}),N=D=>{D&&($.value.includes(D)||($.value=[...$.value,D],Le(()=>{te.value=""})))},F=p(null),Y=p(!0),R=p(!1),H=D=>{F.value=D,D.on("commit",()=>{Y.value=D.context?.state.valid??!0,R.value=D.context?.state.submitted??!1})},M={sparkles:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z'/%3E%3Cpath d='M20 3v4'/%3E%3Cpath d='M22 5h-4'/%3E%3C/svg%3E",ban:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m4.9 4.9 14.2 14.2'/%3E%3C/svg%3E",checkCircle:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E",target:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Ccircle cx='12' cy='12' r='6'/%3E%3Ccircle cx='12' cy='12' r='2'/%3E%3C/svg%3E",signalNone:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Crect x='5' y='15' width='3' height='5' rx='1' fill='currentColor' opacity='0.2'/%3E%3Crect x='10.5' y='10' width='3' height='10' rx='1' fill='currentColor' opacity='0.2'/%3E%3Crect x='16' y='5' width='3' height='15' rx='1' fill='currentColor' opacity='0.2'/%3E%3C/svg%3E",signalLow:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Crect x='5' y='15' width='3' height='5' rx='1' fill='currentColor'/%3E%3Crect x='10.5' y='10' width='3' height='10' rx='1' fill='currentColor' opacity='0.2'/%3E%3Crect x='16' y='5' width='3' height='15' rx='1' fill='currentColor' opacity='0.2'/%3E%3C/svg%3E",signalMedium:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Crect x='5' y='15' width='3' height='5' rx='1' fill='currentColor'/%3E%3Crect x='10.5' y='10' width='3' height='10' rx='1' fill='currentColor'/%3E%3Crect x='16' y='5' width='3' height='15' rx='1' fill='currentColor' opacity='0.2'/%3E%3C/svg%3E",signalHigh:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Crect x='5' y='15' width='3' height='5' rx='1' fill='currentColor'/%3E%3Crect x='10.5' y='10' width='3' height='10' rx='1' fill='currentColor'/%3E%3Crect x='16' y='5' width='3' height='15' rx='1' fill='currentColor'/%3E%3C/svg%3E"},ie=U(()=>{const D=[{value:"auto",label:"Auto",description:"Model decides",icon:M.sparkles},{value:"none",label:"None",description:"No tools allowed",icon:M.ban},{value:"required",label:"Required",description:"Must call a tool",icon:M.checkCircle}];return f.value&&D.push({value:"function",label:"Function",description:"Call specific tool",icon:M.target}),D}),A=[{value:"",label:"None",description:"Disabled",icon:M.signalNone},{value:"low",label:"Low",description:"~20% of max_tokens",icon:M.signalLow},{value:"medium",label:"Medium",description:"~50% of max_tokens",icon:M.signalMedium},{value:"high",label:"High",description:"~80% of max_tokens",icon:M.signalHigh}],pe=()=>{v.value="",y.value="",d.value="",k.value="",b.value=null,g.value={type:"object",properties:{},required:[],additionalProperties:!1},_.value="",L.value=!1,O.value=!1,W.value="",J.value="",z.value=[],P.value=!1,ee.value="auto",ue.value="",me.value=null,Q.value=!1,E.value=!1,$.value=[]},ce=async D=>{if(!D){b.value=null;return}try{const Z=await Je(`/models/${encodeURIComponent(D)}`);if(Z.ok){const K=await Z.json();b.value=K.model||K}}catch(Z){console.error("Error fetching model info:",Z),b.value=null}};ge(k,async D=>{D?await ce(D):b.value=null});const ye=async()=>{try{const D=await Je("/hooks");if(D.ok){const Z=await D.json();V.value=Z.hooks||[]}}catch(D){console.error("Error fetching hooks:",D),V.value=[]}},Me=async()=>{if(a.editPrompt?.id){u.value=!0;try{const D=await Je(`/prompts/${encodeURIComponent(a.editPrompt.id)}`);if(D.ok){const Z=await D.json(),K=Z.prompt||Z;v.value=K.name||"",y.value=K.name||"",d.value=K.tool_description||"",k.value=K.model_id||"",K.model_id&&await ce(K.model_id);let oe=K.required_schema;if(typeof oe=="string")try{oe=JSON.parse(oe)}catch{oe=null}g.value=oe||{type:"object",properties:{},required:[],additionalProperties:!1},_.value=K.prompt||"",L.value=K.include_chat||!1,O.value=K.include_past_tools||!1,W.value=K.before_tool||"",J.value=K.after_tool||"";const se=K.tools||[];z.value=se.map(le=>typeof le=="string"?{name:le,include_text_response:!0,include_tool_calls:!0,include_errors:!0,init_user_message_property:null}:le),P.value=K.parallel_tool_calls||!1,ee.value=K.tool_choice||"auto";const be=K.reasoning||{};ue.value=be.effort||K.reasoning_effort||"",me.value=be.maxTokens||K.reasoning_max_tokens||null,Q.value=be.exclude||K.reasoning_exclude||!1,E.value=be.include||K.include_reasoning||!1,$.value=K.hooks||[]}}catch(D){console.error("Error loading prompt data:",D)}finally{u.value=!1}}},ae=async()=>{const D=/^[a-z][a-z0-9_]*$/;if(!v.value||!D.test(v.value)){alert("Please enter a valid name (lowercase letters, numbers, and underscores only, must start with a letter)");return}if(!d.value){alert("Please enter a description");return}if(!k.value){alert("Please select a model");return}if(!_.value){alert("Please enter the prompt template");return}G.value?.removeUnavailableTools();const Z={name:v.value,tool_description:d.value,prompt:_.value,required_schema:g.value,model_id:k.value,include_chat:L.value,include_past_tools:O.value,before_tool:W.value||null,after_tool:J.value||null,parallel_tool_calls:P.value,tool_choice:ee.value,tools:z.value,reasoning_effort:ue.value||null,reasoning_max_tokens:me.value,reasoning_exclude:Q.value,include_reasoning:E.value,hooks:$.value.length>0?$.value:null};l.value&&a.editPrompt?.id&&(Z.id=a.editPrompt.id,y.value&&y.value!==v.value&&(Z.originalName=y.value)),i("save",Z),pe(),i("update:modelValue",!1)},I=()=>{pe(),i("update:modelValue",!1)};return ge(()=>z.value.length,D=>{ee.value==="function"&&D!==1&&(ee.value="auto")}),ge(()=>a.modelValue,async D=>{D&&(await ye(),l.value?(pe(),await Le(),await Me()):pe())}),ge(()=>a.editPrompt,async D=>{D&&l.value&&a.modelValue&&(await ye(),await Le(),await Me())},{immediate:!0}),(D,Z)=>{const K=Be("FormKit");return r(),q(He,{"model-value":t.modelValue,"onUpdate:modelValue":Z[17]||(Z[17]=oe=>D.$emit("update:modelValue",oe)),title:l.value?"Edit Prompt":"Add Prompt",width:"max-w-5xl","content-padding":!1},{footer:j(()=>[e("div",By,[w(S(De),{variant:"ghost",size:"sm",onClick:I},{default:j(()=>[...Z[29]||(Z[29]=[X(" Cancel ",-1)])]),_:1}),e("div",Fy,[R.value&&!Y.value?(r(),q(S(tt),{key:0},{default:j(()=>[...Z[30]||(Z[30]=[X(" Please fix the errors above ",-1)])]),_:1})):T("",!0),w(S(De),{variant:"primary",size:"sm",disabled:u.value,loading:u.value,onClick:ae},{default:j(()=>[X(C(l.value?"Update Prompt":"Create Prompt"),1)]),_:1},8,["disabled","loading"])])])]),default:j(()=>[u.value?(r(),n("div",wy,[...Z[18]||(Z[18]=[e("span",{class:"text-neutral-500"},"Loading prompt data...",-1)])])):(r(),q(K,{key:1,type:"form",actions:!1,onNode:H,"form-class":"$reset flex-1 min-h-0 flex flex-col"},{default:j(()=>[e("div",_y,[e("nav",$y,[w(S(Qr),{tabs:c,"active-tab":S(h),onSelect:S(x)},null,8,["active-tab","onSelect"])]),e("div",{ref_key:"contentRef",ref:s,class:"flex-1 overflow-y-auto p-5 bg-neutral-100 dark:bg-neutral-950"},[e("div",Cy,[w(S(rt),{id:"section-basics",title:"Basics",icon:S(Lt)},{default:j(()=>[e("div",Sy,[w(py,{name:v.value,"onUpdate:name":Z[0]||(Z[0]=oe=>v.value=oe),"tool-description":d.value,"onUpdate:toolDescription":Z[1]||(Z[1]=oe=>d.value=oe)},null,8,["name","tool-description"]),w(vy,{modelValue:k.value,"onUpdate:modelValue":Z[2]||(Z[2]=oe=>k.value=oe)},null,8,["modelValue"])])]),_:1},8,["icon"]),w(S(rt),{id:"section-schema",title:"Schema",icon:S(xr)},{default:j(()=>[w(K,{type:"schemaEditor",modelValue:g.value,"onUpdate:modelValue":Z[3]||(Z[3]=oe=>g.value=oe),label:"","outer-class":"$reset"},null,8,["modelValue"])]),_:1},8,["icon"]),w(S(rt),{id:"section-prompt",title:"Prompt",icon:S(Et)},{footer:j(()=>[...Z[19]||(Z[19]=[e("p",{class:"text-xs text-neutral-500 dark:text-neutral-400"},[X(" Type "),e("kbd",{class:"px-1.5 py-0.5 rounded bg-neutral-200 dark:bg-neutral-700 font-mono text-xs"},"@"),X(" to insert schema properties or other prompts ")],-1)])]),default:j(()=>[w(fy,{"prompt-text":_.value,"onUpdate:promptText":Z[4]||(Z[4]=oe=>_.value=oe),"before-tool":W.value,"onUpdate:beforeTool":Z[5]||(Z[5]=oe=>W.value=oe),"after-tool":J.value,"onUpdate:afterTool":Z[6]||(Z[6]=oe=>J.value=oe),"required-schema":JSON.stringify(g.value,null,2),"current-prompt-name":l.value?v.value:void 0},null,8,["prompt-text","before-tool","after-tool","required-schema","current-prompt-name"])]),_:1},8,["icon"]),w(S(rt),{id:"section-tools",title:"Tools",icon:S(qt)},{default:j(()=>[z.value.length===0?(r(),n("div",Ty,[...Z[20]||(Z[20]=[e("p",{class:"text-sm text-neutral-500 dark:text-neutral-400"}," No tools selected. This prompt will run without tool access. ",-1)])])):T("",!0),w(Hr,{ref_key:"toolSelectorRef",ref:G,modelValue:z.value,"onUpdate:modelValue":Z[7]||(Z[7]=oe=>z.value=oe),"provider-id":b.value?.provider_id||b.value?.provider,"model-id":b.value?.model},null,8,["modelValue","provider-id","model-id"])]),_:1},8,["icon"]),w(S(rt),{id:"section-hooks",title:"Hooks",icon:S(kr)},{default:j(()=>[Z[23]||(Z[23]=e("p",{class:"text-sm text-neutral-500 dark:text-neutral-400 mb-4"}," Select hooks to run when this prompt is active. Hooks execute in the order listed. ",-1)),$.value.length>0?(r(),n("div",Iy,[(r(!0),n(fe,null,ke($.value,oe=>(r(),n("div",{key:oe,class:"flex items-center justify-between p-3 border border-neutral-300 dark:border-neutral-600 rounded-lg"},[e("div",zy,[e("div",Vy,C(oe),1),e("div",My,C(V.value.find(se=>se.id===oe)?.hook||"unknown"),1)]),e("button",{onClick:se=>$.value=$.value.filter(be=>be!==oe),type:"button",class:"p-1 hover:bg-neutral-200 dark:hover:bg-neutral-800 rounded transition-colors text-neutral-500 hover:text-red-500","aria-label":`Remove ${oe}`},[...Z[21]||(Z[21]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,Ey)]))),128))])):T("",!0),B.value.length>0?(r(),q(K,{key:1,type:"selectSearch",modelValue:te.value,"onUpdate:modelValue":Z[8]||(Z[8]=oe=>te.value=oe),onInput:N,placeholder:$.value.length>0?"Add another hook...":"Select a hook","search-placeholder":"Search hooks...",options:B.value,"outer-class":"$reset"},null,8,["modelValue","placeholder","options"])):T("",!0),V.value.length===0?(r(),n("div",Ly,[...Z[22]||(Z[22]=[e("p",{class:"text-sm text-neutral-500 dark:text-neutral-400"},[X(" No hooks available. Create hooks in "),e("code",{class:"px-1.5 py-0.5 rounded bg-neutral-200 dark:bg-neutral-700 font-mono text-xs"},"agents/hooks/"),X(" to enable them here. ")],-1)])])):B.value.length===0&&$.value.length>0?(r(),n("div",Py," All available hooks are selected. ")):T("",!0)]),_:1},8,["icon"]),w(S(rt),{id:"section-behavior",title:"Behavior",icon:S(yr)},{default:j(()=>[e("div",Ay,[w(S(xt),{title:"Tool Behavior",class:"mb-4"}),e("div",jy,[e("div",null,[w(K,{type:"selectSearch",modelValue:ee.value,"onUpdate:modelValue":Z[9]||(Z[9]=oe=>ee.value=oe),label:"Tool Choice",options:ie.value,placeholder:"Select tool choice","outer-class":"$reset"},null,8,["modelValue","options"]),w(S(Ie),{class:"mt-1"},{default:j(()=>[...Z[24]||(Z[24]=[X(" Controls whether and how the model can call tools ",-1)])]),_:1})]),e("div",Dy,[Z[26]||(Z[26]=e("div",{class:"h-7"},null,-1)),w(K,{type:"checkbox",modelValue:P.value,"onUpdate:modelValue":Z[10]||(Z[10]=oe=>P.value=oe),label:"Allow parallel tool calls","outer-class":"$reset"},null,8,["modelValue"]),w(S(Ie),{class:"mt-1"},{default:j(()=>[...Z[25]||(Z[25]=[X(" Allow the model to call multiple tools simultaneously ",-1)])]),_:1})])])]),e("div",Oy,[w(S(xt),{title:"Context"}),w(K,{type:"checkbox",modelValue:L.value,"onUpdate:modelValue":Z[11]||(Z[11]=oe=>L.value=oe),label:"Include chat history",help:"Expose chat history to the LLM when this prompt is used as a full prompt","outer-class":"$reset"},null,8,["modelValue"]),w(K,{type:"checkbox",modelValue:O.value,"onUpdate:modelValue":Z[12]||(Z[12]=oe=>O.value=oe),label:"Include past tool calls",help:"Include prior tool call history in this prompt","outer-class":"$reset"},null,8,["modelValue"]),w(K,{type:"checkbox",modelValue:E.value,"onUpdate:modelValue":Z[13]||(Z[13]=oe=>E.value=oe),label:"Include reasoning in history",help:"Include reasoning_details from previous responses","outer-class":"$reset"},null,8,["modelValue"])]),e("div",Ry,[w(S(xt),{title:"Reasoning",class:"mb-2"}),Z[28]||(Z[28]=e("p",{class:"text-xs text-neutral-500 dark:text-neutral-400 mb-4"}," Configure extended reasoning for models like o1, o3, Gemini Thinking, and others. Reasoning is enabled automatically when either field is set. ",-1)),e("div",Uy,[e("div",null,[w(K,{type:"selectSearch",modelValue:ue.value,"onUpdate:modelValue":Z[14]||(Z[14]=oe=>ue.value=oe),label:"Reasoning Effort",options:A,placeholder:"Select reasoning effort","outer-class":"$reset"},null,8,["modelValue"]),w(S(Ie),{class:"mt-1"},{default:j(()=>[...Z[27]||(Z[27]=[X(" Controls reasoning capacity. Supported by OpenAI o-series and Grok. ",-1)])]),_:1})]),w(K,{type:"unit",modelValue:me.value,"onUpdate:modelValue":Z[15]||(Z[15]=oe=>me.value=oe),label:"Max Reasoning Tokens",min:0,step:1,decimals:0,validation:"min:1024|max:32000","validation-messages":{min:"Recommended minimum is 1,024 tokens",max:"Recommended maximum is 32,000 tokens"},"validation-visibility":"live",placeholder:"Leave empty to disable",help:"Specify reasoning token limit (1024-32000)","outer-class":"$reset"},null,8,["modelValue"])]),w(K,{type:"checkbox",modelValue:Q.value,"onUpdate:modelValue":Z[16]||(Z[16]=oe=>Q.value=oe),label:"Exclude reasoning from response",help:"Use reasoning internally but don't return it in the response (saves tokens and cost)","outer-class":"$reset"},null,8,["modelValue"])])]),_:1},8,["icon"])])],512)])]),_:1}))]),_:1},8,["model-value","title"])}}}),Ny=ve({__name:"PromptsView",setup(t){const o=bt(),a=ut(),i=p(!1),l=p(null);ge(()=>a.query.refresh,()=>{a.query.refresh&&(l.value?.refresh(),o.replace({path:"/prompts",query:{}}))});const u=()=>{i.value=!0},s=h=>{o.push(`/prompts/${h.id}`)},m=async h=>{try{const x=await fetch(he("/api/prompts"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)});if(x.ok)i.value=!1,await new Promise(c=>setTimeout(c,100)),await l.value?.refresh();else{const c=await x.json();alert(c.error||"Failed to create prompt")}}catch(x){console.error("Error creating prompt:",x),alert("Failed to create prompt")}};return(h,x)=>(r(),q(pt,null,{default:j(()=>[w(sy,{ref_key:"dataTableRef",ref:l,title:"Prompts",description:"Define and manage prompt templates for your agents.","primary-action":{label:"Create Prompt",icon:S(jt),handler:u},onAdd:u,onEdit:s},null,8,["primary-action"]),w(la,{modelValue:i.value,"onUpdate:modelValue":x[0]||(x[0]=c=>i.value=c),mode:"add",onSave:m},null,8,["modelValue"])]),_:1}))}}),qy={class:"p-8"},Hy={key:0,class:"flex items-center justify-center min-h-[400px]"},Wy={key:2,class:"flex items-center justify-center min-h-[400px]"},Ky=ve({__name:"PromptEditView",setup(t){const o=bt(),a=ut(),i=p(!0),l=p(null),u=p(!0),s=async()=>{const x=a.params.id;if(!x){o.push("/prompts");return}u.value=!0;try{const c=await fetch(he(`/api/prompts/${encodeURIComponent(x)}`));if(c.ok){const f=await c.json();l.value=f.prompt||f}else alert("Prompt not found"),o.push("/prompts")}catch(c){console.error("Error loading prompt:",c),alert("Failed to load prompt"),o.push("/prompts")}finally{u.value=!1}},m=async x=>{try{const{originalName:c,...f}=x,y=c||f.id,b=await fetch(he(`/api/prompts/${encodeURIComponent(y)}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(b.ok)o.push({path:"/prompts",query:{refresh:Date.now().toString()}});else{const v=await b.json();alert(v.error||"Failed to update prompt")}}catch(c){console.error("Error updating prompt:",c),alert("Failed to update prompt")}},h=x=>{x||o.push("/prompts")};return Pe(()=>{s()}),ge(i,x=>{x||o.push("/prompts")}),(x,c)=>(r(),n("div",qy,[u.value?(r(),n("div",Hy,[...c[1]||(c[1]=[e("span",{class:"text-neutral-500"},"Loading prompt...",-1)])])):l.value?(r(),q(la,{key:1,modelValue:i.value,"onUpdate:modelValue":[c[0]||(c[0]=f=>i.value=f),h],mode:"edit","edit-prompt":l.value,onSave:m},null,8,["modelValue","edit-prompt"])):(r(),n("div",Wy,[...c[2]||(c[2]=[e("span",{class:"text-neutral-500"},"Prompt not found",-1)])]))]))}}),Jy={class:"space-y-4"},Yy={key:0},Gy={key:1},Zy={class:"px-1 py-0.5 bg-neutral-100 dark:bg-neutral-800 rounded"},Xy={key:2,class:"space-y-3"},Qy={class:"flex items-center justify-between"},ek={key:0,class:"text-sm text-neutral-500 dark:text-neutral-400"},tk={key:1,class:"space-y-3"},rk={class:"grid grid-cols-2 gap-x-4 gap-y-2"},ak={class:"grid grid-cols-2 gap-4"},ok={key:3,class:"space-y-3"},nk={key:0,class:"text-sm text-neutral-500 dark:text-neutral-400"},lk={key:1,class:"grid grid-cols-1 gap-2"},sk=["value"],ik={class:"flex-1 min-w-0"},uk={class:"font-medium text-sm"},dk={class:"text-xs text-neutral-500 dark:text-neutral-400 mt-0.5"},ck={key:0,class:"mt-1"},pk={class:"text-xs text-amber-600 dark:text-amber-400"},mk={key:4,class:"space-y-3"},vk={class:"flex items-center justify-between"},fk={key:0,class:"flex gap-2"},hk={key:0,class:"flex items-center gap-2 py-4"},gk={key:1,class:"py-4 text-sm text-neutral-500 dark:text-neutral-400"},bk={key:2,class:"space-y-2"},xk=["checked","onChange"],yk={class:"flex-1 min-w-0"},kk={class:"flex items-center gap-2"},wk={class:"font-medium text-sm"},_k={key:0,class:"px-1.5 py-0.5 text-xs font-medium rounded bg-neutral-100 dark:bg-neutral-800 text-neutral-600 dark:text-neutral-400"},$k={class:"flex flex-wrap gap-x-4 gap-y-1 mt-1 text-xs text-neutral-500 dark:text-neutral-400"},Ck={key:0},Sk={key:1},Tk={key:5,class:"space-y-3"},Ik={class:"flex items-center justify-between gap-4"},zk={key:1},Vk={class:"flex gap-2"},Mk=ve({__name:"ModelModal",props:{modelValue:{type:Boolean},editModel:{},mode:{default:"add"}},emits:["update:modelValue","save"],setup(t,{emit:o}){const a=t,i=o,l=p([]),u=p(""),s=p(""),m=p([]),h=p(!1),x=p(!1),c=p([]),f=p([]),y=p(!1),b=p({supportsImages:!1,supportsToolCalls:!0,supportsStreaming:!0,supportsJsonMode:!0}),v=p(null),d=p(!1),k=p([]),g=p([]),_=p(!1),L=p([]),O=p(!1),W=U(()=>L.value.map(le=>({value:le.id,label:le.name,description:le.provider_id||le.provider,icon:le.iconId}))),J=async()=>{O.value=!0;try{const le=await fetch(he("/api/models"));if(le.ok){const de=await le.json();L.value=de.models||[]}}catch(le){console.error("Error fetching configured models:",le)}finally{O.value=!1}},z=p([]),P=U(()=>a.mode==="edit"),G=p(null),ee=p(!0),ue=p(!1),me=le=>{G.value=le,le.on("commit",()=>{ee.value=le.context?.state.valid??!0,ue.value=le.context?.state.submitted??!1})},Q=p(""),E=p(""),$=le=>{let de=le.replace(/[^a-zA-Z0-9\s_-]/g,"");return de=de.trim().toLowerCase().replace(/[\s-]+/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,""),de},V=le=>{E.value=$(le)},te=p(!1),B=p(null),N=U(()=>l.value.filter(le=>le.hasApiKey).map(le=>({value:le.name,label:le.name,description:le.sdk==="openai-sdk"?"OpenAI SDK":le.sdk==="openrouter"?"OpenRouter":le.sdk,icon:le.iconId}))),F=U(()=>m.value.map(le=>({...le,icon:le.iconId}))),Y=U(()=>!P.value||!B.value||te.value?!1:E.value!==B.value.name||u.value!==B.value.provider||s.value!==B.value.model||JSON.stringify(f.value.sort())!==JSON.stringify(B.value.endpoints.sort())||JSON.stringify(z.value)!==JSON.stringify(B.value.fallbacks)||JSON.stringify(b.value)!==JSON.stringify(B.value.capabilities)||JSON.stringify(g.value.sort())!==JSON.stringify(B.value.providerTools.sort())),R=U(()=>l.value.find(de=>de.name===u.value)?.sdk==="openrouter"),H=async()=>{h.value=!0;try{const le=await fetch(he("/api/providers"));if(le.ok){const de=await le.json();l.value=de.providers||[]}}catch(le){console.error("Error fetching providers:",le)}finally{h.value=!1}},M=async()=>{if(!u.value){m.value=[];return}x.value=!0;try{const le=await fetch(he("/api/models/available"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:u.value})});if(le.ok){const de=await le.json();m.value=de.models||[]}else{const de=await le.json();console.error("Error fetching models:",de),m.value=[],alert(de.error||"Failed to fetch available models")}}catch(le){console.error("Error fetching models:",le),m.value=[]}finally{x.value=!1}},ie=async()=>{if(!(!u.value||!s.value)){d.value=!0;try{const le=await fetch(he("/api/models/capabilities"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:u.value,modelId:s.value})});if(le.ok){const de=await le.json();de.capabilities&&(v.value=de.capabilities,b.value={supportsImages:de.capabilities.supportsImages??!1,supportsToolCalls:de.capabilities.supportsToolCalls??!0,supportsStreaming:de.capabilities.supportsStreaming??!0,supportsJsonMode:de.capabilities.supportsJsonMode??!0,maxContextTokens:de.capabilities.maxContextTokens,maxOutputTokens:de.capabilities.maxOutputTokens})}}catch(le){console.error("Error fetching capabilities:",le)}finally{d.value=!1}}},A=async()=>{if(!u.value||!s.value){k.value=[];return}_.value=!0;try{const le=await fetch(he(`/api/providers/${u.value}/tools?model=${encodeURIComponent(s.value)}`));if(le.ok){const de=await le.json();k.value=de.tools||[],P.value||(g.value=k.value.map(ze=>ze.name))}else k.value=[]}catch(le){console.error("Error fetching provider tools:",le),k.value=[]}finally{_.value=!1}},pe=()=>{b.value={supportsImages:!1,supportsToolCalls:!0,supportsStreaming:!0,supportsJsonMode:!0},v.value=null},ce=le=>{const de=f.value.indexOf(le);de===-1?f.value.push(le):f.value.splice(de,1)},ye=()=>{f.value=c.value.map(le=>le.id)},Me=()=>{f.value=[]},ae=le=>{const de=le*1e6;return de>=1?`$${de.toFixed(2)}/M`:`$${de.toFixed(4)}/M`},I=()=>{v.value&&(b.value={supportsImages:v.value.supportsImages??!1,supportsToolCalls:v.value.supportsToolCalls??!0,supportsStreaming:v.value.supportsStreaming??!0,supportsJsonMode:v.value.supportsJsonMode??!0,maxContextTokens:v.value.maxContextTokens,maxOutputTokens:v.value.maxOutputTokens})},D=()=>{E.value="",Q.value="",u.value="",s.value="",m.value=[],z.value=[],c.value=[],f.value=[],k.value=[],g.value=[],pe(),B.value=null,te.value=!1,ee.value=!0,ue.value=!1,G.value?.reset()},Z=async()=>{if(a.editModel){te.value=!0;try{await H(),E.value=a.editModel.name||"",Q.value=a.editModel.name||"",u.value=a.editModel.provider_id||a.editModel.provider,await M(),s.value=a.editModel.model,await oe(),a.editModel.included_providers&&a.editModel.included_providers.length>0&&(f.value=a.editModel.included_providers),await K(),a.editModel.capabilities?b.value={supportsImages:a.editModel.capabilities.supportsImages??!1,supportsToolCalls:a.editModel.capabilities.supportsToolCalls??!0,supportsStreaming:a.editModel.capabilities.supportsStreaming??!0,supportsJsonMode:a.editModel.capabilities.supportsJsonMode??!0,maxContextTokens:a.editModel.capabilities.maxContextTokens,maxOutputTokens:a.editModel.capabilities.maxOutputTokens}:await ie(),await A(),a.editModel.providerTools&&Array.isArray(a.editModel.providerTools)&&(g.value=a.editModel.providerTools),B.value={name:E.value,provider:u.value,model:s.value,endpoints:[...f.value],fallbacks:[...z.value],capabilities:{...b.value},providerTools:[...g.value]}}finally{te.value=!1}}};ge(()=>a.modelValue,async le=>{le?(J(),P.value&&a.editModel?await Z():(await H(),D())):D()});const K=async()=>{if(a.editModel?.id){if(a.editModel.fallbacks&&Array.isArray(a.editModel.fallbacks)){z.value=a.editModel.fallbacks.map(le=>typeof le=="string"?le:le.id);return}try{const le=await fetch(he(`/api/models/${encodeURIComponent(a.editModel.id)}/fallbacks`));if(le.ok){const de=await le.json();z.value=de.fallbacks.map(ze=>ze.fallback_model_id)}}catch(le){console.error("Error loading fallbacks:",le)}}};ge(u,async(le,de)=>{te.value||P.value&&!de&&le===(a.editModel?.provider_id||a.editModel?.provider)||(s.value="",c.value=[],f.value=[],u.value&&await M())});const oe=async()=>{if(!s.value||!u.value){c.value=[];return}const le=l.value.find(ze=>ze.name===u.value);if(!le||le.sdk!=="openrouter"){c.value=[];return}const de=F.value.find(ze=>ze.value===s.value);if(!de?.slug){console.error("Model slug not found"),c.value=[];return}y.value=!0;try{const ze=await fetch(he("/api/models/endpoints"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:u.value,modelSlug:de.slug})});if(ze.ok){const we=await ze.json();c.value=we.endpoints||[],P.value||(f.value=c.value.map(_e=>_e.id))}else{const we=await ze.json();console.error("Error fetching endpoints:",we),c.value=[]}}catch(ze){console.error("Error fetching endpoints:",ze),c.value=[]}finally{y.value=!1}};ge(s,async(le,de)=>{te.value||P.value&&!de&&le===a.editModel?.model||(s.value?(await oe(),await ie(),await A(),de&&le!==de&&(f.value=c.value.map(ze=>ze.id))):(c.value=[],f.value=[],k.value=[],g.value=[],pe()))});const se=()=>{const le=R.value?f.value:[],de={name:E.value,model:s.value,provider:u.value,included_providers:le,fallbacks:z.value,capabilities:b.value,providerTools:g.value};P.value&&a.editModel?.id&&(de.id=a.editModel.id,Q.value&&Q.value!==E.value&&(de.originalName=Q.value)),i("save",de)},be=()=>{D(),i("update:modelValue",!1)};return(le,de)=>{const ze=Be("FormKit");return r(),q(He,{"model-value":t.modelValue,"onUpdate:modelValue":de[10]||(de[10]=we=>le.$emit("update:modelValue",we)),title:P.value?"Edit Model":"Add Model",width:"max-w-2xl","min-height":"min-h-[36rem]","has-changes":Y.value},{footer:j(()=>[e("div",Ik,[ue.value&&!ee.value?(r(),q(S(tt),{key:0},{default:j(()=>[...de[22]||(de[22]=[X(" Please fix the errors above before submitting. ",-1)])]),_:1})):(r(),n("div",zk)),e("div",Vk,[w(S(De),{variant:"ghost",size:"sm",onClick:be},{default:j(()=>[...de[23]||(de[23]=[X(" Cancel ",-1)])]),_:1}),w(S(De),{variant:"primary",size:"sm",type:"submit",form:"model-form"},{default:j(()=>[X(C(P.value?"Update Model":"Add Model"),1)]),_:1})])])]),default:j(()=>[w(ze,{type:"form",id:"model-form",actions:!1,onSubmit:se,onNode:me},{default:j(()=>[e("div",Jy,[w(ze,{type:"selectSearch",modelValue:u.value,"onUpdate:modelValue":de[0]||(de[0]=we=>u.value=we),options:N.value,label:"Provider",placeholder:"Select a provider",disabled:h.value||P.value&&!!a.editModel,validation:"required","validation-visibility":"submit"},null,8,["modelValue","options","disabled"]),u.value?(r(),n("div",Yy,[w(ze,{type:"selectSearch",modelValue:s.value,"onUpdate:modelValue":de[1]||(de[1]=we=>s.value=we),options:F.value,label:"Model",placeholder:"Select a model","search-placeholder":"Search models...",loading:x.value,validation:"required","validation-visibility":"submit"},null,8,["modelValue","options","loading"])])):T("",!0),s.value?(r(),n("div",Gy,[w(ze,{type:"text","model-value":E.value,onInput:V,label:"Name",placeholder:"e.g., coding_model, planning_model, fast_response",validation:"required|snakeCase","validation-visibility":"blur",help:E.value?void 0:"A descriptive name for this model. This becomes the filename and reference ID."},null,8,["model-value","help"]),E.value?(r(),q(S(Ie),{key:0,class:"mt-1"},{default:j(()=>[de[11]||(de[11]=X(" Will be saved as: ",-1)),e("code",Zy,C(E.value),1)]),_:1})):T("",!0)])):T("",!0),s.value?(r(),n("div",Xy,[e("div",Qy,[de[12]||(de[12]=e("label",{class:"block text-sm font-medium"},"Model Capabilities",-1)),v.value?(r(),n("button",{key:0,onClick:I,type:"button",class:"text-xs text-accent-600 dark:text-accent-400 hover:underline"}," Reset to detected ")):T("",!0)]),de[13]||(de[13]=e("p",{class:"text-xs text-neutral-500 dark:text-neutral-400 -mt-1"}," Auto-detected from the provider. Override if needed. ",-1)),d.value?(r(),n("div",ek," Detecting capabilities... ")):(r(),n("div",tk,[e("div",rk,[w(ze,{type:"checkbox",modelValue:b.value.supportsImages,"onUpdate:modelValue":de[2]||(de[2]=we=>b.value.supportsImages=we),label:"Vision/Images"},null,8,["modelValue"]),w(ze,{type:"checkbox",modelValue:b.value.supportsToolCalls,"onUpdate:modelValue":de[3]||(de[3]=we=>b.value.supportsToolCalls=we),label:"Tool Calls"},null,8,["modelValue"]),w(ze,{type:"checkbox",modelValue:b.value.supportsStreaming,"onUpdate:modelValue":de[4]||(de[4]=we=>b.value.supportsStreaming=we),label:"Streaming"},null,8,["modelValue"]),w(ze,{type:"checkbox",modelValue:b.value.supportsJsonMode,"onUpdate:modelValue":de[5]||(de[5]=we=>b.value.supportsJsonMode=we),label:"JSON Mode"},null,8,["modelValue"])]),e("div",ak,[w(ze,{type:"unit",modelValue:b.value.maxContextTokens,"onUpdate:modelValue":de[6]||(de[6]=we=>b.value.maxContextTokens=we),label:"Max Context Tokens",placeholder:"e.g., 128,000",unit:"",decimals:"0",step:"1000",min:"0"},null,8,["modelValue"]),w(ze,{type:"unit",modelValue:b.value.maxOutputTokens,"onUpdate:modelValue":de[7]||(de[7]=we=>b.value.maxOutputTokens=we),label:"Max Output Tokens",placeholder:"e.g., 16,384",unit:"",decimals:"0",step:"1000",min:"0"},null,8,["modelValue"])])]))])):T("",!0),s.value&&k.value.length>0?(r(),n("div",ok,[de[14]||(de[14]=e("label",{class:"block text-sm font-medium"},"Provider Tools",-1)),de[15]||(de[15]=e("p",{class:"text-xs text-neutral-500 dark:text-neutral-400 -mt-1"}," Built-in tools available for this model. ",-1)),_.value?(r(),n("div",nk," Loading provider tools... ")):(r(),n("div",lk,[(r(!0),n(fe,null,ke(k.value,we=>(r(),n("label",{key:we.name,class:ne(["flex items-start gap-3 p-3 border rounded cursor-pointer hover:bg-neutral-50 dark:hover:bg-neutral-800/50 transition-colors",g.value.includes(we.name)?"border-black dark:border-white":"border-neutral-200 dark:border-neutral-700"])},[Ae(e("input",{type:"checkbox",value:we.name,"onUpdate:modelValue":de[8]||(de[8]=_e=>g.value=_e),class:"mt-0.5 h-4 w-4 rounded border-neutral-300 dark:border-neutral-600 text-black dark:text-white focus:ring-black dark:focus:ring-white accent-black dark:accent-white"},null,8,sk),[[Jt,g.value]]),e("div",ik,[e("div",uk,C(we.name),1),e("div",dk,C(we.description),1),we.tenvs&&we.tenvs.length>0?(r(),n("div",ck,[e("span",pk," Requires: "+C(we.tenvs.filter(_e=>_e.required).map(_e=>_e.name).join(", ")||"none (optional config available)"),1)])):T("",!0)])],2))),128))]))])):T("",!0),s.value&&R.value?(r(),n("div",mk,[e("div",vk,[de[17]||(de[17]=e("label",{class:"block text-sm font-medium"},"Available Providers",-1)),c.value.length>0?(r(),n("div",fk,[e("button",{type:"button",onClick:ye,class:"text-xs text-accent-600 dark:text-accent-400 hover:underline"}," Select all "),de[16]||(de[16]=e("span",{class:"text-xs text-neutral-300 dark:text-neutral-600"},"|",-1)),e("button",{type:"button",onClick:Me,class:"text-xs text-accent-600 dark:text-accent-400 hover:underline"}," Clear ")])):T("",!0)]),de[19]||(de[19]=e("p",{class:"text-xs text-neutral-500 dark:text-neutral-400 -mt-1"}," OpenRouter routes to the cheapest available provider. ",-1)),y.value?(r(),n("div",hk,[w(Ee,{class:"w-4 h-4"}),de[18]||(de[18]=e("span",{class:"text-sm text-neutral-500 dark:text-neutral-400"},"Loading providers...",-1))])):c.value.length===0?(r(),n("div",gk," No providers available for this model ")):(r(),n("div",bk,[(r(!0),n(fe,null,ke(c.value,we=>(r(),n("label",{key:we.id,class:ne(["flex items-start gap-3 p-3 border rounded-md cursor-pointer transition-colors",[f.value.includes(we.id)?"border-accent-500 dark:border-accent-400 bg-accent-50/50 dark:bg-accent-900/20":"border-neutral-200 dark:border-neutral-700 hover:border-neutral-300 dark:hover:border-neutral-600"]])},[e("input",{type:"checkbox",checked:f.value.includes(we.id),onChange:_e=>ce(we.id),class:"mt-0.5 h-4 w-4 rounded border-neutral-300 dark:border-neutral-600 text-accent-600 dark:text-accent-500 focus:ring-accent-500 dark:focus:ring-accent-400 accent-accent-600 dark:accent-accent-500"},null,40,xk),e("div",yk,[e("div",kk,[e("span",wk,C(we.name),1),we.quantization&&we.quantization!=="unknown"?(r(),n("span",_k,C(we.quantization),1)):T("",!0)]),e("div",$k,[e("span",null," Input: "+C(ae(we.pricing.prompt)),1),e("span",null," Output: "+C(ae(we.pricing.completion)),1),we.maxPromptTokens?(r(),n("span",Ck," Max prompt: "+C(we.maxPromptTokens.toLocaleString()),1)):T("",!0),we.maxCompletionTokens?(r(),n("span",Sk," Max output: "+C(we.maxCompletionTokens.toLocaleString()),1)):T("",!0)])])],2))),128))]))])):T("",!0),s.value?(r(),n("div",Tk,[de[20]||(de[20]=e("label",{class:"block text-sm font-medium"},"Fallback Models",-1)),de[21]||(de[21]=e("p",{class:"text-xs text-neutral-500 dark:text-neutral-400 -mt-1"}," Used in order if the primary model fails. ",-1)),w(ze,{type:"sortableMultiSelect",modelValue:z.value,"onUpdate:modelValue":de[9]||(de[9]=we=>z.value=we),options:W.value,loading:O.value,placeholder:"Add fallback model...","search-placeholder":"Search models...","add-label":"Add another model"},null,8,["modelValue","options","loading"])])):T("",!0)])]),_:1})]),_:1},8,["model-value","title","has-changes"])}}}),Ek={class:"flex items-center gap-2"},Lk=["src","alt"],Pk={class:"text-sm text-neutral-600 dark:text-neutral-400 font-mono"},Ak={key:0,class:"space-y-0.5"},jk=["title"],Dk={class:"shrink-0 font-mono pr-2"},Ok=["src","alt"],Rk={class:"truncate"},Uk={key:1,class:"text-neutral-400 dark:text-neutral-600 text-sm"},Bk=ve({__name:"ModelsView",setup(t){const o=p(!1),a=p([]),i=p(!1),l=p(null),u=p("add"),s=[{key:"name",label:"Name",width:"w-1/4",sortable:!0},{key:"model",label:"Model",width:"w-1/4",sortable:!0,filterable:!0,filterIcon:(y,b)=>`/api/providers/${b.provider}/icon?model=${encodeURIComponent(b.model||"")}`},{key:"provider",label:"Provider",width:"w-1/4",sortable:!0,filterable:!0,filterIcon:(y,b)=>`/api/providers/${b.provider}/icon`},{key:"fallbacks",label:"Fallbacks",width:"w-1/4"}],m=[{icon:"edit",label:"Edit",handler:y=>{l.value=y,u.value="edit",o.value=!0}},{icon:"delete",label:"Delete",confirm:!0,confirmMessage:"Are you sure you want to delete this model? This action cannot be undone.",variant:"danger",handler:async y=>{await c(y.id)}}],h=async()=>{i.value=!0;try{const y=await fetch(he("/api/models"));if(!y.ok)throw new Error("Failed to fetch models");const b=await y.json();a.value=b.models||[]}catch(y){console.error("Error fetching models:",y),a.value=[]}finally{i.value=!1}},x=async y=>{try{if(l.value){const{originalName:b,...v}=y,d=b||l.value.id,k=await fetch(he(`/api/models/${encodeURIComponent(d)}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)});if(!k.ok){const g=await k.json();alert(g.error||"Failed to update model");return}}else{const b=await fetch(he("/api/models"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(y)});if(!b.ok){const v=await b.json();alert(v.error||"Failed to add model");return}}await h(),o.value=!1,l.value=null,u.value="add"}catch(b){console.error("Error saving model:",b),alert("Failed to save model")}},c=async y=>{try{const b=await fetch(he(`/api/models/${encodeURIComponent(y)}`),{method:"DELETE"});if(!b.ok){const v=await b.json();alert(v.error||"Failed to delete model");return}await h()}catch(b){console.error("Error deleting model:",b),alert("Failed to delete model")}},f=()=>{u.value="add",l.value=null,o.value=!0};return Pe(()=>{h()}),(y,b)=>(r(),q(pt,null,{default:j(()=>[w(ot,{title:"Models",description:"Configure AI models from your connected providers. Models define which AI capabilities are available to your agents.","primary-action":{label:"Add Model",icon:S(jt),handler:f},columns:s,data:a.value,actions:m,loading:i.value,sortable:"",searchable:"","search-placeholder":"Search models...","empty-message":"No models configured yet. Add your first model to get started."},{"cell-name":j(({value:v,row:d})=>[e("div",Ek,[d.provider?(r(),n("img",{key:0,src:`/api/providers/${d.provider}/icon?model=${encodeURIComponent(d.model||"")}`,class:"w-5 h-5 shrink-0",alt:d.provider},null,8,Lk)):T("",!0),e("span",null,C(v),1)])]),"cell-model":j(({value:v})=>[e("span",Pk,C(v||"—"),1)]),"cell-fallbacks":j(({value:v})=>[v&&v.length>0?(r(),n("div",Ak,[(r(!0),n(fe,null,ke(v,(d,k)=>(r(),n("div",{key:d.id,class:"text-sm text-neutral-600 dark:text-neutral-400 flex items-center",title:d.name},[e("span",Dk,C(k===v.length-1?"└─":"├─"),1),d.provider?(r(),n("img",{key:0,src:`/api/providers/${d.provider}/icon?model=${encodeURIComponent(d.model||"")}`,class:"w-4 h-4 shrink-0 mr-1.5",alt:d.provider},null,8,Ok)):T("",!0),e("span",Rk,C(d.name),1)],8,jk))),128))])):(r(),n("span",Uk," None "))]),_:1},8,["primary-action","data","loading"]),w(Mk,{modelValue:o.value,"onUpdate:modelValue":[b[0]||(b[0]=v=>o.value=v),b[1]||(b[1]=v=>{o.value=v,v||(l.value=null,u.value="add")})],"edit-model":l.value,mode:u.value,onSave:x},null,8,["modelValue","edit-model","mode"])]),_:1}))}}),Fk={class:"space-y-4"},Nk={class:"space-y-1"},qk={class:"relative"},Hk={key:0,class:"flex items-center gap-2"},Wk=["src","alt"],Kk={key:1,class:"text-neutral-500"},Jk={key:0,class:"absolute z-10 w-full mt-1 bg-white dark:bg-black border-2 border-neutral-300 dark:border-neutral-600 rounded shadow-lg max-h-60 overflow-auto"},Yk=["onClick"],Gk=["src","alt"],Zk={key:0,class:"text-xs text-red-500 dark:text-red-400"},Xk={class:"flex gap-2 justify-end"},Qk=ve({__name:"AddProviderModal",props:{modelValue:{type:Boolean}},emits:["update:modelValue","save"],setup(t,{emit:o}){const a=o,i=p([]),l=p(!1),u=p(!1),s=p(""),m=p(""),h=async()=>{l.value=!0;try{const k=await fetch(he("/api/providers"));if(k.ok){const g=await k.json();i.value=(g.providers||[]).map(_=>({value:_.name,label:_.label||_.name,icon:_.iconId,sdk:_.sdk}))}}catch(k){console.error("Error fetching providers:",k)}finally{l.value=!1}};Pe(()=>{h()});const x=U(()=>i.value.find(k=>k.value===s.value)),c=()=>{setTimeout(()=>{u.value=!1},200)},f=k=>{s.value=k,u.value=!1,m.value=""},y=U(()=>s.value==="custom"||s.value==="openai"),b=p("");ge(s,k=>{if(k&&!b.value){const g=i.value.find(_=>_.value===k);g&&(b.value=g.label)}});const v=k=>{if(!s.value){m.value="Provider type is required";return}a("save",{name:k.name,type:s.value,apiKey:k.apiKey,baseUrl:k.baseUrl}),d()},d=()=>{Mt("add-provider-form"),s.value="",b.value="",m.value="",a("update:modelValue",!1)};return(k,g)=>{const _=Be("FormKit");return r(),q(He,{"model-value":t.modelValue,"onUpdate:modelValue":g[2]||(g[2]=L=>k.$emit("update:modelValue",L)),title:"Add Provider",width:"max-w-md"},{footer:j(()=>[e("div",Xk,[w(S(De),{variant:"ghost",size:"sm",onClick:d},{default:j(()=>[...g[5]||(g[5]=[X(" Cancel ",-1)])]),_:1}),w(S(De),{variant:"primary",size:"sm",type:"submit",form:"add-provider-form"},{default:j(()=>[...g[6]||(g[6]=[X(" Add Provider ",-1)])]),_:1})])]),default:j(()=>[w(_,{id:"add-provider-form",type:"form",actions:!1,onSubmit:v},{default:j(()=>[e("div",Fk,[e("div",Nk,[g[4]||(g[4]=e("label",{class:"block text-sm font-medium"},[X(" Provider Type "),e("span",{class:"text-red-500"},"*")],-1)),e("div",qk,[e("button",{type:"button",onClick:g[0]||(g[0]=L=>u.value=!u.value),onBlur:c,class:ne(["w-full px-3 py-2 bg-white dark:bg-black border rounded font-mono text-sm text-left focus:outline-none focus:ring-2 focus:ring-accent-500 dark:focus:ring-accent-400 transition-colors",[m.value?"border-red-500 dark:border-red-400":"border-neutral-300 dark:border-neutral-600"]])},[x.value?(r(),n("div",Hk,[e("img",{src:x.value.icon,alt:x.value.label,class:"w-5 h-5"},null,8,Wk),e("span",null,C(x.value.label),1)])):(r(),n("span",Kk,"Select a provider")),g[3]||(g[3]=e("div",{class:"absolute inset-y-0 right-0 flex items-center px-2 pointer-events-none"},[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"})])],-1))],34),u.value?(r(),n("div",Jk,[(r(!0),n(fe,null,ke(i.value,L=>(r(),n("button",{key:L.value,type:"button",onClick:O=>f(L.value),class:"w-full px-3 py-2 text-left hover:bg-accent-50 dark:hover:bg-accent-900/20 transition-colors flex items-center gap-2"},[e("img",{src:L.icon,alt:L.label,class:"w-5 h-5"},null,8,Gk),e("span",null,C(L.label),1)],8,Yk))),128))])):T("",!0)]),m.value?(r(),n("p",Zk,C(m.value),1)):T("",!0)]),w(_,{type:"text",name:"name",label:"Provider Name",placeholder:"e.g., My OpenAI Provider",validation:"required",modelValue:b.value,"onUpdate:modelValue":g[1]||(g[1]=L=>b.value=L),"validation-messages":{required:"Provider name is required"}},null,8,["modelValue"]),w(_,{type:"password",name:"apiKey",label:"API Key",placeholder:"sk-...",validation:"required","validation-messages":{required:"API key is required"}}),y.value?(r(),q(_,{key:0,type:"text",name:"baseUrl",label:"Base URL",placeholder:"https://api.example.com",validation:s.value==="custom"?"required":"","validation-messages":{required:"Base URL is required for custom providers"}},null,8,["validation"])):T("",!0)])]),_:1})]),_:1},8,["model-value"])}}}),e2={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function t2(t,o){return r(),n("svg",e2,[...o[0]||(o[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])}const r2=Te({name:"lucide-check",render:t2}),a2={class:"flex items-center gap-2"},o2=["src","alt"],n2={key:0,class:"inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded-full bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400"},l2={key:1,class:"inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded-full bg-neutral-100 text-neutral-500 dark:bg-neutral-800 dark:text-neutral-400"},s2=ve({__name:"ProvidersView",setup(t){const o=p(!1),a=p([]),i=p(!1),l={"openai-sdk":"OpenAI SDK",openrouter:"OpenRouter",openai:"OpenAI"},u=f=>l[f]||f,s=[{key:"name",label:"Name",width:"w-1/3",sortable:!0},{key:"sdk",label:"SDK Type",width:"w-1/3",sortable:!0,formatter:f=>u(f)},{key:"hasApiKey",label:"API Key",width:"w-1/3"}],m=[{icon:"delete",label:"Delete",confirm:!0,confirmMessage:"Are you sure you want to delete this provider? This action cannot be undone.",variant:"danger",handler:async f=>{await c(f.name)}}],h=async()=>{i.value=!0;try{const f=await fetch(he("/api/providers"));if(!f.ok)throw new Error("Failed to fetch providers");const y=await f.json();a.value=y.providers||[]}catch(f){console.error("Error fetching providers:",f),a.value=[]}finally{i.value=!1}},x=async f=>{try{const y=await fetch(he("/api/providers"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(!y.ok){const b=await y.json();alert(b.error||"Failed to add provider");return}await h(),o.value=!1}catch(y){console.error("Error adding provider:",y),alert("Failed to add provider")}},c=async f=>{try{const y=await fetch(he(`/api/providers/${encodeURIComponent(f)}`),{method:"DELETE"});if(!y.ok){const b=await y.json();b.modelCount?alert(`${b.error}
|
|
46
|
+
`).trim():""),P=O(()=>{if(!n.log.response_body)return[];try{const z=JSON.parse(n.log.response_body)?.choices?.[0]?.message?.images;return Array.isArray(z)?z:[]}catch{return[]}}),J=O(()=>{if(!n.log.provider_tools)return[];try{const ae=JSON.parse(n.log.provider_tools);return Array.isArray(ae)?ae:[]}catch{return[]}}),Q=O(()=>{if(!n.log.queued_tools)return[];try{const ae=JSON.parse(n.log.queued_tools);return Array.isArray(ae)?ae:[]}catch{return[]}}),le=O(()=>{const ae=[];for(const z of R.value)ae.push({id:z.id||`tool-${ae.length}`,name:z.function?.name||"Unknown",isProvider:!1,isQueued:!1,function:z.function});for(const z of Q.value)ae.push({id:z.id||`queued-${ae.length}`,name:z.function?.name||"Unknown",isProvider:!1,isQueued:!0,function:z.function,queuedAt:z.queued_at});for(const z of J.value)ae.push({id:z.id,name:z.type,isProvider:!0,isQueued:!1,providerType:z.type,status:z.status,result:z.result});return ae}),me=ae=>{d.value.has(ae)?d.value.delete(ae):d.value.add(ae)},ee=ae=>{i.value.has(ae)?i.value.delete(ae):i.value.add(ae)},L=()=>{y.value=!y.value},C=()=>{v.value=!v.value},I=ae=>{x.value.has(ae)?x.value.delete(ae):x.value.add(ae)},re=ae=>!x.value.has(ae),F=O(()=>{if(!n.log.errors)return[];try{const ae=JSON.parse(n.log.errors);return Array.isArray(ae)?ae:[]}catch{return[]}}),B=m("standard"),q=m(null),Y=m(!1),U=m(null),H=["openai","openrouter"],E=()=>(n.log.actual_provider||n.log.provider)?.toLowerCase(),ne=()=>{const ae=E();ae&&H.includes(ae)?B.value=ae:B.value="standard"},A=ae=>ae.charAt(0).toUpperCase()+ae.slice(1);xe(B,async ae=>{if(ae==="standard"){q.value=null,U.value=null;return}if(!n.threadId||!n.log.id){U.value="Missing thread or log ID";return}Y.value=!0,U.value=null;try{const z=await fetch(ge(`/api/threads/${n.threadId}/logs/${n.log.id}/inspect/${ae}`));if(!z.ok){const K=await z.json();throw new Error(K.error||"Failed to inspect")}q.value=await z.json()}catch(z){U.value=z.message||"Failed to fetch inspected request",q.value=null}finally{Y.value=!1}}),xe(()=>n.log.id,async()=>{if(q.value=null,U.value=null,ne(),B.value!=="standard"&&n.threadId&&n.log.id){Y.value=!0;try{const ae=await fetch(ge(`/api/threads/${n.threadId}/logs/${n.log.id}/inspect/${B.value}`));if(!ae.ok){const z=await ae.json();throw new Error(z.error||"Failed to fetch inspected request")}q.value=await ae.json()}catch(ae){U.value=ae.message||"Failed to fetch inspected request"}finally{Y.value=!1}}},{immediate:!0});const pe=O(()=>{if(B.value==="standard"||!q.value)return n.log.message_history;const ae=q.value.messagesPath,z=ae?q.value.body?.[ae]:q.value.body;return JSON.stringify(z,null,2)}),ue=O(()=>B.value==="standard"||!q.value?n.log.request_body:JSON.stringify(q.value.body,null,2)),ke=O(()=>B.value==="standard"||!q.value?null:`${B.value} format`);xe(()=>n.log,()=>{Le(()=>{h.value?.checkHeight(),_.value?.checkHeight(),b.value?.checkHeight(),u.value?.checkHeight()})});const Ee=async()=>{c.value=!0;try{if(!n.log.request_body||!n.log.model)throw new Error("Missing request data");const ae=await fetch(ge(`/api/models/${encodeURIComponent(n.log.model)}/curl-data`));if(!ae.ok)throw new Error("Failed to fetch model data");const z=await ae.json(),K=k(n.log.request_body);let ie=`curl -X POST '${z.endpoint}' \\
|
|
47
|
+
`;ie+=` -H 'Content-Type: application/json' \\
|
|
48
|
+
`,z.sdk?.toLowerCase()==="openrouter"?(ie+=` -H 'Authorization: Bearer ${z.api_key}' \\
|
|
49
|
+
`,ie+=` -H 'HTTP-Referer: https://agentkit.local' \\
|
|
50
|
+
`,ie+=` -H 'X-Title: AgentKit' \\
|
|
51
|
+
`):z.sdk?.toLowerCase()==="openai"&&(ie+=` -H 'Authorization: Bearer ${z.api_key}' \\
|
|
52
|
+
`),ie+=` -d '${K.replace(/'/g,"'\\''")}'`,await navigator.clipboard.writeText(ie),g.value=!0,setTimeout(()=>{g.value=!1},2e3)}catch(ae){console.error("Failed to copy cURL command:",ae),alert(`Failed to copy cURL: ${ae instanceof Error?ae.message:"Unknown error"}`)}finally{c.value=!1}};return(ae,z)=>(r(),o("div",{ref_key:"scrollContainer",ref:f,class:"p-4 h-full overflow-y-auto"},[e("div",Tg,[e("div",Ig,[e("div",zg,[e("button",{onClick:z[0]||(z[0]=K=>s("previous")),disabled:!t.hasPrevious,class:"w-7 h-7 flex items-center justify-center rounded border border-neutral-300 dark:border-neutral-600 text-neutral-500 hover:text-neutral-700 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:text-neutral-200 dark:hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent dark:disabled:hover:bg-transparent transition-all","aria-label":"Previous log",title:"Previous log"},[...z[10]||(z[10]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("polyline",{points:"15 18 9 12 15 6"})],-1)])],8,Mg),e("button",{onClick:z[1]||(z[1]=K=>s("next")),disabled:!t.hasNext,class:"w-7 h-7 flex items-center justify-center rounded border border-neutral-300 dark:border-neutral-600 text-neutral-500 hover:text-neutral-700 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:text-neutral-200 dark:hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed disabled:hover:bg-transparent dark:disabled:hover:bg-transparent transition-all","aria-label":"Next log",title:"Next log"},[...z[11]||(z[11]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("polyline",{points:"9 18 15 12 9 6"})],-1)])],8,Vg)]),e("h3",Eg,S(t.log.prompt_name||t.log.model_name||t.log.model),1)]),e("div",Lg,[e("button",{onClick:Ee,disabled:c.value||!t.log.request_body,class:"px-3 py-1 text-xs font-medium bg-black text-white dark:bg-white dark:text-black rounded hover:opacity-80 disabled:opacity-50 disabled:cursor-not-allowed transition-opacity",title:t.log.request_body?"Copy cURL command":"No request data available"},[c.value?(r(),N(Ve,{key:0,size:"xs"})):(r(),o("span",Ag,S(g.value?"Copied!":"Copy cURL"),1))],8,Pg),e("button",{onClick:z[2]||(z[2]=K=>s("close")),class:"w-7 h-7 flex items-center justify-center rounded border border-neutral-300 dark:border-neutral-600 text-neutral-500 hover:text-neutral-700 hover:bg-neutral-100 dark:text-neutral-400 dark:hover:text-neutral-200 dark:hover:bg-neutral-800 transition-all","aria-label":"Close details",title:"Close"},[...z[12]||(z[12]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])])]),e("div",jg,[e("div",Dg,[e("table",Rg,[z[13]||(z[13]=e("thead",null,[e("tr",{class:"border-b border-neutral-200 dark:border-neutral-800"},[e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Status "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Provider "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Prompt "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Latency "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Tokens "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Cost "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Created ")])],-1)),e("tbody",null,[e("tr",null,[e("td",{class:oe(["py-1 font-mono",t.log.error?"text-red-600 dark:text-red-400":t.log.is_complete?"text-green-600 dark:text-green-400":"text-yellow-600 dark:text-yellow-400"])},S(t.log.error?"ERROR":t.log.is_complete?"SUCCESS":"LOADING"),3),e("td",Og,S(t.log.actual_provider||t.log.provider),1),e("td",Ug,[!t.log.is_complete&&!t.log.prompt_name?(r(),N(Ve,{key:0,size:"xs"})):(r(),o("span",Bg,S(t.log.prompt_name||"—"),1))]),e("td",Fg,[!t.log.is_complete&&!t.log.latency_ms?(r(),N(Ve,{key:0,size:"xs"})):(r(),o("span",Ng,S(t.log.latency_ms?`${t.log.latency_ms}ms`:"—"),1))]),e("td",qg,[!t.log.is_complete&&!t.log.total_tokens?(r(),N(Ve,{key:0,size:"xs"})):(r(),o("span",Hg,S(t.log.total_tokens?`${t.log.input_tokens}/${t.log.output_tokens} (${t.log.total_tokens})`:"—"),1))]),e("td",Wg,[!t.log.is_complete&&!t.log.cost_total?(r(),N(Ve,{key:0,size:"xs"})):(r(),o("span",Kg,S(t.log.cost_total?`$${t.log.cost_total.toFixed(6)}`:"—"),1))]),e("td",Jg,[w(yt,{timestamp:t.log.created_at},null,8,["timestamp"])])])])])]),e("div",Yg,[e("table",Gg,[z[14]||(z[14]=e("thead",null,[e("tr",{class:"border-b border-neutral-200 dark:border-neutral-800"},[e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Status "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Provider "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Prompt ")])],-1)),e("tbody",null,[e("tr",null,[e("td",{class:oe(["py-1 font-mono",t.log.error?"text-red-600 dark:text-red-400":t.log.is_complete?"text-green-600 dark:text-green-400":"text-yellow-600 dark:text-yellow-400"])},S(t.log.error?"ERROR":t.log.is_complete?"SUCCESS":"LOADING"),3),e("td",Zg,S(t.log.actual_provider||t.log.provider),1),e("td",Xg,[!t.log.is_complete&&!t.log.prompt_name?(r(),N(Ve,{key:0,size:"xs"})):(r(),o("span",Qg,S(t.log.prompt_name||"—"),1))])])])]),e("table",eb,[z[15]||(z[15]=e("thead",null,[e("tr",{class:"border-b border-neutral-200 dark:border-neutral-800"},[e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Latency "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Tokens "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Cost "),e("th",{class:"text-left py-1 pr-4 text-neutral-600 dark:text-neutral-400 font-medium"}," Created ")])],-1)),e("tbody",null,[e("tr",null,[e("td",tb,[!t.log.is_complete&&!t.log.latency_ms?(r(),N(Ve,{key:0,size:"xs"})):(r(),o("span",rb,S(t.log.latency_ms?`${t.log.latency_ms}ms`:"—"),1))]),e("td",ab,[!t.log.is_complete&&!t.log.total_tokens?(r(),N(Ve,{key:0,size:"xs"})):(r(),o("span",ob,S(t.log.total_tokens?`${t.log.input_tokens}/${t.log.output_tokens} (${t.log.total_tokens})`:"—"),1))]),e("td",nb,[!t.log.is_complete&&!t.log.cost_total?(r(),N(Ve,{key:0,size:"xs"})):(r(),o("span",lb,S(t.log.cost_total?`$${t.log.cost_total.toFixed(6)}`:"—"),1))]),e("td",sb,[w(yt,{timestamp:t.log.created_at},null,8,["timestamp"])])])])])])]),e("div",ib,[e("div",ub,[e("button",{onClick:z[3]||(z[3]=K=>l.value="request"),class:oe(["pb-2 px-1 text-sm font-medium border-b-2 transition-colors",l.value==="request"?"border-black dark:border-white text-black dark:text-white":"border-transparent text-neutral-500 dark:text-neutral-400 hover:text-black dark:hover:text-white"])}," Request ",2),e("button",{onClick:z[4]||(z[4]=K=>l.value="response"),class:oe(["pb-2 px-1 text-sm font-medium border-b-2 transition-colors flex items-center gap-1",l.value==="response"?"border-black dark:border-white text-black dark:text-white":"border-transparent text-neutral-500 dark:text-neutral-400 hover:text-black dark:hover:text-white"])},[z[16]||(z[16]=X(" Response ",-1)),t.log.error||F.value.length>0?(r(),o("span",db,"⚠")):T("",!0)],2)])]),e("div",cb,[Ae(e("div",pb,[e("div",mb,[z[17]||(z[17]=e("span",{class:"text-xs text-neutral-500 dark:text-neutral-400 mr-2"},"View as:",-1)),e("button",{onClick:z[5]||(z[5]=K=>B.value="standard"),class:oe(["px-2 py-1 text-xs rounded transition-colors",B.value==="standard"?"bg-black text-white dark:bg-white dark:text-black":"bg-neutral-100 dark:bg-neutral-800 text-neutral-600 dark:text-neutral-400 hover:bg-neutral-200 dark:hover:bg-neutral-700"])}," Standard Agents ",2),(r(),o(he,null,we(H,K=>e("button",{key:K,onClick:ie=>B.value=K,class:oe(["px-2 py-1 text-xs rounded transition-colors",B.value===K?"bg-black text-white dark:bg-white dark:text-black":"bg-neutral-100 dark:bg-neutral-800 text-neutral-600 dark:text-neutral-400 hover:bg-neutral-200 dark:hover:bg-neutral-700"])},S(A(K)),11,vb)),64)),Y.value?(r(),N(Ve,{key:0,size:"xs",class:"ml-2"})):T("",!0),U.value?(r(),o("span",fb,S(U.value),1)):T("",!0)]),M.value.length>0?(r(),N(It,{key:0,ref_key:"toolsSectionRef",ref:h,title:`Available Tools (${M.value.length})`,"section-id":"tools",expanded:re("tools"),"scroll-container":f.value,onToggle:z[6]||(z[6]=K=>I("tools"))},{default:j(()=>[(r(!0),o(he,null,we(M.value,(K,ie)=>(r(),o("div",{key:ie,class:"border-b border-neutral-200 dark:border-neutral-800 last:border-b-0"},[e("button",{onClick:D=>me(ie),class:"w-full px-2 py-1.5 text-left hover:bg-neutral-50 dark:hover:bg-neutral-900 transition-colors flex items-center justify-between text-xs"},[e("span",gb,S(K.function?.name||K.name||"Unknown"),1),e("span",bb,S(d.value.has(ie)?"▼":"▶"),1)],8,hb),Ae(e("div",xb,[K.function?.description||K.description?(r(),o("div",yb,S(K.function?.description||K.description),1)):T("",!0),w(Nt,{code:JSON.stringify(K,null,2),language:"json"},null,8,["code"])],512),[[Ke,d.value.has(ie)]])]))),128))]),_:1},8,["title","expanded","scroll-container"])):T("",!0),t.log.message_history?(r(),N(It,{key:1,ref_key:"messagesSectionRef",ref:_,title:`Messages (${t.log.message_history_length||0} messages)`,subtitle:ke.value,"section-id":"messages",expanded:re("messages"),"scroll-container":f.value,onToggle:z[7]||(z[7]=K=>I("messages"))},{default:j(()=>[w(Mt,{json:pe.value,"thread-id":t.threadId,"show-copy-button":""},null,8,["json","thread-id"])]),_:1},8,["title","subtitle","expanded","scroll-container"])):T("",!0),t.log.system_prompt?(r(),N(It,{key:2,ref_key:"systemPromptSectionRef",ref:b,title:"System Prompt","section-id":"system_prompt",expanded:re("system_prompt"),"scroll-container":f.value,onToggle:z[8]||(z[8]=K=>I("system_prompt"))},{default:j(()=>[e("div",kb,[w(Nt,{code:t.log.system_prompt,language:"markdown"},null,8,["code"]),e("div",wb,[w(da,{content:t.log.system_prompt,variant:"ghost",size:"xs"},null,8,["content"])])])]),_:1},8,["expanded","scroll-container"])):T("",!0),t.log.request_body?(r(),N(It,{key:3,ref_key:"requestBodySectionRef",ref:u,title:"Full Request Body",subtitle:ke.value,"section-id":"request_body",expanded:re("request_body"),"scroll-container":f.value,onToggle:z[9]||(z[9]=K=>I("request_body"))},{default:j(()=>[w(Mt,{json:ue.value,"thread-id":t.threadId,"show-copy-button":""},null,8,["json","thread-id"])]),_:1},8,["subtitle","expanded","scroll-container"])):T("",!0)],512),[[Ke,l.value==="request"]]),Ae(e("div",null,[F.value.length>0?(r(),o("div",_b,[e("div",$b,S(F.value.length>1?`Errors (${F.value.length})`:"Error"),1),e("div",Cb,[(r(!0),o(he,null,we(F.value,(K,ie)=>(r(),o("div",{key:ie,class:"border border-red-300 dark:border-red-700 rounded overflow-hidden"},[e("div",Sb,S(K.type||"error"),1),e("pre",Tb,S(K.message),1)]))),128))])])):t.log.error?(r(),o("div",Ib,[e("div",zb," Error "+S(t.log.error_type?`(${t.log.error_type})`:""),1),e("pre",Mb,S(t.log.error),1)])):T("",!0),t.log.is_complete||!t.log.error?(r(),o("div",Vb,[z[25]||(z[25]=e("div",{class:"text-xs font-semibold mb-1"},"Response Stats",-1)),e("table",Eb,[e("tbody",null,[e("tr",Lb,[z[18]||(z[18]=e("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Finish Reason ",-1)),e("td",Pb,[!t.log.is_complete&&!t.log.finish_reason?(r(),N(Ve,{key:0,size:"xs"})):(r(),o("span",Ab,S(t.log.finish_reason||"—"),1))])]),e("tr",jb,[z[19]||(z[19]=e("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Input Tokens ",-1)),e("td",Db,[!t.log.is_complete&&!t.log.input_tokens?(r(),N(Ve,{key:0,size:"xs"})):(r(),o("span",Rb,S(t.log.input_tokens||"—"),1))])]),t.log.cached_tokens||!t.log.is_complete?(r(),o("tr",Ob,[z[20]||(z[20]=e("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Cached Tokens ",-1)),e("td",Ub,[!t.log.is_complete&&!t.log.cached_tokens?(r(),N(Ve,{key:0,size:"xs"})):(r(),o("span",Bb,S(t.log.cached_tokens||0),1))])])):T("",!0),e("tr",Fb,[z[21]||(z[21]=e("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Output Tokens ",-1)),e("td",Nb,[!t.log.is_complete&&!t.log.output_tokens?(r(),N(Ve,{key:0,size:"xs"})):(r(),o("span",qb,S(t.log.output_tokens||"—"),1))])]),t.log.reasoning_tokens&&t.log.reasoning_tokens>0?(r(),o("tr",Hb,[z[22]||(z[22]=e("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Reasoning Tokens ",-1)),e("td",Wb,S(t.log.reasoning_tokens),1)])):T("",!0),e("tr",Kb,[z[23]||(z[23]=e("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Total Tokens ",-1)),e("td",Jb,[!t.log.is_complete&&!t.log.total_tokens?(r(),N(Ve,{key:0,size:"xs"})):(r(),o("span",Yb,S(t.log.total_tokens||"—"),1))])]),e("tr",null,[z[24]||(z[24]=e("td",{class:"py-1 px-2 text-neutral-600 dark:text-neutral-400 font-medium bg-neutral-50 dark:bg-neutral-950"}," Total Cost ",-1)),e("td",Gb,[!t.log.is_complete&&!t.log.cost_total?(r(),N(Ve,{key:0,size:"xs"})):(r(),o("span",Zb,S(t.log.cost_total?`$${t.log.cost_total.toFixed(6)}`:"—"),1))])])])])])):T("",!0),le.value.length>0?(r(),o("div",Xb,[e("div",Qb," Tools Called ("+S(le.value.length)+") ",1),e("div",e1,[(r(!0),o(he,null,we(le.value,K=>(r(),o("div",{key:K.id,class:"border-b border-neutral-200 dark:border-neutral-800 last:border-b-0"},[e("button",{onClick:ie=>ee(K.id),class:"w-full px-2 py-1.5 text-left hover:bg-neutral-50 dark:hover:bg-neutral-900 transition-colors flex items-center justify-between text-xs"},[e("div",r1,[e("span",a1,S(K.name),1),K.isQueued?(r(),o("span",o1," programmatically invoked ")):T("",!0),K.isProvider?(r(),o("span",n1," provider ")):T("",!0),K.isProvider&&K.status?(r(),o("span",{key:2,class:oe([K.status==="completed"?"text-green-600 dark:text-green-400":K.status==="failed"?"text-red-600 dark:text-red-400":"text-yellow-600 dark:text-yellow-400","text-[10px]"])},S(K.status),3)):T("",!0)]),e("span",l1,S(i.value.has(K.id)?"▼":"▶"),1)],8,t1),Ae(e("div",{class:oe(["px-2 py-2 border-t border-neutral-200 dark:border-neutral-800",K.isProvider?"bg-purple-50 dark:bg-purple-900/10":K.isQueued?"bg-emerald-50 dark:bg-emerald-900/10":"bg-white dark:bg-neutral-950"])},[K.isProvider?(r(),o(he,{key:1},[e("div",b1,[z[32]||(z[32]=e("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Provider Tool ID ",-1)),e("div",x1,S(K.id),1)]),K.providerType==="web_search"&&K.result?.actions?(r(),o("div",y1,[(r(!0),o(he,null,we(K.result.actions,(ie,D)=>(r(),o("div",{key:D,class:"mb-2"},[ie.type==="search"?(r(),o("div",k1,[z[33]||(z[33]=e("span",{class:"font-medium"},"Searched:",-1)),X(' "'+S(ie.query)+'" ',1)])):T("",!0),ie.type==="open"?(r(),o("div",w1,[z[34]||(z[34]=e("span",{class:"font-medium"},"Opened:",-1)),e("a",{href:ie.url,target:"_blank",class:"text-blue-600 hover:underline ml-1"},S(ie.url),9,_1)])):T("",!0),ie.sources?.length?(r(),o("div",$1,[(r(!0),o(he,null,we(ie.sources.slice(0,5),(se,G)=>(r(),o("a",{key:G,href:se.url,target:"_blank",class:"block text-blue-600 hover:underline text-xs truncate"},S(se.title||se.url),9,C1))),128)),ie.sources.length>5?(r(),o("span",S1," ... and "+S(ie.sources.length-5)+" more ",1)):T("",!0)])):T("",!0)]))),128))])):T("",!0),K.providerType==="image_generation"?(r(),o("div",T1,[K.result?.imagePath?(r(),o("span",I1,[z[35]||(z[35]=X(" Stored at: ",-1)),e("span",z1,S(K.result.imagePath),1)])):(r(),o("span",M1," See Generated Images section below "))])):T("",!0),K.providerType==="code_interpreter"&&K.result?.output?(r(),o("div",V1,[z[36]||(z[36]=e("div",{class:"font-medium text-neutral-600 dark:text-neutral-400 mb-1"},"Output:",-1)),e("pre",E1,S(K.result.output),1)])):T("",!0),K.providerType==="file_search"&&K.result?.results?.length?(r(),o("div",L1,[e("div",P1," Found "+S(K.result.results.length)+" result(s) ",1)])):T("",!0)],64)):(r(),o(he,{key:0},[K.isQueued&&K.queuedAt?(r(),o("div",s1,[z[26]||(z[26]=e("div",{class:"font-semibold text-emerald-600 dark:text-emerald-400 mb-1"}," Invoked At ",-1)),e("div",i1,[w(yt,{timestamp:K.queuedAt},null,8,["timestamp"])])])):T("",!0),e("div",u1,[z[27]||(z[27]=e("div",{class:"font-semibold text-neutral-600 dark:text-neutral-400 mb-1"}," Tool Call ID ",-1)),e("div",d1,S(K.id),1)]),e("div",c1,[z[28]||(z[28]=e("div",{class:"font-semibold text-neutral-600 dark:text-neutral-400 mb-1"}," Function Name ",-1)),e("div",p1,S(K.function?.name),1)]),e("div",m1,[z[29]||(z[29]=e("div",{class:"font-semibold text-neutral-600 dark:text-neutral-400 mb-1"}," Arguments ",-1)),e("div",v1,[w(Nt,{code:k(K.function?.arguments||"{}"),language:"json"},null,8,["code"])])]),W.value.has(K.id)?(r(),o("div",f1,[z[30]||(z[30]=e("div",{class:"font-semibold text-green-600 dark:text-green-400 mb-1"}," Result ",-1)),e("pre",h1,S(W.value.get(K.id)?.content||"No content"),1)])):(r(),o("div",g1,[...z[31]||(z[31]=[e("div",{class:"font-semibold text-neutral-500 dark:text-neutral-500 mb-1"}," Result ",-1),e("div",{class:"text-xs text-neutral-500 dark:text-neutral-500 italic"}," No result available ",-1)])]))],64))],2),[[Ke,i.value.has(K.id)]])]))),128))])])):T("",!0),P.value.length>0?(r(),o("div",A1,[e("div",j1," Generated Images ("+S(P.value.length)+") ",1),e("div",D1,[z[37]||(z[37]=e("div",{class:"px-2 py-1.5 bg-emerald-100 dark:bg-emerald-900/30 text-xs text-emerald-800 dark:text-emerald-200 border-b border-emerald-300 dark:border-emerald-700"}," Images returned by the model ",-1)),e("div",R1,[(r(!0),o(he,null,we(P.value,(K,ie)=>(r(),o("div",{key:ie,class:"relative"},[K.image_url?.url?(r(),o("img",{key:0,src:p(K.image_url.url)||K.image_url.url,alt:`Generated image ${ie+1}`,class:"max-w-[300px] max-h-[300px] rounded border border-emerald-200 dark:border-emerald-800 object-contain"},null,8,O1)):(r(),o("div",U1," No URL "))]))),128))])])])):T("",!0),t.log.reasoning_content?(r(),o("div",B1,[e("div",F1,[e("button",{onClick:L,class:"w-full px-2 py-1.5 bg-accent-100 dark:bg-accent-900/30 text-xs text-accent-800 dark:text-accent-200 flex items-center justify-between hover:bg-accent-200 dark:hover:bg-accent-900/50 transition-colors"},[z[38]||(z[38]=e("div",{class:"flex items-center gap-2"},[e("span",{class:"font-semibold"},"Reasoning Content"),e("span",{class:"text-accent-600 dark:text-accent-400 font-normal"}," Internal reasoning output (not displayed to users) ")],-1)),e("span",N1,S(y.value?"▶":"▼"),1)]),Ae(e("pre",{class:"text-xs p-2 overflow-x-auto whitespace-pre-wrap max-h-96 text-accent-900 dark:text-accent-100 border-t border-accent-300 dark:border-accent-700"},S(V.value),513),[[Ke,!y.value]])])])):T("",!0),Z.value.length>0?(r(),o("div",q1,[e("div",H1,[e("button",{onClick:C,class:"w-full px-2 py-1.5 bg-purple-100 dark:bg-purple-900/30 text-xs text-purple-800 dark:text-purple-200 flex items-center justify-between hover:bg-purple-200 dark:hover:bg-purple-900/50 transition-colors"},[e("div",W1,[z[39]||(z[39]=e("span",{class:"font-semibold"},"Reasoning Details",-1)),e("span",K1,S(Z.value.length)+" blocks ",1),z[40]||(z[40]=e("span",{class:"text-purple-600 dark:text-purple-400 font-normal"}," Structured reasoning from OpenRouter ",-1))]),e("span",J1,S(v.value?"▶":"▼"),1)]),Ae(e("div",Y1,[(r(!0),o(he,null,we(Z.value,(K,ie)=>(r(),o("div",{key:ie,class:"p-2"},[e("div",G1,[e("span",Z1,S(K.type||"unknown"),1),K.id?(r(),o("span",X1," ID: "+S(K.id),1)):T("",!0),K.format?(r(),o("span",Q1," Format: "+S(K.format),1)):T("",!0),K.index!==void 0?(r(),o("span",ex," Index: "+S(K.index),1)):T("",!0)]),K.type==="reasoning.summary"&&K.summary?(r(),o("div",tx,[z[41]||(z[41]=e("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Summary: ",-1)),e("div",rx,S(K.summary),1)])):T("",!0),K.type==="reasoning.encrypted"&&K.data?(r(),o("div",ax,[z[42]||(z[42]=e("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Encrypted Data: ",-1)),e("div",ox,S(K.data),1)])):T("",!0),K.type==="reasoning.text"&&K.text?(r(),o("div",nx,[z[44]||(z[44]=e("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Reasoning Text: ",-1)),e("div",lx,S(K.text),1),K.signature?(r(),o("div",sx,[z[43]||(z[43]=e("div",{class:"font-semibold text-purple-600 dark:text-purple-400 mb-1"}," Signature: ",-1)),e("div",ix,S(K.signature),1)])):T("",!0)])):T("",!0),["reasoning.summary","reasoning.encrypted","reasoning.text"].includes(K.type)?T("",!0):(r(),o("div",ux,[e("pre",dx,S(JSON.stringify(K,null,2)),1)]))]))),128))],512),[[Ke,!v.value]])])])):T("",!0),t.log.response_body?(r(),o("div",cx,[z[45]||(z[45]=e("div",{class:"text-xs font-semibold mb-1"},"Full Response Body",-1)),e("div",px,[w(Mt,{json:t.log.response_body,"thread-id":t.threadId,"show-copy-button":""},null,8,["json","thread-id"])])])):T("",!0)],512),[[Ke,l.value==="response"]])])],512))}}),vx={class:"flex flex-col h-full"},fx={class:"px-4 py-3 border-b border-neutral-300 dark:border-neutral-700"},hx={class:"flex items-center justify-between"},gx={class:"flex items-center gap-2"},bx={key:0,class:"text-neutral-500 dark:text-neutral-400 text-center py-12"},xx={key:1,class:"flex justify-center py-12"},yx={key:2,class:"text-red-600 dark:text-red-400 text-center py-12"},kx={key:3,class:"text-neutral-500 dark:text-neutral-400 text-center py-12"},wx={key:4},_x={key:0,class:"border-b border-neutral-300 dark:border-neutral-700 bg-white dark:bg-black sticky top-0 z-10"},$x=["disabled"],Cx={key:1},Sx={key:2},Tx={key:3},Ix={class:"w-full text-sm"},zx=["onClick","onMouseenter"],Mx={class:"px-3 py-2 text-xs"},Vx={class:"flex items-center gap-1"},Ex={key:0,class:"text-neutral-400 dark:text-neutral-600 mr-1"},Lx={key:3},Px={class:"px-3 py-2"},Ax={class:"flex items-center gap-2"},jx={key:0,class:"text-red-600 dark:text-red-400",title:"Error"},Dx={class:"font-mono text-xs"},Rx={class:"px-3 py-2 font-mono text-xs"},Ox={key:1},Ux={key:1,class:"text-neutral-400"},Bx={key:2},Fx={key:0,class:"text-emerald-600 dark:text-emerald-400",title:"Programmatically called with state.queueTool()"},Nx={key:1},qx={key:2},Hx={key:0,class:"log-details-panel relative shrink-0 bg-neutral-100 dark:bg-neutral-950 border-t border-neutral-300 dark:border-neutral-700 overflow-hidden"},Wx={class:"m-2 border h-[calc(100%-1rem)] border-neutral-300 shrink-0 dark:border-neutral-700 rounded-xl bg-white dark:bg-neutral-900 overflow-auto"},Kx={key:0,class:"flex flex-col items-center justify-center h-full gap-3 text-neutral-500 dark:text-neutral-400"},Jx={key:2,class:"absolute inset-0 bg-white/50 dark:bg-black/50 flex items-center justify-center"},xr=20,Yx=20,Gx=fe({__name:"LogsPane",props:{threadId:{},selectedLogId:{},hoveredLogId:{}},emits:["logClick","logHover","logsLoaded"],setup(t,{expose:a,emit:n}){const s=t,l=n,d=m(0),i=m(xr),{logs:c,hasMore:g,isFetching:y,error:v,wsConnected:f,wsError:h,connectWebSocket:_,disconnectWebSocket:b,refetch:u}=ig(O(()=>s.threadId),{limit:O(()=>i.value),offset:O(()=>d.value),enableWebSocket:!0,order:"desc"}),x=m([]),p=m(!0),k=m(null),M=m(null),R=m(!1),W=m(!1),Z=m(new Map),V=async()=>{await Le(),M.value&&(M.value.scrollTop=M.value.scrollHeight)},P=m(null);xe(c,async D=>{if(d.value===0)x.value=[...D].reverse(),p.value&&x.value.length>0&&(await V(),p.value=!1);else{const se=[...D].reverse(),G=new Map;x.value.forEach(ye=>G.set(ye.id,ye)),se.forEach(ye=>G.set(ye.id,ye)),x.value=Array.from(G.values()).sort((ye,Se)=>ye.created_at-Se.created_at)}},{deep:!0,immediate:!0}),xe(y,(D,se)=>{if(se&&!D&&d.value===0&&s.threadId&&P.value!==s.threadId&&x.value.length>0){P.value=s.threadId;const G=x.value[x.value.length-1];l("logsLoaded",G?.id??null)}});const{logDetails:J,isFetching:Q}=ug(O(()=>s.threadId),O(()=>k.value)),le=O(()=>{if(!k.value)return null;const se=x.value.find(G=>G.id===k.value);return se?J.value?{...J.value,...se}:se:null}),me=O(()=>k.value?ie.value.findIndex(D=>D.id===k.value):-1),ee=O(()=>me.value>0),L=O(()=>me.value>=0&&me.value<ie.value.length-1),C=()=>{if(ee.value){const D=ie.value[me.value-1];F(D)}},I=()=>{if(L.value){const D=ie.value[me.value+1];F(D)}},re=D=>{if(!M.value)return;const se=Z.value.get(D);if(!se)return;const G=M.value,ye=se.getBoundingClientRect(),Se=G.getBoundingClientRect(),de=G.querySelectorAll(".sticky");let ce=0;de.forEach(be=>{ce+=be.getBoundingClientRect().height}),ce+=16;const Ie=ye.top<Se.top+ce,ve=ye.bottom>Se.bottom;Ie?G.scrollBy({top:ye.top-Se.top-ce,behavior:"smooth"}):ve&&G.scrollBy({top:ye.bottom-Se.bottom,behavior:"smooth"})},F=D=>{l("logClick",D.id),k.value=D.id},B=(D,se)=>{se?Z.value.set(D,se):Z.value.delete(D)};xe(k,async D=>{D&&(await Le(),re(D))}),xe(()=>s.selectedLogId,D=>{D&&(k.value=D)},{immediate:!0});const q=D=>{k.value=D},Y=async D=>{await Le();const se=Z.value.get(D);if(se&&M.value){const G=M.value,ye=se.getBoundingClientRect(),Se=G.getBoundingClientRect(),de=G.querySelector("thead"),ce=G.querySelector(":scope > div > div.sticky");let Ie=0;de&&(Ie+=de.getBoundingClientRect().height),ce&&(Ie+=ce.getBoundingClientRect().height),Ie+=40;const ve=ye.top<Se.top+Ie,be=ye.bottom>Se.bottom;ve?G.scrollBy({top:ye.top-Se.top-Ie,behavior:"smooth"}):be&&G.scrollBy({top:ye.bottom-Se.bottom,behavior:"smooth"})}},U=D=>{if(D.length===0)return;const se=new Set(D);x.value=x.value.filter(G=>!se.has(G.id))},H=m(!1),E=D=>x.value.some(se=>se.id===D),ne=D=>x.value.find(se=>se.id===D)??null,A=(D,se=3e3)=>new Promise(G=>{const ye=Date.now(),Se=xe(x,()=>{x.value.length!==D&&(Se(),G(!0))},{deep:!0}),de=setInterval(()=>{x.value.length!==D?(clearInterval(de),Se(),G(!0)):Date.now()-ye>se&&(clearInterval(de),Se(),G(!1))},50)});a({scrollToLog:Y,selectLogById:q,removeLogsByIds:U,loadUntilLogId:async D=>{if(E(D))return!0;if(!g.value)return!1;H.value=!0;const se=100,G=50;try{let ye=0;for(;g.value&&!E(D)&&ye<G;){ye++;const Se=x.value.length;if(d.value+=i.value,i.value=se,await u(),!await A(Se))break}return E(D)}finally{H.value=!1}},hasLog:E,getLog:ne,setLoadingForLog:D=>{H.value=D},waitForLogRow:async(D,se=2e3)=>{const G=Date.now();for(;Date.now()-G<se;){if(Z.value.has(D))return!0;if(!ie.value.some(Se=>Se.id===D)){await Le(),await new Promise(Se=>setTimeout(Se,16));continue}await Le(),await new Promise(Se=>setTimeout(Se,16))}return!1}});const Ee=async()=>{if(W.value||!g.value||y.value)return;W.value=!0;const D=M.value?.scrollHeight||0;if(d.value+=i.value,i.value=Yx,await u(),await Le(),M.value){const se=M.value.scrollHeight;M.value.scrollTop+=se-D}W.value=!1};xe(()=>s.threadId,async D=>{D?(b(),_()):b(),d.value=0,i.value=xr,x.value=[],k.value=null,R.value=!1,p.value=!0},{immediate:!0}),xe(x,async()=>{R.value||await V()},{deep:!0});const ae=()=>{if(!M.value)return;const{scrollTop:D,scrollHeight:se,clientHeight:G}=M.value,ye=se-D-G<50;R.value=!ye},z=D=>{const se=[];if(D.tools_called)try{const G=JSON.parse(D.tools_called);Array.isArray(G)&&se.push(...G.map(ye=>({name:ye,isProgrammatic:!1})))}catch{}if(D.provider_tools)try{const G=JSON.parse(D.provider_tools);Array.isArray(G)&&se.push(...G.map(ye=>({name:ye.type,isProgrammatic:!1})))}catch{}if(D.queued_tools)try{const G=JSON.parse(D.queued_tools);Array.isArray(G)&&se.push(...G.map(ye=>({name:ye.function?.name||"unknown",isProgrammatic:!0})))}catch{}return se},K=D=>D==null?"—":`$${D.toFixed(6)}`,ie=O(()=>{const D=new Map,se=new Map;x.value.forEach(Se=>{D.set(Se.id,Se);const de=Se.parent_log_id;de&&(se.has(de)||se.set(de,[]),se.get(de).push(Se))});const G=[],ye=(Se,de)=>{G.push({...Se,depth:de}),(se.get(Se.id)||[]).forEach(Ie=>{ye(Ie,de+1)})};return x.value.forEach(Se=>{Se.parent_log_id||ye(Se,0)}),G});return(D,se)=>(r(),o("div",vx,[e("div",fx,[e("div",hx,[e("div",gx,[w($(Za),{size:18,class:"shrink-0"}),se[3]||(se[3]=e("h2",{class:"text-base font-bold"},"Logs",-1)),t.threadId?(r(),N(rr,{key:0,connected:$(f),error:$(h)},null,8,["connected","error"])):T("",!0)])])]),e("div",{ref_key:"logsScrollContainer",ref:M,class:"logs-list-container flex-1 overflow-y-auto overflow-x-auto",onScroll:ae},[t.threadId?$(y)&&d.value===0?(r(),o("div",xx,[w(Ve)])):$(v)?(r(),o("div",yx," Error loading logs: "+S($(v)),1)):x.value.length===0?(r(),o("div",kx," No logs yet ")):(r(),o("div",wx,[$(g)?(r(),o("div",_x,[e("button",{onClick:Ee,disabled:W.value||H.value,type:"button",class:"w-full px-3 py-2 text-xs font-medium text-neutral-700 dark:text-neutral-300 hover:bg-neutral-100 dark:hover:bg-neutral-900 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2"},[W.value||H.value?(r(),N(Ve,{key:0,size:"xs"})):T("",!0),H.value?(r(),o("span",Cx,"Loading to find log...")):W.value?(r(),o("span",Sx,"Loading older logs...")):(r(),o("span",Tx,"Load previous logs"))],8,$x)])):T("",!0),e("table",Ix,[e("thead",{class:oe(["border-b border-neutral-300 dark:border-neutral-700 sticky bg-white z-[10] dark:bg-black",{"top-0":!$(g),"top-[34px]":$(g)}])},[...se[4]||(se[4]=[e("tr",null,[e("th",{class:"text-left px-3 py-1.5 text-xs font-semibold"},"Prompt"),e("th",{class:"text-left px-3 py-1.5 text-xs font-semibold"},"Model"),e("th",{class:"text-left px-3 py-1.5 text-xs font-semibold"},"Cost"),e("th",{class:"text-left px-3 py-1.5 text-xs font-semibold"},"Tools Called"),e("th",{class:"text-right px-3 py-1.5 text-xs font-semibold"},"Called At")],-1)])],2),e("tbody",null,[(r(!0),o(he,null,we(ie.value,G=>(r(),o("tr",{key:G.id,ref_for:!0,ref:ye=>B(G.id,ye),class:oe(["border-b border-neutral-200 dark:border-neutral-800 cursor-pointer transition-colors relative",{"last:border-b-0":le.value,"bg-red-50 dark:bg-red-950/20":G.error,"bg-accent-100 dark:bg-accent-900 dark:text-white":k.value===G.id,"ring-2 ring-inset ring-accent-400 dark:ring-accent-400":G.id===s.selectedLogId||G.id!==s.selectedLogId&&G.id===s.hoveredLogId}]),onClick:ye=>F(G),onMouseenter:ye=>l("logHover",G.id),onMouseleave:se[0]||(se[0]=ye=>l("logHover",null))},[e("td",Mx,[e("div",Vx,[G.depth>0?(r(),o("span",Ex,"└─")):T("",!0),G.retry_of_log_id?(r(),N($(Xa),{key:1,size:14,class:"text-neutral-500 dark:text-neutral-400 flex-shrink-0"})):T("",!0),!G.is_complete&&!G.prompt_name?(r(),N(Ve,{key:2,size:"xs"})):(r(),o("span",Lx,S(G.prompt_name||"—"),1))])]),e("td",Px,[e("div",Ax,[G.error?(r(),o("span",jx," ✕ ")):T("",!0),e("span",Dx,S(G.model_name||G.model),1)])]),e("td",Rx,[!G.is_complete&&!G.cost_total?(r(),N(Ve,{key:0,size:"xs"})):(r(),o("span",Ox,S(K(G.cost_total)),1))]),e("td",{class:oe(["px-3 py-2 text-xs",k.value===G.id?"text-neutral-800 dark:text-neutral-100":"text-neutral-600 dark:text-neutral-400"])},[!G.is_complete&&z(G).length===0?(r(),N(Ve,{key:0,size:"xs"})):z(G).length===0?(r(),o("span",Ux,"—")):(r(),o("span",Bx,[(r(!0),o(he,null,we(z(G),(ye,Se)=>(r(),o(he,{key:Se},[ye.isProgrammatic?(r(),o("span",Fx,[w($(Qa),{size:11,class:"inline-block -mt-0.5 mr-0.5"}),X(S(ye.name),1)])):(r(),o("span",Nx,S(ye.name),1)),Se<z(G).length-1?(r(),o("span",qx,", ")):T("",!0)],64))),128))]))],2),e("td",{class:oe(["px-3 py-2 text-right text-xs",k.value===G.id?"text-neutral-800 dark:text-neutral-100":"text-neutral-500 dark:text-neutral-500"])},[w(yt,{timestamp:G.created_at},null,8,["timestamp"])],2)],42,zx))),128))])])])):(r(),o("div",bx," Select a thread to view logs "))],544),w(et,{name:"slide-up",onAfterEnter:se[2]||(se[2]=()=>k.value&&re(k.value))},{default:j(()=>[le.value||H.value&&k.value?(r(),o("div",Hx,[e("div",Wx,[H.value&&!le.value?(r(),o("div",Kx,[w(Ve),se[5]||(se[5]=e("span",{class:"text-sm"},"Loading log...",-1))])):le.value?(r(),N(mx,{key:1,log:le.value,"thread-id":t.threadId,"has-previous":ee.value,"has-next":L.value,onClose:se[1]||(se[1]=G=>k.value=null),onPrevious:C,onNext:I},null,8,["log","thread-id","has-previous","has-next"])):T("",!0),$(Q)&&le.value?(r(),o("div",Jx,[w(Ve)])):T("",!0)])])):T("",!0)]),_:1})]))}}),Zx=Xe(Gx,[["__scopeId","data-v-f8e4fdfe"]]),Xx={class:"space-y-4"},Qx={key:0},ey={key:1},ty={key:1,class:"space-y-4 p-4 bg-neutral-50 dark:bg-neutral-900 rounded-lg"},ry={key:2,class:"p-4 bg-neutral-50 dark:bg-neutral-900 rounded-lg text-center text-sm text-neutral-500"},ay={key:3,class:"space-y-4"},oy={key:0,class:"p-4 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-700 rounded-lg"},ny={class:"space-y-3"},ly={key:0,class:"text-xs text-amber-500 dark:text-amber-400 mt-1"},sy={key:1,class:"p-4 bg-neutral-50 dark:bg-neutral-900 rounded-lg"},iy={key:4,class:"p-4 bg-neutral-50 dark:bg-neutral-900 rounded-lg text-center text-sm text-neutral-500"},uy={class:"flex justify-between"},dy=fe({__name:"CreateThreadModal",props:{modelValue:{type:Boolean},editThread:{}},emits:["update:modelValue","thread-created","thread-updated"],setup(t,{emit:a}){const n=t,s=a,l=O(()=>!!n.editThread),d=m(""),i=m(""),c=m({}),g=m(!1),y=m(""),v=m({}),f=m([]),h=m(!1),{data:_,isFetching:b,execute:u}=Ne(ge("/api/agents"),{immediate:!1}).json(),x=O(()=>_.value?(_.value?.agents||[]).map(I=>({value:I.id,label:I.title})):[]),p=O(()=>!d.value||!_.value?null:(_.value?.agents||[]).find(I=>I.id===d.value)),{data:k,isFetching:M,execute:R}=Ne(O(()=>p.value?.side_a_system_prompt?ge(`/api/prompts/${encodeURIComponent(p.value.side_a_system_prompt)}`):""),{immediate:!1}).json(),W=O(()=>{if(!k.value)return null;const C=k.value?.required_schema;if(!C)return null;try{return typeof C=="string"?JSON.parse(C):C}catch{return null}}),Z=O(()=>f.value.filter(C=>C.required&&!C.value&&!v.value[C.name])),V=O(()=>f.value.filter(C=>C.value!==void 0||!C.required)),P=O(()=>f.value.length>0),J=async C=>{if(!C){f.value=[],v.value={};return}h.value=!0;try{const I=await fetch(ge(`/api/agents/${encodeURIComponent(C)}/tenvs`));if(I.ok){const re=await I.json();f.value=re.tenvs||[],v.value=re.merged||{}}else f.value=[],v.value={}}catch(I){console.error("Error fetching agent tenvs:",I),f.value=[],v.value={}}finally{h.value=!1}},Q=O(()=>{const C=W.value;return!C||!C.properties?[]:Object.entries(C.properties).map(([I,re])=>({name:I,type:re.type||"string",description:re.description||"",required:C.required?.includes(I)||!1,enum:re.enum}))});xe(d,async C=>{C&&p.value?.side_a_system_prompt?(await R(),c.value={}):c.value={},C?await J(C):(f.value=[],v.value={})});const le=()=>{d.value="",i.value="",c.value={},y.value="",v.value={},f.value=[]},me=()=>{n.editThread&&(d.value=n.editThread.agent_id,i.value=n.editThread.tags?.join(", ")||"")},ee=async()=>{if(!d.value){y.value="Please select an agent";return}if(!l.value&&Q.value.length>0){for(const C of Q.value)if(C.required&&!c.value[C.name]){y.value=`Please provide ${C.name}`;return}}if(!l.value&&Z.value.length>0){for(const C of Z.value)if(!v.value[C.name]){y.value=`Please provide required environment variable: ${C.name}`;return}}g.value=!0,y.value="";try{const C=i.value.split(",").map(I=>I.trim()).filter(I=>I.length>0);if(l.value){const I=await fetch(ge(`/api/threads/${n.editThread.id}`),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tags:C})});if(!I.ok){const re=await I.json();throw new Error(re.error||"Failed to update thread")}s("thread-updated"),le(),s("update:modelValue",!1)}else{const I={agent_id:d.value,tags:C.length>0?C:void 0};Object.keys(c.value).length>0&&(I.data=c.value),Object.keys(v.value).length>0&&(I.tenvs=v.value);const re=await fetch(ge("/api/threads"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(I)});if(!re.ok){const q=await re.json();throw new Error(q.error||"Failed to create thread")}const B=(await re.json()).threadId;if(!B)throw new Error("Thread created but ID not found in response");s("thread-created",B),le(),s("update:modelValue",!1)}}catch(C){console.error(`Error ${l.value?"updating":"creating"} thread:`,C),y.value=C.message||`Failed to ${l.value?"update":"create"} thread`}finally{g.value=!1}},L=()=>{le(),s("update:modelValue",!1)};return xe(()=>n.modelValue,async C=>{C&&(await u(),le(),l.value&&me())}),(C,I)=>{const re=Be("FormKit");return r(),N(He,{"model-value":t.modelValue,"onUpdate:modelValue":I[3]||(I[3]=F=>C.$emit("update:modelValue",F)),title:l.value?"Edit Thread":"Create New Thread",width:"max-w-3xl"},{footer:j(()=>[e("div",uy,[w($(De),{variant:"ghost",size:"sm",disabled:g.value,onClick:L},{default:j(()=>[...I[10]||(I[10]=[X(" Cancel ",-1)])]),_:1},8,["disabled"]),w($(De),{variant:"primary",size:"sm",disabled:g.value||$(b),loading:g.value,onClick:ee},{default:j(()=>[l.value?(r(),o(he,{key:0},[X(S(g.value?"Updating...":"Update Thread"),1)],64)):(r(),o(he,{key:1},[X(S(g.value?"Creating...":"Create Thread"),1)],64))]),_:1},8,["disabled","loading"])])]),default:j(()=>[e("div",Xx,[y.value?(r(),N($(Fe),{key:0,variant:"error"},{default:j(()=>[X(S(y.value),1)]),_:1})):T("",!0),e("div",null,[w(re,{type:"selectSearch",modelValue:d.value,"onUpdate:modelValue":I[0]||(I[0]=F=>d.value=F),label:"Agent",options:x.value,disabled:$(b)||l.value,placeholder:"Select an agent...",validation:"required"},null,8,["modelValue","options","disabled"]),w($(ze),{class:"mt-1"},{default:j(()=>[l.value?(r(),o("span",Qx,"Agent cannot be changed after thread creation")):(r(),o("span",ey,"Choose which agent will handle this conversation"))]),_:1})]),!l.value&&Q.value.length>0&&!$(M)?(r(),o("div",ty,[I[4]||(I[4]=e("h4",{class:"text-sm font-medium text-neutral-700 dark:text-neutral-300"}," Required Information ",-1)),(r(!0),o(he,null,we(Q.value,F=>(r(),o("div",{key:F.name,class:"space-y-2"},[F.enum?(r(),N(re,{key:0,type:"selectSearch",modelValue:c.value[F.name],"onUpdate:modelValue":B=>c.value[F.name]=B,label:F.name,options:[{value:"",label:"Select..."},...F.enum.map(B=>({value:B,label:B}))],validation:F.required?"required":""},null,8,["modelValue","onUpdate:modelValue","label","options","validation"])):F.type==="string"?(r(),N(re,{key:1,type:"text",modelValue:c.value[F.name],"onUpdate:modelValue":B=>c.value[F.name]=B,label:F.name,placeholder:F.description,validation:F.required?"required":""},null,8,["modelValue","onUpdate:modelValue","label","placeholder","validation"])):F.type==="number"||F.type==="integer"?(r(),N(re,{key:2,type:"number",modelValue:c.value[F.name],"onUpdate:modelValue":B=>c.value[F.name]=B,label:F.name,placeholder:F.description,validation:F.required?"required":""},null,8,["modelValue","onUpdate:modelValue","label","placeholder","validation"])):F.type==="boolean"?(r(),N(re,{key:3,type:"checkbox",modelValue:c.value[F.name],"onUpdate:modelValue":B=>c.value[F.name]=B,label:F.name,validation:F.required?"required":""},null,8,["modelValue","onUpdate:modelValue","label","validation"])):(r(),N(re,{key:4,type:"textarea",modelValue:c.value[F.name],"onUpdate:modelValue":B=>c.value[F.name]=B,label:F.name,placeholder:F.description||`Enter ${F.name} (JSON format)`,validation:F.required?"required":"",rows:3},null,8,["modelValue","onUpdate:modelValue","label","placeholder","validation"])),F.description?(r(),N($(ze),{key:5,class:"mt-1"},{default:j(()=>[X(S(F.description),1)]),_:2},1024)):T("",!0)]))),128))])):T("",!0),!l.value&&$(M)?(r(),o("div",ry," Loading agent requirements... ")):T("",!0),!l.value&&P.value&&!h.value?(r(),o("div",ay,[Z.value.length>0?(r(),o("div",oy,[I[5]||(I[5]=e("h4",{class:"text-sm font-medium text-amber-800 dark:text-amber-200 mb-3"}," Required Environment Variables ",-1)),I[6]||(I[6]=e("p",{class:"text-xs text-amber-600 dark:text-amber-300 mb-3"}," These values are required by the agent's tools and must be provided. ",-1)),e("div",ny,[(r(!0),o(he,null,we(Z.value,F=>(r(),o("div",{key:F.name},[w(re,{type:"text","model-value":v.value[F.name]||"",onInput:B=>v.value[F.name]=B,label:F.name,placeholder:F.description||"Enter value...",validation:"required"},null,8,["model-value","onInput","label","placeholder"]),F.source?(r(),o("p",ly," Required by: "+S(F.source),1)):T("",!0)]))),128))])])):T("",!0),V.value.length>0?(r(),o("div",sy,[I[7]||(I[7]=e("h4",{class:"text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-3"}," Environment Configuration ",-1)),I[8]||(I[8]=e("p",{class:"text-xs text-neutral-500 dark:text-neutral-400 mb-3"}," Values inherited from the agent. Click the lock icon to override. ",-1)),w(Qt,{modelValue:v.value,"onUpdate:modelValue":I[1]||(I[1]=F=>v.value=F),inherited:V.value,"allow-custom":!0},null,8,["modelValue","inherited"])])):T("",!0)])):T("",!0),!l.value&&h.value?(r(),o("div",iy," Loading environment configuration... ")):T("",!0),e("div",null,[w(re,{type:"text",modelValue:i.value,"onUpdate:modelValue":I[2]||(I[2]=F=>i.value=F),label:"Tags",placeholder:"research, urgent, production"},null,8,["modelValue"]),w($(ze),{class:"mt-1"},{default:j(()=>[...I[9]||(I[9]=[X(" Comma-separated tags to help organize and search threads ",-1)])]),_:1})])])]),_:1},8,["model-value","title"])}}}),cy={class:"flex h-full overflow-hidden"},py={key:0,class:"flex flex-col items-center p-4"},my={key:0,class:"flex flex-col items-center p-4"},vy={class:"flex-1 overflow-hidden flex flex-col min-h-0"},yr=fe({__name:"ThreadsView",setup(t){const a=ut(),n=bt(),s=m(typeof a.params.id=="string"?a.params.id:null),l=m({threadList:!1,messages:!1}),d=m(!1),i=m(null),c=m(null),{thread:g}=tr(O(()=>s.value)),y=m(null),v=m(null),f=m(null),h=m(null),_=m(null),b=C=>{h.value=C,_.value=C},u=C=>{const I=p.value,re=k.value;if(!I||!re)return null;if(I.hasWorkblockForLogId(C))return C;let F=C;const B=10;for(let q=0;q<B&&F;q++){const Y=re.getLog(F);if(!Y)break;const U=Y.parent_log_id;if(!U)break;if(I.hasWorkblockForLogId(U))return U;F=U}return null},x=C=>{if(h.value=C,!C){_.value=null;return}_.value=u(C)??C},p=m(null),k=m(null);xe(()=>a.params.id,C=>{s.value=typeof C=="string"?C:null,y.value=null,v.value=null,f.value=null});const M=C=>{n.push(`/threads/${C}`)},R=C=>{window.location.href="/threads"},W=()=>{g.value&&(i.value=g.value,d.value=!0)},Z=()=>{i.value=null,d.value=!0},V=C=>{c.value?.refetch(),n.push(`/threads/${C}`)},P=()=>{c.value?.refetch()},J=C=>{l.value[C]=!l.value[C]},Q=async(C,I)=>{if(y.value=C,!I){v.value=null,f.value=null;return}const re=k.value;if(!re){v.value=I,f.value=I;return}const F=!re.hasLog(I);if(F&&re.setLoadingForLog(!0),v.value=I,f.value=I,F&&!await re.loadUntilLogId(I)){console.warn(`Could not find log ${I} after loading all available logs`),re.setLoadingForLog(!1);return}if(!await re.waitForLogRow(I)){console.warn(`Log row ${I} not rendered in time`);return}re.scrollToLog(I),re.selectLogById(I)},le=C=>{v.value=C,y.value=null;const I=p.value;if(!I){f.value=C;return}if(I.scrollToLogId(C)){f.value=C;return}const re=u(C);re&&re!==C&&I.scrollToLogId(re),f.value=re??C},me=C=>{C&&(v.value=C)},ee=C=>{k.value?.removeLogsByIds(C)},L=C=>{C&&!s.value&&n.push(`/threads/${C}`)};return(C,I)=>(r(),o("div",cy,[e("div",{class:oe([l.value.threadList?"w-[60px]":"w-[320px]","border-r border-neutral-300 dark:border-neutral-700 flex-shrink-0 transition-all duration-200 flex flex-col min-h-0"])},[l.value.threadList?(r(),o("div",py,[e("button",{onClick:I[0]||(I[0]=re=>J("threadList")),class:"p-2 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",title:"Expand Threads pane"},[w($(jr),{size:20})])])):(r(),N(wv,{key:1,ref_key:"threadListPaneRef",ref:c,"selected-thread-id":s.value,onSelectThread:M,onCollapse:I[1]||(I[1]=re=>J("threadList")),onCreateThread:Z,onThreadsLoaded:L},null,8,["selected-thread-id"]))],2),e("div",{class:oe([l.value.messages?"w-[60px]":"w-[380px]","border-r border-neutral-300 dark:border-neutral-700 flex-shrink-0 overflow-hidden transition-all duration-200 flex flex-col min-h-0"])},[l.value.messages?(r(),o("div",my,[e("button",{onClick:I[2]||(I[2]=re=>J("messages")),class:"p-2 hover:bg-neutral-100 dark:hover:bg-neutral-900 rounded transition-colors",title:"Expand Messages pane"},[w($(Ur),{size:20})])])):s.value?(r(),N($(So),{key:1,"thread-id":s.value,preload:!0,live:!0,"include-silent":!0,"use-workblocks":!0},{default:j(()=>[w(br,{ref_key:"messagesPaneRef",ref:p,"thread-id":s.value,"selected-message-id":y.value,"selected-log-id":f.value,"hovered-log-id":_.value,onCollapse:I[3]||(I[3]=re=>J("messages")),onMessageClick:Q,onMessageHover:b,onThreadDeleted:R,onEditThread:W,onLogsDeleted:ee,onThreadUpdated:P},null,8,["thread-id","selected-message-id","selected-log-id","hovered-log-id"])]),_:1},8,["thread-id"])):l.value.messages?T("",!0):(r(),N(br,{key:2,ref_key:"messagesPaneRef",ref:p,"thread-id":null,"selected-message-id":y.value,"selected-log-id":f.value,"hovered-log-id":_.value,onCollapse:I[4]||(I[4]=re=>J("messages")),onMessageClick:Q,onMessageHover:b,onThreadDeleted:R,onEditThread:W,onLogsDeleted:ee,onThreadUpdated:P},null,8,["selected-message-id","selected-log-id","hovered-log-id"]))],2),e("div",vy,[w(Zx,{ref_key:"logsPaneRef",ref:k,"thread-id":s.value,"selected-log-id":v.value,"hovered-log-id":h.value,onLogClick:le,onLogHover:x,onLogsLoaded:me},null,8,["thread-id","selected-log-id","hovered-log-id"])]),w(dy,{modelValue:d.value,"onUpdate:modelValue":I[5]||(I[5]=re=>d.value=re),"edit-thread":i.value,onThreadCreated:V,onThreadUpdated:P},null,8,["modelValue","edit-thread"])]))}}),fy=fe({__name:"PromptsDataTable",props:{title:{},description:{},primaryAction:{},readonly:{type:Boolean,default:!1}},emits:["add","edit","delete"],setup(t,{expose:a,emit:n}){const s=t,l=n,d=m([]),i=m(!1),c=[{key:"name",label:"Name",width:"w-1/4",sortable:!0},{key:"tool_description",label:"Description",width:"w-2/5"},{key:"model_name",label:"Model",width:"w-1/5",sortable:!0,filterable:!0,formatter:(h,_)=>h||_.model_id||"-",filterIcon:(h,_)=>_.model_provider?`/api/providers/${_.model_provider}/icon?model=${encodeURIComponent(_.model_id||"")}`:void 0},{key:"created_at",label:"Created",width:"w-1/6",sortable:!0,searchable:!1,formatter:h=>h?new Date(h*1e3).toLocaleDateString():"-"}],g=[{icon:"edit",label:"Edit",handler:h=>l("edit",h)},{icon:"delete",label:"Delete",handler:async h=>{await f(h)},confirm:!0,confirmMessage:"Are you sure you want to delete this prompt?",variant:"danger"}],y=O(()=>s.readonly?g.filter(h=>h.variant!=="danger"):g),v=async()=>{i.value=!0;try{const h=await fetch(ge("/api/prompts"));if(h.ok){const _=await h.json();d.value=_.prompts||[]}}catch(h){console.error("Error fetching prompts:",h)}finally{i.value=!1}},f=async h=>{try{const _=await fetch(ge(`/api/prompts/${encodeURIComponent(h.id)}`),{method:"DELETE"});if(_.ok)await v();else{const b=await _.json();alert(b.error||"Failed to delete prompt")}}catch(_){console.error("Error deleting prompt:",_),alert("Failed to delete prompt")}};return Pe(()=>{v()}),a({refresh:v}),(h,_)=>(r(),o("div",null,[w(ot,{title:t.title,description:t.description,"primary-action":t.primaryAction,columns:c,data:d.value,actions:y.value,loading:i.value,sortable:"",searchable:"","search-placeholder":"Search prompts...","empty-message":"No prompts available. Create your first prompt to get started.",onRowClick:_[0]||(_[0]=b=>l("edit",b))},null,8,["title","description","primary-action","data","actions","loading"])]))}}),hy={class:"space-y-4"},gy={key:0,class:"mt-1 text-sm text-red-500"},by={key:1,class:"-mt-2 text-sm text-neutral-500 dark:text-neutral-400"},xy={class:"px-1 py-0.5 bg-neutral-100 dark:bg-neutral-800 rounded"},yy=fe({__name:"PromptBasicInfo",props:{name:{},toolDescription:{}},emits:["update:name","update:toolDescription"],setup(t,{emit:a}){const n=t,s=a,l=m(""),d=c=>{let g=c.replace(/[^a-zA-Z0-9\s_]/g,"");return g=g.trim().toLowerCase().replace(/\s+/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,""),g?/^[a-z][a-z0-9_]*$/.test(g)?l.value="":l.value="Name must start with a letter and contain only lowercase letters, numbers, and underscores":l.value="Name is required",g},i=c=>{const g=d(c);s("update:name",g)};return xe(()=>n.name,c=>{c&&d(c)},{immediate:!0}),(c,g)=>{const y=Be("FormKit");return r(),o("div",hy,[w(y,{type:"text",name:"name",value:t.name,onInput:i,label:"Prompt Name",placeholder:"Enter a unique name (will be converted to snake_case)","outer-class":"$reset"},null,8,["value"]),l.value?(r(),o("p",gy,S(l.value),1)):t.name?(r(),o("p",by,[g[1]||(g[1]=X(" Will be saved as: ",-1)),e("code",xy,S(t.name),1)])):T("",!0),w(y,{type:"textarea",name:"tool_description",value:t.toolDescription,onInput:g[0]||(g[0]=v=>s("update:toolDescription",v)),label:"Tool Description",placeholder:"Describe what this prompt does (shown when used as a tool)",rows:"3","outer-class":"$reset"},null,8,["value"])])}}}),ky={class:"space-y-4"},wy=fe({__name:"PromptModelSelect",props:{modelValue:{}},emits:["update:modelValue"],setup(t,{emit:a}){const n=a,s=m([]),l=m(!1),d=O(()=>s.value.map(c=>({value:c.id,label:c.name,description:c.model||c.provider,icon:c.provider?`/api/providers/${c.provider}/icon?model=${encodeURIComponent(c.model||"")}`:void 0}))),i=async()=>{l.value=!0;try{const c=await fetch(ge("/api/models"));if(c.ok){const g=await c.json();s.value=g.models||[]}}catch(c){console.error("Error fetching models:",c)}finally{l.value=!1}};return Pe(()=>{i()}),(c,g)=>{const y=Be("FormKit");return r(),o("div",ky,[w(y,{type:"selectSearch",name:"model_id",value:t.modelValue,onInput:g[0]||(g[0]=v=>n("update:modelValue",v)),options:d.value,label:"Model",placeholder:"Select a model for this prompt","search-placeholder":"Search models...",loading:l.value,"outer-class":"$reset"},null,8,["value","options","loading"])])}}});function kr(t,a){if(!a||!a.properties||Object.keys(a.properties).length===0)return!0;if(!t||!t.properties)return Object.keys(a.properties);const n=[],s=t.properties||{},l=a.properties||{};return(a.required||[]).forEach(i=>{i in s||n.push(i)}),Object.keys(l).forEach(i=>{!(i in s)&&!n.includes(i)&&n.push(i)}),n.length>0?n:!0}function wr(t){return t.length===0?"":t.length===1?`Missing required field: ${t[0]}`:`Missing required fields: ${t.join(", ")}`}const _y=fe({__name:"PromptTemplate",props:{promptText:{},beforeTool:{},afterTool:{},requiredSchema:{},currentPromptName:{}},emits:["update:promptText","update:beforeTool","update:afterTool"],setup(t,{emit:a}){const n=t,s=a,l=m([]),d=m(!1),i=h=>h.type==="text"?{type:"string",value:h.content||""}:h.type==="include"?{type:"prompt",id:h.prompt||"",label:h.prompt||""}:h.type==="string"?{type:"string",value:h.value||""}:h.type==="prompt"?{type:"prompt",id:h.id||"",label:h.label||h.id||""}:h.type==="variable"?{type:"variable",value:h.value||"",label:h.label||h.value||""}:{type:"string",value:""},c=O(()=>{if(!n.promptText)return[{type:"string",value:""}];let h=[];try{const b=JSON.parse(n.promptText);Array.isArray(b)?h=b.map(i):h=[{type:"string",value:n.promptText}]}catch{h=[{type:"string",value:n.promptText}]}const _=n.requiredSchema?JSON.parse(n.requiredSchema):{};return h.map(b=>{if(b.type==="prompt"&&b.schema){const u=kr(_,b.schema),x=u===!0,p=x?[]:u;return{...b,meta:{isValid:x,missingFields:p,validationMessage:x?"":wr(p)}}}return b})}),g=O(()=>{try{const h=JSON.parse(n.requiredSchema);if(h.properties&&typeof h.properties=="object")return Object.keys(h.properties)}catch{return[]}return[]}),y=async h=>{d.value=!0;try{const _=new URLSearchParams;h&&_.set("search",h);const b=await fetch(ge(`/api/prompts${_.toString()?"?"+_.toString():""}`));if(b.ok){const u=await b.json();l.value=u.prompts||[]}}catch(_){console.error("Error fetching prompts:",_)}finally{d.value=!1}},v=async h=>{const _=[];return g.value.forEach(b=>{(!h||b.toLowerCase().includes(h.toLowerCase()))&&_.push({type:"variable",value:b,label:b,description:"Schema property"})}),h!==void 0&&await y(h),l.value.forEach(b=>{if(!(n.currentPromptName&&b.name===n.currentPromptName)&&(!h||b.name.toLowerCase().includes(h.toLowerCase()))){const u=n.requiredSchema?JSON.parse(n.requiredSchema):{},x=kr(u,b.required_schema),p=x===!0,k=p?[]:x;_.push({type:"prompt",id:b.name,label:b.name,description:b.tool_description||"Available prompt",schema:b.required_schema,meta:{isValid:p,missingFields:k,validationMessage:p?"":wr(k)}})}}),_},f=h=>{const _=h.map(b=>{const{type:u,value:x,label:p,id:k,schema:M}=b;return u==="string"?{type:u,value:x||""}:u==="variable"?{type:u,value:x||"",label:p}:u==="prompt"?{type:u,id:k||"",label:p,schema:M}:b});s("update:promptText",JSON.stringify(_))};return Pe(()=>{y()}),(h,_)=>(r(),o("div",null,[w(Xt,{"model-value":c.value,"onUpdate:modelValue":f,search:v,placeholder:"Enter your prompt template... Type @ to insert variables or prompts"},null,8,["model-value"])]))}}),$y={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Cy(t,a){return r(),o("svg",$y,[...a[0]||(a[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2a2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1m8 0h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"},null,-1)])])}const _r=Te({name:"lucide-braces",render:Cy}),Sy={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ty(t,a){return r(),o("svg",Sy,[...a[0]||(a[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10 5H3m9 14H3M14 3v4m2 10v4m5-9h-9m9 7h-5m5-14h-7m-6 5v4m0-2H3"},null,-1)])])}const $r=Te({name:"lucide-sliders-horizontal",render:Ty}),Iy={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function zy(t,a){return r(),o("svg",Iy,[...a[0]||(a[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"},null,-1)])])}const Cr=Te({name:"lucide-zap",render:zy}),My={key:0,class:"min-h-[500px] flex items-center justify-center"},Vy={class:"flex flex-1 min-h-0"},Ey={class:"w-44 flex-shrink-0 border-r border-neutral-200 dark:border-neutral-700 py-4"},Ly={class:"space-y-4"},Py={class:"space-y-5"},Ay={key:0,class:"mb-4 py-6 px-4 border border-dashed border-neutral-300 dark:border-neutral-600 rounded-lg text-center"},jy={key:0,class:"space-y-2 mb-4"},Dy={class:"flex-1 min-w-0"},Ry={class:"font-medium text-sm"},Oy={class:"text-xs text-neutral-500 dark:text-neutral-400"},Uy=["onClick","aria-label"],By={key:2,class:"py-6 px-4 border border-dashed border-neutral-300 dark:border-neutral-600 rounded-lg text-center"},Fy={key:3,class:"text-center py-3 text-xs text-neutral-400 dark:text-neutral-500"},Ny={class:"mb-6"},qy={class:"grid grid-cols-2 gap-6 items-start"},Hy={class:"flex flex-col"},Wy={class:"space-y-4 mb-6 mt-6 pt-6 border-t border-neutral-100 dark:border-neutral-800"},Ky={class:"pt-6 border-t border-neutral-100 dark:border-neutral-800"},Jy={class:"grid grid-cols-2 gap-6 mb-4"},Yy={class:"flex justify-between items-center"},Gy={key:0,class:"flex items-center gap-3"},ca=fe({__name:"PromptModal",props:{modelValue:{type:Boolean},editPrompt:{},mode:{},readonly:{type:Boolean,default:!1}},emits:["update:modelValue","save"],setup(t,{expose:a,emit:n}){const s=t,l=n,d=O(()=>s.mode==="edit"),i=m(!1),c=m(null),g=["basics","schema","prompt","tools","hooks","behavior"],{activeTab:y,scrollToSection:v}=na(c,g),f=[{id:"basics",label:"Basics",icon:Pt},{id:"schema",label:"Schema",icon:_r},{id:"prompt",label:"Prompt",icon:Lt},{id:"tools",label:"Tools",icon:Wt},{id:"hooks",label:"Hooks",icon:Cr},{id:"behavior",label:"Behavior",icon:$r}],h=O(()=>P.value.length===1),_=m(""),b=m(null),u=m(""),x=m(""),p=m(""),k=m({type:"object",properties:{},required:[],additionalProperties:!1}),M=m(""),R=m(!1),W=m(!1),Z=m(""),V=m(""),P=m([]),J=m(!1),Q=m(null),le=m("auto"),me=m(""),ee=m(null),L=m(!1),C=m(!1),I=m([]),re=m([]),F=m(""),B=O(()=>{const ie=new Set(I.value);return re.value.filter(D=>!ie.has(D.id)).map(D=>({value:D.id,label:D.id,attrs:{description:D.hook}}))}),q=ie=>{ie&&(I.value.includes(ie)||(I.value=[...I.value,ie],Le(()=>{F.value=""})))},Y=m(null),U=m(!0),H=m(!1),E=ie=>{Y.value=ie,ie.on("commit",()=>{U.value=ie.context?.state.valid??!0,H.value=ie.context?.state.submitted??!1})},ne={sparkles:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z'/%3E%3Cpath d='M20 3v4'/%3E%3Cpath d='M22 5h-4'/%3E%3C/svg%3E",ban:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m4.9 4.9 14.2 14.2'/%3E%3C/svg%3E",checkCircle:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E",target:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Ccircle cx='12' cy='12' r='6'/%3E%3Ccircle cx='12' cy='12' r='2'/%3E%3C/svg%3E",signalNone:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Crect x='5' y='15' width='3' height='5' rx='1' fill='currentColor' opacity='0.2'/%3E%3Crect x='10.5' y='10' width='3' height='10' rx='1' fill='currentColor' opacity='0.2'/%3E%3Crect x='16' y='5' width='3' height='15' rx='1' fill='currentColor' opacity='0.2'/%3E%3C/svg%3E",signalLow:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Crect x='5' y='15' width='3' height='5' rx='1' fill='currentColor'/%3E%3Crect x='10.5' y='10' width='3' height='10' rx='1' fill='currentColor' opacity='0.2'/%3E%3Crect x='16' y='5' width='3' height='15' rx='1' fill='currentColor' opacity='0.2'/%3E%3C/svg%3E",signalMedium:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Crect x='5' y='15' width='3' height='5' rx='1' fill='currentColor'/%3E%3Crect x='10.5' y='10' width='3' height='10' rx='1' fill='currentColor'/%3E%3Crect x='16' y='5' width='3' height='15' rx='1' fill='currentColor' opacity='0.2'/%3E%3C/svg%3E",signalHigh:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Crect x='5' y='15' width='3' height='5' rx='1' fill='currentColor'/%3E%3Crect x='10.5' y='10' width='3' height='10' rx='1' fill='currentColor'/%3E%3Crect x='16' y='5' width='3' height='15' rx='1' fill='currentColor'/%3E%3C/svg%3E"},A=O(()=>{const ie=[{value:"auto",label:"Auto",description:"Model decides",icon:ne.sparkles},{value:"none",label:"None",description:"No tools allowed",icon:ne.ban},{value:"required",label:"Required",description:"Must call a tool",icon:ne.checkCircle}];return h.value&&ie.push({value:"function",label:"Function",description:"Call specific tool",icon:ne.target}),ie}),pe=[{value:"",label:"None",description:"Disabled",icon:ne.signalNone},{value:"low",label:"Low",description:"~20% of max_tokens",icon:ne.signalLow},{value:"medium",label:"Medium",description:"~50% of max_tokens",icon:ne.signalMedium},{value:"high",label:"High",description:"~80% of max_tokens",icon:ne.signalHigh}],ue=()=>{u.value="",_.value="",x.value="",p.value="",b.value=null,k.value={type:"object",properties:{},required:[],additionalProperties:!1},M.value="",R.value=!1,W.value=!1,Z.value="",V.value="",P.value=[],J.value=!1,le.value="auto",me.value="",ee.value=null,L.value=!1,C.value=!1,I.value=[]},ke=async ie=>{if(!ie){b.value=null;return}try{const D=await Je(`/models/${encodeURIComponent(ie)}`);if(D.ok){const se=await D.json();b.value=se.model||se}}catch(D){console.error("Error fetching model info:",D),b.value=null}};xe(p,async ie=>{ie?await ke(ie):b.value=null});const Ee=async()=>{try{const ie=await Je("/hooks");if(ie.ok){const D=await ie.json();re.value=D.hooks||[]}}catch(ie){console.error("Error fetching hooks:",ie),re.value=[]}},ae=async()=>{if(s.editPrompt?.id){i.value=!0;try{const ie=await Je(`/prompts/${encodeURIComponent(s.editPrompt.id)}`);if(ie.ok){const D=await ie.json(),se=D.prompt||D;u.value=se.name||"",_.value=se.name||"",x.value=se.tool_description||"",p.value=se.model_id||"",se.model_id&&await ke(se.model_id);let G=se.required_schema;if(typeof G=="string")try{G=JSON.parse(G)}catch{G=null}k.value=G||{type:"object",properties:{},required:[],additionalProperties:!1},M.value=se.prompt||"",R.value=se.include_chat||!1,W.value=se.include_past_tools||!1,Z.value=se.before_tool||"",V.value=se.after_tool||"";const ye=se.tools||[];P.value=ye.map(de=>typeof de=="string"?{name:de,include_text_response:!0,include_tool_calls:!0,include_errors:!0,init_user_message_property:null}:de),J.value=se.parallel_tool_calls||!1,le.value=se.tool_choice||"auto";const Se=se.reasoning||{};me.value=Se.effort||se.reasoning_effort||"",ee.value=Se.maxTokens||se.reasoning_max_tokens||null,L.value=Se.exclude||se.reasoning_exclude||!1,C.value=Se.include||se.include_reasoning||!1,I.value=se.hooks||[]}}catch(ie){console.error("Error loading prompt data:",ie)}finally{i.value=!1}}},z=async()=>{km(Y.value);const ie=/^[a-z][a-z0-9_]*$/;if(!u.value||!ie.test(u.value)){alert("Please enter a valid name (lowercase letters, numbers, and underscores only, must start with a letter)");return}if(!x.value){alert("Please enter a description");return}if(!p.value){alert("Please select a model");return}if(!M.value){alert("Please enter the prompt template");return}Q.value?.removeUnavailableTools();const D={name:u.value,tool_description:x.value,prompt:M.value,required_schema:k.value,model_id:p.value,include_chat:R.value,include_past_tools:W.value,before_tool:Z.value||null,after_tool:V.value||null,parallel_tool_calls:J.value,tool_choice:le.value,tools:P.value,reasoning_effort:me.value||null,reasoning_max_tokens:ee.value,reasoning_exclude:L.value,include_reasoning:C.value,hooks:I.value.length>0?I.value:null};d.value&&s.editPrompt?.id&&(D.id=s.editPrompt.id,_.value&&_.value!==u.value&&(D.originalName=_.value)),l("save",D)},K=()=>{ue(),l("update:modelValue",!1)};return xe(()=>P.value.length,ie=>{le.value==="function"&&ie!==1&&(le.value="auto")}),xe(()=>s.modelValue,async ie=>{ie&&(await Ee(),d.value?(ue(),await Le(),await ae()):ue())}),a({formNode:Y}),xe(()=>s.editPrompt,async ie=>{ie&&d.value&&s.modelValue&&(await Ee(),await Le(),await ae())},{immediate:!0}),(ie,D)=>{const se=Be("FormKit");return r(),N(He,{"model-value":t.modelValue,"onUpdate:modelValue":D[17]||(D[17]=G=>ie.$emit("update:modelValue",G)),title:d.value?"Edit Prompt":"Add Prompt",width:"max-w-5xl","content-padding":!1},{footer:j(()=>[e("div",Yy,[w($(De),{variant:"ghost",size:"sm",onClick:K},{default:j(()=>[X(S(t.readonly?"Close":"Cancel"),1)]),_:1}),t.readonly?T("",!0):(r(),o("div",Gy,[H.value&&!U.value?(r(),N($(tt),{key:0},{default:j(()=>[...D[29]||(D[29]=[X(" Please fix the errors above ",-1)])]),_:1})):T("",!0),w($(De),{variant:"primary",size:"sm",disabled:i.value,loading:i.value,onClick:z},{default:j(()=>[X(S(d.value?"Update Prompt":"Create Prompt"),1)]),_:1},8,["disabled","loading"])]))])]),default:j(()=>[i.value?(r(),o("div",My,[...D[18]||(D[18]=[e("span",{class:"text-neutral-500"},"Loading prompt data...",-1)])])):(r(),N(se,{key:1,type:"form",actions:!1,disabled:t.readonly,onNode:E,"form-class":"$reset flex-1 min-h-0 flex flex-col"},{default:j(()=>[e("div",Vy,[e("nav",Ey,[w($(oa),{tabs:f,"active-tab":$(y),onSelect:$(v)},null,8,["active-tab","onSelect"])]),e("div",{ref_key:"contentRef",ref:c,class:"flex-1 overflow-y-auto p-5 bg-neutral-100 dark:bg-neutral-950"},[e("div",Ly,[w($(rt),{id:"section-basics",title:"Basics",icon:$(Pt)},{default:j(()=>[e("div",Py,[w(yy,{name:u.value,"onUpdate:name":D[0]||(D[0]=G=>u.value=G),"tool-description":x.value,"onUpdate:toolDescription":D[1]||(D[1]=G=>x.value=G)},null,8,["name","tool-description"]),w(wy,{modelValue:p.value,"onUpdate:modelValue":D[2]||(D[2]=G=>p.value=G)},null,8,["modelValue"])])]),_:1},8,["icon"]),w($(rt),{id:"section-schema",title:"Schema",icon:$(_r)},{default:j(()=>[w(se,{type:"schemaEditor",modelValue:k.value,"onUpdate:modelValue":D[3]||(D[3]=G=>k.value=G),label:"","outer-class":"$reset"},null,8,["modelValue"])]),_:1},8,["icon"]),w($(rt),{id:"section-prompt",title:"Prompt",icon:$(Lt)},{footer:j(()=>[...D[19]||(D[19]=[e("p",{class:"text-xs text-neutral-500 dark:text-neutral-400"},[X(" Type "),e("kbd",{class:"px-1.5 py-0.5 rounded bg-neutral-200 dark:bg-neutral-700 font-mono text-xs"},"@"),X(" to insert schema properties or other prompts ")],-1)])]),default:j(()=>[w(_y,{"prompt-text":M.value,"onUpdate:promptText":D[4]||(D[4]=G=>M.value=G),"before-tool":Z.value,"onUpdate:beforeTool":D[5]||(D[5]=G=>Z.value=G),"after-tool":V.value,"onUpdate:afterTool":D[6]||(D[6]=G=>V.value=G),"required-schema":JSON.stringify(k.value,null,2),"current-prompt-name":d.value?u.value:void 0},null,8,["prompt-text","before-tool","after-tool","required-schema","current-prompt-name"])]),_:1},8,["icon"]),w($(rt),{id:"section-tools",title:"Tools",icon:$(Wt)},{default:j(()=>[P.value.length===0?(r(),o("div",Ay,[...D[20]||(D[20]=[e("p",{class:"text-sm text-neutral-500 dark:text-neutral-400"}," No tools selected. This prompt will run without tool access. ",-1)])])):T("",!0),w(Gr,{ref_key:"toolSelectorRef",ref:Q,modelValue:P.value,"onUpdate:modelValue":D[7]||(D[7]=G=>P.value=G),"provider-id":b.value?.provider_id||b.value?.provider,"model-id":b.value?.model},null,8,["modelValue","provider-id","model-id"])]),_:1},8,["icon"]),w($(rt),{id:"section-hooks",title:"Hooks",icon:$(Cr)},{default:j(()=>[D[23]||(D[23]=e("p",{class:"text-sm text-neutral-500 dark:text-neutral-400 mb-4"}," Select hooks to run when this prompt is active. Hooks execute in the order listed. ",-1)),I.value.length>0?(r(),o("div",jy,[(r(!0),o(he,null,we(I.value,G=>(r(),o("div",{key:G,class:"flex items-center justify-between p-3 border border-neutral-300 dark:border-neutral-600 rounded-lg"},[e("div",Dy,[e("div",Ry,S(G),1),e("div",Oy,S(re.value.find(ye=>ye.id===G)?.hook||"unknown"),1)]),e("button",{onClick:ye=>I.value=I.value.filter(Se=>Se!==G),type:"button",class:"p-1 hover:bg-neutral-200 dark:hover:bg-neutral-800 rounded transition-colors text-neutral-500 hover:text-red-500","aria-label":`Remove ${G}`},[...D[21]||(D[21]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,Uy)]))),128))])):T("",!0),B.value.length>0?(r(),N(se,{key:1,type:"selectSearch",modelValue:F.value,"onUpdate:modelValue":D[8]||(D[8]=G=>F.value=G),onInput:q,placeholder:I.value.length>0?"Add another hook...":"Select a hook","search-placeholder":"Search hooks...",options:B.value,"outer-class":"$reset"},null,8,["modelValue","placeholder","options"])):T("",!0),re.value.length===0?(r(),o("div",By,[...D[22]||(D[22]=[e("p",{class:"text-sm text-neutral-500 dark:text-neutral-400"},[X(" No hooks available. Create hooks in "),e("code",{class:"px-1.5 py-0.5 rounded bg-neutral-200 dark:bg-neutral-700 font-mono text-xs"},"agents/hooks/"),X(" to enable them here. ")],-1)])])):B.value.length===0&&I.value.length>0?(r(),o("div",Fy," All available hooks are selected. ")):T("",!0)]),_:1},8,["icon"]),w($(rt),{id:"section-behavior",title:"Behavior",icon:$($r)},{default:j(()=>[e("div",Ny,[w($(xt),{title:"Tool Behavior",class:"mb-4"}),e("div",qy,[e("div",null,[w(se,{type:"selectSearch",name:"tool_choice",modelValue:le.value,"onUpdate:modelValue":D[9]||(D[9]=G=>le.value=G),label:"Tool Choice",options:A.value,placeholder:"Select tool choice","outer-class":"$reset"},null,8,["modelValue","options"]),w($(ze),{class:"mt-1"},{default:j(()=>[...D[24]||(D[24]=[X(" Controls whether and how the model can call tools ",-1)])]),_:1})]),e("div",Hy,[D[26]||(D[26]=e("div",{class:"h-7"},null,-1)),w(se,{type:"checkbox",name:"parallel_tool_calls",modelValue:J.value,"onUpdate:modelValue":D[10]||(D[10]=G=>J.value=G),label:"Allow parallel tool calls","outer-class":"$reset"},null,8,["modelValue"]),w($(ze),{class:"mt-1"},{default:j(()=>[...D[25]||(D[25]=[X(" Allow the model to call multiple tools simultaneously ",-1)])]),_:1})])])]),e("div",Wy,[w($(xt),{title:"Context"}),w(se,{type:"checkbox",name:"include_chat",modelValue:R.value,"onUpdate:modelValue":D[11]||(D[11]=G=>R.value=G),label:"Include chat history",help:"Expose chat history to the LLM when this prompt is used as a full prompt","outer-class":"$reset"},null,8,["modelValue"]),w(se,{type:"checkbox",name:"include_past_tools",modelValue:W.value,"onUpdate:modelValue":D[12]||(D[12]=G=>W.value=G),label:"Include past tool calls",help:"Include prior tool call history in this prompt","outer-class":"$reset"},null,8,["modelValue"]),w(se,{type:"checkbox",name:"include_reasoning",modelValue:C.value,"onUpdate:modelValue":D[13]||(D[13]=G=>C.value=G),label:"Include reasoning in history",help:"Include reasoning_details from previous responses","outer-class":"$reset"},null,8,["modelValue"])]),e("div",Ky,[w($(xt),{title:"Reasoning",class:"mb-2"}),D[28]||(D[28]=e("p",{class:"text-xs text-neutral-500 dark:text-neutral-400 mb-4"}," Configure extended reasoning for models like o1, o3, Gemini Thinking, and others. Reasoning is enabled automatically when either field is set. ",-1)),e("div",Jy,[e("div",null,[w(se,{type:"selectSearch",name:"reasoning_effort",modelValue:me.value,"onUpdate:modelValue":D[14]||(D[14]=G=>me.value=G),label:"Reasoning Effort",options:pe,placeholder:"Select reasoning effort","outer-class":"$reset"},null,8,["modelValue"]),w($(ze),{class:"mt-1"},{default:j(()=>[...D[27]||(D[27]=[X(" Controls reasoning capacity. Supported by OpenAI o-series and Grok. ",-1)])]),_:1})]),w(se,{type:"unit",name:"reasoning_max_tokens",modelValue:ee.value,"onUpdate:modelValue":D[15]||(D[15]=G=>ee.value=G),label:"Max Reasoning Tokens",min:0,step:1,decimals:0,validation:"min:1024|max:32000","validation-messages":{min:"Recommended minimum is 1,024 tokens",max:"Recommended maximum is 32,000 tokens"},"validation-visibility":"live",placeholder:"Leave empty to disable",help:"Specify reasoning token limit (1024-32000)","outer-class":"$reset"},null,8,["modelValue"])]),w(se,{type:"checkbox",name:"reasoning_exclude",modelValue:L.value,"onUpdate:modelValue":D[16]||(D[16]=G=>L.value=G),label:"Exclude reasoning from response",help:"Use reasoning internally but don't return it in the response (saves tokens and cost)","outer-class":"$reset"},null,8,["modelValue"])])]),_:1},8,["icon"])])],512)])]),_:1},8,["disabled"]))]),_:1},8,["model-value","title"])}}}),Zy={key:0,class:"mb-5 rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/30 px-4 py-3 text-sm text-amber-800 dark:text-amber-200"},Xy=fe({__name:"PromptsView",setup(t){const a=bt(),n=ut(),s=m(!1),l=m(null),d=m(null),i=Dt();xe(()=>n.query.refresh,()=>{n.query.refresh&&(l.value?.refresh(),a.replace({path:"/prompts",query:{}}))});const c=()=>{s.value=!0},g=v=>{a.push(`/prompts/${v.id}`)},y=async v=>{try{const f=await fetch(ge("/api/prompts"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)});if(f.ok)s.value=!1,await new Promise(h=>setTimeout(h,100)),await l.value?.refresh();else{const h=await f.json();kt(h,d.value?.formNode)||alert(h.error||"Failed to create prompt")}}catch(f){console.error("Error creating prompt:",f),alert("Failed to create prompt")}};return(v,f)=>(r(),N(pt,null,{default:j(()=>[$(i)?T("",!0):(r(),o("div",Zy," Configuration is read-only in production. To make changes, edit your configuration files locally and deploy. ")),w(fy,{ref_key:"dataTableRef",ref:l,title:"Prompts",description:"Define and manage prompt templates for your agents.","primary-action":$(i)?{label:"Create Prompt",icon:$(Rt),handler:c}:void 0,readonly:!$(i),onAdd:c,onEdit:g},null,8,["primary-action","readonly"]),w(ca,{ref_key:"promptModalRef",ref:d,modelValue:s.value,"onUpdate:modelValue":f[0]||(f[0]=h=>s.value=h),mode:"add",onSave:y},null,8,["modelValue"])]),_:1}))}}),Qy={class:"p-8"},ek={key:0,class:"flex items-center justify-center min-h-[400px]"},tk={key:2,class:"flex items-center justify-center min-h-[400px]"},rk=fe({__name:"PromptEditView",setup(t){const a=Dt(),n=bt(),s=ut(),l=m(!0),d=m(null),i=m(!0),c=m(null),g=async()=>{const f=s.params.id;if(!f){n.push("/prompts");return}i.value=!0;try{const h=await fetch(ge(`/api/prompts/${encodeURIComponent(f)}`));if(h.ok){const _=await h.json();d.value=_.prompt||_}else alert("Prompt not found"),n.push("/prompts")}catch(h){console.error("Error loading prompt:",h),alert("Failed to load prompt"),n.push("/prompts")}finally{i.value=!1}},y=async f=>{try{const{originalName:h,..._}=f,b=h||_.id,u=await fetch(ge(`/api/prompts/${encodeURIComponent(b)}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(_)});if(u.ok)n.push({path:"/prompts",query:{refresh:Date.now().toString()}});else{const x=await u.json();kt(x,c.value?.formNode)||alert(x.error||"Failed to update prompt")}}catch(h){console.error("Error updating prompt:",h),alert("Failed to update prompt")}},v=f=>{f||n.push("/prompts")};return Pe(()=>{g()}),xe(l,f=>{f||n.push("/prompts")}),(f,h)=>(r(),o("div",Qy,[i.value?(r(),o("div",ek,[...h[1]||(h[1]=[e("span",{class:"text-neutral-500"},"Loading prompt...",-1)])])):d.value?(r(),N(ca,{key:1,ref_key:"promptModalRef",ref:c,modelValue:l.value,"onUpdate:modelValue":[h[0]||(h[0]=_=>l.value=_),v],mode:"edit","edit-prompt":d.value,readonly:!$(a),onSave:y},null,8,["modelValue","edit-prompt","readonly"])):(r(),o("div",tk,[...h[2]||(h[2]=[e("span",{class:"text-neutral-500"},"Prompt not found",-1)])]))]))}}),ak={class:"space-y-4"},ok={key:0},nk={key:1},lk={class:"px-1 py-0.5 bg-neutral-100 dark:bg-neutral-800 rounded"},sk={key:2,class:"space-y-3"},ik={class:"flex items-center justify-between"},uk={key:0,class:"text-sm text-neutral-500 dark:text-neutral-400"},dk={key:1,class:"space-y-3"},ck={class:"grid grid-cols-2 gap-x-4 gap-y-2"},pk={class:"grid grid-cols-2 gap-4"},mk={key:3,class:"space-y-3"},vk={key:0,class:"text-sm text-neutral-500 dark:text-neutral-400"},fk={key:1,class:"grid grid-cols-1 gap-2"},hk=["value"],gk={class:"flex-1 min-w-0"},bk={class:"font-medium text-sm"},xk={class:"text-xs text-neutral-500 dark:text-neutral-400 mt-0.5"},yk={key:0,class:"mt-1"},kk={class:"text-xs text-amber-600 dark:text-amber-400"},wk={key:4,class:"space-y-3"},_k={class:"flex items-center justify-between"},$k={key:0,class:"flex gap-2"},Ck={key:0,class:"flex items-center gap-2 py-4"},Sk={key:1,class:"py-4 text-sm text-neutral-500 dark:text-neutral-400"},Tk={key:2,class:"space-y-2"},Ik=["checked","onChange"],zk={class:"flex-1 min-w-0"},Mk={class:"flex items-center gap-2"},Vk={class:"font-medium text-sm"},Ek={key:0,class:"px-1.5 py-0.5 text-xs font-medium rounded bg-neutral-100 dark:bg-neutral-800 text-neutral-600 dark:text-neutral-400"},Lk={class:"flex flex-wrap gap-x-4 gap-y-1 mt-1 text-xs text-neutral-500 dark:text-neutral-400"},Pk={key:0},Ak={key:1},jk={key:5,class:"space-y-3"},Dk={class:"flex items-center justify-between gap-4"},Rk={key:1},Ok={class:"flex gap-2"},Uk=fe({__name:"ModelModal",props:{modelValue:{type:Boolean},editModel:{},mode:{default:"add"},readonly:{type:Boolean,default:!1}},emits:["update:modelValue","save"],setup(t,{expose:a,emit:n}){const s=t,l=n,d=m([]),i=m(""),c=m(""),g=m([]),y=m(!1),v=m(!1),f=m([]),h=m([]),_=m(!1),b=m({supportsImages:!1,supportsToolCalls:!0,supportsStreaming:!0,supportsJsonMode:!0}),u=m(null),x=m(!1),p=m([]),k=m([]),M=m(!1),R=m([]),W=m(!1),Z=O(()=>R.value.map(de=>({value:de.id,label:de.name,description:de.provider_id||de.provider,icon:de.iconId}))),V=async()=>{W.value=!0;try{const de=await fetch(ge("/api/models"));if(de.ok){const ce=await de.json();R.value=ce.models||[]}}catch(de){console.error("Error fetching configured models:",de)}finally{W.value=!1}},P=m([]),J=O(()=>s.mode==="edit"),Q=m(null),le=m(!0),me=m(!1),ee=de=>{Q.value=de,de.on("commit",()=>{le.value=de.context?.state.valid??!0,me.value=de.context?.state.submitted??!1})},L=m(""),C=m(""),I=de=>{let ce=de.replace(/[^a-zA-Z0-9\s_-]/g,"");return ce=ce.trim().toLowerCase().replace(/[\s-]+/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,""),ce},re=de=>{C.value=I(de)},F=m(!1),B=m(null),q=O(()=>d.value.filter(de=>de.hasApiKey).map(de=>({value:de.name,label:de.name,description:de.sdk==="openai-sdk"?"OpenAI SDK":de.sdk==="openrouter"?"OpenRouter":de.sdk,icon:de.iconId}))),Y=O(()=>g.value.map(de=>({...de,icon:de.iconId}))),U=O(()=>!J.value||!B.value||F.value?!1:C.value!==B.value.name||i.value!==B.value.provider||c.value!==B.value.model||JSON.stringify(h.value.sort())!==JSON.stringify(B.value.endpoints.sort())||JSON.stringify(P.value)!==JSON.stringify(B.value.fallbacks)||JSON.stringify(b.value)!==JSON.stringify(B.value.capabilities)||JSON.stringify(k.value.sort())!==JSON.stringify(B.value.providerTools.sort())),H=O(()=>d.value.find(ce=>ce.name===i.value)?.sdk==="openrouter"),E=async()=>{y.value=!0;try{const de=await fetch(ge("/api/providers"));if(de.ok){const ce=await de.json();d.value=ce.providers||[]}}catch(de){console.error("Error fetching providers:",de)}finally{y.value=!1}},ne=async()=>{if(!i.value){g.value=[];return}v.value=!0;try{const de=await fetch(ge("/api/models/available"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:i.value})});if(de.ok){const ce=await de.json();g.value=ce.models||[]}else{const ce=await de.json();console.error("Error fetching models:",ce),g.value=[],alert(ce.error||"Failed to fetch available models")}}catch(de){console.error("Error fetching models:",de),g.value=[]}finally{v.value=!1}},A=async()=>{if(!(!i.value||!c.value)){x.value=!0;try{const de=await fetch(ge("/api/models/capabilities"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:i.value,modelId:c.value})});if(de.ok){const ce=await de.json();ce.capabilities&&(u.value=ce.capabilities,b.value={supportsImages:ce.capabilities.supportsImages??!1,supportsToolCalls:ce.capabilities.supportsToolCalls??!0,supportsStreaming:ce.capabilities.supportsStreaming??!0,supportsJsonMode:ce.capabilities.supportsJsonMode??!0,maxContextTokens:ce.capabilities.maxContextTokens,maxOutputTokens:ce.capabilities.maxOutputTokens})}}catch(de){console.error("Error fetching capabilities:",de)}finally{x.value=!1}}},pe=async()=>{if(!i.value||!c.value){p.value=[];return}M.value=!0;try{const de=await fetch(ge(`/api/providers/${i.value}/tools?model=${encodeURIComponent(c.value)}`));if(de.ok){const ce=await de.json();p.value=ce.tools||[],J.value||(k.value=p.value.map(Ie=>Ie.name))}else p.value=[]}catch(de){console.error("Error fetching provider tools:",de),p.value=[]}finally{M.value=!1}},ue=()=>{b.value={supportsImages:!1,supportsToolCalls:!0,supportsStreaming:!0,supportsJsonMode:!0},u.value=null},ke=de=>{const ce=h.value.indexOf(de);ce===-1?h.value.push(de):h.value.splice(ce,1)},Ee=()=>{h.value=f.value.map(de=>de.id)},ae=()=>{h.value=[]},z=de=>{const ce=de*1e6;return ce>=1?`$${ce.toFixed(2)}/M`:`$${ce.toFixed(4)}/M`},K=()=>{u.value&&(b.value={supportsImages:u.value.supportsImages??!1,supportsToolCalls:u.value.supportsToolCalls??!0,supportsStreaming:u.value.supportsStreaming??!0,supportsJsonMode:u.value.supportsJsonMode??!0,maxContextTokens:u.value.maxContextTokens,maxOutputTokens:u.value.maxOutputTokens})},ie=()=>{C.value="",L.value="",i.value="",c.value="",g.value=[],P.value=[],f.value=[],h.value=[],p.value=[],k.value=[],ue(),B.value=null,F.value=!1,le.value=!0,me.value=!1,Q.value?.reset()},D=async()=>{if(s.editModel){F.value=!0;try{await E(),C.value=s.editModel.name||"",L.value=s.editModel.name||"",i.value=s.editModel.provider_id||s.editModel.provider,await ne(),c.value=s.editModel.model,await G(),s.editModel.included_providers&&s.editModel.included_providers.length>0&&(h.value=s.editModel.included_providers),await se(),s.editModel.capabilities?b.value={supportsImages:s.editModel.capabilities.supportsImages??!1,supportsToolCalls:s.editModel.capabilities.supportsToolCalls??!0,supportsStreaming:s.editModel.capabilities.supportsStreaming??!0,supportsJsonMode:s.editModel.capabilities.supportsJsonMode??!0,maxContextTokens:s.editModel.capabilities.maxContextTokens,maxOutputTokens:s.editModel.capabilities.maxOutputTokens}:await A(),await pe(),s.editModel.providerTools&&Array.isArray(s.editModel.providerTools)&&(k.value=s.editModel.providerTools),B.value={name:C.value,provider:i.value,model:c.value,endpoints:[...h.value],fallbacks:[...P.value],capabilities:{...b.value},providerTools:[...k.value]}}finally{F.value=!1}}};xe(()=>s.modelValue,async de=>{de?(V(),J.value&&s.editModel?await D():(await E(),ie())):ie()});const se=async()=>{if(s.editModel?.id){if(s.editModel.fallbacks&&Array.isArray(s.editModel.fallbacks)){P.value=s.editModel.fallbacks.map(de=>typeof de=="string"?de:de.id);return}try{const de=await fetch(ge(`/api/models/${encodeURIComponent(s.editModel.id)}/fallbacks`));if(de.ok){const ce=await de.json();P.value=ce.fallbacks.map(Ie=>Ie.fallback_model_id)}}catch(de){console.error("Error loading fallbacks:",de)}}};xe(i,async(de,ce)=>{F.value||J.value&&!ce&&de===(s.editModel?.provider_id||s.editModel?.provider)||(c.value="",f.value=[],h.value=[],i.value&&await ne())});const G=async()=>{if(!c.value||!i.value){f.value=[];return}const de=d.value.find(Ie=>Ie.name===i.value);if(!de||de.sdk!=="openrouter"){f.value=[];return}const ce=Y.value.find(Ie=>Ie.value===c.value);if(!ce?.slug){console.error("Model slug not found"),f.value=[];return}_.value=!0;try{const Ie=await fetch(ge("/api/models/endpoints"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:i.value,modelSlug:ce.slug})});if(Ie.ok){const ve=await Ie.json();f.value=ve.endpoints||[],J.value||(h.value=f.value.map(be=>be.id))}else{const ve=await Ie.json();console.error("Error fetching endpoints:",ve),f.value=[]}}catch(Ie){console.error("Error fetching endpoints:",Ie),f.value=[]}finally{_.value=!1}};xe(c,async(de,ce)=>{F.value||J.value&&!ce&&de===s.editModel?.model||(c.value?(await G(),await A(),await pe(),ce&&de!==ce&&(h.value=f.value.map(Ie=>Ie.id))):(f.value=[],h.value=[],p.value=[],k.value=[],ue()))});const ye=()=>{const de=H.value?h.value:[],ce={name:C.value,model:c.value,provider:i.value,included_providers:de,fallbacks:P.value,capabilities:b.value,providerTools:k.value};J.value&&s.editModel?.id&&(ce.id=s.editModel.id,L.value&&L.value!==C.value&&(ce.originalName=L.value)),l("save",ce)};a({formNode:Q});const Se=()=>{ie(),l("update:modelValue",!1)};return(de,ce)=>{const Ie=Be("FormKit");return r(),N(He,{"model-value":t.modelValue,"onUpdate:modelValue":ce[10]||(ce[10]=ve=>de.$emit("update:modelValue",ve)),title:J.value?"Edit Model":"Add Model",width:"max-w-2xl","min-height":"min-h-[36rem]","has-changes":U.value},{footer:j(()=>[e("div",Dk,[!t.readonly&&me.value&&!le.value?(r(),N($(tt),{key:0},{default:j(()=>[...ce[22]||(ce[22]=[X(" Please fix the errors above before submitting. ",-1)])]),_:1})):(r(),o("div",Rk)),e("div",Ok,[w($(De),{variant:"ghost",size:"sm",onClick:Se},{default:j(()=>[X(S(t.readonly?"Close":"Cancel"),1)]),_:1}),t.readonly?T("",!0):(r(),N($(De),{key:0,variant:"primary",size:"sm",type:"submit",form:"model-form"},{default:j(()=>[X(S(J.value?"Update Model":"Add Model"),1)]),_:1}))])])]),default:j(()=>[w(Ie,{type:"form",id:"model-form",actions:!1,disabled:t.readonly,onSubmit:ye,onNode:ee},{default:j(()=>[e("div",ak,[w(Ie,{type:"selectSearch",name:"provider",modelValue:i.value,"onUpdate:modelValue":ce[0]||(ce[0]=ve=>i.value=ve),options:q.value,label:"Provider",placeholder:"Select a provider",disabled:y.value||J.value&&!!s.editModel,validation:"required","validation-visibility":"submit"},null,8,["modelValue","options","disabled"]),i.value?(r(),o("div",ok,[w(Ie,{type:"selectSearch",name:"model",modelValue:c.value,"onUpdate:modelValue":ce[1]||(ce[1]=ve=>c.value=ve),options:Y.value,label:"Model",placeholder:"Select a model","search-placeholder":"Search models...",loading:v.value,validation:"required","validation-visibility":"submit"},null,8,["modelValue","options","loading"])])):T("",!0),c.value?(r(),o("div",nk,[w(Ie,{type:"text",name:"name","model-value":C.value,onInput:re,label:"Name",placeholder:"e.g., coding_model, planning_model, fast_response",validation:"required|snakeCase","validation-visibility":"blur",help:C.value?void 0:"A descriptive name for this model. This becomes the filename and reference ID."},null,8,["model-value","help"]),C.value?(r(),N($(ze),{key:0,class:"mt-1"},{default:j(()=>[ce[11]||(ce[11]=X(" Will be saved as: ",-1)),e("code",lk,S(C.value),1)]),_:1})):T("",!0)])):T("",!0),c.value?(r(),o("div",sk,[e("div",ik,[ce[12]||(ce[12]=e("label",{class:"block text-sm font-medium"},"Model Capabilities",-1)),u.value?(r(),o("button",{key:0,onClick:K,type:"button",class:"text-xs text-accent-600 dark:text-accent-400 hover:underline"}," Reset to detected ")):T("",!0)]),ce[13]||(ce[13]=e("p",{class:"text-xs text-neutral-500 dark:text-neutral-400 -mt-1"}," Auto-detected from the provider. Override if needed. ",-1)),x.value?(r(),o("div",uk," Detecting capabilities... ")):(r(),o("div",dk,[e("div",ck,[w(Ie,{type:"checkbox",modelValue:b.value.supportsImages,"onUpdate:modelValue":ce[2]||(ce[2]=ve=>b.value.supportsImages=ve),label:"Vision/Images"},null,8,["modelValue"]),w(Ie,{type:"checkbox",modelValue:b.value.supportsToolCalls,"onUpdate:modelValue":ce[3]||(ce[3]=ve=>b.value.supportsToolCalls=ve),label:"Tool Calls"},null,8,["modelValue"]),w(Ie,{type:"checkbox",modelValue:b.value.supportsStreaming,"onUpdate:modelValue":ce[4]||(ce[4]=ve=>b.value.supportsStreaming=ve),label:"Streaming"},null,8,["modelValue"]),w(Ie,{type:"checkbox",modelValue:b.value.supportsJsonMode,"onUpdate:modelValue":ce[5]||(ce[5]=ve=>b.value.supportsJsonMode=ve),label:"JSON Mode"},null,8,["modelValue"])]),e("div",pk,[w(Ie,{type:"unit",modelValue:b.value.maxContextTokens,"onUpdate:modelValue":ce[6]||(ce[6]=ve=>b.value.maxContextTokens=ve),label:"Max Context Tokens",placeholder:"e.g., 128,000",unit:"",decimals:"0",step:"1000",min:"0"},null,8,["modelValue"]),w(Ie,{type:"unit",modelValue:b.value.maxOutputTokens,"onUpdate:modelValue":ce[7]||(ce[7]=ve=>b.value.maxOutputTokens=ve),label:"Max Output Tokens",placeholder:"e.g., 16,384",unit:"",decimals:"0",step:"1000",min:"0"},null,8,["modelValue"])])]))])):T("",!0),c.value&&p.value.length>0?(r(),o("div",mk,[ce[14]||(ce[14]=e("label",{class:"block text-sm font-medium"},"Provider Tools",-1)),ce[15]||(ce[15]=e("p",{class:"text-xs text-neutral-500 dark:text-neutral-400 -mt-1"}," Built-in tools available for this model. ",-1)),M.value?(r(),o("div",vk," Loading provider tools... ")):(r(),o("div",fk,[(r(!0),o(he,null,we(p.value,ve=>(r(),o("label",{key:ve.name,class:oe(["flex items-start gap-3 p-3 border rounded cursor-pointer hover:bg-neutral-50 dark:hover:bg-neutral-800/50 transition-colors",k.value.includes(ve.name)?"border-black dark:border-white":"border-neutral-200 dark:border-neutral-700"])},[Ae(e("input",{type:"checkbox",value:ve.name,"onUpdate:modelValue":ce[8]||(ce[8]=be=>k.value=be),class:"mt-0.5 h-4 w-4 rounded border-neutral-300 dark:border-neutral-600 text-black dark:text-white focus:ring-black dark:focus:ring-white accent-black dark:accent-white"},null,8,hk),[[Gt,k.value]]),e("div",gk,[e("div",bk,S(ve.name),1),e("div",xk,S(ve.description),1),ve.tenvs&&ve.tenvs.length>0?(r(),o("div",yk,[e("span",kk," Requires: "+S(ve.tenvs.filter(be=>be.required).map(be=>be.name).join(", ")||"none (optional config available)"),1)])):T("",!0)])],2))),128))]))])):T("",!0),c.value&&H.value?(r(),o("div",wk,[e("div",_k,[ce[17]||(ce[17]=e("label",{class:"block text-sm font-medium"},"Available Providers",-1)),f.value.length>0?(r(),o("div",$k,[e("button",{type:"button",onClick:Ee,class:"text-xs text-accent-600 dark:text-accent-400 hover:underline"}," Select all "),ce[16]||(ce[16]=e("span",{class:"text-xs text-neutral-300 dark:text-neutral-600"},"|",-1)),e("button",{type:"button",onClick:ae,class:"text-xs text-accent-600 dark:text-accent-400 hover:underline"}," Clear ")])):T("",!0)]),ce[19]||(ce[19]=e("p",{class:"text-xs text-neutral-500 dark:text-neutral-400 -mt-1"}," OpenRouter routes to the cheapest available provider. ",-1)),_.value?(r(),o("div",Ck,[w(Ve,{class:"w-4 h-4"}),ce[18]||(ce[18]=e("span",{class:"text-sm text-neutral-500 dark:text-neutral-400"},"Loading providers...",-1))])):f.value.length===0?(r(),o("div",Sk," No providers available for this model ")):(r(),o("div",Tk,[(r(!0),o(he,null,we(f.value,ve=>(r(),o("label",{key:ve.id,class:oe(["flex items-start gap-3 p-3 border rounded-md cursor-pointer transition-colors",[h.value.includes(ve.id)?"border-accent-500 dark:border-accent-400 bg-accent-50/50 dark:bg-accent-900/20":"border-neutral-200 dark:border-neutral-700 hover:border-neutral-300 dark:hover:border-neutral-600"]])},[e("input",{type:"checkbox",checked:h.value.includes(ve.id),onChange:be=>ke(ve.id),class:"mt-0.5 h-4 w-4 rounded border-neutral-300 dark:border-neutral-600 text-accent-600 dark:text-accent-500 focus:ring-accent-500 dark:focus:ring-accent-400 accent-accent-600 dark:accent-accent-500"},null,40,Ik),e("div",zk,[e("div",Mk,[e("span",Vk,S(ve.name),1),ve.quantization&&ve.quantization!=="unknown"?(r(),o("span",Ek,S(ve.quantization),1)):T("",!0)]),e("div",Lk,[e("span",null," Input: "+S(z(ve.pricing.prompt)),1),e("span",null," Output: "+S(z(ve.pricing.completion)),1),ve.maxPromptTokens?(r(),o("span",Pk," Max prompt: "+S(ve.maxPromptTokens.toLocaleString()),1)):T("",!0),ve.maxCompletionTokens?(r(),o("span",Ak," Max output: "+S(ve.maxCompletionTokens.toLocaleString()),1)):T("",!0)])])],2))),128))]))])):T("",!0),c.value?(r(),o("div",jk,[ce[20]||(ce[20]=e("label",{class:"block text-sm font-medium"},"Fallback Models",-1)),ce[21]||(ce[21]=e("p",{class:"text-xs text-neutral-500 dark:text-neutral-400 -mt-1"}," Used in order if the primary model fails. ",-1)),w(Ie,{type:"sortableMultiSelect",modelValue:P.value,"onUpdate:modelValue":ce[9]||(ce[9]=ve=>P.value=ve),options:Z.value,loading:W.value,placeholder:"Add fallback model...","search-placeholder":"Search models...","add-label":"Add another model"},null,8,["modelValue","options","loading"])])):T("",!0)])]),_:1},8,["disabled"])]),_:1},8,["model-value","title","has-changes"])}}}),Bk={key:0,class:"mb-5 rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/30 px-4 py-3 text-sm text-amber-800 dark:text-amber-200"},Fk={class:"flex items-center gap-2"},Nk=["src","alt"],qk={class:"text-sm text-neutral-600 dark:text-neutral-400 font-mono"},Hk={key:0,class:"space-y-0.5"},Wk=["title"],Kk={class:"shrink-0 font-mono pr-2"},Jk=["src","alt"],Yk={class:"truncate"},Gk={key:1,class:"text-neutral-400 dark:text-neutral-600 text-sm"},Zk=fe({__name:"ModelsView",setup(t){const a=m(!1),n=m([]),s=m(!1),l=m(null),d=m("add"),i=m(null),c=Dt(),g=[{key:"name",label:"Name",width:"w-1/4",sortable:!0},{key:"model",label:"Model",width:"w-1/4",sortable:!0,filterable:!0,filterIcon:(x,p)=>`/api/providers/${p.provider}/icon?model=${encodeURIComponent(p.model||"")}`},{key:"provider",label:"Provider",width:"w-1/4",sortable:!0,filterable:!0,filterIcon:(x,p)=>`/api/providers/${p.provider}/icon`},{key:"fallbacks",label:"Fallbacks",width:"w-1/4"}],y=x=>{l.value=x,d.value="edit",a.value=!0},v=[{icon:"edit",label:"Edit",handler:x=>y(x)},{icon:"delete",label:"Delete",confirm:!0,confirmMessage:"Are you sure you want to delete this model? This action cannot be undone.",variant:"danger",handler:async x=>{await b(x.id)}}],f=O(()=>c?v:v.filter(x=>x.variant!=="danger")),h=async()=>{s.value=!0;try{const x=await fetch(ge("/api/models"));if(!x.ok)throw new Error("Failed to fetch models");const p=await x.json();n.value=p.models||[]}catch(x){console.error("Error fetching models:",x),n.value=[]}finally{s.value=!1}},_=async x=>{try{if(l.value){const{originalName:p,...k}=x,M=p||l.value.id,R=await fetch(ge(`/api/models/${encodeURIComponent(M)}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)});if(!R.ok){const W=await R.json();kt(W,i.value?.formNode)||alert(W.error||"Failed to update model");return}}else{const p=await fetch(ge("/api/models"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)});if(!p.ok){const k=await p.json();kt(k,i.value?.formNode)||alert(k.error||"Failed to add model");return}}await h(),a.value=!1,l.value=null,d.value="add"}catch(p){console.error("Error saving model:",p),alert("Failed to save model")}},b=async x=>{try{const p=await fetch(ge(`/api/models/${encodeURIComponent(x)}`),{method:"DELETE"});if(!p.ok){const k=await p.json();alert(k.error||"Failed to delete model");return}await h()}catch(p){console.error("Error deleting model:",p),alert("Failed to delete model")}},u=()=>{d.value="add",l.value=null,a.value=!0};return Pe(()=>{h()}),(x,p)=>(r(),N(pt,null,{default:j(()=>[$(c)?T("",!0):(r(),o("div",Bk," Configuration is read-only in production. To make changes, edit your configuration files locally and deploy. ")),w(ot,{title:"Models",description:"Configure AI models from your connected providers. Models define which AI capabilities are available to your agents.","primary-action":$(c)?{label:"Add Model",icon:$(Rt),handler:u}:void 0,columns:g,data:n.value,actions:f.value,loading:s.value,sortable:"",searchable:"","search-placeholder":"Search models...","empty-message":"No models configured yet. Add your first model to get started.",onRowClick:y},{"cell-name":j(({value:k,row:M})=>[e("div",Fk,[M.provider?(r(),o("img",{key:0,src:`/api/providers/${M.provider}/icon?model=${encodeURIComponent(M.model||"")}`,class:"w-5 h-5 shrink-0",alt:M.provider},null,8,Nk)):T("",!0),e("span",null,S(k),1)])]),"cell-model":j(({value:k})=>[e("span",qk,S(k||"—"),1)]),"cell-fallbacks":j(({value:k})=>[k&&k.length>0?(r(),o("div",Hk,[(r(!0),o(he,null,we(k,(M,R)=>(r(),o("div",{key:M.id,class:"text-sm text-neutral-600 dark:text-neutral-400 flex items-center",title:M.name},[e("span",Kk,S(R===k.length-1?"└─":"├─"),1),M.provider?(r(),o("img",{key:0,src:`/api/providers/${M.provider}/icon?model=${encodeURIComponent(M.model||"")}`,class:"w-4 h-4 shrink-0 mr-1.5",alt:M.provider},null,8,Jk)):T("",!0),e("span",Yk,S(M.name),1)],8,Wk))),128))])):(r(),o("span",Gk," None "))]),_:1},8,["primary-action","data","actions","loading"]),w(Uk,{ref_key:"modelModalRef",ref:i,modelValue:a.value,"onUpdate:modelValue":[p[0]||(p[0]=k=>a.value=k),p[1]||(p[1]=k=>{a.value=k,k||(l.value=null,d.value="add")})],"edit-model":l.value,mode:d.value,readonly:!$(c),onSave:_},null,8,["modelValue","edit-model","mode","readonly"])]),_:1}))}}),Xk={class:"space-y-4"},Qk={class:"space-y-1"},e2={class:"relative"},t2={key:0,class:"flex items-center gap-2"},r2=["src","alt"],a2={key:1,class:"text-neutral-500"},o2={key:0,class:"absolute z-10 w-full mt-1 bg-white dark:bg-black border-2 border-neutral-300 dark:border-neutral-600 rounded shadow-lg max-h-60 overflow-auto"},n2=["onClick"],l2=["src","alt"],s2={key:0,class:"text-xs text-red-500 dark:text-red-400"},i2={class:"flex gap-2 justify-end"},u2=fe({__name:"AddProviderModal",props:{modelValue:{type:Boolean}},emits:["update:modelValue","save"],setup(t,{emit:a}){const n=a,s=m([]),l=m(!1),d=m(!1),i=m(""),c=m(""),g=async()=>{l.value=!0;try{const x=await fetch(ge("/api/providers"));if(x.ok){const p=await x.json();s.value=(p.providers||[]).map(k=>({value:k.name,label:k.label||k.name,icon:k.iconId,sdk:k.sdk}))}}catch(x){console.error("Error fetching providers:",x)}finally{l.value=!1}};Pe(()=>{g()});const y=O(()=>s.value.find(x=>x.value===i.value)),v=()=>{setTimeout(()=>{d.value=!1},200)},f=x=>{i.value=x,d.value=!1,c.value=""},h=O(()=>i.value==="custom"||i.value==="openai"),_=m("");xe(i,x=>{if(x&&!_.value){const p=s.value.find(k=>k.value===x);p&&(_.value=p.label)}});const b=x=>{if(!i.value){c.value="Provider type is required";return}n("save",{name:x.name,type:i.value,apiKey:x.apiKey,baseUrl:x.baseUrl}),u()},u=()=>{Et("add-provider-form"),i.value="",_.value="",c.value="",n("update:modelValue",!1)};return(x,p)=>{const k=Be("FormKit");return r(),N(He,{"model-value":t.modelValue,"onUpdate:modelValue":p[2]||(p[2]=M=>x.$emit("update:modelValue",M)),title:"Add Provider",width:"max-w-md"},{footer:j(()=>[e("div",i2,[w($(De),{variant:"ghost",size:"sm",onClick:u},{default:j(()=>[...p[5]||(p[5]=[X(" Cancel ",-1)])]),_:1}),w($(De),{variant:"primary",size:"sm",type:"submit",form:"add-provider-form"},{default:j(()=>[...p[6]||(p[6]=[X(" Add Provider ",-1)])]),_:1})])]),default:j(()=>[w(k,{id:"add-provider-form",type:"form",actions:!1,onSubmit:b},{default:j(()=>[e("div",Xk,[e("div",Qk,[p[4]||(p[4]=e("label",{class:"block text-sm font-medium"},[X(" Provider Type "),e("span",{class:"text-red-500"},"*")],-1)),e("div",e2,[e("button",{type:"button",onClick:p[0]||(p[0]=M=>d.value=!d.value),onBlur:v,class:oe(["w-full px-3 py-2 bg-white dark:bg-black border rounded font-mono text-sm text-left focus:outline-none focus:ring-2 focus:ring-accent-500 dark:focus:ring-accent-400 transition-colors",[c.value?"border-red-500 dark:border-red-400":"border-neutral-300 dark:border-neutral-600"]])},[y.value?(r(),o("div",t2,[e("img",{src:y.value.icon,alt:y.value.label,class:"w-5 h-5"},null,8,r2),e("span",null,S(y.value.label),1)])):(r(),o("span",a2,"Select a provider")),p[3]||(p[3]=e("div",{class:"absolute inset-y-0 right-0 flex items-center px-2 pointer-events-none"},[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"})])],-1))],34),d.value?(r(),o("div",o2,[(r(!0),o(he,null,we(s.value,M=>(r(),o("button",{key:M.value,type:"button",onClick:R=>f(M.value),class:"w-full px-3 py-2 text-left hover:bg-accent-50 dark:hover:bg-accent-900/20 transition-colors flex items-center gap-2"},[e("img",{src:M.icon,alt:M.label,class:"w-5 h-5"},null,8,l2),e("span",null,S(M.label),1)],8,n2))),128))])):T("",!0)]),c.value?(r(),o("p",s2,S(c.value),1)):T("",!0)]),w(k,{type:"text",name:"name",label:"Provider Name",placeholder:"e.g., My OpenAI Provider",validation:"required",modelValue:_.value,"onUpdate:modelValue":p[1]||(p[1]=M=>_.value=M),"validation-messages":{required:"Provider name is required"}},null,8,["modelValue"]),w(k,{type:"password",name:"apiKey",label:"API Key",placeholder:"sk-...",validation:"required","validation-messages":{required:"API key is required"}}),h.value?(r(),N(k,{key:0,type:"text",name:"baseUrl",label:"Base URL",placeholder:"https://api.example.com",validation:i.value==="custom"?"required":"","validation-messages":{required:"Base URL is required for custom providers"}},null,8,["validation"])):T("",!0)])]),_:1})]),_:1},8,["model-value"])}}}),d2={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function c2(t,a){return r(),o("svg",d2,[...a[0]||(a[0]=[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])}const p2=Te({name:"lucide-check",render:c2}),m2={class:"flex items-center gap-2"},v2=["src","alt"],f2={key:0,class:"inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded-full bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400"},h2={key:1,class:"inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded-full bg-neutral-100 text-neutral-500 dark:bg-neutral-800 dark:text-neutral-400"},g2=fe({__name:"ProvidersView",setup(t){const a=m(!1),n=m([]),s=m(!1),l={"openai-sdk":"OpenAI SDK",openrouter:"OpenRouter",openai:"OpenAI"},d=f=>l[f]||f,i=[{key:"name",label:"Name",width:"w-1/3",sortable:!0},{key:"sdk",label:"SDK Type",width:"w-1/3",sortable:!0,formatter:f=>d(f)},{key:"hasApiKey",label:"API Key",width:"w-1/3"}],c=[{icon:"delete",label:"Delete",confirm:!0,confirmMessage:"Are you sure you want to delete this provider? This action cannot be undone.",variant:"danger",handler:async f=>{await v(f.name)}}],g=async()=>{s.value=!0;try{const f=await fetch(ge("/api/providers"));if(!f.ok)throw new Error("Failed to fetch providers");const h=await f.json();n.value=h.providers||[]}catch(f){console.error("Error fetching providers:",f),n.value=[]}finally{s.value=!1}},y=async f=>{try{const h=await fetch(ge("/api/providers"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(!h.ok){const _=await h.json();alert(_.error||"Failed to add provider");return}await g(),a.value=!1}catch(h){console.error("Error adding provider:",h),alert("Failed to add provider")}},v=async f=>{try{const h=await fetch(ge(`/api/providers/${encodeURIComponent(f)}`),{method:"DELETE"});if(!h.ok){const _=await h.json();_.modelCount?alert(`${_.error}
|
|
53
53
|
|
|
54
|
-
This provider has ${b.modelCount} associated model(s).`):alert(b.error||"Failed to delete provider");return}await h()}catch(y){console.error("Error deleting provider:",y),alert("Failed to delete provider")}};return Pe(()=>{h()}),(f,y)=>(r(),q(pt,null,{default:j(()=>[w(ot,{title:"Providers",description:"Manage API providers and authentication keys. All API keys are encrypted at rest.","primary-action":{label:"Add Provider",icon:S(jt),handler:()=>o.value=!0},columns:s,data:a.value,actions:m,loading:i.value,sortable:"",searchable:"","search-placeholder":"Search providers...","empty-message":"No providers configured yet. Add your first provider to get started."},{"cell-sdk":j(({value:b,row:v})=>[e("div",a2,[e("img",{src:`/api/providers/${v.name}/icon`,alt:u(b),class:"w-5 h-5"},null,8,o2),e("span",null,C(u(b)),1)])]),"cell-hasApiKey":j(({value:b})=>[b?(r(),n("span",n2,[w(S(r2),{class:"w-3.5 h-3.5"}),y[1]||(y[1]=X(" Configured ",-1))])):(r(),n("span",l2,[w(S(Pt),{class:"w-3.5 h-3.5"}),y[2]||(y[2]=X(" Not configured ",-1))]))]),_:1},8,["primary-action","data","loading"]),w(Qk,{modelValue:o.value,"onUpdate:modelValue":y[0]||(y[0]=b=>o.value=b),onSave:x},null,8,["modelValue"])]),_:1}))}}),i2={class:"font-medium mb-1"},u2={id:"functions"},d2=["onClick"],c2={key:1,class:"text-left font-medium text-red-600 dark:text-red-400"},p2={class:"flex justify-end"},m2=["onClick"],v2={key:1,class:"text-neutral-400 text-sm"},f2={id:"prompts",class:"mt-12"},h2=["onClick"],g2={class:"text-neutral-600 dark:text-neutral-400"},b2={class:"text-sm text-neutral-500 dark:text-neutral-400"},x2={id:"agents",class:"mt-12"},y2=["onClick"],k2={class:"text-neutral-600 dark:text-neutral-400"},w2={class:"text-sm text-neutral-500 dark:text-neutral-400"},_2={class:"flex items-center gap-2"},$2={key:0,class:"space-y-4"},C2={class:"text-lg font-medium mb-2"},S2={class:"text-sm text-neutral-600 dark:text-neutral-400 mb-4"},T2={key:0,class:"h-96 flex items-center justify-center border border-black/20 dark:border-white/20 rounded bg-black/5 dark:bg-white/5"},I2=ve({__name:"ToolsView",setup(t){const o=p(null),a=p(!1),{data:i}=Ne(he("/api/config")).json(),{data:l,error:u,isFetching:s,execute:m}=Ne(he("/api/tools?type=tools"),{immediate:!1}).json(),{data:h,error:x,isFetching:c,execute:f}=Ne(he("/api/tools?type=prompts&schema=true"),{immediate:!1}).json(),{data:y,error:b,isFetching:v,execute:d}=Ne(he("/api/tools?type=agents&schema=true"),{immediate:!1}).json(),{data:k,error:g,isFetching:_,execute:L}=Ne(()=>o.value?he(`/api/tools/${encodeURIComponent(o.value.name)}`):null,{immediate:!1}).json(),O=p([]),W=p([]),J=p([]),z=ut(),P=async()=>{const H=z.hash;if(H){await Le();const M=document.getElementById(H.slice(1));M&&M.scrollIntoView({behavior:"smooth"})}};ge(()=>z.hash,P);const G=async H=>{o.value=H,await L(),k.value?o.value={...H,schema:k.value.schema||null}:g.value&&console.error("Error fetching tool schema:",g.value),a.value=!0},ee=async H=>{if(o.value=H,a.value=!0,!H.schema&&H.type==="prompt"){const M=await fetch(he("/api/tools?type=prompts&schema=true"));if(M.ok){const ie=await M.json();ie[H.name]&&(o.value={...H,schema:ie[H.name].schema||null})}}},ue=[{key:"name",label:"Prompt Name",width:"w-1/3",sortable:!0},{key:"description",label:"Description",width:"w-1/2"},{key:"model",label:"Model",width:"w-1/6",sortable:!0,filterable:!0}],me=[{key:"name",label:"Agent Name",width:"w-1/3",sortable:!0},{key:"description",label:"Description",width:"w-1/2"},{key:"prompt",label:"Prompt",width:"w-1/6",sortable:!0,filterable:!0}],Q=[{key:"name",label:"Tool Name",width:"w-1/3",sortable:!0},{key:"description",label:"Description",width:"w-1/2"},{key:"actions",label:"Actions",width:"w-1/6"}],E=H=>/^[a-z][a-z0-9_]*[a-z0-9]$/.test(H)||/^[a-z]$/.test(H),$=H=>H.hasError&&H.error?H.error:H.description||"No description available",V=()=>{l.value&&(O.value=Object.entries(l.value).map(([H,M])=>({name:H,description:M.description||"No description available",schema:null,hasError:M.hasError||!1,error:M.error,type:M.type||"tool"})))},te=()=>{h.value&&(W.value=Object.entries(h.value).map(([H,M])=>({name:H,description:M.description||"No description available",schema:M.schema||null,hasError:!1,type:"prompt",model:M.model})))},B=()=>{y.value&&(J.value=Object.entries(y.value).map(([H,M])=>({name:H,description:M.description||"No description available",schema:M.schema||null,hasError:!1,type:"agent",prompt:M.prompt||M.model})))},N=async()=>{await m(),V()},F=async()=>{await f(),te()},Y=async()=>{await d(),B()},R=()=>{a.value=!1,o.value=null};return Pe(()=>{N(),F(),Y(),P()}),(H,M)=>(r(),q(pt,null,{default:j(()=>[M[6]||(M[6]=e("div",{class:"flex justify-between items-center mb-6"},[e("h1",{class:"text-3xl font-bold"},"Tools")],-1)),M[7]||(M[7]=e("p",{class:"text-neutral-600 dark:text-neutral-400 mb-6"}," Tools are the fundamental building blocks of how your business logic is exposed to your agents. Your prompts can expose tools for the agents to call. There are 3 types of tools: functions, prompts, and agents. Functions are actual code in your AgentKit codebase. Prompts are any prompts created in the prompts table (which can themselves expose tools). Agents are multi-turn conversations that can be invoked as tools. ",-1)),w(S(Fe),{variant:"info",class:"mb-6"},{default:j(()=>[e("p",i2,[M[1]||(M[1]=X(" To create or modify tools, edit the ",-1)),w(S(Nr),null,{default:j(()=>[X(C(S(i)?.toolsDir||"agentbuilder/tools")+"/",1)]),_:1}),M[2]||(M[2]=X(" directory of your codebase. ",-1))]),M[3]||(M[3]=e("p",{class:"opacity-70"}," Changes will be automatically detected. ",-1))]),_:1}),e("div",u2,[w(ot,{title:"Functions",description:"Function tools defined in your codebase.",columns:Q,data:O.value,loading:S(s),sortable:"",searchable:"","search-placeholder":"Search functions...","empty-message":`No tools found. Add tool files to the ${S(i)?.toolsDir||"agentbuilder/tools"}/ directory.`},{"cell-name":j(({row:ie})=>[e("div",{class:ne(["flex items-center gap-2",{"text-red-600 dark:text-red-400":ie.hasError}])},[ie.hasError?(r(),n("span",c2,C(ie.name),1)):(r(),n("button",{key:0,onClick:A=>G(ie),class:"text-left font-medium hover:text-black/70 dark:hover:text-white/70 transition-colors underline decoration-transparent hover:decoration-current"},C(ie.name),9,d2)),ie.hasError?(r(),q(S(dr),{key:2,content:"This tool has validation errors"},{default:j(()=>[w(S(ir),{class:"w-4 h-4 text-red-500"})]),_:1})):E(ie.name)?T("",!0):(r(),q(S(dr),{key:3,content:"Tool name should be in snake_case format (e.g., 'log_name', 'send_email')"},{default:j(()=>[w(S(ir),{class:"w-4 h-4 text-amber-500"})]),_:1}))],2)]),"cell-description":j(({row:ie})=>[e("span",{class:ne({"text-red-600 dark:text-red-400":ie.hasError,"text-neutral-600 dark:text-neutral-400":!ie.hasError})},C($(ie)),3)]),"cell-actions":j(({row:ie})=>[e("div",p2,[ie.hasError?(r(),n("span",v2,"—")):(r(),n("button",{key:0,onClick:A=>G(ie),class:"p-1.5 rounded hover:bg-black/10 dark:hover:bg-white/10 transition-colors",title:"View Schema"},[w(S(Kt),{class:"w-4 h-4"})],8,m2))])]),_:1},8,["data","loading","empty-message"])]),e("div",f2,[w(ot,{title:"Prompts",description:"Prompts that are exposed as tools can be called by other prompts and agents. These allow you to create reusable, composable prompt chains.",columns:ue,data:W.value,loading:S(c),sortable:"",searchable:"","search-placeholder":"Search prompts...","empty-message":"No prompts are currently exposed as tools. Mark a prompt as 'Expose as tool' to see it here."},{"cell-name":j(({row:ie})=>[e("button",{onClick:A=>ee(ie),class:"text-left font-medium hover:text-black/70 dark:hover:text-white/70 transition-colors underline decoration-transparent hover:decoration-current"},C(ie.name),9,h2)]),"cell-description":j(({row:ie})=>[e("span",g2,C(ie.description),1)]),"cell-model":j(({row:ie})=>[e("span",b2,C(ie.model||"-"),1)]),_:1},8,["data","loading"])]),e("div",x2,[w(ot,{title:"Agents",description:"Agents that are exposed as tools can be called by other prompts and agents. When an agent is called as a tool, it uses the Side A system prompt's requirements as the tool's input schema.",columns:me,data:J.value,loading:S(v),sortable:"",searchable:"","search-placeholder":"Search agents...","empty-message":"No agents are currently exposed as tools. Mark an agent as 'Expose as tool' to see it here."},{"cell-name":j(({row:ie})=>[e("button",{onClick:A=>ee(ie),class:"text-left font-medium hover:text-black/70 dark:hover:text-white/70 transition-colors underline decoration-transparent hover:decoration-current"},C(ie.name),9,y2)]),"cell-description":j(({row:ie})=>[e("span",k2,C(ie.description),1)]),"cell-prompt":j(({row:ie})=>[e("span",w2,C(ie.prompt||"-"),1)]),_:1},8,["data","loading"])]),w(He,{modelValue:a.value,"onUpdate:modelValue":M[0]||(M[0]=ie=>a.value=ie),onClose:R,width:"max-w-4xl"},{header:j(()=>[e("div",_2,[w(S(Kt),{class:"w-5 h-5"}),e("span",null,C(o.value?.name)+" Schema",1)])]),footer:j(()=>[w(S(De),{onClick:R},{default:j(()=>[...M[5]||(M[5]=[X(" Close ",-1)])]),_:1})]),default:j(()=>[o.value?(r(),n("div",$2,[e("div",null,[e("h3",C2,C(o.value.type==="prompt"?"Required Schema":"JSON Schema"),1),e("p",S2,C(o.value.type==="prompt"?"This is the JSON schema that defines the input parameters for this prompt.":"This is the automatically generated JSON schema for the tool's arguments."),1)]),o.value.schema===null?(r(),n("div",T2,[...M[4]||(M[4]=[e("p",{class:"text-neutral-500 dark:text-neutral-400"}," No parameters required ",-1)])])):(r(),q(zt,{key:1,value:o.value.schema,class:"h-96 border border-black/20 dark:border-white/20 rounded"},null,8,["value"]))])):T("",!0)]),_:1},8,["modelValue"])]),_:1}))}}),z2={class:"space-y-4"},V2={class:"flex justify-end gap-2"},M2={class:"space-y-4"},E2={class:"flex justify-end gap-2"},L2=ve({__name:"UsersView",setup(t){const o=p(!1),a=p(!1),i=p([]),l=p(!1),u=p(null),s=p({username:"",role:"admin"}),m=[{value:"admin",label:"Admin"}],h=[{key:"username",label:"Username",width:"w-1/3"},{key:"role",label:"Role",width:"w-1/4"},{key:"created_at",label:"Created",width:"w-1/3",formatter:k=>new Date(k*1e3).toLocaleString()}],x=[{icon:"edit",label:"Edit",handler:async k=>{u.value=k,s.value={username:k.username,role:k.role},a.value=!0}},{icon:"delete",label:"Delete",confirm:!0,confirmMessage:"Are you sure you want to delete this user? This action cannot be undone.",handler:async k=>{await b(k.id)}}],c=async()=>{l.value=!0;try{const k=await Je("/users");if(!k.ok)throw new Error("Failed to fetch users");const g=await k.json();i.value=g.users||[]}catch(k){console.error("Error fetching users:",k),i.value=[]}finally{l.value=!1}},f=async k=>{try{const g=await Je("/users",{method:"POST",body:JSON.stringify(k)});if(!g.ok){const _=await g.json();alert(_.error||"Failed to add user");return}await c(),v()}catch(g){console.error("Error adding user:",g),alert("Failed to add user")}},y=async k=>{try{const g={username:k.username,role:k.role};k.password&&(g.password=k.password);const _=await Je(`/users/${u.value.id}`,{method:"PUT",body:JSON.stringify(g)});if(!_.ok){const L=await _.json();alert(L.error||"Failed to update user");return}await c(),d()}catch(g){console.error("Error updating user:",g),alert("Failed to update user")}},b=async k=>{try{const g=await Je(`/users/${k}`,{method:"DELETE"});if(!g.ok){const _=await g.json();alert(_.error||"Failed to delete user");return}await c()}catch(g){console.error("Error deleting user:",g),alert("Failed to delete user")}},v=()=>{Mt("add-user-form"),o.value=!1},d=()=>{Mt("edit-user-form"),a.value=!1,u.value=null};return Pe(()=>{c()}),(k,g)=>{const _=Be("FormKit");return r(),q(pt,null,{default:j(()=>[w(ot,{title:"Users",description:"Manage user accounts and permissions","primary-action":{label:"Add User",handler:()=>o.value=!0},columns:h,data:i.value,actions:x,loading:l.value,"empty-message":"No users found"},null,8,["primary-action","data","loading"]),w(He,{modelValue:o.value,"onUpdate:modelValue":g[0]||(g[0]=L=>o.value=L),title:"Add User",onClose:v},{footer:j(()=>[e("div",V2,[w(S(De),{variant:"secondary",onClick:v},{default:j(()=>[...g[4]||(g[4]=[X(" Cancel ",-1)])]),_:1}),w(S(De),{type:"submit",form:"add-user-form"},{default:j(()=>[...g[5]||(g[5]=[X(" Add User ",-1)])]),_:1})])]),default:j(()=>[w(_,{id:"add-user-form",type:"form",actions:!1,onSubmit:f},{default:j(()=>[e("div",z2,[w(_,{type:"text",name:"username",label:"Username",validation:"required","validation-messages":{required:"Username is required"}}),w(_,{type:"password",name:"password",label:"Password",validation:"required","validation-messages":{required:"Password is required"}}),w(_,{type:"selectSearch",name:"role",label:"Role",options:m,value:"admin",placeholder:"Select role"})])]),_:1})]),_:1},8,["modelValue"]),w(He,{modelValue:a.value,"onUpdate:modelValue":g[3]||(g[3]=L=>a.value=L),title:"Edit User",onClose:d},{footer:j(()=>[e("div",E2,[w(S(De),{variant:"secondary",onClick:d},{default:j(()=>[...g[6]||(g[6]=[X(" Cancel ",-1)])]),_:1}),w(S(De),{type:"submit",form:"edit-user-form"},{default:j(()=>[...g[7]||(g[7]=[X(" Update User ",-1)])]),_:1})])]),default:j(()=>[w(_,{id:"edit-user-form",type:"form",actions:!1,onSubmit:y},{default:j(()=>[e("div",M2,[w(_,{type:"text",name:"username",label:"Username",validation:"required",modelValue:s.value.username,"onUpdate:modelValue":g[1]||(g[1]=L=>s.value.username=L),"validation-messages":{required:"Username is required"}},null,8,["modelValue"]),w(_,{type:"password",name:"password",label:"Password",help:"Leave blank to keep current password"}),w(_,{type:"selectSearch",name:"role",label:"Role",options:m,modelValue:s.value.role,"onUpdate:modelValue":g[2]||(g[2]=L=>s.value.role=L),placeholder:"Select role"},null,8,["modelValue"])])]),_:1})]),_:1},8,["modelValue"])]),_:1})}}}),P2={class:"flex justify-end gap-2"},A2={class:"space-y-4"},j2={class:"flex gap-2"},D2=["value"],O2={class:"flex justify-end mt-4"},R2=ve({__name:"ApiKeysView",setup(t){const o=p(!1),a=p(!1),i=p([]),l=p(!1),u=p(""),s=[{key:"name",label:"Name",width:"w-1/3"},{key:"keyPreview",label:"API Key",width:"w-1/3",html:!0,formatter:b=>`<code class="bg-neutral-100 dark:bg-neutral-800 px-2 py-1 rounded text-sm">${b}</code>`},{key:"createdAt",label:"Created",width:"w-1/6",formatter:b=>new Date(b*1e3).toLocaleDateString()},{key:"lastUsedAt",label:"Last Used",width:"w-1/6",formatter:b=>b?new Date(b*1e3).toLocaleDateString():"Never"}],m=[{icon:"delete",label:"Delete",confirm:!0,confirmMessage:"Are you sure you want to delete this API key? This action cannot be undone.",handler:async b=>{await f(b.id)}}],h=async()=>{l.value=!0;try{const b=await Je("/api-keys");if(!b.ok)throw new Error("Failed to fetch API keys");const v=await b.json();i.value=(v.keys||[]).map(d=>({...d,keyPreview:`${d.key_prefix}...${d.last_five}`,createdAt:d.created_at,lastUsedAt:d.last_used_at}))}catch(b){console.error("Error fetching API keys:",b),i.value=[]}finally{l.value=!1}},x=async b=>{try{const v=await Je("/api-keys",{method:"POST",body:JSON.stringify(b)}),d=await v.json();if(!v.ok){alert(d.error||"Failed to create API key");return}u.value=d.key,c(),a.value=!0,await h()}catch(v){console.error("Error creating API key:",v),alert("Failed to create API key")}},c=()=>{Mt("add-api-key-form"),o.value=!1},f=async b=>{try{const v=await Je(`/api-keys/${b}`,{method:"DELETE"});if(!v.ok){const d=await v.json();alert(d.error||"Failed to delete API key");return}await h()}catch(v){console.error("Error deleting API key:",v),alert("Failed to delete API key")}},y=async b=>{try{await navigator.clipboard.writeText(b),alert("API key copied to clipboard!")}catch(v){console.error("Failed to copy:",v)}};return Pe(()=>{h()}),(b,v)=>{const d=Be("FormKit");return r(),q(pt,null,{default:j(()=>[w(ot,{title:"API Keys",description:"Manage API keys for programmatic access","primary-action":{label:"Create API Key",handler:()=>o.value=!0},columns:s,data:i.value,actions:m,loading:l.value,"empty-message":"No API keys found"},null,8,["primary-action","data","loading"]),w(He,{modelValue:o.value,"onUpdate:modelValue":v[0]||(v[0]=k=>o.value=k),title:"Create API Key",onClose:c},{footer:j(()=>[e("div",P2,[w(S(De),{variant:"secondary",onClick:c},{default:j(()=>[...v[5]||(v[5]=[X(" Cancel ",-1)])]),_:1}),w(S(De),{type:"submit",form:"add-api-key-form"},{default:j(()=>[...v[6]||(v[6]=[X(" Create Key ",-1)])]),_:1})])]),default:j(()=>[w(d,{id:"add-api-key-form",type:"form",actions:!1,onSubmit:x},{default:j(()=>[w(d,{type:"text",name:"name",label:"Name",placeholder:"e.g., Production API Key",help:"A descriptive name to help you identify this key",validation:"required","validation-messages":{required:"Name is required"}})]),_:1})]),_:1},8,["modelValue"]),w(He,{modelValue:a.value,"onUpdate:modelValue":v[3]||(v[3]=k=>a.value=k),title:"API Key Created",onClose:v[4]||(v[4]=k=>a.value=!1)},{default:j(()=>[e("div",A2,[w(S(Fe),{variant:"warning"},{default:j(()=>[...v[7]||(v[7]=[e("p",{class:"font-semibold"},"Important: Save this key now!",-1),e("p",{class:"text-sm mt-1"}," You won't be able to see it again. If you lose this key, you'll need to create a new one. ",-1)])]),_:1}),e("div",null,[v[9]||(v[9]=e("label",{class:"block text-sm font-medium mb-2"},"Your new API key:",-1)),e("div",j2,[e("input",{value:u.value,type:"text",readonly:"",class:"flex-1 px-3 py-2 border border-neutral-300 dark:border-neutral-600 rounded-md dark:bg-neutral-700 font-mono text-sm"},null,8,D2),w(S(De),{variant:"secondary",onClick:v[1]||(v[1]=k=>y(u.value))},{default:j(()=>[...v[8]||(v[8]=[X(" Copy ",-1)])]),_:1})])]),w(S(Fe),{variant:"info"},{default:j(()=>[v[10]||(v[10]=e("p",{class:"text-sm"}," Use this key in the Authorization header of your API requests: ",-1)),w(S(Nr),{inline:!1,class:"mt-2"},{default:j(()=>[X(" Authorization: Bearer "+C(u.value),1)]),_:1})]),_:1}),e("div",O2,[w(S(De),{onClick:v[2]||(v[2]=k=>a.value=!1)},{default:j(()=>[...v[11]||(v[11]=[X(" Done ",-1)])]),_:1})])])]),_:1},8,["modelValue"])]),_:1})}}}),U2={class:"login-container flex-1 flex items-center justify-center px-4"},B2={class:"max-w-md w-full space-y-8"},F2={class:"flex justify-center"},N2=["src"],q2={class:"bg-white dark:bg-neutral-900 border border-neutral-300 dark:border-neutral-700 py-8 px-6 rounded-lg"},H2={key:0,class:"bg-red-50 dark:bg-red-950 border border-red-500 text-red-700 dark:text-red-400 px-4 py-3 mb-6 rounded"},W2={class:"mt-6"},K2=["disabled"],J2={key:0,class:"mt-6"},Y2=ve({__name:"LoginView",setup(t){function o(d){if(d.startsWith("/src/")||d.startsWith("data:"))return d;const k=_t();return k==="/"?d.replace("/agents/","/"):d.replace("/agents/",`${k}/`)}const a=o(Zr),i=o(Xr),l=bt(),u=ut(),s=p(""),m=p(!1),h=p(!1),x=p(!1),c=p(!1),f=U(()=>c.value?i:a);Pe(async()=>{const d=localStorage.getItem("theme");c.value=d==="dark"||!d&&window.matchMedia("(prefers-color-scheme: dark)").matches;const k=u.query.token,g=u.query.error;if(k){localStorage.setItem("auth_token",k),l.push("/");return}g&&(g==="oauth_failed"?s.value="OAuth authentication failed. Please try again.":g==="oauth_not_configured"&&(s.value="OAuth provider is not configured."));try{const _=await fetch(he("/api/auth/config"));if(_.ok){const L=await _.json();h.value=L.github||!1,x.value=L.google||!1}}catch(_){console.error("Failed to fetch auth config:",_)}});async function y(d){s.value="",m.value=!0;try{const k=await fetch(he("/api/auth/login"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:d.username,password:d.password})}),g=await k.json();k.ok?(localStorage.setItem("auth_token",g.token),l.push("/")):s.value=g.error||"Login failed"}catch{s.value="Network error. Please try again."}finally{m.value=!1}}function b(){window.location.href=he("/api/auth/oauth/github")}function v(){window.location.href=he("/api/auth/oauth/google")}return(d,k)=>{const g=Be("FormKit");return r(),n("div",U2,[e("div",B2,[e("div",F2,[e("img",{src:f.value,alt:"AgentBuilder",class:"h-16 pointer-events-none select-none"},null,8,N2)]),w(wt,{offsetX:8,offsetY:8,intensity:.2,pattern:"crosshatch"},{default:j(()=>[e("div",q2,[w(g,{type:"form",actions:!1,onSubmit:y,disabled:m.value},{default:j(()=>[s.value?(r(),n("div",H2,C(s.value),1)):T("",!0),w(g,{type:"text",name:"username",label:"Username",placeholder:"Enter your username",validation:"required","validation-messages":{required:"Username is required"}}),w(g,{type:"password",name:"password",label:"Password",placeholder:"Enter your password",validation:"required","validation-messages":{required:"Password is required"}}),e("div",W2,[e("button",{type:"submit",disabled:m.value,class:"w-full px-4 py-2.5 bg-neutral-900 text-white dark:bg-neutral-100 dark:text-neutral-900 rounded-md font-medium hover:bg-neutral-800 dark:hover:bg-neutral-200 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},C(m.value?"Signing in...":"Sign in"),9,K2)])]),_:1},8,["disabled"]),h.value||x.value?(r(),n("div",J2,[k[2]||(k[2]=e("div",{class:"relative"},[e("div",{class:"absolute inset-0 flex items-center"},[e("div",{class:"w-full border-t border-neutral-300 dark:border-neutral-600"})]),e("div",{class:"relative flex justify-center text-sm"},[e("span",{class:"px-2 bg-white dark:bg-neutral-900 text-neutral-500 dark:text-neutral-400"},"Or continue with")])],-1)),e("div",{class:ne(["mt-6 grid gap-3",h.value&&x.value?"grid-cols-2":"grid-cols-1"])},[h.value?(r(),n("button",{key:0,onClick:b,type:"button",class:"w-full inline-flex justify-center items-center px-4 py-2.5 border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-neutral-800 text-neutral-700 dark:text-neutral-200 rounded-md font-medium hover:bg-neutral-50 dark:hover:bg-neutral-700 transition-colors"},[...k[0]||(k[0]=[e("svg",{class:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20"},[e("path",{"fill-rule":"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z","clip-rule":"evenodd"})],-1),e("span",{class:"ml-2"},"GitHub",-1)])])):T("",!0),x.value?(r(),n("button",{key:1,onClick:v,type:"button",class:"w-full inline-flex justify-center items-center px-4 py-2.5 border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-neutral-800 text-neutral-700 dark:text-neutral-200 rounded-md font-medium hover:bg-neutral-50 dark:hover:bg-neutral-700 transition-colors"},[...k[1]||(k[1]=[e("svg",{class:"h-5 w-5",viewBox:"0 0 24 24"},[e("path",{fill:"currentColor",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),e("path",{fill:"currentColor",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),e("path",{fill:"currentColor",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),e("path",{fill:"currentColor",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})],-1),e("span",{class:"ml-2"},"Google",-1)])])):T("",!0)],2)])):T("",!0)])]),_:1})])])}}}),G2={class:"space-y-1"},Z2=["value","placeholder","disabled"],Ft=ve({__name:"MultilineInput",props:{modelValue:{},label:{},placeholder:{},error:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","focus","blur"],setup(t,{expose:o,emit:a}){const i=t,l=a,u=p(null),s=U(()=>["w-full px-3 py-2.5 bg-neutral-50 dark:bg-neutral-950 border rounded-md font-mono text-sm","focus:outline-none focus:ring-2 focus:ring-neutral-400 dark:focus:ring-neutral-500 focus:border-transparent","transition-colors resize-none overflow-hidden placeholder:text-neutral-400 dark:placeholder:text-neutral-500",i.error?"border-red-500 dark:border-red-400":"border-neutral-300 dark:border-neutral-600",i.disabled?"opacity-50 cursor-not-allowed":""]),m=()=>{const f=u.value;f&&(f.style.height="auto",f.style.height=`${f.scrollHeight+2}px`)},h=f=>{const y=f.target;l("update:modelValue",y.value),m()},x=f=>{l("focus",f)},c=f=>{l("blur",f)};return Pe(()=>{m()}),ge(()=>i.modelValue,async()=>{await Le(),m()}),o({textareaRef:u,adjustHeight:m}),(f,y)=>(r(),n("div",G2,[t.label?(r(),q(S(Fr),{key:0,required:t.required},{default:j(()=>[X(C(t.label),1)]),_:1},8,["required"])):T("",!0),e("textarea",{ref_key:"textareaRef",ref:u,value:t.modelValue,placeholder:t.placeholder,disabled:t.disabled,class:ne(s.value),rows:"1",onInput:h,onFocus:x,onBlur:c},null,42,Z2),t.error?(r(),q(S(tt),{key:1},{default:j(()=>[X(C(t.error),1)]),_:1})):T("",!0)]))}}),X2={class:"flex items-start"},Q2=["for"],ew=["id","checked","disabled"],tw={class:"flex items-center h-5"},rw={class:"flex-1"},aw={key:0,class:"text-red-500"},It=ve({__name:"CheckboxInput",props:{modelValue:{type:Boolean,default:!1},label:{},helpText:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},error:{}},emits:["update:modelValue"],setup(t,{emit:o}){const a=t,i=o,l=Ka(),u=U(()=>["w-5 h-5 border-2 rounded relative flex-shrink-0","transition-all duration-150",a.error?"border-red-500 dark:border-red-400":"border-black dark:border-neutral-300",a.disabled?"opacity-50":"hover:scale-110",a.modelValue?"bg-black dark:bg-white":"bg-white dark:bg-black","before:content-[''] before:absolute before:inset-0 before:m-auto before:w-2.5 before:h-1.5 before:border-white dark:before:border-black before:border-b-2 before:border-l-2 before:rotate-[-45deg]",a.modelValue?"before:block":"before:hidden"]),s=m=>{if(!a.disabled){const h=m.target;i("update:modelValue",h.checked)}};return(m,h)=>(r(),n("div",X2,[e("label",{for:S(l),class:ne(["flex items-start space-x-3 cursor-pointer select-none",{"cursor-not-allowed":t.disabled}])},[e("input",{id:S(l),type:"checkbox",checked:t.modelValue,disabled:t.disabled,onChange:s,class:"absolute left-[-9999px]"},null,40,ew),e("div",tw,[e("span",{class:ne(u.value)},null,2)]),e("div",rw,[t.label?(r(),n("span",{key:0,class:ne(["block text-sm font-medium",{"opacity-50":t.disabled}])},[X(C(t.label)+" ",1),t.required?(r(),n("span",aw,"*")):T("",!0)],2)):T("",!0),t.helpText?(r(),q(S(Ie),{key:1,class:"mt-1"},{default:j(()=>[X(C(t.helpText),1)]),_:1})):T("",!0),t.error?(r(),q(S(tt),{key:2,class:"mt-1"},{default:j(()=>[X(C(t.error),1)]),_:1})):T("",!0)])],10,Q2)]))}}),ow={class:"p-8 space-y-6"},nw={class:"mt-12"},lw={class:"mb-6"},sw={class:"mb-6"},iw={class:"mb-6"},uw={class:"mt-8"},dw={class:"border-2 border-red-500 p-4 h-32 overflow-hidden relative"},cw={class:"mt-12"},pw={class:"mb-6"},mw={class:"border-2 border-accent-500 p-4 h-32 overflow-hidden relative"},vw={class:"mt-12"},fw={class:"mb-6"},hw={class:"mb-6"},gw={class:"mt-12"},bw={class:"mb-6"},xw={class:"mt-2 text-sm"},yw={class:"mb-6"},kw={class:"mt-2 text-sm"},ww={class:"mb-6"},_w={class:"mb-6"},$w={class:"mt-12"},Cw={class:"mb-6"},Sw={class:"mt-4 p-4 bg-neutral-100 dark:bg-neutral-900 rounded"},Tw={class:"text-xs overflow-x-auto"},Iw=ve({__name:"TestView",setup(t){const o=p(""),a=p(""),i=p(""),l=p(`Line 1
|
|
54
|
+
This provider has ${_.modelCount} associated model(s).`):alert(_.error||"Failed to delete provider");return}await g()}catch(h){console.error("Error deleting provider:",h),alert("Failed to delete provider")}};return Pe(()=>{g()}),(f,h)=>(r(),N(pt,null,{default:j(()=>[w(ot,{title:"Providers",description:"Manage API providers and authentication keys. All API keys are encrypted at rest.","primary-action":{label:"Add Provider",icon:$(Rt),handler:()=>a.value=!0},columns:i,data:n.value,actions:c,loading:s.value,sortable:"",searchable:"","search-placeholder":"Search providers...","empty-message":"No providers configured yet. Add your first provider to get started."},{"cell-sdk":j(({value:_,row:b})=>[e("div",m2,[e("img",{src:`/api/providers/${b.name}/icon`,alt:d(_),class:"w-5 h-5"},null,8,v2),e("span",null,S(d(_)),1)])]),"cell-hasApiKey":j(({value:_})=>[_?(r(),o("span",f2,[w($(p2),{class:"w-3.5 h-3.5"}),h[1]||(h[1]=X(" Configured ",-1))])):(r(),o("span",h2,[w($(At),{class:"w-3.5 h-3.5"}),h[2]||(h[2]=X(" Not configured ",-1))]))]),_:1},8,["primary-action","data","loading"]),w(u2,{modelValue:a.value,"onUpdate:modelValue":h[0]||(h[0]=_=>a.value=_),onSave:y},null,8,["modelValue"])]),_:1}))}}),b2={class:"font-medium mb-1"},x2={id:"functions"},y2=["onClick"],k2={key:1,class:"text-left font-medium text-red-600 dark:text-red-400"},w2={class:"flex justify-end"},_2=["onClick"],$2={key:1,class:"text-neutral-400 text-sm"},C2={id:"prompts",class:"mt-12"},S2=["onClick"],T2={class:"text-neutral-600 dark:text-neutral-400"},I2={class:"text-sm text-neutral-500 dark:text-neutral-400"},z2={id:"agents",class:"mt-12"},M2=["onClick"],V2={class:"text-neutral-600 dark:text-neutral-400"},E2={class:"text-sm text-neutral-500 dark:text-neutral-400"},L2={class:"flex items-center gap-2"},P2={key:0,class:"space-y-4"},A2={class:"text-lg font-medium mb-2"},j2={class:"text-sm text-neutral-600 dark:text-neutral-400 mb-4"},D2={key:0,class:"h-96 flex items-center justify-center border border-black/20 dark:border-white/20 rounded bg-black/5 dark:bg-white/5"},R2=fe({__name:"ToolsView",setup(t){const a=m(null),n=m(!1),{data:s}=Ne(ge("/api/config")).json(),{data:l,error:d,isFetching:i,execute:c}=Ne(ge("/api/tools?type=tools"),{immediate:!1}).json(),{data:g,error:y,isFetching:v,execute:f}=Ne(ge("/api/tools?type=prompts&schema=true"),{immediate:!1}).json(),{data:h,error:_,isFetching:b,execute:u}=Ne(ge("/api/tools?type=agents&schema=true"),{immediate:!1}).json(),{data:x,error:p,isFetching:k,execute:M}=Ne(()=>a.value?ge(`/api/tools/${encodeURIComponent(a.value.name)}`):null,{immediate:!1}).json(),R=m([]),W=m([]),Z=m([]),V=ut(),P=async()=>{const H=V.hash;if(H){await Le();const E=document.getElementById(H.slice(1));E&&E.scrollIntoView({behavior:"smooth"})}};xe(()=>V.hash,P);const J=async H=>{a.value=H,await M(),x.value?a.value={...H,schema:x.value.schema||null}:p.value&&console.error("Error fetching tool schema:",p.value),n.value=!0},Q=async H=>{if(a.value=H,n.value=!0,!H.schema&&H.type==="prompt"){const E=await fetch(ge("/api/tools?type=prompts&schema=true"));if(E.ok){const ne=await E.json();ne[H.name]&&(a.value={...H,schema:ne[H.name].schema||null})}}},le=[{key:"name",label:"Prompt Name",width:"w-1/3",sortable:!0},{key:"description",label:"Description",width:"w-1/2"},{key:"model",label:"Model",width:"w-1/6",sortable:!0,filterable:!0}],me=[{key:"name",label:"Agent Name",width:"w-1/3",sortable:!0},{key:"description",label:"Description",width:"w-1/2"},{key:"prompt",label:"Prompt",width:"w-1/6",sortable:!0,filterable:!0}],ee=[{key:"name",label:"Tool Name",width:"w-1/3",sortable:!0},{key:"description",label:"Description",width:"w-1/2"},{key:"actions",label:"Actions",width:"w-1/6"}],L=H=>/^[a-z][a-z0-9_]*[a-z0-9]$/.test(H)||/^[a-z]$/.test(H),C=H=>H.hasError&&H.error?H.error:H.description||"No description available",I=()=>{l.value&&(R.value=Object.entries(l.value).map(([H,E])=>({name:H,description:E.description||"No description available",schema:null,hasError:E.hasError||!1,error:E.error,type:E.type||"tool"})))},re=()=>{g.value&&(W.value=Object.entries(g.value).map(([H,E])=>({name:H,description:E.description||"No description available",schema:E.schema||null,hasError:!1,type:"prompt",model:E.model})))},F=()=>{h.value&&(Z.value=Object.entries(h.value).map(([H,E])=>({name:H,description:E.description||"No description available",schema:E.schema||null,hasError:!1,type:"agent",prompt:E.prompt||E.model})))},B=async()=>{await c(),I()},q=async()=>{await f(),re()},Y=async()=>{await u(),F()},U=()=>{n.value=!1,a.value=null};return Pe(()=>{B(),q(),Y(),P()}),(H,E)=>(r(),N(pt,null,{default:j(()=>[E[6]||(E[6]=e("div",{class:"flex justify-between items-center mb-6"},[e("h1",{class:"text-3xl font-bold"},"Tools")],-1)),E[7]||(E[7]=e("p",{class:"text-neutral-600 dark:text-neutral-400 mb-6"}," Tools are the fundamental building blocks of how your business logic is exposed to your agents. Your prompts can expose tools for the agents to call. There are 3 types of tools: functions, prompts, and agents. Functions are actual code in your AgentKit codebase. Prompts are any prompts created in the prompts table (which can themselves expose tools). Agents are multi-turn conversations that can be invoked as tools. ",-1)),w($(Fe),{variant:"info",class:"mb-6"},{default:j(()=>[e("p",b2,[E[1]||(E[1]=X(" To create or modify tools, edit the ",-1)),w($(Kr),null,{default:j(()=>[X(S($(s)?.toolsDir||"agentbuilder/tools")+"/",1)]),_:1}),E[2]||(E[2]=X(" directory of your codebase. ",-1))]),E[3]||(E[3]=e("p",{class:"opacity-70"}," Changes will be automatically detected. ",-1))]),_:1}),e("div",x2,[w(ot,{title:"Functions",description:"Function tools defined in your codebase.",columns:ee,data:R.value,loading:$(i),sortable:"",searchable:"","search-placeholder":"Search functions...","empty-message":`No tools found. Add tool files to the ${$(s)?.toolsDir||"agentbuilder/tools"}/ directory.`},{"cell-name":j(({row:ne})=>[e("div",{class:oe(["flex items-center gap-2",{"text-red-600 dark:text-red-400":ne.hasError}])},[ne.hasError?(r(),o("span",k2,S(ne.name),1)):(r(),o("button",{key:0,onClick:A=>J(ne),class:"text-left font-medium hover:text-black/70 dark:hover:text-white/70 transition-colors underline decoration-transparent hover:decoration-current"},S(ne.name),9,y2)),ne.hasError?(r(),N($(vr),{key:2,content:"This tool has validation errors"},{default:j(()=>[w($(pr),{class:"w-4 h-4 text-red-500"})]),_:1})):L(ne.name)?T("",!0):(r(),N($(vr),{key:3,content:"Tool name should be in snake_case format (e.g., 'log_name', 'send_email')"},{default:j(()=>[w($(pr),{class:"w-4 h-4 text-amber-500"})]),_:1}))],2)]),"cell-description":j(({row:ne})=>[e("span",{class:oe({"text-red-600 dark:text-red-400":ne.hasError,"text-neutral-600 dark:text-neutral-400":!ne.hasError})},S(C(ne)),3)]),"cell-actions":j(({row:ne})=>[e("div",w2,[ne.hasError?(r(),o("span",$2,"—")):(r(),o("button",{key:0,onClick:A=>J(ne),class:"p-1.5 rounded hover:bg-black/10 dark:hover:bg-white/10 transition-colors",title:"View Schema"},[w($(Yt),{class:"w-4 h-4"})],8,_2))])]),_:1},8,["data","loading","empty-message"])]),e("div",C2,[w(ot,{title:"Prompts",description:"Prompts that are exposed as tools can be called by other prompts and agents. These allow you to create reusable, composable prompt chains.",columns:le,data:W.value,loading:$(v),sortable:"",searchable:"","search-placeholder":"Search prompts...","empty-message":"No prompts are currently exposed as tools. Mark a prompt as 'Expose as tool' to see it here."},{"cell-name":j(({row:ne})=>[e("button",{onClick:A=>Q(ne),class:"text-left font-medium hover:text-black/70 dark:hover:text-white/70 transition-colors underline decoration-transparent hover:decoration-current"},S(ne.name),9,S2)]),"cell-description":j(({row:ne})=>[e("span",T2,S(ne.description),1)]),"cell-model":j(({row:ne})=>[e("span",I2,S(ne.model||"-"),1)]),_:1},8,["data","loading"])]),e("div",z2,[w(ot,{title:"Agents",description:"Agents that are exposed as tools can be called by other prompts and agents. When an agent is called as a tool, it uses the Side A system prompt's requirements as the tool's input schema.",columns:me,data:Z.value,loading:$(b),sortable:"",searchable:"","search-placeholder":"Search agents...","empty-message":"No agents are currently exposed as tools. Mark an agent as 'Expose as tool' to see it here."},{"cell-name":j(({row:ne})=>[e("button",{onClick:A=>Q(ne),class:"text-left font-medium hover:text-black/70 dark:hover:text-white/70 transition-colors underline decoration-transparent hover:decoration-current"},S(ne.name),9,M2)]),"cell-description":j(({row:ne})=>[e("span",V2,S(ne.description),1)]),"cell-prompt":j(({row:ne})=>[e("span",E2,S(ne.prompt||"-"),1)]),_:1},8,["data","loading"])]),w(He,{modelValue:n.value,"onUpdate:modelValue":E[0]||(E[0]=ne=>n.value=ne),onClose:U,width:"max-w-4xl"},{header:j(()=>[e("div",L2,[w($(Yt),{class:"w-5 h-5"}),e("span",null,S(a.value?.name)+" Schema",1)])]),footer:j(()=>[w($(De),{onClick:U},{default:j(()=>[...E[5]||(E[5]=[X(" Close ",-1)])]),_:1})]),default:j(()=>[a.value?(r(),o("div",P2,[e("div",null,[e("h3",A2,S(a.value.type==="prompt"?"Required Schema":"JSON Schema"),1),e("p",j2,S(a.value.type==="prompt"?"This is the JSON schema that defines the input parameters for this prompt.":"This is the automatically generated JSON schema for the tool's arguments."),1)]),a.value.schema===null?(r(),o("div",D2,[...E[4]||(E[4]=[e("p",{class:"text-neutral-500 dark:text-neutral-400"}," No parameters required ",-1)])])):(r(),N(Mt,{key:1,value:a.value.schema,class:"h-96 border border-black/20 dark:border-white/20 rounded"},null,8,["value"]))])):T("",!0)]),_:1},8,["modelValue"])]),_:1}))}}),O2={class:"space-y-4"},U2={class:"flex justify-end gap-2"},B2={class:"space-y-4"},F2={class:"flex justify-end gap-2"},N2=fe({__name:"UsersView",setup(t){const a=m(!1),n=m(!1),s=m([]),l=m(!1),d=m(null),i=m({username:"",role:"admin"}),c=[{value:"admin",label:"Admin"}],g=[{key:"username",label:"Username",width:"w-1/3"},{key:"role",label:"Role",width:"w-1/4"},{key:"created_at",label:"Created",width:"w-1/3",formatter:x=>new Date(x*1e3).toLocaleString()}],y=[{icon:"edit",label:"Edit",handler:async x=>{d.value=x,i.value={username:x.username,role:x.role},n.value=!0}},{icon:"delete",label:"Delete",confirm:!0,confirmMessage:"Are you sure you want to delete this user? This action cannot be undone.",handler:async x=>{await _(x.id)}}],v=async()=>{l.value=!0;try{const x=await Je("/users");if(!x.ok)throw new Error("Failed to fetch users");const p=await x.json();s.value=p.users||[]}catch(x){console.error("Error fetching users:",x),s.value=[]}finally{l.value=!1}},f=async x=>{try{const p=await Je("/users",{method:"POST",body:JSON.stringify(x)});if(!p.ok){const k=await p.json();alert(k.error||"Failed to add user");return}await v(),b()}catch(p){console.error("Error adding user:",p),alert("Failed to add user")}},h=async x=>{try{const p={username:x.username,role:x.role};x.password&&(p.password=x.password);const k=await Je(`/users/${d.value.id}`,{method:"PUT",body:JSON.stringify(p)});if(!k.ok){const M=await k.json();alert(M.error||"Failed to update user");return}await v(),u()}catch(p){console.error("Error updating user:",p),alert("Failed to update user")}},_=async x=>{try{const p=await Je(`/users/${x}`,{method:"DELETE"});if(!p.ok){const k=await p.json();alert(k.error||"Failed to delete user");return}await v()}catch(p){console.error("Error deleting user:",p),alert("Failed to delete user")}},b=()=>{Et("add-user-form"),a.value=!1},u=()=>{Et("edit-user-form"),n.value=!1,d.value=null};return Pe(()=>{v()}),(x,p)=>{const k=Be("FormKit");return r(),N(pt,null,{default:j(()=>[w(ot,{title:"Users",description:"Manage user accounts and permissions","primary-action":{label:"Add User",handler:()=>a.value=!0},columns:g,data:s.value,actions:y,loading:l.value,"empty-message":"No users found"},null,8,["primary-action","data","loading"]),w(He,{modelValue:a.value,"onUpdate:modelValue":p[0]||(p[0]=M=>a.value=M),title:"Add User",onClose:b},{footer:j(()=>[e("div",U2,[w($(De),{variant:"secondary",onClick:b},{default:j(()=>[...p[4]||(p[4]=[X(" Cancel ",-1)])]),_:1}),w($(De),{type:"submit",form:"add-user-form"},{default:j(()=>[...p[5]||(p[5]=[X(" Add User ",-1)])]),_:1})])]),default:j(()=>[w(k,{id:"add-user-form",type:"form",actions:!1,onSubmit:f},{default:j(()=>[e("div",O2,[w(k,{type:"text",name:"username",label:"Username",validation:"required","validation-messages":{required:"Username is required"}}),w(k,{type:"password",name:"password",label:"Password",validation:"required","validation-messages":{required:"Password is required"}}),w(k,{type:"selectSearch",name:"role",label:"Role",options:c,value:"admin",placeholder:"Select role"})])]),_:1})]),_:1},8,["modelValue"]),w(He,{modelValue:n.value,"onUpdate:modelValue":p[3]||(p[3]=M=>n.value=M),title:"Edit User",onClose:u},{footer:j(()=>[e("div",F2,[w($(De),{variant:"secondary",onClick:u},{default:j(()=>[...p[6]||(p[6]=[X(" Cancel ",-1)])]),_:1}),w($(De),{type:"submit",form:"edit-user-form"},{default:j(()=>[...p[7]||(p[7]=[X(" Update User ",-1)])]),_:1})])]),default:j(()=>[w(k,{id:"edit-user-form",type:"form",actions:!1,onSubmit:h},{default:j(()=>[e("div",B2,[w(k,{type:"text",name:"username",label:"Username",validation:"required",modelValue:i.value.username,"onUpdate:modelValue":p[1]||(p[1]=M=>i.value.username=M),"validation-messages":{required:"Username is required"}},null,8,["modelValue"]),w(k,{type:"password",name:"password",label:"Password",help:"Leave blank to keep current password"}),w(k,{type:"selectSearch",name:"role",label:"Role",options:c,modelValue:i.value.role,"onUpdate:modelValue":p[2]||(p[2]=M=>i.value.role=M),placeholder:"Select role"},null,8,["modelValue"])])]),_:1})]),_:1},8,["modelValue"])]),_:1})}}}),q2={class:"flex justify-end gap-2"},H2={class:"space-y-4"},W2={class:"flex gap-2"},K2=["value"],J2={class:"flex justify-end mt-4"},Y2=fe({__name:"ApiKeysView",setup(t){const a=m(!1),n=m(!1),s=m([]),l=m(!1),d=m(""),i=[{key:"name",label:"Name",width:"w-1/3"},{key:"keyPreview",label:"API Key",width:"w-1/3",html:!0,formatter:_=>`<code class="bg-neutral-100 dark:bg-neutral-800 px-2 py-1 rounded text-sm">${_}</code>`},{key:"createdAt",label:"Created",width:"w-1/6",formatter:_=>new Date(_*1e3).toLocaleDateString()},{key:"lastUsedAt",label:"Last Used",width:"w-1/6",formatter:_=>_?new Date(_*1e3).toLocaleDateString():"Never"}],c=[{icon:"delete",label:"Delete",confirm:!0,confirmMessage:"Are you sure you want to delete this API key? This action cannot be undone.",handler:async _=>{await f(_.id)}}],g=async()=>{l.value=!0;try{const _=await Je("/api-keys");if(!_.ok)throw new Error("Failed to fetch API keys");const b=await _.json();s.value=(b.keys||[]).map(u=>({...u,keyPreview:`${u.key_prefix}...${u.last_five}`,createdAt:u.created_at,lastUsedAt:u.last_used_at}))}catch(_){console.error("Error fetching API keys:",_),s.value=[]}finally{l.value=!1}},y=async _=>{try{const b=await Je("/api-keys",{method:"POST",body:JSON.stringify(_)}),u=await b.json();if(!b.ok){alert(u.error||"Failed to create API key");return}d.value=u.key,v(),n.value=!0,await g()}catch(b){console.error("Error creating API key:",b),alert("Failed to create API key")}},v=()=>{Et("add-api-key-form"),a.value=!1},f=async _=>{try{const b=await Je(`/api-keys/${_}`,{method:"DELETE"});if(!b.ok){const u=await b.json();alert(u.error||"Failed to delete API key");return}await g()}catch(b){console.error("Error deleting API key:",b),alert("Failed to delete API key")}},h=async _=>{try{await navigator.clipboard.writeText(_),alert("API key copied to clipboard!")}catch(b){console.error("Failed to copy:",b)}};return Pe(()=>{g()}),(_,b)=>{const u=Be("FormKit");return r(),N(pt,null,{default:j(()=>[w(ot,{title:"API Keys",description:"Manage API keys for programmatic access","primary-action":{label:"Create API Key",handler:()=>a.value=!0},columns:i,data:s.value,actions:c,loading:l.value,"empty-message":"No API keys found"},null,8,["primary-action","data","loading"]),w(He,{modelValue:a.value,"onUpdate:modelValue":b[0]||(b[0]=x=>a.value=x),title:"Create API Key",onClose:v},{footer:j(()=>[e("div",q2,[w($(De),{variant:"secondary",onClick:v},{default:j(()=>[...b[5]||(b[5]=[X(" Cancel ",-1)])]),_:1}),w($(De),{type:"submit",form:"add-api-key-form"},{default:j(()=>[...b[6]||(b[6]=[X(" Create Key ",-1)])]),_:1})])]),default:j(()=>[w(u,{id:"add-api-key-form",type:"form",actions:!1,onSubmit:y},{default:j(()=>[w(u,{type:"text",name:"name",label:"Name",placeholder:"e.g., Production API Key",help:"A descriptive name to help you identify this key",validation:"required","validation-messages":{required:"Name is required"}})]),_:1})]),_:1},8,["modelValue"]),w(He,{modelValue:n.value,"onUpdate:modelValue":b[3]||(b[3]=x=>n.value=x),title:"API Key Created",onClose:b[4]||(b[4]=x=>n.value=!1)},{default:j(()=>[e("div",H2,[w($(Fe),{variant:"warning"},{default:j(()=>[...b[7]||(b[7]=[e("p",{class:"font-semibold"},"Important: Save this key now!",-1),e("p",{class:"text-sm mt-1"}," You won't be able to see it again. If you lose this key, you'll need to create a new one. ",-1)])]),_:1}),e("div",null,[b[9]||(b[9]=e("label",{class:"block text-sm font-medium mb-2"},"Your new API key:",-1)),e("div",W2,[e("input",{value:d.value,type:"text",readonly:"",class:"flex-1 px-3 py-2 border border-neutral-300 dark:border-neutral-600 rounded-md dark:bg-neutral-700 font-mono text-sm"},null,8,K2),w($(De),{variant:"secondary",onClick:b[1]||(b[1]=x=>h(d.value))},{default:j(()=>[...b[8]||(b[8]=[X(" Copy ",-1)])]),_:1})])]),w($(Fe),{variant:"info"},{default:j(()=>[b[10]||(b[10]=e("p",{class:"text-sm"}," Use this key in the Authorization header of your API requests: ",-1)),w($(Kr),{inline:!1,class:"mt-2"},{default:j(()=>[X(" Authorization: Bearer "+S(d.value),1)]),_:1})]),_:1}),e("div",J2,[w($(De),{onClick:b[2]||(b[2]=x=>n.value=!1)},{default:j(()=>[...b[11]||(b[11]=[X(" Done ",-1)])]),_:1})])])]),_:1},8,["modelValue"])]),_:1})}}}),G2={class:"login-container flex-1 flex items-center justify-center px-4"},Z2={class:"max-w-md w-full space-y-8"},X2={class:"flex justify-center"},Q2=["src"],ew={class:"bg-white dark:bg-neutral-900 border border-neutral-300 dark:border-neutral-700 py-8 px-6 rounded-lg"},tw={key:0,class:"bg-red-50 dark:bg-red-950 border border-red-500 text-red-700 dark:text-red-400 px-4 py-3 mb-6 rounded"},rw={class:"mt-6"},aw=["disabled"],ow={key:0,class:"mt-6"},nw=fe({__name:"LoginView",setup(t){function a(u){if(u.startsWith("/src/")||u.startsWith("data:"))return u;const x=$t();return x==="/"?u.replace("/agents/","/"):u.replace("/agents/",`${x}/`)}const n=a(ra),s=a(aa),l=bt(),d=ut(),i=m(""),c=m(!1),g=m(!1),y=m(!1),v=m(!1),f=O(()=>v.value?s:n);Pe(async()=>{const u=localStorage.getItem("theme");v.value=u==="dark"||!u&&window.matchMedia("(prefers-color-scheme: dark)").matches;const x=d.query.token,p=d.query.error;if(x){localStorage.setItem("auth_token",x),l.push("/");return}p&&(p==="oauth_failed"?i.value="OAuth authentication failed. Please try again.":p==="oauth_not_configured"&&(i.value="OAuth provider is not configured."));try{const k=await fetch(ge("/api/auth/config"));if(k.ok){const M=await k.json();g.value=M.github||!1,y.value=M.google||!1}}catch(k){console.error("Failed to fetch auth config:",k)}});async function h(u){i.value="",c.value=!0;try{const x=await fetch(ge("/api/auth/login"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:u.username,password:u.password})}),p=await x.json();x.ok?(localStorage.setItem("auth_token",p.token),l.push("/")):i.value=p.error||"Login failed"}catch{i.value="Network error. Please try again."}finally{c.value=!1}}function _(){window.location.href=ge("/api/auth/oauth/github")}function b(){window.location.href=ge("/api/auth/oauth/google")}return(u,x)=>{const p=Be("FormKit");return r(),o("div",G2,[e("div",Z2,[e("div",X2,[e("img",{src:f.value,alt:"AgentBuilder",class:"h-16 pointer-events-none select-none"},null,8,Q2)]),w(_t,{offsetX:8,offsetY:8,intensity:.2,pattern:"crosshatch"},{default:j(()=>[e("div",ew,[w(p,{type:"form",actions:!1,onSubmit:h,disabled:c.value},{default:j(()=>[i.value?(r(),o("div",tw,S(i.value),1)):T("",!0),w(p,{type:"text",name:"username",label:"Username",placeholder:"Enter your username",validation:"required","validation-messages":{required:"Username is required"}}),w(p,{type:"password",name:"password",label:"Password",placeholder:"Enter your password",validation:"required","validation-messages":{required:"Password is required"}}),e("div",rw,[e("button",{type:"submit",disabled:c.value,class:"w-full px-4 py-2.5 bg-neutral-900 text-white dark:bg-neutral-100 dark:text-neutral-900 rounded-md font-medium hover:bg-neutral-800 dark:hover:bg-neutral-200 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},S(c.value?"Signing in...":"Sign in"),9,aw)])]),_:1},8,["disabled"]),g.value||y.value?(r(),o("div",ow,[x[2]||(x[2]=e("div",{class:"relative"},[e("div",{class:"absolute inset-0 flex items-center"},[e("div",{class:"w-full border-t border-neutral-300 dark:border-neutral-600"})]),e("div",{class:"relative flex justify-center text-sm"},[e("span",{class:"px-2 bg-white dark:bg-neutral-900 text-neutral-500 dark:text-neutral-400"},"Or continue with")])],-1)),e("div",{class:oe(["mt-6 grid gap-3",g.value&&y.value?"grid-cols-2":"grid-cols-1"])},[g.value?(r(),o("button",{key:0,onClick:_,type:"button",class:"w-full inline-flex justify-center items-center px-4 py-2.5 border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-neutral-800 text-neutral-700 dark:text-neutral-200 rounded-md font-medium hover:bg-neutral-50 dark:hover:bg-neutral-700 transition-colors"},[...x[0]||(x[0]=[e("svg",{class:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20"},[e("path",{"fill-rule":"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z","clip-rule":"evenodd"})],-1),e("span",{class:"ml-2"},"GitHub",-1)])])):T("",!0),y.value?(r(),o("button",{key:1,onClick:b,type:"button",class:"w-full inline-flex justify-center items-center px-4 py-2.5 border border-neutral-300 dark:border-neutral-600 bg-white dark:bg-neutral-800 text-neutral-700 dark:text-neutral-200 rounded-md font-medium hover:bg-neutral-50 dark:hover:bg-neutral-700 transition-colors"},[...x[1]||(x[1]=[e("svg",{class:"h-5 w-5",viewBox:"0 0 24 24"},[e("path",{fill:"currentColor",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),e("path",{fill:"currentColor",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),e("path",{fill:"currentColor",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),e("path",{fill:"currentColor",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})],-1),e("span",{class:"ml-2"},"Google",-1)])])):T("",!0)],2)])):T("",!0)])]),_:1})])])}}}),lw={class:"space-y-1"},sw=["value","placeholder","disabled"],qt=fe({__name:"MultilineInput",props:{modelValue:{},label:{},placeholder:{},error:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","focus","blur"],setup(t,{expose:a,emit:n}){const s=t,l=n,d=m(null),i=O(()=>["w-full px-3 py-2.5 bg-neutral-50 dark:bg-neutral-950 border rounded-md font-mono text-sm","focus:outline-none focus:ring-2 focus:ring-neutral-400 dark:focus:ring-neutral-500 focus:border-transparent","transition-colors resize-none overflow-hidden placeholder:text-neutral-400 dark:placeholder:text-neutral-500",s.error?"border-red-500 dark:border-red-400":"border-neutral-300 dark:border-neutral-600",s.disabled?"opacity-50 cursor-not-allowed":""]),c=()=>{const f=d.value;f&&(f.style.height="auto",f.style.height=`${f.scrollHeight+2}px`)},g=f=>{const h=f.target;l("update:modelValue",h.value),c()},y=f=>{l("focus",f)},v=f=>{l("blur",f)};return Pe(()=>{c()}),xe(()=>s.modelValue,async()=>{await Le(),c()}),a({textareaRef:d,adjustHeight:c}),(f,h)=>(r(),o("div",lw,[t.label?(r(),N($(Wr),{key:0,required:t.required},{default:j(()=>[X(S(t.label),1)]),_:1},8,["required"])):T("",!0),e("textarea",{ref_key:"textareaRef",ref:d,value:t.modelValue,placeholder:t.placeholder,disabled:t.disabled,class:oe(i.value),rows:"1",onInput:g,onFocus:y,onBlur:v},null,42,sw),t.error?(r(),N($(tt),{key:1},{default:j(()=>[X(S(t.error),1)]),_:1})):T("",!0)]))}}),iw={class:"flex items-start"},uw=["for"],dw=["id","checked","disabled"],cw={class:"flex items-center h-5"},pw={class:"flex-1"},mw={key:0,class:"text-red-500"},zt=fe({__name:"CheckboxInput",props:{modelValue:{type:Boolean,default:!1},label:{},helpText:{},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},error:{}},emits:["update:modelValue"],setup(t,{emit:a}){const n=t,s=a,l=eo(),d=O(()=>["w-5 h-5 border-2 rounded relative flex-shrink-0","transition-all duration-150",n.error?"border-red-500 dark:border-red-400":"border-black dark:border-neutral-300",n.disabled?"opacity-50":"hover:scale-110",n.modelValue?"bg-black dark:bg-white":"bg-white dark:bg-black","before:content-[''] before:absolute before:inset-0 before:m-auto before:w-2.5 before:h-1.5 before:border-white dark:before:border-black before:border-b-2 before:border-l-2 before:rotate-[-45deg]",n.modelValue?"before:block":"before:hidden"]),i=c=>{if(!n.disabled){const g=c.target;s("update:modelValue",g.checked)}};return(c,g)=>(r(),o("div",iw,[e("label",{for:$(l),class:oe(["flex items-start space-x-3 cursor-pointer select-none",{"cursor-not-allowed":t.disabled}])},[e("input",{id:$(l),type:"checkbox",checked:t.modelValue,disabled:t.disabled,onChange:i,class:"absolute left-[-9999px]"},null,40,dw),e("div",cw,[e("span",{class:oe(d.value)},null,2)]),e("div",pw,[t.label?(r(),o("span",{key:0,class:oe(["block text-sm font-medium",{"opacity-50":t.disabled}])},[X(S(t.label)+" ",1),t.required?(r(),o("span",mw,"*")):T("",!0)],2)):T("",!0),t.helpText?(r(),N($(ze),{key:1,class:"mt-1"},{default:j(()=>[X(S(t.helpText),1)]),_:1})):T("",!0),t.error?(r(),N($(tt),{key:2,class:"mt-1"},{default:j(()=>[X(S(t.error),1)]),_:1})):T("",!0)])],10,uw)]))}}),vw={class:"p-8 space-y-6"},fw={class:"mt-12"},hw={class:"mb-6"},gw={class:"mb-6"},bw={class:"mb-6"},xw={class:"mt-8"},yw={class:"border-2 border-red-500 p-4 h-32 overflow-hidden relative"},kw={class:"mt-12"},ww={class:"mb-6"},_w={class:"border-2 border-accent-500 p-4 h-32 overflow-hidden relative"},$w={class:"mt-12"},Cw={class:"mb-6"},Sw={class:"mb-6"},Tw={class:"mt-12"},Iw={class:"mb-6"},zw={class:"mt-2 text-sm"},Mw={class:"mb-6"},Vw={class:"mt-2 text-sm"},Ew={class:"mb-6"},Lw={class:"mb-6"},Pw={class:"mt-12"},Aw={class:"mb-6"},jw={class:"mt-4 p-4 bg-neutral-100 dark:bg-neutral-900 rounded"},Dw={class:"text-xs overflow-x-auto"},Rw=fe({__name:"TestView",setup(t){const a=m(""),n=m(""),s=m(""),l=m(`Line 1
|
|
55
55
|
Line 2
|
|
56
|
-
Line 3`),
|
|
57
|
-
`),
|
|
56
|
+
Line 3`),d=m(""),i=m(""),c=m("option2"),g=m(""),y=m(""),v=m(""),f=m([]),h=m(["test1","test2"]),_=m(!1),b=m(!0),u=m(!1),x=m(!1),p=m({type:"object",properties:{},required:[]}),k=m(0);Pe(()=>{window.resetJSONSchema=()=>{p.value={type:"object",properties:{},required:[]},k.value++}});const M=[{value:"option1",label:"Option One"},{value:"option2",label:"Option Two"},{value:"option3",label:"Option Three"},{value:"option4",label:"Option Four"}],R=[{value:"item1",label:"Item One",description:"First item description"},{value:"item2",label:"Item Two",description:"Second item description"},{value:"item3",label:"Item Three",description:"Third item description"},{value:"item4",label:"Item Four",description:"Fourth item description"}],W=[{value:"test1",label:"Test Item 1",description:"First test item"},{value:"test2",label:"Test Item 2",description:"Second test item"},{value:"test3",label:"Test Item 3",description:"Third test item"},{value:"test4",label:"Test Item 4",description:"Fourth test item"},{value:"test5",label:"Test Item 5",description:"Fifth test item"}];return(Z,V)=>(r(),o("div",vw,[V[30]||(V[30]=e("h1",{class:"text-2xl font-bold"},"Component Test Page",-1)),e("div",null,[w(lt,{modelValue:a.value,"onUpdate:modelValue":V[0]||(V[0]=P=>a.value=P),label:"Test Label",placeholder:"Enter text..."},null,8,["modelValue"]),e("p",null,S(a.value),1)]),e("div",null,[w(lt,{modelValue:n.value,"onUpdate:modelValue":V[1]||(V[1]=P=>n.value=P),label:"Email",error:"Invalid email address",required:""},null,8,["modelValue"])]),e("div",fw,[V[18]||(V[18]=e("h2",{class:"text-xl font-bold mb-4"},"MultilineInput Tests",-1)),e("div",hw,[w(qt,{modelValue:s.value,"onUpdate:modelValue":V[2]||(V[2]=P=>s.value=P),label:"Multiline Text",placeholder:"Type multiple lines..."},null,8,["modelValue"]),e("p",null,S(s.value),1)]),e("div",gw,[w(qt,{modelValue:l.value,"onUpdate:modelValue":V[3]||(V[3]=P=>l.value=P),label:"Pre-filled Multiline",placeholder:"Already has content..."},null,8,["modelValue"]),e("pre",null,S(l.value),1)]),e("div",bw,[w(qt,{modelValue:d.value,"onUpdate:modelValue":V[4]||(V[4]=P=>d.value=P),label:"Required Field",error:"This field is required",required:""},null,8,["modelValue"])])]),e("div",null,[w(Ge,{modelValue:i.value,"onUpdate:modelValue":V[5]||(V[5]=P=>i.value=P),options:M,label:"Select Option",placeholder:"Choose an option..."},null,8,["modelValue"]),e("p",null,S(i.value),1)]),e("div",null,[w(Ge,{modelValue:i.value,"onUpdate:modelValue":V[6]||(V[6]=P=>i.value=P),options:M,label:"Required Select",placeholder:"Please select an option"},null,8,["modelValue"])]),e("div",null,[w(Ge,{modelValue:c.value,"onUpdate:modelValue":V[7]||(V[7]=P=>c.value=P),options:M,label:"Disabled Select",disabled:""},null,8,["modelValue"])]),e("div",xw,[V[20]||(V[20]=e("h2",{class:"text-lg font-semibold mb-2"},"Overflow Test",-1)),e("div",yw,[V[19]||(V[19]=e("p",{class:"text-sm text-neutral-600 mb-2"}," This container has overflow:hidden and limited height ",-1)),w(Ge,{modelValue:g.value,"onUpdate:modelValue":V[8]||(V[8]=P=>g.value=P),options:M,label:"Select in Overflow Container",placeholder:"Should break out of container..."},null,8,["modelValue"])]),V[21]||(V[21]=e("p",{class:"mt-2 text-sm text-neutral-500"}," The dropdown should appear above the red border (in top layer) ",-1))]),e("div",kw,[V[25]||(V[25]=e("h2",{class:"text-xl font-bold mb-4"},"DropdownList Tests",-1)),e("div",ww,[w(Ge,{modelValue:y.value,"onUpdate:modelValue":V[9]||(V[9]=P=>y.value=P),options:R,label:"Select Item",placeholder:"Choose an item..."},null,8,["modelValue"]),e("p",null,S(y.value),1)]),e("div",null,[V[23]||(V[23]=e("h3",{class:"text-lg font-semibold mb-2"},"DropdownList Overflow Test",-1)),e("div",_w,[V[22]||(V[22]=e("p",{class:"text-sm text-neutral-600 mb-2"}," This container has overflow:hidden and limited height ",-1)),w(Ge,{modelValue:v.value,"onUpdate:modelValue":V[10]||(V[10]=P=>v.value=P),options:R,label:"Dropdown in Overflow Container",placeholder:"Should use popover API..."},null,8,["modelValue"])]),V[24]||(V[24]=e("p",{class:"mt-2 text-sm text-neutral-500"}," The dropdown should appear above the blue border (using Popover API) ",-1))])]),e("div",$w,[V[26]||(V[26]=e("h2",{class:"text-xl font-bold mb-4"},"MultipleSelectionsInput Tests",-1)),e("div",Cw,[w(ht,{modelValue:f.value,"onUpdate:modelValue":V[11]||(V[11]=P=>f.value=P),options:W,label:"Select Multiple Items",placeholder:"Choose items...","add-label":"Add another"},null,8,["modelValue"]),e("p",null,S(f.value),1)]),e("div",Sw,[w(ht,{modelValue:h.value,"onUpdate:modelValue":V[12]||(V[12]=P=>h.value=P),options:W,label:"Disabled Multiple Select",placeholder:"Cannot select...",disabled:""},null,8,["modelValue"])])]),e("div",Tw,[V[27]||(V[27]=e("h2",{class:"text-xl font-bold mb-4"},"CheckboxInput Tests",-1)),e("div",Iw,[w(zt,{modelValue:_.value,"onUpdate:modelValue":V[13]||(V[13]=P=>_.value=P),label:"Basic Checkbox"},null,8,["modelValue"]),e("p",zw," Value: "+S(_.value),1)]),e("div",Mw,[w(zt,{modelValue:b.value,"onUpdate:modelValue":V[14]||(V[14]=P=>b.value=P),label:"Checkbox with Help Text",helpText:"This is helpful information about what this checkbox does. Notice how the checkbox stays aligned with the label.",required:""},null,8,["modelValue"]),e("p",Vw," Value: "+S(b.value),1)]),e("div",Ew,[w(zt,{modelValue:u.value,"onUpdate:modelValue":V[15]||(V[15]=P=>u.value=P),label:"Disabled Checkbox",helpText:"This checkbox is disabled and cannot be changed.",disabled:""},null,8,["modelValue"])]),e("div",Lw,[w(zt,{modelValue:x.value,"onUpdate:modelValue":V[16]||(V[16]=P=>x.value=P),label:"Checkbox with Error",error:"You must accept the terms and conditions",required:""},null,8,["modelValue"])])]),e("div",Pw,[V[29]||(V[29]=e("h2",{class:"text-xl font-bold mb-4"},"JSONSchemaInput Tests",-1)),e("div",Aw,[(r(),N(Jr,{key:k.value,modelValue:p.value,"onUpdate:modelValue":V[17]||(V[17]=P=>p.value=P),label:"JSON Schema Builder"},null,8,["modelValue"])),e("div",jw,[V[28]||(V[28]=e("p",{class:"text-sm font-mono mb-2"},"Generated Schema:",-1)),e("pre",Dw,S(JSON.stringify(p.value,null,2)),1)])])])]))}}),Ow={class:"relative"},Uw=["value","placeholder","rows"],Bw={class:"bg-white dark:bg-black rounded-lg"},Fw={class:"px-3 py-2 border-b border-black dark:border-neutral-300"},Nw={class:"text-xs font-medium text-neutral-600 dark:text-neutral-400"},qw={key:0,class:"max-h-[200px] overflow-y-auto"},Hw=["onClick"],Ww={class:"text-xs text-neutral-500 dark:text-neutral-400 mt-0.5"},Kw={class:"flex-1"},Jw={key:0,class:"text-xs text-neutral-600 dark:text-neutral-400 mt-0.5"},Yw={key:1,class:"px-3 py-4 text-sm text-neutral-500 dark:text-neutral-400 text-center"},Gw=fe({__name:"ReferenceInput",props:{modelValue:{},search:{type:Function},placeholder:{},rows:{}},emits:["update:modelValue"],setup(t,{emit:a}){const n=t,s=a,l=m(null),d=m(null),i=m(!1),c=m(""),g=m([]),y=m(0),v=m(-1),f=m(-1),h=m(0),_=m({top:0,left:0}),b=async P=>{const J=P.target,Q=J.value,le=J.selectionStart;s("update:modelValue",Q),Q[le-1]==="@"&&!i.value?u(le):i.value&&await p(Q,le)},u=async P=>{v.value=P-1,f.value=P,c.value="",h.value=0,i.value=!0,y.value=0,await x(),await k("")},x=async()=>{if(!l.value)return;await Le();const P=l.value.getBoundingClientRect(),J=window.getComputedStyle(l.value),Q=parseInt(J.lineHeight||"20"),le=parseInt(J.paddingTop||"8"),ee=n.modelValue.substring(0,f.value).split(`
|
|
57
|
+
`),L=ee.length,C=ee[ee.length-1],re=Math.min(C.length*8,200);_.value={top:P.top+le+L*Q+4,left:P.left+le+re}},p=async(P,J)=>{if(J<=v.value){R();return}const Q=v.value+1,le=P.substring(Q,J);if(g.value.length===0?h.value++:h.value=0,g.value.length===0&&h.value>=5){R();return}c.value=le,await k(le)},k=async P=>{if(!n.search){g.value=[];return}const J=await n.search(P);g.value=Array.isArray(J)?J:[],y.value>=g.value.length&&(y.value=0)},M=P=>{if(!l.value)return;const J=n.modelValue,Q=J.substring(0,v.value),le=J.substring(f.value+c.value.length),me=`@${P.value}`,ee=Q+me+le;s("update:modelValue",ee),Le(()=>{if(!l.value)return;const L=Q.length+me.length;l.value.focus(),l.value.setSelectionRange(L,L)}),R()},R=()=>{i.value=!1,c.value="",g.value=[],y.value=0,v.value=-1,f.value=-1,h.value=0},W=P=>{if(i.value)switch(P.key){case"Escape":P.preventDefault(),R();break;case"ArrowDown":P.preventDefault(),y.value=Math.min(y.value+1,g.value.length-1);break;case"ArrowUp":P.preventDefault(),y.value=Math.max(y.value-1,0);break;case"Enter":g.value.length>0&&(P.preventDefault(),M(g.value[y.value]));break;case"Tab":g.value.length>0&&(P.preventDefault(),M(g.value[y.value]));break}},Z=()=>{if(!i.value||!l.value)return;l.value.selectionStart<=v.value&&R()},V=P=>{if(!d.value||!i.value)return;const J=P.target;!d.value.contains(J)&&J!==l.value&&R()};return xe(i,P=>{P?document.addEventListener("click",V):document.removeEventListener("click",V)}),(P,J)=>(r(),o("div",Ow,[e("textarea",{ref_key:"textarea",ref:l,value:t.modelValue,onInput:b,onKeydown:W,onSelect:Z,placeholder:t.placeholder||"Type @ to insert references...",rows:t.rows||10,class:"w-full px-3 py-2 border border-black dark:border-neutral-300 rounded bg-transparent font-mono text-sm resize-none focus:outline-none focus:ring-1 focus:ring-black dark:focus:ring-white"},null,40,Uw),(r(),N(wt,{to:"body"},[i.value?(r(),o("div",{key:0,ref_key:"searchDialog",ref:d,class:"fixed z-50 min-w-[200px] max-w-[400px] bg-white dark:bg-black border-2 border-black dark:border-neutral-300 rounded-lg",style:st({top:`${_.value.top}px`,left:`${_.value.left}px`,boxShadow:"4px 4px 0 0 rgba(0, 0, 0, 0.25)",backgroundImage:`
|
|
58
58
|
repeating-linear-gradient(
|
|
59
59
|
45deg,
|
|
60
60
|
transparent,
|
|
@@ -62,18 +62,18 @@ Line 3`),u=p(""),s=p(""),m=p("option2"),h=p(""),x=p(""),c=p(""),f=p([]),y=p(["te
|
|
|
62
62
|
rgba(0, 0, 0, 0.03) 2px,
|
|
63
63
|
rgba(0, 0, 0, 0.03) 4px
|
|
64
64
|
)
|
|
65
|
-
`})},[e("div",
|
|
65
|
+
`})},[e("div",Bw,[e("div",Fw,[e("div",Nw," Search: "+S(c.value||"..."),1)]),g.value.length>0?(r(),o("div",qw,[(r(!0),o(he,null,we(g.value,(Q,le)=>(r(),o("button",{key:`${Q.type}-${Q.value}`,onClick:me=>M(Q),class:oe(["w-full px-3 py-2 text-left hover:bg-black/5 dark:hover:bg-white/10 transition-colors flex items-start gap-2 text-sm",{"bg-black/10 dark:bg-white/10":le===y.value}])},[e("span",Ww,S(Q.type),1),e("div",Kw,[e("div",null,S(Q.label),1),Q.description?(r(),o("div",Jw,S(Q.description),1)):T("",!0)])],10,Hw))),128))])):(r(),o("div",Yw," No results found ")),J[0]||(J[0]=e("div",{class:"px-3 py-2 border-t border-neutral-200 dark:border-neutral-700 text-xs text-neutral-500 dark:text-neutral-400"},[e("div",null,"↑↓ Navigate • Enter/Tab Select • Esc Cancel")],-1))])],4)):T("",!0)]))]))}}),Zw={class:"min-h-screen bg-white dark:bg-black p-8"},Xw={class:"max-w-4xl mx-auto space-y-8"},Qw={class:"space-y-4"},e4={class:"block"},t4={class:"p-4 border border-neutral-300 dark:border-neutral-700 rounded"},r4={class:"text-sm font-mono whitespace-pre-wrap"},a4=fe({__name:"TestReferenceInput",setup(t){const a=m("Hello, type @ to see search suggestions"),n=async s=>{await new Promise(d=>setTimeout(d,100));const l=[{type:"variable",value:"userName",label:"userName",description:"Current user name"},{type:"variable",value:"userEmail",label:"userEmail",description:"Current user email"},{type:"function",value:"getCurrentDate()",label:"getCurrentDate",description:"Get current date"},{type:"prompt",value:"{{prompt:welcome}}",label:"welcome",description:"Welcome message prompt"},{type:"prompt",value:"{{prompt:goodbye}}",label:"goodbye",description:"Goodbye message prompt"}];return s?l.filter(d=>d.label.toLowerCase().includes(s.toLowerCase())):l};return(s,l)=>(r(),o("div",Zw,[e("div",Xw,[l[4]||(l[4]=e("div",null,[e("h1",{class:"text-2xl font-bold mb-2"},"ReferenceInput Component Test"),e("p",{class:"text-neutral-600 dark:text-neutral-400"}," Type @ to trigger search mode and test the reference input functionality ")],-1)),e("div",Qw,[e("label",e4,[l[1]||(l[1]=e("span",{class:"text-sm font-medium mb-2 block"},"Test Reference Input",-1)),w(Gw,{modelValue:a.value,"onUpdate:modelValue":l[0]||(l[0]=d=>a.value=d),search:n,placeholder:"Type @ to insert references...",rows:10},null,8,["modelValue"])]),e("div",t4,[l[2]||(l[2]=e("h3",{class:"text-sm font-medium mb-2"},"Current Value:",-1)),e("pre",r4,S(a.value),1)]),l[3]||(l[3]=e("div",{class:"p-4 bg-neutral-100 dark:bg-neutral-900 rounded"},[e("h3",{class:"text-sm font-medium mb-2"},"Test Instructions:"),e("ul",{class:"text-sm space-y-1 list-disc list-inside"},[e("li",null,"Type @ anywhere in the textarea to trigger search mode"),e("li",null,"Type characters after @ to filter results"),e("li",null,"Use arrow keys to navigate results"),e("li",null,"Press Enter or Tab to select a result"),e("li",null,"Press Escape to cancel search mode"),e("li",null,"Search exits if no results and you type 5+ more characters"),e("li",null,"Moving cursor before @ also exits search mode")])],-1))])])]))}}),o4={class:"p-8 space-y-8"},n4={class:"space-y-2 mb-4"},l4={class:"mt-4 p-2 bg-neutral-100 rounded"},s4=fe({__name:"DebugView",setup(t){const a=m([{id:"1",name:"Item 1"}]),n=()=>{console.log("Adding item...");const d={id:crypto.randomUUID(),name:`Item ${a.value.length+1}`};a.value.push(d),console.log("Item added, total:",a.value.length)};xe(a,()=>{console.log("Items changed:",a.value.length)},{deep:!0});const s={props:["modelValue"],emits:["update:modelValue"],template:`
|
|
66
66
|
<div>
|
|
67
67
|
<div v-for="item in modelValue" :key="item.id">
|
|
68
68
|
{{ item.name }}
|
|
69
69
|
</div>
|
|
70
70
|
<button @click="addChild">Add in Child</button>
|
|
71
71
|
</div>
|
|
72
|
-
`,setup(
|
|
72
|
+
`,setup(d,{emit:i}){return{addChild:()=>{console.log("Child adding item...");const g={id:crypto.randomUUID(),name:`Child Item ${d.modelValue.length+1}`};i("update:modelValue",[...d.modelValue,g])}}}},l=m([{id:"1",name:"Parent Item 1"}]);return(d,i)=>(r(),o("div",o4,[e("div",null,[i[1]||(i[1]=e("h2",{class:"text-xl font-bold mb-4"},"Direct Array Test",-1)),e("div",n4,[(r(!0),o(he,null,we(a.value,c=>(r(),o("div",{key:c.id,class:"p-2 border"},S(c.name),1))),128))]),e("button",{onClick:n,class:"px-4 py-2 bg-black text-white rounded"}," Add Item ")]),e("div",null,[i[2]||(i[2]=e("h2",{class:"text-xl font-bold mb-4"},"Parent-Child Test",-1)),w(s,{modelValue:l.value,"onUpdate:modelValue":i[0]||(i[0]=c=>l.value=c)},null,8,["modelValue"]),e("pre",l4,S(JSON.stringify(l.value,null,2)),1)])]))}}),i4={class:"min-h-screen bg-white dark:bg-black p-8"},u4={class:"max-w-4xl mx-auto"},d4={class:"space-y-8"},c4={class:"space-y-4"},p4={class:"space-y-4"},m4={class:"p-4 bg-neutral-100 dark:bg-neutral-900 rounded-lg"},v4={class:"text-sm text-black dark:text-white"},f4=fe({__name:"TestPromptInput",setup(t){const a=m([{type:"string",value:""}]),n=i=>{a.value=i};Pe(()=>{window.setPromptSegments=n}),Pr(()=>{delete window.setPromptSegments});const s=async i=>{await new Promise(y=>setTimeout(y,300));const c=(i||"").toLowerCase();return[{type:"variable",value:"first_name",label:"First Name",description:"The user's first name"},{type:"variable",value:"current_date",label:"current_date",description:"Today's date in ISO format"},{type:"variable",value:"system_time",label:"system_time",description:"Current system time"},{type:"variable",value:"api_key",label:"api_key",description:"API key for external services"},{type:"variable",value:"workspace_id",label:"workspace_id",description:"Current workspace identifier"},{type:"prompt",id:"7102973",label:"Onboarding Prompt",schema:{type:"object",properties:{first_name:{type:"string",description:"the first name of the user"}},required:["first_name"],additionalProperties:!1}},{type:"prompt",id:"error_handler",label:"Error Handler",description:"Error handling prompt",schema:{type:"object",properties:{error_message:{type:"string"}},required:["error_message"]}},{type:"prompt",id:"code_review",label:"Code Review",description:"Code review assistant prompt"},{type:"prompt",id:"data_analysis",label:"Data Analysis",description:"Data analysis insights generator"},{type:"prompt",id:"summary_generator",label:"Summary Generator",description:"Creates concise summaries of long text"}].filter(y=>(y.label||y.id||y.value||"").toLowerCase().includes(c)).slice(0,8)},l=i=>{a.value=i,console.log("Updated:",i)},d=(i,c)=>{console.log("Segment clicked:",i),i.type==="prompt"?alert(`Prompt clicked: ${i.label||i.id}
|
|
73
73
|
|
|
74
74
|
In a real app, this could:
|
|
75
75
|
- Show a modal with prompt details
|
|
76
76
|
- Expand inline to show the full prompt
|
|
77
|
-
- Navigate to the prompt editor`):
|
|
77
|
+
- Navigate to the prompt editor`):i.type==="variable"&&alert(`Variable clicked: ${i.label||i.value}
|
|
78
78
|
|
|
79
|
-
Description: ${s.meta?.description||"No description"}`)};return(s,m)=>(r(),n("div",Xw,[e("div",Qw,[m[5]||(m[5]=e("h1",{class:"text-3xl font-bold mb-8 text-black dark:text-white"}," PromptInput Component Test ",-1)),e("div",e4,[e("div",t4,[m[0]||(m[0]=e("h2",{class:"text-xl font-semibold text-black dark:text-white"}," Basic Usage ",-1)),m[1]||(m[1]=e("p",{class:"text-neutral-600 dark:text-neutral-400"}," Type @ to trigger the autocomplete menu. Use arrow keys to navigate and Enter to select. ",-1)),e("div",null,[w(Gt,{"model-value":o.value,search:i,placeholder:"Type @ to insert variables or prompts...","onUpdate:modelValue":l,onSegmentClick:u},null,8,["model-value"])])]),e("div",r4,[m[3]||(m[3]=e("h2",{class:"text-xl font-semibold text-black dark:text-white"}," Current Value ",-1)),e("div",a4,[m[2]||(m[2]=e("h3",{class:"text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-2"}," Segments (value): ",-1)),e("pre",o4,C(JSON.stringify(o.value,null,2)),1)])]),m[4]||(m[4]=Ja('<div class="space-y-4"><h2 class="text-xl font-semibold text-black dark:text-white"> Testing Instructions </h2><ul class="list-disc list-inside space-y-2 text-neutral-600 dark:text-neutral-400"><li>Type @ anywhere in the text to open the search dialog</li><li>Continue typing to search for variables or prompts</li><li>Use arrow keys (↑↓) to navigate results</li><li>Press Enter to select a result or click with mouse</li><li>Press Escape to close the dialog</li><li>Click outside the dialog to close it</li><li>Use Backspace/Delete to remove tags</li><li> The dialog will auto-close after typing 5+ characters without selection </li><li><strong>NEW: Click on any tag to see action handling!</strong></li></ul></div><div class="space-y-4"><h2 class="text-xl font-semibold text-black dark:text-white"> Test Scenarios </h2><div class="grid grid-cols-1 md:grid-cols-2 gap-4"><div class="p-4 border-2 border-neutral-300 dark:border-neutral-700 rounded-lg"><h3 class="font-medium text-black dark:text-white mb-2"> Variables </h3><p class="text-sm text-neutral-600 dark:text-neutral-400"> Try: @user, @date, @time, @api, @work </p></div><div class="p-4 border-2 border-neutral-300 dark:border-neutral-700 rounded-lg"><h3 class="font-medium text-black dark:text-white mb-2"> Prompts </h3><p class="text-sm text-neutral-600 dark:text-neutral-400"> Try: @greet, @error, @code, @data, @summ </p></div><div class="p-4 border-2 border-neutral-300 dark:border-neutral-700 rounded-lg"><h3 class="font-medium text-black dark:text-white mb-2"> Mixed Content </h3><p class="text-sm text-neutral-600 dark:text-neutral-400"> Mix text with multiple tags and test editing </p></div><div class="p-4 border-2 border-neutral-300 dark:border-neutral-700 rounded-lg"><h3 class="font-medium text-black dark:text-white mb-2"> Edge Cases </h3><p class="text-sm text-neutral-600 dark:text-neutral-400"> Test @ at start/end, multiple @@ symbols, etc. </p></div></div></div>',2))])])]))}}),l4={class:"relative"},s4={key:0,class:"mt-1 text-sm text-red-500"},i4=ve({__name:"JsonEditor",props:{modelValue:{},placeholder:{},error:{},rows:{},readonly:{type:Boolean}},emits:["update:modelValue","blur"],setup(t,{emit:o}){self.MonacoEnvironment={getWorker(b,v){return v==="json"?new oo:new no}};const a=t,i=o,l=p(null);let u=null,s=!1;const m=p(!1),h={minimap:{enabled:!1},fontSize:14,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',lineHeight:24,padding:{top:12,bottom:12},scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0,formatOnPaste:!0,formatOnType:!0,readOnly:a.readonly,quickSuggestions:{other:"on",comments:"off",strings:"on"},suggestOnTriggerCharacters:!0,acceptSuggestionOnCommitCharacter:!0,tabSize:2,detectIndentation:!1,renderLineHighlight:"none",scrollbar:{vertical:"auto",horizontal:"hidden",verticalScrollbarSize:10}},x=()=>{if(!(!u||a.readonly))try{const b=u.getValue(),v=JSON.parse(b),d=JSON.stringify(v,null,2);d!==b&&(s=!0,u.setValue(d),s=!1)}catch{}},c=()=>{m.value=document.documentElement.classList.contains("dark"),u&&or.setTheme(m.value?"vs-dark":"vs")},f=()=>{l.value&&(u=or.create(l.value,{value:a.modelValue||"{}",language:"json",theme:m.value?"vs-dark":"vs",...h})(l.value).__monacoEditor=u,u.onDidChangeModelContent(()=>{if(!s){const b=u.getValue();i("update:modelValue",b)}}),u.onDidBlurEditorText(()=>{i("blur"),x()}))};Pe(async()=>{c(),await Le(),f();const b=new MutationObserver(c);b.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),Ye(()=>{b.disconnect(),u&&u.dispose()})}),ge(()=>a.modelValue,b=>{u&&u.getValue()!==b&&(s=!0,u.setValue(b||""),s=!1)}),ge(()=>a.readonly,b=>{u&&u.updateOptions({readOnly:b})});const y=a.rows?`${a.rows*1.5}rem`:"18rem";return(b,v)=>(r(),n("div",l4,[e("div",{class:ne(["border rounded overflow-hidden bg-white dark:bg-black",[t.error?"border-red-500":"border-black dark:border-neutral-300"]])},[e("div",{ref_key:"containerRef",ref:l,class:"monaco-editor-container",style:st({height:S(y)})},null,4)],2),t.error?(r(),n("div",s4,C(t.error),1)):T("",!0)]))}}),wr=Xe(i4,[["__scopeId","data-v-1393c576"]]),u4={class:"p-8"},d4={class:"space-y-4"},c4={class:"space-y-4"},p4={class:"space-y-4"},m4=ve({__name:"TestJsonEditorModal",setup(t){const o=p(!1),a=p(JSON.stringify({name:"Test",value:123},null,2)),i=p(!1),l=p(JSON.stringify({editable:!0,count:0},null,2));return(u,s)=>(r(),n("div",u4,[s[13]||(s[13]=e("h1",{class:"text-3xl font-bold mb-6"},"JsonEditor in Modal Test",-1)),e("div",d4,[e("div",null,[s[7]||(s[7]=e("h2",{class:"text-xl font-semibold mb-2"}," Read-only JsonEditor in Modal ",-1)),s[8]||(s[8]=e("p",{class:"text-neutral-600 dark:text-neutral-400 mb-4"}," This should NOT show unsaved changes warning when closing ",-1)),e("button",{onClick:s[0]||(s[0]=m=>o.value=!0),class:"px-4 py-2 bg-black dark:bg-white text-white dark:text-black border-2 border-black dark:border-white"}," Open Read-only Modal ")]),e("div",null,[s[9]||(s[9]=e("h2",{class:"text-xl font-semibold mb-2"},"Editable JsonEditor in Modal",-1)),s[10]||(s[10]=e("p",{class:"text-neutral-600 dark:text-neutral-400 mb-4"}," This should NOT show unsaved changes warning on initial close, but SHOULD show it after editing ",-1)),e("button",{onClick:s[1]||(s[1]=m=>i.value=!0),class:"px-4 py-2 bg-black dark:bg-white text-white dark:text-black border-2 border-black dark:border-white"}," Open Editable Modal ")])]),w(He,{modelValue:o.value,"onUpdate:modelValue":s[3]||(s[3]=m=>o.value=m),title:"Read-only JSON Schema",width:"max-w-4xl"},{footer:j(()=>[e("button",{onClick:s[2]||(s[2]=m=>o.value=!1),class:"px-4 py-2 border-2 border-black dark:border-white bg-white dark:bg-black text-black dark:text-white"}," Close ")]),default:j(()=>[e("div",c4,[s[11]||(s[11]=e("p",{class:"text-sm text-neutral-600 dark:text-neutral-400"}," This is a read-only JSON editor. No changes can be made. ",-1)),w(wr,{"model-value":a.value,readonly:!0},null,8,["model-value"])])]),_:1},8,["modelValue"]),w(He,{modelValue:i.value,"onUpdate:modelValue":s[6]||(s[6]=m=>i.value=m),title:"Editable JSON Schema",width:"max-w-4xl"},{footer:j(()=>[e("button",{onClick:s[5]||(s[5]=m=>i.value=!1),class:"px-4 py-2 border-2 border-black dark:border-white bg-white dark:bg-black text-black dark:text-white"}," Close ")]),default:j(()=>[e("div",p4,[s[12]||(s[12]=e("p",{class:"text-sm text-neutral-600 dark:text-neutral-400"}," This is an editable JSON editor. Changes will be tracked. ",-1)),w(wr,{modelValue:l.value,"onUpdate:modelValue":s[4]||(s[4]=m=>l.value=m)},null,8,["modelValue"])])]),_:1},8,["modelValue"])]))}}),v4={class:"p-8 max-w-2xl mx-auto"},f4={class:"mb-6"},h4={class:"p-4 bg-neutral-100 dark:bg-neutral-800 rounded font-mono text-sm"},g4={key:0},b4={class:"whitespace-pre-wrap"},x4={key:1,class:"text-neutral-500"},y4={class:"mb-6"},k4={class:"space-y-2"},w4={class:"mt-6"},_4={class:"p-4 bg-green-50 dark:bg-green-900 rounded min-h-[100px]"},$4={key:0,class:"font-mono"},C4={key:1,class:"text-neutral-500"},S4="10000000-0000-0000-0000-000000000101",_r="10000000-0000-0000-0000-000000000102",T4=ve({__name:"TestPromptInterpolation",setup(t){const o=p([]),a=p(null),i=p(null),l=p(""),u=p("Alice Johnson"),s=p("alice@example.com"),m=p("28"),{data:h,error:x}=Ne(he(`/api/prompts/${encodeURIComponent(S4)}`)).json(),{data:c,error:f}=Ne(he(`/api/prompts/${encodeURIComponent(_r)}`)).json();ge(h,v=>{if(v){a.value=v;try{o.value=JSON.parse(v.prompt)}catch(d){console.error("Failed to parse prompt A:",d)}}},{immediate:!0}),ge(c,v=>{v&&(i.value=v)},{immediate:!0});function y(v,d){return v.map(k=>{if(k.type==="string")return k.value||"";if(k.type==="variable"){const g=d[k.value];return g===void 0?`{{${k.value}}}`:typeof g=="string"?g:JSON.stringify(g)}else if(k.type==="prompt"){if(k.id===_r&&i.value)try{const g=JSON.parse(i.value.prompt);return y(g,d)}catch{return`[Error loading prompt: ${k.label}]`}return""}return""}).join("")}function b(){const v={name:u.value,email:s.value,age:m.value};l.value=y(o.value,v)}return(v,d)=>(r(),n("div",v4,[d[11]||(d[11]=e("h1",{class:"text-2xl font-bold mb-6"},"Prompt Interpolation Test",-1)),e("div",f4,[d[4]||(d[4]=e("h2",{class:"text-lg font-semibold mb-2"},"Prompt Template",-1)),e("div",h4,[a.value?(r(),n("div",g4,[d[3]||(d[3]=e("div",{class:"font-bold mb-2"},"Prompt A:",-1)),e("pre",b4,C(JSON.stringify(o.value,null,2)),1)])):(r(),n("div",x4,"Loading..."))])]),e("div",y4,[d[8]||(d[8]=e("h2",{class:"text-lg font-semibold mb-2"},"Context Values",-1)),e("div",k4,[e("div",null,[d[5]||(d[5]=e("label",{class:"block text-sm mb-1"},"Name:",-1)),Ae(e("input",{"onUpdate:modelValue":d[0]||(d[0]=k=>u.value=k),type:"text",class:"w-full px-3 py-2 border rounded"},null,512),[[Qe,u.value]])]),e("div",null,[d[6]||(d[6]=e("label",{class:"block text-sm mb-1"},"Email:",-1)),Ae(e("input",{"onUpdate:modelValue":d[1]||(d[1]=k=>s.value=k),type:"text",class:"w-full px-3 py-2 border rounded"},null,512),[[Qe,s.value]])]),e("div",null,[d[7]||(d[7]=e("label",{class:"block text-sm mb-1"},"Age:",-1)),Ae(e("input",{"onUpdate:modelValue":d[2]||(d[2]=k=>m.value=k),type:"text",class:"w-full px-3 py-2 border rounded"},null,512),[[Qe,m.value]])])])]),e("button",{onClick:b,class:"px-4 py-2 bg-black text-white rounded hover:bg-neutral-800"}," Render Prompt "),e("div",w4,[d[9]||(d[9]=e("h2",{class:"text-lg font-semibold mb-2"},"Rendered Output",-1)),e("div",_4,[l.value?(r(),n("div",$4,C(l.value),1)):(r(),n("div",C4,' Click "Render Prompt" to see output '))]),d[10]||(d[10]=e("div",{class:"mt-4 p-4 bg-accent-50 dark:bg-accent-900 rounded text-sm"},[e("div",{class:"font-semibold mb-1"}," Expected Output (when feature is implemented): "),e("div",{class:"font-mono"}," User Profile: Alice Johnson <alice@example.com> (Age: 28) ")],-1))])]))}}),sa=Ya({history:Ga(_t()),routes:[{path:"/login",name:"login",component:Y2,meta:{public:!0}},{path:"/",redirect:"/threads"},{path:"/agents",name:"agents",component:ym},{path:"/threads",name:"threads",component:hr},{path:"/threads/:id",name:"thread-detail",component:hr},{path:"/prompts",name:"prompts",component:Ny},{path:"/prompts/:id",name:"prompt-edit",component:Ky},{path:"/models",name:"models",component:Bk},{path:"/providers",name:"providers",component:s2},{path:"/tools",name:"tools",component:I2},{path:"/settings/users",name:"users",component:L2},{path:"/settings/api-keys",name:"api-keys",component:R2},{path:"/test",name:"test",component:Iw},{path:"/test-reference-input",name:"test-reference-input",component:Kw},{path:"/debug",name:"debug",component:Zw},{path:"/test-prompt-input",name:"test-prompt-input",component:n4},{path:"/test-json-editor-modal",name:"test-json-editor-modal",component:m4},{path:"/test-prompt-interpolation",name:"test-prompt-interpolation",component:T4}]});sa.beforeEach(async(t,o,a)=>{const i=t.meta.public===!0,l=localStorage.getItem("auth_token");!i&&!l?a({name:"login"}):i&&l&&t.name==="login"?a({name:"threads"}):a()});const I4=window.fetch;window.fetch=async function(t,o){const a=typeof t=="string"?t:t instanceof URL?t.toString():t.url,i=_t(),l=i==="/"?"/api/":`${i}/api/`,u=a.includes(l)||i==="/"&&a.startsWith("/api/");if(u){const h=localStorage.getItem("auth_token");h&&o?o.headers={...o.headers,Authorization:`Bearer ${h}`}:h&&(o={...o,headers:{Authorization:`Bearer ${h}`}})}const s=await I4(t,o),m=a.includes("/api/auth/");return s.status===401&&u&&!m&&(localStorage.removeItem("auth_token"),window.location.href=he("/login")),s};const Dt=Za(Ju);Dt.use(fo,{endpoint:he("/api")});Dt.use(Xa,Qa(bi));Dt.use(sa);Dt.mount("#app");
|
|
79
|
+
Description: ${i.meta?.description||"No description"}`)};return(i,c)=>(r(),o("div",i4,[e("div",u4,[c[5]||(c[5]=e("h1",{class:"text-3xl font-bold mb-8 text-black dark:text-white"}," PromptInput Component Test ",-1)),e("div",d4,[e("div",c4,[c[0]||(c[0]=e("h2",{class:"text-xl font-semibold text-black dark:text-white"}," Basic Usage ",-1)),c[1]||(c[1]=e("p",{class:"text-neutral-600 dark:text-neutral-400"}," Type @ to trigger the autocomplete menu. Use arrow keys to navigate and Enter to select. ",-1)),e("div",null,[w(Xt,{"model-value":a.value,search:s,placeholder:"Type @ to insert variables or prompts...","onUpdate:modelValue":l,onSegmentClick:d},null,8,["model-value"])])]),e("div",p4,[c[3]||(c[3]=e("h2",{class:"text-xl font-semibold text-black dark:text-white"}," Current Value ",-1)),e("div",m4,[c[2]||(c[2]=e("h3",{class:"text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-2"}," Segments (value): ",-1)),e("pre",v4,S(JSON.stringify(a.value,null,2)),1)])]),c[4]||(c[4]=to('<div class="space-y-4"><h2 class="text-xl font-semibold text-black dark:text-white"> Testing Instructions </h2><ul class="list-disc list-inside space-y-2 text-neutral-600 dark:text-neutral-400"><li>Type @ anywhere in the text to open the search dialog</li><li>Continue typing to search for variables or prompts</li><li>Use arrow keys (↑↓) to navigate results</li><li>Press Enter to select a result or click with mouse</li><li>Press Escape to close the dialog</li><li>Click outside the dialog to close it</li><li>Use Backspace/Delete to remove tags</li><li> The dialog will auto-close after typing 5+ characters without selection </li><li><strong>NEW: Click on any tag to see action handling!</strong></li></ul></div><div class="space-y-4"><h2 class="text-xl font-semibold text-black dark:text-white"> Test Scenarios </h2><div class="grid grid-cols-1 md:grid-cols-2 gap-4"><div class="p-4 border-2 border-neutral-300 dark:border-neutral-700 rounded-lg"><h3 class="font-medium text-black dark:text-white mb-2"> Variables </h3><p class="text-sm text-neutral-600 dark:text-neutral-400"> Try: @user, @date, @time, @api, @work </p></div><div class="p-4 border-2 border-neutral-300 dark:border-neutral-700 rounded-lg"><h3 class="font-medium text-black dark:text-white mb-2"> Prompts </h3><p class="text-sm text-neutral-600 dark:text-neutral-400"> Try: @greet, @error, @code, @data, @summ </p></div><div class="p-4 border-2 border-neutral-300 dark:border-neutral-700 rounded-lg"><h3 class="font-medium text-black dark:text-white mb-2"> Mixed Content </h3><p class="text-sm text-neutral-600 dark:text-neutral-400"> Mix text with multiple tags and test editing </p></div><div class="p-4 border-2 border-neutral-300 dark:border-neutral-700 rounded-lg"><h3 class="font-medium text-black dark:text-white mb-2"> Edge Cases </h3><p class="text-sm text-neutral-600 dark:text-neutral-400"> Test @ at start/end, multiple @@ symbols, etc. </p></div></div></div>',2))])])]))}}),h4={class:"relative"},g4={key:0,class:"mt-1 text-sm text-red-500"},b4=fe({__name:"JsonEditor",props:{modelValue:{},placeholder:{},error:{},rows:{},readonly:{type:Boolean}},emits:["update:modelValue","blur"],setup(t,{emit:a}){self.MonacoEnvironment={getWorker(_,b){return b==="json"?new po:new mo}};const n=t,s=a,l=m(null);let d=null,i=!1;const c=m(!1),g={minimap:{enabled:!1},fontSize:14,fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',lineHeight:24,padding:{top:12,bottom:12},scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0,formatOnPaste:!0,formatOnType:!0,readOnly:n.readonly,quickSuggestions:{other:"on",comments:"off",strings:"on"},suggestOnTriggerCharacters:!0,acceptSuggestionOnCommitCharacter:!0,tabSize:2,detectIndentation:!1,renderLineHighlight:"none",scrollbar:{vertical:"auto",horizontal:"hidden",verticalScrollbarSize:10}},y=()=>{if(!(!d||n.readonly))try{const _=d.getValue(),b=JSON.parse(_),u=JSON.stringify(b,null,2);u!==_&&(i=!0,d.setValue(u),i=!1)}catch{}},v=()=>{c.value=document.documentElement.classList.contains("dark"),d&&ir.setTheme(c.value?"vs-dark":"vs")},f=()=>{l.value&&(d=ir.create(l.value,{value:n.modelValue||"{}",language:"json",theme:c.value?"vs-dark":"vs",...g})(l.value).__monacoEditor=d,d.onDidChangeModelContent(()=>{if(!i){const _=d.getValue();s("update:modelValue",_)}}),d.onDidBlurEditorText(()=>{s("blur"),y()}))};Pe(async()=>{v(),await Le(),f();const _=new MutationObserver(v);_.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),Ye(()=>{_.disconnect(),d&&d.dispose()})}),xe(()=>n.modelValue,_=>{d&&d.getValue()!==_&&(i=!0,d.setValue(_||""),i=!1)}),xe(()=>n.readonly,_=>{d&&d.updateOptions({readOnly:_})});const h=n.rows?`${n.rows*1.5}rem`:"18rem";return(_,b)=>(r(),o("div",h4,[e("div",{class:oe(["border rounded overflow-hidden bg-white dark:bg-black",[t.error?"border-red-500":"border-black dark:border-neutral-300"]])},[e("div",{ref_key:"containerRef",ref:l,class:"monaco-editor-container",style:st({height:$(h)})},null,4)],2),t.error?(r(),o("div",g4,S(t.error),1)):T("",!0)]))}}),Sr=Xe(b4,[["__scopeId","data-v-1393c576"]]),x4={class:"p-8"},y4={class:"space-y-4"},k4={class:"space-y-4"},w4={class:"space-y-4"},_4=fe({__name:"TestJsonEditorModal",setup(t){const a=m(!1),n=m(JSON.stringify({name:"Test",value:123},null,2)),s=m(!1),l=m(JSON.stringify({editable:!0,count:0},null,2));return(d,i)=>(r(),o("div",x4,[i[13]||(i[13]=e("h1",{class:"text-3xl font-bold mb-6"},"JsonEditor in Modal Test",-1)),e("div",y4,[e("div",null,[i[7]||(i[7]=e("h2",{class:"text-xl font-semibold mb-2"}," Read-only JsonEditor in Modal ",-1)),i[8]||(i[8]=e("p",{class:"text-neutral-600 dark:text-neutral-400 mb-4"}," This should NOT show unsaved changes warning when closing ",-1)),e("button",{onClick:i[0]||(i[0]=c=>a.value=!0),class:"px-4 py-2 bg-black dark:bg-white text-white dark:text-black border-2 border-black dark:border-white"}," Open Read-only Modal ")]),e("div",null,[i[9]||(i[9]=e("h2",{class:"text-xl font-semibold mb-2"},"Editable JsonEditor in Modal",-1)),i[10]||(i[10]=e("p",{class:"text-neutral-600 dark:text-neutral-400 mb-4"}," This should NOT show unsaved changes warning on initial close, but SHOULD show it after editing ",-1)),e("button",{onClick:i[1]||(i[1]=c=>s.value=!0),class:"px-4 py-2 bg-black dark:bg-white text-white dark:text-black border-2 border-black dark:border-white"}," Open Editable Modal ")])]),w(He,{modelValue:a.value,"onUpdate:modelValue":i[3]||(i[3]=c=>a.value=c),title:"Read-only JSON Schema",width:"max-w-4xl"},{footer:j(()=>[e("button",{onClick:i[2]||(i[2]=c=>a.value=!1),class:"px-4 py-2 border-2 border-black dark:border-white bg-white dark:bg-black text-black dark:text-white"}," Close ")]),default:j(()=>[e("div",k4,[i[11]||(i[11]=e("p",{class:"text-sm text-neutral-600 dark:text-neutral-400"}," This is a read-only JSON editor. No changes can be made. ",-1)),w(Sr,{"model-value":n.value,readonly:!0},null,8,["model-value"])])]),_:1},8,["modelValue"]),w(He,{modelValue:s.value,"onUpdate:modelValue":i[6]||(i[6]=c=>s.value=c),title:"Editable JSON Schema",width:"max-w-4xl"},{footer:j(()=>[e("button",{onClick:i[5]||(i[5]=c=>s.value=!1),class:"px-4 py-2 border-2 border-black dark:border-white bg-white dark:bg-black text-black dark:text-white"}," Close ")]),default:j(()=>[e("div",w4,[i[12]||(i[12]=e("p",{class:"text-sm text-neutral-600 dark:text-neutral-400"}," This is an editable JSON editor. Changes will be tracked. ",-1)),w(Sr,{modelValue:l.value,"onUpdate:modelValue":i[4]||(i[4]=c=>l.value=c)},null,8,["modelValue"])])]),_:1},8,["modelValue"])]))}}),$4={class:"p-8 max-w-2xl mx-auto"},C4={class:"mb-6"},S4={class:"p-4 bg-neutral-100 dark:bg-neutral-800 rounded font-mono text-sm"},T4={key:0},I4={class:"whitespace-pre-wrap"},z4={key:1,class:"text-neutral-500"},M4={class:"mb-6"},V4={class:"space-y-2"},E4={class:"mt-6"},L4={class:"p-4 bg-green-50 dark:bg-green-900 rounded min-h-[100px]"},P4={key:0,class:"font-mono"},A4={key:1,class:"text-neutral-500"},j4="10000000-0000-0000-0000-000000000101",Tr="10000000-0000-0000-0000-000000000102",D4=fe({__name:"TestPromptInterpolation",setup(t){const a=m([]),n=m(null),s=m(null),l=m(""),d=m("Alice Johnson"),i=m("alice@example.com"),c=m("28"),{data:g,error:y}=Ne(ge(`/api/prompts/${encodeURIComponent(j4)}`)).json(),{data:v,error:f}=Ne(ge(`/api/prompts/${encodeURIComponent(Tr)}`)).json();xe(g,b=>{if(b){n.value=b;try{a.value=JSON.parse(b.prompt)}catch(u){console.error("Failed to parse prompt A:",u)}}},{immediate:!0}),xe(v,b=>{b&&(s.value=b)},{immediate:!0});function h(b,u){return b.map(x=>{if(x.type==="string")return x.value||"";if(x.type==="variable"){const p=u[x.value];return p===void 0?`{{${x.value}}}`:typeof p=="string"?p:JSON.stringify(p)}else if(x.type==="prompt"){if(x.id===Tr&&s.value)try{const p=JSON.parse(s.value.prompt);return h(p,u)}catch{return`[Error loading prompt: ${x.label}]`}return""}return""}).join("")}function _(){const b={name:d.value,email:i.value,age:c.value};l.value=h(a.value,b)}return(b,u)=>(r(),o("div",$4,[u[11]||(u[11]=e("h1",{class:"text-2xl font-bold mb-6"},"Prompt Interpolation Test",-1)),e("div",C4,[u[4]||(u[4]=e("h2",{class:"text-lg font-semibold mb-2"},"Prompt Template",-1)),e("div",S4,[n.value?(r(),o("div",T4,[u[3]||(u[3]=e("div",{class:"font-bold mb-2"},"Prompt A:",-1)),e("pre",I4,S(JSON.stringify(a.value,null,2)),1)])):(r(),o("div",z4,"Loading..."))])]),e("div",M4,[u[8]||(u[8]=e("h2",{class:"text-lg font-semibold mb-2"},"Context Values",-1)),e("div",V4,[e("div",null,[u[5]||(u[5]=e("label",{class:"block text-sm mb-1"},"Name:",-1)),Ae(e("input",{"onUpdate:modelValue":u[0]||(u[0]=x=>d.value=x),type:"text",class:"w-full px-3 py-2 border rounded"},null,512),[[Qe,d.value]])]),e("div",null,[u[6]||(u[6]=e("label",{class:"block text-sm mb-1"},"Email:",-1)),Ae(e("input",{"onUpdate:modelValue":u[1]||(u[1]=x=>i.value=x),type:"text",class:"w-full px-3 py-2 border rounded"},null,512),[[Qe,i.value]])]),e("div",null,[u[7]||(u[7]=e("label",{class:"block text-sm mb-1"},"Age:",-1)),Ae(e("input",{"onUpdate:modelValue":u[2]||(u[2]=x=>c.value=x),type:"text",class:"w-full px-3 py-2 border rounded"},null,512),[[Qe,c.value]])])])]),e("button",{onClick:_,class:"px-4 py-2 bg-black text-white rounded hover:bg-neutral-800"}," Render Prompt "),e("div",E4,[u[9]||(u[9]=e("h2",{class:"text-lg font-semibold mb-2"},"Rendered Output",-1)),e("div",L4,[l.value?(r(),o("div",P4,S(l.value),1)):(r(),o("div",A4,' Click "Render Prompt" to see output '))]),u[10]||(u[10]=e("div",{class:"mt-4 p-4 bg-accent-50 dark:bg-accent-900 rounded text-sm"},[e("div",{class:"font-semibold mb-1"}," Expected Output (when feature is implemented): "),e("div",{class:"font-mono"}," User Profile: Alice Johnson <alice@example.com> (Age: 28) ")],-1))])]))}}),pa=ro({history:ao($t()),routes:[{path:"/login",name:"login",component:nw,meta:{public:!0}},{path:"/",redirect:"/threads"},{path:"/agents",name:"agents",component:Im},{path:"/threads",name:"threads",component:yr},{path:"/threads/:id",name:"thread-detail",component:yr},{path:"/prompts",name:"prompts",component:Xy},{path:"/prompts/:id",name:"prompt-edit",component:rk},{path:"/models",name:"models",component:Zk},{path:"/providers",name:"providers",component:g2},{path:"/tools",name:"tools",component:R2},{path:"/settings/users",name:"users",component:N2},{path:"/settings/api-keys",name:"api-keys",component:Y2},{path:"/test",name:"test",component:Rw},{path:"/test-reference-input",name:"test-reference-input",component:a4},{path:"/debug",name:"debug",component:s4},{path:"/test-prompt-input",name:"test-prompt-input",component:f4},{path:"/test-json-editor-modal",name:"test-json-editor-modal",component:_4},{path:"/test-prompt-interpolation",name:"test-prompt-interpolation",component:D4}]});pa.beforeEach(async(t,a,n)=>{const s=t.meta.public===!0,l=localStorage.getItem("auth_token");!s&&!l?n({name:"login"}):s&&l&&t.name==="login"?n({name:"threads"}):n()});const R4=window.fetch;window.fetch=async function(t,a){const n=typeof t=="string"?t:t instanceof URL?t.toString():t.url,s=$t(),l=s==="/"?"/api/":`${s}/api/`,d=n.includes(l)||s==="/"&&n.startsWith("/api/");if(d){const g=localStorage.getItem("auth_token");g&&a?a.headers={...a.headers,Authorization:`Bearer ${g}`}:g&&(a={...a,headers:{Authorization:`Bearer ${g}`}})}const i=await R4(t,a),c=n.includes("/api/auth/");return i.status===401&&d&&!c&&(localStorage.removeItem("auth_token"),window.location.href=ge("/login")),i};const Ot=oo(ed);Ot.use(wo,{endpoint:ge("/api")});Ot.use(no,lo($i));Ot.use(pa);Ot.mount("#app");
|