@nextclaw/ui 0.12.14 → 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.
Files changed (88) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/assets/{api-C51456xV.js → api-HsS9C7l0.js} +1 -1
  3. package/dist/assets/{app-manager-provider-D_cKqqRG.js → app-manager-provider-CNa6cmOk.js} +1 -1
  4. package/dist/assets/{app-navigation.config-Dve1W20Y.js → app-navigation.config-Dy69P_3O.js} +1 -1
  5. package/dist/assets/{book-open-B4mOKdz8.js → book-open-DJSe9YLj.js} +1 -1
  6. package/dist/assets/{channels-list-page-WJ7d4zMI.js → channels-list-page-DtjYJ1FX.js} +1 -1
  7. package/dist/assets/chat-Rmwi-kQn.js +58 -0
  8. package/dist/assets/{chat-page-DLFTPfmu.js → chat-page-Cslvp6SG.js} +1 -1
  9. package/dist/assets/{chunk-JZWAC4HX-ptDyT_1C.js → chunk-JZWAC4HX-CMPxE3BJ.js} +1 -1
  10. package/dist/assets/{config-split-page-B3PRA_AV.js → config-split-page-v7p1CQjU.js} +1 -1
  11. package/dist/assets/{createLucideIcon-C_GFKVuW.js → createLucideIcon-Y1cWg3R9.js} +1 -1
  12. package/dist/assets/{desktop-update-config-CzGi43xw.js → desktop-update-config-CqJmmpjR.js} +1 -1
  13. package/dist/assets/{dialog-BHcaU6NE.js → dialog-CYis0wx_.js} +1 -1
  14. package/dist/assets/{dist-DtBFqZ6_.js → dist-DIWOVzPY.js} +1 -1
  15. package/dist/assets/{doc-browser-CwgI7ipB.js → doc-browser-BQT0fa3g.js} +1 -1
  16. package/dist/assets/{doc-browser-CoKIUCJj.js → doc-browser-CP6kjGaF.js} +1 -1
  17. package/dist/assets/doc-browser-DK2tXLi_.js +1 -0
  18. package/dist/assets/{doc-browser-context-Dib9sS83.js → doc-browser-context-BacwCbOG.js} +1 -1
  19. package/dist/assets/{es2015-BlNhrQUG.js → es2015-3VnZDFPs.js} +1 -1
  20. package/dist/assets/{external-link-DP2IJ7AM.js → external-link-CPhZo92k.js} +1 -1
  21. package/dist/assets/{folder-BPwc278w.js → folder-orBwjR8h.js} +1 -1
  22. package/dist/assets/{hash-CvcvtMBq.js → hash-BvWW8Scd.js} +1 -1
  23. package/dist/assets/i18n-BhoFaF7E.js +1 -0
  24. package/dist/assets/{index-CAYF44Dz.js → index-D0_J-bk_.js} +2 -2
  25. package/dist/assets/index-OrUEVLgT.css +1 -0
  26. package/dist/assets/{key-round-BQXmPSxD.js → key-round-B5u2XQwa.js} +1 -1
  27. package/dist/assets/loader-circle-DotuB8NZ.js +1 -0
  28. package/dist/assets/{logo-badge-uB4SwANR.js → logo-badge-BLQdO_th.js} +1 -1
  29. package/dist/assets/{logos-BcELLmYh.js → logos-WPtZ1joO.js} +1 -1
  30. package/dist/assets/marketplace-page-CJHkdgv_.js +1 -0
  31. package/dist/assets/{marketplace-page-DiqqX25V.js → marketplace-page-It54wla_.js} +1 -1
  32. package/dist/assets/{mcp-marketplace-page-C_akqPwv.js → mcp-marketplace-page-C64VUmni.js} +1 -1
  33. package/dist/assets/mcp-marketplace-page-DIItTRy_.js +1 -0
  34. package/dist/assets/message-square-CO_7rU-N.js +1 -0
  35. package/dist/assets/{model-config-B0L43HTL.js → model-config-Cu6zLI8a.js} +1 -1
  36. package/dist/assets/{notice-card-C9PFAR67.js → notice-card-DDVM6IFQ.js} +1 -1
  37. package/dist/assets/play-kSfmJAme.js +1 -0
  38. package/dist/assets/plus-BNaF7Wq5.js +1 -0
  39. package/dist/assets/{popover-B8msg2FQ.js → popover-Dliq2K8O.js} +1 -1
  40. package/dist/assets/{provider-scoped-model-input-DeAo2Y65.js → provider-scoped-model-input-D0oXIrWA.js} +1 -1
  41. package/dist/assets/{providers-list-5_VShcn7.js → providers-list-CrwTWzge.js} +1 -1
  42. package/dist/assets/{refresh-ccw-CeG203yU.js → refresh-ccw-pX3BUxPF.js} +1 -1
  43. package/dist/assets/remote-BpAw88FR.js +1 -0
  44. package/dist/assets/{rotate-cw-F7aThvYj.js → rotate-cw-Bm8W8iaF.js} +1 -1
  45. package/dist/assets/{runtime-config-page-B-y_0HIS.js → runtime-config-page-CYZyCr04.js} +1 -1
  46. package/dist/assets/{save-7ztImRj7.js → save-CZ9zvmBJ.js} +1 -1
  47. package/dist/assets/{search-DZSNKEGp.js → search-DpxqxcpP.js} +1 -1
  48. package/dist/assets/{search-config-DJTm9Fno.js → search-config-D_H6cr07.js} +1 -1
  49. package/dist/assets/{secrets-config-DKFeFii1.js → secrets-config-BG9fic_R.js} +1 -1
  50. package/dist/assets/{select-DRDejPLk.js → select-D-gjRjhr.js} +1 -1
  51. package/dist/assets/{sessions-config-page-CZGqS32n.js → sessions-config-page-DzSOCrQt.js} +1 -1
  52. package/dist/assets/{setting-row-BcF6eTW0.js → setting-row-Cl4_XpIR.js} +1 -1
  53. package/dist/assets/{settings-DjvNMJde.js → settings-C9WgQdGW.js} +1 -1
  54. package/dist/assets/skeleton-BN6fOana.js +1 -0
  55. package/dist/assets/{sparkles-CyDTgTM4.js → sparkles-gvRilA9f.js} +1 -1
  56. package/dist/assets/{status-dot-aQU9Mia4.js → status-dot-W2TPs1Zf.js} +1 -1
  57. package/dist/assets/{tabs-custom-C4P7g4vR.js → tabs-custom-BxZfWeD1.js} +1 -1
  58. package/dist/assets/{tag-chip-CVIqyMv7.js → tag-chip-DfmhmN50.js} +1 -1
  59. package/dist/assets/{theme-provider-dHqcWU-j.js → theme-provider-CajCgE_N.js} +1 -1
  60. package/dist/assets/{tooltip-C6VPreZ7.js → tooltip-C1XVx_h1.js} +1 -1
  61. package/dist/assets/{trash-2-C1cdqL6V.js → trash-2-WC4Dlakj.js} +1 -1
  62. package/dist/assets/{use-config-DFja1sda.js → use-config-BIErdQNR.js} +1 -1
  63. package/dist/assets/{use-confirm-dialog-DvIbSUX3.js → use-confirm-dialog-B3ZsM4V-.js} +1 -1
  64. package/dist/assets/{use-infinite-scroll-loader-D8h0k-iL.js → use-infinite-scroll-loader-rO55YHGO.js} +1 -1
  65. package/dist/assets/{use-viewport-layout-D-pjxsyz.js → use-viewport-layout-zLAsjh3A.js} +1 -1
  66. package/dist/assets/x-D1867E7F.js +1 -0
  67. package/dist/index.html +39 -39
  68. package/package.json +3 -3
  69. package/src/features/chat/components/chat-sidebar-session-item.tsx +22 -24
  70. package/src/features/chat/managers/ncp-chat-input.manager.test.ts +29 -0
  71. package/src/features/chat/utils/chat-input-bar.utils.test.ts +27 -1
  72. package/src/features/chat/utils/chat-input-toolbar.utils.ts +20 -19
  73. package/src/features/chat/utils/ncp-chat-input-availability.utils.test.ts +35 -3
  74. package/src/features/chat/utils/ncp-chat-input-availability.utils.ts +4 -6
  75. package/src/shared/lib/i18n/chat.ts +1 -1
  76. package/dist/assets/chat-BxA-mw53.js +0 -58
  77. package/dist/assets/doc-browser-DYKpRqe-.js +0 -1
  78. package/dist/assets/i18n-BnNAQpVM.js +0 -1
  79. package/dist/assets/index-mRmSAB-e.css +0 -1
  80. package/dist/assets/loader-circle-C6gg2m2a.js +0 -1
  81. package/dist/assets/marketplace-page-0sEdt5sA.js +0 -1
  82. package/dist/assets/mcp-marketplace-page-B8vmu9xe.js +0 -1
  83. package/dist/assets/message-square-CLVODA23.js +0 -1
  84. package/dist/assets/play-DeNVUA5C.js +0 -1
  85. package/dist/assets/plus-BptLViq1.js +0 -1
  86. package/dist/assets/remote-pzp4oLcL.js +0 -1
  87. package/dist/assets/skeleton-5Mg6vZHN.js +0 -1
  88. 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-BnNAQpVM.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-BlNhrQUG.js";import{t as p}from"./dist-DtBFqZ6_.js";import{C as m,E as h,S as g,T as _,w as v,x as y}from"./select-DRDejPLk.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
