@xopcai/xopc 0.0.282 → 0.0.284

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 (184) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-iPtG94qr.js → activity-store-CwbIMGLY.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Cny5rATT.js → agent-avatar-dicebear-DjiOld-S.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-OyQ8OVZv.js → agent-defaults-settings-panel-D9qP10BK.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agents-DJeh_Ewo.js → agents-D-bkOuAl.js} +1 -1
  7. package/dist/gateway/static/root/assets/{api-KMJzMqvZ.js → api-3lphBVuY.js} +1 -1
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-ZqQKaZEI.js → app-management-settings-panel-B2nwCXxE.js} +1 -1
  9. package/dist/gateway/static/root/assets/{appearance-settings-CfXsQkKO.js → appearance-settings-BXO4Ej88.js} +1 -1
  10. package/dist/gateway/static/root/assets/{apps-page-k-QnVhKW.js → apps-page-BKwBBwJN.js} +1 -1
  11. package/dist/gateway/static/root/assets/{archive-plugin-BrW53Hap.js → archive-plugin-6ZRqNjla.js} +1 -1
  12. package/dist/gateway/static/root/assets/{attachment-load-DkfFWHiS.js → attachment-load-CmPZalcW.js} +1 -1
  13. package/dist/gateway/static/root/assets/{attachment-preview-renderer-CfEDFYPE.js → attachment-preview-renderer-wzIchDSv.js} +4 -4
  14. package/dist/gateway/static/root/assets/attachment-process-heavy-Db4nTY5N.js +5 -0
  15. package/dist/gateway/static/root/assets/{automations-page-e-5we6kD.js → automations-page-Bc3WbK5n.js} +1 -1
  16. package/dist/gateway/static/root/assets/{automations-workspace-DPnlkws1.js → automations-workspace-B2-f9qZu.js} +1 -1
  17. package/dist/gateway/static/root/assets/binary-plugins-OWR6cxpc.js +2 -0
  18. package/dist/gateway/static/root/assets/{block-editor-CfeF1OmA.js → block-editor-Ca-tDQXm.js} +1 -1
  19. package/dist/gateway/static/root/assets/{browser-automation-inputs-BTIufVbM.js → browser-automation-inputs-Dxy2_p3U.js} +1 -1
  20. package/dist/gateway/static/root/assets/{browser-automations-page-DnsuWKRu.js → browser-automations-page-CibQIxpi.js} +1 -1
  21. package/dist/gateway/static/root/assets/{browser-settings-page-C8xyhnxx.js → browser-settings-page-Dtn4rMeq.js} +1 -1
  22. package/dist/gateway/static/root/assets/{capabilities-settings-panel-CBllOLTT.js → capabilities-settings-panel-DiwtR9MD.js} +1 -1
  23. package/dist/gateway/static/root/assets/{channels-settings-C-A-VUE2.js → channels-settings-pTdR1q1K.js} +1 -1
  24. package/dist/gateway/static/root/assets/{channels-status-swr-DMYQNs-J.js → channels-status-swr-Bh-G9mdZ.js} +1 -1
  25. package/dist/gateway/static/root/assets/{chat-terminal-dock-C_Fw1R3A.js → chat-terminal-dock-lbzbSpV3.js} +1 -1
  26. package/dist/gateway/static/root/assets/{connectors-page-CtsMo3H4.js → connectors-page-BSQ7Hs2w.js} +1 -1
  27. package/dist/gateway/static/root/assets/{date-picker-CPFxjTrN.js → date-picker-tYvbTfZT.js} +1 -1
  28. package/dist/gateway/static/root/assets/{dependency-picker-C_5KqzjI.js → dependency-picker-B8yo7-7V.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-DLJsC5D6.js → desktop-pet-BUGkGB4-.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-BdI1iSgz.js → desktop-pet-settings-DNeVGZNp.js} +1 -1
  31. package/dist/gateway/static/root/assets/{device-pairing-wizard-BnvPLhc9.js → device-pairing-wizard-CYkT7ecp.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-debug-page-BNS_TkZQ.js → extension-debug-page-CiK0QI2p.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-page-DMSDZ7Mb.js → extension-page-CirPNHJd.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-settings-page-CeGCWMt0.js → extension-settings-page-Baua1_Le.js} +1 -1
  35. package/dist/gateway/static/root/assets/{gateway-config-swr-Cpmyrr6j.js → gateway-config-swr-Co4hHe0i.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-settings-DKOTYUma.js → gateway-settings-CzpSYWex.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-startup-retry-DoiPeb65.js → gateway-startup-retry-DBPNJG-e.js} +1 -1
  38. package/dist/gateway/static/root/assets/{heartbeat-settings-gsdL_Yij.js → heartbeat-settings-DTM_kYpE.js} +1 -1
  39. package/dist/gateway/static/root/assets/{home-page-CbeAdS1T.js → home-page-CSSJvdd6.js} +1 -1
  40. package/dist/gateway/static/root/assets/{image-generation-api-CqjHWl2T.js → image-generation-api-D0rMTumD.js} +1 -1
  41. package/dist/gateway/static/root/assets/imports-page-XqVVYbAp.js +1 -0
  42. package/dist/gateway/static/root/assets/{index-enFXJJCU.js → index-C9aQA4Dr.js} +10 -10
  43. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CCLtJ8s8.js → keyboard-shortcuts-settings-CMUaF61L.js} +1 -1
  44. package/dist/gateway/static/root/assets/{local-app-workbench-page-DzC6SrXj.js → local-app-workbench-page-CZSgTYuI.js} +1 -1
  45. package/dist/gateway/static/root/assets/{local-apps-page-3LdgP3NO.js → local-apps-page-CHxyT09t.js} +1 -1
  46. package/dist/gateway/static/root/assets/{locale-store-1urrBBCQ.js → locale-store-DO6JJ1l2.js} +1 -1
  47. package/dist/gateway/static/root/assets/{logs-page-DHClKtm6.js → logs-page-z5ktnEzX.js} +1 -1
  48. package/dist/gateway/static/root/assets/{management-settings-BaCo9Nuo.js → management-settings-jXbA2S54.js} +1 -1
  49. package/dist/gateway/static/root/assets/{markdown-view-BZmcFIWa.js → markdown-view-CKInRsDh.js} +1 -1
  50. package/dist/gateway/static/root/assets/{media-plugins-BMjJppvG.js → media-plugins-BaPkSvW7.js} +1 -1
  51. package/dist/gateway/static/root/assets/messages-BgZRsCkG.js +3 -0
  52. package/dist/gateway/static/root/assets/{note-detail-panel-hYO2jNhL.js → note-detail-panel-DSaZfkna.js} +3 -3
  53. package/dist/gateway/static/root/assets/{notes-page-BT66x22W.js → notes-page-CePEyv_C.js} +1 -1
  54. package/dist/gateway/static/root/assets/{page-tabs-BCszXX_F.js → page-tabs-CdYemUOu.js} +1 -1
  55. package/dist/gateway/static/root/assets/pdf-runtime-DU_sMPjG.js +2 -0
  56. package/dist/gateway/static/root/assets/pdf.worker.min-B4E34YdZ.js +48 -0
  57. package/dist/gateway/static/root/assets/{preview-open-alternatives-CyM0sanh.js → preview-open-alternatives-DzgF1yYO.js} +1 -1
  58. package/dist/gateway/static/root/assets/{proactive-page-CVDGA5sB.js → proactive-page-Cy2Gm2f8.js} +1 -1
  59. package/dist/gateway/static/root/assets/{product-open-page-lXAbj85Z.js → product-open-page-iQ-eW6Aj.js} +1 -1
  60. package/dist/gateway/static/root/assets/{project-detail-page-Bp6TAMPM.js → project-detail-page-BliwYpns.js} +1 -1
  61. package/dist/gateway/static/root/assets/{projects-page-UhOIiDcg.js → projects-page-Dm-BqnQn.js} +1 -1
  62. package/dist/gateway/static/root/assets/{registry-api-CxQstD00.js → registry-api-DMNudT60.js} +1 -1
  63. package/dist/gateway/static/root/assets/{remote-access-hub-DJIkMFT4.js → remote-access-hub-C_XuQ9XR.js} +1 -1
  64. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BUFCgRdZ.js → runtime-tools-settings-panel-u_wVepf7.js} +1 -1
  65. package/dist/gateway/static/root/assets/{schema-form-B01ksA8M.js → schema-form-YdZj2xdI.js} +1 -1
  66. package/dist/gateway/static/root/assets/{sessions-page-CQOAwPDt.js → sessions-page-Drt1aS2G.js} +1 -1
  67. package/dist/gateway/static/root/assets/settings-advanced-gate-BAUd06_9.js +1 -0
  68. package/dist/gateway/static/root/assets/{settings-form-section-DvnjZBa3.js → settings-form-section-Bw6xKOX5.js} +1 -1
  69. package/dist/gateway/static/root/assets/{settings-page-DZRkpbCh.js → settings-page-CV8kVdnE.js} +1 -1
  70. package/dist/gateway/static/root/assets/{setup-status-panel-DVaEiAVY.js → setup-status-panel-BHI9e5Tw.js} +1 -1
  71. package/dist/gateway/static/root/assets/share-preview-page-BHwjHlrV.js +2 -0
  72. package/dist/gateway/static/root/assets/{shares-settings-XiCqMDAe.js → shares-settings-DOAOjZBQ.js} +1 -1
  73. package/dist/gateway/static/root/assets/skill-reload-api-DU0VQpHj.js +1 -0
  74. package/dist/gateway/static/root/assets/skills-page-DRKdb6O5.js +2 -0
  75. package/dist/gateway/static/root/assets/{skills-page.utils-BryVNYll.js → skills-page.utils-DYfaLtts.js} +1 -1
  76. package/dist/gateway/static/root/assets/{system-settings-panel-mKFDe6aZ.js → system-settings-panel-CWrWpKV-.js} +1 -1
  77. package/dist/gateway/static/root/assets/{task-detail-page-Cb0RZNcJ.js → task-detail-page-DiPgMmBM.js} +1 -1
  78. package/dist/gateway/static/root/assets/{theme-store-Dc5s20V3.js → theme-store-CDc7Wqy5.js} +1 -1
  79. package/dist/gateway/static/root/assets/{tunnel-api-FcI3wKy3.js → tunnel-api-Bmsy-5Fs.js} +1 -1
  80. package/dist/gateway/static/root/assets/{use-autosave-CDgdtjTC.js → use-autosave-D-FRib85.js} +1 -1
  81. package/dist/gateway/static/root/assets/{user-model-page-Cnshc-Un.js → user-model-page-DxRaRdA0.js} +1 -1
  82. package/dist/gateway/static/root/assets/{voice-api-key-field-Ce8cb5mN.js → voice-api-key-field-iQ7EBzII.js} +1 -1
  83. package/dist/gateway/static/root/assets/{voice-config-api-Mk78BrpP.js → voice-config-api-DNMWA2tx.js} +1 -1
  84. package/dist/gateway/static/root/assets/{work-discovery-overlay-CacFTtXe.js → work-discovery-overlay-BesuhDlH.js} +1 -1
  85. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-V-5HuEUq.js → workflow-run-setup-panel-Du81FoCy.js} +1 -1
  86. package/dist/gateway/static/root/assets/{workflows-page-1OJimIfo.js → workflows-page-CZikdgNw.js} +1 -1
  87. package/dist/gateway/static/root/index.html +9 -9
  88. package/dist/package.js +1 -1
  89. package/dist/src/agent/agent-manager.js +4 -4
  90. package/dist/src/agent/background-review/run-background-review.js +1 -1
  91. package/dist/src/agent/embedded/model-runtime.js +1 -1
  92. package/dist/src/agent/embedded/run-for-session.js +1 -1
  93. package/dist/src/agent/image/tool-model-config.js +1 -1
  94. package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
  95. package/dist/src/agent/service.js +2 -2
  96. package/dist/src/agent/session/session-inspector.js +1 -1
  97. package/dist/src/agent/skills/hub-lock.js +1 -1
  98. package/dist/src/agent/tasks/task-judge-service.js +3 -3
  99. package/dist/src/agent/tools/xopc-use-tool.js +2 -2
  100. package/dist/src/ai-assist/text-assist.js +1 -1
  101. package/dist/src/auth/credentials.js +2 -2
  102. package/dist/src/auth/oauth/xopc-cloud.js +1 -1
  103. package/dist/src/auth/profiles/store.js +1 -1
  104. package/dist/src/auth/sync-provider-auth.js +2 -2
  105. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  106. package/dist/src/cli/command-loaders.js +1 -0
  107. package/dist/src/cli/command-manifest.js +4 -0
  108. package/dist/src/cli/commands/agent.js +2 -2
  109. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  110. package/dist/src/cli/commands/doctor/checks/provider-auth.js +3 -3
  111. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  112. package/dist/src/cli/commands/import.d.ts +2 -0
  113. package/dist/src/cli/commands/import.js +30 -0
  114. package/dist/src/cli/commands/models.js +2 -2
  115. package/dist/src/cli/commands/onboard.js +1 -1
  116. package/dist/src/cli/commands/platform.js +1 -1
  117. package/dist/src/cli/commands/profile.js +1 -1
  118. package/dist/src/cli/commands/tunnel.js +1 -1
  119. package/dist/src/cli/commands/update.js +1 -1
  120. package/dist/src/cli/extension-cli-register.js +1 -1
  121. package/dist/src/config/index.js +5 -5
  122. package/dist/src/config/loader.js +2 -2
  123. package/dist/src/config/models-json.js +1 -1
  124. package/dist/src/extensions/lockfile.js +1 -1
  125. package/dist/src/gateway/agents-admin.js +1 -1
  126. package/dist/src/gateway/file-path-classifier.js +1 -1
  127. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  128. package/dist/src/gateway/hono/routes/imports.d.ts +3 -0
  129. package/dist/src/gateway/hono/routes/imports.js +44 -0
  130. package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
  131. package/dist/src/gateway/hono/routes/models.js +1 -1
  132. package/dist/src/gateway/hono/routes/workflows.js +2 -2
  133. package/dist/src/gateway/run-loop.js +1 -1
  134. package/dist/src/gateway/service/config-coordinator.js +1 -1
  135. package/dist/src/gateway/service.js +9 -7
  136. package/dist/src/imports/compatibility.d.ts +7 -0
  137. package/dist/src/imports/compatibility.js +174 -0
  138. package/dist/src/imports/contextImport.d.ts +3 -0
  139. package/dist/src/imports/contextImport.js +56 -0
  140. package/dist/src/imports/files.d.ts +13 -0
  141. package/dist/src/imports/files.js +77 -0
  142. package/dist/src/imports/importService.d.ts +45 -0
  143. package/dist/src/imports/importService.js +417 -0
  144. package/dist/src/imports/planner.d.ts +11 -0
  145. package/dist/src/imports/planner.js +98 -0
  146. package/dist/src/imports/productImport.d.ts +10 -0
  147. package/dist/src/imports/productImport.js +148 -0
  148. package/dist/src/imports/runtime.d.ts +5 -0
  149. package/dist/src/imports/runtime.js +56 -0
  150. package/dist/src/imports/scanner.d.ts +14 -0
  151. package/dist/src/imports/scanner.js +159 -0
  152. package/dist/src/imports/secrets.d.ts +2 -0
  153. package/dist/src/imports/secrets.js +9 -0
  154. package/dist/src/imports/sources.d.ts +37 -0
  155. package/dist/src/imports/sources.js +75 -0
  156. package/dist/src/imports/types.d.ts +91 -0
  157. package/dist/src/imports/types.js +11 -0
  158. package/dist/src/knowledge-memory/repository.js +4 -2
  159. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  160. package/dist/src/providers/index.js +2 -2
  161. package/dist/src/providers/model-registry.js +1 -1
  162. package/dist/src/providers/register-runtime-providers.js +1 -1
  163. package/dist/src/storage/sqlite/import-repository.d.ts +19 -0
  164. package/dist/src/storage/sqlite/import-repository.js +35 -0
  165. package/dist/src/storage/sqlite/migrations/174_capability_imports.sql +11 -0
  166. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  167. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  168. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  169. package/dist/src/storage/sqlite/schema.js +1 -1
  170. package/dist/src/tasks/home-query-service.js +2 -2
  171. package/dist/src/tui/tui-startup-resources.js +1 -1
  172. package/dist/src/tui/tui.js +1 -1
  173. package/dist/src/work-discovery/service.js +2 -2
  174. package/dist/src/workflows/service/workflow-run-service.js +2 -2
  175. package/package.json +4 -3
  176. package/dist/gateway/static/root/assets/attachment-process-heavy-C5CqLCsX.js +0 -5
  177. package/dist/gateway/static/root/assets/binary-plugins-CWIswfXA.js +0 -2
  178. package/dist/gateway/static/root/assets/excel-worksheet-utils-DpdB-DjU.js +0 -1
  179. package/dist/gateway/static/root/assets/messages-DYFcjtmG.js +0 -3
  180. package/dist/gateway/static/root/assets/pdf.worker.min-CHFwMXne.mjs +0 -29
  181. package/dist/gateway/static/root/assets/settings-advanced-gate-CFuqbGI-.js +0 -1
  182. package/dist/gateway/static/root/assets/share-preview-page-vz0UK56q.js +0 -2
  183. package/dist/gateway/static/root/assets/skill-reload-api-C3D8WanU.js +0 -1
  184. package/dist/gateway/static/root/assets/skills-page-CxMWwR6A.js +0 -2
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{h as i,t as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./external-link-DjqjBmc3.js";import{t as c}from"./markdown-view-BZmcFIWa.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./cn-JdwAhgNB.js";import{a as p,c as m,i as h,n as g,r as _}from"./locale-store-1urrBBCQ.js";import{t as v}from"./messages-DYFcjtmG.js";import{a as y,i as b,o as x,r as S,s as C,t as w}from"./dist-BGTk37IG.js";import{a as T,i as E}from"./vendor-swr-BIWyz7Rc.js";import{t as D}from"./button-BA45yciM.js";import{t as O}from"./skeleton-BwbyijEw.js";import{$s as k,Bu as ee,Ja as A,Ka as j,Ou as M,Qs as te,Xa as N,Ya as P,Za as F,bc as I,eo as L,go as R,na as z,qc as B,vc as ne,vu as V,wc as H}from"./index-enFXJJCU.js";import{t as U}from"./page-tabs-BCszXX_F.js";var W=e(t(),1),G=n();function K(e){return e===`builtin`||e===`user`?e:`marketplace`}async function q(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function re(e){let t=await h(_(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await q(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function J(e){let t=await h(_(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await q(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function Y(e){let t=await h(_(`/api/extensions/bundled/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e.extensionId.trim(),enabled:e.enabled})});if(!t.ok)throw Error(await q(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function X(e){let t=await h(_(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await q(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var Z=r();function ie(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var Q={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function $({className:e}){let t=v(g(e=>e.language)).extensionsPage,n=m(e=>!!e.sessionKey),r=A(),{mutate:i}=T(),[a,o]=(0,W.useReducer)(z,Q),{q:s,debounced:c,detailPkg:u,rowBusy:d,actionError:h,restartHint:y}=a,b=n?`marketplace-${c}`:null;(0,W.useEffect)(()=>{let e=window.setTimeout(()=>o({type:`patch`,patch:{debounced:s.trim()}}),300);return()=>window.clearTimeout(e)},[s]);let{data:x,isLoading:S,error:C}=E(b,async()=>p(c.length>0?_(`/api/marketplace?q=${encodeURIComponent(c)}`):_(`/api/marketplace`)),{revalidateOnFocus:!1}),w=(0,W.useCallback)(()=>{i(`gateway-extensions-list`),L()},[i]),D=(0,W.useCallback)(async(e,n)=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await J({name:e,overwrite:n});w(),r.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceInstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceInstallFailed,t.marketplaceRestartHint,w]),ee=(0,W.useCallback)(async e=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await X(e);w(),n.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceUninstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceRestartHint,t.marketplaceUninstallFailed,w]),j=x?.extensions??[];return(0,Z.jsxs)(`div`,{className:f(`flex flex-col gap-4`,e),children:[(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(H,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`search`,value:s,onChange:e=>o({type:`patch`,patch:{q:e.target.value}}),placeholder:t.marketplaceSearchPlaceholder,className:`ui-input h-10 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted`})]}),C?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:C instanceof Error?C.message:t.marketplaceLoadFailed}):null,h?(0,Z.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:h}):null,y?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:y}):null,S&&!x?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":t.marketplaceLoading,children:[0,1,2].map(e=>(0,Z.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,Z.jsx)(O,{className:`h-5 w-40`}),(0,Z.jsx)(O,{className:`h-4 w-full max-w-xl`}),(0,Z.jsx)(O,{className:`h-4 w-2/3 max-w-md`})]}),(0,Z.jsx)(O,{className:`h-8 w-20`})]})},e))}):(0,Z.jsx)(`ul`,{className:`flex flex-col gap-3`,children:j.length===0?(0,Z.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):j.map(e=>{let n=ie(r,e.id),i=d===e.id;return(0,Z.jsx)(`li`,{className:`list-none`,children:(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${t.marketplaceDetailTitle}`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),o({type:`patch`,patch:{detailPkg:e.id}}))},className:f(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl bg-surface-panel p-4 text-left shadow-surface`,`transition-[transform,background-color,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,Z.jsx)(V,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,Z.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,Z.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,Z.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,Z.jsx)(B,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,Z.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:n===`bundled`?(0,Z.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.marketplaceBuiltin}):n===`user`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,Z.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&ee(e.id).catch(()=>{})},className:f(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[i?(0,Z.jsx)(l,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,Z.jsx)(k,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,Z.jsx)(`button`,{type:`button`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),className:f(`inline-flex w-full items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:t.marketplaceReview})})]})},e.id)})}),u?(0,Z.jsx)(ae,{packageName:u,copy:t,extensions:r,onClose:()=>o({type:`patch`,patch:{detailPkg:null}}),onInstall:D,onUninstall:ee}):null]})}function ae(e){let t=(0,G.c)(102),{packageName:n,copy:r,extensions:i,onClose:o,onInstall:s,onUninstall:u}=e,[p,h]=(0,W.useState)(!1),[g,_]=(0,W.useState)(!1),v=m(ue)?`ext-mp-detail-${n}`:null,b;t[0]===n?b=t[1]:(b=async()=>re(n),t[0]=n,t[1]=b);let T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T={revalidateOnFocus:!1},t[2]=T):T=t[2];let{data:D,error:A,isLoading:j}=E(v,b,T),M;t[3]!==i||t[4]!==n?(M=ie(i,n),t[3]=i,t[4]=n,t[5]=M):M=t[5];let N=M,P=N===`user`,F=D?.manifest?.permissions,I,L,R,z,B,V,H,U,K,q,J;if(t[6]!==r.detailBack||t[7]!==r.detailClose||t[8]!==r.marketplaceAuthor||t[9]!==r.marketplaceCodeRisk||t[10]!==r.marketplaceDependencies||t[11]!==r.marketplaceDetailLoadFailed||t[12]!==r.marketplaceDetailReadmeHeading||t[13]!==r.marketplaceDetailTitle||t[14]!==r.marketplaceDownloads||t[15]!==r.marketplaceIntegrity||t[16]!==r.marketplaceIntegrityVerified||t[17]!==r.marketplaceLifecycleScripts||t[18]!==r.marketplaceLoadFailed||t[19]!==r.marketplaceLoading||t[20]!==r.marketplaceNoReadme||t[21]!==r.marketplacePermissions||t[22]!==r.marketplacePermissionsNone||t[23]!==r.marketplaceRiskConfirm||t[24]!==r.marketplaceRiskTitle||t[25]!==r.marketplaceUnavailableBody||t[26]!==r.marketplaceUnavailableTitle||t[27]!==r.marketplaceVersion||t[28]!==D||t[29]!==A||t[30]!==N||t[31]!==j||t[32]!==o||t[33]!==F||t[34]!==g){let e=F&&typeof F==`object`&&!Array.isArray(F)?Object.entries(F):[],n;t[46]!==r.marketplaceNoReadme||t[47]!==D?(n=D?.readme?.trim()||(D?.description?.trim()?`### ${D.name}\n\n${D.description}`:`*${r.marketplaceNoReadme}*`),t[46]=r.marketplaceNoReadme,t[47]=D,t[48]=n):n=t[48];let i=n;R=w,z=!0,t[49]===o?B=t[50]:(B=e=>!e&&o(),t[49]=o,t[50]=B),L=x,t[51]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[51]=J):J=t[51],I=S,U=`fixed left-1/2 top-1/2 z-[131] flex h-[min(44rem,calc(100vh-1.5rem))] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,K=le;let a;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(ee,{className:`size-5`}),t[52]=a):a=t[52];let s;t[53]!==r.detailBack||t[54]!==o?(s=(0,Z.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailBack,children:a}),t[53]=r.detailBack,t[54]=o,t[55]=s):s=t[55];let l;t[56]===r.marketplaceDetailTitle?l=t[57]:(l=(0,Z.jsx)(C,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[56]=r.marketplaceDetailTitle,t[57]=l);let u;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(d,{className:`size-5`}),t[58]=u):u=t[58];let f;t[59]!==r.detailClose||t[60]!==o?(f=(0,Z.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailClose,children:u}),t[59]=r.detailClose,t[60]=o,t[61]=f):f=t[61],t[62]!==s||t[63]!==l||t[64]!==f?(q=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[s,l,f]}),t[62]=s,t[63]=l,t[64]=f,t[65]=q):q=t[65],V=`min-h-0 flex-1 overflow-y-auto p-5`,H=j&&!D?(0,Z.jsxs)(`div`,{className:`space-y-4`,"aria-label":r.marketplaceLoading,children:[(0,Z.jsx)(O,{className:`h-6 w-48`}),(0,Z.jsx)(O,{className:`h-4 w-28`}),(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsx)(O,{className:`h-12`}),(0,Z.jsx)(O,{className:`h-12`})]}),(0,Z.jsx)(O,{className:`h-28 w-full`}),(0,Z.jsx)(O,{className:`h-36 w-full`})]}):A?(0,Z.jsxs)(`div`,{className:`rounded-lg border border-red-300/70 bg-red-50 p-4 text-sm dark:border-red-900 dark:bg-red-950/30`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:r.marketplaceDetailLoadFailed}),(0,Z.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:A instanceof Error?A.message:r.marketplaceLoadFailed})]}):D?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:D.name}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,Z.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:D.id})}),(0,Z.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,Z.jsx)(`dd`,{children:D.author.username})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,Z.jsx)(`dd`,{children:D.latestVersion.version})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,Z.jsx)(`dd`,{children:D.downloads})]})]}),N===`bundled`?null:(0,Z.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[D.installability.available?(0,Z.jsx)(ne,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,Z.jsx)(te,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:D.installability.available?r.marketplaceRiskTitle:r.marketplaceUnavailableTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:D.installability.available?r.marketplaceCodeRisk:D.installability.reason??r.marketplaceUnavailableBody})]})]}),D.installability.available?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceIntegrity}),(0,Z.jsx)(`dd`,{children:r.marketplaceIntegrityVerified})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDependencies}),(0,Z.jsx)(`dd`,{children:D.packageSummary?.dependencyCount??0})]})]}),(0,Z.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-fg`,children:r.marketplacePermissions}),e.length>0?(0,Z.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(ce)}):(0,Z.jsx)(`p`,{className:`mt-1`,children:r.marketplacePermissionsNone})]}),(D.packageSummary?.lifecycleScripts.length??0)>0?(0,Z.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[r.marketplaceLifecycleScripts,`: `,D.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:g,onChange:e=>_(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,Z.jsx)(`span`,{children:r.marketplaceRiskConfirm})]})]}):null]}),D.readme?.trim()?(0,Z.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,Z.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,Z.jsx)(c,{content:i})})]}):null,t[6]=r.detailBack,t[7]=r.detailClose,t[8]=r.marketplaceAuthor,t[9]=r.marketplaceCodeRisk,t[10]=r.marketplaceDependencies,t[11]=r.marketplaceDetailLoadFailed,t[12]=r.marketplaceDetailReadmeHeading,t[13]=r.marketplaceDetailTitle,t[14]=r.marketplaceDownloads,t[15]=r.marketplaceIntegrity,t[16]=r.marketplaceIntegrityVerified,t[17]=r.marketplaceLifecycleScripts,t[18]=r.marketplaceLoadFailed,t[19]=r.marketplaceLoading,t[20]=r.marketplaceNoReadme,t[21]=r.marketplacePermissions,t[22]=r.marketplacePermissionsNone,t[23]=r.marketplaceRiskConfirm,t[24]=r.marketplaceRiskTitle,t[25]=r.marketplaceUnavailableBody,t[26]=r.marketplaceUnavailableTitle,t[27]=r.marketplaceVersion,t[28]=D,t[29]=A,t[30]=N,t[31]=j,t[32]=o,t[33]=F,t[34]=g,t[35]=I,t[36]=L,t[37]=R,t[38]=z,t[39]=B,t[40]=V,t[41]=H,t[42]=U,t[43]=K,t[44]=q,t[45]=J}else I=t[35],L=t[36],R=t[37],z=t[38],B=t[39],V=t[40],H=t[41],U=t[42],K=t[43],q=t[44],J=t[45];let Y;t[66]!==V||t[67]!==H?(Y=(0,Z.jsx)(`div`,{className:V,children:H}),t[66]=V,t[67]=H,t[68]=Y):Y=t[68];let X;t[69]!==p||t[70]!==r.marketplaceBuiltinGoBuiltin||t[71]!==r.marketplaceBuiltinManageHint||t[72]!==r.marketplaceInstall||t[73]!==r.marketplaceReinstall||t[74]!==r.marketplaceReinstallConfirm||t[75]!==r.marketplaceUninstall||t[76]!==r.marketplaceUninstallConfirm||t[77]!==D||t[78]!==N||t[79]!==o||t[80]!==s||t[81]!==u||t[82]!==n||t[83]!==g||t[84]!==P?(X=D?(0,Z.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:N===`bundled`?(0,Z.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,Z.jsx)(a,{to:`/extensions?tab=builtin`,onClick:o,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.marketplaceBuiltinGoBuiltin})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,disabled:p||!D.installability.available||!g,onClick:()=>{P&&!window.confirm(r.marketplaceReinstallConfirm)||(h(!0),s(n,P).catch(se).finally(()=>h(!1)))},className:f(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-white shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[p?(0,Z.jsx)(l,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,P?r.marketplaceReinstall:r.marketplaceInstall]}),P?(0,Z.jsxs)(`button`,{type:`button`,disabled:p,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(h(!0),u(n).then(()=>o()).catch(oe).finally(()=>h(!1)))},className:f(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,Z.jsx)(k,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[69]=p,t[70]=r.marketplaceBuiltinGoBuiltin,t[71]=r.marketplaceBuiltinManageHint,t[72]=r.marketplaceInstall,t[73]=r.marketplaceReinstall,t[74]=r.marketplaceReinstallConfirm,t[75]=r.marketplaceUninstall,t[76]=r.marketplaceUninstallConfirm,t[77]=D,t[78]=N,t[79]=o,t[80]=s,t[81]=u,t[82]=n,t[83]=g,t[84]=P,t[85]=X):X=t[85];let Q;t[86]!==I||t[87]!==Y||t[88]!==X||t[89]!==U||t[90]!==K||t[91]!==q?(Q=(0,Z.jsxs)(I,{className:U,onOpenAutoFocus:K,children:[q,Y,X]}),t[86]=I,t[87]=Y,t[88]=X,t[89]=U,t[90]=K,t[91]=q,t[92]=Q):Q=t[92];let $;t[93]!==L||t[94]!==Q||t[95]!==J?($=(0,Z.jsxs)(L,{children:[J,Q]}),t[93]=L,t[94]=Q,t[95]=J,t[96]=$):$=t[96];let ae;return t[97]!==R||t[98]!==z||t[99]!==B||t[100]!==$?(ae=(0,Z.jsx)(R,{defaultOpen:z,onOpenChange:B,children:$}),t[97]=R,t[98]=z,t[99]=B,t[100]=$,t[101]=ae):ae=t[101],ae}function oe(){}function se(){}function ce(e){let[t,n]=e;return(0,Z.jsxs)(`li`,{className:`break-words`,children:[(0,Z.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function le(e){return e.preventDefault()}function ue(e){return!!e.sessionKey}function de(){let e=g(e=>e.language),t=v(e),n=R(e=>e.setPageHeader),r=R(e=>e.clearPageHeader),o=A(),s=P(),[c,l]=i(),d=K(c.get(`tab`)),f=c.get(`q`)??``,[p,m]=(0,W.useState)(d),[h,_]=(0,W.useState)(f),[y,b]=(0,W.useState)(null),x=c.toString(),S=(0,W.useRef)(x);if(S.current!==x){S.current=x;let e=K(c.get(`tab`)),t=c.get(`q`)??``;m(t=>t===e?t:e),_(e=>e===t?e:t)}(0,W.useEffect)(()=>{l(e=>{let t=new URLSearchParams(e),n=h.trim();return n?t.set(`q`,n):t.delete(`q`),p===`marketplace`?t.delete(`tab`):t.set(`tab`,p),t.toString()===e.toString()?e:t},{replace:!0})},[p,h,l]);let C=(0,W.useMemo)(()=>o.filter(e=>e.source===`bundled`),[o]),w=(0,W.useMemo)(()=>o.filter(e=>e.source!==`bundled`),[o]),T=p===`builtin`?C:w,E=(0,W.useMemo)(()=>{let t=h.trim().toLowerCase(),n=T;return t&&(n=n.filter(e=>(e.name??``).toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t))),n.toSorted((t,n)=>t.hasUi===n.hasUi?(t.name||t.id).localeCompare(n.name||n.id,e):t.hasUi?-1:1)},[T,h,e]);if((0,W.useEffect)(()=>{b(e=>{if(!e)return e;let t=o.find(t=>t.id===e.id);return t?fe(e)===fe(t)&&e.active===t.active?e:t:null})},[o]),(0,W.useLayoutEffect)(()=>(n({startExtra:null,main:(0,Z.jsx)(`div`,{className:`min-w-0`,children:(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.extensionsPage.title})}),end:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(D,{asChild:!0,variant:`secondary`,className:`h-9`,children:(0,Z.jsxs)(a,{to:`/local-apps`,"aria-label":t.extensionsPage.openLocalApps,title:t.extensionsPage.openLocalApps,children:[(0,Z.jsx)(M,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`hidden sm:inline`,children:t.extensionsPage.openLocalApps})]})}),(0,Z.jsx)(D,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,Z.jsxs)(a,{to:`/local-apps/new`,children:[(0,Z.jsx)(u,{className:`size-4`}),t.extensionsPage.createLocalApp]})})]})}),()=>r()),[r,t.extensionsPage.createLocalApp,t.extensionsPage.openLocalApps,t.extensionsPage.title,n]),s&&p!==`marketplace`)return(0,Z.jsx)(ye,{});let O=p!==`marketplace`&&T.length>0;return(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,Z.jsxs)(`div`,{className:`mx-auto w-full max-w-7xl px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(0,Z.jsxs)(`div`,{className:`mb-6 flex flex-col gap-3 border-b border-edge-subtle pb-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Z.jsx)(U,{items:[{id:`marketplace`,label:t.extensionsPage.tabMarketplace},{id:`builtin`,label:t.extensionsPage.tabBuiltin,count:C.length},{id:`user`,label:t.extensionsPage.tabUser,count:w.length}],activeTab:p,onChange:m,ariaLabel:t.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`}),O?(0,Z.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,Z.jsx)(H,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`search`,value:h,onChange:e=>_(e.target.value),placeholder:t.extensionsPage.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,autoComplete:`off`})]}):null]}),p===`marketplace`?(0,Z.jsx)($,{}):p===`builtin`&&C.length===0?(0,Z.jsx)(xe,{message:t.extensionsPage.emptyBuiltin}):p===`user`&&w.length===0?(0,Z.jsx)(xe,{message:t.extensionsPage.emptyUser}):E.length===0?(0,Z.jsx)(`p`,{className:`px-3 py-14 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:t.extensionsPage.noSearchResults}):(0,Z.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:E.map(e=>(0,Z.jsx)(ge,{extension:e,copy:t.extensionsPage,showSourceBadge:p===`user`,onOpen:()=>b(e)},e.id))})]}),y?(0,Z.jsx)(_e,{extension:y,copy:t.extensionsPage,onClose:()=>b(null)},y.id):null]})}function fe(e){return e.activationEligible??e.active}function pe(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function me(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function he(e,t){let n=fe(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function ge(e){let t=(0,G.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,s;t[0]===n?s=t[1]:(s=fe(n),t[0]=n,t[1]=s);let c=s,l=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=f(`group flex w-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=d):d=t[2];let p=n.name||n.id,m;t[3]===p?m=t[4]:(m=p.charAt(0).toUpperCase(),t[3]=p,t[4]=m);let h;t[5]===m?h=t[6]:(h=(0,Z.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:m}),t[5]=m,t[6]=h);let g;t[7]===n.name?g=t[8]:(g=(0,Z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=g);let _;t[9]===n.version?_=t[10]:(_=n.version?(0,Z.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=_);let v;t[11]!==g||t[12]!==_?(v=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[g,_]}),t[11]=g,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==r.statusEnabled||t[15]!==c?(y=c?(0,Z.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,Z.jsx)(o,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,Z.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,Z.jsx)(u,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=c,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==y?(b=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[v,y]}),t[17]=v,t[18]=y,t[19]=b):b=t[19];let x;t[20]!==r.cardNoDescription||t[21]!==n.description?(x=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=x):x=t[22];let S;t[23]===x?S=t[24]:(S=(0,Z.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:x}),t[23]=x,t[24]=S);let C=n.hasUi?r.badgeKindUi:r.badgeKindBackend,w;t[25]!==C||t[26]!==l?(w=(0,Z.jsx)(`span`,{title:l,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:C}),t[25]=C,t[26]=l,t[27]=w):w=t[27];let T;t[28]!==r||t[29]!==n||t[30]!==i?(T=n.source===`bundled`?(0,Z.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):i?(0,Z.jsx)(`span`,{title:pe(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:me(n,r)}):null,t[28]=r,t[29]=n,t[30]=i,t[31]=T):T=t[31];let E;t[32]!==w||t[33]!==T?(E=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[w,T]}),t[32]=w,t[33]=T,t[34]=E):E=t[34];let D;t[35]!==b||t[36]!==S||t[37]!==E?(D=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,S,E]}),t[35]=b,t[36]=S,t[37]=E,t[38]=D):D=t[38];let O;t[39]!==D||t[40]!==h?(O=(0,Z.jsxs)(`div`,{className:`flex gap-3`,children:[h,D]}),t[39]=D,t[40]=h,t[41]=O):O=t[41];let k;return t[42]!==a||t[43]!==O?(k=(0,Z.jsx)(`button`,{type:`button`,onClick:a,className:d,children:O}),t[42]=a,t[43]=O,t[44]=k):k=t[44],k}function _e({extension:e,copy:t,onClose:n}){let{mutate:r}=T(),[i,o]=(0,W.useState)(!1),[c,u]=(0,W.useState)(null),[p,m]=(0,W.useState)(!1),h=e.activationEligible===!0,g=(0,W.useCallback)(async()=>{if(e.source===`bundled`){u(null),m(!1),o(!0);try{let{requiresGatewayRestart:t}=await Y({extensionId:e.id,enabled:!h});await r(`gateway-extensions-list`),L(),m(t)}catch(e){u(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[h,t.builtinToggleFailed,e.id,e.source,r]),_=e.ui?.contributions?.pages??[],v=e.ui?.contributions?.settingsPanels??[],E=e.ui?.contributions?.chatWidgets??[],O=e.ui?.contributions?.sidebarPanels??[],k=_.find(e=>e.showInNav)??_[0],A=v[0],M=k?j(e.id,k):null,te=A?`/settings/ext/${e.id}/${A.id}`:e.hasConfigSchema||N(e)?`/settings/ext/${e.id}`:null;return(0,Z.jsx)(w,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,Z.jsxs)(x,{children:[(0,Z.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,Z.jsxs)(S,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailBack,children:(0,Z.jsx)(ee,{className:`size-5`})}),(0,Z.jsx)(C,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,Z.jsxs)(b,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,Z.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailClose,children:(0,Z.jsx)(d,{className:`size-5`})})]}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Z.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,Z.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,pe(e,t)]}),e.version?(0,Z.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,Z.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:he(e,t)}),e.source===`bundled`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.builtinConfigHint}),(0,Z.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,Z.jsx)(D,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void g(),className:`shrink-0 py-1.5 text-xs`,children:i?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(l,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):h?t.builtinToggleDisable:t.builtinToggleEnable})]}),c?(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:c}):null,p?(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,Z.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.cliManageHint}),e.hasUi&&(_.length>0||v.length>0||E.length>0)?(0,Z.jsxs)(`section`,{className:`mt-8`,children:[(0,Z.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,Z.jsx)(ve,{template:t.badgePages,count:_.length,hidden:_.length===0}),(0,Z.jsx)(ve,{template:t.badgeSettings,count:v.length,hidden:v.length===0}),(0,Z.jsx)(ve,{template:t.badgeWidgets,count:E.length,hidden:E.length===0}),(0,Z.jsx)(ve,{template:t.badgeSidebar,count:O.length,hidden:O.length===0})]})]}):null,F(e)&&(M||te)?(0,Z.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[M?(0,Z.jsxs)(a,{to:M,onClick:n,className:f(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,Z.jsx)(s,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,te?(0,Z.jsxs)(a,{to:te,onClick:n,className:f(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,Z.jsx)(I,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,Z.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function ve(e){let t=(0,G.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,Z.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function ye(){let e=(0,G.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,Z.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,Z.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,Z.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,Z.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(be)})]})}),e[4]=a):a=e[4],a}function be(e){return(0,Z.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge-subtle bg-surface-base shadow-surface`},e)}function xe(e){let t=(0,G.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center rounded-xl border border-edge-subtle bg-surface-base px-4 py-12 text-center shadow-surface`,children:(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{de as ExtensionsPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{h as i,t as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./external-link-DjqjBmc3.js";import{t as c}from"./markdown-view-CKInRsDh.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./cn-JdwAhgNB.js";import{a as p,c as m,i as h,n as g,r as _}from"./locale-store-DO6JJ1l2.js";import{t as v}from"./messages-BgZRsCkG.js";import{a as y,i as b,o as x,r as S,s as C,t as w}from"./dist-BGTk37IG.js";import{a as T,i as E}from"./vendor-swr-BIWyz7Rc.js";import{t as D}from"./button-BA45yciM.js";import{t as O}from"./skeleton-BwbyijEw.js";import{$s as k,Bu as ee,Ja as A,Ka as j,Ou as M,Qs as te,Xa as N,Ya as P,Za as F,bc as I,eo as L,go as R,na as z,qc as B,vc as ne,vu as V,wc as H}from"./index-C9aQA4Dr.js";import{t as U}from"./page-tabs-CdYemUOu.js";var W=e(t(),1),G=n();function K(e){return e===`builtin`||e===`user`?e:`marketplace`}async function q(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function re(e){let t=await h(_(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await q(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function J(e){let t=await h(_(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await q(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function Y(e){let t=await h(_(`/api/extensions/bundled/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e.extensionId.trim(),enabled:e.enabled})});if(!t.ok)throw Error(await q(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function X(e){let t=await h(_(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await q(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var Z=r();function ie(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var Q={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function $({className:e}){let t=v(g(e=>e.language)).extensionsPage,n=m(e=>!!e.sessionKey),r=A(),{mutate:i}=T(),[a,o]=(0,W.useReducer)(z,Q),{q:s,debounced:c,detailPkg:u,rowBusy:d,actionError:h,restartHint:y}=a,b=n?`marketplace-${c}`:null;(0,W.useEffect)(()=>{let e=window.setTimeout(()=>o({type:`patch`,patch:{debounced:s.trim()}}),300);return()=>window.clearTimeout(e)},[s]);let{data:x,isLoading:S,error:C}=E(b,async()=>p(c.length>0?_(`/api/marketplace?q=${encodeURIComponent(c)}`):_(`/api/marketplace`)),{revalidateOnFocus:!1}),w=(0,W.useCallback)(()=>{i(`gateway-extensions-list`),L()},[i]),D=(0,W.useCallback)(async(e,n)=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await J({name:e,overwrite:n});w(),r.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceInstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceInstallFailed,t.marketplaceRestartHint,w]),ee=(0,W.useCallback)(async e=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await X(e);w(),n.requiresGatewayRestart&&o({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceUninstallFailed}}),e}finally{o({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceRestartHint,t.marketplaceUninstallFailed,w]),j=x?.extensions??[];return(0,Z.jsxs)(`div`,{className:f(`flex flex-col gap-4`,e),children:[(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(H,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`search`,value:s,onChange:e=>o({type:`patch`,patch:{q:e.target.value}}),placeholder:t.marketplaceSearchPlaceholder,className:`ui-input h-10 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted`})]}),C?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:C instanceof Error?C.message:t.marketplaceLoadFailed}):null,h?(0,Z.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:h}):null,y?(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:y}):null,S&&!x?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":t.marketplaceLoading,children:[0,1,2].map(e=>(0,Z.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,Z.jsx)(O,{className:`h-5 w-40`}),(0,Z.jsx)(O,{className:`h-4 w-full max-w-xl`}),(0,Z.jsx)(O,{className:`h-4 w-2/3 max-w-md`})]}),(0,Z.jsx)(O,{className:`h-8 w-20`})]})},e))}):(0,Z.jsx)(`ul`,{className:`flex flex-col gap-3`,children:j.length===0?(0,Z.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):j.map(e=>{let n=ie(r,e.id),i=d===e.id;return(0,Z.jsx)(`li`,{className:`list-none`,children:(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${t.marketplaceDetailTitle}`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),o({type:`patch`,patch:{detailPkg:e.id}}))},className:f(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl bg-surface-panel p-4 text-left shadow-surface`,`transition-[transform,background-color,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,Z.jsx)(V,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,Z.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,Z.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,Z.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,Z.jsx)(B,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,Z.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:n===`bundled`?(0,Z.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.marketplaceBuiltin}):n===`user`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,Z.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&ee(e.id).catch(()=>{})},className:f(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[i?(0,Z.jsx)(l,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,Z.jsx)(k,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,Z.jsx)(`button`,{type:`button`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),className:f(`inline-flex w-full items-center justify-center rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:t.marketplaceReview})})]})},e.id)})}),u?(0,Z.jsx)(ae,{packageName:u,copy:t,extensions:r,onClose:()=>o({type:`patch`,patch:{detailPkg:null}}),onInstall:D,onUninstall:ee}):null]})}function ae(e){let t=(0,G.c)(102),{packageName:n,copy:r,extensions:i,onClose:o,onInstall:s,onUninstall:u}=e,[p,h]=(0,W.useState)(!1),[g,_]=(0,W.useState)(!1),v=m(ue)?`ext-mp-detail-${n}`:null,b;t[0]===n?b=t[1]:(b=async()=>re(n),t[0]=n,t[1]=b);let T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T={revalidateOnFocus:!1},t[2]=T):T=t[2];let{data:D,error:A,isLoading:j}=E(v,b,T),M;t[3]!==i||t[4]!==n?(M=ie(i,n),t[3]=i,t[4]=n,t[5]=M):M=t[5];let N=M,P=N===`user`,F=D?.manifest?.permissions,I,L,R,z,B,V,H,U,K,q,J;if(t[6]!==r.detailBack||t[7]!==r.detailClose||t[8]!==r.marketplaceAuthor||t[9]!==r.marketplaceCodeRisk||t[10]!==r.marketplaceDependencies||t[11]!==r.marketplaceDetailLoadFailed||t[12]!==r.marketplaceDetailReadmeHeading||t[13]!==r.marketplaceDetailTitle||t[14]!==r.marketplaceDownloads||t[15]!==r.marketplaceIntegrity||t[16]!==r.marketplaceIntegrityVerified||t[17]!==r.marketplaceLifecycleScripts||t[18]!==r.marketplaceLoadFailed||t[19]!==r.marketplaceLoading||t[20]!==r.marketplaceNoReadme||t[21]!==r.marketplacePermissions||t[22]!==r.marketplacePermissionsNone||t[23]!==r.marketplaceRiskConfirm||t[24]!==r.marketplaceRiskTitle||t[25]!==r.marketplaceUnavailableBody||t[26]!==r.marketplaceUnavailableTitle||t[27]!==r.marketplaceVersion||t[28]!==D||t[29]!==A||t[30]!==N||t[31]!==j||t[32]!==o||t[33]!==F||t[34]!==g){let e=F&&typeof F==`object`&&!Array.isArray(F)?Object.entries(F):[],n;t[46]!==r.marketplaceNoReadme||t[47]!==D?(n=D?.readme?.trim()||(D?.description?.trim()?`### ${D.name}\n\n${D.description}`:`*${r.marketplaceNoReadme}*`),t[46]=r.marketplaceNoReadme,t[47]=D,t[48]=n):n=t[48];let i=n;R=w,z=!0,t[49]===o?B=t[50]:(B=e=>!e&&o(),t[49]=o,t[50]=B),L=x,t[51]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[51]=J):J=t[51],I=S,U=`fixed left-1/2 top-1/2 z-[131] flex h-[min(44rem,calc(100vh-1.5rem))] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,K=le;let a;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(ee,{className:`size-5`}),t[52]=a):a=t[52];let s;t[53]!==r.detailBack||t[54]!==o?(s=(0,Z.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailBack,children:a}),t[53]=r.detailBack,t[54]=o,t[55]=s):s=t[55];let l;t[56]===r.marketplaceDetailTitle?l=t[57]:(l=(0,Z.jsx)(C,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[56]=r.marketplaceDetailTitle,t[57]=l);let u;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(d,{className:`size-5`}),t[58]=u):u=t[58];let f;t[59]!==r.detailClose||t[60]!==o?(f=(0,Z.jsx)(`button`,{type:`button`,onClick:o,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailClose,children:u}),t[59]=r.detailClose,t[60]=o,t[61]=f):f=t[61],t[62]!==s||t[63]!==l||t[64]!==f?(q=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[s,l,f]}),t[62]=s,t[63]=l,t[64]=f,t[65]=q):q=t[65],V=`min-h-0 flex-1 overflow-y-auto p-5`,H=j&&!D?(0,Z.jsxs)(`div`,{className:`space-y-4`,"aria-label":r.marketplaceLoading,children:[(0,Z.jsx)(O,{className:`h-6 w-48`}),(0,Z.jsx)(O,{className:`h-4 w-28`}),(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsx)(O,{className:`h-12`}),(0,Z.jsx)(O,{className:`h-12`})]}),(0,Z.jsx)(O,{className:`h-28 w-full`}),(0,Z.jsx)(O,{className:`h-36 w-full`})]}):A?(0,Z.jsxs)(`div`,{className:`rounded-lg border border-red-300/70 bg-red-50 p-4 text-sm dark:border-red-900 dark:bg-red-950/30`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:r.marketplaceDetailLoadFailed}),(0,Z.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:A instanceof Error?A.message:r.marketplaceLoadFailed})]}):D?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:D.name}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,Z.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:D.id})}),(0,Z.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,Z.jsx)(`dd`,{children:D.author.username})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,Z.jsx)(`dd`,{children:D.latestVersion.version})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,Z.jsx)(`dd`,{children:D.downloads})]})]}),N===`bundled`?null:(0,Z.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[D.installability.available?(0,Z.jsx)(ne,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,Z.jsx)(te,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:D.installability.available?r.marketplaceRiskTitle:r.marketplaceUnavailableTitle}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:D.installability.available?r.marketplaceCodeRisk:D.installability.reason??r.marketplaceUnavailableBody})]})]}),D.installability.available?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceIntegrity}),(0,Z.jsx)(`dd`,{children:r.marketplaceIntegrityVerified})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDependencies}),(0,Z.jsx)(`dd`,{children:D.packageSummary?.dependencyCount??0})]})]}),(0,Z.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-fg`,children:r.marketplacePermissions}),e.length>0?(0,Z.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(ce)}):(0,Z.jsx)(`p`,{className:`mt-1`,children:r.marketplacePermissionsNone})]}),(D.packageSummary?.lifecycleScripts.length??0)>0?(0,Z.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[r.marketplaceLifecycleScripts,`: `,D.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:g,onChange:e=>_(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,Z.jsx)(`span`,{children:r.marketplaceRiskConfirm})]})]}):null]}),D.readme?.trim()?(0,Z.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,Z.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,Z.jsx)(c,{content:i})})]}):null,t[6]=r.detailBack,t[7]=r.detailClose,t[8]=r.marketplaceAuthor,t[9]=r.marketplaceCodeRisk,t[10]=r.marketplaceDependencies,t[11]=r.marketplaceDetailLoadFailed,t[12]=r.marketplaceDetailReadmeHeading,t[13]=r.marketplaceDetailTitle,t[14]=r.marketplaceDownloads,t[15]=r.marketplaceIntegrity,t[16]=r.marketplaceIntegrityVerified,t[17]=r.marketplaceLifecycleScripts,t[18]=r.marketplaceLoadFailed,t[19]=r.marketplaceLoading,t[20]=r.marketplaceNoReadme,t[21]=r.marketplacePermissions,t[22]=r.marketplacePermissionsNone,t[23]=r.marketplaceRiskConfirm,t[24]=r.marketplaceRiskTitle,t[25]=r.marketplaceUnavailableBody,t[26]=r.marketplaceUnavailableTitle,t[27]=r.marketplaceVersion,t[28]=D,t[29]=A,t[30]=N,t[31]=j,t[32]=o,t[33]=F,t[34]=g,t[35]=I,t[36]=L,t[37]=R,t[38]=z,t[39]=B,t[40]=V,t[41]=H,t[42]=U,t[43]=K,t[44]=q,t[45]=J}else I=t[35],L=t[36],R=t[37],z=t[38],B=t[39],V=t[40],H=t[41],U=t[42],K=t[43],q=t[44],J=t[45];let Y;t[66]!==V||t[67]!==H?(Y=(0,Z.jsx)(`div`,{className:V,children:H}),t[66]=V,t[67]=H,t[68]=Y):Y=t[68];let X;t[69]!==p||t[70]!==r.marketplaceBuiltinGoBuiltin||t[71]!==r.marketplaceBuiltinManageHint||t[72]!==r.marketplaceInstall||t[73]!==r.marketplaceReinstall||t[74]!==r.marketplaceReinstallConfirm||t[75]!==r.marketplaceUninstall||t[76]!==r.marketplaceUninstallConfirm||t[77]!==D||t[78]!==N||t[79]!==o||t[80]!==s||t[81]!==u||t[82]!==n||t[83]!==g||t[84]!==P?(X=D?(0,Z.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:N===`bundled`?(0,Z.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,Z.jsx)(a,{to:`/extensions?tab=builtin`,onClick:o,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.marketplaceBuiltinGoBuiltin})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,disabled:p||!D.installability.available||!g,onClick:()=>{P&&!window.confirm(r.marketplaceReinstallConfirm)||(h(!0),s(n,P).catch(se).finally(()=>h(!1)))},className:f(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-white shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[p?(0,Z.jsx)(l,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,P?r.marketplaceReinstall:r.marketplaceInstall]}),P?(0,Z.jsxs)(`button`,{type:`button`,disabled:p,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(h(!0),u(n).then(()=>o()).catch(oe).finally(()=>h(!1)))},className:f(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,Z.jsx)(k,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[69]=p,t[70]=r.marketplaceBuiltinGoBuiltin,t[71]=r.marketplaceBuiltinManageHint,t[72]=r.marketplaceInstall,t[73]=r.marketplaceReinstall,t[74]=r.marketplaceReinstallConfirm,t[75]=r.marketplaceUninstall,t[76]=r.marketplaceUninstallConfirm,t[77]=D,t[78]=N,t[79]=o,t[80]=s,t[81]=u,t[82]=n,t[83]=g,t[84]=P,t[85]=X):X=t[85];let Q;t[86]!==I||t[87]!==Y||t[88]!==X||t[89]!==U||t[90]!==K||t[91]!==q?(Q=(0,Z.jsxs)(I,{className:U,onOpenAutoFocus:K,children:[q,Y,X]}),t[86]=I,t[87]=Y,t[88]=X,t[89]=U,t[90]=K,t[91]=q,t[92]=Q):Q=t[92];let $;t[93]!==L||t[94]!==Q||t[95]!==J?($=(0,Z.jsxs)(L,{children:[J,Q]}),t[93]=L,t[94]=Q,t[95]=J,t[96]=$):$=t[96];let ae;return t[97]!==R||t[98]!==z||t[99]!==B||t[100]!==$?(ae=(0,Z.jsx)(R,{defaultOpen:z,onOpenChange:B,children:$}),t[97]=R,t[98]=z,t[99]=B,t[100]=$,t[101]=ae):ae=t[101],ae}function oe(){}function se(){}function ce(e){let[t,n]=e;return(0,Z.jsxs)(`li`,{className:`break-words`,children:[(0,Z.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function le(e){return e.preventDefault()}function ue(e){return!!e.sessionKey}function de(){let e=g(e=>e.language),t=v(e),n=R(e=>e.setPageHeader),r=R(e=>e.clearPageHeader),o=A(),s=P(),[c,l]=i(),d=K(c.get(`tab`)),f=c.get(`q`)??``,[p,m]=(0,W.useState)(d),[h,_]=(0,W.useState)(f),[y,b]=(0,W.useState)(null),x=c.toString(),S=(0,W.useRef)(x);if(S.current!==x){S.current=x;let e=K(c.get(`tab`)),t=c.get(`q`)??``;m(t=>t===e?t:e),_(e=>e===t?e:t)}(0,W.useEffect)(()=>{l(e=>{let t=new URLSearchParams(e),n=h.trim();return n?t.set(`q`,n):t.delete(`q`),p===`marketplace`?t.delete(`tab`):t.set(`tab`,p),t.toString()===e.toString()?e:t},{replace:!0})},[p,h,l]);let C=(0,W.useMemo)(()=>o.filter(e=>e.source===`bundled`),[o]),w=(0,W.useMemo)(()=>o.filter(e=>e.source!==`bundled`),[o]),T=p===`builtin`?C:w,E=(0,W.useMemo)(()=>{let t=h.trim().toLowerCase(),n=T;return t&&(n=n.filter(e=>(e.name??``).toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t))),n.toSorted((t,n)=>t.hasUi===n.hasUi?(t.name||t.id).localeCompare(n.name||n.id,e):t.hasUi?-1:1)},[T,h,e]);if((0,W.useEffect)(()=>{b(e=>{if(!e)return e;let t=o.find(t=>t.id===e.id);return t?fe(e)===fe(t)&&e.active===t.active?e:t:null})},[o]),(0,W.useLayoutEffect)(()=>(n({startExtra:null,main:(0,Z.jsx)(`div`,{className:`min-w-0`,children:(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.extensionsPage.title})}),end:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(D,{asChild:!0,variant:`secondary`,className:`h-9`,children:(0,Z.jsxs)(a,{to:`/local-apps`,"aria-label":t.extensionsPage.openLocalApps,title:t.extensionsPage.openLocalApps,children:[(0,Z.jsx)(M,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`hidden sm:inline`,children:t.extensionsPage.openLocalApps})]})}),(0,Z.jsx)(D,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,Z.jsxs)(a,{to:`/local-apps/new`,children:[(0,Z.jsx)(u,{className:`size-4`}),t.extensionsPage.createLocalApp]})})]})}),()=>r()),[r,t.extensionsPage.createLocalApp,t.extensionsPage.openLocalApps,t.extensionsPage.title,n]),s&&p!==`marketplace`)return(0,Z.jsx)(ye,{});let O=p!==`marketplace`&&T.length>0;return(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,Z.jsxs)(`div`,{className:`mx-auto w-full max-w-7xl px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(0,Z.jsxs)(`div`,{className:`mb-6 flex flex-col gap-3 border-b border-edge-subtle pb-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Z.jsx)(U,{items:[{id:`marketplace`,label:t.extensionsPage.tabMarketplace},{id:`builtin`,label:t.extensionsPage.tabBuiltin,count:C.length},{id:`user`,label:t.extensionsPage.tabUser,count:w.length}],activeTab:p,onChange:m,ariaLabel:t.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`}),O?(0,Z.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,Z.jsx)(H,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{type:`search`,value:h,onChange:e=>_(e.target.value),placeholder:t.extensionsPage.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,autoComplete:`off`})]}):null]}),p===`marketplace`?(0,Z.jsx)($,{}):p===`builtin`&&C.length===0?(0,Z.jsx)(xe,{message:t.extensionsPage.emptyBuiltin}):p===`user`&&w.length===0?(0,Z.jsx)(xe,{message:t.extensionsPage.emptyUser}):E.length===0?(0,Z.jsx)(`p`,{className:`px-3 py-14 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:t.extensionsPage.noSearchResults}):(0,Z.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:E.map(e=>(0,Z.jsx)(ge,{extension:e,copy:t.extensionsPage,showSourceBadge:p===`user`,onOpen:()=>b(e)},e.id))})]}),y?(0,Z.jsx)(_e,{extension:y,copy:t.extensionsPage,onClose:()=>b(null)},y.id):null]})}function fe(e){return e.activationEligible??e.active}function pe(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function me(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function he(e,t){let n=fe(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function ge(e){let t=(0,G.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,s;t[0]===n?s=t[1]:(s=fe(n),t[0]=n,t[1]=s);let c=s,l=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=f(`group flex w-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=d):d=t[2];let p=n.name||n.id,m;t[3]===p?m=t[4]:(m=p.charAt(0).toUpperCase(),t[3]=p,t[4]=m);let h;t[5]===m?h=t[6]:(h=(0,Z.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:m}),t[5]=m,t[6]=h);let g;t[7]===n.name?g=t[8]:(g=(0,Z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=g);let _;t[9]===n.version?_=t[10]:(_=n.version?(0,Z.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=_);let v;t[11]!==g||t[12]!==_?(v=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[g,_]}),t[11]=g,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==r.statusEnabled||t[15]!==c?(y=c?(0,Z.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,Z.jsx)(o,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,Z.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,Z.jsx)(u,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=c,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==y?(b=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[v,y]}),t[17]=v,t[18]=y,t[19]=b):b=t[19];let x;t[20]!==r.cardNoDescription||t[21]!==n.description?(x=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=x):x=t[22];let S;t[23]===x?S=t[24]:(S=(0,Z.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:x}),t[23]=x,t[24]=S);let C=n.hasUi?r.badgeKindUi:r.badgeKindBackend,w;t[25]!==C||t[26]!==l?(w=(0,Z.jsx)(`span`,{title:l,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:C}),t[25]=C,t[26]=l,t[27]=w):w=t[27];let T;t[28]!==r||t[29]!==n||t[30]!==i?(T=n.source===`bundled`?(0,Z.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):i?(0,Z.jsx)(`span`,{title:pe(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:me(n,r)}):null,t[28]=r,t[29]=n,t[30]=i,t[31]=T):T=t[31];let E;t[32]!==w||t[33]!==T?(E=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[w,T]}),t[32]=w,t[33]=T,t[34]=E):E=t[34];let D;t[35]!==b||t[36]!==S||t[37]!==E?(D=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,S,E]}),t[35]=b,t[36]=S,t[37]=E,t[38]=D):D=t[38];let O;t[39]!==D||t[40]!==h?(O=(0,Z.jsxs)(`div`,{className:`flex gap-3`,children:[h,D]}),t[39]=D,t[40]=h,t[41]=O):O=t[41];let k;return t[42]!==a||t[43]!==O?(k=(0,Z.jsx)(`button`,{type:`button`,onClick:a,className:d,children:O}),t[42]=a,t[43]=O,t[44]=k):k=t[44],k}function _e({extension:e,copy:t,onClose:n}){let{mutate:r}=T(),[i,o]=(0,W.useState)(!1),[c,u]=(0,W.useState)(null),[p,m]=(0,W.useState)(!1),h=e.activationEligible===!0,g=(0,W.useCallback)(async()=>{if(e.source===`bundled`){u(null),m(!1),o(!0);try{let{requiresGatewayRestart:t}=await Y({extensionId:e.id,enabled:!h});await r(`gateway-extensions-list`),L(),m(t)}catch(e){u(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[h,t.builtinToggleFailed,e.id,e.source,r]),_=e.ui?.contributions?.pages??[],v=e.ui?.contributions?.settingsPanels??[],E=e.ui?.contributions?.chatWidgets??[],O=e.ui?.contributions?.sidebarPanels??[],k=_.find(e=>e.showInNav)??_[0],A=v[0],M=k?j(e.id,k):null,te=A?`/settings/ext/${e.id}/${A.id}`:e.hasConfigSchema||N(e)?`/settings/ext/${e.id}`:null;return(0,Z.jsx)(w,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,Z.jsxs)(x,{children:[(0,Z.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,Z.jsxs)(S,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailBack,children:(0,Z.jsx)(ee,{className:`size-5`})}),(0,Z.jsx)(C,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,Z.jsxs)(b,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,Z.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailClose,children:(0,Z.jsx)(d,{className:`size-5`})})]}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Z.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,Z.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,pe(e,t)]}),e.version?(0,Z.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,Z.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:he(e,t)}),e.source===`bundled`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.builtinConfigHint}),(0,Z.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,Z.jsx)(D,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void g(),className:`shrink-0 py-1.5 text-xs`,children:i?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(l,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):h?t.builtinToggleDisable:t.builtinToggleEnable})]}),c?(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:c}):null,p?(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,Z.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.cliManageHint}),e.hasUi&&(_.length>0||v.length>0||E.length>0)?(0,Z.jsxs)(`section`,{className:`mt-8`,children:[(0,Z.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,Z.jsx)(ve,{template:t.badgePages,count:_.length,hidden:_.length===0}),(0,Z.jsx)(ve,{template:t.badgeSettings,count:v.length,hidden:v.length===0}),(0,Z.jsx)(ve,{template:t.badgeWidgets,count:E.length,hidden:E.length===0}),(0,Z.jsx)(ve,{template:t.badgeSidebar,count:O.length,hidden:O.length===0})]})]}):null,F(e)&&(M||te)?(0,Z.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[M?(0,Z.jsxs)(a,{to:M,onClick:n,className:f(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,Z.jsx)(s,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,te?(0,Z.jsxs)(a,{to:te,onClick:n,className:f(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,Z.jsx)(I,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,Z.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function ve(e){let t=(0,G.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,Z.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function ye(){let e=(0,G.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,Z.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,Z.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,Z.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,Z.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(be)})]})}),e[4]=a):a=e[4],a}function be(e){return(0,Z.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge-subtle bg-surface-base shadow-surface`},e)}function xe(e){let t=(0,G.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center rounded-xl border border-edge-subtle bg-surface-base px-4 py-12 text-center shadow-surface`,children:(0,Z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{de as ExtensionsPage};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-DYFcjtmG.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-CyM0sanh.js";var s=n(),c=e(a(),1),l=e(t(),1),u=r();function d(e){let t=(0,s.c)(17),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0];let[r,a]=(0,l.useState)(n),[d,m]=(0,l.useState)(null),h,g;if(t[1]===e.binaryBuffer?(h=t[2],g=t[3]):(h=()=>{if(!e.binaryBuffer)return;let t=!1;return c.default.loadAsync(e.binaryBuffer).then(e=>{t||a(Object.values(e.files).slice(0,500).map(p))}).catch(e=>{t||m(e instanceof Error?e.message:String(e))}),()=>{t=!0}},g=[e.binaryBuffer],t[1]=e.binaryBuffer,t[2]=h,t[3]=g),(0,l.useEffect)(h,g),d){let n;t[4]===e.language?n=t[5]:(n=i(e.language),t[4]=e.language,t[5]=n);let r=n,a;t[6]!==r.chat.attachmentPreviewDownloadFull||t[7]!==r.chat.attachmentPreviewOpenElsewhereHint||t[8]!==e.actions.onDownload?(a=(0,u.jsx)(o,{message:r.chat.attachmentPreviewOpenElsewhereHint,downloadLabel:r.chat.attachmentPreviewDownloadFull,onDownload:e.actions.onDownload}),t[6]=r.chat.attachmentPreviewDownloadFull,t[7]=r.chat.attachmentPreviewOpenElsewhereHint,t[8]=e.actions.onDownload,t[9]=a):a=t[9];let s;t[10]===d?s=t[11]:(s=(0,u.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:d}),t[10]=d,t[11]=s);let c;return t[12]!==a||t[13]!==s?(c=(0,u.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[a,s]}),t[12]=a,t[13]=s,t[14]=c):c=t[14],c}let _;return t[15]===r?_=t[16]:(_=(0,u.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:(0,u.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:r.length===0?(0,u.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:`Loading archive...`}):(0,u.jsx)(`table`,{className:`w-full text-left text-xs`,children:(0,u.jsx)(`tbody`,{children:r.map(f)})})})}),t[15]=r,t[16]=_),_}function f(e){return(0,u.jsxs)(`tr`,{className:`border-b border-edge-subtle last:border-b-0 dark:border-edge`,children:[(0,u.jsx)(`td`,{className:`max-w-0 truncate px-3 py-2 font-mono text-fg`,title:e.name,children:e.dir?`${e.name}/`:e.name}),(0,u.jsx)(`td`,{className:`w-24 px-3 py-2 text-right text-fg-muted`,children:e.dir?``:m(e.size)})]},e.name)}function p(e){return{name:e.name,dir:e.dir,size:e.dir?0:e._data?.uncompressedSize??0}}function m(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}export{d as ArchivePreviewPluginView};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-BgZRsCkG.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-DzgF1yYO.js";var s=n(),c=e(a(),1),l=e(t(),1),u=r();function d(e){let t=(0,s.c)(17),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0];let[r,a]=(0,l.useState)(n),[d,m]=(0,l.useState)(null),h,g;if(t[1]===e.binaryBuffer?(h=t[2],g=t[3]):(h=()=>{if(!e.binaryBuffer)return;let t=!1;return c.default.loadAsync(e.binaryBuffer).then(e=>{t||a(Object.values(e.files).slice(0,500).map(p))}).catch(e=>{t||m(e instanceof Error?e.message:String(e))}),()=>{t=!0}},g=[e.binaryBuffer],t[1]=e.binaryBuffer,t[2]=h,t[3]=g),(0,l.useEffect)(h,g),d){let n;t[4]===e.language?n=t[5]:(n=i(e.language),t[4]=e.language,t[5]=n);let r=n,a;t[6]!==r.chat.attachmentPreviewDownloadFull||t[7]!==r.chat.attachmentPreviewOpenElsewhereHint||t[8]!==e.actions.onDownload?(a=(0,u.jsx)(o,{message:r.chat.attachmentPreviewOpenElsewhereHint,downloadLabel:r.chat.attachmentPreviewDownloadFull,onDownload:e.actions.onDownload}),t[6]=r.chat.attachmentPreviewDownloadFull,t[7]=r.chat.attachmentPreviewOpenElsewhereHint,t[8]=e.actions.onDownload,t[9]=a):a=t[9];let s;t[10]===d?s=t[11]:(s=(0,u.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:d}),t[10]=d,t[11]=s);let c;return t[12]!==a||t[13]!==s?(c=(0,u.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[a,s]}),t[12]=a,t[13]=s,t[14]=c):c=t[14],c}let _;return t[15]===r?_=t[16]:(_=(0,u.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:(0,u.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:r.length===0?(0,u.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:`Loading archive...`}):(0,u.jsx)(`table`,{className:`w-full text-left text-xs`,children:(0,u.jsx)(`tbody`,{children:r.map(f)})})})}),t[15]=r,t[16]=_),_}function f(e){return(0,u.jsxs)(`tr`,{className:`border-b border-edge-subtle last:border-b-0 dark:border-edge`,children:[(0,u.jsx)(`td`,{className:`max-w-0 truncate px-3 py-2 font-mono text-fg`,title:e.name,children:e.dir?`${e.name}/`:e.name}),(0,u.jsx)(`td`,{className:`w-24 px-3 py-2 text-right text-fg-muted`,children:e.dir?``:m(e.size)})]},e.name)}function p(e){return{name:e.name,dir:e.dir,size:e.dir?0:e._data?.uncompressedSize??0}}function m(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}export{d as ArchivePreviewPluginView};
@@ -1 +1 @@
1
- import{oa as e,sa as t}from"./index-enFXJJCU.js";async function n(n,r){let i,a=r||`unnamed`,o=`application/octet-stream`,s=0;if(typeof n==`string`){let e=await fetch(n);if(!e.ok)throw Error(`Failed to fetch file`);if(i=await e.arrayBuffer(),s=i.byteLength,o=e.headers.get(`content-type`)||o,!r){let e=n.split(`/`);a=e[e.length-1]||`document`}}else if(n instanceof File)i=await n.arrayBuffer(),s=n.size,o=n.type||o,a=r||n.name;else if(n instanceof Blob)i=await n.arrayBuffer(),s=n.size,o=n.type||o;else if(n instanceof ArrayBuffer)i=n,s=n.byteLength;else throw Error(`Invalid source type`);let c=new Uint8Array(i),l=``,u=32768;for(let e=0;e<c.length;e+=u){let t=c.slice(e,e+u);l+=String.fromCharCode(...t)}let d=btoa(l),f=`${a}_${Date.now()}_${Math.random()}`;if((o===`application/octet-stream`||/\.(csv|tsv)$/i.test(a))&&(o=e(a)??o),o?.startsWith(`image/`))return{id:f,type:`image`,name:a,mimeType:o,size:s,content:d,preview:d};if(o?.startsWith(`audio/`))return{id:f,type:`voice`,name:a,mimeType:o,size:s,content:d};if(t(a,o??``)){let e=new TextDecoder().decode(i);return{id:f,type:`document`,name:a,mimeType:o?.startsWith(`text/`)?o:`text/plain`,size:s,content:d,extractedText:e}}return{id:f,type:`document`,name:a,mimeType:o,size:s,content:d}}export{n as loadAttachment};
1
+ import{oa as e,sa as t}from"./index-C9aQA4Dr.js";async function n(n,r){let i,a=r||`unnamed`,o=`application/octet-stream`,s=0;if(typeof n==`string`){let e=await fetch(n);if(!e.ok)throw Error(`Failed to fetch file`);if(i=await e.arrayBuffer(),s=i.byteLength,o=e.headers.get(`content-type`)||o,!r){let e=n.split(`/`);a=e[e.length-1]||`document`}}else if(n instanceof File)i=await n.arrayBuffer(),s=n.size,o=n.type||o,a=r||n.name;else if(n instanceof Blob)i=await n.arrayBuffer(),s=n.size,o=n.type||o;else if(n instanceof ArrayBuffer)i=n,s=n.byteLength;else throw Error(`Invalid source type`);let c=new Uint8Array(i),l=``,u=32768;for(let e=0;e<c.length;e+=u){let t=c.slice(e,e+u);l+=String.fromCharCode(...t)}let d=btoa(l),f=`${a}_${Date.now()}_${Math.random()}`;if((o===`application/octet-stream`||/\.(csv|tsv)$/i.test(a))&&(o=e(a)??o),o?.startsWith(`image/`))return{id:f,type:`image`,name:a,mimeType:o,size:s,content:d,preview:d};if(o?.startsWith(`audio/`))return{id:f,type:`voice`,name:a,mimeType:o,size:s,content:d};if(t(a,o??``)){let e=new TextDecoder().decode(i);return{id:f,type:`document`,name:a,mimeType:o?.startsWith(`text/`)?o:`text/plain`,size:s,content:d,extractedText:e}}return{id:f,type:`document`,name:a,mimeType:o,size:s,content:d}}export{n as loadAttachment};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-D4PI9qAw.js","assets/preload-helper-zJ_50EbN.js","assets/docx-preview-CajIk2FR.js","assets/rolldown-runtime-aKtaBQYM.js","assets/jszip.min-DT31yWkU.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./preload-helper-zJ_50EbN.js";import{t}from"./excel-worksheet-utils-DpdB-DjU.js";var n=!1,r=5,i=5;async function a(){let t=await e(()=>import(`./pdf-D4PI9qAw.js`),__vite__mapDeps([0,1]));return n||=(t.GlobalWorkerOptions.workerSrc=new URL(`/assets/pdf.worker.min-CHFwMXne.mjs`,``+import.meta.url).toString(),!0),t}function o(){return new Promise(e=>requestAnimationFrame(()=>e()))}async function s(e,t,n){let s=(await a()).getDocument({data:t}),c=s;e.innerHTML=``;let l=document.createElement(`p`);l.className=`p-4 text-sm text-fg-muted`,l.textContent=n?.loadingText??`…`,e.appendChild(l);let u=null,d=null;try{u=await s.promise}catch(e){throw c?.destroy(),c=null,e}c=null,e.innerHTML=``;let f=document.createElement(`div`);e.appendChild(f);let p=document.createElement(`div`);f.appendChild(p);let m=async(e,t)=>{if(!u)return null;let n=await u.getPage(e),r=document.createElement(`div`);r.className=`mb-4 last:mb-0`,r.dataset.pdfPage=String(e);let i=document.createElement(`canvas`),a=i.getContext(`2d`),o=n.getViewport({scale:1.5});if(i.height=o.height,i.width=o.width,i.className=`mx-auto block h-auto w-full max-w-full rounded border border-edge bg-white shadow-sm dark:border-edge`,a&&(a.fillStyle=`white`,a.fillRect(0,0,i.width,i.height)),await n.render({canvasContext:a,viewport:o,canvas:i}).promise,r.appendChild(i),e<t){let e=document.createElement(`div`);e.className=`my-4 h-px bg-edge`,r.appendChild(e)}return r},h=async(e,t)=>{let n=await Promise.all(e.map(e=>m(e,t)));for(let e of n)e&&p.appendChild(e);await o()},g=u.numPages;n?.onPageCount?.(g);let _=Math.min(r,g);_>0&&await h(Array.from({length:_},(e,t)=>t+1),g);let v=_+1;if(v<=g){let t=document.createElement(`p`);t.className=`py-2 text-center text-xs text-fg-muted`,t.textContent=n?.loadMoreHint??``,f.appendChild(t);let r=document.createElement(`div`);r.className=`pdf-lazy-sentinel h-12 w-full shrink-0`,r.setAttribute(`aria-hidden`,`true`),f.appendChild(r);let a=!1;d=new IntersectionObserver(async e=>{if(!(!e[0]?.isIntersecting||a||!u)){a=!0;try{let e=Math.min(v+i-1,g);await h(Array.from({length:e-v+1},(e,t)=>v+t),g),v=e+1,v>g&&(d?.disconnect(),d=null,t.remove(),r.remove())}finally{a=!1}}},{root:e,rootMargin:`320px`,threshold:0}),d.observe(r)}return{cleanup:()=>{if(d?.disconnect(),d=null,c){try{c.destroy()}catch{}c=null}u&&=(s.destroy(),null),e.innerHTML=``}}}async function c(t,n){let{renderAsync:r,defaultOptions:i}=await e(async()=>{let{renderAsync:e,defaultOptions:t}=await import(`./docx-preview-CajIk2FR.js`);return{renderAsync:e,defaultOptions:t}},__vite__mapDeps([2,3,4]));t.innerHTML=``;let a=document.createElement(`div`);a.className=`docx-wrapper-custom max-w-full overflow-x-auto`,t.appendChild(a),await r(n,a,void 0,{...i,className:`docx`,inWrapper:!0,ignoreWidth:!0,ignoreHeight:!1,ignoreFonts:!0,breakPages:!0,ignoreLastRenderedPageBreak:!0,experimental:!1,trimXmlDeclaration:!0,useBase64URL:!1,renderHeaders:!0,renderFooters:!0,renderFootnotes:!0,renderEndnotes:!0});let o=document.createElement(`style`);return o.textContent=`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/docx-preview-CajIk2FR.js","assets/rolldown-runtime-aKtaBQYM.js","assets/jszip.min-DT31yWkU.js"])))=>i.map(i=>d[i]);
2
+ import{t as e}from"./preload-helper-zJ_50EbN.js";import{n as t,t as n}from"./pdf-runtime-DU_sMPjG.js";var r=5,i=5;function a(){return new Promise(e=>requestAnimationFrame(()=>e()))}async function o(e,t,o){let s=(await n()).getDocument({data:t.slice(0)}),c=s;e.innerHTML=``;let l=document.createElement(`p`);l.className=`p-4 text-sm text-fg-muted`,l.textContent=o?.loadingText??`…`,e.appendChild(l);let u=null,d=null;try{u=await s.promise}catch(e){throw c?.destroy(),c=null,e}c=null,e.innerHTML=``;let f=document.createElement(`div`);e.appendChild(f);let p=document.createElement(`div`);f.appendChild(p);let m=async(e,t)=>{if(!u)return null;let n=await u.getPage(e),r=document.createElement(`div`);r.className=`mb-4 last:mb-0`,r.dataset.pdfPage=String(e);let i=document.createElement(`canvas`),a=i.getContext(`2d`),o=n.getViewport({scale:1.5});if(i.height=o.height,i.width=o.width,i.className=`mx-auto block h-auto w-full max-w-full rounded border border-edge bg-white shadow-sm dark:border-edge`,a&&(a.fillStyle=`white`,a.fillRect(0,0,i.width,i.height)),await n.render({canvasContext:a,viewport:o,canvas:i}).promise,r.appendChild(i),e<t){let e=document.createElement(`div`);e.className=`my-4 h-px bg-edge`,r.appendChild(e)}return r},h=async(e,t)=>{let n=await Promise.all(e.map(e=>m(e,t)));for(let e of n)e&&p.appendChild(e);await a()},g=u.numPages;o?.onPageCount?.(g);let _=Math.min(r,g);_>0&&await h(Array.from({length:_},(e,t)=>t+1),g);let v=_+1;if(v<=g){let t=document.createElement(`p`);t.className=`py-2 text-center text-xs text-fg-muted`,t.textContent=o?.loadMoreHint??``,f.appendChild(t);let n=document.createElement(`div`);n.className=`pdf-lazy-sentinel h-12 w-full shrink-0`,n.setAttribute(`aria-hidden`,`true`),f.appendChild(n);let r=!1;d=new IntersectionObserver(async e=>{if(!(!e[0]?.isIntersecting||r||!u)){r=!0;try{let e=Math.min(v+i-1,g);await h(Array.from({length:e-v+1},(e,t)=>v+t),g),v=e+1,v>g&&(d?.disconnect(),d=null,t.remove(),n.remove())}finally{r=!1}}},{root:e,rootMargin:`320px`,threshold:0}),d.observe(n)}return{cleanup:()=>{if(d?.disconnect(),d=null,c){try{c.destroy()}catch{}c=null}u&&=(s.destroy(),null),e.innerHTML=``}}}async function s(t,n){let{renderAsync:r,defaultOptions:i}=await e(async()=>{let{renderAsync:e,defaultOptions:t}=await import(`./docx-preview-CajIk2FR.js`);return{renderAsync:e,defaultOptions:t}},__vite__mapDeps([0,1,2]));t.innerHTML=``;let a=document.createElement(`div`);a.className=`docx-wrapper-custom max-w-full overflow-x-auto`,t.appendChild(a),await r(n,a,void 0,{...i,className:`docx`,inWrapper:!0,ignoreWidth:!0,ignoreHeight:!1,ignoreFonts:!0,breakPages:!0,ignoreLastRenderedPageBreak:!0,experimental:!1,trimXmlDeclaration:!0,useBase64URL:!1,renderHeaders:!0,renderFooters:!0,renderFootnotes:!0,renderEndnotes:!0});let o=document.createElement(`style`);return o.textContent=`
3
3
  .docx-preview-host { padding: 0; }
4
4
  .docx-preview-host .docx-wrapper-custom { max-width: 100%; overflow-x: auto; }
5
5
  .docx-preview-host .docx-wrapper { max-width: 100% !important; margin: 0 !important; background: transparent !important; padding: 0em !important; }
@@ -8,5 +8,5 @@ import{t as e}from"./preload-helper-zJ_50EbN.js";import{t}from"./excel-worksheet
8
8
  .docx-preview-host img { max-width: 100% !important; height: auto !important; }
9
9
  .docx-preview-host p, .docx-preview-host span, .docx-preview-host div, .docx-preview-host td, .docx-preview-host th { max-width: 100% !important; word-wrap: break-word !important; overflow-wrap: break-word !important; font-family: inherit !important; }
10
10
  .docx-preview-host .docx-page-break { display: none !important; }
11
- `,t.classList.add(`docx-preview-host`),t.appendChild(o),{cleanup:()=>{t.innerHTML=``,t.classList.remove(`docx-preview-host`)}}}async function l(t,n,r){let i=await e(()=>import(`./xlsx-CKkngM-o.js`),[]),a=i.read(n,{type:`array`,cellDates:!0,cellStyles:!0});t.innerHTML=``;let o=document.createElement(`div`);o.className=`flex h-full min-h-0 flex-col overflow-hidden bg-white`,t.appendChild(o);let s=a.SheetNames??[];if(s.length===0){let e=document.createElement(`p`);return e.className=`p-4 text-sm text-fg-muted`,e.textContent=`(No sheets in workbook.)`,o.appendChild(e),{truncated:!1,cleanup:()=>{t.innerHTML=``}}}let c=!1;if(s.length>1){let e=document.createElement(`div`);e.className=`z-30 flex shrink-0 gap-1 overflow-x-auto border-b border-edge bg-surface-panel px-2 pt-1 dark:border-edge`;let t=[];s.forEach((n,o)=>{let s=document.createElement(`button`);s.type=`button`,s.textContent=n,s.className=o===0?`shrink-0 border-b-2 border-accent px-3 py-2 text-xs font-medium text-accent`:`shrink-0 border-b-2 border-transparent px-3 py-2 text-xs font-medium text-fg-muted hover:border-edge hover:text-fg`;let l=document.createElement(`div`);l.style.display=o===0?`flex`:`none`,l.className=`min-h-0 flex-1 overflow-hidden`;let u=x(i,a.Sheets[n],n,r?.truncationNotice);u.truncated&&(c=!0),l.appendChild(u.element),t.push(l),s.onclick=()=>{e.querySelectorAll(`button`).forEach((e,t)=>{t===o?e.className=`shrink-0 border-b-2 border-accent px-3 py-2 text-xs font-medium text-accent`:e.className=`shrink-0 border-b-2 border-transparent px-3 py-2 text-xs font-medium text-fg-muted hover:border-edge hover:text-fg`}),t.forEach((e,t)=>{e.style.display=t===o?`flex`:`none`})},e.appendChild(s)}),o.appendChild(e),t.forEach(e=>{o.appendChild(e)})}else{let e=s[0],t=x(i,a.Sheets[e],e,r?.truncationNotice);c=t.truncated,o.appendChild(t.element)}return{truncated:c,cleanup:()=>{t.innerHTML=``}}}var u=80,d=46,f=28,p=480;function m(e,t,n){return Math.min(n,Math.max(t,e))}function h(e){if(!e)return u;if(typeof e.wpx==`number`&&Number.isFinite(e.wpx))return m(e.wpx,f,p);let t=e.wch??e.width;return typeof t==`number`&&Number.isFinite(t)?m(Math.round(t*7+12),f,p):u}function g(e){if(e){if(typeof e.hpx==`number`&&Number.isFinite(e.hpx))return m(e.hpx,16,240);if(typeof e.hpt==`number`&&Number.isFinite(e.hpt))return m(Math.round(e.hpt*(96/72)),16,240)}}function _(e){let t=e?.s;if(!t?.fgColor?.rgb||t.patternType===`none`)return;let n=t.fgColor.rgb.replace(/^#/,``).slice(-6);return/^[0-9a-f]{6}$/i.test(n)?`#${n}`:void 0}function v(e){let t=e.slice(1).match(/.{2}/g)?.map(e=>Number.parseInt(e,16));return!t||t.length!==3?`#0f172a`:(t[0]*299+t[1]*587+t[2]*114)/1e3<132?`#ffffff`:`#0f172a`}function y(e,t){if(!t||t.t===`z`)return``;if(typeof t.w==`string`)return t.w;try{return e.utils.format_cell(t)}catch{return t.v==null?``:String(t.v)}}function b(e,t,n,r,i){let a=new Map,o=new Set;for(let s of e){let e=Math.max(t,s.s.r),c=Math.min(n,s.e.r),l=Math.max(r,s.s.c),u=Math.min(i,s.e.c);if(e>c||l>u)continue;let d=`${e}:${l}`;a.set(d,{rowSpan:c-e+1,colSpan:u-l+1});for(let t=e;t<=c;t+=1)for(let n=l;n<=u;n+=1)(t!==e||n!==l)&&o.add(`${t}:${n}`)}return{anchors:a,covered:o}}function x(e,n,r,i){let a=document.createElement(`div`);if(a.className=`min-h-0 flex-1 overflow-auto bg-white`,!n){let e=document.createElement(`p`);return e.className=`p-4 text-sm text-fg-muted`,e.textContent=`Sheet "${r}" is missing from the workbook.`,a.appendChild(e),{element:a,truncated:!1}}if(!t(n)){let e=document.createElement(`p`);return e.className=`p-4 text-sm text-fg-muted`,e.textContent=`(Empty sheet — no cell range.)`,a.appendChild(e),{element:a,truncated:!1}}try{let t=e.utils.decode_range(n[`!ref`]),o=t.e.r-t.s.r+1,s=t.e.c-t.s.c+1,c=Math.min(t.e.r,t.s.r+500-1),l=Math.min(t.e.c,t.s.c+64-1),u=o>500||s>64;if(u&&i){let e=document.createElement(`p`);e.className=`mb-2 border-b border-edge-subtle px-1 pb-2 text-xs text-fg-muted dark:border-edge`,e.textContent=i,a.appendChild(e)}let f=document.createElement(`table`);f.className=`table-fixed border-separate border-spacing-0 bg-white text-slate-900`,f.setAttribute(`aria-label`,r);let p=document.createElement(`colgroup`),m=document.createElement(`col`);m.style.width=`${d}px`,p.appendChild(m);let x=d;for(let e=t.s.c;e<=l;e+=1){let t=h(n[`!cols`]?.[e]),r=document.createElement(`col`);r.style.width=`${t}px`,p.appendChild(r),x+=t}f.style.width=`${x}px`,f.appendChild(p);let S=document.createElement(`thead`),C=document.createElement(`tr`),w=document.createElement(`th`);w.className=`sticky left-0 top-0 z-30 border-b border-r border-slate-300 bg-slate-100 text-[11px] font-medium text-slate-500`,w.setAttribute(`aria-hidden`,`true`),C.appendChild(w);for(let n=t.s.c;n<=l;n+=1){let t=document.createElement(`th`);t.className=`sticky top-0 z-20 h-7 border-b border-r border-slate-300 bg-slate-100 px-2 text-center text-[11px] font-medium text-slate-600`,t.scope=`col`,t.textContent=e.utils.encode_col(n),C.appendChild(t)}S.appendChild(C),f.appendChild(S);let T=document.createElement(`tbody`),{anchors:E,covered:D}=b(n[`!merges`]??[],t.s.r,c,t.s.c,l);for(let r=t.s.r;r<=c;r+=1){let i=document.createElement(`tr`),a=g(n[`!rows`]?.[r]);a&&(i.style.height=`${a}px`);let o=document.createElement(`th`);o.className=`sticky left-0 z-10 w-[46px] border-b border-r border-slate-300 bg-slate-100 px-1 text-center text-[11px] font-medium text-slate-500`,o.scope=`row`,o.textContent=String(r+1),i.appendChild(o);for(let a=t.s.c;a<=l;a+=1){let t=`${r}:${a}`;if(D.has(t))continue;let o=n[e.utils.encode_cell({r,c:a})],s=E.get(t),c=y(e,o),l=_(o),u=document.createElement(`td`);u.className=`overflow-hidden border-b border-r border-slate-200 px-2 py-1 text-xs leading-5`,u.colSpan=s?.colSpan??1,u.rowSpan=s?.rowSpan??1,u.style.verticalAlign=`middle`,u.style.textAlign=s?`center`:o?.t===`n`||o?.t===`d`?`right`:`left`,l&&(u.style.backgroundColor=l,u.style.color=v(l)),c.includes(`
12
- `)?u.style.whiteSpace=`pre-wrap`:u.style.whiteSpace=`nowrap`,c&&(u.title=o?.f?`${c}\n=${o.f}`:c),u.textContent=c,i.appendChild(u)}T.appendChild(i)}return f.appendChild(T),a.appendChild(f),{element:a,truncated:u}}catch(e){let t=document.createElement(`p`);return t.className=`p-4 text-sm text-red-600 dark:text-red-400`,t.textContent=e instanceof Error?e.message:String(e),a.appendChild(t),{element:a,truncated:!1}}}export{x as buildExcelSheetDomWithXlsx,c as renderDocxInContainer,l as renderExcelInContainer,s as renderPdfInContainer};
11
+ `,t.classList.add(`docx-preview-host`),t.appendChild(o),{cleanup:()=>{t.innerHTML=``,t.classList.remove(`docx-preview-host`)}}}async function c(t,n,r){let i=await e(()=>import(`./xlsx-CKkngM-o.js`),[]),a=i.read(n,{type:`array`,cellDates:!0,cellStyles:!0});t.innerHTML=``;let o=document.createElement(`div`);o.className=`flex h-full min-h-0 flex-col overflow-hidden bg-white`,t.appendChild(o);let s=a.SheetNames??[];if(s.length===0){let e=document.createElement(`p`);return e.className=`p-4 text-sm text-fg-muted`,e.textContent=`(No sheets in workbook.)`,o.appendChild(e),{truncated:!1,cleanup:()=>{t.innerHTML=``}}}let c=!1;if(s.length>1){let e=document.createElement(`div`);e.className=`z-30 flex shrink-0 gap-1 overflow-x-auto border-b border-edge bg-surface-panel px-2 pt-1 dark:border-edge`;let t=[];s.forEach((n,o)=>{let s=document.createElement(`button`);s.type=`button`,s.textContent=n,s.className=o===0?`shrink-0 border-b-2 border-accent px-3 py-2 text-xs font-medium text-accent`:`shrink-0 border-b-2 border-transparent px-3 py-2 text-xs font-medium text-fg-muted hover:border-edge hover:text-fg`;let l=document.createElement(`div`);l.style.display=o===0?`flex`:`none`,l.className=`min-h-0 flex-1 overflow-hidden`;let u=b(i,a.Sheets[n],n,r?.truncationNotice);u.truncated&&(c=!0),l.appendChild(u.element),t.push(l),s.onclick=()=>{e.querySelectorAll(`button`).forEach((e,t)=>{t===o?e.className=`shrink-0 border-b-2 border-accent px-3 py-2 text-xs font-medium text-accent`:e.className=`shrink-0 border-b-2 border-transparent px-3 py-2 text-xs font-medium text-fg-muted hover:border-edge hover:text-fg`}),t.forEach((e,t)=>{e.style.display=t===o?`flex`:`none`})},e.appendChild(s)}),o.appendChild(e),t.forEach(e=>{o.appendChild(e)})}else{let e=s[0],t=b(i,a.Sheets[e],e,r?.truncationNotice);c=t.truncated,o.appendChild(t.element)}return{truncated:c,cleanup:()=>{t.innerHTML=``}}}var l=80,u=46,d=28,f=480;function p(e,t,n){return Math.min(n,Math.max(t,e))}function m(e){if(!e)return l;if(typeof e.wpx==`number`&&Number.isFinite(e.wpx))return p(e.wpx,d,f);let t=e.wch??e.width;return typeof t==`number`&&Number.isFinite(t)?p(Math.round(t*7+12),d,f):l}function h(e){if(e){if(typeof e.hpx==`number`&&Number.isFinite(e.hpx))return p(e.hpx,16,240);if(typeof e.hpt==`number`&&Number.isFinite(e.hpt))return p(Math.round(e.hpt*(96/72)),16,240)}}function g(e){let t=e?.s;if(!t?.fgColor?.rgb||t.patternType===`none`)return;let n=t.fgColor.rgb.replace(/^#/,``).slice(-6);return/^[0-9a-f]{6}$/i.test(n)?`#${n}`:void 0}function _(e){let t=e.slice(1).match(/.{2}/g)?.map(e=>Number.parseInt(e,16));return!t||t.length!==3?`#0f172a`:(t[0]*299+t[1]*587+t[2]*114)/1e3<132?`#ffffff`:`#0f172a`}function v(e,t){if(!t||t.t===`z`)return``;if(typeof t.w==`string`)return t.w;try{return e.utils.format_cell(t)}catch{return t.v==null?``:String(t.v)}}function y(e,t,n,r,i){let a=new Map,o=new Set;for(let s of e){let e=Math.max(t,s.s.r),c=Math.min(n,s.e.r),l=Math.max(r,s.s.c),u=Math.min(i,s.e.c);if(e>c||l>u)continue;let d=`${e}:${l}`;a.set(d,{rowSpan:c-e+1,colSpan:u-l+1});for(let t=e;t<=c;t+=1)for(let n=l;n<=u;n+=1)(t!==e||n!==l)&&o.add(`${t}:${n}`)}return{anchors:a,covered:o}}function b(e,n,r,i){let a=document.createElement(`div`);if(a.className=`min-h-0 flex-1 overflow-auto bg-white`,!n){let e=document.createElement(`p`);return e.className=`p-4 text-sm text-fg-muted`,e.textContent=`Sheet "${r}" is missing from the workbook.`,a.appendChild(e),{element:a,truncated:!1}}if(!t(n)){let e=document.createElement(`p`);return e.className=`p-4 text-sm text-fg-muted`,e.textContent=`(Empty sheet — no cell range.)`,a.appendChild(e),{element:a,truncated:!1}}try{let t=e.utils.decode_range(n[`!ref`]),o=t.e.r-t.s.r+1,s=t.e.c-t.s.c+1,c=Math.min(t.e.r,t.s.r+500-1),l=Math.min(t.e.c,t.s.c+64-1),d=o>500||s>64;if(d&&i){let e=document.createElement(`p`);e.className=`mb-2 border-b border-edge-subtle px-1 pb-2 text-xs text-fg-muted dark:border-edge`,e.textContent=i,a.appendChild(e)}let f=document.createElement(`table`);f.className=`table-fixed border-separate border-spacing-0 bg-white text-slate-900`,f.setAttribute(`aria-label`,r);let p=document.createElement(`colgroup`),b=document.createElement(`col`);b.style.width=`${u}px`,p.appendChild(b);let x=u;for(let e=t.s.c;e<=l;e+=1){let t=m(n[`!cols`]?.[e]),r=document.createElement(`col`);r.style.width=`${t}px`,p.appendChild(r),x+=t}f.style.width=`${x}px`,f.appendChild(p);let S=document.createElement(`thead`),C=document.createElement(`tr`),w=document.createElement(`th`);w.className=`sticky left-0 top-0 z-30 border-b border-r border-slate-300 bg-slate-100 text-[11px] font-medium text-slate-500`,w.setAttribute(`aria-hidden`,`true`),C.appendChild(w);for(let n=t.s.c;n<=l;n+=1){let t=document.createElement(`th`);t.className=`sticky top-0 z-20 h-7 border-b border-r border-slate-300 bg-slate-100 px-2 text-center text-[11px] font-medium text-slate-600`,t.scope=`col`,t.textContent=e.utils.encode_col(n),C.appendChild(t)}S.appendChild(C),f.appendChild(S);let T=document.createElement(`tbody`),{anchors:E,covered:D}=y(n[`!merges`]??[],t.s.r,c,t.s.c,l);for(let r=t.s.r;r<=c;r+=1){let i=document.createElement(`tr`),a=h(n[`!rows`]?.[r]);a&&(i.style.height=`${a}px`);let o=document.createElement(`th`);o.className=`sticky left-0 z-10 w-[46px] border-b border-r border-slate-300 bg-slate-100 px-1 text-center text-[11px] font-medium text-slate-500`,o.scope=`row`,o.textContent=String(r+1),i.appendChild(o);for(let a=t.s.c;a<=l;a+=1){let t=`${r}:${a}`;if(D.has(t))continue;let o=n[e.utils.encode_cell({r,c:a})],s=E.get(t),c=v(e,o),l=g(o),u=document.createElement(`td`);u.className=`overflow-hidden border-b border-r border-slate-200 px-2 py-1 text-xs leading-5`,u.colSpan=s?.colSpan??1,u.rowSpan=s?.rowSpan??1,u.style.verticalAlign=`middle`,u.style.textAlign=s?`center`:o?.t===`n`||o?.t===`d`?`right`:`left`,l&&(u.style.backgroundColor=l,u.style.color=_(l)),c.includes(`
12
+ `)?u.style.whiteSpace=`pre-wrap`:u.style.whiteSpace=`nowrap`,c&&(u.title=o?.f?`${c}\n=${o.f}`:c),u.textContent=c,i.appendChild(u)}T.appendChild(i)}return f.appendChild(T),a.appendChild(f),{element:a,truncated:d}}catch(e){let t=document.createElement(`p`);return t.className=`p-4 text-sm text-red-600 dark:text-red-400`,t.textContent=e instanceof Error?e.message:String(e),a.appendChild(t),{element:a,truncated:!1}}}export{b as buildExcelSheetDomWithXlsx,s as renderDocxInContainer,c as renderExcelInContainer,o as renderPdfInContainer};
@@ -0,0 +1,5 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jszip.min-DT31yWkU.js","assets/rolldown-runtime-aKtaBQYM.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{t}from"./preload-helper-zJ_50EbN.js";import"./pdf-runtime-DU_sMPjG.js";var n=120,r=12e5;function i(e){let t=[];try{if(typeof DOMParser>`u`){let n=/<a:t[^>]*>([^<]*)<\/a:t>/g,r;for(;(r=n.exec(e))!==null;){let e=r[1]?.trim();e&&t.push(e)}return t}let n=new DOMParser().parseFromString(e,`text/xml`);if(n.querySelector(`parsererror`))return t;let r=n.getElementsByTagNameNS(`http://schemas.openxmlformats.org/drawingml/2006/main`,`t`);if(r.length>0){for(let e=0;e<r.length;e++){let n=r[e]?.textContent?.trim();n&&t.push(n)}return t}let i=n.querySelectorAll(`*|t`);for(let e=0;e<i.length;e++){let n=i[e]?.textContent?.trim();n&&t.push(n)}}catch{}return t}async function a(a,o){let s=(await t(async()=>{let{default:t}=await import(`./jszip.min-DT31yWkU.js`).then(t=>e(t.default,1));return{default:t}},__vite__mapDeps([0,1]))).default;try{let e=await s.loadAsync(a),t=`<pptx filename="${o}">`,c=Object.keys(e.files).filter(e=>e.match(/ppt\/slides\/slide\d+\.xml$/)).sort((e,t)=>Number.parseInt(e.match(/slide(\d+)\.xml$/)?.[1]||`0`,10)-Number.parseInt(t.match(/slide(\d+)\.xml$/)?.[1]||`0`,10)),l=Math.min(c.length,n);c.length>n&&(t+=`\n<!-- truncated: ${c.length} slides, processing first ${n} -->`);let u=await Promise.all(c.slice(0,l).map(async(t,n)=>{let r=e.file(t);return r?{i:n,slideXml:await r.async(`text`)}:{i:n,slideXml:null}})),d=async e=>{if(e>=u.length)return;if(t.length>=r){t+=`\n<!-- extraction stopped: size limit ${r} chars -->`;return}let{i:n,slideXml:a}=u[e];if(a){let e=i(a);if(e.length>0){t+=`\n<slide number="${n+1}">`;let i=e.join(`
3
+ `),a=r-t.length-32;t+=a>=i.length?`\n${i}`:`\n${i.slice(0,Math.max(0,a))}`,t+=`
4
+ </slide>`}}e%4==3&&e+1<u.length&&await new Promise(e=>setTimeout(e,0)),await d(e+1)};return await d(0),t+=`
5
+ </pptx>`,{extractedText:t}}catch(e){throw Error(`Failed to process PPTX: ${String(e)}`)}}export{a as processPptx};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./automations-workspace-DPnlkws1.js";var r=e(),i=t();function a(){let e=(0,r.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,i.jsx)(n,{}),e[0]=t):t=e[0],t}export{a as AutomationsPage};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./automations-workspace-B2-f9qZu.js";var r=e(),i=t();function a(){let e=(0,r.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,i.jsx)(n,{}),e[0]=t):t=e[0],t}export{a as AutomationsPage};