@minimalcorp/tsunagi 0.1.52 → 0.1.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/.next/standalone/apps/web/.next/BUILD_ID +1 -1
  2. package/.next/standalone/apps/web/.next/build-manifest.json +3 -3
  3. package/.next/standalone/apps/web/.next/prerender-manifest.json +3 -3
  4. package/.next/standalone/apps/web/.next/server/app/_global-error.html +1 -1
  5. package/.next/standalone/apps/web/.next/server/app/_global-error.rsc +1 -1
  6. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  7. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  9. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  10. package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  11. package/.next/standalone/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  12. package/.next/standalone/apps/web/.next/server/app/_not-found.html +1 -1
  13. package/.next/standalone/apps/web/.next/server/app/_not-found.rsc +13 -13
  14. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_full.segment.rsc +13 -13
  15. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  16. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_index.segment.rsc +8 -8
  17. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  18. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  19. package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  20. package/.next/standalone/apps/web/.next/server/app/index.html +1 -1
  21. package/.next/standalone/apps/web/.next/server/app/index.rsc +15 -15
  22. package/.next/standalone/apps/web/.next/server/app/index.segments/__PAGE__.segment.rsc +4 -4
  23. package/.next/standalone/apps/web/.next/server/app/index.segments/_full.segment.rsc +15 -15
  24. package/.next/standalone/apps/web/.next/server/app/index.segments/_head.segment.rsc +4 -4
  25. package/.next/standalone/apps/web/.next/server/app/index.segments/_index.segment.rsc +8 -8
  26. package/.next/standalone/apps/web/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  27. package/.next/standalone/apps/web/.next/server/app/page.js.nft.json +1 -1
  28. package/.next/standalone/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
  29. package/.next/standalone/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  30. package/.next/standalone/apps/web/.next/server/app/settings.html +1 -1
  31. package/.next/standalone/apps/web/.next/server/app/settings.rsc +15 -15
  32. package/.next/standalone/apps/web/.next/server/app/settings.segments/_full.segment.rsc +15 -15
  33. package/.next/standalone/apps/web/.next/server/app/settings.segments/_head.segment.rsc +4 -4
  34. package/.next/standalone/apps/web/.next/server/app/settings.segments/_index.segment.rsc +8 -8
  35. package/.next/standalone/apps/web/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
  36. package/.next/standalone/apps/web/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +4 -4
  37. package/.next/standalone/apps/web/.next/server/app/settings.segments/settings.segment.rsc +3 -3
  38. package/.next/standalone/apps/web/.next/server/app/tasks/[id]/page.js.nft.json +1 -1
  39. package/.next/standalone/apps/web/.next/server/app/tasks/[id]/page_client-reference-manifest.js +1 -1
  40. package/.next/standalone/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0qjafjt._.js +1 -1
  41. package/.next/standalone/apps/web/.next/server/chunks/ssr/_0hnxatt._.js +3 -0
  42. package/.next/standalone/apps/web/.next/server/chunks/ssr/_0i8ojdw._.js +1 -1
  43. package/.next/standalone/apps/web/.next/server/chunks/ssr/_0ncpk6b._.js +3 -0
  44. package/.next/standalone/apps/web/.next/server/chunks/ssr/apps_web_src_app_settings_page_tsx_0i6itlb._.js +3 -3
  45. package/.next/standalone/apps/web/.next/server/chunks/ssr/apps_web_src_app_tasks_[id]_page_tsx_0jshsm2._.js +12 -12
  46. package/.next/standalone/apps/web/.next/server/middleware-build-manifest.js +3 -3
  47. package/.next/standalone/apps/web/.next/server/pages/404.html +1 -1
  48. package/.next/standalone/apps/web/.next/server/pages/500.html +1 -1
  49. package/.next/standalone/apps/web/.next/server/server-reference-manifest.js +1 -1
  50. package/.next/standalone/apps/web/.next/server/server-reference-manifest.json +1 -1
  51. package/.next/standalone/apps/web/.next/static/chunks/{059w2rbrv6jh4.js → 01mfp5lo0gy.q.js} +12 -12
  52. package/.next/standalone/apps/web/.next/static/chunks/0jc3jwed_8vre.js +7 -0
  53. package/.next/standalone/apps/web/.next/static/chunks/0pavejkn3rkj5.js +1 -0
  54. package/.next/standalone/apps/web/.next/static/chunks/{03~3ukpvmjafx.js → 0vxoeg5sfua~3.js} +1 -1
  55. package/.next/standalone/apps/web/.next/static/chunks/0xa_n_zp.qw-b.js +1 -0
  56. package/dist/server/lib/update-check.d.ts +2 -0
  57. package/dist/server/lib/update-check.js +18 -10
  58. package/dist/server/routes/version.js +12 -1
  59. package/npm-shrinkwrap.json +50 -8
  60. package/package.json +1 -1
  61. package/.next/standalone/apps/web/.next/server/chunks/ssr/_07iexqz._.js +0 -3
  62. package/.next/standalone/apps/web/.next/server/chunks/ssr/_0o6gl4b._.js +0 -3
  63. package/.next/standalone/apps/web/.next/static/chunks/0d-vappn~2d.d.js +0 -1
  64. package/.next/standalone/apps/web/.next/static/chunks/0f8~7qwyc8ul0.js +0 -1
  65. package/.next/standalone/apps/web/.next/static/chunks/0hfsoxrzcikz5.js +0 -7
  66. /package/.next/standalone/apps/web/.next/static/{et2hOuZAP9TEcN1mn6uIG → wiMenzJBT5A0KltHNQWHr}/_buildManifest.js +0 -0
  67. /package/.next/standalone/apps/web/.next/static/{et2hOuZAP9TEcN1mn6uIG → wiMenzJBT5A0KltHNQWHr}/_clientMiddlewareManifest.js +0 -0
  68. /package/.next/standalone/apps/web/.next/static/{et2hOuZAP9TEcN1mn6uIG → wiMenzJBT5A0KltHNQWHr}/_ssgManifest.js +0 -0