+ 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-C_GFKVuW.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
+ 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-BnNAQpVM.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-C51456xV.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
+ 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-BnNAQpVM.js";import{At as i}from"./api-C51456xV.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./dialog-BHcaU6NE.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
+ 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-BnNAQpVM.js";import{Bt as i,Ht as a,Lt as o,Ut as s,Vt as c}from"./api-C51456xV.js";import{t as l}from"./createLucideIcon-C_GFKVuW.js";import{a as u,i as d,n as f,r as p,t as m}from"./select-DRDejPLk.js";import{t as h}from"./skeleton-5Mg6vZHN.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
+ 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-BnNAQpVM.js";import{bt as n}from"./api-C51456xV.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};
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-CAYF44Dz.js"></script>
82
- <link rel="modulepreload" crossorigin href="/assets/i18n-BnNAQpVM.js">
83
- <link rel="modulepreload" crossorigin href="/assets/api-C51456xV.js">
84
- <link rel="modulepreload" crossorigin href="/assets/es2015-BlNhrQUG.js">
85
- <link rel="modulepreload" crossorigin href="/assets/createLucideIcon-C_GFKVuW.js">
86
- <link rel="modulepreload" crossorigin href="/assets/select-DRDejPLk.js">
87
- <link rel="modulepreload" crossorigin href="/assets/dist-DtBFqZ6_.js">
88
- <link rel="modulepreload" crossorigin href="/assets/x-BjMO7v8q.js">
89
- <link rel="modulepreload" crossorigin href="/assets/dialog-BHcaU6NE.js">
90
- <link rel="modulepreload" crossorigin href="/assets/popover-B8msg2FQ.js">
91
- <link rel="modulepreload" crossorigin href="/assets/tooltip-C6VPreZ7.js">
92
- <link rel="modulepreload" crossorigin href="/assets/chunk-JZWAC4HX-ptDyT_1C.js">
93
- <link rel="modulepreload" crossorigin href="/assets/use-config-DFja1sda.js">
94
- <link rel="modulepreload" crossorigin href="/assets/theme-provider-dHqcWU-j.js">
95
- <link rel="modulepreload" crossorigin href="/assets/search-DZSNKEGp.js">
96
- <link rel="modulepreload" crossorigin href="/assets/book-open-B4mOKdz8.js">
97
- <link rel="modulepreload" crossorigin href="/assets/external-link-DP2IJ7AM.js">
98
- <link rel="modulepreload" crossorigin href="/assets/folder-BPwc278w.js">
99
- <link rel="modulepreload" crossorigin href="/assets/logos-BcELLmYh.js">
100
- <link rel="modulepreload" crossorigin href="/assets/loader-circle-C6gg2m2a.js">
101
- <link rel="modulepreload" crossorigin href="/assets/plus-BptLViq1.js">
102
- <link rel="modulepreload" crossorigin href="/assets/refresh-ccw-CeG203yU.js">
103
- <link rel="modulepreload" crossorigin href="/assets/settings-DjvNMJde.js">
104
- <link rel="modulepreload" crossorigin href="/assets/sparkles-CyDTgTM4.js">
105
- <link rel="modulepreload" crossorigin href="/assets/trash-2-C1cdqL6V.js">
106
- <link rel="modulepreload" crossorigin href="/assets/doc-browser-context-Dib9sS83.js">
107
- <link rel="modulepreload" crossorigin href="/assets/doc-browser-CoKIUCJj.js">
108
- <link rel="modulepreload" crossorigin href="/assets/doc-browser-CwgI7ipB.js">
109
- <link rel="modulepreload" crossorigin href="/assets/use-viewport-layout-D-pjxsyz.js">
110
- <link rel="modulepreload" crossorigin href="/assets/logo-badge-uB4SwANR.js">
111
- <link rel="modulepreload" crossorigin href="/assets/skeleton-5Mg6vZHN.js">
112
- <link rel="modulepreload" crossorigin href="/assets/chat-BxA-mw53.js">
113
- <link rel="modulepreload" crossorigin href="/assets/key-round-BQXmPSxD.js">
114
- <link rel="modulepreload" crossorigin href="/assets/message-square-CLVODA23.js">
115
- <link rel="modulepreload" crossorigin href="/assets/app-navigation.config-Dve1W20Y.js">
116
- <link rel="modulepreload" crossorigin href="/assets/notice-card-C9PFAR67.js">
117
- <link rel="modulepreload" crossorigin href="/assets/status-dot-aQU9Mia4.js">
118
- <link rel="modulepreload" crossorigin href="/assets/app-manager-provider-D_cKqqRG.js">
119
- <link rel="stylesheet" crossorigin href="/assets/index-mRmSAB-e.css">
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.14",
3
+ "version": "0.12.15",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -28,9 +28,9 @@
28
28
  "tailwind-merge": "^2.5.4",
