nextclaw 0.18.2 → 0.18.4

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 (107) hide show
  1. package/dist/cli/app/index.js +409 -123
  2. package/package.json +15 -15
  3. package/ui-dist/assets/api-DnPN4SyA.js +15 -0
  4. package/ui-dist/assets/app-manager-provider-M7TngYxx.js +1 -0
  5. package/ui-dist/assets/app-navigation.config-B5YIdRju.js +1 -0
  6. package/ui-dist/assets/{book-open-BE8M56IM.js → book-open-B4mOKdz8.js} +1 -1
  7. package/ui-dist/assets/channels-list-page-Cm-Bbu6u.js +8 -0
  8. package/ui-dist/assets/chat-C0ZNZtS3.js +58 -0
  9. package/ui-dist/assets/chat-page-CGHNhXaw.js +1 -0
  10. package/ui-dist/assets/chunk-JZWAC4HX-BJer-fqD.js +3 -0
  11. package/ui-dist/assets/config-split-page-B3PRA_AV.js +1 -0
  12. package/ui-dist/assets/{createLucideIcon-CCiTGX8L.js → createLucideIcon-C_GFKVuW.js} +1 -1
  13. package/ui-dist/assets/desktop-update-config-Dfh-3uma.js +1 -0
  14. package/ui-dist/assets/{dialog-BghZFPch.js → dialog-D-I7ONHQ.js} +1 -1
  15. package/ui-dist/assets/{dist-Dd9cr-kz.js → dist-DreLBS93.js} +1 -1
  16. package/ui-dist/assets/doc-browser-CoKIUCJj.js +1 -0
  17. package/ui-dist/assets/doc-browser-CwgI7ipB.js +1 -0
  18. package/ui-dist/assets/doc-browser-DYKpRqe-.js +1 -0
  19. package/ui-dist/assets/doc-browser-context-Dib9sS83.js +1 -0
  20. package/ui-dist/assets/{es2015-CEAreese.js → es2015-DMSUl3fm.js} +1 -1
  21. package/ui-dist/assets/{external-link-qsnCMhw1.js → external-link-DP2IJ7AM.js} +1 -1
  22. package/ui-dist/assets/folder-BPwc278w.js +1 -0
  23. package/ui-dist/assets/{hash-0zjWsNl-.js → hash-CvcvtMBq.js} +1 -1
  24. package/ui-dist/assets/i18n-BnNAQpVM.js +1 -0
  25. package/ui-dist/assets/index-Bc6c1kIx.js +2 -0
  26. package/ui-dist/assets/index-mRmSAB-e.css +1 -0
  27. package/ui-dist/assets/{key-round-BLe9D8ND.js → key-round-BQXmPSxD.js} +1 -1
  28. package/ui-dist/assets/loader-circle-C6gg2m2a.js +1 -0
  29. package/ui-dist/assets/{LogoBadge-DP8Ye7wJ.js → logo-badge-uB4SwANR.js} +1 -1
  30. package/ui-dist/assets/{logos-_v5b2SdG.js → logos-BcELLmYh.js} +1 -1
  31. package/ui-dist/assets/marketplace-page-BCrS-jH6.js +49 -0
  32. package/ui-dist/assets/marketplace-page-DVrlpB68.js +1 -0
  33. package/ui-dist/assets/mcp-marketplace-page-CjrxT6wI.js +40 -0
  34. package/ui-dist/assets/mcp-marketplace-page-pQ_A38fH.js +1 -0
  35. package/ui-dist/assets/message-square-CLVODA23.js +1 -0
  36. package/ui-dist/assets/model-config-D4myteLK.js +1 -0
  37. package/ui-dist/assets/notice-card-DX_NEZTQ.js +1 -0
  38. package/ui-dist/assets/play-DeNVUA5C.js +1 -0
  39. package/ui-dist/assets/plus-BptLViq1.js +1 -0
  40. package/ui-dist/assets/popover-Dm_NQ3Cs.js +1 -0
  41. package/ui-dist/assets/provider-scoped-model-input-BLHImwI5.js +1 -0
  42. package/ui-dist/assets/providers-list-DsBFslNi.js +1 -0
  43. package/ui-dist/assets/refresh-ccw-CeG203yU.js +1 -0
  44. package/ui-dist/assets/remote-CQQykOYe.js +1 -0
  45. package/ui-dist/assets/rotate-cw-F7aThvYj.js +1 -0
  46. package/ui-dist/assets/runtime-config-page-Bz9r68Rf.js +1 -0
  47. package/ui-dist/assets/{save-D4bObrmH.js → save-7ztImRj7.js} +1 -1
  48. package/ui-dist/assets/search-DZSNKEGp.js +1 -0
  49. package/ui-dist/assets/search-config-C-6KpgRQ.js +1 -0
  50. package/ui-dist/assets/secrets-config-MiMElvpm.js +3 -0
  51. package/ui-dist/assets/{select-BILPf7zs.js → select-RgeHgn_-.js} +1 -1
  52. package/ui-dist/assets/sessions-config-page-0KNW9QC_.js +2 -0
  53. package/ui-dist/assets/{setting-row-BATDgg4r.js → setting-row-vwm4XKv2.js} +1 -1
  54. package/ui-dist/assets/settings-DjvNMJde.js +1 -0
  55. package/ui-dist/assets/skeleton-5Mg6vZHN.js +1 -0
  56. package/ui-dist/assets/sparkles-CyDTgTM4.js +1 -0
  57. package/ui-dist/assets/status-dot-aQU9Mia4.js +1 -0
  58. package/ui-dist/assets/{tabs-custom-Bx3cNhD-.js → tabs-custom-C4P7g4vR.js} +1 -1
  59. package/ui-dist/assets/{tag-chip-zUaDE2-H.js → tag-chip-DGqz3TON.js} +1 -1
  60. package/ui-dist/assets/theme-provider-CUppbOyN.js +1 -0
  61. package/ui-dist/assets/tooltip-DQlSKhZ_.js +1 -0
  62. package/ui-dist/assets/{trash-2-CQUgYyRn.js → trash-2-C1cdqL6V.js} +1 -1
  63. package/ui-dist/assets/use-config-CrsavfWZ.js +1 -0
  64. package/ui-dist/assets/{useConfirmDialog-patAnl1g.js → use-confirm-dialog-D1AnLFlc.js} +1 -1
  65. package/ui-dist/assets/use-infinite-scroll-loader-DZhv-rmv.js +1 -0
  66. package/ui-dist/assets/use-viewport-layout-CytJAPWM.js +1 -0
  67. package/ui-dist/assets/x-BjMO7v8q.js +1 -0
  68. package/ui-dist/index.html +39 -22
  69. package/ui-dist/assets/ChannelsList-SQ7Oxotv.js +0 -8
  70. package/ui-dist/assets/DocBrowser-BCO2k6XD.js +0 -1
  71. package/ui-dist/assets/DocBrowser-rDOjI3ga.js +0 -1
  72. package/ui-dist/assets/DocBrowserContext-BUq3Wo8O.js +0 -1
  73. package/ui-dist/assets/ModelConfig-C77Ae9ru.js +0 -1
  74. package/ui-dist/assets/ProviderScopedModelInput-CEnK61uo.js +0 -1
  75. package/ui-dist/assets/ProvidersList-BCupBayq.js +0 -1
  76. package/ui-dist/assets/RuntimeConfig-Ad-CAcmy.js +0 -1
  77. package/ui-dist/assets/SearchConfig-BfCz4wJ4.js +0 -1
  78. package/ui-dist/assets/SecretsConfig-DjmBIhyy.js +0 -3
  79. package/ui-dist/assets/SessionsConfig-CvjxU40H.js +0 -2
  80. package/ui-dist/assets/chat-page-JKC6ln-y.js +0 -58
  81. package/ui-dist/assets/chat-session-display-YcRMrAMa.js +0 -1
  82. package/ui-dist/assets/chunk-JZWAC4HX-erTUn3b8.js +0 -3
  83. package/ui-dist/assets/client-CszWMVKi.js +0 -7
  84. package/ui-dist/assets/config-split-page-BAGSzUR3.js +0 -1
  85. package/ui-dist/assets/desktop-DfkLlkG2.js +0 -1
  86. package/ui-dist/assets/desktop-update-config-BXeGlqHD.js +0 -1
  87. package/ui-dist/assets/dist-ZwoAXs46.js +0 -9
  88. package/ui-dist/assets/download-D7LOizcW.js +0 -1
  89. package/ui-dist/assets/i18n-DvzXOGQX.js +0 -1
  90. package/ui-dist/assets/index-DvVTC9FF.css +0 -1
  91. package/ui-dist/assets/index-lr6rQUSd.js +0 -2
  92. package/ui-dist/assets/loader-circle-wj7kARHv.js +0 -1
  93. package/ui-dist/assets/marketplace-page-CAAk1Khc.js +0 -1
  94. package/ui-dist/assets/marketplace-page-CfCiq90S.js +0 -49
  95. package/ui-dist/assets/mcp-marketplace-page-D0Pp9Hs-.js +0 -40
  96. package/ui-dist/assets/play-o6NmwGTi.js +0 -1
  97. package/ui-dist/assets/plus-I9pBS4Fl.js +0 -1
  98. package/ui-dist/assets/refresh-cw-MNqgR3LZ.js +0 -1
  99. package/ui-dist/assets/remote-C9fXm4V5.js +0 -1
  100. package/ui-dist/assets/search-DxmL3IWE.js +0 -1
  101. package/ui-dist/assets/security-config-BUm6FFfl.js +0 -1
  102. package/ui-dist/assets/skeleton-COKMAnJy.js +0 -1
  103. package/ui-dist/assets/switch-CBOzecWS.js +0 -1
  104. package/ui-dist/assets/use-infinite-scroll-loader-B5V2Klve.js +0 -1
  105. package/ui-dist/assets/useMutation-__AYv-Pz.js +0 -1
  106. package/ui-dist/assets/x-BHUGQIUv.js +0 -1
  107. /package/ui-dist/assets/{config-hints-DSQQbeOA.js → config-hints-CPNzbMEp.js} +0 -0
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/DocBrowser-BCO2k6XD.js","assets/DocBrowser-rDOjI3ga.js","assets/i18n-DvzXOGQX.js","assets/createLucideIcon-CCiTGX8L.js","assets/book-open-BE8M56IM.js","assets/external-link-qsnCMhw1.js","assets/plus-I9pBS4Fl.js","assets/search-DxmL3IWE.js","assets/x-BHUGQIUv.js","assets/DocBrowserContext-BUq3Wo8O.js","assets/ModelConfig-C77Ae9ru.js","assets/dist-ZwoAXs46.js","assets/ProviderScopedModelInput-CEnK61uo.js","assets/select-BILPf7zs.js","assets/es2015-CEAreese.js","assets/loader-circle-wj7kARHv.js","assets/skeleton-COKMAnJy.js","assets/config-hints-DSQQbeOA.js","assets/chat-page-JKC6ln-y.js","assets/chunk-JZWAC4HX-erTUn3b8.js","assets/dialog-BghZFPch.js","assets/dist-Dd9cr-kz.js","assets/marketplace-page-CfCiq90S.js","assets/client-CszWMVKi.js","assets/use-infinite-scroll-loader-B5V2Klve.js","assets/useMutation-__AYv-Pz.js","assets/useConfirmDialog-patAnl1g.js","assets/tabs-custom-Bx3cNhD-.js","assets/logos-_v5b2SdG.js","assets/play-o6NmwGTi.js","assets/refresh-cw-MNqgR3LZ.js","assets/trash-2-CQUgYyRn.js","assets/chat-session-display-YcRMrAMa.js","assets/LogoBadge-DP8Ye7wJ.js","assets/tag-chip-zUaDE2-H.js","assets/SearchConfig-BfCz4wJ4.js","assets/key-round-BLe9D8ND.js","assets/config-split-page-BAGSzUR3.js","assets/ProvidersList-BCupBayq.js","assets/setting-row-BATDgg4r.js","assets/switch-CBOzecWS.js","assets/ChannelsList-SQ7Oxotv.js","assets/hash-0zjWsNl-.js","assets/RuntimeConfig-Ad-CAcmy.js","assets/desktop-DfkLlkG2.js","assets/save-D4bObrmH.js","assets/desktop-update-config-BXeGlqHD.js","assets/download-D7LOizcW.js","assets/security-config-BUm6FFfl.js","assets/SessionsConfig-CvjxU40H.js","assets/SecretsConfig-DjmBIhyy.js","assets/marketplace-page-CAAk1Khc.js","assets/mcp-marketplace-page-D0Pp9Hs-.js"])))=>i.map(i=>d[i]);
2
- import{_ as e,a as t,c as n,h as r,i,l as a,m as o,n as s,o as c,p as l,s as u,u as d}from"./i18n-DvzXOGQX.js";import{a as f,c as ee,i as te,n as p,o as m,r as ne,s as re,t as ie}from"./dist-ZwoAXs46.js";import{a as ae,i as h,l as g,n as oe,o as se,r as _,t as ce}from"./chunk-JZWAC4HX-erTUn3b8.js";import{A as le,C as ue,D as de,E as fe,F as pe,H as v,I as me,M as he,N as ge,O as _e,P as ve,R as y,S as ye,T as be,V as xe,_ as Se,a as Ce,b as we,c as Te,d as Ee,f as De,g as Oe,h as ke,j as Ae,k as je,l as Me,m as Ne,n as Pe,p as Fe,s as Ie,t as b,u as Le,v as Re,w as ze,x as Be,z as x}from"./client-CszWMVKi.js";import{t as S}from"./useMutation-__AYv-Pz.js";import{_ as C,a as Ve,c as He,d as Ue,f as We,g as Ge,h as Ke,i as qe,l as Je,n as Ye,o as Xe,r as Ze,t as Qe}from"./es2015-CEAreese.js";import{t as $e}from"./dist-Dd9cr-kz.js";import{a as et,n as tt,o as nt,r as rt,t as it}from"./dialog-BghZFPch.js";import{t as w}from"./createLucideIcon-CCiTGX8L.js";import{n as at}from"./DocBrowser-rDOjI3ga.js";import{t as ot}from"./book-open-BE8M56IM.js";import{C as st,E as ct,S as lt,T as ut,i as dt,n as ft,r as pt,t as mt,w as ht}from"./select-BILPf7zs.js";import{t as gt}from"./download-D7LOizcW.js";import{t as _t}from"./key-round-BLe9D8ND.js";import{t as vt}from"./refresh-cw-MNqgR3LZ.js";import{t as yt}from"./search-DxmL3IWE.js";import{t as bt}from"./x-BHUGQIUv.js";import{i as xt,n as St,r as Ct}from"./DocBrowserContext-BUq3Wo8O.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 wt=r((e=>{var t=ee();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),Tt=w(`AlarmClock`,[[`circle`,{cx:`12`,cy:`13`,r:`8`,key:`3y4lt7`}],[`path`,{d:`M12 9v4l2 2`,key:`1c63tq`}],[`path`,{d:`M5 3 2 6`,key:`18tl5t`}],[`path`,{d:`m22 6-3-3`,key:`1opdir`}],[`path`,{d:`M6.38 18.7 4 21`,key:`17xu3x`}],[`path`,{d:`M17.64 18.67 20 21`,key:`kv2oe2`}]]),Et=w(`Bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Dt=w(`BrainCircuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),Ot=w(`Cpu`,[[`rect`,{width:`16`,height:`16`,x:`4`,y:`4`,rx:`2`,key:`14l7u7`}],[`rect`,{width:`6`,height:`6`,x:`9`,y:`9`,rx:`1`,key:`5aljv4`}],[`path`,{d:`M15 2v2`,key:`13l42r`}],[`path`,{d:`M15 20v2`,key:`15mkzm`}],[`path`,{d:`M2 15h2`,key:`1gxd5l`}],[`path`,{d:`M2 9h2`,key:`1bbxkp`}],[`path`,{d:`M20 15h2`,key:`19e6y8`}],[`path`,{d:`M20 9h2`,key:`19tzq7`}],[`path`,{d:`M9 2v2`,key:`165o2o`}],[`path`,{d:`M9 20v2`,key:`i2bqo8`}]]),kt=w(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),At=w(`History`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),jt=w(`Languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),Mt=w(`Laptop`,[[`path`,{d:`M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16`,key:`tarvll`}]]),Nt=w(`LogOut`,[[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}],[`polyline`,{points:`16 17 21 12 16 7`,key:`1gabdz`}],[`line`,{x1:`21`,x2:`9`,y1:`12`,y2:`12`,key:`1uyos4`}]]),Pt=w(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),Ft=w(`MessageSquare`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),It=w(`Palette`,[[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`path`,{d:`M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z`,key:`12rzf8`}]]),Lt=w(`Plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M9 8V2`,key:`14iosj`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z`,key:`osxo6l`}]]),Rt=w(`RefreshCcw`,[[`path`,{d:`M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`14sxne`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16`,key:`1hlbsb`}],[`path`,{d:`M16 16h5v5`,key:`ccwih5`}]]),zt=w(`Settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Bt=w(`Shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Vt=w(`Smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Ht=w(`Sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),Ut=w(`SquareArrowOutUpRight`,[[`path`,{d:`M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6`,key:`y09zxi`}],[`path`,{d:`m21 3-9 9`,key:`mpx6sq`}],[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}]]),Wt=w(`Wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),Gt=w(`Wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]),Kt=wt(),T=e(o(),1),E=l(),D=T.forwardRef(({className:e,type:t,...n},r)=>(0,E.jsx)(`input`,{type:t,className:d(`flex h-9 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2 text-sm text-gray-900 file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n}));D.displayName=`Input`;var qt=T.forwardRef(({className:e,...t},n)=>(0,E.jsx)(`label`,{ref:n,className:d(`text-sm font-medium leading-none text-gray-700 peer-disabled:cursor-not-allowed peer-disabled:opacity-70`,e),...t}));qt.displayName=`Label`;var Jt=re(`rounded-2xl border px-4 py-3`,{variants:{tone:{neutral:`border-gray-200 bg-gray-50 text-gray-900`,success:`border-emerald-200 bg-emerald-50 text-emerald-900`,warning:`border-amber-200 bg-amber-50 text-amber-900`,danger:`border-rose-200 bg-rose-50 text-rose-700`,info:`border-primary/20 bg-primary/10 text-primary`},borderStyle:{solid:``,dashed:`border-dashed`}},defaultVariants:{tone:`neutral`,borderStyle:`solid`}}),Yt={neutral:`text-gray-900`,success:`text-emerald-800`,warning:`text-amber-900`,danger:`text-rose-700`,info:`text-primary`},Xt={neutral:`text-gray-600`,success:`text-emerald-700`,warning:`text-amber-800`,danger:`text-rose-700`,info:`text-primary/90`},O=T.forwardRef(({className:e,tone:t=`neutral`,borderStyle:n=`solid`,title:r,description:i,icon:a,actions:o,children:s,...c},l)=>{let u=t??`neutral`,f=!!r||!!i||!!a||!!o;return(0,E.jsxs)(`div`,{ref:l,className:d(Jt({tone:u,borderStyle:n}),e),...c,children:[f?(0,E.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,E.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,E.jsxs)(`div`,{className:`flex items-start gap-2`,children:[a?(0,E.jsx)(`div`,{className:`mt-0.5 shrink-0`,children:a}):null,(0,E.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,E.jsx)(`p`,{className:d(`text-sm font-medium`,Yt[u]),children:r}):null,i?(0,E.jsx)(`p`,{className:d(r?`mt-1`:``,`text-sm leading-6`,Xt[u]),children:i}):null]})]})}),o?(0,E.jsx)(`div`,{className:`shrink-0`,children:o}):null]}):null,s?(0,E.jsx)(`div`,{className:d(f?`mt-3`:``),children:s}):null]})});O.displayName=`NoticeCard`;var k=T.forwardRef(({className:e,hover:t=!0,...n},r)=>(0,E.jsx)(`div`,{ref:r,className:d(`rounded-2xl border border-gray-200/50 bg-white text-card-foreground shadow-card transition-all duration-base`,t&&`hover:shadow-card-hover hover:border-gray-200`,e),...n}));k.displayName=`Card`;var A=T.forwardRef(({className:e,...t},n)=>(0,E.jsx)(`div`,{ref:n,className:d(`flex flex-col space-y-1.5 p-6`,e),...t}));A.displayName=`CardHeader`;var j=T.forwardRef(({className:e,...t},n)=>(0,E.jsx)(`h3`,{ref:n,className:d(`text-[15px] font-semibold leading-tight tracking-tight text-gray-900`,e),...t}));j.displayName=`CardTitle`;var M=T.forwardRef(({className:e,...t},n)=>(0,E.jsx)(`p`,{ref:n,className:d(`text-[13px] text-gray-400 leading-relaxed`,e),...t}));M.displayName=`CardDescription`;var N=T.forwardRef(({className:e,...t},n)=>(0,E.jsx)(`div`,{ref:n,className:d(`p-6 pt-0`,e),...t}));N.displayName=`CardContent`;var Zt=T.forwardRef(({className:e,...t},n)=>(0,E.jsx)(`div`,{ref:n,className:d(`flex items-center justify-between p-6 pt-0`,e),...t}));Zt.displayName=`CardFooter`;var Qt={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 P({status:e,label:t,className:n}){let r=Qt[e];return(0,E.jsxs)(`div`,{className:d(`inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-2 py-0.5`,r.bg,n),children:[(0,E.jsx)(`span`,{className:d(`h-1.5 w-1.5 rounded-full`,r.dot)}),(0,E.jsx)(`span`,{className:d(`text-[11px] font-medium`,r.text),children:t})]})}async function $t(){let e=await b.get(`/api/remote/status`);if(!e.ok)throw Error(e.error.message);return e.data}async function en(){let e=await b.get(`/api/remote/doctor`);if(!e.ok)throw Error(e.error.message);return e.data}async function tn(e){let t=await b.post(`/api/remote/auth/start`,e);if(!t.ok)throw Error(t.error.message);return t.data}async function nn(e){let t=await b.post(`/api/remote/auth/poll`,e);if(!t.ok)throw Error(t.error.message);return t.data}async function rn(){let e=await b.post(`/api/remote/logout`,{});if(!e.ok)throw Error(e.error.message);return e.data}async function an(e){let t=await b.put(`/api/remote/account/profile`,e);if(!t.ok)throw Error(t.error.message);return t.data}async function on(e){let t=await b.put(`/api/remote/settings`,e);if(!t.ok)throw Error(t.error.message);return t.data}async function F(e){let t=await b.post(`/api/remote/service/${e}`,{});if(!t.ok)throw Error(t.error.message);return t.data}function I(){return x({queryKey:R,queryFn:$t,staleTime:5e3,refetchOnWindowFocus:!0})}function L(e){let{label:t,muted:n,value:r}=e;return(0,E.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,E.jsx)(`span`,{className:`text-gray-500`,children:t}),(0,E.jsx)(`span`,{className:n?`text-right text-gray-500`:`text-right text-gray-900`,children:r==null||r===``?`-`:String(r)})]})}function sn(){let e=wn(),t=I(),n=t.data,r=H(e=>e.actionLabel),a=(0,T.useMemo)(()=>_n(n),[n]),o=!!r,c=n?.runtime?.deviceName?.trim()||n?.settings.deviceName?.trim()||i(`remoteDeviceNameAuto`),l=!!(n?.account.loggedIn&&dn(n)),{hero:u,issueHint:d}=a;return(0,T.useEffect)(()=>{e.remoteAccessManager.syncStatus(n)},[e,n]),t.isLoading&&!n?(0,E.jsx)(`div`,{className:`p-8 text-gray-400`,children:i(`remoteLoading`)}):(0,E.jsxs)(f,{className:`space-y-6`,children:[(0,E.jsx)(te,{title:i(`remotePageTitle`),description:i(`remotePageDescription`)}),(0,E.jsxs)(`div`,{className:`grid gap-6 xl:grid-cols-[1.2fr_0.8fr]`,children:[(0,E.jsxs)(k,{children:[(0,E.jsxs)(A,{className:`space-y-4`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,E.jsx)(j,{children:u.title}),(0,E.jsx)(P,{status:u.badgeStatus,label:u.badgeLabel})]}),(0,E.jsx)(M,{children:u.description})]}),(0,E.jsxs)(N,{className:`space-y-5`,children:[(0,E.jsxs)(O,{tone:`neutral`,children:[(0,E.jsx)(L,{label:i(`remoteSignedInAccount`),value:n?.account.email}),(0,E.jsx)(L,{label:i(`remoteDeviceName`),value:c}),(0,E.jsx)(L,{label:i(`remoteConnectionStatus`),value:u.badgeLabel}),(0,E.jsx)(L,{label:i(`remoteLastConnectedAt`),value:n?.runtime?.lastConnectedAt?s(n.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,E.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[a.primaryAction?(0,E.jsxs)(m,{onClick:()=>{if(a.primaryAction?.kind===`reauthorize`){e.remoteAccessManager.reauthorizeRemoteAccess(n);return}if(a.primaryAction?.kind===`repair`){e.remoteAccessManager.repairRemoteAccess(n);return}e.remoteAccessManager.enableRemoteAccess(n)},disabled:o,children:[a.primaryAction.showRefreshIcon?(0,E.jsx)(Rt,{className:`mr-2 h-4 w-4`}):null,r||a.primaryAction.label]}):null,(0,E.jsxs)(m,{variant:`outline`,onClick:()=>void e.accountManager.openNextClawWeb(),disabled:o||!l,children:[(0,E.jsx)(Ut,{className:`mr-2 h-4 w-4`}),i(`remoteOpenDeviceList`)]}),n?.settings.enabled?(0,E.jsx)(m,{variant:`outline`,onClick:()=>void e.remoteAccessManager.disableRemoteAccess(n),disabled:o,children:i(`remoteDisable`)}):null]}),a.shouldShowIssueHint&&d?(0,E.jsx)(O,{tone:`warning`,title:d.title,description:d.body}):null,(0,E.jsx)(`p`,{className:`text-xs text-gray-500`,children:i(`remoteOpenWebHint`)})]})]}),(0,E.jsxs)(k,{children:[(0,E.jsxs)(A,{children:[(0,E.jsxs)(j,{className:`flex items-center gap-2`,children:[(0,E.jsx)(Mt,{className:`h-4 w-4 text-primary`}),i(`remoteDeviceSectionTitle`)]}),(0,E.jsx)(M,{children:i(`remoteDeviceSectionDescription`)})]}),(0,E.jsxs)(N,{className:`space-y-5`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,E.jsx)(P,{status:n?.account.loggedIn?`ready`:`inactive`,label:n?.account.loggedIn?i(`remoteAccountConnected`):i(`remoteAccountNotConnected`)}),(0,E.jsx)(P,{status:n?.settings.enabled?`active`:`inactive`,label:n?.settings.enabled?i(`remoteEnabled`):i(`remoteStateDisabled`)}),(0,E.jsx)(P,{status:n?.service.running?`active`:`inactive`,label:n?.service.running?i(`remoteServiceRunning`):i(`remoteServiceStopped`)})]}),(0,E.jsxs)(O,{tone:`neutral`,children:[(0,E.jsx)(L,{label:i(`remoteDeviceName`),value:c}),(0,E.jsx)(L,{label:i(`remoteConnectionStatus`),value:u.badgeLabel}),(0,E.jsx)(L,{label:i(`remoteLastConnectedAt`),value:n?.runtime?.lastConnectedAt?s(n.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,E.jsx)(O,{tone:`neutral`,borderStyle:`dashed`,description:n?.account.loggedIn?i(`remoteOpenWebHint`):i(`remoteStatusNeedsSignInDescription`),className:`text-sm`})]})]})]})]})}var R=[`remote-status`],cn=`https://platform.nextclaw.io`,ln=`https://nextclaw-platform-console.pages.dev`,z=async()=>await y.fetchQuery({queryKey:R,queryFn:$t,staleTime:5e3}),B=async()=>(await y.invalidateQueries({queryKey:R}),await z()),un=(e,t)=>t?.trim()||e?.settings.platformApiBase?.trim()||e?.account.apiBase?.trim()||void 0;function V(e){let t=e?.trim();if(!t)return;let n;try{n=new URL(t)}catch{return}if(n.hostname===`platform.nextclaw.io`||n.hostname===`nextclaw-platform-console.pages.dev`)return n.origin;if(n.hostname===`ai-gateway-api.nextclaw.io`)return cn;if(n.hostname.includes(`nextclaw-provider-gateway-api`)&&n.hostname.endsWith(`.workers.dev`))return ln}var dn=e=>V(e?.account.apiBase)||V(e?.settings.platformApiBase)||V(e?.platformBase)||V(e?.account.platformBase)||void 0,H=ne(e=>({enabled:!1,deviceName:``,platformApiBase:``,advancedOpen:!1,draftTouched:!1,actionLabel:null,doctor:null,setEnabled:t=>e({enabled:t,draftTouched:!0}),setDeviceName:t=>e({deviceName:t,draftTouched:!0}),setPlatformApiBase:t=>e({platformApiBase:t,draftTouched:!0}),setAdvancedOpen:t=>e({advancedOpen:t}),hydrateDraft:({enabled:t,deviceName:n,platformApiBase:r})=>e({enabled:t,deviceName:n,platformApiBase:r,draftTouched:!1}),beginAction:t=>e({actionLabel:t}),finishAction:()=>e({actionLabel:null}),setDoctor:t=>e({doctor:t})})),fn=class{constructor(){this.accountManager=null,this.bindAccountManager=e=>{this.accountManager=e},this.syncStatus=e=>{if(!e)return;let t=H.getState();t.draftTouched||t.actionLabel||this.hydrateDraftFromStatus(e)},this.setEnabled=e=>{H.getState().setEnabled(e)},this.setDeviceName=e=>{H.getState().setDeviceName(e)},this.setPlatformApiBase=e=>{H.getState().setPlatformApiBase(e)},this.setAdvancedOpen=e=>{H.getState().setAdvancedOpen(e)},this.enableRemoteAccess=async e=>{let t=e??await B(),n=H.getState();if(!t.account.loggedIn){await this.accountManager?.ensureSignedIn({pendingAction:{type:`enable-remote`},apiBase:n.platformApiBase});return}await this.applyEnabledState(!0,t)},this.disableRemoteAccess=async e=>{let t=e??await B();await this.applyEnabledState(!1,t)},this.repairRemoteAccess=async e=>{let t=e??await B();if(!t.account.loggedIn){await this.accountManager?.ensureSignedIn({pendingAction:{type:`enable-remote`}});return}let n=t.service.running?`restart`:`start`;await this.runManagedAction({actionLabel:i(n===`restart`?`remoteActionRestarting`:`remoteActionStarting`),job:async()=>{await F(n);let e=await B();this.hydrateDraftFromStatus(e)},successMessage:i(`remoteServiceRecovered`)})},this.reauthorizeRemoteAccess=async e=>{let t=e??await B();await this.accountManager?.startBrowserSignIn({status:t,apiBase:H.getState().platformApiBase,pendingAction:{type:`repair-remote`}})},this.saveAdvancedSettings=async e=>{let t=e??await B(),n=H.getState();await this.runManagedAction({actionLabel:i(`remoteActionSavingAdvanced`),job:async()=>{await on({enabled:n.enabled,deviceName:n.deviceName.trim(),platformApiBase:n.platformApiBase.trim()});let e=await B();this.hydrateDraftFromStatus(e)},successMessage:t.settings.enabled===n.enabled?i(`remoteSettingsSaved`):i(`remoteAdvancedSaved`)})},this.runDoctor=async()=>{await this.runManagedAction({actionLabel:i(`remoteDoctorRunning`),job:async()=>{let e=await en();H.getState().setDoctor(e)},successMessage:i(`remoteDoctorCompleted`)})},this.startService=async()=>{await this.runServiceAction(`start`,i(`remoteActionStarting`))},this.restartService=async()=>{await this.runServiceAction(`restart`,i(`remoteActionRestarting`))},this.stopService=async()=>{await this.runServiceAction(`stop`,i(`remoteActionStopping`))},this.resumePendingActionAfterSignIn=async(e,t)=>{if(e){if(e.type===`enable-remote`){await this.applyEnabledState(!0,t);return}e.type===`repair-remote`&&await this.repairRemoteAccess(t)}},this.applyEnabledState=async(e,t)=>{let n=H.getState();await this.runManagedAction({actionLabel:i(e?`remoteActionEnabling`:`remoteActionDisabling`),job:async()=>{await on({enabled:e,deviceName:n.deviceName.trim(),platformApiBase:n.platformApiBase.trim()});let r=await B();this.hydrateDraftFromStatus(r),e?await F(r.service.running?`restart`:`start`):t.service.running&&await F(`restart`);let i=await B();this.hydrateDraftFromStatus(i)},successMessage:i(e?`remoteEnabledReady`:`remoteDisabledDone`)})},this.runServiceAction=async(e,t)=>{await this.runManagedAction({actionLabel:t,job:async()=>{let t=await F(e),n=await B();this.hydrateDraftFromStatus(n),p.success(t.message)}})},this.hydrateDraftFromStatus=e=>{H.getState().hydrateDraft({enabled:e.settings.enabled,deviceName:e.settings.deviceName,platformApiBase:e.settings.platformApiBase})},this.runManagedAction=async e=>{H.getState().beginAction(e.actionLabel);try{await e.job(),e.successMessage&&p.success(e.successMessage)}catch(e){let t=e instanceof Error?e.message:i(`error`);throw p.error(t),e}finally{H.getState().finishAction()}}}},pn=[/invalid or expired token/i,/missing bearer token/i,/token expired/i,/token is invalid/i,/run "nextclaw login"/i,/browser sign-in again/i];function mn(e){return e?.runtime?.lastError?.trim()||``}function hn(e){let t=i(`remoteStatusIssueDetailGeneric`),n=mn(e);return n?`${t} (${n})`:t}function gn(e){if(!e?.settings.enabled)return!1;let t=mn(e);return pn.some(e=>e.test(t))}function _n(e){return gn(e)?{hero:{badgeStatus:`warning`,badgeLabel:i(`remoteStateReauthorizationRequired`),title:i(`remoteStatusReauthorizationTitle`),description:i(`remoteStatusReauthorizationDescription`)},primaryAction:{kind:`reauthorize`,label:i(`remoteReauthorizeNow`),showRefreshIcon:!1},issueHint:{title:i(`remoteStatusRecoveryTitle`),body:i(`remoteStatusReauthorizationHint`)},shouldShowIssueHint:!0,requiresReauthorization:!0}:e?.account.loggedIn?e.settings.enabled?e.service.running?e.runtime?.state===`connected`?{hero:{badgeStatus:`ready`,badgeLabel:i(`statusReady`),title:i(`remoteStatusReadyTitle`),description:i(`remoteStatusReadyDescription`)},primaryAction:{kind:`repair`,label:i(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:e.runtime?.state===`connecting`?{hero:{badgeStatus:`active`,badgeLabel:i(`connecting`),title:i(`remoteStatusConnectingTitle`),description:i(`remoteStatusConnectingDescription`)},primaryAction:{kind:`repair`,label:i(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:i(`remoteStateDisconnected`),title:i(`remoteStatusIssueTitle`),description:i(`remoteStatusIssueDescription`)},primaryAction:{kind:`repair`,label:i(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:i(`remoteStatusRecoveryTitle`),body:hn(e)},shouldShowIssueHint:!!(e.settings.enabled&&e.account.loggedIn),requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:i(`remoteServiceStopped`),title:i(`remoteStatusNeedsServiceTitle`),description:i(`remoteStatusNeedsServiceDescription`)},primaryAction:{kind:`repair`,label:i(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:i(`remoteStatusRecoveryTitle`),body:i(`remoteStatusIssueDetailServiceStopped`)},shouldShowIssueHint:!0,requiresReauthorization:!1}:{hero:{badgeStatus:`inactive`,badgeLabel:i(`statusInactive`),title:i(`remoteStatusNeedsEnable`),description:i(`remoteStatusNeedsEnableDescription`)},primaryAction:{kind:`enable`,label:i(`remoteEnableNow`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`setup`,badgeLabel:i(`statusSetup`),title:i(`remoteStatusNeedsSignIn`),description:i(`remoteStatusNeedsSignInDescription`)},primaryAction:{kind:`sign-in-enable`,label:i(`remoteSignInAndEnable`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}}var U=ne(e=>({panelOpen:!1,authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500,pendingAction:null,openPanel:()=>e({panelOpen:!0}),closePanel:()=>e({panelOpen:!1}),setPendingAction:t=>e({pendingAction:t}),clearPendingAction:()=>e({pendingAction:null}),beginBrowserAuth:({sessionId:t,verificationUri:n,expiresAt:r,intervalMs:i,statusMessage:a})=>e({panelOpen:!0,authSessionId:t,authVerificationUri:n,authExpiresAt:r,authPollIntervalMs:i,authStatusMessage:a}),updateBrowserAuth:({statusMessage:t,intervalMs:n})=>e(e=>({authStatusMessage:t??e.authStatusMessage,authPollIntervalMs:n??e.authPollIntervalMs})),clearBrowserAuth:()=>e({authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500}),setAuthStatusMessage:t=>e({authStatusMessage:t})}));function W({label:e,value:t}){return(0,E.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,E.jsx)(`span`,{className:`text-gray-500`,children:e}),(0,E.jsx)(`span`,{className:`text-right text-gray-900`,children:t?.trim()||`-`})]})}function vn(e){let{email:t,username:n,role:r,canSubmitUsername:a,savingUsername:o,usernameDraft:s,onUsernameDraftChange:c,onSubmitUsername:l,onOpenDeviceList:u,onLogout:d}=e;return(0,E.jsxs)(`div`,{className:`space-y-4`,children:[(0,E.jsx)(O,{tone:`success`,title:i(`accountPanelSignedInTitle`),description:i(`accountPanelSignedInDescription`)}),(0,E.jsxs)(O,{tone:`neutral`,children:[(0,E.jsx)(W,{label:i(`remoteAccountEmail`),value:t}),(0,E.jsx)(W,{label:i(`remoteAccountUsername`),value:n}),(0,E.jsx)(W,{label:i(`remoteAccountRole`),value:r})]}),n?(0,E.jsx)(`p`,{className:`text-xs text-gray-500`,children:i(`remoteAccountUsernameLockedHelp`)}):(0,E.jsxs)(O,{tone:`warning`,title:i(`remoteAccountUsernameRequiredTitle`),description:i(`remoteAccountUsernameRequiredDescription`),children:[(0,E.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,E.jsx)(qt,{htmlFor:`account-panel-username`,children:i(`remoteAccountUsername`)}),(0,E.jsx)(D,{id:`account-panel-username`,value:s,onChange:e=>c(e.target.value),placeholder:i(`remoteAccountUsernamePlaceholder`),autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1})]}),(0,E.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-3`,children:(0,E.jsx)(m,{disabled:!a,onClick:()=>void l(),children:i(o?`remoteAccountUsernameSaving`:`remoteAccountUsernameSave`)})})]}),(0,E.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,E.jsxs)(m,{onClick:()=>void u(),children:[(0,E.jsx)(Ut,{className:`mr-2 h-4 w-4`}),i(`remoteOpenDeviceList`)]}),(0,E.jsxs)(m,{variant:`outline`,onClick:()=>void d(),children:[(0,E.jsx)(Nt,{className:`mr-2 h-4 w-4`}),i(`remoteLogout`)]})]})]})}function yn(e){let{authSessionId:t,authExpiresAt:n,authStatusMessage:r,authVerificationUri:a,onStartBrowserSignIn:o,onResumeBrowserSignIn:c}=e;return(0,E.jsxs)(`div`,{className:`space-y-4`,children:[(0,E.jsx)(O,{tone:`neutral`,title:i(`accountPanelSignedOutTitle`),description:i(`accountPanelSignedOutDescription`),children:t?(0,E.jsxs)(`div`,{className:`mt-3 border-t border-white/80 pt-3`,children:[(0,E.jsx)(W,{label:i(`remoteBrowserAuthSession`),value:t}),(0,E.jsx)(W,{label:i(`remoteBrowserAuthExpiresAt`),value:n?s(n):`-`})]}):null}),r?(0,E.jsx)(`p`,{className:`text-sm text-gray-600`,children:r}):null,(0,E.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,E.jsx)(m,{onClick:()=>void o(),children:i(t?`remoteBrowserAuthActionRetry`:`remoteBrowserAuthAction`)}),a?(0,E.jsx)(m,{variant:`outline`,onClick:c,children:i(`remoteBrowserAuthResume`)}):null]})]})}function bn(){let e=wn(),t=I(),n=U(e=>e.panelOpen),r=U(e=>e.authSessionId),a=U(e=>e.authVerificationUri),o=U(e=>e.authExpiresAt),s=U(e=>e.authStatusMessage),c=t.data,[l,u]=(0,T.useState)(``),[d,f]=(0,T.useState)(!1);(0,T.useEffect)(()=>{e.accountManager.syncRemoteStatus(c)},[e,c]);let ee=!d&&l.trim().length>0&&!c?.account.username;return(0,E.jsx)(it,{open:n,onOpenChange:t=>t?e.accountManager.openAccountPanel():e.accountManager.closeAccountPanel(),children:(0,E.jsxs)(tt,{className:`max-w-xl`,children:[(0,E.jsxs)(et,{children:[(0,E.jsxs)(nt,{className:`flex items-center gap-2`,children:[(0,E.jsx)(_t,{className:`h-5 w-5 text-primary`}),i(`accountPanelTitle`)]}),(0,E.jsx)(rt,{children:i(`accountPanelDescription`)})]}),c?.account.loggedIn?(0,E.jsx)(vn,{email:c.account.email,username:c.account.username,role:c.account.role,canSubmitUsername:ee,savingUsername:d,usernameDraft:l,onUsernameDraftChange:u,onSubmitUsername:async()=>{f(!0);try{await e.accountManager.updateUsername(l)}finally{f(!1)}},onOpenDeviceList:()=>e.accountManager.openNextClawWeb(`/account`),onLogout:()=>e.accountManager.logout()}):(0,E.jsx)(yn,{authSessionId:r,authExpiresAt:o,authStatusMessage:s,authVerificationUri:a,onStartBrowserSignIn:()=>e.accountManager.startBrowserSignIn(),onResumeBrowserSignIn:()=>e.accountManager.resumeBrowserSignIn()})]})})}var xn=class{constructor(){this.authPollTimerId=null,this.afterSignedIn=null,this.bindSignedInContinuation=e=>{this.afterSignedIn=e},this.openAccountPanel=()=>{U.getState().openPanel()},this.closeAccountPanel=()=>{U.getState().closePanel()},this.syncRemoteStatus=e=>{e?.account.loggedIn&&(this.clearPollTimer(),U.getState().clearBrowserAuth())},this.ensureSignedIn=async e=>{let t=await z();return t.account.loggedIn?!0:(e?.pendingAction&&U.getState().setPendingAction(e.pendingAction),this.openAccountPanel(),await this.startBrowserSignIn({apiBase:e?.apiBase,status:t}),!1)},this.startBrowserSignIn=async e=>{try{let t=e?.apiBase,n=e?.pendingAction,r=e?.status??await z();n&&U.getState().setPendingAction(n);let a=await tn({apiBase:un(r,t)});U.getState().beginBrowserAuth({sessionId:a.sessionId,verificationUri:a.verificationUri,expiresAt:a.expiresAt,intervalMs:a.intervalMs,statusMessage:i(`remoteBrowserAuthWaiting`)}),window.open(a.verificationUri,`_blank`,`noopener,noreferrer`)||U.getState().setAuthStatusMessage(i(`remoteBrowserAuthPopupBlocked`)),this.scheduleBrowserAuthPoll()}catch(e){let t=e instanceof Error?e.message:i(`remoteBrowserAuthStartFailed`);p.error(`${i(`remoteBrowserAuthStartFailed`)}: ${t}`)}},this.resumeBrowserSignIn=()=>{let e=U.getState().authVerificationUri;e&&window.open(e,`_blank`,`noopener,noreferrer`)},this.logout=async()=>{try{await rn(),U.getState().clearPendingAction(),U.getState().clearBrowserAuth(),await B(),p.success(i(`remoteLogoutSuccess`))}catch(e){let t=e instanceof Error?e.message:i(`remoteLogoutFailed`);p.error(`${i(`remoteLogoutFailed`)}: ${t}`)}},this.updateUsername=async e=>{try{await an({username:e.trim()}),await B(),p.success(i(`remoteAccountUsernameSetSuccess`))}catch(e){let t=e instanceof Error?e.message:i(`remoteAccountUsernameSetFailed`);p.error(`${i(`remoteAccountUsernameSetFailed`)}: ${t}`)}},this.openNextClawWeb=async(e=`/`)=>{let t=dn(await z());if(!t){p.error(i(`remoteOpenWebUnavailable`));return}let n=new URL(e,`${t.replace(/\/+$/,``)}/`).toString();window.open(n,`_blank`,`noopener,noreferrer`)},this.scheduleBrowserAuthPoll=()=>{this.clearPollTimer();let{authSessionId:e,authPollIntervalMs:t}=U.getState();e&&(this.authPollTimerId=window.setTimeout(async()=>{await this.pollBrowserSignIn()},t))},this.pollBrowserSignIn=async()=>{let e=U.getState();if(e.authSessionId)try{let t=await z(),n=await nn({sessionId:e.authSessionId,apiBase:un(t)});if(n.status===`pending`){U.getState().updateBrowserAuth({statusMessage:i(`remoteBrowserAuthWaiting`),intervalMs:n.nextPollMs??1500}),this.scheduleBrowserAuthPoll();return}if(n.status===`expired`){this.clearPollTimer(),U.getState().clearBrowserAuth(),p.error(n.message||i(`remoteBrowserAuthExpired`));return}U.getState().setAuthStatusMessage(i(`remoteBrowserAuthCompleted`));let r=await B(),{pendingAction:a}=U.getState();this.clearPollTimer(),U.getState().clearBrowserAuth(),p.success(i(`remoteLoginSuccess`)),a&&this.afterSignedIn&&await this.afterSignedIn(a,r),U.getState().clearPendingAction()}catch(e){this.clearPollTimer(),U.getState().clearBrowserAuth();let t=e instanceof Error?e.message:i(`remoteBrowserAuthPollFailed`);p.error(`${i(`remoteBrowserAuthPollFailed`)}: ${t}`)}},this.clearPollTimer=()=>{this.authPollTimerId!==null&&(window.clearTimeout(this.authPollTimerId),this.authPollTimerId=null)},this.getBrowserAuthSummary=()=>{let e=U.getState();return{sessionId:e.authSessionId,expiresAt:e.authExpiresAt?s(e.authExpiresAt):`-`}}}},G=new class{constructor(){this.accountManager=new xn,this.remoteAccessManager=new fn}};G.accountManager.bindSignedInContinuation(G.remoteAccessManager.resumePendingActionAfterSignIn),G.remoteAccessManager.bindAccountManager(G.accountManager);var Sn=(0,T.createContext)(null);function Cn({children:e}){return(0,E.jsx)(Sn.Provider,{value:G,children:e})}function wn(){let e=(0,T.useContext)(Sn);if(!e)throw Error(`useAppManager must be used inside AppManagerProvider`);return e}var Tn=40,En=400;function Dn(e){if(!(e instanceof Error))return!1;let t=e.message.trim().toLowerCase();return t?t.includes(`failed to fetch`)||t.includes(`networkerror`)||t.includes(`network request failed`)||t.includes(`load failed`)||t.includes(`request timed out`)||t.includes(`timed out waiting for remote request response`)||t.includes(`remote transport connection closed`):!1}function On(e,t){return e>=Tn?!1:Dn(t)}function kn(){let[e,t]=(0,T.useState)(!1),n=x({queryKey:[`auth-status`],queryFn:()=>Ne({timeoutMs:e?5e3:En}),staleTime:5e3,retry:On,retryDelay:250,refetchOnWindowFocus:!0});return(0,T.useEffect)(()=>{n.isSuccess&&!e&&t(!0)},[e,n.isSuccess]),n}function K(e){return Promise.all([e.invalidateQueries({queryKey:[`auth-status`]}),e.invalidateQueries({queryKey:[`app-meta`]}),e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),e.invalidateQueries({queryKey:[`config-schema`]}),e.invalidateQueries({queryKey:[`sessions`]}),e.invalidateQueries({queryKey:[`session-history`]}),e.invalidateQueries({queryKey:[`chat-runs`]}),e.invalidateQueries({queryKey:[`cron-jobs`]})])}function An(){let e=v();return S({mutationFn:fe,onSuccess:async()=>{await K(e),p.success(i(`authSetupSuccess`))},onError:e=>{p.error(`${i(`authActionFailed`)}: ${e.message}`)}})}function jn(){let e=v();return S({mutationFn:Be,onSuccess:async()=>{await K(e),p.success(i(`authLoginSuccess`))},onError:e=>{p.error(`${i(`authActionFailed`)}: ${e.message}`)}})}function Mn(){let e=v();return S({mutationFn:ye,onSuccess:async()=>{await K(e),p.success(i(`authLogoutSuccess`))},onError:e=>{p.error(`${i(`authActionFailed`)}: ${e.message}`)}})}function Nn(){let e=v();return S({mutationFn:le,onSuccess:async()=>{await K(e),p.success(i(`authPasswordUpdated`))},onError:e=>{p.error(`${i(`authActionFailed`)}: ${e.message}`)}})}function Pn(){let e=v();return S({mutationFn:je,onSuccess:async(t,n)=>{await K(e),p.success(n.enabled?i(`authEnabledSuccess`):i(`authDisabledSuccess`))},onError:e=>{p.error(`${i(`authActionFailed`)}: ${e.message}`)}})}function Fn({username:e}){let t=jn(),[n,r]=(0,T.useState)(e??``),[a,o]=(0,T.useState)(``),s=n.trim().length>0&&a.length>0&&!t.isPending;return(0,E.jsx)(`main`,{className:`flex min-h-screen items-center justify-center bg-secondary px-6 py-10`,children:(0,E.jsxs)(k,{hover:!1,className:`w-full max-w-md shadow-card-hover`,children:[(0,E.jsxs)(A,{children:[(0,E.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.24em] text-gray-500`,children:i(`authBrand`)}),(0,E.jsx)(j,{className:`text-2xl`,children:i(`authLoginTitle`)}),(0,E.jsx)(M,{children:i(`authLoginDescription`)})]}),(0,E.jsx)(N,{children:(0,E.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e?.preventDefault(),s&&t.mutate({username:n.trim(),password:a})},children:[(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:i(`authUsername`)}),(0,E.jsx)(D,{value:n,onChange:e=>r(e.target.value),placeholder:i(`authUsernamePlaceholder`),autoFocus:!0})]}),(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:i(`authPassword`)}),(0,E.jsx)(D,{type:`password`,value:a,onChange:e=>o(e.target.value),placeholder:i(`authPasswordPlaceholder`)})]}),(0,E.jsx)(m,{type:`submit`,className:`w-full`,disabled:!s,children:t.isPending?i(`authLoggingIn`):i(`authLoginAction`)})]})})]})})}var In=`nextclaw.ui.theme`,Ln=[{value:`warm`,labelKey:`themeWarm`},{value:`cool`,labelKey:`themeCool`}],q=`warm`,Rn=!1,zn=new Set;function Bn(e){return e===`warm`||e===`cool`}function Vn(e){typeof document>`u`||document.documentElement.setAttribute(`data-theme`,e)}function Hn(){if(typeof window>`u`)return`warm`;try{let e=window.localStorage.getItem(In);if(Bn(e))return e}catch{}return`warm`}function Un(){return Rn||=(q=Hn(),Vn(q),!0),q}function Wn(){return Rn?q:Un()}function Gn(e){if(Un(),e!==q){if(q=e,Vn(q),typeof window<`u`)try{window.localStorage.setItem(In,q)}catch{}zn.forEach(e=>e(q))}}function Kn(e){return zn.add(e),()=>{zn.delete(e)}}function qn(){let e=xt();(0,T.useEffect)(()=>{let t=t=>{let n=t.target.closest(`a[href]`);if(!n)return;let r=n.getAttribute(`href`)||``;Ct(r)&&(n.hasAttribute(`data-doc-external`)||t.ctrlKey||t.metaKey||t.shiftKey||(t.preventDefault(),t.stopPropagation(),e.open(r)))};return document.addEventListener(`click`,t,!0),()=>document.removeEventListener(`click`,t,!0)},[e])}function Jn(e){return[...e].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))}function Yn(e,t){let n=t.updatedAt.localeCompare(e.updatedAt);return n>0?!0:n<0?!1:e.status===t.status?!0:t.status===`idle`}function Xn(e,t){if(!e)return e;let n=e.sessions.findIndex(e=>e.sessionId===t.sessionId),r=Jn(n>=0?e.sessions.map((e,r)=>r===n&&Yn(e,t)?t:e):[...e.sessions,t]);return{...e,sessions:r,total:r.length}}function Zn(e,t){if(!e)return e;let n=t.trim();if(!n)return e;let r=e.sessions.filter(e=>e.sessionId!==n);return r.length===e.sessions.length?e:{...e,sessions:r,total:r.length}}function Qn(e,t){e?.setQueriesData({queryKey:[`ncp-sessions`]},e=>Xn(e,t))}function $n(e,t){if(!e)return e;let n=t.sessionKey.trim();if(!n)return e;let r=!1,i=e.sessions.map(e=>e.sessionId!==n||e.status===t.status?e:(r=!0,{...e,status:t.status}));return r?{...e,sessions:i}:e}function er(e,t){e?.setQueriesData({queryKey:[`ncp-sessions`]},e=>$n(e,t))}function tr(e,t){e?.setQueriesData({queryKey:[`ncp-sessions`]},e=>Zn(e,t))}function nr(e,t){if(t.type===`session.run-status`){er(e,t.payload);return}if(t.type===`session.summary.upsert`){Qn(e,t.payload.summary);return}tr(e,t.payload.sessionKey)}async function rr(e){let t=new URLSearchParams;typeof e?.limit==`number`&&Number.isFinite(e.limit)&&t.set(`limit`,String(Math.max(1,Math.trunc(e.limit))));let n=t.toString(),r=await b.get(n?`/api/ncp/sessions?${n}`:`/api/ncp/sessions`);if(!r.ok)throw Error(r.error.message);return r.data}async function ir(e,t=200){let n=await b.get(`/api/ncp/sessions/${encodeURIComponent(e)}/messages?limit=${Math.max(1,Math.trunc(t))}`);if(!n.ok)throw Error(n.error.message);return n.data}async function ar(e,t){let n=new URLSearchParams,r=t?.projectRoot?.trim();r&&n.set(`projectRoot`,r);let i=n.toString(),a=await b.get(i?`/api/ncp/sessions/${encodeURIComponent(e)}/skills?${i}`:`/api/ncp/sessions/${encodeURIComponent(e)}/skills`);if(!a.ok)throw Error(a.error.message);return a.data}async function or(e,t){let n=await b.put(`/api/ncp/sessions/${encodeURIComponent(e)}`,t);if(!n.ok)throw Error(n.error.message);return n.data}async function sr(e){let t=await b.delete(`/api/ncp/sessions/${encodeURIComponent(e)}`);if(!t.ok)throw Error(t.error.message);return t.data}function cr(){return x({queryKey:[`config`],queryFn:ke,staleTime:3e4,refetchOnWindowFocus:!0})}function lr(){return x({queryKey:[`app-meta`],queryFn:Fe,staleTime:1/0})}function ur(){return x({queryKey:[`config-meta`],queryFn:Oe,staleTime:1/0})}function dr(){return x({queryKey:[`config-schema`],queryFn:Se,staleTime:1/0})}function fr(){let e=v();return S({mutationFn:he,onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),p.success(i(`configSaved`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function pr(){let e=v();return S({mutationFn:({data:e})=>pe(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function mr(){let e=v();return S({mutationFn:({provider:e,data:t})=>ge(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),p.success(i(`configSaved`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function hr(){let e=v();return S({mutationFn:({data:e})=>Me(e??{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),p.success(i(`configSaved`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function gr(){let e=v();return S({mutationFn:({provider:e})=>Ee(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),p.success(i(`configSaved`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function _r(){return S({mutationFn:({provider:e,data:t})=>_e(e,t)})}function vr(){return S({mutationFn:({provider:e,data:t})=>de(e,t)})}function yr(){return S({mutationFn:({provider:e,data:t})=>ue(e,t)})}function br(){return S({mutationFn:({provider:e})=>we(e)})}function xr(){let e=v();return S({mutationFn:({channel:e,data:t})=>Ae(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),p.success(i(`configSavedApplying`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function Sr(){let e=v();return S({mutationFn:({data:e})=>ve(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function Cr(){let e=v();return S({mutationFn:({data:e})=>me(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function wr(){return S({mutationFn:({actionId:e,data:t})=>De(e,t),onError:e=>{p.error(i(`error`)+`: `+e.message)}})}function Tr(e){return x({queryKey:[`ncp-sessions`,e?.limit??null],queryFn:()=>rr(e),staleTime:5e3,retry:!1})}function Er(e,t=200){return x({queryKey:[`ncp-session-messages`,e,t],queryFn:()=>ir(e,t),enabled:!!e,staleTime:5e3,retry:!1})}function Dr(e){return x({queryKey:[`ncp-session-skills`,e.sessionId,e.projectRoot??null],queryFn:()=>ar(e.sessionId,{...Object.prototype.hasOwnProperty.call(e,`projectRoot`)?{projectRoot:e.projectRoot??null}:{}}),enabled:!!e.sessionId,staleTime:5e3,retry:!1})}function Or(){let e=v();return S({mutationFn:({sessionId:e})=>sr(e),onSuccess:(t,n)=>{tr(e,n.sessionId),e.removeQueries({queryKey:[`ncp-session-messages`,n.sessionId]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function kr(){let e=v();return S({mutationFn:({sessionId:e,data:t})=>or(e,t),onSuccess:t=>{Qn(e,t),e.invalidateQueries({queryKey:[`ncp-session-skills`,t.sessionId]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function Ar(e={all:!0}){return x({queryKey:[`cron`,e],queryFn:()=>Re(e),staleTime:1e4})}function jr(){let e=v();return S({mutationFn:({id:e})=>Le(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`cron`]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function Mr(){let e=v();return S({mutationFn:({id:e,enabled:t})=>be(e,{enabled:t}),onSuccess:()=>{e.invalidateQueries({queryKey:[`cron`]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}function Nr(){let e=v();return S({mutationFn:({id:e,force:t})=>ze(e,{force:t}),onSuccess:()=>{e.invalidateQueries({queryKey:[`cron`]}),p.success(i(`configSavedApplied`))},onError:e=>{p.error(i(`configSaveFailed`)+`: `+e.message)}})}var Pr=`Popover`,[Fr,Ir]=Ke(Pr,[ct]),J=ct(),[Lr,Y]=Fr(Pr),Rr=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=J(t),c=T.useRef(null),[l,u]=T.useState(!1),[d,f]=Ue({prop:r,defaultProp:i??!1,onChange:a,caller:Pr});return(0,E.jsx)(ut,{...s,children:(0,E.jsx)(Lr,{scope:t,contentId:We(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:T.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:T.useCallback(()=>u(!0),[]),onCustomAnchorRemove:T.useCallback(()=>u(!1),[]),modal:o,children:n})})};Rr.displayName=Pr;var zr=`PopoverAnchor`,Br=T.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Y(zr,n),a=J(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return T.useEffect(()=>(o(),()=>s()),[o,s]),(0,E.jsx)(lt,{...a,...r,ref:t})});Br.displayName=zr;var Vr=`PopoverTrigger`,Hr=T.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Y(Vr,n),a=J(n),o=Ge(t,i.triggerRef),s=(0,E.jsx)(He.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":ni(i.open),...r,ref:o,onClick:C(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,E.jsx)(lt,{asChild:!0,...a,children:s})});Hr.displayName=Vr;var Ur=`PopoverPortal`,[Wr,Gr]=Fr(Ur,{forceMount:void 0}),Kr=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Y(Ur,t);return(0,E.jsx)(Wr,{scope:t,forceMount:n,children:(0,E.jsx)($e,{present:n||a.open,children:(0,E.jsx)(qe,{asChild:!0,container:i,children:r})})})};Kr.displayName=Ur;var X=`PopoverContent`,qr=T.forwardRef((e,t)=>{let n=Gr(X,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Y(X,e.__scopePopover);return(0,E.jsx)($e,{present:r||a.open,children:a.modal?(0,E.jsx)(Yr,{...i,ref:t}):(0,E.jsx)(Xr,{...i,ref:t})})});qr.displayName=X;var Jr=Je(`PopoverContent.RemoveScroll`),Yr=T.forwardRef((e,t)=>{let n=Y(X,e.__scopePopover),r=T.useRef(null),i=Ge(t,r),a=T.useRef(!1);return T.useEffect(()=>{let e=r.current;if(e)return Qe(e)},[]),(0,E.jsx)(Ye,{as:Jr,allowPinchZoom:!0,children:(0,E.jsx)(Zr,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:C(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:C(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:C(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Xr=T.forwardRef((e,t)=>{let n=Y(X,e.__scopePopover),r=T.useRef(!1),i=T.useRef(!1);return(0,E.jsx)(Zr,{...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()}})}),Zr=T.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Y(X,n),ee=J(n);return Ze(),(0,E.jsx)(Ve,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,E.jsx)(Xe,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,E.jsx)(ht,{"data-state":ni(f.open),role:`dialog`,id:f.contentId,...ee,...d,ref:t,style:{...d.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)`}})})})}),Qr=`PopoverClose`,$r=T.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Y(Qr,n);return(0,E.jsx)(He.button,{type:`button`,...r,ref:t,onClick:C(e.onClick,()=>i.onOpenChange(!1))})});$r.displayName=Qr;var ei=`PopoverArrow`,ti=T.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=J(n);return(0,E.jsx)(st,{...i,...r,ref:t})});ti.displayName=ei;function ni(e){return e?`open`:`closed`}var ri=Rr,ii=Br,ai=Hr,oi=Kr,si=qr,ci=ri,li=ai,ui=T.forwardRef(({className:e,sideOffset:t=8,align:n=`start`,...r},i)=>(0,E.jsx)(oi,{children:(0,E.jsx)(si,{ref:i,sideOffset:t,align:n,className:d(`z-[var(--z-popover,50)] w-72 overflow-hidden rounded-2xl border border-gray-200/50 bg-white p-4 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),...r})}));ui.displayName=si.displayName;var di={healthy:`bg-emerald-500 shadow-[0_0_0_3px_rgba(16,185,129,0.14)]`,attention:`bg-amber-400 shadow-[0_0_0_3px_rgba(251,191,36,0.16)]`,inactive:`bg-gray-300 shadow-[0_0_0_3px_rgba(156,163,175,0.12)]`};function fi(){let e=Ce(),t=e.actionLabel===i(`runtimeStatusRestartAction`),n=async()=>{if(t)try{let e=await Te.runRuntimeControlAction(`restart-service`);p.success(e.message)}catch(e){let t=e instanceof Error?e.message:i(`runtimeControlActionFailed`);p.error(`${i(`runtimeControlActionFailed`)}: ${t}`)}};return(0,E.jsxs)(ci,{children:[(0,E.jsx)(li,{asChild:!0,children:(0,E.jsx)(`button`,{type:`button`,className:`inline-flex items-center justify-center rounded-full p-0.5 transition-transform hover:scale-105`,"aria-label":e.title,title:e.title,"data-testid":`runtime-status-entry`,children:(0,E.jsx)(`span`,{className:d(`h-2.5 w-2.5 rounded-full`,di[e.tone])})})}),(0,E.jsxs)(ui,{align:`start`,sideOffset:10,className:`w-[290px] space-y-3 rounded-2xl border border-gray-200 bg-white p-4`,children:[(0,E.jsxs)(`div`,{className:`space-y-1`,children:[(0,E.jsx)(`div`,{className:`text-sm font-semibold text-gray-900`,children:e.title}),(0,E.jsx)(`p`,{className:`text-xs leading-5 text-gray-600`,children:e.description})]}),e.reasonLines.length>0?(0,E.jsx)(`div`,{className:`space-y-2`,children:e.reasonLines.map(e=>(0,E.jsx)(`div`,{className:`rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-5 text-amber-900`,children:e},e))}):null,e.actionLabel?(0,E.jsxs)(`div`,{className:`flex items-center justify-between border-t border-gray-100 pt-1`,children:[(0,E.jsx)(`span`,{className:`text-[11px] text-gray-500`,children:i(`runtimeStatusActionHint`)}),(0,E.jsx)(`button`,{type:`button`,onClick:()=>void n(),disabled:e.isBusy,className:`text-sm font-semibold text-sky-600 transition-colors hover:text-sky-700 disabled:text-gray-400`,children:e.isBusy?i(`runtimeStatusRestartingAction`):e.actionLabel})]}):null]})]})}function pi({className:e,suffix:t}){let{data:n}=lr(),r=n?.name??`NextClaw`,i=n?.productVersion?.trim(),a=t??(0,E.jsx)(fi,{});return(0,E.jsxs)(`div`,{className:e??`flex items-center gap-2.5`,children:[(0,E.jsx)(`div`,{className:`h-7 w-7 rounded-lg overflow-hidden flex items-center justify-center`,children:(0,E.jsx)(`img`,{src:`/logo.svg`,alt:r,className:`h-full w-full object-contain`})}),(0,E.jsxs)(`div`,{className:`flex items-baseline gap-2 min-w-0`,children:[(0,E.jsx)(`span`,{className:`truncate text-[15px] font-semibold tracking-[-0.01em] text-gray-800`,children:r}),i?(0,E.jsxs)(`span`,{className:`text-[13px] font-medium text-gray-500`,children:[`v`,i]}):null,a?(0,E.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:a}):null]})]})}var mi={default:{row:`gap-3 px-3 py-2.5 text-[14px]`,icon:`h-[17px] w-[17px]`,value:`text-xs`,gap:`gap-3`},compact:{row:`gap-2.5 px-3 py-2 text-[13px]`,icon:`h-4 w-4`,value:`text-[11px]`,gap:`gap-2.5`}};function hi(e){return mi[e]}function gi({to:e,label:t,icon:n,density:r=`default`,className:i}){let a=hi(r);return(0,E.jsx)(oe,{to:e,className:({isActive:e})=>d(`group flex w-full items-center rounded-xl font-medium transition-colors duration-base`,a.row,e?`bg-gray-200 text-gray-900 shadow-sm`:`text-gray-600 hover:bg-gray-200/60 hover:text-gray-900`,i),children:({isActive:e})=>(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(n,{className:d(a.icon,`transition-colors`,e?`text-gray-900`:`text-gray-500 group-hover:text-gray-800`)}),(0,E.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:t})]})})}function _i({label:e,icon:t,onClick:n,density:r=`default`,className:i,labelClassName:a,trailing:o,trailingClassName:s,testId:c,trailingTestId:l}){let u=hi(r);return(0,E.jsxs)(`button`,{type:`button`,onClick:n,className:d(`flex w-full items-center rounded-xl font-medium text-gray-600 transition-all duration-base hover:bg-gray-200/60 hover:text-gray-800`,u.row,i),"data-testid":c,children:[(0,E.jsx)(t,{className:d(u.icon,`shrink-0 text-gray-400`)}),(0,E.jsx)(`span`,{className:d(`min-w-0 flex-1 text-left`,a),children:e}),o?(0,E.jsx)(`span`,{className:d(`shrink-0 text-gray-500`,u.value,s),"data-testid":l,children:o}):null]})}function vi({label:e,icon:t,value:n,valueLabel:r,onValueChange:i,density:a=`default`,children:o}){let s=hi(a);return(0,E.jsxs)(mt,{value:n,onValueChange:i,children:[(0,E.jsxs)(dt,{className:d(`h-auto w-full rounded-xl border-0 bg-transparent font-medium text-gray-600 shadow-none hover:bg-gray-200/60 focus:ring-0`,s.row),children:[(0,E.jsxs)(`div`,{className:d(`flex min-w-0 items-center`,s.gap),children:[(0,E.jsx)(t,{className:d(s.icon,`text-gray-400`)}),(0,E.jsx)(`span`,{className:`text-left`,children:e})]}),(0,E.jsx)(`span`,{className:d(`ml-auto text-gray-500`,s.value),children:r})]}),(0,E.jsx)(ft,{children:o})]})}var yi=(0,T.createContext)(null);function bi({children:e}){let[t,r]=(0,T.useState)(()=>u());(0,T.useEffect)(()=>a(e=>{r(e)}),[]);let i=(0,T.useCallback)(e=>{n(e),r(c())},[]),o=(0,T.useCallback)(()=>{i(t===`en`?`zh`:`en`)},[t,i]),s=(0,T.useMemo)(()=>({language:t,setLanguage:i,toggleLanguage:o}),[t,i,o]);return(0,E.jsx)(yi.Provider,{value:s,children:e})}function xi(){let e=(0,T.useContext)(yi);if(!e)throw Error(`useI18n must be used within I18nProvider`);return{...e,t:i}}var Si={warm:`#F9F8F5`,cool:`#F8FAFB`},Ci=new class{constructor(){this.syncTheme=e=>{if(typeof document>`u`)return;let t=Si[e];this.updateThemeMeta(t),this.updateSurfaceBackgrounds(t),document.documentElement.style.colorScheme=`light`},this.syncCurrentTheme=()=>{if(typeof document>`u`)return;let e=document.documentElement.getAttribute(`data-theme`)===`cool`?`cool`:`warm`;this.syncTheme(e)},this.updateThemeMeta=e=>{let t=document.querySelector(`meta[name="theme-color"]`);t instanceof HTMLMetaElement&&(t.content=e)},this.updateSurfaceBackgrounds=e=>{document.documentElement.style.backgroundColor=e,document.body.style.backgroundColor=e;let t=document.getElementById(`root`);t&&(t.style.backgroundColor=e)}}},wi=(0,T.createContext)(null);function Ti({children:e}){let[t,n]=(0,T.useState)(()=>Un());(0,T.useEffect)(()=>{Ci.syncTheme(t)},[t]),(0,T.useEffect)(()=>Kn(e=>{n(e)}),[]);let r=(0,T.useCallback)(e=>{Gn(e),n(Wn())},[]),i=(0,T.useMemo)(()=>({theme:t,setTheme:r}),[t,r]);return(0,E.jsx)(wi.Provider,{value:i,children:e})}function Ei(){let e=(0,T.useContext)(wi);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}function Di({mode:e}){let n=wn(),r=xt(),a=I(),{language:o,setLanguage:s}=xi(),{theme:c,setTheme:l}=Ei(),u=e===`settings`,f=t.find(e=>e.value===o)?.label??o,ee=i(Ln.find(e=>e.value===c)?.labelKey??`themeWarm`),te=a.data?.account.email?.trim(),p=!!a.data?.account.loggedIn,m=e=>{o!==e&&(s(e),window.location.reload())},ne=e=>{c!==e&&l(e)},re=[{target:`/chat`,label:i(`chat`),icon:Pt},{target:`/chat/cron`,label:i(`cron`),icon:Tt},{target:`/chat/skills`,label:i(`marketplaceFilterSkills`),icon:Dt},{target:`/agents`,label:i(`agentsPageTitle`),icon:Et}],ie=[{target:`/model`,label:i(`model`),icon:Ot},{target:`/providers`,label:i(`providers`),icon:Ht},{target:`/channels`,label:i(`channels`),icon:Ft},{target:`/search`,label:i(`searchChannels`),icon:yt},{target:`/marketplace/plugins`,label:i(`marketplaceFilterPlugins`),icon:Lt},{target:`/marketplace/mcp`,label:i(`marketplaceFilterMcp`),icon:Gt},{target:`/runtime`,label:i(`runtime`),icon:kt},{target:`/updates`,label:i(`updates`),icon:gt},{target:`/remote`,label:i(`remote`),icon:Wt},{target:`/security`,label:i(`security`),icon:Bt},{target:`/sessions`,label:i(`sessions`),icon:At},{target:`/secrets`,label:i(`secrets`),icon:_t}],ae=u?ie:re,h=u?`compact`:`default`;return(0,E.jsxs)(`aside`,{className:`w-[240px] shrink-0 flex h-full min-h-0 flex-col overflow-hidden bg-secondary px-4 py-6`,children:[u?(0,E.jsx)(`div`,{className:`shrink-0 px-2 pb-3`,children:(0,E.jsxs)(`div`,{className:`flex items-center gap-2 px-1 py-1`,"data-testid":`settings-sidebar-header`,children:[(0,E.jsxs)(oe,{to:`/chat`,className:`group inline-flex min-w-0 items-center gap-1.5 rounded-lg px-1 py-1 text-[12px] font-medium text-gray-500 transition-colors hover:bg-gray-200/60 hover:text-gray-900`,children:[(0,E.jsx)(at,{className:`h-3.5 w-3.5 shrink-0 text-gray-400 group-hover:text-gray-700`}),(0,E.jsx)(`span`,{className:`truncate`,children:i(`backToMain`)})]}),(0,E.jsx)(`span`,{className:`h-4 w-px shrink-0 bg-[#dddfe6]`,"aria-hidden":`true`}),(0,E.jsx)(`h1`,{className:`truncate text-[15px] font-semibold tracking-[-0.01em] text-gray-800`,children:i(`settings`)})]})}):(0,E.jsx)(`div`,{className:`shrink-0 px-2 pb-8`,children:(0,E.jsx)(pi,{className:`flex items-center gap-2.5 cursor-pointer`})}),(0,E.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,E.jsx)(`nav`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto pr-1`,children:(0,E.jsx)(`ul`,{className:d(u?`space-y-0.5 pb-3`:`space-y-1 pb-4`),children:ae.map(e=>(0,E.jsx)(`li`,{children:(0,E.jsx)(gi,{to:e.target,label:e.label,icon:e.icon,density:h})},e.target))})}),(0,E.jsxs)(`div`,{className:d(`shrink-0 border-t border-[#dde0ea] bg-secondary`,u?`mt-2 pt-3`:`mt-3 pt-3`),children:[u?(0,E.jsx)(_i,{onClick:()=>n.accountManager.openAccountPanel(),icon:_t,label:i(`remoteAccountEntryManage`),density:`compact`,className:`mb-1.5`,trailing:p?te||i(`remoteAccountEntryConnected`):i(`remoteAccountEntryDisconnected`),trailingClassName:`max-w-[92px] truncate text-right`,testId:`settings-sidebar-account-entry`,trailingTestId:`settings-sidebar-account-status`}):null,e===`main`&&(0,E.jsx)(`div`,{className:`mb-2`,children:(0,E.jsx)(gi,{to:`/settings`,label:i(`settings`),icon:zt})}),(0,E.jsx)(`div`,{className:`mb-2`,children:(0,E.jsx)(vi,{value:c,onValueChange:e=>ne(e),icon:It,label:i(`theme`),valueLabel:ee,density:h,children:Ln.map(e=>(0,E.jsx)(pt,{value:e.value,className:`text-xs`,children:i(e.labelKey)},e.value))})}),(0,E.jsx)(`div`,{className:`mb-2`,children:(0,E.jsx)(vi,{value:o,onValueChange:e=>m(e),icon:jt,label:i(`language`),valueLabel:f,density:h,children:t.map(e=>(0,E.jsx)(pt,{value:e.value,className:`text-xs`,children:e.label},e.value))})}),(0,E.jsx)(_i,{onClick:()=>r.open(void 0,{kind:`docs`,newTab:!0,title:`Docs`}),icon:ot,label:i(`docBrowserHelp`),density:h})]})]})]})}var Oi=`NextClaw`,ki=[{prefix:`/marketplace/mcp`,key:`marketplaceMcpPageTitle`},{prefix:`/marketplace/plugins`,key:`marketplacePluginsPageTitle`},{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:`desktopUpdatesPageTitle`},{prefix:`/remote`,key:`remotePageTitle`},{prefix:`/security`,key:`authSecurityTitle`},{prefix:`/sessions`,key:`sessionsPageTitle`},{prefix:`/secrets`,key:`secretsPageTitle`}];function Ai(e,t){return e===t||e.startsWith(`${t}/`)}function ji(e){let t=e.toLowerCase();for(let{prefix:e,key:n}of ki)if(Ai(t,e))return i(n);return i(`settings`)}function Mi(e){return`${Oi} - ${ji(e)}`}var Ni=(0,T.lazy)(async()=>({default:(await g(async()=>{let{DocBrowser:e}=await import(`./DocBrowser-BCO2k6XD.js`);return{DocBrowser:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))).DocBrowser}));function Pi(e){let t=e.toLowerCase();return t===`/chat`||t.startsWith(`/chat/`)||t===`/skills`||t.startsWith(`/skills/`)||t===`/cron`||t.startsWith(`/cron/`)||t===`/agents`||t.startsWith(`/agents/`)}function Fi({children:e}){let{isOpen:t,mode:n}=xt();qn();let{pathname:r}=se(),{language:i}=xi(),a=Pi(r);return(0,T.useEffect)(()=>{document.title=Mi(r)},[r,i]),(0,E.jsxs)(`div`,{className:`h-screen flex bg-background font-sans text-foreground`,children:[!a&&(0,E.jsx)(Di,{mode:`settings`}),(0,E.jsxs)(`div`,{className:`flex-1 flex min-w-0 overflow-hidden relative`,children:[(0,E.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:a?(0,E.jsx)(`div`,{className:`flex-1 h-full overflow-hidden`,children:e}):(0,E.jsx)(`main`,{className:`flex-1 overflow-auto p-8 pb-16 custom-scrollbar`,children:(0,E.jsx)(`div`,{className:`mx-auto h-full max-w-6xl animate-fade-in`,children:e})})}),t&&n===`docked`&&(0,E.jsx)(T.Suspense,{fallback:null,children:(0,E.jsx)(Ni,{})})]}),t&&n===`floating`&&(0,E.jsx)(T.Suspense,{fallback:null,children:(0,E.jsx)(Ni,{})})]})}function Ii({children:e}){return(0,E.jsx)(St,{children:(0,E.jsx)(Fi,{children:e})})}function Li(e){let t=e.trim().toLowerCase();return t?!(t.startsWith(`plugins`)||t.startsWith(`skills`)):!0}function Ri(e,t){t.startsWith(`plugins`)&&(e?.invalidateQueries({queryKey:[`ncp-session-types`]}),e?.invalidateQueries({queryKey:[`marketplace-installed`,`plugin`]}),e?.invalidateQueries({queryKey:[`marketplace-items`]})),t.startsWith(`mcp`)&&(e?.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}))}function zi(e,t){e&&Li(t)&&e.invalidateQueries({queryKey:[`config`]}),Ri(e,t)}function Bi(e){let{queryClient:t,shouldResyncSessions:n,clearShouldResyncSessions:r,markShouldResyncSessions:i,event:a}=e;if(a.type===`connection.open`){Te.handleConnectionRestored(),n&&(r(),t?.invalidateQueries({queryKey:[`ncp-sessions`]}));return}if(a.type===`connection.close`||a.type===`connection.error`){Te.handleConnectionInterrupted(a.type===`connection.error`?a.payload?.message:null),i();return}if(a.type===`config.updated`){zi(t,typeof a.payload?.path==`string`?a.payload.path:``);return}if(a.type===`session.run-status`||a.type===`session.summary.upsert`||a.type===`session.summary.delete`){nr(t,a);return}a.type===`error`&&console.error(`Realtime transport error:`,a.payload.message)}function Vi(e){let t=(0,T.useRef)(!1);(0,T.useEffect)(()=>Pe.subscribe(n=>Bi({queryClient:e,shouldResyncSessions:t.current,clearShouldResyncSessions:()=>{t.current=!1},markShouldResyncSessions:()=>{t.current=!0},event:n})),[e])}var Hi=`nextclaw-pwa-install-banner-dismissed`,Ui=`nextclaw-pwa-install-banner-dismissed-until`;function Wi(){let e=qi();return e?e.getItem(`nextclaw-pwa-install-banner-dismissed`)===`1`?!0:Ji(e):!1}function Gi(){let e=qi();e?.setItem(Hi,`1`),e?.removeItem(Ui)}function Ki(){let e=qi();e?.removeItem(Hi),e?.removeItem(Ui)}function qi(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Ji(e){let t=e.getItem(Ui);if(!t)return!1;let n=Number.parseInt(t,10);return e.removeItem(Ui),!Number.isFinite(n)||n<=Date.now()?!1:(e.setItem(Hi,`1`),!0)}function Yi(){return{initialized:!1,installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`,dismissedInstallPrompt:Wi(),updateAvailable:!1,registrationFailed:!1}}var Z=ne(()=>Yi()),Xi=`nextclaw-pwa-dev-sw-reset`,Zi=new class{constructor(){this.started=!1,this.registration=null,this.reloadWhenControllerChanges=!1,this.start=async()=>{if(!(this.started||typeof window>`u`)&&(this.started=!0,!(!(`serviceWorker`in navigator)||!this.isEligibleInstallContext()))){if(this.isDevelopmentServer()){await this.cleanupDevelopmentRegistrations();return}try{let e=await navigator.serviceWorker.register(`/sw.js`);this.registration=e,this.bindRegistration(e),navigator.serviceWorker.addEventListener(`controllerchange`,this.handleControllerChange),await this.syncUpdateAvailability()}catch{Z.setState({registrationFailed:!0})}}},this.syncUpdateAvailability=async()=>{if(typeof window>`u`||!(`serviceWorker`in navigator)||typeof navigator.serviceWorker.getRegistration!=`function`){Z.setState({updateAvailable:!1});return}let e=this.registration??await navigator.serviceWorker.getRegistration(`/sw.js`)??null;Z.setState({updateAvailable:this.shouldSurfaceUpdate(e)})},this.applyUpdate=async()=>{let e=this.registration??await navigator.serviceWorker.getRegistration(`/sw.js`)??null;if(!e){window.location.reload();return}e.waiting||await e.update();let t=e.waiting;if(!t){window.location.reload();return}this.reloadWhenControllerChanges=!0,t.postMessage({type:`SKIP_WAIT`})},this.stop=()=>{!this.started||typeof window>`u`||!(`serviceWorker`in navigator)||(navigator.serviceWorker.removeEventListener(`controllerchange`,this.handleControllerChange),this.started=!1,this.registration=null,this.reloadWhenControllerChanges=!1)},this.bindRegistration=e=>{e.addEventListener(`updatefound`,()=>{let t=e.installing;t&&t.addEventListener(`statechange`,()=>{t.state===`installed`&&this.syncUpdateAvailability()})})},this.handleControllerChange=()=>{this.reloadWhenControllerChanges&&(this.reloadWhenControllerChanges=!1,window.location.reload())},this.isEligibleInstallContext=()=>window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>!1,this.shouldSurfaceUpdate=e=>!e?.waiting||!navigator.serviceWorker.controller?!1:Z.getState().installability===`installed`,this.cleanupDevelopmentRegistrations=async()=>{if(typeof navigator.serviceWorker.getRegistrations!=`function`)return;let e=(await navigator.serviceWorker.getRegistrations()).filter(e=>[e.active?.scriptURL,e.installing?.scriptURL,e.waiting?.scriptURL].filter(e=>!!e).some(e=>e.endsWith(`/sw.js`)));if(e.length===0){this.clearDevResetMarker();return}if(await Promise.all(e.map(async e=>await e.unregister())),await this.clearNextClawCaches(),navigator.serviceWorker.controller&&!this.hasDevResetMarker()){this.setDevResetMarker(),window.location.reload();return}this.clearDevResetMarker()},this.clearNextClawCaches=async()=>{if(typeof window>`u`||!(`caches`in window)||typeof caches.keys!=`function`)return;let e=await caches.keys();await Promise.all(e.filter(e=>e.startsWith(`nextclaw-ui-`)).map(async e=>await caches.delete(e)))},this.hasDevResetMarker=()=>{try{return window.sessionStorage.getItem(Xi)===`1`}catch{return!1}},this.setDevResetMarker=()=>{try{window.sessionStorage.setItem(Xi,`1`)}catch{}},this.clearDevResetMarker=()=>{try{window.sessionStorage.removeItem(Xi)}catch{}}}},Q=new class{constructor(){this.started=!1,this.deferredPrompt=null,this.displayModeMediaQuery=null,this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.addEventListener(`appinstalled`,this.handleAppInstalled),typeof window.matchMedia==`function`&&(this.displayModeMediaQuery=window.matchMedia(`(display-mode: standalone)`),this.bindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged)),this.refreshState())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.removeEventListener(`appinstalled`,this.handleAppInstalled),this.displayModeMediaQuery&&=(this.unbindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged),null),this.deferredPrompt=null,this.started=!1)},this.resetForTests=()=>{this.stop(),Z.setState(Yi())},this.refreshState=()=>{let e=this.resolveInstallability();Z.setState(t=>({...t,initialized:!0,installability:e.installability,installMethod:e.installMethod,blockedReason:e.blockedReason,dismissedInstallPrompt:Wi()})),Zi.syncUpdateAvailability()},this.dismissInstallPrompt=()=>{Gi(),Z.setState({dismissedInstallPrompt:!0})},this.promptInstall=async()=>{let e=this.resolveInstallability();if(e.installability!==`available`)return`unavailable`;if(e.installMethod===`manual`||!this.deferredPrompt)return`manual`;this.deferredPrompt.prompt();let t=await this.deferredPrompt.userChoice;return this.deferredPrompt=null,t.outcome===`accepted`?(Ki(),this.refreshState(),p.success(i(`pwaInstallAccepted`)),`accepted`):(this.dismissInstallPrompt(),this.refreshState(),`dismissed`)},this.handleBeforeInstallPrompt=e=>{e.preventDefault(),this.deferredPrompt=e,this.refreshState()},this.handleAppInstalled=()=>{this.deferredPrompt=null,Ki(),Z.setState({dismissedInstallPrompt:!0}),p.success(i(`pwaInstalledToast`)),this.refreshState()},this.handleDisplayModeChanged=()=>{this.refreshState()},this.resolveInstallability=()=>this.isDevelopmentServer()?{installability:`unsupported`,installMethod:`none`,blockedReason:`dev-server`}:this.hasDesktopHost()?{installability:`suppressed`,installMethod:`none`,blockedReason:`desktop-host`}:this.isStandalone()?{installability:`installed`,installMethod:`none`,blockedReason:null}:this.hasInstallSurfaceSupport()?this.isEligibleInstallContext()?{installability:`available`,installMethod:this.deferredPrompt?`prompt`:`manual`,blockedReason:null}:{installability:`unsupported`,installMethod:`none`,blockedReason:`insecure-context`}:{installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`},this.hasDesktopHost=()=>typeof window<`u`&&!!window.nextclawDesktop,this.hasInstallSurfaceSupport=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&`serviceWorker`in navigator,this.isEligibleInstallContext=()=>typeof window>`u`?!1:window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>typeof window<`u`&&!1,this.isStandalone=()=>{if(typeof window>`u`)return!1;let e=window.navigator;return typeof window.matchMedia==`function`&&window.matchMedia(`(display-mode: standalone)`).matches||e.standalone===!0},this.bindDisplayModeListener=(e,t)=>{if(`addEventListener`in e){e.addEventListener(`change`,t);return}e.addListener?.(t)},this.unbindDisplayModeListener=(e,t)=>{if(`removeEventListener`in e){e.removeEventListener(`change`,t);return}e.removeListener?.(t)}}};function Qi(){let e=Z(e=>e.installability);return(0,E.jsx)(`span`,{className:d(`inline-flex items-center rounded-full border px-3 py-1 text-xs font-medium`,e===`installed`?`bg-emerald-50 text-emerald-700 border-emerald-200`:e===`available`?`bg-amber-50 text-amber-700 border-amber-200`:`bg-gray-100 text-gray-600 border-gray-200`),children:$i(e)})}function $i(e){return i(e===`available`?`pwaInstallStatusAvailable`:e===`installed`?`pwaInstallStatusInstalled`:e===`suppressed`?`pwaInstallStatusDesktopHost`:`pwaInstallStatusUnavailable`)}function ea(e,t,n){return i(e===`installed`?`pwaInstallCardInstalled`:e===`suppressed`?`pwaInstallCardSuppressed`:e===`available`&&t===`prompt`?`pwaInstallCardPrompt`:e===`available`?`pwaInstallCardManual`:n===`insecure-context`?`pwaInstallCardInsecureContext`:n===`dev-server`?`pwaInstallCardDevServer`:`pwaInstallCardUnsupported`)}function ta(){let e=Z(e=>e.installability),t=Z(e=>e.installMethod),n=Z(e=>e.blockedReason);return(0,E.jsxs)(k,{children:[(0,E.jsxs)(A,{className:`flex flex-row items-start justify-between gap-4 space-y-0`,children:[(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(j,{children:i(`pwaInstallTitle`)}),(0,E.jsx)(M,{children:i(`pwaInstallDescription`)})]}),(0,E.jsx)(Qi,{})]}),(0,E.jsxs)(N,{className:`space-y-4`,children:[(0,E.jsx)(`div`,{className:`rounded-2xl border border-gray-200 bg-gray-50/90 p-4`,children:(0,E.jsx)(`p`,{className:`text-sm leading-6 text-gray-700`,children:ea(e,t,n)})}),e===`available`&&t===`prompt`?(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,E.jsxs)(m,{type:`button`,className:`gap-2`,onClick:()=>{Q.promptInstall()},children:[(0,E.jsx)(gt,{className:`h-4 w-4`}),i(`pwaInstallAction`)]}),(0,E.jsx)(`p`,{className:`text-sm text-gray-500`,children:i(`pwaInstallPromptHint`)})]}):null,e===`available`&&t===`manual`?(0,E.jsxs)(`div`,{className:`flex items-start gap-3 rounded-2xl border border-dashed border-gray-300 bg-white p-4`,children:[(0,E.jsx)(Vt,{className:`mt-0.5 h-4 w-4 text-gray-500`}),(0,E.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:i(`pwaInstallManualHint`)})]}):null]})]})}function na(){let e=Z(e=>e.installability),t=Z(e=>e.installMethod),n=Z(e=>e.dismissedInstallPrompt);return e!==`available`||t!==`prompt`||n?null:(0,E.jsxs)(`div`,{className:`fixed bottom-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,E.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,E.jsxs)(`div`,{className:`space-y-1`,children:[(0,E.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:i(`pwaInstallBannerTitle`)}),(0,E.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:i(`pwaInstallBannerDescription`)})]}),(0,E.jsx)(`button`,{type:`button`,"aria-label":i(`pwaInstallDismiss`),className:`rounded-full p-1 text-gray-400 transition hover:bg-gray-100 hover:text-gray-600`,onClick:()=>{Q.dismissInstallPrompt()},children:(0,E.jsx)(bt,{className:`h-4 w-4`})})]}),(0,E.jsxs)(`div`,{className:`mt-4 flex items-center gap-3`,children:[(0,E.jsxs)(m,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{Q.promptInstall()},children:[(0,E.jsx)(gt,{className:`h-4 w-4`}),i(`pwaInstallAction`)]}),(0,E.jsx)(m,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{Q.dismissInstallPrompt()},children:i(`pwaInstallDismiss`)})]})]})}function ra(){let e=Z(e=>e.updateAvailable),t=Z(e=>e.installability);return!e||t!==`installed`?null:(0,E.jsxs)(`div`,{className:`fixed top-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,E.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,E.jsxs)(`div`,{className:`space-y-1`,children:[(0,E.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:i(`pwaUpdateBannerTitle`)}),(0,E.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:i(`pwaUpdateBannerDescription`)})]})}),(0,E.jsx)(`div`,{className:`mt-4`,children:(0,E.jsxs)(m,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{Zi.applyUpdate()},children:[(0,E.jsx)(vt,{className:`h-4 w-4`}),i(`pwaUpdateAction`)]})})]})}var ia=!1;function aa(){ia||typeof window>`u`||(ia=!0,Q.start(),Zi.start())}var oa=(0,T.lazy)(async()=>({default:(await g(async()=>{let{ModelConfig:e}=await import(`./ModelConfig-C77Ae9ru.js`);return{ModelConfig:e}},__vite__mapDeps([10,2,11,4,3,12,13,14,15,9,16,17]))).ModelConfig})),sa=(0,T.lazy)(async()=>({default:(await g(async()=>{let{ChatPage:e}=await import(`./chat-page-JKC6ln-y.js`);return{ChatPage:e}},__vite__mapDeps([18,2,19,13,14,11,3,20,21,8,22,23,24,16,25,9,26,27,1,4,5,6,7,12,28,15,29,30,31,32,33,34]))).ChatPage})),ca=(0,T.lazy)(async()=>({default:(await g(async()=>{let{SearchConfig:e}=await import(`./SearchConfig-BfCz4wJ4.js`);return{SearchConfig:e}},__vite__mapDeps([35,2,13,14,11,3,5,36,7,37]))).SearchConfig})),la=(0,T.lazy)(async()=>({default:(await g(async()=>{let{ProvidersList:e}=await import(`./ProvidersList-BCupBayq.js`);return{ProvidersList:e}},__vite__mapDeps([38,2,13,14,11,3,23,36,6,7,31,8,33,37,39,40,27,17]))).ProvidersList})),ua=(0,T.lazy)(async()=>({default:(await g(async()=>{let{ChannelsList:e}=await import(`./ChannelsList-SQ7Oxotv.js`);return{ChannelsList:e}},__vite__mapDeps([41,2,13,14,11,3,23,25,4,5,28,42,36,15,7,8,33,37,40,27,34,17]))).ChannelsList})),da=(0,T.lazy)(async()=>({default:(await g(async()=>{let{RuntimeConfig:e}=await import(`./RuntimeConfig-Ad-CAcmy.js`);return{RuntimeConfig:e}},__vite__mapDeps([43,2,13,14,11,3,23,15,29,6,44,45,31,39,40,17]))).RuntimeConfig})),fa=(0,T.lazy)(async()=>({default:(await g(async()=>{let{DesktopUpdateConfig:e}=await import(`./desktop-update-config-BXeGlqHD.js`);return{DesktopUpdateConfig:e}},__vite__mapDeps([46,2,13,14,11,3,47,5,30,44,40]))).DesktopUpdateConfig})),pa=(0,T.lazy)(async()=>({default:(await g(async()=>{let{SecurityConfig:e}=await import(`./security-config-BUm6FFfl.js`);return{SecurityConfig:e}},__vite__mapDeps([48,2,11,40]))).SecurityConfig})),ma=(0,T.lazy)(async()=>({default:(await g(async()=>{let{SessionsConfig:e}=await import(`./SessionsConfig-CvjxU40H.js`);return{SessionsConfig:e}},__vite__mapDeps([49,2,13,14,11,3,42,30,7,32,23,15,26,20,21,8]))).SessionsConfig})),ha=(0,T.lazy)(async()=>({default:(await g(async()=>{let{SecretsConfig:e}=await import(`./SecretsConfig-DjmBIhyy.js`);return{SecretsConfig:e}},__vite__mapDeps([50,2,13,14,11,3,6,45,31,40]))).SecretsConfig})),ga=(0,T.lazy)(async()=>({default:(await g(async()=>{let{RemoteAccessPage:e}=await import(`./remote-C9fXm4V5.js`);return{RemoteAccessPage:e}},[])).RemoteAccessPage})),_a=(0,T.lazy)(async()=>({default:(await g(async()=>{let{MarketplacePage:e}=await import(`./marketplace-page-CAAk1Khc.js`);return{MarketplacePage:e}},__vite__mapDeps([51,22,2,19,13,14,11,3,21,23,24,16,25,9,26,20,8,27]))).MarketplacePage})),va=(0,T.lazy)(async()=>({default:(await g(async()=>{let{McpMarketplacePage:e}=await import(`./mcp-marketplace-page-D0Pp9Hs-.js`);return{McpMarketplacePage:e}},__vite__mapDeps([52,2,13,14,11,3,20,21,8,23,24,16,25,9,26,40,27,34]))).McpMarketplacePage}));function ya(){return(0,E.jsx)(`div`,{className:`h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40`})}function $({children:e}){return(0,E.jsx)(T.Suspense,{fallback:(0,E.jsx)(ya,{}),children:e})}function ba(){return(0,E.jsxs)(ae,{children:[(0,E.jsx)(h,{path:`/chat/skills`,element:(0,E.jsx)(_,{to:`/skills`,replace:!0})}),(0,E.jsx)(h,{path:`/chat/cron`,element:(0,E.jsx)(_,{to:`/cron`,replace:!0})}),(0,E.jsx)(h,{path:`/chat/agents`,element:(0,E.jsx)(_,{to:`/agents`,replace:!0})}),(0,E.jsx)(h,{path:`/chat/:sessionId?`,element:(0,E.jsx)($,{children:(0,E.jsx)(sa,{view:`chat`})})}),(0,E.jsx)(h,{path:`/agents`,element:(0,E.jsx)($,{children:(0,E.jsx)(sa,{view:`agents`})})}),(0,E.jsx)(h,{path:`/skills`,element:(0,E.jsx)($,{children:(0,E.jsx)(sa,{view:`skills`})})}),(0,E.jsx)(h,{path:`/cron`,element:(0,E.jsx)($,{children:(0,E.jsx)(sa,{view:`cron`})})}),(0,E.jsx)(h,{path:`/model`,element:(0,E.jsx)($,{children:(0,E.jsx)(oa,{})})}),(0,E.jsx)(h,{path:`/search`,element:(0,E.jsx)($,{children:(0,E.jsx)(ca,{})})}),(0,E.jsx)(h,{path:`/providers`,element:(0,E.jsx)($,{children:(0,E.jsx)(la,{})})}),(0,E.jsx)(h,{path:`/channels`,element:(0,E.jsx)($,{children:(0,E.jsx)(ua,{})})}),(0,E.jsx)(h,{path:`/runtime`,element:(0,E.jsx)($,{children:(0,E.jsx)(da,{})})}),(0,E.jsx)(h,{path:`/updates`,element:(0,E.jsx)($,{children:(0,E.jsx)(fa,{})})}),(0,E.jsx)(h,{path:`/remote`,element:(0,E.jsx)($,{children:(0,E.jsx)(ga,{})})}),(0,E.jsx)(h,{path:`/security`,element:(0,E.jsx)($,{children:(0,E.jsx)(pa,{})})}),(0,E.jsx)(h,{path:`/sessions`,element:(0,E.jsx)($,{children:(0,E.jsx)(ma,{})})}),(0,E.jsx)(h,{path:`/secrets`,element:(0,E.jsx)($,{children:(0,E.jsx)(ha,{})})}),(0,E.jsx)(h,{path:`/settings`,element:(0,E.jsx)(_,{to:`/model`,replace:!0})}),(0,E.jsx)(h,{path:`/marketplace/skills`,element:(0,E.jsx)(_,{to:`/skills`,replace:!0})}),(0,E.jsx)(h,{path:`/marketplace`,element:(0,E.jsx)(_,{to:`/marketplace/plugins`,replace:!0})}),(0,E.jsx)(h,{path:`/marketplace/mcp`,element:(0,E.jsx)($,{children:(0,E.jsx)(va,{})})}),(0,E.jsx)(h,{path:`/marketplace/:type`,element:(0,E.jsx)($,{children:(0,E.jsx)(_a,{})})}),(0,E.jsx)(h,{path:`/`,element:(0,E.jsx)(_,{to:`/chat`,replace:!0})}),(0,E.jsx)(h,{path:`*`,element:(0,E.jsx)(_,{to:`/chat`,replace:!0})})]})}function xa(){return Vi(y),Ie(),(0,E.jsxs)(Cn,{children:[(0,E.jsx)(Ii,{children:(0,E.jsx)(ba,{})}),(0,E.jsx)(bn,{})]})}function Sa(){let e=kn(),t=e.isError&&Dn(e.error);return e.isLoading&&!e.isError||t||e.isError?(0,E.jsx)(xa,{}):e.data?.enabled&&!e.data.authenticated?(0,E.jsx)(Fn,{username:e.data.username}):(0,E.jsx)(xa,{})}function Ca(){return(0,T.useEffect)(()=>{aa()},[]),(0,E.jsxs)(xe,{client:y,children:[(0,E.jsx)(Sa,{}),(0,E.jsx)(na,{}),(0,E.jsx)(ra,{}),(0,E.jsx)(ie,{position:`top-right`,richColors:!0})]})}(0,Kt.createRoot)(document.getElementById(`root`)).render((0,E.jsx)(T.StrictMode,{children:(0,E.jsx)(Ti,{children:(0,E.jsx)(bi,{children:(0,E.jsx)(ce,{children:(0,E.jsx)(Ca,{})})})})}));export{gn as $,Nr as A,Cr as B,gr as C,Ft as Ct,Dr as D,Dt,Er as E,kt as Et,fr as F,Qn as G,ir as H,kr as I,Mn as J,Ln as K,mr as L,_r as M,Mr as N,Tr as O,Et as Ot,xr as P,_n as Q,Sr as R,Or as S,It as St,br as T,jt as Tt,or as U,sr as V,tr as W,Pn as X,An as Y,Nn as Z,ur as _,D as _t,gi as a,un as at,Ar as b,zt as bt,ci as c,I as ct,ii as d,N as dt,fn as et,si as f,M as ft,cr as g,qt as gt,ai as h,O as ht,_i as i,B as it,vr as j,yr as k,Tt as kt,ui as l,P as lt,ri as m,j as mt,Ei as n,R as nt,vi as o,dn as ot,oi as p,A as pt,kn as q,xi as r,z as rt,pi as s,sn as st,ta as t,H as tt,li as u,k as ut,dr as v,Gt as vt,wr as w,Pt as wt,jr as x,Rt as xt,hr as y,Ht as yt,pr as z};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-CCiTGX8L.js";var t=e(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]);export{t};
@@ -1 +0,0 @@
1
- import{t as e}from"./marketplace-page-CfCiq90S.js";export{e as MarketplacePage};
@@ -1,49 +0,0 @@
1
- import{_ as e,i as t,m as n,p as r,u as i}from"./i18n-DvzXOGQX.js";import{a,i as o,n as s,o as c}from"./dist-ZwoAXs46.js";import{c as l,s as u}from"./chunk-JZWAC4HX-erTUn3b8.js";import{H as d,t as f,z as p}from"./client-CszWMVKi.js";import{a as m,c as h,i as g,l as _,n as v,o as ee,s as y,t as b}from"./use-infinite-scroll-loader-B5V2Klve.js";import{t as x}from"./useMutation-__AYv-Pz.js";import{_ as S,c as te,d as C,f as ne,g as w,h as re,i as ie,o as T,u as E}from"./es2015-CEAreese.js";import{t as D}from"./dist-Dd9cr-kz.js";import{C as O,E as k,S as A,T as ae,w as oe,x as se}from"./select-BILPf7zs.js";import{i as ce}from"./DocBrowserContext-BUq3Wo8O.js";import{ht as le,r as ue}from"./index-lr6rQUSd.js";import{t as de}from"./useConfirmDialog-patAnl1g.js";import{t as fe}from"./tabs-custom-Bx3cNhD-.js";var j=e(n(),1),M=r(),[N,P]=re(`Tooltip`,[k]),F=k(),I=`TooltipProvider`,pe=700,L=`tooltip.open`,[me,R]=N(I),he=e=>{let{__scopeTooltip:t,delayDuration:n=pe,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=j.useRef(!0),s=j.useRef(!1),c=j.useRef(0);return j.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,M.jsx)(me,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:j.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:j.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:j.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};he.displayName=I;var z=`Tooltip`,[ge,B]=N(z),V=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=R(z,e.__scopeTooltip),l=F(t),[u,d]=j.useState(null),f=ne(),p=j.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=j.useRef(!1),[_,v]=C({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(L))):c.onClose(),a?.(e)},caller:z}),ee=j.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),y=j.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),b=j.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),x=j.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return j.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,M.jsx)(ae,{...l,children:(0,M.jsx)(ge,{scope:t,contentId:f,open:_,stateAttribute:ee,trigger:u,onTriggerChange:d,onTriggerEnter:j.useCallback(()=>{c.isOpenDelayedRef.current?x():y()},[c.isOpenDelayedRef,x,y]),onTriggerLeave:j.useCallback(()=>{m?b():(window.clearTimeout(p.current),p.current=0)},[b,m]),onOpen:y,onClose:b,disableHoverableContent:m,children:n})})};V.displayName=z;var H=`TooltipTrigger`,U=j.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=B(H,n),a=R(H,n),o=F(n),s=w(t,j.useRef(null),i.onTriggerChange),c=j.useRef(!1),l=j.useRef(!1),u=j.useCallback(()=>c.current=!1,[]);return j.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,M.jsx)(A,{asChild:!0,...o,children:(0,M.jsx)(te.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:S(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:S(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:S(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:S(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:S(e.onBlur,i.onClose),onClick:S(e.onClick,i.onClose)})})});U.displayName=H;var W=`TooltipPortal`,[G,_e]=N(W,{forceMount:void 0}),ve=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=B(W,t);return(0,M.jsx)(G,{scope:t,forceMount:n,children:(0,M.jsx)(D,{present:n||a.open,children:(0,M.jsx)(ie,{asChild:!0,container:i,children:r})})})};ve.displayName=W;var K=`TooltipContent`,ye=j.forwardRef((e,t)=>{let n=_e(K,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=B(K,e.__scopeTooltip);return(0,M.jsx)(D,{present:r||o.open,children:o.disableHoverableContent?(0,M.jsx)(we,{side:i,...a,ref:t}):(0,M.jsx)(be,{side:i,...a,ref:t})})}),be=j.forwardRef((e,t)=>{let n=B(K,e.__scopeTooltip),r=R(K,e.__scopeTooltip),i=j.useRef(null),a=w(t,i),[o,s]=j.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=j.useCallback(()=>{s(null),d(!1)},[d]),p=j.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Oe(r,De(r,n.getBoundingClientRect())),a=ke(t.getBoundingClientRect());s(je([...i,...a])),d(!0)},[d]);return j.useEffect(()=>()=>f(),[f]),j.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),j.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Ae(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,M.jsx)(we,{...e,ref:a})}),[xe,Se]=N(z,{isInside:!1}),Ce=E(`TooltipContent`),we=j.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=B(K,n),l=F(n),{onClose:u}=c;return j.useEffect(()=>(document.addEventListener(L,u),()=>document.removeEventListener(L,u)),[u]),j.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,M.jsx)(T,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,M.jsxs)(oe,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,M.jsx)(Ce,{children:r}),(0,M.jsx)(xe,{scope:n,isInside:!0,children:(0,M.jsx)(se,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});ye.displayName=K;var Te=`TooltipArrow`,Ee=j.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=F(n);return Se(Te,n).isInside?null:(0,M.jsx)(O,{...i,...r,ref:t})});Ee.displayName=Te;function De(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Oe(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function ke(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Ae(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function je(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),Me(t)}function Me(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Ne=he,Pe=V,Fe=U,Ie=ve,Le=ye,Re=Ne,q=Pe,J=Fe,Y=j.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,M.jsx)(Ie,{children:(0,M.jsx)(Le,{ref:r,sideOffset:t,className:i(`z-[var(--z-tooltip)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));Y.displayName=Le.displayName;function X(e){return e===`plugin`?`plugins`:e===`skill`?`skills`:`mcp`}async function ze(e){let t=new URLSearchParams,n=X(e.type);e.q?.trim()&&t.set(`q`,e.q.trim()),e.tag?.trim()&&t.set(`tag`,e.tag.trim()),e.sort&&t.set(`sort`,e.sort),typeof e.page==`number`&&Number.isFinite(e.page)&&t.set(`page`,String(Math.max(1,Math.trunc(e.page)))),typeof e.pageSize==`number`&&Number.isFinite(e.pageSize)&&t.set(`pageSize`,String(Math.max(1,Math.trunc(e.pageSize))));let r=t.toString(),i=await f.get(r?`/api/marketplace/${n}/items?${r}`:`/api/marketplace/${n}/items`);if(!i.ok)throw Error(i.error.message);return i.data}async function Be(e){let t=await f.get(`/api/marketplace/skills/items/${encodeURIComponent(e)}/content`);if(!t.ok)throw Error(t.error.message);return t.data}async function Ve(e){let t=await f.get(`/api/marketplace/plugins/items/${encodeURIComponent(e)}/content`);if(!t.ok)throw Error(t.error.message);return t.data}async function He(e){let t=X(e.type),n=await f.post(`/api/marketplace/${t}/install`,e);if(!n.ok)throw Error(n.error.message);return n.data}async function Ue(e){let t=X(e),n=await f.get(`/api/marketplace/${t}/installed`);if(!n.ok)throw Error(n.error.message);return n.data}async function We(e){let t=X(e.type),n=await f.post(`/api/marketplace/${t}/manage`,e);if(!n.ok)throw Error(n.error.message);return n.data}function Ge(e){return Array.from(new Set(e.map(e=>e.spec).filter(Boolean)))}function Ke(e){let t=new Date().toISOString();return e.result.type===`skill`?{type:`skill`,spec:e.result.spec,id:e.request.skill??e.result.spec,label:e.request.skill??e.result.name??e.result.spec,source:`workspace`,installPath:e.request.installPath,installedAt:t}:{type:e.result.type,spec:e.result.spec,id:e.result.name??e.result.spec,label:e.result.name??e.result.spec,source:`marketplace`,origin:`marketplace`,enabled:e.request.enabled??!0,runtimeStatus:e.request.enabled===!1?`disabled`:`ready`,installedAt:t}}function qe(e,t){return!!(t.spec&&e.spec===t.spec||t.id&&e.id===t.id)}function Je(e,t){return t??{type:e,total:0,specs:[],records:[]}}function Ye(e){let t=Je(e.result.type,e.view),n=Ke(e),r=t.records.findIndex(e=>qe(e,{id:n.id,spec:n.spec})),i=[...t.records];return r>=0?i[r]={...i[r],...n}:i.unshift(n),{...t,type:e.result.type,records:i,specs:Ge(i),total:i.length}}function Xe(e){let t=Je(e.result.type,e.view);if(e.result.action===`uninstall`||e.result.action===`remove`){let n=t.records.filter(t=>!qe(t,{id:e.result.id,spec:e.request.spec}));return{...t,records:n,specs:Ge(n),total:n.length}}let n=t.records.map(t=>qe(t,{id:e.result.id,spec:e.request.spec})?e.result.action===`disable`?{...t,enabled:!1,runtimeStatus:`disabled`}:{...t,enabled:!0,runtimeStatus:`ready`}:t);return{...t,records:n,specs:Ge(n),total:n.length}}function Ze(e){let t=_({queryKey:[`marketplace-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>ze({...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?t:void 0},staleTime:15e3}),n=(0,j.useMemo)(()=>h(t.data),[t.data]);return{...t,data:n}}function Qe(e){return p({queryKey:[`marketplace-installed`,e],queryFn:()=>Ue(e),staleTime:1e4})}function $e(){let e=d();return x({mutationFn:e=>He(e),onSuccess:(n,r)=>{e.setQueryData([`marketplace-installed`,n.type],e=>Ye({view:e,request:r,result:n})),e.invalidateQueries({queryKey:[`marketplace-installed`,n.type],refetchType:`inactive`}),n.type===`plugin`&&e.invalidateQueries({queryKey:[`ncp-session-types`]});let i=n.type===`plugin`?t(`marketplaceInstallSuccessPlugin`):t(`marketplaceInstallSuccessSkill`);s.success(n.message||i)},onError:e=>{s.error(e.message||t(`marketplaceInstallFailed`))}})}function et(){let e=d();return x({mutationFn:e=>We(e),onSuccess:(n,r)=>{e.setQueryData([`marketplace-installed`,n.type],e=>Xe({view:e,request:r,result:n})),e.invalidateQueries({queryKey:[`marketplace-installed`,n.type],refetchType:`inactive`}),n.type===`plugin`&&e.invalidateQueries({queryKey:[`ncp-session-types`]});let i=n.action===`enable`?t(`marketplaceEnableSuccess`):n.action===`disable`?t(`marketplaceDisableSuccess`):t(`marketplaceUninstallSuccess`);s.success(n.message||i)},onError:e=>{s.error(e.message||t(`marketplaceOperationFailed`))}})}function tt(e){return(e??``).trim().toLowerCase()}function Z(e,t){let n=tt(t);return n.length>0?`${e}:${n}`:``}function nt(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 rt(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 it(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 at(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 ot(e,t,n,r){let i=tt(n);if(!i)return!0;let a=g(t?.summaryI18n,t?.summary,r);return[e.id,e.spec,e.label,t?.name,t?.slug,t?.summary,a,...t?.tags??[]].map(e=>tt(e)).filter(Boolean).some(e=>e.includes(i))}function Q(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}function $(e){let{title:t,typeLabel:n,spec:r,summary:i,description:a,metadataRaw:o,contentRaw:s,sourceUrl:c,sourceLabel:l,tags:u,author:d}=e,f=o?.trim()||`-`,p=s?.trim()||`-`,m=i?.trim(),h=a?.trim(),g=!!h&&h!==m,_=`<!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1" />
6
- <title>${Q(t)}</title>
7
- <style>
8
- :root { color-scheme: light; }
9
- body { margin: 0; background: #f7f9fc; color: #0f172a; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
10
- .wrap { max-width: 980px; margin: 0 auto; padding: 28px 20px 40px; }
11
- .hero { border: 1px solid #dbeafe; border-radius: 16px; background: linear-gradient(180deg, #eff6ff, #ffffff); padding: 20px; box-shadow: 0 6px 20px rgba(30, 64, 175, 0.08); }
12
- .hero h1 { margin: 0; font-size: 26px; }
13
- .meta { margin-top: 8px; color: #475569; font-size: 13px; overflow-wrap: anywhere; word-break: break-word; }
14
- .summary { margin-top: 14px; font-size: 14px; line-height: 1.7; color: #334155; }
15
- .grid { display: grid; grid-template-columns: 260px 1fr; gap: 14px; margin-top: 16px; }
16
- .card { border: 1px solid #e2e8f0; background: #fff; border-radius: 14px; overflow: hidden; }
17
- .card h2 { margin: 0; padding: 12px 14px; font-size: 13px; font-weight: 700; color: #1d4ed8; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
18
- .card .body { padding: 12px 14px; font-size: 13px; color: #334155; line-height: 1.7; }
19
- .code { white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.6; margin: 0; }
20
- .tags { margin-top: 10px; }
21
- .tag { display: inline-block; margin: 0 6px 6px 0; padding: 4px 9px; border-radius: 999px; background: #e0e7ff; color: #3730a3; font-size: 11px; }
22
- .source { color: #2563eb; text-decoration: none; overflow-wrap: anywhere; word-break: break-all; }
23
- @media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }
24
- </style>
25
- </head>
26
- <body>
27
- <main class="wrap">
28
- <section class="hero">
29
- <h1>${Q(t)}</h1>
30
- <div class="meta">${Q(n)} · ${Q(r)}${d?` · ${Q(d)}`:``}</div>
31
- ${m?`<p class="summary">${Q(m)}</p>`:``}
32
- ${g?`<p class="summary">${Q(h)}</p>`:``}
33
- ${u&&u.length>0?`<div class="tags">${u.map(e=>`<span class="tag">${Q(e)}</span>`).join(``)}</div>`:``}
34
- ${c?`<p class="meta" style="margin-top:12px;">${Q(l??`Source`)}: <a class="source" href="${Q(c)}" target="_blank" rel="noopener noreferrer">${Q(c)}</a></p>`:``}
35
- </section>
36
-
37
- <section class="grid">
38
- <article class="card">
39
- <h2>Metadata</h2>
40
- <div class="body"><pre class="code">${Q(f)}</pre></div>
41
- </article>
42
- <article class="card">
43
- <h2>Content</h2>
44
- <div class="body"><pre class="code">${Q(p)}</pre></div>
45
- </article>
46
- </section>
47
- </main>
48
- </body>
49
- </html>`;return`data:text/html;charset=utf-8,${encodeURIComponent(_)}`}var st=[`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 ct(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return st[Math.abs(t)%st.length]}function lt({name:e,fallback:t}){let n=e||t,r=n.substring(0,2).toUpperCase();return(0,M.jsx)(`div`,{className:i(`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-sm font-semibold text-white`,ct(n)),children:r})}function ut(e){let{title:t,spec:n,summary:r}=e;return(0,M.jsxs)(Re,{delayDuration:400,children:[(0,M.jsxs)(q,{children:[(0,M.jsx)(J,{asChild:!0,children:(0,M.jsx)(`div`,{className:`truncate text-[14px] font-semibold leading-tight text-gray-900`,children:t})}),(0,M.jsx)(Y,{className:`max-w-[300px] text-xs`,children:t})]}),(0,M.jsx)(`div`,{className:`mb-1.5 mt-0.5 flex items-center gap-1.5`,children:n?(0,M.jsxs)(q,{children:[(0,M.jsx)(J,{asChild:!0,children:(0,M.jsx)(`span`,{className:`max-w-full truncate font-mono text-[11px] text-gray-400`,children:n})}),(0,M.jsx)(Y,{className:`max-w-[300px] break-all font-mono text-xs`,children:n})]}):null}),(0,M.jsxs)(q,{children:[(0,M.jsx)(J,{asChild:!0,children:(0,M.jsx)(`p`,{className:`line-clamp-1 text-left text-[12px] leading-relaxed text-gray-500/90 transition-colors`,children:r})}),r?(0,M.jsx)(Y,{className:`max-w-[400px] text-xs leading-relaxed`,children:r}):null]})]})}function dt(e,n){return t(e&&e!==`uninstall`?e===`enable`?`marketplaceEnabling`:`marketplaceDisabling`:n?`marketplaceEnable`:`marketplaceDisable`)}function ft(e){let{item:n,record:r,isInstalling:i,busyAction:a,busyForRecord:o,isDisabled:s,onInstall:l,onManage:u}=e,d=r?.type===`plugin`?r:void 0,f=r?.type===`plugin`&&r.origin!==`bundled`||r?.type===`skill`&&r.source===`workspace`;return(0,M.jsxs)(`div`,{className:`flex h-full shrink-0 items-center`,children:[n&&!r?(0,M.jsx)(c,{type:`button`,size:`sm`,variant:`primary`,onClick:e=>{e.stopPropagation(),l(n)},disabled:i,className:`rounded-xl`,children:t(i?`marketplaceInstalling`:`marketplaceInstall`)}):null,d?(0,M.jsx)(c,{type:`button`,size:`sm`,variant:`outline`,disabled:o,onClick:e=>{e.stopPropagation(),u(s?`enable`:`disable`,d)},className:`rounded-xl border-gray-200/80 text-gray-600`,children:dt(a,s)}):null,r&&f?(0,M.jsx)(c,{type:`button`,size:`sm`,variant:`outline`,disabled:o,onClick:e=>{e.stopPropagation(),u(`uninstall`,r)},className:`rounded-xl border-rose-100 text-rose-500 hover:border-rose-200 hover:bg-rose-50 hover:text-rose-600`,children:t(a===`uninstall`?`marketplaceRemoving`:`marketplaceUninstall`)}):null]})}function pt(e){let{item:n,record:r,language:i,installState:a,manageState:o,onOpen:s,onInstall:c,onManage:l}=e,u=v(i),d=n?.name??r?.label??r?.id??r?.spec??t(`marketplaceUnknownItem`),f=g(n?.summaryI18n,n?.summary,u)||(r?t(`marketplaceInstalledLocalSummary`):``),p=n?.install.spec??r?.spec??``,m=r?.id||r?.spec,h=m?o.actionsByTarget.get(m):void 0,_=!!h,ee=r?r.enabled===!1||r.runtimeStatus===`disabled`:!1,y=n?.install.spec,b=typeof y==`string`&&a.installingSpecs.has(y);return(0,M.jsxs)(`article`,{onClick:s,className:`group flex cursor-pointer items-start justify-between gap-3.5 rounded-2xl border border-gray-200/40 bg-white px-5 py-4 shadow-sm transition-all hover:border-blue-300/80 hover:shadow-md`,children:[(0,M.jsxs)(`div`,{className:`flex h-full min-w-0 flex-1 items-start gap-3`,children:[(0,M.jsx)(lt,{name:d,fallback:p||t(`marketplaceTypeExtension`)}),(0,M.jsx)(`div`,{className:`flex h-full min-w-0 flex-1 flex-col justify-center`,children:(0,M.jsx)(ut,{title:d,spec:p,summary:f})})]}),(0,M.jsx)(ft,{item:n,record:r,isInstalling:b,busyAction:h,busyForRecord:_,isDisabled:ee,onInstall:c,onManage:l})]})}var mt=12,ht=mt;function gt(e={}){let{forcedType:n}=e,r=u(),i=l(),{language:s}=ue(),c=ce(),d=(0,j.useMemo)(()=>n===`plugins`||n===`skills`?n:i.type===`plugins`||i.type===`skills`?i.type:null,[n,i.type]);(0,j.useEffect)(()=>{n||d||r(`/marketplace/plugins`,{replace:!0})},[n,d,r]);let f=d===`skills`?`skill`:`plugin`,p=(0,j.useMemo)(()=>v(s),[s]),h=f===`plugin`?{pageTitle:`marketplacePluginsPageTitle`,pageDescription:`marketplacePluginsPageDescription`,tabMarketplace:`marketplaceTabMarketplacePlugins`,tabInstalled:`marketplaceTabInstalledPlugins`,searchPlaceholder:`marketplaceSearchPlaceholderPlugins`,sectionCatalog:`marketplaceSectionPlugins`,sectionInstalled:`marketplaceSectionInstalledPlugins`,errorLoadData:`marketplaceErrorLoadingPluginsData`,errorLoadInstalled:`marketplaceErrorLoadingInstalledPlugins`,emptyData:`marketplaceNoPlugins`,emptyInstalled:`marketplaceNoInstalledPlugins`,installedCountSuffix:`marketplaceInstalledPluginsCountSuffix`}:{pageTitle:`marketplaceSkillsPageTitle`,pageDescription:`marketplaceSkillsPageDescription`,tabMarketplace:`marketplaceTabMarketplaceSkills`,tabInstalled:`marketplaceTabInstalledSkills`,searchPlaceholder:`marketplaceSearchPlaceholderSkills`,sectionCatalog:`marketplaceSectionSkills`,sectionInstalled:`marketplaceSectionInstalledSkills`,errorLoadData:`marketplaceErrorLoadingSkillsData`,errorLoadInstalled:`marketplaceErrorLoadingInstalledSkills`,emptyData:`marketplaceNoSkills`,emptyInstalled:`marketplaceNoInstalledSkills`,installedCountSuffix:`marketplaceInstalledSkillsCountSuffix`},[_,x]=(0,j.useState)(``),[S,te]=(0,j.useState)(``),[C,ne]=(0,j.useState)(`all`),[w,re]=(0,j.useState)(`relevance`),[ie,T]=(0,j.useState)(new Set),[E,D]=(0,j.useState)(new Map);(0,j.useEffect)(()=>{let e=setTimeout(()=>{te(_.trim())},250);return()=>clearTimeout(e)},[_]);let O=Qe(f),k=Ze({q:S||void 0,type:f,sort:w,pageSize:mt}),A=b({disabled:C!==`all`||k.isError||!k.hasNextPage||k.isFetchingNextPage,onLoadMore:()=>k.fetchNextPage(),watchValue:`${f}:${C}:${S}:${w}:${k.data?.loadedItems??0}:${k.data?.loadedPages??0}`});(0,j.useEffect)(()=>{let e=A.containerRef.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[A.containerRef,S,C,w,f]);let ae=$e(),oe=et(),{confirm:se,ConfirmDialog:N}=de(),P=(0,j.useMemo)(()=>O.data?.records??[],[O.data?.records]),F=(0,j.useMemo)(()=>k.data?.items??[],[k.data?.items]),I=(0,j.useMemo)(()=>nt(F),[F]),pe=(0,j.useMemo)(()=>rt(P),[P]),L=(0,j.useMemo)(()=>{let e=P.filter(e=>e.type===f).map(e=>({key:`${e.type}:${e.spec}:${e.id??``}`,record:e,item:at(e,I)})).filter(e=>ot(e.record,e.item,S,p));return e.sort((e,t)=>{let n=e.record.installedAt?Date.parse(e.record.installedAt):NaN,r=t.record.installedAt?Date.parse(t.record.installedAt):NaN;return!Number.isNaN(n)&&!Number.isNaN(r)&&n!==r?r-n:e.record.spec.localeCompare(t.record.spec)}),e},[P,f,I,S,p]),me=C===`installed`?L.length:k.data?.total??0,R=C===`all`&&k.isLoading&&!k.data,he=C===`installed`&&O.isLoading&&!O.data,z=R||he,ge=(0,j.useMemo)(()=>C===`installed`?O.isLoading&&!O.data?t(`loading`):`${L.length} ${t(h.installedCountSuffix)}`:k.data?`${F.length} / ${me}`:t(`loading`),[C,O.data,O.isLoading,L.length,k.data,F.length,me,h.installedCountSuffix]),B={installingSpecs:ie},V={actionsByTarget:E},H=[{id:`all`,label:t(h.tabMarketplace)},{id:`installed`,label:t(h.tabInstalled),count:O.data?.total??0}],U=async e=>{let t=e.install.spec;if(!ie.has(t)){T(e=>{let n=new Set(e);return n.add(t),n});try{await ae.mutateAsync({type:e.type,spec:t,kind:e.install.kind,...e.type===`skill`?{skill:e.slug,installPath:`skills/${e.slug}`}:{}})}catch{}finally{T(e=>{if(!e.has(t))return e;let n=new Set(e);return n.delete(t),n})}}},W=async(e,n)=>{let r=n.id||n.spec;if(r&&!E.has(r)&&!(e===`uninstall`&&!await se({title:`${t(`marketplaceUninstallTitle`)} ${r}?`,description:t(`marketplaceUninstallDescription`),confirmLabel:t(`marketplaceUninstall`),variant:`destructive`}))){D(t=>{let n=new Map(t);return n.set(r,e),n});try{await oe.mutateAsync({type:n.type,action:e,id:r,spec:n.spec})}finally{D(e=>{if(!e.has(r))return e;let t=new Map(e);return t.delete(r),t})}}},G=async(e,n)=>{let r=e?.name??n?.label??n?.id??n?.spec??t(`marketplaceUnknownItem`);if(!e){let e=$({title:r,typeLabel:n?.type===`plugin`?t(`marketplaceTypePlugin`):t(`marketplaceTypeSkill`),spec:n?.spec??`-`,summary:t(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify(n??{},null,2),contentRaw:`-`});c.open(e,{newTab:!0,title:r,kind:`content`});return}let i=g(e.summaryI18n,e.summary,p);if(e.type===`skill`){try{let n=await Be(e.slug),a=$({title:r,typeLabel:t(`marketplaceTypeSkill`),spec:e.install.spec,summary:i,metadataRaw:n.metadataRaw,contentRaw:n.bodyRaw||n.raw,sourceUrl:n.sourceUrl,sourceLabel:`Source (${n.source})`,tags:e.tags,author:e.author});c.open(a,{newTab:!0,title:r,kind:`content`})}catch(n){let a=$({title:r,typeLabel:t(`marketplaceTypeSkill`),spec:e.install.spec,summary:i,metadataRaw:JSON.stringify({error:n instanceof Error?n.message:String(n)},null,2),contentRaw:t(`marketplaceOperationFailed`)});c.open(a,{newTab:!0,title:r,kind:`content`})}return}try{let n=await Ve(e.slug),a=$({title:r,typeLabel:t(`marketplaceTypePlugin`),spec:e.install.spec,summary:i,metadataRaw:n.metadataRaw,contentRaw:n.bodyRaw||n.raw||e.summary,sourceUrl:n.sourceUrl,sourceLabel:`Source (${n.source})`,tags:e.tags,author:e.author});c.open(a,{newTab:!0,title:r,kind:`content`})}catch(n){let a=$({title:r,typeLabel:t(`marketplaceTypePlugin`),spec:e.install.spec,summary:i,metadataRaw:JSON.stringify({error:n instanceof Error?n.message:String(n)},null,2),contentRaw:`-`});c.open(a,{newTab:!0,title:r,kind:`content`})}};return(0,M.jsxs)(a,{className:`flex h-full min-h-0 flex-col pb-0`,children:[(0,M.jsx)(o,{title:t(h.pageTitle),description:t(h.pageDescription)}),(0,M.jsx)(fe,{tabs:H,activeTab:C,onChange:e=>ne(e),className:`mb-4`}),(0,M.jsx)(m,{scope:C,searchText:_,searchPlaceholder:t(h.searchPlaceholder),sort:w,onSearchTextChange:x,onSortChange:re}),(0,M.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,M.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-900`,children:t(C===`installed`?h.sectionInstalled:h.sectionCatalog)}),(0,M.jsx)(`span`,{className:`text-[12px] text-gray-500`,children:ge})]}),C===`all`&&k.isError&&(0,M.jsx)(le,{tone:`danger`,title:t(h.errorLoadData),description:k.error.message}),C===`installed`&&O.isError&&(0,M.jsx)(le,{tone:`danger`,title:t(h.errorLoadInstalled),description:O.error.message}),(0,M.jsxs)(`div`,{ref:A.containerRef,className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar pr-1`,"aria-busy":z||k.isFetchingNextPage,children:[(0,M.jsxs)(`div`,{"data-testid":z?`marketplace-list-skeleton`:void 0,className:`grid grid-cols-1 gap-3 lg:grid-cols-2 2xl:grid-cols-3`,children:[z&&(0,M.jsx)(y,{count:ht}),!z&&C===`all`&&F.map(e=>(0,M.jsx)(pt,{item:e,record:it(e,pe),language:s,installState:B,manageState:V,onOpen:()=>void G(e,it(e,pe)),onInstall:U,onManage:W},e.id)),!z&&C===`installed`&&L.map(e=>(0,M.jsx)(pt,{item:e.item,record:e.record,language:s,installState:B,manageState:V,onOpen:()=>void G(e.item,e.record),onInstall:U,onManage:W},e.key))]}),C===`all`&&!z&&!k.isError&&F.length===0&&(0,M.jsx)(`div`,{className:`text-[13px] text-gray-500 py-8 text-center`,children:t(h.emptyData)}),C===`installed`&&!z&&!O.isError&&L.length===0&&(0,M.jsx)(`div`,{className:`text-[13px] text-gray-500 py-8 text-center`,children:t(h.emptyInstalled)}),C===`all`&&!R&&!k.isError&&(0,M.jsx)(ee,{hasMore:!!k.hasNextPage,loading:k.isFetchingNextPage,sentinelRef:A.sentinelRef})]})]}),(0,M.jsx)(N,{})]})}export{J as a,Ne as c,Re as i,Pe as l,q as n,Le as o,Y as r,Ie as s,gt as t,Fe as u};
@@ -1,40 +0,0 @@
1
- import{_ as e,i as t,m as n,p as r}from"./i18n-DvzXOGQX.js";import{a as i,i as a,n as o,o as s}from"./dist-ZwoAXs46.js";import{H as c,t as l,z as u}from"./client-CszWMVKi.js";import{c as d,i as f,l as p,n as m,o as h,r as g,s as _,t as v}from"./use-infinite-scroll-loader-B5V2Klve.js";import{t as y}from"./useMutation-__AYv-Pz.js";import{a as b,i as x,n as S,o as C,r as w,t as T}from"./dialog-BghZFPch.js";import{a as ee,i as te,n as E,r as D,t as O}from"./select-BILPf7zs.js";import{i as k}from"./DocBrowserContext-BUq3Wo8O.js";import{_t as A,ht as j,r as M}from"./index-lr6rQUSd.js";import{t as N}from"./tag-chip-zUaDE2-H.js";import{t as ne}from"./useConfirmDialog-patAnl1g.js";import{t as re}from"./tabs-custom-Bx3cNhD-.js";import{t as P}from"./switch-CBOzecWS.js";var F=e(n(),1);async function I(e){let t=new URLSearchParams;e.q?.trim()&&t.set(`q`,e.q.trim()),e.tag?.trim()&&t.set(`tag`,e.tag.trim()),e.sort&&t.set(`sort`,e.sort),typeof e.page==`number`&&Number.isFinite(e.page)&&t.set(`page`,String(Math.max(1,Math.trunc(e.page)))),typeof e.pageSize==`number`&&Number.isFinite(e.pageSize)&&t.set(`pageSize`,String(Math.max(1,Math.trunc(e.pageSize))));let n=t.toString(),r=await l.get(n?`/api/marketplace/mcp/items?${n}`:`/api/marketplace/mcp/items`);if(!r.ok)throw Error(r.error.message);return r.data}async function L(){let e=await l.get(`/api/marketplace/mcp/installed`);if(!e.ok)throw Error(e.error.message);return e.data}async function R(e){let t=await l.get(`/api/marketplace/mcp/items/${encodeURIComponent(e)}/content`);if(!t.ok)throw Error(t.error.message);return t.data}async function z(e){let t=await l.post(`/api/marketplace/mcp/install`,{type:`mcp`,...e});if(!t.ok)throw Error(t.error.message);return t.data}async function B(e){let t=await l.post(`/api/marketplace/mcp/manage`,{type:`mcp`,...e});if(!t.ok)throw Error(t.error.message);return t.data}async function ie(e){let t=await l.post(`/api/marketplace/mcp/doctor`,{name:e});if(!t.ok)throw Error(t.error.message);return t.data}function V(e){return(e??``).trim().toLowerCase()}function H(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=V(r);!e||t.has(e)||t.set(e,n)}}return t}function U(e,t){let n=[e.slug,e.install.spec,e.id,e.name];for(let e of n){let n=V(e);if(!n)continue;let r=t.get(n);if(r)return r}}function W(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}function G(e,t,n,r,i){let a=`<!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1" />
6
- <title>${W(e)}</title>
7
- <style>
8
- body { margin: 0; background: #f8fafc; color: #0f172a; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
9
- .wrap { max-width: 980px; margin: 0 auto; padding: 28px 20px 40px; }
10
- .hero { border: 1px solid #dbeafe; border-radius: 16px; background: linear-gradient(180deg, #eff6ff, #ffffff); padding: 20px; }
11
- .hero h1 { margin: 0; font-size: 26px; }
12
- .grid { display: grid; grid-template-columns: 280px 1fr; gap: 14px; margin-top: 16px; }
13
- .card { border: 1px solid #e2e8f0; background: #fff; border-radius: 14px; overflow: hidden; }
14
- .card h2 { margin: 0; padding: 12px 14px; font-size: 13px; font-weight: 700; color: #1d4ed8; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
15
- .body { padding: 12px 14px; }
16
- pre { margin: 0; white-space: pre-wrap; line-height: 1.7; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
17
- a { color: #2563eb; text-decoration: none; }
18
- @media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }
19
- </style>
20
- </head>
21
- <body>
22
- <main class="wrap">
23
- <section class="hero">
24
- <h1>${W(e)}</h1>
25
- ${i?`<p>${W(i)}</p>`:``}
26
- ${r?`<p><a href="${W(r)}" target="_blank" rel="noopener noreferrer">${W(r)}</a></p>`:``}
27
- </section>
28
- <section class="grid">
29
- <article class="card">
30
- <h2>Metadata</h2>
31
- <div class="body"><pre>${W(t)}</pre></div>
32
- </article>
33
- <article class="card">
34
- <h2>Content</h2>
35
- <div class="body"><pre>${W(n)}</pre></div>
36
- </article>
37
- </section>
38
- </main>
39
- </body>
40
- </html>`;return`data:text/html;charset=utf-8,${encodeURIComponent(a)}`}function K(e,n,r){return f(n?.summaryI18n,n?.summary,e)||g(r,e)||t(`marketplaceInstalledLocalSummary`)}function q(e,t){return t?.transport?t.transport.toUpperCase():(e?.install?.transportTypes??[]).map(e=>e.toUpperCase()).join(` / `)||`MCP`}var J=r();function Y(e){let{item:n,record:r,localeFallbacks:i,onOpen:a,onInstall:o,onToggle:c,onDoctor:l,onRemove:u}=e,d=r,f=n?.name??r?.label??r?.id??`MCP`,p=K(i,n,r),m=q(n,r),h=d?d.enabled===!1?t(`marketplaceDisable`):t(`statusReady`):null;return(0,J.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,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`text-sm font-semibold text-gray-900`,children:f}),(0,J.jsx)(`div`,{className:`mt-1 text-xs text-gray-500`,children:m}),(0,J.jsx)(`div`,{className:`mt-2 line-clamp-2 text-sm text-gray-600`,children:p}),(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(n?.tags??[]).map(e=>(0,J.jsx)(N,{children:e},e)),h?(0,J.jsx)(N,{tone:`success`,children:h}):null]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2`,children:[!d&&n&&o?(0,J.jsx)(s,{type:`button`,size:`sm`,variant:`primary`,className:`rounded-xl`,onClick:e=>{e.stopPropagation(),o()},children:t(`marketplaceInstall`)}):null,d?(0,J.jsxs)(J.Fragment,{children:[c?(0,J.jsx)(s,{type:`button`,size:`sm`,variant:`outline`,className:`rounded-xl border-gray-200 text-gray-700`,onClick:e=>{e.stopPropagation(),c()},children:d.enabled===!1?t(`marketplaceEnable`):t(`marketplaceDisable`)}):null,l?(0,J.jsx)(s,{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(),l()},children:t(`marketplaceMcpDoctor`)}):null,u?(0,J.jsx)(s,{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(),u()},children:t(`marketplaceMcpRemove`)}):null]}):null]})]})})}function X(e){let{item:t,open:n,pending:r,onOpenChange:i,onSubmit:a}=e;return(0,J.jsx)(T,{open:n,onOpenChange:i,children:t?(0,J.jsx)(Z,{item:t,pending:r,onOpenChange:i,onSubmit:a},`${t.slug}:${n?`open`:`closed`}`):null})}function Z(e){let{item:n,pending:r,onOpenChange:i,onSubmit:a}=e,o=n.install,[c,l]=(0,F.useState)(o?.defaultName??``),[u,d]=(0,F.useState)(!0),[f,p]=(0,F.useState)(Object.fromEntries((o?.inputs??[]).map(e=>[e.id,e.defaultValue??``])));return(0,J.jsxs)(S,{children:[(0,J.jsxs)(b,{children:[(0,J.jsx)(C,{children:t(`marketplaceMcpInstallDialogTitle`)}),(0,J.jsx)(w,{children:n.name})]}),(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(`div`,{className:`text-sm font-medium text-gray-800`,children:t(`marketplaceMcpServerName`)}),(0,J.jsx)(A,{value:c,onChange:e=>l(e.target.value),placeholder:o?.defaultName??`mcp-server`})]}),(0,J.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl border border-gray-200 px-3 py-3`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-sm font-medium text-gray-900`,children:t(`marketplaceMcpAllAgents`)}),(0,J.jsx)(`div`,{className:`text-xs text-gray-500`,children:t(`marketplaceMcpAllAgentsDescription`)})]}),(0,J.jsx)(P,{checked:u,onCheckedChange:d})]}),(o?.inputs??[]).map(e=>(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(`div`,{className:`text-sm font-medium text-gray-800`,children:e.label}),e.description?(0,J.jsx)(`div`,{className:`text-xs text-gray-500`,children:e.description}):null,(0,J.jsx)(A,{type:e.secret?`password`:`text`,value:f[e.id]??``,onChange:t=>p(n=>({...n,[e.id]:t.target.value})),placeholder:e.defaultValue??``})]},e.id))]}),(0,J.jsxs)(x,{children:[(0,J.jsx)(s,{variant:`outline`,onClick:()=>i(!1),disabled:r,children:t(`cancel`)}),(0,J.jsx)(s,{onClick:()=>void a({name:c,allAgents:u,inputs:f}),disabled:r||!c.trim(),children:t(r?`marketplaceInstalling`:`marketplaceInstall`)})]})]})}function ae(e){let{result:n,targetName:r,open:i,pending:a,onOpenChange:o}=e;return(0,J.jsx)(T,{open:i,onOpenChange:o,children:(0,J.jsxs)(S,{children:[(0,J.jsxs)(b,{children:[(0,J.jsx)(C,{children:t(`marketplaceMcpDoctorTitle`)}),(0,J.jsx)(w,{children:r??`-`})]}),a?(0,J.jsx)(`div`,{className:`text-sm text-gray-500`,children:t(`loading`)}):null,!a&&n?(0,J.jsxs)(`div`,{className:`space-y-3 text-sm text-gray-700`,children:[(0,J.jsxs)(`div`,{children:[t(`marketplaceMcpDoctorAccessible`),`:`,` `,n.accessible?t(`statusReady`):t(`marketplaceOperationFailed`)]}),(0,J.jsxs)(`div`,{children:[t(`marketplaceMcpDoctorTransport`),`:`,` `,n.transport.toUpperCase()]}),(0,J.jsxs)(`div`,{children:[t(`marketplaceMcpDoctorTools`),`: `,n.toolCount]}),n.error?(0,J.jsx)(j,{tone:`danger`,description:n.error,className:`rounded-lg`}):null]}):null]})})}function oe(e){let t=p({queryKey:[`marketplace-mcp-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>I({...e,page:t}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0,staleTime:15e3}),n=(0,F.useMemo)(()=>d(t.data),[t.data]);return{...t,data:n}}function se(){return u({queryKey:[`marketplace-mcp-installed`],queryFn:()=>L(),staleTime:1e4})}function ce(){let e=c();return y({mutationFn:z,onSuccess:n=>{e.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}),o.success(n.message||t(`marketplaceInstallSuccessMcp`))},onError:e=>{o.error(e.message||t(`marketplaceInstallFailed`))}})}function le(){let e=c();return y({mutationFn:B,onSuccess:n=>{e.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}),o.success(n.message||t(`marketplaceMcpManageSuccess`))},onError:e=>{o.error(e.message||t(`marketplaceOperationFailed`))}})}var ue=12;function Q(){let[e,n]=(0,F.useState)(`catalog`),[r,o]=(0,F.useState)(``),[s,c]=(0,F.useState)(``),[l,u]=(0,F.useState)(`relevance`),[d,f]=(0,F.useState)(null),[p,g]=(0,F.useState)(null),[b,x]=(0,F.useState)(null),{language:S}=M(),C=k(),{confirm:w,ConfirmDialog:T}=ne(),N=(0,F.useMemo)(()=>m(S),[S]);(0,F.useEffect)(()=>{let e=window.setTimeout(()=>{c(r.trim())},250);return()=>window.clearTimeout(e)},[r]);let P=oe({q:s||void 0,sort:l,pageSize:ue}),I=se(),{containerRef:L,sentinelRef:z}=v({disabled:e!==`catalog`||P.isError||!P.hasNextPage||P.isFetchingNextPage,onLoadMore:()=>P.fetchNextPage(),watchValue:`${e}:${s}:${l}:${P.data?.loadedItems??0}:${P.data?.loadedPages??0}`});(0,F.useEffect)(()=>{let e=L.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[L,s,e,l]);let B=ce(),V=le(),W=y({mutationFn:ie,onSuccess:(e,t)=>{g(t),x(e)}}),q=(0,F.useMemo)(()=>H(I.data?.records??[]),[I.data?.records]),Z=(0,F.useMemo)(()=>(I.data?.records??[]).filter(e=>{let t=[e.id??``,e.label??``,e.catalogSlug??``,e.description??``,e.descriptionZh??``].join(` `).toLowerCase();return s?t.includes(s.toLowerCase()):!0}),[I.data?.records,s]),Q=async(e,n)=>{let r=e?.name??n?.label??n?.id??`MCP`,i=K(N,e,n);if(!e){let e=G(r,JSON.stringify(n??{},null,2),t(`marketplaceInstalledLocalSummary`),n?.docsUrl,i);C.open(e,{newTab:!0,title:r,kind:`content`});return}try{let t=await R(e.slug),n=G(r,t.metadataRaw||JSON.stringify(e,null,2),t.bodyRaw||t.raw,t.sourceUrl,i);C.open(n,{newTab:!0,title:r,kind:`content`})}catch(e){let t=G(r,JSON.stringify({error:e instanceof Error?e.message:String(e)},null,2),i,void 0,i);C.open(t,{newTab:!0,title:r,kind:`content`})}},de=async e=>{d&&(await B.mutateAsync({spec:d.slug,name:e.name.trim(),allAgents:e.allAgents,inputs:e.inputs}),f(null))},$=async(e,n)=>{let r=n.id||n.spec;r&&(e===`remove`&&!await w({title:`${t(`marketplaceMcpRemoveTitle`)} ${r}?`,description:t(`marketplaceMcpRemoveDescription`),confirmLabel:t(`marketplaceMcpRemove`),variant:`destructive`})||await V.mutateAsync({action:e,id:r,spec:n.spec}))};return(0,J.jsxs)(i,{className:`flex h-full min-h-0 flex-col pb-0`,children:[(0,J.jsx)(a,{title:t(`marketplaceMcpPageTitle`),description:t(`marketplaceMcpPageDescription`)}),(0,J.jsx)(re,{tabs:[{id:`catalog`,label:t(`marketplaceMcpTabCatalog`)},{id:`installed`,label:t(`marketplaceMcpTabInstalled`),count:I.data?.total??0}],activeTab:e,onChange:e=>n(e),className:`mb-4`}),(0,J.jsxs)(`div`,{className:`mb-4 flex flex-col gap-3 md:flex-row md:items-center md:justify-between`,children:[(0,J.jsx)(A,{value:r,onChange:e=>o(e.target.value),placeholder:t(`marketplaceMcpSearchPlaceholder`),className:`md:max-w-sm`}),(0,J.jsxs)(O,{value:l,onValueChange:e=>u(e),children:[(0,J.jsx)(te,{className:`h-9 w-[180px] rounded-lg`,children:(0,J.jsx)(ee,{})}),(0,J.jsxs)(E,{children:[(0,J.jsx)(D,{value:`relevance`,children:t(`marketplaceSortRelevance`)}),(0,J.jsx)(D,{value:`updated`,children:t(`marketplaceSortUpdated`)})]})]})]}),(0,J.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-gray-900`,children:t(e===`catalog`?`marketplaceMcpSectionCatalog`:`marketplaceMcpSectionInstalled`)}),(0,J.jsx)(`span`,{className:`text-xs text-gray-500`,children:e===`catalog`?P.data?.total??0:I.data?.total??0})]}),(0,J.jsxs)(`div`,{ref:L,className:`min-h-0 flex-1 overflow-y-auto pr-1`,"aria-busy":P.isLoading||P.isFetchingNextPage,children:[(0,J.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 lg:grid-cols-2 2xl:grid-cols-3`,children:[e===`catalog`&&P.isLoading&&(0,J.jsx)(_,{count:6}),e===`catalog`&&!P.isLoading&&(P.data?.items??[]).map(e=>{let t=U(e,q);return(0,J.jsx)(Y,{item:e,record:t,localeFallbacks:N,onOpen:()=>void Q(e,t),onInstall:()=>f(e),onToggle:t?()=>void $(t.enabled===!1?`enable`:`disable`,t):void 0,onDoctor:t?()=>{g(t.id??null),x(null),W.mutateAsync(t.id??``)}:void 0,onRemove:t?()=>void $(`remove`,t):void 0},e.id)}),e===`installed`&&Z.map(e=>(0,J.jsx)(Y,{record:e,localeFallbacks:N,onOpen:()=>void Q(void 0,e),onToggle:()=>void $(e.enabled===!1?`enable`:`disable`,e),onDoctor:()=>{g(e.id??null),x(null),W.mutateAsync(e.id??``)},onRemove:()=>void $(`remove`,e)},e.id??e.spec))]}),e===`catalog`&&P.isError&&(0,J.jsx)(j,{tone:`danger`,title:t(`marketplaceMcpSectionCatalog`),description:P.error.message}),e===`installed`&&I.isError&&(0,J.jsx)(j,{tone:`danger`,title:t(`marketplaceMcpSectionInstalled`),description:I.error.message}),e===`catalog`&&!P.isLoading&&(P.data?.items?.length??0)===0&&(0,J.jsx)(`div`,{className:`py-8 text-center text-sm text-gray-500`,children:t(`marketplaceNoMcp`)}),e===`installed`&&Z.length===0&&(0,J.jsx)(`div`,{className:`py-8 text-center text-sm text-gray-500`,children:t(`marketplaceNoInstalledMcp`)}),e===`catalog`&&!P.isError&&(0,J.jsx)(h,{hasMore:!!P.hasNextPage,loading:P.isFetchingNextPage,sentinelRef:z})]})]}),(0,J.jsx)(X,{item:d,open:!!d,pending:B.isPending,onOpenChange:e=>!e&&f(null),onSubmit:de}),(0,J.jsx)(ae,{open:!!p,targetName:p,result:b,pending:W.isPending,onOpenChange:e=>!e&&g(null)}),(0,J.jsx)(T,{})]})}export{Q as McpMarketplacePage};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-CCiTGX8L.js";var t=e(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]);export{t};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-CCiTGX8L.js";var t=e(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]);export{t};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-CCiTGX8L.js";var t=e(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]);export{t};
@@ -1 +0,0 @@
1
- import{st as e}from"./index-lr6rQUSd.js";export{e as RemoteAccessPage};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-CCiTGX8L.js";var t=e(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]);export{t};
@@ -1 +0,0 @@
1
- import{_ as e,i as t,m as n,p as r}from"./i18n-DvzXOGQX.js";import{a as i,i as a,n as o,o as s}from"./dist-ZwoAXs46.js";import{J as c,X as l,Y as u,Z as d,_t as f,dt as p,ft as m,gt as h,mt as g,pt as _,q as v,ut as y}from"./index-lr6rQUSd.js";import{t as b}from"./switch-CBOzecWS.js";var x=e(n(),1),S=r(),C=8;function w(e){return e.trim().length>=C}function T(e,n){return e===n?!0:(o.error(t(`authPasswordMismatch`)),!1)}function E(){let e=v(),n=u(),r=l(),i=d(),a=c(),[o,C]=(0,x.useState)(``),[E,D]=(0,x.useState)(``),[O,k]=(0,x.useState)(``),[A,j]=(0,x.useState)(``),[M,N]=(0,x.useState)(``),P=e.data,F=o.trim().length>0&&w(E)&&E===O&&!n.isPending,I=w(A)&&A===M&&!i.isPending,L=async()=>{if(T(E,O))try{await n.mutateAsync({username:o.trim(),password:E}),D(``),k(``)}catch{}},R=async()=>{if(T(A,M))try{await i.mutateAsync({password:A}),j(``),N(``)}catch{}},z=async e=>{try{await r.mutateAsync({enabled:e})}catch{}},B=async()=>{try{await a.mutateAsync()}catch{}};return e.isLoading&&!P?(0,S.jsxs)(y,{children:[(0,S.jsxs)(_,{children:[(0,S.jsx)(g,{children:t(`authSecurityTitle`)}),(0,S.jsx)(m,{children:t(`authSecurityDescription`)})]}),(0,S.jsx)(p,{className:`text-sm text-gray-500`,children:t(`loading`)})]}):e.isError||!P?(0,S.jsxs)(y,{children:[(0,S.jsxs)(_,{children:[(0,S.jsx)(g,{children:t(`authSecurityTitle`)}),(0,S.jsx)(m,{children:t(`authSecurityDescription`)})]}),(0,S.jsxs)(p,{className:`space-y-4`,children:[(0,S.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`authStatusLoadFailed`)}),(0,S.jsx)(s,{variant:`outline`,onClick:()=>{e.refetch()},children:t(`authRetryStatus`)})]})]}):P.configured?(0,S.jsxs)(y,{children:[(0,S.jsxs)(_,{children:[(0,S.jsx)(g,{children:t(`authSecurityTitle`)}),(0,S.jsx)(m,{children:t(`authSecurityDescription`)})]}),(0,S.jsxs)(p,{className:`space-y-6`,children:[(0,S.jsxs)(`div`,{className:`rounded-xl border border-gray-200 p-4`,children:[(0,S.jsxs)(`div`,{className:`flex flex-col gap-4 md:flex-row md:items-start md:justify-between`,children:[(0,S.jsxs)(`div`,{className:`space-y-1`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:t(`authStatusLabel`)}),(0,S.jsx)(`p`,{className:`text-sm text-gray-600`,children:t(`authStatusConfiguredUser`).replace(`{username}`,P.username??``)}),(0,S.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`authUsernameFixedHelp`)})]}),(0,S.jsx)(`span`,{className:`inline-flex items-center rounded-full bg-gray-100 px-3 py-1 text-xs font-medium text-gray-700`,children:P.enabled?t(`enabled`):t(`disabled`)})]}),(0,S.jsxs)(`div`,{className:`mt-4 flex flex-col gap-4 border-t border-gray-200 pt-4 md:flex-row md:items-center md:justify-between`,children:[(0,S.jsxs)(`div`,{className:`space-y-1`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:t(`authEnableLabel`)}),(0,S.jsx)(`p`,{className:`text-xs text-gray-500`,children:P.enabled?t(`authEnableOnHelp`):t(`authEnableOffHelp`)})]}),(0,S.jsx)(b,{checked:P.enabled,disabled:r.isPending,onCheckedChange:e=>{z(e)}})]})]}),(0,S.jsxs)(`div`,{className:`rounded-xl border border-gray-200 p-4 space-y-4`,children:[(0,S.jsxs)(`div`,{className:`space-y-1`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:t(`authPasswordSectionTitle`)}),(0,S.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`authPasswordSectionDescription`)})]}),(0,S.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(h,{htmlFor:`auth-password-next`,children:t(`authPassword`)}),(0,S.jsx)(f,{id:`auth-password-next`,type:`password`,value:A,onChange:e=>j(e.target.value),placeholder:t(`authPasswordPlaceholder`)})]}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(h,{htmlFor:`auth-password-confirm`,children:t(`authConfirmPassword`)}),(0,S.jsx)(f,{id:`auth-password-confirm`,type:`password`,value:M,onChange:e=>N(e.target.value),placeholder:t(`authConfirmPasswordPlaceholder`)})]})]}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,S.jsx)(s,{type:`button`,disabled:!I,onClick:()=>void R(),children:i.isPending?t(`authPasswordUpdating`):t(`authPasswordAction`)}),P.enabled&&P.authenticated?(0,S.jsx)(s,{type:`button`,variant:`outline`,disabled:a.isPending,onClick:()=>void B(),children:a.isPending?t(`authLoggingOut`):t(`authLogoutAction`)}):null]}),(0,S.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`authSessionMemoryNotice`)})]})]})]}):(0,S.jsxs)(y,{children:[(0,S.jsxs)(_,{children:[(0,S.jsx)(g,{children:t(`authSecurityTitle`)}),(0,S.jsx)(m,{children:t(`authSecurityDescription`)})]}),(0,S.jsxs)(p,{className:`space-y-5`,children:[(0,S.jsxs)(`div`,{className:`rounded-xl border border-dashed border-gray-200 bg-gray-50/70 p-4`,children:[(0,S.jsx)(`p`,{className:`text-sm font-medium text-gray-900`,children:t(`authSetupTitle`)}),(0,S.jsx)(`p`,{className:`mt-1 text-sm text-gray-500`,children:t(`authSetupDescription`)})]}),(0,S.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(h,{htmlFor:`auth-setup-username`,children:t(`authUsername`)}),(0,S.jsx)(f,{id:`auth-setup-username`,value:o,onChange:e=>C(e.target.value),placeholder:t(`authUsernamePlaceholder`)})]}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(h,{htmlFor:`auth-setup-password`,children:t(`authPassword`)}),(0,S.jsx)(f,{id:`auth-setup-password`,type:`password`,value:E,onChange:e=>D(e.target.value),placeholder:t(`authPasswordPlaceholder`)})]})]}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsx)(h,{htmlFor:`auth-setup-confirm`,children:t(`authConfirmPassword`)}),(0,S.jsx)(f,{id:`auth-setup-confirm`,type:`password`,value:O,onChange:e=>k(e.target.value),placeholder:t(`authConfirmPasswordPlaceholder`)}),(0,S.jsx)(`p`,{className:`text-xs text-gray-500`,children:t(`authPasswordMinLengthHint`)})]}),(0,S.jsx)(s,{type:`button`,disabled:!F,onClick:()=>void L(),children:n.isPending?t(`authSettingUp`):t(`authSetupAction`)})]})]})}function D(){return(0,S.jsxs)(i,{className:`space-y-6`,children:[(0,S.jsx)(a,{title:t(`authSecurityTitle`),description:t(`authSecurityDescription`)}),(0,S.jsx)(E,{})]})}export{D as SecurityConfig};
@@ -1 +0,0 @@
1
- import{p as e,u as t}from"./i18n-DvzXOGQX.js";var n=e();function r({className:e,...r}){return(0,n.jsx)(`div`,{className:t(`animate-pulse rounded-md bg-slate-200`,e),...r})}export{r as t};
@@ -1 +0,0 @@
1
- import{_ as e,m as t,p as n,u as r}from"./i18n-DvzXOGQX.js";var i=e(t(),1),a=n(),o=i.forwardRef(({className:e,checked:t=!1,onCheckedChange:n,...i},o)=>(0,a.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,ref:o,className:r(`peer inline-flex h-[22px] w-10 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors duration-fast focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-gray-200/80 hover:bg-gray-300/80`,e),onClick:()=>n?.(!t),...i,children:(0,a.jsx)(`span`,{className:r(`pointer-events-none block h-5 w-5 rounded-full bg-white shadow-md ring-0 transition-transform duration-fast`,t?`translate-x-5`:`translate-x-0`)})}));o.displayName=`Switch`;export{o as t};
@@ -1 +0,0 @@
1
- import{_ as e,i as t,m as n,p as r}from"./i18n-DvzXOGQX.js";import{B as i,G as a,K as o,W as s,q as c}from"./client-CszWMVKi.js";import{t as l}from"./createLucideIcon-CCiTGX8L.js";import{a as u,i as d,n as f,r as p,t as m}from"./select-BILPf7zs.js";import{t as h}from"./skeleton-COKMAnJy.js";var g=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:o()})}getOptimisticResult(e){return e.behavior=o(),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:o,isError:c,isRefetchError:l}=r,u=n.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=i&&u===`forward`,p=c&&u===`backward`,m=i&&u===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:s(t,n.data),hasPreviousPage:a(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:o&&!f&&!m}}};function _(e,t){return i(e,g,t)}var v=l(`PackageSearch`,[[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}],[`circle`,{cx:`18.5`,cy:`15.5`,r:`2.5`,key:`b5zd12`}],[`path`,{d:`M20.27 17.27 22 19`,key:`1l4muz`}]]);function y(e){if(!e||e.pages.length===0)return;let t=e.pages.flatMap(e=>e.items);return{...e.pages[e.pages.length-1],items:t,pages:e.pages,loadedItems:t.length,loadedPages:e.pages.length}}var b=r();function x(e){return(0,b.jsx)(`div`,{className:`mb-4`,children:(0,b.jsxs)(`div`,{className:`flex gap-3 items-center`,children:[(0,b.jsxs)(`div`,{className:`flex-1 min-w-0 relative`,children:[(0,b.jsx)(v,{className:`h-4 w-4 text-gray-400 absolute left-3 top-1/2 -translate-y-1/2`}),(0,b.jsx)(`input`,{value:e.searchText,onChange:t=>e.onSearchTextChange(t.target.value),placeholder:e.searchPlaceholder,className:`w-full h-9 border border-gray-200/80 rounded-xl pl-9 pr-3 text-sm focus:outline-none focus:ring-1 focus:ring-primary/40`})]}),e.scope===`all`&&(0,b.jsxs)(m,{value:e.sort,onValueChange:t=>e.onSortChange(t),children:[(0,b.jsx)(d,{className:`h-9 w-[150px] shrink-0 rounded-lg`,children:(0,b.jsx)(u,{})}),(0,b.jsxs)(f,{children:[(0,b.jsx)(p,{value:`relevance`,children:t(`marketplaceSortRelevance`)}),(0,b.jsx)(p,{value:`updated`,children:t(`marketplaceSortUpdated`)})]})]})]})})}function S(e){return(0,b.jsx)(b.Fragment,{children:Array.from({length:e.count},(e,t)=>(0,b.jsx)(`article`,{className:`rounded-2xl border border-gray-200/40 bg-white px-5 py-4 shadow-sm`,children:(0,b.jsxs)(`div`,{className:`flex items-start gap-3.5 justify-between`,children:[(0,b.jsxs)(`div`,{className:`flex min-w-0 flex-1 gap-3`,children:[(0,b.jsx)(h,{className:`h-10 w-10 shrink-0 rounded-xl`}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2 pt-0.5`,children:[(0,b.jsx)(h,{className:`h-4 w-32 max-w-[70%]`}),(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(h,{className:`h-3 w-12`}),(0,b.jsx)(h,{className:`h-3 w-24`})]}),(0,b.jsx)(h,{className:`h-3 w-full`})]})]}),(0,b.jsx)(h,{className:`h-8 w-20 shrink-0 rounded-xl`})]})},`marketplace-skeleton-${t}`))})}function C(e){return!e.hasMore&&!e.loading?null:(0,b.jsxs)(`div`,{className:`py-4`,children:[e.hasMore&&(0,b.jsx)(`div`,{ref:e.sentinelRef,className:`h-1 w-full`,"aria-hidden":`true`}),e.loading&&(0,b.jsx)(`div`,{"data-testid":`marketplace-loading-more`,className:`pt-3 text-center text-xs text-gray-500`,children:t(`loading`)})]})}function w(e){let t=e.trim().toLowerCase().replace(/_/g,`-`),n=[t,t.split(`-`)[0],`en`];return Array.from(new Set(n.filter(Boolean)))}function T(e){return e.trim().toLowerCase().replace(/_/g,`-`)}function E(e,t,n){if(e){let t=Object.entries(e).map(([e,t])=>({locale:T(e),text:typeof t==`string`?t.trim():``})).filter(e=>e.text.length>0);if(t.length>0){let e=new Map(t.map(e=>[e.locale,e.text]));for(let t of n){let n=T(t),r=e.get(n);if(r)return r}for(let e of n){let n=T(e).split(`-`)[0];if(!n)continue;let r=t.find(e=>e.locale===n||e.locale.startsWith(`${n}-`));if(r)return r.text}return t[0]?.text??``}}return t?.trim()??``}function D(e,t){if(!e)return``;for(let n of t)if(T(n).split(`-`)[0]===`zh`&&e.descriptionZh?.trim())return e.descriptionZh.trim();return e.description?.trim()?e.description.trim():e.descriptionZh?.trim()?e.descriptionZh.trim():``}var O=e(n(),1),k=160;function A(e){let t=(0,O.useRef)(null),n=(0,O.useRef)(null),r=(0,O.useRef)(e.onLoadMore),i=(0,O.useRef)(!1);return(0,O.useEffect)(()=>{r.current=e.onLoadMore},[e.onLoadMore]),(0,O.useEffect)(()=>{e.disabled&&(i.current=!1)},[e.disabled]),(0,O.useEffect)(()=>{let a=t.current,o=n.current,s=e.thresholdPx??k;if(e.disabled||!a||!o)return;let c=()=>{i.current||e.disabled||(i.current=!0,Promise.resolve(r.current()).finally(()=>{i.current=!1}))},l=()=>{o.getBoundingClientRect().top-a.getBoundingClientRect().bottom<=s&&c()};if(typeof IntersectionObserver==`function`){let e=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&c()},{root:a,rootMargin:`0px 0px ${s}px 0px`});return e.observe(o),l(),()=>{e.disconnect()}}return a.addEventListener(`scroll`,l,{passive:!0}),l(),()=>{a.removeEventListener(`scroll`,l)}},[e.disabled,e.thresholdPx,e.watchValue]),{containerRef:t,sentinelRef:n}}export{x as a,y as c,E as i,_ as l,w as n,C as o,D as r,S as s,A as t};
@@ -1 +0,0 @@
1
- import{_ as e,m as t}from"./i18n-DvzXOGQX.js";import{$ as n,H as r,J as i,Q as a,U as o,X as s,Y as c,Z as l}from"./client-CszWMVKi.js";var u=class extends n{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),l(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&c(t.mutationKey)!==c(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??o();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){i.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},d=e(t(),1);function f(e,t){let n=r(t),[o]=d.useState(()=>new u(n,e));d.useEffect(()=>{o.setOptions(e)},[o,e]);let c=d.useSyncExternalStore(d.useCallback(e=>o.subscribe(i.batchCalls(e)),[o]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),l=d.useCallback((e,t)=>{o.mutate(e,t).catch(s)},[o]);if(c.error&&a(o.options.throwOnError,[c.error]))throw c.error;return{...c,mutate:l,mutateAsync:c.mutate}}export{f as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-CCiTGX8L.js";var t=e(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};