@agent-spaces/server 0.3.65 → 0.3.67
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/adapters/agent-runtime.js +4 -0
- package/dist/adapters/codex-function-tool-bridge.js +144 -0
- package/dist/adapters/codex-runtime.js +23 -4
- package/dist/adapters/git.js +12 -1
- package/dist/adapters/hermes-runtime.js +210 -0
- package/dist/agents/issue-task-controller.js +69 -2
- package/dist/agents/pull-request-agent.js +115 -0
- package/dist/agents/scheduler-agent.js +1 -1
- package/dist/app.js +6 -2
- package/dist/middleware/auth.js +1 -1
- package/dist/package.json +2 -1
- package/dist/routes/agent-sse.js +1 -0
- package/dist/routes/issue.js +1 -1
- package/dist/routes/notification.js +10 -0
- package/dist/routes/version.js +94 -0
- package/dist/routes/worktree.js +93 -0
- package/dist/services/agent.js +1 -1
- package/dist/services/notification-center.js +9 -0
- package/dist/services/version.js +59 -0
- package/dist/services/workflow-command-runner.js +23 -0
- package/dist/services/workflow.js +25 -8
- package/dist/services/workspace.js +23 -1
- package/dist/services/worktree.js +207 -0
- package/dist/storage/worktree-store.js +33 -0
- package/dist/web/404.html +1 -1
- package/dist/web/__next.__PAGE__.txt +4 -4
- package/dist/web/__next._full.txt +21 -21
- package/dist/web/__next._head.txt +4 -4
- package/dist/web/__next._index.txt +13 -13
- package/dist/web/__next._tree.txt +2 -2
- package/dist/web/_next/static/chunks/{08x85faoz58i7.js → 0-92u-tiuy40a.js} +4 -4
- package/dist/web/_next/static/chunks/{0db14450oqzhg.js → 0-yizd8osmas2.js} +1 -1
- package/dist/web/_next/static/chunks/0.ln~3mnv8.69.js +1 -0
- package/dist/web/_next/static/chunks/{11cchuwoupmbf.js → 01y3e9pemva7b.js} +10 -10
- package/dist/web/_next/static/chunks/02l~tmzrgny.~.js +1 -0
- package/dist/web/_next/static/chunks/03f1bwuynjdmk.js +1 -0
- package/dist/web/_next/static/chunks/04cb4kc9r2pd1.js +1 -0
- package/dist/web/_next/static/chunks/04de6ha5_e3pp.js +1 -0
- package/dist/web/_next/static/chunks/09he0p79ov1rn.js +1 -0
- package/dist/web/_next/static/chunks/09vpocs4zuc8h.js +1 -0
- package/dist/web/_next/static/chunks/0_o2exgr0e_nh.js +1 -0
- package/dist/web/_next/static/chunks/{0xbaakj0dfc0..js → 0_y9nskc-xt2k.js} +1 -1
- package/dist/web/_next/static/chunks/0clnj-1fi6u8j.js +3 -0
- package/dist/web/_next/static/chunks/0gv40by0zzxs_.js +1 -0
- package/dist/web/_next/static/chunks/0iusr8y88.kjg.js +1 -0
- package/dist/web/_next/static/chunks/{0-a.-hl3wv99k.js → 0j-8418fxvkd1.js} +1 -1
- package/dist/web/_next/static/chunks/0j.wxxyoclma5.js +1 -0
- package/dist/web/_next/static/chunks/{0.6b64sy0g5.3.js → 0jq.16sozqik..js} +1 -1
- package/dist/web/_next/static/chunks/0jw8xdk_fpnp0.css +1 -0
- package/dist/web/_next/static/chunks/0l1lkd-wcotma.js +1 -0
- package/dist/web/_next/static/chunks/{0u6h-hqc_i52e.js → 0ncxf_zr4n839.js} +1 -1
- package/dist/web/_next/static/chunks/0ndo7um~v7vco.js +1 -0
- package/dist/web/_next/static/chunks/0ngk.~kan8wq_.js +1 -0
- package/dist/web/_next/static/chunks/0ppr271hz0xoq.js +1 -0
- package/dist/web/_next/static/chunks/0rt9bofnn6qvn.js +1 -0
- package/dist/web/_next/static/chunks/0t64.9jd00hio.js +3 -0
- package/dist/web/_next/static/chunks/0taui9--5n6-5.js +1 -0
- package/dist/web/_next/static/chunks/0ty39169lh~z3.js +1 -0
- package/dist/web/_next/static/chunks/0v8nof~waedlu.js +1 -0
- package/dist/web/_next/static/chunks/{0-pi.67w.ymsr.js → 0vcfoagnpf.aw.js} +1 -1
- package/dist/web/_next/static/chunks/{0vis~lx0nxgn-.js → 0wwwq.gyyz0vg.js} +3 -3
- package/dist/web/_next/static/chunks/0x5lak8yz7pm7.js +1 -0
- package/dist/web/_next/static/chunks/0xon_.4-o0_zq.js +7 -0
- package/dist/web/_next/static/chunks/0zjnrbt7inime.js +1 -0
- package/dist/web/_next/static/chunks/0zwebpitvpuv1.js +1 -0
- package/dist/web/_next/static/chunks/0~02o4g-o6n~m.js +1 -0
- package/dist/web/_next/static/chunks/{0w7.tb29958zj.js → 0~fjezp.k4qk3.js} +1 -1
- package/dist/web/_next/static/chunks/0~sh93re1-_rp.js +1 -0
- package/dist/web/_next/static/chunks/10_niiq0k6o-p.js +5 -0
- package/dist/web/_next/static/chunks/12tjr0_2ccrtq.js +2 -0
- package/dist/web/_next/static/chunks/12x5.go_x9mfk.js +1 -0
- package/dist/web/_next/static/chunks/{0l2w0qz1ea7ql.js → 12~5dk9i9d16t.js} +2 -2
- package/dist/web/_next/static/chunks/13iye4rv5p31b.js +1 -0
- package/dist/web/_next/static/chunks/{01~quun6sefgl.js → 13~y-b.b9rrw4.js} +1 -1
- package/dist/web/_next/static/chunks/151wzhb5q0lo5.js +1 -0
- package/dist/web/_not-found/__next._full.txt +19 -19
- package/dist/web/_not-found/__next._head.txt +4 -4
- package/dist/web/_not-found/__next._index.txt +13 -13
- package/dist/web/_not-found/__next._not-found.__PAGE__.txt +2 -2
- package/dist/web/_not-found/__next._not-found.txt +3 -3
- package/dist/web/_not-found/__next._tree.txt +2 -2
- package/dist/web/_not-found.html +1 -1
- package/dist/web/_not-found.txt +19 -19
- package/dist/web/index.html +1 -1
- package/dist/web/index.txt +21 -21
- package/dist/web/login/__next._full.txt +21 -21
- package/dist/web/login/__next._head.txt +4 -4
- package/dist/web/login/__next._index.txt +13 -13
- package/dist/web/login/__next._tree.txt +2 -2
- package/dist/web/login/__next.login.__PAGE__.txt +4 -4
- package/dist/web/login/__next.login.txt +3 -3
- package/dist/web/login.html +1 -1
- package/dist/web/login.txt +21 -21
- package/dist/web/settings/__next._full.txt +23 -23
- package/dist/web/settings/__next._head.txt +4 -4
- package/dist/web/settings/__next._index.txt +13 -13
- package/dist/web/settings/__next._tree.txt +2 -2
- package/dist/web/settings/__next.settings.__PAGE__.txt +4 -4
- package/dist/web/settings/__next.settings.txt +5 -5
- package/dist/web/settings/agents/__next._full.txt +23 -23
- package/dist/web/settings/agents/__next._head.txt +4 -4
- package/dist/web/settings/agents/__next._index.txt +13 -13
- package/dist/web/settings/agents/__next._tree.txt +2 -2
- package/dist/web/settings/agents/__next.settings.agents.__PAGE__.txt +4 -4
- package/dist/web/settings/agents/__next.settings.agents.txt +3 -3
- package/dist/web/settings/agents/__next.settings.txt +5 -5
- package/dist/web/settings/agents.html +1 -1
- package/dist/web/settings/agents.txt +23 -23
- package/dist/web/settings/mcps/__next._full.txt +23 -23
- package/dist/web/settings/mcps/__next._head.txt +4 -4
- package/dist/web/settings/mcps/__next._index.txt +13 -13
- package/dist/web/settings/mcps/__next._tree.txt +2 -2
- package/dist/web/settings/mcps/__next.settings.mcps.__PAGE__.txt +4 -4
- package/dist/web/settings/mcps/__next.settings.mcps.txt +3 -3
- package/dist/web/settings/mcps/__next.settings.txt +5 -5
- package/dist/web/settings/mcps.html +1 -1
- package/dist/web/settings/mcps.txt +23 -23
- package/dist/web/settings/models/__next._full.txt +23 -23
- package/dist/web/settings/models/__next._head.txt +4 -4
- package/dist/web/settings/models/__next._index.txt +13 -13
- package/dist/web/settings/models/__next._tree.txt +2 -2
- package/dist/web/settings/models/__next.settings.models.__PAGE__.txt +4 -4
- package/dist/web/settings/models/__next.settings.models.txt +3 -3
- package/dist/web/settings/models/__next.settings.txt +5 -5
- package/dist/web/settings/models.html +1 -1
- package/dist/web/settings/models.txt +23 -23
- package/dist/web/settings/output-styles/__next._full.txt +23 -23
- package/dist/web/settings/output-styles/__next._head.txt +4 -4
- package/dist/web/settings/output-styles/__next._index.txt +13 -13
- package/dist/web/settings/output-styles/__next._tree.txt +2 -2
- package/dist/web/settings/output-styles/__next.settings.output-styles.__PAGE__.txt +4 -4
- package/dist/web/settings/output-styles/__next.settings.output-styles.txt +3 -3
- package/dist/web/settings/output-styles/__next.settings.txt +5 -5
- package/dist/web/settings/output-styles.html +1 -1
- package/dist/web/settings/output-styles.txt +23 -23
- package/dist/web/settings/prompts/__next._full.txt +23 -23
- package/dist/web/settings/prompts/__next._head.txt +4 -4
- package/dist/web/settings/prompts/__next._index.txt +13 -13
- package/dist/web/settings/prompts/__next._tree.txt +2 -2
- package/dist/web/settings/prompts/__next.settings.prompts.__PAGE__.txt +4 -4
- package/dist/web/settings/prompts/__next.settings.prompts.txt +3 -3
- package/dist/web/settings/prompts/__next.settings.txt +5 -5
- package/dist/web/settings/prompts.html +1 -1
- package/dist/web/settings/prompts.txt +23 -23
- package/dist/web/settings/providers/__next._full.txt +23 -23
- package/dist/web/settings/providers/__next._head.txt +4 -4
- package/dist/web/settings/providers/__next._index.txt +13 -13
- package/dist/web/settings/providers/__next._tree.txt +2 -2
- package/dist/web/settings/providers/__next.settings.providers.__PAGE__.txt +4 -4
- package/dist/web/settings/providers/__next.settings.providers.txt +3 -3
- package/dist/web/settings/providers/__next.settings.txt +5 -5
- package/dist/web/settings/providers.html +1 -1
- package/dist/web/settings/providers.txt +23 -23
- package/dist/web/settings/skills/__next._full.txt +23 -23
- package/dist/web/settings/skills/__next._head.txt +4 -4
- package/dist/web/settings/skills/__next._index.txt +13 -13
- package/dist/web/settings/skills/__next._tree.txt +2 -2
- package/dist/web/settings/skills/__next.settings.skills.__PAGE__.txt +4 -4
- package/dist/web/settings/skills/__next.settings.skills.txt +3 -3
- package/dist/web/settings/skills/__next.settings.txt +5 -5
- package/dist/web/settings/skills.html +1 -1
- package/dist/web/settings/skills.txt +23 -23
- package/dist/web/settings/tools/__next._full.txt +23 -23
- package/dist/web/settings/tools/__next._head.txt +4 -4
- package/dist/web/settings/tools/__next._index.txt +13 -13
- package/dist/web/settings/tools/__next._tree.txt +2 -2
- package/dist/web/settings/tools/__next.settings.tools.__PAGE__.txt +4 -4
- package/dist/web/settings/tools/__next.settings.tools.txt +3 -3
- package/dist/web/settings/tools/__next.settings.txt +5 -5
- package/dist/web/settings/tools.html +1 -1
- package/dist/web/settings/tools.txt +23 -23
- package/dist/web/settings.html +1 -1
- package/dist/web/settings.txt +23 -23
- package/dist/web/workflows/__next._full.txt +22 -22
- package/dist/web/workflows/__next._head.txt +4 -4
- package/dist/web/workflows/__next._index.txt +13 -13
- package/dist/web/workflows/__next._tree.txt +2 -2
- package/dist/web/workflows/__next.workflows.__PAGE__.txt +4 -4
- package/dist/web/workflows/__next.workflows.txt +3 -3
- package/dist/web/workflows.html +1 -1
- package/dist/web/workflows.txt +22 -22
- package/dist/web/workspace/_/__next._full.txt +20 -20
- package/dist/web/workspace/_/__next._head.txt +4 -4
- package/dist/web/workspace/_/__next._index.txt +13 -13
- package/dist/web/workspace/_/__next._tree.txt +2 -2
- package/dist/web/workspace/_/__next.workspace.$d$id.__PAGE__.txt +3 -3
- package/dist/web/workspace/_/__next.workspace.$d$id.txt +3 -3
- package/dist/web/workspace/_/__next.workspace.txt +3 -3
- package/dist/web/workspace/_.html +1 -1
- package/dist/web/workspace/_.txt +20 -20
- package/dist/web/workspaces/__next._full.txt +21 -21
- package/dist/web/workspaces/__next._head.txt +4 -4
- package/dist/web/workspaces/__next._index.txt +13 -13
- package/dist/web/workspaces/__next._tree.txt +2 -2
- package/dist/web/workspaces/__next.workspaces.__PAGE__.txt +4 -4
- package/dist/web/workspaces/__next.workspaces.txt +3 -3
- package/dist/web/workspaces.html +1 -1
- package/dist/web/workspaces.txt +21 -21
- package/dist/ws/agent-prompt.js +32 -3
- package/dist/ws/agent-runner.js +1 -0
- package/package.json +2 -1
- package/dist/web/_next/static/chunks/0-v_p6j5u3_9l.js +0 -1
- package/dist/web/_next/static/chunks/0.-x29t-8gk0r.js +0 -1
- package/dist/web/_next/static/chunks/0.l5e8~r7_0~p.js +0 -1
- package/dist/web/_next/static/chunks/0.n~yfwf4~6w-.js +0 -1
- package/dist/web/_next/static/chunks/00-syqzi-6zxr.js +0 -1
- package/dist/web/_next/static/chunks/02j4sr9psucf-.js +0 -1
- package/dist/web/_next/static/chunks/06si8l0doqe8p.js +0 -1
- package/dist/web/_next/static/chunks/08kfx8on9oty~.js +0 -1
- package/dist/web/_next/static/chunks/08ugbvzr20drp.js +0 -2
- package/dist/web/_next/static/chunks/0_cqojbge48kq.js +0 -5
- package/dist/web/_next/static/chunks/0d6~~lv0-6kex.js +0 -3
- package/dist/web/_next/static/chunks/0gdwop9cnpmtu.js +0 -1
- package/dist/web/_next/static/chunks/0ghx3j_.-gdyd.js +0 -1
- package/dist/web/_next/static/chunks/0kbvoxla7f751.js +0 -1
- package/dist/web/_next/static/chunks/0paaat8y96ayc.js +0 -7
- package/dist/web/_next/static/chunks/0pq318f8xgafg.js +0 -1
- package/dist/web/_next/static/chunks/0t6s8of0qr6nc.js +0 -1
- package/dist/web/_next/static/chunks/0xt-8wk21gs7g.js +0 -1
- package/dist/web/_next/static/chunks/0yd.m1afqg.2t.js +0 -3
- package/dist/web/_next/static/chunks/0yhbr8hl09b-5.js +0 -1
- package/dist/web/_next/static/chunks/0z~vqzbm_q371.js +0 -1
- package/dist/web/_next/static/chunks/0~~_ltu6dx_ch.js +0 -1
- package/dist/web/_next/static/chunks/12oxcgyhpaxw~.js +0 -1
- package/dist/web/_next/static/chunks/1452eibz62gs6.css +0 -1
- package/dist/web/_next/static/chunks/16zlreiems5cn.js +0 -1
- package/dist/web/_next/static/chunks/18awqjk9-o5m0.js +0 -1
- /package/dist/web/_next/static/{x4-CsKe6qUQyFDWVtfvUg → rGXyAK8rgod1NjF3bLZAY}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{x4-CsKe6qUQyFDWVtfvUg → rGXyAK8rgod1NjF3bLZAY}/_clientMiddlewareManifest.js +0 -0
- /package/dist/web/_next/static/{x4-CsKe6qUQyFDWVtfvUg → rGXyAK8rgod1NjF3bLZAY}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,837121,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"warnOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},361031,e=>{"use strict";let t=(0,e.i(816709).create)(e=>({workspaces:[],createDialogOpen:!1,setCreateDialogOpen:t=>e({createDialogOpen:t}),setWorkspaces:t=>e({workspaces:t}),upsertWorkspace:t=>{e(e=>{let a=e.workspaces.findIndex(e=>e.id===t.id);if(-1===a)return{workspaces:[...e.workspaces,t]};let n=[...e.workspaces];return n[a]=t,{workspaces:n}})},removeWorkspace:t=>{e(e=>({workspaces:e.workspaces.filter(e=>e.id!==t)}))}}));e.s(["useWorkspaceStore",0,t])},327962,e=>{"use strict";let t=(0,e.i(433721).default)("git-branch",[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]);e.s(["GitBranch",0,t],327962)},613087,e=>{"use strict";var t=e.i(344180),a=e.i(465458);e.s(["Skeleton",0,function({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"skeleton",className:(0,a.cn)("animate-pulse rounded-md bg-muted",e),...n})},"SkeletonGroup",0,function({count:e=3,children:a}){return(0,t.jsx)(t.Fragment,{children:Array.from({length:e},(e,n)=>(0,t.jsx)("div",{children:a(n)},n))})}])},992764,e=>{"use strict";var t=e.i(942917);e.s(["ChevronRight",()=>t.default])},523592,e=>{"use strict";var t=e.i(8890);let a="agent-spaces-servers",n="agent-spaces-active-server",i="active-server";function r(){let e=t.default.env.NEXT_PUBLIC_SERVER_URL?.trim();if(e)return e.replace(/\/$/,"");let{hostname:a,port:n}=window.location;return("localhost"===a||"127.0.0.1"===a)&&"3000"===n?`http://${a}:3100`:window.location.origin}let s=[{id:"default",name:"Default",url:r()}];function o(){try{let e=localStorage.getItem(a);return e?JSON.parse(e).map(e=>"default"!==e.id||e.url?e:{...e,url:r()}):s}catch{return s}}function l(){return localStorage.getItem(n)||"default"}function c(){let e=o(),t=l();return e.find(e=>e.id===t)||e[0]||null}function d(){return c()?.url??null}e.s(["getActiveServer",0,c,"getActiveServerUrl",0,d,"loadActiveId",0,l,"loadServers",0,o,"resolveServerAssetUrl",0,function(e){if(!e)return"";if(/^(?:[a-z][a-z\d+\-.]*:)?\/\//i.test(e)||e.startsWith("data:")||e.startsWith("blob:"))return e;let t=d();return t?`${t.replace(/\/$/,"")}${e.startsWith("/")?"":"/"}${e}`:e},"saveActiveId",0,function(e){localStorage.setItem(n,e)},"saveServers",0,function(e){localStorage.setItem(a,JSON.stringify(e))},"setActiveServerCookie",0,function(e){e?document.cookie=`${i}=${encodeURIComponent(e)}; path=/; max-age=31536000; SameSite=Lax`:document.cookie=`${i}=; path=/; max-age=0`}])},515104,e=>{"use strict";function t(){return"__FLUTTER_INTERNALS__"in window}function a(){return t()&&"u">typeof navigator&&/android/i.test(navigator.userAgent)}async function n(){return t()?d():"Notification"in window?l(Notification.permission):"unsupported"}async function i(){return t()?u():o()}async function r(e,a,n={}){return t()?p(e,a,n):function(e,t){if(!("Notification"in window))throw Error("Notification API not available");if("granted"!==Notification.permission)throw Error(`Notification permission is "${Notification.permission}", not "granted"`);try{new Notification(e,{body:t,icon:"/favicon.ico"}).onerror=()=>{console.warn("[NativeNotification] browser notification error event")}}catch(e){throw Error(`Failed to create Notification: ${e instanceof Error?e.message:e}`)}}(e,a)}async function s(e){if(a())return r("Agent Spaces",e,{id:10001,ongoing:!0})}async function o(){return"Notification"in window?l(await Notification.requestPermission()):"unsupported"}function l(e){switch(e){case"granted":return"granted";case"denied":return"denied";default:return"default"}}function c(){return window.__flutterBridge??null}async function d(){try{let e=c();if(!e)return"unsupported";let t=await e.invoke("getNotificationPermission",null);return!0===t?"granted":"default"}catch{return"unsupported"}}async function u(){try{let e=c();if(!e)return"unsupported";let t=await e.invoke("requestNotificationPermission",null);return!0===t?"granted":"denied"}catch{return"unsupported"}}async function p(e,t,a){try{let n=c();if(!n)return;await n.invoke("sendNotification",{title:e,body:t,...a})}catch{}}e.s(["getNotificationPermission",0,n,"isFlutterEnvironment",0,t,"isNativeAndroidEnvironment",0,a,"isNativeEnvironment",0,function(){return t()},"requestNotificationPermission",0,i,"sendAndroidOngoingTaskNotification",0,s,"sendNativeNotification",0,r])},233297,e=>{"use strict";var t=e.i(515104);function a(e){let[t,a=""]=e.split("#",2),[n,i=""]=t.split("?",2);if(!n.startsWith("/")||n.startsWith("/api/"))return e;if("/"===n)return`/${i?`?${i}`:""}${a?`#${a}`:""}`;if(n.startsWith("/workspace/")){let e=n.slice(11).split("/")[0],t=new URLSearchParams(i);return t.set("workspaceId",e),`/workspace/_.html${t.toString()?`?${t.toString()}`:""}${a?`#${a}`:""}`}let r=n.endsWith(".html")?n:`${n}.html`;return`${r}${i?`?${i}`:""}${a?`#${a}`:""}`}e.s(["tauriNavigate",0,function(e,n,i=!1){let r=(0,t.isFlutterEnvironment)()&&"8080"===window.location.port;(0,t.isFlutterEnvironment)()&&!r?i?e.replace(n):e.push(n):(n=a(n),i?window.location.replace(n):window.location.href=n)},"toStaticHref",0,a])},437122,286117,e=>{"use strict";var t=e.i(523592),a=e.i(233297);function n(e){return"/index.html"===e?"/":e.endsWith(".html")?e.slice(0,-5):e}function i(e){return"/login"===n(e)}e.s(["isLoginPath",0,i,"isWorkspacePath",0,function(e){return n(e).startsWith("/workspace/")},"workspaceIdFromLocation",0,function(e,t){let a=new URLSearchParams(t).get("workspaceId");if(a)return a;let i=n(e).match(/^\/workspace\/([^/]+)/);return i?.[1]??null}],286117);let r="agent-spaces-token",s="agent-spaces-auth-verified";function o(){return`${r}:${(0,t.loadActiveId)()}`}function l(){let e=localStorage.getItem(o());if(null!==e)return e;let a=(0,t.getActiveServer)()?.secret;return void 0!==a?a:null}function c(){localStorage.removeItem(o()),localStorage.removeItem(s)}function d(){let e=l();return null===e?{}:{Authorization:`Bearer ${e}`}}async function u(e,n){let r=function(e){if("string"!=typeof e||e.startsWith("http"))return e;let a=(0,t.getActiveServerUrl)();return a?`${a}${e.startsWith("/")?"":"/"}${e}`:e}(e),s={...d(),...n?.headers},o=await fetch(r,{...n,headers:s});return(401===o.status||403===o.status)&&(c(),i(window.location.pathname)||window.location.replace((0,a.toStaticHref)("/login"))),o}e.s(["authHeaders",0,d,"fetchWithAuth",0,u,"getToken",0,l,"isAuthenticated",0,function(){return"1"===localStorage.getItem(s)},"removeToken",0,c,"setToken",0,function(e){localStorage.setItem(o(),e),localStorage.setItem(s,"1"),localStorage.removeItem(r)}],437122)},344118,e=>{"use strict";var t=e.i(50153);e.s(["Check",()=>t.default])},962562,995684,e=>{"use strict";let t=(0,e.i(433721).default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);e.s(["default",0,t],995684),e.s(["Pencil",0,t],962562)},790766,e=>{"use strict";e.s([])},257295,619279,415279,439485,e=>{"use strict";var t,a,n=e.i(764556),i=e.i(535270),r=e.i(277642),s=e.i(29905),o=e.i(139236),l=e.i(602453),c=e.i(742665),d=e.i(427708),u=e.i(254891);e.s(["useCollapsibleRoot",0,function(e){let{open:t,defaultOpen:a,onOpenChange:p,disabled:m}=e,h=void 0!==t,[f,g]=(0,i.useControlled)({controlled:t,default:a,name:"Collapsible",state:"open"}),{mounted:x,setMounted:v,transitionStatus:y}=(0,u.useTransitionStatus)(f,!0,!0),[j,b]=n.useState(f),[{height:w,width:S},N]=n.useState({height:void 0,width:void 0}),k=(0,o.useBaseUiId)(),[C,T]=n.useState(),P=C??k,[R,D]=n.useState(!1),[M,E]=n.useState(!1),O=n.useRef(null),z=n.useRef(null),F=n.useRef(null),I=n.useRef(null),A=(0,d.useAnimationsFinished)(I,!1),L=(0,s.useStableCallback)(e=>{let t=!f,a=(0,l.createChangeEventDetails)(c.REASONS.triggerPress,e.nativeEvent);if(p(t,a),a.isCanceled)return;let n=I.current;"css-animation"===z.current&&null!=n&&n.style.removeProperty("animation-name"),R||M||(null!=z.current&&"css-animation"!==z.current&&!x&&t&&v(!0),"css-animation"===z.current&&(!j&&t&&b(!0),!x&&t&&v(!0))),g(t),"none"===z.current&&x&&!t&&v(!1)});return(0,r.useIsoLayoutEffect)(()=>{h&&"none"===z.current&&!f&&v(!1)},[h,f,t,v]),n.useMemo(()=>({abortControllerRef:O,animationTypeRef:z,disabled:m,handleTrigger:L,height:w,mounted:x,open:f,panelId:P,panelRef:I,runOnceAnimationsFinish:A,setDimensions:N,setHiddenUntilFound:D,setKeepMounted:E,setMounted:v,setOpen:g,setPanelIdState:T,setVisible:b,transitionDimensionRef:F,transitionStatus:y,visible:j,width:S}),[O,z,m,L,w,x,f,P,I,A,N,D,E,v,g,b,F,y,j,S])}],257295),e.i(8890);var p=e.i(267805);let m=n.createContext(void 0);e.s(["CollapsibleRootContext",0,m,"useCollapsibleRootContext",0,function(){let e=n.useContext(m);if(void 0===e)throw Error((0,p.default)(15));return e}],619279);var h=e.i(282458);let f=((t={}).open="data-open",t.closed="data-closed",t[t.startingStyle=h.TransitionStatusDataAttributes.startingStyle]="startingStyle",t[t.endingStyle=h.TransitionStatusDataAttributes.endingStyle]="endingStyle",t);e.s(["CollapsiblePanelDataAttributes",0,f],415279);let g=((a={}).panelOpen="data-panel-open",a),x={[f.open]:""},v={[f.closed]:""};e.s(["collapsibleOpenStateMapping",0,{open:e=>e?x:v},"triggerOpenStateMapping",0,{open:e=>e?{[g.panelOpen]:""}:null}],439485)},998723,406899,134319,e=>{"use strict";e.i(8890);var t=e.i(764556),a=e.i(29905),n=e.i(969490),i=e.i(257295),r=e.i(619279),s=e.i(439485),o=e.i(282458);let l={...s.collapsibleOpenStateMapping,...o.transitionStatusMapping};e.s(["collapsibleStateAttributesMapping",0,l],406899);var c=e.i(344180);let d=t.forwardRef(function(e,s){let{render:o,className:d,defaultOpen:u=!1,disabled:p=!1,onOpenChange:m,open:h,style:f,...g}=e,x=(0,a.useStableCallback)(m),v=(0,i.useCollapsibleRoot)({open:h,defaultOpen:u,onOpenChange:x,disabled:p}),y=t.useMemo(()=>({open:v.open,disabled:v.disabled,transitionStatus:v.transitionStatus}),[v.open,v.disabled,v.transitionStatus]),j=t.useMemo(()=>({...v,onOpenChange:x,state:y}),[v,x,y]),b=(0,n.useRenderElement)("div",e,{state:y,ref:s,props:g,stateAttributesMapping:l});return(0,c.jsx)(r.CollapsibleRootContext.Provider,{value:j,children:b})});e.s(["CollapsibleRoot",0,d],998723);var u=e.i(931709);let p={...s.triggerOpenStateMapping,...o.transitionStatusMapping},m=t.forwardRef(function(e,a){let{panelId:i,open:s,handleTrigger:o,state:l,disabled:c}=(0,r.useCollapsibleRootContext)(),{className:d,disabled:m=c,id:h,render:f,nativeButton:g=!0,style:x,...v}=e,{getButtonProps:y,buttonRef:j}=(0,u.useButton)({disabled:m,focusableWhenDisabled:!0,native:g}),b=t.useMemo(()=>({"aria-controls":s?i:void 0,"aria-expanded":s,onClick:o}),[i,s,o]);return(0,n.useRenderElement)("button",e,{state:l,ref:[a,j],props:[b,v,y],stateAttributesMapping:p})});e.s(["CollapsibleTrigger",0,m],134319)},18158,e=>{"use strict";e.i(8890);var t,a=e.i(764556),n=e.i(422561),i=e.i(277642),r=e.i(29905),s=e.i(204133),o=e.i(130522),l=e.i(859092),c=e.i(602453),d=e.i(742665),u=e.i(415279);let p=((t={}).disabled="data-disabled",t.orientation="data-orientation",t);e.s(["useCollapsiblePanel",0,function(e){let{abortControllerRef:t,animationTypeRef:m,externalRef:h,height:f,hiddenUntilFound:g,keepMounted:x,id:v,mounted:y,onOpenChange:j,open:b,panelRef:w,runOnceAnimationsFinish:S,setDimensions:N,setMounted:k,setOpen:C,setVisible:T,transitionDimensionRef:P,visible:R,width:D}=e,M=a.useRef(!1),E=a.useRef(null),O=a.useRef(b),z=a.useRef(b),F=(0,l.useAnimationFrame)(),I=a.useMemo(()=>"css-animation"===m.current?!R:!b&&!y,[b,y,R,m]),A=(0,r.useStableCallback)(e=>{if(!e)return;if(null==m.current||null==P.current){let t=getComputedStyle(e),a="none"!==t.animationName&&""!==t.animationName,n="0s"!==t.transitionDuration&&""!==t.transitionDuration;a&&n||("none"===t.animationName&&"0s"!==t.transitionDuration?m.current="css-transition":"none"!==t.animationName&&"0s"===t.transitionDuration?m.current="css-animation":m.current="none"),"horizontal"===e.getAttribute(p.orientation)||t.transitionProperty.indexOf("width")>-1?P.current="width":P.current="height"}if("css-transition"!==m.current)return;(void 0===f||void 0===D)&&(N({height:e.scrollHeight,width:e.scrollWidth}),z.current&&e.style.setProperty("transition-duration","0s"));let t=-1,a=-1;return t=l.AnimationFrame.request(()=>{z.current=!1,a=l.AnimationFrame.request(()=>{setTimeout(()=>{e.style.removeProperty("transition-duration")})})}),()=>{l.AnimationFrame.cancel(t),l.AnimationFrame.cancel(a)}}),L=(0,s.useMergedRefs)(h,w,A);return(0,i.useIsoLayoutEffect)(()=>{if("css-transition"!==m.current)return;let e=w.current;if(!e)return;let a=-1;if(null!=t.current&&(t.current.abort(),t.current=null),b){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,"initial","important")}),z.current||x||e.setAttribute(u.CollapsiblePanelDataAttributes.startingStyle,""),N({height:e.scrollHeight,width:e.scrollWidth}),a=l.AnimationFrame.request(()=>{Object.entries(t).forEach(([t,a])=>{""===a?e.style.removeProperty(t):e.style.setProperty(t,a)})})}else{if(0===e.scrollHeight&&0===e.scrollWidth)return;N({height:e.scrollHeight,width:e.scrollWidth});let a=new AbortController;t.current=a;let n=a.signal,i=null,r=u.CollapsiblePanelDataAttributes.endingStyle;return(i=new MutationObserver(s=>{s.some(e=>"attributes"===e.type&&e.attributeName===r)&&(i?.disconnect(),i=null,S(()=>{N({height:0,width:0}),e.style.removeProperty("content-visibility"),k(!1),t.current===a&&(t.current=null)},n))})).observe(e,{attributes:!0,attributeFilter:[r]}),()=>{i?.disconnect(),F.cancel(),t.current===a&&(a.abort(),t.current=null)}}return()=>{l.AnimationFrame.cancel(a)}},[t,m,F,g,x,y,b,w,S,N,k]),(0,i.useIsoLayoutEffect)(()=>{if("css-animation"!==m.current)return;let e=w.current;e&&(E.current=e.style.animationName||E.current,e.style.setProperty("animation-name","none"),N({height:e.scrollHeight,width:e.scrollWidth}),O.current||M.current||e.style.removeProperty("animation-name"),b?(null!=t.current&&(t.current.abort(),t.current=null),k(!0),T(!0)):(t.current=new AbortController,S(()=>{k(!1),T(!1),t.current=null},t.current.signal)))},[t,m,b,w,S,N,k,T,R]),(0,o.useOnMount)(()=>{let e=l.AnimationFrame.request(()=>{O.current=!1});return()=>l.AnimationFrame.cancel(e)}),(0,i.useIsoLayoutEffect)(()=>{if(!g)return;let e=w.current;if(!e)return;let t=-1,a=-1;return b&&M.current&&(e.style.transitionDuration="0s",N({height:e.scrollHeight,width:e.scrollWidth}),t=l.AnimationFrame.request(()=>{M.current=!1,a=l.AnimationFrame.request(()=>{setTimeout(()=>{e.style.removeProperty("transition-duration")})})})),()=>{l.AnimationFrame.cancel(t),l.AnimationFrame.cancel(a)}},[g,b,w,N]),(0,i.useIsoLayoutEffect)(()=>{let e=w.current;e&&g&&I&&(e.setAttribute("hidden","until-found"),"css-transition"===m.current&&e.setAttribute(u.CollapsiblePanelDataAttributes.startingStyle,""))},[g,I,m,w]),a.useEffect(function(){let e=w.current;if(e)return(0,n.addEventListener)(e,"beforematch",function(e){M.current=!0,C(!0),j(!0,(0,c.createChangeEventDetails)(d.REASONS.none,e))})},[j,w,C]),a.useMemo(()=>({props:{hidden:I,id:v,ref:L}}),[I,v,L])}],18158)},256186,e=>{"use strict";var t,a=e.i(344180);e.i(790766);var n=e.i(998723),i=e.i(134319);e.i(8890);var r=e.i(764556),s=e.i(277642),o=e.i(969490),l=e.i(619279),c=e.i(406899),d=e.i(18158);let u=((t={}).collapsiblePanelHeight="--collapsible-panel-height",t.collapsiblePanelWidth="--collapsible-panel-width",t);var p=e.i(273598);let m=r.forwardRef(function(e,t){let{className:a,hiddenUntilFound:n,keepMounted:i,render:m,id:h,style:f,...g}=e,{abortControllerRef:x,animationTypeRef:v,height:y,mounted:j,onOpenChange:b,open:w,panelId:S,panelRef:N,runOnceAnimationsFinish:k,setDimensions:C,setHiddenUntilFound:T,setKeepMounted:P,setMounted:R,setPanelIdState:D,setOpen:M,setVisible:E,state:O,transitionDimensionRef:z,visible:F,width:I,transitionStatus:A}=(0,l.useCollapsibleRootContext)(),L=n??!1,B=i??!1;(0,s.useIsoLayoutEffect)(()=>{if(h)return D(h),()=>{D(void 0)}},[h,D]),(0,s.useIsoLayoutEffect)(()=>{T(L)},[T,L]),(0,s.useIsoLayoutEffect)(()=>{P(B)},[P,B]);let{props:$}=(0,d.useCollapsiblePanel)({abortControllerRef:x,animationTypeRef:v,externalRef:t,height:y,hiddenUntilFound:L,id:S,keepMounted:B,mounted:j,onOpenChange:b,open:w,panelRef:N,runOnceAnimationsFinish:k,setDimensions:C,setMounted:R,setOpen:M,setVisible:E,transitionDimensionRef:z,visible:F,width:I});(0,p.useOpenChangeComplete)({open:w&&"idle"===A,ref:N,onComplete(){w&&C({height:void 0,width:void 0})}});let W=r.useMemo(()=>({...O,transitionStatus:A}),[O,A]),H=(0,o.useRenderElement)("div",e,{state:W,ref:[t,N],props:[$,{style:{[u.collapsiblePanelHeight]:void 0===y?"auto":`${y}px`,[u.collapsiblePanelWidth]:void 0===I?"auto":`${I}px`}},g],stateAttributesMapping:c.collapsibleStateAttributesMapping});return B||L||j?H:null});e.s(["Panel",0,m,"Root",()=>n.CollapsibleRoot,"Trigger",()=>i.CollapsibleTrigger],917853);var h=e.i(917853),h=h;e.s(["Collapsible",0,function({...e}){return(0,a.jsx)(h.Root,{"data-slot":"collapsible",...e})},"CollapsibleContent",0,function({...e}){return(0,a.jsx)(h.Panel,{"data-slot":"collapsible-content",...e})},"CollapsibleTrigger",0,function({...e}){return(0,a.jsx)(h.Trigger,{"data-slot":"collapsible-trigger",...e})}],256186)},210,e=>{"use strict";let t=(0,e.i(433721).default)("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);e.s(["Settings2",0,t],210)},226651,e=>{"use strict";let t=(0,e.i(433721).default)("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);e.s(["default",0,t])},315775,e=>{"use strict";var t=e.i(226651);e.s(["MoreHorizontal",()=>t.default])},226624,e=>{"use strict";var t,a=e.i(344180);e.s([],916562),e.i(916562),e.i(8890);var n=e.i(764556),i=e.i(535270),r=e.i(29905),s=e.i(204133),o=e.i(277642),l=e.i(236706),c=e.i(863728),d=e.i(969490),u=e.i(370383),p=e.i(139236),m=e.i(931709),h=e.i(267805);let f=n.createContext(void 0);var g=e.i(438904);let x=((t={}).checked="data-checked",t.unchecked="data-unchecked",t.disabled="data-disabled",t.readonly="data-readonly",t.required="data-required",t.valid="data-valid",t.invalid="data-invalid",t.touched="data-touched",t.dirty="data-dirty",t.filled="data-filled",t.focused="data-focused",t),v={...g.fieldValidityMapping,checked:e=>e?{[x.checked]:""}:{[x.unchecked]:""}};var y=e.i(125231),j=e.i(975698),b=e.i(380414),w=e.i(443124),S=e.i(575665),N=e.i(602453),k=e.i(742665),C=e.i(638144);let T=n.forwardRef(function(e,t){let{checked:h,className:g,defaultChecked:x,"aria-labelledby":T,form:P,id:R,inputRef:D,name:M,nativeButton:E=!1,onCheckedChange:O,readOnly:z=!1,required:F=!1,disabled:I=!1,render:A,uncheckedValue:L,value:B,style:$,...W}=e,{clearErrors:H}=(0,b.useFormContext)(),{state:U,setTouched:V,setDirty:_,validityData:q,setFilled:J,setFocused:K,shouldValidateOnChange:G,validationMode:X,disabled:Y,name:Q,validation:Z}=(0,y.useFieldRootContext)(),{labelId:ee}=(0,w.useLabelableContext)(),et=Y||I,ea=Q??M,en=(0,r.useStableCallback)(O),ei=n.useRef(null),er=(0,s.useMergedRefs)(ei,D,Z.inputRef),es=n.useRef(null),eo=(0,p.useBaseUiId)(),el=(0,S.useLabelableId)({id:R,implicit:!1,controlRef:es}),ec=E?void 0:el,[ed,eu]=(0,i.useControlled)({controlled:h,default:!!x,name:"Switch",state:"checked"});(0,j.useRegisterFieldControl)(es,{id:eo,value:ed}),(0,o.useIsoLayoutEffect)(()=>{ei.current&&J(ei.current.checked)},[ei,J]),(0,C.useValueChanged)(ed,()=>{H(ea),_(ed!==q.initialValue),J(ed),G()?Z.commit(ed):Z.commit(ed,!0)});let{getButtonProps:ep,buttonRef:em}=(0,m.useButton)({disabled:et,native:E}),eh=function(e,t,a,i=!0,r){let[s,l]=n.useState(),c=(0,p.useBaseUiId)(r?`${r}-label`:void 0),d=e??t??s;return(0,o.useIsoLayoutEffect)(()=>{let n=e||t||!i?void 0:function(e,t){let a=function(e){if(!e)return;let t=e.parentElement;if(t&&"LABEL"===t.tagName)return t;let a=e.id;if(a){let t=e.nextElementSibling;if(t&&t.htmlFor===a)return t}let n=e.labels;return n&&n[0]}(e);if(a)return!a.id&&t&&(a.id=t),a.id||void 0}(a.current,c);s!==n&&l(n)}),d}(T,ee,ei,!E,ec),ef=n.useMemo(()=>(0,u.mergeProps)({checked:ed,disabled:et,form:P,id:ec,name:ea,required:F,style:ea?l.visuallyHiddenInput:l.visuallyHidden,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:er,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(z)return void e.preventDefault();let t=e.currentTarget.checked,a=(0,N.createChangeEventDetails)(k.REASONS.none,e.nativeEvent);en?.(t,a),a.isCanceled||eu(t)},onFocus(){es.current?.focus()}},Z.getInputValidationProps,void 0!==B?{value:B}:c.EMPTY_OBJECT),[ed,et,P,er,ec,ea,en,z,F,eu,Z,B]),eg=n.useMemo(()=>({...U,checked:ed,disabled:et,readOnly:z,required:F}),[U,ed,et,z,F]),ex=(0,d.useRenderElement)("span",e,{state:eg,ref:[t,es,em],props:[{id:E?el:eo,role:"switch","aria-checked":ed,"aria-readonly":z||void 0,"aria-required":F||void 0,"aria-labelledby":eh,onFocus(){et||K(!0)},onBlur(){let e=ei.current;e&&!et&&(V(!0),K(!1),"onBlur"===X&&Z.commit(e.checked))},onClick(e){z||et||(e.preventDefault(),ei.current?.dispatchEvent(new PointerEvent("click",{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},Z.getValidationProps,W,ep],stateAttributesMapping:v});return(0,a.jsxs)(f.Provider,{value:eg,children:[ex,!ed&&ea&&void 0!==L&&(0,a.jsx)("input",{type:"hidden",form:P,name:ea,value:L}),(0,a.jsx)("input",{...ef,suppressHydrationWarning:!0})]})}),P=n.forwardRef(function(e,t){let{render:a,className:i,style:r,...s}=e,{state:o}=(0,y.useFieldRootContext)(),l=function(){let e=n.useContext(f);if(void 0===e)throw Error((0,h.default)(63));return e}(),c={...o,...l};return(0,d.useRenderElement)("span",e,{state:c,ref:t,stateAttributesMapping:v,props:s})});e.s(["Root",0,T,"Thumb",0,P],695728);var R=e.i(695728),R=R,D=e.i(465458);e.s(["Switch",0,function({className:e,size:t="default",...n}){return(0,a.jsx)(R.Root,{"data-slot":"switch","data-size":t,className:(0,D.cn)("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...n,children:(0,a.jsx)(R.Thumb,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}],226624)},601039,e=>{"use strict";let t=(0,e.i(433721).default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);e.s(["RefreshCw",0,t],601039)},357301,e=>{"use strict";let t=(0,e.i(433721).default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);e.s(["RotateCcw",0,t],357301)},588591,e=>{"use strict";var t=e.i(344180),a=e.i(764556),n=e.i(244073),i=e.i(355819),r=e.i(209988),s=e.i(260218),o=e.i(917955),l=e.i(465458),c=e.i(767467),d=e.i(325443),u=e.i(650654),p=e.i(953700),m=e.i(601039),h=e.i(357301),f=e.i(511588),g=e.i(282180),x=e.i(611176),v=e.i(562918),y=e.i(226624),j=e.i(159619),b=e.i(137340);function w({agents:e,onSelect:a,onDelete:i,onToggleEnabled:r}){let o=(0,n.useTranslations)("agent");return(0,t.jsxs)("div",{className:"flex flex-col p-2",children:[e.map(e=>{let n="agent-generator"===e.id;return(0,t.jsxs)("div",{className:(0,l.cn)("group flex items-center gap-3 rounded-lg px-3 py-2.5 hover:bg-muted/50 cursor-pointer transition-colors",!e.enabled&&!n&&"opacity-50"),onClick:()=>a(e),children:[(0,t.jsx)(x.AgentIcon,{name:e.name,avatarUrl:e.avatarUrl,apiBase:e.apiBase,className:"size-8"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:e.name}),(0,t.jsx)(v.Badge,{variant:"outline",className:"text-[10px] h-4 px-1.5",children:n?"system":e.role}),(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground font-mono",children:e.modelId.split("-").slice(0,2).join("-")})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:e.description||o("list.noDescription")})]}),(0,t.jsx)(s.Button,{variant:"ghost",size:"icon-xs",className:"opacity-0 group-hover:opacity-100 transition-opacity",onClick:t=>{t.stopPropagation(),navigator.clipboard.writeText(e.id)},children:(0,t.jsx)(j.Copy,{className:"size-3"})}),!n&&(0,t.jsx)(s.Button,{variant:"ghost",size:"icon-xs",className:"opacity-0 group-hover:opacity-100 transition-opacity",onClick:t=>{t.stopPropagation(),i(e.id)},children:(0,t.jsx)(b.Trash2,{className:"size-3 text-destructive"})}),(0,t.jsx)("div",{onClick:e=>e.stopPropagation(),children:(0,t.jsx)(y.Switch,{size:"sm",checked:n||e.enabled,disabled:n,onCheckedChange:()=>r?.(e.id)})})]},e.id)}),0===e.length&&(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[(0,t.jsx)(d.Bot,{className:"size-10 mb-2 opacity-30"}),(0,t.jsx)("p",{className:"text-sm",children:o("list.empty")})]})]})}var S=e.i(965322);let N=new Set(["agent-generator","commit-agent"]);e.s(["AgentDialog",0,function({open:e,onOpenChange:x,roleFilter:v,initialAgentId:y,standalone:j,presetBasePath:b="/api/agents/presets",singleAgent:k=!1}){let C=(0,n.useTranslations)("agent"),T=(0,n.useTranslations)("common"),P=(0,a.useRef)(null),[R,D]=(0,a.useState)([]),[M,E]=(0,a.useState)(null),[O,z]=(0,a.useState)(!1),[F,I]=(0,a.useState)(!1),[A,L]=(0,a.useState)(!1),[B,$]=(0,a.useState)(!1),[W,H]=(0,a.useState)(null),U=v?new Set(Array.isArray(v)?v:[v]):null,V=U?R.filter(e=>N.has(e.id)||U.has(e.role)):R,_=U?g.ROLE_OPTIONS.filter(e=>U.has(e)):g.ROLE_OPTIONS;(0,a.useEffect)(()=>{if(!e)return;let t=new AbortController;return queueMicrotask(()=>{I(!0),H(null)}),fetch(b,{signal:t.signal}).then(async e=>{if(!e.ok)throw Error(await e.text());return e.json()}).then(e=>{let t=e.map(g.normalizeAgent);if(D(t),y){let e=t.find(e=>e.id===y);e&&E(e)}else k&&t[0]&&E(t[0])}).catch(e=>{"AbortError"!==e.name&&H(C("error.loadFailed"))}).finally(()=>I(!1)),()=>t.abort()},[e,y,b,k,C]);let q=()=>{E(null),z(!1)},J=e=>{let t="empty"===e?(0,g.newEmptyAgent)():(0,g.newAgentDraft)(e);H(null),E(t)},K=async e=>{N.has(e)||(D(t=>t.map(t=>t.id===e?{...t,enabled:!t.enabled}:t)),await i.useAgentStore.getState().toggleEnabled(e))},G=async e=>{if(!N.has(e)){if(e.startsWith("draft-"))return void E(null);L(!0),H(null);try{let t=await fetch(`${b}/${e}`,{method:"DELETE"});if(!t.ok)throw Error(await t.text());D(t=>t.filter(t=>t.id!==e)),i.useAgentStore.setState(t=>({agents:t.agents.filter(t=>t.id!==e)})),M?.id===e&&E(null)}catch{H(C("error.deleteFailed"))}finally{L(!1)}}},X=async()=>{$(!0),H(null);try{let e=await fetch(`${b}/sync-workspaces`,{method:"POST"});if(!e.ok)throw Error(await e.text())}catch{H(C("error.syncFailed"))}finally{$(!1)}},Y=e=>(0,t.jsxs)(o.DropdownMenu,{children:[(0,t.jsx)(o.DropdownMenuTrigger,{render:(0,t.jsxs)(s.Button,{variant:"outline",size:"sm",disabled:A,children:[(0,t.jsx)(p.Plus,{className:"size-3.5"}),!e&&C("dialog.add"),(0,t.jsx)(u.ChevronDown,{className:"size-3.5"})]})}),(0,t.jsx)(o.DropdownMenuContent,{side:"bottom",align:"end",className:"w-44",children:(0,t.jsxs)(o.DropdownMenuGroup,{children:[!U&&(0,t.jsxs)(o.DropdownMenuItem,{className:"gap-2",onClick:()=>J("empty"),children:[(0,t.jsx)("span",{className:"size-2 rounded-full bg-muted"}),(0,t.jsx)("span",{children:C("dialog.addEmpty")})]}),g.ROLE_OPTIONS.map(e=>(0,t.jsxs)(o.DropdownMenuItem,{className:"gap-2",onClick:()=>J(e),children:[(0,t.jsx)("span",{className:(0,l.cn)("size-2 rounded-full",g.ROLE_COLORS[e].split(" ")[0])}),(0,t.jsx)("span",{className:"capitalize",children:C(`role.${e}.name`)})]},e))]})})]}),Q=(0,t.jsxs)(t.Fragment,{children:[!j&&(0,t.jsxs)("div",{className:"flex items-center gap-3 border-b px-5 pr-12 py-4",children:[M?(0,t.jsx)(s.Button,{variant:"ghost",size:"icon-sm",onClick:k?()=>x(!1):q,children:(0,t.jsx)(c.ArrowLeft,{className:"size-4"})}):(0,t.jsx)("div",{className:"flex size-7 items-center justify-center rounded-lg bg-primary/10",children:(0,t.jsx)(d.Bot,{className:"size-4 text-primary"})}),(0,t.jsxs)(r.DialogHeader,{className:"flex-1 space-y-0",children:[(0,t.jsx)(r.DialogTitle,{className:"text-base",children:M?M.name:C("dialog.title")}),(0,t.jsx)(r.DialogDescription,{className:"text-xs",children:M?C("dialog.editDescription"):C("dialog.listDescription")})]}),M&&N.has(M.id)&&(0,t.jsxs)(s.Button,{variant:"outline",size:"sm",disabled:A,onClick:()=>P.current?.reset(),children:[(0,t.jsx)(h.RotateCcw,{className:"size-3.5"}),T("reset")]}),M&&(0,t.jsxs)(s.Button,{variant:"outline",size:"sm",onClick:()=>P.current?.openGenerate(),children:[(0,t.jsx)(f.WandSparkles,{className:"size-3.5"}),"智能创建"]}),!M&&!k&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)(s.Button,{variant:"outline",size:"sm",onClick:X,disabled:B,children:[(0,t.jsx)(m.RefreshCw,{className:(0,l.cn)("size-3.5",B&&"animate-spin")}),C("dialog.syncTemplates")]}),(0,t.jsxs)(s.Button,{variant:"outline",size:"sm",onClick:()=>{let e=_[0]?(0,g.newAgentDraft)(_[0]):(0,g.newEmptyAgent)();H(null),E(e),z(!0)},children:[(0,t.jsx)(f.WandSparkles,{className:"size-3.5"}),"智能创建"]}),Y()]})]}),j&&!M&&!k&&(0,t.jsxs)("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-b",children:[(0,t.jsxs)(s.Button,{variant:"outline",size:"sm",onClick:X,disabled:B,children:[(0,t.jsx)(m.RefreshCw,{className:(0,l.cn)("size-3.5",B&&"animate-spin")}),C("dialog.syncTemplates")]}),(0,t.jsxs)(s.Button,{variant:"outline",size:"sm",onClick:()=>{let e=_[0]?(0,g.newAgentDraft)(_[0]):(0,g.newEmptyAgent)();H(null),E(e),z(!0)},children:[(0,t.jsx)(f.WandSparkles,{className:"size-3.5"}),"智能创建"]}),Y()]}),j&&M&&(0,t.jsxs)("div",{className:"flex items-center gap-3 px-5 py-3 border-b",children:[(0,t.jsx)(s.Button,{variant:"ghost",size:"icon-sm",onClick:k?()=>x(!1):q,children:(0,t.jsx)(c.ArrowLeft,{className:"size-4"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("h2",{className:"text-base font-medium truncate",children:M.name}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:C("dialog.editDescription")})]}),N.has(M.id)&&(0,t.jsxs)(s.Button,{variant:"outline",size:"sm",disabled:A,onClick:()=>P.current?.reset(),children:[(0,t.jsx)(h.RotateCcw,{className:"size-3.5"}),T("reset")]}),(0,t.jsxs)(s.Button,{variant:"outline",size:"sm",onClick:()=>P.current?.openGenerate(),children:[(0,t.jsx)(f.WandSparkles,{className:"size-3.5"}),"智能创建"]})]}),W&&!M&&(0,t.jsx)("div",{className:"mx-5 mt-4 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:W}),F?(0,t.jsx)("div",{className:"flex-1 flex flex-col p-2 space-y-1",children:Array.from({length:5},(e,a)=>(0,t.jsxs)("div",{className:"flex items-center gap-3 rounded-lg px-3 py-2.5",children:[(0,t.jsx)("div",{className:"size-8 rounded-full bg-muted animate-pulse"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 space-y-1.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"h-4 w-20 rounded bg-muted animate-pulse"}),(0,t.jsx)("div",{className:"h-4 w-10 rounded-full bg-muted animate-pulse"})]}),(0,t.jsx)("div",{className:"h-3 w-32 rounded bg-muted animate-pulse"})]}),(0,t.jsx)("div",{className:"h-3 w-12 rounded bg-muted animate-pulse"})]},a))}):M?(0,t.jsx)(S.AgentEditor,{ref:P,agent:M,roleOptions:_,onSaved:e=>{(D(t=>t.some(t=>t.id===e.id)?t.map(t=>t.id===e.id?e:t):[...t,e]),k)?x(!1):(E(null),z(!1))},onBack:k?()=>x(!1):q,showFooter:!0,autoOpenGenerate:O,presetBasePath:b}):(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,t.jsx)(w,{agents:V,onSelect:e=>{E(e)},onDelete:G,onToggleEnabled:K})})]});return j?(0,t.jsx)("div",{className:"h-full flex flex-col",children:Q}):(0,t.jsx)(r.Dialog,{open:e,onOpenChange:e=>{e||k||q(),x(e)},children:(0,t.jsx)(r.DialogContent,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 gap-0",children:Q})})}],588591)},381253,e=>{"use strict";let t=(0,e.i(433721).default)("file-code",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]);e.s(["FileCode",0,t],381253)},346038,e=>{"use strict";let t=(0,e.i(433721).default)("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);e.s(["Keyboard",0,t],346038)},905724,e=>{"use strict";let t=(0,e.i(433721).default)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);e.s(["default",0,t])},989484,e=>{"use strict";var t=e.i(905724);e.s(["FileText",()=>t.default])},974267,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"BailoutToCSR",{enumerable:!0,get:function(){return i}});let n=e.r(981225);function i({reason:e,children:t}){if("u"<typeof window)throw Object.defineProperty(new n.BailoutToCSRError(e),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return t}},404590,(e,t,a)=>{"use strict";function n(e){return e.split("/").map(e=>encodeURIComponent(e)).join("/")}Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"encodeURIPath",{enumerable:!0,get:function(){return n}})},172441,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"PreloadChunks",{enumerable:!0,get:function(){return l}});let n=e.r(344180),i=e.r(106206),r=e.r(94932),s=e.r(404590),o=e.r(745137);function l({moduleIds:e}){if("u">typeof window)return null;let t=r.workAsyncStorage.getStore();if(void 0===t)return null;let a=[];if(t.reactLoadableManifest&&e){let n=t.reactLoadableManifest;for(let t of e){if(!n[t])continue;let e=n[t].files;a.push(...e)}}if(0===a.length)return null;let c=(0,o.getAssetTokenQuery)();return(0,n.jsx)(n.Fragment,{children:a.map(e=>{let a=`${t.assetPrefix}/_next/${(0,s.encodeURIPath)(e)}${c}`;return e.endsWith(".css")?(0,n.jsx)("link",{precedence:"dynamic",href:a,rel:"stylesheet",as:"style",nonce:t.nonce},e):((0,i.preload)(a,{as:"script",fetchPriority:"low",nonce:t.nonce}),null)})})}},672479,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"default",{enumerable:!0,get:function(){return c}});let n=e.r(344180),i=e.r(764556),r=e.r(974267),s=e.r(172441);function o(e){return{default:e&&"default"in e?e.default:e}}let l={loader:()=>Promise.resolve(o(()=>null)),loading:null,ssr:!0},c=function(e){let t={...l,...e},a=(0,i.lazy)(()=>t.loader().then(o)),c=t.loading;function d(e){let o=c?(0,n.jsx)(c,{isLoading:!0,pastDelay:!0,error:null}):null,l=!t.ssr||!!t.loading,d=l?i.Suspense:i.Fragment,u=t.ssr?(0,n.jsxs)(n.Fragment,{children:["u"<typeof window?(0,n.jsx)(s.PreloadChunks,{moduleIds:t.modules}):null,(0,n.jsx)(a,{...e})]}):(0,n.jsx)(r.BailoutToCSR,{reason:"next/dynamic",children:(0,n.jsx)(a,{...e})});return(0,n.jsx)(d,{...l?{fallback:o}:{},children:u})}return d.displayName="LoadableComponent",d}},887836,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"default",{enumerable:!0,get:function(){return i}});let n=e.r(481258)._(e.r(672479));function i(e,t){let a={};"function"==typeof e&&(a.loader=e);let i={...a,...t};return(0,n.default)({...i,modules:i.loadableGenerated?.modules})}("function"==typeof a.default||"object"==typeof a.default&&null!==a.default)&&void 0===a.default.__esModule&&(Object.defineProperty(a.default,"__esModule",{value:!0}),Object.assign(a.default,a),t.exports=a.default)},916950,e=>{"use strict";let t="agent-spaces:store-api-base";function a(){return localStorage.getItem(t)||"https://gh-proxy.org/https://github.com/hunmer/agent-spaces/raw/refs/heads/main/packages/agents/"}async function n(e){let t=a(),n=t?`${t.replace(/\/+$/,"")}/${e.replace(/^\/+/,"")}`:`/agents-store/${e}`,i=await fetch(n);if(!i.ok)throw Error(`fetch ${n} failed: ${i.status}`);return i.json()}e.s(["fetchStoreIndex",0,n,"getStoreApiBase",0,a,"setStoreApiBase",0,function(e){e?localStorage.setItem(t,e):localStorage.removeItem(t)}])},513501,e=>{"use strict";let t=(0,e.i(433721).default)("store",[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5",key:"slp6dd"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244",key:"o0xfot"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05",key:"wn3emo"}]]);e.s(["Store",0,t],513501)},734649,e=>{"use strict";var t=e.i(344180),a=e.i(764556);e.s([],764940),e.i(764940);var n=e.i(956834),i=e.i(625386),r=e.i(530089),s=e.i(975983),o=e.i(16223),l=e.i(583901),c=e.i(512519),d=e.i(152851),u=e.i(481181),p=e.i(476343),m=e.i(272248),h=e.i(625144),f=e.i(225171);e.s(["Backdrop",()=>o.DialogBackdrop,"Close",()=>l.DialogClose,"Description",()=>c.DialogDescription,"Handle",()=>f.DialogHandle,"Popup",()=>d.DialogPopup,"Portal",()=>u.DialogPortal,"Root",0,function(e){let{children:o,open:l,defaultOpen:c=!1,onOpenChange:d,onOpenChangeComplete:u,actionsRef:p,handle:m,triggerId:h,defaultTriggerId:f=null}=e,g=(0,r.useDialogRootContext)(!0),x=!!g,v=s.DialogStore.useStore(m?.store,{open:c,openProp:l,activeTriggerId:f,triggerIdProp:h,modal:!0,disablePointerDismissal:!0,nested:x,role:"alertdialog"});v.useControlledProp("openProp",l),v.useControlledProp("triggerIdProp",h),v.useSyncedValue("nested",x),v.useContextCallback("onOpenChange",d),v.useContextCallback("onOpenChangeComplete",u);let y=v.useState("payload");(0,i.useDialogRoot)({store:v,actionsRef:p,parentContext:g?.store.context,isDrawer:!1,onOpenChange:d,triggerIdProp:h});let j=a.useMemo(()=>({store:v}),[v]);return(0,t.jsx)(n.IsDrawerContext.Provider,{value:!1,children:(0,t.jsx)(r.DialogRootContext.Provider,{value:j,children:"function"==typeof o?o({payload:y}):o})})},"Title",()=>p.DialogTitle,"Trigger",()=>m.DialogTrigger,"Viewport",()=>h.DialogViewport,"createHandle",0,function(){return new f.DialogHandle(new s.DialogStore({modal:!0,disablePointerDismissal:!0,role:"alertdialog"}))}],756198);var g=e.i(756198),g=g,x=e.i(465458),v=e.i(260218),y=e.i(250226);function j({...e}){return(0,t.jsx)(g.Portal,{"data-slot":"alert-dialog-portal",...e})}function b({className:e,...a}){return(0,t.jsx)(g.Backdrop,{"data-slot":"alert-dialog-overlay",className:(0,x.cn)("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...a})}e.s(["AlertDialog",0,function({ignoreBack:e=!1,...n}){let i=a.useId(),r=(0,y.useMobilePanelStore)(e=>e.registerOverlay),s=(0,y.useMobilePanelStore)(e=>e.unregisterOverlay),o="open"in n?n.open:"defaultOpen"in n?n.defaultOpen:void 0,l=n.onOpenChange,c=a.useRef(l);return a.useEffect(()=>{c.current=l},[l]),a.useEffect(()=>o&&!e&&c.current?(r(i,()=>c.current?.(!1,{reason:void 0})),()=>s(i)):void s(i),[e,o,i,r,s]),(0,t.jsx)(g.Root,{"data-slot":"alert-dialog",...n})},"AlertDialogAction",0,function({className:e,...a}){return(0,t.jsx)(v.Button,{"data-slot":"alert-dialog-action",className:(0,x.cn)(e),...a})},"AlertDialogCancel",0,function({className:e,variant:a="outline",size:n="default",...i}){return(0,t.jsx)(g.Close,{"data-slot":"alert-dialog-cancel",className:(0,x.cn)(e),render:(0,t.jsx)(v.Button,{variant:a,size:n}),...i})},"AlertDialogContent",0,function({className:e,size:a="default",...n}){return(0,t.jsxs)(j,{children:[(0,t.jsx)(b,{}),(0,t.jsx)(g.Popup,{"data-slot":"alert-dialog-content","data-size":a,className:(0,x.cn)("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...n})]})},"AlertDialogDescription",0,function({className:e,...a}){return(0,t.jsx)(g.Description,{"data-slot":"alert-dialog-description",className:(0,x.cn)("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...a})},"AlertDialogFooter",0,function({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"alert-dialog-footer",className:(0,x.cn)("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...a})},"AlertDialogHeader",0,function({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"alert-dialog-header",className:(0,x.cn)("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...a})},"AlertDialogTitle",0,function({className:e,...a}){return(0,t.jsx)(g.Title,{"data-slot":"alert-dialog-title",className:(0,x.cn)("font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...a})}],734649)},938306,e=>{"use strict";let t=(0,e.i(433721).default)("message-circle",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]);e.s(["MessageCircle",0,t],938306)},592039,e=>{"use strict";let t=(0,e.i(433721).default)("circle-dot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);e.s(["CircleDot",0,t],592039)},964970,e=>{"use strict";var t=e.i(344180),a=e.i(764556),n=e.i(244073),i=e.i(260218),r=e.i(681622),s=e.i(817854),o=e.i(360112),l=e.i(437122);e.s(["GitSettingsForm",0,function({scope:e,workspaceId:c}){let d=(0,n.useTranslations)("git.settings"),u=(0,n.useTranslations)("common"),[p,m]=(0,a.useState)(""),[h,f]=(0,a.useState)(""),[g,x]=(0,a.useState)(""),[v,y]=(0,a.useState)(""),[j,b]=(0,a.useState)(!0),[w,S]=(0,a.useState)(!1),N=(0,a.useCallback)(async()=>{b(!0);try{let t="global"===e?"/api/git-config":`/api/workspaces/${c}/git/config`,a=await fetch(t,{headers:(0,l.authHeaders)()});if(a.ok){let e=await a.json();m(e.name??""),f(e.email??""),x(e.proxy??"")}if("local"===e&&c){let e=await fetch(`/api/workspaces/${c}/git/remote-url`,{headers:(0,l.authHeaders)()});if(e.ok){let t=await e.json();y(t.url??"")}}}catch{}b(!1)},[e,c]);(0,a.useEffect)(()=>{N()},[e,c,N]);let k=async()=>{S(!0);try{let t="global"===e?"/api/git-config":`/api/workspaces/${c}/git/config`;if(!(await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",...(0,l.authHeaders)()},body:JSON.stringify({name:p,email:h,proxy:g})})).ok){o.toast.error(d("saveFailed")),S(!1);return}"local"===e&&c&&v&&await fetch(`/api/workspaces/${c}/git/remotes`,{method:"POST",headers:{"Content-Type":"application/json",...(0,l.authHeaders)()},body:JSON.stringify({name:"origin",url:v})}),o.toast.success(d("saved"))}catch{o.toast.error(d("saveFailed"))}S(!1)};return j?(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:d("loading")}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"global"===e?d("globalScopeDescription"):d("localScopeDescription")}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(s.Label,{className:"text-xs text-muted-foreground",children:d("name")}),(0,t.jsx)(r.Input,{className:"h-7 text-xs",value:p,onChange:e=>m(e.target.value),placeholder:d("namePlaceholder")})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(s.Label,{className:"text-xs text-muted-foreground",children:d("email")}),(0,t.jsx)(r.Input,{className:"h-7 text-xs",value:h,onChange:e=>f(e.target.value),placeholder:d("emailPlaceholder")})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(s.Label,{className:"text-xs text-muted-foreground",children:d("proxy")}),(0,t.jsx)(r.Input,{className:"h-7 text-xs",value:g,onChange:e=>x(e.target.value),placeholder:d("proxyPlaceholder")})]}),"local"===e&&(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)(s.Label,{className:"text-xs text-muted-foreground",children:d("remoteUrl")}),(0,t.jsx)(r.Input,{className:"h-7 text-xs",value:v,onChange:e=>y(e.target.value),placeholder:d("remoteUrlPlaceholder")})]}),(0,t.jsx)(i.Button,{size:"sm",className:"text-xs",onClick:k,disabled:w,children:u(w?"loading":"save")})]})}])},419199,(e,t,a)=>{t.exports={explorer:"EXPLORER",noFiles:"No files found",revealInFinder:"Reveal in Finder",openInTerminal:"Open in Terminal",loading:"Loading...",loadingEditor:"Loading editor...",openFileToEdit:"Open a file to start editing",search:"Search",searchPlaceholder:"Search file contents...",searchFiles:"Search Files",searchCode:"Search Code",caseSensitive:"Case Sensitive",useRegex:"Regex",searchResults:"{count} results in {files} files",tooManyResults:"Too many results, narrow your search",noResults:"No results found",searching:"Searching...",menuFile:"File",menuEdit:"Edit",menuSave:"Save",menuUndo:"Undo",menuRedo:"Redo",menuCut:"Cut",menuCopy:"Copy",menuPaste:"Paste",menuFind:"Find",menuReplace:"Replace",menuView:"View",menuRun:"Run",openCurrentDir:"Current File Directory",openWorkspaceRoot:"Workspace Root",menuFullscreen:"Fullscreen",exitFullscreen:"Exit Fullscreen",enableEdit:"Enable Editing",disableEdit:"Set Read-only",enableWordWrap:"Word Wrap",disableWordWrap:"Disable Word Wrap",enableMinimap:"Minimap",disableMinimap:"Disable Minimap",zoomIn:"Zoom In",zoomOut:"Zoom Out",zoomReset:"Reset Font Size",revealInTree:"Reveal in File Tree",copyFilePath:"Copy File Path",copyRelativePath:"Copy Relative Path",copied:"Copied",pin:"Pin Tab",unpin:"Unpin Tab",closeOthers:"Close Others",closeLeft:"Close to Left",closeRight:"Close to Right",saveChangesTitle:"Save Changes",saveChangesDesc:'File "{name}" has unsaved changes. Save before closing?',discardChanges:"Don't Save",cancel:"Cancel",save:"Save",importFile:"Import File",importFileDesc:"Choose an import method to add files to the current directory",importOnline:"Online File",importInternal:"Internal File",importUpload:"Local Upload",importSuccess:"Import successful",importFailed:"Import failed",copyPath:"Copy Path",duplicateFile:"Duplicate",duplicateSuccess:"Duplicate created",duplicateFailed:"Failed to create duplicate",rename:"Rename",move:"Move",copyFile:"Copy",download:"Download",copyDownloadUrl:"Copy Download URL",renameTitle:"Rename",renamePlaceholder:"Enter new name",moveTitle:"Move to",movePlaceholder:"Enter destination path",copyTitle:"Copy to",copyPlaceholder:"Enter destination path",newFile:"New File",newFolder:"New Folder",newFileName:"Enter file name",newFolderName:"Enter folder name",fileTooLargeTitle:"Large File",fileTooLargeDesc:'File "{name}" is {size}, which may cause the editor to lag. Open anyway?',openAnyway:"Open Anyway",deleteFileTitle:"Delete File",deleteFileDesc:'Are you sure you want to delete "{name}"? This action cannot be undone.',deleteFolderTitle:"Delete Folder",deleteFolderDesc:'Are you sure you want to delete "{name}" and all its contents? This action cannot be undone.',allFiles:"All Files",recentlyAdded:"Recently Added",recentlyOpened:"Recently Opened",code:"Code",preview:"Preview",switchToCode:"Switch to Code",switchToPreview:"Switch to Preview",copyPosition:"Copy Code Position",addToFavorites:"Add to Code Favorites",sendToNewChannel:"Send to New Channel",sendToNewIssue:"Send to New Issue",noFavorites:"No code favorites yet",noFavoritesHint:"Right-click in editor → Add to Code Favorites",copiedPosition:"Copied: {pos}",lines:"lines"}},684198,(e,t,a)=>{t.exports={explorer:"资源管理器",noFiles:"未找到文件",revealInFinder:"在 Finder 中显示",openInTerminal:"在终端中打开",loading:"加载中...",loadingEditor:"编辑器加载中...",openFileToEdit:"打开文件开始编辑",search:"搜索",searchPlaceholder:"搜索文件内容...",searchFiles:"搜索文件名",searchCode:"搜索代码",caseSensitive:"区分大小写",useRegex:"正则表达式",searchResults:"{count} 个结果,{files} 个文件",tooManyResults:"结果过多,请缩小搜索范围",noResults:"未找到结果",searching:"搜索中...",menuFile:"文件",menuEdit:"编辑",menuSave:"保存",menuUndo:"撤销",menuRedo:"重做",menuCut:"剪切",menuCopy:"复制",menuPaste:"粘贴",menuFind:"查找",menuReplace:"替换",menuView:"视图",menuRun:"运行",openCurrentDir:"当前文件目录",openWorkspaceRoot:"工作空间根目录",menuFullscreen:"全屏",exitFullscreen:"退出全屏",enableEdit:"启用编辑",disableEdit:"设为只读",enableWordWrap:"自动换行",disableWordWrap:"取消自动换行",enableMinimap:"迷你地图",disableMinimap:"关闭迷你地图",zoomIn:"放大",zoomOut:"缩小",zoomReset:"重置字体大小",revealInTree:"在文件树中显示",copyFilePath:"复制文件路径",copyRelativePath:"复制相对路径",copied:"已复制",pin:"固定标签",unpin:"取消固定",closeOthers:"关闭其他",closeLeft:"关闭左边",closeRight:"关闭右边",saveChangesTitle:"保存更改",saveChangesDesc:'文件 "{name}" 已修改,是否保存?',discardChanges:"不保存",cancel:"取消",save:"保存",importFile:"导入文件",importFileDesc:"选择导入方式将文件添加到当前目录",importOnline:"在线文件",importInternal:"内部文件",importUpload:"本地上传",importSuccess:"导入成功",importFailed:"导入失败",copyPath:"复制路径",duplicateFile:"复制副本",duplicateSuccess:"副本已创建",duplicateFailed:"创建副本失败",rename:"重命名",move:"移动",copyFile:"复制",download:"下载",copyDownloadUrl:"获取下载地址",renameTitle:"重命名",renamePlaceholder:"输入新名称",moveTitle:"移动到",movePlaceholder:"输入目标路径",copyTitle:"复制到",copyPlaceholder:"输入目标路径",newFile:"新建文件",newFolder:"新建文件夹",newFileName:"输入文件名",newFolderName:"输入文件夹名",fileTooLargeTitle:"文件过大",fileTooLargeDesc:'文件 "{name}" 大小为 {size},可能导致编辑器卡顿。是否继续打开?',openAnyway:"仍然打开",deleteFileTitle:"删除文件",deleteFileDesc:'确定要删除文件 "{name}" 吗?此操作不可撤销。',deleteFolderTitle:"删除文件夹",deleteFolderDesc:'确定要删除文件夹 "{name}" 及其所有内容吗?此操作不可撤销。',allFiles:"所有文件",recentlyAdded:"最近添加",recentlyOpened:"最近打开",code:"代码",preview:"预览",switchToCode:"切换到代码",switchToPreview:"切换到预览",copyPosition:"复制代码位置",addToFavorites:"添加到代码收藏",sendToNewChannel:"发送到新频道",sendToNewIssue:"发送到新议题",noFavorites:"暂无代码收藏",noFavoritesHint:"在编辑器中右键 → 添加到代码收藏",copiedPosition:"已复制: {pos}",lines:"行"}},996652,e=>{"use strict";var t,a=e.i(344180);e.s([],739605),e.i(739605);var n=e.i(764556),i=e.i(166392),r=e.i(538501),s=e.i(427396),o=e.i(974578),l=e.i(389124),c=e.i(107164);e.i(8890);var d=e.i(267805);let u=n.createContext(void 0);function p(e){let t=n.useContext(u);if(void 0===t&&!e)throw Error((0,d.default)(47));return t}var m=e.i(106206),h=e.i(493696),f=e.i(332976),g=e.i(232449),x=e.i(549154),v=e.i(130522),y=e.i(742665),j=e.i(695011),b=e.i(561213),w=e.i(576487);let S={...j.popupStoreSelectors,disabled:(0,f.createSelector)(e=>e.disabled),instantType:(0,f.createSelector)(e=>e.instantType),openMethod:(0,f.createSelector)(e=>e.openMethod),openChangeReason:(0,f.createSelector)(e=>e.openChangeReason),modal:(0,f.createSelector)(e=>e.modal),focusManagerModal:(0,f.createSelector)(e=>e.focusManagerModal),stickIfOpen:(0,f.createSelector)(e=>e.stickIfOpen),titleElementId:(0,f.createSelector)(e=>e.titleElementId),descriptionElementId:(0,f.createSelector)(e=>e.descriptionElementId),openOnHover:(0,f.createSelector)(e=>e.openOnHover),closeDelay:(0,f.createSelector)(e=>e.closeDelay),hasViewport:(0,f.createSelector)(e=>e.hasViewport)};class N extends h.ReactStore{constructor(e){const t={...(0,j.createInitialPopupStoreState)(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1,...e};t.open&&e?.mounted===void 0&&(t.mounted=!0),super(t,{popupRef:n.createRef(),backdropRef:n.createRef(),internalBackdropRef:n.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:n.createRef(),beforeContentFocusGuardRef:n.createRef(),stickIfOpenTimeout:new g.Timeout,triggerElements:new b.PopupTriggerMap},S)}setOpen=(e,t)=>{let a=t.reason===y.REASONS.triggerHover,n=t.reason===y.REASONS.triggerPress&&0===t.event.detail,i=!e&&(t.reason===y.REASONS.escapeKey||null==t.reason);if(t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let r=()=>{let a={open:e,openChangeReason:t.reason},n=t.trigger?.id??null;(n||e)&&(a.activeTriggerId=n,a.activeTriggerElement=t.trigger??null),this.update(a)};a?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(w.PATIENT_CLICK_THRESHOLD,()=>{this.set("stickIfOpen",!1)}),m.flushSync(r)):r(),n||i?this.set("instantType",n?"click":"dismiss"):t.reason===y.REASONS.focusOut?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(e,t){let a=(0,x.useRefWithInit)(()=>new N(t)).current,n=e??a;return(0,v.useOnMount)(a.disposeEffect),n}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}var k=e.i(602453),C=e.i(279501),T=e.i(564846);function P({props:e}){let{children:t,open:d,defaultOpen:p=!1,onOpenChange:m,onOpenChangeComplete:h,modal:f=!1,handle:g,triggerId:x,defaultTriggerId:v=null}=e,j=N.useStore(g?.store,{modal:f,open:p,openProp:d,activeTriggerId:v,triggerIdProp:x});(0,i.useOnFirstRender)(()=>{void 0===d&&!1===j.state.open&&!0===p&&j.update({open:!0,activeTriggerId:v})}),j.useControlledProp("openProp",d),j.useControlledProp("triggerIdProp",x);let b=j.useState("open"),w=j.useState("payload");j.useContextCallback("onOpenChange",m),j.useContextCallback("onOpenChangeComplete",h);let{openMethod:S,triggerProps:R}=(0,T.useOpenInteractionType)(b);(0,C.useImplicitActiveTrigger)(j);let{forceUnmount:D}=(0,C.useOpenStateTransitions)(b,j,()=>{j.update({stickIfOpen:!0,openChangeReason:null})});n.useEffect(()=>{b||j.context.stickIfOpenTimeout.clear()},[j,b]);let M=n.useCallback(()=>{j.setOpen(!1,(0,k.createChangeEventDetails)(y.REASONS.imperativeAction))},[j]);n.useImperativeHandle(e.actionsRef,()=>({unmount:D,close:M}),[D,M]);let E=(0,c.useSyncedFloatingRootContext)({popupStore:j,onOpenChange:j.setOpen}),O=(0,r.useDismiss)(E,{outsidePressEvent:{mouse:"trap-focus"===f?"sloppy":"intentional",touch:"sloppy"}}),z=(0,o.useRole)(E),{getReferenceProps:F,getFloatingProps:I,getTriggerProps:A}=(0,s.useInteractions)([O,z]),L=n.useMemo(()=>F(R),[F,R]),B=n.useMemo(()=>A(R),[A,R]),$=n.useMemo(()=>I(),[I]);j.useSyncedValues({modal:f,openMethod:S,activeTriggerProps:L,inactiveTriggerProps:B,popupProps:$,floatingRootContext:E,nested:null!=(0,l.useFloatingParentNodeId)()});let W=n.useMemo(()=>({store:j}),[j]);return(0,a.jsx)(u.Provider,{value:W,children:"function"==typeof t?t({payload:w}):t})}var R=e.i(931709),D=e.i(817955),M=e.i(969490),E=e.i(499198),O=e.i(934940),z=e.i(480283),F=e.i(139236),I=e.i(601957),A=e.i(660079);let L=n.forwardRef(function(e,t){let{render:i,className:r,disabled:o=!1,nativeButton:l=!0,handle:c,payload:u,openOnHover:m=!1,delay:h=300,closeDelay:f=0,id:g,style:x,...v}=e,j=p(!0),b=c?.store??j?.store;if(!b)throw Error((0,d.default)(74));let S=(0,F.useBaseUiId)(g),N=b.useState("isTriggerActive",S),k=b.useState("floatingRootContext"),T=b.useState("isOpenedByTrigger",S),P=n.useRef(null),{registerTrigger:L,isMountedByThisTrigger:B}=(0,C.useTriggerDataForwarding)(S,P,b,{payload:u,disabled:o,openOnHover:m,closeDelay:f}),$=b.useState("openChangeReason"),W=b.useState("stickIfOpen"),H=b.useState("openMethod"),U=b.useState("focusManagerModal"),V=(0,z.useHoverReferenceInteraction)(k,{enabled:null!=k&&m&&("touch"!==H||$!==y.REASONS.triggerPress),mouseOnly:!0,move:!1,handleClose:(0,E.safePolygon)(),restMs:h,delay:{close:f},triggerElementRef:P,isActiveTrigger:N,isClosing:()=>"ending"===b.select("transitionStatus")}),_=(0,O.useClick)(k,{enabled:null!=k,stickIfOpen:W}),q=(0,s.useInteractions)([_]),J=b.useState("triggerProps",B),{getButtonProps:K,buttonRef:G}=(0,R.useButton)({disabled:o,native:l}),X=n.useMemo(()=>({open:e=>e&&$===y.REASONS.triggerPress?D.pressableTriggerOpenStateMapping.open(e):D.triggerOpenStateMapping.open(e)}),[$]),Y=(0,M.useRenderElement)("button",e,{state:{disabled:o,open:T},ref:[G,t,L,P],props:[q.getReferenceProps(),V,J,{[w.CLICK_TRIGGER_IDENTIFIER]:"",id:S},v,K],stateAttributesMapping:X}),{preFocusGuardRef:Q,handlePreFocusGuardFocus:Z,handleFocusTargetFocus:ee}=(0,A.useTriggerFocusGuards)(b,P);return N&&!U?(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)(I.FocusGuard,{ref:Q,onFocus:Z}),(0,a.jsx)(n.Fragment,{children:Y},S),(0,a.jsx)(I.FocusGuard,{ref:b.context.triggerFocusTargetRef,onFocus:ee})]}):(0,a.jsx)(n.Fragment,{children:Y},S)});var B=e.i(128108);let $=n.createContext(void 0),W=n.forwardRef(function(e,t){let{keepMounted:n=!1,...i}=e,{store:r}=p();return r.useState("mounted")||n?(0,a.jsx)($.Provider,{value:n,children:(0,a.jsx)(B.FloatingPortal,{ref:t,...i})}):null});var H=e.i(677822),U=e.i(277642);let V=n.createContext(void 0);function _(){let e=n.useContext(V);if(!e)throw Error((0,d.default)(46));return e}var q=e.i(576557),J=e.i(251817),K=e.i(427708),G=e.i(909852),X=e.i(263635),Y=e.i(900587);let Q=n.forwardRef(function(e,t){let{render:i,className:r,anchor:s,positionMethod:o="absolute",side:c="bottom",align:u="center",sideOffset:m=0,alignOffset:h=0,collisionBoundary:f="clipping-ancestors",collisionPadding:g=5,arrowPadding:x=5,sticky:v=!1,disableAnchorTracking:j=!1,collisionAvoidance:b=w.POPUP_COLLISION_AVOIDANCE,style:S,...N}=e,{store:k}=p(),C=function(){let e=n.useContext($);if(void 0===e)throw Error((0,d.default)(45));return e}(),T=(0,l.useFloatingNodeId)(),P=k.useState("floatingRootContext"),R=k.useState("mounted"),D=k.useState("open"),M=k.useState("openChangeReason"),E=k.useState("activeTriggerElement"),O=k.useState("modal"),z=k.useState("openMethod"),F=k.useState("positionerElement"),I=k.useState("instantType"),A=k.useState("transitionStatus"),L=k.useState("hasViewport"),B=n.useRef(null),W=(0,K.useAnimationsFinished)(F,!1,!1),_=(0,q.useAnchorPositioning)({anchor:s,floatingRootContext:P,positionMethod:o,mounted:R,side:c,sideOffset:m,align:u,alignOffset:h,arrowPadding:x,collisionBoundary:f,collisionPadding:g,sticky:v,disableAnchorTracking:j,keepMounted:C,nodeId:T,collisionAvoidance:b,adaptiveOrigin:L?G.adaptiveOrigin:void 0}),Q=P.useState("domReferenceElement");(0,U.useIsoLayoutEffect)(()=>{let e=B.current;if(Q&&(B.current=Q),e&&Q&&Q!==e){k.set("instantType",void 0);let e=new AbortController;return W(()=>{k.set("instantType","trigger-change")},e.signal),()=>{e.abort()}}},[Q,W,k]);let Z={open:D,side:_.side,align:_.align,anchorHidden:_.anchorHidden,instant:I};(0,Y.useAnchoredPopupScrollLock)(D&&!0===O&&M!==y.REASONS.triggerHover,"touch"===z,F,E);let ee=n.useCallback(e=>{k.set("positionerElement",e)},[k]),et=(0,X.usePositioner)(e,Z,{styles:_.positionerStyles,transitionStatus:A,props:N,refs:[t,ee],hidden:!R,inert:!D});return(0,a.jsxs)(V.Provider,{value:_,children:[R&&!0===O&&M!==y.REASONS.triggerHover&&(0,a.jsx)(J.InternalBackdrop,{ref:k.context.internalBackdropRef,inert:(0,H.inertValue)(!D),cutout:E}),(0,a.jsx)(l.FloatingNode,{id:T,children:et})]})});var Z=e.i(92615),ee=e.i(583289),et=e.i(795914),ea=e.i(282458),en=e.i(273598),ei=e.i(100229),er=e.i(971109),es=e.i(328657),eo=e.i(29905);let el=n.createContext(void 0);function ec(e){let{value:t,children:n}=e;return(0,a.jsx)(el.Provider,{value:t,children:n})}let ed={...D.popupStateMapping,...ea.transitionStatusMapping},eu=n.forwardRef(function(e,t){let{className:i,render:r,initialFocus:s,finalFocus:o,style:l,...c}=e,{store:d}=p(),u=_(),m=null!=(0,er.useToolbarRootContext)(!0),{context:h,hasClosePart:f}=function(){let[e,t]=n.useState(0),a=(0,eo.useStableCallback)(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:n.useMemo(()=>({register:a}),[a]),hasClosePart:e>0}}(),g=d.useState("open"),x=d.useState("openMethod"),v=d.useState("instantType"),j=d.useState("transitionStatus"),b=d.useState("popupProps"),w=d.useState("titleElementId"),S=d.useState("descriptionElementId"),N=d.useState("modal"),k=d.useState("mounted"),C=d.useState("openChangeReason"),T=d.useState("activeTriggerElement"),P=d.useState("floatingRootContext");(0,en.useOpenChangeComplete)({open:g,ref:d.context.popupRef,onComplete(){g&&d.context.onOpenChangeComplete?.(!0)}});let R=d.useState("disabled"),D=d.useState("openOnHover"),E=d.useState("closeDelay");(0,et.useHoverFloatingInteraction)(P,{enabled:D&&!R,closeDelay:E});let O=void 0===s?function(e){return"touch"!==e||d.context.popupRef.current}:s,z={open:g,side:u.side,align:u.align,instant:v,transitionStatus:j},F=!1!==N&&f;d.useSyncedValue("focusManagerModal",F);let I=n.useCallback(e=>{d.set("popupElement",e)},[d]),A=(0,M.useRenderElement)("div",e,{state:z,ref:[t,d.context.popupRef,I],props:[b,{"aria-labelledby":w,"aria-describedby":S,onKeyDown(e){m&&ei.COMPOSITE_KEYS.has(e.key)&&e.stopPropagation()}},(0,es.getDisabledMountTransitionStyles)(j),c],stateAttributesMapping:ed});return(0,a.jsx)(ee.FloatingFocusManager,{context:P,openInteractionType:x,modal:F,disabled:!k||C===y.REASONS.triggerHover,initialFocus:O,returnFocus:o,restoreFocus:"popup",previousFocusableElement:(0,Z.isHTMLElement)(T)?T:void 0,nextFocusableElement:d.context.triggerFocusTargetRef,beforeContentFocusGuardRef:d.context.beforeContentFocusGuardRef,children:(0,a.jsx)(ec,{value:h,children:A})})}),ep=n.forwardRef(function(e,t){let{className:a,render:n,style:i,...r}=e,{store:s}=p(),o=s.useState("open"),{arrowRef:l,side:c,align:d,arrowUncentered:u,arrowStyles:m}=_();return(0,M.useRenderElement)("div",e,{state:{open:o,side:c,align:d,uncentered:u},ref:[t,l],props:[{style:m,"aria-hidden":!0},r],stateAttributesMapping:D.popupStateMapping})}),em={...D.popupStateMapping,...ea.transitionStatusMapping},eh=n.forwardRef(function(e,t){let{className:a,render:n,style:i,...r}=e,{store:s}=p(),o=s.useState("open"),l=s.useState("mounted"),c=s.useState("transitionStatus"),d=s.useState("openChangeReason");return(0,M.useRenderElement)("div",e,{state:{open:o,transitionStatus:c},ref:[s.context.backdropRef,t],props:[{role:"presentation",hidden:!l,style:{pointerEvents:d===y.REASONS.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},r],stateAttributesMapping:em})}),ef=n.forwardRef(function(e,t){let{render:a,className:n,style:i,...r}=e,{store:s}=p(),o=(0,F.useBaseUiId)(r.id);return(0,U.useIsoLayoutEffect)(()=>(s.set("titleElementId",o),()=>{s.set("titleElementId",void 0)}),[s,o]),(0,M.useRenderElement)("h2",e,{ref:t,props:[{id:o},r]})}),eg=n.forwardRef(function(e,t){let{render:a,className:n,style:i,...r}=e,{store:s}=p(),o=(0,F.useBaseUiId)(r.id);return(0,U.useIsoLayoutEffect)(()=>(s.set("descriptionElementId",o),()=>{s.set("descriptionElementId",void 0)}),[s,o]),(0,M.useRenderElement)("p",e,{ref:t,props:[{id:o},r]})}),ex=n.forwardRef(function(e,t){let a,{render:i,className:r,disabled:s=!1,nativeButton:o=!0,style:l,...c}=e,{buttonRef:d,getButtonProps:u}=(0,R.useButton)({disabled:s,focusableWhenDisabled:!1,native:o}),{store:m}=p();return a=n.useContext(el),(0,U.useIsoLayoutEffect)(()=>a?.register(),[a]),(0,M.useRenderElement)("button",e,{ref:[t,d],props:[{onClick(e){m.setOpen(!1,(0,k.createChangeEventDetails)(y.REASONS.closePress,e.nativeEvent,e.currentTarget))}},c,u]})}),ev=((t={}).popupWidth="--popup-width",t.popupHeight="--popup-height",t);var ey=e.i(3310);let ej={activationDirection:e=>e?{"data-activation-direction":e}:null},eb=n.forwardRef(function(e,t){let{render:a,className:n,style:i,children:r,...s}=e,{store:o}=p(),{side:l}=_(),c=o.useState("instantType"),{children:d,state:u}=(0,ey.usePopupViewport)({store:o,side:l,cssVars:ev,children:r}),m={activationDirection:u.activationDirection,transitioning:u.transitioning,instant:c};return(0,M.useRenderElement)("div",e,{state:m,ref:t,props:[s,{children:d}],stateAttributesMapping:ej})});class ew{constructor(){this.store=new N}open(e){let t=e?this.store.context.triggerElements.getById(e)??void 0:void 0;if(e&&!t)throw Error((0,d.default)(80,e));this.store.setOpen(!0,(0,k.createChangeEventDetails)(y.REASONS.imperativeAction,void 0,t))}close(){this.store.setOpen(!1,(0,k.createChangeEventDetails)(y.REASONS.imperativeAction,void 0,void 0))}get isOpen(){return this.store.state.open}}e.s(["Arrow",0,ep,"Backdrop",0,eh,"Close",0,ex,"Description",0,eg,"Handle",0,ew,"Popup",0,eu,"Portal",0,W,"Positioner",0,Q,"Root",0,function(e){return p(!0)?(0,a.jsx)(P,{props:e}):(0,a.jsx)(l.FloatingTree,{children:(0,a.jsx)(P,{props:e})})},"Title",0,ef,"Trigger",0,L,"Viewport",0,eb,"createHandle",0,function(){return new ew}],631858);var eS=e.i(631858),eS=eS,eN=e.i(465458);e.s(["Popover",0,function({...e}){return(0,a.jsx)(eS.Root,{"data-slot":"popover",...e})},"PopoverContent",0,function({className:e,positionerClassName:t,align:n="center",alignOffset:i=0,side:r="bottom",sideOffset:s=4,...o}){return(0,a.jsx)(eS.Portal,{children:(0,a.jsx)(eS.Positioner,{align:n,alignOffset:i,side:r,sideOffset:s,className:(0,eN.cn)("isolate z-50",t),children:(0,a.jsx)(eS.Popup,{"data-slot":"popover-content",className:(0,eN.cn)("z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...o})})})},"PopoverTrigger",0,function({...e}){return(0,a.jsx)(eS.Trigger,{"data-slot":"popover-trigger",...e})}],996652)},144988,e=>{"use strict";let t=(0,e.i(433721).default)("file",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]);e.s(["default",0,t])},193251,e=>{"use strict";let t=(0,e.i(433721).default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);e.s(["Download",0,t],193251)},984178,e=>{"use strict";var t=e.i(144988);e.s(["FileIcon",()=>t.default])},460578,e=>{"use strict";var t=e.i(344180),a=e.i(764556),n=e.i(898822),i=e.i(129981),r=e.i(972846),s=e.i(984178),o=e.i(465458);let l=0;e.s(["FileUpload",0,function({value:e=[],onChange:c,accept:d,maxFiles:u=0,maxSize:p,disabled:m=!1,className:h,placeholder:f}){let[g,x]=(0,a.useState)(null),v=(0,a.useCallback)((t,a)=>{if(x(null),a.length>0){let e=a[0].errors[0]?.message;e&&x(e)}if(0===t.length)return;let n=t.map(e=>{let t={id:`upload-${++l}`,file:e};return e.type.startsWith("image/")&&(t.preview=URL.createObjectURL(e)),t}),i=u>0?[...e,...n].slice(0,u):[...e,...n];c?.(i)},[e,c,u]),y=(0,a.useCallback)(t=>{let a=e.find(e=>e.id===t);a?.preview&&URL.revokeObjectURL(a.preview),c?.(e.filter(e=>e.id!==t))},[e,c]),{getRootProps:j,getInputProps:b,isDragActive:w}=(0,n.useDropzone)({onDrop:v,accept:d,maxFiles:u||void 0,maxSize:p,disabled:m,noClick:!1});return(0,t.jsxs)("div",{className:(0,o.cn)("space-y-3",h),children:[(0,t.jsxs)("div",{...j(),className:(0,o.cn)("relative flex flex-col items-center justify-center gap-2 rounded-xl border-2 border-dashed px-6 py-8 transition-colors cursor-pointer",w?"border-primary bg-primary/5":"border-border hover:border-primary/50 hover:bg-accent/50",m&&"pointer-events-none opacity-50"),children:[(0,t.jsx)("input",{...b()}),(0,t.jsx)(i.Upload,{className:"size-8 text-muted-foreground"}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:f??(w?"松开即可上传":"拖拽文件到此处,或点击选择")}),!w&&(0,t.jsxs)("p",{className:"mt-1 text-xs text-muted-foreground",children:["支持多文件",p?`,单文件最大 ${(p/1024/1024).toFixed(0)}MB`:""]})]})]}),g&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:g}),e.length>0&&(0,t.jsx)("div",{className:"flex flex-col gap-2",children:e.map(e=>{var a;return(0,t.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-background px-3 py-2 overflow-hidden",children:[e.preview?(0,t.jsx)("img",{src:e.preview,alt:"",className:"size-10 rounded-md object-cover"}):(0,t.jsx)("div",{className:"flex size-10 items-center justify-center rounded-md bg-muted",children:(0,t.jsx)(s.FileIcon,{className:"size-5 text-muted-foreground"})}),(0,t.jsxs)("div",{className:"w-0 flex-1",children:[(0,t.jsx)("p",{className:"truncate text-sm",children:e.file.name}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:(a=e.file.size)<1024?`${a} B`:a<1048576?`${(a/1024).toFixed(1)} KB`:`${(a/1024/1024).toFixed(1)} MB`})]}),(0,t.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),y(e.id)},className:"flex size-7 items-center justify-center rounded-md hover:bg-accent transition-colors",children:(0,t.jsx)(r.X,{className:"size-4 text-muted-foreground"})})]},e.id)})})]})}])},486657,e=>{"use strict";let t=(0,e.i(433721).default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);e.s(["AlertTriangle",0,t],486657)},882469,e=>{"use strict";var t=e.i(551157);e.s(["Globe",()=>t.default])},383171,415955,e=>{"use strict";var t=e.i(220336);e.s(["FolderIcon",()=>t.default],383171);var a=e.i(680422);e.s(["FolderOpenIcon",()=>a.default],415955)},262232,e=>{"use strict";let t=(0,e.i(433721).default)("arrow-right-left",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);e.s(["ArrowRightLeft",0,t],262232)},506037,e=>{"use strict";var t=e.i(816709),a=e.i(437122);let n=(0,t.create)((e,t)=>({notifications:[],loaded:!1,load:async t=>{try{let n=await (0,a.fetchWithAuth)(`/api/workspaces/${t}/notifications`),i=await n.json();e({notifications:i,loaded:!0})}catch{e({loaded:!0})}},addNotification:t=>{e(e=>({notifications:[t,...e.notifications]}))},clearAll:async t=>{await (0,a.fetchWithAuth)(`/api/workspaces/${t}/notifications`,{method:"DELETE"}),e({notifications:[]})},remove:async(t,n)=>{await (0,a.fetchWithAuth)(`/api/workspaces/${t}/notifications/${n}`,{method:"DELETE"}).catch(()=>{}),e(e=>({notifications:e.notifications.filter(e=>e.id!==n)}))},markRead:async(t,n)=>{await (0,a.fetchWithAuth)(`/api/workspaces/${t}/notifications/${n}/read`,{method:"PUT"}),e(e=>({notifications:e.notifications.map(e=>e.id===n?{...e,read:!0}:e)}))},markAllRead:async t=>{await (0,a.fetchWithAuth)(`/api/workspaces/${t}/notifications/read-all`,{method:"PUT"}),e(e=>({notifications:e.notifications.map(e=>({...e,read:!0}))}))},reset:()=>e({notifications:[],loaded:!1})}));e.s(["useNotificationStore",0,n])},939760,e=>{"use strict";let t=(0,e.i(433721).default)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.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",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);e.s(["Settings",0,t],939760)},651850,e=>{"use strict";let t=(0,e.i(433721).default)("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);e.s(["default",0,t])},417092,e=>{"use strict";var t=e.i(344180),a=e.i(764556);function n(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}let i=(0,a.forwardRef)(function({size:e=44,lsKey:i,onClick:r,children:s,className:o,style:l,visible:c=!0,snapThreshold:d=60,minimizeDelay:u=2e3,unhoverDelay:p=2e3,defaultPosition:m},h){let f=(0,a.useRef)({x:0,y:0}),[g,x]=(0,a.useState)({x:0,y:0}),[v,y]=(0,a.useState)(!1),[j,b]=(0,a.useState)(!1),w=(0,a.useRef)(!1),S=(0,a.useRef)({x:0,y:0}),N=(0,a.useRef)(!1),k=(0,a.useRef)(void 0),C=(0,a.useRef)(void 0),T=(0,a.useRef)("right"),P=(0,a.useRef)(null),R=e/2;(0,a.useEffect)(()=>{let t=function(e){try{let t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}}(i),a={x:m?.x??window.innerWidth-e-20,y:m?.y??window.innerHeight-e-28},n=t?{x:Math.min(t.x,window.innerWidth-e),y:Math.min(t.y,window.innerHeight-e)}:a;f.current=n,x(n),y(!0);let r=window.innerWidth;if(n.x<=d||n.x>=r-e-d){let e=n.x<r/2?"left":"right";T.current=e,P.current=e,k.current=setTimeout(()=>D(e),u)}},[i,e,m]);let D=(0,a.useCallback)(e=>{b(!0),f.current={x:"left"===e?-R:window.innerWidth-R,y:f.current.y},x(f.current)},[R]),M=(0,a.useCallback)(()=>{clearTimeout(k.current),k.current=void 0,clearTimeout(C.current),C.current=void 0},[]),E=(0,a.useCallback)(()=>{M(),b(!1);let t=window.innerWidth,a={x:f.current.x<t/2?12:t-e-12,y:f.current.y};f.current=a,x(a),n(i,a)},[M,e,i]),O=(0,a.useCallback)(()=>{j&&E(),clearTimeout(C.current),C.current=void 0},[j,E]),z=(0,a.useCallback)(()=>{P.current&&(C.current=setTimeout(()=>D(T.current),p))},[D,p]),F=(0,a.useCallback)(e=>{w.current=!0,N.current=!1,P.current=null,M(),j&&E(),S.current={x:e.clientX-f.current.x,y:e.clientY-f.current.y},e.target.setPointerCapture(e.pointerId)},[M,j,E]),I=(0,a.useCallback)(t=>{if(!w.current)return;N.current=!0;let a=Math.max(0,Math.min(window.innerWidth-e,t.clientX-S.current.x)),n=Math.max(0,Math.min(window.innerHeight-e,t.clientY-S.current.y));f.current={x:a,y:n},x({x:a,y:n})},[e]),A=(0,a.useCallback)(()=>{w.current=!1;let{x:t,y:a}=f.current,s=window.innerWidth,o=t<d,l=t>s-e-d,c=Math.max(12,Math.min(window.innerHeight-e-12,a));if(o||l){let t=o?"left":"right";T.current=t,P.current=t;let a={x:o?12:s-e-12,y:c};f.current=a,x(a),n(i,a),k.current=setTimeout(()=>D(t),u)}else P.current=null,f.current={x:t,y:c},x(f.current),n(i,{x:t,y:c});if(!N.current&&r){let e=t=>{t.stopPropagation(),t.preventDefault(),document.removeEventListener("click",e,!0)};document.addEventListener("click",e,!0),r()}},[r,D,e,d,u,i]);return((0,a.useEffect)(()=>{let t=()=>{M();let t=window.innerWidth;if(j){let a=f.current.x<t/2;f.current={x:a?-R:t-R,y:Math.min(f.current.y,window.innerHeight-e-12)}}else f.current={x:Math.min(f.current.x,t-e-12),y:Math.min(f.current.y,window.innerHeight-e-12)};x(f.current)};return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[M,j,R,e]),(0,a.useEffect)(()=>M,[M]),c&&v)?(0,t.jsx)("div",{ref:h,onPointerDown:F,onPointerMove:I,onPointerUp:A,onMouseEnter:O,onMouseLeave:z,className:o,style:{position:"fixed",left:g.x,top:g.y,width:e,height:e,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:99999,touchAction:"none",userSelect:"none",transition:w.current?"none":"left 0.3s ease-out, top 0.3s ease-out",...l},children:s}):null});e.s(["FloatingBall",0,i])},487122,511518,e=>{"use strict";let t=Symbol.for("constructDateFrom");e.s(["constructFromSymbol",0,t,"millisecondsInDay",0,864e5,"millisecondsInWeek",0,6048e5,"minutesInDay",0,1440,"minutesInMonth",0,43200],511518),e.s(["constructFrom",0,function(e,a){return"function"==typeof e?e(a):e&&"object"==typeof e&&t in e?e[t](a):e instanceof Date?new e.constructor(a):new Date(a)}],487122)},238153,244874,e=>{"use strict";var t;let a={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function n(e){return (t={})=>{let a=t.width?String(t.width):e.defaultWidth;return e.formats[a]||e.formats[e.defaultWidth]}}let i={date:n({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:n({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:n({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},r={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function s(e){return(t,a)=>{let n;if("formatting"===(a?.context?String(a.context):"standalone")&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,i=a?.width?String(a.width):t;n=e.formattingValues[i]||e.formattingValues[t]}else{let t=e.defaultWidth,i=a?.width?String(a.width):e.defaultWidth;n=e.values[i]||e.values[t]}return n[e.argumentCallback?e.argumentCallback(t):t]}}function o(e){return(t,a={})=>{let n,i=a.width,r=i&&e.matchPatterns[i]||e.matchPatterns[e.defaultMatchWidth],s=t.match(r);if(!s)return null;let o=s[0],l=i&&e.parsePatterns[i]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?function(e,t){for(let a=0;a<e.length;a++)if(t(e[a]))return a}(l,e=>e.test(o)):function(e,t){for(let a in e)if(Object.prototype.hasOwnProperty.call(e,a)&&t(e[a]))return a}(l,e=>e.test(o));return n=e.valueCallback?e.valueCallback(c):c,{value:n=a.valueCallback?a.valueCallback(n):n,rest:t.slice(o.length)}}}let l={code:"en-US",formatDistance:(e,t,n)=>{let i,r=a[e];if(i="string"==typeof r?r:1===t?r.one:r.other.replace("{{count}}",t.toString()),n?.addSuffix)if(n.comparison&&n.comparison>0)return"in "+i;else return i+" ago";return i},formatLong:i,formatRelative:(e,t,a,n)=>r[e],localize:{ordinalNumber:(e,t)=>{let a=Number(e),n=a%100;if(n>20||n<10)switch(n%10){case 1:return a+"st";case 2:return a+"nd";case 3:return a+"rd"}return a+"th"},era:s({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:s({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:s({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:s({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:s({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(t={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,a={})=>{let n=e.match(t.matchPattern);if(!n)return null;let i=n[0],r=e.match(t.parsePattern);if(!r)return null;let s=t.valueCallback?t.valueCallback(r[0]):r[0];return{value:s=a.valueCallback?a.valueCallback(s):s,rest:e.slice(i.length)}}),era:o({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:o({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:o({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:o({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:o({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};e.s(["enUS",0,l],244874),e.s(["defaultLocale",0,l],238153)},492421,e=>{"use strict";let t={};e.s(["getDefaultOptions",0,function(){return t}])},632713,516467,e=>{"use strict";var t=e.i(487122);function a(e,a){return(0,t.constructFrom)(a||e,e)}e.s(["toDate",0,a],516467),e.s(["getTimezoneOffsetInMilliseconds",0,function(e){let t=a(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-n}],632713)},539392,e=>{"use strict";var t=e.i(487122);e.s(["normalizeDates",0,function(e,...a){let n=t.constructFrom.bind(null,e||a.find(e=>"object"==typeof e));return a.map(n)}])},164202,731285,936765,e=>{"use strict";let t=(0,e.i(433721).default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);e.s(["Zap",0,t],164202);var a=e.i(539392);e.s(["differenceInCalendarMonths",0,function(e,t,n){let[i,r]=(0,a.normalizeDates)(n?.in,e,t);return 12*(i.getFullYear()-r.getFullYear())+(i.getMonth()-r.getMonth())}],731285);var n=e.i(516467);e.s(["endOfMonth",0,function(e,t){let a=(0,n.toDate)(e,t?.in),i=a.getMonth();return a.setFullYear(a.getFullYear(),i+1,0),a.setHours(23,59,59,999),a}],936765)},894920,e=>{"use strict";var t=e.i(344180),a=e.i(764556),n=e.i(209988),i=e.i(260218),r=e.i(681622),s=e.i(788010),o=e.i(344118),l=e.i(962562),c=e.i(953700),d=e.i(100559),u=e.i(137340);let p=(0,e.i(433721).default)("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);var m=e.i(244073);e.s(["ServerManagerDialog",0,function({open:e,onOpenChange:h,servers:f,activeId:g,onUpdate:x,onRemove:v,onSwitch:y}){let j=(0,m.useTranslations)("sidebar"),b=(0,m.useTranslations)("common"),[w,S]=a.useState(null),[N,k]=a.useState(""),[C,T]=a.useState(""),[P,R]=a.useState(""),[D,M]=a.useState(""),[E,O]=a.useState(""),[z,F]=a.useState(""),[I,A]=a.useState(""),[L,B]=a.useState(!1),[$,W]=a.useState(""),H=()=>{S(null),k(""),T(""),R("")},U=()=>{if(!N.trim()||!C.trim())return;let e=C.trim().replace(/\/$/,"");/^https?:\/\//.test(e)||(e="http://"+e),x(f.map(t=>t.id===w?{...t,name:N.trim(),url:e,secret:P.trim()||void 0}:t)),H()},V=a.useCallback(e=>{console.log(`[server-diagnostic] ${e}`),A(t=>`${t}${t?"\n":""}${e}`)},[]),_=async e=>{A(""),W(e.name),B(!0);let t=e.url.replace(/\/$/,""),a=`${t}/api/health`,n=new URL("/ws",t);n.protocol="https:"===n.protocol?"wss:":"ws:",n.searchParams.set("workspaceId","__diagnostic__"),n.searchParams.set("token",e.secret||"__diagnostic__"),V(`time: ${new Date().toISOString()}`),V(`window.origin: ${window.location.origin}`),V(`window.href: ${window.location.href}`),V(`navigator.onLine: ${navigator.onLine}`),V(`target: ${t}`),V(`health: ${a}`);let i=performance.now();try{let e=new AbortController,t=window.setTimeout(()=>e.abort(),1e4),n=await fetch(a,{method:"GET",cache:"no-store",mode:"cors",signal:e.signal});window.clearTimeout(t);let r=await n.text();V(`fetch /api/health: OK ${n.status} ${n.statusText} (${Math.round(performance.now()-i)}ms)`),V(`fetch response: ${r.slice(0,500)||"<empty>"}`)}catch(t){let e=t instanceof Error?t:Error(String(t));V(`fetch /api/health: FAILED ${e.name}: ${e.message} (${Math.round(performance.now()-i)}ms)`)}V(`websocket: ${n.toString()}`),await new Promise(e=>{let t=performance.now(),a=!1,i=(n,i)=>{if(!a){a=!0,V(`${n} (${Math.round(performance.now()-t)}ms)`);try{i?.close()}catch{}e()}};try{let e=new WebSocket(n.toString()),t=window.setTimeout(()=>i("websocket: TIMEOUT",e),1e4);e.onopen=()=>{window.clearTimeout(t),i("websocket: OPEN",e)},e.onerror=()=>{window.clearTimeout(t),i("websocket: ERROR",e)},e.onclose=a=>{window.clearTimeout(t),i(`websocket: CLOSE code=${a.code} reason=${a.reason||"<empty>"}`,e)}}catch(t){let e=t instanceof Error?t:Error(String(t));i(`websocket: FAILED ${e.name}: ${e.message}`)}})};return(0,t.jsx)(n.Dialog,{open:e,onOpenChange:e=>{h(e),e||H()},children:(0,t.jsxs)(n.DialogContent,{className:"max-w-md",children:[(0,t.jsxs)(n.DialogHeader,{children:[(0,t.jsx)(n.DialogTitle,{children:j("server.manageServers")}),(0,t.jsx)(n.DialogDescription,{children:j("server.manageDescription")})]}),(0,t.jsx)("div",{className:"space-y-1",children:f.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-3 rounded-md border px-3 py-2",children:[(0,t.jsx)(d.Server,{className:"size-4 shrink-0 text-muted-foreground"}),w===e.id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.Input,{className:"h-7 text-sm flex-1",value:N,onChange:e=>k(e.target.value),placeholder:"Name",autoFocus:!0}),(0,t.jsx)(r.Input,{className:"h-7 text-sm flex-[1.5]",value:C,onChange:e=>T(e.target.value),placeholder:"http://...",onKeyDown:e=>"Enter"===e.key&&e.preventDefault()}),(0,t.jsx)(i.Button,{size:"sm",variant:"ghost",onClick:U,className:"h-7 px-2",children:b("save")}),(0,t.jsx)(i.Button,{size:"sm",variant:"ghost",onClick:H,className:"h-7 px-2",children:b("cancel")})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0 cursor-pointer",onClick:()=>{e.id!==g&&y(e)},children:[(0,t.jsx)("div",{className:"text-sm font-medium truncate",children:e.name}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:e.url})]}),e.id===g?(0,t.jsx)(o.Check,{className:"size-4 shrink-0 text-primary"}):(0,t.jsx)(i.Button,{size:"sm",variant:"ghost",onClick:()=>y(e),className:"h-7 px-2 text-xs shrink-0",children:j("server.switch")}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p,{className:"size-3.5 shrink-0 text-muted-foreground cursor-pointer hover:text-foreground",onClick:()=>_(e)}),(0,t.jsx)(l.Pencil,{className:"size-3.5 shrink-0 text-muted-foreground cursor-pointer hover:text-foreground",onClick:()=>{S(e.id),k(e.name),T(e.url),R(e.secret||"")}}),"default"!==e.id&&(0,t.jsx)(u.Trash2,{className:"size-3.5 shrink-0 text-muted-foreground cursor-pointer hover:text-destructive",onClick:()=>v(e.id)})]})]})]},e.id))}),null===w&&(0,t.jsxs)("div",{className:"border-t pt-3 mt-2 space-y-2",children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground mb-2",children:j("server.newServer")}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(r.Input,{className:"h-8 text-sm",value:D,onChange:e=>M(e.target.value),placeholder:"Name"}),(0,t.jsx)(i.Button,{size:"sm",onClick:()=>{if(!D.trim()||!E.trim())return;let e=E.trim().replace(/\/$/,"");/^https?:\/\//.test(e)||(e="http://"+e),x([...f,{id:Date.now().toString(),name:D.trim(),url:e,secret:z.trim()||void 0}]),M(""),O(""),F("")},disabled:!D.trim()||!E.trim(),children:(0,t.jsx)(c.Plus,{className:"size-4"})})]}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(r.Input,{className:"h-8 text-sm flex-1",value:E,onChange:e=>O(e.target.value),placeholder:"http://..."})}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(r.Input,{className:"h-8 text-sm flex-1",type:"password",value:z,onChange:e=>F(e.target.value),placeholder:j("server.secretOptionalPlaceholder"),onKeyDown:e=>"Enter"===e.key&&e.preventDefault()})})]}),L&&(0,t.jsx)(n.Dialog,{open:L,onOpenChange:B,children:(0,t.jsxs)(n.DialogContent,{className:"max-w-md",children:[(0,t.jsxs)(n.DialogHeader,{children:[(0,t.jsx)(n.DialogTitle,{children:"Network diagnostics"}),(0,t.jsx)(n.DialogDescription,{children:$})]}),(0,t.jsx)(s.Textarea,{readOnly:!0,value:I||"Running...",className:"h-64 resize-none font-mono text-[11px]"})]})})]})})}],894920)},100559,e=>{"use strict";let t=(0,e.i(433721).default)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);e.s(["Server",0,t],100559)},757106,e=>{"use strict";let t=(0,e.i(433721).default)("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]);e.s(["default",0,t])},990336,e=>{"use strict";var t=e.i(757106);e.s(["Brain",()=>t.default])},549705,e=>{"use strict";var t=e.i(344180),a=e.i(764556),n=e.i(244073),i=e.i(209988),r=e.i(260218),s=e.i(681622),o=e.i(562918),l=e.i(767467),c=e.i(100559),d=e.i(953700),u=e.i(137340),p=e.i(990336),m=e.i(307858),h=e.i(368942);let f={vision:"bg-blue-500/10 text-blue-600 border-blue-200",reasoning:"bg-purple-500/10 text-purple-600 border-purple-200",embedding:"bg-green-500/10 text-green-600 border-green-200"};function g({providers:e,providerModels:a,onEdit:i,onDelete:s,onAddModel:l}){let d=(0,n.useTranslations)("providers");return(0,t.jsxs)("div",{className:"flex flex-col p-2",children:[e.map(e=>{let n=a.find(t=>t.id===e.id),h=n?.models??[];return(0,t.jsxs)("div",{className:"group rounded-lg px-3 py-2.5 hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>i(e),children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex size-8 items-center justify-center rounded-lg bg-primary/10",children:(0,t.jsx)(c.Server,{className:"size-4 text-primary"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:e.name}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:e.apiBase||d("list.noApiBase")})]}),(0,t.jsxs)(o.Badge,{variant:"outline",className:"text-[10px] h-4 px-1.5",children:[h.length," ",d("list.modelsCount")]}),(0,t.jsx)(r.Button,{variant:"ghost",size:"icon-xs",className:"opacity-0 group-hover:opacity-100 transition-opacity",onClick:t=>{t.stopPropagation(),s(e.id)},children:(0,t.jsx)(u.Trash2,{className:"size-3 text-destructive"})})]}),h.length>0&&(0,t.jsx)("div",{className:"mt-2 ml-11 flex flex-wrap gap-1",children:h.map(e=>(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-[11px] text-muted-foreground",children:[(0,t.jsx)(p.Brain,{className:"size-3"}),e.name,["vision","reasoning","embedding"].map(a=>e[a]?(0,t.jsx)("span",{className:`inline-block rounded px-1 text-[9px] font-medium border ${f[a]}`,children:a[0].toUpperCase()},a):null)]},e.id))}),(0,t.jsxs)(r.Button,{variant:"ghost",size:"xs",className:"mt-1 ml-11 h-6 text-[11px] text-muted-foreground",onClick:t=>{t.stopPropagation(),l(e.name)},children:[(0,t.jsx)(m.ExternalLink,{className:"size-3"}),d("list.addModel")]})]},e.id)}),0===e.length&&(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[(0,t.jsx)(c.Server,{className:"size-10 mb-2 opacity-30"}),(0,t.jsx)("p",{className:"text-sm",children:d("list.empty")})]})]})}function x({draft:e,onChange:a}){let i=(0,n.useTranslations)("providers");return(0,t.jsx)("div",{className:"flex flex-col gap-5 p-5",children:(0,t.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:i("form.connection")}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:i("form.name")}),(0,t.jsx)(s.Input,{value:e.name||"",onChange:e=>a("name",e.target.value),placeholder:i("form.namePlaceholder")})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:i("form.apiBase")}),(0,t.jsx)(s.Input,{value:e.apiBase||"",onChange:e=>a("apiBase",e.target.value),placeholder:i("form.apiBasePlaceholder")})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:i("form.apiKey")}),(0,t.jsx)(s.Input,{type:"password",value:e.apiKey||"",onChange:e=>a("apiKey",e.target.value),placeholder:i("form.apiKeyPlaceholder")})]})]})})}e.s(["ProvidersDialog",0,function({open:e,onOpenChange:s,onAddModel:o,standalone:c}){let u=(0,n.useTranslations)("providers"),p=(0,n.useTranslations)("common"),{models:m,providers:f,ensure:v,addProvider:y,updateProvider:j,removeProvider:b}=(0,h.useLLMStore)(),[w,S]=(0,a.useState)(null),[N,k]=(0,a.useState)(null),[C,T]=(0,a.useState)(!1),[P,R]=(0,a.useState)(!1),[D,M]=(0,a.useState)(null);(0,a.useEffect)(()=>{e&&(T(!0),M(null),v().finally(()=>T(!1)))},[e,v]);let E=()=>{S(null),k(null)},O=()=>{S(null),k({name:"",apiBase:"",apiKey:""})},z=async()=>{if(N&&N.name){R(!0),M(null);try{let e=!w,t=await fetch(e?"/api/providers":`/api/providers/${w.id}`,{method:e?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(N)});if(!t.ok)throw Error();let a=await t.json();e?y(a):j(a),E()}catch{M(u("error.saveFailed"))}finally{R(!1)}}},F=async e=>{if(confirm(u("confirm.delete"))){R(!0);try{if(!(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok)throw Error();b(e),w?.id===e&&E()}catch{M(u("error.deleteFailed"))}finally{R(!1)}}},I=(0,t.jsxs)(t.Fragment,{children:[!c&&(0,t.jsxs)("div",{className:"flex items-center gap-3 border-b px-5 py-4",children:[N&&(0,t.jsx)(r.Button,{variant:"ghost",size:"icon-sm",onClick:E,children:(0,t.jsx)(l.ArrowLeft,{className:"size-4"})}),(0,t.jsxs)(i.DialogHeader,{className:"flex-1 space-y-0",children:[(0,t.jsx)(i.DialogTitle,{className:"text-base",children:N?w?u("dialog.editTitle"):u("dialog.addTitle"):u("dialog.title")}),(0,t.jsx)(i.DialogDescription,{className:"text-xs",children:N?u("dialog.editDescription"):u("dialog.listDescription")})]}),!N&&(0,t.jsxs)(r.Button,{variant:"outline",size:"sm",onClick:O,className:"mr-6",children:[(0,t.jsx)(d.Plus,{className:"size-3.5"}),u("dialog.add")]})]}),c&&!N&&(0,t.jsx)("div",{className:"flex items-center justify-end px-5 py-3 border-b",children:(0,t.jsxs)(r.Button,{variant:"outline",size:"sm",onClick:O,children:[(0,t.jsx)(d.Plus,{className:"size-3.5"}),u("dialog.add")]})}),c&&N&&(0,t.jsxs)("div",{className:"flex items-center gap-3 px-5 py-3 border-b",children:[(0,t.jsx)(r.Button,{variant:"ghost",size:"icon-sm",onClick:E,children:(0,t.jsx)(l.ArrowLeft,{className:"size-4"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("h2",{className:"text-base font-medium truncate",children:w?u("dialog.editTitle"):u("dialog.addTitle")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:u("dialog.editDescription")})]})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[D&&(0,t.jsx)("div",{className:"mx-5 mt-4 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:D}),C?(0,t.jsx)("div",{className:"py-12 text-center text-sm text-muted-foreground",children:u("dialog.loading")}):N?(0,t.jsx)(x,{draft:N,onChange:(e,t)=>{k(a=>a?{...a,[e]:t}:a)}}):(0,t.jsx)(g,{providers:f,providerModels:f.map(e=>{let t;return{id:e.id,models:(t=e.name,m.filter(e=>e.provider===t))}}),onEdit:e=>{S(e),k({...e})},onDelete:F,onAddModel:e=>{c||s(!1),o(e)}})]}),N&&(0,t.jsxs)("div",{className:"flex justify-end gap-2 border-t px-5 py-3",children:[(0,t.jsx)(r.Button,{variant:"outline",size:"sm",onClick:E,disabled:P,children:p("cancel")}),(0,t.jsx)(r.Button,{size:"sm",onClick:z,disabled:P||!N.name,children:p(P?"saving":"save")})]})]});return c?(0,t.jsx)("div",{className:"h-full flex flex-col",children:I}):(0,t.jsx)(i.Dialog,{open:e,onOpenChange:e=>{e||E(),s(e)},children:(0,t.jsx)(i.DialogContent,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 gap-0",children:I})})}])},841734,e=>{"use strict";var t=e.i(344180),a=e.i(764556),n=e.i(244073),i=e.i(887836),r=e.i(916950),s=e.i(209988),o=e.i(260218),l=e.i(681622),c=e.i(191118),d=e.i(239340),u=e.i(460578),p=e.i(996652),m=e.i(917955),h=e.i(887354),f=e.i(401058),g=e.i(137340),x=e.i(953700),v=e.i(962562),y=e.i(129981),j=e.i(193251),b=e.i(977694),w=e.i(513501),S=e.i(989484);let N=(0,i.default)(()=>e.A(863812).then(e=>e.default),{loadableGenerated:{modules:[158480]},ssr:!1,loading:()=>(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading editor..."})});e.s(["OutputStylesDialog",0,function({open:e,onOpenChange:i,standalone:k}){let C=(0,n.useTranslations)("outputStyles"),T=(0,n.useTranslations)("common"),[P,R]=(0,a.useState)("local"),[D,M]=(0,a.useState)([]),[E,O]=(0,a.useState)([]),[z,F]=(0,a.useState)(!1),[I,A]=(0,a.useState)(""),[L,B]=(0,a.useState)([]),[$,W]=(0,a.useState)(!1),[H,U]=(0,a.useState)(new Set),[V,_]=(0,a.useState)(!1),[q,J]=(0,a.useState)([]),[K,G]=(0,a.useState)(null),[X,Y]=(0,a.useState)(!1),[Q,Z]=(0,a.useState)(""),[ee,et]=(0,a.useState)(""),[ea,en]=(0,a.useState)(""),[ei,er]=(0,a.useState)(!1),[es,eo]=(0,a.useState)(null),[el,ec]=(0,a.useState)([]),[ed,eu]=(0,a.useState)(!1),ep=(0,a.useCallback)(async()=>{F(!0);try{let e=await fetch("/api/output-styles");e.ok&&M(await e.json())}catch{}F(!1)},[]),em=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/output-styles/agents");e.ok&&O(await e.json())}catch{}},[]),eh=(0,a.useCallback)(async()=>{W(!0);try{let e=await (0,r.fetchStoreIndex)("output-styles/index.json");B(e)}catch{}W(!1)},[]);(0,a.useEffect)(()=>{(e||k)&&(ep(),em(),eh())},[e,k,ep,em,eh]);let ef=new Set(D.filter(e=>e.storeId).map(e=>e.storeId));function eg(e){let t=e.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/);if(!t)return{content:e};let a=t[1],n=e.slice(t[0].length),i=a.match(/^name:\s*(.+)$/m),r=a.match(/^description:\s*(.+)$/m);return{name:i?.[1]?.trim(),description:r?.[1]?.trim(),content:n}}let ex=async()=>{if(0!==q.length){if(1===q.length){let e=await q[0].file.text(),t=eg(e),a=t.name||q[0].file.name.replace(/\.(md|txt|markdown)$/i,"");J([]),_(!1),G(null),Y(!0),Z(a),et(t.description||""),en(t.content||e);return}for(let e of q){let t=await e.file.text(),a=eg(t),n=a.name||e.file.name.replace(/\.(md|txt|markdown)$/i,"");await fetch("/api/output-styles",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:n,content:a.content||t,description:a.description})})}J([]),_(!1),ep()}},ev=async e=>{if(!(ef.has(e.id)||H.has(e.id))){U(t=>new Set(t).add(e.id));try{let t=await fetch(`/public/output-styles/${e.filename}`);if(!t.ok)return;let a=await t.text(),n=eg(a),i=await fetch("/api/output-styles",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,content:n.content||a,storeId:e.id,description:n.description})});if(i.ok){let e=await i.json();M(t=>[...t,e])}}catch{}U(t=>{let a=new Set(t);return a.delete(e.id),a})}},ey=()=>{G(null),Y(!1),Z(""),et(""),en("")},ej=async()=>{if(Q.trim()&&ea.trim()){er(!0);try{let e=K?`/api/output-styles/${K.id}`:"/api/output-styles",t=K?"PUT":"POST",a=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify({name:Q,content:ea,description:ee||void 0})});if(a.ok){let e=await a.json();M(t=>K?t.map(t=>t.id===e.id?e:t):[...t,e]),ey()}}catch{}er(!1)}},eb=async e=>{try{(await fetch(`/api/output-styles/${e.id}`,{method:"DELETE"})).ok&&M(t=>t.filter(t=>t.id!==e.id))}catch{}},ew=async()=>{if(es&&0!==el.length){eu(!0);try{await fetch(`/api/output-styles/${es.id}/apply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentIds:el})}),eo(null)}catch{}eu(!1)}},eS=D.filter(e=>{if(!I)return!0;let t=I.toLowerCase();return e.name.toLowerCase().includes(t)||e.content.toLowerCase().includes(t)}),eN=L.filter(e=>{if(!I)return!0;let t=I.toLowerCase();return e.name.toLowerCase().includes(t)||e.id.toLowerCase().includes(t)}),ek=(k||e)&&!es&&!K&&!X,eC=(0,t.jsx)("div",{className:"flex items-center gap-1 border-b border-border px-1",children:[["local",S.FileText,C("tabLocal")],["store",w.Store,C("tabStore")]].map(([e,a,n])=>(0,t.jsxs)("button",{onClick:()=>R(e),className:`flex items-center gap-1.5 px-3 py-2 text-sm font-medium border-b-2 transition-colors ${P===e?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[(0,t.jsx)(a,{className:"size-3.5"}),n]},e))}),eT=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 ml-auto shrink-0 pt-2",children:[(0,t.jsxs)(p.Popover,{open:V,onOpenChange:_,children:[(0,t.jsx)(p.PopoverTrigger,{render:(0,t.jsxs)(o.Button,{variant:"outline",size:"sm",children:[(0,t.jsx)(y.Upload,{className:"size-3.5 mr-1"}),C("import")]})}),(0,t.jsx)(p.PopoverContent,{className:"w-80",align:"end",children:(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:C("importTitle")}),(0,t.jsx)(u.FileUpload,{value:q,onChange:J,accept:{"text/markdown":[".md",".txt"],"":[".md",".txt"]},placeholder:C("importPlaceholder"),maxFiles:10}),(0,t.jsx)(o.Button,{size:"sm",onClick:ex,disabled:0===q.length,className:"w-full",children:C("importConfirm")})]})})]}),(0,t.jsxs)(o.Button,{variant:"outline",size:"sm",onClick:()=>{G(null),Y(!0),Z(""),et(""),en("")},children:[(0,t.jsx)(x.Plus,{className:"size-3.5 mr-1"}),C("create")]})]}),(0,t.jsx)(c.ScrollArea,{className:"flex-1",children:z?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:T("loading")}):0===eS.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:C("empty")}):(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 pr-2",children:eS.map(e=>(0,t.jsx)("div",{className:"rounded-xl border border-border bg-background p-4 hover:bg-accent/30 transition-colors cursor-pointer",onClick:()=>{G(e),Y(!1),Z(e.name),et(e.description||""),en(e.content)},children:(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,t.jsx)(v.Pencil,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"font-medium text-sm truncate",children:e.name})]}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(o.Button,{variant:"outline",size:"sm",className:"h-6 px-1.5 text-xs",onClick:()=>{eo(e),ec([])},children:[(0,t.jsx)(b.Rocket,{className:"size-3 mr-0.5"}),C("apply")]}),(0,t.jsxs)(m.DropdownMenu,{children:[(0,t.jsx)(m.DropdownMenuTrigger,{render:(0,t.jsx)(o.Button,{variant:"ghost",size:"icon",className:"size-6"}),children:(0,t.jsx)(f.MoreVertical,{className:"size-3"})}),(0,t.jsx)(m.DropdownMenuContent,{align:"end",children:(0,t.jsxs)(m.DropdownMenuItem,{className:"text-destructive focus:text-destructive",onClick:()=>eb(e),children:[(0,t.jsx)(g.Trash2,{className:"size-3 mr-1.5"}),C("delete")]})})]})]})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-3",children:e.description||e.content.slice(0,200)})]})},e.id))})})]}),eP=(0,t.jsx)(c.ScrollArea,{className:"flex-1",children:$?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:T("loading")}):0===eN.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:C("storeEmpty")}):(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 pr-2",children:eN.map(e=>{let a=ef.has(e.id),n=H.has(e.id);return(0,t.jsx)("div",{className:"rounded-xl border border-border bg-background p-4 hover:bg-accent/30 transition-colors",children:(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,t.jsx)(w.Store,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"font-medium text-sm truncate",children:e.name})]}),(0,t.jsx)(o.Button,{variant:a?"ghost":"outline",size:"sm",className:"h-6 px-1.5 text-xs shrink-0",disabled:a||n,onClick:()=>ev(e),children:a?(0,t.jsx)(t.Fragment,{children:C("imported")}):n?(0,t.jsx)(t.Fragment,{children:C("importing")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.Download,{className:"size-3 mr-0.5"}),C("importTo")]})})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:e.id})]})},e.id)})})}),eR=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.DialogHeader,{children:(0,t.jsx)("div",{className:"flex items-center justify-between pr-8",children:(0,t.jsxs)("div",{className:"hidden md:block",children:[k?(0,t.jsx)("h2",{className:"text-base font-semibold",children:C("title")}):(0,t.jsx)(s.DialogTitle,{children:C("title")}),k?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:C("description")}):(0,t.jsx)(s.DialogDescription,{children:C("description")})]})})}),eC,(0,t.jsx)("div",{className:"flex flex-1 min-h-0 gap-4 pt-2",children:(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(h.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(l.Input,{value:I,onChange:e=>A(e.target.value),placeholder:C("search"),className:"pl-8"})]}),"local"===P?eT:eP]})})]});return(0,t.jsxs)(t.Fragment,{children:[k&&ek&&(0,t.jsx)("div",{className:"h-full flex flex-col",children:eR}),!k&&(0,t.jsx)(s.Dialog,{open:ek,onOpenChange:i,children:(0,t.jsx)(s.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:eR})}),(0,t.jsx)(s.Dialog,{open:!!K||X,onOpenChange:e=>{e||ey()},children:(0,t.jsxs)(s.DialogContent,{className:"sm:max-w-2xl h-[80vh] flex flex-col",children:[(0,t.jsxs)(s.DialogHeader,{children:[(0,t.jsx)(s.DialogTitle,{children:K?C("editTitle",{name:K.name}):C("createTitle")}),(0,t.jsx)(s.DialogDescription,{children:C("editDescription")})]}),(0,t.jsx)(l.Input,{value:Q,onChange:e=>Z(e.target.value),placeholder:C("namePlaceholder")}),(0,t.jsx)(l.Input,{value:ee,onChange:e=>et(e.target.value),placeholder:C("descriptionPlaceholder")}),(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden rounded-md border border-border",children:(0,t.jsx)(N,{height:"100%",language:"markdown",value:ea,onChange:e=>en(e||""),theme:"vs-dark",options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,padding:{top:8},renderLineHighlight:"gutter",wordWrap:"on"}})}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,t.jsx)(o.Button,{variant:"outline",onClick:ey,disabled:ei,children:T("cancel")}),(0,t.jsx)(o.Button,{onClick:ej,disabled:ei||!Q.trim()||!ea.trim(),children:T(ei?"saving":"save")})]})]})}),(0,t.jsx)(d.AgentPickerDialog,{open:!!es,onClose:()=>eo(null),onConfirm:ew,title:C("applyTitle",{name:es?.name||""}),description:C("applyDescription"),agents:E.map(e=>({id:e.id,name:e.name,avatarUrl:e.avatarUrl,description:e.description})),selected:el,onToggle:e=>ec(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),cancelText:T("cancel"),confirmText:C("applyConfirm",{count:el.length}),loading:ed})]})}])},756638,e=>{"use strict";var t=e.i(344180),a=e.i(764556),n=e.i(244073),i=e.i(887836),r=e.i(916950),s=e.i(209988),o=e.i(260218),l=e.i(681622),c=e.i(191118),d=e.i(239340),u=e.i(460578),p=e.i(996652),m=e.i(917955),h=e.i(887354),f=e.i(401058),g=e.i(137340),x=e.i(977694),v=e.i(111343),y=e.i(953700),j=e.i(426022),b=e.i(129981),w=e.i(193251),S=e.i(513501),N=e.i(989484);let k=(0,i.default)(()=>e.A(863812).then(e=>e.default),{loadableGenerated:{modules:[158480]},ssr:!1,loading:()=>(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading editor..."})});e.s(["PromptsDialog",0,function({open:e,onOpenChange:i,standalone:C}){let T=(0,n.useTranslations)("prompts"),P=(0,n.useTranslations)("common"),[R,D]=(0,a.useState)("local"),[M,E]=(0,a.useState)([]),[O,z]=(0,a.useState)([]),[F,I]=(0,a.useState)(!1),[A,L]=(0,a.useState)(""),[B,$]=(0,a.useState)([]),[W,H]=(0,a.useState)(!1),[U,V]=(0,a.useState)(new Set),[_,q]=(0,a.useState)(!1),[J,K]=(0,a.useState)([]),[G,X]=(0,a.useState)(null),[Y,Q]=(0,a.useState)([]),[Z,ee]=(0,a.useState)(!1),[et,ea]=(0,a.useState)(null),[en,ei]=(0,a.useState)(!1),[er,es]=(0,a.useState)(""),[eo,el]=(0,a.useState)(""),[ec,ed]=(0,a.useState)(!1),eu=(0,a.useCallback)(async()=>{I(!0);try{let e=await fetch("/api/prompt-templates");e.ok&&E(await e.json())}catch{}I(!1)},[]),ep=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/prompt-templates/agents");e.ok&&z(await e.json())}catch{}},[]),em=(0,a.useCallback)(async()=>{H(!0);try{let e=await (0,r.fetchStoreIndex)("prompt/index.json");$(e)}catch{}H(!1)},[]);(0,a.useEffect)(()=>{(e||C)&&(eu(),ep(),em())},[e,C,eu,ep,em]);let eh=new Set(M.filter(e=>e.storeId).map(e=>e.storeId)),ef=async()=>{if(0!==J.length){if(1===J.length){let e=await J[0].file.text(),t=J[0].file.name.replace(/\.(md|txt|markdown)$/i,"");K([]),q(!1),ea(null),ei(!0),es(t),el(e);return}for(let e of J){let t=await e.file.text(),a=e.file.name.replace(/\.(md|txt|markdown)$/i,"");await fetch("/api/prompt-templates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a,content:t})})}K([]),q(!1),eu()}},eg=async e=>{if(!(eh.has(e.id)||U.has(e.id))){V(t=>new Set(t).add(e.id));try{let t=await fetch(`/public/prompt/${e.filename}`);if(!t.ok)return;let a=await t.text(),n=await fetch("/api/prompt-templates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,content:a,storeId:e.id})});if(n.ok){let e=await n.json();E(t=>[...t,e])}}catch{}V(t=>{let a=new Set(t);return a.delete(e.id),a})}},ex=()=>{ea(null),ei(!1),es(""),el("")},ev=async()=>{if(er.trim()&&eo.trim()){ed(!0);try{if(et){let e=await fetch(`/api/prompt-templates/${et.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:er,content:eo})});if(e.ok){let t=await e.json();E(e=>e.map(e=>e.id===t.id?t:e)),ex()}}else{let e=await fetch("/api/prompt-templates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:er,content:eo})});if(e.ok){let t=await e.json();E(e=>[...e,t]),ex()}}}catch{}ed(!1)}},ey=async e=>{try{(await fetch(`/api/prompt-templates/${e.id}`,{method:"DELETE"})).ok&&E(t=>t.filter(t=>t.id!==e.id))}catch{}},ej=async()=>{if(G&&0!==Y.length){ee(!0);try{await fetch(`/api/prompt-templates/${G.id}/apply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentIds:Y})}),X(null)}catch{}ee(!1)}},eb=M.filter(e=>{if(!A)return!0;let t=A.toLowerCase();return e.name.toLowerCase().includes(t)||e.content.toLowerCase().includes(t)}),ew=B.filter(e=>{if(!A)return!0;let t=A.toLowerCase();return e.name.toLowerCase().includes(t)||e.id.toLowerCase().includes(t)}),eS=(C||e)&&!G&&!et&&!en,eN=O.map(e=>({id:e.id,name:e.name,avatarUrl:e.avatarUrl,description:e.description})),ek=(0,t.jsx)("div",{className:"flex items-center gap-1 border-b border-border px-1",children:[["local",N.FileText,T("tabLocal")],["store",S.Store,T("tabStore")]].map(([e,a,n])=>(0,t.jsxs)("button",{onClick:()=>D(e),className:`flex items-center gap-1.5 px-3 py-2 text-sm font-medium border-b-2 transition-colors ${R===e?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[(0,t.jsx)(a,{className:"size-3.5"}),n]},e))}),eC=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 ml-auto shrink-0 pt-2",children:[(0,t.jsxs)(p.Popover,{open:_,onOpenChange:q,children:[(0,t.jsx)(p.PopoverTrigger,{render:(0,t.jsxs)(o.Button,{variant:"outline",size:"sm",children:[(0,t.jsx)(b.Upload,{className:"size-3.5 mr-1"}),T("import")]})}),(0,t.jsx)(p.PopoverContent,{className:"w-80",align:"end",children:(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:T("importTitle")}),(0,t.jsx)(u.FileUpload,{value:J,onChange:K,accept:{"text/markdown":[".md",".txt"],"":[".md",".txt"]},placeholder:T("importPlaceholder"),maxFiles:10}),(0,t.jsx)(o.Button,{size:"sm",onClick:ef,disabled:0===J.length,className:"w-full",children:T("importConfirm")})]})})]}),(0,t.jsxs)(o.Button,{variant:"outline",size:"sm",onClick:()=>{ea(null),ei(!0),es(""),el("")},children:[(0,t.jsx)(y.Plus,{className:"size-3.5 mr-1"}),T("create")]})]}),(0,t.jsx)(c.ScrollArea,{className:"flex-1",children:F?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:P("loading")}):0===eb.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:T("empty")}):(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 pr-2",children:eb.map(e=>(0,t.jsx)("div",{className:"rounded-xl border border-border bg-background p-4 hover:bg-accent/30 transition-colors cursor-pointer",onClick:()=>{ea(e),ei(!1),es(e.name),el(e.content)},children:(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,t.jsx)(j.MessageSquare,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"font-medium text-sm truncate",children:e.name})]}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(o.Button,{variant:"outline",size:"sm",className:"h-6 px-1.5 text-xs",onClick:()=>{X(e),Q([])},children:[(0,t.jsx)(x.Rocket,{className:"size-3 mr-0.5"}),T("apply")]}),(0,t.jsxs)(m.DropdownMenu,{children:[(0,t.jsx)(m.DropdownMenuTrigger,{render:(0,t.jsx)(o.Button,{variant:"ghost",size:"icon",className:"size-6"}),children:(0,t.jsx)(f.MoreVertical,{className:"size-3"})}),(0,t.jsx)(m.DropdownMenuContent,{align:"end",children:(0,t.jsxs)(m.DropdownMenuItem,{className:"text-destructive focus:text-destructive",onClick:()=>ey(e),children:[(0,t.jsx)(g.Trash2,{className:"size-3 mr-1.5"}),T("delete")]})})]})]})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-3",children:e.content.slice(0,200).replace(/^#\s+/,"")})]})},e.id))})})]}),eT=(0,t.jsx)(c.ScrollArea,{className:"flex-1",children:W?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:P("loading")}):0===ew.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:T("storeEmpty")}):(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 pr-2",children:ew.map(e=>{let a=eh.has(e.id),n=U.has(e.id);return(0,t.jsx)("div",{className:"rounded-xl border border-border bg-background p-4 hover:bg-accent/30 transition-colors",children:(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,t.jsx)(S.Store,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"font-medium text-sm truncate",children:e.name})]}),(0,t.jsx)(o.Button,{variant:a?"ghost":"outline",size:"sm",className:"h-6 px-1.5 text-xs shrink-0",disabled:a||n,onClick:()=>eg(e),children:a?(0,t.jsx)(t.Fragment,{children:T("imported")}):n?(0,t.jsx)(t.Fragment,{children:T("importing")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(w.Download,{className:"size-3 mr-0.5"}),T("importTo")]})})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:e.id})]})},e.id)})})}),eP=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.DialogHeader,{children:(0,t.jsx)("div",{className:"flex items-center justify-between pr-8",children:(0,t.jsxs)("div",{className:"hidden md:block",children:[C?(0,t.jsx)("h2",{className:"text-base font-semibold",children:T("title")}):(0,t.jsx)(s.DialogTitle,{children:T("title")}),C?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:T("description")}):(0,t.jsx)(s.DialogDescription,{children:T("description")})]})})}),ek,(0,t.jsx)("div",{className:"flex flex-1 min-h-0 gap-4 pt-2",children:(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(h.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(l.Input,{value:A,onChange:e=>L(e.target.value),placeholder:T("search"),className:"pl-8"})]}),"local"===R?eC:eT]})})]});return(0,t.jsxs)(t.Fragment,{children:[C&&eS&&(0,t.jsx)("div",{className:"h-full flex flex-col",children:eP}),!C&&(0,t.jsx)(s.Dialog,{open:eS,onOpenChange:i,children:(0,t.jsx)(s.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:eP})}),(0,t.jsx)(s.Dialog,{open:!!et||en,onOpenChange:e=>{e||ex()},children:(0,t.jsxs)(s.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:[(0,t.jsx)(s.DialogHeader,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between pr-8",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(s.DialogTitle,{children:et?T("editTitle",{name:et.name}):T("createTitle")}),(0,t.jsx)(s.DialogDescription,{children:T("editDescription")})]}),(0,t.jsxs)(o.Button,{size:"sm",onClick:ev,disabled:ec||!er.trim()||!eo.trim(),children:[(0,t.jsx)(v.Save,{className:"size-3.5 mr-1"}),P("save")]})]})}),(0,t.jsx)("div",{className:"space-y-3 pb-2",children:(0,t.jsx)(l.Input,{value:er,onChange:e=>es(e.target.value),placeholder:T("namePlaceholder")})}),(0,t.jsx)("div",{className:"flex-1 min-h-0",children:(0,t.jsx)(k,{height:"100%",language:"markdown",value:eo,onChange:e=>el(e||""),theme:"vs-dark",options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,padding:{top:8},renderLineHighlight:"gutter",wordWrap:"on"}})})]})}),(0,t.jsx)(d.AgentPickerDialog,{open:!!G,onClose:()=>X(null),onConfirm:ej,title:T("applyTitle",{name:G?.name||""}),description:T("applyDescription"),agents:eN,selected:Y,onToggle:e=>Q(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),cancelText:P("cancel"),confirmText:T("applyConfirm",{count:Y.length}),loading:Z})]})}])},255742,e=>{"use strict";let t=(0,e.i(433721).default)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);e.s(["Star",0,t],255742)},111343,e=>{"use strict";let t=(0,e.i(433721).default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);e.s(["Save",0,t],111343)},239340,e=>{"use strict";var t=e.i(344180),a=e.i(209988),n=e.i(260218),i=e.i(611176),r=e.i(972846),s=e.i(465458);e.s(["AgentPickerDialog",0,function({open:e,onClose:o,onConfirm:l,title:c,description:d,agents:u,selected:p,onToggle:m,cancelText:h,confirmText:f,loading:g}){return(0,t.jsx)(a.Dialog,{open:e,onOpenChange:e=>{e||o()},children:(0,t.jsxs)(a.DialogContent,{className:"sm:max-w-sm flex flex-col gap-0 overflow-hidden p-0",children:[(0,t.jsxs)(a.DialogHeader,{className:"shrink-0 px-6 py-4",children:[(0,t.jsx)(a.DialogTitle,{children:c}),d&&(0,t.jsx)(a.DialogDescription,{children:d})]}),(0,t.jsxs)("div",{className:"min-h-0 flex-1 pb-2 overflow-y-auto px-6 space-y-3",children:[(0,t.jsx)("div",{className:"space-y-0.5",children:u.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>m(e.id),className:"flex items-center gap-2 w-full px-2 py-1.5 rounded-md hover:bg-muted text-left text-sm transition-colors",children:[(0,t.jsx)(i.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-5 rounded-full"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"block truncate",children:e.name}),e.description&&(0,t.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.description})]}),(0,t.jsx)("div",{className:(0,s.cn)("flex items-center justify-center size-4 rounded border shrink-0",p.includes(e.id)?"bg-primary border-primary text-primary-foreground":"border-input")})]},e.id))}),p.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:p.map(e=>{let a=u.find(t=>t.id===e);return(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md bg-muted px-2 py-0.5 text-xs max-w-[160px] min-w-0",children:[(0,t.jsx)(i.AgentIcon,{agentId:e,name:a?.name,avatarUrl:a?.avatarUrl,className:"size-3.5 rounded-full shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:a?.name||e}),(0,t.jsx)("button",{type:"button",onClick:()=>m(e),className:"hover:text-destructive shrink-0 cursor-pointer",children:(0,t.jsx)(r.X,{className:"size-3"})})]},e)})})]}),(0,t.jsxs)("div",{className:"shrink-0 flex justify-end gap-2 border-t px-6 py-4",children:[(0,t.jsx)(n.Button,{variant:"outline",onClick:o,children:h||"Cancel"}),(0,t.jsx)(n.Button,{onClick:l,disabled:g||0===p.length,children:f||"Confirm"})]})]})})}])},977694,e=>{"use strict";let t=(0,e.i(433721).default)("rocket",[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]]);e.s(["Rocket",0,t],977694)},401058,e=>{"use strict";let t=(0,e.i(433721).default)("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);e.s(["MoreVertical",0,t],401058)},973767,e=>{"use strict";let t=(0,e.i(433721).default)("star-off",[["path",{d:"m10.344 4.688 1.181-2.393a.53.53 0 0 1 .95 0l2.31 4.679a2.12 2.12 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.237 3.152",key:"19ctli"}],["path",{d:"m17.945 17.945.43 2.505a.53.53 0 0 1-.771.56l-4.618-2.428a2.12 2.12 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a8 8 0 0 0 .4-.099",key:"ptqqvy"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);e.s(["StarOff",0,t],973767)},191202,e=>{"use strict";let t=(0,e.i(433721).default)("plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]]);e.s(["Plug",0,t],191202)},22906,e=>{"use strict";var t=e.i(344180),a=e.i(764556),n=e.i(244073),i=e.i(887836),r=e.i(209988),s=e.i(260218),o=e.i(681622),l=e.i(788010),c=e.i(191118),d=e.i(917955),u=e.i(996652),p=e.i(188815),m=e.i(611176),h=e.i(239340),f=e.i(255742),g=e.i(973767),x=e.i(129981),v=e.i(887354),y=e.i(191202),j=e.i(401058),b=e.i(137340),w=e.i(977694),S=e.i(111343),N=e.i(465458);e.i(462506);let k=(0,i.default)(()=>e.A(863812).then(e=>e.default),{loadableGenerated:{modules:[158480]},ssr:!1,loading:()=>(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading editor..."})});e.s(["McpsDialog",0,function({open:e,onOpenChange:i,standalone:C}){let T=(0,n.useTranslations)("mcps"),P=(0,n.useTranslations)("common"),[R,D]=(0,a.useState)([]),[M,E]=(0,a.useState)([]),[O,z]=(0,a.useState)(!1),[F,I]=(0,a.useState)(""),[A,L]=(0,a.useState)("all"),[B,$]=(0,a.useState)(""),[W,H]=(0,a.useState)(!1),[U,V]=(0,a.useState)(""),[_,q]=(0,a.useState)(""),[J,K]=(0,a.useState)(null),[G,X]=(0,a.useState)([]),[Y,Q]=(0,a.useState)(null),[Z,ee]=(0,a.useState)(""),et=(0,a.useCallback)(async()=>{z(!0);try{let e=await fetch("/api/mcps");e.ok&&D(await e.json())}catch{}z(!1)},[]),ea=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/agents/presets");if(e.ok){let t=await e.json();E(t.map(e=>({id:e.id,name:e.name,avatarUrl:e.avatarUrl,description:e.description})))}}catch{}},[]);(0,a.useEffect)(()=>{(e||C)&&(et(),ea())},[e,C,et,ea]);let en=async e=>{try{let t=await fetch(`/api/mcps/${encodeURIComponent(e.name)}/favorite`,{method:"POST"});if(t.ok){let{favorited:a}=await t.json();D(t=>t.map(t=>t.name===e.name?{...t,favorited:a}:t))}}catch{}},ei=async()=>{q("");try{JSON.parse(U)}catch{q(T("importInvalidJson"));return}try{let e=await fetch("/api/mcps/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonText:U})});if(e.ok)V(""),H(!1),et();else{let t=await e.json();q(t.error||T("importFailed"))}}catch{q(T("importFailed"))}},er=async()=>{let e;if(Y){try{e=JSON.parse(Z)}catch{return}try{(await fetch(`/api/mcps/${encodeURIComponent(Y.name)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:e})})).ok&&(D(t=>t.map(t=>t.name===Y.name?{...t,config:e}:t)),Q(null))}catch{}}},es=async e=>{try{(await fetch(`/api/mcps/${encodeURIComponent(e.name)}`,{method:"DELETE"})).ok&&D(t=>t.filter(t=>t.name!==e.name))}catch{}},eo=async()=>{if(J){for(let e of M){let t=J.boundAgents.some(t=>t.id===e.id),a=G.includes(e.id);if(t&&!a){let t=await fetch(`/api/agents/presets/${e.id}`);if(!t.ok)continue;let a=await t.json(),n=a.mcps||{},i={...n.mcpServers||{}};delete i[J.name],await fetch(`/api/agents/presets/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,mcps:{...n,mcpServers:i}})})}else if(!t&&a){let t=await fetch(`/api/agents/presets/${e.id}`);if(!t.ok)continue;let a=await t.json(),n=a.mcps||{},i={...n.mcpServers||{}};J.name in i||(i[J.name]=J.config,await fetch(`/api/agents/presets/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,mcps:{...n,mcpServers:i}})}))}}K(null),et()}},el=R.filter(e=>{if(F){let t=F.toLowerCase();if(!e.name.toLowerCase().includes(t)&&!e.description.toLowerCase().includes(t))return!1}return("favorites"!==A||!!e.favorited)&&("agent"!==A||!B||!!e.boundAgents.some(e=>e.id===B))}),ec=(C||e)&&!J&&!Y,ed=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.DialogHeader,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between pr-8 pt-2",children:[(0,t.jsxs)("div",{className:"hidden md:block",children:[C?(0,t.jsx)("h2",{className:"text-base font-semibold",children:T("title")}):(0,t.jsx)(r.DialogTitle,{children:T("title")}),C?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:T("description")}):(0,t.jsx)(r.DialogDescription,{children:T("description")})]}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsxs)(u.Popover,{open:W,onOpenChange:H,children:[(0,t.jsx)(u.PopoverTrigger,{render:(0,t.jsxs)(s.Button,{variant:"outline",size:"sm",children:[(0,t.jsx)(x.Upload,{className:"size-3.5 mr-1"}),T("import")]})}),(0,t.jsx)(u.PopoverContent,{className:"w-96",align:"end",children:(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:T("importTitle")}),(0,t.jsx)(l.Textarea,{value:U,onChange:e=>{V(e.target.value),q("")},placeholder:'{\n "mcpServers": {\n "server-name": {\n "command": "npx",\n "args": ["-y", "package"],\n "env": {}\n }\n }\n}',className:"font-mono text-xs min-h-[180px] resize-none"}),_&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:_}),(0,t.jsx)(s.Button,{size:"sm",onClick:ei,disabled:!U.trim(),className:"w-full",children:T("importConfirm")})]})})]})})]})}),(0,t.jsxs)("div",{className:"flex flex-1 min-h-0 gap-4 pt-2",children:[(0,t.jsxs)("div",{className:"hidden md:flex w-44 shrink-0 flex-col gap-3",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)(s.Button,{variant:"all"===A?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{L("all"),$("")},children:[(0,t.jsx)(y.Plug,{className:"size-3.5 mr-1.5"}),T("filterAll")]}),(0,t.jsxs)(s.Button,{variant:"favorites"===A?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{L("favorites"),$("")},children:[(0,t.jsx)(f.Star,{className:"size-3.5 mr-1.5"}),T("filterFavorites")]})]}),M.length>0&&(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-muted-foreground px-2",children:T("filterByAgent")}),(0,t.jsx)(c.ScrollArea,{className:"max-h-48",children:M.map(e=>(0,t.jsxs)(s.Button,{variant:"agent"===A&&B===e.id?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{L("agent"),$(e.id)},children:[(0,t.jsx)(m.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-4 mr-1.5 rounded-full"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]},e.id))})]})]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:"flex md:hidden flex-col gap-2",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(v.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(o.Input,{value:F,onChange:e=>I(e.target.value),placeholder:T("search"),className:"pl-8"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("div",{className:"flex rounded-lg border border-input p-0.5",children:[(0,t.jsx)("button",{type:"button",className:(0,N.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors","all"===A?"bg-muted":"text-muted-foreground hover:text-foreground"),onClick:()=>{L("all"),$("")},children:T("filterAll")}),(0,t.jsxs)("button",{type:"button",className:(0,N.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors","favorites"===A?"bg-muted":"text-muted-foreground hover:text-foreground"),onClick:()=>{L("favorites"),$("")},children:[(0,t.jsx)(f.Star,{className:"size-3 inline-block mr-0.5 -mt-px"}),T("filterFavorites")]})]}),M.length>0&&(0,t.jsx)(p.SearchSelect,{value:"agent"===A?B:"",onChange:e=>{e?(L("agent"),$(e)):(L("all"),$(""))},options:M.map(e=>({value:e.id,label:e.name})),placeholder:T("filterByAgent"),allowCustom:!1,className:"flex-1 min-w-0"})]})]}),(0,t.jsxs)("div",{className:"hidden md:block relative",children:[(0,t.jsx)(v.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(o.Input,{value:F,onChange:e=>I(e.target.value),placeholder:T("search"),className:"pl-8"})]}),(0,t.jsx)(c.ScrollArea,{className:"flex-1",children:O?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:P("loading")}):0===el.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:T("empty")}):(0,t.jsx)("div",{className:"grid grid-cols-1 gap-3 pr-2",children:el.map(e=>(0,t.jsxs)("div",{className:"rounded-xl border border-border bg-background p-4 hover:bg-accent/30 transition-colors cursor-pointer",onClick:()=>{Q(e),ee(JSON.stringify(e.config,null,2))},children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(y.Plug,{className:"size-3.5 text-muted-foreground"}),(0,t.jsx)("span",{className:"font-medium text-sm",children:e.name}),(0,t.jsx)("button",{type:"button",className:"flex items-center justify-center size-5 rounded hover:bg-accent cursor-pointer",onClick:t=>{t.stopPropagation(),en(e)},children:e.favorited?(0,t.jsx)(f.Star,{className:"size-3.5 text-yellow-500 fill-yellow-500"}):(0,t.jsx)(g.StarOff,{className:"size-3.5 text-muted-foreground"})})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:e.description||e.config.command||e.config.url||JSON.stringify(e.config).slice(0,100)})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(s.Button,{variant:"outline",size:"sm",onClick:()=>{K(e),X(e.boundAgents.map(e=>e.id))},children:[(0,t.jsx)(w.Rocket,{className:"size-3.5 mr-1"}),T("apply")]}),(0,t.jsxs)(d.DropdownMenu,{children:[(0,t.jsx)(d.DropdownMenuTrigger,{render:(0,t.jsx)(s.Button,{variant:"ghost",size:"icon",className:"size-7"}),children:(0,t.jsx)(j.MoreVertical,{className:"size-3.5"})}),(0,t.jsx)(d.DropdownMenuContent,{align:"end",children:(0,t.jsxs)(d.DropdownMenuItem,{className:"text-destructive focus:text-destructive",onClick:()=>es(e),children:[(0,t.jsx)(b.Trash2,{className:"size-3.5 mr-1.5"}),T("delete")]})})]})]})]}),e.boundAgents.length>0&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 mt-2.5 pt-2.5 border-t border-border/50",children:[e.boundAgents.map(e=>(0,t.jsx)(m.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-5 rounded-full"},e.id)),(0,t.jsx)("span",{className:"text-xs text-muted-foreground ml-1",children:e.boundAgents.length})]})]},e.name))})})]})]})]});return(0,t.jsxs)(t.Fragment,{children:[C&&ec&&(0,t.jsx)("div",{className:"h-full flex flex-col",children:ed}),!C&&(0,t.jsx)(r.Dialog,{open:ec,onOpenChange:i,children:(0,t.jsx)(r.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:ed})}),(0,t.jsx)(r.Dialog,{open:!!Y,onOpenChange:e=>{e||Q(null)},children:(0,t.jsxs)(r.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:[(0,t.jsx)(r.DialogHeader,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between pr-8",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(r.DialogTitle,{children:T("editTitle",{name:Y?.name||""})}),(0,t.jsx)(r.DialogDescription,{children:T("editDescription")})]}),(0,t.jsxs)(s.Button,{size:"sm",onClick:er,children:[(0,t.jsx)(S.Save,{className:"size-3.5 mr-1"}),P("save")]})]})}),(0,t.jsx)("div",{className:"flex-1 min-h-0 pt-2",children:(0,t.jsx)(k,{height:"100%",language:"json",value:Z,onChange:e=>ee(e||""),theme:"vs-dark",options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,padding:{top:8},renderLineHighlight:"gutter",wordWrap:"on",formatOnPaste:!0}})})]})}),(0,t.jsx)(h.AgentPickerDialog,{open:!!J,onClose:()=>K(null),onConfirm:eo,title:T("bindTitle",{name:J?.name||""}),description:T("bindDescription"),agents:M,selected:G,onToggle:e=>{X(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},cancelText:P("cancel"),confirmText:P("confirm")})]})}])},638322,e=>{"use strict";var t,a,n=e.i(344180);e.s([],935002),e.i(935002),e.i(8890);var i=e.i(764556),r=e.i(155461),s=e.i(166392),o=e.i(277642),l=e.i(267805);let c=i.createContext(void 0);function d(e){let t=i.useContext(c);if(void 0===t&&!e)throw Error((0,l.default)(72));return t}var u=e.i(92615),p=e.i(422561),m=e.i(29905),h=e.i(410421),f=e.i(150129);function g(e){return null!=e&&null!=e.clientX}var x=e.i(538501),v=e.i(427396),y=e.i(602453),j=e.i(279501),b=e.i(106206),w=e.i(332976),S=e.i(493696),N=e.i(549154),k=e.i(107164),C=e.i(742665),T=e.i(695011),P=e.i(561213);let R={...T.popupStoreSelectors,disabled:(0,w.createSelector)(e=>e.disabled),instantType:(0,w.createSelector)(e=>e.instantType),isInstantPhase:(0,w.createSelector)(e=>e.isInstantPhase),trackCursorAxis:(0,w.createSelector)(e=>e.trackCursorAxis),disableHoverablePopup:(0,w.createSelector)(e=>e.disableHoverablePopup),lastOpenChangeReason:(0,w.createSelector)(e=>e.openChangeReason),closeOnClick:(0,w.createSelector)(e=>e.closeOnClick),closeDelay:(0,w.createSelector)(e=>e.closeDelay),hasViewport:(0,w.createSelector)(e=>e.hasViewport)};class D extends S.ReactStore{constructor(e){super({...(0,T.createInitialPopupStoreState)(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1,...e},{popupRef:i.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new P.PopupTriggerMap},R)}setOpen=(e,t)=>{let a=t.reason,n=a===C.REASONS.triggerHover,i=e&&a===C.REASONS.triggerFocus,r=!e&&(a===C.REASONS.triggerPress||a===C.REASONS.escapeKey);if(t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n={open:e,openChangeReason:a};i?n.instantType="focus":r?n.instantType="dismiss":a===C.REASONS.triggerHover&&(n.instantType=void 0);let s=t.trigger?.id??null;(s||e)&&(n.activeTriggerId=s,n.activeTriggerElement=t.trigger??null),this.update(n)};n?b.flushSync(s):s()};static useStore(e,t){let a=(0,N.useRefWithInit)(()=>new D(t)).current,n=e??a,i=(0,k.useSyncedFloatingRootContext)({popupStore:n,onOpenChange:n.setOpen});return n.state.floatingRootContext=i,n}}let M=(0,r.fastComponent)(function(e){let{disabled:t=!1,defaultOpen:a=!1,open:r,disableHoverablePopup:l=!1,trackCursorAxis:d="none",actionsRef:b,onOpenChange:w,onOpenChangeComplete:S,handle:N,triggerId:k,defaultTriggerId:T=null,children:P}=e,R=D.useStore(N?.store,{open:a,openProp:r,activeTriggerId:T,triggerIdProp:k});(0,s.useOnFirstRender)(()=>{void 0===r&&!1===R.state.open&&!0===a&&R.update({open:!0,activeTriggerId:T})}),R.useControlledProp("openProp",r),R.useControlledProp("triggerIdProp",k),R.useContextCallback("onOpenChange",w),R.useContextCallback("onOpenChangeComplete",S);let M=R.useState("open"),E=!t&&M,O=R.useState("activeTriggerId"),z=R.useState("payload");R.useSyncedValues({trackCursorAxis:d,disableHoverablePopup:l}),(0,o.useIsoLayoutEffect)(()=>{M&&t&&R.setOpen(!1,(0,y.createChangeEventDetails)(C.REASONS.disabled))},[M,t,R]),R.useSyncedValue("disabled",t),(0,j.useImplicitActiveTrigger)(R);let{forceUnmount:F,transitionStatus:I}=(0,j.useOpenStateTransitions)(E,R),A=R.select("floatingRootContext"),L=R.useState("isInstantPhase"),B=R.useState("instantType"),$=R.useState("lastOpenChangeReason"),W=i.useRef(null);(0,o.useIsoLayoutEffect)(()=>{"ending"===I&&$===C.REASONS.none||"ending"!==I&&L?("delay"!==B&&(W.current=B),R.set("instantType","delay")):null!==W.current&&(R.set("instantType",W.current),W.current=null)},[I,L,$,B,R]),(0,o.useIsoLayoutEffect)(()=>{E&&null==O&&R.set("payload",void 0)},[R,O,E]);let H=i.useCallback(()=>{R.setOpen(!1,(0,y.createChangeEventDetails)(C.REASONS.imperativeAction))},[R]);i.useImperativeHandle(b,()=>({unmount:F,close:H}),[F,H]);let U=(0,x.useDismiss)(A,{enabled:!t,referencePress:()=>R.select("closeOnClick")}),V=function(e,t={}){let a="rootStore"in e?e.rootStore:e,n=a.useState("open"),r=a.useState("floatingElement"),s=a.useState("domReferenceElement"),o=a.context.dataRef,{enabled:l=!0,axis:c="both"}=t,d=i.useRef(!1),x=i.useRef(null),[v,y]=i.useState(),[j,b]=i.useState([]),w=(0,m.useStableCallback)((e,t,n)=>{if(!d.current&&(!o.current.openEvent||g(o.current.openEvent))){var i,r;let l,d,u;a.set("positionReference",(i=n??s,r={x:e,y:t,axis:c,dataRef:o,pointerType:v},l=null,d=null,u=!1,{contextElement:i||void 0,getBoundingClientRect(){let e=i?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},t="x"===r.axis||"both"===r.axis,a="y"===r.axis||"both"===r.axis,n=["mouseenter","mousemove"].includes(r.dataRef.current.openEvent?.type||"")&&"touch"!==r.pointerType,s=e.width,o=e.height,c=e.x,p=e.y;return null==l&&r.x&&t&&(l=e.x-r.x),null==d&&r.y&&a&&(d=e.y-r.y),c-=l||0,p-=d||0,s=0,o=0,!u||n?(s="y"===r.axis?e.width:0,o="x"===r.axis?e.height:0,c=t&&null!=r.x?r.x:c,p=a&&null!=r.y?r.y:p):u&&!n&&(o="x"===r.axis?e.height:o,s="y"===r.axis?e.width:s),u=!0,{width:s,height:o,x:c,y:p,top:p,right:c+s,bottom:p+o,left:c}}}))}}),S=(0,m.useStableCallback)(e=>{n?x.current||b([]):w(e.clientX,e.clientY,e.currentTarget)}),N=(0,f.isMouseLikePointerType)(v)?r:n,k=i.useCallback(()=>{if(!N||!l)return;let e=(0,u.getWindow)(r);if(!o.current.openEvent||g(o.current.openEvent))return x.current=(0,p.addEventListener)(e,"mousemove",function(e){let t=(0,h.getTarget)(e);(0,h.contains)(r,t)?(x.current?.(),x.current=null):w(e.clientX,e.clientY)}),()=>{x.current?.(),x.current=null};a.set("positionReference",s)},[N,l,r,o,s,a,w]);i.useEffect(()=>k(),[k,j]),i.useEffect(()=>{l&&!r&&(d.current=!1)},[l,r]),i.useEffect(()=>{!l&&n&&(d.current=!0)},[l,n]);let C=i.useMemo(()=>{function e(e){y(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:S,onMouseEnter:S}},[S]);return i.useMemo(()=>l?{reference:C,trigger:C}:{},[l,C])}(A,{enabled:!t&&"none"!==d,axis:"none"===d?void 0:d}),{getReferenceProps:_,getFloatingProps:q,getTriggerProps:J}=(0,v.useInteractions)([U,V]),K=i.useMemo(()=>_(),[_]),G=i.useMemo(()=>J(),[J]),X=i.useMemo(()=>q(),[q]);return R.useSyncedValues({activeTriggerProps:K,inactiveTriggerProps:G,popupProps:X}),(0,n.jsx)(c.Provider,{value:R,children:"function"==typeof P?P({payload:z}):P})});var E=e.i(817955),O=e.i(969490),z=e.i(139236);let F=i.createContext(void 0);var I=e.i(499198),A=e.i(232449),L=e.i(49863);let B=i.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new A.Timeout,currentIdRef:{current:null},currentContextRef:{current:null}});function $(e){let{children:t,delay:a,timeoutMs:r=0}=e,s=i.useRef(a),o=i.useRef(a),l=i.useRef(null),c=i.useRef(null),d=(0,A.useTimeout)();return(0,n.jsx)(B.Provider,{value:i.useMemo(()=>({hasProvider:!0,delayRef:s,initialDelayRef:o,currentIdRef:l,timeoutMs:r,currentContextRef:c,timeout:d}),[r,d]),children:t})}var W=e.i(604921),H=e.i(480283);let U=((t={})[t.popupOpen=E.CommonTriggerDataAttributes.popupOpen]="popupOpen",t.triggerDisabled="data-trigger-disabled",t),V=(0,r.fastComponentRef)(function(e,t){let{className:a,render:n,handle:r,payload:s,disabled:c,delay:u,closeOnClick:p=!0,closeDelay:m,id:h,style:f,...g}=e,x=d(!0),v=r?.store??x;if(!v)throw Error((0,l.default)(82));let b=(0,z.useBaseUiId)(h),w=v.useState("isTriggerActive",b),S=v.useState("isOpenedByTrigger",b),N=v.useState("floatingRootContext"),k=i.useRef(null),T=u??600,P=m??0,{registerTrigger:R,isMountedByThisTrigger:D}=(0,j.useTriggerDataForwarding)(b,k,v,{payload:s,closeOnClick:p,closeDelay:P}),M=i.useContext(F),{delayRef:A,isInstantPhase:$,hasProvider:V}=function(e,t={open:!1}){let a="rootStore"in e?e.rootStore:e,n=a.useState("floatingId"),{open:r}=t,{currentIdRef:s,delayRef:l,timeoutMs:c,initialDelayRef:d,currentContextRef:u,hasProvider:p,timeout:m}=i.useContext(B),[h,f]=i.useState(!1);return(0,o.useIsoLayoutEffect)(()=>{function e(){f(!1),u.current?.setIsInstantPhase(!1),s.current=null,u.current=null,l.current=d.current}if(s.current&&!r&&s.current===n){if(f(!1),c)return m.start(c,()=>{a.select("open")||s.current&&s.current!==n||e()}),()=>{m.clear()};e()}},[r,n,s,l,c,d,u,m,a]),(0,o.useIsoLayoutEffect)(()=>{if(!r)return;let e=u.current,t=s.current;m.clear(),u.current={onOpenChange:a.setOpen,setIsInstantPhase:f},s.current=n,l.current={open:0,close:(0,L.getDelay)(d.current,"close")},null!==t&&t!==n?(f(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,(0,y.createChangeEventDetails)(C.REASONS.none))):(f(!1),e?.setIsInstantPhase(!1))},[r,n,a,s,l,c,d,u,m]),(0,o.useIsoLayoutEffect)(()=>()=>{u.current=null},[u]),i.useMemo(()=>({hasProvider:p,delayRef:l,isInstantPhase:h}),[p,l,h])}(N,{open:S});v.useSyncedValue("isInstantPhase",$);let _=v.useState("disabled"),q=c??_,J=v.useState("trackCursorAxis"),K=v.useState("disableHoverablePopup"),G=(0,H.useHoverReferenceInteraction)(N,{enabled:!q,mouseOnly:!0,move:!1,handleClose:K||"both"===J?null:(0,I.safePolygon)(),restMs(){let e=M?.delay,t="object"==typeof A.current?A.current.open:void 0,a=T;return V&&(a=0!==t?u??e??T:0),a},delay(){let e="object"==typeof A.current?A.current.close:void 0,t=P;return null==m&&V&&(t=e),{close:t}},triggerElementRef:k,isActiveTrigger:w,isClosing:()=>"ending"===v.select("transitionStatus")}),X=(0,W.useFocus)(N,{enabled:!q}).reference,Y=v.useState("triggerProps",D);return(0,O.useRenderElement)("button",e,{state:{open:S},ref:[t,R,k],props:[G,X,Y,{onPointerDown(){v.set("closeOnClick",p)},id:b,[U.triggerDisabled]:q?"":void 0},g],stateAttributesMapping:E.triggerOpenStateMapping})}),_=i.createContext(void 0);var q=e.i(384389);let J=i.forwardRef(function(e,t){let{keepMounted:a=!1,...i}=e;return d().useState("mounted")||a?(0,n.jsx)(_.Provider,{value:a,children:(0,n.jsx)(q.FloatingPortalLite,{ref:t,...i})}):null}),K=i.createContext(void 0);function G(){let e=i.useContext(K);if(void 0===e)throw Error((0,l.default)(71));return e}var X=e.i(576557),Y=e.i(576487),Q=e.i(909852),Z=e.i(263635);let ee=i.forwardRef(function(e,t){let{render:a,className:r,anchor:s,positionMethod:o="absolute",side:c="top",align:u="center",sideOffset:p=0,alignOffset:m=0,collisionBoundary:h="clipping-ancestors",collisionPadding:f=5,arrowPadding:g=5,sticky:x=!1,disableAnchorTracking:v=!1,collisionAvoidance:y=Y.POPUP_COLLISION_AVOIDANCE,style:j,...b}=e,w=d(),S=function(){let e=i.useContext(_);if(void 0===e)throw Error((0,l.default)(70));return e}(),N=w.useState("open"),k=w.useState("mounted"),C=w.useState("trackCursorAxis"),T=w.useState("disableHoverablePopup"),P=w.useState("floatingRootContext"),R=w.useState("instantType"),D=w.useState("transitionStatus"),M=w.useState("hasViewport"),E=(0,X.useAnchorPositioning)({anchor:s,positionMethod:o,floatingRootContext:P,mounted:k,side:c,sideOffset:p,align:u,alignOffset:m,collisionBoundary:h,collisionPadding:f,sticky:x,arrowPadding:g,disableAnchorTracking:v,keepMounted:S,collisionAvoidance:y,adaptiveOrigin:M?Q.adaptiveOrigin:void 0}),O=i.useMemo(()=>({open:N,side:E.side,align:E.align,anchorHidden:E.anchorHidden,instant:"none"!==C?"tracking-cursor":R}),[N,E.side,E.align,E.anchorHidden,C,R]),z=(0,Z.usePositioner)(e,O,{styles:E.positionerStyles,transitionStatus:D,props:b,refs:[t,w.useStateSetter("positionerElement")],hidden:!k,inert:!N||"both"===C||T});return(0,n.jsx)(K.Provider,{value:E,children:z})});var et=e.i(282458),ea=e.i(273598),en=e.i(328657),ei=e.i(795914);let er={...E.popupStateMapping,...et.transitionStatusMapping},es=i.forwardRef(function(e,t){let{className:a,render:n,style:i,...r}=e,s=d(),{side:o,align:l}=G(),c=s.useState("open"),u=s.useState("instantType"),p=s.useState("transitionStatus"),m=s.useState("popupProps"),h=s.useState("floatingRootContext");(0,ea.useOpenChangeComplete)({open:c,ref:s.context.popupRef,onComplete(){c&&s.context.onOpenChangeComplete?.(!0)}});let f=s.useState("disabled"),g=s.useState("closeDelay");return(0,ei.useHoverFloatingInteraction)(h,{enabled:!f,closeDelay:g}),(0,O.useRenderElement)("div",e,{state:{open:c,side:o,align:l,instant:u,transitionStatus:p},ref:[t,s.context.popupRef,s.useStateSetter("popupElement")],props:[m,(0,en.getDisabledMountTransitionStyles)(p),r],stateAttributesMapping:er})}),eo=i.forwardRef(function(e,t){let{className:a,render:n,style:i,...r}=e,s=d(),o=s.useState("open"),l=s.useState("instantType"),{arrowRef:c,side:u,align:p,arrowUncentered:m,arrowStyles:h}=G();return(0,O.useRenderElement)("div",e,{state:{open:o,side:u,align:p,uncentered:m,instant:l},ref:[t,c],props:[{style:h,"aria-hidden":!0},r],stateAttributesMapping:E.popupStateMapping})}),el=((a={}).popupWidth="--popup-width",a.popupHeight="--popup-height",a);var ec=e.i(3310);let ed={activationDirection:e=>e?{"data-activation-direction":e}:null},eu=i.forwardRef(function(e,t){let{render:a,className:n,style:i,children:r,...s}=e,o=d(),l=G(),c=o.useState("instantType"),{children:u,state:p}=(0,ec.usePopupViewport)({store:o,side:l.side,cssVars:el,children:r}),m={activationDirection:p.activationDirection,transitioning:p.transitioning,instant:c};return(0,O.useRenderElement)("div",e,{state:m,ref:t,props:[s,{children:u}],stateAttributesMapping:ed})});class ep{constructor(){this.store=new D}open(e){let t=e?this.store.context.triggerElements.getById(e):void 0;if(e&&!t)throw Error((0,l.default)(81,e));this.store.setOpen(!0,(0,y.createChangeEventDetails)(C.REASONS.imperativeAction,void 0,t))}close(){this.store.setOpen(!1,(0,y.createChangeEventDetails)(C.REASONS.imperativeAction,void 0,void 0))}get isOpen(){return this.store.state.open}}e.s(["Arrow",0,eo,"Handle",0,ep,"Popup",0,es,"Portal",0,J,"Positioner",0,ee,"Provider",0,function(e){let{delay:t,closeDelay:a,timeout:r=400}=e,s=i.useMemo(()=>({delay:t,closeDelay:a}),[t,a]),o=i.useMemo(()=>({open:t,close:a}),[t,a]);return(0,n.jsx)(F.Provider,{value:s,children:(0,n.jsx)($,{delay:o,timeoutMs:r,children:e.children})})},"Root",0,M,"Trigger",0,V,"Viewport",0,eu,"createHandle",0,function(){return new ep}],638295);var em=e.i(638295),em=em,eh=e.i(465458);e.s(["Tooltip",0,function({...e}){return(0,n.jsx)(em.Root,{"data-slot":"tooltip",...e})},"TooltipContent",0,function({className:e,side:t="top",sideOffset:a=4,align:i="center",alignOffset:r=0,children:s,...o}){return(0,n.jsx)(em.Portal,{children:(0,n.jsx)(em.Positioner,{align:i,alignOffset:r,side:t,sideOffset:a,className:"isolate z-50",children:(0,n.jsxs)(em.Popup,{"data-slot":"tooltip-content",className:(0,eh.cn)("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...o,children:[s,(0,n.jsx)(em.Arrow,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})},"TooltipProvider",0,function({delay:e=0,...t}){return(0,n.jsx)(em.Provider,{"data-slot":"tooltip-provider",delay:e,...t})},"TooltipTrigger",0,function({...e}){return(0,n.jsx)(em.Trigger,{"data-slot":"tooltip-trigger",...e})}],638322)},817854,e=>{"use strict";var t=e.i(344180),a=e.i(465458);e.s(["Label",0,function({className:e,...n}){return(0,t.jsx)("label",{"data-slot":"label",className:(0,a.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...n})}])},244996,444741,e=>{"use strict";let t=(0,e.i(433721).default)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);e.s(["default",0,t],444741),e.s(["CheckCircle2",0,t],244996)},92457,e=>{"use strict";let t=(0,e.i(433721).default)("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);e.s(["Monitor",0,t],92457)},36539,e=>{"use strict";let t=(0,e.i(433721).default)("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);e.s(["default",0,t])},62669,e=>{"use strict";let t=(0,e.i(433721).default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);e.s(["Loader2",0,t],62669)},378371,e=>{"use strict";let t=(0,e.i(433721).default)("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);e.s(["ArrowUp",0,t],378371)},973370,220336,e=>{"use strict";let t=(0,e.i(433721).default)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);e.s(["default",0,t],220336),e.s(["Folder",0,t],973370)},411649,e=>{"use strict";let t=(0,e.i(433721).default)("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]]);e.s(["Home",0,t],411649)},550080,e=>{"use strict";var t=e.i(144988);e.s(["File",()=>t.default])},198699,e=>{"use strict";let t=(0,e.i(433721).default)("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);e.s(["FolderPlus",0,t],198699)},434805,e=>{"use strict";var t=e.i(344180),a=e.i(764556),n=e.i(244073),i=e.i(550080),r=e.i(973370),s=e.i(451534),o=e.i(992764),l=e.i(378371),c=e.i(411649),d=e.i(62669),u=e.i(198699),p=e.i(344118),m=e.i(972846),h=e.i(433721);let f=(0,h.default)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),g=(0,h.default)("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),x=(0,h.default)("shield-off",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]);var v=e.i(465458),y=e.i(681622),j=e.i(996652);e.s(["FolderPicker",0,function({value:e,onChange:h,className:b,placeholder:w="/path/to/project",allowFiles:S=!1,fileFilter:N}){let[k,C]=(0,a.useState)(!1),[T,P]=(0,a.useState)(e||""),[R,D]=(0,a.useState)([]),[M,E]=(0,a.useState)([]),O=(0,n.useTranslations)("folderPicker"),[z,F]=(0,a.useState)(null),[I,A]=(0,a.useState)(!1),[L,B]=(0,a.useState)(""),[$,W]=(0,a.useState)(!1),[H,U]=(0,a.useState)(""),[V,_]=(0,a.useState)(null),[q,J]=(0,a.useState)(!1),K=(0,a.useRef)(null),G=(0,a.useRef)(null),X=(0,a.useRef)(null),Y=(0,a.useCallback)(async e=>{if(!e)return void _(null);J(!0);try{let t=await fetch(`/api/folder/check-permissions?path=${encodeURIComponent(e)}`);if(!t.ok)return void _(null);let a=await t.json();_(a)}catch{_(null)}finally{J(!1)}},[]),Q=(0,a.useCallback)(async e=>{A(!0),B("");try{let t=`/api/folder/browse?path=${encodeURIComponent(e)}`;S&&(t+="&files=1",N&&(t+=`&fileFilter=${encodeURIComponent(N)}`));let a=await fetch(t);if(!a.ok)throw Error((await a.json()).error||"Failed to browse");let n=await a.json();P(n.path),D(n.directories),E(n.files??[]),F(n.parent),Y(n.path)}catch(e){B(e instanceof Error?e.message:String(e))}finally{A(!1)}},[Y,S,N]);(0,a.useEffect)(()=>{k&&Q(e||"")},[k,Q,e]),(0,a.useEffect)(()=>{$&&X.current&&X.current.focus()},[$]);let Z=e=>{Q(e)},ee=async()=>{let e=H.trim();if(!e)return;let t=T.includes("/")?"/":"\\",a=T?`${T}${t}${e}`:e;try{let e=await fetch("/api/folder/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a})});if(!e.ok)throw Error((await e.json()).error||"Failed to create folder");W(!1),U(""),h(a),P(a),C(!1)}catch(e){B(e instanceof Error?e.message:String(e))}},et=R.length>0||M.length>0;return(0,t.jsx)("div",{className:(0,v.cn)("relative",b),children:(0,t.jsxs)("div",{className:"flex gap-1.5",children:[(0,t.jsx)(y.Input,{className:"h-auto rounded-xl py-2.5",placeholder:w,value:e,onChange:e=>{h(e.target.value)},onKeyDown:t=>{"Enter"===t.key&&(t.preventDefault(),Q(e))},ref:K}),(0,t.jsxs)(j.Popover,{open:k,onOpenChange:e=>{C(e),e||(W(!1),U(""))},children:[(0,t.jsxs)(j.PopoverTrigger,{className:(0,v.cn)("flex items-center gap-1.5 rounded-xl border px-3 py-2.5 text-sm transition-colors",k?"border-primary bg-primary/5 text-primary":"border-border bg-background text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:[(0,t.jsx)(s.FolderOpen,{className:"size-4"}),"Browse"]}),(0,t.jsx)(j.PopoverContent,{align:"start",className:"w-[var(--radix-popover-trigger-width)] p-0 overflow-hidden rounded-xl",style:{height:360},children:(0,t.jsxs)("div",{className:"flex h-full flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 border-b border-border px-3 py-2",children:[(0,t.jsx)("button",{type:"button",onClick:()=>Z(""),className:"flex size-7 items-center justify-center rounded-md hover:bg-accent transition-colors cursor-pointer",title:"Home",children:(0,t.jsx)(c.Home,{className:"size-3.5"})}),(0,t.jsx)("button",{type:"button",onClick:()=>{z&&Q(z)},className:"flex size-7 items-center justify-center rounded-md hover:bg-accent transition-colors cursor-pointer",title:"Go up",children:(0,t.jsx)(l.ArrowUp,{className:"size-3.5"})}),(0,t.jsx)(y.Input,{className:"truncate bg-muted text-xs text-muted-foreground font-mono focus-visible:bg-background h-7",value:T,onChange:e=>P(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),Q(T))}}),(0,t.jsx)("button",{type:"button",onClick:()=>{W(!0),U("")},className:"flex size-7 items-center justify-center rounded-md hover:bg-accent transition-colors cursor-pointer",title:O("newFolder"),children:(0,t.jsx)(u.FolderPlus,{className:"size-3.5"})}),!S&&(0,t.jsx)("button",{type:"button",onClick:()=>{h(T),C(!1)},className:"flex size-7 items-center justify-center rounded-md bg-primary text-primary-foreground hover:bg-primary/90 transition-colors cursor-pointer",title:O("select"),children:(0,t.jsx)(p.Check,{className:"size-3.5"})})]}),$&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 border-b border-border px-3 py-1.5",children:[(0,t.jsx)(u.FolderPlus,{className:"size-4 text-muted-foreground shrink-0"}),(0,t.jsx)(y.Input,{ref:X,className:"flex-1 h-7 text-sm",placeholder:O("folderNamePlaceholder"),value:H,onChange:e=>U(e.target.value),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),ee()):"Escape"===e.key&&(W(!1),U(""))}}),(0,t.jsx)("button",{type:"button",onClick:ee,className:"flex size-6 items-center justify-center rounded-md hover:bg-accent transition-colors cursor-pointer",disabled:!H.trim(),children:(0,t.jsx)(p.Check,{className:"size-3.5 text-primary"})}),(0,t.jsx)("button",{type:"button",onClick:()=>{W(!1),U("")},className:"flex size-6 items-center justify-center rounded-md hover:bg-accent transition-colors cursor-pointer",children:(0,t.jsx)(m.X,{className:"size-3.5 text-muted-foreground"})})]}),(0,t.jsx)("div",{ref:G,className:"flex-1 overflow-y-auto p-1.5",children:I?(0,t.jsxs)("div",{className:"flex items-center justify-center py-8 text-muted-foreground",children:[(0,t.jsx)(d.Loader2,{className:"size-4 animate-spin mr-2"}),"Loading..."]}):L?(0,t.jsx)("div",{className:"px-3 py-8 text-center text-xs text-destructive",children:L}):et?(0,t.jsxs)(t.Fragment,{children:[R.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>Z(e.path),onDoubleClick:()=>{h(e.path),C(!1)},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm hover:bg-accent transition-colors text-left",children:[(0,t.jsx)(r.Folder,{className:"size-4 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"flex-1 truncate",children:e.name}),(0,t.jsx)(o.ChevronRight,{className:"size-3 text-muted-foreground shrink-0"})]},e.path)),M.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>{h(e.path),C(!1)},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm hover:bg-accent transition-colors text-left",children:[(0,t.jsx)(i.File,{className:"size-4 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"flex-1 truncate font-mono text-xs",children:e.name})]},e.path))]}):(0,t.jsx)("div",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:"No subdirectories"})}),(0,t.jsx)("div",{className:"border-t border-border px-3 py-1.5 flex items-center gap-2 text-xs",children:q?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.Loader2,{className:"size-3 animate-spin text-muted-foreground"}),(0,t.jsx)("span",{className:"text-muted-foreground",children:"Checking permissions..."})]}):V?(0,t.jsx)(t.Fragment,{children:V.readable&&V.writable?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f,{className:"size-3.5 text-green-500"}),(0,t.jsx)("span",{className:"text-green-600 dark:text-green-400",children:"Read/Write"})]}):V.readable&&!V.writable?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(g,{className:"size-3.5 text-amber-500"}),(0,t.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Read-only — files cannot be written here"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x,{className:"size-3.5 text-destructive"}),(0,t.jsx)("span",{className:"text-destructive",children:V.error||"No access"})]})}):(0,t.jsx)("span",{className:"text-muted-foreground",children:O("selectDirectory")})})]})})]})]})})}],434805)},524,e=>{"use strict";var t=e.i(344180),a=e.i(764556),n=e.i(209988),i=e.i(260218),r=e.i(355819),s=e.i(193251),o=e.i(62669),l=e.i(511800),c=e.i(681622),d=e.i(434805),u=e.i(660748),p=e.i(244073);function m({open:e,onOpenChange:h,workspace:f,onSubmit:g}){let x=(0,p.useTranslations)("workspace"),v=(0,p.useTranslations)("common"),y=(0,r.useAgentStore)(e=>e.agents),[j,b]=(0,a.useState)(f?.name??""),[w,S]=(0,a.useState)(f?.boundDirs[0]??""),[N,k]=(0,a.useState)(!1),[C,T]=(0,a.useState)(!1),[P,R]=(0,a.useState)(""),[D,M]=(0,a.useState)(!1),[E,O]=(0,a.useState)(null),z=!!f,F=async()=>{if(j&&w){k(!0);try{await g({name:j,boundDirs:[w]}),h(!1)}finally{k(!1)}}},I=(0,a.useCallback)(async()=>{if(P&&w){M(!0),O(null);try{let e=await fetch("/api/workspaces/clone",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:P,targetDir:w})});if(!e.ok){let t=await e.json();O({phase:"error",progress:0,error:t.error||x("clone.cloneFailed")}),M(!1);return}let t=e.body?.getReader();if(!t){O({phase:"error",progress:0,error:x("clone.noResponseBody")}),M(!1);return}let a=new TextDecoder,n="";for(;;){let{done:e,value:i}=await t.read();if(e)break;let r=(n+=a.decode(i,{stream:!0})).split("\n");for(let e of(n=r.pop()||"",r))if(e.startsWith("data: "))try{let t=JSON.parse(e.slice(6));O(t),("done"===t.phase||"error"===t.phase)&&(M(!1),"done"===t.phase&&t.cloneDir&&(S(t.cloneDir),j||b(P.split("/").pop()?.replace(".git","")||""),T(!1),R(""),O(null)))}catch{}}}catch(e){O({phase:"error",progress:0,error:e instanceof Error?e.message:String(e)}),M(!1)}}},[P,w,j,x]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.Dialog,{open:e,onOpenChange:h,children:(0,t.jsxs)(n.DialogContent,{children:[(0,t.jsxs)(n.DialogHeader,{children:[(0,t.jsx)(n.DialogTitle,{children:z?x("dialog.editTitle"):x("dialog.newTitle")}),(0,t.jsx)(n.DialogDescription,{children:z?x("dialog.editDescription"):x("dialog.newDescription")})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-3 py-2",children:[(0,t.jsx)(c.Input,{className:"rounded-xl py-2.5",placeholder:x("dialog.namePlaceholder"),value:j,onChange:e=>b(e.target.value),onKeyDown:e=>"Enter"===e.key&&e.preventDefault()}),(0,t.jsx)("div",{children:(0,t.jsx)(d.FolderPicker,{value:w,onChange:S,placeholder:"/path/to/project"})}),!z&&(0,t.jsxs)(i.Button,{type:"button",variant:"outline",size:"sm",className:"w-full gap-1.5",onClick:()=>T(!0),disabled:!w,title:w?x("clone.fromGitTooltip"):x("clone.selectFolderFirst"),children:[(0,t.jsx)(s.Download,{className:"size-4"}),x("clone.createFromGit")]}),z&&y.length>0&&(0,t.jsxs)("div",{className:"rounded-xl border border-border p-3",children:[(0,t.jsxs)("div",{className:"mb-2 flex items-center gap-2 text-sm font-medium",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:y.length}),(0,t.jsx)("span",{children:x("agents")})]}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:y.map(e=>(0,t.jsx)("span",{className:"inline-flex items-center gap-1 rounded-md bg-muted px-2 py-0.5 text-xs",children:e.name||e.role},e.id))})]})]}),(0,t.jsxs)(n.DialogFooter,{children:[(0,t.jsx)(i.Button,{variant:"outline",onClick:()=>h(!1),disabled:N,children:v("cancel")}),(0,t.jsx)(i.Button,{onClick:F,disabled:!j||!w||N,children:v(z?"save":"create")})]})]})}),(0,t.jsx)(n.Dialog,{open:C,onOpenChange:e=>{D||T(e)},children:(0,t.jsxs)(n.DialogContent,{children:[(0,t.jsxs)(n.DialogHeader,{children:[(0,t.jsx)(n.DialogTitle,{children:x("clone.title")}),(0,t.jsx)(n.DialogDescription,{children:x("clone.description")})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-3 py-2",children:[(0,t.jsx)(c.Input,{className:"rounded-xl py-2.5",placeholder:"https://github.com/user/repo.git",value:P,onChange:e=>R(e.target.value),onKeyDown:e=>"Enter"===e.key&&e.preventDefault(),disabled:D}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[x("clone.cloneTo"),w,"/",P?P.split("/").pop()?.replace(".git","")||"repo":"..."]}),E&&"done"!==E.phase&&"error"!==E.phase&&(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)(u.Progress,{value:E.progress,children:[(0,t.jsx)(u.ProgressLabel,{children:x(`clone.phase.${E.phase}`)}),(0,t.jsxs)("span",{className:"ml-auto text-sm text-muted-foreground tabular-nums",children:[E.progress,"%"]}),(0,t.jsx)(u.ProgressTrack,{children:(0,t.jsx)(u.ProgressIndicator,{})})]}),null!=E.received&&null!=E.total&&(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[E.received," / ",E.total," ",x("clone.objects")]})]}),E?.phase==="error"&&(0,t.jsxs)("div",{className:"flex items-start gap-2 rounded-lg border border-destructive/50 bg-destructive/5 p-3",children:[(0,t.jsx)(l.AlertCircle,{className:"size-4 mt-0.5 shrink-0 text-destructive"}),(0,t.jsx)("p",{className:"text-sm text-destructive",children:E.error})]})]}),(0,t.jsxs)(n.DialogFooter,{children:[(0,t.jsx)(i.Button,{variant:"outline",onClick:()=>{D||T(!1)},disabled:D,children:v("cancel")}),(0,t.jsx)(i.Button,{onClick:I,disabled:!P||D,children:D?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.Loader2,{className:"size-4 animate-spin"}),x("clone.cloning")]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.Download,{className:"size-4"}),x("clone.clone")]})})]})]})})]})}e.s(["WorkspaceDialog",0,function({open:e,onOpenChange:a,workspace:n,onSubmit:i}){return(0,t.jsx)(m,{open:e,onOpenChange:a,workspace:n,onSubmit:i},e?n?.id??"new":"closed")}])},842809,203922,e=>{"use strict";let t=new Map;function a(e,a,n){return null==e?"":(function(e,a){let n=JSON.stringify({locale:e,options:a}),i=t.get(n);if(i)return i;let r=new Intl.NumberFormat(e,a);return t.set(n,r),r})(a,n).format(e)}e.s(["formatNumber",0,a,"formatNumberValue",0,function(e,t,n){return null==e?"":n?a(e,t,n):a(e/100,t,{style:"percent"})}],842809),e.s(["valueToPercent",0,function(e,t,a){return(e-t)*100/(a-t)}],203922)},612505,e=>{"use strict";let t=(0,e.i(433721).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",0,t])},511800,e=>{"use strict";var t=e.i(612505);e.s(["AlertCircle",()=>t.default])},660748,e=>{"use strict";var t,a=e.i(344180);e.s([],606106),e.i(606106),e.i(8890);var n=e.i(764556),i=e.i(106045),r=e.i(236706),s=e.i(842809),o=e.i(969490),l=e.i(267805);let c=n.createContext(void 0);function d(){let e=n.useContext(c);if(void 0===e)throw Error((0,l.default)(51));return e}let u=((t={}).complete="data-complete",t.indeterminate="data-indeterminate",t.progressing="data-progressing",t),p={status:e=>"progressing"===e?{[u.progressing]:""}:"complete"===e?{[u.complete]:""}:"indeterminate"===e?{[u.indeterminate]:""}:null};function m(e,t){return null==t?"indeterminate progress":e||`${t}%`}let h=n.forwardRef(function(e,t){let{format:l,getAriaValueText:d=m,locale:u,max:h=100,min:f=0,value:g,render:x,className:v,children:y,style:j,...b}=e,[w,S]=n.useState(),N=(0,i.useValueAsRef)(l),k="indeterminate";Number.isFinite(g)&&(k=g===h?"complete":"progressing");let C=(0,s.formatNumberValue)(g,u,N.current),T=n.useMemo(()=>({status:k}),[k]),P={"aria-labelledby":w,"aria-valuemax":h,"aria-valuemin":f,"aria-valuenow":g??void 0,"aria-valuetext":d(C,g),role:"progressbar",children:(0,a.jsxs)(n.Fragment,{children:[y,(0,a.jsx)("span",{role:"presentation",style:r.visuallyHidden,children:"x"})]})},R=n.useMemo(()=>({formattedValue:C,max:h,min:f,setLabelId:S,state:T,status:k,value:g}),[C,h,f,S,T,k,g]),D=(0,o.useRenderElement)("div",e,{state:T,ref:t,props:[P,b],stateAttributesMapping:p});return(0,a.jsx)(c.Provider,{value:R,children:D})}),f=n.forwardRef(function(e,t){let{render:a,className:n,style:i,...r}=e,{state:s}=d();return(0,o.useRenderElement)("div",e,{state:s,ref:t,props:r,stateAttributesMapping:p})});var g=e.i(203922);let x=n.forwardRef(function(e,t){let{render:a,className:i,style:r,...s}=e,{max:l,min:c,value:u,state:m}=d(),h=Number.isFinite(u)&&null!==u?(0,g.valueToPercent)(u,c,l):null,f=n.useCallback(()=>null==h?{}:{insetInlineStart:0,height:"inherit",width:`${h}%`},[h]);return(0,o.useRenderElement)("div",e,{state:m,ref:t,props:[{style:f()},s],stateAttributesMapping:p})}),v=n.forwardRef(function(e,t){let{className:a,render:n,children:i,style:r,...s}=e,{value:l,formattedValue:c,state:u}=d(),m=null==l?"indeterminate":c,h=null==l?null:c;return(0,o.useRenderElement)("span",e,{state:u,ref:t,props:[{"aria-hidden":!0,children:"function"==typeof i?i(m,l):h},s],stateAttributesMapping:p})});var y=e.i(559713);let j=n.forwardRef(function(e,t){let{render:a,className:n,style:i,id:r,...s}=e,{setLabelId:l,state:c}=d(),u=(0,y.useRegisteredLabelId)(r,l);return(0,o.useRenderElement)("span",e,{state:c,ref:t,props:[{id:u,role:"presentation"},s],stateAttributesMapping:p})});e.s(["Indicator",0,x,"Label",0,j,"Root",0,h,"Track",0,f,"Value",0,v],729535);var b=e.i(729535),b=b,w=e.i(465458);function S({className:e,...t}){return(0,a.jsx)(b.Track,{className:(0,w.cn)("relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-muted",e),"data-slot":"progress-track",...t})}function N({className:e,...t}){return(0,a.jsx)(b.Indicator,{"data-slot":"progress-indicator",className:(0,w.cn)("h-full bg-primary transition-all",e),...t})}e.s(["Progress",0,function({className:e,children:t,value:n,...i}){return(0,a.jsxs)(b.Root,{value:n,"data-slot":"progress",className:(0,w.cn)("flex flex-wrap gap-3",e),...i,children:[t,(0,a.jsx)(S,{children:(0,a.jsx)(N,{})})]})},"ProgressIndicator",0,N,"ProgressLabel",0,function({className:e,...t}){return(0,a.jsx)(b.Label,{className:(0,w.cn)("text-sm font-medium",e),"data-slot":"progress-label",...t})},"ProgressTrack",0,S],660748)},361421,e=>{"use strict";let t=(0,e.i(433721).default)("folder-search",[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]]);e.s(["default",0,t])},244644,e=>{"use strict";var t=e.i(361421);e.s(["FolderSearch",()=>t.default])},980476,e=>{e.v(t=>Promise.all(["static/chunks/05f8cnmzqd5wb.js","static/chunks/128ugqd34tr_-.js"].map(t=>e.l(t))).then(()=>t(65666)))},863812,e=>{e.v(t=>Promise.all(["static/chunks/168ojsxhm7ypc.js"].map(t=>e.l(t))).then(()=>t(158480)))},930010,e=>{e.v(e=>Promise.resolve().then(()=>e(360112)))}]);
|