@nextclaw/ui 0.15.5 → 0.15.6

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 (147) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/assets/api-Dyb5rgh0.js +13 -0
  3. package/dist/assets/app-presenter-provider-7jV0nPiL.js +106 -0
  4. package/dist/assets/{appearance-settings-page-80fLa4-9.js → appearance-settings-page-DFm3BbEb.js} +1 -1
  5. package/dist/assets/{book-open-CN7Shpij.js → book-open-L6LCuqOr.js} +1 -1
  6. package/dist/assets/{channels-list-page-R7M6pzp6.js → channels-list-page-DOaPKNJA.js} +2 -2
  7. package/dist/assets/{chat-page-152YuwfU.js → chat-page-Cw9uDhD_.js} +1 -1
  8. package/dist/assets/{config-split-page-BlfvfmTm.js → config-split-page-CqlqjnCK.js} +1 -1
  9. package/dist/assets/{confirm-dialog-Dt8Kdbgp.js → confirm-dialog-bAp8NU93.js} +1 -1
  10. package/dist/assets/desktop-update-config-2SjMfCMl.js +1 -0
  11. package/dist/assets/{dist-D5ycbwCo.js → dist-CrtbGLlh.js} +1 -1
  12. package/dist/assets/doc-browser-A5IRyDXQ2.js +1 -0
  13. package/dist/assets/{doc-browser-C9u7N9vH.js → doc-browser-BmnQa30-.js} +1 -1
  14. package/dist/assets/{doc-browser-context-CCdW9TJf.js → doc-browser-context-BlpUUFrR.js} +1 -1
  15. package/dist/assets/{download-CyPgglKr.js → download-BhZZNXD8.js} +1 -1
  16. package/dist/assets/{external-link-BahW1sl3.js → external-link-B9Uoq5J7.js} +1 -1
  17. package/dist/assets/{eye-D8gGXMkD.js → eye-K5knauEM.js} +1 -1
  18. package/dist/assets/{folder-DGWqFDvE.js → folder-BIYZZWJv.js} +1 -1
  19. package/dist/assets/{form-actions-D2imZLnU.js → form-actions-CKprWFeM.js} +1 -1
  20. package/dist/assets/index-BVn702m4.css +1 -0
  21. package/dist/assets/{index-CT0iYlxV.js → index-CFxJ1Fkg.js} +2 -2
  22. package/dist/assets/loader-circle-Bj2RMrCR.js +1 -0
  23. package/dist/assets/{logo-badge-CuPetu-v.js → logo-badge-BQ-XFZod.js} +1 -1
  24. package/dist/assets/mcp-marketplace-page-BfA7A3n4.js +9 -0
  25. package/dist/assets/mcp-marketplace-page-CXHYO95j.js +1 -0
  26. package/dist/assets/{model-config-page-DiJcvBML.js → model-config-page-BbWbW_qM.js} +1 -1
  27. package/dist/assets/plus-TmFdwO3P.js +1 -0
  28. package/dist/assets/{popover-Btp7KVc3.js → popover-CX9zFsuc.js} +1 -1
  29. package/dist/assets/{provider-scoped-model-input-DZMtoAJG.js → provider-scoped-model-input-B-9_DtIP.js} +1 -1
  30. package/dist/assets/providers-config-page-xwIjGur2.js +1 -0
  31. package/dist/assets/{react-BY-U3h3t.js → react-DsgudwpT.js} +1 -1
  32. package/dist/assets/{refresh-cw-Cme5qFej.js → refresh-cw-kXdvbhFf.js} +1 -1
  33. package/dist/assets/remote-B9F2uCk9.js +1 -0
  34. package/dist/assets/rotate-cw-DEc6aihr.js +1 -0
  35. package/dist/assets/runtime-config-page-DTsi7czJ.js +1 -0
  36. package/dist/assets/{save-DNg2yJTS.js → save-C9qpz2_2.js} +1 -1
  37. package/dist/assets/{search-3ykfrAFt.js → search-_kEi29qo.js} +1 -1
  38. package/dist/assets/{search-config-page-DrVKa_Ls.js → search-config-page-H7ug8f4D.js} +1 -1
  39. package/dist/assets/{secrets-config-page-B39uQ5kF.js → secrets-config-page-C1_6rINu.js} +2 -2
  40. package/dist/assets/security-config-Cr2ERKLu.js +1 -0
  41. package/dist/assets/{select-B5EecXJt.js → select-MJKhKAWR.js} +1 -1
  42. package/dist/assets/{setting-row-Qv1Ps79v.js → setting-row-DA3tJuew.js} +1 -1
  43. package/dist/assets/{settings-2-D-3um9Az.js → settings-2-D_y7zXJz.js} +1 -1
  44. package/dist/assets/{skeleton-BgkzQd4U.js → skeleton-0uTLUhm9.js} +1 -1
  45. package/dist/assets/{tabs-BVD8gp3y.js → tabs-h44XPocd.js} +1 -1
  46. package/dist/assets/{tag-chip-0qn-f3Bo.js → tag-chip-bRZ04q3C.js} +1 -1
  47. package/dist/assets/{trash-2-cnsMppRC.js → trash-2-BRpSE-Wt.js} +1 -1
  48. package/dist/assets/use-config-CwDEAl6f.js +1 -0
  49. package/dist/assets/{use-confirm-dialog-C_o0eQeH.js → use-confirm-dialog-BbnWw-8c.js} +1 -1
  50. package/dist/assets/{use-viewport-layout-BWav4KCL.js → use-viewport-layout-CqgIMDQL.js} +1 -1
  51. package/dist/assets/x-DdEDL6ju.js +1 -0
  52. package/dist/index.html +29 -29
  53. package/package.json +8 -8
  54. package/src/features/chat/components/conversation/__tests__/chat-conversation-header-section.test.tsx +84 -1
  55. package/src/features/chat/components/conversation/chat-conversation-header-section.tsx +13 -2
  56. package/src/features/chat/components/layout/__tests__/chat-sidebar-test.utils.ts +22 -0
  57. package/src/features/chat/components/layout/__tests__/chat-sidebar.test.tsx +13 -24
  58. package/src/features/chat/components/layout/chat-sidebar-desktop-layout.tsx +16 -4
  59. package/src/features/chat/components/layout/chat-sidebar.tsx +38 -2
  60. package/src/features/chat/features/conversation/components/__tests__/session-conversation-area.test.tsx +1 -0
  61. package/src/features/chat/features/conversation/components/__tests__/session-conversation-input.streaming.test.tsx +52 -2
  62. package/src/features/chat/features/conversation/components/session-conversation-area.tsx +22 -0
  63. package/src/features/chat/features/conversation/components/session-conversation-input.tsx +8 -9
  64. package/src/features/chat/features/conversation/hooks/__tests__/use-session-conversation-input-state.test.tsx +55 -0
  65. package/src/features/chat/features/conversation/hooks/use-session-conversation-input-state.ts +12 -11
  66. package/src/features/chat/features/conversation/hooks/use-session-conversation-preference-actions.ts +94 -0
  67. package/src/features/chat/features/input/hooks/__tests__/use-chat-input-surface-state.test.tsx +37 -0
  68. package/src/features/chat/features/input/hooks/use-chat-input-surface-state.ts +140 -63
  69. package/src/features/chat/features/input/input-surface-plugins/__tests__/context-reference-plugin.test.ts +175 -0
  70. package/src/features/chat/features/input/input-surface-plugins/__tests__/slash-command-plugin.test.ts +23 -0
  71. package/src/features/chat/features/input/input-surface-plugins/chat-input-product-plugin-adapters.types.ts +8 -1
  72. package/src/features/chat/features/input/input-surface-plugins/context-reference-plugin.utils.ts +274 -0
  73. package/src/features/chat/features/input/input-surface-plugins/slash-command-plugin.utils.ts +4 -1
  74. package/src/features/chat/features/input/utils/__tests__/chat-composer-state.utils.test.ts +26 -0
  75. package/src/features/chat/features/input/utils/__tests__/chat-inline-token.utils.test.ts +50 -4
  76. package/src/features/chat/features/input/utils/chat-composer-state.utils.ts +4 -10
  77. package/src/features/chat/features/input/utils/chat-composer-token-protocol.utils.ts +29 -0
  78. package/src/features/chat/features/input/utils/chat-inline-token.utils.ts +66 -8
  79. package/src/features/chat/features/input/utils/chat-input-bar.utils.ts +1 -0
  80. package/src/features/chat/features/ncp/hooks/__tests__/use-hydrated-ncp-agent.test.tsx +41 -3
  81. package/src/features/chat/features/project/components/__tests__/chat-project-create-dialog.test.tsx +67 -0
  82. package/src/features/chat/features/project/components/chat-project-create-dialog.tsx +203 -0
  83. package/src/features/chat/features/session/components/session-header/__tests__/chat-session-header-actions.test.tsx +7 -7
  84. package/src/features/chat/features/session/components/session-header/__tests__/chat-session-project-dialog.test.tsx +47 -0
  85. package/src/features/chat/features/session/components/session-header/chat-session-header-actions.tsx +6 -3
  86. package/src/features/chat/features/session/components/session-header/chat-session-project-badge.tsx +3 -0
  87. package/src/features/chat/features/session/components/session-header/chat-session-project-dialog.tsx +3 -0
  88. package/src/features/chat/features/session/components/session-header/chat-session-switcher-groups.tsx +245 -0
  89. package/src/features/chat/features/session/components/session-header/chat-session-title-switcher.tsx +81 -127
  90. package/src/features/chat/features/session/utils/__tests__/chat-sidebar-session-groups.utils.test.ts +22 -0
  91. package/src/features/chat/features/session/utils/chat-run-metadata.utils.ts +6 -6
  92. package/src/features/chat/features/session/utils/chat-sidebar-session-groups.utils.ts +12 -1
  93. package/src/features/chat/features/welcome/components/chat-conversation-welcome.tsx +3 -0
  94. package/src/features/chat/features/welcome/components/chat-welcome.tsx +1 -0
  95. package/src/features/chat/features/welcome/utils/__tests__/chat-welcome-project-options.utils.test.ts +20 -0
  96. package/src/features/chat/features/welcome/utils/chat-welcome-project-options.utils.ts +15 -2
  97. package/src/features/chat/pages/__tests__/ncp-chat-page.test.ts +23 -0
  98. package/src/features/settings/components/config/provider-form.tsx +0 -4
  99. package/src/features/settings/utils/__tests__/provider-form-support.utils.test.ts +7 -9
  100. package/src/features/settings/utils/provider-form-model.utils.ts +0 -4
  101. package/src/features/system-status/hooks/use-current-version-release-notes-link.ts +33 -0
  102. package/src/features/system-status/index.ts +9 -0
  103. package/src/features/system-status/utils/update-release-notes.utils.ts +44 -3
  104. package/src/index.css +10 -16
  105. package/src/shared/components/common/__tests__/brand-header.test.tsx +110 -3
  106. package/src/shared/components/common/brand-header.tsx +121 -35
  107. package/src/shared/components/path-picker/__tests__/server-path-picker-dialog.test.tsx +288 -38
  108. package/src/shared/components/path-picker/server-path-picker-dialog.tsx +290 -199
  109. package/src/shared/components/path-picker/server-path-picker-directory-list.tsx +103 -0
  110. package/src/shared/components/path-picker/server-path-picker-footer.tsx +58 -0
  111. package/src/shared/components/path-picker/server-path-picker-locations.tsx +148 -0
  112. package/src/shared/components/path-picker/server-path-picker-navigation-bar.tsx +198 -0
  113. package/src/shared/components/path-picker/server-path-picker-new-folder.tsx +59 -0
  114. package/src/shared/components/path-picker/server-path-picker-toolbar.tsx +25 -0
  115. package/src/shared/hooks/use-projects.ts +28 -0
  116. package/src/shared/hooks/use-server-path-create-directory.ts +6 -0
  117. package/src/shared/hooks/use-server-path-search.ts +40 -0
  118. package/src/shared/lib/api/index.ts +1 -0
  119. package/src/shared/lib/api/projects/project.utils.ts +14 -0
  120. package/src/shared/lib/api/types.ts +27 -0
  121. package/src/shared/lib/api/utils/server-path.utils.ts +21 -1
  122. package/src/shared/lib/i18n/locales/en-US/chat.json +35 -2
  123. package/src/shared/lib/i18n/locales/en-US/core.json +2 -3
  124. package/src/shared/lib/i18n/locales/en-US/desktop-update.json +4 -0
  125. package/src/shared/lib/i18n/locales/en-US/path-picker.json +25 -0
  126. package/src/shared/lib/i18n/locales/zh-CN/chat.json +35 -2
  127. package/src/shared/lib/i18n/locales/zh-CN/core.json +2 -3
  128. package/src/shared/lib/i18n/locales/zh-CN/desktop-update.json +4 -0
  129. package/src/shared/lib/i18n/locales/zh-CN/path-picker.json +25 -0
  130. package/dist/assets/api-IlX_CbwU.js +0 -13
  131. package/dist/assets/app-presenter-provider-Bbl_MVbg.js +0 -106
  132. package/dist/assets/desktop-update-config-DreMJu9z.js +0 -1
  133. package/dist/assets/doc-browser-DJQ5XPsi2.js +0 -1
  134. package/dist/assets/index-0av6WO9-.css +0 -1
  135. package/dist/assets/loader-circle-DtKek-qG.js +0 -1
  136. package/dist/assets/mcp-marketplace-page-4qMwFDpz.js +0 -1
  137. package/dist/assets/mcp-marketplace-page-BbxN5aZF.js +0 -9
  138. package/dist/assets/plus-BwgE-Zwf.js +0 -1
  139. package/dist/assets/providers-config-page-DfiWveEF.js +0 -1
  140. package/dist/assets/remote-BaVECEZw.js +0 -1
  141. package/dist/assets/rotate-cw-CMRZxIkH.js +0 -1
  142. package/dist/assets/runtime-config-page-wygwvMB4.js +0 -1
  143. package/dist/assets/security-config-BPzet76z.js +0 -1
  144. package/dist/assets/use-config-D6yx0lb0.js +0 -1
  145. package/dist/assets/x-B3o1dWR5.js +0 -1
  146. package/src/features/chat/features/input/input-surface-plugins/__tests__/panel-app-reference-plugin.test.ts +0 -77
  147. package/src/features/chat/features/input/input-surface-plugins/panel-app-reference-plugin.utils.ts +0 -144
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/model-config-page-DiJcvBML.js","assets/chunk-DseTPa7n.js","assets/api-IlX_CbwU.js","assets/react-BY-U3h3t.js","assets/book-open-CN7Shpij.js","assets/dist-D5ycbwCo.js","assets/provider-scoped-model-input-DZMtoAJG.js","assets/select-B5EecXJt.js","assets/popover-Btp7KVc3.js","assets/provider-models-BoUhFo9R.js","assets/folder-DGWqFDvE.js","assets/loader-circle-DtKek-qG.js","assets/skeleton-BgkzQd4U.js","assets/doc-browser-context-CCdW9TJf.js","assets/middleware-CAXxl-af.js","assets/form-actions-D2imZLnU.js","assets/use-config-D6yx0lb0.js","assets/config-hints-LxG80Uj5.js","assets/appearance-settings-page-80fLa4-9.js","assets/app-presenter-provider-Bbl_MVbg.js","assets/preload-helper-D4M6sveU.js","assets/confirm-dialog-Dt8Kdbgp.js","assets/x-B3o1dWR5.js","assets/doc-browser-C9u7N9vH.js","assets/search-3ykfrAFt.js","assets/external-link-BahW1sl3.js","assets/plus-BwgE-Zwf.js","assets/refresh-cw-Cme5qFej.js","assets/use-confirm-dialog-C_o0eQeH.js","assets/download-CyPgglKr.js","assets/eye-D8gGXMkD.js","assets/tabs-BVD8gp3y.js","assets/use-viewport-layout-BWav4KCL.js","assets/trash-2-cnsMppRC.js","assets/logo-badge-CuPetu-v.js","assets/host-capabilities-CFbAfrrA.js","assets/app-presenter-provider-D3BuuOyZ.css","assets/setting-row-Qv1Ps79v.js","assets/chat-page-152YuwfU.js","assets/settings-2-D-3um9Az.js","assets/tag-chip-0qn-f3Bo.js","assets/search-config-page-DrVKa_Ls.js","assets/config-split-page-BlfvfmTm.js","assets/providers-config-page-DfiWveEF.js","assets/channels-list-page-R7M6pzp6.js","assets/runtime-config-page-wygwvMB4.js","assets/rotate-cw-CMRZxIkH.js","assets/save-DNg2yJTS.js","assets/desktop-update-config-DreMJu9z.js","assets/security-config-BPzet76z.js","assets/secrets-config-page-B39uQ5kF.js","assets/remote-BaVECEZw.js","assets/mcp-marketplace-page-4qMwFDpz.js","assets/mcp-marketplace-page-BbxN5aZF.js"])))=>i.map(i=>d[i]);
2
- import{i as e,t}from"./chunk-DseTPa7n.js";import{h as n,m as r,p as i,r as a,u as o}from"./react-BY-U3h3t.js";import{t as s}from"./preload-helper-D4M6sveU.js";import{B as c,E as l,T as u,_t as d,a as f,at as p,b as m,dt as h,f as g,ft as _,gt as v,h as y,ht as b,i as x,m as S,mt as C,ot as w,p as T,pt as E,r as D,st as O,t as k,u as ee,ut as te,v as ne,y as re,z as ie}from"./app-presenter-provider-Bbl_MVbg.js";import{$t as ae,A as oe,F as se,Gt as ce,Jt as le,Kt as A,M as ue,Mt as j,N as de,P as fe,Qt as pe,Tt as M,Wt as me,Xt as he,Zt as ge,an as N,dn as _e,en as ve,f as P,fn as ye,ft as F,gt as be,ht as xe,in as Se,j as Ce,ln as we,mn as Te,nn as Ee,pn as De,qt as Oe,rn as ke,tn as Ae,un as I,wt as je,yt as L,zt as Me}from"./api-IlX_CbwU.js";import{a as R,c as Ne,d as Pe,f as Fe,i as Ie,l as Le,n as Re,o as z,r as ze,s as B,u as V}from"./mcp-marketplace-page-BbxN5aZF.js";import{c as H}from"./dist-D5ycbwCo.js";import{n as Be}from"./search-3ykfrAFt.js";import{a as Ve,c as He,o as U,s as Ue}from"./doc-browser-C9u7N9vH.js";import{i as We,n as Ge,r as W,t as Ke}from"./use-confirm-dialog-C_o0eQeH.js";import{t as qe}from"./download-CyPgglKr.js";import{t as Je}from"./external-link-BahW1sl3.js";import{i as Ye,r as Xe,t as Ze}from"./tabs-BVD8gp3y.js";import{t as Qe}from"./use-viewport-layout-BWav4KCL.js";import{t as $e}from"./refresh-cw-Cme5qFej.js";import{n as et}from"./skeleton-BgkzQd4U.js";import{t as tt}from"./trash-2-cnsMppRC.js";import{t as nt}from"./host-capabilities-CFbAfrrA.js";import{n as rt,t as it}from"./doc-browser-context-CCdW9TJf.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var at=t((e=>{var t=r();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}));function ot(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function st(e,t,n){let r=e.slice(0);return r[t]=n,r}var ct=class extends Te{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,I.batch(()=>{let e=this.#i,t=this.#f(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!De(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(ot(e,n).forEach(e=>{e.destroy()}),ot(n,e).forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})),this.#m()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#f(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=ye(this.#a,t(e))),this.#a}return e}#f(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new we(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=st(this.#t,n,t),this.#m())}#m(){if(this.hasListeners()){let e=this.#a,t=this.#u(this.#t,this.#l);e!==this.#d(t,this.#r?.combine)&&I.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},G=e(n(),1);function lt({queries:e,...t},n){let r=N(n),i=ke(),a=Ee(),o=G.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{he(e),ae(e,a,r.getQueryCache().get(e.queryHash))}),Ae(a);let[s]=G.useState(()=>new ct(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;G.useSyncExternalStore(G.useCallback(e=>d?s.subscribe(I.batchCalls(e)):_e,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),G.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>pe(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&pe(n,e)?ge(n,new we(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&ve({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}var ut=H(`BriefcaseBusiness`,[[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2`,key:`1ksdt3`}],[`path`,{d:`M22 13a18.15 18.15 0 0 1-20 0`,key:`12hx5q`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]),dt=H(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),ft=H(`Compass`,[[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),pt=H(`MessagesSquare`,[[`path`,{d:`M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z`,key:`p1xzt8`}],[`path`,{d:`M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1`,key:`1cx29u`}]]),mt=H(`PenLine`,[[`path`,{d:`M12 20h9`,key:`t2du7b`}],[`path`,{d:`M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z`,key:`1ykcvy`}]]),ht=H(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),gt=at();function K(e){return Array.from(new Set(e.map(e=>e.spec).filter(Boolean)))}function _t(e){let{request:t,result:n}=e,r=new Date().toISOString();return n.type===`skill`?{type:`skill`,spec:n.spec,id:t.skill??n.spec,label:t.skill??n.name??n.spec,source:`workspace`,installPath:t.installPath,installedAt:r}:{type:n.type,spec:n.spec,id:n.name??n.spec,label:n.name??n.spec,source:`marketplace`,origin:`marketplace`,enabled:t.enabled??!0,runtimeStatus:t.enabled===!1?`disabled`:`ready`,installedAt:r}}function q(e,t){let{id:n,spec:r}=t;return!!(r&&e.spec===r||n&&e.id===n)}function vt(e,t){return t??{type:e,total:0,specs:[],records:[]}}function yt(e){let{result:t,view:n}=e,r=vt(t.type,n),i=_t(e),a=r.records.findIndex(e=>q(e,{id:i.id,spec:i.spec})),o=[...r.records];return a>=0?o[a]={...o[a],...i}:o.unshift(i),{...r,type:t.type,records:o,specs:K(o),total:o.length}}function bt(e){let{request:t,result:n,view:r}=e,i=vt(n.type,r);if(n.action===`uninstall`||n.action===`remove`){let e=i.records.filter(e=>!q(e,{id:n.id,spec:t.spec}));return{...i,records:e,specs:K(e),total:e.length}}let a=i.records.map(e=>q(e,{id:n.id,spec:t.spec})?n.action===`disable`?{...e,enabled:!1,runtimeStatus:`disabled`}:n.action===`update`?{...e,installedAt:new Date().toISOString(),origin:e.origin??`marketplace`}:{...e,enabled:!0,runtimeStatus:`ready`}:e);return{...i,records:a,specs:K(a),total:a.length}}function xt(e){let t=Fe({queryKey:[`marketplace-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>Ce({...e,page:t}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0,placeholderData:(t,n)=>{let r=n?.queryKey?.[1];if(!(!r||typeof r!=`object`||!r))return(`type`in r?r.type:void 0)===e.type&&St(r,e)?t:void 0},staleTime:15e3}),n=(0,G.useMemo)(()=>Pe(t.data),[t.data]);return{...t,data:n}}function St(e,t){return e.tag===t.tag&&e.scene===t.scene&&e.pageSize===t.pageSize}function Ct(e=!0){return le({queryKey:[`marketplace-skill-scenes`],queryFn:de,enabled:e,staleTime:6e4})}function wt(e,t=!0){let n=lt({queries:e.map(e=>({queryKey:[`marketplace-skill-scene-count`,e.scene],queryFn:()=>Ce({type:`skill`,scene:e.scene,pageSize:1}),enabled:t&&typeof e.count!=`number`,staleTime:6e4}))});return(0,G.useMemo)(()=>{let t=new Map;return e.forEach((e,r)=>{let i=typeof e.count==`number`?e.count:n[r]?.data?.total;typeof i==`number`&&t.set(e.scene,i)}),t},[n,e])}function Tt(e){return le({queryKey:[`marketplace-installed`,e],queryFn:()=>oe(e),staleTime:1e4})}function Et(){let e=N();return Oe({mutationFn:e=>fe(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>yt({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`}),A.success(t.message||a(`marketplaceInstallSuccessSkill`))},onError:e=>{A.error(e.message||a(`marketplaceInstallFailed`))}})}function Dt(){let e=N();return Oe({mutationFn:e=>se(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>bt({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`});let r=t.action===`enable`?a(`marketplaceEnableSuccess`):t.action===`disable`?a(`marketplaceDisableSuccess`):t.action===`update`?a(`marketplaceUpdateSuccess`):a(`marketplaceUninstallSuccess`);A.success(t.message||r)},onError:e=>{A.error(e.message||a(`marketplaceOperationFailed`))}})}var J=i(),Ot=[`bg-amber-600`,`bg-orange-500`,`bg-yellow-600`,`bg-emerald-600`,`bg-teal-600`,`bg-cyan-600`,`bg-stone-600`,`bg-rose-500`,`bg-violet-500`];function kt(e){let{name:t,fallback:n,className:r}=e,i=t||n,a=i.substring(0,2).toUpperCase();return(0,J.jsx)(`div`,{className:o(`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-sm font-semibold text-white`,At(i),r),children:a})}function At(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return Ot[Math.abs(t)%Ot.length]}function jt({title:e,spec:t}){return(0,J.jsxs)(Ue,{delayDuration:400,children:[(0,J.jsxs)(Ve,{children:[(0,J.jsx)(He,{asChild:!0,children:(0,J.jsx)(`div`,{className:`truncate text-[14px] font-semibold leading-tight text-gray-950`,children:e})}),(0,J.jsx)(U,{className:`max-w-[300px] text-xs`,children:e})]}),(0,J.jsx)(`div`,{className:`mb-2 mt-1 flex min-w-0 items-center gap-1.5`,children:t?(0,J.jsxs)(Ve,{children:[(0,J.jsx)(He,{asChild:!0,children:(0,J.jsx)(`span`,{className:`max-w-full truncate text-[11px] font-mono leading-tight text-gray-400`,children:t})}),(0,J.jsx)(U,{className:`max-w-[300px] break-all font-mono text-xs`,children:t})]}):null})]})}function Mt(e){let{item:t,record:n,state:r,onInstall:i,onManage:s}=e,{isInstalling:c,canUpdate:l,canUninstall:u,busyAction:d}=r,f=!!d;return t&&!n||n&&(l||u)?(0,J.jsxs)(`div`,{className:o(`flex shrink-0 items-center justify-end gap-1.5 opacity-100 transition-opacity duration-150`,`md:pointer-events-none md:opacity-0`,`md:group-hover:pointer-events-auto md:group-hover:opacity-100`,`md:group-focus-within:pointer-events-auto md:group-focus-within:opacity-100`),children:[t&&!n&&(0,J.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),i(t)},disabled:c,className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md bg-primary px-2 text-[11px] font-medium text-white transition-colors hover:bg-primary-600 disabled:opacity-50`,children:[(0,J.jsx)(qe,{className:`h-3 w-3`}),a(c?`marketplaceInstalling`:`marketplaceInstall`)]}),n&&l&&(0,J.jsxs)(`button`,{disabled:f,onClick:e=>{e.stopPropagation(),s(`update`,n)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-blue-200/80 bg-white px-2 text-[11px] font-medium text-blue-600 transition-colors hover:border-blue-300 hover:bg-blue-50 disabled:opacity-50`,children:[(0,J.jsx)($e,{className:`h-3 w-3`}),a(d===`update`?`marketplaceUpdating`:`marketplaceUpdate`)]}),n&&u&&(0,J.jsxs)(`button`,{disabled:f,onClick:e=>{e.stopPropagation(),s(`uninstall`,n)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-gray-200/80 bg-white px-2 text-[11px] font-medium text-gray-500 transition-colors hover:border-rose-200 hover:bg-rose-50 hover:text-rose-600 disabled:opacity-50`,children:[(0,J.jsx)(tt,{className:`h-3 w-3`}),a(d===`uninstall`?`marketplaceRemoving`:`marketplaceUninstall`)]})]}):null}function Nt(e){let{record:t,disabled:n}=e;return t?(0,J.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-end`,children:(0,J.jsx)(Pt,{disabled:n})}):null}function Pt(e){let{disabled:t}=e,n=a(t?`marketplaceDisabledStatus`:`marketplaceInstalledStatus`);return(0,J.jsx)(Ue,{delayDuration:300,children:(0,J.jsxs)(Ve,{children:[(0,J.jsx)(He,{asChild:!0,children:(0,J.jsx)(`span`,{"aria-label":n,className:o(`inline-flex h-5 w-5 items-center justify-center`,t?`text-gray-400`:`text-emerald-700`),children:t?(0,J.jsx)(O,{className:`h-4 w-4 opacity-40`}):(0,J.jsx)(O,{className:`h-4 w-4`})})}),(0,J.jsx)(U,{className:`text-xs`,children:n})]})})}function Ft(e){let{item:t,record:n,installState:r,manageState:i,onOpen:o,onInstall:s,onManage:c}=e,{language:l}=W(),u=z(l),d=t?.name??n?.label??n?.id??n?.spec??a(`marketplaceUnknownItem`),f=B(t?.summaryI18n,t?.summary,u)||(n?a(`marketplaceInstalledLocalSummary`):``),p=t?.install.spec??n?.spec??``,m=t?.tags??[],h=n?.id||n?.spec,g=h?i.actionsByTarget.get(h):void 0,_=n?.type===`skill`&&n.source===`workspace`,v=n?.type===`skill`&&n.origin===`marketplace`,y=n?n.enabled===!1||n.runtimeStatus===`disabled`:!1,b=t?.install.spec,x=typeof b==`string`&&r.installingSpecs.has(b);return(0,J.jsxs)(`article`,{onClick:o,className:`group flex h-full min-h-[156px] cursor-pointer flex-col rounded-xl border border-gray-200/60 bg-white p-3.5 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,J.jsx)(kt,{name:d,fallback:p||a(`marketplaceTypeSkill`),className:`h-9 w-9 rounded-lg text-xs`}),(0,J.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,J.jsx)(jt,{title:d,spec:p})}),(0,J.jsx)(Nt,{record:n,disabled:y})]}),(0,J.jsxs)(`div`,{className:`mt-2 flex min-w-0 flex-1 flex-col`,children:[(0,J.jsx)(`p`,{className:`line-clamp-2 text-left text-[12px] leading-relaxed text-gray-500`,children:f}),(0,J.jsxs)(`div`,{className:`mt-auto flex min-w-0 items-end justify-between gap-2 pt-2`,children:[(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,J.jsx)(It,{tags:m})}),(0,J.jsx)(Mt,{item:t,record:n,state:{isInstalling:x,canUpdate:v,canUninstall:_,busyAction:g},onInstall:s,onManage:c})]})]})]})}function It({tags:e}){let t=e.filter(Lt).slice(0,3);return t.length===0?null:(0,J.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-1.5 overflow-hidden`,children:t.map(e=>(0,J.jsx)(`span`,{className:`max-w-[104px] truncate rounded-md bg-gray-100 px-2 py-0.5 text-[11px] font-medium leading-5 text-gray-500`,children:e},e))})}function Lt(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function Rt({model:e,showTitle:t,operationState:n,scroll:r,actions:i}){let{scope:a,entries:s,header:c,status:l,emptyLabel:u,errorLabel:d}=e,{showSkeleton:f,isRefreshing:p,error:m}=l,{hasMore:h,loadingMore:g,sentinelRef:_}=r,{installState:v,manageState:y}=n,{onOpen:b,onInstall:x,onManage:S}=i;return(0,J.jsxs)(`section`,{className:o(`flex min-h-full flex-col`,t&&`gap-3`),children:[t&&(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-950`,children:c.title}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] text-gray-500`,children:[p&&(0,J.jsx)(`span`,{className:`font-medium text-primary`,children:c.refreshingLabel}),(0,J.jsx)(`span`,{children:c.summary})]})]}),m&&(0,J.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[d,`: `,m.message]}),p&&(0,J.jsx)(`div`,{"data-testid":`marketplace-list-refreshing`,className:`h-0.5 overflow-hidden rounded-full bg-primary/10`,children:(0,J.jsx)(`div`,{className:`h-full w-1/3 animate-pulse rounded-full bg-primary`})}),(0,J.jsxs)(`div`,{"data-testid":f?`marketplace-list-skeleton`:void 0,className:o(`grid grid-cols-1 gap-2.5 md:grid-cols-2 xl:grid-cols-3`,f&&`min-h-0 flex-1 auto-rows-[156px] content-start`),children:[f&&(0,J.jsx)(V,{count:36}),!f&&!m&&s.map(e=>(0,J.jsx)(Ft,{item:e.item,record:e.record,installState:v,manageState:y,onOpen:()=>b(e.item,e.record),onInstall:x,onManage:S},e.key))]}),!f&&!m&&s.length===0&&(0,J.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:u}),a===`all`&&!f&&!m&&(0,J.jsx)(Le,{hasMore:h,loading:g,sentinelRef:_})]})}function zt(e){let{entry:t,language:n,localeFallbacks:r,installState:i,layout:s=`rail`,onOpen:c,onInstall:l}=e,{item:u,record:d}=t,f=B(u.summaryI18n,u.summary,r),p=u.install.spec,m=i.installingSpecs.has(p),h=!!d;return(0,J.jsxs)(`article`,{onClick:()=>c(t),className:o(`group flex min-h-[166px] cursor-pointer flex-col justify-between rounded-xl border border-gray-200/70 bg-white p-3 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,s===`rail`?`w-[260px] shrink-0`:`w-full min-w-0`),children:[(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-start gap-2.5`,children:[(0,J.jsx)(kt,{name:u.name,fallback:u.install.spec}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,J.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-gray-950`,children:u.name}),(0,J.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] font-mono leading-tight text-gray-400`,children:Bt(u)})]})]}),(0,J.jsx)(`p`,{className:`line-clamp-2 text-[12px] leading-relaxed text-gray-500`,children:f}),(0,J.jsx)(Vt,{tags:u.tags})]}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-gray-100 pt-2.5`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-gray-400`,children:Ut(u.updatedAt)}),h?(0,J.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 text-[11px] font-semibold text-emerald-700`,children:[(0,J.jsx)(O,{className:`h-3.5 w-3.5`}),Wt({zh:`已安装`,en:`Installed`},n)]}):(0,J.jsxs)(`button`,{type:`button`,disabled:m,onClick:e=>{e.stopPropagation(),l(u)},className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-gray-200 bg-white px-2 text-[11px] font-semibold text-gray-700 transition-colors hover:border-gray-300 hover:bg-gray-50 disabled:opacity-50`,children:[(0,J.jsx)(qe,{className:`h-3.5 w-3.5`}),a(m?`marketplaceInstalling`:`marketplaceInstall`)]})]})]})}function Bt(e){return e.slug||e.install.spec}function Vt({tags:e}){let t=e.filter(Ht).slice(0,2);return t.length===0?null:(0,J.jsx)(`div`,{className:`mt-auto truncate pt-2 text-[11px] font-medium text-gray-400`,children:t.join(` / `)})}function Ht(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function Ut(e){return e.slice(0,10)||e}function Wt(e,t){return t.startsWith(`zh`)?e.zh:e.en}var Gt=[{scene:`development-debugging`,title:{zh:`开发与调试`,en:`Development`},summary:{zh:`代码审查、错误定位、架构分析与交付验证。`,en:`Review, debug, analyze, and verify delivery work.`},icon:ht,tone:`dark`,span:`md:col-span-2`},{scene:`office-collaboration`,title:{zh:`办公协作`,en:`Office Work`},summary:{zh:`连接文档、日历、会议、邮件和团队通信。`,en:`Connect docs, calendars, meetings, mail, and teams.`},icon:ut,tone:`green`,span:`md:col-span-2`},{scene:`writing-content`,title:{zh:`写作与内容`,en:`Writing`},summary:{zh:`把调研、写作、润色和发布组织成连续工作流。`,en:`Turn research, writing, polishing, and publishing into one flow.`},icon:mt,tone:`amber`,span:`md:col-span-2`},{scene:`browser-automation`,title:{zh:`浏览器自动化`,en:`Browser`},summary:{zh:`操作网页、捕获动态内容并验证真实用户路径。`,en:`Operate pages, capture dynamic content, and verify user paths.`},icon:p,tone:`blue`,span:`md:col-span-2`},{scene:`local-environment`,title:{zh:`本地环境`,en:`Local`},summary:{zh:`管理终端、文件、运行时和本地服务。`,en:`Manage shells, files, runtimes, and local services.`},icon:w,tone:`violet`,span:`md:col-span-1`},{scene:`social-platforms`,title:{zh:`社交平台`,en:`Social`},summary:{zh:`处理发布、互动、检索和内容分发。`,en:`Handle posting, interaction, search, and distribution.`},icon:pt,tone:`sky`,span:`md:col-span-1`},{scene:`nextclaw-official`,title:{zh:`NextClaw 官方`,en:`NextClaw Official`},summary:{zh:`优先查看由 NextClaw 维护的原生能力。`,en:`Browse native capabilities maintained by NextClaw.`},icon:et,tone:`teal`,span:`md:col-span-2`}],Kt={icon:et,tone:`dark`,span:`md:col-span-2`},qt={dark:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-stone-600 bg-stone-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},blue:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-cyan-600 bg-cyan-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},green:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-emerald-600 bg-emerald-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},amber:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-amber-600 bg-amber-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},violet:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-violet-500 bg-violet-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},sky:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-sky-500 bg-sky-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},teal:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-teal-600 bg-teal-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`}},Jt=`grid grid-cols-[repeat(auto-fill,minmax(240px,320px))] justify-start gap-3`;function Yt(e){let{entries:t,scenes:n,isScenesLoading:r,isItemsLoading:i,language:a,installState:o,onOpen:s,onInstall:c,onOpenScene:l}=e,u=z(a),d=[...t].sort((e,t)=>en(e.item,t.item)).slice(0,6);return(0,J.jsxs)(`div`,{className:`mb-4 space-y-5`,children:[(0,J.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,J.jsx)($t,{icon:ft,title:Y({zh:`场景`,en:`Scenes`},a),description:Y({zh:`按使用场景浏览适合的技能组合。`,en:`Browse skills by how you plan to use them.`},a)}),r?(0,J.jsx)(`div`,{"data-testid":`marketplace-scenes-skeleton`,className:`grid auto-rows-[104px] grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:(0,J.jsx)(V,{count:Gt.length})}):(0,J.jsx)(`div`,{className:`grid grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:n.map(e=>(0,J.jsx)(Xt,{scene:e,language:a,onSelect:l},e.scene))})]}),(i||d.length>0)&&(0,J.jsx)(Qt,{icon:dt,title:Y({zh:`最近更新`,en:`Recently updated`},a),description:Y({zh:`看看生态最近在补齐哪些能力。`,en:`See what the ecosystem has been improving lately.`},a),entries:d,language:a,localeFallbacks:u,isLoading:i,installState:o,onOpen:s,onInstall:c})]})}function Xt(e){let{scene:t,language:n,onSelect:r}=e,i=tn(t.scene),a=i.icon,s=qt[i.tone];return(0,J.jsx)(`button`,{type:`button`,onClick:()=>r(t.scene),className:o(`group flex min-h-[74px] flex-col justify-center rounded-lg border px-3 py-2.5 text-left shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/70`,s.card),children:(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`span`,{className:o(`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border`,s.icon),children:(0,J.jsx)(a,{className:`h-3.5 w-3.5`})}),(0,J.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-gray-950`,children:nn(t,i,n)}),typeof t.count==`number`&&(0,J.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:an(t.count,n)})]}),(0,J.jsx)(`p`,{className:o(`mt-1 line-clamp-1 text-[11px] leading-relaxed`,s.text),children:rn(t,i,n)})]})})}function Zt(e){let{scene:t,entries:n,isLoading:r,language:i,localeFallbacks:a,installState:s,onBack:c,onOpen:l,onInstall:u}=e,d=tn(t.scene),f=d.icon,p=qt[d.tone];return(0,J.jsxs)(`section`,{className:`flex min-h-full flex-col`,children:[(0,J.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-start gap-2.5`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:c,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900`,"aria-label":Y({zh:`返回`,en:`Back`},i),children:(0,J.jsx)(Be,{className:`h-4 w-4`})}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`span`,{className:o(`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border`,p.icon),children:(0,J.jsx)(f,{className:`h-4 w-4`})}),(0,J.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[15px] font-semibold text-gray-950`,children:nn(t,d,i)}),(0,J.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:Y(r?{zh:`加载中`,en:`Loading`}:{zh:`${n.length} 个技能`,en:`${n.length} skills`},i)})]}),(0,J.jsx)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-2`,children:(0,J.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[12px] leading-relaxed text-gray-500`,children:rn(t,d,i)})})]})]}),r?(0,J.jsx)(`div`,{"data-testid":`marketplace-scene-skeleton`,className:o(Jt,`min-h-0 flex-1 auto-rows-[166px] content-start`),children:(0,J.jsx)(V,{count:24})}):n.length>0?(0,J.jsx)(`div`,{className:Jt,children:n.map(e=>(0,J.jsx)(zt,{entry:e,language:i,localeFallbacks:a,installState:s,layout:`grid`,onOpen:l,onInstall:u},e.item.id))}):(0,J.jsx)(`div`,{className:`rounded-lg border border-dashed border-gray-200 py-8 text-center text-[12px] text-gray-500`,children:Y({zh:`这个模块暂无技能。`,en:`No skills in this module yet.`},i)})]})}function Qt(e){let{icon:t,title:n,description:r,entries:i,language:a,localeFallbacks:o,isLoading:s,installState:c,onOpen:l,onInstall:u}=e;return(0,J.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,J.jsx)($t,{icon:t,title:n,description:r}),s?(0,J.jsx)(`div`,{"data-testid":`marketplace-recent-skeleton`,className:`-mx-1 grid auto-rows-[166px] grid-cols-[repeat(4,260px)] gap-2.5 overflow-hidden px-1 pb-1.5`,children:(0,J.jsx)(V,{count:4})}):(0,J.jsx)(`div`,{className:`-mx-1 flex gap-2.5 overflow-x-auto px-1 pb-1.5 custom-scrollbar`,children:i.map(e=>(0,J.jsx)(zt,{entry:e,language:a,localeFallbacks:o,installState:c,onOpen:l,onInstall:u},e.item.id))})]})}function $t({icon:e,title:t,description:n}){return(0,J.jsx)(`div`,{className:`flex items-end justify-between gap-4`,children:(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`h3`,{className:`flex items-center gap-2 text-[14px] font-semibold text-gray-950`,children:[(0,J.jsx)(e,{className:`h-4 w-4 text-primary`}),t]}),(0,J.jsx)(`p`,{className:`mt-0.5 text-[12px] leading-relaxed text-gray-500`,children:n})]})})}function en(e,t){let n=Date.parse(e.updatedAt),r=Date.parse(t.updatedAt);return Number.isNaN(n)||Number.isNaN(r)?t.updatedAt.localeCompare(e.updatedAt):r-n}function Y(e,t){return t.startsWith(`zh`)?e.zh:e.en}function tn(e){return Gt.find(t=>t.scene===e)??{scene:e,...Kt}}function nn(e,t,n){return t.title?Y(t.title,n):e.title}function rn(e,t,n){return t.summary?Y(t.summary,n):e.description??e.scene}function an(e,t){return t.startsWith(`zh`)?`${e} 个技能`:`${e} skills`}function on({label:e,className:t,onClick:n}){return(0,J.jsxs)(`button`,{type:`button`,className:o(`inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md px-1.5 text-[13px] font-medium text-primary transition-colors hover:text-primary-hover focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,t),onClick:n,children:[(0,J.jsx)(Je,{className:`h-3.5 w-3.5`}),e]})}var sn=`https://skillhub.cn/`;function cn(){return(0,J.jsx)(on,{label:a(`marketplaceExternalSkillSourceTitle`),onClick:()=>void nt.openExternalUrl(sn)})}function X(e){return(e??``).trim().toLowerCase()}function Z(e,t){let n=X(t);return n.length>0?`${e}:${n}`:``}function ln(e){let t=new Map;for(let n of e){let e=[n.install.spec,n.slug,n.id];for(let r of e){let e=Z(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function un(e){let t=new Map;for(let n of e){let e=[n.spec,n.id,n.label];for(let r of e){let e=Z(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function dn(e,t){let n=[e.install.spec,e.slug,e.id];for(let r of n){let n=Z(e.type,r);if(!n)continue;let i=t.get(n);if(i)return i}}function fn(e,t){return t.get(Z(e.type,e.spec))||t.get(Z(e.type,e.id))||t.get(Z(e.type,e.label))}function pn(e,t,n,r){let i=X(n);if(!i)return!0;let a=B(t?.summaryI18n,t?.summary,r);return[e.id,e.spec,e.label,t?.name,t?.slug,t?.summary,a,...t?.tags??[]].map(e=>X(e)).filter(Boolean).some(e=>e.includes(i))}function mn(e){let{items:t,installedRecordLookup:n,scene:r,forcedType:i,typeFilter:a,scope:o,searchText:s,query:c,showListSkeleton:l,hasCatalogError:u}=e,d=Ct(a===`skill`),f=(0,G.useMemo)(()=>d.data?.scenes??[],[d.data?.scenes]),p=wt(f,a===`skill`),m=(0,G.useMemo)(()=>f.map(e=>({...e,count:typeof e.count==`number`?e.count:p.get(e.scene)})),[p,f]),h=(0,G.useMemo)(()=>t.map(e=>({item:e,record:dn(e,n)})),[t,n]),g=(0,G.useMemo)(()=>{let e=r?.trim();if(e)return m.find(t=>t.scene===e)??{scene:e,title:e}},[r,m]),_=a===`skill`&&!!r?.trim(),v=a===`skill`&&o===`all`&&!s.trim()&&!c&&!_,y=l||t.length>=4,b=v&&!u&&y&&m.length===0&&d.isLoading;return{entries:h,scenes:m,selectedScene:g,sceneEntries:h,isSceneRoute:_,isScenesLoading:b,showShelves:v&&!u&&y&&(l||m.length>0||b),backPath:i?`/skills`:`/marketplace/skills`,pathPrefix:i?`/skills/scenes`:`/marketplace/skills/scenes`}}function hn(){let e=Et(),t=Dt(),{confirm:n,ConfirmDialog:r}=Ke(),[i,o]=(0,G.useState)(new Set),[s,c]=(0,G.useState)(new Map);return{installState:{installingSpecs:i},manageState:{actionsByTarget:s},handleInstall:async t=>{let n=t.install.spec;if(!i.has(n)){o(e=>new Set(e).add(n));try{await e.mutateAsync({type:t.type,spec:n,kind:t.install.kind,skill:t.slug,installPath:`skills/${t.slug}`})}catch{}finally{o(e=>{let t=new Set(e);return t.delete(n),t})}}},handleManage:async(e,r)=>{let i=e===`update`?r.catalogSlug||r.id||r.spec:r.id||r.spec;if(!(!i||s.has(i))&&!(e===`uninstall`&&!await n({title:`${a(`marketplaceUninstallTitle`)} ${i}?`,description:a(`marketplaceUninstallDescription`),confirmLabel:a(`marketplaceUninstall`),variant:`destructive`}))){c(t=>new Map(t).set(i,e));try{await t.mutateAsync({type:r.type,action:e,id:i,spec:r.spec})}finally{c(e=>{let t=new Map(e);return t.delete(i),t})}}},ConfirmDialog:r}}function gn(e){let t=rt(),n=(0,G.useRef)({byKey:new Map,seq:0});return{openItemDetail:async(r,i)=>{let o=r?.name??i?.label??i?.id??i?.spec??a(`marketplaceUnknownItem`),s=Ie(r?`skill`:`skill-local`,r?.slug??i?.id??i?.spec??o),c=r?`marketplace:${r.type}:${r.slug}`:`marketplace:${i?.type??`unknown`}:${i?.id??i?.spec??o}`,l=a(`marketplaceTypeSkill`);if(!r){R(t,{id:s,title:o,typeLabel:l,spec:i?.spec??`-`,status:`ready`,summary:a(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify(i??{},null,2),contentRaw:`-`});return}let u=n.current.seq+1;n.current.seq=u,n.current.byKey.set(c,u);let d=B(r.summaryI18n,r.summary,e);R(t,{id:s,title:o,typeLabel:l,spec:r.install.spec,status:`loading`,summary:d,tags:r.tags,author:r.author});try{let e=await ue(r.slug);if(n.current.byKey.get(c)!==u)return;R(t,{id:s,title:o,typeLabel:l,spec:r.install.spec,status:`ready`,summary:d,metadataRaw:e.metadataRaw,contentRaw:e.bodyRaw||e.raw,sourceUrl:e.sourceUrl,sourceLabel:`Source (${e.source})`,tags:r.tags,author:r.author},{activate:!1})}catch(e){if(n.current.byKey.get(c)!==u)return;R(t,{id:s,title:o,typeLabel:l,spec:r.install.spec,status:`error`,summary:d,metadataRaw:JSON.stringify({error:e instanceof Error?e.message:String(e)},null,2),contentRaw:a(`marketplaceOperationFailed`)},{activate:!1})}}}}function _n(e){let{scope:t,typeFilter:n,query:r,localeFallbacks:i,catalogView:o,installedView:s,isCatalogLoading:c,isCatalogFetching:l,isCatalogFetchingNextPage:u,catalogError:d,isInstalledLoading:f,installedError:p}=e,m=(0,G.useMemo)(()=>s?.records??[],[s?.records]),h=(0,G.useMemo)(()=>o?.items??[],[o?.items]),g=(0,G.useMemo)(()=>ln(h),[h]),_=(0,G.useMemo)(()=>un(m),[m]),v=(0,G.useMemo)(()=>m.filter(e=>e.type===n).map(e=>({key:`${e.type}:${e.spec}:${e.id??``}`,record:e,item:fn(e,g)})).filter(e=>pn(e.record,e.item,r,i)).sort((e,t)=>vn(e.record,t.record)),[m,n,g,r,i]),y=(0,G.useMemo)(()=>t===`installed`?v:h.map(e=>({key:e.id,item:e,record:dn(e,_)})),[h,v,_,t]),b=t===`all`&&c&&!o||t===`installed`&&f&&!s,x=t===`all`&&!b&&!!o&&l&&!u,S=t===`installed`?f&&!s?a(`loading`):`${v.length} ${a(`marketplaceInstalledSkillsCountSuffix`)}`:o?`${h.length} / ${o.total}`:a(`loading`),C=t===`all`&&d?d:t===`installed`&&p?p:void 0,w={scope:t,entries:y,header:{title:a(t===`installed`?`marketplaceSectionInstalledSkills`:`marketplaceAllSkills`),summary:S,refreshingLabel:a(`marketplaceRefreshingResults`)},status:{showSkeleton:b,isRefreshing:x,error:C},emptyLabel:a(t===`installed`?`marketplaceNoInstalledSkills`:`marketplaceNoSkills`),errorLabel:a(t===`installed`?`marketplaceErrorLoadingInstalledSkills`:`marketplaceErrorLoadingSkillsData`)};return{allItems:h,installedRecordLookup:_,installedTotal:s?.total??0,itemListView:w,showListSkeleton:b,isRefreshingList:x}}function vn(e,t){let n=Date.parse(e.installedAt??``),r=Date.parse(t.installedAt??``);return Number.isNaN(n)||Number.isNaN(r)||n===r?e.spec.localeCompare(t.spec):r-n}var yn=20;function bn({forcedType:e}={}){let t=v(),n=d(),{language:r}=W(),i=`skill`,o=(0,G.useMemo)(()=>z(r),[r]),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(``),[f,p]=(0,G.useState)(`all`),[m,h]=(0,G.useState)(`relevance`),{installState:g,manageState:_,handleInstall:y,handleManage:b,ConfirmDialog:x}=hn(),{openItemDetail:S}=gn(o);(0,G.useEffect)(()=>{let e=setTimeout(()=>{u(s.trim())},250);return()=>clearTimeout(e)},[s]);let C=Tt(i),w=i===`skill`?n.scene?.trim():void 0,T=xt({q:w?void 0:l||void 0,scene:w,type:i,sort:m,pageSize:yn}),{containerRef:E,sentinelRef:D}=Re({disabled:f!==`all`||T.isError||!T.hasNextPage||T.isFetchingNextPage,onLoadMore:()=>T.fetchNextPage(),watchValue:`${i}:${f}:${l}:${w??``}:${m}:${T.data?.loadedItems??0}:${T.data?.loadedPages??0}`});(0,G.useEffect)(()=>{let e=E.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[E,l,w,f,m,i]);let O=_n({scope:f,typeFilter:i,query:l,localeFallbacks:o,catalogView:T.data,installedView:C.data,isCatalogLoading:T.isLoading,isCatalogFetching:T.isFetching,isCatalogFetchingNextPage:T.isFetchingNextPage,catalogError:T.isError?T.error:void 0,isInstalledLoading:C.isLoading,installedError:C.isError?C.error:void 0}),k=mn({items:O.allItems,installedRecordLookup:O.installedRecordLookup,scene:w,forcedType:e,typeFilter:i,scope:f,searchText:s,query:l,showListSkeleton:O.showListSkeleton,hasCatalogError:T.isError});return(0,J.jsxs)(Me,{className:`flex h-full min-h-0 flex-col pb-0`,children:[!k.isSceneRoute&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3 border-b border-gray-200/60`,children:[(0,J.jsx)(Ze,{value:f,onValueChange:e=>p(e),children:(0,J.jsxs)(Xe,{className:`mb-0 h-auto flex-1 justify-start gap-6 rounded-none border-b-0 bg-transparent p-0 text-gray-500`,children:[(0,J.jsx)(Ye,{value:`all`,className:`rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:a(`marketplaceTabMarketplaceSkills`)}),(0,J.jsxs)(Ye,{value:`installed`,className:`gap-1.5 rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:[a(`marketplaceTabInstalledSkills`),(0,J.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:O.installedTotal})]})]})}),(0,J.jsx)(cn,{})]}),(0,J.jsx)(Ne,{scope:f,searchText:s,isRefreshing:O.isRefreshingList,searchPlaceholder:a(`marketplaceSearchPlaceholderSkills`),sort:m,onSearchTextChange:c,onSortChange:h})]}),(0,J.jsx)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,J.jsxs)(`div`,{ref:E,className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar pr-1`,"aria-busy":O.showListSkeleton||T.isFetchingNextPage,children:[k.isSceneRoute&&k.selectedScene&&(0,J.jsx)(Zt,{scene:k.selectedScene,entries:k.sceneEntries,isLoading:O.showListSkeleton,language:r,localeFallbacks:o,installState:g,onBack:()=>t(k.backPath),onOpen:e=>void S(e.item,e.record),onInstall:y}),k.isSceneRoute&&!O.showListSkeleton&&(0,J.jsx)(Le,{hasMore:!!T.hasNextPage,loading:T.isFetchingNextPage,sentinelRef:D}),k.showShelves&&(0,J.jsx)(Yt,{entries:k.entries,scenes:k.scenes,isScenesLoading:k.isScenesLoading,isItemsLoading:O.showListSkeleton,language:r,installState:g,onOpen:e=>void S(e.item,e.record),onInstall:y,onOpenScene:e=>t(`${k.pathPrefix}/${e}`)}),!k.isSceneRoute&&(0,J.jsx)(Rt,{model:O.itemListView,showTitle:k.showShelves||!O.showListSkeleton,operationState:{installState:g,manageState:_},scroll:{hasMore:!!T.hasNextPage,loadingMore:T.isFetchingNextPage,sentinelRef:D},actions:{onOpen:(e,t)=>void S(e,t),onInstall:y,onManage:b}})]})}),(0,J.jsx)(x,{})]})}var xn=`NextClaw`,Sn=[{prefix:`/marketplace/mcp`,key:`marketplaceMcpPageTitle`},{prefix:`/marketplace/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/marketplace`,key:`marketplace`},{prefix:`/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/cron`,key:`cronPageTitle`},{prefix:`/agents`,key:`agentsPageTitle`},{prefix:`/chat`,key:`chat`},{prefix:`/model`,key:`modelPageTitle`},{prefix:`/search`,key:`searchPageTitle`},{prefix:`/providers`,key:`providersPageTitle`},{prefix:`/channels`,key:`channelsPageTitle`},{prefix:`/runtime`,key:`runtimePageTitle`},{prefix:`/updates`,key:`runtimeUpdatesPageTitle`},{prefix:`/remote`,key:`remotePageTitle`},{prefix:`/security`,key:`authSecurityTitle`},{prefix:`/secrets`,key:`secretsPageTitle`}];function Cn(e,t){return e===t||e.startsWith(`${t}/`)}function wn(e){let t=e.toLowerCase();for(let{prefix:e,key:n}of Sn)if(Cn(t,e))return a(n);return a(`settings`)}function Tn(e){let t=e.toLowerCase();return t===`localhost`||t.endsWith(`.localhost`)||t===`::1`||t===`[::1]`||t.startsWith(`127.`)}function En(e){let t=e?.host.trim(),n=e?.hostname.trim(),r=e?.port.trim();return!t||!n?null:Tn(n)?r||null:t}function Dn(e,t){let n=En(t);return`${xn}${n?` ${n}`:``} - ${wn(e)}`}var On={...u,...ze};function kn({children:e,sideDockManager:t}){let{isOpen:n,mode:r}=rt();We();let{pathname:i}=b(),{language:a}=W(),{isMobile:o}=Qe(),s=S(),c=f(e=>e.isVisible);f(e=>e.pinnedItems);let l={getDockState:t.getDockState,pinTab:t.pinTab,unpinTab:t.unpinTab};return(0,G.useEffect)(()=>{document.title=Dn(i,window.location)},[i,a]),o&&s!==`win32`?(0,J.jsx)(T,{pathname:i,isDocBrowserOpen:n,docBrowserDockControls:l,docBrowserRenderers:On,topbarLeadingInset:s===`darwin`?`4.75rem`:void 0,children:e}):(0,J.jsx)(ee,{pathname:i,isMobileLayout:o,isDocBrowserOpen:n,docBrowserMode:r,docBrowserDockControls:l,docBrowserRenderers:On,sideDock:c?(0,J.jsx)(x,{manager:t}):null,children:e})}function An({children:e}){let t=D();return(0,J.jsx)(it,{manager:t.docBrowserManager,children:(0,J.jsx)(kn,{sideDockManager:t.sideDockManager,children:e})})}function jn(){let{isMobile:e}=Qe();return e?(0,J.jsx)(g,{}):(0,J.jsx)(_,{to:`/model`,replace:!0})}function Mn(e){let t=e.trim().toLowerCase();return t?!t.startsWith(`skills`):!0}function Nn(e,t){t.startsWith(`mcp`)&&(e?.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}))}function Pn(e,t){e&&Mn(t)&&e.invalidateQueries({queryKey:[`config`]}),Nn(e,t)}function Fn(e){let t=(0,G.useRef)(!1);(0,G.useEffect)(()=>{let n=F.eventBus.on(j.connectionOpen,()=>{M.handleConnectionRestored(),L.refreshAfterRealtimeReconnect(),t.current&&(t.current=!1,e?.invalidateQueries({queryKey:[`ncp-sessions`]}))}),r=F.eventBus.on(j.connectionClose,()=>{M.handleConnectionInterrupted(null),t.current=!0}),i=F.eventBus.on(j.connectionError,e=>{M.handleConnectionInterrupted(e?.message??null),t.current=!0}),a=F.eventBus.on(j.configUpdated,({path:t})=>{Pn(e,t)}),o=F.eventBus.on(j.runtimeUpdateSnapshot,e=>{L.reportSnapshot(e)}),s=F.eventBus.on(j.sessionRunStatus,t=>{P(e,{type:`session.run-status`,payload:t})}),c=F.eventBus.on(j.sessionSummaryUpsert,t=>{P(e,{type:`session.summary.upsert`,payload:t})}),l=F.eventBus.on(j.sessionSummaryDelete,t=>{P(e,{type:`session.summary.delete`,payload:t})}),u=F.eventBus.on(j.error,e=>{console.error(`Realtime transport error:`,e.message)});return()=>{n(),r(),i(),a(),o(),s(),c(),l(),u()}},[e])}var In=(0,G.lazy)(async()=>({default:(await s(async()=>{let{ModelConfigPage:e}=await import(`./model-config-page-DiJcvBML.js`);return{ModelConfigPage:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]))).ModelConfigPage})),Ln=(0,G.lazy)(async()=>({default:(await s(async()=>{let{AppearanceSettingsPage:e}=await import(`./appearance-settings-page-80fLa4-9.js`);return{AppearanceSettingsPage:e}},__vite__mapDeps([18,19,1,20,5,3,7,21,8,2,22,23,24,25,26,27,13,14,4,28,29,30,10,31,32,11,12,33,34,35,9,36,37]))).AppearanceSettingsPage})),Q=(0,G.lazy)(async()=>({default:(await s(async()=>{let{ChatPage:e}=await import(`./chat-page-152YuwfU.js`);return{ChatPage:e}},__vite__mapDeps([38,1,5,3,19,20,7,21,8,2,22,23,24,25,26,27,13,14,4,28,29,30,10,31,32,11,12,33,34,35,9,36,6,39,40,16]))).ChatPage})),Rn=(0,G.lazy)(async()=>({default:(await s(async()=>{let{SearchConfigPage:e}=await import(`./search-config-page-DrVKa_Ls.js`);return{SearchConfigPage:e}},__vite__mapDeps([41,1,7,5,3,2,24,25,32,14,42,15,16]))).SearchConfigPage})),zn=(0,G.lazy)(async()=>({default:(await s(async()=>{let{ProvidersConfigPage:e}=await import(`./providers-config-page-DfiWveEF.js`);return{ProvidersConfigPage:e}},__vite__mapDeps([43,1,5,3,7,21,8,2,22,24,39,30,32,14,26,33,34,42,15,16,17,35,9]))).ProvidersConfigPage})),Bn=(0,G.lazy)(async()=>({default:(await s(async()=>{let{ChannelsList:e}=await import(`./channels-list-page-R7M6pzp6.js`);return{ChannelsList:e}},__vite__mapDeps([44,1,5,3,7,2,24,4,25,31,32,14,11,22,34,42,40,15,16,17]))).ChannelsList})),Vn=(0,G.lazy)(async()=>({default:(await s(async()=>{let{RuntimeConfig:e}=await import(`./runtime-config-page-wygwvMB4.js`);return{RuntimeConfig:e}},__vite__mapDeps([45,1,19,20,5,3,7,21,8,2,22,23,24,25,26,27,13,14,4,28,29,30,10,31,32,11,12,33,34,35,9,36,46,47,37,15,16]))).RuntimeConfig})),Hn=(0,G.lazy)(async()=>({default:(await s(async()=>{let{DesktopUpdateConfig:e}=await import(`./desktop-update-config-DreMJu9z.js`);return{DesktopUpdateConfig:e}},__vite__mapDeps([48,7,1,5,3,2,29,25,27,46,35]))).DesktopUpdateConfig})),Un=(0,G.lazy)(async()=>({default:(await s(async()=>{let{SecurityConfig:e}=await import(`./security-config-BPzet76z.js`);return{SecurityConfig:e}},__vite__mapDeps([49,2,1,3]))).SecurityConfig})),Wn=(0,G.lazy)(async()=>({default:(await s(async()=>{let{SecretsConfigPage:e}=await import(`./secrets-config-page-B39uQ5kF.js`);return{SecretsConfigPage:e}},__vite__mapDeps([50,1,7,5,3,2,26,47,33,15,16]))).SecretsConfigPage})),Gn=(0,G.lazy)(async()=>({default:(await s(async()=>{let{RemoteAccessPage:e}=await import(`./remote-BaVECEZw.js`);return{RemoteAccessPage:e}},__vite__mapDeps([51,19,1,20,5,3,7,21,8,2,22,23,24,25,26,27,13,14,4,28,29,30,10,31,32,11,12,33,34,35,9,36]))).RemoteAccessPage})),Kn=(0,G.lazy)(async()=>({default:(await s(async()=>{let{McpMarketplacePage:e}=await import(`./mcp-marketplace-page-4qMwFDpz.js`);return{McpMarketplacePage:e}},__vite__mapDeps([52,53,1,5,3,7,21,8,2,22,28,23,24,25,26,27,13,14,11,12,40]))).McpMarketplacePage}));function qn(){return(0,J.jsx)(`div`,{className:`h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40`})}function Jn({children:e}){return(0,J.jsx)(G.Suspense,{fallback:(0,J.jsx)(qn,{}),children:e})}function $(e){return(0,J.jsx)(Jn,{children:e})}var Yn=[{path:`/chat/skills`,redirectTo:`/skills`},{path:`/chat/cron`,redirectTo:`/cron`},{path:`/chat/agents`,redirectTo:`/agents`},{path:`/chat/:sessionId?`,element:$((0,J.jsx)(Q,{view:`chat`}))},{path:`/agents`,element:$((0,J.jsx)(Q,{view:`agents`}))},{path:`/skills`,element:$((0,J.jsx)(Q,{view:`skills`}))},{path:`/skills/scenes/:scene`,element:$((0,J.jsx)(Q,{view:`skills`}))},{path:`/cron`,element:$((0,J.jsx)(Q,{view:`cron`}))},{path:`/appearance`,element:$((0,J.jsx)(Ln,{}))},{path:`/model`,element:$((0,J.jsx)(In,{}))},{path:`/search`,element:$((0,J.jsx)(Rn,{}))},{path:`/providers`,element:$((0,J.jsx)(zn,{}))},{path:`/channels`,element:$((0,J.jsx)(Bn,{}))},{path:`/runtime`,element:$((0,J.jsx)(Vn,{}))},{path:`/updates`,element:$((0,J.jsx)(Hn,{}))},{path:`/remote`,element:$((0,J.jsx)(Gn,{}))},{path:`/security`,element:$((0,J.jsx)(Un,{}))},{path:`/secrets`,element:$((0,J.jsx)(Wn,{}))},{path:`/language`,element:(0,J.jsx)(y,{})},{path:`/settings`,element:(0,J.jsx)(jn,{})},{path:`/marketplace/skills`,redirectTo:`/skills`},{path:`/marketplace`,redirectTo:`/skills`},{path:`/marketplace/mcp`,element:$((0,J.jsx)(Kn,{}))},{path:`/`,redirectTo:`/chat`},{path:`*`,redirectTo:`/chat`}];function Xn(e){return`redirectTo`in e?(0,J.jsx)(E,{path:e.path,element:(0,J.jsx)(_,{to:e.redirectTo,replace:!0})},e.path):(0,J.jsx)(E,{path:e.path,element:e.element},e.path)}function Zn(){return(0,J.jsx)(C,{children:Yn.map(Xn)})}function Qn(){return Fn(me),je(),(0,G.useEffect)(()=>(L.start(),()=>{L.stop()}),[]),(0,J.jsxs)(k,{children:[(0,J.jsx)(An,{children:(0,J.jsx)(Zn,{})}),(0,J.jsx)(c,{}),(0,J.jsx)(l,{})]})}function $n(){let e=be(),t=e.isError&&xe(e.error);return e.isLoading&&!e.isError||t||e.isError?(0,J.jsx)(Qn,{}):e.data?.enabled&&!e.data.authenticated?(0,J.jsx)(ie,{username:e.data.username}):(0,J.jsx)(Qn,{})}function er(){return(0,G.useEffect)(()=>{re()},[]),(0,J.jsxs)(Se,{client:me,children:[(0,J.jsx)($n,{}),(0,J.jsx)(m,{}),(0,J.jsx)(ce,{position:`top-right`,richColors:!0,offset:window.nextclawDesktop?.platform===`win32`?56:void 0,mobileOffset:window.nextclawDesktop?.platform===`win32`?56:void 0})]})}var tr=window.nextclawDesktop?.platform===`win32`?h:te;(0,gt.createRoot)(document.getElementById(`root`)).render((0,J.jsx)(G.StrictMode,{children:(0,J.jsx)(ne,{children:(0,J.jsx)(Ge,{children:(0,J.jsx)(tr,{children:(0,J.jsx)(er,{})})})})}));export{bn as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/model-config-page-BbWbW_qM.js","assets/chunk-DseTPa7n.js","assets/api-Dyb5rgh0.js","assets/react-DsgudwpT.js","assets/book-open-L6LCuqOr.js","assets/dist-CrtbGLlh.js","assets/provider-scoped-model-input-B-9_DtIP.js","assets/select-MJKhKAWR.js","assets/popover-CX9zFsuc.js","assets/provider-models-BoUhFo9R.js","assets/folder-BIYZZWJv.js","assets/loader-circle-Bj2RMrCR.js","assets/skeleton-0uTLUhm9.js","assets/doc-browser-context-BlpUUFrR.js","assets/middleware-CAXxl-af.js","assets/form-actions-CKprWFeM.js","assets/use-config-CwDEAl6f.js","assets/config-hints-LxG80Uj5.js","assets/appearance-settings-page-DFm3BbEb.js","assets/app-presenter-provider-7jV0nPiL.js","assets/preload-helper-D4M6sveU.js","assets/confirm-dialog-bAp8NU93.js","assets/x-DdEDL6ju.js","assets/doc-browser-BmnQa30-.js","assets/search-_kEi29qo.js","assets/external-link-B9Uoq5J7.js","assets/plus-TmFdwO3P.js","assets/refresh-cw-kXdvbhFf.js","assets/use-confirm-dialog-BbnWw-8c.js","assets/download-BhZZNXD8.js","assets/eye-K5knauEM.js","assets/tabs-h44XPocd.js","assets/use-viewport-layout-CqgIMDQL.js","assets/trash-2-BRpSE-Wt.js","assets/logo-badge-BQ-XFZod.js","assets/host-capabilities-CFbAfrrA.js","assets/app-presenter-provider-D3BuuOyZ.css","assets/setting-row-DA3tJuew.js","assets/chat-page-Cw9uDhD_.js","assets/settings-2-D_y7zXJz.js","assets/tag-chip-bRZ04q3C.js","assets/search-config-page-H7ug8f4D.js","assets/config-split-page-CqlqjnCK.js","assets/providers-config-page-xwIjGur2.js","assets/channels-list-page-DOaPKNJA.js","assets/runtime-config-page-DTsi7czJ.js","assets/rotate-cw-DEc6aihr.js","assets/save-C9qpz2_2.js","assets/desktop-update-config-2SjMfCMl.js","assets/security-config-Cr2ERKLu.js","assets/secrets-config-page-C1_6rINu.js","assets/remote-B9F2uCk9.js","assets/mcp-marketplace-page-CXHYO95j.js","assets/mcp-marketplace-page-BfA7A3n4.js"])))=>i.map(i=>d[i]);
2
+ import{i as e,t}from"./chunk-DseTPa7n.js";import{h as n,m as r,p as i,r as a,u as o}from"./react-DsgudwpT.js";import{t as s}from"./preload-helper-D4M6sveU.js";import{B as c,E as l,T as u,_t as d,a as f,at as p,b as m,dt as h,f as g,ft as _,gt as v,h as y,ht as b,i as x,m as S,mt as C,ot as w,p as T,pt as E,r as D,st as O,t as k,u as ee,ut as te,v as ne,y as re,z as ie}from"./app-presenter-provider-7jV0nPiL.js";import{Cn as ae,En as oe,F as se,I as ce,L as le,Nt as ue,Ot as A,P as de,Pt as j,R as fe,Sn as M,Tn as pe,Wt as N,Zt as me,_n as P,an as he,bt as ge,cn as _e,dn as ve,fn as ye,gn as be,gt as F,hn as xe,in as I,ln as Se,m as L,mn as Ce,nn as we,on as Te,pn as Ee,rn as De,un as Oe,wn as ke,xn as Ae,yt as je,z as Me}from"./api-Dyb5rgh0.js";import{a as R,c as Ne,d as Pe,f as Fe,i as Ie,l as Le,n as Re,o as z,r as ze,s as B,u as V}from"./mcp-marketplace-page-BfA7A3n4.js";import{c as H}from"./dist-CrtbGLlh.js";import{n as Be}from"./search-_kEi29qo.js";import{a as Ve,c as He,o as U,s as Ue}from"./doc-browser-BmnQa30-.js";import{i as We,n as Ge,r as W,t as Ke}from"./use-confirm-dialog-BbnWw-8c.js";import{t as qe}from"./download-BhZZNXD8.js";import{t as Je}from"./external-link-B9Uoq5J7.js";import{i as Ye,r as Xe,t as Ze}from"./tabs-h44XPocd.js";import{t as Qe}from"./use-viewport-layout-CqgIMDQL.js";import{t as $e}from"./refresh-cw-kXdvbhFf.js";import{n as et}from"./skeleton-0uTLUhm9.js";import{t as tt}from"./trash-2-BRpSE-Wt.js";import{t as nt}from"./host-capabilities-CFbAfrrA.js";import{n as rt,t as it}from"./doc-browser-context-BlpUUFrR.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var at=t((e=>{var t=r();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}));function ot(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function st(e,t,n){let r=e.slice(0);return r[t]=n,r}var ct=class extends oe{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,M.batch(()=>{let e=this.#i,t=this.#f(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!pe(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(ot(e,n).forEach(e=>{e.destroy()}),ot(n,e).forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})),this.#m()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#f(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=ke(this.#a,t(e))),this.#a}return e}#f(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new Ae(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=st(this.#t,n,t),this.#m())}#m(){if(this.hasListeners()){let e=this.#a,t=this.#u(this.#t,this.#l);e!==this.#d(t,this.#r?.combine)&&M.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},G=e(n(),1);function lt({queries:e,...t},n){let r=P(n),i=xe(),a=Ce(),o=G.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{_e(e),ve(e,a,r.getQueryCache().get(e.queryHash))}),Ee(a);let[s]=G.useState(()=>new ct(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;G.useSyncExternalStore(G.useCallback(e=>d?s.subscribe(M.batchCalls(e)):ae,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),G.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>Oe(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&Oe(n,e)?Se(n,new Ae(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&ye({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}var ut=H(`BriefcaseBusiness`,[[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2`,key:`1ksdt3`}],[`path`,{d:`M22 13a18.15 18.15 0 0 1-20 0`,key:`12hx5q`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]),dt=H(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),ft=H(`Compass`,[[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),pt=H(`MessagesSquare`,[[`path`,{d:`M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z`,key:`p1xzt8`}],[`path`,{d:`M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1`,key:`1cx29u`}]]),mt=H(`PenLine`,[[`path`,{d:`M12 20h9`,key:`t2du7b`}],[`path`,{d:`M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z`,key:`1ykcvy`}]]),ht=H(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),gt=at();function K(e){return Array.from(new Set(e.map(e=>e.spec).filter(Boolean)))}function _t(e){let{request:t,result:n}=e,r=new Date().toISOString();return n.type===`skill`?{type:`skill`,spec:n.spec,id:t.skill??n.spec,label:t.skill??n.name??n.spec,source:`workspace`,installPath:t.installPath,installedAt:r}:{type:n.type,spec:n.spec,id:n.name??n.spec,label:n.name??n.spec,source:`marketplace`,origin:`marketplace`,enabled:t.enabled??!0,runtimeStatus:t.enabled===!1?`disabled`:`ready`,installedAt:r}}function q(e,t){let{id:n,spec:r}=t;return!!(r&&e.spec===r||n&&e.id===n)}function vt(e,t){return t??{type:e,total:0,specs:[],records:[]}}function yt(e){let{result:t,view:n}=e,r=vt(t.type,n),i=_t(e),a=r.records.findIndex(e=>q(e,{id:i.id,spec:i.spec})),o=[...r.records];return a>=0?o[a]={...o[a],...i}:o.unshift(i),{...r,type:t.type,records:o,specs:K(o),total:o.length}}function bt(e){let{request:t,result:n,view:r}=e,i=vt(n.type,r);if(n.action===`uninstall`||n.action===`remove`){let e=i.records.filter(e=>!q(e,{id:n.id,spec:t.spec}));return{...i,records:e,specs:K(e),total:e.length}}let a=i.records.map(e=>q(e,{id:n.id,spec:t.spec})?n.action===`disable`?{...e,enabled:!1,runtimeStatus:`disabled`}:n.action===`update`?{...e,installedAt:new Date().toISOString(),origin:e.origin??`marketplace`}:{...e,enabled:!0,runtimeStatus:`ready`}:e);return{...i,records:a,specs:K(a),total:a.length}}function xt(e){let t=Fe({queryKey:[`marketplace-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>se({...e,page:t}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0,placeholderData:(t,n)=>{let r=n?.queryKey?.[1];if(!(!r||typeof r!=`object`||!r))return(`type`in r?r.type:void 0)===e.type&&St(r,e)?t:void 0},staleTime:15e3}),n=(0,G.useMemo)(()=>Pe(t.data),[t.data]);return{...t,data:n}}function St(e,t){return e.tag===t.tag&&e.scene===t.scene&&e.pageSize===t.pageSize}function Ct(e=!0){return Te({queryKey:[`marketplace-skill-scenes`],queryFn:le,enabled:e,staleTime:6e4})}function wt(e,t=!0){let n=lt({queries:e.map(e=>({queryKey:[`marketplace-skill-scene-count`,e.scene],queryFn:()=>se({type:`skill`,scene:e.scene,pageSize:1}),enabled:t&&typeof e.count!=`number`,staleTime:6e4}))});return(0,G.useMemo)(()=>{let t=new Map;return e.forEach((e,r)=>{let i=typeof e.count==`number`?e.count:n[r]?.data?.total;typeof i==`number`&&t.set(e.scene,i)}),t},[n,e])}function Tt(e){return Te({queryKey:[`marketplace-installed`,e],queryFn:()=>de(e),staleTime:1e4})}function Et(){let e=P();return he({mutationFn:e=>fe(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>yt({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`}),I.success(t.message||a(`marketplaceInstallSuccessSkill`))},onError:e=>{I.error(e.message||a(`marketplaceInstallFailed`))}})}function Dt(){let e=P();return he({mutationFn:e=>Me(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>bt({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`});let r=t.action===`enable`?a(`marketplaceEnableSuccess`):t.action===`disable`?a(`marketplaceDisableSuccess`):t.action===`update`?a(`marketplaceUpdateSuccess`):a(`marketplaceUninstallSuccess`);I.success(t.message||r)},onError:e=>{I.error(e.message||a(`marketplaceOperationFailed`))}})}var J=i(),Ot=[`bg-amber-600`,`bg-orange-500`,`bg-yellow-600`,`bg-emerald-600`,`bg-teal-600`,`bg-cyan-600`,`bg-stone-600`,`bg-rose-500`,`bg-violet-500`];function kt(e){let{name:t,fallback:n,className:r}=e,i=t||n,a=i.substring(0,2).toUpperCase();return(0,J.jsx)(`div`,{className:o(`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-sm font-semibold text-white`,At(i),r),children:a})}function At(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return Ot[Math.abs(t)%Ot.length]}function jt({title:e,spec:t}){return(0,J.jsxs)(Ue,{delayDuration:400,children:[(0,J.jsxs)(Ve,{children:[(0,J.jsx)(He,{asChild:!0,children:(0,J.jsx)(`div`,{className:`truncate text-[14px] font-semibold leading-tight text-gray-950`,children:e})}),(0,J.jsx)(U,{className:`max-w-[300px] text-xs`,children:e})]}),(0,J.jsx)(`div`,{className:`mb-2 mt-1 flex min-w-0 items-center gap-1.5`,children:t?(0,J.jsxs)(Ve,{children:[(0,J.jsx)(He,{asChild:!0,children:(0,J.jsx)(`span`,{className:`max-w-full truncate text-[11px] font-mono leading-tight text-gray-400`,children:t})}),(0,J.jsx)(U,{className:`max-w-[300px] break-all font-mono text-xs`,children:t})]}):null})]})}function Mt(e){let{item:t,record:n,state:r,onInstall:i,onManage:s}=e,{isInstalling:c,canUpdate:l,canUninstall:u,busyAction:d}=r,f=!!d;return t&&!n||n&&(l||u)?(0,J.jsxs)(`div`,{className:o(`flex shrink-0 items-center justify-end gap-1.5 opacity-100 transition-opacity duration-150`,`md:pointer-events-none md:opacity-0`,`md:group-hover:pointer-events-auto md:group-hover:opacity-100`,`md:group-focus-within:pointer-events-auto md:group-focus-within:opacity-100`),children:[t&&!n&&(0,J.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),i(t)},disabled:c,className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md bg-primary px-2 text-[11px] font-medium text-white transition-colors hover:bg-primary-600 disabled:opacity-50`,children:[(0,J.jsx)(qe,{className:`h-3 w-3`}),a(c?`marketplaceInstalling`:`marketplaceInstall`)]}),n&&l&&(0,J.jsxs)(`button`,{disabled:f,onClick:e=>{e.stopPropagation(),s(`update`,n)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-blue-200/80 bg-white px-2 text-[11px] font-medium text-blue-600 transition-colors hover:border-blue-300 hover:bg-blue-50 disabled:opacity-50`,children:[(0,J.jsx)($e,{className:`h-3 w-3`}),a(d===`update`?`marketplaceUpdating`:`marketplaceUpdate`)]}),n&&u&&(0,J.jsxs)(`button`,{disabled:f,onClick:e=>{e.stopPropagation(),s(`uninstall`,n)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-gray-200/80 bg-white px-2 text-[11px] font-medium text-gray-500 transition-colors hover:border-rose-200 hover:bg-rose-50 hover:text-rose-600 disabled:opacity-50`,children:[(0,J.jsx)(tt,{className:`h-3 w-3`}),a(d===`uninstall`?`marketplaceRemoving`:`marketplaceUninstall`)]})]}):null}function Nt(e){let{record:t,disabled:n}=e;return t?(0,J.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-end`,children:(0,J.jsx)(Pt,{disabled:n})}):null}function Pt(e){let{disabled:t}=e,n=a(t?`marketplaceDisabledStatus`:`marketplaceInstalledStatus`);return(0,J.jsx)(Ue,{delayDuration:300,children:(0,J.jsxs)(Ve,{children:[(0,J.jsx)(He,{asChild:!0,children:(0,J.jsx)(`span`,{"aria-label":n,className:o(`inline-flex h-5 w-5 items-center justify-center`,t?`text-gray-400`:`text-emerald-700`),children:t?(0,J.jsx)(O,{className:`h-4 w-4 opacity-40`}):(0,J.jsx)(O,{className:`h-4 w-4`})})}),(0,J.jsx)(U,{className:`text-xs`,children:n})]})})}function Ft(e){let{item:t,record:n,installState:r,manageState:i,onOpen:o,onInstall:s,onManage:c}=e,{language:l}=W(),u=z(l),d=t?.name??n?.label??n?.id??n?.spec??a(`marketplaceUnknownItem`),f=B(t?.summaryI18n,t?.summary,u)||(n?a(`marketplaceInstalledLocalSummary`):``),p=t?.install.spec??n?.spec??``,m=t?.tags??[],h=n?.id||n?.spec,g=h?i.actionsByTarget.get(h):void 0,_=n?.type===`skill`&&n.source===`workspace`,v=n?.type===`skill`&&n.origin===`marketplace`,y=n?n.enabled===!1||n.runtimeStatus===`disabled`:!1,b=t?.install.spec,x=typeof b==`string`&&r.installingSpecs.has(b);return(0,J.jsxs)(`article`,{onClick:o,className:`group flex h-full min-h-[156px] cursor-pointer flex-col rounded-xl border border-gray-200/60 bg-white p-3.5 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,J.jsx)(kt,{name:d,fallback:p||a(`marketplaceTypeSkill`),className:`h-9 w-9 rounded-lg text-xs`}),(0,J.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,J.jsx)(jt,{title:d,spec:p})}),(0,J.jsx)(Nt,{record:n,disabled:y})]}),(0,J.jsxs)(`div`,{className:`mt-2 flex min-w-0 flex-1 flex-col`,children:[(0,J.jsx)(`p`,{className:`line-clamp-2 text-left text-[12px] leading-relaxed text-gray-500`,children:f}),(0,J.jsxs)(`div`,{className:`mt-auto flex min-w-0 items-end justify-between gap-2 pt-2`,children:[(0,J.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,J.jsx)(It,{tags:m})}),(0,J.jsx)(Mt,{item:t,record:n,state:{isInstalling:x,canUpdate:v,canUninstall:_,busyAction:g},onInstall:s,onManage:c})]})]})]})}function It({tags:e}){let t=e.filter(Lt).slice(0,3);return t.length===0?null:(0,J.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-1.5 overflow-hidden`,children:t.map(e=>(0,J.jsx)(`span`,{className:`max-w-[104px] truncate rounded-md bg-gray-100 px-2 py-0.5 text-[11px] font-medium leading-5 text-gray-500`,children:e},e))})}function Lt(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function Rt({model:e,showTitle:t,operationState:n,scroll:r,actions:i}){let{scope:a,entries:s,header:c,status:l,emptyLabel:u,errorLabel:d}=e,{showSkeleton:f,isRefreshing:p,error:m}=l,{hasMore:h,loadingMore:g,sentinelRef:_}=r,{installState:v,manageState:y}=n,{onOpen:b,onInstall:x,onManage:S}=i;return(0,J.jsxs)(`section`,{className:o(`flex min-h-full flex-col`,t&&`gap-3`),children:[t&&(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-950`,children:c.title}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] text-gray-500`,children:[p&&(0,J.jsx)(`span`,{className:`font-medium text-primary`,children:c.refreshingLabel}),(0,J.jsx)(`span`,{children:c.summary})]})]}),m&&(0,J.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[d,`: `,m.message]}),p&&(0,J.jsx)(`div`,{"data-testid":`marketplace-list-refreshing`,className:`h-0.5 overflow-hidden rounded-full bg-primary/10`,children:(0,J.jsx)(`div`,{className:`h-full w-1/3 animate-pulse rounded-full bg-primary`})}),(0,J.jsxs)(`div`,{"data-testid":f?`marketplace-list-skeleton`:void 0,className:o(`grid grid-cols-1 gap-2.5 md:grid-cols-2 xl:grid-cols-3`,f&&`min-h-0 flex-1 auto-rows-[156px] content-start`),children:[f&&(0,J.jsx)(V,{count:36}),!f&&!m&&s.map(e=>(0,J.jsx)(Ft,{item:e.item,record:e.record,installState:v,manageState:y,onOpen:()=>b(e.item,e.record),onInstall:x,onManage:S},e.key))]}),!f&&!m&&s.length===0&&(0,J.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:u}),a===`all`&&!f&&!m&&(0,J.jsx)(Le,{hasMore:h,loading:g,sentinelRef:_})]})}function zt(e){let{entry:t,language:n,localeFallbacks:r,installState:i,layout:s=`rail`,onOpen:c,onInstall:l}=e,{item:u,record:d}=t,f=B(u.summaryI18n,u.summary,r),p=u.install.spec,m=i.installingSpecs.has(p),h=!!d;return(0,J.jsxs)(`article`,{onClick:()=>c(t),className:o(`group flex min-h-[166px] cursor-pointer flex-col justify-between rounded-xl border border-gray-200/70 bg-white p-3 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,s===`rail`?`w-[260px] shrink-0`:`w-full min-w-0`),children:[(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-start gap-2.5`,children:[(0,J.jsx)(kt,{name:u.name,fallback:u.install.spec}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,J.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-gray-950`,children:u.name}),(0,J.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] font-mono leading-tight text-gray-400`,children:Bt(u)})]})]}),(0,J.jsx)(`p`,{className:`line-clamp-2 text-[12px] leading-relaxed text-gray-500`,children:f}),(0,J.jsx)(Vt,{tags:u.tags})]}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-gray-100 pt-2.5`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-gray-400`,children:Ut(u.updatedAt)}),h?(0,J.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 text-[11px] font-semibold text-emerald-700`,children:[(0,J.jsx)(O,{className:`h-3.5 w-3.5`}),Wt({zh:`已安装`,en:`Installed`},n)]}):(0,J.jsxs)(`button`,{type:`button`,disabled:m,onClick:e=>{e.stopPropagation(),l(u)},className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-gray-200 bg-white px-2 text-[11px] font-semibold text-gray-700 transition-colors hover:border-gray-300 hover:bg-gray-50 disabled:opacity-50`,children:[(0,J.jsx)(qe,{className:`h-3.5 w-3.5`}),a(m?`marketplaceInstalling`:`marketplaceInstall`)]})]})]})}function Bt(e){return e.slug||e.install.spec}function Vt({tags:e}){let t=e.filter(Ht).slice(0,2);return t.length===0?null:(0,J.jsx)(`div`,{className:`mt-auto truncate pt-2 text-[11px] font-medium text-gray-400`,children:t.join(` / `)})}function Ht(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function Ut(e){return e.slice(0,10)||e}function Wt(e,t){return t.startsWith(`zh`)?e.zh:e.en}var Gt=[{scene:`development-debugging`,title:{zh:`开发与调试`,en:`Development`},summary:{zh:`代码审查、错误定位、架构分析与交付验证。`,en:`Review, debug, analyze, and verify delivery work.`},icon:ht,tone:`dark`,span:`md:col-span-2`},{scene:`office-collaboration`,title:{zh:`办公协作`,en:`Office Work`},summary:{zh:`连接文档、日历、会议、邮件和团队通信。`,en:`Connect docs, calendars, meetings, mail, and teams.`},icon:ut,tone:`green`,span:`md:col-span-2`},{scene:`writing-content`,title:{zh:`写作与内容`,en:`Writing`},summary:{zh:`把调研、写作、润色和发布组织成连续工作流。`,en:`Turn research, writing, polishing, and publishing into one flow.`},icon:mt,tone:`amber`,span:`md:col-span-2`},{scene:`browser-automation`,title:{zh:`浏览器自动化`,en:`Browser`},summary:{zh:`操作网页、捕获动态内容并验证真实用户路径。`,en:`Operate pages, capture dynamic content, and verify user paths.`},icon:p,tone:`blue`,span:`md:col-span-2`},{scene:`local-environment`,title:{zh:`本地环境`,en:`Local`},summary:{zh:`管理终端、文件、运行时和本地服务。`,en:`Manage shells, files, runtimes, and local services.`},icon:w,tone:`violet`,span:`md:col-span-1`},{scene:`social-platforms`,title:{zh:`社交平台`,en:`Social`},summary:{zh:`处理发布、互动、检索和内容分发。`,en:`Handle posting, interaction, search, and distribution.`},icon:pt,tone:`sky`,span:`md:col-span-1`},{scene:`nextclaw-official`,title:{zh:`NextClaw 官方`,en:`NextClaw Official`},summary:{zh:`优先查看由 NextClaw 维护的原生能力。`,en:`Browse native capabilities maintained by NextClaw.`},icon:et,tone:`teal`,span:`md:col-span-2`}],Kt={icon:et,tone:`dark`,span:`md:col-span-2`},qt={dark:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-stone-600 bg-stone-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},blue:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-cyan-600 bg-cyan-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},green:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-emerald-600 bg-emerald-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},amber:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-amber-600 bg-amber-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},violet:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-violet-500 bg-violet-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},sky:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-sky-500 bg-sky-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},teal:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-teal-600 bg-teal-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`}},Jt=`grid grid-cols-[repeat(auto-fill,minmax(240px,320px))] justify-start gap-3`;function Yt(e){let{entries:t,scenes:n,isScenesLoading:r,isItemsLoading:i,language:a,installState:o,onOpen:s,onInstall:c,onOpenScene:l}=e,u=z(a),d=[...t].sort((e,t)=>en(e.item,t.item)).slice(0,6);return(0,J.jsxs)(`div`,{className:`mb-4 space-y-5`,children:[(0,J.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,J.jsx)($t,{icon:ft,title:Y({zh:`场景`,en:`Scenes`},a),description:Y({zh:`按使用场景浏览适合的技能组合。`,en:`Browse skills by how you plan to use them.`},a)}),r?(0,J.jsx)(`div`,{"data-testid":`marketplace-scenes-skeleton`,className:`grid auto-rows-[104px] grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:(0,J.jsx)(V,{count:Gt.length})}):(0,J.jsx)(`div`,{className:`grid grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:n.map(e=>(0,J.jsx)(Xt,{scene:e,language:a,onSelect:l},e.scene))})]}),(i||d.length>0)&&(0,J.jsx)(Qt,{icon:dt,title:Y({zh:`最近更新`,en:`Recently updated`},a),description:Y({zh:`看看生态最近在补齐哪些能力。`,en:`See what the ecosystem has been improving lately.`},a),entries:d,language:a,localeFallbacks:u,isLoading:i,installState:o,onOpen:s,onInstall:c})]})}function Xt(e){let{scene:t,language:n,onSelect:r}=e,i=tn(t.scene),a=i.icon,s=qt[i.tone];return(0,J.jsx)(`button`,{type:`button`,onClick:()=>r(t.scene),className:o(`group flex min-h-[74px] flex-col justify-center rounded-lg border px-3 py-2.5 text-left shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/70`,s.card),children:(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`span`,{className:o(`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border`,s.icon),children:(0,J.jsx)(a,{className:`h-3.5 w-3.5`})}),(0,J.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-gray-950`,children:nn(t,i,n)}),typeof t.count==`number`&&(0,J.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:an(t.count,n)})]}),(0,J.jsx)(`p`,{className:o(`mt-1 line-clamp-1 text-[11px] leading-relaxed`,s.text),children:rn(t,i,n)})]})})}function Zt(e){let{scene:t,entries:n,isLoading:r,language:i,localeFallbacks:a,installState:s,onBack:c,onOpen:l,onInstall:u}=e,d=tn(t.scene),f=d.icon,p=qt[d.tone];return(0,J.jsxs)(`section`,{className:`flex min-h-full flex-col`,children:[(0,J.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-start gap-2.5`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:c,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900`,"aria-label":Y({zh:`返回`,en:`Back`},i),children:(0,J.jsx)(Be,{className:`h-4 w-4`})}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`span`,{className:o(`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border`,p.icon),children:(0,J.jsx)(f,{className:`h-4 w-4`})}),(0,J.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[15px] font-semibold text-gray-950`,children:nn(t,d,i)}),(0,J.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:Y(r?{zh:`加载中`,en:`Loading`}:{zh:`${n.length} 个技能`,en:`${n.length} skills`},i)})]}),(0,J.jsx)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-2`,children:(0,J.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[12px] leading-relaxed text-gray-500`,children:rn(t,d,i)})})]})]}),r?(0,J.jsx)(`div`,{"data-testid":`marketplace-scene-skeleton`,className:o(Jt,`min-h-0 flex-1 auto-rows-[166px] content-start`),children:(0,J.jsx)(V,{count:24})}):n.length>0?(0,J.jsx)(`div`,{className:Jt,children:n.map(e=>(0,J.jsx)(zt,{entry:e,language:i,localeFallbacks:a,installState:s,layout:`grid`,onOpen:l,onInstall:u},e.item.id))}):(0,J.jsx)(`div`,{className:`rounded-lg border border-dashed border-gray-200 py-8 text-center text-[12px] text-gray-500`,children:Y({zh:`这个模块暂无技能。`,en:`No skills in this module yet.`},i)})]})}function Qt(e){let{icon:t,title:n,description:r,entries:i,language:a,localeFallbacks:o,isLoading:s,installState:c,onOpen:l,onInstall:u}=e;return(0,J.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,J.jsx)($t,{icon:t,title:n,description:r}),s?(0,J.jsx)(`div`,{"data-testid":`marketplace-recent-skeleton`,className:`-mx-1 grid auto-rows-[166px] grid-cols-[repeat(4,260px)] gap-2.5 overflow-hidden px-1 pb-1.5`,children:(0,J.jsx)(V,{count:4})}):(0,J.jsx)(`div`,{className:`-mx-1 flex gap-2.5 overflow-x-auto px-1 pb-1.5 custom-scrollbar`,children:i.map(e=>(0,J.jsx)(zt,{entry:e,language:a,localeFallbacks:o,installState:c,onOpen:l,onInstall:u},e.item.id))})]})}function $t({icon:e,title:t,description:n}){return(0,J.jsx)(`div`,{className:`flex items-end justify-between gap-4`,children:(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`h3`,{className:`flex items-center gap-2 text-[14px] font-semibold text-gray-950`,children:[(0,J.jsx)(e,{className:`h-4 w-4 text-primary`}),t]}),(0,J.jsx)(`p`,{className:`mt-0.5 text-[12px] leading-relaxed text-gray-500`,children:n})]})})}function en(e,t){let n=Date.parse(e.updatedAt),r=Date.parse(t.updatedAt);return Number.isNaN(n)||Number.isNaN(r)?t.updatedAt.localeCompare(e.updatedAt):r-n}function Y(e,t){return t.startsWith(`zh`)?e.zh:e.en}function tn(e){return Gt.find(t=>t.scene===e)??{scene:e,...Kt}}function nn(e,t,n){return t.title?Y(t.title,n):e.title}function rn(e,t,n){return t.summary?Y(t.summary,n):e.description??e.scene}function an(e,t){return t.startsWith(`zh`)?`${e} 个技能`:`${e} skills`}function on({label:e,className:t,onClick:n}){return(0,J.jsxs)(`button`,{type:`button`,className:o(`inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md px-1.5 text-[13px] font-medium text-primary transition-colors hover:text-primary-hover focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,t),onClick:n,children:[(0,J.jsx)(Je,{className:`h-3.5 w-3.5`}),e]})}var sn=`https://skillhub.cn/`;function cn(){return(0,J.jsx)(on,{label:a(`marketplaceExternalSkillSourceTitle`),onClick:()=>void nt.openExternalUrl(sn)})}function X(e){return(e??``).trim().toLowerCase()}function Z(e,t){let n=X(t);return n.length>0?`${e}:${n}`:``}function ln(e){let t=new Map;for(let n of e){let e=[n.install.spec,n.slug,n.id];for(let r of e){let e=Z(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function un(e){let t=new Map;for(let n of e){let e=[n.spec,n.id,n.label];for(let r of e){let e=Z(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function dn(e,t){let n=[e.install.spec,e.slug,e.id];for(let r of n){let n=Z(e.type,r);if(!n)continue;let i=t.get(n);if(i)return i}}function fn(e,t){return t.get(Z(e.type,e.spec))||t.get(Z(e.type,e.id))||t.get(Z(e.type,e.label))}function pn(e,t,n,r){let i=X(n);if(!i)return!0;let a=B(t?.summaryI18n,t?.summary,r);return[e.id,e.spec,e.label,t?.name,t?.slug,t?.summary,a,...t?.tags??[]].map(e=>X(e)).filter(Boolean).some(e=>e.includes(i))}function mn(e){let{items:t,installedRecordLookup:n,scene:r,forcedType:i,typeFilter:a,scope:o,searchText:s,query:c,showListSkeleton:l,hasCatalogError:u}=e,d=Ct(a===`skill`),f=(0,G.useMemo)(()=>d.data?.scenes??[],[d.data?.scenes]),p=wt(f,a===`skill`),m=(0,G.useMemo)(()=>f.map(e=>({...e,count:typeof e.count==`number`?e.count:p.get(e.scene)})),[p,f]),h=(0,G.useMemo)(()=>t.map(e=>({item:e,record:dn(e,n)})),[t,n]),g=(0,G.useMemo)(()=>{let e=r?.trim();if(e)return m.find(t=>t.scene===e)??{scene:e,title:e}},[r,m]),_=a===`skill`&&!!r?.trim(),v=a===`skill`&&o===`all`&&!s.trim()&&!c&&!_,y=l||t.length>=4,b=v&&!u&&y&&m.length===0&&d.isLoading;return{entries:h,scenes:m,selectedScene:g,sceneEntries:h,isSceneRoute:_,isScenesLoading:b,showShelves:v&&!u&&y&&(l||m.length>0||b),backPath:i?`/skills`:`/marketplace/skills`,pathPrefix:i?`/skills/scenes`:`/marketplace/skills/scenes`}}function hn(){let e=Et(),t=Dt(),{confirm:n,ConfirmDialog:r}=Ke(),[i,o]=(0,G.useState)(new Set),[s,c]=(0,G.useState)(new Map);return{installState:{installingSpecs:i},manageState:{actionsByTarget:s},handleInstall:async t=>{let n=t.install.spec;if(!i.has(n)){o(e=>new Set(e).add(n));try{await e.mutateAsync({type:t.type,spec:n,kind:t.install.kind,skill:t.slug,installPath:`skills/${t.slug}`})}catch{}finally{o(e=>{let t=new Set(e);return t.delete(n),t})}}},handleManage:async(e,r)=>{let i=e===`update`?r.catalogSlug||r.id||r.spec:r.id||r.spec;if(!(!i||s.has(i))&&!(e===`uninstall`&&!await n({title:`${a(`marketplaceUninstallTitle`)} ${i}?`,description:a(`marketplaceUninstallDescription`),confirmLabel:a(`marketplaceUninstall`),variant:`destructive`}))){c(t=>new Map(t).set(i,e));try{await t.mutateAsync({type:r.type,action:e,id:i,spec:r.spec})}finally{c(e=>{let t=new Map(e);return t.delete(i),t})}}},ConfirmDialog:r}}function gn(e){let t=rt(),n=(0,G.useRef)({byKey:new Map,seq:0});return{openItemDetail:async(r,i)=>{let o=r?.name??i?.label??i?.id??i?.spec??a(`marketplaceUnknownItem`),s=Ie(r?`skill`:`skill-local`,r?.slug??i?.id??i?.spec??o),c=r?`marketplace:${r.type}:${r.slug}`:`marketplace:${i?.type??`unknown`}:${i?.id??i?.spec??o}`,l=a(`marketplaceTypeSkill`);if(!r){R(t,{id:s,title:o,typeLabel:l,spec:i?.spec??`-`,status:`ready`,summary:a(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify(i??{},null,2),contentRaw:`-`});return}let u=n.current.seq+1;n.current.seq=u,n.current.byKey.set(c,u);let d=B(r.summaryI18n,r.summary,e);R(t,{id:s,title:o,typeLabel:l,spec:r.install.spec,status:`loading`,summary:d,tags:r.tags,author:r.author});try{let e=await ce(r.slug);if(n.current.byKey.get(c)!==u)return;R(t,{id:s,title:o,typeLabel:l,spec:r.install.spec,status:`ready`,summary:d,metadataRaw:e.metadataRaw,contentRaw:e.bodyRaw||e.raw,sourceUrl:e.sourceUrl,sourceLabel:`Source (${e.source})`,tags:r.tags,author:r.author},{activate:!1})}catch(e){if(n.current.byKey.get(c)!==u)return;R(t,{id:s,title:o,typeLabel:l,spec:r.install.spec,status:`error`,summary:d,metadataRaw:JSON.stringify({error:e instanceof Error?e.message:String(e)},null,2),contentRaw:a(`marketplaceOperationFailed`)},{activate:!1})}}}}function _n(e){let{scope:t,typeFilter:n,query:r,localeFallbacks:i,catalogView:o,installedView:s,isCatalogLoading:c,isCatalogFetching:l,isCatalogFetchingNextPage:u,catalogError:d,isInstalledLoading:f,installedError:p}=e,m=(0,G.useMemo)(()=>s?.records??[],[s?.records]),h=(0,G.useMemo)(()=>o?.items??[],[o?.items]),g=(0,G.useMemo)(()=>ln(h),[h]),_=(0,G.useMemo)(()=>un(m),[m]),v=(0,G.useMemo)(()=>m.filter(e=>e.type===n).map(e=>({key:`${e.type}:${e.spec}:${e.id??``}`,record:e,item:fn(e,g)})).filter(e=>pn(e.record,e.item,r,i)).sort((e,t)=>vn(e.record,t.record)),[m,n,g,r,i]),y=(0,G.useMemo)(()=>t===`installed`?v:h.map(e=>({key:e.id,item:e,record:dn(e,_)})),[h,v,_,t]),b=t===`all`&&c&&!o||t===`installed`&&f&&!s,x=t===`all`&&!b&&!!o&&l&&!u,S=t===`installed`?f&&!s?a(`loading`):`${v.length} ${a(`marketplaceInstalledSkillsCountSuffix`)}`:o?`${h.length} / ${o.total}`:a(`loading`),C=t===`all`&&d?d:t===`installed`&&p?p:void 0,w={scope:t,entries:y,header:{title:a(t===`installed`?`marketplaceSectionInstalledSkills`:`marketplaceAllSkills`),summary:S,refreshingLabel:a(`marketplaceRefreshingResults`)},status:{showSkeleton:b,isRefreshing:x,error:C},emptyLabel:a(t===`installed`?`marketplaceNoInstalledSkills`:`marketplaceNoSkills`),errorLabel:a(t===`installed`?`marketplaceErrorLoadingInstalledSkills`:`marketplaceErrorLoadingSkillsData`)};return{allItems:h,installedRecordLookup:_,installedTotal:s?.total??0,itemListView:w,showListSkeleton:b,isRefreshingList:x}}function vn(e,t){let n=Date.parse(e.installedAt??``),r=Date.parse(t.installedAt??``);return Number.isNaN(n)||Number.isNaN(r)||n===r?e.spec.localeCompare(t.spec):r-n}var yn=20;function bn({forcedType:e}={}){let t=v(),n=d(),{language:r}=W(),i=`skill`,o=(0,G.useMemo)(()=>z(r),[r]),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(``),[f,p]=(0,G.useState)(`all`),[m,h]=(0,G.useState)(`relevance`),{installState:g,manageState:_,handleInstall:y,handleManage:b,ConfirmDialog:x}=hn(),{openItemDetail:S}=gn(o);(0,G.useEffect)(()=>{let e=setTimeout(()=>{u(s.trim())},250);return()=>clearTimeout(e)},[s]);let C=Tt(i),w=i===`skill`?n.scene?.trim():void 0,T=xt({q:w?void 0:l||void 0,scene:w,type:i,sort:m,pageSize:yn}),{containerRef:E,sentinelRef:D}=Re({disabled:f!==`all`||T.isError||!T.hasNextPage||T.isFetchingNextPage,onLoadMore:()=>T.fetchNextPage(),watchValue:`${i}:${f}:${l}:${w??``}:${m}:${T.data?.loadedItems??0}:${T.data?.loadedPages??0}`});(0,G.useEffect)(()=>{let e=E.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[E,l,w,f,m,i]);let O=_n({scope:f,typeFilter:i,query:l,localeFallbacks:o,catalogView:T.data,installedView:C.data,isCatalogLoading:T.isLoading,isCatalogFetching:T.isFetching,isCatalogFetchingNextPage:T.isFetchingNextPage,catalogError:T.isError?T.error:void 0,isInstalledLoading:C.isLoading,installedError:C.isError?C.error:void 0}),k=mn({items:O.allItems,installedRecordLookup:O.installedRecordLookup,scene:w,forcedType:e,typeFilter:i,scope:f,searchText:s,query:l,showListSkeleton:O.showListSkeleton,hasCatalogError:T.isError});return(0,J.jsxs)(me,{className:`flex h-full min-h-0 flex-col pb-0`,children:[!k.isSceneRoute&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3 border-b border-gray-200/60`,children:[(0,J.jsx)(Ze,{value:f,onValueChange:e=>p(e),children:(0,J.jsxs)(Xe,{className:`mb-0 h-auto flex-1 justify-start gap-6 rounded-none border-b-0 bg-transparent p-0 text-gray-500`,children:[(0,J.jsx)(Ye,{value:`all`,className:`rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:a(`marketplaceTabMarketplaceSkills`)}),(0,J.jsxs)(Ye,{value:`installed`,className:`gap-1.5 rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:[a(`marketplaceTabInstalledSkills`),(0,J.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:O.installedTotal})]})]})}),(0,J.jsx)(cn,{})]}),(0,J.jsx)(Ne,{scope:f,searchText:s,isRefreshing:O.isRefreshingList,searchPlaceholder:a(`marketplaceSearchPlaceholderSkills`),sort:m,onSearchTextChange:c,onSortChange:h})]}),(0,J.jsx)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,J.jsxs)(`div`,{ref:E,className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar pr-1`,"aria-busy":O.showListSkeleton||T.isFetchingNextPage,children:[k.isSceneRoute&&k.selectedScene&&(0,J.jsx)(Zt,{scene:k.selectedScene,entries:k.sceneEntries,isLoading:O.showListSkeleton,language:r,localeFallbacks:o,installState:g,onBack:()=>t(k.backPath),onOpen:e=>void S(e.item,e.record),onInstall:y}),k.isSceneRoute&&!O.showListSkeleton&&(0,J.jsx)(Le,{hasMore:!!T.hasNextPage,loading:T.isFetchingNextPage,sentinelRef:D}),k.showShelves&&(0,J.jsx)(Yt,{entries:k.entries,scenes:k.scenes,isScenesLoading:k.isScenesLoading,isItemsLoading:O.showListSkeleton,language:r,installState:g,onOpen:e=>void S(e.item,e.record),onInstall:y,onOpenScene:e=>t(`${k.pathPrefix}/${e}`)}),!k.isSceneRoute&&(0,J.jsx)(Rt,{model:O.itemListView,showTitle:k.showShelves||!O.showListSkeleton,operationState:{installState:g,manageState:_},scroll:{hasMore:!!T.hasNextPage,loadingMore:T.isFetchingNextPage,sentinelRef:D},actions:{onOpen:(e,t)=>void S(e,t),onInstall:y,onManage:b}})]})}),(0,J.jsx)(x,{})]})}var xn=`NextClaw`,Sn=[{prefix:`/marketplace/mcp`,key:`marketplaceMcpPageTitle`},{prefix:`/marketplace/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/marketplace`,key:`marketplace`},{prefix:`/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/cron`,key:`cronPageTitle`},{prefix:`/agents`,key:`agentsPageTitle`},{prefix:`/chat`,key:`chat`},{prefix:`/model`,key:`modelPageTitle`},{prefix:`/search`,key:`searchPageTitle`},{prefix:`/providers`,key:`providersPageTitle`},{prefix:`/channels`,key:`channelsPageTitle`},{prefix:`/runtime`,key:`runtimePageTitle`},{prefix:`/updates`,key:`runtimeUpdatesPageTitle`},{prefix:`/remote`,key:`remotePageTitle`},{prefix:`/security`,key:`authSecurityTitle`},{prefix:`/secrets`,key:`secretsPageTitle`}];function Cn(e,t){return e===t||e.startsWith(`${t}/`)}function wn(e){let t=e.toLowerCase();for(let{prefix:e,key:n}of Sn)if(Cn(t,e))return a(n);return a(`settings`)}function Tn(e){let t=e.toLowerCase();return t===`localhost`||t.endsWith(`.localhost`)||t===`::1`||t===`[::1]`||t.startsWith(`127.`)}function En(e){let t=e?.host.trim(),n=e?.hostname.trim(),r=e?.port.trim();return!t||!n?null:Tn(n)?r||null:t}function Dn(e,t){let n=En(t);return`${xn}${n?` ${n}`:``} - ${wn(e)}`}var On={...u,...ze};function kn({children:e,sideDockManager:t}){let{isOpen:n,mode:r}=rt();We();let{pathname:i}=b(),{language:a}=W(),{isMobile:o}=Qe(),s=S(),c=f(e=>e.isVisible);f(e=>e.pinnedItems);let l={getDockState:t.getDockState,pinTab:t.pinTab,unpinTab:t.unpinTab};return(0,G.useEffect)(()=>{document.title=Dn(i,window.location)},[i,a]),o&&s!==`win32`?(0,J.jsx)(T,{pathname:i,isDocBrowserOpen:n,docBrowserDockControls:l,docBrowserRenderers:On,topbarLeadingInset:s===`darwin`?`4.75rem`:void 0,children:e}):(0,J.jsx)(ee,{pathname:i,isMobileLayout:o,isDocBrowserOpen:n,docBrowserMode:r,docBrowserDockControls:l,docBrowserRenderers:On,sideDock:c?(0,J.jsx)(x,{manager:t}):null,children:e})}function An({children:e}){let t=D();return(0,J.jsx)(it,{manager:t.docBrowserManager,children:(0,J.jsx)(kn,{sideDockManager:t.sideDockManager,children:e})})}function jn(){let{isMobile:e}=Qe();return e?(0,J.jsx)(g,{}):(0,J.jsx)(_,{to:`/model`,replace:!0})}function Mn(e){let t=e.trim().toLowerCase();return t?!t.startsWith(`skills`):!0}function Nn(e,t){t.startsWith(`mcp`)&&(e?.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}))}function Pn(e,t){e&&Mn(t)&&e.invalidateQueries({queryKey:[`config`]}),Nn(e,t)}function Fn(e){let t=(0,G.useRef)(!1);(0,G.useEffect)(()=>{let n=F.eventBus.on(N.connectionOpen,()=>{j.handleConnectionRestored(),A.refreshAfterRealtimeReconnect(),t.current&&(t.current=!1,e?.invalidateQueries({queryKey:[`ncp-sessions`]}))}),r=F.eventBus.on(N.connectionClose,()=>{j.handleConnectionInterrupted(null),t.current=!0}),i=F.eventBus.on(N.connectionError,e=>{j.handleConnectionInterrupted(e?.message??null),t.current=!0}),a=F.eventBus.on(N.configUpdated,({path:t})=>{Pn(e,t)}),o=F.eventBus.on(N.runtimeUpdateSnapshot,e=>{A.reportSnapshot(e)}),s=F.eventBus.on(N.sessionRunStatus,t=>{L(e,{type:`session.run-status`,payload:t})}),c=F.eventBus.on(N.sessionSummaryUpsert,t=>{L(e,{type:`session.summary.upsert`,payload:t})}),l=F.eventBus.on(N.sessionSummaryDelete,t=>{L(e,{type:`session.summary.delete`,payload:t})}),u=F.eventBus.on(N.error,e=>{console.error(`Realtime transport error:`,e.message)});return()=>{n(),r(),i(),a(),o(),s(),c(),l(),u()}},[e])}var In=(0,G.lazy)(async()=>({default:(await s(async()=>{let{ModelConfigPage:e}=await import(`./model-config-page-BbWbW_qM.js`);return{ModelConfigPage:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]))).ModelConfigPage})),Ln=(0,G.lazy)(async()=>({default:(await s(async()=>{let{AppearanceSettingsPage:e}=await import(`./appearance-settings-page-DFm3BbEb.js`);return{AppearanceSettingsPage:e}},__vite__mapDeps([18,19,1,20,5,3,7,21,8,2,22,23,24,25,26,27,13,14,4,28,29,30,10,31,32,11,12,33,34,35,9,36,37]))).AppearanceSettingsPage})),Q=(0,G.lazy)(async()=>({default:(await s(async()=>{let{ChatPage:e}=await import(`./chat-page-Cw9uDhD_.js`);return{ChatPage:e}},__vite__mapDeps([38,1,5,3,19,20,7,21,8,2,22,23,24,25,26,27,13,14,4,28,29,30,10,31,32,11,12,33,34,35,9,36,6,39,40,16]))).ChatPage})),Rn=(0,G.lazy)(async()=>({default:(await s(async()=>{let{SearchConfigPage:e}=await import(`./search-config-page-H7ug8f4D.js`);return{SearchConfigPage:e}},__vite__mapDeps([41,1,7,5,3,2,24,25,32,14,42,15,16]))).SearchConfigPage})),zn=(0,G.lazy)(async()=>({default:(await s(async()=>{let{ProvidersConfigPage:e}=await import(`./providers-config-page-xwIjGur2.js`);return{ProvidersConfigPage:e}},__vite__mapDeps([43,1,5,3,7,21,8,2,22,24,39,30,32,14,26,33,34,42,15,16,17,35,9]))).ProvidersConfigPage})),Bn=(0,G.lazy)(async()=>({default:(await s(async()=>{let{ChannelsList:e}=await import(`./channels-list-page-DOaPKNJA.js`);return{ChannelsList:e}},__vite__mapDeps([44,1,5,3,7,2,24,4,25,31,32,14,11,22,34,42,40,15,16,17]))).ChannelsList})),Vn=(0,G.lazy)(async()=>({default:(await s(async()=>{let{RuntimeConfig:e}=await import(`./runtime-config-page-DTsi7czJ.js`);return{RuntimeConfig:e}},__vite__mapDeps([45,1,19,20,5,3,7,21,8,2,22,23,24,25,26,27,13,14,4,28,29,30,10,31,32,11,12,33,34,35,9,36,46,47,37,15,16]))).RuntimeConfig})),Hn=(0,G.lazy)(async()=>({default:(await s(async()=>{let{DesktopUpdateConfig:e}=await import(`./desktop-update-config-2SjMfCMl.js`);return{DesktopUpdateConfig:e}},__vite__mapDeps([48,7,1,5,3,2,29,25,27,46,35]))).DesktopUpdateConfig})),Un=(0,G.lazy)(async()=>({default:(await s(async()=>{let{SecurityConfig:e}=await import(`./security-config-Cr2ERKLu.js`);return{SecurityConfig:e}},__vite__mapDeps([49,2,1,3]))).SecurityConfig})),Wn=(0,G.lazy)(async()=>({default:(await s(async()=>{let{SecretsConfigPage:e}=await import(`./secrets-config-page-C1_6rINu.js`);return{SecretsConfigPage:e}},__vite__mapDeps([50,1,7,5,3,2,26,47,33,15,16]))).SecretsConfigPage})),Gn=(0,G.lazy)(async()=>({default:(await s(async()=>{let{RemoteAccessPage:e}=await import(`./remote-B9F2uCk9.js`);return{RemoteAccessPage:e}},__vite__mapDeps([51,19,1,20,5,3,7,21,8,2,22,23,24,25,26,27,13,14,4,28,29,30,10,31,32,11,12,33,34,35,9,36]))).RemoteAccessPage})),Kn=(0,G.lazy)(async()=>({default:(await s(async()=>{let{McpMarketplacePage:e}=await import(`./mcp-marketplace-page-CXHYO95j.js`);return{McpMarketplacePage:e}},__vite__mapDeps([52,53,1,5,3,7,21,8,2,22,28,23,24,25,26,27,13,14,11,12,40]))).McpMarketplacePage}));function qn(){return(0,J.jsx)(`div`,{className:`h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40`})}function Jn({children:e}){return(0,J.jsx)(G.Suspense,{fallback:(0,J.jsx)(qn,{}),children:e})}function $(e){return(0,J.jsx)(Jn,{children:e})}var Yn=[{path:`/chat/skills`,redirectTo:`/skills`},{path:`/chat/cron`,redirectTo:`/cron`},{path:`/chat/agents`,redirectTo:`/agents`},{path:`/chat/:sessionId?`,element:$((0,J.jsx)(Q,{view:`chat`}))},{path:`/agents`,element:$((0,J.jsx)(Q,{view:`agents`}))},{path:`/skills`,element:$((0,J.jsx)(Q,{view:`skills`}))},{path:`/skills/scenes/:scene`,element:$((0,J.jsx)(Q,{view:`skills`}))},{path:`/cron`,element:$((0,J.jsx)(Q,{view:`cron`}))},{path:`/appearance`,element:$((0,J.jsx)(Ln,{}))},{path:`/model`,element:$((0,J.jsx)(In,{}))},{path:`/search`,element:$((0,J.jsx)(Rn,{}))},{path:`/providers`,element:$((0,J.jsx)(zn,{}))},{path:`/channels`,element:$((0,J.jsx)(Bn,{}))},{path:`/runtime`,element:$((0,J.jsx)(Vn,{}))},{path:`/updates`,element:$((0,J.jsx)(Hn,{}))},{path:`/remote`,element:$((0,J.jsx)(Gn,{}))},{path:`/security`,element:$((0,J.jsx)(Un,{}))},{path:`/secrets`,element:$((0,J.jsx)(Wn,{}))},{path:`/language`,element:(0,J.jsx)(y,{})},{path:`/settings`,element:(0,J.jsx)(jn,{})},{path:`/marketplace/skills`,redirectTo:`/skills`},{path:`/marketplace`,redirectTo:`/skills`},{path:`/marketplace/mcp`,element:$((0,J.jsx)(Kn,{}))},{path:`/`,redirectTo:`/chat`},{path:`*`,redirectTo:`/chat`}];function Xn(e){return`redirectTo`in e?(0,J.jsx)(E,{path:e.path,element:(0,J.jsx)(_,{to:e.redirectTo,replace:!0})},e.path):(0,J.jsx)(E,{path:e.path,element:e.element},e.path)}function Zn(){return(0,J.jsx)(C,{children:Yn.map(Xn)})}function Qn(){return Fn(we),ue(),(0,G.useEffect)(()=>(A.start(),()=>{A.stop()}),[]),(0,J.jsxs)(k,{children:[(0,J.jsx)(An,{children:(0,J.jsx)(Zn,{})}),(0,J.jsx)(c,{}),(0,J.jsx)(l,{})]})}function $n(){let e=ge(),t=e.isError&&je(e.error);return e.isLoading&&!e.isError||t||e.isError?(0,J.jsx)(Qn,{}):e.data?.enabled&&!e.data.authenticated?(0,J.jsx)(ie,{username:e.data.username}):(0,J.jsx)(Qn,{})}function er(){return(0,G.useEffect)(()=>{re()},[]),(0,J.jsxs)(be,{client:we,children:[(0,J.jsx)($n,{}),(0,J.jsx)(m,{}),(0,J.jsx)(De,{position:`top-right`,richColors:!0,offset:window.nextclawDesktop?.platform===`win32`?56:void 0,mobileOffset:window.nextclawDesktop?.platform===`win32`?56:void 0})]})}var tr=window.nextclawDesktop?.platform===`win32`?h:te;(0,gt.createRoot)(document.getElementById(`root`)).render((0,J.jsx)(G.StrictMode,{children:(0,J.jsx)(ne,{children:(0,J.jsx)(Ge,{children:(0,J.jsx)(tr,{children:(0,J.jsx)(er,{})})})})}));export{bn as t};
@@ -0,0 +1 @@
1
+ import{c as e}from"./dist-CrtbGLlh.js";var t=e(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]);export{t};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DseTPa7n.js";import{h as t,p as n,u as r}from"./react-BY-U3h3t.js";var i=n(),a={active:{dot:`bg-emerald-500`,text:`text-emerald-600`,bg:`bg-emerald-50`},ready:{dot:`bg-emerald-500`,text:`text-emerald-600`,bg:`bg-emerald-50`},inactive:{dot:`bg-gray-300`,text:`text-gray-400`,bg:`bg-gray-100/80`},setup:{dot:`bg-gray-300`,text:`text-gray-400`,bg:`bg-gray-100/80`},warning:{dot:`bg-amber-400`,text:`text-amber-600`,bg:`bg-amber-50`}};function o({status:e,label:t,className:n}){let o=a[e];return(0,i.jsxs)(`div`,{className:r(`inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-2 py-0.5`,o.bg,n),children:[(0,i.jsx)(`span`,{className:r(`h-1.5 w-1.5 rounded-full`,o.dot)}),(0,i.jsx)(`span`,{className:r(`text-[11px] font-medium`,o.text),children:t})]})}var s=e(t(),1);function c({name:e,src:t,className:n,imgClassName:a,fallback:o}){let[c,l]=(0,s.useState)(!1),u=!!t&&!c;return(0,i.jsx)(`div`,{className:r(`inline-flex shrink-0 items-center justify-center overflow-hidden`,n),children:u?(0,i.jsx)(`img`,{src:t,alt:`${e} logo`,className:r(`block h-6 w-6 object-contain`,a),onError:()=>l(!0),draggable:!1}):o??(0,i.jsx)(`span`,{className:`text-lg font-bold uppercase`,children:e.slice(0,1)})})}export{o as n,c as t};
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{h as t,p as n,u as r}from"./react-DsgudwpT.js";var i=n(),a={active:{dot:`bg-emerald-500`,text:`text-emerald-600`,bg:`bg-emerald-50`},ready:{dot:`bg-emerald-500`,text:`text-emerald-600`,bg:`bg-emerald-50`},inactive:{dot:`bg-gray-300`,text:`text-gray-400`,bg:`bg-gray-100/80`},setup:{dot:`bg-gray-300`,text:`text-gray-400`,bg:`bg-gray-100/80`},warning:{dot:`bg-amber-400`,text:`text-amber-600`,bg:`bg-amber-50`}};function o({status:e,label:t,className:n}){let o=a[e];return(0,i.jsxs)(`div`,{className:r(`inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-2 py-0.5`,o.bg,n),children:[(0,i.jsx)(`span`,{className:r(`h-1.5 w-1.5 rounded-full`,o.dot)}),(0,i.jsx)(`span`,{className:r(`text-[11px] font-medium`,o.text),children:t})]})}var s=e(t(),1);function c({name:e,src:t,className:n,imgClassName:a,fallback:o}){let[c,l]=(0,s.useState)(!1),u=!!t&&!c;return(0,i.jsx)(`div`,{className:r(`inline-flex shrink-0 items-center justify-center overflow-hidden`,n),children:u?(0,i.jsx)(`img`,{src:t,alt:`${e} logo`,className:r(`block h-6 w-6 object-contain`,a),onError:()=>l(!0),draggable:!1}):o??(0,i.jsx)(`span`,{className:`text-lg font-bold uppercase`,children:e.slice(0,1)})})}export{o as n,c as t};
@@ -0,0 +1,9 @@
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{h as t,p as n,r,t as i,u as a}from"./react-DsgudwpT.js";import{$t as o,A as s,I as c,M as l,N as u,O as d,St as f,Zt as p,_n as m,an as h,bn as g,en as _,in as v,j as y,k as ee,on as b,sn as x,vn as S,xn as C,yn as w}from"./api-Dyb5rgh0.js";import{c as T}from"./dist-CrtbGLlh.js";import{a as E,i as D,n as O,o as k,r as A,s as j}from"./confirm-dialog-bAp8NU93.js";import{a as M,i as N,n as P,r as F,t as te}from"./select-MJKhKAWR.js";import{a as I,o as ne,r as re,s as ie,t as ae}from"./use-confirm-dialog-BbnWw-8c.js";import{t as oe}from"./loader-circle-Bj2RMrCR.js";import{n as se,t as L}from"./skeleton-0uTLUhm9.js";import{n as ce}from"./doc-browser-context-BlpUUFrR.js";import{t as R}from"./tag-chip-bRZ04q3C.js";var le=class extends C{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:g()})}getOptimisticResult(e){return e.behavior=g(),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:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:S(t,n.data),hasPreviousPage:w(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}};function z(e,t){return x(e,le,t)}var ue=T(`PackageCheck`,[[`path`,{d:`m16 16 2 2 4-4`,key:`gfu2re`}],[`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`}]]),de=T(`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 B(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 V=n();function H({scope:e,isRefreshing:t,searchText:n,searchPlaceholder:i,sort:a,onSearchTextChange:o,onSortChange:s}){return(0,V.jsx)(`div`,{className:`mb-4`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,V.jsx)(de,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400`}),(0,V.jsx)(`input`,{value:n,onChange:e=>o(e.target.value),placeholder:i,className:`h-9 w-full rounded-xl border border-border/75 bg-card pl-9 pr-9 text-sm transition-colors focus:outline-none focus:ring-0 focus:border-border`}),t&&(0,V.jsx)(oe,{className:`absolute right-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 animate-spin text-primary`,"aria-label":r(`marketplaceRefreshingResults`)})]}),e===`all`&&(0,V.jsxs)(te,{value:a,onValueChange:e=>s(e),children:[(0,V.jsx)(N,{className:`h-9 w-[150px] shrink-0 rounded-lg`,children:(0,V.jsx)(M,{})}),(0,V.jsxs)(P,{children:[(0,V.jsx)(F,{value:`relevance`,children:r(`marketplaceSortRelevance`)}),(0,V.jsx)(F,{value:`updated`,children:r(`marketplaceSortUpdated`)})]})]})]})})}function U({count:e}){return(0,V.jsx)(V.Fragment,{children:Array.from({length:e},(e,t)=>(0,V.jsx)(`article`,{className:`h-full rounded-xl border border-gray-200/60 bg-white p-3.5 shadow-sm`,children:(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2.5`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 gap-2.5`,children:[(0,V.jsx)(L,{className:`h-9 w-9 shrink-0 rounded-lg`}),(0,V.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,V.jsx)(L,{className:`h-4 w-32 max-w-[70%]`}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(L,{className:`h-3 w-12`}),(0,V.jsx)(L,{className:`h-3 w-24`})]}),(0,V.jsx)(L,{className:`h-3 w-full`}),(0,V.jsxs)(`div`,{className:`flex gap-1.5 pt-0.5`,children:[(0,V.jsx)(L,{className:`h-5 w-14 rounded-md`}),(0,V.jsx)(L,{className:`h-5 w-16 rounded-md`}),(0,V.jsx)(L,{className:`h-5 w-12 rounded-md`})]})]})]}),(0,V.jsx)(L,{className:`h-7 w-16 shrink-0 rounded-md`})]})},`marketplace-skeleton-${t}`))})}function W({hasMore:e,loading:t,sentinelRef:n}){return!e&&!t?null:(0,V.jsxs)(`div`,{className:`py-4`,children:[e&&(0,V.jsx)(`div`,{ref:n,className:`h-1 w-full`,"aria-hidden":`true`}),t&&(0,V.jsx)(`div`,{"data-testid":`marketplace-loading-more`,className:`pt-3 text-center text-xs text-gray-500`,children:r(`loading`)})]})}function G(e){let t=e.trim().toLowerCase().replace(/_/g,`-`),n=[t,t.split(`-`)[0],`en`];return Array.from(new Set(n.filter(Boolean)))}function K(e){return e.trim().toLowerCase().replace(/_/g,`-`)}function fe(e,t,n){if(e){let t=Object.entries(e).map(([e,t])=>({locale:K(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=K(t),r=e.get(n);if(r)return r}for(let e of n){let n=K(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 pe(e,t){if(!e)return``;for(let n of t)if(K(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 q=i(e=>({entries:{},setEntry:t=>e(e=>({entries:{...e.entries,[t.id]:t}}))}));function J(e){q.getState().setEntry(e)}var Y=e(t(),1);function me(e){let t=e.indexOf(`:`);return t<=0||t>=e.length-1?null:{scope:e.slice(0,t),key:e.slice(t+1)}}function he(e){return e===`skill`||e===`skill-preview`}function ge(e){let t=q(t=>e?t.entries[e]:void 0);return(0,Y.useEffect)(()=>{if(!e||q.getState().entries[e])return;let t=me(e);if(!t||!he(t.scope))return;let n=!1,i=t.key,a=r(`marketplaceTypeSkill`);return c(t.key).then(o=>{n||J({id:e,title:i,typeLabel:a,spec:t.key,status:`ready`,summary:r(`marketplaceInstalledLocalSummary`),metadataRaw:o.metadataRaw,contentRaw:o.bodyRaw||o.raw,sourceUrl:o.sourceUrl,sourceLabel:o.source?`Source (${o.source})`:void 0})}).catch(()=>{n||J({id:e,title:i,typeLabel:a,spec:t.key,status:`error`,summary:r(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify({skill:t.key},null,2),contentRaw:r(`marketplaceDetailUnavailableDescription`)})}),()=>{n=!0}},[e]),t}var _e=`marketplace-detail`,ve=`nextclaw://marketplace-detail`;function ye(e,t){return`${e}:${t}`}function be(e){return`${ve}/${encodeURIComponent(e)}`}function xe(e){try{let t=new URL(e);if(t.protocol!==`nextclaw:`||t.hostname!==`marketplace-detail`)return null;let n=t.pathname.replace(/^\//,``);return n?decodeURIComponent(n):null}catch{return null}}function Se(e){let t=be(e.id);return{dedupeKey:`marketplace-detail:${e.id}`,historyPolicy:`managed`,kind:_e,resourceUri:t,title:e.title,url:t}}function X(e,t,n){J(t),e.openTarget(Se(t),{activate:n?.activate,dedupeKey:`marketplace-detail:${t.id}`,title:t.title})}function Ce(e){let t=e.replace(/\r\n/g,`
2
+ `).split(`
3
+ `);if(t[0]?.trim()!==`---`)return e;let n=t.findIndex((e,t)=>t>0&&e.trim()===`---`);return n>0?t.slice(n+1).join(`
4
+ `).trim():e}function Z(e){let t=[],n=/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\(https?:\/\/[^)\s]+\))/g,r=0,i=0;for(let a of e.matchAll(n)){if(a.index===void 0)continue;a.index>r&&t.push(e.slice(r,a.index));let n=a[0],o=`${i}-${a.index}`;if(n.startsWith("`"))t.push((0,V.jsx)(`code`,{className:`rounded border border-border bg-muted px-1 py-0.5 font-mono text-[0.88em] text-foreground`,children:n.slice(1,-1)},o));else if(n.startsWith(`**`))t.push((0,V.jsx)(`strong`,{children:n.slice(2,-2)},o));else{let e=n.match(/^\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)$/);t.push(e?(0,V.jsx)(`a`,{href:e[2],target:`_blank`,rel:`noopener noreferrer`,children:e[1]},o):n)}r=a.index+n.length,i+=1}return r<e.length&&t.push(e.slice(r)),t}function we(e){return/^(#{1,4})\s+/.test(e)||/^([-*])\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)}function Te(e,t,n){let r=[],i=t+1;for(;i<e.length&&!e[i]?.trim().startsWith("```");)r.push(e[i]??``),i+=1;let a=n[1]??``;return{node:(0,V.jsxs)(`div`,{className:`relative my-3 overflow-hidden rounded-lg border border-border bg-muted/70`,children:[a?(0,V.jsx)(`span`,{className:`absolute right-3 top-2 font-mono text-[10px] text-muted-foreground`,children:a}):null,(0,V.jsx)(`pre`,{className:`m-0 overflow-x-auto p-3 text-xs leading-6 text-foreground`,children:(0,V.jsx)(`code`,{children:r.join(`
5
+ `)})})]},t),nextIndex:i+1}}function Ee(e,t,n){let r=[],i=t,o=n?/^\d+\.\s+/:/^[-*]\s+/;for(;i<e.length&&o.test(e[i]?.trim()??``);)r.push((e[i]??``).trim().replace(o,``)),i+=1;return{node:(0,V.jsx)(n?`ol`:`ul`,{className:a(`my-2 pl-5`,n?`list-decimal`:`list-disc`),children:r.map((e,n)=>(0,V.jsx)(`li`,{className:`my-1`,children:Z(e)},`${t}-${n}`))},t),nextIndex:i}}function De(e,t,n){let r=`mb-2 mt-5 font-semibold leading-tight text-foreground`;return e===1?(0,V.jsx)(`h1`,{className:r,children:n},t):e===2?(0,V.jsx)(`h2`,{className:r,children:n},t):e===3?(0,V.jsx)(`h3`,{className:r,children:n},t):(0,V.jsx)(`h4`,{className:r,children:n},t)}function Oe(e,t){let n=e[t]?.trim()??``,r=n.match(/^```(\S*)/);if(r)return Te(e,t,r);let i=n.match(/^(#{1,4})\s+(.+)$/);if(i)return{node:De(Math.min(4,i[1]?.length??2),t,Z(i[2]??``)),nextIndex:t+1};if(/^[-*]\s+/.test(n))return Ee(e,t,!1);if(/^\d+\.\s+/.test(n))return Ee(e,t,!0);if(/^>\s?/.test(n)){let n=[],r=t;for(;r<e.length&&/^>\s?/.test(e[r]?.trim()??``);)n.push((e[r]??``).trim().replace(/^>\s?/,``)),r+=1;return{node:(0,V.jsx)(`blockquote`,{className:`my-3 rounded-lg border-l-4 border-primary/50 bg-muted/60 px-3 py-2 text-muted-foreground`,children:Z(n.join(` `))},t),nextIndex:r}}let a=[],o=t;for(;o<e.length;){let t=e[o]?.trim()??``;if(!t||we(t))break;a.push(t),o+=1}return{node:(0,V.jsx)(`p`,{children:Z(a.join(` `))},t),nextIndex:o}}function ke(e){let t=Ce(e).replace(/\r\n/g,`
6
+ `).split(`
7
+ `),n=[],r=0;for(;r<t.length;){if(!(t[r]??``).trim()){r+=1;continue}let e=Oe(t,r);n.push(e.node),r=e.nextIndex}return n}function Ae(e){return Array.isArray(e)?e.map(e=>Ae(e)).filter(e=>e.trim().length>0).join(`, `):e&&typeof e==`object`?``:String(e??``)}function je(e){try{let t=JSON.parse(e);return!t||typeof t!=`object`||Array.isArray(t)?[]:Object.entries(t).map(([e,t])=>({key:e,value:Ae(t)})).filter(e=>e.value.trim().length>0)}catch{return[]}}function Me(e){return e.replace(/\r\n/g,`
8
+ `).split(`
9
+ `).map(e=>e.match(/^([A-Za-z0-9_.-]+):\s*(.+)$/)).filter(e=>!!e).map(e=>({key:e[1]??``,value:e[2]?.replace(/^["']|["']$/g,``)??``})).filter(e=>e.key&&e.value.trim().length>0)}function Ne(e){let t=je(e);return t.length>0?t:Me(e)}function Pe(){return(0,V.jsxs)(`div`,{className:`space-y-4 p-5`,children:[(0,V.jsxs)(`section`,{className:`rounded-xl border border-border bg-card p-5`,children:[(0,V.jsx)(L,{className:`h-7 w-1/2`}),(0,V.jsx)(L,{className:`mt-3 h-4 w-3/4`}),(0,V.jsx)(L,{className:`mt-4 h-4 w-full`}),(0,V.jsx)(L,{className:`mt-3 h-4 w-2/3`})]}),(0,V.jsxs)(`section`,{className:`grid gap-4 lg:grid-cols-[minmax(220px,0.42fr)_minmax(0,1fr)]`,children:[(0,V.jsx)(L,{className:`h-56 rounded-xl`}),(0,V.jsx)(L,{className:`h-56 rounded-xl`})]})]})}function Fe({raw:e}){let t=Ne(e);return t.length===0?(0,V.jsx)(`pre`,{className:`m-0 whitespace-pre-wrap break-words font-mono text-xs leading-6`,children:e}):(0,V.jsx)(`dl`,{className:`m-0`,children:t.map(e=>(0,V.jsxs)(`div`,{className:`grid grid-cols-[minmax(104px,0.34fr)_minmax(0,1fr)] gap-3 border-b border-border/70 py-2 last:border-b-0`,children:[(0,V.jsx)(`dt`,{className:`break-words font-semibold text-primary`,children:e.key}),(0,V.jsx)(`dd`,{className:`m-0 break-words text-card-foreground`,children:e.value})]},e.key))})}function Ie({title:e,children:t}){return(0,V.jsxs)(`article`,{className:`overflow-hidden rounded-xl border border-border bg-card shadow-sm`,children:[(0,V.jsx)(`h2`,{className:`border-b border-border bg-muted/40 px-4 py-3 text-sm font-semibold text-card-foreground`,children:e}),(0,V.jsx)(`div`,{className:`p-4 text-sm leading-7 text-card-foreground`,children:t})]})}function Le(){return(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center bg-background p-6 text-center text-muted-foreground`,children:(0,V.jsxs)(`div`,{className:`max-w-sm`,children:[(0,V.jsx)(ie,{className:`mx-auto mb-3 h-7 w-7 text-muted-foreground`}),(0,V.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:r(`marketplaceDetailUnavailableTitle`)}),(0,V.jsx)(`p`,{className:`mt-2 text-sm leading-6`,children:r(`marketplaceDetailUnavailableDescription`)})]})})}function Re({entry:e}){let t=e.metadataRaw?.trim()||`-`,n=e.contentRaw?.trim()||`-`,i=e.summary?.trim(),a=e.description?.trim(),o=!!a&&a!==i;return(0,V.jsx)(`main`,{className:`h-full overflow-auto bg-background text-foreground custom-scrollbar`,children:(0,V.jsxs)(`div`,{className:`mx-auto max-w-[940px] space-y-4 p-5 pb-9`,children:[(0,V.jsxs)(`section`,{className:`rounded-xl border border-border bg-card p-5 shadow-sm`,children:[(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(`div`,{className:`mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border bg-muted text-primary`,children:(0,V.jsx)(ne,{className:`h-4 w-4`})}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h1`,{className:`break-words text-2xl font-semibold leading-tight text-foreground`,children:e.title}),(0,V.jsxs)(`p`,{className:`mt-2 break-words text-xs text-muted-foreground`,children:[e.typeLabel,` · `,e.spec,e.author?` · ${e.author}`:``]})]})]}),i?(0,V.jsx)(`p`,{className:`mt-4 text-sm leading-7 text-card-foreground`,children:i}):null,o?(0,V.jsx)(`p`,{className:`mt-3 text-sm leading-7 text-card-foreground`,children:a}):null,e.tags&&e.tags.length>0?(0,V.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:e.tags.map(e=>(0,V.jsx)(`span`,{className:`rounded-full border border-border bg-muted px-3 py-1 text-xs text-muted-foreground`,children:e},e))}):null,e.sourceUrl?(0,V.jsxs)(`p`,{className:`mt-4 break-all text-xs text-muted-foreground`,children:[e.sourceLabel??r(`marketplaceDetailSource`),`: `,` `,(0,V.jsx)(`a`,{href:e.sourceUrl,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-primary hover:underline`,children:e.sourceUrl})]}):null]}),(0,V.jsxs)(`section`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(300px,100%),1fr))] gap-4`,children:[(0,V.jsx)(Ie,{title:r(`marketplaceDetailMetadata`),children:(0,V.jsx)(Fe,{raw:t})}),(0,V.jsx)(Ie,{title:r(`marketplaceDetailContent`),children:(0,V.jsx)(`div`,{className:`marketplace-detail-markdown space-y-3 text-sm leading-7 text-card-foreground [&_a]:font-medium [&_a]:text-primary [&_a:hover]:underline`,children:ke(n)})})]})]})})}function ze({currentUrl:e}){let t=xe(e),n=ge(t);return t?!n||n.status===`loading`?(0,V.jsx)(Pe,{}):n.status===`error`&&!n.contentRaw?(0,V.jsx)(Le,{}):(0,V.jsx)(Re,{entry:n}):(0,V.jsx)(Le,{})}var Be={[_e]:{getTitle:e=>e.title,renderContent:({currentUrl:e})=>(0,V.jsx)(ze,{currentUrl:e}),renderIcon:()=>(0,V.jsx)(ne,{className:`h-4 w-4 text-primary`})}},Ve=160;function He({disabled:e,onLoadMore:t,thresholdPx:n=Ve,watchValue:r}){let i=(0,Y.useRef)(null),a=(0,Y.useRef)(null),o=(0,Y.useRef)(t),s=(0,Y.useRef)(!1);return(0,Y.useEffect)(()=>{o.current=t},[t]),(0,Y.useEffect)(()=>{e&&(s.current=!1)},[e]),(0,Y.useEffect)(()=>{let t=i.current,r=a.current;if(e||!t||!r)return;let c=()=>{s.current||e||(s.current=!0,Promise.resolve(o.current()).finally(()=>{s.current=!1}))},l=()=>{r.getBoundingClientRect().top-t.getBoundingClientRect().bottom<=n&&c()};if(typeof IntersectionObserver==`function`){let e=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&c()},{root:t,rootMargin:`0px 0px ${n}px 0px`});return e.observe(r),l(),()=>{e.disconnect()}}return t.addEventListener(`scroll`,l,{passive:!0}),l(),()=>{t.removeEventListener(`scroll`,l)}},[e,n,r]),{containerRef:i,sentinelRef:a}}function Q(e){return(e??``).trim().toLowerCase()}function Ue(e){let t=new Map;for(let n of e){let e=[n.catalogSlug,n.spec,n.id,n.label];for(let r of e){let e=Q(r);!e||t.has(e)||t.set(e,n)}}return t}function We(e,t){let n=[e.slug,e.install.spec,e.id,e.name];for(let e of n){let n=Q(e);if(!n)continue;let r=t.get(n);if(r)return r}}function Ge(e,t,n){return fe(t?.summaryI18n,t?.summary,e)||pe(n,e)||r(`marketplaceInstalledLocalSummary`)}function Ke(e,t){return t?.transport?t.transport.toUpperCase():(e?.install?.transportTypes??[]).map(e=>e.toUpperCase()).join(` / `)||`MCP`}function qe(e){let{item:t,record:n,localeFallbacks:i,onOpen:a,onInstall:o,onToggle:s,onDoctor:c,onRemove:l}=e,u=n,d=t?.name??n?.label??n?.id??`MCP`,f=Ge(i,t,n),p=Ke(t,n),m=u?u.enabled===!1?r(`marketplaceDisable`):r(`statusReady`):null;return(0,V.jsx)(`article`,{onClick:a,className:`cursor-pointer rounded-2xl border border-gray-200/70 bg-white p-4 shadow-sm transition hover:border-blue-300 hover:shadow-md`,children:(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-sm font-semibold text-gray-900`,children:d}),(0,V.jsx)(`div`,{className:`mt-1 text-xs text-gray-500`,children:p}),(0,V.jsx)(`div`,{className:`mt-2 line-clamp-2 text-sm text-gray-600`,children:f}),(0,V.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(t?.tags??[]).map(e=>(0,V.jsx)(R,{children:e},e)),m?(0,V.jsx)(R,{tone:`success`,children:m}):null]})]}),(0,V.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2`,children:[!u&&t&&o?(0,V.jsx)(_,{type:`button`,size:`sm`,variant:`primary`,className:`rounded-xl`,onClick:e=>{e.stopPropagation(),o()},children:r(`marketplaceInstall`)}):null,u?(0,V.jsxs)(V.Fragment,{children:[s?(0,V.jsx)(_,{type:`button`,size:`sm`,variant:`outline`,className:`rounded-xl border-gray-200 text-gray-700`,onClick:e=>{e.stopPropagation(),s()},children:u.enabled===!1?r(`marketplaceEnable`):r(`marketplaceDisable`)}):null,c?(0,V.jsx)(_,{type:`button`,size:`sm`,variant:`outline`,className:`rounded-xl border-blue-200 text-blue-700 hover:border-blue-300 hover:bg-blue-50 hover:text-blue-700`,onClick:e=>{e.stopPropagation(),c()},children:r(`marketplaceMcpDoctor`)}):null,l?(0,V.jsx)(_,{type:`button`,size:`sm`,variant:`outline`,className:`rounded-xl border-rose-200 text-rose-600 hover:border-rose-300 hover:bg-rose-50 hover:text-rose-600`,onClick:e=>{e.stopPropagation(),l()},children:r(`marketplaceMcpRemove`)}):null]}):null]})]})})}function Je(e){let{item:t,open:n,pending:r,onOpenChange:i,onSubmit:a}=e;return(0,V.jsx)(O,{open:n,onOpenChange:i,children:t?(0,V.jsx)(Ye,{item:t,pending:r,onOpenChange:i,onSubmit:a},`${t.slug}:${n?`open`:`closed`}`):null})}function Ye(e){let{item:t,pending:n,onOpenChange:i,onSubmit:a}=e,s=t.install,[c,l]=(0,Y.useState)(s?.defaultName??``),[u,d]=(0,Y.useState)(!0),[p,m]=(0,Y.useState)(Object.fromEntries((s?.inputs??[]).map(e=>[e.id,e.defaultValue??``])));return(0,V.jsxs)(A,{children:[(0,V.jsxs)(k,{children:[(0,V.jsx)(j,{children:r(`marketplaceMcpInstallDialogTitle`)}),(0,V.jsx)(D,{children:t.name})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`div`,{className:`text-sm font-medium text-gray-800`,children:r(`marketplaceMcpServerName`)}),(0,V.jsx)(o,{value:c,onChange:e=>l(e.target.value),placeholder:s?.defaultName??`mcp-server`})]}),(0,V.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl border border-gray-200 px-3 py-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-sm font-medium text-gray-900`,children:r(`marketplaceMcpAllAgents`)}),(0,V.jsx)(`div`,{className:`text-xs text-gray-500`,children:r(`marketplaceMcpAllAgentsDescription`)})]}),(0,V.jsx)(f,{checked:u,onCheckedChange:d})]}),(s?.inputs??[]).map(e=>(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`div`,{className:`text-sm font-medium text-gray-800`,children:e.label}),e.description?(0,V.jsx)(`div`,{className:`text-xs text-gray-500`,children:e.description}):null,(0,V.jsx)(o,{type:e.secret?`password`:`text`,value:p[e.id]??``,onChange:t=>m(n=>({...n,[e.id]:t.target.value})),placeholder:e.defaultValue??``})]},e.id))]}),(0,V.jsxs)(E,{children:[(0,V.jsx)(_,{variant:`outline`,onClick:()=>i(!1),disabled:n,children:r(`cancel`)}),(0,V.jsx)(_,{onClick:()=>void a({name:c,allAgents:u,inputs:p}),disabled:n||!c.trim(),children:r(n?`marketplaceInstalling`:`marketplaceInstall`)})]})]})}function Xe(e){let{result:t,targetName:n,open:i,pending:a,onOpenChange:o}=e;return(0,V.jsx)(O,{open:i,onOpenChange:o,children:(0,V.jsxs)(A,{children:[(0,V.jsxs)(k,{children:[(0,V.jsx)(j,{children:r(`marketplaceMcpDoctorTitle`)}),(0,V.jsx)(D,{children:n??`-`})]}),a?(0,V.jsx)(`div`,{className:`text-sm text-gray-500`,children:r(`loading`)}):null,!a&&t?(0,V.jsxs)(`div`,{className:`space-y-3 text-sm text-gray-700`,children:[(0,V.jsxs)(`div`,{children:[r(`marketplaceMcpDoctorAccessible`),`:`,` `,t.accessible?r(`statusReady`):r(`marketplaceOperationFailed`)]}),(0,V.jsxs)(`div`,{children:[r(`marketplaceMcpDoctorTransport`),`:`,` `,t.transport.toUpperCase()]}),(0,V.jsxs)(`div`,{children:[r(`marketplaceMcpDoctorTools`),`: `,t.toolCount]}),t.error?(0,V.jsx)(I,{tone:`danger`,description:t.error,className:`rounded-lg`}):null]}):null]})})}function Ze(e){let t=z({queryKey:[`marketplace-mcp-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>y({...e,page:t}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0,staleTime:15e3}),n=(0,Y.useMemo)(()=>B(t.data),[t.data]);return{...t,data:n}}function Qe(){return b({queryKey:[`marketplace-mcp-installed`],queryFn:()=>s(),staleTime:1e4})}function $e(){let e=m();return h({mutationFn:l,onSuccess:t=>{e.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}),v.success(t.message||r(`marketplaceInstallSuccessMcp`))},onError:e=>{v.error(e.message||r(`marketplaceInstallFailed`))}})}function et(){let e=m();return h({mutationFn:u,onSuccess:t=>{e.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}),v.success(t.message||r(`marketplaceMcpManageSuccess`))},onError:e=>{v.error(e.message||r(`marketplaceOperationFailed`))}})}var $=12;function tt(){let[e,t]=(0,Y.useState)(`catalog`),[n,i]=(0,Y.useState)(``),[o,s]=(0,Y.useState)(``),[c,l]=(0,Y.useState)(`relevance`),[u,f]=(0,Y.useState)(null),[m,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(null),{language:y}=re(),b=ce(),{confirm:x,ConfirmDialog:S}=ae(),C=(0,Y.useMemo)(()=>G(y),[y]);(0,Y.useEffect)(()=>{let e=window.setTimeout(()=>{s(n.trim())},250);return()=>window.clearTimeout(e)},[n]);let w=Ze({q:o||void 0,sort:c,pageSize:$}),T=Qe(),{containerRef:E,sentinelRef:D}=He({disabled:e!==`catalog`||w.isError||!w.hasNextPage||w.isFetchingNextPage,onLoadMore:()=>w.fetchNextPage(),watchValue:`${e}:${o}:${c}:${w.data?.loadedItems??0}:${w.data?.loadedPages??0}`});(0,Y.useEffect)(()=>{let e=E.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[E,o,e,c]);let O=$e(),k=et(),A=h({mutationFn:d,onSuccess:(e,t)=>{g(t),v(e)}}),j=(0,Y.useMemo)(()=>Ue(T.data?.records??[]),[T.data?.records]),M=(0,Y.useMemo)(()=>(T.data?.records??[]).filter(e=>{let t=[e.id??``,e.label??``,e.catalogSlug??``,e.description??``,e.descriptionZh??``].join(` `).toLowerCase();return o?t.includes(o.toLowerCase()):!0}),[T.data?.records,o]),N=async(e,t)=>{let n=e?.name??t?.label??t?.id??`MCP`,i=ye(e?`mcp`:`mcp-local`,e?.slug??t?.id??t?.spec??n),a=Ge(C,e,t);if(!e){X(b,{id:i,title:n,typeLabel:r(`marketplaceTypeMcp`),spec:t?.spec??`-`,status:`ready`,summary:a,metadataRaw:JSON.stringify(t??{},null,2),contentRaw:r(`marketplaceInstalledLocalSummary`),sourceUrl:t?.docsUrl,sourceLabel:r(`marketplaceDetailSource`)});return}X(b,{id:i,title:n,typeLabel:r(`marketplaceTypeMcp`),spec:e.install.spec,status:`loading`,summary:a,tags:e.tags,author:e.author});try{let t=await ee(e.slug);X(b,{id:i,title:n,typeLabel:r(`marketplaceTypeMcp`),spec:e.install.spec,status:`ready`,summary:a,metadataRaw:t.metadataRaw||JSON.stringify(e,null,2),contentRaw:t.bodyRaw||t.raw,sourceUrl:t.sourceUrl,sourceLabel:r(`marketplaceDetailSource`),tags:e.tags,author:e.author},{activate:!1})}catch(t){X(b,{id:i,title:n,typeLabel:r(`marketplaceTypeMcp`),spec:e.install.spec,status:`error`,summary:a,metadataRaw:JSON.stringify({error:t instanceof Error?t.message:String(t)},null,2),contentRaw:a},{activate:!1})}},P=async e=>{u&&(await O.mutateAsync({spec:u.slug,name:e.name.trim(),allAgents:e.allAgents,inputs:e.inputs}),f(null))},F=async(e,t)=>{let n=t.id||t.spec;n&&(e===`remove`&&!await x({title:`${r(`marketplaceMcpRemoveTitle`)} ${n}?`,description:r(`marketplaceMcpRemoveDescription`),confirmLabel:r(`marketplaceMcpRemove`),variant:`destructive`})||await k.mutateAsync({action:e,id:n,spec:t.spec}))},te=[{id:`catalog`,label:r(`marketplaceMcpTabCatalog`),icon:se},{id:`installed`,label:r(`marketplaceMcpTabInstalled`),icon:ue,count:T.data?.total??0}];return(0,V.jsxs)(p,{className:`flex h-full min-h-0 flex-col pb-0 px-0`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col gap-6 w-full max-w-[1400px] h-full min-h-0 mx-auto`,children:[(0,V.jsxs)(`div`,{className:`relative isolate overflow-hidden rounded-[28px] border border-border bg-card px-10 py-12 text-card-foreground shadow-card`,children:[(0,V.jsx)(`div`,{className:`absolute inset-y-0 left-0 w-1 bg-primary/80`}),(0,V.jsxs)(`div`,{className:`relative z-10 flex flex-col gap-3`,children:[(0,V.jsx)(`h1`,{className:`text-[38px] font-extrabold leading-tight text-foreground`,children:r(`marketplaceMcpPageTitle`)}),(0,V.jsx)(`p`,{className:`max-w-2xl text-[17px] font-medium leading-relaxed text-muted-foreground`,children:r(`marketplaceMcpPageDescription`)})]})]}),(0,V.jsxs)(`div`,{className:`flex flex-col md:flex-row md:items-center justify-between gap-4 mt-2`,children:[(0,V.jsx)(`div`,{className:`flex items-center gap-1.5 p-1 bg-gray-100/60 backdrop-blur-sm rounded-2xl w-fit border border-gray-200/50 shadow-inner`,children:te.map(n=>{let r=e===n.id,i=n.icon;return(0,V.jsxs)(`button`,{onClick:()=>t(n.id),className:a(`relative flex items-center gap-2 px-5 py-2.5 rounded-xl font-semibold text-[14px] transition-all duration-300`,r?`text-gray-900 bg-white shadow-[0_2px_10px_rgb(0,0,0,0.06)]`:`text-gray-500 hover:text-gray-700 hover:bg-gray-200/40`),children:[(0,V.jsx)(i,{className:a(`w-4 h-4`,r?`text-primary`:`text-gray-400`)}),n.label,n.id===`installed`&&typeof n.count==`number`&&(0,V.jsx)(`span`,{className:a(`ml-1 flex items-center justify-center h-5 px-1.5 min-w-5 rounded-full text-[11px] font-bold transition-colors`,r?`bg-primary/10 text-primary`:`bg-gray-200 text-gray-500`),children:n.count})]},n.id)})}),(0,V.jsx)(`div`,{className:`flex-1 w-full md:max-w-md`,children:(0,V.jsx)(H,{scope:e===`catalog`?`all`:`installed`,searchText:n,isRefreshing:!1,searchPlaceholder:r(`marketplaceMcpSearchPlaceholder`),sort:c,onSearchTextChange:i,onSortChange:l})})]}),(0,V.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col mt-2`,children:[(0,V.jsx)(`div`,{className:`flex items-center justify-between mb-4 px-1`,children:(0,V.jsxs)(`h3`,{className:`text-[18px] font-bold tracking-tight text-gray-900 flex items-center gap-2`,children:[r(e===`catalog`?`marketplaceMcpSectionCatalog`:`marketplaceMcpSectionInstalled`),(0,V.jsx)(`span`,{className:`flex items-center justify-center h-6 px-2 rounded-lg bg-gray-100 text-[12px] font-semibold text-gray-500`,children:e===`catalog`?w.data?.total??0:T.data?.total??0})]})}),(0,V.jsxs)(`div`,{ref:E,className:`min-h-0 flex-1 overflow-y-auto pr-3 pb-8 -mx-1 px-1 custom-scrollbar`,"aria-busy":w.isLoading||w.isFetchingNextPage,children:[(0,V.jsxs)(`div`,{className:`grid grid-cols-1 gap-[22px] md:grid-cols-2 lg:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 items-stretch`,children:[e===`catalog`&&w.isLoading&&(0,V.jsx)(U,{count:$}),e===`catalog`&&!w.isLoading&&(w.data?.items??[]).map(e=>{let t=We(e,j);return(0,V.jsx)(qe,{item:e,record:t,localeFallbacks:C,onOpen:()=>void N(e,t),onInstall:()=>f(e),onToggle:t?()=>void F(t.enabled===!1?`enable`:`disable`,t):void 0,onDoctor:t?()=>{g(t.id??null),v(null),A.mutateAsync(t.id??``)}:void 0,onRemove:t?()=>void F(`remove`,t):void 0},e.id)}),e===`installed`&&M.map(e=>(0,V.jsx)(qe,{record:e,localeFallbacks:C,onOpen:()=>void N(void 0,e),onToggle:()=>void F(e.enabled===!1?`enable`:`disable`,e),onDoctor:()=>{g(e.id??null),v(null),A.mutateAsync(e.id??``)},onRemove:()=>void F(`remove`,e)},e.id??e.spec))]}),e===`catalog`&&w.isError&&(0,V.jsx)(I,{tone:`danger`,title:r(`marketplaceMcpSectionCatalog`),description:w.error.message}),e===`installed`&&T.isError&&(0,V.jsx)(I,{tone:`danger`,title:r(`marketplaceMcpSectionInstalled`),description:T.error.message}),e===`catalog`&&!w.isLoading&&!w.isError&&(w.data?.items?.length??0)===0&&(0,V.jsx)(`div`,{className:`flex flex-col items-center justify-center py-20 bg-gray-50/50 rounded-3xl border border-dashed border-gray-200 mt-4`,children:(0,V.jsx)(`p`,{className:`text-[15px] font-medium text-gray-500`,children:r(`marketplaceNoMcp`)})}),e===`installed`&&!T.isError&&M.length===0&&(0,V.jsx)(`div`,{className:`flex flex-col items-center justify-center py-20 bg-gray-50/50 rounded-3xl border border-dashed border-gray-200 mt-4`,children:(0,V.jsx)(`p`,{className:`text-[15px] font-medium text-gray-500`,children:r(`marketplaceNoInstalledMcp`)})}),e===`catalog`&&!w.isError&&(0,V.jsx)(W,{hasMore:!!w.hasNextPage,loading:w.isFetchingNextPage,sentinelRef:D})]})]})]}),(0,V.jsx)(Je,{item:u,open:!!u,pending:O.isPending,onOpenChange:e=>!e&&f(null),onSubmit:P}),(0,V.jsx)(Xe,{open:!!m,targetName:m,result:_,pending:A.isPending,onOpenChange:e=>!e&&g(null)}),(0,V.jsx)(S,{})]})}export{X as a,H as c,B as d,z as f,ye as i,W as l,He as n,G as o,Be as r,fe as s,tt as t,U as u};
@@ -0,0 +1 @@
1
+ import{t as e}from"./mcp-marketplace-page-BfA7A3n4.js";export{e as McpMarketplacePage};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DseTPa7n.js";import{h as t,p as n,r}from"./react-BY-U3h3t.js";import{Bt as i,Ht as a,Nt as o,Rt as s,Vt as c,zt as l}from"./api-IlX_CbwU.js";import{t as u}from"./book-open-CN7Shpij.js";import{t as d}from"./provider-scoped-model-input-DZMtoAJG.js";import{t as f}from"./folder-DGWqFDvE.js";import{t as p}from"./loader-circle-DtKek-qG.js";import{n as m,t as h}from"./skeleton-BgkzQd4U.js";import{f as g}from"./doc-browser-context-CCdW9TJf.js";import{n as _}from"./provider-models-BoUhFo9R.js";import{t as v}from"./form-actions-D2imZLnU.js";import{l as y,m as b,r as x,t as S,u as C}from"./use-config-D6yx0lb0.js";import{t as w}from"./config-hints-LxG80Uj5.js";var T=e(t(),1),E=n(),D=`provider/model`;function O(e){let{initialModel:t,initialWorkspace:n,isPending:o,modelHelpText:s,modelLabel:l,modelPlaceholder:h,onSubmit:_,providerCatalog:y,workspaceLabel:b,workspacePlaceholder:x}=e,[S,C]=(0,T.useState)(t),[w,D]=(0,T.useState)(n);return(0,E.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),_({model:S,workspace:w})},className:`space-y-5`,children:[(0,E.jsxs)(`div`,{className:`grid grid-cols-1 gap-5 md:grid-cols-2`,children:[(0,E.jsxs)(`div`,{className:`rounded-2xl border border-border/75 bg-card p-6`,children:[(0,E.jsxs)(`div`,{className:`mb-6 flex items-center gap-3`,children:[(0,E.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:(0,E.jsx)(m,{className:`h-4 w-4`})}),(0,E.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:r(`defaultModel`)})]}),(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(i,{htmlFor:`model`,className:`text-xs font-medium text-muted-foreground`,children:l}),(0,E.jsx)(d,{id:`model`,value:S,onChange:C,providerCatalog:y,modelPlaceholder:h}),(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground/80`,children:s}),(0,E.jsxs)(`a`,{href:g(`/guide/model-selection`),className:`inline-flex items-center gap-1.5 text-xs text-primary transition-colors hover:text-primary-hover`,children:[(0,E.jsx)(u,{className:`h-3.5 w-3.5`}),r(`channelsGuideTitle`)]})]})]}),(0,E.jsxs)(`div`,{className:`rounded-2xl border border-border/75 bg-card p-6`,children:[(0,E.jsxs)(`div`,{className:`mb-6 flex items-center gap-3`,children:[(0,E.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:(0,E.jsx)(f,{className:`h-4 w-4`})}),(0,E.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:r(`workspace`)})]}),(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(i,{htmlFor:`workspace`,className:`text-xs font-medium text-muted-foreground`,children:b}),(0,E.jsx)(c,{id:`workspace`,value:w,onChange:e=>D(e.target.value),placeholder:x,className:`rounded-xl`})]})]})]}),(0,E.jsx)(v,{children:(0,E.jsx)(a,{type:`submit`,disabled:o,size:`sm`,children:o?(0,E.jsx)(p,{className:`h-3.5 w-3.5 animate-spin`}):r(`saveChanges`)})})]})}function k(){let{data:e,isLoading:t}=S(),{data:n}=C(),{data:i}=y(),{data:a}=x(),c=b(),u=a?.uiHints,d=w(`agents.defaults.model`,u),f=w(`agents.defaults.workspace`,u),p=(0,T.useMemo)(()=>_({providersView:n,templatesView:i,config:e,onlyConfigured:!0}),[e,n,i]),m=r(`modelIdentifierHelp`)||d?.help||``,g=(e?.agents?.defaults?.model||``).trim(),v=e?.agents?.defaults?.workspace||``;return t?(0,E.jsxs)(`div`,{className:`max-w-2xl space-y-6`,children:[(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(h,{className:`h-8 w-32`}),(0,E.jsx)(h,{className:`h-4 w-48`})]}),(0,E.jsxs)(o,{hover:!1,className:`rounded-2xl border-border/75 p-6 shadow-none`,children:[(0,E.jsxs)(`div`,{className:`mb-6 flex items-center gap-3`,children:[(0,E.jsx)(h,{className:`h-9 w-9 rounded-lg`}),(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(h,{className:`h-5 w-24`}),(0,E.jsx)(h,{className:`h-3 w-32`})]})]}),(0,E.jsx)(h,{className:`mb-2 h-4 w-20`}),(0,E.jsx)(h,{className:`h-10 w-full rounded-xl`})]}),(0,E.jsxs)(o,{hover:!1,className:`rounded-2xl border-border/75 p-6 shadow-none`,children:[(0,E.jsx)(h,{className:`mb-2 h-5 w-24`}),(0,E.jsx)(h,{className:`h-10 w-full rounded-xl`})]})]}):(0,E.jsxs)(l,{children:[(0,E.jsx)(s,{title:r(`modelPageTitle`),description:r(`modelPageDescription`)}),(0,E.jsx)(O,{initialModel:g,initialWorkspace:v,isPending:c.isPending,modelHelpText:m,modelLabel:d?.label??`Model Name`,modelPlaceholder:d?.placeholder??D,onSubmit:({model:e,workspace:t})=>c.mutate({model:e,workspace:t}),providerCatalog:p,workspaceLabel:f?.label??`Default Path`,workspacePlaceholder:f?.placeholder??`/path/to/workspace`},`${g}::${v}`)]})}export{k as ModelConfigPage};
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{h as t,p as n,r}from"./react-DsgudwpT.js";import{$t as i,Gt as a,Qt as o,Xt as s,Zt as c,en as l}from"./api-Dyb5rgh0.js";import{t as u}from"./book-open-L6LCuqOr.js";import{t as d}from"./provider-scoped-model-input-B-9_DtIP.js";import{t as f}from"./folder-BIYZZWJv.js";import{t as p}from"./loader-circle-Bj2RMrCR.js";import{n as m,t as h}from"./skeleton-0uTLUhm9.js";import{f as g}from"./doc-browser-context-BlpUUFrR.js";import{n as _}from"./provider-models-BoUhFo9R.js";import{t as v}from"./form-actions-CKprWFeM.js";import{l as y,m as b,r as x,t as S,u as C}from"./use-config-CwDEAl6f.js";import{t as w}from"./config-hints-LxG80Uj5.js";var T=e(t(),1),E=n(),D=`provider/model`;function O(e){let{initialModel:t,initialWorkspace:n,isPending:a,modelHelpText:s,modelLabel:c,modelPlaceholder:h,onSubmit:_,providerCatalog:y,workspaceLabel:b,workspacePlaceholder:x}=e,[S,C]=(0,T.useState)(t),[w,D]=(0,T.useState)(n);return(0,E.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),_({model:S,workspace:w})},className:`space-y-5`,children:[(0,E.jsxs)(`div`,{className:`grid grid-cols-1 gap-5 md:grid-cols-2`,children:[(0,E.jsxs)(`div`,{className:`rounded-2xl border border-border/75 bg-card p-6`,children:[(0,E.jsxs)(`div`,{className:`mb-6 flex items-center gap-3`,children:[(0,E.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:(0,E.jsx)(m,{className:`h-4 w-4`})}),(0,E.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:r(`defaultModel`)})]}),(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(o,{htmlFor:`model`,className:`text-xs font-medium text-muted-foreground`,children:c}),(0,E.jsx)(d,{id:`model`,value:S,onChange:C,providerCatalog:y,modelPlaceholder:h}),(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground/80`,children:s}),(0,E.jsxs)(`a`,{href:g(`/guide/model-selection`),className:`inline-flex items-center gap-1.5 text-xs text-primary transition-colors hover:text-primary-hover`,children:[(0,E.jsx)(u,{className:`h-3.5 w-3.5`}),r(`channelsGuideTitle`)]})]})]}),(0,E.jsxs)(`div`,{className:`rounded-2xl border border-border/75 bg-card p-6`,children:[(0,E.jsxs)(`div`,{className:`mb-6 flex items-center gap-3`,children:[(0,E.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:(0,E.jsx)(f,{className:`h-4 w-4`})}),(0,E.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:r(`workspace`)})]}),(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(o,{htmlFor:`workspace`,className:`text-xs font-medium text-muted-foreground`,children:b}),(0,E.jsx)(i,{id:`workspace`,value:w,onChange:e=>D(e.target.value),placeholder:x,className:`rounded-xl`})]})]})]}),(0,E.jsx)(v,{children:(0,E.jsx)(l,{type:`submit`,disabled:a,size:`sm`,children:a?(0,E.jsx)(p,{className:`h-3.5 w-3.5 animate-spin`}):r(`saveChanges`)})})]})}function k(){let{data:e,isLoading:t}=S(),{data:n}=C(),{data:i}=y(),{data:o}=x(),l=b(),u=o?.uiHints,d=w(`agents.defaults.model`,u),f=w(`agents.defaults.workspace`,u),p=(0,T.useMemo)(()=>_({providersView:n,templatesView:i,config:e,onlyConfigured:!0}),[e,n,i]),m=r(`modelIdentifierHelp`)||d?.help||``,g=(e?.agents?.defaults?.model||``).trim(),v=e?.agents?.defaults?.workspace||``;return t?(0,E.jsxs)(`div`,{className:`max-w-2xl space-y-6`,children:[(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(h,{className:`h-8 w-32`}),(0,E.jsx)(h,{className:`h-4 w-48`})]}),(0,E.jsxs)(a,{hover:!1,className:`rounded-2xl border-border/75 p-6 shadow-none`,children:[(0,E.jsxs)(`div`,{className:`mb-6 flex items-center gap-3`,children:[(0,E.jsx)(h,{className:`h-9 w-9 rounded-lg`}),(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(h,{className:`h-5 w-24`}),(0,E.jsx)(h,{className:`h-3 w-32`})]})]}),(0,E.jsx)(h,{className:`mb-2 h-4 w-20`}),(0,E.jsx)(h,{className:`h-10 w-full rounded-xl`})]}),(0,E.jsxs)(a,{hover:!1,className:`rounded-2xl border-border/75 p-6 shadow-none`,children:[(0,E.jsx)(h,{className:`mb-2 h-5 w-24`}),(0,E.jsx)(h,{className:`h-10 w-full rounded-xl`})]})]}):(0,E.jsxs)(c,{children:[(0,E.jsx)(s,{title:r(`modelPageTitle`),description:r(`modelPageDescription`)}),(0,E.jsx)(O,{initialModel:g,initialWorkspace:v,isPending:l.isPending,modelHelpText:m,modelLabel:d?.label??`Model Name`,modelPlaceholder:d?.placeholder??D,onSubmit:({model:e,workspace:t})=>l.mutate({model:e,workspace:t}),providerCatalog:p,workspaceLabel:f?.label??`Default Path`,workspacePlaceholder:f?.placeholder??`/path/to/workspace`},`${g}::${v}`)]})}export{k as ModelConfigPage};
@@ -0,0 +1 @@
1
+ import{c as e}from"./dist-CrtbGLlh.js";var t=e(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]);export{t};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DseTPa7n.js";import{h as t,p as n,u as r}from"./react-BY-U3h3t.js";import{C as i,T as a,_ as o,a as s,b as c,d as l,f as u,g as d,i as f,l as p,m as ee,o as m,p as te,r as h,s as g,u as ne,w as _,x as v,y}from"./dist-D5ycbwCo.js";var b=e(t(),1);function re(e,t){return b.useReducer((e,n)=>t[e][n]??e,e)}var x=e=>{let{present:t,children:n}=e,r=ie(t),i=typeof n==`function`?n({present:r.isPresent}):b.Children.only(n),a=_(r.ref,C(i));return typeof n==`function`||r.isPresent?b.cloneElement(i,{ref:a}):null};x.displayName=`Presence`;function ie(e){let[t,n]=b.useState(),r=b.useRef(null),i=b.useRef(e),a=b.useRef(`none`),[o,s]=re(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return b.useEffect(()=>{let e=S(r.current);a.current=o===`mounted`?e:`none`},[o]),v(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=S(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),v(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=S(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=S(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:b.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function S(e){return e?.animationName||`none`}function C(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var w=n(),T=`Popover`,[E,ae]=i(T,[g]),D=g(),[oe,O]=E(T),k=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=D(t),l=b.useRef(null),[u,d]=b.useState(!1),[f,p]=y({prop:r,defaultProp:i??!1,onChange:a,caller:T});return(0,w.jsx)(m,{...s,children:(0,w.jsx)(oe,{scope:t,contentId:c(),triggerRef:l,open:f,onOpenChange:p,onOpenToggle:b.useCallback(()=>p(e=>!e),[p]),hasCustomAnchor:u,onCustomAnchorAdd:b.useCallback(()=>d(!0),[]),onCustomAnchorRemove:b.useCallback(()=>d(!1),[]),modal:o,children:n})})};k.displayName=T;var A=`PopoverAnchor`,j=b.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=O(A,n),a=D(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return b.useEffect(()=>(o(),()=>s()),[o,s]),(0,w.jsx)(h,{...a,...r,ref:t})});j.displayName=A;var M=`PopoverTrigger`,N=b.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=O(M,n),o=D(n),s=_(t,i.triggerRef),c=(0,w.jsx)(d.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":K(i.open),...r,ref:s,onClick:a(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?c:(0,w.jsx)(h,{asChild:!0,...o,children:c})});N.displayName=M;var P=`PopoverPortal`,[se,ce]=E(P,{forceMount:void 0}),F=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=O(P,t);return(0,w.jsx)(se,{scope:t,forceMount:n,children:(0,w.jsx)(x,{present:n||a.open,children:(0,w.jsx)(u,{asChild:!0,container:i,children:r})})})};F.displayName=P;var I=`PopoverContent`,L=b.forwardRef((e,t)=>{let n=ce(I,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=O(I,e.__scopePopover);return(0,w.jsx)(x,{present:r||a.open,children:a.modal?(0,w.jsx)(z,{...i,ref:t}):(0,w.jsx)(B,{...i,ref:t})})});L.displayName=I;var R=o(`PopoverContent.RemoveScroll`),z=b.forwardRef((e,t)=>{let n=O(I,e.__scopePopover),r=b.useRef(null),i=_(t,r),o=b.useRef(!1);return b.useEffect(()=>{let e=r.current;if(e)return p(e)},[]),(0,w.jsx)(ne,{as:R,allowPinchZoom:!0,children:(0,w.jsx)(V,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:a(e.onCloseAutoFocus,e=>{e.preventDefault(),o.current||n.triggerRef.current?.focus()}),onPointerDownOutside:a(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;o.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:a(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),B=b.forwardRef((e,t)=>{let n=O(I,e.__scopePopover),r=b.useRef(!1),i=b.useRef(!1);return(0,w.jsx)(V,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),V=b.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,...p}=e,m=O(I,n),h=D(n);return l(),(0,w.jsx)(te,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,w.jsx)(ee,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:f,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onDismiss:()=>m.onOpenChange(!1),children:(0,w.jsx)(s,{"data-state":K(m.open),role:`dialog`,id:m.contentId,...h,...p,ref:t,style:{...p.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),H=`PopoverClose`,U=b.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=O(H,n);return(0,w.jsx)(d.button,{type:`button`,...r,ref:t,onClick:a(e.onClick,()=>i.onOpenChange(!1))})});U.displayName=H;var W=`PopoverArrow`,G=b.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=D(n);return(0,w.jsx)(f,{...i,...r,ref:t})});G.displayName=W;function K(e){return e?`open`:`closed`}var q=k,J=j,Y=N,X=F,Z=L,le=`2rem`;function Q(e){return`min(${e}, max(0px, calc(var(--radix-popover-content-available-height, 100vh) - ${le})))`}var ue=Q(`24rem`),de=q,fe=Y,pe=J,$=b.forwardRef(({className:e,sideOffset:t=8,align:n=`start`,collisionPadding:i=12,style:a,...o},s)=>(0,w.jsx)(X,{children:(0,w.jsx)(Z,{ref:s,sideOffset:t,align:n,collisionPadding:i,className:r(`z-[var(--z-popover,10100)] w-72 overflow-x-hidden overflow-y-auto rounded-2xl border border-border bg-popover p-4 text-popover-foreground shadow-lg 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),style:{maxHeight:ue,...a},...o})}));$.displayName=Z.displayName;export{Q as a,X as c,x as d,fe as i,q as l,pe as n,J as o,$ as r,Z as s,de as t,Y as u};
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{h as t,p as n,u as r}from"./react-DsgudwpT.js";import{C as i,T as a,_ as o,a as s,b as c,d as l,f as u,g as d,i as f,l as p,m as ee,o as m,p as te,r as h,s as g,u as ne,w as _,x as v,y}from"./dist-CrtbGLlh.js";var b=e(t(),1);function re(e,t){return b.useReducer((e,n)=>t[e][n]??e,e)}var x=e=>{let{present:t,children:n}=e,r=ie(t),i=typeof n==`function`?n({present:r.isPresent}):b.Children.only(n),a=_(r.ref,C(i));return typeof n==`function`||r.isPresent?b.cloneElement(i,{ref:a}):null};x.displayName=`Presence`;function ie(e){let[t,n]=b.useState(),r=b.useRef(null),i=b.useRef(e),a=b.useRef(`none`),[o,s]=re(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return b.useEffect(()=>{let e=S(r.current);a.current=o===`mounted`?e:`none`},[o]),v(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=S(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),v(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=S(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=S(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:b.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function S(e){return e?.animationName||`none`}function C(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var w=n(),T=`Popover`,[E,ae]=i(T,[g]),D=g(),[oe,O]=E(T),k=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=D(t),l=b.useRef(null),[u,d]=b.useState(!1),[f,p]=y({prop:r,defaultProp:i??!1,onChange:a,caller:T});return(0,w.jsx)(m,{...s,children:(0,w.jsx)(oe,{scope:t,contentId:c(),triggerRef:l,open:f,onOpenChange:p,onOpenToggle:b.useCallback(()=>p(e=>!e),[p]),hasCustomAnchor:u,onCustomAnchorAdd:b.useCallback(()=>d(!0),[]),onCustomAnchorRemove:b.useCallback(()=>d(!1),[]),modal:o,children:n})})};k.displayName=T;var A=`PopoverAnchor`,j=b.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=O(A,n),a=D(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return b.useEffect(()=>(o(),()=>s()),[o,s]),(0,w.jsx)(h,{...a,...r,ref:t})});j.displayName=A;var M=`PopoverTrigger`,N=b.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=O(M,n),o=D(n),s=_(t,i.triggerRef),c=(0,w.jsx)(d.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":K(i.open),...r,ref:s,onClick:a(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?c:(0,w.jsx)(h,{asChild:!0,...o,children:c})});N.displayName=M;var P=`PopoverPortal`,[se,ce]=E(P,{forceMount:void 0}),F=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=O(P,t);return(0,w.jsx)(se,{scope:t,forceMount:n,children:(0,w.jsx)(x,{present:n||a.open,children:(0,w.jsx)(u,{asChild:!0,container:i,children:r})})})};F.displayName=P;var I=`PopoverContent`,L=b.forwardRef((e,t)=>{let n=ce(I,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=O(I,e.__scopePopover);return(0,w.jsx)(x,{present:r||a.open,children:a.modal?(0,w.jsx)(z,{...i,ref:t}):(0,w.jsx)(B,{...i,ref:t})})});L.displayName=I;var R=o(`PopoverContent.RemoveScroll`),z=b.forwardRef((e,t)=>{let n=O(I,e.__scopePopover),r=b.useRef(null),i=_(t,r),o=b.useRef(!1);return b.useEffect(()=>{let e=r.current;if(e)return p(e)},[]),(0,w.jsx)(ne,{as:R,allowPinchZoom:!0,children:(0,w.jsx)(V,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:a(e.onCloseAutoFocus,e=>{e.preventDefault(),o.current||n.triggerRef.current?.focus()}),onPointerDownOutside:a(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;o.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:a(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),B=b.forwardRef((e,t)=>{let n=O(I,e.__scopePopover),r=b.useRef(!1),i=b.useRef(!1);return(0,w.jsx)(V,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),V=b.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,...p}=e,m=O(I,n),h=D(n);return l(),(0,w.jsx)(te,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,w.jsx)(ee,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:f,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onDismiss:()=>m.onOpenChange(!1),children:(0,w.jsx)(s,{"data-state":K(m.open),role:`dialog`,id:m.contentId,...h,...p,ref:t,style:{...p.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),H=`PopoverClose`,U=b.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=O(H,n);return(0,w.jsx)(d.button,{type:`button`,...r,ref:t,onClick:a(e.onClick,()=>i.onOpenChange(!1))})});U.displayName=H;var W=`PopoverArrow`,G=b.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=D(n);return(0,w.jsx)(f,{...i,...r,ref:t})});G.displayName=W;function K(e){return e?`open`:`closed`}var q=k,J=j,Y=N,X=F,Z=L,le=`2rem`;function Q(e){return`min(${e}, max(0px, calc(var(--radix-popover-content-available-height, 100vh) - ${le})))`}var ue=Q(`24rem`),de=q,fe=Y,pe=J,$=b.forwardRef(({className:e,sideOffset:t=8,align:n=`start`,collisionPadding:i=12,style:a,...o},s)=>(0,w.jsx)(X,{children:(0,w.jsx)(Z,{ref:s,sideOffset:t,align:n,collisionPadding:i,className:r(`z-[var(--z-popover,10100)] w-72 overflow-x-hidden overflow-y-auto rounded-2xl border border-border bg-popover p-4 text-popover-foreground shadow-lg 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),style:{maxHeight:ue,...a},...o})}));$.displayName=Z.displayName;export{Q as a,X as c,x as d,fe as i,q as l,pe as n,J as o,$ as r,Z as s,de as t,Y as u};
@@ -1 +1 @@
1
- import{i as e}from"./chunk-DseTPa7n.js";import{h as t,p as n,r,u as i}from"./react-BY-U3h3t.js";import{Vt as a}from"./api-IlX_CbwU.js";import{c as o}from"./dist-D5ycbwCo.js";import{a as s,n as c,r as l,t as u}from"./popover-Btp7KVc3.js";import{a as d,i as f,n as p,r as m,t as h,w as g}from"./select-B5EecXJt.js";import{i as _,l as v,r as y}from"./provider-models-BoUhFo9R.js";var b=o(`ChevronsUpDown`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),x=e(t(),1),S=n(),C=s(`15rem`);function w(e){let t=new Set;for(let n of e){let e=n.trim();e.length>0&&t.add(e)}return[...t]}function T({id:e,value:t,onChange:n,options:r,disabled:o=!1,placeholder:s,className:d,inputClassName:f,emptyText:p,createText:m,toggleLabel:h,maxItems:_=1/0,onEnter:v}){let[y,T]=(0,x.useState)(!1);(0,x.useEffect)(()=>{o&&y&&T(!1)},[o,y]);let E=(0,x.useMemo)(()=>w(r),[r]),D=t.trim().toLowerCase(),O=(0,x.useMemo)(()=>{let e=E.map((e,t)=>({option:e,index:t}));D.length>0&&e.sort((e,t)=>{let n=e.option.toLowerCase(),r=t.option.toLowerCase(),i=n===D?0:n.startsWith(D)?1:n.includes(D)?2:3,a=r===D?0:r.startsWith(D)?1:r.includes(D)?2:3;return i===a?e.index-t.index:i-a});let t=e.map(e=>e.option);return Number.isFinite(_)?t.slice(0,Math.max(1,_)):t},[E,D,_]),k=t.trim().length>0&&E.some(e=>e===t.trim()),A=()=>T(!1);return(0,S.jsxs)(u,{open:y&&!o,onOpenChange:e=>T(!o&&e),children:[(0,S.jsx)(c,{asChild:!0,children:(0,S.jsxs)(`div`,{className:i(`relative`,d),children:[(0,S.jsx)(a,{id:e,value:t,disabled:o,onFocus:()=>{o||T(!0)},onChange:e=>{n(e.target.value),!y&&!o&&T(!0)},onKeyDown:e=>{e.key===`Enter`&&(v&&(e.preventDefault(),v()),A())},placeholder:s,className:i(`pr-10`,f)}),(0,S.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>T(e=>!e),disabled:o,className:i(`absolute inset-y-0 right-0 inline-flex w-10 items-center justify-center`,o?`cursor-not-allowed text-gray-300`:`text-gray-400 hover:text-gray-600`),"aria-label":h,children:(0,S.jsx)(b,{className:`h-4 w-4`})})]})}),(0,S.jsx)(l,{align:`start`,className:`flex w-[var(--radix-popover-trigger-width)] min-w-[12rem] flex-col overflow-hidden rounded-xl border border-gray-200 p-0 shadow-lg`,onOpenAutoFocus:e=>e.preventDefault(),style:{maxHeight:C},children:(0,S.jsxs)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto py-1`,children:[!k&&t.trim().length>0&&(0,S.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{n(t.trim()),A()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-gray-50`,children:[(0,S.jsx)(g,{className:`h-4 w-4 text-transparent`}),(0,S.jsx)(`span`,{className:`truncate text-gray-700`,children:m.replace(`{value}`,t.trim())})]}),O.map(e=>(0,S.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{n(e),A()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-gray-50`,children:[(0,S.jsx)(g,{className:i(`h-4 w-4`,e===t.trim()?`text-primary`:`text-transparent`)}),(0,S.jsx)(`span`,{className:`truncate text-gray-700`,children:e})]},e)),O.length===0&&t.trim().length===0&&(0,S.jsx)(`div`,{className:`px-3 py-2 text-sm text-gray-500`,children:p})]})})]})}var E=`provider/model`;function D(e){let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function O({id:e,value:t,onChange:n,providerCatalog:i,disabled:o=!1,providerPlaceholder:s,modelPlaceholder:c,className:l}){let[u,g]=(0,x.useState)(``),[b,C]=(0,x.useState)(``),w=i.length>0,O=c??E,k=(0,x.useMemo)(()=>new Map(i.map(e=>[e.name,e])),[i]),A=k.get(u),j=(0,x.useMemo)(()=>A?.aliases??[],[A]),M=(0,x.useMemo)(()=>D(A?.models??[]),[A]);return(0,x.useEffect)(()=>{let e=t.trim();if(!w){g(``),C(e);return}if(!e){C(``),g(e=>k.has(e)?e:``);return}let n=_(e,i)??``,r=k.get(n)?.aliases??[];g(n),C(n?v(e,r):e)},[w,i,k,t]),w?(0,S.jsxs)(`div`,{className:l,children:[(0,S.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,S.jsx)(`div`,{className:`sm:w-[38%] sm:min-w-[170px]`,children:(0,S.jsxs)(h,{value:u,onValueChange:e=>{let t=D(k.get(e)?.models??[])[0]??``;if(g(e),C(t),!t){n(``);return}n(y(k.get(e)?.prefix??e,t))},disabled:o,children:[(0,S.jsx)(f,{className:`h-10 w-full rounded-xl`,children:(0,S.jsx)(d,{placeholder:s??r(`providersSelectPlaceholder`)})}),(0,S.jsx)(p,{children:i.map(e=>(0,S.jsx)(m,{value:e.name,children:e.displayName},e.name))})]})}),(0,S.jsx)(`span`,{className:`hidden h-10 items-center justify-center leading-none text-lg font-semibold text-gray-300 sm:inline-flex`,children:`/`}),(0,S.jsx)(T,{id:e,value:b,onChange:e=>{if(!A){let t=e.trim();C(t),n(t);return}let t=v(e,j);C(t),n(t?y(A.prefix,t):``)},options:M,disabled:o||!u,placeholder:O,className:`sm:flex-1`,inputClassName:`h-10 rounded-xl`,emptyText:r(`modelPickerNoOptions`),createText:r(`modelPickerUseCustom`),toggleLabel:r(`modelPickerToggleOptions`)},u)]}),(0,S.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:r(`modelInputCustomHint`)})]}):(0,S.jsxs)(`div`,{className:l,children:[(0,S.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 px-4 py-3`,children:[(0,S.jsx)(`p`,{className:`text-sm font-semibold text-amber-950`,children:r(`providersEmptyTitle`)}),(0,S.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-amber-900`,children:r(`providersEmptyDescription`)})]}),(0,S.jsx)(a,{id:e,value:t,disabled:o,onChange:e=>n(e.target.value),placeholder:O,className:`mt-3 h-10 rounded-xl`}),(0,S.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:r(`modelInputCustomHint`)})]})}export{O as t};
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{h as t,p as n,r,u as i}from"./react-DsgudwpT.js";import{$t as a}from"./api-Dyb5rgh0.js";import{c as o}from"./dist-CrtbGLlh.js";import{a as s,n as c,r as l,t as u}from"./popover-CX9zFsuc.js";import{a as d,i as f,n as p,r as m,t as h,w as g}from"./select-MJKhKAWR.js";import{i as _,l as v,r as y}from"./provider-models-BoUhFo9R.js";var b=o(`ChevronsUpDown`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),x=e(t(),1),S=n(),C=s(`15rem`);function w(e){let t=new Set;for(let n of e){let e=n.trim();e.length>0&&t.add(e)}return[...t]}function T({id:e,value:t,onChange:n,options:r,disabled:o=!1,placeholder:s,className:d,inputClassName:f,emptyText:p,createText:m,toggleLabel:h,maxItems:_=1/0,onEnter:v}){let[y,T]=(0,x.useState)(!1);(0,x.useEffect)(()=>{o&&y&&T(!1)},[o,y]);let E=(0,x.useMemo)(()=>w(r),[r]),D=t.trim().toLowerCase(),O=(0,x.useMemo)(()=>{let e=E.map((e,t)=>({option:e,index:t}));D.length>0&&e.sort((e,t)=>{let n=e.option.toLowerCase(),r=t.option.toLowerCase(),i=n===D?0:n.startsWith(D)?1:n.includes(D)?2:3,a=r===D?0:r.startsWith(D)?1:r.includes(D)?2:3;return i===a?e.index-t.index:i-a});let t=e.map(e=>e.option);return Number.isFinite(_)?t.slice(0,Math.max(1,_)):t},[E,D,_]),k=t.trim().length>0&&E.some(e=>e===t.trim()),A=()=>T(!1);return(0,S.jsxs)(u,{open:y&&!o,onOpenChange:e=>T(!o&&e),children:[(0,S.jsx)(c,{asChild:!0,children:(0,S.jsxs)(`div`,{className:i(`relative`,d),children:[(0,S.jsx)(a,{id:e,value:t,disabled:o,onFocus:()=>{o||T(!0)},onChange:e=>{n(e.target.value),!y&&!o&&T(!0)},onKeyDown:e=>{e.key===`Enter`&&(v&&(e.preventDefault(),v()),A())},placeholder:s,className:i(`pr-10`,f)}),(0,S.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>T(e=>!e),disabled:o,className:i(`absolute inset-y-0 right-0 inline-flex w-10 items-center justify-center`,o?`cursor-not-allowed text-gray-300`:`text-gray-400 hover:text-gray-600`),"aria-label":h,children:(0,S.jsx)(b,{className:`h-4 w-4`})})]})}),(0,S.jsx)(l,{align:`start`,className:`flex w-[var(--radix-popover-trigger-width)] min-w-[12rem] flex-col overflow-hidden rounded-xl border border-gray-200 p-0 shadow-lg`,onOpenAutoFocus:e=>e.preventDefault(),style:{maxHeight:C},children:(0,S.jsxs)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto py-1`,children:[!k&&t.trim().length>0&&(0,S.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{n(t.trim()),A()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-gray-50`,children:[(0,S.jsx)(g,{className:`h-4 w-4 text-transparent`}),(0,S.jsx)(`span`,{className:`truncate text-gray-700`,children:m.replace(`{value}`,t.trim())})]}),O.map(e=>(0,S.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{n(e),A()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-gray-50`,children:[(0,S.jsx)(g,{className:i(`h-4 w-4`,e===t.trim()?`text-primary`:`text-transparent`)}),(0,S.jsx)(`span`,{className:`truncate text-gray-700`,children:e})]},e)),O.length===0&&t.trim().length===0&&(0,S.jsx)(`div`,{className:`px-3 py-2 text-sm text-gray-500`,children:p})]})})]})}var E=`provider/model`;function D(e){let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function O({id:e,value:t,onChange:n,providerCatalog:i,disabled:o=!1,providerPlaceholder:s,modelPlaceholder:c,className:l}){let[u,g]=(0,x.useState)(``),[b,C]=(0,x.useState)(``),w=i.length>0,O=c??E,k=(0,x.useMemo)(()=>new Map(i.map(e=>[e.name,e])),[i]),A=k.get(u),j=(0,x.useMemo)(()=>A?.aliases??[],[A]),M=(0,x.useMemo)(()=>D(A?.models??[]),[A]);return(0,x.useEffect)(()=>{let e=t.trim();if(!w){g(``),C(e);return}if(!e){C(``),g(e=>k.has(e)?e:``);return}let n=_(e,i)??``,r=k.get(n)?.aliases??[];g(n),C(n?v(e,r):e)},[w,i,k,t]),w?(0,S.jsxs)(`div`,{className:l,children:[(0,S.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,S.jsx)(`div`,{className:`sm:w-[38%] sm:min-w-[170px]`,children:(0,S.jsxs)(h,{value:u,onValueChange:e=>{let t=D(k.get(e)?.models??[])[0]??``;if(g(e),C(t),!t){n(``);return}n(y(k.get(e)?.prefix??e,t))},disabled:o,children:[(0,S.jsx)(f,{className:`h-10 w-full rounded-xl`,children:(0,S.jsx)(d,{placeholder:s??r(`providersSelectPlaceholder`)})}),(0,S.jsx)(p,{children:i.map(e=>(0,S.jsx)(m,{value:e.name,children:e.displayName},e.name))})]})}),(0,S.jsx)(`span`,{className:`hidden h-10 items-center justify-center leading-none text-lg font-semibold text-gray-300 sm:inline-flex`,children:`/`}),(0,S.jsx)(T,{id:e,value:b,onChange:e=>{if(!A){let t=e.trim();C(t),n(t);return}let t=v(e,j);C(t),n(t?y(A.prefix,t):``)},options:M,disabled:o||!u,placeholder:O,className:`sm:flex-1`,inputClassName:`h-10 rounded-xl`,emptyText:r(`modelPickerNoOptions`),createText:r(`modelPickerUseCustom`),toggleLabel:r(`modelPickerToggleOptions`)},u)]}),(0,S.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:r(`modelInputCustomHint`)})]}):(0,S.jsxs)(`div`,{className:l,children:[(0,S.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 px-4 py-3`,children:[(0,S.jsx)(`p`,{className:`text-sm font-semibold text-amber-950`,children:r(`providersEmptyTitle`)}),(0,S.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-amber-900`,children:r(`providersEmptyDescription`)})]}),(0,S.jsx)(a,{id:e,value:t,disabled:o,onChange:e=>n(e.target.value),placeholder:O,className:`mt-3 h-10 rounded-xl`}),(0,S.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:r(`modelInputCustomHint`)})]})}export{O as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./chunk-DseTPa7n.js";import{a as t,h as n,p as r,r as i,u as a}from"./react-DsgudwpT.js";import{$t as o,Qt as s,St as c,Xt as l,Zt as u,_n as d,en as f,in as p}from"./api-Dyb5rgh0.js";import{c as m}from"./dist-CrtbGLlh.js";import{i as h,r as g,t as _}from"./popover-CX9zFsuc.js";import{t as v}from"./confirm-dialog-bAp8NU93.js";import{t as y}from"./search-_kEi29qo.js";import{C as b,a as x,i as S,n as C,r as w,t as T}from"./select-MJKhKAWR.js";import{n as E,t as D}from"./settings-2-D_y7zXJz.js";import{t as O}from"./eye-K5knauEM.js";import{i as ee,t as te}from"./use-viewport-layout-CqgIMDQL.js";import{t as k}from"./plus-TmFdwO3P.js";import{t as A}from"./trash-2-BRpSE-Wt.js";import{t as j}from"./x-DdEDL6ju.js";import{n as M,t as N}from"./logo-badge-BQ-XFZod.js";import{t as P}from"./host-capabilities-CFbAfrrA.js";import{a as F,o as I,s as L,t as R}from"./provider-models-BoUhFo9R.js";import{t as z}from"./form-actions-CKprWFeM.js";import{a as B,c as V,d as H,f as ne,h as U,i as W,l as re,r as ie,s as ae,u as oe}from"./use-config-CwDEAl6f.js";import{t as G}from"./config-hints-LxG80Uj5.js";import{a as K,c as q,i as se,n as ce,o as J,r as le,s as ue}from"./config-split-page-CqlqjnCK.js";var de=m(`CircleDotDashed`,[[`path`,{d:`M10.1 2.18a9.93 9.93 0 0 1 3.8 0`,key:`1qdqn0`}],[`path`,{d:`M17.6 3.71a9.95 9.95 0 0 1 2.69 2.7`,key:`1bq7p6`}],[`path`,{d:`M21.82 10.1a9.93 9.93 0 0 1 0 3.8`,key:`1rlaqf`}],[`path`,{d:`M20.29 17.6a9.95 9.95 0 0 1-2.7 2.69`,key:`1xk03u`}],[`path`,{d:`M13.9 21.82a9.94 9.94 0 0 1-3.8 0`,key:`l7re25`}],[`path`,{d:`M6.4 20.29a9.95 9.95 0 0 1-2.69-2.7`,key:`1v18p6`}],[`path`,{d:`M2.18 13.9a9.93 9.93 0 0 1 0-3.8`,key:`xdo6bj`}],[`path`,{d:`M3.71 6.4a9.95 9.95 0 0 1 2.7-2.69`,key:`1jjmaz`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),fe=m(`EyeOff`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Y=e(n(),1),X=r();function pe({isSet:e,className:t,value:n,onChange:r,placeholder:i,...s}){let[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(!1),p=typeof n==`string`&&n.length>0;return(0,X.jsxs)(`div`,{className:`relative`,children:[e&&!p&&!u?(0,X.jsx)(`div`,{onClick:()=>d(!0),className:a(`flex h-9 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2 text-sm text-gray-500 cursor-text items-center pr-12`,t),children:`••••••••••••`}):(0,X.jsx)(o,{type:c?`text`:`password`,className:a(`pr-12`,t),value:n,onChange:r,onBlur:()=>{p||d(!1)},placeholder:i,autoFocus:u,...s}),(0,X.jsx)(`div`,{className:`absolute right-2 top-1/2 -translate-y-1/2 flex gap-1`,children:(e||p)&&(0,X.jsx)(f,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>l(!c),children:c?(0,X.jsx)(fe,{className:`h-4 w-4`}):(0,X.jsx)(O,{className:`h-4 w-4`})})})]})}function me({value:e,onChange:t,className:n}){let r=e?Object.entries(e):[],s=(e,n,i)=>{let a=[...r];a[e]=[n,i],t(Object.fromEntries(a))},c=()=>{t({...e,"":``})},l=e=>{let n=r.filter((t,n)=>n!==e);t(Object.fromEntries(n))};return(0,X.jsxs)(`div`,{className:a(`space-y-2`,n),children:[r.map(([e,t],n)=>(0,X.jsxs)(`div`,{className:`flex gap-2`,children:[(0,X.jsx)(o,{type:`text`,value:e,onChange:e=>s(n,e.target.value,t),placeholder:i(`headerName`),className:`flex-1`}),(0,X.jsx)(o,{type:`text`,value:t,onChange:t=>s(n,e,t.target.value),placeholder:i(`headerValue`),className:`flex-1`}),(0,X.jsx)(f,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>l(n),children:(0,X.jsx)(A,{className:`h-4 w-4 text-red-500`})})]},n)),(0,X.jsxs)(f,{type:`button`,variant:`outline`,size:`sm`,onClick:c,children:[(0,X.jsx)(k,{className:`h-4 w-4 mr-2`}),i(`add`)]})]})}function he(e){let{value:t,onChange:n,options:r}=e;return(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.map(e=>{let r=e.value===t;return(0,X.jsx)(`button`,{type:`button`,onClick:()=>n(e.value),"aria-pressed":r,className:`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors ${r?`border-foreground/15 bg-foreground text-background`:`border-border/55 bg-muted/50 text-muted-foreground hover:border-border hover:bg-muted hover:text-foreground`}`,children:e.label},e.value)})})}function ge(e){let{showAdvanced:t,onShowAdvancedChange:n,supportsWireApi:r,wireApiLabel:a,wireApi:o,onWireApiChange:c,shouldUseWireApiPills:l,wireApiSelectOptions:u,extraHeadersLabel:d,extraHeaders:f,onExtraHeadersChange:p}=e;return(0,X.jsxs)(`div`,{className:`border-t border-border/70 pt-4`,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>n(!t),className:`flex w-full items-center justify-between text-sm text-muted-foreground transition-colors hover:text-foreground`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(D,{className:`h-3.5 w-3.5`}),i(`providerAdvancedSettings`)]}),(0,X.jsx)(b,{className:`h-4 w-4 transition-transform ${t?`rotate-180`:``}`})]}),t?(0,X.jsxs)(`div`,{className:`mt-4 space-y-5`,children:[r?(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(s,{htmlFor:`wireApi`,className:`text-sm font-medium text-foreground`,children:a}),l?(0,X.jsx)(he,{value:o,onChange:e=>c(e),options:u}):(0,X.jsxs)(T,{value:o,onValueChange:e=>c(e),children:[(0,X.jsx)(S,{className:`rounded-xl`,children:(0,X.jsx)(x,{})}),(0,X.jsx)(C,{children:u.map(e=>(0,X.jsx)(w,{value:e.value,children:e.label},e.value))})]})]}):null,(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(s,{className:`text-sm font-medium text-foreground`,children:d}),(0,X.jsx)(me,{value:f,onChange:p}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`providerExtraHeadersHelpShort`)})]})]}):null]})}function _e(e){let{providerAuth:t,providerAuthNote:n,providerAuthMethodOptions:r,providerAuthMethodsCount:a,selectedAuthMethodHint:o,shouldUseAuthMethodPills:c,resolvedAuthMethodId:l,onAuthMethodChange:u,onStartProviderAuth:d,onImportProviderAuthFromCli:p,startPending:m,importPending:h,authSessionId:g,authStatusMessage:_}=e;return t?.kind===`device_code`?(0,X.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-border/60 bg-muted/35 p-3`,children:[(0,X.jsx)(s,{className:`text-sm font-medium text-foreground`,children:t.displayName||i(`providerAuthSectionTitle`)}),n?(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n}):null,a>1?(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(s,{className:`text-xs font-medium text-foreground`,children:i(`providerAuthMethodLabel`)}),c?(0,X.jsx)(he,{value:l,onChange:u,options:r}):(0,X.jsxs)(T,{value:l,onValueChange:u,children:[(0,X.jsx)(S,{className:`h-8 rounded-lg`,children:(0,X.jsx)(x,{placeholder:i(`providerAuthMethodPlaceholder`)})}),(0,X.jsx)(C,{children:r.map(e=>(0,X.jsx)(w,{value:e.value,children:e.label},e.value))})]}),o?(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o}):null]}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(f,{type:`button`,variant:`outline`,size:`sm`,onClick:d,disabled:m||!!g,children:i(m?`providerAuthStarting`:g?`providerAuthAuthorizing`:`providerAuthAuthorizeInBrowser`)}),t.supportsCliImport?(0,X.jsx)(f,{type:`button`,variant:`outline`,size:`sm`,onClick:p,disabled:h,children:i(h?`providerAuthImporting`:`providerAuthImportFromCli`)}):null,g?(0,X.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[i(`providerAuthSessionLabel`),`: `,g.slice(0,8),`…`]}):null]}),_?(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:_}):null]}):null}var ve={providerId:``,providerType:null,isBuiltInType:!1,isCustom:!0,enabled:!0,displayName:``,apiKeySet:!1,apiKeyMasked:void 0,apiBase:null,extraHeaders:null,wireApi:null,models:[],modelConfig:{}};function Z(e){if(!e)return null;let t=Object.entries(e).map(([e,t])=>[e.trim(),t]).filter(([e])=>e.length>0);return t.length===0?null:Object.fromEntries(t)}function ye(e,t){let n=Z(e),r=Z(t);if(n===null&&r===null)return!0;if(!n||!r)return!1;let i=Object.entries(n).sort(([e],[t])=>e.localeCompare(t)),a=Object.entries(r).sort(([e],[t])=>e.localeCompare(t));return i.length===a.length?i.every(([e,t],n)=>e===a[n][0]&&t===a[n][1]):!1}function Q(e){if(!e||e.length===0)return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function be(e,t){let n=e.trim();if(!n||!t.trim())return n;let r=`${t.trim()}/`;return n.startsWith(r)?n.slice(r.length):n}function $(e,t){let n=e.trim();if(!n)return``;for(let e of t){let t=e.trim();t&&(n=be(n,t))}return n.trim()}function xe(e,t){return e.length===t.length?e.every((e,n)=>e===t[n]):!1}function Se(e,t){return Q(t)}function Ce(e,t){return Q(e).map(e=>{let n=e.trim();return!n||n.startsWith(`${t}/`)?n:`${t}/${n}`})}function we(e,t){let n=new Set(t.map(e=>e.trim()).filter(Boolean)),r={};for(let[t,i]of Object.entries(e)){if(!n.has(t))continue;let e={},a=I(i.thinking?.supported);if(a.length>0){let t=L(i.thinking?.default);e.thinking=t&&a.includes(t)?{supported:a,default:t}:{supported:a}}i.vision===!0&&(e.vision=!0),(e.thinking||e.vision===!0)&&(r[t]=e)}return r}function Te(e,t,n){return{...F(e,n),...F(t,n)}}function Ee(e,t){let n=Object.keys(e).sort(),r=Object.keys(t).sort();if(n.length!==r.length)return!1;for(let i=0;i<n.length;i+=1){let a=n[i];if(a!==r[i])return!1;let o=e[a],s=t[a];if(!o||!s||!xe([...o.thinking?.supported??[]].sort(),[...s.thinking?.supported??[]].sort())||(o.thinking?.default??null)!==(s.thinking?.default??null)||(o.vision??!1)!==(s.vision??!1))return!1}return!0}function De(e){return e.providerName?e.apiKey.trim().length>0||e.apiBase.trim()!==e.currentApiBase.trim()||!ye(e.extraHeaders,e.currentHeaders)||e.supportsWireApi&&e.wireApi!==e.currentWireApi||!xe(e.models,e.currentEditableModels)||!Ee(e.modelConfig,e.currentModelConfig)||e.providerDisplayName.trim()!==e.effectiveDisplayName:!1}function Oe(e){let t={},n=e.apiKey.trim(),r=e.apiBase.trim(),i=Z(e.extraHeaders),a=e.providerDisplayName.trim();return a!==e.effectiveDisplayName&&(t.displayName=a.length>0?a:null),n.length>0&&(t.apiKey=n),r!==e.currentApiBase.trim()&&(t.apiBase=r.length>0&&r!==e.defaultApiBase?r:null),ye(i,e.currentHeaders)||(t.extraHeaders=i),e.supportsWireApi&&e.wireApi!==e.currentWireApi&&(t.wireApi=e.wireApi),xe(e.models,e.currentEditableModels)||(t.models=Ce(e.models,e.providerName??``)),Ee(e.modelConfig,e.currentModelConfig)||(t.modelConfig=we(e.modelConfig,e.models)),t}function ke(e){let t=$(e.models.find(e=>e.trim().length>0)??``,e.providerModelAliases),n={apiBase:e.apiBase.trim(),extraHeaders:Z(e.extraHeaders),model:t||null};return e.apiKey.trim().length>0&&(n.apiKey=e.apiKey.trim()),e.supportsWireApi&&(n.wireApi=e.wireApi),n}function Ae(e){return i(e===`off`?`chatThinkingLevelOff`:e===`minimal`?`chatThinkingLevelMinimal`:e===`low`?`chatThinkingLevelLow`:e===`medium`?`chatThinkingLevelMedium`:e===`high`?`chatThinkingLevelHigh`:e===`adaptive`?`chatThinkingLevelAdaptive`:`chatThinkingLevelXhigh`)}function je(e){let{providerName:t,methods:n,defaultMethodId:r,language:i}=e;if(n.length===0)return``;let a=new Map;for(let e of n){let t=e.id.trim();t&&a.set(t.toLowerCase(),t)}let o=(...e)=>{for(let t of e){let e=a.get(t.toLowerCase());if(e)return e}},s=r?.trim();if(t===`minimax-portal`){if(i===`zh`)return o(`cn`,`china-mainland`)??o(s??``)??n[0]?.id??``;if(i===`en`)return o(`global`,`intl`,`international`)??o(s??``)??n[0]?.id??``}if(s){let e=o(s);if(e)return e}return i===`zh`?o(`cn`)??n[0]?.id??``:i===`en`?o(`global`)??n[0]?.id??``:n[0]?.id??``}function Me(e){let{required:t,hasDefault:n,optionCount:r}=e;return t&&n&&r>1&&r<=3}function Ne(e,t,n){let r=$(t,n);return r?e.includes(r)?{models:e,draft:``}:{models:[...e,r],draft:``}:{models:e,draft:t}}function Pe(e,t,n){let r={...t};return delete r[n],{models:e.filter(e=>e!==n),modelConfig:r}}function Fe(e,t,n){let r=e[t],i=r?.thinking?.supported??[],a=i.includes(n)?i.filter(e=>e!==n):R.filter(e=>e===n||i.includes(e)),o=r?.thinking?.default&&a.includes(r.thinking.default)?r.thinking.default:void 0,s={...r,thinking:a.length>0?o?{supported:a,default:o}:{supported:a}:void 0},c={...e};return s.thinking||s.vision===!0?c[t]=s:delete c[t],c}function Ie(e,t,n){let r=e[t],i=r?.thinking;return!i||i.supported.length===0||n&&!i.supported.includes(n)?e:{...e,[t]:{...r,thinking:n?{supported:i.supported,default:n}:{supported:i.supported}}}}function Le(e,t,n){let r={...e[t],vision:n?!0:void 0},i={...e};return r.thinking||r.vision===!0?i[t]=r:delete i[t],i}function Re(e){let{providerName:t,providerSpec:n,language:r}=e,i=n?.auth,a=i?.methods??[];return{providerAuth:i,providerAuthMethodOptions:a.map(e=>({value:e.id,label:e.label?.[r]||e.label?.en||e.id})),providerAuthMethods:a,preferredAuthMethodId:je({providerName:n?.providerType??t,methods:a,defaultMethodId:i?.defaultMethodId,language:r}),shouldUseAuthMethodPills:Me({required:i?.kind===`device_code`,hasDefault:!!i?.defaultMethodId?.trim(),optionCount:a.length})}}function ze(e,t){let n=!!e?.supportsWireApi||t,r=(e?.wireApiOptions||[`auto`,`chat`,`responses`]).map(e=>({value:e,label:i(e===`chat`?`wireApiChat`:e===`responses`?`wireApiResponses`:`wireApiAuto`)}));return{shouldUseWireApiPills:Me({required:n,hasDefault:typeof e?.defaultWireApi==`string`&&e.defaultWireApi.length>0,optionCount:r.length}),supportsWireApi:n,wireApiSelectOptions:r}}function Be(e){let{providerName:t,providersView:n,templatesView:r,schema:a,language:o}=e,s=t?n?.providers[t]:null,c=r?.providerTemplates.find(e=>e.providerType===s?.providerType),l=s??ve,u=a?.uiHints,d=!!s?.isCustom,f=t?G(`providers.${t}.apiKey`,u):void 0,p=t?G(`providers.${t}.apiBase`,u):void 0,m=t?G(`providers.${t}.extraHeaders`,u):void 0,h=t?G(`providers.${t}.wireApi`,u):void 0,g=c?.displayName||s?.displayName||t||``,_=(l.displayName||``).trim()||g,v=l.enabled!==!1,y=Q([c?.modelPrefix||c?.providerType||``,t||``]),b=c?.defaultApiBase||``,x=l.apiBase||b,S=Z(l.extraHeaders||null),C=l.wireApi||c?.defaultWireApi||`auto`,w=Se(Q((c?.defaultModels??[]).map(e=>$(e,y))),Q((l.models??[]).map(e=>$(e,y)))),T=we(Te(c?.modelConfig,l.modelConfig,y),w),E=c?.apiBaseHelp?.[o]||c?.apiBaseHelp?.en||p?.help||i(`providerApiBaseHelp`),D=Re({providerName:t,providerSpec:c,language:o}),O=ze(c,d);return{apiBaseHelpText:E,apiBaseHint:p,apiKeyHint:f,currentApiBase:x,currentEditableModels:w,currentEnabled:v,currentHeaders:S,currentModelConfig:T,currentWireApi:C,defaultApiBase:b,defaultDisplayName:g,effectiveDisplayName:_,extraHeadersHint:m,...D,providerConfig:s,providerModelAliases:y,resolvedProviderConfig:l,wireApiHint:h,...O}}function Ve(e){let{models:t,modelConfig:n,modelDraft:r,showModelInput:a,onModelDraftChange:l,onShowModelInputChange:u,onAddModel:d,onRemoveModel:p,onToggleModelThinkingLevel:m,onSetModelThinkingDefault:v,onSetModelVision:y,thinkingLevels:b,formatThinkingLevelLabel:E}=e;return(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsx)(s,{className:`text-sm font-medium text-foreground`,children:i(`providerModelsTitle`)}),a?null:(0,X.jsxs)(`button`,{type:`button`,onClick:()=>u(!0),className:`flex items-center gap-1 text-xs font-medium text-primary hover:text-primary/80`,children:[(0,X.jsx)(k,{className:`h-3 w-3`}),i(`providerAddModel`)]})]}),a?(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(o,{value:r,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d()),e.key===`Escape`&&(u(!1),l(``))},placeholder:i(`providerModelInputPlaceholder`),className:`flex-1 rounded-xl`,autoFocus:!0}),(0,X.jsx)(f,{type:`button`,size:`sm`,onClick:d,disabled:r.trim().length===0,children:i(`add`)}),(0,X.jsx)(f,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{u(!1),l(``)},children:(0,X.jsx)(j,{className:`h-4 w-4`})})]}):null,t.length===0?(0,X.jsxs)(`div`,{className:`rounded-xl border border-dashed border-border/65 bg-muted/30 px-4 py-6 text-center`,children:[(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i(`providerModelsEmptyShort`)}),a?null:(0,X.jsx)(`button`,{type:`button`,onClick:()=>u(!0),className:`mt-2 text-sm font-medium text-primary hover:text-primary/80`,children:i(`providerAddFirstModel`)})]}):(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.map(e=>{let t=n[e],r=t?.thinking,a=r?.supported??[],o=r?.default??null,l=t?.vision===!0;return(0,X.jsxs)(`div`,{className:`group inline-flex max-w-full items-center gap-1 rounded-full border border-border/55 bg-muted/45 px-3 py-1.5`,children:[(0,X.jsx)(`span`,{className:`max-w-[140px] truncate text-sm text-foreground sm:max-w-[220px]`,children:e}),(0,X.jsxs)(_,{children:[(0,X.jsx)(h,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,className:`inline-flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground/70 opacity-100 transition-opacity hover:bg-muted hover:text-foreground md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,"aria-label":i(`providerModelThinkingTitle`),title:i(`providerModelThinkingTitle`),children:(0,X.jsx)(D,{className:`h-3 w-3`})})}),(0,X.jsxs)(g,{className:`w-80 space-y-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg bg-muted/50 px-3 py-2`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`p`,{className:`text-xs font-semibold text-foreground`,children:i(`providerModelVisionTitle`)}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`providerModelVisionHint`)})]}),(0,X.jsx)(c,{checked:l,onCheckedChange:t=>y(e,t)})]}),(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`p`,{className:`text-xs font-semibold text-foreground`,children:i(`providerModelThinkingTitle`)}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`providerModelThinkingHint`)})]}),(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:b.map(t=>(0,X.jsx)(`button`,{type:`button`,onClick:()=>m(e,t),className:`rounded-full border px-2.5 py-1 text-xs font-medium transition-colors ${a.includes(t)?`border-foreground/15 bg-foreground text-background`:`border-border/55 bg-muted/50 text-muted-foreground hover:border-border hover:bg-muted hover:text-foreground`}`,children:E(t)},t))}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(s,{className:`text-xs font-medium text-foreground`,children:i(`providerModelThinkingDefault`)}),(0,X.jsxs)(T,{value:o??`__none__`,onValueChange:t=>v(e,t===`__none__`?null:t),disabled:a.length===0,children:[(0,X.jsx)(S,{className:`h-8 rounded-lg text-xs`,children:(0,X.jsx)(x,{})}),(0,X.jsxs)(C,{children:[(0,X.jsx)(w,{value:`__none__`,children:i(`providerModelThinkingDefaultNone`)}),a.map(e=>(0,X.jsx)(w,{value:e,children:E(e)},e))]})]}),a.length===0?(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`providerModelThinkingNoSupported`)}):null]})]})]}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>p(e),className:`inline-flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground/70 opacity-100 transition-opacity hover:bg-muted hover:text-foreground md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,"aria-label":i(`remove`),children:(0,X.jsx)(j,{className:`h-3 w-3`})})]},e)})})]})}function He({apiKeySet:e,className:t,enabled:n}){return n?(0,X.jsx)(M,{status:e?`ready`:`setup`,label:i(e?`statusReady`:`statusSetup`),className:t}):(0,X.jsx)(M,{status:`inactive`,label:i(`disabled`),className:t})}function Ue(e){let{providerName:t,providerAuth:n,resolvedAuthMethodId:r}=e,a=d(),o=H(),s=V(),c=ae(),[l,u]=(0,Y.useState)(``),[f,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(``),_=(0,Y.useRef)(null),v=(0,Y.useCallback)(()=>{_.current!==null&&(window.clearTimeout(_.current),_.current=null)},[]),y=(0,Y.useCallback)((e,n)=>{v(),_.current=window.setTimeout(()=>{(async()=>{if(t)try{let r=await s.mutateAsync({provider:t,data:{sessionId:e}});if(r.status===`pending`){g(i(`providerAuthWaitingBrowser`)),y(e,r.nextPollMs??n);return}if(r.status===`authorized`){m(null),v(),g(i(`providerAuthCompleted`)),p.success(i(`providerAuthCompleted`)),a.invalidateQueries({queryKey:[`config`]}),a.invalidateQueries({queryKey:[`providers`]});return}m(null),v(),g(r.message||`Authorization ${r.status}.`),p.error(r.message||`Authorization ${r.status}.`)}catch(e){m(null),v();let t=e instanceof Error?e.message:String(e);g(t),p.error(`Authorization failed: ${t}`)}})()},Math.max(1e3,n))},[v,s,t,a]),b=(0,Y.useCallback)(async()=>{if(!(!t||n?.kind!==`device_code`))try{u(t),g(``);let e=await o.mutateAsync({provider:t,data:r?{methodId:r}:{}});if(!e.sessionId||!e.verificationUri)throw Error(i(`providerAuthStartFailed`));m(e.sessionId),g(`${i(`providerAuthOpenPrompt`)}${e.userCode}${i(`providerAuthOpenPromptSuffix`)}`),await P.openExternalUrl(e.verificationUri),y(e.sessionId,e.intervalMs)}catch(e){let t=e instanceof Error?e.message:String(e);m(null),v(),g(t),p.error(`${i(`providerAuthStartFailed`)}: ${t}`)}},[v,n?.kind,t,r,y,o]),x=(0,Y.useCallback)(async()=>{if(!(!t||n?.kind!==`device_code`))try{u(t),v(),m(null);let e=await c.mutateAsync({provider:t});g(`${i(`providerAuthImportStatusPrefix`)}${e.expiresAt?` (expires: ${e.expiresAt})`:``}`),p.success(i(`providerAuthImportSuccess`)),a.invalidateQueries({queryKey:[`config`]}),a.invalidateQueries({queryKey:[`providers`]})}catch(e){let t=e instanceof Error?e.message:String(e);g(t),p.error(`${i(`providerAuthImportFailed`)}: ${t}`)}},[v,c,n?.kind,t,a]);return(0,Y.useEffect)(()=>{v()},[v,t]),(0,Y.useEffect)(()=>()=>v(),[v]),{authSessionId:l===t?f:null,authStatusMessage:l===t?h:``,importAuthFromCli:x,importPending:c.isPending,startAuth:b,startPending:o.isPending}}function We({providerName:e,onProviderDeleted:n}){let{data:r}=oe(),{data:a}=re(),{data:o}=ie(),s=U(),c=B(),l=ne(),[u,d]=(0,Y.useState)(``),[f,m]=(0,Y.useState)(``),[h,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(`auto`),[y,b]=(0,Y.useState)([]),[x,S]=(0,Y.useState)({}),[C,w]=(0,Y.useState)(``),[T,E]=(0,Y.useState)(``),[D,O]=(0,Y.useState)(!1),[ee,te]=(0,Y.useState)(!1),[k,A]=(0,Y.useState)(``),j=t(),M=(0,Y.useMemo)(()=>Be({providerName:e,providersView:r,templatesView:a,schema:o,language:j}),[j,e,r,o,a]),{currentApiBase:N,currentEditableModels:P,currentHeaders:F,currentModelConfig:I,currentWireApi:L,defaultApiBase:R,effectiveDisplayName:z,providerAuth:V,providerAuthMethods:H,providerConfig:W,providerModelAliases:ae,resolvedProviderConfig:G,preferredAuthMethodId:K,supportsWireApi:q}=M,se=T.trim()||z||e||i(`providersSelectPlaceholder`),J=(0,Y.useMemo)(()=>{if(!H.length)return``;let e=k.trim();return e&&H.some(t=>t.id===e)?e:K||H[0]?.id||``},[k,K,H]),{authSessionId:le,authStatusMessage:ue,importAuthFromCli:de,importPending:fe,startAuth:pe,startPending:me}=Ue({providerName:e,providerAuth:V,resolvedAuthMethodId:J});(0,Y.useEffect)(()=>{if(!e){d(``),m(``),g(null),v(`auto`),b([]),S({}),w(``),E(``),A(``);return}d(``),m(N),g(G.extraHeaders||null),v(L),b(P),S(I),w(``),E(z),A(K)},[e,N,G.extraHeaders,L,P,I,z,K]),(0,Y.useEffect)(()=>S(e=>we(e,y)),[y]);let he=(0,Y.useMemo)(()=>De({providerName:e,apiKey:u,apiBase:f,currentApiBase:N,extraHeaders:h,currentHeaders:F,supportsWireApi:q,wireApi:_,currentWireApi:L,models:y,currentEditableModels:P,modelConfig:x,currentModelConfig:I,providerDisplayName:T,effectiveDisplayName:z}),[e,u,f,N,h,F,q,_,L,y,P,x,I,T,z]);return!e||!W?(0,X.jsx)(ce,{children:(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:i(`providersSelectTitle`)}),(0,X.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:i(`providersSelectDescription`)})]})}):(0,X.jsx)(Ge,{context:M,language:j,providerTitle:se,providerDisplayName:T,apiKey:u,apiBase:f,extraHeaders:h,wireApi:_,models:y,modelConfig:x,modelDraft:C,showAdvanced:D,showModelInput:ee,resolvedAuthMethodId:J,authSessionId:le,authStatusMessage:ue,hasChanges:he,isDeletePending:c.isPending,isUpdatePending:s.isPending,isTestPending:l.isPending,startPending:me,importPending:fe,onProviderDisplayNameChange:E,onApiKeyChange:d,onApiBaseChange:m,onAuthMethodChange:A,onStartProviderAuth:pe,onImportProviderAuthFromCli:de,onModelDraftChange:w,onShowModelInputChange:te,onAddModel:()=>{let e=Ne(y,C,ae);b(e.models),w(e.draft)},onRemoveModel:e=>{let t=Pe(y,x,e);b(t.models),S(t.modelConfig)},onToggleModelThinkingLevel:(e,t)=>{S(n=>Fe(n,e,t))},onSetModelThinkingDefault:(e,t)=>{S(n=>Ie(n,e,t))},onSetModelVision:(e,t)=>{S(n=>Le(n,e,t))},onShowAdvancedChange:O,onWireApiChange:v,onExtraHeadersChange:g,onDeleteProvider:async()=>{if(e&&window.confirm(i(`providerDeleteConfirm`)))try{await c.mutateAsync({provider:e}),n?.(e)}catch{}},onSubmit:t=>{t.preventDefault(),e&&s.mutate({provider:e,data:Oe({providerName:e,apiKey:u,apiBase:f,currentApiBase:N,defaultApiBase:R,extraHeaders:h,currentHeaders:F,supportsWireApi:q,wireApi:_,currentWireApi:L,models:y,currentEditableModels:P,modelConfig:x,currentModelConfig:I,providerDisplayName:T,effectiveDisplayName:z})})},onTestConnection:async()=>{if(e)try{let t=await l.mutateAsync({provider:e,data:ke({apiKey:u,apiBase:f,extraHeaders:h,supportsWireApi:q,wireApi:_,models:y,providerModelAliases:ae})});if(t.success){p.success(`${i(`providerTestConnectionSuccess`)} (${t.latencyMs}ms)`);return}let n=[`provider=${t.provider}`,`latency=${t.latencyMs}ms`];t.model&&n.push(`model=${t.model}`),p.error(`${i(`providerTestConnectionFailed`)}: ${t.message} | ${n.join(` | `)}`)}catch(e){let t=e instanceof Error?e.message:String(e);p.error(`${i(`providerTestConnectionFailed`)}: ${t}`)}}})}function Ge(e){let{context:t,language:n,providerTitle:r,providerDisplayName:a,apiKey:c,apiBase:l,extraHeaders:u,wireApi:d,models:p,modelConfig:m,modelDraft:h,showAdvanced:g,showModelInput:_,resolvedAuthMethodId:v,authSessionId:y,authStatusMessage:b,hasChanges:x,isDeletePending:S,isUpdatePending:C,isTestPending:w,startPending:T,importPending:E,onProviderDisplayNameChange:D,onApiKeyChange:O,onApiBaseChange:ee,onAuthMethodChange:te,onStartProviderAuth:k,onImportProviderAuthFromCli:j,onModelDraftChange:M,onShowModelInputChange:N,onAddModel:P,onRemoveModel:F,onToggleModelThinkingLevel:I,onSetModelThinkingDefault:L,onSetModelVision:B,onShowAdvancedChange:V,onWireApiChange:H,onExtraHeadersChange:ne,onDeleteProvider:U,onSubmit:W,onTestConnection:re}=e,ie=t.providerAuthMethods.find(e=>e.id===v);return(0,X.jsxs)(K,{children:[(0,X.jsx)(q,{className:`px-6 py-4`,children:(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsx)(`h3`,{className:`truncate text-lg font-semibold text-foreground`,children:r}),(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:U,disabled:S,className:`text-muted-foreground/70 transition-colors hover:text-red-500`,title:i(`providerDelete`),children:(0,X.jsx)(A,{className:`h-4 w-4`})}),(0,X.jsx)(He,{enabled:t.currentEnabled,apiKeySet:t.resolvedProviderConfig.apiKeySet})]})]})}),(0,X.jsxs)(`form`,{onSubmit:W,className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsxs)(J,{className:`space-y-5 px-6 py-5`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(s,{htmlFor:`providerDisplayName`,className:`text-sm font-medium text-foreground`,children:i(`providerDisplayName`)}),(0,X.jsx)(o,{id:`providerDisplayName`,type:`text`,value:a,onChange:e=>D(e.target.value),placeholder:t.defaultDisplayName||i(`providerDisplayNamePlaceholder`),className:`rounded-xl`}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`providerDisplayNameHelpShort`)})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(s,{htmlFor:`apiKey`,className:`text-sm font-medium text-foreground`,children:t.apiKeyHint?.label??i(`apiKey`)}),(0,X.jsx)(pe,{id:`apiKey`,value:c,isSet:t.resolvedProviderConfig.apiKeySet,onChange:e=>O(e.target.value),placeholder:t.apiKeyHint?.placeholder??i(`enterApiKey`),className:`rounded-xl`}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:i(`leaveBlankToKeepUnchanged`)})]}),(0,X.jsx)(_e,{providerAuth:t.providerAuth,providerAuthNote:t.providerAuth?.note?.[n]||t.providerAuth?.note?.en||t.providerAuth?.displayName||``,providerAuthMethodOptions:t.providerAuthMethodOptions,providerAuthMethodsCount:t.providerAuthMethods.length,selectedAuthMethodHint:ie?.hint?.[n]||ie?.hint?.en||``,shouldUseAuthMethodPills:t.shouldUseAuthMethodPills,resolvedAuthMethodId:v,onAuthMethodChange:te,onStartProviderAuth:k,onImportProviderAuthFromCli:j,startPending:T,importPending:E,authSessionId:y,authStatusMessage:b}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(s,{htmlFor:`apiBase`,className:`text-sm font-medium text-foreground`,children:t.apiBaseHint?.label??i(`apiBase`)}),(0,X.jsx)(o,{id:`apiBase`,type:`text`,value:l,onChange:e=>ee(e.target.value),placeholder:t.defaultApiBase||t.apiBaseHint?.placeholder||`https://api.example.com`,className:`rounded-xl`}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.apiBaseHelpText})]}),(0,X.jsx)(Ve,{models:p,modelConfig:m,modelDraft:h,showModelInput:_,onModelDraftChange:M,onShowModelInputChange:N,onAddModel:P,onRemoveModel:F,onToggleModelThinkingLevel:I,onSetModelThinkingDefault:L,onSetModelVision:B,thinkingLevels:R,formatThinkingLevelLabel:Ae}),(0,X.jsx)(ge,{showAdvanced:g,onShowAdvancedChange:V,supportsWireApi:t.supportsWireApi,wireApiLabel:t.wireApiHint?.label??i(`wireApi`),wireApi:d,onWireApiChange:H,shouldUseWireApiPills:t.shouldUseWireApiPills,wireApiSelectOptions:t.wireApiSelectOptions,extraHeadersLabel:t.extraHeadersHint?.label??i(`extraHeaders`),extraHeaders:u,onExtraHeadersChange:ne})]}),(0,X.jsx)(ue,{children:(0,X.jsxs)(z,{align:`between`,children:[(0,X.jsxs)(f,{type:`button`,variant:`outline`,size:`sm`,onClick:re,disabled:w,children:[(0,X.jsx)(de,{className:`mr-1.5 h-3.5 w-3.5`}),i(w?`providerTestingConnection`:`providerTestConnection`)]}),(0,X.jsx)(f,{type:`submit`,size:`sm`,disabled:C||!x,children:i(C?`saving`:x?`save`:`unchanged`)})]})})]})]})}function Ke(e){if(!e)return null;try{let t=new URL(e);return`${t.host}${t.pathname&&t.pathname!==`/`?t.pathname:``}`}catch{return e.replace(/^https?:\/\//,``)}}function qe(e,t=[]){let n=new Map(t.map((e,t)=>[e,t]));return e.map((e,t)=>({provider:e,index:t})).sort((e,t)=>{let r=n.get(e.provider.providerId),i=n.get(t.provider.providerId);if(r!==void 0||i!==void 0)return(r??2**53-1)-(i??2**53-1);let a=e.provider.providerType===`nextclaw`?1:0,o=t.provider.providerType===`nextclaw`?1:0;return a===o?e.index-t.index:a-o}).map(({provider:e})=>e)}function Je(e){let t=e.findIndex(e=>e.providerType===`zhipu`),n=e.findIndex(e=>e.providerType===`dashscope-coding-plan`);return e.map((e,t)=>({template:e,index:t})).sort((e,r)=>{let i=({template:e,index:r})=>e.providerType===`nextclaw`?2**53-1:e.providerType===`deepseek`&&n>=0?n-.5:e.providerType===`mimo`&&t>=0?t+.5:r;return i(e)-i(r)}).map(({template:e})=>e)}function Ye(){let{isMobile:e}=te(),{data:t}=oe(),{data:n}=re(),r=W(),s=B(),d=U(),[p,m]=(0,Y.useState)(null),[b,x]=(0,Y.useState)(null),[S,C]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)([]),[D,O]=(0,Y.useState)(``),j=(0,Y.useMemo)(()=>qe(Object.values(t?.providers??{}),w),[t?.providers,w]),P=(0,Y.useMemo)(()=>n?.providerTemplates??[],[n?.providerTemplates]),F=(0,Y.useMemo)(()=>Je(P),[P]),I=(0,Y.useMemo)(()=>new Map(P.map(e=>[e.providerType,e])),[P]),L=(0,Y.useMemo)(()=>{let e=D.trim().toLowerCase();return j.filter(t=>{if(!e)return!0;let n=t.providerType?I.get(t.providerType):null;return(t.displayName?.trim()||n?.displayName||t.providerId).toLowerCase().includes(e)||t.providerId.toLowerCase().includes(e)})},[j,D,I]),R=(0,Y.useMemo)(()=>p&&L.some(e=>e.providerId===p)?p:e?null:L[0]?.providerId??null,[L,e,p]);return!t||!n?(0,X.jsx)(`div`,{className:`p-8`,children:i(`providersLoading`)}):(0,X.jsxs)(u,{className:`pb-0 xl:flex xl:h-full xl:min-h-0 xl:flex-col`,children:[(0,X.jsx)(l,{title:i(`providersPageTitle`),description:i(`providersPageDescription`)}),(0,X.jsxs)(se,{className:`xl:min-h-0`,mobileView:e?R?`detail`:`list`:void 0,onMobileBack:()=>m(null),mobileListLabel:i(`providersPageTitle`),children:[(0,X.jsxs)(K,{children:[(0,X.jsx)(q,{className:`space-y-3 px-4 pb-3 pt-4`,children:(0,X.jsxs)(_,{open:S,onOpenChange:C,children:[(0,X.jsx)(h,{asChild:!0,children:(0,X.jsxs)(f,{type:`button`,variant:`outline`,className:`w-full justify-center`,disabled:r.isPending,children:[(0,X.jsx)(k,{className:`mr-2 h-4 w-4`}),r.isPending?i(`saving`):i(`providerAdd`)]})}),(0,X.jsxs)(g,{className:`w-[42rem] max-w-[calc(100vw-2rem)] p-3`,align:`start`,children:[(0,X.jsx)(`div`,{className:`mb-2 px-1 text-xs font-semibold text-muted-foreground`,children:i(`providerTemplatePickerTitle`)}),(0,X.jsxs)(`div`,{className:`grid max-h-[24rem] grid-cols-2 gap-2 overflow-y-auto sm:grid-cols-3`,children:[(0,X.jsxs)(`button`,{type:`button`,className:`flex min-h-20 w-full flex-col items-start gap-2 rounded-lg border border-dashed border-border/70 bg-muted/20 px-3 py-2 text-left transition-colors hover:border-border hover:bg-muted/45`,onClick:async()=>{try{let e=await r.mutateAsync({data:{providerType:null}});O(``),m(e.providerId),T(t=>[e.providerId,...t.filter(t=>t!==e.providerId)]),C(!1)}catch{}},children:[(0,X.jsx)(N,{name:`custom`,className:`h-8 w-8 rounded-lg border border-border/60 bg-muted/50`}),(0,X.jsx)(`span`,{className:`line-clamp-2 min-w-0 text-xs font-semibold leading-4 text-foreground`,children:i(`providerAddCustom`)})]}),F.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:`flex min-h-20 w-full flex-col items-start gap-2 rounded-lg border border-border/55 bg-muted/15 px-3 py-2 text-left transition-colors hover:border-border/80 hover:bg-muted/40`,onClick:async()=>{try{let t=await r.mutateAsync({data:{providerType:e.providerType}});O(``),m(t.providerId),T(e=>[t.providerId,...e.filter(e=>e!==t.providerId)]),C(!1)}catch{}},children:[(0,X.jsx)(N,{name:e.providerType,src:e.logo?`/logos/${e.logo}`:null,className:`h-8 w-8 rounded-lg border border-border/55 bg-background`,imgClassName:`h-4 w-4 object-contain`}),(0,X.jsx)(`span`,{className:`line-clamp-2 min-w-0 text-xs font-semibold leading-4 text-foreground`,children:e.displayName||e.providerType})]},e.providerType))]})]})]})}),(0,X.jsx)(`div`,{className:`border-b border-border/70 px-4 py-3`,children:(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(y,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/70`}),(0,X.jsx)(o,{value:D,onChange:e=>O(e.target.value),placeholder:i(`providersFilterPlaceholder`),className:`h-10 rounded-xl pl-9`})]})}),(0,X.jsxs)(J,{className:`space-y-2 p-3`,children:[L.map(e=>{let t=e.providerType?I.get(e.providerType):null,n=e.enabled!==!1,r=!!(n&&e.apiKeySet),o=e.displayName?.trim()||t?.displayName||e.providerId,s=Ke(e.apiBase||t?.defaultApiBase||``)||i(`providersDefaultDescription`);return(0,X.jsx)(`div`,{onClick:()=>m(e.providerId),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),m(e.providerId))},role:`button`,tabIndex:0,className:a(`group w-full rounded-xl border p-2.5 text-left transition-colors`,R===e.providerId?`border-border/70 bg-muted/65 text-foreground`:`border-transparent bg-transparent text-muted-foreground hover:border-border/50 hover:bg-muted/40 hover:text-foreground`),children:(0,X.jsxs)(`div`,{className:`relative min-h-10`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 pr-20`,children:[(0,X.jsx)(N,{name:e.providerType??e.providerId,src:t?.logo?`/logos/${t.logo}`:null,className:`h-10 w-10 rounded-lg border border-border/55 bg-muted/40`,imgClassName:`h-5 w-5 object-contain`,fallback:(0,X.jsx)(`span`,{className:`text-sm font-semibold uppercase text-muted-foreground`,children:e.providerId[0]})}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`p`,{className:`truncate text-sm font-semibold text-foreground`,children:o}),(0,X.jsx)(`p`,{className:`truncate font-mono text-[10px] text-muted-foreground/65`,children:e.providerId}),(0,X.jsxs)(`p`,{className:`line-clamp-1 text-[11px] text-muted-foreground`,children:[s,` · `,e.models?.length??0]})]})]}),(0,X.jsxs)(`div`,{className:`absolute right-0 top-0 flex items-center gap-1.5 opacity-70 transition-opacity group-hover:opacity-100`,children:[(0,X.jsx)(`div`,{onClick:e=>e.stopPropagation(),children:(0,X.jsx)(c,{checked:n,disabled:d.isPending,title:i(n?`disabled`:`enabled`),className:`h-[18px] w-8`,thumbClassName:`h-4 w-4 data-[state=checked]:translate-x-4`,onCheckedChange:t=>{d.mutateAsync({provider:e.providerId,data:{enabled:t},silentSuccess:!0})}})}),(0,X.jsxs)(_,{children:[(0,X.jsx)(h,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,className:`inline-flex h-7 w-7 items-center justify-center rounded-lg text-muted-foreground/70 hover:bg-muted hover:text-foreground`,onClick:e=>e.stopPropagation(),title:i(`more`),children:(0,X.jsx)(E,{className:`h-4 w-4`})})}),(0,X.jsx)(g,{className:`w-40 p-1`,align:`end`,onClick:e=>e.stopPropagation(),children:(0,X.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-2 py-2 text-sm text-red-600 hover:bg-red-50`,onClick:()=>x(e.providerId),children:[(0,X.jsx)(A,{className:`h-4 w-4`}),i(`providerDelete`)]})})]})]}),(0,X.jsx)(M,{status:n?r?`ready`:`setup`:`inactive`,label:i(n?r?`statusReady`:`statusSetup`:`disabled`),className:`absolute bottom-0 right-0 justify-end`})]})},e.providerId)}),L.length===0?(0,X.jsx)(le,{icon:ee,title:i(`providersNoMatch`)}):null]})]}),(0,X.jsx)(We,{providerName:R??void 0,onProviderDeleted:e=>{T(t=>t.filter(t=>t!==e)),e===R&&m(null)}})]}),(0,X.jsx)(v,{open:!!b,onOpenChange:e=>{e||x(null)},title:i(`providerDelete`),description:b??void 0,confirmLabel:i(`delete`),variant:`destructive`,onCancel:()=>x(null),onConfirm:()=>{b&&s.mutateAsync({provider:b}).then(()=>{T(e=>e.filter(e=>e!==b)),b===R&&m(null),x(null)})}})]})}export{Ye as ProvidersConfigPage};