@nextclaw/ui 0.15.19 → 0.15.20
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/CHANGELOG.md +18 -0
- package/dist/assets/{api-O5yEgzBt.js → api-tWUa6l9J.js} +3 -3
- package/dist/assets/app-presenter-provider-s-FrOinZ.js +106 -0
- package/dist/assets/appearance-settings-page-dMRBD7ni.js +1 -0
- package/dist/assets/{book-open-HtUSPwoS.js → book-open-BQ29ZmDE.js} +1 -1
- package/dist/assets/card-CtKueklV.js +1 -0
- package/dist/assets/{channels-list-page-Bspr1Jp4.js → channels-list-page-C8y3rqYt.js} +2 -2
- package/dist/assets/{chat-page-BKQ89f4s.js → chat-page-MXBltS3G.js} +1 -1
- package/dist/assets/config-split-page-uC6d_r9c.js +1 -0
- package/dist/assets/confirm-dialog-C1pbqHZX.js +5 -0
- package/dist/assets/desktop-update-config-DssP8LCk.js +1 -0
- package/dist/assets/{dist-CZx9Q6jc.js → dist-rYHnBo8t.js} +1 -1
- package/dist/assets/doc-browser-AXF1zRsM.js +1 -0
- package/dist/assets/{doc-browser-B4l0Xu7u.js → doc-browser-D8ng4EUc.js} +1 -1
- package/dist/assets/{doc-browser-context-Dy7EhLI8.js → doc-browser-context-CPHNzQ8m.js} +1 -1
- package/dist/assets/{eye-DU7p1-7X.js → eye-CiJz3ODY.js} +1 -1
- package/dist/assets/form-actions-BnZVzLZf.js +1 -0
- package/dist/assets/{index-6pHX0DZH.js → index-CocHWEsI.js} +2 -2
- package/dist/assets/loader-circle-AOpK5kkW.js +1 -0
- package/dist/assets/logo-badge-BXI-Kdhd.js +1 -0
- package/dist/assets/mcp-marketplace-page-5ogeBHnl.js +1 -0
- package/dist/assets/{mcp-marketplace-page-Dg03SZX1.js → mcp-marketplace-page-CxNe-Q9Q.js} +3 -3
- package/dist/assets/{model-config-page-DOBqLZoQ.js → model-config-page-CR_mgEVp.js} +1 -1
- package/dist/assets/{navigation-link-Ct6xtnVM.js → navigation-link-C1cvB7y4.js} +1 -1
- package/dist/assets/plus-DI37QuHc.js +1 -0
- package/dist/assets/{popover-C2oIpGBF.js → popover-ZoDwVwwd.js} +1 -1
- package/dist/assets/provider-scoped-model-input-DIL6Ex_d.js +1 -0
- package/dist/assets/{providers-config-page-BAVPJKpx.js → providers-config-page-D2NXVctW.js} +1 -1
- package/dist/assets/react-39CDNZlM.js +8 -0
- package/dist/assets/{refresh-cw-BZ8giusN.js → refresh-cw-DKewcdAl.js} +1 -1
- package/dist/assets/remote-DYOOO1YG.js +1 -0
- package/dist/assets/rotate-cw-PmqA8LQT.js +1 -0
- package/dist/assets/{runtime-config-page-D0244uxJ.js → runtime-config-page-0lb5NyKc.js} +1 -1
- package/dist/assets/{save-CSzFGRse.js → save-BrckuAXY.js} +1 -1
- package/dist/assets/{search-BmSWsiG2.js → search-BhXQB2TO.js} +1 -1
- package/dist/assets/{search-config-page-CrL1pUzy.js → search-config-page-DFOQ6SDJ.js} +1 -1
- package/dist/assets/{secrets-config-page-BlgsD0-L.js → secrets-config-page-BqqeClqE.js} +1 -1
- package/dist/assets/security-config-13AtPIlm.js +1 -0
- package/dist/assets/{select-CklWb6Rs.js → select-CVzGGT38.js} +1 -1
- package/dist/assets/{settings-2-BSZf8327.js → settings-2-BP6L2enG.js} +1 -1
- package/dist/assets/skeleton-OwCNQJ7M.js +1 -0
- package/dist/assets/{tabs-Cah5klko.js → tabs-B-QWjKCL.js} +1 -1
- package/dist/assets/{tag-chip-DcrirDgN.js → tag-chip-C88mxjwx.js} +1 -1
- package/dist/assets/{trash-2-BLQOULWD.js → trash-2-ck3t33I3.js} +1 -1
- package/dist/assets/{use-config-CuFIsUVG.js → use-config-BAr5bH2c.js} +1 -1
- package/dist/assets/use-confirm-dialog-C4e0nG_4.js +1 -0
- package/dist/assets/{use-viewport-layout-DU29bUJS.js → use-viewport-layout-k1isXfNm.js} +1 -1
- package/dist/assets/x-C1ijNWcE.js +1 -0
- package/dist/index.html +27 -27
- package/package.json +9 -9
- package/src/features/chat/features/conversation/hooks/__tests__/use-session-run-queue.test.tsx +28 -0
- package/src/features/chat/features/conversation/hooks/use-session-run-queue.ts +4 -5
- package/src/features/chat/features/input/hooks/__tests__/use-chat-input-surface-state.test.tsx +13 -0
- package/src/features/chat/features/input/hooks/use-chat-input-surface-state.ts +31 -8
- package/src/features/chat/features/input/input-surface-plugins/__tests__/context-reference-plugin.test.ts +79 -9
- package/src/features/chat/features/input/input-surface-plugins/__tests__/slash-command-plugin.test.ts +16 -4
- package/src/features/chat/features/input/input-surface-plugins/chat-input-product-plugin-adapters.types.ts +10 -2
- package/src/features/chat/features/input/input-surface-plugins/context-reference-items.utils.ts +240 -0
- package/src/features/chat/features/input/input-surface-plugins/context-reference-plugin.utils.ts +62 -173
- package/src/features/chat/features/input/utils/__tests__/chat-inline-token.utils.test.ts +29 -0
- package/src/features/chat/features/input/utils/chat-composer-token-protocol.utils.ts +5 -0
- package/src/features/chat/features/input/utils/chat-inline-token.utils.ts +26 -5
- package/src/features/chat/features/message/components/__tests__/chat-message-list.container.test.tsx +12 -1
- package/src/features/chat/features/message/components/chat-message-list.container.tsx +9 -5
- package/src/features/chat/pages/__tests__/ncp-chat-page.test.ts +26 -0
- package/src/shared/hooks/use-projects.ts +2 -1
- package/src/shared/lib/i18n/locales/en-US/chat.json +13 -4
- package/src/shared/lib/i18n/locales/zh-CN/chat.json +13 -4
- package/dist/assets/app-presenter-provider-DXTYtH78.js +0 -106
- package/dist/assets/appearance-settings-page-BuGxSvlJ.js +0 -1
- package/dist/assets/card-GkBc-UMw.js +0 -1
- package/dist/assets/config-split-page-CvLXSFSC.js +0 -1
- package/dist/assets/confirm-dialog-BVH7haN0.js +0 -5
- package/dist/assets/desktop-update-config-C9ZUI8UW.js +0 -1
- package/dist/assets/doc-browser-DsVF1DrS.js +0 -1
- package/dist/assets/form-actions-aM9_jSJC.js +0 -1
- package/dist/assets/loader-circle-Dd6jw700.js +0 -1
- package/dist/assets/logo-badge-2-iV1pkr.js +0 -1
- package/dist/assets/mcp-marketplace-page-C-d0RMfg.js +0 -1
- package/dist/assets/plus-CsgeRId8.js +0 -1
- package/dist/assets/provider-scoped-model-input-DDqCdnTU.js +0 -1
- package/dist/assets/react-CeMr9V52.js +0 -8
- package/dist/assets/remote-C-r0SHcz.js +0 -1
- package/dist/assets/rotate-cw-DVdRfMSO.js +0 -1
- package/dist/assets/security-config-cDrdpMJW.js +0 -1
- package/dist/assets/skeleton-DG9u1BmA.js +0 -1
- package/dist/assets/use-confirm-dialog-CcySmkWp.js +0 -1
- package/dist/assets/x-BVoeXny1.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./chunk-DseTPa7n.js";import{C as t,E as n,O as r,d as i,r as a}from"./react-CeMr9V52.js";import{C as o,T as s,a as c,b as l,c as u,f as d,g as f,i as p,m,o as h,r as g,s as _,t as v,v as y,w as b,y as x}from"./dist-CZx9Q6jc.js";import{d as S,i as C,r as w,t as T}from"./popover-C2oIpGBF.js";import{n as ee,t as E}from"./search-BmSWsiG2.js";import{t as te}from"./navigation-link-Ct6xtnVM.js";import{t as D}from"./plus-CsgeRId8.js";import{t as O}from"./refresh-cw-BZ8giusN.js";import{t as k}from"./x-BVoeXny1.js";import{_ as ne,d as re,g as A,m as j,n as ie,p as ae}from"./doc-browser-context-Dy7EhLI8.js";var M=u(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),N=u(`Boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),P=u(`EllipsisVertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),oe=u(`GripVertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),F=u(`PanelRightOpen`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),se=u(`PictureInPicture2`,[[`path`,{d:`M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4`,key:`daa4of`}],[`rect`,{width:`10`,height:`7`,x:`12`,y:`13`,rx:`2`,key:`1nb8gs`}]]),ce=u(`PinOff`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),le=u(`Pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),I=e(r(),1),L=n(),[R,ue]=o(`Tooltip`,[_]),z=_(),B=`TooltipProvider`,de=700,V=`tooltip.open`,[fe,H]=R(B),U=e=>{let{__scopeTooltip:t,delayDuration:n=de,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=I.useRef(!0),s=I.useRef(!1),c=I.useRef(0);return I.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,L.jsx)(fe,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:I.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:I.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:I.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};U.displayName=B;var W=`Tooltip`,[pe,G]=R(W),K=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=H(W,e.__scopeTooltip),u=z(t),[d,f]=I.useState(null),p=l(),m=I.useRef(0),g=o??c.disableHoverableContent,_=s??c.delayDuration,v=I.useRef(!1),[y,b]=x({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(V))):c.onClose(),a?.(e)},caller:W}),S=I.useMemo(()=>y?v.current?`delayed-open`:`instant-open`:`closed`,[y]),C=I.useCallback(()=>{window.clearTimeout(m.current),m.current=0,v.current=!1,b(!0)},[b]),w=I.useCallback(()=>{window.clearTimeout(m.current),m.current=0,b(!1)},[b]),T=I.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{v.current=!0,b(!0),m.current=0},_)},[_,b]);return I.useEffect(()=>()=>{m.current&&=(window.clearTimeout(m.current),0)},[]),(0,L.jsx)(h,{...u,children:(0,L.jsx)(pe,{scope:t,contentId:p,open:y,stateAttribute:S,trigger:d,onTriggerChange:f,onTriggerEnter:I.useCallback(()=>{c.isOpenDelayedRef.current?T():C()},[c.isOpenDelayedRef,T,C]),onTriggerLeave:I.useCallback(()=>{g?w():(window.clearTimeout(m.current),m.current=0)},[w,g]),onOpen:C,onClose:w,disableHoverableContent:g,children:n})})};K.displayName=W;var q=`TooltipTrigger`,me=I.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=G(q,n),a=H(q,n),o=z(n),c=b(t,I.useRef(null),i.onTriggerChange),l=I.useRef(!1),u=I.useRef(!1),d=I.useCallback(()=>l.current=!1,[]);return I.useEffect(()=>()=>document.removeEventListener(`pointerup`,d),[d]),(0,L.jsx)(g,{asChild:!0,...o,children:(0,L.jsx)(f.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:s(e.onPointerMove,e=>{e.pointerType!==`touch`&&!u.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:s(e.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:s(e.onPointerDown,()=>{i.open&&i.onClose(),l.current=!0,document.addEventListener(`pointerup`,d,{once:!0})}),onFocus:s(e.onFocus,()=>{l.current||i.onOpen()}),onBlur:s(e.onBlur,i.onClose),onClick:s(e.onClick,i.onClose)})})});me.displayName=q;var J=`TooltipPortal`,[he,ge]=R(J,{forceMount:void 0}),_e=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=G(J,t);return(0,L.jsx)(he,{scope:t,forceMount:n,children:(0,L.jsx)(S,{present:n||a.open,children:(0,L.jsx)(d,{asChild:!0,container:i,children:r})})})};_e.displayName=J;var Y=`TooltipContent`,ve=I.forwardRef((e,t)=>{let n=ge(Y,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=G(Y,e.__scopeTooltip);return(0,L.jsx)(S,{present:r||o.open,children:o.disableHoverableContent?(0,L.jsx)(Ce,{side:i,...a,ref:t}):(0,L.jsx)(ye,{side:i,...a,ref:t})})}),ye=I.forwardRef((e,t)=>{let n=G(Y,e.__scopeTooltip),r=H(Y,e.__scopeTooltip),i=I.useRef(null),a=b(t,i),[o,s]=I.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=I.useCallback(()=>{s(null),d(!1)},[d]),p=I.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=De(r,Ee(r,n.getBoundingClientRect())),a=Oe(t.getBoundingClientRect());s(Ae([...i,...a])),d(!0)},[d]);return I.useEffect(()=>()=>f(),[f]),I.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),I.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!ke(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,L.jsx)(Ce,{...e,ref:a})}),[be,xe]=R(W,{isInside:!1}),Se=y(`TooltipContent`),Ce=I.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,l=G(Y,n),u=z(n),{onClose:d}=l;return I.useEffect(()=>(document.addEventListener(V,d),()=>document.removeEventListener(V,d)),[d]),I.useEffect(()=>{if(l.trigger){let e=e=>{e.target?.contains(l.trigger)&&d()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]),(0,L.jsx)(m,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,L.jsxs)(c,{"data-state":l.stateAttribute,...u,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,L.jsx)(Se,{children:r}),(0,L.jsx)(be,{scope:n,isInside:!0,children:(0,L.jsx)(v,{id:l.contentId,role:`tooltip`,children:i||r})})]})})});ve.displayName=Y;var we=`TooltipArrow`,Te=I.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=z(n);return xe(we,n).isInside?null:(0,L.jsx)(p,{...i,...r,ref:t})});Te.displayName=we;function Ee(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function De(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Oe(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function ke(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Ae(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),je(t)}function je(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Me=U,Ne=K,Pe=me,Fe=_e,Ie=ve,Le=Me,Re=Ne,ze=Pe,X=I.forwardRef(({className:e,sideOffset:n=4,...r},i)=>(0,L.jsx)(Fe,{children:(0,L.jsx)(Ie,{ref:i,sideOffset:n,className:t(`z-[var(--z-tooltip,10150)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-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`,e),...r})}));X.displayName=Ie.displayName;var Be={sm:`h-6 w-6 rounded-md p-1`,md:`h-7 w-7 rounded-md p-1.5`,lg:`h-8 w-8 rounded-lg p-1.5`},Ve={default:`text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:text-muted-foreground/45 disabled:hover:bg-transparent disabled:hover:text-muted-foreground/45`,strong:`text-muted-foreground hover:bg-black/10 hover:text-foreground disabled:text-muted-foreground/45 disabled:hover:bg-transparent disabled:hover:text-muted-foreground/45`},Z=I.forwardRef(({className:e,disabled:n=!1,icon:r,label:i,size:a=`md`,tone:o=`default`,tooltip:s,tooltipSide:c=`bottom`,...l},u)=>{let d=(0,L.jsx)(`button`,{...l,ref:u,type:`button`,disabled:n,"aria-label":i,className:t(`inline-flex shrink-0 items-center justify-center transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:cursor-not-allowed`,Be[a],Ve[o],e),children:r}),f=s===!1?null:s??i;return f?(0,L.jsx)(Le,{delayDuration:250,children:(0,L.jsxs)(Re,{disableHoverableContent:!0,children:[(0,L.jsx)(ze,{asChild:!0,onFocus:e=>{e.currentTarget.matches(`:focus-visible`)||e.preventDefault()},children:n?(0,L.jsx)(`span`,{className:`inline-flex`,children:d}):d}),(0,L.jsx)(X,{side:c,className:`text-xs`,children:f})]})}):d});Z.displayName=`IconActionButton`;function He(e,t){e.stopPropagation(),t()}function Ue({tab:e}){let[n,r]=I.useState(!1),i=I.useRef(!0);if(!e.menuActions?.length)return null;let a=e.menuLabel??e.label;return(0,L.jsxs)(T,{open:n,onOpenChange:e=>{e&&(i.current=!0),r(e)},children:[(0,L.jsx)(`div`,{className:t(`-ml-1.5 flex w-0 shrink-0 overflow-hidden opacity-0 transition-[width,margin,opacity] group-hover:ml-0 group-hover:w-5 group-hover:opacity-100 group-focus-within:ml-0 group-focus-within:w-5 group-focus-within:opacity-100`,n?`ml-0 w-5 opacity-100`:null),children:(0,L.jsx)(C,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,"aria-label":a,onClick:e=>e.stopPropagation(),className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors hover:bg-gray-200 hover:text-gray-700 focus-visible:bg-gray-200 focus-visible:text-gray-700 focus-visible:outline-none`,children:(0,L.jsx)(P,{className:`h-3.5 w-3.5`})})})}),(0,L.jsx)(w,{align:`end`,className:`w-40 rounded-xl p-1.5`,onClick:e=>e.stopPropagation(),onCloseAutoFocus:e=>{i.current||e.preventDefault()},children:(0,L.jsx)(`div`,{role:`menu`,"aria-label":a,children:e.menuActions.map(e=>(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,disabled:e.disabled,className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-xs text-gray-700 transition-colors hover:bg-gray-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:cursor-not-allowed disabled:opacity-45`,onClick:()=>{i.current=!1,r(!1),e.onClick()},children:[(0,L.jsx)(`span`,{className:`inline-flex h-4 w-4 shrink-0 items-center justify-center`,children:e.icon}),(0,L.jsx)(`span`,{children:e.label})]},e.key))})})]})}function We({labelClassName:e,tab:n}){let r=n.onClose&&n.closePlacement===`leading-hover`?null:n.leadingIcon,i=(0,L.jsxs)(`button`,{type:`button`,onClick:n.onSelect,"aria-label":n.label,className:`flex min-w-0 flex-1 items-center gap-1.5 text-left`,children:[r?(0,L.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center`,children:r}):null,(0,L.jsx)(`span`,{className:t(`min-w-0 truncate text-[12px] font-medium`,e,n.labelClassName),children:n.label}),n.badge,n.unreadIndicator]}),a=n.tooltip??n.label;return a?(0,L.jsx)(Le,{delayDuration:250,children:(0,L.jsxs)(Re,{children:[(0,L.jsx)(ze,{asChild:!0,children:i}),(0,L.jsx)(X,{side:`bottom`,className:`text-xs`,children:a})]})}):i}function Ge({activeTabClassName:e,inactiveTabClassName:n,itemRef:r,labelClassName:i,tab:a,tabBaseClassName:o}){let s=a.onClose&&a.closePlacement===`leading-hover`;return(0,L.jsxs)(`div`,{ref:r,"data-compact-tab-item":``,onClick:e=>e.target===e.currentTarget&&a.onSelect(),className:t(o??`group flex max-w-[180px] min-w-0 cursor-pointer items-center gap-1.5 border-r border-gray-200/70 border-b-2 px-2.5 py-2 transition-colors`,a.active?e??`border-b-primary bg-white text-gray-900`:n??`border-b-transparent bg-gray-50/85 text-gray-500 hover:bg-gray-100`),children:[s?(0,L.jsxs)(`button`,{type:`button`,onClick:e=>He(e,a.onClose),className:`relative inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors hover:bg-gray-200 hover:text-gray-700`,"aria-label":a.closeLabel,children:[(0,L.jsx)(`span`,{className:`flex items-center justify-center group-hover:hidden`,children:a.leadingIcon}),(0,L.jsx)(k,{className:`hidden h-3.5 w-3.5 group-hover:block`})]}):null,(0,L.jsx)(We,{tab:a,labelClassName:i}),(0,L.jsx)(Ue,{tab:a}),a.onClose&&a.closePlacement!==`leading-hover`?(0,L.jsx)(Z,{size:`sm`,tone:`strong`,icon:(0,L.jsx)(k,{className:`h-3 w-3`}),label:a.closeLabel??``,tooltip:a.closeLabel??null,onClick:e=>He(e,a.onClose)}):null]})}function Ke({actionButtonClassName:e,actions:n,actionsClassName:r,actionsTestId:i,className:a,onPointerDown:o,onScrollPointerDown:s,scrollClassName:c,scrollTestId:l,tabs:u,tabsClassName:d,testId:f,...p}){let m=I.useCallback(e=>{e?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[]);return(0,L.jsxs)(`div`,{"data-testid":f,className:t(`flex min-w-0 items-stretch border-b border-gray-200/70 bg-gray-50/85`,a),onPointerDown:o,children:[(0,L.jsx)(`div`,{className:t(`min-w-0 flex-1 overflow-x-auto overflow-y-hidden`,c),onPointerDown:s,children:(0,L.jsx)(`div`,{"data-testid":l,className:t(`flex min-w-max items-stretch`,d),children:u.map(e=>(0,L.jsx)(Ge,{itemRef:e.active?m:void 0,tab:e,...p},e.key))})}),(0,L.jsx)(`div`,{className:t(`flex shrink-0 items-center gap-1`,r),"data-testid":i,onPointerDown:e=>e.stopPropagation(),children:n.map(t=>(0,L.jsx)(Z,{icon:t.icon,label:t.label,disabled:t.disabled,onClick:t.onClick,className:e},t.key))})]})}function qe(){return(0,L.jsx)(`div`,{className:`flex h-full items-center justify-center bg-background px-5 py-6`,children:(0,L.jsxs)(`div`,{className:`flex max-w-[260px] flex-col items-center gap-3 text-center`,children:[(0,L.jsx)(`span`,{className:`flex h-12 w-12 items-center justify-center rounded-lg border border-border bg-muted text-muted-foreground shadow-[0_1px_2px_rgba(30,20,10,0.04)]`,children:(0,L.jsx)(N,{className:`h-5 w-5`})}),(0,L.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:a(`docBrowserHomeTitle`)})]})})}function Je({isVisible:e,onRefresh:t,onSubmit:n,onUrlInputChange:r,placeholder:i,urlInput:o}){return e?(0,L.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 bg-card px-3.5 py-2 shrink-0`,children:[(0,L.jsxs)(`form`,{onSubmit:n,className:`flex-1 relative`,children:[(0,L.jsx)(E,{className:`absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/70`}),(0,L.jsx)(`input`,{type:`text`,value:o,onChange:e=>r(e.target.value),"aria-label":a(`docBrowserAddressLabel`),placeholder:i,className:`h-8 w-full rounded-lg border border-border/75 bg-background pl-8 pr-3 text-xs text-foreground transition-colors placeholder:text-muted-foreground/55 focus:border-border focus:outline-none focus:ring-0`})]}),(0,L.jsx)(Z,{icon:(0,L.jsx)(O,{className:`h-3.5 w-3.5`}),label:a(`docBrowserRefresh`),onClick:t})]}):null}function Ye({currentTab:e,currentUrl:t,customContent:n,iframeRef:r,iframeInstanceId:a,iframeSandbox:o,isDragging:s,isResizing:c,onIframePointerOver:l}){return(0,L.jsxs)(`div`,{className:`flex-1 relative overflow-hidden`,children:[n||(0,L.jsx)(`iframe`,{ref:r,src:t,name:i(e?.contentParams),className:`absolute inset-0 w-full h-full border-0`,title:e?.title||`NextClaw Docs`,sandbox:o,tabIndex:l?0:void 0,onPointerOver:l,allow:`clipboard-read; clipboard-write`,allowFullScreen:!0},a),(c||s)&&(0,L.jsx)(`div`,{className:`absolute inset-0 z-10`})]})}function Xe(e){try{let t=new URL(e,window.location.origin);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function Ze({currentUrl:e,isVisible:t}){if(!t||!Xe(e))return null;let n=A(e)?a(`docBrowserOpenExternal`):a(`docBrowserOpenInBrowser`);return(0,L.jsx)(`div`,{className:`flex items-center justify-between border-t border-border/70 bg-muted/55 px-4 py-2 shrink-0`,children:(0,L.jsx)(te,{href:e,external:!0,iconPosition:`trailing`,size:`xs`,"data-doc-external":!0,children:n})})}function Qe(e){return e instanceof Element&&!!e.closest(`button, a, input, textarea, select, [data-compact-tab-item]`)}function $e({tabs:e,activeTabId:n,canGoBack:r,canGoForward:i,isDocked:o,isFullscreen:s,dockState:c,onGoBack:l,onGoForward:u,onOpenNewTab:d,onToggleDock:f,onSetActiveTab:p,onCloseTab:m,onClose:h,onDragStart:g,onToggleMode:_}){let v=a(`docBrowserBack`),y=a(`docBrowserClose`),b=a(`docBrowserCloseTab`),x=c?.isDocked?c.removable?a(`sideDockUnpinCurrent`):a(`sideDockBuiltInDocked`):a(`sideDockPinCurrent`),S=a(`docBrowserForward`),C=a(o?`docBrowserFloatMode`:`docBrowserDockMode`),w=a(`docBrowserNewTab`);return(0,L.jsx)(Ke,{testId:`doc-browser-tab-strip`,actionsTestId:`doc-browser-tab-actions`,tabs:e.map(e=>({key:e.id,label:e.title||a(`docBrowserTabUntitled`),active:e.id===n,tooltip:e.title,closeLabel:b,closePlacement:`trailing`,onSelect:()=>p(e.id),onClose:()=>m(e.id)})),actions:[{key:`back`,disabled:!r,icon:(0,L.jsx)(ee,{className:`h-3.5 w-3.5`}),label:v,onClick:l},{key:`forward`,disabled:!i,icon:(0,L.jsx)(M,{className:`h-3.5 w-3.5`}),label:S,onClick:u},{key:`new-tab`,icon:(0,L.jsx)(D,{className:`h-3.5 w-3.5`}),label:w,onClick:d},...c?.canDock?[{key:`dock`,disabled:c.isDocked&&!c.removable,icon:c.isDocked&&c.removable?(0,L.jsx)(ce,{className:`h-3.5 w-3.5`}):(0,L.jsx)(le,{className:`h-3.5 w-3.5`}),label:x,onClick:()=>f?.()}]:[],...s?[]:[{key:`mode`,icon:o?(0,L.jsx)(se,{className:`h-3.5 w-3.5`}):(0,L.jsx)(F,{className:`h-3.5 w-3.5`}),label:C,onClick:_}],{key:`close`,icon:(0,L.jsx)(k,{className:`h-3.5 w-3.5`}),label:y,onClick:h}],className:t(`h-10 gap-1.5 border-border/50 bg-card/80 px-2 shrink-0 select-none`,s&&`h-[calc(env(safe-area-inset-top,0px)+2.5rem)] pt-[env(safe-area-inset-top,0px)]`),scrollClassName:t(`doc-browser-tab-scrollbar flex h-full items-center gap-0.5`,!o&&!s&&`cursor-grab active:cursor-grabbing`),tabsClassName:`items-center gap-0.5`,actionsClassName:`h-full items-center gap-0.5`,actionButtonClassName:`rounded-md p-1.5 text-muted-foreground hover:bg-muted/60 hover:text-foreground disabled:opacity-50`,tabBaseClassName:`group inline-flex min-w-0 cursor-pointer items-center gap-0.5 h-7 px-2 rounded-md text-xs max-w-[220px] shrink-0 transition-colors`,activeTabClassName:`bg-muted/80 text-foreground`,inactiveTabClassName:`text-muted-foreground hover:bg-muted/45 hover:text-foreground`,labelClassName:`px-0.5 text-xs font-normal`,onPointerDown:!o&&!s?g:void 0,onScrollPointerDown:e=>{if(Qe(e.target)){e.stopPropagation();return}!o&&!s&&(e.stopPropagation(),g(e))}})}var Q=40,et=360,tt=400;function $(e,t,n){return Math.min(n,Math.max(t,e))}function nt(e,t){return e.split(`-`).includes(t)}function rt(){return{x:Math.max(Q,window.innerWidth-520),y:80,w:480,h:600}}function it(e,t,n){return{...e,x:$(e.x+t,Q,window.innerWidth-Q-e.w),y:$(e.y+n,Q,window.innerHeight-Q-e.h)}}function at(e,t,n,r){let i=t.x+t.w,a=t.y+t.h,o=nt(e,`left`)?$(t.x+n,Q,i-et):t.x,s=nt(e,`right`)?$(i+n,o+et,window.innerWidth-Q):i,c=nt(e,`top`)?$(t.y+r,Q,a-tt):t.y,l=nt(e,`bottom`)?$(a+r,c+tt,window.innerHeight-Q):a;return{x:o,y:c,w:s-o,h:l-c}}function ot({children:e,className:n,style:r,defaultWidth:i=420,minWidth:a=320,maxWidth:o=860,onWidthCommit:s,overlay:c=!1,overlayScope:l=`viewport`,width:u,...d}){let f=(0,I.useRef)(null),p=(0,I.useRef)(u??i),[m,h]=(0,I.useState)(!1),[g,_]=(0,I.useState)(null),[v,y]=(0,I.useState)(i),b=g??u??v,x=c?l===`container`?`absolute inset-0 z-30`:`fixed inset-0 z-40`:`border-l border-border`,S=e=>{if(c)return;e.preventDefault(),e.stopPropagation(),e.currentTarget.setPointerCapture?.(e.pointerId),h(!0),p.current=b,f.current={startX:e.clientX,startWidth:b};let t=e=>{let t=f.current;if(!t)return;let n=t.startWidth+t.startX-e.clientX,r=Math.max(a,Math.min(o,n));p.current=r,_(r)},n=()=>{u===void 0&&y(p.current),s?.(p.current),_(null),h(!1),f.current=null,window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,n)};window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,n)};return(0,L.jsxs)(`aside`,{...d,className:t(`relative flex h-full min-h-0 shrink-0 overflow-hidden bg-card text-card-foreground`,x,n),style:c?r:{...r,width:b},children:[c?null:(0,L.jsx)(`div`,{className:`absolute left-0 top-0 z-20 h-full w-3 cursor-ew-resize transition-colors hover:bg-primary/10`,"data-testid":`resizable-right-panel-handle`,onPointerDown:S}),(0,L.jsx)(`div`,{className:`flex h-full min-h-0 w-full flex-col overflow-hidden`,children:e}),m?(0,L.jsx)(`div`,{className:`absolute inset-0 z-10 cursor-ew-resize`,"data-testid":`resizable-right-panel-resize-shield`}):null]})}var st=`allow-same-origin allow-scripts allow-popups allow-forms`;function ct(e,t){if(e.startsWith(`/`))try{return new URL(e,t).toString()}catch{return e}return/^[a-z][a-z\d+.-]*:\/\//i.test(e)||e===`about:blank`?e:/^(localhost|127\.|0\.0\.0\.0|\[::1\])(?::|\/|$)/i.test(e)?`http://${e}`:`https://${e}`}function lt(e,t){if(!t)return st;let n=e?.getIframeSandbox?.(t);return n===void 0?t.kind===`content`?void 0:st:n}function ut(e,t,n){return(0,I.useCallback)(()=>{if(n?.canDock){if(n.isDocked){n.removable&&e?.unpinTab(t);return}e?.pinTab(t)}},[t,e,n])}function dt({activeTabId:e,currentUrl:t,isAddressToolbarTab:n,isContentTab:r,isDocsTab:i,navigate:a}){let o=`${e}:${t}:${r?`content`:`docs`}`,[s,c]=(0,I.useState)(null),l=(()=>{if(!n)return``;if(r)return t;try{return new URL(t).pathname}catch{return t}})(),u=s?.key===o?s.value:l,d=(0,I.useCallback)(e=>c({key:o,value:e}),[o]);return{handleUrlSubmit:(0,I.useCallback)(e=>{if(e.preventDefault(),!n)return;let r=u.trim();r&&(i&&r.startsWith(`/`)?a(j(r)):i&&r.startsWith(`http`)?a(r):a(i?j(`/${r}`):ct(r,t)))},[t,n,i,a,u]),setUrlInput:d,urlInput:u}}function ft({customTabRenderers:e={},displayMode:n=`desktop`,dockControls:r}){let{isOpen:i,mode:o,dockedWidth:s,tabs:c,activeTabId:l,activeHistory:u,activeHistoryIndex:d,currentTab:f,open:p,openTarget:m,openNewTab:h,close:g,toggleMode:_,setDockedWidth:v,goBack:y,goForward:b,navigate:x,syncUrl:S,setActiveTab:C,closeTab:w}=ie(),[T,ee]=(0,I.useState)(0),[E,te]=(0,I.useState)(rt),[D,O]=(0,I.useState)(null),k=(0,I.useRef)(null),A=f?.currentUrl??ae(),j=f?.navVersion??0,M=`${l}:${j}:${T}`,N=(0,I.useRef)(null),P=(0,I.useRef)(j),F=f?.kind===`docs`,se=f?.kind===re,ce=d>0,le=d<u.length-1,R=f?e[f.kind]:void 0,ue=r?.getDockState(f),z=f?.kind===`content`,B=F||z,{handleUrlSubmit:de,setUrlInput:V,urlInput:fe}=dt({activeTabId:l,currentUrl:A,isAddressToolbarTab:B,isContentTab:z,isDocsTab:F,navigate:x});(0,I.useEffect)(()=>{if(!F){N.current=null;return}if(j!==P.current){P.current=j,N.current=ne(A);return}if(k.current?.contentWindow)try{let e=new URL(A).pathname;N.current=ne(A),k.current.contentWindow.postMessage({type:`docs-navigate`,path:e},`*`)}catch{}},[A,j,F]),(0,I.useEffect)(()=>{let e=e=>{if(F&&e.data?.type===`docs-route-change`&&typeof e.data.url==`string`){let t=ne(e.data.url);if(N.current&&t!==N.current)return;N.current=null,S(e.data.url)}};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[A,S,F]),(0,I.useEffect)(()=>{if(!f||!R?.onIframeMessage)return;let e=e=>{R.onIframeMessage?.({event:e,iframe:k.current,iframeInstanceId:M,tab:f})};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[f,R,M]);let H=(0,I.useCallback)(e=>{e.preventDefault(),O({kind:`drag`,startX:e.clientX,startY:e.clientY,startRect:E})},[E]),U=(0,I.useCallback)(e=>t=>{t.preventDefault(),t.stopPropagation(),O({kind:`resize`,edge:e,startX:t.clientX,startY:t.clientY,startRect:E})},[E]);(0,I.useEffect)(()=>{if(!D)return;let e=e=>{let{startRect:t,startX:n,startY:r}=D,i=e.clientX-n,a=e.clientY-r;if(D.kind===`drag`){te(it(t,i,a));return}te(at(D.edge,t,i,a))},t=()=>O(null);return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[D]);let W=(0,I.useCallback)(()=>{ee(e=>e+1)},[]),pe=ut(r,f,ue);if(!i)return null;let G=o===`docked`,K=n===`fullscreen`,q=f?{currentUrl:A,open:p,openTarget:m,refreshIframe:W,tab:f}:void 0,me=q?R?.renderToolbar?.(q):null,J=q?R?.renderContent?.(q)??(se?(0,L.jsx)(qe,{}):null):null,he=lt(R,f),ge=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)($e,{tabs:c,activeTabId:l,canGoBack:ce,canGoForward:le,dockState:ue,isDocked:G,isFullscreen:K,onGoBack:y,onGoForward:b,onOpenNewTab:h,onToggleDock:pe,onSetActiveTab:C,onCloseTab:w,onClose:g,onDragStart:H,onToggleMode:_}),(0,L.jsx)(Je,{isVisible:B,onRefresh:W,onSubmit:de,onUrlInputChange:V,placeholder:a(F?`docBrowserSearchPlaceholder`:`docBrowserAddressPlaceholder`),urlInput:fe}),me,(0,L.jsx)(Ye,{currentTab:f,currentUrl:A,customContent:J,iframeRef:k,iframeInstanceId:M,iframeSandbox:he,isDragging:D?.kind===`drag`,isResizing:D?.kind===`resize`,onIframePointerOver:R?.onIframePointerOver}),(0,L.jsx)(Ze,{currentUrl:A,isVisible:F||z})]});return G&&!K?(0,L.jsx)(ot,{"data-testid":`doc-browser-panel`,defaultWidth:s,width:s,minWidth:320,maxWidth:860,onWidthCommit:v,children:ge}):(0,L.jsxs)(`div`,{"data-testid":`doc-browser-panel`,className:t(`relative flex flex-col overflow-hidden bg-card text-card-foreground`,K?`fixed inset-0 z-[var(--z-floating-panel)] h-[100dvh] w-screen rounded-none border-0 shadow-2xl`:`rounded-2xl border border-border shadow-2xl`),style:K?void 0:{position:`fixed`,left:E.x,top:E.y,width:E.w,height:E.h,zIndex:`var(--z-floating-panel)`},children:[ge,!G&&!K&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`absolute top-0 left-0 h-3 w-full cursor-ns-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-top`,onPointerDown:U(`top`)}),(0,L.jsx)(`div`,{className:`absolute top-0 left-0 w-3 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-left`,onPointerDown:U(`left`)}),(0,L.jsx)(`div`,{className:`absolute top-0 right-0 w-3 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-right`,onPointerDown:U(`right`)}),(0,L.jsx)(`div`,{className:`absolute bottom-0 left-0 h-3 w-full cursor-ns-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-bottom`,onPointerDown:U(`bottom`)}),(0,L.jsx)(`div`,{className:`absolute top-0 left-0 z-30 h-4 w-4 cursor-nw-resize hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-top-left`,onPointerDown:U(`top-left`)}),(0,L.jsx)(`div`,{className:`absolute top-0 right-0 z-30 h-4 w-4 cursor-ne-resize hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-top-right`,onPointerDown:U(`top-right`)}),(0,L.jsx)(`div`,{className:`absolute bottom-0 left-0 z-30 h-4 w-4 cursor-sw-resize hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-bottom-left`,onPointerDown:U(`bottom-left`)}),(0,L.jsx)(`div`,{className:`absolute bottom-0 right-0 z-30 flex h-4 w-4 cursor-se-resize items-center justify-center text-muted-foreground/45 transition-colors hover:text-muted-foreground`,"data-testid":`doc-browser-resize-bottom-right`,onPointerDown:U(`bottom-right`),children:(0,L.jsx)(oe,{className:`w-3 h-3 rotate-[-45deg]`})})]})]})}export{N as _,Re as a,ze as c,Me as d,Ne as f,P as g,F as h,Z as i,Ie as l,le as m,ot as n,X as o,Pe as p,Ke as r,Le as s,ft as t,Fe as u,M as v};
|
|
1
|
+
import{i as e}from"./chunk-DseTPa7n.js";import{D as t,d as n,k as r,r as i,w as a}from"./react-39CDNZlM.js";import{C as o,T as s,a as c,b as l,c as u,f as d,g as f,i as p,m,o as h,r as g,s as _,t as v,v as y,w as b,y as x}from"./dist-rYHnBo8t.js";import{d as S,i as C,r as w,t as T}from"./popover-ZoDwVwwd.js";import{n as ee,t as E}from"./search-BhXQB2TO.js";import{t as te}from"./navigation-link-C1cvB7y4.js";import{t as D}from"./plus-DI37QuHc.js";import{t as O}from"./refresh-cw-DKewcdAl.js";import{t as k}from"./x-C1ijNWcE.js";import{_ as ne,d as re,g as A,m as j,n as ie,p as ae}from"./doc-browser-context-CPHNzQ8m.js";var M=u(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),N=u(`Boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),P=u(`EllipsisVertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),oe=u(`GripVertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),F=u(`PanelRightOpen`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),se=u(`PictureInPicture2`,[[`path`,{d:`M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4`,key:`daa4of`}],[`rect`,{width:`10`,height:`7`,x:`12`,y:`13`,rx:`2`,key:`1nb8gs`}]]),ce=u(`PinOff`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),le=u(`Pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),I=e(r(),1),L=t(),[R,ue]=o(`Tooltip`,[_]),z=_(),B=`TooltipProvider`,de=700,V=`tooltip.open`,[fe,H]=R(B),U=e=>{let{__scopeTooltip:t,delayDuration:n=de,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=I.useRef(!0),s=I.useRef(!1),c=I.useRef(0);return I.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,L.jsx)(fe,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:I.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:I.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:I.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};U.displayName=B;var W=`Tooltip`,[pe,G]=R(W),K=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=H(W,e.__scopeTooltip),u=z(t),[d,f]=I.useState(null),p=l(),m=I.useRef(0),g=o??c.disableHoverableContent,_=s??c.delayDuration,v=I.useRef(!1),[y,b]=x({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(V))):c.onClose(),a?.(e)},caller:W}),S=I.useMemo(()=>y?v.current?`delayed-open`:`instant-open`:`closed`,[y]),C=I.useCallback(()=>{window.clearTimeout(m.current),m.current=0,v.current=!1,b(!0)},[b]),w=I.useCallback(()=>{window.clearTimeout(m.current),m.current=0,b(!1)},[b]),T=I.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{v.current=!0,b(!0),m.current=0},_)},[_,b]);return I.useEffect(()=>()=>{m.current&&=(window.clearTimeout(m.current),0)},[]),(0,L.jsx)(h,{...u,children:(0,L.jsx)(pe,{scope:t,contentId:p,open:y,stateAttribute:S,trigger:d,onTriggerChange:f,onTriggerEnter:I.useCallback(()=>{c.isOpenDelayedRef.current?T():C()},[c.isOpenDelayedRef,T,C]),onTriggerLeave:I.useCallback(()=>{g?w():(window.clearTimeout(m.current),m.current=0)},[w,g]),onOpen:C,onClose:w,disableHoverableContent:g,children:n})})};K.displayName=W;var q=`TooltipTrigger`,me=I.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=G(q,n),a=H(q,n),o=z(n),c=b(t,I.useRef(null),i.onTriggerChange),l=I.useRef(!1),u=I.useRef(!1),d=I.useCallback(()=>l.current=!1,[]);return I.useEffect(()=>()=>document.removeEventListener(`pointerup`,d),[d]),(0,L.jsx)(g,{asChild:!0,...o,children:(0,L.jsx)(f.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:s(e.onPointerMove,e=>{e.pointerType!==`touch`&&!u.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:s(e.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:s(e.onPointerDown,()=>{i.open&&i.onClose(),l.current=!0,document.addEventListener(`pointerup`,d,{once:!0})}),onFocus:s(e.onFocus,()=>{l.current||i.onOpen()}),onBlur:s(e.onBlur,i.onClose),onClick:s(e.onClick,i.onClose)})})});me.displayName=q;var J=`TooltipPortal`,[he,ge]=R(J,{forceMount:void 0}),_e=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=G(J,t);return(0,L.jsx)(he,{scope:t,forceMount:n,children:(0,L.jsx)(S,{present:n||a.open,children:(0,L.jsx)(d,{asChild:!0,container:i,children:r})})})};_e.displayName=J;var Y=`TooltipContent`,ve=I.forwardRef((e,t)=>{let n=ge(Y,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=G(Y,e.__scopeTooltip);return(0,L.jsx)(S,{present:r||o.open,children:o.disableHoverableContent?(0,L.jsx)(Ce,{side:i,...a,ref:t}):(0,L.jsx)(ye,{side:i,...a,ref:t})})}),ye=I.forwardRef((e,t)=>{let n=G(Y,e.__scopeTooltip),r=H(Y,e.__scopeTooltip),i=I.useRef(null),a=b(t,i),[o,s]=I.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=I.useCallback(()=>{s(null),d(!1)},[d]),p=I.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=De(r,Ee(r,n.getBoundingClientRect())),a=Oe(t.getBoundingClientRect());s(Ae([...i,...a])),d(!0)},[d]);return I.useEffect(()=>()=>f(),[f]),I.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),I.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!ke(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,L.jsx)(Ce,{...e,ref:a})}),[be,xe]=R(W,{isInside:!1}),Se=y(`TooltipContent`),Ce=I.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,l=G(Y,n),u=z(n),{onClose:d}=l;return I.useEffect(()=>(document.addEventListener(V,d),()=>document.removeEventListener(V,d)),[d]),I.useEffect(()=>{if(l.trigger){let e=e=>{e.target?.contains(l.trigger)&&d()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]),(0,L.jsx)(m,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,L.jsxs)(c,{"data-state":l.stateAttribute,...u,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,L.jsx)(Se,{children:r}),(0,L.jsx)(be,{scope:n,isInside:!0,children:(0,L.jsx)(v,{id:l.contentId,role:`tooltip`,children:i||r})})]})})});ve.displayName=Y;var we=`TooltipArrow`,Te=I.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=z(n);return xe(we,n).isInside?null:(0,L.jsx)(p,{...i,...r,ref:t})});Te.displayName=we;function Ee(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function De(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Oe(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function ke(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Ae(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),je(t)}function je(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Me=U,Ne=K,Pe=me,Fe=_e,Ie=ve,Le=Me,Re=Ne,ze=Pe,X=I.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,L.jsx)(Fe,{children:(0,L.jsx)(Ie,{ref:r,sideOffset:t,className:a(`z-[var(--z-tooltip,10150)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-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`,e),...n})}));X.displayName=Ie.displayName;var Be={sm:`h-6 w-6 rounded-md p-1`,md:`h-7 w-7 rounded-md p-1.5`,lg:`h-8 w-8 rounded-lg p-1.5`},Ve={default:`text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:text-muted-foreground/45 disabled:hover:bg-transparent disabled:hover:text-muted-foreground/45`,strong:`text-muted-foreground hover:bg-black/10 hover:text-foreground disabled:text-muted-foreground/45 disabled:hover:bg-transparent disabled:hover:text-muted-foreground/45`},Z=I.forwardRef(({className:e,disabled:t=!1,icon:n,label:r,size:i=`md`,tone:o=`default`,tooltip:s,tooltipSide:c=`bottom`,...l},u)=>{let d=(0,L.jsx)(`button`,{...l,ref:u,type:`button`,disabled:t,"aria-label":r,className:a(`inline-flex shrink-0 items-center justify-center transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:cursor-not-allowed`,Be[i],Ve[o],e),children:n}),f=s===!1?null:s??r;return f?(0,L.jsx)(Le,{delayDuration:250,children:(0,L.jsxs)(Re,{disableHoverableContent:!0,children:[(0,L.jsx)(ze,{asChild:!0,onFocus:e=>{e.currentTarget.matches(`:focus-visible`)||e.preventDefault()},children:t?(0,L.jsx)(`span`,{className:`inline-flex`,children:d}):d}),(0,L.jsx)(X,{side:c,className:`text-xs`,children:f})]})}):d});Z.displayName=`IconActionButton`;function He(e,t){e.stopPropagation(),t()}function Ue({tab:e}){let[t,n]=I.useState(!1),r=I.useRef(!0);if(!e.menuActions?.length)return null;let i=e.menuLabel??e.label;return(0,L.jsxs)(T,{open:t,onOpenChange:e=>{e&&(r.current=!0),n(e)},children:[(0,L.jsx)(`div`,{className:a(`-ml-1.5 flex w-0 shrink-0 overflow-hidden opacity-0 transition-[width,margin,opacity] group-hover:ml-0 group-hover:w-5 group-hover:opacity-100 group-focus-within:ml-0 group-focus-within:w-5 group-focus-within:opacity-100`,t?`ml-0 w-5 opacity-100`:null),children:(0,L.jsx)(C,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,"aria-label":i,onClick:e=>e.stopPropagation(),className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors hover:bg-gray-200 hover:text-gray-700 focus-visible:bg-gray-200 focus-visible:text-gray-700 focus-visible:outline-none`,children:(0,L.jsx)(P,{className:`h-3.5 w-3.5`})})})}),(0,L.jsx)(w,{align:`end`,className:`w-40 rounded-xl p-1.5`,onClick:e=>e.stopPropagation(),onCloseAutoFocus:e=>{r.current||e.preventDefault()},children:(0,L.jsx)(`div`,{role:`menu`,"aria-label":i,children:e.menuActions.map(e=>(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,disabled:e.disabled,className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-xs text-gray-700 transition-colors hover:bg-gray-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:cursor-not-allowed disabled:opacity-45`,onClick:()=>{r.current=!1,n(!1),e.onClick()},children:[(0,L.jsx)(`span`,{className:`inline-flex h-4 w-4 shrink-0 items-center justify-center`,children:e.icon}),(0,L.jsx)(`span`,{children:e.label})]},e.key))})})]})}function We({labelClassName:e,tab:t}){let n=t.onClose&&t.closePlacement===`leading-hover`?null:t.leadingIcon,r=(0,L.jsxs)(`button`,{type:`button`,onClick:t.onSelect,"aria-label":t.label,className:`flex min-w-0 flex-1 items-center gap-1.5 text-left`,children:[n?(0,L.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center`,children:n}):null,(0,L.jsx)(`span`,{className:a(`min-w-0 truncate text-[12px] font-medium`,e,t.labelClassName),children:t.label}),t.badge,t.unreadIndicator]}),i=t.tooltip??t.label;return i?(0,L.jsx)(Le,{delayDuration:250,children:(0,L.jsxs)(Re,{children:[(0,L.jsx)(ze,{asChild:!0,children:r}),(0,L.jsx)(X,{side:`bottom`,className:`text-xs`,children:i})]})}):r}function Ge({activeTabClassName:e,inactiveTabClassName:t,itemRef:n,labelClassName:r,tab:i,tabBaseClassName:o}){let s=i.onClose&&i.closePlacement===`leading-hover`;return(0,L.jsxs)(`div`,{ref:n,"data-compact-tab-item":``,onClick:e=>e.target===e.currentTarget&&i.onSelect(),className:a(o??`group flex max-w-[180px] min-w-0 cursor-pointer items-center gap-1.5 border-r border-gray-200/70 border-b-2 px-2.5 py-2 transition-colors`,i.active?e??`border-b-primary bg-white text-gray-900`:t??`border-b-transparent bg-gray-50/85 text-gray-500 hover:bg-gray-100`),children:[s?(0,L.jsxs)(`button`,{type:`button`,onClick:e=>He(e,i.onClose),className:`relative inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors hover:bg-gray-200 hover:text-gray-700`,"aria-label":i.closeLabel,children:[(0,L.jsx)(`span`,{className:`flex items-center justify-center group-hover:hidden`,children:i.leadingIcon}),(0,L.jsx)(k,{className:`hidden h-3.5 w-3.5 group-hover:block`})]}):null,(0,L.jsx)(We,{tab:i,labelClassName:r}),(0,L.jsx)(Ue,{tab:i}),i.onClose&&i.closePlacement!==`leading-hover`?(0,L.jsx)(Z,{size:`sm`,tone:`strong`,icon:(0,L.jsx)(k,{className:`h-3 w-3`}),label:i.closeLabel??``,tooltip:i.closeLabel??null,onClick:e=>He(e,i.onClose)}):null]})}function Ke({actionButtonClassName:e,actions:t,actionsClassName:n,actionsTestId:r,className:i,onPointerDown:o,onScrollPointerDown:s,scrollClassName:c,scrollTestId:l,tabs:u,tabsClassName:d,testId:f,...p}){let m=I.useCallback(e=>{e?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[]);return(0,L.jsxs)(`div`,{"data-testid":f,className:a(`flex min-w-0 items-stretch border-b border-gray-200/70 bg-gray-50/85`,i),onPointerDown:o,children:[(0,L.jsx)(`div`,{className:a(`min-w-0 flex-1 overflow-x-auto overflow-y-hidden`,c),onPointerDown:s,children:(0,L.jsx)(`div`,{"data-testid":l,className:a(`flex min-w-max items-stretch`,d),children:u.map(e=>(0,L.jsx)(Ge,{itemRef:e.active?m:void 0,tab:e,...p},e.key))})}),(0,L.jsx)(`div`,{className:a(`flex shrink-0 items-center gap-1`,n),"data-testid":r,onPointerDown:e=>e.stopPropagation(),children:t.map(t=>(0,L.jsx)(Z,{icon:t.icon,label:t.label,disabled:t.disabled,onClick:t.onClick,className:e},t.key))})]})}function qe(){return(0,L.jsx)(`div`,{className:`flex h-full items-center justify-center bg-background px-5 py-6`,children:(0,L.jsxs)(`div`,{className:`flex max-w-[260px] flex-col items-center gap-3 text-center`,children:[(0,L.jsx)(`span`,{className:`flex h-12 w-12 items-center justify-center rounded-lg border border-border bg-muted text-muted-foreground shadow-[0_1px_2px_rgba(30,20,10,0.04)]`,children:(0,L.jsx)(N,{className:`h-5 w-5`})}),(0,L.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:i(`docBrowserHomeTitle`)})]})})}function Je({isVisible:e,onRefresh:t,onSubmit:n,onUrlInputChange:r,placeholder:a,urlInput:o}){return e?(0,L.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 bg-card px-3.5 py-2 shrink-0`,children:[(0,L.jsxs)(`form`,{onSubmit:n,className:`flex-1 relative`,children:[(0,L.jsx)(E,{className:`absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/70`}),(0,L.jsx)(`input`,{type:`text`,value:o,onChange:e=>r(e.target.value),"aria-label":i(`docBrowserAddressLabel`),placeholder:a,className:`h-8 w-full rounded-lg border border-border/75 bg-background pl-8 pr-3 text-xs text-foreground transition-colors placeholder:text-muted-foreground/55 focus:border-border focus:outline-none focus:ring-0`})]}),(0,L.jsx)(Z,{icon:(0,L.jsx)(O,{className:`h-3.5 w-3.5`}),label:i(`docBrowserRefresh`),onClick:t})]}):null}function Ye({currentTab:e,currentUrl:t,customContent:r,iframeRef:i,iframeInstanceId:a,iframeSandbox:o,isDragging:s,isResizing:c,onIframePointerOver:l}){return(0,L.jsxs)(`div`,{className:`flex-1 relative overflow-hidden`,children:[r||(0,L.jsx)(`iframe`,{ref:i,src:t,name:n(e?.contentParams),className:`absolute inset-0 w-full h-full border-0`,title:e?.title||`NextClaw Docs`,sandbox:o,tabIndex:l?0:void 0,onPointerOver:l,allow:`clipboard-read; clipboard-write`,allowFullScreen:!0},a),(c||s)&&(0,L.jsx)(`div`,{className:`absolute inset-0 z-10`})]})}function Xe(e){try{let t=new URL(e,window.location.origin);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function Ze({currentUrl:e,isVisible:t}){if(!t||!Xe(e))return null;let n=A(e)?i(`docBrowserOpenExternal`):i(`docBrowserOpenInBrowser`);return(0,L.jsx)(`div`,{className:`flex items-center justify-between border-t border-border/70 bg-muted/55 px-4 py-2 shrink-0`,children:(0,L.jsx)(te,{href:e,external:!0,iconPosition:`trailing`,size:`xs`,"data-doc-external":!0,children:n})})}function Qe(e){return e instanceof Element&&!!e.closest(`button, a, input, textarea, select, [data-compact-tab-item]`)}function $e({tabs:e,activeTabId:t,canGoBack:n,canGoForward:r,isDocked:o,isFullscreen:s,dockState:c,onGoBack:l,onGoForward:u,onOpenNewTab:d,onToggleDock:f,onSetActiveTab:p,onCloseTab:m,onClose:h,onDragStart:g,onToggleMode:_}){let v=i(`docBrowserBack`),y=i(`docBrowserClose`),b=i(`docBrowserCloseTab`),x=c?.isDocked?c.removable?i(`sideDockUnpinCurrent`):i(`sideDockBuiltInDocked`):i(`sideDockPinCurrent`),S=i(`docBrowserForward`),C=i(o?`docBrowserFloatMode`:`docBrowserDockMode`),w=i(`docBrowserNewTab`);return(0,L.jsx)(Ke,{testId:`doc-browser-tab-strip`,actionsTestId:`doc-browser-tab-actions`,tabs:e.map(e=>({key:e.id,label:e.title||i(`docBrowserTabUntitled`),active:e.id===t,tooltip:e.title,closeLabel:b,closePlacement:`trailing`,onSelect:()=>p(e.id),onClose:()=>m(e.id)})),actions:[{key:`back`,disabled:!n,icon:(0,L.jsx)(ee,{className:`h-3.5 w-3.5`}),label:v,onClick:l},{key:`forward`,disabled:!r,icon:(0,L.jsx)(M,{className:`h-3.5 w-3.5`}),label:S,onClick:u},{key:`new-tab`,icon:(0,L.jsx)(D,{className:`h-3.5 w-3.5`}),label:w,onClick:d},...c?.canDock?[{key:`dock`,disabled:c.isDocked&&!c.removable,icon:c.isDocked&&c.removable?(0,L.jsx)(ce,{className:`h-3.5 w-3.5`}):(0,L.jsx)(le,{className:`h-3.5 w-3.5`}),label:x,onClick:()=>f?.()}]:[],...s?[]:[{key:`mode`,icon:o?(0,L.jsx)(se,{className:`h-3.5 w-3.5`}):(0,L.jsx)(F,{className:`h-3.5 w-3.5`}),label:C,onClick:_}],{key:`close`,icon:(0,L.jsx)(k,{className:`h-3.5 w-3.5`}),label:y,onClick:h}],className:a(`h-10 gap-1.5 border-border/50 bg-card/80 px-2 shrink-0 select-none`,s&&`h-[calc(env(safe-area-inset-top,0px)+2.5rem)] pt-[env(safe-area-inset-top,0px)]`),scrollClassName:a(`doc-browser-tab-scrollbar flex h-full items-center gap-0.5`,!o&&!s&&`cursor-grab active:cursor-grabbing`),tabsClassName:`items-center gap-0.5`,actionsClassName:`h-full items-center gap-0.5`,actionButtonClassName:`rounded-md p-1.5 text-muted-foreground hover:bg-muted/60 hover:text-foreground disabled:opacity-50`,tabBaseClassName:`group inline-flex min-w-0 cursor-pointer items-center gap-0.5 h-7 px-2 rounded-md text-xs max-w-[220px] shrink-0 transition-colors`,activeTabClassName:`bg-muted/80 text-foreground`,inactiveTabClassName:`text-muted-foreground hover:bg-muted/45 hover:text-foreground`,labelClassName:`px-0.5 text-xs font-normal`,onPointerDown:!o&&!s?g:void 0,onScrollPointerDown:e=>{if(Qe(e.target)){e.stopPropagation();return}!o&&!s&&(e.stopPropagation(),g(e))}})}var Q=40,et=360,tt=400;function $(e,t,n){return Math.min(n,Math.max(t,e))}function nt(e,t){return e.split(`-`).includes(t)}function rt(){return{x:Math.max(Q,window.innerWidth-520),y:80,w:480,h:600}}function it(e,t,n){return{...e,x:$(e.x+t,Q,window.innerWidth-Q-e.w),y:$(e.y+n,Q,window.innerHeight-Q-e.h)}}function at(e,t,n,r){let i=t.x+t.w,a=t.y+t.h,o=nt(e,`left`)?$(t.x+n,Q,i-et):t.x,s=nt(e,`right`)?$(i+n,o+et,window.innerWidth-Q):i,c=nt(e,`top`)?$(t.y+r,Q,a-tt):t.y,l=nt(e,`bottom`)?$(a+r,c+tt,window.innerHeight-Q):a;return{x:o,y:c,w:s-o,h:l-c}}function ot({children:e,className:t,style:n,defaultWidth:r=420,minWidth:i=320,maxWidth:o=860,onWidthCommit:s,overlay:c=!1,overlayScope:l=`viewport`,width:u,...d}){let f=(0,I.useRef)(null),p=(0,I.useRef)(u??r),[m,h]=(0,I.useState)(!1),[g,_]=(0,I.useState)(null),[v,y]=(0,I.useState)(r),b=g??u??v,x=c?l===`container`?`absolute inset-0 z-30`:`fixed inset-0 z-40`:`border-l border-border`,S=e=>{if(c)return;e.preventDefault(),e.stopPropagation(),e.currentTarget.setPointerCapture?.(e.pointerId),h(!0),p.current=b,f.current={startX:e.clientX,startWidth:b};let t=e=>{let t=f.current;if(!t)return;let n=t.startWidth+t.startX-e.clientX,r=Math.max(i,Math.min(o,n));p.current=r,_(r)},n=()=>{u===void 0&&y(p.current),s?.(p.current),_(null),h(!1),f.current=null,window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,n)};window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,n)};return(0,L.jsxs)(`aside`,{...d,className:a(`relative flex h-full min-h-0 shrink-0 overflow-hidden bg-card text-card-foreground`,x,t),style:c?n:{...n,width:b},children:[c?null:(0,L.jsx)(`div`,{className:`absolute left-0 top-0 z-20 h-full w-3 cursor-ew-resize transition-colors hover:bg-primary/10`,"data-testid":`resizable-right-panel-handle`,onPointerDown:S}),(0,L.jsx)(`div`,{className:`flex h-full min-h-0 w-full flex-col overflow-hidden`,children:e}),m?(0,L.jsx)(`div`,{className:`absolute inset-0 z-10 cursor-ew-resize`,"data-testid":`resizable-right-panel-resize-shield`}):null]})}var st=`allow-same-origin allow-scripts allow-popups allow-forms`;function ct(e,t){if(e.startsWith(`/`))try{return new URL(e,t).toString()}catch{return e}return/^[a-z][a-z\d+.-]*:\/\//i.test(e)||e===`about:blank`?e:/^(localhost|127\.|0\.0\.0\.0|\[::1\])(?::|\/|$)/i.test(e)?`http://${e}`:`https://${e}`}function lt(e,t){if(!t)return st;let n=e?.getIframeSandbox?.(t);return n===void 0?t.kind===`content`?void 0:st:n}function ut(e,t,n){return(0,I.useCallback)(()=>{if(n?.canDock){if(n.isDocked){n.removable&&e?.unpinTab(t);return}e?.pinTab(t)}},[t,e,n])}function dt({activeTabId:e,currentUrl:t,isAddressToolbarTab:n,isContentTab:r,isDocsTab:i,navigate:a}){let o=`${e}:${t}:${r?`content`:`docs`}`,[s,c]=(0,I.useState)(null),l=(()=>{if(!n)return``;if(r)return t;try{return new URL(t).pathname}catch{return t}})(),u=s?.key===o?s.value:l,d=(0,I.useCallback)(e=>c({key:o,value:e}),[o]);return{handleUrlSubmit:(0,I.useCallback)(e=>{if(e.preventDefault(),!n)return;let r=u.trim();r&&(i&&r.startsWith(`/`)?a(j(r)):i&&r.startsWith(`http`)?a(r):a(i?j(`/${r}`):ct(r,t)))},[t,n,i,a,u]),setUrlInput:d,urlInput:u}}function ft({customTabRenderers:e={},displayMode:t=`desktop`,dockControls:n}){let{isOpen:r,mode:o,dockedWidth:s,tabs:c,activeTabId:l,activeHistory:u,activeHistoryIndex:d,currentTab:f,open:p,openTarget:m,openNewTab:h,close:g,toggleMode:_,setDockedWidth:v,goBack:y,goForward:b,navigate:x,syncUrl:S,setActiveTab:C,closeTab:w}=ie(),[T,ee]=(0,I.useState)(0),[E,te]=(0,I.useState)(rt),[D,O]=(0,I.useState)(null),k=(0,I.useRef)(null),A=f?.currentUrl??ae(),j=f?.navVersion??0,M=`${l}:${j}:${T}`,N=(0,I.useRef)(null),P=(0,I.useRef)(j),F=f?.kind===`docs`,se=f?.kind===re,ce=d>0,le=d<u.length-1,R=f?e[f.kind]:void 0,ue=n?.getDockState(f),z=f?.kind===`content`,B=F||z,{handleUrlSubmit:de,setUrlInput:V,urlInput:fe}=dt({activeTabId:l,currentUrl:A,isAddressToolbarTab:B,isContentTab:z,isDocsTab:F,navigate:x});(0,I.useEffect)(()=>{if(!F){N.current=null;return}if(j!==P.current){P.current=j,N.current=ne(A);return}if(k.current?.contentWindow)try{let e=new URL(A).pathname;N.current=ne(A),k.current.contentWindow.postMessage({type:`docs-navigate`,path:e},`*`)}catch{}},[A,j,F]),(0,I.useEffect)(()=>{let e=e=>{if(F&&e.data?.type===`docs-route-change`&&typeof e.data.url==`string`){let t=ne(e.data.url);if(N.current&&t!==N.current)return;N.current=null,S(e.data.url)}};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[A,S,F]),(0,I.useEffect)(()=>{if(!f||!R?.onIframeMessage)return;let e=e=>{R.onIframeMessage?.({event:e,iframe:k.current,iframeInstanceId:M,tab:f})};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[f,R,M]);let H=(0,I.useCallback)(e=>{e.preventDefault(),O({kind:`drag`,startX:e.clientX,startY:e.clientY,startRect:E})},[E]),U=(0,I.useCallback)(e=>t=>{t.preventDefault(),t.stopPropagation(),O({kind:`resize`,edge:e,startX:t.clientX,startY:t.clientY,startRect:E})},[E]);(0,I.useEffect)(()=>{if(!D)return;let e=e=>{let{startRect:t,startX:n,startY:r}=D,i=e.clientX-n,a=e.clientY-r;if(D.kind===`drag`){te(it(t,i,a));return}te(at(D.edge,t,i,a))},t=()=>O(null);return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[D]);let W=(0,I.useCallback)(()=>{ee(e=>e+1)},[]),pe=ut(n,f,ue);if(!r)return null;let G=o===`docked`,K=t===`fullscreen`,q=f?{currentUrl:A,open:p,openTarget:m,refreshIframe:W,tab:f}:void 0,me=q?R?.renderToolbar?.(q):null,J=q?R?.renderContent?.(q)??(se?(0,L.jsx)(qe,{}):null):null,he=lt(R,f),ge=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)($e,{tabs:c,activeTabId:l,canGoBack:ce,canGoForward:le,dockState:ue,isDocked:G,isFullscreen:K,onGoBack:y,onGoForward:b,onOpenNewTab:h,onToggleDock:pe,onSetActiveTab:C,onCloseTab:w,onClose:g,onDragStart:H,onToggleMode:_}),(0,L.jsx)(Je,{isVisible:B,onRefresh:W,onSubmit:de,onUrlInputChange:V,placeholder:i(F?`docBrowserSearchPlaceholder`:`docBrowserAddressPlaceholder`),urlInput:fe}),me,(0,L.jsx)(Ye,{currentTab:f,currentUrl:A,customContent:J,iframeRef:k,iframeInstanceId:M,iframeSandbox:he,isDragging:D?.kind===`drag`,isResizing:D?.kind===`resize`,onIframePointerOver:R?.onIframePointerOver}),(0,L.jsx)(Ze,{currentUrl:A,isVisible:F||z})]});return G&&!K?(0,L.jsx)(ot,{"data-testid":`doc-browser-panel`,defaultWidth:s,width:s,minWidth:320,maxWidth:860,onWidthCommit:v,children:ge}):(0,L.jsxs)(`div`,{"data-testid":`doc-browser-panel`,className:a(`relative flex flex-col overflow-hidden bg-card text-card-foreground`,K?`fixed inset-0 z-[var(--z-floating-panel)] h-[100dvh] w-screen rounded-none border-0 shadow-2xl`:`rounded-2xl border border-border shadow-2xl`),style:K?void 0:{position:`fixed`,left:E.x,top:E.y,width:E.w,height:E.h,zIndex:`var(--z-floating-panel)`},children:[ge,!G&&!K&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`absolute top-0 left-0 h-3 w-full cursor-ns-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-top`,onPointerDown:U(`top`)}),(0,L.jsx)(`div`,{className:`absolute top-0 left-0 w-3 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-left`,onPointerDown:U(`left`)}),(0,L.jsx)(`div`,{className:`absolute top-0 right-0 w-3 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-right`,onPointerDown:U(`right`)}),(0,L.jsx)(`div`,{className:`absolute bottom-0 left-0 h-3 w-full cursor-ns-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-bottom`,onPointerDown:U(`bottom`)}),(0,L.jsx)(`div`,{className:`absolute top-0 left-0 z-30 h-4 w-4 cursor-nw-resize hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-top-left`,onPointerDown:U(`top-left`)}),(0,L.jsx)(`div`,{className:`absolute top-0 right-0 z-30 h-4 w-4 cursor-ne-resize hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-top-right`,onPointerDown:U(`top-right`)}),(0,L.jsx)(`div`,{className:`absolute bottom-0 left-0 z-30 h-4 w-4 cursor-sw-resize hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-bottom-left`,onPointerDown:U(`bottom-left`)}),(0,L.jsx)(`div`,{className:`absolute bottom-0 right-0 z-30 flex h-4 w-4 cursor-se-resize items-center justify-center text-muted-foreground/45 transition-colors hover:text-muted-foreground`,"data-testid":`doc-browser-resize-bottom-right`,onPointerDown:U(`bottom-right`),children:(0,L.jsx)(oe,{className:`w-3 h-3 rotate-[-45deg]`})})]})]})}export{N as _,Re as a,ze as c,Me as d,Ne as f,P as g,F as h,Z as i,Ie as l,le as m,ot as n,X as o,Pe as p,Ke as r,Le as s,ft as t,Fe as u,M as v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./chunk-DseTPa7n.js";import{
|
|
1
|
+
import{i as e}from"./chunk-DseTPa7n.js";import{D as t,a as n,d as r,k as i,r as a,t as o}from"./react-39CDNZlM.js";import{n as s,t as c}from"./middleware-Df-a4x-q.js";var l=`docs.nextclaw.io`,u=`docs.nextclaw.net`,d=`nextclaw-docs.pages.dev`,f=new Set([l,`www.${l}`,u,`www.${u}`,d,`www.${d}`]),p=`https://${l}`,ee=`https://${u}`,m=`home`,h=`nextclaw://new-tab`,g=`/guide/getting-started`;function _(e){return e===`zh`?`zh`:`en`}function v(e,t){let n=e.startsWith(`/`)?e:`/${e}`;return n===`/`||n===``?`/${t}/`:/^\/(en|zh)(\/|$)/.test(n)?n:`/${t}${n}`}function y(e){let t=e?.trim();if(t)try{return new URL(t).origin}catch{return}}function b(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??``}catch{return``}}function x(e){return/^[a-z][a-z\d+.-]*:/i.test(e.trim())}function S(){return n()===`zh`||b()===`Asia/Shanghai`}function C(){return y(void 0)||(S()?y(void 0)??ee:p)}function w(e){let t=_(n()),r=C();try{let n=new URL(e,r),i=new URL(r);return!x(e)||f.has(n.hostname)||n.origin===i.origin?(n.protocol=i.protocol,n.host=i.host,n.pathname=v(n.pathname,t),n.toString()):n.toString()}catch{return new URL(`/${t}${g}`,r).toString()}}function T(){return w(g)}function E(e){return w(e)}function D(e){try{return new URL(e).pathname.replace(/\.html$/,``).replace(/\/$/,``)}catch{return e}}function O(e,t,n=`Docs`){try{let r=new URL(e,p);if(r.protocol===`data:`)return t===`docs`?n:`Detail`;let i=r.pathname.split(`/`).filter(Boolean),a=i[i.length-1]??n;return decodeURIComponent(a).replace(/[-_]/g,` `).slice(0,40)||n}catch{return n}}function k(e){try{let t=typeof window<`u`?window.location.origin:p,n=new URL(e,t);return f.has(n.hostname)}catch{return!1}}function te(e,t){return t===`docs`?w(e):e}var A=0;function j(e){return typeof e==`number`&&Number.isFinite(e)?Math.min(860,Math.max(320,e)):420}function M(){return A+=1,`doc-tab-${Date.now()}-${A}`}function N(e,t,n,r,i,o,s){let c=n?.trim()||O(e,t,t===`docs`?a(`docBrowserHelp`):`Detail`),l=i?.trim();return{id:M(),kind:t,title:c,currentUrl:e,resourceUri:l||void 0,contentParams:s,dockIcon:o,dedupeKey:r,history:[e],historyIndex:0,navVersion:0}}function P(e,t){let n=[...e.history.slice(0,e.historyIndex+1),t];return{history:n,historyIndex:n.length-1}}function F(e,t,n,i,a){let o={...t,title:i?.title||n.title||t.title,kind:n.kind,resourceUri:n.resourceUri??n.url,dockIcon:i?.dockIcon??n.dockIcon,dedupeKey:a,contentParams:n.contentParams},s=e.areUrlsEquivalent(t.currentUrl,n.url,t.kind,n.kind);return s&&r(t.contentParams)===r(n.contentParams)?o:s?{...o,navVersion:t.navVersion+1}:{...o,currentUrl:n.url,...P(t,n.url),navVersion:t.navVersion+1}}function I(e){return{kind:e.kind,resourceUri:e.resourceUri,tabId:e.id,url:e.currentUrl}}function L(){let e=N(h,m,a(`docBrowserHomeTitle`));return{isOpen:!1,mode:`docked`,dockedWidth:420,tabs:[e],activeTabId:e.id,activeHistory:[I(e)],activeHistoryIndex:0}}var R=`nextclaw.doc-browser.state`,z=1,B=8;function V(e){return!!e&&typeof e==`object`}function H(e){return e===`floating`||e===`docked`}function U(e,t){if(!Array.isArray(e))return[t];let n=e.filter(e=>typeof e==`string`&&e.trim().length>0);return n.length>0?n:[t]}function W(e,t,n,r){return typeof e==`number`&&Number.isFinite(e)?Math.min(n,Math.max(t,e)):r}function G(e){if(!(!V(e)||typeof e.type!=`string`)){if(e.type===`builtin`&&typeof e.name==`string`&&e.name.trim().length>0)return{type:`builtin`,name:e.name.trim()};if(e.type===`url`&&typeof e.url==`string`&&e.url.trim().length>0)return{type:`url`,url:e.url.trim()};if(e.type===`text`&&typeof e.value==`string`&&e.value.trim().length>0)return{type:`text`,value:e.value.trim()}}}function K(e){if(!V(e)||typeof e.id!=`string`||typeof e.kind!=`string`||typeof e.title!=`string`||typeof e.currentUrl!=`string`||e.currentUrl.trim().length===0)return null;let t=U(e.history,e.currentUrl),n=W(e.historyIndex,0,t.length-1,t.length-1),r=W(e.navVersion,0,2**53-1,0),i=typeof e.dedupeKey==`string`&&e.dedupeKey.trim().length>0?e.dedupeKey:void 0,a=typeof e.resourceUri==`string`&&e.resourceUri.trim().length>0?e.resourceUri.trim():void 0,o=G(e.dockIcon);return{id:e.id,kind:e.kind,title:e.title,currentUrl:t[n]??e.currentUrl,resourceUri:a,dockIcon:o,dedupeKey:i,history:t,historyIndex:n,navVersion:r}}function q(e){return{kind:e.kind,resourceUri:e.resourceUri,tabId:e.id,url:e.currentUrl}}function J(e,t){if(!V(e)||typeof e.tabId!=`string`||typeof e.kind!=`string`||typeof e.url!=`string`||e.url.trim().length===0||!t.has(e.tabId))return null;let n=typeof e.resourceUri==`string`&&e.resourceUri.trim().length>0?e.resourceUri.trim():void 0;return{kind:e.kind,resourceUri:n,tabId:e.tabId,url:e.url}}function Y(e){if(!V(e))return null;let t=Array.isArray(e.tabs)?e.tabs.map(K).filter(e=>e!==null).slice(-B):[];if(t.length===0)return null;let n=typeof e.activeTabId==`string`?e.activeTabId:null,r=t.some(e=>e.id===n)?n??t[0].id:t[0].id,i=new Map(t.map(e=>[e.id,e])),a=Array.isArray(e.activeHistory)?e.activeHistory.map(e=>J(e,i)).filter(e=>e!==null):[],o=[q(i.get(r)??t[0])],s=a.length>0?a:o,c=W(e.activeHistoryIndex,0,s.length-1,s.length-1),l=s[c],u=i.has(l.tabId)?l.tabId:r;return{isOpen:e.isOpen===!0,mode:H(e.mode)?e.mode:`docked`,dockedWidth:j(e.dockedWidth),tabs:t,activeTabId:u,activeHistory:s,activeHistoryIndex:c}}function X(e,t){return typeof t==`function`?t(e):t}var Z=o()(s(e=>({snapshot:L(),setSnapshot:t=>e(e=>({snapshot:X(e.snapshot,t)}))}),{name:R,version:z,storage:c(()=>window.localStorage),partialize:e=>({snapshot:{isOpen:e.snapshot.isOpen,mode:e.snapshot.mode,dockedWidth:e.snapshot.dockedWidth,tabs:e.snapshot.tabs.slice(-B),activeTabId:e.snapshot.activeTabId,activeHistory:e.snapshot.activeHistory,activeHistoryIndex:e.snapshot.activeHistoryIndex}}),merge:(e,t)=>{let n=Y(V(e)?e.snapshot:null);return n?{...t,snapshot:n}:t}})),Q=e(i(),1),ne=t(),$=(0,Q.createContext)(null);function re(){let e=(0,Q.useContext)($);if(!e)throw Error(`useDocBrowser must be used within DocBrowserProvider`);return e}function ie({children:e,manager:t}){let n=Z(e=>e.snapshot),r=(0,Q.useMemo)(()=>n.tabs.find(e=>e.id===n.activeTabId)??n.tabs[0],[n.activeTabId,n.tabs]),i=(0,Q.useMemo)(()=>({...n,currentTab:r,open:t.open,openTarget:t.openTarget,openNewTab:t.openNewTab,close:t.close,toggleMode:t.toggleMode,setDockedWidth:t.setDockedWidth,navigate:t.navigate,syncUrl:t.syncUrl,goBack:t.goBack,goForward:t.goForward,closeTab:t.closeTab,setActiveTab:t.setActiveTab}),[r,t,n]);return(0,ne.jsx)($.Provider,{value:i,children:e})}export{D as _,L as a,j as c,m as d,h as f,k as g,O as h,P as i,F as l,E as m,re as n,I as o,T as p,Z as r,N as s,ie as t,p as u,te as v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"./dist-
|
|
1
|
+
import{c as e}from"./dist-rYHnBo8t.js";var t=e(`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`}]]),n=e(`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`}]]);export{t as n,n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{D as e,w as t}from"./react-39CDNZlM.js";var n=e();function r({align:e=`end`,className:r,...i}){return(0,n.jsx)(`div`,{className:t(`flex flex-wrap items-center gap-2`,e===`start`&&`justify-start`,e===`end`&&`justify-end`,e===`between`&&`justify-between`,r),...i})}export{r as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/model-config-page-
|
|
2
|
-
import{i as e,t}from"./chunk-DseTPa7n.js";import{C as n,D as r,E as i,O as a,r as o,x as s}from"./react-CeMr9V52.js";import{t as c}from"./preload-helper-D4M6sveU.js";import{B as l,D as u,E as d,V as f,_ as p,_t as m,a as h,at as g,b as _,dt as v,f as y,ft as b,gt as x,ht as S,i as C,m as w,mt as T,ot as E,p as D,pt as O,r as k,st as A,t as ee,u as te,ut as ne,y as re}from"./app-presenter-provider-DXTYtH78.js";import{$t as j,At as M,B as ie,Ft as ae,I as oe,It as N,L as P,Qt as se,R as ce,St as le,V as ue,Wt as de,Xt as fe,Yt as pe,Zt as F,_n as me,an as he,cn as ge,gn as _e,hn as ve,in as ye,ln as be,m as xe,mn as Se,nn as Ce,on as we,rn as Te,sn as Ee,tn as De,un as Oe,vn as ke,vt as I,xt as Ae,yn as je,z as Me}from"./api-O5yEgzBt.js";import{a as L,c as Ne,d as Pe,f as Fe,i as Ie,l as Le,n as Re,o as R,r as ze,s as z,u as B}from"./mcp-marketplace-page-Dg03SZX1.js";import{c as V}from"./dist-CZx9Q6jc.js";import{n as Be}from"./search-BmSWsiG2.js";import{a as H,c as U,o as W,s as Ve}from"./doc-browser-B4l0Xu7u.js";import{i as He,n as Ue,o as We,r as G,t as Ge}from"./use-confirm-dialog-CcySmkWp.js";import{o as Ke}from"./card-GkBc-UMw.js";import{t as qe}from"./navigation-link-Ct6xtnVM.js";import{i as Je,r as Ye,t as Xe}from"./tabs-Cah5klko.js";import{t as Ze}from"./use-viewport-layout-DU29bUJS.js";import{t as Qe}from"./refresh-cw-BZ8giusN.js";import{t as $e}from"./trash-2-BLQOULWD.js";import{n as et,t as tt}from"./doc-browser-context-Dy7EhLI8.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var nt=t((e=>{var t=r();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}));function rt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function it(e,t,n){let r=e.slice(0);return r[t]=n,r}var at=class extends je{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,ve.batch(()=>{let e=this.#i,t=this.#f(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!ke(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(rt(e,n).forEach(e=>{e.destroy()}),rt(n,e).forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})),this.#m()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#f(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=me(this.#a,t(e))),this.#a}return e}#f(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new Se(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=it(this.#t,n,t),this.#m())}#m(){if(this.hasListeners()){let e=this.#a,t=this.#u(this.#t,this.#l);e!==this.#d(t,this.#r?.combine)&&ve.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},K=e(a(),1);function ot({queries:e,...t},n){let r=Oe(n),i=ge(),a=Ee(),o=K.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{De(e),ye(e,a,r.getQueryCache().get(e.queryHash))}),we(a);let[s]=K.useState(()=>new at(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;K.useSyncExternalStore(K.useCallback(e=>d?s.subscribe(ve.batchCalls(e)):_e,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),K.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>Te(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&Te(n,e)?Ce(n,new Se(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&he({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}var st=V(`BriefcaseBusiness`,[[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2`,key:`1ksdt3`}],[`path`,{d:`M22 13a18.15 18.15 0 0 1-20 0`,key:`12hx5q`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]),ct=V(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),lt=V(`Compass`,[[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),ut=V(`MessagesSquare`,[[`path`,{d:`M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z`,key:`p1xzt8`}],[`path`,{d:`M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1`,key:`1cx29u`}]]),dt=V(`PenLine`,[[`path`,{d:`M12 20h9`,key:`t2du7b`}],[`path`,{d:`M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z`,key:`1ykcvy`}]]),ft=V(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),pt=nt();function q(e){return Array.from(new Set(e.map(e=>e.spec).filter(Boolean)))}function mt(e){let{request:t,result:n}=e,r=new Date().toISOString();return n.type===`skill`?{type:`skill`,spec:n.spec,id:t.skill??n.spec,label:t.skill??n.name??n.spec,source:`workspace`,installPath:t.installPath,installedAt:r}:{type:n.type,spec:n.spec,id:n.name??n.spec,label:n.name??n.spec,source:`marketplace`,origin:`marketplace`,enabled:t.enabled??!0,runtimeStatus:t.enabled===!1?`disabled`:`ready`,installedAt:r}}function J(e,t){let{id:n,spec:r}=t;return!!(r&&e.spec===r||n&&e.id===n)}function ht(e,t){return t??{type:e,total:0,specs:[],records:[]}}function gt(e){let{result:t,view:n}=e,r=ht(t.type,n),i=mt(e),a=r.records.findIndex(e=>J(e,{id:i.id,spec:i.spec})),o=[...r.records];return a>=0?o[a]={...o[a],...i}:o.unshift(i),{...r,type:t.type,records:o,specs:q(o),total:o.length}}function _t(e){let{request:t,result:n,view:r}=e,i=ht(n.type,r);if(n.action===`uninstall`||n.action===`remove`){let e=i.records.filter(e=>!J(e,{id:n.id,spec:t.spec}));return{...i,records:e,specs:q(e),total:e.length}}let a=i.records.map(e=>J(e,{id:n.id,spec:t.spec})?n.action===`disable`?{...e,enabled:!1,runtimeStatus:`disabled`}:n.action===`update`?{...e,installedAt:new Date().toISOString(),origin:e.origin??`marketplace`}:{...e,enabled:!0,runtimeStatus:`ready`}:e);return{...i,records:a,specs:q(a),total:a.length}}var vt=3e4;function yt(e){let t=Fe({queryKey:[`marketplace-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>P({...e,page:t}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0,placeholderData:(t,n)=>{let r=n?.queryKey?.[1];if(!(!r||typeof r!=`object`||!r))return(`type`in r?r.type:void 0)===e.type&&xt(r,e)?t:void 0},staleTime:15e3,refetchInterval:e.q?!1:vt,refetchOnMount:`always`,refetchOnReconnect:`always`,refetchOnWindowFocus:`always`}),n=(0,K.useMemo)(()=>Pe(t.data),[t.data]);return{...t,data:n}}function bt(e,t=!0){return j({queryKey:[`marketplace-recent-items`,e],queryFn:()=>P({type:e,sort:`updated`,page:1,pageSize:6}),enabled:t,staleTime:15e3,refetchInterval:vt,refetchOnMount:`always`,refetchOnReconnect:`always`,refetchOnWindowFocus:`always`})}function xt(e,t){return e.tag===t.tag&&e.scene===t.scene&&e.pageSize===t.pageSize}function St(e=!0){return j({queryKey:[`marketplace-skill-scenes`],queryFn:Me,enabled:e,staleTime:6e4})}function Ct(e,t=!0){let n=ot({queries:e.map(e=>({queryKey:[`marketplace-skill-scene-count`,e.scene],queryFn:()=>P({type:`skill`,scene:e.scene,pageSize:1}),enabled:t&&typeof e.count!=`number`,staleTime:6e4}))});return(0,K.useMemo)(()=>{let t=new Map;return e.forEach((e,r)=>{let i=typeof e.count==`number`?e.count:n[r]?.data?.total;typeof i==`number`&&t.set(e.scene,i)}),t},[n,e])}function wt(e){return j({queryKey:[`marketplace-installed`,e],queryFn:()=>oe(e),staleTime:1e4})}function Tt(){let e=Oe();return se({mutationFn:e=>ie(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>gt({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`}),F.success(t.message||o(`marketplaceInstallSuccessSkill`))},onError:e=>{F.error(e.message||o(`marketplaceInstallFailed`))}})}function Et(){let e=Oe();return se({mutationFn:e=>ue(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>_t({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`});let r=t.action===`enable`?o(`marketplaceEnableSuccess`):t.action===`disable`?o(`marketplaceDisableSuccess`):t.action===`update`?o(`marketplaceUpdateSuccess`):o(`marketplaceUninstallSuccess`);F.success(t.message||r)},onError:e=>{F.error(e.message||o(`marketplaceOperationFailed`))}})}var Y=i(),Dt=[`bg-amber-600`,`bg-orange-500`,`bg-yellow-600`,`bg-emerald-600`,`bg-teal-600`,`bg-cyan-600`,`bg-stone-600`,`bg-rose-500`,`bg-violet-500`];function Ot(e){let{name:t,fallback:r,className:i}=e,a=t||r,o=a.substring(0,2).toUpperCase();return(0,Y.jsx)(`div`,{className:n(`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-sm font-semibold text-white`,kt(a),i),children:o})}function kt(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return Dt[Math.abs(t)%Dt.length]}function At({title:e,spec:t}){return(0,Y.jsxs)(Ve,{delayDuration:400,children:[(0,Y.jsxs)(H,{children:[(0,Y.jsx)(U,{asChild:!0,children:(0,Y.jsx)(`div`,{className:`truncate text-[14px] font-semibold leading-tight text-gray-950`,children:e})}),(0,Y.jsx)(W,{className:`max-w-[300px] text-xs`,children:e})]}),(0,Y.jsx)(`div`,{className:`mb-2 mt-1 flex min-w-0 items-center gap-1.5`,children:t?(0,Y.jsxs)(H,{children:[(0,Y.jsx)(U,{asChild:!0,children:(0,Y.jsx)(`span`,{className:`max-w-full truncate text-[11px] font-mono leading-tight text-gray-400`,children:t})}),(0,Y.jsx)(W,{className:`max-w-[300px] break-all font-mono text-xs`,children:t})]}):null})]})}function jt(e){let{item:t,record:r,state:i,onInstall:a,onManage:s}=e,{isInstalling:c,canUpdate:l,canUninstall:u,busyAction:d}=i,f=!!d;return t&&!r||r&&(l||u)?(0,Y.jsxs)(`div`,{className:n(`flex shrink-0 items-center justify-end gap-1.5 opacity-100 transition-opacity duration-150`,`md:pointer-events-none md:opacity-0`,`md:group-hover:pointer-events-auto md:group-hover:opacity-100`,`md:group-focus-within:pointer-events-auto md:group-focus-within:opacity-100`),children:[t&&!r&&(0,Y.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),a(t)},disabled:c,className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md bg-primary px-2 text-[11px] font-medium text-white transition-colors hover:bg-primary-600 disabled:opacity-50`,children:[(0,Y.jsx)(Ke,{className:`h-3 w-3`}),o(c?`marketplaceInstalling`:`marketplaceInstall`)]}),r&&l&&(0,Y.jsxs)(`button`,{disabled:f,onClick:e=>{e.stopPropagation(),s(`update`,r)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-blue-200/80 bg-white px-2 text-[11px] font-medium text-blue-600 transition-colors hover:border-blue-300 hover:bg-blue-50 disabled:opacity-50`,children:[(0,Y.jsx)(Qe,{className:`h-3 w-3`}),o(d===`update`?`marketplaceUpdating`:`marketplaceUpdate`)]}),r&&u&&(0,Y.jsxs)(`button`,{disabled:f,onClick:e=>{e.stopPropagation(),s(`uninstall`,r)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-gray-200/80 bg-white px-2 text-[11px] font-medium text-gray-500 transition-colors hover:border-rose-200 hover:bg-rose-50 hover:text-rose-600 disabled:opacity-50`,children:[(0,Y.jsx)($e,{className:`h-3 w-3`}),o(d===`uninstall`?`marketplaceRemoving`:`marketplaceUninstall`)]})]}):null}function Mt(e){let{record:t,disabled:n}=e;return t?(0,Y.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-end`,children:(0,Y.jsx)(Nt,{disabled:n})}):null}function Nt(e){let{disabled:t}=e,r=o(t?`marketplaceDisabledStatus`:`marketplaceInstalledStatus`);return(0,Y.jsx)(Ve,{delayDuration:300,children:(0,Y.jsxs)(H,{children:[(0,Y.jsx)(U,{asChild:!0,children:(0,Y.jsx)(`span`,{"aria-label":r,className:n(`inline-flex h-5 w-5 items-center justify-center`,t?`text-gray-400`:`text-emerald-700`),children:t?(0,Y.jsx)(A,{className:`h-4 w-4 opacity-40`}):(0,Y.jsx)(A,{className:`h-4 w-4`})})}),(0,Y.jsx)(W,{className:`text-xs`,children:r})]})})}function Pt(e){let{item:t,record:n,installState:r,manageState:i,onOpen:a,onInstall:s,onManage:c}=e,{language:l}=G(),u=R(l),d=t?.name??n?.label??n?.id??n?.spec??o(`marketplaceUnknownItem`),f=z(t?.summaryI18n,t?.summary,u)||(n?o(`marketplaceInstalledLocalSummary`):``),p=t?.install.spec??n?.spec??``,m=t?.tags??[],h=n?.id||n?.spec,g=h?i.actionsByTarget.get(h):void 0,_=n?.type===`skill`&&n.source===`workspace`,v=n?.type===`skill`&&n.origin===`marketplace`,y=n?n.enabled===!1||n.runtimeStatus===`disabled`:!1,b=t?.install.spec,x=typeof b==`string`&&r.installingSpecs.has(b);return(0,Y.jsxs)(`article`,{onClick:a,className:`group flex h-full min-h-[156px] cursor-pointer flex-col rounded-xl border border-gray-200/60 bg-white p-3.5 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,Y.jsx)(Ot,{name:d,fallback:p||o(`marketplaceTypeSkill`),className:`h-9 w-9 rounded-lg text-xs`}),(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,Y.jsx)(At,{title:d,spec:p})}),(0,Y.jsx)(Mt,{record:n,disabled:y})]}),(0,Y.jsxs)(`div`,{className:`mt-2 flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`p`,{className:`line-clamp-2 text-left text-[12px] leading-relaxed text-gray-500`,children:f}),(0,Y.jsxs)(`div`,{className:`mt-auto flex min-w-0 items-end justify-between gap-2 pt-2`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsx)(Ft,{tags:m})}),(0,Y.jsx)(jt,{item:t,record:n,state:{isInstalling:x,canUpdate:v,canUninstall:_,busyAction:g},onInstall:s,onManage:c})]})]})]})}function Ft({tags:e}){let t=e.filter(It).slice(0,3);return t.length===0?null:(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-1.5 overflow-hidden`,children:t.map(e=>(0,Y.jsx)(`span`,{className:`max-w-[104px] truncate rounded-md bg-gray-100 px-2 py-0.5 text-[11px] font-medium leading-5 text-gray-500`,children:e},e))})}function It(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function Lt({model:e,showTitle:t,operationState:r,scroll:i,actions:a}){let{scope:o,entries:s,header:c,status:l,emptyLabel:u,errorLabel:d}=e,{showSkeleton:f,isRefreshing:p,error:m}=l,{hasMore:h,loadingMore:g,sentinelRef:_}=i,{installState:v,manageState:y}=r,{onOpen:b,onInstall:x,onManage:S}=a;return(0,Y.jsxs)(`section`,{className:n(`flex min-h-full flex-col`,t&&`gap-3`),children:[t&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-950`,children:c.title}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] text-gray-500`,children:[p&&(0,Y.jsx)(`span`,{className:`font-medium text-primary`,children:c.refreshingLabel}),(0,Y.jsx)(`span`,{children:c.summary})]})]}),m&&(0,Y.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[d,`: `,m.message]}),p&&(0,Y.jsx)(`div`,{"data-testid":`marketplace-list-refreshing`,className:`h-0.5 overflow-hidden rounded-full bg-primary/10`,children:(0,Y.jsx)(`div`,{className:`h-full w-1/3 animate-pulse rounded-full bg-primary`})}),(0,Y.jsxs)(`div`,{"data-testid":f?`marketplace-list-skeleton`:void 0,className:n(`grid grid-cols-1 gap-2.5 md:grid-cols-2 xl:grid-cols-3`,f&&`min-h-0 flex-1 auto-rows-[156px] content-start`),children:[f&&(0,Y.jsx)(B,{count:36}),!f&&!m&&s.map(e=>(0,Y.jsx)(Pt,{item:e.item,record:e.record,installState:v,manageState:y,onOpen:()=>b(e.item,e.record),onInstall:x,onManage:S},e.key))]}),!f&&!m&&s.length===0&&(0,Y.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:u}),o===`all`&&!f&&!m&&(0,Y.jsx)(Le,{hasMore:h,loading:g,sentinelRef:_})]})}function Rt(e){let{entry:t,language:r,localeFallbacks:i,installState:a,layout:s=`rail`,onOpen:c,onInstall:l}=e,{item:u,record:d}=t,f=z(u.summaryI18n,u.summary,i),p=u.install.spec,m=a.installingSpecs.has(p),h=!!d;return(0,Y.jsxs)(`article`,{onClick:()=>c(t),className:n(`group flex min-h-[166px] cursor-pointer flex-col justify-between rounded-xl border border-gray-200/70 bg-white p-3 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,s===`rail`?`w-[260px] shrink-0`:`w-full min-w-0`),children:[(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-start gap-2.5`,children:[(0,Y.jsx)(Ot,{name:u.name,fallback:u.install.spec}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,Y.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-gray-950`,children:u.name}),(0,Y.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] font-mono leading-tight text-gray-400`,children:zt(u)})]})]}),(0,Y.jsx)(`p`,{className:`line-clamp-2 text-[12px] leading-relaxed text-gray-500`,children:f}),(0,Y.jsx)(Bt,{tags:u.tags})]}),(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-gray-100 pt-2.5`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-gray-400`,children:Ht(u.updatedAt)}),h?(0,Y.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 text-[11px] font-semibold text-emerald-700`,children:[(0,Y.jsx)(A,{className:`h-3.5 w-3.5`}),Ut({zh:`已安装`,en:`Installed`},r)]}):(0,Y.jsxs)(`button`,{type:`button`,disabled:m,onClick:e=>{e.stopPropagation(),l(u)},className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-gray-200 bg-white px-2 text-[11px] font-semibold text-gray-700 transition-colors hover:border-gray-300 hover:bg-gray-50 disabled:opacity-50`,children:[(0,Y.jsx)(Ke,{className:`h-3.5 w-3.5`}),o(m?`marketplaceInstalling`:`marketplaceInstall`)]})]})]})}function zt(e){return e.slug||e.install.spec}function Bt({tags:e}){let t=e.filter(Vt).slice(0,2);return t.length===0?null:(0,Y.jsx)(`div`,{className:`mt-auto truncate pt-2 text-[11px] font-medium text-gray-400`,children:t.join(` / `)})}function Vt(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function Ht(e){return e.slice(0,10)||e}function Ut(e,t){return t.startsWith(`zh`)?e.zh:e.en}var Wt=[{scene:`development-debugging`,title:{zh:`开发与调试`,en:`Development`},summary:{zh:`代码审查、错误定位、架构分析与交付验证。`,en:`Review, debug, analyze, and verify delivery work.`},icon:ft,tone:`dark`,span:`md:col-span-2`},{scene:`office-collaboration`,title:{zh:`办公协作`,en:`Office Work`},summary:{zh:`连接文档、日历、会议、邮件和团队通信。`,en:`Connect docs, calendars, meetings, mail, and teams.`},icon:st,tone:`green`,span:`md:col-span-2`},{scene:`writing-content`,title:{zh:`写作与内容`,en:`Writing`},summary:{zh:`把调研、写作、润色和发布组织成连续工作流。`,en:`Turn research, writing, polishing, and publishing into one flow.`},icon:dt,tone:`amber`,span:`md:col-span-2`},{scene:`browser-automation`,title:{zh:`浏览器自动化`,en:`Browser`},summary:{zh:`操作网页、捕获动态内容并验证真实用户路径。`,en:`Operate pages, capture dynamic content, and verify user paths.`},icon:g,tone:`blue`,span:`md:col-span-2`},{scene:`local-environment`,title:{zh:`本地环境`,en:`Local`},summary:{zh:`管理终端、文件、运行时和本地服务。`,en:`Manage shells, files, runtimes, and local services.`},icon:E,tone:`violet`,span:`md:col-span-1`},{scene:`social-platforms`,title:{zh:`社交平台`,en:`Social`},summary:{zh:`处理发布、互动、检索和内容分发。`,en:`Handle posting, interaction, search, and distribution.`},icon:ut,tone:`sky`,span:`md:col-span-1`},{scene:`nextclaw-official`,title:{zh:`NextClaw 官方`,en:`NextClaw Official`},summary:{zh:`优先查看由 NextClaw 维护的原生能力。`,en:`Browse native capabilities maintained by NextClaw.`},icon:We,tone:`teal`,span:`md:col-span-2`}],Gt={icon:We,tone:`dark`,span:`md:col-span-2`},Kt={dark:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-stone-600 bg-stone-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},blue:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-cyan-600 bg-cyan-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},green:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-emerald-600 bg-emerald-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},amber:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-amber-600 bg-amber-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},violet:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-violet-500 bg-violet-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},sky:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-sky-500 bg-sky-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},teal:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-teal-600 bg-teal-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`}},qt=`grid grid-cols-[repeat(auto-fill,minmax(240px,320px))] justify-start gap-3`;function Jt(e){let{recentEntries:t,scenes:n,isScenesLoading:r,isItemsLoading:i,language:a,installState:o,onOpen:s,onInstall:c,onOpenScene:l}=e,u=R(a);return(0,Y.jsxs)(`div`,{className:`mb-4 space-y-5`,children:[(0,Y.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,Y.jsx)(Qt,{icon:lt,title:X({zh:`场景`,en:`Scenes`},a),description:X({zh:`按使用场景浏览适合的技能组合。`,en:`Browse skills by how you plan to use them.`},a)}),r?(0,Y.jsx)(`div`,{"data-testid":`marketplace-scenes-skeleton`,className:`grid auto-rows-[104px] grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:(0,Y.jsx)(B,{count:Wt.length})}):(0,Y.jsx)(`div`,{className:`grid grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:n.map(e=>(0,Y.jsx)(Yt,{scene:e,language:a,onSelect:l},e.scene))})]}),(i||t.length>0)&&(0,Y.jsx)(Zt,{icon:ct,title:X({zh:`最近更新`,en:`Recently updated`},a),description:X({zh:`看看生态最近在补齐哪些能力。`,en:`See what the ecosystem has been improving lately.`},a),entries:t,language:a,localeFallbacks:u,isLoading:i,installState:o,onOpen:s,onInstall:c})]})}function Yt(e){let{scene:t,language:r,onSelect:i}=e,a=$t(t.scene),o=a.icon,s=Kt[a.tone];return(0,Y.jsx)(`button`,{type:`button`,onClick:()=>i(t.scene),className:n(`group flex min-h-[74px] flex-col justify-center rounded-lg border px-3 py-2.5 text-left shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/70`,s.card),children:(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:n(`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border`,s.icon),children:(0,Y.jsx)(o,{className:`h-3.5 w-3.5`})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-gray-950`,children:en(t,a,r)}),typeof t.count==`number`&&(0,Y.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:nn(t.count,r)})]}),(0,Y.jsx)(`p`,{className:n(`mt-1 line-clamp-1 text-[11px] leading-relaxed`,s.text),children:tn(t,a,r)})]})})}function Xt(e){let{scene:t,entries:r,isLoading:i,language:a,localeFallbacks:o,installState:s,onBack:c,onOpen:l,onInstall:u}=e,d=$t(t.scene),f=d.icon,p=Kt[d.tone];return(0,Y.jsxs)(`section`,{className:`flex min-h-full flex-col`,children:[(0,Y.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-start gap-2.5`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:c,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900`,"aria-label":X({zh:`返回`,en:`Back`},a),children:(0,Y.jsx)(Be,{className:`h-4 w-4`})}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:n(`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border`,p.icon),children:(0,Y.jsx)(f,{className:`h-4 w-4`})}),(0,Y.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[15px] font-semibold text-gray-950`,children:en(t,d,a)}),(0,Y.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:X(i?{zh:`加载中`,en:`Loading`}:{zh:`${r.length} 个技能`,en:`${r.length} skills`},a)})]}),(0,Y.jsx)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-2`,children:(0,Y.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[12px] leading-relaxed text-gray-500`,children:tn(t,d,a)})})]})]}),i?(0,Y.jsx)(`div`,{"data-testid":`marketplace-scene-skeleton`,className:n(qt,`min-h-0 flex-1 auto-rows-[166px] content-start`),children:(0,Y.jsx)(B,{count:24})}):r.length>0?(0,Y.jsx)(`div`,{className:qt,children:r.map(e=>(0,Y.jsx)(Rt,{entry:e,language:a,localeFallbacks:o,installState:s,layout:`grid`,onOpen:l,onInstall:u},e.item.id))}):(0,Y.jsx)(`div`,{className:`rounded-lg border border-dashed border-gray-200 py-8 text-center text-[12px] text-gray-500`,children:X({zh:`这个模块暂无技能。`,en:`No skills in this module yet.`},a)})]})}function Zt(e){let{icon:t,title:n,description:r,entries:i,language:a,localeFallbacks:o,isLoading:s,installState:c,onOpen:l,onInstall:u}=e;return(0,Y.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,Y.jsx)(Qt,{icon:t,title:n,description:r}),s?(0,Y.jsx)(`div`,{"data-testid":`marketplace-recent-skeleton`,className:`-mx-1 grid auto-rows-[166px] grid-cols-[repeat(4,260px)] gap-2.5 overflow-hidden px-1 pb-1.5`,children:(0,Y.jsx)(B,{count:4})}):(0,Y.jsx)(`div`,{className:`-mx-1 flex gap-2.5 overflow-x-auto px-1 pb-1.5 custom-scrollbar`,children:i.map(e=>(0,Y.jsx)(Rt,{entry:e,language:a,localeFallbacks:o,installState:c,onOpen:l,onInstall:u},e.item.id))})]})}function Qt({icon:e,title:t,description:n}){return(0,Y.jsx)(`div`,{className:`flex items-end justify-between gap-4`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`h3`,{className:`flex items-center gap-2 text-[14px] font-semibold text-gray-950`,children:[(0,Y.jsx)(e,{className:`h-4 w-4 text-primary`}),t]}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-[12px] leading-relaxed text-gray-500`,children:n})]})})}function X(e,t){return t.startsWith(`zh`)?e.zh:e.en}function $t(e){return Wt.find(t=>t.scene===e)??{scene:e,...Gt}}function en(e,t,n){return t.title?X(t.title,n):e.title}function tn(e,t,n){return t.summary?X(t.summary,n):e.description??e.scene}function nn(e,t){return t.startsWith(`zh`)?`${e} 个技能`:`${e} skills`}var rn=`https://skillhub.cn/`;function an(){return(0,Y.jsx)(qe,{href:rn,external:!0,className:`h-7 shrink-0 px-1.5 text-[13px]`,children:o(`marketplaceExternalSkillSourceTitle`)})}function on(e){return(e??``).trim().toLowerCase()}function Z(e,t){let n=on(t);return n.length>0?`${e}:${n}`:``}function sn(e){let t=new Map;for(let n of e){let e=[n.install.spec,n.slug,n.id];for(let r of e){let e=Z(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function cn(e){let t=new Map;for(let n of e){let e=[n.spec,n.id,n.label];for(let r of e){let e=Z(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function ln(e,t){let n=[e.install.spec,e.slug,e.id];for(let r of n){let n=Z(e.type,r);if(!n)continue;let i=t.get(n);if(i)return i}}function un(e,t){return t.get(Z(e.type,e.spec))||t.get(Z(e.type,e.id))||t.get(Z(e.type,e.label))}function dn(e,t,n,r){let i=on(n);if(!i)return!0;let a=z(t?.summaryI18n,t?.summary,r);return[e.id,e.spec,e.label,t?.name,t?.slug,t?.summary,a,...t?.tags??[]].map(e=>on(e)).filter(Boolean).some(e=>e.includes(i))}function fn(e){let{items:t,recentItems:n,installedRecordLookup:r,scene:i,forcedType:a,typeFilter:o,scope:s,searchText:c,query:l,showListSkeleton:u,hasCatalogError:d}=e,f=St(o===`skill`),p=(0,K.useMemo)(()=>f.data?.scenes??[],[f.data?.scenes]),m=Ct(p,o===`skill`),h=(0,K.useMemo)(()=>p.map(e=>({...e,count:typeof e.count==`number`?e.count:m.get(e.scene)})),[m,p]),g=(0,K.useMemo)(()=>t.map(e=>({item:e,record:ln(e,r)})),[t,r]),_=(0,K.useMemo)(()=>n.map(e=>({item:e,record:ln(e,r)})),[r,n]),v=(0,K.useMemo)(()=>{let e=i?.trim();if(e)return h.find(t=>t.scene===e)??{scene:e,title:e}},[i,h]),y=o===`skill`&&!!i?.trim(),b=o===`skill`&&s===`all`&&!c.trim()&&!l&&!y,x=u||t.length>=4,S=b&&!d&&x&&h.length===0&&f.isLoading;return{entries:g,recentEntries:_,scenes:h,selectedScene:v,sceneEntries:g,isSceneRoute:y,isScenesLoading:S,showShelves:b&&!d&&x&&(u||h.length>0||S),backPath:a?`/skills`:`/marketplace/skills`,pathPrefix:a?`/skills/scenes`:`/marketplace/skills/scenes`}}function pn(){let e=Tt(),t=Et(),{confirm:n,ConfirmDialog:r}=Ge(),[i,a]=(0,K.useState)(new Set),[s,c]=(0,K.useState)(new Map);return{installState:{installingSpecs:i},manageState:{actionsByTarget:s},handleInstall:async t=>{let n=t.install.spec;if(!i.has(n)){a(e=>new Set(e).add(n));try{await e.mutateAsync({type:t.type,spec:n,kind:t.install.kind,skill:t.slug,installPath:`skills/${t.slug}`})}catch{}finally{a(e=>{let t=new Set(e);return t.delete(n),t})}}},handleManage:async(e,r)=>{let i=e===`update`?r.catalogSlug||r.id||r.spec:r.id||r.spec;if(!(!i||s.has(i))&&!(e===`uninstall`&&!await n({title:`${o(`marketplaceUninstallTitle`)} ${i}?`,description:o(`marketplaceUninstallDescription`),confirmLabel:o(`marketplaceUninstall`),variant:`destructive`}))){c(t=>new Map(t).set(i,e));try{await t.mutateAsync({type:r.type,action:e,id:i,spec:r.spec})}finally{c(e=>{let t=new Map(e);return t.delete(i),t})}}},ConfirmDialog:r}}function mn(e){let t=et(),n=(0,K.useRef)({byKey:new Map,seq:0});return{openItemDetail:async(r,i)=>{let a=r?.name??i?.label??i?.id??i?.spec??o(`marketplaceUnknownItem`),s=Ie(r?`skill`:`skill-local`,r?.slug??i?.id??i?.spec??a),c=r?`marketplace:${r.type}:${r.slug}`:`marketplace:${i?.type??`unknown`}:${i?.id??i?.spec??a}`,l=o(`marketplaceTypeSkill`);if(!r){L(t,{id:s,title:a,typeLabel:l,spec:i?.spec??`-`,status:`ready`,summary:o(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify(i??{},null,2),contentRaw:`-`});return}let u=n.current.seq+1;n.current.seq=u,n.current.byKey.set(c,u);let d=z(r.summaryI18n,r.summary,e);L(t,{id:s,title:a,typeLabel:l,spec:r.install.spec,status:`loading`,summary:d,tags:r.tags,author:r.author});try{let e=await ce(r.slug);if(n.current.byKey.get(c)!==u)return;L(t,{id:s,title:a,typeLabel:l,spec:r.install.spec,status:`ready`,summary:d,metadataRaw:e.metadataRaw,contentRaw:e.bodyRaw||e.raw,sourceUrl:e.sourceUrl,sourceLabel:`Source (${e.source})`,tags:r.tags,author:r.author},{activate:!1})}catch(e){if(n.current.byKey.get(c)!==u)return;L(t,{id:s,title:a,typeLabel:l,spec:r.install.spec,status:`error`,summary:d,metadataRaw:JSON.stringify({error:e instanceof Error?e.message:String(e)},null,2),contentRaw:o(`marketplaceOperationFailed`)},{activate:!1})}}}}function hn(e){let{scope:t,typeFilter:n,query:r,localeFallbacks:i,catalogView:a,installedView:s,isCatalogLoading:c,isCatalogFetching:l,isCatalogFetchingNextPage:u,catalogError:d,isInstalledLoading:f,installedError:p}=e,m=(0,K.useMemo)(()=>s?.records??[],[s?.records]),h=(0,K.useMemo)(()=>a?.items??[],[a?.items]),g=(0,K.useMemo)(()=>sn(h),[h]),_=(0,K.useMemo)(()=>cn(m),[m]),v=(0,K.useMemo)(()=>m.filter(e=>e.type===n).map(e=>({key:`${e.type}:${e.spec}:${e.id??``}`,record:e,item:un(e,g)})).filter(e=>dn(e.record,e.item,r,i)).sort((e,t)=>gn(e.record,t.record)),[m,n,g,r,i]),y=(0,K.useMemo)(()=>t===`installed`?v:h.map(e=>({key:e.id,item:e,record:ln(e,_)})),[h,v,_,t]),b=t===`all`&&c&&!a||t===`installed`&&f&&!s,x=t===`all`&&!b&&!!a&&l&&!u,S=t===`installed`?f&&!s?o(`loading`):`${v.length} ${o(`marketplaceInstalledSkillsCountSuffix`)}`:a?`${a.total} ${o(`marketplaceSkillsCountSuffix`)}`:o(`loading`),C=t===`all`&&d?d:t===`installed`&&p?p:void 0,w={scope:t,entries:y,header:{title:o(t===`installed`?`marketplaceSectionInstalledSkills`:`marketplaceAllSkills`),summary:S,refreshingLabel:o(`marketplaceRefreshingResults`)},status:{showSkeleton:b,isRefreshing:x,error:C},emptyLabel:o(t===`installed`?`marketplaceNoInstalledSkills`:`marketplaceNoSkills`),errorLabel:o(t===`installed`?`marketplaceErrorLoadingInstalledSkills`:`marketplaceErrorLoadingSkillsData`)};return{allItems:h,installedRecordLookup:_,installedTotal:s?.total??0,itemListView:w,showListSkeleton:b,isRefreshingList:x}}function gn(e,t){let n=Date.parse(e.installedAt??``),r=Date.parse(t.installedAt??``);return Number.isNaN(n)||Number.isNaN(r)||n===r?e.spec.localeCompare(t.spec):r-n}var _n=20;function vn({forcedType:e}={}){let t=x(),n=m(),{language:r}=G(),i=`skill`,a=(0,K.useMemo)(()=>R(r),[r]),[s,c]=(0,K.useState)(``),[l,u]=(0,K.useState)(``),[d,f]=(0,K.useState)(`all`),[p,h]=(0,K.useState)(`relevance`),{installState:g,manageState:_,handleInstall:v,handleManage:y,ConfirmDialog:b}=pn(),{openItemDetail:S}=mn(a);(0,K.useEffect)(()=>{let e=setTimeout(()=>{u(s.trim())},250);return()=>clearTimeout(e)},[s]);let C=wt(i),w=i===`skill`?n.scene?.trim():void 0,T=yt({q:w?void 0:l||void 0,scene:w,type:i,sort:p,pageSize:_n}),E=bt(i,d===`all`&&!s.trim()&&!l&&!w),{containerRef:D,sentinelRef:O}=Re({disabled:d!==`all`||T.isError||!T.hasNextPage||T.isFetchingNextPage,onLoadMore:()=>T.fetchNextPage(),watchValue:`${i}:${d}:${l}:${w??``}:${p}:${T.data?.loadedItems??0}:${T.data?.loadedPages??0}`});(0,K.useEffect)(()=>{let e=D.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[D,l,w,d,p,i]);let k=hn({scope:d,typeFilter:i,query:l,localeFallbacks:a,catalogView:T.data,installedView:C.data,isCatalogLoading:T.isLoading,isCatalogFetching:T.isFetching,isCatalogFetchingNextPage:T.isFetchingNextPage,catalogError:T.isError?T.error:void 0,isInstalledLoading:C.isLoading,installedError:C.isError?C.error:void 0}),A=fn({items:k.allItems,recentItems:E.data?.items??[],installedRecordLookup:k.installedRecordLookup,scene:w,forcedType:e,typeFilter:i,scope:d,searchText:s,query:l,showListSkeleton:k.showListSkeleton,hasCatalogError:T.isError});return(0,Y.jsxs)(de,{className:`flex h-full min-h-0 flex-col pb-0`,children:[!A.isSceneRoute&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3 border-b border-gray-200/60`,children:[(0,Y.jsx)(Xe,{value:d,onValueChange:e=>f(e),children:(0,Y.jsxs)(Ye,{className:`mb-0 h-auto flex-1 justify-start gap-6 rounded-none border-b-0 bg-transparent p-0 text-gray-500`,children:[(0,Y.jsx)(Je,{value:`all`,className:`rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:o(`marketplaceTabMarketplaceSkills`)}),(0,Y.jsxs)(Je,{value:`installed`,className:`gap-1.5 rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:[o(`marketplaceTabInstalledSkills`),(0,Y.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:k.installedTotal})]})]})}),(0,Y.jsx)(an,{})]}),(0,Y.jsx)(Ne,{scope:d,searchText:s,isRefreshing:k.isRefreshingList,searchPlaceholder:o(`marketplaceSearchPlaceholderSkills`),sort:p,onSearchTextChange:c,onSortChange:h})]}),(0,Y.jsx)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,Y.jsxs)(`div`,{ref:D,className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar pr-1`,"aria-busy":k.showListSkeleton||T.isFetchingNextPage,children:[A.isSceneRoute&&A.selectedScene&&(0,Y.jsx)(Xt,{scene:A.selectedScene,entries:A.sceneEntries,isLoading:k.showListSkeleton,language:r,localeFallbacks:a,installState:g,onBack:()=>t(A.backPath),onOpen:e=>void S(e.item,e.record),onInstall:v}),A.isSceneRoute&&!k.showListSkeleton&&(0,Y.jsx)(Le,{hasMore:!!T.hasNextPage,loading:T.isFetchingNextPage,sentinelRef:O}),A.showShelves&&(0,Y.jsx)(Jt,{recentEntries:A.recentEntries,scenes:A.scenes,isScenesLoading:A.isScenesLoading,isItemsLoading:k.showListSkeleton||E.isLoading,language:r,installState:g,onOpen:e=>void S(e.item,e.record),onInstall:v,onOpenScene:e=>t(`${A.pathPrefix}/${e}`)}),!A.isSceneRoute&&(0,Y.jsx)(Lt,{model:k.itemListView,showTitle:A.showShelves||!k.showListSkeleton,operationState:{installState:g,manageState:_},scroll:{hasMore:!!T.hasNextPage,loadingMore:T.isFetchingNextPage,sentinelRef:O},actions:{onOpen:(e,t)=>void S(e,t),onInstall:v,onManage:y}})]})}),(0,Y.jsx)(b,{})]})}var yn=`NextClaw`,bn=[{prefix:`/marketplace/mcp`,key:`marketplaceMcpPageTitle`},{prefix:`/marketplace/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/marketplace`,key:`marketplace`},{prefix:`/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/cron`,key:`cronPageTitle`},{prefix:`/agents`,key:`agentsPageTitle`},{prefix:`/chat`,key:`chat`},{prefix:`/model`,key:`modelPageTitle`},{prefix:`/search`,key:`searchPageTitle`},{prefix:`/providers`,key:`providersPageTitle`},{prefix:`/channels`,key:`channelsPageTitle`},{prefix:`/runtime`,key:`runtimePageTitle`},{prefix:`/updates`,key:`runtimeUpdatesPageTitle`},{prefix:`/remote`,key:`remotePageTitle`},{prefix:`/security`,key:`authSecurityTitle`},{prefix:`/secrets`,key:`secretsPageTitle`}];function xn(e,t){return e===t||e.startsWith(`${t}/`)}function Sn(e){let t=e.toLowerCase();for(let{prefix:e,key:n}of bn)if(xn(t,e))return o(n);return o(`settings`)}function Cn(e){let t=e.toLowerCase();return t===`localhost`||t.endsWith(`.localhost`)||t===`::1`||t===`[::1]`||t.startsWith(`127.`)}function wn(e){let t=e?.host.trim(),n=e?.hostname.trim(),r=e?.port.trim();return!t||!n?null:Cn(n)?r||null:t}function Tn(e,t){let n=wn(t);return`${yn}${n?` ${n}`:``} - ${Sn(e)}`}var En={...d,...ze};function Dn({children:e,sideDockManager:t}){let{isOpen:n,mode:r}=et();He();let{pathname:i}=S(),{language:a}=G(),{isMobile:o}=Ze(),s=w(),c=h(e=>e.isVisible);h(e=>e.pinnedItems);let l={getDockState:t.getDockState,pinTab:t.pinTab,unpinTab:t.unpinTab};return(0,K.useEffect)(()=>{document.title=Tn(i,window.location)},[i,a]),o&&s!==`win32`?(0,Y.jsx)(D,{pathname:i,isDocBrowserOpen:n,docBrowserDockControls:l,docBrowserRenderers:En,topbarLeadingInset:s===`darwin`?`4.75rem`:void 0,children:e}):(0,Y.jsx)(te,{pathname:i,isMobileLayout:o,isDocBrowserOpen:n,docBrowserMode:r,docBrowserDockControls:l,docBrowserRenderers:En,sideDock:c?(0,Y.jsx)(C,{manager:t}):null,children:e})}function On({children:e}){let t=k();return(0,Y.jsx)(tt,{manager:t.docBrowserManager,children:(0,Y.jsx)(Dn,{sideDockManager:t.sideDockManager,children:e})})}function kn(){let{isMobile:e}=Ze();return e?(0,Y.jsx)(y,{}):(0,Y.jsx)(b,{to:`/model`,replace:!0})}function An(e){let t=e.trim().toLowerCase();return t?!t.startsWith(`skills`):!0}function jn(e,t){t.startsWith(`mcp`)&&(e?.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}))}function Mn(e,t){e&&An(t)&&e.invalidateQueries({queryKey:[`config`]}),jn(e,t)}function Nn(e){let t=(0,K.useRef)(!1);(0,K.useEffect)(()=>{let n=I.eventBus.on(s.connectionOpen,()=>{N.handleConnectionRestored(),M.refreshAfterRealtimeReconnect(),t.current&&(t.current=!1,e?.invalidateQueries({queryKey:[`ncp-sessions`]}))}),r=I.eventBus.on(s.connectionClose,()=>{N.handleConnectionInterrupted(null),t.current=!0}),i=I.eventBus.on(s.connectionError,e=>{N.handleConnectionInterrupted(e?.message??null),t.current=!0}),a=I.eventBus.on(s.configUpdated,({path:t})=>{Mn(e,t)}),o=I.eventBus.on(s.runtimeUpdateSnapshot,e=>{M.reportSnapshot(e)}),c=I.eventBus.on(s.sessionRunStatus,t=>{xe(e,{type:`session.run-status`,payload:t})}),l=I.eventBus.on(s.sessionSummaryUpsert,t=>{xe(e,{type:`session.summary.upsert`,payload:t})}),u=I.eventBus.on(s.sessionSummaryDelete,t=>{xe(e,{type:`session.summary.delete`,payload:t})}),d=I.eventBus.on(s.error,e=>{console.error(`Realtime transport error:`,e.message)});return()=>{n(),r(),i(),a(),o(),c(),l(),u(),d()}},[e])}var Pn=(0,K.lazy)(async()=>({default:(await c(async()=>{let{ModelConfigPage:e}=await import(`./model-config-page-DOBqLZoQ.js`);return{ModelConfigPage:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]))).ModelConfigPage})),Fn=(0,K.lazy)(async()=>({default:(await c(async()=>{let{AppearanceSettingsPage:e}=await import(`./appearance-settings-page-BuGxSvlJ.js`);return{AppearanceSettingsPage:e}},__vite__mapDeps([19,1,20,21,5,3,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35]))).AppearanceSettingsPage})),Q=(0,K.lazy)(async()=>({default:(await c(async()=>{let{ChatPage:e}=await import(`./chat-page-BKQ89f4s.js`);return{ChatPage:e}},__vite__mapDeps([36,1,5,3,20,21,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35,6,37,38,17]))).ChatPage})),In=(0,K.lazy)(async()=>({default:(await c(async()=>{let{SearchConfigPage:e}=await import(`./search-config-page-CrL1pUzy.js`);return{SearchConfigPage:e}},__vite__mapDeps([39,1,7,5,3,2,25,10,11,32,14,40,15,17]))).SearchConfigPage})),Ln=(0,K.lazy)(async()=>({default:(await c(async()=>{let{ProvidersConfigPage:e}=await import(`./providers-config-page-BAVPJKpx.js`);return{ProvidersConfigPage:e}},__vite__mapDeps([41,1,5,3,7,22,8,2,23,25,30,32,14,26,37,33,34,40,15,17,18,11,9]))).ProvidersConfigPage})),Rn=(0,K.lazy)(async()=>({default:(await c(async()=>{let{ChannelsList:e}=await import(`./channels-list-page-Bspr1Jp4.js`);return{ChannelsList:e}},__vite__mapDeps([42,1,5,3,7,2,25,4,10,11,31,32,14,12,23,34,40,38,15,17,18]))).ChannelsList})),zn=(0,K.lazy)(async()=>({default:(await c(async()=>{let{RuntimeConfig:e}=await import(`./runtime-config-page-D0244uxJ.js`);return{RuntimeConfig:e}},__vite__mapDeps([43,1,20,21,5,3,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35,44,45,15,17]))).RuntimeConfig})),Bn=(0,K.lazy)(async()=>({default:(await c(async()=>{let{DesktopUpdateConfig:e}=await import(`./desktop-update-config-C9ZUI8UW.js`);return{DesktopUpdateConfig:e}},__vite__mapDeps([46,7,1,5,3,2,29,10,11,27,44]))).DesktopUpdateConfig})),Vn=(0,K.lazy)(async()=>({default:(await c(async()=>{let{SecurityConfig:e}=await import(`./security-config-cDrdpMJW.js`);return{SecurityConfig:e}},__vite__mapDeps([47,2,1,3]))).SecurityConfig})),Hn=(0,K.lazy)(async()=>({default:(await c(async()=>{let{SecretsConfigPage:e}=await import(`./secrets-config-page-BlgsD0-L.js`);return{SecretsConfigPage:e}},__vite__mapDeps([48,1,7,5,3,2,26,45,33,15,17]))).SecretsConfigPage})),Un=(0,K.lazy)(async()=>({default:(await c(async()=>{let{RemoteAccessPage:e}=await import(`./remote-C-r0SHcz.js`);return{RemoteAccessPage:e}},__vite__mapDeps([49,20,1,21,5,3,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35]))).RemoteAccessPage})),Wn=(0,K.lazy)(async()=>({default:(await c(async()=>{let{McpMarketplacePage:e}=await import(`./mcp-marketplace-page-C-d0RMfg.js`);return{McpMarketplacePage:e}},__vite__mapDeps([50,51,1,5,3,7,22,8,2,23,28,24,25,10,11,26,27,13,14,12,38,16]))).McpMarketplacePage}));function Gn(){return(0,Y.jsx)(`div`,{className:`h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40`})}function Kn({children:e}){return(0,Y.jsx)(K.Suspense,{fallback:(0,Y.jsx)(Gn,{}),children:e})}function $(e){return(0,Y.jsx)(Kn,{children:e})}var qn=[{path:`/chat/skills`,redirectTo:`/skills`},{path:`/chat/cron`,redirectTo:`/cron`},{path:`/chat/agents`,redirectTo:`/agents`},{path:`/chat/:sessionId?`,element:$((0,Y.jsx)(Q,{view:`chat`}))},{path:`/agents`,element:$((0,Y.jsx)(Q,{view:`agents`}))},{path:`/skills`,element:$((0,Y.jsx)(Q,{view:`skills`}))},{path:`/skills/scenes/:scene`,element:$((0,Y.jsx)(Q,{view:`skills`}))},{path:`/cron`,element:$((0,Y.jsx)(Q,{view:`cron`}))},{path:`/appearance`,element:$((0,Y.jsx)(Fn,{}))},{path:`/model`,element:$((0,Y.jsx)(Pn,{}))},{path:`/search`,element:$((0,Y.jsx)(In,{}))},{path:`/providers`,element:$((0,Y.jsx)(Ln,{}))},{path:`/channels`,element:$((0,Y.jsx)(Rn,{}))},{path:`/runtime`,element:$((0,Y.jsx)(zn,{}))},{path:`/updates`,element:$((0,Y.jsx)(Bn,{}))},{path:`/remote`,element:$((0,Y.jsx)(Un,{}))},{path:`/security`,element:$((0,Y.jsx)(Vn,{}))},{path:`/secrets`,element:$((0,Y.jsx)(Hn,{}))},{path:`/settings`,element:(0,Y.jsx)(kn,{})},{path:`/marketplace/skills`,redirectTo:`/skills`},{path:`/marketplace`,redirectTo:`/skills`},{path:`/marketplace/mcp`,element:$((0,Y.jsx)(Wn,{}))},{path:`/`,redirectTo:`/chat`},{path:`*`,redirectTo:`/chat`}];function Jn(e){return`redirectTo`in e?(0,Y.jsx)(O,{path:e.path,element:(0,Y.jsx)(b,{to:e.redirectTo,replace:!0})},e.path):(0,Y.jsx)(O,{path:e.path,element:e.element},e.path)}function Yn(){return(0,Y.jsx)(T,{children:qn.map(Jn)})}function Xn(){return Nn(pe),ae(),(0,K.useEffect)(()=>(M.start(),()=>{M.stop()}),[]),(0,Y.jsxs)(ee,{children:[(0,Y.jsx)(On,{children:(0,Y.jsx)(Yn,{})}),(0,Y.jsx)(f,{}),(0,Y.jsx)(u,{})]})}function Zn(){let e=le(),t=e.isError&&Ae(e.error);return e.isLoading&&!e.isError||t||e.isError?(0,Y.jsx)(Xn,{}):e.data?.enabled&&!e.data.authenticated?(0,Y.jsx)(l,{username:e.data.username}):(0,Y.jsx)(Xn,{})}function Qn(){return(0,K.useEffect)(()=>{re()},[]),(0,Y.jsxs)(be,{client:pe,children:[(0,Y.jsx)(Zn,{}),(0,Y.jsx)(_,{}),(0,Y.jsx)(fe,{position:`top-right`,richColors:!0,offset:window.nextclawDesktop?.platform===`win32`?56:void 0,mobileOffset:window.nextclawDesktop?.platform===`win32`?56:void 0})]})}var $n=window.nextclawDesktop?.platform===`win32`?v:ne;(0,pt.createRoot)(document.getElementById(`root`)).render((0,Y.jsx)(K.StrictMode,{children:(0,Y.jsx)(p,{children:(0,Y.jsx)(Ue,{children:(0,Y.jsx)($n,{children:(0,Y.jsx)(Qn,{})})})})}));export{vn as t};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/model-config-page-CR_mgEVp.js","assets/chunk-DseTPa7n.js","assets/api-tWUa6l9J.js","assets/react-39CDNZlM.js","assets/book-open-BQ29ZmDE.js","assets/dist-rYHnBo8t.js","assets/provider-scoped-model-input-DIL6Ex_d.js","assets/select-CVzGGT38.js","assets/popover-ZoDwVwwd.js","assets/provider-models-CXUgDxGR.js","assets/navigation-link-C1cvB7y4.js","assets/host-capabilities-B-TtABsP.js","assets/loader-circle-AOpK5kkW.js","assets/doc-browser-context-CPHNzQ8m.js","assets/middleware-Df-a4x-q.js","assets/form-actions-BnZVzLZf.js","assets/skeleton-OwCNQJ7M.js","assets/use-config-BAr5bH2c.js","assets/config-hints-S3g-UVZb.js","assets/appearance-settings-page-dMRBD7ni.js","assets/app-presenter-provider-s-FrOinZ.js","assets/preload-helper-D4M6sveU.js","assets/confirm-dialog-C1pbqHZX.js","assets/x-C1ijNWcE.js","assets/doc-browser-D8ng4EUc.js","assets/search-BhXQB2TO.js","assets/plus-DI37QuHc.js","assets/refresh-cw-DKewcdAl.js","assets/use-confirm-dialog-C4e0nG_4.js","assets/card-CtKueklV.js","assets/eye-CiJz3ODY.js","assets/tabs-B-QWjKCL.js","assets/use-viewport-layout-k1isXfNm.js","assets/trash-2-ck3t33I3.js","assets/logo-badge-BXI-Kdhd.js","assets/app-presenter-provider-D3BuuOyZ.css","assets/chat-page-MXBltS3G.js","assets/settings-2-BP6L2enG.js","assets/tag-chip-C88mxjwx.js","assets/search-config-page-DFOQ6SDJ.js","assets/config-split-page-uC6d_r9c.js","assets/providers-config-page-D2NXVctW.js","assets/channels-list-page-C8y3rqYt.js","assets/runtime-config-page-0lb5NyKc.js","assets/rotate-cw-PmqA8LQT.js","assets/save-BrckuAXY.js","assets/desktop-update-config-DssP8LCk.js","assets/security-config-13AtPIlm.js","assets/secrets-config-page-BqqeClqE.js","assets/remote-DYOOO1YG.js","assets/mcp-marketplace-page-5ogeBHnl.js","assets/mcp-marketplace-page-CxNe-Q9Q.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e,t}from"./chunk-DseTPa7n.js";import{D as n,O as r,S as i,k as a,r as o,w as s}from"./react-39CDNZlM.js";import{t as c}from"./preload-helper-D4M6sveU.js";import{B as l,D as u,E as d,V as f,_ as p,_t as m,a as h,at as g,b as _,dt as v,f as y,ft as b,gt as x,ht as S,i as C,m as w,mt as T,ot as E,p as D,pt as O,r as k,st as A,t as ee,u as te,ut as ne,y as re}from"./app-presenter-provider-s-FrOinZ.js";import{$t as j,At as M,B as ie,Ft as ae,I as oe,It as N,L as P,Qt as se,R as ce,St as le,V as ue,Wt as de,Xt as fe,Yt as pe,Zt as F,_n as me,an as he,cn as ge,gn as _e,hn as ve,in as ye,ln as be,m as xe,mn as Se,nn as Ce,on as we,rn as Te,sn as Ee,tn as De,un as Oe,vn as ke,vt as I,xt as Ae,yn as je,z as Me}from"./api-tWUa6l9J.js";import{a as L,c as Ne,d as Pe,f as Fe,i as Ie,l as Le,n as Re,o as R,r as ze,s as z,u as B}from"./mcp-marketplace-page-CxNe-Q9Q.js";import{c as V}from"./dist-rYHnBo8t.js";import{n as Be}from"./search-BhXQB2TO.js";import{a as H,c as U,o as W,s as Ve}from"./doc-browser-D8ng4EUc.js";import{i as He,n as Ue,o as We,r as G,t as Ge}from"./use-confirm-dialog-C4e0nG_4.js";import{o as Ke}from"./card-CtKueklV.js";import{t as qe}from"./navigation-link-C1cvB7y4.js";import{i as Je,r as Ye,t as Xe}from"./tabs-B-QWjKCL.js";import{t as Ze}from"./use-viewport-layout-k1isXfNm.js";import{t as Qe}from"./refresh-cw-DKewcdAl.js";import{t as $e}from"./trash-2-ck3t33I3.js";import{n as et,t as tt}from"./doc-browser-context-CPHNzQ8m.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var nt=t((e=>{var t=r();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}));function rt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function it(e,t,n){let r=e.slice(0);return r[t]=n,r}var at=class extends je{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,ve.batch(()=>{let e=this.#i,t=this.#f(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!ke(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(rt(e,n).forEach(e=>{e.destroy()}),rt(n,e).forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})),this.#m()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#f(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=me(this.#a,t(e))),this.#a}return e}#f(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new Se(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=it(this.#t,n,t),this.#m())}#m(){if(this.hasListeners()){let e=this.#a,t=this.#u(this.#t,this.#l);e!==this.#d(t,this.#r?.combine)&&ve.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},K=e(a(),1);function ot({queries:e,...t},n){let r=Oe(n),i=ge(),a=Ee(),o=K.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{De(e),ye(e,a,r.getQueryCache().get(e.queryHash))}),we(a);let[s]=K.useState(()=>new at(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;K.useSyncExternalStore(K.useCallback(e=>d?s.subscribe(ve.batchCalls(e)):_e,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),K.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>Te(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&Te(n,e)?Ce(n,new Se(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&he({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}var st=V(`BriefcaseBusiness`,[[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2`,key:`1ksdt3`}],[`path`,{d:`M22 13a18.15 18.15 0 0 1-20 0`,key:`12hx5q`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]),ct=V(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),lt=V(`Compass`,[[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),ut=V(`MessagesSquare`,[[`path`,{d:`M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z`,key:`p1xzt8`}],[`path`,{d:`M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1`,key:`1cx29u`}]]),dt=V(`PenLine`,[[`path`,{d:`M12 20h9`,key:`t2du7b`}],[`path`,{d:`M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z`,key:`1ykcvy`}]]),ft=V(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),pt=nt();function q(e){return Array.from(new Set(e.map(e=>e.spec).filter(Boolean)))}function mt(e){let{request:t,result:n}=e,r=new Date().toISOString();return n.type===`skill`?{type:`skill`,spec:n.spec,id:t.skill??n.spec,label:t.skill??n.name??n.spec,source:`workspace`,installPath:t.installPath,installedAt:r}:{type:n.type,spec:n.spec,id:n.name??n.spec,label:n.name??n.spec,source:`marketplace`,origin:`marketplace`,enabled:t.enabled??!0,runtimeStatus:t.enabled===!1?`disabled`:`ready`,installedAt:r}}function J(e,t){let{id:n,spec:r}=t;return!!(r&&e.spec===r||n&&e.id===n)}function ht(e,t){return t??{type:e,total:0,specs:[],records:[]}}function gt(e){let{result:t,view:n}=e,r=ht(t.type,n),i=mt(e),a=r.records.findIndex(e=>J(e,{id:i.id,spec:i.spec})),o=[...r.records];return a>=0?o[a]={...o[a],...i}:o.unshift(i),{...r,type:t.type,records:o,specs:q(o),total:o.length}}function _t(e){let{request:t,result:n,view:r}=e,i=ht(n.type,r);if(n.action===`uninstall`||n.action===`remove`){let e=i.records.filter(e=>!J(e,{id:n.id,spec:t.spec}));return{...i,records:e,specs:q(e),total:e.length}}let a=i.records.map(e=>J(e,{id:n.id,spec:t.spec})?n.action===`disable`?{...e,enabled:!1,runtimeStatus:`disabled`}:n.action===`update`?{...e,installedAt:new Date().toISOString(),origin:e.origin??`marketplace`}:{...e,enabled:!0,runtimeStatus:`ready`}:e);return{...i,records:a,specs:q(a),total:a.length}}var vt=3e4;function yt(e){let t=Fe({queryKey:[`marketplace-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>P({...e,page:t}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0,placeholderData:(t,n)=>{let r=n?.queryKey?.[1];if(!(!r||typeof r!=`object`||!r))return(`type`in r?r.type:void 0)===e.type&&xt(r,e)?t:void 0},staleTime:15e3,refetchInterval:e.q?!1:vt,refetchOnMount:`always`,refetchOnReconnect:`always`,refetchOnWindowFocus:`always`}),n=(0,K.useMemo)(()=>Pe(t.data),[t.data]);return{...t,data:n}}function bt(e,t=!0){return j({queryKey:[`marketplace-recent-items`,e],queryFn:()=>P({type:e,sort:`updated`,page:1,pageSize:6}),enabled:t,staleTime:15e3,refetchInterval:vt,refetchOnMount:`always`,refetchOnReconnect:`always`,refetchOnWindowFocus:`always`})}function xt(e,t){return e.tag===t.tag&&e.scene===t.scene&&e.pageSize===t.pageSize}function St(e=!0){return j({queryKey:[`marketplace-skill-scenes`],queryFn:Me,enabled:e,staleTime:6e4})}function Ct(e,t=!0){let n=ot({queries:e.map(e=>({queryKey:[`marketplace-skill-scene-count`,e.scene],queryFn:()=>P({type:`skill`,scene:e.scene,pageSize:1}),enabled:t&&typeof e.count!=`number`,staleTime:6e4}))});return(0,K.useMemo)(()=>{let t=new Map;return e.forEach((e,r)=>{let i=typeof e.count==`number`?e.count:n[r]?.data?.total;typeof i==`number`&&t.set(e.scene,i)}),t},[n,e])}function wt(e){return j({queryKey:[`marketplace-installed`,e],queryFn:()=>oe(e),staleTime:1e4})}function Tt(){let e=Oe();return se({mutationFn:e=>ie(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>gt({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`}),F.success(t.message||o(`marketplaceInstallSuccessSkill`))},onError:e=>{F.error(e.message||o(`marketplaceInstallFailed`))}})}function Et(){let e=Oe();return se({mutationFn:e=>ue(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>_t({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`});let r=t.action===`enable`?o(`marketplaceEnableSuccess`):t.action===`disable`?o(`marketplaceDisableSuccess`):t.action===`update`?o(`marketplaceUpdateSuccess`):o(`marketplaceUninstallSuccess`);F.success(t.message||r)},onError:e=>{F.error(e.message||o(`marketplaceOperationFailed`))}})}var Y=n(),Dt=[`bg-amber-600`,`bg-orange-500`,`bg-yellow-600`,`bg-emerald-600`,`bg-teal-600`,`bg-cyan-600`,`bg-stone-600`,`bg-rose-500`,`bg-violet-500`];function Ot(e){let{name:t,fallback:n,className:r}=e,i=t||n,a=i.substring(0,2).toUpperCase();return(0,Y.jsx)(`div`,{className:s(`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-sm font-semibold text-white`,kt(i),r),children:a})}function kt(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return Dt[Math.abs(t)%Dt.length]}function At({title:e,spec:t}){return(0,Y.jsxs)(Ve,{delayDuration:400,children:[(0,Y.jsxs)(H,{children:[(0,Y.jsx)(U,{asChild:!0,children:(0,Y.jsx)(`div`,{className:`truncate text-[14px] font-semibold leading-tight text-gray-950`,children:e})}),(0,Y.jsx)(W,{className:`max-w-[300px] text-xs`,children:e})]}),(0,Y.jsx)(`div`,{className:`mb-2 mt-1 flex min-w-0 items-center gap-1.5`,children:t?(0,Y.jsxs)(H,{children:[(0,Y.jsx)(U,{asChild:!0,children:(0,Y.jsx)(`span`,{className:`max-w-full truncate text-[11px] font-mono leading-tight text-gray-400`,children:t})}),(0,Y.jsx)(W,{className:`max-w-[300px] break-all font-mono text-xs`,children:t})]}):null})]})}function jt(e){let{item:t,record:n,state:r,onInstall:i,onManage:a}=e,{isInstalling:c,canUpdate:l,canUninstall:u,busyAction:d}=r,f=!!d;return t&&!n||n&&(l||u)?(0,Y.jsxs)(`div`,{className:s(`flex shrink-0 items-center justify-end gap-1.5 opacity-100 transition-opacity duration-150`,`md:pointer-events-none md:opacity-0`,`md:group-hover:pointer-events-auto md:group-hover:opacity-100`,`md:group-focus-within:pointer-events-auto md:group-focus-within:opacity-100`),children:[t&&!n&&(0,Y.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),i(t)},disabled:c,className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md bg-primary px-2 text-[11px] font-medium text-white transition-colors hover:bg-primary-600 disabled:opacity-50`,children:[(0,Y.jsx)(Ke,{className:`h-3 w-3`}),o(c?`marketplaceInstalling`:`marketplaceInstall`)]}),n&&l&&(0,Y.jsxs)(`button`,{disabled:f,onClick:e=>{e.stopPropagation(),a(`update`,n)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-blue-200/80 bg-white px-2 text-[11px] font-medium text-blue-600 transition-colors hover:border-blue-300 hover:bg-blue-50 disabled:opacity-50`,children:[(0,Y.jsx)(Qe,{className:`h-3 w-3`}),o(d===`update`?`marketplaceUpdating`:`marketplaceUpdate`)]}),n&&u&&(0,Y.jsxs)(`button`,{disabled:f,onClick:e=>{e.stopPropagation(),a(`uninstall`,n)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-gray-200/80 bg-white px-2 text-[11px] font-medium text-gray-500 transition-colors hover:border-rose-200 hover:bg-rose-50 hover:text-rose-600 disabled:opacity-50`,children:[(0,Y.jsx)($e,{className:`h-3 w-3`}),o(d===`uninstall`?`marketplaceRemoving`:`marketplaceUninstall`)]})]}):null}function Mt(e){let{record:t,disabled:n}=e;return t?(0,Y.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-end`,children:(0,Y.jsx)(Nt,{disabled:n})}):null}function Nt(e){let{disabled:t}=e,n=o(t?`marketplaceDisabledStatus`:`marketplaceInstalledStatus`);return(0,Y.jsx)(Ve,{delayDuration:300,children:(0,Y.jsxs)(H,{children:[(0,Y.jsx)(U,{asChild:!0,children:(0,Y.jsx)(`span`,{"aria-label":n,className:s(`inline-flex h-5 w-5 items-center justify-center`,t?`text-gray-400`:`text-emerald-700`),children:t?(0,Y.jsx)(A,{className:`h-4 w-4 opacity-40`}):(0,Y.jsx)(A,{className:`h-4 w-4`})})}),(0,Y.jsx)(W,{className:`text-xs`,children:n})]})})}function Pt(e){let{item:t,record:n,installState:r,manageState:i,onOpen:a,onInstall:s,onManage:c}=e,{language:l}=G(),u=R(l),d=t?.name??n?.label??n?.id??n?.spec??o(`marketplaceUnknownItem`),f=z(t?.summaryI18n,t?.summary,u)||(n?o(`marketplaceInstalledLocalSummary`):``),p=t?.install.spec??n?.spec??``,m=t?.tags??[],h=n?.id||n?.spec,g=h?i.actionsByTarget.get(h):void 0,_=n?.type===`skill`&&n.source===`workspace`,v=n?.type===`skill`&&n.origin===`marketplace`,y=n?n.enabled===!1||n.runtimeStatus===`disabled`:!1,b=t?.install.spec,x=typeof b==`string`&&r.installingSpecs.has(b);return(0,Y.jsxs)(`article`,{onClick:a,className:`group flex h-full min-h-[156px] cursor-pointer flex-col rounded-xl border border-gray-200/60 bg-white p-3.5 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,Y.jsx)(Ot,{name:d,fallback:p||o(`marketplaceTypeSkill`),className:`h-9 w-9 rounded-lg text-xs`}),(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,Y.jsx)(At,{title:d,spec:p})}),(0,Y.jsx)(Mt,{record:n,disabled:y})]}),(0,Y.jsxs)(`div`,{className:`mt-2 flex min-w-0 flex-1 flex-col`,children:[(0,Y.jsx)(`p`,{className:`line-clamp-2 text-left text-[12px] leading-relaxed text-gray-500`,children:f}),(0,Y.jsxs)(`div`,{className:`mt-auto flex min-w-0 items-end justify-between gap-2 pt-2`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsx)(Ft,{tags:m})}),(0,Y.jsx)(jt,{item:t,record:n,state:{isInstalling:x,canUpdate:v,canUninstall:_,busyAction:g},onInstall:s,onManage:c})]})]})]})}function Ft({tags:e}){let t=e.filter(It).slice(0,3);return t.length===0?null:(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-1.5 overflow-hidden`,children:t.map(e=>(0,Y.jsx)(`span`,{className:`max-w-[104px] truncate rounded-md bg-gray-100 px-2 py-0.5 text-[11px] font-medium leading-5 text-gray-500`,children:e},e))})}function It(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function Lt({model:e,showTitle:t,operationState:n,scroll:r,actions:i}){let{scope:a,entries:o,header:c,status:l,emptyLabel:u,errorLabel:d}=e,{showSkeleton:f,isRefreshing:p,error:m}=l,{hasMore:h,loadingMore:g,sentinelRef:_}=r,{installState:v,manageState:y}=n,{onOpen:b,onInstall:x,onManage:S}=i;return(0,Y.jsxs)(`section`,{className:s(`flex min-h-full flex-col`,t&&`gap-3`),children:[t&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-950`,children:c.title}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] text-gray-500`,children:[p&&(0,Y.jsx)(`span`,{className:`font-medium text-primary`,children:c.refreshingLabel}),(0,Y.jsx)(`span`,{children:c.summary})]})]}),m&&(0,Y.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[d,`: `,m.message]}),p&&(0,Y.jsx)(`div`,{"data-testid":`marketplace-list-refreshing`,className:`h-0.5 overflow-hidden rounded-full bg-primary/10`,children:(0,Y.jsx)(`div`,{className:`h-full w-1/3 animate-pulse rounded-full bg-primary`})}),(0,Y.jsxs)(`div`,{"data-testid":f?`marketplace-list-skeleton`:void 0,className:s(`grid grid-cols-1 gap-2.5 md:grid-cols-2 xl:grid-cols-3`,f&&`min-h-0 flex-1 auto-rows-[156px] content-start`),children:[f&&(0,Y.jsx)(B,{count:36}),!f&&!m&&o.map(e=>(0,Y.jsx)(Pt,{item:e.item,record:e.record,installState:v,manageState:y,onOpen:()=>b(e.item,e.record),onInstall:x,onManage:S},e.key))]}),!f&&!m&&o.length===0&&(0,Y.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:u}),a===`all`&&!f&&!m&&(0,Y.jsx)(Le,{hasMore:h,loading:g,sentinelRef:_})]})}function Rt(e){let{entry:t,language:n,localeFallbacks:r,installState:i,layout:a=`rail`,onOpen:c,onInstall:l}=e,{item:u,record:d}=t,f=z(u.summaryI18n,u.summary,r),p=u.install.spec,m=i.installingSpecs.has(p),h=!!d;return(0,Y.jsxs)(`article`,{onClick:()=>c(t),className:s(`group flex min-h-[166px] cursor-pointer flex-col justify-between rounded-xl border border-gray-200/70 bg-white p-3 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,a===`rail`?`w-[260px] shrink-0`:`w-full min-w-0`),children:[(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-start gap-2.5`,children:[(0,Y.jsx)(Ot,{name:u.name,fallback:u.install.spec}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,Y.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-gray-950`,children:u.name}),(0,Y.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] font-mono leading-tight text-gray-400`,children:zt(u)})]})]}),(0,Y.jsx)(`p`,{className:`line-clamp-2 text-[12px] leading-relaxed text-gray-500`,children:f}),(0,Y.jsx)(Bt,{tags:u.tags})]}),(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-gray-100 pt-2.5`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-gray-400`,children:Ht(u.updatedAt)}),h?(0,Y.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 text-[11px] font-semibold text-emerald-700`,children:[(0,Y.jsx)(A,{className:`h-3.5 w-3.5`}),Ut({zh:`已安装`,en:`Installed`},n)]}):(0,Y.jsxs)(`button`,{type:`button`,disabled:m,onClick:e=>{e.stopPropagation(),l(u)},className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-gray-200 bg-white px-2 text-[11px] font-semibold text-gray-700 transition-colors hover:border-gray-300 hover:bg-gray-50 disabled:opacity-50`,children:[(0,Y.jsx)(Ke,{className:`h-3.5 w-3.5`}),o(m?`marketplaceInstalling`:`marketplaceInstall`)]})]})]})}function zt(e){return e.slug||e.install.spec}function Bt({tags:e}){let t=e.filter(Vt).slice(0,2);return t.length===0?null:(0,Y.jsx)(`div`,{className:`mt-auto truncate pt-2 text-[11px] font-medium text-gray-400`,children:t.join(` / `)})}function Vt(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function Ht(e){return e.slice(0,10)||e}function Ut(e,t){return t.startsWith(`zh`)?e.zh:e.en}var Wt=[{scene:`development-debugging`,title:{zh:`开发与调试`,en:`Development`},summary:{zh:`代码审查、错误定位、架构分析与交付验证。`,en:`Review, debug, analyze, and verify delivery work.`},icon:ft,tone:`dark`,span:`md:col-span-2`},{scene:`office-collaboration`,title:{zh:`办公协作`,en:`Office Work`},summary:{zh:`连接文档、日历、会议、邮件和团队通信。`,en:`Connect docs, calendars, meetings, mail, and teams.`},icon:st,tone:`green`,span:`md:col-span-2`},{scene:`writing-content`,title:{zh:`写作与内容`,en:`Writing`},summary:{zh:`把调研、写作、润色和发布组织成连续工作流。`,en:`Turn research, writing, polishing, and publishing into one flow.`},icon:dt,tone:`amber`,span:`md:col-span-2`},{scene:`browser-automation`,title:{zh:`浏览器自动化`,en:`Browser`},summary:{zh:`操作网页、捕获动态内容并验证真实用户路径。`,en:`Operate pages, capture dynamic content, and verify user paths.`},icon:g,tone:`blue`,span:`md:col-span-2`},{scene:`local-environment`,title:{zh:`本地环境`,en:`Local`},summary:{zh:`管理终端、文件、运行时和本地服务。`,en:`Manage shells, files, runtimes, and local services.`},icon:E,tone:`violet`,span:`md:col-span-1`},{scene:`social-platforms`,title:{zh:`社交平台`,en:`Social`},summary:{zh:`处理发布、互动、检索和内容分发。`,en:`Handle posting, interaction, search, and distribution.`},icon:ut,tone:`sky`,span:`md:col-span-1`},{scene:`nextclaw-official`,title:{zh:`NextClaw 官方`,en:`NextClaw Official`},summary:{zh:`优先查看由 NextClaw 维护的原生能力。`,en:`Browse native capabilities maintained by NextClaw.`},icon:We,tone:`teal`,span:`md:col-span-2`}],Gt={icon:We,tone:`dark`,span:`md:col-span-2`},Kt={dark:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-stone-600 bg-stone-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},blue:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-cyan-600 bg-cyan-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},green:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-emerald-600 bg-emerald-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},amber:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-amber-600 bg-amber-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},violet:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-violet-500 bg-violet-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},sky:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-sky-500 bg-sky-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},teal:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-teal-600 bg-teal-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`}},qt=`grid grid-cols-[repeat(auto-fill,minmax(240px,320px))] justify-start gap-3`;function Jt(e){let{recentEntries:t,scenes:n,isScenesLoading:r,isItemsLoading:i,language:a,installState:o,onOpen:s,onInstall:c,onOpenScene:l}=e,u=R(a);return(0,Y.jsxs)(`div`,{className:`mb-4 space-y-5`,children:[(0,Y.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,Y.jsx)(Qt,{icon:lt,title:X({zh:`场景`,en:`Scenes`},a),description:X({zh:`按使用场景浏览适合的技能组合。`,en:`Browse skills by how you plan to use them.`},a)}),r?(0,Y.jsx)(`div`,{"data-testid":`marketplace-scenes-skeleton`,className:`grid auto-rows-[104px] grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:(0,Y.jsx)(B,{count:Wt.length})}):(0,Y.jsx)(`div`,{className:`grid grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:n.map(e=>(0,Y.jsx)(Yt,{scene:e,language:a,onSelect:l},e.scene))})]}),(i||t.length>0)&&(0,Y.jsx)(Zt,{icon:ct,title:X({zh:`最近更新`,en:`Recently updated`},a),description:X({zh:`看看生态最近在补齐哪些能力。`,en:`See what the ecosystem has been improving lately.`},a),entries:t,language:a,localeFallbacks:u,isLoading:i,installState:o,onOpen:s,onInstall:c})]})}function Yt(e){let{scene:t,language:n,onSelect:r}=e,i=$t(t.scene),a=i.icon,o=Kt[i.tone];return(0,Y.jsx)(`button`,{type:`button`,onClick:()=>r(t.scene),className:s(`group flex min-h-[74px] flex-col justify-center rounded-lg border px-3 py-2.5 text-left shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/70`,o.card),children:(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:s(`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border`,o.icon),children:(0,Y.jsx)(a,{className:`h-3.5 w-3.5`})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-gray-950`,children:en(t,i,n)}),typeof t.count==`number`&&(0,Y.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:nn(t.count,n)})]}),(0,Y.jsx)(`p`,{className:s(`mt-1 line-clamp-1 text-[11px] leading-relaxed`,o.text),children:tn(t,i,n)})]})})}function Xt(e){let{scene:t,entries:n,isLoading:r,language:i,localeFallbacks:a,installState:o,onBack:c,onOpen:l,onInstall:u}=e,d=$t(t.scene),f=d.icon,p=Kt[d.tone];return(0,Y.jsxs)(`section`,{className:`flex min-h-full flex-col`,children:[(0,Y.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-start gap-2.5`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:c,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900`,"aria-label":X({zh:`返回`,en:`Back`},i),children:(0,Y.jsx)(Be,{className:`h-4 w-4`})}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:s(`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border`,p.icon),children:(0,Y.jsx)(f,{className:`h-4 w-4`})}),(0,Y.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[15px] font-semibold text-gray-950`,children:en(t,d,i)}),(0,Y.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:X(r?{zh:`加载中`,en:`Loading`}:{zh:`${n.length} 个技能`,en:`${n.length} skills`},i)})]}),(0,Y.jsx)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-2`,children:(0,Y.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[12px] leading-relaxed text-gray-500`,children:tn(t,d,i)})})]})]}),r?(0,Y.jsx)(`div`,{"data-testid":`marketplace-scene-skeleton`,className:s(qt,`min-h-0 flex-1 auto-rows-[166px] content-start`),children:(0,Y.jsx)(B,{count:24})}):n.length>0?(0,Y.jsx)(`div`,{className:qt,children:n.map(e=>(0,Y.jsx)(Rt,{entry:e,language:i,localeFallbacks:a,installState:o,layout:`grid`,onOpen:l,onInstall:u},e.item.id))}):(0,Y.jsx)(`div`,{className:`rounded-lg border border-dashed border-gray-200 py-8 text-center text-[12px] text-gray-500`,children:X({zh:`这个模块暂无技能。`,en:`No skills in this module yet.`},i)})]})}function Zt(e){let{icon:t,title:n,description:r,entries:i,language:a,localeFallbacks:o,isLoading:s,installState:c,onOpen:l,onInstall:u}=e;return(0,Y.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,Y.jsx)(Qt,{icon:t,title:n,description:r}),s?(0,Y.jsx)(`div`,{"data-testid":`marketplace-recent-skeleton`,className:`-mx-1 grid auto-rows-[166px] grid-cols-[repeat(4,260px)] gap-2.5 overflow-hidden px-1 pb-1.5`,children:(0,Y.jsx)(B,{count:4})}):(0,Y.jsx)(`div`,{className:`-mx-1 flex gap-2.5 overflow-x-auto px-1 pb-1.5 custom-scrollbar`,children:i.map(e=>(0,Y.jsx)(Rt,{entry:e,language:a,localeFallbacks:o,installState:c,onOpen:l,onInstall:u},e.item.id))})]})}function Qt({icon:e,title:t,description:n}){return(0,Y.jsx)(`div`,{className:`flex items-end justify-between gap-4`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`h3`,{className:`flex items-center gap-2 text-[14px] font-semibold text-gray-950`,children:[(0,Y.jsx)(e,{className:`h-4 w-4 text-primary`}),t]}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-[12px] leading-relaxed text-gray-500`,children:n})]})})}function X(e,t){return t.startsWith(`zh`)?e.zh:e.en}function $t(e){return Wt.find(t=>t.scene===e)??{scene:e,...Gt}}function en(e,t,n){return t.title?X(t.title,n):e.title}function tn(e,t,n){return t.summary?X(t.summary,n):e.description??e.scene}function nn(e,t){return t.startsWith(`zh`)?`${e} 个技能`:`${e} skills`}var rn=`https://skillhub.cn/`;function an(){return(0,Y.jsx)(qe,{href:rn,external:!0,className:`h-7 shrink-0 px-1.5 text-[13px]`,children:o(`marketplaceExternalSkillSourceTitle`)})}function on(e){return(e??``).trim().toLowerCase()}function Z(e,t){let n=on(t);return n.length>0?`${e}:${n}`:``}function sn(e){let t=new Map;for(let n of e){let e=[n.install.spec,n.slug,n.id];for(let r of e){let e=Z(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function cn(e){let t=new Map;for(let n of e){let e=[n.spec,n.id,n.label];for(let r of e){let e=Z(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function ln(e,t){let n=[e.install.spec,e.slug,e.id];for(let r of n){let n=Z(e.type,r);if(!n)continue;let i=t.get(n);if(i)return i}}function un(e,t){return t.get(Z(e.type,e.spec))||t.get(Z(e.type,e.id))||t.get(Z(e.type,e.label))}function dn(e,t,n,r){let i=on(n);if(!i)return!0;let a=z(t?.summaryI18n,t?.summary,r);return[e.id,e.spec,e.label,t?.name,t?.slug,t?.summary,a,...t?.tags??[]].map(e=>on(e)).filter(Boolean).some(e=>e.includes(i))}function fn(e){let{items:t,recentItems:n,installedRecordLookup:r,scene:i,forcedType:a,typeFilter:o,scope:s,searchText:c,query:l,showListSkeleton:u,hasCatalogError:d}=e,f=St(o===`skill`),p=(0,K.useMemo)(()=>f.data?.scenes??[],[f.data?.scenes]),m=Ct(p,o===`skill`),h=(0,K.useMemo)(()=>p.map(e=>({...e,count:typeof e.count==`number`?e.count:m.get(e.scene)})),[m,p]),g=(0,K.useMemo)(()=>t.map(e=>({item:e,record:ln(e,r)})),[t,r]),_=(0,K.useMemo)(()=>n.map(e=>({item:e,record:ln(e,r)})),[r,n]),v=(0,K.useMemo)(()=>{let e=i?.trim();if(e)return h.find(t=>t.scene===e)??{scene:e,title:e}},[i,h]),y=o===`skill`&&!!i?.trim(),b=o===`skill`&&s===`all`&&!c.trim()&&!l&&!y,x=u||t.length>=4,S=b&&!d&&x&&h.length===0&&f.isLoading;return{entries:g,recentEntries:_,scenes:h,selectedScene:v,sceneEntries:g,isSceneRoute:y,isScenesLoading:S,showShelves:b&&!d&&x&&(u||h.length>0||S),backPath:a?`/skills`:`/marketplace/skills`,pathPrefix:a?`/skills/scenes`:`/marketplace/skills/scenes`}}function pn(){let e=Tt(),t=Et(),{confirm:n,ConfirmDialog:r}=Ge(),[i,a]=(0,K.useState)(new Set),[s,c]=(0,K.useState)(new Map);return{installState:{installingSpecs:i},manageState:{actionsByTarget:s},handleInstall:async t=>{let n=t.install.spec;if(!i.has(n)){a(e=>new Set(e).add(n));try{await e.mutateAsync({type:t.type,spec:n,kind:t.install.kind,skill:t.slug,installPath:`skills/${t.slug}`})}catch{}finally{a(e=>{let t=new Set(e);return t.delete(n),t})}}},handleManage:async(e,r)=>{let i=e===`update`?r.catalogSlug||r.id||r.spec:r.id||r.spec;if(!(!i||s.has(i))&&!(e===`uninstall`&&!await n({title:`${o(`marketplaceUninstallTitle`)} ${i}?`,description:o(`marketplaceUninstallDescription`),confirmLabel:o(`marketplaceUninstall`),variant:`destructive`}))){c(t=>new Map(t).set(i,e));try{await t.mutateAsync({type:r.type,action:e,id:i,spec:r.spec})}finally{c(e=>{let t=new Map(e);return t.delete(i),t})}}},ConfirmDialog:r}}function mn(e){let t=et(),n=(0,K.useRef)({byKey:new Map,seq:0});return{openItemDetail:async(r,i)=>{let a=r?.name??i?.label??i?.id??i?.spec??o(`marketplaceUnknownItem`),s=Ie(r?`skill`:`skill-local`,r?.slug??i?.id??i?.spec??a),c=r?`marketplace:${r.type}:${r.slug}`:`marketplace:${i?.type??`unknown`}:${i?.id??i?.spec??a}`,l=o(`marketplaceTypeSkill`);if(!r){L(t,{id:s,title:a,typeLabel:l,spec:i?.spec??`-`,status:`ready`,summary:o(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify(i??{},null,2),contentRaw:`-`});return}let u=n.current.seq+1;n.current.seq=u,n.current.byKey.set(c,u);let d=z(r.summaryI18n,r.summary,e);L(t,{id:s,title:a,typeLabel:l,spec:r.install.spec,status:`loading`,summary:d,tags:r.tags,author:r.author});try{let e=await ce(r.slug);if(n.current.byKey.get(c)!==u)return;L(t,{id:s,title:a,typeLabel:l,spec:r.install.spec,status:`ready`,summary:d,metadataRaw:e.metadataRaw,contentRaw:e.bodyRaw||e.raw,sourceUrl:e.sourceUrl,sourceLabel:`Source (${e.source})`,tags:r.tags,author:r.author},{activate:!1})}catch(e){if(n.current.byKey.get(c)!==u)return;L(t,{id:s,title:a,typeLabel:l,spec:r.install.spec,status:`error`,summary:d,metadataRaw:JSON.stringify({error:e instanceof Error?e.message:String(e)},null,2),contentRaw:o(`marketplaceOperationFailed`)},{activate:!1})}}}}function hn(e){let{scope:t,typeFilter:n,query:r,localeFallbacks:i,catalogView:a,installedView:s,isCatalogLoading:c,isCatalogFetching:l,isCatalogFetchingNextPage:u,catalogError:d,isInstalledLoading:f,installedError:p}=e,m=(0,K.useMemo)(()=>s?.records??[],[s?.records]),h=(0,K.useMemo)(()=>a?.items??[],[a?.items]),g=(0,K.useMemo)(()=>sn(h),[h]),_=(0,K.useMemo)(()=>cn(m),[m]),v=(0,K.useMemo)(()=>m.filter(e=>e.type===n).map(e=>({key:`${e.type}:${e.spec}:${e.id??``}`,record:e,item:un(e,g)})).filter(e=>dn(e.record,e.item,r,i)).sort((e,t)=>gn(e.record,t.record)),[m,n,g,r,i]),y=(0,K.useMemo)(()=>t===`installed`?v:h.map(e=>({key:e.id,item:e,record:ln(e,_)})),[h,v,_,t]),b=t===`all`&&c&&!a||t===`installed`&&f&&!s,x=t===`all`&&!b&&!!a&&l&&!u,S=t===`installed`?f&&!s?o(`loading`):`${v.length} ${o(`marketplaceInstalledSkillsCountSuffix`)}`:a?`${a.total} ${o(`marketplaceSkillsCountSuffix`)}`:o(`loading`),C=t===`all`&&d?d:t===`installed`&&p?p:void 0,w={scope:t,entries:y,header:{title:o(t===`installed`?`marketplaceSectionInstalledSkills`:`marketplaceAllSkills`),summary:S,refreshingLabel:o(`marketplaceRefreshingResults`)},status:{showSkeleton:b,isRefreshing:x,error:C},emptyLabel:o(t===`installed`?`marketplaceNoInstalledSkills`:`marketplaceNoSkills`),errorLabel:o(t===`installed`?`marketplaceErrorLoadingInstalledSkills`:`marketplaceErrorLoadingSkillsData`)};return{allItems:h,installedRecordLookup:_,installedTotal:s?.total??0,itemListView:w,showListSkeleton:b,isRefreshingList:x}}function gn(e,t){let n=Date.parse(e.installedAt??``),r=Date.parse(t.installedAt??``);return Number.isNaN(n)||Number.isNaN(r)||n===r?e.spec.localeCompare(t.spec):r-n}var _n=20;function vn({forcedType:e}={}){let t=x(),n=m(),{language:r}=G(),i=`skill`,a=(0,K.useMemo)(()=>R(r),[r]),[s,c]=(0,K.useState)(``),[l,u]=(0,K.useState)(``),[d,f]=(0,K.useState)(`all`),[p,h]=(0,K.useState)(`relevance`),{installState:g,manageState:_,handleInstall:v,handleManage:y,ConfirmDialog:b}=pn(),{openItemDetail:S}=mn(a);(0,K.useEffect)(()=>{let e=setTimeout(()=>{u(s.trim())},250);return()=>clearTimeout(e)},[s]);let C=wt(i),w=i===`skill`?n.scene?.trim():void 0,T=yt({q:w?void 0:l||void 0,scene:w,type:i,sort:p,pageSize:_n}),E=bt(i,d===`all`&&!s.trim()&&!l&&!w),{containerRef:D,sentinelRef:O}=Re({disabled:d!==`all`||T.isError||!T.hasNextPage||T.isFetchingNextPage,onLoadMore:()=>T.fetchNextPage(),watchValue:`${i}:${d}:${l}:${w??``}:${p}:${T.data?.loadedItems??0}:${T.data?.loadedPages??0}`});(0,K.useEffect)(()=>{let e=D.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[D,l,w,d,p,i]);let k=hn({scope:d,typeFilter:i,query:l,localeFallbacks:a,catalogView:T.data,installedView:C.data,isCatalogLoading:T.isLoading,isCatalogFetching:T.isFetching,isCatalogFetchingNextPage:T.isFetchingNextPage,catalogError:T.isError?T.error:void 0,isInstalledLoading:C.isLoading,installedError:C.isError?C.error:void 0}),A=fn({items:k.allItems,recentItems:E.data?.items??[],installedRecordLookup:k.installedRecordLookup,scene:w,forcedType:e,typeFilter:i,scope:d,searchText:s,query:l,showListSkeleton:k.showListSkeleton,hasCatalogError:T.isError});return(0,Y.jsxs)(de,{className:`flex h-full min-h-0 flex-col pb-0`,children:[!A.isSceneRoute&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3 border-b border-gray-200/60`,children:[(0,Y.jsx)(Xe,{value:d,onValueChange:e=>f(e),children:(0,Y.jsxs)(Ye,{className:`mb-0 h-auto flex-1 justify-start gap-6 rounded-none border-b-0 bg-transparent p-0 text-gray-500`,children:[(0,Y.jsx)(Je,{value:`all`,className:`rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:o(`marketplaceTabMarketplaceSkills`)}),(0,Y.jsxs)(Je,{value:`installed`,className:`gap-1.5 rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:[o(`marketplaceTabInstalledSkills`),(0,Y.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:k.installedTotal})]})]})}),(0,Y.jsx)(an,{})]}),(0,Y.jsx)(Ne,{scope:d,searchText:s,isRefreshing:k.isRefreshingList,searchPlaceholder:o(`marketplaceSearchPlaceholderSkills`),sort:p,onSearchTextChange:c,onSortChange:h})]}),(0,Y.jsx)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,Y.jsxs)(`div`,{ref:D,className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar pr-1`,"aria-busy":k.showListSkeleton||T.isFetchingNextPage,children:[A.isSceneRoute&&A.selectedScene&&(0,Y.jsx)(Xt,{scene:A.selectedScene,entries:A.sceneEntries,isLoading:k.showListSkeleton,language:r,localeFallbacks:a,installState:g,onBack:()=>t(A.backPath),onOpen:e=>void S(e.item,e.record),onInstall:v}),A.isSceneRoute&&!k.showListSkeleton&&(0,Y.jsx)(Le,{hasMore:!!T.hasNextPage,loading:T.isFetchingNextPage,sentinelRef:O}),A.showShelves&&(0,Y.jsx)(Jt,{recentEntries:A.recentEntries,scenes:A.scenes,isScenesLoading:A.isScenesLoading,isItemsLoading:k.showListSkeleton||E.isLoading,language:r,installState:g,onOpen:e=>void S(e.item,e.record),onInstall:v,onOpenScene:e=>t(`${A.pathPrefix}/${e}`)}),!A.isSceneRoute&&(0,Y.jsx)(Lt,{model:k.itemListView,showTitle:A.showShelves||!k.showListSkeleton,operationState:{installState:g,manageState:_},scroll:{hasMore:!!T.hasNextPage,loadingMore:T.isFetchingNextPage,sentinelRef:O},actions:{onOpen:(e,t)=>void S(e,t),onInstall:v,onManage:y}})]})}),(0,Y.jsx)(b,{})]})}var yn=`NextClaw`,bn=[{prefix:`/marketplace/mcp`,key:`marketplaceMcpPageTitle`},{prefix:`/marketplace/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/marketplace`,key:`marketplace`},{prefix:`/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/cron`,key:`cronPageTitle`},{prefix:`/agents`,key:`agentsPageTitle`},{prefix:`/chat`,key:`chat`},{prefix:`/model`,key:`modelPageTitle`},{prefix:`/search`,key:`searchPageTitle`},{prefix:`/providers`,key:`providersPageTitle`},{prefix:`/channels`,key:`channelsPageTitle`},{prefix:`/runtime`,key:`runtimePageTitle`},{prefix:`/updates`,key:`runtimeUpdatesPageTitle`},{prefix:`/remote`,key:`remotePageTitle`},{prefix:`/security`,key:`authSecurityTitle`},{prefix:`/secrets`,key:`secretsPageTitle`}];function xn(e,t){return e===t||e.startsWith(`${t}/`)}function Sn(e){let t=e.toLowerCase();for(let{prefix:e,key:n}of bn)if(xn(t,e))return o(n);return o(`settings`)}function Cn(e){let t=e.toLowerCase();return t===`localhost`||t.endsWith(`.localhost`)||t===`::1`||t===`[::1]`||t.startsWith(`127.`)}function wn(e){let t=e?.host.trim(),n=e?.hostname.trim(),r=e?.port.trim();return!t||!n?null:Cn(n)?r||null:t}function Tn(e,t){let n=wn(t);return`${yn}${n?` ${n}`:``} - ${Sn(e)}`}var En={...d,...ze};function Dn({children:e,sideDockManager:t}){let{isOpen:n,mode:r}=et();He();let{pathname:i}=S(),{language:a}=G(),{isMobile:o}=Ze(),s=w(),c=h(e=>e.isVisible);h(e=>e.pinnedItems);let l={getDockState:t.getDockState,pinTab:t.pinTab,unpinTab:t.unpinTab};return(0,K.useEffect)(()=>{document.title=Tn(i,window.location)},[i,a]),o&&s!==`win32`?(0,Y.jsx)(D,{pathname:i,isDocBrowserOpen:n,docBrowserDockControls:l,docBrowserRenderers:En,topbarLeadingInset:s===`darwin`?`4.75rem`:void 0,children:e}):(0,Y.jsx)(te,{pathname:i,isMobileLayout:o,isDocBrowserOpen:n,docBrowserMode:r,docBrowserDockControls:l,docBrowserRenderers:En,sideDock:c?(0,Y.jsx)(C,{manager:t}):null,children:e})}function On({children:e}){let t=k();return(0,Y.jsx)(tt,{manager:t.docBrowserManager,children:(0,Y.jsx)(Dn,{sideDockManager:t.sideDockManager,children:e})})}function kn(){let{isMobile:e}=Ze();return e?(0,Y.jsx)(y,{}):(0,Y.jsx)(b,{to:`/model`,replace:!0})}function An(e){let t=e.trim().toLowerCase();return t?!t.startsWith(`skills`):!0}function jn(e,t){t.startsWith(`mcp`)&&(e?.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}))}function Mn(e,t){e&&An(t)&&e.invalidateQueries({queryKey:[`config`]}),jn(e,t)}function Nn(e){let t=(0,K.useRef)(!1);(0,K.useEffect)(()=>{let n=I.eventBus.on(i.connectionOpen,()=>{N.handleConnectionRestored(),M.refreshAfterRealtimeReconnect(),t.current&&(t.current=!1,e?.invalidateQueries({queryKey:[`ncp-sessions`]}))}),r=I.eventBus.on(i.connectionClose,()=>{N.handleConnectionInterrupted(null),t.current=!0}),a=I.eventBus.on(i.connectionError,e=>{N.handleConnectionInterrupted(e?.message??null),t.current=!0}),o=I.eventBus.on(i.configUpdated,({path:t})=>{Mn(e,t)}),s=I.eventBus.on(i.runtimeUpdateSnapshot,e=>{M.reportSnapshot(e)}),c=I.eventBus.on(i.sessionRunStatus,t=>{xe(e,{type:`session.run-status`,payload:t})}),l=I.eventBus.on(i.sessionSummaryUpsert,t=>{xe(e,{type:`session.summary.upsert`,payload:t})}),u=I.eventBus.on(i.sessionSummaryDelete,t=>{xe(e,{type:`session.summary.delete`,payload:t})}),d=I.eventBus.on(i.error,e=>{console.error(`Realtime transport error:`,e.message)});return()=>{n(),r(),a(),o(),s(),c(),l(),u(),d()}},[e])}var Pn=(0,K.lazy)(async()=>({default:(await c(async()=>{let{ModelConfigPage:e}=await import(`./model-config-page-CR_mgEVp.js`);return{ModelConfigPage:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]))).ModelConfigPage})),Fn=(0,K.lazy)(async()=>({default:(await c(async()=>{let{AppearanceSettingsPage:e}=await import(`./appearance-settings-page-dMRBD7ni.js`);return{AppearanceSettingsPage:e}},__vite__mapDeps([19,1,20,21,5,3,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35]))).AppearanceSettingsPage})),Q=(0,K.lazy)(async()=>({default:(await c(async()=>{let{ChatPage:e}=await import(`./chat-page-MXBltS3G.js`);return{ChatPage:e}},__vite__mapDeps([36,1,5,3,20,21,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35,6,37,38,17]))).ChatPage})),In=(0,K.lazy)(async()=>({default:(await c(async()=>{let{SearchConfigPage:e}=await import(`./search-config-page-DFOQ6SDJ.js`);return{SearchConfigPage:e}},__vite__mapDeps([39,1,7,5,3,2,25,10,11,32,14,40,15,17]))).SearchConfigPage})),Ln=(0,K.lazy)(async()=>({default:(await c(async()=>{let{ProvidersConfigPage:e}=await import(`./providers-config-page-D2NXVctW.js`);return{ProvidersConfigPage:e}},__vite__mapDeps([41,1,5,3,7,22,8,2,23,25,30,32,14,26,37,33,34,40,15,17,18,11,9]))).ProvidersConfigPage})),Rn=(0,K.lazy)(async()=>({default:(await c(async()=>{let{ChannelsList:e}=await import(`./channels-list-page-C8y3rqYt.js`);return{ChannelsList:e}},__vite__mapDeps([42,1,5,3,7,2,25,4,10,11,31,32,14,12,23,34,40,38,15,17,18]))).ChannelsList})),zn=(0,K.lazy)(async()=>({default:(await c(async()=>{let{RuntimeConfig:e}=await import(`./runtime-config-page-0lb5NyKc.js`);return{RuntimeConfig:e}},__vite__mapDeps([43,1,20,21,5,3,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35,44,45,15,17]))).RuntimeConfig})),Bn=(0,K.lazy)(async()=>({default:(await c(async()=>{let{DesktopUpdateConfig:e}=await import(`./desktop-update-config-DssP8LCk.js`);return{DesktopUpdateConfig:e}},__vite__mapDeps([46,7,1,5,3,2,29,10,11,27,44]))).DesktopUpdateConfig})),Vn=(0,K.lazy)(async()=>({default:(await c(async()=>{let{SecurityConfig:e}=await import(`./security-config-13AtPIlm.js`);return{SecurityConfig:e}},__vite__mapDeps([47,2,1,3]))).SecurityConfig})),Hn=(0,K.lazy)(async()=>({default:(await c(async()=>{let{SecretsConfigPage:e}=await import(`./secrets-config-page-BqqeClqE.js`);return{SecretsConfigPage:e}},__vite__mapDeps([48,1,7,5,3,2,26,45,33,15,17]))).SecretsConfigPage})),Un=(0,K.lazy)(async()=>({default:(await c(async()=>{let{RemoteAccessPage:e}=await import(`./remote-DYOOO1YG.js`);return{RemoteAccessPage:e}},__vite__mapDeps([49,20,1,21,5,3,7,22,8,2,23,24,25,10,11,26,27,13,14,4,28,29,30,31,32,12,33,34,9,35]))).RemoteAccessPage})),Wn=(0,K.lazy)(async()=>({default:(await c(async()=>{let{McpMarketplacePage:e}=await import(`./mcp-marketplace-page-5ogeBHnl.js`);return{McpMarketplacePage:e}},__vite__mapDeps([50,51,1,5,3,7,22,8,2,23,28,24,25,10,11,26,27,13,14,12,38,16]))).McpMarketplacePage}));function Gn(){return(0,Y.jsx)(`div`,{className:`h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40`})}function Kn({children:e}){return(0,Y.jsx)(K.Suspense,{fallback:(0,Y.jsx)(Gn,{}),children:e})}function $(e){return(0,Y.jsx)(Kn,{children:e})}var qn=[{path:`/chat/skills`,redirectTo:`/skills`},{path:`/chat/cron`,redirectTo:`/cron`},{path:`/chat/agents`,redirectTo:`/agents`},{path:`/chat/:sessionId?`,element:$((0,Y.jsx)(Q,{view:`chat`}))},{path:`/agents`,element:$((0,Y.jsx)(Q,{view:`agents`}))},{path:`/skills`,element:$((0,Y.jsx)(Q,{view:`skills`}))},{path:`/skills/scenes/:scene`,element:$((0,Y.jsx)(Q,{view:`skills`}))},{path:`/cron`,element:$((0,Y.jsx)(Q,{view:`cron`}))},{path:`/appearance`,element:$((0,Y.jsx)(Fn,{}))},{path:`/model`,element:$((0,Y.jsx)(Pn,{}))},{path:`/search`,element:$((0,Y.jsx)(In,{}))},{path:`/providers`,element:$((0,Y.jsx)(Ln,{}))},{path:`/channels`,element:$((0,Y.jsx)(Rn,{}))},{path:`/runtime`,element:$((0,Y.jsx)(zn,{}))},{path:`/updates`,element:$((0,Y.jsx)(Bn,{}))},{path:`/remote`,element:$((0,Y.jsx)(Un,{}))},{path:`/security`,element:$((0,Y.jsx)(Vn,{}))},{path:`/secrets`,element:$((0,Y.jsx)(Hn,{}))},{path:`/settings`,element:(0,Y.jsx)(kn,{})},{path:`/marketplace/skills`,redirectTo:`/skills`},{path:`/marketplace`,redirectTo:`/skills`},{path:`/marketplace/mcp`,element:$((0,Y.jsx)(Wn,{}))},{path:`/`,redirectTo:`/chat`},{path:`*`,redirectTo:`/chat`}];function Jn(e){return`redirectTo`in e?(0,Y.jsx)(O,{path:e.path,element:(0,Y.jsx)(b,{to:e.redirectTo,replace:!0})},e.path):(0,Y.jsx)(O,{path:e.path,element:e.element},e.path)}function Yn(){return(0,Y.jsx)(T,{children:qn.map(Jn)})}function Xn(){return Nn(pe),ae(),(0,K.useEffect)(()=>(M.start(),()=>{M.stop()}),[]),(0,Y.jsxs)(ee,{children:[(0,Y.jsx)(On,{children:(0,Y.jsx)(Yn,{})}),(0,Y.jsx)(f,{}),(0,Y.jsx)(u,{})]})}function Zn(){let e=le(),t=e.isError&&Ae(e.error);return e.isLoading&&!e.isError||t||e.isError?(0,Y.jsx)(Xn,{}):e.data?.enabled&&!e.data.authenticated?(0,Y.jsx)(l,{username:e.data.username}):(0,Y.jsx)(Xn,{})}function Qn(){return(0,K.useEffect)(()=>{re()},[]),(0,Y.jsxs)(be,{client:pe,children:[(0,Y.jsx)(Zn,{}),(0,Y.jsx)(_,{}),(0,Y.jsx)(fe,{position:`top-right`,richColors:!0,offset:window.nextclawDesktop?.platform===`win32`?56:void 0,mobileOffset:window.nextclawDesktop?.platform===`win32`?56:void 0})]})}var $n=window.nextclawDesktop?.platform===`win32`?v:ne;(0,pt.createRoot)(document.getElementById(`root`)).render((0,Y.jsx)(K.StrictMode,{children:(0,Y.jsx)(p,{children:(0,Y.jsx)(Ue,{children:(0,Y.jsx)($n,{children:(0,Y.jsx)(Qn,{})})})})}));export{vn as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e}from"./dist-rYHnBo8t.js";var t=e(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./chunk-DseTPa7n.js";import{D as t,k as n,w as r}from"./react-39CDNZlM.js";var i=t(),a={active:{dot:`bg-emerald-500`,text:`text-emerald-600`,bg:`bg-emerald-50`},ready:{dot:`bg-emerald-500`,text:`text-emerald-600`,bg:`bg-emerald-50`},inactive:{dot:`bg-gray-300`,text:`text-gray-400`,bg:`bg-gray-100/80`},setup:{dot:`bg-gray-300`,text:`text-gray-400`,bg:`bg-gray-100/80`},warning:{dot:`bg-amber-400`,text:`text-amber-600`,bg:`bg-amber-50`}};function o({status:e,label:t,className:n}){let o=a[e];return(0,i.jsxs)(`div`,{className:r(`inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-2 py-0.5`,o.bg,n),children:[(0,i.jsx)(`span`,{className:r(`h-1.5 w-1.5 rounded-full`,o.dot)}),(0,i.jsx)(`span`,{className:r(`text-[11px] font-medium`,o.text),children:t})]})}var s=e(n(),1);function c({name:e,src:t,className:n,imgClassName:a,fallback:o}){let[c,l]=(0,s.useState)(!1),u=!!t&&!c;return(0,i.jsx)(`div`,{className:r(`inline-flex shrink-0 items-center justify-center overflow-hidden`,n),children:u?(0,i.jsx)(`img`,{src:t,alt:`${e} logo`,className:r(`block h-6 w-6 object-contain`,a),onError:()=>l(!0),draggable:!1}):o??(0,i.jsx)(`span`,{className:`text-lg font-bold uppercase`,children:e.slice(0,1)})})}export{o as n,c as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./mcp-marketplace-page-CxNe-Q9Q.js";export{e as McpMarketplacePage};
|