@@ -0,0 +1,7 @@
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 x=(0,l.default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);var m=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)(m.Button,{variant:"ghost",size:"icon-xs",onClick:e=>{e.stopPropagation(),n&&n()},className:"size-4",children:a?(0,t.jsx)(x,{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 x=(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=>x(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=>x(e))})})}var f=e.i(7233),g=e.i(37727),j=e.i(43531),v=e.i(86536);let N=(0,l.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"}]]);var b=e.i(27612),y=e.i(88699),k=e.i(10012);function w({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,x]=(0,s.useState)(!1),[h,p]=(0,s.useState)(e.value),f=async t=>{d(!0);try{await a(e.key,t.target.checked)}finally{d(!1)}},C=async()=>{await r(e.key)},S=async()=>{try{await l(e.key,h),x(!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:f,disabled:c,className:"w-4 h-4 cursor-pointer"}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:"Enabled"})]}),(0,t.jsx)(m.Button,{variant:"ghost",size:"icon-lg",onClick:()=>o(!i),title:i?"Hide value":"Show value",children:i?(0,t.jsx)(N,{className:"w-4 h-4 text-muted-foreground"}):(0,t.jsx)(v.Eye,{className:"w-4 h-4 text-muted-foreground"})}),(0,t.jsx)(m.Button,{variant:"ghost",size:"icon-lg",onClick:()=>{x(!0),p(e.value)},title:"Edit",children:(0,t.jsx)(y.Pencil,{className:"w-4 h-4 text-muted-foreground"})}),n&&(0,t.jsx)(m.Button,{variant:"ghost",size:"icon-lg",onClick:C,title:"Delete",children:(0,t.jsx)(b.Trash2,{className:"w-4 h-4 text-destructive"})})]})]}),u?(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(k.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)(m.Button,{variant:"outline",size:"sm",onClick:()=>{x(!1),p(e.value)},className:"active:scale-95",children:(0,t.jsx)(g.X,{className:"w-4 h-4"})}),(0,t.jsx)(m.Button,{size:"sm",onClick:S,className:"active:scale-95",children:(0,t.jsx)(j.Check,{className:"w-4 h-4"})})]})]}):(0,t.jsx)("div",{children:(0,t.jsx)(k.Input,{type:i?"text":"password",value:e.value,readOnly:!0,className:"w-full font-mono"})})]})}var C=e.i(37870);let S=["ANTHROPIC_API_KEY","CLAUDE_CODE_OAUTH_TOKEN"];function L({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),[x,h]=(0,s.useState)(""),[p,v]=(0,s.useState)(""),[N,b]=(0,s.useState)("");(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()).data.envVars||[]).filter(e=>!S.includes(e.key));r(a)}catch(e){console.error("Failed to load environment variables:",e),c("Failed to load environment variables")}finally{n(!1)}})()},[e]);let y=async(t,s)=>{if("global"===e.scope&&!s&&("ANTHROPIC_API_KEY"===t||"CLAUDE_CODE_OAUTH_TOKEN"===t)&&!a.find(e=>e.key!==t&&("ANTHROPIC_API_KEY"===e.key||"CLAUDE_CODE_OAUTH_TOKEN"===e.key)&&e.enabled))return void alert("Cannot disable the last enabled Claude Token. Please add or enable another Claude Token first.");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))}},E=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")}},z=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}},T=async()=>{var t;if(b(""),!x.trim())return void b("Key is required");if(!p.trim())return void b("Value is required");if(t=x.trim(),/^[A-Z0-9_]+$/.test(t)?S.includes(t)?(b("Claude tokens should be added in the Tokens section"),!1):!a.some(e=>e.key===t)||(b(`Key "${t}" already exists in this scope`),!1):(b("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:x.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()).data.envVars||[]).filter(e=>!S.includes(e.key));r(e)}u(!1),h(""),v("")}catch(e){console.error("Failed to add environment variable:",e),b("Failed to add environment variable")}};return l?(0,t.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,t.jsx)(C.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)(m.Button,{size:"sm",onClick:()=>u(!0),className:"active:scale-95",children:[(0,t.jsx)(f.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.jsx)("div",{className:"text-sm font-medium text-foreground",children:"New Variable"}),(0,t.jsx)(k.Input,{type:"text",value:x,onChange:e=>h(e.target.value.toUpperCase()),placeholder:"VARIABLE_NAME",className:"w-full font-mono",autoFocus:!0}),(0,t.jsx)(k.Input,{type:"password",value:p,onChange:e=>v(e.target.value),placeholder:"value",className:"w-full font-mono"}),N&&(0,t.jsx)("div",{className:"text-xs text-destructive",children:N}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(m.Button,{variant:"outline",size:"sm",onClick:()=>{u(!1),h(""),v(""),b("")},className:"active:scale-95",children:(0,t.jsx)(g.X,{className:"w-4 h-4"})}),(0,t.jsx)(m.Button,{size:"sm",onClick:T,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)(w,{variable:e,onToggle:y,onDelete:E,onUpdate:z,isDeletable:!0},e.key)):(0,t.jsx)("div",{className:"text-center text-muted-foreground text-sm py-4",children:"No environment variables"})]})]})}var E=e.i(63209);let z=["ANTHROPIC_API_KEY","CLAUDE_CODE_OAUTH_TOKEN"],T={ANTHROPIC_API_KEY:"API Key",CLAUDE_CODE_OAUTH_TOKEN:"OAuth Token"};function O(e){return e.startsWith("sk-ant-api")?"ANTHROPIC_API_KEY":e.startsWith("sk-ant-oat")?"CLAUDE_CODE_OAUTH_TOKEN":null}function M({selectedNode:e,onboardingStatus:a,onSwitchToGlobal:r}){let[l,n]=(0,s.useState)([]),[o,c]=(0,s.useState)(!0),[d,u]=(0,s.useState)(null),[x,h]=(0,s.useState)(null),[p,w]=(0,s.useState)(""),[S,L]=(0,s.useState)(""),[P,B]=(0,s.useState)(null),[I,U]=(0,s.useState)({}),[A,_]=(0,s.useState)(!1),[F,$]=(0,s.useState)(""),[D,R]=(0,s.useState)(""),[G,H]=(0,s.useState)(null);(0,s.useEffect)(()=>{K()},[e]);let K=async()=>{c(!0),u(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 tokens");let a=((await s.json()).data.envVars||[]).filter(e=>z.includes(e.key)).map(e=>({key:e.key,value:e.value,label:T[e.key]||e.key}));n(a)}catch(e){console.error("Failed to load tokens:",e),u("Failed to load tokens")}finally{c(!1)}},X=()=>{h(null),w(""),L(""),B(null)},V=async t=>{if(!p.trim())return void L("Token value is required");let s=O(p);if(!s)return void L("Invalid token format");try{if(s!==t){let a=new URLSearchParams({key:t,scope:e.scope});e.owner&&a.set("owner",e.owner),e.repo&&a.set("repo",e.repo),await fetch((0,i.apiUrl)(`/api/env?${a}`),{method:"DELETE"}),await fetch((0,i.apiUrl)("/api/env"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:s,value:p.trim(),scope:e.scope,owner:e.owner,repo:e.repo})})}else if(!(await fetch((0,i.apiUrl)("/api/env"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:t,value:p.trim(),scope:e.scope,owner:e.owner,repo:e.repo})})).ok)throw Error("Failed to update token");await K(),h(null),w(""),L(""),B(null)}catch(e){console.error("Failed to update token:",e),L("Failed to update token")}},q=async()=>{if(!F.trim())return void R("Token value is required");let t=O(F);if(!t)return void R("Invalid token format");if(l.length>0)return void R("Only one Claude token is allowed per scope. Please edit the existing token.");try{if(!(await fetch((0,i.apiUrl)("/api/env"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:t,value:F.trim(),scope:e.scope,owner:e.owner,repo:e.repo})})).ok)throw Error("Failed to add token");await K(),_(!1),$(""),H(null)}catch(e){console.error("Failed to add token:",e),R("Failed to add token")}},W=async t=>{if(confirm("Are you sure you want to delete this token?"))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 token");await K()}catch(e){console.error("Failed to delete token:",e),alert("Failed to delete token")}};if(o)return(0,t.jsxs)("div",{className:"border-2 border-primary rounded-xl p-4 bg-card",children:[(0,t.jsx)("h2",{className:"text-lg font-bold text-foreground mb-4",children:"Claude Tokens"}),(0,t.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,t.jsx)(C.LoadingSpinner,{size:"sm",message:"Loading tokens..."})})]});if(d)return(0,t.jsxs)("div",{className:"border-2 border-primary rounded-xl p-4 bg-card",children:[(0,t.jsx)("h2",{className:"text-lg font-bold text-foreground mb-4",children:"Claude Tokens"}),(0,t.jsx)("div",{className:"text-destructive text-sm",children:d})]});let J=a&&!a.completed&&"global"!==e.scope;return(0,t.jsxs)("div",{className:"border-2 border-primary rounded-xl p-4 bg-card",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:"Claude Tokens"}),!A&&0===l.length&&(0,t.jsxs)(m.Button,{size:"sm",onClick:()=>_(!0),className:"active:scale-95",children:[(0,t.jsx)(f.Plus,{className:"w-4 h-4"}),"Add Token"]})]}),J&&(0,t.jsxs)("div",{className:"mb-4 border-2 border-warning bg-warning/10 rounded-xl p-3 flex items-start gap-3",children:[(0,t.jsx)(E.AlertCircle,{className:"w-5 h-5 text-warning flex-shrink-0 mt-0.5"}),(0,t.jsx)("div",{className:"flex-1",children:(0,t.jsx)("p",{className:"text-sm text-warning",children:"オンボーディングを完了するには、Globalスコープにトークンを追加してください"})}),r&&(0,t.jsx)(m.Button,{size:"sm",onClick:r,className:"bg-warning text-white hover:bg-warning/80 active:scale-95 whitespace-nowrap",children:"Switch to Global"})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[A&&(0,t.jsxs)("div",{className:"border border-border rounded p-3 bg-accent",children:[(0,t.jsx)("div",{className:"text-sm font-medium text-foreground mb-2",children:"New Token"}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(k.Input,{type:"password",value:F,onChange:e=>{var t;let s;return $(t=e.target.value),R(""),void(H(s=O(t)),t&&!s&&R("Invalid token format. Must start with sk-ant-api or sk-ant-oat"))},placeholder:"sk-ant-api... or sk-ant-oat...",className:"w-full font-mono",autoFocus:!0}),G&&!D&&(0,t.jsxs)("div",{className:"text-xs text-success",children:["→ Detected: ",T[G]]}),D&&(0,t.jsx)("div",{className:"text-xs text-destructive",children:D}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(m.Button,{variant:"outline",size:"sm",onClick:()=>{_(!1),$(""),R(""),H(null)},className:"active:scale-95",children:(0,t.jsx)(g.X,{className:"w-4 h-4"})}),(0,t.jsx)(m.Button,{size:"sm",onClick:q,disabled:!G||!!D,className:"active:scale-95",children:(0,t.jsx)(j.Check,{className:"w-4 h-4"})})]})]})]}),0!==l.length||A?l.map(s=>(0,t.jsx)("div",{className:"border border-border rounded p-3 space-y-2",children:x===s.key?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"text-sm font-medium text-foreground mb-2",children:"Edit Token"}),(0,t.jsx)(k.Input,{type:"password",value:p,onChange:e=>{var t;let s;return w(t=e.target.value),L(""),void(B(s=O(t)),t&&!s&&L("Invalid token format. Must start with sk-ant-api or sk-ant-oat"))},placeholder:"sk-ant-api... or sk-ant-oat...",className:"w-full font-mono",autoFocus:!0}),P&&!S&&(0,t.jsxs)("div",{className:"text-xs text-success",children:["→ Detected: ",T[P]]}),S&&(0,t.jsx)("div",{className:"text-xs text-destructive",children:S}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(m.Button,{variant:"outline",size:"sm",onClick:X,className:"active:scale-95",children:(0,t.jsx)(g.X,{className:"w-4 h-4"})}),(0,t.jsx)(m.Button,{size:"sm",onClick:()=>V(s.key),disabled:!P||!!S,className:"active:scale-95",children:(0,t.jsx)(j.Check,{className:"w-4 h-4"})})]})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-foreground",children:s.label}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(m.Button,{variant:"ghost",size:"icon-lg",onClick:()=>U(e=>({...e,[s.key]:!e[s.key]})),title:I[s.key]?"Hide value":"Show value",children:I[s.key]?(0,t.jsx)(N,{className:"w-4 h-4 text-muted-foreground"}):(0,t.jsx)(v.Eye,{className:"w-4 h-4 text-muted-foreground"})}),(0,t.jsx)(m.Button,{variant:"ghost",size:"icon-lg",onClick:()=>{h(s.key),w(""),L(""),B(null)},title:"Edit",children:(0,t.jsx)(y.Pencil,{className:"w-4 h-4 text-muted-foreground"})}),"global"!==e.scope&&(0,t.jsx)(m.Button,{variant:"ghost",size:"icon-lg",onClick:()=>W(s.key),className:"hover:bg-destructive/10",title:"Delete",children:(0,t.jsx)(b.Trash2,{className:"w-4 h-4 text-destructive"})})]})]}),(0,t.jsx)(k.Input,{type:I[s.key]?"text":"password",value:s.value,readOnly:!0,className:"w-full font-mono"})]})},s.key)):(0,t.jsx)("div",{className:"text-center text-muted-foreground text-sm py-4",children:"No Claude tokens configured"})]})]})}let P=(0,l.default)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);var B=e.i(5352),I=e.i(68995);function U(){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 f=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)}}},g=(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)(I.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:f,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,B.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)(m.Button,{variant:"ghost",size:"icon",onClick:()=>g(a,-1),disabled:0===a||u,className:"text-muted-foreground",title:"Move up",children:(0,t.jsx)(P,{className:"size-4"})}),(0,t.jsx)(m.Button,{variant:"ghost",size:"icon",onClick:()=>g(a,1),disabled:a===e.length-1||u,className:"text-muted-foreground",title:"Move down",children:(0,t.jsx)(x,{className:"size-4"})}),(0,t.jsx)(m.Button,{variant:"ghost",size:"icon",onClick:()=>o(s),className:"text-muted-foreground hover:text-destructive",title:"Delete repository",children:(0,t.jsx)(b.Trash2,{className:"size-4"})})]})]},s.id)})})]})}var A=e.i(69068);function _({owner:e,repo:a,onDeleted:r}){let[l,n]=(0,s.useState)(!1),[o,c]=(0,s.useState)(""),[d,u]=(0,s.useState)(!1),x=`${e}/${a}`,h=o===x,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)(m.Button,{variant:"destructive",size:"sm",onClick:()=>n(!0),children:[(0,t.jsx)(b.Trash2,{className:"size-4"}),"Remove Repository"]})]}),(0,t.jsx)(A.Dialog,{open:l,onOpenChange:n,children:(0,t.jsxs)(A.DialogContent,{showCloseButton:!1,children:[(0,t.jsxs)(A.DialogHeader,{children:[(0,t.jsx)(A.DialogTitle,{children:"Remove Repository"}),(0,t.jsxs)(A.DialogDescription,{children:["This will permanently delete ",(0,t.jsx)("strong",{children:x})," 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:x})," to confirm"]}),(0,t.jsx)(k.Input,{value:o,onChange:e=>c(e.target.value),placeholder:x,autoComplete:"off"})]}),(0,t.jsxs)(A.DialogFooter,{children:[(0,t.jsx)(m.Button,{variant:"outline",size:"sm",onClick:()=>{n(!1),c("")},disabled:d,children:"Cancel"}),(0,t.jsx)(m.Button,{variant:"destructive",size:"sm",onClick:p,disabled:!h||d,children:d?"Removing...":"Remove"})]})]})})]})}var F=e.i(95468);let $=(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 D=e.i(31278),R=e.i(87951);let G=(0,l.default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);var H=e.i(52088);function K({className:e,size:s="default",...a}){return(0,t.jsx)("div",{"data-slot":"card","data-size":s,className:(0,H.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 X({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-header",className:(0,H.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 V({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-title",className:(0,H.cn)("font-heading text-sm font-medium",e),...s})}function q({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-description",className:(0,H.cn)("text-xs/relaxed text-muted-foreground",e),...s})}function W({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-content",className:(0,H.cn)("px-4 group-data-[size=sm]/card:px-3",e),...s})}var J=e.i(77814),Y=e.i(41247);let Q=(0,l.default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);var Z=e.i(7347),ee=e.i(57024);let et=["running","running_external"];function es(e){return`${(e/0x40000000).toFixed(1)} GB`}async function ea(e,t){let s=await fetch((0,i.apiUrl)(e),t),a=await s.json().catch(()=>null);if(!s.ok||!a?.data)throw Error(a?.error||`HTTPエラー: ${s.status}`);return a.data}function er({serverInfo:e,onServerChanged:a}){let[r,l]=(0,s.useState)(null),[n,i]=(0,s.useState)(null),o=(0,s.useCallback)(async()=>{try{l(await ea("/api/whisper/models"))}catch(e){console.error("Failed to fetch ASR models:",e)}},[]),c=e?.step;(0,s.useEffect)(()=>{o()},[o,c]);let d=(0,s.useCallback)(async(e,t,s,r)=>{i(e);try{l(await ea(t,s)),a()}catch(e){ee.toaster.create({type:"error",title:r,description:e instanceof Error?e.message:String(e)})}finally{i(null)}},[a]),u=(0,s.useCallback)(e=>d(e.id,"/api/whisper/models/selected",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({modelId:e.id})},"モデルを切り替えられませんでした"),[d]),x=(0,s.useCallback)(e=>d(e.id,`/api/whisper/models/${encodeURIComponent(e.id)}`,{method:"DELETE"},"モデルを削除できませんでした"),[d]);if(!r)return(0,t.jsxs)("span",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,t.jsx)(D.Loader2,{className:"size-4 animate-spin"}),"モデル一覧を読み込み中..."]});let h=null!==e&&!et.includes(e.step),p=null!==n||e?.step==="downloading_model";return(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"音声認識モデル"}),r.models.map(s=>{let a=s.id===r.selectedModelId,l=e?.modelId===s.id&&et.includes(e.step),i=e?.modelId===s.id&&"downloading_model"===e.step,o=i?e?.downloadProgress:void 0,c=e?.modelId===s.id;return(0,t.jsxs)("div",{className:(0,H.cn)("flex flex-col gap-2 rounded-md border p-3 transition-colors duration-[130ms]",a?"border-primary bg-accent/40":"border-border"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-2 text-left disabled:cursor-not-allowed",onClick:()=>void u(s),disabled:a||p,children:[(0,t.jsx)("span",{className:(0,H.cn)("size-3.5 shrink-0 rounded-full border",a?"border-4 border-primary":"border-input")}),(0,t.jsx)("span",{className:"truncate text-sm font-medium",children:s.label})]}),(0,t.jsx)("span",{className:"text-muted-foreground",title:`${s.description}
6
+ ライセンス: ${s.license}
7
+ ${s.repo}`,children:(0,t.jsx)($,{className:"size-4"})}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:es(s.expectedBytes)}),l?(0,t.jsxs)(Z.Badge,{variant:"default",children:[(0,t.jsx)(F.CheckCircle2,{}),"使用中"]}):s.installed?(0,t.jsx)(Z.Badge,{variant:"secondary",children:"取得済み"}):(0,t.jsxs)(Z.Badge,{variant:"outline",title:"選択して起動すると自動でダウンロードされます",children:[(0,t.jsx)(Q,{}),"未取得"]}),s.installed&&!c&&(0,t.jsx)(m.Button,{variant:"ghost",size:"icon-sm",onClick:()=>void x(s),disabled:p,title:"ダウンロード済みのモデルを削除",children:(0,t.jsx)(b.Trash2,{})}),n===s.id&&(0,t.jsx)(D.Loader2,{className:"size-4 animate-spin"})]}),o&&(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)(J.Progress,{value:o.downloadedBytes/o.totalBytes*100}),(0,t.jsxs)("span",{className:"text-[0.65rem] text-muted-foreground",children:[es(o.downloadedBytes)," / ",es(o.totalBytes)]})]}),a&&h&&e?.modelId===s.id&&!i&&(0,t.jsxs)("span",{className:"flex items-center gap-2 text-[0.65rem] text-muted-foreground",children:[(0,t.jsx)(D.Loader2,{className:"size-3 animate-spin"}),"準備中..."]})]},s.id)}),(0,t.jsx)("p",{className:"text-[0.65rem] text-muted-foreground",children:"サーバー起動中に切り替えると、選択したモデルで再起動します(未取得の場合はダウンロードから行います)。"})]})}var el=e.i(19728);let en={not_running:"停止中",installing_deps:"依存関係をインストール中...",downloading_model:"モデルをダウンロード中...",starting_server:"サーバーを起動中...",running:"実行中",running_external:"実行中 (tsunagi外で起動)",error:"エラー"},ei=["installing_deps","downloading_model","starting_server"],eo=["running","running_external"];function ec(e){let t=e/0x40000000;return t>=.1?`${t.toFixed(2)} GB`:`${(e/1048576).toFixed(0)} MB`}function ed(){let[e,a]=(0,s.useState)(!1),[r,l]=(0,s.useState)(!1),[n,o]=(0,s.useState)(null),[c,d]=(0,s.useState)(""),u=(0,s.useRef)(null),x=(0,s.useCallback)(e=>{a(e),localStorage.setItem(el.VOICE_INPUT_ENABLED_STORAGE_KEY,String(e))},[]),h=(0,s.useCallback)(e=>{d(e),localStorage.setItem(el.WHISPER_PROMPT_STORAGE_KEY,e)},[]),p=(0,s.useCallback)(async()=>{let e=await fetch((0,i.apiUrl)("/api/whisper/server/status")),t=await e.json();return o(t),t},[]);(0,s.useEffect)(()=>{a("true"===localStorage.getItem(el.VOICE_INPUT_ENABLED_STORAGE_KEY)),d(localStorage.getItem(el.WHISPER_PROMPT_STORAGE_KEY)??""),p()},[p]),(0,s.useEffect)(()=>{n&&eo.includes(n.step)&&!e&&(x(!0),ee.toaster.create({type:"success",title:"音声入力が有効化されました"}))},[n,e,x]),(0,s.useEffect)(()=>(n&&ei.includes(n.step)&&!u.current&&(u.current=setInterval(()=>{p().then(e=>{!ei.includes(e.step)&&u.current&&(clearInterval(u.current),u.current=null)})},1e3)),()=>{u.current&&(clearInterval(u.current),u.current=null)}),[n,p]);let f=(0,s.useCallback)(()=>{p(),l(!0)},[p]),g=(0,s.useCallback)(async()=>{try{let e=await fetch((0,i.apiUrl)("/api/whisper/server/start"),{method:"POST"});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||`HTTPエラー: ${e.status}`)}o(await e.json())}catch(e){ee.toaster.create({type:"error",title:"サーバーの起動に失敗しました",description:e instanceof Error?e.message:String(e)})}},[]),j=(0,s.useCallback)(async()=>{try{let e=await fetch((0,i.apiUrl)("/api/whisper/server/stop"),{method:"POST"});if(!e.ok){let t=await e.json().catch(()=>null);throw Error(t?.error||`HTTPエラー: ${e.status}`)}o(await e.json())}catch(e){ee.toaster.create({type:"error",title:"サーバーの停止に失敗しました",description:e instanceof Error?e.message:String(e)})}},[]),v=(0,s.useCallback)(()=>{x(!1),n&&eo.includes(n.step)&&j()},[x,j,n]),N=n?.serverDir,b=n?.downloadProgress,y=b?b.downloadedBytes/b.totalBytes*100:0,k=null!==n,w=k&&eo.includes(n.step);return(0,t.jsxs)(K,{children:[(0,t.jsxs)(X,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(V,{children:"音声入力"}),(0,t.jsx)(m.Button,{variant:"ghost",size:"icon-sm",onClick:f,title:"音声入力について",children:(0,t.jsx)($,{})})]}),(0,t.jsx)(q,{children:"ローカルで動作する音声認識モデル(Whisper / Qwen3-ASR)を使って音声入力を行います。"})]}),(0,t.jsxs)(W,{className:"flex flex-col gap-3",children:[(0,t.jsx)(er,{serverInfo:n,onServerChanged:()=>void p()}),e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[k?w?(0,t.jsxs)("span",{className:"flex items-center gap-2 text-success",children:[(0,t.jsx)(F.CheckCircle2,{className:"size-4"}),"音声入力: 有効"]}):(0,t.jsxs)("span",{className:"flex items-center gap-2 text-warning",children:[(0,t.jsx)(E.AlertCircle,{className:"size-4"}),"音声入力: 有効化済み(サーバー停止中)"]}):(0,t.jsxs)("span",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(D.Loader2,{className:"size-4 animate-spin"}),"状態を確認中..."]}),n&&(0,t.jsxs)("span",{className:"text-xs/relaxed text-muted-foreground",children:["(",en[n.step],")"]}),k&&!w&&(0,t.jsxs)(m.Button,{size:"default",onClick:f,children:[(0,t.jsx)(R.Mic,{}),"サーバーを起動"]}),(0,t.jsx)(m.Button,{size:"default",variant:"outline",onClick:v,children:"無効にする"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"文字起こしプロンプト (任意)"}),(0,t.jsx)(Y.Textarea,{value:c,onChange:e=>h(e.target.value),placeholder:"例: 誤字、句読点、音声入力、Whisper、固有名詞や専門用語など",className:"min-h-16 text-xs"}),(0,t.jsx)("p",{className:"mt-1 text-[0.65rem] text-muted-foreground",children:"よく使う単語(固有名詞・専門用語・同音異義語で誤変換されやすい単語など)を列挙すると、 その表記が優先されやすくなり誤変換が減ります。Qwen3-ASRではスペース区切りの単語の羅列を推奨。空でも可。"})]})]}):(0,t.jsxs)(m.Button,{size:"default",onClick:f,children:[(0,t.jsx)(R.Mic,{}),"音声入力を有効化する"]})]}),(0,t.jsx)(I.Dialog,{open:r,onOpenChange:({open:e})=>l(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.jsx)("p",{className:"text-muted-foreground",children:"音声入力はローカルで動作する音声認識モデル (mlx-whisper / mlx-qwen3-asr) を利用します。精度・速度は環境に依存し、今後変更される可能性があります。"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium text-foreground",children:"対応環境"}),(0,t.jsx)("p",{className:"text-muted-foreground",children:"Apple Silicon Mac (M1/M2/M3/M4) のみ対応。Windows/Linuxでは利用できません。"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium text-foreground",children:"必要なもの(事前に手動でインストール)"}),(0,t.jsx)("ul",{className:"list-disc pl-5 text-muted-foreground",children:(0,t.jsx)("li",{children:"Python 3.9以降(Xcode Command Line Tools または Homebrew経由で入手可能)"})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"mb-1 font-medium text-foreground",children:"セットアップ・起動"}),(0,t.jsx)("p",{className:"text-muted-foreground",children:"下のボタンから、依存関係のインストール・モデルのダウンロード・サーバー起動まで自動で行われます(初回は数分かかります)。"}),n&&!N&&(0,t.jsx)("p",{className:"mt-1 text-destructive",children:"音声認識サーバー(whisper-server)が見つかりませんでした。インストールが壊れている可能性があります。"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"mb-1 font-medium text-foreground",children:"アンインストール"}),(0,t.jsxs)("p",{className:"text-muted-foreground",children:["音声入力のためにダウンロードされるもの(Pythonの依存関係・選択したモデル、モデルは1つあたり約1.6〜4.1GB)は全て",(0,t.jsx)("code",{className:"rounded bg-muted px-1",children:"~/.tsunagi/whisper"}),"に保存されます。不要になった場合はこのディレクトリを削除するだけで、関連リソースを完全に削除できます。"]})]}),(0,t.jsxs)("div",{className:"border-t border-border pt-4",children:[(!n||"not_running"===n.step||"error"===n.step)&&(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)(m.Button,{size:"default",onClick:()=>void g(),disabled:!n,children:[n?(0,t.jsx)(R.Mic,{}):(0,t.jsx)(D.Loader2,{className:"animate-spin"}),"音声認識サーバーを起動"]}),n?.step==="error"&&n.error&&(0,t.jsx)("p",{className:"text-xs/relaxed text-destructive",children:n.error})]}),n?.step==="installing_deps"&&(0,t.jsxs)(m.Button,{size:"default",disabled:!0,children:[(0,t.jsx)(D.Loader2,{className:"animate-spin"}),"依存関係をインストール中... (数分かかる場合があります)"]}),n?.step==="downloading_model"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs/relaxed text-muted-foreground",children:[(0,t.jsx)(D.Loader2,{className:"size-4 animate-spin"}),"モデルをダウンロード中..."]}),b&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(J.Progress,{value:y}),(0,t.jsxs)("p",{className:"text-xs/relaxed text-muted-foreground",children:[ec(b.downloadedBytes)," / ",ec(b.totalBytes)," (",y.toFixed(0),"%) ・ ",function(e){if(null===e)return"残り時間を計算中...";if(e<60)return`残り約${e}秒`;let t=Math.floor(e/60);return`残り約${t}分${e%60}秒`}(b.etaSeconds)]})]})]}),n?.step==="starting_server"&&(0,t.jsxs)(m.Button,{size:"default",disabled:!0,children:[(0,t.jsx)(D.Loader2,{className:"animate-spin"}),"サーバーを起動中..."]}),n&&eo.includes(n.step)&&(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("span",{className:"flex items-center gap-2 text-success",children:[(0,t.jsx)(F.CheckCircle2,{className:"size-4"}),"サーバーは起動しています"]}),(0,t.jsxs)(m.Button,{size:"default",variant:"outline",onClick:()=>void j(),children:[(0,t.jsx)(G,{}),"サーバーを停止"]})]})]})]})})]})}var eu=e.i(66992);let ex=(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 em=e.i(31343);let eh=(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 ep=e.i(16715),ef=e.i(47161),eg=e.i(93355),ej=e.i(38078);let ev={k:1024,m:1048576},eN=[32768,65536,131072,262144];function eb(e){let t=e.trim().replace(/[,_\s]/g,"").toLowerCase().match(/^(\d+(?:\.\d+)?)([km]?)$/);if(!t)return null;let s=Number(t[1])*(t[2]?ev[t[2]]:1);return Number.isInteger(s)&&s>0?s:null}function ey(e){return e>=ev.m&&e%ev.m==0?`${e/ev.m}m`:e>=ev.k&&e%ev.k==0?`${e/ev.k}k`:String(e)}var ek=e.i(64691);function ew({value:e,onChange:a,max:r}){let l=(0,s.useId)(),n=eb(e),i=null!==n&&void 0!==r&&r>0&&n>r,o=eN.filter(e=>!r||e<=r);return(0,t.jsxs)("div",{children:[(0,t.jsx)(k.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:ey(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?`このモデルの最大値(${ey(r)})を超えています`:`${n.toLocaleString()} tokens`})]})}var u=u;async function eC(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 eS(e,t){return eC(e,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}function eL(e){return e instanceof Error?e.message:String(e)}function eE({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 ez({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 eT({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 eO({children:e}){return(0,t.jsx)("code",{className:"rounded bg-muted px-1",children:e})}function eM(e,t){return`${e}:${t}`}function eP(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}(${ek.LOCAL_LLM_PROVIDER_LABEL[e.active.provider]}・${ey(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)(D.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)(F.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)(ex,{className:"size-4"}),"解放済み: ",s,"(次の発言で読み込みます)"]});case"error":return(0,t.jsxs)("span",{className:"flex items-center gap-2 text-destructive",children:[(0,t.jsx)(E.AlertCircle,{className:"size-4"}),e.error]})}}function eI(){var e;let a,{settings:r,setSettings:l}=(0,ej.useLocalLlmSettings)(),[n,i]=(0,s.useState)(null),[o,c]=(0,s.useState)(null),[d,u]=(0,s.useState)(null),[x,h]=(0,s.useState)(!1),[p,f]=(0,s.useState)(null),[g,j]=(0,s.useState)(!1),[v,N]=(0,s.useState)(!1),[b,y]=(0,s.useState)(!1);(0,s.useEffect)(()=>{var e;r&&i({selection:(e=r).active?eM(e.active.provider,e.active.model):"",context:ey(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 eC("/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 eC("/api/settings/local-llm/models"))}catch(e){ee.toaster.create({type:"error",title:"モデル一覧を取得できません",description:eL(e)})}finally{h(!1)}},[]);(0,s.useEffect)(()=>{w(),C();let e=setInterval(()=>void w(),3e3);return()=>clearInterval(e)},[w,C]);let S=n?eP(n.selection):null,L=(0,s.useMemo)(()=>d?.models.find(e=>e.provider===S?.provider&&e.model===S?.model),[d,S?.provider,S?.model]),E=L?.maxContextLength??void 0,z=S?.provider==="lmstudio"?S.model:"",T=n?eb(n.context):null;(0,s.useEffect)(()=>{if(f(null),!z||!T)return;let e=new AbortController,t=setTimeout(()=>{let t=new URLSearchParams({model:z,contextTokens:String(T)});eC(`/api/settings/local-llm/estimate?${t}`,{signal:e.signal}).then(f).catch(()=>f(null))},600);return()=>{clearTimeout(t),e.abort()}},[z,T]);let O=Number(n?.idleUnloadMinutes),M=null!==n&&(e=n.context,null!==(a=eb(e))&&(!E||a<=E))&&Number.isInteger(O)&&O>=0,P=(0,s.useCallback)(async()=>{if(!n||!M)return;let e=eP(n.selection),t={active:e?{...e,contextTokens:eb(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 eS("/api/settings/local-llm",t)),ee.toaster.create({type:"success",title:s?"使用するモデルを切り替えました(他のモデルは解放します)":"ローカルLLMの設定を保存しました"}),w()}catch(e){ee.toaster.create({type:"error",title:"ローカルLLMの設定を保存できませんでした",description:eL(e)})}finally{j(!1)}},[n,M,r?.active,l,w]),B=(0,s.useCallback)(async(e,t)=>{N(!0);try{c(await eC(e,{method:"POST"}))}catch(e){ee.toaster.create({type:"error",title:t,description:eL(e)})}finally{N(!1)}},[]),U=e=>i(t=>t?{...t,...e}:t),A=(d?.models??[]).map(e=>{var t;return{value:eM(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?`最大 ${ey(e.maxContextLength)}`:null].filter(Boolean).join(" · "),group:ek.LOCAL_LLM_PROVIDER_LABEL[e.provider]}}),_=r?.active;_&&!A.some(e=>e.value===eM(_.provider,_.model))&&A.unshift({value:eM(_.provider,_.model),label:`${_.model}(一覧にありません)`,group:ek.LOCAL_LLM_PROVIDER_LABEL[_.provider]});let F=null!==d&&0===d.models.length&&0===d.errors.length;return(0,t.jsxs)(K,{children:[(0,t.jsxs)(X,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(V,{children:"Claude Code のローカルLLM"}),(0,t.jsx)(m.Button,{variant:"ghost",size:"icon-sm",onClick:()=>y(!0),title:"ローカルLLMについて",children:(0,t.jsx)($,{})})]}),(0,t.jsxs)(q,{children:["Ollama / LM Studio のローカルLLMで Claude Code を起動します。",(0,t.jsx)("strong",{className:"font-medium text-foreground",children:"使用するモデルは1つだけで、全てのローカルLLMタブで共有します"}),"。切り替えると他のモデルはメモリから解放されます。"]})]}),(0,t.jsx)(W,{className:"flex flex-col gap-3",children:r&&n?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(eE,{children:[o?(0,t.jsx)(eB,{status:o}):(0,t.jsx)(D.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)(m.Button,{variant:"outline",size:"sm",onClick:()=>void B("/api/settings/local-llm/load","モデルを読み込めません"),disabled:v,children:[(0,t.jsx)(em.Play,{}),"読み込む"]}),(o?.state==="loaded"||o?.state==="error")&&(0,t.jsxs)(m.Button,{variant:"outline",size:"sm",onClick:()=>void B("/api/settings/local-llm/unload","モデルを解放できません"),disabled:v||(o?.inflight??0)>0,title:"メモリから外す(次の発言で自動で読み込み直します)",children:[v?(0,t.jsx)(D.Loader2,{className:"animate-spin"}):(0,t.jsx)(eh,{}),"解放"]})]})]}),o&&o.inflight>0&&(0,t.jsxs)("p",{className:"text-[0.65rem] text-muted-foreground",children:["応答を生成中のタブがあります(",o.inflight,"件)。完了するまでモデルは切り替えられません。"]}),F?(0,t.jsx)("p",{className:"text-xs text-warning",children:"下の Ollama / LM Studio のどちらかを有効にすると、モデルを選べるようになります。"}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ez,{label:"使用するモデル",hint:d?.errors.length?(0,t.jsx)("span",{className:"text-destructive",children:d.errors.map(e=>`${ek.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)(ef.Combobox,{options:A,value:n.selection,onChange:e=>U({selection:String(e)}),placeholder:"モデルを選択",className:"flex-1"}),(0,t.jsx)(m.Button,{variant:"outline",size:"icon",onClick:()=>void C(),disabled:x,title:"モデル一覧を再取得",children:(0,t.jsx)(ep.RefreshCw,{className:x?"animate-spin":void 0})})]})}),(0,t.jsxs)(ez,{label:"コンテキスト長",children:[(0,t.jsx)(ew,{value:n.context,onChange:e=>U({context:e}),max:E}),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)(eu.Cpu,{className:"size-3"}),"必要メモリ(見積もり): ",p?.totalMemory??"-",L?.format==="mlx"&&"。MLX はモデルの最大値で読み込まれ、メモリは使った分だけ増えます"]}),S?.provider==="ollama"&&(0,t.jsxs)("p",{className:"mt-1 text-[0.65rem] text-muted-foreground",children:["このコンテキスト長を固定した派生モデル(",(0,t.jsx)(eO,{children:"<モデル>-tsunagi-ctx<長さ>"}),")を作成して使います(重みは共有されます)。"]})]})]}),(0,t.jsx)(ez,{label:"自動解放(分)",hint:"最後のリクエストからこの時間がたったらモデルをメモリから外します(0 で無効)。次の発言で自動で読み込み直します",children:(0,t.jsx)(k.Input,{type:"number",min:0,value:n.idleUnloadMinutes,onChange:e=>U({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=>U({unloadOnExit:e.target.checked}),className:"size-4 accent-primary"}),"tsunagi の終了時にモデルを解放する"]}),(0,t.jsxs)(ez,{label:"WebSearch",children:[(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(m.Button,{size:"sm",variant:"local"===n.webSearch?"default":"outline",onClick:()=>U({webSearch:"local"}),children:"ローカル検索(SearXNG)"}),(0,t.jsx)(m.Button,{size:"sm",variant:"ollama"===n.webSearch?"default":"outline",onClick:()=>U({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)(eT,{children:(0,t.jsx)(ez,{label:"追加の環境変数 (任意)",hint:"ローカルLLMタブにのみ適用されます。同名の既定値より優先されます",children:(0,t.jsx)(Y.Textarea,{value:n.extraEnvText,onChange:e=>U({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)(m.Button,{size:"default",onClick:()=>void P(),disabled:g||!M,children:[g?(0,t.jsx)(D.Loader2,{className:"animate-spin"}):S&&(0,t.jsx)(eg.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)(D.Loader2,{className:"size-4 animate-spin"}),"読み込み中..."]})}),(0,t.jsx)(I.Dialog,{open:b,onOpenChange:({open:e})=>y(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)(eO,{children:"/model"})," ","によるモデルの切り替えを無効にしています(Claude Code が切り替えたモデルを通常の Claude タブの既定値として保存してしまうため)。切り替えはここで行ってください。"]})]})]})})]})}var eU=e.i(78917),eA=e.i(82458),eA=eA;function e_(){let{settings:e,setSettings:a}=(0,ej.useOllamaSettings)(),[r,l]=(0,s.useState)(""),[n,i]=(0,s.useState)(!1),[c,d]=(0,s.useState)(null),[u,x]=(0,s.useState)(null),[h,p]=(0,s.useState)(!1),[f,g]=(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 eS("/api/settings/ollama",e)),!0}catch(e){return ee.toaster.create({type:"error",title:"Ollama の設定を保存できませんでした",description:eL(e)}),!1}finally{i(!1)}},[a]),v=(0,s.useCallback)(async e=>{try{d(await eC(`/api/settings/ollama/status?baseUrl=${encodeURIComponent(e)}`))}catch(e){console.error("Failed to fetch Ollama status:",e)}},[]),N=(0,s.useCallback)(async e=>{p(!0),g(null);try{x(await eC(`/api/settings/ollama/account?baseUrl=${encodeURIComponent(e)}`))}catch(e){x(null),g(eL(e))}finally{p(!1)}},[]),b=e?.enabled===!0,y=e?.baseUrl;(0,s.useEffect)(()=>{if(!b||!y)return;v(y),N(y);let e=setInterval(()=>void v(y),5e3);return()=>clearInterval(e)},[b,y,v,N]);let w=(0,s.useCallback)(async()=>{e&&await j({...e,baseUrl:r})&&ee.toaster.create({type:"success",title:"Ollama の設定を保存しました"})},[e,r,j]);return(0,t.jsxs)(K,{children:[(0,t.jsxs)(X,{children:[(0,t.jsx)(V,{children:"Ollama"}),(0,t.jsxs)(q,{children:["ローカルLLMのプロバイダーとして Ollama を使います。Ollama のインストール・モデルの pull・起動はご自身で行ってください(例:"," ",(0,t.jsx)(eO,{children:"ollama pull qwen3.6:35b-a3b-coding-nvfp4"}),")。"]})]}),(0,t.jsx)(W,{className:"flex flex-col gap-3",children:e?b?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(eE,{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)(F.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?` (${ey(e.contextLength)})`:""}`).join(", ")}`:"読み込み中のモデルなし"})]}):(0,t.jsxs)("span",{className:"flex items-center gap-2 text-warning",children:[(0,t.jsx)(eA.default,{className:"size-4"}),"Ollama に接続できません。Ollama アプリを起動してください"]}):(0,t.jsxs)("span",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(D.Loader2,{className:"size-4 animate-spin"}),"確認中..."]}),(0,t.jsx)(m.Button,{variant:"outline",size:"sm",className:"ml-auto",onClick:()=>void j({...e,enabled:!1}),disabled:n,children:"無効にする"})]}),(0,t.jsx)(ez,{label:"ollama.com(WebSearch を Ollama に代行させる場合)",hint:(0,t.jsxs)(t.Fragment,{children:["「Claude Code のローカルLLM」欄の WebSearch を「ollama.com」にした場合のみ必要です。Ollama を動かしているマシンで"," ",(0,t.jsx)(eO,{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)(D.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)(eA.default,{className:"size-4"}),"未サインイン"]}),u.signinUrl&&(0,t.jsxs)("a",{href:u.signinUrl,target:"_blank",rel:"noreferrer",className:(0,m.buttonVariants)({variant:"outline",size:"sm"}),children:[(0,t.jsx)(eU.ExternalLink,{}),"サインイン"]})]}):(0,t.jsx)("span",{className:"text-xs text-destructive",children:f}),(0,t.jsx)(m.Button,{variant:"outline",size:"icon",onClick:()=>void N(e.baseUrl),disabled:h,title:"サインイン状態を再確認",children:(0,t.jsx)(ep.RefreshCw,{className:h?"animate-spin":void 0})})]})}),(0,t.jsx)(eT,{children:(0,t.jsx)(ez,{label:"Base URL",hint:(0,t.jsxs)(t.Fragment,{children:["Docker で tsunagi を動かしている場合は"," ",(0,t.jsx)(eO,{children:"http://host.docker.internal:11434"})]}),children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(k.Input,{value:r,onChange:e=>l(e.target.value),placeholder:"http://localhost:11434"}),(0,t.jsx)(m.Button,{size:"default",onClick:()=>void w(),disabled:n||r===e.baseUrl,children:"保存"})]})})})]}):(0,t.jsxs)(m.Button,{size:"default",onClick:()=>void j({...e,enabled:!0}),disabled:n,children:[(0,t.jsx)(eg.OllamaIcon,{className:"size-4"}),"Ollama を有効化する"]}):(0,t.jsxs)("span",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(D.Loader2,{className:"size-4 animate-spin"}),"読み込み中..."]})})]})}var eA=eA;function eF(){let{settings:e,setSettings:a}=(0,ej.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 x=e?.enabled===!0,h=(0,s.useCallback)(async()=>{try{c(await eC("/api/settings/lmstudio/status"))}catch(e){console.error("Failed to fetch LM Studio status:",e)}},[]);(0,s.useEffect)(()=>{if(!x)return;h();let e=setInterval(()=>void h(),5e3);return()=>clearInterval(e)},[x,h]);let p=(0,s.useCallback)(async e=>{i(!0);try{return a(await eS("/api/settings/lmstudio",e)),!0}catch(e){return ee.toaster.create({type:"error",title:"LM Studio の設定を保存できませんでした",description:eL(e)}),!1}finally{i(!1)}},[a]),f=(0,s.useCallback)(async e=>{u(!0);try{c(await eC(`/api/settings/lmstudio/server/${e}`,{method:"POST"}))}catch(t){ee.toaster.create({type:"error",title:"start"===e?"サーバーを起動できません":"サーバーを停止できません",description:eL(t)})}finally{u(!1)}},[]),g=(0,s.useCallback)(async()=>{e&&r&&await p({...e,...r})&&(ee.toaster.create({type:"success",title:"LM Studio の設定を保存しました"}),h())},[e,r,p,h]),j=e=>l(t=>t?{...t,...e}:t);return(0,t.jsxs)(K,{children:[(0,t.jsxs)(X,{children:[(0,t.jsx)(V,{children:"LM Studio"}),(0,t.jsxs)(q,{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)(eO,{children:"mlx-community/Qwen3.6-35B-A3B-4bit"}),")。一度起動すると lms CLI が入ります。"]})]}),(0,t.jsx)(W,{className:"flex flex-col gap-3",children:e&&r?x?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(eE,{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)(F.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} (${ey(e.contextLength)})`).join(", ")}`:"読み込み中のモデルなし"})]}):(0,t.jsxs)("span",{className:"flex items-center gap-2 text-warning",children:[(0,t.jsx)(eA.default,{className:"size-4"}),"サーバー停止中"]}):(0,t.jsxs)("span",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(D.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)(m.Button,{variant:"outline",size:"sm",onClick:()=>void f("stop"),disabled:d,children:[d?(0,t.jsx)(D.Loader2,{className:"animate-spin"}):(0,t.jsx)(G,{}),"停止"]}):(0,t.jsxs)(m.Button,{size:"sm",onClick:()=>void f("start"),disabled:d,children:[d?(0,t.jsx)(D.Loader2,{className:"animate-spin"}):(0,t.jsx)(em.Play,{}),"起動"]}):null,(0,t.jsx)(m.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)(eO,{children:"lms server start"})," を実行してください。lms がある場合は詳細設定でパスを指定できます。"]}),(0,t.jsxs)(eT,{children:[(0,t.jsx)(ez,{label:"Base URL",children:(0,t.jsx)(k.Input,{value:r.baseUrl,onChange:e=>j({baseUrl:e.target.value}),placeholder:"http://localhost:1234"})}),(0,t.jsx)(ez,{label:"API トークン (任意)",hint:"LM Studio で「Require Authentication」を有効にしている場合のみ",children:(0,t.jsx)(k.Input,{type:"password",value:r.apiToken,onChange:e=>j({apiToken:e.target.value})})}),(0,t.jsx)(ez,{label:"lms のパス (任意)",hint:"空欄なら ~/.lmstudio/bin/lms → PATH の順で探します",children:(0,t.jsx)(k.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)(m.Button,{size:"default",onClick:()=>void g(),disabled:n,children:[n&&(0,t.jsx)(D.Loader2,{className:"animate-spin"}),"保存"]})})]})]}):(0,t.jsxs)(m.Button,{size:"default",onClick:()=>void p({...e,enabled:!0}),disabled:n,children:[(0,t.jsx)(eg.LmStudioIcon,{className:"size-4"}),"LM Studio を有効化する"]}):(0,t.jsxs)("span",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(D.Loader2,{className:"size-4 animate-spin"}),"読み込み中..."]})})]})}let e$=(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"}]]),eD=(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"}]]),eR=(0,l.default)("rotate-cw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]),eG=(0,l.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"}]]),eH={auto:"自動(searxng-run → Docker の順)",process:"searxng-run",docker:"Docker"};function eK({status:e}){let s,{state:a,runner:r,docker:l}=e;if("not-installed"===a)return null;let n=(0,t.jsx)(eO,{children:l.container}),i=(0,t.jsx)(eO,{children:e.binPath??"searxng-run"});return 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," を起動します"]}),(0,t.jsxs)("p",{className:"flex items-start gap-1.5 text-xs text-muted-foreground",children:[(0,t.jsx)("docker"===r?e$:eG,{className:"mt-px size-3.5 shrink-0","aria-label":"起動方法"}),(0,t.jsx)("span",{children:s})]})}function eX(){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),x=(0,s.useCallback)(async()=>{try{a(await eC("/api/settings/searxng/status"))}catch(e){console.error("Failed to fetch SearXNG status:",e)}},[]);(0,s.useEffect)(()=>{x(),eC("/api/settings/searxng").then(l).catch(e=>console.error("Failed to fetch SearXNG settings:",e));let e=setInterval(()=>void x(),3e3);return()=>clearInterval(e)},[x]),(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 eC(e,{method:"POST"}))}catch(e){ee.toaster.create({type:"error",title:t,description:eL(e)})}finally{c(!1)}},[]),p=(0,s.useCallback)(async()=>{if(n){c(!0);try{l(await eS("/api/settings/searxng",{port:Number(n.port),method:n.method,binPath:n.binPath,settingsPath:n.settingsPath,dockerContainer:n.dockerContainer}))}catch(e){ee.toaster.create({type:"error",title:"SearXNG の設定を保存できませんでした",description:eL(e)}),c(!1);return}c(!1),await h("/api/settings/searxng/restart","SearXNG を再起動できません")}},[n,h]);if(!e?.required)return null;let f=e=>i(t=>t?{...t,...e}:t);return(0,t.jsxs)(K,{children:[(0,t.jsxs)(X,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(V,{children:"ローカル検索 (SearXNG)"}),(0,t.jsx)(m.Button,{variant:"ghost",size:"icon-sm",onClick:()=>u(!0),title:"ローカル検索について",children:(0,t.jsx)($,{})})]}),(0,t.jsxs)(q,{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)(W,{className:"flex flex-col gap-3",children:[(0,t.jsxs)(eE,{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)(F.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)(D.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)(eD,{className:"size-4"}),"SearXNG を起動できません(",(0,t.jsx)(eO,{children:"searxng-run"})," も ",(0,t.jsx)(eO,{children:"docker"})," ","も見つかりません)"]}):"error"===e.state?(0,t.jsxs)("span",{className:"flex items-center gap-2 text-destructive",children:[(0,t.jsx)(E.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)(m.Button,{variant:"outline",size:"sm",onClick:()=>void h("/api/settings/searxng/restart","SearXNG を起動できません"),disabled:o,children:[(0,t.jsx)(eR,{}),"running"===e.state?"再起動":"起動"]}),"running"===e.state&&(0,t.jsxs)(m.Button,{variant:"outline",size:"sm",onClick:()=>void h("/api/settings/searxng/stop","SearXNG を停止できません"),disabled:o,children:[(0,t.jsx)(G,{}),"停止"]})]})]}),(0,t.jsx)(eK,{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)(eO,{children:"nix profile install nixpkgs#searxng"})," ","などで ",(0,t.jsx)(eO,{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)(eT,{children:[(0,t.jsx)(ez,{label:"ポート",hint:"既定は 7964(キーパッドで sxng)",children:(0,t.jsx)(k.Input,{type:"number",min:1,max:65535,value:n.port,onChange:e=>f({port:e.target.value}),className:"font-mono"})}),(0,t.jsx)(ez,{label:"起動方法",children:(0,t.jsx)("select",{value:n.method,onChange:e=>f({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(eH).map(e=>(0,t.jsx)("option",{value:e,children:eH[e]},e))})}),(0,t.jsx)(ez,{label:"Docker のコンテナ名",hint:"無ければ tsunagi が公式イメージで作成します(設定は ~/.tsunagi/searxng/docker/<コンテナ名>/)",children:(0,t.jsx)(k.Input,{value:n.dockerContainer,onChange:e=>f({dockerContainer:e.target.value}),placeholder:"searxng",className:"font-mono"})}),(0,t.jsx)(ez,{label:"searxng-run のパス (任意)",hint:"空欄なら PATH から探します",children:(0,t.jsx)(k.Input,{value:n.binPath,onChange:e=>f({binPath:e.target.value}),placeholder:e.binPath??"searxng-run",className:"font-mono"})}),(0,t.jsx)(ez,{label:"settings.yml のパス (任意)",hint:"searxng-run で起動するときのみ。空欄なら tsunagi が生成したもの(~/.tsunagi/searxng/settings.yml)を使います。独自のものを使う場合は search.formats に json を含めてください",children:(0,t.jsx)(k.Input,{value:n.settingsPath,onChange:e=>f({settingsPath:e.target.value}),className:"font-mono"})}),(0,t.jsx)("div",{children:(0,t.jsxs)(m.Button,{size:"default",onClick:()=>void p(),disabled:o,children:[o&&(0,t.jsx)(D.Loader2,{className:"animate-spin"}),"保存して再起動"]})})]})]}),(0,t.jsx)(I.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)(eO,{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)(eO,{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 eV=e.i(43034),eq=e.i(37837),eW=e.i(99059),eJ=e.i(44142);function eY(){let e=(0,eJ.useUpdateStatus)(),a=(0,eJ.useCheckForUpdate)(),[r,l]=(0,s.useState)(!1),n=async()=>{l(!0);try{await a()}catch(e){ee.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)(m.Button,{variant:"ghost",size:"icon-sm",onClick:()=>void n(),disabled:r,title:"Check for updates","aria-label":"Check for updates",children:(0,t.jsx)(ep.RefreshCw,{className:(0,H.cn)(r&&"animate-spin")})})]}),e?.updateAvailable?(0,t.jsxs)(eq.Popover,{children:[(0,t.jsxs)(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:[(0,t.jsx)(eV.ArrowUpCircle,{className:"size-3.5"}),"v",e.latest," available"]}),(0,t.jsx)(eW.UpdatePopoverContent,{status:e})]}):e?.checkedAt?(0,t.jsxs)("div",{className:"flex items-center gap-1 text-success",children:[(0,t.jsx)(F.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)($,{className:"size-3.5"}),"Not checked"]}),e?.checkedAt&&(0,t.jsxs)("div",{className:"text-muted-foreground",children:["Last checked: ",new Date(e.checkedAt).toLocaleString()]})]})}var eQ=e.i(51846);e.s(["default",0,function(){let e=(0,a.useRouter)();(0,eQ.useDocumentTitle)("settings");let l=()=>{{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"}},[o,c]=(0,s.useState)(null),[d,u]=(0,s.useState)(0),[x,h]=(0,s.useState)({completed:!0,hasGlobalToken:!0});return(0,s.useEffect)(()=>{fetch((0,i.apiUrl)("/api/onboarding/status")).then(e=>e.json()).then(e=>{let t=e.data;h(t),t.completed||t.hasGlobalToken?c(l()):c({scope:"global",label:"Global"})}).catch(e=>{console.error("Failed to fetch onboarding status:",e),c(l())})},[]),(0,s.useEffect)(()=>{o&&localStorage.setItem("tsunagi:env-selected-node",JSON.stringify(o))},[o]),(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)(m.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)(eW.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:o,onNodeSelect:e=>{c(e)},refreshKey:d})}),(0,t.jsx)(eY,{})]}),(0,t.jsx)("div",{className:"flex-1 bg-card p-4 overflow-y-auto",children:o?(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)(M,{selectedNode:o,onboardingStatus:x,onSwitchToGlobal:()=>{c({scope:"global",label:"Global"})}}),(0,t.jsx)(L,{selectedNode:o}),"global"===o.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)(U,{})]}),"global"===o.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)(ed,{}),(0,t.jsx)(eI,{}),(0,t.jsx)(e_,{}),(0,t.jsx)(eF,{}),(0,t.jsx)(eX,{})]}),"repo"===o.scope&&o.owner&&o.repo&&(0,t.jsx)(_,{owner:o.owner,repo:o.repo,onDeleted:()=>{c({scope:"global",label:"Global"}),u(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)}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,7347,e=>{"use strict";var t=e.i(19805),r=e.i(27601),s=e.i(25913),a=e.i(52088);let n=(0,s.cva)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-[0.625rem] font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-2.5!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border bg-input/20 text-foreground dark:bg-input/30 [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});e.s(["Badge",0,function({className:e,variant:s="default",render:i,...u}){var c;return c={defaultTagName:"span",props:(0,t.mergeProps)({className:(0,a.cn)(n({variant:s}),e)},u),render:i,state:{slot:"badge",variant:s}},(0,r.useRenderElement)(c.defaultTagName??"div",c,c)}],7347)},18566,(e,t,r)=>{t.exports=e.r(76562)},95468,e=>{"use strict";var t=e.i(23287);e.s(["CheckCircle2",()=>t.default])},31278,e=>{"use strict";var t=e.i(17521);e.s(["Loader2",()=>t.default])},86311,e=>{"use strict";let t=(0,e.i(75254).default)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]);e.s(["MessageSquare",0,t],86311)},73884,e=>{"use strict";let t=(0,e.i(75254).default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);e.s(["XCircle",0,t],73884)},2576,e=>{"use strict";var t=e.i(71645),r=e.i(96085),s=e.i(70935);e.s(["useTaskEvents",0,function(e){let a=(0,t.useRef)(null),n=(0,t.useRef)(e);(0,t.useLayoutEffect)(()=>{n.current=e}),(0,t.useEffect)(()=>{let e=(0,r.io)((0,s.getServerUrl)(),{transports:["polling","websocket"]});return a.current=e,e.on("task:created",({task:e,warnings:t})=>{n.current.onTaskCreated(e,t??[])}),e.on("task:updated",({task:e})=>{n.current.onTaskUpdated(e)}),e.on("task:deleted",({taskId:e})=>{n.current.onTaskDeleted(e)}),e.on("task:tabs-changed",({task:e})=>{n.current.onTaskTabsChanged?.(e)}),()=>{e.disconnect(),a.current=null}},[])}])},71698,e=>{"use strict";var t=e.i(71645),r=e.i(96085),s=e.i(70935);e.s(["useTabStatusEvents",0,function(e,a){let n=(0,t.useRef)(null),i=(0,t.useRef)(new Set),u=(0,t.useRef)(a);(0,t.useEffect)(()=>{u.current=a});let c=(0,t.useCallback)(()=>{if(!n.current){let e=(0,r.io)((0,s.getServerUrl)(),{transports:["polling","websocket"]});n.current=e,e.on("status-changed",({sessionId:e,status:t})=>{let r=function(e){switch(e){case"running":return"running";case"waiting":return"waiting";case"success":return"success";case"failure":case"error":return"error";case"idle":return"idle";default:return null}}(t);null!==r&&u.current(e,r)}),e.on("connect",()=>{for(let t of i.current)e.emit("join",{room:t,mode:"subscribe"})})}return n.current},[]);(0,t.useEffect)(()=>{if(0===e.length)return;let t=c();for(let r of e){let e=`tab:${r}`;i.current.has(e)||(t.emit("join",{room:e,mode:"subscribe"}),i.current.add(e))}let r=new Set(e);for(let e of i.current){let s=e.replace("tab:","");r.has(s)||(t.emit("leave",{room:e}),i.current.delete(e))}},[e,c]),(0,t.useEffect)(()=>{let e=i.current;return()=>{n.current?.disconnect(),n.current=null,e.clear()}},[])}])},53134,801,e=>{"use strict";function t(e){return"success"===e||"error"===e||"running"!==e&&"idle"!==e&&void 0}function r(e){let t=e.tabs??[];if(0===t.length||t.some(e=>"running"===e.status))return null;if(t.some(e=>"waiting"===e.status))return"waiting";let r=t.filter(e=>e.unread);return r.some(e=>"error"===e.status)?"error":r.some(e=>"success"===e.status)?"success":null}e.s(["activityKind",0,function(e){return(e.tabs??[]).some(e=>"running"===e.status)?"running":r(e)},"hasUnreadResult",0,function(e){return null!==r(e)},"unreadForStatus",0,t,"unreadKind",0,r],53134);var s=e.i(71645),a=e.i(70935),n=e.i(2576),i=e.i(71698);e.s(["useLiveTasks",0,function(e={}){let[r,u]=(0,s.useState)([]),[c,l]=(0,s.useState)(!0),o=(0,s.useRef)(e),d=(0,s.useRef)(r);(0,s.useEffect)(()=>{o.current=e,d.current=r});let f=(0,s.useCallback)(async()=>{l(!0);try{let e=await fetch((0,a.apiUrl)("/api/tasks"));if(!e.ok)throw Error("Failed to fetch tasks");let t=await e.json();u(t.data.tasks)}catch(e){console.error("Failed to load tasks:",e)}finally{l(!1)}},[]);(0,s.useEffect)(()=>{f()},[f]);let g=(0,s.useMemo)(()=>r.flatMap(e=>(e.tabs??[]).map(e=>e.tab_id)),[r]);return(0,i.useTabStatusEvents)(g,(e,r)=>{let s=t(r);u(t=>t.map(t=>({...t,tabs:(t.tabs??[]).map(t=>t.tab_id===e?{...t,status:r,...void 0!==s&&{unread:s}}:t)})))}),(0,n.useTaskEvents)({onTaskCreated:(e,t)=>{u(t=>t.some(t=>t.id===e.id)?t:[...t,e]),o.current.onTaskCreated?.(e,t)},onTaskUpdated:e=>{u(t=>t.map(t=>t.id===e.id?e:t)),o.current.onTaskUpdated?.(e)},onTaskDeleted:e=>{let t=d.current.find(t=>t.id===e);u(t=>t.filter(t=>t.id!==e)),o.current.onTaskDeleted?.(e,t)},onTaskTabsChanged:e=>{u(t=>t.map(t=>t.id===e.id?e:t))}}),{tasks:r,setTasks:u,isLoading:c,reload:f}}],801)},22770,e=>{"use strict";var t=e.i(18050),r=e.i(18566),s=e.i(71645),a=e.i(95468),n=e.i(31278),i=e.i(86311),u=e.i(73884),c=e.i(53134),l=e.i(801),o=e.i(7347),d=e.i(52088);let f={waiting:{order:0,icon:i.MessageSquare,className:"text-warning",label:"Waiting for your input"},error:{order:1,icon:u.XCircle,className:"text-destructive",label:"Failed, not opened yet"},success:{order:2,icon:a.CheckCircle2,className:"text-success",label:"Finished, not opened yet"},running:{order:3,icon:n.Loader2,className:"text-primary animate-spin",label:"Running"}};function g({currentTaskId:e}){let a=(0,r.useRouter)(),{tasks:n}=(0,l.useLiveTasks)(),i=(0,s.useMemo)(()=>{let t=[];for(let r of n){let s=(0,c.activityKind)(r);s&&(r.id!==e||"success"!==s&&"error"!==s)&&t.push({task:r,kind:s})}return t.sort((e,t)=>f[e.kind].order-f[t.kind].order||e.task.order-t.task.order||e.task.createdAt.localeCompare(t.task.createdAt))},[n,e]);return(0,t.jsxs)("aside",{className:"hidden md:flex w-64 shrink-0 flex-col border-r border-border bg-card",children:[(0,t.jsxs)("div",{className:"flex h-8 shrink-0 box-content items-center gap-2 border-b border-border p-4",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Active"}),(0,t.jsx)(o.Badge,{variant:"secondary",children:i.length})]}),0===i.length?(0,t.jsx)("p",{className:"p-4 text-center text-xs text-muted-foreground",children:"No active tasks"}):(0,t.jsx)("ul",{className:"flex-1 space-y-0.5 overflow-y-auto p-2",children:i.map(({task:r,kind:s})=>{let{icon:n,className:i,label:u}=f[s],c=r.id===e;return(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button",onClick:()=>a.push(`/tasks/${r.id}`),"aria-current":c?"page":void 0,className:(0,d.cn)("flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-accent",c&&"bg-accent"),children:[(0,t.jsx)("span",{role:"img","aria-label":u,title:u,className:"mt-0.5 shrink-0",children:(0,t.jsx)(n,{className:(0,d.cn)("size-3.5",i)})}),(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"block truncate text-sm text-foreground",title:r.title,children:r.title}),(0,t.jsxs)("span",{className:"block truncate text-xs text-muted-foreground",children:[r.owner,"/",r.repo]})]})]})},r.id)})})]})}e.s(["default",0,function({children:e}){let{id:s}=(0,r.useParams)();return(0,t.jsxs)("div",{className:"h-screen flex bg-background",children:[(0,t.jsx)(g,{currentTaskId:s}),(0,t.jsx)("div",{className:"flex-1 min-w-0",children:e})]})}],22770)}]);
@@ -9,4 +9,4 @@
9
9
  ${e.right}px ${e.bottom}px,
10
10
  ${e.right}px ${e.top}px,
11
11
  ${e.left}px ${e.top}px
12
- )`}return(0,n.jsx)("div",{ref:t,role:"presentation","data-base-ui-inert":"",...a,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:r}})});e.s(["InternalBackdrop",0,r])},38449,e=>{"use strict";var t=e.i(71645),n=e.i(58130),r=e.i(37692),o=e.i(13104),a=e.i(77681),i=e.i(36893),s=e.i(18050);let l=t.forwardRef(function(e,t){let{keepMounted:l=!1,...u}=e,{store:c}=(0,o.useDialogRootContext)(),d=c.useState("mounted"),f=c.useState("modal"),p=c.useState("open");return d||l?(0,s.jsx)(a.DialogPortalContext.Provider,{value:l,children:(0,s.jsxs)(r.FloatingPortal,{ref:t,...u,children:[d&&!0===f&&(0,s.jsx)(i.InternalBackdrop,{ref:c.context.internalBackdropRef,inert:(0,n.inertValue)(!p)}),e.children]})}):null});e.s(["DialogPortal",0,l])},58509,e=>{"use strict";var t=e.i(71645);e.s(["useOnFirstRender",0,function(e){let n=t.useRef(!0);n.current&&(n.current=!1,e())}])},66196,e=>{"use strict";var t=e.i(29315),n=e.i(57666),r=e.i(90219),o=e.i(33848),a=e.i(977),i=e.i(66745),s=e.i(47135),l=e.i(17514);let u={},c={},d="";class f{lockCount=0;restore=null;timeoutLock=i.Timeout.create();timeoutUnlock=i.Timeout.create();acquire(e){return this.lockCount+=1,1===this.lockCount&&null===this.restore&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{this.lockCount-=1,0===this.lockCount&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{0===this.lockCount&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){let a,i,f,p,g;if(0===this.lockCount||null!==this.restore)return;let m=(0,r.ownerDocument)(e).documentElement,h=(0,o.ownerWindow)(m).getComputedStyle(m).overflowY;if("hidden"===h||"clip"===h){this.restore=l.NOOP;return}let v=n.isIOS||!function(e){if("u"<typeof document)return!1;let t=(0,r.ownerDocument)(e);return(0,o.ownerWindow)(t).innerWidth-t.documentElement.clientWidth>0}(e);this.restore=v?(i=(a=(0,r.ownerDocument)(e)).documentElement,f=a.body,g={overflowY:(p=(0,t.isOverflowElement)(i)?i:f).style.overflowY,overflowX:p.style.overflowX},Object.assign(p.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(p.style,g)}):function(e){let a=(0,r.ownerDocument)(e),i=a.documentElement,l=a.body,f=(0,o.ownerWindow)(i),p=0,g=0,m=!1,h=s.AnimationFrame.create();if(n.isWebKit&&(f.visualViewport?.scale??1)!==1)return()=>{};function v(){let n=f.getComputedStyle(i),o=f.getComputedStyle(l),a=(n.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";p=i.scrollTop,g=i.scrollLeft,u={scrollbarGutter:i.style.scrollbarGutter,overflowY:i.style.overflowY,overflowX:i.style.overflowX},d=i.style.scrollBehavior,c={position:l.style.position,height:l.style.height,width:l.style.width,boxSizing:l.style.boxSizing,overflowY:l.style.overflowY,overflowX:l.style.overflowX,scrollBehavior:l.style.scrollBehavior};let s=i.scrollHeight>i.clientHeight,h=i.scrollWidth>i.clientWidth,v="scroll"===n.overflowY||"scroll"===o.overflowY,b="scroll"===n.overflowX||"scroll"===o.overflowX,y=Math.max(0,f.innerWidth-l.clientWidth),x=Math.max(0,f.innerHeight-l.clientHeight),E=parseFloat(o.marginTop)+parseFloat(o.marginBottom),w=parseFloat(o.marginLeft)+parseFloat(o.marginRight),S=(0,t.isOverflowElement)(i)?i:l;if(m=function(e){if(!("u">typeof CSS&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||"u"<typeof document)return!1;let n=(0,r.ownerDocument)(e),o=n.documentElement,a=n.body,i=(0,t.isOverflowElement)(o)?o:a,s=i.style.overflowY,l=o.style.scrollbarGutter;o.style.scrollbarGutter="stable",i.style.overflowY="scroll";let u=i.offsetWidth;i.style.overflowY="hidden";let c=i.offsetWidth;return i.style.overflowY=s,o.style.scrollbarGutter=l,u===c}(e)){i.style.scrollbarGutter=a,S.style.overflowY="hidden",S.style.overflowX="hidden";return}Object.assign(i.style,{scrollbarGutter:a,overflowY:"hidden",overflowX:"hidden"}),(s||v)&&(i.style.overflowY="scroll"),(h||b)&&(i.style.overflowX="scroll"),Object.assign(l.style,{position:"relative",height:E||x?`calc(100dvh - ${E+x}px)`:"100dvh",width:w||y?`calc(100vw - ${w+y}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),l.scrollTop=p,l.scrollLeft=g,i.setAttribute("data-base-ui-scroll-locked",""),i.style.scrollBehavior="unset"}function b(){Object.assign(i.style,u),Object.assign(l.style,c),m||(i.scrollTop=p,i.scrollLeft=g,i.removeAttribute("data-base-ui-scroll-locked"),i.style.scrollBehavior=d)}function y(){b(),h.request(v)}return v(),f.addEventListener("resize",y),()=>{h.cancel(),b(),"function"==typeof f.removeEventListener&&f.removeEventListener("resize",y)}}(e)}}let p=new f;e.s(["useScrollLock",0,function(e=!0,t=null){(0,a.useIsoLayoutEffect)(()=>{if(e)return p.acquire(t)},[e,t])}])},55838,(e,t,n)=>{"use strict";var r=e.r(71645),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useState,i=r.useEffect,s=r.useLayoutEffect,l=r.useDebugValue;function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var c="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),o=r[0].inst,c=r[1];return s(function(){o.value=n,o.getSnapshot=t,u(o)&&c({inst:o})},[e,n,t]),i(function(){return u(o)&&c({inst:o}),e(function(){u(o)&&c({inst:o})})},[e]),l(n),n};n.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:c},2239,(e,t,n)=>{"use strict";t.exports=e.r(55838)},52822,(e,t,n)=>{"use strict";var r=e.r(71645),o=e.r(2239),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=o.useSyncExternalStore,s=r.useRef,l=r.useEffect,u=r.useMemo,c=r.useDebugValue;n.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var d=s(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;var p=i(e,(d=u(function(){function e(e){if(!l){if(l=!0,i=e,e=r(e),void 0!==o&&f.hasValue){var t=f.value;if(o(t,e))return s=t}return s=e}if(t=s,a(i,e))return t;var n=r(e);return void 0!==o&&o(t,n)?(i=e,t):(i=e,s=n)}var i,s,l=!1,u=void 0===n?null:n;return[function(){return e(t())},null===u?void 0:function(){return e(u())}]},[t,n,r,o]))[0],d[1]);return l(function(){f.hasValue=!0,f.value=p},[p]),c(p),p}},30224,(e,t,n)=>{"use strict";t.exports=e.r(52822)},33605,89633,26665,83921,3851,98263,24019,6157,e=>{"use strict";let t;var n=e.i(71645),r=e.i(29315),o=e.i(66745),a=e.i(76477),i=e.i(90219),s=e.i(47857),l=e.i(82033),u=e.i(87612),c=e.i(51665),d=e.i(5963),f=e.i(3404),p=e.i(32652);let g={intentional:"onClick",sloppy:"onPointerDown"};function m(){return!1}e.s(["useDismiss",0,function(e,t={}){let h="rootStore"in e?e.rootStore:e,v=h.useState("open"),b=h.useState("floatingElement"),{dataRef:y}=h.context,{enabled:x=!0,escapeKey:E=!0,outsidePress:w=!0,outsidePressEvent:S="sloppy",referencePress:C=m,referencePressEvent:R="sloppy",bubbles:T,externalTree:k}=t,D=(0,c.useFloatingTree)(k),O=(0,a.useStableCallback)("function"==typeof w?w:()=>!1),I="function"==typeof w?O:w,A=!1!==I,P=(0,a.useStableCallback)(()=>S),N=n.useRef(!1),M=n.useRef(!1),L=n.useRef(!1),{escapeKey:j,outsidePress:F}={escapeKey:"boolean"==typeof T?T:T?.escapeKey??!1,outsidePress:"boolean"==typeof T?T:T?.outsidePress??!0},B=n.useRef(null),W=(0,o.useTimeout)(),z=(0,o.useTimeout)(),_=(0,a.useStableCallback)(()=>{z.clear(),y.current.insideReactTree=!1}),V=n.useRef(!1),Y=n.useRef(""),H=(0,a.useStableCallback)(C),$=(0,a.useStableCallback)(e=>{if(!v||!x||!E||"Escape"!==e.key||V.current)return;let t=y.current.floatingContext?.nodeId,n=D?(0,u.getNodeChildren)(D.nodesRef.current,t):[];if(!j&&n.length>0){let e=!0;if(n.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__escapeKeyBubbles&&(e=!1)}),!e)return}let r=(0,l.isReactEvent)(e)?e.nativeEvent:e,o=(0,d.createChangeEventDetails)(f.REASONS.escapeKey,r);h.setOpen(!1,o),j||o.isPropagationAllowed||e.stopPropagation()}),U=(0,a.useStableCallback)(()=>{y.current.insideReactTree=!0,z.start(0,_)});n.useEffect(()=>{if(!v||!x)return;y.current.__escapeKeyBubbles=j,y.current.__outsidePressBubbles=F;let e=new o.Timeout,t=new o.Timeout;function n(){e.clear(),V.current=!0}function a(){e.start(5*!!(0,r.isWebKit)(),()=>{V.current=!1})}function l(){L.current=!0,t.start(0,()=>{L.current=!1})}function c(){N.current=!1,M.current=!1}function g(){let e=Y.current,t=P(),n="function"==typeof t?t():t;return"string"==typeof n?n:n["pen"!==e&&e?e:"mouse"]}function m(e){let t=y.current.floatingContext?.nodeId,n=D&&(0,u.getNodeChildren)(D.nodesRef.current,t).some(t=>(0,s.isEventTargetWithin)(e,t.context?.elements.floating));return(0,s.isEventTargetWithin)(e,h.select("floatingElement"))||(0,s.isEventTargetWithin)(e,h.select("domReferenceElement"))||n}function w(e){let n;if("intentional"===(n=g())&&"click"!==e.type||"sloppy"===n&&"click"===e.type||y.current.insideReactTree)return void _();let o=(0,s.getTarget)(e),a=`[${(0,p.createAttribute)("inert")}]`,l=Array.from((0,i.ownerDocument)(h.select("floatingElement")).querySelectorAll(a)),c=(0,r.isElement)(o)?o.getRootNode():null;(0,r.isShadowRoot)(c)&&(l=l.concat(Array.from(c.querySelectorAll(a))));let v=h.context.triggerElements;if(o&&(v.hasElement(o)||v.hasMatchingElement(e=>(0,s.contains)(e,o))))return;let b=(0,r.isElement)(o)?o:null;for(;b&&!(0,r.isLastTraversableNode)(b);){let e=(0,r.getParentNode)(b);if((0,r.isLastTraversableNode)(e)||!(0,r.isElement)(e))break;b=e}if(l.length&&(0,r.isElement)(o)&&!(0,s.isRootElement)(o)&&!(0,s.contains)(o,h.select("floatingElement"))&&l.every(e=>!(0,s.contains)(b,e)))return;if((0,r.isHTMLElement)(o)&&!("touches"in e)){let t=(0,r.isLastTraversableNode)(o),n=(0,r.getComputedStyle)(o),a=/auto|scroll/,i=t||a.test(n.overflowX),s=t||a.test(n.overflowY),l=i&&o.clientWidth>0&&o.scrollWidth>o.clientWidth,u=s&&o.clientHeight>0&&o.scrollHeight>o.clientHeight,c="rtl"===n.direction,d=u&&(c?e.offsetX<=o.offsetWidth-o.clientWidth:e.offsetX>o.clientWidth),f=l&&e.offsetY>o.clientHeight;if(d||f)return}if(m(e))return;if("intentional"===g()&&L.current){t.clear(),L.current=!1;return}if("function"==typeof I&&!I(e))return;let x=y.current.floatingContext?.nodeId,E=D?(0,u.getNodeChildren)(D.nodesRef.current,x):[];if(E.length>0){let e=!0;if(E.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__outsidePressBubbles&&(e=!1)}),!e)return}h.setOpen(!1,(0,d.createChangeEventDetails)(f.REASONS.outsidePress,e)),_()}function S(e){Y.current="touch";let t=(0,s.getTarget)(e);t?.addEventListener(e.type,function n(){!function(e){if("sloppy"!==g()||!h.select("open")||!x||(0,s.isEventTargetWithin)(e,h.select("floatingElement"))||(0,s.isEventTargetWithin)(e,h.select("domReferenceElement")))return;let t=e.touches[0];t&&(B.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},W.start(1e3,()=>{B.current&&(B.current.dismissOnTouchEnd=!1,B.current.dismissOnMouseDown=!1)}))}(e),t?.removeEventListener(e.type,n)})}function C(e){if(W.clear(),"pointerdown"===e.type&&(Y.current=e.pointerType),"mousedown"===e.type&&B.current&&!B.current.dismissOnMouseDown)return;let t=(0,s.getTarget)(e);t?.addEventListener(e.type,function n(){if("pointerdown"===e.type)"sloppy"!==g()||"touch"===e.pointerType||!h.select("open")||!x||(0,s.isEventTargetWithin)(e,h.select("floatingElement"))||(0,s.isEventTargetWithin)(e,h.select("domReferenceElement"))||w(e);else w(e);t?.removeEventListener(e.type,n)})}function R(e){if(!N.current)return;let n=M.current;if(c(),"intentional"===g()){if("pointercancel"===e.type){n&&l();return}m(e)||(n?l():("function"!=typeof I||I(e))&&(t.clear(),L.current=!0,_()))}}function T(e){let t=(0,s.getTarget)(e);t?.addEventListener(e.type,function n(){!function(e){if("sloppy"!==g()||!B.current||(0,s.isEventTargetWithin)(e,h.select("floatingElement"))||(0,s.isEventTargetWithin)(e,h.select("domReferenceElement")))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-B.current.startX),r=Math.abs(t.clientY-B.current.startY),o=Math.sqrt(n*n+r*r);o>5&&(B.current.dismissOnTouchEnd=!0),o>10&&(w(e),W.clear(),B.current=null)}(e),t?.removeEventListener(e.type,n)})}function k(e){let t=(0,s.getTarget)(e);t?.addEventListener(e.type,function n(){"sloppy"!==g()||!B.current||(0,s.isEventTargetWithin)(e,h.select("floatingElement"))||(0,s.isEventTargetWithin)(e,h.select("domReferenceElement"))||(B.current.dismissOnTouchEnd&&w(e),W.clear(),B.current=null),t?.removeEventListener(e.type,n)})}let O=(0,i.ownerDocument)(b);return E&&(O.addEventListener("keydown",$),O.addEventListener("compositionstart",n),O.addEventListener("compositionend",a)),A&&(O.addEventListener("click",C,!0),O.addEventListener("pointerdown",C,!0),O.addEventListener("pointerup",R,!0),O.addEventListener("pointercancel",R,!0),O.addEventListener("mousedown",C,!0),O.addEventListener("mouseup",R,!0),O.addEventListener("touchstart",S,!0),O.addEventListener("touchmove",T,!0),O.addEventListener("touchend",k,!0)),()=>{E&&(O.removeEventListener("keydown",$),O.removeEventListener("compositionstart",n),O.removeEventListener("compositionend",a)),A&&(O.removeEventListener("click",C,!0),O.removeEventListener("pointerdown",C,!0),O.removeEventListener("pointerup",R,!0),O.removeEventListener("pointercancel",R,!0),O.removeEventListener("mousedown",C,!0),O.removeEventListener("mouseup",R,!0),O.removeEventListener("touchstart",S,!0),O.removeEventListener("touchmove",T,!0),O.removeEventListener("touchend",k,!0)),e.clear(),t.clear(),c(),L.current=!1}},[y,b,E,A,I,v,x,j,F,$,_,P,D,h,W]),n.useEffect(_,[I,_]);let K=n.useMemo(()=>({onKeyDown:$,[g[R]]:e=>{H()&&h.setOpen(!1,(0,d.createChangeEventDetails)(f.REASONS.triggerPress,e.nativeEvent))},..."intentional"!==R&&{onClick(e){H()&&h.setOpen(!1,(0,d.createChangeEventDetails)(f.REASONS.triggerPress,e.nativeEvent))}}}),[$,h,R,H]),q=(0,a.useStableCallback)(e=>{if(!v||!x||0!==e.button)return;let t=(0,s.getTarget)(e.nativeEvent);(0,s.contains)(h.select("floatingElement"),t)&&(N.current||(N.current=!0,M.current=!1))}),X=(0,a.useStableCallback)(e=>{!v||!x||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&N.current&&(M.current=!0)}),G=n.useMemo(()=>({onKeyDown:$,onPointerDown:X,onMouseDown:X,onClickCapture:U,onMouseDownCapture(e){U(),q(e)},onPointerDownCapture(e){U(),q(e)},onMouseUpCapture:U,onTouchEndCapture:U,onTouchMoveCapture:U}),[$,U,q,X]);return n.useMemo(()=>x?{reference:K,floating:G,trigger:K}:{},[x,K,G])}],33605);var h=e.i(494);function v(e,t,n){let r=new Map,o="item"===n,a={};for(let t in"floating"===n&&(a.tabIndex=-1,a[h.FOCUSABLE_ATTRIBUTE]=""),e)o&&e&&(t===h.ACTIVE_KEY||t===h.SELECTED_KEY)||(a[t]=e[t]);for(let i=0;i<t.length;i+=1){let s,l=t[i]?.[n];(s="function"==typeof l?e?l(e):null:l)&&b(a,s,o,r)}return b(a,e,o,r),a}function b(e,t,n,r){for(let o in t){let a=t[o];n&&(o===h.ACTIVE_KEY||o===h.SELECTED_KEY)||(o.startsWith("on")?(r.has(o)||r.set(o,[]),"function"==typeof a&&(r.get(o)?.push(a),e[o]=(...e)=>r.get(o)?.map(t=>t(...e)).find(e=>void 0!==e))):e[o]=a)}}e.s(["useInteractions",0,function(e=[]){let t=e.map(e=>e?.reference),r=e.map(e=>e?.floating),o=e.map(e=>e?.item),a=e.map(e=>e?.trigger),i=n.useCallback(t=>v(t,e,"reference"),t),s=n.useCallback(t=>v(t,e,"floating"),r),l=n.useCallback(t=>v(t,e,"item"),o),u=n.useCallback(t=>v(t,e,"trigger"),a);return n.useMemo(()=>({getReferenceProps:i,getFloatingProps:s,getItemProps:l,getTriggerProps:u}),[i,s,l,u])}],89633);var y=e.i(83799),x=e.i(17514);let E=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);e.s(["useRole",0,function(e,t={}){let r="rootStore"in e?e.rootStore:e,o=r.useState("open"),a=r.useState("floatingId"),i=r.useState("domReferenceElement"),l=r.useState("floatingElement"),{role:u="dialog"}=t,d=(0,y.useId)(),f=i?.id||d,p=n.useMemo(()=>(0,s.getFloatingFocusElement)(l)?.id||a,[l,a]),g=E.get(u)??u,m=null!=(0,c.useFloatingParentNodeId)(),h=n.useMemo(()=>"tooltip"===g||"label"===u?x.EMPTY_OBJECT:{"aria-haspopup":"alertdialog"===g?"dialog":g,"aria-expanded":"false",..."listbox"===g&&{role:"combobox"},..."menu"===g&&m&&{role:"menuitem"},..."select"===u&&{"aria-autocomplete":"none"},..."combobox"===u&&{"aria-autocomplete":"list"}},[g,m,u]),v=n.useMemo(()=>"tooltip"===g||"label"===u?{[`aria-${"label"===u?"labelledby":"describedby"}`]:o?p:void 0}:{...h,"aria-expanded":o?"true":"false","aria-controls":o?p:void 0,..."menu"===g&&{id:f}},[g,p,o,f,u,h]),b=n.useMemo(()=>{let e={id:p,...g&&{role:g}};return"tooltip"===g||"label"===u?e:{...e,..."menu"===g&&{"aria-labelledby":f}}},[g,p,f,u]),w=n.useCallback(({active:e,selected:t})=>{let n={role:"option",...e&&{id:`${p}-fui-option`}};switch(u){case"select":case"combobox":return{...n,"aria-selected":t}}return{}},[p,u]);return n.useMemo(()=>({reference:v,floating:b,item:w,trigger:h}),[v,b,h,w])}],26665);var w=e.i(30628),S=e.i(977);e.i(47167);var C=e.i(67805),R=Symbol("NOT_FOUND"),T=e=>Array.isArray(e)?e:[e],k=0,D=class{revision=k;_value;_lastValue;_isEqual=O;constructor(e,t=O){this._value=this._lastValue=e,this._isEqual=t}get value(){return this._value}set value(e){this.value!==e&&(this._value=e,this.revision=++k)}};function O(e,t){return e===t}function I(e){return e instanceof D||console.warn("Not a valid cell! ",e),e.value}var A=(e,t)=>!1;function P(){return function(e=O){return new D(null,e)}(A)}var N=e=>{let t=e.collectionTag;null===t&&(t=e.collectionTag=P()),I(t)};Symbol();var M=0,L=Object.getPrototypeOf({}),j=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy(this,F);tag=P();tags={};children={};collectionTag=null;id=M++},F={get:(e,t)=>(function(){let{value:n}=e,r=Reflect.get(n,t);if("symbol"==typeof t||t in L)return r;if("object"==typeof r&&null!==r){var o;let n=e.children[t];return void 0===n&&(n=e.children[t]=Array.isArray(o=r)?new B(o):new j(o)),n.tag&&I(n.tag),n.proxy}{let n=e.tags[t];return void 0===n&&((n=e.tags[t]=P()).value=r),I(n),r}})(),ownKeys:e=>(N(e),Reflect.ownKeys(e.value)),getOwnPropertyDescriptor:(e,t)=>Reflect.getOwnPropertyDescriptor(e.value,t),has:(e,t)=>Reflect.has(e.value,t)},B=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy([this],W);tag=P();tags={};children={};collectionTag=null;id=M++},W={get:([e],t)=>("length"===t&&N(e),F.get(e,t)),ownKeys:([e])=>F.ownKeys(e),getOwnPropertyDescriptor:([e],t)=>F.getOwnPropertyDescriptor(e,t),has:([e],t)=>F.has(e,t)},z=(e,t)=>e===t,_="u">typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function V(){return{s:0,v:void 0,o:null,p:null}}function Y(e,t={}){let n,r=V(),{resultEqualityCheck:o}=t,a=0;function i(){let t,i=r,{length:s}=arguments;for(let e=0;e<s;e++){let t=arguments[e];if("function"==typeof t||"object"==typeof t&&null!==t){let e=i.o;null===e&&(i.o=e=new WeakMap);let n=e.get(t);void 0===n?(i=V(),e.set(t,i)):i=n}else{let e=i.p;null===e&&(i.p=e=new Map);let n=e.get(t);void 0===n?(i=V(),e.set(t,i)):i=n}}let l=i;if(1===i.s)t=i.v;else if(t=e.apply(null,arguments),a++,o){let e=n?.deref?.()??n;null!=e&&o(e,t)&&(t=e,0!==a&&a--),n="object"==typeof t&&null!==t||"function"==typeof t?new _(t):t}return l.s=1,l.v=t,t}return i.clearCache=()=>{r=V(),i.resetResultsCount()},i.resultsCount=()=>a,i.resetResultsCount=()=>{a=0},i}function H(e,...t){let n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r,o=0,a=0,i={},s=e.pop();"object"==typeof s&&(i=s,s=e.pop()),function(e,t=`expected a function, instead received ${typeof e}`){if("function"!=typeof e)throw TypeError(t)}(s,`createSelector expects an output function after the inputs, but received: [${typeof s}]`);let{memoize:l,memoizeOptions:u=[],argsMemoize:c=Y,argsMemoizeOptions:d=[],devModeChecks:f={}}={...n,...i},p=T(u),g=T(d),m=(!function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(e=>"function"==typeof e)){let n=e.map(e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e).join(", ");throw TypeError(`${t}[${n}]`)}}(t=Array.isArray(e[0])?e[0]:e,"createSelector expects all input-selectors to be functions, but received the following types: "),t),h=l(function(){return o++,s.apply(null,arguments)},...p);return Object.assign(c(function(){a++;let e=function(e,t){let n=[],{length:r}=e;for(let o=0;o<r;o++)n.push(e[o].apply(null,t));return n}(m,arguments);return r=h.apply(null,e)},...g),{resultFunc:s,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>r,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:l,argsMemoize:c})};return Object.assign(r,{withTypes:()=>r}),r}var $=H(Y),U=Object.assign((e,t=$)=>{!function(e,t=`expected an object, instead received ${typeof e}`){if("object"!=typeof e)throw TypeError(t)}(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>U});H({memoize:function(e,t){let n,{equalityCheck:r=z,maxSize:o=1,resultEqualityCheck:a}="object"==typeof t?t:{equalityCheck:t},i=function(e,t){if(null===e||null===t||e.length!==t.length)return!1;let{length:n}=e;for(let o=0;o<n;o++)if(!r(e[o],t[o]))return!1;return!0},s=0,l=o<=1?{get:e=>n&&i(n.key,e)?n.value:R,put(e,t){n={key:e,value:t}},getEntries:()=>n?[n]:[],clear(){n=void 0}}:function(e,t){let n=[];function r(e){let r=n.findIndex(n=>t(e,n.key));if(r>-1){let e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return R}return{get:r,put:function(t,o){r(t)===R&&(n.unshift({key:t,value:o}),n.length>e&&n.pop())},getEntries:function(){return n},clear:function(){n=[]}}}(o,i);function u(){let t=l.get(arguments);if(t===R){if(t=e.apply(null,arguments),s++,a){let e=l.getEntries().find(e=>a(e.value,t));e&&(t=e.value,0!==s&&s--)}l.put(arguments,t)}return t}return u.clearCache=()=>{l.clear(),u.resetResultsCount()},u.resultsCount=()=>s,u.resetResultsCount=()=>{s=0},u},memoizeOptions:{maxSize:1,equalityCheck:Object.is}});let K=(e,t,n,r,o,a,...i)=>{let s;if(i.length>0)throw Error((0,C.default)(1));if(e&&t&&n&&r&&o&&a)s=(i,s,l,u)=>a(e(i,s,l,u),t(i,s,l,u),n(i,s,l,u),r(i,s,l,u),o(i,s,l,u),s,l,u);else if(e&&t&&n&&r&&o)s=(a,i,s,l)=>o(e(a,i,s,l),t(a,i,s,l),n(a,i,s,l),r(a,i,s,l),i,s,l);else if(e&&t&&n&&r)s=(o,a,i,s)=>r(e(o,a,i,s),t(o,a,i,s),n(o,a,i,s),a,i,s);else if(e&&t&&n)s=(r,o,a,i)=>n(e(r,o,a,i),t(r,o,a,i),o,a,i);else if(e&&t)s=(n,r,o,a)=>t(e(n,r,o,a),r,o,a);else if(e)s=e;else throw Error("Missing arguments");return s};e.s(["createSelector",0,K],83921);var q=e.i(2239),X=e.i(30224),G=e.i(35423);let J=[];function Q(){return t}function Z(e){J.push(e)}function ee(e){let n=(n,r)=>{let o,a=(0,w.useRefWithInit)(et).current;try{for(let e of(t=a,J))e.before(a);for(let t of(o=e(n,r),J))t.after(a);a.didInitialize=!0}finally{t=void 0}return o};return n.displayName=e.displayName||e.name,n}function et(){return{didInitialize:!1}}e.s(["fastComponent",0,ee,"fastComponentRef",0,function(e){return n.forwardRef(ee(e))},"getInstance",0,Q,"register",0,Z],3851);let en=(0,G.isReactVersionAtLeast)(19)?function(e,t,r,o,a){let i,s=Q();if(!s){let i;return i=n.useCallback(()=>t(e.getSnapshot(),r,o,a),[e,t,r,o,a]),(0,q.useSyncExternalStore)(e.subscribe,i,i)}let l=s.syncIndex;return s.syncIndex+=1,s.didInitialize?(i=s.syncHooks[l]).store===e&&i.selector===t&&Object.is(i.a1,r)&&Object.is(i.a2,o)&&Object.is(i.a3,a)||(i.store!==e&&(s.didChangeStore=!0),i.store=e,i.selector=t,i.a1=r,i.a2=o,i.a3=a,i.didChange=!0):(i={store:e,selector:t,a1:r,a2:o,a3:a,value:t(e.getSnapshot(),r,o,a),didChange:!1},s.syncHooks.push(i)),i.value}:function(e,t,n,r,o){return(0,X.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,o))};Z({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],o=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,o))&&(t=!0,r.value=o,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,q.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});class er{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t]))return void this.setState({...this.state,...e})}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return en(this,e,t,n,r)}}class eo extends er{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){n.useDebugValue(e),(0,S.useIsoLayoutEffect)(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let n=this;(0,S.useIsoLayoutEffect)(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this,n=Object.values(e);(0,S.useIsoLayoutEffect)(()=>{t.update(e)},[t,...n])}useControlledProp(e,t){n.useDebugValue(e);let r=void 0!==t;(0,S.useIsoLayoutEffect)(()=>{r&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,r])}select(e,t,n,r){return(0,this.selectors[e])(this.state,t,n,r)}useState(e,t,r,o){return n.useDebugValue(e),en(this,this.selectors[e],t,r,o)}useContextCallback(e,t){n.useDebugValue(e);let r=(0,a.useStableCallback)(t??x.NOOP);this.context[e]=r}useStateSetter(e){let t=n.useRef(void 0);return void 0===t.current&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n,r=(n="function"==typeof e?e:this.selectors[e])(this.state);return t(r,r,this),this.subscribe(e=>{let o=n(e);if(!Object.is(r,o)){let e=r;r=o,t(o,e,this)}})}}e.s(["ReactStore",0,eo],98263);var ea=e.i(16385);let ei={open:K(e=>e.open),domReferenceElement:K(e=>e.domReferenceElement),referenceElement:K(e=>e.positionReference??e.referenceElement),floatingElement:K(e=>e.floatingElement),floatingId:K(e=>e.floatingId)};class es extends eo{constructor(e){const{nested:t,noEmit:n,onOpenChange:r,triggerElements:o,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:(0,ea.createEventEmitter)(),nested:t,noEmit:n,triggerElements:o},ei)}setOpen=(e,t)=>{if((!e||!this.state.open||(0,l.isClickLikeEvent)(t.event))&&(this.context.dataRef.current.openEvent=e?t.event:void 0),!this.context.noEmit){let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit("openchange",n)}this.context.onOpenChange?.(e,t)}}e.s(["FloatingRootStore",0,es],24019),e.s(["useSyncedFloatingRootContext",0,function(e){let{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:o=!1,onOpenChange:a}=e,i=(0,y.useId)(),s=null!=(0,c.useFloatingParentNodeId)(),l=t.useState("open"),u=t.useState("activeTriggerElement"),d=t.useState(o?"popupElement":"positionerElement"),f=t.context.triggerElements,p=(0,w.useRefWithInit)(()=>new es({open:l,referenceElement:u,floatingElement:d,triggerElements:f,onOpenChange:a,floatingId:i,nested:s,noEmit:n})).current;return(0,S.useIsoLayoutEffect)(()=>{let e={open:l,floatingId:i,referenceElement:u,floatingElement:d};(0,r.isElement)(u)&&(e.domReferenceElement=u),p.state.positionReference===p.state.referenceElement&&(e.positionReference=u),p.update(e)},[l,i,u,d,p]),p.context.onOpenChange=a,p.context.nested=s,p.context.noEmit=n,p}],6157)},50091,e=>{"use strict";var t=e.i(71645),n=e.i(76477),r=e.i(57666),o=e.i(977);e.s(["useOpenInteractionType",0,function(e){let a,i,s,l,[u,c]=t.useState(null),d=(0,n.useStableCallback)((t,n)=>{e||c(n||(r.isIOS?"touch":""))});a=t.useRef(e),i=(0,n.useStableCallback)(t=>{t&&!e&&c(null)}),(0,o.useIsoLayoutEffect)(()=>{a.current!==e&&i(a.current)},[e,i]),(0,o.useIsoLayoutEffect)(()=>{a.current=e},[e]);let{onClick:f,onPointerDown:p}=(s=t.useRef(""),l=t.useCallback(e=>{e.defaultPrevented||(s.current=e.pointerType,d(e,e.pointerType))},[d]),{onClick:t.useCallback(e=>{0===e.detail?d(e,"keyboard"):(d(e,"pointerType"in e?e.pointerType:s.current),s.current="")},[d]),onPointerDown:l});return t.useMemo(()=>({openMethod:u,triggerProps:{onClick:f,onPointerDown:p}}),[u,f,p])}],50091)},88841,e=>{"use strict";var t=e.i(71645),n=e.i(977),r=e.i(47135);e.s(["useTransitionStatus",0,function(e,o=!1,a=!1){let[i,s]=t.useState(e&&o?"idle":void 0),[l,u]=t.useState(e);return e&&!l&&(u(!0),s("starting")),e||!l||"ending"===i||a||s("ending"),e||l||"ending"!==i||s(void 0),(0,n.useIsoLayoutEffect)(()=>{if(!e&&l&&"ending"!==i&&a){let e=r.AnimationFrame.request(()=>{s("ending")});return()=>{r.AnimationFrame.cancel(e)}}},[e,l,i,a]),(0,n.useIsoLayoutEffect)(()=>{if(!e||o)return;let t=r.AnimationFrame.request(()=>{s(void 0)});return()=>{r.AnimationFrame.cancel(t)}},[o,e]),(0,n.useIsoLayoutEffect)(()=>{if(!e||!o)return;e&&l&&"idle"!==i&&s("starting");let t=r.AnimationFrame.request(()=>{s("idle")});return()=>{r.AnimationFrame.cancel(t)}},[o,e,l,s,i]),t.useMemo(()=>({mounted:l,setMounted:u,transitionStatus:i}),[l,i])}])},58642,e=>{"use strict";var t=e.i(71645),n=e.i(76477),r=e.i(977),o=e.i(88841),a=e.i(89269);function i(e,n){let r=t.useRef(null),o=t.useRef(null);return t.useCallback(t=>{if(void 0!==e){if(null!==r.current){let e=r.current,t=o.current,a=n.context.triggerElements.getById(e);t&&a===t&&n.context.triggerElements.delete(e),r.current=null,o.current=null}null!==t&&(r.current=e,o.current=t,n.context.triggerElements.add(e,t))}},[n,e])}e.s(["useImplicitActiveTrigger",0,function(e){let t=e.useState("open");(0,r.useIsoLayoutEffect)(()=>{if(t&&!e.select("activeTriggerId")&&1===e.context.triggerElements.size){let t=e.context.triggerElements.entries().next();if(!t.done){let[n,r]=t.value;e.update({activeTriggerId:n,activeTriggerElement:r})}}},[t,e])},"useOpenStateTransitions",0,function(e,t,r){let{mounted:i,setMounted:s,transitionStatus:l}=(0,o.useTransitionStatus)(e);t.useSyncedValues({mounted:i,transitionStatus:l});let u=(0,n.useStableCallback)(()=>{s(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),r?.(),t.context.onOpenChangeComplete?.(!1)}),c=t.useState("preventUnmountingOnClose");return(0,a.useOpenChangeComplete)({enabled:!c,open:e,ref:t.context.popupRef,onComplete(){e||u()}}),{forceUnmount:u,transitionStatus:l}},"useTriggerDataForwarding",0,function(e,t,o,a){let s=o.useState("isMountedByTrigger",e),l=i(e,o),u=(0,n.useStableCallback)(t=>{if(l(t),!t||!o.select("open"))return;let n=o.select("activeTriggerId");n===e?o.update({activeTriggerElement:t,...a}):null==n&&o.update({activeTriggerId:e,activeTriggerElement:t,...a})});return(0,r.useIsoLayoutEffect)(()=>{s&&o.update({activeTriggerElement:t.current,...a})},[s,o,t,...Object.values(a)]),{registerTrigger:u,isMountedByThisTrigger:s}},"useTriggerRegistration",0,i])},32156,e=>{"use strict";var t=e.i(71645),n=e.i(76477),r=e.i(66196),o=e.i(33605),a=e.i(89633),i=e.i(26665),s=e.i(6157),l=e.i(47857),u=e.i(50091),c=e.i(5963),d=e.i(3404),f=e.i(58642);e.s(["useDialogRoot",0,function(e){let{store:p,parentContext:g,actionsRef:m}=e,h=p.useState("open"),v=p.useState("disablePointerDismissal"),b=p.useState("modal"),y=p.useState("popupElement"),{openMethod:x,triggerProps:E}=(0,u.useOpenInteractionType)(h);(0,f.useImplicitActiveTrigger)(p);let{forceUnmount:w}=(0,f.useOpenStateTransitions)(h,p),S=(0,n.useStableCallback)(e=>{let t=(0,c.createChangeEventDetails)(e);return t.preventUnmountOnClose=()=>{p.set("preventUnmountingOnClose",!0)},t}),C=t.useCallback(()=>{p.setOpen(!1,S(d.REASONS.imperativeAction))},[p,S]);t.useImperativeHandle(m,()=>({unmount:w,close:C}),[w,C]);let R=(0,s.useSyncedFloatingRootContext)({popupStore:p,onOpenChange:p.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[T,k]=t.useState(0),D=0===T,O=(0,i.useRole)(R),I=(0,o.useDismiss)(R,{outsidePressEvent:()=>p.context.internalBackdropRef.current||p.context.backdropRef.current?"intentional":{mouse:"trap-focus"===b?"sloppy":"intentional",touch:"sloppy"},outsidePress(e){if(!p.context.outsidePressEnabledRef.current||"button"in e&&0!==e.button||"touches"in e&&1!==e.touches.length)return!1;let t=(0,l.getTarget)(e);return!!D&&!v&&(!b||!p.context.internalBackdropRef.current&&!p.context.backdropRef.current||p.context.internalBackdropRef.current===t||p.context.backdropRef.current===t||(0,l.contains)(t,y)&&!t?.hasAttribute("data-base-ui-portal"))},escapeKey:D});(0,r.useScrollLock)(h&&!0===b,y);let{getReferenceProps:A,getFloatingProps:P,getTriggerProps:N}=(0,a.useInteractions)([O,I]);p.useContextCallback("onNestedDialogOpen",e=>{k(e+1)}),p.useContextCallback("onNestedDialogClose",()=>{k(0)}),t.useEffect(()=>(g?.onNestedDialogOpen&&h&&g.onNestedDialogOpen(T),g?.onNestedDialogClose&&!h&&g.onNestedDialogClose(),()=>{g?.onNestedDialogClose&&h&&g.onNestedDialogClose()}),[h,g,T]);let M=t.useMemo(()=>A(E),[A,E]),L=t.useMemo(()=>N(E),[N,E]),j=t.useMemo(()=>P(),[P]);p.useSyncedValues({openMethod:x,activeTriggerProps:M,inactiveTriggerProps:L,popupProps:j,floatingRootContext:R,nestedOpenDialogCount:T})}])},628,69375,e=>{"use strict";var t=e.i(83921);e.i(47167);class n{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(void 0!==n&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}e.s(["PopupTriggerMap",0,n],69375);var r=e.i(24019),o=e.i(17514);let a=(0,t.createSelector)(e=>e.triggerIdProp??e.activeTriggerId),i={open:(0,t.createSelector)(e=>e.openProp??e.open),mounted:(0,t.createSelector)(e=>e.mounted),transitionStatus:(0,t.createSelector)(e=>e.transitionStatus),floatingRootContext:(0,t.createSelector)(e=>e.floatingRootContext),preventUnmountingOnClose:(0,t.createSelector)(e=>e.preventUnmountingOnClose),payload:(0,t.createSelector)(e=>e.payload),activeTriggerId:a,activeTriggerElement:(0,t.createSelector)(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:(0,t.createSelector)((e,t)=>void 0!==t&&a(e)===t),isOpenedByTrigger:(0,t.createSelector)((e,t)=>void 0!==t&&a(e)===t&&e.open),isMountedByTrigger:(0,t.createSelector)((e,t)=>void 0!==t&&a(e)===t&&e.mounted),triggerProps:(0,t.createSelector)((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:(0,t.createSelector)(e=>e.popupProps),popupElement:(0,t.createSelector)(e=>e.popupElement),positionerElement:(0,t.createSelector)(e=>e.positionerElement)};e.s(["createInitialPopupStoreState",0,function(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:"idle",floatingRootContext:new r.FloatingRootStore({open:!1,floatingElement:null,referenceElement:null,triggerElements:new n,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0}),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:o.EMPTY_OBJECT,inactiveTriggerProps:o.EMPTY_OBJECT,popupProps:o.EMPTY_OBJECT}},"popupStoreSelectors",0,i],628)},25547,2346,55057,49899,e=>{"use strict";var t,n=e.i(71645),r=e.i(30628),o=e.i(58509),a=e.i(32156),i=e.i(13104),s=e.i(83921),l=e.i(98263),u=e.i(628),c=e.i(69375);let d={...u.popupStoreSelectors,modal:(0,s.createSelector)(e=>e.modal),nested:(0,s.createSelector)(e=>e.nested),nestedOpenDialogCount:(0,s.createSelector)(e=>e.nestedOpenDialogCount),disablePointerDismissal:(0,s.createSelector)(e=>e.disablePointerDismissal),openMethod:(0,s.createSelector)(e=>e.openMethod),descriptionElementId:(0,s.createSelector)(e=>e.descriptionElementId),titleElementId:(0,s.createSelector)(e=>e.titleElementId),viewportElement:(0,s.createSelector)(e=>e.viewportElement),role:(0,s.createSelector)(e=>e.role)};class f extends l.ReactStore{constructor(e){super(function(e={}){return{...(0,u.createInitialPopupStoreState)(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}(e),{popupRef:n.createRef(),backdropRef:n.createRef(),internalBackdropRef:n.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new c.PopupTriggerMap,onOpenChange:void 0,onOpenChangeComplete:void 0},d)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},e||null!=t.trigger||null==this.state.activeTriggerId||(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;let n={open:e,nativeEvent:t.event,reason:t.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",n);let r={open:e},o=t.trigger?.id??null;(o||e)&&(r.activeTriggerId=o,r.activeTriggerElement=t.trigger??null),this.update(r)}}e.s(["DialogStore",0,f],2346);var p=e.i(18050);e.s(["DialogRoot",0,function(e){let{children:t,open:s,defaultOpen:l=!1,onOpenChange:u,onOpenChangeComplete:c,disablePointerDismissal:d=!1,modal:g=!0,actionsRef:m,handle:h,triggerId:v,defaultTriggerId:b=null}=e,y=(0,i.useDialogRootContext)(!0),x=!!y,E=(0,r.useRefWithInit)(()=>h?.store??new f({open:l,openProp:s,activeTriggerId:b,triggerIdProp:v,modal:g,disablePointerDismissal:d,nested:x})).current;(0,o.useOnFirstRender)(()=>{void 0===s&&!1===E.state.open&&!0===l&&E.update({open:!0,activeTriggerId:b})}),E.useControlledProp("openProp",s),E.useControlledProp("triggerIdProp",v),E.useSyncedValues({disablePointerDismissal:d,nested:x,modal:g}),E.useContextCallback("onOpenChange",u),E.useContextCallback("onOpenChangeComplete",c);let w=E.useState("payload");(0,a.useDialogRoot)({store:E,actionsRef:m,parentContext:y?.store.context,onOpenChange:u,triggerIdProp:v});let S=n.useMemo(()=>({store:E}),[E]);return(0,p.jsx)(i.DialogRootContext.Provider,{value:S,children:"function"==typeof t?t({payload:w}):t})}],25547),e.i(47167);var g=e.i(27601),m=e.i(83590),h=e.i(84759),v=e.i(77681);let b=((t={})[t.open=m.CommonPopupDataAttributes.open]="open",t[t.closed=m.CommonPopupDataAttributes.closed]="closed",t[t.startingStyle=m.CommonPopupDataAttributes.startingStyle]="startingStyle",t[t.endingStyle=m.CommonPopupDataAttributes.endingStyle]="endingStyle",t.nested="data-nested",t.nestedDialogOpen="data-nested-dialog-open",t),y={...m.popupStateMapping,...h.transitionStatusMapping,nested:e=>e?{[b.nested]:""}:null,nestedDialogOpen:e=>e?{[b.nestedDialogOpen]:""}:null},x=n.forwardRef(function(e,t){let{className:n,render:r,children:o,...a}=e,s=(0,v.useDialogPortalContext)(),{store:l}=(0,i.useDialogRootContext)(),u=l.useState("open"),c=l.useState("nested"),d=l.useState("transitionStatus"),f=l.useState("nestedOpenDialogCount"),p=l.useState("mounted");return(0,g.useRenderElement)("div",e,{enabled:s||p,state:{open:u,nested:c,transitionStatus:d,nestedDialogOpen:f>0},ref:[t,l.useStateSetter("viewportElement")],stateAttributesMapping:y,props:[{role:"presentation",hidden:!p,style:{pointerEvents:u?void 0:"none"},children:o},a]})});e.s(["DialogViewport",0,x],55057);var E=e.i(89879);let w=n.forwardRef(function(e,t){let{render:n,className:r,id:o,...a}=e,{store:s}=(0,i.useDialogRootContext)(),l=(0,E.useBaseUiId)(o);return s.useSyncedValueWithCleanup("titleElementId",l),(0,g.useRenderElement)("h2",e,{ref:t,props:[{id:l},a]})});e.s(["DialogTitle",0,w],49899)},4012,e=>{"use strict";var t=e.i(71645),n=e.i(47135),r=e.i(66745),o=e.i(17514),a=e.i(82033),i=e.i(47857),s=e.i(5963),l=e.i(3404);e.s(["useClick",0,function(e,u={}){let c="rootStore"in e?e.rootStore:e,d=c.context.dataRef,{enabled:f=!0,event:p="click",toggle:g=!0,ignoreMouse:m=!1,stickIfOpen:h=!0,touchOpenDelay:v=0,reason:b=l.REASONS.triggerPress}=u,y=t.useRef(void 0),x=(0,n.useAnimationFrame)(),E=(0,r.useTimeout)(),w=t.useMemo(()=>({onPointerDown(e){y.current=e.pointerType},onMouseDown(e){let t=y.current,n=e.nativeEvent,r=c.select("open");if(0!==e.button||"click"===p||(0,a.isMouseLikePointerType)(t,!0)&&m)return;let o=d.current.openEvent,l=o?.type,u=c.select("domReferenceElement")!==e.currentTarget,f=r&&u||!(r&&g&&(!o||!h||"click"===l||"mousedown"===l));if((0,i.isTypeableElement)(n.target)){let e=(0,s.createChangeEventDetails)(b,n,n.target);f&&"touch"===t&&v>0?E.start(v,()=>{c.setOpen(!0,e)}):c.setOpen(f,e);return}let w=e.currentTarget;x.request(()=>{let e=(0,s.createChangeEventDetails)(b,n,w);f&&"touch"===t&&v>0?E.start(v,()=>{c.setOpen(!0,e)}):c.setOpen(f,e)})},onClick(e){if("mousedown-only"===p)return;let t=y.current;if("mousedown"===p&&t){y.current=void 0;return}if((0,a.isMouseLikePointerType)(t,!0)&&m)return;let n=c.select("open"),r=d.current.openEvent,o=c.select("domReferenceElement")!==e.currentTarget,i=n&&o||!(n&&g&&(!r||!h||(0,a.isClickLikeEvent)(r))),l=(0,s.createChangeEventDetails)(b,e.nativeEvent,e.currentTarget);i&&"touch"===t&&v>0?E.start(v,()=>{c.setOpen(!0,l)}):c.setOpen(i,l)},onKeyDown(){y.current=void 0}}),[d,p,m,c,h,g,x,E,v,b]);return t.useMemo(()=>f?{reference:w}:o.EMPTY_OBJECT,[f,w])}])},72920,e=>{"use strict";e.i(75704);var t=e.i(59141),n=e.i(43444),r=e.i(39362),o=e.i(96918),a=e.i(38449),i=e.i(25547),s=e.i(55057),l=e.i(49899);e.i(47167);var u=e.i(67805),c=e.i(71645),d=e.i(13104),f=e.i(91730),p=e.i(27601),g=e.i(83590),m=e.i(7335),h=e.i(58642),v=e.i(89879),b=e.i(4012),y=e.i(89633);let x=c.forwardRef(function(e,t){let{render:n,className:r,disabled:o=!1,nativeButton:a=!0,id:i,payload:s,handle:l,...x}=e,E=(0,d.useDialogRootContext)(!0),w=l?.store??E?.store;if(!w)throw Error((0,u.default)(79));let S=(0,v.useBaseUiId)(i),C=w.useState("floatingRootContext"),R=w.useState("isOpenedByTrigger",S),T=c.useRef(null),{registerTrigger:k,isMountedByThisTrigger:D}=(0,h.useTriggerDataForwarding)(S,T,w,{payload:s}),{getButtonProps:O,buttonRef:I}=(0,f.useButton)({disabled:o,native:a}),A=(0,b.useClick)(C,{enabled:null!=C}),P=(0,y.useInteractions)([A]),N=w.useState("triggerProps",D);return(0,p.useRenderElement)("button",e,{state:{disabled:o,open:R},ref:[I,t,k,T],props:[P.getReferenceProps(),N,{[m.CLICK_TRIGGER_IDENTIFIER]:"",id:S},x,O],stateAttributesMapping:g.triggerOpenStateMapping})});var E=e.i(2346),w=e.i(5963),S=e.i(3404);class C{constructor(e){this.store=e??new E.DialogStore}open(e){let t=e?this.store.context.triggerElements.getById(e):void 0;this.store.setOpen(!0,(0,w.createChangeEventDetails)(S.REASONS.imperativeAction,void 0,t))}openWithPayload(e){this.store.set("payload",e),this.store.setOpen(!0,(0,w.createChangeEventDetails)(S.REASONS.imperativeAction,void 0,void 0))}close(){this.store.setOpen(!1,(0,w.createChangeEventDetails)(S.REASONS.imperativeAction,void 0,void 0))}get isOpen(){return this.store.state.open}}e.s(["Backdrop",()=>t.DialogBackdrop,"Close",()=>n.DialogClose,"Description",()=>r.DialogDescription,"Handle",0,C,"Popup",()=>o.DialogPopup,"Portal",()=>a.DialogPortal,"Root",()=>i.DialogRoot,"Title",()=>l.DialogTitle,"Trigger",0,x,"Viewport",()=>s.DialogViewport,"createHandle",0,function(){return new C}],87913);var R=e.i(87913);e.s(["Dialog",0,R],72920)},85902,e=>{"use strict";var t=e.i(18050);e.i(47167);var n=e.i(71645),r=e.i(91730),o=e.i(27601);let a=n.forwardRef(function(e,t){let{render:n,className:a,disabled:i=!1,focusableWhenDisabled:s=!1,nativeButton:l=!0,...u}=e,{getButtonProps:c,buttonRef:d}=(0,r.useButton)({disabled:i,focusableWhenDisabled:s,native:l});return(0,o.useRenderElement)("button",e,{state:{disabled:i},ref:[t,d],props:[u,c]})});var i=e.i(25913),s=e.i(52088);let l=(0,i.cva)("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-xs/relaxed font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-input/20 shadow-xs text-muted-foreground hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:bg-input/30 dark:text-muted-foreground dark:hover:bg-muted/50 dark:hover:text-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-7 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",xs:"h-5 gap-1 rounded-sm px-2 text-[0.625rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-2.5",sm:"h-6 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",lg:"h-8 gap-1 px-2.5 text-xs/relaxed has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-4",icon:"size-7 [&_svg:not([class*='size-'])]:size-3.5","icon-xs":"size-5 rounded-sm [&_svg:not([class*='size-'])]:size-2.5","icon-sm":"size-6 [&_svg:not([class*='size-'])]:size-3","icon-lg":"size-8 [&_svg:not([class*='size-'])]:size-4"}},defaultVariants:{variant:"default",size:"default"}});e.s(["Button",0,function({className:e,variant:n="default",size:r="default",...o}){return(0,t.jsx)(a,{"data-slot":"button",className:(0,s.cn)(l({variant:n,size:r,className:e})),...o})},"buttonVariants",0,l],85902)},41947,e=>{"use strict";let t=(0,e.i(75254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",0,t])},69068,e=>{"use strict";var t=e.i(18050),n=e.i(72920),r=e.i(52088),o=e.i(85902),a=e.i(41947),a=a;function i({...e}){return(0,t.jsx)(n.Dialog.Portal,{"data-slot":"dialog-portal",...e})}function s({className:e,...o}){return(0,t.jsx)(n.Dialog.Backdrop,{"data-slot":"dialog-overlay",className:(0,r.cn)("fixed inset-0 isolate z-50 bg-black/20 backdrop-blur-sm duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...o})}e.s(["Dialog",0,function({...e}){return(0,t.jsx)(n.Dialog.Root,{"data-slot":"dialog",...e})},"DialogClose",0,function({...e}){return(0,t.jsx)(n.Dialog.Close,{"data-slot":"dialog-close",...e})},"DialogContent",0,function({className:e,children:l,showCloseButton:u=!0,...c}){return(0,t.jsxs)(i,{children:[(0,t.jsx)(s,{}),(0,t.jsxs)(n.Dialog.Popup,{"data-slot":"dialog-content",className:(0,r.cn)("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-xs/relaxed text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...c,children:[l,u&&(0,t.jsxs)(n.Dialog.Close,{"data-slot":"dialog-close",render:(0,t.jsx)(o.Button,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[(0,t.jsx)(a.default,{}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})},"DialogDescription",0,function({className:e,...o}){return(0,t.jsx)(n.Dialog.Description,{"data-slot":"dialog-description",className:(0,r.cn)("text-xs/relaxed text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...o})},"DialogFooter",0,function({className:e,showCloseButton:a=!1,children:i,...s}){return(0,t.jsxs)("div",{"data-slot":"dialog-footer",className:(0,r.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...s,children:[i,a&&(0,t.jsx)(n.Dialog.Close,{render:(0,t.jsx)(o.Button,{variant:"outline"}),children:"Close"})]})},"DialogHeader",0,function({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"dialog-header",className:(0,r.cn)("flex flex-col gap-1",e),...n})},"DialogTitle",0,function({className:e,...o}){return(0,t.jsx)(n.Dialog.Title,{"data-slot":"dialog-title",className:(0,r.cn)("font-heading text-sm font-medium",e),...o})}],69068)},37727,e=>{"use strict";var t=e.i(41947);e.s(["X",()=>t.default])},68995,e=>{"use strict";var t=e.i(18050),n=e.i(71645),r=e.i(69068),o=e.i(85902),a=e.i(37727),i=e.i(52088);let s={sm:"sm:max-w-sm",md:"sm:max-w-md",lg:"sm:max-w-lg",xl:"sm:max-w-xl","2xl":"sm:max-w-2xl","4xl":"sm:max-w-4xl","6xl":"sm:max-w-6xl"};function l({open:e,onOpenChange:u,title:c,children:d,maxWidth:f="2xl",showCloseButton:p=!0,initialFocusEl:g,dismissOnEsc:m=!0,fullScreen:h=!1}){return(0,n.useEffect)(()=>{if(e&&g){let e=requestAnimationFrame(()=>{let e=g();e&&e.focus()});return()=>cancelAnimationFrame(e)}},[e,g]),(0,t.jsx)(r.Dialog,{open:e,onOpenChange:(e,t)=>{(e||m||"escape-key"!==t.reason)&&u({open:e})},modal:!0,children:(0,t.jsxs)(r.DialogContent,{showCloseButton:!1,className:(0,i.cn)("bg-background rounded-lg border border-border shadow-lg","gap-0 p-0",h?"w-[calc(100%-32px)] !max-w-[calc(100%-32px)] h-[calc(100vh-32px)] max-h-[calc(100vh-32px)] flex flex-col overflow-hidden":(0,i.cn)("max-h-[90vh] overflow-y-auto",s[f])),children:[(c||p)&&(0,t.jsxs)("div",{className:(0,i.cn)("flex items-center justify-between",h?"px-4 pt-4 pb-2":"px-6 pt-6 pb-2"),children:[c&&(0,t.jsx)(r.DialogTitle,{className:"text-lg font-semibold leading-none text-foreground",children:c}),p&&(0,t.jsx)(r.DialogClose,{render:(0,t.jsx)(o.Button,{variant:"ghost",size:"icon",className:"ml-auto text-muted-foreground hover:text-foreground"}),children:(0,t.jsx)(a.X,{className:"size-4"})})]}),(0,t.jsx)("div",{className:(0,i.cn)(h?"px-4 pb-4 pt-2 flex-1 min-h-0 flex flex-col":c||p?"px-6 pb-6 pt-2":"p-6"),children:d})]})})}e.s(["ConfirmDialog",0,function({open:e,onOpenChange:n,title:a,message:i,confirmLabel:s="Confirm",cancelLabel:u="Cancel",onConfirm:c,variant:d="default"}){return(0,t.jsx)(l,{open:e,onOpenChange:n,maxWidth:"md",showCloseButton:!1,children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold leading-none text-foreground",children:a}),(0,t.jsx)("div",{className:"text-sm text-muted-foreground whitespace-pre-line",children:i}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,t.jsx)(r.DialogClose,{render:(0,t.jsx)(o.Button,{variant:"outline",className:"cursor-pointer"}),children:u}),(0,t.jsx)(o.Button,{variant:"danger"===d?"destructive":"default",onClick:()=>{c(),n({open:!1})},className:"cursor-pointer",children:s})]})]})})},"Dialog",0,l])},44142,e=>{"use strict";var t=e.i(18050),n=e.i(71645),r=e.i(96085),o=e.i(70935);let a=(0,n.createContext)(null);e.s(["UpdateStatusProvider",0,function({children:e}){let[i,s]=(0,n.useState)(null);return(0,n.useEffect)(()=>{let e=!1;fetch((0,o.apiUrl)("/api/version")).then(e=>e.ok?e.json():null).then(t=>{!e&&t?.data&&s(t.data)}).catch(()=>{});let t=(0,r.io)((0,o.getServerUrl)(),{transports:["polling","websocket"]});return t.on("version:status",e=>s(e)),()=>{e=!0,t.disconnect()}},[]),(0,t.jsx)(a.Provider,{value:i,children:e})},"useUpdateStatus",0,function(){return(0,n.useContext)(a)}])}]);
12
+ )`}return(0,n.jsx)("div",{ref:t,role:"presentation","data-base-ui-inert":"",...a,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:r}})});e.s(["InternalBackdrop",0,r])},38449,e=>{"use strict";var t=e.i(71645),n=e.i(58130),r=e.i(37692),o=e.i(13104),a=e.i(77681),i=e.i(36893),s=e.i(18050);let l=t.forwardRef(function(e,t){let{keepMounted:l=!1,...u}=e,{store:c}=(0,o.useDialogRootContext)(),d=c.useState("mounted"),f=c.useState("modal"),p=c.useState("open");return d||l?(0,s.jsx)(a.DialogPortalContext.Provider,{value:l,children:(0,s.jsxs)(r.FloatingPortal,{ref:t,...u,children:[d&&!0===f&&(0,s.jsx)(i.InternalBackdrop,{ref:c.context.internalBackdropRef,inert:(0,n.inertValue)(!p)}),e.children]})}):null});e.s(["DialogPortal",0,l])},58509,e=>{"use strict";var t=e.i(71645);e.s(["useOnFirstRender",0,function(e){let n=t.useRef(!0);n.current&&(n.current=!1,e())}])},66196,e=>{"use strict";var t=e.i(29315),n=e.i(57666),r=e.i(90219),o=e.i(33848),a=e.i(977),i=e.i(66745),s=e.i(47135),l=e.i(17514);let u={},c={},d="";class f{lockCount=0;restore=null;timeoutLock=i.Timeout.create();timeoutUnlock=i.Timeout.create();acquire(e){return this.lockCount+=1,1===this.lockCount&&null===this.restore&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{this.lockCount-=1,0===this.lockCount&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{0===this.lockCount&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){let a,i,f,p,g;if(0===this.lockCount||null!==this.restore)return;let m=(0,r.ownerDocument)(e).documentElement,h=(0,o.ownerWindow)(m).getComputedStyle(m).overflowY;if("hidden"===h||"clip"===h){this.restore=l.NOOP;return}let v=n.isIOS||!function(e){if("u"<typeof document)return!1;let t=(0,r.ownerDocument)(e);return(0,o.ownerWindow)(t).innerWidth-t.documentElement.clientWidth>0}(e);this.restore=v?(i=(a=(0,r.ownerDocument)(e)).documentElement,f=a.body,g={overflowY:(p=(0,t.isOverflowElement)(i)?i:f).style.overflowY,overflowX:p.style.overflowX},Object.assign(p.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(p.style,g)}):function(e){let a=(0,r.ownerDocument)(e),i=a.documentElement,l=a.body,f=(0,o.ownerWindow)(i),p=0,g=0,m=!1,h=s.AnimationFrame.create();if(n.isWebKit&&(f.visualViewport?.scale??1)!==1)return()=>{};function v(){let n=f.getComputedStyle(i),o=f.getComputedStyle(l),a=(n.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";p=i.scrollTop,g=i.scrollLeft,u={scrollbarGutter:i.style.scrollbarGutter,overflowY:i.style.overflowY,overflowX:i.style.overflowX},d=i.style.scrollBehavior,c={position:l.style.position,height:l.style.height,width:l.style.width,boxSizing:l.style.boxSizing,overflowY:l.style.overflowY,overflowX:l.style.overflowX,scrollBehavior:l.style.scrollBehavior};let s=i.scrollHeight>i.clientHeight,h=i.scrollWidth>i.clientWidth,v="scroll"===n.overflowY||"scroll"===o.overflowY,b="scroll"===n.overflowX||"scroll"===o.overflowX,y=Math.max(0,f.innerWidth-l.clientWidth),x=Math.max(0,f.innerHeight-l.clientHeight),E=parseFloat(o.marginTop)+parseFloat(o.marginBottom),w=parseFloat(o.marginLeft)+parseFloat(o.marginRight),S=(0,t.isOverflowElement)(i)?i:l;if(m=function(e){if(!("u">typeof CSS&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||"u"<typeof document)return!1;let n=(0,r.ownerDocument)(e),o=n.documentElement,a=n.body,i=(0,t.isOverflowElement)(o)?o:a,s=i.style.overflowY,l=o.style.scrollbarGutter;o.style.scrollbarGutter="stable",i.style.overflowY="scroll";let u=i.offsetWidth;i.style.overflowY="hidden";let c=i.offsetWidth;return i.style.overflowY=s,o.style.scrollbarGutter=l,u===c}(e)){i.style.scrollbarGutter=a,S.style.overflowY="hidden",S.style.overflowX="hidden";return}Object.assign(i.style,{scrollbarGutter:a,overflowY:"hidden",overflowX:"hidden"}),(s||v)&&(i.style.overflowY="scroll"),(h||b)&&(i.style.overflowX="scroll"),Object.assign(l.style,{position:"relative",height:E||x?`calc(100dvh - ${E+x}px)`:"100dvh",width:w||y?`calc(100vw - ${w+y}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),l.scrollTop=p,l.scrollLeft=g,i.setAttribute("data-base-ui-scroll-locked",""),i.style.scrollBehavior="unset"}function b(){Object.assign(i.style,u),Object.assign(l.style,c),m||(i.scrollTop=p,i.scrollLeft=g,i.removeAttribute("data-base-ui-scroll-locked"),i.style.scrollBehavior=d)}function y(){b(),h.request(v)}return v(),f.addEventListener("resize",y),()=>{h.cancel(),b(),"function"==typeof f.removeEventListener&&f.removeEventListener("resize",y)}}(e)}}let p=new f;e.s(["useScrollLock",0,function(e=!0,t=null){(0,a.useIsoLayoutEffect)(()=>{if(e)return p.acquire(t)},[e,t])}])},55838,(e,t,n)=>{"use strict";var r=e.r(71645),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useState,i=r.useEffect,s=r.useLayoutEffect,l=r.useDebugValue;function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var c="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),o=r[0].inst,c=r[1];return s(function(){o.value=n,o.getSnapshot=t,u(o)&&c({inst:o})},[e,n,t]),i(function(){return u(o)&&c({inst:o}),e(function(){u(o)&&c({inst:o})})},[e]),l(n),n};n.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:c},2239,(e,t,n)=>{"use strict";t.exports=e.r(55838)},52822,(e,t,n)=>{"use strict";var r=e.r(71645),o=e.r(2239),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=o.useSyncExternalStore,s=r.useRef,l=r.useEffect,u=r.useMemo,c=r.useDebugValue;n.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var d=s(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;var p=i(e,(d=u(function(){function e(e){if(!l){if(l=!0,i=e,e=r(e),void 0!==o&&f.hasValue){var t=f.value;if(o(t,e))return s=t}return s=e}if(t=s,a(i,e))return t;var n=r(e);return void 0!==o&&o(t,n)?(i=e,t):(i=e,s=n)}var i,s,l=!1,u=void 0===n?null:n;return[function(){return e(t())},null===u?void 0:function(){return e(u())}]},[t,n,r,o]))[0],d[1]);return l(function(){f.hasValue=!0,f.value=p},[p]),c(p),p}},30224,(e,t,n)=>{"use strict";t.exports=e.r(52822)},33605,89633,26665,83921,3851,98263,24019,6157,e=>{"use strict";let t;var n=e.i(71645),r=e.i(29315),o=e.i(66745),a=e.i(76477),i=e.i(90219),s=e.i(47857),l=e.i(82033),u=e.i(87612),c=e.i(51665),d=e.i(5963),f=e.i(3404),p=e.i(32652);let g={intentional:"onClick",sloppy:"onPointerDown"};function m(){return!1}e.s(["useDismiss",0,function(e,t={}){let h="rootStore"in e?e.rootStore:e,v=h.useState("open"),b=h.useState("floatingElement"),{dataRef:y}=h.context,{enabled:x=!0,escapeKey:E=!0,outsidePress:w=!0,outsidePressEvent:S="sloppy",referencePress:C=m,referencePressEvent:R="sloppy",bubbles:T,externalTree:k}=t,D=(0,c.useFloatingTree)(k),O=(0,a.useStableCallback)("function"==typeof w?w:()=>!1),I="function"==typeof w?O:w,A=!1!==I,P=(0,a.useStableCallback)(()=>S),N=n.useRef(!1),M=n.useRef(!1),L=n.useRef(!1),{escapeKey:j,outsidePress:F}={escapeKey:"boolean"==typeof T?T:T?.escapeKey??!1,outsidePress:"boolean"==typeof T?T:T?.outsidePress??!0},B=n.useRef(null),W=(0,o.useTimeout)(),z=(0,o.useTimeout)(),_=(0,a.useStableCallback)(()=>{z.clear(),y.current.insideReactTree=!1}),V=n.useRef(!1),Y=n.useRef(""),H=(0,a.useStableCallback)(C),$=(0,a.useStableCallback)(e=>{if(!v||!x||!E||"Escape"!==e.key||V.current)return;let t=y.current.floatingContext?.nodeId,n=D?(0,u.getNodeChildren)(D.nodesRef.current,t):[];if(!j&&n.length>0){let e=!0;if(n.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__escapeKeyBubbles&&(e=!1)}),!e)return}let r=(0,l.isReactEvent)(e)?e.nativeEvent:e,o=(0,d.createChangeEventDetails)(f.REASONS.escapeKey,r);h.setOpen(!1,o),j||o.isPropagationAllowed||e.stopPropagation()}),U=(0,a.useStableCallback)(()=>{y.current.insideReactTree=!0,z.start(0,_)});n.useEffect(()=>{if(!v||!x)return;y.current.__escapeKeyBubbles=j,y.current.__outsidePressBubbles=F;let e=new o.Timeout,t=new o.Timeout;function n(){e.clear(),V.current=!0}function a(){e.start(5*!!(0,r.isWebKit)(),()=>{V.current=!1})}function l(){L.current=!0,t.start(0,()=>{L.current=!1})}function c(){N.current=!1,M.current=!1}function g(){let e=Y.current,t=P(),n="function"==typeof t?t():t;return"string"==typeof n?n:n["pen"!==e&&e?e:"mouse"]}function m(e){let t=y.current.floatingContext?.nodeId,n=D&&(0,u.getNodeChildren)(D.nodesRef.current,t).some(t=>(0,s.isEventTargetWithin)(e,t.context?.elements.floating));return(0,s.isEventTargetWithin)(e,h.select("floatingElement"))||(0,s.isEventTargetWithin)(e,h.select("domReferenceElement"))||n}function w(e){let n;if("intentional"===(n=g())&&"click"!==e.type||"sloppy"===n&&"click"===e.type||y.current.insideReactTree)return void _();let o=(0,s.getTarget)(e),a=`[${(0,p.createAttribute)("inert")}]`,l=Array.from((0,i.ownerDocument)(h.select("floatingElement")).querySelectorAll(a)),c=(0,r.isElement)(o)?o.getRootNode():null;(0,r.isShadowRoot)(c)&&(l=l.concat(Array.from(c.querySelectorAll(a))));let v=h.context.triggerElements;if(o&&(v.hasElement(o)||v.hasMatchingElement(e=>(0,s.contains)(e,o))))return;let b=(0,r.isElement)(o)?o:null;for(;b&&!(0,r.isLastTraversableNode)(b);){let e=(0,r.getParentNode)(b);if((0,r.isLastTraversableNode)(e)||!(0,r.isElement)(e))break;b=e}if(l.length&&(0,r.isElement)(o)&&!(0,s.isRootElement)(o)&&!(0,s.contains)(o,h.select("floatingElement"))&&l.every(e=>!(0,s.contains)(b,e)))return;if((0,r.isHTMLElement)(o)&&!("touches"in e)){let t=(0,r.isLastTraversableNode)(o),n=(0,r.getComputedStyle)(o),a=/auto|scroll/,i=t||a.test(n.overflowX),s=t||a.test(n.overflowY),l=i&&o.clientWidth>0&&o.scrollWidth>o.clientWidth,u=s&&o.clientHeight>0&&o.scrollHeight>o.clientHeight,c="rtl"===n.direction,d=u&&(c?e.offsetX<=o.offsetWidth-o.clientWidth:e.offsetX>o.clientWidth),f=l&&e.offsetY>o.clientHeight;if(d||f)return}if(m(e))return;if("intentional"===g()&&L.current){t.clear(),L.current=!1;return}if("function"==typeof I&&!I(e))return;let x=y.current.floatingContext?.nodeId,E=D?(0,u.getNodeChildren)(D.nodesRef.current,x):[];if(E.length>0){let e=!0;if(E.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__outsidePressBubbles&&(e=!1)}),!e)return}h.setOpen(!1,(0,d.createChangeEventDetails)(f.REASONS.outsidePress,e)),_()}function S(e){Y.current="touch";let t=(0,s.getTarget)(e);t?.addEventListener(e.type,function n(){!function(e){if("sloppy"!==g()||!h.select("open")||!x||(0,s.isEventTargetWithin)(e,h.select("floatingElement"))||(0,s.isEventTargetWithin)(e,h.select("domReferenceElement")))return;let t=e.touches[0];t&&(B.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},W.start(1e3,()=>{B.current&&(B.current.dismissOnTouchEnd=!1,B.current.dismissOnMouseDown=!1)}))}(e),t?.removeEventListener(e.type,n)})}function C(e){if(W.clear(),"pointerdown"===e.type&&(Y.current=e.pointerType),"mousedown"===e.type&&B.current&&!B.current.dismissOnMouseDown)return;let t=(0,s.getTarget)(e);t?.addEventListener(e.type,function n(){if("pointerdown"===e.type)"sloppy"!==g()||"touch"===e.pointerType||!h.select("open")||!x||(0,s.isEventTargetWithin)(e,h.select("floatingElement"))||(0,s.isEventTargetWithin)(e,h.select("domReferenceElement"))||w(e);else w(e);t?.removeEventListener(e.type,n)})}function R(e){if(!N.current)return;let n=M.current;if(c(),"intentional"===g()){if("pointercancel"===e.type){n&&l();return}m(e)||(n?l():("function"!=typeof I||I(e))&&(t.clear(),L.current=!0,_()))}}function T(e){let t=(0,s.getTarget)(e);t?.addEventListener(e.type,function n(){!function(e){if("sloppy"!==g()||!B.current||(0,s.isEventTargetWithin)(e,h.select("floatingElement"))||(0,s.isEventTargetWithin)(e,h.select("domReferenceElement")))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-B.current.startX),r=Math.abs(t.clientY-B.current.startY),o=Math.sqrt(n*n+r*r);o>5&&(B.current.dismissOnTouchEnd=!0),o>10&&(w(e),W.clear(),B.current=null)}(e),t?.removeEventListener(e.type,n)})}function k(e){let t=(0,s.getTarget)(e);t?.addEventListener(e.type,function n(){"sloppy"!==g()||!B.current||(0,s.isEventTargetWithin)(e,h.select("floatingElement"))||(0,s.isEventTargetWithin)(e,h.select("domReferenceElement"))||(B.current.dismissOnTouchEnd&&w(e),W.clear(),B.current=null),t?.removeEventListener(e.type,n)})}let O=(0,i.ownerDocument)(b);return E&&(O.addEventListener("keydown",$),O.addEventListener("compositionstart",n),O.addEventListener("compositionend",a)),A&&(O.addEventListener("click",C,!0),O.addEventListener("pointerdown",C,!0),O.addEventListener("pointerup",R,!0),O.addEventListener("pointercancel",R,!0),O.addEventListener("mousedown",C,!0),O.addEventListener("mouseup",R,!0),O.addEventListener("touchstart",S,!0),O.addEventListener("touchmove",T,!0),O.addEventListener("touchend",k,!0)),()=>{E&&(O.removeEventListener("keydown",$),O.removeEventListener("compositionstart",n),O.removeEventListener("compositionend",a)),A&&(O.removeEventListener("click",C,!0),O.removeEventListener("pointerdown",C,!0),O.removeEventListener("pointerup",R,!0),O.removeEventListener("pointercancel",R,!0),O.removeEventListener("mousedown",C,!0),O.removeEventListener("mouseup",R,!0),O.removeEventListener("touchstart",S,!0),O.removeEventListener("touchmove",T,!0),O.removeEventListener("touchend",k,!0)),e.clear(),t.clear(),c(),L.current=!1}},[y,b,E,A,I,v,x,j,F,$,_,P,D,h,W]),n.useEffect(_,[I,_]);let K=n.useMemo(()=>({onKeyDown:$,[g[R]]:e=>{H()&&h.setOpen(!1,(0,d.createChangeEventDetails)(f.REASONS.triggerPress,e.nativeEvent))},..."intentional"!==R&&{onClick(e){H()&&h.setOpen(!1,(0,d.createChangeEventDetails)(f.REASONS.triggerPress,e.nativeEvent))}}}),[$,h,R,H]),q=(0,a.useStableCallback)(e=>{if(!v||!x||0!==e.button)return;let t=(0,s.getTarget)(e.nativeEvent);(0,s.contains)(h.select("floatingElement"),t)&&(N.current||(N.current=!0,M.current=!1))}),X=(0,a.useStableCallback)(e=>{!v||!x||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&N.current&&(M.current=!0)}),G=n.useMemo(()=>({onKeyDown:$,onPointerDown:X,onMouseDown:X,onClickCapture:U,onMouseDownCapture(e){U(),q(e)},onPointerDownCapture(e){U(),q(e)},onMouseUpCapture:U,onTouchEndCapture:U,onTouchMoveCapture:U}),[$,U,q,X]);return n.useMemo(()=>x?{reference:K,floating:G,trigger:K}:{},[x,K,G])}],33605);var h=e.i(494);function v(e,t,n){let r=new Map,o="item"===n,a={};for(let t in"floating"===n&&(a.tabIndex=-1,a[h.FOCUSABLE_ATTRIBUTE]=""),e)o&&e&&(t===h.ACTIVE_KEY||t===h.SELECTED_KEY)||(a[t]=e[t]);for(let i=0;i<t.length;i+=1){let s,l=t[i]?.[n];(s="function"==typeof l?e?l(e):null:l)&&b(a,s,o,r)}return b(a,e,o,r),a}function b(e,t,n,r){for(let o in t){let a=t[o];n&&(o===h.ACTIVE_KEY||o===h.SELECTED_KEY)||(o.startsWith("on")?(r.has(o)||r.set(o,[]),"function"==typeof a&&(r.get(o)?.push(a),e[o]=(...e)=>r.get(o)?.map(t=>t(...e)).find(e=>void 0!==e))):e[o]=a)}}e.s(["useInteractions",0,function(e=[]){let t=e.map(e=>e?.reference),r=e.map(e=>e?.floating),o=e.map(e=>e?.item),a=e.map(e=>e?.trigger),i=n.useCallback(t=>v(t,e,"reference"),t),s=n.useCallback(t=>v(t,e,"floating"),r),l=n.useCallback(t=>v(t,e,"item"),o),u=n.useCallback(t=>v(t,e,"trigger"),a);return n.useMemo(()=>({getReferenceProps:i,getFloatingProps:s,getItemProps:l,getTriggerProps:u}),[i,s,l,u])}],89633);var y=e.i(83799),x=e.i(17514);let E=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);e.s(["useRole",0,function(e,t={}){let r="rootStore"in e?e.rootStore:e,o=r.useState("open"),a=r.useState("floatingId"),i=r.useState("domReferenceElement"),l=r.useState("floatingElement"),{role:u="dialog"}=t,d=(0,y.useId)(),f=i?.id||d,p=n.useMemo(()=>(0,s.getFloatingFocusElement)(l)?.id||a,[l,a]),g=E.get(u)??u,m=null!=(0,c.useFloatingParentNodeId)(),h=n.useMemo(()=>"tooltip"===g||"label"===u?x.EMPTY_OBJECT:{"aria-haspopup":"alertdialog"===g?"dialog":g,"aria-expanded":"false",..."listbox"===g&&{role:"combobox"},..."menu"===g&&m&&{role:"menuitem"},..."select"===u&&{"aria-autocomplete":"none"},..."combobox"===u&&{"aria-autocomplete":"list"}},[g,m,u]),v=n.useMemo(()=>"tooltip"===g||"label"===u?{[`aria-${"label"===u?"labelledby":"describedby"}`]:o?p:void 0}:{...h,"aria-expanded":o?"true":"false","aria-controls":o?p:void 0,..."menu"===g&&{id:f}},[g,p,o,f,u,h]),b=n.useMemo(()=>{let e={id:p,...g&&{role:g}};return"tooltip"===g||"label"===u?e:{...e,..."menu"===g&&{"aria-labelledby":f}}},[g,p,f,u]),w=n.useCallback(({active:e,selected:t})=>{let n={role:"option",...e&&{id:`${p}-fui-option`}};switch(u){case"select":case"combobox":return{...n,"aria-selected":t}}return{}},[p,u]);return n.useMemo(()=>({reference:v,floating:b,item:w,trigger:h}),[v,b,h,w])}],26665);var w=e.i(30628),S=e.i(977);e.i(47167);var C=e.i(67805),R=Symbol("NOT_FOUND"),T=e=>Array.isArray(e)?e:[e],k=0,D=class{revision=k;_value;_lastValue;_isEqual=O;constructor(e,t=O){this._value=this._lastValue=e,this._isEqual=t}get value(){return this._value}set value(e){this.value!==e&&(this._value=e,this.revision=++k)}};function O(e,t){return e===t}function I(e){return e instanceof D||console.warn("Not a valid cell! ",e),e.value}var A=(e,t)=>!1;function P(){return function(e=O){return new D(null,e)}(A)}var N=e=>{let t=e.collectionTag;null===t&&(t=e.collectionTag=P()),I(t)};Symbol();var M=0,L=Object.getPrototypeOf({}),j=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy(this,F);tag=P();tags={};children={};collectionTag=null;id=M++},F={get:(e,t)=>(function(){let{value:n}=e,r=Reflect.get(n,t);if("symbol"==typeof t||t in L)return r;if("object"==typeof r&&null!==r){var o;let n=e.children[t];return void 0===n&&(n=e.children[t]=Array.isArray(o=r)?new B(o):new j(o)),n.tag&&I(n.tag),n.proxy}{let n=e.tags[t];return void 0===n&&((n=e.tags[t]=P()).value=r),I(n),r}})(),ownKeys:e=>(N(e),Reflect.ownKeys(e.value)),getOwnPropertyDescriptor:(e,t)=>Reflect.getOwnPropertyDescriptor(e.value,t),has:(e,t)=>Reflect.has(e.value,t)},B=class{constructor(e){this.value=e,this.value=e,this.tag.value=e}proxy=new Proxy([this],W);tag=P();tags={};children={};collectionTag=null;id=M++},W={get:([e],t)=>("length"===t&&N(e),F.get(e,t)),ownKeys:([e])=>F.ownKeys(e),getOwnPropertyDescriptor:([e],t)=>F.getOwnPropertyDescriptor(e,t),has:([e],t)=>F.has(e,t)},z=(e,t)=>e===t,_="u">typeof WeakRef?WeakRef:class{constructor(e){this.value=e}deref(){return this.value}};function V(){return{s:0,v:void 0,o:null,p:null}}function Y(e,t={}){let n,r=V(),{resultEqualityCheck:o}=t,a=0;function i(){let t,i=r,{length:s}=arguments;for(let e=0;e<s;e++){let t=arguments[e];if("function"==typeof t||"object"==typeof t&&null!==t){let e=i.o;null===e&&(i.o=e=new WeakMap);let n=e.get(t);void 0===n?(i=V(),e.set(t,i)):i=n}else{let e=i.p;null===e&&(i.p=e=new Map);let n=e.get(t);void 0===n?(i=V(),e.set(t,i)):i=n}}let l=i;if(1===i.s)t=i.v;else if(t=e.apply(null,arguments),a++,o){let e=n?.deref?.()??n;null!=e&&o(e,t)&&(t=e,0!==a&&a--),n="object"==typeof t&&null!==t||"function"==typeof t?new _(t):t}return l.s=1,l.v=t,t}return i.clearCache=()=>{r=V(),i.resetResultsCount()},i.resultsCount=()=>a,i.resetResultsCount=()=>{a=0},i}function H(e,...t){let n="function"==typeof e?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t,r,o=0,a=0,i={},s=e.pop();"object"==typeof s&&(i=s,s=e.pop()),function(e,t=`expected a function, instead received ${typeof e}`){if("function"!=typeof e)throw TypeError(t)}(s,`createSelector expects an output function after the inputs, but received: [${typeof s}]`);let{memoize:l,memoizeOptions:u=[],argsMemoize:c=Y,argsMemoizeOptions:d=[],devModeChecks:f={}}={...n,...i},p=T(u),g=T(d),m=(!function(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(e=>"function"==typeof e)){let n=e.map(e=>"function"==typeof e?`function ${e.name||"unnamed"}()`:typeof e).join(", ");throw TypeError(`${t}[${n}]`)}}(t=Array.isArray(e[0])?e[0]:e,"createSelector expects all input-selectors to be functions, but received the following types: "),t),h=l(function(){return o++,s.apply(null,arguments)},...p);return Object.assign(c(function(){a++;let e=function(e,t){let n=[],{length:r}=e;for(let o=0;o<r;o++)n.push(e[o].apply(null,t));return n}(m,arguments);return r=h.apply(null,e)},...g),{resultFunc:s,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>r,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:l,argsMemoize:c})};return Object.assign(r,{withTypes:()=>r}),r}var $=H(Y),U=Object.assign((e,t=$)=>{!function(e,t=`expected an object, instead received ${typeof e}`){if("object"!=typeof e)throw TypeError(t)}(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>U});H({memoize:function(e,t){let n,{equalityCheck:r=z,maxSize:o=1,resultEqualityCheck:a}="object"==typeof t?t:{equalityCheck:t},i=function(e,t){if(null===e||null===t||e.length!==t.length)return!1;let{length:n}=e;for(let o=0;o<n;o++)if(!r(e[o],t[o]))return!1;return!0},s=0,l=o<=1?{get:e=>n&&i(n.key,e)?n.value:R,put(e,t){n={key:e,value:t}},getEntries:()=>n?[n]:[],clear(){n=void 0}}:function(e,t){let n=[];function r(e){let r=n.findIndex(n=>t(e,n.key));if(r>-1){let e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return R}return{get:r,put:function(t,o){r(t)===R&&(n.unshift({key:t,value:o}),n.length>e&&n.pop())},getEntries:function(){return n},clear:function(){n=[]}}}(o,i);function u(){let t=l.get(arguments);if(t===R){if(t=e.apply(null,arguments),s++,a){let e=l.getEntries().find(e=>a(e.value,t));e&&(t=e.value,0!==s&&s--)}l.put(arguments,t)}return t}return u.clearCache=()=>{l.clear(),u.resetResultsCount()},u.resultsCount=()=>s,u.resetResultsCount=()=>{s=0},u},memoizeOptions:{maxSize:1,equalityCheck:Object.is}});let K=(e,t,n,r,o,a,...i)=>{let s;if(i.length>0)throw Error((0,C.default)(1));if(e&&t&&n&&r&&o&&a)s=(i,s,l,u)=>a(e(i,s,l,u),t(i,s,l,u),n(i,s,l,u),r(i,s,l,u),o(i,s,l,u),s,l,u);else if(e&&t&&n&&r&&o)s=(a,i,s,l)=>o(e(a,i,s,l),t(a,i,s,l),n(a,i,s,l),r(a,i,s,l),i,s,l);else if(e&&t&&n&&r)s=(o,a,i,s)=>r(e(o,a,i,s),t(o,a,i,s),n(o,a,i,s),a,i,s);else if(e&&t&&n)s=(r,o,a,i)=>n(e(r,o,a,i),t(r,o,a,i),o,a,i);else if(e&&t)s=(n,r,o,a)=>t(e(n,r,o,a),r,o,a);else if(e)s=e;else throw Error("Missing arguments");return s};e.s(["createSelector",0,K],83921);var q=e.i(2239),X=e.i(30224),G=e.i(35423);let J=[];function Q(){return t}function Z(e){J.push(e)}function ee(e){let n=(n,r)=>{let o,a=(0,w.useRefWithInit)(et).current;try{for(let e of(t=a,J))e.before(a);for(let t of(o=e(n,r),J))t.after(a);a.didInitialize=!0}finally{t=void 0}return o};return n.displayName=e.displayName||e.name,n}function et(){return{didInitialize:!1}}e.s(["fastComponent",0,ee,"fastComponentRef",0,function(e){return n.forwardRef(ee(e))},"getInstance",0,Q,"register",0,Z],3851);let en=(0,G.isReactVersionAtLeast)(19)?function(e,t,r,o,a){let i,s=Q();if(!s){let i;return i=n.useCallback(()=>t(e.getSnapshot(),r,o,a),[e,t,r,o,a]),(0,q.useSyncExternalStore)(e.subscribe,i,i)}let l=s.syncIndex;return s.syncIndex+=1,s.didInitialize?(i=s.syncHooks[l]).store===e&&i.selector===t&&Object.is(i.a1,r)&&Object.is(i.a2,o)&&Object.is(i.a3,a)||(i.store!==e&&(s.didChangeStore=!0),i.store=e,i.selector=t,i.a1=r,i.a2=o,i.a3=a,i.didChange=!0):(i={store:e,selector:t,a1:r,a2:o,a3:a,value:t(e.getSnapshot(),r,o,a),didChange:!1},s.syncHooks.push(i)),i.value}:function(e,t,n,r,o){return(0,X.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,o))};Z({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],o=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,o))&&(t=!0,r.value=o,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,q.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});class er{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t]))return void this.setState({...this.state,...e})}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return en(this,e,t,n,r)}}class eo extends er{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){n.useDebugValue(e),(0,S.useIsoLayoutEffect)(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let n=this;(0,S.useIsoLayoutEffect)(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this,n=Object.values(e);(0,S.useIsoLayoutEffect)(()=>{t.update(e)},[t,...n])}useControlledProp(e,t){n.useDebugValue(e);let r=void 0!==t;(0,S.useIsoLayoutEffect)(()=>{r&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,r])}select(e,t,n,r){return(0,this.selectors[e])(this.state,t,n,r)}useState(e,t,r,o){return n.useDebugValue(e),en(this,this.selectors[e],t,r,o)}useContextCallback(e,t){n.useDebugValue(e);let r=(0,a.useStableCallback)(t??x.NOOP);this.context[e]=r}useStateSetter(e){let t=n.useRef(void 0);return void 0===t.current&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n,r=(n="function"==typeof e?e:this.selectors[e])(this.state);return t(r,r,this),this.subscribe(e=>{let o=n(e);if(!Object.is(r,o)){let e=r;r=o,t(o,e,this)}})}}e.s(["ReactStore",0,eo],98263);var ea=e.i(16385);let ei={open:K(e=>e.open),domReferenceElement:K(e=>e.domReferenceElement),referenceElement:K(e=>e.positionReference??e.referenceElement),floatingElement:K(e=>e.floatingElement),floatingId:K(e=>e.floatingId)};class es extends eo{constructor(e){const{nested:t,noEmit:n,onOpenChange:r,triggerElements:o,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:(0,ea.createEventEmitter)(),nested:t,noEmit:n,triggerElements:o},ei)}setOpen=(e,t)=>{if((!e||!this.state.open||(0,l.isClickLikeEvent)(t.event))&&(this.context.dataRef.current.openEvent=e?t.event:void 0),!this.context.noEmit){let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit("openchange",n)}this.context.onOpenChange?.(e,t)}}e.s(["FloatingRootStore",0,es],24019),e.s(["useSyncedFloatingRootContext",0,function(e){let{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:o=!1,onOpenChange:a}=e,i=(0,y.useId)(),s=null!=(0,c.useFloatingParentNodeId)(),l=t.useState("open"),u=t.useState("activeTriggerElement"),d=t.useState(o?"popupElement":"positionerElement"),f=t.context.triggerElements,p=(0,w.useRefWithInit)(()=>new es({open:l,referenceElement:u,floatingElement:d,triggerElements:f,onOpenChange:a,floatingId:i,nested:s,noEmit:n})).current;return(0,S.useIsoLayoutEffect)(()=>{let e={open:l,floatingId:i,referenceElement:u,floatingElement:d};(0,r.isElement)(u)&&(e.domReferenceElement=u),p.state.positionReference===p.state.referenceElement&&(e.positionReference=u),p.update(e)},[l,i,u,d,p]),p.context.onOpenChange=a,p.context.nested=s,p.context.noEmit=n,p}],6157)},50091,e=>{"use strict";var t=e.i(71645),n=e.i(76477),r=e.i(57666),o=e.i(977);e.s(["useOpenInteractionType",0,function(e){let a,i,s,l,[u,c]=t.useState(null),d=(0,n.useStableCallback)((t,n)=>{e||c(n||(r.isIOS?"touch":""))});a=t.useRef(e),i=(0,n.useStableCallback)(t=>{t&&!e&&c(null)}),(0,o.useIsoLayoutEffect)(()=>{a.current!==e&&i(a.current)},[e,i]),(0,o.useIsoLayoutEffect)(()=>{a.current=e},[e]);let{onClick:f,onPointerDown:p}=(s=t.useRef(""),l=t.useCallback(e=>{e.defaultPrevented||(s.current=e.pointerType,d(e,e.pointerType))},[d]),{onClick:t.useCallback(e=>{0===e.detail?d(e,"keyboard"):(d(e,"pointerType"in e?e.pointerType:s.current),s.current="")},[d]),onPointerDown:l});return t.useMemo(()=>({openMethod:u,triggerProps:{onClick:f,onPointerDown:p}}),[u,f,p])}],50091)},88841,e=>{"use strict";var t=e.i(71645),n=e.i(977),r=e.i(47135);e.s(["useTransitionStatus",0,function(e,o=!1,a=!1){let[i,s]=t.useState(e&&o?"idle":void 0),[l,u]=t.useState(e);return e&&!l&&(u(!0),s("starting")),e||!l||"ending"===i||a||s("ending"),e||l||"ending"!==i||s(void 0),(0,n.useIsoLayoutEffect)(()=>{if(!e&&l&&"ending"!==i&&a){let e=r.AnimationFrame.request(()=>{s("ending")});return()=>{r.AnimationFrame.cancel(e)}}},[e,l,i,a]),(0,n.useIsoLayoutEffect)(()=>{if(!e||o)return;let t=r.AnimationFrame.request(()=>{s(void 0)});return()=>{r.AnimationFrame.cancel(t)}},[o,e]),(0,n.useIsoLayoutEffect)(()=>{if(!e||!o)return;e&&l&&"idle"!==i&&s("starting");let t=r.AnimationFrame.request(()=>{s("idle")});return()=>{r.AnimationFrame.cancel(t)}},[o,e,l,s,i]),t.useMemo(()=>({mounted:l,setMounted:u,transitionStatus:i}),[l,i])}])},58642,e=>{"use strict";var t=e.i(71645),n=e.i(76477),r=e.i(977),o=e.i(88841),a=e.i(89269);function i(e,n){let r=t.useRef(null),o=t.useRef(null);return t.useCallback(t=>{if(void 0!==e){if(null!==r.current){let e=r.current,t=o.current,a=n.context.triggerElements.getById(e);t&&a===t&&n.context.triggerElements.delete(e),r.current=null,o.current=null}null!==t&&(r.current=e,o.current=t,n.context.triggerElements.add(e,t))}},[n,e])}e.s(["useImplicitActiveTrigger",0,function(e){let t=e.useState("open");(0,r.useIsoLayoutEffect)(()=>{if(t&&!e.select("activeTriggerId")&&1===e.context.triggerElements.size){let t=e.context.triggerElements.entries().next();if(!t.done){let[n,r]=t.value;e.update({activeTriggerId:n,activeTriggerElement:r})}}},[t,e])},"useOpenStateTransitions",0,function(e,t,r){let{mounted:i,setMounted:s,transitionStatus:l}=(0,o.useTransitionStatus)(e);t.useSyncedValues({mounted:i,transitionStatus:l});let u=(0,n.useStableCallback)(()=>{s(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),r?.(),t.context.onOpenChangeComplete?.(!1)}),c=t.useState("preventUnmountingOnClose");return(0,a.useOpenChangeComplete)({enabled:!c,open:e,ref:t.context.popupRef,onComplete(){e||u()}}),{forceUnmount:u,transitionStatus:l}},"useTriggerDataForwarding",0,function(e,t,o,a){let s=o.useState("isMountedByTrigger",e),l=i(e,o),u=(0,n.useStableCallback)(t=>{if(l(t),!t||!o.select("open"))return;let n=o.select("activeTriggerId");n===e?o.update({activeTriggerElement:t,...a}):null==n&&o.update({activeTriggerId:e,activeTriggerElement:t,...a})});return(0,r.useIsoLayoutEffect)(()=>{s&&o.update({activeTriggerElement:t.current,...a})},[s,o,t,...Object.values(a)]),{registerTrigger:u,isMountedByThisTrigger:s}},"useTriggerRegistration",0,i])},32156,e=>{"use strict";var t=e.i(71645),n=e.i(76477),r=e.i(66196),o=e.i(33605),a=e.i(89633),i=e.i(26665),s=e.i(6157),l=e.i(47857),u=e.i(50091),c=e.i(5963),d=e.i(3404),f=e.i(58642);e.s(["useDialogRoot",0,function(e){let{store:p,parentContext:g,actionsRef:m}=e,h=p.useState("open"),v=p.useState("disablePointerDismissal"),b=p.useState("modal"),y=p.useState("popupElement"),{openMethod:x,triggerProps:E}=(0,u.useOpenInteractionType)(h);(0,f.useImplicitActiveTrigger)(p);let{forceUnmount:w}=(0,f.useOpenStateTransitions)(h,p),S=(0,n.useStableCallback)(e=>{let t=(0,c.createChangeEventDetails)(e);return t.preventUnmountOnClose=()=>{p.set("preventUnmountingOnClose",!0)},t}),C=t.useCallback(()=>{p.setOpen(!1,S(d.REASONS.imperativeAction))},[p,S]);t.useImperativeHandle(m,()=>({unmount:w,close:C}),[w,C]);let R=(0,s.useSyncedFloatingRootContext)({popupStore:p,onOpenChange:p.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[T,k]=t.useState(0),D=0===T,O=(0,i.useRole)(R),I=(0,o.useDismiss)(R,{outsidePressEvent:()=>p.context.internalBackdropRef.current||p.context.backdropRef.current?"intentional":{mouse:"trap-focus"===b?"sloppy":"intentional",touch:"sloppy"},outsidePress(e){if(!p.context.outsidePressEnabledRef.current||"button"in e&&0!==e.button||"touches"in e&&1!==e.touches.length)return!1;let t=(0,l.getTarget)(e);return!!D&&!v&&(!b||!p.context.internalBackdropRef.current&&!p.context.backdropRef.current||p.context.internalBackdropRef.current===t||p.context.backdropRef.current===t||(0,l.contains)(t,y)&&!t?.hasAttribute("data-base-ui-portal"))},escapeKey:D});(0,r.useScrollLock)(h&&!0===b,y);let{getReferenceProps:A,getFloatingProps:P,getTriggerProps:N}=(0,a.useInteractions)([O,I]);p.useContextCallback("onNestedDialogOpen",e=>{k(e+1)}),p.useContextCallback("onNestedDialogClose",()=>{k(0)}),t.useEffect(()=>(g?.onNestedDialogOpen&&h&&g.onNestedDialogOpen(T),g?.onNestedDialogClose&&!h&&g.onNestedDialogClose(),()=>{g?.onNestedDialogClose&&h&&g.onNestedDialogClose()}),[h,g,T]);let M=t.useMemo(()=>A(E),[A,E]),L=t.useMemo(()=>N(E),[N,E]),j=t.useMemo(()=>P(),[P]);p.useSyncedValues({openMethod:x,activeTriggerProps:M,inactiveTriggerProps:L,popupProps:j,floatingRootContext:R,nestedOpenDialogCount:T})}])},628,69375,e=>{"use strict";var t=e.i(83921);e.i(47167);class n{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(void 0!==n&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}e.s(["PopupTriggerMap",0,n],69375);var r=e.i(24019),o=e.i(17514);let a=(0,t.createSelector)(e=>e.triggerIdProp??e.activeTriggerId),i={open:(0,t.createSelector)(e=>e.openProp??e.open),mounted:(0,t.createSelector)(e=>e.mounted),transitionStatus:(0,t.createSelector)(e=>e.transitionStatus),floatingRootContext:(0,t.createSelector)(e=>e.floatingRootContext),preventUnmountingOnClose:(0,t.createSelector)(e=>e.preventUnmountingOnClose),payload:(0,t.createSelector)(e=>e.payload),activeTriggerId:a,activeTriggerElement:(0,t.createSelector)(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:(0,t.createSelector)((e,t)=>void 0!==t&&a(e)===t),isOpenedByTrigger:(0,t.createSelector)((e,t)=>void 0!==t&&a(e)===t&&e.open),isMountedByTrigger:(0,t.createSelector)((e,t)=>void 0!==t&&a(e)===t&&e.mounted),triggerProps:(0,t.createSelector)((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:(0,t.createSelector)(e=>e.popupProps),popupElement:(0,t.createSelector)(e=>e.popupElement),positionerElement:(0,t.createSelector)(e=>e.positionerElement)};e.s(["createInitialPopupStoreState",0,function(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:"idle",floatingRootContext:new r.FloatingRootStore({open:!1,floatingElement:null,referenceElement:null,triggerElements:new n,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0}),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:o.EMPTY_OBJECT,inactiveTriggerProps:o.EMPTY_OBJECT,popupProps:o.EMPTY_OBJECT}},"popupStoreSelectors",0,i],628)},25547,2346,55057,49899,e=>{"use strict";var t,n=e.i(71645),r=e.i(30628),o=e.i(58509),a=e.i(32156),i=e.i(13104),s=e.i(83921),l=e.i(98263),u=e.i(628),c=e.i(69375);let d={...u.popupStoreSelectors,modal:(0,s.createSelector)(e=>e.modal),nested:(0,s.createSelector)(e=>e.nested),nestedOpenDialogCount:(0,s.createSelector)(e=>e.nestedOpenDialogCount),disablePointerDismissal:(0,s.createSelector)(e=>e.disablePointerDismissal),openMethod:(0,s.createSelector)(e=>e.openMethod),descriptionElementId:(0,s.createSelector)(e=>e.descriptionElementId),titleElementId:(0,s.createSelector)(e=>e.titleElementId),viewportElement:(0,s.createSelector)(e=>e.viewportElement),role:(0,s.createSelector)(e=>e.role)};class f extends l.ReactStore{constructor(e){super(function(e={}){return{...(0,u.createInitialPopupStoreState)(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}(e),{popupRef:n.createRef(),backdropRef:n.createRef(),internalBackdropRef:n.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new c.PopupTriggerMap,onOpenChange:void 0,onOpenChangeComplete:void 0},d)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},e||null!=t.trigger||null==this.state.activeTriggerId||(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;let n={open:e,nativeEvent:t.event,reason:t.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",n);let r={open:e},o=t.trigger?.id??null;(o||e)&&(r.activeTriggerId=o,r.activeTriggerElement=t.trigger??null),this.update(r)}}e.s(["DialogStore",0,f],2346);var p=e.i(18050);e.s(["DialogRoot",0,function(e){let{children:t,open:s,defaultOpen:l=!1,onOpenChange:u,onOpenChangeComplete:c,disablePointerDismissal:d=!1,modal:g=!0,actionsRef:m,handle:h,triggerId:v,defaultTriggerId:b=null}=e,y=(0,i.useDialogRootContext)(!0),x=!!y,E=(0,r.useRefWithInit)(()=>h?.store??new f({open:l,openProp:s,activeTriggerId:b,triggerIdProp:v,modal:g,disablePointerDismissal:d,nested:x})).current;(0,o.useOnFirstRender)(()=>{void 0===s&&!1===E.state.open&&!0===l&&E.update({open:!0,activeTriggerId:b})}),E.useControlledProp("openProp",s),E.useControlledProp("triggerIdProp",v),E.useSyncedValues({disablePointerDismissal:d,nested:x,modal:g}),E.useContextCallback("onOpenChange",u),E.useContextCallback("onOpenChangeComplete",c);let w=E.useState("payload");(0,a.useDialogRoot)({store:E,actionsRef:m,parentContext:y?.store.context,onOpenChange:u,triggerIdProp:v});let S=n.useMemo(()=>({store:E}),[E]);return(0,p.jsx)(i.DialogRootContext.Provider,{value:S,children:"function"==typeof t?t({payload:w}):t})}],25547),e.i(47167);var g=e.i(27601),m=e.i(83590),h=e.i(84759),v=e.i(77681);let b=((t={})[t.open=m.CommonPopupDataAttributes.open]="open",t[t.closed=m.CommonPopupDataAttributes.closed]="closed",t[t.startingStyle=m.CommonPopupDataAttributes.startingStyle]="startingStyle",t[t.endingStyle=m.CommonPopupDataAttributes.endingStyle]="endingStyle",t.nested="data-nested",t.nestedDialogOpen="data-nested-dialog-open",t),y={...m.popupStateMapping,...h.transitionStatusMapping,nested:e=>e?{[b.nested]:""}:null,nestedDialogOpen:e=>e?{[b.nestedDialogOpen]:""}:null},x=n.forwardRef(function(e,t){let{className:n,render:r,children:o,...a}=e,s=(0,v.useDialogPortalContext)(),{store:l}=(0,i.useDialogRootContext)(),u=l.useState("open"),c=l.useState("nested"),d=l.useState("transitionStatus"),f=l.useState("nestedOpenDialogCount"),p=l.useState("mounted");return(0,g.useRenderElement)("div",e,{enabled:s||p,state:{open:u,nested:c,transitionStatus:d,nestedDialogOpen:f>0},ref:[t,l.useStateSetter("viewportElement")],stateAttributesMapping:y,props:[{role:"presentation",hidden:!p,style:{pointerEvents:u?void 0:"none"},children:o},a]})});e.s(["DialogViewport",0,x],55057);var E=e.i(89879);let w=n.forwardRef(function(e,t){let{render:n,className:r,id:o,...a}=e,{store:s}=(0,i.useDialogRootContext)(),l=(0,E.useBaseUiId)(o);return s.useSyncedValueWithCleanup("titleElementId",l),(0,g.useRenderElement)("h2",e,{ref:t,props:[{id:l},a]})});e.s(["DialogTitle",0,w],49899)},4012,e=>{"use strict";var t=e.i(71645),n=e.i(47135),r=e.i(66745),o=e.i(17514),a=e.i(82033),i=e.i(47857),s=e.i(5963),l=e.i(3404);e.s(["useClick",0,function(e,u={}){let c="rootStore"in e?e.rootStore:e,d=c.context.dataRef,{enabled:f=!0,event:p="click",toggle:g=!0,ignoreMouse:m=!1,stickIfOpen:h=!0,touchOpenDelay:v=0,reason:b=l.REASONS.triggerPress}=u,y=t.useRef(void 0),x=(0,n.useAnimationFrame)(),E=(0,r.useTimeout)(),w=t.useMemo(()=>({onPointerDown(e){y.current=e.pointerType},onMouseDown(e){let t=y.current,n=e.nativeEvent,r=c.select("open");if(0!==e.button||"click"===p||(0,a.isMouseLikePointerType)(t,!0)&&m)return;let o=d.current.openEvent,l=o?.type,u=c.select("domReferenceElement")!==e.currentTarget,f=r&&u||!(r&&g&&(!o||!h||"click"===l||"mousedown"===l));if((0,i.isTypeableElement)(n.target)){let e=(0,s.createChangeEventDetails)(b,n,n.target);f&&"touch"===t&&v>0?E.start(v,()=>{c.setOpen(!0,e)}):c.setOpen(f,e);return}let w=e.currentTarget;x.request(()=>{let e=(0,s.createChangeEventDetails)(b,n,w);f&&"touch"===t&&v>0?E.start(v,()=>{c.setOpen(!0,e)}):c.setOpen(f,e)})},onClick(e){if("mousedown-only"===p)return;let t=y.current;if("mousedown"===p&&t){y.current=void 0;return}if((0,a.isMouseLikePointerType)(t,!0)&&m)return;let n=c.select("open"),r=d.current.openEvent,o=c.select("domReferenceElement")!==e.currentTarget,i=n&&o||!(n&&g&&(!r||!h||(0,a.isClickLikeEvent)(r))),l=(0,s.createChangeEventDetails)(b,e.nativeEvent,e.currentTarget);i&&"touch"===t&&v>0?E.start(v,()=>{c.setOpen(!0,l)}):c.setOpen(i,l)},onKeyDown(){y.current=void 0}}),[d,p,m,c,h,g,x,E,v,b]);return t.useMemo(()=>f?{reference:w}:o.EMPTY_OBJECT,[f,w])}])},72920,e=>{"use strict";e.i(75704);var t=e.i(59141),n=e.i(43444),r=e.i(39362),o=e.i(96918),a=e.i(38449),i=e.i(25547),s=e.i(55057),l=e.i(49899);e.i(47167);var u=e.i(67805),c=e.i(71645),d=e.i(13104),f=e.i(91730),p=e.i(27601),g=e.i(83590),m=e.i(7335),h=e.i(58642),v=e.i(89879),b=e.i(4012),y=e.i(89633);let x=c.forwardRef(function(e,t){let{render:n,className:r,disabled:o=!1,nativeButton:a=!0,id:i,payload:s,handle:l,...x}=e,E=(0,d.useDialogRootContext)(!0),w=l?.store??E?.store;if(!w)throw Error((0,u.default)(79));let S=(0,v.useBaseUiId)(i),C=w.useState("floatingRootContext"),R=w.useState("isOpenedByTrigger",S),T=c.useRef(null),{registerTrigger:k,isMountedByThisTrigger:D}=(0,h.useTriggerDataForwarding)(S,T,w,{payload:s}),{getButtonProps:O,buttonRef:I}=(0,f.useButton)({disabled:o,native:a}),A=(0,b.useClick)(C,{enabled:null!=C}),P=(0,y.useInteractions)([A]),N=w.useState("triggerProps",D);return(0,p.useRenderElement)("button",e,{state:{disabled:o,open:R},ref:[I,t,k,T],props:[P.getReferenceProps(),N,{[m.CLICK_TRIGGER_IDENTIFIER]:"",id:S},x,O],stateAttributesMapping:g.triggerOpenStateMapping})});var E=e.i(2346),w=e.i(5963),S=e.i(3404);class C{constructor(e){this.store=e??new E.DialogStore}open(e){let t=e?this.store.context.triggerElements.getById(e):void 0;this.store.setOpen(!0,(0,w.createChangeEventDetails)(S.REASONS.imperativeAction,void 0,t))}openWithPayload(e){this.store.set("payload",e),this.store.setOpen(!0,(0,w.createChangeEventDetails)(S.REASONS.imperativeAction,void 0,void 0))}close(){this.store.setOpen(!1,(0,w.createChangeEventDetails)(S.REASONS.imperativeAction,void 0,void 0))}get isOpen(){return this.store.state.open}}e.s(["Backdrop",()=>t.DialogBackdrop,"Close",()=>n.DialogClose,"Description",()=>r.DialogDescription,"Handle",0,C,"Popup",()=>o.DialogPopup,"Portal",()=>a.DialogPortal,"Root",()=>i.DialogRoot,"Title",()=>l.DialogTitle,"Trigger",0,x,"Viewport",()=>s.DialogViewport,"createHandle",0,function(){return new C}],87913);var R=e.i(87913);e.s(["Dialog",0,R],72920)},85902,e=>{"use strict";var t=e.i(18050);e.i(47167);var n=e.i(71645),r=e.i(91730),o=e.i(27601);let a=n.forwardRef(function(e,t){let{render:n,className:a,disabled:i=!1,focusableWhenDisabled:s=!1,nativeButton:l=!0,...u}=e,{getButtonProps:c,buttonRef:d}=(0,r.useButton)({disabled:i,focusableWhenDisabled:s,native:l});return(0,o.useRenderElement)("button",e,{state:{disabled:i},ref:[t,d],props:[u,c]})});var i=e.i(25913),s=e.i(52088);let l=(0,i.cva)("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-xs/relaxed font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-input/20 shadow-xs text-muted-foreground hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:bg-input/30 dark:text-muted-foreground dark:hover:bg-muted/50 dark:hover:text-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-7 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",xs:"h-5 gap-1 rounded-sm px-2 text-[0.625rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-2.5",sm:"h-6 gap-1 px-2 text-xs/relaxed has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",lg:"h-8 gap-1 px-2.5 text-xs/relaxed has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-4",icon:"size-7 [&_svg:not([class*='size-'])]:size-3.5","icon-xs":"size-5 rounded-sm [&_svg:not([class*='size-'])]:size-2.5","icon-sm":"size-6 [&_svg:not([class*='size-'])]:size-3","icon-lg":"size-8 [&_svg:not([class*='size-'])]:size-4"}},defaultVariants:{variant:"default",size:"default"}});e.s(["Button",0,function({className:e,variant:n="default",size:r="default",...o}){return(0,t.jsx)(a,{"data-slot":"button",className:(0,s.cn)(l({variant:n,size:r,className:e})),...o})},"buttonVariants",0,l],85902)},41947,e=>{"use strict";let t=(0,e.i(75254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",0,t])},69068,e=>{"use strict";var t=e.i(18050),n=e.i(72920),r=e.i(52088),o=e.i(85902),a=e.i(41947),a=a;function i({...e}){return(0,t.jsx)(n.Dialog.Portal,{"data-slot":"dialog-portal",...e})}function s({className:e,...o}){return(0,t.jsx)(n.Dialog.Backdrop,{"data-slot":"dialog-overlay",className:(0,r.cn)("fixed inset-0 isolate z-50 bg-black/20 backdrop-blur-sm duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...o})}e.s(["Dialog",0,function({...e}){return(0,t.jsx)(n.Dialog.Root,{"data-slot":"dialog",...e})},"DialogClose",0,function({...e}){return(0,t.jsx)(n.Dialog.Close,{"data-slot":"dialog-close",...e})},"DialogContent",0,function({className:e,children:l,showCloseButton:u=!0,...c}){return(0,t.jsxs)(i,{children:[(0,t.jsx)(s,{}),(0,t.jsxs)(n.Dialog.Popup,{"data-slot":"dialog-content",className:(0,r.cn)("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-xs/relaxed text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...c,children:[l,u&&(0,t.jsxs)(n.Dialog.Close,{"data-slot":"dialog-close",render:(0,t.jsx)(o.Button,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[(0,t.jsx)(a.default,{}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})},"DialogDescription",0,function({className:e,...o}){return(0,t.jsx)(n.Dialog.Description,{"data-slot":"dialog-description",className:(0,r.cn)("text-xs/relaxed text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...o})},"DialogFooter",0,function({className:e,showCloseButton:a=!1,children:i,...s}){return(0,t.jsxs)("div",{"data-slot":"dialog-footer",className:(0,r.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...s,children:[i,a&&(0,t.jsx)(n.Dialog.Close,{render:(0,t.jsx)(o.Button,{variant:"outline"}),children:"Close"})]})},"DialogHeader",0,function({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"dialog-header",className:(0,r.cn)("flex flex-col gap-1",e),...n})},"DialogTitle",0,function({className:e,...o}){return(0,t.jsx)(n.Dialog.Title,{"data-slot":"dialog-title",className:(0,r.cn)("font-heading text-sm font-medium",e),...o})}],69068)},37727,e=>{"use strict";var t=e.i(41947);e.s(["X",()=>t.default])},68995,e=>{"use strict";var t=e.i(18050),n=e.i(71645),r=e.i(69068),o=e.i(85902),a=e.i(37727),i=e.i(52088);let s={sm:"sm:max-w-sm",md:"sm:max-w-md",lg:"sm:max-w-lg",xl:"sm:max-w-xl","2xl":"sm:max-w-2xl","4xl":"sm:max-w-4xl","6xl":"sm:max-w-6xl"};function l({open:e,onOpenChange:u,title:c,children:d,maxWidth:f="2xl",showCloseButton:p=!0,initialFocusEl:g,dismissOnEsc:m=!0,fullScreen:h=!1}){return(0,n.useEffect)(()=>{if(e&&g){let e=requestAnimationFrame(()=>{let e=g();e&&e.focus()});return()=>cancelAnimationFrame(e)}},[e,g]),(0,t.jsx)(r.Dialog,{open:e,onOpenChange:(e,t)=>{(e||m||"escape-key"!==t.reason)&&u({open:e})},modal:!0,children:(0,t.jsxs)(r.DialogContent,{showCloseButton:!1,className:(0,i.cn)("bg-background rounded-lg border border-border shadow-lg","gap-0 p-0",h?"w-[calc(100%-32px)] !max-w-[calc(100%-32px)] h-[calc(100vh-32px)] max-h-[calc(100vh-32px)] flex flex-col overflow-hidden":(0,i.cn)("max-h-[90vh] overflow-y-auto",s[f])),children:[(c||p)&&(0,t.jsxs)("div",{className:(0,i.cn)("flex items-center justify-between",h?"px-4 pt-4 pb-2":"px-6 pt-6 pb-2"),children:[c&&(0,t.jsx)(r.DialogTitle,{className:"text-lg font-semibold leading-none text-foreground",children:c}),p&&(0,t.jsx)(r.DialogClose,{render:(0,t.jsx)(o.Button,{variant:"ghost",size:"icon",className:"ml-auto text-muted-foreground hover:text-foreground"}),children:(0,t.jsx)(a.X,{className:"size-4"})})]}),(0,t.jsx)("div",{className:(0,i.cn)(h?"px-4 pb-4 pt-2 flex-1 min-h-0 flex flex-col":c||p?"px-6 pb-6 pt-2":"p-6"),children:d})]})})}e.s(["ConfirmDialog",0,function({open:e,onOpenChange:n,title:a,message:i,confirmLabel:s="Confirm",cancelLabel:u="Cancel",onConfirm:c,variant:d="default"}){return(0,t.jsx)(l,{open:e,onOpenChange:n,maxWidth:"md",showCloseButton:!1,children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold leading-none text-foreground",children:a}),(0,t.jsx)("div",{className:"text-sm text-muted-foreground whitespace-pre-line",children:i}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,t.jsx)(r.DialogClose,{render:(0,t.jsx)(o.Button,{variant:"outline",className:"cursor-pointer"}),children:u}),(0,t.jsx)(o.Button,{variant:"danger"===d?"destructive":"default",onClick:()=>{c(),n({open:!1})},className:"cursor-pointer",children:s})]})]})})},"Dialog",0,l])},44142,e=>{"use strict";var t=e.i(18050),n=e.i(71645),r=e.i(96085),o=e.i(70935);let a=(0,n.createContext)({status:null,checkNow:async()=>{}});e.s(["UpdateStatusProvider",0,function({children:e}){let[i,s]=(0,n.useState)(null);(0,n.useEffect)(()=>{let e=!1;fetch((0,o.apiUrl)("/api/version")).then(e=>e.ok?e.json():null).then(t=>{!e&&t?.data&&s(t.data)}).catch(()=>{});let t=(0,r.io)((0,o.getServerUrl)(),{transports:["polling","websocket"]});return t.on("version:status",e=>s(e)),()=>{e=!0,t.disconnect()}},[]);let l=(0,n.useCallback)(async()=>{let e=await fetch((0,o.apiUrl)("/api/version/check"),{method:"POST"}),t=await e.json().catch(()=>null);if(!e.ok||!t?.data)throw Error(t?.error??`HTTP ${e.status}`);s(t.data)},[]);return(0,t.jsx)(a.Provider,{value:{status:i,checkNow:l},children:e})},"useCheckForUpdate",0,function(){return(0,n.useContext)(a).checkNow},"useUpdateStatus",0,function(){return(0,n.useContext)(a).status}])}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,41241,19556,9752,20486,t=>{"use strict";var e=t.i(49915),a=(0,t.i(65485).default)(Object.keys,Object),s=Object.prototype.hasOwnProperty;let r=function(t){if(!(0,e.default)(t))return a(t);var r=[];for(var n in Object(t))s.call(t,n)&&"constructor"!=n&&r.push(n);return r};t.s(["default",0,r],19556);var n=t.i(47244),i=t.i(56176),l=(0,n.default)(i.default,"DataView"),c=t.i(44483),u=(0,n.default)(i.default,"Promise"),o=(0,n.default)(i.default,"Set");t.s(["default",0,o],9752);var d=(0,n.default)(i.default,"WeakMap"),h=t.i(35287),k=t.i(66762),f="[object Map]",m="[object Promise]",p="[object Set]",g="[object WeakMap]",v="[object DataView]",b=(0,k.default)(l),j=(0,k.default)(c.default),y=(0,k.default)(u),x=(0,k.default)(o),w=(0,k.default)(d),P=h.default;(l&&P(new l(new ArrayBuffer(1)))!=v||c.default&&P(new c.default)!=f||u&&P(u.resolve())!=m||o&&P(new o)!=p||d&&P(new d)!=g)&&(P=function(t){var e=(0,h.default)(t),a="[object Object]"==e?t.constructor:void 0,s=a?(0,k.default)(a):"";if(s)switch(s){case b:return v;case j:return f;case y:return m;case x:return p;case w:return g}return e});let q=P;t.s(["default",0,q],20486);var _=t.i(15300),T=t.i(44071),C=t.i(41338),E=t.i(3745),z=t.i(1645),L=Object.prototype.hasOwnProperty;t.s(["default",0,function(t){if(null==t)return!0;if((0,C.default)(t)&&((0,T.default)(t)||"string"==typeof t||"function"==typeof t.splice||(0,E.default)(t)||(0,z.default)(t)||(0,_.default)(t)))return!t.length;var a=q(t);if("[object Map]"==a||"[object Set]"==a)return!t.size;if((0,e.default)(t))return!r(t).length;for(var s in t)if(L.call(t,s))return!1;return!0}],41241)},44917,t=>{"use strict";var e=t.i(96977),a=t.i(71206);t.i(47716);var s=t.i(23685),r=(0,a.__name)(t=>{let{securityLevel:a}=(0,e.getConfig2)(),r=(0,s.select)("body");if("sandbox"===a){let e=(0,s.select)(`#i${t}`),a=e.node()?.contentDocument??document;r=(0,s.select)(a.body)}return r.select(`#${t}`)},"selectSvgElement");t.s(["selectSvgElement",0,r])},3262,t=>{"use strict";var e=t.i(31360),a=t.i(60884),s=t.i(29432),r=t.i(96977),n=t.i(71206),i={common:r.common_default,getConfig:r.getConfig,insertCluster:a.insertCluster,insertEdge:e.insertEdge,insertEdgeLabel:e.insertEdgeLabel,insertMarkers:e.markers_default,insertNode:a.insertNode,interpolateToCurve:s.interpolateToCurve,labelHelper:a.labelHelper,log:n.log,positionEdgeLabel:e.positionEdgeLabel},l={},c=(0,n.__name)(t=>{for(let e of t)l[e.name]=e},"registerLayoutLoaders");(0,n.__name)(()=>{c([{name:"dagre",loader:(0,n.__name)(async()=>await t.A(92568),"loader")},{name:"cose-bilkent",loader:(0,n.__name)(async()=>await t.A(62369),"loader")}])},"registerDefaultLayoutLoaders")();var u=(0,n.__name)(async(t,e)=>{if(!(t.layoutAlgorithm in l))throw Error(`Unknown layout algorithm: ${t.layoutAlgorithm}`);if(t.diagramId)for(let e of t.nodes){let a=e.domId||e.id;e.domId=`${t.diagramId}-${a}`}let a=l[t.layoutAlgorithm],s=await a.loader(),{theme:r,themeVariables:n}=t.config,{useGradient:c,gradientStart:u,gradientStop:o}=n,d=e.attr("id");if(e.append("defs").append("filter").attr("id",`${d}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${r?.includes("dark")?"#FFFFFF":"#000000"}`),e.append("defs").append("filter").attr("id",`${d}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${r?.includes("dark")?"#FFFFFF":"#000000"}`),c){let t=e.append("linearGradient").attr("id",e.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");t.append("svg:stop").attr("offset","0%").attr("stop-color",u).attr("stop-opacity",1),t.append("svg:stop").attr("offset","100%").attr("stop-color",o).attr("stop-opacity",1)}return s.render(t,e,i,{algorithm:a.algorithm})},"render"),o=(0,n.__name)((t="",{fallback:e="dagre"}={})=>{if(t in l)return t;if(e in l)return n.log.warn(`Layout algorithm ${t} is not registered. Using ${e} as fallback.`),e;throw Error(`Both layout algorithms ${t} and ${e} are not registered.`)},"getRegisteredLayoutAlgorithm");t.s(["getRegisteredLayoutAlgorithm",0,o,"registerLayoutLoaders",0,c,"render",0,u])},50160,t=>{t.q("/_next/static/media/icon.0fkix7.hkmsz4.png")},16715,t=>{"use strict";let e=(0,t.i(75254).default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);t.s(["RefreshCw",0,e],16715)},7233,5352,t=>{"use strict";let e=(0,t.i(75254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);t.s(["Plus",0,e],7233);let a=[{bg:"bg-blue-100 dark:bg-blue-900/30",text:"text-blue-700 dark:text-blue-300"},{bg:"bg-emerald-100 dark:bg-emerald-900/30",text:"text-emerald-700 dark:text-emerald-300"},{bg:"bg-violet-100 dark:bg-violet-900/30",text:"text-violet-700 dark:text-violet-300"},{bg:"bg-amber-100 dark:bg-amber-900/30",text:"text-amber-700 dark:text-amber-300"},{bg:"bg-rose-100 dark:bg-rose-900/30",text:"text-rose-700 dark:text-rose-300"},{bg:"bg-cyan-100 dark:bg-cyan-900/30",text:"text-cyan-700 dark:text-cyan-300"},{bg:"bg-orange-100 dark:bg-orange-900/30",text:"text-orange-700 dark:text-orange-300"},{bg:"bg-teal-100 dark:bg-teal-900/30",text:"text-teal-700 dark:text-teal-300"},{bg:"bg-indigo-100 dark:bg-indigo-900/30",text:"text-indigo-700 dark:text-indigo-300"},{bg:"bg-pink-100 dark:bg-pink-900/30",text:"text-pink-700 dark:text-pink-300"},{bg:"bg-lime-100 dark:bg-lime-900/30",text:"text-lime-700 dark:text-lime-300"},{bg:"bg-fuchsia-100 dark:bg-fuchsia-900/30",text:"text-fuchsia-700 dark:text-fuchsia-300"}];t.s(["getRepoColor",0,function(t,e){let s=function(t){let e=5381;for(let a=0;a<t.length;a++)e=33*e^t.charCodeAt(a);return e>>>0}(`${t}/${e}`)%a.length;return a[s]}],5352)},55716,t=>{"use strict";let e=(0,t.i(75254).default)("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);t.s(["GitBranch",0,e],55716)},18566,(t,e,a)=>{e.exports=t.r(76562)},31278,t=>{"use strict";var e=t.i(17521);t.s(["Loader2",()=>e.default])},95468,t=>{"use strict";var e=t.i(23287);t.s(["CheckCircle2",()=>e.default])},86311,t=>{"use strict";let e=(0,t.i(75254).default)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]);t.s(["MessageSquare",0,e],86311)},73884,t=>{"use strict";let e=(0,t.i(75254).default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);t.s(["XCircle",0,e],73884)},2576,t=>{"use strict";var e=t.i(71645),a=t.i(96085),s=t.i(70935);t.s(["useTaskEvents",0,function(t){let r=(0,e.useRef)(null),n=(0,e.useRef)(t);(0,e.useLayoutEffect)(()=>{n.current=t}),(0,e.useEffect)(()=>{let t=(0,a.io)((0,s.getServerUrl)(),{transports:["polling","websocket"]});return r.current=t,t.on("task:created",({task:t,warnings:e})=>{n.current.onTaskCreated(t,e??[])}),t.on("task:updated",({task:t})=>{n.current.onTaskUpdated(t)}),t.on("task:deleted",({taskId:t})=>{n.current.onTaskDeleted(t)}),t.on("task:tabs-changed",({task:t})=>{n.current.onTaskTabsChanged?.(t)}),()=>{t.disconnect(),r.current=null}},[])}])},71698,t=>{"use strict";var e=t.i(71645),a=t.i(96085),s=t.i(70935);t.s(["useTabStatusEvents",0,function(t,r){let n=(0,e.useRef)(null),i=(0,e.useRef)(new Set),l=(0,e.useRef)(r);(0,e.useEffect)(()=>{l.current=r});let c=(0,e.useCallback)(()=>{if(!n.current){let t=(0,a.io)((0,s.getServerUrl)(),{transports:["polling","websocket"]});n.current=t,t.on("status-changed",({sessionId:t,status:e})=>{let a=function(t){switch(t){case"running":return"running";case"waiting":return"waiting";case"success":return"success";case"failure":case"error":return"error";case"idle":return"idle";default:return null}}(e);null!==a&&l.current(t,a)}),t.on("connect",()=>{for(let e of i.current)t.emit("join",{room:e,mode:"subscribe"})})}return n.current},[]);(0,e.useEffect)(()=>{if(0===t.length)return;let e=c();for(let a of t){let t=`tab:${a}`;i.current.has(t)||(e.emit("join",{room:t,mode:"subscribe"}),i.current.add(t))}let a=new Set(t);for(let t of i.current){let s=t.replace("tab:","");a.has(s)||(e.emit("leave",{room:t}),i.current.delete(t))}},[t,c]),(0,e.useEffect)(()=>{let t=i.current;return()=>{n.current?.disconnect(),n.current=null,t.clear()}},[])}])},53134,801,t=>{"use strict";function e(t){return"success"===t||"error"===t||"running"!==t&&"idle"!==t&&void 0}function a(t){let e=t.tabs??[];if(0===e.length||e.some(t=>"running"===t.status))return null;if(e.some(t=>"waiting"===t.status))return"waiting";let a=e.filter(t=>t.unread);return a.some(t=>"error"===t.status)?"error":a.some(t=>"success"===t.status)?"success":null}t.s(["activityKind",0,function(t){return(t.tabs??[]).some(t=>"running"===t.status)?"running":a(t)},"hasUnreadResult",0,function(t){return null!==a(t)},"unreadForStatus",0,e,"unreadKind",0,a],53134);var s=t.i(71645),r=t.i(70935),n=t.i(2576),i=t.i(71698);t.s(["useLiveTasks",0,function(t={}){let[a,l]=(0,s.useState)([]),[c,u]=(0,s.useState)(!0),o=(0,s.useRef)(t),d=(0,s.useRef)(a);(0,s.useEffect)(()=>{o.current=t,d.current=a});let h=(0,s.useCallback)(async()=>{u(!0);try{let t=await fetch((0,r.apiUrl)("/api/tasks"));if(!t.ok)throw Error("Failed to fetch tasks");let e=await t.json();l(e.data.tasks)}catch(t){console.error("Failed to load tasks:",t)}finally{u(!1)}},[]);(0,s.useEffect)(()=>{h()},[h]);let k=(0,s.useMemo)(()=>a.flatMap(t=>(t.tabs??[]).map(t=>t.tab_id)),[a]);return(0,i.useTabStatusEvents)(k,(t,a)=>{let s=e(a);l(e=>e.map(e=>({...e,tabs:(e.tabs??[]).map(e=>e.tab_id===t?{...e,status:a,...void 0!==s&&{unread:s}}:e)})))}),(0,n.useTaskEvents)({onTaskCreated:(t,e)=>{l(e=>e.some(e=>e.id===t.id)?e:[...e,t]),o.current.onTaskCreated?.(t,e)},onTaskUpdated:t=>{l(e=>e.map(e=>e.id===t.id?t:e)),o.current.onTaskUpdated?.(t)},onTaskDeleted:t=>{let e=d.current.find(e=>e.id===t);l(e=>e.filter(e=>e.id!==t)),o.current.onTaskDeleted?.(t,e)},onTaskTabsChanged:t=>{l(e=>e.map(e=>e.id===t.id?t:e))}}),{tasks:a,setTasks:l,isLoading:c,reload:h}}],801)},39484,t=>{t.v(e=>Promise.all(["static/chunks/002jt~~cq5_aa.js"].map(e=>t.l(e))).then(()=>e(16400)))},92568,t=>{t.v(e=>Promise.all(["static/chunks/0bew-tpzkv4a6.js","static/chunks/0hc31lz26e0bj.js","static/chunks/156lsa3n_7-g1.js"].map(e=>t.l(e))).then(()=>e(68053)))},62369,t=>{t.v(e=>Promise.all(["static/chunks/0t-ecot2ot8jq.js","static/chunks/0s2ei~z99yg.7.js"].map(e=>t.l(e))).then(()=>e(97810)))},78997,t=>{t.v(e=>Promise.all(["static/chunks/0w4h2u4jedq4..js","static/chunks/0v8zy131j2_sl.js"].map(e=>t.l(e))).then(()=>e(77010)))},28146,t=>{t.v(e=>Promise.all(["static/chunks/179i-blt6kp34.js","static/chunks/004q74ucr0rud.js"].map(e=>t.l(e))).then(()=>e(26067)))},80472,t=>{t.v(e=>Promise.all(["static/chunks/0-whcx~709zzu.js"].map(e=>t.l(e))).then(()=>e(50032)))},83305,t=>{t.v(e=>Promise.all(["static/chunks/00h5q76-kypod.js","static/chunks/0f6mqg1npiv.t.js","static/chunks/0g7ov558axacn.js"].map(e=>t.l(e))).then(()=>e(8709)))},34606,t=>{t.v(e=>Promise.all(["static/chunks/0t-7~zw5_oj33.js","static/chunks/0t1nhjmm.2-8-.js"].map(e=>t.l(e))).then(()=>e(13976)))},23526,t=>{t.v(e=>Promise.all(["static/chunks/0zz1c.5ttlw75.js","static/chunks/0f6mqg1npiv.t.js","static/chunks/00h5q76-kypod.js"].map(e=>t.l(e))).then(()=>e(60498)))},3931,t=>{t.v(e=>Promise.all(["static/chunks/0egss2l0vp3iv.js","static/chunks/0f6mqg1npiv.t.js","static/chunks/00h5q76-kypod.js"].map(e=>t.l(e))).then(()=>e(79567)))},67051,t=>{t.v(e=>Promise.all(["static/chunks/0v~puv980n2mn.js"].map(e=>t.l(e))).then(()=>e(51778)))},36080,t=>{t.v(e=>Promise.all(["static/chunks/0_u58hj44ucg2.js","static/chunks/0coux02phyasu.js"].map(e=>t.l(e))).then(()=>e(79003)))},3156,t=>{t.v(e=>Promise.all(["static/chunks/0~fjlnit~fkey.js"].map(e=>t.l(e))).then(()=>e(91739)))},71209,t=>{t.v(e=>Promise.all(["static/chunks/0njmix7y_6miv.js","static/chunks/0z9df3ijvbr8h.js"].map(e=>t.l(e))).then(()=>e(94614)))},78922,t=>{t.v(e=>Promise.all(["static/chunks/0nt-wtu-~b7hv.js","static/chunks/0nwbvs~t8m~k6.js"].map(e=>t.l(e))).then(()=>e(99223)))},10404,t=>{t.v(e=>Promise.all(["static/chunks/0puq-xa16mucw.js","static/chunks/0nwbvs~t8m~k6.js"].map(e=>t.l(e))).then(()=>e(25730)))},81283,t=>{t.v(e=>Promise.all(["static/chunks/0bew-tpzkv4a6.js","static/chunks/104dsd7mk1jyt.js","static/chunks/0.fiftciismd2.js","static/chunks/0hc31lz26e0bj.js"].map(e=>t.l(e))).then(()=>e(24924)))},41605,t=>{t.v(e=>Promise.all(["static/chunks/0vj43fihkfmqz.js","static/chunks/0.fiftciismd2.js"].map(e=>t.l(e))).then(()=>e(32579)))},78877,t=>{t.v(e=>Promise.all(["static/chunks/0lmm~3cjla0c9.js"].map(e=>t.l(e))).then(()=>e(21392)))},27415,t=>{t.v(e=>Promise.all(["static/chunks/0rr4nl_auvf0b.js"].map(e=>t.l(e))).then(()=>e(92280)))},44319,t=>{t.v(e=>Promise.all(["static/chunks/0l_tj98f_5ot-.js"].map(e=>t.l(e))).then(()=>e(84201)))},31376,t=>{t.v(e=>Promise.all(["static/chunks/0-_x27yxy_uq_.js"].map(e=>t.l(e))).then(()=>e(3054)))},34215,t=>{t.v(e=>Promise.all(["static/chunks/0kx.ki.9u_0dy.js"].map(e=>t.l(e))).then(()=>e(30770)))},11980,t=>{t.v(e=>Promise.all(["static/chunks/0bb.y5mii27l0.js","static/chunks/0f6mqg1npiv.t.js","static/chunks/00h5q76-kypod.js"].map(e=>t.l(e))).then(()=>e(39342)))},70234,t=>{t.v(e=>Promise.all(["static/chunks/0g8qw208n3i89.js","static/chunks/0f6mqg1npiv.t.js","static/chunks/00h5q76-kypod.js"].map(e=>t.l(e))).then(()=>e(43020)))},44243,t=>{t.v(e=>Promise.all(["static/chunks/06x~dj4kp-z9f.js","static/chunks/11905-quym2vs.js","static/chunks/043yk9d-7bl43.js"].map(e=>t.l(e))).then(()=>e(15508)))},51365,t=>{t.v(e=>Promise.all(["static/chunks/0r4wgiv_kwiro.js","static/chunks/0f6mqg1npiv.t.js","static/chunks/00h5q76-kypod.js"].map(e=>t.l(e))).then(()=>e(78730)))},46201,t=>{t.v(e=>Promise.all(["static/chunks/1158vq~dpuyl-.js","static/chunks/00h5q76-kypod.js","static/chunks/0f6mqg1npiv.t.js","static/chunks/0s2ei~z99yg.7.js","static/chunks/0lr2ip~4h2o.z.js"].map(e=>t.l(e))).then(()=>e(38206)))},48926,t=>{t.v(e=>Promise.all(["static/chunks/0kl8vyx5367.j.js"].map(e=>t.l(e))).then(()=>e(90158)))},81291,t=>{t.v(e=>Promise.all(["static/chunks/17me7gnh4-..3.js"].map(e=>t.l(e))).then(()=>e(4447)))},31656,t=>{t.v(e=>Promise.all(["static/chunks/00h5q76-kypod.js","static/chunks/0f6mqg1npiv.t.js","static/chunks/0_7ef.hja3s4s.js"].map(e=>t.l(e))).then(()=>e(68025)))},22654,t=>{t.v(e=>Promise.all(["static/chunks/00h5q76-kypod.js","static/chunks/0f6mqg1npiv.t.js","static/chunks/0oryo.isv4jwb.js"].map(e=>t.l(e))).then(()=>e(67933)))}]);