@minimalcorp/tsunagi 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/apps/web/.next/BUILD_ID +1 -1
- package/.next/standalone/apps/web/.next/build-manifest.json +3 -3
- package/.next/standalone/apps/web/.next/prerender-manifest.json +3 -3
- package/.next/standalone/apps/web/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.rsc +14 -14
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_index.segment.rsc +9 -9
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/index.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/index.rsc +16 -16
- package/.next/standalone/apps/web/.next/server/app/index.segments/__PAGE__.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/index.segments/_full.segment.rsc +16 -16
- package/.next/standalone/apps/web/.next/server/app/index.segments/_head.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/index.segments/_index.segment.rsc +9 -9
- package/.next/standalone/apps/web/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.rsc +16 -16
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_full.segment.rsc +16 -16
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_head.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_index.segment.rsc +9 -9
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +4 -4
- package/.next/standalone/apps/web/.next/server/app/settings.segments/settings.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/tasks/[id]/page.js.nft.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/tasks/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0vv~7-r._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{_03lm.~7._.js → _04i6ddr._.js} +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{_09br4yx._.js → _0g.v9_-._.js} +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{_02er0h8._.js → _0hl6ols._.js} +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/_0~zpobw._.js +3 -3
- package/.next/standalone/apps/web/.next/server/chunks/ssr/_11t..8m._.js +3 -0
- package/.next/standalone/apps/web/.next/server/chunks/ssr/apps_web_src_app_settings_page_tsx_0i6itlb._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0kntoyl._.js → node_modules_0.04ooy._.js} +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0sfg-s2._.js → node_modules_00bep8g._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_10j308c._.js → node_modules_01ec0_l._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_13~-5ar._.js → node_modules_01zoxen._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_125.p.9._.js → node_modules_025yuyy._.js} +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0-g.x7m._.js → node_modules_03l6xk8._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0wgsa8v._.js → node_modules_088uler._.js} +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0_74i.3._.js → node_modules_0_e.5ij._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0p7lgf.._.js → node_modules_0aeoz80._.js} +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_03b-l-s._.js → node_modules_0cldkel._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_137mu_b._.js → node_modules_0g~702_._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_01ofeu6._.js → node_modules_0hpd6s0._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0bkgg0r._.js → node_modules_0lvvzo4._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0quv7f0._.js → node_modules_0lyr8-2._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0w165t_._.js → node_modules_0m2ei5d._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0mmku.o._.js → node_modules_0mjiffy._.js} +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0b9gmx_._.js → node_modules_0nsk~wg._.js} +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0x__scl._.js → node_modules_0p4kkxj._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0vt~23j._.js → node_modules_0pek10d._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0ucmvhi._.js → node_modules_0s5ryxm._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0_w-_n5._.js → node_modules_0sc~~sz._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_11cmy64._.js → node_modules_0uruwej._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_005zok8._.js → node_modules_0vnb_k7._.js} +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0vodr9~._.js → node_modules_0zhd.oc._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0r-s06f._.js → node_modules_0~jg31l._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0e-3ya_._.js → node_modules_10pfv5l._.js} +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0r86i37._.js → node_modules_11ezb-s._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0xsvbht._.js → node_modules_1361-47._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/node_modules_@monaco-editor_react_dist_index_mjs_09~ygmr._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_0wcq3n2._.js → node_modules_katex_dist_katex_mjs_0en46.t._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_mermaid_dist_mermaid_core_mjs_0cx19ue._.js → node_modules_mermaid_dist_mermaid_core_mjs_0tj-0va._.js} +2 -2
- package/.next/standalone/apps/web/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/apps/web/.next/server/pages/404.html +1 -1
- package/.next/standalone/apps/web/.next/server/pages/500.html +1 -1
- package/.next/standalone/apps/web/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/apps/web/.next/static/chunks/0e0fmyr3zozkx.js +5 -0
- package/.next/standalone/apps/web/.next/static/chunks/{10~9n6f7thxf2.js → 0k3fz-f35j.vf.js} +1 -1
- package/.next/standalone/apps/web/.next/static/chunks/0k40f3q-emtpq.js +6 -0
- package/.next/standalone/apps/web/.next/static/chunks/{0js0-6if09qdg.js → 0v74iyx_wnwnw.js} +1 -1
- package/.next/standalone/apps/web/.next/static/chunks/0wg~4f4ytbgwu.js +1 -0
- package/.next/standalone/apps/web/.next/static/chunks/{17a.jnkt2t63-.css → 10fqyxhxwwdyy.css} +1 -1
- package/.next/standalone/apps/web/.next/static/chunks/{06luioxl4u4qe.js → 11qlw_akft1w9.js} +1 -1
- package/npm-shrinkwrap.json +49 -49
- package/package.json +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/_0gzw46w._.js +0 -3
- package/.next/standalone/apps/web/.next/server/chunks/ssr/apps_web_src_app_tasks_layout_tsx_0hv_h45._.js +0 -3
- package/.next/standalone/apps/web/.next/static/chunks/043fskg~m3moq.js +0 -1
- package/.next/standalone/apps/web/.next/static/chunks/0ib..rzpm7.-s.js +0 -6
- package/.next/standalone/apps/web/.next/static/chunks/0ur9k0wvs407q.js +0 -5
- /package/.next/standalone/apps/web/.next/static/{ijmt54NtHYZN8O-IqCrAe → cyJwJnHI5QJBS5yCGq9h6}/_buildManifest.js +0 -0
- /package/.next/standalone/apps/web/.next/static/{ijmt54NtHYZN8O-IqCrAe → cyJwJnHI5QJBS5yCGq9h6}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/apps/web/.next/static/{ijmt54NtHYZN8O-IqCrAe → cyJwJnHI5QJBS5yCGq9h6}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,82341,e=>{"use strict";var t=e.i(18050),s=e.i(71645),a=e.i(18566),r=e.i(471),l=e.i(75254);let n=(0,l.default)("flask-conical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]);var i=e.i(70935);let o=(0,l.default)("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]),c=(0,l.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"}]]);var d=e.i(55716),u=e.i(46349),u=u;let m=(0,l.default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);var x=e.i(85902);function h({node:e,isSelected:s,isExpanded:a,depth:r,onSelect:l,onToggle:n}){let i=e.children&&e.children.length>0;return(0,t.jsxs)("div",{onClick:()=>{l(),i&&n&&!a&&n()},className:`
|
|
2
|
+
flex items-center gap-2 px-2 py-1.5 rounded cursor-pointer
|
|
3
|
+
transition-colors
|
|
4
|
+
${s?"bg-accent":"hover:bg-accent"}
|
|
5
|
+
`,style:{paddingLeft:`${16*r+8}px`},children:[i&&(0,t.jsx)(x.Button,{variant:"ghost",size:"icon-xs",onClick:e=>{e.stopPropagation(),n&&n()},className:"size-4",children:a?(0,t.jsx)(m,{className:"w-3 h-3 text-muted-foreground"}):(0,t.jsx)(u.default,{className:"w-3 h-3 text-muted-foreground"})}),!i&&(0,t.jsx)("div",{className:"w-3"}),(0,t.jsx)("div",{className:"text-foreground",children:(()=>{switch(e.type){case"global":return(0,t.jsx)(o,{className:"w-4 h-4"});case"owner":return(0,t.jsx)(c,{className:"w-4 h-4"});case"repo":return(0,t.jsx)(d.GitBranch,{className:"w-4 h-4"})}})()}),(0,t.jsx)("span",{className:"text-sm text-foreground truncate",children:e.label})]})}function p({selectedNode:e,onNodeSelect:a,refreshKey:r}){let[l,n]=(0,s.useState)([]),[o,c]=(0,s.useState)(new Set),[d,u]=(0,s.useState)(!0);(0,s.useEffect)(()=>{let e=localStorage.getItem("tsunagi:env-tree-expanded");if(e)try{let t=JSON.parse(e);c(new Set(t))}catch(e){console.error("Failed to parse expanded owners:",e)}},[]),(0,s.useEffect)(()=>{localStorage.setItem("tsunagi:env-tree-expanded",JSON.stringify([...o]))},[o]),(0,s.useEffect)(()=>{(async()=>{u(!0);try{let e=await fetch((0,i.apiUrl)("/api/owners"));if(!e.ok)throw Error("Failed to fetch owners");let t=((await e.json()).data.owners||[]).map(e=>({id:`owner:${e.name}`,type:"owner",label:e.name,scope:"owner",owner:e.name,children:e.repositories.map(e=>({id:`repo:${e.owner}/${e.repo}`,type:"repo",label:e.repo,scope:"repo",owner:e.owner,repo:e.repo}))}));n([{id:"global",type:"global",label:"Global",scope:"global"},...t])}catch(e){console.error("Failed to load tree:",e)}finally{u(!1)}})()},[r]);let m=(s,r=0)=>{let l=e?.scope===s.scope&&e?.owner===s.owner&&e?.repo===s.repo,n=o.has(s.id);return(0,t.jsxs)("div",{children:[(0,t.jsx)(h,{node:s,isSelected:l,isExpanded:n,depth:r,onSelect:()=>{a({scope:s.scope,owner:s.owner,repo:s.repo,label:s.label})},onToggle:()=>{var e;return e=s.id,void c(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})}}),n&&s.children?.map(e=>m(e,r+1))]},s.id)};return d?(0,t.jsx)("div",{className:"p-4 text-muted-foreground text-sm",children:"Loading..."}):0===l.length?(0,t.jsx)("div",{className:"p-4 text-muted-foreground text-sm",children:"No repositories found"}):(0,t.jsx)("div",{className:"h-full overflow-y-auto",children:(0,t.jsx)("div",{className:"p-2",children:l.map(e=>m(e))})})}var g=e.i(7233),f=e.i(37727),j=e.i(43531);let v=(0,l.default)("clipboard-paste",[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]),b=/^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/,N=/^(?:export\s+|set\s+|\$env:)/i;var y=e.i(57024),k=e.i(86536),w=e.i(77705),C=e.i(27612),S=e.i(88699),L=e.i(10012);function E({variable:e,onToggle:a,onDelete:r,onUpdate:l,isDeletable:n=!0}){let[i,o]=(0,s.useState)(!1),[c,d]=(0,s.useState)(!1),[u,m]=(0,s.useState)(!1),[h,p]=(0,s.useState)(e.value),g=async t=>{d(!0);try{await a(e.key,t.target.checked)}finally{d(!1)}},v=async()=>{await r(e.key)},b=async()=>{try{await l(e.key,h),m(!1)}catch(e){console.error("Failed to update variable:",e),alert("Failed to update variable")}};return(0,t.jsxs)("div",{className:"border border-border rounded p-3 space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-sm font-mono text-foreground",children:e.key}),!u&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,t.jsx)("input",{type:"checkbox",checked:e.enabled,onChange:g,disabled:c,className:"w-4 h-4 cursor-pointer"}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:"Enabled"})]}),(0,t.jsx)(x.Button,{variant:"ghost",size:"icon-lg",onClick:()=>o(!i),title:i?"Hide value":"Show value",children:i?(0,t.jsx)(w.EyeOff,{className:"w-4 h-4 text-muted-foreground"}):(0,t.jsx)(k.Eye,{className:"w-4 h-4 text-muted-foreground"})}),(0,t.jsx)(x.Button,{variant:"ghost",size:"icon-lg",onClick:()=>{m(!0),p(e.value)},title:"Edit",children:(0,t.jsx)(S.Pencil,{className:"w-4 h-4 text-muted-foreground"})}),n&&(0,t.jsx)(x.Button,{variant:"ghost",size:"icon-lg",onClick:v,title:"Delete",children:(0,t.jsx)(C.Trash2,{className:"w-4 h-4 text-destructive"})})]})]}),u?(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(L.Input,{type:"password",value:h,onChange:e=>p(e.target.value),className:"w-full font-mono",autoFocus:!0}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(x.Button,{variant:"outline",size:"sm",onClick:()=>{m(!1),p(e.value)},className:"active:scale-95",children:(0,t.jsx)(f.X,{className:"w-4 h-4"})}),(0,t.jsx)(x.Button,{size:"sm",onClick:b,className:"active:scale-95",children:(0,t.jsx)(j.Check,{className:"w-4 h-4"})})]})]}):(0,t.jsx)("div",{children:(0,t.jsx)(L.Input,{type:i?"text":"password",value:e.value,readOnly:!0,className:"w-full font-mono"})})]})}var z=e.i(37870),O=e.i(68995);let $=["ANTHROPIC_API_KEY","CLAUDE_CODE_OAUTH_TOKEN","CLAUDE_CONFIG_DIR","TSUNAGI_CLAUDE_PROFILE","CODEX_API_KEY","CODEX_ACCESS_TOKEN","CODEX_HOME","TSUNAGI_CODEX_PROFILE"];function M({selectedNode:e}){let[a,r]=(0,s.useState)([]),[l,n]=(0,s.useState)(!0),[o,c]=(0,s.useState)(null),[d,u]=(0,s.useState)(!1),[m,h]=(0,s.useState)(""),[p,k]=(0,s.useState)(""),[w,C]=(0,s.useState)(""),[S,D]=(0,s.useState)(null),P=async()=>{let t=new URLSearchParams({scope:e.scope});e.owner&&t.set("owner",e.owner),e.repo&&t.set("repo",e.repo);let s=await fetch((0,i.apiUrl)(`/api/env/list?${t}`));if(!s.ok)throw Error("Failed to fetch environment variables");return(await s.json()).data.envVars||[]};(0,s.useEffect)(()=>{(async()=>{n(!0),c(null);try{let t=new URLSearchParams({scope:e.scope});e.owner&&t.set("owner",e.owner),e.repo&&t.set("repo",e.repo);let s=await fetch((0,i.apiUrl)(`/api/env/list?${t}`));if(!s.ok)throw Error("Failed to fetch environment variables");let a=await s.json();r(a.data.envVars||[])}catch(e){console.error("Failed to load environment variables:",e),c("Failed to load environment variables")}finally{n(!1)}})()},[e]);let U=async(t,s)=>{try{if(!(await fetch((0,i.apiUrl)("/api/env/toggle"),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:t,scope:e.scope,owner:e.owner,repo:e.repo,enabled:s})})).ok)throw Error("Failed to toggle environment variable");r(e=>e.map(e=>e.key===t?{...e,enabled:s}:e))}catch(e){console.error("Failed to toggle environment variable:",e),r(e=>e.map(e=>e.key===t?{...e,enabled:!s}:e))}},I=async t=>{if(confirm(`Delete ${t}?`))try{let s=new URLSearchParams({key:t,scope:e.scope});if(e.owner&&s.set("owner",e.owner),e.repo&&s.set("repo",e.repo),!(await fetch((0,i.apiUrl)(`/api/env?${s}`),{method:"DELETE"})).ok)throw Error("Failed to delete environment variable");r(e=>e.filter(e=>e.key!==t))}catch(e){console.error("Failed to delete environment variable:",e),alert("Failed to delete environment variable")}},T=async(t,s)=>{try{if(!(await fetch((0,i.apiUrl)("/api/env"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:t,value:s,scope:e.scope,owner:e.owner,repo:e.repo})})).ok)throw Error("Failed to update environment variable");r(e=>e.map(e=>e.key===t?{...e,value:s}:e))}catch(e){throw console.error("Failed to update environment variable:",e),e}},F=async()=>{var t;if(C(""),!m.trim())return void C("Key is required");if(!p.trim())return void C("Value is required");if(t=m.trim(),/^[A-Z0-9_]+$/.test(t)?$.includes(t)?(C("エージェントの認証は Claude Profile / Codex Profile で設定してください"),!1):!a.some(e=>e.key===t)||(C(`Key "${t}" already exists in this scope`),!1):(C("Key must contain only uppercase letters, numbers, and underscores"),!1))try{if(!(await fetch((0,i.apiUrl)("/api/env"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:m.trim(),value:p.trim(),scope:e.scope,owner:e.owner,repo:e.repo})})).ok)throw Error("Failed to add environment variable");let t=new URLSearchParams({scope:e.scope});e.owner&&t.set("owner",e.owner),e.repo&&t.set("repo",e.repo);let s=await fetch((0,i.apiUrl)(`/api/env/list?${t}`));if(s.ok){let e=await s.json();r(e.data.envVars||[])}u(!1),h(""),k("")}catch(e){console.error("Failed to add environment variable:",e),C("Failed to add environment variable")}},B=()=>{u(!1),h(""),k(""),C("")},A=async t=>{C("");try{let s=await fetch((0,i.apiUrl)("/api/env/bulk"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:e.scope,owner:e.owner,repo:e.repo,vars:t})});if(!s.ok){let e=await s.json().catch(()=>null);throw Error(e?.error||"Failed to import environment variables")}r(await P()),B(),y.toaster.create({type:"success",title:`Imported ${t.length} variable${1===t.length?"":"s"}`,description:t.map(e=>e.key).join(", ")})}catch(e){console.error("Failed to import environment variables:",e),C(e instanceof Error?e.message:"Failed to import environment variables")}};return l?(0,t.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,t.jsx)(z.LoadingSpinner,{size:"md",message:"Loading variables..."})}):o?(0,t.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,t.jsx)("div",{className:"text-destructive text-sm",children:o})}):(0,t.jsxs)("div",{className:"h-full flex flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsx)("h2",{className:"text-lg font-bold text-foreground",children:"Environment Variables"}),!d&&(0,t.jsxs)(x.Button,{size:"sm",onClick:()=>u(!0),className:"active:scale-95",children:[(0,t.jsx)(g.Plus,{className:"w-4 h-4"}),"Add Variable"]})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto space-y-3",children:[d&&(0,t.jsxs)("div",{className:"border border-border rounded p-3 bg-accent space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("div",{className:"text-sm font-medium text-foreground",children:"New Variable"}),(0,t.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",title:"Paste `export KEY=value` / `KEY=value` / `SET KEY=value` lines to import them all at once",children:[(0,t.jsx)(v,{className:"w-3.5 h-3.5"}),(0,t.jsx)("span",{children:"Paste to import"})]})]}),(0,t.jsx)(L.Input,{type:"text",value:m,onChange:e=>h(e.target.value.toUpperCase()),onPaste:e=>{let t=function(e){let t=new Map,s=0;for(let a of e.split(/\r?\n/)){let e=a.trim();if(!e||e.startsWith("#")||e.startsWith(";")||/^\[.*\]$/.test(e))continue;let r=b.exec(e.replace(N,""));if(!r){s++;continue}let l=function(e){let t=e.trim();if(t.length>=2){let e=t[0],s=t[t.length-1];if(('"'===e||"'"===e)&&e===s)return t.slice(1,-1)}return t}(r[2]);if(!l||l.startsWith("=")){s++;continue}let n=r[1].toUpperCase();t.delete(n),t.set(n,l)}return{entries:Array.from(t,([e,t])=>({key:e,value:t})),unparsedLineCount:s}}(e.clipboardData.getData("text"));if(!(t.entries.length>0&&0===t.unparsedLineCount))return;e.preventDefault(),C("");let s=t.entries.filter(e=>$.includes(e.key)),r=t.entries.filter(e=>!$.includes(e.key));if(s.length>0&&y.toaster.create({type:"warning",title:"Skipped reserved keys",description:`${s.map(e=>e.key).join(", ")} — エージェントの認証は Claude Profile / Codex Profile で設定してください`}),0===r.length)return;let l=new Set(a.map(e=>e.key)),n=r.filter(e=>l.has(e.key)).map(e=>e.key);n.length>0?D({entries:r,overwriting:n}):A(r)},placeholder:"VARIABLE_NAME",className:"w-full font-mono",autoFocus:!0}),(0,t.jsx)(L.Input,{type:"password",value:p,onChange:e=>k(e.target.value),placeholder:"value",className:"w-full font-mono"}),w&&(0,t.jsx)("div",{className:"text-xs text-destructive",children:w}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(x.Button,{variant:"outline",size:"sm",onClick:B,className:"active:scale-95",children:(0,t.jsx)(f.X,{className:"w-4 h-4"})}),(0,t.jsx)(x.Button,{size:"sm",onClick:F,className:"active:scale-95",children:(0,t.jsx)(j.Check,{className:"w-4 h-4"})})]})]}),0!==a.length||d?a.map(e=>(0,t.jsx)(E,{variable:e,onToggle:U,onDelete:I,onUpdate:T,isDeletable:!0},e.key)):(0,t.jsx)("div",{className:"text-center text-muted-foreground text-sm py-4",children:"No environment variables"})]}),(0,t.jsx)(O.ConfirmDialog,{open:null!==S,onOpenChange:({open:e})=>{e||D(null)},title:"Overwrite existing variables?",message:(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("p",{children:"The following variables already exist in this scope and will be overwritten:"}),(0,t.jsx)("ul",{className:"font-mono text-foreground list-disc pl-5",children:S?.overwriting.map(e=>(0,t.jsx)("li",{children:e},e))})]}),confirmLabel:"Overwrite",variant:"danger",onConfirm:()=>{S&&A(S.entries)}})]})}var D=e.i(61653),D=D,P=e.i(78917);let U=(0,l.default)("log-in",[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]]),I=(0,l.default)("user-round",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);var T=e.i(28962),F=e.i(52088),B=e.i(1048),A=e.i(67211),u=u;async function R(e,t){let s=await fetch((0,i.apiUrl)(e),t),a=await s.json().catch(()=>null);if(!s.ok||a?.data===void 0)throw Error(a?.error||`HTTPエラー: ${s.status}`);return a.data}function _(e,t){return R(e,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}function G(e){return e instanceof Error?e.message:String(e)}function X({children:e}){return(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-2 rounded-md border border-border bg-muted/30 px-3 py-2 text-sm",children:e})}function V({label:e,hint:s,children:a}){return(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:e}),a,s&&(0,t.jsx)("p",{className:"mt-1 text-[0.65rem] text-muted-foreground",children:s})]})}function H({children:e}){let[a,r]=(0,s.useState)(!1);return(0,t.jsxs)("div",{children:[(0,t.jsxs)("button",{type:"button",onClick:()=>r(e=>!e),className:"flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground",children:[(0,t.jsx)(u.default,{className:`size-3.5 transition-transform ${a?"rotate-90":""}`}),"詳細設定"]}),a&&(0,t.jsx)("div",{className:"mt-3 flex flex-col gap-3 border-l border-border pl-3",children:e})]})}function q({children:e}){return(0,t.jsx)("code",{className:"rounded bg-muted px-1",children:e})}let K={claude:"ブラウザで認証してください。ブラウザが開かない場合は表示された URL を開き、表示されたコードをこのターミナルに貼り付けます。",codex:"ブラウザで認証してください。ブラウザが開かない場合は表示された URL を開きます。ログイン済みの場合、今のログインはこの時点で解除されています。"};function W({sessionId:e}){let[a,r]=(0,s.useState)(""),[l,n]=(0,s.useState)(!1),[i,o]=(0,s.useState)(null);return(0,t.jsxs)("form",{onSubmit:t=>{t.preventDefault(),n(!0),o(null),R(`/api/agent-profiles/login/${e}/callback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:a})}).then(()=>r("")).catch(e=>o(G(e))).finally(()=>n(!1))},className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"認証後にブラウザが 127.0.0.1 のページを開けなかったら、そのアドレスバーの URL を貼り付けてください。"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(L.Input,{value:a,onChange:e=>r(e.target.value),placeholder:"http://127.0.0.1:1455/auth/callback?code=...","aria-label":"Callback URL"}),(0,t.jsx)(x.Button,{type:"submit",disabled:!a.trim()||l,children:"Submit"})]}),i&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:i})]})}function J({profile:e,onClose:a}){let[r,l]=(0,s.useState)(null),n=r?.sessionId??null,[o,c]=(0,s.useState)(null),[d,u]=(0,s.useState)(null);(0,s.useEffect)(()=>{let t=null,s=!1;return R(`/api/agent-profiles/${e.agent}/${e.slug}/login`,{method:"POST"}).then(e=>{(t=e.sessionId,s)?fetch((0,i.apiUrl)(`/api/agent-profiles/login/${t}`),{method:"DELETE"}):l(e)}).catch(e=>c(G(e))),()=>{s=!0,t&&fetch((0,i.apiUrl)(`/api/agent-profiles/login/${t}`),{method:"DELETE"})}},[e.agent,e.slug]);let m=d?.loggedIn??!1;return(0,s.useEffect)(()=>{if(!n||m)return;let t=setInterval(()=>{R(`/api/agent-profiles/${e.agent}/${e.slug}/status`).then(t=>{t.status.loggedIn&&!e.status.loggedIn&&u(t.status)}).catch(()=>void 0)},2e3);return()=>clearInterval(t)},[n,m,e.agent,e.slug,e.status.loggedIn]),(0,t.jsx)(O.Dialog,{open:!0,onOpenChange:e=>{e.open||a()},title:`Login: ${e.name}`,maxWidth:"4xl",children:(0,t.jsxs)("div",{className:"space-y-3",children:[m&&d?(0,t.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-success/30 bg-success/10 px-3 py-2 text-sm text-success",children:[(0,t.jsx)(B.CircleCheck,{className:"size-4"}),(0,t.jsxs)("span",{className:"flex-1",children:["Logged in",d.email?` as ${d.email}`:"",d.orgName?` (${d.orgName})`:""]}),(0,t.jsx)(x.Button,{size:"sm",onClick:a,children:"Done"})]}):(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[K[e.agent],e.status.loggedIn&&" 再ログインが終わったら閉じてください。"]}),!m&&r?.callbackPaste&&(0,t.jsx)(W,{sessionId:r.sessionId}),(0,t.jsx)("div",{className:"h-[420px] overflow-hidden rounded-md border border-border",children:o?(0,t.jsx)("div",{className:"flex h-full items-center justify-center text-sm text-destructive",children:o}):n?(0,t.jsx)(A.TerminalView,{tabId:n,isActive:!0}):(0,t.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,t.jsx)(z.LoadingSpinner,{size:"sm",message:"Starting..."})})})]})})}let Y="default",Z={claude:{label:"Claude",cliLabel:"Claude Code",installUrl:"https://docs.claude.com/en/docs/claude-code/overview",configDirEnv:"CLAUDE_CONFIG_DIR",defaultConfigDir:"~/.claude",loginCommand:"claude auth login"},codex:{label:"Codex",cliLabel:"Codex",installUrl:"https://developers.openai.com/codex/cli",configDirEnv:"CODEX_HOME",defaultConfigDir:"~/.codex",loginCommand:"codex login"}},Q=Object.keys(Z),ee=/^[A-Za-z0-9 _-]+$/;function et(e){return e.trim().replace(/\s+/g,"-").toLowerCase()}function es({agent:e,availability:s}){let a=Z[e];return!s||s.supported?null:(0,t.jsxs)("p",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[(0,t.jsx)(D.default,{className:"size-4 shrink-0 text-warning"}),s.installed?(0,T.agentOutdatedReason)(a.cliLabel,s):(0,t.jsxs)("span",{children:[a.cliLabel," の CLI が見つかりません。",(0,t.jsxs)("a",{href:a.installUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-0.5 text-primary hover:underline",children:["インストール",(0,t.jsx)(P.ExternalLink,{className:"size-3"})]}),"すると使えます"]})]})}function ea({agent:e,availability:a,selectedNode:r}){let l,n=Z[e],o=`${n.label} Profile`,[c,d]=(0,s.useState)(null),[u,m]=(0,s.useState)(null),[h,p]=(0,s.useState)(null),[v,b]=(0,s.useState)(!1),[N,k]=(0,s.useState)(""),[w,S]=(0,s.useState)(null),[E,$]=(0,s.useState)(null),M="global"===r.scope,P=a?.installed===!1,T=(0,s.useCallback)(async()=>{try{let t=await R(`/api/agent-profiles/${e}`);d(t.profiles)}catch(e){p(G(e))}},[e]),B=(0,s.useCallback)(async()=>{try{let t,s=await R(`/api/agent-profiles/${e}/assignment?${(t=new URLSearchParams({scope:r.scope}),r.owner&&t.set("owner",r.owner),r.repo&&t.set("repo",r.repo),t.toString())}`);m(s.assignment)}catch(e){p(G(e))}},[e,r]);(0,s.useEffect)(()=>{T()},[T]),(0,s.useEffect)(()=>{m(null),B()},[B]);let A=async t=>{try{let s=await R(`/api/agent-profiles/${e}/assignment`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:r.scope,owner:r.owner,repo:r.repo,slug:""===t?null:t})});m(s.assignment)}catch(e){y.toaster.create({type:"error",title:"プロファイルを変更できません",description:G(e)})}},_=async()=>{try{let t=await R(`/api/agent-profiles/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:N.trim()})});b(!1),k(""),await T(),S(t.profile.slug)}catch(e){y.toaster.create({type:"error",title:"プロファイルを追加できません",description:G(e)})}},X=async t=>{try{let s=await fetch((0,i.apiUrl)(`/api/agent-profiles/${e}/${t.slug}`),{method:"DELETE"});if(!s.ok)throw Error(`HTTPエラー: ${s.status}`);await Promise.all([T(),B()])}catch(e){y.toaster.create({type:"error",title:"プロファイルを削除できません",description:G(e)})}};if(h)return(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsx)("h2",{className:"text-lg font-bold text-foreground",children:o}),(0,t.jsx)("p",{className:"text-sm text-destructive",children:h})]});if(!c||!u)return(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsx)("h2",{className:"text-lg font-bold text-foreground",children:o}),(0,t.jsx)(z.LoadingSpinner,{size:"sm",message:"Loading profiles..."})]});let H=function(e,t){let s=e.trim();if(!s)return null;if(!ee.test(s))return'Use only letters, numbers, spaces, "-" and "_"';let a=et(s);return t.some(e=>e.slug===a)?`"${a}" already exists`:null}(N,c),K=c.find(e=>e.slug===w);return(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("h2",{className:"text-lg font-bold text-foreground",children:o}),(0,t.jsx)(es,{agent:e,availability:a})]}),(0,t.jsxs)("fieldset",{disabled:P,className:(0,F.cn)("min-w-0 space-y-3",P&&"opacity-50"),children:[(0,t.jsx)(V,{label:M?"Default profile":"Profile for this scope",hint:`このスコープのタスクのターミナル・${n.label} で使うアカウント。変更は開いているタブにも自動で反映されます`,children:(0,t.jsxs)("select",{value:u.assigned??"",onChange:e=>void A(e.target.value),className:"h-9 w-full rounded-md border border-input bg-transparent pl-3 pr-10 text-sm text-foreground shadow-xs",children:[!M&&(0,t.jsxs)("option",{value:"",children:["Inherit (",(l=u.effective,c.find(e=>e.slug===l)?.name??l),")"]}),c.map(e=>(0,t.jsx)("option",{value:M&&e.slug===Y?"":e.slug,children:e.name},e.slug))]})}),M&&(0,t.jsxs)("div",{className:"space-y-2",children:[c.map(e=>{var s;return(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-md border border-border p-3",children:[(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,t.jsx)(I,{className:"size-4 shrink-0 text-muted-foreground"}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("div",{className:"text-sm font-medium text-foreground",children:e.name}),!P&&(0,t.jsxs)("div",{className:"flex items-center gap-1 truncate text-xs text-muted-foreground",children:[e.status.loggedIn?(0,t.jsx)(j.Check,{className:"size-3 shrink-0 text-success"}):(0,t.jsx)(D.default,{className:"size-3 shrink-0 text-warning"}),(0,t.jsx)("span",{className:"truncate",children:(s=e.status).loggedIn?[s.email,s.orgName??s.subscriptionType].filter(Boolean).join(" · ")||s.authMethod||"Logged in":"Not logged in"})]}),(0,t.jsx)("div",{className:"truncate text-[0.65rem] text-muted-foreground",children:(0,t.jsx)(q,{children:e.configDir??`${n.configDirEnv} 未指定(${n.defaultConfigDir})`})})]})]}),(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(0,t.jsxs)(x.Button,{variant:e.status.loggedIn?"ghost":"default",size:"sm",onClick:()=>S(e.slug),title:n.loginCommand,children:[(0,t.jsx)(U,{className:"size-4"}),e.status.loggedIn?"Re-login":"Login"]}),e.slug!==Y&&(0,t.jsx)(x.Button,{variant:"ghost",size:"icon",onClick:()=>$(e),className:"hover:bg-destructive/10",title:"Delete",children:(0,t.jsx)(C.Trash2,{className:"size-4 text-destructive"})})]})]},e.slug)}),v?(0,t.jsxs)("div",{className:"space-y-2 rounded-md border border-border bg-accent p-3",children:[(0,t.jsx)(L.Input,{value:N,onChange:e=>k(e.target.value),onKeyDown:e=>{"Enter"===e.key&&N.trim()&&!H&&_()},placeholder:"Profile name (e.g. work)",autoFocus:!0}),H?(0,t.jsx)("p",{className:"text-xs text-destructive",children:H}):N.trim()&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:(0,t.jsxs)(q,{children:["~/.tsunagi/",e,"-profiles/",et(N)]})}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(x.Button,{variant:"outline",size:"sm",onClick:()=>{b(!1),k("")},children:(0,t.jsx)(f.X,{className:"size-4"})}),(0,t.jsx)(x.Button,{size:"sm",onClick:()=>void _(),disabled:!N.trim()||!!H,children:(0,t.jsx)(j.Check,{className:"size-4"})})]})]}):(0,t.jsxs)(x.Button,{variant:"outline",size:"sm",onClick:()=>b(!0),children:[(0,t.jsx)(g.Plus,{className:"size-4"}),"Add Profile"]})]})]}),K&&(0,t.jsx)(J,{profile:K,onClose:()=>{S(null),T()}}),(0,t.jsx)(O.ConfirmDialog,{open:null!==E,onOpenChange:e=>{e.open||$(null)},title:"Delete Profile",message:E?`${E.name} からログアウトし、${E.configDir} を削除します。このプロファイルを使っているスコープは親の設定を継承します。`:"",confirmLabel:"Delete",variant:"danger",onConfirm:()=>{E&&X(E)}})]})}let er=(0,l.default)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);var el=e.i(5352);function en(){let[e,a]=(0,s.useState)([]),[r,l]=(0,s.useState)({}),[n,o]=(0,s.useState)(null),[c,d]=(0,s.useState)(!1),[u,h]=(0,s.useState)(!1),p=(0,s.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch((0,i.apiUrl)("/api/repos")).then(e=>e.json()),fetch((0,i.apiUrl)("/api/tasks")).then(e=>e.json())]);a(e.data??[]);let s={};for(let e of t.data?.tasks??[]){let t=`${e.owner}/${e.repo}`;s[t]=(s[t]??0)+1}l(s)}catch(e){console.error("Failed to load repositories:",e)}},[]);(0,s.useEffect)(()=>{p()},[p]);let g=async()=>{if(n){d(!0);try{if(!(await fetch((0,i.apiUrl)(`/api/repos/${n.owner}/${n.repo}`),{method:"DELETE"})).ok)throw Error("Failed to delete repository");await p()}catch(e){console.error("Failed to delete repository:",e)}finally{d(!1),o(null)}}},f=(0,s.useCallback)(async(t,s)=>{let r=t+s;if(r<0||r>=e.length)return;let l=[...e];[l[t],l[r]]=[l[r],l[t]],a(l.map((e,t)=>({...e,order:t}))),h(!0);try{if(!(await fetch((0,i.apiUrl)("/api/repos/reorder"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({repoIds:l.map(e=>e.id)})})).ok)throw Error("Failed to reorder repositories")}catch(e){console.error("Failed to reorder repositories:",e),await p()}finally{h(!1)}},[e,p]);return 0===e.length?(0,t.jsx)("div",{className:"text-sm text-muted-foreground",children:"No repositories cloned yet."}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(O.ConfirmDialog,{open:null!==n,onOpenChange:e=>{e.open||o(null)},title:"Delete Repository",message:n?`Delete ${n.owner}/${n.repo}? This will also delete ${r[`${n.owner}/${n.repo}`]??0} associated task(s), all worktrees, and the bare repository. This action cannot be undone.`:"",confirmLabel:c?"Deleting...":"Delete",cancelLabel:"Cancel",onConfirm:g,variant:"danger"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"この並び順がトップページの列の並び順になります"}),(0,t.jsx)("div",{className:"space-y-2",children:e.map((s,a)=>{let l=`${s.owner}/${s.repo}`,n=(0,el.getRepoColor)(s.owner,s.repo),i=r[l]??0;return(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-md border border-border p-3",children:[(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,t.jsx)("span",{className:`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium ${n.bg} ${n.text}`,children:l}),(0,t.jsxs)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[i," task",1!==i?"s":""]})]}),(0,t.jsxs)("div",{className:"flex flex-shrink-0 items-center",children:[(0,t.jsx)(x.Button,{variant:"ghost",size:"icon",onClick:()=>f(a,-1),disabled:0===a||u,className:"text-muted-foreground",title:"Move up",children:(0,t.jsx)(er,{className:"size-4"})}),(0,t.jsx)(x.Button,{variant:"ghost",size:"icon",onClick:()=>f(a,1),disabled:a===e.length-1||u,className:"text-muted-foreground",title:"Move down",children:(0,t.jsx)(m,{className:"size-4"})}),(0,t.jsx)(x.Button,{variant:"ghost",size:"icon",onClick:()=>o(s),className:"text-muted-foreground hover:text-destructive",title:"Delete repository",children:(0,t.jsx)(C.Trash2,{className:"size-4"})})]})]},s.id)})})]})}var ei=e.i(69068);function eo({owner:e,repo:a,onDeleted:r}){let[l,n]=(0,s.useState)(!1),[o,c]=(0,s.useState)(""),[d,u]=(0,s.useState)(!1),m=`${e}/${a}`,h=o===m,p=async()=>{if(h){u(!0);try{if(!(await fetch((0,i.apiUrl)(`/api/repos/${e}/${a}`),{method:"DELETE"})).ok)throw Error("Failed to delete repository");r()}catch(e){console.error("Failed to delete repository:",e)}finally{u(!1),n(!1),c("")}}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"rounded-md border border-destructive/30 p-4 space-y-3",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-destructive",children:"Remove Repository"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Remove this repository and all associated data including tasks, worktrees, and environment variables. This action cannot be undone."})]}),(0,t.jsxs)(x.Button,{variant:"destructive",size:"sm",onClick:()=>n(!0),children:[(0,t.jsx)(C.Trash2,{className:"size-4"}),"Remove Repository"]})]}),(0,t.jsx)(ei.Dialog,{open:l,onOpenChange:n,children:(0,t.jsxs)(ei.DialogContent,{showCloseButton:!1,children:[(0,t.jsxs)(ei.DialogHeader,{children:[(0,t.jsx)(ei.DialogTitle,{children:"Remove Repository"}),(0,t.jsxs)(ei.DialogDescription,{children:["This will permanently delete ",(0,t.jsx)("strong",{children:m})," and all associated tasks, worktrees, and environment variables."]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"text-xs text-muted-foreground",children:["Type ",(0,t.jsx)("strong",{children:m})," to confirm"]}),(0,t.jsx)(L.Input,{value:o,onChange:e=>c(e.target.value),placeholder:m,autoComplete:"off"})]}),(0,t.jsxs)(ei.DialogFooter,{children:[(0,t.jsx)(x.Button,{variant:"outline",size:"sm",onClick:()=>{n(!1),c("")},disabled:d,children:"Cancel"}),(0,t.jsx)(x.Button,{variant:"destructive",size:"sm",onClick:p,disabled:!h||d,children:d?"Removing...":"Remove"})]})]})})]})}let ec=(0,l.default)("mic",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]]);function ed(){return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:"Voice Input"}),(0,t.jsxs)("div",{className:"flex items-center gap-3 rounded-md border border-border p-3",children:[(0,t.jsx)(ec,{className:"size-4 shrink-0 text-muted-foreground"}),(0,t.jsx)("p",{className:"min-w-0 flex-1 text-sm text-muted-foreground",children:"音声入力は mukuchi(macOS / Windows・無料)をご利用ください。話した内容をターミナルにそのまま入力できます"}),(0,t.jsxs)("a",{href:"https://mukuchi.minimalcorp.com/",target:"_blank",rel:"noreferrer",className:"inline-flex h-8 shrink-0 items-center gap-1 rounded-md border border-input bg-background px-3 text-sm shadow-xs transition-colors hover:bg-accent",children:["mukuchi",(0,t.jsx)(P.ExternalLink,{className:"size-3"})]})]})]})}var eu=e.i(31278);function em({className:e,size:s="default",...a}){return(0,t.jsx)("div",{"data-slot":"card","data-size":s,className:(0,F.cn)("group/card flex flex-col gap-4 overflow-hidden rounded-lg bg-card py-4 text-xs/relaxed text-card-foreground ring-1 ring-foreground/10 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 *:[img:first-child]:rounded-t-lg *:[img:last-child]:rounded-b-lg",e),...a})}function ex({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-header",className:(0,F.cn)("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-lg px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",e),...s})}function eh({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-title",className:(0,F.cn)("font-heading text-sm font-medium",e),...s})}function ep({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-description",className:(0,F.cn)("text-xs/relaxed text-muted-foreground",e),...s})}function eg({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-content",className:(0,F.cn)("px-4 group-data-[size=sm]/card:px-3",e),...s})}let ef="/api/settings/claude-tui";function ej(){let[e,a]=(0,s.useState)(null),[r,l]=(0,s.useState)(!1);(0,s.useEffect)(()=>{R(ef).then(a).catch(e=>console.error("Failed to fetch Claude TUI settings:",e))},[]);let n=(0,s.useCallback)(async e=>{l(!0);try{a(await _(ef,e))}catch(e){y.toaster.create({type:"error",title:"画面描画の設定を保存できませんでした",description:G(e)})}finally{l(!1)}},[]);return(0,t.jsxs)(em,{children:[(0,t.jsxs)(ex,{children:[(0,t.jsx)(eh,{children:"Claude Code の画面描画"}),(0,t.jsxs)(ep,{children:["fullscreen レンダラでは、会話ログが重複・ループして表示される問題が起きません。OFF にすると Claude Code 自身の設定(",(0,t.jsx)(q,{children:"/tui"}),")に従います。起動中のタブは 応答が終わった後に再起動して反映されます。"]})]}),(0,t.jsx)(eg,{children:e?(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)("input",{type:"checkbox",checked:e.fullscreen,disabled:r,onChange:e=>void n({fullscreen:e.target.checked}),className:"size-4 accent-primary"}),"fullscreen レンダラを使う(",(0,t.jsx)(q,{children:"CLAUDE_CODE_NO_FLICKER=1"}),")"]}):(0,t.jsxs)("span",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(eu.Loader2,{className:"size-4 animate-spin"}),"読み込み中..."]})})]})}var ev=e.i(63209),eb=e.i(95468);let eN=(0,l.default)("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var ey=e.i(66992);let ek=(0,l.default)("memory-stick",[["path",{d:"M12 12v-2",key:"fwoke6"}],["path",{d:"M12 18v-2",key:"qj6yno"}],["path",{d:"M16 12v-2",key:"heuere"}],["path",{d:"M16 18v-2",key:"s1ct0w"}],["path",{d:"M2 11h1.5",key:"15p63e"}],["path",{d:"M20 18v-2",key:"12ehxp"}],["path",{d:"M20.5 11H22",key:"khsy7a"}],["path",{d:"M4 18v-2",key:"1c3oqr"}],["path",{d:"M8 12v-2",key:"1mwtfd"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["rect",{x:"2",y:"6",width:"20",height:"10",rx:"2",key:"1qcswk"}]]);var ew=e.i(31343);let eC=(0,l.default)("power-off",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);var eS=e.i(16715),eL=e.i(47161),eE=e.i(41247),ez=e.i(93355),eO=e.i(38078);let e$={k:1024,m:1048576},eM=[32768,65536,131072,262144];function eD(e){let t=e.trim().replace(/[,_\s]/g,"").toLowerCase().match(/^(\d+(?:\.\d+)?)([km]?)$/);if(!t)return null;let s=Number(t[1])*(t[2]?e$[t[2]]:1);return Number.isInteger(s)&&s>0?s:null}function eP(e){return e>=e$.m&&e%e$.m==0?`${e/e$.m}m`:e>=e$.k&&e%e$.k==0?`${e/e$.k}k`:String(e)}var eU=e.i(64691);function eI({value:e,onChange:a,max:r}){let l=(0,s.useId)(),n=eD(e),i=null!==n&&void 0!==r&&r>0&&n>r,o=eM.filter(e=>!r||e<=r);return(0,t.jsxs)("div",{children:[(0,t.jsx)(L.Input,{value:e,onChange:e=>a(e.target.value),placeholder:"64k",list:l,"aria-invalid":null===n||i,className:"font-mono"}),(0,t.jsx)("datalist",{id:l,children:o.map(e=>(0,t.jsx)("option",{value:eP(e)},e))}),(0,t.jsx)("p",{className:`mt-1 text-[0.65rem] ${null===n||i?"text-destructive":"text-muted-foreground"}`,children:null===n?"64k / 128k / 1m または整数で入力してください(k = 1024)":i?`このモデルの最大値(${eP(r)})を超えています`:`${n.toLocaleString()} tokens`})]})}function eT(e,t){return`${e}:${t}`}function eF(e){let t=e.indexOf(":");if(t<0)return null;let s=e.slice(0,t);return"ollama"!==s&&"lmstudio"!==s?null:{provider:s,model:e.slice(t+1)}}function eB({status:e}){let s=e.active?`${e.active.model}(${eU.LOCAL_LLM_PROVIDER_LABEL[e.active.provider]}・${eP(e.active.contextTokens)})`:"";switch(e.state){case"unconfigured":return(0,t.jsx)("span",{className:"text-muted-foreground",children:"使用するモデルが未設定です"});case"loading":return(0,t.jsxs)("span",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(eu.Loader2,{className:"size-4 animate-spin"}),"読み込み中: ",s]});case"loaded":return(0,t.jsxs)("span",{className:"flex items-center gap-2 text-success",children:[(0,t.jsx)(eb.CheckCircle2,{className:"size-4"}),"読み込み済み: ",s]});case"unloaded":return(0,t.jsxs)("span",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(ek,{className:"size-4"}),"解放済み: ",s,"(次の発言で読み込みます)"]});case"error":return(0,t.jsxs)("span",{className:"flex items-center gap-2 text-destructive",children:[(0,t.jsx)(ev.AlertCircle,{className:"size-4"}),e.error]})}}function eA(){var e;let a,{settings:r,setSettings:l}=(0,eO.useLocalLlmSettings)(),[n,i]=(0,s.useState)(null),[o,c]=(0,s.useState)(null),[d,u]=(0,s.useState)(null),[m,h]=(0,s.useState)(!1),[p,g]=(0,s.useState)(null),[f,j]=(0,s.useState)(!1),[v,b]=(0,s.useState)(!1),[N,k]=(0,s.useState)(!1);(0,s.useEffect)(()=>{var e;r&&i({selection:(e=r).active?eT(e.active.provider,e.active.model):"",context:eP(e.active?.contextTokens??65536),idleUnloadMinutes:String(e.idleUnloadMinutes),unloadOnExit:e.unloadOnExit,webSearch:e.webSearch,extraEnvText:Object.entries(e.extraEnv).map(([e,t])=>`${e}=${t}`).join("\n")})},[r]);let w=(0,s.useCallback)(async()=>{try{c(await R("/api/settings/local-llm/status"))}catch(e){console.error("Failed to fetch local LLM status:",e)}},[]),C=(0,s.useCallback)(async()=>{h(!0);try{u(await R("/api/settings/local-llm/models"))}catch(e){y.toaster.create({type:"error",title:"モデル一覧を取得できません",description:G(e)})}finally{h(!1)}},[]);(0,s.useEffect)(()=>{w(),C();let e=setInterval(()=>void w(),3e3);return()=>clearInterval(e)},[w,C]);let S=n?eF(n.selection):null,E=(0,s.useMemo)(()=>d?.models.find(e=>e.provider===S?.provider&&e.model===S?.model),[d,S?.provider,S?.model]),z=E?.maxContextLength??void 0,$=S?.provider==="lmstudio"?S.model:"",M=n?eD(n.context):null;(0,s.useEffect)(()=>{if(g(null),!$||!M)return;let e=new AbortController,t=setTimeout(()=>{let t=new URLSearchParams({model:$,contextTokens:String(M)});R(`/api/settings/local-llm/estimate?${t}`,{signal:e.signal}).then(g).catch(()=>g(null))},600);return()=>{clearTimeout(t),e.abort()}},[$,M]);let D=Number(n?.idleUnloadMinutes),P=null!==n&&(e=n.context,null!==(a=eD(e))&&(!z||a<=z))&&Number.isInteger(D)&&D>=0,U=(0,s.useCallback)(async()=>{if(!n||!P)return;let e=eF(n.selection),t={active:e?{...e,contextTokens:eD(n.context)??65536}:null,idleUnloadMinutes:Number(n.idleUnloadMinutes),unloadOnExit:n.unloadOnExit,webSearch:n.webSearch,extraEnv:function(e){let t={};for(let s of e.split("\n")){let e=s.trim();if(!e||e.startsWith("#"))continue;let a=e.indexOf("=");a<=0||(t[e.slice(0,a).trim()]=e.slice(a+1).trim())}return t}(n.extraEnvText)},s=JSON.stringify(r?.active)!==JSON.stringify(t.active);j(!0);try{l(await _("/api/settings/local-llm",t)),y.toaster.create({type:"success",title:s?"使用するモデルを切り替えました(他のモデルは解放します)":"ローカルLLMの設定を保存しました"}),w()}catch(e){y.toaster.create({type:"error",title:"ローカルLLMの設定を保存できませんでした",description:G(e)})}finally{j(!1)}},[n,P,r?.active,l,w]),I=(0,s.useCallback)(async(e,t)=>{b(!0);try{c(await R(e,{method:"POST"}))}catch(e){y.toaster.create({type:"error",title:t,description:G(e)})}finally{b(!1)}},[]),T=e=>i(t=>t?{...t,...e}:t),F=(d?.models??[]).map(e=>{var t;return{value:eT(e.provider,e.model),label:[e.displayName,e.format.toUpperCase(),e.sizeBytes?(t=e.sizeBytes)>=0x40000000?`${(t/0x40000000).toFixed(1)} GB`:`${Math.round(t/1048576)} MB`:null,e.maxContextLength?`最大 ${eP(e.maxContextLength)}`:null].filter(Boolean).join(" · "),group:eU.LOCAL_LLM_PROVIDER_LABEL[e.provider]}}),B=r?.active;B&&!F.some(e=>e.value===eT(B.provider,B.model))&&F.unshift({value:eT(B.provider,B.model),label:`${B.model}(一覧にありません)`,group:eU.LOCAL_LLM_PROVIDER_LABEL[B.provider]});let A=null!==d&&0===d.models.length&&0===d.errors.length;return(0,t.jsxs)(em,{children:[(0,t.jsxs)(ex,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(eh,{children:"Claude Code のローカルLLM"}),(0,t.jsx)(x.Button,{variant:"ghost",size:"icon-sm",onClick:()=>k(!0),title:"ローカルLLMについて",children:(0,t.jsx)(eN,{})})]}),(0,t.jsxs)(ep,{children:["Ollama / LM Studio のローカルLLMで Claude Code を起動します。",(0,t.jsx)("strong",{className:"font-medium text-foreground",children:"使用するモデルは1つだけで、全てのローカルLLMタブで共有します"}),"。切り替えると他のモデルはメモリから解放されます。"]})]}),(0,t.jsx)(eg,{className:"flex flex-col gap-3",children:r&&n?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(X,{children:[o?(0,t.jsx)(eB,{status:o}):(0,t.jsx)(eu.Loader2,{className:"size-4 animate-spin"}),(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[o?.state==="unloaded"&&(0,t.jsxs)(x.Button,{variant:"outline",size:"sm",onClick:()=>void I("/api/settings/local-llm/load","モデルを読み込めません"),disabled:v,children:[(0,t.jsx)(ew.Play,{}),"読み込む"]}),(o?.state==="loaded"||o?.state==="error")&&(0,t.jsxs)(x.Button,{variant:"outline",size:"sm",onClick:()=>void I("/api/settings/local-llm/unload","モデルを解放できません"),disabled:v||(o?.inflight??0)>0,title:"メモリから外す(次の発言で自動で読み込み直します)",children:[v?(0,t.jsx)(eu.Loader2,{className:"animate-spin"}):(0,t.jsx)(eC,{}),"解放"]})]})]}),o&&o.inflight>0&&(0,t.jsxs)("p",{className:"text-[0.65rem] text-muted-foreground",children:["応答を生成中のタブがあります(",o.inflight,"件)。完了するまでモデルは切り替えられません。"]}),A?(0,t.jsx)("p",{className:"text-xs text-warning",children:"下の Ollama / LM Studio のどちらかを有効にすると、モデルを選べるようになります。"}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(V,{label:"使用するモデル",hint:d?.errors.length?(0,t.jsx)("span",{className:"text-destructive",children:d.errors.map(e=>`${eU.LOCAL_LLM_PROVIDER_LABEL[e.provider]}: ${e.message}`).join(" / ")}):`有効なプロバイダーにダウンロード済みのモデル(${d?.models.length??0}件)`,children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(eL.Combobox,{options:F,value:n.selection,onChange:e=>T({selection:String(e)}),placeholder:"モデルを選択",className:"flex-1"}),(0,t.jsx)(x.Button,{variant:"outline",size:"icon",onClick:()=>void C(),disabled:m,title:"モデル一覧を再取得",children:(0,t.jsx)(eS.RefreshCw,{className:m?"animate-spin":void 0})})]})}),(0,t.jsxs)(V,{label:"コンテキスト長",children:[(0,t.jsx)(eI,{value:n.context,onChange:e=>T({context:e}),max:z}),S?.provider==="lmstudio"&&(0,t.jsxs)("p",{className:"mt-1 flex items-center gap-1 text-[0.65rem] text-muted-foreground",children:[(0,t.jsx)(ey.Cpu,{className:"size-3"}),"必要メモリ(見積もり): ",p?.totalMemory??"-",E?.format==="mlx"&&"。MLX はモデルの最大値で読み込まれ、メモリは使った分だけ増えます"]}),S?.provider==="ollama"&&(0,t.jsxs)("p",{className:"mt-1 text-[0.65rem] text-muted-foreground",children:["このコンテキスト長を固定した派生モデル(",(0,t.jsx)(q,{children:"<モデル>-tsunagi-ctx<長さ>"}),")を作成して使います(重みは共有されます)。"]})]})]}),(0,t.jsx)(V,{label:"自動解放(分)",hint:"最後のリクエストからこの時間がたったらモデルをメモリから外します(0 で無効)。次の発言で自動で読み込み直します",children:(0,t.jsx)(L.Input,{type:"number",min:0,value:n.idleUnloadMinutes,onChange:e=>T({idleUnloadMinutes:e.target.value}),className:"w-32 font-mono"})}),(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)("input",{type:"checkbox",checked:n.unloadOnExit,onChange:e=>T({unloadOnExit:e.target.checked}),className:"size-4 accent-primary"}),"tsunagi の終了時にモデルを解放する"]}),(0,t.jsxs)(V,{label:"WebSearch",children:[(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(x.Button,{size:"sm",variant:"local"===n.webSearch?"default":"outline",onClick:()=>T({webSearch:"local"}),children:"ローカル検索(SearXNG)"}),(0,t.jsx)(x.Button,{size:"sm",variant:"ollama"===n.webSearch?"default":"outline",onClick:()=>T({webSearch:"ollama"}),children:"ollama.com(Ollama のみ・要サインイン)"})]}),(0,t.jsxs)("p",{className:"mt-1 text-[0.65rem] text-muted-foreground",children:["local"===n.webSearch?"組み込みの WebSearch を無効化し、ローカル検索(SearXNG)の web_search ツールを使います。":"使用するモデルが Ollama のとき、Ollama が ollama.com の Web 検索 API で代行します(Ollama 欄でサインイン状態を確認できます)。LM Studio のときはローカル検索になります。","設定はこの後に作成・起動したタブから反映されます。"]})]}),(0,t.jsx)(H,{children:(0,t.jsx)(V,{label:"追加の環境変数 (任意)",hint:"ローカルLLMタブにのみ適用されます。同名の既定値より優先されます",children:(0,t.jsx)(eE.Textarea,{value:n.extraEnvText,onChange:e=>T({extraEnvText:e.target.value}),placeholder:"KEY=VALUE(1行に1つ)",className:"min-h-16 font-mono text-xs"})})}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)(x.Button,{size:"default",onClick:()=>void U(),disabled:f||!P,children:[f?(0,t.jsx)(eu.Loader2,{className:"animate-spin"}):S&&(0,t.jsx)(ez.LocalLlmIcon,{provider:S.provider,className:"size-4"}),"保存"]}),(0,t.jsx)("span",{className:"text-[0.65rem] text-muted-foreground",children:"モデルを変えて保存すると、他のモデルを解放して読み込みを始めます"})]})]}):(0,t.jsxs)("span",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(eu.Loader2,{className:"size-4 animate-spin"}),"読み込み中..."]})}),(0,t.jsx)(O.Dialog,{open:N,onOpenChange:({open:e})=>k(e),title:"ローカルLLMについて",maxWidth:"2xl",children:(0,t.jsxs)("div",{className:"space-y-4 text-sm",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium text-foreground",children:"実験的機能です"}),(0,t.jsx)("p",{className:"text-muted-foreground",children:"Claude Code の接続先を tsunagi の中継口に切り替え、tsunagi が Ollama / LM Studio の Anthropic 互換 API に転送します。Anthropic はClaude以外のモデルへの接続をサポートしていないため、動作は保証されません。"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium text-foreground",children:"モデルは1つだけ"}),(0,t.jsx)("p",{className:"text-muted-foreground",children:"20〜30GB 級のモデルを2つ同時にメモリへ載せられるマシンは少ないため、使用するモデルは1つにし、全てのローカルLLMタブで共有します。切り替えると他のモデルは解放され、各タブは次の発言で会話全体を新しいモデルで読み直します(数十秒〜数分)。"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium text-foreground",children:"/model について"}),(0,t.jsxs)("p",{className:"text-muted-foreground",children:["ローカルLLMタブでは ",(0,t.jsx)(q,{children:"/model"})," ","によるモデルの切り替えを無効にしています(Claude Code が切り替えたモデルを通常の Claude タブの既定値として保存してしまうため)。切り替えはここで行ってください。"]})]})]})})]})}var eR=e.i(82458),eR=eR;function e_(){let{settings:e,setSettings:a}=(0,eO.useOllamaSettings)(),[r,l]=(0,s.useState)(""),[n,i]=(0,s.useState)(!1),[c,d]=(0,s.useState)(null),[u,m]=(0,s.useState)(null),[h,p]=(0,s.useState)(!1),[g,f]=(0,s.useState)(null);(0,s.useEffect)(()=>{e&&l(e.baseUrl)},[e]);let j=(0,s.useCallback)(async e=>{i(!0);try{return a(await _("/api/settings/ollama",e)),!0}catch(e){return y.toaster.create({type:"error",title:"Ollama の設定を保存できませんでした",description:G(e)}),!1}finally{i(!1)}},[a]),v=(0,s.useCallback)(async e=>{try{d(await R(`/api/settings/ollama/status?baseUrl=${encodeURIComponent(e)}`))}catch(e){console.error("Failed to fetch Ollama status:",e)}},[]),b=(0,s.useCallback)(async e=>{p(!0),f(null);try{m(await R(`/api/settings/ollama/account?baseUrl=${encodeURIComponent(e)}`))}catch(e){m(null),f(G(e))}finally{p(!1)}},[]),N=e?.enabled===!0,k=e?.baseUrl;(0,s.useEffect)(()=>{if(!N||!k)return;v(k),b(k);let e=setInterval(()=>void v(k),5e3);return()=>clearInterval(e)},[N,k,v,b]);let w=(0,s.useCallback)(async()=>{e&&await j({...e,baseUrl:r})&&y.toaster.create({type:"success",title:"Ollama の設定を保存しました"})},[e,r,j]);return(0,t.jsxs)(em,{children:[(0,t.jsxs)(ex,{children:[(0,t.jsx)(eh,{children:"Ollama"}),(0,t.jsxs)(ep,{children:["ローカルLLMのプロバイダーとして Ollama を使います。Ollama のインストール・モデルの pull・起動はご自身で行ってください(例:"," ",(0,t.jsx)(q,{children:"ollama pull qwen3.6:35b-a3b-coding-nvfp4"}),")。"]})]}),(0,t.jsx)(eg,{className:"flex flex-col gap-3",children:e?N?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(X,{children:[c?c.reachable?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{className:"flex items-center gap-2 text-success",children:[(0,t.jsx)(eb.CheckCircle2,{className:"size-4"}),"接続中",c.version&&` (v${c.version})`]}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:c.loaded.length>0?`読み込み中: ${c.loaded.map(e=>`${e.name}${e.contextLength?` (${eP(e.contextLength)})`:""}`).join(", ")}`:"読み込み中のモデルなし"})]}):(0,t.jsxs)("span",{className:"flex items-center gap-2 text-warning",children:[(0,t.jsx)(eR.default,{className:"size-4"}),"Ollama に接続できません。Ollama アプリを起動してください"]}):(0,t.jsxs)("span",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(eu.Loader2,{className:"size-4 animate-spin"}),"確認中..."]}),(0,t.jsx)(x.Button,{variant:"outline",size:"sm",className:"ml-auto",onClick:()=>void j({...e,enabled:!1}),disabled:n,children:"無効にする"})]}),(0,t.jsx)(V,{label:"ollama.com(WebSearch を Ollama に代行させる場合)",hint:(0,t.jsxs)(t.Fragment,{children:["「Claude Code のローカルLLM」欄の WebSearch を「ollama.com」にした場合のみ必要です。Ollama を動かしているマシンで"," ",(0,t.jsx)(q,{children:"ollama signin"})," を実行してください(検索クエリは ollama.com に送信されます)。"]}),children:(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[h?(0,t.jsxs)("span",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(eu.Loader2,{className:"size-4 animate-spin"}),"確認中..."]}):u?.signedIn?(0,t.jsxs)("span",{className:"flex items-center gap-2 text-success",children:[(0,t.jsx)(o,{className:"size-4"}),"サインイン済み(",u.name,")"]}):u?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(eR.default,{className:"size-4"}),"未サインイン"]}),u.signinUrl&&(0,t.jsxs)("a",{href:u.signinUrl,target:"_blank",rel:"noreferrer",className:(0,x.buttonVariants)({variant:"outline",size:"sm"}),children:[(0,t.jsx)(P.ExternalLink,{}),"サインイン"]})]}):(0,t.jsx)("span",{className:"text-xs text-destructive",children:g}),(0,t.jsx)(x.Button,{variant:"outline",size:"icon",onClick:()=>void b(e.baseUrl),disabled:h,title:"サインイン状態を再確認",children:(0,t.jsx)(eS.RefreshCw,{className:h?"animate-spin":void 0})})]})}),(0,t.jsx)(H,{children:(0,t.jsx)(V,{label:"Base URL",hint:(0,t.jsxs)(t.Fragment,{children:["Docker で tsunagi を動かしている場合は"," ",(0,t.jsx)(q,{children:"http://host.docker.internal:11434"})]}),children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(L.Input,{value:r,onChange:e=>l(e.target.value),placeholder:"http://localhost:11434"}),(0,t.jsx)(x.Button,{size:"default",onClick:()=>void w(),disabled:n||r===e.baseUrl,children:"保存"})]})})})]}):(0,t.jsxs)(x.Button,{size:"default",onClick:()=>void j({...e,enabled:!0}),disabled:n,children:[(0,t.jsx)(ez.OllamaIcon,{className:"size-4"}),"Ollama を有効化する"]}):(0,t.jsxs)("span",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(eu.Loader2,{className:"size-4 animate-spin"}),"読み込み中..."]})})]})}let eG=(0,l.default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);var eR=eR;function eX(){let{settings:e,setSettings:a}=(0,eO.useLmStudioSettings)(),[r,l]=(0,s.useState)(null),[n,i]=(0,s.useState)(!1),[o,c]=(0,s.useState)(null),[d,u]=(0,s.useState)(!1);(0,s.useEffect)(()=>{e&&l({baseUrl:e.baseUrl,apiToken:e.apiToken,lmsPath:e.lmsPath})},[e]);let m=e?.enabled===!0,h=(0,s.useCallback)(async()=>{try{c(await R("/api/settings/lmstudio/status"))}catch(e){console.error("Failed to fetch LM Studio status:",e)}},[]);(0,s.useEffect)(()=>{if(!m)return;h();let e=setInterval(()=>void h(),5e3);return()=>clearInterval(e)},[m,h]);let p=(0,s.useCallback)(async e=>{i(!0);try{return a(await _("/api/settings/lmstudio",e)),!0}catch(e){return y.toaster.create({type:"error",title:"LM Studio の設定を保存できませんでした",description:G(e)}),!1}finally{i(!1)}},[a]),g=(0,s.useCallback)(async e=>{u(!0);try{c(await R(`/api/settings/lmstudio/server/${e}`,{method:"POST"}))}catch(t){y.toaster.create({type:"error",title:"start"===e?"サーバーを起動できません":"サーバーを停止できません",description:G(t)})}finally{u(!1)}},[]),f=(0,s.useCallback)(async()=>{e&&r&&await p({...e,...r})&&(y.toaster.create({type:"success",title:"LM Studio の設定を保存しました"}),h())},[e,r,p,h]),j=e=>l(t=>t?{...t,...e}:t);return(0,t.jsxs)(em,{children:[(0,t.jsxs)(ex,{children:[(0,t.jsx)(eh,{children:"LM Studio"}),(0,t.jsxs)(ep,{children:["ローカルLLMのプロバイダーとして LM Studio(0.4.1 以降)を使います。",(0,t.jsx)("a",{href:"https://lmstudio.ai/download",target:"_blank",rel:"noreferrer",className:"underline",children:"LM Studio"}),"のインストールとモデルのダウンロードはご自身で行ってください(例:"," ",(0,t.jsx)(q,{children:"mlx-community/Qwen3.6-35B-A3B-4bit"}),")。一度起動すると lms CLI が入ります。"]})]}),(0,t.jsx)(eg,{className:"flex flex-col gap-3",children:e&&r?m?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(X,{children:[o?o.serverRunning?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{className:"flex items-center gap-2 text-success",children:[(0,t.jsx)(eb.CheckCircle2,{className:"size-4"}),"サーバー起動中"]}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:o.loaded.length>0?`読み込み中: ${o.loaded.map(e=>`${e.key} (${eP(e.contextLength)})`).join(", ")}`:"読み込み中のモデルなし"})]}):(0,t.jsxs)("span",{className:"flex items-center gap-2 text-warning",children:[(0,t.jsx)(eR.default,{className:"size-4"}),"サーバー停止中"]}):(0,t.jsxs)("span",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(eu.Loader2,{className:"size-4 animate-spin"}),"確認中..."]}),(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[o&&o.lmsPath?o.serverRunning?(0,t.jsxs)(x.Button,{variant:"outline",size:"sm",onClick:()=>void g("stop"),disabled:d,children:[d?(0,t.jsx)(eu.Loader2,{className:"animate-spin"}):(0,t.jsx)(eG,{}),"停止"]}):(0,t.jsxs)(x.Button,{size:"sm",onClick:()=>void g("start"),disabled:d,children:[d?(0,t.jsx)(eu.Loader2,{className:"animate-spin"}):(0,t.jsx)(ew.Play,{}),"起動"]}):null,(0,t.jsx)(x.Button,{variant:"outline",size:"sm",onClick:()=>void p({...e,enabled:!1}),disabled:n,children:"無効にする"})]})]}),o&&!o.lmsPath&&!o.serverRunning&&(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:["tsunagi から LM Studio のサーバーを起動するための lms CLI が見つかりません(tsunagi を Docker で動かしている場合も同様です)。LM Studio アプリの Developer タブでサーバーを起動するか、LM Studio を動かしているマシンで"," ",(0,t.jsx)(q,{children:"lms server start"})," を実行してください。lms がある場合は詳細設定でパスを指定できます。"]}),(0,t.jsxs)(H,{children:[(0,t.jsx)(V,{label:"Base URL",children:(0,t.jsx)(L.Input,{value:r.baseUrl,onChange:e=>j({baseUrl:e.target.value}),placeholder:"http://localhost:1234"})}),(0,t.jsx)(V,{label:"API トークン (任意)",hint:"LM Studio で「Require Authentication」を有効にしている場合のみ",children:(0,t.jsx)(L.Input,{type:"password",value:r.apiToken,onChange:e=>j({apiToken:e.target.value})})}),(0,t.jsx)(V,{label:"lms のパス (任意)",hint:"空欄なら ~/.lmstudio/bin/lms → PATH の順で探します",children:(0,t.jsx)(L.Input,{value:r.lmsPath,onChange:e=>j({lmsPath:e.target.value}),placeholder:o?.lmsPath??"~/.lmstudio/bin/lms",className:"font-mono"})}),(0,t.jsx)("div",{children:(0,t.jsxs)(x.Button,{size:"default",onClick:()=>void f(),disabled:n,children:[n&&(0,t.jsx)(eu.Loader2,{className:"animate-spin"}),"保存"]})})]})]}):(0,t.jsxs)(x.Button,{size:"default",onClick:()=>void p({...e,enabled:!0}),disabled:n,children:[(0,t.jsx)(ez.LmStudioIcon,{className:"size-4"}),"LM Studio を有効化する"]}):(0,t.jsxs)("span",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(eu.Loader2,{className:"size-4 animate-spin"}),"読み込み中..."]})})]})}let eV=(0,l.default)("container",[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]]),eH=(0,l.default)("package-x",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["path",{d:"m17 13 5 5m-5 0 5-5",key:"im3w4b"}]]);var eq=e.i(91810),eK=e.i(20535);let eW={auto:"自動(searxng-run → Docker の順)",process:"searxng-run",docker:"Docker"};function eJ({status:e}){let s,{state:a,runner:r,docker:l}=e;if("not-installed"===a)return null;let n=(0,t.jsx)(q,{children:l.container}),i=(0,t.jsx)(q,{children:e.binPath??"searxng-run"});s="external"===a?"docker"===r?(0,t.jsxs)(t.Fragment,{children:["Docker コンテナ ",n,"(tsunagi 外で起動したため、tsunagi は停止しません)"]}):(0,t.jsx)(t.Fragment,{children:"tsunagi 外で起動した SearXNG(起動方法は不明。tsunagi は停止しません)"}):"running"===a?"docker"===r?(0,t.jsxs)(t.Fragment,{children:["Docker コンテナ ",n," を tsunagi が起動しました(停止時・終了時に停止します)"]}):(0,t.jsxs)(t.Fragment,{children:[i," を tsunagi が起動しました(停止時・終了時に停止します)"]}):"docker"===r?null===l.containerExists?(0,t.jsxs)(t.Fragment,{children:["Docker コンテナ ",n," を起動します(Docker が応答しません。Docker Desktop を起動してください)"]}):l.containerExists?(0,t.jsxs)(t.Fragment,{children:["Docker コンテナ ",n," を起動します"]}):(0,t.jsxs)(t.Fragment,{children:["Docker コンテナ ",n," を作成して起動します(初回はイメージの取得に数分かかります)"]}):(0,t.jsxs)(t.Fragment,{children:[i," を起動します"]});let o="docker"===r?eV:eK.SquareTerminal;return(0,t.jsxs)("p",{className:"flex items-start gap-1.5 text-xs text-muted-foreground",children:[(0,t.jsx)(o,{className:"mt-px size-3.5 shrink-0","aria-label":"起動方法"}),(0,t.jsx)("span",{children:s})]})}function eY(){let[e,a]=(0,s.useState)(null),[r,l]=(0,s.useState)(null),[n,i]=(0,s.useState)(null),[o,c]=(0,s.useState)(!1),[d,u]=(0,s.useState)(!1),m=(0,s.useCallback)(async()=>{try{a(await R("/api/settings/searxng/status"))}catch(e){console.error("Failed to fetch SearXNG status:",e)}},[]);(0,s.useEffect)(()=>{m(),R("/api/settings/searxng").then(l).catch(e=>console.error("Failed to fetch SearXNG settings:",e));let e=setInterval(()=>void m(),3e3);return()=>clearInterval(e)},[m]),(0,s.useEffect)(()=>{r&&i({port:String(r.port),method:r.method,binPath:r.binPath,settingsPath:r.settingsPath,dockerContainer:r.dockerContainer})},[r]);let h=(0,s.useCallback)(async(e,t)=>{c(!0);try{a(await R(e,{method:"POST"}))}catch(e){y.toaster.create({type:"error",title:t,description:G(e)})}finally{c(!1)}},[]),p=(0,s.useCallback)(async()=>{if(n){c(!0);try{l(await _("/api/settings/searxng",{port:Number(n.port),method:n.method,binPath:n.binPath,settingsPath:n.settingsPath,dockerContainer:n.dockerContainer}))}catch(e){y.toaster.create({type:"error",title:"SearXNG の設定を保存できませんでした",description:G(e)}),c(!1);return}c(!1),await h("/api/settings/searxng/restart","SearXNG を再起動できません")}},[n,h]);if(!e?.required)return null;let g=e=>i(t=>t?{...t,...e}:t);return(0,t.jsxs)(em,{children:[(0,t.jsxs)(ex,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(eh,{children:"ローカル検索 (SearXNG)"}),(0,t.jsx)(x.Button,{variant:"ghost",size:"icon-sm",onClick:()=>u(!0),title:"ローカル検索について",children:(0,t.jsx)(eN,{})})]}),(0,t.jsxs)(ep,{children:["Ollama / LM Studio タブの WebSearch をローカルの SearXNG で行います。",(0,t.jsx)("strong",{className:"font-medium text-foreground",children:"Ollama か LM Studio が有効な間、tsunagi が自動で起動・停止します"}),"。searxng-run が無ければ Docker で起動します(コンテナが無ければ作成します)。"]})]}),(0,t.jsxs)(eg,{className:"flex flex-col gap-3",children:[(0,t.jsxs)(X,{children:["running"===e.state||"external"===e.state?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{className:"flex items-center gap-2 text-success",children:[(0,t.jsx)(eb.CheckCircle2,{className:"size-4"}),"running"===e.state?"起動中":"起動中(tsunagi 外で起動)"]}),(0,t.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:e.url})]}):"starting"===e.state?(0,t.jsxs)("span",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(eu.Loader2,{className:"size-4 animate-spin"}),e.message??"起動中","..."]}):"not-installed"===e.state?(0,t.jsxs)("span",{className:"flex items-center gap-2 text-warning",children:[(0,t.jsx)(eH,{className:"size-4"}),"SearXNG を起動できません(",(0,t.jsx)(q,{children:"searxng-run"})," も ",(0,t.jsx)(q,{children:"docker"})," ","も見つかりません)"]}):"error"===e.state?(0,t.jsxs)("span",{className:"flex items-center gap-2 text-destructive",children:[(0,t.jsx)(ev.AlertCircle,{className:"size-4"}),"エラー"]}):(0,t.jsx)("span",{className:"text-muted-foreground",children:"停止中"}),(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:["external"!==e.state&&"starting"!==e.state&&(0,t.jsxs)(x.Button,{variant:"outline",size:"sm",onClick:()=>void h("/api/settings/searxng/restart","SearXNG を起動できません"),disabled:o,children:[(0,t.jsx)(eq.RotateCw,{}),"running"===e.state?"再起動":"起動"]}),"running"===e.state&&(0,t.jsxs)(x.Button,{variant:"outline",size:"sm",onClick:()=>void h("/api/settings/searxng/stop","SearXNG を停止できません"),disabled:o,children:[(0,t.jsx)(eG,{}),"停止"]})]})]}),(0,t.jsx)(eJ,{status:e}),"error"===e.state&&e.error&&(0,t.jsx)("pre",{className:"max-h-40 overflow-auto rounded-md bg-muted p-2 text-[0.65rem] whitespace-pre-wrap text-destructive",children:e.error}),"not-installed"===e.state&&(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Docker Desktop を入れると、tsunagi がコンテナを作成して起動します(",(0,t.jsx)("a",{href:"https://minimalcorp.github.io/tsunagi/ja/features/local-search/",target:"_blank",rel:"noreferrer",className:"underline",children:"手順"}),")。Docker を使わない場合は、nix なら ",(0,t.jsx)(q,{children:"nix profile install nixpkgs#searxng"})," ","などで ",(0,t.jsx)(q,{children:"searxng-run"})," を PATH に入れてください(",(0,t.jsx)("a",{href:"https://docs.searxng.org/admin/installation.html",target:"_blank",rel:"noreferrer",className:"underline",children:"インストール方法"}),")。PATH にない場合は詳細設定でパスを指定できます。起動方法を固定したい場合も詳細設定で選べます。"]}),n&&(0,t.jsxs)(H,{children:[(0,t.jsx)(V,{label:"ポート",hint:"既定は 7964(キーパッドで sxng)",children:(0,t.jsx)(L.Input,{type:"number",min:1,max:65535,value:n.port,onChange:e=>g({port:e.target.value}),className:"font-mono"})}),(0,t.jsx)(V,{label:"起動方法",children:(0,t.jsx)("select",{value:n.method,onChange:e=>g({method:e.target.value}),className:"h-9 w-full rounded-md border border-input bg-transparent pl-3 pr-10 text-sm text-foreground shadow-xs",children:Object.keys(eW).map(e=>(0,t.jsx)("option",{value:e,children:eW[e]},e))})}),(0,t.jsx)(V,{label:"Docker のコンテナ名",hint:"無ければ tsunagi が公式イメージで作成します(設定は ~/.tsunagi/searxng/docker/<コンテナ名>/)",children:(0,t.jsx)(L.Input,{value:n.dockerContainer,onChange:e=>g({dockerContainer:e.target.value}),placeholder:"searxng",className:"font-mono"})}),(0,t.jsx)(V,{label:"searxng-run のパス (任意)",hint:"空欄なら PATH から探します",children:(0,t.jsx)(L.Input,{value:n.binPath,onChange:e=>g({binPath:e.target.value}),placeholder:e.binPath??"searxng-run",className:"font-mono"})}),(0,t.jsx)(V,{label:"settings.yml のパス (任意)",hint:"searxng-run で起動するときのみ。空欄なら tsunagi が生成したもの(~/.tsunagi/searxng/settings.yml)を使います。独自のものを使う場合は search.formats に json を含めてください",children:(0,t.jsx)(L.Input,{value:n.settingsPath,onChange:e=>g({settingsPath:e.target.value}),className:"font-mono"})}),(0,t.jsx)("div",{children:(0,t.jsxs)(x.Button,{size:"default",onClick:()=>void p(),disabled:o,children:[o&&(0,t.jsx)(eu.Loader2,{className:"animate-spin"}),"保存して再起動"]})})]})]}),(0,t.jsx)(O.Dialog,{open:d,onOpenChange:({open:e})=>u(e),title:"ローカル検索について",maxWidth:"2xl",children:(0,t.jsxs)("div",{className:"space-y-4 text-sm",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium text-foreground",children:"仕組み"}),(0,t.jsxs)("p",{className:"text-muted-foreground",children:["Claude Code の WebSearch は Anthropic のサーバーツールのため、ローカルLLMでは使えません(LM Studio は無視し、Ollama は ollama.com のサインインが必要)。ローカル検索を使うタブでは WebSearch を無効化し、tsunagi の MCP が提供する ",(0,t.jsx)(q,{children:"web_search"})," ツールで SearXNG に検索させます。"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium text-foreground",children:"自動起動・停止"}),(0,t.jsxs)("p",{className:"text-muted-foreground",children:["Ollama か LM Studio が有効なら、tsunagi の起動時・有効化時に SearXNG を起動し、両方を無効にしたときと tsunagi の終了時に停止します。起動方法は"," ",(0,t.jsx)(q,{children:"searxng-run"})," があればそれを、なければ Docker(コンテナが無ければ作成)を使います。既にポートで SearXNG が動いていればそれを使います(tsunagi は止めません)。SearXNG がなくても tsunagi 自体は通常どおり動きます。"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium text-foreground",children:"注意"}),(0,t.jsx)("p",{className:"text-muted-foreground",children:"SearXNG は Google / Bing / DuckDuckGo などの検索エンジンに問い合わせます。短時間に大量に検索すると、検索エンジン側で一時的にブロックされることがあります。"})]})]})})]})}var eZ=e.i(43034),eQ=e.i(37837),e0=e.i(99059),e1=e.i(44142);function e2(){let e=(0,e1.useUpdateStatus)(),a=(0,e1.useCheckForUpdate)(),[r,l]=(0,s.useState)(!1),n=async()=>{l(!0);try{await a()}catch(e){y.toaster.create({type:"error",title:"Failed to check for updates",description:e instanceof Error?e.message:String(e)})}finally{l(!1)}};return(0,t.jsxs)("div",{className:"border-t border-border p-3 space-y-1 text-xs",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-1",children:[(0,t.jsxs)("span",{className:"font-medium text-foreground",children:["tsunagi ",e?.current?`v${e.current}`:"dev"]}),e?.current&&(0,t.jsx)(x.Button,{variant:"ghost",size:"icon-sm",onClick:()=>void n(),disabled:r,title:"Check for updates","aria-label":"Check for updates",children:(0,t.jsx)(eS.RefreshCw,{className:(0,F.cn)(r&&"animate-spin")})})]}),e?.updateAvailable?(0,t.jsxs)(eQ.Popover,{children:[(0,t.jsx)(eQ.PopoverTrigger,{className:"flex items-center gap-1 rounded-sm text-info hover:underline cursor-pointer outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",children:"ready"===e.autoUpdate.state?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eq.RotateCw,{className:"size-3.5"}),"Restart to update to v",e.autoUpdate.version]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eZ.ArrowUpCircle,{className:"size-3.5"}),"v",e.latest," available"]})}),(0,t.jsx)(e0.UpdatePopoverContent,{status:e})]}):e?.checkedAt?(0,t.jsxs)("div",{className:"flex items-center gap-1 text-success",children:[(0,t.jsx)(eb.CheckCircle2,{className:"size-3.5"}),"Up to date"]}):(0,t.jsxs)("div",{className:"flex items-center gap-1 text-muted-foreground",children:[(0,t.jsx)(eN,{className:"size-3.5"}),"Not checked"]}),e?.entryOutdated&&!e.updateAvailable&&(0,t.jsxs)(eQ.Popover,{children:[(0,t.jsxs)(eQ.PopoverTrigger,{className:"flex items-center gap-1 rounded-sm text-warning hover:underline cursor-pointer outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",children:[(0,t.jsx)(ev.AlertCircle,{className:"size-3.5"}),"Reinstall recommended"]}),(0,t.jsx)(e0.UpdatePopoverContent,{status:e})]}),e?.checkedAt&&(0,t.jsxs)("div",{className:"text-muted-foreground",children:["Last checked: ",new Date(e.checkedAt).toLocaleString()]})]})}var e4=e.i(51846),e3=e.i(81671);e.s(["default",0,function(){let e=(0,a.useRouter)();(0,e4.useDocumentTitle)("settings");let l=(0,e3.useAgentAvailability)(),o=l?.find(e=>"claude"===e.agent),c=o?.installed===!1,d=()=>{{let e=localStorage.getItem("tsunagi:env-selected-node");if(e)try{return JSON.parse(e)}catch(e){console.error("Failed to parse selected node:",e)}}return{scope:"global",label:"Global"}},[u,m]=(0,s.useState)(null),[h,g]=(0,s.useState)(0);return(0,s.useEffect)(()=>{fetch((0,i.apiUrl)("/api/onboarding/status")).then(e=>e.json()).then(e=>{e.data?.completed?m(d()):m({scope:"global",label:"Global"})}).catch(e=>{console.error("Failed to fetch onboarding status:",e),m(d())})},[]),(0,s.useEffect)(()=>{u&&localStorage.setItem("tsunagi:env-selected-node",JSON.stringify(u))},[u]),(0,t.jsxs)("div",{className:"h-screen flex flex-col bg-background",children:[(0,t.jsx)("div",{className:"sticky top-0 z-50 p-4 border-b border-border bg-card",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)(x.Button,{variant:"ghost",onClick:()=>e.push("/"),className:"text-primary font-medium hover:bg-primary/10 hover:text-foreground",children:[(0,t.jsx)(r.ArrowLeft,{className:"w-4 h-4"}),"Back to Board"]}),(0,t.jsx)("h1",{className:"text-xl font-bold text-foreground absolute left-1/2 -translate-x-1/2",children:"Settings"}),(0,t.jsx)(e0.UpdateIndicator,{})]})}),(0,t.jsxs)("div",{className:"flex-1 flex min-h-0",children:[(0,t.jsxs)("div",{className:"w-64 border-r border-border bg-card flex flex-col",children:[(0,t.jsx)("div",{className:"flex-1 min-h-0",children:(0,t.jsx)(p,{selectedNode:u,onNodeSelect:e=>{m(e)},refreshKey:h})}),(0,t.jsx)(e2,{})]}),(0,t.jsx)("div",{className:"flex-1 bg-card p-4 overflow-y-auto",children:u?(0,t.jsxs)("div",{className:"space-y-6",children:[Q.map(e=>(0,t.jsx)(ea,{agent:e,availability:l?.find(t=>t.agent===e),selectedNode:u},e)),"global"===u.scope&&(0,t.jsx)(ej,{}),(0,t.jsx)(M,{selectedNode:u}),"global"===u.scope&&(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:"Repositories"}),(0,t.jsx)(en,{})]}),"global"===u.scope&&(0,t.jsx)(ed,{}),"global"===u.scope&&(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 pt-2 text-muted-foreground",children:[(0,t.jsx)(n,{className:"size-4"}),(0,t.jsx)("span",{className:"text-sm font-semibold",children:"Experimental"}),(0,t.jsx)("div",{className:"h-px flex-1 bg-border"})]}),(0,t.jsx)(es,{agent:"claude",availability:o}),(0,t.jsxs)("fieldset",{disabled:c,className:(0,F.cn)("min-w-0 space-y-6",c&&"opacity-50"),children:[(0,t.jsx)(eA,{}),(0,t.jsx)(e_,{}),(0,t.jsx)(eX,{})]}),(0,t.jsx)(eY,{})]}),"repo"===u.scope&&u.owner&&u.repo&&(0,t.jsx)(eo,{owner:u.owner,repo:u.repo,onDeleted:()=>{m({scope:"global",label:"Global"}),g(e=>e+1)}})]}):(0,t.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground text-sm",children:"Select a node from the left panel"})})]})]})}],82341)}]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,471,e=>{"use strict";let i=(0,e.i(75254).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",0,i],471)},88699,e=>{"use strict";let i=(0,e.i(75254).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(["Pencil",0,i],88699)},93355,66992,e=>{"use strict";var i=e.i(18050);let s=(0,e.i(75254).default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);function r(e){return(0,i.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:(0,i.jsx)("path",{d:"M16.361 10.26a.894.894 0 0 0-.558.47l-.072.148.001.207c0 .193.004.217.059.353.076.193.152.312.291.448.24.238.51.3.872.205a.86.86 0 0 0 .517-.436.752.752 0 0 0 .08-.498c-.064-.453-.33-.782-.724-.897a1.06 1.06 0 0 0-.466 0zm-9.203.005c-.305.096-.533.32-.65.639a1.187 1.187 0 0 0-.06.52c.057.309.31.59.598.667.362.095.632.033.872-.205.14-.136.215-.255.291-.448.055-.136.059-.16.059-.353l.001-.207-.072-.148a.894.894 0 0 0-.565-.472 1.02 1.02 0 0 0-.474.007Zm4.184 2c-.131.071-.223.25-.195.383.031.143.157.288.353.407.105.063.112.072.117.136.004.038-.01.146-.029.243-.02.094-.036.194-.036.222.002.074.07.195.143.253.064.052.076.054.255.059.164.005.198.001.264-.03.169-.082.212-.234.15-.525-.052-.243-.042-.28.087-.355.137-.08.281-.219.324-.314a.365.365 0 0 0-.175-.48.394.394 0 0 0-.181-.033c-.126 0-.207.03-.355.124l-.085.053-.053-.032c-.219-.13-.259-.145-.391-.143a.396.396 0 0 0-.193.032zm.39-2.195c-.373.036-.475.05-.654.086-.291.06-.68.195-.951.328-.94.46-1.589 1.226-1.787 2.114-.04.176-.045.234-.045.53 0 .294.005.357.043.524.264 1.16 1.332 2.017 2.714 2.173.3.033 1.596.033 1.896 0 1.11-.125 2.064-.727 2.493-1.571.114-.226.169-.372.22-.602.039-.167.044-.23.044-.523 0-.297-.005-.355-.045-.531-.288-1.29-1.539-2.304-3.072-2.497a6.873 6.873 0 0 0-.855-.031zm.645.937a3.283 3.283 0 0 1 1.44.514c.223.148.537.458.671.662.166.251.26.508.303.82.02.143.01.251-.043.482-.08.345-.332.705-.672.957a3.115 3.115 0 0 1-.689.348c-.382.122-.632.144-1.525.138-.582-.006-.686-.01-.853-.042-.57-.107-1.022-.334-1.35-.68-.264-.28-.385-.535-.45-.946-.03-.192.025-.509.137-.776.136-.326.488-.73.836-.963.403-.269.934-.46 1.422-.512.187-.02.586-.02.773-.002zm-5.503-11a1.653 1.653 0 0 0-.683.298C5.617.74 5.173 1.666 4.985 2.819c-.07.436-.119 1.04-.119 1.503 0 .544.064 1.24.155 1.721.02.107.031.202.023.208a8.12 8.12 0 0 1-.187.152 5.324 5.324 0 0 0-.949 1.02 5.49 5.49 0 0 0-.94 2.339 6.625 6.625 0 0 0-.023 1.357c.091.78.325 1.438.727 2.04l.13.195-.037.064c-.269.452-.498 1.105-.605 1.732-.084.496-.095.629-.095 1.294 0 .67.009.803.088 1.266.095.555.288 1.143.503 1.534.071.128.243.393.264.407.007.003-.014.067-.046.141a7.405 7.405 0 0 0-.548 1.873c-.062.417-.071.552-.071.991 0 .56.031.832.148 1.279L3.42 24h1.478l-.05-.091c-.297-.552-.325-1.575-.068-2.597.117-.472.25-.819.498-1.296l.148-.29v-.177c0-.165-.003-.184-.057-.293a.915.915 0 0 0-.194-.25 1.74 1.74 0 0 1-.385-.543c-.424-.92-.506-2.286-.208-3.451.124-.486.329-.918.544-1.154a.787.787 0 0 0 .223-.531c0-.195-.07-.355-.224-.522a3.136 3.136 0 0 1-.817-1.729c-.14-.96.114-2.005.69-2.834.563-.814 1.353-1.336 2.237-1.475.199-.033.57-.028.776.01.226.04.367.028.512-.041.179-.085.268-.19.374-.431.093-.215.165-.333.36-.576.234-.29.46-.489.822-.729.413-.27.884-.467 1.352-.561.17-.035.25-.04.569-.04.319 0 .398.005.569.04a4.07 4.07 0 0 1 1.914.997c.117.109.398.457.488.602.034.057.095.177.132.267.105.241.195.346.374.43.14.068.286.082.503.045.343-.058.607-.053.943.016 1.144.23 2.14 1.173 2.581 2.437.385 1.108.276 2.267-.296 3.153-.097.15-.193.27-.333.419-.301.322-.301.722-.001 1.053.493.539.801 1.866.708 3.036-.062.772-.26 1.463-.533 1.854a2.096 2.096 0 0 1-.224.258.916.916 0 0 0-.194.25c-.054.109-.057.128-.057.293v.178l.148.29c.248.476.38.823.498 1.295.253 1.008.231 2.01-.059 2.581a.845.845 0 0 0-.044.098c0 .006.329.009.732.009h.73l.02-.074.036-.134c.019-.076.057-.3.088-.516.029-.217.029-1.016 0-1.258-.11-.875-.295-1.57-.597-2.226-.032-.074-.053-.138-.046-.141.008-.005.057-.074.108-.152.376-.569.607-1.284.724-2.228.031-.26.031-1.378 0-1.628-.083-.645-.182-1.082-.348-1.525a6.083 6.083 0 0 0-.329-.7l-.038-.064.131-.194c.402-.604.636-1.262.727-2.04a6.625 6.625 0 0 0-.024-1.358 5.512 5.512 0 0 0-.939-2.339 5.325 5.325 0 0 0-.95-1.02 8.097 8.097 0 0 1-.186-.152.692.692 0 0 1 .023-.208c.208-1.087.201-2.443-.017-3.503-.19-.924-.535-1.658-.98-2.082-.354-.338-.716-.482-1.15-.455-.996.059-1.8 1.205-2.116 3.01a6.805 6.805 0 0 0-.097.726c0 .036-.007.066-.015.066a.96.96 0 0 1-.149-.078A4.857 4.857 0 0 0 12 3.03c-.832 0-1.687.243-2.456.698a.958.958 0 0 1-.148.078c-.008 0-.015-.03-.015-.066a6.71 6.71 0 0 0-.097-.725C8.997 1.392 8.337.319 7.46.048a2.096 2.096 0 0 0-.585-.041Zm.293 1.402c.248.197.523.759.682 1.388.03.113.06.244.069.292.007.047.026.152.041.233.067.365.098.76.102 1.24l.002.475-.12.175-.118.178h-.278c-.324 0-.646.041-.954.124l-.238.06c-.033.007-.038-.003-.057-.144a8.438 8.438 0 0 1 .016-2.323c.124-.788.413-1.501.696-1.711.067-.05.079-.049.157.013zm9.825-.012c.17.126.358.46.498.888.28.854.36 2.028.212 3.145-.019.14-.024.151-.057.144l-.238-.06a3.693 3.693 0 0 0-.954-.124h-.278l-.119-.178-.119-.175.002-.474c.004-.669.066-1.19.214-1.772.157-.623.434-1.185.68-1.382.078-.062.09-.063.159-.012z"})})}function n(e){return(0,i.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:(0,i.jsx)("path",{d:"M14.025 0c3.492 0 5.237 0 6.571.68a6.24 6.24 0 0 1 2.725 2.724C24 4.738 24 6.484 24 9.975v4.05c0 3.492 0 5.237-.68 6.571a6.24 6.24 0 0 1-2.724 2.725c-1.334.679-3.08.679-6.571.679h-4.05c-3.492 0-5.237 0-6.571-.68A6.24 6.24 0 0 1 .68 20.597C0 19.262 0 17.516 0 14.025v-4.05c0-3.492 0-5.237.68-6.571A6.23 6.23 0 0 1 3.404.68C4.738 0 6.484 0 9.975 0zM7.688 16.313a1.313 1.313 0 0 0 0 2.625h11.625a1.313 1.313 0 0 0 0-2.625zm-3-3.75a1.313 1.313 0 0 0 0 2.624h11.625a1.313 1.313 0 0 0 0-2.624zm3-3.75a1.313 1.313 0 0 0 0 2.624h11.625a1.313 1.313 0 0 0 0-2.624zm-3-3.75a1.313 1.313 0 0 0 0 2.625h11.625a1.313 1.313 0 0 0 0-2.625z"})})}e.s(["Cpu",0,s],66992);let o={ollama:r,lmstudio:n};function a({provider:e,...s}){let r=o[e];return(0,i.jsx)(r,{...s})}e.s(["ClaudeIcon",0,function(e){return(0,i.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:(0,i.jsx)("path",{d:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z"})})},"CodexIcon",0,function(e){return(0,i.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:(0,i.jsx)("path",{d:"M22.418 9.822a5.903 5.903 0 0 0-.52-4.91 6.1 6.1 0 0 0-2.822-2.513 6.204 6.204 0 0 0-3.78-.389A6.055 6.055 0 0 0 13.232.518 6.129 6.129 0 0 0 10.726 0a6.185 6.185 0 0 0-3.615 1.153A6.052 6.052 0 0 0 4.88 4.187a6.102 6.102 0 0 0-2.344 1.018A6.008 6.008 0 0 0 .828 7.087a5.981 5.981 0 0 0 .754 7.09 5.904 5.904 0 0 0 .52 4.911 6.101 6.101 0 0 0 2.821 2.513 6.205 6.205 0 0 0 3.78.389 6.057 6.057 0 0 0 2.065 1.492 6.13 6.13 0 0 0 2.505.518 6.185 6.185 0 0 0 3.617-1.154 6.052 6.052 0 0 0 2.232-3.035 6.101 6.101 0 0 0 2.343-1.018 6.009 6.009 0 0 0 1.709-1.883 5.981 5.981 0 0 0-.756-7.088Zm-9.143 12.609a4.583 4.583 0 0 1-2.918-1.04c.037-.02.102-.056.144-.081l4.844-2.76a.783.783 0 0 0 .397-.68v-6.738L17.79 12.3a.072.072 0 0 1 .04.055v5.58a4.473 4.473 0 0 1-1.335 3.176 4.596 4.596 0 0 1-3.219 1.321Zm-9.793-4.127a4.432 4.432 0 0 1-.544-3.014c.036.021.099.06.144.085l4.843 2.76a.796.796 0 0 0 .795 0l5.913-3.369V17.1a.071.071 0 0 1-.029.062L9.708 19.95a4.617 4.617 0 0 1-3.458.447 4.556 4.556 0 0 1-2.768-2.093ZM2.208 7.872A4.527 4.527 0 0 1 4.58 5.9l-.002.164v5.52a.768.768 0 0 0 .397.68l5.913 3.369-2.047 1.166a.075.075 0 0 1-.069.006l-4.896-2.792a4.51 4.51 0 0 1-2.12-2.73 4.45 4.45 0 0 1 .452-3.411Zm16.818 3.861-5.913-3.368 2.047-1.166a.074.074 0 0 1 .07-.006l4.896 2.789a4.526 4.526 0 0 1 1.762 1.815 4.448 4.448 0 0 1-.418 4.808 4.556 4.556 0 0 1-2.049 1.494v-5.686a.767.767 0 0 0-.395-.68Zm2.038-3.025a6.874 6.874 0 0 0-.144-.085l-4.843-2.76a.797.797 0 0 0-.796 0L9.368 9.23V6.9a.072.072 0 0 1 .03-.062l4.895-2.787a4.608 4.608 0 0 1 4.885.207 4.51 4.51 0 0 1 1.599 1.955c.333.788.433 1.654.287 2.496ZM8.255 12.865 6.208 11.7a.071.071 0 0 1-.04-.056v-5.58c0-.854.248-1.69.713-2.412a4.54 4.54 0 0 1 1.913-1.658 4.614 4.614 0 0 1 4.85.616c-.037.02-.102.055-.144.08L8.657 5.452a.782.782 0 0 0-.398.68l-.004 6.734ZM9.367 10.5 12.001 9l2.633 1.5v3L12.001 15l-2.634-1.5v-3Z"})})},"LmStudioIcon",0,n,"LocalLlmIcon",0,a,"LocalLlmTabIcon",0,function({provider:e,className:r}){return e?(0,i.jsx)(a,{provider:e,className:r}):(0,i.jsx)(s,{className:r})},"OllamaIcon",0,r],93355)},64691,20535,e=>{"use strict";let i={ollama:"Ollama",lmstudio:"LM Studio"};e.s(["LOCAL_LLM_PROVIDER_LABEL",0,i,"localLlmTabLabel",0,function(e){return e?i[e]:"ローカルLLM"}],64691);let s=(0,e.i(75254).default)("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);e.s(["SquareTerminal",0,s],20535)},99894,93309,52216,31343,23622,e=>{"use strict";let i,s,r,n,o,a,h,l,c,d,u,_;var f=e.i(47167),p=Object.defineProperty,g=Object.getOwnPropertyDescriptor,v=(e,i,s,r)=>{for(var n,o=r>1?void 0:r?g(i,s):i,a=e.length-1;a>=0;a--)(n=e[a])&&(o=(r?n(i,s,o):n(o))||o);return r&&o&&p(i,s,o),o},m=(e,i)=>(s,r)=>i(s,r,e),S="Terminal input",w="Too much output to announce, navigate to rows manually to read";function b(e,i,s,r){var n;n=e=e.replace(/\r?\n/g,"\r"),e=s.decPrivateModes.bracketedPasteMode&&!0!==r.rawOptions.ignoreBracketedPasteMode?"\x1b[200~"+n+"\x1b[201~":n,s.triggerDataEvent(e,!0),i.value=""}function y(e,i,s){let r=s.getBoundingClientRect(),n=e.clientX-r.left-10,o=e.clientY-r.top-10;i.style.width="20px",i.style.height="20px",i.style.left=`${n}px`,i.style.top=`${o}px`,i.style.zIndex="1000",i.focus()}function C(e,i,s,r,n){y(e,i,s),n&&r.rightClickSelect(e),i.value=r.selectionText,i.select()}function x(e){return e>65535?String.fromCharCode(((e-=65536)>>10)+55296)+String.fromCharCode(e%1024+56320):String.fromCharCode(e)}function k(e,i=0,s=e.length){let r="";for(let n=i;n<s;++n){let i=e[n];i>65535?(i-=65536,r+=String.fromCharCode((i>>10)+55296)+String.fromCharCode(i%1024+56320)):r+=String.fromCharCode(i)}return r}var E=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,i){let s=e.length;if(!s)return 0;let r=0,n=0;if(this._interim){let s=e.charCodeAt(n++);56320<=s&&s<=57343?i[r++]=(this._interim-55296)*1024+s-56320+65536:(i[r++]=this._interim,i[r++]=s),this._interim=0}for(let o=n;o<s;++o){let n=e.charCodeAt(o);if(55296<=n&&n<=56319){if(++o>=s)return this._interim=n,r;let a=e.charCodeAt(o);56320<=a&&a<=57343?i[r++]=(n-55296)*1024+a-56320+65536:(i[r++]=n,i[r++]=a);continue}65279!==n&&(i[r++]=n)}return r}},B=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,i){let s=e.length;if(!s)return 0;let r=0,n,o,a,h,l=0,c=0;if(this.interim[0]){let n=!1,o=this.interim[0];o&=(224&o)==192?31:(240&o)==224?15:7;let a=0,h;for(;(h=63&this.interim[++a])&&a<4;)o<<=6,o|=h;let l=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,d=l-a;for(;c<d;){if(c>=s)return 0;if((192&(h=e[c++]))!=128){c--,n=!0;break}this.interim[a++]=h,o<<=6,o|=63&h}n||(2===l?o<128?c--:i[r++]=o:3===l?o<2048||o>=55296&&o<=57343||65279===o||(i[r++]=o):o<65536||o>1114111||(i[r++]=o)),this.interim.fill(0)}let d=s-4,u=c;for(;u<s;){for(;u<d&&!(128&(n=e[u]))&&!(128&(o=e[u+1]))&&!(128&(a=e[u+2]))&&!(128&(h=e[u+3]));)i[r++]=n,i[r++]=o,i[r++]=a,i[r++]=h,u+=4;if((n=e[u++])<128)i[r++]=n;else if((224&n)==192){if(u>=s)return this.interim[0]=n,r;if((192&(o=e[u++]))!=128||(l=(31&n)<<6|63&o)<128){u--;continue}i[r++]=l}else if((240&n)==224){if(u>=s)return this.interim[0]=n,r;if((192&(o=e[u++]))!=128){u--;continue}if(u>=s)return this.interim[0]=n,this.interim[1]=o,r;if((192&(a=e[u++]))!=128){u--;continue}if((l=(15&n)<<12|(63&o)<<6|63&a)<2048||l>=55296&&l<=57343||65279===l)continue;i[r++]=l}else if((248&n)==240){if(u>=s)return this.interim[0]=n,r;if((192&(o=e[u++]))!=128){u--;continue}if(u>=s)return this.interim[0]=n,this.interim[1]=o,r;if((192&(a=e[u++]))!=128){u--;continue}if(u>=s)return this.interim[0]=n,this.interim[1]=o,this.interim[2]=a,r;if((192&(h=e[u++]))!=128){u--;continue}if((l=(7&n)<<18|(63&o)<<12|(63&a)<<6|63&h)<65536||l>1114111)continue;i[r++]=l}}return r}},L=class e{constructor(){this.fg=0,this.bg=0,this.extended=new D}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let i=new e;return i.fg=this.fg,i.bg=this.bg,i.extended=this.extended.clone(),i}isInverse(){return 0x4000000&this.fg}isBold(){return 0x8000000&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?1:0x10000000&this.fg}isBlink(){return 0x20000000&this.fg}isInvisible(){return 0x40000000&this.fg}isItalic(){return 0x4000000&this.bg}isDim(){return 0x8000000&this.bg}isStrikethrough(){return 0x80000000&this.fg}isProtected(){return 0x20000000&this.bg}isOverline(){return 0x40000000&this.bg}getFgColorMode(){return 0x3000000&this.fg}getBgColorMode(){return 0x3000000&this.bg}isFgRGB(){return(0x3000000&this.fg)==0x3000000}isBgRGB(){return(0x3000000&this.bg)==0x3000000}isFgPalette(){return(0x3000000&this.fg)==0x1000000||(0x3000000&this.fg)==0x2000000}isBgPalette(){return(0x3000000&this.bg)==0x1000000||(0x3000000&this.bg)==0x2000000}isFgDefault(){return(0x3000000&this.fg)==0}isBgDefault(){return(0x3000000&this.bg)==0}isAttributeDefault(){return 0===this.fg&&0===this.bg}getFgColor(){switch(0x3000000&this.fg){case 0x1000000:case 0x2000000:return 255&this.fg;case 0x3000000:return 0xffffff&this.fg;default:return -1}}getBgColor(){switch(0x3000000&this.bg){case 0x1000000:case 0x2000000:return 255&this.bg;case 0x3000000:return 0xffffff&this.bg;default:return -1}}hasExtendedAttrs(){return 0x10000000&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-0x10000001:this.bg|=0x10000000}getUnderlineColor(){if(0x10000000&this.bg&&~this.extended.underlineColor)switch(0x3000000&this.extended.underlineColor){case 0x1000000:case 0x2000000:return 255&this.extended.underlineColor;case 0x3000000:return 0xffffff&this.extended.underlineColor}return this.getFgColor()}getUnderlineColorMode(){return 0x10000000&this.bg&&~this.extended.underlineColor?0x3000000&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0x3000000:this.isFgRGB()}isUnderlineColorPalette(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0x1000000||(0x3000000&this.extended.underlineColor)==0x2000000:this.isFgPalette()}isUnderlineColorDefault(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 0x10000000&this.fg?0x10000000&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},D=class e{constructor(e=0,i=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=i}get ext(){return this._urlId?-0x1c000001&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(0x1c000000&this._ext)>>26}set underlineStyle(e){this._ext&=-0x1c000001,this._ext|=e<<26&0x1c000000}get underlineColor(){return 0x3ffffff&this._ext}set underlineColor(e){this._ext&=-0x4000000,this._ext|=0x3ffffff&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(0xe0000000&this._ext)>>29;return e<0?0xfffffff8^e:e}set underlineVariantOffset(e){this._ext&=0x1fffffff,this._ext|=e<<29&0xe0000000}clone(){return new e(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}},R=class e extends L{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new D,this.combinedData=""}static fromCharData(i){let s=new e;return s.setFromCharData(i),s}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?x(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(2===e[1].length){let s=e[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},M="di$target",P="di$dependencies",T=new Map;function A(e){if(T.has(e))return T.get(e);let i=function(e,s,r){var n,o,a;if(3!=arguments.length)throw Error("@IServiceName-decorator can only be used to decorate a parameter");n=i,o=e,a=r,o[M]===o?o[P].push({id:n,index:a}):(o[P]=[{id:n,index:a}],o[M]=o)};return i._id=e,T.set(e,i),i}var O=A("BufferService"),I=A("CoreMouseService"),N=A("CoreService"),H=A("CharsetService"),W=A("InstantiationService"),z=A("LogService"),F=A("OptionsService"),$=A("OscLinkService"),K=A("UnicodeService"),U=A("DecorationService"),q=class{constructor(e,i,s){this._bufferService=e,this._optionsService=i,this._oscLinkService=s}provideLinks(e,i){let s=this._bufferService.buffer.lines.get(e-1);if(!s)return void i(void 0);let r=[],n=this._optionsService.rawOptions.linkHandler,o=new R,a=s.getTrimmedLength(),h=-1,l=-1,c=!1;for(let i=0;i<a;i++)if(!(-1===l&&!s.hasContent(i))){if(s.loadCell(i,o),o.hasExtendedAttrs()&&o.extended.urlId)if(-1===l){l=i,h=o.extended.urlId;continue}else c=o.extended.urlId!==h;else -1!==l&&(c=!0);if(c||-1!==l&&i===a-1){let s=this._oscLinkService.getLinkData(h)?.uri;if(s){let o={start:{x:l+1,y:e},end:{x:i+ +(!c&&i===a-1),y:e}},h=!1;if(!n?.allowNonHttpProtocols)try{let e=new URL(s);["http:","https:"].includes(e.protocol)||(h=!0)}catch{h=!0}h||r.push({text:s,range:o,activate:(e,i)=>n?n.activate(e,i,o):function(e){if(confirm(`Do you want to navigate to ${e}?
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,471,e=>{"use strict";let i=(0,e.i(75254).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",0,i],471)},77705,88699,e=>{"use strict";var i=e.i(75254);let s=(0,i.default)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);e.s(["EyeOff",0,s],77705);let r=(0,i.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(["Pencil",0,r],88699)},93355,66992,e=>{"use strict";var i=e.i(18050);let s=(0,e.i(75254).default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);function r(e){return(0,i.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:(0,i.jsx)("path",{d:"M16.361 10.26a.894.894 0 0 0-.558.47l-.072.148.001.207c0 .193.004.217.059.353.076.193.152.312.291.448.24.238.51.3.872.205a.86.86 0 0 0 .517-.436.752.752 0 0 0 .08-.498c-.064-.453-.33-.782-.724-.897a1.06 1.06 0 0 0-.466 0zm-9.203.005c-.305.096-.533.32-.65.639a1.187 1.187 0 0 0-.06.52c.057.309.31.59.598.667.362.095.632.033.872-.205.14-.136.215-.255.291-.448.055-.136.059-.16.059-.353l.001-.207-.072-.148a.894.894 0 0 0-.565-.472 1.02 1.02 0 0 0-.474.007Zm4.184 2c-.131.071-.223.25-.195.383.031.143.157.288.353.407.105.063.112.072.117.136.004.038-.01.146-.029.243-.02.094-.036.194-.036.222.002.074.07.195.143.253.064.052.076.054.255.059.164.005.198.001.264-.03.169-.082.212-.234.15-.525-.052-.243-.042-.28.087-.355.137-.08.281-.219.324-.314a.365.365 0 0 0-.175-.48.394.394 0 0 0-.181-.033c-.126 0-.207.03-.355.124l-.085.053-.053-.032c-.219-.13-.259-.145-.391-.143a.396.396 0 0 0-.193.032zm.39-2.195c-.373.036-.475.05-.654.086-.291.06-.68.195-.951.328-.94.46-1.589 1.226-1.787 2.114-.04.176-.045.234-.045.53 0 .294.005.357.043.524.264 1.16 1.332 2.017 2.714 2.173.3.033 1.596.033 1.896 0 1.11-.125 2.064-.727 2.493-1.571.114-.226.169-.372.22-.602.039-.167.044-.23.044-.523 0-.297-.005-.355-.045-.531-.288-1.29-1.539-2.304-3.072-2.497a6.873 6.873 0 0 0-.855-.031zm.645.937a3.283 3.283 0 0 1 1.44.514c.223.148.537.458.671.662.166.251.26.508.303.82.02.143.01.251-.043.482-.08.345-.332.705-.672.957a3.115 3.115 0 0 1-.689.348c-.382.122-.632.144-1.525.138-.582-.006-.686-.01-.853-.042-.57-.107-1.022-.334-1.35-.68-.264-.28-.385-.535-.45-.946-.03-.192.025-.509.137-.776.136-.326.488-.73.836-.963.403-.269.934-.46 1.422-.512.187-.02.586-.02.773-.002zm-5.503-11a1.653 1.653 0 0 0-.683.298C5.617.74 5.173 1.666 4.985 2.819c-.07.436-.119 1.04-.119 1.503 0 .544.064 1.24.155 1.721.02.107.031.202.023.208a8.12 8.12 0 0 1-.187.152 5.324 5.324 0 0 0-.949 1.02 5.49 5.49 0 0 0-.94 2.339 6.625 6.625 0 0 0-.023 1.357c.091.78.325 1.438.727 2.04l.13.195-.037.064c-.269.452-.498 1.105-.605 1.732-.084.496-.095.629-.095 1.294 0 .67.009.803.088 1.266.095.555.288 1.143.503 1.534.071.128.243.393.264.407.007.003-.014.067-.046.141a7.405 7.405 0 0 0-.548 1.873c-.062.417-.071.552-.071.991 0 .56.031.832.148 1.279L3.42 24h1.478l-.05-.091c-.297-.552-.325-1.575-.068-2.597.117-.472.25-.819.498-1.296l.148-.29v-.177c0-.165-.003-.184-.057-.293a.915.915 0 0 0-.194-.25 1.74 1.74 0 0 1-.385-.543c-.424-.92-.506-2.286-.208-3.451.124-.486.329-.918.544-1.154a.787.787 0 0 0 .223-.531c0-.195-.07-.355-.224-.522a3.136 3.136 0 0 1-.817-1.729c-.14-.96.114-2.005.69-2.834.563-.814 1.353-1.336 2.237-1.475.199-.033.57-.028.776.01.226.04.367.028.512-.041.179-.085.268-.19.374-.431.093-.215.165-.333.36-.576.234-.29.46-.489.822-.729.413-.27.884-.467 1.352-.561.17-.035.25-.04.569-.04.319 0 .398.005.569.04a4.07 4.07 0 0 1 1.914.997c.117.109.398.457.488.602.034.057.095.177.132.267.105.241.195.346.374.43.14.068.286.082.503.045.343-.058.607-.053.943.016 1.144.23 2.14 1.173 2.581 2.437.385 1.108.276 2.267-.296 3.153-.097.15-.193.27-.333.419-.301.322-.301.722-.001 1.053.493.539.801 1.866.708 3.036-.062.772-.26 1.463-.533 1.854a2.096 2.096 0 0 1-.224.258.916.916 0 0 0-.194.25c-.054.109-.057.128-.057.293v.178l.148.29c.248.476.38.823.498 1.295.253 1.008.231 2.01-.059 2.581a.845.845 0 0 0-.044.098c0 .006.329.009.732.009h.73l.02-.074.036-.134c.019-.076.057-.3.088-.516.029-.217.029-1.016 0-1.258-.11-.875-.295-1.57-.597-2.226-.032-.074-.053-.138-.046-.141.008-.005.057-.074.108-.152.376-.569.607-1.284.724-2.228.031-.26.031-1.378 0-1.628-.083-.645-.182-1.082-.348-1.525a6.083 6.083 0 0 0-.329-.7l-.038-.064.131-.194c.402-.604.636-1.262.727-2.04a6.625 6.625 0 0 0-.024-1.358 5.512 5.512 0 0 0-.939-2.339 5.325 5.325 0 0 0-.95-1.02 8.097 8.097 0 0 1-.186-.152.692.692 0 0 1 .023-.208c.208-1.087.201-2.443-.017-3.503-.19-.924-.535-1.658-.98-2.082-.354-.338-.716-.482-1.15-.455-.996.059-1.8 1.205-2.116 3.01a6.805 6.805 0 0 0-.097.726c0 .036-.007.066-.015.066a.96.96 0 0 1-.149-.078A4.857 4.857 0 0 0 12 3.03c-.832 0-1.687.243-2.456.698a.958.958 0 0 1-.148.078c-.008 0-.015-.03-.015-.066a6.71 6.71 0 0 0-.097-.725C8.997 1.392 8.337.319 7.46.048a2.096 2.096 0 0 0-.585-.041Zm.293 1.402c.248.197.523.759.682 1.388.03.113.06.244.069.292.007.047.026.152.041.233.067.365.098.76.102 1.24l.002.475-.12.175-.118.178h-.278c-.324 0-.646.041-.954.124l-.238.06c-.033.007-.038-.003-.057-.144a8.438 8.438 0 0 1 .016-2.323c.124-.788.413-1.501.696-1.711.067-.05.079-.049.157.013zm9.825-.012c.17.126.358.46.498.888.28.854.36 2.028.212 3.145-.019.14-.024.151-.057.144l-.238-.06a3.693 3.693 0 0 0-.954-.124h-.278l-.119-.178-.119-.175.002-.474c.004-.669.066-1.19.214-1.772.157-.623.434-1.185.68-1.382.078-.062.09-.063.159-.012z"})})}function n(e){return(0,i.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:(0,i.jsx)("path",{d:"M14.025 0c3.492 0 5.237 0 6.571.68a6.24 6.24 0 0 1 2.725 2.724C24 4.738 24 6.484 24 9.975v4.05c0 3.492 0 5.237-.68 6.571a6.24 6.24 0 0 1-2.724 2.725c-1.334.679-3.08.679-6.571.679h-4.05c-3.492 0-5.237 0-6.571-.68A6.24 6.24 0 0 1 .68 20.597C0 19.262 0 17.516 0 14.025v-4.05c0-3.492 0-5.237.68-6.571A6.23 6.23 0 0 1 3.404.68C4.738 0 6.484 0 9.975 0zM7.688 16.313a1.313 1.313 0 0 0 0 2.625h11.625a1.313 1.313 0 0 0 0-2.625zm-3-3.75a1.313 1.313 0 0 0 0 2.624h11.625a1.313 1.313 0 0 0 0-2.624zm3-3.75a1.313 1.313 0 0 0 0 2.624h11.625a1.313 1.313 0 0 0 0-2.624zm-3-3.75a1.313 1.313 0 0 0 0 2.625h11.625a1.313 1.313 0 0 0 0-2.625z"})})}e.s(["Cpu",0,s],66992);let o={ollama:r,lmstudio:n};function a({provider:e,...s}){let r=o[e];return(0,i.jsx)(r,{...s})}e.s(["ClaudeIcon",0,function(e){return(0,i.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:(0,i.jsx)("path",{d:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z"})})},"CodexIcon",0,function(e){return(0,i.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:(0,i.jsx)("path",{d:"M22.418 9.822a5.903 5.903 0 0 0-.52-4.91 6.1 6.1 0 0 0-2.822-2.513 6.204 6.204 0 0 0-3.78-.389A6.055 6.055 0 0 0 13.232.518 6.129 6.129 0 0 0 10.726 0a6.185 6.185 0 0 0-3.615 1.153A6.052 6.052 0 0 0 4.88 4.187a6.102 6.102 0 0 0-2.344 1.018A6.008 6.008 0 0 0 .828 7.087a5.981 5.981 0 0 0 .754 7.09 5.904 5.904 0 0 0 .52 4.911 6.101 6.101 0 0 0 2.821 2.513 6.205 6.205 0 0 0 3.78.389 6.057 6.057 0 0 0 2.065 1.492 6.13 6.13 0 0 0 2.505.518 6.185 6.185 0 0 0 3.617-1.154 6.052 6.052 0 0 0 2.232-3.035 6.101 6.101 0 0 0 2.343-1.018 6.009 6.009 0 0 0 1.709-1.883 5.981 5.981 0 0 0-.756-7.088Zm-9.143 12.609a4.583 4.583 0 0 1-2.918-1.04c.037-.02.102-.056.144-.081l4.844-2.76a.783.783 0 0 0 .397-.68v-6.738L17.79 12.3a.072.072 0 0 1 .04.055v5.58a4.473 4.473 0 0 1-1.335 3.176 4.596 4.596 0 0 1-3.219 1.321Zm-9.793-4.127a4.432 4.432 0 0 1-.544-3.014c.036.021.099.06.144.085l4.843 2.76a.796.796 0 0 0 .795 0l5.913-3.369V17.1a.071.071 0 0 1-.029.062L9.708 19.95a4.617 4.617 0 0 1-3.458.447 4.556 4.556 0 0 1-2.768-2.093ZM2.208 7.872A4.527 4.527 0 0 1 4.58 5.9l-.002.164v5.52a.768.768 0 0 0 .397.68l5.913 3.369-2.047 1.166a.075.075 0 0 1-.069.006l-4.896-2.792a4.51 4.51 0 0 1-2.12-2.73 4.45 4.45 0 0 1 .452-3.411Zm16.818 3.861-5.913-3.368 2.047-1.166a.074.074 0 0 1 .07-.006l4.896 2.789a4.526 4.526 0 0 1 1.762 1.815 4.448 4.448 0 0 1-.418 4.808 4.556 4.556 0 0 1-2.049 1.494v-5.686a.767.767 0 0 0-.395-.68Zm2.038-3.025a6.874 6.874 0 0 0-.144-.085l-4.843-2.76a.797.797 0 0 0-.796 0L9.368 9.23V6.9a.072.072 0 0 1 .03-.062l4.895-2.787a4.608 4.608 0 0 1 4.885.207 4.51 4.51 0 0 1 1.599 1.955c.333.788.433 1.654.287 2.496ZM8.255 12.865 6.208 11.7a.071.071 0 0 1-.04-.056v-5.58c0-.854.248-1.69.713-2.412a4.54 4.54 0 0 1 1.913-1.658 4.614 4.614 0 0 1 4.85.616c-.037.02-.102.055-.144.08L8.657 5.452a.782.782 0 0 0-.398.68l-.004 6.734ZM9.367 10.5 12.001 9l2.633 1.5v3L12.001 15l-2.634-1.5v-3Z"})})},"LmStudioIcon",0,n,"LocalLlmIcon",0,a,"LocalLlmTabIcon",0,function({provider:e,className:r}){return e?(0,i.jsx)(a,{provider:e,className:r}):(0,i.jsx)(s,{className:r})},"OllamaIcon",0,r],93355)},64691,20535,e=>{"use strict";let i={ollama:"Ollama",lmstudio:"LM Studio"};e.s(["LOCAL_LLM_PROVIDER_LABEL",0,i,"localLlmTabLabel",0,function(e){return e?i[e]:"ローカルLLM"}],64691);let s=(0,e.i(75254).default)("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);e.s(["SquareTerminal",0,s],20535)},99894,93309,52216,31343,23622,e=>{"use strict";let i,s,r,n,o,a,h,l,c,d,u,_;var f=e.i(47167),p=Object.defineProperty,g=Object.getOwnPropertyDescriptor,v=(e,i,s,r)=>{for(var n,o=r>1?void 0:r?g(i,s):i,a=e.length-1;a>=0;a--)(n=e[a])&&(o=(r?n(i,s,o):n(o))||o);return r&&o&&p(i,s,o),o},m=(e,i)=>(s,r)=>i(s,r,e),S="Terminal input",w="Too much output to announce, navigate to rows manually to read";function b(e,i,s,r){var n;n=e=e.replace(/\r?\n/g,"\r"),e=s.decPrivateModes.bracketedPasteMode&&!0!==r.rawOptions.ignoreBracketedPasteMode?"\x1b[200~"+n+"\x1b[201~":n,s.triggerDataEvent(e,!0),i.value=""}function y(e,i,s){let r=s.getBoundingClientRect(),n=e.clientX-r.left-10,o=e.clientY-r.top-10;i.style.width="20px",i.style.height="20px",i.style.left=`${n}px`,i.style.top=`${o}px`,i.style.zIndex="1000",i.focus()}function C(e,i,s,r,n){y(e,i,s),n&&r.rightClickSelect(e),i.value=r.selectionText,i.select()}function x(e){return e>65535?String.fromCharCode(((e-=65536)>>10)+55296)+String.fromCharCode(e%1024+56320):String.fromCharCode(e)}function k(e,i=0,s=e.length){let r="";for(let n=i;n<s;++n){let i=e[n];i>65535?(i-=65536,r+=String.fromCharCode((i>>10)+55296)+String.fromCharCode(i%1024+56320)):r+=String.fromCharCode(i)}return r}var E=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,i){let s=e.length;if(!s)return 0;let r=0,n=0;if(this._interim){let s=e.charCodeAt(n++);56320<=s&&s<=57343?i[r++]=(this._interim-55296)*1024+s-56320+65536:(i[r++]=this._interim,i[r++]=s),this._interim=0}for(let o=n;o<s;++o){let n=e.charCodeAt(o);if(55296<=n&&n<=56319){if(++o>=s)return this._interim=n,r;let a=e.charCodeAt(o);56320<=a&&a<=57343?i[r++]=(n-55296)*1024+a-56320+65536:(i[r++]=n,i[r++]=a);continue}65279!==n&&(i[r++]=n)}return r}},B=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,i){let s=e.length;if(!s)return 0;let r=0,n,o,a,h,l=0,c=0;if(this.interim[0]){let n=!1,o=this.interim[0];o&=(224&o)==192?31:(240&o)==224?15:7;let a=0,h;for(;(h=63&this.interim[++a])&&a<4;)o<<=6,o|=h;let l=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,d=l-a;for(;c<d;){if(c>=s)return 0;if((192&(h=e[c++]))!=128){c--,n=!0;break}this.interim[a++]=h,o<<=6,o|=63&h}n||(2===l?o<128?c--:i[r++]=o:3===l?o<2048||o>=55296&&o<=57343||65279===o||(i[r++]=o):o<65536||o>1114111||(i[r++]=o)),this.interim.fill(0)}let d=s-4,u=c;for(;u<s;){for(;u<d&&!(128&(n=e[u]))&&!(128&(o=e[u+1]))&&!(128&(a=e[u+2]))&&!(128&(h=e[u+3]));)i[r++]=n,i[r++]=o,i[r++]=a,i[r++]=h,u+=4;if((n=e[u++])<128)i[r++]=n;else if((224&n)==192){if(u>=s)return this.interim[0]=n,r;if((192&(o=e[u++]))!=128||(l=(31&n)<<6|63&o)<128){u--;continue}i[r++]=l}else if((240&n)==224){if(u>=s)return this.interim[0]=n,r;if((192&(o=e[u++]))!=128){u--;continue}if(u>=s)return this.interim[0]=n,this.interim[1]=o,r;if((192&(a=e[u++]))!=128){u--;continue}if((l=(15&n)<<12|(63&o)<<6|63&a)<2048||l>=55296&&l<=57343||65279===l)continue;i[r++]=l}else if((248&n)==240){if(u>=s)return this.interim[0]=n,r;if((192&(o=e[u++]))!=128){u--;continue}if(u>=s)return this.interim[0]=n,this.interim[1]=o,r;if((192&(a=e[u++]))!=128){u--;continue}if(u>=s)return this.interim[0]=n,this.interim[1]=o,this.interim[2]=a,r;if((192&(h=e[u++]))!=128){u--;continue}if((l=(7&n)<<18|(63&o)<<12|(63&a)<<6|63&h)<65536||l>1114111)continue;i[r++]=l}}return r}},L=class e{constructor(){this.fg=0,this.bg=0,this.extended=new D}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let i=new e;return i.fg=this.fg,i.bg=this.bg,i.extended=this.extended.clone(),i}isInverse(){return 0x4000000&this.fg}isBold(){return 0x8000000&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?1:0x10000000&this.fg}isBlink(){return 0x20000000&this.fg}isInvisible(){return 0x40000000&this.fg}isItalic(){return 0x4000000&this.bg}isDim(){return 0x8000000&this.bg}isStrikethrough(){return 0x80000000&this.fg}isProtected(){return 0x20000000&this.bg}isOverline(){return 0x40000000&this.bg}getFgColorMode(){return 0x3000000&this.fg}getBgColorMode(){return 0x3000000&this.bg}isFgRGB(){return(0x3000000&this.fg)==0x3000000}isBgRGB(){return(0x3000000&this.bg)==0x3000000}isFgPalette(){return(0x3000000&this.fg)==0x1000000||(0x3000000&this.fg)==0x2000000}isBgPalette(){return(0x3000000&this.bg)==0x1000000||(0x3000000&this.bg)==0x2000000}isFgDefault(){return(0x3000000&this.fg)==0}isBgDefault(){return(0x3000000&this.bg)==0}isAttributeDefault(){return 0===this.fg&&0===this.bg}getFgColor(){switch(0x3000000&this.fg){case 0x1000000:case 0x2000000:return 255&this.fg;case 0x3000000:return 0xffffff&this.fg;default:return -1}}getBgColor(){switch(0x3000000&this.bg){case 0x1000000:case 0x2000000:return 255&this.bg;case 0x3000000:return 0xffffff&this.bg;default:return -1}}hasExtendedAttrs(){return 0x10000000&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-0x10000001:this.bg|=0x10000000}getUnderlineColor(){if(0x10000000&this.bg&&~this.extended.underlineColor)switch(0x3000000&this.extended.underlineColor){case 0x1000000:case 0x2000000:return 255&this.extended.underlineColor;case 0x3000000:return 0xffffff&this.extended.underlineColor}return this.getFgColor()}getUnderlineColorMode(){return 0x10000000&this.bg&&~this.extended.underlineColor?0x3000000&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0x3000000:this.isFgRGB()}isUnderlineColorPalette(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0x1000000||(0x3000000&this.extended.underlineColor)==0x2000000:this.isFgPalette()}isUnderlineColorDefault(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 0x10000000&this.fg?0x10000000&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},D=class e{constructor(e=0,i=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=i}get ext(){return this._urlId?-0x1c000001&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(0x1c000000&this._ext)>>26}set underlineStyle(e){this._ext&=-0x1c000001,this._ext|=e<<26&0x1c000000}get underlineColor(){return 0x3ffffff&this._ext}set underlineColor(e){this._ext&=-0x4000000,this._ext|=0x3ffffff&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(0xe0000000&this._ext)>>29;return e<0?0xfffffff8^e:e}set underlineVariantOffset(e){this._ext&=0x1fffffff,this._ext|=e<<29&0xe0000000}clone(){return new e(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}},R=class e extends L{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new D,this.combinedData=""}static fromCharData(i){let s=new e;return s.setFromCharData(i),s}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?x(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(2===e[1].length){let s=e[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},M="di$target",P="di$dependencies",T=new Map;function A(e){if(T.has(e))return T.get(e);let i=function(e,s,r){var n,o,a;if(3!=arguments.length)throw Error("@IServiceName-decorator can only be used to decorate a parameter");n=i,o=e,a=r,o[M]===o?o[P].push({id:n,index:a}):(o[P]=[{id:n,index:a}],o[M]=o)};return i._id=e,T.set(e,i),i}var O=A("BufferService"),I=A("CoreMouseService"),N=A("CoreService"),H=A("CharsetService"),W=A("InstantiationService"),z=A("LogService"),F=A("OptionsService"),$=A("OscLinkService"),K=A("UnicodeService"),U=A("DecorationService"),q=class{constructor(e,i,s){this._bufferService=e,this._optionsService=i,this._oscLinkService=s}provideLinks(e,i){let s=this._bufferService.buffer.lines.get(e-1);if(!s)return void i(void 0);let r=[],n=this._optionsService.rawOptions.linkHandler,o=new R,a=s.getTrimmedLength(),h=-1,l=-1,c=!1;for(let i=0;i<a;i++)if(!(-1===l&&!s.hasContent(i))){if(s.loadCell(i,o),o.hasExtendedAttrs()&&o.extended.urlId)if(-1===l){l=i,h=o.extended.urlId;continue}else c=o.extended.urlId!==h;else -1!==l&&(c=!0);if(c||-1!==l&&i===a-1){let s=this._oscLinkService.getLinkData(h)?.uri;if(s){let o={start:{x:l+1,y:e},end:{x:i+ +(!c&&i===a-1),y:e}},h=!1;if(!n?.allowNonHttpProtocols)try{let e=new URL(s);["http:","https:"].includes(e.protocol)||(h=!0)}catch{h=!0}h||r.push({text:s,range:o,activate:(e,i)=>n?n.activate(e,i,o):function(e){if(confirm(`Do you want to navigate to ${e}?
|
|
2
2
|
|
|
3
3
|
WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}(i),hover:(e,i)=>n?.hover?.(e,i,o),leave:(e,i)=>n?.leave?.(e,i,o)})}c=!1,o.hasExtendedAttrs()&&o.extended.urlId?(l=i,h=o.extended.urlId):(l=-1,h=-1)}}i(r)}};q=v([m(0,O),m(1,F),m(2,$)],q);var V=A("CharSizeService"),j=A("CoreBrowserService"),Y=A("MouseService"),X=A("RenderService"),G=A("SelectionService"),J=A("CharacterJoinerService"),Z=A("ThemeService"),Q=A("LinkProviderService"),ee=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?er.isErrorNoTelemetry(e)?new er(e.message+`
|
|
4
4
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,95057,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r={formatUrl:function(){return i},formatWithValidation:function(){return u},urlObjectKeys:function(){return l}};for(var a in r)Object.defineProperty(n,a,{enumerable:!0,get:r[a]});let o=e.r(90809)._(e.r(98183)),s=/https?|ftp|gopher|file/;function i(e){let{auth:t,hostname:n}=e,r=e.protocol||"",a=e.pathname||"",i=e.hash||"",l=e.query||"",u=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?u=t+e.host:n&&(u=t+(~n.indexOf(":")?`[${n}]`:n),e.port&&(u+=":"+e.port)),l&&"object"==typeof l&&(l=String(o.urlQueryToSearchParams(l)));let c=e.search||l&&`?${l}`||"";return r&&!r.endsWith(":")&&(r+=":"),e.slashes||(!r||s.test(r))&&!1!==u?(u="//"+(u||""),a&&"/"!==a[0]&&(a="/"+a)):u||(u=""),i&&"#"!==i[0]&&(i="#"+i),c&&"?"!==c[0]&&(c="?"+c),a=a.replace(/[?#]/g,encodeURIComponent),c=c.replace("#","%23"),`${r}${u}${a}${c}${i}`}let l=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function u(e){return i(e)}},73668,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"isLocalURL",{enumerable:!0,get:function(){return o}});let r=e.r(18967),a=e.r(52817);function o(e){if(!(0,r.isAbsoluteUrl)(e))return!0;try{let t=(0,r.getLocationOrigin)(),n=new URL(e,t);return n.origin===t&&(0,a.hasBasePath)(n.pathname)}catch(e){return!1}}},84508,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"errorOnce",{enumerable:!0,get:function(){return r}});let r=e=>{}},22016,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r={default:function(){return v},useLinkStatus:function(){return b}};for(var a in r)Object.defineProperty(n,a,{enumerable:!0,get:r[a]});let o=e.r(90809),s=e.r(18050),i=o._(e.r(71645)),l=e.r(95057),u=e.r(8372),c=e.r(18581),d=e.r(18967),f=e.r(5550);e.r(33525);let p=e.r(88540),m=e.r(91949),g=e.r(73668),h=e.r(9396);function v(t){var n,r;let a,o,v,[b,y]=(0,i.useOptimistic)(m.IDLE_LINK_STATUS),S=(0,i.useRef)(null),{href:E,as:R,children:C,prefetch:k=null,passHref:w,replace:T,shallow:O,scroll:I,onClick:N,onMouseEnter:j,onTouchStart:M,legacyBehavior:P=!1,onNavigate:L,transitionTypes:A,ref:D,unstable_dynamicOnHover:_,...F}=t;a=C,P&&("string"==typeof a||"number"==typeof a)&&(a=(0,s.jsx)("a",{children:a}));let U=i.default.useContext(u.AppRouterContext),B=!1!==k,z=!1!==k?null===(r=k)||"auto"===r?h.FetchStrategy.PPR:h.FetchStrategy.Full:h.FetchStrategy.PPR,H="string"==typeof(n=R||E)?n:(0,l.formatUrl)(n);if(P){if(a?.$$typeof===Symbol.for("react.lazy"))throw Object.defineProperty(Error("`<Link legacyBehavior>` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's `<a>` tag."),"__NEXT_ERROR_CODE",{value:"E863",enumerable:!1,configurable:!0});o=i.default.Children.only(a)}let V=P?o&&"object"==typeof o&&o.ref:D,W=i.default.useCallback(e=>(null!==U&&(S.current=(0,m.mountLinkInstance)(e,H,U,z,B,y)),()=>{S.current&&((0,m.unmountLinkForCurrentNavigation)(S.current),S.current=null),(0,m.unmountPrefetchableInstance)(e)}),[B,H,U,z,y]),$={ref:(0,c.useMergedRef)(W,V),onClick(t){P||"function"!=typeof N||N(t),P&&o.props&&"function"==typeof o.props.onClick&&o.props.onClick(t),!U||t.defaultPrevented||function(t,n,r,a,o,s,l){if("u">typeof window){let u,{nodeName:c}=t.currentTarget;if("A"===c.toUpperCase()&&((u=t.currentTarget.getAttribute("target"))&&"_self"!==u||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.nativeEvent&&2===t.nativeEvent.which)||t.currentTarget.hasAttribute("download"))return;if(!(0,g.isLocalURL)(n)){a&&(t.preventDefault(),location.replace(n));return}if(t.preventDefault(),s){let e=!1;if(s({preventDefault:()=>{e=!0}}),e)return}let{dispatchNavigateAction:d}=e.r(99781);i.default.startTransition(()=>{d(n,a?"replace":"push",!1===o?p.ScrollBehavior.NoScroll:p.ScrollBehavior.Default,r.current,l)})}}(t,H,S,T,I,L,A)},onMouseEnter(e){P||"function"!=typeof j||j(e),P&&o.props&&"function"==typeof o.props.onMouseEnter&&o.props.onMouseEnter(e),U&&B&&(0,m.onNavigationIntent)(e.currentTarget,!0===_)},onTouchStart:function(e){P||"function"!=typeof M||M(e),P&&o.props&&"function"==typeof o.props.onTouchStart&&o.props.onTouchStart(e),U&&B&&(0,m.onNavigationIntent)(e.currentTarget,!0===_)}};return(0,d.isAbsoluteUrl)(H)?$.href=H:P&&!w&&("a"!==o.type||"href"in o.props)||($.href=(0,f.addBasePath)(H)),v=P?i.default.cloneElement(o,$):(0,s.jsx)("a",{...F,...$,children:a}),(0,s.jsx)(x.Provider,{value:b,children:v})}e.r(84508);let x=(0,i.createContext)(m.IDLE_LINK_STATUS),b=()=>(0,i.useContext)(x);("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},97099,e=>{"use strict";var t,n,r,a=e.i(18050),o=e.i(71645),s=e.i(18566),i=e.i(22016),l=e.i(471),u=e.i(75254);let c=(0,u.default)("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]),d=(0,u.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"}]]);var f=e.i(77705);let p=(0,u.default)("folder-x",[["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"}],["path",{d:"m9.5 10.5 5 5",key:"ra9qjz"}],["path",{d:"m14.5 10.5-5 5",key:"l2rkpq"}]]);var m=e.i(88699);let g=(0,u.default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);var h=e.i(27612),v=e.i(70935),x=e.i(30627),b=e.i(37870),y=e.i(76165),S=e.i(51846),E=e.i(2576),R=e.i(22508),C=e.i(37727),k=e.i(31278);let w=(0,u.default)("circle-pause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);var T=e.i(63209);let O=(0,u.default)("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);var I=e.i(95468),N=e.i(73884),j=e.i(86311),M=e.i(68995),P=e.i(85902),L=e.i(93355),A=e.i(64691);function D({entry:e}){if(!e||"idle"===e.terminal)return(0,a.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,a.jsx)(w,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:"idle"})]});if("connecting"===e.terminal)return(0,a.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,a.jsx)(k.Loader2,{className:"w-3 h-3 animate-spin"}),(0,a.jsx)("span",{children:"connecting"})]});if("error"===e.terminal)return(0,a.jsxs)("div",{className:"flex items-center gap-1 text-xs text-destructive",children:[(0,a.jsx)(T.AlertCircle,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:"error"})]});if("exited"===e.terminal||"paused"===e.terminal)return(0,a.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,a.jsx)(O,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:e.terminal})]});switch(e.claude){case"running":return(0,a.jsxs)("div",{className:"flex items-center gap-1 text-xs text-primary",children:[(0,a.jsx)(k.Loader2,{className:"w-3 h-3 animate-spin"}),(0,a.jsx)("span",{children:"running"})]});case"waiting":return(0,a.jsxs)("div",{className:"flex items-center gap-1 text-xs text-warning",children:[(0,a.jsx)(j.MessageSquare,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:"waiting"})]});case"success":return(0,a.jsxs)("div",{className:"flex items-center gap-1 text-xs text-success",children:[(0,a.jsx)(I.CheckCircle2,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:"success"})]});case"failure":case"error":return(0,a.jsxs)("div",{className:"flex items-center gap-1 text-xs text-destructive",children:[(0,a.jsx)(N.XCircle,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:"failure"===e.claude?"failure":"error"})]});default:return(0,a.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,a.jsx)(w,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:"idle"})]})}}function _({tabs:e,activeTabId:t,onTabChange:n,onTabCreateTerminal:r,onTabCreateClaude:s,claudeOption:i,codexOption:l,onTabCreateCodex:u,localLlmOption:c,onTabCreateLocalLlm:d,onTabDelete:f,tabStatusMap:p}){let m=(0,o.useRef)([]),[h,v]=(0,o.useState)({left:0,width:0}),[x,b]=(0,o.useState)(null);(0,o.useEffect)(()=>{let n=e.findIndex(e=>e.tab_id===t);if(-1!==n&&m.current[n]){let e=m.current[n];e&&v({left:e.offsetLeft,width:e.offsetWidth})}},[t,e]);let y=e.some(e=>e.tab_id===t),S=new Map,E=0;for(let t of e)"terminal"===t.mode&&(E+=1,S.set(t.tab_id,E));return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(M.ConfirmDialog,{open:null!==x,onOpenChange:e=>{e.open||b(null)},title:"Delete Tab",message:x?.isRunning?"This tab is running. Are you sure you want to delete it?":"Delete this tab?",confirmLabel:"Delete",cancelLabel:"Cancel",onConfirm:()=>{x&&f(x.tabId)},variant:"danger"}),(0,a.jsxs)("div",{className:"relative flex items-center gap-2 overflow-x-auto border-b border-border pb-1",children:[e.map((e,r)=>{let o=t===e.tab_id,s=p?.get(e.tab_id),i=(s?.claude==="running"||s?.claude==="waiting")&&(s?.terminal==="connected"||s?.terminal===null);return(0,a.jsxs)("div",{ref:e=>{m.current[r]=e},onClick:()=>n(e.tab_id),className:`
|
|
2
|
+
flex items-center gap-2 px-4 pt-1 pb-2 h-10 flex-shrink-0 transition-colors cursor-pointer
|
|
3
|
+
${o?"text-primary":i?"text-primary-light":"text-muted-foreground hover:text-foreground"}
|
|
4
|
+
`,children:[(0,a.jsx)("div",{className:"font-medium flex items-center gap-2",children:"terminal"===e.mode?(0,a.jsxs)("span",{className:"text-xs",children:["terminal ",S.get(e.tab_id)]}):(0,a.jsxs)(a.Fragment,{children:["codex"===e.mode&&(0,a.jsx)("span",{title:"Codex",children:(0,a.jsx)(L.CodexIcon,{className:"w-3 h-3"})}),("local"===e.mode||"ollama"===e.mode||"lmstudio"===e.mode)&&(0,a.jsx)("span",{title:(0,A.localLlmTabLabel)(c?.provider??null),children:(0,a.jsx)(L.LocalLlmTabIcon,{provider:c?.provider??null,className:"w-3 h-3"})}),(0,a.jsx)(D,{entry:s})]})}),(0,a.jsx)(P.Button,{variant:"ghost",size:"icon-xs",onClick:t=>{t.stopPropagation(),b({tabId:e.tab_id,isRunning:i})},children:(0,a.jsx)(C.X,{className:"w-4 h-4"})})]},e.tab_id)}),(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0 ml-auto",children:[(0,a.jsx)("div",{className:"w-px self-stretch bg-theme"}),r&&(0,a.jsx)(P.Button,{size:"icon",onClick:r,title:"Open terminal",children:(0,a.jsx)(g,{className:"w-4 h-4"})}),(0,a.jsx)("span",{title:i?.disabledReason??"Claude Code",children:(0,a.jsx)(P.Button,{size:"icon",onClick:s,disabled:!!i?.disabledReason,children:(0,a.jsx)(L.ClaudeIcon,{className:"w-4 h-4"})})}),l&&(0,a.jsx)("span",{title:l.disabledReason??"Codex",children:(0,a.jsx)(P.Button,{size:"icon",onClick:u,disabled:!!l.disabledReason,children:(0,a.jsx)(L.CodexIcon,{className:"w-4 h-4"})})}),c&&(0,a.jsx)("span",{title:c.disabledReason??`${(0,A.localLlmTabLabel)(c.provider)}: ${c.model}`,children:(0,a.jsx)(P.Button,{size:"icon",onClick:d,disabled:!!c.disabledReason,children:(0,a.jsx)(L.LocalLlmTabIcon,{provider:c.provider,className:"w-4 h-4"})})})]}),y&&(0,a.jsx)("div",{className:"absolute bottom-0 h-0.5 bg-primary transition-[left,width]",style:{left:`${h.left}px`,width:`${h.width}px`}})]})]})}var F=e.i(88784);let U=(0,u.default)("send-horizontal",[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]);var B=e.i(627);let z="tsunagi:task-view-mode",H="tsunagi:editor-submit-on-send",V="(min-width: 1024px)",W=new Set;function $(e){return W.add(e),window.addEventListener("storage",e),()=>{W.delete(e),window.removeEventListener("storage",e)}}function K(e){try{return localStorage.getItem(e)}catch{return null}}function G(e,t){try{localStorage.setItem(e,t)}catch{}W.forEach(e=>e())}function Y(e){let t=window.matchMedia(V);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function q(){let e=K(z);return"split"===e||"editor"===e?e:"terminal"}var J=e.i(50213),X=e.i(49611);let Q="u">typeof navigator&&/Mac/.test(navigator.platform),Z="tsunagi-draft",ee="__none__";function et(e){return`inmemory://${Z}/${e}.md`}function en({draftId:e,draftIds:t,canSend:n,onSend:r}){let{effectiveTheme:s}=(0,B.useTheme)(),{submitOnSend:i,setSubmitOnSend:l}={submitOnSend:(0,o.useSyncExternalStore)($,()=>"true"===K(H),()=>!1),setSubmitOnSend:(0,o.useCallback)(e=>G(H,String(e)),[])},[u,c]=(0,o.useState)(null),d=(0,o.useRef)(null),[f,p]=(0,o.useState)(!0),m=null===e;function g(){let e=d.current,t=e?.getModel();if(!e||!t||!n)return;let a=t.getValue();""===a.trim()||r(a,i)&&(e.executeEdits("send",[{range:t.getFullModelRange(),text:""}]),e.pushUndoStop())}let h=(0,o.useRef)(g);(0,o.useLayoutEffect)(()=>{h.current=g}),(0,o.useEffect)(()=>(0,X.registerFocusTarget)("editor",()=>d.current?.focus()),[]),(0,o.useEffect)(()=>{if(!u)return;let n=new Set([...t,e??ee].map(et));for(let e of u.editor.getModels())e.uri.authority===Z&&(n.has(e.uri.toString())||e.dispose())},[u,t,e]);let v=(0,o.useMemo)(()=>({...J.MONACO_INDENT_OPTIONS,...J.MONACO_IME_OPTIONS,minimap:{enabled:!1},lineNumbers:"on",wordWrap:"on",fontSize:13,scrollBeyondLastLine:!1,automaticLayout:!0,readOnly:m}),[m]);return(0,a.jsxs)("div",{className:"flex flex-col h-full min-h-0 overflow-hidden",children:[(0,a.jsx)("div",{className:"flex-1 min-h-0",children:(0,a.jsx)(F.Editor,{height:"100%",defaultLanguage:"markdown",defaultValue:"",path:et(e??ee),keepCurrentModel:!0,onMount:(e,t)=>{d.current=e,c(t);let n=()=>p(""===e.getValue().trim());n(),e.onDidChangeModelContent(n),e.onDidChangeModel(n),e.onDidFocusEditorText(()=>(0,X.setPaneFocusTarget)("editor")),e.onKeyDown(e=>{e.keyCode===t.KeyCode.Enter&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.stopPropagation(),h.current())}),"editor"===(0,X.getFocusTarget)()&&(e.layout(),e.focus())},options:v,theme:"dark"===s?"vs-dark":"vs-light"})}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-x-3 gap-y-2 p-2 border-t border-border flex-shrink-0",children:[(0,a.jsxs)("span",{className:"mr-auto text-xs text-muted-foreground",children:[Q?"Cmd+Enter":"Ctrl+Enter"," で送信"]}),(0,a.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-foreground cursor-pointer select-none",title:"ON: 送信後に Enter を押して確定します。OFF: テキストを入力するだけで確定しません",children:[(0,a.jsx)("input",{type:"checkbox",checked:i,onChange:e=>l(e.target.checked),className:"size-3.5 accent-primary"}),"送信後にEnter"]}),(0,a.jsxs)(P.Button,{size:"sm",onClick:g,disabled:!(n&&!f),children:[(0,a.jsx)(U,{className:"w-4 h-4"}),"送信"]})]})]})}let er=(0,u.default)("columns-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]),ea=(0,u.default)("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);var eo=e.i(20535),es=e.i(52088);let ei=[{mode:"terminal",label:"Terminal only",icon:eo.SquareTerminal},{mode:"split",label:"Terminal and editor",icon:er},{mode:"editor",label:"Editor only",icon:ea}];function el({mode:e,canSplit:t,onChange:n}){let r=t?ei:ei.filter(e=>"split"!==e.mode);return(0,a.jsx)("div",{className:"flex shrink-0 items-center rounded-md border border-input",role:"group","aria-label":"View mode",children:r.map(({mode:t,label:r,icon:o})=>(0,a.jsx)(P.Button,{variant:"ghost",size:"icon-xs",title:r,"aria-label":r,"aria-pressed":e===t,onClick:()=>n(t),className:(0,es.cn)("rounded-none first:rounded-l-md last:rounded-r-md",e===t?"bg-accent text-foreground":"text-muted-foreground"),children:(0,a.jsx)(o,{className:"size-3.5"})},t))})}var eu=e.i(71698),ec=e.i(67211),ed=e.i(38078),ef=e.i(81671),ep=e.i(28962);let em=(0,o.forwardRef)(function({task:e,tabs:t,activeTabId:n,onTabChange:r,onTabCreate:s,onTabDelete:i,onTodosUpdated:l,onAgentStatusChange:u},c){let d,f,{mode:p,canSplit:m,setMode:h}=(d=(0,o.useSyncExternalStore)($,q,()=>"terminal"),f=(0,o.useSyncExternalStore)(Y,()=>window.matchMedia(V).matches,()=>!0),{mode:"split"!==d||f?d:"terminal",canSplit:f,setMode:(0,o.useCallback)(e=>G(z,e),[])}),v=t.length>0,x=v?p:"terminal",[b,y]=(0,o.useState)(null),[S,E]=(0,o.useState)(()=>new Set(n?[n]:[]));(0,o.useEffect)(()=>{n&&E(e=>{if(e.has(n))return e;let t=new Set(e);return t.add(n),t})},[n]);let[R,C]=(0,o.useState)(()=>new Map(t.map(e=>[e.tab_id,{terminal:null,claude:e.status}])));(0,o.useEffect)(()=>{C(e=>{let n=!1,r=new Map(e);for(let e of t)r.has(e.tab_id)||(r.set(e.tab_id,{terminal:null,claude:e.status}),n=!0);return n?r:e})},[t]);let k=(0,o.useRef)(S);(0,o.useEffect)(()=>{k.current=S},[S]);let w=(0,o.useMemo)(()=>t.map(e=>e.tab_id),[t]);(0,eu.useTabStatusEvents)(w,(e,t)=>{k.current.has(e)||(C(n=>{let r=n.get(e);if(!r||null!==r.terminal||r.claude===t)return n;let a=new Map(n);return a.set(e,{terminal:null,claude:t}),a}),u?.(e,t))});let T=(0,o.useRef)(new Map);(0,o.useEffect)(()=>(0,X.registerFocusTarget)("terminal",()=>{n&&T.current.get(n)?.focus()}),[n]),(0,o.useEffect)(()=>()=>(0,X.setPaneFocusTarget)("terminal"),[]),(0,o.useEffect)(()=>{"split"!==x&&(0,X.setPaneFocusTarget)(x),(0,X.restoreFocus)()},[x,n]);let O=(0,o.useCallback)((e,t,n)=>{C(r=>{let a=new Map(r);return a.set(e,{terminal:t,claude:n}),a}),u?.(e,n)},[u]);(0,o.useImperativeHandle)(c,()=>({sendInput:(e,t)=>{let n=T.current.get(e);n?.sendInput(t)}}));let I=(0,o.useCallback)(e=>{E(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n}),r(e)},[r]),N=(0,o.useCallback)(async e=>{let t=await s(e);t&&E(e=>{let n=new Set(e);return n.add(t),n})},[s]),j=(0,o.useCallback)(()=>N("terminal"),[N]),M=(0,o.useCallback)(()=>N("claude"),[N]),D=(0,o.useCallback)(()=>N("codex"),[N]),F=(0,o.useCallback)(()=>N("local"),[N]),U=(0,ef.useAgentAvailability)(),B={disabledReason:(0,ep.agentDisabledReason)("Claude Code",U?.find(e=>"claude"===e.agent))},H={disabledReason:(0,ep.agentDisabledReason)("Codex",U?.find(e=>"codex"===e.agent))},{settings:W}=(0,ed.useOllamaSettings)(),{settings:K}=(0,ed.useLmStudioSettings)(),{settings:J}=(0,ed.useLocalLlmSettings)(),Q=J?.active?.model??"",Z=W?.enabled||K?.enabled?{provider:J?.active?.provider??null,model:Q,disabledReason:B.disabledReason??(Q?void 0:"ローカルLLMのモデルが未設定です(Settings で設定)")}:void 0,ee=(0,o.useCallback)(e=>{E(t=>{let n=new Set(t);return n.delete(e),n}),C(t=>{let n=new Map(t);return n.delete(e),n}),T.current.delete(e),i(e)},[i]),et="editor"===x,er=(0,o.useMemo)(()=>t.map(e=>e.tab_id),[t]);return(0,a.jsxs)("div",{className:"flex flex-col flex-1 min-h-0",children:[(0,a.jsx)("div",{className:"px-4 pt-4 flex-shrink-0",children:(0,a.jsx)(_,{tabs:t,activeTabId:n,onTabChange:I,onTabCreateTerminal:j,onTabCreateClaude:M,claudeOption:B,codexOption:H,onTabCreateCodex:D,localLlmOption:Z,onTabCreateLocalLlm:F,onTabDelete:ee,tabStatusMap:R})}),(0,a.jsxs)("div",{className:"flex-1 min-h-0 mx-4 mb-4 mt-2 flex flex-col overflow-hidden rounded-lg border border-border bg-card dark:rounded-none dark:border-0",children:[v&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1 border-b border-border flex-shrink-0",children:[(0,a.jsx)("div",{ref:y,className:"flex flex-1 min-w-0 items-center gap-2"}),(0,a.jsx)(el,{mode:x,canSplit:m,onChange:h})]}),(0,a.jsxs)("div",{className:"flex-1 min-h-0 relative flex",children:[(0,a.jsxs)("div",{className:(0,es.cn)("min-w-0",et?"absolute inset-0":"relative flex-1 basis-0"),children:[t.map(t=>{let r=S.has(t.tab_id),o=t.tab_id===n;return r?(0,a.jsx)("div",{className:"absolute inset-0 flex flex-col",style:{visibility:o&&!et?"visible":"hidden",pointerEvents:o&&!et?"auto":"none"},children:(0,a.jsx)(ec.TerminalView,{ref:e=>{e?T.current.set(t.tab_id,e):T.current.delete(t.tab_id)},tabId:t.tab_id,isActive:o,cwd:e.worktreePath,launchAgent:"terminal"!==t.mode,mode:t.mode,className:"h-full overflow-hidden",initialTodos:t.todos,initialAgentStatus:t.status,onTodosUpdated:l,onStatusChange:O,toolbarContainer:b})},t.tab_id):null}),0===t.length&&(0,a.jsxs)("div",{className:(0,es.cn)("h-full flex flex-col items-center justify-center gap-4 px-4",et&&"invisible"),children:[(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"起動するタブを選んでください"}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[(0,a.jsx)("span",{title:B.disabledReason,children:(0,a.jsxs)(P.Button,{onClick:M,disabled:!!B.disabledReason,children:[(0,a.jsx)(L.ClaudeIcon,{className:"w-4 h-4"}),"Claude Code"]})}),H&&(0,a.jsx)("span",{title:H.disabledReason,children:(0,a.jsxs)(P.Button,{variant:"outline",onClick:D,disabled:!!H.disabledReason,children:[(0,a.jsx)(L.CodexIcon,{className:"w-4 h-4"}),"Codex"]})}),Z&&(0,a.jsx)("span",{title:Z.disabledReason??`${(0,A.localLlmTabLabel)(Z.provider)}: ${Z.model}`,children:(0,a.jsxs)(P.Button,{variant:"outline",onClick:()=>void F(),disabled:!!Z.disabledReason,children:[(0,a.jsx)(L.LocalLlmTabIcon,{provider:Z.provider,className:"w-4 h-4"}),(0,A.localLlmTabLabel)(Z.provider)]})}),(0,a.jsxs)(P.Button,{variant:"outline",onClick:j,children:[(0,a.jsx)(g,{className:"w-4 h-4"}),"Terminal"]})]})]}),t.length>0&&!n&&(0,a.jsx)("div",{className:(0,es.cn)("h-full flex items-center justify-center text-muted-foreground text-sm",et&&"invisible"),children:"Select a tab to view terminal"})]}),"terminal"!==x&&(0,a.jsx)("div",{className:(0,es.cn)("flex-1 basis-0 min-w-0 relative",!et&&"border-l border-border"),children:(0,a.jsx)("div",{className:"absolute inset-0 flex flex-col",children:(0,a.jsx)(en,{draftId:n??null,draftIds:er,canSend:!!n&&R.get(n)?.terminal==="connected",onSend:(e,t)=>!!n&&(T.current.get(n)?.sendText(e,t)??!1)})})})]})]})]})});var eg=e.i(99059);e.s([],38727),e.i(38727),e.i(47167);var eh=e.i(67805);let ev=o.createContext(void 0);function ex(e){let t=o.useContext(ev);if(void 0===t&&!e)throw Error((0,eh.default)(33));return t}let eb=o.createContext(void 0);function ey(e){let t=o.useContext(eb);if(void 0===t&&!e)throw Error((0,eh.default)(36));return t}var eS=e.i(27601),eE=e.i(83590);let eR=o.forwardRef(function(e,t){let{className:n,render:r,...a}=e,{store:o}=ey(),{arrowRef:s,side:i,align:l,arrowUncentered:u,arrowStyles:c}=ex(),d=o.useState("open");return(0,eS.useRenderElement)("div",e,{ref:[s,t],stateAttributesMapping:eE.popupStateMapping,state:{open:d,side:i,align:l,uncentered:u},props:{style:c,"aria-hidden":!0,...a}})});var eC=e.i(84759);let ek=o.createContext(void 0);function ew(e=!0){let t=o.useContext(ek);if(void 0===t&&!e)throw Error((0,eh.default)(25));return t}var eT=e.i(3404);let eO={...eE.popupStateMapping,...eC.transitionStatusMapping},eI=o.forwardRef(function(e,t){let{className:n,render:r,...a}=e,{store:o}=ey(),s=o.useState("open"),i=o.useState("mounted"),l=o.useState("transitionStatus"),u=o.useState("lastOpenChangeReason"),c=ew();return(0,eS.useRenderElement)("div",e,{ref:c?.backdropRef?[t,c.backdropRef]:t,state:{open:s,transitionStatus:l},stateAttributesMapping:eO,props:[{role:"presentation",hidden:!i,style:{pointerEvents:u===eT.REASONS.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},a]})});var eN=e.i(76477),ej=e.i(94349);let eM=o.createContext(void 0);var eP=e.i(26292),eL=e.i(91730),eA=e.i(19805),eD=e.i(57666);function e_(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:a,store:s,typingRef:i,itemRef:l,itemMetadata:u}=e,{events:c}=s.useState("floatingTreeRoot"),d=ew(!0),f=void 0!==d;return o.useMemo(()=>({id:r,role:"menuitem",tabIndex:n?0:-1,onKeyDown(e){" "===e.key&&i?.current&&e.preventDefault()},onMouseMove(e){a&&c.emit("itemhover",{nodeId:a,target:e.currentTarget})},onClick(e){t&&c.emit("close",{domEvent:e,reason:eT.REASONS.itemPress})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&1>=Math.abs(e.clientX-t.x)&&1>=Math.abs(e.clientY-t.y)||f&&!eD.isMac&&2===e.button)return}l.current&&s.context.allowMouseUpTriggerRef.current&&(!f||2===e.button)&&(!u||"regular-item"===u.type)&&l.current.click()}}),[t,n,r,c,a,s,i,l,d,f,u])}let eF={type:"regular-item"};function eU(e){let{closeOnClick:t,disabled:n=!1,highlighted:r,id:a,store:s,typingRef:i=s.context.typingRef,nativeButton:l,itemMetadata:u,nodeId:c}=e,d=o.useRef(null),{getButtonProps:f,buttonRef:p}=(0,eL.useButton)({disabled:n,focusableWhenDisabled:!0,native:l,composite:!0}),m=e_({closeOnClick:t,highlighted:r,id:a,nodeId:c,store:s,typingRef:i,itemRef:d,itemMetadata:u}),g=o.useCallback(e=>(0,eA.mergeProps)(m,{onMouseEnter(){"submenu-trigger"===u.type&&u.setActive()}},e,f),[m,f,u]),h=(0,eP.useMergedRefs)(d,p);return o.useMemo(()=>({getItemProps:g,itemRef:h}),[g,h])}var eB=e.i(977);let ez=o.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}}),eH=((t={})[t.None=0]="None",t[t.GuessFromOrder=1]="GuessFromOrder",t);function eV(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:a,index:s}=e,{register:i,unregister:l,subscribeMapChange:u,elementsRef:c,labelsRef:d,nextIndexRef:f}=o.useContext(ez),p=o.useRef(-1),[m,g]=o.useState(s??(a===eH.GuessFromOrder?()=>{if(-1===p.current){let e=f.current;f.current+=1,p.current=e}return p.current}:-1)),h=o.useRef(null),v=o.useCallback(e=>{if(h.current=e,-1!==m&&null!==e&&(c.current[m]=e,d)){let n=void 0!==t;d.current[m]=n?t:r?.current?.textContent??e.textContent}},[m,c,d,t,r]);return(0,eB.useIsoLayoutEffect)(()=>{if(null!=s)return;let e=h.current;if(e)return i(e,n),()=>{l(e)}},[s,i,l,n]),(0,eB.useIsoLayoutEffect)(()=>{if(null==s)return u(e=>{let t=h.current?e.get(h.current)?.index:null;null!=t&&g(t)})},[s,u,g]),o.useMemo(()=>({ref:v,index:m}),[m,v])}var eW=e.i(89879);let e$=((n={}).checked="data-checked",n.unchecked="data-unchecked",n.disabled="data-disabled",n.highlighted="data-highlighted",n),eK={checked:e=>e?{[e$.checked]:""}:{[e$.unchecked]:""},...eC.transitionStatusMapping};var eG=e.i(5963);let eY=o.forwardRef(function(e,t){let{render:n,className:r,id:s,label:i,nativeButton:l=!1,disabled:u=!1,closeOnClick:c=!1,checked:d,defaultChecked:f,onCheckedChange:p,...m}=e,g=eV({label:i}),h=ex(!0),v=(0,eW.useBaseUiId)(s),{store:x}=ey(),b=x.useState("isActive",g.index),y=x.useState("itemProps"),[S,E]=(0,ej.useControlled)({controlled:d,default:f??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:R,itemRef:C}=eU({closeOnClick:c,disabled:u,highlighted:b,id:v,store:x,nativeButton:l,nodeId:h?.nodeId,itemMetadata:eF}),k=o.useMemo(()=>({disabled:u,highlighted:b,checked:S}),[u,b,S]),w=(0,eN.useStableCallback)(e=>{let t={...(0,eG.createChangeEventDetails)(eT.REASONS.itemPress,e.nativeEvent),preventUnmountOnClose:()=>{}};p?.(!S,t),t.isCanceled||E(e=>!e)}),T=(0,eS.useRenderElement)("div",e,{state:k,stateAttributesMapping:eK,props:[y,{role:"menuitemcheckbox","aria-checked":S,onClick:w},m,R],ref:[C,t,g.ref]});return(0,a.jsx)(eM.Provider,{value:k,children:T})});var eq=e.i(88841),eJ=e.i(89269);let eX=o.forwardRef(function(e,t){let{render:n,className:r,keepMounted:a=!1,...s}=e,i=function(){let e=o.useContext(eM);if(void 0===e)throw Error((0,eh.default)(30));return e}(),l=o.useRef(null),{transitionStatus:u,setMounted:c}=(0,eq.useTransitionStatus)(i.checked);(0,eJ.useOpenChangeComplete)({open:i.checked,ref:l,onComplete(){i.checked||c(!1)}});let d={checked:i.checked,disabled:i.disabled,highlighted:i.highlighted,transitionStatus:u};return(0,eS.useRenderElement)("span",e,{state:d,ref:[t,l],stateAttributesMapping:eK,props:{"aria-hidden":!0,...s},enabled:a||i.checked})}),eQ=o.createContext(void 0),eZ=o.forwardRef(function(e,t){let{render:n,className:r,...s}=e,[i,l]=o.useState(void 0),u=o.useMemo(()=>({setLabelId:l}),[l]),c=(0,eS.useRenderElement)("div",e,{ref:t,props:{role:"group","aria-labelledby":i,...s}});return(0,a.jsx)(eQ.Provider,{value:u,children:c})}),e0=o.forwardRef(function(e,t){let{className:n,render:r,id:a,...s}=e,i=(0,eW.useBaseUiId)(a),{setLabelId:l}=function(){let e=o.useContext(eQ);if(void 0===e)throw Error((0,eh.default)(31));return e}();return(0,eB.useIsoLayoutEffect)(()=>(l(i),()=>{l(void 0)}),[l,i]),(0,eS.useRenderElement)("div",e,{ref:t,props:{id:i,role:"presentation",...s}})}),e1=o.forwardRef(function(e,t){let{render:n,className:r,id:a,label:o,nativeButton:s=!1,disabled:i=!1,closeOnClick:l=!0,...u}=e,c=eV({label:o}),d=ex(!0),f=(0,eW.useBaseUiId)(a),{store:p}=ey(),m=p.useState("isActive",c.index),g=p.useState("itemProps"),{getItemProps:h,itemRef:v}=eU({closeOnClick:l,disabled:i,highlighted:m,id:f,store:p,nativeButton:s,nodeId:d?.nodeId,itemMetadata:eF});return(0,eS.useRenderElement)("div",e,{state:{disabled:i,highlighted:m},props:[g,u,h],ref:[v,t,c.ref]})}),e2=o.forwardRef(function(e,t){let{render:n,className:r,id:a,label:s,closeOnClick:i=!1,...l}=e,u=o.useRef(null),c=eV({label:s}),d=ex(!0),f=d?.nodeId,p=(0,eW.useBaseUiId)(a),{store:m}=ey(),g=m.useState("isActive",c.index),h=m.useState("itemProps"),v=m.context.typingRef,{getButtonProps:x,buttonRef:b}=(0,eL.useButton)({native:!1,composite:!0}),y=e_({closeOnClick:i,highlighted:g,id:p,nodeId:f,store:m,typingRef:v,itemRef:u}),S=o.useMemo(()=>({highlighted:g}),[g]);return(0,eS.useRenderElement)("a",e,{state:S,props:[h,l,function(e){return(0,eA.mergeProps)(y,e,x)}],ref:[u,b,t,c.ref]})});var e5=e.i(88306),e8=e.i(61896),e3=e.i(60752),e4=e.i(92238),e6=e.i(18847);let e9={...eE.popupStateMapping,...eC.transitionStatusMapping},e7=o.forwardRef(function(e,t){let{render:n,className:r,finalFocus:s,...i}=e,{store:l}=ey(),{side:u,align:c}=ex(),d=null!=(0,e3.useToolbarRootContext)(!0),f=l.useState("open"),p=l.useState("transitionStatus"),m=l.useState("popupProps"),g=l.useState("mounted"),h=l.useState("instantType"),v=l.useState("activeTriggerElement"),x=l.useState("parent"),b=l.useState("lastOpenChangeReason"),y=l.useState("rootId"),S=l.useState("floatingRootContext"),E=l.useState("floatingTreeRoot"),R=l.useState("closeDelay"),C=l.useState("activeTriggerElement"),k="context-menu"===x.type;(0,eJ.useOpenChangeComplete)({open:f,ref:l.context.popupRef,onComplete(){f&&l.context.onOpenChangeComplete?.(!0)}}),o.useEffect(()=>{function e(e){l.setOpen(!1,(0,eG.createChangeEventDetails)(e.reason,e.domEvent))}return E.events.on("close",e),()=>{E.events.off("close",e)}},[E.events,l]);let w=l.useState("hoverEnabled"),T=l.useState("disabled");(0,e8.useHoverFloatingInteraction)(S,{enabled:w&&!T&&!k&&"menubar"!==x.type,closeDelay:R});let O={transitionStatus:p,side:u,align:c,open:f,nested:"menu"===x.type,instant:h},I=o.useCallback(e=>{l.set("popupElement",e)},[l]),N=(0,eS.useRenderElement)("div",e,{state:O,ref:[t,l.context.popupRef,I],stateAttributesMapping:e9,props:[m,{onKeyDown(e){d&&e4.COMPOSITE_KEYS.has(e.key)&&e.stopPropagation()}},(0,e6.getDisabledMountTransitionStyles)(p),i,{"data-rootownerid":y}]}),j=void 0===x.type||k;return(v||"menubar"===x.type&&b!==eT.REASONS.outsidePress)&&(j=!0),(0,a.jsx)(e5.FloatingFocusManager,{context:S,modal:k,disabled:!g,returnFocus:void 0===s?j:s,initialFocus:"menu"!==x.type,restoreFocus:!0,externalTree:"menubar"!==x.type?E:void 0,previousFocusableElement:C,nextFocusableElement:void 0===x.type?l.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:void 0===x.type?l.context.beforeContentFocusGuardRef:void 0,children:N})});var te=e.i(37692);let tt=o.createContext(void 0),tn=o.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:o}=ey();return o.useState("mounted")||n?(0,a.jsx)(tt.Provider,{value:n,children:(0,a.jsx)(te.FloatingPortal,{ref:t,...r})}):null});var tr=e.i(58130),ta=e.i(66745),to=e.i(51665),ts=e.i(56590),ti=e.i(30628);function tl(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:s}=e,i=(0,eN.useStableCallback)(s),l=o.useRef(0),u=(0,ti.useRefWithInit)(tc).current,c=(0,ti.useRefWithInit)(tu).current,[d,f]=o.useState(0),p=o.useRef(d),m=(0,eN.useStableCallback)((e,t)=>{c.set(e,t??null),p.current+=1,f(p.current)}),g=(0,eN.useStableCallback)(e=>{c.delete(e),p.current+=1,f(p.current)}),h=o.useMemo(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(td).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,d]);(0,eB.useIsoLayoutEffect)(()=>{if("function"!=typeof MutationObserver||0===h.size)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),0===t.size&&(p.current+=1,f(p.current))});return h.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[h]),(0,eB.useIsoLayoutEffect)(()=>{p.current===d&&(n.current.length!==h.size&&(n.current.length=h.size),r&&r.current.length!==h.size&&(r.current.length=h.size),l.current=h.size),i(h)},[i,h,n,r,d]),(0,eB.useIsoLayoutEffect)(()=>()=>{n.current=[]},[n]),(0,eB.useIsoLayoutEffect)(()=>()=>{r&&(r.current=[])},[r]);let v=(0,eN.useStableCallback)(e=>(u.add(e),()=>{u.delete(e)}));(0,eB.useIsoLayoutEffect)(()=>{u.forEach(e=>e(h))},[u,h]);let x=o.useMemo(()=>({register:m,unregister:g,subscribeMapChange:v,elementsRef:n,labelsRef:r,nextIndexRef:l}),[m,g,v,n,r,l]);return(0,a.jsx)(ez.Provider,{value:x,children:t})}function tu(){return new Map}function tc(){return new Set}function td(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}var tf=e.i(36893),tp=e.i(7335),tm=e.i(67569),tg=e.i(77817);let th=o.forwardRef(function(e,t){let{anchor:n,positionMethod:r="absolute",className:s,render:i,side:l,align:u,sideOffset:c=0,alignOffset:d=0,collisionBoundary:f="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:g=!1,disableAnchorTracking:h=!1,collisionAvoidance:v=tp.DROPDOWN_COLLISION_AVOIDANCE,...x}=e,{store:b}=ey(),y=function(){let e=o.useContext(tt);if(void 0===e)throw Error((0,eh.default)(32));return e}(),S=ew(!0),E=b.useState("parent"),R=b.useState("floatingRootContext"),C=b.useState("floatingTreeRoot"),k=b.useState("mounted"),w=b.useState("open"),T=b.useState("modal"),O=b.useState("activeTriggerElement"),I=b.useState("transitionStatus"),N=b.useState("positionerElement"),j=b.useState("instantType"),M=b.useState("hasViewport"),P=b.useState("lastOpenChangeReason"),L=b.useState("floatingNodeId"),A=b.useState("floatingParentNodeId"),D=R.useState("domReferenceElement"),_=o.useRef(null),F=(0,tg.useAnimationsFinished)(N,!1,!1),U=n,B=c,z=d,H=u,V=v;"context-menu"===E.type&&(U=n??E.context?.anchor,H=H??"start",l||"center"===H||(z=e.alignOffset??2,B=e.sideOffset??-5));let W=l,$=H;"menu"===E.type?(W=W??"inline-end",$=$??"start",V=e.collisionAvoidance??tp.POPUP_COLLISION_AVOIDANCE):"menubar"===E.type&&(W=W??"bottom",$=$??"start");let K="context-menu"===E.type,G=(0,ts.useAnchorPositioning)({anchor:U,floatingRootContext:R,positionMethod:S?"fixed":r,mounted:k,side:W,sideOffset:B,align:$,alignOffset:z,arrowPadding:K?0:m,collisionBoundary:f,collisionPadding:p,sticky:g,nodeId:L,keepMounted:y,disableAnchorTracking:h,collisionAvoidance:V,shiftCrossAxis:K&&!("side"in V&&"flip"===V.side),externalTree:C,adaptiveOrigin:M?tm.adaptiveOrigin:void 0}),Y=o.useMemo(()=>{let e={};return w||(e.pointerEvents="none"),{role:"presentation",hidden:!k,style:{...G.positionerStyles,...e}}},[w,k,G.positionerStyles]);o.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===L&&b.set("hoverEnabled",!1),e.nodeId!==L&&e.parentNodeId===b.select("floatingParentNodeId")&&b.setOpen(!1,(0,eG.createChangeEventDetails)(eT.REASONS.siblingOpen)))}return C.events.on("menuopenchange",e),()=>{C.events.off("menuopenchange",e)}},[b,C.events,L]),o.useEffect(()=>{if(null!=b.select("floatingParentNodeId"))return C.events.on("menuopenchange",e),()=>{C.events.off("menuopenchange",e)};function e(e){if(e.open||e.nodeId!==b.select("floatingParentNodeId"))return;let t=e.reason??eT.REASONS.siblingOpen;b.setOpen(!1,(0,eG.createChangeEventDetails)(t))}},[C.events,b]);let q=(0,ta.useTimeout)();o.useEffect(()=>{w||q.clear()},[w,q]),o.useEffect(()=>{function e(e){if(w&&e.nodeId===b.select("floatingParentNodeId"))if(e.target&&O&&O!==e.target){let e=b.select("closeDelay");e>0?q.isStarted()||q.start(e,()=>{b.setOpen(!1,(0,eG.createChangeEventDetails)(eT.REASONS.siblingOpen))}):b.setOpen(!1,(0,eG.createChangeEventDetails)(eT.REASONS.siblingOpen))}else q.clear()}return C.events.on("itemhover",e),()=>{C.events.off("itemhover",e)}},[C.events,w,O,b,q]),o.useEffect(()=>{let e={open:w,nodeId:L,parentNodeId:A,reason:b.select("lastOpenChangeReason")};C.events.emit("menuopenchange",e)},[C.events,w,b,L,A]),(0,eB.useIsoLayoutEffect)(()=>{let e=_.current;if(D&&(_.current=D),e&&D&&D!==e){b.set("instantType",void 0);let e=new AbortController;return F(()=>{b.set("instantType","trigger-change")},e.signal),()=>{e.abort()}}},[D,F,b]);let J={open:w,side:G.side,align:G.align,anchorHidden:G.anchorHidden,nested:"menu"===E.type,instant:j},X=o.useMemo(()=>({side:G.side,align:G.align,arrowRef:G.arrowRef,arrowUncentered:G.arrowUncentered,arrowStyles:G.arrowStyles,nodeId:G.context.nodeId}),[G.side,G.align,G.arrowRef,G.arrowUncentered,G.arrowStyles,G.context.nodeId]),Q=(0,eS.useRenderElement)("div",e,{state:J,stateAttributesMapping:eE.popupStateMapping,ref:[t,b.useStateSetter("positionerElement")],props:[Y,(0,e6.getDisabledMountTransitionStyles)(I),x]}),Z=k&&"menu"!==E.type&&("menubar"!==E.type&&T&&P!==eT.REASONS.triggerHover||"menubar"===E.type&&E.context.modal),ee=null;return"menubar"===E.type?ee=E.context.contentElement:void 0===E.type&&(ee=O),(0,a.jsxs)(ev.Provider,{value:X,children:[Z&&(0,a.jsx)(tf.InternalBackdrop,{ref:"context-menu"===E.type||"nested-context-menu"===E.type?E.context.internalBackdropRef:null,inert:(0,tr.inertValue)(!w),cutout:ee}),(0,a.jsx)(to.FloatingNode,{id:L,children:(0,a.jsx)(tl,{elementsRef:b.context.itemDomElements,labelsRef:b.context.itemLabels,children:Q})})]})}),tv=o.createContext(void 0),tx=o.memo(o.forwardRef(function(e,t){let{render:n,className:r,value:s,defaultValue:i,onValueChange:l,disabled:u=!1,...c}=e,[d,f]=(0,ej.useControlled)({controlled:s,default:i,name:"MenuRadioGroup"}),p=(0,eN.useStableCallback)(l),m=(0,eN.useStableCallback)((e,t)=>{p?.(e,t),t.isCanceled||f(e)}),g=(0,eS.useRenderElement)("div",e,{state:{disabled:u},ref:t,props:{role:"group","aria-disabled":u||void 0,...c}}),h=o.useMemo(()=>({value:d,setValue:m,disabled:u}),[d,m,u]);return(0,a.jsx)(tv.Provider,{value:h,children:g})})),tb=o.createContext(void 0),ty=o.forwardRef(function(e,t){let{render:n,className:r,id:s,label:i,nativeButton:l=!1,disabled:u=!1,closeOnClick:c=!1,value:d,...f}=e,p=eV({label:i}),m=ex(!0),g=(0,eW.useBaseUiId)(s),{store:h}=ey(),v=h.useState("isActive",p.index),x=h.useState("itemProps"),{value:b,setValue:y,disabled:S}=function(){let e=o.useContext(tv);if(void 0===e)throw Error((0,eh.default)(34));return e}(),E=S||u,R=b===d,{getItemProps:C,itemRef:k}=eU({closeOnClick:c,disabled:E,highlighted:v,id:g,store:h,nativeButton:l,nodeId:m?.nodeId,itemMetadata:eF}),w=o.useMemo(()=>({disabled:E,highlighted:v,checked:R}),[E,v,R]),T=(0,eN.useStableCallback)(e=>{y(d,{...(0,eG.createChangeEventDetails)(eT.REASONS.itemPress,e.nativeEvent),preventUnmountOnClose:()=>{}})}),O=(0,eS.useRenderElement)("div",e,{state:w,stateAttributesMapping:eK,props:[x,{role:"menuitemradio","aria-checked":R,onClick:T},f,C],ref:[k,t,p.ref]});return(0,a.jsx)(tb.Provider,{value:w,children:O})}),tS=o.forwardRef(function(e,t){let{render:n,className:r,keepMounted:a=!1,...s}=e,i=function(){let e=o.useContext(tb);if(void 0===e)throw Error((0,eh.default)(35));return e}(),l=o.useRef(null),{transitionStatus:u,setMounted:c}=(0,eq.useTransitionStatus)(i.checked);(0,eJ.useOpenChangeComplete)({open:i.checked,ref:l,onComplete(){i.checked||c(!1)}});let d={checked:i.checked,disabled:i.disabled,highlighted:i.highlighted,transitionStatus:u};return(0,eS.useRenderElement)("span",e,{state:d,stateAttributesMapping:eK,ref:[t,l],props:{"aria-hidden":!0,...s},enabled:a||i.checked})});var tE=e.i(83799),tR=e.i(58509),tC=e.i(66196),tk=e.i(17514),tw=e.i(3851),tT=e.i(33605),tO=e.i(89633),tI=e.i(29315),tN=e.i(231),tj=e.i(90219),tM=e.i(47857),tP=e.i(82033),tL=e.i(43801),tA=e.i(98442),tD=e.i(494);function t_(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function tF(e,t){return t_(t,e===tD.ARROW_UP||e===tD.ARROW_DOWN,e===tD.ARROW_LEFT||e===tD.ARROW_RIGHT)}function tU(e,t,n){return t_(t,e===tD.ARROW_DOWN,n?e===tD.ARROW_LEFT:e===tD.ARROW_RIGHT)||"Enter"===e||" "===e||""===e}var tB=e.i(26665),tz=e.i(6157);let tH=o.createContext(null);function tV(e){let t=o.useContext(tH);if(null===t&&!e)throw Error((0,eh.default)(5));return t}var tW=e.i(79144),t$=e.i(50091),tK=e.i(83921),tG=e.i(98263),tY=e.i(89429),tq=e.i(628),tJ=e.i(69375);let tX={...tq.popupStoreSelectors,disabled:(0,tK.createSelector)(e=>"menubar"===e.parent.type&&e.parent.context.disabled||e.disabled),modal:(0,tK.createSelector)(e=>(void 0===e.parent.type||"context-menu"===e.parent.type)&&(e.modal??!0)),allowMouseEnter:(0,tK.createSelector)(e=>e.allowMouseEnter),stickIfOpen:(0,tK.createSelector)(e=>e.stickIfOpen),parent:(0,tK.createSelector)(e=>e.parent),rootId:(0,tK.createSelector)(e=>"menu"===e.parent.type?e.parent.store.select("rootId"):void 0!==e.parent.type?e.parent.context.rootId:e.rootId),activeIndex:(0,tK.createSelector)(e=>e.activeIndex),isActive:(0,tK.createSelector)((e,t)=>e.activeIndex===t),hoverEnabled:(0,tK.createSelector)(e=>e.hoverEnabled),instantType:(0,tK.createSelector)(e=>e.instantType),lastOpenChangeReason:(0,tK.createSelector)(e=>e.openChangeReason),floatingTreeRoot:(0,tK.createSelector)(e=>"menu"===e.parent.type?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:(0,tK.createSelector)(e=>e.floatingNodeId),floatingParentNodeId:(0,tK.createSelector)(e=>e.floatingParentNodeId),itemProps:(0,tK.createSelector)(e=>e.itemProps),closeDelay:(0,tK.createSelector)(e=>e.closeDelay),hasViewport:(0,tK.createSelector)(e=>e.hasViewport),keyboardEventRelay:(0,tK.createSelector)(e=>e.keyboardEventRelay?e.keyboardEventRelay:"menu"===e.parent.type?e.parent.store.select("keyboardEventRelay"):void 0)};class tQ extends tG.ReactStore{constructor(e){super({...{...(0,tq.createInitialPopupStoreState)(),disabled:!1,modal:!0,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new tY.FloatingTreeStore,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:tk.EMPTY_OBJECT,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1},...e},{positionerRef:o.createRef(),popupRef:o.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:o.createRef(),beforeContentFocusGuardRef:o.createRef(),onOpenChangeComplete:void 0,triggerElements:new tJ.PopupTriggerMap},tX),this.unsubscribeParentListener=this.observe("parent",e=>{if(this.unsubscribeParentListener?.(),"menu"===e.type){let t=e.store.select("rootId"),n=e.store.select("floatingTreeRoot"),r=e.store.select("keyboardEventRelay");this.unsubscribeParentListener=e.store.subscribe(()=>{let a=e.store.select("rootId"),o=e.store.select("floatingTreeRoot"),s=e.store.select("keyboardEventRelay");(t!==a||n!==o||r!==s)&&(t=a,n=o,r=s,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}void 0!==e.type&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit("setOpen",{open:e,eventDetails:t})}static useStore(e,t){let n=(0,ti.useRefWithInit)(()=>new tQ(t)).current;return e??n}unsubscribeParentListener=null}var tZ=e.i(58642);let t0=o.createContext(void 0);function t1(){return o.useContext(t0)}let t2=(0,tw.fastComponent)(function(e){let t,n,{children:r,open:s,onOpenChange:i,onOpenChangeComplete:l,defaultOpen:u=!1,disabled:c=!1,modal:d,loopFocus:f=!0,orientation:p="vertical",actionsRef:m,closeParentOnEsc:g=!1,handle:h,triggerId:v,defaultTriggerId:x=null,highlightItemOnHover:b=!0}=e,y=ew(!0),S=ey(!0),E=tV(!0),R=t1(),C=o.useMemo(()=>R&&S?{type:"menu",store:S.store}:E?{type:"menubar",context:E}:y&&!S?{type:"context-menu",context:y}:{type:void 0},[y,S,E,R]),k=tQ.useStore(h?.store,{open:u,openProp:s,activeTriggerId:x,triggerIdProp:v,parent:C});(0,tR.useOnFirstRender)(()=>{void 0===s&&!1===k.state.open&&!0===u&&k.update({open:!0,activeTriggerId:x})}),k.useControlledProp("openProp",s),k.useControlledProp("triggerIdProp",v),k.useContextCallback("onOpenChangeComplete",l);let w=k.useState("floatingTreeRoot"),T=(0,to.useFloatingNodeId)(w),O=(0,to.useFloatingParentNodeId)();(0,eB.useIsoLayoutEffect)(()=>{y&&!S?k.update({parent:{type:"context-menu",context:y},floatingNodeId:T,floatingParentNodeId:O}):S&&k.update({floatingNodeId:T,floatingParentNodeId:O})},[y,S,T,O,k]);let I=k.useState("open"),N=k.useState("activeTriggerElement"),j=k.useState("positionerElement"),M=k.useState("hoverEnabled"),P=k.useState("modal"),L=k.useState("disabled"),A=k.useState("lastOpenChangeReason"),D=k.useState("parent"),_=k.useState("activeIndex"),F=k.useState("payload"),U=k.useState("floatingParentNodeId"),B=o.useRef(null),z=null!=U;k.useSyncedValues({disabled:c,modal:void 0===D.type?d:void 0,rootId:(0,tE.useId)()});let{openMethod:H,triggerProps:V}=(0,t$.useOpenInteractionType)(I);(0,tZ.useImplicitActiveTrigger)(k);let{forceUnmount:W}=(0,tZ.useOpenStateTransitions)(I,k,()=>{k.update({allowMouseEnter:!1,stickIfOpen:!0})}),$=o.useRef("context-menu"!==D.type),K=(0,ta.useTimeout)();o.useEffect(()=>{if(I||(B.current=null),"context-menu"===D.type){if(!I){K.clear(),$.current=!1;return}K.start(500,()=>{$.current=!0})}},[K,I,D.type]),(0,tC.useScrollLock)(I&&P&&A!==eT.REASONS.triggerHover&&"touch"!==H,j),(0,eB.useIsoLayoutEffect)(()=>{I||M||k.set("hoverEnabled",!0)},[I,M,k]);let G=o.useRef(!0),Y=(0,ta.useTimeout)(),q=(0,eN.useStableCallback)((e,n)=>{let r=n.reason;if(I===e&&n.trigger===N&&A===r||(n.preventUnmountOnClose=()=>{k.set("preventUnmountingOnClose",!0)},e||null!=n.trigger||(n.trigger=N??void 0),i?.(e,n),n.isCanceled))return;let a={open:e,nativeEvent:n.event,reason:n.reason,nested:z};t?.emit("openchange",a);let o=n.event;if(!1===e&&o?.type==="click"&&"touch"===o.pointerType&&!G.current)return;if(!e&&null!==_){let e=k.context.itemDomElements.current[_];queueMicrotask(()=>{e?.setAttribute("tabindex","-1")})}e&&r===eT.REASONS.triggerFocus?(G.current=!1,Y.start(300,()=>{G.current=!0})):(G.current=!0,Y.clear());let s=(r===eT.REASONS.triggerPress||r===eT.REASONS.itemPress)&&0===o.detail&&o?.isTrusted,l=!e&&(r===eT.REASONS.escapeKey||null==r),u={open:e,openChangeReason:r};B.current=n.event??null;let c=n.trigger?.id??null;(c||e)&&(u.activeTriggerId=c,u.activeTriggerElement=n.trigger??null),k.update(u),"menubar"===D.type&&(r===eT.REASONS.triggerFocus||r===eT.REASONS.focusOut||r===eT.REASONS.triggerHover||r===eT.REASONS.listNavigation||r===eT.REASONS.siblingOpen)?k.set("instantType","group"):s||l?k.set("instantType",s?"click":"dismiss"):k.set("instantType",void 0)}),J=o.useCallback(e=>{let t=(0,eG.createChangeEventDetails)(e);return t.preventUnmountOnClose=()=>{k.set("preventUnmountingOnClose",!0)},t},[k]),X=o.useCallback(()=>{k.setOpen(!1,J(eT.REASONS.imperativeAction))},[k,J]);o.useImperativeHandle(m,()=>({unmount:W,close:X}),[W,X]),"context-menu"===D.type&&(n=D.context),o.useImperativeHandle(n?.positionerRef,()=>j,[j]),o.useImperativeHandle(n?.actionsRef,()=>({setOpen:q}),[q]);let Q=(0,tz.useSyncedFloatingRootContext)({popupStore:k,onOpenChange:q});t=Q.context.events,o.useEffect(()=>{let e=({open:e,eventDetails:t})=>q(e,t);return t.on("setOpen",e),()=>{t?.off("setOpen",e)}},[t,q]);let Z=(0,tT.useDismiss)(Q,{enabled:!L,bubbles:{escapeKey:g&&"menu"===D.type},outsidePress:()=>"context-menu"!==D.type||B.current?.type==="contextmenu"||$.current,externalTree:z?w:void 0}),ee=(0,tB.useRole)(Q,{role:"menu"}),et=(0,tW.useDirection)(),en=o.useCallback(e=>{k.select("activeIndex")!==e&&k.set("activeIndex",e)},[k]),er=function(e,t){let n="rootStore"in e?e.rootStore:e,r=n.useState("open"),a=n.useState("floatingElement"),s=n.useState("domReferenceElement"),i=n.context.dataRef,{listRef:l,activeIndex:u,onNavigate:c=()=>{},enabled:d=!0,selectedIndex:f=null,allowEscape:p=!1,loopFocus:m=!1,nested:g=!1,rtl:h=!1,virtual:v=!1,focusItemOnOpen:x="auto",focusItemOnHover:b=!0,openOnArrowKeyDown:y=!0,disabledIndices:S,orientation:E="vertical",parentOrientation:R,cols:C=1,id:k,resetOnPointerLeave:w=!0,externalTree:T}=t,O=(0,tM.getFloatingFocusElement)(a),I=(0,tN.useValueAsRef)(O),N=(0,to.useFloatingParentNodeId)(),j=(0,to.useFloatingTree)(T);(0,eB.useIsoLayoutEffect)(()=>{i.current.orientation=E},[i,E]);let M=(0,tM.isTypeableCombobox)(s),P=o.useRef(x),L=o.useRef(f??-1),A=o.useRef(null),D=o.useRef(!0),_=(0,eN.useStableCallback)(e=>{c(-1===L.current?null:L.current,e)}),F=o.useRef(_),U=o.useRef(!!a),B=o.useRef(r),z=o.useRef(!1),H=o.useRef(!1),V=(0,tN.useValueAsRef)(S),W=(0,tN.useValueAsRef)(r),$=(0,tN.useValueAsRef)(f),K=(0,tN.useValueAsRef)(w),G=(0,eN.useStableCallback)(()=>{function e(e){v?j?.events.emit("virtualfocus",e):(0,tA.enqueueFocus)(e,{sync:z.current,preventScroll:!0})}let t=l.current[L.current],n=H.current;t&&e(t),(z.current?e=>e():requestAnimationFrame)(()=>{let r=l.current[L.current]||t;!r||(t||e(r),q&&(n||!D.current)&&r.scrollIntoView?.({block:"nearest",inline:"nearest"}))})});(0,eB.useIsoLayoutEffect)(()=>{d&&(r&&a?(L.current=f??-1,P.current&&null!=f&&(H.current=!0,_())):U.current&&(L.current=-1,F.current()))},[d,r,a,f,_]),(0,eB.useIsoLayoutEffect)(()=>{if(d){if(!r){z.current=!1;return}if(a)if(null==u){if(z.current=!1,null!=$.current)return;if(U.current&&(L.current=-1,G()),(!B.current||!U.current)&&P.current&&(null!=A.current||!0===P.current&&null==A.current)){let e=0,t=()=>{null==l.current[0]?(e<2&&(e?requestAnimationFrame:queueMicrotask)(t),e+=1):(L.current=null==A.current||tU(A.current,E,h)||g?(0,tL.getMinListIndex)(l):(0,tL.getMaxListIndex)(l),A.current=null,_())};t()}}else(0,tL.isIndexOutOfListBounds)(l,u)||(L.current=u,G(),H.current=!1)}},[d,r,a,u,$,g,l,E,h,_,G,V]),(0,eB.useIsoLayoutEffect)(()=>{if(!d||a||!j||v||!U.current)return;let e=j.nodesRef.current,t=e.find(e=>e.id===N)?.context?.elements.floating,n=(0,tM.activeElement)((0,tj.ownerDocument)(a)),r=e.some(e=>e.context&&(0,tM.contains)(e.context.elements.floating,n));t&&!r&&D.current&&t.focus({preventScroll:!0})},[d,a,j,N,v]),(0,eB.useIsoLayoutEffect)(()=>{F.current=_,B.current=r,U.current=!!a}),(0,eB.useIsoLayoutEffect)(()=>{r||(A.current=null,P.current=x)},[r,x]);let Y=null!=u,q=o.useMemo(()=>{function e(e){if(!W.current)return;let t=l.current.indexOf(e.currentTarget);-1!==t&&L.current!==t&&(L.current=t,_(e))}return{onFocus(t){z.current=!0,e(t)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(t){z.current=!0,H.current=!1,b&&e(t)},onPointerLeave(e){if(!W.current||!D.current||"touch"===e.pointerType)return;z.current=!0;let t=e.relatedTarget;if(!(!b||l.current.includes(t))&&K.current&&((0,tA.enqueueFocus)(null,{sync:!0}),L.current=-1,_(e),!v)){let e=I.current,t=(0,tM.activeElement)((0,tj.ownerDocument)(e));e&&(0,tM.contains)(e,t)&&e.focus({preventScroll:!0})}}}},[W,I,b,l,_,K,v]),J=o.useCallback(()=>R??j?.nodesRef.current.find(e=>e.id===N)?.context?.dataRef?.current.orientation,[N,j,R]),X=(0,eN.useStableCallback)(e=>{var t;let a,o;if(D.current=!1,z.current=!0,229===e.which||!W.current&&e.currentTarget===I.current)return;if(g&&(t=e.key,a=h?t===tD.ARROW_RIGHT:t===tD.ARROW_LEFT,o=t===tD.ARROW_UP,"both"===E||"horizontal"===E&&C&&C>1?"Escape"===t:t_(E,a,o))){tF(e.key,J())||(0,tP.stopEvent)(e),n.setOpen(!1,(0,eG.createChangeEventDetails)(eT.REASONS.listNavigation,e.nativeEvent)),(0,tI.isHTMLElement)(s)&&(v?j?.events.emit("virtualfocus",s):s.focus());return}let i=L.current,u=(0,tL.getMinListIndex)(l,S),c=(0,tL.getMaxListIndex)(l,S);if(M||("Home"===e.key&&((0,tP.stopEvent)(e),L.current=u,_(e)),"End"===e.key&&((0,tP.stopEvent)(e),L.current=c,_(e))),C>1){let t=Array.from({length:l.current.length},()=>({width:1,height:1})),n=(0,tL.createGridCellMap)(t,C,!1),r=n.findIndex(e=>null!=e&&!(0,tL.isListIndexDisabled)(l,e,S)),a=n.reduce((e,t,n)=>null==t||(0,tL.isListIndexDisabled)(l,t,S)?e:n,-1),o=n[(0,tL.getGridNavigatedIndex)({current:n.map(e=>null!=e?l.current[e]:null)},{event:e,orientation:E,loopFocus:m,rtl:h,cols:C,disabledIndices:(0,tL.getGridCellIndices)([...("function"!=typeof S?S:null)||l.current.map((e,t)=>(0,tL.isListIndexDisabled)(l,t,S)?t:void 0),void 0],n),minIndex:r,maxIndex:a,prevIndex:(0,tL.getGridCellIndexOfCorner)(L.current>c?u:L.current,t,n,C,e.key===tD.ARROW_DOWN?"bl":e.key===(h?tD.ARROW_LEFT:tD.ARROW_RIGHT)?"tr":"tl"),stopEvent:!0})];if(null!=o&&(L.current=o,_(e)),"both"===E)return}if(tF(e.key,E)){if((0,tP.stopEvent)(e),r&&!v&&(0,tM.activeElement)(e.currentTarget.ownerDocument)===e.currentTarget){L.current=tU(e.key,E,h)?u:c,_(e);return}tU(e.key,E,h)?m?i>=c?p&&i!==l.current.length?L.current=-1:(z.current=!1,L.current=u):L.current=(0,tL.findNonDisabledListIndex)(l,{startingIndex:i,disabledIndices:S}):L.current=Math.min(c,(0,tL.findNonDisabledListIndex)(l,{startingIndex:i,disabledIndices:S})):m?i<=u?p&&-1!==i?L.current=l.current.length:(z.current=!1,L.current=c):L.current=(0,tL.findNonDisabledListIndex)(l,{startingIndex:i,decrement:!0,disabledIndices:S}):L.current=Math.max(u,(0,tL.findNonDisabledListIndex)(l,{startingIndex:i,decrement:!0,disabledIndices:S})),(0,tL.isIndexOutOfListBounds)(l,L.current)&&(L.current=-1),_(e)}}),Q=o.useMemo(()=>v&&r&&Y&&{"aria-activedescendant":`${k}-${u}`},[v,r,Y,k,u]),Z=o.useMemo(()=>({"aria-orientation":"both"===E?void 0:E,...!M?Q:{},onKeyDown(e){if("Tab"===e.key&&e.shiftKey&&r&&!v){let t=(0,tM.getTarget)(e.nativeEvent);if(t&&!(0,tM.contains)(I.current,t))return;(0,tP.stopEvent)(e),n.setOpen(!1,(0,eG.createChangeEventDetails)(eT.REASONS.focusOut,e.nativeEvent)),(0,tI.isHTMLElement)(s)&&s.focus();return}X(e)},onPointerMove(){D.current=!0}}),[Q,X,I,E,M,n,r,v,s]),ee=o.useMemo(()=>{function e(e){"auto"===x&&(0,tP.isVirtualClick)(e.nativeEvent)&&(P.current=!v)}function t(e){P.current=x,"auto"===x&&(0,tP.isVirtualPointerEvent)(e.nativeEvent)&&(P.current=!0)}return{onKeyDown(e){var t,r;let a=n.select("open");D.current=!1;let o=e.key.startsWith("Arrow"),s=(t=e.key,r=J(),t_(r,h?t===tD.ARROW_LEFT:t===tD.ARROW_RIGHT,t===tD.ARROW_DOWN)),i=tF(e.key,E),u=(g?s:i)||"Enter"===e.key||""===e.key.trim();if(v&&a)return X(e);if(a||y||!o){if(u){let t=tF(e.key,J());A.current=g&&t?null:e.key}if(g){s&&((0,tP.stopEvent)(e),a?(L.current=(0,tL.getMinListIndex)(l,V.current),_(e)):n.setOpen(!0,(0,eG.createChangeEventDetails)(eT.REASONS.listNavigation,e.nativeEvent,e.currentTarget)));return}i&&(null!=$.current&&(L.current=$.current),(0,tP.stopEvent)(e),!a&&y?n.setOpen(!0,(0,eG.createChangeEventDetails)(eT.REASONS.listNavigation,e.nativeEvent,e.currentTarget)):X(e),a&&_(e))}},onFocus(e){n.select("open")&&!v&&(L.current=-1,_(e))},onPointerDown:t,onPointerEnter:t,onMouseDown:e,onClick:e}},[X,V,x,l,g,_,n,y,E,J,h,$,v]),et=o.useMemo(()=>({...Q,...ee}),[Q,ee]);return o.useMemo(()=>d?{reference:et,floating:Z,item:q,trigger:ee}:{},[d,et,Z,ee,q])}(Q,{enabled:!L,listRef:k.context.itemDomElements,activeIndex:_,nested:void 0!==D.type,loopFocus:f,orientation:p,parentOrientation:"menubar"===D.type?D.context.orientation:void 0,rtl:"rtl"===et,disabledIndices:tk.EMPTY_ARRAY,onNavigate:en,openOnArrowKeyDown:"context-menu"!==D.type,externalTree:z?w:void 0,focusItemOnHover:b}),ea=o.useCallback(e=>{k.context.typingRef.current=e},[k]),eo=function(e,t){let n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,a=n.useState("open"),{listRef:s,elementsRef:i,activeIndex:l,onMatch:u,onTypingChange:c,enabled:d=!0,resetMs:f=750,selectedIndex:p=null}=t,m=(0,ta.useTimeout)(),g=o.useRef(""),h=o.useRef(p??l??-1),v=o.useRef(null);(0,eB.useIsoLayoutEffect)(()=>{(a||null===p)&&(m.clear(),v.current=null,""!==g.current&&(g.current=""))},[a,p,m]),(0,eB.useIsoLayoutEffect)(()=>{a&&""===g.current&&(h.current=p??l??-1)},[a,p,l]);let x=(0,eN.useStableCallback)(e=>{e?r.current.typing||(r.current.typing=e,c?.(e)):r.current.typing&&(r.current.typing=e,c?.(e))}),b=(0,eN.useStableCallback)(e=>{function t(e,n,r=0){if(0===e.length)return -1;let a=(r%e.length+e.length)%e.length,o=n.toLocaleLowerCase();for(let t=0;t<e.length;t+=1){let n=(a+t)%e.length,r=e[n];if(r?.toLocaleLowerCase().startsWith(o)&&function(e){let t=i?.current[e];return!t||(0,tL.isElementVisible)(t)}(n))return n}return -1}let n=s.current;if(g.current.length>0&&" "===e.key&&((0,tP.stopEvent)(e),x(!0)),g.current.length>0&&" "!==g.current[0]&&-1===t(n,g.current)&&" "!==e.key&&x(!1),null==n||1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey)return;a&&" "!==e.key&&((0,tP.stopEvent)(e),x(!0));let r=""===g.current;r&&(h.current=p??l??-1),n.every(e=>!e||e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase())&&g.current===e.key&&(g.current="",h.current=v.current),g.current+=e.key,m.start(f,()=>{g.current="",h.current=v.current,x(!1)});let o=r?p??l??-1:h.current,c=t(n,g.current,(o??0)+1);-1!==c?(u?.(c),v.current=c):" "!==e.key&&(g.current="",x(!1))}),y=(0,eN.useStableCallback)(e=>{let t=e.relatedTarget,r=n.select("domReferenceElement"),a=n.select("floatingElement"),o=(0,tM.contains)(r,t),s=(0,tM.contains)(a,t);o||s||(m.clear(),g.current="",h.current=v.current,x(!1))}),S=o.useMemo(()=>({onKeyDown:b,onBlur:y}),[b,y]),E=o.useMemo(()=>({onKeyDown:b,onBlur:y}),[b,y]);return o.useMemo(()=>d?{reference:S,floating:E}:{},[d,S,E])}(Q,{listRef:k.context.itemLabels,elementsRef:k.context.itemDomElements,activeIndex:_,resetMs:tp.TYPEAHEAD_RESET_MS,onMatch:e=>{I&&e!==_&&k.set("activeIndex",e)},onTypingChange:ea}),{getReferenceProps:es,getFloatingProps:ei,getItemProps:el,getTriggerProps:eu}=(0,tO.useInteractions)([Z,ee,er,eo]),ec=o.useMemo(()=>{let e=(0,eA.mergeProps)(es(),{onMouseMove(){k.set("allowMouseEnter",!0)}},V);return delete e.role,e},[es,k,V]),ed=o.useMemo(()=>{let e=eu();if(!e)return e;let t=(0,eA.mergeProps)(e,V);return delete t.role,delete t["aria-controls"],t},[eu,V]),ef=o.useMemo(()=>ei({onMouseMove(){k.set("allowMouseEnter",!0),"menu"===D.type&&k.set("hoverEnabled",!1)},onClick(){k.select("hoverEnabled")&&k.set("hoverEnabled",!1)},onKeyDown(e){let t=k.select("keyboardEventRelay");t&&!e.isPropagationStopped()&&t(e)}}),[ei,D.type,k]),ep=o.useMemo(()=>el(),[el]);k.useSyncedValues({floatingRootContext:Q,activeTriggerProps:ec,inactiveTriggerProps:ed,popupProps:ef,itemProps:ep});let em=o.useMemo(()=>({store:k,parent:C}),[k,C]),eg=(0,a.jsx)(eb.Provider,{value:em,children:"function"==typeof r?r({payload:F}):r});return void 0===D.type||"context-menu"===D.type?(0,a.jsx)(to.FloatingTree,{externalTree:w,children:eg}):eg});var t5=e.i(74080),t8=e.i(37287),t3=e.i(4012),t4=e.i(32652);let t6=eD.isMac&&eD.isSafari;var t9=e.i(97254),t7=e.i(59266),ne=e.i(54694);function nt(e){let{render:t,className:n,state:r=tk.EMPTY_OBJECT,props:a=tk.EMPTY_ARRAY,refs:s=tk.EMPTY_ARRAY,metadata:i,stateAttributesMapping:l,tag:u="div",...c}=e,{compositeProps:d,compositeRef:f}=function(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=(0,ne.useCompositeRootContext)(),{ref:a,index:s}=eV(e),i=n===s,l=o.useRef(null),u=(0,eP.useMergedRefs)(a,l);return{compositeProps:o.useMemo(()=>({tabIndex:i?0:-1,onFocus(){r(s)},onMouseMove(){let e=l.current;if(!t||!e)return;let n=e.hasAttribute("disabled")||"true"===e.ariaDisabled;i||n||e.focus()}}),[i,r,s,t]),compositeRef:u,index:s}}({metadata:i});return(0,eS.useRenderElement)(u,e,{state:r,ref:[...s,f],props:[d,...a,c],stateAttributesMapping:l})}var nn=e.i(72408);let nr=(0,tw.fastComponentRef)(function(e,t){let n,r,s,{render:i,className:l,disabled:u=!1,nativeButton:c=!0,id:d,openOnHover:f,delay:p=100,closeDelay:m=0,handle:g,payload:h,...v}=e,x=ey(!0),b=g?.store??x?.store;if(!b)throw Error((0,eh.default)(85));let y=(0,eW.useBaseUiId)(d),S=b.useState("isTriggerActive",y),E=b.useState("floatingRootContext"),R=b.useState("isOpenedByTrigger",y),C=o.useRef(null),k=(n=ew(!0),r=ey(!0),s=tV(!0),o.useMemo(()=>s?{type:"menubar",context:s}:n&&!r?{type:"context-menu",context:n}:{type:void 0},[n,r,s])),w=(0,ne.useCompositeRootContext)(!0),T=(0,to.useFloatingTree)(),O=o.useMemo(()=>T??new tY.FloatingTreeStore,[T]),I=(0,to.useFloatingNodeId)(O),N=(0,to.useFloatingParentNodeId)(),{registerTrigger:j,isMountedByThisTrigger:M}=(0,tZ.useTriggerDataForwarding)(y,C,b,{payload:h,closeDelay:m,parent:k,floatingTreeRoot:O,floatingNodeId:I,floatingParentNodeId:N,keyboardEventRelay:w?.relayKeyboardEvent}),P="menubar"===k.type,L=b.useState("disabled"),A=u||L||P&&k.context.disabled,{getButtonProps:D,buttonRef:_}=(0,eL.useButton)({disabled:A,native:c});o.useEffect(()=>{R||void 0!==k.type||(b.context.allowMouseUpTriggerRef.current=!1)},[b,R,k.type]);let F=o.useRef(null),U=(0,ta.useTimeout)(),B=(0,eN.useStableCallback)(e=>{if(!F.current)return;U.clear(),b.context.allowMouseUpTriggerRef.current=!1;let t=e.target;if((0,tM.contains)(F.current,t)||(0,tM.contains)(b.select("positionerElement"),t)||t===F.current||null!=t&&function e(t){return(0,tI.isHTMLElement)(t)&&t.hasAttribute("data-rootownerid")?t.getAttribute("data-rootownerid")??void 0:(0,tI.isLastTraversableNode)(t)?void 0:e((0,tI.getParentNode)(t))}(t)===b.select("rootId"))return;let n=function(e){let t=e.getBoundingClientRect(),n=window.getComputedStyle(e,"::before"),r=window.getComputedStyle(e,"::after");if("none"===n.content&&"none"===r.content)return t;let a=parseFloat(n.width)||0,o=parseFloat(n.height)||0,s=parseFloat(r.width)||0,i=parseFloat(r.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,i),c=l-t.width,d=u-t.height;return{left:t.left-c/2,right:t.right+c/2,top:t.top-d/2,bottom:t.bottom+d/2}}(F.current);e.clientX>=n.left-2&&e.clientX<=n.right+2&&e.clientY>=n.top-2&&e.clientY<=n.bottom+2||O.events.emit("close",{domEvent:e,reason:eT.REASONS.cancelOpen})});o.useEffect(()=>{R&&b.select("lastOpenChangeReason")===eT.REASONS.triggerHover&&(0,tj.ownerDocument)(F.current).addEventListener("mouseup",B,{once:!0})},[R,B,b]);let z=P&&k.context.hasSubmenuOpen,H=f??z,V=(0,t9.useHoverReferenceInteraction)(E,{enabled:H&&!A&&"context-menu"!==k.type&&(!P||z&&!M),handleClose:(0,t8.safePolygon)({blockPointerEvents:!P}),mouseOnly:!0,move:!1,restMs:void 0===k.type?p:void 0,delay:{close:m},triggerElementRef:C,externalTree:O,isActiveTrigger:S}),W=function(e,t){let n=(0,ta.useTimeout)(),[r,a]=o.useState(!1);return(0,eB.useIsoLayoutEffect)(()=>{e&&"trigger-hover"===t?(a(!0),n.start(tp.PATIENT_CLICK_THRESHOLD,()=>{a(!1)})):e||(n.clear(),a(!1))},[e,t,n]),r}(R,b.select("lastOpenChangeReason")),$=(0,t3.useClick)(E,{enabled:!A&&"context-menu"!==k.type,event:R&&P?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:void 0===k.type&&W}),K=function(e,t={}){let n="rootStore"in e?e.rootStore:e,{events:r,dataRef:a}=n.context,{enabled:s=!0,delay:i}=t,l=o.useRef(!1),u=o.useRef(null),c=(0,ta.useTimeout)(),d=o.useRef(!0);o.useEffect(()=>{let e=n.select("domReferenceElement");if(!s)return;let t=(0,tI.getWindow)(e);function r(){let e=n.select("domReferenceElement");!n.select("open")&&(0,tI.isHTMLElement)(e)&&e===(0,tM.activeElement)((0,tj.ownerDocument)(e))&&(l.current=!0)}function a(){d.current=!0}function o(){d.current=!1}return t.addEventListener("blur",r),t6&&(t.addEventListener("keydown",a,!0),t.addEventListener("pointerdown",o,!0)),()=>{t.removeEventListener("blur",r),t6&&(t.removeEventListener("keydown",a,!0),t.removeEventListener("pointerdown",o,!0))}},[n,s]),o.useEffect(()=>{if(s)return r.on("openchange",e),()=>{r.off("openchange",e)};function e(e){if(e.reason===eT.REASONS.triggerPress||e.reason===eT.REASONS.escapeKey){let e=n.select("domReferenceElement");(0,tI.isElement)(e)&&(u.current=e,l.current=!0)}}},[r,s,n]);let f=o.useMemo(()=>({onMouseLeave(){l.current=!1,u.current=null},onFocus(e){let t=e.currentTarget;if(l.current){if(u.current===t)return;l.current=!1,u.current=null}let r=(0,tM.getTarget)(e.nativeEvent);if((0,tI.isElement)(r)){if(t6&&!e.relatedTarget){if(!d.current&&!(0,tM.isTypeableElement)(r))return}else if(!(0,tM.matchesFocusVisible)(r))return}let a=(0,tM.isTargetInsideEnabledTrigger)(e.relatedTarget,n.context.triggerElements),{nativeEvent:o,currentTarget:s}=e,f="function"==typeof i?i():i;n.select("open")&&a||0===f||void 0===f?n.setOpen(!0,(0,eG.createChangeEventDetails)(eT.REASONS.triggerFocus,o,s)):c.start(f,()=>{l.current||n.setOpen(!0,(0,eG.createChangeEventDetails)(eT.REASONS.triggerFocus,o,s))})},onBlur(e){l.current=!1,u.current=null;let t=e.relatedTarget,r=e.nativeEvent,o=(0,tI.isElement)(t)&&t.hasAttribute((0,t4.createAttribute)("focus-guard"))&&"outside"===t.getAttribute("data-type");c.start(0,()=>{let e=n.select("domReferenceElement"),s=(0,tM.activeElement)(e?e.ownerDocument:document);if(!t&&s===e||(0,tM.contains)(a.current.floatingContext?.refs.floating.current,s)||(0,tM.contains)(e,s)||o)return;let i=t??s;(0,tM.isTargetInsideEnabledTrigger)(i,n.context.triggerElements)||n.setOpen(!1,(0,eG.createChangeEventDetails)(eT.REASONS.triggerFocus,r))})}}),[a,n,c,i]);return o.useMemo(()=>s?{reference:f,trigger:f}:{},[s,f])}(E,{enabled:!A&&z}),G=function(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,a=o.useRef(!1);return o.useMemo(()=>t?{onMouseDown:e=>{("open"===n&&!r||"close"===n&&r)&&(a.current=!0,(0,tj.ownerDocument)(e.currentTarget).addEventListener("click",()=>{a.current=!1},{once:!0}))},onClick:e=>{a.current&&(a.current=!1,e.preventBaseUIHandler())}}:tk.EMPTY_OBJECT,[t,n,r])}({open:R,enabled:P,mouseDownAction:"open"}),Y=(0,tO.useInteractions)([$,K]),q={disabled:A,open:R},J=b.useState("triggerProps",M),X=[F,t,_,j,C],Q=[Y.getReferenceProps(),V??tk.EMPTY_OBJECT,J,{"aria-haspopup":"menu",id:y,onMouseDown:e=>{b.select("open")||(U.start(200,()=>{b.context.allowMouseUpTriggerRef.current=!0}),(0,tj.ownerDocument)(e.currentTarget).addEventListener("mouseup",B,{once:!0}))}},P?{role:"menuitem"}:{},G,v,D],Z=o.useRef(null),ee=(0,eN.useStableCallback)(e=>{t5.flushSync(()=>{b.setOpen(!1,(0,eG.createChangeEventDetails)(eT.REASONS.focusOut,e.nativeEvent,e.currentTarget))});let t=(0,t7.getTabbableBeforeElement)(Z.current);t?.focus()}),et=(0,eN.useStableCallback)(e=>{let t=b.select("positionerElement");if(t&&(0,t7.isOutsideEvent)(e,t))b.context.beforeContentFocusGuardRef.current?.focus();else{t5.flushSync(()=>{b.setOpen(!1,(0,eG.createChangeEventDetails)(eT.REASONS.focusOut,e.nativeEvent,e.currentTarget))});let n=(0,t7.getTabbableAfterElement)(b.context.triggerFocusTargetRef.current||C.current);for(;null!==n&&(0,tM.contains)(t,n);){let e=n;if((n=(0,t7.getNextTabbable)(n))===e)break}n?.focus()}}),en=(0,eS.useRenderElement)("button",e,{enabled:!P,stateAttributesMapping:eE.pressableTriggerOpenStateMapping,state:q,ref:X,props:Q});return P?(0,a.jsx)(nt,{tag:"button",render:i,className:l,state:q,refs:X,props:Q,stateAttributesMapping:eE.pressableTriggerOpenStateMapping}):R?(0,a.jsxs)(o.Fragment,{children:[(0,a.jsx)(nn.FocusGuard,{ref:Z,onFocus:ee},`${y}-pre-focus-guard`),(0,a.jsx)(o.Fragment,{children:en},y),(0,a.jsx)(nn.FocusGuard,{ref:b.context.triggerFocusTargetRef,onFocus:et},`${y}-post-focus-guard`)]}):(0,a.jsx)(o.Fragment,{children:en},y)});var na=e.i(12666);let no=((r={}).popupWidth="--popup-width",r.popupHeight="--popup-height",r),ns={activationDirection:e=>e?{"data-activation-direction":e}:null},ni=o.forwardRef(function(e,t){let{render:n,className:r,children:a,...o}=e,{store:s}=ey(),{side:i}=ex(),l=s.useState("instantType"),{children:u,state:c}=(0,na.usePopupViewport)({store:s,side:i,cssVars:no,children:a}),d={activationDirection:c.activationDirection,transitioning:c.transitioning,instant:l};return(0,eS.useRenderElement)("div",e,{state:d,ref:t,props:[o,{children:u}],stateAttributesMapping:ns})}),nl=o.forwardRef(function(e,t){let{className:n,render:r,orientation:a="horizontal",...o}=e;return(0,eS.useRenderElement)("div",e,{state:{orientation:a},ref:t,props:[{role:"separator","aria-orientation":a},o]})}),nu=o.forwardRef(function(e,t){let{render:n,className:r,label:a,id:s,nativeButton:i=!1,openOnHover:l=!0,delay:u=100,closeDelay:c=0,disabled:d=!1,...f}=e,p=eV(),m=ex(),{store:g}=ey(),h=(0,eW.useBaseUiId)(s),v=g.useState("open"),x=g.useState("floatingRootContext"),b=g.useState("floatingTreeRoot"),y=(0,tZ.useTriggerRegistration)(h,g),S=o.useCallback(e=>{let t=y(e);return null!==e&&g.select("open")&&null==g.select("activeTriggerId")&&g.update({activeTriggerId:h,activeTriggerElement:e,closeDelay:c}),t},[y,c,g,h]),E=o.useRef(null),R=o.useCallback(e=>{E.current=e,g.set("activeTriggerElement",e)},[g]),C=t1();if(!C?.parentMenu)throw Error((0,eh.default)(37));g.useSyncedValue("closeDelay",c);let k=C.parentMenu,w=k.useState("itemProps"),T=k.useState("isActive",p.index),O=o.useMemo(()=>({type:"submenu-trigger",setActive(){k.set("activeIndex",p.index)}}),[k,p.index]),I=g.useState("disabled"),N=d||I,{getItemProps:j,itemRef:M}=eU({closeOnClick:!1,disabled:N,highlighted:T,id:h,store:g,typingRef:k.context.typingRef,nativeButton:i,itemMetadata:O,nodeId:m?.nodeId}),P=g.useState("hoverEnabled"),L=k.useState("allowMouseEnter"),A=(0,t9.useHoverReferenceInteraction)(x,{enabled:P&&l&&!N,handleClose:(0,t8.safePolygon)({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:u,delay:L?{open:u,close:c}:0,triggerElementRef:E,externalTree:b}),D=(0,t3.useClick)(x,{enabled:!N,event:"mousedown",toggle:!l,ignoreMouse:l,stickIfOpen:!1}),_=(0,tO.useInteractions)([D]),F=g.useState("triggerProps",!0);return delete F.id,(0,eS.useRenderElement)("div",e,{state:{disabled:N,highlighted:T,open:v},stateAttributesMapping:eE.triggerOpenStateMapping,props:[_.getReferenceProps(),A,F,w,{tabIndex:v||T?0:-1,onBlur(){T&&k.set("activeIndex",null)}},f,j],ref:[t,p.ref,M,S,R]})});class nc{constructor(){this.store=new tQ}open(e){let t=e?this.store.context.triggerElements.getById(e):void 0;if(e&&!t)throw Error((0,eh.default)(83,e));this.store.setOpen(!0,(0,eG.createChangeEventDetails)("imperative-action",void 0,t))}close(){this.store.setOpen(!1,(0,eG.createChangeEventDetails)("imperative-action",void 0,void 0))}get isOpen(){return this.store.state.open}}e.s(["Arrow",0,eR,"Backdrop",0,eI,"CheckboxItem",0,eY,"CheckboxItemIndicator",0,eX,"Group",0,eZ,"GroupLabel",0,e0,"Handle",0,nc,"Item",0,e1,"LinkItem",0,e2,"Popup",0,e7,"Portal",0,tn,"Positioner",0,th,"RadioGroup",0,tx,"RadioItem",0,ty,"RadioItemIndicator",0,tS,"Root",0,t2,"Separator",0,nl,"SubmenuRoot",0,function(e){let t=ey().store,n=o.useMemo(()=>({parentMenu:t}),[t]);return(0,a.jsx)(t0.Provider,{value:n,children:(0,a.jsx)(t2,{...e})})},"SubmenuTrigger",0,nu,"Trigger",0,nr,"Viewport",0,ni,"createHandle",0,function(){return new nc}],30250);var nd=e.i(30250),nd=nd;function nf({...e}){return(0,a.jsx)(nd.Root,{"data-slot":"dropdown-menu",...e})}function np({...e}){return(0,a.jsx)(nd.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function nm({align:e="start",alignOffset:t=0,side:n="bottom",sideOffset:r=4,className:o,...s}){return(0,a.jsx)(nd.Portal,{children:(0,a.jsx)(nd.Positioner,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:n,sideOffset:r,children:(0,a.jsx)(nd.Popup,{"data-slot":"dropdown-menu-content",className:(0,es.cn)("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none 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:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",o),...s})})})}function ng({className:e,inset:t,variant:n="default",...r}){return(0,a.jsx)(nd.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:(0,es.cn)("group/dropdown-menu-item relative flex min-h-7 cursor-default items-center gap-2 rounded-md px-2 py-1 text-xs/relaxed outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7.5 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 data-[variant=destructive]:*:[svg]:text-destructive",e),...r})}function nh({className:e,...t}){return(0,a.jsx)(nd.Separator,{"data-slot":"dropdown-menu-separator",className:(0,es.cn)("-mx-1 my-1 h-px bg-border/50",e),...t})}e.i(46349),e.i(78784),e.s(["default",0,function({params:e}){let{id:t}=(0,o.use)(e),n=(0,s.useRouter)(),r=(0,y.useToast)(),[u,C]=(0,o.useState)(null),[k,w]=(0,o.useState)(!0),[T,O]=(0,o.useState)([]),[I,N]=(0,o.useState)(),[j,L]=(0,o.useState)(!0),[A,D]=(0,o.useState)(!1),[_,F]=(0,o.useState)(!1),[U,B]=(0,o.useState)(!0),{state:z,update:H}=(0,R.useSidebarTaskList)(),V=z.hidden.includes(t),W=(0,o.useRef)(null);(0,S.useDocumentTitle)(u?.title),(0,E.useTaskEvents)({onTaskCreated:()=>{},onTaskUpdated:e=>{e.id===t&&C(e)},onTaskDeleted:e=>{e===t&&(r.info("Task deleted",u?.title??void 0),n.push("/"))}});let $=(0,o.useCallback)(()=>{fetch((0,v.apiUrl)(`/api/tasks/${t}/read`),{method:"POST"}).catch(()=>{})},[t]),K=(0,o.useCallback)((e,t)=>{("success"===t||"failure"===t||"error"===t)&&$()},[$]),G=(0,o.useRef)(null),Y=(0,o.useCallback)(async()=>{if(null!==G.current&&G.current!==t&&B(!0),G.current=t,U){L(!0);try{let e=await fetch((0,v.apiUrl)(`/api/tasks/${t}`));if(!e.ok)throw Error("Failed to fetch task");let n=await e.json(),r=n.data.task,a=r.tabs||[];C(r),w(n.data.worktreeExists),O(a),a.length>0&&N(a[0].tab_id),$()}catch(e){console.error("Failed to load data:",e)}finally{L(!1),B(!1)}}},[t,U,$]);(0,o.useEffect)(()=>{Y()},[t,Y]);let q=async(e,t)=>{let n=r.loading("Updating task...");try{let a=await fetch((0,v.apiUrl)(`/api/tasks/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!a.ok)throw Error("Failed to update task");let o=await a.json();return C(o.data.task),r.success(n,"Successfully updated task"),{success:!0}}catch(t){console.error("Failed to update task:",t);let e=t instanceof Error?t.message:"Failed to update task";return r.error(n,"Failed to update task",e),{success:!1,errors:[{field:"global",message:"Failed to update task"}]}}},J=async(e="claude")=>{try{let n=await fetch((0,v.apiUrl)(`/api/tasks/${t}/tabs`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:e})});if(!n.ok)throw Error("Failed to create tab");let r=(await n.json()).data.tab;return O(e=>e.some(e=>e.tab_id===r.tab_id)?e:[...e,r]),N(r.tab_id),r.tab_id}catch(e){console.error("Failed to create tab:",e);return}},X=async e=>{try{if(!(await fetch((0,v.apiUrl)(`/api/tasks/${t}/tabs/${e}`),{method:"DELETE"})).ok)throw Error("Failed to delete tab");if(O(t=>t.filter(t=>t.tab_id!==e)),I===e){let t=T.filter(t=>t.tab_id!==e);N(t[0]?.tab_id)}}catch(e){console.error("Failed to delete tab:",e)}},Q=async()=>{if(!u)return;let e=r.loading("Opening terminal...",u.worktreePath);try{if(!(await fetch((0,v.apiUrl)("/api/commands/open"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandType:"terminal",owner:u.owner,repo:u.repo,branch:u.branch})})).ok)throw Error("Command execution failed");r.success(e,"Successfully opened terminal",u.worktreePath)}catch(n){let t=n instanceof Error?n.message:"Unknown error";r.error(e,"Failed to open terminal",t)}},Z=async()=>{if(!u)return;let e=r.loading("Opening VS Code...",u.worktreePath);try{if(!(await fetch((0,v.apiUrl)("/api/commands/open"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commandType:"vscode",owner:u.owner,repo:u.repo,branch:u.branch})})).ok)throw Error("Command execution failed");r.success(e,"Successfully opened VS Code",u.worktreePath)}catch(n){let t=n instanceof Error?n.message:"Unknown error";r.error(e,"Failed to open VS Code",t)}};return j&&!u?(0,a.jsx)("div",{className:"h-screen flex items-center justify-center bg-background",children:(0,a.jsx)(b.LoadingSpinner,{size:"lg",message:"Loading task..."})}):u?(0,a.jsxs)("div",{className:"h-screen flex flex-col bg-background",children:[(0,a.jsx)("div",{className:"sticky top-0 z-50 p-4 border-b border-border bg-card",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)(i.default,{href:"/",className:(0,es.cn)((0,P.buttonVariants)({variant:"ghost"}),"text-primary font-medium hover:bg-primary/10 hover:text-foreground"),children:[(0,a.jsx)(l.ArrowLeft,{className:"w-4 h-4"}),"Back to Board"]}),(0,a.jsxs)("div",{className:"absolute left-1/2 -translate-x-1/2 max-w-[50vw] flex items-center gap-1",children:[(0,a.jsx)("h1",{className:"min-w-0 truncate text-base font-semibold text-foreground",children:u.title}),V&&(0,a.jsx)(P.Button,{variant:"ghost",size:"icon",className:"hidden md:inline-flex shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Hidden from sidebar. Click to show",title:"Hidden from sidebar. Click to show",onClick:()=>H(e=>({...e,hidden:e.hidden.filter(e=>e!==t),shown:e.shown.includes(t)?e.shown:[...e.shown,t]})),children:(0,a.jsx)(f.EyeOff,{})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(eg.UpdateIndicator,{}),(0,a.jsxs)(nf,{children:[(0,a.jsx)(np,{render:(0,a.jsx)(P.Button,{variant:"ghost",size:"icon-lg",className:"text-primary hover:bg-primary/10 hover:text-foreground",title:"Task menu"}),children:(0,a.jsx)(d,{className:"w-5 h-5"})}),(0,a.jsxs)(nm,{align:"end",children:[(0,a.jsxs)(ng,{onClick:()=>D(!0),children:[(0,a.jsx)(m.Pencil,{className:"w-4 h-4"}),"Detail / Edit"]}),k&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(nh,{}),(0,a.jsxs)(ng,{onClick:Q,children:[(0,a.jsx)(g,{className:"w-4 h-4"}),"Open Terminal"]}),(0,a.jsxs)(ng,{onClick:Z,children:[(0,a.jsx)(c,{className:"w-4 h-4"}),"Open VS Code"]})]}),(0,a.jsx)(nh,{}),(0,a.jsxs)(ng,{className:"text-destructive focus:text-destructive",onClick:()=>F(!0),children:[(0,a.jsx)(h.Trash2,{className:"w-4 h-4"}),"Delete"]})]})]})]})]})}),(0,a.jsx)("div",{className:"flex-1 flex flex-col min-h-0",children:(0,a.jsx)("div",{className:"bg-background dark:bg-card flex flex-col flex-1 min-h-0",children:k?(0,a.jsx)(em,{ref:W,task:u,tabs:T,activeTabId:I,onTabChange:N,onTabCreate:J,onTabDelete:X,onAgentStatusChange:K}):(0,a.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-6 text-center",children:[(0,a.jsx)(p,{className:"size-10 text-muted-foreground"}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("p",{className:"font-medium text-foreground",children:"Worktree not found"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground break-all",children:u.worktreePath})]}),(0,a.jsxs)(P.Button,{variant:"destructive",onClick:()=>F(!0),children:[(0,a.jsx)(h.Trash2,{className:"w-4 h-4"}),"Delete Task"]})]})})}),(0,a.jsx)(x.LazyTaskDialog,{mode:"edit",isOpen:A,onClose:()=>D(!1),task:u,onUpdate:q}),(0,a.jsx)(M.ConfirmDialog,{open:_,onOpenChange:e=>F(e.open),title:"Delete Task",message:`Delete task "${u.title}"?
|
|
5
|
+
|
|
6
|
+
This will also delete the worktree and branch.`,confirmLabel:"Delete",cancelLabel:"Cancel",onConfirm:()=>{if(!u)return;let e=r.loading("Deleting task...",u.title);fetch((0,v.apiUrl)(`/api/tasks/${u.id}`),{method:"DELETE"}).then(()=>{r.success(e,"Successfully deleted task",u.title)}).catch(t=>{let n=t instanceof Error?t.message:"Unknown error";r.error(e,"Failed to delete task",n)}),n.push("/")},variant:"danger"})]}):(0,a.jsx)("div",{className:"h-screen flex items-center justify-center bg-background",children:(0,a.jsx)("div",{className:"text-center text-foreground",children:"Task not found"})})}],97099)}]);
|