@xopcai/xopc 0.0.177 → 0.0.178
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-Wu2ikfbM.js → activity-store-BzGX__8I.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B0_biISn.js → agent-avatar-dicebear-BzxntcaZ.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-TpIpJk59.js → agents-DC9F12Kw.js} +1 -1
- package/dist/gateway/static/root/assets/{api-DljBt-N5.js → api-hi6f2Xtp.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CKoZRi7Y.js → app-management-settings-panel-fTY1F7ac.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DOdXhNDo.js → appearance-settings-BZ-IxQfB.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-Cxbn5hy8.js → apps-page-5bKr05Fa.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-D18gyP76.js → archive-plugin-ZSLLG8wB.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CZh9fc8u.js → attachment-load-D4YktqIF.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-DKrVoiiK.js → automation-suggestion-card-B7mxFRtf.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DYv16QMU.js → automations-page-Dg6dmt5g.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-DdSyGL6M.js → binary-plugins-BIkPxfxj.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BOpNApiX.js → block-editor-Q3v_YQom.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-DlcqaGu1.js → browser-settings-page-BHoo6Rpq.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-C0SnSj_R.js → browser-workflow-inputs-M5lTEW1I.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CzlzH7HA.js → browser-workflows-page-B3T1KYk4.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-QPX4wsGZ.js → capabilities-settings-panel-BlsqN8Fu.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-api-RM6S7ES5.js → capability-presets-api-DE09c0VB.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-DmCeusO8.js → capability-presets-settings-panel-DJeT8_B4.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-B4sha-30.js → channel-recipient-api-CFR5FBfS.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-HcKoP1wm.js → channels-settings-C4VVjYEm.js} +1 -1
- package/dist/gateway/static/root/assets/channels-status-swr-vdf8kB16.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-BPsKIyoM.js → connector-logo-B1mD-3pM.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-DwbThFvd.js → connectors-page-DNcrDThX.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DjL1GWON.js → desktop-pet-B1urphOZ.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-u_abAXh7.js → desktop-pet-settings-DTL6J3EP.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BoZGualI.js → directory-picker-path-field-BYQJ2XUS.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-s3gn3f9h.js → dreaming-settings-BXcb8fwx.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DIbMngCF.js → extension-debug-page-O1Xu1r4Q.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-D94f2bWQ.js → extension-page-C2Jraq8l.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-B7TI13ex.js → extension-settings-page-DcXQDTpG.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-Do77rV8R.js → gateway-config-api-DmPIZrvg.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-Dt1PNJmb.js → gateway-settings-DmObBx9b.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-WaXTw3fi.js → gateway-startup-retry-BZEkOdPm.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-DEiOOLGU.js → goal-create-dialog-BRhmmBe9.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-detail-page-C1Qj4o1K.js → goal-detail-page-C1k7_s_O.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-config-api-BL0fAEns.js → goals-config-api-Fwu1wjEP.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-page-qJDcEDzc.js → goals-page-hOu9uA3q.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-settings-DV3ZlrdI.js → goals-settings-DY-JjvHz.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-C3kzg6ai.js → heartbeat-settings-BtKu2NWT.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-BgISY8i-.js → image-generation-api-05Gg8wsU.js} +1 -1
- package/dist/gateway/static/root/assets/{index-C1h0zkNo.js → index-C0CGebQ1.js} +7 -7
- package/dist/gateway/static/root/assets/index-eqq25gvV.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-0KSmaPu0.js → keyboard-shortcuts-settings-CfmDR9Sc.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-DcD4mVId.js → local-app-workbench-page-EjsNT7nJ.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BMrU8u7w.js → local-apps-page-Df8BW1A_.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DVGhFXRz.js → locale-store-CTwSy7yW.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CW5m9Cov.js → logs-page-Dswjlraa.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-BVqbtN9o.js → markdown-split-B3FvKbaP.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Dr_wtkNJ.js → media-plugins-DsjrvvB6.js} +1 -1
- package/dist/gateway/static/root/assets/messages-DP6tPKk-.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-BWZRXsq6.js → notes-page-tuzIwy3c.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-DdnwNz9x.js → notes-workbench-DSh3-hMY.js} +2 -2
- package/dist/gateway/static/root/assets/{page-tabs-DWWgy0bF.js → page-tabs-ke9s4nYi.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Bnfs93ZP.js → preview-open-alternatives-Cp1eI4S9.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-BR7QFmT-.js → product-open-page-dXQCMAtH.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-B8GeS4dl.js → project-detail-page-D0QPRHR_.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-DOeu1Hk_.js → projects-page-CI5Vz62F.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-De94rxnE.js → remote-access-hub-S1jpzBS5.js} +1 -1
- package/dist/gateway/static/root/assets/{save-bar-controls-BzS-rRTP.js → save-bar-controls-Bl30zjHc.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-Cl2IIDAN.js → schedule-field-DqhmXQKo.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-BjKjp5eZ.js → schema-form-DkUCy6vf.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-A7p8G0OJ.js → sessions-page-CTm66k7h.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CU52AUVD.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BSDNBfHn.js → settings-form-section-C6ZbNpdy.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-BD4peoAv.js → settings-loading-skeleton-Bk58_cr7.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-S-P3U7at.js → settings-page-k8iE_NdX.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-BQTLh-86.js → settings-page-layout-DgFSya2e.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-W3p6kNyA.js → setup-status-panel-B_KDlyZA.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-DQjMxyvw.js → share-preview-page-CV7nL_J9.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-Xo3N99PO.js → shares-settings-DK6XK95e.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Bvv_u4ii.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-C019Ml5q.js → skills-page-BGHvVbay.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-CXnpudm6.js → skills-page.utils-kahBIHg0.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BhFwdYJP.js → system-settings-panel-JV3-MG5F.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DQI-HPL-.js → theme-store-DFLyzoLO.js} +1 -1
- package/dist/gateway/static/root/assets/{time-picker-C0DCya4U.js → time-picker-XwpxdZFr.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-C-M3Fv2N.js → typed-models-lib-60Aqo-UJ.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-Bndq4y4I.js → use-channel-catalog-CnTkHDnw.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-fYBzpus-.js → user-context-page-DBCMk-Vn.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-p_g4UI1-.js → voice-api-key-field-CNa8qUgS.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-DI0gCZRw.js → work-discovery-page-C1UIdsCl.js} +1 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-DEAQepB8.js +1 -0
- package/dist/gateway/static/root/assets/{work-page-Z-nUaS_n.js → work-page-D5qYmCTq.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CHEXVvhH.js → workflow-run-setup-panel-yV_x595t.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-BDfwnM-Y.js → workflows-page-yrK17ZZ5.js} +1 -1
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +3 -0
- package/dist/src/agent/embedded/run-for-session.js +18 -5
- package/dist/src/agent/embedded/run-turn.js +6 -3
- package/dist/src/agent/embedded/types.d.ts +2 -0
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/connectors/composio-sessions.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/routes/browser-install.js +1 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/providers/provider-auth-service.js +3 -0
- package/dist/src/providers/register-bundled-oauth-flows.d.ts +2 -0
- package/dist/src/providers/register-bundled-oauth-flows.js +16 -0
- package/dist/src/session/store.d.ts +2 -0
- package/dist/src/session/store.js +30 -0
- package/package.json +3 -11
- package/dist/gateway/static/root/assets/channels-status-swr-D3xr2enH.js +0 -1
- package/dist/gateway/static/root/assets/index-Da36E3WH.css +0 -1
- package/dist/gateway/static/root/assets/messages-r8L6Ur3A.js +0 -3
- package/dist/gateway/static/root/assets/settings-advanced-gate-BsGzjmqx.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-ByPEG5t1.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-DnBRP2wI.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,s as t}from"./locale-store-
|
|
1
|
+
import{r as e,s as t}from"./locale-store-CTwSy7yW.js";async function n(){return(await t(e(`/api/local-apps`))).apps}async function r(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}`))).app}async function i(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/validate`),{method:`POST`})).validation}async function a(n,r,i){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/acceptance-runs`),{method:`POST`,body:JSON.stringify({sourceHash:r,...i})})).acceptance}async function o(n){return(await t(e(`/api/local-apps`),{method:`POST`,body:JSON.stringify(n)})).app}async function s(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`POST`})).app}async function c(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/releases/${encodeURIComponent(r)}/rollback`),{method:`POST`})).app}async function l(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/${r?`enable`:`disable`}`),{method:`POST`})).app}async function u(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`DELETE`})).app}export{a,u as c,n as i,i as l,r as n,c as o,s as r,l as s,o as t};
|
|
@@ -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"./cn-JdwAhgNB.js";import{t as a}from"./copy-to-clipboard-HOJ79TWv.js";import{t as o}from"./messages-r8L6Ur3A.js";import{n as s,r as c,s as l}from"./locale-store-DVGhFXRz.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{As as d,Go as f,Ho as p,Ko as m,Nt as h,Uo as g,Vc as _,Vo as v,Wo as y,Zl as b,ls as x,ro as S,us as C,ws as w,zo as T}from"./index-C1h0zkNo.js";import{n as E,r as D}from"./settings-page-layout-BQTLh-86.js";import{t as O}from"./settings-loading-skeleton-BD4peoAv.js";import{r as k,t as A}from"./settings-form-section-BSDNBfHn.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,o]=(0,M.useReducer)(h,L),{info:s,loadError:c,actionError:l,copiedField:u,clearDialogOpen:m,clearConfirmChecked:S,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:k,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){o({type:`patch`,patch:{loadError:null}});try{o({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){o({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await a(e)){o({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>o({type:`patch`,patch:{copiedField:null}}),2e3);return}o({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:k});n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(c)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c});if(!s)return(0,N.jsx)(O,{rows:2});let H=!s.packaged,U=j||s.pendingUpdate||H,W=!H&&s.uninstallMode!==`unsupported`,G=I(s,t),K=S&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(A,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(_,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,l?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:l}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,s.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,w.press),onClick:()=>void z(s.appPath,`app`),children:[(0,N.jsx)(b,{className:`size-3`,"aria-hidden":!0}),u===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,w.press),onClick:()=>void z(s.dataPath,`data`),children:[(0,N.jsx)(b,{className:`size-3`,"aria-hidden":!0}),u===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(s.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,w.press),onClick:()=>{o({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,w.press),onClick:()=>{o({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(T,{open:m,onOpenChange:e=>{e||o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(y,{children:[(0,N.jsx)(g,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,C)}),(0,N.jsxs)(v,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,x,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(f,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(p,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:S,onChange:e=>o({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>o({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(d,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(d,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j||!K,onClick:()=>void B(),children:t.confirmClear})]})]})]})}),W?(0,N.jsx)(T,{open:D,onOpenChange:e=>{e||o({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(y,{children:[(0,N.jsx)(g,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,C)}),(0,N.jsxs)(v,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,x,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(f,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(p,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:k,onChange:e=>o({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),k?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(d,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>o({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(d,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await l(c(`/api/migrations/status`))).payload}async function B(){await l(c(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=u(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function l(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,N.jsx)(S,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(S,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let f=t?.items??[],p=f.filter(e=>e.status===`conflict`||e.status===`error`),m=f.filter(e=>e.safety===`auto`&&e.status===`planned`),h=p.length>0||f.some(e=>e.safety!==`auto`);return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:f.length===0?e.upToDate:h?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(m.length))})]}),m.length>0&&!h?(0,N.jsx)(d,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),f.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:f.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=s(U),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,a=typeof window<`u`?window.electronAPI?.system:void 0;if(!m()||!a){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=k(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let c;e[18]===i.title?c=e[19]:(c=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=c);let l;e[20]===i.migrations?l=e[21]:(l=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,N.jsx)(R,{api:a,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==c||e[25]!==l||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[c,l,u]}),e[24]=c,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function U(e){return e.language}export{H as AppManagementSettingsPanel};
|
|
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"./cn-JdwAhgNB.js";import{t as a}from"./copy-to-clipboard-HOJ79TWv.js";import{t as o}from"./messages-DP6tPKk-.js";import{n as s,r as c,s as l}from"./locale-store-CTwSy7yW.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{As as d,Go as f,Ho as p,Ko as m,Nt as h,Uo as g,Vc as _,Vo as v,Wo as y,Zl as b,ls as x,ro as S,us as C,ws as w,zo as T}from"./index-C0CGebQ1.js";import{n as E,r as D}from"./settings-page-layout-DgFSya2e.js";import{t as O}from"./settings-loading-skeleton-Bk58_cr7.js";import{r as k,t as A}from"./settings-form-section-C6ZbNpdy.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,o]=(0,M.useReducer)(h,L),{info:s,loadError:c,actionError:l,copiedField:u,clearDialogOpen:m,clearConfirmChecked:S,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:k,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){o({type:`patch`,patch:{loadError:null}});try{o({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){o({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await a(e)){o({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>o({type:`patch`,patch:{copiedField:null}}),2e3);return}o({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:k});n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(c)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c});if(!s)return(0,N.jsx)(O,{rows:2});let H=!s.packaged,U=j||s.pendingUpdate||H,W=!H&&s.uninstallMode!==`unsupported`,G=I(s,t),K=S&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(A,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(_,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,l?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:l}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,s.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,w.press),onClick:()=>void z(s.appPath,`app`),children:[(0,N.jsx)(b,{className:`size-3`,"aria-hidden":!0}),u===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:s.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,w.press),onClick:()=>void z(s.dataPath,`data`),children:[(0,N.jsx)(b,{className:`size-3`,"aria-hidden":!0}),u===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(s.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,w.press),onClick:()=>{o({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,w.press),onClick:()=>{o({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(T,{open:m,onOpenChange:e=>{e||o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(y,{children:[(0,N.jsx)(g,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,C)}),(0,N.jsxs)(v,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,x,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(f,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(p,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:S,onChange:e=>o({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>o({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(d,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(d,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j||!K,onClick:()=>void B(),children:t.confirmClear})]})]})]})}),W?(0,N.jsx)(T,{open:D,onOpenChange:e=>{e||o({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(y,{children:[(0,N.jsx)(g,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,C)}),(0,N.jsxs)(v,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,x,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(f,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(p,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:k,onChange:e=>o({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),k?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(d,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>o({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(d,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await l(c(`/api/migrations/status`))).payload}async function B(){await l(c(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=u(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function l(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,N.jsx)(S,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(S,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let f=t?.items??[],p=f.filter(e=>e.status===`conflict`||e.status===`error`),m=f.filter(e=>e.safety===`auto`&&e.status===`planned`),h=p.length>0||f.some(e=>e.safety!==`auto`);return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:f.length===0?e.upToDate:h?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(m.length))})]}),m.length>0&&!h?(0,N.jsx)(d,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),disabled:a,children:a?e.applying:e.apply}):null]}),f.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:f.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=s(U),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,a=typeof window<`u`?window.electronAPI?.system:void 0;if(!m()||!a){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=k(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let c;e[18]===i.title?c=e[19]:(c=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=c);let l;e[20]===i.migrations?l=e[21]:(l=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,N.jsx)(R,{api:a,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==c||e[25]!==l||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[c,l,u]}),e[24]=c,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function U(e){return e.language}export{H as AppManagementSettingsPanel};
|
|
@@ -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"./cn-JdwAhgNB.js";import{t as a}from"./messages-r8L6Ur3A.js";import{n as o,r as s,s as c}from"./locale-store-DVGhFXRz.js";import{i as l}from"./theme-store-DQI-HPL-.js";import{Dt as u,es as d,is as f,no as p,ns as m,ro as h,to as g,ws as _}from"./index-C1h0zkNo.js";import{n as v,r as y}from"./settings-page-layout-BQTLh-86.js";import{t as b}from"./settings-advanced-gate-BsGzjmqx.js";var x=e(t(),1),S=n();function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function w(e){let t=C(e)?e:{},n=C(t.gateway)?t.gateway:{},r=(C(n.webchat)?n.webchat:{}).activityDetailDefault;return r===`off`||r===`stream`||r===`on`?r:`on`}async function T(e){await c(s(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{webchat:{activityDetailDefault:e}}})}),await g()}var E=r();function D(){return i(`rounded-xl bg-surface-base px-4 py-1 sm:px-5`)}var O={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},mono:{light:{canvas:`#ffffff`,panel:`#f5f5f5`,accent:`#111111`,fg:`#111111`,muted:`#e5e7eb`},dark:{canvas:`#101010`,panel:`#1a1a1a`,accent:`#737373`,fg:`#fafafa`,muted:`#333333`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}}};function k(e){let t=(0,S.c)(24),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]!==o||t[3]!==r?(c={backgroundColor:r,borderColor:o},t[2]=o,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,E.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[5]=i,t[6]=l);let u;t[7]===a?u=t[8]:(u=(0,E.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[7]=a,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let f;t[12]===o?f=t[13]:(f=(0,E.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[12]=o,t[13]=f);let p;t[14]===o?p=t[15]:(p=(0,E.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[14]=o,t[15]=p);let m;t[16]!==c||t[17]!==d||t[18]!==f||t[19]!==p?(m=(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm border p-1`,style:c,children:[d,f,p]}),t[16]=c,t[17]=d,t[18]=f,t[19]=p,t[20]=m):m=t[20];let h;return t[21]!==s||t[22]!==m?(h=(0,E.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:m}),t[21]=s,t[22]=m,t[23]=h):h=t[23],h}function A(e){let t=(0,S.c)(8),{scheme:n}=e,{light:r,dark:i}=O[n],a;t[0]===r?a=t[1]:(a=(0,E.jsx)(k,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,E.jsx)(k,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,E.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md border border-edge-subtle`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var j=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`mono`,labelKey:`colorSchemeModernMono`},{value:`clay`,labelKey:`colorSchemeClay`}];function M(){let e=(0,S.c)(18),t=o(F),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,s=l(P),c=l(N),u;e[2]===r.colorSchemeTitle?u=e[3]:(u=(0,E.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:r.colorSchemeTitle}),e[2]=r.colorSchemeTitle,e[3]=u);let d;e[4]===r.colorSchemeDescription?d=e[5]:(d=(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:r.colorSchemeDescription}),e[4]=r.colorSchemeDescription,e[5]=d);let f;e[6]!==u||e[7]!==d?(f=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[u,d]}),e[6]=u,e[7]=d,e[8]=f):f=e[8];let p;e[9]!==r||e[10]!==s||e[11]!==c?(p=j.map(e=>{let{value:t,labelKey:n}=e,a=s===t;return(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":a,onClick:()=>c(t),className:i(`flex flex-col gap-2 rounded-xl border-2 p-2.5 text-left transition-[border-color,box-shadow,transform] duration-150`,_.pressCard,a?`border-accent shadow-[0_0_0_1px_var(--color-accent)]`:`border-edge-subtle hover:border-edge`),children:[(0,E.jsx)(A,{scheme:t}),(0,E.jsx)(`span`,{className:i(`text-xs font-medium leading-none`,a?`text-accent-fg`:`text-fg-muted`),children:r[n]})]},t)}),e[9]=r,e[10]=s,e[11]=c,e[12]=p):p=e[12];let m;e[13]===p?m=e[14]:(m=(0,E.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:p}),e[13]=p,e[14]=m);let h;return e[15]!==f||e[16]!==m?(h=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/50 p-3.5 sm:py-4`,children:[f,m]}),e[15]=f,e[16]=m,e[17]=h):h=e[17],h}function N(e){return e.setColorScheme}function P(e){return e.colorScheme}function F(e){return e.language}function I(){let e=(0,S.c)(31),t=o(L),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,{data:s,isLoading:c}=p(!0),l=s?.payload?.config,u;e[2]===l?u=e[3]:(u=w(l),e[2]=l,e[3]=u);let d=u,[g,_]=(0,x.useState)(d),[v,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),D,O;e[4]===d?(D=e[5],O=e[6]):(D=()=>_(d),O=[d],e[4]=d,e[5]=D,e[6]=O),(0,x.useEffect)(D,O);let k;e[7]===g?k=e[8]:(k=e=>{let t=g;_(e),y(!0),C(!1),T(e).catch(()=>{_(t),C(!0)}).finally(()=>y(!1))},e[7]=g,e[8]=k);let A=k,j;e[9]===r.activityDetailDefaultTitle?j=e[10]:(j=(0,E.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:r.activityDetailDefaultTitle}),e[9]=r.activityDetailDefaultTitle,e[10]=j);let M;e[11]===r.activityDetailDefaultDescription?M=e[12]:(M=(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:r.activityDetailDefaultDescription}),e[11]=r.activityDetailDefaultDescription,e[12]=M);let N;e[13]!==j||e[14]!==M?(N=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[j,M]}),e[13]=j,e[14]=M,e[15]=N):N=e[15];let P;e[16]!==r.activityDetailLevels||e[17]!==A||e[18]!==c||e[19]!==g||e[20]!==v?(P=c?(0,E.jsx)(h,{className:`h-10 w-full rounded-lg sm:max-w-sm`}):(0,E.jsxs)(m,{value:g,disabled:v,onChange:e=>A(e.target.value),triggerClassName:`sm:max-w-sm`,children:[(0,E.jsx)(f,{value:`off`,children:r.activityDetailLevels.off}),(0,E.jsx)(f,{value:`on`,children:r.activityDetailLevels.on}),(0,E.jsx)(f,{value:`stream`,children:r.activityDetailLevels.stream})]}),e[16]=r.activityDetailLevels,e[17]=A,e[18]=c,e[19]=g,e[20]=v,e[21]=P):P=e[21];let F=b?`text-red-600 dark:text-red-400`:`text-fg-subtle`,I;e[22]===F?I=e[23]:(I=i(`min-h-4 text-xs`,F),e[22]=F,e[23]=I);let R=b?r.activityDetailSaveError:v?r.activityDetailSaving:r.activityDetailDefaultHint,z;e[24]!==I||e[25]!==R?(z=(0,E.jsx)(`p`,{className:I,children:R}),e[24]=I,e[25]=R,e[26]=z):z=e[26];let B;return e[27]!==z||e[28]!==N||e[29]!==P?(B=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[N,P,z]}),e[27]=z,e[28]=N,e[29]=P,e[30]=B):B=e[30],B}function L(e){return e.language}function R(){let e=(0,S.c)(27),t=o(V),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=u(B),s=u(z),c;e[2]===r.developerGroupTitle?c=e[3]:(c=(0,E.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:r.developerGroupTitle}),e[2]=r.developerGroupTitle,e[3]=c);let l;e[4]===r.developerGroupDescription?l=e[5]:(l=(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:r.developerGroupDescription}),e[4]=r.developerGroupDescription,e[5]=l);let d;e[6]!==c||e[7]!==l?(d=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[c,l]}),e[6]=c,e[7]=l,e[8]=d):d=e[8];let f;e[9]===r.showRawToolDataTitle?f=e[10]:(f=(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.showRawToolDataTitle}),e[9]=r.showRawToolDataTitle,e[10]=f);let p;e[11]===r.showRawToolDataDescription?p=e[12]:(p=(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.showRawToolDataDescription}),e[11]=r.showRawToolDataDescription,e[12]=p);let m;e[13]!==f||e[14]!==p?(m=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[f,p]}),e[13]=f,e[14]=p,e[15]=m):m=e[15];let h;e[16]===s?h=e[17]:(h=e=>s(e.target.checked),e[16]=s,e[17]=h);let g;e[18]!==i||e[19]!==h?(g=(0,E.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i,onChange:h}),e[18]=i,e[19]=h,e[20]=g):g=e[20];let _;e[21]!==m||e[22]!==g?(_=(0,E.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[m,g]}),e[21]=m,e[22]=g,e[23]=_):_=e[23];let v;return e[24]!==d||e[25]!==_?(v=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[d,_]}),e[24]=d,e[25]=_,e[26]=v):v=e[26],v}function z(e){return e.setShowRawToolData}function B(e){return e.showRawToolData}function V(e){return e.language}function H(){let e=(0,S.c)(30),t=o(U),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i;e[2]!==r.pageTitle||e[3]!==r.subtitle?(i=(0,E.jsx)(v,{title:r.pageTitle,subtitle:r.subtitle}),e[2]=r.pageTitle,e[3]=r.subtitle,e[4]=i):i=e[4];let s;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=D(),e[5]=s):s=e[5];let c;e[6]===r.languageTitle?c=e[7]:(c=(0,E.jsx)(`h2`,{id:`pref-language-heading`,className:`sr-only`,children:r.languageTitle}),e[6]=r.languageTitle,e[7]=c);let l;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,E.jsx)(d,{variant:`page`,sections:[`language`]}),e[8]=l):l=e[8];let u;e[9]===c?u=e[10]:(u=(0,E.jsxs)(`section`,{className:s,"aria-labelledby":`pref-language-heading`,children:[c,l]}),e[9]=c,e[10]=u);let f;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(f=D(),e[11]=f):f=e[11];let p;e[12]===r.themeTitle?p=e[13]:(p=(0,E.jsx)(`h2`,{id:`pref-appearance-heading`,className:`sr-only`,children:r.themeTitle}),e[12]=r.themeTitle,e[13]=p);let m,h,g;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,E.jsx)(d,{variant:`page`,sections:[`theme`,`font`]}),g=(0,E.jsx)(M,{}),m=(0,E.jsx)(I,{}),e[14]=m,e[15]=h,e[16]=g):(m=e[14],h=e[15],g=e[16]);let _;e[17]===p?_=e[18]:(_=(0,E.jsxs)(`section`,{className:f,"aria-labelledby":`pref-appearance-heading`,children:[p,h,g,m]}),e[17]=p,e[18]=_);let x;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(x=D(),e[19]=x):x=e[19];let C;e[20]===r.developerGroupTitle?C=e[21]:(C=(0,E.jsx)(`h2`,{id:`pref-developer-heading`,className:`sr-only`,children:r.developerGroupTitle}),e[20]=r.developerGroupTitle,e[21]=C);let w;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,E.jsx)(R,{}),e[22]=w):w=e[22];let T;e[23]===C?T=e[24]:(T=(0,E.jsx)(b,{children:(0,E.jsxs)(`section`,{className:x,"aria-labelledby":`pref-developer-heading`,children:[C,w]})}),e[23]=C,e[24]=T);let O;return e[25]!==i||e[26]!==_||e[27]!==T||e[28]!==u?(O=(0,E.jsxs)(y,{gap:`gap-6`,children:[i,u,_,T]}),e[25]=i,e[26]=_,e[27]=T,e[28]=u,e[29]=O):O=e[29],O}function U(e){return e.language}export{H as AppearanceSettingsPanel};
|
|
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"./cn-JdwAhgNB.js";import{t as a}from"./messages-DP6tPKk-.js";import{n as o,r as s,s as c}from"./locale-store-CTwSy7yW.js";import{i as l}from"./theme-store-DFLyzoLO.js";import{Dt as u,es as d,is as f,no as p,ns as m,ro as h,to as g,ws as _}from"./index-C0CGebQ1.js";import{n as v,r as y}from"./settings-page-layout-DgFSya2e.js";import{t as b}from"./settings-advanced-gate-CU52AUVD.js";var x=e(t(),1),S=n();function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function w(e){let t=C(e)?e:{},n=C(t.gateway)?t.gateway:{},r=(C(n.webchat)?n.webchat:{}).activityDetailDefault;return r===`off`||r===`stream`||r===`on`?r:`on`}async function T(e){await c(s(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{webchat:{activityDetailDefault:e}}})}),await g()}var E=r();function D(){return i(`rounded-xl bg-surface-base px-4 py-1 sm:px-5`)}var O={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},mono:{light:{canvas:`#ffffff`,panel:`#f5f5f5`,accent:`#111111`,fg:`#111111`,muted:`#e5e7eb`},dark:{canvas:`#101010`,panel:`#1a1a1a`,accent:`#737373`,fg:`#fafafa`,muted:`#333333`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}}};function k(e){let t=(0,S.c)(24),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]!==o||t[3]!==r?(c={backgroundColor:r,borderColor:o},t[2]=o,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,E.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[5]=i,t[6]=l);let u;t[7]===a?u=t[8]:(u=(0,E.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[7]=a,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let f;t[12]===o?f=t[13]:(f=(0,E.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[12]=o,t[13]=f);let p;t[14]===o?p=t[15]:(p=(0,E.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[14]=o,t[15]=p);let m;t[16]!==c||t[17]!==d||t[18]!==f||t[19]!==p?(m=(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm border p-1`,style:c,children:[d,f,p]}),t[16]=c,t[17]=d,t[18]=f,t[19]=p,t[20]=m):m=t[20];let h;return t[21]!==s||t[22]!==m?(h=(0,E.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:m}),t[21]=s,t[22]=m,t[23]=h):h=t[23],h}function A(e){let t=(0,S.c)(8),{scheme:n}=e,{light:r,dark:i}=O[n],a;t[0]===r?a=t[1]:(a=(0,E.jsx)(k,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,E.jsx)(k,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,E.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md border border-edge-subtle`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var j=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`mono`,labelKey:`colorSchemeModernMono`},{value:`clay`,labelKey:`colorSchemeClay`}];function M(){let e=(0,S.c)(18),t=o(F),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,s=l(P),c=l(N),u;e[2]===r.colorSchemeTitle?u=e[3]:(u=(0,E.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:r.colorSchemeTitle}),e[2]=r.colorSchemeTitle,e[3]=u);let d;e[4]===r.colorSchemeDescription?d=e[5]:(d=(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:r.colorSchemeDescription}),e[4]=r.colorSchemeDescription,e[5]=d);let f;e[6]!==u||e[7]!==d?(f=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[u,d]}),e[6]=u,e[7]=d,e[8]=f):f=e[8];let p;e[9]!==r||e[10]!==s||e[11]!==c?(p=j.map(e=>{let{value:t,labelKey:n}=e,a=s===t;return(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":a,onClick:()=>c(t),className:i(`flex flex-col gap-2 rounded-xl border-2 p-2.5 text-left transition-[border-color,box-shadow,transform] duration-150`,_.pressCard,a?`border-accent shadow-[0_0_0_1px_var(--color-accent)]`:`border-edge-subtle hover:border-edge`),children:[(0,E.jsx)(A,{scheme:t}),(0,E.jsx)(`span`,{className:i(`text-xs font-medium leading-none`,a?`text-accent-fg`:`text-fg-muted`),children:r[n]})]},t)}),e[9]=r,e[10]=s,e[11]=c,e[12]=p):p=e[12];let m;e[13]===p?m=e[14]:(m=(0,E.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:p}),e[13]=p,e[14]=m);let h;return e[15]!==f||e[16]!==m?(h=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/50 p-3.5 sm:py-4`,children:[f,m]}),e[15]=f,e[16]=m,e[17]=h):h=e[17],h}function N(e){return e.setColorScheme}function P(e){return e.colorScheme}function F(e){return e.language}function I(){let e=(0,S.c)(31),t=o(L),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,{data:s,isLoading:c}=p(!0),l=s?.payload?.config,u;e[2]===l?u=e[3]:(u=w(l),e[2]=l,e[3]=u);let d=u,[g,_]=(0,x.useState)(d),[v,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),D,O;e[4]===d?(D=e[5],O=e[6]):(D=()=>_(d),O=[d],e[4]=d,e[5]=D,e[6]=O),(0,x.useEffect)(D,O);let k;e[7]===g?k=e[8]:(k=e=>{let t=g;_(e),y(!0),C(!1),T(e).catch(()=>{_(t),C(!0)}).finally(()=>y(!1))},e[7]=g,e[8]=k);let A=k,j;e[9]===r.activityDetailDefaultTitle?j=e[10]:(j=(0,E.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:r.activityDetailDefaultTitle}),e[9]=r.activityDetailDefaultTitle,e[10]=j);let M;e[11]===r.activityDetailDefaultDescription?M=e[12]:(M=(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:r.activityDetailDefaultDescription}),e[11]=r.activityDetailDefaultDescription,e[12]=M);let N;e[13]!==j||e[14]!==M?(N=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[j,M]}),e[13]=j,e[14]=M,e[15]=N):N=e[15];let P;e[16]!==r.activityDetailLevels||e[17]!==A||e[18]!==c||e[19]!==g||e[20]!==v?(P=c?(0,E.jsx)(h,{className:`h-10 w-full rounded-lg sm:max-w-sm`}):(0,E.jsxs)(m,{value:g,disabled:v,onChange:e=>A(e.target.value),triggerClassName:`sm:max-w-sm`,children:[(0,E.jsx)(f,{value:`off`,children:r.activityDetailLevels.off}),(0,E.jsx)(f,{value:`on`,children:r.activityDetailLevels.on}),(0,E.jsx)(f,{value:`stream`,children:r.activityDetailLevels.stream})]}),e[16]=r.activityDetailLevels,e[17]=A,e[18]=c,e[19]=g,e[20]=v,e[21]=P):P=e[21];let F=b?`text-red-600 dark:text-red-400`:`text-fg-subtle`,I;e[22]===F?I=e[23]:(I=i(`min-h-4 text-xs`,F),e[22]=F,e[23]=I);let R=b?r.activityDetailSaveError:v?r.activityDetailSaving:r.activityDetailDefaultHint,z;e[24]!==I||e[25]!==R?(z=(0,E.jsx)(`p`,{className:I,children:R}),e[24]=I,e[25]=R,e[26]=z):z=e[26];let B;return e[27]!==z||e[28]!==N||e[29]!==P?(B=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[N,P,z]}),e[27]=z,e[28]=N,e[29]=P,e[30]=B):B=e[30],B}function L(e){return e.language}function R(){let e=(0,S.c)(27),t=o(V),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=u(B),s=u(z),c;e[2]===r.developerGroupTitle?c=e[3]:(c=(0,E.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:r.developerGroupTitle}),e[2]=r.developerGroupTitle,e[3]=c);let l;e[4]===r.developerGroupDescription?l=e[5]:(l=(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:r.developerGroupDescription}),e[4]=r.developerGroupDescription,e[5]=l);let d;e[6]!==c||e[7]!==l?(d=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[c,l]}),e[6]=c,e[7]=l,e[8]=d):d=e[8];let f;e[9]===r.showRawToolDataTitle?f=e[10]:(f=(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.showRawToolDataTitle}),e[9]=r.showRawToolDataTitle,e[10]=f);let p;e[11]===r.showRawToolDataDescription?p=e[12]:(p=(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.showRawToolDataDescription}),e[11]=r.showRawToolDataDescription,e[12]=p);let m;e[13]!==f||e[14]!==p?(m=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[f,p]}),e[13]=f,e[14]=p,e[15]=m):m=e[15];let h;e[16]===s?h=e[17]:(h=e=>s(e.target.checked),e[16]=s,e[17]=h);let g;e[18]!==i||e[19]!==h?(g=(0,E.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i,onChange:h}),e[18]=i,e[19]=h,e[20]=g):g=e[20];let _;e[21]!==m||e[22]!==g?(_=(0,E.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[m,g]}),e[21]=m,e[22]=g,e[23]=_):_=e[23];let v;return e[24]!==d||e[25]!==_?(v=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[d,_]}),e[24]=d,e[25]=_,e[26]=v):v=e[26],v}function z(e){return e.setShowRawToolData}function B(e){return e.showRawToolData}function V(e){return e.language}function H(){let e=(0,S.c)(30),t=o(U),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i;e[2]!==r.pageTitle||e[3]!==r.subtitle?(i=(0,E.jsx)(v,{title:r.pageTitle,subtitle:r.subtitle}),e[2]=r.pageTitle,e[3]=r.subtitle,e[4]=i):i=e[4];let s;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=D(),e[5]=s):s=e[5];let c;e[6]===r.languageTitle?c=e[7]:(c=(0,E.jsx)(`h2`,{id:`pref-language-heading`,className:`sr-only`,children:r.languageTitle}),e[6]=r.languageTitle,e[7]=c);let l;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,E.jsx)(d,{variant:`page`,sections:[`language`]}),e[8]=l):l=e[8];let u;e[9]===c?u=e[10]:(u=(0,E.jsxs)(`section`,{className:s,"aria-labelledby":`pref-language-heading`,children:[c,l]}),e[9]=c,e[10]=u);let f;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(f=D(),e[11]=f):f=e[11];let p;e[12]===r.themeTitle?p=e[13]:(p=(0,E.jsx)(`h2`,{id:`pref-appearance-heading`,className:`sr-only`,children:r.themeTitle}),e[12]=r.themeTitle,e[13]=p);let m,h,g;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,E.jsx)(d,{variant:`page`,sections:[`theme`,`font`]}),g=(0,E.jsx)(M,{}),m=(0,E.jsx)(I,{}),e[14]=m,e[15]=h,e[16]=g):(m=e[14],h=e[15],g=e[16]);let _;e[17]===p?_=e[18]:(_=(0,E.jsxs)(`section`,{className:f,"aria-labelledby":`pref-appearance-heading`,children:[p,h,g,m]}),e[17]=p,e[18]=_);let x;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(x=D(),e[19]=x):x=e[19];let C;e[20]===r.developerGroupTitle?C=e[21]:(C=(0,E.jsx)(`h2`,{id:`pref-developer-heading`,className:`sr-only`,children:r.developerGroupTitle}),e[20]=r.developerGroupTitle,e[21]=C);let w;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,E.jsx)(R,{}),e[22]=w):w=e[22];let T;e[23]===C?T=e[24]:(T=(0,E.jsx)(b,{children:(0,E.jsxs)(`section`,{className:x,"aria-labelledby":`pref-developer-heading`,children:[C,w]})}),e[23]=C,e[24]=T);let O;return e[25]!==i||e[26]!==_||e[27]!==T||e[28]!==u?(O=(0,E.jsxs)(y,{gap:`gap-6`,children:[i,u,_,T]}),e[25]=i,e[26]=_,e[27]=T,e[28]=u,e[29]=O):O=e[29],O}function U(e){return e.language}export{H as AppearanceSettingsPanel};
|
|
@@ -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{f as i,t as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./messages-r8L6Ur3A.js";import{l,n as u,o as d,r as f,s as p}from"./locale-store-DVGhFXRz.js";import{a as m,i as h}from"./vendor-swr-BIWyz7Rc.js";import{Ac as g,As as _,Cu as v,Go as y,Gs as b,Ho as x,Ir as S,Ji as C,Ks as w,Ns as T,Nt as E,Nu as D,To as O,Uo as k,Vc as A,Vo as j,Wl as M,Wo as ee,ao as N,co as P,fc as F,gc as I,lo as L,mu as R,oo as z,ro as B,so as V,tl as te,uc as ne,zo as re}from"./index-C1h0zkNo.js";import{t as H}from"./page-tabs-DWWgy0bF.js";var U=e(t(),1),W=n();function G(e){return e===`builtin`||e===`user`?e:`marketplace`}async function K(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 ie(e){let t=await d(f(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function q(e){let t=await d(f(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function J(e){let t=await d(f(`/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 K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function Y(e){let t=await d(f(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var X=r();function ae(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var Z={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function Q({className:e}){let t=c(u(e=>e.language)).extensionsPage,n=l(e=>!!e.token),r=z(),{mutate:i}=m(),[a,o]=(0,U.useReducer)(E,Z),{q:d,debounced:g,detailPkg:_,rowBusy:v,actionError:y,restartHint:b}=a,x=n?`marketplace-${g}`:null;(0,U.useEffect)(()=>{let e=window.setTimeout(()=>o({type:`patch`,patch:{debounced:d.trim()}}),300);return()=>window.clearTimeout(e)},[d]);let{data:C,isLoading:T,error:D}=h(x,async()=>p(g.length>0?f(`/api/marketplace?q=${encodeURIComponent(g)}`):f(`/api/marketplace`)),{revalidateOnFocus:!1}),O=(0,U.useCallback)(()=>{i(`gateway-extensions-list`),S()},[i]),k=(0,U.useCallback)(async(e,n)=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await q({name:e,overwrite:n});O(),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,O]),j=(0,U.useCallback)(async e=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await Y(e);O(),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,O]),M=C?.extensions??[];return(0,X.jsxs)(`div`,{className:s(`flex flex-col gap-4`,e),children:[(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(I,{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,X.jsx)(`input`,{type:`search`,value:d,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`})]}),D?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:D instanceof Error?D.message:t.marketplaceLoadFailed}):null,y?(0,X.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:y}):null,b?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:b}):null,T&&!C?(0,X.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":t.marketplaceLoading,children:[0,1,2].map(e=>(0,X.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,X.jsx)(B,{className:`h-5 w-40`}),(0,X.jsx)(B,{className:`h-4 w-full max-w-xl`}),(0,X.jsx)(B,{className:`h-4 w-2/3 max-w-md`})]}),(0,X.jsx)(B,{className:`h-8 w-20`})]})},e))}):(0,X.jsx)(`ul`,{className:`flex flex-col gap-3`,children:M.length===0?(0,X.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):M.map(e=>{let n=ae(r,e.id),i=v===e.id;return(0,X.jsx)(`li`,{className:`list-none`,children:(0,X.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:s(`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,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,X.jsx)(R,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,X.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,X.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,X.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,X.jsx)(A,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,X.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,X.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,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,X.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&j(e.id).catch(()=>{})},className:s(`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,X.jsx)(te,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,X.jsx)(w,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,X.jsx)(`button`,{type:`button`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),className:s(`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)})}),_?(0,X.jsx)($,{packageName:_,copy:t,extensions:r,onClose:()=>o({type:`patch`,patch:{detailPkg:null}}),onInstall:k,onUninstall:j}):null]})}function $(e){let t=(0,W.c)(102),{packageName:n,copy:r,extensions:i,onClose:o,onInstall:c,onUninstall:u}=e,[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)(!1),g=l(ue)?`ext-mp-detail-${n}`:null,_;t[0]===n?_=t[1]:(_=async()=>ie(n),t[0]=n,t[1]=_);let v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(v={revalidateOnFocus:!1},t[2]=v):v=t[2];let{data:x,error:S,isLoading:E}=h(g,_,v),O;t[3]!==i||t[4]!==n?(O=ae(i,n),t[3]=i,t[4]=n,t[5]=O):O=t[5];let A=O,M=A===`user`,N=x?.manifest?.permissions,P,F,I,L,R,z,V,H,G,K,q;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]!==x||t[29]!==S||t[30]!==A||t[31]!==E||t[32]!==o||t[33]!==N||t[34]!==p){let e=N&&typeof N==`object`&&!Array.isArray(N)?Object.entries(N):[],n;t[46]!==r.marketplaceNoReadme||t[47]!==x?(n=x?.readme?.trim()||(x?.description?.trim()?`### ${x.name}\n\n${x.description}`:`*${r.marketplaceNoReadme}*`),t[46]=r.marketplaceNoReadme,t[47]=x,t[48]=n):n=t[48];let i=n;I=re,L=!0,t[49]===o?R=t[50]:(R=e=>!e&&o(),t[49]=o,t[50]=R),F=ee,t[51]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,X.jsx)(k,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[51]=q):q=t[51],P=j,H=`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`,G=le;let a;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(D,{className:`size-5`}),t[52]=a):a=t[52];let s;t[53]!==r.detailBack||t[54]!==o?(s=(0,X.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 c;t[56]===r.marketplaceDetailTitle?c=t[57]:(c=(0,X.jsx)(y,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[56]=r.marketplaceDetailTitle,t[57]=c);let l;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(T,{className:`size-5`}),t[58]=l):l=t[58];let u;t[59]!==r.detailClose||t[60]!==o?(u=(0,X.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:l}),t[59]=r.detailClose,t[60]=o,t[61]=u):u=t[61],t[62]!==s||t[63]!==c||t[64]!==u?(K=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[s,c,u]}),t[62]=s,t[63]=c,t[64]=u,t[65]=K):K=t[65],z=`min-h-0 flex-1 overflow-y-auto p-5`,V=E&&!x?(0,X.jsxs)(`div`,{className:`space-y-4`,"aria-label":r.marketplaceLoading,children:[(0,X.jsx)(B,{className:`h-6 w-48`}),(0,X.jsx)(B,{className:`h-4 w-28`}),(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,X.jsx)(B,{className:`h-12`}),(0,X.jsx)(B,{className:`h-12`})]}),(0,X.jsx)(B,{className:`h-28 w-full`}),(0,X.jsx)(B,{className:`h-36 w-full`})]}):S?(0,X.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,X.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:r.marketplaceDetailLoadFailed}),(0,X.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:S instanceof Error?S.message:r.marketplaceLoadFailed})]}):x?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:x.name}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:x.id})}),(0,X.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,X.jsx)(`dd`,{children:x.author.username})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,X.jsx)(`dd`,{children:x.latestVersion.version})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,X.jsx)(`dd`,{children:x.downloads})]})]}),A===`bundled`?null:(0,X.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[x.installability.available?(0,X.jsx)(ne,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,X.jsx)(b,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:x.installability.available?r.marketplaceRiskTitle:r.marketplaceUnavailableTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:x.installability.available?r.marketplaceCodeRisk:x.installability.reason??r.marketplaceUnavailableBody})]})]}),x.installability.available?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceIntegrity}),(0,X.jsx)(`dd`,{children:r.marketplaceIntegrityVerified})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDependencies}),(0,X.jsx)(`dd`,{children:x.packageSummary?.dependencyCount??0})]})]}),(0,X.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,X.jsx)(`p`,{className:`font-medium text-fg`,children:r.marketplacePermissions}),e.length>0?(0,X.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(ce)}):(0,X.jsx)(`p`,{className:`mt-1`,children:r.marketplacePermissionsNone})]}),(x.packageSummary?.lifecycleScripts.length??0)>0?(0,X.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[r.marketplaceLifecycleScripts,`: `,x.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,X.jsx)(`span`,{children:r.marketplaceRiskConfirm})]})]}):null]}),x.readme?.trim()?(0,X.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,X.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,X.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]=x,t[29]=S,t[30]=A,t[31]=E,t[32]=o,t[33]=N,t[34]=p,t[35]=P,t[36]=F,t[37]=I,t[38]=L,t[39]=R,t[40]=z,t[41]=V,t[42]=H,t[43]=G,t[44]=K,t[45]=q}else P=t[35],F=t[36],I=t[37],L=t[38],R=t[39],z=t[40],V=t[41],H=t[42],G=t[43],K=t[44],q=t[45];let J;t[66]!==z||t[67]!==V?(J=(0,X.jsx)(`div`,{className:z,children:V}),t[66]=z,t[67]=V,t[68]=J):J=t[68];let Y;t[69]!==d||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]!==x||t[78]!==A||t[79]!==o||t[80]!==c||t[81]!==u||t[82]!==n||t[83]!==p||t[84]!==M?(Y=x?(0,X.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:A===`bundled`?(0,X.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,X.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,X.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,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{type:`button`,disabled:d||!x.installability.available||!p,onClick:()=>{M&&!window.confirm(r.marketplaceReinstallConfirm)||(f(!0),c(n,M).catch(se).finally(()=>f(!1)))},className:s(`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:[d?(0,X.jsx)(te,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,M?r.marketplaceReinstall:r.marketplaceInstall]}),M?(0,X.jsxs)(`button`,{type:`button`,disabled:d,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(f(!0),u(n).then(()=>o()).catch(oe).finally(()=>f(!1)))},className:s(`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,X.jsx)(w,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[69]=d,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]=x,t[78]=A,t[79]=o,t[80]=c,t[81]=u,t[82]=n,t[83]=p,t[84]=M,t[85]=Y):Y=t[85];let Z;t[86]!==P||t[87]!==J||t[88]!==Y||t[89]!==H||t[90]!==G||t[91]!==K?(Z=(0,X.jsxs)(P,{className:H,onOpenAutoFocus:G,children:[K,J,Y]}),t[86]=P,t[87]=J,t[88]=Y,t[89]=H,t[90]=G,t[91]=K,t[92]=Z):Z=t[92];let Q;t[93]!==F||t[94]!==Z||t[95]!==q?(Q=(0,X.jsxs)(F,{children:[q,Z]}),t[93]=F,t[94]=Z,t[95]=q,t[96]=Q):Q=t[96];let $;return t[97]!==I||t[98]!==L||t[99]!==R||t[100]!==Q?($=(0,X.jsx)(I,{defaultOpen:L,onOpenChange:R,children:Q}),t[97]=I,t[98]=L,t[99]=R,t[100]=Q,t[101]=$):$=t[101],$}function oe(){}function se(){}function ce(e){let[t,n]=e;return(0,X.jsxs)(`li`,{className:`break-words`,children:[(0,X.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function le(e){return e.preventDefault()}function ue(e){return!!e.token}function de(){let e=u(e=>e.language),t=c(e),n=O(e=>e.setPageHeader),r=O(e=>e.clearPageHeader),o=z(),s=V(),[l,d]=i(),f=G(l.get(`tab`)),p=l.get(`q`)??``,[m,h]=(0,U.useState)(f),[y,b]=(0,U.useState)(p),[x,S]=(0,U.useState)(null),C=l.toString(),w=(0,U.useRef)(C);if(w.current!==C){w.current=C;let e=G(l.get(`tab`)),t=l.get(`q`)??``;h(t=>t===e?t:e),b(e=>e===t?e:t)}(0,U.useEffect)(()=>{d(e=>{let t=new URLSearchParams(e),n=y.trim();return n?t.set(`q`,n):t.delete(`q`),m===`marketplace`?t.delete(`tab`):t.set(`tab`,m),t.toString()===e.toString()?e:t},{replace:!0})},[m,y,d]);let T=(0,U.useMemo)(()=>o.filter(e=>e.source===`bundled`),[o]),E=(0,U.useMemo)(()=>o.filter(e=>e.source!==`bundled`),[o]),D=m===`builtin`?T:E,k=(0,U.useMemo)(()=>{let t=y.trim().toLowerCase(),n=D;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)},[D,y,e]);if((0,U.useEffect)(()=>{S(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,U.useLayoutEffect)(()=>(n({startExtra:null,main:(0,X.jsx)(`div`,{className:`min-w-0`,children:(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.extensionsPage.title})}),end:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(_,{asChild:!0,variant:`secondary`,className:`h-9`,children:(0,X.jsxs)(a,{to:`/local-apps`,"aria-label":t.extensionsPage.openLocalApps,title:t.extensionsPage.openLocalApps,children:[(0,X.jsx)(v,{className:`size-4`}),(0,X.jsx)(`span`,{className:`hidden sm:inline`,children:t.extensionsPage.openLocalApps})]})}),(0,X.jsx)(_,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,X.jsxs)(a,{to:`/local-apps/new`,children:[(0,X.jsx)(g,{className:`size-4`}),t.extensionsPage.createLocalApp]})})]})}),()=>r()),[r,t.extensionsPage.createLocalApp,t.extensionsPage.openLocalApps,t.extensionsPage.title,n]),s&&m!==`marketplace`)return(0,X.jsx)(ye,{});let A=m!==`marketplace`&&D.length>0;return(0,X.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,X.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[(0,X.jsxs)(`div`,{className:`mb-5 flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,X.jsx)(H,{items:[{id:`marketplace`,label:t.extensionsPage.tabMarketplace},{id:`builtin`,label:t.extensionsPage.tabBuiltin,count:T.length},{id:`user`,label:t.extensionsPage.tabUser,count:E.length}],activeTab:m,onChange:h,ariaLabel:t.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`}),A?(0,X.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,X.jsx)(I,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,value:y,onChange:e=>b(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]}),m===`marketplace`?(0,X.jsx)(Q,{}):m===`builtin`&&T.length===0?(0,X.jsx)(xe,{message:t.extensionsPage.emptyBuiltin}):m===`user`&&E.length===0?(0,X.jsx)(xe,{message:t.extensionsPage.emptyUser}):k.length===0?(0,X.jsx)(`p`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-3 py-8 text-center text-sm text-fg-muted shadow-surface sm:px-5 xl:px-6`,children:t.extensionsPage.noSearchResults}):(0,X.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:k.map(e=>(0,X.jsx)(ge,{extension:e,copy:t.extensionsPage,showSourceBadge:m===`user`,onOpen:()=>S(e)},e.id))})]}),x?(0,X.jsx)(_e,{extension:x,copy:t.extensionsPage,onClose:()=>S(null)},x.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,W.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,c;t[0]===n?c=t[1]:(c=fe(n),t[0]=n,t[1]=c);let l=c,u=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=s(`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 f=n.name||n.id,p;t[3]===f?p=t[4]:(p=f.charAt(0).toUpperCase(),t[3]=f,t[4]=p);let m;t[5]===p?m=t[6]:(m=(0,X.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:p}),t[5]=p,t[6]=m);let h;t[7]===n.name?h=t[8]:(h=(0,X.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=h);let _;t[9]===n.version?_=t[10]:(_=n.version?(0,X.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=_);let v;t[11]!==h||t[12]!==_?(v=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[h,_]}),t[11]=h,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==r.statusEnabled||t[15]!==l?(y=l?(0,X.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,X.jsx)(o,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,X.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,X.jsx)(g,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=l,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==y?(b=(0,X.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,X.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]!==u?(w=(0,X.jsx)(`span`,{title:u,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]=u,t[27]=w):w=t[27];let T;t[28]!==r||t[29]!==n||t[30]!==i?(T=n.source===`bundled`?(0,X.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,X.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,X.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,X.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]!==m?(O=(0,X.jsxs)(`div`,{className:`flex gap-3`,children:[m,D]}),t[39]=D,t[40]=m,t[41]=O):O=t[41];let k;return t[42]!==a||t[43]!==O?(k=(0,X.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}=m(),[i,o]=(0,U.useState)(!1),[c,l]=(0,U.useState)(null),[u,d]=(0,U.useState)(!1),f=e.activationEligible===!0,p=(0,U.useCallback)(async()=>{if(e.source===`bundled`){l(null),d(!1),o(!0);try{let{requiresGatewayRestart:t}=await J({extensionId:e.id,enabled:!f});await r(`gateway-extensions-list`),S(),d(t)}catch(e){l(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[f,t.builtinToggleFailed,e.id,e.source,r]),h=e.ui?.contributions?.pages??[],g=e.ui?.contributions?.settingsPanels??[],v=e.ui?.contributions?.chatWidgets??[],b=e.ui?.contributions?.sidebarPanels??[],C=h.find(e=>e.showInNav)??h[0],w=g[0],E=C?N(e.id,C):null,O=w?`/settings/ext/${e.id}/${w.id}`:e.hasConfigSchema||P(e)?`/settings/ext/${e.id}`:null;return(0,X.jsx)(re,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,X.jsxs)(ee,{children:[(0,X.jsx)(k,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,X.jsxs)(j,{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,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,X.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,X.jsx)(D,{className:`size-5`})}),(0,X.jsx)(y,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,X.jsxs)(x,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,X.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,X.jsx)(T,{className:`size-5`})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,X.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,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,X.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,pe(e,t)]}),e.version?(0,X.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,X.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,X.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:he(e,t)}),e.source===`bundled`?(0,X.jsxs)(X.Fragment,{children:[(0,X.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,X.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,X.jsx)(_,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void p(),className:`shrink-0 py-1.5 text-xs`,children:i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(te,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):f?t.builtinToggleDisable:t.builtinToggleEnable})]}),c?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:c}):null,u?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,X.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&&(h.length>0||g.length>0||v.length>0)?(0,X.jsxs)(`section`,{className:`mt-8`,children:[(0,X.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,X.jsx)(ve,{template:t.badgePages,count:h.length,hidden:h.length===0}),(0,X.jsx)(ve,{template:t.badgeSettings,count:g.length,hidden:g.length===0}),(0,X.jsx)(ve,{template:t.badgeWidgets,count:v.length,hidden:v.length===0}),(0,X.jsx)(ve,{template:t.badgeSidebar,count:b.length,hidden:b.length===0})]})]}):null,L(e)&&(E||O)?(0,X.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[E?(0,X.jsxs)(a,{to:E,onClick:n,className:s(`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,X.jsx)(M,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,O?(0,X.jsxs)(a,{to:O,onClick:n,className:s(`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,X.jsx)(F,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,X.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function ve(e){let t=(0,W.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,X.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,W.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,X.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,X.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,X.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,X.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,X.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,X.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,W.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.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,X.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{f as i,t as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./messages-DP6tPKk-.js";import{l,n as u,o as d,r as f,s as p}from"./locale-store-CTwSy7yW.js";import{a as m,i as h}from"./vendor-swr-BIWyz7Rc.js";import{Ac as g,As as _,Cu as v,Go as y,Gs as b,Ho as x,Ir as S,Ji as C,Ks as w,Ns as T,Nt as E,Nu as D,To as O,Uo as k,Vc as A,Vo as j,Wl as M,Wo as ee,ao as N,co as P,fc as F,gc as I,lo as L,mu as R,oo as z,ro as B,so as V,tl as te,uc as ne,zo as re}from"./index-C0CGebQ1.js";import{t as H}from"./page-tabs-ke9s4nYi.js";var U=e(t(),1),W=n();function G(e){return e===`builtin`||e===`user`?e:`marketplace`}async function K(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 ie(e){let t=await d(f(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function q(e){let t=await d(f(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function J(e){let t=await d(f(`/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 K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function Y(e){let t=await d(f(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await K(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var X=r();function ae(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var Z={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function Q({className:e}){let t=c(u(e=>e.language)).extensionsPage,n=l(e=>!!e.token),r=z(),{mutate:i}=m(),[a,o]=(0,U.useReducer)(E,Z),{q:d,debounced:g,detailPkg:_,rowBusy:v,actionError:y,restartHint:b}=a,x=n?`marketplace-${g}`:null;(0,U.useEffect)(()=>{let e=window.setTimeout(()=>o({type:`patch`,patch:{debounced:d.trim()}}),300);return()=>window.clearTimeout(e)},[d]);let{data:C,isLoading:T,error:D}=h(x,async()=>p(g.length>0?f(`/api/marketplace?q=${encodeURIComponent(g)}`):f(`/api/marketplace`)),{revalidateOnFocus:!1}),O=(0,U.useCallback)(()=>{i(`gateway-extensions-list`),S()},[i]),k=(0,U.useCallback)(async(e,n)=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await q({name:e,overwrite:n});O(),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,O]),j=(0,U.useCallback)(async e=>{o({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await Y(e);O(),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,O]),M=C?.extensions??[];return(0,X.jsxs)(`div`,{className:s(`flex flex-col gap-4`,e),children:[(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(I,{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,X.jsx)(`input`,{type:`search`,value:d,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`})]}),D?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:D instanceof Error?D.message:t.marketplaceLoadFailed}):null,y?(0,X.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:y}):null,b?(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:b}):null,T&&!C?(0,X.jsx)(`ul`,{className:`flex flex-col gap-3`,"aria-label":t.marketplaceLoading,children:[0,1,2].map(e=>(0,X.jsx)(`li`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2.5`,children:[(0,X.jsx)(B,{className:`h-5 w-40`}),(0,X.jsx)(B,{className:`h-4 w-full max-w-xl`}),(0,X.jsx)(B,{className:`h-4 w-2/3 max-w-md`})]}),(0,X.jsx)(B,{className:`h-8 w-20`})]})},e))}):(0,X.jsx)(`ul`,{className:`flex flex-col gap-3`,children:M.length===0?(0,X.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):M.map(e=>{let n=ae(r,e.id),i=v===e.id;return(0,X.jsx)(`li`,{className:`list-none`,children:(0,X.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:s(`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,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,X.jsx)(R,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,X.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,X.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,X.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,X.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,X.jsx)(A,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,X.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,X.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,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,X.jsxs)(`button`,{type:`button`,disabled:i,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&j(e.id).catch(()=>{})},className:s(`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,X.jsx)(te,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,X.jsx)(w,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,X.jsx)(`button`,{type:`button`,onClick:()=>o({type:`patch`,patch:{detailPkg:e.id}}),className:s(`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)})}),_?(0,X.jsx)($,{packageName:_,copy:t,extensions:r,onClose:()=>o({type:`patch`,patch:{detailPkg:null}}),onInstall:k,onUninstall:j}):null]})}function $(e){let t=(0,W.c)(102),{packageName:n,copy:r,extensions:i,onClose:o,onInstall:c,onUninstall:u}=e,[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)(!1),g=l(ue)?`ext-mp-detail-${n}`:null,_;t[0]===n?_=t[1]:(_=async()=>ie(n),t[0]=n,t[1]=_);let v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(v={revalidateOnFocus:!1},t[2]=v):v=t[2];let{data:x,error:S,isLoading:E}=h(g,_,v),O;t[3]!==i||t[4]!==n?(O=ae(i,n),t[3]=i,t[4]=n,t[5]=O):O=t[5];let A=O,M=A===`user`,N=x?.manifest?.permissions,P,F,I,L,R,z,V,H,G,K,q;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]!==x||t[29]!==S||t[30]!==A||t[31]!==E||t[32]!==o||t[33]!==N||t[34]!==p){let e=N&&typeof N==`object`&&!Array.isArray(N)?Object.entries(N):[],n;t[46]!==r.marketplaceNoReadme||t[47]!==x?(n=x?.readme?.trim()||(x?.description?.trim()?`### ${x.name}\n\n${x.description}`:`*${r.marketplaceNoReadme}*`),t[46]=r.marketplaceNoReadme,t[47]=x,t[48]=n):n=t[48];let i=n;I=re,L=!0,t[49]===o?R=t[50]:(R=e=>!e&&o(),t[49]=o,t[50]=R),F=ee,t[51]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,X.jsx)(k,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[51]=q):q=t[51],P=j,H=`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`,G=le;let a;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(D,{className:`size-5`}),t[52]=a):a=t[52];let s;t[53]!==r.detailBack||t[54]!==o?(s=(0,X.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 c;t[56]===r.marketplaceDetailTitle?c=t[57]:(c=(0,X.jsx)(y,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[56]=r.marketplaceDetailTitle,t[57]=c);let l;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(T,{className:`size-5`}),t[58]=l):l=t[58];let u;t[59]!==r.detailClose||t[60]!==o?(u=(0,X.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:l}),t[59]=r.detailClose,t[60]=o,t[61]=u):u=t[61],t[62]!==s||t[63]!==c||t[64]!==u?(K=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[s,c,u]}),t[62]=s,t[63]=c,t[64]=u,t[65]=K):K=t[65],z=`min-h-0 flex-1 overflow-y-auto p-5`,V=E&&!x?(0,X.jsxs)(`div`,{className:`space-y-4`,"aria-label":r.marketplaceLoading,children:[(0,X.jsx)(B,{className:`h-6 w-48`}),(0,X.jsx)(B,{className:`h-4 w-28`}),(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,X.jsx)(B,{className:`h-12`}),(0,X.jsx)(B,{className:`h-12`})]}),(0,X.jsx)(B,{className:`h-28 w-full`}),(0,X.jsx)(B,{className:`h-36 w-full`})]}):S?(0,X.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,X.jsx)(`p`,{className:`font-medium text-red-700 dark:text-red-300`,children:r.marketplaceDetailLoadFailed}),(0,X.jsx)(`p`,{className:`mt-1 break-words text-red-600 dark:text-red-400`,children:S instanceof Error?S.message:r.marketplaceLoadFailed})]}):x?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:x.name}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,X.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:x.id})}),(0,X.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,X.jsx)(`dd`,{children:x.author.username})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,X.jsx)(`dd`,{children:x.latestVersion.version})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,X.jsx)(`dd`,{children:x.downloads})]})]}),A===`bundled`?null:(0,X.jsxs)(`section`,{className:`mt-5 space-y-3 rounded-lg border border-edge bg-surface-base p-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[x.installability.available?(0,X.jsx)(ne,{className:`mt-0.5 size-5 shrink-0 text-emerald-600 dark:text-emerald-400`,"aria-hidden":!0}):(0,X.jsx)(b,{className:`mt-0.5 size-5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":!0}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:x.installability.available?r.marketplaceRiskTitle:r.marketplaceUnavailableTitle}),(0,X.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:x.installability.available?r.marketplaceCodeRisk:x.installability.reason??r.marketplaceUnavailableBody})]})]}),x.installability.available?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`dl`,{className:`grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceIntegrity}),(0,X.jsx)(`dd`,{children:r.marketplaceIntegrityVerified})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDependencies}),(0,X.jsx)(`dd`,{children:x.packageSummary?.dependencyCount??0})]})]}),(0,X.jsxs)(`div`,{className:`text-xs text-fg-muted`,children:[(0,X.jsx)(`p`,{className:`font-medium text-fg`,children:r.marketplacePermissions}),e.length>0?(0,X.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(ce)}):(0,X.jsx)(`p`,{className:`mt-1`,children:r.marketplacePermissionsNone})]}),(x.packageSummary?.lifecycleScripts.length??0)>0?(0,X.jsxs)(`p`,{className:`text-xs leading-relaxed text-amber-700 dark:text-amber-300`,children:[r.marketplaceLifecycleScripts,`: `,x.packageSummary?.lifecycleScripts.join(`, `)]}):null,(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,X.jsx)(`span`,{children:r.marketplaceRiskConfirm})]})]}):null]}),x.readme?.trim()?(0,X.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,X.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,X.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]=x,t[29]=S,t[30]=A,t[31]=E,t[32]=o,t[33]=N,t[34]=p,t[35]=P,t[36]=F,t[37]=I,t[38]=L,t[39]=R,t[40]=z,t[41]=V,t[42]=H,t[43]=G,t[44]=K,t[45]=q}else P=t[35],F=t[36],I=t[37],L=t[38],R=t[39],z=t[40],V=t[41],H=t[42],G=t[43],K=t[44],q=t[45];let J;t[66]!==z||t[67]!==V?(J=(0,X.jsx)(`div`,{className:z,children:V}),t[66]=z,t[67]=V,t[68]=J):J=t[68];let Y;t[69]!==d||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]!==x||t[78]!==A||t[79]!==o||t[80]!==c||t[81]!==u||t[82]!==n||t[83]!==p||t[84]!==M?(Y=x?(0,X.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:A===`bundled`?(0,X.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,X.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,X.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,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{type:`button`,disabled:d||!x.installability.available||!p,onClick:()=>{M&&!window.confirm(r.marketplaceReinstallConfirm)||(f(!0),c(n,M).catch(se).finally(()=>f(!1)))},className:s(`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:[d?(0,X.jsx)(te,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,M?r.marketplaceReinstall:r.marketplaceInstall]}),M?(0,X.jsxs)(`button`,{type:`button`,disabled:d,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(f(!0),u(n).then(()=>o()).catch(oe).finally(()=>f(!1)))},className:s(`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,X.jsx)(w,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[69]=d,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]=x,t[78]=A,t[79]=o,t[80]=c,t[81]=u,t[82]=n,t[83]=p,t[84]=M,t[85]=Y):Y=t[85];let Z;t[86]!==P||t[87]!==J||t[88]!==Y||t[89]!==H||t[90]!==G||t[91]!==K?(Z=(0,X.jsxs)(P,{className:H,onOpenAutoFocus:G,children:[K,J,Y]}),t[86]=P,t[87]=J,t[88]=Y,t[89]=H,t[90]=G,t[91]=K,t[92]=Z):Z=t[92];let Q;t[93]!==F||t[94]!==Z||t[95]!==q?(Q=(0,X.jsxs)(F,{children:[q,Z]}),t[93]=F,t[94]=Z,t[95]=q,t[96]=Q):Q=t[96];let $;return t[97]!==I||t[98]!==L||t[99]!==R||t[100]!==Q?($=(0,X.jsx)(I,{defaultOpen:L,onOpenChange:R,children:Q}),t[97]=I,t[98]=L,t[99]=R,t[100]=Q,t[101]=$):$=t[101],$}function oe(){}function se(){}function ce(e){let[t,n]=e;return(0,X.jsxs)(`li`,{className:`break-words`,children:[(0,X.jsx)(`code`,{children:t}),`: `,Array.isArray(n)?n.join(`, `):String(n)]},t)}function le(e){return e.preventDefault()}function ue(e){return!!e.token}function de(){let e=u(e=>e.language),t=c(e),n=O(e=>e.setPageHeader),r=O(e=>e.clearPageHeader),o=z(),s=V(),[l,d]=i(),f=G(l.get(`tab`)),p=l.get(`q`)??``,[m,h]=(0,U.useState)(f),[y,b]=(0,U.useState)(p),[x,S]=(0,U.useState)(null),C=l.toString(),w=(0,U.useRef)(C);if(w.current!==C){w.current=C;let e=G(l.get(`tab`)),t=l.get(`q`)??``;h(t=>t===e?t:e),b(e=>e===t?e:t)}(0,U.useEffect)(()=>{d(e=>{let t=new URLSearchParams(e),n=y.trim();return n?t.set(`q`,n):t.delete(`q`),m===`marketplace`?t.delete(`tab`):t.set(`tab`,m),t.toString()===e.toString()?e:t},{replace:!0})},[m,y,d]);let T=(0,U.useMemo)(()=>o.filter(e=>e.source===`bundled`),[o]),E=(0,U.useMemo)(()=>o.filter(e=>e.source!==`bundled`),[o]),D=m===`builtin`?T:E,k=(0,U.useMemo)(()=>{let t=y.trim().toLowerCase(),n=D;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)},[D,y,e]);if((0,U.useEffect)(()=>{S(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,U.useLayoutEffect)(()=>(n({startExtra:null,main:(0,X.jsx)(`div`,{className:`min-w-0`,children:(0,X.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.extensionsPage.title})}),end:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(_,{asChild:!0,variant:`secondary`,className:`h-9`,children:(0,X.jsxs)(a,{to:`/local-apps`,"aria-label":t.extensionsPage.openLocalApps,title:t.extensionsPage.openLocalApps,children:[(0,X.jsx)(v,{className:`size-4`}),(0,X.jsx)(`span`,{className:`hidden sm:inline`,children:t.extensionsPage.openLocalApps})]})}),(0,X.jsx)(_,{asChild:!0,variant:`primary`,className:`h-9`,children:(0,X.jsxs)(a,{to:`/local-apps/new`,children:[(0,X.jsx)(g,{className:`size-4`}),t.extensionsPage.createLocalApp]})})]})}),()=>r()),[r,t.extensionsPage.createLocalApp,t.extensionsPage.openLocalApps,t.extensionsPage.title,n]),s&&m!==`marketplace`)return(0,X.jsx)(ye,{});let A=m!==`marketplace`&&D.length>0;return(0,X.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,X.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[(0,X.jsxs)(`div`,{className:`mb-5 flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,X.jsx)(H,{items:[{id:`marketplace`,label:t.extensionsPage.tabMarketplace},{id:`builtin`,label:t.extensionsPage.tabBuiltin,count:T.length},{id:`user`,label:t.extensionsPage.tabUser,count:E.length}],activeTab:m,onChange:h,ariaLabel:t.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`}),A?(0,X.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,X.jsx)(I,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,X.jsx)(`input`,{type:`search`,value:y,onChange:e=>b(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]}),m===`marketplace`?(0,X.jsx)(Q,{}):m===`builtin`&&T.length===0?(0,X.jsx)(xe,{message:t.extensionsPage.emptyBuiltin}):m===`user`&&E.length===0?(0,X.jsx)(xe,{message:t.extensionsPage.emptyUser}):k.length===0?(0,X.jsx)(`p`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-3 py-8 text-center text-sm text-fg-muted shadow-surface sm:px-5 xl:px-6`,children:t.extensionsPage.noSearchResults}):(0,X.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:k.map(e=>(0,X.jsx)(ge,{extension:e,copy:t.extensionsPage,showSourceBadge:m===`user`,onOpen:()=>S(e)},e.id))})]}),x?(0,X.jsx)(_e,{extension:x,copy:t.extensionsPage,onClose:()=>S(null)},x.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,W.c)(45),{extension:n,copy:r,showSourceBadge:i,onOpen:a}=e,c;t[0]===n?c=t[1]:(c=fe(n),t[0]=n,t[1]=c);let l=c,u=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=s(`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 f=n.name||n.id,p;t[3]===f?p=t[4]:(p=f.charAt(0).toUpperCase(),t[3]=f,t[4]=p);let m;t[5]===p?m=t[6]:(m=(0,X.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:p}),t[5]=p,t[6]=m);let h;t[7]===n.name?h=t[8]:(h=(0,X.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=h);let _;t[9]===n.version?_=t[10]:(_=n.version?(0,X.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=_);let v;t[11]!==h||t[12]!==_?(v=(0,X.jsxs)(`div`,{className:`min-w-0`,children:[h,_]}),t[11]=h,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==r.statusEnabled||t[15]!==l?(y=l?(0,X.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,X.jsx)(o,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,X.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,X.jsx)(g,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=l,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==y?(b=(0,X.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,X.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]!==u?(w=(0,X.jsx)(`span`,{title:u,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]=u,t[27]=w):w=t[27];let T;t[28]!==r||t[29]!==n||t[30]!==i?(T=n.source===`bundled`?(0,X.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,X.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,X.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,X.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]!==m?(O=(0,X.jsxs)(`div`,{className:`flex gap-3`,children:[m,D]}),t[39]=D,t[40]=m,t[41]=O):O=t[41];let k;return t[42]!==a||t[43]!==O?(k=(0,X.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}=m(),[i,o]=(0,U.useState)(!1),[c,l]=(0,U.useState)(null),[u,d]=(0,U.useState)(!1),f=e.activationEligible===!0,p=(0,U.useCallback)(async()=>{if(e.source===`bundled`){l(null),d(!1),o(!0);try{let{requiresGatewayRestart:t}=await J({extensionId:e.id,enabled:!f});await r(`gateway-extensions-list`),S(),d(t)}catch(e){l(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[f,t.builtinToggleFailed,e.id,e.source,r]),h=e.ui?.contributions?.pages??[],g=e.ui?.contributions?.settingsPanels??[],v=e.ui?.contributions?.chatWidgets??[],b=e.ui?.contributions?.sidebarPanels??[],C=h.find(e=>e.showInNav)??h[0],w=g[0],E=C?N(e.id,C):null,O=w?`/settings/ext/${e.id}/${w.id}`:e.hasConfigSchema||P(e)?`/settings/ext/${e.id}`:null;return(0,X.jsx)(re,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,X.jsxs)(ee,{children:[(0,X.jsx)(k,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,X.jsxs)(j,{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,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,X.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,X.jsx)(D,{className:`size-5`})}),(0,X.jsx)(y,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,X.jsxs)(x,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,X.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,X.jsx)(T,{className:`size-5`})})]}),(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,X.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,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,X.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,pe(e,t)]}),e.version?(0,X.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,X.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,X.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:he(e,t)}),e.source===`bundled`?(0,X.jsxs)(X.Fragment,{children:[(0,X.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,X.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,X.jsx)(_,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void p(),className:`shrink-0 py-1.5 text-xs`,children:i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(te,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):f?t.builtinToggleDisable:t.builtinToggleEnable})]}),c?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:c}):null,u?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,X.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&&(h.length>0||g.length>0||v.length>0)?(0,X.jsxs)(`section`,{className:`mt-8`,children:[(0,X.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,X.jsx)(ve,{template:t.badgePages,count:h.length,hidden:h.length===0}),(0,X.jsx)(ve,{template:t.badgeSettings,count:g.length,hidden:g.length===0}),(0,X.jsx)(ve,{template:t.badgeWidgets,count:v.length,hidden:v.length===0}),(0,X.jsx)(ve,{template:t.badgeSidebar,count:b.length,hidden:b.length===0})]})]}):null,L(e)&&(E||O)?(0,X.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[E?(0,X.jsxs)(a,{to:E,onClick:n,className:s(`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,X.jsx)(M,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,O?(0,X.jsxs)(a,{to:O,onClick:n,className:s(`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,X.jsx)(F,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,X.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function ve(e){let t=(0,W.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,X.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,W.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,X.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,X.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,X.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,X.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,X.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,X.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,W.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.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,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{de as ExtensionsPage};
|
package/dist/gateway/static/root/assets/{archive-plugin-D18gyP76.js → archive-plugin-ZSLLG8wB.js}
RENAMED
|
@@ -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-
|
|
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-DP6tPKk-.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-Cp1eI4S9.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};
|
package/dist/gateway/static/root/assets/{attachment-load-CZh9fc8u.js → attachment-load-D4YktqIF.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-process-heavy-B2_kr5EA.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-zJ_50EbN.js","assets/excel-worksheet-utils-EyvwNT4X.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./preload-helper-zJ_50EbN.js";import{Qa as t}from"./index-
|
|
2
|
+
import{t as e}from"./preload-helper-zJ_50EbN.js";import{Qa as t}from"./index-C0CGebQ1.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/pdf`||a.toLowerCase().endsWith(`.pdf`)){let{processPdf:t}=await e(async()=>{let{processPdf:e}=await import(`./attachment-process-heavy-B2_kr5EA.js`);return{processPdf:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n,preview:r}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/pdf`,size:s,content:d,extractedText:n,preview:r}}if(o===`application/vnd.openxmlformats-officedocument.wordprocessingml.document`||a.toLowerCase().endsWith(`.docx`)){let{processDocx:t}=await e(async()=>{let{processDocx:e}=await import(`./attachment-process-heavy-B2_kr5EA.js`);return{processDocx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,size:s,content:d,extractedText:n}}if(o===`application/vnd.openxmlformats-officedocument.presentationml.presentation`||a.toLowerCase().endsWith(`.pptx`)){let{processPptx:t}=await e(async()=>{let{processPptx:e}=await import(`./attachment-process-heavy-B2_kr5EA.js`);return{processPptx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.presentationml.presentation`,size:s,content:d,extractedText:n}}if([`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`application/vnd.ms-excel`].includes(o)||a.toLowerCase().endsWith(`.xlsx`)||a.toLowerCase().endsWith(`.xls`)){let{processExcel:t}=await e(async()=>{let{processExcel:e}=await import(`./attachment-process-heavy-B2_kr5EA.js`);return{processExcel:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:o&&o.startsWith(`application/vnd`)?o:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,size:s,content:d,extractedText:n}}if(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}}throw Error(`Unsupported file type: ${o}`)}export{n as loadAttachment};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{l as n}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as r}from"./cn-JdwAhgNB.js";import{t as i}from"./messages-
|
|
1
|
+
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{l as n}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as r}from"./cn-JdwAhgNB.js";import{t as i}from"./messages-DP6tPKk-.js";import{n as a}from"./locale-store-CTwSy7yW.js";import{i as o}from"./vendor-swr-BIWyz7Rc.js";import{As as s,b as c,oc as l,pu as u,ul as d,v as f,x as p,y as m}from"./index-C0CGebQ1.js";var h=e(),g=t();function _(e){let t=(0,h.c)(45),{title:p,description:_,prompt:x,coverage:S,className:C,variant:w}=e,T=w===void 0?`card`:w,E=a(b),D=i(E).automations.suggestions,O=i(E).automations,k=n(),A;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(A={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=A):A=t[0];let{data:j}=o(S?`automation-suggestion-coverage`:null,y,A),M=S?j?.automations.find(e=>c(e,S)):void 0,N=M?f(M,O):[];if(T===`titleAction`){if(M){let e;t[1]===C?e=t[2]:(e=r(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,C),t[1]=C,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,g.jsx)(u,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let i;return t[4]===k?i=t[5]:(i=()=>k(`/automations`),t[4]=k,t[5]=i),(0,g.jsxs)(`section`,{className:e,children:[n,(0,g.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:D.coveredTitle}),(0,g.jsx)(s,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:i,children:D.manage})]})}let e;t[6]===C?e=t[7]:(e=r(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,C),t[6]=C,t[7]=e);let n;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,g.jsx)(d,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=n):n=t[8];let i;t[9]!==_||t[10]!==p?(i=(0,g.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:_,children:p}),t[9]=_,t[10]=p,t[11]=i):i=t[11];let a;t[12]!==k||t[13]!==x?(a=()=>{k(`/automations?${new URLSearchParams({draft:x,autogenerate:`1`}).toString()}`)},t[12]=k,t[13]=x,t[14]=a):a=t[14];let o;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,g.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),t[15]=o):o=t[15],(0,g.jsxs)(`section`,{className:e,children:[n,i,(0,g.jsxs)(s,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:a,children:[o,D.create]})]})}if(M){let e;t[16]===C?e=t[17]:(e=r(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,C),t[16]=C,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,g.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let i;t[19]===k?i=t[20]:(i=()=>k(`/automations`),t[19]=k,t[20]=i);let a;return t[21]!==D||t[22]!==i?(a=(0,g.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,g.jsx)(s,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:i,children:D.manage})}),t[21]=D,t[22]=i,t[23]=a):a=t[23],(0,g.jsxs)(`section`,{className:e,children:[(0,g.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,g.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,g.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:D.coveredTitle}),(0,g.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:m(D.coveredDescription,{name:M.name})})]})]}),(0,g.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,g.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:O.explain.whyCovered}),(0,g.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:N.map(v)})]}),a]})}let P;t[24]===C?P=t[25]:(P=r(`rounded-lg bg-surface-panel p-3 shadow-surface`,C),t[24]=C,t[25]=P);let F;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,g.jsx)(d,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=F):F=t[26];let I;t[27]===p?I=t[28]:(I=(0,g.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:p}),t[27]=p,t[28]=I);let L;t[29]===_?L=t[30]:(L=(0,g.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:_}),t[29]=_,t[30]=L);let R;t[31]!==I||t[32]!==L?(R=(0,g.jsxs)(`div`,{className:`flex items-start gap-2`,children:[F,(0,g.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[I,L]})]}),t[31]=I,t[32]=L,t[33]=R):R=t[33];let z;t[34]!==k||t[35]!==x?(z=()=>{k(`/automations?${new URLSearchParams({draft:x,autogenerate:`1`}).toString()}`)},t[34]=k,t[35]=x,t[36]=z):z=t[36];let B;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,g.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),t[37]=B):B=t[37];let V;t[38]!==D.create||t[39]!==z?(V=(0,g.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,g.jsxs)(s,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:z,children:[B,D.create]})}),t[38]=D.create,t[39]=z,t[40]=V):V=t[40];let H;return t[41]!==V||t[42]!==P||t[43]!==R?(H=(0,g.jsxs)(`section`,{className:P,children:[R,V]}),t[41]=V,t[42]=P,t[43]=R,t[44]=H):H=t[44],H}function v(e){return(0,g.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function y(){return p.list()}function b(e){return e.language}export{_ as t};
|