@minimalcorp/tsunagi 0.0.6 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/apps/web/.next/BUILD_ID +1 -1
- package/.next/standalone/apps/web/.next/build-manifest.json +3 -3
- package/.next/standalone/apps/web/.next/prerender-manifest.json +3 -3
- package/.next/standalone/apps/web/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/index.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/index.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.html +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_full.segment.rsc +3 -3
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_head.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_index.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/apps/web/.next/server/app/settings.segments/settings.segment.rsc +1 -1
- package/.next/standalone/apps/web/.next/server/app/tasks/[id]/page.js.nft.json +1 -1
- package/.next/standalone/apps/web/.next/server/app/tasks/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{[root-of-the-server]__0.df2qi._.js → [root-of-the-server]__0.71xtd._.js} +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{[root-of-the-server]__0ji00ks._.js → [root-of-the-server]__0dg0i1g._.js} +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0mo_9ei._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/[root-of-the-server]__0qw6wy3._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/[root-of-the-server]__12yece_._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{_10np2kf._.js → _0ciirh0._.js} +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/_0g.cd6a._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{_00wnq9i._.js → _0m02uow._.js} +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{_0mjd2fj._.js → _12haisb._.js} +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/apps_web_src_app_settings_page_tsx_0i6itlb._.js +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/apps_web_src_app_tasks_[id]_page_tsx_0jshsm2._.js +2 -2
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_07maurq._.js → node_modules_0-4t5u4._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_07pr0y_._.js → node_modules_0.2komk._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0j_6wlf._.js → node_modules_02~gcwc._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0d3g-x9._.js → node_modules_055srxz._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0yvlzfi._.js → node_modules_05ji-z-._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0llt_c0._.js → node_modules_07.c491._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_064q4aj._.js → node_modules_0coeuci._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0yd1acw._.js → node_modules_0cphr_r._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0hisk_6._.js → node_modules_0f2d1ld._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0_9vx8p._.js → node_modules_0gpuu-x._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0imu_yh._.js → node_modules_0o5v9qy._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0.o~~kw._.js → node_modules_0rry_x9._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0xodfy.._.js → node_modules_0s5._2.._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0236txg._.js → node_modules_0t3_1om._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0p7i50i._.js → node_modules_12fhr6_._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/chunks/ssr/{node_modules_0tba1-p._.js → node_modules_12qdm6m._.js} +1 -1
- package/.next/standalone/apps/web/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/apps/web/.next/server/pages/404.html +1 -1
- package/.next/standalone/apps/web/.next/server/pages/500.html +1 -1
- package/.next/standalone/apps/web/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/apps/web/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/apps/web/.next/static/chunks/{037p8v0.zt_g5.js → 01vu~a32zh7cz.js} +1 -1
- package/.next/standalone/apps/web/.next/static/chunks/{0cea659lv7fcc.js → 0dv3n-mxhr4w1.js} +1 -1
- package/.next/standalone/apps/web/.next/static/chunks/{066xfipi1ub8l.js → 0ew.-lnxoet~x.js} +1 -1
- package/.next/standalone/apps/web/.next/static/chunks/{11_tr0pr9kxkl.js → 0hx_sdyz0yyfb.js} +7 -7
- package/.next/standalone/apps/web/.next/static/chunks/{0qyu6t8~exdxl.js → 0l0s3fn6xga.t.js} +1 -1
- package/.next/standalone/apps/web/.next/static/chunks/12r3ashx0krmo.js +3 -0
- package/.next/standalone/apps/web/.next/static/chunks/{0rqog09uuknxq.js → 1490sj3xb9_m6.js} +2 -2
- package/dist/cli.js +4 -0
- package/dist/plugin-lifecycle.js +27 -2
- package/dist/server/editor-session-store.d.ts +1 -0
- package/dist/server/routes/editor.js +19 -0
- package/package.json +1 -1
- package/.next/standalone/apps/web/.next/static/chunks/0lx0y8ph~faus.js +0 -3
- /package/.next/standalone/apps/web/.next/static/{bSPSUH1nA_0wClz0cgylZ → YPzHzYzcA3DhWIUQf4Bh4}/_buildManifest.js +0 -0
- /package/.next/standalone/apps/web/.next/static/{bSPSUH1nA_0wClz0cgylZ → YPzHzYzcA3DhWIUQf4Bh4}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/apps/web/.next/static/{bSPSUH1nA_0wClz0cgylZ → YPzHzYzcA3DhWIUQf4Bh4}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,97099,e=>{"use strict";var t,n,r,o=e.i(18050),a=e.i(71645),s=e.i(18566),i=e.i(471);let u=(0,e.i(75254).default)("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);var l=e.i(88699),c=e.i(27612),d=e.i(70935),f=e.i(10483),p=e.i(37870),g=e.i(76165),m=e.i(51846),v=e.i(30939),h=e.i(67211),b=e.i(85902);let x=(0,a.forwardRef)(function({task:e,tabs:t,activeTabId:n,onTabChange:r,onTabCreate:s,onTabDelete:i,onTodosUpdated:u},l){let[c,d]=(0,a.useState)(()=>new Set(n?[n]:[]));(0,a.useEffect)(()=>{n&&d(e=>{if(e.has(n))return e;let t=new Set(e);return t.add(n),t})},[n]);let[f,p]=(0,a.useState)(new Map),[g,m]=(0,a.useState)(new Map),x=(0,a.useRef)(new Map);(0,a.useEffect)(()=>{n&&x.current.get(n)?.focus()},[n]);let E=(0,a.useCallback)((e,t,n)=>{p(r=>{let o=new Map(r);return o.set(e,{terminal:t,claude:n}),o})},[]);(0,a.useImperativeHandle)(l,()=>({sendInput:(e,t)=>{let n=x.current.get(e);n?.sendInput(t)}}));let S=(0,a.useCallback)(e=>{d(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n}),r(e)},[r]),R=(0,a.useCallback)(async e=>{let t=await s();t&&(d(e=>{let n=new Set(e);return n.add(t),n}),m(n=>{let r=new Map(n);return r.set(t,e),r}))},[s]),y=(0,a.useCallback)(()=>R("terminal"),[R]),C=(0,a.useCallback)(()=>R("claude"),[R]),I=(0,a.useCallback)(e=>{d(t=>{let n=new Set(t);return n.delete(e),n}),p(t=>{let n=new Map(t);return n.delete(e),n}),m(t=>{let n=new Map(t);return n.delete(e),n}),x.current.delete(e),i(e)},[i]);return(0,o.jsxs)("div",{className:"flex flex-col flex-1 min-h-0",children:[(0,o.jsx)("div",{className:"px-4 pt-4 flex-shrink-0",children:t.length>0?(0,o.jsx)(v.SessionTabs,{tabs:t,activeTabId:n,onTabChange:S,onTabCreateTerminal:y,onTabCreateClaude:C,onTabDelete:I,tabStatusMap:f}):(0,o.jsxs)("div",{className:"text-center py-8",children:[(0,o.jsx)("p",{className:"text-muted-foreground mb-4",children:"No tabs yet"}),(0,o.jsx)(b.Button,{size:"lg",onClick:C,children:"+ Create First Tab"})]})}),(0,o.jsxs)("div",{className:"flex-1 min-h-0 relative",children:[t.map(t=>{let r=c.has(t.tab_id),a=t.tab_id===n;return r?(0,o.jsx)("div",{className:"absolute inset-0 flex flex-col px-4 pb-4 pt-2",style:{visibility:a?"visible":"hidden",pointerEvents:a?"auto":"none"},children:(0,o.jsx)(h.TerminalView,{ref:e=>{e?x.current.set(t.tab_id,e):x.current.delete(t.tab_id)},tabId:t.tab_id,isActive:a,cwd:e.worktreePath,worktreePath:e.worktreePath,command:"terminal"!==g.get(t.tab_id)?`claude --dangerously-skip-permissions --resume ${t.tab_id} 2>/dev/null || claude --dangerously-skip-permissions --session-id ${t.tab_id}`:void 0,className:"h-full",initialTodos:t.todos,onTodosUpdated:u,onStatusChange:E})},t.tab_id):null}),t.length>0&&!n&&(0,o.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground text-sm",children:"Select a tab to view terminal"})]})]})});var E=e.i(68995);e.s([],38727),e.i(38727),e.i(47167);var S=e.i(67805);let R=a.createContext(void 0);function y(e){let t=a.useContext(R);if(void 0===t&&!e)throw Error((0,S.default)(33));return t}let C=a.createContext(void 0);function I(e){let t=a.useContext(C);if(void 0===t&&!e)throw Error((0,S.default)(36));return t}var T=e.i(27601),k=e.i(83590);let O=a.forwardRef(function(e,t){let{className:n,render:r,...o}=e,{store:a}=I(),{arrowRef:s,side:i,align:u,arrowUncentered:l,arrowStyles:c}=y(),d=a.useState("open");return(0,T.useRenderElement)("div",e,{ref:[s,t],stateAttributesMapping:k.popupStateMapping,state:{open:d,side:i,align:u,uncentered:l},props:{style:c,"aria-hidden":!0,...o}})});var w=e.i(84759);let M=a.createContext(void 0);function N(e=!0){let t=a.useContext(M);if(void 0===t&&!e)throw Error((0,S.default)(25));return t}var A=e.i(3404);let P={...k.popupStateMapping,...w.transitionStatusMapping},D=a.forwardRef(function(e,t){let{className:n,render:r,...o}=e,{store:a}=I(),s=a.useState("open"),i=a.useState("mounted"),u=a.useState("transitionStatus"),l=a.useState("lastOpenChangeReason"),c=N();return(0,T.useRenderElement)("div",e,{ref:c?.backdropRef?[t,c.backdropRef]:t,state:{open:s,transitionStatus:u},stateAttributesMapping:P,props:[{role:"presentation",hidden:!i,style:{pointerEvents:l===A.REASONS.triggerHover?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},o]})});var L=e.i(76477),F=e.i(94349);let j=a.createContext(void 0);var _=e.i(26292),U=e.i(91730),B=e.i(19805),H=e.i(57666);function W(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:o,store:s,typingRef:i,itemRef:u,itemMetadata:l}=e,{events:c}=s.useState("floatingTreeRoot"),d=N(!0),f=void 0!==d;return a.useMemo(()=>({id:r,role:"menuitem",tabIndex:n?0:-1,onKeyDown(e){" "===e.key&&i?.current&&e.preventDefault()},onMouseMove(e){o&&c.emit("itemhover",{nodeId:o,target:e.currentTarget})},onClick(e){t&&c.emit("close",{domEvent:e,reason:A.REASONS.itemPress})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&1>=Math.abs(e.clientX-t.x)&&1>=Math.abs(e.clientY-t.y)||f&&!H.isMac&&2===e.button)return}u.current&&s.context.allowMouseUpTriggerRef.current&&(!f||2===e.button)&&(!l||"regular-item"===l.type)&&u.current.click()}}),[t,n,r,c,o,s,i,u,d,f,l])}let V={type:"regular-item"};function G(e){let{closeOnClick:t,disabled:n=!1,highlighted:r,id:o,store:s,typingRef:i=s.context.typingRef,nativeButton:u,itemMetadata:l,nodeId:c}=e,d=a.useRef(null),{getButtonProps:f,buttonRef:p}=(0,U.useButton)({disabled:n,focusableWhenDisabled:!0,native:u,composite:!0}),g=W({closeOnClick:t,highlighted:r,id:o,nodeId:c,store:s,typingRef:i,itemRef:d,itemMetadata:l}),m=a.useCallback(e=>(0,B.mergeProps)(g,{onMouseEnter(){"submenu-trigger"===l.type&&l.setActive()}},e,f),[g,f,l]),v=(0,_.useMergedRefs)(d,p);return a.useMemo(()=>({getItemProps:m,itemRef:v}),[m,v])}var z=e.i(977);let K=a.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}}),Y=((t={})[t.None=0]="None",t[t.GuessFromOrder=1]="GuessFromOrder",t);function $(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:o,index:s}=e,{register:i,unregister:u,subscribeMapChange:l,elementsRef:c,labelsRef:d,nextIndexRef:f}=a.useContext(K),p=a.useRef(-1),[g,m]=a.useState(s??(o===Y.GuessFromOrder?()=>{if(-1===p.current){let e=f.current;f.current+=1,p.current=e}return p.current}:-1)),v=a.useRef(null),h=a.useCallback(e=>{if(v.current=e,-1!==g&&null!==e&&(c.current[g]=e,d)){let n=void 0!==t;d.current[g]=n?t:r?.current?.textContent??e.textContent}},[g,c,d,t,r]);return(0,z.useIsoLayoutEffect)(()=>{if(null!=s)return;let e=v.current;if(e)return i(e,n),()=>{u(e)}},[s,i,u,n]),(0,z.useIsoLayoutEffect)(()=>{if(null==s)return l(e=>{let t=v.current?e.get(v.current)?.index:null;null!=t&&m(t)})},[s,l,m]),a.useMemo(()=>({ref:h,index:g}),[g,h])}var J=e.i(89879);let q=((n={}).checked="data-checked",n.unchecked="data-unchecked",n.disabled="data-disabled",n.highlighted="data-highlighted",n),X={checked:e=>e?{[q.checked]:""}:{[q.unchecked]:""},...w.transitionStatusMapping};var Q=e.i(5963);let Z=a.forwardRef(function(e,t){let{render:n,className:r,id:s,label:i,nativeButton:u=!1,disabled:l=!1,closeOnClick:c=!1,checked:d,defaultChecked:f,onCheckedChange:p,...g}=e,m=$({label:i}),v=y(!0),h=(0,J.useBaseUiId)(s),{store:b}=I(),x=b.useState("isActive",m.index),E=b.useState("itemProps"),[S,R]=(0,F.useControlled)({controlled:d,default:f??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:C,itemRef:k}=G({closeOnClick:c,disabled:l,highlighted:x,id:h,store:b,nativeButton:u,nodeId:v?.nodeId,itemMetadata:V}),O=a.useMemo(()=>({disabled:l,highlighted:x,checked:S}),[l,x,S]),w=(0,L.useStableCallback)(e=>{let t={...(0,Q.createChangeEventDetails)(A.REASONS.itemPress,e.nativeEvent),preventUnmountOnClose:()=>{}};p?.(!S,t),t.isCanceled||R(e=>!e)}),M=(0,T.useRenderElement)("div",e,{state:O,stateAttributesMapping:X,props:[E,{role:"menuitemcheckbox","aria-checked":S,onClick:w},g,C],ref:[k,t,m.ref]});return(0,o.jsx)(j.Provider,{value:O,children:M})});var ee=e.i(88841),et=e.i(89269);let en=a.forwardRef(function(e,t){let{render:n,className:r,keepMounted:o=!1,...s}=e,i=function(){let e=a.useContext(j);if(void 0===e)throw Error((0,S.default)(30));return e}(),u=a.useRef(null),{transitionStatus:l,setMounted:c}=(0,ee.useTransitionStatus)(i.checked);(0,et.useOpenChangeComplete)({open:i.checked,ref:u,onComplete(){i.checked||c(!1)}});let d={checked:i.checked,disabled:i.disabled,highlighted:i.highlighted,transitionStatus:l};return(0,T.useRenderElement)("span",e,{state:d,ref:[t,u],stateAttributesMapping:X,props:{"aria-hidden":!0,...s},enabled:o||i.checked})}),er=a.createContext(void 0),eo=a.forwardRef(function(e,t){let{render:n,className:r,...s}=e,[i,u]=a.useState(void 0),l=a.useMemo(()=>({setLabelId:u}),[u]),c=(0,T.useRenderElement)("div",e,{ref:t,props:{role:"group","aria-labelledby":i,...s}});return(0,o.jsx)(er.Provider,{value:l,children:c})}),ea=a.forwardRef(function(e,t){let{className:n,render:r,id:o,...s}=e,i=(0,J.useBaseUiId)(o),{setLabelId:u}=function(){let e=a.useContext(er);if(void 0===e)throw Error((0,S.default)(31));return e}();return(0,z.useIsoLayoutEffect)(()=>(u(i),()=>{u(void 0)}),[u,i]),(0,T.useRenderElement)("div",e,{ref:t,props:{id:i,role:"presentation",...s}})}),es=a.forwardRef(function(e,t){let{render:n,className:r,id:o,label:a,nativeButton:s=!1,disabled:i=!1,closeOnClick:u=!0,...l}=e,c=$({label:a}),d=y(!0),f=(0,J.useBaseUiId)(o),{store:p}=I(),g=p.useState("isActive",c.index),m=p.useState("itemProps"),{getItemProps:v,itemRef:h}=G({closeOnClick:u,disabled:i,highlighted:g,id:f,store:p,nativeButton:s,nodeId:d?.nodeId,itemMetadata:V});return(0,T.useRenderElement)("div",e,{state:{disabled:i,highlighted:g},props:[m,l,v],ref:[h,t,c.ref]})}),ei=a.forwardRef(function(e,t){let{render:n,className:r,id:o,label:s,closeOnClick:i=!1,...u}=e,l=a.useRef(null),c=$({label:s}),d=y(!0),f=d?.nodeId,p=(0,J.useBaseUiId)(o),{store:g}=I(),m=g.useState("isActive",c.index),v=g.useState("itemProps"),h=g.context.typingRef,{getButtonProps:b,buttonRef:x}=(0,U.useButton)({native:!1,composite:!0}),E=W({closeOnClick:i,highlighted:m,id:p,nodeId:f,store:g,typingRef:h,itemRef:l}),S=a.useMemo(()=>({highlighted:m}),[m]);return(0,T.useRenderElement)("a",e,{state:S,props:[v,u,function(e){return(0,B.mergeProps)(E,e,b)}],ref:[l,x,t,c.ref]})});var eu=e.i(88306),el=e.i(61896),ec=e.i(60752),ed=e.i(92238),ef=e.i(18847);let ep={...k.popupStateMapping,...w.transitionStatusMapping},eg=a.forwardRef(function(e,t){let{render:n,className:r,finalFocus:s,...i}=e,{store:u}=I(),{side:l,align:c}=y(),d=null!=(0,ec.useToolbarRootContext)(!0),f=u.useState("open"),p=u.useState("transitionStatus"),g=u.useState("popupProps"),m=u.useState("mounted"),v=u.useState("instantType"),h=u.useState("activeTriggerElement"),b=u.useState("parent"),x=u.useState("lastOpenChangeReason"),E=u.useState("rootId"),S=u.useState("floatingRootContext"),R=u.useState("floatingTreeRoot"),C=u.useState("closeDelay"),k=u.useState("activeTriggerElement"),O="context-menu"===b.type;(0,et.useOpenChangeComplete)({open:f,ref:u.context.popupRef,onComplete(){f&&u.context.onOpenChangeComplete?.(!0)}}),a.useEffect(()=>{function e(e){u.setOpen(!1,(0,Q.createChangeEventDetails)(e.reason,e.domEvent))}return R.events.on("close",e),()=>{R.events.off("close",e)}},[R.events,u]);let w=u.useState("hoverEnabled"),M=u.useState("disabled");(0,el.useHoverFloatingInteraction)(S,{enabled:w&&!M&&!O&&"menubar"!==b.type,closeDelay:C});let N={transitionStatus:p,side:l,align:c,open:f,nested:"menu"===b.type,instant:v},P=a.useCallback(e=>{u.set("popupElement",e)},[u]),D=(0,T.useRenderElement)("div",e,{state:N,ref:[t,u.context.popupRef,P],stateAttributesMapping:ep,props:[g,{onKeyDown(e){d&&ed.COMPOSITE_KEYS.has(e.key)&&e.stopPropagation()}},(0,ef.getDisabledMountTransitionStyles)(p),i,{"data-rootownerid":E}]}),L=void 0===b.type||O;return(h||"menubar"===b.type&&x!==A.REASONS.outsidePress)&&(L=!0),(0,o.jsx)(eu.FloatingFocusManager,{context:S,modal:O,disabled:!m,returnFocus:void 0===s?L:s,initialFocus:"menu"!==b.type,restoreFocus:!0,externalTree:"menubar"!==b.type?R:void 0,previousFocusableElement:k,nextFocusableElement:void 0===b.type?u.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:void 0===b.type?u.context.beforeContentFocusGuardRef:void 0,children:D})});var em=e.i(37692);let ev=a.createContext(void 0),eh=a.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:a}=I();return a.useState("mounted")||n?(0,o.jsx)(ev.Provider,{value:n,children:(0,o.jsx)(em.FloatingPortal,{ref:t,...r})}):null});var eb=e.i(58130),ex=e.i(66745),eE=e.i(51665),eS=e.i(56590),eR=e.i(30628);function ey(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:s}=e,i=(0,L.useStableCallback)(s),u=a.useRef(0),l=(0,eR.useRefWithInit)(eI).current,c=(0,eR.useRefWithInit)(eC).current,[d,f]=a.useState(0),p=a.useRef(d),g=(0,L.useStableCallback)((e,t)=>{c.set(e,t??null),p.current+=1,f(p.current)}),m=(0,L.useStableCallback)(e=>{c.delete(e),p.current+=1,f(p.current)}),v=a.useMemo(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(eT).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,d]);(0,z.useIsoLayoutEffect)(()=>{if("function"!=typeof MutationObserver||0===v.size)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),0===t.size&&(p.current+=1,f(p.current))});return v.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[v]),(0,z.useIsoLayoutEffect)(()=>{p.current===d&&(n.current.length!==v.size&&(n.current.length=v.size),r&&r.current.length!==v.size&&(r.current.length=v.size),u.current=v.size),i(v)},[i,v,n,r,d]),(0,z.useIsoLayoutEffect)(()=>()=>{n.current=[]},[n]),(0,z.useIsoLayoutEffect)(()=>()=>{r&&(r.current=[])},[r]);let h=(0,L.useStableCallback)(e=>(l.add(e),()=>{l.delete(e)}));(0,z.useIsoLayoutEffect)(()=>{l.forEach(e=>e(v))},[l,v]);let b=a.useMemo(()=>({register:g,unregister:m,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:u}),[g,m,h,n,r,u]);return(0,o.jsx)(K.Provider,{value:b,children:t})}function eC(){return new Map}function eI(){return new Set}function eT(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}var ek=e.i(36893),eO=e.i(7335),ew=e.i(67569),eM=e.i(77817);let eN=a.forwardRef(function(e,t){let{anchor:n,positionMethod:r="absolute",className:s,render:i,side:u,align:l,sideOffset:c=0,alignOffset:d=0,collisionBoundary:f="clipping-ancestors",collisionPadding:p=5,arrowPadding:g=5,sticky:m=!1,disableAnchorTracking:v=!1,collisionAvoidance:h=eO.DROPDOWN_COLLISION_AVOIDANCE,...b}=e,{store:x}=I(),E=function(){let e=a.useContext(ev);if(void 0===e)throw Error((0,S.default)(32));return e}(),y=N(!0),C=x.useState("parent"),O=x.useState("floatingRootContext"),w=x.useState("floatingTreeRoot"),M=x.useState("mounted"),P=x.useState("open"),D=x.useState("modal"),L=x.useState("activeTriggerElement"),F=x.useState("transitionStatus"),j=x.useState("positionerElement"),_=x.useState("instantType"),U=x.useState("hasViewport"),B=x.useState("lastOpenChangeReason"),H=x.useState("floatingNodeId"),W=x.useState("floatingParentNodeId"),V=O.useState("domReferenceElement"),G=a.useRef(null),K=(0,eM.useAnimationsFinished)(j,!1,!1),Y=n,$=c,J=d,q=l,X=h;"context-menu"===C.type&&(Y=n??C.context?.anchor,q=q??"start",u||"center"===q||(J=e.alignOffset??2,$=e.sideOffset??-5));let Z=u,ee=q;"menu"===C.type?(Z=Z??"inline-end",ee=ee??"start",X=e.collisionAvoidance??eO.POPUP_COLLISION_AVOIDANCE):"menubar"===C.type&&(Z=Z??"bottom",ee=ee??"start");let et="context-menu"===C.type,en=(0,eS.useAnchorPositioning)({anchor:Y,floatingRootContext:O,positionMethod:y?"fixed":r,mounted:M,side:Z,sideOffset:$,align:ee,alignOffset:J,arrowPadding:et?0:g,collisionBoundary:f,collisionPadding:p,sticky:m,nodeId:H,keepMounted:E,disableAnchorTracking:v,collisionAvoidance:X,shiftCrossAxis:et&&!("side"in X&&"flip"===X.side),externalTree:w,adaptiveOrigin:U?ew.adaptiveOrigin:void 0}),er=a.useMemo(()=>{let e={};return P||(e.pointerEvents="none"),{role:"presentation",hidden:!M,style:{...en.positionerStyles,...e}}},[P,M,en.positionerStyles]);a.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===H&&x.set("hoverEnabled",!1),e.nodeId!==H&&e.parentNodeId===x.select("floatingParentNodeId")&&x.setOpen(!1,(0,Q.createChangeEventDetails)(A.REASONS.siblingOpen)))}return w.events.on("menuopenchange",e),()=>{w.events.off("menuopenchange",e)}},[x,w.events,H]),a.useEffect(()=>{if(null!=x.select("floatingParentNodeId"))return w.events.on("menuopenchange",e),()=>{w.events.off("menuopenchange",e)};function e(e){if(e.open||e.nodeId!==x.select("floatingParentNodeId"))return;let t=e.reason??A.REASONS.siblingOpen;x.setOpen(!1,(0,Q.createChangeEventDetails)(t))}},[w.events,x]);let eo=(0,ex.useTimeout)();a.useEffect(()=>{P||eo.clear()},[P,eo]),a.useEffect(()=>{function e(e){if(P&&e.nodeId===x.select("floatingParentNodeId"))if(e.target&&L&&L!==e.target){let e=x.select("closeDelay");e>0?eo.isStarted()||eo.start(e,()=>{x.setOpen(!1,(0,Q.createChangeEventDetails)(A.REASONS.siblingOpen))}):x.setOpen(!1,(0,Q.createChangeEventDetails)(A.REASONS.siblingOpen))}else eo.clear()}return w.events.on("itemhover",e),()=>{w.events.off("itemhover",e)}},[w.events,P,L,x,eo]),a.useEffect(()=>{let e={open:P,nodeId:H,parentNodeId:W,reason:x.select("lastOpenChangeReason")};w.events.emit("menuopenchange",e)},[w.events,P,x,H,W]),(0,z.useIsoLayoutEffect)(()=>{let e=G.current;if(V&&(G.current=V),e&&V&&V!==e){x.set("instantType",void 0);let e=new AbortController;return K(()=>{x.set("instantType","trigger-change")},e.signal),()=>{e.abort()}}},[V,K,x]);let ea={open:P,side:en.side,align:en.align,anchorHidden:en.anchorHidden,nested:"menu"===C.type,instant:_},es=a.useMemo(()=>({side:en.side,align:en.align,arrowRef:en.arrowRef,arrowUncentered:en.arrowUncentered,arrowStyles:en.arrowStyles,nodeId:en.context.nodeId}),[en.side,en.align,en.arrowRef,en.arrowUncentered,en.arrowStyles,en.context.nodeId]),ei=(0,T.useRenderElement)("div",e,{state:ea,stateAttributesMapping:k.popupStateMapping,ref:[t,x.useStateSetter("positionerElement")],props:[er,(0,ef.getDisabledMountTransitionStyles)(F),b]}),eu=M&&"menu"!==C.type&&("menubar"!==C.type&&D&&B!==A.REASONS.triggerHover||"menubar"===C.type&&C.context.modal),el=null;return"menubar"===C.type?el=C.context.contentElement:void 0===C.type&&(el=L),(0,o.jsxs)(R.Provider,{value:es,children:[eu&&(0,o.jsx)(ek.InternalBackdrop,{ref:"context-menu"===C.type||"nested-context-menu"===C.type?C.context.internalBackdropRef:null,inert:(0,eb.inertValue)(!P),cutout:el}),(0,o.jsx)(eE.FloatingNode,{id:H,children:(0,o.jsx)(ey,{elementsRef:x.context.itemDomElements,labelsRef:x.context.itemLabels,children:ei})})]})}),eA=a.createContext(void 0),eP=a.memo(a.forwardRef(function(e,t){let{render:n,className:r,value:s,defaultValue:i,onValueChange:u,disabled:l=!1,...c}=e,[d,f]=(0,F.useControlled)({controlled:s,default:i,name:"MenuRadioGroup"}),p=(0,L.useStableCallback)(u),g=(0,L.useStableCallback)((e,t)=>{p?.(e,t),t.isCanceled||f(e)}),m=(0,T.useRenderElement)("div",e,{state:{disabled:l},ref:t,props:{role:"group","aria-disabled":l||void 0,...c}}),v=a.useMemo(()=>({value:d,setValue:g,disabled:l}),[d,g,l]);return(0,o.jsx)(eA.Provider,{value:v,children:m})})),eD=a.createContext(void 0),eL=a.forwardRef(function(e,t){let{render:n,className:r,id:s,label:i,nativeButton:u=!1,disabled:l=!1,closeOnClick:c=!1,value:d,...f}=e,p=$({label:i}),g=y(!0),m=(0,J.useBaseUiId)(s),{store:v}=I(),h=v.useState("isActive",p.index),b=v.useState("itemProps"),{value:x,setValue:E,disabled:R}=function(){let e=a.useContext(eA);if(void 0===e)throw Error((0,S.default)(34));return e}(),C=R||l,k=x===d,{getItemProps:O,itemRef:w}=G({closeOnClick:c,disabled:C,highlighted:h,id:m,store:v,nativeButton:u,nodeId:g?.nodeId,itemMetadata:V}),M=a.useMemo(()=>({disabled:C,highlighted:h,checked:k}),[C,h,k]),N=(0,L.useStableCallback)(e=>{E(d,{...(0,Q.createChangeEventDetails)(A.REASONS.itemPress,e.nativeEvent),preventUnmountOnClose:()=>{}})}),P=(0,T.useRenderElement)("div",e,{state:M,stateAttributesMapping:X,props:[b,{role:"menuitemradio","aria-checked":k,onClick:N},f,O],ref:[w,t,p.ref]});return(0,o.jsx)(eD.Provider,{value:M,children:P})}),eF=a.forwardRef(function(e,t){let{render:n,className:r,keepMounted:o=!1,...s}=e,i=function(){let e=a.useContext(eD);if(void 0===e)throw Error((0,S.default)(35));return e}(),u=a.useRef(null),{transitionStatus:l,setMounted:c}=(0,ee.useTransitionStatus)(i.checked);(0,et.useOpenChangeComplete)({open:i.checked,ref:u,onComplete(){i.checked||c(!1)}});let d={checked:i.checked,disabled:i.disabled,highlighted:i.highlighted,transitionStatus:l};return(0,T.useRenderElement)("span",e,{state:d,stateAttributesMapping:X,ref:[t,u],props:{"aria-hidden":!0,...s},enabled:o||i.checked})});var ej=e.i(83799),e_=e.i(58509),eU=e.i(66196),eB=e.i(17514),eH=e.i(3851),eW=e.i(33605),eV=e.i(89633),eG=e.i(29315),ez=e.i(231),eK=e.i(90219),eY=e.i(47857),e$=e.i(82033),eJ=e.i(43801),eq=e.i(98442),eX=e.i(494);function eQ(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function eZ(e,t){return eQ(t,e===eX.ARROW_UP||e===eX.ARROW_DOWN,e===eX.ARROW_LEFT||e===eX.ARROW_RIGHT)}function e0(e,t,n){return eQ(t,e===eX.ARROW_DOWN,n?e===eX.ARROW_LEFT:e===eX.ARROW_RIGHT)||"Enter"===e||" "===e||""===e}var e1=e.i(26665),e2=e.i(6157);let e5=a.createContext(null);function e9(e){let t=a.useContext(e5);if(null===t&&!e)throw Error((0,S.default)(5));return t}var e6=e.i(79144),e8=e.i(50091),e7=e.i(83921),e3=e.i(98263),e4=e.i(89429),te=e.i(628),tt=e.i(69375);let tn={...te.popupStoreSelectors,disabled:(0,e7.createSelector)(e=>"menubar"===e.parent.type&&e.parent.context.disabled||e.disabled),modal:(0,e7.createSelector)(e=>(void 0===e.parent.type||"context-menu"===e.parent.type)&&(e.modal??!0)),allowMouseEnter:(0,e7.createSelector)(e=>e.allowMouseEnter),stickIfOpen:(0,e7.createSelector)(e=>e.stickIfOpen),parent:(0,e7.createSelector)(e=>e.parent),rootId:(0,e7.createSelector)(e=>"menu"===e.parent.type?e.parent.store.select("rootId"):void 0!==e.parent.type?e.parent.context.rootId:e.rootId),activeIndex:(0,e7.createSelector)(e=>e.activeIndex),isActive:(0,e7.createSelector)((e,t)=>e.activeIndex===t),hoverEnabled:(0,e7.createSelector)(e=>e.hoverEnabled),instantType:(0,e7.createSelector)(e=>e.instantType),lastOpenChangeReason:(0,e7.createSelector)(e=>e.openChangeReason),floatingTreeRoot:(0,e7.createSelector)(e=>"menu"===e.parent.type?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:(0,e7.createSelector)(e=>e.floatingNodeId),floatingParentNodeId:(0,e7.createSelector)(e=>e.floatingParentNodeId),itemProps:(0,e7.createSelector)(e=>e.itemProps),closeDelay:(0,e7.createSelector)(e=>e.closeDelay),hasViewport:(0,e7.createSelector)(e=>e.hasViewport),keyboardEventRelay:(0,e7.createSelector)(e=>e.keyboardEventRelay?e.keyboardEventRelay:"menu"===e.parent.type?e.parent.store.select("keyboardEventRelay"):void 0)};class tr extends e3.ReactStore{constructor(e){super({...{...(0,te.createInitialPopupStoreState)(),disabled:!1,modal:!0,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new e4.FloatingTreeStore,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:eB.EMPTY_OBJECT,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1},...e},{positionerRef:a.createRef(),popupRef:a.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:a.createRef(),beforeContentFocusGuardRef:a.createRef(),onOpenChangeComplete:void 0,triggerElements:new tt.PopupTriggerMap},tn),this.unsubscribeParentListener=this.observe("parent",e=>{if(this.unsubscribeParentListener?.(),"menu"===e.type){let t=e.store.select("rootId"),n=e.store.select("floatingTreeRoot"),r=e.store.select("keyboardEventRelay");this.unsubscribeParentListener=e.store.subscribe(()=>{let o=e.store.select("rootId"),a=e.store.select("floatingTreeRoot"),s=e.store.select("keyboardEventRelay");(t!==o||n!==a||r!==s)&&(t=o,n=a,r=s,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}void 0!==e.type&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit("setOpen",{open:e,eventDetails:t})}static useStore(e,t){let n=(0,eR.useRefWithInit)(()=>new tr(t)).current;return e??n}unsubscribeParentListener=null}var to=e.i(58642);let ta=a.createContext(void 0);function ts(){return a.useContext(ta)}let ti=(0,eH.fastComponent)(function(e){let t,n,{children:r,open:s,onOpenChange:i,onOpenChangeComplete:u,defaultOpen:l=!1,disabled:c=!1,modal:d,loopFocus:f=!0,orientation:p="vertical",actionsRef:g,closeParentOnEsc:m=!1,handle:v,triggerId:h,defaultTriggerId:b=null,highlightItemOnHover:x=!0}=e,E=N(!0),S=I(!0),R=e9(!0),y=ts(),T=a.useMemo(()=>y&&S?{type:"menu",store:S.store}:R?{type:"menubar",context:R}:E&&!S?{type:"context-menu",context:E}:{type:void 0},[E,S,R,y]),k=tr.useStore(v?.store,{open:l,openProp:s,activeTriggerId:b,triggerIdProp:h,parent:T});(0,e_.useOnFirstRender)(()=>{void 0===s&&!1===k.state.open&&!0===l&&k.update({open:!0,activeTriggerId:b})}),k.useControlledProp("openProp",s),k.useControlledProp("triggerIdProp",h),k.useContextCallback("onOpenChangeComplete",u);let O=k.useState("floatingTreeRoot"),w=(0,eE.useFloatingNodeId)(O),M=(0,eE.useFloatingParentNodeId)();(0,z.useIsoLayoutEffect)(()=>{E&&!S?k.update({parent:{type:"context-menu",context:E},floatingNodeId:w,floatingParentNodeId:M}):S&&k.update({floatingNodeId:w,floatingParentNodeId:M})},[E,S,w,M,k]);let P=k.useState("open"),D=k.useState("activeTriggerElement"),F=k.useState("positionerElement"),j=k.useState("hoverEnabled"),_=k.useState("modal"),U=k.useState("disabled"),H=k.useState("lastOpenChangeReason"),W=k.useState("parent"),V=k.useState("activeIndex"),G=k.useState("payload"),K=k.useState("floatingParentNodeId"),Y=a.useRef(null),$=null!=K;k.useSyncedValues({disabled:c,modal:void 0===W.type?d:void 0,rootId:(0,ej.useId)()});let{openMethod:J,triggerProps:q}=(0,e8.useOpenInteractionType)(P);(0,to.useImplicitActiveTrigger)(k);let{forceUnmount:X}=(0,to.useOpenStateTransitions)(P,k,()=>{k.update({allowMouseEnter:!1,stickIfOpen:!0})}),Z=a.useRef("context-menu"!==W.type),ee=(0,ex.useTimeout)();a.useEffect(()=>{if(P||(Y.current=null),"context-menu"===W.type){if(!P){ee.clear(),Z.current=!1;return}ee.start(500,()=>{Z.current=!0})}},[ee,P,W.type]),(0,eU.useScrollLock)(P&&_&&H!==A.REASONS.triggerHover&&"touch"!==J,F),(0,z.useIsoLayoutEffect)(()=>{P||j||k.set("hoverEnabled",!0)},[P,j,k]);let et=a.useRef(!0),en=(0,ex.useTimeout)(),er=(0,L.useStableCallback)((e,n)=>{let r=n.reason;if(P===e&&n.trigger===D&&H===r||(n.preventUnmountOnClose=()=>{k.set("preventUnmountingOnClose",!0)},e||null!=n.trigger||(n.trigger=D??void 0),i?.(e,n),n.isCanceled))return;let o={open:e,nativeEvent:n.event,reason:n.reason,nested:$};t?.emit("openchange",o);let a=n.event;if(!1===e&&a?.type==="click"&&"touch"===a.pointerType&&!et.current)return;if(!e&&null!==V){let e=k.context.itemDomElements.current[V];queueMicrotask(()=>{e?.setAttribute("tabindex","-1")})}e&&r===A.REASONS.triggerFocus?(et.current=!1,en.start(300,()=>{et.current=!0})):(et.current=!0,en.clear());let s=(r===A.REASONS.triggerPress||r===A.REASONS.itemPress)&&0===a.detail&&a?.isTrusted,u=!e&&(r===A.REASONS.escapeKey||null==r),l={open:e,openChangeReason:r};Y.current=n.event??null;let c=n.trigger?.id??null;(c||e)&&(l.activeTriggerId=c,l.activeTriggerElement=n.trigger??null),k.update(l),"menubar"===W.type&&(r===A.REASONS.triggerFocus||r===A.REASONS.focusOut||r===A.REASONS.triggerHover||r===A.REASONS.listNavigation||r===A.REASONS.siblingOpen)?k.set("instantType","group"):s||u?k.set("instantType",s?"click":"dismiss"):k.set("instantType",void 0)}),eo=a.useCallback(e=>{let t=(0,Q.createChangeEventDetails)(e);return t.preventUnmountOnClose=()=>{k.set("preventUnmountingOnClose",!0)},t},[k]),ea=a.useCallback(()=>{k.setOpen(!1,eo(A.REASONS.imperativeAction))},[k,eo]);a.useImperativeHandle(g,()=>({unmount:X,close:ea}),[X,ea]),"context-menu"===W.type&&(n=W.context),a.useImperativeHandle(n?.positionerRef,()=>F,[F]),a.useImperativeHandle(n?.actionsRef,()=>({setOpen:er}),[er]);let es=(0,e2.useSyncedFloatingRootContext)({popupStore:k,onOpenChange:er});t=es.context.events,a.useEffect(()=>{let e=({open:e,eventDetails:t})=>er(e,t);return t.on("setOpen",e),()=>{t?.off("setOpen",e)}},[t,er]);let ei=(0,eW.useDismiss)(es,{enabled:!U,bubbles:{escapeKey:m&&"menu"===W.type},outsidePress:()=>"context-menu"!==W.type||Y.current?.type==="contextmenu"||Z.current,externalTree:$?O:void 0}),eu=(0,e1.useRole)(es,{role:"menu"}),el=(0,e6.useDirection)(),ec=a.useCallback(e=>{k.select("activeIndex")!==e&&k.set("activeIndex",e)},[k]),ed=function(e,t){let n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),i=n.context.dataRef,{listRef:u,activeIndex:l,onNavigate:c=()=>{},enabled:d=!0,selectedIndex:f=null,allowEscape:p=!1,loopFocus:g=!1,nested:m=!1,rtl:v=!1,virtual:h=!1,focusItemOnOpen:b="auto",focusItemOnHover:x=!0,openOnArrowKeyDown:E=!0,disabledIndices:S,orientation:R="vertical",parentOrientation:y,cols:C=1,id:I,resetOnPointerLeave:T=!0,externalTree:k}=t,O=(0,eY.getFloatingFocusElement)(o),w=(0,ez.useValueAsRef)(O),M=(0,eE.useFloatingParentNodeId)(),N=(0,eE.useFloatingTree)(k);(0,z.useIsoLayoutEffect)(()=>{i.current.orientation=R},[i,R]);let P=(0,eY.isTypeableCombobox)(s),D=a.useRef(b),F=a.useRef(f??-1),j=a.useRef(null),_=a.useRef(!0),U=(0,L.useStableCallback)(e=>{c(-1===F.current?null:F.current,e)}),B=a.useRef(U),H=a.useRef(!!o),W=a.useRef(r),V=a.useRef(!1),G=a.useRef(!1),K=(0,ez.useValueAsRef)(S),Y=(0,ez.useValueAsRef)(r),$=(0,ez.useValueAsRef)(f),J=(0,ez.useValueAsRef)(T),q=(0,L.useStableCallback)(()=>{function e(e){h?N?.events.emit("virtualfocus",e):(0,eq.enqueueFocus)(e,{sync:V.current,preventScroll:!0})}let t=u.current[F.current],n=G.current;t&&e(t),(V.current?e=>e():requestAnimationFrame)(()=>{let r=u.current[F.current]||t;!r||(t||e(r),Z&&(n||!_.current)&&r.scrollIntoView?.({block:"nearest",inline:"nearest"}))})});(0,z.useIsoLayoutEffect)(()=>{d&&(r&&o?(F.current=f??-1,D.current&&null!=f&&(G.current=!0,U())):H.current&&(F.current=-1,B.current()))},[d,r,o,f,U]),(0,z.useIsoLayoutEffect)(()=>{if(d){if(!r){V.current=!1;return}if(o)if(null==l){if(V.current=!1,null!=$.current)return;if(H.current&&(F.current=-1,q()),(!W.current||!H.current)&&D.current&&(null!=j.current||!0===D.current&&null==j.current)){let e=0,t=()=>{null==u.current[0]?(e<2&&(e?requestAnimationFrame:queueMicrotask)(t),e+=1):(F.current=null==j.current||e0(j.current,R,v)||m?(0,eJ.getMinListIndex)(u):(0,eJ.getMaxListIndex)(u),j.current=null,U())};t()}}else(0,eJ.isIndexOutOfListBounds)(u,l)||(F.current=l,q(),G.current=!1)}},[d,r,o,l,$,m,u,R,v,U,q,K]),(0,z.useIsoLayoutEffect)(()=>{if(!d||o||!N||h||!H.current)return;let e=N.nodesRef.current,t=e.find(e=>e.id===M)?.context?.elements.floating,n=(0,eY.activeElement)((0,eK.ownerDocument)(o)),r=e.some(e=>e.context&&(0,eY.contains)(e.context.elements.floating,n));t&&!r&&_.current&&t.focus({preventScroll:!0})},[d,o,N,M,h]),(0,z.useIsoLayoutEffect)(()=>{B.current=U,W.current=r,H.current=!!o}),(0,z.useIsoLayoutEffect)(()=>{r||(j.current=null,D.current=b)},[r,b]);let X=null!=l,Z=a.useMemo(()=>{function e(e){if(!Y.current)return;let t=u.current.indexOf(e.currentTarget);-1!==t&&F.current!==t&&(F.current=t,U(e))}return{onFocus(t){V.current=!0,e(t)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(t){V.current=!0,G.current=!1,x&&e(t)},onPointerLeave(e){if(!Y.current||!_.current||"touch"===e.pointerType)return;V.current=!0;let t=e.relatedTarget;if(!(!x||u.current.includes(t))&&J.current&&((0,eq.enqueueFocus)(null,{sync:!0}),F.current=-1,U(e),!h)){let e=w.current,t=(0,eY.activeElement)((0,eK.ownerDocument)(e));e&&(0,eY.contains)(e,t)&&e.focus({preventScroll:!0})}}}},[Y,w,x,u,U,J,h]),ee=a.useCallback(()=>y??N?.nodesRef.current.find(e=>e.id===M)?.context?.dataRef?.current.orientation,[M,N,y]),et=(0,L.useStableCallback)(e=>{var t;let o,a;if(_.current=!1,V.current=!0,229===e.which||!Y.current&&e.currentTarget===w.current)return;if(m&&(t=e.key,o=v?t===eX.ARROW_RIGHT:t===eX.ARROW_LEFT,a=t===eX.ARROW_UP,"both"===R||"horizontal"===R&&C&&C>1?"Escape"===t:eQ(R,o,a))){eZ(e.key,ee())||(0,e$.stopEvent)(e),n.setOpen(!1,(0,Q.createChangeEventDetails)(A.REASONS.listNavigation,e.nativeEvent)),(0,eG.isHTMLElement)(s)&&(h?N?.events.emit("virtualfocus",s):s.focus());return}let i=F.current,l=(0,eJ.getMinListIndex)(u,S),c=(0,eJ.getMaxListIndex)(u,S);if(P||("Home"===e.key&&((0,e$.stopEvent)(e),F.current=l,U(e)),"End"===e.key&&((0,e$.stopEvent)(e),F.current=c,U(e))),C>1){let t=Array.from({length:u.current.length},()=>({width:1,height:1})),n=(0,eJ.createGridCellMap)(t,C,!1),r=n.findIndex(e=>null!=e&&!(0,eJ.isListIndexDisabled)(u,e,S)),o=n.reduce((e,t,n)=>null==t||(0,eJ.isListIndexDisabled)(u,t,S)?e:n,-1),a=n[(0,eJ.getGridNavigatedIndex)({current:n.map(e=>null!=e?u.current[e]:null)},{event:e,orientation:R,loopFocus:g,rtl:v,cols:C,disabledIndices:(0,eJ.getGridCellIndices)([...("function"!=typeof S?S:null)||u.current.map((e,t)=>(0,eJ.isListIndexDisabled)(u,t,S)?t:void 0),void 0],n),minIndex:r,maxIndex:o,prevIndex:(0,eJ.getGridCellIndexOfCorner)(F.current>c?l:F.current,t,n,C,e.key===eX.ARROW_DOWN?"bl":e.key===(v?eX.ARROW_LEFT:eX.ARROW_RIGHT)?"tr":"tl"),stopEvent:!0})];if(null!=a&&(F.current=a,U(e)),"both"===R)return}if(eZ(e.key,R)){if((0,e$.stopEvent)(e),r&&!h&&(0,eY.activeElement)(e.currentTarget.ownerDocument)===e.currentTarget){F.current=e0(e.key,R,v)?l:c,U(e);return}e0(e.key,R,v)?g?i>=c?p&&i!==u.current.length?F.current=-1:(V.current=!1,F.current=l):F.current=(0,eJ.findNonDisabledListIndex)(u,{startingIndex:i,disabledIndices:S}):F.current=Math.min(c,(0,eJ.findNonDisabledListIndex)(u,{startingIndex:i,disabledIndices:S})):g?i<=l?p&&-1!==i?F.current=u.current.length:(V.current=!1,F.current=c):F.current=(0,eJ.findNonDisabledListIndex)(u,{startingIndex:i,decrement:!0,disabledIndices:S}):F.current=Math.max(l,(0,eJ.findNonDisabledListIndex)(u,{startingIndex:i,decrement:!0,disabledIndices:S})),(0,eJ.isIndexOutOfListBounds)(u,F.current)&&(F.current=-1),U(e)}}),en=a.useMemo(()=>h&&r&&X&&{"aria-activedescendant":`${I}-${l}`},[h,r,X,I,l]),er=a.useMemo(()=>({"aria-orientation":"both"===R?void 0:R,...!P?en:{},onKeyDown(e){if("Tab"===e.key&&e.shiftKey&&r&&!h){let t=(0,eY.getTarget)(e.nativeEvent);if(t&&!(0,eY.contains)(w.current,t))return;(0,e$.stopEvent)(e),n.setOpen(!1,(0,Q.createChangeEventDetails)(A.REASONS.focusOut,e.nativeEvent)),(0,eG.isHTMLElement)(s)&&s.focus();return}et(e)},onPointerMove(){_.current=!0}}),[en,et,w,R,P,n,r,h,s]),eo=a.useMemo(()=>{function e(e){"auto"===b&&(0,e$.isVirtualClick)(e.nativeEvent)&&(D.current=!h)}function t(e){D.current=b,"auto"===b&&(0,e$.isVirtualPointerEvent)(e.nativeEvent)&&(D.current=!0)}return{onKeyDown(e){var t,r;let o=n.select("open");_.current=!1;let a=e.key.startsWith("Arrow"),s=(t=e.key,r=ee(),eQ(r,v?t===eX.ARROW_LEFT:t===eX.ARROW_RIGHT,t===eX.ARROW_DOWN)),i=eZ(e.key,R),l=(m?s:i)||"Enter"===e.key||""===e.key.trim();if(h&&o)return et(e);if(o||E||!a){if(l){let t=eZ(e.key,ee());j.current=m&&t?null:e.key}if(m){s&&((0,e$.stopEvent)(e),o?(F.current=(0,eJ.getMinListIndex)(u,K.current),U(e)):n.setOpen(!0,(0,Q.createChangeEventDetails)(A.REASONS.listNavigation,e.nativeEvent,e.currentTarget)));return}i&&(null!=$.current&&(F.current=$.current),(0,e$.stopEvent)(e),!o&&E?n.setOpen(!0,(0,Q.createChangeEventDetails)(A.REASONS.listNavigation,e.nativeEvent,e.currentTarget)):et(e),o&&U(e))}},onFocus(e){n.select("open")&&!h&&(F.current=-1,U(e))},onPointerDown:t,onPointerEnter:t,onMouseDown:e,onClick:e}},[et,K,b,u,m,U,n,E,R,ee,v,$,h]),ea=a.useMemo(()=>({...en,...eo}),[en,eo]);return a.useMemo(()=>d?{reference:ea,floating:er,item:Z,trigger:eo}:{},[d,ea,er,eo,Z])}(es,{enabled:!U,listRef:k.context.itemDomElements,activeIndex:V,nested:void 0!==W.type,loopFocus:f,orientation:p,parentOrientation:"menubar"===W.type?W.context.orientation:void 0,rtl:"rtl"===el,disabledIndices:eB.EMPTY_ARRAY,onNavigate:ec,openOnArrowKeyDown:"context-menu"!==W.type,externalTree:$?O:void 0,focusItemOnHover:x}),ef=a.useCallback(e=>{k.context.typingRef.current=e},[k]),ep=function(e,t){let n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,o=n.useState("open"),{listRef:s,elementsRef:i,activeIndex:u,onMatch:l,onTypingChange:c,enabled:d=!0,resetMs:f=750,selectedIndex:p=null}=t,g=(0,ex.useTimeout)(),m=a.useRef(""),v=a.useRef(p??u??-1),h=a.useRef(null);(0,z.useIsoLayoutEffect)(()=>{(o||null===p)&&(g.clear(),h.current=null,""!==m.current&&(m.current=""))},[o,p,g]),(0,z.useIsoLayoutEffect)(()=>{o&&""===m.current&&(v.current=p??u??-1)},[o,p,u]);let b=(0,L.useStableCallback)(e=>{e?r.current.typing||(r.current.typing=e,c?.(e)):r.current.typing&&(r.current.typing=e,c?.(e))}),x=(0,L.useStableCallback)(e=>{function t(e,n,r=0){if(0===e.length)return -1;let o=(r%e.length+e.length)%e.length,a=n.toLocaleLowerCase();for(let t=0;t<e.length;t+=1){let n=(o+t)%e.length,r=e[n];if(r?.toLocaleLowerCase().startsWith(a)&&function(e){let t=i?.current[e];return!t||(0,eJ.isElementVisible)(t)}(n))return n}return -1}let n=s.current;if(m.current.length>0&&" "===e.key&&((0,e$.stopEvent)(e),b(!0)),m.current.length>0&&" "!==m.current[0]&&-1===t(n,m.current)&&" "!==e.key&&b(!1),null==n||1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey)return;o&&" "!==e.key&&((0,e$.stopEvent)(e),b(!0));let r=""===m.current;r&&(v.current=p??u??-1),n.every(e=>!e||e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase())&&m.current===e.key&&(m.current="",v.current=h.current),m.current+=e.key,g.start(f,()=>{m.current="",v.current=h.current,b(!1)});let a=r?p??u??-1:v.current,c=t(n,m.current,(a??0)+1);-1!==c?(l?.(c),h.current=c):" "!==e.key&&(m.current="",b(!1))}),E=(0,L.useStableCallback)(e=>{let t=e.relatedTarget,r=n.select("domReferenceElement"),o=n.select("floatingElement"),a=(0,eY.contains)(r,t),s=(0,eY.contains)(o,t);a||s||(g.clear(),m.current="",v.current=h.current,b(!1))}),S=a.useMemo(()=>({onKeyDown:x,onBlur:E}),[x,E]),R=a.useMemo(()=>({onKeyDown:x,onBlur:E}),[x,E]);return a.useMemo(()=>d?{reference:S,floating:R}:{},[d,S,R])}(es,{listRef:k.context.itemLabels,elementsRef:k.context.itemDomElements,activeIndex:V,resetMs:eO.TYPEAHEAD_RESET_MS,onMatch:e=>{P&&e!==V&&k.set("activeIndex",e)},onTypingChange:ef}),{getReferenceProps:eg,getFloatingProps:em,getItemProps:ev,getTriggerProps:eh}=(0,eV.useInteractions)([ei,eu,ed,ep]),eb=a.useMemo(()=>{let e=(0,B.mergeProps)(eg(),{onMouseMove(){k.set("allowMouseEnter",!0)}},q);return delete e.role,e},[eg,k,q]),eS=a.useMemo(()=>{let e=eh();if(!e)return e;let t=(0,B.mergeProps)(e,q);return delete t.role,delete t["aria-controls"],t},[eh,q]),eR=a.useMemo(()=>em({onMouseMove(){k.set("allowMouseEnter",!0),"menu"===W.type&&k.set("hoverEnabled",!1)},onClick(){k.select("hoverEnabled")&&k.set("hoverEnabled",!1)},onKeyDown(e){let t=k.select("keyboardEventRelay");t&&!e.isPropagationStopped()&&t(e)}}),[em,W.type,k]),ey=a.useMemo(()=>ev(),[ev]);k.useSyncedValues({floatingRootContext:es,activeTriggerProps:eb,inactiveTriggerProps:eS,popupProps:eR,itemProps:ey});let eC=a.useMemo(()=>({store:k,parent:T}),[k,T]),eI=(0,o.jsx)(C.Provider,{value:eC,children:"function"==typeof r?r({payload:G}):r});return void 0===W.type||"context-menu"===W.type?(0,o.jsx)(eE.FloatingTree,{externalTree:O,children:eI}):eI});var tu=e.i(74080),tl=e.i(37287),tc=e.i(4012),td=e.i(32652);let tf=H.isMac&&H.isSafari;var tp=e.i(97254),tg=e.i(59266),tm=e.i(54694);function tv(e){let{render:t,className:n,state:r=eB.EMPTY_OBJECT,props:o=eB.EMPTY_ARRAY,refs:s=eB.EMPTY_ARRAY,metadata:i,stateAttributesMapping:u,tag:l="div",...c}=e,{compositeProps:d,compositeRef:f}=function(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=(0,tm.useCompositeRootContext)(),{ref:o,index:s}=$(e),i=n===s,u=a.useRef(null),l=(0,_.useMergedRefs)(o,u);return{compositeProps:a.useMemo(()=>({tabIndex:i?0:-1,onFocus(){r(s)},onMouseMove(){let e=u.current;if(!t||!e)return;let n=e.hasAttribute("disabled")||"true"===e.ariaDisabled;i||n||e.focus()}}),[i,r,s,t]),compositeRef:l,index:s}}({metadata:i});return(0,T.useRenderElement)(l,e,{state:r,ref:[...s,f],props:[d,...o,c],stateAttributesMapping:u})}var th=e.i(72408);let tb=(0,eH.fastComponentRef)(function(e,t){let n,r,s,{render:i,className:u,disabled:l=!1,nativeButton:c=!0,id:d,openOnHover:f,delay:p=100,closeDelay:g=0,handle:m,payload:v,...h}=e,b=I(!0),x=m?.store??b?.store;if(!x)throw Error((0,S.default)(85));let E=(0,J.useBaseUiId)(d),R=x.useState("isTriggerActive",E),y=x.useState("floatingRootContext"),C=x.useState("isOpenedByTrigger",E),O=a.useRef(null),w=(n=N(!0),r=I(!0),s=e9(!0),a.useMemo(()=>s?{type:"menubar",context:s}:n&&!r?{type:"context-menu",context:n}:{type:void 0},[n,r,s])),M=(0,tm.useCompositeRootContext)(!0),P=(0,eE.useFloatingTree)(),D=a.useMemo(()=>P??new e4.FloatingTreeStore,[P]),F=(0,eE.useFloatingNodeId)(D),j=(0,eE.useFloatingParentNodeId)(),{registerTrigger:_,isMountedByThisTrigger:B}=(0,to.useTriggerDataForwarding)(E,O,x,{payload:v,closeDelay:g,parent:w,floatingTreeRoot:D,floatingNodeId:F,floatingParentNodeId:j,keyboardEventRelay:M?.relayKeyboardEvent}),H="menubar"===w.type,W=x.useState("disabled"),V=l||W||H&&w.context.disabled,{getButtonProps:G,buttonRef:K}=(0,U.useButton)({disabled:V,native:c});a.useEffect(()=>{C||void 0!==w.type||(x.context.allowMouseUpTriggerRef.current=!1)},[x,C,w.type]);let Y=a.useRef(null),$=(0,ex.useTimeout)(),q=(0,L.useStableCallback)(e=>{if(!Y.current)return;$.clear(),x.context.allowMouseUpTriggerRef.current=!1;let t=e.target;if((0,eY.contains)(Y.current,t)||(0,eY.contains)(x.select("positionerElement"),t)||t===Y.current||null!=t&&function e(t){return(0,eG.isHTMLElement)(t)&&t.hasAttribute("data-rootownerid")?t.getAttribute("data-rootownerid")??void 0:(0,eG.isLastTraversableNode)(t)?void 0:e((0,eG.getParentNode)(t))}(t)===x.select("rootId"))return;let n=function(e){let t=e.getBoundingClientRect(),n=window.getComputedStyle(e,"::before"),r=window.getComputedStyle(e,"::after");if("none"===n.content&&"none"===r.content)return t;let o=parseFloat(n.width)||0,a=parseFloat(n.height)||0,s=parseFloat(r.width)||0,i=parseFloat(r.height)||0,u=Math.max(t.width,o,s),l=Math.max(t.height,a,i),c=u-t.width,d=l-t.height;return{left:t.left-c/2,right:t.right+c/2,top:t.top-d/2,bottom:t.bottom+d/2}}(Y.current);e.clientX>=n.left-2&&e.clientX<=n.right+2&&e.clientY>=n.top-2&&e.clientY<=n.bottom+2||D.events.emit("close",{domEvent:e,reason:A.REASONS.cancelOpen})});a.useEffect(()=>{C&&x.select("lastOpenChangeReason")===A.REASONS.triggerHover&&(0,eK.ownerDocument)(Y.current).addEventListener("mouseup",q,{once:!0})},[C,q,x]);let X=H&&w.context.hasSubmenuOpen,Z=f??X,ee=(0,tp.useHoverReferenceInteraction)(y,{enabled:Z&&!V&&"context-menu"!==w.type&&(!H||X&&!B),handleClose:(0,tl.safePolygon)({blockPointerEvents:!H}),mouseOnly:!0,move:!1,restMs:void 0===w.type?p:void 0,delay:{close:g},triggerElementRef:O,externalTree:D,isActiveTrigger:R}),et=function(e,t){let n=(0,ex.useTimeout)(),[r,o]=a.useState(!1);return(0,z.useIsoLayoutEffect)(()=>{e&&"trigger-hover"===t?(o(!0),n.start(eO.PATIENT_CLICK_THRESHOLD,()=>{o(!1)})):e||(n.clear(),o(!1))},[e,t,n]),r}(C,x.select("lastOpenChangeReason")),en=(0,tc.useClick)(y,{enabled:!V&&"context-menu"!==w.type,event:C&&H?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:void 0===w.type&&et}),er=function(e,t={}){let n="rootStore"in e?e.rootStore:e,{events:r,dataRef:o}=n.context,{enabled:s=!0,delay:i}=t,u=a.useRef(!1),l=a.useRef(null),c=(0,ex.useTimeout)(),d=a.useRef(!0);a.useEffect(()=>{let e=n.select("domReferenceElement");if(!s)return;let t=(0,eG.getWindow)(e);function r(){let e=n.select("domReferenceElement");!n.select("open")&&(0,eG.isHTMLElement)(e)&&e===(0,eY.activeElement)((0,eK.ownerDocument)(e))&&(u.current=!0)}function o(){d.current=!0}function a(){d.current=!1}return t.addEventListener("blur",r),tf&&(t.addEventListener("keydown",o,!0),t.addEventListener("pointerdown",a,!0)),()=>{t.removeEventListener("blur",r),tf&&(t.removeEventListener("keydown",o,!0),t.removeEventListener("pointerdown",a,!0))}},[n,s]),a.useEffect(()=>{if(s)return r.on("openchange",e),()=>{r.off("openchange",e)};function e(e){if(e.reason===A.REASONS.triggerPress||e.reason===A.REASONS.escapeKey){let e=n.select("domReferenceElement");(0,eG.isElement)(e)&&(l.current=e,u.current=!0)}}},[r,s,n]);let f=a.useMemo(()=>({onMouseLeave(){u.current=!1,l.current=null},onFocus(e){let t=e.currentTarget;if(u.current){if(l.current===t)return;u.current=!1,l.current=null}let r=(0,eY.getTarget)(e.nativeEvent);if((0,eG.isElement)(r)){if(tf&&!e.relatedTarget){if(!d.current&&!(0,eY.isTypeableElement)(r))return}else if(!(0,eY.matchesFocusVisible)(r))return}let o=(0,eY.isTargetInsideEnabledTrigger)(e.relatedTarget,n.context.triggerElements),{nativeEvent:a,currentTarget:s}=e,f="function"==typeof i?i():i;n.select("open")&&o||0===f||void 0===f?n.setOpen(!0,(0,Q.createChangeEventDetails)(A.REASONS.triggerFocus,a,s)):c.start(f,()=>{u.current||n.setOpen(!0,(0,Q.createChangeEventDetails)(A.REASONS.triggerFocus,a,s))})},onBlur(e){u.current=!1,l.current=null;let t=e.relatedTarget,r=e.nativeEvent,a=(0,eG.isElement)(t)&&t.hasAttribute((0,td.createAttribute)("focus-guard"))&&"outside"===t.getAttribute("data-type");c.start(0,()=>{let e=n.select("domReferenceElement"),s=(0,eY.activeElement)(e?e.ownerDocument:document);if(!t&&s===e||(0,eY.contains)(o.current.floatingContext?.refs.floating.current,s)||(0,eY.contains)(e,s)||a)return;let i=t??s;(0,eY.isTargetInsideEnabledTrigger)(i,n.context.triggerElements)||n.setOpen(!1,(0,Q.createChangeEventDetails)(A.REASONS.triggerFocus,r))})}}),[o,n,c,i]);return a.useMemo(()=>s?{reference:f,trigger:f}:{},[s,f])}(y,{enabled:!V&&X}),eo=function(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,o=a.useRef(!1);return a.useMemo(()=>t?{onMouseDown:e=>{("open"===n&&!r||"close"===n&&r)&&(o.current=!0,(0,eK.ownerDocument)(e.currentTarget).addEventListener("click",()=>{o.current=!1},{once:!0}))},onClick:e=>{o.current&&(o.current=!1,e.preventBaseUIHandler())}}:eB.EMPTY_OBJECT,[t,n,r])}({open:C,enabled:H,mouseDownAction:"open"}),ea=(0,eV.useInteractions)([en,er]),es={disabled:V,open:C},ei=x.useState("triggerProps",B),eu=[Y,t,K,_,O],el=[ea.getReferenceProps(),ee??eB.EMPTY_OBJECT,ei,{"aria-haspopup":"menu",id:E,onMouseDown:e=>{x.select("open")||($.start(200,()=>{x.context.allowMouseUpTriggerRef.current=!0}),(0,eK.ownerDocument)(e.currentTarget).addEventListener("mouseup",q,{once:!0}))}},H?{role:"menuitem"}:{},eo,h,G],ec=a.useRef(null),ed=(0,L.useStableCallback)(e=>{tu.flushSync(()=>{x.setOpen(!1,(0,Q.createChangeEventDetails)(A.REASONS.focusOut,e.nativeEvent,e.currentTarget))});let t=(0,tg.getTabbableBeforeElement)(ec.current);t?.focus()}),ef=(0,L.useStableCallback)(e=>{let t=x.select("positionerElement");if(t&&(0,tg.isOutsideEvent)(e,t))x.context.beforeContentFocusGuardRef.current?.focus();else{tu.flushSync(()=>{x.setOpen(!1,(0,Q.createChangeEventDetails)(A.REASONS.focusOut,e.nativeEvent,e.currentTarget))});let n=(0,tg.getTabbableAfterElement)(x.context.triggerFocusTargetRef.current||O.current);for(;null!==n&&(0,eY.contains)(t,n);){let e=n;if((n=(0,tg.getNextTabbable)(n))===e)break}n?.focus()}}),ep=(0,T.useRenderElement)("button",e,{enabled:!H,stateAttributesMapping:k.pressableTriggerOpenStateMapping,state:es,ref:eu,props:el});return H?(0,o.jsx)(tv,{tag:"button",render:i,className:u,state:es,refs:eu,props:el,stateAttributesMapping:k.pressableTriggerOpenStateMapping}):C?(0,o.jsxs)(a.Fragment,{children:[(0,o.jsx)(th.FocusGuard,{ref:ec,onFocus:ed},`${E}-pre-focus-guard`),(0,o.jsx)(a.Fragment,{children:ep},E),(0,o.jsx)(th.FocusGuard,{ref:x.context.triggerFocusTargetRef,onFocus:ef},`${E}-post-focus-guard`)]}):(0,o.jsx)(a.Fragment,{children:ep},E)});var tx=e.i(12666);let tE=((r={}).popupWidth="--popup-width",r.popupHeight="--popup-height",r),tS={activationDirection:e=>e?{"data-activation-direction":e}:null},tR=a.forwardRef(function(e,t){let{render:n,className:r,children:o,...a}=e,{store:s}=I(),{side:i}=y(),u=s.useState("instantType"),{children:l,state:c}=(0,tx.usePopupViewport)({store:s,side:i,cssVars:tE,children:o}),d={activationDirection:c.activationDirection,transitioning:c.transitioning,instant:u};return(0,T.useRenderElement)("div",e,{state:d,ref:t,props:[a,{children:l}],stateAttributesMapping:tS})}),ty=a.forwardRef(function(e,t){let{className:n,render:r,orientation:o="horizontal",...a}=e;return(0,T.useRenderElement)("div",e,{state:{orientation:o},ref:t,props:[{role:"separator","aria-orientation":o},a]})}),tC=a.forwardRef(function(e,t){let{render:n,className:r,label:o,id:s,nativeButton:i=!1,openOnHover:u=!0,delay:l=100,closeDelay:c=0,disabled:d=!1,...f}=e,p=$(),g=y(),{store:m}=I(),v=(0,J.useBaseUiId)(s),h=m.useState("open"),b=m.useState("floatingRootContext"),x=m.useState("floatingTreeRoot"),E=(0,to.useTriggerRegistration)(v,m),R=a.useCallback(e=>{let t=E(e);return null!==e&&m.select("open")&&null==m.select("activeTriggerId")&&m.update({activeTriggerId:v,activeTriggerElement:e,closeDelay:c}),t},[E,c,m,v]),C=a.useRef(null),O=a.useCallback(e=>{C.current=e,m.set("activeTriggerElement",e)},[m]),w=ts();if(!w?.parentMenu)throw Error((0,S.default)(37));m.useSyncedValue("closeDelay",c);let M=w.parentMenu,N=M.useState("itemProps"),A=M.useState("isActive",p.index),P=a.useMemo(()=>({type:"submenu-trigger",setActive(){M.set("activeIndex",p.index)}}),[M,p.index]),D=m.useState("disabled"),L=d||D,{getItemProps:F,itemRef:j}=G({closeOnClick:!1,disabled:L,highlighted:A,id:v,store:m,typingRef:M.context.typingRef,nativeButton:i,itemMetadata:P,nodeId:g?.nodeId}),_=m.useState("hoverEnabled"),U=M.useState("allowMouseEnter"),B=(0,tp.useHoverReferenceInteraction)(b,{enabled:_&&u&&!L,handleClose:(0,tl.safePolygon)({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:l,delay:U?{open:l,close:c}:0,triggerElementRef:C,externalTree:x}),H=(0,tc.useClick)(b,{enabled:!L,event:"mousedown",toggle:!u,ignoreMouse:u,stickIfOpen:!1}),W=(0,eV.useInteractions)([H]),V=m.useState("triggerProps",!0);return delete V.id,(0,T.useRenderElement)("div",e,{state:{disabled:L,highlighted:A,open:h},stateAttributesMapping:k.triggerOpenStateMapping,props:[W.getReferenceProps(),B,V,N,{tabIndex:h||A?0:-1,onBlur(){A&&M.set("activeIndex",null)}},f,F],ref:[t,p.ref,j,R,O]})});class tI{constructor(){this.store=new tr}open(e){let t=e?this.store.context.triggerElements.getById(e):void 0;if(e&&!t)throw Error((0,S.default)(83,e));this.store.setOpen(!0,(0,Q.createChangeEventDetails)("imperative-action",void 0,t))}close(){this.store.setOpen(!1,(0,Q.createChangeEventDetails)("imperative-action",void 0,void 0))}get isOpen(){return this.store.state.open}}e.s(["Arrow",0,O,"Backdrop",0,D,"CheckboxItem",0,Z,"CheckboxItemIndicator",0,en,"Group",0,eo,"GroupLabel",0,ea,"Handle",0,tI,"Item",0,es,"LinkItem",0,ei,"Popup",0,eg,"Portal",0,eh,"Positioner",0,eN,"RadioGroup",0,eP,"RadioItem",0,eL,"RadioItemIndicator",0,eF,"Root",0,ti,"Separator",0,ty,"SubmenuRoot",0,function(e){let t=I().store,n=a.useMemo(()=>({parentMenu:t}),[t]);return(0,o.jsx)(ta.Provider,{value:n,children:(0,o.jsx)(ti,{...e})})},"SubmenuTrigger",0,tC,"Trigger",0,tb,"Viewport",0,tR,"createHandle",0,function(){return new tI}],30250);var tT=e.i(30250),tT=tT,tk=e.i(52088);function tO({...e}){return(0,o.jsx)(tT.Root,{"data-slot":"dropdown-menu",...e})}function tw({...e}){return(0,o.jsx)(tT.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function tM({align:e="start",alignOffset:t=0,side:n="bottom",sideOffset:r=4,className:a,...s}){return(0,o.jsx)(tT.Portal,{children:(0,o.jsx)(tT.Positioner,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:n,sideOffset:r,children:(0,o.jsx)(tT.Popup,{"data-slot":"dropdown-menu-content",className:(0,tk.cn)("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",a),...s})})})}function tN({className:e,inset:t,variant:n="default",...r}){return(0,o.jsx)(tT.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:(0,tk.cn)("group/dropdown-menu-item relative flex min-h-7 cursor-default items-center gap-2 rounded-md px-2 py-1 text-xs/relaxed outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7.5 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 data-[variant=destructive]:*:[svg]:text-destructive",e),...r})}function tA({className:e,...t}){return(0,o.jsx)(tT.Separator,{"data-slot":"dropdown-menu-separator",className:(0,tk.cn)("-mx-1 my-1 h-px bg-border/50",e),...t})}e.i(46349),e.i(78784),e.s(["default",0,function({params:e}){let{id:t}=(0,a.use)(e),n=(0,s.useRouter)(),r=(0,g.useToast)(),[v,h]=(0,a.useState)(null),[S,R]=(0,a.useState)([]),[y,C]=(0,a.useState)(),[I,T]=(0,a.useState)(!0),[k,O]=(0,a.useState)(!1),[w,M]=(0,a.useState)(!1),[N,A]=(0,a.useState)(!0),P=(0,a.useRef)(null);(0,m.useDocumentTitle)(v?.title);let D=(0,a.useRef)(null),L=(0,a.useCallback)(async()=>{if(null!==D.current&&D.current!==t&&A(!0),D.current=t,N){T(!0);try{let e=await fetch((0,d.apiUrl)(`/api/tasks/${t}`));if(!e.ok)throw Error("Failed to fetch task");let n=(await e.json()).data.task,r=n.tabs||[];if(0===r.length){let e=await fetch((0,d.apiUrl)(`/api/tasks/${t}/tabs`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});e.ok&&(r=[(await e.json()).data.tab])}h(n),R(r),r.length>0&&C(r[0].tab_id)}catch(e){console.error("Failed to load data:",e)}finally{T(!1),A(!1)}}},[t,N]);(0,a.useEffect)(()=>{L()},[t,L]);let F=async(e,t)=>{let n=r.loading("Updating task...");try{if(!(await fetch((0,d.apiUrl)(`/api/tasks/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).ok)throw Error("Failed to update task");return r.success(n,"Successfully updated task"),{success:!0}}catch(t){console.error("Failed to update task:",t);let e=t instanceof Error?t.message:"Failed to update task";return r.error(n,"Failed to update task",e),{success:!1,errors:[{field:"global",message:"Failed to update task"}]}}},j=async()=>{try{let e=await fetch((0,d.apiUrl)(`/api/tasks/${t}/tabs`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!e.ok)throw Error("Failed to create tab");let n=(await e.json()).data.tab;return R(e=>e.some(e=>e.tab_id===n.tab_id)?e:[...e,n]),C(n.tab_id),n.tab_id}catch(e){console.error("Failed to create tab:",e);return}},_=async e=>{try{if(!(await fetch((0,d.apiUrl)(`/api/tasks/${t}/tabs/${e}`),{method:"DELETE"})).ok)throw Error("Failed to delete tab");if(R(t=>t.filter(t=>t.tab_id!==e)),y===e){let t=S.filter(t=>t.tab_id!==e);C(t[0]?.tab_id)}}catch(e){console.error("Failed to delete tab:",e)}};return I&&!v?(0,o.jsx)("div",{className:"h-screen flex items-center justify-center bg-background",children:(0,o.jsx)(p.LoadingSpinner,{size:"lg",message:"Loading task..."})}):v?(0,o.jsxs)("div",{className:"h-screen flex flex-col bg-background",children:[(0,o.jsx)("div",{className:"sticky top-0 z-50 p-4 border-b border-border bg-card",children:(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)(b.Button,{variant:"ghost",onClick:()=>n.push("/"),className:"text-primary font-medium hover:bg-primary/10 hover:text-foreground",children:[(0,o.jsx)(i.ArrowLeft,{className:"w-4 h-4"}),"Back to Board"]}),(0,o.jsx)("h1",{className:"text-base font-semibold text-foreground absolute left-1/2 -translate-x-1/2 max-w-[50vw] truncate",children:v.title}),(0,o.jsxs)(tO,{children:[(0,o.jsx)(tw,{render:(0,o.jsx)(b.Button,{variant:"ghost",size:"icon-lg",className:"text-primary hover:bg-primary/10 hover:text-foreground",title:"Task menu"}),children:(0,o.jsx)(u,{className:"w-5 h-5"})}),(0,o.jsxs)(tM,{align:"end",children:[(0,o.jsxs)(tN,{onClick:()=>O(!0),children:[(0,o.jsx)(l.Pencil,{className:"w-4 h-4"}),"Detail / Edit"]}),(0,o.jsx)(tA,{}),(0,o.jsxs)(tN,{className:"text-destructive focus:text-destructive",onClick:()=>M(!0),children:[(0,o.jsx)(c.Trash2,{className:"w-4 h-4"}),"Delete"]})]})]})]})}),(0,o.jsx)("div",{className:"flex-1 flex flex-col min-h-0",children:(0,o.jsx)("div",{className:"bg-card flex flex-col flex-1 min-h-0",children:(0,o.jsx)(x,{ref:P,task:v,tabs:S,activeTabId:y,onTabChange:C,onTabCreate:j,onTabDelete:_})})}),(0,o.jsx)(f.TaskDialog,{mode:"edit",isOpen:k,onClose:()=>O(!1),task:v,onUpdate:F}),(0,o.jsx)(E.ConfirmDialog,{open:w,onOpenChange:e=>M(e.open),title:"Delete Task",message:`Delete task "${v.title}"?
|
|
2
|
+
|
|
3
|
+
This will also delete the worktree and branch.`,confirmLabel:"Delete",cancelLabel:"Cancel",onConfirm:()=>{if(!v)return;let e=r.loading("Deleting task...",v.title);fetch((0,d.apiUrl)(`/api/tasks/${v.id}`),{method:"DELETE"}).then(()=>{r.success(e,"Successfully deleted task",v.title)}).catch(t=>{let n=t instanceof Error?t.message:"Unknown error";r.error(e,"Failed to delete task",n)}),n.push("/")},variant:"danger"})]}):(0,o.jsx)("div",{className:"h-screen flex items-center justify-center bg-background",children:(0,o.jsx)("div",{className:"text-center text-foreground",children:"Task not found"})})}],97099)}]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,55716,e=>{"use strict";let t=(0,e.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"}]]);e.s(["GitBranch",0,t],55716)},7233,5352,e=>{"use strict";let t=(0,e.i(75254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["Plus",0,t],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"}];e.s(["getRepoColor",0,function(e,t){let r=function(e){let t=5381;for(let a=0;a<e.length;a++)t=33*t^e.charCodeAt(a);return t>>>0}(`${e}/${t}`)%a.length;return a[r]}],5352)},18566,(e,t,a)=>{t.exports=e.r(76562)},43531,78745,e=>{"use strict";let t=(0,e.i(75254).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["default",0,t],78745),e.s(["Check",0,t],43531)},86536,e=>{"use strict";let t=(0,e.i(75254).default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);e.s(["Eye",0,t],86536)},27612,e=>{"use strict";let t=(0,e.i(75254).default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);e.s(["Trash2",0,t],27612)},10012,24564,94349,e=>{"use strict";var t,a=e.i(18050);e.i(47167);var r=e.i(71645);e.s([],19485),e.i(19485);var s=e.i(76477),l=e.i(67805),i=e.i(17514);let n=((t={}).disabled="data-disabled",t.valid="data-valid",t.invalid="data-invalid",t.touched="data-touched",t.dirty="data-dirty",t.filled="data-filled",t.focused="data-focused",t),o={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},d={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},c={disabled:!1,...d},u={valid:e=>null===e?null:e?{[n.valid]:""}:{[n.invalid]:""}},f=r.createContext({invalid:void 0,name:void 0,validityData:{state:o,errors:[],error:"",value:"",initialValue:null},setValidityData:i.NOOP,disabled:void 0,touched:d.touched,setTouched:i.NOOP,dirty:d.dirty,setDirty:i.NOOP,filled:d.filled,setFilled:i.NOOP,focused:d.focused,setFocused:i.NOOP,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:c,markedDirtyRef:{current:!1},validation:{getValidationProps:(e=i.EMPTY_OBJECT)=>e,getInputValidationProps:(e=i.EMPTY_OBJECT)=>e,inputRef:{current:null},commit:async()=>{}}});function m(e=!0){let t=r.useContext(f);if(t.setValidityData===i.NOOP&&!e)throw Error((0,l.default)(28));return t}let p=r.createContext({legendId:void 0,setLegendId:()=>{},disabled:void 0}),h=r.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:i.NOOP,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function v(){return r.useContext(h)}var x=e.i(30628),g=e.i(19805),b=e.i(89879);let y=r.createContext({controlId:void 0,registerControlId:i.NOOP,labelId:void 0,setLabelId:i.NOOP,messageIds:[],setMessageIds:i.NOOP,getDescriptionProps:e=>e});function k(){return r.useContext(y)}let w=function(e){let t=(0,b.useBaseUiId)(),l=void 0===e.controlId?t:e.controlId,[i,n]=r.useState(l),[o,d]=r.useState(e.labelId),[c,u]=r.useState([]),f=(0,x.useRefWithInit)(()=>new Map),{messageIds:m}=k(),p=(0,s.useStableCallback)((e,t)=>{let a=f.current;void 0===t?a.delete(e):(a.set(e,t),n(e=>{let t;if(0!==a.size){for(let r of a.values()){if(void 0!==e&&r===e)return e;void 0===t&&(t=r)}return t}}))}),h=r.useCallback(e=>(0,g.mergeProps)({"aria-describedby":m.concat(c).join(" ")||void 0},e),[m,c]),v=r.useMemo(()=>({controlId:i,registerControlId:p,labelId:o,setLabelId:d,messageIds:c,setMessageIds:u,getDescriptionProps:h}),[i,p,o,d,c,u,h]);return(0,a.jsx)(y.Provider,{value:v,children:e.children})};var j=e.i(27601),N=e.i(66745);function C(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}let E=Object.keys(o),S=r.forwardRef(function(e,t){let{errors:n,validationMode:d,submitAttemptedRef:c}=v(),{render:m,className:h,validate:x,validationDebounceTime:b=0,validationMode:y=d,name:w,disabled:S=!1,invalid:T,dirty:O,touched:I,actionsRef:P,...R}=e,{disabled:M}=function(e=!1){let t=r.useContext(p);if(!t&&!e)throw Error((0,l.default)(86));return t}(),A=(0,s.useStableCallback)(x||(()=>null)),D=M||S,[F,L]=r.useState(!1),[U,B]=r.useState(!1),[V,_]=r.useState(!1),[z,$]=r.useState(!1),H=O??U,K=I??F,J=r.useRef(!1),G=(0,s.useStableCallback)(e=>{void 0===O&&(e&&(J.current=!0),B(e))}),q=(0,s.useStableCallback)(e=>{void 0===I&&L(e)}),Y=(0,s.useStableCallback)(()=>"onChange"===y||"onSubmit"===y&&c.current),W=!!w&&Object.hasOwn(n,w)&&void 0!==n[w],X=!0===T||W,[Z,Q]=r.useState({state:o,error:"",errors:[],value:null,initialValue:null}),ee=!X&&Z.state.valid,et=r.useMemo(()=>({disabled:D,touched:K,dirty:H,valid:ee,filled:V,focused:z}),[D,K,H,ee,V,z]),ea=function(e){let{formRef:t,clearErrors:a}=v(),{setValidityData:l,validate:n,validityData:d,validationDebounceTime:c,invalid:u,markedDirtyRef:f,state:m,name:p,shouldValidateOnChange:h}=e,{controlId:x,getDescriptionProps:b}=k(),y=(0,N.useTimeout)(),w=r.useRef(null),j=(0,s.useStableCallback)(async(e,a=!1)=>{let r,s=w.current;if(!s)return;if(a){if(!1!==m.valid)return;let a=s.validity;if(!a.valueMissing){let a={value:e,state:{...o,valid:!0},error:"",errors:[],initialValue:d.initialValue};if(s.setCustomValidity(""),x){let e=t.current.fields.get(x);e&&t.current.fields.set(x,{...e,...C(a,!1)})}l(a);return}let r=E.reduce((e,t)=>(e[t]=a[t],e),{});if(!r.valid&&!function(e){if(!e||e.valid||!e.valueMissing)return!1;let t=!1;for(let a of E)"valid"!==a&&("valueMissing"===a&&(t=e[a]),e[a]&&(t=!1));return t}(r))return}y.clear();let i=null,c=[],p=function(e){let t=E.reduce((t,a)=>(t[a]=e.validity[a],t),{}),a=!1;for(let e of E)if("valid"!==e){if("valueMissing"===e&&t[e])a=!0;else if(t[e])return t}return a&&!f.current&&(t.valid=!0,t.valueMissing=!1),t}(s),v=h();if(s.validationMessage&&!v)r=s.validationMessage,c=[s.validationMessage];else{let a=n(e,Array.from(t.current.fields.values()).reduce((e,t)=>(t.name&&(e[t.name]=t.getValue()),e),{}));null!==(i="object"==typeof a&&null!==a&&"then"in a?await a:a)?(p.valid=!1,p.customError=!0,Array.isArray(i)?(c=i,s.setCustomValidity(i.join("\n"))):i&&(c=[i],s.setCustomValidity(i))):v&&(s.setCustomValidity(""),p.customError=!1,s.validationMessage?(r=s.validationMessage,c=[s.validationMessage]):s.validity.valid&&!p.valid&&(p.valid=!0))}let g={value:e,state:p,error:r??(Array.isArray(i)?i[0]:i??""),errors:c,initialValue:d.initialValue};if(x){let e=t.current.fields.get(x);e&&t.current.fields.set(x,{...e,...C(g,u)})}l(g)}),S=r.useCallback((e={})=>(0,g.mergeProps)(b,!1===m.valid?{"aria-invalid":!0}:i.EMPTY_OBJECT,e),[b,m.valid]),T=r.useCallback((e={})=>(0,g.mergeProps)({onChange(e){if(e.nativeEvent.defaultPrevented)return;if(a(p),!h())return void j(e.currentTarget.value,!0);let t=e.currentTarget;""===t.value?j(t.value):(y.clear(),c?y.start(c,()=>{j(t.value)}):j(t.value))}},S(e)),[S,a,p,y,j,c,h]);return r.useMemo(()=>({getValidationProps:S,getInputValidationProps:T,inputRef:w,commit:j}),[S,T,j])}({setValidityData:Q,validate:A,validityData:Z,validationDebounceTime:b,invalid:X,markedDirtyRef:J,state:et,name:w,shouldValidateOnChange:Y}),er=r.useCallback(()=>{J.current=!0,ea.commit(Z.value)},[ea,Z]);r.useImperativeHandle(P,()=>({validate:er}),[er]);let es=r.useMemo(()=>({invalid:X,name:w,validityData:Z,setValidityData:Q,disabled:D,touched:K,setTouched:q,dirty:H,setDirty:G,filled:V,setFilled:_,focused:z,setFocused:$,validate:A,validationMode:y,validationDebounceTime:b,shouldValidateOnChange:Y,state:et,markedDirtyRef:J,validation:ea}),[X,w,Z,D,K,q,H,G,V,_,z,$,A,y,b,Y,et,ea]),el=(0,j.useRenderElement)("div",e,{ref:t,state:et,props:R,stateAttributesMapping:u});return(0,a.jsx)(f.Provider,{value:es,children:el})}),T=r.forwardRef(function(e,t){return(0,a.jsx)(w,{children:(0,a.jsx)(S,{...e,ref:t})})});var O=e.i(29315),I=e.i(90219),P=e.i(47857),R=e.i(977);function M(e,t){let a=(0,b.useBaseUiId)(e);return(0,R.useIsoLayoutEffect)(()=>(t(a),()=>{t(void 0)}),[a,t]),a}e.s(["useRegisteredLabelId",0,M],24564);let A=r.forwardRef(function(e,t){let{render:a,className:l,id:i,nativeLabel:n=!0,...o}=e,d=m(!1),{labelId:c}=k(),f=r.useRef(null),p=function(e={}){let{id:t,fallbackControlId:a,native:r=!1,setLabelId:l,focusControl:i}=e,{controlId:n,setLabelId:o}=k(),d=M(t,(0,s.useStableCallback)(e=>{o(e),l?.(e)})),c=n??a;function u(e){let t=(0,P.getTarget)(e.nativeEvent);t?.closest("button,input,select,textarea")||(!e.defaultPrevented&&e.detail>1&&e.preventDefault(),r||function(e){if(i)return i(e,c);if(!c)return;let t=(0,I.ownerDocument)(e.currentTarget).getElementById(c);(0,O.isHTMLElement)(t)&&t.focus({focusVisible:!0})}(e))}return r?{id:d,htmlFor:c??void 0,onMouseDown:u}:{id:d,onClick:u,onPointerDown(e){e.preventDefault()}}}({id:c??i,native:n});return(0,j.useRenderElement)("label",e,{ref:[t,f],state:d.state,props:[p,o],stateAttributesMapping:u})});var D=e.i(89269),F=e.i(84759),L=e.i(88841);let U={...u,...F.transitionStatusMapping},B=r.forwardRef(function(e,t){let{render:s,id:l,className:i,match:n,...o}=e,d=(0,b.useBaseUiId)(l),{validityData:c,state:u,name:f}=m(!1),{setMessageIds:p}=k(),{errors:h}=v(),x=f?h[f]:null,g=!1;g=!!x||!0===n||(n?!!c.state[n]:!1===c.state.valid);let{mounted:y,transitionStatus:w,setMounted:N}=(0,L.useTransitionStatus)(g);(0,R.useIsoLayoutEffect)(()=>{if(g&&d)return p(e=>e.concat(d)),()=>{p(e=>e.filter(e=>e!==d))}},[g,d,p]);let C=r.useRef(null),[E,S]=r.useState(null),[T,O]=r.useState(null),I=x||(c.errors.length>1?(0,a.jsx)("ul",{children:c.errors.map(e=>(0,a.jsx)("li",{children:e},e))}):c.error),P=c.error;null!=x?P=Array.isArray(x)?JSON.stringify(x):x:c.errors.length>1&&(P=JSON.stringify(c.errors)),g&&P!==T&&(O(P),S(I)),(0,D.useOpenChangeComplete)({open:g,ref:C,onComplete(){g||N(!1)}});let M={...u,transitionStatus:w},A=(0,j.useRenderElement)("div",e,{ref:[t,C],state:M,props:[{id:d,children:g?I:E},o],stateAttributesMapping:U,enabled:y});return y?A:null}),V=r.forwardRef(function(e,t){let{render:a,id:r,className:s,...l}=e,i=(0,b.useBaseUiId)(r),n=m(!1),{setMessageIds:o}=k();return(0,R.useIsoLayoutEffect)(()=>{if(i)return o(e=>e.concat(i)),()=>{o(e=>e.filter(e=>e!==i))}},[i,o]),(0,j.useRenderElement)("p",e,{ref:t,state:n.state,props:[{id:i},l],stateAttributesMapping:u})});function _({controlled:e,default:t,name:a,state:s="value"}){let{current:l}=r.useRef(void 0!==e),[i,n]=r.useState(t),o=r.useCallback(e=>{l||n(e)},[]);return[l?e:i,o]}e.s(["useControlled",0,_],94349);var z=e.i(74080),$=e.i(5963),H=e.i(3404);let K=r.forwardRef(function(e,t){let{render:a,className:l,id:n,name:o,value:d,disabled:c=!1,onValueChange:f,defaultValue:p,autoFocus:h=!1,...g}=e,{state:y,name:w,disabled:N,setTouched:E,setDirty:S,validityData:T,setFocused:M,setFilled:A,validationMode:D,validation:F}=m(),L=N||c,U=w??o,B={...y,disabled:L},{labelId:V}=k(),K=function(e={}){let{id:t,implicit:a=!1,controlRef:l}=e,{controlId:n,registerControlId:o}=k(),d=(0,b.useBaseUiId)(t),c=a?n:void 0,u=(0,x.useRefWithInit)(()=>Symbol("labelable-control")),f=r.useRef(!1),m=r.useRef(null!=t),p=(0,s.useStableCallback)(()=>{f.current&&o!==i.NOOP&&(f.current=!1,o(u.current,void 0))});return(0,R.useIsoLayoutEffect)(()=>{let e;if(o!==i.NOOP){if(a){let a=l?.current;e=(0,O.isElement)(a)&&null!=a.closest("label")?t??null:c??d}else if(null!=t)m.current=!0,e=t;else{if(!m.current)return void p();e=d}if(void 0===e)return void p();f.current=!0,o(u.current,e)}},[t,l,c,o,a,d,u,p]),r.useEffect(()=>p,[p]),n??d}({id:n});(0,R.useIsoLayoutEffect)(()=>{let e=null!=d;F.inputRef.current?.value||e&&""!==d?A(!0):e&&""===d&&A(!1)},[F.inputRef,A,d]);let J=r.useRef(null);(0,R.useIsoLayoutEffect)(()=>{h&&J.current===(0,P.activeElement)((0,I.ownerDocument)(J.current))&&M(!0)},[h,M]);let[G]=_({controlled:d,default:p,name:"FieldControl",state:"value"}),q=void 0!==d,Y=q?G:void 0;return!function(e){let{enabled:t=!0,value:a,id:r,name:l,controlRef:i,commit:n}=e,{formRef:o}=v(),{invalid:d,markedDirtyRef:c,validityData:u,setValidityData:f}=m(),p=(0,s.useStableCallback)(e.getValue);(0,R.useIsoLayoutEffect)(()=>{if(!t)return;let e=a;void 0===e&&(e=p()),null===u.initialValue&&null!==e&&f(t=>({...t,initialValue:e}))},[t,f,a,u.initialValue,p]),(0,R.useIsoLayoutEffect)(()=>{t&&r&&o.current.fields.set(r,{getValue:p,name:l,controlRef:i,validityData:C(u,d),validate(e=!0){let t=a;void 0===t&&(t=p()),c.current=!0,e?z.flushSync(()=>n(t)):n(t)}})},[n,i,t,o,p,r,d,c,l,u,a]),(0,R.useIsoLayoutEffect)(()=>{let e=o.current.fields;return()=>{r&&e.delete(r)}},[o,r])}({id:K,name:U,commit:F.commit,value:Y,getValue:()=>F.inputRef.current?.value,controlRef:F.inputRef}),(0,j.useRenderElement)("input",e,{ref:[t,J],state:B,props:[{id:K,disabled:L,name:U,ref:F.inputRef,"aria-labelledby":V,autoFocus:h,...q?{value:Y}:{defaultValue:p},onChange(e){let t=e.currentTarget.value;f?.(t,(0,$.createChangeEventDetails)(H.REASONS.none,e.nativeEvent)),S(t!==T.initialValue),A(""!==t)},onFocus(){M(!0)},onBlur(e){E(!0),M(!1),"onBlur"===D&&F.commit(e.currentTarget.value)},onKeyDown(e){"INPUT"===e.currentTarget.tagName&&"Enter"===e.key&&(E(!0),F.commit(e.currentTarget.value))}},F.getInputValidationProps(),g],stateAttributesMapping:u})}),J=r.createContext({disabled:!1}),G=r.createContext(void 0),q=r.forwardRef(function(e,t){let{render:s,className:i,disabled:n=!1,...o}=e,{state:d,disabled:c}=m(!1),f=c||n,p=function(e=!0){let t=r.useContext(G);if(void 0===t&&!e)throw Error((0,l.default)(3));return t}(),h=p?.parent.id,v=p?.allValues!==void 0,x=r.useMemo(()=>({disabled:f}),[f]),g=(0,j.useRenderElement)("div",e,{ref:t,state:d,props:o,stateAttributesMapping:u});return(0,a.jsx)(w,{controlId:v?h:void 0,children:(0,a.jsx)(J.Provider,{value:x,children:g})})});e.s(["Control",0,K,"Description",0,V,"Error",0,B,"Item",0,q,"Label",0,A,"Root",0,T,"Validity",0,function(e){let{children:t}=e,{validityData:s,invalid:l}=m(!1),i=r.useMemo(()=>C(s,l),[s,l]),n=!1===i.state.valid,{transitionStatus:o}=(0,L.useTransitionStatus)(n),d=r.useMemo(()=>({...i,validity:i.state,transitionStatus:o}),[i,o]);return(0,a.jsx)(r.Fragment,{children:t(d)})}],71975);var Y=e.i(71975),Y=Y;let W=r.forwardRef(function(e,t){return(0,a.jsx)(Y.Control,{ref:t,...e})});var X=e.i(52088);e.s(["Input",0,function({className:e,type:t,...r}){return(0,a.jsx)(W,{type:t,"data-slot":"input",className:(0,X.cn)("h-9 w-full min-w-0 rounded-md border border-input bg-input/20 px-3 py-1 text-sm transition-colors outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...r})}],10012)},37870,31278,e=>{"use strict";var t=e.i(18050),a=e.i(17521);e.s(["Loader2",()=>a.default],31278);var a=a;e.s(["LoadingSpinner",0,function({size:e="md",message:r}){return(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3",children:[(0,t.jsx)(a.default,{className:`${{sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"}[e]} text-primary animate-spin`}),r&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:r})]})}],37870)},63209,e=>{"use strict";let t=(0,e.i(75254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["AlertCircle",0,t],63209)},471,e=>{"use strict";let t=(0,e.i(75254).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",0,t],471)},46349,e=>{"use strict";let t=(0,e.i(75254).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["default",0,t])},88699,e=>{"use strict";let t=(0,e.i(75254).default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);e.s(["Pencil",0,t],88699)},82341,e=>{"use strict";var t=e.i(18050),a=e.i(71645),r=e.i(18566),s=e.i(471),l=e.i(70935),i=e.i(75254);let n=(0,i.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"}]]),o=(0,i.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),c=e.i(46349),c=c;let u=(0,i.default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);var f=e.i(85902);function m({node:e,isSelected:a,isExpanded:r,depth:s,onSelect:l,onToggle:i}){let p=e.children&&e.children.length>0;return(0,t.jsxs)("div",{onClick:()=>{l(),p&&i&&!r&&i()},className:`
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,55716,e=>{"use strict";let t=(0,e.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"}]]);e.s(["GitBranch",0,t],55716)},7233,5352,e=>{"use strict";let t=(0,e.i(75254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["Plus",0,t],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"}];e.s(["getRepoColor",0,function(e,t){let r=function(e){let t=5381;for(let a=0;a<e.length;a++)t=33*t^e.charCodeAt(a);return t>>>0}(`${e}/${t}`)%a.length;return a[r]}],5352)},18566,(e,t,a)=>{t.exports=e.r(76562)},43531,78745,e=>{"use strict";let t=(0,e.i(75254).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["default",0,t],78745),e.s(["Check",0,t],43531)},86536,e=>{"use strict";let t=(0,e.i(75254).default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);e.s(["Eye",0,t],86536)},27612,e=>{"use strict";let t=(0,e.i(75254).default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);e.s(["Trash2",0,t],27612)},10012,24564,94349,e=>{"use strict";var t,a=e.i(18050);e.i(47167);var r=e.i(71645);e.s([],19485),e.i(19485);var s=e.i(76477),l=e.i(67805),i=e.i(17514);let n=((t={}).disabled="data-disabled",t.valid="data-valid",t.invalid="data-invalid",t.touched="data-touched",t.dirty="data-dirty",t.filled="data-filled",t.focused="data-focused",t),o={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},d={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},c={disabled:!1,...d},u={valid:e=>null===e?null:e?{[n.valid]:""}:{[n.invalid]:""}},f=r.createContext({invalid:void 0,name:void 0,validityData:{state:o,errors:[],error:"",value:"",initialValue:null},setValidityData:i.NOOP,disabled:void 0,touched:d.touched,setTouched:i.NOOP,dirty:d.dirty,setDirty:i.NOOP,filled:d.filled,setFilled:i.NOOP,focused:d.focused,setFocused:i.NOOP,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:c,markedDirtyRef:{current:!1},validation:{getValidationProps:(e=i.EMPTY_OBJECT)=>e,getInputValidationProps:(e=i.EMPTY_OBJECT)=>e,inputRef:{current:null},commit:async()=>{}}});function m(e=!0){let t=r.useContext(f);if(t.setValidityData===i.NOOP&&!e)throw Error((0,l.default)(28));return t}let p=r.createContext({legendId:void 0,setLegendId:()=>{},disabled:void 0}),h=r.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:i.NOOP,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function v(){return r.useContext(h)}var x=e.i(30628),g=e.i(19805),b=e.i(89879);let y=r.createContext({controlId:void 0,registerControlId:i.NOOP,labelId:void 0,setLabelId:i.NOOP,messageIds:[],setMessageIds:i.NOOP,getDescriptionProps:e=>e});function k(){return r.useContext(y)}let w=function(e){let t=(0,b.useBaseUiId)(),l=void 0===e.controlId?t:e.controlId,[i,n]=r.useState(l),[o,d]=r.useState(e.labelId),[c,u]=r.useState([]),f=(0,x.useRefWithInit)(()=>new Map),{messageIds:m}=k(),p=(0,s.useStableCallback)((e,t)=>{let a=f.current;void 0===t?a.delete(e):(a.set(e,t),n(e=>{let t;if(0!==a.size){for(let r of a.values()){if(void 0!==e&&r===e)return e;void 0===t&&(t=r)}return t}}))}),h=r.useCallback(e=>(0,g.mergeProps)({"aria-describedby":m.concat(c).join(" ")||void 0},e),[m,c]),v=r.useMemo(()=>({controlId:i,registerControlId:p,labelId:o,setLabelId:d,messageIds:c,setMessageIds:u,getDescriptionProps:h}),[i,p,o,d,c,u,h]);return(0,a.jsx)(y.Provider,{value:v,children:e.children})};var j=e.i(27601),N=e.i(66745);function C(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}let E=Object.keys(o),S=r.forwardRef(function(e,t){let{errors:n,validationMode:d,submitAttemptedRef:c}=v(),{render:m,className:h,validate:x,validationDebounceTime:b=0,validationMode:y=d,name:w,disabled:S=!1,invalid:T,dirty:O,touched:I,actionsRef:P,...R}=e,{disabled:M}=function(e=!1){let t=r.useContext(p);if(!t&&!e)throw Error((0,l.default)(86));return t}(),A=(0,s.useStableCallback)(x||(()=>null)),D=M||S,[F,L]=r.useState(!1),[U,B]=r.useState(!1),[V,$]=r.useState(!1),[_,z]=r.useState(!1),H=O??U,K=I??F,J=r.useRef(!1),G=(0,s.useStableCallback)(e=>{void 0===O&&(e&&(J.current=!0),B(e))}),q=(0,s.useStableCallback)(e=>{void 0===I&&L(e)}),Y=(0,s.useStableCallback)(()=>"onChange"===y||"onSubmit"===y&&c.current),W=!!w&&Object.hasOwn(n,w)&&void 0!==n[w],X=!0===T||W,[Z,Q]=r.useState({state:o,error:"",errors:[],value:null,initialValue:null}),ee=!X&&Z.state.valid,et=r.useMemo(()=>({disabled:D,touched:K,dirty:H,valid:ee,filled:V,focused:_}),[D,K,H,ee,V,_]),ea=function(e){let{formRef:t,clearErrors:a}=v(),{setValidityData:l,validate:n,validityData:d,validationDebounceTime:c,invalid:u,markedDirtyRef:f,state:m,name:p,shouldValidateOnChange:h}=e,{controlId:x,getDescriptionProps:b}=k(),y=(0,N.useTimeout)(),w=r.useRef(null),j=(0,s.useStableCallback)(async(e,a=!1)=>{let r,s=w.current;if(!s)return;if(a){if(!1!==m.valid)return;let a=s.validity;if(!a.valueMissing){let a={value:e,state:{...o,valid:!0},error:"",errors:[],initialValue:d.initialValue};if(s.setCustomValidity(""),x){let e=t.current.fields.get(x);e&&t.current.fields.set(x,{...e,...C(a,!1)})}l(a);return}let r=E.reduce((e,t)=>(e[t]=a[t],e),{});if(!r.valid&&!function(e){if(!e||e.valid||!e.valueMissing)return!1;let t=!1;for(let a of E)"valid"!==a&&("valueMissing"===a&&(t=e[a]),e[a]&&(t=!1));return t}(r))return}y.clear();let i=null,c=[],p=function(e){let t=E.reduce((t,a)=>(t[a]=e.validity[a],t),{}),a=!1;for(let e of E)if("valid"!==e){if("valueMissing"===e&&t[e])a=!0;else if(t[e])return t}return a&&!f.current&&(t.valid=!0,t.valueMissing=!1),t}(s),v=h();if(s.validationMessage&&!v)r=s.validationMessage,c=[s.validationMessage];else{let a=n(e,Array.from(t.current.fields.values()).reduce((e,t)=>(t.name&&(e[t.name]=t.getValue()),e),{}));null!==(i="object"==typeof a&&null!==a&&"then"in a?await a:a)?(p.valid=!1,p.customError=!0,Array.isArray(i)?(c=i,s.setCustomValidity(i.join("\n"))):i&&(c=[i],s.setCustomValidity(i))):v&&(s.setCustomValidity(""),p.customError=!1,s.validationMessage?(r=s.validationMessage,c=[s.validationMessage]):s.validity.valid&&!p.valid&&(p.valid=!0))}let g={value:e,state:p,error:r??(Array.isArray(i)?i[0]:i??""),errors:c,initialValue:d.initialValue};if(x){let e=t.current.fields.get(x);e&&t.current.fields.set(x,{...e,...C(g,u)})}l(g)}),S=r.useCallback((e={})=>(0,g.mergeProps)(b,!1===m.valid?{"aria-invalid":!0}:i.EMPTY_OBJECT,e),[b,m.valid]),T=r.useCallback((e={})=>(0,g.mergeProps)({onChange(e){if(e.nativeEvent.defaultPrevented)return;if(a(p),!h())return void j(e.currentTarget.value,!0);let t=e.currentTarget;""===t.value?j(t.value):(y.clear(),c?y.start(c,()=>{j(t.value)}):j(t.value))}},S(e)),[S,a,p,y,j,c,h]);return r.useMemo(()=>({getValidationProps:S,getInputValidationProps:T,inputRef:w,commit:j}),[S,T,j])}({setValidityData:Q,validate:A,validityData:Z,validationDebounceTime:b,invalid:X,markedDirtyRef:J,state:et,name:w,shouldValidateOnChange:Y}),er=r.useCallback(()=>{J.current=!0,ea.commit(Z.value)},[ea,Z]);r.useImperativeHandle(P,()=>({validate:er}),[er]);let es=r.useMemo(()=>({invalid:X,name:w,validityData:Z,setValidityData:Q,disabled:D,touched:K,setTouched:q,dirty:H,setDirty:G,filled:V,setFilled:$,focused:_,setFocused:z,validate:A,validationMode:y,validationDebounceTime:b,shouldValidateOnChange:Y,state:et,markedDirtyRef:J,validation:ea}),[X,w,Z,D,K,q,H,G,V,$,_,z,A,y,b,Y,et,ea]),el=(0,j.useRenderElement)("div",e,{ref:t,state:et,props:R,stateAttributesMapping:u});return(0,a.jsx)(f.Provider,{value:es,children:el})}),T=r.forwardRef(function(e,t){return(0,a.jsx)(w,{children:(0,a.jsx)(S,{...e,ref:t})})});var O=e.i(29315),I=e.i(90219),P=e.i(47857),R=e.i(977);function M(e,t){let a=(0,b.useBaseUiId)(e);return(0,R.useIsoLayoutEffect)(()=>(t(a),()=>{t(void 0)}),[a,t]),a}e.s(["useRegisteredLabelId",0,M],24564);let A=r.forwardRef(function(e,t){let{render:a,className:l,id:i,nativeLabel:n=!0,...o}=e,d=m(!1),{labelId:c}=k(),f=r.useRef(null),p=function(e={}){let{id:t,fallbackControlId:a,native:r=!1,setLabelId:l,focusControl:i}=e,{controlId:n,setLabelId:o}=k(),d=M(t,(0,s.useStableCallback)(e=>{o(e),l?.(e)})),c=n??a;function u(e){let t=(0,P.getTarget)(e.nativeEvent);t?.closest("button,input,select,textarea")||(!e.defaultPrevented&&e.detail>1&&e.preventDefault(),r||function(e){if(i)return i(e,c);if(!c)return;let t=(0,I.ownerDocument)(e.currentTarget).getElementById(c);(0,O.isHTMLElement)(t)&&t.focus({focusVisible:!0})}(e))}return r?{id:d,htmlFor:c??void 0,onMouseDown:u}:{id:d,onClick:u,onPointerDown(e){e.preventDefault()}}}({id:c??i,native:n});return(0,j.useRenderElement)("label",e,{ref:[t,f],state:d.state,props:[p,o],stateAttributesMapping:u})});var D=e.i(89269),F=e.i(84759),L=e.i(88841);let U={...u,...F.transitionStatusMapping},B=r.forwardRef(function(e,t){let{render:s,id:l,className:i,match:n,...o}=e,d=(0,b.useBaseUiId)(l),{validityData:c,state:u,name:f}=m(!1),{setMessageIds:p}=k(),{errors:h}=v(),x=f?h[f]:null,g=!1;g=!!x||!0===n||(n?!!c.state[n]:!1===c.state.valid);let{mounted:y,transitionStatus:w,setMounted:N}=(0,L.useTransitionStatus)(g);(0,R.useIsoLayoutEffect)(()=>{if(g&&d)return p(e=>e.concat(d)),()=>{p(e=>e.filter(e=>e!==d))}},[g,d,p]);let C=r.useRef(null),[E,S]=r.useState(null),[T,O]=r.useState(null),I=x||(c.errors.length>1?(0,a.jsx)("ul",{children:c.errors.map(e=>(0,a.jsx)("li",{children:e},e))}):c.error),P=c.error;null!=x?P=Array.isArray(x)?JSON.stringify(x):x:c.errors.length>1&&(P=JSON.stringify(c.errors)),g&&P!==T&&(O(P),S(I)),(0,D.useOpenChangeComplete)({open:g,ref:C,onComplete(){g||N(!1)}});let M={...u,transitionStatus:w},A=(0,j.useRenderElement)("div",e,{ref:[t,C],state:M,props:[{id:d,children:g?I:E},o],stateAttributesMapping:U,enabled:y});return y?A:null}),V=r.forwardRef(function(e,t){let{render:a,id:r,className:s,...l}=e,i=(0,b.useBaseUiId)(r),n=m(!1),{setMessageIds:o}=k();return(0,R.useIsoLayoutEffect)(()=>{if(i)return o(e=>e.concat(i)),()=>{o(e=>e.filter(e=>e!==i))}},[i,o]),(0,j.useRenderElement)("p",e,{ref:t,state:n.state,props:[{id:i},l],stateAttributesMapping:u})});function $({controlled:e,default:t,name:a,state:s="value"}){let{current:l}=r.useRef(void 0!==e),[i,n]=r.useState(t),o=r.useCallback(e=>{l||n(e)},[]);return[l?e:i,o]}e.s(["useControlled",0,$],94349);var _=e.i(74080),z=e.i(5963),H=e.i(3404);let K=r.forwardRef(function(e,t){let{render:a,className:l,id:n,name:o,value:d,disabled:c=!1,onValueChange:f,defaultValue:p,autoFocus:h=!1,...g}=e,{state:y,name:w,disabled:N,setTouched:E,setDirty:S,validityData:T,setFocused:M,setFilled:A,validationMode:D,validation:F}=m(),L=N||c,U=w??o,B={...y,disabled:L},{labelId:V}=k(),K=function(e={}){let{id:t,implicit:a=!1,controlRef:l}=e,{controlId:n,registerControlId:o}=k(),d=(0,b.useBaseUiId)(t),c=a?n:void 0,u=(0,x.useRefWithInit)(()=>Symbol("labelable-control")),f=r.useRef(!1),m=r.useRef(null!=t),p=(0,s.useStableCallback)(()=>{f.current&&o!==i.NOOP&&(f.current=!1,o(u.current,void 0))});return(0,R.useIsoLayoutEffect)(()=>{let e;if(o!==i.NOOP){if(a){let a=l?.current;e=(0,O.isElement)(a)&&null!=a.closest("label")?t??null:c??d}else if(null!=t)m.current=!0,e=t;else{if(!m.current)return void p();e=d}if(void 0===e)return void p();f.current=!0,o(u.current,e)}},[t,l,c,o,a,d,u,p]),r.useEffect(()=>p,[p]),n??d}({id:n});(0,R.useIsoLayoutEffect)(()=>{let e=null!=d;F.inputRef.current?.value||e&&""!==d?A(!0):e&&""===d&&A(!1)},[F.inputRef,A,d]);let J=r.useRef(null);(0,R.useIsoLayoutEffect)(()=>{h&&J.current===(0,P.activeElement)((0,I.ownerDocument)(J.current))&&M(!0)},[h,M]);let[G]=$({controlled:d,default:p,name:"FieldControl",state:"value"}),q=void 0!==d,Y=q?G:void 0;return!function(e){let{enabled:t=!0,value:a,id:r,name:l,controlRef:i,commit:n}=e,{formRef:o}=v(),{invalid:d,markedDirtyRef:c,validityData:u,setValidityData:f}=m(),p=(0,s.useStableCallback)(e.getValue);(0,R.useIsoLayoutEffect)(()=>{if(!t)return;let e=a;void 0===e&&(e=p()),null===u.initialValue&&null!==e&&f(t=>({...t,initialValue:e}))},[t,f,a,u.initialValue,p]),(0,R.useIsoLayoutEffect)(()=>{t&&r&&o.current.fields.set(r,{getValue:p,name:l,controlRef:i,validityData:C(u,d),validate(e=!0){let t=a;void 0===t&&(t=p()),c.current=!0,e?_.flushSync(()=>n(t)):n(t)}})},[n,i,t,o,p,r,d,c,l,u,a]),(0,R.useIsoLayoutEffect)(()=>{let e=o.current.fields;return()=>{r&&e.delete(r)}},[o,r])}({id:K,name:U,commit:F.commit,value:Y,getValue:()=>F.inputRef.current?.value,controlRef:F.inputRef}),(0,j.useRenderElement)("input",e,{ref:[t,J],state:B,props:[{id:K,disabled:L,name:U,ref:F.inputRef,"aria-labelledby":V,autoFocus:h,...q?{value:Y}:{defaultValue:p},onChange(e){let t=e.currentTarget.value;f?.(t,(0,z.createChangeEventDetails)(H.REASONS.none,e.nativeEvent)),S(t!==T.initialValue),A(""!==t)},onFocus(){M(!0)},onBlur(e){E(!0),M(!1),"onBlur"===D&&F.commit(e.currentTarget.value)},onKeyDown(e){"INPUT"===e.currentTarget.tagName&&"Enter"===e.key&&(E(!0),F.commit(e.currentTarget.value))}},F.getInputValidationProps(),g],stateAttributesMapping:u})}),J=r.createContext({disabled:!1}),G=r.createContext(void 0),q=r.forwardRef(function(e,t){let{render:s,className:i,disabled:n=!1,...o}=e,{state:d,disabled:c}=m(!1),f=c||n,p=function(e=!0){let t=r.useContext(G);if(void 0===t&&!e)throw Error((0,l.default)(3));return t}(),h=p?.parent.id,v=p?.allValues!==void 0,x=r.useMemo(()=>({disabled:f}),[f]),g=(0,j.useRenderElement)("div",e,{ref:t,state:d,props:o,stateAttributesMapping:u});return(0,a.jsx)(w,{controlId:v?h:void 0,children:(0,a.jsx)(J.Provider,{value:x,children:g})})});e.s(["Control",0,K,"Description",0,V,"Error",0,B,"Item",0,q,"Label",0,A,"Root",0,T,"Validity",0,function(e){let{children:t}=e,{validityData:s,invalid:l}=m(!1),i=r.useMemo(()=>C(s,l),[s,l]),n=!1===i.state.valid,{transitionStatus:o}=(0,L.useTransitionStatus)(n),d=r.useMemo(()=>({...i,validity:i.state,transitionStatus:o}),[i,o]);return(0,a.jsx)(r.Fragment,{children:t(d)})}],71975);var Y=e.i(71975),Y=Y;let W=r.forwardRef(function(e,t){return(0,a.jsx)(Y.Control,{ref:t,...e})});var X=e.i(52088);e.s(["Input",0,function({className:e,type:t,...r}){return(0,a.jsx)(W,{type:t,"data-slot":"input",className:(0,X.cn)("h-9 w-full min-w-0 rounded-md border border-input bg-input/20 px-3 py-1 text-sm transition-colors outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...r})}],10012)},37870,31278,e=>{"use strict";var t=e.i(18050),a=e.i(17521);e.s(["Loader2",()=>a.default],31278);var a=a;e.s(["LoadingSpinner",0,function({size:e="md",message:r}){return(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3",children:[(0,t.jsx)(a.default,{className:`${{sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"}[e]} text-primary animate-spin`}),r&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:r})]})}],37870)},63209,e=>{"use strict";let t=(0,e.i(75254).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["AlertCircle",0,t],63209)},51846,e=>{"use strict";var t=e.i(71645);e.s(["useDocumentTitle",0,function(e){(0,t.useEffect)(()=>{let t=e?`繋 | ${e}`:"繋",a=document.title;return document.title=t,()=>{document.title=a}},[e])}])},471,e=>{"use strict";let t=(0,e.i(75254).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",0,t],471)},46349,e=>{"use strict";let t=(0,e.i(75254).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["default",0,t])},88699,e=>{"use strict";let t=(0,e.i(75254).default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);e.s(["Pencil",0,t],88699)},82341,e=>{"use strict";var t=e.i(18050),a=e.i(71645),r=e.i(18566),s=e.i(471),l=e.i(70935),i=e.i(75254);let n=(0,i.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"}]]),o=(0,i.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),c=e.i(46349),c=c;let u=(0,i.default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);var f=e.i(85902);function m({node:e,isSelected:a,isExpanded:r,depth:s,onSelect:l,onToggle:i}){let p=e.children&&e.children.length>0;return(0,t.jsxs)("div",{onClick:()=>{l(),p&&i&&!r&&i()},className:`
|
|
2
2
|
flex items-center gap-2 px-2 py-1.5 rounded cursor-pointer
|
|
3
3
|
transition-colors
|
|
4
4
|
${a?"bg-accent":"hover:bg-accent"}
|
|
5
|
-
`,style:{paddingLeft:`${16*s+8}px`},children:[p&&(0,t.jsx)(f.Button,{variant:"ghost",size:"icon-xs",onClick:e=>{e.stopPropagation(),i&&i()},className:"size-4",children:r?(0,t.jsx)(u,{className:"w-3 h-3 text-muted-foreground"}):(0,t.jsx)(c.default,{className:"w-3 h-3 text-muted-foreground"})}),!p&&(0,t.jsx)("div",{className:"w-3"}),(0,t.jsx)("div",{className:"text-foreground",children:(()=>{switch(e.type){case"global":return(0,t.jsx)(n,{className:"w-4 h-4"});case"owner":return(0,t.jsx)(o,{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:r,refreshKey:s}){let[i,n]=(0,a.useState)([]),[o,d]=(0,a.useState)(new Set),[c,u]=(0,a.useState)(!0);(0,a.useEffect)(()=>{let e=localStorage.getItem("tsunagi:env-tree-expanded");if(e)try{let t=JSON.parse(e);d(new Set(t))}catch(e){console.error("Failed to parse expanded owners:",e)}},[]),(0,a.useEffect)(()=>{localStorage.setItem("tsunagi:env-tree-expanded",JSON.stringify([...o]))},[o]),(0,a.useEffect)(()=>{(async()=>{u(!0);try{let e=await fetch((0,l.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)}})()},[s]);let f=(a,s=0)=>{let l=e?.scope===a.scope&&e?.owner===a.owner&&e?.repo===a.repo,i=o.has(a.id);return(0,t.jsxs)("div",{children:[(0,t.jsx)(m,{node:a,isSelected:l,isExpanded:i,depth:s,onSelect:()=>{r({scope:a.scope,owner:a.owner,repo:a.repo,label:a.label})},onToggle:()=>{var e;return e=a.id,void d(t=>{let a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})}}),i&&a.children?.map(e=>f(e,s+1))]},a.id)};return c?(0,t.jsx)("div",{className:"p-4 text-muted-foreground text-sm",children:"Loading..."}):0===i.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:i.map(e=>f(e))})})}var h=e.i(7233),v=e.i(37727),x=e.i(43531),g=e.i(86536);let b=(0,i.default)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);var y=e.i(27612),k=e.i(88699),w=e.i(10012);function j({variable:e,onToggle:r,onDelete:s,onUpdate:l,isDeletable:i=!0}){let[n,o]=(0,a.useState)(!1),[d,c]=(0,a.useState)(!1),[u,m]=(0,a.useState)(!1),[p,h]=(0,a.useState)(e.value),N=async t=>{c(!0);try{await r(e.key,t.target.checked)}finally{c(!1)}},C=async()=>{await s(e.key)},E=async()=>{try{await l(e.key,p),m(!1)}catch(e){console.error("Failed to update variable:",e),alert("Failed to update variable")}};return(0,t.jsxs)("div",{className:"border border-border rounded p-3 space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-sm font-mono text-foreground",children:e.key}),!u&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,t.jsx)("input",{type:"checkbox",checked:e.enabled,onChange:N,disabled:d,className:"w-4 h-4 cursor-pointer"}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:"Enabled"})]}),(0,t.jsx)(f.Button,{variant:"ghost",size:"icon-lg",onClick:()=>o(!n),title:n?"Hide value":"Show value",children:n?(0,t.jsx)(b,{className:"w-4 h-4 text-muted-foreground"}):(0,t.jsx)(g.Eye,{className:"w-4 h-4 text-muted-foreground"})}),(0,t.jsx)(f.Button,{variant:"ghost",size:"icon-lg",onClick:()=>{m(!0),h(e.value)},title:"Edit",children:(0,t.jsx)(k.Pencil,{className:"w-4 h-4 text-muted-foreground"})}),i&&(0,t.jsx)(f.Button,{variant:"ghost",size:"icon-lg",onClick:C,title:"Delete",children:(0,t.jsx)(y.Trash2,{className:"w-4 h-4 text-destructive"})})]})]}),u?(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(w.Input,{type:"password",value:p,onChange:e=>h(e.target.value),className:"w-full font-mono",autoFocus:!0}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(f.Button,{variant:"outline",size:"sm",onClick:()=>{m(!1),h(e.value)},className:"active:scale-95",children:(0,t.jsx)(v.X,{className:"w-4 h-4"})}),(0,t.jsx)(f.Button,{size:"sm",onClick:E,className:"active:scale-95",children:(0,t.jsx)(x.Check,{className:"w-4 h-4"})})]})]}):(0,t.jsx)("div",{children:(0,t.jsx)(w.Input,{type:n?"text":"password",value:e.value,readOnly:!0,className:"w-full font-mono"})})]})}var N=e.i(37870);let C=["ANTHROPIC_API_KEY","CLAUDE_CODE_OAUTH_TOKEN"];function E({selectedNode:e}){let[r,s]=(0,a.useState)([]),[i,n]=(0,a.useState)(!0),[o,d]=(0,a.useState)(null),[c,u]=(0,a.useState)(!1),[m,p]=(0,a.useState)(""),[g,b]=(0,a.useState)(""),[y,k]=(0,a.useState)("");(0,a.useEffect)(()=>{(async()=>{n(!0),d(null);try{let t=new URLSearchParams({scope:e.scope});e.owner&&t.set("owner",e.owner),e.repo&&t.set("repo",e.repo);let a=await fetch((0,l.apiUrl)(`/api/env/list?${t}`));if(!a.ok)throw Error("Failed to fetch environment variables");let r=((await a.json()).data.envVars||[]).filter(e=>!C.includes(e.key));s(r)}catch(e){console.error("Failed to load environment variables:",e),d("Failed to load environment variables")}finally{n(!1)}})()},[e]);let S=async(t,a)=>{if("global"===e.scope&&!a&&("ANTHROPIC_API_KEY"===t||"CLAUDE_CODE_OAUTH_TOKEN"===t)&&!r.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,l.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:a})})).ok)throw Error("Failed to toggle environment variable");s(e=>e.map(e=>e.key===t?{...e,enabled:a}:e))}catch(e){console.error("Failed to toggle environment variable:",e),s(e=>e.map(e=>e.key===t?{...e,enabled:!a}:e))}},T=async t=>{if(confirm(`Delete ${t}?`))try{let a=new URLSearchParams({key:t,scope:e.scope});if(e.owner&&a.set("owner",e.owner),e.repo&&a.set("repo",e.repo),!(await fetch((0,l.apiUrl)(`/api/env?${a}`),{method:"DELETE"})).ok)throw Error("Failed to delete environment variable");s(e=>e.filter(e=>e.key!==t))}catch(e){console.error("Failed to delete environment variable:",e),alert("Failed to delete environment variable")}},O=async(t,a)=>{try{if(!(await fetch((0,l.apiUrl)("/api/env"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:t,value:a,scope:e.scope,owner:e.owner,repo:e.repo})})).ok)throw Error("Failed to update environment variable");s(e=>e.map(e=>e.key===t?{...e,value:a}:e))}catch(e){throw console.error("Failed to update environment variable:",e),e}},I=async()=>{var t;if(k(""),!m.trim())return void k("Key is required");if(!g.trim())return void k("Value is required");if(t=m.trim(),/^[A-Z0-9_]+$/.test(t)?C.includes(t)?(k("Claude tokens should be added in the Tokens section"),!1):!r.some(e=>e.key===t)||(k(`Key "${t}" already exists in this scope`),!1):(k("Key must contain only uppercase letters, numbers, and underscores"),!1))try{if(!(await fetch((0,l.apiUrl)("/api/env"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:m.trim(),value:g.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 a=await fetch((0,l.apiUrl)(`/api/env/list?${t}`));if(a.ok){let e=((await a.json()).data.envVars||[]).filter(e=>!C.includes(e.key));s(e)}u(!1),p(""),b("")}catch(e){console.error("Failed to add environment variable:",e),k("Failed to add environment variable")}};return i?(0,t.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,t.jsx)(N.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"}),!c&&(0,t.jsxs)(f.Button,{size:"sm",onClick:()=>u(!0),className:"active:scale-95",children:[(0,t.jsx)(h.Plus,{className:"w-4 h-4"}),"Add Variable"]})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto space-y-3",children:[c&&(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)(w.Input,{type:"text",value:m,onChange:e=>p(e.target.value.toUpperCase()),placeholder:"VARIABLE_NAME",className:"w-full font-mono",autoFocus:!0}),(0,t.jsx)(w.Input,{type:"password",value:g,onChange:e=>b(e.target.value),placeholder:"value",className:"w-full font-mono"}),y&&(0,t.jsx)("div",{className:"text-xs text-destructive",children:y}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(f.Button,{variant:"outline",size:"sm",onClick:()=>{u(!1),p(""),b(""),k("")},className:"active:scale-95",children:(0,t.jsx)(v.X,{className:"w-4 h-4"})}),(0,t.jsx)(f.Button,{size:"sm",onClick:I,className:"active:scale-95",children:(0,t.jsx)(x.Check,{className:"w-4 h-4"})})]})]}),0!==r.length||c?r.map(e=>(0,t.jsx)(j,{variable:e,onToggle:S,onDelete:T,onUpdate:O,isDeletable:!0},e.key)):(0,t.jsx)("div",{className:"text-center text-muted-foreground text-sm py-4",children:"No environment variables"})]})]})}var S=e.i(63209);let T=["ANTHROPIC_API_KEY","CLAUDE_CODE_OAUTH_TOKEN"],O={ANTHROPIC_API_KEY:"API Key",CLAUDE_CODE_OAUTH_TOKEN:"OAuth Token"};function I(e){return e.startsWith("sk-ant-api")?"ANTHROPIC_API_KEY":e.startsWith("sk-ant-oat")?"CLAUDE_CODE_OAUTH_TOKEN":null}function P({selectedNode:e,onboardingStatus:r,onSwitchToGlobal:s}){let[i,n]=(0,a.useState)([]),[o,d]=(0,a.useState)(!0),[c,u]=(0,a.useState)(null),[m,p]=(0,a.useState)(null),[j,C]=(0,a.useState)(""),[E,R]=(0,a.useState)(""),[M,A]=(0,a.useState)(null),[D,F]=(0,a.useState)({}),[L,U]=(0,a.useState)(!1),[B,V]=(0,a.useState)(""),[_,z]=(0,a.useState)(""),[$,H]=(0,a.useState)(null);(0,a.useEffect)(()=>{K()},[e]);let K=async()=>{d(!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 a=await fetch((0,l.apiUrl)(`/api/env/list?${t}`));if(!a.ok)throw Error("Failed to fetch tokens");let r=((await a.json()).data.envVars||[]).filter(e=>T.includes(e.key)).map(e=>({key:e.key,value:e.value,label:O[e.key]||e.key}));n(r)}catch(e){console.error("Failed to load tokens:",e),u("Failed to load tokens")}finally{d(!1)}},J=()=>{p(null),C(""),R(""),A(null)},G=async t=>{if(!j.trim())return void R("Token value is required");let a=I(j);if(!a)return void R("Invalid token format");try{if(a!==t){let r=new URLSearchParams({key:t,scope:e.scope});e.owner&&r.set("owner",e.owner),e.repo&&r.set("repo",e.repo),await fetch((0,l.apiUrl)(`/api/env?${r}`),{method:"DELETE"}),await fetch((0,l.apiUrl)("/api/env"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:a,value:j.trim(),scope:e.scope,owner:e.owner,repo:e.repo})})}else if(!(await fetch((0,l.apiUrl)("/api/env"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:t,value:j.trim(),scope:e.scope,owner:e.owner,repo:e.repo})})).ok)throw Error("Failed to update token");await K(),p(null),C(""),R(""),A(null)}catch(e){console.error("Failed to update token:",e),R("Failed to update token")}},q=async()=>{if(!B.trim())return void z("Token value is required");let t=I(B);if(!t)return void z("Invalid token format");if(i.length>0)return void z("Only one Claude token is allowed per scope. Please edit the existing token.");try{if(!(await fetch((0,l.apiUrl)("/api/env"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:t,value:B.trim(),scope:e.scope,owner:e.owner,repo:e.repo})})).ok)throw Error("Failed to add token");await K(),U(!1),V(""),H(null)}catch(e){console.error("Failed to add token:",e),z("Failed to add token")}},Y=async t=>{if(confirm("Are you sure you want to delete this token?"))try{let a=new URLSearchParams({key:t,scope:e.scope});if(e.owner&&a.set("owner",e.owner),e.repo&&a.set("repo",e.repo),!(await fetch((0,l.apiUrl)(`/api/env?${a}`),{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)(N.LoadingSpinner,{size:"sm",message:"Loading tokens..."})})]});if(c)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:c})]});let W=r&&!r.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"}),!L&&0===i.length&&(0,t.jsxs)(f.Button,{size:"sm",onClick:()=>U(!0),className:"active:scale-95",children:[(0,t.jsx)(h.Plus,{className:"w-4 h-4"}),"Add Token"]})]}),W&&(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)(S.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スコープにトークンを追加してください"})}),s&&(0,t.jsx)(f.Button,{size:"sm",onClick:s,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:[L&&(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)(w.Input,{type:"password",value:B,onChange:e=>{var t;let a;return V(t=e.target.value),z(""),void(H(a=I(t)),t&&!a&&z("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}),$&&!_&&(0,t.jsxs)("div",{className:"text-xs text-success",children:["→ Detected: ",O[$]]}),_&&(0,t.jsx)("div",{className:"text-xs text-destructive",children:_}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(f.Button,{variant:"outline",size:"sm",onClick:()=>{U(!1),V(""),z(""),H(null)},className:"active:scale-95",children:(0,t.jsx)(v.X,{className:"w-4 h-4"})}),(0,t.jsx)(f.Button,{size:"sm",onClick:q,disabled:!$||!!_,className:"active:scale-95",children:(0,t.jsx)(x.Check,{className:"w-4 h-4"})})]})]})]}),0!==i.length||L?i.map(a=>(0,t.jsx)("div",{className:"border border-border rounded p-3 space-y-2",children:m===a.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)(w.Input,{type:"password",value:j,onChange:e=>{var t;let a;return C(t=e.target.value),R(""),void(A(a=I(t)),t&&!a&&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}),M&&!E&&(0,t.jsxs)("div",{className:"text-xs text-success",children:["→ Detected: ",O[M]]}),E&&(0,t.jsx)("div",{className:"text-xs text-destructive",children:E}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(f.Button,{variant:"outline",size:"sm",onClick:J,className:"active:scale-95",children:(0,t.jsx)(v.X,{className:"w-4 h-4"})}),(0,t.jsx)(f.Button,{size:"sm",onClick:()=>G(a.key),disabled:!M||!!E,className:"active:scale-95",children:(0,t.jsx)(x.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:a.label}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(f.Button,{variant:"ghost",size:"icon-lg",onClick:()=>F(e=>({...e,[a.key]:!e[a.key]})),title:D[a.key]?"Hide value":"Show value",children:D[a.key]?(0,t.jsx)(b,{className:"w-4 h-4 text-muted-foreground"}):(0,t.jsx)(g.Eye,{className:"w-4 h-4 text-muted-foreground"})}),(0,t.jsx)(f.Button,{variant:"ghost",size:"icon-lg",onClick:()=>{p(a.key),C(""),R(""),A(null)},title:"Edit",children:(0,t.jsx)(k.Pencil,{className:"w-4 h-4 text-muted-foreground"})}),"global"!==e.scope&&(0,t.jsx)(f.Button,{variant:"ghost",size:"icon-lg",onClick:()=>Y(a.key),className:"hover:bg-destructive/10",title:"Delete",children:(0,t.jsx)(y.Trash2,{className:"w-4 h-4 text-destructive"})})]})]}),(0,t.jsx)(w.Input,{type:D[a.key]?"text":"password",value:a.value,readOnly:!0,className:"w-full font-mono"})]})},a.key)):(0,t.jsx)("div",{className:"text-center text-muted-foreground text-sm py-4",children:"No Claude tokens configured"})]})]})}var R=e.i(5352),M=e.i(68995);function A(){let[e,r]=(0,a.useState)([]),[s,i]=(0,a.useState)({}),[n,o]=(0,a.useState)(null),[d,c]=(0,a.useState)(!1),u=(0,a.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch((0,l.apiUrl)("/api/repos")).then(e=>e.json()),fetch((0,l.apiUrl)("/api/tasks")).then(e=>e.json())]);r(e.data?.repos??[]);let a={};for(let e of t.data?.tasks??[]){let t=`${e.owner}/${e.repo}`;a[t]=(a[t]??0)+1}i(a)}catch(e){console.error("Failed to load repositories:",e)}},[]);(0,a.useEffect)(()=>{u()},[u]);let m=async()=>{if(n){c(!0);try{if(!(await fetch((0,l.apiUrl)(`/api/repos/${n.owner}/${n.repo}`),{method:"DELETE"})).ok)throw Error("Failed to delete repository");await u()}catch(e){console.error("Failed to delete repository:",e)}finally{c(!1),o(null)}}};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)(M.ConfirmDialog,{open:null!==n,onOpenChange:e=>{e.open||o(null)},title:"Delete Repository",message:n?`Delete ${n.owner}/${n.repo}? This will also delete ${s[`${n.owner}/${n.repo}`]??0} associated task(s), all worktrees, and the bare repository. This action cannot be undone.`:"",confirmLabel:d?"Deleting...":"Delete",cancelLabel:"Cancel",onConfirm:m,variant:"danger"}),(0,t.jsx)("div",{className:"space-y-2",children:e.map(e=>{let a=`${e.owner}/${e.repo}`,r=(0,R.getRepoColor)(e.owner,e.repo),l=s[a]??0;return(0,t.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-border p-3",children:[(0,t.jsxs)("div",{className:"flex 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 ${r.bg} ${r.text}`,children:a}),(0,t.jsxs)("span",{className:"text-xs text-muted-foreground",children:[l," task",1!==l?"s":""]})]}),(0,t.jsx)(f.Button,{variant:"ghost",size:"icon",onClick:()=>o(e),className:"text-muted-foreground hover:text-destructive",children:(0,t.jsx)(y.Trash2,{className:"size-4"})})]},e.id)})})]})}var D=e.i(69068);function F({owner:e,repo:r,onDeleted:s}){let[i,n]=(0,a.useState)(!1),[o,d]=(0,a.useState)(""),[c,u]=(0,a.useState)(!1),m=`${e}/${r}`,p=o===m,h=async()=>{if(p){u(!0);try{if(!(await fetch((0,l.apiUrl)(`/api/repos/${e}/${r}`),{method:"DELETE"})).ok)throw Error("Failed to delete repository");s()}catch(e){console.error("Failed to delete repository:",e)}finally{u(!1),n(!1),d("")}}};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)(f.Button,{variant:"destructive",size:"sm",onClick:()=>n(!0),children:[(0,t.jsx)(y.Trash2,{className:"size-4"}),"Remove Repository"]})]}),(0,t.jsx)(D.Dialog,{open:i,onOpenChange:n,children:(0,t.jsxs)(D.DialogContent,{showCloseButton:!1,children:[(0,t.jsxs)(D.DialogHeader,{children:[(0,t.jsx)(D.DialogTitle,{children:"Remove Repository"}),(0,t.jsxs)(D.DialogDescription,{children:["This will permanently delete ",(0,t.jsx)("strong",{children:m})," and all associated tasks, worktrees, and environment variables."]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"text-xs text-muted-foreground",children:["Type ",(0,t.jsx)("strong",{children:m})," to confirm"]}),(0,t.jsx)(w.Input,{value:o,onChange:e=>d(e.target.value),placeholder:m,autoComplete:"off"})]}),(0,t.jsxs)(D.DialogFooter,{children:[(0,t.jsx)(f.Button,{variant:"outline",size:"sm",onClick:()=>{n(!1),d("")},disabled:c,children:"Cancel"}),(0,t.jsx)(f.Button,{variant:"destructive",size:"sm",onClick:h,disabled:!p||c,children:c?"Removing...":"Remove"})]})]})})]})}e.s(["default",0,function(){let e=(0,r.useRouter)(),i=()=>{{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"}},[n,o]=(0,a.useState)(null),[d,c]=(0,a.useState)(0),[u,m]=(0,a.useState)({completed:!0,hasGlobalToken:!0});return(0,a.useEffect)(()=>{fetch((0,l.apiUrl)("/api/onboarding/status")).then(e=>e.json()).then(e=>{let t=e.data;m(t),t.completed||t.hasGlobalToken?o(i()):o({scope:"global",label:"Global"})}).catch(e=>{console.error("Failed to fetch onboarding status:",e),o(i())})},[]),(0,a.useEffect)(()=>{n&&localStorage.setItem("tsunagi:env-selected-node",JSON.stringify(n))},[n]),(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)(f.Button,{variant:"ghost",onClick:()=>e.push("/"),className:"text-primary font-medium hover:bg-primary/10 hover:text-foreground",children:[(0,t.jsx)(s.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.jsxs)("div",{className:"flex-1 flex min-h-0",children:[(0,t.jsx)("div",{className:"w-64 border-r border-border bg-card",children:(0,t.jsx)(p,{selectedNode:n,onNodeSelect:e=>{o(e)},refreshKey:d})}),(0,t.jsx)("div",{className:"flex-1 bg-card p-4 overflow-y-auto",children:n?(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)(P,{selectedNode:n,onboardingStatus:u,onSwitchToGlobal:()=>{o({scope:"global",label:"Global"})}}),(0,t.jsx)(E,{selectedNode:n}),"global"===n.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)(A,{})]}),"repo"===n.scope&&n.owner&&n.repo&&(0,t.jsx)(F,{owner:n.owner,repo:n.repo,onDeleted:()=>{o({scope:"global",label:"Global"}),c(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)}]);
|
|
5
|
+
`,style:{paddingLeft:`${16*s+8}px`},children:[p&&(0,t.jsx)(f.Button,{variant:"ghost",size:"icon-xs",onClick:e=>{e.stopPropagation(),i&&i()},className:"size-4",children:r?(0,t.jsx)(u,{className:"w-3 h-3 text-muted-foreground"}):(0,t.jsx)(c.default,{className:"w-3 h-3 text-muted-foreground"})}),!p&&(0,t.jsx)("div",{className:"w-3"}),(0,t.jsx)("div",{className:"text-foreground",children:(()=>{switch(e.type){case"global":return(0,t.jsx)(n,{className:"w-4 h-4"});case"owner":return(0,t.jsx)(o,{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:r,refreshKey:s}){let[i,n]=(0,a.useState)([]),[o,d]=(0,a.useState)(new Set),[c,u]=(0,a.useState)(!0);(0,a.useEffect)(()=>{let e=localStorage.getItem("tsunagi:env-tree-expanded");if(e)try{let t=JSON.parse(e);d(new Set(t))}catch(e){console.error("Failed to parse expanded owners:",e)}},[]),(0,a.useEffect)(()=>{localStorage.setItem("tsunagi:env-tree-expanded",JSON.stringify([...o]))},[o]),(0,a.useEffect)(()=>{(async()=>{u(!0);try{let e=await fetch((0,l.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)}})()},[s]);let f=(a,s=0)=>{let l=e?.scope===a.scope&&e?.owner===a.owner&&e?.repo===a.repo,i=o.has(a.id);return(0,t.jsxs)("div",{children:[(0,t.jsx)(m,{node:a,isSelected:l,isExpanded:i,depth:s,onSelect:()=>{r({scope:a.scope,owner:a.owner,repo:a.repo,label:a.label})},onToggle:()=>{var e;return e=a.id,void d(t=>{let a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})}}),i&&a.children?.map(e=>f(e,s+1))]},a.id)};return c?(0,t.jsx)("div",{className:"p-4 text-muted-foreground text-sm",children:"Loading..."}):0===i.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:i.map(e=>f(e))})})}var h=e.i(7233),v=e.i(37727),x=e.i(43531),g=e.i(86536);let b=(0,i.default)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);var y=e.i(27612),k=e.i(88699),w=e.i(10012);function j({variable:e,onToggle:r,onDelete:s,onUpdate:l,isDeletable:i=!0}){let[n,o]=(0,a.useState)(!1),[d,c]=(0,a.useState)(!1),[u,m]=(0,a.useState)(!1),[p,h]=(0,a.useState)(e.value),N=async t=>{c(!0);try{await r(e.key,t.target.checked)}finally{c(!1)}},C=async()=>{await s(e.key)},E=async()=>{try{await l(e.key,p),m(!1)}catch(e){console.error("Failed to update variable:",e),alert("Failed to update variable")}};return(0,t.jsxs)("div",{className:"border border-border rounded p-3 space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-sm font-mono text-foreground",children:e.key}),!u&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,t.jsx)("input",{type:"checkbox",checked:e.enabled,onChange:N,disabled:d,className:"w-4 h-4 cursor-pointer"}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:"Enabled"})]}),(0,t.jsx)(f.Button,{variant:"ghost",size:"icon-lg",onClick:()=>o(!n),title:n?"Hide value":"Show value",children:n?(0,t.jsx)(b,{className:"w-4 h-4 text-muted-foreground"}):(0,t.jsx)(g.Eye,{className:"w-4 h-4 text-muted-foreground"})}),(0,t.jsx)(f.Button,{variant:"ghost",size:"icon-lg",onClick:()=>{m(!0),h(e.value)},title:"Edit",children:(0,t.jsx)(k.Pencil,{className:"w-4 h-4 text-muted-foreground"})}),i&&(0,t.jsx)(f.Button,{variant:"ghost",size:"icon-lg",onClick:C,title:"Delete",children:(0,t.jsx)(y.Trash2,{className:"w-4 h-4 text-destructive"})})]})]}),u?(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(w.Input,{type:"password",value:p,onChange:e=>h(e.target.value),className:"w-full font-mono",autoFocus:!0}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(f.Button,{variant:"outline",size:"sm",onClick:()=>{m(!1),h(e.value)},className:"active:scale-95",children:(0,t.jsx)(v.X,{className:"w-4 h-4"})}),(0,t.jsx)(f.Button,{size:"sm",onClick:E,className:"active:scale-95",children:(0,t.jsx)(x.Check,{className:"w-4 h-4"})})]})]}):(0,t.jsx)("div",{children:(0,t.jsx)(w.Input,{type:n?"text":"password",value:e.value,readOnly:!0,className:"w-full font-mono"})})]})}var N=e.i(37870);let C=["ANTHROPIC_API_KEY","CLAUDE_CODE_OAUTH_TOKEN"];function E({selectedNode:e}){let[r,s]=(0,a.useState)([]),[i,n]=(0,a.useState)(!0),[o,d]=(0,a.useState)(null),[c,u]=(0,a.useState)(!1),[m,p]=(0,a.useState)(""),[g,b]=(0,a.useState)(""),[y,k]=(0,a.useState)("");(0,a.useEffect)(()=>{(async()=>{n(!0),d(null);try{let t=new URLSearchParams({scope:e.scope});e.owner&&t.set("owner",e.owner),e.repo&&t.set("repo",e.repo);let a=await fetch((0,l.apiUrl)(`/api/env/list?${t}`));if(!a.ok)throw Error("Failed to fetch environment variables");let r=((await a.json()).data.envVars||[]).filter(e=>!C.includes(e.key));s(r)}catch(e){console.error("Failed to load environment variables:",e),d("Failed to load environment variables")}finally{n(!1)}})()},[e]);let S=async(t,a)=>{if("global"===e.scope&&!a&&("ANTHROPIC_API_KEY"===t||"CLAUDE_CODE_OAUTH_TOKEN"===t)&&!r.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,l.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:a})})).ok)throw Error("Failed to toggle environment variable");s(e=>e.map(e=>e.key===t?{...e,enabled:a}:e))}catch(e){console.error("Failed to toggle environment variable:",e),s(e=>e.map(e=>e.key===t?{...e,enabled:!a}:e))}},T=async t=>{if(confirm(`Delete ${t}?`))try{let a=new URLSearchParams({key:t,scope:e.scope});if(e.owner&&a.set("owner",e.owner),e.repo&&a.set("repo",e.repo),!(await fetch((0,l.apiUrl)(`/api/env?${a}`),{method:"DELETE"})).ok)throw Error("Failed to delete environment variable");s(e=>e.filter(e=>e.key!==t))}catch(e){console.error("Failed to delete environment variable:",e),alert("Failed to delete environment variable")}},O=async(t,a)=>{try{if(!(await fetch((0,l.apiUrl)("/api/env"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:t,value:a,scope:e.scope,owner:e.owner,repo:e.repo})})).ok)throw Error("Failed to update environment variable");s(e=>e.map(e=>e.key===t?{...e,value:a}:e))}catch(e){throw console.error("Failed to update environment variable:",e),e}},I=async()=>{var t;if(k(""),!m.trim())return void k("Key is required");if(!g.trim())return void k("Value is required");if(t=m.trim(),/^[A-Z0-9_]+$/.test(t)?C.includes(t)?(k("Claude tokens should be added in the Tokens section"),!1):!r.some(e=>e.key===t)||(k(`Key "${t}" already exists in this scope`),!1):(k("Key must contain only uppercase letters, numbers, and underscores"),!1))try{if(!(await fetch((0,l.apiUrl)("/api/env"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:m.trim(),value:g.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 a=await fetch((0,l.apiUrl)(`/api/env/list?${t}`));if(a.ok){let e=((await a.json()).data.envVars||[]).filter(e=>!C.includes(e.key));s(e)}u(!1),p(""),b("")}catch(e){console.error("Failed to add environment variable:",e),k("Failed to add environment variable")}};return i?(0,t.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,t.jsx)(N.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"}),!c&&(0,t.jsxs)(f.Button,{size:"sm",onClick:()=>u(!0),className:"active:scale-95",children:[(0,t.jsx)(h.Plus,{className:"w-4 h-4"}),"Add Variable"]})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto space-y-3",children:[c&&(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)(w.Input,{type:"text",value:m,onChange:e=>p(e.target.value.toUpperCase()),placeholder:"VARIABLE_NAME",className:"w-full font-mono",autoFocus:!0}),(0,t.jsx)(w.Input,{type:"password",value:g,onChange:e=>b(e.target.value),placeholder:"value",className:"w-full font-mono"}),y&&(0,t.jsx)("div",{className:"text-xs text-destructive",children:y}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(f.Button,{variant:"outline",size:"sm",onClick:()=>{u(!1),p(""),b(""),k("")},className:"active:scale-95",children:(0,t.jsx)(v.X,{className:"w-4 h-4"})}),(0,t.jsx)(f.Button,{size:"sm",onClick:I,className:"active:scale-95",children:(0,t.jsx)(x.Check,{className:"w-4 h-4"})})]})]}),0!==r.length||c?r.map(e=>(0,t.jsx)(j,{variable:e,onToggle:S,onDelete:T,onUpdate:O,isDeletable:!0},e.key)):(0,t.jsx)("div",{className:"text-center text-muted-foreground text-sm py-4",children:"No environment variables"})]})]})}var S=e.i(63209);let T=["ANTHROPIC_API_KEY","CLAUDE_CODE_OAUTH_TOKEN"],O={ANTHROPIC_API_KEY:"API Key",CLAUDE_CODE_OAUTH_TOKEN:"OAuth Token"};function I(e){return e.startsWith("sk-ant-api")?"ANTHROPIC_API_KEY":e.startsWith("sk-ant-oat")?"CLAUDE_CODE_OAUTH_TOKEN":null}function P({selectedNode:e,onboardingStatus:r,onSwitchToGlobal:s}){let[i,n]=(0,a.useState)([]),[o,d]=(0,a.useState)(!0),[c,u]=(0,a.useState)(null),[m,p]=(0,a.useState)(null),[j,C]=(0,a.useState)(""),[E,R]=(0,a.useState)(""),[M,A]=(0,a.useState)(null),[D,F]=(0,a.useState)({}),[L,U]=(0,a.useState)(!1),[B,V]=(0,a.useState)(""),[$,_]=(0,a.useState)(""),[z,H]=(0,a.useState)(null);(0,a.useEffect)(()=>{K()},[e]);let K=async()=>{d(!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 a=await fetch((0,l.apiUrl)(`/api/env/list?${t}`));if(!a.ok)throw Error("Failed to fetch tokens");let r=((await a.json()).data.envVars||[]).filter(e=>T.includes(e.key)).map(e=>({key:e.key,value:e.value,label:O[e.key]||e.key}));n(r)}catch(e){console.error("Failed to load tokens:",e),u("Failed to load tokens")}finally{d(!1)}},J=()=>{p(null),C(""),R(""),A(null)},G=async t=>{if(!j.trim())return void R("Token value is required");let a=I(j);if(!a)return void R("Invalid token format");try{if(a!==t){let r=new URLSearchParams({key:t,scope:e.scope});e.owner&&r.set("owner",e.owner),e.repo&&r.set("repo",e.repo),await fetch((0,l.apiUrl)(`/api/env?${r}`),{method:"DELETE"}),await fetch((0,l.apiUrl)("/api/env"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:a,value:j.trim(),scope:e.scope,owner:e.owner,repo:e.repo})})}else if(!(await fetch((0,l.apiUrl)("/api/env"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:t,value:j.trim(),scope:e.scope,owner:e.owner,repo:e.repo})})).ok)throw Error("Failed to update token");await K(),p(null),C(""),R(""),A(null)}catch(e){console.error("Failed to update token:",e),R("Failed to update token")}},q=async()=>{if(!B.trim())return void _("Token value is required");let t=I(B);if(!t)return void _("Invalid token format");if(i.length>0)return void _("Only one Claude token is allowed per scope. Please edit the existing token.");try{if(!(await fetch((0,l.apiUrl)("/api/env"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:t,value:B.trim(),scope:e.scope,owner:e.owner,repo:e.repo})})).ok)throw Error("Failed to add token");await K(),U(!1),V(""),H(null)}catch(e){console.error("Failed to add token:",e),_("Failed to add token")}},Y=async t=>{if(confirm("Are you sure you want to delete this token?"))try{let a=new URLSearchParams({key:t,scope:e.scope});if(e.owner&&a.set("owner",e.owner),e.repo&&a.set("repo",e.repo),!(await fetch((0,l.apiUrl)(`/api/env?${a}`),{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)(N.LoadingSpinner,{size:"sm",message:"Loading tokens..."})})]});if(c)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:c})]});let W=r&&!r.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"}),!L&&0===i.length&&(0,t.jsxs)(f.Button,{size:"sm",onClick:()=>U(!0),className:"active:scale-95",children:[(0,t.jsx)(h.Plus,{className:"w-4 h-4"}),"Add Token"]})]}),W&&(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)(S.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スコープにトークンを追加してください"})}),s&&(0,t.jsx)(f.Button,{size:"sm",onClick:s,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:[L&&(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)(w.Input,{type:"password",value:B,onChange:e=>{var t;let a;return V(t=e.target.value),_(""),void(H(a=I(t)),t&&!a&&_("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}),z&&!$&&(0,t.jsxs)("div",{className:"text-xs text-success",children:["→ Detected: ",O[z]]}),$&&(0,t.jsx)("div",{className:"text-xs text-destructive",children:$}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(f.Button,{variant:"outline",size:"sm",onClick:()=>{U(!1),V(""),_(""),H(null)},className:"active:scale-95",children:(0,t.jsx)(v.X,{className:"w-4 h-4"})}),(0,t.jsx)(f.Button,{size:"sm",onClick:q,disabled:!z||!!$,className:"active:scale-95",children:(0,t.jsx)(x.Check,{className:"w-4 h-4"})})]})]})]}),0!==i.length||L?i.map(a=>(0,t.jsx)("div",{className:"border border-border rounded p-3 space-y-2",children:m===a.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)(w.Input,{type:"password",value:j,onChange:e=>{var t;let a;return C(t=e.target.value),R(""),void(A(a=I(t)),t&&!a&&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}),M&&!E&&(0,t.jsxs)("div",{className:"text-xs text-success",children:["→ Detected: ",O[M]]}),E&&(0,t.jsx)("div",{className:"text-xs text-destructive",children:E}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(f.Button,{variant:"outline",size:"sm",onClick:J,className:"active:scale-95",children:(0,t.jsx)(v.X,{className:"w-4 h-4"})}),(0,t.jsx)(f.Button,{size:"sm",onClick:()=>G(a.key),disabled:!M||!!E,className:"active:scale-95",children:(0,t.jsx)(x.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:a.label}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(f.Button,{variant:"ghost",size:"icon-lg",onClick:()=>F(e=>({...e,[a.key]:!e[a.key]})),title:D[a.key]?"Hide value":"Show value",children:D[a.key]?(0,t.jsx)(b,{className:"w-4 h-4 text-muted-foreground"}):(0,t.jsx)(g.Eye,{className:"w-4 h-4 text-muted-foreground"})}),(0,t.jsx)(f.Button,{variant:"ghost",size:"icon-lg",onClick:()=>{p(a.key),C(""),R(""),A(null)},title:"Edit",children:(0,t.jsx)(k.Pencil,{className:"w-4 h-4 text-muted-foreground"})}),"global"!==e.scope&&(0,t.jsx)(f.Button,{variant:"ghost",size:"icon-lg",onClick:()=>Y(a.key),className:"hover:bg-destructive/10",title:"Delete",children:(0,t.jsx)(y.Trash2,{className:"w-4 h-4 text-destructive"})})]})]}),(0,t.jsx)(w.Input,{type:D[a.key]?"text":"password",value:a.value,readOnly:!0,className:"w-full font-mono"})]})},a.key)):(0,t.jsx)("div",{className:"text-center text-muted-foreground text-sm py-4",children:"No Claude tokens configured"})]})]})}var R=e.i(5352),M=e.i(68995);function A(){let[e,r]=(0,a.useState)([]),[s,i]=(0,a.useState)({}),[n,o]=(0,a.useState)(null),[d,c]=(0,a.useState)(!1),u=(0,a.useCallback)(async()=>{try{let[e,t]=await Promise.all([fetch((0,l.apiUrl)("/api/repos")).then(e=>e.json()),fetch((0,l.apiUrl)("/api/tasks")).then(e=>e.json())]);r(e.data?.repos??[]);let a={};for(let e of t.data?.tasks??[]){let t=`${e.owner}/${e.repo}`;a[t]=(a[t]??0)+1}i(a)}catch(e){console.error("Failed to load repositories:",e)}},[]);(0,a.useEffect)(()=>{u()},[u]);let m=async()=>{if(n){c(!0);try{if(!(await fetch((0,l.apiUrl)(`/api/repos/${n.owner}/${n.repo}`),{method:"DELETE"})).ok)throw Error("Failed to delete repository");await u()}catch(e){console.error("Failed to delete repository:",e)}finally{c(!1),o(null)}}};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)(M.ConfirmDialog,{open:null!==n,onOpenChange:e=>{e.open||o(null)},title:"Delete Repository",message:n?`Delete ${n.owner}/${n.repo}? This will also delete ${s[`${n.owner}/${n.repo}`]??0} associated task(s), all worktrees, and the bare repository. This action cannot be undone.`:"",confirmLabel:d?"Deleting...":"Delete",cancelLabel:"Cancel",onConfirm:m,variant:"danger"}),(0,t.jsx)("div",{className:"space-y-2",children:e.map(e=>{let a=`${e.owner}/${e.repo}`,r=(0,R.getRepoColor)(e.owner,e.repo),l=s[a]??0;return(0,t.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-border p-3",children:[(0,t.jsxs)("div",{className:"flex 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 ${r.bg} ${r.text}`,children:a}),(0,t.jsxs)("span",{className:"text-xs text-muted-foreground",children:[l," task",1!==l?"s":""]})]}),(0,t.jsx)(f.Button,{variant:"ghost",size:"icon",onClick:()=>o(e),className:"text-muted-foreground hover:text-destructive",children:(0,t.jsx)(y.Trash2,{className:"size-4"})})]},e.id)})})]})}var D=e.i(69068);function F({owner:e,repo:r,onDeleted:s}){let[i,n]=(0,a.useState)(!1),[o,d]=(0,a.useState)(""),[c,u]=(0,a.useState)(!1),m=`${e}/${r}`,p=o===m,h=async()=>{if(p){u(!0);try{if(!(await fetch((0,l.apiUrl)(`/api/repos/${e}/${r}`),{method:"DELETE"})).ok)throw Error("Failed to delete repository");s()}catch(e){console.error("Failed to delete repository:",e)}finally{u(!1),n(!1),d("")}}};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)(f.Button,{variant:"destructive",size:"sm",onClick:()=>n(!0),children:[(0,t.jsx)(y.Trash2,{className:"size-4"}),"Remove Repository"]})]}),(0,t.jsx)(D.Dialog,{open:i,onOpenChange:n,children:(0,t.jsxs)(D.DialogContent,{showCloseButton:!1,children:[(0,t.jsxs)(D.DialogHeader,{children:[(0,t.jsx)(D.DialogTitle,{children:"Remove Repository"}),(0,t.jsxs)(D.DialogDescription,{children:["This will permanently delete ",(0,t.jsx)("strong",{children:m})," and all associated tasks, worktrees, and environment variables."]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("label",{className:"text-xs text-muted-foreground",children:["Type ",(0,t.jsx)("strong",{children:m})," to confirm"]}),(0,t.jsx)(w.Input,{value:o,onChange:e=>d(e.target.value),placeholder:m,autoComplete:"off"})]}),(0,t.jsxs)(D.DialogFooter,{children:[(0,t.jsx)(f.Button,{variant:"outline",size:"sm",onClick:()=>{n(!1),d("")},disabled:c,children:"Cancel"}),(0,t.jsx)(f.Button,{variant:"destructive",size:"sm",onClick:h,disabled:!p||c,children:c?"Removing...":"Remove"})]})]})})]})}var L=e.i(51846);e.s(["default",0,function(){let e=(0,r.useRouter)();(0,L.useDocumentTitle)("settings");let i=()=>{{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"}},[n,o]=(0,a.useState)(null),[d,c]=(0,a.useState)(0),[u,m]=(0,a.useState)({completed:!0,hasGlobalToken:!0});return(0,a.useEffect)(()=>{fetch((0,l.apiUrl)("/api/onboarding/status")).then(e=>e.json()).then(e=>{let t=e.data;m(t),t.completed||t.hasGlobalToken?o(i()):o({scope:"global",label:"Global"})}).catch(e=>{console.error("Failed to fetch onboarding status:",e),o(i())})},[]),(0,a.useEffect)(()=>{n&&localStorage.setItem("tsunagi:env-selected-node",JSON.stringify(n))},[n]),(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)(f.Button,{variant:"ghost",onClick:()=>e.push("/"),className:"text-primary font-medium hover:bg-primary/10 hover:text-foreground",children:[(0,t.jsx)(s.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.jsxs)("div",{className:"flex-1 flex min-h-0",children:[(0,t.jsx)("div",{className:"w-64 border-r border-border bg-card",children:(0,t.jsx)(p,{selectedNode:n,onNodeSelect:e=>{o(e)},refreshKey:d})}),(0,t.jsx)("div",{className:"flex-1 bg-card p-4 overflow-y-auto",children:n?(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)(P,{selectedNode:n,onboardingStatus:u,onSwitchToGlobal:()=>{o({scope:"global",label:"Global"})}}),(0,t.jsx)(E,{selectedNode:n}),"global"===n.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)(A,{})]}),"repo"===n.scope&&n.owner&&n.repo&&(0,t.jsx)(F,{owner:n.owner,repo:n.repo,onDeleted:()=>{o({scope:"global",label:"Global"}),c(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)}]);
|
package/dist/cli.js
CHANGED
|
@@ -90,6 +90,10 @@ function shutdown(code) {
|
|
|
90
90
|
}
|
|
91
91
|
process.on('SIGINT', () => shutdown(0));
|
|
92
92
|
process.on('SIGTERM', () => shutdown(0));
|
|
93
|
+
process.on('exit', () => {
|
|
94
|
+
if (!shuttingDown)
|
|
95
|
+
cleanupPluginState();
|
|
96
|
+
});
|
|
93
97
|
fastifyChild.on('exit', (code) => {
|
|
94
98
|
console.error(`[tsunagi] Fastify server exited with code ${code}`);
|
|
95
99
|
shutdown(code ?? 1);
|
package/dist/plugin-lifecycle.js
CHANGED
|
@@ -34,6 +34,26 @@ function getMarketplaceDir() {
|
|
|
34
34
|
function log(msg) {
|
|
35
35
|
console.log(`[tsunagi:plugin] ${msg}`);
|
|
36
36
|
}
|
|
37
|
+
/** プラグインがインストール済みか確認する */
|
|
38
|
+
function isPluginInstalled() {
|
|
39
|
+
try {
|
|
40
|
+
const output = execSync('claude plugin list', { stdio: 'pipe' }).toString();
|
|
41
|
+
return output.includes(PLUGIN_REF);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** marketplaceが登録済みか確認する */
|
|
48
|
+
function isMarketplaceAdded() {
|
|
49
|
+
try {
|
|
50
|
+
const output = execSync('claude plugin marketplace list', { stdio: 'pipe' }).toString();
|
|
51
|
+
return output.includes(MARKETPLACE_NAME);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
37
57
|
/**
|
|
38
58
|
* Run a `claude` CLI command. Returns true on success, false on failure.
|
|
39
59
|
* Logs stderr on failure to aid debugging.
|
|
@@ -59,8 +79,13 @@ function runClaude(args) {
|
|
|
59
79
|
*/
|
|
60
80
|
export function ensureCleanPluginState() {
|
|
61
81
|
// Phase 1: best-effort cleanup of any orphaned state from a previous run.
|
|
62
|
-
|
|
63
|
-
|
|
82
|
+
// Check existence first to avoid error output when plugin is not installed (normal first-boot case).
|
|
83
|
+
if (isPluginInstalled()) {
|
|
84
|
+
runClaude(`plugin uninstall ${PLUGIN_REF}`);
|
|
85
|
+
}
|
|
86
|
+
if (isMarketplaceAdded()) {
|
|
87
|
+
runClaude(`plugin marketplace remove ${MARKETPLACE_NAME}`);
|
|
88
|
+
}
|
|
64
89
|
// Phase 2: clean install. Failures here are fatal.
|
|
65
90
|
const marketplaceDir = getMarketplaceDir();
|
|
66
91
|
if (!runClaude(`plugin marketplace add ${marketplaceDir}`)) {
|
|
@@ -23,6 +23,7 @@ export async function editorRoutes(fastify) {
|
|
|
23
23
|
content,
|
|
24
24
|
status: 'pending',
|
|
25
25
|
createdAt: Date.now(),
|
|
26
|
+
tabId: tabId ?? null,
|
|
26
27
|
});
|
|
27
28
|
// tabIdが指定されていれば、最後にinputを送信したソケットにのみ送信
|
|
28
29
|
// (同じtabルームに複数ブラウザタブのソケットが参加している場合の隔離)
|
|
@@ -58,6 +59,24 @@ export async function editorRoutes(fastify) {
|
|
|
58
59
|
}
|
|
59
60
|
await writeFile(session.filePath, request.body.content, 'utf8');
|
|
60
61
|
session.status = 'done';
|
|
62
|
+
// sh が polling で "done" を検知して exit し claude が foreground に戻った後、
|
|
63
|
+
// cols を一瞬変えることで SIGWINCH を発火させる。
|
|
64
|
+
// rows 変更と異なり cols 変更では Ink が全画面クリア + 全 UI 再描画を行うため、
|
|
65
|
+
// $EDITOR exit 後に blank になる余白が解消される。
|
|
66
|
+
// 300ms: server が /complete を受信した時点が T=0。sh の polling(最大100ms) +
|
|
67
|
+
// exit + claude foreground 復帰 で ~150ms。余裕を持たせた値。
|
|
68
|
+
if (session.tabId) {
|
|
69
|
+
const ptySession = ptyManager.getSession(session.tabId);
|
|
70
|
+
if (ptySession) {
|
|
71
|
+
const { cols, rows } = ptySession.pty;
|
|
72
|
+
setTimeout(() => {
|
|
73
|
+
ptySession.pty.resize(cols + 1, rows);
|
|
74
|
+
setTimeout(() => {
|
|
75
|
+
ptySession.pty.resize(cols, rows);
|
|
76
|
+
}, 100);
|
|
77
|
+
}, 300);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
61
80
|
return reply.send({ ok: true });
|
|
62
81
|
});
|
|
63
82
|
}
|
package/package.json
CHANGED