29
29
  "zod": "^3.23.8",
30
30
  "zustand": "^5.0.2",
31
- "@nextclaw/agent-chat": "0.1.10",
32
- "@nextclaw/agent-chat-ui": "0.3.9",
33
31
  "@nextclaw/ncp-http-agent-client": "0.3.17",
32
+ "@nextclaw/agent-chat": "0.1.10",
33
+ "@nextclaw/agent-chat-ui": "0.3.10",
34
34
  "@nextclaw/ncp-react": "0.4.25",
35
35
  "@nextclaw/ncp": "0.5.5"
36
36
  },
@@ -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 { formatDateTime, t } from '@/shared/lib/i18n';
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 iconTone = active ? 'text-gray-700' : 'text-gray-500';
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="grid grid-cols-[minmax(0,1fr)_auto] items-center gap-1.5 pr-8">
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
- {shouldShowAgentAvatar ? (
125
+ {agentId?.trim() && agentId.trim().toLowerCase() !== 'main' ? (
130
126
  <AgentAvatar
131
- agentId={normalizedAgentId}
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={iconTone} />
148
+ <SessionContextIconNode icon={context.icon} className={active ? 'text-gray-700' : 'text-gray-500'} />
153
149
  </span>
154
150
  ) : null}
155
151
  </span>
156
- <span className="inline-flex shrink-0 items-center justify-end gap-1.5">
157
- {showUnreadDot ? (
158
- <span
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
- </span>
156
+ ) : null}
167
157
  </div>
168
- <div className="mt-0.5 text-[11px] text-gray-400 truncate">
169
- <span>
170
- {agentLabel?.trim() ? `${agentLabel} · ` : ''}{session.messageCount} · {formatDateTime(session.updatedAt)}
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'
@@ -146,4 +146,33 @@ describe('NcpChatInputManager', () => {
146
146
  expect(streamActionsManager.sendMessage).not.toHaveBeenCalled();
147
147
  expect(sessionListManager.promoteRootDraftSessionRoute).not.toHaveBeenCalled();
148
148
  });
149
+
150
+ it('still attempts to send when provider metadata is stale or the session type is marked unavailable', async () => {
151
+ useChatInputStore.setState({
152
+ snapshot: {
153
+ ...useChatInputStore.getState().snapshot,
154
+ isProviderStateResolved: true,
155
+ modelOptions: [],
156
+ sessionTypeUnavailable: true,
157
+ },
158
+ });
159
+ const streamActionsManager = {
160
+ sendMessage: vi.fn().mockResolvedValue(undefined),
161
+ stopCurrentRun: vi.fn().mockResolvedValue(undefined),
162
+ } as unknown as ConstructorParameters<typeof NcpChatInputManager>[1];
163
+ const sessionListManager = {
164
+ ensureDraftSession: vi.fn(() => 'draft-session'),
165
+ promoteRootDraftSessionRoute: vi.fn(),
166
+ } as unknown as ConstructorParameters<typeof NcpChatInputManager>[2];
167
+ const manager = new NcpChatInputManager(
168
+ {} as ConstructorParameters<typeof NcpChatInputManager>[0],
169
+ streamActionsManager,
170
+ sessionListManager,
171
+ );
172
+
173
+ await manager.send();
174
+
175
+ expect(streamActionsManager.sendMessage).toHaveBeenCalledTimes(1);
176
+ expect(sessionListManager.promoteRootDraftSessionRoute).toHaveBeenCalledWith('current-route-session');
177
+ });
149
178
  });
