@xopcai/xopc 0.0.134 → 0.0.136
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/Combination-HAlzriaz.js +41 -0
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-mQ4lbZRf.js → agent-avatar-dicebear-CER17NHM.js} +1 -1
- package/dist/gateway/static/root/assets/agents-Bv5R-N8Q.js +2 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-Bj2YJiQe.js → app-management-settings-panel-B3Ap_wpX.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-B93olV5Z.js → appearance-settings-3kBO22Xd.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-BHYbGQcZ.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-D_yymKFJ.js → archive-plugin-D_vGeNB8.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-kfyH3HV-.js → attachment-load-hWV_8pHL.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-DyGBB2WH.js → automation-suggestion-card-DVKmVTIo.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-BCTXpOBp.js +4 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BX1AXf98.js → binary-plugins-BuXIeSPc.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-D-WEVNHU.js → block-editor-C1m0u-UU.js} +39 -39
- package/dist/gateway/static/root/assets/browser-settings-page-ChUF08V5.js +8 -0
- package/dist/gateway/static/root/assets/capability-presets-api-B7WWYaEh.js +1 -0
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-CHExb90z.js → capability-presets-settings-panel-D_Bh1PnA.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-RANYrzfa.js → channel-recipient-api-sV06LCht.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-BI2ChQc7.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-MY4Xh4fM.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-qgvEp09M.js +2 -0
- package/dist/gateway/static/root/assets/desktop-pet-BxMJlvb-.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-settings-C3JDiXSu.js → desktop-pet-settings-DCvpDImn.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-MT71cjgl.js → directory-picker-path-field-D1nxs9PA.js} +1 -1
- package/dist/gateway/static/root/assets/dist-Mys7eFJ5.js +1 -0
- package/dist/gateway/static/root/assets/{dreaming-settings-Cfx_Qg4R.js → dreaming-settings-EAWkpOgw.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-Wp23cLkf.js → extension-debug-page-LUQ8dE8z.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-B5HRNtVY.js → extension-page-B_mnhoRd.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-zPfMpsYi.js → extension-settings-page-BWQsGmvW.js} +1 -1
- package/dist/gateway/static/root/assets/{fetch-6HXXdO77.js → fetch-BWXmBizE.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-CsS_3Ii6.js → gateway-config-api-M9bzPASf.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DOxh0hei.js → gateway-settings-CbgtpprN.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BE1M9fH_.js → gateway-startup-retry-BALL91S7.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-CbP4t9aM.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-DlwI-MZZ.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api--3Vzceq-.js → goals-config-api-BBhFVzBS.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-D26r7knp.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-Dg_hQNVC.js → goals-settings-DdmVG_TR.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-CecoDTZJ.js → heartbeat-settings-DZW2Xq-U.js} +1 -1
- package/dist/gateway/static/root/assets/index-CPwVzi9x.css +1 -0
- package/dist/gateway/static/root/assets/index-DZOm5_ex.js +262 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BWMLAFxf.js → keyboard-shortcuts-settings-1IWd88-T.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DxoKJO7-.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-5tvDwUMS.js → markdown-split-BtdBj32h.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-RSjPG4B0.js → media-plugins-CpoPj3s8.js} +1 -1
- package/dist/gateway/static/root/assets/messages-CQ_k8RHj.js +3 -0
- package/dist/gateway/static/root/assets/models-hub-panel-D1Rp__dV.js +2 -0
- package/dist/gateway/static/root/assets/notes-page-CgR1bO2W.js +1 -0
- package/dist/gateway/static/root/assets/notes-workbench-ozsnmDTV.js +2 -0
- package/dist/gateway/static/root/assets/{page-tabs-DYNWfN6S.js → page-tabs-CVLqCfQB.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-B50PdIc8.js → preview-open-alternatives-CKUXJk2t.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-B4dqFAQF.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DlRGXv4a.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-rZEYQMZV.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-DggNb0SF.js → save-bar-controls-BtGni268.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-T4ti2C8S.js → schedule-field-BDGzKVWn.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-D6wGEfEa.js → schema-form-DQJsKMCE.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DxGoCGU8.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-4e8ZQwxr.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-Cgd_aLBV.js → settings-collapsible-section-c8XGd4-8.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-DnDrLMWZ.js → settings-form-section-By0YiDWo.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-A2OshMK8.js → settings-loading-skeleton-SYCPY-WM.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-CXMK9Vb3.js → settings-page-D9NwvnBt.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-Da_LNPDS.js → settings-page-layout-CrICyGob.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-IjK-hDxf.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BGZV-PCJ.js → share-preview-page-Dfnk9M_m.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-vQiRBra7.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BIWv778A.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-CruV215G.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-D8uzXP0Y.js → system-settings-panel-BBVbSDFD.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-DQxv2BHa.js → typed-models-lib-CwFayhxu.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-BCBfSoHx.js → use-channel-catalog-BKtHOM50.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-settings-panel-DkZSHsIs.js → user-profile-settings-panel-_KDWzagh.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-ivGpUrZi.js → utils-BiUjIHb4.js} +1 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-agJqlm4o.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-Bdw4ATCb.js +1 -0
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-D-Dy6mTy.js +3 -0
- package/dist/gateway/static/root/assets/workflow-start-dialog-GammZ2GK.js +1 -0
- package/dist/gateway/static/root/assets/workflows-page-Cw5zrqti.js +18 -0
- package/dist/gateway/static/root/index.html +7 -8
- package/dist/package.js +1 -1
- package/dist/src/agent/image/inbound-image-handling.d.ts +1 -0
- package/dist/src/agent/image/inbound-image-handling.js +4 -1
- package/dist/src/agent/image/inbound-image-handling.js.map +1 -1
- package/dist/src/agent/image/tool-model-config.d.ts +18 -2
- package/dist/src/agent/image/tool-model-config.js +100 -14
- package/dist/src/agent/image/tool-model-config.js.map +1 -1
- package/dist/src/agent/image/vision-detection.js +4 -23
- package/dist/src/agent/image/vision-detection.js.map +1 -1
- package/dist/src/agent/inbound/attachment-pipeline.js +3 -0
- package/dist/src/agent/inbound/attachment-pipeline.js.map +1 -1
- package/dist/src/agent/messaging/command-handler.d.ts +5 -2
- package/dist/src/agent/messaging/command-handler.js +4 -3
- package/dist/src/agent/messaging/command-handler.js.map +1 -1
- package/dist/src/agent/service/btw-query.d.ts +2 -0
- package/dist/src/agent/service/btw-query.js +4 -2
- package/dist/src/agent/service/btw-query.js.map +1 -1
- package/dist/src/agent/service/direct-turn-helpers.d.ts +2 -0
- package/dist/src/agent/service/direct-turn-helpers.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js.map +1 -1
- package/dist/src/agent/service/process-direct-streaming.js +58 -1
- package/dist/src/agent/service/process-direct-streaming.js.map +1 -1
- package/dist/src/agent/service.js +1 -1
- package/dist/src/agent/service.js.map +1 -1
- package/dist/src/agent/session/session-inspector.d.ts +2 -1
- package/dist/src/agent/session/session-inspector.js +5 -3
- package/dist/src/agent/session/session-inspector.js.map +1 -1
- package/dist/src/agent/tools/factory.js +2 -1
- package/dist/src/agent/tools/factory.js.map +1 -1
- package/dist/src/agent/tools/image-tool.d.ts +1 -0
- package/dist/src/agent/tools/image-tool.js +4 -1
- package/dist/src/agent/tools/image-tool.js.map +1 -1
- package/dist/src/chat-commands/builtins/review.js +94 -7
- package/dist/src/chat-commands/builtins/review.js.map +1 -1
- package/dist/src/chat-commands/context.d.ts +5 -3
- package/dist/src/chat-commands/context.js +5 -2
- package/dist/src/chat-commands/context.js.map +1 -1
- package/dist/src/chat-commands/index.d.ts +1 -1
- package/dist/src/chat-commands/index.js.map +1 -1
- package/dist/src/chat-commands/types.d.ts +12 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/gateway/agents-admin.d.ts +5 -0
- package/dist/src/gateway/agents-admin.js +6 -1
- package/dist/src/gateway/agents-admin.js.map +1 -1
- package/dist/src/gateway/hono/routes/models.js +2 -1
- package/dist/src/gateway/hono/routes/models.js.map +1 -1
- package/dist/src/gateway/hono/routes/projects.js +88 -0
- package/dist/src/gateway/hono/routes/projects.js.map +1 -1
- package/dist/src/gateway/hono/routes/sessions.js +2 -1
- package/dist/src/gateway/hono/routes/sessions.js.map +1 -1
- package/dist/src/gateway/hono/routes/workflows.js +1 -0
- package/dist/src/gateway/hono/routes/workflows.js.map +1 -1
- package/dist/src/gateway/image-capabilities.d.ts +7 -1
- package/dist/src/gateway/image-capabilities.js +16 -3
- package/dist/src/gateway/image-capabilities.js.map +1 -1
- package/dist/src/gateway/service/sessions-api.d.ts +1 -0
- package/dist/src/gateway/service/sessions-api.js.map +1 -1
- package/dist/src/gateway/service.js +3 -3
- package/dist/src/projects/project-loop.js +2 -2
- package/dist/src/projects/project-loop.js.map +1 -1
- package/dist/src/review/review-types.js +2 -1
- package/dist/src/review/review-types.js.map +1 -1
- package/dist/src/session/client-history.d.ts +1 -0
- package/dist/src/session/client-history.js +56 -0
- package/dist/src/session/client-history.js.map +1 -1
- package/dist/src/session/index.js +1 -1
- package/dist/src/session/manager.d.ts +1 -0
- package/dist/src/session/manager.js.map +1 -1
- package/dist/src/session/store.d.ts +1 -0
- package/dist/src/session/store.js +30 -1
- package/dist/src/session/store.js.map +1 -1
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/components/assistant-message.js +10 -3
- package/dist/src/tui/components/assistant-message.js.map +1 -1
- package/dist/src/tui/components/bash-execution.d.ts +4 -0
- package/dist/src/tui/components/bash-execution.js +15 -7
- package/dist/src/tui/components/bash-execution.js.map +1 -1
- package/dist/src/tui/tool-summary.js +9 -3
- package/dist/src/tui/tool-summary.js.map +1 -1
- package/dist/src/tui/tui-submit.d.ts +3 -0
- package/dist/src/tui/tui-submit.js +24 -1
- package/dist/src/tui/tui-submit.js.map +1 -1
- package/dist/src/tui/tui.js +29 -2
- package/dist/src/tui/tui.js.map +1 -1
- package/dist/src/work-items/index.d.ts +1 -0
- package/dist/src/work-items/index.js +2 -1
- package/dist/src/work-items/work-item-workflow-judge.d.ts +8 -0
- package/dist/src/work-items/work-item-workflow-judge.js +50 -0
- package/dist/src/work-items/work-item-workflow-judge.js.map +1 -0
- package/dist/src/workflows/domain/run.d.ts +17 -0
- package/dist/src/workflows/domain/run.js.map +1 -1
- package/dist/src/workflows/service/workflow-run-service.d.ts +3 -0
- package/dist/src/workflows/service/workflow-run-service.js +67 -0
- package/dist/src/workflows/service/workflow-run-service.js.map +1 -1
- package/dist/src/workflows/service/workflow-run-service.types.d.ts +4 -1
- package/dist/src/workflows/service/workflow-session-bridge.d.ts +1 -0
- package/dist/src/workflows/service/workflow-session-bridge.js +45 -0
- package/dist/src/workflows/service/workflow-session-bridge.js.map +1 -1
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/Combination-BzaXOLd9.js +0 -41
- package/dist/gateway/static/root/assets/agents-BP0iRtiu.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-12_2SDFq.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-V-tw6y1o.js +0 -4
- package/dist/gateway/static/root/assets/browser-settings-page-aMPnxWXi.js +0 -8
- package/dist/gateway/static/root/assets/capability-presets-api-CsaY2Z8B.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-N8NujD--.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-BG_j4Ci-.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-zBJbFgnK.js +0 -2
- package/dist/gateway/static/root/assets/desktop-pet-DfA-hVlt.js +0 -1
- package/dist/gateway/static/root/assets/dist-CkobR7mk.js +0 -1
- package/dist/gateway/static/root/assets/dist-DokQNVMQ.js +0 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-BOWSTGB-.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-CCLgkqj1.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-CsfIp8Vl.js +0 -2
- package/dist/gateway/static/root/assets/index-BOme955B.js +0 -262
- package/dist/gateway/static/root/assets/index-DXUkWmeK.css +0 -1
- package/dist/gateway/static/root/assets/logs-page-CW7AMYhN.js +0 -7
- package/dist/gateway/static/root/assets/messages-DR9ODkb8.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-panel-mKfeyGVq.js +0 -2
- package/dist/gateway/static/root/assets/notes-page-DYw5zPeJ.js +0 -1
- package/dist/gateway/static/root/assets/notes-workbench-SPdKpvSN.js +0 -2
- package/dist/gateway/static/root/assets/project-detail-page-D3yP4K3k.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B6EV45NR.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-9foX60FQ.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BReBhxWd.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DNDBN4nT.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-C8UtBMJ_.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-xXAMKlc7.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CurjHfEM.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BRR7NQkL.js +0 -2
- package/dist/gateway/static/root/assets/voice-api-key-field-DCiECZN1.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-DAel5CHH.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-2w0zj9eJ.js +0 -3
- package/dist/gateway/static/root/assets/workflow-start-dialog-B5xdDFV-.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-DRhiSwuU.js +0 -18
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jszip.min-DT31yWkU.js","assets/rolldown-runtime-aKtaBQYM.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{t as a}from"./cn-BQ_8x0bT.js";import{t as o}from"./messages-CQ_k8RHj.js";import{a as s,o as c,t as l}from"./fetch-BWXmBizE.js";import{n as u}from"./locale-store-Ba72bFmP.js";import{t as d}from"./config-reload-event-Bjh2zoKp.js";import{Ac as f,Ba as p,Bo as m,Cs as h,Dl as g,El as _,Eo as v,Fr as y,Ga as b,Ir as x,Ka as S,Ks as C,Lr as w,Oc as T,Pr as E,Ua as D,Va as O,Vo as k,Wa as A,Xo as j,ai as M,bc as N,bo as P,fr as F,il as I,kl as L,ko as ee,nl as te,pr as R,qa as z,rl as B,sc as ne,si as V,us as H,yi as re,za as U,zr as ie}from"./index-DZOm5_ex.js";import{t as W}from"./page-tabs-CVLqCfQB.js";import{t as ae}from"./skill-reload-api-BIWv778A.js";var oe=n(),G=e(t(),1),K=r(),se=(0,G.memo)(function(e){let t=(0,oe.c)(23),{loading:n,onReloadClick:r,searchQuery:i,setSearchQuery:a,mainTab:o,sk:s,setPendingFile:c,setInstallOpen:l}=e,u;t[0]!==n||t[1]!==r||t[2]!==s.reloadDiskAria||t[3]!==s.reloadRuntime?(u=(0,K.jsx)(re,{className:`size-9 shrink-0 p-0`,loading:n,label:s.reloadDiskAria,title:s.reloadRuntime,onClick:r}),t[0]=n,t[1]=r,t[2]=s.reloadDiskAria,t[3]=s.reloadRuntime,t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,K.jsx)(H,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),t[5]=d):d=t[5];let f;t[6]===a?f=t[7]:(f=e=>a(e.target.value),t[6]=a,t[7]=f);let p=o===`marketplace`?s.marketplaceSearchPackages:s.searchPlaceholder,m;t[8]!==i||t[9]!==f||t[10]!==p?(m=(0,K.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill border border-edge bg-surface-base py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[d,(0,K.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:i,onChange:f,placeholder:p,autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`})]}),t[8]=i,t[9]=f,t[10]=p,t[11]=m):m=t[11];let g;t[12]!==l||t[13]!==c?(g=()=>{c(null),l(!0)},t[12]=l,t[13]=c,t[14]=g):g=t[14];let _;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,K.jsx)(h,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[15]=_):_=t[15];let y;t[16]!==s.installCta||t[17]!==g?(y=(0,K.jsxs)(v,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,onClick:g,children:[_,s.installCta]}),t[16]=s.installCta,t[17]=g,t[18]=y):y=t[18];let b;return t[19]!==u||t[20]!==m||t[21]!==y?(b=(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[u,m,y]}),t[19]=u,t[20]=m,t[21]=y,t[22]=b):b=t[22],b}),q=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function ce(){let e=(0,oe.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(`div`,{className:a(`h-4 min-w-0 flex-1`,q)}),e[0]=t):t=e[0];let n,r,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[t,(0,K.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,K.jsx)(`div`,{className:a(`size-8 shrink-0 rounded-lg`,q)}),(0,K.jsx)(`div`,{className:a(`h-8 w-[4.5rem] shrink-0 rounded-lg`,q)})]})]}),r=(0,K.jsx)(`div`,{className:a(`h-3 w-full`,q)}),i=(0,K.jsx)(`div`,{className:a(`h-3 w-[92%]`,q)}),e[1]=n,e[2]=r,e[3]=i):(n=e[1],r=e[2],i=e[3]);let o;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,K.jsx)(`div`,{className:`flex h-full min-h-[10.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start gap-3`,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[n,r,i,(0,K.jsxs)(`div`,{className:`mt-auto space-y-1 pt-0.5`,children:[(0,K.jsx)(`div`,{className:a(`h-3 w-full`,q)}),(0,K.jsx)(`div`,{className:a(`h-2.5 w-4/5`,q)})]})]})})}),e[4]=o):o=e[4],o}function J(){let e=(0,oe.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(ce,{}),e[0]=t):t=e[0],t}var le=new Set([`builtin`,`user`,`marketplace`]),ue=new Set([`all`,`global`,`workspace`,`extra`]),de=`mprov`,Y=[`s0`,`s1`,`s2`,`s3`,`s4`,`s5`],fe=[`business`,`creative`,`documents`,`engineering`,`tools`];function pe(e){let t=(0,oe.c)(28),{sk:n,mainTab:r,loading:i,catalog:o,filteredCatalog:s,builtinCategories:c,builtinCategoryFilter:l,setBuiltinCategoryFilter:u,catalogDisplayRows:d,catalogStatusFilter:f,resolveSkillEnabled:p,categoryLabel:m,sourceLabel:h,openSkillDetail:g,onSkillToggle:_,onUseSkillInChat:y,usingSkillInChatName:b,togglingSkillName:x}=e;if(i){let e=n.loading,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=Y.map(me),t[0]=r):r=t[0];let i;return t[1]===n.loading?i=t[2]:(i=(0,K.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,"aria-busy":`true`,"aria-label":e,children:r}),t[1]=n.loading,t[2]=i),i}if(o.length===0){let e;return t[3]===n.empty?e=t[4]:(e=(0,K.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:n.empty}),t[3]=n.empty,t[4]=e),e}if(s.length===0){let e;return t[5]===n.noSearchResults?e=t[6]:(e=(0,K.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:n.noSearchResults}),t[5]=n.noSearchResults,t[6]=e),e}let S;t[7]!==c||t[8]!==l||t[9]!==m||t[10]!==u||t[11]!==n?(S=c.length>1?(0,K.jsx)(W,{items:[{id:``,label:n.marketplaceCategoryAll},...c.map(e=>({id:e,label:m(e),title:m(e)}))],activeTab:l,onChange:u,ariaLabel:n.marketplaceCategoriesAria,tabIdPrefix:`skills-builtin-category-tab`,className:`gap-2 pt-0.5 [scrollbar-width:thin]`,buttonClassName:`max-w-[14rem] truncate rounded-full border px-3 py-1.5 text-xs`,selectedClassName:`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`,unselectedClassName:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`}):null,t[7]=c,t[8]=l,t[9]=m,t[10]=u,t[11]=n,t[12]=S):S=t[12];let C;t[13]!==d||t[14]!==f||t[15]!==r||t[16]!==_||t[17]!==y||t[18]!==g||t[19]!==p||t[20]!==n||t[21]!==h||t[22]!==x||t[23]!==b?(C=d.length===0?(0,K.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:f===`disabled`?n.noDisabledSkills:n.noSearchResults}):(0,K.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:d.map(e=>{let t=p(e);return(0,K.jsxs)(`article`,{className:a(`group flex h-full flex-col rounded-xl bg-surface-panel p-4 shadow-surface transition-colors`,t?`hover:bg-surface-hover`:`bg-amber-50/30 hover:bg-amber-50/50 dark:bg-amber-950/20`),children:[(0,K.jsx)(`div`,{role:`button`,tabIndex:0,className:a(`flex min-h-0 flex-1 cursor-pointer flex-col rounded-lg text-left outline-none`,P.focusRingPanel),"aria-labelledby":`catalog-skill-title-${e.directoryId}`,onClick:t=>{t.target.closest(`button`)||g(e)},onKeyDown:t=>{t.target.closest(`button`)||(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),g(e))},children:(0,K.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,K.jsx)(`h3`,{id:`catalog-skill-title-${e.directoryId}`,className:`min-w-0 flex-1 truncate text-[15px] font-semibold leading-snug tracking-tight text-fg`,children:e.name}),(0,K.jsxs)(`div`,{role:`group`,className:a(`hidden shrink-0 items-center gap-1 transition-opacity sm:flex`,`sm:pointer-events-none sm:opacity-0 sm:group-hover:pointer-events-auto sm:group-hover:opacity-100 sm:group-focus-within:pointer-events-auto sm:group-focus-within:opacity-100`),onClick:Z,onKeyDown:X,children:[t?null:(0,K.jsx)(v,{type:`button`,variant:`primary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:x===e.name,onClick:()=>void _(e.name,!0),children:x===e.name?n.uploading:n.detailModalEnable}),(0,K.jsx)(v,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:!t||b===e.name||x===e.name,title:t?void 0:n.useRequiresEnabled,onClick:()=>void y({name:e.name,source:`catalog`}),children:b===e.name?n.previewUseInChatBusy:n.previewUseInChat})]})]}),(0,K.jsx)(`p`,{className:`line-clamp-2 text-sm leading-relaxed text-fg-muted`,title:e.description?e.description:void 0,children:e.description||`—`}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:r!==`builtin`||e.managed?(0,K.jsxs)(K.Fragment,{children:[r===`builtin`?null:(0,K.jsx)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:h(e.source)}),e.managed?(0,K.jsxs)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:[n.col.managed,`: `,n.yes]}):null,e.hub?(0,K.jsxs)(`span`,{className:`max-w-full break-all rounded-md bg-surface-hover/60 px-2 py-0.5 font-mono text-[10px] leading-snug dark:bg-surface-active/50 line-clamp-2`,title:`${e.hub.source}${e.hub.ref?`\nref: ${e.hub.ref}`:``}\nupdated: ${e.hub.updatedAt}`,children:[n.hubRemote,` ·`,` `,e.hub.kind===`git`?n.hubKindGit:n.hubKindArchive,` ·`,` `,e.hub.source.length>48?`${e.hub.source.slice(0,48)}…`:e.hub.source]}):null]}):null})]})})}),(0,K.jsxs)(`div`,{role:`group`,className:`mt-3 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3 sm:hidden`,children:[t?null:(0,K.jsx)(v,{type:`button`,variant:`primary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:x===e.name,onClick:()=>void _(e.name,!0),children:x===e.name?n.uploading:n.detailModalEnable}),(0,K.jsx)(v,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:!t||b===e.name||x===e.name,title:t?void 0:n.useRequiresEnabled,onClick:()=>void y({name:e.name,source:`catalog`}),children:b===e.name?n.previewUseInChatBusy:n.previewUseInChat})]})]},`${e.directoryId}-${e.path}`)})}),t[13]=d,t[14]=f,t[15]=r,t[16]=_,t[17]=y,t[18]=g,t[19]=p,t[20]=n,t[21]=h,t[22]=x,t[23]=b,t[24]=C):C=t[24];let w;return t[25]!==S||t[26]!==C?(w=(0,K.jsxs)(K.Fragment,{children:[S,C]}),t[25]=S,t[26]=C,t[27]=w):w=t[27],w}function X(e){return e.stopPropagation()}function Z(e){return e.stopPropagation()}function me(e){return(0,K.jsx)(J,{},e)}var Q=`https://skillhub.cn`,he=`https://clawhub.ai`;function ge(e){let t=e.trim();return t?`${Q}/skills/${encodeURIComponent(t)}`:null}function _e(e){let t=e.trim();return t?`${he}/${encodeURIComponent(t)}`:null}function ve(e,t){return e===`skillhub`?ge(t):e===`clawhub`?_e(t):null}function ye(e,t){return t===`store`?e.name.trim()||e.id:e.id.trim()||e.name}function be(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function xe(e){let t=[e.kind];return e.label?.trim()&&t.push(e.label.trim()),e.package?.trim()&&t.push(e.package.trim()),e.formula?.trim()&&t.push(e.formula.trim()),e.module?.trim()&&t.push(e.module.trim()),e.url?.trim()&&t.push(e.url.trim()),t.join(` · `)}function Se(e){return{...e,enabled:e.enabled??!0,disableModelInvocation:e.disableModelInvocation??!1}}function Ce(e){let t=(0,oe.c)(32),{sk:n,confirmOpen:r,setConfirmOpen:i,confirmId:a,setConfirmId:o,runDelete:s}=e,c;t[0]!==o||t[1]!==i?(c=e=>{i(e),e||o(null)},t[0]=o,t[1]=i,t[2]=c):c=t[2];let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,K.jsx)(D,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[3]=l):l=t[3];let u;t[4]===n.deleteTitle?u=t[5]:(u=(0,K.jsx)(S,{className:`text-base font-semibold text-fg`,children:n.deleteTitle}),t[4]=n.deleteTitle,t[5]=u);let d;t[6]!==a||t[7]!==n.deleteMessage?(d=a?be(n.deleteMessage,{id:a}):``,t[6]=a,t[7]=n.deleteMessage,t[8]=d):d=t[8];let f;t[9]===d?f=t[10]:(f=(0,K.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:d}),t[9]=d,t[10]=f);let p;t[11]===i?p=t[12]:(p=()=>i(!1),t[11]=i,t[12]=p);let m;t[13]!==n.cancel||t[14]!==p?(m=(0,K.jsx)(v,{type:`button`,variant:`secondary`,onClick:p,children:n.cancel}),t[13]=n.cancel,t[14]=p,t[15]=m):m=t[15];let h;t[16]===s?h=t[17]:(h=()=>void s(),t[16]=s,t[17]=h);let g;t[18]!==n.deleteConfirm||t[19]!==h?(g=(0,K.jsx)(v,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:h,children:n.deleteConfirm}),t[18]=n.deleteConfirm,t[19]=h,t[20]=g):g=t[20];let _;t[21]!==m||t[22]!==g?(_=(0,K.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[m,g]}),t[21]=m,t[22]=g,t[23]=_):_=t[23];let y;t[24]!==_||t[25]!==u||t[26]!==f?(y=(0,K.jsxs)(A,{children:[l,(0,K.jsxs)(O,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,children:[u,f,_]})]}),t[24]=_,t[25]=u,t[26]=f,t[27]=y):y=t[27];let x;return t[28]!==r||t[29]!==c||t[30]!==y?(x=(0,K.jsx)(b,{open:r,onOpenChange:c,children:y}),t[28]=r,t[29]=c,t[30]=y,t[31]=x):x=t[31],x}var we=[{light:`bg-sky-100 text-sky-800`,dark:`dark:bg-sky-950/55 dark:text-sky-200`},{light:`bg-violet-100 text-violet-800`,dark:`dark:bg-violet-950/55 dark:text-violet-200`},{light:`bg-emerald-100 text-emerald-800`,dark:`dark:bg-emerald-950/55 dark:text-emerald-200`},{light:`bg-orange-100 text-orange-800`,dark:`dark:bg-orange-950/55 dark:text-orange-200`},{light:`bg-rose-100 text-rose-800`,dark:`dark:bg-rose-950/55 dark:text-rose-200`},{light:`bg-amber-100 text-amber-900`,dark:`dark:bg-amber-950/55 dark:text-amber-200`},{light:`bg-cyan-100 text-cyan-800`,dark:`dark:bg-cyan-950/55 dark:text-cyan-200`},{light:`bg-indigo-100 text-indigo-800`,dark:`dark:bg-indigo-950/55 dark:text-indigo-200`},{light:`bg-fuchsia-100 text-fuchsia-800`,dark:`dark:bg-fuchsia-950/55 dark:text-fuchsia-200`},{light:`bg-teal-100 text-teal-800`,dark:`dark:bg-teal-950/55 dark:text-teal-200`}];function Te(e){let t=0;for(let n=0;n<e.length;n+=1)t=Math.imul(31,t)+e.charCodeAt(n)|0;return Math.abs(t)}function Ee(e){let t=e.trim();if(!t)return`?`;let n=t.match(/[\p{L}\p{N}]/u);return n?n[0].toLocaleUpperCase(`en-US`):t[0]}function De(e){let t=(0,oe.c)(9),{name:n,className:r}=e,i;t[0]===n?i=t[1]:(i=Ee(n),t[0]=n,t[1]=i);let o=i,s=we[Te(n)%we.length],c;t[2]!==r||t[3]!==s.dark||t[4]!==s.light?(c=a(`flex size-11 shrink-0 items-center justify-center rounded-xl font-semibold tracking-tight shadow-surface`,`text-[1.05rem] ring-1 ring-inset ring-black/[0.06] dark:ring-white/[0.1]`,`transition-[transform,box-shadow] duration-200 ease-out group-hover:ring-black/[0.1] dark:group-hover:ring-white/[0.14]`,`group-hover:-translate-y-px`,s.light,s.dark,r),t[2]=r,t[3]=s.dark,t[4]=s.light,t[5]=c):c=t[5];let l;return t[6]!==o||t[7]!==c?(l=(0,K.jsx)(`div`,{className:c,"aria-hidden":!0,children:o}),t[6]=o,t[7]=c,t[8]=l):l=t[8],l}function Oe(e){let t=(0,oe.c)(7),{label:n,children:r}=e;if(r==null||r===!1)return null;let i;t[0]===n?i=t[1]:(i=(0,K.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,K.jsx)(`div`,{className:`mt-1.5 min-w-0 text-sm text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,K.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3 dark:border-edge/60`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function ke(e){let t=(0,oe.c)(118),{preview:n,sk:r}=e,i=n.metadata,o=n.toolConditions,s=!!o&&(o.requiresTools.length>0||o.requiresToolsets.length>0||o.fallbackForTools.length>0||o.fallbackForToolsets.length>0),c=i.requires,l=c&&((c.bins?.length??0)>0||(c.env?.length??0)>0||(c.anyBins?.length??0)>0),u,d,f,p,m,h,g,_,v,y,b,x,S,C,w;if(t[0]!==o||t[1]!==l||t[2]!==s||t[3]!==i.emoji||t[4]!==i.homepage||t[5]!==i.install||t[6]!==i.os||t[7]!==n.description||t[8]!==n.disableModelInvocation||t[9]!==n.requiredEnvVarNames||t[10]!==c||t[11]!==r.detailEnvVarsLabel||t[12]!==r.detailHomepageLabel||t[13]!==r.detailInstallLabel||t[14]!==r.detailNotInjectedNote||t[15]!==r.detailPlatformsLabel||t[16]!==r.detailRequiresAnyBins||t[17]!==r.detailRequiresBins||t[18]!==r.detailRequiresEnv||t[19]!==r.detailRequiresLabel||t[20]!==r.detailSummaryHeading||t[21]!==r.detailToolGatingLabel||t[22]!==r.detailToolsFallbackList||t[23]!==r.detailToolsRequiresList||t[24]!==r.detailToolsetsFallbackList||t[25]!==r.detailToolsetsRequiresList){let e=i.install?.filter(Me)??[],T=n.requiredEnvVarNames?.filter(je)??[];g=`space-y-6`,m=`skill-detail-summary-heading`,t[41]===r.detailSummaryHeading?h=t[42]:(h=(0,K.jsx)(`h3`,{id:`skill-detail-summary-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:r.detailSummaryHeading}),t[41]=r.detailSummaryHeading,t[42]=h),v=`rounded-xl border border-edge bg-surface-base px-4 py-3 dark:bg-surface-hover/25`,t[43]===i.emoji?y=t[44]:(y=i.emoji?.trim()?(0,K.jsx)(`p`,{className:`text-2xl leading-none`,"aria-hidden":!0,children:i.emoji.trim()}):null,t[43]=i.emoji,t[44]=y);let E;t[45]===i.emoji?E=t[46]:(E=i.emoji?.trim()?`mt-2`:``,t[45]=i.emoji,t[46]=E);let D;t[47]===E?D=t[48]:(D=a(`text-sm leading-relaxed text-fg`,E),t[47]=E,t[48]=D),t[49]!==n.description||t[50]!==D?(b=(0,K.jsx)(`p`,{className:D,children:n.description}),t[49]=n.description,t[50]=D,t[51]=b):b=t[51],t[52]!==n.disableModelInvocation||t[53]!==r.detailNotInjectedNote?(x=n.disableModelInvocation?(0,K.jsx)(`p`,{className:`mt-3 rounded-lg border border-amber-200/80 bg-amber-50/90 px-3 py-2 text-xs leading-snug text-amber-950 dark:border-amber-900/50 dark:bg-amber-950/40 dark:text-amber-100`,children:r.detailNotInjectedNote}):null,t[52]=n.disableModelInvocation,t[53]=r.detailNotInjectedNote,t[54]=x):x=t[54];let O;t[55]===i.homepage?O=t[56]:(O=i.homepage?.trim()?(0,K.jsx)(`a`,{href:i.homepage.trim(),target:`_blank`,rel:`noopener noreferrer`,className:`break-all text-accent underline-offset-2 hover:underline`,children:i.homepage.trim()}):null,t[55]=i.homepage,t[56]=O),t[57]!==r.detailHomepageLabel||t[58]!==O?(S=(0,K.jsx)(Oe,{label:r.detailHomepageLabel,children:O}),t[57]=r.detailHomepageLabel,t[58]=O,t[59]=S):S=t[59];let k;t[60]===i.os?k=t[61]:(k=i.os&&i.os.length>0?(0,K.jsx)(`span`,{className:`font-mono text-xs text-fg-muted`,children:i.os.join(`, `)}):null,t[60]=i.os,t[61]=k),t[62]!==r.detailPlatformsLabel||t[63]!==k?(C=(0,K.jsx)(Oe,{label:r.detailPlatformsLabel,children:k}),t[62]=r.detailPlatformsLabel,t[63]=k,t[64]=C):C=t[64];let A;t[65]!==l||t[66]!==c||t[67]!==r.detailRequiresAnyBins||t[68]!==r.detailRequiresBins||t[69]!==r.detailRequiresEnv?(A=l&&c?(0,K.jsxs)(`ul`,{className:`list-inside list-disc space-y-1 text-sm text-fg-muted`,children:[c.bins&&c.bins.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`text-fg`,children:[r.detailRequiresBins,`: `]}),c.bins.join(`, `)]}):null,c.env&&c.env.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`text-fg`,children:[r.detailRequiresEnv,`: `]}),(0,K.jsx)(`span`,{className:`font-mono text-xs`,children:c.env.join(`, `)})]}):null,c.anyBins&&c.anyBins.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`text-fg`,children:[r.detailRequiresAnyBins,`: `]}),c.anyBins.join(`, `)]}):null]}):null,t[65]=l,t[66]=c,t[67]=r.detailRequiresAnyBins,t[68]=r.detailRequiresBins,t[69]=r.detailRequiresEnv,t[70]=A):A=t[70],t[71]!==r.detailRequiresLabel||t[72]!==A?(w=(0,K.jsx)(Oe,{label:r.detailRequiresLabel,children:A}),t[71]=r.detailRequiresLabel,t[72]=A,t[73]=w):w=t[73];let j=e.length>0?(0,K.jsx)(`ul`,{className:`list-inside list-decimal space-y-1.5 text-sm text-fg-muted`,children:e.map(Ae)}):null;t[74]!==r.detailInstallLabel||t[75]!==j?(f=(0,K.jsx)(Oe,{label:r.detailInstallLabel,children:j}),t[74]=r.detailInstallLabel,t[75]=j,t[76]=f):f=t[76];let M;t[77]!==o||t[78]!==s||t[79]!==r.detailToolsFallbackList||t[80]!==r.detailToolsRequiresList||t[81]!==r.detailToolsetsFallbackList||t[82]!==r.detailToolsetsRequiresList?(M=s&&o?(0,K.jsxs)(`ul`,{className:`mt-1 space-y-2 text-sm text-fg-muted`,children:[o.requiresTools.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsRequiresList,`: `]}),o.requiresTools.join(`, `)]}):null,o.requiresToolsets.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsetsRequiresList,`: `]}),o.requiresToolsets.join(`, `)]}):null,o.fallbackForTools.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsFallbackList,`: `]}),o.fallbackForTools.join(`, `)]}):null,o.fallbackForToolsets.length>0?(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsetsFallbackList,`: `]}),o.fallbackForToolsets.join(`, `)]}):null]}):null,t[77]=o,t[78]=s,t[79]=r.detailToolsFallbackList,t[80]=r.detailToolsRequiresList,t[81]=r.detailToolsetsFallbackList,t[82]=r.detailToolsetsRequiresList,t[83]=M):M=t[83],t[84]!==r.detailToolGatingLabel||t[85]!==M?(p=(0,K.jsx)(Oe,{label:r.detailToolGatingLabel,children:M}),t[84]=r.detailToolGatingLabel,t[85]=M,t[86]=p):p=t[86],u=Oe,d=r.detailEnvVarsLabel,_=T.length>0?(0,K.jsx)(`span`,{className:`font-mono text-xs text-fg-muted`,children:T.join(`, `)}):null,t[0]=o,t[1]=l,t[2]=s,t[3]=i.emoji,t[4]=i.homepage,t[5]=i.install,t[6]=i.os,t[7]=n.description,t[8]=n.disableModelInvocation,t[9]=n.requiredEnvVarNames,t[10]=c,t[11]=r.detailEnvVarsLabel,t[12]=r.detailHomepageLabel,t[13]=r.detailInstallLabel,t[14]=r.detailNotInjectedNote,t[15]=r.detailPlatformsLabel,t[16]=r.detailRequiresAnyBins,t[17]=r.detailRequiresBins,t[18]=r.detailRequiresEnv,t[19]=r.detailRequiresLabel,t[20]=r.detailSummaryHeading,t[21]=r.detailToolGatingLabel,t[22]=r.detailToolsFallbackList,t[23]=r.detailToolsRequiresList,t[24]=r.detailToolsetsFallbackList,t[25]=r.detailToolsetsRequiresList,t[26]=u,t[27]=d,t[28]=f,t[29]=p,t[30]=m,t[31]=h,t[32]=g,t[33]=_,t[34]=v,t[35]=y,t[36]=b,t[37]=x,t[38]=S,t[39]=C,t[40]=w}else u=t[26],d=t[27],f=t[28],p=t[29],m=t[30],h=t[31],g=t[32],_=t[33],v=t[34],y=t[35],b=t[36],x=t[37],S=t[38],C=t[39],w=t[40];let T;t[87]!==u||t[88]!==d||t[89]!==_?(T=(0,K.jsx)(u,{label:d,children:_}),t[87]=u,t[88]=d,t[89]=_,t[90]=T):T=t[90];let E;t[91]!==f||t[92]!==p||t[93]!==T||t[94]!==v||t[95]!==y||t[96]!==b||t[97]!==x||t[98]!==S||t[99]!==C||t[100]!==w?(E=(0,K.jsxs)(`div`,{className:v,children:[y,b,x,S,C,w,f,p,T]}),t[91]=f,t[92]=p,t[93]=T,t[94]=v,t[95]=y,t[96]=b,t[97]=x,t[98]=S,t[99]=C,t[100]=w,t[101]=E):E=t[101];let D;t[102]!==m||t[103]!==h||t[104]!==E?(D=(0,K.jsxs)(`section`,{"aria-labelledby":m,children:[h,E]}),t[102]=m,t[103]=h,t[104]=E,t[105]=D):D=t[105];let O;t[106]===r.detailInstructionsHeading?O=t[107]:(O=(0,K.jsx)(`h3`,{id:`skill-detail-instructions-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:r.detailInstructionsHeading}),t[106]=r.detailInstructionsHeading,t[107]=O);let k;t[108]!==n.bodyMarkdown||t[109]!==r.detailNoInstructionsBody?(k=n.bodyMarkdown.trim()?(0,K.jsx)(`div`,{className:`markdown-content min-w-0 break-words`,children:(0,K.jsx)(V,{content:n.bodyMarkdown})}):(0,K.jsx)(`p`,{className:`text-sm italic text-fg-muted`,children:r.detailNoInstructionsBody}),t[108]=n.bodyMarkdown,t[109]=r.detailNoInstructionsBody,t[110]=k):k=t[110];let A;t[111]!==O||t[112]!==k?(A=(0,K.jsxs)(`section`,{"aria-labelledby":`skill-detail-instructions-heading`,children:[O,k]}),t[111]=O,t[112]=k,t[113]=A):A=t[113];let j;return t[114]!==g||t[115]!==D||t[116]!==A?(j=(0,K.jsxs)(`div`,{className:g,children:[D,A]}),t[114]=g,t[115]=D,t[116]=A,t[117]=j):j=t[117],j}function Ae(e,t){return(0,K.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:(0,K.jsx)(`span`,{className:`text-fg`,children:xe(e)})},e.id||`${e.kind}-${t}`)}function je(e){return e.trim()}function Me(e){return e&&typeof e.kind==`string`}var Ne=[{id:`s0`,width:`w-[92%]`},{id:`s1`,width:`w-full`},{id:`s2`,width:`w-4/5`},{id:`s3`,width:`w-[92%]`},{id:`s4`,width:`w-full`},{id:`s5`,width:`w-4/5`},{id:`s6`,width:`w-[92%]`},{id:`s7`,width:`w-full`},{id:`s8`,width:`w-4/5`},{id:`s9`,width:`w-[92%]`}];function Pe(e){let t=(0,oe.c)(81),{sk:n,detailOpen:r,setDetailOpen:i,detailSource:o,setDetailSource:s,detailTitle:c,setDetailTitle:l,detailCatalogPreview:u,setDetailCatalogPreview:d,detailMarketplacePreview:h,setDetailMarketplacePreview:g,detailLoading:_,detailError:y,setDetailError:x,detailEnabled:C,detailDirectoryId:w,detailManaged:T,detailExternalUrl:E,usingSkillInChatName:j,installingMarketName:M,togglingSkillName:N,isSkillInstalledByName:F,onUseSkillInChat:I,onMarketInstall:L,onSkillToggle:te,setConfirmId:R,setConfirmOpen:z}=e,B;t[0]!==d||t[1]!==x||t[2]!==g||t[3]!==i||t[4]!==s||t[5]!==l?(B=e=>{i(e),e||(s(`catalog`),d(null),g(null),x(null),l(``))},t[0]=d,t[1]=x,t[2]=g,t[3]=i,t[4]=s,t[5]=l,t[6]=B):B=t[6];let V;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,K.jsx)(D,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[7]=V):V=t[7];let H;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(H=a(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(88vh,44rem)] max-h-[min(92vh,56rem)] w-[min(100%-2rem,min(92vw,56rem))]`,`-translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),t[8]=H):H=t[8];let re=c||`?`,U;t[9]===re?U=t[10]:(U=(0,K.jsx)(De,{name:re}),t[9]=re,t[10]=U);let ie=c||`—`,W;t[11]===ie?W=t[12]:(W=(0,K.jsx)(S,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:ie}),t[11]=ie,t[12]=W);let ae;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(ae=a(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,P.focusRingPanel),t[13]=ae):ae=t[13];let G;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,K.jsx)(ee,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[14]=G):G=t[14];let se;t[15]===n.detailCloseAria?se=t[16]:(se=(0,K.jsx)(p,{asChild:!0,children:(0,K.jsx)(`button`,{type:`button`,className:ae,"aria-label":n.detailCloseAria,children:G})}),t[15]=n.detailCloseAria,t[16]=se);let q;t[17]!==U||t[18]!==W||t[19]!==se?(q=(0,K.jsxs)(`div`,{className:`group flex min-h-[3.25rem] shrink-0 items-center gap-3 border-b border-edge px-4 py-3`,children:[U,W,se]}),t[17]=U,t[18]=W,t[19]=se,t[20]=q):q=t[20];let ce;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,K.jsx)(ne,{className:`mt-0.5 size-4 shrink-0 text-blue-600 dark:text-blue-400`,strokeWidth:1.75,"aria-hidden":!0}),t[21]=ce):ce=t[21];let J=o===`store`&&h?n.detailModalBanner:o===`store`?n.detailModalBannerStore:n.detailModalBanner,le;t[22]===J?le=t[23]:(le=(0,K.jsxs)(`div`,{className:`flex min-h-[3.25rem] shrink-0 items-start gap-2 border-b border-blue-200/80 bg-blue-50/95 px-4 py-2.5 text-sm text-fg dark:border-blue-900/50 dark:bg-blue-950/45`,children:[ce,(0,K.jsx)(`p`,{className:`min-w-0 leading-relaxed`,children:J})]}),t[22]=J,t[23]=le);let ue;t[24]!==u||t[25]!==C||t[26]!==y||t[27]!==_||t[28]!==h||t[29]!==o||t[30]!==n?(ue=(0,K.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-auto p-4`,children:_?(0,K.jsx)(`div`,{className:`flex h-full min-h-[14rem] flex-col gap-2.5 py-1`,"aria-busy":`true`,"aria-label":n.loading,children:Ne.map(Fe)}):y?(0,K.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:y}):o===`catalog`&&u?(0,K.jsxs)(K.Fragment,{children:[C?null:(0,K.jsxs)(`div`,{className:`mb-4 flex items-start gap-2 rounded-xl border border-amber-200 bg-amber-50 px-3 py-2.5 text-sm text-amber-900 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-100`,children:[(0,K.jsx)(m,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-300`,strokeWidth:1.75,"aria-hidden":!0}),(0,K.jsx)(`p`,{className:`leading-relaxed`,children:n.detailDisabledNotice})]}),(0,K.jsx)(ke,{preview:u,sk:n})]}):o===`store`&&h?(0,K.jsx)(ke,{preview:h,sk:n}):(0,K.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:n.detailLoadFailed})}),t[24]=u,t[25]=C,t[26]=y,t[27]=_,t[28]=h,t[29]=o,t[30]=n,t[31]=ue):ue=t[31];let de;t[32]!==E||t[33]!==o||t[34]!==n.marketplaceOpenExternal||t[35]!==n.marketplaceOpenExternalAria?(de=o===`store`&&E?(0,K.jsxs)(`a`,{href:E,target:`_blank`,rel:`noopener noreferrer`,className:a(`inline-flex h-9 items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 text-sm font-medium text-fg-muted`,`hover:bg-surface-hover hover:text-fg dark:border-edge`,P.focusRingPanel),"aria-label":n.marketplaceOpenExternalAria,title:n.marketplaceOpenExternal,children:[(0,K.jsx)(f,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,K.jsx)(`span`,{children:n.marketplaceOpenExternal})]}):null,t[32]=E,t[33]=o,t[34]=n.marketplaceOpenExternal,t[35]=n.marketplaceOpenExternalAria,t[36]=de):de=t[36];let Y;t[37]!==w||t[38]!==T||t[39]!==o||t[40]!==R||t[41]!==z||t[42]!==n.delete?(Y=o===`catalog`&&T&&w?(0,K.jsxs)(v,{type:`button`,variant:`ghost`,className:`gap-1.5 text-red-600 hover:bg-red-50 hover:text-red-700 dark:text-red-400 dark:hover:bg-red-950/40 dark:hover:text-red-300`,onClick:()=>{R(w),z(!0)},children:[(0,K.jsx)(k,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),n.delete]}):null,t[37]=w,t[38]=T,t[39]=o,t[40]=R,t[41]=z,t[42]=n.delete,t[43]=Y):Y=t[43];let fe;t[44]!==de||t[45]!==Y?(fe=(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[de,Y]}),t[44]=de,t[45]=Y,t[46]=fe):fe=t[46];let pe;t[47]!==C||t[48]!==_||t[49]!==o||t[50]!==c||t[51]!==M||t[52]!==F||t[53]!==L||t[54]!==te||t[55]!==I||t[56]!==i||t[57]!==n.cancel||t[58]!==n.detailModalDisable||t[59]!==n.detailModalEnable||t[60]!==n.marketplaceInstall||t[61]!==n.marketplaceReinstall||t[62]!==n.previewUseInChat||t[63]!==n.previewUseInChatBusy||t[64]!==n.uploading||t[65]!==n.useRequiresEnabled||t[66]!==N||t[67]!==j?(pe=(0,K.jsx)(`div`,{className:`flex items-center gap-2`,children:o===`store`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(v,{type:`button`,variant:`ghost`,onClick:()=>i(!1),children:n.cancel}),(0,K.jsx)(v,{type:`button`,variant:`secondary`,disabled:!c||_||j===c||M===c,onClick:()=>void I(),children:j===c?n.previewUseInChatBusy:n.previewUseInChat}),(0,K.jsx)(v,{type:`button`,variant:F(c)?`secondary`:`primary`,disabled:!c||M===c,onClick:()=>{c&&L(c,{useDetailProvider:!0})},children:M===c?n.uploading:F(c)?n.marketplaceReinstall:n.marketplaceInstall})]}):(0,K.jsxs)(K.Fragment,{children:[C?(0,K.jsx)(v,{type:`button`,variant:`secondary`,disabled:!c||N===c,onClick:()=>{c&&te(c,!1)},children:N===c?n.uploading:n.detailModalDisable}):(0,K.jsx)(v,{type:`button`,variant:`primary`,disabled:!c||N===c,onClick:()=>{c&&te(c,!0)},children:N===c?n.uploading:n.detailModalEnable}),(0,K.jsx)(v,{type:`button`,variant:`secondary`,disabled:!c||!C||_||j===c||N===c,title:C?void 0:n.useRequiresEnabled,onClick:()=>void I(),children:j===c?n.previewUseInChatBusy:n.previewUseInChat})]})}),t[47]=C,t[48]=_,t[49]=o,t[50]=c,t[51]=M,t[52]=F,t[53]=L,t[54]=te,t[55]=I,t[56]=i,t[57]=n.cancel,t[58]=n.detailModalDisable,t[59]=n.detailModalEnable,t[60]=n.marketplaceInstall,t[61]=n.marketplaceReinstall,t[62]=n.previewUseInChat,t[63]=n.previewUseInChatBusy,t[64]=n.uploading,t[65]=n.useRequiresEnabled,t[66]=N,t[67]=j,t[68]=pe):pe=t[68];let X;t[69]!==fe||t[70]!==pe?(X=(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-t border-edge px-4 py-3`,children:[fe,pe]}),t[69]=fe,t[70]=pe,t[71]=X):X=t[71];let Z;t[72]!==q||t[73]!==le||t[74]!==ue||t[75]!==X?(Z=(0,K.jsxs)(A,{children:[V,(0,K.jsxs)(O,{className:H,children:[q,le,ue,X]})]}),t[72]=q,t[73]=le,t[74]=ue,t[75]=X,t[76]=Z):Z=t[76];let me;return t[77]!==r||t[78]!==B||t[79]!==Z?(me=(0,K.jsx)(b,{open:r,onOpenChange:B,children:Z}),t[77]=r,t[78]=B,t[79]=Z,t[80]=me):me=t[80],me}function Fe(e){return(0,K.jsx)(`div`,{className:a(`h-4 animate-pulse rounded-md bg-surface-hover dark:bg-surface-active/50`,e.width)},e.id)}function $(e){let t=(0,oe.c)(67),{sk:n,installOpen:r,setInstallOpen:i,pendingFile:o,setPendingFile:s,dropActive:c,setDropActive:l,uploading:u,onModalDragOver:d,onModalDragLeave:f,onModalDrop:m,onFileInputChange:h,onInstallSubmit:g}=e,_;t[0]!==l||t[1]!==i||t[2]!==s?(_=e=>{i(e),e||(s(null),l(!1))},t[0]=l,t[1]=i,t[2]=s,t[3]=_):_=t[3];let v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,K.jsx)(D,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[4]=v):v=t[4];let y;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(y=a(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] max-h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,48rem))] -translate-x-1/2 -translate-y-1/2 overflow-y-auto`,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-float dark:border-edge`),t[5]=y):y=t[5];let x;t[6]===n.installModalTitle?x=t[7]:(x=(0,K.jsx)(S,{className:`text-base font-semibold text-fg`,children:n.installModalTitle}),t[6]=n.installModalTitle,t[7]=x);let C;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=a(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,P.focusRingPanel),t[8]=C):C=t[8];let w;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,K.jsx)(ee,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=w):w=t[9];let E;t[10]===n.installClose?E=t[11]:(E=(0,K.jsx)(`span`,{className:`sr-only`,children:n.installClose}),t[10]=n.installClose,t[11]=E);let k;t[12]!==n.installClose||t[13]!==E?(k=(0,K.jsx)(p,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,className:C,"aria-label":n.installClose,children:[w,E]})}),t[12]=n.installClose,t[13]=E,t[14]=k):k=t[14];let j;t[15]!==x||t[16]!==k?(j=(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[x,k]}),t[15]=x,t[16]=k,t[17]=j):j=t[17];let M=c?`border-accent bg-accent-soft/60 dark:bg-blue-950/40`:`border-edge bg-surface-base dark:bg-surface-hover/30`,N;t[18]===M?N=t[19]:(N=a(`mt-4 flex min-h-[11rem] cursor-pointer flex-col items-center justify-center gap-3 rounded-xl border-2 border-dashed px-6 py-12 text-center transition-colors`,M),t[18]=M,t[19]=N);let F;t[20]!==h||t[21]!==n.installModalDropHint||t[22]!==u?(F=(0,K.jsx)(`input`,{type:`file`,accept:`.zip,.md,application/zip,text/markdown`,className:`sr-only`,"aria-label":n.installModalDropHint,disabled:u,onChange:h}),t[20]=h,t[21]=n.installModalDropHint,t[22]=u,t[23]=F):F=t[23];let I;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,K.jsx)(T,{className:`size-12 text-fg-subtle`,strokeWidth:1.25,"aria-hidden":!0}),t[24]=I):I=t[24];let L;t[25]===n.installModalDropHint?L=t[26]:(L=(0,K.jsx)(`span`,{className:`text-sm text-fg-muted`,children:n.installModalDropHint}),t[25]=n.installModalDropHint,t[26]=L);let te;t[27]===o?te=t[28]:(te=o?(0,K.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:o.name}):null,t[27]=o,t[28]=te);let R;t[29]!==f||t[30]!==d||t[31]!==m||t[32]!==N||t[33]!==F||t[34]!==L||t[35]!==te?(R=(0,K.jsxs)(`label`,{className:N,onDragLeave:f,onDragOver:d,onDrop:m,children:[F,I,L,te]}),t[29]=f,t[30]=d,t[31]=m,t[32]=N,t[33]=F,t[34]=L,t[35]=te,t[36]=R):R=t[36];let z;t[37]===n.installModalReqTitle?z=t[38]:(z=(0,K.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.installModalReqTitle}),t[37]=n.installModalReqTitle,t[38]=z);let B;t[39]===n.installModalReq1?B=t[40]:(B=(0,K.jsx)(`li`,{children:n.installModalReq1}),t[39]=n.installModalReq1,t[40]=B);let ne;t[41]===n.installModalReq2?ne=t[42]:(ne=(0,K.jsx)(`li`,{children:n.installModalReq2}),t[41]=n.installModalReq2,t[42]=ne);let V;t[43]!==B||t[44]!==ne?(V=(0,K.jsxs)(`ul`,{className:`list-inside list-disc space-y-1 text-sm text-fg-muted`,children:[B,ne]}),t[43]=B,t[44]=ne,t[45]=V):V=t[45];let H;t[46]!==z||t[47]!==V?(H=(0,K.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[z,V]}),t[46]=z,t[47]=V,t[48]=H):H=t[48];let re=!o||u,U=!o||u?`cursor-not-allowed bg-surface-active text-fg-disabled`:`bg-accent text-white hover:bg-accent-hover`,ie;t[49]===U?ie=t[50]:(ie=a(`mt-6 flex w-full items-center justify-center rounded-xl py-3 text-sm font-semibold`,`transition-colors`,U,P.focusRingPanel),t[49]=U,t[50]=ie);let W;t[51]===g?W=t[52]:(W=()=>void g(),t[51]=g,t[52]=W);let ae=u?n.uploading:n.installAction,G;t[53]!==re||t[54]!==ie||t[55]!==W||t[56]!==ae?(G=(0,K.jsx)(`button`,{type:`button`,disabled:re,className:ie,onClick:W,children:ae}),t[53]=re,t[54]=ie,t[55]=W,t[56]=ae,t[57]=G):G=t[57];let se;t[58]!==R||t[59]!==H||t[60]!==G||t[61]!==j?(se=(0,K.jsxs)(A,{children:[v,(0,K.jsxs)(O,{className:y,children:[j,R,H,G]})]}),t[58]=R,t[59]=H,t[60]=G,t[61]=j,t[62]=se):se=t[62];let q;return t[63]!==r||t[64]!==_||t[65]!==se?(q=(0,K.jsx)(b,{open:r,onOpenChange:_,children:se}),t[63]=r,t[64]=_,t[65]=se,t[66]=q):q=t[66],q}function Ie(e){let t=(0,oe.c)(66),{sk:n,mpCategories:r,mpCategoriesLoading:i,mpCategoriesError:o,mpPayload:s,mpLoading:c,mpError:l,marketCategoryId:u,setMarketCategoryId:d,marketPage:f,setMarketPage:p,isSkillInstalledByName:m,openMarketplaceDetail:h,onMarketInstall:g,installingMarketName:_,onUseSkillInChat:y,usingSkillInChatName:b,searchInputActive:x,searchQuery:S,setSearchQuery:w,registeredProviders:T,marketBrowseProvider:E,setMarketBrowseProvider:D}=e,O=!x,k,A,M;if(t[0]!==_||t[1]!==m||t[2]!==E||t[3]!==u||t[4]!==f||t[5]!==r||t[6]!==o||t[7]!==i||t[8]!==l||t[9]!==c||t[10]!==s||t[11]!==g||t[12]!==y||t[13]!==h||t[14]!==T||t[15]!==x||t[16]!==S||t[17]!==D||t[18]!==d||t[19]!==p||t[20]!==w||t[21]!==O||t[22]!==n.loading||t[23]!==n.marketplaceAuthor||t[24]!==n.marketplaceCategoriesAria||t[25]!==n.marketplaceCategoryAll||t[26]!==n.marketplaceDownloads||t[27]!==n.marketplaceEmpty||t[28]!==n.marketplaceEmptySearch||t[29]!==n.marketplaceEmptySearchClear||t[30]!==n.marketplaceEmptySearchTryProvider||t[31]!==n.marketplaceInstall||t[32]!==n.marketplaceInstalled||t[33]!==n.marketplacePageNext||t[34]!==n.marketplacePagePrev||t[35]!==n.marketplacePageStatus||t[36]!==n.marketplaceVersion||t[37]!==n.previewUseInChat||t[38]!==n.previewUseInChatBusy||t[39]!==n.uploading||t[40]!==b){let e;t[44]===E?e=t[45]:(e=e=>e.id!==E,t[44]=E,t[45]=e);let N=T.filter(e),F=S.trim(),I;t[46]===n.marketplaceCategoryAll?I=t[47]:(I={id:``,label:n.marketplaceCategoryAll},t[46]=n.marketplaceCategoryAll,t[47]=I);let L;t[48]!==r||t[49]!==I?(L=[I,...r.map(He)],t[48]=r,t[49]=I,t[50]=L):L=t[50];let ee=L;t[51]!==ee||t[52]!==u||t[53]!==r.length||t[54]!==i||t[55]!==d||t[56]!==O||t[57]!==n.marketplaceCategoriesAria?(k=O?r.length>0?(0,K.jsx)(W,{items:ee,activeTab:u,onChange:d,ariaLabel:n.marketplaceCategoriesAria,tabIdPrefix:`skills-marketplace-category-tab`,className:`min-h-[2.75rem] items-center gap-2 pt-0.5 [scrollbar-width:thin]`,buttonClassName:`max-w-[14rem] truncate rounded-full border px-3 py-1.5 text-xs`,selectedClassName:`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`,unselectedClassName:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`}):i?(0,K.jsx)(`div`,{className:`-mx-1 flex min-h-[2.75rem] items-center gap-2 overflow-x-auto px-1 pb-1 pt-0.5 [scrollbar-width:thin]`,"aria-hidden":!0,children:[`p0`,`p1`,`p2`,`p3`,`p4`].map(Ve)}):null:null,t[51]=ee,t[52]=u,t[53]=r.length,t[54]=i,t[55]=d,t[56]=O,t[57]=n.marketplaceCategoriesAria,t[58]=k):k=t[58],t[59]!==o||t[60]!==O?(A=O&&o?(0,K.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,role:`alert`,children:o}):null,t[59]=o,t[60]=O,t[61]=A):A=t[61],M=!s&&!l?(0,K.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,"aria-busy":`true`,"aria-label":n.loading,children:Y.map(Be)}):l&&!s?(0,K.jsx)(`div`,{className:`rounded-xl border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:l}):s?(0,K.jsxs)(`div`,{className:`relative`,children:[c?(0,K.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-[1] flex justify-center bg-surface-panel/40 pt-[min(28vh,7.5rem)] backdrop-blur-[1px] motion-reduce:backdrop-blur-none dark:bg-surface-base/35`,"aria-busy":`true`,"aria-label":n.loading,children:(0,K.jsx)(C,{className:`size-8 shrink-0 animate-spin text-accent motion-reduce:animate-none`,strokeWidth:2,"aria-hidden":!0})}):null,s.items.length===0?(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-3 rounded-2xl border border-dashed border-edge py-12 text-center text-sm text-fg-muted`,children:[(0,K.jsx)(`p`,{className:`px-4`,children:x&&F?be(n.marketplaceEmptySearch,{query:F}):n.marketplaceEmpty}),x?(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[N.map(e=>(0,K.jsx)(v,{type:`button`,variant:`secondary`,className:`h-8 px-3 text-xs`,onClick:()=>D(e.id),children:be(n.marketplaceEmptySearchTryProvider,{provider:e.displayName})},e.id)),(0,K.jsx)(v,{type:`button`,variant:`ghost`,className:`h-8 px-3 text-xs`,onClick:()=>w(``),children:n.marketplaceEmptySearchClear})]}):null]}):(0,K.jsx)(`div`,{className:a(`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,c&&`pointer-events-none opacity-[0.52] motion-reduce:opacity-100`),children:s.items.map(e=>{let t=ye(e,e.providerId??E),r=m(t);return(0,K.jsxs)(`article`,{className:a(`group flex h-full flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,`transition-colors hover:bg-surface-hover`),children:[(0,K.jsx)(`div`,{role:`button`,tabIndex:0,className:a(`flex min-h-0 flex-1 cursor-pointer flex-col rounded-lg text-left outline-none`,P.focusRingPanel),"aria-labelledby":`mp-skill-title-${e.id}`,onClick:n=>{n.target.closest(`button`)||h(t,e.name,e.providerId??void 0)},onKeyDown:n=>{n.target.closest(`button`)||(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),h(t,e.name,e.providerId??void 0))},children:(0,K.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,K.jsx)(`h3`,{id:`mp-skill-title-${e.id}`,className:`min-w-0 flex-1 truncate text-[15px] font-semibold leading-snug tracking-tight text-fg`,children:e.name}),(0,K.jsxs)(`div`,{role:`group`,className:a(`hidden shrink-0 items-center gap-1 transition-opacity sm:flex`,`sm:pointer-events-none sm:opacity-0 sm:group-hover:pointer-events-auto sm:group-hover:opacity-100 sm:group-focus-within:pointer-events-auto sm:group-focus-within:opacity-100`),onClick:ze,onKeyDown:Re,children:[r?null:(0,K.jsx)(v,{type:`button`,variant:`primary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:c||_===t,onClick:()=>void g(t,{providerOverride:e.providerId??null}),children:_===t?n.uploading:n.marketplaceInstall}),(0,K.jsx)(v,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:c||b===t||_===t,onClick:()=>void y({name:t,source:`store`,providerOverride:e.providerId??null}),children:b===t?n.previewUseInChatBusy:n.previewUseInChat})]})]}),(0,K.jsx)(`p`,{className:`line-clamp-2 text-sm leading-relaxed text-fg-muted`,title:e.description?e.description:void 0,children:e.description||`—`}),(0,K.jsxs)(`div`,{className:`mt-auto min-h-[2.625rem] space-y-1 text-[11px] leading-snug text-fg-muted`,children:[(0,K.jsxs)(`p`,{className:`line-clamp-1`,title:`${n.marketplaceAuthor}: ${e.author.username} · ${n.marketplaceDownloads}: ${e.downloads}${e.stars!=null&&e.stars>0?` · ★${e.stars}`:``}${r?` · ${n.marketplaceInstalled}`:``}`,children:[(0,K.jsx)(`span`,{className:`text-fg-subtle`,children:n.marketplaceAuthor}),` `,(0,K.jsx)(`span`,{className:`text-fg`,children:e.author.username}),(0,K.jsx)(`span`,{className:`text-fg-subtle`,children:` · `}),(0,K.jsxs)(`span`,{children:[n.marketplaceDownloads,`: `,e.downloads]}),e.stars!=null&&e.stars>0?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-fg-subtle`,children:` · `}),(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-fg-muted`,children:[(0,K.jsx)(j,{className:`size-3 shrink-0 text-amber-600 dark:text-amber-400`,strokeWidth:2,"aria-hidden":!0}),e.stars]})]}):null,r?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-fg-subtle`,children:` · `}),(0,K.jsx)(`span`,{className:`text-emerald-700 dark:text-emerald-400`,children:n.marketplaceInstalled})]}):null]}),e.latestVersion?(0,K.jsxs)(`p`,{className:`line-clamp-1 min-h-[1.125rem] font-mono text-[10px] text-fg-subtle`,title:`${n.marketplaceVersion}: ${e.latestVersion}`,children:[n.marketplaceVersion,`: `,e.latestVersion]}):null]})]})})}),(0,K.jsxs)(`div`,{role:`group`,className:`mt-3 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3 sm:hidden`,children:[r?null:(0,K.jsx)(v,{type:`button`,variant:`primary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:c||_===t,onClick:()=>void g(t,{providerOverride:e.providerId??null}),children:_===t?n.uploading:n.marketplaceInstall}),(0,K.jsx)(v,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:c||b===t||_===t,onClick:()=>void y({name:t,source:`store`,providerOverride:e.providerId??null}),children:b===t?n.previewUseInChatBusy:n.previewUseInChat})]})]},e.id)})}),s.items.length>0?(0,K.jsxs)(`div`,{className:`mt-3 flex flex-col items-center justify-between gap-3 sm:flex-row`,children:[(0,K.jsx)(`p`,{className:`text-center text-xs text-fg-muted sm:text-left`,children:be(n.marketplacePageStatus,{page:s.meta.page,totalPages:s.meta.totalPages,total:s.meta.total})}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsxs)(v,{type:`button`,variant:`ghost`,className:`h-9 gap-1 px-2`,disabled:c||f<=1,"aria-label":n.marketplacePagePrev,onClick:()=>p(Le),children:[(0,K.jsx)(B,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:n.marketplacePagePrev})]}),(0,K.jsxs)(v,{type:`button`,variant:`ghost`,className:`h-9 gap-1 px-2`,disabled:c||f>=s.meta.totalPages,"aria-label":n.marketplacePageNext,onClick:()=>p(e=>Math.min(s.meta.totalPages,e+1)),children:[(0,K.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:n.marketplacePageNext}),(0,K.jsx)(te,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})]})]})]}):null]}):null,t[0]=_,t[1]=m,t[2]=E,t[3]=u,t[4]=f,t[5]=r,t[6]=o,t[7]=i,t[8]=l,t[9]=c,t[10]=s,t[11]=g,t[12]=y,t[13]=h,t[14]=T,t[15]=x,t[16]=S,t[17]=D,t[18]=d,t[19]=p,t[20]=w,t[21]=O,t[22]=n.loading,t[23]=n.marketplaceAuthor,t[24]=n.marketplaceCategoriesAria,t[25]=n.marketplaceCategoryAll,t[26]=n.marketplaceDownloads,t[27]=n.marketplaceEmpty,t[28]=n.marketplaceEmptySearch,t[29]=n.marketplaceEmptySearchClear,t[30]=n.marketplaceEmptySearchTryProvider,t[31]=n.marketplaceInstall,t[32]=n.marketplaceInstalled,t[33]=n.marketplacePageNext,t[34]=n.marketplacePagePrev,t[35]=n.marketplacePageStatus,t[36]=n.marketplaceVersion,t[37]=n.previewUseInChat,t[38]=n.previewUseInChatBusy,t[39]=n.uploading,t[40]=b,t[41]=k,t[42]=A,t[43]=M}else k=t[41],A=t[42],M=t[43];let N;return t[62]!==k||t[63]!==A||t[64]!==M?(N=(0,K.jsxs)(K.Fragment,{children:[k,A,M]}),t[62]=k,t[63]=A,t[64]=M,t[65]=N):N=t[65],N}function Le(e){return Math.max(1,e-1)}function Re(e){return e.stopPropagation()}function ze(e){return e.stopPropagation()}function Be(e){return(0,K.jsx)(ce,{},e)}function Ve(e){return(0,K.jsx)(`div`,{className:`h-8 w-[4.5rem] shrink-0 animate-pulse rounded-full bg-surface-hover motion-reduce:animate-none dark:bg-surface-active/50`},e)}function He(e){return{id:e.id,label:e.label,title:e.label}}function Ue(e){let t=(0,oe.c)(114),{vm:n}=e,{sk:r,hasToken:i,error:o,actionFeedback:s,skillDiagnostics:c,mainTab:l,setMainTab:u,setSourceFilter:d,builtinTabStats:f,userTabStats:p,catalogDisabledCount:m,catalogStatusFilter:h,setCatalogStatusFilter:g,marketSort:_,setMarketSort:v,marketBrowseProvider:b,setMarketBrowseProvider:S,registeredProviders:C,filterLabel:T,inSettingsShell:D,searchInputActive:O,resultTab:k,setResultTab:A,aggregatedTabCounts:j,aggregatedProviderStatus:M}=n;if(!i){let e;t[0]===n?e=t[1]:(e=(0,K.jsx)(qe,{vm:n}),t[0]=n,t[1]=e);let i;t[2]===r.needToken?i=t[3]:(i=(0,K.jsx)(`div`,{className:`w-full px-3 py-16 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:r.needToken}),t[2]=r.needToken,t[3]=i);let a;return t[4]!==e||t[5]!==i?(a=(0,K.jsxs)(K.Fragment,{children:[e,i]}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}let F;t[7]===r.tabMarketplace?F=t[8]:(F={id:`marketplace`,label:r.tabMarketplace},t[7]=r.tabMarketplace,t[8]=F);let L=`${f.enabled}/${f.total}`,ee;t[9]!==r.tabBuiltin||t[10]!==L?(ee={id:`builtin`,label:r.tabBuiltin,count:L},t[9]=r.tabBuiltin,t[10]=L,t[11]=ee):ee=t[11];let te=`${p.enabled}/${p.total}`,R;t[12]!==r.tabUser||t[13]!==te?(R={id:`user`,label:r.tabUser,count:te},t[12]=r.tabUser,t[13]=te,t[14]=R):R=t[14];let z;t[15]!==F||t[16]!==ee||t[17]!==R?(z=[F,ee,R],t[15]=F,t[16]=ee,t[17]=R,t[18]=z):z=t[18];let B=z,ne;t[19]===C?ne=t[20]:(ne=[`all`,...C.map(Ke)],t[19]=C,t[20]=ne);let V=ne,H;t[21]!==M||t[22]!==j||t[23]!==C||t[24]!==r.marketplaceLoadFailed||t[25]!==r.marketplaceResultsTabAll||t[26]!==V?(H=V.map(e=>{let t=e===`all`?r.marketplaceResultsTabAll:C.find(t=>t.id===e)?.displayName??e,n=j[e]??0,i=e===`all`?null:M[e];return{id:e,label:t,title:i===`error`?`${t} · ${r.marketplaceLoadFailed}`:void 0,suffix:i===`loading`?(0,K.jsx)(`span`,{className:`inline-block size-1.5 animate-pulse rounded-full bg-fg-muted/60 motion-reduce:animate-none`,"aria-hidden":!0}):i===`error`?(0,K.jsx)(`span`,{className:`inline-block size-1.5 rounded-full bg-red-500`,"aria-hidden":!0}):(0,K.jsx)(`span`,{className:`tabular-nums opacity-70`,children:n})}}),t[21]=M,t[22]=j,t[23]=C,t[24]=r.marketplaceLoadFailed,t[25]=r.marketplaceResultsTabAll,t[26]=V,t[27]=H):H=t[27];let re=H,U;t[28]===n?U=t[29]:(U=(0,K.jsx)(qe,{vm:n}),t[28]=n,t[29]=U);let ae;t[30]!==s||t[31]!==o?(ae=s?(0,K.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:a(`rounded-xl border px-3 py-2 text-sm`,s.kind===`success`?`border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900/40 dark:bg-emerald-950/40 dark:text-emerald-200`:`border-red-200 bg-red-50 text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`),children:s.message}):o?(0,K.jsx)(`div`,{className:`rounded-xl border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:o}):null,t[30]=s,t[31]=o,t[32]=ae):ae=t[32];let G;t[33]===c?G=t[34]:(G=c.length>0?(0,K.jsxs)(`div`,{className:`rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-200`,role:`status`,children:[(0,K.jsxs)(`div`,{className:`font-medium`,children:[`Skill diagnostics: `,c.length]}),(0,K.jsx)(`ul`,{className:`mt-1 space-y-1`,children:c.slice(0,3).map(Ge)})]}):null,t[33]=c,t[34]=G);let q;t[35]!==D||t[36]!==n.loading||t[37]!==n.mainTab||t[38]!==n.onReloadClick||t[39]!==n.searchQuery||t[40]!==n.setInstallOpen||t[41]!==n.setPendingFile||t[42]!==n.setSearchQuery||t[43]!==n.sk?(q=D?(0,K.jsx)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-4 dark:border-edge-subtle sm:flex-row sm:flex-wrap sm:items-center sm:justify-end`,children:(0,K.jsx)(se,{loading:n.loading,onReloadClick:n.onReloadClick,searchQuery:n.searchQuery,setSearchQuery:n.setSearchQuery,mainTab:n.mainTab,sk:n.sk,setPendingFile:n.setPendingFile,setInstallOpen:n.setInstallOpen})}):null,t[35]=D,t[36]=n.loading,t[37]=n.mainTab,t[38]=n.onReloadClick,t[39]=n.searchQuery,t[40]=n.setInstallOpen,t[41]=n.setPendingFile,t[42]=n.setSearchQuery,t[43]=n.sk,t[44]=q):q=t[44];let ce;t[45]!==l||t[46]!==B||t[47]!==u||t[48]!==r.skillsNavAria?(ce=(0,K.jsx)(W,{items:B,activeTab:l,onChange:u,ariaLabel:r.skillsNavAria,tabIdPrefix:`skills-tab`,panelIdPrefix:`skills-panel`,className:`flex-wrap`}),t[45]=l,t[46]=B,t[47]=u,t[48]=r.skillsNavAria,t[49]=ce):ce=t[49];let J=l===`user`?`flex-nowrap overflow-x-auto pb-0.5 sm:justify-end`:`flex-wrap sm:justify-end`,le;t[50]===J?le=t[51]:(le=a(`flex min-h-9 min-w-0 items-center gap-2`,J),t[50]=J,t[51]=le);let ue;t[52]!==T||t[53]!==l||t[54]!==d||t[55]!==r.filterAll||t[56]!==r.filterExtra||t[57]!==r.filterGlobal||t[58]!==r.filterWorkspace?(ue=l===`user`?(0,K.jsxs)(w,{children:[(0,K.jsx)(ie,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,className:a(`inline-flex h-9 min-h-9 min-w-[9rem] shrink-0 items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,P.transition,P.focusRingPanel),children:[(0,K.jsx)(N,{className:`size-3.5 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,K.jsx)(`span`,{children:T}),(0,K.jsx)(I,{className:`size-3.5 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0})]})}),(0,K.jsx)(x,{children:(0,K.jsx)(E,{className:`z-50 min-w-[10rem] rounded-xl border border-edge bg-surface-panel p-1 shadow-popover dark:border-edge`,sideOffset:6,align:`end`,children:[`all`,`global`,`workspace`,`extra`].map(e=>(0,K.jsx)(y,{className:a(`cursor-pointer rounded-lg px-3 py-2 text-sm text-fg outline-none`,`hover:bg-surface-hover data-[highlighted]:bg-surface-hover`),onSelect:()=>d(e),children:e===`all`?r.filterAll:e===`global`?r.filterGlobal:e===`workspace`?r.filterWorkspace:r.filterExtra},e))})})]}):null,t[52]=T,t[53]=l,t[54]=d,t[55]=r.filterAll,t[56]=r.filterExtra,t[57]=r.filterGlobal,t[58]=r.filterWorkspace,t[59]=ue):ue=t[59];let de;t[60]!==l||t[61]!==b||t[62]!==_||t[63]!==C||t[64]!==k||t[65]!==re||t[66]!==O||t[67]!==S||t[68]!==v||t[69]!==A||t[70]!==r.marketplaceBrowseSwitchAria||t[71]!==r.marketplaceResultsTabsAria||t[72]!==r.marketplaceSortDownloads||t[73]!==r.marketplaceSortNewest?(de=l===`marketplace`?O?(0,K.jsx)(W,{items:re,activeTab:k,onChange:A,ariaLabel:r.marketplaceResultsTabsAria,tabIdPrefix:`skills-marketplace-results-tab`,panelIdPrefix:`skills-marketplace-results-panel`,className:`inline-flex h-9 shrink-0 rounded-lg border border-edge bg-surface-panel p-0.5 shadow-surface`,buttonClassName:`rounded-md px-2.5 py-1.5 text-xs`,selectedClassName:`bg-fg text-surface-panel dark:bg-fg dark:text-surface-base`,unselectedClassName:`text-fg-muted hover:text-fg`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`inline-flex h-9 shrink-0 rounded-lg border border-edge bg-surface-panel p-0.5 shadow-surface`,role:`group`,"aria-label":r.marketplaceBrowseSwitchAria,children:C.map(e=>{let t=b===e.id;return(0,K.jsx)(`button`,{type:`button`,className:a(`rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors`,P.focusRingPanel,t?`bg-fg text-surface-panel dark:bg-fg dark:text-surface-base`:`text-fg-muted hover:text-fg`),"aria-pressed":t,onClick:()=>S(e.id),children:e.displayName},e.id)})}),(0,K.jsxs)(w,{children:[(0,K.jsx)(ie,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,className:a(`inline-flex h-9 min-h-9 min-w-[9rem] shrink-0 items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,P.transition,P.focusRingPanel),children:[(0,K.jsx)(N,{className:`size-3.5 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,K.jsx)(`span`,{children:_===`newest`?r.marketplaceSortNewest:r.marketplaceSortDownloads}),(0,K.jsx)(I,{className:`size-3.5 text-fg-subtle`,strokeWidth:1.75,"aria-hidden":!0})]})}),(0,K.jsx)(x,{children:(0,K.jsxs)(E,{className:`z-50 min-w-[10rem] rounded-xl border border-edge bg-surface-panel p-1 shadow-popover dark:border-edge`,sideOffset:6,align:`end`,children:[(0,K.jsx)(y,{className:a(`cursor-pointer rounded-lg px-3 py-2 text-sm text-fg outline-none`,`hover:bg-surface-hover data-[highlighted]:bg-surface-hover`),onSelect:()=>v(`downloads`),children:r.marketplaceSortDownloads}),(0,K.jsx)(y,{className:a(`cursor-pointer rounded-lg px-3 py-2 text-sm text-fg outline-none`,`hover:bg-surface-hover data-[highlighted]:bg-surface-hover`),onSelect:()=>v(`newest`),children:r.marketplaceSortNewest})]})})]})]}):null,t[60]=l,t[61]=b,t[62]=_,t[63]=C,t[64]=k,t[65]=re,t[66]=O,t[67]=S,t[68]=v,t[69]=A,t[70]=r.marketplaceBrowseSwitchAria,t[71]=r.marketplaceResultsTabsAria,t[72]=r.marketplaceSortDownloads,t[73]=r.marketplaceSortNewest,t[74]=de):de=t[74];let Y;t[75]!==m||t[76]!==h||t[77]!==l||t[78]!==g||t[79]!==r.filterAll||t[80]!==r.filterDisabledOnly||t[81]!==r.filterDisabledOnlyAria?(Y=l!==`marketplace`&&m>0?(0,K.jsx)(`button`,{type:`button`,className:a(`inline-flex h-9 shrink-0 items-center rounded-lg border px-2.5 text-xs font-medium transition-colors`,P.focusRingPanel,h===`disabled`?`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`:`border-amber-300/80 bg-amber-50/90 text-amber-950 hover:border-amber-400 dark:border-amber-700/60 dark:bg-amber-950/40 dark:text-amber-100`),"aria-pressed":h===`disabled`,"aria-label":r.filterDisabledOnlyAria,onClick:()=>g(We),children:h===`disabled`?r.filterAll:be(r.filterDisabledOnly,{count:m})}):l===`builtin`?(0,K.jsx)(`div`,{className:`h-9 min-w-[9rem] shrink-0`,"aria-hidden":!0}):null,t[75]=m,t[76]=h,t[77]=l,t[78]=g,t[79]=r.filterAll,t[80]=r.filterDisabledOnly,t[81]=r.filterDisabledOnlyAria,t[82]=Y):Y=t[82];let fe;t[83]!==le||t[84]!==ue||t[85]!==de||t[86]!==Y?(fe=(0,K.jsxs)(`div`,{className:le,children:[ue,de,Y]}),t[83]=le,t[84]=ue,t[85]=de,t[86]=Y,t[87]=fe):fe=t[87];let X;t[88]!==ce||t[89]!==fe?(X=(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge-subtle`,children:[ce,fe]}),t[88]=ce,t[89]=fe,t[90]=X):X=t[90];let Z;t[91]!==l||t[92]!==n?(Z=l===`marketplace`?(0,K.jsx)(Ie,{...n}):(0,K.jsx)(pe,{...n}),t[91]=l,t[92]=n,t[93]=Z):Z=t[93];let me;t[94]!==X||t[95]!==Z?(me=(0,K.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[X,Z]}),t[94]=X,t[95]=Z,t[96]=me):me=t[96];let Q;t[97]!==ae||t[98]!==G||t[99]!==q||t[100]!==me?(Q=(0,K.jsxs)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[ae,G,q,me]}),t[97]=ae,t[98]=G,t[99]=q,t[100]=me,t[101]=Q):Q=t[101];let he,ge,_e;t[102]===n?(he=t[103],ge=t[104],_e=t[105]):(he=(0,K.jsx)(Pe,{...n}),ge=(0,K.jsx)($,{...n}),_e=(0,K.jsx)(Ce,{...n}),t[102]=n,t[103]=he,t[104]=ge,t[105]=_e);let ve;t[106]!==Q||t[107]!==he||t[108]!==ge||t[109]!==_e?(ve=(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[Q,he,ge,_e]}),t[106]=Q,t[107]=he,t[108]=ge,t[109]=_e,t[110]=ve):ve=t[110];let ye;return t[111]!==U||t[112]!==ve?(ye=(0,K.jsxs)(K.Fragment,{children:[U,ve]}),t[111]=U,t[112]=ve,t[113]=ye):ye=t[113],ye}function We(e){return e===`disabled`?`all`:`disabled`}function Ge(e,t){return(0,K.jsxs)(`li`,{className:`truncate`,children:[e.type,`: `,e.message]},`${e.path??e.skillName??`diagnostic`}-${t}`)}function Ke(e){return e.id}function qe(e){let t=(0,oe.c)(17),{vm:n}=e,{sk:r,hasToken:i,loading:a,onReloadClick:o,searchQuery:s,setSearchQuery:c,mainTab:l,setPendingFile:u,setInstallOpen:d,inSettingsShell:f}=n,p=z(Ye),m=z(Je),h;t[0]!==a||t[1]!==l||t[2]!==o||t[3]!==s||t[4]!==d||t[5]!==u||t[6]!==c||t[7]!==r?(h=(0,K.jsx)(se,{loading:a,onReloadClick:o,searchQuery:s,setSearchQuery:c,mainTab:l,sk:r,setPendingFile:u,setInstallOpen:d}),t[0]=a,t[1]=l,t[2]=o,t[3]=s,t[4]=d,t[5]=u,t[6]=c,t[7]=r,t[8]=h):h=t[8];let g=h,_,v;return t[9]!==m||t[10]!==i||t[11]!==f||t[12]!==p||t[13]!==r.title||t[14]!==g?(_=()=>!i||f?(m(),()=>m()):(p({startExtra:null,main:(0,K.jsx)(`div`,{className:`min-w-0`,children:(0,K.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r.title})}),end:g}),()=>m()),v=[m,i,f,p,g,r.title],t[9]=m,t[10]=i,t[11]=f,t[12]=p,t[13]=r.title,t[14]=g,t[15]=_,t[16]=v):(_=t[15],v=t[16]),(0,G.useLayoutEffect)(_,v),null}function Je(e){return e.clearPageHeader}function Ye(e){return e.setPageHeader}async function Xe(e,t){let n=new FormData;n.append(`file`,e),t.skillId&&n.append(`skillId`,t.skillId),t.overwrite&&n.append(`overwrite`,`true`),n.append(`target`,t.target??`workspace`);let r=s.getState().token,i=new Headers;r&&i.set(`Authorization`,`Bearer ${r}`);let a=await fetch(c(`/api/skills/upload`),{method:`POST`,headers:i,body:n});a.status===401&&s.getState().onUnauthorized();let o=await a.json().catch(()=>({}));if(!a.ok)throw Error(o.error||`HTTP ${a.status}`);if(!o.payload?.skillId)throw Error(`Invalid response`);return o.payload}async function Ze(e,t){let n=t?`?target=${encodeURIComponent(t)}`:``,r=await l(c(`/api/skills/${encodeURIComponent(e)}${n}`),{method:`DELETE`});if(!r.ok)throw Error(await R(r))}async function Qe(e,t){let n=await l(c(`/api/skills/enabled`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({skillName:e,enabled:t})});if(!n.ok)throw Error(await R(n))}function $e(e,t){t?.trim()&&e.set(`provider`,t.trim())}async function et(e){let t=new URLSearchParams;$e(t,e?.provider);let n=t.toString(),r=await l(c(`/api/skills/marketplace/categories${n?`?${n}`:``}`),{cache:`no-store`});if(!r.ok)throw Error(await R(r));let i=await r.json();if(!i.payload||!Array.isArray(i.payload.items))throw Error(`Invalid response`);return{items:i.payload.items}}async function tt(e){let t=new URLSearchParams;e.q?.trim()&&t.set(`q`,e.q.trim()),e.page!=null&&t.set(`page`,String(e.page)),e.pageSize!=null&&t.set(`pageSize`,String(e.pageSize)),e.sort&&t.set(`sort`,e.sort),e.category?.trim()&&t.set(`category`,e.category.trim()),$e(t,e.provider);let n=t.toString(),r=await l(c(`/api/skills/marketplace${n?`?${n}`:``}`),{cache:`no-store`,signal:e.signal});if(!r.ok)throw Error(await R(r));let i=await r.json();if(!i.payload?.items||!i.payload.meta)throw Error(`Invalid response`);return i.payload}async function nt(e,t){let n=encodeURIComponent(e),r=new URLSearchParams;$e(r,t?.provider);let i=r.toString(),a=await l(c(`/api/skills/marketplace/packages/${n}${i?`?${i}`:``}`),{cache:`no-store`});if(!a.ok)throw Error(await R(a));let o=(await a.json()).payload;if(!o?.name||!o.skillDocPreview||typeof o.skillDocPreview.name!=`string`||typeof o.skillDocPreview.description!=`string`||typeof o.skillDocPreview.bodyMarkdown!=`string`||typeof o.skillDocPreview.disableModelInvocation!=`boolean`||!o.skillDocPreview.metadata||typeof o.skillDocPreview.metadata!=`object`||typeof o.skillDocPreview.metadata.name!=`string`||typeof o.skillDocPreview.metadata.description!=`string`)throw Error(`Invalid response`);return o}async function rt(e){let t=await l(c(`/api/skills/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({target:`workspace`,...e})});if(!t.ok)throw Error(await R(t));let n=await t.json();if(!n.payload?.skillId)throw Error(n.error||`Invalid response`);return n.payload}async function it(e){let t=await l(c(`/api/skills/${encodeURIComponent(e)}/content`),{cache:`no-store`});if(!t.ok)throw Error(await R(t));let n=(await t.json()).payload;if(!n||typeof n.name!=`string`||typeof n.description!=`string`||typeof n.bodyMarkdown!=`string`||typeof n.disableModelInvocation!=`boolean`||!n.metadata||typeof n.metadata!=`object`||typeof n.metadata.name!=`string`||typeof n.metadata.description!=`string`)throw Error(`Invalid response`);return n}async function at(){let e=await l(c(`/api/skills/marketplace/provider`),{cache:`no-store`});if(!e.ok)throw Error(await R(e));let t=await e.json();if(!t.payload?.provider)throw Error(`Invalid response`);return t.payload}async function ot(){let e=await l(c(`/api/skills/marketplace/providers`),{cache:`no-store`});if(!e.ok)throw Error(await R(e));let t=await e.json();if(!t.payload?.providers)throw Error(`Invalid response`);return t.payload}async function st(t){let n=t.name.toLowerCase();if(n.endsWith(`.zip`))return t;if(n.endsWith(`skill.md`)){let n=(await i(async()=>{let{default:t}=await import(`./jszip.min-DT31yWkU.js`).then(t=>e(t.default,1));return{default:t}},__vite__mapDeps([0,1]))).default,r=new n;r.file(`SKILL.md`,await t.arrayBuffer());let a=await r.generateAsync({type:`blob`,compression:`DEFLATE`}),o=t.name.replace(/\.md$/i,``).replace(/\s+/g,`-`)||`skill`;return new File([a],`${o}.zip`,{type:`application/zip`})}throw Error(`invalid`)}function ct(){let e=o(u(e=>e.language)).skills,t=!!s(e=>e.token),n=g(),[r,i]=L(),a=r.get(`mprov`)?.trim()||null,[c,l]=(0,G.useState)(!1),[f,p]=(0,G.useState)(null),[m,h]=(0,G.useState)(!1),v=r.get(`q`)??``,y=r.get(`tab`),b=r.get(`source`),x=le.has(y)?y:`marketplace`,S=ue.has(b)?b:`all`,[C,w]=(0,G.useState)(v),[T]=M(C,250),E=T.trim(),D=C.trim().length>0,O=E.length>0,[k,A]=(0,G.useState)(null),[j,N]=(0,G.useState)(x),[P,I]=(0,G.useState)(S),[ee,te]=(0,G.useState)(``),[R,z]=(0,G.useState)(`all`),[B,ne]=(0,G.useState)(!1),[V,H]=(0,G.useState)(null),[re,ie]=(0,G.useState)(!1),[W,oe]=(0,G.useState)(!1),[K,se]=(0,G.useState)(null),[q,ce]=(0,G.useState)(null),[J,Y]=(0,G.useState)({}),[pe,X]=(0,G.useState)(!1),[Z,me]=(0,G.useState)(`catalog`),[Q,he]=(0,G.useState)(``),[ge,_e]=(0,G.useState)(null),[ye,be]=(0,G.useState)(null),[xe,Ce]=(0,G.useState)(!1),[we,Te]=(0,G.useState)(null),[Ee,De]=(0,G.useState)(`downloads`),[Oe,ke]=(0,G.useState)(1),[Ae,je]=(0,G.useState)(null),[Me,Ne]=(0,G.useState)(null),[Pe,Fe]=(0,G.useState)(``),[$,Ie]=(0,G.useState)(()=>a),[Le,Re]=(0,G.useState)(0),[ze,Be]=(0,G.useState)(0),[Ve,He]=(0,G.useState)([]),Ue=(0,G.useRef)(null),We=(0,G.useRef)(a),Ge=(0,G.useRef)(null),Ke=(0,G.useRef)(``),qe=(0,G.useRef)(null),Je=(0,G.useRef)(!1),[Ye,$e]=(0,G.useState)({query:``,byProvider:{}}),[ct,lt]=(0,G.useState)(`all`),ut=(0,G.useRef)(0),dt=(0,G.useRef)(E);dt.current!==E&&(dt.current=E,lt(e=>e===`all`?e:`all`));let ft=U(()=>F().then(e=>(He(e.diagnostics??[]),e.catalog.map(Se))),[t,ze],{enabled:t,initial:[],errorData:[]}),{data:pt,loading:mt,setData:ht}=ft,gt=U(async()=>{try{let{providers:e,current:t}=await ot();return{providers:e.map(e=>({id:e.id,displayName:e.displayName})),current:t}}catch{try{return{providers:[],current:(await at()).provider}}catch{return{providers:[],current:`store`}}}},[t,Le],{enabled:t,initial:{providers:[],current:null}}),_t=c||mt,vt=gt.data.providers;(0,G.useEffect)(()=>{let e=e=>{if(d(e.detail)===`skills`){if(Je.current){Je.current=!1;return}Be(e=>e+1)}else Re(e=>e+1)};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[]);let yt=r.toString(),bt=(0,G.useRef)(yt);if(bt.current!==yt){bt.current=yt;let e=r.get(`q`)??``,t=r.get(`tab`),n=r.get(`source`),i=le.has(t)?t:`marketplace`,a=ue.has(n)?n:`all`;w(t=>t===e?t:e),N(e=>e===i?e:i),I(e=>e===a?e:a);let o=r.get(`mcat`)??``;Fe(i===`marketplace`?e=>e===o?e:o:``)}let xt=(0,G.useRef)(t);!t&&xt.current&&(Ie(null),Ue.current=null),xt.current=t,t&&a&&We.current!==a&&(We.current=a,Ie(a)),t&&a==null&>.data.current&>.data.current!==Ge.current&&(Ge.current=gt.data.current,Ie(e=>e??gt.data.current));let St=`${E}|${Ee}|${j}|${Pe}|${$??``}|${ct}`;Ke.current!==St&&(Ke.current=St,ke(1)),j===`marketplace`&&$&&qe.current!=null&&qe.current!==$&&Fe(``),qe.current=$;let Ct=U(()=>tt({page:Oe,pageSize:20,sort:Ee,category:Pe.trim()||void 0,provider:$}),[t,j,Pe,Oe,Ee,O,$],{enabled:t&&j===`marketplace`&&!!$&&!O,initial:null,errorData:null});(0,G.useLayoutEffect)(()=>{!t||!D||N(e=>e===`marketplace`?e:`marketplace`)},[t,D]),(0,G.useEffect)(()=>{if(!t||!O||j!==`marketplace`||vt.length===0)return;let n=++ut.current,r={};for(let e of vt)r[e.id]={status:`loading`,rows:[]};$e({query:E,byProvider:r});let i=[],a=[];for(let t of vt){let r=new AbortController;i.push(r);let o=window.setTimeout(()=>{r.abort(new DOMException(`Adapter timed out`,`TimeoutError`))},8e3);a.push(o),tt({provider:t.id,q:E,page:1,pageSize:40,sort:Ee,signal:r.signal}).then(e=>{if(window.clearTimeout(o),n!==ut.current)return;let r=e.items.map(e=>({...e,providerId:t.id}));$e(e=>({...e,byProvider:{...e.byProvider,[t.id]:{status:`ok`,rows:r}}}))}).catch(r=>{if(window.clearTimeout(o),n!==ut.current)return;let i=r instanceof DOMException&&(r.name===`TimeoutError`||r.name===`AbortError`)?e.marketplaceLoadFailed:r instanceof Error?r.message:e.marketplaceLoadFailed;$e(e=>({...e,byProvider:{...e.byProvider,[t.id]:{status:`error`,rows:[],error:i}}}))})}return()=>{for(let e of a)window.clearTimeout(e);for(let e of i)e.abort()}},[t,j,O,E,vt,Ee,e.marketplaceLoadFailed]);let wt=U(()=>et({provider:$}).then(e=>e.items),[t,j,$],{enabled:t&&j===`marketplace`&&!!$,initial:[],errorData:[]}),Tt=(0,G.useMemo)(()=>{if(!O||Ye.query!==E)return[];let e=vt.map(e=>({id:e.id,rows:[...Ye.byProvider[e.id]?.rows??[]]})),t=[];for(;e.some(e=>e.rows.length>0);)for(let n of e)n.rows.length>0&&t.push(n.rows.shift());let n=new Map;for(let e of t){let t=[(e.id??``).toLowerCase().trim(),(e.name??``).toLowerCase().trim(),(e.author?.username??``).toLowerCase().trim()].join(`|`),r=n.get(t);if(!r){n.set(t,{...e,additionalSources:[]});continue}if(e.providerId&&e.providerId!==r.providerId){let t=r.additionalSources??[];t.some(t=>t.providerId===e.providerId)||(t.push({providerId:e.providerId,sourceLabel:e.sourceLabel}),r.additionalSources=t)}}return Array.from(n.values())},[O,E,Ye,vt]),Et=(0,G.useMemo)(()=>{if(!O)return{};let e={all:Tt.length};for(let t of vt)e[t.id]=Tt.filter(e=>e.providerId===t.id||(e.additionalSources??[]).some(e=>e.providerId===t.id)).length;return e},[O,Tt,vt]),Dt=(0,G.useMemo)(()=>O?ct===`all`?Tt:Tt.filter(e=>e.providerId===ct||(e.additionalSources??[]).some(e=>e.providerId===ct)):[],[O,Tt,ct]),Ot=(0,G.useMemo)(()=>{if(!O)return{};let e={};for(let t of vt)e[t.id]=Ye.byProvider[t.id]?.status??`loading`;return e},[O,Ye,vt]),kt=(0,G.useMemo)(()=>Object.values(Ot).some(e=>e===`loading`),[Ot]),At=(0,G.useMemo)(()=>{if(!O)return!1;let e=Object.values(Ot);return e.length>0&&e.every(e=>e===`error`)},[O,Ot]),jt=(0,G.useMemo)(()=>{if(!O||Tt.length===0&&kt)return null;let e=Dt.length,t=(Oe-1)*20;return{items:Dt.slice(t,t+20),meta:{page:Oe,pageSize:20,total:e,totalPages:Math.max(1,Math.ceil(e/20))},provider:ct}},[O,Tt,kt,Dt,Oe,ct]),Mt=j===`marketplace`?D?O?jt:null:Ct.data:null,Nt=j===`marketplace`?D?O?kt:!0:Ct.loading:!1,Pt=O?At?e.marketplaceLoadFailed:null:Ct.error instanceof Error?Ct.error.message:Ct.error?e.marketplaceLoadFailed:null,Ft=j===`marketplace`?wt.data:[],It=j===`marketplace`?wt.loading:!1,Lt=wt.error instanceof Error?wt.error.message:wt.error?e.marketplaceCategoriesFailed:null;Pe.trim()&&Ft.length>0&&!Ft.some(e=>e.id===Pe)&&Fe(``);let Rt=(0,G.useCallback)(async t=>{let n=t?.silent===!0;n||l(!0),p(null);try{let e=await F();return He(e.diagnostics??[]),ht(e.catalog.map(Se)),{ok:!0}}catch(t){let n=t instanceof Error?t.message:e.loadFailed;return p(n),{ok:!1,message:n}}finally{n||l(!1)}},[ht,e.loadFailed]),zt=!c&&ft.error?ft.error instanceof Error?ft.error.message:e.loadFailed:null,Bt=f??zt;(0,G.useEffect)(()=>{i(e=>{let t=new URLSearchParams(e);return E?t.set(`q`,E):t.delete(`q`),j===`marketplace`?t.delete(`tab`):t.set(`tab`,j),P===`all`?t.delete(`source`):t.set(`source`,P),j===`marketplace`&&Pe.trim()?t.set(`mcat`,Pe.trim()):t.delete(`mcat`),j===`marketplace`&&$?t.set(de,$):t.delete(de),t.toString()===e.toString()?e:t},{replace:!0})},[j,Pe,$,E,i,P]);let Vt=(0,G.useCallback)((e,t,n=5e3)=>{A({kind:e,message:t}),window.setTimeout(()=>A(null),n)},[]),Ht=(0,G.useCallback)(t=>{let n=t.availability;if(!n)return e.installSuccess;let r=n.skillName||n.skillId;if(!n.loaded)return`Skill "${r}" installed, but it was not loaded. Check skill diagnostics.`;if(n.diagnostics.length>0)return`Skill "${r}" installed with ${n.diagnostics.length} diagnostic(s).`;if(n.enabled===!1)return`Skill "${r}" installed but disabled. Enable it before use.`;if(n.availableForDefaultAgent===!1){let e=n.unavailableReason||`unavailable`;return`Skill "${r}" installed but unavailable for agent "${n.defaultAgentId}" (${e}).`}return`Skill "${r}" installed and ready.`},[e.installSuccess]),Ut=(0,G.useCallback)(async t=>{me(`catalog`),X(!0),he(t.name),_e(null),be(null),Te(null),Ce(!0);try{let e=await it(t.name);_e(e),he(e.name)}catch(t){_e(null),Te(t instanceof Error?t.message:e.detailLoadFailed)}finally{Ce(!1)}},[e.detailLoadFailed]),Wt=(0,G.useCallback)(async t=>{let n=t.trim();if(n){me(`catalog`),X(!0),he(n),_e(null),be(null),Te(null),Ce(!0);try{let e=await it(n);_e(e),he(e.name)}catch(t){_e(null),Te(t instanceof Error?t.message:e.detailLoadFailed)}finally{Ce(!1)}}},[e.detailLoadFailed]),Gt=(0,G.useCallback)(async(t,n,r)=>{let i=r?.trim()||$;if(i){Ue.current=i,me(`store`),X(!0),he(n?.trim()||t),_e(null),be(null),Te(null),Ce(!0);try{let e=await nt(t,{provider:i});he(e.name),be(e.skillDocPreview)}catch(t){be(null),Te(t instanceof Error?t.message:e.detailLoadFailed)}finally{Ce(!1)}}},[$,e.detailLoadFailed]),Kt=(0,G.useCallback)(async(t,n)=>{ce(t),Y(e=>({...e,[t]:n})),A(null);try{return await Qe(t,n),await Rt({silent:!0}),!0}catch(n){return Y(e=>{let{[t]:n,...r}=e;return r}),Vt(`error`,n instanceof Error?n.message:e.skillToggleFailed),!1}finally{ce(null),Y(e=>{let{[t]:n,...r}=e;return r})}},[Rt,Vt,e.skillToggleFailed]),qt=(0,G.useCallback)(async()=>{A(null),l(!0),p(null);try{await ae()}catch(t){p(t instanceof Error?t.message:e.reloadFailed),l(!1);return}await Rt()},[Rt,e.reloadFailed]),Jt=(0,G.useMemo)(()=>{let e=C.trim().toLowerCase();return e?pt.filter(t=>[t.name,t.description,t.directoryId,t.path,t.source,t.hub?.source,t.hub?.ref].filter(Boolean).join(` `).toLowerCase().includes(e)):pt},[pt,C]),Yt=(0,G.useMemo)(()=>{let e=Jt.filter(e=>e.source===`builtin`);return{total:e.length,enabled:e.filter(e=>J[e.name]??e.enabled).length}},[Jt,J]),Xt=(0,G.useMemo)(()=>{let e=Jt.filter(e=>e.source!==`builtin`);return{total:e.length,enabled:e.filter(e=>J[e.name]??e.enabled).length}},[Jt,J]),Zt=(0,G.useMemo)(()=>Q?pt.find(e=>e.name===Q):void 0,[pt,Q]),Qt=Zt==null?!0:J[Q]??Zt.enabled,$t=Zt?.directoryId??null,en=Zt?.managed??!1,tn=(0,G.useMemo)(()=>Z!==`store`||!Q?null:ve(Ue.current??$,Q),[Z,Q,$]),nn=(0,G.useMemo)(()=>{let e=Jt;return j===`builtin`?e=e.filter(e=>e.source===`builtin`):j===`user`&&(e=e.filter(e=>e.source!==`builtin`),P!==`all`&&(e=e.filter(e=>e.source===P))),e},[Jt,j,P]),rn=(0,G.useMemo)(()=>{let e=new Set,t=[];for(let n of nn){let r=n.category;!r||e.has(r)||(e.add(r),t.push(r))}return t.sort((e,t)=>{let n=fe.indexOf(e),r=fe.indexOf(t);return n>=0&&r>=0?n-r:n>=0?-1:r>=0?1:e.localeCompare(t)})},[nn]),an=(0,G.useCallback)(t=>e.categoryLabel?.[t]||t,[e.categoryLabel]),on=(0,G.useMemo)(()=>ee?nn.filter(e=>e.category===ee):nn,[nn,ee]);(0,G.useEffect)(()=>{z(`all`)},[j]);let sn=(0,G.useCallback)(e=>J[e.name]??e.enabled,[J]),cn=(0,G.useMemo)(()=>on.filter(e=>!sn(e)).length,[on,sn]),ln=(0,G.useMemo)(()=>{let e=on;return R===`disabled`&&(e=e.filter(e=>!sn(e))),[...e].toSorted((e,t)=>{let n=sn(e);return n===sn(t)?e.name.localeCompare(t.name,void 0,{sensitivity:`base`}):n?-1:1})},[on,R,sn]),un=async t=>{A(null),h(!0),p(null);try{let n;try{n=await st(t)}catch{p(e.invalidFile),Vt(`error`,e.invalidFile);return}let r=await Xe(n,{overwrite:!0});Je.current=!0,await Rt(),Vt(`success`,Ht(r)),ne(!1),H(null),N(`user`),await Wt(r.availability?.skillName||r.skillId)}catch(t){p(t instanceof Error?t.message:e.uploadFailed),Vt(`error`,t instanceof Error?t.message:e.uploadFailed)}finally{h(!1)}},dn=()=>{V&&un(V)},fn=e=>{let t=e.target.files?.[0];e.target.value=``,t&&H(t)},pn=e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.types.includes(`Files`)&&(ie(!0),e.dataTransfer.dropEffect=`copy`)},mn=e=>{let t=e.currentTarget,n=e.relatedTarget;n&&t.contains(n)||ie(!1)},hn=e=>{e.preventDefault(),e.stopPropagation(),ie(!1);let t=e.dataTransfer?.files?.[0];t&&H(t)},gn=t=>{switch(t){case`builtin`:return e.source.builtin;case`workspace`:return e.source.workspace;case`global`:return e.source.global;case`extra`:return e.source.extra;default:return t}},_n=async()=>{let t=K,n=pe&&Z===`catalog`&&$t===t;if(oe(!1),se(null),t){A(null);try{await Ze(t),Je.current=!0,await Rt(),n&&(X(!1),me(`catalog`),he(``),_e(null),be(null),Te(null))}catch(t){p(t instanceof Error?t.message:e.deleteFailed)}}},vn=(0,G.useCallback)(e=>pt.some(t=>t.name===e),[pt]),yn=(0,G.useCallback)(async t=>{let r=(t?.name??Q).trim();if(!r)return;let i=t?.source??Z;if(i===`catalog`){let e=pt.find(e=>e.name===r);if(e&&!(J[e.name]??e.enabled))return}A(null);let a=i===`store`&&!vn(r);Ne(r);try{if(a){let e=t?.providerOverride?.trim()||Ue.current||$;await rt({name:r,overwrite:!1,...e?{provider:e}:{}}),Je.current=!0,await Rt({silent:!0})}X(!1),n(`/chat/new?skill=${encodeURIComponent(r)}`)}catch(t){Vt(`error`,t instanceof Error?t.message:e.uploadFailed)}finally{Ne(null)}},[pt,Q,Z,J,vn,Rt,n,Vt,e.uploadFailed,$]),bn=(0,G.useCallback)(async(t,n)=>{let r=vn(t);if(!(r&&!window.confirm(e.marketplaceReinstallConfirm))){A(null),je(t);try{let e=n?.providerOverride?.trim()||(n?.useDetailProvider?Ue.current??$:$),i=await rt({name:t,overwrite:r,...e?{provider:e}:{}});Je.current=!0,await Rt({silent:!0}),Vt(`success`,Ht(i)),N(`user`),await Wt(i.availability?.skillName||i.skillId||t)}catch(t){Vt(`error`,t instanceof Error?t.message:e.uploadFailed)}finally{je(null)}}},[vn,Ht,Rt,$,Wt,Vt,e.marketplaceReinstallConfirm,e.uploadFailed]),xn=P===`all`?e.filterAll:P===`global`?e.filterGlobal:P===`workspace`?e.filterWorkspace:e.filterExtra,{pathname:Sn}=_();return{sk:e,hasToken:t,catalog:pt,loading:_t,error:Bt,uploading:m,searchQuery:C,setSearchQuery:w,actionFeedback:k,skillDiagnostics:Ve,mainTab:j,setMainTab:N,sourceFilter:P,setSourceFilter:I,builtinCategoryFilter:ee,setBuiltinCategoryFilter:te,installOpen:B,setInstallOpen:ne,pendingFile:V,setPendingFile:H,dropActive:re,setDropActive:ie,confirmOpen:W,setConfirmOpen:oe,confirmId:K,setConfirmId:se,togglingSkillName:q,enabledOverride:J,detailOpen:pe,setDetailOpen:X,detailSource:Z,setDetailSource:me,detailTitle:Q,setDetailTitle:he,detailCatalogPreview:ge,setDetailCatalogPreview:_e,detailMarketplacePreview:ye,setDetailMarketplacePreview:be,detailLoading:xe,detailError:we,setDetailError:Te,marketSort:Ee,setMarketSort:De,marketPage:Oe,setMarketPage:ke,mpLoading:Nt,mpError:Pt,mpPayload:Mt,searchActive:O,searchInputActive:D,resultTab:ct,setResultTab:lt,aggregatedTabCounts:Et,aggregatedProviderStatus:Ot,aggregatedAllFailed:At,installingMarketName:Ae,usingSkillInChatName:Me,onUseSkillInChat:yn,marketCategoryId:Pe,setMarketCategoryId:Fe,mpCategories:Ft,mpCategoriesError:Lt,mpCategoriesLoading:It,marketBrowseProvider:$,setMarketBrowseProvider:Ie,registeredProviders:vt,builtinTabStats:Yt,userTabStats:Xt,detailEnabled:Qt,detailDirectoryId:$t,detailManaged:en,detailExternalUrl:tn,filteredCatalog:nn,builtinCategories:rn,categoryFilteredCatalog:on,catalogDisplayRows:ln,catalogDisabledCount:cn,catalogStatusFilter:R,setCatalogStatusFilter:z,resolveSkillEnabled:sn,filterLabel:xn,inSettingsShell:Sn.startsWith(`/settings/`),categoryLabel:an,onReloadClick:qt,openSkillDetail:Ut,openMarketplaceDetail:Gt,onSkillToggle:Kt,onInstallSubmit:dn,onFileInputChange:fn,onModalDragOver:pn,onModalDragLeave:mn,onModalDrop:hn,sourceLabel:gn,runDelete:_n,onMarketInstall:bn,isSkillInstalledByName:vn}}function lt(){let e=(0,oe.c)(2),t=ct(),n;return e[0]===t?n=e[1]:(n=(0,K.jsx)(Ue,{vm:t}),e[0]=t,e[1]=n),n}export{lt as SkillsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-BQ_8x0bT.js";import{t as i}from"./messages-DR9ODkb8.js";import{n as a}from"./locale-store-Ba72bFmP.js";import{Ar as o,Dc as s,Ka as c,Tt as l,jr as u,ms as d,ts as f,vo as p}from"./index-BOme955B.js";import{n as m,t as h}from"./settings-page-layout-Da_LNPDS.js";import{r as g,t as _}from"./settings-form-section-DnDrLMWZ.js";var v=e(t(),1),y=n();async function b(){if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return!1;try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop();return!0}catch{return!1}}function x(e,t,n){return e.outcome===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.outcome===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function S(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:t.denied}function C(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function w(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}var T=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function E(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||T.has(e)?t===`unknown`:!1}function D(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:T.has(e)?t===`denied`:!0}var O=[{key:`fullDisk`,pane:`fullDisk`,platforms:[`darwin`]},{key:`screen`,pane:`screen`},{key:`microphone`,pane:`microphone`},{key:`accessibility`,pane:`accessibility`},{key:`automation`,pane:`automation`},{key:`notifications`,pane:`notifications`},{key:`location`,pane:`location`}];function k(e){return e===`linux`?O:O.filter(t=>!t.platforms||t.platforms.includes(e))}function A(e,t){let n=i(e).systemSettings.status;return t===`granted`?{label:n.granted,className:`text-emerald-600 dark:text-emerald-400`}:t===`denied`?{label:n.denied,className:`text-amber-600 dark:text-amber-400`}:{label:n.unknown,className:`text-fg-muted`}}function j(e,t,n){let r=i(e).systemSettings.permUnknown?.[t];return r?n===`darwin`&&r.darwin?r.darwin:n===`win32`&&r.win32?r.win32:n===`linux`&&r.linux?r.linux:null:null}var M={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function N(){let e=a(e=>e.language),t=i(e).systemSettings,[n,T]=(0,v.useReducer)(l,M),{behavior:O,perms:N,loadError:P,permFeedback:F,permBusy:I,refreshing:L}=n,R=typeof window<`u`?window.electronAPI?.system:void 0,z=(0,v.useCallback)(async e=>{if(R){T({type:`patch`,patch:{loadError:null}});try{T({type:`patch`,patch:{behavior:await R.getBehavior(),perms:await R.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:t.refreshDone}:{}}})}catch(t){T({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[R,t.refreshDone]),B=(0,v.useCallback)(async()=>{if(!(L||I)){T({type:`patch`,patch:{refreshing:!0}});try{await z({showRefreshFeedback:!0})}finally{T({type:`patch`,patch:{refreshing:!1}})}}},[z,I,L]);if((0,v.useEffect)(()=>{let e=new Set([t.refreshDone,t.openSettingsDone,t.openSettingsFailed,t.desktopNotify.testShown]);if(!F||!e.has(F))return;let n=window.setTimeout(()=>{T({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(n)},[F,t.openSettingsDone,t.openSettingsFailed,t.refreshDone,t.desktopNotify.testShown]),(0,v.useEffect)(()=>{c()&&R&&z()},[R,z]),!c()||!R)return(0,y.jsxs)(h,{gap:`gap-3`,children:[(0,y.jsx)(m,{title:t.title}),(0,y.jsxs)(`div`,{className:g(),children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.desktopOnlyTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.desktopOnlyBody})]})]});let V=async e=>{try{let{behavior:t}=await R.setBehavior(e);T({type:`patch`,patch:{behavior:t}}),(e.notifyEnabled!==void 0||e.notifySoundEnabled!==void 0)&&o()}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},H=async e=>{if(!e){await V({notifyEnabled:!1});return}T({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await u(t.desktopNotify.testTitle,t.desktopNotify.testBody);if(e===`unsupported`){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.unsupported}});return}if(e===`denied`){T({type:`patch`,patch:{permFeedback:t.desktopNotify.denied}});return}if(e==="default"){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.default}});return}await V({notifyEnabled:!0}),T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:t.desktopNotify.testShown}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},U=async e=>{T({type:`patch`,patch:{permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{(await R.openPrivacy(e)).ok?T({type:`patch`,patch:{permFeedback:t.openSettingsDone}}):T({type:`patch`,patch:{permFeedback:t.openSettingsFailed}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},W=async()=>{T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestMicrophone(),n=await b();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:x(e,n,t.permFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},G=async()=>{if(R.requestAccessibility){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestAccessibility();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:S(e,t.accessibilityFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},K=async()=>{if(R.requestNotifications){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestNotifications();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:C(e,t.notificationsFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(R.requestScreen){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestScreen();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:w(e,t.screenFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},J=O?O.platform===`win32`?t.permissionsHintWin:O.platform===`linux`?t.permissionsHintLinux:O.platform===`darwin`?t.permissionsHintDarwin:t.permissionsHint:t.permissionsHint;return(0,y.jsxs)(h,{gap:`gap-6`,children:[(0,y.jsx)(m,{title:t.title}),P?(0,y.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:P}):null,F?(0,y.jsx)(`p`,{className:r(`text-sm`,F===t.refreshDone||F===t.openSettingsDone||F===t.permFeedback.granted||F===t.permFeedback.alreadyGranted||F===t.accessibilityFeedback.granted||F===t.accessibilityFeedback.alreadyGranted||F===t.notificationsFeedback.granted||F===t.notificationsFeedback.alreadyGranted||F===t.screenFeedback.granted||F===t.screenFeedback.alreadyGranted||F===t.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:F}):null,(0,y.jsxs)(_,{children:[(0,y.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,y.jsx)(f,{className:`size-4 text-accent`,strokeWidth:1.75}),t.behaviorGroup]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsxs)(`div`,{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:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.openAtLogin}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.openAtLoginDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.openAtLogin,onChange:e=>{V({openAtLogin:e.target.checked})}})]}),(0,y.jsxs)(`div`,{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:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.keepAwake}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.keepAwakeDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.keepAwakePreferred,onChange:e=>{V({keepAwakePreferred:e.target.checked})}})]}),(0,y.jsxs)(`div`,{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:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifyDesktop}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifyDesktopDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O||I,checked:!!O?.notifyEnabled,onChange:e=>{H(e.target.checked)}})]}),(0,y.jsxs)(`div`,{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:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifySound}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifySoundDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.notifySoundEnabled,onChange:e=>{V({notifySoundEnabled:e.target.checked})}})]})]})]}),O&&N?(0,y.jsxs)(`section`,{className:g(),children:[(0,y.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.permissionsTitle}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:J}),O.platform===`darwin`&&!O.packaged?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:t.permissionsHintDevDarwin}):null]}),(0,y.jsxs)(`button`,{type:`button`,disabled:L||I,"aria-busy":L,className:r(`mt-2 inline-flex max-w-full items-center justify-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-sm font-medium text-fg transition-colors hover:bg-surface-hover disabled:opacity-50 sm:mt-0`,p.press),onClick:()=>void B(),children:[(0,y.jsx)(d,{className:r(`size-3.5`,L&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),L?t.refreshing:t.refresh]})]}),(0,y.jsx)(`ul`,{className:`space-y-3`,children:k(O.platform).map(({key:n,pane:i})=>{let a=A(e,N[n]),o=t.perm[n],c=N[n]===`unknown`?j(e,n,O.platform):null;return o?(0,y.jsxs)(`li`,{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,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:o.title}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:o.desc}),(0,y.jsx)(`p`,{className:`mt-1 text-xs font-medium ${a.className}`,children:a.label}),c?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:c}):null]}),(0,y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[n===`notifications`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,p.press),onClick:()=>void K(),children:t.requestAccess}):null,n===`microphone`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,p.press),onClick:()=>void W(),children:t.requestAccess}):null,n===`accessibility`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,p.press),onClick:()=>void G(),children:t.requestAccess}):null,n===`screen`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,p.press),onClick:()=>void q(),children:t.requestAccess}):null,D(n,N[n],O.platform)?(0,y.jsxs)(`button`,{type:`button`,className:r(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,p.press),onClick:()=>void U(i),children:[t.openSettings,(0,y.jsx)(s,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},n):null})})]}):null]})}export{N as SystemSettingsPanel};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-BQ_8x0bT.js";import{t as i}from"./messages-CQ_k8RHj.js";import{n as a}from"./locale-store-Ba72bFmP.js";import{Ac as o,Dt as s,Ja as c,Mr as l,Nr as u,_s as d,bo as f,rs as p}from"./index-DZOm5_ex.js";import{n as m,t as h}from"./settings-page-layout-CrICyGob.js";import{r as g,t as _}from"./settings-form-section-By0YiDWo.js";var v=e(t(),1),y=n();async function b(){if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return!1;try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop();return!0}catch{return!1}}function x(e,t,n){return e.outcome===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.outcome===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function S(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:t.denied}function C(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function w(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}var T=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function E(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||T.has(e)?t===`unknown`:!1}function D(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:T.has(e)?t===`denied`:!0}var O=[{key:`fullDisk`,pane:`fullDisk`,platforms:[`darwin`]},{key:`screen`,pane:`screen`},{key:`microphone`,pane:`microphone`},{key:`accessibility`,pane:`accessibility`},{key:`automation`,pane:`automation`},{key:`notifications`,pane:`notifications`},{key:`location`,pane:`location`}];function k(e){return e===`linux`?O:O.filter(t=>!t.platforms||t.platforms.includes(e))}function A(e,t){let n=i(e).systemSettings.status;return t===`granted`?{label:n.granted,className:`text-emerald-600 dark:text-emerald-400`}:t===`denied`?{label:n.denied,className:`text-amber-600 dark:text-amber-400`}:{label:n.unknown,className:`text-fg-muted`}}function j(e,t,n){let r=i(e).systemSettings.permUnknown?.[t];return r?n===`darwin`&&r.darwin?r.darwin:n===`win32`&&r.win32?r.win32:n===`linux`&&r.linux?r.linux:null:null}var M={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function N(){let e=a(e=>e.language),t=i(e).systemSettings,[n,T]=(0,v.useReducer)(s,M),{behavior:O,perms:N,loadError:P,permFeedback:F,permBusy:I,refreshing:L}=n,R=typeof window<`u`?window.electronAPI?.system:void 0,z=(0,v.useCallback)(async e=>{if(R){T({type:`patch`,patch:{loadError:null}});try{T({type:`patch`,patch:{behavior:await R.getBehavior(),perms:await R.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:t.refreshDone}:{}}})}catch(t){T({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[R,t.refreshDone]),B=(0,v.useCallback)(async()=>{if(!(L||I)){T({type:`patch`,patch:{refreshing:!0}});try{await z({showRefreshFeedback:!0})}finally{T({type:`patch`,patch:{refreshing:!1}})}}},[z,I,L]);if((0,v.useEffect)(()=>{let e=new Set([t.refreshDone,t.openSettingsDone,t.openSettingsFailed,t.desktopNotify.testShown]);if(!F||!e.has(F))return;let n=window.setTimeout(()=>{T({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(n)},[F,t.openSettingsDone,t.openSettingsFailed,t.refreshDone,t.desktopNotify.testShown]),(0,v.useEffect)(()=>{c()&&R&&z()},[R,z]),!c()||!R)return(0,y.jsxs)(h,{gap:`gap-3`,children:[(0,y.jsx)(m,{title:t.title}),(0,y.jsxs)(`div`,{className:g(),children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.desktopOnlyTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.desktopOnlyBody})]})]});let V=async e=>{try{let{behavior:t}=await R.setBehavior(e);T({type:`patch`,patch:{behavior:t}}),(e.notifyEnabled!==void 0||e.notifySoundEnabled!==void 0)&&l()}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},H=async e=>{if(!e){await V({notifyEnabled:!1});return}T({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await u(t.desktopNotify.testTitle,t.desktopNotify.testBody);if(e===`unsupported`){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.unsupported}});return}if(e===`denied`){T({type:`patch`,patch:{permFeedback:t.desktopNotify.denied}});return}if(e==="default"){T({type:`patch`,patch:{permFeedback:t.notificationsFeedback.default}});return}await V({notifyEnabled:!0}),T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:t.desktopNotify.testShown}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},U=async e=>{T({type:`patch`,patch:{permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{(await R.openPrivacy(e)).ok?T({type:`patch`,patch:{permFeedback:t.openSettingsDone}}):T({type:`patch`,patch:{permFeedback:t.openSettingsFailed}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},W=async()=>{T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestMicrophone(),n=await b();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:x(e,n,t.permFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}},G=async()=>{if(R.requestAccessibility){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestAccessibility();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:S(e,t.accessibilityFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},K=async()=>{if(R.requestNotifications){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestNotifications();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:C(e,t.notificationsFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(R.requestScreen){T({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),T({type:`patch`,patch:{loadError:null}});try{let e=await R.requestScreen();T({type:`patch`,patch:{perms:await R.getPermissions()}}),T({type:`patch`,patch:{permFeedback:w(e,t.screenFeedback)}})}catch(e){T({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{T({type:`patch`,patch:{permBusy:!1}})}}},J=O?O.platform===`win32`?t.permissionsHintWin:O.platform===`linux`?t.permissionsHintLinux:O.platform===`darwin`?t.permissionsHintDarwin:t.permissionsHint:t.permissionsHint;return(0,y.jsxs)(h,{gap:`gap-6`,children:[(0,y.jsx)(m,{title:t.title}),P?(0,y.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:P}):null,F?(0,y.jsx)(`p`,{className:r(`text-sm`,F===t.refreshDone||F===t.openSettingsDone||F===t.permFeedback.granted||F===t.permFeedback.alreadyGranted||F===t.accessibilityFeedback.granted||F===t.accessibilityFeedback.alreadyGranted||F===t.notificationsFeedback.granted||F===t.notificationsFeedback.alreadyGranted||F===t.screenFeedback.granted||F===t.screenFeedback.alreadyGranted||F===t.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:F}):null,(0,y.jsxs)(_,{children:[(0,y.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,y.jsx)(p,{className:`size-4 text-accent`,strokeWidth:1.75}),t.behaviorGroup]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsxs)(`div`,{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:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.openAtLogin}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.openAtLoginDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.openAtLogin,onChange:e=>{V({openAtLogin:e.target.checked})}})]}),(0,y.jsxs)(`div`,{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:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.keepAwake}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.keepAwakeDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.keepAwakePreferred,onChange:e=>{V({keepAwakePreferred:e.target.checked})}})]}),(0,y.jsxs)(`div`,{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:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifyDesktop}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifyDesktopDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O||I,checked:!!O?.notifyEnabled,onChange:e=>{H(e.target.checked)}})]}),(0,y.jsxs)(`div`,{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:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifySound}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifySoundDesc})]}),(0,y.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!O,checked:!!O?.notifySoundEnabled,onChange:e=>{V({notifySoundEnabled:e.target.checked})}})]})]})]}),O&&N?(0,y.jsxs)(`section`,{className:g(),children:[(0,y.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.permissionsTitle}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:J}),O.platform===`darwin`&&!O.packaged?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:t.permissionsHintDevDarwin}):null]}),(0,y.jsxs)(`button`,{type:`button`,disabled:L||I,"aria-busy":L,className:r(`mt-2 inline-flex max-w-full items-center justify-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-sm font-medium text-fg transition-colors hover:bg-surface-hover disabled:opacity-50 sm:mt-0`,f.press),onClick:()=>void B(),children:[(0,y.jsx)(d,{className:r(`size-3.5`,L&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),L?t.refreshing:t.refresh]})]}),(0,y.jsx)(`ul`,{className:`space-y-3`,children:k(O.platform).map(({key:n,pane:i})=>{let a=A(e,N[n]),s=t.perm[n],c=N[n]===`unknown`?j(e,n,O.platform):null;return s?(0,y.jsxs)(`li`,{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,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:s.title}),(0,y.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:s.desc}),(0,y.jsx)(`p`,{className:`mt-1 text-xs font-medium ${a.className}`,children:a.label}),c?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:c}):null]}),(0,y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[n===`notifications`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,f.press),onClick:()=>void K(),children:t.requestAccess}):null,n===`microphone`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,f.press),onClick:()=>void W(),children:t.requestAccess}):null,n===`accessibility`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,f.press),onClick:()=>void G(),children:t.requestAccess}):null,n===`screen`&&E(n,N[n],O.platform)?(0,y.jsx)(`button`,{type:`button`,disabled:I,className:r(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,f.press),onClick:()=>void q(),children:t.requestAccess}):null,D(n,N[n],O.platform)?(0,y.jsxs)(`button`,{type:`button`,className:r(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,f.press),onClick:()=>void U(i),children:[t.openSettings,(0,y.jsx)(o,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},n):null})})]}):null]})}export{N as SystemSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cn-BQ_8x0bT.js";import{Co as t,
|
|
1
|
+
import{t as e}from"./cn-BQ_8x0bT.js";import{Co as t,To as n,wo as r}from"./index-DZOm5_ex.js";function i(){return e(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,n,`dark:border-edge`)}function a(){return e(r,t)}var o=`h-auto shrink-0 px-2.5 py-1.5 text-xs font-medium`,s=/^[a-z][a-z0-9_-]{0,63}$/;function c(e){let t=e.trim(),n=t.indexOf(`/`);return n>0&&n<t.length-1}function l(e){let t=e&&typeof e==`object`&&!Array.isArray(e)&&`roles`in e?Object.entries(e.roles??{}).map(([e,t])=>({id:e,...t&&typeof t==`object`&&!Array.isArray(t)?t:{}})):e;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!e||typeof e!=`object`||Array.isArray(e))continue;let t=e,r=typeof t.id==`string`?t.id.trim():``,i=typeof t.model==`string`?t.model.trim():``;if(!r||!i)continue;let a=typeof t.description==`string`?t.description.trim():``,o=Array.isArray(t.fallbacks)?t.fallbacks.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean):[];n.push({id:r,model:i,fallbacks:o,description:a})}return n}function u(e,t){let n=new Set([t.toLowerCase()]),r=[];for(let t of e){let e=t.trim(),i=e.toLowerCase();!e||!c(e)||n.has(i)||(n.add(i),r.push(e))}return r}function d(e){let t=new Map;for(let n of e){let e=n.id.trim(),r=n.model.trim();if(!e||!s.test(e)||!r||!c(r))continue;let i=n.description.trim(),a=u(n.fallbacks??[],r);t.set(e,{model:r,...a.length>0?{fallbacks:a}:{},...i?{description:i}:{}})}return t.size===0?null:{roles:Object.fromEntries(t.entries())}}function f(e,t){let n=new Set;for(let r of e){let e=r.id.trim(),i=r.model.trim(),a=r.fallbacks??[];if(!(!e&&!i&&!r.description.trim()&&a.every(e=>!e.trim()))){if(!e||!s.test(e))return t.invalidId;if(n.has(e))return t.duplicateId;if(n.add(e),!i||!c(i)||a.some(e=>e.trim()&&!c(e)))return t.invalidModel}}return null}function p(e){return e.length===0?`—`:e.map(e=>`${e.id} -> ${e.model}${e.fallbacks?.length?` (+${e.fallbacks.length})`:``}`).join(`, `)}function m(e){return(e??[]).map(e=>({id:e.id,model:e.model,fallbacks:e.fallbacks??[],description:e.description?.trim()??``}))}export{f as a,a as c,m as i,p as n,o,l as r,i as s,d as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./vendor-react-BOUWij0V.js";import{n as t,o as n}from"./fetch-
|
|
1
|
+
import{n as e}from"./vendor-react-BOUWij0V.js";import{n as t,o as n}from"./fetch-BWXmBizE.js";import{i as r}from"./vendor-swr-BIWyz7Rc.js";var i=e();function a(e){return n(`/api/channels/catalog?locale=${encodeURIComponent(e)}`)}async function o(e){return(await t(a(e))).payload?.channels??[]}function s(e,t){let n=(0,i.c)(14),s;n[0]!==e||n[1]!==t?(s=e?a(t):null,n[0]=e,n[1]=t,n[2]=s):s=n[2];let c;n[3]===t?c=n[4]:(c=()=>o(t),n[3]=t,n[4]=c);let l;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(l={revalidateOnFocus:!1},n[5]=l):l=n[5];let{data:u,error:d,isLoading:f,isValidating:p,mutate:m}=r(s,c,l),h;n[6]===u?h=n[7]:(h=u??[],n[6]=u,n[7]=h);let g;return n[8]!==d||n[9]!==f||n[10]!==p||n[11]!==m||n[12]!==h?(g={entries:h,isLoading:f,isValidating:p,error:d,mutate:m},n[8]=d,n[9]=f,n[10]=p,n[11]=m,n[12]=h,n[13]=g):g=n[13],g}export{s 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-BQ_8x0bT.js";import{t as a}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"./cn-BQ_8x0bT.js";import{t as a}from"./messages-CQ_k8RHj.js";import{n as o}from"./locale-store-Ba72bFmP.js";import{Bt as s,Eo as c,Ht as l,It as u,Jc as d,Lt as f,Pt as p,_a as m,bo as h,ir as g,lr as _,ps as v,ro as y,sc as b,to as x}from"./index-DZOm5_ex.js";import{n as S,t as C}from"./settings-page-layout-CrICyGob.js";import{n as w,t as T}from"./settings-form-section-By0YiDWo.js";import{t as E}from"./utils-BiUjIHb4.js";var D=n(),O=e(t(),1),k=r(),A={callName:``,pronouns:``,timezone:``,notes:``};function j(e){if(e.timezone)return e;let t=f();return t?{...e,timezone:t}:e}function M(){let e=(0,D.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,k.jsxs)(`div`,{className:`grid gap-2`,children:[(0,k.jsx)(m,{className:`h-4 w-24`}),(0,k.jsx)(m,{className:`h-10 rounded-lg`})]}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,k.jsxs)(`div`,{className:`grid gap-2`,children:[(0,k.jsx)(m,{className:`h-4 w-24`}),(0,k.jsx)(m,{className:`h-10 rounded-lg`})]}),e[1]=n):n=e[1];let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,k.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"aria-hidden":`true`,children:[t,n,(0,k.jsxs)(`div`,{className:`grid gap-2 sm:col-span-2`,children:[(0,k.jsx)(m,{className:`h-4 w-28`}),(0,k.jsx)(m,{className:`h-28 rounded-lg`})]})]}),e[2]=r):r=e[2],r}function N(){let e=o(e=>e.language),t=a(e).userProfileSettings,n=E(),[r,m]=(0,O.useState)(A),[D,N]=(0,O.useState)(JSON.stringify(A)),[P,F]=(0,O.useState)(``),[I,L]=(0,O.useState)(!1),[R,z]=(0,O.useState)(!1),[B,V]=(0,O.useState)(!0),[H,U]=(0,O.useState)(!1),[W,G]=(0,O.useState)(!1),[K,q]=(0,O.useState)(null);(0,O.useEffect)(()=>{let e=!1;return V(!0),q(null),g().then(t=>{if(e)return;let n=j(s(t)),r=u.some(e=>e.value===n.timezone),i=!n.pronouns||p.some(e=>e.value===n.pronouns);m(n),N(JSON.stringify(n)),L(!!(n.timezone&&!r)),F(n.timezone&&!r?n.timezone:``),z(!!(n.pronouns&&!i))}).catch(n=>{e||q(n instanceof Error?n.message:t.loadError)}).finally(()=>{e||V(!1)}),()=>{e=!0}},[t.loadError]);let J=JSON.stringify(r)!==D,Y=(0,O.useCallback)((t,n)=>e===`zh`?n:t,[e]),X=(0,O.useCallback)(e=>{m(t=>({...t,...e})),G(!1)},[]),Z=(0,O.useMemo)(()=>I?`__custom__`:u.some(e=>e.value===r.timezone)?r.timezone:`__custom__`,[I,r.timezone]),Q=(0,O.useCallback)(e=>{if(e===`__custom__`){L(!0);return}L(!1),F(``),X({timezone:e})},[X]),$=(0,O.useCallback)(()=>{let e=f();if(!e)return;let t=u.some(t=>t.value===e);L(!t),F(t?``:e),X({timezone:e})},[X]);async function ee(){U(!0),q(null);try{await _(l(r)),N(JSON.stringify(r)),G(!0)}catch(e){q(e instanceof Error?e.message:t.saveError)}finally{U(!1)}}return(0,k.jsxs)(C,{gap:`gap-6`,children:[(0,k.jsx)(S,{title:t.title,subtitle:t.subtitle,actions:(0,k.jsxs)(c,{type:`button`,variant:`primary`,disabled:B||H||!J,onClick:()=>void ee(),children:[(0,k.jsx)(v,{className:`size-4`,"aria-hidden":!0}),H?t.saving:W?t.saved:t.save]})}),(0,k.jsxs)(T,{children:[(0,k.jsx)(w,{icon:d,title:t.sectionTitle,subtitle:t.sectionSubtitle}),B?(0,k.jsx)(M,{}):(0,k.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,k.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,k.jsx)(`span`,{className:`font-medium text-fg`,children:t.callName}),(0,k.jsx)(`input`,{className:n,value:r.callName,onChange:e=>X({callName:e.target.value}),placeholder:t.callNamePlaceholder,autoComplete:`off`})]}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,k.jsx)(`span`,{className:`font-medium text-fg`,children:t.pronouns}),(0,k.jsxs)(x,{className:n,value:p.some(e=>e.value===r.pronouns)?r.pronouns:`__custom__`,onChange:e=>{if(e.target.value===`__custom__`){z(!0);return}z(!1),X({pronouns:e.target.value})},children:[(0,k.jsx)(y,{value:``,disabled:!0,children:t.pronounsPlaceholder}),p.map(e=>(0,k.jsx)(y,{value:e.value,children:Y(e.labelEn,e.labelZh)},e.value)),(0,k.jsx)(y,{value:`__custom__`,children:t.custom})]}),R?(0,k.jsx)(`input`,{className:i(n,`mt-1 text-xs`),value:p.some(e=>e.value===r.pronouns)?``:r.pronouns,onChange:e=>X({pronouns:e.target.value}),placeholder:t.pronounsPlaceholder,autoComplete:`off`}):null]}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[(0,k.jsx)(`span`,{className:`font-medium text-fg`,children:t.timezone}),(0,k.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[(0,k.jsxs)(x,{className:i(n,`min-w-0 flex-1`),value:Z,onChange:e=>Q(e.target.value),children:[u.map(e=>(0,k.jsx)(y,{value:e.value,children:Y(e.labelEn,e.labelZh)},e.value)),(0,k.jsx)(y,{value:`__custom__`,children:t.timezoneCustom})]}),(0,k.jsx)(`button`,{type:`button`,className:i(`shrink-0 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,h.press),onClick:$,children:t.timezoneDetect})]}),I?(0,k.jsx)(`input`,{className:i(n,`mt-1 font-mono text-xs`),value:P,onChange:e=>{F(e.target.value),X({timezone:e.target.value})},placeholder:`e.g. Asia/Shanghai`,autoComplete:`off`}):null]}),(0,k.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[(0,k.jsx)(`span`,{className:`font-medium text-fg`,children:t.notes}),(0,k.jsx)(`textarea`,{className:i(n,`min-h-28 resize-y text-sm leading-relaxed`),value:r.notes,onChange:e=>X({notes:e.target.value}),placeholder:t.notesPlaceholder,rows:5,spellCheck:!0})]})]}),(0,k.jsxs)(`div`,{className:`mt-4 flex items-start gap-2 rounded-lg bg-accent-soft/30 px-3 py-2.5 text-xs text-fg-muted`,children:[(0,k.jsx)(b,{className:`mt-0.5 size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),(0,k.jsx)(`span`,{children:t.note})]}),K?(0,k.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:K}):null]})]})}export{N as UserProfileSettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cn-BQ_8x0bT.js";import{
|
|
1
|
+
import{t as e}from"./cn-BQ_8x0bT.js";import{To as t}from"./index-DZOm5_ex.js";function n(){return e(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,t,`dark:border-edge`)}function r(e){return[e.channel,e.accountId,e.peerKind,e.peerId].filter(e=>typeof e==`string`&&e.length>0).join(` · `)||e.channel}function i(e,t,n,r){let i=e.trim(),a=t.trim();if(a)return{channel:i,peerId:a};if(n!=null){let e=r[n];if(!e)return{channel:i};let t={channel:i};e.accountId?.trim()&&(t.accountId=e.accountId.trim()),e.peerKind?.trim()&&(t.peerKind=e.peerKind.trim());let a=e.peerId?.trim()||e.chatId?.trim();return a&&(t.peerId=a),t}return{channel:i}}export{i as n,r,n as t};
|
|
@@ -0,0 +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-BQ_8x0bT.js";import{a,n as o,o as s}from"./fetch-BWXmBizE.js";import{o as c}from"./vendor-swr-BIWyz7Rc.js";import{Ac as l,Eo as u,Ks as d,Kt as f,To as p,dn as m,ga as h,ha as g,ho as _,il as ee,ps as v,qt as y,ro as b,to as te,wl as ne}from"./index-DZOm5_ex.js";var x=`/api/image/providers`;async function S(){return(await o(s(`/api/image/providers`)))?.payload?.providers??[]}var C=e(t(),1),re=n();function w(){return{apiKey:``,region:``,baseUrl:``,imageBaseUrl:``}}function ie(e){return e?.apiKey?`••••••••••••`:``}function T(e,t){let n=(()=>{if(!e||typeof e!=`object`||!(`providersConfig`in e))return;let t=e.providersConfig;if(!(!t||typeof t!=`object`||Array.isArray(t)))return t})(),r={};for(let e of t){let t=n?.[e];r[e]={apiKey:ie(t),region:t?.region??``,baseUrl:t?.baseUrl??``,imageBaseUrl:t?.imageBaseUrl??``}}return r}function E(e,t,n){let r=e[n].trim();if(r!==t[n].trim())return r||null}function D(e,t){let n=e.trim(),r=t.trim();if(n!==r&&!(m(n)&&m(r)))return n||(r?null:void 0)}function ae(e,t,n){let r={};for(let i of e){let e=t[i]??w(),a=n[i]??w();if(JSON.stringify(e)===JSON.stringify(a))continue;let o={},s=D(e.apiKey,a.apiKey);s!==void 0&&(o.apiKey=s);let c=E(e,a,`region`);c!==void 0&&(o.region=c);let l=E(e,a,`baseUrl`);l!==void 0&&(o.baseUrl=l);let u=E(e,a,`imageBaseUrl`);u!==void 0&&(o.imageBaseUrl=u),Object.keys(o).length>0&&(r[i]=o)}return r}async function O(e){let t=await o(s(`/api/image/providers/${encodeURIComponent(e)}/reveal-api-key`),{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(!t.ok||!t.payload)throw Error(t.error?.message??`Reveal failed`);return t.payload}async function k(e){Object.keys(e).length!==0&&(await o(s(`/api/config`),{method:`PATCH`,body:JSON.stringify({providersConfig:e})}),await g())}var A=r();function oe(e){let t=(0,re.c)(18),{providerId:n,value:r,onChange:i,labels:a,apiKeyLinks:o,apiKeyLinkLabels:s}=e,c;t[0]===n?c=t[1]:(c=()=>O(n).then(j),t[0]=n,t[1]=c);let u=c,d=`img-cred-key-${n}`,f;t[2]!==a.apiKeyLabel||t[3]!==d?(f=(0,A.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:d,children:a.apiKeyLabel}),t[2]=a.apiKeyLabel,t[3]=d,t[4]=f):f=t[4];let p;t[5]!==s||t[6]!==o?(p=o.length>0?(0,A.jsx)(`div`,{className:`flex flex-col gap-1`,children:o.map(e=>(0,A.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-xs font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[y(e.kind,s),(0,A.jsx)(l,{className:`size-3`,"aria-hidden":!0})]},`${e.kind}-${e.href}`))}):null,t[5]=s,t[6]=o,t[7]=p):p=t[7];let m=`img-cred-key-${n}`,h;t[8]!==a||t[9]!==i||t[10]!==u||t[11]!==m||t[12]!==r?(h=(0,A.jsx)(_,{id:m,value:r,onChange:i,placeholder:a.optionalPlaceholder,labels:a,reveal:u,loadFailedLabel:a.loadFailed,maskedHelp:a.maskedHelp,notInConfigFile:a.notInConfigFile}),t[8]=a,t[9]=i,t[10]=u,t[11]=m,t[12]=r,t[13]=h):h=t[13];let g;return t[14]!==f||t[15]!==p||t[16]!==h?(g=(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 sm:col-span-2`,children:[f,p,h]}),t[14]=f,t[15]=p,t[16]=h,t[17]=g):g=t[17],g}function j(e){return e.apiKey??null}function M(){return i(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,p)}function se(){return i(M(),`appearance-none bg-[length:1rem] bg-[right_0.5rem_center] bg-no-repeat pr-9`)}var N=`__custom__`;function ce(e,t){if(!e.region.trim()&&!e.imageBaseUrl.trim())return``;let n=e.region.trim().toLowerCase();return t.some(e=>e.value===n)?n:N}function le(e,t){let n=e.baseUrl.trim().replace(/\/+$/,``);if(!n)return``;let r=t.map(e=>e.value.replace(/\/+$/,``)).indexOf(n);return r>=0?t[r].value:N}function ue(e,t,n){return t===`beijing`?e.dashscopeRegion_beijing:t===`singapore`?e.dashscopeRegion_singapore:t===`us`?e.dashscopeRegion_us:n}function de(e,t){return t===`minimax`?e.minimaxClusterLabel:t===`fal`?e.falQueueBaseLabel:e.baseUrlLabel}function fe(e,t){return t===`minimax`?e.minimaxClusterHint:t===`fal`?e.falQueueBaseHint:null}function pe(e,t){return JSON.stringify(e)!==JSON.stringify(t)}function me(e,t){return t===1?e.modelCountOne:e.modelCountMany.replace(`{count}`,String(t))}function P(e){let t=(0,re.c)(76),{summaries:n,credDraft:r,credBaseline:a,credDirty:o,credSaving:s,credError:c,credSavedFlash:p,credNoopFlash:m,updateCredRow:h,onDiscardCredentials:g,onSaveCredentials:_,extensionIds:y,showExtensionLinks:x,showImageModelsLink:S,hideActions:ie,language:T,apiKeyLinkLabels:E,messages:D}=e,ae=ie===void 0?!1:ie,O;t[0]===n?O=t[1]:(O=n.some(ye),t[0]=n,t[1]=O);let k=O,j;t[2]===n?j=t[3]:(j=n.some(ve),t[2]=n,t[3]=j);let P=j,[F,be]=(0,C.useState)(_e),[I,L]=(0,C.useState)(ge),R;if(t[4]!==a||t[5]!==r||t[6]!==n){R=new Set;for(let e of n)pe(r[e.id]??w(),a[e.id]??w())&&R.add(e.id);t[4]=a,t[5]=r,t[6]=n,t[7]=R}else R=t[7];let z=R,B;t[8]!==z||t[9]!==I||t[10]!==F?(B=e=>I.has(e)?!1:F.has(e)?!0:z.has(e),t[8]=z,t[9]=I,t[10]=F,t[11]=B):B=t[11];let V=B,H;t[12]===V?H=t[13]:(H=e=>{if(V(e)){L(t=>new Set(t).add(e)),be(t=>{let n=new Set(t);return n.delete(e),n});return}L(t=>{let n=new Set(t);return n.delete(e),n}),be(t=>new Set(t).add(e))},t[12]=V,t[13]=H);let U=H;if(n.length===0)return null;let W;t[14]===D.credentialsIntro?W=t[15]:(W=(0,A.jsx)(`p`,{children:D.credentialsIntro}),t[14]=D.credentialsIntro,t[15]=W);let G;t[16]!==k||t[17]!==D.regionHint?(G=k?(0,A.jsx)(`p`,{className:`text-fg-subtle`,children:D.regionHint}):null,t[16]=k,t[17]=D.regionHint,t[18]=G):G=t[18];let K;t[19]!==P||t[20]!==D.endpointPresetsHint?(K=P?(0,A.jsx)(`p`,{className:`text-fg-subtle`,children:D.endpointPresetsHint}):null,t[19]=P,t[20]=D.endpointPresetsHint,t[21]=K):K=t[21];let q;t[22]!==S||t[23]!==D.imageModelsLinkTitle||t[24]!==D.openImageModelsPage?(q=S?(0,A.jsx)(`p`,{children:(0,A.jsx)(ne,{to:`/settings/credentials?tab=image-models`,className:`font-medium text-accent hover:underline`,title:D.imageModelsLinkTitle,children:D.openImageModelsPage})}):null,t[22]=S,t[23]=D.imageModelsLinkTitle,t[24]=D.openImageModelsPage,t[25]=q):q=t[25];let J;t[26]!==W||t[27]!==G||t[28]!==K||t[29]!==q?(J=(0,A.jsxs)(`div`,{className:`flex flex-col gap-1 text-xs leading-relaxed text-fg-muted`,children:[W,G,K,q]}),t[26]=W,t[27]=G,t[28]=K,t[29]=q,t[30]=J):J=t[30];let Y;t[31]===c?Y=t[32]:(Y=c?(0,A.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:c}):null,t[31]=c,t[32]=Y);let X;t[33]!==o||t[34]!==m||t[35]!==p||t[36]!==s||t[37]!==ae||t[38]!==g||t[39]!==_||t[40]!==D.credentialsNothingToSave||t[41]!==D.credentialsSaved||t[42]!==D.discardCredentials||t[43]!==D.saveCredentials||t[44]!==D.savingCredentials?(X=ae?null:(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[p?(0,A.jsx)(`span`,{className:`text-sm text-fg-muted`,children:D.credentialsSaved}):null,m?(0,A.jsx)(`span`,{className:`text-sm text-fg-muted`,children:D.credentialsNothingToSave}):null,(0,A.jsx)(u,{type:`button`,variant:`secondary`,onClick:g,disabled:!o||s,children:D.discardCredentials}),(0,A.jsx)(u,{type:`button`,variant:`primary`,onClick:_,disabled:!o||s,children:s?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(d,{className:`size-3.5 animate-spin`}),(0,A.jsx)(`span`,{className:`ml-1.5`,children:D.savingCredentials})]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(v,{className:`size-3.5`}),(0,A.jsx)(`span`,{className:`ml-1.5`,children:D.saveCredentials})]})})]}),t[33]=o,t[34]=m,t[35]=p,t[36]=s,t[37]=ae,t[38]=g,t[39]=_,t[40]=D.credentialsNothingToSave,t[41]=D.credentialsSaved,t[42]=D.discardCredentials,t[43]=D.saveCredentials,t[44]=D.savingCredentials,t[45]=X):X=t[45];let Z;if(t[46]!==E||t[47]!==a||t[48]!==r||t[49]!==y||t[50]!==V||t[51]!==T||t[52]!==x||t[53]!==n||t[54]!==D||t[55]!==U||t[56]!==h){let e;t[58]!==E||t[59]!==a||t[60]!==r||t[61]!==y||t[62]!==V||t[63]!==T||t[64]!==x||t[65]!==D||t[66]!==U||t[67]!==h?(e=e=>{let t=r[e.id]??w(),n=e.ui,o=x&&y.has(e.id)?`/settings/ext/${encodeURIComponent(e.id)}`:null,s=pe(t,a[e.id]??w()),c=V(e.id),u=e.label??e.id,d=me(D,e.models.length);return(0,A.jsxs)(`section`,{className:i(`overflow-hidden rounded-xl bg-surface-panel/80 shadow-surface transition-colors`,s&&`ring-1 ring-accent/50`),children:[(0,A.jsxs)(`button`,{type:`button`,className:`flex w-full items-start justify-between gap-3 px-4 py-3 text-left hover:bg-surface-hover/70`,"aria-expanded":c,"aria-controls":`img-provider-credentials-${e.id}`,onClick:()=>U(e.id),children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`truncate text-sm font-semibold text-fg`,children:u}),(0,A.jsx)(`span`,{className:`rounded-full bg-surface-subtle px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:e.id}),s?(0,A.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:D.unsavedChanges}):null,e.configured?(0,A.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:D.configured}):(0,A.jsx)(`span`,{className:`rounded-full border border-amber-500/40 bg-amber-500/10 px-2 py-0.5 text-[11px] font-medium text-amber-700 dark:text-amber-300`,children:D.missingKey})]}),(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-subtle`,children:[(0,A.jsx)(`span`,{children:d}),e.defaultModel?(0,A.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,A.jsxs)(`span`,{className:`text-fg-muted`,children:[D.defaultModel,`:`]}),` `,e.id,`/`,e.defaultModel]}):null]})]}),(0,A.jsx)(ee,{className:i(`mt-0.5 size-4 shrink-0 text-fg-subtle transition-transform`,c?`rotate-180`:`rotate-0`),"aria-hidden":`true`}),(0,A.jsx)(`span`,{className:`sr-only`,children:c?D.collapseProvider:D.expandProvider})]}),c?(0,A.jsxs)(`div`,{id:`img-provider-credentials-${e.id}`,className:`bg-surface-base/45 px-4 py-4`,children:[o?(0,A.jsxs)(ne,{to:o,className:`mb-3 inline-flex items-center gap-1 text-xs font-medium text-accent hover:underline`,title:D.extensionSettingsLinkTitle,children:[(0,A.jsx)(l,{className:`size-3`}),D.openExtensionSettings]}):null,e.models.length>0?(0,A.jsxs)(`p`,{className:`mb-3 text-xs leading-relaxed text-fg-subtle`,children:[(0,A.jsxs)(`span`,{className:`text-fg-muted`,children:[D.modelsLabel,`:`]}),` `,e.models.map(t=>`${e.id}/${t}`).join(`, `)]}):null,(0,A.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,A.jsx)(oe,{providerId:e.id,value:t.apiKey,onChange:t=>h(e.id,{apiKey:t}),apiKeyLinks:f(e.id,T),apiKeyLinkLabels:E,labels:{apiKeyLabel:D.apiKeyLabel,optionalPlaceholder:D.optionalPlaceholder,maskedHelp:D.apiKeyMaskedHelp,copy:D.apiKeyCopy,copied:D.apiKeyCopied,show:D.apiKeyShow,hide:D.apiKeyHide,notInConfigFile:D.apiKeyNotInConfigFile,loadFailed:D.apiKeyRevealFailed}}),n?.regions?.length?(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 sm:col-span-2`,children:[(0,A.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:`img-cred-region-preset-${e.id}`,children:D.regionLabel}),(0,A.jsxs)(te,{id:`img-cred-region-preset-${e.id}`,className:se(),value:ce(t,n.regions),onChange:t=>{let r=t.target.value;if(r===``){h(e.id,{region:``,imageBaseUrl:``});return}if(r===N){h(e.id,{region:``,imageBaseUrl:``});return}let i=n.regions.find(e=>e.value===r);i&&h(e.id,{region:i.value,imageBaseUrl:i.imageBaseUrl})},children:[(0,A.jsx)(b,{value:``,children:D.regionPresetDefault}),n.regions.map(e=>(0,A.jsx)(b,{value:e.value,children:ue(D,e.value,e.label)},e.value)),(0,A.jsx)(b,{value:N,children:D.regionPresetCustom})]}),ce(t,n.regions)===N?(0,A.jsxs)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[(0,A.jsx)(`input`,{type:`text`,className:M(),value:t.region,placeholder:`region`,onChange:t=>h(e.id,{region:t.target.value})}),(0,A.jsx)(`input`,{type:`url`,className:M(),value:t.imageBaseUrl,placeholder:D.imageBaseUrlLabel,onChange:t=>h(e.id,{imageBaseUrl:t.target.value})})]}):null]}):null,n?.baseUrlPresets?.length?(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 sm:col-span-2`,children:[(0,A.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:`img-cred-base-preset-${e.id}`,children:de(D,n.baseUrlPresetKind)}),fe(D,n.baseUrlPresetKind)?(0,A.jsx)(`p`,{className:`text-[11px] text-fg-subtle`,children:fe(D,n.baseUrlPresetKind)}):null,(0,A.jsxs)(te,{id:`img-cred-base-preset-${e.id}`,className:se(),value:le(t,n.baseUrlPresets),onChange:t=>{let n=t.target.value;if(n===``){h(e.id,{baseUrl:``});return}if(n===N){h(e.id,{baseUrl:``});return}h(e.id,{baseUrl:n.replace(/\/+$/,``)})},children:[(0,A.jsx)(b,{value:``,children:D.baseUrlPresetDefault}),n.baseUrlPresets.map(he),(0,A.jsx)(b,{value:N,children:D.baseUrlPresetCustom})]}),le(t,n.baseUrlPresets)===N?(0,A.jsx)(`input`,{type:`url`,className:i(M(),`mt-2`),value:t.baseUrl,placeholder:`https://…`,onChange:t=>h(e.id,{baseUrl:t.target.value})}):null]}):null,n?.regions?.length&&ce(t,n.regions)!==N?(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 sm:col-span-2`,children:[(0,A.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:`img-cred-imgbase-ro-${e.id}`,children:D.imageBaseUrlLabel}),(0,A.jsx)(`input`,{id:`img-cred-imgbase-ro-${e.id}`,type:`url`,readOnly:!0,className:i(M(),`cursor-not-allowed opacity-90`),value:t.imageBaseUrl,title:D.imageBaseUrlPresetHint}),(0,A.jsx)(`p`,{className:`text-[11px] text-fg-subtle`,children:D.imageBaseUrlPresetHint})]}):null]})]}):null]},e.id)},t[58]=E,t[59]=a,t[60]=r,t[61]=y,t[62]=V,t[63]=T,t[64]=x,t[65]=D,t[66]=U,t[67]=h,t[68]=e):e=t[68],Z=n.map(e),t[46]=E,t[47]=a,t[48]=r,t[49]=y,t[50]=V,t[51]=T,t[52]=x,t[53]=n,t[54]=D,t[55]=U,t[56]=h,t[57]=Z}else Z=t[57];let Q;t[69]===Z?Q=t[70]:(Q=(0,A.jsx)(`div`,{className:`flex flex-col gap-4`,children:Z}),t[69]=Z,t[70]=Q);let $;return t[71]!==J||t[72]!==Y||t[73]!==X||t[74]!==Q?($=(0,A.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[J,Y,X,Q]}),t[71]=J,t[72]=Y,t[73]=X,t[74]=Q,t[75]=$):$=t[75],$}function he(e){return(0,A.jsx)(b,{value:e.value,children:e.label},e.value)}function ge(){return new Set}function _e(){return new Set}function ve(e){return(e.ui?.baseUrlPresets?.length??0)>0}function ye(e){return(e.ui?.regions?.length??0)>0}function F(e){let t=h(a(e=>!!e.token)),n=t.data,r=(0,C.useMemo)(()=>e.map(e=>e.id),[e]),i=(0,C.useRef)(!1),[o,l]=(0,C.useState)(null),[u,d]=(0,C.useState)(!1),[f,p]=(0,C.useState)(null),[m,g]=(0,C.useState)(!1),[_,ee]=(0,C.useState)(!1),v=(0,C.useMemo)(()=>T(n?.payload?.config,r),[n?.payload?.config,r]),y=o??v,b=v;return{gwSwr:t,credDraft:y,credBaseline:b,credDirty:(0,C.useMemo)(()=>JSON.stringify(y)!==JSON.stringify(b),[y,b]),credSaving:u,credError:f,credSavedFlash:m,credNoopFlash:_,updateCredRow:(0,C.useCallback)((e,t)=>{i.current=!0,l(n=>{let r=n??v,i=r[e]??w();return{...r,[e]:{...i,...t}}})},[v]),onDiscardCredentials:(0,C.useCallback)(()=>{i.current=!1,l(null),p(null),g(!1),ee(!1)},[]),saveCredentials:(0,C.useCallback)(async e=>{let n=ae(r,y,b);if(Object.keys(n).length===0){ee(!0),window.setTimeout(()=>ee(!1),2200);return}d(!0),p(null),g(!1);try{await k(n),await t.mutate?.(),c(s(x)),i.current=!1,l(null),g(!0),window.setTimeout(()=>g(!1),2e3)}catch(t){p(t instanceof Error?t.message:e)}finally{d(!1)}},[r,y,b,t])}}function be(){return{enabled:!1,provider:`alibaba`,alibaba:{model:`paraformer-v2`},openai:{model:`whisper-1`},fallback:{enabled:!0,order:[`alibaba`,`openai`]}}}function I(){return{enabled:!1,provider:`edge`,trigger:`always`,maxTextLength:512,timeoutMs:6e4,alibaba:{model:`qwen-tts`,voice:`Cherry`},openai:{model:`tts-1`,voice:`alloy`},edge:{voice:`en-US-MichelleNeural`},minimax:{model:`speech-2.8-hd`,voice:`male-qn-qingse`},"tts-local-cli":{command:``,outputFormat:`wav`}}}function L(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function R(e){return typeof e==`string`&&e.trim().length>0?e.trim():`alibaba`}function z(e,t,n){let r=L(e.providers)?e.providers:void 0,i=r&&L(r[t])?r[t]:void 0;return{...n,...i??{}}}function B(e){let t=be();if(!L(e))return t;let n=R(e.provider),r=z(e,`alibaba`,t.alibaba??{}),i=z(e,`openai`,t.openai??{}),a=t.fallback??{enabled:!0,order:[`alibaba`,`openai`]};if(L(e.fallback)){let t=Array.isArray(e.fallback.order)?e.fallback.order.filter(e=>typeof e==`string`&&e.trim().length>0):a.order;a={enabled:typeof e.fallback.enabled==`boolean`?e.fallback.enabled:a.enabled,order:t.length?t:a.order}}let o=L(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,L(t)?{...t}:{}])):void 0;return{enabled:!!e.enabled,provider:n,alibaba:r,openai:i,...o?{providers:o}:{},fallback:a}}function V(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function H(e){let t=I();if(!L(e))return t;let n=V(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`always`,i=t[`tts-local-cli`]??{},a=L(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,L(t)?{...t}:{}])):void 0;return{enabled:!!e.enabled,provider:n,trigger:r,maxTextLength:typeof e.maxTextLength==`number`&&Number.isFinite(e.maxTextLength)?e.maxTextLength:t.maxTextLength,timeoutMs:typeof e.timeoutMs==`number`&&Number.isFinite(e.timeoutMs)?e.timeoutMs:t.timeoutMs,...a?{providers:a}:{},alibaba:z(e,`alibaba`,t.alibaba??{}),openai:z(e,`openai`,t.openai??{}),edge:z(e,`edge`,t.edge??{}),minimax:z(e,`minimax`,t.minimax??{}),"tts-local-cli":z(e,`tts-local-cli`,i)}}function U(e){let{alibaba:t,openai:n,providers:r,...i}=e,a={...r??{}};return t&&(a.alibaba={...a.alibaba??{},...t}),n&&(a.openai={...a.openai??{},...n}),{...i,...Object.keys(a).length>0?{providers:a}:{}}}function W(e){let{alibaba:t,openai:n,edge:r,minimax:i,"tts-local-cli":a,providers:o,...s}=e,c={...o??{}};return t&&(c.alibaba={...c.alibaba??{},...t}),n&&(c.openai={...c.openai??{},...n}),r&&(c.edge={...c.edge??{},...r}),i&&(c.minimax={...c.minimax??{},...i}),a&&(c[`tts-local-cli`]={...c[`tts-local-cli`]??{},...a}),{...s,...Object.keys(c).length>0?{providers:c}:{}}}function G(e){let t=L(e)?e:{};return{stt:B(t.stt),tts:H(t.tts)}}async function K(){return G((await o(s(`/api/config`))).payload?.config??{})}async function q(e){await o(s(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:U(e.stt),tts:W(e.tts)})}),g()}async function J(){let e=await o(s(`/api/voice/models`));if(!e.payload?.models)throw Error(`Missing voice models payload`);return e.payload.models}async function Y(){let e=await o(s(`/api/voice/providers`));if(!e.payload?.providers)throw Error(`Missing voice providers payload`);return e.payload}async function X(){let e=await o(s(`/api/voice/stt-providers`));if(!e.payload?.providers)throw Error(`Missing STT providers payload`);return e.payload}async function Z(e){let t=await o(s(`/api/voice/tts-test`),{method:`POST`,body:JSON.stringify(e)});if(t.ok===!1){let e=typeof t.error==`string`?t.error:t.error?.message;throw Error(e||`TTS test failed`)}if(!t.payload||typeof t.payload.audio!=`string`||!t.payload.audio.trim())throw Error(`TTS test returned no audio. Check the selected voice engine and try again.`);return t.payload}async function Q(e){let t=await o(s(`/api/voice/reveal-api-key`),{method:`POST`,body:JSON.stringify(e)});if(!t.payload)throw Error(`Missing reveal payload`);return t.payload}function $(e){let t=(0,re.c)(15),{kind:n,providerId:r,fieldId:a,value:o,onChange:s,labels:c,placeholder:l,className:u}=e,d=l===void 0?`sk-...`:l,f;t[0]!==n||t[1]!==r?(f=()=>Q({kind:n,provider:r}).then(xe),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p=f,m;t[3]===u?m=t[4]:(m=i(`flex min-w-0 flex-col gap-1.5`,u),t[3]=u,t[4]=m);let h;t[5]!==a||t[6]!==c||t[7]!==s||t[8]!==d||t[9]!==p||t[10]!==o?(h=(0,A.jsx)(_,{id:a,value:o,onChange:s,placeholder:d,labels:c,reveal:p,loadFailedLabel:c.loadFailed,maskedHelp:c.maskedHelp,notInConfigFile:c.notInConfigFile,inputClassName:`text-xs`}),t[5]=a,t[6]=c,t[7]=s,t[8]=d,t[9]=p,t[10]=o,t[11]=h):h=t[11];let g;return t[12]!==m||t[13]!==h?(g=(0,A.jsx)(`div`,{className:m,children:h}),t[12]=m,t[13]=h,t[14]=g):g=t[14],g}function xe(e){return e.apiKey??null}export{X as a,Z as c,S as d,x as f,K as i,F as l,J as n,G as o,Y as r,q as s,$ as t,P as u};
|
|
@@ -0,0 +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-BQ_8x0bT.js";import{t as a}from"./messages-CQ_k8RHj.js";import{n as o}from"./locale-store-Ba72bFmP.js";import{$c as s,Ac as c,Cs as l,Dl as u,Ec as d,Eo as f,Go as p,Hs as m,Ji as ee,Ms as te,Nc as ne,Ol as h,Vo as re,_s as ie,a as ae,f as oe,gs as se,gt as ce,l as le,m as ue,o as de,p as fe,qa as g,ro as _,s as pe,sl as v,to as y,u as b,vc as me,vl as x,wl as S}from"./index-DZOm5_ex.js";var C=n(),w=e(t(),1),T=r();function he(e){return e===`done`||e===`in_review`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`blocked`||e===`needs_input`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`in_progress`?`bg-accent-soft text-accent-fg`:e===`backlog`||e===`todo`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-muted text-fg-subtle`}function E(e){return e?new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(e)):``}function ge(e){return!Number.isFinite(e)||e<=0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(+(e<10*1024))} KB`:`${(e/(1024*1024)).toFixed(+(e<10*1024*1024))} MB`}function _e(e){return e.kind===`chat`?`/chat/${encodeURIComponent(e.targetId)}`:e.kind===`goal`?`/goals/${encodeURIComponent(e.targetId)}`:e.kind===`workflow_run`?`/workflows?run=${encodeURIComponent(e.targetId)}`:e.kind===`automation`?`/automations?automationId=${encodeURIComponent(e.targetId)}`:e.kind===`note`?`/notes/${encodeURIComponent(e.targetId)}`:`#`}function D(e){let t=(0,C.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,T.jsx)(`dt`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a=r||`-`,o;t[2]===a?o=t[3]:(o=(0,T.jsx)(`dd`,{className:`min-w-0 break-words text-sm text-fg`,children:a}),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s=(0,T.jsxs)(`div`,{className:`grid gap-1`,children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s}function ve(e){let t=(0,C.c)(9),{events:n,t:r}=e;if(!n.length){let e;return t[0]===r.detail.noActivity?e=t[1]:(e=(0,T.jsx)(`div`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:r.detail.noActivity}),t[0]=r.detail.noActivity,t[1]=e),e}let i;if(t[2]!==n||t[3]!==r){let e;t[5]===r?e=t[6]:(e=e=>(0,T.jsx)(`article`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,T.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r.eventTypes[e.type]??e.type}),(0,T.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:E(e.createdAt)})]})},e.id),t[5]=r,t[6]=e),i=n.map(e),t[2]=n,t[3]=r,t[4]=i}else i=t[4];let a;return t[7]===i?a=t[8]:(a=(0,T.jsx)(`div`,{className:`grid gap-3`,children:i}),t[7]=i,t[8]=a),a}function O(e){return new Set(e.toLowerCase().split(/[^a-z0-9\u4e00-\u9fff]+/).filter(e=>e.length>=2))}function k(e,t,n){let r=t?.projectKind,i=[e.title,e.description,e.nextAction,e.blockedReason,e.status,e.priority,t?.name,t?.description,r].filter(Boolean).join(` `),a=[n.title,n.description,n.metadata.whenToUse,...n.metadata.tags??[]].filter(Boolean).join(` `),o=O(i),s=0;for(let e of O(a))o.has(e)&&(s+=3);let c=a.toLowerCase();return(e.status===`blocked`||e.status===`needs_input`)&&/debug|diagnos|review|audit|fix|检查|排查|修复/.test(c)&&(s+=8),e.status===`in_review`&&/review|audit|check|验收|评审|检查/.test(c)&&(s+=6),e.attachments?.length&&/analy|extract|summar|review|整理|分析|总结/.test(c)&&(s+=5),r===`coding`&&/code|repo|test|pr|review|代码|仓库|测试/.test(c)&&(s+=5),s}function ye(e,t,n){return[...n].sort((n,r)=>k(e,t,r)-k(e,t,n)||n.title.localeCompare(r.title))}function A(){let{workItemId:e=``}=h(),t=u(),n=a(o(e=>e.language)).projectDetailPage.workItems,[r,C]=(0,w.useState)(null),[O,A]=(0,w.useState)(null),[j,M]=(0,w.useState)([]),[N,be]=(0,w.useState)([]),[P,F]=(0,w.useState)(``),[I,L]=(0,w.useState)(``),[R,z]=(0,w.useState)(!0),[B,V]=(0,w.useState)(!1),[H,U]=(0,w.useState)(null),W=(0,w.useRef)(null),G=g(e=>e.setPageHeader),K=g(e=>e.clearPageHeader),q=(0,w.useMemo)(()=>r?`/projects/${encodeURIComponent(r.projectId)}/work-items`:`/projects`,[r]),J=(0,w.useCallback)(async()=>{if(e){z(!0),U(null);try{let[t,n]=await Promise.all([le(e),b(e).catch(()=>({events:[]}))]);C(t.item),L(t.item.nextAction||t.item.title),M(n.events);let[r,i]=await Promise.all([ee(t.item.projectId).catch(()=>null),ce().catch(()=>[])]),a=ye(t.item,r,i);A(r),be(a),F(e=>e||a[0]?.id||``)}catch(e){U(e instanceof Error?e.message:String(e))}finally{z(!1)}}},[e]);(0,w.useEffect)(()=>{J()},[J]);let Y=(0,w.useCallback)(async()=>{if(r){V(!0),U(null);try{let e=await oe(r.id);C(e.item),t(`/chat/${encodeURIComponent(e.session.key)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t]),X=(0,w.useCallback)(async()=>{if(r){V(!0),U(null);try{let e=await ae(r.id);C(e.item),t(`/goals/${encodeURIComponent(e.goal.id)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t]),Z=(0,w.useCallback)(async e=>{M((await b(e).catch(()=>({events:[]}))).events)},[]),xe=(0,w.useCallback)(async()=>{if(!(!r||!P)){V(!0),U(null);try{let e=await fe(r.id,{definitionId:P,goal:I.trim()||r.nextAction||r.title});C(e.item),await Z(e.item.id),t(`/workflows?run=${encodeURIComponent(e.runId)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t,Z,P,I]),Se=(0,w.useCallback)(async e=>{if(!(!r||!e.length)){V(!0),U(null);try{let t=await ue(r.id,e);C(t.item),await Z(t.item.id)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,Z]),Ce=(0,w.useCallback)(async e=>{if(r){V(!0),U(null);try{let t=await de(r.id,e.id);C(t.item),await Z(t.item.id)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,Z]),we=(0,w.useCallback)(async e=>{if(r){U(null);try{await pe(r.id,e)}catch(e){U(e instanceof Error?e.message:String(e))}}},[r]),Q=(0,w.useMemo)(()=>r?N.filter(e=>k(r,O,e)>0).slice(0,3):[],[r,O,N]),$=(0,w.useMemo)(()=>(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(f,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:()=>void J(),children:[(0,T.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`hidden sm:inline`,children:n.refreshShort})]}),r?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(f,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:Y,children:[(0,T.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.startChat})]}),(0,T.jsxs)(f,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:X,children:[(0,T.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.createGoal})]})]}):null]}),[B,X,Y,r,J,n.detail.createGoal,n.detail.startChat,n.refreshShort]);return(0,w.useLayoutEffect)(()=>(G({startExtra:(0,T.jsx)(S,{to:q,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":O?.name?n.detail.backToProject.replace(`{{name}}`,O.name):n.detail.backToProjects,children:(0,T.jsx)(x,{className:`size-4`,"aria-hidden":!0})}),main:(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,T.jsx)(v,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,T.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r?.title??(R?n.detail.loading:n.detail.notFound)})]}),r?(0,T.jsxs)(`p`,{className:`truncate text-xs text-fg-muted`,children:[n.statuses[r.status],` · `,n.priorities[r.priority],` · `,O?.name||r.projectId,` · `,n.updated,`: `,E(r.updatedAt)]}):null]}),end:$}),()=>K()),[K,$,r,R,O?.name,q,G,n,O]),R?(0,T.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,T.jsx)(`div`,{className:`h-8 w-40 animate-pulse rounded-md bg-surface-hover`}),(0,T.jsx)(`div`,{className:`mt-5 h-44 animate-pulse rounded-xl bg-surface-hover`})]}):H||!r?(0,T.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,children:[(0,T.jsxs)(S,{to:`/projects`,className:`inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,T.jsx)(x,{className:`size-4`,"aria-hidden":!0}),n.detail.backToProjects]}),(0,T.jsx)(`div`,{className:`mt-5 rounded-lg border border-danger/30 bg-danger-soft px-4 py-3 text-sm text-danger`,children:H||n.detail.notFound})]}):(0,T.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-4 shadow-surface sm:px-5`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,T.jsx)(v,{className:`size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,T.jsx)(`h1`,{className:`min-w-0 break-words text-lg font-semibold leading-7 text-fg`,children:r.title})]}),(0,T.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs`,children:[(0,T.jsx)(`span`,{className:i(`rounded-full px-2 py-0.5 font-medium`,he(r.status)),children:n.statuses[r.status]}),(0,T.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-fg-muted`,children:n.priorities[r.priority]}),r.archivedAt?(0,T.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-fg-muted`,children:n.detail.archived}):null]})]}),(0,T.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,T.jsxs)(f,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:Y,children:[(0,T.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startChat]}),(0,T.jsxs)(f,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:X,children:[(0,T.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),n.detail.createGoal]})]})]}),(0,T.jsxs)(`dl`,{className:`mt-5 grid gap-4 border-t border-edge pt-4 sm:grid-cols-2`,children:[(0,T.jsx)(D,{label:n.create.descriptionLabel,value:r.description||n.detail.noDescription}),(0,T.jsx)(D,{label:n.nextAction,value:r.nextAction||n.noNextAction}),(0,T.jsx)(D,{label:n.blockedReason,value:r.blockedReason||n.detail.noBlockedReason}),(0,T.jsx)(D,{label:n.updated,value:E(r.updatedAt)})]})]}),(0,T.jsxs)(`div`,{className:`mt-4 grid min-h-0 gap-4 lg:grid-cols-[minmax(0,1fr)_18rem]`,children:[(0,T.jsxs)(`section`,{className:`min-w-0`,children:[(0,T.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,T.jsx)(d,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,T.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.activity})]}),(0,T.jsx)(ve,{events:j,t:n})]}),(0,T.jsxs)(`aside`,{className:`grid content-start gap-4`,children:[(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,T.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,T.jsxs)(`h2`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,T.jsx)(me,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`truncate`,children:n.detail.workflowTitle})]})}),(0,T.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.detail.workflowHint}),(0,T.jsxs)(`div`,{className:`mt-3 grid gap-2`,children:[(0,T.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-subtle`,children:[n.detail.workflowTemplate,(0,T.jsxs)(y,{className:`h-9 rounded-md border border-edge bg-surface-base px-2 text-sm font-normal text-fg outline-none focus:border-accent`,value:P,disabled:B||N.length===0,onChange:e=>F(e.target.value),children:[N.length===0?(0,T.jsx)(_,{value:``,children:n.detail.noWorkflowTemplates}):null,N.map(e=>(0,T.jsx)(_,{value:e.id,children:e.title},e.id))]})]}),Q.length?(0,T.jsxs)(`div`,{className:`grid gap-1`,children:[(0,T.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n.detail.recommendedWorkflows}),(0,T.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Q.map(e=>(0,T.jsx)(`button`,{type:`button`,className:i(`min-w-0 rounded-md border px-2 py-1 text-left text-xs transition-colors`,P===e.id?`border-accent bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg`),disabled:B,onClick:()=>F(e.id),children:(0,T.jsx)(`span`,{className:`block max-w-48 truncate`,children:e.title})},e.id))})]}):null,(0,T.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-subtle`,children:[n.detail.workflowGoal,(0,T.jsx)(`textarea`,{className:`min-h-20 resize-y rounded-md border border-edge bg-surface-base px-2 py-2 text-sm font-normal text-fg outline-none focus:border-accent`,value:I,disabled:B,onChange:e=>L(e.target.value)})]}),(0,T.jsxs)(f,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3 text-xs`,disabled:B||!P,onClick:xe,children:[(0,T.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startWorkflow]}),N.length?null:(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.detail.noWorkflowTemplates})]})]}),(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,T.jsxs)(`h2`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,T.jsx)(te,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`truncate`,children:n.attachments.title})]}),(0,T.jsxs)(f,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:()=>W.current?.click(),children:[(0,T.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),n.attachments.add]}),(0,T.jsx)(`input`,{ref:W,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{Se(Array.from(e.target.files??[])),e.currentTarget.value=``}})]}),(0,T.jsx)(`div`,{className:`mt-3 grid gap-2`,children:r.attachments?.length?r.attachments.map(e=>(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-base px-2 py-2 text-sm`,children:[(0,T.jsx)(d,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsx)(`div`,{className:`truncate font-medium text-fg`,children:e.fileName}),(0,T.jsxs)(`div`,{className:`truncate text-xs text-fg-subtle`,children:[e.mimeType,` · `,ge(e.size)]})]}),(0,T.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:n.attachments.download,"aria-label":n.attachments.download,disabled:B,onClick:()=>void we(e),children:(0,T.jsx)(ne,{className:`size-3.5`,"aria-hidden":!0})}),(0,T.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-danger`,title:n.attachments.remove,"aria-label":n.attachments.remove,disabled:B,onClick:()=>void Ce(e),children:(0,T.jsx)(re,{className:`size-3.5`,"aria-hidden":!0})})]},e.id)):(0,T.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.attachments.empty})})]}),(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,T.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.links}),(0,T.jsx)(`div`,{className:`mt-3 grid gap-1 text-sm`,children:r.links?.length?r.links.map(e=>(0,T.jsxs)(S,{to:_e(e),className:`flex min-w-0 items-center justify-between gap-3 rounded-md px-2 py-1.5 hover:bg-surface-hover`,children:[(0,T.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.title||e.targetId}),(0,T.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[n.linkKinds[e.kind],(0,T.jsx)(c,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,T.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.detail.noLinks})})]}),(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,T.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.project}),(0,T.jsxs)(S,{to:q,className:`mt-2 inline-flex min-w-0 items-center gap-2 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,T.jsx)(s,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`min-w-0 truncate`,children:O?.name||r.projectId})]})]})]})]})]})}export{A as WorkItemDetailPage};
|
|
@@ -0,0 +1,3 @@
|
|
|
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-BQ_8x0bT.js";import{t as a}from"./messages-CQ_k8RHj.js";import{o,t as s}from"./fetch-BWXmBizE.js";import{$ as c,Ba as l,D as u,Eo as d,Fo as f,Ga as p,Go as m,Ka as h,N as g,Q as _,Qo as v,U as y,Ua as b,Va as x,Wa as S,_s as C,es as w,ic as T,il as E,kc as D,ko as O,ns as k,ro as A,si as j,to as M}from"./index-DZOm5_ex.js";var N=e(t(),1),P=n();function F(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function I(e){return typeof e.message==`string`&&e.message.trim()?e.message:typeof e.error==`string`&&e.error.trim()?e.error:e.error&&typeof e.error==`object`&&typeof e.error.message==`string`?e.error.message:`AI suggestion failed`}function L(e,t={}){let n=F(e.split(`
|
|
2
|
+
`).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
|
|
3
|
+
`));if(!n)return null;if(n.type===`text_delta`&&typeof n.delta==`string`)return t.onDelta?.(n.delta),null;if(n.type===`thinking_delta`&&typeof n.delta==`string`)return t.onThinkingDelta?.(n.delta),null;if(n.type===`done`&&typeof n.text==`string`)return n.text;if(n.type===`error`)throw Error(I(n));return null}async function R(e,t={}){let n=await s(o(`/api/ai/text-assist`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify(e)});if(!n.ok){let e=await n.json().catch(()=>({})),t=typeof e.error==`string`?e.error:e.error?.message;throw Error(t||`AI suggestion failed (${n.status})`)}if(!n.body){let e=await n.json().catch(()=>null);if(e?.text)return e;throw Error(`AI suggestion stream is empty`)}let r=n.body.getReader(),i=new TextDecoder,a=``,c=``,l=``;for(;;){let{done:e,value:n}=await r.read();if(n){a+=i.decode(n,{stream:!e});let r=a.split(/\r?\n\r?\n/);a=r.pop()??``;for(let e of r){let n=L(e,{onDelta:e=>{c+=e,t.onDelta?.(e)},onThinkingDelta:e=>{l+=e,t.onThinkingDelta?.(e)}});n!==null&&(c=n)}}if(e)break}if(a.trim()){let e=L(a,{onDelta:e=>{c+=e,t.onDelta?.(e)},onThinkingDelta:e=>{l+=e,t.onThinkingDelta?.(e)}});e!==null&&(c=e)}let u=c.trim();if(!u)throw Error(`AI returned an empty suggestion`);return{text:u,thinking:l.trim()||void 0}}function ee(){let[e,t]=(0,N.useState)(``),[n,r]=(0,N.useState)(``),[i,a]=(0,N.useState)(!1),[o,s]=(0,N.useState)(null);return{suggestion:e,thinking:n,loading:i,error:o,generate:(0,N.useCallback)(async e=>{a(!0),s(null),t(``),r(``);try{let n=await R(e,{onDelta:e=>{t(t=>t+e)},onThinkingDelta:e=>{r(t=>t+e)}});return t(n.text),r(n.thinking??``),n.text}catch(e){return s(e instanceof Error?e.message:`AI suggestion failed`),null}finally{a(!1)}},[]),reset:(0,N.useCallback)(()=>{t(``),r(``),s(null),a(!1)},[])}}var z=r(),te=5;function ne(e){return e.startsWith(`zh`)?{title:`AI 优化文案`,buttonTitle:`优化文案`,current:`当前内容`,suggestion:`AI 建议`,editedSuggestion:`审核并编辑建议`,thinking:`模型思考`,thinkingLoading:`思考中`,edit:`编辑`,preview:`预览`,loading:`正在生成建议...`,empty:`暂无内容`,generate:`生成建议`,regenerate:`重新生成`,applyCurrent:`应用当前内容`,replace:`替换`,append:`追加`,cancel:`取消`,close:`关闭`}:{title:`AI text assist`,buttonTitle:`Improve text`,current:`Current`,suggestion:`Suggestion`,editedSuggestion:`Review and edit suggestion`,thinking:`Model thinking`,thinkingLoading:`Thinking`,edit:`Edit`,preview:`Preview`,loading:`Generating suggestion...`,empty:`No content`,generate:`Generate suggestion`,regenerate:`Regenerate`,applyCurrent:`Apply current`,replace:`Replace`,append:`Append`,cancel:`Cancel`,close:`Close`}}function B(e){let t=(0,P.c)(232),{value:n,onApply:r,fieldId:a,fieldLabel:o,scenario:s,format:c,intent:u,locale:f,context:m,disabled:g,className:_,showLabel:y}=e,T=s===void 0?`generic.text`:s,k=c===void 0?`plain`:c,A=u===void 0?`improve`:u,M=y===void 0?!0:y,[F,I]=(0,N.useState)(!1),[L,R]=(0,N.useState)(n),[B,V]=(0,N.useState)(`preview`),[H,U]=(0,N.useState)(``),[W,G]=(0,N.useState)(`edit`),[K,ae]=(0,N.useState)(!0),oe=(0,N.useRef)(null),q=(0,N.useRef)(!0),{suggestion:se,thinking:J,loading:Y,error:X,generate:ce,reset:le}=ee(),ue;t[0]===f?ue=t[1]:(ue=ne(f),t[0]=f,t[1]=ue);let Z=ue,de;t[2]!==Y||t[3]!==J?(de=Y&&J.trim().length>0,t[2]=Y,t[3]=J,t[4]=de):de=t[4];let Q=de,fe,pe;t[5]!==F||t[6]!==n?(fe=()=>{F||R(n)},pe=[F,n],t[5]=F,t[6]=n,t[7]=fe,t[8]=pe):(fe=t[7],pe=t[8]),(0,N.useEffect)(fe,pe);let me,he;t[9]===se?(me=t[10],he=t[11]):(he=()=>{U(se)},me=[se],t[9]=se,t[10]=me,t[11]=he),(0,N.useEffect)(he,me);let ge,_e;t[12]===J?(ge=t[13],_e=t[14]):(ge=()=>{J.trim()&&ae(!0)},_e=[J],t[12]=J,t[13]=ge,t[14]=_e),(0,N.useEffect)(ge,_e);let ve;t[15]!==Q||t[16]!==K?(ve=()=>{let e=oe.current;!e||!Q||!K||q.current&&(e.scrollTop=e.scrollHeight)},t[15]=Q,t[16]=K,t[17]=ve):ve=t[17];let ye;t[18]!==Q||t[19]!==J||t[20]!==K?(ye=[Q,J,K],t[18]=Q,t[19]=J,t[20]=K,t[21]=ye):ye=t[21],(0,N.useLayoutEffect)(ve,ye);let be;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(be=()=>{let e=oe.current;e&&(q.current=e.scrollHeight-e.scrollTop-e.clientHeight<=te)},t[22]=be):be=t[22];let xe=be,Se;t[23]!==m||t[24]!==a||t[25]!==o||t[26]!==k||t[27]!==ce||t[28]!==A||t[29]!==f||t[30]!==T?(Se=async e=>{G(`edit`),ae(!0),q.current=!0,await ce({intent:A,scenario:T,input:e,locale:f,field:{id:a,label:o,format:k},context:m})},t[23]=m,t[24]=a,t[25]=o,t[26]=k,t[27]=ce,t[28]=A,t[29]=f,t[30]=T,t[31]=Se):Se=t[31];let Ce=Se,we;t[32]!==le||t[33]!==n?(we=()=>{R(n),V(`preview`),U(``),G(`edit`),ae(!0),le(),I(!0)},t[32]=le,t[33]=n,t[34]=we):we=t[34];let Te=we,Ee;t[35]!==L||t[36]!==Ce?(Ee=async()=>{await Ce(L)},t[35]=L,t[36]=Ce,t[37]=Ee):Ee=t[37];let De=Ee,Oe;t[38]!==le||t[39]!==n?(Oe=()=>{I(!1),R(n),V(`preview`),U(``),G(`edit`),ae(!0),le()},t[38]=le,t[39]=n,t[40]=Oe):Oe=t[40];let $=Oe,ke;t[41]!==$||t[42]!==L||t[43]!==r?(ke=()=>{r(L),$()},t[41]=$,t[42]=L,t[43]=r,t[44]=ke):ke=t[44];let Ae=ke,je;t[45]!==$||t[46]!==H||t[47]!==r?(je=()=>{H.trim()&&(r(H),$())},t[45]=$,t[46]=H,t[47]=r,t[48]=je):je=t[48];let Me=je,Ne;t[49]!==$||t[50]!==L||t[51]!==H||t[52]!==r?(Ne=()=>{if(!H.trim())return;let e=L.trimEnd();r(e?`${e}\n\n${H}`:H),$()},t[49]=$,t[50]=L,t[51]=H,t[52]=r,t[53]=Ne):Ne=t[53];let Pe=Ne,Fe;t[54]!==H||t[55]!==X||t[56]!==Y?(Fe=!Y&&!X&&H.trim().length>0,t[54]=H,t[55]=X,t[56]=Y,t[57]=Fe):Fe=t[57];let Ie=Fe,Le=L!==n,Re;t[58]!==H||t[59]!==X||t[60]!==J?(Re=H.trim().length>0||J.trim().length>0||!!X,t[58]=H,t[59]=X,t[60]=J,t[61]=Re):Re=t[61];let ze=Re,Be=!M&&`size-7 p-0`,Ve;t[62]!==_||t[63]!==Be?(Ve=i(`h-7 gap-1 px-2 text-xs`,Be,_),t[62]=_,t[63]=Be,t[64]=Ve):Ve=t[64];let He=g||Y,Ue;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,z.jsx)(w,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[65]=Ue):Ue=t[65];let We=M?Z.buttonTitle:null,Ge;t[66]!==Z.buttonTitle||t[67]!==Te||t[68]!==Ve||t[69]!==He||t[70]!==We?(Ge=(0,z.jsxs)(d,{type:`button`,variant:`ghost`,className:Ve,title:Z.buttonTitle,"aria-label":Z.buttonTitle,disabled:He,onClick:Te,children:[Ue,We]}),t[66]=Z.buttonTitle,t[67]=Te,t[68]=Ve,t[69]=He,t[70]=We,t[71]=Ge):Ge=t[71];let Ke;t[72]===$?Ke=t[73]:(Ke=e=>e?I(!0):$(),t[72]=$,t[73]=Ke);let qe;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,z.jsx)(b,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[74]=qe):qe=t[74];let Je;t[75]===Z.title?Je=t[76]:(Je=(0,z.jsx)(h,{className:`text-base font-semibold text-fg`,children:Z.title}),t[75]=Z.title,t[76]=Je);let Ye;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,z.jsx)(O,{className:`size-5`,strokeWidth:1.75}),t[77]=Ye):Ye=t[77];let Xe;t[78]===Z.close?Xe=t[79]:(Xe=(0,z.jsx)(l,{asChild:!0,children:(0,z.jsx)(d,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":Z.close,children:Ye})}),t[78]=Z.close,t[79]=Xe);let Ze;t[80]!==Je||t[81]!==Xe?(Ze=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[Je,Xe]}),t[80]=Je,t[81]=Xe,t[82]=Ze):Ze=t[82];let Qe;t[83]===Z.current?Qe=t[84]:(Qe=(0,z.jsx)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:Z.current}),t[83]=Z.current,t[84]=Qe);let $e=B===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,et;t[85]===$e?et=t[86]:(et=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,$e),t[85]=$e,t[86]=et);let tt,nt;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(tt=()=>V(`edit`),nt=(0,z.jsx)(v,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[87]=tt,t[88]=nt):(tt=t[87],nt=t[88]);let rt;t[89]!==Z.edit||t[90]!==et?(rt=(0,z.jsxs)(`button`,{type:`button`,className:et,onClick:tt,children:[nt,Z.edit]}),t[89]=Z.edit,t[90]=et,t[91]=rt):rt=t[91];let it=B===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,at;t[92]===it?at=t[93]:(at=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,it),t[92]=it,t[93]=at);let ot,st;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(ot=()=>V(`preview`),st=(0,z.jsx)(D,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[94]=ot,t[95]=st):(ot=t[94],st=t[95]);let ct;t[96]!==Z.preview||t[97]!==at?(ct=(0,z.jsxs)(`button`,{type:`button`,className:at,onClick:ot,children:[st,Z.preview]}),t[96]=Z.preview,t[97]=at,t[98]=ct):ct=t[98];let lt;t[99]!==rt||t[100]!==ct?(lt=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[rt,ct]}),t[99]=rt,t[100]=ct,t[101]=lt):lt=t[101];let ut;t[102]!==Qe||t[103]!==lt?(ut=(0,z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[Qe,lt]}),t[102]=Qe,t[103]=lt,t[104]=ut):ut=t[104];let dt;t[105]!==L||t[106]!==B||t[107]!==k||t[108]!==Z.current||t[109]!==Z.empty?(dt=B===`preview`?(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:k===`markdown`?(0,z.jsx)(j,{content:L||Z.empty,compact:!0,className:`text-sm`}):(0,z.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:L||Z.empty})}):(0,z.jsx)(`textarea`,{className:`min-h-0 flex-1 resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25`,value:L,onChange:e=>R(e.currentTarget.value),placeholder:Z.empty,"aria-label":Z.current}),t[105]=L,t[106]=B,t[107]=k,t[108]=Z.current,t[109]=Z.empty,t[110]=dt):dt=t[110];let ft;t[111]!==ut||t[112]!==dt?(ft=(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[ut,dt]}),t[111]=ut,t[112]=dt,t[113]=ft):ft=t[113];let pt;t[114]===Z.editedSuggestion?pt=t[115]:(pt=(0,z.jsx)(`span`,{children:Z.editedSuggestion}),t[114]=Z.editedSuggestion,t[115]=pt);let mt;t[116]!==Z.loading||t[117]!==Y?(mt=Y?(0,z.jsx)(`span`,{className:`ml-2 font-normal`,children:Z.loading}):null,t[116]=Z.loading,t[117]=Y,t[118]=mt):mt=t[118];let ht;t[119]!==pt||t[120]!==mt?(ht=(0,z.jsxs)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:[pt,mt]}),t[119]=pt,t[120]=mt,t[121]=ht):ht=t[121];let gt=W===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,_t;t[122]===gt?_t=t[123]:(_t=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,gt),t[122]=gt,t[123]=_t);let vt,yt;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(vt=()=>G(`edit`),yt=(0,z.jsx)(v,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[124]=vt,t[125]=yt):(vt=t[124],yt=t[125]);let bt;t[126]!==Z.edit||t[127]!==_t?(bt=(0,z.jsxs)(`button`,{type:`button`,className:_t,onClick:vt,children:[yt,Z.edit]}),t[126]=Z.edit,t[127]=_t,t[128]=bt):bt=t[128];let xt=W===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,St;t[129]===xt?St=t[130]:(St=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,xt),t[129]=xt,t[130]=St);let Ct,wt;t[131]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=()=>G(`preview`),wt=(0,z.jsx)(D,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[131]=Ct,t[132]=wt):(Ct=t[131],wt=t[132]);let Tt;t[133]!==Z.preview||t[134]!==St?(Tt=(0,z.jsxs)(`button`,{type:`button`,className:St,onClick:Ct,children:[wt,Z.preview]}),t[133]=Z.preview,t[134]=St,t[135]=Tt):Tt=t[135];let Et;t[136]!==bt||t[137]!==Tt?(Et=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[bt,Tt]}),t[136]=bt,t[137]=Tt,t[138]=Et):Et=t[138];let Dt;t[139]!==ht||t[140]!==Et?(Dt=(0,z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[ht,Et]}),t[139]=ht,t[140]=Et,t[141]=Dt):Dt=t[141];let Ot=Q?`opacity-100`:`pointer-events-none opacity-0`,kt;t[142]===Ot?kt=t[143]:(kt=i(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Ot),t[142]=Ot,t[143]=kt);let At=!Q,jt;t[144]===Symbol.for(`react.memo_cache_sentinel`)?(jt=()=>ae(re),t[144]=jt):jt=t[144];let Mt;t[145]!==Z.thinkingLoading||t[146]!==Y?(Mt=Y?(0,z.jsxs)(`span`,{className:`ml-1 font-normal`,children:[`· `,Z.thinkingLoading]}):null,t[145]=Z.thinkingLoading,t[146]=Y,t[147]=Mt):Mt=t[147];let Nt;t[148]!==Z.thinking||t[149]!==Mt?(Nt=(0,z.jsxs)(`span`,{className:`min-w-0 truncate`,children:[Z.thinking,Mt]}),t[148]=Z.thinking,t[149]=Mt,t[150]=Nt):Nt=t[150];let Pt=K&&`rotate-180`,Ft;t[151]===Pt?Ft=t[152]:(Ft=i(`size-3.5 shrink-0 transition-transform`,Pt),t[151]=Pt,t[152]=Ft);let It;t[153]===Ft?It=t[154]:(It=(0,z.jsx)(E,{className:Ft,strokeWidth:1.75,"aria-hidden":!0}),t[153]=Ft,t[154]=It);let Lt;t[155]!==Nt||t[156]!==It?(Lt=(0,z.jsxs)(`button`,{type:`button`,className:`flex shrink-0 items-center justify-between gap-2 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:text-fg`,onClick:jt,children:[Nt,It]}),t[155]=Nt,t[156]=It,t[157]=Lt):Lt=t[157];let Rt;t[158]!==J||t[159]!==K?(Rt=K?(0,z.jsx)(`pre`,{ref:oe,className:`min-h-0 flex-1 overflow-auto border-t border-edge px-2.5 py-2 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,onScroll:xe,children:J}):null,t[158]=J,t[159]=K,t[160]=Rt):Rt=t[160];let zt;t[161]!==Lt||t[162]!==Rt?(zt=(0,z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col rounded-lg border border-edge bg-surface-muted/70`,children:[Lt,Rt]}),t[161]=Lt,t[162]=Rt,t[163]=zt):zt=t[163];let Bt;t[164]!==kt||t[165]!==At||t[166]!==zt?(Bt=(0,z.jsx)(`div`,{className:kt,"aria-hidden":At,children:zt}),t[164]=kt,t[165]=At,t[166]=zt,t[167]=Bt):Bt=t[167];let Vt=Q?`pointer-events-none opacity-0`:`opacity-100`,Ht;t[168]===Vt?Ht=t[169]:(Ht=i(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Vt),t[168]=Vt,t[169]=Ht);let Ut;t[170]!==H||t[171]!==X||t[172]!==k||t[173]!==Z.empty||t[174]!==Z.loading||t[175]!==Z.suggestion||t[176]!==Y||t[177]!==W?(Ut=X?(0,z.jsx)(`pre`,{className:`h-full min-h-0 overflow-auto whitespace-pre-wrap rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg-muted`,children:X}):W===`preview`?(0,z.jsx)(`div`,{className:`h-full min-h-0 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:Y&&!H.trim()?(0,z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Z.loading}):k===`markdown`?(0,z.jsx)(j,{content:H||Z.empty,compact:!0,className:`text-sm`}):(0,z.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:H||Z.empty})}):(0,z.jsx)(`textarea`,{className:`h-full min-h-0 w-full resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25 disabled:text-fg-muted`,value:H,onChange:e=>U(e.currentTarget.value),disabled:Y,placeholder:Y?Z.loading:Z.empty,"aria-label":Z.suggestion}),t[170]=H,t[171]=X,t[172]=k,t[173]=Z.empty,t[174]=Z.loading,t[175]=Z.suggestion,t[176]=Y,t[177]=W,t[178]=Ut):Ut=t[178];let Wt;t[179]!==Ht||t[180]!==Ut?(Wt=(0,z.jsx)(`div`,{className:Ht,children:Ut}),t[179]=Ht,t[180]=Ut,t[181]=Wt):Wt=t[181];let Gt;t[182]!==Bt||t[183]!==Wt?(Gt=(0,z.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[Bt,Wt]}),t[182]=Bt,t[183]=Wt,t[184]=Gt):Gt=t[184];let Kt;t[185]!==Dt||t[186]!==Gt?(Kt=(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[Dt,Gt]}),t[185]=Dt,t[186]=Gt,t[187]=Kt):Kt=t[187];let qt;t[188]!==ft||t[189]!==Kt?(qt=(0,z.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-3 overflow-hidden p-4 md:grid-cols-2`,children:[ft,Kt]}),t[188]=ft,t[189]=Kt,t[190]=qt):qt=t[190];let Jt;t[191]!==$||t[192]!==Z.cancel?(Jt=(0,z.jsx)(d,{type:`button`,variant:`secondary`,onClick:$,children:Z.cancel}),t[191]=$,t[192]=Z.cancel,t[193]=Jt):Jt=t[193];let Yt=!Le,Xt;t[194]!==Ae||t[195]!==Z.applyCurrent||t[196]!==Yt?(Xt=(0,z.jsx)(d,{type:`button`,variant:`secondary`,disabled:Yt,onClick:Ae,children:Z.applyCurrent}),t[194]=Ae,t[195]=Z.applyCurrent,t[196]=Yt,t[197]=Xt):Xt=t[197];let Zt;t[198]===De?Zt=t[199]:(Zt=()=>void De(),t[198]=De,t[199]=Zt);let Qt;t[200]===ze?Qt=t[201]:(Qt=ze?(0,z.jsx)(C,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}):(0,z.jsx)(w,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[200]=ze,t[201]=Qt);let $t=ze?Z.regenerate:Z.generate,en;t[202]!==Y||t[203]!==Zt||t[204]!==Qt||t[205]!==$t?(en=(0,z.jsxs)(d,{type:`button`,variant:`secondary`,disabled:Y,onClick:Zt,children:[Qt,$t]}),t[202]=Y,t[203]=Zt,t[204]=Qt,t[205]=$t,t[206]=en):en=t[206];let tn=!Ie,nn;t[207]!==Pe||t[208]!==Z.append||t[209]!==tn?(nn=(0,z.jsx)(d,{type:`button`,variant:`secondary`,disabled:tn,onClick:Pe,children:Z.append}),t[207]=Pe,t[208]=Z.append,t[209]=tn,t[210]=nn):nn=t[210];let rn=!Ie,an;t[211]!==Me||t[212]!==Z.replace||t[213]!==rn?(an=(0,z.jsx)(d,{type:`button`,variant:`primary`,disabled:rn,onClick:Me,children:Z.replace}),t[211]=Me,t[212]=Z.replace,t[213]=rn,t[214]=an):an=t[214];let on;t[215]!==Jt||t[216]!==Xt||t[217]!==en||t[218]!==nn||t[219]!==an?(on=(0,z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[Jt,Xt,en,nn,an]}),t[215]=Jt,t[216]=Xt,t[217]=en,t[218]=nn,t[219]=an,t[220]=on):on=t[220];let sn;t[221]!==Ze||t[222]!==qt||t[223]!==on?(sn=(0,z.jsxs)(S,{children:[qe,(0,z.jsx)(`div`,{className:`fixed inset-0 z-[80] flex items-center justify-center p-4 pointer-events-none`,children:(0,z.jsxs)(x,{className:`xopc-dialog-content-pane pointer-events-auto flex h-[min(78vh,38rem)] w-full max-w-4xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,onOpenAutoFocus:ie,children:[Ze,qt,on]})})]}),t[221]=Ze,t[222]=qt,t[223]=on,t[224]=sn):sn=t[224];let cn;t[225]!==F||t[226]!==Ke||t[227]!==sn?(cn=(0,z.jsx)(p,{open:F,onOpenChange:Ke,children:sn}),t[225]=F,t[226]=Ke,t[227]=sn,t[228]=cn):cn=t[228];let ln;return t[229]!==cn||t[230]!==Ge?(ln=(0,z.jsxs)(z.Fragment,{children:[Ge,cn]}),t[229]=cn,t[230]=Ge,t[231]=ln):ln=t[231],ln}function re(e){return!e}function ie(e){return e.preventDefault()}function V(e,t){return e[t]??t}function H(e){let t=(0,P.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,z.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,z.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,z.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function U(e){let t=(0,P.c)(34),{workflowName:n,language:r,argValues:o,onArgValuesChange:s,goal:c,onGoalChange:l,examplePrompts:u,showGoal:d,inputClassName:f,aiAssist:p}=e,m;t[0]===u?m=t[1]:(m=u===void 0?[]:u,t[0]=u,t[1]=m);let h=m,g=d===void 0?!0:d,v,b,x,S,C,w,T;if(t[2]!==p||t[3]!==o||t[4]!==h||t[5]!==c||t[6]!==f||t[7]!==r||t[8]!==s||t[9]!==l||t[10]!==g||t[11]!==n){x=a(r).workflows;let e=y[n]??[];b=e.length>0;let u=i(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,f),d;t[19]!==o||t[20]!==s||t[21]!==l?(d=e=>{_(e,l,e=>{s(e(o))})},t[19]=o,t[20]=s,t[21]=l,t[22]=d):d=t[22],v=d,S=`flex flex-col gap-3`,C=e.map(e=>{let t=V(x.args,e.labelKey),a=V(x.args,e.placeholderKey),c=o[e.key]??``;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[t,e.required?` *`:``]}),e.multiline&&p?(0,z.jsx)(B,{value:c,onApply:t=>s({...o,[e.key]:t}),fieldId:`workflow.arg.${e.key}`,fieldLabel:t,scenario:p.argScenario??`workflow.arg`,locale:r,context:{...p.context,workflowName:n,workflowArgs:o,fieldKey:e.key},disabled:p.disabled,showLabel:!1}):null]}),e.multiline?(0,z.jsx)(`textarea`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:i(u,`min-h-20 resize-y`)}):(0,z.jsx)(`input`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:u})]},e.key)}),w=b&&h.length>0?(0,z.jsx)(H,{examples:h,labels:x,onSelect:v}):null,T=g?(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:x.goalLabel}),p?(0,z.jsx)(B,{value:c,onApply:l,fieldId:`workflow.goal`,fieldLabel:x.goalLabel,scenario:p.goalScenario??`cron.workflowGoal`,locale:r,context:{...p.context,workflowName:n,workflowArgs:o},disabled:p.disabled,showLabel:!1}):null]}),(0,z.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),placeholder:x.goalPlaceholder,className:i(u,`min-h-20 resize-y`)})]}):null,t[2]=p,t[3]=o,t[4]=h,t[5]=c,t[6]=f,t[7]=r,t[8]=s,t[9]=l,t[10]=g,t[11]=n,t[12]=v,t[13]=b,t[14]=x,t[15]=S,t[16]=C,t[17]=w,t[18]=T}else v=t[12],b=t[13],x=t[14],S=t[15],C=t[16],w=t[17],T=t[18];let E;t[23]!==v||t[24]!==h||t[25]!==b||t[26]!==x?(E=!b&&h.length>0?(0,z.jsx)(H,{examples:h,labels:x,onSelect:v}):null,t[23]=v,t[24]=h,t[25]=b,t[26]=x,t[27]=E):E=t[27];let D;return t[28]!==S||t[29]!==C||t[30]!==w||t[31]!==T||t[32]!==E?(D=(0,z.jsxs)(`div`,{className:S,children:[C,w,T,E]}),t[28]=S,t[29]=C,t[30]=w,t[31]=T,t[32]=E,t[33]=D):D=t[33],D}var W=`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`;function G(e){return!!(e&&e.type===`object`&&e.properties&&!Array.isArray(e.properties))}function K({schema:e,value:t,onChange:n,labels:r,aiAssist:a,onValidChange:o}){let s=(0,N.useMemo)(()=>q(e),[e]),[c,l]=(0,N.useState)(!1),[u,d]=(0,N.useState)(()=>JSON.stringify(t,null,2)),[f,p]=(0,N.useState)(null);if(s.length===0)return null;let m=(e,r)=>{let i={...t,[e]:r};(r===``||r===void 0)&&delete i[e],n(i),c&&d(JSON.stringify(i,null,2))},h=e=>{d(e);try{let t=e.trim()?JSON.parse(e):{};if(!t||typeof t!=`object`||Array.isArray(t)){p(r.rawJsonInvalid),o?.(!1);return}p(null),n(t),o?.(!0,t)}catch{p(r.rawJsonInvalid),o?.(!1)}};return(0,z.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel/70 p-4 shadow-surface`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.inputSchemaHeading}),(0,z.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent-fg hover:underline`,onClick:()=>{let e=!c;l(e),e&&(d(JSON.stringify(t,null,2)),p(null),o?.(!0))},children:r.rawJson})]}),c?(0,z.jsxs)(`div`,{className:`mt-3`,children:[(0,z.jsx)(`textarea`,{value:u,onChange:e=>h(e.target.value),spellCheck:!1,className:i(W,`min-h-40 font-mono text-xs leading-5`)}),f?(0,z.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-300`,children:f}):null]}):(0,z.jsx)(`div`,{className:`mt-3 grid gap-3`,children:s.map(e=>(0,z.jsx)(ae,{field:e,value:t[e.key],labels:r,aiAssist:a,allValues:t,onChange:t=>m(e.key,t)},e.key))})]})}function ae(e){let t=(0,P.c)(30),{field:n,value:r,labels:a,aiAssist:o,allValues:s,onChange:c}=e,l=n.schema.title||n.key,u=typeof n.schema.description==`string`?n.schema.description:void 0,d=Array.isArray(n.schema.type)?n.schema.type[0]:n.schema.type,f;t[0]===n.schema.enum?f=t[1]:(f=Array.isArray(n.schema.enum)?n.schema.enum:[],t[0]=n.schema.enum,t[1]=f);let p=f,m=!!o&&!p.length&&(d===`string`||!d),h=String(l),g=n.required?` *`:``,_;t[2]!==h||t[3]!==g?(_=(0,z.jsxs)(`span`,{className:`text-xs font-medium text-fg`,children:[h,g]}),t[2]=h,t[3]=g,t[4]=_):_=t[4];let v;t[5]!==o||t[6]!==s||t[7]!==n.key||t[8]!==n.schema||t[9]!==c||t[10]!==m||t[11]!==l||t[12]!==r?(v=m&&o?(0,z.jsx)(B,{value:typeof r==`string`?r:r==null?``:String(r),onApply:c,fieldId:`workflow.schema.${n.key}`,fieldLabel:String(l),scenario:o.scenario??`workflow.arg`,locale:o.locale,context:{...o.context,fieldKey:n.key,fieldSchema:n.schema,inputValues:s},disabled:o.disabled,showLabel:!1}):null,t[5]=o,t[6]=s,t[7]=n.key,t[8]=n.schema,t[9]=c,t[10]=m,t[11]=l,t[12]=r,t[13]=v):v=t[13];let y;t[14]!==_||t[15]!==v?(y=(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[_,v]}),t[14]=_,t[15]=v,t[16]=y):y=t[16];let b;t[17]===u?b=t[18]:(b=u?(0,z.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-subtle`,children:u}):null,t[17]=u,t[18]=b);let x;t[19]!==u||t[20]!==p||t[21]!==a||t[22]!==c||t[23]!==d||t[24]!==r?(x=p.length>0?(0,z.jsxs)(M,{value:r==null?``:String(r),onChange:e=>c(e.target.value),className:W,children:[(0,z.jsx)(A,{value:``}),p.map(oe)]}):d===`boolean`?(0,z.jsxs)(M,{value:typeof r==`boolean`?String(r):``,onChange:e=>c(e.target.value===``?void 0:e.target.value===`true`),className:W,children:[(0,z.jsx)(A,{value:``}),(0,z.jsx)(A,{value:`true`,children:a.booleanTrue}),(0,z.jsx)(A,{value:`false`,children:a.booleanFalse})]}):d===`number`||d===`integer`?(0,z.jsx)(`input`,{type:`number`,value:typeof r==`number`||typeof r==`string`?String(r):``,onChange:e=>c(e.target.value===``?void 0:Number(e.target.value)),className:W}):(0,z.jsx)(`textarea`,{value:typeof r==`string`?r:r==null?``:String(r),onChange:e=>c(e.target.value),className:i(W,u&&u.length>80?`min-h-20 resize-y`:`min-h-10 resize-y`)}),t[19]=u,t[20]=p,t[21]=a,t[22]=c,t[23]=d,t[24]=r,t[25]=x):x=t[25];let S;return t[26]!==y||t[27]!==b||t[28]!==x?(S=(0,z.jsxs)(`div`,{className:`block`,children:[y,b,x]}),t[26]=y,t[27]=b,t[28]=x,t[29]=S):S=t[29],S}function oe(e){return(0,z.jsx)(A,{value:String(e),children:String(e)},String(e))}function q(e){let t=e.properties??{},n=new Set(e.required??[]);return Object.entries(t).map(([e,t])=>({key:e,schema:t,required:n.has(e)}))}function se(e,t){return!G(e)||!e?!0:q(e).every(e=>{if(!e.required)return!0;let n=t[e.key];return n==null?!1:typeof n==`string`?n.trim().length>0:!0})}function J(e){let t=(0,P.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,z.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,z.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,z.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function Y(e,t){if(e)return G(e.inputSchema)?Object.keys(t.schemaInput).length>0?t.schemaInput:void 0:u(t.argValues)}function X(e,t,n){let r=a(t).workflows;if(!e)return r.noInputSummary;let i=c(e,t);if(G(e.inputSchema)&&Object.keys(n.schemaInput).length>0)return Object.entries(n.schemaInput).map(([e,t])=>`${e}: ${String(t)}`).join(` · `);let o=Object.values(n.argValues).map(e=>e.trim()).filter(Boolean),s=n.goal.trim()||i.description;return s&&o.unshift(s),o.length>0?o.join(` · `):r.noInputSummary}function ce(e,t,n=!0){return e?n?G(e.inputSchema)?se(e.inputSchema,t.schemaInput)?{valid:!0}:{valid:!1,reason:`schema-required`}:{valid:(y[e.name]??[]).every(e=>!e.required||!!t.argValues[e.key]?.trim())}:{valid:!1,reason:`raw-json`}:{valid:!1}}function le(e){let t=(0,P.c)(114),{definition:n,language:r,value:o,onChange:s,aiAssist:l,inputClassName:u,onValidityChange:d}=e,f;t[0]===r?f=t[1]:(f=a(r),t[0]=r,t[1]=f);let p=f.workflows,m;t[2]!==n||t[3]!==r?(m=c(n,r),t[2]=n,t[3]=r,t[4]=m):m=t[4];let h=m,[g,_]=(0,N.useState)(!0),v;t[5]===h.examplePrompts?v=t[6]:(v=h.examplePrompts??[],t[5]=h.examplePrompts,t[6]=v);let y=v,b;t[7]===n.inputSchema?b=t[8]:(b=G(n.inputSchema),t[7]=n.inputSchema,t[8]=b);let x=b,S,C,w,T,E,D,O,k,A,j;if(t[9]!==l||t[10]!==n||t[11]!==y||t[12]!==x||t[13]!==u||t[14]!==p||t[15]!==r||t[16]!==h.description||t[17]!==s||t[18]!==d||t[19]!==g||t[20]!==o){E=Symbol.for(`react.early_return_sentinel`);bb0:{let e=i(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,u),a;t[31]!==n||t[32]!==s||t[33]!==d||t[34]!==g?(a=(e,t)=>{let r=t===void 0?g:t;s(e),d?.(ce(n,e,r))},t[31]=n,t[32]=s,t[33]=d,t[34]=g,t[35]=a):a=t[35];let c=a,f;t[36]!==c||t[37]!==o?(f=e=>c({...o,goal:e}),t[36]=c,t[37]=o,t[38]=f):f=t[38];let m=f,v;t[39]!==c||t[40]!==o?(v=e=>c({...o,schemaInput:e}),t[39]=c,t[40]=o,t[41]=v):v=t[41];let b=v,M;t[42]!==c||t[43]!==o?(M=e=>c({...o,argValues:e}),t[42]=c,t[43]=o,t[44]=M):M=t[44];let N=M,P;if(t[45]!==m||t[46]!==b||t[47]!==o.schemaInput?(P=e=>{if(e.field===`goal`){m(e.text);return}b({...o.schemaInput,[e.field]:e.text})},t[45]=m,t[46]=b,t[47]=o.schemaInput,t[48]=P):P=t[48],S=P,!x){let e;t[49]!==l||t[50]!==n.id||t[51]!==n.name||t[52]!==n.title||t[53]!==h.description?(e=l?{disabled:l.disabled,argScenario:l.inputScenario??`workflow.arg`,goalScenario:l.goalScenario??`workflow.goal`,context:{...l.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:h.description}}:void 0,t[49]=l,t[50]=n.id,t[51]=n.name,t[52]=n.title,t[53]=h.description,t[54]=e):e=t[54];let i;t[55]!==n.name||t[56]!==y||t[57]!==u||t[58]!==r||t[59]!==N||t[60]!==m||t[61]!==e||t[62]!==o.argValues||t[63]!==o.goal?(i=(0,z.jsx)(U,{workflowName:n.name,language:r,argValues:o.argValues,onArgValuesChange:N,goal:o.goal,onGoalChange:m,examplePrompts:y,inputClassName:u,aiAssist:e}),t[55]=n.name,t[56]=y,t[57]=u,t[58]=r,t[59]=N,t[60]=m,t[61]=e,t[62]=o.argValues,t[63]=o.goal,t[64]=i):i=t[64],E=i;break bb0}w=`flex flex-col gap-3`,t[65]!==l||t[66]!==n||t[67]!==p.booleanFalse||t[68]!==p.booleanTrue||t[69]!==p.inputSchemaHeading||t[70]!==p.rawJson||t[71]!==p.rawJsonInvalid||t[72]!==r||t[73]!==h.description||t[74]!==d||t[75]!==b||t[76]!==o?(T=n.inputSchema?(0,z.jsx)(K,{schema:n.inputSchema,value:o.schemaInput,onChange:b,onValidChange:(e,t)=>{_(e),d?.(ce(n,t?{...o,schemaInput:t}:o,e))},aiAssist:l?{locale:r,disabled:l.disabled,scenario:l.inputScenario??`workflow.arg`,context:{...l.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:h.description}}:void 0,labels:{inputSchemaHeading:p.inputSchemaHeading,rawJson:p.rawJson,rawJsonInvalid:p.rawJsonInvalid,booleanTrue:p.booleanTrue,booleanFalse:p.booleanFalse}}):null,t[65]=l,t[66]=n,t[67]=p.booleanFalse,t[68]=p.booleanTrue,t[69]=p.inputSchemaHeading,t[70]=p.rawJson,t[71]=p.rawJsonInvalid,t[72]=r,t[73]=h.description,t[74]=d,t[75]=b,t[76]=o,t[77]=T):T=t[77],j=`flex flex-col gap-1`;let F;t[78]===p.goalLabel?F=t[79]:(F=(0,z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:p.goalLabel}),t[78]=p.goalLabel,t[79]=F);let I;t[80]!==l||t[81]!==n.id||t[82]!==n.name||t[83]!==n.title||t[84]!==p.goalLabel||t[85]!==r||t[86]!==h.description||t[87]!==m||t[88]!==o.goal||t[89]!==o.schemaInput?(I=l?(0,z.jsx)(B,{value:o.goal,onApply:m,fieldId:`workflow.goal`,fieldLabel:p.goalLabel,scenario:l.goalScenario??`workflow.goal`,locale:r,context:{...l.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:h.description,workflowInput:o.schemaInput},disabled:l.disabled,showLabel:!1}):null,t[80]=l,t[81]=n.id,t[82]=n.name,t[83]=n.title,t[84]=p.goalLabel,t[85]=r,t[86]=h.description,t[87]=m,t[88]=o.goal,t[89]=o.schemaInput,t[90]=I):I=t[90],t[91]!==F||t[92]!==I?(C=(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[F,I]}),t[91]=F,t[92]=I,t[93]=C):C=t[93],D=o.goal,t[94]===m?O=t[95]:(O=e=>m(e.target.value),t[94]=m,t[95]=O),k=p.goalPlaceholder,A=i(e,`min-h-20 resize-y`)}t[9]=l,t[10]=n,t[11]=y,t[12]=x,t[13]=u,t[14]=p,t[15]=r,t[16]=h.description,t[17]=s,t[18]=d,t[19]=g,t[20]=o,t[21]=S,t[22]=C,t[23]=w,t[24]=T,t[25]=E,t[26]=D,t[27]=O,t[28]=k,t[29]=A,t[30]=j}else S=t[21],C=t[22],w=t[23],T=t[24],E=t[25],D=t[26],O=t[27],k=t[28],A=t[29],j=t[30];if(E!==Symbol.for(`react.early_return_sentinel`))return E;let M;t[96]!==D||t[97]!==O||t[98]!==k||t[99]!==A?(M=(0,z.jsx)(`textarea`,{value:D,onChange:O,placeholder:k,className:A}),t[96]=D,t[97]=O,t[98]=k,t[99]=A,t[100]=M):M=t[100];let F;t[101]!==C||t[102]!==M||t[103]!==j?(F=(0,z.jsxs)(`div`,{className:j,children:[C,M]}),t[101]=C,t[102]=M,t[103]=j,t[104]=F):F=t[104];let I;t[105]!==S||t[106]!==y||t[107]!==p?(I=(0,z.jsx)(J,{examples:y,labels:p,onSelect:S}),t[105]=S,t[106]=y,t[107]=p,t[108]=I):I=t[108];let L;return t[109]!==w||t[110]!==T||t[111]!==F||t[112]!==I?(L=(0,z.jsxs)(`div`,{className:w,children:[T,F,I]}),t[109]=w,t[110]=T,t[111]=F,t[112]=I,t[113]=L):L=t[113],L}function ue(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?g(t.agentScaleExact,{count:n.min}):g(t.agentScaleRange,{min:n.min,max:n.max}):g(t.agentScaleExact,{count:e.defaults.maxSubagents})}function Z(e){let t=(0,P.c)(41),{definition:n,language:r,value:o,onChange:s,mode:l,badgeLabel:u,aiAssist:d,inputClassName:p,showTimeout:h,defaultAdvancedOpen:_,onValidityChange:v}=e,y=h===void 0?!1:h,b=_===void 0?!1:_,x=a(r).workflows,[S,C]=(0,N.useState)(b),w;t[0]!==n||t[1]!==r?(w=c(n,r),t[0]=n,t[1]=r,t[2]=w):w=t[2];let D=w,O;t[3]!==n.defaults||t[4]!==o.concurrency?(O=o.concurrency.trim()?Number(o.concurrency):n.defaults.concurrency,t[3]=n.defaults,t[4]=o.concurrency,t[5]=O):O=t[5];let A=O,j;t[6]!==n.defaults||t[7]!==o.maxSubagents?(j=o.maxSubagents.trim()?Number(o.maxSubagents):n.defaults.maxSubagents,t[6]=n.defaults,t[7]=o.maxSubagents,t[8]=j):j=t[8];let M=j,F;t[9]!==n||t[10]!==r||t[11]!==o?(F=X(n,r,o),t[9]=n,t[10]=r,t[11]=o,t[12]=F):F=t[12];let I=F,L=u??x.readyToStart,R;t[13]!==s||t[14]!==o?(R=e=>s({...o,...e}),t[13]=s,t[14]=o,t[15]=R):R=t[15];let ee=R,te=l===`automation`&&`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,ne;t[16]===te?ne=t[17]:(ne=i(`space-y-4`,te),t[16]=te,t[17]=ne);let B=I||D.description,re;t[18]===B?re=t[19]:(re=(0,z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:B}),t[18]=B,t[19]=re);let ie;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,z.jsx)(T,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[20]=ie):ie=t[20];let V;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,z.jsx)(f,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[21]=V):V=t[21];let H;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,z.jsx)(k,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[22]=H):H=t[22];let U;t[23]!==s||t[24]!==o?(U=e=>s({...o,...e}),t[23]=s,t[24]=o,t[25]=U):U=t[25];let W;t[26]===v?W=t[27]:(W=e=>{v?.(e)},t[26]=v,t[27]=W);let G;t[28]!==d||t[29]!==n||t[30]!==p||t[31]!==r||t[32]!==U||t[33]!==W||t[34]!==o?(G=(0,z.jsx)(le,{definition:n,language:r,value:o,onChange:U,onValidityChange:W,aiAssist:d,inputClassName:p}),t[28]=d,t[29]=n,t[30]=p,t[31]=r,t[32]=U,t[33]=W,t[34]=o,t[35]=G):G=t[35];let K;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(K=()=>C(de),t[36]=K):K=t[36];let ae=x.advancedSettings,oe=S&&`rotate-180`,q;t[37]===oe?q=t[38]:(q=i(`size-4 transition-transform`,oe),t[37]=oe,t[38]=q);let se;return t[39]===q?se=t[40]:(se=(0,z.jsx)(E,{className:q}),t[39]=q,t[40]=se),(0,z.jsxs)(`div`,{className:ne,children:[(0,z.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:x.runPlanPreview}),re]}),(0,z.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent-soft px-2 py-1 text-[11px] font-medium text-accent-fg`,children:L})]}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-2 text-xs text-fg-muted sm:grid-cols-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[ie,(0,z.jsx)(`span`,{children:g(x.phaseCount,{count:n.phases.length})})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[V,(0,z.jsx)(`span`,{children:ue(n,x)})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[H,(0,z.jsx)(`span`,{children:g(x.runLimitsSummary,{concurrency:A,max:M})})]})]}),n.phases.length>0?(0,z.jsxs)(`div`,{className:`mt-4`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:[(0,z.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),x.startPlanPhases]}),(0,z.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:n.phases.map(Q)})]}):null]}),G,(0,z.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between px-3 py-2.5 text-left text-sm text-fg`,onClick:K,children:[ae,se]}),S?(0,z.jsxs)(`div`,{className:`grid gap-3 border-t border-edge px-3 pb-3 pt-3 sm:grid-cols-2`,children:[(0,z.jsx)(`input`,{value:o.concurrency,onChange:e=>ee({concurrency:e.target.value}),placeholder:g(x.concurrencyPlaceholder,{default:n.defaults.concurrency}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,z.jsx)(`input`,{value:o.maxSubagents,onChange:e=>ee({maxSubagents:e.target.value}),placeholder:g(x.maxSubagentsPlaceholder,{default:n.defaults.maxSubagents}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),y?(0,z.jsx)(`input`,{value:o.timeoutSeconds??``,onChange:e=>ee({timeoutSeconds:e.target.value}),placeholder:g(x.timeoutSecondsPlaceholder,{default:n.defaults.timeoutSec}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}):null]}):null]})]})}function de(e){return!e}function Q(e,t){return(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t>0?(0,z.jsx)(`span`,{className:`text-fg-subtle`,children:`→`}):null,(0,z.jsx)(`span`,{className:`rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1 text-[11px] text-fg-muted`,children:e.title})]},e.id)}export{B as a,V as i,Y as n,ce as r,Z as t};
|
|
@@ -0,0 +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-CQ_k8RHj.js";import{$ as a,Eo as o,Ga as s,Ha as c,Ka as l,Ua as u,Va as d,Wa as f}from"./index-DZOm5_ex.js";import{n as p,r as m,t as h}from"./workflow-run-setup-panel-D-Dy6mTy.js";var g=n(),_=e(t(),1),v=r();function y(e){let t=(0,g.c)(69),{open:n,definition:r,language:y,starting:b,onClose:x,onStart:S}=e,C;t[0]===y?C=t[1]:(C=i(y),t[0]=y,t[1]=C);let w=C.workflows,T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T={goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},t[2]=T):T=t[2];let[E,D]=(0,_.useState)(T),O;t[3]!==r||t[4]!==y?(O=r?a(r,y):null,t[3]=r,t[4]=y,t[5]=O):O=t[5];let k=O,A;t[6]!==r||t[7]!==E?(A=m(r,E),t[6]=r,t[7]=E,t[8]=A):A=t[8];let j=A,M;t[9]!==E.concurrency||t[10]!==E.maxSubagents?(M=[E.concurrency,E.maxSubagents].every(ee),t[9]=E.concurrency,t[10]=E.maxSubagents,t[11]=M):M=t[11];let te=M,N=j.valid&&te&&!b,P;t[12]!==r||t[13]!==n?(P=()=>{!n||!r||D({goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``})},t[12]=r,t[13]=n,t[14]=P):P=t[14];let F=r?.id,I;if(t[15]!==n||t[16]!==F?(I=[n,F],t[15]=n,t[16]=F,t[17]=I):I=t[17],(0,_.useEffect)(P,I),!r||!k)return null;let L;t[18]!==N||t[19]!==r||t[20]!==E||t[21]!==k.description||t[22]!==S?(L=()=>{if(!N)return;let e=p(r,E);S({goal:E.goal.trim()||k.description,input:e,concurrency:E.concurrency.trim()?Number(E.concurrency):void 0,maxSubagents:E.maxSubagents.trim()?Number(E.maxSubagents):void 0})},t[18]=N,t[19]=r,t[20]=E,t[21]=k.description,t[22]=S,t[23]=L):L=t[23];let R=L,z;t[24]===x?z=t[25]:(z=e=>!e&&x(),t[24]=x,t[25]=z);let B;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,v.jsx)(u,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),t[26]=B):B=t[26];let V;t[27]!==r.title||t[28]!==w.startTitle?(V=(0,v.jsxs)(l,{className:`text-base font-semibold text-fg`,children:[w.startTitle,` · `,r.title]}),t[27]=r.title,t[28]=w.startTitle,t[29]=V):V=t[29];let H;t[30]===k.description?H=t[31]:(H=(0,v.jsx)(c,{className:`mt-1 text-sm text-fg-muted`,children:k.description}),t[30]=k.description,t[31]=H);let U;t[32]!==V||t[33]!==H?(U=(0,v.jsxs)(`div`,{className:`border-b border-edge px-5 py-4`,children:[V,H]}),t[32]=V,t[33]=H,t[34]=U):U=t[34];let W;t[35]!==r.id||t[36]!==r.name||t[37]!==r.title||t[38]!==k.description?(W={context:{surface:`workflow-start`,workflowId:r.id,workflowName:r.name,workflowTitle:r.title,workflowDescription:k.description}},t[35]=r.id,t[36]=r.name,t[37]=r.title,t[38]=k.description,t[39]=W):W=t[39];let G;t[40]!==r||t[41]!==E||t[42]!==w.readyToStart||t[43]!==y||t[44]!==W?(G=(0,v.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-auto px-5 py-4`,children:(0,v.jsx)(h,{definition:r,language:y,value:E,onChange:D,mode:`manual`,badgeLabel:w.readyToStart,aiAssist:W})}),t[40]=r,t[41]=E,t[42]=w.readyToStart,t[43]=y,t[44]=W,t[45]=G):G=t[45];let K;t[46]!==N||t[47]!==w.inputRequiredHint?(K=N?null:(0,v.jsx)(`div`,{className:`mr-auto self-center text-xs text-fg-subtle`,children:w.inputRequiredHint}),t[46]=N,t[47]=w.inputRequiredHint,t[48]=K):K=t[48];let q;t[49]!==w.cancelDialog||t[50]!==x||t[51]!==b?(q=(0,v.jsx)(o,{variant:`secondary`,onClick:x,disabled:b,children:w.cancelDialog}),t[49]=w.cancelDialog,t[50]=x,t[51]=b,t[52]=q):q=t[52];let J=!N,Y=b?w.starting:w.start,X;t[53]!==R||t[54]!==J||t[55]!==Y?(X=(0,v.jsx)(o,{variant:`primary`,onClick:R,disabled:J,children:Y}),t[53]=R,t[54]=J,t[55]=Y,t[56]=X):X=t[56];let Z;t[57]!==K||t[58]!==q||t[59]!==X?(Z=(0,v.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[K,q,X]}),t[57]=K,t[58]=q,t[59]=X,t[60]=Z):Z=t[60];let Q;t[61]!==U||t[62]!==G||t[63]!==Z?(Q=(0,v.jsxs)(f,{children:[B,(0,v.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-66 flex max-h-[min(85vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[U,G,Z]})]}),t[61]=U,t[62]=G,t[63]=Z,t[64]=Q):Q=t[64];let $;return t[65]!==n||t[66]!==z||t[67]!==Q?($=(0,v.jsx)(s,{open:n,onOpenChange:z,children:Q}),t[65]=n,t[66]=z,t[67]=Q,t[68]=$):$=t[68],$}function ee(e){let t=e.trim();if(!t)return!0;let n=Number(t);return Number.isInteger(n)&&n>0}export{y as t};
|