@nextclaw/ui 0.12.13 → 0.12.15
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 +20 -0
- package/dist/assets/{api-C51456xV.js → api-HsS9C7l0.js} +1 -1
- package/dist/assets/{app-manager-provider-D_cKqqRG.js → app-manager-provider-CNa6cmOk.js} +1 -1
- package/dist/assets/{app-navigation.config-Dve1W20Y.js → app-navigation.config-Dy69P_3O.js} +1 -1
- package/dist/assets/{book-open-B4mOKdz8.js → book-open-DJSe9YLj.js} +1 -1
- package/dist/assets/{channels-list-page-WJ7d4zMI.js → channels-list-page-DtjYJ1FX.js} +1 -1
- package/dist/assets/chat-Rmwi-kQn.js +58 -0
- package/dist/assets/{chat-page-CHKwiqPY.js → chat-page-Cslvp6SG.js} +1 -1
- package/dist/assets/{chunk-JZWAC4HX-ptDyT_1C.js → chunk-JZWAC4HX-CMPxE3BJ.js} +1 -1
- package/dist/assets/{config-split-page-B3PRA_AV.js → config-split-page-v7p1CQjU.js} +1 -1
- package/dist/assets/{createLucideIcon-C_GFKVuW.js → createLucideIcon-Y1cWg3R9.js} +1 -1
- package/dist/assets/{desktop-update-config-gnna2NaS.js → desktop-update-config-CqJmmpjR.js} +1 -1
- package/dist/assets/{dialog-BHcaU6NE.js → dialog-CYis0wx_.js} +1 -1
- package/dist/assets/{dist-DtBFqZ6_.js → dist-DIWOVzPY.js} +1 -1
- package/dist/assets/{doc-browser-CwgI7ipB.js → doc-browser-BQT0fa3g.js} +1 -1
- package/dist/assets/{doc-browser-CoKIUCJj.js → doc-browser-CP6kjGaF.js} +1 -1
- package/dist/assets/doc-browser-DK2tXLi_.js +1 -0
- package/dist/assets/{doc-browser-context-Dib9sS83.js → doc-browser-context-BacwCbOG.js} +1 -1
- package/dist/assets/{es2015-BlNhrQUG.js → es2015-3VnZDFPs.js} +1 -1
- package/dist/assets/{external-link-DP2IJ7AM.js → external-link-CPhZo92k.js} +1 -1
- package/dist/assets/{folder-BPwc278w.js → folder-orBwjR8h.js} +1 -1
- package/dist/assets/{hash-CvcvtMBq.js → hash-BvWW8Scd.js} +1 -1
- package/dist/assets/i18n-BhoFaF7E.js +1 -0
- package/dist/assets/{index-CxzW1dQ9.js → index-D0_J-bk_.js} +2 -2
- package/dist/assets/index-OrUEVLgT.css +1 -0
- package/dist/assets/{key-round-BQXmPSxD.js → key-round-B5u2XQwa.js} +1 -1
- package/dist/assets/loader-circle-DotuB8NZ.js +1 -0
- package/dist/assets/{logo-badge-uB4SwANR.js → logo-badge-BLQdO_th.js} +1 -1
- package/dist/assets/{logos-BcELLmYh.js → logos-WPtZ1joO.js} +1 -1
- package/dist/assets/marketplace-page-CJHkdgv_.js +1 -0
- package/dist/assets/{marketplace-page-DiqqX25V.js → marketplace-page-It54wla_.js} +1 -1
- package/dist/assets/{mcp-marketplace-page-C_akqPwv.js → mcp-marketplace-page-C64VUmni.js} +1 -1
- package/dist/assets/mcp-marketplace-page-DIItTRy_.js +1 -0
- package/dist/assets/message-square-CO_7rU-N.js +1 -0
- package/dist/assets/{model-config-B0L43HTL.js → model-config-Cu6zLI8a.js} +1 -1
- package/dist/assets/{notice-card-C9PFAR67.js → notice-card-DDVM6IFQ.js} +1 -1
- package/dist/assets/play-kSfmJAme.js +1 -0
- package/dist/assets/plus-BNaF7Wq5.js +1 -0
- package/dist/assets/{popover-B8msg2FQ.js → popover-Dliq2K8O.js} +1 -1
- package/dist/assets/{provider-scoped-model-input-DeAo2Y65.js → provider-scoped-model-input-D0oXIrWA.js} +1 -1
- package/dist/assets/{providers-list-5_VShcn7.js → providers-list-CrwTWzge.js} +1 -1
- package/dist/assets/{refresh-ccw-CeG203yU.js → refresh-ccw-pX3BUxPF.js} +1 -1
- package/dist/assets/remote-BpAw88FR.js +1 -0
- package/dist/assets/{rotate-cw-F7aThvYj.js → rotate-cw-Bm8W8iaF.js} +1 -1
- package/dist/assets/{runtime-config-page-BuWmH7fe.js → runtime-config-page-CYZyCr04.js} +1 -1
- package/dist/assets/{save-7ztImRj7.js → save-CZ9zvmBJ.js} +1 -1
- package/dist/assets/{search-DZSNKEGp.js → search-DpxqxcpP.js} +1 -1
- package/dist/assets/{search-config-DJTm9Fno.js → search-config-D_H6cr07.js} +1 -1
- package/dist/assets/{secrets-config-DKFeFii1.js → secrets-config-BG9fic_R.js} +1 -1
- package/dist/assets/{select-DRDejPLk.js → select-D-gjRjhr.js} +1 -1
- package/dist/assets/{sessions-config-page-DZrdd2zT.js → sessions-config-page-DzSOCrQt.js} +1 -1
- package/dist/assets/{setting-row-BcF6eTW0.js → setting-row-Cl4_XpIR.js} +1 -1
- package/dist/assets/{settings-DjvNMJde.js → settings-C9WgQdGW.js} +1 -1
- package/dist/assets/skeleton-BN6fOana.js +1 -0
- package/dist/assets/{sparkles-CyDTgTM4.js → sparkles-gvRilA9f.js} +1 -1
- package/dist/assets/{status-dot-aQU9Mia4.js → status-dot-W2TPs1Zf.js} +1 -1
- package/dist/assets/{tabs-custom-C4P7g4vR.js → tabs-custom-BxZfWeD1.js} +1 -1
- package/dist/assets/{tag-chip-CVIqyMv7.js → tag-chip-DfmhmN50.js} +1 -1
- package/dist/assets/{theme-provider-dHqcWU-j.js → theme-provider-CajCgE_N.js} +1 -1
- package/dist/assets/{tooltip-C6VPreZ7.js → tooltip-C1XVx_h1.js} +1 -1
- package/dist/assets/{trash-2-C1cdqL6V.js → trash-2-WC4Dlakj.js} +1 -1
- package/dist/assets/{use-config-DFja1sda.js → use-config-BIErdQNR.js} +1 -1
- package/dist/assets/{use-confirm-dialog-DvIbSUX3.js → use-confirm-dialog-B3ZsM4V-.js} +1 -1
- package/dist/assets/{use-infinite-scroll-loader-D8h0k-iL.js → use-infinite-scroll-loader-rO55YHGO.js} +1 -1
- package/dist/assets/{use-viewport-layout-D-pjxsyz.js → use-viewport-layout-zLAsjh3A.js} +1 -1
- package/dist/assets/x-D1867E7F.js +1 -0
- package/dist/index.html +39 -39
- package/package.json +3 -3
- package/src/features/chat/components/chat-session-type-option-item.test.tsx +16 -0
- package/src/features/chat/components/chat-session-type-option-item.tsx +4 -1
- package/src/features/chat/components/chat-sidebar-session-item.tsx +22 -24
- package/src/features/chat/components/conversation/chat-conversation-panel.test.tsx +18 -1
- package/src/features/chat/components/conversation/chat-conversation-panel.tsx +2 -1
- package/src/features/chat/components/layout/chat-sidebar.test.tsx +45 -1
- package/src/features/chat/components/layout/chat-sidebar.tsx +36 -45
- package/src/features/chat/managers/ncp-chat-input.manager.test.ts +29 -0
- package/src/features/chat/utils/chat-input-bar.utils.test.ts +27 -1
- package/src/features/chat/utils/chat-input-toolbar.utils.ts +20 -19
- package/src/features/chat/utils/ncp-chat-input-availability.utils.test.ts +35 -3
- package/src/features/chat/utils/ncp-chat-input-availability.utils.ts +4 -6
- package/src/shared/lib/i18n/chat.ts +1 -1
- package/dist/assets/chat-DCi1-y8U.js +0 -58
- package/dist/assets/doc-browser-DYKpRqe-.js +0 -1
- package/dist/assets/i18n-BnNAQpVM.js +0 -1
- package/dist/assets/index-mRmSAB-e.css +0 -1
- package/dist/assets/loader-circle-C6gg2m2a.js +0 -1
- package/dist/assets/marketplace-page-0sEdt5sA.js +0 -1
- package/dist/assets/mcp-marketplace-page-B8vmu9xe.js +0 -1
- package/dist/assets/message-square-CLVODA23.js +0 -1
- package/dist/assets/play-DeNVUA5C.js +0 -1
- package/dist/assets/plus-BptLViq1.js +0 -1
- package/dist/assets/remote-pzp4oLcL.js +0 -1
- package/dist/assets/skeleton-5Mg6vZHN.js +0 -1
- package/dist/assets/x-BjMO7v8q.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,i as t,m as n,p as r,u as i}from"./i18n-BnNAQpVM.js";import{At as a,Ct as o,Pt as s,St as c,Tt as l,bt as u,gt as d,wt as ee,xt as te,yt as ne}from"./api-C51456xV.js";import{r as re}from"./chunk-JZWAC4HX-ptDyT_1C.js";import{t as f}from"./createLucideIcon-C_GFKVuW.js";import{i as p,n as m,t as h}from"./select-DRDejPLk.js";import{t as g}from"./x-BjMO7v8q.js";import{t as _}from"./use-config-DFja1sda.js";import{n as v,r as ie,t as ae}from"./popover-B8msg2FQ.js";var oe=f(`AlarmClock`,[[`circle`,{cx:`12`,cy:`13`,r:`8`,key:`3y4lt7`}],[`path`,{d:`M12 9v4l2 2`,key:`1c63tq`}],[`path`,{d:`M5 3 2 6`,key:`18tl5t`}],[`path`,{d:`m22 6-3-3`,key:`1opdir`}],[`path`,{d:`M6.38 18.7 4 21`,key:`17xu3x`}],[`path`,{d:`M17.64 18.67 20 21`,key:`kv2oe2`}]]),se=f(`Bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),ce=f(`BrainCircuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),y=f(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),le=f(`Languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),ue=f(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),de=f(`Palette`,[[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`path`,{d:`M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z`,key:`12rzf8`}]]),b=f(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),fe=f(`Smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),pe=f(`Wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]),x=`nextclaw.ui.theme`,me=[{value:`warm`,labelKey:`themeWarm`},{value:`cool`,labelKey:`themeCool`}],S=`warm`,C=!1,w=new Set;function T(e){return e===`warm`||e===`cool`}function E(e){typeof document>`u`||document.documentElement.setAttribute(`data-theme`,e)}function D(){if(typeof window>`u`)return`warm`;try{let e=window.localStorage.getItem(x);if(T(e))return e}catch{}return`warm`}function O(){return C||=(S=D(),E(S),!0),S}function k(){return C?S:O()}function A(e){if(O(),e!==S){if(S=e,E(S),typeof window<`u`)try{window.localStorage.setItem(x,S)}catch{}w.forEach(e=>e(S))}}function j(e){return w.add(e),()=>{w.delete(e)}}var M=r(),N={healthy:`bg-emerald-500 shadow-[0_0_0_3px_rgba(16,185,129,0.14)]`,attention:`bg-amber-400 shadow-[0_0_0_3px_rgba(251,191,36,0.16)]`,inactive:`bg-gray-300 shadow-[0_0_0_3px_rgba(156,163,175,0.12)]`};function P(){let e=d(),n=e.actionLabel===t(`runtimeStatusRestartAction`),r=async()=>{if(n)try{let e=await ne.runRuntimeControlAction(`restart-service`);s.success(e.message)}catch(e){let n=e instanceof Error?e.message:t(`runtimeControlActionFailed`);s.error(`${t(`runtimeControlActionFailed`)}: ${n}`)}};return(0,M.jsxs)(ae,{children:[(0,M.jsx)(ie,{asChild:!0,children:(0,M.jsx)(`button`,{type:`button`,className:`inline-flex items-center justify-center rounded-full p-0.5 transition-transform hover:scale-105`,"aria-label":e.title,title:e.title,"data-testid":`runtime-status-entry`,children:(0,M.jsx)(`span`,{className:i(`h-2.5 w-2.5 rounded-full`,N[e.tone])})})}),(0,M.jsxs)(v,{align:`start`,sideOffset:10,className:`w-[290px] space-y-3 rounded-2xl border border-gray-200 bg-white p-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)(`div`,{className:`text-sm font-semibold text-gray-900`,children:e.title}),(0,M.jsx)(`p`,{className:`text-xs leading-5 text-gray-600`,children:e.description})]}),e.reasonLines.length>0?(0,M.jsx)(`div`,{className:`space-y-2`,children:e.reasonLines.map(e=>(0,M.jsx)(`div`,{className:`rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-5 text-amber-900`,children:e},e))}):null,e.actionLabel?(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-t border-gray-100 pt-1`,children:[(0,M.jsx)(`span`,{className:`text-[11px] text-gray-500`,children:t(`runtimeStatusActionHint`)}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>void r(),disabled:e.isBusy,className:`text-sm font-semibold text-sky-600 transition-colors hover:text-sky-700 disabled:text-gray-400`,children:e.isBusy?t(`runtimeStatusRestartingAction`):e.actionLabel})]}):null]})]})}function F({className:e,suffix:t}){let{data:n}=_(),r=n?.name??`NextClaw`,i=n?.productVersion?.trim(),a=t??(0,M.jsx)(P,{});return(0,M.jsxs)(`div`,{className:e??`flex items-center gap-2.5`,children:[(0,M.jsx)(`div`,{className:`h-7 w-7 rounded-lg overflow-hidden flex items-center justify-center`,children:(0,M.jsx)(`img`,{src:`/logo.svg`,alt:r,className:`h-full w-full object-contain`})}),(0,M.jsxs)(`div`,{className:`flex items-baseline gap-2 min-w-0`,children:[(0,M.jsx)(`span`,{className:`truncate text-[15px] font-semibold tracking-[-0.01em] text-gray-800`,children:r}),i?(0,M.jsxs)(`span`,{className:`text-[13px] font-medium text-gray-500`,children:[`v`,i]}):null,a?(0,M.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:a}):null]})]})}var I={default:{row:`gap-3 px-3 py-2.5 text-[14px]`,icon:`h-[17px] w-[17px]`,value:`text-xs`,gap:`gap-3`},compact:{row:`gap-2.5 px-3 py-2 text-[13px]`,icon:`h-4 w-4`,value:`text-[11px]`,gap:`gap-2.5`}};function L(e){return I[e]}function R({to:e,label:t,icon:n,density:r=`default`,className:a}){let o=L(r);return(0,M.jsx)(re,{to:e,className:({isActive:e})=>i(`group flex w-full items-center rounded-xl font-medium transition-colors duration-base`,o.row,e?`bg-gray-200 text-gray-900 shadow-sm`:`text-gray-600 hover:bg-gray-200/60 hover:text-gray-900`,a),children:({isActive:e})=>(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(n,{className:i(o.icon,`transition-colors`,e?`text-gray-900`:`text-gray-500 group-hover:text-gray-800`)}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:t})]})})}function z({label:e,icon:t,onClick:n,density:r=`default`,className:a,labelClassName:o,trailing:s,trailingClassName:c,testId:l,trailingTestId:u}){let d=L(r);return(0,M.jsxs)(`button`,{type:`button`,onClick:n,className:i(`flex w-full items-center rounded-xl font-medium text-gray-600 transition-all duration-base hover:bg-gray-200/60 hover:text-gray-800`,d.row,a),"data-testid":l,children:[(0,M.jsx)(t,{className:i(d.icon,`shrink-0 text-gray-400`)}),(0,M.jsx)(`span`,{className:i(`min-w-0 flex-1 text-left`,o),children:e}),s?(0,M.jsx)(`span`,{className:i(`shrink-0 text-gray-500`,d.value,c),"data-testid":u,children:s}):null]})}function he({label:e,icon:t,value:n,valueLabel:r,onValueChange:a,density:o=`default`,children:s}){let c=L(o);return(0,M.jsxs)(h,{value:n,onValueChange:a,children:[(0,M.jsxs)(p,{className:i(`h-auto w-full rounded-xl border-0 bg-transparent font-medium text-gray-600 shadow-none hover:bg-gray-200/60 focus:ring-0`,c.row),children:[(0,M.jsxs)(`div`,{className:i(`flex min-w-0 items-center`,c.gap),children:[(0,M.jsx)(t,{className:i(c.icon,`text-gray-400`)}),(0,M.jsx)(`span`,{className:`text-left`,children:e})]}),(0,M.jsx)(`span`,{className:i(`ml-auto text-gray-500`,c.value),children:r})]}),(0,M.jsx)(m,{children:s})]})}var B=`nextclaw-pwa-install-banner-dismissed`,V=`nextclaw-pwa-install-banner-dismissed-until`;function H(){let e=W();return e?e.getItem(`nextclaw-pwa-install-banner-dismissed`)===`1`?!0:_e(e):!1}function ge(){let e=W();e?.setItem(B,`1`),e?.removeItem(V)}function U(){let e=W();e?.removeItem(B),e?.removeItem(V)}function W(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function _e(e){let t=e.getItem(V);if(!t)return!1;let n=Number.parseInt(t,10);return e.removeItem(V),!Number.isFinite(n)||n<=Date.now()?!1:(e.setItem(B,`1`),!0)}function G(){return{initialized:!1,installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`,dismissedInstallPrompt:H(),updateAvailable:!1,registrationFailed:!1}}var K=u(()=>G()),q=`nextclaw-pwa-dev-sw-reset`,J=new class{constructor(){this.started=!1,this.registration=null,this.reloadWhenControllerChanges=!1,this.start=async()=>{if(!(this.started||typeof window>`u`)&&(this.started=!0,!(!(`serviceWorker`in navigator)||!this.isEligibleInstallContext()))){if(this.isDevelopmentServer()){await this.cleanupDevelopmentRegistrations();return}try{let e=await navigator.serviceWorker.register(`/sw.js`);this.registration=e,this.bindRegistration(e),navigator.serviceWorker.addEventListener(`controllerchange`,this.handleControllerChange),await this.syncUpdateAvailability()}catch{K.setState({registrationFailed:!0})}}},this.syncUpdateAvailability=async()=>{if(typeof window>`u`||!(`serviceWorker`in navigator)||typeof navigator.serviceWorker.getRegistration!=`function`){K.setState({updateAvailable:!1});return}let e=this.registration??await navigator.serviceWorker.getRegistration(`/sw.js`)??null;K.setState({updateAvailable:this.shouldSurfaceUpdate(e)})},this.applyUpdate=async()=>{let e=this.registration??await navigator.serviceWorker.getRegistration(`/sw.js`)??null;if(!e){window.location.reload();return}e.waiting||await e.update();let t=e.waiting;if(!t){window.location.reload();return}this.reloadWhenControllerChanges=!0,t.postMessage({type:`SKIP_WAIT`})},this.stop=()=>{!this.started||typeof window>`u`||!(`serviceWorker`in navigator)||(navigator.serviceWorker.removeEventListener(`controllerchange`,this.handleControllerChange),this.started=!1,this.registration=null,this.reloadWhenControllerChanges=!1)},this.bindRegistration=e=>{e.addEventListener(`updatefound`,()=>{let t=e.installing;t&&t.addEventListener(`statechange`,()=>{t.state===`installed`&&this.syncUpdateAvailability()})})},this.handleControllerChange=()=>{this.reloadWhenControllerChanges&&(this.reloadWhenControllerChanges=!1,window.location.reload())},this.isEligibleInstallContext=()=>window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>!1,this.shouldSurfaceUpdate=e=>!e?.waiting||!navigator.serviceWorker.controller?!1:K.getState().installability===`installed`,this.cleanupDevelopmentRegistrations=async()=>{if(typeof navigator.serviceWorker.getRegistrations!=`function`)return;let e=(await navigator.serviceWorker.getRegistrations()).filter(e=>[e.active?.scriptURL,e.installing?.scriptURL,e.waiting?.scriptURL].filter(e=>!!e).some(e=>e.endsWith(`/sw.js`)));if(e.length===0){this.clearDevResetMarker();return}if(await Promise.all(e.map(async e=>await e.unregister())),await this.clearNextClawCaches(),navigator.serviceWorker.controller&&!this.hasDevResetMarker()){this.setDevResetMarker(),window.location.reload();return}this.clearDevResetMarker()},this.clearNextClawCaches=async()=>{if(typeof window>`u`||!(`caches`in window)||typeof caches.keys!=`function`)return;let e=await caches.keys();await Promise.all(e.filter(e=>e.startsWith(`nextclaw-ui-`)).map(async e=>await caches.delete(e)))},this.hasDevResetMarker=()=>{try{return window.sessionStorage.getItem(q)===`1`}catch{return!1}},this.setDevResetMarker=()=>{try{window.sessionStorage.setItem(q,`1`)}catch{}},this.clearDevResetMarker=()=>{try{window.sessionStorage.removeItem(q)}catch{}}}},Y=new class{constructor(){this.started=!1,this.deferredPrompt=null,this.displayModeMediaQuery=null,this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.addEventListener(`appinstalled`,this.handleAppInstalled),typeof window.matchMedia==`function`&&(this.displayModeMediaQuery=window.matchMedia(`(display-mode: standalone)`),this.bindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged)),this.refreshState())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.removeEventListener(`appinstalled`,this.handleAppInstalled),this.displayModeMediaQuery&&=(this.unbindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged),null),this.deferredPrompt=null,this.started=!1)},this.resetForTests=()=>{this.stop(),K.setState(G())},this.refreshState=()=>{let e=this.resolveInstallability();K.setState(t=>({...t,initialized:!0,installability:e.installability,installMethod:e.installMethod,blockedReason:e.blockedReason,dismissedInstallPrompt:H()})),J.syncUpdateAvailability()},this.dismissInstallPrompt=()=>{ge(),K.setState({dismissedInstallPrompt:!0})},this.promptInstall=async()=>{let e=this.resolveInstallability();if(e.installability!==`available`)return`unavailable`;if(e.installMethod===`manual`||!this.deferredPrompt)return`manual`;this.deferredPrompt.prompt();let n=await this.deferredPrompt.userChoice;return this.deferredPrompt=null,n.outcome===`accepted`?(U(),this.refreshState(),s.success(t(`pwaInstallAccepted`)),`accepted`):(this.dismissInstallPrompt(),this.refreshState(),`dismissed`)},this.handleBeforeInstallPrompt=e=>{e.preventDefault(),this.deferredPrompt=e,this.refreshState()},this.handleAppInstalled=()=>{this.deferredPrompt=null,U(),K.setState({dismissedInstallPrompt:!0}),s.success(t(`pwaInstalledToast`)),this.refreshState()},this.handleDisplayModeChanged=()=>{this.refreshState()},this.resolveInstallability=()=>this.isDevelopmentServer()?{installability:`unsupported`,installMethod:`none`,blockedReason:`dev-server`}:this.hasDesktopHost()?{installability:`suppressed`,installMethod:`none`,blockedReason:`desktop-host`}:this.isStandalone()?{installability:`installed`,installMethod:`none`,blockedReason:null}:this.hasInstallSurfaceSupport()?this.isEligibleInstallContext()?{installability:`available`,installMethod:this.deferredPrompt?`prompt`:`manual`,blockedReason:null}:{installability:`unsupported`,installMethod:`none`,blockedReason:`insecure-context`}:{installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`},this.hasDesktopHost=()=>typeof window<`u`&&!!window.nextclawDesktop,this.hasInstallSurfaceSupport=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&`serviceWorker`in navigator,this.isEligibleInstallContext=()=>typeof window>`u`?!1:window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>typeof window<`u`&&!1,this.isStandalone=()=>{if(typeof window>`u`)return!1;let e=window.navigator;return typeof window.matchMedia==`function`&&window.matchMedia(`(display-mode: standalone)`).matches||e.standalone===!0},this.bindDisplayModeListener=(e,t)=>{if(`addEventListener`in e){e.addEventListener(`change`,t);return}e.addListener?.(t)},this.unbindDisplayModeListener=(e,t)=>{if(`removeEventListener`in e){e.removeEventListener(`change`,t);return}e.removeListener?.(t)}}};function ve(){let e=K(e=>e.installability);return(0,M.jsx)(`span`,{className:i(`inline-flex items-center rounded-full border px-3 py-1 text-xs font-medium`,e===`installed`?`bg-emerald-50 text-emerald-700 border-emerald-200`:e===`available`?`bg-amber-50 text-amber-700 border-amber-200`:`bg-gray-100 text-gray-600 border-gray-200`),children:ye(e)})}function ye(e){return t(e===`available`?`pwaInstallStatusAvailable`:e===`installed`?`pwaInstallStatusInstalled`:e===`suppressed`?`pwaInstallStatusDesktopHost`:`pwaInstallStatusUnavailable`)}function be(e,n,r){return t(e===`installed`?`pwaInstallCardInstalled`:e===`suppressed`?`pwaInstallCardSuppressed`:e===`available`&&n===`prompt`?`pwaInstallCardPrompt`:e===`available`?`pwaInstallCardManual`:r===`insecure-context`?`pwaInstallCardInsecureContext`:r===`dev-server`?`pwaInstallCardDevServer`:`pwaInstallCardUnsupported`)}function xe(){let e=K(e=>e.installability),n=K(e=>e.installMethod),r=K(e=>e.blockedReason);return(0,M.jsxs)(te,{children:[(0,M.jsxs)(ee,{className:`flex flex-row items-start justify-between gap-4 space-y-0`,children:[(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(l,{children:t(`pwaInstallTitle`)}),(0,M.jsx)(o,{children:t(`pwaInstallDescription`)})]}),(0,M.jsx)(ve,{})]}),(0,M.jsxs)(c,{className:`space-y-4`,children:[(0,M.jsx)(`div`,{className:`rounded-2xl border border-gray-200 bg-gray-50/90 p-4`,children:(0,M.jsx)(`p`,{className:`text-sm leading-6 text-gray-700`,children:be(e,n,r)})}),e===`available`&&n===`prompt`?(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,M.jsxs)(a,{type:`button`,className:`gap-2`,onClick:()=>{Y.promptInstall()},children:[(0,M.jsx)(y,{className:`h-4 w-4`}),t(`pwaInstallAction`)]}),(0,M.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`pwaInstallPromptHint`)})]}):null,e===`available`&&n===`manual`?(0,M.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl border border-dashed border-gray-300 bg-white p-4`,children:[(0,M.jsx)(fe,{className:`mt-0.5 h-4 w-4 text-gray-500`}),(0,M.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:t(`pwaInstallManualHint`)})]}):null]})]})}function Se(){let e=K(e=>e.installability),n=K(e=>e.installMethod),r=K(e=>e.dismissedInstallPrompt);return e!==`available`||n!==`prompt`||r?null:(0,M.jsxs)(`div`,{className:`fixed bottom-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,M.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:t(`pwaInstallBannerTitle`)}),(0,M.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:t(`pwaInstallBannerDescription`)})]}),(0,M.jsx)(`button`,{type:`button`,"aria-label":t(`pwaInstallDismiss`),className:`rounded-full p-1 text-gray-400 transition hover:bg-gray-100 hover:text-gray-600`,onClick:()=>{Y.dismissInstallPrompt()},children:(0,M.jsx)(g,{className:`h-4 w-4`})})]}),(0,M.jsxs)(`div`,{className:`mt-4 flex items-center gap-3`,children:[(0,M.jsxs)(a,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{Y.promptInstall()},children:[(0,M.jsx)(y,{className:`h-4 w-4`}),t(`pwaInstallAction`)]}),(0,M.jsx)(a,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{Y.dismissInstallPrompt()},children:t(`pwaInstallDismiss`)})]})]})}function Ce(){let e=K(e=>e.updateAvailable),n=K(e=>e.installability);return!e||n!==`installed`?null:(0,M.jsxs)(`div`,{className:`fixed top-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,M.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:t(`pwaUpdateBannerTitle`)}),(0,M.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:t(`pwaUpdateBannerDescription`)})]})}),(0,M.jsx)(`div`,{className:`mt-4`,children:(0,M.jsxs)(a,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{J.applyUpdate()},children:[(0,M.jsx)(b,{className:`h-4 w-4`}),t(`pwaUpdateAction`)]})})]})}var X=!1;function we(){X||typeof window>`u`||(X=!0,Y.start(),J.start())}var Te={warm:`#F9F8F5`,cool:`#F8FAFB`},Z=new class{constructor(){this.syncTheme=e=>{if(typeof document>`u`)return;let t=Te[e];this.updateThemeMeta(t),this.updateSurfaceBackgrounds(t),document.documentElement.style.colorScheme=`light`},this.syncCurrentTheme=()=>{if(typeof document>`u`)return;let e=document.documentElement.getAttribute(`data-theme`)===`cool`?`cool`:`warm`;this.syncTheme(e)},this.updateThemeMeta=e=>{let t=document.querySelector(`meta[name="theme-color"]`);t instanceof HTMLMetaElement&&(t.content=e)},this.updateSurfaceBackgrounds=e=>{document.documentElement.style.backgroundColor=e,document.body.style.backgroundColor=e;let t=document.getElementById(`root`);t&&(t.style.backgroundColor=e)}}},Q=e(n(),1),$=(0,Q.createContext)(null);function Ee({children:e}){let[t,n]=(0,Q.useState)(()=>O());(0,Q.useEffect)(()=>{Z.syncTheme(t)},[t]),(0,Q.useEffect)(()=>j(e=>{n(e)}),[]);let r=(0,Q.useCallback)(e=>{A(e),n(k())},[]),i=(0,Q.useMemo)(()=>({theme:t,setTheme:r}),[t,r]);return(0,M.jsx)($.Provider,{value:i,children:e})}function De(){let e=(0,Q.useContext)($);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}export{y as _,xe as a,oe as b,R as c,me as d,pe as f,le as g,ue as h,Se as i,he as l,de as m,De as n,Ce as o,b as p,we as r,z as s,Ee as t,F as u,ce as v,se as y};
|
|
1
|
+
import{_ as e,i as t,m as n,p as r,u as i}from"./i18n-BhoFaF7E.js";import{At as a,Ct as o,Pt as s,St as c,Tt as l,bt as u,gt as d,wt as ee,xt as te,yt as ne}from"./api-HsS9C7l0.js";import{r as re}from"./chunk-JZWAC4HX-CMPxE3BJ.js";import{t as f}from"./createLucideIcon-Y1cWg3R9.js";import{i as p,n as m,t as h}from"./select-D-gjRjhr.js";import{t as g}from"./x-D1867E7F.js";import{t as _}from"./use-config-BIErdQNR.js";import{n as v,r as ie,t as ae}from"./popover-Dliq2K8O.js";var oe=f(`AlarmClock`,[[`circle`,{cx:`12`,cy:`13`,r:`8`,key:`3y4lt7`}],[`path`,{d:`M12 9v4l2 2`,key:`1c63tq`}],[`path`,{d:`M5 3 2 6`,key:`18tl5t`}],[`path`,{d:`m22 6-3-3`,key:`1opdir`}],[`path`,{d:`M6.38 18.7 4 21`,key:`17xu3x`}],[`path`,{d:`M17.64 18.67 20 21`,key:`kv2oe2`}]]),se=f(`Bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),ce=f(`BrainCircuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),y=f(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),le=f(`Languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),ue=f(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),de=f(`Palette`,[[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`path`,{d:`M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z`,key:`12rzf8`}]]),b=f(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),fe=f(`Smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),pe=f(`Wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]),x=`nextclaw.ui.theme`,me=[{value:`warm`,labelKey:`themeWarm`},{value:`cool`,labelKey:`themeCool`}],S=`warm`,C=!1,w=new Set;function T(e){return e===`warm`||e===`cool`}function E(e){typeof document>`u`||document.documentElement.setAttribute(`data-theme`,e)}function D(){if(typeof window>`u`)return`warm`;try{let e=window.localStorage.getItem(x);if(T(e))return e}catch{}return`warm`}function O(){return C||=(S=D(),E(S),!0),S}function k(){return C?S:O()}function A(e){if(O(),e!==S){if(S=e,E(S),typeof window<`u`)try{window.localStorage.setItem(x,S)}catch{}w.forEach(e=>e(S))}}function j(e){return w.add(e),()=>{w.delete(e)}}var M=r(),N={healthy:`bg-emerald-500 shadow-[0_0_0_3px_rgba(16,185,129,0.14)]`,attention:`bg-amber-400 shadow-[0_0_0_3px_rgba(251,191,36,0.16)]`,inactive:`bg-gray-300 shadow-[0_0_0_3px_rgba(156,163,175,0.12)]`};function P(){let e=d(),n=e.actionLabel===t(`runtimeStatusRestartAction`),r=async()=>{if(n)try{let e=await ne.runRuntimeControlAction(`restart-service`);s.success(e.message)}catch(e){let n=e instanceof Error?e.message:t(`runtimeControlActionFailed`);s.error(`${t(`runtimeControlActionFailed`)}: ${n}`)}};return(0,M.jsxs)(ae,{children:[(0,M.jsx)(ie,{asChild:!0,children:(0,M.jsx)(`button`,{type:`button`,className:`inline-flex items-center justify-center rounded-full p-0.5 transition-transform hover:scale-105`,"aria-label":e.title,title:e.title,"data-testid":`runtime-status-entry`,children:(0,M.jsx)(`span`,{className:i(`h-2.5 w-2.5 rounded-full`,N[e.tone])})})}),(0,M.jsxs)(v,{align:`start`,sideOffset:10,className:`w-[290px] space-y-3 rounded-2xl border border-gray-200 bg-white p-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)(`div`,{className:`text-sm font-semibold text-gray-900`,children:e.title}),(0,M.jsx)(`p`,{className:`text-xs leading-5 text-gray-600`,children:e.description})]}),e.reasonLines.length>0?(0,M.jsx)(`div`,{className:`space-y-2`,children:e.reasonLines.map(e=>(0,M.jsx)(`div`,{className:`rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-5 text-amber-900`,children:e},e))}):null,e.actionLabel?(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-t border-gray-100 pt-1`,children:[(0,M.jsx)(`span`,{className:`text-[11px] text-gray-500`,children:t(`runtimeStatusActionHint`)}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>void r(),disabled:e.isBusy,className:`text-sm font-semibold text-sky-600 transition-colors hover:text-sky-700 disabled:text-gray-400`,children:e.isBusy?t(`runtimeStatusRestartingAction`):e.actionLabel})]}):null]})]})}function F({className:e,suffix:t}){let{data:n}=_(),r=n?.name??`NextClaw`,i=n?.productVersion?.trim(),a=t??(0,M.jsx)(P,{});return(0,M.jsxs)(`div`,{className:e??`flex items-center gap-2.5`,children:[(0,M.jsx)(`div`,{className:`h-7 w-7 rounded-lg overflow-hidden flex items-center justify-center`,children:(0,M.jsx)(`img`,{src:`/logo.svg`,alt:r,className:`h-full w-full object-contain`})}),(0,M.jsxs)(`div`,{className:`flex items-baseline gap-2 min-w-0`,children:[(0,M.jsx)(`span`,{className:`truncate text-[15px] font-semibold tracking-[-0.01em] text-gray-800`,children:r}),i?(0,M.jsxs)(`span`,{className:`text-[13px] font-medium text-gray-500`,children:[`v`,i]}):null,a?(0,M.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:a}):null]})]})}var I={default:{row:`gap-3 px-3 py-2.5 text-[14px]`,icon:`h-[17px] w-[17px]`,value:`text-xs`,gap:`gap-3`},compact:{row:`gap-2.5 px-3 py-2 text-[13px]`,icon:`h-4 w-4`,value:`text-[11px]`,gap:`gap-2.5`}};function L(e){return I[e]}function R({to:e,label:t,icon:n,density:r=`default`,className:a}){let o=L(r);return(0,M.jsx)(re,{to:e,className:({isActive:e})=>i(`group flex w-full items-center rounded-xl font-medium transition-colors duration-base`,o.row,e?`bg-gray-200 text-gray-900 shadow-sm`:`text-gray-600 hover:bg-gray-200/60 hover:text-gray-900`,a),children:({isActive:e})=>(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(n,{className:i(o.icon,`transition-colors`,e?`text-gray-900`:`text-gray-500 group-hover:text-gray-800`)}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:t})]})})}function z({label:e,icon:t,onClick:n,density:r=`default`,className:a,labelClassName:o,trailing:s,trailingClassName:c,testId:l,trailingTestId:u}){let d=L(r);return(0,M.jsxs)(`button`,{type:`button`,onClick:n,className:i(`flex w-full items-center rounded-xl font-medium text-gray-600 transition-all duration-base hover:bg-gray-200/60 hover:text-gray-800`,d.row,a),"data-testid":l,children:[(0,M.jsx)(t,{className:i(d.icon,`shrink-0 text-gray-400`)}),(0,M.jsx)(`span`,{className:i(`min-w-0 flex-1 text-left`,o),children:e}),s?(0,M.jsx)(`span`,{className:i(`shrink-0 text-gray-500`,d.value,c),"data-testid":u,children:s}):null]})}function he({label:e,icon:t,value:n,valueLabel:r,onValueChange:a,density:o=`default`,children:s}){let c=L(o);return(0,M.jsxs)(h,{value:n,onValueChange:a,children:[(0,M.jsxs)(p,{className:i(`h-auto w-full rounded-xl border-0 bg-transparent font-medium text-gray-600 shadow-none hover:bg-gray-200/60 focus:ring-0`,c.row),children:[(0,M.jsxs)(`div`,{className:i(`flex min-w-0 items-center`,c.gap),children:[(0,M.jsx)(t,{className:i(c.icon,`text-gray-400`)}),(0,M.jsx)(`span`,{className:`text-left`,children:e})]}),(0,M.jsx)(`span`,{className:i(`ml-auto text-gray-500`,c.value),children:r})]}),(0,M.jsx)(m,{children:s})]})}var B=`nextclaw-pwa-install-banner-dismissed`,V=`nextclaw-pwa-install-banner-dismissed-until`;function H(){let e=W();return e?e.getItem(`nextclaw-pwa-install-banner-dismissed`)===`1`?!0:_e(e):!1}function ge(){let e=W();e?.setItem(B,`1`),e?.removeItem(V)}function U(){let e=W();e?.removeItem(B),e?.removeItem(V)}function W(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function _e(e){let t=e.getItem(V);if(!t)return!1;let n=Number.parseInt(t,10);return e.removeItem(V),!Number.isFinite(n)||n<=Date.now()?!1:(e.setItem(B,`1`),!0)}function G(){return{initialized:!1,installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`,dismissedInstallPrompt:H(),updateAvailable:!1,registrationFailed:!1}}var K=u(()=>G()),q=`nextclaw-pwa-dev-sw-reset`,J=new class{constructor(){this.started=!1,this.registration=null,this.reloadWhenControllerChanges=!1,this.start=async()=>{if(!(this.started||typeof window>`u`)&&(this.started=!0,!(!(`serviceWorker`in navigator)||!this.isEligibleInstallContext()))){if(this.isDevelopmentServer()){await this.cleanupDevelopmentRegistrations();return}try{let e=await navigator.serviceWorker.register(`/sw.js`);this.registration=e,this.bindRegistration(e),navigator.serviceWorker.addEventListener(`controllerchange`,this.handleControllerChange),await this.syncUpdateAvailability()}catch{K.setState({registrationFailed:!0})}}},this.syncUpdateAvailability=async()=>{if(typeof window>`u`||!(`serviceWorker`in navigator)||typeof navigator.serviceWorker.getRegistration!=`function`){K.setState({updateAvailable:!1});return}let e=this.registration??await navigator.serviceWorker.getRegistration(`/sw.js`)??null;K.setState({updateAvailable:this.shouldSurfaceUpdate(e)})},this.applyUpdate=async()=>{let e=this.registration??await navigator.serviceWorker.getRegistration(`/sw.js`)??null;if(!e){window.location.reload();return}e.waiting||await e.update();let t=e.waiting;if(!t){window.location.reload();return}this.reloadWhenControllerChanges=!0,t.postMessage({type:`SKIP_WAIT`})},this.stop=()=>{!this.started||typeof window>`u`||!(`serviceWorker`in navigator)||(navigator.serviceWorker.removeEventListener(`controllerchange`,this.handleControllerChange),this.started=!1,this.registration=null,this.reloadWhenControllerChanges=!1)},this.bindRegistration=e=>{e.addEventListener(`updatefound`,()=>{let t=e.installing;t&&t.addEventListener(`statechange`,()=>{t.state===`installed`&&this.syncUpdateAvailability()})})},this.handleControllerChange=()=>{this.reloadWhenControllerChanges&&(this.reloadWhenControllerChanges=!1,window.location.reload())},this.isEligibleInstallContext=()=>window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>!1,this.shouldSurfaceUpdate=e=>!e?.waiting||!navigator.serviceWorker.controller?!1:K.getState().installability===`installed`,this.cleanupDevelopmentRegistrations=async()=>{if(typeof navigator.serviceWorker.getRegistrations!=`function`)return;let e=(await navigator.serviceWorker.getRegistrations()).filter(e=>[e.active?.scriptURL,e.installing?.scriptURL,e.waiting?.scriptURL].filter(e=>!!e).some(e=>e.endsWith(`/sw.js`)));if(e.length===0){this.clearDevResetMarker();return}if(await Promise.all(e.map(async e=>await e.unregister())),await this.clearNextClawCaches(),navigator.serviceWorker.controller&&!this.hasDevResetMarker()){this.setDevResetMarker(),window.location.reload();return}this.clearDevResetMarker()},this.clearNextClawCaches=async()=>{if(typeof window>`u`||!(`caches`in window)||typeof caches.keys!=`function`)return;let e=await caches.keys();await Promise.all(e.filter(e=>e.startsWith(`nextclaw-ui-`)).map(async e=>await caches.delete(e)))},this.hasDevResetMarker=()=>{try{return window.sessionStorage.getItem(q)===`1`}catch{return!1}},this.setDevResetMarker=()=>{try{window.sessionStorage.setItem(q,`1`)}catch{}},this.clearDevResetMarker=()=>{try{window.sessionStorage.removeItem(q)}catch{}}}},Y=new class{constructor(){this.started=!1,this.deferredPrompt=null,this.displayModeMediaQuery=null,this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.addEventListener(`appinstalled`,this.handleAppInstalled),typeof window.matchMedia==`function`&&(this.displayModeMediaQuery=window.matchMedia(`(display-mode: standalone)`),this.bindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged)),this.refreshState())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.removeEventListener(`appinstalled`,this.handleAppInstalled),this.displayModeMediaQuery&&=(this.unbindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged),null),this.deferredPrompt=null,this.started=!1)},this.resetForTests=()=>{this.stop(),K.setState(G())},this.refreshState=()=>{let e=this.resolveInstallability();K.setState(t=>({...t,initialized:!0,installability:e.installability,installMethod:e.installMethod,blockedReason:e.blockedReason,dismissedInstallPrompt:H()})),J.syncUpdateAvailability()},this.dismissInstallPrompt=()=>{ge(),K.setState({dismissedInstallPrompt:!0})},this.promptInstall=async()=>{let e=this.resolveInstallability();if(e.installability!==`available`)return`unavailable`;if(e.installMethod===`manual`||!this.deferredPrompt)return`manual`;this.deferredPrompt.prompt();let n=await this.deferredPrompt.userChoice;return this.deferredPrompt=null,n.outcome===`accepted`?(U(),this.refreshState(),s.success(t(`pwaInstallAccepted`)),`accepted`):(this.dismissInstallPrompt(),this.refreshState(),`dismissed`)},this.handleBeforeInstallPrompt=e=>{e.preventDefault(),this.deferredPrompt=e,this.refreshState()},this.handleAppInstalled=()=>{this.deferredPrompt=null,U(),K.setState({dismissedInstallPrompt:!0}),s.success(t(`pwaInstalledToast`)),this.refreshState()},this.handleDisplayModeChanged=()=>{this.refreshState()},this.resolveInstallability=()=>this.isDevelopmentServer()?{installability:`unsupported`,installMethod:`none`,blockedReason:`dev-server`}:this.hasDesktopHost()?{installability:`suppressed`,installMethod:`none`,blockedReason:`desktop-host`}:this.isStandalone()?{installability:`installed`,installMethod:`none`,blockedReason:null}:this.hasInstallSurfaceSupport()?this.isEligibleInstallContext()?{installability:`available`,installMethod:this.deferredPrompt?`prompt`:`manual`,blockedReason:null}:{installability:`unsupported`,installMethod:`none`,blockedReason:`insecure-context`}:{installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`},this.hasDesktopHost=()=>typeof window<`u`&&!!window.nextclawDesktop,this.hasInstallSurfaceSupport=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&`serviceWorker`in navigator,this.isEligibleInstallContext=()=>typeof window>`u`?!1:window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>typeof window<`u`&&!1,this.isStandalone=()=>{if(typeof window>`u`)return!1;let e=window.navigator;return typeof window.matchMedia==`function`&&window.matchMedia(`(display-mode: standalone)`).matches||e.standalone===!0},this.bindDisplayModeListener=(e,t)=>{if(`addEventListener`in e){e.addEventListener(`change`,t);return}e.addListener?.(t)},this.unbindDisplayModeListener=(e,t)=>{if(`removeEventListener`in e){e.removeEventListener(`change`,t);return}e.removeListener?.(t)}}};function ve(){let e=K(e=>e.installability);return(0,M.jsx)(`span`,{className:i(`inline-flex items-center rounded-full border px-3 py-1 text-xs font-medium`,e===`installed`?`bg-emerald-50 text-emerald-700 border-emerald-200`:e===`available`?`bg-amber-50 text-amber-700 border-amber-200`:`bg-gray-100 text-gray-600 border-gray-200`),children:ye(e)})}function ye(e){return t(e===`available`?`pwaInstallStatusAvailable`:e===`installed`?`pwaInstallStatusInstalled`:e===`suppressed`?`pwaInstallStatusDesktopHost`:`pwaInstallStatusUnavailable`)}function be(e,n,r){return t(e===`installed`?`pwaInstallCardInstalled`:e===`suppressed`?`pwaInstallCardSuppressed`:e===`available`&&n===`prompt`?`pwaInstallCardPrompt`:e===`available`?`pwaInstallCardManual`:r===`insecure-context`?`pwaInstallCardInsecureContext`:r===`dev-server`?`pwaInstallCardDevServer`:`pwaInstallCardUnsupported`)}function xe(){let e=K(e=>e.installability),n=K(e=>e.installMethod),r=K(e=>e.blockedReason);return(0,M.jsxs)(te,{children:[(0,M.jsxs)(ee,{className:`flex flex-row items-start justify-between gap-4 space-y-0`,children:[(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(l,{children:t(`pwaInstallTitle`)}),(0,M.jsx)(o,{children:t(`pwaInstallDescription`)})]}),(0,M.jsx)(ve,{})]}),(0,M.jsxs)(c,{className:`space-y-4`,children:[(0,M.jsx)(`div`,{className:`rounded-2xl border border-gray-200 bg-gray-50/90 p-4`,children:(0,M.jsx)(`p`,{className:`text-sm leading-6 text-gray-700`,children:be(e,n,r)})}),e===`available`&&n===`prompt`?(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,M.jsxs)(a,{type:`button`,className:`gap-2`,onClick:()=>{Y.promptInstall()},children:[(0,M.jsx)(y,{className:`h-4 w-4`}),t(`pwaInstallAction`)]}),(0,M.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`pwaInstallPromptHint`)})]}):null,e===`available`&&n===`manual`?(0,M.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl border border-dashed border-gray-300 bg-white p-4`,children:[(0,M.jsx)(fe,{className:`mt-0.5 h-4 w-4 text-gray-500`}),(0,M.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:t(`pwaInstallManualHint`)})]}):null]})]})}function Se(){let e=K(e=>e.installability),n=K(e=>e.installMethod),r=K(e=>e.dismissedInstallPrompt);return e!==`available`||n!==`prompt`||r?null:(0,M.jsxs)(`div`,{className:`fixed bottom-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,M.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:t(`pwaInstallBannerTitle`)}),(0,M.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:t(`pwaInstallBannerDescription`)})]}),(0,M.jsx)(`button`,{type:`button`,"aria-label":t(`pwaInstallDismiss`),className:`rounded-full p-1 text-gray-400 transition hover:bg-gray-100 hover:text-gray-600`,onClick:()=>{Y.dismissInstallPrompt()},children:(0,M.jsx)(g,{className:`h-4 w-4`})})]}),(0,M.jsxs)(`div`,{className:`mt-4 flex items-center gap-3`,children:[(0,M.jsxs)(a,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{Y.promptInstall()},children:[(0,M.jsx)(y,{className:`h-4 w-4`}),t(`pwaInstallAction`)]}),(0,M.jsx)(a,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{Y.dismissInstallPrompt()},children:t(`pwaInstallDismiss`)})]})]})}function Ce(){let e=K(e=>e.updateAvailable),n=K(e=>e.installability);return!e||n!==`installed`?null:(0,M.jsxs)(`div`,{className:`fixed top-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,M.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:t(`pwaUpdateBannerTitle`)}),(0,M.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:t(`pwaUpdateBannerDescription`)})]})}),(0,M.jsx)(`div`,{className:`mt-4`,children:(0,M.jsxs)(a,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{J.applyUpdate()},children:[(0,M.jsx)(b,{className:`h-4 w-4`}),t(`pwaUpdateAction`)]})})]})}var X=!1;function we(){X||typeof window>`u`||(X=!0,Y.start(),J.start())}var Te={warm:`#F9F8F5`,cool:`#F8FAFB`},Z=new class{constructor(){this.syncTheme=e=>{if(typeof document>`u`)return;let t=Te[e];this.updateThemeMeta(t),this.updateSurfaceBackgrounds(t),document.documentElement.style.colorScheme=`light`},this.syncCurrentTheme=()=>{if(typeof document>`u`)return;let e=document.documentElement.getAttribute(`data-theme`)===`cool`?`cool`:`warm`;this.syncTheme(e)},this.updateThemeMeta=e=>{let t=document.querySelector(`meta[name="theme-color"]`);t instanceof HTMLMetaElement&&(t.content=e)},this.updateSurfaceBackgrounds=e=>{document.documentElement.style.backgroundColor=e,document.body.style.backgroundColor=e;let t=document.getElementById(`root`);t&&(t.style.backgroundColor=e)}}},Q=e(n(),1),$=(0,Q.createContext)(null);function Ee({children:e}){let[t,n]=(0,Q.useState)(()=>O());(0,Q.useEffect)(()=>{Z.syncTheme(t)},[t]),(0,Q.useEffect)(()=>j(e=>{n(e)}),[]);let r=(0,Q.useCallback)(e=>{A(e),n(k())},[]),i=(0,Q.useMemo)(()=>({theme:t,setTheme:r}),[t,r]);return(0,M.jsx)($.Provider,{value:i,children:e})}function De(){let e=(0,Q.useContext)($);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}export{y as _,xe as a,oe as b,R as c,me as d,pe as f,le as g,ue as h,Se as i,he as l,de as m,De as n,Ce as o,b as p,we as r,z as s,Ee as t,F as u,ce as v,se as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,m as t,p as n,u as r}from"./i18n-
|
|
1
|
+
import{_ as e,m as t,p as n,u as r}from"./i18n-BhoFaF7E.js";import{_ as i,c as a,d as o,f as s,g as c,h as l,i as u,o as d,u as f}from"./es2015-3VnZDFPs.js";import{t as p}from"./dist-DIWOVzPY.js";import{C as m,E as h,S as g,T as _,w as v,x as y}from"./select-D-gjRjhr.js";var b=e(t(),1),x=n(),[S,C]=l(`Tooltip`,[h]),w=h(),T=`TooltipProvider`,E=700,D=`tooltip.open`,[O,k]=S(T),A=e=>{let{__scopeTooltip:t,delayDuration:n=E,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=b.useRef(!0),s=b.useRef(!1),c=b.useRef(0);return b.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,x.jsx)(O,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:b.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};A.displayName=T;var j=`Tooltip`,[ee,M]=S(j),N=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:c,delayDuration:l}=e,u=k(j,e.__scopeTooltip),d=w(t),[f,p]=b.useState(null),m=s(),h=b.useRef(0),g=c??u.disableHoverableContent,v=l??u.delayDuration,y=b.useRef(!1),[S,C]=o({prop:r,defaultProp:i??!1,onChange:e=>{e?(u.onOpen(),document.dispatchEvent(new CustomEvent(D))):u.onClose(),a?.(e)},caller:j}),T=b.useMemo(()=>S?y.current?`delayed-open`:`instant-open`:`closed`,[S]),E=b.useCallback(()=>{window.clearTimeout(h.current),h.current=0,y.current=!1,C(!0)},[C]),O=b.useCallback(()=>{window.clearTimeout(h.current),h.current=0,C(!1)},[C]),A=b.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{y.current=!0,C(!0),h.current=0},v)},[v,C]);return b.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]),(0,x.jsx)(_,{...d,children:(0,x.jsx)(ee,{scope:t,contentId:m,open:S,stateAttribute:T,trigger:f,onTriggerChange:p,onTriggerEnter:b.useCallback(()=>{u.isOpenDelayedRef.current?A():E()},[u.isOpenDelayedRef,A,E]),onTriggerLeave:b.useCallback(()=>{g?O():(window.clearTimeout(h.current),h.current=0)},[O,g]),onOpen:E,onClose:O,disableHoverableContent:g,children:n})})};N.displayName=j;var P=`TooltipTrigger`,F=b.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,o=M(P,n),s=k(P,n),l=w(n),u=c(t,b.useRef(null),o.onTriggerChange),d=b.useRef(!1),f=b.useRef(!1),p=b.useCallback(()=>d.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener(`pointerup`,p),[p]),(0,x.jsx)(g,{asChild:!0,...l,children:(0,x.jsx)(a.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:u,onPointerMove:i(e.onPointerMove,e=>{e.pointerType!==`touch`&&!f.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),f.current=!0)}),onPointerLeave:i(e.onPointerLeave,()=>{o.onTriggerLeave(),f.current=!1}),onPointerDown:i(e.onPointerDown,()=>{o.open&&o.onClose(),d.current=!0,document.addEventListener(`pointerup`,p,{once:!0})}),onFocus:i(e.onFocus,()=>{d.current||o.onOpen()}),onBlur:i(e.onBlur,o.onClose),onClick:i(e.onClick,o.onClose)})})});F.displayName=P;var I=`TooltipPortal`,[L,R]=S(I,{forceMount:void 0}),z=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=M(I,t);return(0,x.jsx)(L,{scope:t,forceMount:n,children:(0,x.jsx)(p,{present:n||a.open,children:(0,x.jsx)(u,{asChild:!0,container:i,children:r})})})};z.displayName=I;var B=`TooltipContent`,V=b.forwardRef((e,t)=>{let n=R(B,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=M(B,e.__scopeTooltip);return(0,x.jsx)(p,{present:r||o.open,children:o.disableHoverableContent?(0,x.jsx)(K,{side:i,...a,ref:t}):(0,x.jsx)(H,{side:i,...a,ref:t})})}),H=b.forwardRef((e,t)=>{let n=M(B,e.__scopeTooltip),r=k(B,e.__scopeTooltip),i=b.useRef(null),a=c(t,i),[o,s]=b.useState(null),{trigger:l,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,p=b.useCallback(()=>{s(null),f(!1)},[f]),m=b.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=re(r,ne(r,n.getBoundingClientRect())),a=ie(t.getBoundingClientRect());s(oe([...i,...a])),f(!0)},[f]);return b.useEffect(()=>()=>p(),[p]),b.useEffect(()=>{if(l&&d){let e=e=>m(e,d),t=e=>m(e,l);return l.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[l,d,m,p]),b.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||d?.contains(t),i=!ae(n,o);r?p():i&&(p(),u())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,o,u,p]),(0,x.jsx)(K,{...e,ref:a})}),[U,W]=S(j,{isInside:!1}),G=f(`TooltipContent`),K=b.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=M(B,n),l=w(n),{onClose:u}=c;return b.useEffect(()=>(document.addEventListener(D,u),()=>document.removeEventListener(D,u)),[u]),b.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,x.jsx)(d,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,x.jsxs)(v,{"data-state":c.stateAttribute,...l,...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,x.jsx)(G,{children:r}),(0,x.jsx)(U,{scope:n,isInside:!0,children:(0,x.jsx)(y,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});V.displayName=B;var q=`TooltipArrow`,te=b.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=w(n);return W(q,n).isInside?null:(0,x.jsx)(m,{...i,...r,ref:t})});te.displayName=q;function ne(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 re(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 ie(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 ae(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 oe(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),se(t)}function se(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 J=A,Y=N,X=F,Z=z,Q=V,ce=J,le=Y,ue=X,$=b.forwardRef(({className:e,sideOffset:t=4,...n},i)=>(0,x.jsx)(Z,{children:(0,x.jsx)(Q,{ref:i,sideOffset:t,className:r(`z-[var(--z-tooltip)] 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})}));$.displayName=Q.displayName;export{Q as a,Y as c,ue as i,X as l,$ as n,Z as o,ce as r,J as s,le as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./createLucideIcon-
|
|
1
|
+
import{t as e}from"./createLucideIcon-Y1cWg3R9.js";var t=e(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./i18n-
|
|
1
|
+
import{i as e}from"./i18n-BhoFaF7E.js";import{$ as t,B as n,F as r,Ft as i,G as a,I as o,It as s,J as c,K as l,L as u,N as d,P as f,Pt as p,Q as m,R as h,U as g,V as _,W as v,X as y,Y as b,Z as x,_ as S,et as C,g as w,h as T,m as E,p as D,q as O,v as k,y as A,z as j,zt as M}from"./api-HsS9C7l0.js";function ee(){return s({queryKey:[`config`],queryFn:h,staleTime:3e4,refetchOnWindowFocus:!0})}function N(){return s({queryKey:[`app-meta`],queryFn:u,staleTime:1/0})}function P(){return s({queryKey:[`config-meta`],queryFn:j,staleTime:1/0})}function F(){return s({queryKey:[`config-schema`],queryFn:n,staleTime:1/0})}function I(){let t=M();return i({mutationFn:y,onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),p.success(e(`configSaved`))},onError:t=>{p.error(e(`configSaveFailed`)+`: `+t.message)}})}function L(){let n=M();return i({mutationFn:({data:e})=>t(e),onSuccess:()=>{n.invalidateQueries({queryKey:[`config`]}),n.invalidateQueries({queryKey:[`config-meta`]}),p.success(e(`configSavedApplied`))},onError:t=>{p.error(e(`configSaveFailed`)+`: `+t.message)}})}function R(){let t=M();return i({mutationFn:({provider:e,data:t})=>x(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),t.invalidateQueries({queryKey:[`config-meta`]}),p.success(e(`configSaved`))},onError:t=>{p.error(e(`configSaveFailed`)+`: `+t.message)}})}function z(){let t=M();return i({mutationFn:({data:e})=>d(e??{}),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),t.invalidateQueries({queryKey:[`config-meta`]}),p.success(e(`configSaved`))},onError:t=>{p.error(e(`configSaveFailed`)+`: `+t.message)}})}function B(){let t=M();return i({mutationFn:({provider:e})=>r(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),t.invalidateQueries({queryKey:[`config-meta`]}),p.success(e(`configSaved`))},onError:t=>{p.error(e(`configSaveFailed`)+`: `+t.message)}})}function V(){return i({mutationFn:({provider:e,data:t})=>c(e,t)})}function H(){return i({mutationFn:({provider:e,data:t})=>O(e,t)})}function U(){return i({mutationFn:({provider:e,data:t})=>v(e,t)})}function W(){return i({mutationFn:({provider:e})=>g(e)})}function G(){let t=M();return i({mutationFn:({channel:e,data:t})=>b(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),t.invalidateQueries({queryKey:[`config-meta`]}),p.success(e(`configSavedApplying`))},onError:t=>{p.error(e(`configSaveFailed`)+`: `+t.message)}})}function K(){let t=M();return i({mutationFn:({data:e})=>m(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),p.success(e(`configSavedApplied`))},onError:t=>{p.error(e(`configSaveFailed`)+`: `+t.message)}})}function q(){let t=M();return i({mutationFn:({data:e})=>C(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`config`]}),p.success(e(`configSavedApplied`))},onError:t=>{p.error(e(`configSaveFailed`)+`: `+t.message)}})}function J(){return i({mutationFn:({actionId:e,data:t})=>o(e,t),onError:t=>{p.error(e(`error`)+`: `+t.message)}})}function Y(e){return s({queryKey:[`ncp-sessions`,e?.limit??null],queryFn:()=>k(e),staleTime:5e3,retry:!1})}function X(e,t=200){return s({queryKey:[`ncp-session-messages`,e,t],queryFn:()=>w(e,t),enabled:!!e,staleTime:5e3,retry:!1})}function Z(e){return s({queryKey:[`ncp-session-skills`,e.sessionId,e.projectRoot??null],queryFn:()=>S(e.sessionId,{...Object.prototype.hasOwnProperty.call(e,`projectRoot`)?{projectRoot:e.projectRoot??null}:{}}),enabled:!!e.sessionId,staleTime:5e3,retry:!1})}function Q(){let t=M();return i({mutationFn:({sessionId:e})=>T(e),onSuccess:(n,r)=>{D(t,r.sessionId),t.removeQueries({queryKey:[`ncp-session-messages`,r.sessionId]}),p.success(e(`configSavedApplied`))},onError:t=>{p.error(e(`configSaveFailed`)+`: `+t.message)}})}function $(){let t=M();return i({mutationFn:({sessionId:e,data:t})=>A(e,t),onSuccess:n=>{E(t,n),t.invalidateQueries({queryKey:[`ncp-session-skills`,n.sessionId]}),p.success(e(`configSavedApplied`))},onError:t=>{p.error(e(`configSaveFailed`)+`: `+t.message)}})}function te(e={all:!0}){return s({queryKey:[`cron`,e],queryFn:()=>_(e),staleTime:1e4})}function ne(){let t=M();return i({mutationFn:({id:e})=>f(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`cron`]}),p.success(e(`configSavedApplied`))},onError:t=>{p.error(e(`configSaveFailed`)+`: `+t.message)}})}function re(){let t=M();return i({mutationFn:({id:e,enabled:t})=>l(e,{enabled:t}),onSuccess:()=>{t.invalidateQueries({queryKey:[`cron`]}),p.success(e(`configSavedApplied`))},onError:t=>{p.error(e(`configSaveFailed`)+`: `+t.message)}})}function ie(){let t=M();return i({mutationFn:({id:e,force:t})=>a(e,{force:t}),onSuccess:()=>{t.invalidateQueries({queryKey:[`cron`]}),p.success(e(`configSavedApplied`))},onError:t=>{p.error(e(`configSaveFailed`)+`: `+t.message)}})}export{R as C,q as E,$ as S,L as T,H as _,z as a,G as b,Q as c,W as d,X as f,ie as g,U as h,F as i,B as l,Y as m,ee as n,te as o,Z as p,P as r,ne as s,N as t,J as u,V as v,K as w,I as x,re as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,i as t,m as n,p as r}from"./i18n-
|
|
1
|
+
import{_ as e,i as t,m as n,p as r}from"./i18n-BhoFaF7E.js";import{At as i}from"./api-HsS9C7l0.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./dialog-CYis0wx_.js";var d=e(n(),1),f=r(),p=({open:e,onOpenChange:n,title:r,description:d,confirmLabel:p=t(`confirm`),cancelLabel:m=t(`cancel`),variant:h=`default`,onConfirm:g,onCancel:_})=>(0,f.jsx)(u,{open:e,onOpenChange:n,children:(0,f.jsxs)(s,{className:`[&>:last-child]:hidden`,onCloseAutoFocus:e=>e.preventDefault(),children:[(0,f.jsxs)(a,{children:[(0,f.jsx)(c,{children:r}),d?(0,f.jsx)(l,{children:d}):null]}),(0,f.jsxs)(o,{className:`gap-2 sm:gap-0`,children:[(0,f.jsx)(i,{type:`button`,variant:`outline`,onClick:()=>{_(),n(!1)},children:m}),(0,f.jsx)(i,{type:`button`,variant:h===`destructive`?`destructive`:`default`,onClick:()=>{g(),n(!1)},children:p})]})]})}),m={open:!1,title:``,description:``,confirmLabel:t(`confirm`),cancelLabel:t(`cancel`),variant:`default`,resolve:null};function h(){let[e,n]=(0,d.useState)(m),r=(0,d.useCallback)(e=>new Promise(r=>{n({open:!0,title:e.title,description:e.description??``,confirmLabel:e.confirmLabel??t(`confirm`),cancelLabel:e.cancelLabel??t(`cancel`),variant:e.variant??`default`,resolve:e=>{r(e),n(e=>({...e,open:!1,resolve:null}))}})}),[]),i=(0,d.useCallback)(e=>{n(t=>(!e&&t.resolve&&t.resolve(!1),{...t,open:e,resolve:e?t.resolve:null}))},[]);return{confirm:r,ConfirmDialog:(0,d.useCallback)(()=>(0,f.jsx)(p,{open:e.open,onOpenChange:i,title:e.title,description:e.description||void 0,confirmLabel:e.confirmLabel,cancelLabel:e.cancelLabel,variant:e.variant,onConfirm:()=>e.resolve?.(!0),onCancel:()=>e.resolve?.(!1)}),[e,i])}}export{h as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,i as t,m as n,p as r}from"./i18n-
|
|
1
|
+
import{_ as e,i as t,m as n,p as r}from"./i18n-BhoFaF7E.js";import{Bt as i,Ht as a,Lt as o,Ut as s,Vt as c}from"./api-HsS9C7l0.js";import{t as l}from"./createLucideIcon-Y1cWg3R9.js";import{a as u,i as d,n as f,r as p,t as m}from"./select-D-gjRjhr.js";import{t as h}from"./skeleton-BN6fOana.js";var g=class extends s{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:a()})}getOptimisticResult(e){return e.behavior=a(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:a,isRefetching:o,isError:s,isRefetchError:l}=r,u=n.fetchMeta?.fetchMore?.direction,d=s&&u===`forward`,f=a&&u===`forward`,p=s&&u===`backward`,m=a&&u===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:i(t,n.data),hasPreviousPage:c(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:o&&!f&&!m}}};function _(e,t){return o(e,g,t)}var v=l(`PackageSearch`,[[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}],[`circle`,{cx:`18.5`,cy:`15.5`,r:`2.5`,key:`b5zd12`}],[`path`,{d:`M20.27 17.27 22 19`,key:`1l4muz`}]]);function y(e){if(!e||e.pages.length===0)return;let t=e.pages.flatMap(e=>e.items);return{...e.pages[e.pages.length-1],items:t,pages:e.pages,loadedItems:t.length,loadedPages:e.pages.length}}var b=r();function x({scope:e,searchText:n,searchPlaceholder:r,sort:i,onSearchTextChange:a,onSortChange:o}){return(0,b.jsx)(`div`,{className:`mb-4`,children:(0,b.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,b.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,b.jsx)(v,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400`}),(0,b.jsx)(`input`,{value:n,onChange:e=>a(e.target.value),placeholder:r,className:`h-9 w-full rounded-xl border border-gray-200/80 pl-9 pr-3 text-sm focus:outline-none focus:ring-1 focus:ring-primary/40`})]}),e===`all`&&(0,b.jsxs)(m,{value:i,onValueChange:e=>o(e),children:[(0,b.jsx)(d,{className:`h-9 w-[150px] shrink-0 rounded-lg`,children:(0,b.jsx)(u,{})}),(0,b.jsxs)(f,{children:[(0,b.jsx)(p,{value:`relevance`,children:t(`marketplaceSortRelevance`)}),(0,b.jsx)(p,{value:`updated`,children:t(`marketplaceSortUpdated`)})]})]})]})})}function S({count:e}){return(0,b.jsx)(b.Fragment,{children:Array.from({length:e},(e,t)=>(0,b.jsx)(`article`,{className:`rounded-2xl border border-gray-200/40 bg-white px-5 py-4 shadow-sm`,children:(0,b.jsxs)(`div`,{className:`flex items-start justify-between gap-3.5`,children:[(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-1 gap-3`,children:[(0,b.jsx)(h,{className:`h-10 w-10 shrink-0 rounded-xl`}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2 pt-0.5`,children:[(0,b.jsx)(h,{className:`h-4 w-32 max-w-[70%]`}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(h,{className:`h-3 w-12`}),(0,b.jsx)(h,{className:`h-3 w-24`})]}),(0,b.jsx)(h,{className:`h-3 w-full`})]})]}),(0,b.jsx)(h,{className:`h-8 w-20 shrink-0 rounded-xl`})]})},`marketplace-skeleton-${t}`))})}function C({hasMore:e,loading:n,sentinelRef:r}){return!e&&!n?null:(0,b.jsxs)(`div`,{className:`py-4`,children:[e&&(0,b.jsx)(`div`,{ref:r,className:`h-1 w-full`,"aria-hidden":`true`}),n&&(0,b.jsx)(`div`,{"data-testid":`marketplace-loading-more`,className:`pt-3 text-center text-xs text-gray-500`,children:t(`loading`)})]})}function w(e){let t=e.trim().toLowerCase().replace(/_/g,`-`),n=[t,t.split(`-`)[0],`en`];return Array.from(new Set(n.filter(Boolean)))}function T(e){return e.trim().toLowerCase().replace(/_/g,`-`)}function E(e,t,n){if(e){let t=Object.entries(e).map(([e,t])=>({locale:T(e),text:typeof t==`string`?t.trim():``})).filter(e=>e.text.length>0);if(t.length>0){let e=new Map(t.map(e=>[e.locale,e.text]));for(let t of n){let n=T(t),r=e.get(n);if(r)return r}for(let e of n){let n=T(e).split(`-`)[0];if(!n)continue;let r=t.find(e=>e.locale===n||e.locale.startsWith(`${n}-`));if(r)return r.text}return t[0]?.text??``}}return t?.trim()??``}function D(e,t){if(!e)return``;for(let n of t)if(T(n).split(`-`)[0]===`zh`&&e.descriptionZh?.trim())return e.descriptionZh.trim();return e.description?.trim()?e.description.trim():e.descriptionZh?.trim()?e.descriptionZh.trim():``}var O=e(n(),1),k=160;function A(e){let t=(0,O.useRef)(null),n=(0,O.useRef)(null),r=(0,O.useRef)(e.onLoadMore),i=(0,O.useRef)(!1);return(0,O.useEffect)(()=>{r.current=e.onLoadMore},[e.onLoadMore]),(0,O.useEffect)(()=>{e.disabled&&(i.current=!1)},[e.disabled]),(0,O.useEffect)(()=>{let a=t.current,o=n.current,s=e.thresholdPx??k;if(e.disabled||!a||!o)return;let c=()=>{i.current||e.disabled||(i.current=!0,Promise.resolve(r.current()).finally(()=>{i.current=!1}))},l=()=>{o.getBoundingClientRect().top-a.getBoundingClientRect().bottom<=s&&c()};if(typeof IntersectionObserver==`function`){let e=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&c()},{root:a,rootMargin:`0px 0px ${s}px 0px`});return e.observe(o),l(),()=>{e.disconnect()}}return a.addEventListener(`scroll`,l,{passive:!0}),l(),()=>{a.removeEventListener(`scroll`,l)}},[e.disabled,e.thresholdPx,e.watchValue]),{containerRef:t,sentinelRef:n}}export{x as a,y as c,E as i,_ as l,w as n,C as o,D as r,S as s,A as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,m as t}from"./i18n-
|
|
1
|
+
import{_ as e,m as t}from"./i18n-BhoFaF7E.js";import{bt as n}from"./api-HsS9C7l0.js";function r(e){return typeof e!=`number`||!Number.isFinite(e)?`desktop`:e<=767?`mobile`:`desktop`}function i(){let e=typeof window>`u`?null:window.innerWidth??null;return{mode:r(e),width:e}}var a=n(()=>i()),o=new class{constructor(){this.consumerCount=0,this.started=!1,this.attach=()=>(this.consumerCount+=1,this.consumerCount===1&&this.start(),()=>{this.consumerCount=Math.max(0,this.consumerCount-1),this.consumerCount===0&&this.stop()}),this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`resize`,this.handleViewportChange),window.addEventListener(`orientationchange`,this.handleViewportChange),this.syncFromWindow())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`resize`,this.handleViewportChange),window.removeEventListener(`orientationchange`,this.handleViewportChange),this.started=!1)},this.getSnapshot=()=>a.getState(),this.resetForTests=()=>{this.consumerCount=0,this.stop(),a.setState(i())},this.handleViewportChange=()=>{this.syncFromWindow()},this.syncFromWindow=()=>{if(typeof window>`u`)return;let e=window.innerWidth??null;a.setState({width:e,mode:r(e)})}}},s=e(t(),1);function c(){(0,s.useEffect)(()=>o.attach(),[]);let e=a(e=>e.mode);return{mode:e,isMobile:e===`mobile`,isDesktop:e===`desktop`}}export{o as n,c as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-Y1cWg3R9.js";var t=e(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};
|
package/dist/index.html
CHANGED
|
@@ -78,45 +78,45 @@
|
|
|
78
78
|
})();
|
|
79
79
|
</script>
|
|
80
80
|
<title>NextClaw</title>
|
|
81
|
-
<script type="module" crossorigin src="/assets/index-
|
|
82
|
-
<link rel="modulepreload" crossorigin href="/assets/i18n-
|
|
83
|
-
<link rel="modulepreload" crossorigin href="/assets/api-
|
|
84
|
-
<link rel="modulepreload" crossorigin href="/assets/es2015-
|
|
85
|
-
<link rel="modulepreload" crossorigin href="/assets/createLucideIcon-
|
|
86
|
-
<link rel="modulepreload" crossorigin href="/assets/select-
|
|
87
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
88
|
-
<link rel="modulepreload" crossorigin href="/assets/x-
|
|
89
|
-
<link rel="modulepreload" crossorigin href="/assets/dialog-
|
|
90
|
-
<link rel="modulepreload" crossorigin href="/assets/popover-
|
|
91
|
-
<link rel="modulepreload" crossorigin href="/assets/tooltip-
|
|
92
|
-
<link rel="modulepreload" crossorigin href="/assets/chunk-JZWAC4HX-
|
|
93
|
-
<link rel="modulepreload" crossorigin href="/assets/use-config-
|
|
94
|
-
<link rel="modulepreload" crossorigin href="/assets/theme-provider-
|
|
95
|
-
<link rel="modulepreload" crossorigin href="/assets/search-
|
|
96
|
-
<link rel="modulepreload" crossorigin href="/assets/book-open-
|
|
97
|
-
<link rel="modulepreload" crossorigin href="/assets/external-link-
|
|
98
|
-
<link rel="modulepreload" crossorigin href="/assets/folder-
|
|
99
|
-
<link rel="modulepreload" crossorigin href="/assets/logos-
|
|
100
|
-
<link rel="modulepreload" crossorigin href="/assets/loader-circle-
|
|
101
|
-
<link rel="modulepreload" crossorigin href="/assets/plus-
|
|
102
|
-
<link rel="modulepreload" crossorigin href="/assets/refresh-ccw-
|
|
103
|
-
<link rel="modulepreload" crossorigin href="/assets/settings-
|
|
104
|
-
<link rel="modulepreload" crossorigin href="/assets/sparkles-
|
|
105
|
-
<link rel="modulepreload" crossorigin href="/assets/trash-2-
|
|
106
|
-
<link rel="modulepreload" crossorigin href="/assets/doc-browser-context-
|
|
107
|
-
<link rel="modulepreload" crossorigin href="/assets/doc-browser-
|
|
108
|
-
<link rel="modulepreload" crossorigin href="/assets/doc-browser-
|
|
109
|
-
<link rel="modulepreload" crossorigin href="/assets/use-viewport-layout-
|
|
110
|
-
<link rel="modulepreload" crossorigin href="/assets/logo-badge-
|
|
111
|
-
<link rel="modulepreload" crossorigin href="/assets/skeleton-
|
|
112
|
-
<link rel="modulepreload" crossorigin href="/assets/chat-
|
|
113
|
-
<link rel="modulepreload" crossorigin href="/assets/key-round-
|
|
114
|
-
<link rel="modulepreload" crossorigin href="/assets/message-square-
|
|
115
|
-
<link rel="modulepreload" crossorigin href="/assets/app-navigation.config-
|
|
116
|
-
<link rel="modulepreload" crossorigin href="/assets/notice-card-
|
|
117
|
-
<link rel="modulepreload" crossorigin href="/assets/status-dot-
|
|
118
|
-
<link rel="modulepreload" crossorigin href="/assets/app-manager-provider-
|
|
119
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
81
|
+
<script type="module" crossorigin src="/assets/index-D0_J-bk_.js"></script>
|
|
82
|
+
<link rel="modulepreload" crossorigin href="/assets/i18n-BhoFaF7E.js">
|
|
83
|
+
<link rel="modulepreload" crossorigin href="/assets/api-HsS9C7l0.js">
|
|
84
|
+
<link rel="modulepreload" crossorigin href="/assets/es2015-3VnZDFPs.js">
|
|
85
|
+
<link rel="modulepreload" crossorigin href="/assets/createLucideIcon-Y1cWg3R9.js">
|
|
86
|
+
<link rel="modulepreload" crossorigin href="/assets/select-D-gjRjhr.js">
|
|
87
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-DIWOVzPY.js">
|
|
88
|
+
<link rel="modulepreload" crossorigin href="/assets/x-D1867E7F.js">
|
|
89
|
+
<link rel="modulepreload" crossorigin href="/assets/dialog-CYis0wx_.js">
|
|
90
|
+
<link rel="modulepreload" crossorigin href="/assets/popover-Dliq2K8O.js">
|
|
91
|
+
<link rel="modulepreload" crossorigin href="/assets/tooltip-C1XVx_h1.js">
|
|
92
|
+
<link rel="modulepreload" crossorigin href="/assets/chunk-JZWAC4HX-CMPxE3BJ.js">
|
|
93
|
+
<link rel="modulepreload" crossorigin href="/assets/use-config-BIErdQNR.js">
|
|
94
|
+
<link rel="modulepreload" crossorigin href="/assets/theme-provider-CajCgE_N.js">
|
|
95
|
+
<link rel="modulepreload" crossorigin href="/assets/search-DpxqxcpP.js">
|
|
96
|
+
<link rel="modulepreload" crossorigin href="/assets/book-open-DJSe9YLj.js">
|
|
97
|
+
<link rel="modulepreload" crossorigin href="/assets/external-link-CPhZo92k.js">
|
|
98
|
+
<link rel="modulepreload" crossorigin href="/assets/folder-orBwjR8h.js">
|
|
99
|
+
<link rel="modulepreload" crossorigin href="/assets/logos-WPtZ1joO.js">
|
|
100
|
+
<link rel="modulepreload" crossorigin href="/assets/loader-circle-DotuB8NZ.js">
|
|
101
|
+
<link rel="modulepreload" crossorigin href="/assets/plus-BNaF7Wq5.js">
|
|
102
|
+
<link rel="modulepreload" crossorigin href="/assets/refresh-ccw-pX3BUxPF.js">
|
|
103
|
+
<link rel="modulepreload" crossorigin href="/assets/settings-C9WgQdGW.js">
|
|
104
|
+
<link rel="modulepreload" crossorigin href="/assets/sparkles-gvRilA9f.js">
|
|
105
|
+
<link rel="modulepreload" crossorigin href="/assets/trash-2-WC4Dlakj.js">
|
|
106
|
+
<link rel="modulepreload" crossorigin href="/assets/doc-browser-context-BacwCbOG.js">
|
|
107
|
+
<link rel="modulepreload" crossorigin href="/assets/doc-browser-CP6kjGaF.js">
|
|
108
|
+
<link rel="modulepreload" crossorigin href="/assets/doc-browser-BQT0fa3g.js">
|
|
109
|
+
<link rel="modulepreload" crossorigin href="/assets/use-viewport-layout-zLAsjh3A.js">
|
|
110
|
+
<link rel="modulepreload" crossorigin href="/assets/logo-badge-BLQdO_th.js">
|
|
111
|
+
<link rel="modulepreload" crossorigin href="/assets/skeleton-BN6fOana.js">
|
|
112
|
+
<link rel="modulepreload" crossorigin href="/assets/chat-Rmwi-kQn.js">
|
|
113
|
+
<link rel="modulepreload" crossorigin href="/assets/key-round-B5u2XQwa.js">
|
|
114
|
+
<link rel="modulepreload" crossorigin href="/assets/message-square-CO_7rU-N.js">
|
|
115
|
+
<link rel="modulepreload" crossorigin href="/assets/app-navigation.config-Dy69P_3O.js">
|
|
116
|
+
<link rel="modulepreload" crossorigin href="/assets/notice-card-DDVM6IFQ.js">
|
|
117
|
+
<link rel="modulepreload" crossorigin href="/assets/status-dot-W2TPs1Zf.js">
|
|
118
|
+
<link rel="modulepreload" crossorigin href="/assets/app-manager-provider-CNa6cmOk.js">
|
|
119
|
+
<link rel="stylesheet" crossorigin href="/assets/index-OrUEVLgT.css">
|
|
120
120
|
</head>
|
|
121
121
|
|
|
122
122
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/ui",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.15",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"zod": "^3.23.8",
|
|
30
30
|
"zustand": "^5.0.2",
|
|
31
31
|
"@nextclaw/ncp-http-agent-client": "0.3.17",
|
|
32
|
-
"@nextclaw/ncp-react": "0.4.25",
|
|
33
32
|
"@nextclaw/agent-chat": "0.1.10",
|
|
34
|
-
"@nextclaw/agent-chat-ui": "0.3.
|
|
33
|
+
"@nextclaw/agent-chat-ui": "0.3.10",
|
|
34
|
+
"@nextclaw/ncp-react": "0.4.25",
|
|
35
35
|
"@nextclaw/ncp": "0.5.5"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
@@ -43,4 +43,20 @@ describe("ChatSessionTypeOptionItem", () => {
|
|
|
43
43
|
|
|
44
44
|
expect(screen.getAllByText("Ready")).toHaveLength(1);
|
|
45
45
|
});
|
|
46
|
+
|
|
47
|
+
it("renders a built-in fallback icon when the session type has no runtime image", () => {
|
|
48
|
+
render(
|
|
49
|
+
<ChatSessionTypeOptionItem
|
|
50
|
+
option={{
|
|
51
|
+
value: "native",
|
|
52
|
+
label: "Native",
|
|
53
|
+
ready: true,
|
|
54
|
+
}}
|
|
55
|
+
onSelect={vi.fn()}
|
|
56
|
+
/>,
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
expect(screen.getByRole("button", { name: /native/i })).toBeTruthy();
|
|
60
|
+
expect(screen.getByText("Native")).toBeTruthy();
|
|
61
|
+
});
|
|
46
62
|
});
|
|
@@ -2,6 +2,7 @@ import type { ChatInputSnapshot } from "@/features/chat/stores/chat-input.store"
|
|
|
2
2
|
import { SessionContextIconNode } from "@/features/chat/components/session/session-context-icon";
|
|
3
3
|
import { t } from "@/shared/lib/i18n";
|
|
4
4
|
import { cn } from "@/shared/lib/utils";
|
|
5
|
+
import { Bot } from "lucide-react";
|
|
5
6
|
|
|
6
7
|
type SessionTypeOption = ChatInputSnapshot["sessionTypeOptions"][number];
|
|
7
8
|
|
|
@@ -34,7 +35,9 @@ export function ChatSessionTypeOptionItem(props: {
|
|
|
34
35
|
}}
|
|
35
36
|
/>
|
|
36
37
|
</span>
|
|
37
|
-
) :
|
|
38
|
+
) : (
|
|
39
|
+
<span className="inline-flex h-5 w-5 shrink-0 items-center justify-center pt-0.5 text-gray-400"><Bot className="h-4 w-4" /></span>
|
|
40
|
+
)}
|
|
38
41
|
<div className="min-w-0 flex-1">
|
|
39
42
|
<div className="flex items-center justify-between gap-3">
|
|
40
43
|
<div className="truncate text-[13px] font-semibold text-gray-900">
|
|
@@ -7,7 +7,7 @@ import { Input } from '@/shared/components/ui/input';
|
|
|
7
7
|
import { type SessionContextView } from '@/features/chat/utils/session-context.utils';
|
|
8
8
|
import type { SessionRunStatus } from '@/features/chat/types/session-run-status.types';
|
|
9
9
|
import { cn } from '@/shared/lib/utils';
|
|
10
|
-
import {
|
|
10
|
+
import { formatDateShort, t } from '@/shared/lib/i18n';
|
|
11
11
|
import { Check, GitBranch, Pencil, X } from 'lucide-react';
|
|
12
12
|
|
|
13
13
|
type ChatSidebarSessionItemProps = {
|
|
@@ -115,20 +115,16 @@ function ChatSidebarSessionDisplayView({
|
|
|
115
115
|
onOpenChildSessions,
|
|
116
116
|
onStartEditing
|
|
117
117
|
}: ChatSidebarSessionDisplayViewProps) {
|
|
118
|
-
const
|
|
119
|
-
const normalizedAgentId = agentId?.trim() ?? '';
|
|
120
|
-
const shouldShowAgentAvatar = Boolean(
|
|
121
|
-
normalizedAgentId && normalizedAgentId.toLowerCase() !== 'main',
|
|
122
|
-
);
|
|
118
|
+
const trailingControlsClassName = childSessionCount > 0 && onOpenChildSessions ? 'pr-16' : 'pr-8';
|
|
123
119
|
|
|
124
120
|
return (
|
|
125
121
|
<div className="group/session relative">
|
|
126
122
|
<button type="button" onClick={onSelect} className="w-full text-left">
|
|
127
|
-
<div className=
|
|
123
|
+
<div className={cn('grid grid-cols-[minmax(0,1fr)_auto] items-start gap-2', trailingControlsClassName)}>
|
|
128
124
|
<span className="flex min-w-0 items-center gap-1.5">
|
|
129
|
-
{
|
|
125
|
+
{agentId?.trim() && agentId.trim().toLowerCase() !== 'main' ? (
|
|
130
126
|
<AgentAvatar
|
|
131
|
-
agentId={
|
|
127
|
+
agentId={agentId}
|
|
132
128
|
displayName={agentLabel}
|
|
133
129
|
avatarUrl={agentAvatarUrl}
|
|
134
130
|
className="h-5 w-5 shrink-0"
|
|
@@ -149,26 +145,28 @@ function ChatSidebarSessionDisplayView({
|
|
|
149
145
|
) : null}
|
|
150
146
|
{context.icon ? (
|
|
151
147
|
<span className="inline-flex h-[1.125rem] w-[1.125rem] shrink-0 items-center justify-center">
|
|
152
|
-
<SessionContextIconNode icon={context.icon} className={
|
|
148
|
+
<SessionContextIconNode icon={context.icon} className={active ? 'text-gray-700' : 'text-gray-500'} />
|
|
153
149
|
</span>
|
|
154
150
|
) : null}
|
|
155
151
|
</span>
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
<
|
|
159
|
-
aria-label={t('chatSessionUnread')}
|
|
160
|
-
className="h-2 w-2 rounded-full bg-primary"
|
|
161
|
-
/>
|
|
162
|
-
) : null}
|
|
163
|
-
<span className="inline-flex h-3.5 w-3.5 items-center justify-center">
|
|
164
|
-
{runStatus ? <SessionRunBadge status={runStatus} /> : null}
|
|
152
|
+
{runStatus ? (
|
|
153
|
+
<span className="inline-flex shrink-0 items-center justify-end gap-1.5 pt-0.5">
|
|
154
|
+
<SessionRunBadge status={runStatus} />
|
|
165
155
|
</span>
|
|
166
|
-
|
|
156
|
+
) : null}
|
|
167
157
|
</div>
|
|
168
|
-
<div className="mt-
|
|
169
|
-
<span>
|
|
170
|
-
{agentLabel?.trim() ? `${agentLabel} · ` : ''}{session.messageCount}
|
|
158
|
+
<div className="mt-1 flex items-center gap-2 text-[11px] text-gray-400">
|
|
159
|
+
<span className="min-w-0 truncate">
|
|
160
|
+
{agentLabel?.trim() ? `${agentLabel} · ` : ''}{session.messageCount}
|
|
171
161
|
</span>
|
|
162
|
+
{showUnreadDot ? (
|
|
163
|
+
<span
|
|
164
|
+
aria-label={t('chatSessionUnread')}
|
|
165
|
+
className="ml-auto h-2 w-2 shrink-0 rounded-full bg-primary"
|
|
166
|
+
/>
|
|
167
|
+
) : (
|
|
168
|
+
<span className="ml-auto shrink-0">{formatDateShort(session.updatedAt)}</span>
|
|
169
|
+
)}
|
|
172
170
|
</div>
|
|
173
171
|
</button>
|
|
174
172
|
{childSessionCount > 0 && onOpenChildSessions ? (
|
|
@@ -235,7 +233,7 @@ export function ChatSidebarSessionItem({
|
|
|
235
233
|
return (
|
|
236
234
|
<div
|
|
237
235
|
className={cn(
|
|
238
|
-
'w-full rounded-xl px-3 py-2 text-left transition-all text-[13px]',
|
|
236
|
+
'w-full rounded-xl px-3 py-2.5 text-left transition-all text-[13px]',
|
|
239
237
|
active
|
|
240
238
|
? 'bg-gray-200 text-gray-900 font-semibold shadow-sm'
|
|
241
239
|
: 'text-gray-700 hover:bg-gray-200/60 hover:text-gray-900'
|
|
@@ -11,7 +11,8 @@ import { useChatThreadStore } from "@/features/chat/stores/chat-thread.store";
|
|
|
11
11
|
const mocks = vi.hoisted(() => ({
|
|
12
12
|
deleteSession: vi.fn(),
|
|
13
13
|
goToProviders: vi.fn(),
|
|
14
|
-
createSession: vi.fn(),
|
|
14
|
+
createSession: vi.fn(() => "draft-session-2"),
|
|
15
|
+
goToSession: vi.fn(),
|
|
15
16
|
setSelectedAgentId: vi.fn(),
|
|
16
17
|
setPendingSessionType: vi.fn(),
|
|
17
18
|
stickyBottomScroll: vi.fn(() => ({
|
|
@@ -79,6 +80,9 @@ vi.mock("@/features/chat/components/chat-welcome", () => ({
|
|
|
79
80
|
|
|
80
81
|
vi.mock("@/features/chat/components/providers/chat-presenter.provider", () => ({
|
|
81
82
|
usePresenter: () => ({
|
|
83
|
+
chatUiManager: {
|
|
84
|
+
goToSession: mocks.goToSession,
|
|
85
|
+
},
|
|
82
86
|
chatThreadManager: {
|
|
83
87
|
deleteSession: mocks.deleteSession,
|
|
84
88
|
goToProviders: mocks.goToProviders,
|
|
@@ -158,6 +162,8 @@ describe("ChatConversationPanel", () => {
|
|
|
158
162
|
mocks.deleteSession.mockReset();
|
|
159
163
|
mocks.goToProviders.mockReset();
|
|
160
164
|
mocks.createSession.mockReset();
|
|
165
|
+
mocks.createSession.mockReturnValue("draft-session-2");
|
|
166
|
+
mocks.goToSession.mockReset();
|
|
161
167
|
mocks.setSelectedAgentId.mockReset();
|
|
162
168
|
mocks.setPendingSessionType.mockReset();
|
|
163
169
|
mocks.stickyBottomScroll.mockClear();
|
|
@@ -233,6 +239,17 @@ describe("ChatConversationPanel", () => {
|
|
|
233
239
|
expect(onBackToList).toHaveBeenCalledTimes(1);
|
|
234
240
|
});
|
|
235
241
|
|
|
242
|
+
it("opens the new draft session immediately when mobile welcome creates a session", async () => {
|
|
243
|
+
const user = userEvent.setup();
|
|
244
|
+
|
|
245
|
+
render(<ChatConversationPanel layoutMode="mobile" />);
|
|
246
|
+
|
|
247
|
+
await user.click(screen.getByRole("button", { name: "create draft session" }));
|
|
248
|
+
|
|
249
|
+
expect(mocks.createSession).toHaveBeenCalledWith("native");
|
|
250
|
+
expect(mocks.goToSession).toHaveBeenCalledWith("draft-session-2");
|
|
251
|
+
});
|
|
252
|
+
|
|
236
253
|
it("shows the selected session project badge and more actions trigger", () => {
|
|
237
254
|
useChatThreadStore.setState({
|
|
238
255
|
snapshot: {
|
|
@@ -272,7 +272,8 @@ export function ChatConversationPanel({
|
|
|
272
272
|
resolveDraftAgent(snapshot.agentId ?? "main"),
|
|
273
273
|
defaultSessionType,
|
|
274
274
|
);
|
|
275
|
-
presenter.chatSessionListManager.createSession(sessionType);
|
|
275
|
+
const sessionKey = presenter.chatSessionListManager.createSession(sessionType);
|
|
276
|
+
if (layoutMode === "mobile") presenter.chatUiManager.goToSession(sessionKey);
|
|
276
277
|
};
|
|
277
278
|
const selectDraftAgent = (agentId: string) => {
|
|
278
279
|
presenter.chatSessionListManager.setSelectedAgentId(agentId);
|