@@ -212,13 +212,39 @@ describe('buildModelToolbarSelect', () => {
212
212
  });
213
213
 
214
214
  expect(select.value).toBe('minimax/MiniMax-M2.7');
215
- expect(select.selectedLabel).toBe('MiniMax/MiniMax-M2.7');
215
+ expect(select.selectedLabel).toBe('MiniMax-M2.7');
216
216
  expect(select.options[0]).toEqual({
217
217
  value: 'minimax/MiniMax-M2.7',
218
218
  label: 'MiniMax/MiniMax-M2.7'
219
219
  });
220
220
  });
221
221
 
222
+ it('keeps provider labels in the dropdown while using only the model name in the trigger', () => {
223
+ const select = buildModelToolbarSelect({
224
+ modelOptions: [
225
+ {
226
+ value: 'anthropic/claude-sonnet-4-very-long-name',
227
+ modelLabel: 'claude-sonnet-4-very-long-name',
228
+ providerLabel: 'Anthropic'
229
+ }
230
+ ],
231
+ recentModelValues: [],
232
+ selectedModel: 'anthropic/claude-sonnet-4-very-long-name',
233
+ isModelOptionsLoading: false,
234
+ hasModelOptions: true,
235
+ onValueChange: vi.fn(),
236
+ texts: {
237
+ modelSelectPlaceholder: 'Select model',
238
+ modelNoOptionsLabel: 'No models',
239
+ recentModelsLabel: 'Recent',
240
+ allModelsLabel: 'All models'
241
+ }
242
+ });
243
+
244
+ expect(select.selectedLabel).toBe('claude-sonnet-4-very-long-name');
245
+ expect(select.options[0]?.label).toBe('Anthropic/claude-sonnet-4-very-long-name');
246
+ });
247
+
222
248
  it('groups recent models ahead of the remaining catalog', () => {
223
249
  const select = buildModelToolbarSelect({
224
250
  modelOptions: [
@@ -52,7 +52,9 @@ export function buildModelStateHint(params: {
52
52
  };
53
53
  }
54
54
 
55
- export function buildModelToolbarSelect(params: {
55
+ export function buildModelToolbarSelect({
56
+ modelOptions, recentModelValues, selectedModel, isModelOptionsLoading, hasModelOptions, onValueChange, texts,
57
+ }: {
56
58
  modelOptions: ChatModelRecord[];
57
59
  recentModelValues?: string[];
58
60
  selectedModel: string;
@@ -67,22 +69,21 @@ export function buildModelToolbarSelect(params: {
67
69
  | "allModelsLabel"
68
70
  >;
69
71
  }): ChatToolbarSelect {
70
- const selectedModelOption = params.modelOptions.find(
71
- (option) => option.value === params.selectedModel,
72
+ const selectedModelOption = modelOptions.find(
73
+ (option) => option.value === selectedModel,
72
74
  );
73
- const fallbackModelOption = params.modelOptions[0];
74
- const resolvedModelOption = selectedModelOption ?? fallbackModelOption;
75
- const resolvedValue = params.hasModelOptions
75
+ const resolvedModelOption = selectedModelOption ?? modelOptions[0];
76
+ const resolvedValue = hasModelOptions
76
77
  ? resolvedModelOption?.value
77
78
  : undefined;
78
- const recentValueSet = new Set(params.recentModelValues ?? []);
79
+ const recentValueSet = new Set(recentModelValues ?? []);
79
80
  const modelOptionMap = new Map(
80
- params.modelOptions.map((option) => [option.value, option] as const),
81
+ modelOptions.map((option) => [option.value, option] as const),
81
82
  );
82
- const recentOptions = (params.recentModelValues ?? [])
83
+ const recentOptions = (recentModelValues ?? [])
83
84
  .map((value) => modelOptionMap.get(value))
84
85
  .filter((option): option is ChatModelRecord => Boolean(option));
85
- const remainingOptions = params.modelOptions.filter(
86
+ const remainingOptions = modelOptions.filter(
86
87
  (option) => !recentValueSet.has(option.value),
87
88
  );
88
89
  const optionGroups =
@@ -90,7 +91,7 @@ export function buildModelToolbarSelect(params: {
90
91
  ? [
91
92
  {
92
93
  key: "recent-models",
93
- label: params.texts.recentModelsLabel,
94
+ label: texts.recentModelsLabel,
94
95
  options: recentOptions.map((option) => ({
95
96
  value: option.value,
96
97
  label: formatModelOptionLabel(option),
@@ -98,7 +99,7 @@ export function buildModelToolbarSelect(params: {
98
99
  },
99
100
  {
100
101
  key: "all-models",
101
- label: params.texts.allModelsLabel,
102
+ label: texts.allModelsLabel,
102
103
  options: remainingOptions.map((option) => ({
103
104
  value: option.value,
104
105
  label: formatModelOptionLabel(option),
@@ -110,20 +111,20 @@ export function buildModelToolbarSelect(params: {
110
111
  return {
111
112
  key: "model",
112
113
  value: resolvedValue,
113
- placeholder: params.texts.modelSelectPlaceholder,
114
+ placeholder: texts.modelSelectPlaceholder,
114
115
  selectedLabel: resolvedModelOption
115
- ? formatModelOptionLabel(resolvedModelOption)
116
+ ? resolvedModelOption.modelLabel.trim() || formatModelOptionLabel(resolvedModelOption)
116
117
  : undefined,
117
118
  icon: "sparkles",
118
- options: params.modelOptions.map((option) => ({
119
+ options: modelOptions.map((option) => ({
119
120
  value: option.value,
120
121
  label: formatModelOptionLabel(option),
121
122
  })),
122
123
  groups: optionGroups,
123
- disabled: !params.hasModelOptions,
124
- loading: params.isModelOptionsLoading,
125
- emptyLabel: params.texts.modelNoOptionsLabel,
126
- onValueChange: params.onValueChange,
124
+ disabled: !hasModelOptions,
125
+ loading: isModelOptionsLoading,
126
+ emptyLabel: texts.modelNoOptionsLabel,
127
+ onValueChange,
127
128
  };
128
129
  }
129
130