@codexhost/cli-win32-x64 0.33.0 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/README.md +2 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +670 -116
  4. package/app/console-web.js +2032 -309
  5. package/app/desktop-controller.mjs +621 -74
  6. package/app/desktop-mcp-client.mjs +619 -0
  7. package/app/host-runtime.mjs +7134 -3865
  8. package/app/plugins/antigravity/plugin.mjs +1411 -121
  9. package/app/plugins/claude-code/plugin.mjs +527 -70
  10. package/app/plugins/codebuddy/plugin.mjs +592 -98
  11. package/app/plugins/codex-usage/plugin.mjs +659 -74
  12. package/app/plugins/copilot/plugin.mjs +527 -72
  13. package/app/plugins/cursor-cli/plugin.mjs +527 -70
  14. package/app/plugins/deepseek-harness/plugin.mjs +527 -70
  15. package/app/plugins/devin/plugin.mjs +527 -70
  16. package/app/plugins/enabled.json +1 -0
  17. package/app/plugins/grok/plugin.mjs +580 -92
  18. package/app/plugins/hermes/plugin.mjs +526 -69
  19. package/app/plugins/kimi-code/plugin.mjs +527 -70
  20. package/app/plugins/kiro-cli/plugin.mjs +527 -70
  21. package/app/plugins/omp/plugin.mjs +1338 -301
  22. package/app/plugins/opencode/plugin.mjs +527 -70
  23. package/app/plugins/pi/plugin.mjs +527 -70
  24. package/app/plugins/qoder/plugin.mjs +528 -71
  25. package/app/plugins/qoder-cn/plugin.mjs +528 -71
  26. package/app/plugins/qwen-code/plugin.mjs +526 -69
  27. package/app/plugins/workbuddy/plugin.mjs +1231 -546
  28. package/app/plugins/workbuddy-cn/assets/icon.svg +27 -0
  29. package/app/plugins/workbuddy-cn/manifest.json +32 -0
  30. package/app/plugins/workbuddy-cn/plugin.mjs +36524 -0
  31. package/app/plugins/zcode/plugin.mjs +528 -70
  32. package/app/renderer-extension.js +3898 -478
  33. package/app/web/assets/{abnfDiagram-XWFEHMT6-VnfRaHM6.js → abnfDiagram-XWFEHMT6-CGkBtBVj.js} +1 -1
  34. package/app/web/assets/{architectureDiagram-CSQXQB3N-BA1ehtvi.js → architectureDiagram-CSQXQB3N-Byv-cZeH.js} +1 -1
  35. package/app/web/assets/{blockDiagram-BEDRHYPZ-31BZSfd4.js → blockDiagram-BEDRHYPZ-DjLzUtwg.js} +1 -1
  36. package/app/web/assets/{c4Diagram-M2UUVUY5-CNzGWc5k.js → c4Diagram-M2UUVUY5-CJlsb6QO.js} +1 -1
  37. package/app/web/assets/{chunk-2Q5K7J3B-ahAIR-NM.js → chunk-2Q5K7J3B-CWm537bw.js} +1 -1
  38. package/app/web/assets/{chunk-3GCGMST5-BIV5YeRJ.js → chunk-3GCGMST5-NpcInIx4.js} +1 -1
  39. package/app/web/assets/{chunk-5VM5RSS4-CluTMPJG.js → chunk-5VM5RSS4-CeyyP0dm.js} +1 -1
  40. package/app/web/assets/{chunk-7U7NFRK5-4NIQuFbE.js → chunk-7U7NFRK5-Bto5OgbF.js} +1 -1
  41. package/app/web/assets/{chunk-CNRTWJTD-_0bEfGn3.js → chunk-CNRTWJTD-CuRMFCjT.js} +1 -1
  42. package/app/web/assets/{chunk-D5HYT7QG-_kTC6f8F.js → chunk-D5HYT7QG-DtQM1-2k.js} +1 -1
  43. package/app/web/assets/{chunk-EBZ3SEQC-CykaYOrL.js → chunk-EBZ3SEQC-DbUb3ZJ4.js} +2 -2
  44. package/app/web/assets/{chunk-JWPE2WC7-3vVOQ_py.js → chunk-JWPE2WC7-Dxh3d9Ag.js} +1 -1
  45. package/app/web/assets/{chunk-KTR4FSNJ-aVg5vgrm.js → chunk-KTR4FSNJ-BfwavXUO.js} +1 -1
  46. package/app/web/assets/{chunk-XXDRQBXY-_gVwGeSp.js → chunk-XXDRQBXY-CxR1flID.js} +1 -1
  47. package/app/web/assets/{classDiagram-v2-KXABOMEV-fI1LfeBf.js → classDiagram-v2-KXABOMEV-2WV2q_X2.js} +1 -1
  48. package/app/web/assets/{cose-bilkent-JH36ORCC-DFXMlWov.js → cose-bilkent-JH36ORCC-C-ENrCL_.js} +1 -1
  49. package/app/web/assets/{cynefin-EF2NZ3EQ-lZy7X6FO.js → cynefin-EF2NZ3EQ-Bg5LeTZO.js} +1 -1
  50. package/app/web/assets/{cynefinDiagram-NJNITYFG-N4DwFSW1.js → cynefinDiagram-NJNITYFG-CRAdbGGt.js} +1 -1
  51. package/app/web/assets/{dagre-KIHZ2IZ3-B7-8baTH.js → dagre-KIHZ2IZ3-dNHEvUqL.js} +1 -1
  52. package/app/web/assets/{diagram-7YQZDPLS-DLfjiBXV.js → diagram-7YQZDPLS-7F4O37o5.js} +1 -1
  53. package/app/web/assets/{diagram-QBROCOUO-CQnRzSTi.js → diagram-QBROCOUO-B-5KpeI2.js} +1 -1
  54. package/app/web/assets/{diagram-RJJCUUZO-DPnxazRT.js → diagram-RJJCUUZO-DqDsyDaL.js} +1 -1
  55. package/app/web/assets/{diagram-WERXNKYE-BBuEFRvD.js → diagram-WERXNKYE-f1oaPKos.js} +1 -1
  56. package/app/web/assets/{diagram-YHHI257C-BQ92JNJs.js → diagram-YHHI257C-DVMtl9Bt.js} +1 -1
  57. package/app/web/assets/{diagram-YR4HJLHV-Ce6BQO3J.js → diagram-YR4HJLHV-BWFCNFFF.js} +1 -1
  58. package/app/web/assets/{ebnfDiagram-N527522P-DYknE2Jy.js → ebnfDiagram-N527522P-B4N7d-Bi.js} +1 -1
  59. package/app/web/assets/{elk-O5DQBFGD-4S6_JJFF.js → elk-O5DQBFGD-DRdfF_UQ.js} +1 -1
  60. package/app/web/assets/{erDiagram-K3K3BIDK-DRtF7JVQ.js → erDiagram-K3K3BIDK-BW4-_5sZ.js} +1 -1
  61. package/app/web/assets/{flowDiagram-Z6JWZHQI-7Ho8CyR9.js → flowDiagram-Z6JWZHQI-DIQa5yEv.js} +1 -1
  62. package/app/web/assets/{ganttDiagram-3PRQTZWP-CW8Ig5y4.js → ganttDiagram-3PRQTZWP-JBK9PM7A.js} +1 -1
  63. package/app/web/assets/{gitGraphDiagram-VXDFKS5L-CzS8Xg2D.js → gitGraphDiagram-VXDFKS5L-TPI9Su0g.js} +1 -1
  64. package/app/web/assets/{grid-E2QIVN74-Cq284lCe.js → grid-E2QIVN74-DmHbunuP.js} +1 -1
  65. package/app/web/assets/index-BKDmniRf.js +209 -0
  66. package/app/web/assets/index-BPMnQdGr.css +1 -0
  67. package/app/web/assets/{infoDiagram-EZ3ZOAHP-BZgN6qlY.js → infoDiagram-EZ3ZOAHP-BeFwO9PI.js} +1 -1
  68. package/app/web/assets/{ishikawaDiagram-S3EKX5GW-BH9YHc-1.js → ishikawaDiagram-S3EKX5GW-BTbrKF_p.js} +1 -1
  69. package/app/web/assets/{journeyDiagram-POQNLL5X-D50KYOLe.js → journeyDiagram-POQNLL5X-DR0yWxJi.js} +1 -1
  70. package/app/web/assets/{kanban-definition-BH5XI6FM-Crw_5mMP.js → kanban-definition-BH5XI6FM-DMHrC9oV.js} +1 -1
  71. package/app/web/assets/{mermaid.core-o2Qjrppc.js → mermaid.core-Brmc1kJw.js} +4 -4
  72. package/app/web/assets/{mindmap-definition-WVAN44T4-B_bEbpAH.js → mindmap-definition-WVAN44T4-NT_XVwlI.js} +1 -1
  73. package/app/web/assets/{pegDiagram-D4NLKWP3-VecAHoyw.js → pegDiagram-D4NLKWP3-K67_THcc.js} +1 -1
  74. package/app/web/assets/{pieDiagram-36ENHN4W-o3ei2T-6.js → pieDiagram-36ENHN4W-GlTgKnTi.js} +1 -1
  75. package/app/web/assets/{quadrantDiagram-ZQUDMS73-DHndOAcn.js → quadrantDiagram-ZQUDMS73-yMEZ6-Nr.js} +1 -1
  76. package/app/web/assets/{railroadDiagram-JIZHGYPL-DRd_lfii.js → railroadDiagram-JIZHGYPL-MXCqwbuq.js} +1 -1
  77. package/app/web/assets/{render-VIF2ZAQL-awM3hUqB.js → render-VIF2ZAQL-BRUlhHPG.js} +2 -2
  78. package/app/web/assets/{requirementDiagram-AXW2TVFA-Ce1ePsOe.js → requirementDiagram-AXW2TVFA-Dqx4p0Bz.js} +1 -1
  79. package/app/web/assets/{sankeyDiagram-FBCJTAIF-cP-LtgW-.js → sankeyDiagram-FBCJTAIF-COp3IWvs.js} +1 -1
  80. package/app/web/assets/{sequenceDiagram-3LA2ROMG-C3JStTuW.js → sequenceDiagram-3LA2ROMG-j1xwrmp8.js} +1 -1
  81. package/app/web/assets/{sizeCapture-2Q2CQKSF-Dyyelr9K.js → sizeCapture-2Q2CQKSF-ZEXdxLeY.js} +1 -1
  82. package/app/web/assets/{stateDiagram-v2-ATKHQDJO-DkYRBVTd.js → stateDiagram-v2-ATKHQDJO-2pt2L-Zd.js} +1 -1
  83. package/app/web/assets/{swimlanes-YQL5WMAO-B2FwJU5_.js → swimlanes-YQL5WMAO-BHpgfPPd.js} +1 -1
  84. package/app/web/assets/swimlanesDiagram-UCCPES4V-BrYKheZO.js +8 -0
  85. package/app/web/assets/{timeline-definition-7Z437IG3-Di-qRIIi.js → timeline-definition-7Z437IG3-Cw4F_3FM.js} +1 -1
  86. package/app/web/assets/{usecaseDiagram-RDK6N6HP-yAImn62t.js → usecaseDiagram-RDK6N6HP-DefiMBIg.js} +1 -1
  87. package/app/web/assets/{vennDiagram-SHRQU5PJ-BEv8jpfv.js → vennDiagram-SHRQU5PJ-D30EMFrI.js} +1 -1
  88. package/app/web/assets/{wardleyDiagram-F3OXNVQS-7irksA0b.js → wardleyDiagram-F3OXNVQS-4ok25PKp.js} +1 -1
  89. package/app/web/assets/{xychartDiagram-GDYJKCDI-BokJGG2y.js → xychartDiagram-GDYJKCDI-BB0uAQX5.js} +1 -1
  90. package/app/web/codexhost-settings.js +429 -159
  91. package/app/web/index.html +2 -2
  92. package/app/web/plugins/deepseek-ai__dsh-api-gateway/client.js +1 -1
  93. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +63 -63
  94. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +70 -70
  95. package/app/web/plugins/deepseek-ai__dsh-client-file-upload/client.js +1 -1
  96. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +75 -75
  97. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +172 -77
  98. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +104 -100
  99. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +65 -65
  100. package/app/web/plugins/deepseek-ai__dsh-client-ui-session/client.js +1 -1
  101. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +5 -5
  102. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +6 -6
  103. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.pdf.js +1 -1
  104. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-right/client.js +62 -62
  105. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +72 -72
  106. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +70 -70
  107. package/app/web/plugins.json +1 -0
  108. package/app/web/role-avatars/builtin/advisor-otter.webp +0 -0
  109. package/app/web/role-avatars/builtin/builder-otter.webp +0 -0
  110. package/app/web/role-avatars/builtin/sailor-otter.webp +0 -0
  111. package/app/web/role-avatars/builtin/wizard-otter.webp +0 -0
  112. package/app/web-modules/server.mjs +7262 -2970
  113. package/bin/codexhost.exe +0 -0
  114. package/libexec/codexhost-node-repl.exe +0 -0
  115. package/libexec/codexhost-screenshot.exe +0 -0
  116. package/libexec/codexhost-shell.exe +0 -0
  117. package/libexec/codexhost-shim.exe +0 -0
  118. package/libexec/codexhost-updater.exe +0 -0
  119. package/package.json +1 -1
  120. package/app/web/assets/index-CINZ6P-q.css +0 -1
  121. package/app/web/assets/index-CvV6veuY.js +0 -208
  122. package/app/web/assets/swimlanesDiagram-UCCPES4V-BkMsxCPb.js +0 -8
@@ -1,6 +1,6 @@
1
- window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-ui-workspace`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});let r=e("@deepseek-ai/dsh-client-ui-primitives"),i=e("@deepseek-ai/dsh-client-store"),a=e("@deepseek-ai/cordis"),o=e("react/jsx-runtime"),s=e("react"),c=e("react-dom"),l=(e,t)=>()=>t;function u(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function d(e,t=`|`){return e.map(e=>le(e)).join(t)}function f(e,t){return typeof t==`bigint`?t.toString():t}var p=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function m(e){return new p(e)}function h(e){return e==null}function g(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function _(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}let v=/* @__PURE__*/ Symbol(`evaluating`);function y(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==v)return r===void 0&&(r=v,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function b(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function x(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function S(e){return x(e._zod.def)??e._zod.def.shape}function C(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return b(this,t,e),e},enumerable:!0,configurable:!0})}function w(e,t,n){t in e?b(e,t,n):e[t]=n}function T(e,t,n,r){let i=S(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?C(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):w(e,a,r?r(n.value,a):n.value))}}function E(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?C(e,n,()=>t[n]):w(e,n,r.value))}}function D(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ee(e){return JSON.stringify(e)}function te(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}let ne=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function re(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let ie=/* @__PURE__*/ m(()=>{if(Je.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ae(e){if(re(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return re(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function oe(e){return ae(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let se=/* @__PURE__*/ new Set([`string`,`number`,`symbol`]),O=/* @__PURE__*/ new Set([`string`,`number`,`bigint`,`boolean`,`symbol`,`undefined`]);function ce(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function k(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function A(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function le(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function ue(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}let j={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},de={int64:[/* @__PURE__*/ BigInt(`-9223372036854775808`),/* @__PURE__*/ BigInt(`9223372036854775807`)],uint64:[/* @__PURE__*/ BigInt(0),/* @__PURE__*/ BigInt(`18446744073709551615`)]};function M(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return T(i,e,fe(e,t)),k(e,D(n,{shape:i,checks:[]}))}function fe(e,t){let n=S(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function pe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(fe(e,t)),a={};return T(a,e,Reflect.ownKeys(S(e)).filter(e=>!i.has(e))),k(e,D(n,{shape:a,checks:[]}))}function me(e,t){if(!ae(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=S(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return k(e,D(e._zod.def,{shape:he(e,t)}))}function he(e,t){let n={};return T(n,e,Reflect.ownKeys(S(e))),E(n,t),n}function ge(e,t){if(!ae(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return k(e,D(e._zod.def,{shape:he(e,t)}))}function _e(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return T(n,e,Reflect.ownKeys(S(e))),T(n,t,Reflect.ownKeys(S(t))),k(e,D(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function ve(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(fe(t,n)):void 0,o={};return T(o,t,Reflect.ownKeys(S(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),k(t,D(t._zod.def,{shape:o,checks:[]}))}function ye(e,t,n){let r=n?new Set(fe(t,n)):void 0,i={};return T(i,t,Reflect.ownKeys(S(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),k(t,D(t._zod.def,{shape:i}))}function be(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function xe(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Se(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function N(e){return typeof e==`string`?e:e?.message}function Ce(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function we(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Te(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:N(e.inst?._zod.def?.error?.(e))??N(a?.(e))??N(t?.error?.(e))??N(n.customError?.(e))??N(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}let Ee=/[\uD800-\uDBFF]/;function De(e){let t=e.length;if(!Ee.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Oe(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function ke(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Ae(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function je(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Pe(e,n,r.value)}}function P(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Me(e,t,n){return P(e,t,n,!1)}function Ne(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return P(this,n,r(this))},set(e){P(this,n,e)}})}return t}function Pe(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:P(this,t,n.bind(this))},set(e){P(this,t,e)}})}function Fe(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let Ie,Le=!1,Re={configurable:!0,get(){Le=!0}};function F(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&Ie!==e._zod?Ie=void 0:(Ie=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Re);let e=Le;Le=!1;try{let r=n(this);return Le?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Le||=e,r}catch(n){throw delete this[t],Le||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function ze(e,t,n,r){let i=Fe(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}function Be(e){let t=()=>e;return t[`~constantCatch`]=!0,t}var Ve;let He=/*@__PURE__*/ Object.freeze({status:`aborted`}),Ue={value:void 0,enumerable:!1},We=`captureStackTrace`in Error?Error:null;function Ge(e){let t=We;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return We=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function I(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=/* @__PURE__ */ new Set}a.prototype=i;let o=n,s=o&&/* @__PURE__ */ new WeakSet;function c(n,r){if(!n._zod){Ue.value=new a(r);try{Object.defineProperty(n,"_zod",Ue)}finally{Ue.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),je(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Ge(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Ke=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},qe=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Ve=globalThis).__zod_globalConfig??(Ve.__zod_globalConfig={});let Je=globalThis.__zod_globalConfig;function Ye(e){return e&&Object.assign(Je,e),Je}function Xe(){let e=this._zod;return e.message??=JSON.stringify(e.def,f,2),e.message}function Ze(e){this._zod.message=e}let Qe={get:Xe,set:Ze,enumerable:!0,configurable:!0},L={value:void 0,enumerable:!1},$e=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]),et=(e,t)=>{e.name=`$ZodError`,L.value=t,Object.defineProperty(e,"issues",L),L.value=void 0,Object.defineProperty(e,"message",Qe);let n=Object.getPrototypeOf(e);$e.has(n)||($e.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},tt=I(`$ZodError`,et);I(`$ZodError`,et,void 0,{Parent:Error});function nt(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function rt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?nt(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function it(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function at(e,t){return{callee:t?.callee??e,Err:t?.Err}}let ot=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Ke;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Te(e,o,Ye())));throw ne(n,a?.callee??t),n}return s.value};return t},st=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Te(e,o,Ye())));throw ne(n,a?.callee??t),n}return s.value};return t},ct=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Ke;return a.issues.length?lt(e,a.issues,i):{success:!0,data:a.value}};function lt(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Te(e,n,Ye()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}let ut=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?lt(e,a.issues,i):{success:!0,data:a.value}},dt=/* @__PURE__ */ Symbol.for(`zod.compile.invalid`),ft=/* @__PURE__ */ Symbol.for(`zod.compile.fallback`),pt=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==dt)return!0;if(r.definite===!0&&n===void 0)return!1}return mt(e,t,n)});function mt(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[ft]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new Ke;return a.issues.length===0}let ht=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},gt=e=>{let t=ot(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,at(n,a))};return n},_t=e=>{let t=ot(e),n=(e,r,i,a)=>t(e,r,i,at(n,a));return n},vt=e=>{let t=st(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,at(n,a))};return n},yt=e=>{let t=st(e),n=async(e,r,i,a)=>await t(e,r,i,at(n,a));return n},bt=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ct(e)(t,n,i)},xt=e=>(t,n,r)=>ct(e)(t,n,r),St=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ut(e)(t,n,i)},Ct=e=>async(t,n,r)=>ut(e)(t,n,r),wt=/^[cC][0-9a-z]{6,}$/,Tt=/^[0-9a-z]+$/,Et=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Dt=/^[0-9a-vA-V]{20}$/,Ot=/^[A-Za-z0-9]{27}$/,kt=/^[a-zA-Z0-9_-]{21}$/;function At(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}let jt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Mt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Nt=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Pt=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Ft(){return RegExp(`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,`u`)}let It=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Lt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Rt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,zt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Bt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Vt=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Ht=/^https?$/,Ut=/^\+[1-9]\d{6,14}$/,Wt=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Gt(e){return RegExp(`^${e}$`)}let Kt=/*@__PURE__*/ Gt(Wt);function qt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Jt(e){return RegExp(`^${qt(e)}$`)}function Yt(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${qt({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${qt({precision:e.precision})}`:n;return RegExp(`^${Wt}T(?:${r})$`)}let Xt=/^[\s\S]{0,}$/,Zt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Qt=/^-?\d+$/,$t=/^-?\d+(?:\.\d+)?$/,en=/^(?:true|false)$/i,tn=/^null$/i,nn=/^[^A-Z]*$/,rn=/^[^a-z]*$/,an=/*@__PURE__*/ I(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),on=e=>{let t=e.value;return!h(t)&&t.length!==void 0},sn={number:`number`,bigint:`bigint`,object:`date`},cn=/*@__PURE__*/ I(`$ZodCheckLessThan`,(e,t)=>{an.init(e,t);let n=sn[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:sn[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ln=/*@__PURE__*/ I(`$ZodCheckGreaterThan`,(e,t)=>{an.init(e,t);let n=sn[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:sn[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),un=/*@__PURE__*/ I(`$ZodCheckMultipleOf`,(e,t)=>{an.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):_(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),dn=/*@__PURE__*/ I(`$ZodCheckNumberFormat`,(e,t)=>{an.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=j[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),fn=/*@__PURE__*/ I(`$ZodCheckMaxLength`,(e,t)=>{var n;an.init(e,t),(n=e._zod.def).when??(n.when=on),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?De(r):i)<=t.maximum)return;let a=Oe(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),pn=/*@__PURE__*/ I(`$ZodCheckMinLength`,(e,t)=>{var n;an.init(e,t),(n=e._zod.def).when??(n.when=on),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?De(r):i)>=t.minimum)return;let a=Oe(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),mn=/*@__PURE__*/ I(`$ZodCheckLengthEquals`,(e,t)=>{var n;an.init(e,t),(n=e._zod.def).when??(n.when=on),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?De(r):i;if(a===t.length)return;let o=Oe(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),hn=/*@__PURE__*/ I(`$ZodCheckStringFormat`,(e,t)=>{var n,r;an.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),gn=/*@__PURE__*/ I(`$ZodCheckRegex`,(e,t)=>{hn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),_n=/*@__PURE__*/ I(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=nn,hn.init(e,t)}),vn=/*@__PURE__*/ I(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=rn,hn.init(e,t)}),yn=/*@__PURE__*/ I(`$ZodCheckIncludes`,(e,t)=>{an.init(e,t);let n=ce(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),bn=/*@__PURE__*/ I(`$ZodCheckStartsWith`,(e,t)=>{an.init(e,t);let n=RegExp(`^${ce(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),xn=/*@__PURE__*/ I(`$ZodCheckEndsWith`,(e,t)=>{an.init(e,t);let n=RegExp(`.*${ce(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Sn=/*@__PURE__*/ I(`$ZodCheckOverwrite`,(e,t)=>{an.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Cn=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
1
+ window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-ui-workspace`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});let r=e("@deepseek-ai/dsh-client-ui-primitives"),i=e("@deepseek-ai/dsh-client-store"),a=e("@deepseek-ai/cordis"),o=e("react/jsx-runtime"),s=e("react"),c=e("react-dom"),l=(e,t)=>()=>t;function u(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function d(e,t=`|`){return e.map(e=>ce(e)).join(t)}function f(e,t){return typeof t==`bigint`?t.toString():t}var p=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function m(e){return new p(e)}function h(e){return e==null}function g(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function _(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function v(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function y(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function b(e){return y(e._zod.def)??e._zod.def.shape}function x(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return v(this,t,e),e},enumerable:!0,configurable:!0})}function S(e,t,n){t in e?v(e,t,n):e[t]=n}function C(e,t,n,r){let i=b(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?x(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):S(e,a,r?r(n.value,a):n.value))}}function w(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?x(e,n,()=>t[n]):S(e,n,r.value))}}function T(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function E(e){return JSON.stringify(e)}function D(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}let ee=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function te(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let ne=/* @__PURE__*/ m(()=>{if(Ke.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function re(e){if(te(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return te(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ie(e){return re(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let ae=/* @__PURE__*/ new Set([`string`,`number`,`symbol`]),oe=/* @__PURE__*/ new Set([`string`,`number`,`bigint`,`boolean`,`symbol`,`undefined`]);function se(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function O(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function k(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ce(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function le(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}let ue={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},de={int64:[/* @__PURE__*/ BigInt(`-9223372036854775808`),/* @__PURE__*/ BigInt(`9223372036854775807`)],uint64:[/* @__PURE__*/ BigInt(0),/* @__PURE__*/ BigInt(`18446744073709551615`)]};function A(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return C(i,e,fe(e,t)),O(e,T(n,{shape:i,checks:[]}))}function fe(e,t){let n=b(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function j(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(fe(e,t)),a={};return C(a,e,Reflect.ownKeys(b(e)).filter(e=>!i.has(e))),O(e,T(n,{shape:a,checks:[]}))}function pe(e,t){if(!re(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=b(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return O(e,T(e._zod.def,{shape:me(e,t)}))}function me(e,t){let n={};return C(n,e,Reflect.ownKeys(b(e))),w(n,t),n}function he(e,t){if(!re(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return O(e,T(e._zod.def,{shape:me(e,t)}))}function ge(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return C(n,e,Reflect.ownKeys(b(e))),C(n,t,Reflect.ownKeys(b(t))),O(e,T(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function _e(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(fe(t,n)):void 0,o={};return C(o,t,Reflect.ownKeys(b(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),O(t,T(t._zod.def,{shape:o,checks:[]}))}function ve(e,t,n){let r=n?new Set(fe(t,n)):void 0,i={};return C(i,t,Reflect.ownKeys(b(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),O(t,T(t._zod.def,{shape:i}))}function ye(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function be(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function xe(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Se(e){return typeof e==`string`?e:e?.message}function Ce(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function M(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function we(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Se(e.inst?._zod.def?.error?.(e))??Se(a?.(e))??Se(t?.error?.(e))??Se(n.customError?.(e))??Se(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}let Te=/[\uD800-\uDBFF]/;function Ee(e){let t=e.length;if(!Te.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function De(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Oe(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function ke(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Ae(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Ne(e,n,r.value)}}function je(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Me(e,t,n){return je(e,t,n,!1)}function N(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return je(this,n,r(this))},set(e){je(this,n,e)}})}return t}function Ne(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:je(this,t,n.bind(this))},set(e){je(this,t,e)}})}function Pe(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let Fe,Ie=!1,Le={configurable:!0,get(){Ie=!0}};function P(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&Fe!==e._zod?Fe=void 0:(Fe=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Le);let e=Ie;Ie=!1;try{let r=n(this);return Ie?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Ie||=e,r}catch(n){throw delete this[t],Ie||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function Re(e,t,n,r){let i=Pe(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}function ze(e){let t=()=>e;return t[`~constantCatch`]=!0,t}var Be;let Ve=/*@__PURE__*/ Object.freeze({status:`aborted`}),F={value:void 0,enumerable:!1},He=`captureStackTrace`in Error?Error:null;function Ue(e){let t=He;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return He=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function I(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=/* @__PURE__ */ new Set}a.prototype=i;let o=n,s=o&&/* @__PURE__ */ new WeakSet;function c(n,r){if(!n._zod){F.value=new a(r);try{Object.defineProperty(n,"_zod",F)}finally{F.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Ae(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Ue(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var We=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ge=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Be=globalThis).__zod_globalConfig??(Be.__zod_globalConfig={});let Ke=globalThis.__zod_globalConfig;function qe(e){return e&&Object.assign(Ke,e),Ke}function Je(){let e=this._zod;return e.message??=JSON.stringify(e.def,f,2),e.message}function Ye(e){this._zod.message=e}let Xe={get:Je,set:Ye,enumerable:!0,configurable:!0},Ze={value:void 0,enumerable:!1},Qe=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]),L=(e,t)=>{e.name=`$ZodError`,Ze.value=t,Object.defineProperty(e,"issues",Ze),Ze.value=void 0,Object.defineProperty(e,"message",Xe);let n=Object.getPrototypeOf(e);Qe.has(n)||(Qe.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},$e=I(`$ZodError`,L);I(`$ZodError`,L,void 0,{Parent:Error});function et(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function tt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?et(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function nt(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function rt(e,t){return{callee:t?.callee??e,Err:t?.Err}}let it=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new We;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>we(e,o,qe())));throw ee(n,a?.callee??t),n}return s.value};return t},at=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>we(e,o,qe())));throw ee(n,a?.callee??t),n}return s.value};return t},ot=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new We;return a.issues.length?st(e,a.issues,i):{success:!0,data:a.value}};function st(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>we(e,n,qe()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}let ct=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?st(e,a.issues,i):{success:!0,data:a.value}},lt=/* @__PURE__ */ Symbol.for(`zod.compile.invalid`),ut=/* @__PURE__ */ Symbol.for(`zod.compile.fallback`),dt=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==lt)return!0;if(r.definite===!0&&n===void 0)return!1}return ft(e,t,n)});function ft(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[ut]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new We;return a.issues.length===0}let pt=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},mt=e=>{let t=it(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,rt(n,a))};return n},ht=e=>{let t=it(e),n=(e,r,i,a)=>t(e,r,i,rt(n,a));return n},gt=e=>{let t=at(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,rt(n,a))};return n},_t=e=>{let t=at(e),n=async(e,r,i,a)=>await t(e,r,i,rt(n,a));return n},vt=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ot(e)(t,n,i)},yt=e=>(t,n,r)=>ot(e)(t,n,r),bt=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ct(e)(t,n,i)},xt=e=>async(t,n,r)=>ct(e)(t,n,r),St=/^[cC][0-9a-z]{6,}$/,Ct=/^[0-9a-z]+$/,wt=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Tt=/^[0-9a-vA-V]{20}$/,Et=/^[A-Za-z0-9]{27}$/,Dt=/^[a-zA-Z0-9_-]{21}$/;function Ot(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}let kt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,At=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,jt=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Mt=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Nt(){return RegExp(`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,`u`)}let Pt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ft=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,R=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,It=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Lt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Rt=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,zt=/^https?$/,Bt=/^\+[1-9]\d{6,14}$/,Vt=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Ht(e){return RegExp(`^${e}$`)}let Ut=/*@__PURE__*/ Ht(Vt);function Wt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Gt(e){return RegExp(`^${Wt(e)}$`)}function Kt(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Wt({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Wt({precision:e.precision})}`:n;return RegExp(`^${Vt}T(?:${r})$`)}let qt=/^[\s\S]{0,}$/,Jt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Yt=/^-?\d+$/,Xt=/^-?\d+(?:\.\d+)?$/,Zt=/^(?:true|false)$/i,Qt=/^null$/i,$t=/^[^A-Z]*$/,en=/^[^a-z]*$/,tn=/*@__PURE__*/ I(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),nn=e=>{let t=e.value;return!h(t)&&t.length!==void 0},rn={number:`number`,bigint:`bigint`,object:`date`},an=/*@__PURE__*/ I(`$ZodCheckLessThan`,(e,t)=>{tn.init(e,t);let n=rn[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:rn[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),on=/*@__PURE__*/ I(`$ZodCheckGreaterThan`,(e,t)=>{tn.init(e,t);let n=rn[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:rn[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),sn=/*@__PURE__*/ I(`$ZodCheckMultipleOf`,(e,t)=>{tn.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):_(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),cn=/*@__PURE__*/ I(`$ZodCheckNumberFormat`,(e,t)=>{tn.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ue[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),ln=/*@__PURE__*/ I(`$ZodCheckMaxLength`,(e,t)=>{var n;tn.init(e,t),(n=e._zod.def).when??(n.when=nn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Ee(r):i)<=t.maximum)return;let a=De(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),un=/*@__PURE__*/ I(`$ZodCheckMinLength`,(e,t)=>{var n;tn.init(e,t),(n=e._zod.def).when??(n.when=nn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Ee(r):i)>=t.minimum)return;let a=De(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),dn=/*@__PURE__*/ I(`$ZodCheckLengthEquals`,(e,t)=>{var n;tn.init(e,t),(n=e._zod.def).when??(n.when=nn),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Ee(r):i;if(a===t.length)return;let o=De(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),fn=/*@__PURE__*/ I(`$ZodCheckStringFormat`,(e,t)=>{var n,r;tn.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),pn=/*@__PURE__*/ I(`$ZodCheckRegex`,(e,t)=>{fn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),mn=/*@__PURE__*/ I(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=$t,fn.init(e,t)}),hn=/*@__PURE__*/ I(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=en,fn.init(e,t)}),gn=/*@__PURE__*/ I(`$ZodCheckIncludes`,(e,t)=>{tn.init(e,t);let n=se(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),_n=/*@__PURE__*/ I(`$ZodCheckStartsWith`,(e,t)=>{tn.init(e,t);let n=RegExp(`^${se(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),vn=/*@__PURE__*/ I(`$ZodCheckEndsWith`,(e,t)=>{tn.init(e,t);let n=RegExp(`.*${se(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),yn=/*@__PURE__*/ I(`$ZodCheckOverwrite`,(e,t)=>{tn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var bn=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
2
2
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
3
- `)}\n};`)(...Object.values(this.closed))}};let wn={major:4,minor:6,patch:7},Tn=/*@__PURE__*/ I(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=wn;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=be(t),a;for(let o of n){if(o._zod.def.when){if(xe(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new Ke;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(we(t.issues,n,e),i||=be(t,n))});else{if(t.issues.length===n)continue;we(t.issues,n,e),i||=be(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(be(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Ke;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new Ke;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Me(this,`~standard`,On(this))},set"~standard"(e){P(this,`~standard`,e)}}),En=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Te(e,t,Ye()))}:{value:e.value};async function Dn(e,t){let n={async:!0};return En(await e._zod.run({value:t,issues:[]},n),n)}function On(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return En(r,n)}catch{}return Dn(e,t)},vendor:`zod`,version:1}}let kn=/*@__PURE__*/ I(`$ZodString`,(e,t)=>{Tn.init(e,t),e._zod.pattern=t.pattern??Xt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),An=/*@__PURE__*/ I(`$ZodStringFormat`,(e,t)=>{hn.init(e,t),kn.init(e,t)}),jn=/*@__PURE__*/ I(`$ZodGUID`,(e,t)=>{t.pattern??=Mt,An.init(e,t)}),Mn=/*@__PURE__*/ I(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Nt(e)}else t.pattern??=Nt();An.init(e,t)}),Nn=/*@__PURE__*/ I(`$ZodEmail`,(e,t)=>{t.pattern??=Pt,An.init(e,t)});function Pn(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Fn(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Pn(e)||2:In(e,t)}function In(e,t){if(!t.normalize&&t.protocol?.source===Ht.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}let Ln=/[\t\n\r]/g;function Rn(e){return e.replace(Ln,``)}function zn(e,t){return t.lastIndex=0,t.test(e.hostname)}function Bn(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}let Vn=/*@__PURE__*/ I(`$ZodURL`,(e,t)=>{An.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Fn(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Rn(r);return}t.hostname&&!zn(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Bn(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Rn(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Hn=/*@__PURE__*/ I(`$ZodEmoji`,(e,t)=>{t.pattern??=Ft(),An.init(e,t)}),Un=/*@__PURE__*/ I(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?kt:At(t.length),An.init(e,t)}),Wn=/*@__PURE__*/ I(`$ZodCUID`,(e,t)=>{t.pattern??=wt,An.init(e,t)}),Gn=/*@__PURE__*/ I(`$ZodCUID2`,(e,t)=>{t.pattern??=Tt,An.init(e,t)}),Kn=/*@__PURE__*/ I(`$ZodULID`,(e,t)=>{t.pattern??=Et,An.init(e,t)}),qn=/*@__PURE__*/ I(`$ZodXID`,(e,t)=>{t.pattern??=Dt,An.init(e,t)}),Jn=/*@__PURE__*/ I(`$ZodKSUID`,(e,t)=>{t.pattern??=Ot,An.init(e,t)}),Yn=/*@__PURE__*/ I(`$ZodISODateTime`,(e,t)=>{t.pattern??=Yt(t),An.init(e,t)}),Xn=/*@__PURE__*/ I(`$ZodISODate`,(e,t)=>{t.pattern??=Kt,An.init(e,t)}),Zn=/*@__PURE__*/ I(`$ZodISOTime`,(e,t)=>{t.pattern??=Jt(t),An.init(e,t)}),Qn=/*@__PURE__*/ I(`$ZodISODuration`,(e,t)=>{t.pattern??=jt,An.init(e,t)}),$n=/*@__PURE__*/ I(`$ZodIPv4`,(e,t)=>{t.pattern??=It,An.init(e,t)}),er=/^[0-9a-fA-F:.]+$/;function tr(e){return er.test(e)?Pn(`http://[${e}]`):!1}let nr=/*@__PURE__*/ I(`$ZodIPv6`,(e,t)=>{t.pattern??=Lt,An.init(e,t),e._zod.check=n=>{tr(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),rr=/*@__PURE__*/ I(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Rt,An.init(e,t)});function ir(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:tr(n)}let ar=/*@__PURE__*/ I(`$ZodCIDRv6`,(e,t)=>{t.pattern??=zt,An.init(e,t),e._zod.check=n=>{ir(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function or(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let sr=/^[0-9a-zA-Z+/]*={0,2}$/,cr=/*@__PURE__*/ I(`$ZodBase64`,(e,t)=>{t.pattern??=sr,An.init(e,t),e._zod.check=n=>{or(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),lr=/^[A-Za-z0-9_-]*$/;function ur(e){if(!lr.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return or(t.padEnd(Math.ceil(t.length/4)*4,`=`))}let dr=/*@__PURE__*/ I(`$ZodBase64URL`,(e,t)=>{t.pattern??=lr,An.init(e,t),e._zod.check=n=>{ur(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),fr=/*@__PURE__*/ I(`$ZodE164`,(e,t)=>{t.pattern??=Ut,An.init(e,t)});function pr(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}let mr=/*@__PURE__*/ I(`$ZodJWT`,(e,t)=>{An.init(e,t),e._zod.check=n=>{pr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),hr=/*@__PURE__*/ I(`$ZodNumber`,(e,t)=>{Tn.init(e,t),e._zod.pattern=$t,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),gr=/*@__PURE__*/ I(`$ZodNumberFormat`,(e,t)=>{dn.init(e,t),hr.init(e,t)}),_r=/*@__PURE__*/ I(`$ZodBoolean`,(e,t)=>{Tn.init(e,t),e._zod.pattern=en,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),vr=/*@__PURE__*/ I(`$ZodNull`,(e,t)=>{Tn.init(e,t),e._zod.pattern=tn,e._zod.values=/* @__PURE__ */ new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),yr=/*@__PURE__*/ I(`$ZodUnknown`,(e,t)=>{Tn.init(e,t),e._zod.parse=e=>e}),br=/*@__PURE__*/ I(`$ZodNever`,(e,t)=>{Tn.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function xr(e,t){let n=Ce(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of Ce(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,we(n.issues,t,e),n}}return i(n,a)}}let Sr=e=>Array.isArray(e)?e.length:-1;function Cr(e,t,n){e.issues.length&&t.issues.push(...Se(n,e.issues)),t.value[n]=e.value}let wr=/*@__PURE__*/ I(`$ZodArray`,(e,t)=>{Tn.init(e,t);let n=Je.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Cr(t,r,e)));else if(Cr(c,r,e),s&&c.issues.length!==0&&be(c))break}return o.length?Promise.all(o).then(()=>r):r},xr(e,Sr)});function Tr(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...Se(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}let Er=[];function Dr(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Er,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=ue(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Or(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(be(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Tr(e,n,i,t,d,f))):Tr(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}let kr=/*@__PURE__*/ I(`$ZodObject`,(e,t)=>{Tn.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=m(()=>Dr(t));F(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||b(n,e,/* @__PURE__ */ new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=re,o=t.catchall,s,c=Je.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(be(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Tr(n,t,e,r,a,o))):Tr(s,t,e,r,a,o)}return o?Or(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Ar=/*@__PURE__*/ I(`$ZodObjectJIT`,(e,t)=>{kr.init(e,t);let n=e._zod.parse,r=m(()=>Dr(t)),i=Je.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Cn([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
3
+ `)}\n};`)(...Object.values(this.closed))}};let xn={major:4,minor:6,patch:7},Sn=/*@__PURE__*/ I(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=xn;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=ye(t),a;for(let o of n){if(o._zod.def.when){if(be(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new We;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(M(t.issues,n,e),i||=ye(t,n))});else{if(t.issues.length===n)continue;M(t.issues,n,e),i||=ye(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(ye(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new We;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new We;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Me(this,`~standard`,Tn(this))},set"~standard"(e){je(this,`~standard`,e)}}),Cn=(e,t)=>e.issues.length?{issues:e.issues.map(e=>we(e,t,qe()))}:{value:e.value};async function wn(e,t){let n={async:!0};return Cn(await e._zod.run({value:t,issues:[]},n),n)}function Tn(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Cn(r,n)}catch{}return wn(e,t)},vendor:`zod`,version:1}}let En=/*@__PURE__*/ I(`$ZodString`,(e,t)=>{Sn.init(e,t),e._zod.pattern=t.pattern??qt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Dn=/*@__PURE__*/ I(`$ZodStringFormat`,(e,t)=>{fn.init(e,t),En.init(e,t)}),On=/*@__PURE__*/ I(`$ZodGUID`,(e,t)=>{t.pattern??=At,Dn.init(e,t)}),kn=/*@__PURE__*/ I(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=jt(e)}else t.pattern??=jt();Dn.init(e,t)}),An=/*@__PURE__*/ I(`$ZodEmail`,(e,t)=>{t.pattern??=Mt,Dn.init(e,t)});function jn(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Mn(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?jn(e)||2:Nn(e,t)}function Nn(e,t){if(!t.normalize&&t.protocol?.source===zt.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}let Pn=/[\t\n\r]/g;function Fn(e){return e.replace(Pn,``)}function In(e,t){return t.lastIndex=0,t.test(e.hostname)}function Ln(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}let Rn=/*@__PURE__*/ I(`$ZodURL`,(e,t)=>{Dn.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Mn(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Fn(r);return}t.hostname&&!In(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Ln(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Fn(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),zn=/*@__PURE__*/ I(`$ZodEmoji`,(e,t)=>{t.pattern??=Nt(),Dn.init(e,t)}),Bn=/*@__PURE__*/ I(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Dt:Ot(t.length),Dn.init(e,t)}),Vn=/*@__PURE__*/ I(`$ZodCUID`,(e,t)=>{t.pattern??=St,Dn.init(e,t)}),Hn=/*@__PURE__*/ I(`$ZodCUID2`,(e,t)=>{t.pattern??=Ct,Dn.init(e,t)}),Un=/*@__PURE__*/ I(`$ZodULID`,(e,t)=>{t.pattern??=wt,Dn.init(e,t)}),Wn=/*@__PURE__*/ I(`$ZodXID`,(e,t)=>{t.pattern??=Tt,Dn.init(e,t)}),Gn=/*@__PURE__*/ I(`$ZodKSUID`,(e,t)=>{t.pattern??=Et,Dn.init(e,t)}),Kn=/*@__PURE__*/ I(`$ZodISODateTime`,(e,t)=>{t.pattern??=Kt(t),Dn.init(e,t)}),qn=/*@__PURE__*/ I(`$ZodISODate`,(e,t)=>{t.pattern??=Ut,Dn.init(e,t)}),Jn=/*@__PURE__*/ I(`$ZodISOTime`,(e,t)=>{t.pattern??=Gt(t),Dn.init(e,t)}),Yn=/*@__PURE__*/ I(`$ZodISODuration`,(e,t)=>{t.pattern??=kt,Dn.init(e,t)}),Xn=/*@__PURE__*/ I(`$ZodIPv4`,(e,t)=>{t.pattern??=Pt,Dn.init(e,t)}),Zn=/^[0-9a-fA-F:.]+$/;function Qn(e){return Zn.test(e)?jn(`http://[${e}]`):!1}let $n=/*@__PURE__*/ I(`$ZodIPv6`,(e,t)=>{t.pattern??=Ft,Dn.init(e,t),e._zod.check=n=>{Qn(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),er=/*@__PURE__*/ I(`$ZodCIDRv4`,(e,t)=>{t.pattern??=R,Dn.init(e,t)});function tr(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Qn(n)}let nr=/*@__PURE__*/ I(`$ZodCIDRv6`,(e,t)=>{t.pattern??=It,Dn.init(e,t),e._zod.check=n=>{tr(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function rr(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let ir=/^[0-9a-zA-Z+/]*={0,2}$/,ar=/*@__PURE__*/ I(`$ZodBase64`,(e,t)=>{t.pattern??=ir,Dn.init(e,t),e._zod.check=n=>{rr(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),or=/^[A-Za-z0-9_-]*$/;function sr(e){if(!or.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return rr(t.padEnd(Math.ceil(t.length/4)*4,`=`))}let cr=/*@__PURE__*/ I(`$ZodBase64URL`,(e,t)=>{t.pattern??=or,Dn.init(e,t),e._zod.check=n=>{sr(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),lr=/*@__PURE__*/ I(`$ZodE164`,(e,t)=>{t.pattern??=Bt,Dn.init(e,t)});function ur(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}let dr=/*@__PURE__*/ I(`$ZodJWT`,(e,t)=>{Dn.init(e,t),e._zod.check=n=>{ur(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),fr=/*@__PURE__*/ I(`$ZodNumber`,(e,t)=>{Sn.init(e,t),e._zod.pattern=Xt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),pr=/*@__PURE__*/ I(`$ZodNumberFormat`,(e,t)=>{cn.init(e,t),fr.init(e,t)}),mr=/*@__PURE__*/ I(`$ZodBoolean`,(e,t)=>{Sn.init(e,t),e._zod.pattern=Zt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),hr=/*@__PURE__*/ I(`$ZodNull`,(e,t)=>{Sn.init(e,t),e._zod.pattern=Qt,e._zod.values=/* @__PURE__ */ new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),gr=/*@__PURE__*/ I(`$ZodUnknown`,(e,t)=>{Sn.init(e,t),e._zod.parse=e=>e}),_r=/*@__PURE__*/ I(`$ZodNever`,(e,t)=>{Sn.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function vr(e,t){let n=Ce(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of Ce(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,M(n.issues,t,e),n}}return i(n,a)}}let yr=e=>Array.isArray(e)?e.length:-1;function br(e,t,n){e.issues.length&&t.issues.push(...xe(n,e.issues)),t.value[n]=e.value}let xr=/*@__PURE__*/ I(`$ZodArray`,(e,t)=>{Sn.init(e,t);let n=Ke.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>br(t,r,e)));else if(br(c,r,e),s&&c.issues.length!==0&&ye(c))break}return o.length?Promise.all(o).then(()=>r):r},vr(e,yr)});function Sr(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...xe(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}let Cr=[];function wr(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Cr,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=le(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Tr(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(ye(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Sr(e,n,i,t,d,f))):Sr(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}let Er=/*@__PURE__*/ I(`$ZodObject`,(e,t)=>{Sn.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=m(()=>wr(t));P(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||v(n,e,/* @__PURE__ */ new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=te,o=t.catchall,s,c=Ke.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(ye(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Sr(n,t,e,r,a,o))):Sr(s,t,e,r,a,o)}return o?Tr(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Dr=/*@__PURE__*/ I(`$ZodObjectJIT`,(e,t)=>{Er.init(e,t);let n=e._zod.parse,r=m(()=>wr(t)),i=Ke.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new bn([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
4
4
  let ${e}_ab = false;
5
5
  for (let i = 0; i < ${e}.issues.length; i++) {
6
6
  const iss = ${e}.issues[i];
@@ -11,7 +11,7 @@ window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-ui-workspace`,factory:
11
11
  if (${e}_ab && ctx && ctx.abortEarly) {
12
12
  payload.value = newResult;
13
13
  return payload;
14
- }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:ee(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
14
+ }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:E(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
15
15
  const ${n}_present = ${i};
16
16
  if (!${n}.issues.length || ${n}_present) {
17
17
  if (${n}.issues.length) {${c(n,r)}
@@ -50,78 +50,78 @@ window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-ui-workspace`,factory:
50
50
  newResult[${r}] = ${n}.value;
51
51
  }
52
52
 
53
- `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=re,c=!Je.jitless,l=c&&ie.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?Or([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function jr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!be(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Te(e,r,Ye())))}),t)}let Mr=/*@__PURE__*/ I(`$ZodUnion`,(e,t)=>{Tn.init(e,t),F(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),F(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),F(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),F(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>g(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>jr(t,r,e,i)):jr(o,r,e,i)}});function Nr(e){let t=/* @__PURE__ */ new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}let Pr=/*@__PURE__*/ I(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Mr.init(e,t);let n=e._zod.parse;F(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||b(t,e,/* @__PURE__ */ new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=x(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=m(()=>Nr(t));e._zod.parse=(i,a)=>{let o=i.value;if(!re(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),Fr=/*@__PURE__*/ I(`$ZodIntersection`,(e,t)=>{Tn.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Lr(e,t,n)):Lr(e,i,a)}});function Ir(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ae(e)&&ae(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Ir(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Ir(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Lr(e,t,n){let r=/* @__PURE__ */ new Map,i,a=/* @__PURE__ */ new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Ir(t.value,n.value);if(!c.valid){if(be(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}let Rr=/*@__PURE__*/ I(`$ZodTuple`,(e,t)=>{Tn.init(e,t);let n=t.items,r=Je.memoizer;r?.attach(e),e._zod.parse=(i,a)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:`tuple`,code:`invalid_type`}),i;i.value=r?r.alloc(e,i,[],a):[];let s=[],c=zr(n,`optin`),l=zr(n,`optout`);if(!t.rest){if(o.length<c)return i.issues.push({code:`too_small`,minimum:c,inclusive:!0,input:o,inst:e,origin:`array`}),i;o.length>n.length&&i.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:o,inst:e,origin:`array`})}let u=Array(n.length),d=t.rest?a?.abortEarly:void 0,f=!1;for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:o[e],issues:[]},a);t instanceof Promise?s.push(t.then(t=>{u[e]=t})):(u[e]=t,d&&!f&&t.issues.length&&(f=be(t)))}if(t.rest&&!f){let e=n.length-1,r=o.slice(n.length),c=i.issues.length;for(let n of r){if(d&&i.issues.length!==c){if(be(i,c))break;c=i.issues.length}e++;let r=t.rest._zod.run({value:n,issues:[]},a);r instanceof Promise?s.push(r.then(t=>Br(t,i,e))):Br(r,i,e)}}return s.length?Promise.all(s).then(()=>Vr(u,i,n,o,l)):Vr(u,i,n,o,l)}});function zr(e,t){for(let n=e.length-1;n>=0;n--)if(!(t===`optin`?e[n]._zod.optin!==void 0:e[n]._zod.optout===`optional`))return n+1;return 0}function Br(e,t,n){e.issues.length&&t.issues.push(...Se(n,e.issues)),t.value[n]=e.value}function Vr(e,t,n,r,i){for(let a=0;a<n.length;a++){let o=e[a],s=a<r.length;if(!s&&a>=i&&n[a]._zod.optin===`optional`){t.value.length=a;break}if(o.issues.length){if(!s&&a>=i){t.value.length=a;break}t.issues.push(...Se(a,o.issues))}t.value[a]=o.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}let Hr=/*@__PURE__*/ I(`$ZodRecord`,(e,t)=>{Tn.init(e,t);let n=Je.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!ae(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=/* @__PURE__ */ new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Te(e,i,Ye())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...Se(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...Se(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&$t.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>Te(e,i,Ye())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...Se(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...Se(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Ur=/*@__PURE__*/ I(`$ZodEnum`,(e,t)=>{Tn.init(e,t);let n=u(t.entries),r=new Set(n);e._zod.values=r,F(e,`pattern`,e=>{let t=u(e.def.entries).filter(e=>se.has(typeof e));return RegExp(t.length?`^(${t.map(e=>ce(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Wr=/*@__PURE__*/ I(`$ZodLiteral`,(e,t)=>{Tn.init(e,t);let n=new Set(t.values);e._zod.values=n,F(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?ce(e):e?ce(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Gr=/*@__PURE__*/ I(`$ZodTransform`,(e,t)=>{Tn.init(e,t),e._zod.optin=`optional`,Je.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new qe(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Ke;return n.value=i,n}});function Kr(e,t){return e.value=t.issues.length?void 0:t.value,e}let qr=/*@__PURE__*/ I(`$ZodOptional`,(e,t)=>{Tn.init(e,t),F(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,F(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?/* @__PURE__ */ new Set([...t,void 0]):void 0}),F(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${g(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Kr(e,t)):Kr(e,r)}return t.innerType._zod.run(e,n)}}),Jr=/*@__PURE__*/ I(`$ZodExactOptional`,(e,t)=>{qr.init(e,t),F(e,`values`,e=>e.def.innerType._zod.values),F(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Yr=/*@__PURE__*/ I(`$ZodNullable`,(e,t)=>{Tn.init(e,t),F(e,`optin`,e=>e.def.innerType._zod.optin),F(e,`optout`,e=>e.def.innerType._zod.optout),F(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${g(t.source)}|null)$`):void 0}),F(e,`values`,e=>e.def.innerType._zod.values?/* @__PURE__ */ new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Xr=/*@__PURE__*/ I(`$ZodDefault`,(e,t)=>{Tn.init(e,t),e._zod.optin=`defaulted`,F(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Zr(e,t)):Zr(r,t)}});function Zr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}let Qr=/*@__PURE__*/ I(`$ZodPrefault`,(e,t)=>{Tn.init(e,t),e._zod.optin=`defaulted`,F(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),$r=/*@__PURE__*/ I(`$ZodNonOptional`,(e,t)=>{Tn.init(e,t),F(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>ei(t,e)):ei(i,e)}});function ei(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function ti(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Te(e,r,Ye()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}let ni=/*@__PURE__*/ I(`$ZodCatch`,(e,t)=>{Tn.init(e,t),F(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),F(e,`optout`,e=>e.def.innerType._zod.optout),F(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>ti(e,r,t,n)):ti(e,r,t,n)}}),ri=/*@__PURE__*/ I(`$ZodPipe`,(e,t)=>{Tn.init(e,t),F(e,`values`,e=>e.def.in._zod.values),F(e,`optin`,e=>e.def.in._zod.optin),F(e,`optout`,e=>e.def.out._zod.optout),F(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>ii(e,t.in,n)):ii(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>ii(e,t.out,n)):ii(r,t.out,n)}});function ii(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}let ai=/*@__PURE__*/ I(`$ZodReadonly`,(e,t)=>{Tn.init(e,t),F(e,`propValues`,e=>e.def.innerType._zod.propValues),F(e,`values`,e=>e.def.innerType._zod.values),F(e,`optin`,e=>e.def.innerType?._zod?.optin),F(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(oi):oi(r)}});function oi(e){return e.memo||(e.value=Object.freeze(e.value)),e}function si(e){let t=e._zod.def,n=t.pattern,r=!!t.format?.includes(`int`),i,a;for(let e of t.checks??[]){let t=e._zod.def;t.pattern&&(n=t.pattern),r||=!!t.format?.includes(`int`);let o=t.minimum??t.length,s=t.maximum??t.length;o!==void 0&&(i===void 0||o>i)&&(i=o),s!==void 0&&(a===void 0||s<a)&&(a=s)}if(n)return n.source;if(i!==void 0&&a!==void 0&&i>a)return`(?!)`;if(i!==void 0||a!==void 0)return Zt({minimum:i,maximum:a}).source;let o=e._zod.pattern;return(r&&o===$t?Qt:o)?.source}function ci(e){let t=e._zod.def,n=e._zod.pattern?.source,r=t.innerType??e._zod.innerType;if(r){let e=r._zod.pattern?.source,t=ci(r);return n&&e&&t&&t!==e?n.replace(g(e),()=>g(t)):n}if(t.options){let e=t.options.map(ci);if(e.every(Boolean))return`^(${e.map(e=>g(e)).join(`|`)})$`}return si(e)}let li=/*@__PURE__*/ I(`$ZodTemplateLiteral`,(e,t)=>{Tn.init(e,t);let n=[];for(let e of t.parts)if(typeof e==`object`&&e){let t=ci(e);if(!t)throw Error(`Invalid template literal part, no pattern found: ${[...e._zod.traits].shift()}`);n.push(g(t))}else if(e===null||O.has(typeof e))n.push(ce(`${e}`));else throw Error(`Invalid template literal part: ${e}`);e._zod.pattern=RegExp(`^${n.join(``)}$`),e._zod.parse=(n,r)=>typeof n.value==`string`?(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:`invalid_format`,format:t.format??`template_literal`,pattern:e._zod.pattern.source}),n):(n.issues.push({input:n.value,inst:e,expected:`string`,code:`invalid_type`}),n)}),ui=/*@__PURE__*/ I(`$ZodLazy`,(e,t)=>{Tn.init(e,t),y(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),F(e,`pattern`,e=>e.innerType?._zod?.pattern),F(e,`propValues`,e=>e.innerType?._zod?.propValues),F(e,`optin`,e=>e.innerType?._zod?.optin??void 0),F(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),di=/*@__PURE__*/ I(`$ZodCustom`,(e,t)=>{an.init(e,t),Tn.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>fi(t,n,r,e));fi(i,n,r,e)}});function fi(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Ae(e))}}var pi=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}};let mi=`~memo`,hi=[];function gi(e){return typeof e==`object`&&!!e}function _i(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}let vi=/*@__PURE__*/ new WeakMap;function yi(e,t,n){let r=vi.get(e);if(r!==void 0)return r?2:0;if(t.has(e))return 2;t.add(e);let i=0,a=e=>{if(i!==2&&e?._zod){let r=yi(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=0;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?1:o.value?._zod?yi(o.value,t,n):0;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=x(c);s(e?o(e,!0):1),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?yi(r,t,!1):1);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),bi(e,i)}function bi(e,t){return t!==1&&vi.set(e,t===2),t}function xi(e,t){let n=e.buckets.get(t);return n||(n=/* @__PURE__ */ new WeakMap,e.buckets.set(t,n)),n}let Si,Ci=[],wi={alloc(e,t,n){let r=Si;if(!r)return n;Si=void 0;let i={value:n,issues:null};return r.set(t.value,i),Ci.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Ei(n,e.value))throw new pi;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=yi(e,/* @__PURE__ */ new Set,!1);if(i===0)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===2||r?n=!0:r=!0}let l=s.value;if(!gi(l))return t(s,c);let u=c[mi];u||(u={buckets:/* @__PURE__ */ new WeakMap,backEdges:void 0},c[mi]=u);let d;i===c?d=a:(d=xi(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(..._i(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=/* @__PURE__ */ new WeakSet),u.backEdges.add(f.value)),s;Si=d;let p=Ci.length,m=t(s,c);Si=void 0;let h=Ci.length>p?Ci.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?_i(e.issues):hi),e)):(h&&(h.issues=m.issues.length?_i(m.issues):hi),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Ti(){return wi}function Ei(e,t){let n=e[mi]?.backEdges;return n!==void 0&&gi(t)&&n.has(t)}let Di=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(ke(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${le(e.values[0])}`:`Invalid option: expected one of ${d(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${d(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Oi(){return{localeError:Di()}}var ki,Ai=class{constructor(){this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function ji(){return new Ai}(ki=globalThis).__zod_globalRegistry??(ki.__zod_globalRegistry=ji());let Mi=globalThis.__zod_globalRegistry;function Ni(e){return e.checks&&=[...e.checks],e}// @__NO_SIDE_EFFECTS__
54
- function Pi(e,t){return new e(Ni({type:`string`,...A(t)}))}// @__NO_SIDE_EFFECTS__
55
- function Fi(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...A(t)})}// @__NO_SIDE_EFFECTS__
56
- function Ii(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...A(t)})}// @__NO_SIDE_EFFECTS__
57
- function Li(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...A(t)})}// @__NO_SIDE_EFFECTS__
58
- function Ri(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...A(t)})}// @__NO_SIDE_EFFECTS__
59
- function zi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...A(t)})}// @__NO_SIDE_EFFECTS__
60
- function Bi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...A(t)})}// @__NO_SIDE_EFFECTS__
61
- function Vi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...A(t)})}// @__NO_SIDE_EFFECTS__
62
- function Hi(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...A(t)})}// @__NO_SIDE_EFFECTS__
63
- function Ui(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...A(t)})}// @__NO_SIDE_EFFECTS__
64
- function Wi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...A(t)})}// @__NO_SIDE_EFFECTS__
65
- function Gi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...A(t)})}// @__NO_SIDE_EFFECTS__
66
- function Ki(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...A(t)})}// @__NO_SIDE_EFFECTS__
67
- function qi(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...A(t)})}// @__NO_SIDE_EFFECTS__
68
- function Ji(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...A(t)})}// @__NO_SIDE_EFFECTS__
69
- function Yi(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...A(t)})}// @__NO_SIDE_EFFECTS__
70
- function Xi(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...A(t)})}// @__NO_SIDE_EFFECTS__
71
- function Zi(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...A(t)})}// @__NO_SIDE_EFFECTS__
72
- function Qi(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...A(t)})}// @__NO_SIDE_EFFECTS__
73
- function $i(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...A(t)})}// @__NO_SIDE_EFFECTS__
74
- function ea(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...A(t)})}// @__NO_SIDE_EFFECTS__
75
- function ta(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...A(t)})}// @__NO_SIDE_EFFECTS__
76
- function na(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...A(t)})}// @__NO_SIDE_EFFECTS__
77
- function ra(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...A(t)})}// @__NO_SIDE_EFFECTS__
78
- function ia(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...A(t)})}// @__NO_SIDE_EFFECTS__
79
- function aa(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...A(t)})}// @__NO_SIDE_EFFECTS__
80
- function oa(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...A(t)})}// @__NO_SIDE_EFFECTS__
81
- function sa(e,t){return new e(Ni({type:`number`,checks:[],...A(t)}))}// @__NO_SIDE_EFFECTS__
82
- function ca(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...A(t)})}// @__NO_SIDE_EFFECTS__
83
- function la(e,t){return new e({type:`boolean`,...A(t)})}// @__NO_SIDE_EFFECTS__
84
- function ua(e,t){return new e({type:`null`,...A(t)})}// @__NO_SIDE_EFFECTS__
85
- function da(e){return new e({type:`unknown`})}// @__NO_SIDE_EFFECTS__
86
- function fa(e,t){return new e({type:`never`,...A(t)})}// @__NO_SIDE_EFFECTS__
87
- function pa(e,t){return new cn({check:`less_than`,...A(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
88
- function ma(e,t){return new cn({check:`less_than`,...A(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
89
- function ha(e,t){return new ln({check:`greater_than`,...A(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
90
- function ga(e,t){return new ln({check:`greater_than`,...A(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
91
- function _a(e,t){return new un({check:`multiple_of`,...A(t),value:e})}// @__NO_SIDE_EFFECTS__
92
- function va(e,t){return new fn({check:`max_length`,...A(t),maximum:e})}// @__NO_SIDE_EFFECTS__
93
- function ya(e,t){return new pn({check:`min_length`,...A(t),minimum:e})}// @__NO_SIDE_EFFECTS__
94
- function ba(e,t){return new mn({check:`length_equals`,...A(t),length:e})}// @__NO_SIDE_EFFECTS__
95
- function xa(e,t){return new gn({check:`string_format`,format:`regex`,...A(t),pattern:e})}// @__NO_SIDE_EFFECTS__
96
- function Sa(e){return new _n({check:`string_format`,format:`lowercase`,...A(e)})}// @__NO_SIDE_EFFECTS__
97
- function Ca(e){return new vn({check:`string_format`,format:`uppercase`,...A(e)})}// @__NO_SIDE_EFFECTS__
98
- function wa(e,t){return new yn({check:`string_format`,format:`includes`,...A(t),includes:e})}// @__NO_SIDE_EFFECTS__
99
- function Ta(e,t){return new bn({check:`string_format`,format:`starts_with`,...A(t),prefix:e})}// @__NO_SIDE_EFFECTS__
100
- function Ea(e,t){return new xn({check:`string_format`,format:`ends_with`,...A(t),suffix:e})}// @__NO_SIDE_EFFECTS__
101
- function Da(e){return new Sn({check:`overwrite`,tx:e})}// @__NO_SIDE_EFFECTS__
102
- function Oa(e){return/* @__PURE__ */ Da(t=>t.normalize(e))}// @__NO_SIDE_EFFECTS__
103
- function ka(){return/* @__PURE__ */ Da(e=>e.trim())}// @__NO_SIDE_EFFECTS__
104
- function Aa(){return/* @__PURE__ */ Da(e=>e.toLowerCase())}// @__NO_SIDE_EFFECTS__
105
- function ja(){return/* @__PURE__ */ Da(e=>e.toUpperCase())}// @__NO_SIDE_EFFECTS__
106
- function Ma(){return/* @__PURE__ */ Da(e=>te(e))}// @__NO_SIDE_EFFECTS__
107
- function Na(e,t,n){return new e({type:`array`,element:t,...A(n)})}// @__NO_SIDE_EFFECTS__
108
- function Pa(e,t,n){let r=A(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}// @__NO_SIDE_EFFECTS__
109
- function Fa(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...A(n)})}// @__NO_SIDE_EFFECTS__
110
- function Ia(e,t){let n=/* @__PURE__ */ La(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Ae(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Ae(r))}},e(t.value,t)),t);return n}// @__NO_SIDE_EFFECTS__
111
- function La(e,t){let n=new an({check:`custom`,...A(t)});return n._zod.check=e,n}function Ra(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&b(e,t,n[t]);return e}function za(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Mi,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:/* @__PURE__ */ new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function Ba(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function Va(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Va(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Ra(o.schema,c),t.io===`input`&&Za(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Ha(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Ua(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=/* @__PURE__ */ new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Ha(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Ha(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
53
+ `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=te,c=!Ke.jitless,l=c&&ne.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?Tr([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Or(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!ye(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>we(e,r,qe())))}),t)}let kr=/*@__PURE__*/ I(`$ZodUnion`,(e,t)=>{Sn.init(e,t),P(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),P(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),P(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),P(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>g(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Or(t,r,e,i)):Or(o,r,e,i)}});function Ar(e){let t=/* @__PURE__ */ new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}let jr=/*@__PURE__*/ I(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,kr.init(e,t);let n=e._zod.parse;P(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||v(t,e,/* @__PURE__ */ new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=y(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=m(()=>Ar(t));e._zod.parse=(i,a)=>{let o=i.value;if(!te(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),Mr=/*@__PURE__*/ I(`$ZodIntersection`,(e,t)=>{Sn.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Pr(e,t,n)):Pr(e,i,a)}});function Nr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(re(e)&&re(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Nr(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Nr(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Pr(e,t,n){let r=/* @__PURE__ */ new Map,i,a=/* @__PURE__ */ new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Nr(t.value,n.value);if(!c.valid){if(ye(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}let Fr=/*@__PURE__*/ I(`$ZodTuple`,(e,t)=>{Sn.init(e,t);let n=t.items,r=Ke.memoizer;r?.attach(e),e._zod.parse=(i,a)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:`tuple`,code:`invalid_type`}),i;i.value=r?r.alloc(e,i,[],a):[];let s=[],c=Ir(n,`optin`),l=Ir(n,`optout`);if(!t.rest){if(o.length<c)return i.issues.push({code:`too_small`,minimum:c,inclusive:!0,input:o,inst:e,origin:`array`}),i;o.length>n.length&&i.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:o,inst:e,origin:`array`})}let u=Array(n.length),d=t.rest?a?.abortEarly:void 0,f=!1;for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:o[e],issues:[]},a);t instanceof Promise?s.push(t.then(t=>{u[e]=t})):(u[e]=t,d&&!f&&t.issues.length&&(f=ye(t)))}if(t.rest&&!f){let e=n.length-1,r=o.slice(n.length),c=i.issues.length;for(let n of r){if(d&&i.issues.length!==c){if(ye(i,c))break;c=i.issues.length}e++;let r=t.rest._zod.run({value:n,issues:[]},a);r instanceof Promise?s.push(r.then(t=>Lr(t,i,e))):Lr(r,i,e)}}return s.length?Promise.all(s).then(()=>Rr(u,i,n,o,l)):Rr(u,i,n,o,l)}});function Ir(e,t){for(let n=e.length-1;n>=0;n--)if(!(t===`optin`?e[n]._zod.optin!==void 0:e[n]._zod.optout===`optional`))return n+1;return 0}function Lr(e,t,n){e.issues.length&&t.issues.push(...xe(n,e.issues)),t.value[n]=e.value}function Rr(e,t,n,r,i){for(let a=0;a<n.length;a++){let o=e[a],s=a<r.length;if(!s&&a>=i&&n[a]._zod.optin===`optional`){t.value.length=a;break}if(o.issues.length){if(!s&&a>=i){t.value.length=a;break}t.issues.push(...xe(a,o.issues))}t.value[a]=o.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}let zr=/*@__PURE__*/ I(`$ZodRecord`,(e,t)=>{Sn.init(e,t);let n=Ke.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!re(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=/* @__PURE__ */ new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>we(e,i,qe())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...xe(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...xe(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&Xt.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>we(e,i,qe())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...xe(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...xe(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Br=/*@__PURE__*/ I(`$ZodEnum`,(e,t)=>{Sn.init(e,t);let n=u(t.entries),r=new Set(n);e._zod.values=r,P(e,`pattern`,e=>{let t=u(e.def.entries).filter(e=>ae.has(typeof e));return RegExp(t.length?`^(${t.map(e=>se(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Vr=/*@__PURE__*/ I(`$ZodLiteral`,(e,t)=>{Sn.init(e,t);let n=new Set(t.values);e._zod.values=n,P(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?se(e):e?se(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Hr=/*@__PURE__*/ I(`$ZodTransform`,(e,t)=>{Sn.init(e,t),e._zod.optin=`optional`,Ke.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ge(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new We;return n.value=i,n}});function Ur(e,t){return e.value=t.issues.length?void 0:t.value,e}let Wr=/*@__PURE__*/ I(`$ZodOptional`,(e,t)=>{Sn.init(e,t),P(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,P(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?/* @__PURE__ */ new Set([...t,void 0]):void 0}),P(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${g(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Ur(e,t)):Ur(e,r)}return t.innerType._zod.run(e,n)}}),Gr=/*@__PURE__*/ I(`$ZodExactOptional`,(e,t)=>{Wr.init(e,t),P(e,`values`,e=>e.def.innerType._zod.values),P(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Kr=/*@__PURE__*/ I(`$ZodNullable`,(e,t)=>{Sn.init(e,t),P(e,`optin`,e=>e.def.innerType._zod.optin),P(e,`optout`,e=>e.def.innerType._zod.optout),P(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${g(t.source)}|null)$`):void 0}),P(e,`values`,e=>e.def.innerType._zod.values?/* @__PURE__ */ new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),qr=/*@__PURE__*/ I(`$ZodDefault`,(e,t)=>{Sn.init(e,t),e._zod.optin=`defaulted`,P(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Jr(e,t)):Jr(r,t)}});function Jr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}let Yr=/*@__PURE__*/ I(`$ZodPrefault`,(e,t)=>{Sn.init(e,t),e._zod.optin=`defaulted`,P(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Xr=/*@__PURE__*/ I(`$ZodNonOptional`,(e,t)=>{Sn.init(e,t),P(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Zr(t,e)):Zr(i,e)}});function Zr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Qr(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>we(e,r,qe()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}let $r=/*@__PURE__*/ I(`$ZodCatch`,(e,t)=>{Sn.init(e,t),P(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),P(e,`optout`,e=>e.def.innerType._zod.optout),P(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Qr(e,r,t,n)):Qr(e,r,t,n)}}),ei=/*@__PURE__*/ I(`$ZodPipe`,(e,t)=>{Sn.init(e,t),P(e,`values`,e=>e.def.in._zod.values),P(e,`optin`,e=>e.def.in._zod.optin),P(e,`optout`,e=>e.def.out._zod.optout),P(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>ti(e,t.in,n)):ti(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>ti(e,t.out,n)):ti(r,t.out,n)}});function ti(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}let ni=/*@__PURE__*/ I(`$ZodPreprocess`,(e,t)=>{ei.init(e,t)}),ri=/*@__PURE__*/ I(`$ZodReadonly`,(e,t)=>{Sn.init(e,t),P(e,`propValues`,e=>e.def.innerType._zod.propValues),P(e,`values`,e=>e.def.innerType._zod.values),P(e,`optin`,e=>e.def.innerType?._zod?.optin),P(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(ii):ii(r)}});function ii(e){return e.memo||(e.value=Object.freeze(e.value)),e}function ai(e){let t=e._zod.def,n=t.pattern,r=!!t.format?.includes(`int`),i,a;for(let e of t.checks??[]){let t=e._zod.def;t.pattern&&(n=t.pattern),r||=!!t.format?.includes(`int`);let o=t.minimum??t.length,s=t.maximum??t.length;o!==void 0&&(i===void 0||o>i)&&(i=o),s!==void 0&&(a===void 0||s<a)&&(a=s)}if(n)return n.source;if(i!==void 0&&a!==void 0&&i>a)return`(?!)`;if(i!==void 0||a!==void 0)return Jt({minimum:i,maximum:a}).source;let o=e._zod.pattern;return(r&&o===Xt?Yt:o)?.source}function oi(e){let t=e._zod.def,n=e._zod.pattern?.source,r=t.innerType??e._zod.innerType;if(r){let e=r._zod.pattern?.source,t=oi(r);return n&&e&&t&&t!==e?n.replace(g(e),()=>g(t)):n}if(t.options){let e=t.options.map(oi);if(e.every(Boolean))return`^(${e.map(e=>g(e)).join(`|`)})$`}return ai(e)}let si=/*@__PURE__*/ I(`$ZodTemplateLiteral`,(e,t)=>{Sn.init(e,t);let n=[];for(let e of t.parts)if(typeof e==`object`&&e){let t=oi(e);if(!t)throw Error(`Invalid template literal part, no pattern found: ${[...e._zod.traits].shift()}`);n.push(g(t))}else if(e===null||oe.has(typeof e))n.push(se(`${e}`));else throw Error(`Invalid template literal part: ${e}`);e._zod.pattern=RegExp(`^${n.join(``)}$`),e._zod.parse=(n,r)=>typeof n.value==`string`?(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:`invalid_format`,format:t.format??`template_literal`,pattern:e._zod.pattern.source}),n):(n.issues.push({input:n.value,inst:e,expected:`string`,code:`invalid_type`}),n)}),ci=/*@__PURE__*/ I(`$ZodCustom`,(e,t)=>{tn.init(e,t),Sn.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>li(t,n,r,e));li(i,n,r,e)}});function li(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(ke(e))}}var ui=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}};let di=`~memo`,fi=[];function pi(e){return typeof e==`object`&&!!e}function mi(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}let hi=/*@__PURE__*/ new WeakMap;function gi(e,t,n){let r=hi.get(e);if(r!==void 0)return r?2:0;if(t.has(e))return 2;t.add(e);let i=0,a=e=>{if(i!==2&&e?._zod){let r=gi(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=0;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?1:o.value?._zod?gi(o.value,t,n):0;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=y(c);s(e?o(e,!0):1),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?gi(r,t,!1):1);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),_i(e,i)}function _i(e,t){return t!==1&&hi.set(e,t===2),t}function vi(e,t){let n=e.buckets.get(t);return n||(n=/* @__PURE__ */ new WeakMap,e.buckets.set(t,n)),n}let yi,bi=[],xi={alloc(e,t,n){let r=yi;if(!r)return n;yi=void 0;let i={value:n,issues:null};return r.set(t.value,i),bi.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Ci(n,e.value))throw new ui;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=gi(e,/* @__PURE__ */ new Set,!1);if(i===0)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===2||r?n=!0:r=!0}let l=s.value;if(!pi(l))return t(s,c);let u=c[di];u||(u={buckets:/* @__PURE__ */ new WeakMap,backEdges:void 0},c[di]=u);let d;i===c?d=a:(d=vi(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...mi(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=/* @__PURE__ */ new WeakSet),u.backEdges.add(f.value)),s;yi=d;let p=bi.length,m=t(s,c);yi=void 0;let h=bi.length>p?bi.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?mi(e.issues):fi),e)):(h&&(h.issues=m.issues.length?mi(m.issues):fi),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Si(){return xi}function Ci(e,t){let n=e[di]?.backEdges;return n!==void 0&&pi(t)&&n.has(t)}let wi=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Oe(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${ce(e.values[0])}`:`Invalid option: expected one of ${d(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${d(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Ti(){return{localeError:wi()}}var Ei,Di=class{constructor(){this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Oi(){return new Di}(Ei=globalThis).__zod_globalRegistry??(Ei.__zod_globalRegistry=Oi());let ki=globalThis.__zod_globalRegistry;function Ai(e){return e.checks&&=[...e.checks],e}// @__NO_SIDE_EFFECTS__
54
+ function ji(e,t){return new e(Ai({type:`string`,...k(t)}))}// @__NO_SIDE_EFFECTS__
55
+ function Mi(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...k(t)})}// @__NO_SIDE_EFFECTS__
56
+ function Ni(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...k(t)})}// @__NO_SIDE_EFFECTS__
57
+ function Pi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...k(t)})}// @__NO_SIDE_EFFECTS__
58
+ function Fi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...k(t)})}// @__NO_SIDE_EFFECTS__
59
+ function Ii(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...k(t)})}// @__NO_SIDE_EFFECTS__
60
+ function Li(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...k(t)})}// @__NO_SIDE_EFFECTS__
61
+ function Ri(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...k(t)})}// @__NO_SIDE_EFFECTS__
62
+ function zi(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...k(t)})}// @__NO_SIDE_EFFECTS__
63
+ function Bi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...k(t)})}// @__NO_SIDE_EFFECTS__
64
+ function Vi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...k(t)})}// @__NO_SIDE_EFFECTS__
65
+ function Hi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...k(t)})}// @__NO_SIDE_EFFECTS__
66
+ function Ui(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...k(t)})}// @__NO_SIDE_EFFECTS__
67
+ function Wi(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...k(t)})}// @__NO_SIDE_EFFECTS__
68
+ function Gi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...k(t)})}// @__NO_SIDE_EFFECTS__
69
+ function Ki(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...k(t)})}// @__NO_SIDE_EFFECTS__
70
+ function qi(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...k(t)})}// @__NO_SIDE_EFFECTS__
71
+ function Ji(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...k(t)})}// @__NO_SIDE_EFFECTS__
72
+ function Yi(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...k(t)})}// @__NO_SIDE_EFFECTS__
73
+ function Xi(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...k(t)})}// @__NO_SIDE_EFFECTS__
74
+ function Zi(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...k(t)})}// @__NO_SIDE_EFFECTS__
75
+ function Qi(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...k(t)})}// @__NO_SIDE_EFFECTS__
76
+ function $i(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...k(t)})}// @__NO_SIDE_EFFECTS__
77
+ function ea(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...k(t)})}// @__NO_SIDE_EFFECTS__
78
+ function ta(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...k(t)})}// @__NO_SIDE_EFFECTS__
79
+ function na(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...k(t)})}// @__NO_SIDE_EFFECTS__
80
+ function ra(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...k(t)})}// @__NO_SIDE_EFFECTS__
81
+ function ia(e,t){return new e(Ai({type:`number`,checks:[],...k(t)}))}// @__NO_SIDE_EFFECTS__
82
+ function aa(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...k(t)})}// @__NO_SIDE_EFFECTS__
83
+ function oa(e,t){return new e({type:`boolean`,...k(t)})}// @__NO_SIDE_EFFECTS__
84
+ function sa(e,t){return new e({type:`null`,...k(t)})}// @__NO_SIDE_EFFECTS__
85
+ function ca(e){return new e({type:`unknown`})}// @__NO_SIDE_EFFECTS__
86
+ function la(e,t){return new e({type:`never`,...k(t)})}// @__NO_SIDE_EFFECTS__
87
+ function ua(e,t){return new an({check:`less_than`,...k(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
88
+ function da(e,t){return new an({check:`less_than`,...k(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
89
+ function fa(e,t){return new on({check:`greater_than`,...k(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
90
+ function pa(e,t){return new on({check:`greater_than`,...k(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
91
+ function ma(e,t){return new sn({check:`multiple_of`,...k(t),value:e})}// @__NO_SIDE_EFFECTS__
92
+ function ha(e,t){return new ln({check:`max_length`,...k(t),maximum:e})}// @__NO_SIDE_EFFECTS__
93
+ function ga(e,t){return new un({check:`min_length`,...k(t),minimum:e})}// @__NO_SIDE_EFFECTS__
94
+ function _a(e,t){return new dn({check:`length_equals`,...k(t),length:e})}// @__NO_SIDE_EFFECTS__
95
+ function va(e,t){return new pn({check:`string_format`,format:`regex`,...k(t),pattern:e})}// @__NO_SIDE_EFFECTS__
96
+ function ya(e){return new mn({check:`string_format`,format:`lowercase`,...k(e)})}// @__NO_SIDE_EFFECTS__
97
+ function ba(e){return new hn({check:`string_format`,format:`uppercase`,...k(e)})}// @__NO_SIDE_EFFECTS__
98
+ function xa(e,t){return new gn({check:`string_format`,format:`includes`,...k(t),includes:e})}// @__NO_SIDE_EFFECTS__
99
+ function Sa(e,t){return new _n({check:`string_format`,format:`starts_with`,...k(t),prefix:e})}// @__NO_SIDE_EFFECTS__
100
+ function Ca(e,t){return new vn({check:`string_format`,format:`ends_with`,...k(t),suffix:e})}// @__NO_SIDE_EFFECTS__
101
+ function wa(e){return new yn({check:`overwrite`,tx:e})}// @__NO_SIDE_EFFECTS__
102
+ function Ta(e){return/* @__PURE__ */ wa(t=>t.normalize(e))}// @__NO_SIDE_EFFECTS__
103
+ function Ea(){return/* @__PURE__ */ wa(e=>e.trim())}// @__NO_SIDE_EFFECTS__
104
+ function Da(){return/* @__PURE__ */ wa(e=>e.toLowerCase())}// @__NO_SIDE_EFFECTS__
105
+ function Oa(){return/* @__PURE__ */ wa(e=>e.toUpperCase())}// @__NO_SIDE_EFFECTS__
106
+ function ka(){return/* @__PURE__ */ wa(e=>D(e))}// @__NO_SIDE_EFFECTS__
107
+ function Aa(e,t,n){return new e({type:`array`,element:t,...k(n)})}// @__NO_SIDE_EFFECTS__
108
+ function ja(e,t,n){let r=k(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}// @__NO_SIDE_EFFECTS__
109
+ function Ma(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...k(n)})}// @__NO_SIDE_EFFECTS__
110
+ function Na(e,t){let n=/* @__PURE__ */ Pa(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(ke(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(ke(r))}},e(t.value,t)),t);return n}// @__NO_SIDE_EFFECTS__
111
+ function Pa(e,t){let n=new tn({check:`custom`,...k(t)});return n._zod.check=e,n}function Fa(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&v(e,t,n[t]);return e}function Ia(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??ki,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:/* @__PURE__ */ new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function La(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function Ra(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Ra(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Fa(o.schema,c),t.io===`input`&&Ja(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function za(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Ba(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=/* @__PURE__ */ new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${za(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+za(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
112
112
 
113
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Wa(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Wa(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}let Ga=/* @__PURE__ */ new Set([`type`,`properties`,`required`,`additionalProperties`]),Ka=[`oneOf`,`anyOf`];function qa(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Ja(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Ga.has(e))return null;t.push(n)}let n={},r=/* @__PURE__ */ new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??qa(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}b(n,r,e.length===1?e[0]:Ja(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=qa(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Ya(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Ga)if(t in e)return;let n=t.filter(e=>Ka.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Ja(t);else{let e=n[0],i=Ka.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Ja([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Ra(e,r))}function Xa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Ra(i,s),Ra(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Wa(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=/* @__PURE__ */ new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Ya(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Ra(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,b(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:$a(t,`input`,e.processors),output:$a(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Za(e,t){let n=t??{seen:/* @__PURE__ */ new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Za(r.element,n);if(r.type===`set`)return Za(r.valueType,n);if(r.type===`lazy`)return Za(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return Za(r.innerType,n);if(r.type===`intersection`)return Za(r.left,n)||Za(r.right,n);if(r.type===`record`||r.type===`map`)return Za(r.keyType,n)||Za(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Za(r.in,n)||Za(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Za(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Za(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Za(e,n))return!0;return!!(r.rest&&Za(r.rest,n))}return!1}let Qa=(e,t={})=>n=>{let r=za({...n,processors:t});return Va(e,r),Ua(r,e),Xa(r,e)},$a=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=za({...i??{},target:a,io:t,processors:n});return Va(e,o),Ua(o,e),Xa(o,e)},eo=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},to=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},no=(e,t)=>{eo(e,`minimum`,t),to(e,`maximum`,t)},ro=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},io=(e,t)=>{e.patterns??=/* @__PURE__ */ new Set,e.patterns.add(t)},ao=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},oo=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},so=(e,t)=>eo(e,`minimum`,t.minimum),co=(e,t)=>to(e,`maximum`,t.maximum),lo=e=>(t,n)=>{oo(t,n.format);let[r,i]=e[n.format];eo(t,`minimum`,r),to(t,`maximum`,i)},uo={greater_than:(e,t)=>eo(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>to(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>ro(e,t.value),number_format:lo(j),bigint_format:lo(de),min_length:so,max_length:co,length_equals:(e,t)=>no(e,t.length),min_size:so,max_size:co,size_equals:(e,t)=>no(e,t.size),string_format:(e,t)=>{oo(e,t.format),t.pattern&&io(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>ao(e,t.mime)};function fo(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)uo[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&eo(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&eo(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&to(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&to(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&ro(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&ao(t,i.mime);for(let e of i.patterns??[])io(t,e);return t}let po={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},mo=/* @__PURE__ */ new Map([[sr,Bt],[lr,Vt]]),ho=e=>mo.get(e)??e,go=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=fo(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=po[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(ho);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},_o=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=fo(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=/* @__PURE__ */ new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Ba(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},vo=(e,t,n,r)=>{n.type=`boolean`},yo=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},bo=(e,t,n,r)=>{n.not={}},xo=(e,t,n,r)=>{let i=e._zod.def,a=u(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},So=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Ba(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Ba(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Co=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},wo=(e,t,n,r)=>{Ba(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},To=(e,t,n,r)=>{Ba(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Eo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=fo(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Va(a.element,t,{...r,path:[...r.path,`items`]})};function Do(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Do(t.out):t.type===`catch`?Do(t.innerType):e._zod.optin}let Oo=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Ba(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)b(i.properties,e,Va(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Do(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Va(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ko=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Va(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ao=(e,t,n,r)=>{let i=e._zod.def,a=Va(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Va(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},jo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>Va(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?Va(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?Do(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=fo(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function Mo(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Mo(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Mo(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?$t:Qt).source)),p}let No=/* @__PURE__ */ new WeakMap;function Po(e){let t=/* @__PURE__ */ new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=/* @__PURE__ */ new Map;for(let r of No.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Mo(t,a,/* @__PURE__ */ new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}let Fo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=fo(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Va(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)b(i.patternProperties,ho(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=Va(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=No.get(t);n||(n=[],No.set(t,n),t.deferred.push(()=>Po(t))),n.push(e)}i.additionalProperties=Va(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Do(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Io=(e,t,n,r)=>{let i=e._zod.def,a=Va(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Lo=(e,t,n,r)=>{let i=e._zod.def;Va(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ro=Symbol();function zo(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Ba(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Ro):JSON.parse(o)}let Bo=(e,t,n,r)=>{let i=e._zod.def;Va(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=zo(i.defaultValue,e,t,n,r);o!==Ro&&(n.default=o)},Vo=(e,t,n,r)=>{let i=e._zod.def;Va(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=zo(i.defaultValue,e,t,n,r);o!==Ro&&(n._prefault=o)},Ho=(e,t,n,r)=>{let i=e._zod.def;Va(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Ba(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Uo=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Va(o,t,r);let s=t.seen.get(e);s.ref=o},Wo=(e,t,n,r)=>{let i=e._zod.def;Va(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Go=(e,t,n,r)=>{let i=e._zod.def;Va(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ko=(e,t,n,r)=>{let i=e._zod.innerType;Va(i,t,r);let a=t.seen.get(e);a.ref=i},qo=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]);function Jo(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}let Yo=/*@__PURE__*/ I(`ZodError`,(e,t)=>{tt.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);qo.has(n)||(qo.add(n),Jo(n,`format`,e=>t=>it(e,t)),Jo(n,`flatten`,e=>t=>rt(e,t)),Jo(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,f,2)}),Jo(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,f,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Xo=/* @__PURE__ */ ot(Yo),Zo=/* @__PURE__ */ st(Yo),Qo=/* @__PURE__ */ ct(Yo),$o=/* @__PURE__ */ ut(Yo),es=/* @__PURE__ */ gt(Yo),ts=/* @__PURE__ */ _t(Yo),ns=/* @__PURE__ */ vt(Yo),rs=/* @__PURE__ */ yt(Yo),is=/* @__PURE__ */ bt(Yo),as=/* @__PURE__ */ xt(Yo),os=/* @__PURE__ */ St(Yo),ss=/* @__PURE__ */ Ct(Yo);function cs(){Je.localeError||Ye(Oi())}function ls(){Je.memoizer||Ye({memoizer:Ti()})}let us=/*@__PURE__*/ I(`ZodType`,(e,t)=>(cs(),Tn.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(D(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return k(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ic(e,t))},superRefine(e,t){return this.check(Lc(e,t))},overwrite(e){return this.check(/* @__PURE__ */ Da(e))},optional(){return pc(this)},exactOptional(){return hc(this)},nullable(){return _c(this)},nullish(){return pc(_c(this))},nonoptional(e){return Cc(this,e)},array(){return V(this)},or(e){return $s([this,e])},and(e){return rc(this,e)},transform(e){return Dc(this,dc(e))},default(e){return yc(this,e)},prefault(e){return xc(this,e)},catch(e){return Tc(this,e)},pipe(e){return Dc(this,e)},readonly(){return kc(this)},describe(e){let t=this.clone();return Mi.add(t,{description:e}),t},meta(...e){if(e.length===0)return Mi.get(this);let t=this.clone();return Mi.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Me(this,`~standard`,{...On(this),jsonSchema:{input:$a(this,`input`),output:$a(this,`output`)}})},set"~standard"(e){P(this,`~standard`,e)},parse:function e(t,n){return Xo(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Zo(this,t,n,{callee:e})},safeParse(e,t){return Qo(this,e,t)},async safeParseAsync(e,t){return $o(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){P(this,`spa`,e)},validate(e,t){return pt(this,e,t)},validateAsync(e,t){return ht(this,e,t)},encode:function e(t,n){return es(this,t,n,{callee:e})},decode:function e(t,n){return ts(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await ns(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await rs(this,t,n,{callee:e})},safeEncode(e,t){return is(this,e,t)},safeDecode(e,t){return as(this,e,t)},async safeEncodeAsync(e,t){return os(this,e,t)},async safeDecodeAsync(e,t){return ss(this,e,t)},toJSONSchema(e){return Qa(this,{})(e)},get description(){return Mi.get(this)?.description},get _def(){return this._zod.def}}),ds=/*@__PURE__*/ I(`_ZodString`,(e,t)=>{kn.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(e,t,n,r)},/*@__PURE__*/ Ne({format:e=>fo(e).format??null,minLength:e=>fo(e).minimum??null,maxLength:e=>fo(e).maximum??null},{regex(...e){return this.check(/* @__PURE__ */ xa(...e))},includes(...e){return this.check(/* @__PURE__ */ wa(...e))},startsWith(...e){return this.check(/* @__PURE__ */ Ta(...e))},endsWith(...e){return this.check(/* @__PURE__ */ Ea(...e))},min(...e){return this.check(/* @__PURE__ */ ya(...e))},max(...e){return this.check(/* @__PURE__ */ va(...e))},length(...e){return this.check(/* @__PURE__ */ ba(...e))},nonempty(...e){return this.check(/* @__PURE__ */ ya(1,...e))},lowercase(e){return this.check(/* @__PURE__ */ Sa(e))},uppercase(e){return this.check(/* @__PURE__ */ Ca(e))},trim(){return this.check(/* @__PURE__ */ ka())},normalize(...e){return this.check(/* @__PURE__ */ Oa(...e))},toLowerCase(){return this.check(/* @__PURE__ */ Aa())},toUpperCase(){return this.check(/* @__PURE__ */ ja())},slugify(){return this.check(/* @__PURE__ */ Ma())}})),fs=/*@__PURE__*/ I(`ZodString`,(e,t)=>{kn.init(e,t),ds.init(e,t)},{email(e){return this.check(/* @__PURE__ */ Fi(vs,e))},url(e){return this.check(/* @__PURE__ */ Vi(Cs,e))},jwt(e){return this.check(/* @__PURE__ */ na(zs,e))},emoji(e){return this.check(/* @__PURE__ */ Hi(Ts,e))},guid(e){return this.check(/* @__PURE__ */ Ii(ys,e))},uuid(e){return this.check(/* @__PURE__ */ Li(bs,e))},uuidv4(e){return this.check(/* @__PURE__ */ Ri(bs,e))},uuidv6(e){return this.check(/* @__PURE__ */ zi(bs,e))},uuidv7(e){return this.check(/* @__PURE__ */ Bi(bs,e))},nanoid(e){return this.check(/* @__PURE__ */ Ui(Es,e))},cuid(e){return this.check(/* @__PURE__ */ Wi(Ds,e))},cuid2(e){return this.check(/* @__PURE__ */ Gi(Os,e))},ulid(e){return this.check(/* @__PURE__ */ Ki(ks,e))},base64(e){return this.check(/* @__PURE__ */ $i(Is,e))},base64url(e){return this.check(/* @__PURE__ */ ea(Ls,e))},xid(e){return this.check(/* @__PURE__ */ qi(As,e))},ksuid(e){return this.check(/* @__PURE__ */ Ji(js,e))},ipv4(e){return this.check(/* @__PURE__ */ Yi(Ms,e))},ipv6(e){return this.check(/* @__PURE__ */ Xi(Ns,e))},cidrv4(e){return this.check(/* @__PURE__ */ Zi(Ps,e))},cidrv6(e){return this.check(/* @__PURE__ */ Qi(Fs,e))},e164(e){return this.check(/* @__PURE__ */ ta(Rs,e))},datetime(e){return this.check(/* @__PURE__ */ ra(ms,e))},date(e){return this.check(/* @__PURE__ */ ia(hs,e))},time(e){return this.check(/* @__PURE__ */ aa(gs,e))},duration(e){return this.check(/* @__PURE__ */ oa(_s,e))}});function R(e){return/* @__PURE__ */ Pi(fs,e)}let ps=/*@__PURE__*/ I(`ZodStringFormat`,(e,t)=>{An.init(e,t),ds.init(e,t)}),ms=/*@__PURE__*/ I(`ZodISODateTime`,(e,t)=>{Yn.init(e,t),ps.init(e,t)}),hs=/*@__PURE__*/ I(`ZodISODate`,(e,t)=>{Xn.init(e,t),ps.init(e,t)}),gs=/*@__PURE__*/ I(`ZodISOTime`,(e,t)=>{Zn.init(e,t),ps.init(e,t)}),_s=/*@__PURE__*/ I(`ZodISODuration`,(e,t)=>{Qn.init(e,t),ps.init(e,t)}),vs=/*@__PURE__*/ I(`ZodEmail`,(e,t)=>{Nn.init(e,t),ps.init(e,t)}),ys=/*@__PURE__*/ I(`ZodGUID`,(e,t)=>{jn.init(e,t),ps.init(e,t)}),bs=/*@__PURE__*/ I(`ZodUUID`,(e,t)=>{Mn.init(e,t),ps.init(e,t)});function xs(e){return/* @__PURE__ */ Li(bs,e)}function Ss(e){return/* @__PURE__ */ Ri(bs,e)}let Cs=/*@__PURE__*/ I(`ZodURL`,(e,t)=>{Vn.init(e,t),ps.init(e,t)});function ws(e){return/* @__PURE__ */ Vi(Cs,e)}let Ts=/*@__PURE__*/ I(`ZodEmoji`,(e,t)=>{Hn.init(e,t),ps.init(e,t)}),Es=/*@__PURE__*/ I(`ZodNanoID`,(e,t)=>{Un.init(e,t),ps.init(e,t)}),Ds=/*@__PURE__*/ I(`ZodCUID`,(e,t)=>{Wn.init(e,t),ps.init(e,t)}),Os=/*@__PURE__*/ I(`ZodCUID2`,(e,t)=>{Gn.init(e,t),ps.init(e,t)}),ks=/*@__PURE__*/ I(`ZodULID`,(e,t)=>{Kn.init(e,t),ps.init(e,t)}),As=/*@__PURE__*/ I(`ZodXID`,(e,t)=>{qn.init(e,t),ps.init(e,t)}),js=/*@__PURE__*/ I(`ZodKSUID`,(e,t)=>{Jn.init(e,t),ps.init(e,t)}),Ms=/*@__PURE__*/ I(`ZodIPv4`,(e,t)=>{$n.init(e,t),ps.init(e,t)}),Ns=/*@__PURE__*/ I(`ZodIPv6`,(e,t)=>{nr.init(e,t),ps.init(e,t)}),Ps=/*@__PURE__*/ I(`ZodCIDRv4`,(e,t)=>{rr.init(e,t),ps.init(e,t)}),Fs=/*@__PURE__*/ I(`ZodCIDRv6`,(e,t)=>{ar.init(e,t),ps.init(e,t)}),Is=/*@__PURE__*/ I(`ZodBase64`,(e,t)=>{cr.init(e,t),ps.init(e,t)}),Ls=/*@__PURE__*/ I(`ZodBase64URL`,(e,t)=>{dr.init(e,t),ps.init(e,t)}),Rs=/*@__PURE__*/ I(`ZodE164`,(e,t)=>{fr.init(e,t),ps.init(e,t)}),zs=/*@__PURE__*/ I(`ZodJWT`,(e,t)=>{mr.init(e,t),ps.init(e,t)}),Bs=/*@__PURE__*/ I(`ZodNumber`,(e,t)=>{hr.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_o(e,t,n,r),e.isFinite=!0},/*@__PURE__*/ Ne({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=fo(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=fo(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=fo(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>fo(e).format??null},{gt(e,t){return this.check(/* @__PURE__ */ ha(e,t))},gte(e,t){return this.check(/* @__PURE__ */ ga(e,t))},min(e,t){return this.check(/* @__PURE__ */ ga(e,t))},lt(e,t){return this.check(/* @__PURE__ */ pa(e,t))},lte(e,t){return this.check(/* @__PURE__ */ ma(e,t))},max(e,t){return this.check(/* @__PURE__ */ ma(e,t))},int(e){return this.check(Hs(e))},safe(e){return this.check(Hs(e))},positive(e){return this.check(/* @__PURE__ */ ha(0,e))},nonnegative(e){return this.check(/* @__PURE__ */ ga(0,e))},negative(e){return this.check(/* @__PURE__ */ pa(0,e))},nonpositive(e){return this.check(/* @__PURE__ */ ma(0,e))},multipleOf(e,t){return this.check(/* @__PURE__ */ _a(e,t))},step(e,t){return this.check(/* @__PURE__ */ _a(e,t))},finite(){return this}}));function z(e){return/* @__PURE__ */ sa(Bs,e)}let Vs=/*@__PURE__*/ I(`ZodNumberFormat`,(e,t)=>{gr.init(e,t),Bs.init(e,t)});function Hs(e){return/* @__PURE__ */ ca(Vs,e)}let Us=/*@__PURE__*/ I(`ZodBoolean`,(e,t)=>{_r.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vo(e,t,n,r)});function B(e){return/* @__PURE__ */ la(Us,e)}let Ws=/*@__PURE__*/ I(`ZodNull`,(e,t)=>{vr.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yo(e,t,n,r)});function Gs(e){return/* @__PURE__ */ ua(Ws,e)}let Ks=/*@__PURE__*/ I(`ZodUnknown`,(e,t)=>{yr.init(e,t),us.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function qs(){return/* @__PURE__ */ da(Ks)}let Js=/*@__PURE__*/ I(`ZodNever`,(e,t)=>{br.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bo(e,t,n,r)});function Ys(e){return/* @__PURE__ */ fa(Js,e)}let Xs=/*@__PURE__*/ I(`ZodArray`,(e,t)=>{ls(),wr.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r),e.element=t.element},{min(e,t){return this.check(/* @__PURE__ */ ya(e,t))},nonempty(e){return this.check(/* @__PURE__ */ ya(1,e))},max(e,t){return this.check(/* @__PURE__ */ va(e,t))},length(e,t){return this.check(/* @__PURE__ */ ba(e,t))},unwrap(){return this.element}});function V(e,t){return/* @__PURE__ */ Na(Xs,e,t)}let Zs=/*@__PURE__*/ I(`ZodObject`,(e,t)=>{ls(),Ar.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),ze(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return W(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(D(this._zod.def,{catchall:e}))},passthrough(){return this.clone(D(this._zod.def,{catchall:qs()}))},loose(){return this.clone(D(this._zod.def,{catchall:qs()}))},strict(){return this.clone(D(this._zod.def,{catchall:Ys()}))},strip(){return this.clone(D(this._zod.def,{catchall:void 0}))},extend(e){return me(this,e)},safeExtend(e){return ge(this,e)},merge(e){return _e(this,e)},pick(e){return M(this,e)},omit(e){return pe(this,e)},partial(...e){return ve(fc,this,e[0])},exactPartial(...e){return ve(mc,this,e[0],`exactPartial`)},required(...e){return ye(Sc,this,e[0])}});function H(e,t){let n={type:`object`,shape:e??{},...A(t)};return new Zs(n)}function U(e,t){return new Zs({type:`object`,shape:e,catchall:Ys(),...A(t)})}let Qs=/*@__PURE__*/ I(`ZodUnion`,(e,t)=>{Mr.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r),e.options=t.options});function $s(e,t){return new Qs({type:`union`,options:e,...A(t)})}let ec=/*@__PURE__*/ I(`ZodDiscriminatedUnion`,(e,t)=>{Qs.init(e,t),Pr.init(e,t)});function tc(e,t,n){return new ec({type:`union`,options:t,discriminator:e,...A(n)})}let nc=/*@__PURE__*/ I(`ZodIntersection`,(e,t)=>{Fr.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r)});function rc(e,t){return new nc({type:`intersection`,left:e,right:t})}let ic=/*@__PURE__*/ I(`ZodTuple`,(e,t)=>{ls(),Rr.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(`.partial() cannot be used on tuple schemas containing refinements`);return this.clone({...e,items:e.items.map(e=>new fc({type:`optional`,innerType:e}))})}});function ac(e,t,n){let r=t instanceof Tn;return new ic({type:`tuple`,items:e,rest:r?t:null,...A(r?n:t)})}let oc=/*@__PURE__*/ I(`ZodRecord`,(e,t)=>{ls(),Hr.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function sc(e,t,n){return!t||!t._zod?new oc({type:`record`,keyType:R(),valueType:e,...A(t)}):new oc({type:`record`,keyType:e,valueType:t,...A(n)})}let cc=/*@__PURE__*/ I(`ZodEnum`,(e,t)=>{Ur.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new cc({...t,checks:[],...A(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new cc({...t,checks:[],...A(r),entries:i})}});function W(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new cc({type:`enum`,entries:n,...A(t)})}let lc=/*@__PURE__*/ I(`ZodLiteral`,(e,t)=>{Wr.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function G(e,t){return new lc({type:`literal`,values:Array.isArray(e)?e:[e],...A(t)})}let uc=/*@__PURE__*/ I(`ZodTransform`,(e,t)=>{ls(),Gr.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new qe(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ae(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Ae(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function dc(e){return new uc({type:`transform`,transform:e})}let fc=/*@__PURE__*/ I(`ZodOptional`,(e,t)=>{qr.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Go(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pc(e){return new fc({type:`optional`,innerType:e})}let mc=/*@__PURE__*/ I(`ZodExactOptional`,(e,t)=>{Jr.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Go(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hc(e){return new mc({type:`optional`,innerType:e})}let gc=/*@__PURE__*/ I(`ZodNullable`,(e,t)=>{Yr.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _c(e){return new gc({type:`nullable`,innerType:e})}let vc=/*@__PURE__*/ I(`ZodDefault`,(e,t)=>{Xr.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function yc(e,t){return new vc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():oe(t)}})}let bc=/*@__PURE__*/ I(`ZodPrefault`,(e,t)=>{Qr.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xc(e,t){return new bc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():oe(t)}})}let Sc=/*@__PURE__*/ I(`ZodNonOptional`,(e,t)=>{$r.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Cc(e,t){return new Sc({type:`nonoptional`,innerType:e,...A(t)})}let wc=/*@__PURE__*/ I(`ZodCatch`,(e,t)=>{ni.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ho(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Tc(e,t){return new wc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Be(t)})}let Ec=/*@__PURE__*/ I(`ZodPipe`,(e,t)=>{ri.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uo(e,t,n,r),e.in=t.in,e.out=t.out});function Dc(e,t){return new Ec({type:`pipe`,in:e,out:t})}let Oc=/*@__PURE__*/ I(`ZodReadonly`,(e,t)=>{ai.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kc(e){return new Oc({type:`readonly`,innerType:e})}let Ac=/*@__PURE__*/ I(`ZodTemplateLiteral`,(e,t)=>{li.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r)});function jc(e,t){return new Ac({type:`template_literal`,parts:e,...A(t)})}let Mc=/*@__PURE__*/ I(`ZodLazy`,(e,t)=>{ui.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ko(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Nc(e){return new Mc({type:`lazy`,getter:e})}let Pc=/*@__PURE__*/ I(`ZodCustom`,(e,t)=>{di.init(e,t),us.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r)});function Fc(e,t){return/* @__PURE__ */ Pa(Pc,e??(()=>!0),t)}function Ic(e,t={}){return/* @__PURE__ */ Fa(Pc,e,t)}function Lc(e,t){return/* @__PURE__ */ Ia(e,t)}function Rc(e){return/* @__PURE__ */ ra(ms,e)}function zc(e){return(t,n)=>{for(let r of e)Object.hasOwn(t,r)&&t[r]===void 0&&n.addIssue({code:`custom`,path:[r],message:`Explicit undefined is not valid JSON`})}}let Bc=$s([R(),z(),B(),Gs()]);function Vc(e){let t=/* @__PURE__ */ new WeakSet,n=[{value:e,leaving:!1}];try{for(;n.length>0;){let e=n.pop();if(!e)break;if(e.leaving)t.delete(e.value);else if(typeof e.value==`object`&&e.value!==null){if(t.has(e.value))return!1;t.add(e.value),n.push({value:e.value,leaving:!0});for(let t of Object.values(e.value))n.push({value:t,leaving:!1})}}}catch{return!1}return!0}let Hc=Fc(Vc,{message:`JSON value must not contain circular references`}),Uc=Nc(()=>$s([Bc,V(Uc),sc(R(),Uc)])),Wc=Hc.pipe(Uc);Hc.pipe(V(Uc));let Gc=Hc.pipe(sc(R(),Uc)),Kc=U({code:R().min(1),message:R().min(1),retryable:B(),diagnostic:R().min(1).optional(),stage:R().min(1).optional(),durationMs:z().int().nonnegative().optional(),stderrTail:R().min(1).optional()}).superRefine(zc([`diagnostic`,`stage`,`durationMs`,`stderrTail`])),qc=R().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u),Jc=e=>R().min(1).max(e).refine(e=>e.trim().length>0),Yc=sc(qc,H({label:Jc(256).optional(),description:Jc(1024).optional()}).strict()).refine(e=>Object.keys(e).length<=16,`Too many locales`),Xc=sc(qc,Jc(4096)).refine(e=>typeof e.en==`string`,`English fallback is required`).refine(e=>Object.keys(e).length<=16,`Too many locales`),Zc=R().refine(e=>e.trim().length>0,{message:`Identifier must not be empty or whitespace`}),Qc=Zc.brand(),K=Zc.brand(),$c=Zc.brand();Zc.brand();let el=Zc.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).brand();Zc.brand();let tl=R().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),nl=tl.max(128).regex(/^[A-Za-z0-9._~:-]+$/u,`Permission Mode ID must use transport-safe characters`).brand(),rl=H({modes:V(H({id:nl,label:tl.max(256),description:tl.max(1024).optional(),dangerous:B().optional(),localizations:Yc.optional()}).strict()).min(1).max(32),defaultModeId:nl}).strict().superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.modes.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Permission Mode IDs must be unique`,path:[`modes`,r,`id`]}),n.add(i.id);n.has(e.defaultModeId)||t.addIssue({code:`custom`,message:`Default Permission Mode must exist in the catalog`,path:[`defaultModeId`]})});H({threadId:K,permissionModeId:nl}).strict();let il=R().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`});H({sourceThreadId:K,lastTurnId:$c.optional(),targetHarnessId:Qc,targetModel:il.max(1024).optional(),targetThinkingOptionId:il.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).optional()}).strict();let al=H({sourceThreadId:K,sourceHarnessId:Qc,sourceHarnessLabel:il.max(256).optional(),sourceModel:il.max(1024).optional(),targetHarnessId:Qc,targetHarnessLabel:il.max(256).optional(),targetModel:il.max(1024).optional(),totalTurns:z().int().min(1),boundaryTurnNumber:z().int().min(1),includedTurnNumbers:V(z().int().min(1)),omittedTurns:z().int().min(0),preview:R().max(32e3),createdAtMs:z().int().nonnegative()}).strict();H({threadId:K,handoff:al}).strict();let ol=R().regex(/^[a-z0-9][a-z0-9-]{0,63}$/u),sl=R().min(1).max(512).refine(e=>!/\p{Cc}/u.test(e),`Role model must not contain control characters`),cl=W([`stone`,`rose`,`mist`,`sage`,`amber`,`aqua`]),ll=jc([`builtin:`,W([`pm-otter`,`frontend-otter`,`backend-otter`,`reviewer-otter`,`idea-otter`,`researcher-otter`,`writer-otter`,`architect-otter`,`debugger-otter`,`tester-otter`,`classic-otter`,`ops-otter`,`security-otter`,`audio-otter`,`scholar-otter`,`data-otter`])]),ul=/^[a-zA-Z0-9_-]{1,64}\.(png|jpg|jpeg|webp)$/u,dl=jc([`custom:`,R().regex(ul)]),fl=jc([`catalog:`,R().regex(ul)]),pl=$s([ll,dl]),ml=$s([ll,fl]),hl=$s([pl,fl]),gl=R().url().max(2048).refine(e=>/^https:\/\//i.test(e),`URL must use https://`),_l=H({en:R().trim().min(1).max(2e3),"zh-CN":R().trim().min(1).max(2e3)}),vl=H({slug:ol,name:_l,description:_l,avatar:ml,accentColor:cl,recommendedHarnessId:Qc.optional(),author:R().trim().min(1).max(128),authorUrl:gl.optional(),sourceUrl:gl.optional(),license:R().trim().min(1).max(64).optional(),official:B().optional(),instructions:R().trim().min(1).max(1e5),updatedAt:Rc()});H({formatVersion:G(1),generatedAt:Rc(),roles:V(vl)});let yl=H({slug:ol,name:R().refine(e=>e.trim().length>0),avatar:pl,accentColor:cl}),bl=yl.readonly(),xl=yl.extend({description:R(),harnessId:Qc,model:sl.optional(),thinkingOptionId:el.optional(),instructions:R(),updatedAt:Rc()});xl.omit({updatedAt:!0,avatar:!0}).extend({avatar:hl}).partial({slug:!0}),H({locale:R().trim().min(1).max(64).optional()}),H({roles:V(xl)}),H({slug:ol}),H({role:xl.nullable()}),H({role:xl}),H({deleted:B()}),H({refresh:B().optional()}),H({roles:V(vl),fetchedAt:Rc(),likes:sc(ol,z().int().nonnegative()).optional(),myLikes:sc(ol,z().int().min(0).max(5)).optional(),stale:B().optional(),error:R().optional()}),H({slug:ol}),H({slug:ol,likes:z().int().nonnegative(),myLikes:z().int().min(0).max(5),maxLikes:G(5),limitReached:B().optional()});let Sl=z().int().safe().nonnegative(),Cl=z().finite().nonnegative(),wl=z().finite().min(0).max(100),Tl=H({version:$s([G(3),G(4)]).optional(),requestId:R().min(1),turnId:R().min(1).max(1024),outputTokens:Sl,startedAtMs:Sl,completedAtMs:Sl}).strict().refine(e=>e.completedAtMs>e.startedAtMs),El=H({version:$s([G(2),G(3),G(4)]).optional(),value:Cl,turnId:R().min(1).max(1024),at:Sl}).strict();H({outputTimings:V(Tl).transform(e=>e.filter(e=>e.version===4)).optional(),outputTokensPerSecond:El.refine(e=>e.version===4).optional().catch(void 0),timeToFirstOutputMs:El.extend({value:Sl}).optional()}).strict();let Dl=e=>Xc.refine(t=>Object.values(t).every(t=>t.length<=e)),Ol=H({composerIndicators:V(H({kind:G(`countdown`),id:R().min(1).max(64),expiresAtUnix:Sl,label:Dl(256).optional(),tooltip:Dl(1024).optional()}).strict()).max(2).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,{message:`Composer indicator IDs must be unique`}).optional(),inputTokens:Sl.optional(),cachedInputTokens:Sl.optional(),cacheWriteInputTokens:Sl.optional(),outputTokens:Sl.optional(),outputTokensPerSecond:Cl.optional(),sessionOutputTokensPerSecond:Cl.optional(),apiOutputTokensPerSecond:Cl.optional(),reasoningOutputTokens:Sl.optional(),totalTokens:Sl.optional(),totalCostUsd:Cl.optional(),totalCredits:Cl.optional(),contextUsagePercent:Cl.optional(),cacheHitRatePercent:wl.optional(),contextWindowTokens:Sl.optional(),contextUsedTokens:Sl.optional(),planFiveHourUsedPercent:wl.optional(),planFiveHourResetsAtUnix:Sl.optional(),planSevenDayUsedPercent:wl.optional(),planSevenDayResetsAtUnix:Sl.optional(),sessionCacheHitRatePercent:wl.optional(),timeToFirstOutputMs:Sl.optional(),latestRequestTimeToFirstOutputMs:Sl.optional(),costSource:W([`publicPrice`,`native`]).optional(),unpricedModels:V(R().min(1)).min(1).optional()}).strict().superRefine((e,t)=>{Object.keys(e).length===0&&t.addIssue({code:`custom`,message:`Thread Usage must contain a reliable field`});let n=e.contextUsedTokens!==void 0;n!==(e.contextWindowTokens!==void 0)&&t.addIssue({code:`custom`,message:`Thread Usage context fields must be provided together`,path:[n?`contextWindowTokens`:`contextUsedTokens`]}),e.contextWindowTokens===0&&t.addIssue({code:`custom`,message:`Thread Usage contextWindowTokens must be greater than zero`,path:[`contextWindowTokens`]}),e.costSource!==void 0&&e.totalCostUsd===void 0&&t.addIssue({code:`custom`,message:`Thread Usage costSource must be provided with totalCostUsd`,path:[`costSource`]}),e.unpricedModels!==void 0&&e.costSource!==`publicPrice`&&t.addIssue({code:`custom`,message:`Thread Usage unpricedModels must be provided with a publicPrice cost`,path:[`unpricedModels`]}),e.planFiveHourResetsAtUnix!==void 0&&e.planFiveHourUsedPercent===void 0&&t.addIssue({code:`custom`,message:`Thread Usage planFiveHourResetsAtUnix must be provided with planFiveHourUsedPercent`,path:[`planFiveHourResetsAtUnix`]}),e.planSevenDayResetsAtUnix!==void 0&&e.planSevenDayUsedPercent===void 0&&t.addIssue({code:`custom`,message:`Thread Usage planSevenDayResetsAtUnix must be provided with planSevenDayUsedPercent`,path:[`planSevenDayResetsAtUnix`]})}),kl=z().finite().min(0).max(100),Al=W([`weekly`,`monthly`,`five_hour`,`seven_day`,`unknown`]),jl=H({id:R().min(1).max(256),label:R().min(1).max(256),localizations:Yc.optional()}).strict(),Ml=H({product:R().min(1),periodType:Al.optional(),scope:jl.optional(),localizations:Yc.optional(),used:z().finite().nonnegative().optional(),limit:z().finite().nonnegative().optional(),unit:R().min(1).max(32).optional(),usagePercent:kl,resetsAt:R().min(1).optional()}).strict(),Nl=H({availableCount:z().int().safe().positive(),nextExpiresAt:R().min(1).optional(),expiresAt:V(R().min(1)).min(1).max(32).optional()}).strict(),Pl=H({used:z().finite().nonnegative().optional(),limit:z().finite().nonnegative().optional(),unit:R().min(1).max(32).optional(),label:R().min(1).optional(),scope:jl.optional(),localizations:Yc.optional(),usedPercent:kl,resetsAt:R().min(1).optional(),periodType:Al,productUsage:V(Ml).min(1).optional(),resetCredits:Nl.optional()}).strict(),Fl=H({amount:z().finite().nonnegative(),currency:R().trim().min(1).max(8),label:R().trim().min(1).max(128).optional()}).strict();H({threadId:K,refresh:G(`exact`).optional()}).strict(),H({threadId:K,usage:Ol.nullable(),accountCredits:Pl.optional(),accountBalance:Fl.optional(),accountCreditsSupported:B().optional()}).strict();let Il=R().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),Ll=R().min(1).max(512).refine(e=>!/\p{Cc}/u.test(e),`Model Ref must not contain control characters`).brand(),Rl=W([`priority`,`ultrafast`]),zl=H({id:Ll,serviceTier:Rl.optional()}).strict();function Bl(e,t){return e?.id===t?.id&&e?.serviceTier===t?.serviceTier}let Vl=Il.max(256),Hl=H({id:el,label:Il.max(256)}).strict(),Ul=H({ref:zl,label:Il.max(256),resolvedModelLabel:Vl.optional(),fastModel:zl.optional(),supportedThinkingOptionIds:V(el).optional()}).strict().refine(e=>e.fastModel?.serviceTier===void 0||e.fastModel.id===e.ref.id,{path:[`fastModel`,`id`],message:`A tiered Fast Model must share the base Model ID`});function Wl(e,t){if(t)return e?.models.find(e=>Bl(e.ref,t)||Bl(e.fastModel,t))}let Gl=V(Hl).superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Thinking option IDs must be unique`,path:[r,`id`]}),n.add(i.id)}),Kl=W([`catalog`,`activeModel`]),ql=H({models:V(Ul),defaultModel:zl.optional(),thinkingOptions:Gl,defaultThinkingOptionId:el.optional(),thinkingOptionsScope:Kl.optional()}).strict().superRefine((e,t)=>{let n=[],r=new Set(e.thinkingOptions.map(({id:e})=>e));for(let[i,a]of e.models.entries()){n.some(e=>Bl(e,a.ref))&&t.addIssue({code:`custom`,message:`Model Catalog refs must be unique`,path:[`models`,i,`ref`,`id`]}),n.push(a.ref),a.fastModel&&(n.some(e=>Bl(e,a.fastModel))&&t.addIssue({code:`custom`,message:`Fast Model refs must be distinct and unique`,path:[`models`,i,`fastModel`]}),n.push(a.fastModel));let e=/* @__PURE__ */ new Set;for(let[n,o]of(a.supportedThinkingOptionIds??[]).entries())e.has(o)&&t.addIssue({code:`custom`,message:`Supported Thinking option IDs must be unique per Model`,path:[`models`,i,`supportedThinkingOptionIds`,n]}),e.add(o),r.has(o)||t.addIssue({code:`custom`,message:`Supported Thinking option must exist in the catalog`,path:[`models`,i,`supportedThinkingOptionIds`,n]})}e.defaultModel&&!Wl(e,e.defaultModel)&&t.addIssue({code:`custom`,message:`Default Model must exist in the Model Catalog`,path:[`defaultModel`,`id`]}),e.defaultThinkingOptionId&&!r.has(e.defaultThinkingOptionId)&&t.addIssue({code:`custom`,message:`Default Thinking option must exist in the catalog`,path:[`defaultThinkingOptionId`]})}),Jl=H({fork:B(),forkAcrossCwd:B(),rollbackLastTurn:B()}).strict().refine(e=>e.fork||!e.forkAcrossCwd,{path:[`forkAcrossCwd`],message:`Cross-cwd Fork requires exact history Fork support`}),Yl=W([`live`,`atCreate`]),Xl=H({configuration:H({selectModel:B(),selectThinkingOption:B(),selectPermissionMode:B(),permissionModeScope:Yl.default(`live`)}).strict(),history:Jl,subagents:H({observe:B(),readTranscript:B()}).strict().optional(),autonomousTurns:H({observe:B()}).strict().optional(),steer:B().optional(),persistentPlan:B().optional()}).strict();H({effectiveModel:zl.optional(),resolvedModelLabel:Vl.optional(),effectiveThinkingOptionId:el.optional(),availableThinkingOptions:Gl.optional(),effectivePermissionModeId:nl.optional()}).strict().superRefine((e,t)=>{e.effectiveThinkingOptionId&&e.availableThinkingOptions&&!e.availableThinkingOptions.some(({id:t})=>t===e.effectiveThinkingOptionId)&&t.addIssue({code:`custom`,message:`Effective Thinking option must be currently available`,path:[`effectiveThinkingOptionId`]})});let Zl=H({open:G(!0)}).strict();$s([H({status:G(`ready`),catalog:ql,permissionModes:rl.optional(),capabilities:Xl,webUi:Zl.optional()}).strict().superRefine((e,t)=>{let n=e.capabilities.configuration.selectPermissionMode;n!==!!e.permissionModes&&t.addIssue({code:`custom`,message:`Permission Mode catalog and capability must agree`,path:n?[`permissionModes`]:[`capabilities`,`configuration`,`selectPermissionMode`]})}),H({status:W([`notInstalled`,`unavailable`,`error`]),error:Kc}).strict()]),H({harnessId:Qc,cwd:Il.max(16384).optional(),refresh:B().optional(),purpose:G(`availability`).optional(),credentialAccess:W([`allow`,`retry`]).optional()}).strict(),H({harnessId:Qc}).strict(),H({}).strict(),H({threadId:K,model:zl}).strict(),H({threadId:K,thinkingOptionId:el}).strict(),H({threadId:K,includeReferenceCapability:B().optional()}).strict(),tc(`owner`,[H({owner:G(`codex`),locked:B(),effectiveModel:zl.optional(),resolvedModelLabel:Vl.optional(),effectiveThinkingOptionId:el.optional(),effectivePermissionModeId:nl.optional(),history:Jl.optional(),supportsThreadReferences:G(!0).optional(),handoff:al.optional(),roleSnapshot:bl.optional(),nativeSessionRef:Ys().optional()}),H({owner:G(`external`),harnessId:Il.max(256),transportModelId:Il.max(8192),effectiveModel:zl.optional(),resolvedModelLabel:Vl.optional(),effectiveThinkingOptionId:el.optional(),availableThinkingOptions:Gl.optional(),effectivePermissionModeId:nl.optional(),catalog:ql.optional(),history:Jl,usage:Ol.optional(),handoff:al.optional(),roleSnapshot:bl.optional(),nativeSessionRef:Ys().optional(),locked:G(!0)})]),H({threadIds:V(K).min(1).max(100)}).strict().superRefine(({threadIds:e},t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i)&&t.addIssue({code:`custom`,message:`Thread ownership-list IDs must be unique`,path:[`threadIds`,r]}),n.add(i)});let Ql=tc(`owner`,[H({threadId:K,owner:G(`codex`)}).strict(),H({threadId:K,owner:G(`external`),harnessId:R().max(256).pipe(Qc)}).strict()]);H({threads:V(Ql).min(1).max(100)}).strict().superRefine(({threads:e},t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i.threadId)&&t.addIssue({code:`custom`,message:`Thread ownership-list results must be unique`,path:[`threads`,r,`threadId`]}),n.add(i.threadId)}),H({threadId:K,text:R().optional()}).strict(),H({kind:G(`application`),value:R().transform((e,t)=>{try{return JSON.parse(e)}catch{return t.addIssue({code:`custom`,message:`Invalid steering context JSON`}),He}}).pipe(H({expectedTurnId:$c,clientUserMessageId:R().min(1),delivery:W([`newTurn`,`activeTurn`])}).strict())}).strict().transform(e=>e.value),W([`activeTurn`,`newTurn`]),H({delivery:W([`official`,`activeTurn`,`newTurn`])}).strict();let $l=R().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u),eu=$l.pipe(Qc),tu=eu.refine(e=>e!==`codex`,`The official Codex identity is reserved`),nu=R().min(1).max(512).refine(e=>!/[\\\u0000:#?]/u.test(e)&&!e.startsWith(`/`)&&!e.split(`/`).some(e=>e===`..`||e===``),`Plugin resources must be relative paths inside the plugin`),ru=ws().refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Plugin documentation links must be credential-free HTTPS URLs`),iu=H({en:R().max(4096),"zh-CN":R().max(4096).optional()}).strict(),au=H({commands:V(H({terminal:R().max(256),command:R().max(4096)}).strict()).max(8),before:iu.optional(),after:iu.optional(),downloads:V(H({label:R().max(128),url:ru}).strict()).max(8).optional()}).strict(),ou={id:eu,name:R().trim().min(1).max(128),version:R().min(1).max(128),kind:G(`usage`).optional(),iconStyle:H({vector:H({viewBox:R().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),color:R().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),paths:V(H({d:R().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),fillRule:W([`evenodd`,`nonzero`]).optional(),fill:R().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()}).strict()).min(1).max(32)}).strict().optional(),background:R().regex(/^#[a-f0-9]{6}$/iu).optional(),borderRadius:z().min(0).max(50).optional(),paddingRatio:z().min(0).max(.25).optional()}).strict().optional(),installation:au.optional(),notice:iu.optional(),launchCommand:G(!0).optional(),links:H({website:ru.optional(),documentation:ru.optional(),installation:ru.optional()}).strict().optional()};H({manifestVersion:G(1),...ou,adapterApiVersion:z().int().positive(),entry:nu,icon:nu.optional()}).strict();let su=R().max(174828).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u),cu=H({...ou,icon:su.optional()}).strict();H({}).strict(),H({plugins:V(cu.extend({id:tu})).max(128)}).strict(),H({version:G(1),enabled:V(eu).max(128)}).strict().refine(e=>new Set(e.enabled).size===e.enabled.length,{message:`Enabled plugin IDs must be unique`,path:[`enabled`]});let lu=131072,uu=524288,du=$l,fu=W([`sidebar.thread-layout`,`sidebar.thread-badge`,`appearance.theme`]),pu=W([`appearance`,`interface`,`workflow`,`analytics`,`integrations`,`tools`]),mu=R().trim().min(1).max(128);function hu(e){switch(e.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()){case`png`:return`image/png`;case`jpg`:case`jpeg`:return`image/jpeg`;case`webp`:return`image/webp`;default:return}}let gu=e=>e.split(`/`).every(e=>!/[. ]$/u.test(e)),_u=nu.refine(e=>hu(e)!==void 0&&gu(e),`Images must be relative .png, .jpg, .jpeg, or .webp paths with no segments ending in a dot or space`),vu=R().trim().max(2048).regex(/^https?:\/\/[^/?#\\\s]+/iu,`Expected an HTTP(S) URL`).pipe(ws({protocol:/^https?$/u})).refine(e=>{let{username:t,password:n}=new URL(e);return!t&&!n&&!/[\\\s]/u.test(e)},`URL must not contain credentials, backslashes, or whitespace`);function yu(e){return U({en:e,"zh-CN":e})}let bu=yu(R().trim().min(1)),xu=V(pu).max(pu.options.length).refine(e=>new Set(e).size===e.length,`Duplicate categories`),Su=V(fu).max(fu.options.length).refine(e=>new Set(e).size===e.length,`Duplicate slots`),Cu={key:R().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),label:bu,description:bu.optional()},wu={...Cu,step:z().positive().optional(),default:z().optional()},Tu=U({value:R(),label:bu}),Eu=tc(`type`,[U({...Cu,type:G(`boolean`),default:B().optional()}),U({...Cu,type:G(`string`),placeholder:bu.optional(),default:R().optional()}),U({...wu,type:G(`number`),min:z().optional(),max:z().optional()}),U({...wu,type:G(`range`),min:z(),max:z()}),U({...Cu,type:G(`select`),options:V(Tu).min(1),default:R().optional()})]).superRefine((e,t)=>{let n=(e,n)=>t.addIssue({code:`custom`,path:[e],message:n});if(e.type===`number`||e.type===`range`){let{min:t=-1/0,max:r=1/0,default:i}=e;t>r&&n(`max`,`Must be at least min`),i!==void 0&&(i<t||i>r)&&n(`default`,`Must be within min and max`)}else if(e.type===`select`){let t=new Set(e.options.map(({value:e})=>e));t.size!==e.options.length&&n(`options`,`Duplicate option values`),e.default!==void 0&&!t.has(e.default)&&n(`default`,`Must match an option value`)}}),Du=H({manifestVersion:Hs().positive(),id:du,name:$s([mu,yu(mu)]),version:R().min(1).max(128),desktopApi:Hs().positive()}).passthrough().extend({manifestVersion:G(1),desktopApi:G(1),description:U({en:R().max(4096),"zh-CN":R().max(4096).optional()}).optional(),author:R().trim().min(1).max(128).optional(),repository:vu.optional(),details:U({en:R().max(16384),"zh-CN":R().max(16384).optional()}).optional(),icon:_u.optional(),screenshots:V(_u).max(4).refine(e=>new Set(e).size===e.length,`Duplicate screenshots`).optional(),desktop:U({script:nu,style:nu.optional()}).optional(),backend:U({script:nu.refine(gu)}).optional(),slots:Su.default(()=>[]),settingsSchema:V(Eu).max(32).refine(e=>new Set(e.map(({key:e})=>e)).size===e.length,`Duplicate setting keys`).optional(),categories:xu.optional()}).strict().refine(e=>e.desktop!==void 0||e.backend!==void 0,`Expected at least one desktop or backend entry`),Ou=R().regex(/^[a-f0-9]{64}$/u),ku=U({state:W([`running`,`disabled`,`invalid`,`incompatible`,`conflict`,`failed`,`waiting`]),hash:Ou.optional(),error:R().optional(),conflictWith:du.optional()});U({controllerPid:Hs().positive(),targetId:R().nullable(),updatedAt:Rc(),handledReloadToken:xs().optional(),extensions:sc(R(),ku),surfaces:sc(R(),ku).optional()});let Au=W([`official`,`community`]);function ju(e){return e.origin===`https://api.github.com`&&/^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(e.pathname)}let Mu=vu.refine(e=>{let t=new URL(e);return/\.zip$/iu.test(t.pathname)||ju(t)||t.origin===`https://github.com`&&/^\/[\w-]+\/[\w.-]+\/zipball(?:\/.+)?\/?$/u.test(t.pathname)||t.origin===`https://codeload.github.com`&&/^\/[\w-]+\/[\w.-]+\/(?:zip|zipball|legacy\.zip)\/.+$/u.test(t.pathname)},`Expected a .zip download URL or a GitHub zipball URL`),Nu=U({id:du,version:R().trim().min(1).max(128),name:bu.extend({en:mu,"zh-CN":mu}),description:yu(R().trim().min(1).max(4096)),details:yu(R().trim().min(1).max(16384)).optional(),author:R().trim().min(1).max(128),repository:vu,stars:z().int().min(0).optional(),downloads:z().int().min(0).optional(),categories:xu.optional(),trustTier:Au.default(`community`),icon:vu.optional(),screenshots:V(vu).max(4).optional(),downloadUrl:Mu,sha256:Ou,slots:Su.optional(),publishedAt:R().optional(),updatedAt:R().optional(),minCodexHostVersion:R().optional()});U({schemaVersion:G(1),generatedAt:R(),extensions:V(Nu).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,`Duplicate extension IDs`)});let Pu=R().trim().min(1).max(128),Fu=/^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³]) *(?:\.|$)/iu,Iu=du.refine(e=>!Fu.test(e),`Reserved extension ID`),Lu=W([`desktop`,`web`]),Ru=Ou,zu=xs(),Bu=nu.refine(e=>!/[\x00-\x1f\x7f<>"|*]/u.test(e)&&e.split(`/`).every(e=>!/[. ]$/u.test(e)&&!Fu.test(e)),`Expected a portable relative resource path`).refine(e=>e.split(`/`).length<=32,`Extension resources may be at most 32 segments deep`),Vu=Du.shape,Hu=(e,t=0)=>U({en:R().trim().min(t).max(e),"zh-CN":R().trim().min(t).max(e)}),Uu=e=>Bu.refine(t=>t.endsWith(e),`Expected a ${e} file`),Wu=Uu(`.mjs`),Gu=Uu(`.css`).optional(),Ku=e=>e.normalize(`NFC`).toLowerCase(),qu=U({manifestVersion:G(2),id:Iu,name:Hu(128,1),version:R().trim().min(1).max(128),description:Hu(4096),details:Hu(16384).optional(),author:Vu.author,repository:Vu.repository,icon:Vu.icon.refine(e=>e===void 0||Bu.safeParse(e).success),screenshots:Vu.screenshots.refine(e=>e===void 0||e.every(e=>Bu.safeParse(e).success)),categories:Vu.categories,settingsSchema:Vu.settingsSchema,slots:Vu.slots.removeDefault().optional(),page:U({apiVersion:G(1),entry:Wu,style:Gu,title:Hu(128,1).optional()}).optional(),widget:U({apiVersion:G(1),entry:Wu,style:Gu}).optional(),desktop:U({apiVersion:G(1),script:Uu(`.js`),style:Gu}).optional(),web:U({apiVersion:G(1),entry:Wu.optional(),style:Gu}).refine(({entry:e,style:t})=>e!==void 0||t!==void 0,`Expected a Web entry or style`).optional(),backend:U({apiVersion:G(1),entry:Wu}).optional()}).refine(({page:e,widget:t,desktop:n,web:r,backend:i})=>!!(e||t||n||r||i),`Expected at least one page, widget, desktop, web, or backend entry`).refine(({page:e,widget:t,web:n,backend:r})=>!r||[e?.entry,t?.entry,n?.entry].every(e=>e===void 0||Ku(e)!==Ku(r.entry)),{path:[`backend`,`entry`],message:`A backend entry cannot also be a frontend entry`});function Ju({hasPage:e,hasWidget:t,hasDesktop:n,hasWeb:r,hasBackend:i}){if(e||t||i&&!n&&!r)return[`desktop`,`web`];let a=[];return n&&a.push(`desktop`),r&&a.push(`web`),a}let Yu=Pu,Xu=W([`running`,`waiting`,`idle`,`unknown`]),Zu=H({createdAtMs:z().int().nonnegative()}),Qu=U({sourceThreadId:K,createdAtMs:z().int().nonnegative()}),$u=U({harnessId:Qc,title:R().optional(),status:Xu,archived:B(),updatedAtMs:z().int().nonnegative().optional()}),ed=H({revision:Hs().nonnegative(),parents:sc(K,K),delegations:sc(K,Zu).optional(),handoffs:sc(K,Qu).optional(),nodes:sc(K,$u),truncated:B()}).refine(e=>Object.keys(e.nodes).length<=5e3,`Too many Thread tree nodes`).refine(({parents:e,handoffs:t,nodes:n})=>Object.entries(e).every(([e,t])=>Object.hasOwn(n,e)&&Object.hasOwn(n,t))&&Object.entries(t??{}).every(([e,{sourceThreadId:t}])=>Object.hasOwn(n,e)&&Object.hasOwn(n,t)),`Missing Thread tree node`).refine(({parents:e,delegations:t})=>Object.keys(t??{}).every(t=>Object.hasOwn(e,t)),`Delegation metadata requires a matching parent edge`),td=R().min(1).max(128);U({});let nd=U({subscriptionId:td});U({}),nd.extend({snapshot:ed});let rd=Hs().nonnegative(),id=U({revision:rd,enabled:V(Iu).max(64).refine(e=>new Set(e).size===e.length,`Duplicate extension IDs`)});U({version:G(1),seeded:V(Iu).max(64).refine(e=>new Set(e).size===e.length,`Duplicate extension IDs`)});let ad=H({version:R().trim().min(1).max(128),publishedAt:R().trim().min(1).max(64).optional(),notes:R().trim().min(1).max(8192),url:vu.optional()}),{downloadUrl:od,...sd}=Nu.shape,cd=H({...sd,id:Iu,format:G(`codexhost`),targets:V(Lu).min(1).max(2).refine(e=>new Set(e).size===e.length,`Duplicate targets`),apis:U({page:Hs().positive().optional(),widget:Hs().positive().optional(),desktop:Hs().positive().optional(),web:Hs().positive().optional(),backend:Hs().positive().optional()}),downloadUrl:od.refine(e=>e.startsWith(`https://`),`Expected HTTPS`),featured:B().optional(),featuredOrder:Hs().nonnegative().optional(),changelog:V(ad).max(20).optional()}).refine(({targets:e,apis:t})=>{let n=Ju({hasPage:!!t.page,hasWidget:!!t.widget,hasDesktop:!!t.desktop,hasWeb:!!t.web,hasBackend:!!t.backend});return e.length===n.length&&n.every(t=>e.includes(t))},`Catalog targets must match the declared APIs`);H({schemaVersion:G(2),generatedAt:R().min(1),extensions:V(cd).max(1e4).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,`Duplicate extension IDs`)}).extend({catalogUrl:vu,fetchedAt:Rc(),cached:B(),stale:B().optional()});let ld={id:Iu},ud={...ld,activationId:zu,digest:Ru},dd={...ld,activationId:ud.activationId.optional()},fd=R().min(1).max(4096).refine(e=>/^(?:\/|[a-z]:[/\\])/iu.test(e)&&!e.includes(`\0`)&&!e.split(/[/\\]/u).some(e=>e===`.`||e===`..`),`Expected an absolute local path without dot segments`),pd=R().min(1).max(256).refine(e=>e.split(`/`).every(e=>e&&/^[a-z0-9_.-]+$/iu.test(e)&&e!==`.`&&e!==`..`),`Invalid GitHub ref`);function md(e){return R().max(4*Math.ceil(e/3)).refine(t=>{let n=t.endsWith(`==`)?2:+!!t.endsWith(`=`);return t.length%4==0&&t.length*3/4-n<=e&&/^[A-Za-z0-9+/]*={0,2}$/u.test(t)},`Expected bounded standard padded base64`)}let hd=U({type:G(`github`),repository:R().max(150).regex(/^[a-z0-9-]+\/[a-z0-9_-][a-z0-9_.-]*$/iu),ref:pd.optional(),tag:pd.optional(),asset:R().max(255).regex(/^[a-z0-9_.-]+\.zip$/iu).optional(),subpath:Bu.optional()}).refine(({ref:e,tag:t,asset:n})=>!e||!t&&!n,`Use either a zipball ref or a release tag/asset`),gd=$s([U({type:G(`catalog`),...ld}),hd,U({type:G(`zip`),base64:md(67108864).min(4)}),U({type:G(`zip`),localZipPath:fd}),U({type:G(`localDir`),localDir:fd})]),_d=tc(`type`,[U({type:G(`catalog`),...ld}),hd,U({type:G(`zip`)}),U({type:G(`localDir`)})]),vd=U({...ud,manifest:qu,installedAt:Rc(),source:_d.optional()}),yd=e=>R().max(23+4*Math.ceil(e/3)).regex(/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/u),bd={desktopConflictWith:Iu.optional()},xd=W([`none`,`inactive`,`starting`,`running`,`failed`]),Sd=tc(`state`,[vd.extend({state:G(`valid`),enabled:B(),...bd,iconDataUrl:yd(lu).optional(),screenshotDataUrls:V(yd(uu)).max(4).optional(),backendState:xd.optional(),backendError:R().optional()}),U({state:W([`invalid`,`incompatible`]),id:R().min(1),enabled:B(),error:R()})]);U({revision:rd,configuration:id,diagnostics:V(R()),extensions:V(Sd)}),U({revision:rd,extensions:V(vd.extend({...bd,settingsRevision:rd})).max(64)});let Cd={list:`codexhost/extensions/list`,snapshot:`codexhost/extensions/snapshot`,catalog:`codexhost/extensions/catalog`,catalogIcon:`codexhost/extensions/catalogIcon`,catalogScreenshot:`codexhost/extensions/catalogScreenshot`,install:`codexhost/extensions/install`,update:`codexhost/extensions/update`,enable:`codexhost/extensions/enable`,disable:`codexhost/extensions/disable`,uninstall:`codexhost/extensions/uninstall`,recover:`codexhost/extensions/recover`,asset:`codexhost/extensions/asset`,settingsGet:`codexhost/extensions/settings/get`,settingsSet:`codexhost/extensions/settings/set`,backendInvoke:`codexhost/extensions/backend/invoke`,threadTree:`codexhost/extensions/threadTree`},wd=Object.freeze(Object.values(Cd));new Set(wd),U({});let Td={expectedRevision:rd};U({...ld,...Td}),vd.extend({replaced:B()}),tc(`state`,[U({state:G(`saved`),configuration:id}),U({state:G(`revision-conflict`),revision:rd})]),U({...dd,digest:ud.digest.optional(),path:Bu}),U({mimeType:R().min(1),base64:md(16777216),digest:ud.digest}),U({mimeType:W([`image/png`,`image/jpeg`,`image/webp`]),base64:md(lu)});let Ed=Hs().min(0).max(3);U({mimeType:W([`image/png`,`image/jpeg`,`image/webp`]),base64:md(uu)}),U({settingsRevision:rd,values:Gc}),Cd.list,Cd.snapshot,Cd.catalog,U({forceRefresh:B().optional(),staleWhileRevalidate:B().optional()}),Cd.catalogIcon,U({...ld}),Cd.catalogScreenshot,U({...ld,index:Ed}),Cd.install,U({source:gd}),Cd.update,U({...ld,expectedDigest:ud.digest,expectedActivationId:ud.activationId.optional(),source:gd.optional()}),Cd.enable,Cd.disable,Cd.uninstall,U({...ld,removeData:B().optional(),expectedDigest:ud.digest.optional()}),U({...ld,removed:B()}),Cd.recover,U({expectedRevision:Td.expectedRevision.optional()}),Cd.asset,Cd.settingsGet,U(dd),Cd.settingsSet,U({...dd,expectedSettingsRevision:rd,values:Gc}),Cd.backendInvoke,U({...dd,method:Yu,params:Wc.optional()}),U({result:Wc}),Cd.threadTree;let Dd=R().regex(/^remote:[A-Za-z0-9_-]{8,512}$/u),Od=$s([Ss(),Dd]),kd=Ss(),Ad=R().regex(/^[a-z0-9][a-z0-9_-]{0,47}$/u),jd=W([`none`,`last_speaker`,`all`]),Md=W([`active`,`muted`,`removed`]),Nd=Hs().nonnegative(),Pd=Hs().positive(),Fd=Pd.max(20),Id=R().refine(e=>e.trim().length>0),Ld=Rc(),Rd={handle:Ad.optional(),displayName:Id.optional(),note:R().optional()},zd=H({memberId:kd,threadId:K,handle:Ad,displayName:Id,note:R().optional(),roleSlug:ol.optional(),roleSnapshot:bl.optional(),harnessId:Qc,status:Md,joinedAtSeq:Nd,lastDeliveredSeq:Nd,lastRosterVersion:Nd,createdAt:Ld}),Bd=H({hostId:Id,displayName:Id,state:Id.optional(),color:R().optional(),filePreview:B().optional()}),Vd=H({roomId:Od,title:Id,defaultCwd:Id,unmentionedPolicy:jd.default(`none`),allowAgentMentions:B().default(!0),maxAgentHops:Fd.default(5),lastSeq:Nd,lastSpeakerMemberId:kd.optional(),rosterVersion:Nd,humanEpoch:Nd,relayPaused:B(),pinned:B(),createdAt:Ld,updatedAt:Ld,members:V(zd),remote:Bd.optional()}).superRefine(({members:e},t)=>{let n=/* @__PURE__ */ new Set;for(let[r,{handle:i,status:a}]of e.entries())a!==`removed`&&(n.has(i)&&t.addIssue({code:`custom`,path:[`members`,r,`handle`],message:`Handle must be unique among non-removed members`}),n.add(i))}),Hd=H({kind:W([`image`,`file`]),attachmentId:Id.max(256),name:Id.max(256),path:Id.max(4096),bytes:Nd,mediaType:Id.max(128).optional(),width:Pd.optional(),height:Pd.optional()}),Ud=H({roomId:Od,seq:Pd,messageId:Id,senderType:W([`user`,`agent`,`system`]),senderMemberId:kd.optional(),senderHandle:Ad.optional(),senderName:R().optional(),senderThreadId:K.optional(),sourceTurnId:Id.optional(),replyToSeq:Pd.optional(),content:R(),attachments:V(Hd).max(12).optional(),mentionedMemberIds:V(kd),mentionAll:B().optional(),hopCount:Nd,createdAt:Ld}),Wd={...Rd,model:sl.optional(),thinkingOptionId:el.optional(),worktree:B().optional()},Gd=tc(`kind`,[U({kind:G(`role`),roleSlug:ol,...Wd}),U({kind:G(`harness`),harnessId:Qc,...Wd}),U({kind:G(`existing`),threadId:K,...Rd,includeRecentHistory:B().default(!0).optional()})]),Kd={roomId:Od},qd={...Kd,memberId:kd},Jd={title:Id.optional(),unmentionedPolicy:jd.optional(),allowAgentMentions:B().optional(),maxAgentHops:Fd.optional()};U({}),H({rooms:V(Vd)}),U({...Kd,limit:Pd.optional(),beforeSeq:Pd.optional()}),H({room:Vd.nullable(),messages:V(Ud),hasMore:B()}),U({...Jd,defaultCwd:Id,members:V(Gd)}),H({room:Vd}),U({...Kd,...Jd,pinned:B().optional(),relayPaused:B().optional()}),U(Kd),H({deleted:B()}),U({...Kd,member:Gd}),H({room:Vd,member:zd}),U({...qd,...Rd,status:Md.optional()}),U(qd),U({...Kd,content:R().max(64e3),attachments:V(Hd).max(12).optional(),replyToSeq:Pd.optional(),targetMemberIds:V(kd).optional(),mentionAll:B().optional()}).refine(e=>e.content.trim().length>0||(e.attachments?.length??0)>0,`Message content or at least one attachment is required`),H({room:Vd,message:Ud,awakenedMemberIds:V(kd)}),U({...Kd,fromSeq:Pd.optional(),toSeq:Pd.optional(),limit:Pd.optional()}),H({...Kd,messages:V(Ud),totalSeq:Nd}),H({threadId:K}).strict(),H({confirmed:B()}).strict();let Yd=[`codex-desktop`,`web`,`web-desktop-shell`,`web-mobile`,`ssh-remote`,`cli`],Xd=[`darwin`,`win32`,`linux`],Zd=[`arm64`,`x64`,`ia32`,`arm`],Qd=[`zh`,`en`,`ja`,`ko`,`de`,`fr`,`es`,`pt`,`ru`,`other`],$d=[`codex`,`claude-code`,`antigravity`,`pi`,`opencode`,`cursor-cli`,`deepseek-harness`,`grok`,`omp`,`qwen-code`,`kiro-cli`,`codebuddy`,`workbuddy`,`devin`,`hermes`,`qoder`,`qoder-cn`,`kimi-code`,`zcode`,`copilot`,`custom`],ef=[`official-relay`,`self-hosted-relay`,`tailscale-serve`,`tailscale-funnel`,`tailscale-ip`,`lan`,`custom-proxy`,`remote-peer`],tf=R().min(1).max(40).regex(/^[0-9A-Za-z._+-]+$/u),nf=W(Yd),rf=W(Qd),af=W($d),of=W(ef);new Set($d),new Set(Qd),H({enabled:B(),forcedOffByEnv:B()}).strict(),H({enabled:B()}).strict(),H({surfaces:V(nf).max(12).optional(),harnesses:V(af).max(32).optional(),remoteAccess:V(of).max(12).optional()}).strict(),H({dailyActive:G(!0).optional(),weeklyActive:G(!0).optional(),monthlyActive:G(!0).optional(),newInstall:G(!0).optional(),retainedD1:G(!0).optional(),retainedD7:G(!0).optional(),remoteAny:G(!0).optional(),appVersion:tf.optional(),codexDesktopVersion:tf.optional(),os:W(Xd).optional(),arch:W(Zd).optional(),uiLanguage:rf.optional(),surfaces:V(nf).min(1).max(12).optional(),harnesses:V(af).min(1).max(32).optional(),remoteAccess:V(of).min(1).max(12).optional()}).strict().refine(e=>Object.keys(e).length>0,{message:`Telemetry heartbeat must contain at least one countable field`});let sf=4e3,cf={threadId:K};tc(`action`,[U({...cf,action:W([`get`,`pause`,`resume`,`clear`])}),U({...cf,action:W([`create`,`edit`]),objective:R().trim().min(1).refine(e=>Array.from(e).length<=sf,`A goal objective can have up to ${sf} characters.`)})]),H({goal:H({threadId:K,objective:R(),status:W([`active`,`paused`,`blocked`,`usageLimited`,`budgetLimited`,`complete`]),tokenBudget:Hs().positive().nullable().default(null),tokensUsed:Hs().nonnegative(),timeUsedSeconds:Hs().nonnegative()}).nullable()});let lf=R().trim().min(1),uf=R().min(1),df=H({icon:R().nullable(),color:R().nullable()}),ff=df.nullable(),pf={create:{method:`codexhost/thread/sections/create`,params:H({name:lf}).strict()},update:{method:`codexhost/thread/sections/update`,params:H({sectionId:uf,name:lf,appearance:df.strict().nullable().optional()}).strict()},delete:{method:`codexhost/thread/sections/delete`,params:H({sectionId:uf}).strict()}};tc(`status`,[H({status:G(`unknown`)}),H({status:G(`confirmed`),sectionId:uf,section:H({id:uf,name:R().min(1),appearance:ff}).nullable(),syncPending:B()})]),[pf.create.method,pf.update.method,pf.delete.method,...wd],H({threadSectionsV1:G(!0).optional(),complete:G(!1).optional(),sections:V(H({id:R().min(1),name:R().min(1),appearance:ff.optional(),threads:V(Gc)}))}),H({threadId:R().min(1).max(1024),sectionId:R().min(1).max(1024).nullable(),beforeThreadId:R().min(1).max(1024).nullable().optional(),expectedSourceSectionId:R().min(1).max(1024).optional()}).refine(e=>e.expectedSourceSectionId===void 0||e.sectionId===null),H({threadIds:V(R().min(1))}).strict(),H({threadId:R().min(1).max(1024),pinned:B()}).strict(),H({}).strict(),H({parents:sc(R().min(1),R().min(1))}).strict(),H({prompt:R().max(16384).optional()}).strict(),H({projects:V(H({id:R(),name:R(),rootPaths:V(R()),createdAt:z().int().optional()})),nativeProjects:G(!0).optional(),assignments:sc(R(),R()),projectless:V(R()),pinned:V(R()),sectionProjects:sc(R(),V(R())).optional(),pinnedProjects:V(R()).optional()});let mf=sc(R(),qs()),hf=H({epoch:R().uuid(),sequence:z().int().nonnegative()});tc(`type`,[H({type:G(`projects-changed`),cursor:hf}),H({type:G(`skills-changed`),cursor:hf,cwd:R().optional()}),H({type:G(`harness-inspection-changed`),cursor:hf,harnessId:R().min(1)}),H({type:G(`display-settings-changed`),cursor:hf}),H({type:G(`sections-changed`),cursor:hf}),H({type:G(`groups-changed`),cursor:hf,roomId:R().optional()}),H({type:G(`preferences-changed`),cursor:hf,revision:z().int().nonnegative()}),H({type:G(`extensions-changed`),cursor:hf,revision:rd}),H({type:G(`hello`),version:G(1),cursor:hf,reset:B()}),H({type:G(`changed`),cursor:hf,threadId:R().min(1),method:R().min(1)})]);let gf=tc(`type`,[H({type:G(`text`),id:R(),prompt:R(),secret:B().optional(),optional:B().optional()}),H({type:G(`choice`),id:R(),prompt:R(),multiple:B(),allowOther:B(),optional:B().optional(),options:V(H({value:R(),label:R(),description:R().optional()}))})]),_f=tc(`type`,[H({type:G(`approval`),title:R(),description:R().optional(),subject:qs().optional(),actions:V(H({id:R(),label:R(),effect:R()}))}),H({type:G(`question`),title:R().optional(),questions:V(gf)})]),vf=H({requestId:$s([R(),z().int()]),threadId:R(),kind:W([`approval`,`question`]),interaction:_f,request:mf}),yf=H({id:R().min(1),clientUserMessageId:R().min(1),input:V(mf),presentationInput:V(mf).nullable().optional()}).passthrough();H({fields:V(H({path:V($s([R(),z().int().nonnegative()])),originalLength:z().int().nonnegative()}))});let bf=H({id:R().min(1),status:R().min(1),codexhostTurnOutcome:H({status:G(`unknown`),reason:R()}).optional(),items:V(H({id:R().min(1),type:R().min(1)}).passthrough()),codexhostFileOperations:V(H({beforeItemId:R().nullable(),item:H({id:R().min(1),type:R().min(1)}).passthrough()})).optional(),error:H({message:R().optional()}).passthrough().nullable().optional(),fingerprint:R().min(1).optional(),unchanged:G(!0).optional()}).passthrough(),xf=H({id:R().min(1).max(512),fingerprint:R().min(1).max(128)});H({threadId:R().min(1),knownTurns:V(xf).max(64).optional(),truncateToolOutput:B().optional()});let Sf=H({harnessId:R().min(1),nativeSessionId:R().min(1)});H({cursor:hf,activeTurnId:R().min(1).nullable().optional(),command:H({name:R().min(1),turn:bf,subsequentTurnId:R().min(1).optional()}).optional(),thread:H({id:R().min(1),cwd:R(),modelProvider:R().min(1),createdAt:z(),updatedAt:z(),recencyAt:z().nullable().optional(),status:H({type:R()}).passthrough(),name:R().nullable().optional(),preview:R().optional(),roleSnapshot:bl.optional(),codexhostImportSource:Sf.optional(),turns:V(bf).length(0)}).passthrough(),turnsPage:H({data:V(bf).max(5),nextCursor:R().nullable()}),configuration:H({codexCollaborationMode:W([`plan`,`default`]).optional(),native:H({model:R().min(1).max(1024).optional(),reasoningEffort:R().min(1).max(128).optional()}).optional(),effectiveModel:zl.optional(),effectiveThinkingOptionId:el.optional(),effectivePermissionModeId:nl.optional()}),queue:H({items:V(yf),pausedReason:W([`interrupted`,`outcome-unknown`,`failed`]).nullable()}).optional(),interactions:V(vf),handoff:al.optional()}),H({version:G(1),owner:G(`service`).optional(),pid:z().int().positive(),port:z().int().min(1).max(65535),token:R().regex(/^[0-9a-f]{64}$/u),startedAt:z(),epoch:R().uuid(),capabilities:H({peerDelegation:G(1).optional(),threadReferenceContext:G(1).optional()}).optional()}),H({epoch:R().uuid(),threadId:R().min(1),requestId:$s([R(),z().int()]),result:mf}),H({includeArchived:B().optional(),officialCursor:H({live:R().nullable(),archived:R().nullable().optional()}).strict().optional(),scope:$s([H({cwd:R().min(1).max(4096),excludeCwds:V(R().min(1).max(4096)).max(1024)}).strict(),H({projectId:R().min(1).max(1024),legacyThreadIds:V(R().min(1).max(1024)).max(1024),rootPaths:V(R().min(1).max(4096)).max(1024).optional()}).strict()]).optional()}).strict(),H({threads:V(Gc),ownership:V(Ql),archivedThreadIds:V(K),officialCursor:H({live:R().nullable(),archived:R().nullable().optional()}).strict().optional()}).strict(),cu.pick({id:!0,name:!0,icon:!0,iconStyle:!0});let Cf=U({threadId:R().max(1024),title:R().max(240),project:R().max(240),harness:U({id:R().min(1).max(128),name:R().min(1).max(128)}).optional(),state:W([`idle`,`running`,`waiting`,`completed`,`failed`]),updatedAt:z().nonnegative()});U({epoch:R().max(128),revision:Hs().nonnegative(),running:Hs().nonnegative(),waiting:Hs().nonnegative(),sessions:V(Cf).max(32).default([]),notifications:V(U({threadId:R().max(1024),key:R().max(4096),kind:W([`completed`,`failed`,`approval`,`question`]),revision:Hs().nonnegative()})).max(256)});let wf=R().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);H({available:B()}).strict(),H({path:R().min(1),mimeType:wf}).strict();let Tf=W([`credentials-unavailable`,`login-expired`,`rate-limited`,`service-rejected`,`host-incompatible`,`network`,`timeout`,`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`]);tc(`ok`,[H({ok:G(!0),text:R()}).strict(),H({ok:G(!1),error:H({code:Tf}).strict()}).strict()]),H({threadId:K.optional(),cwd:R().min(1).optional()}).strict().refine(e=>!(e.threadId&&e.cwd),{message:`Specify threadId or cwd, not both`});let Ef=H({name:R().min(1).regex(/^[^\s[\]]+$/u),description:R().optional(),path:R().min(1),scope:W([`project`,`global`]),source:R().min(1)}).strict();H({revision:z().int().nonnegative(),complete:B(),skills:V(Ef),warnings:V(R()).optional()}).strict(),H({cwd:R().min(1).optional()}).strict();let Df=H({kind:W([`public`,`relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`]),url:R().min(1)}).strict(),Of=tc(`status`,[H({status:G(`not-installed`)}),H({status:G(`not-running`)}),H({status:G(`not-logged-in`)}),H({status:G(`https-disabled`)}),H({status:G(`not-serving`),command:R()}),H({status:G(`occupied`),target:R()}),H({status:G(`serving`),url:R(),funnel:B()}),H({status:G(`error`),message:R()})]);H({state:Of,error:R().optional()}).strict();let kf=tc(`status`,[H({status:G(`on`)}),H({status:G(`off`)}),H({status:G(`invalid`),reason:R()})]),Af=H({lan:B(),autostart:kf}).strict(),jf=H({expiresAt:R().optional(),issuing:B(),failure:H({detail:R().optional(),retryAt:R(),paused:B()}).optional()}),Mf=tc(`status`,[H({status:G(`off`),reason:W([`invite`,`name-taken`,`banned`]).optional()}),H({status:G(`connecting`),reason:W([`full`,`unreachable`]).optional()}),H({status:G(`connected`),url:R(),certificate:jf}),H({status:G(`missing-certificate`),url:R(),certificate:jf}),H({status:G(`stopped`),reason:W([`replaced`,`rejected`,`unsupported-version`])})]);R().max(253).regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/i).transform(e=>e.toLowerCase()),R().regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)?$/);let Nf=W([`official`,`self-hosted`]);H({secret:R().min(1),lastUsedAt:z().nullable(),networkUrls:V(Df),directCandidates:V(Df).optional(),tailscale:Of,background:Af.optional(),relay:H({state:Mf,enabled:B(),kind:Nf,officialHost:R(),customHost:R().optional(),officialHostname:R().optional(),customHostname:R().optional(),quotaUntil:R().optional()}).strict().optional()}).strict();let Pf=U({threadId:R().min(1).max(1024),view:W([`result`,`messages`]),from:z().int().min(1).max(2**53-1).optional(),to:z().int().min(1).max(2**53-1).optional()}),Ff=/^[a-zA-Z0-9_-]{1,64}$/u,If=R().regex(Ff),Lf=R().regex(Ff),Rf=R().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u),zf=W([`relay`,`tailscale`,`lan`,`custom`]),Bf=[`blue`,`purple`,`cyan`,`green`,`amber`,`rose`,`slate`],Vf=W(Bf),Hf=new Set(Bf);function Uf(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return Bf[(t>>>0)%Bf.length]??Bf[0]}function Wf(e,t){return typeof t==`string`&&Hf.has(t)?t:Uf(e)}let Gf=W([`connected`,`connecting`,`auth-error`,`offline`,`disabled`]),Kf=H({peerId:If,hostId:Rf,nodeId:Lf.optional(),name:R().min(1).max(120),color:Vf.optional(),origin:R().min(1).max(2048),transportKind:zf,encrypted:B(),enabled:B(),state:Gf,supportsPeerPairing:B().optional(),pairedBack:B().optional(),linkedPeerIds:V(If).max(128).optional(),latencyMs:z().int().nonnegative().optional(),version:R().max(128).optional(),platform:R().max(64).optional(),hostname:R().max(255).optional(),homeDir:R().max(4096).optional(),lastError:R().max(1e3).optional(),projectCount:z().int().nonnegative(),createdAt:R(),updatedAt:R()});H({localPlatform:R().max(64).optional(),peers:V(Kf)}),H({connectionUrl:R().min(1).max(4096).optional(),origin:R().min(1).max(2048).optional(),token:R().min(1).max(2048).optional(),name:R().trim().min(1).max(120).optional(),color:Vf.optional(),pairBack:B().optional(),meshPeerIds:V(If).max(64).optional(),selfOrigin:R().min(1).max(2048).optional()}).refine(e=>!!e.connectionUrl||!!e.origin&&!!e.token,`Provide either connectionUrl or both origin and token`),U({origin:R().min(1).max(2048),token:R().min(1).max(2048),name:R().trim().min(1).max(120).optional(),color:Vf.optional(),expectedNodeId:Lf.optional()}),H({status:W([`added`,`updated`,`existing`]),peerId:If,hostId:Rf,nodeId:Lf.optional()});let qf=W([`added`,`updated`,`existing`,`failed`,`skipped`]);H({results:V(H({targetPeerId:If,targetName:R().min(1).max(120),introducedHost:$s([G(`local`),If]),introducedName:R().min(1).max(120),status:qf,error:R().max(1e3).optional()}))}),H({peerIds:V(If).max(64).optional(),includeSelf:B().optional(),includeMesh:B().optional(),selfOrigin:R().min(1).max(2048).optional()}),H({peerId:If,name:R().trim().min(1).max(120).optional(),color:Vf.nullable().optional(),connectionUrl:R().min(1).max(4096).optional(),origin:R().min(1).max(2048).optional(),token:R().min(1).max(2048).optional(),enabled:B().optional()}),H({peerId:If}),H({removed:B()}),H({peerId:If.optional(),connectionUrl:R().min(1).max(4096).optional(),origin:R().min(1).max(2048).optional(),token:R().min(1).max(2048).optional()}).refine(e=>!!e.peerId||!!e.connectionUrl||!!e.origin&&!!e.token,`Provide peerId, connectionUrl, or both origin and token`);let Jf=H({id:R().min(1).max(1024),name:R().min(1).max(512),path:R().min(1).max(8192)});H({ok:B(),nodeId:Lf.optional(),supportsPeerPairing:B().optional(),pairedBack:B().optional(),latencyMs:z().int().nonnegative().optional(),origin:R().max(2048).optional(),transportKind:zf.optional(),encrypted:B().optional(),version:R().max(128).optional(),platform:R().max(64).optional(),hostname:R().max(255).optional(),homeDir:R().max(4096).optional(),projectCount:z().int().nonnegative().optional(),projects:V(Jf).optional(),error:R().max(1e3).optional()});let Yf=H({id:R().min(1).max(1024),name:R().min(1).max(512),path:R().min(1).max(8192),threadIds:V(R().min(1).max(1024))}),Xf=H({attachments:G(1).optional(),workspaceFiles:G(1).optional(),officePreview:G(1).optional(),delegation:G(1).optional(),peerPairing:G(1).optional()}),Zf=H({version:R().max(128),platform:R().max(64),hostname:R().max(255),homeDir:R().max(4096).optional(),epoch:R().min(1).max(256),nodeId:Lf.optional(),peerNodes:sc(Rf,Lf).refine(e=>Object.keys(e).length<=128).optional(),projects:V(Yf),capabilities:Xf.optional()});U({threadId:R().min(1).max(1024),scope:R().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u).optional(),requestId:R().min(1).max(256).optional(),mode:W([`queue`,`steer`]).optional(),expectedTurnId:R().min(1).max(1024).nullable().optional(),content:V(tc(`type`,[U({type:G(`text`),text:R()}),U({type:G(`file`),receiptId:R().min(1).max(128)})])).min(1).max(64)});let Qf=H({ok:G(!1),error:H({code:R(),message:R(),details:sc(R(),qs()).optional()})});$s([H({ok:G(!0),value:H({receiptId:R().min(1),file:H({attachmentId:R(),name:R(),bytes:z().int().nonnegative()})})}),Qf]),$s([H({ok:G(!0),value:H({accepted:G(!0)})}),Qf]);let $f=H({name:R().min(1).max(512),path:R().min(1).max(8192),kind:G(`directory`)});H({peerId:If,path:R().min(1).max(8192).optional()}),H({path:R().min(1).max(8192),parentPath:R().min(1).max(8192).nullable(),homeDir:R().min(1).max(8192).optional(),entries:V($f)}),H({peerId:If,parentPath:R().min(1).max(8192),name:R().min(1).max(255).refine(e=>e.trim().length>0,`Directory name cannot be blank`)}),H({path:R().min(1).max(8192),name:R().min(1).max(255)}),H({peerId:If,path:R().min(1).max(8192),title:R().trim().min(1).max(255).optional()}),H({peerId:If,workspaceId:R().min(1).max(1024),title:R().trim().min(1).max(255)}),H({peerId:If,workspaceId:R().min(1).max(1024)}),H({workspaceId:R().min(1).max(1024).optional(),manifest:Zf}),H({sessionHostId:R().min(1).max(128).optional()}),H({hosts:V(H({hostId:$s([G(`local`),Rf]),name:R().min(1).max(120),isLocal:B().optional(),color:Vf.optional(),hostname:R().max(255).optional()}))}),H({hostId:$s([G(`local`),Rf])}),H({harnesses:V(H({id:R().regex(/^[a-z0-9][a-z0-9-]*$/u),name:R().min(1).max(120)}))});let ep=W([`listHarnesses`,`inspect`,`start`,`send`,`cancel`,`read`,`answer`,`list`]);U({operation:ep,hopCount:z().int().min(0).max(16),sourceId:If.optional(),input:Gc});let tp=U({code:R().min(1).max(128),message:R().max(4096),details:Gc.optional()});$s([U({ok:G(!0),value:Wc}),U({ok:G(!1),error:tp})]);let np=U({id:R().min(1).max(1024),name:R().min(1).max(512),path:R().min(1).max(8192)});U({hosts:V(U({hostId:Rf,nodeId:Lf.optional(),displayName:R().min(1).max(120),online:B(),state:Gf,delegation:B(),projects:V(np),platform:R().max(64).optional(),hostname:R().max(255).optional(),homeDir:R().max(4096).optional()}))}),U({version:G(1),instanceId:R().min(1).max(128),pid:z().int().positive(),endpoint:R().min(1).max(256),token:R().regex(/^[0-9a-f]{64}$/u),startedAt:z().int().nonnegative()}),$s([U({operation:G(`hosts`)}),U({operation:ep,hostId:Rf,hopCount:z().int().min(0).max(16),timeoutMs:z().int().min(1).max(12e4).optional(),input:Gc})]);let rp=H({id:R().min(1).max(256),harnessId:R().min(1),label:R().min(1).max(512),provider:W([`openai-codex`,`xai`])}).strict(),ip=R().regex(/^[a-z][a-z0-9-]{0,47}$/),ap=H({name:ip,source:rp,importedAt:R()}).strict(),op=tc(`action`,[H({action:G(`list`)}).strict(),H({action:G(`import`),sourceId:R().min(1).max(256),name:ip,confirmed:G(!0)}).strict(),H({action:G(`reimport`),sourceId:R().min(1).max(256),name:ip,confirmed:G(!0)}).strict(),H({action:G(`remove`),name:ip,confirmed:G(!0)}).strict()]),sp=H({provider:R().min(1).max(128),type:W([`oauth`,`api_key`,`unknown`]),label:R().min(1).max(512).optional(),vendor:W([`openai-codex`,`xai`]).optional()}).strict();H({sources:V(rp),targets:V(H({harnessId:R(),providers:V(W([`openai-codex`,`xai`])),imports:V(ap),others:V(sp).default([])}).strict())}).strict(),H({targetHarnessId:R().min(1).max(128).optional(),request:op}).strict(),H({events:B()});let cp=V(U({agent:R().min(1).max(128),section:W([`main`,`more`,`auto`])})).max(256).refine(e=>new Set(e.map(e=>e.agent)).size===e.length,`Duplicate Harness IDs`);U({entries:cp.nullable()}),U({}),U({entries:cp,initializeOnly:B().optional()});let lp=U({enabled:B(),timeoutMinutes:z().int().min(5).max(1440)});Object.freeze({enabled:!0,timeoutMinutes:10});let up=R().regex(/^external$/u),dp=Qc.transform(e=>String(e)),fp=U({model:zl.optional(),thinkingOptionId:el.optional(),permissionModeId:nl.optional()}).refine(e=>!!(e.model||e.thinkingOptionId||e.permissionModeId),`A default configuration must contain a preference`);tc(`mode`,[U({mode:G(`global`)}),U({mode:G(`last`)}),U({mode:G(`manual`),harnessId:Qc})]);let pp=U({lastHarness:Qc.optional(),byHarness:sc(dp,fp)}),mp=U({model:zl.optional(),thinkingOptionId:el.optional()}).refine(e=>!!(e.model||e.thinkingOptionId),`A delegation default must contain a Model or Thinking option`),hp=U({byHarness:sc(dp,mp)}),gp=R().min(1).max(1024),_p=U({idleRelease:lp.optional(),favorites:sc(dp,V(gp).max(2048)).default({}),newThread:pp.optional(),delegation:hp.optional()});U({scope:up,revision:z().int().nonnegative(),values:_p}),U({scope:up.default(`external`)});let vp=tc(`kind`,[U({kind:G(`idleRelease`),value:lp}),U({kind:G(`favorite`),harnessId:Qc,modelId:gp,enabled:B()}),U({kind:G(`favorites`),harnessId:Qc,modelIds:V(gp).max(2048)}),U({kind:G(`newThread`),lastHarness:Qc.optional(),harnessId:Qc.optional(),configuration:fp.optional()}),U({kind:G(`delegation`),harnessId:Qc,configuration:mp.nullable()})]);U({scope:up.default(`external`),operations:V(vp).min(1).max(256),initializeOnly:B().optional(),expectedRevision:z().int().nonnegative().optional()}).superRefine((e,t)=>{for(let n of e.operations)n.kind===`newThread`&&(!n.lastHarness&&!n.configuration||!!n.harnessId!=!!n.configuration)&&t.addIssue({code:`custom`,message:`A default Harness or complete configuration is required`})}),U({version:G(1),revision:z().int().nonnegative(),scopes:sc(up,_p)});let yp=z().finite().nonnegative(),bp=U({input:yp,output:yp,cacheRead:yp.optional(),cacheWrite:yp.optional(),cacheWrite1h:yp.optional()}),xp=R().max(512).refine(e=>e.trim()===e&&e.length>0,`Model ID is required`);U({path:R(),entries:V(U({key:R(),price:bp})),error:R().nullable()}),U({}),U({key:xp,price:bp.nullable(),previousKey:xp.optional()}),U({model:xp});let Sp=U({official:B().optional(),canonicalModelId:R().min(1).optional(),provider:R().min(1).max(512),model:R().min(1).max(512),price:bp});U({price:bp.nullable(),suggestions:V(Sp).max(6).optional()});let Cp=[`today`,`7d`,`30d`,`90d`,`all`],wp=z().int().min(0).max(2**53-1),Tp=R().regex(/^\d{4}-\d{2}-\d{2}$/u),Ep=R().min(1).max(128),Dp=R().min(1).max(512),Op=R().min(1).max(4096);U({range:W(Cp),timeZone:R().min(1).max(128).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Unsupported usage statistics timezone`).optional(),harness:Ep.optional(),model:Dp.nullable().optional(),project:Op.nullable().optional(),date:Tp.optional()});let kp=U({requests:wp,inputTokens:wp,cachedInputTokens:wp,cacheWriteInputTokens:wp,cacheKnownInputTokens:wp,cacheHitCachedInputTokens:wp,cacheHitInputTokens:wp,outputTokens:wp,reasoningOutputTokens:wp,costUsd:z().finite().min(0),unpricedRequests:wp,unmeteredRequests:wp}),Ap=kp.shape,jp=U({harness:Ep,sessionId:R().min(1).max(512),project:Op.nullable(),title:R().min(1).max(200).optional(),models:V(Dp).max(16),firstAtMs:wp,lastAtMs:wp,...Ap});U({range:W(Cp),from:Tp.nullable(),to:Tp,filters:U({harness:Ep.nullable(),model:Dp.nullable(),unknownModel:B(),project:Op.nullable(),unknownProject:B(),date:Tp.nullable()}),reading:U({complete:B(),sources:wp,read:wp}),failures:V(U({harness:Ep,message:R().max(2048)})).max(256),options:U({harnesses:V(Ep).max(256),models:V(Dp.nullable()).max(4096),projects:V(Op.nullable()).max(4096)}),modelLabels:V(U({harness:Ep,model:Dp,label:Dp})).max(4096).optional(),credits:V(U({harness:Ep,model:Dp.nullable(),credits:z().finite().min(0),reportedRequests:wp,requests:wp})).max(4096).optional(),totals:kp,daily:V(U({date:Tp,harness:Ep,...Ap})).max(2e5),hourly:V(U({weekday:z().int().min(0).max(6),hour:z().int().min(0).max(23),...Ap})).max(168),byHarness:V(U({harness:Ep,...Ap})).max(256),byModel:V(U({model:Dp.nullable(),...Ap,harnessPricedRequests:wp})).max(4096),byProject:V(U({project:Op.nullable(),...Ap})).max(4096),sessions:V(jp).max(100),recentSessions:V(jp).max(100).optional()}),H({threadId:K}),H({discarded:B()});let Mp=tc(`type`,[H({id:R().min(1),type:G(`choice`),prompt:R(),options:V(H({value:R().min(1),label:R(),description:R().optional()})).min(1),multiple:B(),allowOther:B(),optional:B()}),H({id:R().min(1),type:G(`text`),prompt:R(),multiline:B(),secret:G(!1),optional:B(),placeholder:R().optional(),prefill:R().optional()})]),Np=H({interactionId:R().min(1),turnId:R().min(1),title:R().optional(),questions:V(Mp).min(1)}).refine(({questions:e})=>e.some(e=>e.type===`choice`&&e.multiple),{message:`Shared cards require at least one multi-select question`});U({threadId:R().min(1)}),H({questions:V(Np)}),U({threadId:R().min(1),turnId:R().min(1),interactionId:R().min(1),answers:sc(R(),V(R())),cancelled:B().default(!1)}),H({accepted:G(!0)});let Pp=H({path:R(),oldText:R().nullable(),newText:R()});H({sessionId:R().min(1),turn:z().int().nonnegative(),path:R().min(1).optional()}),H({diffs:V(Pp)}),U({}),U({}),H({reference:H({sessionId:R().min(1),epoch:R().min(1),turn:z().int().nonnegative(),seq:z().int().nonnegative(),callId:R().min(1),part:z().int().nonnegative(),version:R().min(1)}),length:z().int().nonnegative(),bytes:z().int().nonnegative()}),U({}),U({}),U({title:R().trim().min(1).max(200),type:W([`info`,`warning`,`danger`]),body:R().trim().min(1).max(16384)}),U({}),U({url:R().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)}),Object.freeze(/* @__PURE__ */ `codexhost/console/remote-connections.codexhost/runtime/status.codexhost/remote/ssh-setup.codexhost/harness/plugins/list.codexhost/harness/display-settings/capabilities.codexhost/harness/display-settings/get.codexhost/harness/display-settings/set.codexhost/harness/inspect.codexhost/harness/installation.codexhost/harness/installation/start.codexhost/harness/installation/status.codexhost/harness/launch-settings/get.codexhost/harness/launch-settings/set.codexhost/harness/web-ui/open.codexhost/harness/accounts/sources.codexhost/harness/accounts/list.codexhost/harness/accounts/inspect.codexhost/harness/credential-imports.codexhost/harness/session-import/sources.codexhost/harness/session-import/list.codexhost/harness/session-import/import.codexhost/account/list.codexhost/account/refresh.codexhost/account/usage/inspect.codexhost/usage/model-prices/get.codexhost/usage/model-prices/set.codexhost/usage/model-prices/default.codexhost/usage/statistics/get.codexhost/update/check.codexhost/update/start.codexhost/update/status.codexhost/update/macos-signing/status.codexhost/update/macos-signing/setup.codexhost/update/macos-signing/remove`.split(`.`));let Fp=W([`idle`,`running`,`busy`,`closing`,`failed`,`blocked`]),Ip=W([`none`,`disabled`,`timeout`,`operation`,`background`,`identity`,`persistence`,`closeFailed`]);U({threadId:R(),title:R(),harnessId:R(),state:Fp,reason:Ip,inactiveMs:z().nonnegative()}),U({threadId:K,turnId:$c});let Lp=H({email:R().trim().min(1).max(320).optional(),label:R().trim().min(1).max(256).optional(),plan:R().trim().min(1).max(128).optional(),credits:Pl.optional(),balance:Fl.optional()}).strict();function Rp(e){return e.refine(e=>{let t=e;return t.credits!==void 0||t.balance!==void 0},{message:`Account must report either credits or a balance`})}let zp=Rp(Lp),Bp={harnessId:Qc,harnessName:R().trim().min(1).max(128)},Vp=H(Bp).strict();H({}).strict(),H({sources:V(Vp).max(128)}).strict(),H({harnessId:Qc,refresh:B().optional()}).strict(),H({...Bp,account:zp.nullable(),accounts:V(zp).max(8).optional()}).strict(),H({refresh:B().optional()}).strict(),H({accounts:V(Rp(Lp.extend(Bp))).max(128)}).strict(),H({harnessId:tu,model:zl.optional(),thinkingOptionId:el.optional(),permissionModeId:nl.optional(),prewarm:G(!0).optional()}).strict();let Hp=R().trim().min(1).max(4096).refine(e=>!/[\u0000\r\n]/u.test(e),`Invalid entrypoint path`);H({harnessId:tu}).strict().extend({path:Hp.nullable()}),H({path:Hp.nullable(),restartRequired:B()}).strict(),H({harnessId:Qc,action:W([`check`,`update`,`install`]),confirmedVersion:R().min(1).max(128).optional()}).strict().refine(({action:e,confirmedVersion:t})=>e===`update`||t===void 0);let Up=H({currentVersion:R().min(1).max(128),latestVersion:R().min(1).max(128),updateAvailable:B(),canUpdate:B(),latestVerifiedVersion:R().min(1).max(128).optional(),confirmationRequired:G(!0).optional(),versionKind:W([`cli`,`application`]).optional(),manualUpdateUrl:ws().max(2048).refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Manual updates require a credential-free HTTPS URL`).optional(),message:R().max(2048).optional(),messageCode:R().min(1).max(128).optional(),notice:Xc.optional(),latestVersionKind:W([`unknown`,`tracking-branch`]).optional()}).strict();H({taskId:R().uuid()}).strict(),tc(`status`,[H({taskId:R().uuid(),status:G(`running`)}).strict(),H({taskId:R().uuid(),status:G(`succeeded`),result:Up}).strict(),H({taskId:R().uuid(),status:G(`failed`),error:H({code:z().int(),message:R().min(1).max(2048)}).strict()}).strict()]);let Wp=R().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u),Gp=R().trim().min(1),Kp=W([`free`,`go`,`plus`,`pro`,`prolite`,`team`,`self_serve_business_prolite`,`self_serve_business_usage_based`,`business`,`ent26`,`enterprise_cbp_automation`,`enterprise_cbp_usage_based`,`enterprise`,`edu`,`edu_plus`,`edu_pro`,`unknown`]),qp=H({accountId:Wp,label:Gp.max(256),email:R().email().max(320).optional(),planType:Kp.optional()}).strict(),Jp=W([`ready`,`unavailable`]);H({version:G(2),currentAccountId:Wp.nullable(),phase:Jp,revision:z().int().nonnegative(),instanceId:Gp.max(1024).optional(),accounts:V(qp).max(1)}).strict(),H({accountId:Wp,refresh:B().optional()}).strict(),H({accountId:Wp,usage:Ol.nullable(),accountCredits:Pl.optional(),freshness:W([`live`,`cached`]),observedAt:R().datetime().nullable()}).strict();let Yp=1e3,Xp=R().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),Zp=Xp.max(1024),Qp=H({nativeSessionId:Zp,title:Xp.max(4096).nullable(),updatedAt:z().int().nonnegative().max(864e13),cwd:Xp.max(16384),running:B().nullable()}).strict();H({}).strict(),H({harnesses:V(H({harnessId:tu,name:Xp.max(128)}).strict()).max(128)}).strict(),H({harnessId:tu,query:R().trim().max(4096).refine(e=>!e.includes(`\0`)).optional(),offset:z().int().nonnegative().safe().optional(),limit:z().int().min(1).max(Yp).optional()}).strict(),H({candidates:V(Qp).max(Yp),total:z().int().nonnegative().safe()}).strict(),H({harnessId:tu,nativeSessionId:Zp}).strict(),H({threadId:Xp.max(1024).pipe(K)}).strict();let $p=R().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),em=Zp,tm=Qp;H({}).strict(),H({candidates:V(tm).max(1e3)}).strict(),H({nativeSessionId:em}).strict(),H({threadId:$p.max(1024).pipe(K)}).strict(),H({threadId:K,lastTurnId:$c}).strict(),H({threadId:K}).strict();let nm=R().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u).brand();H({commands:V(H({id:nm,invocation:R().min(1).max(128),label:R().trim().min(1).max(128),description:R().trim().min(1).max(512).optional(),localizations:Yc.optional(),argumentMode:W([`none`,`text`]),kind:W([`command`,`skill`]).optional()}).strict()),warnings:V(R().min(1)).optional(),source:W([`live`,`static`]).optional()}).strict().superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.commands.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Harness command IDs must be unique`,path:[`commands`,r,`id`]}),n.add(i.id)}),H({harnessId:Qc,cwd:R().min(1).optional()}).strict(),H({threadId:K}).strict(),H({threadId:K,commandId:nm,turnId:$c.optional(),arguments:Gc.optional()}).strict(),H({accepted:G(!0),turnId:$c.optional()}).strict();let rm=G(`2.0`).optional(),im=Ys().optional(),am=R().min(1),om=$s([R(),z().int()]),sm=H({code:z().int(),message:R(),data:Wc.optional()}).catchall(Wc).superRefine(zc([`data`]));$s([H({jsonrpc:rm,id:om,method:am,params:Wc.optional(),result:im,error:im}).catchall(Wc).superRefine(zc([`jsonrpc`,`params`,`result`,`error`])),H({jsonrpc:rm,id:im,method:am,params:Wc.optional(),result:im,error:im}).catchall(Wc).superRefine(zc([`jsonrpc`,`id`,`params`,`result`,`error`])),H({jsonrpc:rm,id:om,method:im,params:im,result:Wc,error:im}).catchall(Wc).superRefine(zc([`jsonrpc`,`method`,`params`,`error`])),H({jsonrpc:rm,id:om,method:im,params:im,result:im,error:sm}).catchall(Wc).superRefine(zc([`jsonrpc`,`method`,`params`,`result`]))]);let cm=R().refine(e=>e.trim().length>0,{message:`Native identifier must not be empty or whitespace`});U({harnessId:Qc,nativeSessionId:cm,locator:Wc.optional(),formatVersion:G(1)}).superRefine(zc([`locator`])),U({harnessId:Qc,nativeSessionId:cm,nativeTurnKey:cm,formatVersion:G(1)}),U({harnessId:Qc,nativeSessionId:cm,checkpointId:cm,locator:Wc.optional(),formatVersion:G(1)}).superRefine(zc([`locator`]));let lm=R().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u),um=W([`npm`,`windows-installer`,`macos-dmg`,`linux-archive`]),dm=W([`prepared`,`downloading`,`waiting-for-exit`,`installing`,`restarting`,`succeeded`,`failed`]),fm=U({completed:z().int().nonnegative(),total:z().int().positive()}).refine(e=>e.completed<=e.total,{path:[`completed`],message:`completed must not exceed total`}),pm=U({version:lm,installation:um,phase:dm,updatedAt:z().int().nonnegative(),downloadedBytes:z().int().nonnegative().optional(),totalBytes:z().int().positive().optional(),npmDownload:fm.optional(),error:R().min(1).max(500).nullable(),serviceStopOutput:R().optional()}).superRefine((e,t)=>{e.downloadedBytes!==void 0&&e.totalBytes!==void 0&&e.downloadedBytes>e.totalBytes&&t.addIssue({code:`custom`,path:[`downloadedBytes`],message:`downloadedBytes must not exceed totalBytes`})});U({});let mm=R().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u,`release notes URL must identify a codexhost GitHub Release`),hm=W([`idle`,`downloading`,`ready`,`failed`]),gm=U({downloadedBytes:z().int().nonnegative(),totalBytes:z().int().positive()}).refine(e=>e.downloadedBytes<=e.totalBytes,{path:[`downloadedBytes`],message:`downloadedBytes must not exceed totalBytes`});H({currentVersion:lm,installation:um.nullable(),latestVersion:lm.nullable(),updateAvailable:B(),installationAvailable:B(),releaseNotes:R().min(1).max(2e4).nullable(),releaseNotesUrl:mm.nullable(),status:pm.nullable(),error:R().min(1).max(500).nullable(),stagedVersion:lm.nullable().optional(),backgroundPhase:hm.optional(),backgroundDownload:gm.nullable().optional(),backgroundError:R().min(1).max(500).nullable().optional(),runningTaskCount:z().int().nonnegative().optional()}),U({status:pm}),U({status:pm.nullable()}),U({supported:B(),enabled:B(),certificatePresent:B(),appSignedWithLocalCert:B(),appPath:R().min(1).nullable(),certificateName:R().min(1),certificateSha1:R().regex(/^[0-9A-Fa-f]{40}$/u).nullable()});let _m=U({icon:R().min(1).max(16).optional(),title:R().min(1).max(120),body:R().min(1).max(1200),contributors:V(R().min(1).max(39)).max(30)}),vm=U({summary:R().min(1).max(600).optional(),themes:V(_m).min(1).max(12)}),ym=U({version:lm,publishedAt:Rc(),url:R().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u),zh:vm.nullable(),en:vm.nullable()}).refine(e=>e.zh!==null||e.en!==null,{message:`an announcement needs at least one language`});U({manual:B().optional()}),U({announcement:ym.nullable(),unread:B()}),U({version:lm}),RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): `+`(${[`completed`,`failed`,`interrupted`,`needsInput`,`timedOut`,`unreadable`,`notFound`].join(`|`)})(?:\. (.+))?$`,`u`);let bm=W([`idle`,`installing`,`restarting`,`succeeded`,`failed`]);H({runningVersion:R().nullable(),installedVersion:R().nullable(),restartRequired:B(),remote:B(),updateSupported:B(),update:H({phase:bm,targetVersion:R().nullable(),error:R().nullable()})});let xm=H({version:R().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)}).strict();H({hostname:R().min(1).max(1024).refine(e=>!e.startsWith(`-`)&&!/\s/u.test(e)),port:z().int().min(1).max(65535).nullable(),identity:R().max(4096).nullable(),action:W([`inspect`,`install`,`update`,`repair`,`uninstall`]),uninstallPackage:B().optional(),version:R().regex(/^\d+\.\d+\.\d+$/u).nullable()}).strict(),H({state:W([`installed`,`not-installed`])}).strict();let q=R().min(1).max(1024),Sm={hostId:q.regex(/^(?:remote-(?:ssh(?:-|:)|control:)|remote-peer:[a-zA-Z0-9_-]{1,64}$)/u)},Cm={...Sm,threadId:q},wm=R().min(1).max(8e3),Tm={text:wm,requestId:q};tc(`accepted`,[H({accepted:G(!0),startQueuedItemId:q.optional()}),H({accepted:G(!1),code:W([`remote/queue-unavailable`,`remote/steer-unavailable`,`remote/turn-changed`,`remote/send-rejected`,`session/queue-item-not-found`,`session/queue-item-starting`]),message:R()})]),tc(`available`,[H({available:G(!1)}),H({available:G(!0),items:V(H({id:q,clientUserMessageId:q,preview:R().max(801)})).max(100)})]);let Em=tc(`kind`,[U({kind:G(`hosts`)}),U({kind:G(`create`),...Sm,cwd:R().min(1).max(8192),epoch:q}),U({kind:G(`projectHarnesses`),...Sm,epoch:q}),U({kind:G(`inspectHarness`),...Sm,epoch:q,cwd:R().min(1).max(8192),harnessId:q}),U({kind:G(`startSelected`),...Sm,epoch:q,cwd:R().min(1).max(8192),harnessId:q,model:R().min(1).max(4096),serviceTier:W([`priority`,`ultrafast`]).optional(),reasoningEffort:q.optional()}),U({kind:G(`status`),...Cm}),U({kind:G(`list`),...Sm,cursor:R().nullable(),archived:B(),includeLoaded:G(!0).optional()}),U({kind:G(`read`),...Cm,page:U({cursor:R().min(1).max(8192).nullable(),epoch:q.optional(),sortDirection:W([`asc`,`desc`]).optional(),limit:z().int().min(1).max(20).optional()}).refine(e=>e.cursor===null||e.epoch!==void 0,{message:`A history continuation requires its connection epoch`}).optional()}),U({kind:G(`usage`),...Cm,epoch:q}),U({kind:G(`configure`),...Cm,epoch:q,modelId:q.optional(),serviceTier:Rl.optional(),thinkingOptionId:q.optional(),permissionModeId:q.optional()}).refine(e=>[e.modelId,e.thinkingOptionId,e.permissionModeId].filter(e=>e!==void 0).length===1,`Select exactly one remote setting`).refine(e=>e.serviceTier===void 0||e.modelId!==void 0,{message:`A service tier requires a Model ID`}),U({kind:G(`prompt`),...Cm,epoch:q,text:wm,requestId:q.optional()}),U({kind:G(`queue`),...Cm,epoch:q}),U({kind:G(`delivery`),...Cm,epoch:q,action:tc(`kind`,[U({kind:G(`enqueue`),...Tm}),U({kind:G(`steer`),...Tm,turnId:q}),U({kind:G(`remove`),itemId:q}),U({kind:G(`start`),itemId:q,onlyIfHead:G(!0).optional()}),U({kind:G(`sendNow`),itemId:q})])}),U({kind:G(`interrupt`),...Cm,epoch:q,turnId:q}),U({kind:G(`rename`),...Cm,epoch:q,name:R().min(1).max(512)}),U({kind:G(`archive`),...Cm,epoch:q,archived:B()}),U({kind:G(`respond`),...Cm,epoch:q,requestId:$s([q,z().int()]),result:sc(R(),qs())})]),Dm=R().min(1).max(1024),Om=H({hostId:Dm,displayName:R().min(1).max(1024),source:W([`codex-managed`,`discovered`]),sshAlias:R().max(1024).nullable(),sshHost:R().min(1).max(1024),sshPort:z().int().min(1).max(65535).nullable(),identity:R().max(4096).nullable(),autoConnect:B(),connectionAnalyticsId:R().max(1024).optional()}),km=U({displayName:R().min(1).max(1024),hostname:R().min(1).max(1024),sshPort:z().int().min(1).max(65535).nullable(),identity:R().max(4096).nullable()});tc(`action`,[U({action:G(`session`),operation:Em}),U({action:G(`list`)}),U({action:G(`catalog`)}),U({action:G(`read-thread`),hostId:Dm.refine(e=>e!==`local`),input:Pf}),U({action:G(`save`),draft:km,previous:Om.nullable()}),U({action:G(`remove`),previous:Om}),U({action:G(`connect`),hostId:Dm,enabled:B()}),U({action:G(`state`),hostId:Dm}),U({action:G(`runtime`),hostId:Dm}),U({action:G(`update`),hostId:Dm.refine(e=>e!==`local`),version:xm.shape.version})]),$s([U({result:Wc}),U({error:U({code:z().int(),message:R()})})]),U({prompt:R().trim().min(1).max(2e3),cwd:R().max(4096).nullable()}),R().trim().min(1).max(60).nullable();let Am=R().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u),jm=$s([R(),H({en:R()}).catchall(R())]),Mm=H({title:jm.optional(),description:jm.optional(),icon:R().max(349592).regex(/^data:image\/(?:svg\+xml|png|jpeg|webp);base64,[A-Za-z0-9+/]*={0,2}$/u).optional(),error:R().optional()});H({extensions:V(H({id:Am,name:R().min(1).max(214),version:R().min(1).max(128),format:G(`dsh`),supportedTargets:ac([G(`web`)]),enabledTargets:V(G(`web`)).max(1),source:R().min(1).max(4096),projectUrl:R().max(4096).url({protocol:/^https?$/u}).optional(),installedAt:R(),meta:Mm.optional(),loadError:R().optional()})),loadedIds:V(Am),safeMode:B(),storeError:R().optional()});let Nm=R().trim().max(2048).url({protocol:/^https?$/u,normalize:!0}).refine(e=>!/[\s\\?#]/u.test(e)&&!e.split(`/`)[2]?.includes(`@`),`Use an HTTP(S) registry URL without credentials, a query, or a fragment.`).transform(e=>e.endsWith(`/`)?e:`${e}/`);H({spec:R().trim().min(1).max(4096),registry:Nm.optional()}).strict(),H({id:Am,enabled:B()}).strict(),H({id:Am}).strict(),G(1);function Pm(e){return e?.projectionValues?.remoteHost?.hostId}function Fm(e){return e===void 0?!1:Pm(e)!==void 0||String(e.id).startsWith(`web-remote:`)}function Im(e){if(e===void 0)return!1;let t=Pm(e);return t===void 0?!String(e.id).startsWith(`web-remote:`):t.startsWith(`remote-peer:`)}function Lm(e){return e!==void 0&&!Fm(e)}function Rm(e){return Im(e)}function zm(){let e=(0,i.createSnapshotStore)({searchRequest:0,activityViewRequest:0,addRequested:!1,directoryBusy:!1,renameTarget:null,forkError:null}),t=0;return{state:e,search:()=>{e.set({...e.getSnapshot(),searchRequest:e.getSnapshot().searchRequest+1})},toggleActivityView:()=>{let t=e.getSnapshot();e.set({...t,activityViewRequest:t.activityViewRequest+1})},add:()=>{e.set(e.getSnapshot().directoryBusy?e.getSnapshot():{...e.getSnapshot(),addRequested:!0})},closeAdd:()=>{e.set({...e.getSnapshot(),addRequested:!1})},directoryBusy:t=>{e.set({...e.getSnapshot(),directoryBusy:t})},rename:(t,n)=>{e.set({...e.getSnapshot(),renameTarget:{sessionId:t,currentTitle:n}})},closeRename:()=>{e.set({...e.getSnapshot(),renameTarget:null})},forkFailed:n=>{t+=1,e.set({...e.getSnapshot(),forkError:{reason:n,seq:t}})},dismissForkError:()=>{e.set({...e.getSnapshot(),forkError:null})}}}function Bm(e,t,n,r){let i=e.locale.bind(`workspace`),a=()=>Object.values(e.sessions.list.getSnapshot().byId).find(e=>(e.retainedBy.mainView??0)>0),o=()=>e.slots.entries(`sidebar.workspaces.directoryFlow`).length===0?i(`shortcut.noPicker`):n.state.getSnapshot().directoryBusy?i(`shortcut.directoryBusy`):null,s=(t,n,r,i,a,o,s)=>{e.effect(()=>e.shortcuts.register({id:t,label:n,aliases:r,defaults:{"desktop:macos":{code:i,modifiers:a},"desktop:windows":{code:i,modifiers:a},"desktop:linux":{code:i,modifiers:a},"web:macos":{code:i,modifiers:o},"web:windows":{code:i,modifiers:o}},regions:[`page`,`editable`],modals:[],resolve:s}),`ui-workspace: ${t}`)};s(`session.new`,()=>i(`session.new`),[`new session`,`new chat`],`KeyN`,[`primary`],[`primary`,`alt`],()=>({status:`handled`,run:()=>{t.startSession()}})),s(`session.search`,()=>i(`search.sessions.aria`),[`search sessions`],`KeyK`,[`primary`],[`primary`,`alt`],()=>({status:`handled`,run:n.search})),s(`session.activityView`,()=>i(`activityView.label`),[`activity view`,`unread sessions`],`KeyU`,[`primary`,`alt`],[`primary`,`alt`],()=>({status:`handled`,run:n.toggleActivityView})),s(`workspace.add`,()=>i(`workspace.add`),[`add workspace`,`open folder`],`KeyO`,[`primary`],[`primary`,`alt`],()=>{let e=o();return e===null?{status:`handled`,run:n.add}:{status:`blocked`,reason:e}}),s(`session.rename`,()=>i(`rename.session.title`),[`rename session`],`KeyG`,[`primary`,`alt`],[`primary`,`alt`],t=>{let r=a();return r===void 0||r.blank||t.modal!==null||e.layout.panelInfo.getSnapshot().activePanelId!==null?{status:`blocked`,reason:i(`shortcut.noSession`)}:{status:`handled`,run:()=>{n.rename(r.id,r.title?.trim()??``)}}}),s(`session.fork`,()=>i(`menu.fork`),[`fork session`],`KeyF`,[`primary`,`alt`],[`primary`,`shift`],()=>{let e=a();return e===void 0?{status:`blocked`,reason:i(`shortcut.noSession`)}:Lm(e)?e.blank?{status:`blocked`,reason:i(`shortcut.noCompletedTurn`)}:{status:`handled`,run:()=>{t.forkSession(e.id).catch(e=>{let t=e instanceof Error&&e.name===`SessionForkError`&&e.rpcError.code===`session/fork-unavailable`;n.forkFailed(t?`unavailable`:`failed`),t||console.warn(`session fork rejected:`,e)})}}:{status:`blocked`,reason:i(`shortcut.remoteForkUnsupported`)}}),s(`session.archive`,()=>i(`menu.archiveSession`),[`archive session`],`KeyA`,[`primary`,`shift`],[`primary`,`alt`],()=>{let e=a();return e===void 0?{status:`blocked`,reason:i(`shortcut.noSession`)}:{status:`handled`,run:()=>{r(e.id)}}})}function Vm(e){return e}function Hm(e){return Vm(e)}let Um={'"':`"`,"\\":`\\`,"/":`/`,b:`\b`,f:`\f`,n:`
114
- `,r:`\r`,t:` `},Wm=/[\\\u0000-\u001f]/u;function Gm(e){return e===` `||e===`
115
- `||e===`\r`||e===` `}function Km(e){return e>=`0`&&e<=`9`||e>=`a`&&e<=`f`||e>=`A`&&e<=`F`}(class e{static EMPTY=e.fromObject({});static fromText(t){let n=new e;return n.append(t),n.sealed=!0,n}static fromObject(t){let n=new e;return n.object=typeof t==`object`&&t&&!Array.isArray(t)?t:{},n.sealed=!0,n}chunks=[];object;sealed=!1;#e=[];#t=0;#n=0;#r=`root`;#i=!1;#a=0;#o=!1;#s=``;#c=null;#l=[];#u=!1;#d;#f=!1;#p=/* @__PURE__ */ new Map;#m=[];#h=/* @__PURE__ */ new Map;get isSealed(){return this.sealed}get invalid(){return this.scan(),this.#r===`invalid`||this.#f}append(e){if(this.sealed)throw Error(`PartialArguments: cannot append to a sealed view`);e.length!==0&&(this.chunks.push(e),this.#t+=e.length,this.#e.push(this.#t))}settle(t){if(this.object!==void 0||t.length!==this.#t)return e.fromText(t);let n=0;for(let r of this.chunks){if(!t.startsWith(r,n))return e.fromText(t);n+=r.length}return this.chunks=t.length===0?[]:[t],this.#e=t.length===0?[]:[t.length],this.sealed=!0,this}refresh(){if(this.#h.size===0)return!1;this.scan();let e=!1,t=!1;for(let n of this.#h.values())n.completion?t=!0:e=this.refreshRead(n)||e;if(t)for(let t of this.#h.values())t.completion&&(e=this.refreshRead(t)||e);return this.sealed&&this.#h.clear(),e}refreshRead(e){let t=e.answer();return!Object.is(t,e.last)&&(e.last=t,!0)}closed(){return this.remember(`closed`,``,()=>this.closedNow())}keys(){return this.remember(`keys`,``,()=>this.keysNow(),e=>e.length)}has(e){return this.remember(`has`,e,()=>this.hasNow(e))}complete(e){return this.remember(`complete`,e,()=>this.completeNow(e))}stringLength(e,t){let n=Math.max(1,Math.floor(t?.step??1)),r=t?.offset??0;return this.remember(`length:${n}:${r}`,e,()=>this.lengthNow(e),e=>e===void 0?void 0:Math.ceil((e+r)/n))}stringExceeds(e,t){let n=Math.max(0,Math.floor(t));return this.remember(`exceeds:${n}`,e,()=>(this.lengthNow(e,n+1)??0)>n)}text(e){return this.remember(`text`,e,()=>this.textNow(e))}textPrefix(e,t){let n=Math.max(1,Math.floor(t));return this.remember(`prefix:${n}`,e,()=>this.textPrefixNow(e,n))}value(e){return this.remember(`value`,e,()=>this.valueNow(e))}remember(e,t,n,r){this.scan();let i=n();if(!this.sealed){let a=`${e}/${t}`;this.#h.has(a)||this.#h.set(a,{completion:e===`complete`,answer:r===void 0?n:()=>r(n()),last:r===void 0?i:r(i)})}return i}closedNow(){return this.sealed||this.#r===`closed`||this.#r===`invalid`}keysNow(){return this.object===void 0?this.#m:Object.keys(this.object)}hasNow(e){return this.object===void 0?this.#p.has(e):Object.hasOwn(this.object,e)}completeNow(e){if(this.object!==void 0)return Object.hasOwn(this.object,e);let t=this.#p.get(e);return t!==void 0&&t.end>=0&&(t.kind===`string`?t.invalidAt===void 0:!t.invalid)}lengthNow(e,t=1/0){if(this.object!==void 0){let t=Object.hasOwn(this.object,e)?this.object[e]:void 0;return typeof t==`string`?t.length:void 0}let n=this.#p.get(e);if(n?.kind!==`string`)return;if(n.text!==void 0&&n.text.at===n.end)return n.text.length;let r=n.length??={at:n.start,length:0,text:``};return this.readString(n,r,t,!1),r.length}textNow(e){if(this.object!==void 0){let t=Object.hasOwn(this.object,e)?this.object[e]:void 0;return typeof t==`string`?t:void 0}let t=this.#p.get(e);if(t?.kind!==`string`)return;if(t.text===void 0&&t.end>=0&&t.needsDecoding&&t.invalidAt===void 0){let e;try{e=JSON.parse(`"${this.slice(t.start,t.end)}"`)}catch{}e!==void 0&&(t.text={at:t.end,length:e.length,text:e})}let n=t.text??={at:t.start,length:0,text:``};return this.readString(t,n,1/0,!0),n.text}textPrefixNow(e,t){if(this.object!==void 0){let n=Object.hasOwn(this.object,e)?this.object[e]:void 0;return typeof n==`string`?n.slice(0,t):void 0}let n=this.#p.get(e);if(n?.kind!==`string`)return;let r=n.prefixes??=/* @__PURE__ */ new Map,i=r.get(t);return i===void 0&&(i={at:n.start,length:0,text:``},r.set(t,i)),this.readString(n,i,t,!0),i.text}valueNow(e){if(this.object!==void 0){if(!Object.hasOwn(this.object,e))return;let t=this.object[e];return typeof t==`string`?void 0:t}let t=this.#p.get(e);if(!(t?.kind!==`value`||t.end<0||t.invalid)){if(t.parsed===void 0)try{t.parsed=JSON.parse(this.slice(t.start,t.end))}catch{t.invalid=!0,this.#f=!0}return t.parsed}}chunkAt(e){let t=0,n=this.#e.length;for(;t<n;){let r=t+n>>>1;this.#e[r]<=e?t=r+1:n=r}return t}slice(e,t){if(e>=t)return``;let n=this.chunkAt(e),r=this.chunkAt(t-1),i=n===0?0:this.#e[n-1];if(n===r)return this.chunks[n].slice(e-i,t-i);let a=[this.chunks[n].slice(e-i)];for(let e=n+1;e<r;e++)a.push(this.chunks[e]);return a.push(this.chunks[r].slice(0,t-this.#e[r-1])),a.join(``)}readString(e,t,n,r){let i=Math.min(e.end<0?this.#n:e.end,e.invalidAt??1/0,this.#d??1/0);if(!e.needsDecoding){let e=Math.min(i-t.at,n-t.length);if(e<=0)return;r&&(t.text+=this.slice(t.at,t.at+e)),t.at+=e,t.length+=e;return}let a=this.chunkAt(t.at);for(;t.at<i&&t.length<n;){let o=a===0?0:this.#e[a-1],s=this.chunks[a],c=s.slice(t.at-o,Math.min(s.length,i-o)),l=c.search(Wm),u=Math.min(l<0?c.length:l,n-t.length);if(u>0){r&&(t.text+=c.slice(0,u)),t.at+=u,t.length+=u,t.at===o+s.length&&a++;continue}let d=c.length>1?c[1]:t.at+1<i?this.chunks[a+1][0]:void 0,f,p=2;if(c[0]===`\\`&&d===void 0&&e.end<0)return;if(c[0]===`\\`&&d===`u`){let n=this.slice(t.at+2,Math.min(i,t.at+6)),r=!0;for(let e=0;e<n.length;e++)Km(n[e])||(r=!1);if(r){if(n.length<4&&e.end<0)return;n.length===4&&(f=String.fromCharCode(Number.parseInt(n,16)))}p=6}else c[0]===`\\`&&d!==void 0&&(f=Um[d]);if(f===void 0){e.invalidAt=t.at,this.#f=!0;return}for(r&&(t.text+=f),t.length++,t.at+=p;a<this.chunks.length&&t.at>=this.#e[a];)a++}}scan(){if(this.object===void 0&&this.#n!==this.#t)for(let e=this.chunkAt(this.#n);e<this.chunks.length&&this.#d===void 0;e++){let t=this.chunks[e],n=e===0?0:this.#e[e-1];for(let e=this.#n-n;e<t.length&&this.#r!==`invalid`;e++){if(this.#r===`string`||this.#r===`nested`&&this.#u){let n=this.stringBoundary(t,e);if(this.#n+=n-e,e=n,e===t.length)break}this.step(t[e],this.#n),this.#n++}}}stringBoundary(e,t){let n=t;for(;;){let t=e.indexOf(`"`,n),r=t<0?e.length:t;if(this.#r===`string`){let t=this.#c;!t.needsDecoding&&Wm.test(e.slice(n,r))&&(t.needsDecoding=!0)}let i=r;for(;i>n&&e[i-1]===`\\`;)i--;let a=(r-i)%2==1!==(i===n&&this.#i);if(this.#i=t<0&&a,t<0||!a)return r;n=t+1}}step(e,t){switch(this.#r){case`root`:if(Gm(e))return;if(e===`{`){this.#r=`key-or-end`;return}this.fail();return;case`key-or-end`:if(Gm(e))return;if(e===`}`){this.#r=`closed`;return}if(e===`"`){this.beginKey(t);return}this.fail();return;case`key-only`:if(Gm(e))return;if(e===`"`){this.beginKey(t);return}this.fail();return;case`key`:this.stepKey(e,t);return;case`colon`:if(Gm(e))return;if(e===`:`){this.#r=`value`;return}this.fail();return;case`value`:this.beginValue(e,t);return;case`string`:{let e=this.#c;e.end=t,this.#c=null,this.#r=`comma-or-end`;return}case`scalar`:this.stepScalar(e,t);return;case`nested`:this.stepNested(e,t);return;case`comma-or-end`:if(Gm(e))return;if(e===`,`){this.#r=`key-only`;return}if(e===`}`){this.#r=`closed`;return}this.fail();return;case`closed`:if(Gm(e))return;this.fail();return;
113
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Va(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Va(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}let Ha=/* @__PURE__ */ new Set([`type`,`properties`,`required`,`additionalProperties`]),Ua=[`oneOf`,`anyOf`];function Wa(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Ga(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Ha.has(e))return null;t.push(n)}let n={},r=/* @__PURE__ */ new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Wa(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}v(n,r,e.length===1?e[0]:Ga(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Wa(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Ka(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Ha)if(t in e)return;let n=t.filter(e=>Ua.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Ga(t);else{let e=n[0],i=Ua.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Ga([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Fa(e,r))}function qa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Fa(i,s),Fa(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Va(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=/* @__PURE__ */ new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Ka(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Fa(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,v(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Xa(t,`input`,e.processors),output:Xa(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Ja(e,t){let n=t??{seen:/* @__PURE__ */ new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Ja(r.element,n);if(r.type===`set`)return Ja(r.valueType,n);if(r.type===`lazy`)return Ja(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return Ja(r.innerType,n);if(r.type===`intersection`)return Ja(r.left,n)||Ja(r.right,n);if(r.type===`record`||r.type===`map`)return Ja(r.keyType,n)||Ja(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Ja(r.in,n)||Ja(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Ja(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Ja(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Ja(e,n))return!0;return!!(r.rest&&Ja(r.rest,n))}return!1}let Ya=(e,t={})=>n=>{let r=Ia({...n,processors:t});return Ra(e,r),Ba(r,e),qa(r,e)},Xa=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ia({...i??{},target:a,io:t,processors:n});return Ra(e,o),Ba(o,e),qa(o,e)},Za=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Qa=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},$a=(e,t)=>{Za(e,`minimum`,t),Qa(e,`maximum`,t)},eo=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},to=(e,t)=>{e.patterns??=/* @__PURE__ */ new Set,e.patterns.add(t)},no=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},ro=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},io=(e,t)=>Za(e,`minimum`,t.minimum),ao=(e,t)=>Qa(e,`maximum`,t.maximum),oo=e=>(t,n)=>{ro(t,n.format);let[r,i]=e[n.format];Za(t,`minimum`,r),Qa(t,`maximum`,i)},so={greater_than:(e,t)=>Za(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>Qa(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>eo(e,t.value),number_format:oo(ue),bigint_format:oo(de),min_length:io,max_length:ao,length_equals:(e,t)=>$a(e,t.length),min_size:io,max_size:ao,size_equals:(e,t)=>$a(e,t.size),string_format:(e,t)=>{ro(e,t.format),t.pattern&&to(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>no(e,t.mime)};function co(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)so[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Za(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Za(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&Qa(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&Qa(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&eo(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&no(t,i.mime);for(let e of i.patterns??[])to(t,e);return t}let lo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},uo=/* @__PURE__ */ new Map([[ir,Lt],[or,Rt]]),fo=e=>uo.get(e)??e,po=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=co(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=lo[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(fo);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},mo=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=co(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=/* @__PURE__ */ new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):La(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},ho=(e,t,n,r)=>{n.type=`boolean`},go=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},_o=(e,t,n,r)=>{n.not={}},vo=(e,t,n,r)=>{let i=e._zod.def,a=u(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},yo=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(La(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(La(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},bo=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},xo=(e,t,n,r)=>{La(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},So=(e,t,n,r)=>{La(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Co=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=co(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Ra(a.element,t,{...r,path:[...r.path,`items`]})};function wo(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?wo(t.out):t.type===`catch`?wo(t.innerType):e._zod.optin}let To=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&La(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)v(i.properties,e,Ra(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?wo(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Ra(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Eo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Ra(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Do=(e,t,n,r)=>{let i=e._zod.def,a=Ra(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Ra(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Oo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>Ra(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?Ra(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?wo(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=co(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function ko(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=ko(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>ko(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?Xt:Yt).source)),p}let Ao=/* @__PURE__ */ new WeakMap;function jo(e){let t=/* @__PURE__ */ new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=/* @__PURE__ */ new Map;for(let r of Ao.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=ko(t,a,/* @__PURE__ */ new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}let Mo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=co(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Ra(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)v(i.patternProperties,fo(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=Ra(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Ao.get(t);n||(n=[],Ao.set(t,n),t.deferred.push(()=>jo(t))),n.push(e)}i.additionalProperties=Ra(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&wo(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},No=(e,t,n,r)=>{let i=e._zod.def,a=Ra(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Po=(e,t,n,r)=>{let i=e._zod.def;Ra(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Fo=Symbol();function Io(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(La(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Fo):JSON.parse(o)}let Lo=(e,t,n,r)=>{let i=e._zod.def;Ra(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Io(i.defaultValue,e,t,n,r);o!==Fo&&(n.default=o)},Ro=(e,t,n,r)=>{let i=e._zod.def;Ra(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Io(i.defaultValue,e,t,n,r);o!==Fo&&(n._prefault=o)},zo=(e,t,n,r)=>{let i=e._zod.def;Ra(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{La(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Bo=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Ra(o,t,r);let s=t.seen.get(e);s.ref=o},Vo=(e,t,n,r)=>{let i=e._zod.def;Ra(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ho=(e,t,n,r)=>{let i=e._zod.def;Ra(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Uo=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]);function Wo(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}let Go=/*@__PURE__*/ I(`ZodError`,(e,t)=>{$e.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Uo.has(n)||(Uo.add(n),Wo(n,`format`,e=>t=>nt(e,t)),Wo(n,`flatten`,e=>t=>tt(e,t)),Wo(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,f,2)}),Wo(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,f,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Ko=/* @__PURE__ */ it(Go),qo=/* @__PURE__ */ at(Go),Jo=/* @__PURE__ */ ot(Go),Yo=/* @__PURE__ */ ct(Go),Xo=/* @__PURE__ */ mt(Go),Zo=/* @__PURE__ */ ht(Go),Qo=/* @__PURE__ */ gt(Go),$o=/* @__PURE__ */ _t(Go),es=/* @__PURE__ */ vt(Go),ts=/* @__PURE__ */ yt(Go),ns=/* @__PURE__ */ bt(Go),rs=/* @__PURE__ */ xt(Go);function is(){Ke.localeError||qe(Ti())}function as(){Ke.memoizer||qe({memoizer:Si()})}let os=/*@__PURE__*/ I(`ZodType`,(e,t)=>(is(),Sn.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(T(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return O(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(jc(e,t))},superRefine(e,t){return this.check(Mc(e,t))},overwrite(e){return this.check(/* @__PURE__ */ wa(e))},optional(){return lc(this)},exactOptional(){return dc(this)},nullable(){return pc(this)},nullish(){return lc(pc(this))},nonoptional(e){return yc(this,e)},array(){return H(this)},or(e){return Ys([this,e])},and(e){return $s(this,e)},transform(e){return Cc(this,sc(e))},default(e){return hc(this,e)},prefault(e){return _c(this,e)},catch(e){return xc(this,e)},pipe(e){return Cc(this,e)},readonly(){return Ec(this)},describe(e){let t=this.clone();return ki.add(t,{description:e}),t},meta(...e){if(e.length===0)return ki.get(this);let t=this.clone();return ki.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Me(this,`~standard`,{...Tn(this),jsonSchema:{input:Xa(this,`input`),output:Xa(this,`output`)}})},set"~standard"(e){je(this,`~standard`,e)},parse:function e(t,n){return Ko(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await qo(this,t,n,{callee:e})},safeParse(e,t){return Jo(this,e,t)},async safeParseAsync(e,t){return Yo(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){je(this,`spa`,e)},validate(e,t){return dt(this,e,t)},validateAsync(e,t){return pt(this,e,t)},encode:function e(t,n){return Xo(this,t,n,{callee:e})},decode:function e(t,n){return Zo(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Qo(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await $o(this,t,n,{callee:e})},safeEncode(e,t){return es(this,e,t)},safeDecode(e,t){return ts(this,e,t)},async safeEncodeAsync(e,t){return ns(this,e,t)},async safeDecodeAsync(e,t){return rs(this,e,t)},toJSONSchema(e){return Ya(this,{})(e)},get description(){return ki.get(this)?.description},get _def(){return this._zod.def}}),ss=/*@__PURE__*/ I(`_ZodString`,(e,t)=>{En.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(e,t,n,r)},/*@__PURE__*/ N({format:e=>co(e).format??null,minLength:e=>co(e).minimum??null,maxLength:e=>co(e).maximum??null},{regex(...e){return this.check(/* @__PURE__ */ va(...e))},includes(...e){return this.check(/* @__PURE__ */ xa(...e))},startsWith(...e){return this.check(/* @__PURE__ */ Sa(...e))},endsWith(...e){return this.check(/* @__PURE__ */ Ca(...e))},min(...e){return this.check(/* @__PURE__ */ ga(...e))},max(...e){return this.check(/* @__PURE__ */ ha(...e))},length(...e){return this.check(/* @__PURE__ */ _a(...e))},nonempty(...e){return this.check(/* @__PURE__ */ ga(1,...e))},lowercase(e){return this.check(/* @__PURE__ */ ya(e))},uppercase(e){return this.check(/* @__PURE__ */ ba(e))},trim(){return this.check(/* @__PURE__ */ Ea())},normalize(...e){return this.check(/* @__PURE__ */ Ta(...e))},toLowerCase(){return this.check(/* @__PURE__ */ Da())},toUpperCase(){return this.check(/* @__PURE__ */ Oa())},slugify(){return this.check(/* @__PURE__ */ ka())}})),cs=/*@__PURE__*/ I(`ZodString`,(e,t)=>{En.init(e,t),ss.init(e,t)},{email(e){return this.check(/* @__PURE__ */ Mi(ms,e))},url(e){return this.check(/* @__PURE__ */ Ri(ys,e))},jwt(e){return this.check(/* @__PURE__ */ $i(Fs,e))},emoji(e){return this.check(/* @__PURE__ */ zi(xs,e))},guid(e){return this.check(/* @__PURE__ */ Ni(hs,e))},uuid(e){return this.check(/* @__PURE__ */ Pi(gs,e))},uuidv4(e){return this.check(/* @__PURE__ */ Fi(gs,e))},uuidv6(e){return this.check(/* @__PURE__ */ Ii(gs,e))},uuidv7(e){return this.check(/* @__PURE__ */ Li(gs,e))},nanoid(e){return this.check(/* @__PURE__ */ Bi(Ss,e))},cuid(e){return this.check(/* @__PURE__ */ Vi(Cs,e))},cuid2(e){return this.check(/* @__PURE__ */ Hi(ws,e))},ulid(e){return this.check(/* @__PURE__ */ Ui(Ts,e))},base64(e){return this.check(/* @__PURE__ */ Xi(Ms,e))},base64url(e){return this.check(/* @__PURE__ */ Zi(Ns,e))},xid(e){return this.check(/* @__PURE__ */ Wi(Es,e))},ksuid(e){return this.check(/* @__PURE__ */ Gi(Ds,e))},ipv4(e){return this.check(/* @__PURE__ */ Ki(Os,e))},ipv6(e){return this.check(/* @__PURE__ */ qi(ks,e))},cidrv4(e){return this.check(/* @__PURE__ */ Ji(As,e))},cidrv6(e){return this.check(/* @__PURE__ */ Yi(js,e))},e164(e){return this.check(/* @__PURE__ */ Qi(Ps,e))},datetime(e){return this.check(/* @__PURE__ */ ea(us,e))},date(e){return this.check(/* @__PURE__ */ ta(ds,e))},time(e){return this.check(/* @__PURE__ */ na(fs,e))},duration(e){return this.check(/* @__PURE__ */ ra(ps,e))}});function z(e){return/* @__PURE__ */ ji(cs,e)}let ls=/*@__PURE__*/ I(`ZodStringFormat`,(e,t)=>{Dn.init(e,t),ss.init(e,t)}),us=/*@__PURE__*/ I(`ZodISODateTime`,(e,t)=>{Kn.init(e,t),ls.init(e,t)}),ds=/*@__PURE__*/ I(`ZodISODate`,(e,t)=>{qn.init(e,t),ls.init(e,t)}),fs=/*@__PURE__*/ I(`ZodISOTime`,(e,t)=>{Jn.init(e,t),ls.init(e,t)}),ps=/*@__PURE__*/ I(`ZodISODuration`,(e,t)=>{Yn.init(e,t),ls.init(e,t)}),ms=/*@__PURE__*/ I(`ZodEmail`,(e,t)=>{An.init(e,t),ls.init(e,t)}),hs=/*@__PURE__*/ I(`ZodGUID`,(e,t)=>{On.init(e,t),ls.init(e,t)}),gs=/*@__PURE__*/ I(`ZodUUID`,(e,t)=>{kn.init(e,t),ls.init(e,t)});function _s(e){return/* @__PURE__ */ Pi(gs,e)}function vs(e){return/* @__PURE__ */ Fi(gs,e)}let ys=/*@__PURE__*/ I(`ZodURL`,(e,t)=>{Rn.init(e,t),ls.init(e,t)});function bs(e){return/* @__PURE__ */ Ri(ys,e)}let xs=/*@__PURE__*/ I(`ZodEmoji`,(e,t)=>{zn.init(e,t),ls.init(e,t)}),Ss=/*@__PURE__*/ I(`ZodNanoID`,(e,t)=>{Bn.init(e,t),ls.init(e,t)}),Cs=/*@__PURE__*/ I(`ZodCUID`,(e,t)=>{Vn.init(e,t),ls.init(e,t)}),ws=/*@__PURE__*/ I(`ZodCUID2`,(e,t)=>{Hn.init(e,t),ls.init(e,t)}),Ts=/*@__PURE__*/ I(`ZodULID`,(e,t)=>{Un.init(e,t),ls.init(e,t)}),Es=/*@__PURE__*/ I(`ZodXID`,(e,t)=>{Wn.init(e,t),ls.init(e,t)}),Ds=/*@__PURE__*/ I(`ZodKSUID`,(e,t)=>{Gn.init(e,t),ls.init(e,t)}),Os=/*@__PURE__*/ I(`ZodIPv4`,(e,t)=>{Xn.init(e,t),ls.init(e,t)}),ks=/*@__PURE__*/ I(`ZodIPv6`,(e,t)=>{$n.init(e,t),ls.init(e,t)}),As=/*@__PURE__*/ I(`ZodCIDRv4`,(e,t)=>{er.init(e,t),ls.init(e,t)}),js=/*@__PURE__*/ I(`ZodCIDRv6`,(e,t)=>{nr.init(e,t),ls.init(e,t)}),Ms=/*@__PURE__*/ I(`ZodBase64`,(e,t)=>{ar.init(e,t),ls.init(e,t)}),Ns=/*@__PURE__*/ I(`ZodBase64URL`,(e,t)=>{cr.init(e,t),ls.init(e,t)}),Ps=/*@__PURE__*/ I(`ZodE164`,(e,t)=>{lr.init(e,t),ls.init(e,t)}),Fs=/*@__PURE__*/ I(`ZodJWT`,(e,t)=>{dr.init(e,t),ls.init(e,t)}),Is=/*@__PURE__*/ I(`ZodNumber`,(e,t)=>{fr.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mo(e,t,n,r),e.isFinite=!0},/*@__PURE__*/ N({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=co(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=co(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=co(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>co(e).format??null},{gt(e,t){return this.check(/* @__PURE__ */ fa(e,t))},gte(e,t){return this.check(/* @__PURE__ */ pa(e,t))},min(e,t){return this.check(/* @__PURE__ */ pa(e,t))},lt(e,t){return this.check(/* @__PURE__ */ ua(e,t))},lte(e,t){return this.check(/* @__PURE__ */ da(e,t))},max(e,t){return this.check(/* @__PURE__ */ da(e,t))},int(e){return this.check(Rs(e))},safe(e){return this.check(Rs(e))},positive(e){return this.check(/* @__PURE__ */ fa(0,e))},nonnegative(e){return this.check(/* @__PURE__ */ pa(0,e))},negative(e){return this.check(/* @__PURE__ */ ua(0,e))},nonpositive(e){return this.check(/* @__PURE__ */ da(0,e))},multipleOf(e,t){return this.check(/* @__PURE__ */ ma(e,t))},step(e,t){return this.check(/* @__PURE__ */ ma(e,t))},finite(){return this}}));function B(e){return/* @__PURE__ */ ia(Is,e)}let Ls=/*@__PURE__*/ I(`ZodNumberFormat`,(e,t)=>{pr.init(e,t),Is.init(e,t)});function Rs(e){return/* @__PURE__ */ aa(Ls,e)}let zs=/*@__PURE__*/ I(`ZodBoolean`,(e,t)=>{mr.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r)});function V(e){return/* @__PURE__ */ oa(zs,e)}let Bs=/*@__PURE__*/ I(`ZodNull`,(e,t)=>{hr.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(e,t,n,r)});function Vs(e){return/* @__PURE__ */ sa(Bs,e)}let Hs=/*@__PURE__*/ I(`ZodUnknown`,(e,t)=>{gr.init(e,t),os.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Us(){return/* @__PURE__ */ ca(Hs)}let Ws=/*@__PURE__*/ I(`ZodNever`,(e,t)=>{_r.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_o(e,t,n,r)});function Gs(e){return/* @__PURE__ */ la(Ws,e)}let Ks=/*@__PURE__*/ I(`ZodArray`,(e,t)=>{as(),xr.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r),e.element=t.element},{min(e,t){return this.check(/* @__PURE__ */ ga(e,t))},nonempty(e){return this.check(/* @__PURE__ */ ga(1,e))},max(e,t){return this.check(/* @__PURE__ */ ha(e,t))},length(e,t){return this.check(/* @__PURE__ */ _a(e,t))},unwrap(){return this.element}});function H(e,t){return/* @__PURE__ */ Aa(Ks,e,t)}let qs=/*@__PURE__*/ I(`ZodObject`,(e,t)=>{as(),Dr.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r),Re(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return G(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(T(this._zod.def,{catchall:e}))},passthrough(){return this.clone(T(this._zod.def,{catchall:Us()}))},loose(){return this.clone(T(this._zod.def,{catchall:Us()}))},strict(){return this.clone(T(this._zod.def,{catchall:Gs()}))},strip(){return this.clone(T(this._zod.def,{catchall:void 0}))},extend(e){return pe(this,e)},safeExtend(e){return he(this,e)},merge(e){return ge(this,e)},pick(e){return A(this,e)},omit(e){return j(this,e)},partial(...e){return _e(cc,this,e[0])},exactPartial(...e){return _e(uc,this,e[0],`exactPartial`)},required(...e){return ve(vc,this,e[0])}});function U(e,t){let n={type:`object`,shape:e??{},...k(t)};return new qs(n)}function W(e,t){return new qs({type:`object`,shape:e,catchall:Gs(),...k(t)})}let Js=/*@__PURE__*/ I(`ZodUnion`,(e,t)=>{kr.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r),e.options=t.options});function Ys(e,t){return new Js({type:`union`,options:e,...k(t)})}let Xs=/*@__PURE__*/ I(`ZodDiscriminatedUnion`,(e,t)=>{Js.init(e,t),jr.init(e,t)});function Zs(e,t,n){return new Xs({type:`union`,options:t,discriminator:e,...k(n)})}let Qs=/*@__PURE__*/ I(`ZodIntersection`,(e,t)=>{Mr.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r)});function $s(e,t){return new Qs({type:`intersection`,left:e,right:t})}let ec=/*@__PURE__*/ I(`ZodTuple`,(e,t)=>{as(),Fr.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(`.partial() cannot be used on tuple schemas containing refinements`);return this.clone({...e,items:e.items.map(e=>new cc({type:`optional`,innerType:e}))})}});function tc(e,t,n){let r=t instanceof Sn;return new ec({type:`tuple`,items:e,rest:r?t:null,...k(r?n:t)})}let nc=/*@__PURE__*/ I(`ZodRecord`,(e,t)=>{as(),zr.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function rc(e,t,n){return!t||!t._zod?new nc({type:`record`,keyType:z(),valueType:e,...k(t)}):new nc({type:`record`,keyType:e,valueType:t,...k(n)})}let ic=/*@__PURE__*/ I(`ZodEnum`,(e,t)=>{Br.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vo(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new ic({...t,checks:[],...k(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new ic({...t,checks:[],...k(r),entries:i})}});function G(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new ic({type:`enum`,entries:n,...k(t)})}let ac=/*@__PURE__*/ I(`ZodLiteral`,(e,t)=>{Vr.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yo(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function K(e,t){return new ac({type:`literal`,values:Array.isArray(e)?e:[e],...k(t)})}let oc=/*@__PURE__*/ I(`ZodTransform`,(e,t)=>{as(),Hr.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ge(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(ke(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(ke(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function sc(e){return new oc({type:`transform`,transform:e})}let cc=/*@__PURE__*/ I(`ZodOptional`,(e,t)=>{Wr.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ho(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function lc(e){return new cc({type:`optional`,innerType:e})}let uc=/*@__PURE__*/ I(`ZodExactOptional`,(e,t)=>{Gr.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ho(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function dc(e){return new uc({type:`optional`,innerType:e})}let fc=/*@__PURE__*/ I(`ZodNullable`,(e,t)=>{Kr.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pc(e){return new fc({type:`nullable`,innerType:e})}let mc=/*@__PURE__*/ I(`ZodDefault`,(e,t)=>{qr.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function hc(e,t){return new mc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ie(t)}})}let gc=/*@__PURE__*/ I(`ZodPrefault`,(e,t)=>{Yr.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ro(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _c(e,t){return new gc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ie(t)}})}let vc=/*@__PURE__*/ I(`ZodNonOptional`,(e,t)=>{Xr.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yc(e,t){return new vc({type:`nonoptional`,innerType:e,...k(t)})}let bc=/*@__PURE__*/ I(`ZodCatch`,(e,t)=>{$r.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function xc(e,t){return new bc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:ze(t)})}let Sc=/*@__PURE__*/ I(`ZodPipe`,(e,t)=>{ei.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.in=t.in,e.out=t.out});function Cc(e,t){return new Sc({type:`pipe`,in:e,out:t})}let wc=/*@__PURE__*/ I(`ZodPreprocess`,(e,t)=>{Sc.init(e,t),ni.init(e,t)}),Tc=/*@__PURE__*/ I(`ZodReadonly`,(e,t)=>{ri.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ec(e){return new Tc({type:`readonly`,innerType:e})}let Dc=/*@__PURE__*/ I(`ZodTemplateLiteral`,(e,t)=>{si.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bo(e,t,n,r)});function Oc(e,t){return new Dc({type:`template_literal`,parts:e,...k(t)})}let kc=/*@__PURE__*/ I(`ZodCustom`,(e,t)=>{ci.init(e,t),os.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r)});function Ac(e,t){return/* @__PURE__ */ ja(kc,e??(()=>!0),t)}function jc(e,t={}){return/* @__PURE__ */ Ma(kc,e,t)}function Mc(e,t){return/* @__PURE__ */ Na(e,t)}function Nc(e,t){return new wc({type:`pipe`,in:sc(e),out:t})}let Pc={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`};var Fc;Fc||={};function Ic(e){return/* @__PURE__ */ ea(us,e)}function Lc(e){return(t,n)=>{for(let r of e)Object.hasOwn(t,r)&&t[r]===void 0&&n.addIssue({code:`custom`,path:[r],message:`Explicit undefined is not valid JSON`})}}Ys([z(),B(),V(),Vs()]);function Rc(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}let zc=Symbol(`json-validation-leave`);function Bc(e){if(e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e))return!0;if(typeof e!=`object`)return!1;let t=/* @__PURE__ */ new Set,n=[e];try{for(;n.length>0;){let e=n.pop();if(e===zc)t.delete(n.pop());else if(!(e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e))){if(typeof e!=`object`||t.has(e))return!1;if(Array.isArray(e)){t.add(e),n.push(e,zc);for(let t=e.length-1;t>=0;--t)n.push(e[t])}else{if(!Rc(e))return!1;t.add(e),n.push(e,zc);for(let t in e)if(Object.hasOwn(e,t)){if(t===`__proto__`)return!1;n.push(e[t])}}}}}catch{return!1}return!0}let Vc=Ac(Bc,{message:`Invalid JSON value`}),Hc=Ac(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&Bc(e),{message:`Invalid JSON object`}),Uc=W({code:z().min(1),message:z().min(1),retryable:V(),diagnostic:z().min(1).optional(),stage:z().min(1).optional(),durationMs:B().int().nonnegative().optional(),stderrTail:z().min(1).optional()}).superRefine(Lc([`diagnostic`,`stage`,`durationMs`,`stderrTail`])),Wc=z().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u),Gc=e=>z().min(1).max(e).refine(e=>e.trim().length>0),Kc=rc(Wc,U({label:Gc(256).optional(),description:Gc(1024).optional()}).strict()).refine(e=>Object.keys(e).length<=16,`Too many locales`),qc=rc(Wc,Gc(4096)).refine(e=>typeof e.en==`string`,`English fallback is required`).refine(e=>Object.keys(e).length<=16,`Too many locales`),Jc=z().refine(e=>e.trim().length>0,{message:`Identifier must not be empty or whitespace`}),Yc=Jc.brand(),q=Jc.brand(),Xc=Jc.brand();Jc.brand();let Zc=Jc.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).brand();Jc.brand();let Qc=z().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),$c=Qc.max(128).regex(/^[A-Za-z0-9._~:-]+$/u,`Permission Mode ID must use transport-safe characters`).brand(),el=U({modes:H(U({id:$c,label:Qc.max(256),description:Qc.max(1024).optional(),dangerous:V().optional(),localizations:Kc.optional()}).strict()).min(1).max(32),defaultModeId:$c}).strict().superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.modes.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Permission Mode IDs must be unique`,path:[`modes`,r,`id`]}),n.add(i.id);n.has(e.defaultModeId)||t.addIssue({code:`custom`,message:`Default Permission Mode must exist in the catalog`,path:[`defaultModeId`]})});U({threadId:q,permissionModeId:$c}).strict();let tl=z().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`});U({sourceThreadId:q,lastTurnId:Xc.optional(),targetHarnessId:Yc,targetModel:tl.max(1024).optional(),targetThinkingOptionId:tl.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).optional()}).strict();let nl=U({sourceThreadId:q,sourceHarnessId:Yc,sourceHarnessLabel:tl.max(256).optional(),sourceModel:tl.max(1024).optional(),targetHarnessId:Yc,targetHarnessLabel:tl.max(256).optional(),targetModel:tl.max(1024).optional(),totalTurns:B().int().min(1),boundaryTurnNumber:B().int().min(1),includedTurnNumbers:H(B().int().min(1)),omittedTurns:B().int().min(0),preview:z().max(32e3),createdAtMs:B().int().nonnegative()}).strict();U({threadId:q,handoff:nl}).strict();let rl=z().regex(/^[a-z0-9][a-z0-9-]{0,63}$/u),il=z().min(1).max(512).refine(e=>!/\p{Cc}/u.test(e),`Role model must not contain control characters`),al=G([`stone`,`rose`,`mist`,`sage`,`amber`,`aqua`]),ol=Oc([`builtin:`,G([`pm-otter`,`frontend-otter`,`backend-otter`,`reviewer-otter`,`idea-otter`,`researcher-otter`,`writer-otter`,`architect-otter`,`debugger-otter`,`tester-otter`,`classic-otter`,`ops-otter`,`security-otter`,`audio-otter`,`scholar-otter`,`data-otter`,`advisor-otter`,`builder-otter`,`wizard-otter`,`sailor-otter`])]),sl=/^[a-zA-Z0-9_-]{1,64}\.(png|jpg|jpeg|webp)$/u,cl=Oc([`custom:`,z().regex(sl)]),ll=Oc([`catalog:`,z().regex(sl)]),ul=Ys([ol,cl]),dl=Ys([ol,ll]),fl=Ys([ul,ll]),pl=z().url().max(2048).refine(e=>/^https:\/\//i.test(e),`URL must use https://`),ml=U({en:z().trim().min(1).max(2e3),"zh-CN":z().trim().min(1).max(2e3)}),hl=U({slug:rl,name:ml,description:ml,avatar:dl,accentColor:al,recommendedHarnessId:Yc.optional(),author:z().trim().min(1).max(128),authorUrl:pl.optional(),sourceUrl:pl.optional(),license:z().trim().min(1).max(64).optional(),official:V().optional(),instructions:z().trim().min(1).max(1e5),updatedAt:Ic()});U({formatVersion:K(1),generatedAt:Ic(),roles:H(hl)});let gl=U({slug:rl,name:z().refine(e=>e.trim().length>0),avatar:ul,accentColor:al}),_l=gl.readonly(),vl=gl.extend({description:z(),harnessId:Yc,model:il.optional(),thinkingOptionId:Zc.optional(),instructions:z(),updatedAt:Ic()});vl.omit({updatedAt:!0,avatar:!0}).extend({avatar:fl}).partial({slug:!0}),U({locale:z().trim().min(1).max(64).optional()}),U({roles:H(vl)}),U({slug:rl}),U({role:vl.nullable()}),U({role:vl}),U({deleted:V()}),U({refresh:V().optional()}),U({roles:H(hl),fetchedAt:Ic(),likes:rc(rl,B().int().nonnegative()).optional(),myLikes:rc(rl,B().int().min(0).max(5)).optional(),stale:V().optional(),error:z().optional()}),U({slug:rl}),U({slug:rl,likes:B().int().nonnegative(),myLikes:B().int().min(0).max(5),maxLikes:K(5),limitReached:V().optional()});let yl=B().int().safe().nonnegative(),bl=B().finite().nonnegative(),xl=B().finite().min(0).max(100),Sl=U({version:Ys([K(3),K(4)]).optional(),requestId:z().min(1),turnId:z().min(1).max(1024),outputTokens:yl,startedAtMs:yl,completedAtMs:yl}).strict().refine(e=>e.completedAtMs>e.startedAtMs),Cl=U({version:Ys([K(2),K(3),K(4)]).optional(),value:bl,turnId:z().min(1).max(1024),at:yl}).strict();U({outputTimings:H(Sl).transform(e=>e.filter(e=>e.version===4)).optional(),outputTokensPerSecond:Cl.refine(e=>e.version===4).optional().catch(void 0),timeToFirstOutputMs:Cl.extend({value:yl}).optional()}).strict();let wl=e=>qc.refine(t=>Object.values(t).every(t=>t.length<=e)),Tl=U({composerIndicators:H(U({kind:K(`countdown`),id:z().min(1).max(64),expiresAtUnix:yl,label:wl(256).optional(),tooltip:wl(1024).optional()}).strict()).max(2).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,{message:`Composer indicator IDs must be unique`}).optional(),inputTokens:yl.optional(),cachedInputTokens:yl.optional(),cacheWriteInputTokens:yl.optional(),outputTokens:yl.optional(),outputTokensPerSecond:bl.optional(),sessionOutputTokensPerSecond:bl.optional(),apiOutputTokensPerSecond:bl.optional(),reasoningOutputTokens:yl.optional(),totalTokens:yl.optional(),totalCostUsd:bl.optional(),totalCredits:bl.optional(),contextUsagePercent:bl.optional(),cacheHitRatePercent:xl.optional(),contextWindowTokens:yl.optional(),contextUsedTokens:yl.optional(),planFiveHourUsedPercent:xl.optional(),planFiveHourResetsAtUnix:yl.optional(),planSevenDayUsedPercent:xl.optional(),planSevenDayResetsAtUnix:yl.optional(),sessionCacheHitRatePercent:xl.optional(),timeToFirstOutputMs:yl.optional(),latestRequestTimeToFirstOutputMs:yl.optional(),costSource:G([`publicPrice`,`native`]).optional(),unpricedModels:H(z().min(1)).min(1).optional()}).strict().superRefine((e,t)=>{Object.keys(e).length===0&&t.addIssue({code:`custom`,message:`Thread Usage must contain a reliable field`});let n=e.contextUsedTokens!==void 0;n!==(e.contextWindowTokens!==void 0)&&t.addIssue({code:`custom`,message:`Thread Usage context fields must be provided together`,path:[n?`contextWindowTokens`:`contextUsedTokens`]}),e.contextWindowTokens===0&&t.addIssue({code:`custom`,message:`Thread Usage contextWindowTokens must be greater than zero`,path:[`contextWindowTokens`]}),e.costSource!==void 0&&e.totalCostUsd===void 0&&t.addIssue({code:`custom`,message:`Thread Usage costSource must be provided with totalCostUsd`,path:[`costSource`]}),e.unpricedModels!==void 0&&e.costSource!==`publicPrice`&&t.addIssue({code:`custom`,message:`Thread Usage unpricedModels must be provided with a publicPrice cost`,path:[`unpricedModels`]}),e.planFiveHourResetsAtUnix!==void 0&&e.planFiveHourUsedPercent===void 0&&t.addIssue({code:`custom`,message:`Thread Usage planFiveHourResetsAtUnix must be provided with planFiveHourUsedPercent`,path:[`planFiveHourResetsAtUnix`]}),e.planSevenDayResetsAtUnix!==void 0&&e.planSevenDayUsedPercent===void 0&&t.addIssue({code:`custom`,message:`Thread Usage planSevenDayResetsAtUnix must be provided with planSevenDayUsedPercent`,path:[`planSevenDayResetsAtUnix`]})}),El=B().finite().min(0).max(100),Dl=G([`weekly`,`monthly`,`five_hour`,`seven_day`,`unknown`]),Ol=U({id:z().min(1).max(256),label:z().min(1).max(256),localizations:Kc.optional()}).strict(),kl=U({product:z().min(1),periodType:Dl.optional(),scope:Ol.optional(),localizations:Kc.optional(),used:B().finite().nonnegative().optional(),limit:B().finite().nonnegative().optional(),unit:z().min(1).max(32).optional(),usagePercent:El,resetsAt:z().min(1).optional()}).strict(),Al=U({availableCount:B().int().safe().positive(),nextExpiresAt:z().min(1).optional(),expiresAt:H(z().min(1)).min(1).max(32).optional()}).strict(),jl=U({used:B().finite().nonnegative().optional(),limit:B().finite().nonnegative().optional(),unit:z().min(1).max(32).optional(),label:z().min(1).optional(),scope:Ol.optional(),localizations:Kc.optional(),usedPercent:El,resetsAt:z().min(1).optional(),periodType:Dl,productUsage:H(kl).min(1).optional(),resetCredits:Al.optional()}).strict(),Ml=U({amount:B().finite().nonnegative(),currency:z().trim().min(1).max(8),label:z().trim().min(1).max(128).optional()}).strict();U({threadId:q,refresh:K(`exact`).optional()}).strict(),U({threadId:q,usage:Tl.nullable(),accountCredits:jl.optional(),accountBalance:Ml.optional(),accountCreditsSupported:V().optional()}).strict();let Nl=z().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),Pl=z().min(1).max(512).refine(e=>!/\p{Cc}/u.test(e),`Model Ref must not contain control characters`).brand(),Fl=G([`priority`,`ultrafast`]),Il=U({id:Pl,serviceTier:Fl.optional()}).strict();function Ll(e,t){return e?.id===t?.id&&e?.serviceTier===t?.serviceTier}let Rl=Nl.max(256),zl=U({id:Zc,label:Nl.max(256)}).strict(),Bl=U({ref:Il,label:Nl.max(256),resolvedModelLabel:Rl.optional(),fastModel:Il.optional(),supportedThinkingOptionIds:H(Zc).optional()}).strict().refine(e=>e.fastModel?.serviceTier===void 0||e.fastModel.id===e.ref.id,{path:[`fastModel`,`id`],message:`A tiered Fast Model must share the base Model ID`});function Vl(e,t){if(t)return e?.models.find(e=>Ll(e.ref,t)||Ll(e.fastModel,t))}let Hl=H(zl).superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Thinking option IDs must be unique`,path:[r,`id`]}),n.add(i.id)}),Ul=G([`catalog`,`activeModel`]),Wl=U({models:H(Bl),defaultModel:Il.optional(),thinkingOptions:Hl,defaultThinkingOptionId:Zc.optional(),thinkingOptionsScope:Ul.optional()}).strict().superRefine((e,t)=>{let n=[],r=new Set(e.thinkingOptions.map(({id:e})=>e));for(let[i,a]of e.models.entries()){n.some(e=>Ll(e,a.ref))&&t.addIssue({code:`custom`,message:`Model Catalog refs must be unique`,path:[`models`,i,`ref`,`id`]}),n.push(a.ref),a.fastModel&&(n.some(e=>Ll(e,a.fastModel))&&t.addIssue({code:`custom`,message:`Fast Model refs must be distinct and unique`,path:[`models`,i,`fastModel`]}),n.push(a.fastModel));let e=/* @__PURE__ */ new Set;for(let[n,o]of(a.supportedThinkingOptionIds??[]).entries())e.has(o)&&t.addIssue({code:`custom`,message:`Supported Thinking option IDs must be unique per Model`,path:[`models`,i,`supportedThinkingOptionIds`,n]}),e.add(o),r.has(o)||t.addIssue({code:`custom`,message:`Supported Thinking option must exist in the catalog`,path:[`models`,i,`supportedThinkingOptionIds`,n]})}e.defaultModel&&!Vl(e,e.defaultModel)&&t.addIssue({code:`custom`,message:`Default Model must exist in the Model Catalog`,path:[`defaultModel`,`id`]}),e.defaultThinkingOptionId&&!r.has(e.defaultThinkingOptionId)&&t.addIssue({code:`custom`,message:`Default Thinking option must exist in the catalog`,path:[`defaultThinkingOptionId`]})}),Gl=U({fork:V(),forkAcrossCwd:V(),rollbackLastTurn:V()}).strict().refine(e=>e.fork||!e.forkAcrossCwd,{path:[`forkAcrossCwd`],message:`Cross-cwd Fork requires exact history Fork support`}),Kl=G([`live`,`atCreate`]),ql=U({configuration:U({selectModel:V(),selectThinkingOption:V(),selectPermissionMode:V(),permissionModeScope:Kl.default(`live`)}).strict(),history:Gl,subagents:U({observe:V(),readTranscript:V()}).strict().optional(),autonomousTurns:U({observe:V()}).strict().optional(),steer:V().optional(),persistentPlan:V().optional()}).strict();U({effectiveModel:Il.optional(),resolvedModelLabel:Rl.optional(),effectiveThinkingOptionId:Zc.optional(),availableThinkingOptions:Hl.optional(),effectivePermissionModeId:$c.optional()}).strict().superRefine((e,t)=>{e.effectiveThinkingOptionId&&e.availableThinkingOptions&&!e.availableThinkingOptions.some(({id:t})=>t===e.effectiveThinkingOptionId)&&t.addIssue({code:`custom`,message:`Effective Thinking option must be currently available`,path:[`effectiveThinkingOptionId`]})});let Jl=U({open:K(!0)}).strict();Ys([U({status:K(`ready`),catalog:Wl,permissionModes:el.optional(),capabilities:ql,webUi:Jl.optional()}).strict().superRefine((e,t)=>{let n=e.capabilities.configuration.selectPermissionMode;n!==!!e.permissionModes&&t.addIssue({code:`custom`,message:`Permission Mode catalog and capability must agree`,path:n?[`permissionModes`]:[`capabilities`,`configuration`,`selectPermissionMode`]})}),U({status:G([`notInstalled`,`unavailable`,`error`]),error:Uc}).strict()]),U({harnessId:Yc,cwd:Nl.max(16384).optional(),refresh:V().optional(),purpose:K(`availability`).optional(),credentialAccess:G([`allow`,`retry`]).optional()}).strict(),U({harnessId:Yc}).strict(),U({}).strict(),U({threadId:q,model:Il}).strict(),U({threadId:q,thinkingOptionId:Zc}).strict(),U({threadId:q,includeReferenceCapability:V().optional()}).strict(),Zs(`owner`,[U({owner:K(`codex`),locked:V(),effectiveModel:Il.optional(),resolvedModelLabel:Rl.optional(),effectiveThinkingOptionId:Zc.optional(),effectivePermissionModeId:$c.optional(),history:Gl.optional(),supportsThreadReferences:K(!0).optional(),handoff:nl.optional(),roleSnapshot:_l.optional(),nativeSessionRef:Gs().optional()}),U({owner:K(`external`),harnessId:Nl.max(256),transportModelId:Nl.max(8192),effectiveModel:Il.optional(),resolvedModelLabel:Rl.optional(),effectiveThinkingOptionId:Zc.optional(),availableThinkingOptions:Hl.optional(),effectivePermissionModeId:$c.optional(),catalog:Wl.optional(),history:Gl,usage:Tl.optional(),handoff:nl.optional(),roleSnapshot:_l.optional(),nativeSessionRef:Gs().optional(),locked:K(!0)})]),U({threadIds:H(q).min(1).max(100)}).strict().superRefine(({threadIds:e},t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i)&&t.addIssue({code:`custom`,message:`Thread ownership-list IDs must be unique`,path:[`threadIds`,r]}),n.add(i)});let Yl=Zs(`owner`,[U({threadId:q,owner:K(`codex`)}).strict(),U({threadId:q,owner:K(`external`),harnessId:z().max(256).pipe(Yc)}).strict()]);U({threads:H(Yl).min(1).max(100)}).strict().superRefine(({threads:e},t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.entries())n.has(i.threadId)&&t.addIssue({code:`custom`,message:`Thread ownership-list results must be unique`,path:[`threads`,r,`threadId`]}),n.add(i.threadId)}),U({threadId:q,text:z().optional()}).strict(),U({kind:K(`application`),value:z().transform((e,t)=>{try{return JSON.parse(e)}catch{return t.addIssue({code:`custom`,message:`Invalid steering context JSON`}),Ve}}).pipe(U({expectedTurnId:Xc,clientUserMessageId:z().min(1),delivery:G([`newTurn`,`activeTurn`])}).strict())}).strict().transform(e=>e.value),G([`activeTurn`,`newTurn`]),U({delivery:G([`official`,`activeTurn`,`newTurn`])}).strict();let Xl=z().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u),Zl=Xl.pipe(Yc),Ql=Zl.refine(e=>e!==`codex`,`The official Codex identity is reserved`),$l=z().min(1).max(512).refine(e=>!/[\\\u0000:#?]/u.test(e)&&!e.startsWith(`/`)&&!e.split(`/`).some(e=>e===`..`||e===``),`Plugin resources must be relative paths inside the plugin`),eu=bs().refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Plugin documentation links must be credential-free HTTPS URLs`),tu=U({en:z().max(4096),"zh-CN":z().max(4096).optional()}).strict(),nu=U({commands:H(U({terminal:z().max(256),command:z().max(4096)}).strict()).max(8),before:tu.optional(),after:tu.optional(),downloads:H(U({label:z().max(128),url:eu}).strict()).max(8).optional()}).strict(),ru={id:Zl,name:z().trim().min(1).max(128),version:z().min(1).max(128),kind:K(`usage`).optional(),iconStyle:U({vector:U({viewBox:z().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),color:z().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),paths:H(U({d:z().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),fillRule:G([`evenodd`,`nonzero`]).optional(),fill:z().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()}).strict()).min(1).max(32)}).strict().optional(),background:z().regex(/^#[a-f0-9]{6}$/iu).optional(),borderRadius:B().min(0).max(50).optional(),paddingRatio:B().min(0).max(.25).optional()}).strict().optional(),installation:nu.optional(),notice:tu.optional(),launchCommand:K(!0).optional(),links:U({website:eu.optional(),documentation:eu.optional(),installation:eu.optional()}).strict().optional()};U({manifestVersion:K(1),...ru,adapterApiVersion:B().int().positive(),entry:$l,icon:$l.optional()}).strict();let iu=z().max(174828).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u),au=U({...ru,icon:iu.optional()}).strict();U({}).strict(),U({plugins:H(au.extend({id:Ql})).max(128)}).strict(),U({version:K(1),enabled:H(Zl).max(128)}).strict().refine(e=>new Set(e.enabled).size===e.enabled.length,{message:`Enabled plugin IDs must be unique`,path:[`enabled`]});let ou=131072,su=524288,cu=Xl,lu=G([`sidebar.thread-layout`,`sidebar.thread-badge`,`appearance.theme`]),uu=G([`appearance`,`interface`,`workflow`,`analytics`,`integrations`,`tools`]),du=z().trim().min(1).max(128);function fu(e){switch(e.match(/\.([^./]+)$/u)?.[1]?.toLowerCase()){case`png`:return`image/png`;case`jpg`:case`jpeg`:return`image/jpeg`;case`webp`:return`image/webp`;default:return}}let pu=e=>e.split(`/`).every(e=>!/[. ]$/u.test(e)),mu=$l.refine(e=>fu(e)!==void 0&&pu(e),`Images must be relative .png, .jpg, .jpeg, or .webp paths with no segments ending in a dot or space`),hu=z().trim().max(2048).regex(/^https?:\/\/[^/?#\\\s]+/iu,`Expected an HTTP(S) URL`).pipe(bs({protocol:/^https?$/u})).refine(e=>{let{username:t,password:n}=new URL(e);return!t&&!n&&!/[\\\s]/u.test(e)},`URL must not contain credentials, backslashes, or whitespace`);function gu(e){return W({en:e,"zh-CN":e})}let _u=gu(z().trim().min(1)),vu=H(uu).max(uu.options.length).refine(e=>new Set(e).size===e.length,`Duplicate categories`),yu=H(lu).max(lu.options.length).refine(e=>new Set(e).size===e.length,`Duplicate slots`),bu={key:z().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),label:_u,description:_u.optional()},xu={...bu,step:B().positive().optional(),default:B().optional()},Su=W({value:z(),label:_u}),Cu=Zs(`type`,[W({...bu,type:K(`boolean`),default:V().optional()}),W({...bu,type:K(`string`),placeholder:_u.optional(),default:z().optional()}),W({...xu,type:K(`number`),min:B().optional(),max:B().optional()}),W({...xu,type:K(`range`),min:B(),max:B()}),W({...bu,type:K(`select`),options:H(Su).min(1),default:z().optional()})]).superRefine((e,t)=>{let n=(e,n)=>t.addIssue({code:`custom`,path:[e],message:n});if(e.type===`number`||e.type===`range`){let{min:t=-1/0,max:r=1/0,default:i}=e;t>r&&n(`max`,`Must be at least min`),i!==void 0&&(i<t||i>r)&&n(`default`,`Must be within min and max`)}else if(e.type===`select`){let t=new Set(e.options.map(({value:e})=>e));t.size!==e.options.length&&n(`options`,`Duplicate option values`),e.default!==void 0&&!t.has(e.default)&&n(`default`,`Must match an option value`)}}),wu=U({manifestVersion:Rs().positive(),id:cu,name:Ys([du,gu(du)]),version:z().min(1).max(128),desktopApi:Rs().positive()}).passthrough().extend({manifestVersion:K(1),desktopApi:K(1),description:W({en:z().max(4096),"zh-CN":z().max(4096).optional()}).optional(),author:z().trim().min(1).max(128).optional(),repository:hu.optional(),details:W({en:z().max(16384),"zh-CN":z().max(16384).optional()}).optional(),icon:mu.optional(),screenshots:H(mu).max(4).refine(e=>new Set(e).size===e.length,`Duplicate screenshots`).optional(),desktop:W({script:$l,style:$l.optional()}).optional(),backend:W({script:$l.refine(pu)}).optional(),slots:yu.default(()=>[]),settingsSchema:H(Cu).max(32).refine(e=>new Set(e.map(({key:e})=>e)).size===e.length,`Duplicate setting keys`).optional(),categories:vu.optional()}).strict().refine(e=>e.desktop!==void 0||e.backend!==void 0,`Expected at least one desktop or backend entry`),Tu=z().regex(/^[a-f0-9]{64}$/u),Eu=W({state:G([`running`,`disabled`,`invalid`,`incompatible`,`conflict`,`failed`,`waiting`]),hash:Tu.optional(),error:z().optional(),conflictWith:cu.optional()});W({controllerPid:Rs().positive(),targetId:z().nullable(),updatedAt:Ic(),handledReloadToken:_s().optional(),extensions:rc(z(),Eu),surfaces:rc(z(),Eu).optional()});let Du=G([`official`,`community`]);function Ou(e){return e.origin===`https://api.github.com`&&/^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(e.pathname)}let ku=hu.refine(e=>{let t=new URL(e);return/\.zip$/iu.test(t.pathname)||Ou(t)||t.origin===`https://github.com`&&/^\/[\w-]+\/[\w.-]+\/zipball(?:\/.+)?\/?$/u.test(t.pathname)||t.origin===`https://codeload.github.com`&&/^\/[\w-]+\/[\w.-]+\/(?:zip|zipball|legacy\.zip)\/.+$/u.test(t.pathname)},`Expected a .zip download URL or a GitHub zipball URL`),Au=W({id:cu,version:z().trim().min(1).max(128),name:_u.extend({en:du,"zh-CN":du}),description:gu(z().trim().min(1).max(4096)),details:gu(z().trim().min(1).max(16384)).optional(),author:z().trim().min(1).max(128),repository:hu,stars:B().int().min(0).optional(),downloads:B().int().min(0).optional(),categories:vu.optional(),trustTier:Du.default(`community`),icon:hu.optional(),screenshots:H(hu).max(4).optional(),downloadUrl:ku,sha256:Tu,slots:yu.optional(),publishedAt:z().optional(),updatedAt:z().optional(),minCodexHostVersion:z().optional()});W({schemaVersion:K(1),generatedAt:z(),extensions:H(Au).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,`Duplicate extension IDs`)});let ju=z().trim().min(1).max(128),Mu=/^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³]) *(?:\.|$)/iu,Nu=cu.refine(e=>!Mu.test(e),`Reserved extension ID`),Pu=G([`desktop`,`web`]),Fu=Tu,Iu=_s(),Lu=$l.refine(e=>!/[\x00-\x1f\x7f<>"|*]/u.test(e)&&e.split(`/`).every(e=>!/[. ]$/u.test(e)&&!Mu.test(e)),`Expected a portable relative resource path`).refine(e=>e.split(`/`).length<=32,`Extension resources may be at most 32 segments deep`),Ru=wu.shape,zu=(e,t=0)=>W({en:z().trim().min(t).max(e),"zh-CN":z().trim().min(t).max(e)}),Bu=e=>Lu.refine(t=>t.endsWith(e),`Expected a ${e} file`),Vu=Bu(`.mjs`),Hu=Bu(`.css`).optional(),Uu=e=>e.normalize(`NFC`).toLowerCase(),Wu=W({manifestVersion:K(2),id:Nu,name:zu(128,1),version:z().trim().min(1).max(128),description:zu(4096),details:zu(16384).optional(),author:Ru.author,repository:Ru.repository,icon:Ru.icon.refine(e=>e===void 0||Lu.safeParse(e).success),screenshots:Ru.screenshots.refine(e=>e===void 0||e.every(e=>Lu.safeParse(e).success)),categories:Ru.categories,settingsSchema:Ru.settingsSchema,slots:Ru.slots.removeDefault().optional(),page:W({apiVersion:K(1),entry:Vu,style:Hu,title:zu(128,1).optional()}).optional(),widget:W({apiVersion:K(1),entry:Vu,style:Hu}).optional(),desktop:W({apiVersion:K(1),script:Bu(`.js`),style:Hu}).optional(),web:W({apiVersion:K(1),entry:Vu.optional(),style:Hu}).refine(({entry:e,style:t})=>e!==void 0||t!==void 0,`Expected a Web entry or style`).optional(),backend:W({apiVersion:K(1),entry:Vu}).optional()}).refine(({page:e,widget:t,desktop:n,web:r,backend:i})=>!!(e||t||n||r||i),`Expected at least one page, widget, desktop, web, or backend entry`).refine(({page:e,widget:t,web:n,backend:r})=>!r||[e?.entry,t?.entry,n?.entry].every(e=>e===void 0||Uu(e)!==Uu(r.entry)),{path:[`backend`,`entry`],message:`A backend entry cannot also be a frontend entry`});function Gu({hasPage:e,hasWidget:t,hasDesktop:n,hasWeb:r,hasBackend:i}){if(e||t||i&&!n&&!r)return[`desktop`,`web`];let a=[];return n&&a.push(`desktop`),r&&a.push(`web`),a}let Ku=ju,qu=G([`running`,`waiting`,`idle`,`unknown`]),Ju=U({createdAtMs:B().int().nonnegative()}),Yu=W({sourceThreadId:q,createdAtMs:B().int().nonnegative()}),Xu=W({harnessId:Yc,title:z().optional(),status:qu,archived:V(),updatedAtMs:B().int().nonnegative().optional()}),Zu=U({revision:Rs().nonnegative(),parents:rc(q,q),delegations:rc(q,Ju).optional(),handoffs:rc(q,Yu).optional(),nodes:rc(q,Xu),truncated:V()}).refine(e=>Object.keys(e.nodes).length<=5e3,`Too many Thread tree nodes`).refine(({parents:e,handoffs:t,nodes:n})=>Object.entries(e).every(([e,t])=>Object.hasOwn(n,e)&&Object.hasOwn(n,t))&&Object.entries(t??{}).every(([e,{sourceThreadId:t}])=>Object.hasOwn(n,e)&&Object.hasOwn(n,t)),`Missing Thread tree node`).refine(({parents:e,delegations:t})=>Object.keys(t??{}).every(t=>Object.hasOwn(e,t)),`Delegation metadata requires a matching parent edge`),Qu=z().min(1).max(128);W({});let $u=W({subscriptionId:Qu});W({}),$u.extend({snapshot:Zu});let ed=Rs().nonnegative(),td=W({revision:ed,enabled:H(Nu).max(64).refine(e=>new Set(e).size===e.length,`Duplicate extension IDs`)});W({version:K(1),seeded:H(Nu).max(64).refine(e=>new Set(e).size===e.length,`Duplicate extension IDs`)});let nd=U({version:z().trim().min(1).max(128),publishedAt:z().trim().min(1).max(64).optional(),notes:z().trim().min(1).max(8192),url:hu.optional()}),{downloadUrl:rd,...id}=Au.shape,ad=U({...id,id:Nu,format:K(`codexhost`),targets:H(Pu).min(1).max(2).refine(e=>new Set(e).size===e.length,`Duplicate targets`),apis:W({page:Rs().positive().optional(),widget:Rs().positive().optional(),desktop:Rs().positive().optional(),web:Rs().positive().optional(),backend:Rs().positive().optional()}),downloadUrl:rd.refine(e=>e.startsWith(`https://`),`Expected HTTPS`),downloads7d:B().int().min(0).optional(),featured:V().optional(),featuredOrder:Rs().nonnegative().optional(),changelog:H(nd).max(20).optional()}).refine(({targets:e,apis:t})=>{let n=Gu({hasPage:!!t.page,hasWidget:!!t.widget,hasDesktop:!!t.desktop,hasWeb:!!t.web,hasBackend:!!t.backend});return e.length===n.length&&n.every(t=>e.includes(t))},`Catalog targets must match the declared APIs`);U({schemaVersion:K(2),generatedAt:z().min(1),extensions:H(ad).max(1e4).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,`Duplicate extension IDs`)}).extend({catalogUrl:hu,fetchedAt:Ic(),cached:V(),stale:V().optional()});let od={id:Nu},sd={...od,activationId:Iu,digest:Fu},cd={...od,activationId:sd.activationId.optional()},ld=z().min(1).max(4096).refine(e=>/^(?:\/|[a-z]:[/\\])/iu.test(e)&&!e.includes(`\0`)&&!e.split(/[/\\]/u).some(e=>e===`.`||e===`..`),`Expected an absolute local path without dot segments`),ud=z().min(1).max(256).refine(e=>e.split(`/`).every(e=>e&&/^[a-z0-9_.-]+$/iu.test(e)&&e!==`.`&&e!==`..`),`Invalid GitHub ref`);function dd(e){return z().max(4*Math.ceil(e/3)).refine(t=>{let n=t.endsWith(`==`)?2:+!!t.endsWith(`=`);return t.length%4==0&&t.length*3/4-n<=e&&/^[A-Za-z0-9+/]*={0,2}$/u.test(t)},`Expected bounded standard padded base64`)}let fd=W({type:K(`github`),repository:z().max(150).regex(/^[a-z0-9-]+\/[a-z0-9_-][a-z0-9_.-]*$/iu),ref:ud.optional(),tag:ud.optional(),asset:z().max(255).regex(/^[a-z0-9_.-]+\.zip$/iu).optional(),subpath:Lu.optional()}).refine(({ref:e,tag:t,asset:n})=>!e||!t&&!n,`Use either a zipball ref or a release tag/asset`),pd=Ys([W({type:K(`catalog`),...od}),fd,W({type:K(`zip`),base64:dd(67108864).min(4)}),W({type:K(`zip`),localZipPath:ld}),W({type:K(`localDir`),localDir:ld})]),md=Zs(`type`,[W({type:K(`catalog`),...od}),fd,W({type:K(`zip`)}),W({type:K(`localDir`)})]),hd=W({...sd,manifest:Wu,installedAt:Ic(),source:md.optional()}),gd=e=>z().max(23+4*Math.ceil(e/3)).regex(/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/u),_d={desktopConflictWith:Nu.optional()},vd=G([`none`,`inactive`,`starting`,`running`,`failed`]),yd=Zs(`state`,[U({state:K(`updating`),targetVersion:z().trim().min(1).max(128).optional(),startedAt:Ic()}),U({state:K(`failed`),targetVersion:z().trim().min(1).max(128).optional(),startedAt:Ic(),updatedAt:Ic(),error:z().min(1).max(512),interruptedByShutdown:V().optional()})]),bd=Zs(`state`,[U({...hd.shape,state:K(`valid`),enabled:V(),..._d,iconDataUrl:gd(ou).optional(),screenshotDataUrls:H(gd(su)).max(4).optional(),backendState:vd.optional(),backendError:z().optional(),operation:yd.optional()}),U({state:G([`invalid`,`incompatible`]),id:z().min(1),enabled:V(),error:z()})]);U({revision:ed,configuration:td,diagnostics:H(z()),extensions:H(bd)}),W({revision:ed,extensions:H(hd.extend({..._d,settingsRevision:ed})).max(64)});let xd={list:`codexhost/extensions/list`,snapshot:`codexhost/extensions/snapshot`,catalog:`codexhost/extensions/catalog`,catalogIcon:`codexhost/extensions/catalogIcon`,catalogScreenshot:`codexhost/extensions/catalogScreenshot`,install:`codexhost/extensions/install`,update:`codexhost/extensions/update`,enable:`codexhost/extensions/enable`,disable:`codexhost/extensions/disable`,uninstall:`codexhost/extensions/uninstall`,recover:`codexhost/extensions/recover`,asset:`codexhost/extensions/asset`,settingsGet:`codexhost/extensions/settings/get`,settingsSet:`codexhost/extensions/settings/set`,backendInvoke:`codexhost/extensions/backend/invoke`,threadTree:`codexhost/extensions/threadTree`},Sd=Object.freeze(Object.values(xd));new Set(Sd),W({});let Cd={expectedRevision:ed};W({...od,...Cd}),U({...hd.shape,replaced:V()}),Zs(`state`,[W({state:K(`saved`),configuration:td}),W({state:K(`revision-conflict`),revision:ed})]),W({...cd,digest:sd.digest.optional(),path:Lu}),W({mimeType:z().min(1),base64:dd(16777216),digest:sd.digest}),W({mimeType:G([`image/png`,`image/jpeg`,`image/webp`]),base64:dd(ou)});let wd=Rs().min(0).max(3);W({mimeType:G([`image/png`,`image/jpeg`,`image/webp`]),base64:dd(su)}),W({settingsRevision:ed,values:Hc}),xd.list,U({includeOperations:V().optional()}),xd.snapshot,xd.catalog,W({forceRefresh:V().optional(),staleWhileRevalidate:V().optional()}),xd.catalogIcon,W({...od}),xd.catalogScreenshot,W({...od,index:wd}),xd.install,W({source:pd}),xd.update,W({...od,expectedDigest:sd.digest,expectedActivationId:sd.activationId.optional(),expectedVersion:z().trim().min(1).max(128).optional(),source:pd.optional()}),xd.enable,xd.disable,xd.uninstall,W({...od,removeData:V().optional(),expectedDigest:sd.digest.optional()}),W({...od,removed:V()}),xd.recover,W({expectedRevision:Cd.expectedRevision.optional()}),xd.asset,xd.settingsGet,W(cd),xd.settingsSet,W({...cd,expectedSettingsRevision:ed,values:Hc}),xd.backendInvoke,W({...cd,method:Ku,params:Vc.optional()}),W({result:Vc}),xd.threadTree;let Td=4096,Ed;function Dd(e){if(Ed===void 0&&(Ed=typeof TextEncoder==`function`?new TextEncoder:null),Ed!==null)return Ed.encode(e).length;let t=0;for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r<=127)t+=1;else if(r<=2047)t+=2;else if(r>=55296&&r<=56319&&n+1<e.length){let r=e.charCodeAt(n+1);r>=56320&&r<=57343?(t+=4,n+=1):t+=3}else t+=3}return t}let Od=z().regex(/^remote:[A-Za-z0-9_-]{8,512}$/u),kd=Ys([vs(),Od]),Ad=vs(),jd=z().regex(/^[a-z0-9][a-z0-9_-]{0,47}$/u),Md=G([`none`,`last_speaker`,`all`]),Nd=G([`active`,`muted`,`removed`]),Pd=Rs().nonnegative(),Fd=Rs().positive(),Id=Pd.max(200),Ld=z().refine(e=>e.trim().length>0),Rd=Ic(),zd={handle:jd.optional(),displayName:Ld.optional(),note:z().optional()},Bd=U({memberId:Ad,threadId:q,handle:jd,displayName:Ld,note:z().optional(),roleSlug:rl.optional(),roleSnapshot:_l.optional(),harnessId:Yc,status:Nd,projectless:V().optional(),showInSidebar:V().optional(),joinedAtSeq:Pd,lastDeliveredSeq:Pd,lastRosterVersion:Pd,lastMemoryVersion:Pd.default(0),createdAt:Rd}),Vd=U({workspaceRoot:Ld,outputDirectory:Ld}),Hd=U({hostId:Ld,displayName:Ld,state:Ld.optional(),color:z().optional(),filePreview:V().optional(),memberSidebarVisibility:V().optional(),sharedMemory:V().optional()}),Ud=Nc(e=>{if(typeof e==`object`&&e&&!Array.isArray(e)){let t=e;if(t.unmentionedPolicy===`member`&&t.unmentionedMemberId!==void 0)return{...t,unmentionedPolicy:`none`}}return e},U({roomId:kd,title:Ld,defaultCwd:Ld,projectlessWorkspace:Vd.optional(),unmentionedPolicy:Md.default(`none`),unmentionedMemberId:Ad.optional(),allowAgentMentions:V().default(!0),maxAgentHops:Id.default(10),relayHopLimit:Id.optional(),lastSeq:Pd,lastSpeakerMemberId:Ad.optional(),rosterVersion:Pd,memoryVersion:Pd.default(0),memorySha256:z().regex(/^[0-9a-f]{64}$/u).optional(),humanEpoch:Pd,relayPaused:V(),pinned:V(),createdAt:Rd,updatedAt:Rd,members:H(Bd),remote:Hd.optional()}).superRefine(({members:e,unmentionedPolicy:t,unmentionedMemberId:n},r)=>{n!==void 0&&t!==`none`&&r.addIssue({code:`custom`,path:[`unmentionedMemberId`],message:`A default member can only be set when unmentionedPolicy is "none"`});let i=/* @__PURE__ */ new Set;for(let[t,{handle:n,status:a}]of e.entries())a!==`removed`&&(i.has(n)&&r.addIssue({code:`custom`,path:[`members`,t,`handle`],message:`Handle must be unique among non-removed members`}),i.add(n))})),Wd=U({kind:G([`image`,`file`]),attachmentId:Ld.max(256),name:Ld.max(256),path:Ld.max(4096),bytes:Pd,mediaType:Ld.max(128).optional(),width:Fd.optional(),height:Fd.optional()}),Gd=U({roomId:kd,seq:Fd,messageId:Ld,senderType:G([`user`,`agent`,`system`]),senderMemberId:Ad.optional(),senderHandle:jd.optional(),senderName:z().optional(),senderThreadId:q.optional(),sourceTurnId:Ld.optional(),replyToSeq:Fd.optional(),content:z(),attachments:H(Wd).max(12).optional(),mentionedMemberIds:H(Ad),mentionAll:V().optional(),hopCount:Pd,durationMs:Pd.optional(),createdAt:Rd}),Kd={...zd,model:il.optional(),thinkingOptionId:Zc.optional(),worktree:V().optional()},qd=Zs(`kind`,[W({kind:K(`role`),roleSlug:rl,...Kd}),W({kind:K(`harness`),harnessId:Yc,...Kd}),W({kind:K(`existing`),threadId:q,...zd,includeRecentHistory:V().default(!0).optional()})]),Jd={roomId:kd},Yd={...Jd,memberId:Ad},Xd={title:Ld.optional(),unmentionedPolicy:Md.optional(),allowAgentMentions:V().optional(),maxAgentHops:Id.optional()};W({}),U({rooms:H(Ud)}),W({...Jd,limit:Fd.optional(),beforeSeq:Fd.optional()}),U({room:Ud.nullable(),messages:H(Gd),hasMore:V()}),W({...Xd,defaultCwd:Ld.optional(),members:H(qd)}),U({room:Ud}),W({...Jd,...Xd,unmentionedMemberId:Ad.nullable().optional(),pinned:V().optional(),relayPaused:V().optional()}).superRefine(({unmentionedPolicy:e,unmentionedMemberId:t},n)=>{t!=null&&e!==void 0&&e!==`none`&&n.addIssue({code:`custom`,path:[`unmentionedMemberId`],message:`A default member can only be set when unmentionedPolicy is "none"`})}),W(Jd),U({deleted:V()}),W({...Jd,member:qd}),U({room:Ud,member:Bd}),W({...Yd,...zd,status:Nd.optional(),showInSidebar:V().optional()}),W(Yd),W({...Yd,threadId:q,redeliverFrom:Fd.optional(),note:z().optional()}),W({...Jd,memberId:Ad.optional(),memberHandle:jd.optional(),threadId:q,redeliverFrom:Fd.optional(),note:z().optional()}).refine(e=>e.memberId!==void 0!=(e.memberHandle!==void 0),`Provide exactly one of memberId or memberHandle`),U({room:Ud,member:Bd,previousThreadId:q,awakened:V()});let Zd=U({roomId:kd,title:Ld,memberCount:Pd,updatedAt:Rd,member:U({memberId:Ad,threadId:q,handle:jd,displayName:Ld,status:Nd,harnessId:Yc,roleSlug:rl.optional(),roleName:Ld.optional()}).optional()});W({threadId:q.optional()}),U({rooms:H(Zd)}),W({...Jd,content:z().max(64e3),attachments:H(Wd).max(12).optional(),replyToSeq:Fd.optional(),targetMemberIds:H(Ad).optional(),mentionAll:V().optional(),notice:V().optional()}).superRefine((e,t)=>{e.notice===!0?(e.content.trim().length===0&&t.addIssue({code:`custom`,path:[`content`],message:`Notice content is required`}),e.content.length>2e3&&t.addIssue({code:`custom`,path:[`content`],message:`Notice content must be at most 2000 characters`}),((e.targetMemberIds?.length??0)>0||e.mentionAll===!0||(e.attachments?.length??0)>0)&&t.addIssue({code:`custom`,path:[`notice`],message:`System notices cannot target members or include attachments`})):e.content.trim().length===0&&(e.attachments?.length??0)===0&&t.addIssue({code:`custom`,path:[`content`],message:`Message content or at least one attachment is required`})}),U({room:Ud,message:Gd,awakenedMemberIds:H(Ad)}),W({...Jd,fromSeq:Fd.optional(),toSeq:Fd.optional(),limit:Fd.optional()}),U({...Jd,messages:H(Gd),totalSeq:Pd}),W(Jd),U({...Jd,memoryVersion:Pd,content:z(),updatedAt:Rd}),W({...Jd,content:z().refine(e=>Dd(e)<=Td,`Shared room memory must be at most ${Td} UTF-8 bytes`),expectedVersion:Pd.optional()}),U({room:Ud,memoryVersion:Pd,content:z(),updatedAt:Rd}),W({cwd:Ld,roomId:kd.optional()}),U({isGitRepo:V()}),U({threadId:q}).strict(),U({confirmed:V()}).strict();let Qd=[`codex-desktop`,`web`,`web-desktop-shell`,`web-mobile`,`ssh-remote`,`cli`],$d=[`darwin`,`win32`,`linux`],ef=[`arm64`,`x64`,`ia32`,`arm`],tf=[`zh`,`en`,`ja`,`ko`,`de`,`fr`,`es`,`pt`,`ru`,`other`],nf=[`codex`,`claude-code`,`antigravity`,`pi`,`opencode`,`cursor-cli`,`deepseek-harness`,`grok`,`omp`,`qwen-code`,`kiro-cli`,`codebuddy`,`workbuddy`,`workbuddy-cn`,`devin`,`hermes`,`qoder`,`qoder-cn`,`kimi-code`,`zcode`,`copilot`,`custom`],rf=[`official-relay`,`self-hosted-relay`,`tailscale-serve`,`tailscale-funnel`,`tailscale-ip`,`lan`,`custom-proxy`,`remote-peer`],af=z().min(1).max(40).regex(/^[0-9A-Za-z._+-]+$/u),of=G(Qd),sf=G(tf),cf=G(nf),lf=G(rf);new Set(nf),new Set(tf),U({enabled:V(),forcedOffByEnv:V()}).strict(),U({enabled:V()}).strict(),U({surfaces:H(of).max(12).optional(),harnesses:H(cf).max(32).optional(),remoteAccess:H(lf).max(12).optional()}).strict(),U({dailyActive:K(!0).optional(),weeklyActive:K(!0).optional(),monthlyActive:K(!0).optional(),newInstall:K(!0).optional(),retainedD1:K(!0).optional(),retainedD7:K(!0).optional(),remoteAny:K(!0).optional(),appVersion:af.optional(),codexDesktopVersion:af.optional(),os:G($d).optional(),arch:G(ef).optional(),uiLanguage:sf.optional(),surfaces:H(of).min(1).max(12).optional(),harnesses:H(cf).min(1).max(32).optional(),remoteAccess:H(lf).min(1).max(12).optional()}).strict().refine(e=>Object.keys(e).length>0,{message:`Telemetry heartbeat must contain at least one countable field`});let uf=4e3,df={threadId:q};Zs(`action`,[W({...df,action:G([`get`,`pause`,`resume`,`clear`])}),W({...df,action:G([`create`,`edit`]),objective:z().trim().min(1).refine(e=>Array.from(e).length<=uf,`A goal objective can have up to ${uf} characters.`)})]),U({goal:U({threadId:q,objective:z(),status:G([`active`,`paused`,`blocked`,`usageLimited`,`budgetLimited`,`complete`]),tokenBudget:Rs().positive().nullable().default(null),tokensUsed:Rs().nonnegative(),timeUsedSeconds:Rs().nonnegative()}).nullable()});let ff=G([`codex`,`openai-compatible`,`deepseek-asr`,`openai-chat-audio`]),pf=G([`native`,`wav`]),mf=/(?:^|[_-])(?:key|token|secret|password|passwd|pwd|auth|authorization|credential|signature|sig)(?:$|[_-])|(?:api|access|auth|client|app|private|bearer)[_-]?(?:key|token|secret)/i;function hf(e){let t=e.trim().toLowerCase().replace(/^\[|\]$/g,``);return t===`localhost`||t.endsWith(`.localhost`)||t===`::1`?!0:/^127(?:\.(?:25[0-5]|2[0-4]\d|1?\d?\d)){3}$/.test(t)}function gf(e){let t=e.trim();if(!t)return!1;try{let e=new URL(t);if(!e.hostname||e.username!==``||e.password!==``||e.hash!==``)return!1;if(e.protocol!==`https:`){if(e.protocol===`http:`){if(!hf(e.hostname))return!1}else return!1}for(let t of e.searchParams.keys())if(mf.test(t))return!1;return!0}catch{return!1}}let _f=z().max(2048).refine(e=>e===``||gf(e),{message:`Base URL must be empty or a valid https:// URL (http:// is allowed only for localhost/127.0.0.1/[::1]) without embedded credentials`}),vf=U({baseUrl:_f,model:z().max(256),hasApiKey:V(),apiKeyHint:z().max(64).optional(),apiKey:Gs().optional()});U({mode:ff,baseUrl:_f,model:z().max(256),hasApiKey:V(),apiKeyHint:z().max(64).optional(),apiKey:Gs().optional(),audioFormat:pf.optional(),providers:U({"openai-compatible":vf,"deepseek-asr":vf,"openai-chat-audio":vf}).optional(),codexAvailable:V(),available:V()}),U({mode:ff,baseUrl:z().max(2048).optional(),model:z().max(256).optional(),apiKey:z().max(4096).nullable().optional()}).strict().superRefine((e,t)=>{let n=e.baseUrl?.trim()??``,r=e.model?.trim()??``;e.mode===`openai-compatible`?gf(n)||t.addIssue({code:Pc.custom,path:[`baseUrl`],message:`OpenAI-compatible mode requires a valid https:// base URL (http:// is allowed only for loopback hosts)`}):e.mode===`openai-chat-audio`?(gf(n)||t.addIssue({code:Pc.custom,path:[`baseUrl`],message:`Multimodal Chat Audio mode requires a valid https:// base URL (http:// is allowed only for loopback hosts)`}),r||t.addIssue({code:Pc.custom,path:[`model`],message:`Multimodal Chat Audio mode requires a model name`})):n!==``&&!gf(n)&&t.addIssue({code:Pc.custom,path:[`baseUrl`],message:`Base URL must be empty or a valid https:// URL (http:// is allowed only for loopback hosts)`})});let yf=z().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);U({available:V(),audioFormat:pf.optional()}),U({path:z().min(1),mimeType:yf}).strict();let bf=G([`credentials-unavailable`,`login-expired`,`rate-limited`,`service-rejected`,`host-incompatible`,`network`,`timeout`,`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`]);Zs(`ok`,[U({ok:K(!0),text:z()}).strict(),U({ok:K(!1),error:U({code:bf}).strict()}).strict()]),U({}).strict(),U({ghAvailable:V(),starred:V()});let xf=z().trim().min(1),Sf=z().min(1),Cf=U({icon:z().nullable(),color:z().nullable()}),wf=Cf.nullable(),Tf={create:{method:`codexhost/thread/sections/create`,params:U({name:xf}).strict()},update:{method:`codexhost/thread/sections/update`,params:U({sectionId:Sf,name:xf,appearance:Cf.strict().nullable().optional()}).strict()},delete:{method:`codexhost/thread/sections/delete`,params:U({sectionId:Sf}).strict()}};Zs(`status`,[U({status:K(`unknown`)}),U({status:K(`confirmed`),sectionId:Sf,section:U({id:Sf,name:z().min(1),appearance:wf}).nullable(),syncPending:V()})]),[Tf.create.method,Tf.update.method,Tf.delete.method,...Sd],U({threadSectionsV1:K(!0).optional(),complete:K(!1).optional(),sections:H(U({id:z().min(1),name:z().min(1),appearance:wf.optional(),threads:H(Hc)}))}),U({threadId:z().min(1).max(1024),sectionId:z().min(1).max(1024).nullable(),beforeThreadId:z().min(1).max(1024).nullable().optional(),expectedSourceSectionId:z().min(1).max(1024).optional()}).refine(e=>e.expectedSourceSectionId===void 0||e.sectionId===null),U({threadIds:H(z().min(1))}).strict(),U({threadId:z().min(1).max(1024),pinned:V()}).strict(),U({}).strict(),U({parents:rc(z().min(1),z().min(1))}).strict(),U({prompt:z().max(16384).optional()}).strict(),U({projects:H(U({id:z(),name:z(),rootPaths:H(z()),createdAt:B().int().optional()})),nativeProjects:K(!0).optional(),assignments:rc(z(),z()),projectless:H(z()),pinned:H(z()),sectionProjects:rc(z(),H(z())).optional(),pinnedProjects:H(z()).optional()});let Ef=rc(z(),Us()),Df=U({epoch:z().uuid(),sequence:B().int().nonnegative()});Zs(`type`,[U({type:K(`projects-changed`),cursor:Df}),U({type:K(`skills-changed`),cursor:Df,cwd:z().optional()}),U({type:K(`harness-inspection-changed`),cursor:Df,harnessId:z().min(1)}),U({type:K(`display-settings-changed`),cursor:Df}),U({type:K(`sections-changed`),cursor:Df}),U({type:K(`groups-changed`),cursor:Df,roomId:z().optional()}),U({type:K(`preferences-changed`),cursor:Df,revision:B().int().nonnegative()}),U({type:K(`extensions-changed`),cursor:Df,revision:ed}),U({type:K(`hello`),version:K(1),cursor:Df,reset:V()}),U({type:K(`changed`),cursor:Df,threadId:z().min(1),method:z().min(1)})]);let Of=Zs(`type`,[U({type:K(`text`),id:z(),prompt:z(),secret:V().optional(),optional:V().optional()}),U({type:K(`choice`),id:z(),prompt:z(),multiple:V(),allowOther:V(),optional:V().optional(),options:H(U({value:z(),label:z(),description:z().optional()}))})]),kf=Zs(`type`,[U({type:K(`approval`),title:z(),description:z().optional(),subject:Us().optional(),actions:H(U({id:z(),label:z(),effect:z()}))}),U({type:K(`question`),title:z().optional(),questions:H(Of)})]),Af=U({requestId:Ys([z(),B().int()]),threadId:z(),kind:G([`approval`,`question`]),interaction:kf,request:Ef}),jf=U({id:z().min(1),clientUserMessageId:z().min(1),input:H(Ef),presentationInput:H(Ef).nullable().optional()}).passthrough();U({fields:H(U({path:H(Ys([z(),B().int().nonnegative()])),originalLength:B().int().nonnegative()}))});let Mf=U({id:z().min(1),status:z().min(1),codexhostTurnOutcome:U({status:K(`unknown`),reason:z()}).optional(),items:H(U({id:z().min(1),type:z().min(1)}).passthrough()),codexhostFileOperations:H(U({beforeItemId:z().nullable(),item:U({id:z().min(1),type:z().min(1)}).passthrough()})).optional(),error:U({message:z().optional()}).passthrough().nullable().optional(),fingerprint:z().min(1).optional(),unchanged:K(!0).optional()}).passthrough(),Nf=U({id:z().min(1).max(512),fingerprint:z().min(1).max(128)});U({threadId:z().min(1),knownTurns:H(Nf).max(64).optional(),truncateToolOutput:V().optional()});let Pf=U({harnessId:z().min(1),nativeSessionId:z().min(1)});U({cursor:Df,activeTurnId:z().min(1).nullable().optional(),command:U({name:z().min(1),turn:Mf,subsequentTurnId:z().min(1).optional()}).optional(),thread:U({id:z().min(1),cwd:z(),modelProvider:z().min(1),createdAt:B(),updatedAt:B(),recencyAt:B().nullable().optional(),status:U({type:z()}).passthrough(),name:z().nullable().optional(),preview:z().optional(),roleSnapshot:_l.optional(),codexhostImportSource:Pf.optional(),turns:H(Mf).length(0)}).passthrough(),turnsPage:U({data:H(Mf).max(5),nextCursor:z().nullable()}),configuration:U({codexCollaborationMode:G([`plan`,`default`]).optional(),native:U({model:z().min(1).max(1024).optional(),reasoningEffort:z().min(1).max(128).optional()}).optional(),effectiveModel:Il.optional(),effectiveThinkingOptionId:Zc.optional(),effectivePermissionModeId:$c.optional()}),queue:U({items:H(jf),pausedReason:G([`interrupted`,`outcome-unknown`,`failed`]).nullable()}).optional(),interactions:H(Af),handoff:nl.optional()}),U({version:K(1),owner:K(`service`).optional(),pid:B().int().positive(),port:B().int().min(1).max(65535),token:z().regex(/^[0-9a-f]{64}$/u),startedAt:B(),epoch:z().uuid(),capabilities:U({peerDelegation:K(1).optional(),threadReferenceContext:K(1).optional()}).optional()}),U({epoch:z().uuid(),threadId:z().min(1),requestId:Ys([z(),B().int()]),result:Ef}),U({includeArchived:V().optional(),officialCursor:U({live:z().nullable(),archived:z().nullable().optional()}).strict().optional(),scope:Ys([U({cwd:z().min(1).max(4096),excludeCwds:H(z().min(1).max(4096)).max(1024)}).strict(),U({projectId:z().min(1).max(1024),legacyThreadIds:H(z().min(1).max(1024)).max(1024),rootPaths:H(z().min(1).max(4096)).max(1024).optional()}).strict()]).optional()}).strict(),U({threads:H(Hc),ownership:H(Yl),archivedThreadIds:H(q),officialCursor:U({live:z().nullable(),archived:z().nullable().optional()}).strict().optional()}).strict(),au.pick({id:!0,name:!0,icon:!0,iconStyle:!0});let Ff=W({threadId:z().max(1024),title:z().max(240),project:z().max(240),harness:W({id:z().min(1).max(128),name:z().min(1).max(128)}).optional(),state:G([`idle`,`running`,`waiting`,`completed`,`failed`]),updatedAt:B().nonnegative()});W({epoch:z().max(128),revision:Rs().nonnegative(),running:Rs().nonnegative(),waiting:Rs().nonnegative(),sessions:H(Ff).max(32).default([]),notifications:H(W({threadId:z().max(1024),key:z().max(4096),kind:G([`completed`,`failed`,`approval`,`question`]),revision:Rs().nonnegative()})).max(256)}),Object.freeze({appearance:[`appearance`,`外观主题`],interface:[`interface`,`界面增强`],workflow:[`workflow`,`效率与协作`],analytics:[`analytics`,`数据与统计`],integrations:[`integrations`,`外部集成`],tools:[`tools`,`实用工具`]}),U({threadId:q.optional(),cwd:z().min(1).optional()}).strict().refine(e=>!(e.threadId&&e.cwd),{message:`Specify threadId or cwd, not both`});let If=U({name:z().min(1).regex(/^[^\s[\]]+$/u),description:z().optional(),path:z().min(1),scope:G([`project`,`global`]),source:z().min(1)}).strict();U({revision:B().int().nonnegative(),complete:V(),skills:H(If),warnings:H(z()).optional()}).strict(),U({cwd:z().min(1).optional()}).strict();let Lf=U({kind:G([`public`,`relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`]),url:z().min(1)}).strict(),Rf=Zs(`status`,[U({status:K(`not-installed`)}),U({status:K(`not-running`)}),U({status:K(`not-logged-in`)}),U({status:K(`https-disabled`)}),U({status:K(`not-serving`),command:z()}),U({status:K(`occupied`),target:z()}),U({status:K(`serving`),url:z(),funnel:V()}),U({status:K(`error`),message:z()})]);U({state:Rf,error:z().optional()}).strict();let zf=Zs(`status`,[U({status:K(`on`)}),U({status:K(`off`)}),U({status:K(`invalid`),reason:z()})]),Bf=U({lan:V(),autostart:zf}).strict(),Vf=U({expiresAt:z().optional(),issuing:V(),failure:U({detail:z().optional(),retryAt:z(),paused:V()}).optional()}),Hf=Zs(`status`,[U({status:K(`off`),reason:G([`invite`,`name-taken`,`banned`]).optional()}),U({status:K(`connecting`),reason:G([`full`,`unreachable`]).optional()}),U({status:K(`connected`),url:z(),certificate:Vf}),U({status:K(`missing-certificate`),url:z(),certificate:Vf}),U({status:K(`stopped`),reason:G([`replaced`,`rejected`,`unsupported-version`])})]);z().max(253).regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/i).transform(e=>e.toLowerCase()),z().regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)?$/);let Uf=G([`official`,`self-hosted`]);U({secret:z().min(1),lastUsedAt:B().nullable(),networkUrls:H(Lf),directCandidates:H(Lf).optional(),tailscale:Rf,background:Bf.optional(),relay:U({state:Hf,enabled:V(),kind:Uf,officialHost:z(),customHost:z().optional(),officialHostname:z().optional(),customHostname:z().optional(),quotaUntil:z().optional()}).strict().optional()}).strict();let Wf=W({threadId:z().min(1).max(1024),view:G([`result`,`messages`]),from:B().int().min(1).max(2**53-1).optional(),to:B().int().min(1).max(2**53-1).optional()}),Gf=/^[a-zA-Z0-9_-]{1,64}$/u,Kf=z().regex(Gf),qf=z().regex(Gf),Jf=z().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u),Yf=G([`relay`,`tailscale`,`lan`,`ssh`,`custom`]),Xf=G([`auto`,`key`,`password`]);U({host:z().trim().min(1).max(255),port:B().int().min(1).max(65535).optional(),user:z().trim().min(1).max(128).optional(),identityFile:z().trim().min(1).max(1024).optional(),authMode:Xf.default(`auto`),remoteDataDir:z().trim().min(1).max(1024).optional()});let Zf=U({host:z().min(1).max(255),port:B().int().min(1).max(65535).optional(),user:z().min(1).max(128).optional(),authMode:Xf,keyInstalled:V().optional()}),Qf=[`blue`,`purple`,`cyan`,`green`,`amber`,`rose`,`slate`],$f=G(Qf),ep=new Set(Qf);function tp(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return Qf[(t>>>0)%Qf.length]??Qf[0]}function np(e,t){return typeof t==`string`&&ep.has(t)?t:tp(e)}let rp=G([`connected`,`connecting`,`auth-error`,`offline`,`disabled`]),ip=U({peerId:Kf,hostId:Jf,nodeId:qf.optional(),name:z().min(1).max(120),color:$f.optional(),origin:z().min(1).max(2048),transportKind:Yf,ssh:Zf.optional(),encrypted:V(),enabled:V(),state:rp,supportsPeerPairing:V().optional(),pairedBack:V().optional(),linkedPeerIds:H(Kf).max(128).optional(),latencyMs:B().int().nonnegative().optional(),version:z().max(128).optional(),platform:z().max(64).optional(),hostname:z().max(255).optional(),homeDir:z().max(4096).optional(),lastError:z().max(1e3).optional(),projectCount:B().int().nonnegative(),createdAt:z(),updatedAt:z()});U({localPlatform:z().max(64).optional(),peers:H(ip)}),U({connectionUrl:z().min(1).max(4096).optional(),origin:z().min(1).max(2048).optional(),token:z().min(1).max(2048).optional(),name:z().trim().min(1).max(120).optional(),color:$f.optional(),pairBack:V().optional(),meshPeerIds:H(Kf).max(64).optional(),selfOrigin:z().min(1).max(2048).optional()}).refine(e=>!!e.connectionUrl||!!e.origin&&!!e.token,`Provide either connectionUrl or both origin and token`),W({origin:z().min(1).max(2048),token:z().min(1).max(2048),name:z().trim().min(1).max(120).optional(),color:$f.optional(),expectedNodeId:qf.optional()}),U({status:G([`added`,`updated`,`existing`]),peerId:Kf,hostId:Jf,nodeId:qf.optional()});let ap=G([`added`,`updated`,`existing`,`failed`,`skipped`]);U({results:H(U({targetPeerId:Kf,targetName:z().min(1).max(120),introducedHost:Ys([K(`local`),Kf]),introducedName:z().min(1).max(120),status:ap,error:z().max(1e3).optional()}))}),U({peerIds:H(Kf).max(64).optional(),includeSelf:V().optional(),includeMesh:V().optional(),selfOrigin:z().min(1).max(2048).optional()}),U({peerId:Kf,name:z().trim().min(1).max(120).optional(),color:$f.nullable().optional(),connectionUrl:z().min(1).max(4096).optional(),origin:z().min(1).max(2048).optional(),token:z().min(1).max(2048).optional(),enabled:V().optional()}),U({peerId:Kf}),U({removed:V()}),U({peerId:Kf.optional(),connectionUrl:z().min(1).max(4096).optional(),origin:z().min(1).max(2048).optional(),token:z().min(1).max(2048).optional()}).refine(e=>!!e.peerId||!!e.connectionUrl||!!e.origin&&!!e.token,`Provide peerId, connectionUrl, or both origin and token`);let op=U({id:z().min(1).max(1024),name:z().min(1).max(512),path:z().min(1).max(8192)});U({ok:V(),nodeId:qf.optional(),supportsPeerPairing:V().optional(),pairedBack:V().optional(),latencyMs:B().int().nonnegative().optional(),origin:z().max(2048).optional(),transportKind:Yf.optional(),encrypted:V().optional(),version:z().max(128).optional(),platform:z().max(64).optional(),hostname:z().max(255).optional(),homeDir:z().max(4096).optional(),projectCount:B().int().nonnegative().optional(),projects:H(op).optional(),error:z().max(1e3).optional()});let sp=U({id:z().min(1).max(1024),name:z().min(1).max(512),path:z().min(1).max(8192),threadIds:H(z().min(1).max(1024))}),cp=U({attachments:K(1).optional(),workspaceFiles:K(1).optional(),officePreview:K(1).optional(),delegation:K(1).optional(),peerPairing:K(1).optional(),extensionUpdateTracking:K(1).optional(),groupMemberSidebarVisibility:K(1).optional(),groupSharedMemory:K(1).optional()}),lp=U({version:z().max(128),platform:z().max(64),hostname:z().max(255),homeDir:z().max(4096).optional(),epoch:z().min(1).max(256),nodeId:qf.optional(),peerNodes:rc(Jf,qf).refine(e=>Object.keys(e).length<=128).optional(),projects:H(sp),capabilities:cp.optional()});W({threadId:z().min(1).max(1024),scope:z().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u).optional(),requestId:z().min(1).max(256).optional(),mode:G([`queue`,`steer`]).optional(),expectedTurnId:z().min(1).max(1024).nullable().optional(),content:H(Zs(`type`,[W({type:K(`text`),text:z()}),W({type:K(`file`),receiptId:z().min(1).max(128)})])).min(1).max(64)});let up=U({ok:K(!1),error:U({code:z(),message:z(),details:rc(z(),Us()).optional()})});Ys([U({ok:K(!0),value:U({receiptId:z().min(1),file:U({attachmentId:z(),name:z(),bytes:B().int().nonnegative()})})}),up]),Ys([U({ok:K(!0),value:U({accepted:K(!0)})}),up]);let dp=U({name:z().min(1).max(512),path:z().min(1).max(8192),kind:K(`directory`)});U({peerId:Kf,path:z().min(1).max(8192).optional()}),U({path:z().min(1).max(8192),parentPath:z().min(1).max(8192).nullable(),homeDir:z().min(1).max(8192).optional(),entries:H(dp)}),U({peerId:Kf,parentPath:z().min(1).max(8192),name:z().min(1).max(255).refine(e=>e.trim().length>0,`Directory name cannot be blank`)}),U({path:z().min(1).max(8192),name:z().min(1).max(255)}),U({peerId:Kf,path:z().min(1).max(8192),title:z().trim().min(1).max(255).optional()}),U({peerId:Kf,workspaceId:z().min(1).max(1024),title:z().trim().min(1).max(255)}),U({peerId:Kf,workspaceId:z().min(1).max(1024)}),U({workspaceId:z().min(1).max(1024).optional(),manifest:lp}),U({sessionHostId:z().min(1).max(128).optional()}),U({hosts:H(U({hostId:Ys([K(`local`),Jf]),name:z().min(1).max(120),isLocal:V().optional(),color:$f.optional(),hostname:z().max(255).optional()}))}),U({hostId:Ys([K(`local`),Jf])}),U({harnesses:H(U({id:z().regex(/^[a-z0-9][a-z0-9-]*$/u),name:z().min(1).max(120)}))}),U({hosts:H(U({alias:z().min(1).max(255),hostName:z().max(255).optional(),user:z().max(128).optional(),port:B().int().min(1).max(65535).optional(),identityFile:z().max(1024).optional()}))}),U({host:z().trim().min(1).max(255),port:B().int().min(1).max(65535).optional(),user:z().trim().min(1).max(128).optional(),identityFile:z().trim().min(1).max(1024).optional(),authMode:Xf.default(`auto`),password:z().max(1024).optional(),installAuthorizedKey:V().optional(),name:z().trim().min(1).max(120).optional(),color:$f.optional(),remoteDataDir:z().trim().min(1).max(1024).optional(),sessionId:z().min(1).max(128).optional()}),U({ok:V(),codexhostInstalled:V(),version:z().max(128).optional(),nodeId:qf.optional(),platform:z().max(64).optional(),hostname:z().max(255).optional(),latencyMs:B().int().nonnegative().optional(),errorCode:z().max(128).optional(),error:z().max(1e3).optional()}),U({ok:V(),version:z().max(128).optional(),message:z().max(1e3).optional()}),U({promptId:z().min(1).max(128),sessionId:z().min(1).max(128).optional(),peerId:Kf.optional(),host:z().min(1).max(255),kind:G([`host-key`,`password`,`passphrase`,`otp`,`generic`]),prompt:z().min(1).max(1e3),echo:V()}),U({promptId:z().min(1).max(128),sessionId:z().min(1).max(128).optional(),response:z().max(1024).optional(),cancel:V().optional()}),W({hostId:Jf,threadId:z().min(1).max(1024).optional()});let fp=G([`listHarnesses`,`inspect`,`start`,`send`,`cancel`,`read`,`answer`,`list`]);W({operation:fp,hopCount:B().int().min(0).max(16),sourceId:Kf.optional(),input:Hc});let pp=W({code:z().min(1).max(128),message:z().max(4096),details:Hc.optional()});Ys([W({ok:K(!0),value:Vc}),W({ok:K(!1),error:pp})]);let mp=W({id:z().min(1).max(1024),name:z().min(1).max(512),path:z().min(1).max(8192)});W({hosts:H(W({hostId:Jf,nodeId:qf.optional(),displayName:z().min(1).max(120),online:V(),state:rp,delegation:V(),projects:H(mp),platform:z().max(64).optional(),hostname:z().max(255).optional(),homeDir:z().max(4096).optional()}))}),W({version:K(1),instanceId:z().min(1).max(128),pid:B().int().positive(),endpoint:z().min(1).max(256),token:z().regex(/^[0-9a-f]{64}$/u),startedAt:B().int().nonnegative()}),Ys([W({operation:K(`hosts`)}),W({operation:fp,hostId:Jf,hopCount:B().int().min(0).max(16),timeoutMs:B().int().min(1).max(12e4).optional(),input:Hc})]);let hp=U({id:z().min(1).max(256),harnessId:z().min(1),label:z().min(1).max(512),provider:G([`openai-codex`,`xai`])}).strict(),gp=z().regex(/^[a-z][a-z0-9-]{0,47}$/),_p=U({name:gp,source:hp,importedAt:z()}).strict(),vp=Zs(`action`,[U({action:K(`list`)}).strict(),U({action:K(`import`),sourceId:z().min(1).max(256),name:gp,confirmed:K(!0)}).strict(),U({action:K(`reimport`),sourceId:z().min(1).max(256),name:gp,confirmed:K(!0)}).strict(),U({action:K(`remove`),name:gp,confirmed:K(!0)}).strict()]),yp=U({provider:z().min(1).max(128),type:G([`oauth`,`api_key`,`unknown`]),label:z().min(1).max(512).optional(),vendor:G([`openai-codex`,`xai`]).optional()}).strict();U({sources:H(hp),targets:H(U({harnessId:z(),providers:H(G([`openai-codex`,`xai`])),imports:H(_p),others:H(yp).default([])}).strict())}).strict(),U({targetHarnessId:z().min(1).max(128).optional(),request:vp}).strict(),U({events:V()});let bp=H(W({agent:z().min(1).max(128),section:G([`main`,`more`,`auto`])})).max(256).refine(e=>new Set(e.map(e=>e.agent)).size===e.length,`Duplicate Harness IDs`);W({entries:bp.nullable()}),W({}),W({entries:bp,initializeOnly:V().optional()});let xp=W({enabled:V(),timeoutMinutes:B().int().min(5).max(1440)});Object.freeze({enabled:!0,timeoutMinutes:10});let Sp=z().regex(/^external$/u),Cp=Yc.transform(e=>String(e)),wp=W({model:Il.optional(),thinkingOptionId:Zc.optional(),permissionModeId:$c.optional()}).refine(e=>!!(e.model||e.thinkingOptionId||e.permissionModeId),`A default configuration must contain a preference`);Zs(`mode`,[W({mode:K(`global`)}),W({mode:K(`last`)}),W({mode:K(`manual`),harnessId:Yc})]);let Tp=W({lastHarness:Yc.optional(),byHarness:rc(Cp,wp)}),Ep=W({model:Il.optional(),thinkingOptionId:Zc.optional()}).refine(e=>!!(e.model||e.thinkingOptionId),`A delegation default must contain a Model or Thinking option`),Dp=W({byHarness:rc(Cp,Ep)}),Op=z().min(1).max(1024),kp=U({idleRelease:xp.optional(),favorites:rc(Cp,H(Op).max(2048)).default({}),newThread:Tp.optional(),delegation:Dp.optional(),showGroupChatsInSidebar:V().optional()});W({scope:Sp,revision:B().int().nonnegative(),values:kp}),W({scope:Sp.default(`external`)});let Ap=Zs(`kind`,[W({kind:K(`idleRelease`),value:xp}),W({kind:K(`favorite`),harnessId:Yc,modelId:Op,enabled:V()}),W({kind:K(`favorites`),harnessId:Yc,modelIds:H(Op).max(2048)}),W({kind:K(`newThread`),lastHarness:Yc.optional(),harnessId:Yc.optional(),configuration:wp.optional()}),W({kind:K(`delegation`),harnessId:Yc,configuration:Ep.nullable()}),W({kind:K(`groupChatsSidebar`),visible:V()})]);W({scope:Sp.default(`external`),operations:H(Ap).min(1).max(256),initializeOnly:V().optional(),expectedRevision:B().int().nonnegative().optional()}).superRefine((e,t)=>{for(let n of e.operations)n.kind===`newThread`&&(!n.lastHarness&&!n.configuration||!!n.harnessId!=!!n.configuration)&&t.addIssue({code:`custom`,message:`A default Harness or complete configuration is required`})}),W({version:K(1),revision:B().int().nonnegative(),scopes:rc(Sp,kp)});let jp=B().finite().nonnegative(),Mp=W({input:jp,output:jp,cacheRead:jp.optional(),cacheWrite:jp.optional(),cacheWrite1h:jp.optional()}),Np=z().max(512).refine(e=>e.trim()===e&&e.length>0,`Model ID is required`);W({path:z(),entries:H(W({key:z(),price:Mp})),error:z().nullable()}),W({}),W({key:Np,price:Mp.nullable(),previousKey:Np.optional()}),W({model:Np});let Pp=W({official:V().optional(),canonicalModelId:z().min(1).optional(),provider:z().min(1).max(512),model:z().min(1).max(512),price:Mp});W({price:Mp.nullable(),suggestions:H(Pp).max(6).optional()});let Fp=[`today`,`7d`,`30d`,`90d`,`all`],Ip=B().int().min(0).max(2**53-1),Lp=z().regex(/^\d{4}-\d{2}-\d{2}$/u),Rp=z().min(1).max(128),zp=z().min(1).max(512),Bp=z().min(1).max(4096);W({range:G(Fp),timeZone:z().min(1).max(128).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Unsupported usage statistics timezone`).optional(),harness:Rp.optional(),model:zp.nullable().optional(),project:Bp.nullable().optional(),date:Lp.optional()});let Vp=W({requests:Ip,inputTokens:Ip,cachedInputTokens:Ip,cacheWriteInputTokens:Ip,cacheKnownInputTokens:Ip,cacheHitCachedInputTokens:Ip,cacheHitInputTokens:Ip,outputTokens:Ip,reasoningOutputTokens:Ip,costUsd:B().finite().min(0),unpricedRequests:Ip,unmeteredRequests:Ip}),Hp=Vp.shape,Up=W({harness:Rp,sessionId:z().min(1).max(512),project:Bp.nullable(),title:z().min(1).max(200).optional(),models:H(zp).max(16),firstAtMs:Ip,lastAtMs:Ip,...Hp});W({range:G(Fp),from:Lp.nullable(),to:Lp,filters:W({harness:Rp.nullable(),model:zp.nullable(),unknownModel:V(),project:Bp.nullable(),unknownProject:V(),date:Lp.nullable()}),reading:W({complete:V(),sources:Ip,read:Ip}),failures:H(W({harness:Rp,message:z().max(2048)})).max(256),options:W({harnesses:H(Rp).max(256),models:H(zp.nullable()).max(4096),projects:H(Bp.nullable()).max(4096)}),modelLabels:H(W({harness:Rp,model:zp,label:zp})).max(4096).optional(),credits:H(W({harness:Rp,model:zp.nullable(),credits:B().finite().min(0),reportedRequests:Ip,requests:Ip})).max(4096).optional(),totals:Vp,daily:H(W({date:Lp,harness:Rp,...Hp})).max(2e5),hourly:H(W({weekday:B().int().min(0).max(6),hour:B().int().min(0).max(23),...Hp})).max(168),byHarness:H(W({harness:Rp,...Hp})).max(256),byModel:H(W({model:zp.nullable(),...Hp,harnessPricedRequests:Ip})).max(4096),byProject:H(W({project:Bp.nullable(),...Hp})).max(4096),sessions:H(Up).max(100),recentSessions:H(Up).max(100).optional()}),U({threadId:q}),U({discarded:V()});let Wp=Zs(`type`,[U({id:z().min(1),type:K(`choice`),prompt:z(),options:H(U({value:z().min(1),label:z(),description:z().optional()})).min(1),multiple:V(),allowOther:V(),optional:V()}),U({id:z().min(1),type:K(`text`),prompt:z(),multiline:V(),secret:K(!1),optional:V(),placeholder:z().optional(),prefill:z().optional()})]),Gp=U({interactionId:z().min(1),turnId:z().min(1),title:z().optional(),questions:H(Wp).min(1)}).refine(({questions:e})=>e.some(e=>e.type===`choice`&&e.multiple),{message:`Shared cards require at least one multi-select question`});W({threadId:z().min(1)}),U({questions:H(Gp)}),W({threadId:z().min(1),turnId:z().min(1),interactionId:z().min(1),answers:rc(z(),H(z())),cancelled:V().default(!1)}),U({accepted:K(!0)});let Kp=U({path:z(),oldText:z().nullable(),newText:z()});U({sessionId:z().min(1),turn:B().int().nonnegative(),path:z().min(1).optional()}),U({diffs:H(Kp)}),W({}),W({}),U({reference:U({sessionId:z().min(1),epoch:z().min(1),turn:B().int().nonnegative(),seq:B().int().nonnegative(),callId:z().min(1),part:B().int().nonnegative(),version:z().min(1)}),length:B().int().nonnegative(),bytes:B().int().nonnegative()}),W({}),W({}),W({title:z().trim().min(1).max(200),type:G([`info`,`warning`,`danger`]),body:z().trim().min(1).max(16384)}),W({}),W({url:z().max(2048).regex(/^http:\/\/(?:127\.0\.0\.1|localhost):\d{1,5}\/(?:\?.*)?$/u)}),Object.freeze(/* @__PURE__ */ `codexhost/console/remote-connections.codexhost/runtime/status.codexhost/remote/ssh-setup.codexhost/harness/plugins/list.codexhost/harness/display-settings/capabilities.codexhost/harness/display-settings/get.codexhost/harness/display-settings/set.codexhost/harness/inspect.codexhost/harness/installation.codexhost/harness/installation/start.codexhost/harness/installation/status.codexhost/harness/launch-settings/get.codexhost/harness/launch-settings/set.codexhost/harness/web-ui/open.codexhost/harness/accounts/sources.codexhost/harness/accounts/list.codexhost/harness/accounts/inspect.codexhost/harness/credential-imports.codexhost/harness/session-import/sources.codexhost/harness/session-import/list.codexhost/harness/session-import/import.codexhost/account/list.codexhost/account/refresh.codexhost/account/usage/inspect.codexhost/usage/model-prices/get.codexhost/usage/model-prices/set.codexhost/usage/model-prices/default.codexhost/usage/statistics/get.codexhost/update/check.codexhost/update/start.codexhost/update/status.codexhost/update/macos-signing/status.codexhost/update/macos-signing/setup.codexhost/update/macos-signing/remove`.split(`.`));let qp=G([`idle`,`running`,`busy`,`closing`,`failed`,`blocked`]),Jp=G([`none`,`disabled`,`timeout`,`operation`,`background`,`identity`,`persistence`,`closeFailed`]);W({threadId:z(),title:z(),harnessId:z(),state:qp,reason:Jp,inactiveMs:B().nonnegative()}),W({threadId:q,turnId:Xc});let Yp=U({email:z().trim().min(1).max(320).optional(),label:z().trim().min(1).max(256).optional(),plan:z().trim().min(1).max(128).optional(),credits:jl.optional(),balance:Ml.optional()}).strict();function Xp(e){return e.refine(e=>{let t=e;return t.credits!==void 0||t.balance!==void 0},{message:`Account must report either credits or a balance`})}let Zp=Xp(Yp),Qp={harnessId:Yc,harnessName:z().trim().min(1).max(128)},$p=U(Qp).strict();U({}).strict(),U({sources:H($p).max(128)}).strict(),U({harnessId:Yc,refresh:V().optional()}).strict(),U({...Qp,account:Zp.nullable(),accounts:H(Zp).max(8).optional()}).strict(),U({refresh:V().optional()}).strict(),U({accounts:H(Xp(Yp.extend(Qp))).max(128)}).strict(),U({harnessId:Ql,model:Il.optional(),thinkingOptionId:Zc.optional(),permissionModeId:$c.optional(),prewarm:K(!0).optional()}).strict();let em=z().trim().min(1).max(4096).refine(e=>!/[\u0000\r\n]/u.test(e),`Invalid entrypoint path`);U({harnessId:Ql}).strict().extend({path:em.nullable()}),U({path:em.nullable(),restartRequired:V()}).strict(),U({harnessId:Yc,action:G([`check`,`update`,`install`]),confirmedVersion:z().min(1).max(128).optional()}).strict().refine(({action:e,confirmedVersion:t})=>e===`update`||t===void 0);let tm=U({currentVersion:z().min(1).max(128),latestVersion:z().min(1).max(128),updateAvailable:V(),canUpdate:V(),latestVerifiedVersion:z().min(1).max(128).optional(),confirmationRequired:K(!0).optional(),versionKind:G([`cli`,`application`]).optional(),manualUpdateUrl:bs().max(2048).refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Manual updates require a credential-free HTTPS URL`).optional(),message:z().max(2048).optional(),messageCode:z().min(1).max(128).optional(),notice:qc.optional(),latestVersionKind:G([`unknown`,`tracking-branch`]).optional()}).strict();U({taskId:z().uuid()}).strict(),Zs(`status`,[U({taskId:z().uuid(),status:K(`running`)}).strict(),U({taskId:z().uuid(),status:K(`succeeded`),result:tm}).strict(),U({taskId:z().uuid(),status:K(`failed`),error:U({code:B().int(),message:z().min(1).max(2048)}).strict()}).strict()]);let nm=z().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u),rm=z().trim().min(1),im=G([`free`,`go`,`plus`,`pro`,`prolite`,`team`,`self_serve_business_prolite`,`self_serve_business_usage_based`,`business`,`ent26`,`enterprise_cbp_automation`,`enterprise_cbp_usage_based`,`enterprise`,`edu`,`edu_plus`,`edu_pro`,`unknown`]),am=U({accountId:nm,label:rm.max(256),email:z().email().max(320).optional(),planType:im.optional()}).strict(),om=G([`ready`,`unavailable`]);U({version:K(2),currentAccountId:nm.nullable(),phase:om,revision:B().int().nonnegative(),instanceId:rm.max(1024).optional(),accounts:H(am).max(1)}).strict(),U({accountId:nm,refresh:V().optional()}).strict(),U({accountId:nm,usage:Tl.nullable(),accountCredits:jl.optional(),freshness:G([`live`,`cached`]),observedAt:z().datetime().nullable()}).strict();let sm=1e3,cm=z().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),lm=cm.max(1024),um=U({nativeSessionId:lm,title:cm.max(4096).nullable(),updatedAt:B().int().nonnegative().max(864e13),cwd:cm.max(16384),running:V().nullable()}).strict();U({}).strict(),U({harnesses:H(U({harnessId:Ql,name:cm.max(128)}).strict()).max(128)}).strict(),U({harnessId:Ql,query:z().trim().max(4096).refine(e=>!e.includes(`\0`)).optional(),offset:B().int().nonnegative().safe().optional(),limit:B().int().min(1).max(sm).optional()}).strict(),U({candidates:H(um).max(sm),total:B().int().nonnegative().safe()}).strict(),U({harnessId:Ql,nativeSessionId:lm}).strict(),U({threadId:cm.max(1024).pipe(q)}).strict();let dm=z().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),fm=lm,pm=um;U({}).strict(),U({candidates:H(pm).max(1e3)}).strict(),U({nativeSessionId:fm}).strict(),U({threadId:dm.max(1024).pipe(q)}).strict(),U({threadId:q,lastTurnId:Xc}).strict(),U({threadId:q}).strict();let mm=z().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u).brand();U({commands:H(U({id:mm,invocation:z().min(1).max(128),label:z().trim().min(1).max(128),description:z().trim().min(1).max(512).optional(),localizations:Kc.optional(),argumentMode:G([`none`,`text`]),kind:G([`command`,`skill`]).optional()}).strict()),warnings:H(z().min(1)).optional(),source:G([`live`,`static`]).optional()}).strict().superRefine((e,t)=>{let n=/* @__PURE__ */ new Set;for(let[r,i]of e.commands.entries())n.has(i.id)&&t.addIssue({code:`custom`,message:`Harness command IDs must be unique`,path:[`commands`,r,`id`]}),n.add(i.id)}),U({harnessId:Yc,cwd:z().min(1).optional()}).strict(),U({threadId:q}).strict(),U({threadId:q,commandId:mm,turnId:Xc.optional(),arguments:Hc.optional()}).strict(),U({accepted:K(!0),turnId:Xc.optional()}).strict();let hm=K(`2.0`).optional(),gm=Gs().optional(),_m=z().min(1),vm=Ys([z(),B().int()]),ym=U({code:B().int(),message:z(),data:Vc.optional()}).catchall(Vc).superRefine(Lc([`data`]));Ys([U({jsonrpc:hm,id:vm,method:_m,params:Vc.optional(),result:gm,error:gm}).catchall(Vc).superRefine(Lc([`jsonrpc`,`params`,`result`,`error`])),U({jsonrpc:hm,id:gm,method:_m,params:Vc.optional(),result:gm,error:gm}).catchall(Vc).superRefine(Lc([`jsonrpc`,`id`,`params`,`result`,`error`])),U({jsonrpc:hm,id:vm,method:gm,params:gm,result:Vc,error:gm}).catchall(Vc).superRefine(Lc([`jsonrpc`,`method`,`params`,`error`])),U({jsonrpc:hm,id:vm,method:gm,params:gm,result:gm,error:ym}).catchall(Vc).superRefine(Lc([`jsonrpc`,`method`,`params`,`result`]))]);let bm=z().refine(e=>e.trim().length>0,{message:`Native identifier must not be empty or whitespace`});W({harnessId:Yc,nativeSessionId:bm,locator:Vc.optional(),formatVersion:K(1)}).superRefine(Lc([`locator`])),W({harnessId:Yc,nativeSessionId:bm,nativeTurnKey:bm,formatVersion:K(1)}),W({harnessId:Yc,nativeSessionId:bm,checkpointId:bm,locator:Vc.optional(),formatVersion:K(1)}).superRefine(Lc([`locator`]));let xm=z().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u),Sm=G([`npm`,`windows-installer`,`macos-dmg`,`linux-archive`]),Cm=G([`prepared`,`downloading`,`waiting-for-exit`,`installing`,`restarting`,`succeeded`,`failed`]),wm=W({completed:B().int().nonnegative(),total:B().int().positive()}).refine(e=>e.completed<=e.total,{path:[`completed`],message:`completed must not exceed total`}),Tm=W({version:xm,installation:Sm,phase:Cm,updatedAt:B().int().nonnegative(),downloadedBytes:B().int().nonnegative().optional(),totalBytes:B().int().positive().optional(),npmDownload:wm.optional(),error:z().min(1).max(500).nullable(),serviceStopOutput:z().optional()}).superRefine((e,t)=>{e.downloadedBytes!==void 0&&e.totalBytes!==void 0&&e.downloadedBytes>e.totalBytes&&t.addIssue({code:`custom`,path:[`downloadedBytes`],message:`downloadedBytes must not exceed totalBytes`})});W({});let Em=z().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u,`release notes URL must identify a codexhost GitHub Release`),Dm=G([`idle`,`downloading`,`ready`,`failed`]),Om=W({downloadedBytes:B().int().nonnegative(),totalBytes:B().int().positive()}).refine(e=>e.downloadedBytes<=e.totalBytes,{path:[`downloadedBytes`],message:`downloadedBytes must not exceed totalBytes`});U({currentVersion:xm,installation:Sm.nullable(),latestVersion:xm.nullable(),updateAvailable:V(),installationAvailable:V(),releaseNotes:z().min(1).max(2e4).nullable(),releaseNotesUrl:Em.nullable(),status:Tm.nullable(),error:z().min(1).max(500).nullable(),stagedVersion:xm.nullable().optional(),backgroundPhase:Dm.optional(),backgroundDownload:Om.nullable().optional(),backgroundError:z().min(1).max(500).nullable().optional(),runningTaskCount:B().int().nonnegative().optional()}),W({status:Tm}),W({status:Tm.nullable()}),W({supported:V(),enabled:V(),certificatePresent:V(),appSignedWithLocalCert:V(),appPath:z().min(1).nullable(),certificateName:z().min(1),certificateSha1:z().regex(/^[0-9A-Fa-f]{40}$/u).nullable()});let km=W({icon:z().min(1).max(16).optional(),title:z().min(1).max(120),body:z().min(1).max(1200),contributors:H(z().min(1).max(39)).max(30)}),Am=W({summary:z().min(1).max(600).optional(),themes:H(km).min(1).max(12)}),jm=W({version:xm,publishedAt:Ic(),url:z().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u),zh:Am.nullable(),en:Am.nullable()}).refine(e=>e.zh!==null||e.en!==null,{message:`an announcement needs at least one language`});W({manual:V().optional()}),W({announcement:jm.nullable(),unread:V()}),W({version:xm}),RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)(?:\?hostId=([^\s()<>"?#/&]+))?\): `+`(${[`completed`,`failed`,`interrupted`,`needsInput`,`timedOut`,`unreadable`,`notFound`].join(`|`)})(?:\. (.+))?$`,`u`);let Mm=G([`idle`,`installing`,`restarting`,`succeeded`,`failed`]);U({runningVersion:z().nullable(),installedVersion:z().nullable(),restartRequired:V(),remote:V(),updateSupported:V(),update:U({phase:Mm,targetVersion:z().nullable(),error:z().nullable()})});let Nm=U({version:z().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)}).strict();U({hostname:z().min(1).max(1024).refine(e=>!e.startsWith(`-`)&&!/\s/u.test(e)),port:B().int().min(1).max(65535).nullable(),identity:z().max(4096).nullable(),action:G([`inspect`,`install`,`update`,`restart`,`repair`,`uninstall`]),uninstallPackage:V().optional(),version:z().regex(/^\d+\.\d+\.\d+$/u).nullable()}).strict(),U({state:G([`installed`,`not-installed`])}).strict();let Pm=z().min(1).max(1024),Fm={hostId:Pm.regex(/^(?:remote-(?:ssh(?:-|:)|control:)|remote-peer:[a-zA-Z0-9_-]{1,64}$)/u)},Im={...Fm,threadId:Pm},Lm=z().min(1).max(8e3),Rm={text:Lm,requestId:Pm},zm=H(Pm).min(2).max(100).refine(e=>new Set(e).size===e.length,`Queued submission IDs must be distinct`);Zs(`accepted`,[U({accepted:K(!0),startQueuedItemId:Pm.optional()}),U({accepted:K(!1),code:G([`remote/queue-unavailable`,`remote/steer-unavailable`,`remote/turn-changed`,`remote/send-rejected`,`session/queue-item-not-found`,`session/queue-item-starting`]),message:z()})]),Zs(`available`,[U({available:K(!1)}),U({available:K(!0),canReorder:K(!0).optional(),items:H(U({id:Pm,clientUserMessageId:Pm,preview:z().max(801)})).max(100)})]);let Bm=Zs(`kind`,[W({kind:K(`hosts`)}),W({kind:K(`create`),...Fm,cwd:z().min(1).max(8192),epoch:Pm}),W({kind:K(`projectHarnesses`),...Fm,epoch:Pm}),W({kind:K(`inspectHarness`),...Fm,epoch:Pm,cwd:z().min(1).max(8192),harnessId:Pm}),W({kind:K(`startSelected`),...Fm,epoch:Pm,cwd:z().min(1).max(8192),harnessId:Pm,model:z().min(1).max(4096),serviceTier:G([`priority`,`ultrafast`]).optional(),reasoningEffort:Pm.optional()}),W({kind:K(`status`),...Im}),W({kind:K(`list`),...Fm,cursor:z().nullable(),archived:V(),includeLoaded:K(!0).optional()}),W({kind:K(`read`),...Im,page:W({cursor:z().min(1).max(8192).nullable(),epoch:Pm.optional(),sortDirection:G([`asc`,`desc`]).optional(),limit:B().int().min(1).max(20).optional()}).refine(e=>e.cursor===null||e.epoch!==void 0,{message:`A history continuation requires its connection epoch`}).optional()}),W({kind:K(`usage`),...Im,epoch:Pm}),W({kind:K(`configure`),...Im,epoch:Pm,modelId:Pm.optional(),serviceTier:Fl.optional(),thinkingOptionId:Pm.optional(),permissionModeId:Pm.optional()}).refine(e=>[e.modelId,e.thinkingOptionId,e.permissionModeId].filter(e=>e!==void 0).length===1,`Select exactly one remote setting`).refine(e=>e.serviceTier===void 0||e.modelId!==void 0,{message:`A service tier requires a Model ID`}),W({kind:K(`prompt`),...Im,epoch:Pm,text:Lm,requestId:Pm.optional()}),W({kind:K(`queue`),...Im,epoch:Pm}),W({kind:K(`delivery`),...Im,epoch:Pm,action:Zs(`kind`,[W({kind:K(`enqueue`),...Rm}),W({kind:K(`steer`),...Rm,turnId:Pm}),W({kind:K(`remove`),itemId:Pm}),W({kind:K(`reorder`),itemIds:zm}),W({kind:K(`start`),itemId:Pm,onlyIfHead:K(!0).optional()}),W({kind:K(`sendNow`),itemId:Pm})])}),W({kind:K(`interrupt`),...Im,epoch:Pm,turnId:Pm}),W({kind:K(`rename`),...Im,epoch:Pm,name:z().min(1).max(512)}),W({kind:K(`archive`),...Im,epoch:Pm,archived:V()}),W({kind:K(`respond`),...Im,epoch:Pm,requestId:Ys([Pm,B().int()]),result:rc(z(),Us())})]),Vm=z().min(1).max(1024),Hm=U({hostId:Vm,displayName:z().min(1).max(1024),source:G([`codex-managed`,`discovered`]),sshAlias:z().max(1024).nullable(),sshHost:z().min(1).max(1024),sshPort:B().int().min(1).max(65535).nullable(),identity:z().max(4096).nullable(),autoConnect:V(),connectionAnalyticsId:z().max(1024).optional()}),Um=W({displayName:z().min(1).max(1024),hostname:z().min(1).max(1024),sshPort:B().int().min(1).max(65535).nullable(),identity:z().max(4096).nullable()});Zs(`action`,[W({action:K(`session`),operation:Bm}),W({action:K(`list`)}),W({action:K(`catalog`)}),W({action:K(`read-thread`),hostId:Vm.refine(e=>e!==`local`),input:Wf}),W({action:K(`save`),draft:Um,previous:Hm.nullable()}),W({action:K(`remove`),previous:Hm}),W({action:K(`connect`),hostId:Vm,enabled:V()}),W({action:K(`state`),hostId:Vm}),W({action:K(`runtime`),hostId:Vm}),W({action:K(`update`),hostId:Vm.refine(e=>e!==`local`),version:Nm.shape.version})]),Ys([W({result:Vc}),W({error:W({code:B().int(),message:z()})})]),W({prompt:z().trim().min(1).max(2e3),cwd:z().max(4096).nullable()}),z().trim().min(1).max(60).nullable();let Wm=z().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u),Gm=Ys([z(),U({en:z()}).catchall(z())]),Km=U({title:Gm.optional(),description:Gm.optional(),icon:z().max(349592).regex(/^data:image\/(?:svg\+xml|png|jpeg|webp);base64,[A-Za-z0-9+/]*={0,2}$/u).optional(),error:z().optional()});U({extensions:H(U({id:Wm,name:z().min(1).max(214),version:z().min(1).max(128),format:K(`dsh`),supportedTargets:tc([K(`web`)]),enabledTargets:H(K(`web`)).max(1),source:z().min(1).max(4096),projectUrl:z().max(4096).url({protocol:/^https?$/u}).optional(),installedAt:z(),meta:Km.optional(),loadError:z().optional()})),loadedIds:H(Wm),safeMode:V(),storeError:z().optional()});let qm=z().trim().max(2048).url({protocol:/^https?$/u,normalize:!0}).refine(e=>!/[\s\\?#]/u.test(e)&&!e.split(`/`)[2]?.includes(`@`),`Use an HTTP(S) registry URL without credentials, a query, or a fragment.`).transform(e=>e.endsWith(`/`)?e:`${e}/`);U({spec:z().trim().min(1).max(4096),registry:qm.optional()}).strict(),U({id:Wm,enabled:V()}).strict(),U({id:Wm}).strict(),K(1);function Jm(e){return e?.projectionValues?.remoteHost?.hostId}function Ym(e){return e===void 0?!1:Jm(e)!==void 0||String(e.id).startsWith(`web-remote:`)}function Xm(e){if(e===void 0)return!1;let t=Jm(e);return t===void 0?!String(e.id).startsWith(`web-remote:`):t.startsWith(`remote-peer:`)}function Zm(e){return e!==void 0&&!Ym(e)}function Qm(e){return Xm(e)}function $m(){let e=(0,i.createSnapshotStore)({searchRequest:0,activityViewRequest:0,addRequested:!1,directoryBusy:!1,renameTarget:null,forkError:null}),t=0;return{state:e,search:()=>{e.set({...e.getSnapshot(),searchRequest:e.getSnapshot().searchRequest+1})},toggleActivityView:()=>{let t=e.getSnapshot();e.set({...t,activityViewRequest:t.activityViewRequest+1})},add:()=>{e.set(e.getSnapshot().directoryBusy?e.getSnapshot():{...e.getSnapshot(),addRequested:!0})},closeAdd:()=>{e.set({...e.getSnapshot(),addRequested:!1})},directoryBusy:t=>{e.set({...e.getSnapshot(),directoryBusy:t})},rename:(t,n)=>{e.set({...e.getSnapshot(),renameTarget:{sessionId:t,currentTitle:n}})},closeRename:()=>{e.set({...e.getSnapshot(),renameTarget:null})},forkFailed:n=>{t+=1,e.set({...e.getSnapshot(),forkError:{reason:n,seq:t}})},dismissForkError:()=>{e.set({...e.getSnapshot(),forkError:null})}}}function eh(e,t,n,r){let i=e.locale.bind(`workspace`),a=()=>Object.values(e.sessions.list.getSnapshot().byId).find(e=>(e.retainedBy.mainView??0)>0),o=()=>e.slots.entries(`sidebar.workspaces.directoryFlow`).length===0?i(`shortcut.noPicker`):n.state.getSnapshot().directoryBusy?i(`shortcut.directoryBusy`):null,s=(t,n,r,i,a,o,s)=>{e.effect(()=>e.shortcuts.register({id:t,label:n,aliases:r,defaults:{"desktop:macos":{code:i,modifiers:a},"desktop:windows":{code:i,modifiers:a},"desktop:linux":{code:i,modifiers:a},"web:macos":{code:i,modifiers:o},"web:windows":{code:i,modifiers:o}},regions:[`page`,`editable`],modals:[],resolve:s}),`ui-workspace: ${t}`)};s(`session.new`,()=>i(`session.new`),[`new session`,`new chat`],`KeyN`,[`primary`],[`primary`,`alt`],()=>({status:`handled`,run:()=>{t.startSession()}})),s(`session.search`,()=>i(`search.sessions.aria`),[`search sessions`],`KeyK`,[`primary`],[`primary`,`alt`],()=>({status:`handled`,run:n.search})),s(`session.activityView`,()=>i(`activityView.label`),[`activity view`,`unread sessions`],`KeyU`,[`primary`,`alt`],[`primary`,`alt`],()=>({status:`handled`,run:n.toggleActivityView})),s(`workspace.add`,()=>i(`workspace.add`),[`add workspace`,`open folder`],`KeyO`,[`primary`],[`primary`,`alt`],()=>{let e=o();return e===null?{status:`handled`,run:n.add}:{status:`blocked`,reason:e}}),s(`session.rename`,()=>i(`rename.session.title`),[`rename session`],`KeyG`,[`primary`,`alt`],[`primary`,`alt`],t=>{let r=a();return r===void 0||r.blank||t.modal!==null||e.layout.panelInfo.getSnapshot().activePanelId!==null?{status:`blocked`,reason:i(`shortcut.noSession`)}:{status:`handled`,run:()=>{n.rename(r.id,r.title?.trim()??``)}}}),s(`session.fork`,()=>i(`menu.fork`),[`fork session`],`KeyF`,[`primary`,`alt`],[`primary`,`shift`],()=>{let e=a();return e===void 0?{status:`blocked`,reason:i(`shortcut.noSession`)}:Zm(e)?e.blank?{status:`blocked`,reason:i(`shortcut.noCompletedTurn`)}:{status:`handled`,run:()=>{t.forkSession(e.id).catch(e=>{let t=e instanceof Error&&e.name===`SessionForkError`&&e.rpcError.code===`session/fork-unavailable`;n.forkFailed(t?`unavailable`:`failed`),t||console.warn(`session fork rejected:`,e)})}}:{status:`blocked`,reason:i(`shortcut.remoteForkUnsupported`)}}),s(`session.archive`,()=>i(`menu.archiveSession`),[`archive session`],`KeyA`,[`primary`,`shift`],[`primary`,`alt`],()=>{let e=a();return e===void 0?{status:`blocked`,reason:i(`shortcut.noSession`)}:{status:`handled`,run:()=>{r(e.id)}}})}function th(e){return e}function nh(e){return th(e)}let rh={'"':`"`,"\\":`\\`,"/":`/`,b:`\b`,f:`\f`,n:`
114
+ `,r:`\r`,t:` `},ih=/[\\\u0000-\u001f]/u;function ah(e){return e===` `||e===`
115
+ `||e===`\r`||e===` `}function oh(e){return e>=`0`&&e<=`9`||e>=`a`&&e<=`f`||e>=`A`&&e<=`F`}(class e{static EMPTY=e.fromObject({});static fromText(t){let n=new e;return n.append(t),n.sealed=!0,n}static fromObject(t){let n=new e;return n.object=typeof t==`object`&&t&&!Array.isArray(t)?t:{},n.sealed=!0,n}chunks=[];object;sealed=!1;#e=[];#t=0;#n=0;#r=`root`;#i=!1;#a=0;#o=!1;#s=``;#c=null;#l=[];#u=!1;#d;#f=!1;#p=/* @__PURE__ */ new Map;#m=[];#h=/* @__PURE__ */ new Map;get isSealed(){return this.sealed}get invalid(){return this.scan(),this.#r===`invalid`||this.#f}append(e){if(this.sealed)throw Error(`PartialArguments: cannot append to a sealed view`);e.length!==0&&(this.chunks.push(e),this.#t+=e.length,this.#e.push(this.#t))}settle(t){if(this.object!==void 0||t.length!==this.#t)return e.fromText(t);let n=0;for(let r of this.chunks){if(!t.startsWith(r,n))return e.fromText(t);n+=r.length}return this.chunks=t.length===0?[]:[t],this.#e=t.length===0?[]:[t.length],this.sealed=!0,this}refresh(){if(this.#h.size===0)return!1;this.scan();let e=!1,t=!1;for(let n of this.#h.values())n.completion?t=!0:e=this.refreshRead(n)||e;if(t)for(let t of this.#h.values())t.completion&&(e=this.refreshRead(t)||e);return this.sealed&&this.#h.clear(),e}refreshRead(e){let t=e.answer();return!Object.is(t,e.last)&&(e.last=t,!0)}closed(){return this.remember(`closed`,``,()=>this.closedNow())}keys(){return this.remember(`keys`,``,()=>this.keysNow(),e=>e.length)}has(e){return this.remember(`has`,e,()=>this.hasNow(e))}complete(e){return this.remember(`complete`,e,()=>this.completeNow(e))}stringLength(e,t){let n=Math.max(1,Math.floor(t?.step??1)),r=t?.offset??0;return this.remember(`length:${n}:${r}`,e,()=>this.lengthNow(e),e=>e===void 0?void 0:Math.ceil((e+r)/n))}stringExceeds(e,t){let n=Math.max(0,Math.floor(t));return this.remember(`exceeds:${n}`,e,()=>(this.lengthNow(e,n+1)??0)>n)}text(e){return this.remember(`text`,e,()=>this.textNow(e))}textPrefix(e,t){let n=Math.max(1,Math.floor(t));return this.remember(`prefix:${n}`,e,()=>this.textPrefixNow(e,n))}value(e){return this.remember(`value`,e,()=>this.valueNow(e))}remember(e,t,n,r){this.scan();let i=n();if(!this.sealed){let a=`${e}/${t}`;this.#h.has(a)||this.#h.set(a,{completion:e===`complete`,answer:r===void 0?n:()=>r(n()),last:r===void 0?i:r(i)})}return i}closedNow(){return this.sealed||this.#r===`closed`||this.#r===`invalid`}keysNow(){return this.object===void 0?this.#m:Object.keys(this.object)}hasNow(e){return this.object===void 0?this.#p.has(e):Object.hasOwn(this.object,e)}completeNow(e){if(this.object!==void 0)return Object.hasOwn(this.object,e);let t=this.#p.get(e);return t!==void 0&&t.end>=0&&(t.kind===`string`?t.invalidAt===void 0:!t.invalid)}lengthNow(e,t=1/0){if(this.object!==void 0){let t=Object.hasOwn(this.object,e)?this.object[e]:void 0;return typeof t==`string`?t.length:void 0}let n=this.#p.get(e);if(n?.kind!==`string`)return;if(n.text!==void 0&&n.text.at===n.end)return n.text.length;let r=n.length??={at:n.start,length:0,text:``};return this.readString(n,r,t,!1),r.length}textNow(e){if(this.object!==void 0){let t=Object.hasOwn(this.object,e)?this.object[e]:void 0;return typeof t==`string`?t:void 0}let t=this.#p.get(e);if(t?.kind!==`string`)return;if(t.text===void 0&&t.end>=0&&t.needsDecoding&&t.invalidAt===void 0){let e;try{e=JSON.parse(`"${this.slice(t.start,t.end)}"`)}catch{}e!==void 0&&(t.text={at:t.end,length:e.length,text:e})}let n=t.text??={at:t.start,length:0,text:``};return this.readString(t,n,1/0,!0),n.text}textPrefixNow(e,t){if(this.object!==void 0){let n=Object.hasOwn(this.object,e)?this.object[e]:void 0;return typeof n==`string`?n.slice(0,t):void 0}let n=this.#p.get(e);if(n?.kind!==`string`)return;let r=n.prefixes??=/* @__PURE__ */ new Map,i=r.get(t);return i===void 0&&(i={at:n.start,length:0,text:``},r.set(t,i)),this.readString(n,i,t,!0),i.text}valueNow(e){if(this.object!==void 0){if(!Object.hasOwn(this.object,e))return;let t=this.object[e];return typeof t==`string`?void 0:t}let t=this.#p.get(e);if(!(t?.kind!==`value`||t.end<0||t.invalid)){if(t.parsed===void 0)try{t.parsed=JSON.parse(this.slice(t.start,t.end))}catch{t.invalid=!0,this.#f=!0}return t.parsed}}chunkAt(e){let t=0,n=this.#e.length;for(;t<n;){let r=t+n>>>1;this.#e[r]<=e?t=r+1:n=r}return t}slice(e,t){if(e>=t)return``;let n=this.chunkAt(e),r=this.chunkAt(t-1),i=n===0?0:this.#e[n-1];if(n===r)return this.chunks[n].slice(e-i,t-i);let a=[this.chunks[n].slice(e-i)];for(let e=n+1;e<r;e++)a.push(this.chunks[e]);return a.push(this.chunks[r].slice(0,t-this.#e[r-1])),a.join(``)}readString(e,t,n,r){let i=Math.min(e.end<0?this.#n:e.end,e.invalidAt??1/0,this.#d??1/0);if(!e.needsDecoding){let e=Math.min(i-t.at,n-t.length);if(e<=0)return;r&&(t.text+=this.slice(t.at,t.at+e)),t.at+=e,t.length+=e;return}let a=this.chunkAt(t.at);for(;t.at<i&&t.length<n;){let o=a===0?0:this.#e[a-1],s=this.chunks[a],c=s.slice(t.at-o,Math.min(s.length,i-o)),l=c.search(ih),u=Math.min(l<0?c.length:l,n-t.length);if(u>0){r&&(t.text+=c.slice(0,u)),t.at+=u,t.length+=u,t.at===o+s.length&&a++;continue}let d=c.length>1?c[1]:t.at+1<i?this.chunks[a+1][0]:void 0,f,p=2;if(c[0]===`\\`&&d===void 0&&e.end<0)return;if(c[0]===`\\`&&d===`u`){let n=this.slice(t.at+2,Math.min(i,t.at+6)),r=!0;for(let e=0;e<n.length;e++)oh(n[e])||(r=!1);if(r){if(n.length<4&&e.end<0)return;n.length===4&&(f=String.fromCharCode(Number.parseInt(n,16)))}p=6}else c[0]===`\\`&&d!==void 0&&(f=rh[d]);if(f===void 0){e.invalidAt=t.at,this.#f=!0;return}for(r&&(t.text+=f),t.length++,t.at+=p;a<this.chunks.length&&t.at>=this.#e[a];)a++}}scan(){if(this.object===void 0&&this.#n!==this.#t)for(let e=this.chunkAt(this.#n);e<this.chunks.length&&this.#d===void 0;e++){let t=this.chunks[e],n=e===0?0:this.#e[e-1];for(let e=this.#n-n;e<t.length&&this.#r!==`invalid`;e++){if(this.#r===`string`||this.#r===`nested`&&this.#u){let n=this.stringBoundary(t,e);if(this.#n+=n-e,e=n,e===t.length)break}this.step(t[e],this.#n),this.#n++}}}stringBoundary(e,t){let n=t;for(;;){let t=e.indexOf(`"`,n),r=t<0?e.length:t;if(this.#r===`string`){let t=this.#c;!t.needsDecoding&&ih.test(e.slice(n,r))&&(t.needsDecoding=!0)}let i=r;for(;i>n&&e[i-1]===`\\`;)i--;let a=(r-i)%2==1!==(i===n&&this.#i);if(this.#i=t<0&&a,t<0||!a)return r;n=t+1}}step(e,t){switch(this.#r){case`root`:if(ah(e))return;if(e===`{`){this.#r=`key-or-end`;return}this.fail();return;case`key-or-end`:if(ah(e))return;if(e===`}`){this.#r=`closed`;return}if(e===`"`){this.beginKey(t);return}this.fail();return;case`key-only`:if(ah(e))return;if(e===`"`){this.beginKey(t);return}this.fail();return;case`key`:this.stepKey(e,t);return;case`colon`:if(ah(e))return;if(e===`:`){this.#r=`value`;return}this.fail();return;case`value`:this.beginValue(e,t);return;case`string`:{let e=this.#c;e.end=t,this.#c=null,this.#r=`comma-or-end`;return}case`scalar`:this.stepScalar(e,t);return;case`nested`:this.stepNested(e,t);return;case`comma-or-end`:if(ah(e))return;if(e===`,`){this.#r=`key-only`;return}if(e===`}`){this.#r=`closed`;return}this.fail();return;case`closed`:if(ah(e))return;this.fail();return;
116
116
  /* v8 ignore next 2 -- scan() stops stepping once the view is invalid. */
117
117
  case`invalid`:return;
118
118
  /* v8 ignore next 2 -- Every scanner mode has a handler above. */
119
- default:qm(this.#r)}}fail(){this.#d=this.#n,this.#r=`invalid`,this.#c=null}beginKey(e){this.#r=`key`,this.#a=e+1,this.#o=!1,this.#i=!1}stepKey(e,t){if(e<` `){this.fail();return}if(this.#i){this.#i=!1;return}if(e===`\\`){this.#i=!0,this.#o=!0;return}if(e!==`"`)return;let n=this.slice(this.#a,t);if(this.#o)try{this.#s=JSON.parse(`"${n}"`)}catch{this.fail();return}else this.#s=n;this.#r=`colon`}open(e){this.#p.has(this.#s)||this.#m.push(this.#s),this.#p.set(this.#s,e),this.#c=e}beginValue(e,t){Gm(e)||(e===`"`?(this.open({kind:`string`,start:t+1,end:-1,needsDecoding:!1,invalidAt:void 0,length:void 0,text:void 0,prefixes:void 0}),this.#i=!1,this.#r=`string`):e===`}`||e===`,`||e===`:`||e===`]`?this.fail():(this.open({kind:`value`,start:t,end:-1,parsed:void 0,invalid:!1}),e===`{`||e===`[`?(this.#r=`nested`,this.#l=[e===`{`?`}`:`]`],this.#u=!1,this.#i=!1):this.#r=`scalar`))}stepScalar(e,t){(e===`,`||e===`}`||Gm(e))&&(this.closeValue(t),this.#r=e===`,`?`key-only`:e===`}`?`closed`:`comma-or-end`)}stepNested(e,t){if(this.#u)this.#u=!1;else if(e===`"`)this.#u=!0;else if(e===`{`||e===`[`)this.#l.push(e===`{`?`}`:`]`);else if(e===`}`||e===`]`){if(this.#l.pop()!==e){this.fail();return}this.#l.length===0&&(this.closeValue(t+1),this.#r=`comma-or-end`)}}closeValue(e){let t=this.#c;t.end=e,this.#c=null}});function qm(e,t){let n=JSON.stringify(e)??String(e);throw Error(`unreachable variant${t?` in ${t}`:``}: ${n}`)}function Jm(e){return/^[A-Za-z]:[/\\]/.test(e)||e.startsWith(`\\\\`)}function Ym(e,t){if(t===void 0||t===``||Jm(e)||Jm(t))return e;let n=t.replace(/\/+$/,``);return n===``||n===`/`?e:e.replace(/\/+$/,``)===n?`~`:e.startsWith(`${n}/`)?`~${e.slice(n.length)}`:e}function Xm(e){let t=e.replace(/[/\\]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return t.slice(n+1)}let Zm=/^remote-(?:peer:|ssh(?:-|:)|control:).+/u;function Qm(e){let t=e.projectionValues?.threadReference;if(!e.blank&&t?.hostId&&(t.hostId===`local`||Zm.test(t.hostId)&&t.threadId))return{threadId:t.threadId??e.id,hostId:t.hostId,title:e.title?.replace(/[\s\u0000-\u001f\u007f]+/gu,` `).trim()||e.id.slice(0,8)}}function $m(e){return`thread://${encodeURIComponent(e.threadId).replace(/[!'()*]/gu,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}?hostId=${encodeURIComponent(e.hostId)}`}function eh(e){let t=`[@${e.title.replace(/[\\`*{}[\]()#+.!_<>|~-]/gu,e=>`\\${e}`)}](${$m(e)})`;return{source:`codexhost-thread`,ref:t,label:e.title,appearance:`session`,clipboardText:t}}function th(e,t){let n=new Map(e.map(e=>[e.id,e])),r=/* @__PURE__ */ new Map;for(let e of n.values()){let i=t(e);i!=null&&n.has(i)&&r.set(e.id,i)}let i=/* @__PURE__ */ new Set;for(let e of n.keys()){let t=[],n=/* @__PURE__ */ new Map,a=e;for(;a!==void 0&&!i.has(a);){let e=n.get(a);if(e!==void 0){for(let n of t.slice(e))r.delete(n);break}n.set(a,t.length),t.push(a),a=r.get(a)}for(let e of t)i.add(e)}let a=/* @__PURE__ */ new Map;for(let e of n.values())a.set(e.id,{...e,tree:{depth:0,parentId:r.get(e.id)??null,children:[],descendantIds:[],descendantCount:0,activity:{running:0,pendingInteraction:0,completed:0},updatedAt:e.updatedAt}});let o=[];for(let e of a.values()){let t=e.tree.parentId===null?void 0:a.get(e.tree.parentId);t===void 0?o.push(e):t.tree.children.push(e)}let s=[],c=[...o];for(let e=c.pop();e!==void 0;e=c.pop()){s.push(e);let t=[...e.tree.children].sort((e,t)=>t.updatedAt-e.updatedAt||e.id.localeCompare(t.id));e.tree.children=t;for(let n of t)n.tree.depth=e.tree.depth+1,c.push(n)}for(let e of s.reverse()){let t=[];for(let n of e.tree.children)t.push(n.id,...n.tree.descendantIds),e.tree.updatedAt=Math.max(e.tree.updatedAt,n.tree.updatedAt),e.tree.activity.running+=Number(n.running||(n.runningSubagentCount??0)>0)+n.tree.activity.running,e.tree.activity.pendingInteraction+=Number(n.pendingInteraction!==void 0)+n.tree.activity.pendingInteraction,e.tree.activity.completed+=Number(n.completed)+n.tree.activity.completed;e.tree.descendantIds=t,e.tree.descendantCount=t.length}return o}function nh(e,t){let n=[],r=[...e].reverse();for(let e=r.pop();e!==void 0;e=r.pop())n.push(e),t[e.id]&&r.push(...[...e.tree?.children??[]].reverse());return n}function rh(e,t){return e.find(e=>e.sessionIds.includes(t))?.workspaceId??``}function ih(e){return Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id}function ah(e){if(e===void 0||e===``)return``;let t=Xm(e);return t===``?e:t}function oh(e,t){return e.flatMap(e=>{let n=t[e];return n===void 0?[]:[{id:e,rank:n.updatedAt}]}).sort((e,t)=>e.rank===t.rank?e.id<t.id?-1:1:t.rank-e.rank).map(e=>e.id)}function sh(e,t,n,r){let i=new Map(e.map(e=>[e,e])),a=/* @__PURE__ */ new Set,o=[];for(let e of t??[]){let t=i.get(e);t===void 0||a.has(e)||(o.push(t),a.add(e))}let s=new Set(r?.archivedSessionIds),c=[];for(let e of r?.pinnedSessionIds??[]){let t=i.get(e);t===void 0||a.has(t)||s.has(t)||n[t]===void 0||(c.push(t),a.add(t))}let l=[],u=[];for(let e of oh([...i.values()].filter(e=>!a.has(e)),n))s.has(e)?u.push(e):l.push(e);let d=[...c,...o,...l,...u],f=new Set(l),p=e=>{if(!f.delete(e))return;let t=n[e]?.parentId;t!==void 0&&t!==e&&d.includes(t)&&(p(t),d.splice(d.indexOf(e),1),d.splice(d.indexOf(t),0,e))};for(let e of[...l].reverse())p(e);return d}function ch(e,t){return t===void 0?[...e]:[t,...e.filter(e=>e!==t)]}function lh(e,t,n){if(e.origin===`subagent`||e.blank)return!1;switch(n){case`default`:return!t.has(e.id);case`show`:return!0;case`only`:return t.has(e.id);
119
+ default:sh(this.#r)}}fail(){this.#d=this.#n,this.#r=`invalid`,this.#c=null}beginKey(e){this.#r=`key`,this.#a=e+1,this.#o=!1,this.#i=!1}stepKey(e,t){if(e<` `){this.fail();return}if(this.#i){this.#i=!1;return}if(e===`\\`){this.#i=!0,this.#o=!0;return}if(e!==`"`)return;let n=this.slice(this.#a,t);if(this.#o)try{this.#s=JSON.parse(`"${n}"`)}catch{this.fail();return}else this.#s=n;this.#r=`colon`}open(e){this.#p.has(this.#s)||this.#m.push(this.#s),this.#p.set(this.#s,e),this.#c=e}beginValue(e,t){ah(e)||(e===`"`?(this.open({kind:`string`,start:t+1,end:-1,needsDecoding:!1,invalidAt:void 0,length:void 0,text:void 0,prefixes:void 0}),this.#i=!1,this.#r=`string`):e===`}`||e===`,`||e===`:`||e===`]`?this.fail():(this.open({kind:`value`,start:t,end:-1,parsed:void 0,invalid:!1}),e===`{`||e===`[`?(this.#r=`nested`,this.#l=[e===`{`?`}`:`]`],this.#u=!1,this.#i=!1):this.#r=`scalar`))}stepScalar(e,t){(e===`,`||e===`}`||ah(e))&&(this.closeValue(t),this.#r=e===`,`?`key-only`:e===`}`?`closed`:`comma-or-end`)}stepNested(e,t){if(this.#u)this.#u=!1;else if(e===`"`)this.#u=!0;else if(e===`{`||e===`[`)this.#l.push(e===`{`?`}`:`]`);else if(e===`}`||e===`]`){if(this.#l.pop()!==e){this.fail();return}this.#l.length===0&&(this.closeValue(t+1),this.#r=`comma-or-end`)}}closeValue(e){let t=this.#c;t.end=e,this.#c=null}});function sh(e,t){let n=JSON.stringify(e)??String(e);throw Error(`unreachable variant${t?` in ${t}`:``}: ${n}`)}function ch(e){return/^[A-Za-z]:[/\\]/.test(e)||e.startsWith(`\\\\`)}function lh(e,t){if(t===void 0||t===``||ch(e)||ch(t))return e;let n=t.replace(/\/+$/,``);return n===``||n===`/`?e:e.replace(/\/+$/,``)===n?`~`:e.startsWith(`${n}/`)?`~${e.slice(n.length)}`:e}function uh(e){let t=e.replace(/[/\\]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return t.slice(n+1)}let dh=/^remote-(?:peer:|ssh(?:-|:)|control:).+/u;function fh(e){let t=e.projectionValues?.threadReference;if(!e.blank&&t?.hostId&&(t.hostId===`local`||dh.test(t.hostId)&&t.threadId))return{threadId:t.threadId??e.id,hostId:t.hostId,title:e.title?.replace(/[\s\u0000-\u001f\u007f]+/gu,` `).trim()||e.id.slice(0,8)}}function ph(e){return`thread://${encodeURIComponent(e.threadId).replace(/[!'()*]/gu,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}?hostId=${encodeURIComponent(e.hostId)}`}function mh(e){let t=`[@${e.title.replace(/[\\`*{}[\]()#+.!_<>|~-]/gu,e=>`\\${e}`)}](${ph(e)})`;return{source:`codexhost-thread`,ref:t,label:e.title,appearance:`session`,clipboardText:t}}function hh(e,t){let n=new Map(e.map(e=>[e.id,e])),r=/* @__PURE__ */ new Map;for(let e of n.values()){let i=t(e);i!=null&&n.has(i)&&r.set(e.id,i)}let i=/* @__PURE__ */ new Set;for(let e of n.keys()){let t=[],n=/* @__PURE__ */ new Map,a=e;for(;a!==void 0&&!i.has(a);){let e=n.get(a);if(e!==void 0){for(let n of t.slice(e))r.delete(n);break}n.set(a,t.length),t.push(a),a=r.get(a)}for(let e of t)i.add(e)}let a=/* @__PURE__ */ new Map;for(let e of n.values())a.set(e.id,{...e,tree:{depth:0,parentId:r.get(e.id)??null,children:[],descendantIds:[],descendantCount:0,activity:{running:0,pendingInteraction:0,completed:0},updatedAt:e.updatedAt}});let o=[];for(let e of a.values()){let t=e.tree.parentId===null?void 0:a.get(e.tree.parentId);t===void 0?o.push(e):t.tree.children.push(e)}let s=[],c=[...o];for(let e=c.pop();e!==void 0;e=c.pop()){s.push(e);let t=[...e.tree.children].sort((e,t)=>t.updatedAt-e.updatedAt||e.id.localeCompare(t.id));e.tree.children=t;for(let n of t)n.tree.depth=e.tree.depth+1,c.push(n)}for(let e of s.reverse()){let t=[];for(let n of e.tree.children)t.push(n.id,...n.tree.descendantIds),e.tree.updatedAt=Math.max(e.tree.updatedAt,n.tree.updatedAt),e.tree.activity.running+=Number(n.running||(n.runningSubagentCount??0)>0)+n.tree.activity.running,e.tree.activity.pendingInteraction+=Number(n.pendingInteraction!==void 0)+n.tree.activity.pendingInteraction,e.tree.activity.completed+=Number(n.completed)+n.tree.activity.completed;e.tree.descendantIds=t,e.tree.descendantCount=t.length}return o}function gh(e,t){let n=[],r=[...e].reverse();for(let e=r.pop();e!==void 0;e=r.pop())n.push(e),t[e.id]&&r.push(...[...e.tree?.children??[]].reverse());return n}function _h(e,t){let n=(e,t,r)=>{let i=e.tree;if(i===void 0||i.children===void 0)return e;let a=i.children.map(r=>n(r,t+1,e.id)),o=[],s={running:0,pendingInteraction:0,completed:0},c=e.updatedAt??0;for(let e of a)o.push(e.id,...e.tree?.descendantIds??[]),c=Math.max(c,e.tree?.updatedAt??e.updatedAt??0),s.running+=Number(!!e.running||(e.runningSubagentCount??0)>0)+(e.tree?.activity.running??0),s.pendingInteraction+=Number(e.pendingInteraction!==void 0)+(e.tree?.activity.pendingInteraction??0),s.completed+=Number(!!e.completed)+(e.tree?.activity.completed??0);return{...e,tree:{...i,depth:t,parentId:r,children:a,descendantIds:o,descendantCount:o.length,activity:s,updatedAt:c}}},r=(e,i,a)=>{let o=t(e),s=e.tree;if(s===void 0||s.children===void 0)return o?{nodes:[],changed:!0}:{nodes:[e],changed:!1};let c=!1,l=[],u=o?i:i+1,d=o?a:e.id;for(let e of s.children){let t=r(e,u,d);t.changed&&(c=!0),l.push(...t.nodes)}if(o)return{nodes:l.map(e=>n(e,i,a)),changed:!0};if(!c&&s.depth===i&&s.parentId===a)return{nodes:[e],changed:!1};let f=c?[...l].sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0)||e.id.localeCompare(t.id)):l,p={...e,tree:{...s,depth:i,parentId:a,children:f}};return{nodes:[n(p,i,a)],changed:!0}},i=[];for(let t of e)i.push(...r(t,0,null).nodes);return i}function vh(e,t){return e.find(e=>e.sessionIds.includes(t))?.workspaceId??``}function yh(e){return Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id}function bh(e){if(e===void 0||e===``)return``;let t=uh(e);return t===``?e:t}function xh(e,t){return e.flatMap(e=>{let n=t[e];return n===void 0?[]:[{id:e,rank:n.updatedAt}]}).sort((e,t)=>e.rank===t.rank?e.id<t.id?-1:1:t.rank-e.rank).map(e=>e.id)}function Sh(e,t,n,r){let i=new Map(e.map(e=>[e,e])),a=/* @__PURE__ */ new Set,o=[];for(let e of t??[]){let t=i.get(e);t===void 0||a.has(e)||(o.push(t),a.add(e))}let s=new Set(r?.archivedSessionIds),c=[];for(let e of r?.pinnedSessionIds??[]){let t=i.get(e);t===void 0||a.has(t)||s.has(t)||n[t]===void 0||(c.push(t),a.add(t))}let l=[],u=[];for(let e of xh([...i.values()].filter(e=>!a.has(e)),n))s.has(e)?u.push(e):l.push(e);let d=[...c,...o,...l,...u],f=new Set(l),p=e=>{if(!f.delete(e))return;let t=n[e]?.parentId;t!==void 0&&t!==e&&d.includes(t)&&(p(t),d.splice(d.indexOf(e),1),d.splice(d.indexOf(t),0,e))};for(let e of[...l].reverse())p(e);return d}function Ch(e,t){return t===void 0?[...e]:[t,...e.filter(e=>e!==t)]}function wh(e,t,n,r,i=!0){let a=t.find(e=>e.id===n.sessionId),o=t.find(e=>e.id===r.id);if(a===void 0||o===void 0||a.blank||i&&(a.pinned!==n.pinned||o.pinned!==n.pinned)||a.id===o.id||!e.includes(a.id))return;let s=i?t.filter(e=>e.pinned===n.pinned):t,c=s.findIndex(e=>e.id===a.id);if(s.filter(e=>e.id!==a.id).findIndex(e=>e.id===o.id)+ +(r.half===`after`)===c)return;let l=e.filter(e=>e!==a.id),u=l.indexOf(o.id);if(u!==-1)return l.splice(u+ +(r.half===`after`),0,a.id),Ch(l,t.find(e=>e.blank)?.id)}function Th(e,t,n){if(e.origin===`subagent`||e.blank)return!1;switch(n){case`default`:return!t.has(e.id);case`show`:return!0;case`only`:return t.has(e.id);
120
120
  /* v8 ignore next 2 -- closed-union backstop; only reached if the filter is forged */
121
- default:return qm(n)}}function uh(e,t,n){let r=[],i=[];for(let a of e)!n.has(a.id)&&t.has(a.id)?r.push(a):i.push(a);return[...r,...i]}function dh(e){return e.blank?``:e.title?.trim()??``}function fh(e){let t=Date.parse(e);return Number.isFinite(t)&&t>0?t:void 0}function ph(e,t,n,r,i,a,o){return{key:e,workspaceId:t,cwd:n,createdAt:r,label:i,sessions:[...a],remote:o}}function mh(e,t,n,r){let i=new Set(e.workspaceOnlyIds),a=/* @__PURE__ */ new Set,o=[];for(let s of t){let t=[];for(let o of s.sessionIds){let s=e.byId[o];s!==void 0&&lh(s,n,r)&&(t.push(s),i.has(o)&&a.add(o))}(r!==`only`||t.length!==0)&&o.push(ph(s.workspaceId,s.workspaceId,s.path,fh(s.createdAt),s.title,t,s.remote))}let s=oh(e.ids.filter(e=>!a.has(e)),e.byId).map(t=>e.byId[t]).filter(e=>e!==void 0&&lh(e,n,r));return s.length>0&&o.push(ph(``,void 0,void 0,void 0,``,s)),o}function hh(e){switch(e){case`approval`:case`plan-review`:case`question`:return e;default:return}}function gh(e,t,n){return e.projectionsBySession[t]?.values.subagentCatalog?.reduce((t,r)=>t+ +((n.get(r.id)?.running??e.byId[r.id]?.running)===!0),0)??0}function _h(e,t,n){let r=n.get(e.id),i=hh(r?.pendingInteraction?.kind),a=r?.running??e.running,o=gh(t,e.id,n);return{running:a,runningSubagentCount:o,completed:!a&&o===0&&r?.pendingInteraction===void 0&&r?.completionUnread===!0,...i===void 0?{}:{pendingInteraction:i}}}function vh(e,t,n,r,i){let a=_h(e,t,n),o=i.has(e.id);return{id:e.id,reference:Qm(e),remote:e.projectionValues?.remoteHost??void 0,title:dh(e),...e.cwd===void 0?{}:{cwd:e.cwd},blank:e.blank,...a,completed:!o&&a.completed,pinned:!o&&r.has(e.id),archived:o,updatedAt:e.updatedAt}}function yh(e,t){let n=e.projectionValues?.threadTreeParent??null;if(n===null)return null;let r=t?.byId[Hm(n)];return r===void 0?null:(e.projectionValues?.threadReference?.hostId??e.projectionValues?.remoteHost?.hostId??`local`)===(r.projectionValues?.threadReference?.hostId??r.projectionValues?.remoteHost?.hostId??`local`)?n:null}function bh(e,t,n){let r=new Set(t.archivedSessionIds),i=new Set(t.pinnedSessionIds);return th(Ch(e,t.archivedSessionIds,t.archivedFilter).flatMap(t=>{let a=e.byId[t];return a===void 0?[]:[vh(a,e,n,i,r)]}),n=>{if(t.sectionedSessionIds?.has(n.id))return null;let r=e.byId[n.id];return r===void 0?null:yh(r,e)})}function xh(e,t,n,r,i,a){let o=new Set(n.archivedSessionIds),s=new Set(n.pinnedSessionIds),c=new Set(i.expandedGroups),l=ih(e),u=a??new Map(bh(e,n,r).map(e=>[e.id,e])),d=[];for(let r of mh(e,t,o,n.archivedFilter)){let e=c.has(r.key),t=r.key===``,a=r.sessions.flatMap(e=>{let r=u.get(e.id);return r===void 0||i.excludePinned&&(!t&&r.pinned||n.sectionedSessionIds?.has(r.id))?[]:[r]});t&&a.sort((e,t)=>(t.tree?.updatedAt??t.updatedAt)-(e.tree?.updatedAt??e.updatedAt)||e.id.localeCompare(t.id));let f={running:0,pendingInteraction:0,completed:0};for(let e of a)e.archived||(f.running+=Number(e.running||e.runningSubagentCount>0)+(e.tree?.activity.running??0),f.pendingInteraction+=Number(e.pendingInteraction!==void 0)+(e.tree?.activity.pendingInteraction??0),f.completed+=Number(e.completed)+(e.tree?.activity.completed??0));d.push({key:r.key,workspaceId:r.workspaceId,cwd:r.cwd,createdAt:r.createdAt,label:r.label,remote:r.remote,sessionCount:a.length,expanded:e,activity:f,containsCurrent:a.some(e=>e.id===l||l!==void 0&&e.tree?.descendantIds.includes(l)),sessions:e?t&&i.excludePinned?a:uh(a,s,o):[]})}return d}function Sh(e,t=[]){return[...Ch(e,[],`show`),...t.filter(t=>e.byId[t]===void 0)]}function Ch(e,t,n){let r=new Set(t);return e.ids.filter(t=>{let i=e.byId[t];return i!==void 0&&lh(i,r,n)})}function wh(e,t,n,r,i,a){if(t.length===0)return[];let o=new Set(n.archivedSessionIds),s=new Set(n.pinnedSessionIds),c=i??new Map(bh(e,n,r).map(e=>[e.id,e])),l=t.flatMap(e=>{let t=c.get(e);return t===void 0?[]:[t]});return a?.floatPinned===!1?l:uh(l,s,o)}function Th(e,t,n,r,i,a,o,s){let c=n.trim().toLowerCase();if(c===``)return{items:[],hasMore:!1};let l=new Set(r),u=/* @__PURE__ */ new Map;for(let e of t)for(let t of e.sessionIds)u.has(t)||u.set(t,e.title);let d=e=>u.get(e.id)??ah(e.cwd),f=/* @__PURE__ */ new Map;for(let e of o.items)f.has(e.sessionId)||f.set(e.sessionId,e);let p=[];for(let t of e.ids){let n=e.byId[t];n!==void 0&&!n.blank&&lh(n,l,i)&&(dh(n).toLowerCase().includes(c)||d(n).toLowerCase().includes(c))&&p.push(n)}let m=new Map(p.map(e=>[e.id,e])),h=oh(p.map(e=>e.id),e.byId).map(e=>m.get(e)),g=[],_=/* @__PURE__ */ new Set,v=e=>{_.has(e.id)||(_.add(e.id),g.push(e))};for(let e of h)v(e);for(let t of o.items){let n=e.byId[t.sessionId];n!==void 0&&!n.blank&&lh(n,l,i)&&v(n)}return{items:g.slice(0,s).map(t=>{let n=f.get(t.id),r=a.get(t.id),i=hh(r?.pendingInteraction?.kind),o=yh(t,e);return{id:t.id,title:dh(t),workspace:d(t),...o===null?{}:{parentTitle:e.byId[Hm(o)]?.title??``},remote:t.projectionValues?.remoteHost??void 0,running:r?.running??t.running,runningSubagentCount:gh(e,t.id,a),...i===void 0?{}:{pendingInteraction:i},completed:r?.completionUnread===!0,archived:l.has(t.id),...n===void 0?{}:{snippet:n.snippet}}}),hasMore:o.hasMore||g.length>s}}function Eh(e){return(/^[A-Za-z]:[/\\]/.test(e)||e.startsWith(`\\\\`)?e.replaceAll(`\\`,`/`):e).replace(/\/+$/,``)}function Dh(e,t){let n=Eh(e),r,i=-1;for(let e of t){let t=Eh(e);t.length>i&&n!==t&&n.startsWith(`${t}/`)&&(r=e,i=t.length)}return r}let Oh=`__flat_session_order__`,kh=`pinned`,Ah=`groups`,jh=`workspaces`;function Mh(e,t){return e?.[t]??!0}function Nh(e,t,n){let r=new Map(Object.entries(n.summaries)),i=/* @__PURE__ */ new Map;for(let[e,t]of Object.entries(n.members))if(e!==`__flat_session_order__`)for(let n of t)i.set(n,e);return Object.fromEntries(Object.entries(e).map(([e,n])=>{let a=[...n],o=n[0]===void 0?void 0:r.get(n[0]),s=o?.blank&&(o.retainedBy.mainView??0)>0?1:0;for(let n of t[e]??[]){let t=a.indexOf(n);t===-1?!r.has(n)&&(e===`__flat_session_order__`||!i.has(n)||i.get(n)===e)&&a.splice(s++,0,n):s=t+1}return[e,a]}))}function Ph(){return(0,i.defineStore)({init:()=>({groupBy:`workspace`,orderBy:`updated`,groupExpansion:{},threadExpansion:{},sectionExpansion:{},sessionOrderByAccount:{},archivedFilter:`default`}),persist:`dsh.workspace.view.v5`,actions:{setGroupBy:(e,t)=>{e.groupBy=t},setOrderBy:(e,t,n,r)=>{t!==e.orderBy&&(e.sessionOrderByAccount=t===`manual`?Nh(n,e.sessionOrderByAccount,r):{},e.orderBy=t)},setGroupExpanded:(e,t,n)=>{e.groupExpansion[t]=n},setThreadsExpanded:(e,t,n)=>{e.threadExpansion??={};for(let r of t)e.threadExpansion[r]=n},setSectionExpanded:(e,t,n)=>{e.sectionExpansion={...e.sectionExpansion,[t]:n}},retainAccountKeys:(e,t)=>{let n=new Set(t);e.groupExpansion=Object.fromEntries(Object.entries(e.groupExpansion).filter(([e])=>n.has(e))),e.sessionOrderByAccount=Object.fromEntries(Object.entries(e.sessionOrderByAccount).filter(([e])=>n.has(e))),delete e.sessionUpdatedAtByAccount},syncSessionOrders:(e,t,n)=>{e.orderBy===`manual`&&Object.assign(e.sessionOrderByAccount,Nh(t,e.sessionOrderByAccount,n))},setSessionOrder:(e,t,n,r,i)=>{let a=Nh({...r,[t]:n},e.sessionOrderByAccount,i);e.orderBy===`updated`?e.sessionOrderByAccount=a:Object.assign(e.sessionOrderByAccount,a),e.orderBy=`manual`},pinSessionOrder:(e,t,n,r)=>{let i=new Set(n),a=Nh(Object.fromEntries(Object.entries(r.members).map(([t,n])=>[t,sh(n,e.sessionOrderByAccount[t],r.summaries,r.rowState)])),e.sessionOrderByAccount,r);for(let e of i)a[e]!==void 0&&(a[e]=[t,...a[e].filter(e=>e!==t)]);Object.assign(e.sessionOrderByAccount,a)},setArchivedFilter:(e,t)=>{e.archivedFilter=t}}})}function Fh(e,t,n){let r=n??bh(e,t,/* @__PURE__ */ new Map),i=new Set(Ch(e,t.archivedSessionIds,t.archivedFilter)),a=/* @__PURE__ */ new Set([...r.map(e=>e.id),...Sh(e,t.archivedSessionIds).filter(e=>!i.has(e))]),o=/* @__PURE__ */ new Map,s={...e.byId};for(let e of r){for(let t of e.tree?.descendantIds??[])o.set(Hm(t),e.id);let t=s[e.id];t!==void 0&&(s[e.id]={...t,updatedAt:e.tree?.updatedAt??e.updatedAt})}return{rootIds:a,rootOf:o,summaries:s}}function Ih(e,t){let n=new Set(e),r=[],i=/* @__PURE__ */ new Set;for(let a of e){if(t.summaries[a]===void 0||t.rootIds.has(a)){r.push(a);continue}let e=t.rootOf.get(a);e===void 0||n.has(e)||i.has(e)||(i.add(e),r.push(e))}return{memberIds:r,linkedRootIds:i}}function Lh(e,t,n,r){let i=r??Fh(t,{...n,archivedFilter:n.archivedFilter??`default`}),a=e=>e.filter(e=>t.byId[e]===void 0||i.rootIds.has(e)),o=new Set(e.flatMap(e=>e.sessionIds));return{members:Object.fromEntries([...e.map(e=>[e.workspaceId,Ih(e.sessionIds,i).memberIds]),[``,a([.../* @__PURE__ */ new Set([...t.ids,...n.archivedSessionIds])]).filter(e=>!o.has(e))],[Oh,a(Sh(t,n.archivedSessionIds))]]),summaries:i.summaries,rowState:n}}function Rh(e,t){return[rh(e,t),Oh]}var zh=class{sessions;workspaces;held=/* @__PURE__ */ new Map;recent=/* @__PURE__ */ new Map;running=/* @__PURE__ */ new Set;failed=/* @__PURE__ */ new Set;maxStoppedSessions;maxStoppedBytes;maxBackgroundRunningSessions;maxTotalBytes;assemblyOverheadFactor;lastVisited;active=!1;reconciling=!1;dirty=!1;constructor(e,t,n={}){this.sessions=e,this.workspaces=t,this.maxStoppedSessions=Math.max(0,n.maxStoppedSessions??4),this.maxStoppedBytes=Math.max(0,n.maxStoppedBytes??33554432),this.maxBackgroundRunningSessions=Math.max(0,n.maxBackgroundRunningSessions??2),this.maxTotalBytes=n.maxTotalBytes===void 0?Math.max(this.maxStoppedBytes,50331648):Math.max(0,n.maxTotalBytes),this.assemblyOverheadFactor=Math.max(1,n.assemblyOverheadFactor??3)}start(){this.active=!0;let e=this.sessions.list.subscribe(()=>this.reconcile()),t=this.workspaces.list.subscribe(()=>this.reconcile());return this.reconcile(),()=>{this.active=!1,e(),t();let n=[...this.held.values()];this.held.clear(),this.recent.clear(),this.running.clear(),this.failed.clear(),this.lastVisited=void 0;for(let{reference:e}of n)e.release()}}visit(e,t){this.active&&(this.lastVisited=e.sessionId,this.failed.delete(e.sessionId),this.remember(e.sessionId,typeof t==`string`?this.sessions.subagentAddress(e.sessionId)??t:t),this.reconcile())}remember(e,t){this.recent.delete(e),this.recent.set(e,t)}isProtectedView(e,t){let n=!1;for(let r of[this.sessions.retainInfo?.(e)?.getSnapshot().retainedBy,t.byId[e]?.retainedBy])if(r!==void 0){for(let[e,t]of Object.entries(r))if(!((t??0)<=0)&&(n=!0,e!==`backgroundWarm`))return!0}return!n&&e===this.lastVisited}reconcile(){if(this.active&&(this.dirty=!0,!this.reconciling)){this.reconciling=!0;try{for(;this.dirty&&this.active;)this.dirty=!1,this.update()}finally{this.reconciling=!1}}}update(){let e=this.sessions.list.getSnapshot(),t=new Set(e.ids),n=new Set(this.workspaces.list.getSnapshot().archivedSessionIds);for(let[r,i]of this.recent)(n.has(r)||this.sessions.binding(r)?.session.getSnapshot().removed||e.phase===`ready`&&!t.has(r)&&typeof i==`string`)&&(this.recent.delete(r),this.running.delete(r),this.lastVisited===r&&(this.lastVisited=void 0));let r=/* @__PURE__ */ new Set;for(let t of this.recent.keys()){let n=e.byId[t];(n?.running&&n.origin!==`subagent`||e.phase===`pending`&&this.running.has(t))&&r.add(t)}this.running=r;let i=/* @__PURE__ */ new Set,a=/* @__PURE__ */ new Map,o=0;for(let t of this.recent.keys()){this.isProtectedView(t,e)&&i.add(t);let n=Math.max(0,this.sessions.estimatedBytes?.(t)??0)*this.assemblyOverheadFactor;a.set(t,n),o+=n}let s=[...this.recent.keys()].filter(e=>!r.has(e)),c=s.length,l=0;for(let e of s)l+=a.get(e)??0;for(let e of s){if(c<=this.maxStoppedSessions&&l<=this.maxStoppedBytes)break;if(i.has(e))continue;let t=a.get(e)??0;this.recent.delete(e),--c,l-=t,o-=t}let u=[...this.recent.keys()].filter(e=>r.has(e)&&!i.has(e)),d=u.length;for(let e of u){if(d<=this.maxBackgroundRunningSessions)break;let t=a.get(e)??0;this.recent.delete(e),r.delete(e),--d,o-=t}if(o>this.maxTotalBytes){let e=[...this.recent.keys()].filter(e=>!r.has(e)&&!i.has(e));for(let t of e){if(o<=this.maxTotalBytes)break;this.recent.delete(t),o-=a.get(t)??0}}if(o>this.maxTotalBytes){let e=[...this.recent.keys()].filter(e=>r.has(e)&&!i.has(e));for(let t of e){if(o<=this.maxTotalBytes)break;this.recent.delete(t),r.delete(t),o-=a.get(t)??0}}let f=new Map(this.recent);for(let e of this.failed)f.has(e)||this.failed.delete(e);for(let[e,t]of this.held){let n=this.sessions.binding(e)!==t.binding;(!f.has(e)||n)&&(this.held.delete(e),n&&(this.recent.delete(e),this.failed.add(e)),t.reference.release())}for(let[e,t]of f){if(this.held.has(e)||this.failed.has(e))continue;let n;try{n=this.sessions.retain(t,{source:`backgroundWarm`});let r={reference:n,binding:n.binding};this.held.set(e,r),n.ready.then(()=>{this.active&&this.held.get(e)===r&&this.reconcile()},()=>this.fail(e,r))}catch{this.failed.add(e),n?.release()}}}fail(e,t){this.active&&this.held.get(e)===t&&(this.failed.add(e),this.held.delete(e),t.reference.release())}};let Bh=`codexhost.web.session-tabs.v2:local`,Vh=`codexhost.web.session-tabs.v1:local`,Hh=`codexhost.web.recent-visits.v1:local`,Uh=1048576;function Wh(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Gh(e){return typeof e==`string`&&e.length>0&&e.length<=1024&&e.trim()===e&&!/[\u0000-\u001f\u007f]/u.test(e)?Hm(e):void 0}function Kh(e,t){if(typeof e==`string`)return e===t?t:void 0;if(!Wh(e)||Object.keys(e).length!==3)return;let n=Gh(e.parentSessionId),r=Gh(e.childSessionId),i=e.mode;if(!(n===void 0||r!==t||n===r||i!==`one-shot`&&i!==`continuable`&&i!==`unknown`))return{parentSessionId:n,childSessionId:r,mode:i}}function qh(e,t){if(e===null||e.length>Uh)return[];try{let n=JSON.parse(e);if(!Wh(n)||Object.keys(n).length!==2||n.version!==t||!Array.isArray(n.entries))return[];let r=[],i=/* @__PURE__ */ new Set,a=Date.now();for(let e of n.entries){if(!Wh(e))continue;let n=Object.keys(e);if(t===2&&n.length!==3||n.length!==2&&(n.length!==3||!Object.hasOwn(e,`lastVisitedAt`)))continue;let o=Gh(e.sessionId);if(o===void 0||i.has(o))continue;let s=Object.hasOwn(e,`lastVisitedAt`)?e.lastVisitedAt:a;if(typeof s!=`number`||!Number.isSafeInteger(s)||s<0||s>a)continue;let c=Kh(e.target,o);c!==void 0&&(i.add(o),r.push({sessionId:o,target:c,lastVisitedAt:s}))}return r}catch{return[]}}var Jh=class{onFailure;enabled=typeof window<`u`&&/^https?:$/u.test(window.location.protocol);reported=!1;constructor(e){this.onFailure=e}read(){if(!this.enabled)return[];try{return this.latest()}catch{return this.failed(),[]}}update(e,t){if(this.enabled)try{let n=this.latest().filter(e=>t?.(e)!==!0),r=new Map(n.map((e,t)=>[e.sessionId,t]));for(let i of e){if(t?.(i)===!0)continue;let e=r.get(i.sessionId);e===void 0?(r.set(i.sessionId,n.length),n.push(i)):n[e]=i}let i=JSON.stringify({version:2,entries:n.map(e=>({sessionId:e.sessionId,lastVisitedAt:e.lastVisitedAt,target:typeof e.target==`string`?e.target:{parentSessionId:e.target.parentSessionId,childSessionId:e.target.childSessionId,mode:e.target.mode}}))});if(i.length>Uh){this.failed();return}localStorage.getItem(Bh)!==i&&localStorage.setItem(Bh,i),localStorage.removeItem(Vh),localStorage.removeItem(Hh)}catch{this.failed()}}latest(){let e=localStorage.getItem(Bh);return e===null?qh(localStorage.getItem(Vh)??localStorage.getItem(Hh),1):qh(e,2)}failed(){if(!this.reported){this.reported=!0;try{this.onFailure()}catch{}}}},Yh=class{sessions;workspaces;subscribeRemoved;entries=(0,i.createSnapshotStore)([]);records=[];current;awaitingFormalSession=!1;active=!1;headRevision=0;restoring=!1;cache;constructor(e,t,n,r=()=>{}){this.sessions=e,this.workspaces=t,this.subscribeRemoved=n,this.cache=new Jh(r)}start(e){this.active=!0,this.headRevision=this.sessions.list.getSnapshot().headRefreshRevision??0,this.records=this.cache.read(),this.cache.update([]);let t=this.sessions.list.subscribe(()=>{let t=this.sessions.list.getSnapshot().headRefreshRevision??0;t!==this.headRevision&&(this.headRevision=t,this.restoreSummaries(this.current?.sessionId??e)),this.reconcile()}),n=this.workspaces.list.subscribe(()=>this.reconcile()),r=this.subscribeRemoved?.(e=>{this.sessions.subagentAddress(e)!==void 0||this.sessions.list.getSnapshot().byId[e]?.origin===`subagent`||this.records.some(t=>t.sessionId===e&&typeof t.target!=`string`)||(this.records=this.records.filter(t=>!this.includesIdentity(t,e)),this.cache.update([],t=>this.includesIdentity(t,e)),this.publish())});return this.reconcile(),this.restoreSummaries(e),()=>{this.active=!1,t(),n(),r?.(),this.current=void 0,this.awaitingFormalSession=!1,this.records=[],this.entries.set([])}}visit(e,t){let n=Date.now(),r=this.depart(n);r!==void 0&&this.remember(r),this.current={sessionId:e,target:typeof t==`string`?this.sessions.subagentAddress(e)??t:t,lastVisitedAt:n},this.awaitingFormalSession=!0,this.reconcile(r===void 0?[]:[r])}clearCurrent(){let e=this.depart(Date.now());e!==void 0&&this.remember(e),this.current=void 0,this.awaitingFormalSession=!1,this.reconcile(e===void 0?[]:[e])}depart(e){let t=this.current;return t!==void 0&&this.records.some(e=>e.sessionId===t.sessionId)&&this.formal(t)?{...t,lastVisitedAt:e}:void 0}close(e){this.records=this.records.filter(t=>t.sessionId!==e),this.cache.update([],t=>t.sessionId===e),this.current?.sessionId===e&&(this.awaitingFormalSession=!1),this.publish()}closeAll(){let e=new Set(this.records.map(e=>e.sessionId));this.records=[],this.awaitingFormalSession=!1,this.cache.update([],t=>e.has(t.sessionId)),this.publish()}expireInactive(e,t,n=Date.now()){let r=this.sessions.list.getSnapshot();if(!this.active||!Number.isFinite(e)||e<=0||r.phase!==`ready`||r.loading===!0||r.listError!=null&&r.listErrorPage!==`more`||this.workspaces.list.getSnapshot().phase!==`ready`)return{changed:!1,nextDelayMs:void 0};let i=new Set(r.ids),a=new Set(this.entries.getSnapshot().map(e=>e.sessionId)),o=e=>{let n=r.byId[e.sessionId];if(e.sessionId===this.current?.sessionId||!a.has(e.sessionId)||n===void 0||n.blank||(n.retainedBy.mainView??0)>0||n.running||!Number.isFinite(n.updatedAt))return;let o=t.get(e.sessionId);if(o?.pendingInteraction!==void 0)return;let s=n.projectionValues?.subagentTiming;if(s?.active!==void 0||typeof e.target!=`string`&&!(o?.running!==void 0||i.has(e.sessionId)||s?.lastTurnCompleted!==void 0))return;let c=_h(n,r,t);if(!(c.running||c.runningSubagentCount>0))return Math.max(e.lastVisitedAt,n.updatedAt)},s=/* @__PURE__ */ new Set,c;for(let t of this.records){let r=o(t);if(r===void 0)continue;let i=e-(n-r);i<=0?s.add(t.sessionId):(c===void 0||i<c)&&(c=i)}return s.size===0?{changed:!1,nextDelayMs:c}:(this.records=this.records.filter(e=>!s.has(e.sessionId)),this.cache.update([],t=>{if(!s.has(t.sessionId))return!1;let r=o(t);return r!==void 0&&n-r>=e}),this.publish(),{changed:!0,nextDelayMs:c})}remember(e){let t=this.records.findIndex(t=>t.sessionId===e.sessionId);this.records=t===-1?[...this.records,e]:this.records.map((n,r)=>r===t?e:n)}formal(e){let t=this.sessions.list.getSnapshot();return t.byId[e.sessionId]?.blank===!1&&!this.invalid(e,t)}reconcile(e=[]){if(!this.active)return;let t=this.sessions.list.getSnapshot(),n=new Set(this.records.filter(e=>this.invalid(e,t)).map(e=>e.sessionId));this.records=this.records.filter(e=>!n.has(e.sessionId));let r=[...e],i=this.current;this.awaitingFormalSession&&i!==void 0&&this.formal(i)&&(this.awaitingFormalSession=!1,this.remember(i),r.push(i)),this.publish(),(r.length>0||n.size>0)&&this.cache.update(r,e=>n.has(e.sessionId))}publish(){let e=this.sessions.list.getSnapshot(),t=this.workspaces.list.getSnapshot().phase===`ready`,n=this.records.flatMap(n=>{if(!t||e.byId[n.sessionId]?.blank!==!1||this.invalid(n,e))return[];if(typeof n.target==`string`)return[n];let r=this.sessions.subagentAddress(n.sessionId);if(r===void 0||r.parentSessionId!==n.target.parentSessionId||r.childSessionId!==n.sessionId)return[];if(r.mode===n.target.mode)return[n];let i={...n,target:r};return this.records=this.records.map(e=>e===n?i:e),[i]}),r=this.entries.getSnapshot();(n.length!==r.length||n.some((e,t)=>e!==r[t]))&&this.entries.set(n)}restoreSummaries(e=this.current?.sessionId){if(this.restoring)return;let t=this.sessions.list.getSnapshot(),n=new Set(t.ids),r=this.records.filter(r=>r.sessionId!==e&&(t.byId[r.sessionId]===void 0||typeof r.target!=`string`&&!n.has(r.sessionId)));if(r.length===0)return;this.restoring=!0;let i=0;Promise.all(Array.from({length:Math.min(4,r.length)},async()=>{for(;this.active;){let e=r[i++];if(e===void 0)return;let t=e.sessionId,n=this.sessions.list.getSnapshot();if(!(!this.records.some(e=>e.sessionId===t)||(typeof e.target==`string`?n.byId[t]!==void 0:n.ids.includes(t)))){try{await this.sessions.loadSummary(t)}catch{}this.active&&this.reconcile()}}})).finally(()=>{this.restoring=!1})}includesIdentity(e,t){if(e.sessionId===t)return!0;if(typeof e.target==`string`)return!1;let n=/* @__PURE__ */ new Set,r=e.target.parentSessionId;for(;r!==void 0&&!n.has(r);){if(r===t)return!0;n.add(r),r=this.sessions.subagentAddress(r)?.parentSessionId}return!1}invalid(e,t){let n=this.workspaces.list.getSnapshot().archivedSessionIds,r=e=>n.includes(e)||this.sessions.binding(e)?.session.getSnapshot().removed===!0;if(r(e.sessionId))return!0;if(typeof e.target==`string`)return!1;let i=/* @__PURE__ */ new Set([e.sessionId]),a=e.target;for(;!i.has(a.parentSessionId);){if(r(a.parentSessionId)||Xh(t,a.parentSessionId,a.childSessionId))return!0;i.add(a.parentSessionId);let e=this.sessions.subagentAddress(a.parentSessionId);if(e===void 0)break;a=e}return!1}};function Xh(e,t,n){let r=e.projectionsBySession[t];return e.phase===`ready`&&r?.state!==`loading`&&r?.state!==`error`&&r?.values.subagentCatalog!==void 0&&!r.values.subagentCatalog.some(e=>e.id===n)}function Zh(e){return typeof e==`string`&&e.length>0?e:void 0}function Qh(e){if(typeof e!=`object`||!e||!(`next`in e))return;let t=e.next;if(typeof t!=`object`||!t)return;let n=t;if(typeof n.provider==`string`&&typeof n.model==`string`)return{provider:n.provider,model:n.model,...typeof n.reasoningEffort==`string`?{reasoningEffort:n.reasoningEffort}:{}}}var $h=class extends Error{rpcError;name=`DirectoryBrowseError`;constructor(e){super(`directory browse failed: ${e.code}: ${e.message}`),this.rpcError=e}},eg=class extends a.Service{directoryPicker;workspaces;sessions;view;notify;sessionRemote;connecting=/* @__PURE__ */ new Map;lifetime=new AbortController;selection=(0,i.createSnapshotStore)({},{persist:{name:`dsh.sessions.current`}});mainReference;mainIsRemote=!1;disposeMainSessionWatch;opening=(0,i.createSnapshotStore)({state:`idle`});retryOpen;openingLoad;creating=(0,i.createSnapshotStore)({state:`idle`});retryCreate;creatingLoad;creationToken=0;openedProjectlessBlank;keepalive;recentVisits;groupRooms=(0,i.createSnapshotStore)([]);disposeGroupRoomsSource;constructor(e,t,n,r,i,a,o){super(e,`uiWorkspace`),this.directoryPicker=t,this.workspaces=n,this.sessions=r,this.view=i,this.notify=a,this.sessionRemote=o,this.keepalive=new zh(r,n);let s=e.get(`remote`);this.recentVisits=new Yh(r,n,s===void 0?void 0:e=>s.$on(`api-session/removed`,e),()=>a({kind:`recentVisitsStorageFailed`})),e.effect(()=>{let e=this.selection.getSnapshot(),t=this.recentVisits.start(e.subagentAddress?.childSessionId??e.sessionId),n=this.keepalive.start(),r=this.watchNavigation();return()=>{r(),this.lifetime.abort(),n(),t(),this.disposeMainSessionWatch?.(),this.disposeMainSessionWatch=void 0,this.disposeGroupRoomsSource?.(),this.disposeGroupRoomsSource=void 0;let e=this.mainReference;this.mainReference=void 0,this.mainIsRemote=!1,e?.release()}},`ui-workspace: Workspace navigation policy`)}setGroupSidebarSource(e){this.disposeGroupRoomsSource?.();let t=()=>{this.groupRooms.set(e.getSnapshot())};t();let n=e.subscribe(t),r=!1,i=()=>{r||(r=!0,n(),this.disposeGroupRoomsSource===i&&(this.disposeGroupRoomsSource=void 0,this.groupRooms.set([])))};return this.disposeGroupRoomsSource=i,i}async connectWorkspace(e){let t=this.workspaces.list.getSnapshot().items.find(t=>t.workspaceId===e);if(t===void 0)throw Error(`uiWorkspace.connectWorkspace: unknown workspace ${e}`);let n=this.connecting.get(e);if(n!==void 0)return n;let r=this.reuseOrCreateBlank(t).finally(()=>{this.connecting.delete(e)});return this.connecting.set(e,r),r}async reuseOrCreateBlank(e,t){let n=this.workspaces.list.getSnapshot().archivedSessionIds,r=this.sessions.list.getSnapshot();for(let i of r.ids){let a=r.byId[i];if(a===void 0||!a.blank||a.cwd!==e.path||!e.sessionIds.includes(i)||n.includes(i))continue;let o=await this.tryReuseBlank(e.workspaceId,i,{...t===void 0?{}:{roleSlug:t}});if(o!==void 0)return o}return this.sessions.create({workspaceId:e.workspaceId,...t===void 0?{}:{roleSlug:t}})}async reuseOrCreateProjectlessBlank(e){let t=this.workspaces.list.getSnapshot(),n=this.sessions.list.getSnapshot(),r=r=>{let i=n.byId[r];if(i===void 0||!i.blank||i.cwd!==void 0||i.parentId!==void 0||i.origin!==void 0||this.isRemoteSession(r)||t.archivedSessionIds.includes(r)||t.items.some(e=>e.sessionIds.includes(r)))return!1;let a=Zh(i.projectionValues?.draftRoleSlug);return e===void 0?a===void 0:a===e},i=this.openedProjectlessBlank,a=i!==void 0&&r(i)?i:n.ids.find(r);return(a===void 0?void 0:await this.tryReuseBlank(void 0,a,{...e===void 0?{}:{roleSlug:e}}))??this.sessions.create(e===void 0?void 0:{roleSlug:e})}openProjectlessBlank(e,t,n,r,i=!1){this.replaceMain(e,t,n,r,i),this.mainReference?.sessionId===e&&(this.openedProjectlessBlank=e)}async tryReuseBlank(e,t,{restore:n=!1,roleSlug:r}={}){let i=e===void 0?{}:{workspaceId:e};try{return await this.sessions.create({...i,sessionId:t,...!n&&e!==void 0&&r===void 0?{matchProjectDefault:!0}:{},...r===void 0?{}:{roleSlug:r}})}catch(e){let t=tg(e)?.rpcError.code;if(t!==`session/writer-held`&&(n||t!==`session/busy`))throw e;return}}carriedDraftSelection(e){let t=this.mainReference?.sessionId;if(t===void 0||this.isRemoteSession(t))return;let n=this.sessions.list.getSnapshot().byId[t];if(n?.blank!==!0)return;if(e!==null){let t=this.workspaces.list.getSnapshot().items.find(t=>t.workspaceId===e);if(t===void 0||t.remote!==void 0)return}let r=this.sessions.binding(t)?.session.projections,i=Zh(r?.faceOf(`draftRoleSlug`).getSnapshot())??Zh(n.projectionValues?.draftRoleSlug),a=r?.faceOf(`draftSelectionExplicit`).getSnapshot()===!0,o=Qh(r?.faceOf(`modelSelection`).getSnapshot())??Qh(n.projectionValues?.modelSelection);if(i!==void 0)return{currentId:t,roleSlug:i,...o===void 0?{}:{selection:o}};if(a&&o!==void 0)return{currentId:t,selection:o}}draftMatchesWorkspace(e,t){let n=this.workspaces.list.getSnapshot().items;return t===null?this.sessions.list.getSnapshot().byId[e]?.cwd===void 0&&!n.some(t=>t.sessionIds.includes(e)):n.find(e=>e.workspaceId===t)?.sessionIds.includes(e)===!0}async resolveWorkspaceDraftWithSelection(e,t){let n=this.sessionRemote?.selectModel??this.ctx.get(`remote.session`)?.selectModel;if(t.roleSlug!==void 0){let r;if(e===null)r=await this.reuseOrCreateProjectlessBlank(t.roleSlug);else{let n=this.workspaces.list.getSnapshot().items.find(t=>t.workspaceId===e);if(n===void 0)throw Error(`uiWorkspace.openWorkspace: unknown workspace ${e}`);r=await this.reuseOrCreateBlank(n,t.roleSlug)}return t.selection!==void 0&&n!==void 0&&await n({sessionId:r,...t.selection,roleSlug:t.roleSlug}).catch(()=>void 0),r}let r=e===null?await this.sessions.create():await this.sessions.create({workspaceId:e});return t.selection!==void 0&&n!==void 0&&await n({sessionId:r,...t.selection,roleSlug:null}).catch(()=>void 0),r}openSession(e){if(typeof e==`string`&&this.workspaces.list.getSnapshot().archivedSessionIds.includes(e)){this.notify({kind:`archivedNotOpenable`});return}let t=AbortSignal.any([this.ctx.layout.beginNavigation(),this.lifetime.signal]);this.opening.set({state:`idle`}),this.retryOpen=void 0,typeof e!=`string`||this.sessions.list.getSnapshot().byId[e]!==void 0||this.sessions.syncSummary?.(e)===!0?this.replaceMain(e,t,`reveal`):this.resolveSession(e,t,()=>{this.workspaces.list.getSnapshot().archivedSessionIds.includes(e)?this.notify({kind:`archivedNotOpenable`}):this.replaceMain(e,t,`reveal`)},()=>this.openSession(e))}closeSessionTab(e){this.recentVisits.close(e)}closeAllSessionTabs(){this.recentVisits.closeAll()}retryOpening(){this.retryOpen?.()}retryCreating(){this.retryCreate?.()}async resolveSession(e,t,n,r,i){if(t.aborted)return;this.openingLoad?.stop(),this.retryOpen=void 0;let a={stop:()=>t.removeEventListener(`abort`,o)},o=()=>{a.stop(),this.openingLoad===a&&(this.openingLoad=void 0,this.opening.set({state:`idle`}),this.retryOpen=void 0)};t.addEventListener(`abort`,o,{once:!0}),this.openingLoad=a,this.opening.set({state:`loading`,sessionId:e});try{if(t.aborted||this.openingLoad!==a||(await this.sessions.loadSummary(e),t.aborted||this.openingLoad!==a))return;if(this.sessions.list.getSnapshot().byId[e]===void 0){if(i!==void 0){o(),i();return}throw Error(`Session not found: ${e}`)}n(),o()}catch(n){if(t.aborted||this.openingLoad!==a)return;let s=ng(n)===`remote/offline`;if(i!==void 0&&(s||rg(n))){o(),i(s?{message:sg(n)}:void 0);return}this.retryOpen=r,this.opening.set({state:`error`,sessionId:e,message:sg(n)})}}async openWorkspace(e,t){if(this.mainReference===void 0){let n=this.creating.getSnapshot(),r=n.state===`idle`?++this.creationToken:n.token,i=n.state===`idle`?void 0:n.initialPrompt;await this.runCreation({workspaceId:e,token:r,...i===void 0?{}:{initialPrompt:i},...t===void 0?{}:{beforeOpen:t}});return}let n=this.carriedDraftSelection(e);if(n!==void 0&&this.draftMatchesWorkspace(n.currentId,e))return;let r=AbortSignal.any([this.ctx.layout.beginNavigation(),this.lifetime.signal]),i;try{if(e===null&&!this.workspaces.list.getSnapshot().canStartProjectless)throw new ig;i=n===void 0?e===null?await this.reuseOrCreateProjectlessBlank():await this.connectWorkspace(e):await this.resolveWorkspaceDraftWithSelection(e,n)}catch(e){throw r.aborted||this.notify({kind:`createFailed`,message:sg(e)}),e}r.aborted||(e===null?this.openProjectlessBlank(i,r,`reveal`,t):this.replaceMain(i,r,`reveal`,t))}async forkSession(e,t){return this.sessions.fork({sessionId:e,increaseTitle:!0,...t===void 0?{}:{onCreated:t}})}startSession(e,t){let n=t===void 0?void 0:{...t},r=n!==void 0&&(n.prompt!==void 0||n.clearPreviousDraft===!0),i=this.workspaces.list.getSnapshot(),a=this.sessions.list.getSnapshot(),o=this.mainReference?.sessionId,s=o===void 0?void 0:i.items.find(e=>e.sessionIds.includes(o))?.workspaceId,c=i.phase===`ready`&&a.phase===`ready`?cg(i.items,a.byId):void 0,l=e??(i.canStartProjectless?null:s??c);if(l===void 0){if(this.ctx.layout.beginNavigation(),r){this.notify({kind:`createFailed`,message:this.ctx.locale.bind(`workspace`)(`draft.workspaceRequired`)});return}this.clearMain();return}this.ctx.layout.selectPanel(null),this.releaseMainSelection();let u=++this.creationToken;this.runCreation({workspaceId:l,token:u,...n?.prompt===void 0?{}:{initialPrompt:n.prompt},...r?{draftOptions:n}:{}}).catch(e=>{console.warn(`new session failed:`,e)})}async runCreation(e){this.creatingLoad?.stop(),this.creatingLoad=void 0,this.retryCreate=void 0;let t=AbortSignal.any([this.ctx.layout.beginNavigation(),this.lifetime.signal]);this.openingLoad?.stop(),this.openingLoad=void 0,this.opening.set({state:`idle`}),this.retryOpen=void 0;let n={stop:()=>t.removeEventListener(`abort`,r)},r=()=>{n.stop(),this.creatingLoad===n&&(this.creatingLoad=void 0,this.retryCreate=void 0,this.creating.set({state:`idle`}))};t.addEventListener(`abort`,r,{once:!0}),this.creatingLoad=n,this.creating.set({state:`creating`,workspaceId:e.workspaceId,token:e.token,...e.initialPrompt===void 0?{}:{initialPrompt:e.initialPrompt}});try{if(e.workspaceId===null&&!this.workspaces.list.getSnapshot().canStartProjectless)throw new ig;let i=e.workspaceId===null?await this.reuseOrCreateProjectlessBlank():await this.connectWorkspace(e.workspaceId);if(t.aborted||this.creatingLoad!==n)return;let a=t=>{e.beforeOpen?.(t),this.handoffPendingDraft(t,e.draftOptions)};e.workspaceId===null?this.openProjectlessBlank(i,t,`preserve`,a):this.replaceMain(i,t,`preserve`,a),r()}catch(r){if(t.aborted||this.creatingLoad!==n)return;this.retryCreate=()=>{this.runCreation(e).catch(e=>{console.warn(`new session retry failed:`,e)})};let i=ag(r),a=i===`unknown`?og(r):void 0;throw this.creating.set({state:`error`,workspaceId:e.workspaceId,reason:i,...a===void 0?{}:{message:a},token:e.token,...e.initialPrompt===void 0?{}:{initialPrompt:e.initialPrompt}}),r}}handoffPendingDraft(e,t){let n=this.sessions.binding(e),r=this.ctx.get(`conversation`);t===void 0?n!==void 0&&r!==void 0&&r.input.adoptPendingDraft(n):((n===void 0||r===void 0)&&this.draftPreparationFailed(),r.input.adoptPendingDraft(n,t)===`blocked`&&this.draftPreparationFailed())}draftPreparationFailed(){let e=this.ctx.locale.bind(`workspace`)(`draft.initializationFailed`);throw this.notify({kind:`createFailed`,message:e}),Error(e)}async archiveSession(e,t={}){await this.workspaces.archiveSession(e,t),this.mainReference?.sessionId===e&&this.clearMain()}async unarchiveSession(e){await this.workspaces.unarchiveSession(e)}async deleteSession(e){if(!this.workspaces.deleteSession)throw Error(`Session deletion is unavailable`);await this.workspaces.deleteSession(e),this.mainReference?.sessionId===e&&this.clearMain()}async pinSession(e){await this.workspaces.pinSession(e);let{items:t,pinnedSessionIds:n,archivedSessionIds:r}=this.workspaces.list.getSnapshot();this.view.pinSessionOrder(e,Rh(t,e),Lh(t,this.sessions.list.getSnapshot(),{pinnedSessionIds:n,archivedSessionIds:r}))}async unpinSession(e){await this.workspaces.unpinSession(e)}async pickDirectory(){let e=await this.directoryPicker.pick();if(!e.ok)throw Error(`directory picker failed: ${e.error.message}`);return e.value}async listDirectory(e,t){let n=await this.directoryPicker.list(e,t);if(!n.ok)throw new $h(n.error);return n.value}async createDirectory(e,t){let n=await this.directoryPicker.createDirectory(e,t);if(!n.ok)throw new $h(n.error);return n.value}watchNavigation(){let e=`waiting`,t,n=AbortSignal.any([this.ctx.layout.beginNavigation(),this.lifetime.signal]);n.addEventListener(`abort`,()=>{e=`done`},{once:!0});let r=e=>{this.retryOpen=e.retry,this.opening.set({state:`error`,sessionId:e.sessionId,message:e.message})},i=()=>{if(this.lifetime.signal.aborted)return;let i=this.mainReference?.sessionId;if(i!==void 0&&!this.mainIsRemote&&this.isRemoteSession(i)&&(this.mainIsRemote=!0),this.clearArchivedCurrent()||this.clearRemovedRemoteCurrent()||e!==`waiting`)return;let a=this.workspaces.list.getSnapshot(),o=this.sessions.list.getSnapshot();if(this.mainReference!==void 0){e=`done`;return}if(a.phase!==`ready`||o.phase!==`ready`)return;e=`connecting`;let s=t;this.restoreSelection(a,o,n,s!==void 0).then(t=>{n.aborted||(!t&&s!==void 0&&this.mainReference===void 0&&r(s),e=`done`)},t=>{n.aborted||(s!==void 0&&this.mainReference===void 0?(r(s),e=`done`,console.warn(`initial Session restoration failed:`,t)):(e=`waiting`,console.warn(`initial Session restoration failed:`,t)))})},a=this.workspaces.list.subscribe(i),o=this.sessions.list.subscribe(i),s=this.ctx.get(`remote`)?.$on(`api-session/removed`,e=>{this.lifetime.signal.aborted||this.clearRemovedRemoteCurrent(e)}),c=this.selection.getSnapshot();if(c.sessionId!==void 0||c.subagentAddress!==void 0){if(e=`connecting`,c.subagentAddress!==void 0)this.replaceMain(c.subagentAddress,n,`preserve`),e=`done`;else if(c.sessionId!==void 0){let r=c.sessionId,a=()=>{this.resolveSession(r,n,()=>{t=void 0,this.sessions.list.getSnapshot().byId[r]?.blank===!0?(e=`waiting`,i()):(this.replaceMain(r,n,`preserve`),e=`done`)},a,o=>{n.aborted||(o===void 0&&this.selection.getSnapshot().sessionId===r&&this.selection.set({}),t=o===void 0?void 0:{sessionId:r,message:o.message,retry:a},e=`waiting`,i())})};a()}}return i(),()=>{this.lifetime.abort(),s?.(),o(),a()}}async restoreSelection(e,t,n,r){let i=r?{}:this.selection.getSnapshot(),a=r?e.items.filter(e=>e.remote===void 0):e.items;if(i.subagentAddress!==void 0)return this.replaceMain(i.subagentAddress,n,`preserve`),!0;let o=i.sessionId===void 0?void 0:t.byId[i.sessionId],s=o===void 0?void 0:a.find(e=>e.sessionIds.includes(o.id));if(o!==void 0&&(!o.blank||s===void 0))return o.blank?this.openProjectlessBlank(o.id,n,`preserve`):this.replaceMain(o.id,n,`preserve`),!0;let c;if(o!==void 0&&s!==void 0&&o.cwd===s.path&&!e.archivedSessionIds.includes(o.id)&&(c=await this.tryReuseBlank(s.workspaceId,o.id,{restore:!0})),c===void 0&&e.canStartProjectless&&o===void 0)return c=await this.reuseOrCreateProjectlessBlank(),!n.aborted&&(this.openProjectlessBlank(c,n,`preserve`,void 0,r),!0);let l=s?.workspaceId??cg(a,t.byId),u=t.ids.some(t=>!e.archivedSessionIds.includes(t)&&!this.isRemoteSession(t));if(l===void 0&&a.length===0&&(r?!u:t.ids.length===0)){let e=await this.initializeDefaultWorkspace(n);if(n.aborted)return!1;l=e?.workspaceId}return c===void 0&&l!==void 0&&(c=await this.connectWorkspace(l)),c!==void 0&&!n.aborted&&(this.replaceMain(c,n,`preserve`,void 0,r),!0)}async initializeDefaultWorkspace(e){try{return await this.workspaces.initializeDefault(e)}catch{e.aborted||this.notify({kind:`defaultWorkspaceFailed`});return}}clearArchivedCurrent(){let e=this.mainReference?.sessionId;return e===void 0||!this.workspaces.list.getSnapshot().archivedSessionIds.includes(e)?!1:(this.clearMain(),!0)}isDurableSubagent(e){return this.sessions.subagentAddress(e)!==void 0||this.sessions.list.getSnapshot().byId[e]?.origin===`subagent`}isRemoteSession(e){let t=this.sessions.list.getSnapshot(),n=this.workspaces.list.getSnapshot().items,r=/* @__PURE__ */ new Set,i=e;for(;i!==void 0&&!r.has(i);){let e=i;if(r.add(e),e.startsWith(`web-remote:`)||t.byId[e]?.projectionValues?.remoteHost!=null||t.projectionsBySession[e]?.values.remoteHost!=null||n.some(t=>t.remote!==void 0&&t.sessionIds.includes(e)))return!0;i=this.sessions.subagentAddress(e)?.parentSessionId}return!1}clearRemovedRemoteCurrent(e){let t=this.mainReference;if(t===void 0||e!==void 0&&this.isDurableSubagent(e))return!1;let n=/* @__PURE__ */ new Set,r=t.sessionId,i=!1;for(;r!==void 0&&!n.has(r);){let a=r;n.add(a);let o=a===t.sessionId?t.binding:this.sessions.binding(a);if(e!==void 0&&a===e||o?.session.getSnapshot().removed===!0){i=!0;break}r=this.sessions.subagentAddress(a)?.parentSessionId}return!i||!(this.mainIsRemote||this.isRemoteSession(t.sessionId)||e!==void 0&&this.isRemoteSession(e))?!1:(this.clearMain(),!0)}releaseMainSelection(){let e=this.mainReference;this.disposeMainSessionWatch?.(),this.disposeMainSessionWatch=void 0,this.mainReference=void 0,this.mainIsRemote=!1,this.recentVisits.clearCurrent(),this.selection.set({}),e?.release()}clearMain(){this.releaseMainSelection(),this.ctx.layout.selectPanel(null)}replaceMain(e,t,n,r,i=!1){t.throwIfAborted();let a=this.sessions.retain(e,{source:`mainView`});try{if(t.throwIfAborted(),r?.(a.sessionId),t.aborted){a.release();return}if(!i){let t=typeof e==`string`?this.sessions.subagentAddress(a.sessionId):e;this.selection.set({sessionId:a.sessionId,...t===void 0?{}:{subagentAddress:t}})}}catch(e){throw a.release(),e}let o=this.mainReference;this.disposeMainSessionWatch?.(),this.disposeMainSessionWatch=void 0,this.mainReference=a,this.mainIsRemote=this.isRemoteSession(a.sessionId),this.disposeMainSessionWatch=typeof a.binding.session.subscribe==`function`?a.binding.session.subscribe(()=>{this.lifetime.signal.aborted||this.clearRemovedRemoteCurrent()}):void 0,this.keepalive.visit(a,e),this.recentVisits.visit(a.sessionId,e),o?.release(),n===`reveal`&&this.ctx.layout.selectPanel(null)}};function tg(e){return e instanceof Error&&e.name===`SessionCreateError`?e:void 0}function ng(e){if(typeof e==`object`&&e&&`isDSHRemoteError`in e&&e.isDSHRemoteError===!0&&`code`in e)return e.code}function rg(e){let t=ng(e);return t===`session/not-found`||t===`remote/not-found`||t===`remote/identity-invalid`}var ig=class extends Error{name=`WorkspaceRequiredError`;constructor(){super(`This Host requires a Workspace.`)}};function ag(e){return tg(e)?.rpcError.code===`host/no-harness`?`no-harness`:e instanceof ig?`workspace-required`:`unknown`}function og(e){let t=tg(e),n=(t===void 0?e instanceof Error?e.message:String(e):t.rpcError.message).trim();return n===``?void 0:n}function sg(e){let t=tg(e);return t===void 0?e instanceof Error?e.message:String(e):`${t.rpcError.code}: ${t.rpcError.message}`}function cg(e,t){let n,r=-1/0;for(let i of e){let e=-1/0;for(let n of i.sessionIds){let r=t[n];r!==void 0&&(e=Math.max(e,r.updatedAt))}e===-1/0&&(e=Date.parse(i.createdAt)),(n===void 0||e>r)&&(n=i.workspaceId,r=e)}return n}let lg=`@deepseek-ai/dsh-client-ui-workspace/PhoneHeaderNewSession.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(lg)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=lg,e.textContent=`.--73Qq_button{display:none}[data-phone] .--73Qq_button{corner-shape:round;width:34px;height:34px;color:var(--dsw-alias-label-primary);cursor:pointer;-webkit-app-region:no-drag;-webkit-tap-highlight-color:transparent;background:0 0;border:0;border-radius:9999px;flex:none;justify-content:center;align-items:center;padding:0;transition:transform .14s,background-color .14s;display:inline-flex;position:relative}[data-phone] .--73Qq_button:after{content:"";position:absolute;inset:-5px -1px}[data-phone] .--73Qq_icon{width:17px;height:17px}[data-phone] .--73Qq_button:active{background:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent);transform:scale(.92)}[data-phone] .--73Qq_button:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}@media (prefers-reduced-motion:reduce){[data-phone] .--73Qq_button{transition:none}[data-phone] .--73Qq_button:active{transform:none}}@media (forced-colors:active){[data-phone] .--73Qq_button{color:buttontext}[data-phone] .--73Qq_button:focus-visible{outline-color:highlight}}`,document.head.appendChild(e)}var ug={button:`--73Qq_button`,icon:`--73Qq_icon`};function dg({startSession:e,useShortcuts:t,t:n}){let i=t(e=>e.find(e=>e.id===`session.new`));return/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:n(`actions.newSession`),shortcutKeys:i?.keys,side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:ug.button,"aria-label":n(`actions.newSession`),"aria-keyshortcuts":i?.aria,"data-phone-new-session":!0,onClick:()=>{e()},children:/* @__PURE__ */ (0,o.jsx)(r.IconNewChatOutlineRegular,{size:17,className:ug.icon})})})}let fg=`@deepseek-ai/dsh-client-ui-workspace/RecentShortcut.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(fg)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=fg,e.textContent=`.oOF3UG_shortcut{isolation:isolate;box-sizing:border-box;width:max-content;min-width:0;max-width:min(164px,100% - 24px);min-height:44px;color:var(--dsw-alias-label-primary);background:0 0;border:0;border-radius:8px;flex:none;align-items:center;padding:0;font-size:13px;font-weight:500;line-height:20px;display:inline-flex;position:relative}.oOF3UG_select,.oOF3UG_close{border-radius:inherit;min-height:44px;color:inherit;font:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent;background:0 0;border:0;align-items:center;padding:0;display:inline-flex}.oOF3UG_select{box-sizing:border-box;text-align:start;flex:1;align-self:stretch;gap:6px;min-width:44px;padding-inline-start:8px}.oOF3UG_close{width:28px;color:var(--dsw-alias-label-secondary);flex:0 0 28px;justify-content:center}.oOF3UG_close:active{color:var(--dsw-alias-label-primary)}.oOF3UG_shortcut:before{content:"";z-index:-1;box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l2);border-radius:inherit;background:var(--dsw-alias-bg-module-platform);box-shadow:inset 0 .5px 0 color-mix(in srgb, var(--dsw-alias-bg-layer-1) 65%, transparent), 0 1px 3px color-mix(in srgb, var(--dsw-alias-label-primary) 5%, transparent);pointer-events:none;position:absolute;inset:6px 0}.oOF3UG_shortcut[data-active]:before{border-width:1px;border-color:color-mix(in srgb, var(--dsw-alias-label-primary) 34%, var(--dsw-alias-border-l2));background:color-mix(in srgb, var(--dsw-alias-bg-module-platform) 90%, var(--dsw-alias-label-primary))}.oOF3UG_shortcut:active:before{background:var(--dsw-alias-button-ghost-active-fill)}@supports (backdrop-filter:blur(8px)){.oOF3UG_shortcut:before{background:color-mix(in srgb, var(--dsw-alias-bg-module-platform) 64%, transparent);backdrop-filter:blur(8px)saturate(115%)}.oOF3UG_shortcut[data-active]:before{background:color-mix(in srgb, color-mix(in srgb, var(--dsw-alias-bg-module-platform) 90%, var(--dsw-alias-label-primary)) 82%, transparent)}.oOF3UG_shortcut:active:before{background:color-mix(in srgb, var(--dsw-alias-button-ghost-active-fill) 82%, transparent)}}.oOF3UG_select:focus-visible,.oOF3UG_close:focus-visible{outline:none}@media (hover:hover) and (pointer:fine){.oOF3UG_select:focus-visible,.oOF3UG_close:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}}.oOF3UG_identity{flex:0 0 14px;justify-content:center;align-items:center;width:14px;height:14px;display:inline-flex}.oOF3UG_identity:has([data-role-avatar]){flex:0 0 22px;width:22px;height:22px}.oOF3UG_title{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.oOF3UG_activity{flex:none;justify-content:center;align-items:center;display:inline-flex}@media (prefers-reduced-transparency:reduce),(prefers-contrast:more){.oOF3UG_shortcut:before,.oOF3UG_shortcut[data-active]:before{border-color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-module-platform);backdrop-filter:none;box-shadow:none}.oOF3UG_shortcut[data-active]:before{border-width:1px;border-color:var(--dsw-alias-label-primary)}.oOF3UG_shortcut:active:before{background:var(--dsw-alias-button-ghost-active-fill)}}@media (forced-colors:active){.oOF3UG_shortcut{color:buttontext}.oOF3UG_shortcut:before{backdrop-filter:none;box-shadow:none;background:buttonface;border:1px solid buttontext}.oOF3UG_shortcut[data-active],.oOF3UG_shortcut:active{color:highlighttext}.oOF3UG_shortcut[data-active]:before,.oOF3UG_shortcut:active:before{background:highlight;border-color:highlight}.oOF3UG_close,.oOF3UG_close:active{color:inherit}.oOF3UG_select:focus-visible,.oOF3UG_close:focus-visible{outline-color:highlight}.oOF3UG_shortcut[data-active] .oOF3UG_select:focus-visible,.oOF3UG_shortcut[data-active] .oOF3UG_close:focus-visible{outline-color:highlighttext}}`,document.head.appendChild(e)}var pg={activity:`oOF3UG_activity`,close:`oOF3UG_close`,identity:`oOF3UG_identity`,select:`oOF3UG_select`,shortcut:`oOF3UG_shortcut`,title:`oOF3UG_title`};function mg({visit:e,summary:t,identity:n,activityLabel:i,activity:a,active:c,closeLabel:l,closeHint:u,open:d,close:f,restoreNavigationFocus:p}){let m=(0,s.useRef)(null),h=(0,s.useCallback)(e=>{e===null&&m.current?.contains(document.activeElement)&&p(),m.current=e},[p]);return/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:h,className:pg.shortcut,"data-active":c||void 0,onMouseDown:e=>{e.button===1&&e.target instanceof Node&&e.currentTarget.contains(e.target)&&e.preventDefault()},onAuxClick:t=>{t.button===1&&t.target instanceof Node&&t.currentTarget.contains(t.target)&&(t.preventDefault(),t.stopPropagation(),p(),f(e.sessionId))},children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:pg.select,onMouseDown:e=>e.preventDefault(),title:t.displayTitle,"aria-current":c?`page`:void 0,"aria-label":[t.displayTitle,t.id,i].filter(Boolean).join(` · `),onClick:()=>{c||(p(),d(e.target))},children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:pg.identity,children:n}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:pg.title,children:t.displayTitle}),a!=null&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:pg.activity,title:i,children:a})]}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:pg.close,onMouseDown:e=>e.preventDefault(),"aria-label":l,title:u,onClick:()=>{p(),f(e.sessionId)},children:/* @__PURE__ */ (0,o.jsx)(r.IconCloseOutlineRegular,{size:12})})]})}let hg=`@deepseek-ai/dsh-client-ui-workspace/Rows.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(hg)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=hg,e.textContent=`._5OaiBG_hostBadge{--ch-peer-dot-color:#3b82f6;letter-spacing:.01em;min-width:0;max-width:88px;height:18px;color:color-mix(in srgb, var(--dsw-alias-label-secondary) 60%, var(--dsw-alias-label-tertiary));background:0 0;border:none;flex-shrink:0;align-items:center;gap:4.5px;margin-left:4px;padding:0;font-size:11px;font-weight:500;line-height:16px;display:inline-flex;overflow:hidden}._5OaiBG_hostBadgeSession{gap:4px;max-width:74px;height:16px;margin-left:2px;font-size:10.5px}._5OaiBG_hostBadge[data-color=blue],._5OaiBG_hoverHostDot[data-color=blue],._5OaiBG_remoteFolderGlobe[data-color=blue]{--ch-peer-dot-color:#3b76cc}._5OaiBG_hostBadge[data-color=purple],._5OaiBG_hoverHostDot[data-color=purple],._5OaiBG_remoteFolderGlobe[data-color=purple]{--ch-peer-dot-color:#7460cc}._5OaiBG_hostBadge[data-color=cyan],._5OaiBG_hoverHostDot[data-color=cyan],._5OaiBG_remoteFolderGlobe[data-color=cyan]{--ch-peer-dot-color:#0e8fa8}._5OaiBG_hostBadge[data-color=green],._5OaiBG_hoverHostDot[data-color=green],._5OaiBG_remoteFolderGlobe[data-color=green]{--ch-peer-dot-color:#2f8c70}._5OaiBG_hostBadge[data-color=amber],._5OaiBG_hoverHostDot[data-color=amber],._5OaiBG_remoteFolderGlobe[data-color=amber]{--ch-peer-dot-color:#c27803}._5OaiBG_hostBadge[data-color=rose],._5OaiBG_hoverHostDot[data-color=rose],._5OaiBG_remoteFolderGlobe[data-color=rose]{--ch-peer-dot-color:#c94a6a}._5OaiBG_hostBadge[data-color=slate],._5OaiBG_hoverHostDot[data-color=slate],._5OaiBG_remoteFolderGlobe[data-color=slate]{--ch-peer-dot-color:#64748b}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hoverHostDot,._5OaiBG_remoteFolderGlobe)[data-color=blue]{--ch-peer-dot-color:#7bb0f8}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hoverHostDot,._5OaiBG_remoteFolderGlobe)[data-color=purple]{--ch-peer-dot-color:#a899f2}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hoverHostDot,._5OaiBG_remoteFolderGlobe)[data-color=cyan]{--ch-peer-dot-color:#63c5da}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hoverHostDot,._5OaiBG_remoteFolderGlobe)[data-color=green]{--ch-peer-dot-color:#6ec4a7}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hoverHostDot,._5OaiBG_remoteFolderGlobe)[data-color=amber]{--ch-peer-dot-color:#e0ae58}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hoverHostDot,._5OaiBG_remoteFolderGlobe)[data-color=rose]{--ch-peer-dot-color:#e08298}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hoverHostDot,._5OaiBG_remoteFolderGlobe)[data-color=slate]{--ch-peer-dot-color:#94a3b8}._5OaiBG_hostBadge[data-state=connecting]{color:color-mix(in srgb, var(--dsw-alias-state-warning-primary,var(--dsw-alias-state-warn-primary,#d97706)) 78%, var(--dsw-alias-label-secondary))}._5OaiBG_hostBadge:is([data-state=disconnected],[data-state=offline],[data-state=auth-error]){color:var(--dsw-alias-label-tertiary);opacity:.72}._5OaiBG_hostLabel{text-overflow:ellipsis;white-space:nowrap;flex:auto;min-width:0;overflow:hidden}._5OaiBG_hostDot{background:var(--dsw-alias-label-tertiary);opacity:.45;border-radius:50%;flex-shrink:0;width:5px;height:5px}._5OaiBG_hostBadge[data-state=connected] ._5OaiBG_hostDot{background:var(--ch-peer-dot-color);opacity:.95}._5OaiBG_hostBadge[data-state=connecting] ._5OaiBG_hostDot{background:var(--dsw-alias-state-warning-primary,var(--dsw-alias-state-warn-primary,#d97706));opacity:.9;animation:1.6s ease-in-out infinite _5OaiBG_hostDotPulse}@keyframes _5OaiBG_hostDotPulse{0%,to{opacity:.95}50%{opacity:.35}}@media (prefers-reduced-motion:reduce){._5OaiBG_hostBadge[data-state=connecting] ._5OaiBG_hostDot,._5OaiBG_remoteHostStatusDot[data-state=connecting]{animation:none}}._5OaiBG_remoteFolderGlobe{--ch-peer-dot-color:#3b76cc;background:var(--dsh-row-surface);width:11px;height:11px;color:var(--ch-peer-dot-color);pointer-events:none;border-radius:50%;justify-content:center;align-items:center;display:inline-flex;position:absolute;bottom:0;right:-3px}._5OaiBG_remoteSessionGlobe{z-index:1;width:10px;height:10px;bottom:0;right:-4px}._5OaiBG_remoteSessionGlobe svg{width:9px;height:9px}._5OaiBG_remoteFolderGlobe:is([data-state=disconnected],[data-state=offline],[data-state=auth-error]){opacity:.6}._5OaiBG_remoteHostText{flex:1;align-items:baseline;gap:6px;min-width:0;display:flex;overflow:hidden}._5OaiBG_remoteHostText ._5OaiBG_title{flex:0 auto}._5OaiBG_remoteHostMeta{text-overflow:ellipsis;white-space:nowrap;font-variant-numeric:tabular-nums;max-width:45%;color:var(--dsw-alias-label-tertiary);flex:none;font-size:12px;line-height:16px;overflow:hidden}._5OaiBG_remoteHostStatusDot{background:var(--dsw-alias-label-tertiary);opacity:.45;border-radius:50%;flex:none;width:7px;height:7px;margin-inline:auto 4px}._5OaiBG_remoteHostStatusDot[data-state=connected]{background:var(--dsw-alias-state-success-primary,#22c55e);opacity:1}._5OaiBG_remoteHostStatusDot[data-state=connecting]{background:var(--dsw-alias-state-warning-primary,var(--dsw-alias-state-warn-primary,#d97706));opacity:.95;animation:1.6s ease-in-out infinite _5OaiBG_hostDotPulse}._5OaiBG_hoverHost{color:#cfd3d6;align-items:center;gap:6px;font-size:12px;line-height:16px;display:flex}._5OaiBG_hoverHostDot{--ch-peer-dot-color:#7bb0f8;opacity:.55;background:#94a3b8;border-radius:50%;flex:none;width:6px;height:6px}._5OaiBG_hoverHostDot[data-state=connected]{background:var(--ch-peer-dot-color);opacity:.95}._5OaiBG_hoverHostDot[data-state=connecting]{opacity:.9;background:#e0ae58}._5OaiBG_projectRow,._5OaiBG_sessionRow{--dsh-row-surface:var(--dsw-specific-sidebar-fill);border-radius:var(--dsw-radius-md);padding:0 8px;cursor:pointer;-webkit-tap-highlight-color:transparent;user-select:none;color:var(--dsw-alias-label-primary);align-items:center;gap:6px;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px));display:flex;position:relative}._5OaiBG_projectRow:is(:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen),._5OaiBG_sessionRow:is(:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 4%, var(--dsw-specific-sidebar-fill));background:var(--dsh-row-surface)}._5OaiBG_sessionRow._5OaiBG_selected{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, var(--dsw-specific-sidebar-fill));background:var(--dsh-row-surface)}._5OaiBG_sessionRow._5OaiBG_selected:is(:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, var(--dsw-specific-sidebar-fill))}@media (hover:hover){._5OaiBG_projectRow:hover,._5OaiBG_sessionRow:hover{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 4%, var(--dsw-specific-sidebar-fill));background:var(--dsh-row-surface)}._5OaiBG_sessionRow._5OaiBG_selected:hover{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, var(--dsw-specific-sidebar-fill))}}._5OaiBG_sessionRow,._5OaiBG_searchResultRow{--ch-sidebar-text-primary:#1a1c1f;letter-spacing:normal;color:color-mix(in oklab, var(--ch-sidebar-text-primary) 85%, transparent);font-family:-apple-system,"system-ui",Segoe UI,sans-serif;font-size:14px;font-weight:430;line-height:20px}body[data-ds-dark-theme] ._5OaiBG_sessionRow,body[data-ds-dark-theme] ._5OaiBG_searchResultRow{--ch-sidebar-text-primary:#fff}._5OaiBG_projectRow:focus-visible,._5OaiBG_sessionRow:focus-visible,._5OaiBG_searchResultRow:focus-visible,._5OaiBG_iconButton:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}._5OaiBG_searchResultRow{box-sizing:border-box;border-radius:var(--dsw-radius-lg);cursor:pointer;text-align:left;background:0 0;border:none;flex-direction:column;align-items:stretch;width:100%;min-height:48px;padding:4px 8px;display:flex}._5OaiBG_searchResultRow:hover,._5OaiBG_searchResultRow._5OaiBG_selected{background:var(--dsw-alias-interactive-bg-hover)}._5OaiBG_searchResultHeading{align-items:center;gap:4px;min-width:0;display:flex}._5OaiBG_searchResultTitle{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;margin-left:4px;font-size:14px;line-height:20px;overflow:hidden}._5OaiBG_searchResultMeta{align-items:center;gap:6px;min-width:0;margin-left:20px;display:flex}._5OaiBG_searchResultWorkspace,._5OaiBG_searchResultSnippet{text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:17px;overflow:hidden}._5OaiBG_searchResultWorkspace{max-width:40%;color:var(--dsw-alias-label-tertiary);flex:none}._5OaiBG_searchResultWorkspace:only-child{max-width:100%}._5OaiBG_searchResultSnippet{min-width:0;color:var(--dsw-alias-label-secondary);flex:1}._5OaiBG_projectRow{box-sizing:border-box;align-items:center;height:34px}._5OaiBG_sessionRow{box-sizing:border-box;min-width:0;max-width:100%;flex-direction:column;align-items:stretch;gap:0;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px) + var(--dsh-thread-indent,0px))}._5OaiBG_sessionMain{min-width:0;height:var(--dsh-thread-row-height);flex:none;align-items:center;display:flex;position:relative}._5OaiBG_identityButton{appearance:none;cursor:pointer;background:0 0;border:0;border-radius:4px;padding:0}._5OaiBG_identityButton:after{content:"";position:absolute;inset:-6px -4px -6px -8px}@media (hover:none),(pointer:coarse){._5OaiBG_sessionRow:not(:has(>[data-thread-summary])) ._5OaiBG_identityButton:after{inset:-12px -6px -12px -8px}}._5OaiBG_foldChevron{justify-content:center;align-items:center;display:none;position:absolute;inset:0}._5OaiBG_foldChevron:before{content:"";border-bottom:1.5px solid;border-right:1.5px solid;width:6px;height:6px;transform:translate(-1px)rotate(-45deg)}._5OaiBG_identityButton[aria-expanded=true] ._5OaiBG_foldChevron:before{transform:translateY(-1px)rotate(45deg)}._5OaiBG_identityButton[aria-expanded=true]>:not(._5OaiBG_foldChevron){visibility:hidden}._5OaiBG_identityButton[aria-expanded=true] ._5OaiBG_foldChevron{color:var(--dsw-alias-label-secondary,currentColor);display:flex}@media (hover:hover) and (pointer:fine){._5OaiBG_identityButton:hover>:not(._5OaiBG_foldChevron),._5OaiBG_identityButton:focus-visible>:not(._5OaiBG_foldChevron){visibility:hidden}._5OaiBG_identityButton:hover ._5OaiBG_foldChevron,._5OaiBG_identityButton:focus-visible ._5OaiBG_foldChevron{color:var(--dsw-alias-text-secondary,currentColor);display:flex}}._5OaiBG_identityButton:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}._5OaiBG_sessionRow ._5OaiBG_title{margin:0 6px 0 4px}._5OaiBG_slot{width:16px;height:20px;color:var(--dsw-alias-label-tertiary);flex:none;justify-content:center;align-items:center;display:inline-flex;position:relative}._5OaiBG_slot:has([data-harness-id]),._5OaiBG_slot:has([data-role-avatar]){width:14px;color:inherit}._5OaiBG_sessionRow:has([data-harness-id]) ._5OaiBG_title,._5OaiBG_searchResultHeading:has([data-harness-id]) ._5OaiBG_searchResultTitle{margin-left:8px}._5OaiBG_sessionRow:has([data-role-avatar]) ._5OaiBG_title,._5OaiBG_searchResultHeading:has([data-role-avatar]) ._5OaiBG_searchResultTitle{margin-left:10px}._5OaiBG_sessionRow:has([data-role-badge]) ._5OaiBG_title{margin-left:5px}._5OaiBG_sessionRow:has([data-group-prefix]) ._5OaiBG_title{margin-left:4px}._5OaiBG_statusOverlay{display:contents}._5OaiBG_slot:has([data-harness-id]) ._5OaiBG_statusOverlay,._5OaiBG_slot:has([data-role-avatar]) ._5OaiBG_statusOverlay{transform-origin:100% 100%;display:inline-flex;position:absolute;bottom:-3px;right:-3px;transform:scale(.65)}._5OaiBG_slot:has([data-role-avatar]) ._5OaiBG_statusOverlay{bottom:-3px;right:-5px}._5OaiBG_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}._5OaiBG_projectRow>._5OaiBG_slot:not(._5OaiBG_folderExpanded){color:color-mix(in srgb, currentColor 86%, transparent);transition:color .14s}._5OaiBG_projectRow:hover>._5OaiBG_slot:not(._5OaiBG_folderExpanded){color:inherit}._5OaiBG_folderExpanded{color:var(--dsw-alias-state-business-primary)}._5OaiBG_projectText{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}._5OaiBG_title{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:14px;line-height:20px;overflow:hidden}._5OaiBG_projectRow ._5OaiBG_projectText>._5OaiBG_title,._5OaiBG_sessionRow ._5OaiBG_title,._5OaiBG_searchResultTitle{--dsh-title-ink-bleed:4px;text-overflow:clip;-webkit-text-size-adjust:100%;text-size-adjust:100%;align-items:center;margin-inline-end:calc(-1 * var(--dsh-title-ink-bleed));padding-inline-end:var(--dsh-title-ink-bleed);display:flex;overflow:clip visible;container-type:inline-size}._5OaiBG_sessionRow ._5OaiBG_title{margin-inline-end:calc(6px - var(--dsh-title-ink-bleed))}._5OaiBG_projectRow ._5OaiBG_projectText>._5OaiBG_title>._5OaiBG_titleText,._5OaiBG_sessionRow ._5OaiBG_title>._5OaiBG_titleText,._5OaiBG_searchResultTitle>._5OaiBG_titleText{box-sizing:content-box;padding:var(--dsh-title-ink-bleed);margin:calc(-1 * var(--dsh-title-ink-bleed));white-space:nowrap;--dsh-title-fade:clamp(0px, ( min(100%, 100cqw + 20px + var(--dsh-title-ink-bleed) * 2) - 100cqw - var(--dsh-title-ink-bleed) * 2 - .5px ) * 48, 20px + var(--dsh-title-ink-bleed));-webkit-mask-image:linear-gradient(to right, #000 calc(100cqw + var(--dsh-title-ink-bleed) * 2 - var(--dsh-title-fade)), transparent calc(100cqw + var(--dsh-title-ink-bleed) * 2 + 20px - var(--dsh-title-fade)));mask-image:linear-gradient(to right, #000 calc(100cqw + var(--dsh-title-ink-bleed) * 2 - var(--dsh-title-fade)), transparent calc(100cqw + var(--dsh-title-ink-bleed) * 2 + 20px - var(--dsh-title-fade)));flex:none}._5OaiBG_renameInput{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-button-elevated-fill);min-width:0;color:inherit;outline:none;padding:0 2px;font-size:14px;line-height:20px}._5OaiBG_sessionRow ._5OaiBG_title{flex:1}._5OaiBG_meta{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:20px;overflow:hidden}._5OaiBG_trailing{flex:none;place-items:center end;display:grid}._5OaiBG_trailing:empty{display:none}._5OaiBG_trailing>*{grid-area:1/1}._5OaiBG_time{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary);flex:none;font-size:10px;line-height:16px}._5OaiBG_timeStatus{justify-content:center;align-items:center;gap:6px;min-width:16px;height:20px;display:inline-flex}._5OaiBG_timeStatus [data-state=done],._5OaiBG_projectActivity [data-state=done]{color:var(--dsw-alias-state-business-primary)}._5OaiBG_projectActivity{flex:none;justify-content:center;align-items:center;min-width:16px;height:20px;display:inline-flex}._5OaiBG_timeStatus ._5OaiBG_visuallyHidden,._5OaiBG_projectActivity ._5OaiBG_visuallyHidden{visibility:visible}._5OaiBG_sessionRow._5OaiBG_archived ._5OaiBG_title,._5OaiBG_searchResultRow._5OaiBG_archived ._5OaiBG_searchResultTitle,._5OaiBG_searchResultRow._5OaiBG_archived ._5OaiBG_searchResultWorkspace,._5OaiBG_searchResultRow._5OaiBG_archived ._5OaiBG_searchResultSnippet{color:var(--dsw-alias-label-caption)}._5OaiBG_sessionRow._5OaiBG_sectionMoving{cursor:progress}._5OaiBG_sessionRow._5OaiBG_sectionMoving ._5OaiBG_sessionMain{opacity:.62}@media (prefers-reduced-motion:no-preference){._5OaiBG_sessionRow._5OaiBG_sectionMoving ._5OaiBG_sessionMain{transition:opacity .12s var(--ds-ease-in-out)}}._5OaiBG_sectionMovingSpinner{color:var(--dsw-alias-label-tertiary)}._5OaiBG_dot{flex:none}._5OaiBG_quickActions{align-items:center;gap:2px;display:inline-flex}._5OaiBG_rowActions{visibility:hidden;pointer-events:none;flex:none;align-items:center;gap:2px;display:inline-flex}._5OaiBG_projectRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen) ._5OaiBG_rowActions,._5OaiBG_sessionRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen) ._5OaiBG_rowActions,._5OaiBG_searchResultRow:is(:hover,:focus-visible,:has(:focus-visible)) ._5OaiBG_rowActions{visibility:visible;pointer-events:auto}._5OaiBG_searchResultHeading ._5OaiBG_rowActions{margin-left:auto}@media (hover:hover) and (pointer:fine){._5OaiBG_sessionRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen) :is(._5OaiBG_time,._5OaiBG_hostBadge),._5OaiBG_projectRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen) :is(._5OaiBG_hostBadge,._5OaiBG_remoteHostStatusDot,._5OaiBG_projectActivity){visibility:hidden}._5OaiBG_projectRow>._5OaiBG_rowActions,._5OaiBG_sessionRow ._5OaiBG_rowActions{inset-inline-end:0;z-index:1;background:var(--dsh-row-surface);border-radius:var(--dsw-radius-sm);position:absolute;top:50%;transform:translateY(-50%)}._5OaiBG_projectRow>._5OaiBG_rowActions{inset-inline-end:8px}._5OaiBG_projectRow>._5OaiBG_rowActions:before,._5OaiBG_sessionRow ._5OaiBG_rowActions:before{content:"";background:linear-gradient(to right, transparent, var(--dsh-row-surface));pointer-events:none;width:12px;position:absolute;inset-block:0;inset-inline-end:100%}}[data-phone-drawer] ._5OaiBG_sessionRow{min-height:44px}[data-phone-drawer] ._5OaiBG_sessionRow:has(>[data-thread-summary]){grid-template-columns:var(--dsh-thread-icon-size,16px) minmax(0, 1fr) auto;grid-template-rows:24px 24px;column-gap:8px;padding-block:2px;display:grid}[data-phone-drawer] ._5OaiBG_sessionRow:has(>[data-thread-summary])>._5OaiBG_hostRail{top:7px}[data-phone-drawer] ._5OaiBG_sessionRow:has(>[data-thread-summary]) ._5OaiBG_sessionMain{display:contents;position:static}[data-phone-drawer] ._5OaiBG_sessionRow:has(>[data-thread-summary]) ._5OaiBG_slot{grid-area:1/1;align-self:center}[data-phone-drawer] ._5OaiBG_sessionRow:has(>[data-thread-summary]) ._5OaiBG_title{margin:0 calc(-1 * var(--dsh-title-ink-bleed)) 0 0;grid-area:1/2;align-self:center}[data-phone-drawer] ._5OaiBG_sessionRow:has(>[data-thread-summary]) ._5OaiBG_trailing{grid-area:1/3/span 2;align-self:center}[data-phone-drawer] ._5OaiBG_sessionRow>[data-thread-summary]{text-overflow:ellipsis;white-space:nowrap;grid-area:2/2;width:100%;margin:0;padding-inline:0;overflow:hidden}._5OaiBG_phoneDetails{padding:8px 8px 16px}._5OaiBG_phoneDetails ._5OaiBG_hoverTitle{display:none}._5OaiBG_phoneDetails :is(._5OaiBG_hoverTitle,._5OaiBG_hoverTime,._5OaiBG_hoverStatus,._5OaiBG_hoverPath){color:inherit}._5OaiBG_sessionRow._5OaiBG_dropBefore,._5OaiBG_sessionRow._5OaiBG_dropAfter{position:relative}._5OaiBG_sessionRow._5OaiBG_dropBefore:before,._5OaiBG_sessionRow._5OaiBG_dropAfter:after{content:"";z-index:1;background:linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat, linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat, linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;pointer-events:none;height:12px;position:absolute;left:0;right:4px}._5OaiBG_sessionRow._5OaiBG_dropBefore:before{top:-7px}._5OaiBG_sessionRow._5OaiBG_dropAfter:after{bottom:-7px}._5OaiBG_hoverContent{flex-direction:column;gap:8px;display:flex}._5OaiBG_hoverTitle{color:#fff;overflow-wrap:break-word;font-size:14px;line-height:20px}._5OaiBG_hoverPath{color:#cfd3d6;word-break:break-all;font-size:12px;line-height:16px}._5OaiBG_hoverTime{color:#cfd3d6;font-size:12px;line-height:16px}._5OaiBG_hoverStatus{color:#adb2b8;align-items:center;gap:8px;font-size:12px;line-height:20px;display:flex}._5OaiBG_hoverArchived svg{flex-shrink:0;margin:0 -4px}._5OaiBG_iconButton{cursor:pointer;-webkit-tap-highlight-color:transparent;width:24px;height:24px;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;border-radius:4px;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}@media (hover:hover){._5OaiBG_iconButton:hover{color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-alias-label-primary) 7%, transparent)}}[data-phone-drawer] :is(._5OaiBG_projectRow,._5OaiBG_sessionRow){--dsh-row-surface:transparent;background:var(--dsh-row-surface)}[data-phone-drawer] :is(._5OaiBG_projectRow,._5OaiBG_sessionRow):is(:active,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 3%, transparent)}[data-phone-drawer] ._5OaiBG_sessionRow._5OaiBG_selected{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}[data-phone-drawer] ._5OaiBG_rowActions,[data-phone-drawer] ._5OaiBG_rowActions:before{background:0 0}[data-phone-drawer] ._5OaiBG_remoteFolderGlobe,body[data-codexhost-wallpaper] ._5OaiBG_remoteFolderGlobe{background:var(--dsw-specific-sidebar-fill)}body[data-codexhost-wallpaper] :is(._5OaiBG_projectRow,._5OaiBG_sessionRow){--dsh-row-surface:transparent}body[data-codexhost-wallpaper] :is(._5OaiBG_projectRow,._5OaiBG_sessionRow):is(:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}body[data-codexhost-wallpaper] ._5OaiBG_sessionRow._5OaiBG_selected{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent)}body[data-codexhost-wallpaper] ._5OaiBG_sessionRow._5OaiBG_selected:is(:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 12%, transparent)}@media (hover:hover){body[data-codexhost-wallpaper] :is(._5OaiBG_projectRow,._5OaiBG_sessionRow):hover{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}body[data-codexhost-wallpaper] ._5OaiBG_sessionRow._5OaiBG_selected:hover{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 12%, transparent)}}@media (hover:hover) and (pointer:fine){body[data-codexhost-wallpaper] :is(._5OaiBG_projectRow>._5OaiBG_rowActions,._5OaiBG_sessionRow ._5OaiBG_rowActions){background:color-mix(in srgb, var(--dsw-specific-sidebar-fill) 82%, transparent)}body[data-codexhost-wallpaper] :is(._5OaiBG_projectRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen)>._5OaiBG_rowActions,._5OaiBG_sessionRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen) ._5OaiBG_rowActions){backdrop-filter:blur(10px)}body[data-codexhost-wallpaper] :is(){display:none}}[data-phone-drawer] ._5OaiBG_iconButton{width:44px;height:44px;color:var(--dsw-alias-label-tertiary);background:0 0}[data-phone-drawer] ._5OaiBG_iconButton:active{color:var(--dsw-alias-label-primary)}@media (hover:none),(pointer:coarse){._5OaiBG_projectRow,._5OaiBG_sessionRow{min-height:44px}._5OaiBG_rowActions{visibility:visible;pointer-events:auto}._5OaiBG_sessionRow ._5OaiBG_quickActions{display:none}._5OaiBG_sessionRow ._5OaiBG_trailing{align-items:center;gap:4px;display:flex}._5OaiBG_sessionRow ._5OaiBG_time:not(._5OaiBG_timeStatus){display:none}._5OaiBG_sessionRow ._5OaiBG_timeStatus{visibility:visible;padding-inline-end:0}._5OaiBG_iconButton{width:44px;height:44px}}`,document.head.appendChild(e)}var J={archived:`_5OaiBG_archived`,dot:`_5OaiBG_dot`,dropAfter:`_5OaiBG_dropAfter`,dropBefore:`_5OaiBG_dropBefore`,foldChevron:`_5OaiBG_foldChevron`,folderExpanded:`_5OaiBG_folderExpanded`,hostBadge:`_5OaiBG_hostBadge`,hostBadgeSession:`_5OaiBG_hostBadgeSession`,hostDot:`_5OaiBG_hostDot`,hostDotPulse:`_5OaiBG_hostDotPulse`,hostLabel:`_5OaiBG_hostLabel`,hostRail:`_5OaiBG_hostRail`,hoverArchived:`_5OaiBG_hoverArchived`,hoverContent:`_5OaiBG_hoverContent`,hoverHost:`_5OaiBG_hoverHost`,hoverHostDot:`_5OaiBG_hoverHostDot`,hoverPath:`_5OaiBG_hoverPath`,hoverStatus:`_5OaiBG_hoverStatus`,hoverTime:`_5OaiBG_hoverTime`,hoverTitle:`_5OaiBG_hoverTitle`,iconButton:`_5OaiBG_iconButton`,identityButton:`_5OaiBG_identityButton`,menuOpen:`_5OaiBG_menuOpen`,meta:`_5OaiBG_meta`,phoneDetails:`_5OaiBG_phoneDetails`,projectActivity:`_5OaiBG_projectActivity`,projectRow:`_5OaiBG_projectRow`,projectText:`_5OaiBG_projectText`,quickActions:`_5OaiBG_quickActions`,remoteFolderGlobe:`_5OaiBG_remoteFolderGlobe`,remoteHostMeta:`_5OaiBG_remoteHostMeta`,remoteHostStatusDot:`_5OaiBG_remoteHostStatusDot`,remoteHostText:`_5OaiBG_remoteHostText`,remoteSessionGlobe:`_5OaiBG_remoteSessionGlobe`,renameInput:`_5OaiBG_renameInput`,rowActions:`_5OaiBG_rowActions`,searchResultHeading:`_5OaiBG_searchResultHeading`,searchResultMeta:`_5OaiBG_searchResultMeta`,searchResultRow:`_5OaiBG_searchResultRow`,searchResultSnippet:`_5OaiBG_searchResultSnippet`,searchResultTitle:`_5OaiBG_searchResultTitle`,searchResultWorkspace:`_5OaiBG_searchResultWorkspace`,sectionMoving:`_5OaiBG_sectionMoving`,sectionMovingSpinner:`_5OaiBG_sectionMovingSpinner`,selected:`_5OaiBG_selected`,sessionMain:`_5OaiBG_sessionMain`,sessionRow:`_5OaiBG_sessionRow`,slot:`_5OaiBG_slot`,statusOverlay:`_5OaiBG_statusOverlay`,time:`_5OaiBG_time`,timeStatus:`_5OaiBG_timeStatus`,title:`_5OaiBG_title`,titleText:`_5OaiBG_titleText`,trailing:`_5OaiBG_trailing`,visuallyHidden:`_5OaiBG_visuallyHidden`};function gg(e,t){let n=e.runningSubagentCount===0?void 0:{state:`ongoing`,label:t(e.runningSubagentCount===1?`status.subagentsRunning.one`:`status.subagentsRunning.other`,{n:e.runningSubagentCount})},r;switch(e.pendingInteraction){case`approval`:r={state:`warning`,label:t(`status.waitingApproval`),trailingLabel:t(`status.compact.approval`)};break;case`plan-review`:r={state:`warning`,label:t(`status.planReview`),trailingLabel:t(`status.compact.planReview`)};break;case`question`:r={state:`warning`,label:t(`status.waitingAnswer`),trailingLabel:t(`status.compact.answer`)};break;case void 0:break;default:return _g(e.pendingInteraction)}if(r!==void 0)return n===void 0?[r]:[r,n];if(e.running){let e={state:`ongoing`,label:t(`status.running`)};return n===void 0?[e]:[e,n]}return n===void 0?e.completed?[{state:`done`,label:t(`status.completed`)}]:[{state:`idle`,label:t(`status.idle`)}]:[n]}function _g(e){throw Error(`unknown pending interaction: ${String(e)}`)}function vg({statuses:e}){return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.StateDot,{state:e[0].state,size:e[0].state===`ongoing`?16:void 0}),e.map(e=>/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.visuallyHidden,children:e.label},e.label))]})}let yg=`@deepseek-ai/dsh-client-ui-workspace/RecentNavigation.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(yg)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=yg,e.textContent=`.qXmkFa_trigger,.qXmkFa_shortcuts{display:none}[data-phone] .qXmkFa_trigger{width:auto;height:auto;color:var(--dsw-alias-label-secondary);cursor:pointer;-webkit-tap-highlight-color:transparent;-webkit-app-region:no-drag;-webkit-tap-highlight-color:transparent;background:0 0;border:0;border-radius:0;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex;position:relative}[data-phone] .qXmkFa_trigger:after{content:"";position:absolute;inset:-12px -10px}[data-phone] .qXmkFa_trigger>svg{transition:transform .18s;display:block}.qXmkFa_trigger[aria-disabled=true]{cursor:wait}.qXmkFa_trigger:focus-visible{outline:none}.qXmkFa_expanded{transform:rotate(180deg)}@media (prefers-reduced-motion:reduce){[data-phone] .qXmkFa_trigger>svg{transition:none}}[data-phone] .qXmkFa_shortcuts{overflow-anchor:none;scroll-behavior:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;scrollbar-width:none;-webkit-app-region:no-drag;grid-column:1/-1;gap:6px;min-width:0;min-height:44px;margin-inline:-12px -20px;padding-inline-end:16px;scroll-padding-inline:8px 20px;display:flex;overflow-x:auto}.qXmkFa_clear{min-width:44px;min-height:44px;color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent;background:0 0;border:0;border-radius:8px;flex:none;align-self:center;padding:0 6px;font-size:12px}.qXmkFa_clear:active{background:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent)}.qXmkFa_clear:focus-visible{outline:none}@media (hover:hover) and (pointer:fine){.qXmkFa_clear:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}}.qXmkFa_shortcuts::-webkit-scrollbar{width:0;height:0;display:none}`,document.head.appendChild(e)}var bg={clear:`qXmkFa_clear`,expanded:`qXmkFa_expanded`,shortcuts:`qXmkFa_shortcuts`,trigger:`qXmkFa_trigger`};function xg({useVisits:e,useSessions:t,useWorkspaces:n,useSessionStatus:r,t:i}){let a=e(e=>e),o=t(e=>e),s=n(e=>e.archivedSessionIds),c=r(e=>e);return a.flatMap(e=>{let t=o.byId[e.sessionId];return t===void 0||t.blank||s.includes(e.sessionId)?[]:[{visit:e,summary:t,statuses:gg(_h(t,o,c),i)}]})}function Sg(e){let{useRecentNavigationSettings:t,open:n,close:i,closeAll:a,viewport:c,restoreNavigationFocus:l,renderSlot:u,t:d}=e,f=t(e=>e.value?.showRecentVisits??!0),p=xg(e),m=f&&p.length>0,h=(0,s.useRef)(null),[g,_]=(0,s.useState)(!1),v=(0,s.useCallback)((e=h.current)=>{e?.isConnected&&e.clientWidth>0&&(c.scrollLeft=Math.max(0,Math.min(e.scrollLeft,e.scrollWidth-e.clientWidth)))},[c]);return(0,s.useLayoutEffect)(()=>{let e=h.current;if(e===null)return;e.scrollLeft=c.scrollLeft;let t=e.clientWidth,n=new ResizeObserver(()=>{e.clientWidth!==t&&(t=e.clientWidth,e.scrollLeft=c.scrollLeft)});return n.observe(e),()=>{v(e),n.disconnect()}},[m,c,v]),m?/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsxs)(`nav`,{ref:h,className:bg.shortcuts,"aria-label":d(`recent.navigation`),onScroll:e=>v(e.currentTarget),children:[p.map(({visit:t,summary:r,statuses:a})=>/* @__PURE__ */ (0,o.jsx)(mg,{visit:t,summary:r,identity:u(`workspace.recent.shortcut.identity`,{sessionId:t.sessionId}),activityLabel:a[0].state===`idle`?void 0:a.map(e=>e.label).join(` · `),activity:a[0].state===`idle`?null:/* @__PURE__ */ (0,o.jsx)(vg,{statuses:a}),active:e.sessionId===t.sessionId,closeLabel:d(`recent.close`,{name:r.displayTitle}),closeHint:d(`recent.closeHint`),open:e=>{v(),n(e)},close:e=>{v();try{i(e)}catch{_(!0)}},restoreNavigationFocus:l},t.sessionId)),p.length>=3&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:bg.clear,"aria-label":d(`recent.clearAll`),title:d(`recent.clearAllHint`),onMouseDown:e=>e.preventDefault(),onClick:()=>{l();try{a()}catch{_(!0)}},children:d(`recent.clear`)})]}),g&&/* @__PURE__ */ (0,o.jsx)(r.Toast,{text:d(`recent.closeFailed`),onDone:()=>_(!1)})]}):null}function Cg(e){let{useRecentNavigationSettings:t,setEnabled:n,t:i}=e,a=t(e=>e.value?.showRecentVisits??!0),c=xg(e),[l,u]=(0,s.useState)(!1),[d,f]=(0,s.useState)(!1),p=(0,s.useRef)(!1);return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[c.length>0&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,"data-navigation-focus-return":!0,className:bg.trigger,"aria-label":i(a?`recent.collapse`:`recent.expand`),"aria-expanded":a,"aria-disabled":l||void 0,"aria-busy":l||void 0,onClick:()=>{p.current||(p.current=!0,u(!0),f(!1),n(!a).then(e=>f(!e)).catch(()=>f(!0)).finally(()=>{p.current=!1,u(!1)}))},children:/* @__PURE__ */ (0,o.jsx)(r.IconChevronDownOutlineRegular,{size:14,className:a?bg.expanded:void 0})}),d&&/* @__PURE__ */ (0,o.jsx)(r.Toast,{text:i(`recent.settings.error`),onDone:()=>f(!1)})]})}function wg(e){return e==null}function Tg(e){return e&&typeof e==`object`&&!Array.isArray(e)}function Eg(e,t){return Object.fromEntries(Object.entries(e).filter(([e,n])=>t(e,n)))}function Dg(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n,e)]))}function Og(e,t,n){if(!t)return{...e};let r={};for(let i of t)(n||e[i]!==void 0)&&(r[i]=e[i]);return r}let kg=Symbol.for(`cosmokit.volatile.write`);function Ag(e,t=/* @__PURE__ */ new Set){if(typeof e==`function`)throw TypeError(`volatile config cannot contain functions`);if(typeof e!=`object`||!e)return e;if(t.has(e))throw TypeError(`volatile config cannot contain cycles`);t.add(e);try{if(Array.isArray(e))return Object.freeze(e.map(e=>Ag(e,t)));if(Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw TypeError(`volatile config objects must be plain objects or arrays`);return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,n])=>[e,Ag(n,t)])))}finally{t.delete(e)}}function jg(e){let t=Ag(e);return Object.freeze({get:()=>t,[kg]:e=>{t=e}})}function Mg(e){return typeof e==`object`&&!!e&&kg in e}function Ng(e,t){return arguments.length===1?t=>Ng(e,t):e in globalThis&&t instanceof globalThis[e]||Object.prototype.toString.call(t).slice(8,-1)===e}function Pg(e){return Ng(`ArrayBuffer`,e)||Ng(`SharedArrayBuffer`,e)}function Fg(e){return Pg(e)||ArrayBuffer.isView(e)}let Ig;(function(e){e.is=Pg,e.isSource=Fg;function t(e){return ArrayBuffer.isView(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e}e.fromSource=t;function n(e){if(e=t(e),typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let n=``,r=new Uint8Array(e);for(let e=0;e<r.byteLength;e++)n+=String.fromCharCode(r[e]);return btoa(n)}e.toBase64=n;function r(e){return typeof Buffer<`u`?t(Buffer.from(e,`base64`)):Uint8Array.from(atob(e),e=>e.charCodeAt(0))}e.fromBase64=r;function i(e){return e=t(e),typeof Buffer<`u`?Buffer.from(e).toString(`hex`):Array.from(new Uint8Array(e),e=>e.toString(16).padStart(2,`0`)).join(``)}e.toHex=i;function a(e){if(typeof Buffer<`u`)return t(Buffer.from(e,`hex`));let n=e.length%2==0?e:e.slice(0,e.length-1),r=[];for(let e=0;e<n.length;e+=2)r.push(parseInt(`${n[e]}${n[e+1]}`,16));return Uint8Array.from(r).buffer}e.fromHex=a})(Ig||={}),Ig.fromBase64,Ig.toBase64,Ig.fromHex,Ig.toHex;function Lg(e,t=/* @__PURE__ */ new Map){if(!e||typeof e!=`object`)return e;if(Ng(`Date`,e))return new Date(e.valueOf());if(Ng(`RegExp`,e))return new RegExp(e.source,e.flags);if(Pg(e))return e.slice(0);if(ArrayBuffer.isView(e))return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);let n=t.get(e);if(n)return n;if(Array.isArray(e)){let n=[];return t.set(e,n),e.forEach((e,r)=>{n[r]=Reflect.apply(Lg,null,[e,t])}),n}let r=Object.create(Object.getPrototypeOf(e));t.set(e,r);for(let n of Reflect.ownKeys(e)){let i={...Reflect.getOwnPropertyDescriptor(e,n)};`value`in i&&(i.value=Reflect.apply(Lg,null,[i.value,t])),Reflect.defineProperty(r,n,i)}return r}function Rg(e,t,n){let r=/* @__PURE__ */ new Set;function i(e,t){if(e===t)return!0;if(Mg(e)||Mg(t))return Mg(e)&&Mg(t);if(!n&&wg(e)&&wg(t))return!0;if(typeof e!=typeof t||typeof e!=`object`||!e||!t||r.has(e))return!1;function a(n,r){return n(e)?n(t)?r(e,t):!1:!n(t)&&void 0}r.add(e);try{return a(Array.isArray,(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!i(e[n],t[n]))return!1;return!0})??a(Ng(`Date`),(e,t)=>e.valueOf()===t.valueOf())??a(Ng(`URL`),(e,t)=>e.href===t.href)??a(Ng(`RegExp`),(e,t)=>e.source===t.source&&e.flags===t.flags)??a(Pg,(e,t)=>{if(e.byteLength!==t.byteLength)return!1;let n=new Uint8Array(e),r=new Uint8Array(t);for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0})??((!n||[e,t].every(e=>Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null))&&Object.keys({...e,...t}).every(n=>i(e[n],t[n])))}finally{r.delete(e)}}return i(e,t)}let zg;(function(e){e.millisecond=1;let t=e.second=1e3,n=e.minute=t*60,r=e.hour=n*60,i=e.day=r*24,a=e.week=i*7,o=(/* @__PURE__ */ new Date()).getTimezoneOffset();function s(e){o=e}e.setTimezoneOffset=s;function c(){return o}e.getTimezoneOffset=c;function l(e=/* @__PURE__ */ new Date,t){return typeof e==`number`&&(e=new Date(e)),t===void 0&&(t=o),Math.floor((e.valueOf()/n-t)/1440)}e.getDateNumber=l;function u(e,t){let r=new Date(e*i);return t===void 0&&(t=o),new Date(+r+t*n)}e.fromDateNumber=u;let d=RegExp(`^${[`w(?:eek(?:s)?)?`,`d(?:ay(?:s)?)?`,`h(?:our(?:s)?)?`,`m(?:in(?:ute)?(?:s)?)?`,`s(?:ec(?:ond)?(?:s)?)?`].map(e=>`(\\d+(?:\\.\\d+)?${e})?`).join(``)}$`);function f(e){let o=d.exec(e);return o?(parseFloat(o[1])*a||0)+(parseFloat(o[2])*i||0)+(parseFloat(o[3])*r||0)+(parseFloat(o[4])*n||0)+(parseFloat(o[5])*t||0):0}e.parseTime=f;function p(e){let t=f(e);return t?e=Date.now()+t:/^\d{1,2}(:\d{1,2}){1,2}$/.test(e)?e=`${(/* @__PURE__ */ new Date()).toLocaleDateString()}-${e}`:/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(e)&&(e=`${(/* @__PURE__ */ new Date()).getFullYear()}-${e}`),e?new Date(e):/* @__PURE__ */ new Date}e.parseDate=p;function m(e){let a=Math.abs(e);return a>=i-r/2?Math.round(e/i)+`d`:a>=r-n/2?Math.round(e/r)+`h`:a>=n-t/2?Math.round(e/n)+`m`:a>=t?Math.round(e/t)+`s`:e+`ms`}e.format=m;function h(e,t=2){return e.toString().padStart(t,`0`)}e.toDigits=h;function g(e,t=/* @__PURE__ */ new Date){return e.replace(`yyyy`,t.getFullYear().toString()).replace(`yy`,t.getFullYear().toString().slice(2)).replace(`MM`,h(t.getMonth()+1)).replace(`dd`,h(t.getDate())).replace(`hh`,h(t.getHours())).replace(`mm`,h(t.getMinutes())).replace(`ss`,h(t.getSeconds())).replace(`SSS`,h(t.getMilliseconds(),3))}e.template=g})(zg||={});let Bg=Symbol.for(`schemastery`),Vg=Symbol.for(`ValidationError`);globalThis.__schemastery_index__??=0,globalThis.__schemastery_refs__=void 0;var Hg=class extends TypeError{options;name=`ValidationError`;constructor(e,t){let n=`$`;for(let e of t.path||[])typeof e==`string`?n+=`.`+e:typeof e==`number`?n+=`[`+e+`]`:typeof e==`symbol`&&(n+=`[Symbol(${e.toString()})]`);n.startsWith(`.`)&&(n=n.slice(1)),super((n===`$`?``:`${n} `)+e),this.options=t}static is(e){return!!e?.[Vg]}};Object.defineProperty(Hg.prototype,Vg,{value:!0});let Y=function(e){let t=function(e,n={}){return Y.resolve(e,t,n)[0]};if(e.refs){let t=Dg(e.refs,e=>new Y(e)),n=e=>t[e];for(let e in t){let r=t[e];r.sKey=n(r.sKey),r.inner=n(r.inner),r.list=r.list&&r.list.map(n),r.dict=r.dict&&Dg(r.dict,n)}return t[e.uid]}if(Object.assign(t,e),typeof t.callback==`string`)try{t.callback=Function(`return `+t.callback)()}catch{}return Object.defineProperty(t,"uid",{value:globalThis.__schemastery_index__++}),Object.setPrototypeOf(t,Y.prototype),t.meta||={},t.toString=t.toString.bind(t),t};Y.prototype=Object.create(Function.prototype),Y.prototype[Bg]=!0,Object.defineProperty(Y.prototype,"~standard",{get(){return{version:1,vendor:`schemastery`,validate:e=>{try{return{value:Y.resolve(e,this,{})[0]}}catch(e){if(Hg.is(e))return{issues:[{message:e.message,path:e.options.path}]};throw e}}}}}),Y.ValidationError=Hg,Y.prototype.toJSON=function(){if(globalThis.__schemastery_refs__)return globalThis.__schemastery_refs__[this.uid]??=JSON.parse(JSON.stringify({...this})),this.uid;globalThis.__schemastery_refs__={[this.uid]:{...this}},globalThis.__schemastery_refs__[this.uid]=JSON.parse(JSON.stringify({...this}));let e={uid:this.uid,refs:globalThis.__schemastery_refs__};return globalThis.__schemastery_refs__=void 0,e},Y.prototype.set=function(e,t){return this.dict[e]=t,this},Y.prototype.push=function(e){return this.list.push(e),this};function Ug(e,t){let n=typeof e==`string`?{"":e}:{...e};for(let e in t){let r=t[e];r?.$description||r?.$desc?n[e]=r.$description||r.$desc:typeof r==`string`&&(n[e]=r)}return n}function Wg(e){return e?.$value??e?.$inner}function Gg(e){return Eg(e??{},e=>!e.startsWith(`$`))}Y.prototype.i18n=function(e){let t=Y(this),n=Ug(t.meta.description,e);return Object.keys(n).length&&(t.meta.description=n),t.dict&&=Dg(t.dict,(t,n)=>t.i18n(Dg(e,e=>Wg(e)?.[n]??e?.[n]))),t.list&&=t.list.map((t,n)=>t.i18n(Dg(e,(e={})=>Array.isArray(Wg(e))?Wg(e)[n]:Array.isArray(e)?e[n]:Gg(e)))),t.inner&&=t.inner.i18n(Dg(e,e=>Wg(e)?Wg(e):Gg(e))),t.sKey&&=t.sKey.i18n(Dg(e,e=>e?.$key)),t},Y.prototype.extra=function(e,t){let n=Y(this);return n.meta={...n.meta,[e]:t},n};for(let e of[`required`,`disabled`,`collapse`,`hidden`,`loose`])Object.assign(Y.prototype,{[e](t=!0){let n=Y(this);return n.meta={...n.meta,[e]:t},n}});Y.prototype.deprecated=function(){let e=Y(this);return e.meta.badges||=[],e.meta.badges.push({text:`deprecated`,type:`danger`}),e},Y.prototype.experimental=function(){let e=Y(this);return e.meta.badges||=[],e.meta.badges.push({text:`experimental`,type:`warning`}),e},Y.prototype.pattern=function(e){let t=Y(this),n=Og(e,[`source`,`flags`]);return t.meta={...t.meta,pattern:n},t},Y.prototype.simplify=function(e){if(Mg(e)&&(e=e.get()),Rg(e,this.meta.default,this.type===`dict`))return null;if(wg(e))return e;if(this.type===`object`||this.type===`dict`){let t={};for(let n in e){let r=(this.type===`object`?this.dict[n]:this.inner)?.simplify(e[n]);(this.type===`dict`||!wg(r))&&(t[n]=r)}return Rg(t,this.meta.default,this.type===`dict`)?null:t}if(this.type===`array`||this.type===`tuple`){let t=[];return e.forEach((e,n)=>{let r=this.type===`array`?this.inner:this.list[n],i=r?r.simplify(e):e;t.push(i)}),t}if(this.type===`intersect`){let t={};for(let n of this.list)Object.assign(t,n.simplify(e));return t}if(this.type===`union`)for(let t of this.list)try{return Y.resolve(e,t,{}),t.simplify(e)}catch{}return e},Y.prototype.toString=function(e){return e_[this.type]?.(this,e)??`Schema<${this.type}>`},Y.prototype.role=function(e,t){let n=Y(this);return n.meta={...n.meta,role:e,extra:t},n};for(let e of[`default`,`link`,`comment`,`description`,`max`,`min`,`step`])Object.assign(Y.prototype,{[e](t){let n=Y(this);return n.meta={...n.meta,[e]:t},n}});Y.prototype.volatile=function(){if(this.meta.volatile)throw TypeError(`volatile schema is already wrapped`);return this.extra(`volatile`,!0)};let Kg={},qg=Symbol(`checked-volatile-schema`);function Jg(e,t=[],n=!1,r=/* @__PURE__ */ new Map){let i=r.get(e)??/* @__PURE__ */ new Set;if(i.has(n))return;if(i.add(n),r.set(e,i),e.meta?.volatile&&n)throw new Hg(`volatile fields require a fixed object path without an enclosing volatile field`,{path:t});let a=n||!!e.meta?.volatile;if(e.dict)for(let[n,i]of Object.entries(e.dict))Jg(i,[...t,n],a,r);if(e.sKey&&Jg(e.sKey,[...t,`<key>`],!0,r),e.inner&&(e.type!==`lazy`||e.inner[Bg])&&Jg(e.inner,[...t,`*`],!0,r),e.list)for(let n=0;n<e.list.length;n++)Jg(e.list[n],[...t,String(n)],!0,r)}Y.extend=function(e,t){Kg[e]=t},Y.resolve=function(e,t,n={},r=!1){if(!t)return[e];if(n[qg]||(Jg(t,n.path),n={...n,[qg]:!0}),t.meta?.volatile){let i=Y(t);i.meta={...t.meta,volatile:!1};let[a,o]=Y.resolve(e,i,n,r);try{return[jg(a),o]}catch(e){throw new Hg(e instanceof Error?e.message:String(e),n)}}if(n.ignore?.(e,t))return[e];if(wg(e)&&t.type!==`lazy`){if(t.meta.required)throw new Hg(`missing required value`,n);let r=t,i=t.meta.default;for(;r?.type===`intersect`&&wg(i);)r=r.list[0],i=r?.meta.default;if(wg(i))return[e];e=Lg(i)}let i=Kg[t.type];if(!i)throw new Hg(`unsupported type "${t.type}"`,n);try{return i(e,t,n,r)}catch(e){if(!t.meta.loose)throw e;return[t.meta.default]}},Y.from=function(e){if(wg(e))return Y.any();if([`string`,`number`,`boolean`].includes(typeof e))return Y.const(e).required();if(e[Bg])return e;if(typeof e==`function`)switch(e){case String:return Y.string().required();case Number:return Y.number().required();case Boolean:return Y.boolean().required();case Function:return Y.function().required();default:return Y.is(e).required()}else throw TypeError(`cannot infer schema from ${e}`)},Y.lazy=function(e){let t=new Y({type:`lazy`,builder:e,inner:{toJSON:()=>(t.inner[Bg]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta}),t.inner.toJSON())}});return t},Y.natural=function(){return Y.number().step(1).min(0)},Y.percent=function(){return Y.number().step(.01).min(0).max(1).role(`slider`)},Y.date=function(){return Y.union([Y.is(Date),Y.transform(Y.string().role(`datetime`),(e,t)=>{let n=new Date(e);if(isNaN(+n))throw new Hg(`invalid date "${e}"`,t);return n},!0)])},Y.regExp=function(e=``){return Y.union([Y.is(RegExp),Y.transform(Y.string().role(`regexp`,{flag:e}),(t,n)=>{try{return new RegExp(t,e)}catch(e){throw new Hg(e.message,n)}},!0)])},Y.arrayBuffer=function(e){return Y.union([Y.is(ArrayBuffer),Y.is(SharedArrayBuffer),Y.transform(Y.any(),(e,t)=>{if(Ig.isSource(e))return Ig.fromSource(e);throw new Hg(`expected ArrayBufferSource but got ${e}`,t)},!0),...e?[Y.transform(Y.string(),(t,n)=>{try{return e===`base64`?Ig.fromBase64(t):Ig.fromHex(t)}catch(e){throw new Hg(e.message,n)}},!0)]:[]])},Y.extend(`lazy`,(e,t,n,r)=>(t.inner[Bg]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta},Jg(t.inner,n.path,!0)),Y.resolve(e,t.inner,n,r))),Y.extend(`any`,e=>[e]),Y.extend(`never`,(e,t,n)=>{throw new Hg(`expected nullable but got ${e}`,n)}),Y.extend(`const`,(e,{value:t},n)=>{if(Rg(e,t))return[t];throw new Hg(`expected ${t} but got ${e}`,n)});function Yg(e,t,n,r,i=!1){let{max:a=1/0,min:o=-1/0}=t;if(e>a)throw new Hg(`expected ${n} <= ${a} but got ${e}`,r);if(e<o&&!i)throw new Hg(`expected ${n} >= ${o} but got ${e}`,r)}Y.extend(`string`,(e,{meta:t},n)=>{if(typeof e!=`string`)throw new Hg(`expected string but got ${e}`,n);if(t.pattern){let r=new RegExp(t.pattern.source,t.pattern.flags);if(!r.test(e))throw new Hg(`expect string to match regexp ${r}`,n)}return Yg(e.length,t,`string length`,n),[e]});function Xg(e,t){let n=e.toString();if(n.includes(`e`))return e*10**t;let r=n.indexOf(`.`);if(r===-1)return e*10**t;let i=n.slice(r+1),a=n.slice(0,r);return i.length<=t?+(a+i.padEnd(t,`0`)):+(a+i.slice(0,t)+`.`+i.slice(t))}function Zg(e,t,n){if(n=Math.abs(n),!/^\d+\.\d+$/.test(n.toString()))return(e-t)%n===0;let r=n.toString().indexOf(`.`),i=n.toString().slice(r+1).length;return Math.abs(Xg(e,i)-Xg(t,i))%Xg(n,i)===0}Y.extend(`number`,(e,{meta:t},n)=>{if(typeof e!=`number`)throw new Hg(`expected number but got ${e}`,n);Yg(e,t,`number`,n);let{step:r}=t;if(r&&!Zg(e,t.min??0,r))throw new Hg(`expected number multiple of ${r} but got ${e}`,n);return[e]}),Y.extend(`boolean`,(e,t,n)=>{if(typeof e==`boolean`)return[e];throw new Hg(`expected boolean but got ${e}`,n)}),Y.extend(`bitset`,(e,{bits:t,meta:n},r)=>{let i=0,a=[];if(typeof e==`number`){i=e;for(let n in t)e&t[n]&&a.push(n)}else if(Array.isArray(e)){a=e;for(let e of a){if(typeof e!=`string`)throw new Hg(`expected string but got ${e}`,r);e in t&&(i|=t[e])}}else throw new Hg(`expected number or array but got ${e}`,r);return i===n.default?[i]:[i,a]}),Y.extend(`function`,(e,t,n)=>{if(typeof e==`function`)return[e];throw new Hg(`expected function but got ${e}`,n)}),Y.extend(`is`,(e,{constructor:t},n)=>{if(typeof t==`function`){if(e instanceof t)return[e];throw new Hg(`expected ${t.name} but got ${e}`,n)}{if(wg(e))throw new Hg(`expected ${t} but got ${e}`,n);let r=Object.getPrototypeOf(e);for(;r;){if(r.constructor?.name===t)return[e];r=Object.getPrototypeOf(r)}throw new Hg(`expected ${t} but got ${e}`,n)}});function Qg(e,t,n,r){try{let[i,a]=Y.resolve(e[t],n,{...r,path:[...r.path||[],t]});return a!==void 0&&(e[t]=a),i}catch(i){if(!r?.autofix)throw i;return delete e[t],n.meta.volatile?jg(n.meta.default):n.meta.default}}Y.extend(`array`,(e,{inner:t,meta:n},r)=>{if(!Array.isArray(e))throw new Hg(`expected array but got ${e}`,r);return Yg(e.length,n,`array length`,r,!wg(t.meta.default)),[e.map((n,i)=>Qg(e,i,t,r))]}),Y.extend(`dict`,(e,{inner:t,sKey:n},r,i)=>{if(!Tg(e))throw new Hg(`expected object but got ${e}`,r);let a={};for(let o in e){let s;try{s=Y.resolve(o,n,r)[0]}catch(e){if(i)continue;throw e}a[s]=Qg(e,o,t,r),e[s]=e[o],o!==s&&delete e[o]}return[a]}),Y.extend(`tuple`,(e,{list:t},n,r)=>{if(!Array.isArray(e))throw new Hg(`expected array but got ${e}`,n);let i=t.map((t,r)=>Qg(e,r,t,n));return r||i.push(...e.slice(t.length)),[i]});function $g(e,t){for(let n in t)n in e||(e[n]=t[n])}Y.extend(`object`,(e,{dict:t},n,r)=>{if(!Tg(e))throw new Hg(`expected object but got ${e}`,n);let i={};for(let r in t){let a=Qg(e,r,t[r],n);(!wg(a)||r in e)&&(i[r]=a)}return r||$g(i,e),[i]}),Y.extend(`union`,(e,{list:t,toString:n},r,i)=>{let a=[];for(let n of t)try{return Y.resolve(e,n,r,i)}catch(e){a.push(e)}throw new Hg(`expected ${n()} but got ${JSON.stringify(e)}`,r)}),Y.extend(`intersect`,(e,{list:t,toString:n},r,i)=>{if(!t.length)return[e];let a;for(let i of t){let t=Y.resolve(e,i,r,!0)[0];if(!wg(t)){if(wg(a))a=t;else if(typeof a!=typeof t)throw new Hg(`expected ${n()} but got ${JSON.stringify(e)}`,r);else if(typeof t==`object`)$g(a??={},t);else if(a!==t)throw new Hg(`expected ${n()} but got ${JSON.stringify(e)}`,r)}}return!i&&Tg(e)&&$g(a,e),[a]}),Y.extend(`transform`,(e,{inner:t,callback:n,preserve:r},i)=>{let[a,o=e]=Y.resolve(e,t,i,!0);return r?[n(a)]:[n(a),n(o)]});let e_={};function t_(e,t,n){e_[e]=n,Object.assign(Y,{[e](...n){let r=new Y({type:e});return t.forEach((e,t)=>{switch(e){case`sKey`:r.sKey=n[t]??Y.string();break;case`inner`:r.inner=Y.from(n[t]);break;case`list`:r.list=n[t].map(Y.from);break;case`dict`:r.dict=Dg(n[t],Y.from);break;case`bits`:r.bits={};for(let e in n[t])typeof n[t][e]==`number`&&(r.bits[e]=n[t][e]);break;case`callback`:{let e=r.callback=n[t];e.toJSON||=()=>e.toString();break}case`constructor`:{let e=r.constructor=n[t];typeof e==`function`&&(e.toJSON||=()=>e.name);break}default:r[e]=n[t]}}),e===`object`||e===`dict`?r.meta.default={}:e===`array`||e===`tuple`?r.meta.default=[]:e===`bitset`&&(r.meta.default=0),r}})}t_(`is`,[`constructor`],({constructor:e})=>typeof e==`function`?e.name:e),t_(`any`,[],()=>`any`),t_(`never`,[],()=>`never`),t_(`const`,[`value`],({value:e})=>typeof e==`string`?JSON.stringify(e):e),t_(`string`,[],()=>`string`),t_(`number`,[],()=>`number`),t_(`boolean`,[],()=>`boolean`),t_(`bitset`,[`bits`],()=>`bitset`),t_(`function`,[],()=>`function`),t_(`array`,[`inner`],({inner:e})=>`${e.toString(!0)}[]`),t_(`dict`,[`inner`,`sKey`],({inner:e,sKey:t})=>`{ [key: ${t.toString()}]: ${e.toString()} }`),t_(`tuple`,[`list`],({list:e})=>`[${e.map(e=>e.toString()).join(`, `)}]`),t_(`object`,[`dict`],({dict:e})=>Object.keys(e).length===0?`{}`:`{ ${Object.entries(e).map(([e,t])=>`${e}${t.meta.required?``:`?`}: ${t.toString()}`).join(`, `)} }`),t_(`union`,[`list`],({list:e},t)=>{let n=e.map(({toString:e})=>e()).join(` | `);return t?`(${n})`:n}),t_(`intersect`,[`list`],({list:e})=>`${e.map(e=>e.toString(!0)).join(` & `)}`),t_(`transform`,[`inner`,`callback`,`preserve`],({inner:e},t)=>e.toString(t));let n_=[0,15,30,60,120,240,1440],r_={showRecentVisits:!0,tabIdleTimeoutMinutes:60},i_={showRecentVisits:Y.boolean().default(!0),tabIdleTimeoutMinutes:Y.natural().max(1440).default(60)},a_=`@deepseek-ai/dsh-client-ui-workspace/RecentNavigationRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(a_)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=a_,e.textContent=`._0lPQtW_row{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px 16px;padding:16px 0;display:flex}._0lPQtW_text{flex:160px;min-width:0}._0lPQtW_timeoutRow{border-top:.5px solid var(--dsw-alias-border-l2)}._0lPQtW_menu{flex:none;margin-inline-start:auto}._0lPQtW_selector{background:var(--dsw-alias-bg-module-platform);min-width:96px;min-height:44px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;border:0;border-radius:8px;justify-content:space-between;align-items:center;gap:8px;padding:0 12px;font-size:14px;line-height:20px;display:inline-flex}._0lPQtW_selector:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:2px}._0lPQtW_selector:disabled{opacity:.5;cursor:not-allowed}@media (hover:hover){._0lPQtW_selector:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}}._0lPQtW_error{padding-bottom:12px;font-size:12px;line-height:18px}._0lPQtW_titleLine{flex-wrap:wrap;align-items:center;gap:8px;display:flex}._0lPQtW_title{font-size:14px;line-height:20px}._0lPQtW_description{color:var(--dsw-alias-label-secondary);margin-top:4px;font-size:12px;line-height:18px}`,document.head.appendChild(e)}var o_={description:`_0lPQtW_description`,error:`_0lPQtW_error`,menu:`_0lPQtW_menu`,row:`_0lPQtW_row`,selector:`_0lPQtW_selector`,text:`_0lPQtW_text`,timeoutRow:`_0lPQtW_timeoutRow`,title:`_0lPQtW_title`,titleLine:`_0lPQtW_titleLine`};function s_({usePreference:e,setEnabled:t,setIdleTimeout:n,t:i}){let a=e(e=>e.value),c=a?.showRecentVisits??!0,l=a?.tabIdleTimeoutMinutes??60,[u,d]=(0,s.useState)(!1),[f,p]=(0,s.useState)(!1),[m,h]=(0,s.useState)(!1),g=(0,s.useRef)(!1),_=(0,s.useId)();(0,s.useEffect)(()=>{c||d(!1)},[c]);let v=e=>e===0?i(`recent.timeout.off`):e>=120&&e%60==0?i(`recent.timeout.hours`,{n:e/60}):i(`recent.timeout.minutes`,{n:e}),y=e=>{g.current||(g.current=!0,d(!1),p(!0),h(!1),Promise.resolve().then(e).then(e=>h(!e)).catch(()=>h(!0)).finally(()=>{g.current=!1,p(!1)}))};return/* @__PURE__ */ (0,o.jsxs)(`div`,{children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:o_.row,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:o_.text,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:o_.titleLine,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:o_.title,children:i(`recent.settings.title`)}),/* @__PURE__ */ (0,o.jsx)(r.Tag,{tone:`neutral`,children:i(`recent.settings.mobile`)})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:o_.description,children:i(`recent.settings.description`)})]}),/* @__PURE__ */ (0,o.jsx)(r.Switch,{checked:c,disabled:f,label:`${i(`recent.settings.title`)} · ${i(`recent.settings.mobile`)}`,onChange:e=>y(()=>t(e))})]}),c&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:`${o_.row} ${o_.timeoutRow}`,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:o_.text,children:/* @__PURE__ */ (0,o.jsx)(`div`,{className:o_.title,id:`${_}-label`,children:i(`recent.timeout.title`)})}),/* @__PURE__ */ (0,o.jsx)(r.Menu,{className:o_.menu,open:u&&c&&!f,onClose:()=>d(!1),items:n_.map(e=>({id:String(e),label:e===60?i(`recent.timeout.default`,{value:v(e)}):v(e)})),selectedId:String(l),onSelect:e=>{let t=n_.find(t=>String(t)===e);t!==void 0&&y(()=>n(t))},align:`end`,portal:!0,anchor:/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:o_.selector,disabled:!c||f,"aria-labelledby":`${_}-label ${_}-value`,"aria-haspopup":`menu`,"aria-expanded":u&&c&&!f,onClick:()=>d(e=>!e),children:[/* @__PURE__ */ (0,o.jsx)(`span`,{id:`${_}-value`,children:v(l)}),/* @__PURE__ */ (0,o.jsx)(r.IconChevronDownOutlineRegular,{size:14})]})})]}),m&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:o_.error,role:`alert`,children:i(`recent.settings.error`)})]})}function c_(e,t,n){let r=e=>n.set(`showRecentVisits`,e),i=e=>n.set(`tabIdleTimeoutMinutes`,e),a={scrollLeft:0};e.inject([`uiSession`,`connection`,`sessions`,`workspaces`],e=>{e.effect(()=>{let r,i=!1,o=!1,s=!1,c=n.getSnapshot().value?.showRecentVisits,l=n.getSnapshot().value?.tabIdleTimeoutMinutes,u=()=>{r!==void 0&&clearTimeout(r),r=void 0},d=()=>{if(!s){if(i)o=!0;else{i=!0;try{do{o=!1,u();let i=n.getSnapshot().value;if(i===void 0||!i.showRecentVisits||i.tabIdleTimeoutMinutes<=0||document.visibilityState!==`visible`||e.connection.state.getSnapshot()!==`connected`||t.opening.getSnapshot().state===`loading`)continue;let{changed:c,nextDelayMs:l}=t.recentVisits.expireInactive(i.tabIdleTimeoutMinutes*6e4,e.uiSession.sessionStatus.getSnapshot());c&&t.recentVisits.entries.getSnapshot().length===0&&(a.scrollLeft=0),!s&&!o&&l!==void 0&&(r=setTimeout(d,Math.max(1,Math.min(l,6e4))))}while(o&&!s)}finally{i=!1}}}},f=[n.subscribe(()=>{let e=n.getSnapshot().value,t=e?.showRecentVisits,r=e?.tabIdleTimeoutMinutes;(t!==c||r!==l)&&(c=t,l=r,d())}),e.connection.state.subscribe(d),t.opening.subscribe(d),t.recentVisits.entries.subscribe(d),e.uiSession.sessionStatus.subscribe(d),e.sessions.list.subscribe(d),e.workspaces.list.subscribe(d)];return document.addEventListener(`visibilitychange`,d),window.addEventListener(`pageshow`,d),d(),()=>{s=!0,u();for(let e of f)e();document.removeEventListener(`visibilitychange`,d),window.removeEventListener(`pageshow`,d)}},`ui-workspace: idle session tabs`)});let o=()=>({hooks:{visits:t.recentVisits.entries,recentNavigationSettings:n},open:e=>t.openSession(e),close:e=>{t.closeSessionTab(e),t.recentVisits.entries.getSnapshot().length===0&&(a.scrollLeft=0)},closeAll:()=>{t.closeAllSessionTabs(),a.scrollLeft=0},viewport:a,setEnabled:r});e.slots.inject(`conversation.header.trailing`,()=>e.slots.register({name:`conversation.header.trailing`,locale:`workspace`,inject:()=>({startSession:()=>t.startSession(),hooks:{shortcuts:e.shortcuts.catalog}})},dg)),e.slots.inject(`conversation.header.navigation`,()=>e.slots.register({name:`conversation.header.navigation`,locale:`workspace`,inject:o},Cg)),e.slots.inject(`conversation.header.shortcuts`,()=>e.slots.register({name:`conversation.header.shortcuts`,locale:`workspace`,inject:o,children:{"workspace.recent.shortcut.identity":{kind:`list`,scope:`root`}}},Sg)),e.slots.inject(`settings.general.item`,()=>e.slots.register({name:`settings.general.item`,id:`workspace.recent-navigation`,order:12,locale:`workspace`,inject:()=>({hooks:{preference:n},setEnabled:r,setIdleTimeout:i})},s_))}let l_=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeStyle.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(l_)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=l_,e.textContent=`.GyPSUW_options{min-width:0;color:var(--dsw-alias-label-primary);flex-direction:column;align-items:flex-start;gap:8px;padding-block:6px;display:flex}.GyPSUW_settingsText{flex:240px}.GyPSUW_prompt{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-specific-sidebar-fill);color:var(--dsw-alias-label-primary);overflow-wrap:anywhere;border-radius:8px;min-width:0;margin:6px 2px 8px;padding:8px;font-size:12px;line-height:16px}.GyPSUW_promptHeading{justify-content:space-between;align-items:center;gap:8px;margin-bottom:8px;display:flex}.GyPSUW_promptHeading strong{font-weight:500}.GyPSUW_comparison{border:1px solid var(--dsw-alias-border-l2);border-radius:6px;grid-template-columns:repeat(2,minmax(0,1fr));display:grid}.GyPSUW_choice{appearance:none;min-width:0;color:inherit;font:inherit;text-align:start;cursor:pointer;background:0 0;border:0;border-radius:5px 0 0 5px;flex-direction:column;justify-content:flex-start;align-items:stretch;padding:8px 0 4px;display:flex;position:relative}.GyPSUW_choice+.GyPSUW_choice{border-inline-start:1px solid var(--dsw-alias-border-l2);border-radius:0 5px 5px 0}.GyPSUW_choice[aria-checked=true]{box-shadow:inset 0 0 0 1px var(--dsw-alias-state-business-primary)}.GyPSUW_choiceTitle{padding:0 8px 2px;font-size:12px;font-weight:500;display:block}.GyPSUW_choiceSubtitle{white-space:nowrap;text-overflow:ellipsis;color:var(--dsw-alias-label-secondary);padding:0 8px 6px;font-size:10px;line-height:16px;overflow:hidden}.GyPSUW_preview{pointer-events:none;user-select:none;grid-auto-rows:44px;min-width:0;display:grid;overflow:hidden}.GyPSUW_preview .GyPSUW_sampleRow{--dsh-thread-row-height:22px;--dsh-workspace-indent:0px;--dsh-thread-indent:0px;min-height:0;padding-inline:6px}.GyPSUW_preview [data-session-title]{margin-inline:7px 0;font-size:11px}.GyPSUW_preview .GyPSUW_sampleSummary{margin-block-end:0;padding:0 0 0 7px;font-size:9px;line-height:11px}.GyPSUW_sampleIcon{flex-shrink:0;width:14px;height:14px;display:inline-flex}.GyPSUW_hint{color:var(--dsw-alias-label-tertiary);margin:0 0 8px;font-size:11px;line-height:1.5}.GyPSUW_later{color:var(--dsw-alias-label-secondary);cursor:pointer;font:inherit;background:0 0;border:0;border-radius:4px;flex-shrink:0;padding:4px}.GyPSUW_choice:focus-visible,.GyPSUW_later:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}.GyPSUW_error{color:var(--dsw-alias-state-warn-primary);overflow-wrap:anywhere;flex-basis:100%;margin-top:6px;font-size:12px}@media (width<=639px){.GyPSUW_choiceTitle,.GyPSUW_choiceSubtitle{padding-inline:6px}.GyPSUW_preview [data-session-title]{font-size:10px}}@media (hover:none),(pointer:coarse){.GyPSUW_later{min-height:44px}}`,document.head.appendChild(e)}var u_={choice:`GyPSUW_choice`,choiceSubtitle:`GyPSUW_choiceSubtitle`,choiceTitle:`GyPSUW_choiceTitle`,comparison:`GyPSUW_comparison`,error:`GyPSUW_error`,hint:`GyPSUW_hint`,later:`GyPSUW_later`,options:`GyPSUW_options`,preview:`GyPSUW_preview`,prompt:`GyPSUW_prompt`,promptHeading:`GyPSUW_promptHeading`,sampleIcon:`GyPSUW_sampleIcon`,sampleRow:`GyPSUW_sampleRow`,sampleSummary:`GyPSUW_sampleSummary`,settingsText:`GyPSUW_settingsText`};let d_=[`summary`,`ring`];function f_(e){let[t,n]=(0,s.useState)(!1),[r,i]=(0,s.useState)(!1),a=(0,s.useRef)(!1);return{busy:t,failed:r,save:async t=>{if(a.current)return!1;a.current=!0,n(!0),i(!1);try{let n=await e(t);return i(!n),n}catch{return i(!0),!1}finally{a.current=!1,n(!1)}}}}function p_({style:e,setStyle:t,t:n,settings:i=!1}){let a=(0,s.useId)(),{busy:c,failed:l,save:u}=f_(t);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:i?r.preferenceRowStyles.row:u_.options,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:`${r.preferenceRowStyles.rowText} ${i?u_.settingsText:``}`,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:r.preferenceRowStyles.title,id:a,children:n(`threadTree.style.title`)}),i&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:r.preferenceRowStyles.description,id:`${a}-description`,children:n(`threadTree.style.description`)})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:r.preferenceRowStyles.choices,role:`radiogroup`,"aria-labelledby":a,"aria-describedby":i?`${a}-description`:void 0,"aria-busy":c,onKeyDown:e=>{if(![`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key))return;e.preventDefault(),e.stopPropagation();let t=[...e.currentTarget.querySelectorAll(`[role="radio"]`)],n=t.indexOf(e.target),r=e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowLeft`||e.key===`ArrowUp`?-1:1)+t.length)%t.length;t[r]?.focus(),t[r]?.click()},children:d_.map(t=>/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,role:`radio`,className:r.preferenceRowStyles.choice,"aria-checked":e===t,"aria-disabled":c,tabIndex:e===t?0:-1,onClick:()=>void u(t),children:n(`threadTree.style.${t}`)},t))}),l&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:u_.error,role:`alert`,children:n(`threadTree.style.error`)})]})}function m_({usePreference:e,setStyle:t,t:n}){let r=e(e=>e.value?.threadTreeCollapseStyle??`summary`);return/* @__PURE__ */ (0,o.jsx)(p_,{style:r,setStyle:t,t:n,settings:!0})}let h_={...r_,threadTreeCollapseStyle:`summary`},g_=Y.object({...i_,threadTreeCollapseStyle:Y.union([`summary`,`ring`]).default(`summary`)});function __(e){return typeof e==`object`&&!!e&&Object.hasOwn(e,`threadTreeCollapseStyle`)}function v_(e){let t=e.configForms.registerBrowser(`ui-workspace`,g_.toJSON(),{...h_});return e.slots.inject(`settings.general.item`,()=>e.slots.register({name:`settings.general.item`,id:`workspace.thread-tree-style`,order:11.5,locale:`workspace`,inject:()=>({hooks:{preference:t},setStyle:e=>t.set(`threadTreeCollapseStyle`,e)})},m_)),t}function y_(e,t){return e!==void 0&&e.has(t)}function b_(e,t,n,r={}){if(n===void 0||t===n)return!1;let i=e.find(e=>e.workspaceId===t),a=e.find(e=>e.workspaceId===n);return!(i===void 0||a===void 0||y_(r.sectionOf,t)||y_(r.sectionOf,n)||r.parents!==void 0&&r.parents.get(t)!==r.parents.get(n))}function x_(e,t,n,r={}){if(!b_(e,t,n.id,r))return null;let i=r.parents?.get(t),a=e.filter(e=>!y_(r.sectionOf,e.workspaceId)&&r.parents?.get(e.workspaceId)===i),o=a.findIndex(e=>e.workspaceId===n.id),s=a.findIndex(e=>e.workspaceId===t);if(o===-1||s===-1)return null;let c=n.half===`before`?n.id:a[o+1]?.workspaceId;if(c===t)return null;let l=c===void 0?a.length:a.findIndex(e=>e.workspaceId===c);return l===s||l===s+1?null:{beforeWorkspaceId:c}}function S_(e,t){let n=/* @__PURE__ */ new Map;for(let t of e)for(let e of t.workspaceIds??[])n.has(e)||n.set(e,t.id);let r=new Map(n);for(let e of t)r.set(e,kh);return{nativeSectionOf:n,sectionOf:r}}function C_(e,t,n,r){if(!t)return/* @__PURE__ */ new Map;let i=e=>`${e.remote?.hostId??`local`}\n${n.get(e.workspaceId)??``}`,a=/* @__PURE__ */ new Map;for(let t of e){let e=i(t),n=a.get(e)??/* @__PURE__ */ new Map;t.path&&n.set(t.path,t.workspaceId),a.set(e,n)}return new Map(e.map(e=>{if(r.has(e.workspaceId))return[e.workspaceId,void 0];let t=a.get(i(e)),n=Dh(e.path,[...t?.keys()??[]]);return[e.workspaceId,n===void 0?void 0:t?.get(n)]}))}function w_(e,t,n,r){let i=new Map(e.map(e=>[e.key,e]));return{pinnedGroups:n.flatMap(e=>i.get(e)??[]),sectionRoots:new Map(t.map(e=>[e.id,(e.workspaceIds??[]).flatMap(t=>{let n=i.get(t);return n!==void 0&&r.get(t)===e.id?[n]:[]})])),workspaceRoots:e.filter(e=>e.key!==``&&!r.has(e.key))}}function T_(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=T_(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function X(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=T_(e))&&(r&&(r+=` `),r+=t);return r}function E_(e,t){return e===`default-workspace`?t:e}let D_=`@deepseek-ai/dsh-client-ui-workspace/WorkspaceBrowser.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(D_)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=D_,e.textContent=`._14DcuW_root{--dsh-session-list-edge-inset:var(--dsh-sidebar-inline-padding);--dsh-session-list-scrollbar-width:5px;--dsh-session-list-scrollbar-offset:2px;box-sizing:border-box;min-height:0;padding-right:var(--dsh-session-list-edge-inset);flex-direction:column;flex:1;display:flex}[data-phone-drawer] ._14DcuW_root{--dsh-session-list-scrollbar-width:0px}[data-phone-drawer] ._14DcuW_list{scrollbar-gutter:auto}._14DcuW_root._14DcuW_rail{padding-right:0}._14DcuW_iconButton{isolation:isolate;corner-shape:round;cursor:pointer;width:28px;height:28px;color:color-mix(in srgb, var(--dsw-alias-label-secondary) 82%, transparent);background:0 0;border:none;border-radius:50%;flex:none;justify-content:center;align-items:center;padding:0;transition:color .14s;display:inline-flex;position:relative}._14DcuW_iconButton:before,._14DcuW_searchButton:before{content:"";corner-shape:round;pointer-events:none;z-index:-1;background:0 0;border-radius:50%;width:28px;height:28px;margin:auto;transition:background-color .14s;position:absolute;inset:0}._14DcuW_iconButton:focus-visible,._14DcuW_searchButton:focus-visible,._14DcuW_clearButton:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}._14DcuW_iconButton:hover{color:var(--dsw-alias-label-primary)}._14DcuW_iconButton:hover:before{background:var(--dsw-alias-interactive-bg-hover)}._14DcuW_activityButton{position:relative}._14DcuW_activityButtonActive{color:var(--dsw-alias-state-business-primary)}._14DcuW_activityButtonActive:before{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 12%, transparent)}._14DcuW_activityButtonActive:hover{color:var(--dsw-alias-state-business-primary)}._14DcuW_activityButtonActive:hover:before{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 18%, transparent)}._14DcuW_activityIconWrap{justify-content:center;align-items:center;width:16px;height:16px;display:inline-flex;position:relative}._14DcuW_activityDot{background:var(--dsw-alias-state-business-primary);width:5.5px;height:5.5px;box-shadow:0 0 0 1.5px var(--dsw-specific-sidebar-fill);pointer-events:none;border-radius:50%;position:absolute;top:-2px;right:-2px}._14DcuW_activityDot[data-attention=pending]{background:var(--dsw-alias-state-warn-primary)}._14DcuW_viewOptionsMenu{min-width:200px}._14DcuW_sectionHeader{box-sizing:border-box;height:36px;color:var(--dsw-alias-label-tertiary);border-radius:6px;flex:none;justify-content:flex-end;align-items:center;gap:4px;margin-bottom:6px;padding-left:4px;display:flex;overflow:hidden}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader{margin-top:2px;margin-bottom:4px;margin-right:-4px}._14DcuW_sectionLabel{white-space:nowrap;opacity:1;visibility:visible;min-width:0;max-width:45%;transition:max-width .18s var(--ds-ease-in-out), margin-right .18s var(--ds-ease-in-out), opacity .12s var(--ds-ease-in-out), transform .18s var(--ds-ease-in-out), visibility 0s linear;flex:none;font-size:14px;font-weight:500;line-height:21px;overflow:hidden}._14DcuW_sectionLabelHidden{opacity:0;visibility:hidden;max-width:0;margin-right:-4px;transition-delay:0s,0s,0s,0s,.18s;transform:translate(-4px)}._14DcuW_activitySlot{opacity:1;visibility:visible;max-width:28px;transition:max-width .18s var(--ds-ease-in-out), margin-right .18s var(--ds-ease-in-out), opacity .12s var(--ds-ease-in-out), transform .18s var(--ds-ease-in-out), visibility 0s linear;flex:none;align-items:center;margin-left:auto;display:flex;overflow:hidden}._14DcuW_activitySlotHidden{opacity:0;visibility:hidden;pointer-events:none;max-width:0;margin-left:0;margin-right:-4px;transition-delay:0s,0s,0s,0s,.18s;transform:translate(-4px)}._14DcuW_searchSlot{box-sizing:border-box;min-width:0;max-width:28px;transition:max-width .18s var(--ds-ease-in-out), padding-left .18s var(--ds-ease-in-out);flex:1;align-items:center;padding-left:0;display:flex}._14DcuW_searchSlotExpanded{max-width:100%;padding-left:0}._14DcuW_headerActions{opacity:1;visibility:visible;max-width:96px;transition:max-width .18s var(--ds-ease-in-out), opacity .12s var(--ds-ease-in-out), transform .18s var(--ds-ease-in-out), visibility 0s linear;flex:none;align-items:center;gap:4px;display:flex;overflow:hidden}._14DcuW_headerActionsHidden{opacity:0;visibility:hidden;pointer-events:none;max-width:0;transition-delay:0s,0s,0s,.18s;transform:translate(4px)}._14DcuW_search{box-sizing:border-box;border-radius:var(--dsw-radius-sm);cursor:text;width:100%;height:28px;color:var(--dsw-alias-label-secondary);transition:width .18s var(--ds-ease-in-out), padding .18s var(--ds-ease-in-out), border-color .18s var(--ds-ease-in-out), background-color .18s var(--ds-ease-in-out);background:0 0;border:none;flex:none;align-items:center;gap:0;margin:0;padding:0;display:flex;overflow:hidden}._14DcuW_searchExpanded{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);width:calc(100% + 4px);height:30px;color:var(--dsw-alias-label-caption);background:0 0;margin-inline:-2px;padding:0 4px 0 0}._14DcuW_searchButton{isolation:isolate;corner-shape:round;cursor:pointer;width:28px;height:28px;color:color-mix(in srgb, var(--dsw-alias-label-secondary) 82%, transparent);background:0 0;border:none;border-radius:50%;flex:none;justify-content:center;align-items:center;padding:0;transition:color .14s;display:inline-flex;position:relative}._14DcuW_searchExpanded ._14DcuW_searchButton{width:28px;height:30px}._14DcuW_searchButton:hover{color:var(--dsw-alias-label-primary)}._14DcuW_searchButton:hover:before{background:var(--dsw-alias-interactive-bg-hover)}._14DcuW_searchExpanded ._14DcuW_searchButton:hover:before{background:0 0}._14DcuW_searchInput{opacity:0;pointer-events:none;width:0;min-width:0;color:var(--dsw-alias-label-primary);transition:opacity .12s var(--ds-ease-in-out);background:0 0;border:none;outline:none;flex:1;font-size:13px;line-height:18px}._14DcuW_searchExpanded ._14DcuW_searchInput{opacity:1;pointer-events:auto;margin-left:-2px}._14DcuW_searchInput::placeholder{color:var(--dsw-alias-label-tertiary)}._14DcuW_clearButton{border-radius:var(--dsw-radius-sm);cursor:pointer;width:24px;height:24px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}._14DcuW_clearButton:hover{background:var(--dsw-alias-interactive-bg-hover)}._14DcuW_rail ._14DcuW_sectionHeader{justify-content:flex-start;gap:0;margin-bottom:12px;padding-left:0}._14DcuW_rail ._14DcuW_headerActions{max-width:none}._14DcuW_rail ._14DcuW_iconButton{border-radius:var(--dsw-radius-md);corner-shape:var(--dsw-corner-shape);width:36px;height:36px;color:var(--dsw-alias-label-primary)}._14DcuW_rail ._14DcuW_iconButton:before,._14DcuW_rail ._14DcuW_searchButton:before{border-radius:var(--dsw-radius-md);corner-shape:var(--dsw-corner-shape);width:100%;height:100%}._14DcuW_rail ._14DcuW_search{border-radius:var(--dsw-radius-md);background:0 0;border-color:#0000;gap:0;width:36px;height:36px;margin:0 0 12px;padding:0}._14DcuW_rail ._14DcuW_searchButton{border-radius:var(--dsw-radius-md);corner-shape:var(--dsw-corner-shape);width:36px;height:36px;color:var(--dsw-alias-label-primary)}._14DcuW_listArea{min-height:0;margin-left:-4px;margin-right:calc(-1 * var(--dsh-session-list-edge-inset));flex-direction:column;flex:1;padding-left:4px;display:flex;position:relative;overflow:visible}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader+._14DcuW_listArea{padding-top:6px}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader+._14DcuW_listArea:before{content:"";top:0;left:calc(4px - var(--dsh-sidebar-inline-padding));background:color-mix(in srgb, var(--dsw-alias-border-l3) 38%, transparent);pointer-events:none;height:1px;position:absolute;right:0}body[data-ds-dark-theme] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader+._14DcuW_listArea:before{background:color-mix(in srgb, var(--dsw-alias-border-l3) 34%, transparent)}@media (resolution>=2x){._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader+._14DcuW_listArea:before{background:color-mix(in srgb, var(--dsw-alias-border-l3) 56%, transparent);transform-origin:top;transform:scaleY(.5)}body[data-ds-dark-theme] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader+._14DcuW_listArea:before{background:color-mix(in srgb, var(--dsw-alias-border-l3) 48%, transparent)}}[data-phone-drawer] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader+._14DcuW_listArea:before{left:4px;right:var(--dsh-session-list-edge-inset)}._14DcuW_rail ._14DcuW_listArea{margin-left:0;margin-right:0;padding-left:0}._14DcuW_treeBody{flex-direction:column;flex:1;min-height:0;display:flex;position:relative}._14DcuW_fade{left:0;right:var(--dsh-session-list-edge-inset);background:linear-gradient(to bottom, transparent, var(--dsw-specific-sidebar-fill));pointer-events:none;height:24px;position:absolute;bottom:0}[data-platform=darwin]:not([data-tauri-shell]) ._14DcuW_fade,[data-phone-drawer] ._14DcuW_fade,body[data-codexhost-wallpaper] ._14DcuW_fade{display:none}._14DcuW_wide{animation:_14DcuW_wide-in .2s var(--ds-ease-in-out)}@keyframes _14DcuW_wide-in{0%{opacity:0}}._14DcuW_list{overflow-anchor:none;overscroll-behavior-y:contain;--dsh-scrollbar-width:var(--dsh-session-list-scrollbar-width);--dsh-scrollbar-track-margin:6px;min-height:0;margin-left:-4px;margin-right:var(--dsh-session-list-scrollbar-offset);padding-left:4px;padding-right:calc(var(--dsh-session-list-edge-inset) - var(--dsh-session-list-scrollbar-width) - var(--dsh-session-list-scrollbar-offset));scrollbar-gutter:stable;flex:1;padding-bottom:16px;scroll-padding-block:8px;overflow-y:auto}._14DcuW_flatList>*+*,._14DcuW_flatUnsectioned>*+*,._14DcuW_flatRows>*+*,._14DcuW_searchTree>[role=treeitem]+[role=treeitem],._14DcuW_groupSection>*+*,._14DcuW_groupSessions>*+*{margin-top:2px}._14DcuW_unsectionedZone{border-radius:var(--dsw-radius-sm)}._14DcuW_unsectionedDropTarget{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 8%, transparent);box-shadow:inset 0 0 0 1px var(--dsw-alias-state-business-primary)}._14DcuW_unsectionedDropHint{color:var(--dsw-alias-label-tertiary);padding:6px 8px;font-size:12px;line-height:18px}._14DcuW_searchStatus{color:var(--dsw-alias-label-tertiary);padding:10px 12px;font-size:12px;line-height:18px}._14DcuW_skeletonRow{box-sizing:border-box;align-items:flex-start;gap:8px;min-height:48px;padding:6px 8px 7px;display:flex}._14DcuW_skeletonDot{corner-shape:round;border-radius:50%;flex:none;width:16px;height:16px}._14DcuW_skeletonBars{flex-direction:column;flex:1;gap:6px;min-width:0;display:flex}._14DcuW_skeletonDot,._14DcuW_skeletonBar{background:var(--dsw-alias-bg-skeleton);animation:2s cubic-bezier(.36,0,.64,1) infinite _14DcuW_search-skeleton}._14DcuW_skeletonBar{border-radius:var(--dsw-radius-xs);width:65%;height:16px}._14DcuW_skeletonBarWide{width:90%;height:13px}@keyframes _14DcuW_search-skeleton{0%{opacity:1}40%{opacity:.6}80%,to{opacity:1}}._14DcuW_groupSection{position:relative}._14DcuW_groupSection+._14DcuW_groupSection{margin-top:4px}._14DcuW_listTopDropIndicator,._14DcuW_workspaceDropBefore:before,._14DcuW_workspaceDropAfter:after{content:"";z-index:1;background:linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat, linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat, linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;pointer-events:none;height:12px;position:absolute;left:0;right:0}._14DcuW_listTopDropIndicator{top:-8px;left:0;right:var(--dsh-session-list-edge-inset)}._14DcuW_listTopDropActive>._14DcuW_workspaceDropBefore:first-child:before{display:none}._14DcuW_workspaceDropBefore:before{top:-8px}._14DcuW_workspaceDropAfter:after{bottom:-8px}._14DcuW_sessionOverflowButton{width:100%;height:32px;padding:0 12px 0 calc(32px + var(--dsh-workspace-indent,0px));cursor:pointer;text-align:left;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;border-radius:6px;font-size:12px}._14DcuW_sessionOverflowButton[data-row-key=overflow\\:workspaces]{padding-inline-start:8px}._14DcuW_groupSessions>._14DcuW_sessionOverflowButton{margin-top:0;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px))}@media (hover:hover){._14DcuW_sessionOverflowButton:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}}._14DcuW_sessionOverflowButton:active{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}._14DcuW_sessionOverflowButton:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}@media (hover:none),(pointer:coarse){._14DcuW_sessionOverflowButton{min-height:44px}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_iconButton,._14DcuW_root:not(._14DcuW_rail) ._14DcuW_searchButton{width:36px;min-width:36px;height:36px;min-height:36px}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_activitySlot:not(._14DcuW_activitySlotHidden),._14DcuW_root:not(._14DcuW_rail) ._14DcuW_searchSlot{max-width:36px}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_searchSlotExpanded{max-width:100%}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_search{height:36px}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_headerActions:not(._14DcuW_headerActionsHidden){max-width:120px}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader{height:44px}._14DcuW_searchInput,._14DcuW_renameInput{font-size:16px}}[data-phone-drawer] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader{height:44px}[data-phone-drawer] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_iconButton,[data-phone-drawer] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_searchButton{width:36px;min-width:36px;height:36px;min-height:36px}[data-phone-drawer] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_activitySlot:not(._14DcuW_activitySlotHidden){max-width:36px}[data-phone-drawer] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_searchSlot{max-width:36px}[data-phone-drawer] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_searchSlotExpanded{max-width:100%}[data-phone-drawer] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_search{height:36px}[data-phone-drawer] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_headerActions:not(._14DcuW_headerActionsHidden){max-width:120px}._14DcuW_empty{color:var(--dsw-alias-label-tertiary);padding:16px 12px;font-size:13px}._14DcuW_emptyState{color:var(--dsw-alias-label-tertiary);flex-direction:column;align-items:center;gap:8px;margin-top:80px;padding:0 12px;font-size:13px;line-height:20px;display:flex}._14DcuW_emptyState>svg{color:var(--dsw-alias-label-caption);margin-bottom:4px}._14DcuW_emptyAction{cursor:pointer;color:var(--dsw-alias-link);background:0 0;border:none;padding:0;font-size:13px;line-height:20px}._14DcuW_filterEmptyHint{color:var(--dsw-alias-label-tertiary);flex-direction:column;align-items:flex-start;gap:4px;padding:10px 12px;font-size:12px;line-height:18px;display:flex}._14DcuW_filterEmptyHint ._14DcuW_emptyAction{font-size:12px;line-height:18px}._14DcuW_renameInput{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);width:100%;height:44px;color:var(--dsw-alias-label-primary);background:0 0;outline:none;padding:7px 14px;font-size:14px;font-weight:400;line-height:22px}._14DcuW_renameInput:disabled{color:var(--dsw-alias-label-dimmed)}._14DcuW_defaultHarnessOptions{flex-direction:column;display:flex}._14DcuW_defaultHarnessOptions>[role=radiogroup]{flex-direction:column;gap:12px;display:flex}._14DcuW_defaultHarnessOption{min-height:28px;color:var(--dsw-alias-label-primary);cursor:pointer;align-items:flex-start;gap:10px;font-size:14px;display:flex}._14DcuW_defaultHarnessOption input{width:16px;height:16px;accent-color:var(--dsw-alias-label-primary);flex:none;margin:2px 0 0}._14DcuW_defaultHarnessOptionText{flex-direction:column;gap:2px;min-width:0;display:flex}._14DcuW_defaultHarnessOptionTitle{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500;line-height:20px}._14DcuW_defaultHarnessOptionDesc{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}._14DcuW_defaultHarnessTrigger{text-align:start;cursor:pointer;align-items:center;gap:8px;width:calc(100% - 26px);margin-top:12px;margin-left:26px;display:flex}._14DcuW_defaultHarnessTrigger:focus-visible{outline:2px solid var(--dsw-alias-label-secondary);outline-offset:2px}._14DcuW_defaultHarnessTrigger>:is(svg,img){flex:none}._14DcuW_defaultHarnessTrigger>span{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}._14DcuW_defaultHarnessMenu{width:min(332px,100vw - 64px)}._14DcuW_renameError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}._14DcuW_deleteAction:not(:disabled){color:var(--dsw-alias-state-error-primary)}._14DcuW_deleteStatus{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}._14DcuW_archiveActivity{max-height:220px;color:var(--dsw-alias-label-primary);margin:0 0 8px;padding-left:18px;font-size:13px;line-height:20px;overflow-y:auto}._14DcuW_archiveActivity li{overflow-wrap:anywhere}@media (prefers-reduced-motion:reduce){._14DcuW_wide,._14DcuW_skeletonDot,._14DcuW_skeletonBar{animation:none}._14DcuW_search,._14DcuW_sectionLabel,._14DcuW_activitySlot,._14DcuW_searchSlot,._14DcuW_searchInput,._14DcuW_headerActions{transition:none}}`,document.head.appendChild(e)}var Z={activityButton:`_14DcuW_activityButton`,activityButtonActive:`_14DcuW_activityButtonActive`,activityDot:`_14DcuW_activityDot`,activityIconWrap:`_14DcuW_activityIconWrap`,activitySlot:`_14DcuW_activitySlot`,activitySlotHidden:`_14DcuW_activitySlotHidden`,archiveActivity:`_14DcuW_archiveActivity`,clearButton:`_14DcuW_clearButton`,defaultHarnessMenu:`_14DcuW_defaultHarnessMenu`,defaultHarnessOption:`_14DcuW_defaultHarnessOption`,defaultHarnessOptionDesc:`_14DcuW_defaultHarnessOptionDesc`,defaultHarnessOptionText:`_14DcuW_defaultHarnessOptionText`,defaultHarnessOptionTitle:`_14DcuW_defaultHarnessOptionTitle`,defaultHarnessOptions:`_14DcuW_defaultHarnessOptions`,defaultHarnessTrigger:`_14DcuW_defaultHarnessTrigger`,deleteAction:`_14DcuW_deleteAction`,deleteStatus:`_14DcuW_deleteStatus`,empty:`_14DcuW_empty`,emptyAction:`_14DcuW_emptyAction`,emptyState:`_14DcuW_emptyState`,fade:`_14DcuW_fade`,filterEmptyHint:`_14DcuW_filterEmptyHint`,flatList:`_14DcuW_flatList`,flatRows:`_14DcuW_flatRows`,flatUnsectioned:`_14DcuW_flatUnsectioned`,groupSection:`_14DcuW_groupSection`,groupSessions:`_14DcuW_groupSessions`,headerActions:`_14DcuW_headerActions`,headerActionsHidden:`_14DcuW_headerActionsHidden`,iconButton:`_14DcuW_iconButton`,list:`_14DcuW_list`,listArea:`_14DcuW_listArea`,listTopDropActive:`_14DcuW_listTopDropActive`,listTopDropIndicator:`_14DcuW_listTopDropIndicator`,rail:`_14DcuW_rail`,renameError:`_14DcuW_renameError`,renameInput:`_14DcuW_renameInput`,root:`_14DcuW_root`,search:`_14DcuW_search`,"search-skeleton":`_14DcuW_search-skeleton`,searchButton:`_14DcuW_searchButton`,searchExpanded:`_14DcuW_searchExpanded`,searchInput:`_14DcuW_searchInput`,searchSlot:`_14DcuW_searchSlot`,searchSlotExpanded:`_14DcuW_searchSlotExpanded`,searchStatus:`_14DcuW_searchStatus`,searchTree:`_14DcuW_searchTree`,sectionHeader:`_14DcuW_sectionHeader`,sectionLabel:`_14DcuW_sectionLabel`,sectionLabelHidden:`_14DcuW_sectionLabelHidden`,sessionOverflowButton:`_14DcuW_sessionOverflowButton`,skeletonBar:`_14DcuW_skeletonBar`,skeletonBarWide:`_14DcuW_skeletonBarWide`,skeletonBars:`_14DcuW_skeletonBars`,skeletonDot:`_14DcuW_skeletonDot`,skeletonRow:`_14DcuW_skeletonRow`,treeBody:`_14DcuW_treeBody`,unsectionedDropHint:`_14DcuW_unsectionedDropHint`,unsectionedDropTarget:`_14DcuW_unsectionedDropTarget`,unsectionedZone:`_14DcuW_unsectionedZone`,viewOptionsMenu:`_14DcuW_viewOptionsMenu`,wide:`_14DcuW_wide`,"wide-in":`_14DcuW_wide-in`,workspaceDropAfter:`_14DcuW_workspaceDropAfter`,workspaceDropBefore:`_14DcuW_workspaceDropBefore`};function O_({section:e,request:t,t:n}){let[i,a]=(0,s.useState)(!1),c=n(`actions.section.aria`,{name:e.name});return/* @__PURE__ */ (0,o.jsx)(r.Menu,{open:i,onClose:()=>a(!1),items:[{id:`rename`,label:n(`section.rename.title`)},{id:`delete`,label:n(`section.delete.title`)}],onSelect:n=>{a(!1),(n===`rename`||n===`delete`)&&t({mode:n,section:e})},align:`end`,dense:!0,portal:!0,anchor:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.iconButton,"aria-label":c,"aria-haspopup":`menu`,"aria-expanded":i,onClick:()=>a(!i),children:/* @__PURE__ */ (0,o.jsx)(r.IconEllipsisOutlineRegular,{size:16})})})}function k_({useThreadSectionManage:e,dismiss:t,createSection:n,updateSection:r,deleteSection:i,notifySyncPending:a,t:s}){let c=e(e=>e);if(c===null)return null;if(c.mode!==`delete`){let e=c.mode===`rename`?c.section:void 0;return/* @__PURE__ */ (0,o.jsx)(A_,{initialName:e?.name??``,requireChange:e!==void 0,title:s(e?`section.rename.title`:`section.create.title`),submitLabel:s(e?`rename`:`section.create.action`),saveName:e?t=>r(e.id,t):n,dismiss:t,notifySyncPending:a,t:s},e?`rename:${e.id}`:`create`)}return/* @__PURE__ */ (0,o.jsx)(j_,{section:c.section,dismiss:t,deleteSection:i,notifySyncPending:a,t:s},`delete:${c.section.id}`)}function A_({initialName:e,requireChange:t,title:n,submitLabel:i,saveName:a,dismiss:c,notifySyncPending:l,t:u}){let[d,f]=(0,s.useState)(e),[p,m]=(0,s.useState)(`editing`),[h,g]=(0,s.useState)(null),_=(0,s.useRef)(!1),v=(0,s.useRef)(!1),y=d.trim(),b=y.length===0||t&&y===e,x=()=>{p!==`saving`&&c()},S=async()=>{if(!(v.current||b)){v.current=!0,m(`saving`),g(null);try{let e=await a(y);if(e.status===`unknown`){m(`unknown`),g(u(`section.outcomeUnknown`));return}c(),e.syncPending&&l()}catch(e){g(M_(e)),v.current=!1,m(`editing`)}}};return/* @__PURE__ */ (0,o.jsxs)(r.Modal,{phoneSidebar:!0,open:!0,onClose:x,closeLabel:u(`close`),title:n,footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,disabled:p===`saving`,onClick:x,children:u(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`primary`,disabled:p!==`editing`||b,onClick:()=>void S(),children:i})]}),children:[/* @__PURE__ */ (0,o.jsx)(`input`,{className:Z.renameInput,value:d,placeholder:u(`section.namePlaceholder`),"aria-label":u(`field.sectionName`),"data-modal-autofocus":!0,disabled:p!==`editing`,onFocus:t?e=>e.target.select():void 0,onChange:e=>{f(e.target.value),g(null)},onCompositionStart:()=>{_.current=!0},onCompositionEnd:()=>{_.current=!1},onKeyDown:e=>{e.key===`Enter`&&!_.current&&(e.preventDefault(),S())}}),h!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:h})]})}function j_({section:e,dismiss:t,deleteSection:n,notifySyncPending:i,t:a}){let[c,l]=(0,s.useState)(!1),[u,d]=(0,s.useState)(null),f=(0,s.useRef)(!1),p=()=>{f.current||t()},m=async()=>{if(!f.current){f.current=!0,l(!0),d(null);try{let r=await n(e.id);if(r.status!==`confirmed`){d(a(`section.outcomeUnknown`));return}t(),r.syncPending&&i()}catch(e){d(M_(e))}finally{f.current=!1,l(!1)}}};return/* @__PURE__ */ (0,o.jsxs)(r.Modal,{phoneSidebar:!0,open:!0,onClose:p,closeLabel:a(`close`),title:a(`section.delete.title`),description:a(`section.delete.desc`,{name:e.name}),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,disabled:c,onClick:p,children:a(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,className:Z.deleteAction,disabled:c,onClick:()=>void m(),children:a(`section.delete.action`)})]}),children:[c&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.deleteStatus,role:`status`,children:a(`section.delete.pending`)}),u!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:u})]})}function M_(e){return e instanceof Error?e.message:String(e)}function N_(e){return e.pendingInteraction!==void 0}function P_(e){return e.running||e.runningSubagentCount>0}function F_(e){return e.completed}function I_(e){return e.archived||e.blank?null:N_(e)||(e.tree?.activity.pendingInteraction??0)>0?0:P_(e)||(e.tree?.activity.running??0)>0?1:F_(e)||(e.tree?.activity.completed??0)>0?2:null}function L_(e){let t=/* @__PURE__ */ new Set,n=[],r=e=>{!e.archived&&!e.blank&&F_(e)&&!t.has(e.id)&&(t.add(e.id),n.push(e.id));for(let t of e.tree?.children??[])r(t)};for(let t of e)r(t);return n}function R_(e,t,n){let r=bh(e,{pinnedSessionIds:t.pinnedSessionIds,archivedSessionIds:t.archivedSessionIds,archivedFilter:`default`,...t.sectionedSessionIds===void 0?{}:{sectionedSessionIds:t.sectionedSessionIds}},n),i=[],a=0,o=0;for(let e=0;e<r.length;e++){let t=r[e],n=I_(t);n!==null&&(a+=Number(N_(t))+(t.tree?.activity.pendingInteraction??0),o+=Number(P_(t))+(t.tree?.activity.running??0),i.push({node:t,priority:n,updatedAt:t.tree?.updatedAt??t.updatedAt,index:e}))}i.sort((e,t)=>e.priority-t.priority||t.updatedAt-e.updatedAt||e.index-t.index);let s=i.map(e=>e.node),c=L_(s),l=c.length;return{rows:s,unreadSessionIds:c,pendingCount:a,runningCount:o,unreadCount:l,hasAttention:a>0||l>0}}let z_=`@deepseek-ai/dsh-client-ui-workspace/AnimatedRows.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(z_)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=z_,e.textContent=`.Jek-Ha_exits{contain:strict;pointer-events:none;position:absolute;inset:0;overflow:clip}`,document.head.appendChild(e)}var B_={exits:`Jek-Ha_exits`};function V_(e){return[...e.querySelectorAll(`[data-row-key]`)].filter(e=>e.offsetHeight>0&&!e.closest(`[inert]`))}function H_(e){if(!e)return;let t=V_(e),n=document.activeElement?.closest(`[data-row-key]`),r=t.find(e=>e===n)??t.find(e=>e.getAttribute(`aria-selected`)===`true`)??t[0];for(let e of t){let t=e===r?0:-1;(!e.hasAttribute(`tabindex`)||e.tabIndex!==t)&&(e.tabIndex=t)}}function U_(e){if(e.defaultPrevented||e.nativeEvent.isComposing||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let t=e.currentTarget,n=e.target;if(!(n instanceof HTMLElement)||!n.matches(`[data-row-key]`)||!t.contains(n))return;let r=V_(t),i=r.indexOf(n);if(i<0)return;let a=n.matches(`[role="treeitem"][aria-expanded]`),o=n.querySelector(`[data-thread-icon-toggle]`),s=()=>{o?o.click():n.click()},c;switch(e.key){case`ArrowDown`:c=r[i+1];break;case`ArrowUp`:c=r[i-1];break;case`Home`:c=r[0];break;case`End`:c=r.at(-1);break;case`ArrowRight`:a&&n.getAttribute(`aria-expanded`)===`false`?s():a&&(c=r[i+1]);break;case`ArrowLeft`:if(a&&n.getAttribute(`aria-expanded`)===`true`)s();else{let e=n.dataset.threadParent;if(e!==void 0){let t=n.dataset.rowKey??``,i=t.startsWith(`linked:`)?t.slice(0,t.indexOf(`:`,7)+1):t.startsWith(`recent:`)?`recent:`:`session:`;c=r.find(t=>t.dataset.rowKey===`${i}${e}`);break}let t=n.closest(`[data-sidebar-group]`),i=t?.querySelector(`[data-row-key^="workspace:"]`);i===n&&(t=t?.parentElement?.closest(`[data-sidebar-group]`)??null,i=t?.querySelector(`[data-row-key^="workspace:"]`)),c=i??void 0}break;case`Enter`:case` `:n.click();break;default:return}e.preventDefault(),c&&(c.focus({preventScroll:!0}),c.scrollIntoView({block:`nearest`}),H_(t))}function W_(e,t){return e.rowKeys.length===t.rowKeys.length&&e.rowKeys.every((e,n)=>e===t.rowKeys[n])}function G_(e,t){return e.bottom>t.top&&e.top<t.bottom&&e.right>t.left&&e.left<t.right}var K_=class extends s.Component{armed=!1;localList=(0,s.createRef)();overlay=(0,s.createRef)();movements=/* @__PURE__ */ new Map;exits=/* @__PURE__ */ new Map;get list(){return this.props.scrollRef??this.localList}componentDidMount(){H_(this.list.current)}getSnapshotBeforeUpdate(e){let t=this.list.current;if(W_(e,this.props)||e.resetKey!==this.props.resetKey||!e.ready||!this.props.ready||t===null)return null;let n=this.armed&&typeof t.animate==`function`&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,r=t.getBoundingClientRect(),i=this.readPositions(),a=new Set(this.props.rowKeys),o=/* @__PURE__ */ new Map;if(n)for(let[e,t]of i){if(a.has(e)||!G_(t.rect,r))continue;let n=t.element.cloneNode(!0);n.removeAttribute(`data-row-key`),n.inert=!0,n.style.setProperty(`--dsh-workspace-indent`,getComputedStyle(t.element).getPropertyValue(`--dsh-workspace-indent`)),o.set(e,{...t,element:n})}let s=null,c=0;for(let[e,t]of i)if(a.has(e)&&!this.movements.has(t.element)&&G_(t.rect,r)){s=e,c=t.rect.top-r.top;break}return{positions:i,removed:o,anchorViewportTop:c,anchorKey:s,animate:n}}componentDidUpdate(e,t,n){if(H_(this.list.current),n===null){(!W_(e,this.props)||e.resetKey!==this.props.resetKey||e.ready!==this.props.ready)&&this.clear();return}this.cancelMovements();let r=this.list.current,i=this.overlay.current;if(this.restoreScroll(n,r),!n.animate)return;let a=r.getBoundingClientRect(),o=i.getBoundingClientRect(),s=this.readPositions();for(let[e,t]of s){this.removeExit(e);let r=n.positions.get(e);if(!G_(t.rect,a)&&(r===void 0||!G_(r.rect,a)))continue;if(r===void 0){this.move(t.element,[{opacity:0},{opacity:1}],100);continue}let i=r.rect.left-t.rect.left,o=r.rect.top-t.rect.top;(i!==0||o!==0||r.opacity!==1)&&this.move(t.element,[{transform:`translate(${String(i)}px, ${String(o)}px)`,opacity:r.opacity},{transform:`translate(0, 0)`,opacity:1}],200)}for(let[e,t]of n.removed){let{element:n}=t;this.removeExit(e),Object.assign(n.style,{position:`absolute`,margin:`0`,transform:`none`,boxSizing:`border-box`,left:`${String(t.rect.left-o.left)}px`,top:`${String(t.rect.top-o.top)}px`,width:`${String(t.rect.width)}px`,height:`${String(t.rect.height)}px`}),i.append(n);let r=n.animate([{opacity:t.opacity},{opacity:0}],{duration:100,easing:`ease-out`,fill:`forwards`});this.exits.set(e,{element:n,animation:r}),r.onfinish=()=>{this.removeExit(e)}}}componentWillUnmount(){this.clear()}restoreScroll(e,t){if(e.anchorKey===null)return;let n=t.querySelector(`[data-row-key="${CSS.escape(e.anchorKey)}"]`);if(n===null)return;let r=n.getBoundingClientRect().top-t.getBoundingClientRect().top-e.anchorViewportTop;if(r===0)return;let i=t.scrollHeight-t.clientHeight;t.scrollTop=Math.min(Math.max(t.scrollTop+r,0),i)}readPositions(){let e=this.list.current.querySelectorAll(`[data-row-key]`);return new Map(Array.from(e,e=>[e.dataset.rowKey,{element:e,rect:e.getBoundingClientRect(),opacity:this.movements.has(e)?Number(getComputedStyle(e).opacity):1}]))}move(e,t,n){let r=e.animate(t,{duration:n,easing:`ease-out`});this.movements.set(e,r),r.onfinish=()=>{this.movements.delete(e),r.cancel()}}cancelMovements(){for(let e of this.movements.values())e.onfinish=null,e.cancel();this.movements.clear()}removeExit(e){let t=this.exits.get(e);t!==void 0&&(t.animation.onfinish=null,t.animation.cancel(),t.element.remove(),this.exits.delete(e))}clear(){this.cancelMovements();for(let e of this.exits.keys())this.removeExit(e)}render(){return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(`div`,{ref:this.list,className:this.props.className,role:`tree`,"aria-label":this.props.label,onScroll:this.props.onScroll,onKeyDown:U_,onFocusCapture:()=>H_(this.list.current),onPointerDownCapture:()=>{this.armed=!0},onKeyDownCapture:()=>{this.armed=!0},children:this.props.children}),/* @__PURE__ */ (0,o.jsx)(`div`,{ref:this.overlay,className:B_.exits,"aria-hidden":`true`})]})}};function q_({identity:e,ambient:t,titlePrefix:n,title:r,onIdentityClick:i,identityLabel:a,identityControls:s,identityExpanded:c,children:l}){let u=/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[e,/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.statusOverlay,children:t})]});return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[i?/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:`${J.slot} ${J.identityButton}`,onClick:i,"data-thread-icon-toggle":!0,"aria-label":a,title:a,"aria-expanded":c,"aria-controls":s,children:[u,/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.foldChevron,"aria-hidden":`true`})]}):/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.slot,children:u}),n,/* @__PURE__ */ (0,o.jsx)(`span`,{"data-session-title":!0,className:J.title,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.titleText,children:r})}),l]})}var J_=class{pendingDownId=void 0;orphanUpId=void 0;lateDownSeen=!1;activated=!1;down(e){this.activated=!1,this.orphanUpId===e?(this.orphanUpId=void 0,this.lateDownSeen=!0):this.pendingDownId=e}orphanUp(e){return this.pendingDownId===e?(this.pendingDownId=void 0,!1):(this.pendingDownId=void 0,this.orphanUpId=e,this.lateDownSeen=!1,!0)}needsFallback(){return!this.activated&&this.lateDownSeen}clicked(){this.activated=!0}takeFallback(){let e=!this.activated&&this.lateDownSeen;return this.lateDownSeen=!1,this.pendingDownId=void 0,this.orphanUpId=void 0,e}abandonPress(){this.pendingDownId=void 0}consumeFallback(){this.lateDownSeen=!1,this.pendingDownId=void 0,this.orphanUpId=void 0}cancel(){this.pendingDownId=void 0,this.orphanUpId=void 0,this.lateDownSeen=!1}};function Y_({host:e,variant:t=`workspace`,t:n}){let r=e?.displayName??n(`host.local`),i=e?.state===`connected`?n(`host.connected`):e?.state===`connecting`?n(`host.connecting`):n(`host.disconnected`),a=e?`${r} · ${i}`:r,s=e===void 0?void 0:Wf(e.hostId,e.color);return/* @__PURE__ */ (0,o.jsxs)(`span`,{className:X(J.hostBadge,t===`session`&&J.hostBadgeSession),"data-host-id":e?.hostId??`local`,"data-state":e?.state??`local`,"data-color":s,role:`img`,"aria-label":a,title:a,children:[e!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.hostDot,"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.hostLabel,children:r})]})}let X_=`codexhost.sidebar.hostScopeFilter.v1`,Z_=`codexhost:apply-host-scope-workspace-selection`;function Q_(e){return e.some(e=>e.remote!==void 0)}function $_(e){if(e.remote===void 0)return!1;let t=e.path??e.cwd;return t===void 0||t.trim()===``}function ev(e){return e.some(e=>e.remote?.hostId.startsWith(`remote-peer:`)===!0)}function tv(e){let t=[],n=/* @__PURE__ */ new Map;for(let r of e){let e=r.remote;if(e===void 0){t.push(r);continue}let i=n.get(e.hostId);i===void 0?n.set(e.hostId,{key:e.hostId,hostId:e.hostId,displayName:e.displayName,state:e.state,...e.color===void 0?{}:{color:e.color},workspaceCount:1,workspaces:[r]}):(i.workspaces.push(r),i.workspaceCount+=1,i.color===void 0&&e.color!==void 0&&(i.color=e.color))}return t.length===0&&n.size===0?[]:[{key:`local`,workspaceCount:t.length,workspaces:t},...n.values()]}function nv(e,t){return e.selectedHost===`all`||tv(t).some(t=>t.key===e.selectedHost)?e:{...e,selectedHost:`all`}}function rv(e,t,n){let r=tv(t),i=new Map(r.map(e=>[e.key,e])),a=n?.preserveHostKeys,o=e.selectedHost!==`all`&&e.selectedHost!==`local`&&!i.has(e.selectedHost)?`all`:e.selectedHost,s=o!==e.selectedHost,c={};for(let[t,n]of Object.entries(e.perHost)){let e=i.get(t);if(e===void 0){if(t!==`local`){a?.has(t)===!0?c[t]=n:s=!0;continue}n.workspaceIds.length>0?(s=!0,c[t]={mode:n.mode,workspaceIds:[]}):c[t]=n;continue}if(t!==`local`&&(e.state===`connecting`||e.state!==`connected`&&a?.has(t)===!0)){c[t]=n;continue}let r=new Set(e.workspaces.map(e=>e.workspaceId)),o=n.workspaceIds.filter(e=>r.has(e));o.length===n.workspaceIds.length?c[t]=n:(s=!0,c[t]={mode:n.mode,workspaceIds:o})}return s?{selectedHost:o,perHost:c}:e}function iv(e,t){let n=nv(e,t);return n.selectedHost!==`all`||tv(t).some(e=>n.perHost[e.key]?.mode===`selected`)}function av(e,t){let n=nv(t,e);return e.filter(e=>{let t=e.remote?.hostId??`local`;if(n.selectedHost===`local`){if(e.remote!==void 0)return!1}else if(n.selectedHost!==`all`&&e.remote?.hostId!==n.selectedHost)return!1;let r=n.perHost[t];return r?.mode!==`selected`||r.workspaceIds.includes(e.workspaceId)})}function ov(e){return typeof e==`string`?e:e.id}function sv(e){return typeof e==`string`?`local`:e.remote?.hostId??e.projectionValues?.remoteHost?.hostId??`local`}function cv(e,t){if(!Q_(t))return!0;let n=nv(e,t);return(n.selectedHost===`all`||n.selectedHost===`local`)&&n.perHost.local?.mode!==`selected`}function lv(e,t,n=av(t,e)){if(!Q_(t))return!0;let r=nv(e,t);return r.selectedHost!==`all`&&r.selectedHost!==`local`?!1:r.perHost.local?.mode!==`selected`||n.some(e=>e.remote===void 0)}function uv(e,t,n,r,i){let a=nv(r,n);if(!iv(a,n))return[...e];let o=t instanceof Set?t:new Set(t),s=/* @__PURE__ */ new Set,c=/* @__PURE__ */ new Set;for(let e of n){let t=o.has(e.workspaceId);for(let n of e.sessionIds)s.add(n),t&&c.add(n)}return e.filter(e=>{let t=ov(e),n=i?.get(t)??t;if(c.has(n))return!0;if(!s.has(n)){let t=sv(e);return(a.selectedHost===`all`||a.selectedHost===t)&&a.perHost[t]?.mode!==`selected`}return!1})}function dv(e,t){if(t===void 0||t.mode!==`selected`)return e.workspaceCount;let n=new Set(t.workspaceIds),r=0;for(let t of e.workspaces)n.has(t.workspaceId)&&(r+=1);return r}function fv(e,t){return e.selectedHost===t?e:{...e,selectedHost:t}}function pv(e,t,n,r){let i=e.perHost[t],a=n===`selected`?i===void 0?[...new Set(r)]:[...i.workspaceIds]:i===void 0?[]:[...i.workspaceIds];return{...e,perHost:{...e.perHost,[t]:{mode:n,workspaceIds:a}}}}function mv(e,t,n,r){let i=e.perHost[t],a=i?.mode===`selected`?i.workspaceIds:[...r],o=a.includes(n)?a.filter(e=>e!==n):[...a,n];return{...e,perHost:{...e.perHost,[t]:{mode:`selected`,workspaceIds:o}}}}function hv(e,t,n){return{...e,perHost:{...e.perHost,[t]:{mode:`selected`,workspaceIds:[...new Set(n)]}}}}function gv(){return{selectedHost:`all`,perHost:{}}}function _v(e,t,n){let r=nv(e,n),i=t?.remote?.hostId??`local`,a=r.selectedHost,o=r.perHost,s=!1;a!==`all`&&a!==i&&(a=`all`,s=!0);let c=o[i];return c?.mode===`selected`&&(t===void 0?(o={...o,[i]:{...c,mode:`all`}},s=!0):c.workspaceIds.includes(t.workspaceId)||(o={...o,[i]:{mode:`selected`,workspaceIds:[...c.workspaceIds,t.workspaceId]}},s=!0)),s?{selectedHost:a,perHost:o}:e}function vv(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function yv(e){if(e===null||e===``)return gv();try{let t=JSON.parse(e);if(!vv(t))return gv();let n=typeof t.selectedHost==`string`&&t.selectedHost.trim()!==``?t.selectedHost:`all`,r={};if(vv(t.perHost))for(let[e,n]of Object.entries(t.perHost)){if(e===``||!vv(n)||n.mode!==`all`&&n.mode!==`selected`)continue;let t=Array.isArray(n.workspaceIds)?[...new Set(n.workspaceIds.filter(e=>typeof e==`string`))]:[];r[e]={mode:n.mode,workspaceIds:t}}return{selectedHost:n,perHost:r}}catch{return gv()}}function bv(e){try{let t=e===void 0?typeof window<`u`?window.localStorage:null:e;return t===null?gv():yv(t.getItem(X_))}catch{return gv()}}function xv(e,t){try{let n=t===void 0?typeof window<`u`?window.localStorage:null:t;if(n===null)return;n.setItem(X_,JSON.stringify(e))}catch{}}let Sv={},Cv=(0,s.createContext)({t:e=>e,forest:[],expansion:Sv,rows:e=>nh(e,Sv),toggle:()=>{},markCompletionsRead:()=>{},collapseStyle:`summary`,stylePrompt:void 0,dismissStylePrompt:()=>{},setCollapseStyle:async()=>!1,rootId:e=>e,reveal:()=>{},selectSidebarRow:()=>{},isSidebarSelection:()=>!1});function wv(){return(0,s.useContext)(Cv)}function Tv({browser:e,children:t}){let{useSessions:n,useStore:r,useWorkspaces:i,actions:a,useWorkspacePreferences:c,setThreadTreeCollapseStyle:l}=e,u=c(e=>e),d=__(u.user),f=u.value?.threadTreeCollapseStyle??`summary`,[p,m]=(0,s.useState)(),h=(0,s.useCallback)(()=>m(void 0),[]),g=n(e=>e),_=i(e=>e.pinnedSessionIds),v=i(e=>e.archivedSessionIds),y=i(e=>e.threadSections),b=r(e=>e.threadExpansion??Sv),x=r(e=>e.archivedFilter??`default`),S=(0,s.useMemo)(()=>bh(g,{pinnedSessionIds:_,archivedSessionIds:v,archivedFilter:x,...x===`only`||!y?.length?{}:{sectionedSessionIds:new Set(y.flatMap(e=>e.threadIds))}},/* @__PURE__ */ new Map),[g,_,v,x,y]),C=(0,s.useMemo)(()=>{let e=/* @__PURE__ */ new Map;for(let t of S){let n=[{node:t,ancestors:[]}];for(let r=n.pop();r!==void 0;r=n.pop()){e.set(r.node.id,{root:t,ancestors:r.ancestors});for(let e of r.node.tree?.children??[])n.push({node:e,ancestors:[...r.ancestors,r.node.id]})}}return e},[S]),w=(0,s.useRef)(void 0),T=(0,s.useCallback)(e=>w.current===e,[]),E=(0,s.useCallback)(e=>{w.current=e,a.setThreadsExpanded(C.get(e)?.ancestors??[],!0)},[a,C]),D=(0,s.useCallback)(e=>{w.current=void 0;let t=C.get(e);t!==void 0&&a.setThreadsExpanded(t.ancestors,!0)},[a,C]),ee=Object.values(g.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,te=(0,s.useRef)(``);(0,s.useEffect)(()=>{ee===void 0?te.current=``:C.get(ee)!==void 0&&te.current!==ee&&(te.current=ee,T(ee)||D(ee))},[ee,T,D,C]);let ne=(0,s.useMemo)(()=>({t:e.t,forest:S,expansion:b,rows:e=>nh(e,b),toggle:(e,t,n)=>{a.setThreadsExpanded([e],t),t&&n!==void 0&&!d&&m(n)},markCompletionsRead:e.markCompletionsRead??(()=>{}),collapseStyle:f,stylePrompt:d?void 0:p,dismissStylePrompt:h,setCollapseStyle:l,rootId:e=>C.get(e)?.root.id??e,reveal:D,selectSidebarRow:E,isSidebarSelection:T}),[e.t,e.markCompletionsRead,a,S,b,C,D,E,T,f,d,p,h,l]);return/* @__PURE__ */ (0,o.jsx)(Cv.Provider,{value:ne,children:t})}let Ev=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeControls.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ev)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Ev,e.textContent=`.jGgv6G_branch{--dsh-thread-row-height:32px;--dsh-thread-icon-size:16px;--dsh-thread-icon-center-y:calc(var(--dsh-thread-row-height) / 2);--dsh-thread-row-gap:2px;min-width:0;position:relative}.jGgv6G_branch:has(>:first-child [data-harness-id]),.jGgv6G_branch:has(>:first-child [data-role-avatar]){--dsh-thread-icon-size:14px}.jGgv6G_branch:has(>:first-child [data-harness-id])>.jGgv6G_children,.jGgv6G_branch:has(>:first-child [data-role-avatar])>.jGgv6G_children{--dsh-thread-parent-icon-size:14px}.jGgv6G_branch:has(>:first-child [data-role-avatar])>.jGgv6G_children{--dsh-thread-guide-parent-gap:15px}.jGgv6G_children{gap:var(--dsh-thread-row-gap);margin-top:var(--dsh-thread-row-gap);--dsh-thread-parent-icon-size:16px;--dsh-thread-guide-parent-gap:12px;--dsh-thread-guide-start:calc(var(--dsh-thread-guide-parent-gap) - (var(--dsh-thread-row-height) - var(--dsh-thread-parent-icon-size)) / 2 - var(--dsh-thread-row-gap));--dsh-thread-guide-axis:calc(8px + var(--dsh-workspace-indent,0px) + var(--dsh-thread-guide-indent) + var(--dsh-thread-parent-icon-size) / 2 + .5px);flex-direction:column;display:flex;position:relative}.jGgv6G_children .jGgv6G_children{--dsh-thread-guide-parent-gap:10px}.jGgv6G_children[hidden]{display:none}.jGgv6G_children[data-thread-guide]:before,.jGgv6G_children[data-thread-guide]>.jGgv6G_branch:before{content:"";pointer-events:none;z-index:1;position:absolute;inset-inline-start:var(--dsh-thread-guide-axis)}.jGgv6G_children[data-thread-guide]:before{top:var(--dsh-thread-guide-start);height:max(0px, calc(-1 * var(--dsh-thread-guide-start)));background:var(--dsw-alias-border-l2);width:1px}.jGgv6G_children[data-thread-guide]>.jGgv6G_branch:before{--dsh-thread-guide-stem-start:0px;--dsh-thread-guide-stem-end:0px;top:0;bottom:calc(-1 * var(--dsh-thread-row-gap));width:calc(24px - var(--dsh-thread-parent-icon-size) / 2 - 6.5px);background:var(--dsw-alias-border-l2);mask:linear-gradient(transparent var(--dsh-thread-guide-stem-start), black 0) 0 0 / 1px calc(100% - var(--dsh-thread-guide-stem-end)) no-repeat, url("data:image/svg+xml,<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 11 8\\" preserveAspectRatio=\\"none\\"><path d=\\"M.5 0V1Q.5 3.3 2.5 4.5L10.5 7.5\\" fill=\\"none\\" stroke=\\"black\\" stroke-width=\\"1\\" vector-effect=\\"non-scaling-stroke\\"/></svg>") 0 calc(var(--dsh-thread-icon-center-y) - 8px) / 100% 8px no-repeat}.jGgv6G_children[data-thread-guide]>.jGgv6G_branch:first-child:before{--dsh-thread-guide-stem-start:max(0px, var(--dsh-thread-guide-start))}.jGgv6G_children[data-thread-guide]>.jGgv6G_branch:last-child:before{--dsh-thread-guide-stem-end:8px;bottom:calc(100% - var(--dsh-thread-icon-center-y))}.jGgv6G_summary{appearance:none;width:calc(100% - var(--dsh-thread-icon-size));min-width:0;color:var(--dsw-alias-label-tertiary);font:inherit;text-align:start;overflow-wrap:anywhere;cursor:pointer;-webkit-tap-highlight-color:transparent;background:0 0;border:0;border-radius:6px;margin-block-end:2px;margin-inline-start:var(--dsh-thread-icon-size);padding:2px 8px;font-size:11px;line-height:18px;display:block}.jGgv6G_summary [data-thread-tree-activity=running]{color:color-mix(in srgb, var(--dsw-alias-state-business-primary), var(--dsw-alias-state-success-primary))}.jGgv6G_summary [data-thread-tree-activity=pending]{color:var(--dsw-alias-state-warn-primary)}.jGgv6G_summary [data-thread-tree-activity=completed]{color:var(--dsw-alias-state-business-primary)}@media (hover:hover) and (pointer:fine){.jGgv6G_summary:hover{background:color-mix(in srgb, var(--dsw-alias-label-primary) 4%, transparent)}}.jGgv6G_summary:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}@media (hover:none),(pointer:coarse){.jGgv6G_branch{--dsh-thread-row-height:44px}.jGgv6G_summary{min-height:24px;padding-block:3px}}[data-phone-drawer] .jGgv6G_branch{--dsh-thread-row-height:44px}[data-phone-drawer] .jGgv6G_branch:has(>:first-child>[data-thread-summary]){--dsh-thread-icon-center-y:14px}`,document.head.appendChild(e)}var Dv={branch:`jGgv6G_branch`,children:`jGgv6G_children`,summary:`jGgv6G_summary`};function Ov(e){return[{state:`running`,count:e.running},{state:`pending`,count:e.pendingInteraction},{state:`completed`,count:e.completed}]}function kv(e){return e.pendingInteraction>0?`pending`:e.running>0?`running`:e.completed>0?`completed`:`idle`}function Av(e,t,n){return[n(`threadTree.children`,{n:e}),...Ov(t).filter(e=>e.count>0).map(e=>n(`threadTree.${e.state}`,{n:e.count}))].join(` · `)}function jv({count:e,activity:t,t:n}){return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[n(`threadTree.children`,{n:e}),Ov(t).filter(e=>e.count>0).map(e=>/* @__PURE__ */ (0,o.jsx)(`span`,{"data-thread-tree-activity":e.state,children:` · ${n(`threadTree.${e.state}`,{n:e.count})}`},e.state))]})}let Mv=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeRing.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Mv)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Mv,e.textContent=`.yY-O0a_ring{inset-inline-start:50%;margin-inline-start:-11px;pointer-events:none;width:22px;height:22px;color:var(--dsw-alias-state-business-primary);margin-top:-11px;position:absolute;top:50%}.yY-O0a_ring svg{width:100%;height:100%;display:block}.yY-O0a_ring circle{stroke:currentColor;stroke-width:1.5px}.yY-O0a_ring[data-thread-ring=pending]{color:var(--dsw-alias-state-warn-primary)}.yY-O0a_ring[data-thread-ring=running]{color:color-mix(in srgb, var(--dsw-alias-state-business-primary), var(--dsw-alias-state-success-primary))}.yY-O0a_ring[data-thread-ring=running] svg{will-change:transform;contain:layout style paint;animation:1.8s linear infinite yY-O0a_spin}.yY-O0a_ring[data-thread-ring=running] circle{stroke-dasharray:48 16.4}.yY-O0a_ring[data-thread-ring=idle]{color:var(--dsw-alias-label-tertiary);opacity:.55}.yY-O0a_ring[data-thread-ring=idle] circle{stroke-width:1px;stroke-dasharray:1.5 3}@keyframes yY-O0a_spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.yY-O0a_ring[data-thread-ring=running] svg{animation:none}}`,document.head.appendChild(e)}var Nv={ring:`yY-O0a_ring`,spin:`yY-O0a_spin`};function Pv({activity:e}){return/* @__PURE__ */ (0,o.jsx)(`span`,{className:Nv.ring,"data-thread-ring":kv(e),"aria-hidden":`true`,children:/* @__PURE__ */ (0,o.jsx)(`svg`,{viewBox:`0 0 22 22`,fill:`none`,children:/* @__PURE__ */ (0,o.jsx)(`circle`,{cx:`11`,cy:`11`,r:`10.25`})})})}let Fv=[{title:`threadTree.style.samplePending`,activity:{pendingInteraction:1,running:0,completed:0}},{title:`threadTree.style.sampleRunning`,activity:{pendingInteraction:0,running:1,completed:0}},{title:`threadTree.style.sampleUnread`,activity:{pendingInteraction:0,running:0,completed:1}},{title:`threadTree.style.sampleRead`,activity:{pendingInteraction:0,running:0,completed:0}}];function Iv({style:e,t}){return/* @__PURE__ */ (0,o.jsx)(`div`,{className:u_.preview,"aria-hidden":`true`,children:Fv.map(({title:n,activity:r})=>/* @__PURE__ */ (0,o.jsx)(`div`,{className:Dv.branch,children:/* @__PURE__ */ (0,o.jsxs)(`div`,{className:`${J.sessionRow} ${u_.sampleRow}`,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:J.sessionMain,children:/* @__PURE__ */ (0,o.jsx)(q_,{title:t(n),identity:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(`span`,{"data-harness-id":`codex`,className:u_.sampleIcon,children:/* @__PURE__ */ (0,o.jsx)(`img`,{src:`/harness-icons/codex`,width:14,height:14,alt:``})}),e===`ring`&&/* @__PURE__ */ (0,o.jsx)(Pv,{activity:r})]})})}),e===`summary`&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:`${Dv.summary} ${u_.sampleSummary}`,children:/* @__PURE__ */ (0,o.jsx)(jv,{count:2,activity:r,t})})]})},n))})}function Lv({style:e,setStyle:t,onLater:n,onExit:r,t:i}){let a=(0,s.useId)(),[c,l]=(0,s.useState)(e),u=(0,s.useRef)(null),d=(0,s.useRef)(r);d.current=r,(0,s.useLayoutEffect)(()=>{let e=u.current;return e?.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:`instant`}),()=>{e?.contains(document.activeElement)&&d.current()}},[]);let{busy:f,failed:p,save:m}=f_(t);return/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:u,className:u_.prompt,"data-thread-style-prompt":!0,role:`region`,"aria-labelledby":a,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:u_.promptHeading,children:[/* @__PURE__ */ (0,o.jsx)(`strong`,{id:a,children:i(`threadTree.style.promptTitle`)}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:u_.later,disabled:f,onClick:n,children:i(`threadTree.style.later`)})]}),/* @__PURE__ */ (0,o.jsx)(`p`,{className:u_.hint,children:i(`threadTree.style.hint`)}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:u_.comparison,role:`radiogroup`,"aria-labelledby":a,"aria-busy":f,onKeyDown:e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault(),e.stopPropagation();let t=e.key===`Home`||e.key===`End`?d_[e.key===`Home`?0:1]:d_[+(c===`summary`)];e.currentTarget.querySelector(`[data-thread-style-choice="${t}"]`)?.focus()},children:d_.map(t=>/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`radio`,className:u_.choice,"data-thread-style-choice":t,"aria-disabled":f,"aria-checked":e===t,"aria-labelledby":`${a}-${t}`,"aria-describedby":`${a}-${t}-description`,tabIndex:c===t?0:-1,onFocus:()=>l(t),onClick:()=>void m(t),children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:u_.choiceTitle,id:`${a}-${t}`,children:i(`threadTree.style.${t}`)}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:u_.choiceSubtitle,id:`${a}-${t}-description`,children:i(`threadTree.style.${t}Subtitle`)}),/* @__PURE__ */ (0,o.jsx)(Iv,{style:t,t:i})]},t))}),p&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:u_.error,role:`alert`,children:i(`threadTree.style.error`)})]})}let Rv=(0,s.createContext)(void 0),zv=()=>(0,s.useContext)(Rv);function Bv({roots:e,children:t}){return e.map(e=>/* @__PURE__ */ (0,o.jsx)(Vv,{node:e,renderRow:t},e.id))}function Vv({node:e,renderRow:t}){let n=(0,s.useId)(),{expansion:r,stylePrompt:i,dismissStylePrompt:a,collapseStyle:c,setCollapseStyle:l,t:u}=wv(),d=r[e.id]===!0,f=e.tree?.depth??0,p=e.tree?.children??[];return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Dv.branch,"data-thread-branch":e.id,children:[/* @__PURE__ */ (0,o.jsx)(Rv.Provider,{value:n,children:t(e)}),d&&i===n&&/* @__PURE__ */ (0,o.jsx)(Lv,{style:c,setStyle:l,onLater:a,onExit:()=>document.querySelector(`[data-thread-icon-toggle][aria-controls="${CSS.escape(n)}"]`)?.focus({preventScroll:!0}),t:u}),p.length>0&&/* @__PURE__ */ (0,o.jsx)(`div`,{id:n,role:`group`,hidden:!d,"data-thread-guide":d&&f<3?``:void 0,className:Dv.children,style:{"--dsh-thread-guide-indent":`${Math.min(f,3)*24}px`},children:d&&/* @__PURE__ */ (0,o.jsx)(Bv,{roots:p,children:t})})]})}function Hv({node:e,title:t,toggle:n,t:r}){let i=zv(),a=(0,s.useRef)(null);(0,s.useLayoutEffect)(()=>{let e=a.current;return()=>{e!==null&&document.activeElement===e&&e.closest(`[data-row-key]`)?.querySelector(`[data-thread-icon-toggle]`)?.focus({preventScroll:!0})}},[]);let c=e.tree;if(!c||c.descendantCount===0)return null;let l=Av(c.descendantCount,c.activity,r);return/* @__PURE__ */ (0,o.jsx)(`button`,{ref:a,type:`button`,"data-thread-summary":!0,className:Dv.summary,"aria-label":r(`threadTree.expandSummary`,{title:t,summary:l}),"aria-expanded":!1,"aria-controls":i,onClick:e=>{e.stopPropagation(),e.currentTarget.closest(`[data-row-key]`)?.querySelector(`[data-thread-icon-toggle]`)?.focus({preventScroll:!0}),n()},children:/* @__PURE__ */ (0,o.jsx)(jv,{count:c.descendantCount,activity:c.activity,t:r})})}function Uv(e){return e!=null&&e.id.length>0&&e.id!==`01984de2-8f74-7c91-a3b2-5c5e937cf318`}let Wv=`(hover: hover) and (pointer: fine)`;function Gv(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(Wv).matches}function Kv(e){return!(!e.nativeThreadIds.has(e.sessionId)||e.blank===!0||e.archived===!0||e.archivedSessionIds.includes(e.sessionId)||e.pinned===!0||e.pinnedSessionIds.includes(e.sessionId)||e.remote===!0||(e.depth??0)>0||e.movingSessionIds?.has(e.sessionId)===!0)}function qv(e){return e.moving&&(e.depth??0)===0&&e.blank!==!0&&e.archived!==!0}function Jv(e,t){if(t!==void 0)return t.find(t=>Uv(t)&&t.threadIds.includes(e))}function Yv(e,t){if(!Uv(e)||t.archivedFilter===`only`)return[];let n=new Set(t.pinnedSessionIds),r=new Set(t.archivedSessionIds),i=/* @__PURE__ */ new Set,a=[];for(let o of e.threadIds){if(i.has(o)||t.visibleSessionIds!=null&&!t.visibleSessionIds.has(o))continue;let e=t.byId[o];e===void 0||e.blank||e.origin===`subagent`||r.has(o)||n.has(o)||(i.add(o),a.push(o))}return a}function Xv(e,t,n,r){let i=n??e,a=i!==``&&!t.some(({id:e})=>e===i);return{effectiveTarget:i,targetDeleted:a,canSubmit:!r&&n!==void 0&&!a&&n!==e}}function Zv(e,t){if(e.target!==e.currentTarget)return null;let n=t===null?null:String(t),r=null,i=0;for(let t of e.currentTarget.children){let a=t.getAttribute(`data-thread-branch`);if(a===null||n!==null&&t.querySelector(`[data-thread-pinned]`)?.getAttribute(`data-thread-pinned`)!==n){r=null;continue}let{top:o,bottom:s}=t.getBoundingClientRect();if(r!==null&&i<=e.clientY&&e.clientY<=o)return{id:r,half:`after`};r=a,i=s}return null}function Qv(e){return!(e.committed||e.cancelled||e.dropEffect===`copy`)}function $v(e,t,n,r){if(t.kind===`unsectioned`){let t=n.find(t=>t.id===e.sourceSectionId);return t===void 0||!Uv(t)||!t.threadIds.includes(e.sessionId)?null:{sessionId:e.sessionId,sectionId:null,expectedSourceSectionId:t.id}}let i=n.find(e=>e.id===t.sectionId);if(i===void 0||!Uv(i))return null;if(t.kind===`section-end`)return e.sourceSectionId===i.id&&i.threadIds.length>0&&i.threadIds[i.threadIds.length-1]===e.sessionId?null:{sessionId:e.sessionId,sectionId:i.id,beforeSessionId:null};if(t.targetSessionId===e.sessionId||!i.threadIds.includes(t.targetSessionId))return null;let a=r?.get(i.id)??i.threadIds,o=a.indexOf(t.targetSessionId);if(o===-1)return null;if(t.half===`before`){if(e.sourceSectionId===i.id){let t=a.indexOf(e.sessionId);if(t!==-1&&o===t+1)return null}return{sessionId:e.sessionId,sectionId:i.id,beforeSessionId:t.targetSessionId}}let s=a[o+1];return s===e.sessionId?null:s===void 0?e.sourceSectionId===i.id&&i.threadIds.length>0&&i.threadIds[i.threadIds.length-1]===e.sessionId?null:{sessionId:e.sessionId,sectionId:i.id,beforeSessionId:null}:i.threadIds.includes(s)?{sessionId:e.sessionId,sectionId:i.id,beforeSessionId:s}:{sessionId:e.sessionId,sectionId:i.id,beforeSessionId:null}}function ey(e,t,n,r){if(!Uv(n))return null;let i=r.indexOf(e);if(i===-1)return null;if(t===`up`){if(i<=0)return null;let t=r[i-1];return t===void 0||t===e||!n.threadIds.includes(t)?null:{sessionId:e,sectionId:n.id,beforeSessionId:t}}if(i>=r.length-1)return null;let a=r[i+2];return a===e?null:a===void 0||!n.threadIds.includes(a)?{sessionId:e,sectionId:n.id,beforeSessionId:null}:{sessionId:e,sectionId:n.id,beforeSessionId:a}}function ty(e){let t=/* @__PURE__ */ new Set,n=(0,i.createSnapshotStore)(/* @__PURE__ */ new Set);return{movingSessionIds:n,isMoving:e=>t.has(e),async move(r,i={}){if(t.has(r.sessionId))return{status:`skipped-in-flight`};t.add(r.sessionId),n.set(new Set(t));try{let t=await e.execute(r.sessionId,r.sectionId,r.beforeSessionId,r.expectedSourceSectionId);return t?.status===`unknown`&&i.notifyOnError!==!1&&e.onUnknown?.(),t??{status:`committed`}}catch(t){return i.notifyOnError!==!1&&e.onError?.(t),{status:`failed`,error:t}}finally{t.delete(r.sessionId),n.set(new Set(t))}}}}let ny=(e,t)=>{let n=e instanceof Element?e:null;return n===null||t===null||!t.contains(n)||n.closest(`button, a, input, textarea, select, [role='menuitem'], [data-row-actions]`)!==null},ry=/* @__PURE__ */ new Set;function iy(e){return e(ry)}function ay(e,t){return e.blank?t(`session.new`):e.title||t(`session.untitled`)}function oy(e,t,n){let{unit:i,n:a}=(0,r.relativeTime)(e,t);return i===`now`?n(`time.now`):n(`time.${i}`,{n:a})}function sy(e,t,n){let{unit:i,n:a}=(0,r.relativeTime)(e,t);return i===`now`?n(`time.now`):n(`time.ago`,{t:n(`time.${i}`,{n:a})})}function cy(e,t){let n=new Date(e),r=e=>String(e).padStart(2,`0`);return t(`hover.created`,{time:`${t(`date.ymd`,{y:n.getFullYear(),m:n.getMonth()+1,d:n.getDate()})} ${r(n.getHours())}:${r(n.getMinutes())}`})}function ly({label:e,cwd:t,createdAt:n,t:r}){return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:J.hoverContent,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:J.hoverTitle,children:e}),t!==void 0&&t!==``&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:J.hoverPath,children:t}),n!==void 0&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:J.hoverTime,children:cy(n,r)})]})}function uy(e){let t=e.currentTarget.getBoundingClientRect();return e.clientY<t.top+t.height/2?`before`:`after`}function dy({color:e,state:t,className:n}){return/* @__PURE__ */ (0,o.jsx)(`span`,{className:X(J.remoteFolderGlobe,n),"data-color":e,"data-state":t,"aria-hidden":`true`,children:/* @__PURE__ */ (0,o.jsxs)(`svg`,{viewBox:`0 0 12 12`,width:`10`,height:`10`,fill:`none`,children:[/* @__PURE__ */ (0,o.jsx)(`circle`,{cx:`6`,cy:`6`,r:`4.6`,stroke:`currentColor`,strokeWidth:`1.2`}),/* @__PURE__ */ (0,o.jsx)(`ellipse`,{cx:`6`,cy:`6`,rx:`2.1`,ry:`4.6`,stroke:`currentColor`,strokeWidth:`1.05`}),/* @__PURE__ */ (0,o.jsx)(`path`,{d:`M1.6 6h8.8`,stroke:`currentColor`,strokeWidth:`1.05`})]})})}function fy({group:e,foldedActivity:t,onToggle:n,onCreate:i,copyWorkingDirectory:a,pin:c,actions:l,drag:u,showHost:d=!0,home:f,newShortcut:p,t:m}){let h=e,g=t===void 0?void 0:{pending:`warning`,running:`ongoing`,completed:`done`,idle:void 0}[kv(t)],_=e.remote?void 0:l,v=u,y=$_(h),b=h.workspaceId===void 0?m(`group.ungrouped`):y?m(`group.remoteOtherSessions`):h.label,x=h.remote===void 0?void 0:Wf(h.remote.hostId,h.remote.color),S=d&&h.workspaceId!==void 0&&h.remote!==void 0,[C,w]=(0,s.useState)(!1),[T,E]=(0,s.useState)(null),D=(0,s.useRef)(null),ee=m(c?.pinned?`menu.unpinWorkspace`:`menu.pinWorkspace`),te=c?.pinned?r.IconPinFillRegular:r.IconPinOutlineRegular,ne=[...c?[{id:`pin`,label:ee,icon:/* @__PURE__ */ (0,o.jsx)(te,{})}]:[],...h.cwd!==void 0&&h.cwd.trim()!==``?[{id:`copy-working-directory`,label:m(`menu.copyWorkingDirectory`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconCopyOutlineRegular,{})}]:[],..._?[{id:`rename`,label:m(`rename`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconEditOutlineRegular,{})},..._.defaultHarness?[{id:`defaultHarness`,label:m(`defaultHarness.title`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconSettingsOutlineRegular,{})}]:[],..._.moveToSection?[{id:`move`,label:m(`menu.moveToSection`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconFolderCloseRegular,{})}]:[],{id:`delete`,label:m(`delete.workspace`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconTrashOutlineRegular,{}),danger:!0}]:[]],re=/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(J.projectRow,C&&J.menuOpen),"data-row-key":`workspace:${e.key}`,role:`treeitem`,"aria-expanded":h.expanded,tabIndex:-1,onContextMenu:e=>{ne.length&&!e.target.closest(`button`)&&(e.preventDefault(),E(new DOMRect(e.clientX,e.clientY,0,0)),w(!0))},onKeyDown:e=>{e.target===e.currentTarget&&ne.length&&(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`)&&(e.preventDefault(),E(null),w(!0))},onClick:n,draggable:v!==void 0,onDragStart:v===void 0?void 0:e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,h.key),v.start()},onDragEnd:v?.end,children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:X(J.slot,h.expanded&&J.folderExpanded),children:[y?/* @__PURE__ */ (0,o.jsx)(r.IconQueueOutlineRegular,{size:16}):h.expanded?/* @__PURE__ */ (0,o.jsx)(r.IconFolderOpenRegular,{}):/* @__PURE__ */ (0,o.jsx)(r.IconFolderCloseRegular,{}),S&&h.remote&&x!==void 0&&/* @__PURE__ */ (0,o.jsx)(dy,{color:x,state:h.remote.state})]}),S&&h.remote?/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:J.remoteHostText,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.title,children:b}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.remoteHostMeta,children:h.remote.displayName})]}),g===void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.remoteHostStatusDot,"data-state":h.remote.state,"aria-hidden":`true`})]}):/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.projectText,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.title,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.titleText,children:b})})}),g!==void 0&&t!==void 0&&/* @__PURE__ */ (0,o.jsxs)(`span`,{className:J.projectActivity,"data-project-activity":g,children:[/* @__PURE__ */ (0,o.jsx)(r.StateDot,{state:g,size:g===`ongoing`?16:void 0}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.visuallyHidden,children:Ov(t).filter(e=>e.count>0).map(e=>m(`threadTree.${e.state}`,{n:e.count})).join(` · `)})]}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:J.rowActions,children:[ne.length>0&&/* @__PURE__ */ (0,o.jsx)(r.Menu,{open:C,onClose:()=>{w(!1)},items:ne,onSelect:e=>{w(!1),e===`pin`&&c?.toggle(),e===`copy-working-directory`&&h.cwd!==void 0&&a(h.cwd),e===`rename`&&_?.rename(),e===`defaultHarness`&&_?.defaultHarness?.(D.current),e===`move`&&_?.moveToSection?.(),e===`delete`&&_?.delete()},portal:!0,autoFocus:!0,getAnchorRect:T===null?void 0:()=>T,anchor:/* @__PURE__ */ (0,o.jsx)(`button`,{ref:D,type:`button`,className:J.iconButton,"aria-label":m(`actions.workspace.aria`,{name:b}),"aria-haspopup":`menu`,"aria-expanded":C,onClick:e=>{e.stopPropagation(),E(null),w(e=>!e)},children:/* @__PURE__ */ (0,o.jsx)(r.IconEllipsisOutlineRegular,{})})}),(!h.remote||h.remote.state===`connected`&&!y)&&/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:m(`actions.newSession`),shortcutKeys:p?.keys,side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:J.iconButton,"aria-keyshortcuts":p?.aria,"aria-label":m(`actions.newSession.aria`,{name:b}),onClick:e=>{e.stopPropagation(),i()},children:/* @__PURE__ */ (0,o.jsx)(r.IconNewChatOutlineRegular,{})})})]})]}),ie=h.cwd!==void 0&&h.cwd!==``?h.cwd:void 0;return h.workspaceId===void 0||ie===void 0&&h.createdAt===void 0?re:/* @__PURE__ */ (0,o.jsx)(r.HoverCard,{anchor:re,content:/* @__PURE__ */ (0,o.jsx)(ly,{label:b,cwd:ie===void 0?void 0:Ym(ie,f),createdAt:h.createdAt,t:m}),openDelayMs:800,disabled:C,copyText:ie,copyLabel:m(`copy`),copiedLabel:m(`hover.copied`)})}function py({node:e,now:t,renderSlot:n,t:i}){let a=gg(e,i).filter(t=>!e.archived||t.state!==`done`&&t.state!==`idle`),s=e.remote===void 0?void 0:Wf(e.remote.hostId,e.remote.color),c=e.remote?.state===`connected`?i(`host.connected`):e.remote?.state===`connecting`?i(`host.connecting`):i(`host.disconnected`);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:J.hoverContent,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:J.hoverTitle,children:ay(e,i)}),e.remote&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:J.hoverHost,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.hoverHostDot,"data-color":s,"data-state":e.remote.state,"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:`${e.remote.displayName} · ${c}`})]}),e.cwd&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:J.hoverPath,children:e.cwd}),!e.blank&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:J.hoverTime,children:sy(e.updatedAt,t,i)}),n(`sidebar.session.row.hover`,{sessionId:e.id}),a.map(e=>/* @__PURE__ */ (0,o.jsxs)(`div`,{className:J.hoverStatus,children:[/* @__PURE__ */ (0,o.jsx)(r.StateDot,{state:e.state}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:e.label})]},e.label)),e.archived&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(J.hoverStatus,J.hoverArchived),children:[/* @__PURE__ */ (0,o.jsx)(r.IconArchiveOutlineRegular,{size:16}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:i(`row.archived`)})]})]})}function my({result:e,currentId:t,onOpen:n,onUnarchive:i,t:a}){let s=e.id===t,c=gg(e,a),l=c[0];return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(J.searchResultRow,s&&J.selected,e.archived&&J.archived),role:`treeitem`,"aria-selected":s,"aria-description":e.archived?a(`toast.archivedNotOpenable`):void 0,"data-row-key":`search:${e.id}`,tabIndex:-1,onClick:()=>{n(e.id)},children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:J.searchResultHeading,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.slot}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.searchResultTitle,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.titleText,children:e.title||a(`session.untitled`)})}),e.remote&&/* @__PURE__ */ (0,o.jsx)(Y_,{host:e.remote,variant:`session`,t:a}),!e.archived&&l.state!==`idle`&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.timeStatus,"data-session-status":l.state,children:/* @__PURE__ */ (0,o.jsx)(vg,{statuses:c})}),e.archived&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.rowActions,children:/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:a(`actions.unarchive`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:J.iconButton,"aria-label":a(`menu.unarchiveSession`),onClick:t=>{t.stopPropagation(),i(e.id)},children:/* @__PURE__ */ (0,o.jsx)(r.IconUnarchiveOutlineRegular,{size:16})})})})]}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:J.searchResultMeta,children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:J.searchResultWorkspace,children:[e.workspace||a(`group.ungrouped`),e.parentTitle!==void 0&&` · ${e.parentTitle||a(`session.untitled`)}`]}),e.snippet!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.searchResultSnippet,children:e.snippet})]})]})}function hy({node:e,rowKey:t=`session:${e.id}`,currentId:n,now:i,onOpen:a,onRenameRequest:c,renderSlot:l,onReveal:u,drag:d,useMovingSectionSessions:f=iy,showHost:p=!0,t:m}){let h=e,{expansion:g,toggle:_,markCompletionsRead:v,collapseStyle:y}=wv(),b=zv(),x=e.tree,S=x?.depth??0,C=!h.archived&&x!==void 0&&x.activity.completed>0?()=>{v(x.descendantIds.map(Hm))}:void 0,w=g[e.id]===!0,T=S===0?d:void 0,E=f(t=>t.has(e.id)),D=qv({depth:S,blank:h.blank,archived:h.archived,moving:E}),ee=ay(e,m),te=e.id===n,ne=gg(e,m),re=ne[0],ie=!h.archived&&re.state!==`idle`,ae=h.remote===void 0?void 0:Wf(h.remote.hostId,h.remote.color),oe=p&&h.remote!==void 0&&ae!==void 0,se=T!==void 0&&T.canDrag!==!1&&!D&&!h.blank&&!h.archived,O=h.blank?void 0:h.reference,ce=se||O!==void 0,k=(0,s.useRef)(!1),A=(0,s.useRef)(new J_),le=(0,s.useRef)(void 0);(0,s.useEffect)(()=>()=>window.clearTimeout(le.current),[]);let ue=()=>{k.current||(te&&!h.archived&&e.tree?.descendantCount?(w&&v(e.tree.descendantIds),_(e.id,!w,b)):a(e.id))},[j,de]=(0,s.useState)(!1),[M,fe]=(0,s.useState)(null),pe=(0,s.useMemo)(()=>[j,de],[j]),me=(0,s.useRef)(null);(0,s.useEffect)(()=>{u!==void 0&&(me.current?.scrollIntoView({block:`nearest`}),u())},[u]);let he=/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:me,"data-row-key":t,"data-thread-parent":e.tree?.parentId??void 0,"data-thread-depth":S,"data-thread-sortable":String(se),"data-thread-pinned":String(e.pinned),"data-section-moving":D?`true`:void 0,style:{"--dsh-thread-indent":`${Math.min(S,3)*24}px`},className:X(J.sessionRow,te&&J.selected,j&&J.menuOpen,h.archived&&J.archived,D&&J.sectionMoving,T?.marker===`before`&&J.dropBefore,T?.marker===`after`&&J.dropAfter),role:`treeitem`,"aria-selected":te,"aria-current":te?`page`:void 0,"aria-busy":D||void 0,"aria-level":S+1,"aria-expanded":e.tree?.descendantCount?w:void 0,tabIndex:-1,onContextMenu:e=>{h.blank||e.target.closest(`button`)||(e.preventDefault(),fe(new DOMRect(e.clientX,e.clientY,0,0)),de(!0))},onKeyDown:t=>{t.target!==t.currentTarget||h.blank||(k.current=!1,t.key===`ContextMenu`||t.shiftKey&&t.key===`F10`?(t.preventDefault(),fe(null),de(!0)):t.key===`F2`&&!h.archived&&(t.preventDefault(),c(e.id,h.title)))},"aria-description":h.archived?m(`toast.archivedNotOpenable`):void 0,onPointerDown:e=>{k.current=!1,e.isPrimary&&e.button===0&&(ny(e.target,me.current)||A.current.down(e.pointerId))},onPointerLeave:()=>{A.current.abandonPress()},onPointerUp:e=>{e.isPrimary&&e.button===0&&(ny(e.target,me.current)?A.current.abandonPress():A.current.orphanUp(e.pointerId)&&(window.clearTimeout(le.current),le.current=window.setTimeout(()=>{A.current.takeFallback()&&ue()},32)))},onPointerCancel:()=>{A.current.cancel(),window.clearTimeout(le.current)},onClick:()=>{A.current.clicked(),window.clearTimeout(le.current),ue()},draggable:ce,onDragStart:ce?t=>{k.current=!0,A.current.cancel(),t.dataTransfer.effectAllowed=O===void 0?`move`:se?`copyMove`:`copy`,t.dataTransfer.setData(`text/plain`,O===void 0?e.id:eh(O).clipboardText),O!==void 0&&t.dataTransfer.setData(`application/x-codexhost-thread-reference`,JSON.stringify(O)),se&&T?.start()}:void 0,onDragEnd:ce?e=>T?.end(e.dataTransfer.dropEffect===`copy`):void 0,onDragOver:T===void 0?void 0:e=>{T.active&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`,T.hover(uy(e)))},onDrop:T===void 0?void 0:e=>{T.active&&e.dataTransfer.dropEffect!==`copy`&&(e.preventDefault(),e.stopPropagation(),T.drop(uy(e),e.dataTransfer.dropEffect))},children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:J.sessionMain,children:/* @__PURE__ */ (0,o.jsx)(q_,{identityLabel:e.tree?.descendantCount?!w&&y===`ring`?m(`threadTree.expandSummary`,{title:ee,summary:Av(e.tree.descendantCount,e.tree.activity,m)}):m(w?`threadTree.collapse`:`threadTree.expand`,{n:e.tree.descendantCount}):void 0,identityExpanded:e.tree?.descendantCount?w:void 0,identityControls:b,identity:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[l(`sidebar.session.row.identity`,{sessionId:e.id}),!w&&y===`ring`&&!!e.tree?.descendantCount&&/* @__PURE__ */ (0,o.jsx)(Pv,{activity:e.tree.activity}),oe&&h.remote&&ae!==void 0&&/* @__PURE__ */ (0,o.jsx)(dy,{color:ae,state:h.remote.state,className:J.remoteSessionGlobe})]}),ambient:!h.archived&&!h.blank&&!ie&&l(`sidebar.session.row.leading`,{sessionId:e.id}),titlePrefix:l(`sidebar.session.row.titlePrefix`,{sessionId:e.id}),title:ee,onIdentityClick:e.tree?.descendantCount?t=>{t.stopPropagation(),_(e.id,!w,b)}:void 0,children:/* @__PURE__ */ (0,o.jsxs)(`span`,{className:J.trailing,children:[!h.blank&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:X(J.time,(ie||D)&&J.timeStatus),"data-session-status":ie?re.state:void 0,"data-section-moving-indicator":D?`true`:void 0,children:ie?/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(vg,{statuses:ne}),re.trailingLabel!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{"aria-hidden":`true`,children:re.trailingLabel})]}):D?/* @__PURE__ */ (0,o.jsx)(r.StateDot,{state:`ongoing`,size:14,className:J.sectionMovingSpinner}):oy(h.updatedAt,i,m)}),!h.blank&&/* @__PURE__ */ (0,o.jsxs)(`span`,{className:J.rowActions,"data-row-actions":``,onClick:e=>{e.stopPropagation()},children:[/* @__PURE__ */ (0,o.jsx)(r.Menu,{open:j,onClose:()=>{de(!1)},portal:!0,autoFocus:!0,phoneSidebarTitle:ee,phoneSidebarFooterBackLabel:m(`session.backToList`),phoneSidebarDetails:/* @__PURE__ */ (0,o.jsx)(`div`,{className:J.phoneDetails,children:/* @__PURE__ */ (0,o.jsx)(py,{node:e,now:i,renderSlot:l,t:m})}),getAnchorRect:M===null?void 0:()=>M,anchor:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:J.iconButton,"aria-label":m(`actions.session.aria`,{name:ee}),"aria-haspopup":`menu`,"aria-expanded":j,onClick:()=>{fe(null),de(e=>!e)},children:/* @__PURE__ */ (0,o.jsx)(r.IconEllipsisOutlineRegular,{})}),children:l(`sidebar.workspaces.session.menu.item`,{sessionId:e.id,displayTitle:h.title,threadTreeChild:S>0,...C===void 0?{}:{markChildThreadsRead:C}},{hookContext:pe})}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.quickActions,children:l(`sidebar.workspaces.session.row.action`,{sessionId:e.id,displayTitle:h.title,threadTreeChild:S>0})})]})]})})}),!w&&y===`summary`&&/* @__PURE__ */ (0,o.jsx)(Hv,{node:e,title:ee,toggle:()=>_(e.id,!0,b),t:m})]});return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.HoverCard,{anchor:he,content:/* @__PURE__ */ (0,o.jsx)(py,{node:e,now:i,renderSlot:l,t:m}),openDelayMs:800,disabled:j||T?.active===!0,copyText:h.blank||h.title===``?void 0:h.title,copyLabel:m(`copy`),copiedLabel:m(`hover.copied`)}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.visuallyHidden,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:D?m(`section.moving`):null})]})}let gy=`@deepseek-ai/dsh-client-ui-workspace/ActivityViewList.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(gy)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=gy,e.textContent=`.lGfYeW_toolbar{min-height:30px;margin:0 calc(var(--dsh-session-list-edge-inset) - 4px) 6px 0;border-bottom:1px solid color-mix(in srgb, var(--dsw-alias-border-l3) 34%, transparent);flex:none;justify-content:space-between;align-items:center;gap:8px;padding:2px 6px 6px 8px;display:flex}.lGfYeW_titleGroup{white-space:nowrap;flex:1;align-items:center;gap:5px;min-width:0;font-size:12px;line-height:17px;display:inline-flex;overflow:hidden}.lGfYeW_title{color:var(--dsw-alias-label-secondary);flex:none;font-weight:500}.lGfYeW_unreadMeta{text-overflow:ellipsis;font-variant-numeric:tabular-nums;min-width:0;color:var(--dsw-alias-label-tertiary);overflow:hidden}.lGfYeW_markAllReadButton{height:24px;font:inherit;color:var(--dsw-alias-state-business-primary);cursor:pointer;white-space:nowrap;background:0 0;border:none;border-radius:6px;flex:none;justify-content:center;align-items:center;padding:0 8px;font-size:12px;font-weight:500;line-height:16px;transition:background-color .12s,color .12s,opacity .12s;display:inline-flex}.lGfYeW_markAllReadButton:hover:not(:disabled){background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 10%, transparent)}.lGfYeW_markAllReadButton:active:not(:disabled){background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 16%, transparent)}.lGfYeW_markAllReadButton:disabled{color:var(--dsw-alias-label-tertiary);opacity:.45;cursor:default}.lGfYeW_markAllReadButton:focus-visible,.lGfYeW_backButton:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.lGfYeW_emptyState{text-align:center;color:var(--dsw-alias-label-tertiary);flex-direction:column;align-items:center;gap:8px;margin-top:72px;padding:0 16px;font-size:13px;line-height:20px;display:flex}.lGfYeW_emptyIcon{color:var(--dsw-alias-label-caption);opacity:.85;margin-bottom:4px}.lGfYeW_emptyTitle{color:var(--dsw-alias-label-tertiary)}.lGfYeW_backButton{cursor:pointer;font:inherit;color:var(--dsw-alias-link);background:0 0;border:none;border-radius:6px;margin-top:2px;padding:4px 10px;font-size:13px;font-weight:500;line-height:20px;transition:background-color .12s}.lGfYeW_backButton:hover{background:var(--dsw-alias-interactive-bg-hover)}@media (hover:none),(pointer:coarse){.lGfYeW_markAllReadButton{min-height:32px;padding:0 10px}.lGfYeW_backButton{min-height:36px;padding:6px 12px}}@media (prefers-reduced-motion:reduce){.lGfYeW_markAllReadButton,.lGfYeW_backButton{transition:none}}`,document.head.appendChild(e)}var _y={backButton:`lGfYeW_backButton`,emptyIcon:`lGfYeW_emptyIcon`,emptyState:`lGfYeW_emptyState`,emptyTitle:`lGfYeW_emptyTitle`,markAllReadButton:`lGfYeW_markAllReadButton`,title:`lGfYeW_title`,titleGroup:`lGfYeW_titleGroup`,toolbar:`lGfYeW_toolbar`,unreadMeta:`lGfYeW_unreadMeta`};function vy({size:e=16,className:t}){return/* @__PURE__ */ (0,o.jsxs)(`svg`,{width:e,height:e,className:t,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:1.2,strokeLinecap:`round`,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,o.jsx)(`path`,{d:`M2.5 4.5h11`}),/* @__PURE__ */ (0,o.jsx)(`path`,{d:`M4.5 8h7`}),/* @__PURE__ */ (0,o.jsx)(`path`,{d:`M6.5 11.5h3`})]})}function yy({projection:e,currentId:t,ready:n,animationResetKey:r,scrollRef:i,onScroll:a,singleRemoteHostScoped:s=!1,onOpen:c,onSessionRenameRequest:l,onMarkAllRead:u,onExit:d,renderSlot:f,t:p}){let m=wv(),{rows:h,unreadSessionIds:g,unreadCount:_}=e,v=Date.now(),y=h.length===0?[`empty:activity`]:m.rows(h).map(e=>`session:${e.id}`);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(Z.treeBody,Z.wide),children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:_y.toolbar,role:`region`,"aria-label":p(`activityView.label`),children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:_y.titleGroup,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:_y.title,children:p(`activityView.label`)}),_>0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:_y.unreadMeta,children:p(_===1?`activityView.unreadCount.one`:`activityView.unreadCount.other`,{n:_})})]}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:_y.markAllReadButton,disabled:_===0,onClick:()=>{u(g)},children:p(`activityView.markAllRead`)})]}),/* @__PURE__ */ (0,o.jsx)(K_,{className:X(Z.list,Z.flatList),label:p(`activityView.label`),rowKeys:y,ready:n,resetKey:r,scrollRef:i,onScroll:a,children:h.length===0?/* @__PURE__ */ (0,o.jsxs)(`div`,{className:_y.emptyState,"data-row-key":`empty:activity`,children:[/* @__PURE__ */ (0,o.jsx)(vy,{size:22,className:_y.emptyIcon}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:_y.emptyTitle,children:p(`activityView.empty`)}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:_y.backButton,onClick:d,children:p(`activityView.backToAll`)})]}):/* @__PURE__ */ (0,o.jsx)(Bv,{roots:h,children:e=>/* @__PURE__ */ (0,o.jsx)(hy,{node:e,showHost:!s,currentId:t,now:v,onOpen:c,onRenameRequest:l,renderSlot:f,t:p},e.id)})}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.fade})]})}function by(e){return/* @__PURE__ */ (0,o.jsx)(r.RemotePluginIcon,{id:e,...(0,r.harnessIconSources)(e),size:16,fallback:/* @__PURE__ */ (0,o.jsx)(r.IconDataOutlineRegular,{size:16})})}async function xy(e,t){let n=`workspace/defaultHarness`,r=await fetch(`api/${n}`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({type:`client-request`,rpcId:globalThis.crypto?.randomUUID?.()??`project-default-${Date.now()}`,method:n,payload:{args:{request:e}}}),...t===void 0?{}:{signal:t}});if(!r.ok)throw Error(`HTTP ${r.status}`);let{result:i}=await r.json();if(!i.ok)throw Error(i.error.message);return i.value}function Sy({workspaceId:e,title:t,t:n,onClose:i}){let[a,c]=(0,s.useState)(),l=(0,s.useId)(),[u,d]=(0,s.useState)(`global`),[f,p]=(0,s.useState)(``),[m,h]=(0,s.useState)(!1),[g,_]=(0,s.useState)(!1),[v,y]=(0,s.useState)();(0,s.useEffect)(()=>{let t=new AbortController;return xy({workspaceId:e},t.signal).then(e=>{if(t.signal.aborted)return;let n=e;c(n),d(n.selection.mode),p(n.selection.mode===`manual`?n.selection.harnessId:``)}).catch(()=>{t.signal.aborted||y(`loadFailed`)}),()=>t.abort()},[e]);let b=a?.harnesses.map(({id:e,name:t})=>({id:e,label:t,icon:by(e)}))??[],x=a?.selection.mode===`manual`?a.selection.harnessId:void 0;if(x&&!b.some(({id:e})=>e===x)){let e=x;b.push({id:e,label:n(`defaultHarness.unavailable`,{name:e}),icon:by(e),disabled:!0})}let S=b.find(({id:e})=>e===f),C=u===`manual`?{mode:u,harnessId:f}:{mode:u},w=a===void 0||u===a.selection.mode&&(u!==`manual`||a.selection.mode===`manual`&&f===a.selection.harnessId),T=u===`manual`&&(!S||S.disabled),E=()=>{g||i()},D=async()=>{if(!(g||w||T)){_(!0),y(void 0);try{await xy({workspaceId:e,selection:C}),i()}catch{y(`saveFailed`),_(!1)}}};return/* @__PURE__ */ (0,o.jsxs)(r.Modal,{open:!0,onClose:E,closeLabel:n(`close`),title:n(`defaultHarness.title`),description:n(`defaultHarness.description`,{name:t}),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,disabled:g,onClick:E,children:n(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`primary`,disabled:g||w||T,onClick:()=>void D(),children:n(`defaultHarness.save`)})]}),children:[a?/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.defaultHarnessOptions,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{role:`radiogroup`,"aria-label":n(`defaultHarness.title`),children:[`global`,`last`,`manual`].map(e=>/* @__PURE__ */ (0,o.jsxs)(`label`,{className:Z.defaultHarnessOption,children:[/* @__PURE__ */ (0,o.jsx)(`input`,{type:`radio`,name:l,value:e,checked:u===e,disabled:g,onChange:()=>{d(e),h(!1)}}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:Z.defaultHarnessOptionText,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.defaultHarnessOptionTitle,children:n(`defaultHarness.${e}`)}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.defaultHarnessOptionDesc,children:n(`defaultHarness.${e}.desc`)})]})]},e))}),u===`manual`&&/* @__PURE__ */ (0,o.jsx)(r.Menu,{open:m,portal:!0,autoFocus:!0,listClassName:Z.defaultHarnessMenu,items:b,selectedId:f,onClose:()=>h(!1),onSelect:e=>{p(e),h(!1)},anchor:/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:`${Z.renameInput} ${Z.defaultHarnessTrigger}`,"aria-label":S?n(`defaultHarness.select`,{name:S.label}):n(`defaultHarness.choose`),"aria-haspopup":`menu`,"aria-expanded":m,disabled:g,onClick:()=>h(!m),children:[S?.icon,/* @__PURE__ */ (0,o.jsx)(`span`,{children:S?.label??n(`defaultHarness.choose`)}),/* @__PURE__ */ (0,o.jsx)(r.IconChevronDownOutlineRegular,{size:14})]})})]}):v===void 0?/* @__PURE__ */ (0,o.jsx)(`div`,{role:`status`,children:n(`defaultHarness.loading`)}):null,v&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:n(`defaultHarness.${v}`)})]})}let Cy=`@deepseek-ai/dsh-client-ui-workspace/SectionHeading.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Cy)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Cy,e.textContent=`.Z54rEq_heading{border-radius:var(--dsw-radius-sm);min-height:30px;color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;padding:0 8px;font-size:14px;font-weight:500;line-height:21px;display:flex}.Z54rEq_heading[data-row-key]{cursor:pointer}.Z54rEq_heading[data-row-key]:hover{background:var(--dsw-alias-interactive-bg-hover)}.Z54rEq_heading[data-project-drop-active]{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:-2px}.Z54rEq_heading.Z54rEq_dropTarget{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 12%, transparent);box-shadow:inset 0 0 0 1px var(--dsw-alias-state-business-primary);color:var(--dsw-alias-label-primary)}.Z54rEq_heading[data-row-key]:focus-visible,.Z54rEq_action:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.Z54rEq_title{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.Z54rEq_chevron,.Z54rEq_collapsed{flex-shrink:0}.Z54rEq_collapsed{transform:rotate(-90deg)}.Z54rEq_trailing{align-items:center;min-width:0;margin-inline-start:auto;display:inline-flex}.Z54rEq_action{border-radius:var(--dsw-radius-sm);width:24px;height:24px;color:inherit;cursor:pointer;background:0 0;border:none;place-items:center;margin-inline-start:auto;padding:0;display:grid}.Z54rEq_actionAfterTrailing{margin-inline-start:0}.Z54rEq_action:hover{background:var(--dsw-alias-interactive-bg-hover)}@media (hover:none),(pointer:coarse){.Z54rEq_heading{min-height:44px}.Z54rEq_action{width:44px;min-width:44px;height:44px;min-height:44px}}[data-phone-drawer] .Z54rEq_heading{min-height:44px}[data-phone-drawer] .Z54rEq_action{width:44px;min-width:44px;height:44px;min-height:44px}`,document.head.appendChild(e)}var wy={action:`Z54rEq_action`,actionAfterTrailing:`Z54rEq_actionAfterTrailing`,chevron:`Z54rEq_chevron`,collapsed:`Z54rEq_collapsed`,dropTarget:`Z54rEq_dropTarget`,heading:`Z54rEq_heading`,title:`Z54rEq_title`,trailing:`Z54rEq_trailing`};function Ty({label:e,icon:t,expanded:n,onToggle:i,rowKey:a,trailing:s,action:c,projectDrop:l,dropTarget:u=!1,onDragOver:d,onDrop:f}){let p=d||f?void 0:l,m=n!==void 0&&i!==void 0&&a!==void 0,h=/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[t,/* @__PURE__ */ (0,o.jsx)(`span`,{className:wy.title,children:e}),m&&/* @__PURE__ */ (0,o.jsx)(r.IconChevronDownOutlineRegular,{className:n?wy.chevron:wy.collapsed,size:12}),s!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:wy.trailing,onClick:e=>{e.stopPropagation()},children:s}),c!==void 0&&/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:c.label,portal:!0,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:X(wy.action,s!==void 0&&wy.actionAfterTrailing),"aria-label":c.label,onClick:e=>{e.stopPropagation(),c.onActivate()},children:c.icon})})]});return m?/* @__PURE__ */ (0,o.jsx)(`div`,{className:X(wy.heading,u&&wy.dropTarget),role:`treeitem`,tabIndex:-1,"data-row-key":a,"data-section-drop-target":u||void 0,"aria-label":e,"data-project-drop-active":p?.active||void 0,onDragOver:p?e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`,p.hover()}:d,onDragLeave:p&&(e=>{e.relatedTarget instanceof Node&&e.currentTarget.contains(e.relatedTarget)||p.leave()}),onDrop:p?e=>{e.preventDefault(),e.stopPropagation(),p.drop()}:f,"aria-expanded":n,onClick:i,children:h}):/* @__PURE__ */ (0,o.jsx)(`div`,{className:X(wy.heading,u&&wy.dropTarget),"data-section-drop-target":u||void 0,onDragOver:d,onDrop:f,children:h})}let Ey=`@deepseek-ai/dsh-client-ui-workspace/PinnedSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ey)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Ey,e.textContent=`.t4p6JG_section{margin-bottom:8px}.t4p6JG_section>*+[data-thread-branch]{margin-top:2px}.t4p6JG_empty{border-radius:var(--dsw-radius-sm);color:var(--dsw-alias-label-tertiary);padding:4px 8px 6px 26px;font-size:12px;line-height:18px}.t4p6JG_emptyDropTarget{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 12%, transparent);box-shadow:inset 0 0 0 1px var(--dsw-alias-state-business-primary);color:var(--dsw-alias-label-primary)}`,document.head.appendChild(e)}var Dy={empty:`t4p6JG_empty`,emptyDropTarget:`t4p6JG_emptyDropTarget`,section:`t4p6JG_section`};function Oy({rows:e,customSection:t,headingActions:n,sectionDrag:i,currentId:a,onOpen:s,onRenameRequest:c,renderSlot:l,useMovingSectionSessions:u,t:d,revealSessionId:f,onSessionRevealed:p,showHost:m=!0,expanded:h,onToggle:g,leadingChildren:_,children:v,hasWorkspaces:y=!1,hasExtraItems:b=!1}){if(e.length===0&&!y&&!b&&!t)return null;let x=t?.section,S=x?.name??d(`section.pinned`),C=x!==void 0&&Uv(x),w=Array.isArray(v)?v.length>0:!!v,T=C&&x!==void 0&&i?.active===!0,E=T&&i.over?.kind===`section-end`&&i.over.sectionId===x.id,D=T&&x!==void 0?e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`,i.hoverSectionEnd(x.id)}:void 0,ee=T&&x!==void 0?e=>{e.dataTransfer.dropEffect!==`copy`&&(e.preventDefault(),e.stopPropagation(),i.dropSectionEnd(x.id,e.dataTransfer.dropEffect))}:void 0;return/* @__PURE__ */ (0,o.jsxs)(`div`,{role:`group`,"aria-label":S,className:Dy.section,"data-sidebar-pinned":!t||void 0,"data-sidebar-custom-section":x?.id,onDragOver:!t&&i?.active?()=>{i.clearHover()}:void 0,children:[/* @__PURE__ */ (0,o.jsx)(Ty,{label:S,icon:t?void 0:/* @__PURE__ */ (0,o.jsx)(r.IconPinOutlineRegular,{size:14}),trailing:n,expanded:h,onToggle:g,rowKey:`section:${t?.key??`pinned`}`,projectDrop:t?.projectDrop,dropTarget:E,onDragOver:D,onDrop:ee}),h&&_,h&&e.length>0&&/* @__PURE__ */ (0,o.jsx)(Bv,{roots:e,children:e=>{let t=C&&x!==void 0&&i!==void 0?{canDrag:i.canDragRow(e),start:()=>{i.startFromSection(e.id,x.id)},active:i.active&&!e.blank&&!e.archived&&e.id!==i.draggedSessionId,marker:i.over?.kind===`section-row`&&i.over.sectionId===x.id&&i.over.targetSessionId===e.id?i.over.half:null,hover:t=>{i.hoverSectionRow(x.id,e.id,t)},drop:(t,n)=>{i.dropSectionRow(x.id,e.id,t,n)},end:()=>{i.end()}}:void 0;return/* @__PURE__ */ (0,o.jsx)(hy,{node:e,showHost:m,currentId:a,now:Date.now(),onOpen:s,onRenameRequest:c,renderSlot:l,onReveal:e.id===f?()=>p(e.id):void 0,drag:t,useMovingSectionSessions:u,t:d},e.id)}}),h&&w&&v,h&&t!==void 0&&e.length===0&&!w&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:X(Dy.empty,E&&Dy.emptyDropTarget),"data-section-drop-empty":x?.id,onDragOver:D,onDrop:ee,children:d(`section.empty`)})]})}function ky({list:e,refreshSessions:t,loadMoreSessions:n,t:r}){return e.listError?/* @__PURE__ */ (0,o.jsxs)(`div`,{role:`alert`,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{children:e.listError}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.sessionOverflowButton,disabled:e.loading,onClick:()=>{e.listErrorPage===`more`?n():t()},children:r(`sessions.retry`)})]}):null}function Ay(e,t,n,r,i){let a=i?.keepPinned??!0,o=0,s=e.filter(e=>e.blank||a&&e.pinned||e.running||e.runningSubagentCount>0||e.pendingInteraction!==void 0||e.tree?.activity.running||e.tree?.activity.pendingInteraction?!0:o++<t||e.id===n||e.id===r||e.tree?.descendantIds.some(e=>e===n||e===r)===!0);return{rows:s,hiddenCount:e.length-s.length,ordinaryCount:o}}function jy(e,t,n){let r=e.filter((e,r)=>r<t||n.has(e.key));return{rows:r,hiddenCount:e.length-r.length}}function My({rowKey:e,hiddenCount:t,hasMore:n,loading:r,workspaceHistory:i,workspaceId:a,fillWorkspace:c,expanded:l,expand:u,collapse:d,loadMoreSessions:f,t:p}){if((0,s.useEffect)(()=>{c&&f(a)},[c,f,a]),t===0&&!n&&!d)return null;let m=t===0&&n&&r,h=i===`retry`?`sessions.retryWorkspaceHistory`:i===`continue`?`sessions.continueWorkspaceHistory`:i===`search`?`sessions.searchWorkspaceHistory`:`sessions.expandMore`;return/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,"data-row-key":e,className:Z.sessionOverflowButton,"aria-expanded":l,disabled:m,onClick:()=>{t>0?u?.():n?(u?.(),f(a)):d?.()},children:m?p(`sessions.loading`):t>0?p(`sessions.expand`,{n:Math.min(10,t)}):p(n?h:`sessions.collapse`)})}function Ny({current:e,sections:t,dismiss:n,move:i,defaultLabel:a,failedLabel:c,busy:l=!1,disabled:u=!1,blockedMessage:d,deletedTargetLabel:f,t:p}){let[m,h]=(0,s.useState)(),[g,_]=(0,s.useState)(!1),v=l||g,{effectiveTarget:y,targetDeleted:b,canSubmit:x}=Xv(e,t,m,v||u),[S,C]=(0,s.useState)(!1),w=d??(b?f:void 0)??(S?c:void 0),T=(0,s.useRef)(!1),E=()=>{!T.current&&!l&&n()},D=async()=>{if(!T.current&&x){T.current=!0,_(!0),C(!1);try{await i(y||null)!==!1&&n()}catch{C(!0)}finally{T.current=!1,_(!1)}}};return/* @__PURE__ */ (0,o.jsxs)(r.Modal,{phoneSidebar:!0,open:!0,title:p(`menu.moveToSection`),closeLabel:p(`close`),onClose:E,footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,disabled:v,onClick:E,children:p(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`primary`,disabled:!x,onClick:()=>void D(),children:p(`section.move`)})]}),children:[/* @__PURE__ */ (0,o.jsxs)(`select`,{className:Z.renameInput,"aria-label":p(`section.destination`),value:y,disabled:v||u,"data-modal-autofocus":!0,onChange:({target:e})=>{h(e.value),f!==void 0&&C(!1)},children:[b&&/* @__PURE__ */ (0,o.jsx)(`option`,{value:y,disabled:!0,children:p(f===void 0?`section.destination`:`section.targetDeletedOption`)}),/* @__PURE__ */ (0,o.jsx)(`option`,{value:``,children:a}),t.map(({id:e,name:t})=>/* @__PURE__ */ (0,o.jsx)(`option`,{value:e,children:t},e))]}),w!==void 0&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:w})]})}let Py=`@deepseek-ai/dsh-client-ui-workspace/HostScopeFilter.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Py)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Py,e.textContent=`.jFA5LW_tabBarRow{border-bottom:1px solid var(--dsw-alias-border-l2,#80808024);flex:none;align-items:flex-end;gap:6px;margin:0 4px 6px;display:flex}.jFA5LW_tabBar{scrollbar-width:none;flex:1;align-items:center;gap:12px;min-width:0;padding:0;display:flex;overflow:auto hidden}.jFA5LW_tabBar::-webkit-scrollbar{display:none}.jFA5LW_tabTrailing{flex:none;align-items:center;padding-bottom:3px;display:inline-flex}.jFA5LW_tabItem{max-width:136px;color:var(--dsw-alias-label-secondary);font:inherit;white-space:nowrap;cursor:pointer;-webkit-tap-highlight-color:transparent;transition:color .12s var(--ds-ease-in-out);background:0 0;border:none;border-radius:0;flex:none;align-items:center;gap:5px;padding:3px 1px 7px;font-size:12.5px;font-weight:500;line-height:16px;display:inline-flex;position:relative}.jFA5LW_tabItem:hover{color:var(--dsw-alias-label-primary)}.jFA5LW_tabItemActive{color:var(--dsw-alias-label-primary);font-weight:600}.jFA5LW_tabItemActive:after{content:"";background:var(--dsw-alias-label-primary);border-radius:2px;height:1.5px;position:absolute;bottom:0;left:0;right:0}.jFA5LW_tabItem:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px;border-radius:4px}.jFA5LW_iconTrigger{width:24px;height:24px;color:var(--dsw-alias-label-tertiary);cursor:pointer;-webkit-tap-highlight-color:transparent;transition:background-color .12s var(--ds-ease-in-out), color .12s var(--ds-ease-in-out);background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;padding:0;display:inline-flex;position:relative}.jFA5LW_iconTrigger:hover,.jFA5LW_iconTriggerOpen{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.jFA5LW_iconTriggerActive{color:var(--dsw-alias-state-business-primary);background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 10%, transparent)}.jFA5LW_iconTriggerActive:hover,.jFA5LW_iconTriggerActive.jFA5LW_iconTriggerOpen{color:var(--dsw-alias-state-business-primary);background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 16%, transparent)}.jFA5LW_iconTrigger:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.jFA5LW_iconTriggerPip{background:var(--dsw-alias-state-business-primary);border-radius:50%;width:5px;height:5px;position:absolute;top:3px;right:3px}.jFA5LW_tabLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.jFA5LW_tabDot{--ch-peer-dot-color:#3b76cc;background:var(--dsw-alias-label-tertiary);opacity:.45;border-radius:50%;flex:none;width:5px;height:5px}.jFA5LW_anchorRoot{align-items:center;min-width:0;display:inline-flex;position:relative}.jFA5LW_trigger{max-width:128px;height:22px;color:var(--dsw-alias-label-tertiary);font:inherit;cursor:pointer;transition:background-color .12s var(--ds-ease-in-out), color .12s var(--ds-ease-in-out);background:0 0;border:none;border-radius:6px;align-items:center;gap:4px;padding:0 6px;font-size:11.5px;font-weight:500;line-height:16px;display:inline-flex}.jFA5LW_trigger:hover,.jFA5LW_triggerOpen{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.jFA5LW_triggerActive{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 10%, transparent);color:var(--dsw-alias-state-business-primary)}.jFA5LW_triggerActive:hover,.jFA5LW_triggerActive.jFA5LW_triggerOpen{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 16%, transparent);color:var(--dsw-alias-state-business-primary)}.jFA5LW_trigger:focus-visible,.jFA5LW_hostRow:focus-visible,.jFA5LW_segmentButton:focus-visible,.jFA5LW_perHostTrigger:focus-visible,.jFA5LW_footerAction:focus-visible,.jFA5LW_resetLink:focus-visible,.jFA5LW_miniLink:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.jFA5LW_triggerLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.jFA5LW_triggerChevron{opacity:.65;flex:none}.jFA5LW_dot{--ch-peer-dot-color:#3b76cc;background:var(--dsw-alias-label-tertiary);opacity:.5;border-radius:50%;flex:none;width:6px;height:6px}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=blue]{--ch-peer-dot-color:#3b76cc}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=purple]{--ch-peer-dot-color:#7460cc}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=cyan]{--ch-peer-dot-color:#0e8fa8}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=green]{--ch-peer-dot-color:#2f8c70}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=amber]{--ch-peer-dot-color:#c27803}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=rose]{--ch-peer-dot-color:#c94a6a}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=slate]{--ch-peer-dot-color:#64748b}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=blue]{--ch-peer-dot-color:#7bb0f8}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=purple]{--ch-peer-dot-color:#a899f2}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=cyan]{--ch-peer-dot-color:#63c5da}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=green]{--ch-peer-dot-color:#6ec4a7}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=amber]{--ch-peer-dot-color:#e0ae58}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=rose]{--ch-peer-dot-color:#e08298}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=slate]{--ch-peer-dot-color:#94a3b8}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-state=connected]{background:var(--ch-peer-dot-color);opacity:.95}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-state=connecting]{background:var(--dsw-alias-state-warning-primary,#c27803);opacity:.9}.jFA5LW_popover{z-index:1100;box-sizing:border-box;width:min(260px,100vw - 24px);max-height:calc(100vh - 24px - max(12px, var(--dsh-frame-overlay-top,12px)));--dsw-elevation-stroke-color:var(--dsw-alias-border-l2);box-shadow:var(--dsw-elevation-prominent);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);color:var(--dsw-alias-label-primary);border:0;flex-direction:column;padding:5px;display:flex;position:fixed}.jFA5LW_scrollArea{flex-direction:column;flex:1;gap:2px;min-height:0;display:flex;overflow-y:auto}.jFA5LW_section{flex-direction:column;gap:1px;display:flex}.jFA5LW_sectionTitleRow{justify-content:space-between;align-items:center;gap:8px;padding:4px 7px 3px;display:flex}.jFA5LW_sectionTitle{letter-spacing:.01em;color:var(--dsw-alias-label-tertiary);font-size:10.5px;font-weight:500;line-height:14px}.jFA5LW_resetLink,.jFA5LW_miniLink{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:4px;padding:1px 4px;font-size:11px;line-height:15px;transition:background-color .1s,color .1s}.jFA5LW_resetLink:hover:not(:disabled),.jFA5LW_miniLink:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.jFA5LW_miniLink:disabled{opacity:.35;cursor:default}.jFA5LW_hostList{flex-direction:column;gap:1px;display:flex}.jFA5LW_hostRow{width:100%;min-height:28px;color:var(--dsw-alias-label-primary);text-align:left;cursor:pointer;background:0 0;border:none;border-radius:6px;align-items:center;gap:7px;padding:3px 7px;font-size:12.5px;line-height:18px;transition:background-color .1s;display:flex}.jFA5LW_hostRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.jFA5LW_hostRowSelected{background:color-mix(in srgb, var(--dsw-alias-label-primary) 5%, transparent);font-weight:500}.jFA5LW_hostName{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.jFA5LW_hostCount{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary);flex:none;font-size:11px;line-height:15px}.jFA5LW_hostCountFiltered{color:var(--dsw-alias-state-business-primary);font-weight:500}.jFA5LW_checkSlot{width:14px;height:14px;color:var(--dsw-alias-label-primary);flex:none;justify-content:center;align-items:center;display:inline-flex}.jFA5LW_divider{background:var(--dsw-alias-border-l2);height:1px;margin:4px 3px}.jFA5LW_scopeEditor{flex-direction:column;gap:6px;padding:2px 4px 4px;display:flex}.jFA5LW_segmented{background:var(--dsw-alias-interactive-bg-hover);border-radius:7px;grid-template-columns:1fr 1fr;gap:2px;padding:2px;display:grid}.jFA5LW_segmentButton{box-sizing:border-box;height:24px;color:var(--dsw-alias-label-secondary);font:inherit;white-space:nowrap;text-overflow:ellipsis;cursor:pointer;background:0 0;border:none;border-radius:5px;padding:0 7px;font-size:11.5px;font-weight:500;line-height:16px;transition:color .1s;overflow:hidden}.jFA5LW_segmentButton:hover:not(.jFA5LW_segmentActive){color:var(--dsw-alias-label-primary)}.jFA5LW_segmentActive{background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);box-shadow:var(--dsw-elevation-soft)}.jFA5LW_workspacePicker{flex-direction:column;gap:3px;display:flex}.jFA5LW_workspacePickerBar{justify-content:space-between;align-items:center;gap:6px;padding:0 3px;display:flex}.jFA5LW_workspacePickerCount{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:15px}.jFA5LW_workspacePickerActions{align-items:center;gap:2px;display:inline-flex}.jFA5LW_workspaceList{flex-direction:column;gap:1px;max-height:160px;display:flex;overflow-y:auto}.jFA5LW_workspaceOption{min-height:25px;color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:5px;align-items:center;gap:7px;padding:2px 6px;font-size:12px;line-height:17px;display:flex}.jFA5LW_workspaceOption:hover{background:var(--dsw-alias-interactive-bg-hover)}.jFA5LW_workspaceCheckbox{width:13px;height:13px;accent-color:var(--dsw-alias-brand-primary,var(--dsw-alias-state-business-primary));cursor:pointer;flex:none;margin:0}.jFA5LW_workspaceOptionName{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.jFA5LW_noWorkspaces{color:var(--dsw-alias-label-tertiary);padding:6px;font-size:11.5px;line-height:16px}.jFA5LW_allHostsScopeList{flex-direction:column;gap:1px;display:flex}.jFA5LW_perHostAccordion{border-radius:6px;flex-direction:column;display:flex}.jFA5LW_perHostTrigger{width:100%;min-height:27px;color:var(--dsw-alias-label-primary);text-align:left;cursor:pointer;background:0 0;border:none;border-radius:6px;align-items:center;gap:6px;padding:3px 6px;font-size:12px;line-height:17px;display:flex}.jFA5LW_perHostTrigger:hover,.jFA5LW_perHostTriggerOpen{background:var(--dsw-alias-interactive-bg-hover)}.jFA5LW_accordionIcon{color:var(--dsw-alias-label-tertiary);flex:none}.jFA5LW_scopeSummaryTag{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary);flex:none;font-size:11px;line-height:15px}.jFA5LW_scopeSummaryTagFiltered{color:var(--dsw-alias-state-business-primary);font-weight:500}.jFA5LW_perHostBody{padding:3px 2px 2px 10px}.jFA5LW_footer{border-top:1px solid var(--dsw-alias-border-l2);flex-direction:column;flex:none;gap:1px;margin-top:4px;padding-top:4px;display:flex}.jFA5LW_footerAction{width:100%;min-height:28px;color:var(--dsw-alias-label-secondary);text-align:left;cursor:pointer;background:0 0;border:none;border-radius:6px;align-items:center;gap:7px;padding:3px 7px;font-size:12.5px;line-height:18px;transition:background-color .1s,color .1s;display:flex}.jFA5LW_footerAction:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.jFA5LW_footerIcon{color:var(--dsw-alias-label-tertiary);flex:none}.jFA5LW_footerAction:hover .jFA5LW_footerIcon{color:var(--dsw-alias-label-primary)}@media (hover:none),(pointer:coarse){.jFA5LW_trigger{min-height:32px;padding:0 8px}.jFA5LW_hostRow,.jFA5LW_footerAction{min-height:38px}.jFA5LW_workspaceOption{min-height:34px}}@media (prefers-reduced-motion:reduce){.jFA5LW_trigger,.jFA5LW_hostRow,.jFA5LW_footerAction{transition:none}}`,document.head.appendChild(e)}var Q={accordionIcon:`jFA5LW_accordionIcon`,allHostsScopeList:`jFA5LW_allHostsScopeList`,anchorRoot:`jFA5LW_anchorRoot`,checkSlot:`jFA5LW_checkSlot`,divider:`jFA5LW_divider`,dot:`jFA5LW_dot`,footer:`jFA5LW_footer`,footerAction:`jFA5LW_footerAction`,footerIcon:`jFA5LW_footerIcon`,hostCount:`jFA5LW_hostCount`,hostCountFiltered:`jFA5LW_hostCountFiltered`,hostList:`jFA5LW_hostList`,hostName:`jFA5LW_hostName`,hostRow:`jFA5LW_hostRow`,hostRowSelected:`jFA5LW_hostRowSelected`,iconTrigger:`jFA5LW_iconTrigger`,iconTriggerActive:`jFA5LW_iconTriggerActive`,iconTriggerOpen:`jFA5LW_iconTriggerOpen`,iconTriggerPip:`jFA5LW_iconTriggerPip`,miniLink:`jFA5LW_miniLink`,noWorkspaces:`jFA5LW_noWorkspaces`,perHostAccordion:`jFA5LW_perHostAccordion`,perHostBody:`jFA5LW_perHostBody`,perHostTrigger:`jFA5LW_perHostTrigger`,perHostTriggerOpen:`jFA5LW_perHostTriggerOpen`,popover:`jFA5LW_popover`,resetLink:`jFA5LW_resetLink`,scopeEditor:`jFA5LW_scopeEditor`,scopeSummaryTag:`jFA5LW_scopeSummaryTag`,scopeSummaryTagFiltered:`jFA5LW_scopeSummaryTagFiltered`,scrollArea:`jFA5LW_scrollArea`,section:`jFA5LW_section`,sectionTitle:`jFA5LW_sectionTitle`,sectionTitleRow:`jFA5LW_sectionTitleRow`,segmentActive:`jFA5LW_segmentActive`,segmentButton:`jFA5LW_segmentButton`,segmented:`jFA5LW_segmented`,tabBar:`jFA5LW_tabBar`,tabBarRow:`jFA5LW_tabBarRow`,tabDot:`jFA5LW_tabDot`,tabItem:`jFA5LW_tabItem`,tabItemActive:`jFA5LW_tabItemActive`,tabLabel:`jFA5LW_tabLabel`,tabTrailing:`jFA5LW_tabTrailing`,trigger:`jFA5LW_trigger`,triggerActive:`jFA5LW_triggerActive`,triggerChevron:`jFA5LW_triggerChevron`,triggerLabel:`jFA5LW_triggerLabel`,triggerOpen:`jFA5LW_triggerOpen`,workspaceCheckbox:`jFA5LW_workspaceCheckbox`,workspaceList:`jFA5LW_workspaceList`,workspaceOption:`jFA5LW_workspaceOption`,workspaceOptionName:`jFA5LW_workspaceOptionName`,workspacePicker:`jFA5LW_workspacePicker`,workspacePickerActions:`jFA5LW_workspacePickerActions`,workspacePickerBar:`jFA5LW_workspacePickerBar`,workspacePickerCount:`jFA5LW_workspacePickerCount`};function Fy(e,t){return e.key===`local`?t(`host.local`):e.displayName||e.hostId||e.key}function Iy(e,t){return t(e===`connected`?`host.connected`:e===`connecting`?`host.connecting`:`host.disconnected`)}function Ly({host:e,state:t,onChange:n,t:r}){let i=t.perHost[e.key],a=i?.mode===`selected`?`selected`:`all`,c=(0,s.useMemo)(()=>new Set(i?.mode===`selected`?i.workspaceIds:[]),[i]),l=(0,s.useMemo)(()=>e.workspaces.map(e=>e.workspaceId),[e.workspaces]),u=dv(e,i),d=Fy(e,r);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.scopeEditor,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.segmented,role:`tablist`,"aria-label":r(`hostScope.scope.label`),children:[/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":a===`all`,className:X(Q.segmentButton,a===`all`&&Q.segmentActive),onClick:()=>{n(pv(t,e.key,`all`,l))},children:r(`hostScope.scope.allSessions`)}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":a===`selected`,className:X(Q.segmentButton,a===`selected`&&Q.segmentActive),onClick:()=>{n(pv(t,e.key,`selected`,l))},children:r(`hostScope.scope.selectedWorkspaces`)})]}),a===`selected`&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.workspacePicker,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.workspacePickerBar,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.workspacePickerCount,children:r(`hostScope.selectedCount`,{selected:u,total:e.workspaceCount})}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:Q.workspacePickerActions,children:[/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Q.miniLink,disabled:e.workspaces.length===0||u===e.workspaces.length,onClick:()=>{n(hv(t,e.key,l))},children:r(`hostScope.selectAll`)}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Q.miniLink,disabled:u===0,onClick:()=>{n(hv(t,e.key,[]))},children:r(`hostScope.clear`)})]})]}),e.workspaces.length===0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.noWorkspaces,children:r(`hostScope.noHostWorkspaces`)}):/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.workspaceList,children:e.workspaces.map(i=>{let a=c.has(i.workspaceId),s=$_(i),u=s?r(`group.remoteOtherSessions`):i.title;return/* @__PURE__ */ (0,o.jsxs)(`label`,{className:Q.workspaceOption,title:s?`${d} · ${u}`:i.path||u,children:[/* @__PURE__ */ (0,o.jsx)(`input`,{type:`checkbox`,className:Q.workspaceCheckbox,checked:a,onChange:()=>{n(mv(t,e.key,i.workspaceId,l))}}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.workspaceOptionName,children:u})]},i.workspaceId)})})]})]})}function Ry(){return/* @__PURE__ */ (0,o.jsx)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:/* @__PURE__ */ (0,o.jsx)(`path`,{d:`M2.2 3.2h11.6L9.4 8.4v4.1l-2.8-1.4V8.4L2.2 3.2Z`})})}function zy({workspaces:e,state:t,onChange:n,t:r}){let i=(0,s.useMemo)(()=>Q_(e),[e]),a=(0,s.useMemo)(()=>tv(e),[e]),c=(0,s.useMemo)(()=>nv(t,e),[t,e]);return i?/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.tabBarRow,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.tabBar,role:`tablist`,"aria-label":r(`hostScope.host.label`),children:[/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":c.selectedHost===`all`,className:X(Q.tabItem,c.selectedHost===`all`&&Q.tabItemActive),onClick:()=>{n(fv(c,`all`))},children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.tabLabel,children:r(`hostScope.allShort`)})}),a.map(e=>{let t=c.selectedHost===e.key,i=Fy(e,r),a=e.hostId===void 0?i:`${i} · ${Iy(e.state,r)}`;return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t,className:X(Q.tabItem,t&&Q.tabItemActive),title:a,onClick:()=>{n(fv(c,e.key))},children:[e.hostId!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.tabDot,"data-state":e.state??`disconnected`,"data-color":Wf(e.hostId,e.color),"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.tabLabel,children:i})]},e.key)})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.tabTrailing,children:/* @__PURE__ */ (0,o.jsx)(By,{workspaces:e,state:t,onChange:n,t:r,variant:`icon`})})]}):null}function By({workspaces:e,state:t,onChange:n,t:i,variant:a=`pill`}){let[l,u]=(0,s.useState)(!1),[d,f]=(0,s.useState)(null),p=(0,s.useRef)(null),m=(0,s.useRef)(null),h=(0,s.useRef)(null),g=(0,s.useId)(),_=(0,s.useMemo)(()=>Q_(e),[e]),v=(0,s.useMemo)(()=>tv(e),[e]),y=(0,s.useMemo)(()=>nv(t,e),[t,e]),b=(0,s.useMemo)(()=>iv(y,e),[y,e]),x=(0,s.useMemo)(()=>y.selectedHost===`all`?void 0:v.find(e=>e.key===y.selectedHost),[y.selectedHost,v]),S=(0,r.useAnchoredPosition)({open:l,anchorRef:m,panelRef:h,side:`bottom`,align:`end`,gap:4,margin:12});if((0,r.useDismissOnOutsidePointer)(p,l,u,h),(0,s.useEffect)(()=>{if(!l)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),u(!1),m.current?.focus({preventScroll:!0}))};return document.addEventListener(`keydown`,e,!0),()=>{document.removeEventListener(`keydown`,e,!0)}},[l]),!_)return null;let C=(()=>{if(!b)return i(`hostScope.allShort`);if(x!==void 0){let e=Fy(x,i),t=y.perHost[x.key];return t?.mode===`selected`?`${e} · ${dv(x,t)}`:e}return i(`hostScope.filtered`)})(),w=x?.hostId===void 0?void 0:x.hostId,T=()=>{u(!1),window.dispatchEvent(new CustomEvent(`codexhost:open-add-remote-workspace`,{detail:w===void 0?{}:{hostId:w}}))},E=()=>{u(!1),window.dispatchEvent(new CustomEvent(`codexhost:open-remote-peers-settings`))},D=e.length,ee=v.some(e=>y.perHost[e.key]?.mode===`selected`);return/* @__PURE__ */ (0,o.jsxs)(`span`,{ref:p,className:Q.anchorRoot,children:[a===`icon`?/* @__PURE__ */ (0,o.jsxs)(`button`,{ref:m,type:`button`,className:X(Q.iconTrigger,ee&&Q.iconTriggerActive,l&&Q.iconTriggerOpen),"aria-haspopup":`dialog`,"aria-expanded":l,"aria-controls":l?g:void 0,"aria-label":i(`hostScope.trigger.aria`,{current:C}),title:i(`hostScope.trigger.aria`,{current:C}),onClick:e=>{e.stopPropagation(),u(e=>!e)},children:[/* @__PURE__ */ (0,o.jsx)(Ry,{}),ee&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.iconTriggerPip,"aria-hidden":`true`})]}):/* @__PURE__ */ (0,o.jsxs)(`button`,{ref:m,type:`button`,className:X(Q.trigger,b&&Q.triggerActive,l&&Q.triggerOpen),"aria-haspopup":`dialog`,"aria-expanded":l,"aria-controls":l?g:void 0,"aria-label":i(`hostScope.trigger.aria`,{current:C}),title:i(`hostScope.trigger.aria`,{current:C}),onClick:e=>{e.stopPropagation(),u(e=>!e)},children:[x?.hostId!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.dot,"data-state":x.state??`disconnected`,"data-color":Wf(x.hostId,x.color),"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.triggerLabel,children:C}),/* @__PURE__ */ (0,o.jsx)(r.IconChevronDownOutlineRegular,{size:12,className:Q.triggerChevron})]}),l&&(0,c.createPortal)(/* @__PURE__ */ (0,o.jsxs)(r.MenuSurface,{ref:h,id:g,role:`dialog`,"aria-label":i(`hostScope.popover.aria`),className:Q.popover,style:S??{visibility:`hidden`,left:0,top:0},onClick:e=>{e.stopPropagation()},children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.scrollArea,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.section,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.sectionTitleRow,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.sectionTitle,children:i(`hostScope.host.label`)}),b&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Q.resetLink,onClick:()=>{n(gv())},children:i(`hostScope.reset`)})]}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.hostList,role:`radiogroup`,"aria-label":i(`hostScope.host.label`),children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":y.selectedHost===`all`,className:X(Q.hostRow,y.selectedHost===`all`&&Q.hostRowSelected),onClick:()=>{n(fv(y,`all`))},children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.hostName,children:i(`hostScope.allHosts`)}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.hostCount,children:D}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.checkSlot,children:y.selectedHost===`all`&&/* @__PURE__ */ (0,o.jsx)(r.IconCheckOutlineRegular,{size:14})})]}),v.map(e=>{let t=y.selectedHost===e.key,a=y.perHost[e.key],s=a?.mode===`selected`,c=dv(e,a),l=s?`${c}/${e.workspaceCount}`:String(e.workspaceCount),u=Fy(e,i),d=e.hostId===void 0?u:`${u} · ${Iy(e.state,i)}`;return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,className:X(Q.hostRow,t&&Q.hostRowSelected),title:d,onClick:()=>{n(fv(y,e.key))},children:[e.hostId!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.dot,"data-state":e.state??`disconnected`,"data-color":Wf(e.hostId,e.color),"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.hostName,children:u}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:X(Q.hostCount,s&&Q.hostCountFiltered),children:l}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.checkSlot,children:t&&/* @__PURE__ */ (0,o.jsx)(r.IconCheckOutlineRegular,{size:14})})]},e.key)})]})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.divider,role:`separator`}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.section,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.sectionTitleRow,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.sectionTitle,children:i(`hostScope.scope.label`)})}),x===void 0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.allHostsScopeList,children:v.map(e=>{let t=d===e.key,a=y.perHost[e.key],s=a?.mode===`selected`,c=s?`${dv(e,a)}/${e.workspaceCount}`:i(`hostScope.allShort`);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.perHostAccordion,children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:X(Q.perHostTrigger,t&&Q.perHostTriggerOpen),"aria-expanded":t,onClick:()=>{f(t=>t===e.key?null:e.key)},children:[t?/* @__PURE__ */ (0,o.jsx)(r.IconChevronDownOutlineRegular,{size:12,className:Q.accordionIcon}):/* @__PURE__ */ (0,o.jsx)(r.IconChevronRightOutlineRegular,{size:12,className:Q.accordionIcon}),e.hostId!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.dot,"data-state":e.state??`disconnected`,"data-color":Wf(e.hostId,e.color),"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.hostName,children:Fy(e,i)}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:X(Q.scopeSummaryTag,s&&Q.scopeSummaryTagFiltered),children:c})]}),t&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.perHostBody,children:/* @__PURE__ */ (0,o.jsx)(Ly,{host:e,state:y,onChange:n,t:i})})]},e.key)})}):/* @__PURE__ */ (0,o.jsx)(Ly,{host:x,state:y,onChange:n,t:i})]})]}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.footer,children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:Q.footerAction,onClick:T,children:[/* @__PURE__ */ (0,o.jsx)(r.IconPlusOutlineRegular,{size:14,className:Q.footerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:i(`hostScope.action.addRemoteWorkspace`)})]}),/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:Q.footerAction,onClick:E,children:[/* @__PURE__ */ (0,o.jsx)(r.IconSettingsOutlineRegular,{size:14,className:Q.footerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:i(`hostScope.action.manageRemoteHosts`)})]})]})]}),document.body)]})}function Vy(){let[e,t]=(0,s.useState)(Gv);return(0,s.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(Wv);t(e.matches);let n=e=>{t(e.matches)};if(typeof e.addEventListener==`function`)return e.addEventListener(`change`,n),()=>{e.removeEventListener(`change`,n)}},[]),e}function Hy({enabled:e,nativeSections:t,visibleSectionRows:n,nativeThreadIds:r,pinnedSessionIds:i,archivedSessionIds:a,moveSessionToSection:o,onCancelLocalDrag:c}){let[l,u]=(0,s.useState)(null),d=(0,s.useRef)(null),f=(0,s.useRef)(!1),p=(0,s.useRef)(!1),m=(0,s.useRef)(c),h=e=>{d.current=e,u(e)},g=e&&l!==null;(0,s.useLayoutEffect)(()=>{m.current=c,!(e||d.current===null)&&(p.current=!0,d.current=null,u(null),m.current())},[e,c]),(0,s.useEffect)(()=>{if(!g)return;let e=()=>{p.current=!0,h(null),m.current()},t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`keydown`,t,!0),window.addEventListener(`blur`,e),()=>{window.removeEventListener(`keydown`,t,!0),window.removeEventListener(`blur`,e)}},[g]);let _=(t,n=!1)=>e&&Kv({sessionId:t.id,nativeThreadIds:r,pinnedSessionIds:i,archivedSessionIds:a,blank:t.blank,archived:t.archived,pinned:t.pinned,remote:n||!!t.remote,depth:t.tree?.depth??0}),v=(t,n)=>{e&&(f.current=!1,p.current=!1,h({source:{sessionId:t,sourceSectionId:n},over:null}))},y=e=>{let t=d.current;if(t===null||p.current||e.kind===`unsectioned`&&t.source.sourceSectionId===null)return;let n=t.over;n!==null&&n.kind===e.kind&&(e.kind===`unsectioned`||e.kind===`section-end`&&n.kind===`section-end`&&n.sectionId===e.sectionId||e.kind===`section-row`&&n.kind===`section-row`&&n.sectionId===e.sectionId&&n.targetSessionId===e.targetSessionId&&n.half===e.half)||h({...t,over:e})},b=()=>{let e=d.current;e!==null&&e.over!==null&&h({...e,over:null})},x=(r,i)=>{let a=d.current;if(!e||a===null||!Qv({committed:f.current,cancelled:p.current,dropEffect:i}))return;f.current=!0,h(null),m.current();let s=$v(a.source,r,t,n);s!==null&&o!==void 0&&o(s)},S=()=>{h(null),f.current=!1,p.current=!1},C=e?{active:g,draggedSessionId:l?.source.sessionId??null,over:l?.over??null,canDragRow:e=>_(e),startFromSection:(e,t)=>{v(e,t)},hoverSectionEnd:e=>{y({kind:`section-end`,sectionId:e})},hoverSectionRow:(e,t,n)=>{y({kind:`section-row`,sectionId:e,targetSessionId:t,half:n})},dropSectionEnd:(e,t)=>{x({kind:`section-end`,sectionId:e},t)},dropSectionRow:(e,t,n,r)=>{x({kind:`section-row`,sectionId:e,targetSessionId:t,half:n},r)},clearHover:b,end:S}:void 0;return{active:g,hasSectionTarget:g&&l.over!==null,canFinishLocalDrop:e=>Qv({committed:f.current,cancelled:p.current,dropEffect:e?`copy`:null}),canDropToUnsectioned:g&&l.source.sourceSectionId!==null,isUnsectionedTarget:g&&l.over?.kind===`unsectioned`,canDragRow:_,startFromUnsectioned:e=>{v(e,null)},hoverUnsectioned:()=>{y({kind:`unsectioned`})},dropUnsectioned:e=>{x({kind:`unsectioned`},e)},clearHover:b,end:S,interaction:C}}function Uy(e,t){let n=tv(e),r=n.find(e=>e.key===`local`)??{key:`local`,workspaces:[]},i=/* @__PURE__ */ new Map;for(let e of n)e.key!==`local`&&e.hostId!==void 0&&i.set(e.hostId,{...e,workspaces:e.workspaces.filter(e=>!$_(e))});for(let e of t){if(!e.enabled){i.delete(e.hostId);continue}let t=i.get(e.hostId);t===void 0?i.set(e.hostId,{key:e.hostId,hostId:e.hostId,displayName:e.name,state:e.state,workspaces:[]}):i.set(e.hostId,{...t,displayName:e.name||t.displayName,state:e.state||t.state})}return[r,...i.values()]}function Wy(e,t){return t===void 0?`local`:e.find(e=>e.workspaceId===t)?.remote?.hostId??`local`}function Gy(e,t,n){let r=t.trim().toLowerCase();return r===``?[...e]:e.filter(e=>(e.key===`local`?n:e.displayName??e.hostId??e.key).toLowerCase().includes(r)||e.hostId!==void 0&&e.hostId.toLowerCase().includes(r))}function Ky(e,t,n){let r=e.filter(e=>!$_(e)),i=t.trim().toLowerCase();return i===``?r:r.filter(e=>{let t=n(e).toLowerCase(),r=(e.path??``).toLowerCase();return t.includes(i)||r.includes(i)})}function qy(e,t){if(!e)return;let n=e.replace(/[\\/]+$/u,``);if(!n)return;let r=n.split(/[\\/]+/u).filter(Boolean);if(r.length<2)return;let i=r[r.length-2];if(i&&i!==t&&i!==`~`&&i!==`Users`&&i!==`home`)return i}function Jy(e){if(typeof e!=`object`||!e)return[];let t=e.result;if(typeof t!=`object`||!t)return[];let n=t,r=(n.ok===!0&&typeof n.value==`object`&&n.value!==null?n.value:n).peers;if(!Array.isArray(r))return[];let i=[];for(let e of r){if(typeof e!=`object`||!e)continue;let t=e;typeof t.hostId==`string`&&t.hostId!==``&&typeof t.name==`string`&&typeof t.state==`string`&&i.push({hostId:t.hostId,name:t.name,state:t.state,enabled:t.enabled!==!1})}return i}function Yy(e,t){if(t.workspaceId!==void 0){let n=e.find(e=>e.workspaceId===t.workspaceId);if(n!==void 0)return n}let n=t.path.replace(/[\\/]+$/u,``);return e.find(e=>e.remote?.hostId===t.hostId&&e.path.replace(/[\\/]+$/u,``)===n)}let Xy=`@deepseek-ai/dsh-client-ui-workspace/HeroLocationWorkspacePicker.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Xy)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Xy,e.textContent=`.tXrwyq_root{align-items:center;gap:4px;min-width:0;max-width:100%;display:inline-flex}.tXrwyq_trigger{min-width:0;max-width:240px;height:30px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;background:0 0;border:none;border-radius:9999px;align-items:center;gap:7px;padding:0 10px;font-size:13.5px;font-weight:450;line-height:20px;transition:background-color .11s,color .11s;display:inline-flex}.tXrwyq_trigger:hover:not(:disabled),.tXrwyq_triggerOpen{background:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent)}.tXrwyq_trigger:disabled{opacity:.55;cursor:default}.tXrwyq_trigger:focus-visible,.tXrwyq_row:focus-visible,.tXrwyq_footerAction:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.tXrwyq_triggerPlaceholder{color:var(--dsw-alias-label-tertiary);font-weight:400}.tXrwyq_triggerPlaceholder:hover:not(:disabled),.tXrwyq_triggerPlaceholder.tXrwyq_triggerOpen{color:var(--dsw-alias-label-secondary)}.tXrwyq_triggerLocation{flex:0 auto;max-width:180px}.tXrwyq_triggerProject{flex:0 auto;max-width:260px}.tXrwyq_triggerIcon{color:currentColor;opacity:.9;flex:none}.tXrwyq_triggerPlaceholder .tXrwyq_triggerIcon{opacity:.8}.tXrwyq_triggerLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.tXrwyq_statusDot{background:var(--dsw-alias-label-tertiary);opacity:.78;border-radius:50%;flex:none;width:6px;height:6px}.tXrwyq_statusDot[data-state=connecting]{background:var(--dsw-alias-state-warning-primary,#c27803);opacity:.92}.tXrwyq_statusDot[data-state=auth-error]{background:var(--dsw-alias-state-error-primary);opacity:.92}.tXrwyq_popover{z-index:1100;box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);--dsw-elevation-stroke-color:transparent;box-shadow:var(--dsw-elevation-prominent);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);color:var(--dsw-alias-label-primary);border-radius:16px;flex-direction:column;padding:6px;display:flex;position:fixed}.tXrwyq_popoverLocation{width:min(264px,100vw - 24px)}.tXrwyq_popoverProject{width:min(280px,100vw - 24px)}.tXrwyq_searchRow{align-items:center;gap:8px;height:36px;padding:0 10px;display:flex}.tXrwyq_searchIcon{color:var(--dsw-alias-label-tertiary);flex:none}.tXrwyq_searchInput{min-width:0;height:100%;color:var(--dsw-alias-label-primary);font:inherit;background:0 0;border:none;outline:none;flex:1;padding:0;font-size:14px;line-height:20px}.tXrwyq_searchInput::placeholder{color:var(--dsw-alias-label-tertiary)}.tXrwyq_divider{background:var(--dsw-alias-border-l2);flex:none;height:.5px;margin:4px 10px 6px}.tXrwyq_footerDivider{background:var(--dsw-alias-border-l2);flex:none;height:.5px;margin:6px 10px 4px}.tXrwyq_list{flex-direction:column;gap:2px;max-height:260px;display:flex;overflow-y:auto}.tXrwyq_row{width:100%;min-height:36px;color:var(--dsw-alias-label-primary);font:inherit;text-align:left;cursor:pointer;background:0 0;border:none;border-radius:11px;align-items:center;gap:9px;padding:6px 10px;font-size:14px;font-weight:450;line-height:20px;transition:background-color 90ms;display:flex}.tXrwyq_row:hover,.tXrwyq_rowActive{background:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent)}.tXrwyq_rowIcon{width:16px;height:16px;color:var(--dsw-alias-label-secondary);flex:none;justify-content:center;align-items:center;display:inline-flex}.tXrwyq_rowMain{flex:1;align-items:baseline;gap:7px;min-width:0;display:flex}.tXrwyq_rowTitle{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.tXrwyq_rowHint{text-overflow:ellipsis;white-space:nowrap;min-width:0;color:var(--dsw-alias-label-tertiary);flex:0 auto;font-size:13px;font-weight:400;line-height:18px;overflow:hidden}.tXrwyq_rowStatus{color:var(--dsw-alias-label-tertiary);flex:none;font-size:11.5px;line-height:16px}.tXrwyq_checkSlot{width:16px;height:16px;color:var(--dsw-alias-label-primary);flex:none;justify-content:center;align-items:center;display:inline-flex}.tXrwyq_emptyState{text-align:center;color:var(--dsw-alias-label-tertiary);padding:16px 10px;font-size:13px;line-height:18px}.tXrwyq_footerAction{width:100%;min-height:36px;color:var(--dsw-alias-label-primary);font:inherit;text-align:left;cursor:pointer;background:0 0;border:none;border-radius:11px;align-items:center;gap:9px;padding:6px 10px;font-size:14px;font-weight:450;line-height:20px;transition:background-color 90ms;display:flex}.tXrwyq_footerAction:hover:not(:disabled){background:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent)}.tXrwyq_footerAction:disabled{opacity:.5;cursor:default}.tXrwyq_footerIcon{color:var(--dsw-alias-label-secondary);flex:none}.tXrwyq_modalAction{min-width:72px}.tXrwyq_modalError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}@media (hover:none),(pointer:coarse){.tXrwyq_trigger{min-height:34px;padding:0 11px}.tXrwyq_row,.tXrwyq_footerAction{min-height:40px}}@media (prefers-reduced-motion:reduce){.tXrwyq_trigger,.tXrwyq_row,.tXrwyq_footerAction{transition:none}}`,document.head.appendChild(e)}var $={checkSlot:`tXrwyq_checkSlot`,divider:`tXrwyq_divider`,emptyState:`tXrwyq_emptyState`,footerAction:`tXrwyq_footerAction`,footerDivider:`tXrwyq_footerDivider`,footerIcon:`tXrwyq_footerIcon`,list:`tXrwyq_list`,modalAction:`tXrwyq_modalAction`,modalError:`tXrwyq_modalError`,popover:`tXrwyq_popover`,popoverLocation:`tXrwyq_popoverLocation`,popoverProject:`tXrwyq_popoverProject`,root:`tXrwyq_root`,row:`tXrwyq_row`,rowActive:`tXrwyq_rowActive`,rowHint:`tXrwyq_rowHint`,rowIcon:`tXrwyq_rowIcon`,rowMain:`tXrwyq_rowMain`,rowStatus:`tXrwyq_rowStatus`,rowTitle:`tXrwyq_rowTitle`,searchIcon:`tXrwyq_searchIcon`,searchInput:`tXrwyq_searchInput`,searchRow:`tXrwyq_searchRow`,statusDot:`tXrwyq_statusDot`,trigger:`tXrwyq_trigger`,triggerIcon:`tXrwyq_triggerIcon`,triggerLabel:`tXrwyq_triggerLabel`,triggerLocation:`tXrwyq_triggerLocation`,triggerOpen:`tXrwyq_triggerOpen`,triggerPlaceholder:`tXrwyq_triggerPlaceholder`,triggerProject:`tXrwyq_triggerProject`};let Zy=`codexhost:remote-peers-updated`,Qy=`codexhost:remote-workspace-created`,$y=`codexhost/remote-peers/list`,eb=`::no-project`;function tb({className:e}){return/* @__PURE__ */ (0,o.jsxs)(`svg`,{width:15,height:15,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,o.jsx)(`rect`,{x:`2.25`,y:`2.75`,width:`11.5`,height:`8`,rx:`1.5`}),/* @__PURE__ */ (0,o.jsx)(`path`,{d:`M1.25 12.75h13.5`})]})}function nb({className:e}){return/* @__PURE__ */ (0,o.jsxs)(`svg`,{width:15,height:15,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,o.jsx)(`rect`,{x:`2`,y:`2.5`,width:`12`,height:`8.5`,rx:`1.6`}),/* @__PURE__ */ (0,o.jsx)(`path`,{d:`M5.5 13.5h5M8 11v2.5`})]})}function rb(e,t){return e.key===`local`?t(`host.thisComputer`):e.displayName||e.hostId||e.key}function ib(e,t){if(e!==void 0&&e!==`connected`)return t(e===`connecting`?`host.connecting`:`host.disconnected`)}function ab({location:e,className:t}){return e.key===`local`?/* @__PURE__ */ (0,o.jsx)(tb,{className:t}):e.state!==void 0&&e.state!==`connected`?/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.statusDot,"data-state":e.state,"aria-hidden":`true`}):/* @__PURE__ */ (0,o.jsx)(nb,{className:t})}async function ob(e){try{let t=typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`hero-peers-${Date.now()}`,n=await fetch(`api/${$y}`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({type:`client-request`,rpcId:t,method:$y,payload:{args:{}}}),...e===void 0?{}:{signal:e}});return n.ok?Jy(await n.json()):null}catch{return null}}function sb({open:e,selectedId:t,fallbackLabel:n,onOpenChange:i,onPick:a,onClose:l,useWorkspaces:u,createWorkspace:d,useDirectoryFlow:f,renderSlot:p,t:m}){let h=u(e=>e),g=h.items,_=h.canStartProjectless===!0,v=f(e=>e),[y,b]=(0,s.useState)([]),[x,S]=(0,s.useState)(!1),[C,w]=(0,s.useState)(!1),[T,E]=(0,s.useState)(!1),[D,ee]=(0,s.useState)(``),[te,ne]=(0,s.useState)(``),[re,ie]=(0,s.useState)(-1),[ae,oe]=(0,s.useState)(-1),[se,O]=(0,s.useState)(!1),[ce,k]=(0,s.useState)(!1),[A,le]=(0,s.useState)(!1),[ue,j]=(0,s.useState)(null),de=(0,r.usePhoneSidebar)(),M=(0,s.useRef)(!1),fe=(0,s.useRef)(null),[pe,me]=(0,s.useState)(null),he=(0,s.useRef)(null),ge=(0,s.useRef)(null),_e=(0,s.useRef)(null),ve=(0,s.useRef)(null),ye=(0,s.useRef)(null),be=(0,s.useRef)(null),xe=(0,s.useRef)(null),Se=(0,s.useId)(),N=(0,s.useId)(),Ce=e||T,we=se||ce,Te=(0,s.useMemo)(()=>Wy(g,t),[g,t]),Ee=(0,s.useMemo)(()=>Uy(g,y),[g,y]),De=(0,s.useMemo)(()=>new Set(Ee.map(e=>e.key)),[Ee]),Oe=(0,s.useMemo)(()=>new Set(y.filter(e=>!e.enabled).map(e=>e.hostId)),[y]),ke=h.phase===`ready`&&h.state===`idle`&&x,[Ae,je]=(0,s.useState)(()=>Te),P=(0,s.useCallback)((e,t=!1)=>{E(e),i?.(e),e||(t||je(De.has(Te)?Te:`local`),l())},[De,l,i,Te]);(0,s.useEffect)(()=>{e&&(w(!1),E(!0))},[e]);let Me=(0,s.useCallback)(e=>{ob(e).then(t=>{e?.aborted||t===null||(b(t),S(!0))})},[]);(0,s.useEffect)(()=>{let e=new AbortController;Me(e.signal);let t=()=>{Me()};return window.addEventListener(Zy,t),()=>{e.abort(),window.removeEventListener(Zy,t)}},[Me]),(0,s.useEffect)(()=>{C&&Me()},[C,Me]),(0,s.useEffect)(()=>{let e=e=>{let t=e.detail;t&&typeof t.hostId==`string`&&typeof t.path==`string`&&fe.current!==null&&t.hostId===fe.current&&(fe.current=null,me({hostId:t.hostId,path:t.path,...typeof t.workspaceId==`string`?{workspaceId:t.workspaceId}:{}}))};return window.addEventListener(Qy,e),()=>{window.removeEventListener(Qy,e)}},[]);let Ne=(0,s.useRef)(t);(0,s.useEffect)(()=>{if(t!==Ne.current&&(Ne.current=t,t!==void 0)){let e=Wy(g,t);je(De.has(e)?e:`local`)}},[De,t,g]),(0,s.useEffect)(()=>{t!==void 0&&Te!==`local`&&De.has(Te)&&je(e=>e===`local`?Te:e)},[De,t,Te]);let Pe=(0,s.useRef)(void 0);(0,s.useEffect)(()=>{let e=e=>e!==`local`&&!De.has(e)&&(ke||Oe.has(e));e(Ae)&&je(`local`),fe.current!==null&&e(fe.current)&&(fe.current=null),pe!==null&&e(pe.hostId)&&me(null);let n=t===void 0?void 0:g.find(e=>e.workspaceId===t),r=n?.remote!==void 0&&e(n.remote.hostId),i=pe!==null&&!e(pe.hostId)&&pe.workspaceId===t,o=ke&&t!==void 0&&n===void 0&&!i&&(Ae!==`local`||t.startsWith(`remote-peer:`));r||o?_&&Pe.current!==t&&(Pe.current=t,a(null)):Pe.current=void 0},[Ae,De,_,Oe,ke,a,pe,t,g]);let Fe=(0,s.useMemo)(()=>Ee.find(e=>e.key===Ae)??Ee[0]??{key:`local`,workspaces:[]},[Ae,Ee]);(0,s.useEffect)(()=>{if(pe===null)return;let e=Yy(g,pe);e!==void 0&&(me(null),je(e.remote?.hostId??`local`),a(e.workspaceId))},[a,pe,g]),(0,s.useEffect)(()=>{se&&!v&&O(!1)},[se,v]);let Ie=(0,r.useAnchoredPosition)({open:C,anchorRef:ge,panelRef:ve,side:`bottom`,align:`start`,gap:6,margin:12}),Le=(0,r.useAnchoredPosition)({open:Ce,anchorRef:_e,panelRef:ye,side:`bottom`,align:`start`,gap:6,margin:12});(0,r.useDismissOnOutsidePointer)(he,C,w,ve),(0,r.useDismissOnOutsidePointer)(he,Ce,(0,s.useCallback)(e=>{e||P(!1)},[P]),ye),(0,s.useEffect)(()=>{if(!C)return;ee(``),ie(-1);let e=requestAnimationFrame(()=>{be.current?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(e)},[C]),(0,s.useEffect)(()=>{if(!Ce)return;ne(``),oe(-1);let e=requestAnimationFrame(()=>{xe.current?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(e)},[Ce]),(0,s.useEffect)(()=>{if(!C&&!Ce)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),C?(w(!1),ge.current?.focus({preventScroll:!0})):Ce&&(P(!1),_e.current?.focus({preventScroll:!0})))};return document.addEventListener(`keydown`,e,!0),()=>{document.removeEventListener(`keydown`,e,!0)}},[C,Ce,P]);let Re=(0,s.useCallback)(e=>E_(e.title,m(`workspace.defaultName`)),[m]),F=(0,s.useMemo)(()=>Gy(Ee,D,m(`host.thisComputer`)),[Ee,D,m]),ze=(0,s.useMemo)(()=>Ky(Fe.workspaces,te,Re),[Fe.workspaces,te,Re]),Be=Fe.key===`local`&&_&&te.trim()===``,Ve=(0,s.useMemo)(()=>[...Be?[{id:eb,workspace:void 0}]:[],...ze.map(e=>({id:e.workspaceId,workspace:e}))],[ze,Be]);(0,s.useEffect)(()=>{ie(e=>F.length===0?-1:e>=F.length?0:e)},[F.length]),(0,s.useEffect)(()=>{oe(e=>Ve.length===0?-1:e>=Ve.length?0:e)},[Ve.length]);let He=Ee.length>1,Ue=rb(Fe,m),We=(0,s.useMemo)(()=>t===void 0?void 0:g.find(e=>e.workspaceId===t&&!$_(e)),[t,g]),Ge=We!==void 0&&(We.remote?.hostId??`local`)===Fe.key,I=Ge&&We!==void 0?Re(We):t===void 0&&Fe.key===`local`&&n!==void 0?n:m(`heroPicker.project.choose`),Ke=!Ge&&(t!==void 0||Fe.key!==`local`||n===void 0),qe=e=>{let t=e.key!==Fe.key;je(e.key),w(!1),t&&P(!0)},Je=e=>{fe.current=null,P(!1,!0),a(e===eb?null:e)},Ye=(0,s.useCallback)(()=>{fe.current=null,M.current=de?.open===!0,P(!1,!0),le(!1),j(null),O(!0)},[de?.open,P]),Xe=()=>{Fe.key===`local`?v&&!we&&Ye():Fe.hostId?.startsWith(`remote-peer:`)&&Fe.state===`connected`&&(P(!1),fe.current=Fe.hostId,window.dispatchEvent(new CustomEvent(`codexhost:open-add-remote-workspace`,{detail:{hostId:Fe.hostId}})))},Ze=Fe.key===`local`?v:Fe.hostId?.startsWith(`remote-peer:`)===!0&&Fe.state===`connected`,Qe=()=>{w(!1),window.dispatchEvent(new CustomEvent(`codexhost:open-remote-peers-settings`))},L=e=>d({path:e}).then(e=>{O(!1),je(`local`),a(e.workspaceId)}).catch(e=>{j(e instanceof Error?e.message:String(e)),O(!1),le(!0)}),$e={open:se,busy:ce,onPicked:e=>{k(!0),L(e).finally(()=>{k(!1)})},onCancel:()=>{O(!1)},onError:e=>{O(!1),j(e),le(!0)}},et=e=>{if(F.length!==0){if(e.key===`ArrowDown`)e.preventDefault(),ie(e=>e<0?0:(e+1)%F.length);else if(e.key===`ArrowUp`)e.preventDefault(),ie(e=>e<0?F.length-1:(e-1+F.length)%F.length);else if(e.key===`Enter`){e.preventDefault();let t=F[re>=0?re:0];t!==void 0&&qe(t)}}},tt=e=>{if(Ve.length!==0){if(e.key===`ArrowDown`)e.preventDefault(),oe(e=>e<0?0:(e+1)%Ve.length);else if(e.key===`ArrowUp`)e.preventDefault(),oe(e=>e<0?Ve.length-1:(e-1+Ve.length)%Ve.length);else if(e.key===`Enter`){e.preventDefault();let t=Ve[ae>=0?ae:0];t!==void 0&&Je(t.id)}}},nt=()=>{le(!1),j(null)};return/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:he,className:$.root,"data-hero-location-picker":``,children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{ref:ge,type:`button`,className:X($.trigger,$.triggerLocation,C&&$.triggerOpen),"aria-haspopup":`dialog`,"aria-expanded":C,"aria-controls":C?Se:void 0,"aria-label":m(`heroPicker.location.aria`,{current:Ue}),disabled:we,"data-hero-location-trigger":``,onClick:()=>{P(!1),w(e=>!e)},children:[/* @__PURE__ */ (0,o.jsx)(ab,{location:Fe,className:$.triggerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.triggerLabel,children:Ue})]}),/* @__PURE__ */ (0,o.jsxs)(`button`,{ref:_e,type:`button`,className:X($.trigger,$.triggerProject,Ke&&$.triggerPlaceholder,Ce&&$.triggerOpen),"aria-haspopup":`dialog`,"aria-expanded":Ce,"aria-controls":Ce?N:void 0,"aria-label":m(`heroPicker.project.aria`,{current:I}),disabled:we,"data-hero-project-trigger":``,onClick:()=>{w(!1),P(!Ce)},children:[Ke?/* @__PURE__ */ (0,o.jsx)(r.IconFolderCloseRegular,{size:15,className:$.triggerIcon}):/* @__PURE__ */ (0,o.jsx)(r.IconFolderOpenOutlineRegular,{size:15,className:$.triggerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.triggerLabel,children:I})]}),C&&(0,c.createPortal)(/* @__PURE__ */ (0,o.jsxs)(r.MenuSurface,{ref:ve,id:Se,role:`dialog`,"aria-label":m(`heroPicker.location.placeholder`),className:X($.popover,$.popoverLocation),style:Ie??{visibility:`hidden`,left:0,top:0},"data-hero-location-popover":``,onClick:e=>{e.stopPropagation()},children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:$.searchRow,children:[/* @__PURE__ */ (0,o.jsx)(r.IconSearchOutlineRegular,{size:15,className:$.searchIcon}),/* @__PURE__ */ (0,o.jsx)(`input`,{ref:be,type:`text`,className:$.searchInput,value:D,placeholder:m(`heroPicker.location.placeholder`),"aria-label":m(`heroPicker.location.placeholder`),spellCheck:!1,autoComplete:`off`,onChange:e=>{ee(e.target.value),ie(e.target.value.trim()===``?-1:0)},onKeyDown:et})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.divider,role:`separator`}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.list,role:`listbox`,"aria-label":m(`heroPicker.location.placeholder`),onMouseLeave:()=>ie(-1),children:F.length===0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.emptyState,children:m(`heroPicker.location.empty`)}):F.map((e,t)=>{let n=e.key===Fe.key,i=rb(e,m),a=ib(e.state,m);return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n,className:X($.row,t===re&&$.rowActive),onMouseEnter:()=>ie(t),onClick:()=>qe(e),children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowIcon,children:/* @__PURE__ */ (0,o.jsx)(ab,{location:e})}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowMain,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowTitle,children:i})}),a!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowStatus,children:a}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.checkSlot,children:n&&/* @__PURE__ */ (0,o.jsx)(r.IconCheckOutlineRegular,{size:15})})]},e.key)})}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.footerDivider,role:`separator`}),/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:$.footerAction,onClick:Qe,children:[He?/* @__PURE__ */ (0,o.jsx)(r.IconSettingsOutlineRegular,{size:15,className:$.footerIcon}):/* @__PURE__ */ (0,o.jsx)(r.IconPlusOutlineRegular,{size:15,className:$.footerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:m(He?`heroPicker.location.manageRemote`:`heroPicker.location.connectRemote`)})]})]}),document.body),Ce&&(0,c.createPortal)(/* @__PURE__ */ (0,o.jsxs)(r.MenuSurface,{ref:ye,id:N,role:`dialog`,"aria-label":m(`heroPicker.project.placeholder`),className:X($.popover,$.popoverProject),style:Le??{visibility:`hidden`,left:0,top:0},"data-hero-project-popover":``,onClick:e=>{e.stopPropagation()},children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:$.searchRow,children:[/* @__PURE__ */ (0,o.jsx)(r.IconSearchOutlineRegular,{size:15,className:$.searchIcon}),/* @__PURE__ */ (0,o.jsx)(`input`,{ref:xe,type:`text`,className:$.searchInput,value:te,placeholder:m(`heroPicker.project.placeholder`),"aria-label":m(`heroPicker.project.placeholder`),spellCheck:!1,autoComplete:`off`,onChange:e=>{ne(e.target.value),oe(e.target.value.trim()===``?-1:0)},onKeyDown:tt})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.divider,role:`separator`}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.list,role:`listbox`,"aria-label":m(`heroPicker.project.placeholder`),onMouseLeave:()=>oe(-1),children:h.phase===`pending`&&Ve.length===0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.emptyState,role:`status`,children:m(`picker.loading`)}):Ve.length===0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.emptyState,children:te.trim()===``?m(`heroPicker.project.empty`):m(`heroPicker.project.noMatches`)}):Ve.map((e,n)=>{let i=e.workspace===void 0,a=i?t===void 0:e.id===t,s=i?m(`heroPicker.project.noProject`):Re(e.workspace),c=i?void 0:qy(e.workspace.path,s);return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":a,className:X($.row,n===ae&&$.rowActive),title:e.workspace?.path||s,onMouseEnter:()=>oe(n),onClick:()=>Je(e.id),children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowIcon,children:/* @__PURE__ */ (0,o.jsx)(r.IconFolderCloseRegular,{size:15})}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:$.rowMain,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowTitle,children:s}),c!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowHint,children:c})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.checkSlot,children:a&&/* @__PURE__ */ (0,o.jsx)(r.IconCheckOutlineRegular,{size:15})})]},e.id)})}),Ze&&/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.footerDivider,role:`separator`}),/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:$.footerAction,disabled:we,onClick:Xe,children:[/* @__PURE__ */ (0,o.jsx)(r.IconPlusOutlineRegular,{size:15,className:$.footerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:m(`heroPicker.project.new`)})]})]})]}),document.body),p(`conversation.hero.workspace.directoryFlow`,$e),/* @__PURE__ */ (0,o.jsx)(r.Modal,{phoneSidebar:!0,phoneSidebarOrigin:M.current,open:A,onClose:nt,closeLabel:m(`close`),title:m(`folderError.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,className:$.modalAction,onClick:nt,children:m(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`primary`,className:$.modalAction,disabled:!v,onClick:Ye,children:m(`folderError.retry`)})]}),children:/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.modalError,role:`alert`,children:ue})})]})}let cb=`@deepseek-ai/dsh-client-ui-workspace/WorkspacePicker.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(cb)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=cb,e.textContent=`.s4nt4G_modalAction{min-width:72px}.s4nt4G_modalError,.s4nt4G_menuStatus{margin-top:8px;font-size:12px;line-height:18px}.s4nt4G_modalError{color:var(--dsw-alias-state-error-primary)}.s4nt4G_menuStatus{color:var(--dsw-alias-label-secondary)}`,document.head.appendChild(e)}var lb={menuStatus:`s4nt4G_menuStatus`,modalAction:`s4nt4G_modalAction`,modalError:`s4nt4G_modalError`};let ub=`::add-workspace`,db=`::no-workspace`;function fb({t:e,open:t,anchorRef:n,useWorkspaces:i,createWorkspace:a,useDirectoryFlow:c,renderDirectoryFlow:l,onPick:u,onPickNone:d,onClose:f,addOnly:p=!1,onBusyChange:m,side:h=`bottom`,selectedId:g}){let _=i(e=>e),v=_.items.filter(e=>!$_(e)),y=(0,s.useCallback)(()=>n?.current?.getBoundingClientRect()??null,[n]),[b,x]=(0,s.useState)(!1),[S,C]=(0,s.useState)(null),[w,T]=(0,s.useState)(!1),E=(0,r.usePhoneSidebar)(),D=(0,s.useRef)(!1),[ee,te]=(0,s.useState)(!1),ne=w||ee;(0,s.useEffect)(()=>{m?.(ne)},[ne,m]);let re=c(e=>e);(0,s.useEffect)(()=>{w&&!re&&T(!1)},[w,re]);let ie=re?[{id:ub,label:e(`menu.addWorkspace`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconPlusOutlineRegular,{size:16}),disabled:ne}]:[],ae=!p&&v.length>0,oe=d!==void 0&&!p,se=oe?[{id:db,label:e(`menu.noWorkspace`),disabled:ne}]:[],O=ae?[...se,...v.map(t=>({id:t.workspaceId,label:E_(t.title,e(`workspace.defaultName`)),icon:/* @__PURE__ */ (0,o.jsx)(r.IconFolderCloseRegular,{size:16}),disabled:ne}))]:[...se,...ie],ce=O.length===0,k=()=>{x(!1),C(null)},A=e=>a({path:e}).then(e=>{T(!1),u(e.workspaceId)}).catch(e=>{C(e instanceof Error?e.message:String(e)),T(!1),x(!0)}),le=(0,s.useCallback)(()=>{D.current=E?.open===!0,f(),x(!1),C(null),T(!0)},[f,E?.open]),ue=p||_.phase===`ready`,j=!oe&&!ae&&ue&&ie.length===1;(0,s.useEffect)(()=>{t&&j&&!ne&&le()},[t,j,ne,le]);let de={open:w,busy:ee,onPicked:e=>{te(!0),A(e).finally(()=>{te(!1)})},onCancel:()=>{T(!1)},onError:e=>{T(!1),C(e),x(!0)}},M=e=>{e===db?d?.():e===ub?le():u(e)};return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Menu,{open:t&&!j&&!ce,anchor:null,items:O,...ae?{footer:ie}:{},selectedId:g??(oe?db:void 0),onSelect:M,onClose:f,side:h,portal:!0,getAnchorRect:y}),t&&!j&&!ce&&_.phase===`pending`&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:lb.menuStatus,role:`status`,children:e(`picker.loading`)}),l(de),/* @__PURE__ */ (0,o.jsx)(r.Modal,{phoneSidebar:!0,phoneSidebarOrigin:D.current,open:b,onClose:k,closeLabel:e(`close`),title:e(`folderError.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,className:lb.modalAction,onClick:k,children:e(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`primary`,className:lb.modalAction,disabled:!re,onClick:le,children:e(`folderError.retry`)})]}),children:/* @__PURE__ */ (0,o.jsx)(`div`,{className:lb.modalError,role:`alert`,children:S})})]})}function pb(e){return/* @__PURE__ */ (0,o.jsx)(sb,{...e})}function mb(e){let t=e.replaceAll(`\0`,``);if(t.length<=500)return t;let n=500,r=t.charCodeAt(n-1),i=t.charCodeAt(n);return r>=55296&&r<=56319&&i>=56320&&i<=57343&&n--,t.slice(0,n)}function hb(e){(0,s.useEffect)(()=>{if(!e)return;let t=e=>{e.defaultPrevented||(e.preventDefault(),e.dataTransfer!==null&&(e.dataTransfer.dropEffect=`move`))},n=e=>{e.preventDefault()};return document.addEventListener(`dragover`,t),document.addEventListener(`drop`,n),()=>{document.removeEventListener(`dragover`,t),document.removeEventListener(`drop`,n)}},[e])}function gb({groupBy:e,orderBy:t,archivedFilter:n,onGroupPick:i,onOrderPick:a,onArchivedFilterPick:c,t:l}){let[u,d]=(0,s.useState)(!1),f=(0,s.useRef)(null),p=(0,r.usePhoneSidebar)(),{collapseStyle:m,setCollapseStyle:h}=wv(),{busy:g,failed:_,save:v}=f_(h);return/* @__PURE__ */ (0,o.jsx)(r.Menu,{phoneSidebarTitle:l(`viewOptions.label`),open:u,onClose:()=>{d(!1)},items:[{type:`label`,id:`group-by`,text:l(`groupBy.label`)},{id:`workspace`,label:l(`groupBy.workspace`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconFolderCloseRegular,{})},{id:`workspace-tree`,label:l(`groupBy.workspaceTree`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconWorkspaceTreeOutlineRegular,{})},{id:`flat`,label:l(`groupBy.flat`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconFlatListOutlineRegular,{})},{type:`separator`,id:`order-by-separator`},{type:`label`,id:`order-by`,text:l(`orderBy.label`)},{id:`manual`,label:l(`orderBy.manual`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconChevronsUpDownOutlineRegular,{})},{id:`updated`,label:l(`orderBy.updated`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconClockOutlineRegular,{})},{type:`separator`,id:`archived-filter-separator`},{type:`label`,id:`filter-by`,text:l(`filterBy.label`)},{id:`hide-archived`,label:l(`viewOptions.hideArchived`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconArchiveOffOutlineRegular,{})},{id:`show-archived`,label:l(`viewOptions.showArchived`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconQueueOutlineRegular,{})},{id:`only-archived`,label:l(`viewOptions.onlyArchived`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconArchiveCheckOutlineRegular,{})},{type:`separator`,id:`thread-tree-style-separator`},{type:`label`,id:`thread-tree-style`,text:l(`threadTree.style.title`)},{id:`summary`,label:l(`threadTree.style.summary`),disabled:g},{id:`ring`,label:l(`threadTree.style.ring`),disabled:g}],selectedIds:[e,t,{default:`hide-archived`,show:`show-archived`,only:`only-archived`}[n],m],onSelect:e=>{e===`summary`||e===`ring`?v(e).then(e=>{e&&(d(!1),f.current&&(0,r.focusWithoutRing)(f.current))}):(e===`workspace`||e===`workspace-tree`||e===`flat`?i(e):e===`manual`||e===`updated`?a(e):e===`hide-archived`?c(`default`):e===`show-archived`?c(`show`):e===`only-archived`&&c(`only`),d(!1))},align:`end`,dense:!0,listClassName:Z.viewOptionsMenu,portal:!0,anchor:/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:l(`viewOptions.label`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,ref:f,className:X(Z.iconButton,Z.wide),"aria-label":l(`viewOptions.label`),"data-phone-sidebar-return":p!==null||void 0,onClick:()=>{d(e=>!e)},children:/* @__PURE__ */ (0,o.jsx)(r.IconSlidersTwoOutlineRegular,{})})}),children:_&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:u_.error,role:`alert`,children:l(`threadTree.style.error`)})})}function _b(e,t,n,r,i=!0){let a=t.find(e=>e.id===n.sessionId),o=t.find(e=>e.id===r.id);if(a===void 0||o===void 0||a.blank||i&&(a.pinned!==n.pinned||o.pinned!==n.pinned)||a.id===o.id||!e.includes(a.id))return;let s=i?t.filter(e=>e.pinned===n.pinned):t,c=s.findIndex(e=>e.id===a.id);if(s.filter(e=>e.id!==a.id).findIndex(e=>e.id===o.id)+ +(r.half===`after`)===c)return;let l=e.filter(e=>e!==a.id),u=l.indexOf(o.id);if(u!==-1)return l.splice(u+ +(r.half===`after`),0,a.id),ch(l,t.find(e=>e.blank)?.id)}function vb(e){let t=e.currentTarget.getBoundingClientRect();return e.clientY<t.top+t.height/2?`before`:`after`}function yb(e,t){let n=[...e.map(e=>({kind:`session`,node:e,updatedAt:e.tree?.updatedAt??e.updatedAt})),...t.map(e=>({kind:`group`,room:e,updatedAt:e.updatedAt}))];return n.sort((e,t)=>{if(e.updatedAt!==t.updatedAt)return t.updatedAt-e.updatedAt;let n=e.kind===`group`?`g:${e.room.roomId}`:`s:${e.node.id}`,r=t.kind===`group`?`g:${t.room.roomId}`:`s:${t.node.id}`;return n.localeCompare(r)}),n}function bb({rowState:e,onLeaveArchivedOnly:t,partial:n,t:i}){let a=e.archivedFilter===`only`;return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.emptyState,"data-row-key":`empty`,children:[a?/* @__PURE__ */ (0,o.jsx)(r.IconArchiveOutlineRegular,{size:24}):/* @__PURE__ */ (0,o.jsx)(r.IconQueueOutlineRegular,{size:24}),/* @__PURE__ */ (0,o.jsx)(`div`,{children:i(n?`sessions.notLoaded`:a?`empty.noneArchived`:`empty.none`)}),a&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.emptyAction,onClick:t,children:i(`empty.viewOthers`)})]})}function xb({list:e,groupRooms:t,showGroupsSection:n=!0,useSessionStatus:i,startSession:a,copyWorkingDirectory:c,open:l,workspaces:u,allWorkspaces:d=u,linkedRoots:f,ungroupedSessionIds:p,rowState:m,nativeSections:h,nativeThreadIds:g,useMovingSectionSessions:_,moveSessionToSection:v,finePointer:y,manageThreadSection:b,onLeaveArchivedOnly:x,workspaceReady:S,canStartProjectless:C,animationResetKey:w,scrollRef:T,onScroll:E,sessionLimits:D,setSessionLimits:ee,allWorkspacesShown:te,setAllWorkspacesShown:ne,usePanelInfo:re,onRenameRequest:ie,onDefaultHarnessRequest:ae,onDeleteRequest:oe,onSessionRenameRequest:se,renderSlot:O,insertWorkspaceBefore:ce,moveWorkspaceToSection:k,nestWorkspaces:A,groupExpansion:le,setGroupExpanded:ue,sectionExpansion:j,setSectionExpanded:de,setSessionOrder:M,pinnedWorkspaceIds:fe,setWorkspacePinned:pe,home:me,t:he,revealSessionId:ge,onSessionRevealed:_e,shortcuts:ve,loadMoreSessions:ye,hostScopeFiltered:be=!1,singleRemoteHostScoped:xe=!1,onResetHostScope:Se}){let N=wv(),Ce=(0,r.usePhoneSidebar)(),we=re(e=>e.activePanelId!==null),Te=i(e=>e),Ee=we?void 0:Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,De=(0,s.useMemo)(()=>u.map(e=>{let t=f.get(e.workspaceId);return t===void 0||t.size===0?e:{...e,sessionIds:e.sessionIds.filter(e=>!t.has(e))}}),[f,u]),Oe=ge===void 0||!S?void 0:rh(De,N.rootId(ge)),[ke,Ae]=(0,s.useState)(null),je=(0,s.useRef)(!1),[P,Me]=(0,s.useState)(null),Ne=(0,s.useRef)(!1),Pe=(0,s.useRef)(null),Fe=(0,s.useRef)(null);(0,s.useLayoutEffect)(()=>{let e=Fe.current;if(Fe.current=null,e===null||document.activeElement!==document.body)return;let t=Pe.current?.querySelector(`[role="tree"]`);(t?.querySelector(`[data-row-key="${CSS.escape(`workspace:${e}`)}"]`)??t?.querySelector(`[data-row-key][tabindex="0"]`))?.focus()},[fe]);let Ie=(0,s.useMemo)(()=>new Map(bh(e,m,Te).map(e=>[e.id,e])),[e,m,Te]),Le=(0,s.useMemo)(()=>wb(h,e,m,Te,j,Ie),[h,e,m,Te,j,Ie]),Re=(0,s.useMemo)(()=>new Map(Le.map(e=>[e.id,e.rows.filter(e=>!e.archived&&!e.pinned).map(e=>e.id)])),[Le]),F=Hy({enabled:y&&v!==void 0&&h.length>0,nativeSections:h,visibleSectionRows:Re,nativeThreadIds:g,pinnedSessionIds:m.pinnedSessionIds,archivedSessionIds:m.archivedSessionIds,moveSessionToSection:v,onCancelLocalDrag:()=>{je.current=!0,Ae(null)}}),ze=ke!==null||P!==null||F.active;hb(P!==null||ke!==null);let Be=Ee===void 0||!S?void 0:rh(De,N.rootId(Ee)),Ve=(0,s.useMemo)(()=>new Set(fe),[fe]),{nativeSectionOf:He,sectionOf:Ue}=(0,s.useMemo)(()=>S_(h,Ve),[h,Ve]),[We,Ge]=(0,s.useState)(),[I,Ke]=(0,s.useState)(!1),qe=(0,s.useMemo)(()=>new Set(k&&h.length>0?d.filter(e=>e.projectId&&!e.remote&&!Ve.has(e.workspaceId)).map(e=>e.workspaceId):[]),[d,k,h.length,Ve]);(0,s.useEffect)(()=>{We&&!qe.has(We)&&Ge(void 0)},[We,qe]);let Je=e=>{if(P&&k&&qe.has(P.workspaceId)&&(He.get(P.workspaceId)??null)!==e)return{active:P.overSection===e,hover:()=>{P.overSection!==e&&Me({...P,over:null,overSection:e})},leave:()=>Me(t=>t?.overSection===e?{workspaceId:t.workspaceId,over:null}:t),drop:()=>{Ne.current||(Ne.current=!0,Me(null),Ke(!1),k(P.workspaceId,e).catch(()=>Ke(!0)))}}},Ye=(0,s.useMemo)(()=>C_(u,A,He,Ve),[A,He,Ve,u]),Xe=(0,s.useMemo)(()=>d===u?Ye:C_(d,A,He,Ve),[d,A,He,Ye,Ve,u]),Ze=(0,s.useMemo)(()=>{let e=new Set(Ye.values());return[...u.map(e=>e.workspaceId),``].filter(t=>le[t]??(t===``||e.has(t)))},[le,Ye,u]),Qe=(0,s.useMemo)(()=>{let n=xh(e,u,m,Te,{expandedGroups:Ze,excludePinned:!0},Ie);return(C||t.length>0||e.hasMore&&n.length===0)&&!n.some(e=>e.key===``)&&n.push({key:``,workspaceId:void 0,cwd:void 0,createdAt:void 0,label:``,sessionCount:0,expanded:Ze.includes(``),containsCurrent:!1,activity:{running:0,pendingInteraction:0,completed:0},sessions:[]}),n},[e,u,m,Te,Ze,C,t.length,Ie]),L=Date.now(),$e=e=>Ay(e.sessions,D[e.key]??5,Ee,ge,{keepPinned:e.key!==``}),et=(e,t)=>{if(je.current)return;je.current=!0,Ae(null);let n=Qe.find(t=>t.key===e.accountKey);if(n===void 0||t.id===e.sessionId)return;let r=e.accountKey===``?p:u.find(t=>t.workspaceId===e.accountKey)?.sessionIds;if(r===void 0)return;let i=_b(r,$e(n).rows,e,t);i!==void 0&&M(e.accountKey,i)},tt=(e,t)=>{if(Ne.current)return;Ne.current=!0,Me(null);let n=x_(d,e.workspaceId,t,{sectionOf:Ue,parents:Xe});n!==null&&ce(e.workspaceId,n.beforeWorkspaceId).catch(e=>{console.warn(`workspace reorder rejected:`,e)})},nt=(0,s.useMemo)(()=>{let e=new Set(Qe.map(e=>e.key)),t=/* @__PURE__ */ new Map;for(let n of Qe){let r=Ye.get(n.key);for(;r!==void 0&&!e.has(r);)r=Ye.get(r);let i=t.get(r);i===void 0?t.set(r,[n]):i.push(n)}return t},[Qe,Ye]),rt=nt.get(void 0)??[],it=(0,s.useMemo)(()=>{let e=/* @__PURE__ */ new Map,t=(n,r)=>{e.set(n.key,r);for(let e of nt.get(n.key)??[])t(e,r)};for(let e of rt)t(e,e.key);return e},[nt,rt]),at=(0,s.useMemo)(()=>{let e=/* @__PURE__ */ new Set;for(let t of[Be,Oe]){let n=t===void 0?void 0:it.get(t);n!==void 0&&n!==``&&e.add(n)}return e},[Be,Oe,it]),{pinnedGroups:ot,sectionRoots:st,workspaceRoots:ct}=(0,s.useMemo)(()=>w_(rt,h,fe,Ue),[h,fe,rt,Ue]),lt=jy(ct,5,at),ut=te?ct:lt.rows,dt=Mh(j,kh),ft=Mh(j,Ah),pt=(0,s.useMemo)(()=>[...t].filter(e=>e.pinned).sort((e,t)=>t.updatedAt-e.updatedAt),[t]),mt=(0,s.useMemo)(()=>[...t].sort((e,t)=>t.updatedAt-e.updatedAt),[t]),ht=Oe===void 0?void 0:it.get(Oe),gt=ht!==void 0&&Ve.has(ht);(0,s.useEffect)(()=>{if(gt){dt||de(kh,!0);for(let e=Oe;e!==void 0;e=Ye.get(e))Ze.includes(e)||ue(e,!0)}},[Ze,Ye,dt,Oe,gt,ue,de]);let _t=Mh(j,jh),vt=e=>{e.expanded&&ee(t=>({...t,[e.key]:5})),ue(e.key,!e.expanded)},yt=(0,s.useMemo)(()=>new Set(m.archivedSessionIds),[m.archivedSessionIds]),bt=(0,s.useMemo)(()=>new Map(d.map(e=>[e.workspaceId,e])),[d]),xt=(0,s.useMemo)(()=>wh(e,m.pinnedSessionIds,m,Te,Ie).filter(e=>e.pinned),[e,m,Te,Ie]),St=xt.length>0||ot.length>0||pt.length>0,Ct=dt&&ge!==void 0&&xt.some(e=>e.id===ge||e.tree?.descendantIds.includes(ge)),wt=[];if(St&&(wt.push(`section:${kh}`),dt)){for(let e of pt)wt.push(`pinned-group:${e.roomId}`);for(let e of N.rows(xt))wt.push(`session:${e.id}`)}if(n&&(wt.push(`section:${Ah}`),ft))for(let e of mt)wt.push(`group:${e.roomId}`);let Tt=e=>{let t={...e.activity};for(let n of nt.get(e.key)??[]){let e=Tt(n);t.running+=e.running,t.pendingInteraction+=e.pendingInteraction,t.completed+=e.completed}return t},Et=(t,n)=>{let i=t.workspaceId,s=i!==void 0&&!t.remote,u=Ve.has(t.key),p=nt.get(t.key)??[],h=Ue.has(t.key),g=P!==null&&b_(d,P.workspaceId,i,{sectionOf:Ue,parents:Xe}),v=$e(t);wt.push(`workspace:${t.key}`);let y=t.expanded?p.map(e=>Et(e,n+1)):[],b=t.expanded?void 0:Tt(t),x=N.rows(v.rows),w=f.get(t.key),T=new Set(w===void 0?[]:v.rows.flatMap(e=>w.has(e.id)?[e.id,...e.tree?.descendantIds??[]]:[])),E=i===void 0&&t.expanded&&mt.length>0?yb(v.rows,mt):null,D=e=>i===void 0?`recent:${e}`:T.has(e)?`linked:${t.key}:${e}`:`session:${e}`;if(E!==null)for(let e of E)if(e.kind===`group`)wt.push(`recent-group:${e.room.roomId}`);else for(let t of N.rows([e.node]))wt.push(D(t.id));else for(let e of x)wt.push(D(e.id));let te=e=>m.archivedFilter===`show`?!0:m.archivedFilter===`only`?yt.has(e):!yt.has(e),ne=t.remote&&i!==void 0&&(bt.get(i)?.sessionIds.some(t=>e.byId[t]===void 0&&te(t))??!1),re=s||ne,ce=re?e.workspaceHistory?.[i]??(e.canSearchWorkspaceHistory?`search`:`done`):void 0,k=ce===void 0?!t.remote&&e.hasMore:ce!==`done`,A=t.expanded&&(v.hiddenCount>0||k);A&&wt.push(`overflow:${t.key}`);let le=i!==void 0&&P?.over?.id===i?P?.over?.half??null:null,j=i!==void 0&&qe.has(i),M=i===void 0||h&&!j?void 0:{start:()=>{Ne.current=!1,Me({workspaceId:i,over:null})},end:()=>{P?.over!==null&&P?.over!==void 0?tt(P,P.over):Me(null),Ne.current=!1}},fe=i===void 0||!g?void 0:e=>{Me(t=>t===null?t:{workspaceId:t.workspaceId,over:{id:i,half:e}})},be=i===void 0||!g?void 0:e=>{tt(P,{id:i,half:e})};return/* @__PURE__ */ (0,o.jsxs)(`div`,{"data-sidebar-group":t.key,style:{"--dsh-workspace-indent":`${n*12}px`},className:X(Z.groupSection,le===`before`&&Z.workspaceDropBefore,le===`after`&&Z.workspaceDropAfter),onDragOver:P===null?void 0:e=>{e.preventDefault(),(fe!==void 0||Ye.get(t.key)===void 0)&&(e.stopPropagation(),fe===void 0?(e.dataTransfer.dropEffect=`none`,P.over!==null&&Me({...P,over:null})):(e.dataTransfer.dropEffect=`move`,fe(vb(e))))},onDrop:P===null?void 0:e=>{e.preventDefault(),(be!==void 0||Ye.get(t.key)===void 0)&&(e.stopPropagation(),be===void 0?(Ne.current=!0,Me(null)):be(vb(e)))},children:[i===void 0?/* @__PURE__ */ (0,o.jsx)(Ty,{label:he(`group.ungrouped`),expanded:t.expanded,onToggle:()=>{vt(t)},rowKey:`workspace:${t.key}`,action:C?{label:he(`actions.newSession`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconNewChatOutlineRegular,{size:16}),onActivate:()=>{ue(t.key,!0),Ce?.close(),a()}}:void 0}):/* @__PURE__ */ (0,o.jsx)(fy,{copyWorkingDirectory:c,newShortcut:ve.find(e=>e.id===`session.new`),group:t,foldedActivity:b,showHost:!xe,home:me,t:he,onToggle:()=>{vt(t)},onCreate:()=>{t.workspaceId!==void 0&&(ue(t.key,t.expanded),Ce?.close(),a(t.workspaceId))},drag:M,pin:pe?{pinned:u,toggle:()=>{Fe.current=i,u||de(kh,!0),pe(i,!u).catch(e=>{console.warn(`workspace pin rejected:`,e)})}}:void 0,actions:s?{...j?{moveToSection:()=>Ge(i)}:{},rename:()=>ie(i,t.label),defaultHarness:e=>ae(i,t.label,e),delete:()=>oe(i,t.label)}:void 0}),y.length>0&&/* @__PURE__ */ (0,o.jsx)(`div`,{role:`group`,children:y}),(x.length>0||E!==null&&E.length>0||A)&&/* @__PURE__ */ (0,o.jsxs)(`div`,{role:`group`,className:Z.groupSessions,style:{"--dsh-workspace-indent":`${i===void 0?0:n*12+22}px`},onDragOver:ke!==null&&ke.accountKey===t.key?e=>{let t=Zv(e,ke.pinned);t!==null&&(F.clearHover(),(ke.over?.id!==t.id||ke.over.half!==t.half)&&Ae({...ke,over:t}),e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`)}:void 0,onDrop:ke!==null&&ke.accountKey===t.key?e=>{if(e.dataTransfer.dropEffect===`copy`)return;let t=Zv(e,ke.pinned);t!==null&&(e.preventDefault(),e.stopPropagation(),F.end(),et(ke,t))}:void 0,children:[E===null?/* @__PURE__ */ (0,o.jsx)(Bv,{roots:v.rows,children:e=>{let n=ke!==null&&ke.accountKey===t.key,r=n&&ke.pinned===e.pinned,a=t=>e.blank?`after`:t,s=i!==void 0&&!t.remote&&(e.tree?.depth??0)===0,c=F.canDragRow(e,!!t.remote),u=s?{start:()=>{je.current=!1,Ae({accountKey:t.key,sessionId:e.id,pinned:e.pinned,over:null}),c?F.startFromUnsectioned(e.id):F.end()},active:r,marker:!F.hasSectionTarget&&n&&ke.over?.id===e.id?ke.over.half:null,hover:t=>{
121
+ default:return sh(n)}}function Eh(e,t,n){let r=[],i=[];for(let a of e)!n.has(a.id)&&t.has(a.id)?r.push(a):i.push(a);return[...r,...i]}function Dh(e){return e.blank?``:e.title?.trim()??``}function Oh(e){let t=Date.parse(e);return Number.isFinite(t)&&t>0?t:void 0}function kh(e,t,n,r,i,a,o){return{key:e,workspaceId:t,cwd:n,createdAt:r,label:i,sessions:[...a],remote:o}}function Ah(e,t,n,r){let i=new Set(e.workspaceOnlyIds),a=/* @__PURE__ */ new Set,o=[];for(let s of t){let t=[];for(let o of s.sessionIds){let s=e.byId[o];s!==void 0&&Th(s,n,r)&&(t.push(s),i.has(o)&&a.add(o))}(r!==`only`||t.length!==0)&&o.push(kh(s.workspaceId,s.workspaceId,s.path,Oh(s.createdAt),s.title,t,s.remote))}let s=xh(e.ids.filter(e=>!a.has(e)),e.byId).map(t=>e.byId[t]).filter(e=>e!==void 0&&Th(e,n,r));return s.length>0&&o.push(kh(``,void 0,void 0,void 0,``,s)),o}function jh(e){switch(e){case`approval`:case`plan-review`:case`question`:return e;default:return}}function Mh(e,t,n){return e.projectionsBySession[t]?.values.subagentCatalog?.reduce((t,r)=>t+ +((n.get(r.id)?.running??e.byId[r.id]?.running)===!0),0)??0}function Nh(e,t,n){let r=n.get(e.id),i=jh(r?.pendingInteraction?.kind),a=r?.running??e.running,o=Mh(t,e.id,n);return{running:a,runningSubagentCount:o,completed:!a&&o===0&&r?.pendingInteraction===void 0&&r?.completionUnread===!0,...i===void 0?{}:{pendingInteraction:i}}}function Ph(e,t,n,r,i){let a=Nh(e,t,n),o=i.has(e.id);return{id:e.id,reference:fh(e),remote:e.projectionValues?.remoteHost??void 0,title:Dh(e),...e.cwd===void 0?{}:{cwd:e.cwd},blank:e.blank,...a,completed:!o&&a.completed,pinned:!o&&r.has(e.id),archived:o,updatedAt:e.updatedAt}}function Fh(e,t){let n=e.projectionValues?.threadTreeParent??null;if(n===null)return null;let r=t?.byId[nh(n)];return r===void 0?null:(e.projectionValues?.threadReference?.hostId??e.projectionValues?.remoteHost?.hostId??`local`)===(r.projectionValues?.threadReference?.hostId??r.projectionValues?.remoteHost?.hostId??`local`)?n:null}function Ih(e,t,n,r){let i=new Set(t.archivedSessionIds),a=new Set(t.pinnedSessionIds),o=hh(zh(e,t.archivedSessionIds,t.archivedFilter).flatMap(t=>{let r=e.byId[t];return r===void 0?[]:[Ph(r,e,n,a,i)]}),n=>{if(t.sectionedSessionIds?.has(n.id))return null;let r=e.byId[n.id];return r===void 0?null:Fh(r,e)});return r&&r.size>0?_h(o,e=>!e.pinned&&r.has(e.id)):o}function Lh(e,t,n,r,i,a){let o=new Set(n.archivedSessionIds),s=new Set(n.pinnedSessionIds),c=new Set(i.expandedGroups),l=yh(e),u=a??new Map(Ih(e,n,r).map(e=>[e.id,e])),d=i.hiddenSessionIds&&i.hiddenSessionIds.size>0?new Map(_h([...u.values()],e=>!e.pinned&&i.hiddenSessionIds.has(e.id)).map(e=>[e.id,e])):u,f=[];for(let r of Ah(e,t,o,n.archivedFilter)){let e=c.has(r.key),t=r.key===``,a=t?u:d,p=r.sessions.flatMap(e=>{let r=a.get(e.id);return r===void 0||i.excludePinned&&(!t&&r.pinned||n.sectionedSessionIds?.has(r.id))?[]:[r]});t&&p.sort((e,t)=>(t.tree?.updatedAt??t.updatedAt)-(e.tree?.updatedAt??e.updatedAt)||e.id.localeCompare(t.id));let m={running:0,pendingInteraction:0,completed:0};for(let e of p)e.archived||(m.running+=Number(e.running||e.runningSubagentCount>0)+(e.tree?.activity.running??0),m.pendingInteraction+=Number(e.pendingInteraction!==void 0)+(e.tree?.activity.pendingInteraction??0),m.completed+=Number(e.completed)+(e.tree?.activity.completed??0));f.push({key:r.key,workspaceId:r.workspaceId,cwd:r.cwd,createdAt:r.createdAt,label:r.label,remote:r.remote,sessionCount:p.length,expanded:e,activity:m,containsCurrent:p.some(e=>e.id===l||l!==void 0&&e.tree?.descendantIds.includes(l)),sessions:e?t&&i.excludePinned?p:Eh(p,s,o):[]})}return f}function Rh(e,t=[]){return[...zh(e,[],`show`),...t.filter(t=>e.byId[t]===void 0)]}function zh(e,t,n){let r=new Set(t);return e.ids.filter(t=>{let i=e.byId[t];return i!==void 0&&Th(i,r,n)})}function Bh(e,t,n,r,i,a){if(t.length===0)return[];let o=new Set(n.archivedSessionIds),s=new Set(n.pinnedSessionIds),c=i??new Map(Ih(e,n,r,a?.hiddenSessionIds).map(e=>[e.id,e])),l=t.flatMap(e=>{let t=c.get(e);return t===void 0?[]:[t]});return a?.floatPinned===!1?l:Eh(l,s,o)}function Vh(e,t,n,r,i,a,o,s){let c=n.trim().toLowerCase();if(c===``)return{items:[],hasMore:!1};let l=new Set(r),u=/* @__PURE__ */ new Map;for(let e of t)for(let t of e.sessionIds)u.has(t)||u.set(t,e.title);let d=e=>u.get(e.id)??bh(e.cwd),f=/* @__PURE__ */ new Map;for(let e of o.items)f.has(e.sessionId)||f.set(e.sessionId,e);let p=[];for(let t of e.ids){let n=e.byId[t];n!==void 0&&!n.blank&&Th(n,l,i)&&(Dh(n).toLowerCase().includes(c)||d(n).toLowerCase().includes(c))&&p.push(n)}let m=new Map(p.map(e=>[e.id,e])),h=xh(p.map(e=>e.id),e.byId).map(e=>m.get(e)),g=[],_=/* @__PURE__ */ new Set,v=e=>{_.has(e.id)||(_.add(e.id),g.push(e))};for(let e of h)v(e);for(let t of o.items){let n=e.byId[t.sessionId];n!==void 0&&!n.blank&&Th(n,l,i)&&v(n)}return{items:g.slice(0,s).map(t=>{let n=f.get(t.id),r=a.get(t.id),i=jh(r?.pendingInteraction?.kind),o=Fh(t,e);return{id:t.id,title:Dh(t),workspace:d(t),...o===null?{}:{parentTitle:e.byId[nh(o)]?.title??``},remote:t.projectionValues?.remoteHost??void 0,running:r?.running??t.running,runningSubagentCount:Mh(e,t.id,a),...i===void 0?{}:{pendingInteraction:i},completed:r?.completionUnread===!0,archived:l.has(t.id),...n===void 0?{}:{snippet:n.snippet}}}),hasMore:o.hasMore||g.length>s}}function Hh(e){return(/^[A-Za-z]:[/\\]/.test(e)||e.startsWith(`\\\\`)?e.replaceAll(`\\`,`/`):e).replace(/\/+$/,``)}function Uh(e,t){let n=Hh(e),r,i=-1;for(let e of t){let t=Hh(e);t.length>i&&n!==t&&n.startsWith(`${t}/`)&&(r=e,i=t.length)}return r}let Wh=`__flat_session_order__`,Gh=`pinned`,Kh=`groups`,qh=`workspaces`;function Jh(e,t){return e?.[t]??!0}function Yh(e,t,n){let r=new Map(Object.entries(n.summaries)),i=/* @__PURE__ */ new Map;for(let[e,t]of Object.entries(n.members))if(e!==`__flat_session_order__`)for(let n of t)i.set(n,e);return Object.fromEntries(Object.entries(e).map(([e,n])=>{let a=[...n],o=n[0]===void 0?void 0:r.get(n[0]),s=o?.blank&&(o.retainedBy.mainView??0)>0?1:0;for(let n of t[e]??[]){let t=a.indexOf(n);t===-1?!r.has(n)&&(e===`__flat_session_order__`||!i.has(n)||i.get(n)===e)&&a.splice(s++,0,n):s=t+1}return[e,a]}))}function Xh(){return(0,i.defineStore)({init:()=>({groupBy:`workspace`,orderBy:`updated`,groupExpansion:{},threadExpansion:{},sectionExpansion:{},sessionOrderByAccount:{},archivedFilter:`default`}),persist:`dsh.workspace.view.v5`,actions:{setGroupBy:(e,t)=>{e.groupBy=t},setOrderBy:(e,t,n,r)=>{t!==e.orderBy&&(e.sessionOrderByAccount=t===`manual`?Yh(n,e.sessionOrderByAccount,r):{},e.orderBy=t)},setGroupExpanded:(e,t,n)=>{e.groupExpansion[t]=n},setThreadsExpanded:(e,t,n)=>{e.threadExpansion??={};for(let r of t)e.threadExpansion[r]=n},setSectionExpanded:(e,t,n)=>{e.sectionExpansion={...e.sectionExpansion,[t]:n}},retainAccountKeys:(e,t)=>{let n=new Set(t);e.groupExpansion=Object.fromEntries(Object.entries(e.groupExpansion).filter(([e])=>n.has(e))),e.sessionOrderByAccount=Object.fromEntries(Object.entries(e.sessionOrderByAccount).filter(([e])=>n.has(e))),delete e.sessionUpdatedAtByAccount},syncSessionOrders:(e,t,n)=>{e.orderBy===`manual`&&Object.assign(e.sessionOrderByAccount,Yh(t,e.sessionOrderByAccount,n))},setSessionOrder:(e,t,n,r,i)=>{let a=Yh({...r,[t]:n},e.sessionOrderByAccount,i);e.orderBy===`updated`?e.sessionOrderByAccount=a:Object.assign(e.sessionOrderByAccount,a),e.orderBy=`manual`},pinSessionOrder:(e,t,n,r)=>{let i=new Set(n),a=Yh(Object.fromEntries(Object.entries(r.members).map(([t,n])=>[t,Sh(n,e.sessionOrderByAccount[t],r.summaries,r.rowState)])),e.sessionOrderByAccount,r);for(let e of i)a[e]!==void 0&&(a[e]=[t,...a[e].filter(e=>e!==t)]);Object.assign(e.sessionOrderByAccount,a)},setArchivedFilter:(e,t)=>{e.archivedFilter=t}}})}function Zh(e,t,n){let r=n??Ih(e,t,/* @__PURE__ */ new Map),i=new Set(zh(e,t.archivedSessionIds,t.archivedFilter)),a=/* @__PURE__ */ new Set([...r.map(e=>e.id),...Rh(e,t.archivedSessionIds).filter(e=>!i.has(e))]),o=/* @__PURE__ */ new Map,s={...e.byId};for(let e of r){for(let t of e.tree?.descendantIds??[])o.set(nh(t),e.id);let t=s[e.id];t!==void 0&&(s[e.id]={...t,updatedAt:e.tree?.updatedAt??e.updatedAt})}return{rootIds:a,rootOf:o,summaries:s}}function Qh(e,t){let n=new Set(e),r=[],i=/* @__PURE__ */ new Set;for(let a of e){if(t.summaries[a]===void 0||t.rootIds.has(a)){r.push(a);continue}let e=t.rootOf.get(a);e===void 0||n.has(e)||i.has(e)||(i.add(e),r.push(e))}return{memberIds:r,linkedRootIds:i}}function $h(e,t,n,r){let i=r??Zh(t,{...n,archivedFilter:n.archivedFilter??`default`}),a=e=>e.filter(e=>t.byId[e]===void 0||i.rootIds.has(e)),o=new Set(e.flatMap(e=>e.sessionIds));return{members:Object.fromEntries([...e.map(e=>[e.workspaceId,Qh(e.sessionIds,i).memberIds]),[``,a([.../* @__PURE__ */ new Set([...t.ids,...n.archivedSessionIds])]).filter(e=>!o.has(e))],[Wh,a(Rh(t,n.archivedSessionIds))]]),summaries:i.summaries,rowState:n}}function eg(e,t){return[vh(e,t),Wh]}var tg=class{sessions;workspaces;held=/* @__PURE__ */ new Map;recent=/* @__PURE__ */ new Map;running=/* @__PURE__ */ new Set;failed=/* @__PURE__ */ new Set;maxStoppedSessions;maxStoppedBytes;maxBackgroundRunningSessions;maxTotalBytes;assemblyOverheadFactor;lastVisited;active=!1;reconciling=!1;dirty=!1;constructor(e,t,n={}){this.sessions=e,this.workspaces=t,this.maxStoppedSessions=Math.max(0,n.maxStoppedSessions??4),this.maxStoppedBytes=Math.max(0,n.maxStoppedBytes??33554432),this.maxBackgroundRunningSessions=Math.max(0,n.maxBackgroundRunningSessions??2),this.maxTotalBytes=n.maxTotalBytes===void 0?Math.max(this.maxStoppedBytes,50331648):Math.max(0,n.maxTotalBytes),this.assemblyOverheadFactor=Math.max(1,n.assemblyOverheadFactor??3)}start(){this.active=!0;let e=this.sessions.list.subscribe(()=>this.reconcile()),t=this.workspaces.list.subscribe(()=>this.reconcile());return this.reconcile(),()=>{this.active=!1,e(),t();let n=[...this.held.values()];this.held.clear(),this.recent.clear(),this.running.clear(),this.failed.clear(),this.lastVisited=void 0;for(let{reference:e}of n)e.release()}}visit(e,t){this.active&&(this.lastVisited=e.sessionId,this.failed.delete(e.sessionId),this.remember(e.sessionId,typeof t==`string`?this.sessions.subagentAddress(e.sessionId)??t:t),this.reconcile())}remember(e,t){this.recent.delete(e),this.recent.set(e,t)}isProtectedView(e,t){let n=!1;for(let r of[this.sessions.retainInfo?.(e)?.getSnapshot().retainedBy,t.byId[e]?.retainedBy])if(r!==void 0){for(let[e,t]of Object.entries(r))if(!((t??0)<=0)&&(n=!0,e!==`backgroundWarm`))return!0}return!n&&e===this.lastVisited}reconcile(){if(this.active&&(this.dirty=!0,!this.reconciling)){this.reconciling=!0;try{for(;this.dirty&&this.active;)this.dirty=!1,this.update()}finally{this.reconciling=!1}}}update(){let e=this.sessions.list.getSnapshot(),t=new Set(e.ids),n=new Set(this.workspaces.list.getSnapshot().archivedSessionIds);for(let[r,i]of this.recent)(n.has(r)||this.sessions.binding(r)?.session.getSnapshot().removed||e.phase===`ready`&&!t.has(r)&&typeof i==`string`)&&(this.recent.delete(r),this.running.delete(r),this.lastVisited===r&&(this.lastVisited=void 0));let r=/* @__PURE__ */ new Set;for(let t of this.recent.keys()){let n=e.byId[t];(n?.running&&n.origin!==`subagent`||e.phase===`pending`&&this.running.has(t))&&r.add(t)}this.running=r;let i=/* @__PURE__ */ new Set,a=/* @__PURE__ */ new Map,o=0;for(let t of this.recent.keys()){this.isProtectedView(t,e)&&i.add(t);let n=Math.max(0,this.sessions.estimatedBytes?.(t)??0)*this.assemblyOverheadFactor;a.set(t,n),o+=n}let s=[...this.recent.keys()].filter(e=>!r.has(e)),c=s.length,l=0;for(let e of s)l+=a.get(e)??0;for(let e of s){if(c<=this.maxStoppedSessions&&l<=this.maxStoppedBytes)break;if(i.has(e))continue;let t=a.get(e)??0;this.recent.delete(e),--c,l-=t,o-=t}let u=[...this.recent.keys()].filter(e=>r.has(e)&&!i.has(e)),d=u.length;for(let e of u){if(d<=this.maxBackgroundRunningSessions)break;let t=a.get(e)??0;this.recent.delete(e),r.delete(e),--d,o-=t}if(o>this.maxTotalBytes){let e=[...this.recent.keys()].filter(e=>!r.has(e)&&!i.has(e));for(let t of e){if(o<=this.maxTotalBytes)break;this.recent.delete(t),o-=a.get(t)??0}}if(o>this.maxTotalBytes){let e=[...this.recent.keys()].filter(e=>r.has(e)&&!i.has(e));for(let t of e){if(o<=this.maxTotalBytes)break;this.recent.delete(t),r.delete(t),o-=a.get(t)??0}}let f=new Map(this.recent);for(let e of this.failed)f.has(e)||this.failed.delete(e);for(let[e,t]of this.held){let n=this.sessions.binding(e)!==t.binding;(!f.has(e)||n)&&(this.held.delete(e),n&&(this.recent.delete(e),this.failed.add(e)),t.reference.release())}for(let[e,t]of f){if(this.held.has(e)||this.failed.has(e))continue;let n;try{n=this.sessions.retain(t,{source:`backgroundWarm`});let r={reference:n,binding:n.binding};this.held.set(e,r),n.ready.then(()=>{this.active&&this.held.get(e)===r&&this.reconcile()},()=>this.fail(e,r))}catch{this.failed.add(e),n?.release()}}}fail(e,t){this.active&&this.held.get(e)===t&&(this.failed.add(e),this.held.delete(e),t.reference.release())}};let ng=`codexhost.web.session-tabs.v2:local`,rg=`codexhost.web.session-tabs.v1:local`,ig=`codexhost.web.recent-visits.v1:local`,ag=1048576;function og(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function sg(e){return typeof e==`string`&&e.length>0&&e.length<=1024&&e.trim()===e&&!/[\u0000-\u001f\u007f]/u.test(e)?nh(e):void 0}function cg(e,t){if(typeof e==`string`)return e===t?t:void 0;if(!og(e)||Object.keys(e).length!==3)return;let n=sg(e.parentSessionId),r=sg(e.childSessionId),i=e.mode;if(!(n===void 0||r!==t||n===r||i!==`one-shot`&&i!==`continuable`&&i!==`unknown`))return{parentSessionId:n,childSessionId:r,mode:i}}function lg(e,t){if(e===null||e.length>ag)return[];try{let n=JSON.parse(e);if(!og(n)||Object.keys(n).length!==2||n.version!==t||!Array.isArray(n.entries))return[];let r=[],i=/* @__PURE__ */ new Set,a=Date.now();for(let e of n.entries){if(!og(e))continue;let n=Object.keys(e);if(t===2&&n.length!==3||n.length!==2&&(n.length!==3||!Object.hasOwn(e,`lastVisitedAt`)))continue;let o=sg(e.sessionId);if(o===void 0||i.has(o))continue;let s=Object.hasOwn(e,`lastVisitedAt`)?e.lastVisitedAt:a;if(typeof s!=`number`||!Number.isSafeInteger(s)||s<0||s>a)continue;let c=cg(e.target,o);c!==void 0&&(i.add(o),r.push({sessionId:o,target:c,lastVisitedAt:s}))}return r}catch{return[]}}var ug=class{onFailure;enabled=typeof window<`u`&&/^https?:$/u.test(window.location.protocol);reported=!1;constructor(e){this.onFailure=e}read(){if(!this.enabled)return[];try{return this.latest()}catch{return this.failed(),[]}}update(e,t){if(this.enabled)try{let n=this.latest().filter(e=>t?.(e)!==!0),r=new Map(n.map((e,t)=>[e.sessionId,t]));for(let i of e){if(t?.(i)===!0)continue;let e=r.get(i.sessionId);e===void 0?(r.set(i.sessionId,n.length),n.push(i)):n[e]=i}let i=JSON.stringify({version:2,entries:n.map(e=>({sessionId:e.sessionId,lastVisitedAt:e.lastVisitedAt,target:typeof e.target==`string`?e.target:{parentSessionId:e.target.parentSessionId,childSessionId:e.target.childSessionId,mode:e.target.mode}}))});if(i.length>ag){this.failed();return}localStorage.getItem(ng)!==i&&localStorage.setItem(ng,i),localStorage.removeItem(rg),localStorage.removeItem(ig)}catch{this.failed()}}latest(){let e=localStorage.getItem(ng);return e===null?lg(localStorage.getItem(rg)??localStorage.getItem(ig),1):lg(e,2)}failed(){if(!this.reported){this.reported=!0;try{this.onFailure()}catch{}}}},dg=class{sessions;workspaces;subscribeRemoved;entries=(0,i.createSnapshotStore)([]);records=[];current;awaitingFormalSession=!1;active=!1;headRevision=0;restoring=!1;cache;constructor(e,t,n,r=()=>{}){this.sessions=e,this.workspaces=t,this.subscribeRemoved=n,this.cache=new ug(r)}start(e){this.active=!0,this.headRevision=this.sessions.list.getSnapshot().headRefreshRevision??0,this.records=this.cache.read(),this.cache.update([]);let t=this.sessions.list.subscribe(()=>{let t=this.sessions.list.getSnapshot().headRefreshRevision??0;t!==this.headRevision&&(this.headRevision=t,this.restoreSummaries(this.current?.sessionId??e)),this.reconcile()}),n=this.workspaces.list.subscribe(()=>this.reconcile()),r=this.subscribeRemoved?.(e=>{this.sessions.subagentAddress(e)!==void 0||this.sessions.list.getSnapshot().byId[e]?.origin===`subagent`||this.records.some(t=>t.sessionId===e&&typeof t.target!=`string`)||(this.records=this.records.filter(t=>!this.includesIdentity(t,e)),this.cache.update([],t=>this.includesIdentity(t,e)),this.publish())});return this.reconcile(),this.restoreSummaries(e),()=>{this.active=!1,t(),n(),r?.(),this.current=void 0,this.awaitingFormalSession=!1,this.records=[],this.entries.set([])}}visit(e,t){let n=Date.now(),r=this.depart(n);r!==void 0&&this.remember(r),this.current={sessionId:e,target:typeof t==`string`?this.sessions.subagentAddress(e)??t:t,lastVisitedAt:n},this.awaitingFormalSession=!0,this.reconcile(r===void 0?[]:[r])}clearCurrent(){let e=this.depart(Date.now());e!==void 0&&this.remember(e),this.current=void 0,this.awaitingFormalSession=!1,this.reconcile(e===void 0?[]:[e])}depart(e){let t=this.current;return t!==void 0&&this.records.some(e=>e.sessionId===t.sessionId)&&this.formal(t)?{...t,lastVisitedAt:e}:void 0}close(e){this.records=this.records.filter(t=>t.sessionId!==e),this.cache.update([],t=>t.sessionId===e),this.current?.sessionId===e&&(this.awaitingFormalSession=!1),this.publish()}closeAll(){let e=new Set(this.records.map(e=>e.sessionId));this.records=[],this.awaitingFormalSession=!1,this.cache.update([],t=>e.has(t.sessionId)),this.publish()}expireInactive(e,t,n=Date.now()){let r=this.sessions.list.getSnapshot();if(!this.active||!Number.isFinite(e)||e<=0||r.phase!==`ready`||r.loading===!0||r.listError!=null&&r.listErrorPage!==`more`||this.workspaces.list.getSnapshot().phase!==`ready`)return{changed:!1,nextDelayMs:void 0};let i=new Set(r.ids),a=new Set(this.entries.getSnapshot().map(e=>e.sessionId)),o=e=>{let n=r.byId[e.sessionId];if(e.sessionId===this.current?.sessionId||!a.has(e.sessionId)||n===void 0||n.blank||(n.retainedBy.mainView??0)>0||n.running||!Number.isFinite(n.updatedAt))return;let o=t.get(e.sessionId);if(o?.pendingInteraction!==void 0)return;let s=n.projectionValues?.subagentTiming;if(s?.active!==void 0||typeof e.target!=`string`&&!(o?.running!==void 0||i.has(e.sessionId)||s?.lastTurnCompleted!==void 0))return;let c=Nh(n,r,t);if(!(c.running||c.runningSubagentCount>0))return Math.max(e.lastVisitedAt,n.updatedAt)},s=/* @__PURE__ */ new Set,c;for(let t of this.records){let r=o(t);if(r===void 0)continue;let i=e-(n-r);i<=0?s.add(t.sessionId):(c===void 0||i<c)&&(c=i)}return s.size===0?{changed:!1,nextDelayMs:c}:(this.records=this.records.filter(e=>!s.has(e.sessionId)),this.cache.update([],t=>{if(!s.has(t.sessionId))return!1;let r=o(t);return r!==void 0&&n-r>=e}),this.publish(),{changed:!0,nextDelayMs:c})}remember(e){let t=this.records.findIndex(t=>t.sessionId===e.sessionId);this.records=t===-1?[...this.records,e]:this.records.map((n,r)=>r===t?e:n)}formal(e){let t=this.sessions.list.getSnapshot();return t.byId[e.sessionId]?.blank===!1&&!this.invalid(e,t)}reconcile(e=[]){if(!this.active)return;let t=this.sessions.list.getSnapshot(),n=new Set(this.records.filter(e=>this.invalid(e,t)).map(e=>e.sessionId));this.records=this.records.filter(e=>!n.has(e.sessionId));let r=[...e],i=this.current;this.awaitingFormalSession&&i!==void 0&&this.formal(i)&&(this.awaitingFormalSession=!1,this.remember(i),r.push(i)),this.publish(),(r.length>0||n.size>0)&&this.cache.update(r,e=>n.has(e.sessionId))}publish(){let e=this.sessions.list.getSnapshot(),t=this.workspaces.list.getSnapshot().phase===`ready`,n=this.records.flatMap(n=>{if(!t||e.byId[n.sessionId]?.blank!==!1||this.invalid(n,e))return[];if(typeof n.target==`string`)return[n];let r=this.sessions.subagentAddress(n.sessionId);if(r===void 0||r.parentSessionId!==n.target.parentSessionId||r.childSessionId!==n.sessionId)return[];if(r.mode===n.target.mode)return[n];let i={...n,target:r};return this.records=this.records.map(e=>e===n?i:e),[i]}),r=this.entries.getSnapshot();(n.length!==r.length||n.some((e,t)=>e!==r[t]))&&this.entries.set(n)}restoreSummaries(e=this.current?.sessionId){if(this.restoring)return;let t=this.sessions.list.getSnapshot(),n=new Set(t.ids),r=this.records.filter(r=>r.sessionId!==e&&(t.byId[r.sessionId]===void 0||typeof r.target!=`string`&&!n.has(r.sessionId)));if(r.length===0)return;this.restoring=!0;let i=0;Promise.all(Array.from({length:Math.min(4,r.length)},async()=>{for(;this.active;){let e=r[i++];if(e===void 0)return;let t=e.sessionId,n=this.sessions.list.getSnapshot();if(!(!this.records.some(e=>e.sessionId===t)||(typeof e.target==`string`?n.byId[t]!==void 0:n.ids.includes(t)))){try{await this.sessions.loadSummary(t)}catch{}this.active&&this.reconcile()}}})).finally(()=>{this.restoring=!1})}includesIdentity(e,t){if(e.sessionId===t)return!0;if(typeof e.target==`string`)return!1;let n=/* @__PURE__ */ new Set,r=e.target.parentSessionId;for(;r!==void 0&&!n.has(r);){if(r===t)return!0;n.add(r),r=this.sessions.subagentAddress(r)?.parentSessionId}return!1}invalid(e,t){let n=this.workspaces.list.getSnapshot().archivedSessionIds,r=e=>n.includes(e)||this.sessions.binding(e)?.session.getSnapshot().removed===!0;if(r(e.sessionId))return!0;if(typeof e.target==`string`)return!1;let i=/* @__PURE__ */ new Set([e.sessionId]),a=e.target;for(;!i.has(a.parentSessionId);){if(r(a.parentSessionId)||fg(t,a.parentSessionId,a.childSessionId))return!0;i.add(a.parentSessionId);let e=this.sessions.subagentAddress(a.parentSessionId);if(e===void 0)break;a=e}return!1}};function fg(e,t,n){let r=e.projectionsBySession[t];return e.phase===`ready`&&r?.state!==`loading`&&r?.state!==`error`&&r?.values.subagentCatalog!==void 0&&!r.values.subagentCatalog.some(e=>e.id===n)}function pg(e){return typeof e==`string`&&e.length>0?e:void 0}function mg(e){if(typeof e!=`object`||!e||!(`next`in e))return;let t=e.next;if(typeof t!=`object`||!t)return;let n=t;if(typeof n.provider==`string`&&typeof n.model==`string`)return{provider:n.provider,model:n.model,...typeof n.reasoningEffort==`string`?{reasoningEffort:n.reasoningEffort}:{}}}var hg=class extends Error{rpcError;name=`DirectoryBrowseError`;constructor(e){super(`directory browse failed: ${e.code}: ${e.message}`),this.rpcError=e}},gg=class extends a.Service{directoryPicker;workspaces;sessions;view;notify;sessionRemote;connecting=/* @__PURE__ */ new Map;lifetime=new AbortController;selection=(0,i.createSnapshotStore)({},{persist:{name:`dsh.sessions.current`}});mainReference;mainIsRemote=!1;disposeMainSessionWatch;opening=(0,i.createSnapshotStore)({state:`idle`});retryOpen;openingLoad;creating=(0,i.createSnapshotStore)({state:`idle`});retryCreate;creatingLoad;creationToken=0;openedProjectlessBlank;keepalive;recentVisits;groupRooms=(0,i.createSnapshotStore)([]);disposeGroupRoomsSource;constructor(e,t,n,r,i,a,o){super(e,`uiWorkspace`),this.directoryPicker=t,this.workspaces=n,this.sessions=r,this.view=i,this.notify=a,this.sessionRemote=o,this.keepalive=new tg(r,n);let s=e.get(`remote`);this.recentVisits=new dg(r,n,s===void 0?void 0:e=>s.$on(`api-session/removed`,e),()=>a({kind:`recentVisitsStorageFailed`})),e.effect(()=>{let e=this.selection.getSnapshot(),t=this.recentVisits.start(e.subagentAddress?.childSessionId??e.sessionId),n=this.keepalive.start(),r=this.watchNavigation();return()=>{r(),this.lifetime.abort(),n(),t(),this.disposeMainSessionWatch?.(),this.disposeMainSessionWatch=void 0,this.disposeGroupRoomsSource?.(),this.disposeGroupRoomsSource=void 0;let e=this.mainReference;this.mainReference=void 0,this.mainIsRemote=!1,e?.release()}},`ui-workspace: Workspace navigation policy`)}setGroupSidebarSource(e){this.disposeGroupRoomsSource?.();let t=()=>{this.groupRooms.set(e.getSnapshot())};t();let n=e.subscribe(t),r=!1,i=()=>{r||(r=!0,n(),this.disposeGroupRoomsSource===i&&(this.disposeGroupRoomsSource=void 0,this.groupRooms.set([])))};return this.disposeGroupRoomsSource=i,i}async connectWorkspace(e){let t=this.workspaces.list.getSnapshot().items.find(t=>t.workspaceId===e);if(t===void 0)throw Error(`uiWorkspace.connectWorkspace: unknown workspace ${e}`);let n=this.connecting.get(e);if(n!==void 0)return n;let r=this.reuseOrCreateBlank(t).finally(()=>{this.connecting.delete(e)});return this.connecting.set(e,r),r}async reuseOrCreateBlank(e,t){let n=this.workspaces.list.getSnapshot().archivedSessionIds,r=this.sessions.list.getSnapshot();for(let i of r.ids){let a=r.byId[i];if(a===void 0||!a.blank||a.cwd!==e.path||!e.sessionIds.includes(i)||n.includes(i))continue;let o=await this.tryReuseBlank(e.workspaceId,i,{...t===void 0?{}:{roleSlug:t}});if(o!==void 0)return o}return this.sessions.create({workspaceId:e.workspaceId,...t===void 0?{}:{roleSlug:t}})}async reuseOrCreateProjectlessBlank(e){let t=this.workspaces.list.getSnapshot(),n=this.sessions.list.getSnapshot(),r=r=>{let i=n.byId[r];if(i===void 0||!i.blank||i.cwd!==void 0||i.parentId!==void 0||i.origin!==void 0||this.isRemoteSession(r)||t.archivedSessionIds.includes(r)||t.items.some(e=>e.sessionIds.includes(r)))return!1;let a=pg(i.projectionValues?.draftRoleSlug);return e===void 0?a===void 0:a===e},i=this.openedProjectlessBlank,a=i!==void 0&&r(i)?i:n.ids.find(r);return(a===void 0?void 0:await this.tryReuseBlank(void 0,a,{...e===void 0?{}:{roleSlug:e}}))??this.sessions.create(e===void 0?void 0:{roleSlug:e})}openProjectlessBlank(e,t,n,r,i=!1){this.replaceMain(e,t,n,r,i),this.mainReference?.sessionId===e&&(this.openedProjectlessBlank=e)}async tryReuseBlank(e,t,{restore:n=!1,roleSlug:r}={}){let i=e===void 0?{}:{workspaceId:e};try{return await this.sessions.create({...i,sessionId:t,...!n&&e!==void 0&&r===void 0?{matchProjectDefault:!0}:{},...r===void 0?{}:{roleSlug:r}})}catch(e){let t=_g(e)?.rpcError.code;if(t!==`session/writer-held`&&(n||t!==`session/busy`))throw e;return}}carriedDraftSelection(e){let t=this.mainReference?.sessionId;if(t===void 0||this.isRemoteSession(t))return;let n=this.sessions.list.getSnapshot().byId[t];if(n?.blank!==!0)return;if(e!==null){let t=this.workspaces.list.getSnapshot().items.find(t=>t.workspaceId===e);if(t===void 0||t.remote!==void 0)return}let r=this.sessions.binding(t)?.session.projections,i=pg(r?.faceOf(`draftRoleSlug`).getSnapshot())??pg(n.projectionValues?.draftRoleSlug),a=r?.faceOf(`draftSelectionExplicit`).getSnapshot()===!0,o=mg(r?.faceOf(`modelSelection`).getSnapshot())??mg(n.projectionValues?.modelSelection);if(i!==void 0)return{currentId:t,roleSlug:i,...o===void 0?{}:{selection:o}};if(a&&o!==void 0)return{currentId:t,selection:o}}draftMatchesWorkspace(e,t){let n=this.workspaces.list.getSnapshot().items;return t===null?this.sessions.list.getSnapshot().byId[e]?.cwd===void 0&&!n.some(t=>t.sessionIds.includes(e)):n.find(e=>e.workspaceId===t)?.sessionIds.includes(e)===!0}async resolveWorkspaceDraftWithSelection(e,t){let n=this.sessionRemote?.selectModel??this.ctx.get(`remote.session`)?.selectModel;if(t.roleSlug!==void 0){let r;if(e===null)r=await this.reuseOrCreateProjectlessBlank(t.roleSlug);else{let n=this.workspaces.list.getSnapshot().items.find(t=>t.workspaceId===e);if(n===void 0)throw Error(`uiWorkspace.openWorkspace: unknown workspace ${e}`);r=await this.reuseOrCreateBlank(n,t.roleSlug)}return t.selection!==void 0&&n!==void 0&&await n({sessionId:r,...t.selection,roleSlug:t.roleSlug}).catch(()=>void 0),r}let r=e===null?await this.sessions.create():await this.sessions.create({workspaceId:e});return t.selection!==void 0&&n!==void 0&&await n({sessionId:r,...t.selection,roleSlug:null}).catch(()=>void 0),r}openSession(e){if(typeof e==`string`&&this.workspaces.list.getSnapshot().archivedSessionIds.includes(e)){this.notify({kind:`archivedNotOpenable`});return}let t=AbortSignal.any([this.ctx.layout.beginNavigation(),this.lifetime.signal]);this.opening.set({state:`idle`}),this.retryOpen=void 0,typeof e!=`string`||this.sessions.list.getSnapshot().byId[e]!==void 0||this.sessions.syncSummary?.(e)===!0?this.replaceMain(e,t,`reveal`):this.resolveSession(e,t,()=>{this.workspaces.list.getSnapshot().archivedSessionIds.includes(e)?this.notify({kind:`archivedNotOpenable`}):this.replaceMain(e,t,`reveal`)},()=>this.openSession(e))}closeSessionTab(e){this.recentVisits.close(e)}closeAllSessionTabs(){this.recentVisits.closeAll()}retryOpening(){this.retryOpen?.()}retryCreating(){this.retryCreate?.()}async resolveSession(e,t,n,r,i){if(t.aborted)return;this.openingLoad?.stop(),this.retryOpen=void 0;let a={stop:()=>t.removeEventListener(`abort`,o)},o=()=>{a.stop(),this.openingLoad===a&&(this.openingLoad=void 0,this.opening.set({state:`idle`}),this.retryOpen=void 0)};t.addEventListener(`abort`,o,{once:!0}),this.openingLoad=a,this.opening.set({state:`loading`,sessionId:e});try{if(t.aborted||this.openingLoad!==a||(await this.sessions.loadSummary(e),t.aborted||this.openingLoad!==a))return;if(this.sessions.list.getSnapshot().byId[e]===void 0){if(i!==void 0){o(),i();return}throw Error(`Session not found: ${e}`)}n(),o()}catch(n){if(t.aborted||this.openingLoad!==a)return;let s=vg(n)===`remote/offline`;if(i!==void 0&&(s||yg(n))){o(),i(s?{message:Cg(n)}:void 0);return}this.retryOpen=r,this.opening.set({state:`error`,sessionId:e,message:Cg(n)})}}async openWorkspace(e,t){if(this.mainReference===void 0){let n=this.creating.getSnapshot(),r=n.state===`idle`?++this.creationToken:n.token,i=n.state===`idle`?void 0:n.initialPrompt;await this.runCreation({workspaceId:e,token:r,...i===void 0?{}:{initialPrompt:i},...t===void 0?{}:{beforeOpen:t}});return}let n=this.carriedDraftSelection(e);if(n!==void 0&&this.draftMatchesWorkspace(n.currentId,e))return;let r=AbortSignal.any([this.ctx.layout.beginNavigation(),this.lifetime.signal]),i;try{if(e===null&&!this.workspaces.list.getSnapshot().canStartProjectless)throw new bg;i=n===void 0?e===null?await this.reuseOrCreateProjectlessBlank():await this.connectWorkspace(e):await this.resolveWorkspaceDraftWithSelection(e,n)}catch(e){throw r.aborted||this.notify({kind:`createFailed`,message:Cg(e)}),e}r.aborted||(e===null?this.openProjectlessBlank(i,r,`reveal`,t):this.replaceMain(i,r,`reveal`,t))}async forkSession(e,t){return this.sessions.fork({sessionId:e,increaseTitle:!0,...t===void 0?{}:{onCreated:t}})}startSession(e,t){let n=t===void 0?void 0:{...t},r=n!==void 0&&(n.prompt!==void 0||n.clearPreviousDraft===!0),i=this.workspaces.list.getSnapshot(),a=this.sessions.list.getSnapshot(),o=this.mainReference?.sessionId,s=o===void 0?void 0:i.items.find(e=>e.sessionIds.includes(o))?.workspaceId,c=i.phase===`ready`&&a.phase===`ready`?wg(i.items,a.byId):void 0,l=e??(i.canStartProjectless?null:s??c);if(l===void 0){if(this.ctx.layout.beginNavigation(),r){this.notify({kind:`createFailed`,message:this.ctx.locale.bind(`workspace`)(`draft.workspaceRequired`)});return}this.clearMain();return}this.ctx.layout.selectPanel(null),this.releaseMainSelection();let u=++this.creationToken;this.runCreation({workspaceId:l,token:u,...n?.prompt===void 0?{}:{initialPrompt:n.prompt},...r?{draftOptions:n}:{}}).catch(e=>{console.warn(`new session failed:`,e)})}async runCreation(e){this.creatingLoad?.stop(),this.creatingLoad=void 0,this.retryCreate=void 0;let t=AbortSignal.any([this.ctx.layout.beginNavigation(),this.lifetime.signal]);this.openingLoad?.stop(),this.openingLoad=void 0,this.opening.set({state:`idle`}),this.retryOpen=void 0;let n={stop:()=>t.removeEventListener(`abort`,r)},r=()=>{n.stop(),this.creatingLoad===n&&(this.creatingLoad=void 0,this.retryCreate=void 0,this.creating.set({state:`idle`}))};t.addEventListener(`abort`,r,{once:!0}),this.creatingLoad=n,this.creating.set({state:`creating`,workspaceId:e.workspaceId,token:e.token,...e.initialPrompt===void 0?{}:{initialPrompt:e.initialPrompt}});try{if(e.workspaceId===null&&!this.workspaces.list.getSnapshot().canStartProjectless)throw new bg;let i=e.workspaceId===null?await this.reuseOrCreateProjectlessBlank():await this.connectWorkspace(e.workspaceId);if(t.aborted||this.creatingLoad!==n)return;let a=t=>{e.beforeOpen?.(t),this.handoffPendingDraft(t,e.draftOptions)};e.workspaceId===null?this.openProjectlessBlank(i,t,`preserve`,a):this.replaceMain(i,t,`preserve`,a),r()}catch(r){if(t.aborted||this.creatingLoad!==n)return;this.retryCreate=()=>{this.runCreation(e).catch(e=>{console.warn(`new session retry failed:`,e)})};let i=xg(r),a=i===`unknown`?Sg(r):void 0;throw this.creating.set({state:`error`,workspaceId:e.workspaceId,reason:i,...a===void 0?{}:{message:a},token:e.token,...e.initialPrompt===void 0?{}:{initialPrompt:e.initialPrompt}}),r}}handoffPendingDraft(e,t){let n=this.sessions.binding(e),r=this.ctx.get(`conversation`);t===void 0?n!==void 0&&r!==void 0&&r.input.adoptPendingDraft(n):((n===void 0||r===void 0)&&this.draftPreparationFailed(),r.input.adoptPendingDraft(n,t)===`blocked`&&this.draftPreparationFailed())}draftPreparationFailed(){let e=this.ctx.locale.bind(`workspace`)(`draft.initializationFailed`);throw this.notify({kind:`createFailed`,message:e}),Error(e)}async archiveSession(e,t={}){await this.workspaces.archiveSession(e,t),this.mainReference?.sessionId===e&&this.clearMain()}async unarchiveSession(e){await this.workspaces.unarchiveSession(e)}async deleteSession(e){if(!this.workspaces.deleteSession)throw Error(`Session deletion is unavailable`);await this.workspaces.deleteSession(e),this.mainReference?.sessionId===e&&this.clearMain()}async pinSession(e){await this.workspaces.pinSession(e);let{items:t,pinnedSessionIds:n,archivedSessionIds:r}=this.workspaces.list.getSnapshot();this.view.pinSessionOrder(e,eg(t,e),$h(t,this.sessions.list.getSnapshot(),{pinnedSessionIds:n,archivedSessionIds:r}))}async unpinSession(e){await this.workspaces.unpinSession(e)}async pickDirectory(){let e=await this.directoryPicker.pick();if(!e.ok)throw Error(`directory picker failed: ${e.error.message}`);return e.value}async listDirectory(e,t){let n=await this.directoryPicker.list(e,t);if(!n.ok)throw new hg(n.error);return n.value}async createDirectory(e,t){let n=await this.directoryPicker.createDirectory(e,t);if(!n.ok)throw new hg(n.error);return n.value}watchNavigation(){let e=`waiting`,t,n=AbortSignal.any([this.ctx.layout.beginNavigation(),this.lifetime.signal]);n.addEventListener(`abort`,()=>{e=`done`},{once:!0});let r=e=>{this.retryOpen=e.retry,this.opening.set({state:`error`,sessionId:e.sessionId,message:e.message})},i=()=>{if(this.lifetime.signal.aborted)return;let i=this.mainReference?.sessionId;if(i!==void 0&&!this.mainIsRemote&&this.isRemoteSession(i)&&(this.mainIsRemote=!0),this.clearArchivedCurrent()||this.clearRemovedRemoteCurrent()||e!==`waiting`)return;let a=this.workspaces.list.getSnapshot(),o=this.sessions.list.getSnapshot();if(this.mainReference!==void 0){e=`done`;return}if(a.phase!==`ready`||o.phase!==`ready`)return;e=`connecting`;let s=t;this.restoreSelection(a,o,n,s!==void 0).then(t=>{n.aborted||(!t&&s!==void 0&&this.mainReference===void 0&&r(s),e=`done`)},t=>{n.aborted||(s!==void 0&&this.mainReference===void 0?(r(s),e=`done`,console.warn(`initial Session restoration failed:`,t)):(e=`waiting`,console.warn(`initial Session restoration failed:`,t)))})},a=this.workspaces.list.subscribe(i),o=this.sessions.list.subscribe(i),s=this.ctx.get(`remote`)?.$on(`api-session/removed`,e=>{this.lifetime.signal.aborted||this.clearRemovedRemoteCurrent(e)}),c=this.selection.getSnapshot();if(c.sessionId!==void 0||c.subagentAddress!==void 0){if(e=`connecting`,c.subagentAddress!==void 0)this.replaceMain(c.subagentAddress,n,`preserve`),e=`done`;else if(c.sessionId!==void 0){let r=c.sessionId,a=()=>{this.resolveSession(r,n,()=>{t=void 0,this.sessions.list.getSnapshot().byId[r]?.blank===!0?(e=`waiting`,i()):(this.replaceMain(r,n,`preserve`),e=`done`)},a,o=>{n.aborted||(o===void 0&&this.selection.getSnapshot().sessionId===r&&this.selection.set({}),t=o===void 0?void 0:{sessionId:r,message:o.message,retry:a},e=`waiting`,i())})};a()}}return i(),()=>{this.lifetime.abort(),s?.(),o(),a()}}async restoreSelection(e,t,n,r){let i=r?{}:this.selection.getSnapshot(),a=r?e.items.filter(e=>e.remote===void 0):e.items;if(i.subagentAddress!==void 0)return this.replaceMain(i.subagentAddress,n,`preserve`),!0;let o=i.sessionId===void 0?void 0:t.byId[i.sessionId],s=o===void 0?void 0:a.find(e=>e.sessionIds.includes(o.id));if(o!==void 0&&(!o.blank||s===void 0))return o.blank?this.openProjectlessBlank(o.id,n,`preserve`):this.replaceMain(o.id,n,`preserve`),!0;let c;if(o!==void 0&&s!==void 0&&o.cwd===s.path&&!e.archivedSessionIds.includes(o.id)&&(c=await this.tryReuseBlank(s.workspaceId,o.id,{restore:!0})),c===void 0&&e.canStartProjectless&&o===void 0)return c=await this.reuseOrCreateProjectlessBlank(),!n.aborted&&(this.openProjectlessBlank(c,n,`preserve`,void 0,r),!0);let l=s?.workspaceId??wg(a,t.byId),u=t.ids.some(t=>!e.archivedSessionIds.includes(t)&&!this.isRemoteSession(t));if(l===void 0&&a.length===0&&(r?!u:t.ids.length===0)){let e=await this.initializeDefaultWorkspace(n);if(n.aborted)return!1;l=e?.workspaceId}return c===void 0&&l!==void 0&&(c=await this.connectWorkspace(l)),c!==void 0&&!n.aborted&&(this.replaceMain(c,n,`preserve`,void 0,r),!0)}async initializeDefaultWorkspace(e){try{return await this.workspaces.initializeDefault(e)}catch{e.aborted||this.notify({kind:`defaultWorkspaceFailed`});return}}clearArchivedCurrent(){let e=this.mainReference?.sessionId;return e===void 0||!this.workspaces.list.getSnapshot().archivedSessionIds.includes(e)?!1:(this.clearMain(),!0)}isDurableSubagent(e){return this.sessions.subagentAddress(e)!==void 0||this.sessions.list.getSnapshot().byId[e]?.origin===`subagent`}isRemoteSession(e){let t=this.sessions.list.getSnapshot(),n=this.workspaces.list.getSnapshot().items,r=/* @__PURE__ */ new Set,i=e;for(;i!==void 0&&!r.has(i);){let e=i;if(r.add(e),e.startsWith(`web-remote:`)||t.byId[e]?.projectionValues?.remoteHost!=null||t.projectionsBySession[e]?.values.remoteHost!=null||n.some(t=>t.remote!==void 0&&t.sessionIds.includes(e)))return!0;i=this.sessions.subagentAddress(e)?.parentSessionId}return!1}clearRemovedRemoteCurrent(e){let t=this.mainReference;if(t===void 0||e!==void 0&&this.isDurableSubagent(e))return!1;let n=/* @__PURE__ */ new Set,r=t.sessionId,i=!1;for(;r!==void 0&&!n.has(r);){let a=r;n.add(a);let o=a===t.sessionId?t.binding:this.sessions.binding(a);if(e!==void 0&&a===e||o?.session.getSnapshot().removed===!0){i=!0;break}r=this.sessions.subagentAddress(a)?.parentSessionId}return!i||!(this.mainIsRemote||this.isRemoteSession(t.sessionId)||e!==void 0&&this.isRemoteSession(e))?!1:(this.clearMain(),!0)}releaseMainSelection(){let e=this.mainReference;this.disposeMainSessionWatch?.(),this.disposeMainSessionWatch=void 0,this.mainReference=void 0,this.mainIsRemote=!1,this.recentVisits.clearCurrent(),this.selection.set({}),e?.release()}clearMain(){this.releaseMainSelection(),this.ctx.layout.selectPanel(null)}replaceMain(e,t,n,r,i=!1){t.throwIfAborted();let a=this.sessions.retain(e,{source:`mainView`});try{if(t.throwIfAborted(),r?.(a.sessionId),t.aborted){a.release();return}if(!i){let t=typeof e==`string`?this.sessions.subagentAddress(a.sessionId):e;this.selection.set({sessionId:a.sessionId,...t===void 0?{}:{subagentAddress:t}})}}catch(e){throw a.release(),e}let o=this.mainReference;this.disposeMainSessionWatch?.(),this.disposeMainSessionWatch=void 0,this.mainReference=a,this.mainIsRemote=this.isRemoteSession(a.sessionId),this.disposeMainSessionWatch=typeof a.binding.session.subscribe==`function`?a.binding.session.subscribe(()=>{this.lifetime.signal.aborted||this.clearRemovedRemoteCurrent()}):void 0,this.keepalive.visit(a,e),this.recentVisits.visit(a.sessionId,e),o?.release(),n===`reveal`&&this.ctx.layout.selectPanel(null)}};function _g(e){return e instanceof Error&&e.name===`SessionCreateError`?e:void 0}function vg(e){if(typeof e==`object`&&e&&`isDSHRemoteError`in e&&e.isDSHRemoteError===!0&&`code`in e)return e.code}function yg(e){let t=vg(e);return t===`session/not-found`||t===`remote/not-found`||t===`remote/identity-invalid`}var bg=class extends Error{name=`WorkspaceRequiredError`;constructor(){super(`This Host requires a Workspace.`)}};function xg(e){return _g(e)?.rpcError.code===`host/no-harness`?`no-harness`:e instanceof bg?`workspace-required`:`unknown`}function Sg(e){let t=_g(e),n=(t===void 0?e instanceof Error?e.message:String(e):t.rpcError.message).trim();return n===``?void 0:n}function Cg(e){let t=_g(e);return t===void 0?e instanceof Error?e.message:String(e):`${t.rpcError.code}: ${t.rpcError.message}`}function wg(e,t){let n,r=-1/0;for(let i of e){let e=-1/0;for(let n of i.sessionIds){let r=t[n];r!==void 0&&(e=Math.max(e,r.updatedAt))}e===-1/0&&(e=Date.parse(i.createdAt)),(n===void 0||e>r)&&(n=i.workspaceId,r=e)}return n}let Tg=`@deepseek-ai/dsh-client-ui-workspace/PhoneHeaderNewSession.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Tg)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Tg,e.textContent=`.--73Qq_button{display:none}[data-phone] .--73Qq_button{corner-shape:round;width:34px;height:34px;color:var(--dsw-alias-label-primary);cursor:pointer;-webkit-app-region:no-drag;-webkit-tap-highlight-color:transparent;background:0 0;border:0;border-radius:9999px;flex:none;justify-content:center;align-items:center;padding:0;transition:transform .14s,background-color .14s;display:inline-flex;position:relative}[data-phone] .--73Qq_button:after{content:"";position:absolute;inset:-5px -1px}[data-phone] .--73Qq_icon{width:17px;height:17px}[data-phone] .--73Qq_button:active{background:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent);transform:scale(.92)}[data-phone] .--73Qq_button:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}@media (prefers-reduced-motion:reduce){[data-phone] .--73Qq_button{transition:none}[data-phone] .--73Qq_button:active{transform:none}}@media (forced-colors:active){[data-phone] .--73Qq_button{color:buttontext}[data-phone] .--73Qq_button:focus-visible{outline-color:highlight}}`,document.head.appendChild(e)}var Eg={button:`--73Qq_button`,icon:`--73Qq_icon`};function Dg({startSession:e,useShortcuts:t,t:n}){let i=t(e=>e.find(e=>e.id===`session.new`));return/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:n(`actions.newSession`),shortcutKeys:i?.keys,side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Eg.button,"aria-label":n(`actions.newSession`),"aria-keyshortcuts":i?.aria,"data-phone-new-session":!0,onClick:()=>{e()},children:/* @__PURE__ */ (0,o.jsx)(r.IconNewChatOutlineRegular,{size:17,className:Eg.icon})})})}let Og=`@deepseek-ai/dsh-client-ui-workspace/RecentShortcut.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Og)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Og,e.textContent=`.oOF3UG_shortcut{isolation:isolate;box-sizing:border-box;width:max-content;min-width:0;max-width:min(164px,100% - 24px);min-height:44px;color:var(--dsw-alias-label-primary);background:0 0;border:0;border-radius:8px;flex:none;align-items:center;padding:0;font-size:13px;font-weight:500;line-height:20px;display:inline-flex;position:relative}.oOF3UG_select,.oOF3UG_close{border-radius:inherit;min-height:44px;color:inherit;font:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent;background:0 0;border:0;align-items:center;padding:0;display:inline-flex}.oOF3UG_select{box-sizing:border-box;text-align:start;flex:1;align-self:stretch;gap:6px;min-width:44px;padding-inline-start:8px}.oOF3UG_close{width:28px;color:var(--dsw-alias-label-secondary);flex:0 0 28px;justify-content:center}.oOF3UG_close:active{color:var(--dsw-alias-label-primary)}.oOF3UG_shortcut:before{content:"";z-index:-1;box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l2);border-radius:inherit;background:var(--dsw-alias-bg-module-platform);box-shadow:inset 0 .5px 0 color-mix(in srgb, var(--dsw-alias-bg-layer-1) 65%, transparent), 0 1px 3px color-mix(in srgb, var(--dsw-alias-label-primary) 5%, transparent);pointer-events:none;position:absolute;inset:6px 0}.oOF3UG_shortcut[data-active]:before{border-width:1px;border-color:color-mix(in srgb, var(--dsw-alias-label-primary) 34%, var(--dsw-alias-border-l2));background:color-mix(in srgb, var(--dsw-alias-bg-module-platform) 90%, var(--dsw-alias-label-primary))}.oOF3UG_shortcut:active:before{background:var(--dsw-alias-button-ghost-active-fill)}@supports (backdrop-filter:blur(8px)){.oOF3UG_shortcut:before{background:color-mix(in srgb, var(--dsw-alias-bg-module-platform) 64%, transparent);backdrop-filter:blur(8px)saturate(115%)}.oOF3UG_shortcut[data-active]:before{background:color-mix(in srgb, color-mix(in srgb, var(--dsw-alias-bg-module-platform) 90%, var(--dsw-alias-label-primary)) 82%, transparent)}.oOF3UG_shortcut:active:before{background:color-mix(in srgb, var(--dsw-alias-button-ghost-active-fill) 82%, transparent)}}.oOF3UG_select:focus-visible,.oOF3UG_close:focus-visible{outline:none}@media (hover:hover) and (pointer:fine){.oOF3UG_select:focus-visible,.oOF3UG_close:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}}.oOF3UG_identity{flex:0 0 14px;justify-content:center;align-items:center;width:14px;height:14px;display:inline-flex}.oOF3UG_identity:has([data-role-avatar]){flex:0 0 22px;width:22px;height:22px}.oOF3UG_title{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.oOF3UG_activity{flex:none;justify-content:center;align-items:center;display:inline-flex}@media (prefers-reduced-transparency:reduce),(prefers-contrast:more){.oOF3UG_shortcut:before,.oOF3UG_shortcut[data-active]:before{border-color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-module-platform);backdrop-filter:none;box-shadow:none}.oOF3UG_shortcut[data-active]:before{border-width:1px;border-color:var(--dsw-alias-label-primary)}.oOF3UG_shortcut:active:before{background:var(--dsw-alias-button-ghost-active-fill)}}@media (forced-colors:active){.oOF3UG_shortcut{color:buttontext}.oOF3UG_shortcut:before{backdrop-filter:none;box-shadow:none;background:buttonface;border:1px solid buttontext}.oOF3UG_shortcut[data-active],.oOF3UG_shortcut:active{color:highlighttext}.oOF3UG_shortcut[data-active]:before,.oOF3UG_shortcut:active:before{background:highlight;border-color:highlight}.oOF3UG_close,.oOF3UG_close:active{color:inherit}.oOF3UG_select:focus-visible,.oOF3UG_close:focus-visible{outline-color:highlight}.oOF3UG_shortcut[data-active] .oOF3UG_select:focus-visible,.oOF3UG_shortcut[data-active] .oOF3UG_close:focus-visible{outline-color:highlighttext}}`,document.head.appendChild(e)}var kg={activity:`oOF3UG_activity`,close:`oOF3UG_close`,identity:`oOF3UG_identity`,select:`oOF3UG_select`,shortcut:`oOF3UG_shortcut`,title:`oOF3UG_title`};function Ag({visit:e,summary:t,identity:n,activityLabel:i,activity:a,active:c,closeLabel:l,closeHint:u,open:d,close:f,restoreNavigationFocus:p}){let m=(0,s.useRef)(null),h=(0,s.useCallback)(e=>{e===null&&m.current?.contains(document.activeElement)&&p(),m.current=e},[p]);return/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:h,className:kg.shortcut,"data-active":c||void 0,onMouseDown:e=>{e.button===1&&e.target instanceof Node&&e.currentTarget.contains(e.target)&&e.preventDefault()},onAuxClick:t=>{t.button===1&&t.target instanceof Node&&t.currentTarget.contains(t.target)&&(t.preventDefault(),t.stopPropagation(),p(),f(e.sessionId))},children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:kg.select,onMouseDown:e=>e.preventDefault(),title:t.displayTitle,"aria-current":c?`page`:void 0,"aria-label":[t.displayTitle,t.id,i].filter(Boolean).join(` · `),onClick:()=>{c||(p(),d(e.target))},children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:kg.identity,children:n}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:kg.title,children:t.displayTitle}),a!=null&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:kg.activity,title:i,children:a})]}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:kg.close,onMouseDown:e=>e.preventDefault(),"aria-label":l,title:u,onClick:()=>{p(),f(e.sessionId)},children:/* @__PURE__ */ (0,o.jsx)(r.IconCloseOutlineRegular,{size:12})})]})}let jg=`@deepseek-ai/dsh-client-ui-workspace/Rows.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(jg)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=jg,e.textContent=`._5OaiBG_hostBadge{--ch-peer-dot-color:#3b82f6;letter-spacing:.01em;min-width:0;max-width:88px;height:18px;color:color-mix(in srgb, var(--dsw-alias-label-secondary) 60%, var(--dsw-alias-label-tertiary));background:0 0;border:none;flex-shrink:0;align-items:center;gap:4.5px;margin-left:4px;padding:0;font-size:11px;font-weight:500;line-height:16px;display:inline-flex;overflow:hidden}._5OaiBG_hostBadgeSession{gap:4px;max-width:74px;height:16px;margin-left:2px;font-size:10.5px}._5OaiBG_hostBadge[data-color=blue],._5OaiBG_hoverHostDot[data-color=blue],._5OaiBG_remoteFolderGlobe[data-color=blue]{--ch-peer-dot-color:#3b76cc}._5OaiBG_hostBadge[data-color=purple],._5OaiBG_hoverHostDot[data-color=purple],._5OaiBG_remoteFolderGlobe[data-color=purple]{--ch-peer-dot-color:#7460cc}._5OaiBG_hostBadge[data-color=cyan],._5OaiBG_hoverHostDot[data-color=cyan],._5OaiBG_remoteFolderGlobe[data-color=cyan]{--ch-peer-dot-color:#0e8fa8}._5OaiBG_hostBadge[data-color=green],._5OaiBG_hoverHostDot[data-color=green],._5OaiBG_remoteFolderGlobe[data-color=green]{--ch-peer-dot-color:#2f8c70}._5OaiBG_hostBadge[data-color=amber],._5OaiBG_hoverHostDot[data-color=amber],._5OaiBG_remoteFolderGlobe[data-color=amber]{--ch-peer-dot-color:#c27803}._5OaiBG_hostBadge[data-color=rose],._5OaiBG_hoverHostDot[data-color=rose],._5OaiBG_remoteFolderGlobe[data-color=rose]{--ch-peer-dot-color:#c94a6a}._5OaiBG_hostBadge[data-color=slate],._5OaiBG_hoverHostDot[data-color=slate],._5OaiBG_remoteFolderGlobe[data-color=slate]{--ch-peer-dot-color:#64748b}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hoverHostDot,._5OaiBG_remoteFolderGlobe)[data-color=blue]{--ch-peer-dot-color:#7bb0f8}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hoverHostDot,._5OaiBG_remoteFolderGlobe)[data-color=purple]{--ch-peer-dot-color:#a899f2}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hoverHostDot,._5OaiBG_remoteFolderGlobe)[data-color=cyan]{--ch-peer-dot-color:#63c5da}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hoverHostDot,._5OaiBG_remoteFolderGlobe)[data-color=green]{--ch-peer-dot-color:#6ec4a7}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hoverHostDot,._5OaiBG_remoteFolderGlobe)[data-color=amber]{--ch-peer-dot-color:#e0ae58}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hoverHostDot,._5OaiBG_remoteFolderGlobe)[data-color=rose]{--ch-peer-dot-color:#e08298}body[data-ds-dark-theme] :is(._5OaiBG_hostBadge,._5OaiBG_hoverHostDot,._5OaiBG_remoteFolderGlobe)[data-color=slate]{--ch-peer-dot-color:#94a3b8}._5OaiBG_hostBadge[data-state=connecting]{color:color-mix(in srgb, var(--dsw-alias-state-warning-primary,var(--dsw-alias-state-warn-primary,#d97706)) 78%, var(--dsw-alias-label-secondary))}._5OaiBG_hostBadge:is([data-state=disconnected],[data-state=offline],[data-state=auth-error]){color:var(--dsw-alias-label-tertiary);opacity:.72}._5OaiBG_hostLabel{text-overflow:ellipsis;white-space:nowrap;flex:auto;min-width:0;overflow:hidden}._5OaiBG_hostDot{background:var(--dsw-alias-label-tertiary);opacity:.45;border-radius:50%;flex-shrink:0;width:5px;height:5px}._5OaiBG_hostBadge[data-state=connected] ._5OaiBG_hostDot{background:var(--ch-peer-dot-color);opacity:.95}._5OaiBG_hostBadge[data-state=connecting] ._5OaiBG_hostDot{background:var(--dsw-alias-state-warning-primary,var(--dsw-alias-state-warn-primary,#d97706));opacity:.9;animation:1.6s ease-in-out infinite _5OaiBG_hostDotPulse}@keyframes _5OaiBG_hostDotPulse{0%,to{opacity:.95}50%{opacity:.35}}@media (prefers-reduced-motion:reduce){._5OaiBG_hostBadge[data-state=connecting] ._5OaiBG_hostDot,._5OaiBG_remoteHostStatusDot[data-state=connecting]{animation:none}}._5OaiBG_remoteFolderGlobe{--ch-peer-dot-color:#3b76cc;background:var(--dsh-row-surface);width:11px;height:11px;color:var(--ch-peer-dot-color);pointer-events:none;border-radius:50%;justify-content:center;align-items:center;display:inline-flex;position:absolute;bottom:0;right:-3px}._5OaiBG_remoteSessionGlobe{z-index:1;width:10px;height:10px;bottom:0;right:-4px}._5OaiBG_remoteSessionGlobe svg{width:9px;height:9px}._5OaiBG_remoteFolderGlobe:is([data-state=disconnected],[data-state=offline],[data-state=auth-error]){opacity:.6}._5OaiBG_remoteHostText{flex:1;align-items:baseline;gap:6px;min-width:0;display:flex;overflow:hidden}._5OaiBG_remoteHostText ._5OaiBG_title{flex:0 auto}._5OaiBG_remoteHostMeta{text-overflow:ellipsis;white-space:nowrap;font-variant-numeric:tabular-nums;max-width:45%;color:var(--dsw-alias-label-tertiary);flex:none;font-size:12px;line-height:16px;overflow:hidden}._5OaiBG_remoteHostStatusDot{background:var(--dsw-alias-label-tertiary);opacity:.45;border-radius:50%;flex:none;width:7px;height:7px;margin-inline:auto 4px}._5OaiBG_remoteHostStatusDot[data-state=connected]{background:var(--dsw-alias-state-success-primary,#22c55e);opacity:1}._5OaiBG_remoteHostStatusDot[data-state=connecting]{background:var(--dsw-alias-state-warning-primary,var(--dsw-alias-state-warn-primary,#d97706));opacity:.95;animation:1.6s ease-in-out infinite _5OaiBG_hostDotPulse}._5OaiBG_hoverHost{color:#cfd3d6;align-items:center;gap:6px;font-size:12px;line-height:16px;display:flex}._5OaiBG_hoverHostDot{--ch-peer-dot-color:#7bb0f8;opacity:.55;background:#94a3b8;border-radius:50%;flex:none;width:6px;height:6px}._5OaiBG_hoverHostDot[data-state=connected]{background:var(--ch-peer-dot-color);opacity:.95}._5OaiBG_hoverHostDot[data-state=connecting]{opacity:.9;background:#e0ae58}._5OaiBG_projectRow,._5OaiBG_sessionRow{--dsh-row-surface:var(--dsw-specific-sidebar-fill);border-radius:var(--dsw-radius-md);padding:0 8px;cursor:pointer;-webkit-tap-highlight-color:transparent;user-select:none;color:var(--dsw-alias-label-primary);align-items:center;gap:6px;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px));display:flex;position:relative}._5OaiBG_projectRow:is(:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen),._5OaiBG_sessionRow:is(:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 4%, var(--dsw-specific-sidebar-fill));background:var(--dsh-row-surface)}._5OaiBG_sessionRow._5OaiBG_selected{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, var(--dsw-specific-sidebar-fill));background:var(--dsh-row-surface)}._5OaiBG_sessionRow._5OaiBG_selected:is(:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, var(--dsw-specific-sidebar-fill))}@media (hover:hover){._5OaiBG_projectRow:hover,._5OaiBG_sessionRow:hover{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 4%, var(--dsw-specific-sidebar-fill));background:var(--dsh-row-surface)}._5OaiBG_sessionRow._5OaiBG_selected:hover{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, var(--dsw-specific-sidebar-fill))}}._5OaiBG_sessionRow,._5OaiBG_searchResultRow{--ch-sidebar-text-primary:#1a1c1f;letter-spacing:normal;color:color-mix(in oklab, var(--ch-sidebar-text-primary) 85%, transparent);font-family:-apple-system,"system-ui",Segoe UI,sans-serif;font-size:14px;font-weight:430;line-height:20px}body[data-ds-dark-theme] ._5OaiBG_sessionRow,body[data-ds-dark-theme] ._5OaiBG_searchResultRow{--ch-sidebar-text-primary:#fff}._5OaiBG_projectRow:focus-visible,._5OaiBG_sessionRow:focus-visible,._5OaiBG_searchResultRow:focus-visible,._5OaiBG_iconButton:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}._5OaiBG_searchResultRow{box-sizing:border-box;border-radius:var(--dsw-radius-lg);cursor:pointer;text-align:left;background:0 0;border:none;flex-direction:column;align-items:stretch;width:100%;min-height:48px;padding:4px 8px;display:flex}._5OaiBG_searchResultRow:hover,._5OaiBG_searchResultRow._5OaiBG_selected{background:var(--dsw-alias-interactive-bg-hover)}._5OaiBG_searchResultHeading{align-items:center;gap:4px;min-width:0;display:flex}._5OaiBG_searchResultTitle{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;margin-left:4px;font-size:14px;line-height:20px;overflow:hidden}._5OaiBG_searchResultMeta{align-items:center;gap:6px;min-width:0;margin-left:20px;display:flex}._5OaiBG_searchResultWorkspace,._5OaiBG_searchResultSnippet{text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:17px;overflow:hidden}._5OaiBG_searchResultWorkspace{max-width:40%;color:var(--dsw-alias-label-tertiary);flex:none}._5OaiBG_searchResultWorkspace:only-child{max-width:100%}._5OaiBG_searchResultSnippet{min-width:0;color:var(--dsw-alias-label-secondary);flex:1}._5OaiBG_projectRow{box-sizing:border-box;align-items:center;height:34px}._5OaiBG_sessionRow{box-sizing:border-box;min-width:0;max-width:100%;flex-direction:column;align-items:stretch;gap:0;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px) + var(--dsh-thread-indent,0px))}._5OaiBG_sessionMain{min-width:0;height:var(--dsh-thread-row-height);flex:none;align-items:center;display:flex;position:relative}._5OaiBG_identityButton{appearance:none;cursor:pointer;background:0 0;border:0;border-radius:4px;padding:0}._5OaiBG_identityButton:after{content:"";position:absolute;inset:-6px -4px -6px -8px}@media (hover:none),(pointer:coarse){._5OaiBG_sessionRow:not(:has(>[data-thread-summary])) ._5OaiBG_identityButton:after{inset:-12px -6px -12px -8px}}._5OaiBG_foldChevron{justify-content:center;align-items:center;display:none;position:absolute;inset:0}._5OaiBG_foldChevron:before{content:"";border-bottom:1.5px solid;border-right:1.5px solid;width:6px;height:6px;transform:translate(-1px)rotate(-45deg)}._5OaiBG_identityButton[aria-expanded=true] ._5OaiBG_foldChevron:before{transform:translateY(-1px)rotate(45deg)}._5OaiBG_identityButton[aria-expanded=true]>:not(._5OaiBG_foldChevron){visibility:hidden}._5OaiBG_identityButton[aria-expanded=true] ._5OaiBG_foldChevron{color:var(--dsw-alias-label-secondary,currentColor);display:flex}@media (hover:hover) and (pointer:fine){._5OaiBG_identityButton:hover>:not(._5OaiBG_foldChevron),._5OaiBG_identityButton:focus-visible>:not(._5OaiBG_foldChevron){visibility:hidden}._5OaiBG_identityButton:hover ._5OaiBG_foldChevron,._5OaiBG_identityButton:focus-visible ._5OaiBG_foldChevron{color:var(--dsw-alias-text-secondary,currentColor);display:flex}}._5OaiBG_identityButton:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}._5OaiBG_sessionRow ._5OaiBG_title{margin:0 6px 0 4px}._5OaiBG_slot{width:16px;height:20px;color:var(--dsw-alias-label-tertiary);flex:none;justify-content:center;align-items:center;display:inline-flex;position:relative}._5OaiBG_slot:has([data-harness-id]),._5OaiBG_slot:has([data-role-avatar]){width:14px;color:inherit}._5OaiBG_sessionRow:has([data-harness-id]) ._5OaiBG_title,._5OaiBG_searchResultHeading:has([data-harness-id]) ._5OaiBG_searchResultTitle{margin-left:8px}._5OaiBG_sessionRow:has([data-role-avatar]) ._5OaiBG_title,._5OaiBG_searchResultHeading:has([data-role-avatar]) ._5OaiBG_searchResultTitle{margin-left:10px}._5OaiBG_sessionRow:has([data-role-badge]) ._5OaiBG_title{margin-left:5px}._5OaiBG_sessionRow:has([data-group-prefix]) ._5OaiBG_title{margin-left:4px}._5OaiBG_statusOverlay{display:contents}._5OaiBG_slot:has([data-harness-id]) ._5OaiBG_statusOverlay,._5OaiBG_slot:has([data-role-avatar]) ._5OaiBG_statusOverlay{transform-origin:100% 100%;display:inline-flex;position:absolute;bottom:-3px;right:-3px;transform:scale(.65)}._5OaiBG_slot:has([data-role-avatar]) ._5OaiBG_statusOverlay{bottom:-3px;right:-5px}._5OaiBG_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}._5OaiBG_projectRow>._5OaiBG_slot:not(._5OaiBG_folderExpanded){color:color-mix(in srgb, currentColor 86%, transparent);transition:color .14s}._5OaiBG_projectRow:hover>._5OaiBG_slot:not(._5OaiBG_folderExpanded){color:inherit}._5OaiBG_folderExpanded{color:var(--dsw-alias-state-business-primary)}._5OaiBG_projectText{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}._5OaiBG_titleGroup{flex:1;align-items:center;min-width:0;display:flex}._5OaiBG_title{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:14px;line-height:20px;overflow:hidden}._5OaiBG_projectRow ._5OaiBG_projectText>._5OaiBG_title,._5OaiBG_sessionRow ._5OaiBG_title,._5OaiBG_searchResultTitle{--dsh-title-ink-bleed:4px;text-overflow:clip;-webkit-text-size-adjust:100%;text-size-adjust:100%;align-items:center;margin-inline-end:calc(-1 * var(--dsh-title-ink-bleed));padding-inline-end:var(--dsh-title-ink-bleed);display:flex;overflow:clip visible;container-type:inline-size}._5OaiBG_sessionRow ._5OaiBG_title{margin-inline-end:calc(6px - var(--dsh-title-ink-bleed))}._5OaiBG_projectRow ._5OaiBG_projectText>._5OaiBG_title>._5OaiBG_titleText,._5OaiBG_sessionRow ._5OaiBG_title>._5OaiBG_titleText,._5OaiBG_searchResultTitle>._5OaiBG_titleText{box-sizing:content-box;padding:var(--dsh-title-ink-bleed);margin:calc(-1 * var(--dsh-title-ink-bleed));white-space:nowrap;--dsh-title-fade:clamp(0px, ( min(100%, 100cqw + 20px + var(--dsh-title-ink-bleed) * 2) - 100cqw - var(--dsh-title-ink-bleed) * 2 - .5px ) * 48, 20px + var(--dsh-title-ink-bleed));-webkit-mask-image:linear-gradient(to right, #000 calc(100cqw + var(--dsh-title-ink-bleed) * 2 - var(--dsh-title-fade)), transparent calc(100cqw + var(--dsh-title-ink-bleed) * 2 + 20px - var(--dsh-title-fade)));mask-image:linear-gradient(to right, #000 calc(100cqw + var(--dsh-title-ink-bleed) * 2 - var(--dsh-title-fade)), transparent calc(100cqw + var(--dsh-title-ink-bleed) * 2 + 20px - var(--dsh-title-fade)));flex:none}._5OaiBG_renameInput{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-button-elevated-fill);min-width:0;color:inherit;outline:none;padding:0 2px;font-size:14px;line-height:20px}._5OaiBG_sessionRow ._5OaiBG_title{flex:1}._5OaiBG_meta{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:20px;overflow:hidden}._5OaiBG_trailing{flex:none;place-items:center end;display:grid}._5OaiBG_trailing:empty{display:none}._5OaiBG_trailing>*{grid-area:1/1}._5OaiBG_time{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary);flex:none;font-size:10px;line-height:16px}._5OaiBG_timeStatus{justify-content:center;align-items:center;gap:6px;min-width:16px;height:20px;display:inline-flex}._5OaiBG_timeStatus [data-state=done],._5OaiBG_projectActivity [data-state=done]{color:var(--dsw-alias-state-business-primary)}._5OaiBG_projectActivity{flex:none;justify-content:center;align-items:center;min-width:16px;height:20px;display:inline-flex}._5OaiBG_timeStatus ._5OaiBG_visuallyHidden,._5OaiBG_projectActivity ._5OaiBG_visuallyHidden{visibility:visible}._5OaiBG_sessionRow._5OaiBG_archived ._5OaiBG_title,._5OaiBG_searchResultRow._5OaiBG_archived ._5OaiBG_searchResultTitle,._5OaiBG_searchResultRow._5OaiBG_archived ._5OaiBG_searchResultWorkspace,._5OaiBG_searchResultRow._5OaiBG_archived ._5OaiBG_searchResultSnippet{color:var(--dsw-alias-label-caption)}._5OaiBG_sessionRow._5OaiBG_sectionMoving{cursor:progress}._5OaiBG_sessionRow._5OaiBG_sectionMoving ._5OaiBG_sessionMain{opacity:.62}@media (prefers-reduced-motion:no-preference){._5OaiBG_sessionRow._5OaiBG_sectionMoving ._5OaiBG_sessionMain{transition:opacity .12s var(--ds-ease-in-out)}}._5OaiBG_sectionMovingSpinner{color:var(--dsw-alias-label-tertiary)}._5OaiBG_dot{flex:none}._5OaiBG_quickActions{align-items:center;gap:2px;display:inline-flex}._5OaiBG_rowActions{visibility:hidden;pointer-events:none;flex:none;align-items:center;gap:2px;display:inline-flex}._5OaiBG_projectRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen) ._5OaiBG_rowActions,._5OaiBG_sessionRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen) ._5OaiBG_rowActions,._5OaiBG_searchResultRow:is(:hover,:focus-visible,:has(:focus-visible)) ._5OaiBG_rowActions{visibility:visible;pointer-events:auto}._5OaiBG_searchResultHeading ._5OaiBG_rowActions{margin-left:auto}@media (hover:hover) and (pointer:fine){._5OaiBG_sessionRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen) :is(._5OaiBG_time,._5OaiBG_hostBadge),._5OaiBG_projectRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen) :is(._5OaiBG_hostBadge,._5OaiBG_remoteHostStatusDot,._5OaiBG_projectActivity){visibility:hidden}._5OaiBG_projectRow>._5OaiBG_rowActions,._5OaiBG_sessionRow ._5OaiBG_rowActions{inset-inline-end:0;z-index:1;background:var(--dsh-row-surface);border-radius:var(--dsw-radius-sm);position:absolute;top:50%;transform:translateY(-50%)}._5OaiBG_projectRow>._5OaiBG_rowActions{inset-inline-end:8px}._5OaiBG_projectRow>._5OaiBG_rowActions:before,._5OaiBG_sessionRow ._5OaiBG_rowActions:before{content:"";background:linear-gradient(to right, transparent, var(--dsh-row-surface));pointer-events:none;width:12px;position:absolute;inset-block:0;inset-inline-end:100%}}[data-phone-drawer] ._5OaiBG_sessionRow{min-height:44px}[data-phone-drawer] ._5OaiBG_sessionRow:has(>[data-thread-summary]){grid-template-columns:var(--dsh-thread-icon-size,16px) minmax(0, 1fr) auto;grid-template-rows:24px 24px;column-gap:8px;padding-block:2px;display:grid}[data-phone-drawer] ._5OaiBG_sessionRow:has(>[data-thread-summary])>._5OaiBG_hostRail{top:7px}[data-phone-drawer] ._5OaiBG_sessionRow:has(>[data-thread-summary]) ._5OaiBG_sessionMain{display:contents;position:static}[data-phone-drawer] ._5OaiBG_sessionRow:has(>[data-thread-summary]) ._5OaiBG_slot{grid-area:1/1;align-self:center}[data-phone-drawer] ._5OaiBG_sessionRow:has(>[data-thread-summary]) ._5OaiBG_titleGroup{grid-area:1/2;align-self:center}[data-phone-drawer] ._5OaiBG_sessionRow:has(>[data-thread-summary]) ._5OaiBG_title{margin:0 calc(-1 * var(--dsh-title-ink-bleed)) 0 0}[data-phone-drawer] ._5OaiBG_sessionRow:has(>[data-thread-summary]):has([data-role-badge]) ._5OaiBG_title{margin-inline-start:5px}[data-phone-drawer] ._5OaiBG_sessionRow:has(>[data-thread-summary]):has([data-group-prefix]):not(:has([data-role-badge])) ._5OaiBG_title{margin-inline-start:4px}[data-phone-drawer] ._5OaiBG_sessionRow:has(>[data-thread-summary]) :is([data-role-badge],[data-group-prefix]){margin-inline-start:0}[data-phone-drawer] ._5OaiBG_sessionRow:has(>[data-thread-summary]) [data-group-prefix]+[data-role-badge]{margin-inline-start:4px}[data-phone-drawer] ._5OaiBG_sessionRow:has(>[data-thread-summary]) ._5OaiBG_trailing{grid-area:1/3/span 2;align-self:center}[data-phone-drawer] ._5OaiBG_sessionRow>[data-thread-summary]{text-overflow:ellipsis;white-space:nowrap;grid-area:2/2;width:100%;margin:0;padding-inline:0;overflow:hidden}._5OaiBG_phoneDetails{padding:8px 8px 16px}._5OaiBG_phoneDetails ._5OaiBG_hoverTitle{display:none}._5OaiBG_phoneDetails :is(._5OaiBG_hoverTitle,._5OaiBG_hoverTime,._5OaiBG_hoverStatus,._5OaiBG_hoverPath){color:inherit}._5OaiBG_sessionRow._5OaiBG_dropBefore,._5OaiBG_sessionRow._5OaiBG_dropAfter{position:relative}._5OaiBG_sessionRow._5OaiBG_dropBefore:before,._5OaiBG_sessionRow._5OaiBG_dropAfter:after{content:"";z-index:1;background:linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat, linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat, linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;pointer-events:none;height:12px;position:absolute;left:0;right:4px}._5OaiBG_sessionRow._5OaiBG_dropBefore:before{top:-7px}._5OaiBG_sessionRow._5OaiBG_dropAfter:after{bottom:-7px}._5OaiBG_hoverContent{flex-direction:column;gap:8px;display:flex}._5OaiBG_hoverTitle{color:#fff;overflow-wrap:break-word;font-size:14px;line-height:20px}._5OaiBG_hoverPath{color:#cfd3d6;word-break:break-all;font-size:12px;line-height:16px}._5OaiBG_hoverTime{color:#cfd3d6;font-size:12px;line-height:16px}._5OaiBG_hoverStatus{color:#adb2b8;align-items:center;gap:8px;font-size:12px;line-height:20px;display:flex}._5OaiBG_hoverArchived svg{flex-shrink:0;margin:0 -4px}._5OaiBG_iconButton{cursor:pointer;-webkit-tap-highlight-color:transparent;width:24px;height:24px;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;border-radius:4px;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}@media (hover:hover){._5OaiBG_iconButton:hover{color:var(--dsw-alias-label-primary);background:color-mix(in srgb, var(--dsw-alias-label-primary) 7%, transparent)}}[data-phone-drawer] :is(._5OaiBG_projectRow,._5OaiBG_sessionRow){--dsh-row-surface:transparent;background:var(--dsh-row-surface)}[data-phone-drawer] :is(._5OaiBG_projectRow,._5OaiBG_sessionRow):is(:active,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 3%, transparent)}[data-phone-drawer] ._5OaiBG_sessionRow._5OaiBG_selected{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}[data-phone-drawer] ._5OaiBG_rowActions,[data-phone-drawer] ._5OaiBG_rowActions:before{background:0 0}[data-phone-drawer] ._5OaiBG_remoteFolderGlobe,body[data-codexhost-wallpaper] ._5OaiBG_remoteFolderGlobe{background:var(--dsw-specific-sidebar-fill)}body[data-codexhost-wallpaper] :is(._5OaiBG_projectRow,._5OaiBG_sessionRow){--dsh-row-surface:transparent}body[data-codexhost-wallpaper] :is(._5OaiBG_projectRow,._5OaiBG_sessionRow):is(:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}body[data-codexhost-wallpaper] ._5OaiBG_sessionRow._5OaiBG_selected{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent)}body[data-codexhost-wallpaper] ._5OaiBG_sessionRow._5OaiBG_selected:is(:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen){--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 12%, transparent)}@media (hover:hover){body[data-codexhost-wallpaper] :is(._5OaiBG_projectRow,._5OaiBG_sessionRow):hover{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent)}body[data-codexhost-wallpaper] ._5OaiBG_sessionRow._5OaiBG_selected:hover{--dsh-row-surface:color-mix(in srgb, var(--dsw-alias-label-primary) 12%, transparent)}}@media (hover:hover) and (pointer:fine){body[data-codexhost-wallpaper] :is(._5OaiBG_projectRow>._5OaiBG_rowActions,._5OaiBG_sessionRow ._5OaiBG_rowActions){background:color-mix(in srgb, var(--dsw-specific-sidebar-fill) 82%, transparent)}body[data-codexhost-wallpaper] :is(._5OaiBG_projectRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen)>._5OaiBG_rowActions,._5OaiBG_sessionRow:is(:hover,:focus-visible,:has(:focus-visible),._5OaiBG_menuOpen) ._5OaiBG_rowActions){backdrop-filter:blur(10px)}body[data-codexhost-wallpaper] :is(){display:none}}[data-phone-drawer] ._5OaiBG_iconButton{width:44px;height:44px;color:var(--dsw-alias-label-tertiary);background:0 0}[data-phone-drawer] ._5OaiBG_iconButton:active{color:var(--dsw-alias-label-primary)}@media (hover:none),(pointer:coarse){._5OaiBG_projectRow,._5OaiBG_sessionRow{min-height:44px}._5OaiBG_rowActions{visibility:visible;pointer-events:auto}._5OaiBG_sessionRow ._5OaiBG_quickActions{display:none}._5OaiBG_sessionRow ._5OaiBG_trailing{align-items:center;gap:4px;display:flex}._5OaiBG_sessionRow ._5OaiBG_time:not(._5OaiBG_timeStatus){display:none}._5OaiBG_sessionRow ._5OaiBG_timeStatus{visibility:visible;padding-inline-end:0}._5OaiBG_iconButton{width:44px;height:44px}}`,document.head.appendChild(e)}var J={archived:`_5OaiBG_archived`,dot:`_5OaiBG_dot`,dropAfter:`_5OaiBG_dropAfter`,dropBefore:`_5OaiBG_dropBefore`,foldChevron:`_5OaiBG_foldChevron`,folderExpanded:`_5OaiBG_folderExpanded`,hostBadge:`_5OaiBG_hostBadge`,hostBadgeSession:`_5OaiBG_hostBadgeSession`,hostDot:`_5OaiBG_hostDot`,hostDotPulse:`_5OaiBG_hostDotPulse`,hostLabel:`_5OaiBG_hostLabel`,hostRail:`_5OaiBG_hostRail`,hoverArchived:`_5OaiBG_hoverArchived`,hoverContent:`_5OaiBG_hoverContent`,hoverHost:`_5OaiBG_hoverHost`,hoverHostDot:`_5OaiBG_hoverHostDot`,hoverPath:`_5OaiBG_hoverPath`,hoverStatus:`_5OaiBG_hoverStatus`,hoverTime:`_5OaiBG_hoverTime`,hoverTitle:`_5OaiBG_hoverTitle`,iconButton:`_5OaiBG_iconButton`,identityButton:`_5OaiBG_identityButton`,menuOpen:`_5OaiBG_menuOpen`,meta:`_5OaiBG_meta`,phoneDetails:`_5OaiBG_phoneDetails`,projectActivity:`_5OaiBG_projectActivity`,projectRow:`_5OaiBG_projectRow`,projectText:`_5OaiBG_projectText`,quickActions:`_5OaiBG_quickActions`,remoteFolderGlobe:`_5OaiBG_remoteFolderGlobe`,remoteHostMeta:`_5OaiBG_remoteHostMeta`,remoteHostStatusDot:`_5OaiBG_remoteHostStatusDot`,remoteHostText:`_5OaiBG_remoteHostText`,remoteSessionGlobe:`_5OaiBG_remoteSessionGlobe`,renameInput:`_5OaiBG_renameInput`,rowActions:`_5OaiBG_rowActions`,searchResultHeading:`_5OaiBG_searchResultHeading`,searchResultMeta:`_5OaiBG_searchResultMeta`,searchResultRow:`_5OaiBG_searchResultRow`,searchResultSnippet:`_5OaiBG_searchResultSnippet`,searchResultTitle:`_5OaiBG_searchResultTitle`,searchResultWorkspace:`_5OaiBG_searchResultWorkspace`,sectionMoving:`_5OaiBG_sectionMoving`,sectionMovingSpinner:`_5OaiBG_sectionMovingSpinner`,selected:`_5OaiBG_selected`,sessionMain:`_5OaiBG_sessionMain`,sessionRow:`_5OaiBG_sessionRow`,slot:`_5OaiBG_slot`,statusOverlay:`_5OaiBG_statusOverlay`,time:`_5OaiBG_time`,timeStatus:`_5OaiBG_timeStatus`,title:`_5OaiBG_title`,titleGroup:`_5OaiBG_titleGroup`,titleText:`_5OaiBG_titleText`,trailing:`_5OaiBG_trailing`,visuallyHidden:`_5OaiBG_visuallyHidden`};function Mg(e,t){let n=e.runningSubagentCount===0?void 0:{state:`ongoing`,label:t(e.runningSubagentCount===1?`status.subagentsRunning.one`:`status.subagentsRunning.other`,{n:e.runningSubagentCount})},r;switch(e.pendingInteraction){case`approval`:r={state:`warning`,label:t(`status.waitingApproval`),trailingLabel:t(`status.compact.approval`)};break;case`plan-review`:r={state:`warning`,label:t(`status.planReview`),trailingLabel:t(`status.compact.planReview`)};break;case`question`:r={state:`warning`,label:t(`status.waitingAnswer`),trailingLabel:t(`status.compact.answer`)};break;case void 0:break;default:return Ng(e.pendingInteraction)}if(r!==void 0)return n===void 0?[r]:[r,n];if(e.running){let e={state:`ongoing`,label:t(`status.running`)};return n===void 0?[e]:[e,n]}return n===void 0?e.completed?[{state:`done`,label:t(`status.completed`)}]:[{state:`idle`,label:t(`status.idle`)}]:[n]}function Ng(e){throw Error(`unknown pending interaction: ${String(e)}`)}function Pg({statuses:e}){return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.StateDot,{state:e[0].state,size:e[0].state===`ongoing`?16:void 0}),e.map(e=>/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.visuallyHidden,children:e.label},e.label))]})}let Fg=`@deepseek-ai/dsh-client-ui-workspace/RecentNavigation.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Fg)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Fg,e.textContent=`.qXmkFa_trigger,.qXmkFa_shortcuts{display:none}[data-phone] .qXmkFa_trigger{width:auto;height:auto;color:var(--dsw-alias-label-secondary);cursor:pointer;-webkit-tap-highlight-color:transparent;-webkit-app-region:no-drag;-webkit-tap-highlight-color:transparent;background:0 0;border:0;border-radius:0;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex;position:relative}[data-phone] .qXmkFa_trigger:after{content:"";position:absolute;inset:-12px -10px}[data-phone] .qXmkFa_trigger>svg{transition:transform .18s;display:block}.qXmkFa_trigger[aria-disabled=true]{cursor:wait}.qXmkFa_trigger:focus-visible{outline:none}.qXmkFa_expanded{transform:rotate(180deg)}@media (prefers-reduced-motion:reduce){[data-phone] .qXmkFa_trigger>svg{transition:none}}[data-phone] .qXmkFa_shortcuts{overflow-anchor:none;scroll-behavior:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;scrollbar-width:none;-webkit-app-region:no-drag;grid-column:1/-1;gap:6px;min-width:0;min-height:44px;margin-inline:-12px -20px;padding-inline-end:16px;scroll-padding-inline:8px 20px;display:flex;overflow-x:auto}.qXmkFa_clear{min-width:44px;min-height:44px;color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent;background:0 0;border:0;border-radius:8px;flex:none;align-self:center;padding:0 6px;font-size:12px}.qXmkFa_clear:active{background:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent)}.qXmkFa_clear:focus-visible{outline:none}@media (hover:hover) and (pointer:fine){.qXmkFa_clear:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}}.qXmkFa_shortcuts::-webkit-scrollbar{width:0;height:0;display:none}`,document.head.appendChild(e)}var Ig={clear:`qXmkFa_clear`,expanded:`qXmkFa_expanded`,shortcuts:`qXmkFa_shortcuts`,trigger:`qXmkFa_trigger`};function Lg({useVisits:e,useSessions:t,useWorkspaces:n,useSessionStatus:r,t:i}){let a=e(e=>e),o=t(e=>e),s=n(e=>e.archivedSessionIds),c=r(e=>e);return a.flatMap(e=>{let t=o.byId[e.sessionId];return t===void 0||t.blank||s.includes(e.sessionId)?[]:[{visit:e,summary:t,statuses:Mg(Nh(t,o,c),i)}]})}function Rg(e){let{useRecentNavigationSettings:t,open:n,close:i,closeAll:a,viewport:c,restoreNavigationFocus:l,renderSlot:u,t:d}=e,f=t(e=>e.value?.showRecentVisits??!0),p=Lg(e),m=f&&p.length>0,h=(0,s.useRef)(null),[g,_]=(0,s.useState)(!1),v=(0,s.useCallback)((e=h.current)=>{e?.isConnected&&e.clientWidth>0&&(c.scrollLeft=Math.max(0,Math.min(e.scrollLeft,e.scrollWidth-e.clientWidth)))},[c]);return(0,s.useLayoutEffect)(()=>{let e=h.current;if(e===null)return;e.scrollLeft=c.scrollLeft;let t=e.clientWidth,n=new ResizeObserver(()=>{e.clientWidth!==t&&(t=e.clientWidth,e.scrollLeft=c.scrollLeft)});return n.observe(e),()=>{v(e),n.disconnect()}},[m,c,v]),m?/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsxs)(`nav`,{ref:h,className:Ig.shortcuts,"aria-label":d(`recent.navigation`),onScroll:e=>v(e.currentTarget),children:[p.map(({visit:t,summary:r,statuses:a})=>/* @__PURE__ */ (0,o.jsx)(Ag,{visit:t,summary:r,identity:u(`workspace.recent.shortcut.identity`,{sessionId:t.sessionId}),activityLabel:a[0].state===`idle`?void 0:a.map(e=>e.label).join(` · `),activity:a[0].state===`idle`?null:/* @__PURE__ */ (0,o.jsx)(Pg,{statuses:a}),active:e.sessionId===t.sessionId,closeLabel:d(`recent.close`,{name:r.displayTitle}),closeHint:d(`recent.closeHint`),open:e=>{v(),n(e)},close:e=>{v();try{i(e)}catch{_(!0)}},restoreNavigationFocus:l},t.sessionId)),p.length>=3&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Ig.clear,"aria-label":d(`recent.clearAll`),title:d(`recent.clearAllHint`),onMouseDown:e=>e.preventDefault(),onClick:()=>{l();try{a()}catch{_(!0)}},children:d(`recent.clear`)})]}),g&&/* @__PURE__ */ (0,o.jsx)(r.Toast,{text:d(`recent.closeFailed`),onDone:()=>_(!1)})]}):null}function zg(e){let{useRecentNavigationSettings:t,setEnabled:n,t:i}=e,a=t(e=>e.value?.showRecentVisits??!0),c=Lg(e),[l,u]=(0,s.useState)(!1),[d,f]=(0,s.useState)(!1),p=(0,s.useRef)(!1);return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[c.length>0&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,"data-navigation-focus-return":!0,className:Ig.trigger,"aria-label":i(a?`recent.collapse`:`recent.expand`),"aria-expanded":a,"aria-disabled":l||void 0,"aria-busy":l||void 0,onClick:()=>{p.current||(p.current=!0,u(!0),f(!1),n(!a).then(e=>f(!e)).catch(()=>f(!0)).finally(()=>{p.current=!1,u(!1)}))},children:/* @__PURE__ */ (0,o.jsx)(r.IconChevronDownOutlineRegular,{size:14,className:a?Ig.expanded:void 0})}),d&&/* @__PURE__ */ (0,o.jsx)(r.Toast,{text:i(`recent.settings.error`),onDone:()=>f(!1)})]})}function Bg(e){return e==null}function Vg(e){return e&&typeof e==`object`&&!Array.isArray(e)}function Hg(e,t){return Object.fromEntries(Object.entries(e).filter(([e,n])=>t(e,n)))}function Ug(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n,e)]))}function Wg(e,t,n){if(!t)return{...e};let r={};for(let i of t)(n||e[i]!==void 0)&&(r[i]=e[i]);return r}let Gg=Symbol.for(`cosmokit.volatile.write`);function Kg(e,t=/* @__PURE__ */ new Set){if(typeof e==`function`)throw TypeError(`volatile config cannot contain functions`);if(typeof e!=`object`||!e)return e;if(t.has(e))throw TypeError(`volatile config cannot contain cycles`);t.add(e);try{if(Array.isArray(e))return Object.freeze(e.map(e=>Kg(e,t)));if(Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw TypeError(`volatile config objects must be plain objects or arrays`);return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,n])=>[e,Kg(n,t)])))}finally{t.delete(e)}}function qg(e){let t=Kg(e);return Object.freeze({get:()=>t,[Gg]:e=>{t=e}})}function Jg(e){return typeof e==`object`&&!!e&&Gg in e}function Yg(e,t){return arguments.length===1?t=>Yg(e,t):e in globalThis&&t instanceof globalThis[e]||Object.prototype.toString.call(t).slice(8,-1)===e}function Xg(e){return Yg(`ArrayBuffer`,e)||Yg(`SharedArrayBuffer`,e)}function Zg(e){return Xg(e)||ArrayBuffer.isView(e)}let Qg;(function(e){e.is=Xg,e.isSource=Zg;function t(e){return ArrayBuffer.isView(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e}e.fromSource=t;function n(e){if(e=t(e),typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let n=``,r=new Uint8Array(e);for(let e=0;e<r.byteLength;e++)n+=String.fromCharCode(r[e]);return btoa(n)}e.toBase64=n;function r(e){return typeof Buffer<`u`?t(Buffer.from(e,`base64`)):Uint8Array.from(atob(e),e=>e.charCodeAt(0))}e.fromBase64=r;function i(e){return e=t(e),typeof Buffer<`u`?Buffer.from(e).toString(`hex`):Array.from(new Uint8Array(e),e=>e.toString(16).padStart(2,`0`)).join(``)}e.toHex=i;function a(e){if(typeof Buffer<`u`)return t(Buffer.from(e,`hex`));let n=e.length%2==0?e:e.slice(0,e.length-1),r=[];for(let e=0;e<n.length;e+=2)r.push(parseInt(`${n[e]}${n[e+1]}`,16));return Uint8Array.from(r).buffer}e.fromHex=a})(Qg||={}),Qg.fromBase64,Qg.toBase64,Qg.fromHex,Qg.toHex;function $g(e,t=/* @__PURE__ */ new Map){if(!e||typeof e!=`object`)return e;if(Yg(`Date`,e))return new Date(e.valueOf());if(Yg(`RegExp`,e))return new RegExp(e.source,e.flags);if(Xg(e))return e.slice(0);if(ArrayBuffer.isView(e))return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);let n=t.get(e);if(n)return n;if(Array.isArray(e)){let n=[];return t.set(e,n),e.forEach((e,r)=>{n[r]=Reflect.apply($g,null,[e,t])}),n}let r=Object.create(Object.getPrototypeOf(e));t.set(e,r);for(let n of Reflect.ownKeys(e)){let i={...Reflect.getOwnPropertyDescriptor(e,n)};`value`in i&&(i.value=Reflect.apply($g,null,[i.value,t])),Reflect.defineProperty(r,n,i)}return r}function e_(e,t,n){let r=/* @__PURE__ */ new Set;function i(e,t){if(e===t)return!0;if(Jg(e)||Jg(t))return Jg(e)&&Jg(t);if(!n&&Bg(e)&&Bg(t))return!0;if(typeof e!=typeof t||typeof e!=`object`||!e||!t||r.has(e))return!1;function a(n,r){return n(e)?n(t)?r(e,t):!1:!n(t)&&void 0}r.add(e);try{return a(Array.isArray,(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!i(e[n],t[n]))return!1;return!0})??a(Yg(`Date`),(e,t)=>e.valueOf()===t.valueOf())??a(Yg(`URL`),(e,t)=>e.href===t.href)??a(Yg(`RegExp`),(e,t)=>e.source===t.source&&e.flags===t.flags)??a(Xg,(e,t)=>{if(e.byteLength!==t.byteLength)return!1;let n=new Uint8Array(e),r=new Uint8Array(t);for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0})??((!n||[e,t].every(e=>Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null))&&Object.keys({...e,...t}).every(n=>i(e[n],t[n])))}finally{r.delete(e)}}return i(e,t)}let t_;(function(e){e.millisecond=1;let t=e.second=1e3,n=e.minute=t*60,r=e.hour=n*60,i=e.day=r*24,a=e.week=i*7,o=(/* @__PURE__ */ new Date()).getTimezoneOffset();function s(e){o=e}e.setTimezoneOffset=s;function c(){return o}e.getTimezoneOffset=c;function l(e=/* @__PURE__ */ new Date,t){return typeof e==`number`&&(e=new Date(e)),t===void 0&&(t=o),Math.floor((e.valueOf()/n-t)/1440)}e.getDateNumber=l;function u(e,t){let r=new Date(e*i);return t===void 0&&(t=o),new Date(+r+t*n)}e.fromDateNumber=u;let d=RegExp(`^${[`w(?:eek(?:s)?)?`,`d(?:ay(?:s)?)?`,`h(?:our(?:s)?)?`,`m(?:in(?:ute)?(?:s)?)?`,`s(?:ec(?:ond)?(?:s)?)?`].map(e=>`(\\d+(?:\\.\\d+)?${e})?`).join(``)}$`);function f(e){let o=d.exec(e);return o?(parseFloat(o[1])*a||0)+(parseFloat(o[2])*i||0)+(parseFloat(o[3])*r||0)+(parseFloat(o[4])*n||0)+(parseFloat(o[5])*t||0):0}e.parseTime=f;function p(e){let t=f(e);return t?e=Date.now()+t:/^\d{1,2}(:\d{1,2}){1,2}$/.test(e)?e=`${(/* @__PURE__ */ new Date()).toLocaleDateString()}-${e}`:/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(e)&&(e=`${(/* @__PURE__ */ new Date()).getFullYear()}-${e}`),e?new Date(e):/* @__PURE__ */ new Date}e.parseDate=p;function m(e){let a=Math.abs(e);return a>=i-r/2?Math.round(e/i)+`d`:a>=r-n/2?Math.round(e/r)+`h`:a>=n-t/2?Math.round(e/n)+`m`:a>=t?Math.round(e/t)+`s`:e+`ms`}e.format=m;function h(e,t=2){return e.toString().padStart(t,`0`)}e.toDigits=h;function g(e,t=/* @__PURE__ */ new Date){return e.replace(`yyyy`,t.getFullYear().toString()).replace(`yy`,t.getFullYear().toString().slice(2)).replace(`MM`,h(t.getMonth()+1)).replace(`dd`,h(t.getDate())).replace(`hh`,h(t.getHours())).replace(`mm`,h(t.getMinutes())).replace(`ss`,h(t.getSeconds())).replace(`SSS`,h(t.getMilliseconds(),3))}e.template=g})(t_||={});let n_=Symbol.for(`schemastery`),r_=Symbol.for(`ValidationError`);globalThis.__schemastery_index__??=0,globalThis.__schemastery_refs__=void 0;var i_=class extends TypeError{options;name=`ValidationError`;constructor(e,t){let n=`$`;for(let e of t.path||[])typeof e==`string`?n+=`.`+e:typeof e==`number`?n+=`[`+e+`]`:typeof e==`symbol`&&(n+=`[Symbol(${e.toString()})]`);n.startsWith(`.`)&&(n=n.slice(1)),super((n===`$`?``:`${n} `)+e),this.options=t}static is(e){return!!e?.[r_]}};Object.defineProperty(i_.prototype,r_,{value:!0});let Y=function(e){let t=function(e,n={}){return Y.resolve(e,t,n)[0]};if(e.refs){let t=Ug(e.refs,e=>new Y(e)),n=e=>t[e];for(let e in t){let r=t[e];r.sKey=n(r.sKey),r.inner=n(r.inner),r.list=r.list&&r.list.map(n),r.dict=r.dict&&Ug(r.dict,n)}return t[e.uid]}if(Object.assign(t,e),typeof t.callback==`string`)try{t.callback=Function(`return `+t.callback)()}catch{}return Object.defineProperty(t,"uid",{value:globalThis.__schemastery_index__++}),Object.setPrototypeOf(t,Y.prototype),t.meta||={},t.toString=t.toString.bind(t),t};Y.prototype=Object.create(Function.prototype),Y.prototype[n_]=!0,Object.defineProperty(Y.prototype,"~standard",{get(){return{version:1,vendor:`schemastery`,validate:e=>{try{return{value:Y.resolve(e,this,{})[0]}}catch(e){if(i_.is(e))return{issues:[{message:e.message,path:e.options.path}]};throw e}}}}}),Y.ValidationError=i_,Y.prototype.toJSON=function(){if(globalThis.__schemastery_refs__)return globalThis.__schemastery_refs__[this.uid]??=JSON.parse(JSON.stringify({...this})),this.uid;globalThis.__schemastery_refs__={[this.uid]:{...this}},globalThis.__schemastery_refs__[this.uid]=JSON.parse(JSON.stringify({...this}));let e={uid:this.uid,refs:globalThis.__schemastery_refs__};return globalThis.__schemastery_refs__=void 0,e},Y.prototype.set=function(e,t){return this.dict[e]=t,this},Y.prototype.push=function(e){return this.list.push(e),this};function a_(e,t){let n=typeof e==`string`?{"":e}:{...e};for(let e in t){let r=t[e];r?.$description||r?.$desc?n[e]=r.$description||r.$desc:typeof r==`string`&&(n[e]=r)}return n}function o_(e){return e?.$value??e?.$inner}function s_(e){return Hg(e??{},e=>!e.startsWith(`$`))}Y.prototype.i18n=function(e){let t=Y(this),n=a_(t.meta.description,e);return Object.keys(n).length&&(t.meta.description=n),t.dict&&=Ug(t.dict,(t,n)=>t.i18n(Ug(e,e=>o_(e)?.[n]??e?.[n]))),t.list&&=t.list.map((t,n)=>t.i18n(Ug(e,(e={})=>Array.isArray(o_(e))?o_(e)[n]:Array.isArray(e)?e[n]:s_(e)))),t.inner&&=t.inner.i18n(Ug(e,e=>o_(e)?o_(e):s_(e))),t.sKey&&=t.sKey.i18n(Ug(e,e=>e?.$key)),t},Y.prototype.extra=function(e,t){let n=Y(this);return n.meta={...n.meta,[e]:t},n};for(let e of[`required`,`disabled`,`collapse`,`hidden`,`loose`])Object.assign(Y.prototype,{[e](t=!0){let n=Y(this);return n.meta={...n.meta,[e]:t},n}});Y.prototype.deprecated=function(){let e=Y(this);return e.meta.badges||=[],e.meta.badges.push({text:`deprecated`,type:`danger`}),e},Y.prototype.experimental=function(){let e=Y(this);return e.meta.badges||=[],e.meta.badges.push({text:`experimental`,type:`warning`}),e},Y.prototype.pattern=function(e){let t=Y(this),n=Wg(e,[`source`,`flags`]);return t.meta={...t.meta,pattern:n},t},Y.prototype.simplify=function(e){if(Jg(e)&&(e=e.get()),e_(e,this.meta.default,this.type===`dict`))return null;if(Bg(e))return e;if(this.type===`object`||this.type===`dict`){let t={};for(let n in e){let r=(this.type===`object`?this.dict[n]:this.inner)?.simplify(e[n]);(this.type===`dict`||!Bg(r))&&(t[n]=r)}return e_(t,this.meta.default,this.type===`dict`)?null:t}if(this.type===`array`||this.type===`tuple`){let t=[];return e.forEach((e,n)=>{let r=this.type===`array`?this.inner:this.list[n],i=r?r.simplify(e):e;t.push(i)}),t}if(this.type===`intersect`){let t={};for(let n of this.list)Object.assign(t,n.simplify(e));return t}if(this.type===`union`)for(let t of this.list)try{return Y.resolve(e,t,{}),t.simplify(e)}catch{}return e},Y.prototype.toString=function(e){return g_[this.type]?.(this,e)??`Schema<${this.type}>`},Y.prototype.role=function(e,t){let n=Y(this);return n.meta={...n.meta,role:e,extra:t},n};for(let e of[`default`,`link`,`comment`,`description`,`max`,`min`,`step`])Object.assign(Y.prototype,{[e](t){let n=Y(this);return n.meta={...n.meta,[e]:t},n}});Y.prototype.volatile=function(){if(this.meta.volatile)throw TypeError(`volatile schema is already wrapped`);return this.extra(`volatile`,!0)};let c_={},l_=Symbol(`checked-volatile-schema`);function u_(e,t=[],n=!1,r=/* @__PURE__ */ new Map){let i=r.get(e)??/* @__PURE__ */ new Set;if(i.has(n))return;if(i.add(n),r.set(e,i),e.meta?.volatile&&n)throw new i_(`volatile fields require a fixed object path without an enclosing volatile field`,{path:t});let a=n||!!e.meta?.volatile;if(e.dict)for(let[n,i]of Object.entries(e.dict))u_(i,[...t,n],a,r);if(e.sKey&&u_(e.sKey,[...t,`<key>`],!0,r),e.inner&&(e.type!==`lazy`||e.inner[n_])&&u_(e.inner,[...t,`*`],!0,r),e.list)for(let n=0;n<e.list.length;n++)u_(e.list[n],[...t,String(n)],!0,r)}Y.extend=function(e,t){c_[e]=t},Y.resolve=function(e,t,n={},r=!1){if(!t)return[e];if(n[l_]||(u_(t,n.path),n={...n,[l_]:!0}),t.meta?.volatile){let i=Y(t);i.meta={...t.meta,volatile:!1};let[a,o]=Y.resolve(e,i,n,r);try{return[qg(a),o]}catch(e){throw new i_(e instanceof Error?e.message:String(e),n)}}if(n.ignore?.(e,t))return[e];if(Bg(e)&&t.type!==`lazy`){if(t.meta.required)throw new i_(`missing required value`,n);let r=t,i=t.meta.default;for(;r?.type===`intersect`&&Bg(i);)r=r.list[0],i=r?.meta.default;if(Bg(i))return[e];e=$g(i)}let i=c_[t.type];if(!i)throw new i_(`unsupported type "${t.type}"`,n);try{return i(e,t,n,r)}catch(e){if(!t.meta.loose)throw e;return[t.meta.default]}},Y.from=function(e){if(Bg(e))return Y.any();if([`string`,`number`,`boolean`].includes(typeof e))return Y.const(e).required();if(e[n_])return e;if(typeof e==`function`)switch(e){case String:return Y.string().required();case Number:return Y.number().required();case Boolean:return Y.boolean().required();case Function:return Y.function().required();default:return Y.is(e).required()}else throw TypeError(`cannot infer schema from ${e}`)},Y.lazy=function(e){let t=new Y({type:`lazy`,builder:e,inner:{toJSON:()=>(t.inner[n_]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta}),t.inner.toJSON())}});return t},Y.natural=function(){return Y.number().step(1).min(0)},Y.percent=function(){return Y.number().step(.01).min(0).max(1).role(`slider`)},Y.date=function(){return Y.union([Y.is(Date),Y.transform(Y.string().role(`datetime`),(e,t)=>{let n=new Date(e);if(isNaN(+n))throw new i_(`invalid date "${e}"`,t);return n},!0)])},Y.regExp=function(e=``){return Y.union([Y.is(RegExp),Y.transform(Y.string().role(`regexp`,{flag:e}),(t,n)=>{try{return new RegExp(t,e)}catch(e){throw new i_(e.message,n)}},!0)])},Y.arrayBuffer=function(e){return Y.union([Y.is(ArrayBuffer),Y.is(SharedArrayBuffer),Y.transform(Y.any(),(e,t)=>{if(Qg.isSource(e))return Qg.fromSource(e);throw new i_(`expected ArrayBufferSource but got ${e}`,t)},!0),...e?[Y.transform(Y.string(),(t,n)=>{try{return e===`base64`?Qg.fromBase64(t):Qg.fromHex(t)}catch(e){throw new i_(e.message,n)}},!0)]:[]])},Y.extend(`lazy`,(e,t,n,r)=>(t.inner[n_]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta},u_(t.inner,n.path,!0)),Y.resolve(e,t.inner,n,r))),Y.extend(`any`,e=>[e]),Y.extend(`never`,(e,t,n)=>{throw new i_(`expected nullable but got ${e}`,n)}),Y.extend(`const`,(e,{value:t},n)=>{if(e_(e,t))return[t];throw new i_(`expected ${t} but got ${e}`,n)});function d_(e,t,n,r,i=!1){let{max:a=1/0,min:o=-1/0}=t;if(e>a)throw new i_(`expected ${n} <= ${a} but got ${e}`,r);if(e<o&&!i)throw new i_(`expected ${n} >= ${o} but got ${e}`,r)}Y.extend(`string`,(e,{meta:t},n)=>{if(typeof e!=`string`)throw new i_(`expected string but got ${e}`,n);if(t.pattern){let r=new RegExp(t.pattern.source,t.pattern.flags);if(!r.test(e))throw new i_(`expect string to match regexp ${r}`,n)}return d_(e.length,t,`string length`,n),[e]});function f_(e,t){let n=e.toString();if(n.includes(`e`))return e*10**t;let r=n.indexOf(`.`);if(r===-1)return e*10**t;let i=n.slice(r+1),a=n.slice(0,r);return i.length<=t?+(a+i.padEnd(t,`0`)):+(a+i.slice(0,t)+`.`+i.slice(t))}function p_(e,t,n){if(n=Math.abs(n),!/^\d+\.\d+$/.test(n.toString()))return(e-t)%n===0;let r=n.toString().indexOf(`.`),i=n.toString().slice(r+1).length;return Math.abs(f_(e,i)-f_(t,i))%f_(n,i)===0}Y.extend(`number`,(e,{meta:t},n)=>{if(typeof e!=`number`)throw new i_(`expected number but got ${e}`,n);d_(e,t,`number`,n);let{step:r}=t;if(r&&!p_(e,t.min??0,r))throw new i_(`expected number multiple of ${r} but got ${e}`,n);return[e]}),Y.extend(`boolean`,(e,t,n)=>{if(typeof e==`boolean`)return[e];throw new i_(`expected boolean but got ${e}`,n)}),Y.extend(`bitset`,(e,{bits:t,meta:n},r)=>{let i=0,a=[];if(typeof e==`number`){i=e;for(let n in t)e&t[n]&&a.push(n)}else if(Array.isArray(e)){a=e;for(let e of a){if(typeof e!=`string`)throw new i_(`expected string but got ${e}`,r);e in t&&(i|=t[e])}}else throw new i_(`expected number or array but got ${e}`,r);return i===n.default?[i]:[i,a]}),Y.extend(`function`,(e,t,n)=>{if(typeof e==`function`)return[e];throw new i_(`expected function but got ${e}`,n)}),Y.extend(`is`,(e,{constructor:t},n)=>{if(typeof t==`function`){if(e instanceof t)return[e];throw new i_(`expected ${t.name} but got ${e}`,n)}{if(Bg(e))throw new i_(`expected ${t} but got ${e}`,n);let r=Object.getPrototypeOf(e);for(;r;){if(r.constructor?.name===t)return[e];r=Object.getPrototypeOf(r)}throw new i_(`expected ${t} but got ${e}`,n)}});function m_(e,t,n,r){try{let[i,a]=Y.resolve(e[t],n,{...r,path:[...r.path||[],t]});return a!==void 0&&(e[t]=a),i}catch(i){if(!r?.autofix)throw i;return delete e[t],n.meta.volatile?qg(n.meta.default):n.meta.default}}Y.extend(`array`,(e,{inner:t,meta:n},r)=>{if(!Array.isArray(e))throw new i_(`expected array but got ${e}`,r);return d_(e.length,n,`array length`,r,!Bg(t.meta.default)),[e.map((n,i)=>m_(e,i,t,r))]}),Y.extend(`dict`,(e,{inner:t,sKey:n},r,i)=>{if(!Vg(e))throw new i_(`expected object but got ${e}`,r);let a={};for(let o in e){let s;try{s=Y.resolve(o,n,r)[0]}catch(e){if(i)continue;throw e}a[s]=m_(e,o,t,r),e[s]=e[o],o!==s&&delete e[o]}return[a]}),Y.extend(`tuple`,(e,{list:t},n,r)=>{if(!Array.isArray(e))throw new i_(`expected array but got ${e}`,n);let i=t.map((t,r)=>m_(e,r,t,n));return r||i.push(...e.slice(t.length)),[i]});function h_(e,t){for(let n in t)n in e||(e[n]=t[n])}Y.extend(`object`,(e,{dict:t},n,r)=>{if(!Vg(e))throw new i_(`expected object but got ${e}`,n);let i={};for(let r in t){let a=m_(e,r,t[r],n);(!Bg(a)||r in e)&&(i[r]=a)}return r||h_(i,e),[i]}),Y.extend(`union`,(e,{list:t,toString:n},r,i)=>{let a=[];for(let n of t)try{return Y.resolve(e,n,r,i)}catch(e){a.push(e)}throw new i_(`expected ${n()} but got ${JSON.stringify(e)}`,r)}),Y.extend(`intersect`,(e,{list:t,toString:n},r,i)=>{if(!t.length)return[e];let a;for(let i of t){let t=Y.resolve(e,i,r,!0)[0];if(!Bg(t)){if(Bg(a))a=t;else if(typeof a!=typeof t)throw new i_(`expected ${n()} but got ${JSON.stringify(e)}`,r);else if(typeof t==`object`)h_(a??={},t);else if(a!==t)throw new i_(`expected ${n()} but got ${JSON.stringify(e)}`,r)}}return!i&&Vg(e)&&h_(a,e),[a]}),Y.extend(`transform`,(e,{inner:t,callback:n,preserve:r},i)=>{let[a,o=e]=Y.resolve(e,t,i,!0);return r?[n(a)]:[n(a),n(o)]});let g_={};function __(e,t,n){g_[e]=n,Object.assign(Y,{[e](...n){let r=new Y({type:e});return t.forEach((e,t)=>{switch(e){case`sKey`:r.sKey=n[t]??Y.string();break;case`inner`:r.inner=Y.from(n[t]);break;case`list`:r.list=n[t].map(Y.from);break;case`dict`:r.dict=Ug(n[t],Y.from);break;case`bits`:r.bits={};for(let e in n[t])typeof n[t][e]==`number`&&(r.bits[e]=n[t][e]);break;case`callback`:{let e=r.callback=n[t];e.toJSON||=()=>e.toString();break}case`constructor`:{let e=r.constructor=n[t];typeof e==`function`&&(e.toJSON||=()=>e.name);break}default:r[e]=n[t]}}),e===`object`||e===`dict`?r.meta.default={}:e===`array`||e===`tuple`?r.meta.default=[]:e===`bitset`&&(r.meta.default=0),r}})}__(`is`,[`constructor`],({constructor:e})=>typeof e==`function`?e.name:e),__(`any`,[],()=>`any`),__(`never`,[],()=>`never`),__(`const`,[`value`],({value:e})=>typeof e==`string`?JSON.stringify(e):e),__(`string`,[],()=>`string`),__(`number`,[],()=>`number`),__(`boolean`,[],()=>`boolean`),__(`bitset`,[`bits`],()=>`bitset`),__(`function`,[],()=>`function`),__(`array`,[`inner`],({inner:e})=>`${e.toString(!0)}[]`),__(`dict`,[`inner`,`sKey`],({inner:e,sKey:t})=>`{ [key: ${t.toString()}]: ${e.toString()} }`),__(`tuple`,[`list`],({list:e})=>`[${e.map(e=>e.toString()).join(`, `)}]`),__(`object`,[`dict`],({dict:e})=>Object.keys(e).length===0?`{}`:`{ ${Object.entries(e).map(([e,t])=>`${e}${t.meta.required?``:`?`}: ${t.toString()}`).join(`, `)} }`),__(`union`,[`list`],({list:e},t)=>{let n=e.map(({toString:e})=>e()).join(` | `);return t?`(${n})`:n}),__(`intersect`,[`list`],({list:e})=>`${e.map(e=>e.toString(!0)).join(` & `)}`),__(`transform`,[`inner`,`callback`,`preserve`],({inner:e},t)=>e.toString(t));let v_=[0,15,30,60,120,240,1440],y_={showRecentVisits:!0,tabIdleTimeoutMinutes:60},b_={showRecentVisits:Y.boolean().default(!0),tabIdleTimeoutMinutes:Y.natural().max(1440).default(60)},x_=`@deepseek-ai/dsh-client-ui-workspace/RecentNavigationRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(x_)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=x_,e.textContent=`._0lPQtW_row{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px 16px;padding:16px 0;display:flex}._0lPQtW_text{flex:160px;min-width:0}._0lPQtW_timeoutRow{border-top:.5px solid var(--dsw-alias-border-l2)}._0lPQtW_menu{flex:none;margin-inline-start:auto}._0lPQtW_selector{background:var(--dsw-alias-bg-module-platform);min-width:96px;min-height:44px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;border:0;border-radius:8px;justify-content:space-between;align-items:center;gap:8px;padding:0 12px;font-size:14px;line-height:20px;display:inline-flex}._0lPQtW_selector:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:2px}._0lPQtW_selector:disabled{opacity:.5;cursor:not-allowed}@media (hover:hover){._0lPQtW_selector:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}}._0lPQtW_error{padding-bottom:12px;font-size:12px;line-height:18px}._0lPQtW_titleLine{flex-wrap:wrap;align-items:center;gap:8px;display:flex}._0lPQtW_title{font-size:14px;line-height:20px}._0lPQtW_description{color:var(--dsw-alias-label-secondary);margin-top:4px;font-size:12px;line-height:18px}`,document.head.appendChild(e)}var S_={description:`_0lPQtW_description`,error:`_0lPQtW_error`,menu:`_0lPQtW_menu`,row:`_0lPQtW_row`,selector:`_0lPQtW_selector`,text:`_0lPQtW_text`,timeoutRow:`_0lPQtW_timeoutRow`,title:`_0lPQtW_title`,titleLine:`_0lPQtW_titleLine`};function C_({usePreference:e,setEnabled:t,setIdleTimeout:n,t:i}){let a=e(e=>e.value),c=a?.showRecentVisits??!0,l=a?.tabIdleTimeoutMinutes??60,[u,d]=(0,s.useState)(!1),[f,p]=(0,s.useState)(!1),[m,h]=(0,s.useState)(!1),g=(0,s.useRef)(!1),_=(0,s.useId)();(0,s.useEffect)(()=>{c||d(!1)},[c]);let v=e=>e===0?i(`recent.timeout.off`):e>=120&&e%60==0?i(`recent.timeout.hours`,{n:e/60}):i(`recent.timeout.minutes`,{n:e}),y=e=>{g.current||(g.current=!0,d(!1),p(!0),h(!1),Promise.resolve().then(e).then(e=>h(!e)).catch(()=>h(!0)).finally(()=>{g.current=!1,p(!1)}))};return/* @__PURE__ */ (0,o.jsxs)(`div`,{children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:S_.row,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:S_.text,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:S_.titleLine,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:S_.title,children:i(`recent.settings.title`)}),/* @__PURE__ */ (0,o.jsx)(r.Tag,{tone:`neutral`,children:i(`recent.settings.mobile`)})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:S_.description,children:i(`recent.settings.description`)})]}),/* @__PURE__ */ (0,o.jsx)(r.Switch,{checked:c,disabled:f,label:`${i(`recent.settings.title`)} · ${i(`recent.settings.mobile`)}`,onChange:e=>y(()=>t(e))})]}),c&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:`${S_.row} ${S_.timeoutRow}`,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:S_.text,children:/* @__PURE__ */ (0,o.jsx)(`div`,{className:S_.title,id:`${_}-label`,children:i(`recent.timeout.title`)})}),/* @__PURE__ */ (0,o.jsx)(r.Menu,{className:S_.menu,open:u&&c&&!f,onClose:()=>d(!1),items:v_.map(e=>({id:String(e),label:e===60?i(`recent.timeout.default`,{value:v(e)}):v(e)})),selectedId:String(l),onSelect:e=>{let t=v_.find(t=>String(t)===e);t!==void 0&&y(()=>n(t))},align:`end`,portal:!0,anchor:/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:S_.selector,disabled:!c||f,"aria-labelledby":`${_}-label ${_}-value`,"aria-haspopup":`menu`,"aria-expanded":u&&c&&!f,onClick:()=>d(e=>!e),children:[/* @__PURE__ */ (0,o.jsx)(`span`,{id:`${_}-value`,children:v(l)}),/* @__PURE__ */ (0,o.jsx)(r.IconChevronDownOutlineRegular,{size:14})]})})]}),m&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:S_.error,role:`alert`,children:i(`recent.settings.error`)})]})}function w_(e,t,n){let r=e=>n.set(`showRecentVisits`,e),i=e=>n.set(`tabIdleTimeoutMinutes`,e),a={scrollLeft:0};e.inject([`uiSession`,`connection`,`sessions`,`workspaces`],e=>{e.effect(()=>{let r,i=!1,o=!1,s=!1,c=n.getSnapshot().value?.showRecentVisits,l=n.getSnapshot().value?.tabIdleTimeoutMinutes,u=()=>{r!==void 0&&clearTimeout(r),r=void 0},d=()=>{if(!s){if(i)o=!0;else{i=!0;try{do{o=!1,u();let i=n.getSnapshot().value;if(i===void 0||!i.showRecentVisits||i.tabIdleTimeoutMinutes<=0||document.visibilityState!==`visible`||e.connection.state.getSnapshot()!==`connected`||t.opening.getSnapshot().state===`loading`)continue;let{changed:c,nextDelayMs:l}=t.recentVisits.expireInactive(i.tabIdleTimeoutMinutes*6e4,e.uiSession.sessionStatus.getSnapshot());c&&t.recentVisits.entries.getSnapshot().length===0&&(a.scrollLeft=0),!s&&!o&&l!==void 0&&(r=setTimeout(d,Math.max(1,Math.min(l,6e4))))}while(o&&!s)}finally{i=!1}}}},f=[n.subscribe(()=>{let e=n.getSnapshot().value,t=e?.showRecentVisits,r=e?.tabIdleTimeoutMinutes;(t!==c||r!==l)&&(c=t,l=r,d())}),e.connection.state.subscribe(d),t.opening.subscribe(d),t.recentVisits.entries.subscribe(d),e.uiSession.sessionStatus.subscribe(d),e.sessions.list.subscribe(d),e.workspaces.list.subscribe(d)];return document.addEventListener(`visibilitychange`,d),window.addEventListener(`pageshow`,d),d(),()=>{s=!0,u();for(let e of f)e();document.removeEventListener(`visibilitychange`,d),window.removeEventListener(`pageshow`,d)}},`ui-workspace: idle session tabs`)});let o=()=>({hooks:{visits:t.recentVisits.entries,recentNavigationSettings:n},open:e=>t.openSession(e),close:e=>{t.closeSessionTab(e),t.recentVisits.entries.getSnapshot().length===0&&(a.scrollLeft=0)},closeAll:()=>{t.closeAllSessionTabs(),a.scrollLeft=0},viewport:a,setEnabled:r});e.slots.inject(`conversation.header.trailing`,()=>e.slots.register({name:`conversation.header.trailing`,locale:`workspace`,inject:()=>({startSession:()=>t.startSession(),hooks:{shortcuts:e.shortcuts.catalog}})},Dg)),e.slots.inject(`conversation.header.navigation`,()=>e.slots.register({name:`conversation.header.navigation`,locale:`workspace`,inject:o},zg)),e.slots.inject(`conversation.header.shortcuts`,()=>e.slots.register({name:`conversation.header.shortcuts`,locale:`workspace`,inject:o,children:{"workspace.recent.shortcut.identity":{kind:`list`,scope:`root`}}},Rg)),e.slots.inject(`settings.general.item`,()=>e.slots.register({name:`settings.general.item`,id:`workspace.recent-navigation`,order:12,locale:`workspace`,inject:()=>({hooks:{preference:n},setEnabled:r,setIdleTimeout:i})},C_))}let T_=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeStyle.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(T_)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=T_,e.textContent=`.GyPSUW_options{min-width:0;color:var(--dsw-alias-label-primary);flex-direction:column;align-items:flex-start;gap:8px;padding-block:6px;display:flex}.GyPSUW_settingsText{flex:240px}.GyPSUW_prompt{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-specific-sidebar-fill);color:var(--dsw-alias-label-primary);overflow-wrap:anywhere;border-radius:8px;min-width:0;margin:6px 2px 8px;padding:8px;font-size:12px;line-height:16px}.GyPSUW_promptHeading{justify-content:space-between;align-items:center;gap:8px;margin-bottom:8px;display:flex}.GyPSUW_promptHeading strong{font-weight:500}.GyPSUW_comparison{border:1px solid var(--dsw-alias-border-l2);border-radius:6px;grid-template-columns:repeat(2,minmax(0,1fr));display:grid}.GyPSUW_choice{appearance:none;min-width:0;color:inherit;font:inherit;text-align:start;cursor:pointer;background:0 0;border:0;border-radius:5px 0 0 5px;flex-direction:column;justify-content:flex-start;align-items:stretch;padding:8px 0 4px;display:flex;position:relative}.GyPSUW_choice+.GyPSUW_choice{border-inline-start:1px solid var(--dsw-alias-border-l2);border-radius:0 5px 5px 0}.GyPSUW_choice[aria-checked=true]{box-shadow:inset 0 0 0 1px var(--dsw-alias-state-business-primary)}.GyPSUW_choiceTitle{padding:0 8px 2px;font-size:12px;font-weight:500;display:block}.GyPSUW_choiceSubtitle{white-space:nowrap;text-overflow:ellipsis;color:var(--dsw-alias-label-secondary);padding:0 8px 6px;font-size:10px;line-height:16px;overflow:hidden}.GyPSUW_preview{pointer-events:none;user-select:none;grid-auto-rows:44px;min-width:0;display:grid;overflow:hidden}.GyPSUW_preview .GyPSUW_sampleRow{--dsh-thread-row-height:22px;--dsh-workspace-indent:0px;--dsh-thread-indent:0px;min-height:0;padding-inline:6px}.GyPSUW_preview [data-session-title]{margin-inline:7px 0;font-size:11px}.GyPSUW_preview .GyPSUW_sampleSummary{margin-block-end:0;padding:0 0 0 7px;font-size:9px;line-height:11px}.GyPSUW_sampleIcon{flex-shrink:0;width:14px;height:14px;display:inline-flex}.GyPSUW_hint{color:var(--dsw-alias-label-tertiary);margin:0 0 8px;font-size:11px;line-height:1.5}.GyPSUW_later{color:var(--dsw-alias-label-secondary);cursor:pointer;font:inherit;background:0 0;border:0;border-radius:4px;flex-shrink:0;padding:4px}.GyPSUW_choice:focus-visible,.GyPSUW_later:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}.GyPSUW_error{color:var(--dsw-alias-state-warn-primary);overflow-wrap:anywhere;flex-basis:100%;margin-top:6px;font-size:12px}@media (width<=639px){.GyPSUW_choiceTitle,.GyPSUW_choiceSubtitle{padding-inline:6px}.GyPSUW_preview [data-session-title]{font-size:10px}}@media (hover:none),(pointer:coarse){.GyPSUW_later{min-height:44px}}`,document.head.appendChild(e)}var E_={choice:`GyPSUW_choice`,choiceSubtitle:`GyPSUW_choiceSubtitle`,choiceTitle:`GyPSUW_choiceTitle`,comparison:`GyPSUW_comparison`,error:`GyPSUW_error`,hint:`GyPSUW_hint`,later:`GyPSUW_later`,options:`GyPSUW_options`,preview:`GyPSUW_preview`,prompt:`GyPSUW_prompt`,promptHeading:`GyPSUW_promptHeading`,sampleIcon:`GyPSUW_sampleIcon`,sampleRow:`GyPSUW_sampleRow`,sampleSummary:`GyPSUW_sampleSummary`,settingsText:`GyPSUW_settingsText`};let D_=[`summary`,`ring`];function O_(e){let[t,n]=(0,s.useState)(!1),[r,i]=(0,s.useState)(!1),a=(0,s.useRef)(!1);return{busy:t,failed:r,save:async t=>{if(a.current)return!1;a.current=!0,n(!0),i(!1);try{let n=await e(t);return i(!n),n}catch{return i(!0),!1}finally{a.current=!1,n(!1)}}}}function k_({style:e,setStyle:t,t:n,settings:i=!1}){let a=(0,s.useId)(),{busy:c,failed:l,save:u}=O_(t);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:i?r.preferenceRowStyles.row:E_.options,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:`${r.preferenceRowStyles.rowText} ${i?E_.settingsText:``}`,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:r.preferenceRowStyles.title,id:a,children:n(`threadTree.style.title`)}),i&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:r.preferenceRowStyles.description,id:`${a}-description`,children:n(`threadTree.style.description`)})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:r.preferenceRowStyles.choices,role:`radiogroup`,"aria-labelledby":a,"aria-describedby":i?`${a}-description`:void 0,"aria-busy":c,onKeyDown:e=>{if(![`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key))return;e.preventDefault(),e.stopPropagation();let t=[...e.currentTarget.querySelectorAll(`[role="radio"]`)],n=t.indexOf(e.target),r=e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowLeft`||e.key===`ArrowUp`?-1:1)+t.length)%t.length;t[r]?.focus(),t[r]?.click()},children:D_.map(t=>/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,role:`radio`,className:r.preferenceRowStyles.choice,"aria-checked":e===t,"aria-disabled":c,tabIndex:e===t?0:-1,onClick:()=>void u(t),children:n(`threadTree.style.${t}`)},t))}),l&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:E_.error,role:`alert`,children:n(`threadTree.style.error`)})]})}function A_({usePreference:e,setStyle:t,t:n}){let r=e(e=>e.value?.threadTreeCollapseStyle??`summary`);return/* @__PURE__ */ (0,o.jsx)(k_,{style:r,setStyle:t,t:n,settings:!0})}let j_={...y_,threadTreeCollapseStyle:`summary`},M_=Y.object({...b_,threadTreeCollapseStyle:Y.union([`summary`,`ring`]).default(`summary`)});function N_(e){return typeof e==`object`&&!!e&&Object.hasOwn(e,`threadTreeCollapseStyle`)}function P_(e){let t=e.configForms.registerBrowser(`ui-workspace`,M_.toJSON(),{...j_});return e.slots.inject(`settings.general.item`,()=>e.slots.register({name:`settings.general.item`,id:`workspace.thread-tree-style`,order:11.5,locale:`workspace`,inject:()=>({hooks:{preference:t},setStyle:e=>t.set(`threadTreeCollapseStyle`,e)})},A_)),t}function F_(e,t){return e!==void 0&&e.has(t)}function I_(e,t,n,r={}){if(n===void 0||t===n)return!1;let i=e.find(e=>e.workspaceId===t),a=e.find(e=>e.workspaceId===n);return!(i===void 0||a===void 0||F_(r.sectionOf,t)||F_(r.sectionOf,n)||r.parents!==void 0&&r.parents.get(t)!==r.parents.get(n))}function L_(e,t,n,r={}){if(!I_(e,t,n.id,r))return null;let i=r.parents?.get(t),a=e.filter(e=>!F_(r.sectionOf,e.workspaceId)&&r.parents?.get(e.workspaceId)===i),o=a.findIndex(e=>e.workspaceId===n.id),s=a.findIndex(e=>e.workspaceId===t);if(o===-1||s===-1)return null;let c=n.half===`before`?n.id:a[o+1]?.workspaceId;if(c===t)return null;let l=c===void 0?a.length:a.findIndex(e=>e.workspaceId===c);return l===s||l===s+1?null:{beforeWorkspaceId:c}}function R_(e,t){let n=/* @__PURE__ */ new Map;for(let t of e)for(let e of t.workspaceIds??[])n.has(e)||n.set(e,t.id);let r=new Map(n);for(let e of t)r.set(e,Gh);return{nativeSectionOf:n,sectionOf:r}}function z_(e,t,n,r){if(!t)return/* @__PURE__ */ new Map;let i=e=>`${e.remote?.hostId??`local`}\n${n.get(e.workspaceId)??``}`,a=/* @__PURE__ */ new Map;for(let t of e){let e=i(t),n=a.get(e)??/* @__PURE__ */ new Map;t.path&&n.set(t.path,t.workspaceId),a.set(e,n)}return new Map(e.map(e=>{if(r.has(e.workspaceId))return[e.workspaceId,void 0];let t=a.get(i(e)),n=Uh(e.path,[...t?.keys()??[]]);return[e.workspaceId,n===void 0?void 0:t?.get(n)]}))}function B_(e,t,n,r){let i=new Map(e.map(e=>[e.key,e]));return{pinnedGroups:n.flatMap(e=>i.get(e)??[]),sectionRoots:new Map(t.map(e=>[e.id,(e.workspaceIds??[]).flatMap(t=>{let n=i.get(t);return n!==void 0&&r.get(t)===e.id?[n]:[]})])),workspaceRoots:e.filter(e=>e.key!==``&&!r.has(e.key))}}function V_(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=V_(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function X(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=V_(e))&&(r&&(r+=` `),r+=t);return r}function H_(e,t){return e===`default-workspace`?t:e}let U_=`@deepseek-ai/dsh-client-ui-workspace/WorkspaceBrowser.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(U_)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=U_,e.textContent=`._14DcuW_root{--dsh-session-list-edge-inset:var(--dsh-sidebar-inline-padding);--dsh-session-list-scrollbar-width:5px;--dsh-session-list-scrollbar-offset:2px;box-sizing:border-box;min-height:0;padding-right:var(--dsh-session-list-edge-inset);flex-direction:column;flex:1;display:flex}[data-phone-drawer] ._14DcuW_root{--dsh-session-list-scrollbar-width:0px}[data-phone-drawer] ._14DcuW_list{scrollbar-gutter:auto}._14DcuW_root._14DcuW_rail{padding-right:0}._14DcuW_iconButton{isolation:isolate;corner-shape:round;cursor:pointer;width:28px;height:28px;color:color-mix(in srgb, var(--dsw-alias-label-secondary) 82%, transparent);background:0 0;border:none;border-radius:50%;flex:none;justify-content:center;align-items:center;padding:0;transition:color .14s;display:inline-flex;position:relative}._14DcuW_iconButton:before,._14DcuW_searchButton:before{content:"";corner-shape:round;pointer-events:none;z-index:-1;background:0 0;border-radius:50%;width:28px;height:28px;margin:auto;transition:background-color .14s;position:absolute;inset:0}._14DcuW_iconButton:focus-visible,._14DcuW_searchButton:focus-visible,._14DcuW_clearButton:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}._14DcuW_iconButton:hover{color:var(--dsw-alias-label-primary)}._14DcuW_iconButton:hover:before{background:var(--dsw-alias-interactive-bg-hover)}._14DcuW_activityButton{position:relative}._14DcuW_activityButtonActive{color:var(--dsw-alias-state-business-primary)}._14DcuW_activityButtonActive:before{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 12%, transparent)}._14DcuW_activityButtonActive:hover{color:var(--dsw-alias-state-business-primary)}._14DcuW_activityButtonActive:hover:before{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 18%, transparent)}._14DcuW_activityIconWrap{justify-content:center;align-items:center;width:16px;height:16px;display:inline-flex;position:relative}._14DcuW_activityDot{background:var(--dsw-alias-state-business-primary);width:5.5px;height:5.5px;box-shadow:0 0 0 1.5px var(--dsw-specific-sidebar-fill);pointer-events:none;border-radius:50%;position:absolute;top:-2px;right:-2px}._14DcuW_activityDot[data-attention=pending]{background:var(--dsw-alias-state-warn-primary)}._14DcuW_viewOptionsMenu{min-width:200px}._14DcuW_sectionHeader{box-sizing:border-box;height:36px;color:var(--dsw-alias-label-tertiary);border-radius:6px;flex:none;justify-content:flex-end;align-items:center;gap:4px;margin-bottom:6px;padding-left:4px;display:flex;overflow:hidden}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader{margin-top:2px;margin-bottom:4px;margin-right:-4px}._14DcuW_sectionLabel{white-space:nowrap;opacity:1;visibility:visible;min-width:0;max-width:45%;transition:max-width .18s var(--ds-ease-in-out), margin-right .18s var(--ds-ease-in-out), opacity .12s var(--ds-ease-in-out), transform .18s var(--ds-ease-in-out), visibility 0s linear;flex:none;font-size:14px;font-weight:500;line-height:21px;overflow:hidden}._14DcuW_sectionLabelHidden{opacity:0;visibility:hidden;max-width:0;margin-right:-4px;transition-delay:0s,0s,0s,0s,.18s;transform:translate(-4px)}._14DcuW_activitySlot{opacity:1;visibility:visible;max-width:28px;transition:max-width .18s var(--ds-ease-in-out), margin-right .18s var(--ds-ease-in-out), opacity .12s var(--ds-ease-in-out), transform .18s var(--ds-ease-in-out), visibility 0s linear;flex:none;align-items:center;margin-left:auto;display:flex;overflow:hidden}._14DcuW_activitySlotHidden{opacity:0;visibility:hidden;pointer-events:none;max-width:0;margin-left:0;margin-right:-4px;transition-delay:0s,0s,0s,0s,.18s;transform:translate(-4px)}._14DcuW_searchSlot{box-sizing:border-box;min-width:0;max-width:28px;transition:max-width .18s var(--ds-ease-in-out), padding-left .18s var(--ds-ease-in-out);flex:1;align-items:center;padding-left:0;display:flex}._14DcuW_searchSlotExpanded{max-width:100%;padding-left:0}._14DcuW_headerActions{opacity:1;visibility:visible;max-width:96px;transition:max-width .18s var(--ds-ease-in-out), opacity .12s var(--ds-ease-in-out), transform .18s var(--ds-ease-in-out), visibility 0s linear;flex:none;align-items:center;gap:4px;display:flex;overflow:hidden}._14DcuW_headerActionsHidden{opacity:0;visibility:hidden;pointer-events:none;max-width:0;transition-delay:0s,0s,0s,.18s;transform:translate(4px)}._14DcuW_search{box-sizing:border-box;border-radius:var(--dsw-radius-sm);cursor:text;width:100%;height:28px;color:var(--dsw-alias-label-secondary);transition:width .18s var(--ds-ease-in-out), padding .18s var(--ds-ease-in-out), border-color .18s var(--ds-ease-in-out), background-color .18s var(--ds-ease-in-out);background:0 0;border:none;flex:none;align-items:center;gap:0;margin:0;padding:0;display:flex;overflow:hidden}._14DcuW_searchExpanded{border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);width:calc(100% + 4px);height:30px;color:var(--dsw-alias-label-caption);background:0 0;margin-inline:-2px;padding:0 4px 0 0}._14DcuW_searchButton{isolation:isolate;corner-shape:round;cursor:pointer;width:28px;height:28px;color:color-mix(in srgb, var(--dsw-alias-label-secondary) 82%, transparent);background:0 0;border:none;border-radius:50%;flex:none;justify-content:center;align-items:center;padding:0;transition:color .14s;display:inline-flex;position:relative}._14DcuW_searchExpanded ._14DcuW_searchButton{width:28px;height:30px}._14DcuW_searchButton:hover{color:var(--dsw-alias-label-primary)}._14DcuW_searchButton:hover:before{background:var(--dsw-alias-interactive-bg-hover)}._14DcuW_searchExpanded ._14DcuW_searchButton:hover:before{background:0 0}._14DcuW_searchInput{opacity:0;pointer-events:none;width:0;min-width:0;color:var(--dsw-alias-label-primary);transition:opacity .12s var(--ds-ease-in-out);background:0 0;border:none;outline:none;flex:1;font-size:13px;line-height:18px}._14DcuW_searchExpanded ._14DcuW_searchInput{opacity:1;pointer-events:auto;margin-left:-2px}._14DcuW_searchInput::placeholder{color:var(--dsw-alias-label-tertiary)}._14DcuW_clearButton{border-radius:var(--dsw-radius-sm);cursor:pointer;width:24px;height:24px;color:var(--dsw-alias-label-secondary);background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}._14DcuW_clearButton:hover{background:var(--dsw-alias-interactive-bg-hover)}._14DcuW_rail ._14DcuW_sectionHeader{justify-content:flex-start;gap:0;margin-bottom:12px;padding-left:0}._14DcuW_rail ._14DcuW_headerActions{max-width:none}._14DcuW_rail ._14DcuW_iconButton{border-radius:var(--dsw-radius-md);corner-shape:var(--dsw-corner-shape);width:36px;height:36px;color:var(--dsw-alias-label-primary)}._14DcuW_rail ._14DcuW_iconButton:before,._14DcuW_rail ._14DcuW_searchButton:before{border-radius:var(--dsw-radius-md);corner-shape:var(--dsw-corner-shape);width:100%;height:100%}._14DcuW_rail ._14DcuW_search{border-radius:var(--dsw-radius-md);background:0 0;border-color:#0000;gap:0;width:36px;height:36px;margin:0 0 12px;padding:0}._14DcuW_rail ._14DcuW_searchButton{border-radius:var(--dsw-radius-md);corner-shape:var(--dsw-corner-shape);width:36px;height:36px;color:var(--dsw-alias-label-primary)}._14DcuW_listArea{min-height:0;margin-left:-4px;margin-right:calc(-1 * var(--dsh-session-list-edge-inset));flex-direction:column;flex:1;padding-left:4px;display:flex;position:relative;overflow:visible}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader+._14DcuW_listArea{padding-top:6px}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader+._14DcuW_listArea:before{content:"";top:0;left:calc(4px - var(--dsh-sidebar-inline-padding));background:color-mix(in srgb, var(--dsw-alias-border-l3) 38%, transparent);pointer-events:none;height:1px;position:absolute;right:0}body[data-ds-dark-theme] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader+._14DcuW_listArea:before{background:color-mix(in srgb, var(--dsw-alias-border-l3) 34%, transparent)}@media (resolution>=2x){._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader+._14DcuW_listArea:before{background:color-mix(in srgb, var(--dsw-alias-border-l3) 56%, transparent);transform-origin:top;transform:scaleY(.5)}body[data-ds-dark-theme] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader+._14DcuW_listArea:before{background:color-mix(in srgb, var(--dsw-alias-border-l3) 48%, transparent)}}[data-phone-drawer] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader+._14DcuW_listArea:before{left:4px;right:var(--dsh-session-list-edge-inset)}._14DcuW_rail ._14DcuW_listArea{margin-left:0;margin-right:0;padding-left:0}._14DcuW_treeBody{flex-direction:column;flex:1;min-height:0;display:flex;position:relative}._14DcuW_fade{left:0;right:var(--dsh-session-list-edge-inset);background:linear-gradient(to bottom, transparent, var(--dsw-specific-sidebar-fill));pointer-events:none;height:24px;position:absolute;bottom:0}[data-platform=darwin]:not([data-tauri-shell]) ._14DcuW_fade,[data-phone-drawer] ._14DcuW_fade,body[data-codexhost-wallpaper] ._14DcuW_fade{display:none}._14DcuW_wide{animation:_14DcuW_wide-in .2s var(--ds-ease-in-out)}@keyframes _14DcuW_wide-in{0%{opacity:0}}._14DcuW_list{overflow-anchor:none;overscroll-behavior-y:contain;--dsh-scrollbar-width:var(--dsh-session-list-scrollbar-width);--dsh-scrollbar-track-margin:6px;min-height:0;margin-left:-4px;margin-right:var(--dsh-session-list-scrollbar-offset);padding-left:4px;padding-right:calc(var(--dsh-session-list-edge-inset) - var(--dsh-session-list-scrollbar-width) - var(--dsh-session-list-scrollbar-offset));scrollbar-gutter:stable;flex:1;padding-bottom:16px;scroll-padding-block:8px;overflow-y:auto}._14DcuW_flatList>*+*,._14DcuW_flatUnsectioned>*+*,._14DcuW_flatRows>*+*,._14DcuW_searchTree>[role=treeitem]+[role=treeitem],._14DcuW_groupSection>*+*,._14DcuW_groupSessions>*+*{margin-top:2px}._14DcuW_unsectionedZone{border-radius:var(--dsw-radius-sm)}._14DcuW_unsectionedDropTarget{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 8%, transparent);box-shadow:inset 0 0 0 1px var(--dsw-alias-state-business-primary)}._14DcuW_unsectionedDropHint{color:var(--dsw-alias-label-tertiary);padding:6px 8px;font-size:12px;line-height:18px}._14DcuW_searchStatus{color:var(--dsw-alias-label-tertiary);padding:10px 12px;font-size:12px;line-height:18px}._14DcuW_skeletonRow{box-sizing:border-box;align-items:flex-start;gap:8px;min-height:48px;padding:6px 8px 7px;display:flex}._14DcuW_skeletonDot{corner-shape:round;border-radius:50%;flex:none;width:16px;height:16px}._14DcuW_skeletonBars{flex-direction:column;flex:1;gap:6px;min-width:0;display:flex}._14DcuW_skeletonDot,._14DcuW_skeletonBar{background:var(--dsw-alias-bg-skeleton);animation:2s cubic-bezier(.36,0,.64,1) infinite _14DcuW_search-skeleton}._14DcuW_skeletonBar{border-radius:var(--dsw-radius-xs);width:65%;height:16px}._14DcuW_skeletonBarWide{width:90%;height:13px}@keyframes _14DcuW_search-skeleton{0%{opacity:1}40%{opacity:.6}80%,to{opacity:1}}._14DcuW_groupSection{position:relative}._14DcuW_groupSection+._14DcuW_groupSection{margin-top:4px}._14DcuW_listTopDropIndicator,._14DcuW_workspaceDropBefore:before,._14DcuW_workspaceDropAfter:after{content:"";z-index:1;background:linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat, linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat, linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;pointer-events:none;height:12px;position:absolute;left:0;right:0}._14DcuW_listTopDropIndicator{top:-8px;left:0;right:var(--dsh-session-list-edge-inset)}._14DcuW_listTopDropActive>._14DcuW_workspaceDropBefore:first-child:before{display:none}._14DcuW_workspaceDropBefore:before{top:-8px}._14DcuW_workspaceDropAfter:after{bottom:-8px}._14DcuW_sessionOverflowButton{width:100%;height:32px;padding:0 12px 0 calc(32px + var(--dsh-workspace-indent,0px));cursor:pointer;text-align:left;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;border-radius:6px;font-size:12px}._14DcuW_sessionOverflowButton[data-row-key=overflow\\:workspaces]{padding-inline-start:8px}._14DcuW_groupSessions>._14DcuW_sessionOverflowButton{margin-top:0;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px))}@media (hover:hover){._14DcuW_sessionOverflowButton:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}}._14DcuW_sessionOverflowButton:active{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}._14DcuW_sessionOverflowButton:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}@media (hover:none),(pointer:coarse){._14DcuW_sessionOverflowButton{min-height:44px}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_iconButton,._14DcuW_root:not(._14DcuW_rail) ._14DcuW_searchButton{width:36px;min-width:36px;height:36px;min-height:36px}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_activitySlot:not(._14DcuW_activitySlotHidden),._14DcuW_root:not(._14DcuW_rail) ._14DcuW_searchSlot{max-width:36px}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_searchSlotExpanded{max-width:100%}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_search{height:36px}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_headerActions:not(._14DcuW_headerActionsHidden){max-width:120px}._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader{height:44px}._14DcuW_searchInput,._14DcuW_renameInput{font-size:16px}}[data-phone-drawer] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_sectionHeader{height:44px}[data-phone-drawer] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_iconButton,[data-phone-drawer] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_searchButton{width:36px;min-width:36px;height:36px;min-height:36px}[data-phone-drawer] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_activitySlot:not(._14DcuW_activitySlotHidden){max-width:36px}[data-phone-drawer] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_searchSlot{max-width:36px}[data-phone-drawer] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_searchSlotExpanded{max-width:100%}[data-phone-drawer] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_search{height:36px}[data-phone-drawer] ._14DcuW_root:not(._14DcuW_rail) ._14DcuW_headerActions:not(._14DcuW_headerActionsHidden){max-width:120px}._14DcuW_empty{color:var(--dsw-alias-label-tertiary);padding:16px 12px;font-size:13px}._14DcuW_emptyState{color:var(--dsw-alias-label-tertiary);flex-direction:column;align-items:center;gap:8px;margin-top:80px;padding:0 12px;font-size:13px;line-height:20px;display:flex}._14DcuW_emptyState>svg{color:var(--dsw-alias-label-caption);margin-bottom:4px}._14DcuW_emptyAction{cursor:pointer;color:var(--dsw-alias-link);background:0 0;border:none;padding:0;font-size:13px;line-height:20px}._14DcuW_filterEmptyHint{color:var(--dsw-alias-label-tertiary);flex-direction:column;align-items:flex-start;gap:4px;padding:10px 12px;font-size:12px;line-height:18px;display:flex}._14DcuW_filterEmptyHint ._14DcuW_emptyAction{font-size:12px;line-height:18px}._14DcuW_renameInput{box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-lg);width:100%;height:44px;color:var(--dsw-alias-label-primary);background:0 0;outline:none;padding:7px 14px;font-size:14px;font-weight:400;line-height:22px}._14DcuW_renameInput:disabled{color:var(--dsw-alias-label-dimmed)}._14DcuW_defaultHarnessOptions{flex-direction:column;display:flex}._14DcuW_defaultHarnessOptions>[role=radiogroup]{flex-direction:column;gap:12px;display:flex}._14DcuW_defaultHarnessOption{min-height:28px;color:var(--dsw-alias-label-primary);cursor:pointer;align-items:flex-start;gap:10px;font-size:14px;display:flex}._14DcuW_defaultHarnessOption input{width:16px;height:16px;accent-color:var(--dsw-alias-label-primary);flex:none;margin:2px 0 0}._14DcuW_defaultHarnessOptionText{flex-direction:column;gap:2px;min-width:0;display:flex}._14DcuW_defaultHarnessOptionTitle{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:500;line-height:20px}._14DcuW_defaultHarnessOptionDesc{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}._14DcuW_defaultHarnessTrigger{text-align:start;cursor:pointer;align-items:center;gap:8px;width:calc(100% - 26px);margin-top:12px;margin-left:26px;display:flex}._14DcuW_defaultHarnessTrigger:focus-visible{outline:2px solid var(--dsw-alias-label-secondary);outline-offset:2px}._14DcuW_defaultHarnessTrigger>:is(svg,img){flex:none}._14DcuW_defaultHarnessTrigger>span{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}._14DcuW_defaultHarnessMenu{width:min(332px,100vw - 64px)}._14DcuW_renameError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}._14DcuW_deleteAction:not(:disabled){color:var(--dsw-alias-state-error-primary)}._14DcuW_deleteStatus{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}._14DcuW_archiveActivity{max-height:220px;color:var(--dsw-alias-label-primary);margin:0 0 8px;padding-left:18px;font-size:13px;line-height:20px;overflow-y:auto}._14DcuW_archiveActivity li{overflow-wrap:anywhere}@media (prefers-reduced-motion:reduce){._14DcuW_wide,._14DcuW_skeletonDot,._14DcuW_skeletonBar{animation:none}._14DcuW_search,._14DcuW_sectionLabel,._14DcuW_activitySlot,._14DcuW_searchSlot,._14DcuW_searchInput,._14DcuW_headerActions{transition:none}}`,document.head.appendChild(e)}var Z={activityButton:`_14DcuW_activityButton`,activityButtonActive:`_14DcuW_activityButtonActive`,activityDot:`_14DcuW_activityDot`,activityIconWrap:`_14DcuW_activityIconWrap`,activitySlot:`_14DcuW_activitySlot`,activitySlotHidden:`_14DcuW_activitySlotHidden`,archiveActivity:`_14DcuW_archiveActivity`,clearButton:`_14DcuW_clearButton`,defaultHarnessMenu:`_14DcuW_defaultHarnessMenu`,defaultHarnessOption:`_14DcuW_defaultHarnessOption`,defaultHarnessOptionDesc:`_14DcuW_defaultHarnessOptionDesc`,defaultHarnessOptionText:`_14DcuW_defaultHarnessOptionText`,defaultHarnessOptionTitle:`_14DcuW_defaultHarnessOptionTitle`,defaultHarnessOptions:`_14DcuW_defaultHarnessOptions`,defaultHarnessTrigger:`_14DcuW_defaultHarnessTrigger`,deleteAction:`_14DcuW_deleteAction`,deleteStatus:`_14DcuW_deleteStatus`,empty:`_14DcuW_empty`,emptyAction:`_14DcuW_emptyAction`,emptyState:`_14DcuW_emptyState`,fade:`_14DcuW_fade`,filterEmptyHint:`_14DcuW_filterEmptyHint`,flatList:`_14DcuW_flatList`,flatRows:`_14DcuW_flatRows`,flatUnsectioned:`_14DcuW_flatUnsectioned`,groupSection:`_14DcuW_groupSection`,groupSessions:`_14DcuW_groupSessions`,headerActions:`_14DcuW_headerActions`,headerActionsHidden:`_14DcuW_headerActionsHidden`,iconButton:`_14DcuW_iconButton`,list:`_14DcuW_list`,listArea:`_14DcuW_listArea`,listTopDropActive:`_14DcuW_listTopDropActive`,listTopDropIndicator:`_14DcuW_listTopDropIndicator`,rail:`_14DcuW_rail`,renameError:`_14DcuW_renameError`,renameInput:`_14DcuW_renameInput`,root:`_14DcuW_root`,search:`_14DcuW_search`,"search-skeleton":`_14DcuW_search-skeleton`,searchButton:`_14DcuW_searchButton`,searchExpanded:`_14DcuW_searchExpanded`,searchInput:`_14DcuW_searchInput`,searchSlot:`_14DcuW_searchSlot`,searchSlotExpanded:`_14DcuW_searchSlotExpanded`,searchStatus:`_14DcuW_searchStatus`,searchTree:`_14DcuW_searchTree`,sectionHeader:`_14DcuW_sectionHeader`,sectionLabel:`_14DcuW_sectionLabel`,sectionLabelHidden:`_14DcuW_sectionLabelHidden`,sessionOverflowButton:`_14DcuW_sessionOverflowButton`,skeletonBar:`_14DcuW_skeletonBar`,skeletonBarWide:`_14DcuW_skeletonBarWide`,skeletonBars:`_14DcuW_skeletonBars`,skeletonDot:`_14DcuW_skeletonDot`,skeletonRow:`_14DcuW_skeletonRow`,treeBody:`_14DcuW_treeBody`,unsectionedDropHint:`_14DcuW_unsectionedDropHint`,unsectionedDropTarget:`_14DcuW_unsectionedDropTarget`,unsectionedZone:`_14DcuW_unsectionedZone`,viewOptionsMenu:`_14DcuW_viewOptionsMenu`,wide:`_14DcuW_wide`,"wide-in":`_14DcuW_wide-in`,workspaceDropAfter:`_14DcuW_workspaceDropAfter`,workspaceDropBefore:`_14DcuW_workspaceDropBefore`};function W_({section:e,request:t,t:n}){let[i,a]=(0,s.useState)(!1),c=n(`actions.section.aria`,{name:e.name});return/* @__PURE__ */ (0,o.jsx)(r.Menu,{open:i,onClose:()=>a(!1),items:[{id:`rename`,label:n(`section.rename.title`)},{id:`delete`,label:n(`section.delete.title`)}],onSelect:n=>{a(!1),(n===`rename`||n===`delete`)&&t({mode:n,section:e})},align:`end`,dense:!0,portal:!0,anchor:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.iconButton,"aria-label":c,"aria-haspopup":`menu`,"aria-expanded":i,onClick:()=>a(!i),children:/* @__PURE__ */ (0,o.jsx)(r.IconEllipsisOutlineRegular,{size:16})})})}function G_({useThreadSectionManage:e,dismiss:t,createSection:n,updateSection:r,deleteSection:i,notifySyncPending:a,t:s}){let c=e(e=>e);if(c===null)return null;if(c.mode!==`delete`){let e=c.mode===`rename`?c.section:void 0;return/* @__PURE__ */ (0,o.jsx)(K_,{initialName:e?.name??``,requireChange:e!==void 0,title:s(e?`section.rename.title`:`section.create.title`),submitLabel:s(e?`rename`:`section.create.action`),saveName:e?t=>r(e.id,t):n,dismiss:t,notifySyncPending:a,t:s},e?`rename:${e.id}`:`create`)}return/* @__PURE__ */ (0,o.jsx)(q_,{section:c.section,dismiss:t,deleteSection:i,notifySyncPending:a,t:s},`delete:${c.section.id}`)}function K_({initialName:e,requireChange:t,title:n,submitLabel:i,saveName:a,dismiss:c,notifySyncPending:l,t:u}){let[d,f]=(0,s.useState)(e),[p,m]=(0,s.useState)(`editing`),[h,g]=(0,s.useState)(null),_=(0,s.useRef)(!1),v=(0,s.useRef)(!1),y=d.trim(),b=y.length===0||t&&y===e,x=()=>{p!==`saving`&&c()},S=async()=>{if(!(v.current||b)){v.current=!0,m(`saving`),g(null);try{let e=await a(y);if(e.status===`unknown`){m(`unknown`),g(u(`section.outcomeUnknown`));return}c(),e.syncPending&&l()}catch(e){g(J_(e)),v.current=!1,m(`editing`)}}};return/* @__PURE__ */ (0,o.jsxs)(r.Modal,{phoneSidebar:!0,open:!0,onClose:x,closeLabel:u(`close`),title:n,footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,disabled:p===`saving`,onClick:x,children:u(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`primary`,disabled:p!==`editing`||b,onClick:()=>void S(),children:i})]}),children:[/* @__PURE__ */ (0,o.jsx)(`input`,{className:Z.renameInput,value:d,placeholder:u(`section.namePlaceholder`),"aria-label":u(`field.sectionName`),"data-modal-autofocus":!0,disabled:p!==`editing`,onFocus:t?e=>e.target.select():void 0,onChange:e=>{f(e.target.value),g(null)},onCompositionStart:()=>{_.current=!0},onCompositionEnd:()=>{_.current=!1},onKeyDown:e=>{e.key===`Enter`&&!_.current&&(e.preventDefault(),S())}}),h!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:h})]})}function q_({section:e,dismiss:t,deleteSection:n,notifySyncPending:i,t:a}){let[c,l]=(0,s.useState)(!1),[u,d]=(0,s.useState)(null),f=(0,s.useRef)(!1),p=()=>{f.current||t()},m=async()=>{if(!f.current){f.current=!0,l(!0),d(null);try{let r=await n(e.id);if(r.status!==`confirmed`){d(a(`section.outcomeUnknown`));return}t(),r.syncPending&&i()}catch(e){d(J_(e))}finally{f.current=!1,l(!1)}}};return/* @__PURE__ */ (0,o.jsxs)(r.Modal,{phoneSidebar:!0,open:!0,onClose:p,closeLabel:a(`close`),title:a(`section.delete.title`),description:a(`section.delete.desc`,{name:e.name}),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,disabled:c,onClick:p,children:a(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,className:Z.deleteAction,disabled:c,onClick:()=>void m(),children:a(`section.delete.action`)})]}),children:[c&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.deleteStatus,role:`status`,children:a(`section.delete.pending`)}),u!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:u})]})}function J_(e){return e instanceof Error?e.message:String(e)}function Y_(e){return e.pendingInteraction!==void 0}function X_(e){return e.running||e.runningSubagentCount>0}function Z_(e){return e.completed}function Q_(e){return e.archived||e.blank?null:Y_(e)||(e.tree?.activity.pendingInteraction??0)>0?0:X_(e)||(e.tree?.activity.running??0)>0?1:Z_(e)||(e.tree?.activity.completed??0)>0?2:null}function $_(e){let t=/* @__PURE__ */ new Set,n=[],r=e=>{!e.archived&&!e.blank&&Z_(e)&&!t.has(e.id)&&(t.add(e.id),n.push(e.id));for(let t of e.tree?.children??[])r(t)};for(let t of e)r(t);return n}function ev(e,t,n){let r=Ih(e,{pinnedSessionIds:t.pinnedSessionIds,archivedSessionIds:t.archivedSessionIds,archivedFilter:`default`,...t.sectionedSessionIds===void 0?{}:{sectionedSessionIds:t.sectionedSessionIds}},n),i=[],a=0,o=0;for(let e=0;e<r.length;e++){let t=r[e],n=Q_(t);n!==null&&(a+=Number(Y_(t))+(t.tree?.activity.pendingInteraction??0),o+=Number(X_(t))+(t.tree?.activity.running??0),i.push({node:t,priority:n,updatedAt:t.tree?.updatedAt??t.updatedAt,index:e}))}i.sort((e,t)=>e.priority-t.priority||t.updatedAt-e.updatedAt||e.index-t.index);let s=i.map(e=>e.node),c=$_(s),l=c.length;return{rows:s,unreadSessionIds:c,pendingCount:a,runningCount:o,unreadCount:l,hasAttention:a>0||l>0}}let tv=`@deepseek-ai/dsh-client-ui-workspace/AnimatedRows.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(tv)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=tv,e.textContent=`.Jek-Ha_exits{contain:strict;pointer-events:none;position:absolute;inset:0;overflow:clip}`,document.head.appendChild(e)}var nv={exits:`Jek-Ha_exits`};function rv(e){return[...e.querySelectorAll(`[data-row-key]`)].filter(e=>e.offsetHeight>0&&!e.closest(`[inert]`))}function iv(e){if(!e)return;let t=rv(e),n=document.activeElement?.closest(`[data-row-key]`),r=t.find(e=>e===n)??t.find(e=>e.getAttribute(`aria-selected`)===`true`)??t[0];for(let e of t){let t=e===r?0:-1;(!e.hasAttribute(`tabindex`)||e.tabIndex!==t)&&(e.tabIndex=t)}}function av(e){if(e.defaultPrevented||e.nativeEvent.isComposing||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let t=e.currentTarget,n=e.target;if(!(n instanceof HTMLElement)||!n.matches(`[data-row-key]`)||!t.contains(n))return;let r=rv(t),i=r.indexOf(n);if(i<0)return;let a=n.matches(`[role="treeitem"][aria-expanded]`),o=n.querySelector(`[data-thread-icon-toggle]`),s=()=>{o?o.click():n.click()},c;switch(e.key){case`ArrowDown`:c=r[i+1];break;case`ArrowUp`:c=r[i-1];break;case`Home`:c=r[0];break;case`End`:c=r.at(-1);break;case`ArrowRight`:a&&n.getAttribute(`aria-expanded`)===`false`?s():a&&(c=r[i+1]);break;case`ArrowLeft`:if(a&&n.getAttribute(`aria-expanded`)===`true`)s();else{let e=n.dataset.threadParent;if(e!==void 0){let t=n.dataset.rowKey??``,i=t.startsWith(`linked:`)?t.slice(0,t.indexOf(`:`,7)+1):t.startsWith(`recent:`)?`recent:`:`session:`;c=r.find(t=>t.dataset.rowKey===`${i}${e}`);break}let t=n.closest(`[data-sidebar-group]`),i=t?.querySelector(`[data-row-key^="workspace:"]`);i===n&&(t=t?.parentElement?.closest(`[data-sidebar-group]`)??null,i=t?.querySelector(`[data-row-key^="workspace:"]`)),c=i??void 0}break;case`Enter`:case` `:n.click();break;default:return}e.preventDefault(),c&&(c.focus({preventScroll:!0}),c.scrollIntoView({block:`nearest`}),iv(t))}function ov(e,t){return e.rowKeys.length===t.rowKeys.length&&e.rowKeys.every((e,n)=>e===t.rowKeys[n])}function sv(e,t){return e.bottom>t.top&&e.top<t.bottom&&e.right>t.left&&e.left<t.right}var cv=class extends s.Component{armed=!1;localList=(0,s.createRef)();overlay=(0,s.createRef)();movements=/* @__PURE__ */ new Map;exits=/* @__PURE__ */ new Map;get list(){return this.props.scrollRef??this.localList}componentDidMount(){iv(this.list.current)}getSnapshotBeforeUpdate(e){let t=this.list.current;if(ov(e,this.props)||e.resetKey!==this.props.resetKey||!e.ready||!this.props.ready||t===null)return null;let n=this.armed&&typeof t.animate==`function`&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,r=t.getBoundingClientRect(),i=this.readPositions(),a=new Set(this.props.rowKeys),o=/* @__PURE__ */ new Map;if(n)for(let[e,t]of i){if(a.has(e)||!sv(t.rect,r))continue;let n=t.element.cloneNode(!0);n.removeAttribute(`data-row-key`),n.inert=!0,n.style.setProperty(`--dsh-workspace-indent`,getComputedStyle(t.element).getPropertyValue(`--dsh-workspace-indent`)),o.set(e,{...t,element:n})}let s=null,c=0;for(let[e,t]of i)if(a.has(e)&&!this.movements.has(t.element)&&sv(t.rect,r)){s=e,c=t.rect.top-r.top;break}return{positions:i,removed:o,anchorViewportTop:c,anchorKey:s,animate:n}}componentDidUpdate(e,t,n){if(iv(this.list.current),n===null){(!ov(e,this.props)||e.resetKey!==this.props.resetKey||e.ready!==this.props.ready)&&this.clear();return}this.cancelMovements();let r=this.list.current,i=this.overlay.current;if(this.restoreScroll(n,r),!n.animate)return;let a=r.getBoundingClientRect(),o=i.getBoundingClientRect(),s=this.readPositions();for(let[e,t]of s){this.removeExit(e);let r=n.positions.get(e);if(!sv(t.rect,a)&&(r===void 0||!sv(r.rect,a)))continue;if(r===void 0){this.move(t.element,[{opacity:0},{opacity:1}],100);continue}let i=r.rect.left-t.rect.left,o=r.rect.top-t.rect.top;(i!==0||o!==0||r.opacity!==1)&&this.move(t.element,[{transform:`translate(${String(i)}px, ${String(o)}px)`,opacity:r.opacity},{transform:`translate(0, 0)`,opacity:1}],200)}for(let[e,t]of n.removed){let{element:n}=t;this.removeExit(e),Object.assign(n.style,{position:`absolute`,margin:`0`,transform:`none`,boxSizing:`border-box`,left:`${String(t.rect.left-o.left)}px`,top:`${String(t.rect.top-o.top)}px`,width:`${String(t.rect.width)}px`,height:`${String(t.rect.height)}px`}),i.append(n);let r=n.animate([{opacity:t.opacity},{opacity:0}],{duration:100,easing:`ease-out`,fill:`forwards`});this.exits.set(e,{element:n,animation:r}),r.onfinish=()=>{this.removeExit(e)}}}componentWillUnmount(){this.clear()}restoreScroll(e,t){if(e.anchorKey===null)return;let n=t.querySelector(`[data-row-key="${CSS.escape(e.anchorKey)}"]`);if(n===null)return;let r=n.getBoundingClientRect().top-t.getBoundingClientRect().top-e.anchorViewportTop;if(r===0)return;let i=t.scrollHeight-t.clientHeight;t.scrollTop=Math.min(Math.max(t.scrollTop+r,0),i)}readPositions(){let e=this.list.current.querySelectorAll(`[data-row-key]`);return new Map(Array.from(e,e=>[e.dataset.rowKey,{element:e,rect:e.getBoundingClientRect(),opacity:this.movements.has(e)?Number(getComputedStyle(e).opacity):1}]))}move(e,t,n){let r=e.animate(t,{duration:n,easing:`ease-out`});this.movements.set(e,r),r.onfinish=()=>{this.movements.delete(e),r.cancel()}}cancelMovements(){for(let e of this.movements.values())e.onfinish=null,e.cancel();this.movements.clear()}removeExit(e){let t=this.exits.get(e);t!==void 0&&(t.animation.onfinish=null,t.animation.cancel(),t.element.remove(),this.exits.delete(e))}clear(){this.cancelMovements();for(let e of this.exits.keys())this.removeExit(e)}render(){return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(`div`,{ref:this.list,className:this.props.className,role:`tree`,"aria-label":this.props.label,onScroll:this.props.onScroll,onKeyDown:av,onFocusCapture:()=>iv(this.list.current),onPointerDownCapture:()=>{this.armed=!0},onKeyDownCapture:()=>{this.armed=!0},children:this.props.children}),/* @__PURE__ */ (0,o.jsx)(`div`,{ref:this.overlay,className:nv.exits,"aria-hidden":`true`})]})}};function lv({identity:e,ambient:t,titlePrefix:n,title:r,onIdentityClick:i,identityLabel:a,identityControls:s,identityExpanded:c,children:l}){let u=/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[e,/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.statusOverlay,children:t})]});return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[i?/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:`${J.slot} ${J.identityButton}`,onClick:i,"data-thread-icon-toggle":!0,"aria-label":a,title:a,"aria-expanded":c,"aria-controls":s,children:[u,/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.foldChevron,"aria-hidden":`true`})]}):/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.slot,children:u}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:J.titleGroup,children:[n,/* @__PURE__ */ (0,o.jsx)(`span`,{"data-session-title":!0,className:J.title,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.titleText,children:r})})]}),l]})}var uv=class{pendingDownId=void 0;orphanUpId=void 0;lateDownSeen=!1;activated=!1;down(e){this.activated=!1,this.orphanUpId===e?(this.orphanUpId=void 0,this.lateDownSeen=!0):this.pendingDownId=e}orphanUp(e){return this.pendingDownId===e?(this.pendingDownId=void 0,!1):(this.pendingDownId=void 0,this.orphanUpId=e,this.lateDownSeen=!1,!0)}needsFallback(){return!this.activated&&this.lateDownSeen}clicked(){this.activated=!0}takeFallback(){let e=!this.activated&&this.lateDownSeen;return this.lateDownSeen=!1,this.pendingDownId=void 0,this.orphanUpId=void 0,e}abandonPress(){this.pendingDownId=void 0}consumeFallback(){this.lateDownSeen=!1,this.pendingDownId=void 0,this.orphanUpId=void 0}cancel(){this.pendingDownId=void 0,this.orphanUpId=void 0,this.lateDownSeen=!1}};function dv({host:e,variant:t=`workspace`,t:n}){let r=e?.displayName??n(`host.local`),i=e?.state===`connected`?n(`host.connected`):e?.state===`connecting`?n(`host.connecting`):n(`host.disconnected`),a=e?`${r} · ${i}`:r,s=e===void 0?void 0:np(e.hostId,e.color);return/* @__PURE__ */ (0,o.jsxs)(`span`,{className:X(J.hostBadge,t===`session`&&J.hostBadgeSession),"data-host-id":e?.hostId??`local`,"data-state":e?.state??`local`,"data-color":s,role:`img`,"aria-label":a,title:a,children:[e!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.hostDot,"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.hostLabel,children:r})]})}let fv=`codexhost.sidebar.hostScopeFilter.v1`,pv=`codexhost:apply-host-scope-workspace-selection`;function mv(e){return e.some(e=>e.remote!==void 0)}function hv(e){if(e.remote===void 0)return!1;let t=e.path??e.cwd;return t===void 0||t.trim()===``}function gv(e){return e.some(e=>e.remote?.hostId.startsWith(`remote-peer:`)===!0)}function _v(e){let t=[],n=/* @__PURE__ */ new Map;for(let r of e){let e=r.remote;if(e===void 0){t.push(r);continue}let i=n.get(e.hostId);i===void 0?n.set(e.hostId,{key:e.hostId,hostId:e.hostId,displayName:e.displayName,state:e.state,...e.color===void 0?{}:{color:e.color},workspaceCount:1,workspaces:[r]}):(i.workspaces.push(r),i.workspaceCount+=1,i.color===void 0&&e.color!==void 0&&(i.color=e.color))}return t.length===0&&n.size===0?[]:[{key:`local`,workspaceCount:t.length,workspaces:t},...n.values()]}function vv(e,t){return e.selectedHost===`all`||_v(t).some(t=>t.key===e.selectedHost)?e:{...e,selectedHost:`all`}}function yv(e,t,n){let r=_v(t),i=new Map(r.map(e=>[e.key,e])),a=n?.preserveHostKeys,o=e.selectedHost!==`all`&&e.selectedHost!==`local`&&!i.has(e.selectedHost)?`all`:e.selectedHost,s=o!==e.selectedHost,c={};for(let[t,n]of Object.entries(e.perHost)){let e=i.get(t);if(e===void 0){if(t!==`local`){a?.has(t)===!0?c[t]=n:s=!0;continue}n.workspaceIds.length>0?(s=!0,c[t]={mode:n.mode,workspaceIds:[]}):c[t]=n;continue}if(t!==`local`&&(e.state===`connecting`||e.state!==`connected`&&a?.has(t)===!0)){c[t]=n;continue}let r=new Set(e.workspaces.map(e=>e.workspaceId)),o=n.workspaceIds.filter(e=>r.has(e));o.length===n.workspaceIds.length?c[t]=n:(s=!0,c[t]={mode:n.mode,workspaceIds:o})}return s?{selectedHost:o,perHost:c}:e}function bv(e,t){let n=vv(e,t);return n.selectedHost!==`all`||_v(t).some(e=>n.perHost[e.key]?.mode===`selected`)}function xv(e,t){let n=vv(t,e);return e.filter(e=>{let t=e.remote?.hostId??`local`;if(n.selectedHost===`local`){if(e.remote!==void 0)return!1}else if(n.selectedHost!==`all`&&e.remote?.hostId!==n.selectedHost)return!1;let r=n.perHost[t];return r?.mode!==`selected`||r.workspaceIds.includes(e.workspaceId)})}function Sv(e){return typeof e==`string`?e:e.id}function Cv(e){return typeof e==`string`?`local`:e.remote?.hostId??e.projectionValues?.remoteHost?.hostId??`local`}function wv(e,t){if(!mv(t))return!0;let n=vv(e,t);return(n.selectedHost===`all`||n.selectedHost===`local`)&&n.perHost.local?.mode!==`selected`}function Tv(e,t,n=xv(t,e)){if(!mv(t))return!0;let r=vv(e,t);return r.selectedHost!==`all`&&r.selectedHost!==`local`?!1:r.perHost.local?.mode!==`selected`||n.some(e=>e.remote===void 0)}function Ev(e,t,n,r,i){let a=vv(r,n);if(!bv(a,n))return[...e];let o=t instanceof Set?t:new Set(t),s=/* @__PURE__ */ new Set,c=/* @__PURE__ */ new Set;for(let e of n){let t=o.has(e.workspaceId);for(let n of e.sessionIds)s.add(n),t&&c.add(n)}return e.filter(e=>{let t=Sv(e),n=i?.get(t)??t;if(c.has(n))return!0;if(!s.has(n)){let t=Cv(e);return(a.selectedHost===`all`||a.selectedHost===t)&&a.perHost[t]?.mode!==`selected`}return!1})}function Dv(e,t,n,r,i){let a=vv(t,n);if(r===null||!(a.selectedHost!==`all`&&a.selectedHost!==`local`||(a.selectedHost===`local`?a.perHost.local?.mode===`selected`:_v(n).some(e=>a.perHost[e.key]?.mode===`selected`))))return[...e];let o=i?.pinnedSessionIds,s=i?.archivedSessionIds,c=i?.archivedFilter,l=i?.visibleWorkspaceIds;return e.filter(e=>l!==void 0&&(e.workspaceIds??[]).some(e=>l.has(e))?!0:e.threadIds.some(e=>r.has(e)?s?.has(e)===!0?c===`show`||c===`only`:o?.has(e)!==!0:!1))}function Ov(e,t){if(t===void 0||t.mode!==`selected`)return e.workspaceCount;let n=new Set(t.workspaceIds),r=0;for(let t of e.workspaces)n.has(t.workspaceId)&&(r+=1);return r}function kv(e,t){return e.selectedHost===t?e:{...e,selectedHost:t}}function Av(e,t,n,r){let i=e.perHost[t],a=n===`selected`?i===void 0?[...new Set(r)]:[...i.workspaceIds]:i===void 0?[]:[...i.workspaceIds];return{...e,perHost:{...e.perHost,[t]:{mode:n,workspaceIds:a}}}}function jv(e,t,n,r){let i=e.perHost[t],a=i?.mode===`selected`?i.workspaceIds:[...r],o=a.includes(n)?a.filter(e=>e!==n):[...a,n];return{...e,perHost:{...e.perHost,[t]:{mode:`selected`,workspaceIds:o}}}}function Mv(e,t,n){return{...e,perHost:{...e.perHost,[t]:{mode:`selected`,workspaceIds:[...new Set(n)]}}}}function Nv(){return{selectedHost:`all`,perHost:{}}}function Pv(e,t,n){let r=vv(e,n),i=t?.remote?.hostId??`local`,a=r.selectedHost,o=r.perHost,s=!1;a!==`all`&&a!==i&&(a=`all`,s=!0);let c=o[i];return c?.mode===`selected`&&(t===void 0?(o={...o,[i]:{...c,mode:`all`}},s=!0):c.workspaceIds.includes(t.workspaceId)||(o={...o,[i]:{mode:`selected`,workspaceIds:[...c.workspaceIds,t.workspaceId]}},s=!0)),s?{selectedHost:a,perHost:o}:e}function Fv(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Iv(e){if(e===null||e===``)return Nv();try{let t=JSON.parse(e);if(!Fv(t))return Nv();let n=typeof t.selectedHost==`string`&&t.selectedHost.trim()!==``?t.selectedHost:`all`,r={};if(Fv(t.perHost))for(let[e,n]of Object.entries(t.perHost)){if(e===``||!Fv(n)||n.mode!==`all`&&n.mode!==`selected`)continue;let t=Array.isArray(n.workspaceIds)?[...new Set(n.workspaceIds.filter(e=>typeof e==`string`))]:[];r[e]={mode:n.mode,workspaceIds:t}}return{selectedHost:n,perHost:r}}catch{return Nv()}}function Lv(e){try{let t=e===void 0?typeof window<`u`?window.localStorage:null:e;return t===null?Nv():Iv(t.getItem(fv))}catch{return Nv()}}function Rv(e,t){try{let n=t===void 0?typeof window<`u`?window.localStorage:null:t;if(n===null)return;n.setItem(fv,JSON.stringify(e))}catch{}}function zv(e){let t=/* @__PURE__ */ new Set,n=/* @__PURE__ */ new Set;for(let r of e){let e=new Set(r.hiddenMemberThreadIds??[]);for(let n of e)t.add(n);for(let t of r.memberThreadIds??[])e.has(t)||n.add(t)}for(let e of n)t.delete(e);return t}function Bv(e,t){return t.size===0?e:_h(e,e=>!e.pinned&&t.has(e.id))}function Vv(e,t){return e.blank||t&&e.pinned||e.running||e.runningSubagentCount>0||e.pendingInteraction!==void 0}function Hv(e,t){return Vv(e,t)||!!e.tree?.activity.running||!!e.tree?.activity.pendingInteraction}function Uv(e,t,n){return e.id===t||e.id===n||e.tree?.descendantIds.some(e=>e===t||e===n)===!0}function Wv(e,t,n,r,i){let a=i?.keepPinned??!0,o=0,s=e.filter(e=>Hv(e,a)?!0:o++<t||Uv(e,n,r));return{rows:s,hiddenCount:e.length-s.length,ordinaryCount:o}}function Gv(e,t,n,r,i){let a=zv(t),o=/* @__PURE__ */ new Map;for(let e of t){for(let t of e.memberThreadIds??[])o.has(t)||o.set(t,e.roomId);for(let t of e.hiddenMemberThreadIds??[])o.has(t)||o.set(t,e.roomId)}let s=/* @__PURE__ */ new Map,c=e=>{let t=o.get(e.id);if(t!==void 0){let n=s.get(t);n===void 0?s.set(t,[e]):n.push(e)}for(let t of e.tree?.children??[])c(t)};for(let t of e)c(t);let l=a.size===0?e:_h(e,e=>!e.pinned&&a.has(e.id)),u=/* @__PURE__ */ new Map,d=[];for(let e of l){let t=o.get(e.id);if(t!==void 0){let n=u.get(t);n===void 0?u.set(t,[e]):n.push(e)}else d.push(e)}let f=[...d.map(e=>({kind:`session`,node:e,updatedAt:e.tree?.updatedAt??e.updatedAt})),...t.map(e=>{let t=u.get(e.roomId)??[],n=s.get(e.roomId)??[],r=e.updatedAt;for(let e of t){let t=e.tree?.updatedAt??e.updatedAt;t>r&&(r=t)}for(let e of n)e.updatedAt>r&&(r=e.updatedAt);return{kind:`group`,room:e,members:t,allMembers:n,updatedAt:r}})];f.sort((e,t)=>{if(e.updatedAt!==t.updatedAt)return t.updatedAt-e.updatedAt;let n=e.kind===`group`?`g:${e.room.roomId}`:`s:${e.node.id}`,r=t.kind===`group`?`g:${t.room.roomId}`:`s:${t.node.id}`;return n.localeCompare(r)});let p=0,m=[];for(let e of f){let t=e.kind===`session`?Hv(e.node,!1):e.members.some(e=>Hv(e,!1))||e.allMembers.some(e=>Vv(e,!1)),a=e.kind===`session`?Uv(e.node,r,i):e.members.some(e=>Uv(e,r,i))||e.allMembers.some(e=>e.id===r||e.id===i);(t||p++<n||a)&&m.push(e.kind===`group`?{kind:`group`,room:e.room,members:e.members,updatedAt:e.updatedAt}:e)}return{entries:m,hiddenCount:f.length-m.length,ordinaryCount:p}}function Kv(e,t,n){let r=e.filter((e,r)=>r<t||n.has(e.key));return{rows:r,hiddenCount:e.length-r.length}}let qv={},Jv=[],Yv=/* @__PURE__ */ new Set,Xv=(0,s.createContext)({t:e=>e,forest:Jv,expansion:qv,rows:e=>gh(e,qv),toggle:()=>{},markCompletionsRead:()=>{},collapseStyle:`summary`,stylePrompt:void 0,dismissStylePrompt:()=>{},setCollapseStyle:async()=>!1,rootId:e=>e,reveal:()=>{},selectSidebarRow:()=>{},isSidebarSelection:()=>!1});function Zv(){return(0,s.useContext)(Xv)}function Qv({browser:e,children:t}){let{useSessions:n,useStore:r,useWorkspaces:i,useGroupRooms:a,actions:c,useWorkspacePreferences:l,setThreadTreeCollapseStyle:u}=e,d=l(e=>e),f=N_(d.user),p=d.value?.threadTreeCollapseStyle??`summary`,[m,h]=(0,s.useState)(),g=(0,s.useCallback)(()=>h(void 0),[]),_=n(e=>e),v=i(e=>e.pinnedSessionIds),y=i(e=>e.archivedSessionIds),b=i(e=>e.threadSections),x=a(e=>e),S=r(e=>e.threadExpansion??qv),C=r(e=>e.archivedFilter??`default`),w=(0,s.useMemo)(()=>C===`only`?Yv:zv(x),[C,x]),T=(0,s.useMemo)(()=>Ih(_,{pinnedSessionIds:v,archivedSessionIds:y,archivedFilter:C,...C===`only`||!b?.length?{}:{sectionedSessionIds:new Set(b.flatMap(e=>e.threadIds))}},/* @__PURE__ */ new Map,w),[_,v,y,C,b,w]),E=(0,s.useMemo)(()=>{let e=/* @__PURE__ */ new Map;for(let t of T){let n=[{node:t,ancestors:[]}];for(let r=n.pop();r!==void 0;r=n.pop()){e.set(r.node.id,{root:t,ancestors:r.ancestors});for(let e of r.node.tree?.children??[])n.push({node:e,ancestors:[...r.ancestors,r.node.id]})}}return e},[T]),D=(0,s.useRef)(void 0),ee=(0,s.useCallback)(e=>D.current===e,[]),te=(0,s.useCallback)(e=>{D.current=e,c.setThreadsExpanded(E.get(e)?.ancestors??[],!0)},[c,E]),ne=(0,s.useCallback)(e=>{D.current=void 0;let t=E.get(e);t!==void 0&&c.setThreadsExpanded(t.ancestors,!0)},[c,E]),re=Object.values(_.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,ie=(0,s.useRef)(``);(0,s.useEffect)(()=>{re===void 0?ie.current=``:E.get(re)!==void 0&&ie.current!==re&&(ie.current=re,ee(re)||ne(re))},[re,ee,ne,E]);let ae=(0,s.useMemo)(()=>({t:e.t,forest:T,expansion:S,rows:e=>gh(e,S),toggle:(e,t,n)=>{c.setThreadsExpanded([e],t),t&&n!==void 0&&!f&&h(n)},markCompletionsRead:e.markCompletionsRead??(()=>{}),collapseStyle:p,stylePrompt:f?void 0:m,dismissStylePrompt:g,setCollapseStyle:u,rootId:e=>E.get(e)?.root.id??e,reveal:ne,selectSidebarRow:te,isSidebarSelection:ee}),[e.t,e.markCompletionsRead,c,T,S,E,ne,te,ee,p,f,m,g,u]);return/* @__PURE__ */ (0,o.jsx)(Xv.Provider,{value:ae,children:t})}let $v=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeControls.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify($v)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=$v,e.textContent=`.jGgv6G_branch{--dsh-thread-row-height:32px;--dsh-thread-icon-size:16px;--dsh-thread-icon-center-y:calc(var(--dsh-thread-row-height) / 2);--dsh-thread-row-gap:2px;min-width:0;position:relative}.jGgv6G_branch:has(>:first-child [data-harness-id]),.jGgv6G_branch:has(>:first-child [data-role-avatar]){--dsh-thread-icon-size:14px}.jGgv6G_branch:has(>:first-child [data-harness-id])>.jGgv6G_children,.jGgv6G_branch:has(>:first-child [data-role-avatar])>.jGgv6G_children{--dsh-thread-parent-icon-size:14px}.jGgv6G_branch:has(>:first-child [data-role-avatar])>.jGgv6G_children{--dsh-thread-guide-parent-gap:15px}.jGgv6G_children{gap:var(--dsh-thread-row-gap);margin-top:var(--dsh-thread-row-gap);--dsh-thread-parent-icon-size:16px;--dsh-thread-guide-parent-gap:12px;--dsh-thread-guide-start:calc(var(--dsh-thread-guide-parent-gap) - (var(--dsh-thread-row-height) - var(--dsh-thread-parent-icon-size)) / 2 - var(--dsh-thread-row-gap));--dsh-thread-guide-axis:calc(8px + var(--dsh-workspace-indent,0px) + var(--dsh-thread-guide-indent) + var(--dsh-thread-parent-icon-size) / 2 + .5px);flex-direction:column;display:flex;position:relative}.jGgv6G_children .jGgv6G_children{--dsh-thread-guide-parent-gap:10px}.jGgv6G_children[hidden]{display:none}.jGgv6G_children[data-thread-guide]:before,.jGgv6G_children[data-thread-guide]>.jGgv6G_branch:before{content:"";pointer-events:none;z-index:1;position:absolute;inset-inline-start:var(--dsh-thread-guide-axis)}.jGgv6G_children[data-thread-guide]:before{top:var(--dsh-thread-guide-start);height:max(0px, calc(-1 * var(--dsh-thread-guide-start)));background:var(--dsw-alias-border-l2);width:1px}.jGgv6G_children[data-thread-guide]>.jGgv6G_branch:before{--dsh-thread-guide-stem-start:0px;--dsh-thread-guide-stem-end:0px;top:0;bottom:calc(-1 * var(--dsh-thread-row-gap));width:calc(24px - var(--dsh-thread-parent-icon-size) / 2 - 6.5px);background:var(--dsw-alias-border-l2);mask:linear-gradient(transparent var(--dsh-thread-guide-stem-start), black 0) 0 0 / 1px calc(100% - var(--dsh-thread-guide-stem-end)) no-repeat, url("data:image/svg+xml,<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 11 8\\" preserveAspectRatio=\\"none\\"><path d=\\"M.5 0V1Q.5 3.3 2.5 4.5L10.5 7.5\\" fill=\\"none\\" stroke=\\"black\\" stroke-width=\\"1\\" vector-effect=\\"non-scaling-stroke\\"/></svg>") 0 calc(var(--dsh-thread-icon-center-y) - 8px) / 100% 8px no-repeat}.jGgv6G_children[data-thread-guide]>.jGgv6G_branch:first-child:before{--dsh-thread-guide-stem-start:max(0px, var(--dsh-thread-guide-start))}.jGgv6G_children[data-thread-guide]>.jGgv6G_branch:last-child:before{--dsh-thread-guide-stem-end:8px;bottom:calc(100% - var(--dsh-thread-icon-center-y))}.jGgv6G_summary{appearance:none;width:calc(100% - var(--dsh-thread-icon-size));min-width:0;color:var(--dsw-alias-label-tertiary);font:inherit;text-align:start;overflow-wrap:anywhere;cursor:pointer;-webkit-tap-highlight-color:transparent;background:0 0;border:0;border-radius:6px;margin-block-end:2px;margin-inline-start:var(--dsh-thread-icon-size);padding:2px 8px;font-size:11px;line-height:18px;display:block}.jGgv6G_summary [data-thread-tree-activity=running]{color:color-mix(in srgb, var(--dsw-alias-state-business-primary), var(--dsw-alias-state-success-primary))}.jGgv6G_summary [data-thread-tree-activity=pending]{color:var(--dsw-alias-state-warn-primary)}.jGgv6G_summary [data-thread-tree-activity=completed]{color:var(--dsw-alias-state-business-primary)}@media (hover:hover) and (pointer:fine){.jGgv6G_summary:hover{background:color-mix(in srgb, var(--dsw-alias-label-primary) 4%, transparent)}}.jGgv6G_summary:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}@media (hover:none),(pointer:coarse){.jGgv6G_branch{--dsh-thread-row-height:44px}.jGgv6G_summary{min-height:24px;padding-block:3px}}[data-phone-drawer] .jGgv6G_branch{--dsh-thread-row-height:44px}[data-phone-drawer] .jGgv6G_branch:has(>:first-child>[data-thread-summary]){--dsh-thread-icon-center-y:14px}`,document.head.appendChild(e)}var ey={branch:`jGgv6G_branch`,children:`jGgv6G_children`,summary:`jGgv6G_summary`};function ty(e){return[{state:`running`,count:e.running},{state:`pending`,count:e.pendingInteraction},{state:`completed`,count:e.completed}]}function ny(e){return e.pendingInteraction>0?`pending`:e.running>0?`running`:e.completed>0?`completed`:`idle`}function ry(e,t,n){return[n(`threadTree.children`,{n:e}),...ty(t).filter(e=>e.count>0).map(e=>n(`threadTree.${e.state}`,{n:e.count}))].join(` · `)}function iy({count:e,activity:t,t:n}){return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[n(`threadTree.children`,{n:e}),ty(t).filter(e=>e.count>0).map(e=>/* @__PURE__ */ (0,o.jsx)(`span`,{"data-thread-tree-activity":e.state,children:` · ${n(`threadTree.${e.state}`,{n:e.count})}`},e.state))]})}let ay=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeRing.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(ay)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=ay,e.textContent=`.yY-O0a_ring{inset-inline-start:50%;margin-inline-start:-11px;pointer-events:none;width:22px;height:22px;color:var(--dsw-alias-state-business-primary);margin-top:-11px;position:absolute;top:50%}.yY-O0a_ring svg{width:100%;height:100%;display:block}.yY-O0a_ring circle{stroke:currentColor;stroke-width:1.5px}.yY-O0a_ring[data-thread-ring=pending]{color:var(--dsw-alias-state-warn-primary)}.yY-O0a_ring[data-thread-ring=running]{color:color-mix(in srgb, var(--dsw-alias-state-business-primary), var(--dsw-alias-state-success-primary))}.yY-O0a_ring[data-thread-ring=running] svg{will-change:transform;contain:layout style paint;animation:1.8s linear infinite yY-O0a_spin}.yY-O0a_ring[data-thread-ring=running] circle{stroke-dasharray:48 16.4}.yY-O0a_ring[data-thread-ring=idle]{color:var(--dsw-alias-label-tertiary);opacity:.55}.yY-O0a_ring[data-thread-ring=idle] circle{stroke-width:1px;stroke-dasharray:1.5 3}@keyframes yY-O0a_spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:reduce){.yY-O0a_ring[data-thread-ring=running] svg{animation:none}}`,document.head.appendChild(e)}var oy={ring:`yY-O0a_ring`,spin:`yY-O0a_spin`};function sy({activity:e}){return/* @__PURE__ */ (0,o.jsx)(`span`,{className:oy.ring,"data-thread-ring":ny(e),"aria-hidden":`true`,children:/* @__PURE__ */ (0,o.jsx)(`svg`,{viewBox:`0 0 22 22`,fill:`none`,children:/* @__PURE__ */ (0,o.jsx)(`circle`,{cx:`11`,cy:`11`,r:`10.25`})})})}let cy=[{title:`threadTree.style.samplePending`,activity:{pendingInteraction:1,running:0,completed:0}},{title:`threadTree.style.sampleRunning`,activity:{pendingInteraction:0,running:1,completed:0}},{title:`threadTree.style.sampleUnread`,activity:{pendingInteraction:0,running:0,completed:1}},{title:`threadTree.style.sampleRead`,activity:{pendingInteraction:0,running:0,completed:0}}];function ly({style:e,t}){return/* @__PURE__ */ (0,o.jsx)(`div`,{className:E_.preview,"aria-hidden":`true`,children:cy.map(({title:n,activity:r})=>/* @__PURE__ */ (0,o.jsx)(`div`,{className:ey.branch,children:/* @__PURE__ */ (0,o.jsxs)(`div`,{className:`${J.sessionRow} ${E_.sampleRow}`,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:J.sessionMain,children:/* @__PURE__ */ (0,o.jsx)(lv,{title:t(n),identity:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(`span`,{"data-harness-id":`codex`,className:E_.sampleIcon,children:/* @__PURE__ */ (0,o.jsx)(`img`,{src:`/harness-icons/codex`,width:14,height:14,alt:``})}),e===`ring`&&/* @__PURE__ */ (0,o.jsx)(sy,{activity:r})]})})}),e===`summary`&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:`${ey.summary} ${E_.sampleSummary}`,children:/* @__PURE__ */ (0,o.jsx)(iy,{count:2,activity:r,t})})]})},n))})}function uy({style:e,setStyle:t,onLater:n,onExit:r,t:i}){let a=(0,s.useId)(),[c,l]=(0,s.useState)(e),u=(0,s.useRef)(null),d=(0,s.useRef)(r);d.current=r,(0,s.useLayoutEffect)(()=>{let e=u.current;return e?.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:`instant`}),()=>{e?.contains(document.activeElement)&&d.current()}},[]);let{busy:f,failed:p,save:m}=O_(t);return/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:u,className:E_.prompt,"data-thread-style-prompt":!0,role:`region`,"aria-labelledby":a,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:E_.promptHeading,children:[/* @__PURE__ */ (0,o.jsx)(`strong`,{id:a,children:i(`threadTree.style.promptTitle`)}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:E_.later,disabled:f,onClick:n,children:i(`threadTree.style.later`)})]}),/* @__PURE__ */ (0,o.jsx)(`p`,{className:E_.hint,children:i(`threadTree.style.hint`)}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:E_.comparison,role:`radiogroup`,"aria-labelledby":a,"aria-busy":f,onKeyDown:e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault(),e.stopPropagation();let t=e.key===`Home`||e.key===`End`?D_[e.key===`Home`?0:1]:D_[+(c===`summary`)];e.currentTarget.querySelector(`[data-thread-style-choice="${t}"]`)?.focus()},children:D_.map(t=>/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`radio`,className:E_.choice,"data-thread-style-choice":t,"aria-disabled":f,"aria-checked":e===t,"aria-labelledby":`${a}-${t}`,"aria-describedby":`${a}-${t}-description`,tabIndex:c===t?0:-1,onFocus:()=>l(t),onClick:()=>void m(t),children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:E_.choiceTitle,id:`${a}-${t}`,children:i(`threadTree.style.${t}`)}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:E_.choiceSubtitle,id:`${a}-${t}-description`,children:i(`threadTree.style.${t}Subtitle`)}),/* @__PURE__ */ (0,o.jsx)(ly,{style:t,t:i})]},t))}),p&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:E_.error,role:`alert`,children:i(`threadTree.style.error`)})]})}let dy=(0,s.createContext)(void 0),fy=()=>(0,s.useContext)(dy);function py({roots:e,children:t}){return e.map(e=>/* @__PURE__ */ (0,o.jsx)(my,{node:e,renderRow:t},e.id))}function my({node:e,renderRow:t}){let n=(0,s.useId)(),{expansion:r,stylePrompt:i,dismissStylePrompt:a,collapseStyle:c,setCollapseStyle:l,t:u}=Zv(),d=r[e.id]===!0,f=e.tree?.depth??0,p=e.tree?.children??[];return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:ey.branch,"data-thread-branch":e.id,children:[/* @__PURE__ */ (0,o.jsx)(dy.Provider,{value:n,children:t(e)}),d&&i===n&&/* @__PURE__ */ (0,o.jsx)(uy,{style:c,setStyle:l,onLater:a,onExit:()=>document.querySelector(`[data-thread-icon-toggle][aria-controls="${CSS.escape(n)}"]`)?.focus({preventScroll:!0}),t:u}),p.length>0&&/* @__PURE__ */ (0,o.jsx)(`div`,{id:n,role:`group`,hidden:!d,"data-thread-guide":d&&f<3?``:void 0,className:ey.children,style:{"--dsh-thread-guide-indent":`${Math.min(f,3)*24}px`},children:d&&/* @__PURE__ */ (0,o.jsx)(py,{roots:p,children:t})})]})}function hy({node:e,title:t,toggle:n,t:r}){let i=fy(),a=(0,s.useRef)(null);(0,s.useLayoutEffect)(()=>{let e=a.current;return()=>{e!==null&&document.activeElement===e&&e.closest(`[data-row-key]`)?.querySelector(`[data-thread-icon-toggle]`)?.focus({preventScroll:!0})}},[]);let c=e.tree;if(!c||c.descendantCount===0)return null;let l=ry(c.descendantCount,c.activity,r);return/* @__PURE__ */ (0,o.jsx)(`button`,{ref:a,type:`button`,"data-thread-summary":!0,className:ey.summary,"aria-label":r(`threadTree.expandSummary`,{title:t,summary:l}),"aria-expanded":!1,"aria-controls":i,onClick:e=>{e.stopPropagation(),e.currentTarget.closest(`[data-row-key]`)?.querySelector(`[data-thread-icon-toggle]`)?.focus({preventScroll:!0}),n()},children:/* @__PURE__ */ (0,o.jsx)(iy,{count:c.descendantCount,activity:c.activity,t:r})})}function gy(e){return e!=null&&e.id.length>0&&e.id!==`01984de2-8f74-7c91-a3b2-5c5e937cf318`}let _y=`(hover: hover) and (pointer: fine)`;function vy(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(_y).matches}function yy(e){return!(!e.nativeThreadIds.has(e.sessionId)||e.blank===!0||e.archived===!0||e.archivedSessionIds.includes(e.sessionId)||e.pinned===!0||e.pinnedSessionIds.includes(e.sessionId)||e.remote===!0||(e.depth??0)>0||e.movingSessionIds?.has(e.sessionId)===!0)}function by(e){return e.moving&&(e.depth??0)===0&&e.blank!==!0&&e.archived!==!0}function xy(e,t){if(t!==void 0)return t.find(t=>gy(t)&&t.threadIds.includes(e))}function Sy(e,t){if(!gy(e)||t.archivedFilter===`only`)return[];let n=new Set(t.pinnedSessionIds),r=new Set(t.archivedSessionIds),i=/* @__PURE__ */ new Set,a=[];for(let o of e.threadIds){if(i.has(o)||t.visibleSessionIds!=null&&!t.visibleSessionIds.has(o))continue;let e=t.byId[o];e===void 0||e.blank||e.origin===`subagent`||r.has(o)||n.has(o)||(i.add(o),a.push(o))}return a}function Cy(e,t,n,r){let i=n??e,a=i!==``&&!t.some(({id:e})=>e===i);return{effectiveTarget:i,targetDeleted:a,canSubmit:!r&&n!==void 0&&!a&&n!==e}}function wy(e,t){if(e.target!==e.currentTarget)return null;let n=t===null?null:String(t),r=null,i=0;for(let t of e.currentTarget.children){let a=t.getAttribute(`data-thread-branch`);if(a===null||n!==null&&t.querySelector(`[data-thread-pinned]`)?.getAttribute(`data-thread-pinned`)!==n){r=null;continue}let{top:o,bottom:s}=t.getBoundingClientRect();if(r!==null&&i<=e.clientY&&e.clientY<=o)return{id:r,half:`after`};r=a,i=s}return null}function Ty(e){return!(e.committed||e.cancelled||e.dropEffect===`copy`)}function Ey(e,t,n,r){if(t.kind===`unsectioned`){let t=n.find(t=>t.id===e.sourceSectionId);return t===void 0||!gy(t)||!t.threadIds.includes(e.sessionId)?null:{sessionId:e.sessionId,sectionId:null,expectedSourceSectionId:t.id}}let i=n.find(e=>e.id===t.sectionId);if(i===void 0||!gy(i))return null;if(t.kind===`section-end`)return e.sourceSectionId===i.id&&i.threadIds.length>0&&i.threadIds[i.threadIds.length-1]===e.sessionId?null:{sessionId:e.sessionId,sectionId:i.id,beforeSessionId:null};if(t.targetSessionId===e.sessionId||!i.threadIds.includes(t.targetSessionId))return null;let a=r?.get(i.id)??i.threadIds,o=a.indexOf(t.targetSessionId);if(o===-1)return null;if(t.half===`before`){if(e.sourceSectionId===i.id){let t=a.indexOf(e.sessionId);if(t!==-1&&o===t+1)return null}return{sessionId:e.sessionId,sectionId:i.id,beforeSessionId:t.targetSessionId}}let s=a[o+1];return s===e.sessionId?null:s===void 0?e.sourceSectionId===i.id&&i.threadIds.length>0&&i.threadIds[i.threadIds.length-1]===e.sessionId?null:{sessionId:e.sessionId,sectionId:i.id,beforeSessionId:null}:i.threadIds.includes(s)?{sessionId:e.sessionId,sectionId:i.id,beforeSessionId:s}:{sessionId:e.sessionId,sectionId:i.id,beforeSessionId:null}}function Dy(e,t,n,r){if(!gy(n))return null;let i=r.indexOf(e);if(i===-1)return null;if(t===`up`){if(i<=0)return null;let t=r[i-1];return t===void 0||t===e||!n.threadIds.includes(t)?null:{sessionId:e,sectionId:n.id,beforeSessionId:t}}if(i>=r.length-1)return null;let a=r[i+2];return a===e?null:a===void 0||!n.threadIds.includes(a)?{sessionId:e,sectionId:n.id,beforeSessionId:null}:{sessionId:e,sectionId:n.id,beforeSessionId:a}}function Oy(e){let t=/* @__PURE__ */ new Set,n=(0,i.createSnapshotStore)(/* @__PURE__ */ new Set);return{movingSessionIds:n,isMoving:e=>t.has(e),async move(r,i={}){if(t.has(r.sessionId))return{status:`skipped-in-flight`};t.add(r.sessionId),n.set(new Set(t));try{let t=await e.execute(r.sessionId,r.sectionId,r.beforeSessionId,r.expectedSourceSectionId);return t?.status===`unknown`&&i.notifyOnError!==!1&&e.onUnknown?.(),t??{status:`committed`}}catch(t){return i.notifyOnError!==!1&&e.onError?.(t),{status:`failed`,error:t}}finally{t.delete(r.sessionId),n.set(new Set(t))}}}}let ky=(e,t)=>{let n=e instanceof Element?e:null;return n===null||t===null||!t.contains(n)||n.closest(`button, a, input, textarea, select, [role='menuitem'], [data-row-actions]`)!==null},Ay=/* @__PURE__ */ new Set;function jy(e){return e(Ay)}function My(e,t){return e.blank?t(`session.new`):e.title||t(`session.untitled`)}function Ny(e,t,n){let{unit:i,n:a}=(0,r.relativeTime)(e,t);return i===`now`?n(`time.now`):n(`time.${i}`,{n:a})}function Py(e,t,n){let{unit:i,n:a}=(0,r.relativeTime)(e,t);return i===`now`?n(`time.now`):n(`time.ago`,{t:n(`time.${i}`,{n:a})})}function Fy(e,t){let n=new Date(e),r=e=>String(e).padStart(2,`0`);return t(`hover.created`,{time:`${t(`date.ymd`,{y:n.getFullYear(),m:n.getMonth()+1,d:n.getDate()})} ${r(n.getHours())}:${r(n.getMinutes())}`})}function Iy({label:e,cwd:t,createdAt:n,t:r}){return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:J.hoverContent,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:J.hoverTitle,children:e}),t!==void 0&&t!==``&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:J.hoverPath,children:t}),n!==void 0&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:J.hoverTime,children:Fy(n,r)})]})}function Ly(e){let t=e.currentTarget.getBoundingClientRect();return e.clientY<t.top+t.height/2?`before`:`after`}function Ry({color:e,state:t,className:n}){return/* @__PURE__ */ (0,o.jsx)(`span`,{className:X(J.remoteFolderGlobe,n),"data-color":e,"data-state":t,"aria-hidden":`true`,children:/* @__PURE__ */ (0,o.jsxs)(`svg`,{viewBox:`0 0 12 12`,width:`10`,height:`10`,fill:`none`,children:[/* @__PURE__ */ (0,o.jsx)(`circle`,{cx:`6`,cy:`6`,r:`4.6`,stroke:`currentColor`,strokeWidth:`1.2`}),/* @__PURE__ */ (0,o.jsx)(`ellipse`,{cx:`6`,cy:`6`,rx:`2.1`,ry:`4.6`,stroke:`currentColor`,strokeWidth:`1.05`}),/* @__PURE__ */ (0,o.jsx)(`path`,{d:`M1.6 6h8.8`,stroke:`currentColor`,strokeWidth:`1.05`})]})})}function zy({group:e,foldedActivity:t,onToggle:n,onCreate:i,copyWorkingDirectory:a,pin:c,actions:l,drag:u,showHost:d=!0,home:f,newShortcut:p,t:m}){let h=e,g=t===void 0?void 0:{pending:`warning`,running:`ongoing`,completed:`done`,idle:void 0}[ny(t)],_=e.remote?void 0:l,v=u,y=hv(h),b=h.workspaceId===void 0?m(`group.ungrouped`):y?m(`group.remoteOtherSessions`):h.label,x=h.remote===void 0?void 0:np(h.remote.hostId,h.remote.color),S=d&&h.workspaceId!==void 0&&h.remote!==void 0,[C,w]=(0,s.useState)(!1),[T,E]=(0,s.useState)(null),D=(0,s.useRef)(null),ee=m(c?.pinned?`menu.unpinWorkspace`:`menu.pinWorkspace`),te=c?.pinned?r.IconPinFillRegular:r.IconPinOutlineRegular,ne=[...c?[{id:`pin`,label:ee,icon:/* @__PURE__ */ (0,o.jsx)(te,{})}]:[],...h.cwd!==void 0&&h.cwd.trim()!==``?[{id:`copy-working-directory`,label:m(`menu.copyWorkingDirectory`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconCopyOutlineRegular,{})}]:[],..._?[{id:`rename`,label:m(`rename`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconEditOutlineRegular,{})},..._.defaultHarness?[{id:`defaultHarness`,label:m(`defaultHarness.title`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconSettingsOutlineRegular,{})}]:[],..._.moveToSection?[{id:`move`,label:m(`menu.moveToSection`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconFolderCloseRegular,{})}]:[],{id:`delete`,label:m(`delete.workspace`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconTrashOutlineRegular,{}),danger:!0}]:[]],re=/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(J.projectRow,C&&J.menuOpen),"data-row-key":`workspace:${e.key}`,role:`treeitem`,"aria-expanded":h.expanded,tabIndex:-1,onContextMenu:e=>{ne.length&&!e.target.closest(`button`)&&(e.preventDefault(),E(new DOMRect(e.clientX,e.clientY,0,0)),w(!0))},onKeyDown:e=>{e.target===e.currentTarget&&ne.length&&(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`)&&(e.preventDefault(),E(null),w(!0))},onClick:n,draggable:v!==void 0,onDragStart:v===void 0?void 0:e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,h.key),v.start()},onDragEnd:v?.end,children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:X(J.slot,h.expanded&&J.folderExpanded),children:[y?/* @__PURE__ */ (0,o.jsx)(r.IconQueueOutlineRegular,{size:16}):h.expanded?/* @__PURE__ */ (0,o.jsx)(r.IconFolderOpenRegular,{}):/* @__PURE__ */ (0,o.jsx)(r.IconFolderCloseRegular,{}),S&&h.remote&&x!==void 0&&/* @__PURE__ */ (0,o.jsx)(Ry,{color:x,state:h.remote.state})]}),S&&h.remote?/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:J.remoteHostText,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.title,children:b}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.remoteHostMeta,children:h.remote.displayName})]}),g===void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.remoteHostStatusDot,"data-state":h.remote.state,"aria-hidden":`true`})]}):/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.projectText,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.title,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.titleText,children:b})})}),g!==void 0&&t!==void 0&&/* @__PURE__ */ (0,o.jsxs)(`span`,{className:J.projectActivity,"data-project-activity":g,children:[/* @__PURE__ */ (0,o.jsx)(r.StateDot,{state:g,size:g===`ongoing`?16:void 0}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.visuallyHidden,children:ty(t).filter(e=>e.count>0).map(e=>m(`threadTree.${e.state}`,{n:e.count})).join(` · `)})]}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:J.rowActions,children:[ne.length>0&&/* @__PURE__ */ (0,o.jsx)(r.Menu,{open:C,onClose:()=>{w(!1)},items:ne,onSelect:e=>{w(!1),e===`pin`&&c?.toggle(),e===`copy-working-directory`&&h.cwd!==void 0&&a(h.cwd),e===`rename`&&_?.rename(),e===`defaultHarness`&&_?.defaultHarness?.(D.current),e===`move`&&_?.moveToSection?.(),e===`delete`&&_?.delete()},portal:!0,autoFocus:!0,getAnchorRect:T===null?void 0:()=>T,anchor:/* @__PURE__ */ (0,o.jsx)(`button`,{ref:D,type:`button`,className:J.iconButton,"aria-label":m(`actions.workspace.aria`,{name:b}),"aria-haspopup":`menu`,"aria-expanded":C,onClick:e=>{e.stopPropagation(),E(null),w(e=>!e)},children:/* @__PURE__ */ (0,o.jsx)(r.IconEllipsisOutlineRegular,{})})}),(!h.remote||h.remote.state===`connected`&&!y)&&/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:m(`actions.newSession`),shortcutKeys:p?.keys,side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:J.iconButton,"aria-keyshortcuts":p?.aria,"aria-label":m(`actions.newSession.aria`,{name:b}),onClick:e=>{e.stopPropagation(),i()},children:/* @__PURE__ */ (0,o.jsx)(r.IconNewChatOutlineRegular,{})})})]})]}),ie=h.cwd!==void 0&&h.cwd!==``?h.cwd:void 0;return h.workspaceId===void 0||ie===void 0&&h.createdAt===void 0?re:/* @__PURE__ */ (0,o.jsx)(r.HoverCard,{anchor:re,content:/* @__PURE__ */ (0,o.jsx)(Iy,{label:b,cwd:ie===void 0?void 0:lh(ie,f),createdAt:h.createdAt,t:m}),openDelayMs:800,disabled:C,copyText:ie,copyLabel:m(`copy`),copiedLabel:m(`hover.copied`)})}function By({node:e,now:t,renderSlot:n,t:i}){let a=Mg(e,i).filter(t=>!e.archived||t.state!==`done`&&t.state!==`idle`),s=e.remote===void 0?void 0:np(e.remote.hostId,e.remote.color),c=e.remote?.state===`connected`?i(`host.connected`):e.remote?.state===`connecting`?i(`host.connecting`):i(`host.disconnected`);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:J.hoverContent,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:J.hoverTitle,children:My(e,i)}),e.remote&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:J.hoverHost,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.hoverHostDot,"data-color":s,"data-state":e.remote.state,"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:`${e.remote.displayName} · ${c}`})]}),e.cwd&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:J.hoverPath,children:e.cwd}),!e.blank&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:J.hoverTime,children:Py(e.updatedAt,t,i)}),n(`sidebar.session.row.hover`,{sessionId:e.id}),a.map(e=>/* @__PURE__ */ (0,o.jsxs)(`div`,{className:J.hoverStatus,children:[/* @__PURE__ */ (0,o.jsx)(r.StateDot,{state:e.state}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:e.label})]},e.label)),e.archived&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(J.hoverStatus,J.hoverArchived),children:[/* @__PURE__ */ (0,o.jsx)(r.IconArchiveOutlineRegular,{size:16}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:i(`row.archived`)})]})]})}function Vy({result:e,currentId:t,onOpen:n,onUnarchive:i,t:a}){let s=e.id===t,c=Mg(e,a),l=c[0];return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(J.searchResultRow,s&&J.selected,e.archived&&J.archived),role:`treeitem`,"aria-selected":s,"aria-description":e.archived?a(`toast.archivedNotOpenable`):void 0,"data-row-key":`search:${e.id}`,tabIndex:-1,onClick:()=>{n(e.id)},children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:J.searchResultHeading,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.slot}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.searchResultTitle,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.titleText,children:e.title||a(`session.untitled`)})}),e.remote&&/* @__PURE__ */ (0,o.jsx)(dv,{host:e.remote,variant:`session`,t:a}),!e.archived&&l.state!==`idle`&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.timeStatus,"data-session-status":l.state,children:/* @__PURE__ */ (0,o.jsx)(Pg,{statuses:c})}),e.archived&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.rowActions,children:/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:a(`actions.unarchive`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:J.iconButton,"aria-label":a(`menu.unarchiveSession`),onClick:t=>{t.stopPropagation(),i(e.id)},children:/* @__PURE__ */ (0,o.jsx)(r.IconUnarchiveOutlineRegular,{size:16})})})})]}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:J.searchResultMeta,children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:J.searchResultWorkspace,children:[e.workspace||a(`group.ungrouped`),e.parentTitle!==void 0&&` · ${e.parentTitle||a(`session.untitled`)}`]}),e.snippet!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.searchResultSnippet,children:e.snippet})]})]})}let Hy=(0,s.memo)(function({node:e,rowKey:t=`session:${e.id}`,currentId:n,now:i,onOpen:a,onRenameRequest:c,renderSlot:l,onReveal:u,drag:d,useMovingSectionSessions:f=jy,showHost:p=!0,t:m}){let h=e,{expansion:g,toggle:_,markCompletionsRead:v,collapseStyle:y}=Zv(),b=fy(),x=e.tree,S=x?.depth??0,C=!h.archived&&x!==void 0&&x.activity.completed>0?()=>{v(x.descendantIds.map(nh))}:void 0,w=g[e.id]===!0,T=S===0?d:void 0,E=f(t=>t.has(e.id)),D=by({depth:S,blank:h.blank,archived:h.archived,moving:E}),ee=My(e,m),te=e.id===n,ne=Mg(e,m),re=ne[0],ie=!h.archived&&re.state!==`idle`,ae=h.remote===void 0?void 0:np(h.remote.hostId,h.remote.color),oe=p&&h.remote!==void 0&&ae!==void 0,se=T!==void 0&&T.canDrag!==!1&&!D&&!h.blank&&!h.archived,O=h.blank?void 0:h.reference,k=se||O!==void 0,ce=(0,s.useRef)(!1),le=(0,s.useRef)(new uv),ue=(0,s.useRef)(void 0);(0,s.useEffect)(()=>()=>window.clearTimeout(ue.current),[]);let de=()=>{ce.current||(te&&!h.archived&&e.tree?.descendantCount?(w&&v(e.tree.descendantIds),_(e.id,!w,b)):a(e.id))},[A,fe]=(0,s.useState)(!1),[j,pe]=(0,s.useState)(null),me=(0,s.useMemo)(()=>[A,fe],[A]),he=(0,s.useRef)(null);(0,s.useEffect)(()=>{u!==void 0&&(he.current?.scrollIntoView({block:`nearest`}),u())},[u]);let ge=/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:he,"data-row-key":t,"data-thread-parent":e.tree?.parentId??void 0,"data-thread-depth":S,"data-thread-sortable":String(se),"data-thread-pinned":String(e.pinned),"data-section-moving":D?`true`:void 0,style:{"--dsh-thread-indent":`${Math.min(S,3)*24}px`},className:X(J.sessionRow,te&&J.selected,A&&J.menuOpen,h.archived&&J.archived,D&&J.sectionMoving,T?.marker===`before`&&J.dropBefore,T?.marker===`after`&&J.dropAfter),role:`treeitem`,"aria-selected":te,"aria-current":te?`page`:void 0,"aria-busy":D||void 0,"aria-level":S+1,"aria-expanded":e.tree?.descendantCount?w:void 0,tabIndex:-1,onContextMenu:e=>{h.blank||e.target.closest(`button`)||(e.preventDefault(),pe(new DOMRect(e.clientX,e.clientY,0,0)),fe(!0))},onKeyDown:t=>{t.target!==t.currentTarget||h.blank||(ce.current=!1,t.key===`ContextMenu`||t.shiftKey&&t.key===`F10`?(t.preventDefault(),pe(null),fe(!0)):t.key===`F2`&&!h.archived&&(t.preventDefault(),c(e.id,h.title)))},"aria-description":h.archived?m(`toast.archivedNotOpenable`):void 0,onPointerDown:e=>{ce.current=!1,e.isPrimary&&e.button===0&&(ky(e.target,he.current)||le.current.down(e.pointerId))},onPointerLeave:()=>{le.current.abandonPress()},onPointerUp:e=>{e.isPrimary&&e.button===0&&(ky(e.target,he.current)?le.current.abandonPress():le.current.orphanUp(e.pointerId)&&(window.clearTimeout(ue.current),ue.current=window.setTimeout(()=>{le.current.takeFallback()&&de()},32)))},onPointerCancel:()=>{le.current.cancel(),window.clearTimeout(ue.current)},onClick:()=>{le.current.clicked(),window.clearTimeout(ue.current),de()},draggable:k,onDragStart:k?t=>{ce.current=!0,le.current.cancel(),t.dataTransfer.effectAllowed=O===void 0?`move`:se?`copyMove`:`copy`,t.dataTransfer.setData(`text/plain`,O===void 0?e.id:mh(O).clipboardText),O!==void 0&&t.dataTransfer.setData(`application/x-codexhost-thread-reference`,JSON.stringify(O)),se&&T?.start()}:void 0,onDragEnd:k?e=>T?.end(e.dataTransfer.dropEffect===`copy`):void 0,onDragOver:T===void 0?void 0:e=>{T.active&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`,T.hover(Ly(e)))},onDrop:T===void 0?void 0:e=>{T.active&&e.dataTransfer.dropEffect!==`copy`&&(e.preventDefault(),e.stopPropagation(),T.drop(Ly(e),e.dataTransfer.dropEffect))},children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:J.sessionMain,children:/* @__PURE__ */ (0,o.jsx)(lv,{identityLabel:e.tree?.descendantCount?!w&&y===`ring`?m(`threadTree.expandSummary`,{title:ee,summary:ry(e.tree.descendantCount,e.tree.activity,m)}):m(w?`threadTree.collapse`:`threadTree.expand`,{n:e.tree.descendantCount}):void 0,identityExpanded:e.tree?.descendantCount?w:void 0,identityControls:b,identity:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[l(`sidebar.session.row.identity`,{sessionId:e.id}),!w&&y===`ring`&&!!e.tree?.descendantCount&&/* @__PURE__ */ (0,o.jsx)(sy,{activity:e.tree.activity}),oe&&h.remote&&ae!==void 0&&/* @__PURE__ */ (0,o.jsx)(Ry,{color:ae,state:h.remote.state,className:J.remoteSessionGlobe})]}),ambient:!h.archived&&!h.blank&&!ie&&l(`sidebar.session.row.leading`,{sessionId:e.id}),titlePrefix:l(`sidebar.session.row.titlePrefix`,{sessionId:e.id}),title:ee,onIdentityClick:e.tree?.descendantCount?t=>{t.stopPropagation(),_(e.id,!w,b)}:void 0,children:/* @__PURE__ */ (0,o.jsxs)(`span`,{className:J.trailing,children:[!h.blank&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:X(J.time,(ie||D)&&J.timeStatus),"data-session-status":ie?re.state:void 0,"data-section-moving-indicator":D?`true`:void 0,children:ie?/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(Pg,{statuses:ne}),re.trailingLabel!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{"aria-hidden":`true`,children:re.trailingLabel})]}):D?/* @__PURE__ */ (0,o.jsx)(r.StateDot,{state:`ongoing`,size:14,className:J.sectionMovingSpinner}):Ny(h.updatedAt,i,m)}),!h.blank&&/* @__PURE__ */ (0,o.jsxs)(`span`,{className:J.rowActions,"data-row-actions":``,onClick:e=>{e.stopPropagation()},children:[/* @__PURE__ */ (0,o.jsx)(r.Menu,{open:A,onClose:()=>{fe(!1)},portal:!0,autoFocus:!0,phoneSidebarTitle:ee,phoneSidebarFooterBackLabel:m(`session.backToList`),phoneSidebarDetails:/* @__PURE__ */ (0,o.jsx)(`div`,{className:J.phoneDetails,children:/* @__PURE__ */ (0,o.jsx)(By,{node:e,now:i,renderSlot:l,t:m})}),getAnchorRect:j===null?void 0:()=>j,anchor:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:J.iconButton,"aria-label":m(`actions.session.aria`,{name:ee}),"aria-haspopup":`menu`,"aria-expanded":A,onClick:()=>{pe(null),fe(e=>!e)},children:/* @__PURE__ */ (0,o.jsx)(r.IconEllipsisOutlineRegular,{})}),children:l(`sidebar.workspaces.session.menu.item`,{sessionId:e.id,displayTitle:h.title,threadTreeChild:S>0,...C===void 0?{}:{markChildThreadsRead:C}},{hookContext:me})}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.quickActions,children:l(`sidebar.workspaces.session.row.action`,{sessionId:e.id,displayTitle:h.title,threadTreeChild:S>0})})]})]})})}),!w&&y===`summary`&&/* @__PURE__ */ (0,o.jsx)(hy,{node:e,title:ee,toggle:()=>_(e.id,!0,b),t:m})]});return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.HoverCard,{anchor:ge,content:/* @__PURE__ */ (0,o.jsx)(By,{node:e,now:i,renderSlot:l,t:m}),openDelayMs:800,disabled:A||T?.active===!0,copyText:h.blank||h.title===``?void 0:h.title,copyLabel:m(`copy`),copiedLabel:m(`hover.copied`)}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:J.visuallyHidden,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:D?m(`section.moving`):null})]})},(e,t)=>e.node===t.node&&e.rowKey===t.rowKey&&e.showHost===t.showHost&&e.node.id===e.currentId==(t.node.id===t.currentId)&&e.now===t.now&&e.onOpen===t.onOpen&&e.onRenameRequest===t.onRenameRequest&&e.onReveal===t.onReveal&&e.drag===t.drag&&e.useMovingSectionSessions===t.useMovingSectionSessions&&e.renderSlot===t.renderSlot&&e.t===t.t),Uy=`@deepseek-ai/dsh-client-ui-workspace/ActivityViewList.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Uy)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Uy,e.textContent=`.lGfYeW_toolbar{min-height:30px;margin:0 calc(var(--dsh-session-list-edge-inset) - 4px) 6px 0;border-bottom:1px solid color-mix(in srgb, var(--dsw-alias-border-l3) 34%, transparent);flex:none;justify-content:space-between;align-items:center;gap:8px;padding:2px 6px 6px 8px;display:flex}.lGfYeW_titleGroup{white-space:nowrap;flex:1;align-items:center;gap:5px;min-width:0;font-size:12px;line-height:17px;display:inline-flex;overflow:hidden}.lGfYeW_title{color:var(--dsw-alias-label-secondary);flex:none;font-weight:500}.lGfYeW_unreadMeta{text-overflow:ellipsis;font-variant-numeric:tabular-nums;min-width:0;color:var(--dsw-alias-label-tertiary);overflow:hidden}.lGfYeW_markAllReadButton{height:24px;font:inherit;color:var(--dsw-alias-state-business-primary);cursor:pointer;white-space:nowrap;background:0 0;border:none;border-radius:6px;flex:none;justify-content:center;align-items:center;padding:0 8px;font-size:12px;font-weight:500;line-height:16px;transition:background-color .12s,color .12s,opacity .12s;display:inline-flex}.lGfYeW_markAllReadButton:hover:not(:disabled){background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 10%, transparent)}.lGfYeW_markAllReadButton:active:not(:disabled){background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 16%, transparent)}.lGfYeW_markAllReadButton:disabled{color:var(--dsw-alias-label-tertiary);opacity:.45;cursor:default}.lGfYeW_markAllReadButton:focus-visible,.lGfYeW_backButton:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.lGfYeW_emptyState{text-align:center;color:var(--dsw-alias-label-tertiary);flex-direction:column;align-items:center;gap:8px;margin-top:72px;padding:0 16px;font-size:13px;line-height:20px;display:flex}.lGfYeW_emptyIcon{color:var(--dsw-alias-label-caption);opacity:.85;margin-bottom:4px}.lGfYeW_emptyTitle{color:var(--dsw-alias-label-tertiary)}.lGfYeW_backButton{cursor:pointer;font:inherit;color:var(--dsw-alias-link);background:0 0;border:none;border-radius:6px;margin-top:2px;padding:4px 10px;font-size:13px;font-weight:500;line-height:20px;transition:background-color .12s}.lGfYeW_backButton:hover{background:var(--dsw-alias-interactive-bg-hover)}@media (hover:none),(pointer:coarse){.lGfYeW_markAllReadButton{min-height:32px;padding:0 10px}.lGfYeW_backButton{min-height:36px;padding:6px 12px}}@media (prefers-reduced-motion:reduce){.lGfYeW_markAllReadButton,.lGfYeW_backButton{transition:none}}`,document.head.appendChild(e)}var Wy={backButton:`lGfYeW_backButton`,emptyIcon:`lGfYeW_emptyIcon`,emptyState:`lGfYeW_emptyState`,emptyTitle:`lGfYeW_emptyTitle`,markAllReadButton:`lGfYeW_markAllReadButton`,title:`lGfYeW_title`,titleGroup:`lGfYeW_titleGroup`,toolbar:`lGfYeW_toolbar`,unreadMeta:`lGfYeW_unreadMeta`};function Gy({size:e=16,className:t}){return/* @__PURE__ */ (0,o.jsxs)(`svg`,{width:e,height:e,className:t,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:1.2,strokeLinecap:`round`,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,o.jsx)(`path`,{d:`M2.5 4.5h11`}),/* @__PURE__ */ (0,o.jsx)(`path`,{d:`M4.5 8h7`}),/* @__PURE__ */ (0,o.jsx)(`path`,{d:`M6.5 11.5h3`})]})}function Ky({projection:e,currentId:t,ready:n,animationResetKey:r,scrollRef:i,onScroll:a,singleRemoteHostScoped:s=!1,onOpen:c,onSessionRenameRequest:l,onMarkAllRead:u,onExit:d,renderSlot:f,t:p}){let m=Zv(),{rows:h,unreadSessionIds:g,unreadCount:_}=e,v=Date.now(),y=h.length===0?[`empty:activity`]:m.rows(h).map(e=>`session:${e.id}`);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(Z.treeBody,Z.wide),children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Wy.toolbar,role:`region`,"aria-label":p(`activityView.label`),children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Wy.titleGroup,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Wy.title,children:p(`activityView.label`)}),_>0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Wy.unreadMeta,children:p(_===1?`activityView.unreadCount.one`:`activityView.unreadCount.other`,{n:_})})]}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Wy.markAllReadButton,disabled:_===0,onClick:()=>{u(g)},children:p(`activityView.markAllRead`)})]}),/* @__PURE__ */ (0,o.jsx)(cv,{className:X(Z.list,Z.flatList),label:p(`activityView.label`),rowKeys:y,ready:n,resetKey:r,scrollRef:i,onScroll:a,children:h.length===0?/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Wy.emptyState,"data-row-key":`empty:activity`,children:[/* @__PURE__ */ (0,o.jsx)(Gy,{size:22,className:Wy.emptyIcon}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:Wy.emptyTitle,children:p(`activityView.empty`)}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Wy.backButton,onClick:d,children:p(`activityView.backToAll`)})]}):/* @__PURE__ */ (0,o.jsx)(py,{roots:h,children:e=>/* @__PURE__ */ (0,o.jsx)(Hy,{node:e,showHost:!s,currentId:t,now:v,onOpen:c,onRenameRequest:l,renderSlot:f,t:p},e.id)})}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.fade})]})}function qy(e){return/* @__PURE__ */ (0,o.jsx)(r.RemotePluginIcon,{id:e,...(0,r.harnessIconSources)(e),size:16,fallback:/* @__PURE__ */ (0,o.jsx)(r.IconDataOutlineRegular,{size:16})})}async function Jy(e,t){let n=`workspace/defaultHarness`,r=await fetch(`api/${n}`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({type:`client-request`,rpcId:globalThis.crypto?.randomUUID?.()??`project-default-${Date.now()}`,method:n,payload:{args:{request:e}}}),...t===void 0?{}:{signal:t}});if(!r.ok)throw Error(`HTTP ${r.status}`);let{result:i}=await r.json();if(!i.ok)throw Error(i.error.message);return i.value}function Yy({workspaceId:e,title:t,t:n,onClose:i}){let[a,c]=(0,s.useState)(),l=(0,s.useId)(),[u,d]=(0,s.useState)(`global`),[f,p]=(0,s.useState)(``),[m,h]=(0,s.useState)(!1),[g,_]=(0,s.useState)(!1),[v,y]=(0,s.useState)();(0,s.useEffect)(()=>{let t=new AbortController;return Jy({workspaceId:e},t.signal).then(e=>{if(t.signal.aborted)return;let n=e;c(n),d(n.selection.mode),p(n.selection.mode===`manual`?n.selection.harnessId:``)}).catch(()=>{t.signal.aborted||y(`loadFailed`)}),()=>t.abort()},[e]);let b=a?.harnesses.map(({id:e,name:t})=>({id:e,label:t,icon:qy(e)}))??[],x=a?.selection.mode===`manual`?a.selection.harnessId:void 0;if(x&&!b.some(({id:e})=>e===x)){let e=x;b.push({id:e,label:n(`defaultHarness.unavailable`,{name:e}),icon:qy(e),disabled:!0})}let S=b.find(({id:e})=>e===f),C=u===`manual`?{mode:u,harnessId:f}:{mode:u},w=a===void 0||u===a.selection.mode&&(u!==`manual`||a.selection.mode===`manual`&&f===a.selection.harnessId),T=u===`manual`&&(!S||S.disabled),E=()=>{g||i()},D=async()=>{if(!(g||w||T)){_(!0),y(void 0);try{await Jy({workspaceId:e,selection:C}),i()}catch{y(`saveFailed`),_(!1)}}};return/* @__PURE__ */ (0,o.jsxs)(r.Modal,{open:!0,onClose:E,closeLabel:n(`close`),title:n(`defaultHarness.title`),description:n(`defaultHarness.description`,{name:t}),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,disabled:g,onClick:E,children:n(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`primary`,disabled:g||w||T,onClick:()=>void D(),children:n(`defaultHarness.save`)})]}),children:[a?/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.defaultHarnessOptions,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{role:`radiogroup`,"aria-label":n(`defaultHarness.title`),children:[`global`,`last`,`manual`].map(e=>/* @__PURE__ */ (0,o.jsxs)(`label`,{className:Z.defaultHarnessOption,children:[/* @__PURE__ */ (0,o.jsx)(`input`,{type:`radio`,name:l,value:e,checked:u===e,disabled:g,onChange:()=>{d(e),h(!1)}}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:Z.defaultHarnessOptionText,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.defaultHarnessOptionTitle,children:n(`defaultHarness.${e}`)}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.defaultHarnessOptionDesc,children:n(`defaultHarness.${e}.desc`)})]})]},e))}),u===`manual`&&/* @__PURE__ */ (0,o.jsx)(r.Menu,{open:m,portal:!0,autoFocus:!0,listClassName:Z.defaultHarnessMenu,items:b,selectedId:f,onClose:()=>h(!1),onSelect:e=>{p(e),h(!1)},anchor:/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:`${Z.renameInput} ${Z.defaultHarnessTrigger}`,"aria-label":S?n(`defaultHarness.select`,{name:S.label}):n(`defaultHarness.choose`),"aria-haspopup":`menu`,"aria-expanded":m,disabled:g,onClick:()=>h(!m),children:[S?.icon,/* @__PURE__ */ (0,o.jsx)(`span`,{children:S?.label??n(`defaultHarness.choose`)}),/* @__PURE__ */ (0,o.jsx)(r.IconChevronDownOutlineRegular,{size:14})]})})]}):v===void 0?/* @__PURE__ */ (0,o.jsx)(`div`,{role:`status`,children:n(`defaultHarness.loading`)}):null,v&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:n(`defaultHarness.${v}`)})]})}let Xy=`@deepseek-ai/dsh-client-ui-workspace/SectionHeading.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Xy)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Xy,e.textContent=`.Z54rEq_heading{border-radius:var(--dsw-radius-sm);min-height:30px;color:var(--dsw-alias-label-tertiary);align-items:center;gap:6px;padding:0 8px;font-size:14px;font-weight:500;line-height:21px;display:flex}.Z54rEq_heading[data-row-key]{cursor:pointer}.Z54rEq_heading[data-row-key]:hover{background:var(--dsw-alias-interactive-bg-hover)}.Z54rEq_heading[data-project-drop-active]{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:-2px}.Z54rEq_heading.Z54rEq_dropTarget{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 12%, transparent);box-shadow:inset 0 0 0 1px var(--dsw-alias-state-business-primary);color:var(--dsw-alias-label-primary)}.Z54rEq_heading[data-row-key]:focus-visible,.Z54rEq_action:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.Z54rEq_title{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.Z54rEq_chevron,.Z54rEq_collapsed{flex-shrink:0}.Z54rEq_collapsed{transform:rotate(-90deg)}.Z54rEq_trailing{align-items:center;min-width:0;margin-inline-start:auto;display:inline-flex}.Z54rEq_action{border-radius:var(--dsw-radius-sm);width:24px;height:24px;color:inherit;cursor:pointer;background:0 0;border:none;place-items:center;margin-inline-start:auto;padding:0;display:grid}.Z54rEq_actionAfterTrailing{margin-inline-start:0}.Z54rEq_action:hover{background:var(--dsw-alias-interactive-bg-hover)}@media (hover:none),(pointer:coarse){.Z54rEq_heading{min-height:44px}.Z54rEq_action{width:44px;min-width:44px;height:44px;min-height:44px}}[data-phone-drawer] .Z54rEq_heading{min-height:44px}[data-phone-drawer] .Z54rEq_action{width:44px;min-width:44px;height:44px;min-height:44px}`,document.head.appendChild(e)}var Zy={action:`Z54rEq_action`,actionAfterTrailing:`Z54rEq_actionAfterTrailing`,chevron:`Z54rEq_chevron`,collapsed:`Z54rEq_collapsed`,dropTarget:`Z54rEq_dropTarget`,heading:`Z54rEq_heading`,title:`Z54rEq_title`,trailing:`Z54rEq_trailing`};function Qy({label:e,icon:t,expanded:n,onToggle:i,rowKey:a,trailing:s,action:c,projectDrop:l,dropTarget:u=!1,onDragOver:d,onDrop:f}){let p=d||f?void 0:l,m=n!==void 0&&i!==void 0&&a!==void 0,h=/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[t,/* @__PURE__ */ (0,o.jsx)(`span`,{className:Zy.title,children:e}),m&&/* @__PURE__ */ (0,o.jsx)(r.IconChevronDownOutlineRegular,{className:n?Zy.chevron:Zy.collapsed,size:12}),s!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Zy.trailing,onClick:e=>{e.stopPropagation()},children:s}),c!==void 0&&/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:c.label,portal:!0,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:X(Zy.action,s!==void 0&&Zy.actionAfterTrailing),"aria-label":c.label,onClick:e=>{e.stopPropagation(),c.onActivate()},children:c.icon})})]});return m?/* @__PURE__ */ (0,o.jsx)(`div`,{className:X(Zy.heading,u&&Zy.dropTarget),role:`treeitem`,tabIndex:-1,"data-row-key":a,"data-section-drop-target":u||void 0,"aria-label":e,"data-project-drop-active":p?.active||void 0,onDragOver:p?e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`,p.hover()}:d,onDragLeave:p&&(e=>{e.relatedTarget instanceof Node&&e.currentTarget.contains(e.relatedTarget)||p.leave()}),onDrop:p?e=>{e.preventDefault(),e.stopPropagation(),p.drop()}:f,"aria-expanded":n,onClick:i,children:h}):/* @__PURE__ */ (0,o.jsx)(`div`,{className:X(Zy.heading,u&&Zy.dropTarget),"data-section-drop-target":u||void 0,onDragOver:d,onDrop:f,children:h})}let $y=`@deepseek-ai/dsh-client-ui-workspace/PinnedSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify($y)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=$y,e.textContent=`.t4p6JG_section{margin-bottom:8px}.t4p6JG_section>*+[data-thread-branch]{margin-top:2px}.t4p6JG_empty{border-radius:var(--dsw-radius-sm);color:var(--dsw-alias-label-tertiary);padding:4px 8px 6px 26px;font-size:12px;line-height:18px}.t4p6JG_emptyDropTarget{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 12%, transparent);box-shadow:inset 0 0 0 1px var(--dsw-alias-state-business-primary);color:var(--dsw-alias-label-primary)}`,document.head.appendChild(e)}var eb={empty:`t4p6JG_empty`,emptyDropTarget:`t4p6JG_emptyDropTarget`,section:`t4p6JG_section`};function tb({rows:e,customSection:t,headingActions:n,sectionDrag:i,currentId:a,onOpen:s,onRenameRequest:c,renderSlot:l,useMovingSectionSessions:u,t:d,revealSessionId:f,onSessionRevealed:p,showHost:m=!0,expanded:h,onToggle:g,leadingChildren:_,children:v,hasWorkspaces:y=!1,hasExtraItems:b=!1}){if(e.length===0&&!y&&!b&&!t)return null;let x=t?.section,S=x?.name??d(`section.pinned`),C=x!==void 0&&gy(x),w=Array.isArray(v)?v.length>0:!!v,T=C&&x!==void 0&&i?.active===!0,E=T&&i.over?.kind===`section-end`&&i.over.sectionId===x.id,D=T&&x!==void 0?e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`,i.hoverSectionEnd(x.id)}:void 0,ee=T&&x!==void 0?e=>{e.dataTransfer.dropEffect!==`copy`&&(e.preventDefault(),e.stopPropagation(),i.dropSectionEnd(x.id,e.dataTransfer.dropEffect))}:void 0;return/* @__PURE__ */ (0,o.jsxs)(`div`,{role:`group`,"aria-label":S,className:eb.section,"data-sidebar-pinned":!t||void 0,"data-sidebar-custom-section":x?.id,onDragOver:!t&&i?.active?()=>{i.clearHover()}:void 0,children:[/* @__PURE__ */ (0,o.jsx)(Qy,{label:S,icon:t?void 0:/* @__PURE__ */ (0,o.jsx)(r.IconPinOutlineRegular,{size:14}),trailing:n,expanded:h,onToggle:g,rowKey:`section:${t?.key??`pinned`}`,projectDrop:t?.projectDrop,dropTarget:E,onDragOver:D,onDrop:ee}),h&&_,h&&e.length>0&&/* @__PURE__ */ (0,o.jsx)(py,{roots:e,children:e=>{let t=C&&x!==void 0&&i!==void 0?{canDrag:i.canDragRow(e),start:()=>{i.startFromSection(e.id,x.id)},active:i.active&&!e.blank&&!e.archived&&e.id!==i.draggedSessionId,marker:i.over?.kind===`section-row`&&i.over.sectionId===x.id&&i.over.targetSessionId===e.id?i.over.half:null,hover:t=>{i.hoverSectionRow(x.id,e.id,t)},drop:(t,n)=>{i.dropSectionRow(x.id,e.id,t,n)},end:()=>{i.end()}}:void 0;return/* @__PURE__ */ (0,o.jsx)(Hy,{node:e,showHost:m,currentId:a,now:Date.now(),onOpen:s,onRenameRequest:c,renderSlot:l,onReveal:e.id===f?()=>p(e.id):void 0,drag:t,useMovingSectionSessions:u,t:d},e.id)}}),h&&w&&v,h&&t!==void 0&&e.length===0&&!w&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:X(eb.empty,E&&eb.emptyDropTarget),"data-section-drop-empty":x?.id,onDragOver:D,onDrop:ee,children:d(`section.empty`)})]})}function nb({list:e,refreshSessions:t,loadMoreSessions:n,t:r}){return e.listError?/* @__PURE__ */ (0,o.jsxs)(`div`,{role:`alert`,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{children:e.listError}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.sessionOverflowButton,disabled:e.loading,onClick:()=>{e.listErrorPage===`more`?n():t()},children:r(`sessions.retry`)})]}):null}function rb({rowKey:e,hiddenCount:t,hasMore:n,loading:r,workspaceHistory:i,workspaceId:a,fillWorkspace:c,expanded:l,expand:u,collapse:d,loadMoreSessions:f,t:p}){if((0,s.useEffect)(()=>{c&&f(a)},[c,f,a]),t===0&&!n&&!d)return null;let m=t===0&&n&&r,h=i===`retry`?`sessions.retryWorkspaceHistory`:i===`continue`?`sessions.continueWorkspaceHistory`:i===`search`?`sessions.searchWorkspaceHistory`:`sessions.expandMore`;return/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,"data-row-key":e,className:Z.sessionOverflowButton,"aria-expanded":l,disabled:m,onClick:()=>{t>0?u?.():n?(u?.(),f(a)):d?.()},children:m?p(`sessions.loading`):t>0?p(`sessions.expand`,{n:Math.min(10,t)}):p(n?h:`sessions.collapse`)})}function ib({current:e,sections:t,dismiss:n,move:i,defaultLabel:a,failedLabel:c,busy:l=!1,disabled:u=!1,blockedMessage:d,deletedTargetLabel:f,t:p}){let[m,h]=(0,s.useState)(),[g,_]=(0,s.useState)(!1),v=l||g,{effectiveTarget:y,targetDeleted:b,canSubmit:x}=Cy(e,t,m,v||u),[S,C]=(0,s.useState)(!1),w=d??(b?f:void 0)??(S?c:void 0),T=(0,s.useRef)(!1),E=()=>{!T.current&&!l&&n()},D=async()=>{if(!T.current&&x){T.current=!0,_(!0),C(!1);try{await i(y||null)!==!1&&n()}catch{C(!0)}finally{T.current=!1,_(!1)}}};return/* @__PURE__ */ (0,o.jsxs)(r.Modal,{phoneSidebar:!0,open:!0,title:p(`menu.moveToSection`),closeLabel:p(`close`),onClose:E,footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,disabled:v,onClick:E,children:p(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`primary`,disabled:!x,onClick:()=>void D(),children:p(`section.move`)})]}),children:[/* @__PURE__ */ (0,o.jsxs)(`select`,{className:Z.renameInput,"aria-label":p(`section.destination`),value:y,disabled:v||u,"data-modal-autofocus":!0,onChange:({target:e})=>{h(e.value),f!==void 0&&C(!1)},children:[b&&/* @__PURE__ */ (0,o.jsx)(`option`,{value:y,disabled:!0,children:p(f===void 0?`section.destination`:`section.targetDeletedOption`)}),/* @__PURE__ */ (0,o.jsx)(`option`,{value:``,children:a}),t.map(({id:e,name:t})=>/* @__PURE__ */ (0,o.jsx)(`option`,{value:e,children:t},e))]}),w!==void 0&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:w})]})}let ab=`@deepseek-ai/dsh-client-ui-workspace/HostScopeFilter.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(ab)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=ab,e.textContent=`.jFA5LW_tabBarRow{border-bottom:1px solid var(--dsw-alias-border-l2,#80808024);flex:none;align-items:flex-end;gap:6px;margin:0 4px 6px;display:flex}.jFA5LW_tabBar{scrollbar-width:none;flex:1;align-items:center;gap:12px;min-width:0;padding:0;display:flex;overflow:auto hidden}.jFA5LW_tabBar::-webkit-scrollbar{display:none}.jFA5LW_tabTrailing{flex:none;align-items:center;padding-bottom:3px;display:inline-flex}.jFA5LW_tabItem{max-width:136px;color:var(--dsw-alias-label-secondary);font:inherit;white-space:nowrap;cursor:pointer;-webkit-tap-highlight-color:transparent;transition:color .12s var(--ds-ease-in-out);background:0 0;border:none;border-radius:0;flex:none;align-items:center;gap:5px;padding:3px 1px 7px;font-size:12.5px;font-weight:500;line-height:16px;display:inline-flex;position:relative}.jFA5LW_tabItem:hover{color:var(--dsw-alias-label-primary)}.jFA5LW_tabItemActive{color:var(--dsw-alias-label-primary);font-weight:600}.jFA5LW_tabItemActive:after{content:"";background:var(--dsw-alias-label-primary);border-radius:2px;height:1.5px;position:absolute;bottom:0;left:0;right:0}.jFA5LW_tabItem:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px;border-radius:4px}.jFA5LW_iconTrigger{width:24px;height:24px;color:var(--dsw-alias-label-tertiary);cursor:pointer;-webkit-tap-highlight-color:transparent;transition:background-color .12s var(--ds-ease-in-out), color .12s var(--ds-ease-in-out);background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;padding:0;display:inline-flex;position:relative}.jFA5LW_iconTrigger:hover,.jFA5LW_iconTriggerOpen{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.jFA5LW_iconTriggerActive{color:var(--dsw-alias-state-business-primary);background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 10%, transparent)}.jFA5LW_iconTriggerActive:hover,.jFA5LW_iconTriggerActive.jFA5LW_iconTriggerOpen{color:var(--dsw-alias-state-business-primary);background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 16%, transparent)}.jFA5LW_iconTrigger:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.jFA5LW_iconTriggerPip{background:var(--dsw-alias-state-business-primary);border-radius:50%;width:5px;height:5px;position:absolute;top:3px;right:3px}.jFA5LW_tabLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.jFA5LW_tabDot{--ch-peer-dot-color:#3b76cc;background:var(--dsw-alias-label-tertiary);opacity:.45;border-radius:50%;flex:none;width:5px;height:5px}.jFA5LW_anchorRoot{align-items:center;min-width:0;display:inline-flex;position:relative}.jFA5LW_trigger{max-width:128px;height:22px;color:var(--dsw-alias-label-tertiary);font:inherit;cursor:pointer;transition:background-color .12s var(--ds-ease-in-out), color .12s var(--ds-ease-in-out);background:0 0;border:none;border-radius:6px;align-items:center;gap:4px;padding:0 6px;font-size:11.5px;font-weight:500;line-height:16px;display:inline-flex}.jFA5LW_trigger:hover,.jFA5LW_triggerOpen{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.jFA5LW_triggerActive{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 10%, transparent);color:var(--dsw-alias-state-business-primary)}.jFA5LW_triggerActive:hover,.jFA5LW_triggerActive.jFA5LW_triggerOpen{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 16%, transparent);color:var(--dsw-alias-state-business-primary)}.jFA5LW_trigger:focus-visible,.jFA5LW_hostRow:focus-visible,.jFA5LW_segmentButton:focus-visible,.jFA5LW_perHostTrigger:focus-visible,.jFA5LW_footerAction:focus-visible,.jFA5LW_resetLink:focus-visible,.jFA5LW_miniLink:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.jFA5LW_triggerLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.jFA5LW_triggerChevron{opacity:.65;flex:none}.jFA5LW_dot{--ch-peer-dot-color:#3b76cc;background:var(--dsw-alias-label-tertiary);opacity:.5;border-radius:50%;flex:none;width:6px;height:6px}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=blue]{--ch-peer-dot-color:#3b76cc}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=purple]{--ch-peer-dot-color:#7460cc}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=cyan]{--ch-peer-dot-color:#0e8fa8}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=green]{--ch-peer-dot-color:#2f8c70}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=amber]{--ch-peer-dot-color:#c27803}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=rose]{--ch-peer-dot-color:#c94a6a}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=slate]{--ch-peer-dot-color:#64748b}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=blue]{--ch-peer-dot-color:#7bb0f8}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=purple]{--ch-peer-dot-color:#a899f2}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=cyan]{--ch-peer-dot-color:#63c5da}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=green]{--ch-peer-dot-color:#6ec4a7}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=amber]{--ch-peer-dot-color:#e0ae58}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=rose]{--ch-peer-dot-color:#e08298}body[data-ds-dark-theme] :is(.jFA5LW_dot,.jFA5LW_tabDot)[data-color=slate]{--ch-peer-dot-color:#94a3b8}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-state=connected]{background:var(--ch-peer-dot-color);opacity:.95}:is(.jFA5LW_dot,.jFA5LW_tabDot)[data-state=connecting]{background:var(--dsw-alias-state-warning-primary,#c27803);opacity:.9}.jFA5LW_popover{z-index:1100;box-sizing:border-box;width:min(260px,100vw - 24px);max-height:calc(100vh - 24px - max(12px, var(--dsh-frame-overlay-top,12px)));--dsw-elevation-stroke-color:var(--dsw-alias-border-l2);box-shadow:var(--dsw-elevation-prominent);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);color:var(--dsw-alias-label-primary);border:0;flex-direction:column;padding:5px;display:flex;position:fixed}.jFA5LW_scrollArea{flex-direction:column;flex:1;gap:2px;min-height:0;display:flex;overflow-y:auto}.jFA5LW_section{flex-direction:column;gap:1px;display:flex}.jFA5LW_sectionTitleRow{justify-content:space-between;align-items:center;gap:8px;padding:4px 7px 3px;display:flex}.jFA5LW_sectionTitle{letter-spacing:.01em;color:var(--dsw-alias-label-tertiary);font-size:10.5px;font-weight:500;line-height:14px}.jFA5LW_resetLink,.jFA5LW_miniLink{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:4px;padding:1px 4px;font-size:11px;line-height:15px;transition:background-color .1s,color .1s}.jFA5LW_resetLink:hover:not(:disabled),.jFA5LW_miniLink:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.jFA5LW_miniLink:disabled{opacity:.35;cursor:default}.jFA5LW_hostList{flex-direction:column;gap:1px;display:flex}.jFA5LW_hostRow{width:100%;min-height:28px;color:var(--dsw-alias-label-primary);text-align:left;cursor:pointer;background:0 0;border:none;border-radius:6px;align-items:center;gap:7px;padding:3px 7px;font-size:12.5px;line-height:18px;transition:background-color .1s;display:flex}.jFA5LW_hostRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.jFA5LW_hostRowSelected{background:color-mix(in srgb, var(--dsw-alias-label-primary) 5%, transparent);font-weight:500}.jFA5LW_hostName{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.jFA5LW_hostCount{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary);flex:none;font-size:11px;line-height:15px}.jFA5LW_hostCountFiltered{color:var(--dsw-alias-state-business-primary);font-weight:500}.jFA5LW_checkSlot{width:14px;height:14px;color:var(--dsw-alias-label-primary);flex:none;justify-content:center;align-items:center;display:inline-flex}.jFA5LW_divider{background:var(--dsw-alias-border-l2);height:1px;margin:4px 3px}.jFA5LW_scopeEditor{flex-direction:column;gap:6px;padding:2px 4px 4px;display:flex}.jFA5LW_segmented{background:var(--dsw-alias-interactive-bg-hover);border-radius:7px;grid-template-columns:1fr 1fr;gap:2px;padding:2px;display:grid}.jFA5LW_segmentButton{box-sizing:border-box;height:24px;color:var(--dsw-alias-label-secondary);font:inherit;white-space:nowrap;text-overflow:ellipsis;cursor:pointer;background:0 0;border:none;border-radius:5px;padding:0 7px;font-size:11.5px;font-weight:500;line-height:16px;transition:color .1s;overflow:hidden}.jFA5LW_segmentButton:hover:not(.jFA5LW_segmentActive){color:var(--dsw-alias-label-primary)}.jFA5LW_segmentActive{background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);box-shadow:var(--dsw-elevation-soft)}.jFA5LW_workspacePicker{flex-direction:column;gap:3px;display:flex}.jFA5LW_workspacePickerBar{justify-content:space-between;align-items:center;gap:6px;padding:0 3px;display:flex}.jFA5LW_workspacePickerCount{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:15px}.jFA5LW_workspacePickerActions{align-items:center;gap:2px;display:inline-flex}.jFA5LW_workspaceList{flex-direction:column;gap:1px;max-height:160px;display:flex;overflow-y:auto}.jFA5LW_workspaceOption{min-height:25px;color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:5px;align-items:center;gap:7px;padding:2px 6px;font-size:12px;line-height:17px;display:flex}.jFA5LW_workspaceOption:hover{background:var(--dsw-alias-interactive-bg-hover)}.jFA5LW_workspaceCheckbox{width:13px;height:13px;accent-color:var(--dsw-alias-brand-primary,var(--dsw-alias-state-business-primary));cursor:pointer;flex:none;margin:0}.jFA5LW_workspaceOptionName{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.jFA5LW_noWorkspaces{color:var(--dsw-alias-label-tertiary);padding:6px;font-size:11.5px;line-height:16px}.jFA5LW_allHostsScopeList{flex-direction:column;gap:1px;display:flex}.jFA5LW_perHostAccordion{border-radius:6px;flex-direction:column;display:flex}.jFA5LW_perHostTrigger{width:100%;min-height:27px;color:var(--dsw-alias-label-primary);text-align:left;cursor:pointer;background:0 0;border:none;border-radius:6px;align-items:center;gap:6px;padding:3px 6px;font-size:12px;line-height:17px;display:flex}.jFA5LW_perHostTrigger:hover,.jFA5LW_perHostTriggerOpen{background:var(--dsw-alias-interactive-bg-hover)}.jFA5LW_accordionIcon{color:var(--dsw-alias-label-tertiary);flex:none}.jFA5LW_scopeSummaryTag{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary);flex:none;font-size:11px;line-height:15px}.jFA5LW_scopeSummaryTagFiltered{color:var(--dsw-alias-state-business-primary);font-weight:500}.jFA5LW_perHostBody{padding:3px 2px 2px 10px}.jFA5LW_footer{border-top:1px solid var(--dsw-alias-border-l2);flex-direction:column;flex:none;gap:1px;margin-top:4px;padding-top:4px;display:flex}.jFA5LW_footerAction{width:100%;min-height:28px;color:var(--dsw-alias-label-secondary);text-align:left;cursor:pointer;background:0 0;border:none;border-radius:6px;align-items:center;gap:7px;padding:3px 7px;font-size:12.5px;line-height:18px;transition:background-color .1s,color .1s;display:flex}.jFA5LW_footerAction:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.jFA5LW_footerIcon{color:var(--dsw-alias-label-tertiary);flex:none}.jFA5LW_footerAction:hover .jFA5LW_footerIcon{color:var(--dsw-alias-label-primary)}@media (hover:none),(pointer:coarse){.jFA5LW_trigger{min-height:32px;padding:0 8px}.jFA5LW_hostRow,.jFA5LW_footerAction{min-height:38px}.jFA5LW_workspaceOption{min-height:34px}}@media (prefers-reduced-motion:reduce){.jFA5LW_trigger,.jFA5LW_hostRow,.jFA5LW_footerAction{transition:none}}`,document.head.appendChild(e)}var Q={accordionIcon:`jFA5LW_accordionIcon`,allHostsScopeList:`jFA5LW_allHostsScopeList`,anchorRoot:`jFA5LW_anchorRoot`,checkSlot:`jFA5LW_checkSlot`,divider:`jFA5LW_divider`,dot:`jFA5LW_dot`,footer:`jFA5LW_footer`,footerAction:`jFA5LW_footerAction`,footerIcon:`jFA5LW_footerIcon`,hostCount:`jFA5LW_hostCount`,hostCountFiltered:`jFA5LW_hostCountFiltered`,hostList:`jFA5LW_hostList`,hostName:`jFA5LW_hostName`,hostRow:`jFA5LW_hostRow`,hostRowSelected:`jFA5LW_hostRowSelected`,iconTrigger:`jFA5LW_iconTrigger`,iconTriggerActive:`jFA5LW_iconTriggerActive`,iconTriggerOpen:`jFA5LW_iconTriggerOpen`,iconTriggerPip:`jFA5LW_iconTriggerPip`,miniLink:`jFA5LW_miniLink`,noWorkspaces:`jFA5LW_noWorkspaces`,perHostAccordion:`jFA5LW_perHostAccordion`,perHostBody:`jFA5LW_perHostBody`,perHostTrigger:`jFA5LW_perHostTrigger`,perHostTriggerOpen:`jFA5LW_perHostTriggerOpen`,popover:`jFA5LW_popover`,resetLink:`jFA5LW_resetLink`,scopeEditor:`jFA5LW_scopeEditor`,scopeSummaryTag:`jFA5LW_scopeSummaryTag`,scopeSummaryTagFiltered:`jFA5LW_scopeSummaryTagFiltered`,scrollArea:`jFA5LW_scrollArea`,section:`jFA5LW_section`,sectionTitle:`jFA5LW_sectionTitle`,sectionTitleRow:`jFA5LW_sectionTitleRow`,segmentActive:`jFA5LW_segmentActive`,segmentButton:`jFA5LW_segmentButton`,segmented:`jFA5LW_segmented`,tabBar:`jFA5LW_tabBar`,tabBarRow:`jFA5LW_tabBarRow`,tabDot:`jFA5LW_tabDot`,tabItem:`jFA5LW_tabItem`,tabItemActive:`jFA5LW_tabItemActive`,tabLabel:`jFA5LW_tabLabel`,tabTrailing:`jFA5LW_tabTrailing`,trigger:`jFA5LW_trigger`,triggerActive:`jFA5LW_triggerActive`,triggerChevron:`jFA5LW_triggerChevron`,triggerLabel:`jFA5LW_triggerLabel`,triggerOpen:`jFA5LW_triggerOpen`,workspaceCheckbox:`jFA5LW_workspaceCheckbox`,workspaceList:`jFA5LW_workspaceList`,workspaceOption:`jFA5LW_workspaceOption`,workspaceOptionName:`jFA5LW_workspaceOptionName`,workspacePicker:`jFA5LW_workspacePicker`,workspacePickerActions:`jFA5LW_workspacePickerActions`,workspacePickerBar:`jFA5LW_workspacePickerBar`,workspacePickerCount:`jFA5LW_workspacePickerCount`};function ob(e,t){return e.key===`local`?t(`host.local`):e.displayName||e.hostId||e.key}function sb(e,t){return t(e===`connected`?`host.connected`:e===`connecting`?`host.connecting`:`host.disconnected`)}function cb({host:e,state:t,onChange:n,t:r}){let i=t.perHost[e.key],a=i?.mode===`selected`?`selected`:`all`,c=(0,s.useMemo)(()=>new Set(i?.mode===`selected`?i.workspaceIds:[]),[i]),l=(0,s.useMemo)(()=>e.workspaces.map(e=>e.workspaceId),[e.workspaces]),u=Ov(e,i),d=ob(e,r);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.scopeEditor,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.segmented,role:`tablist`,"aria-label":r(`hostScope.scope.label`),children:[/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":a===`all`,className:X(Q.segmentButton,a===`all`&&Q.segmentActive),onClick:()=>{n(Av(t,e.key,`all`,l))},children:r(`hostScope.scope.allSessions`)}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":a===`selected`,className:X(Q.segmentButton,a===`selected`&&Q.segmentActive),onClick:()=>{n(Av(t,e.key,`selected`,l))},children:r(`hostScope.scope.selectedWorkspaces`)})]}),a===`selected`&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.workspacePicker,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.workspacePickerBar,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.workspacePickerCount,children:r(`hostScope.selectedCount`,{selected:u,total:e.workspaceCount})}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:Q.workspacePickerActions,children:[/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Q.miniLink,disabled:e.workspaces.length===0||u===e.workspaces.length,onClick:()=>{n(Mv(t,e.key,l))},children:r(`hostScope.selectAll`)}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Q.miniLink,disabled:u===0,onClick:()=>{n(Mv(t,e.key,[]))},children:r(`hostScope.clear`)})]})]}),e.workspaces.length===0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.noWorkspaces,children:r(`hostScope.noHostWorkspaces`)}):/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.workspaceList,children:e.workspaces.map(i=>{let a=c.has(i.workspaceId),s=hv(i),u=s?r(`group.remoteOtherSessions`):i.title;return/* @__PURE__ */ (0,o.jsxs)(`label`,{className:Q.workspaceOption,title:s?`${d} · ${u}`:i.path||u,children:[/* @__PURE__ */ (0,o.jsx)(`input`,{type:`checkbox`,className:Q.workspaceCheckbox,checked:a,onChange:()=>{n(jv(t,e.key,i.workspaceId,l))}}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.workspaceOptionName,children:u})]},i.workspaceId)})})]})]})}function lb(){return/* @__PURE__ */ (0,o.jsx)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.3`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:/* @__PURE__ */ (0,o.jsx)(`path`,{d:`M2.2 3.2h11.6L9.4 8.4v4.1l-2.8-1.4V8.4L2.2 3.2Z`})})}function ub({workspaces:e,state:t,onChange:n,t:r}){let i=(0,s.useMemo)(()=>mv(e),[e]),a=(0,s.useMemo)(()=>_v(e),[e]),c=(0,s.useMemo)(()=>vv(t,e),[t,e]);return i?/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.tabBarRow,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.tabBar,role:`tablist`,"aria-label":r(`hostScope.host.label`),children:[/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":c.selectedHost===`all`,className:X(Q.tabItem,c.selectedHost===`all`&&Q.tabItemActive),onClick:()=>{n(kv(c,`all`))},children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.tabLabel,children:r(`hostScope.allShort`)})}),a.map(e=>{let t=c.selectedHost===e.key,i=ob(e,r),a=e.hostId===void 0?i:`${i} · ${sb(e.state,r)}`;return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t,className:X(Q.tabItem,t&&Q.tabItemActive),title:a,onClick:()=>{n(kv(c,e.key))},children:[e.hostId!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.tabDot,"data-state":e.state??`disconnected`,"data-color":np(e.hostId,e.color),"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.tabLabel,children:i})]},e.key)})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.tabTrailing,children:/* @__PURE__ */ (0,o.jsx)(db,{workspaces:e,state:t,onChange:n,t:r,variant:`icon`})})]}):null}function db({workspaces:e,state:t,onChange:n,t:i,variant:a=`pill`}){let[l,u]=(0,s.useState)(!1),[d,f]=(0,s.useState)(null),p=(0,s.useRef)(null),m=(0,s.useRef)(null),h=(0,s.useRef)(null),g=(0,s.useId)(),_=(0,s.useMemo)(()=>mv(e),[e]),v=(0,s.useMemo)(()=>_v(e),[e]),y=(0,s.useMemo)(()=>vv(t,e),[t,e]),b=(0,s.useMemo)(()=>bv(y,e),[y,e]),x=(0,s.useMemo)(()=>y.selectedHost===`all`?void 0:v.find(e=>e.key===y.selectedHost),[y.selectedHost,v]),S=(0,r.useAnchoredPosition)({open:l,anchorRef:m,panelRef:h,side:`bottom`,align:`end`,gap:4,margin:12});if((0,r.useDismissOnOutsidePointer)(p,l,u,h),(0,s.useEffect)(()=>{if(!l)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),u(!1),m.current?.focus({preventScroll:!0}))};return document.addEventListener(`keydown`,e,!0),()=>{document.removeEventListener(`keydown`,e,!0)}},[l]),!_)return null;let C=(()=>{if(!b)return i(`hostScope.allShort`);if(x!==void 0){let e=ob(x,i),t=y.perHost[x.key];return t?.mode===`selected`?`${e} · ${Ov(x,t)}`:e}return i(`hostScope.filtered`)})(),w=x?.hostId===void 0?void 0:x.hostId,T=()=>{u(!1),window.dispatchEvent(new CustomEvent(`codexhost:open-add-remote-workspace`,{detail:w===void 0?{}:{hostId:w}}))},E=()=>{u(!1),window.dispatchEvent(new CustomEvent(`codexhost:open-remote-peers-settings`))},D=e.length,ee=v.some(e=>y.perHost[e.key]?.mode===`selected`);return/* @__PURE__ */ (0,o.jsxs)(`span`,{ref:p,className:Q.anchorRoot,children:[a===`icon`?/* @__PURE__ */ (0,o.jsxs)(`button`,{ref:m,type:`button`,className:X(Q.iconTrigger,ee&&Q.iconTriggerActive,l&&Q.iconTriggerOpen),"aria-haspopup":`dialog`,"aria-expanded":l,"aria-controls":l?g:void 0,"aria-label":i(`hostScope.trigger.aria`,{current:C}),title:i(`hostScope.trigger.aria`,{current:C}),onClick:e=>{e.stopPropagation(),u(e=>!e)},children:[/* @__PURE__ */ (0,o.jsx)(lb,{}),ee&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.iconTriggerPip,"aria-hidden":`true`})]}):/* @__PURE__ */ (0,o.jsxs)(`button`,{ref:m,type:`button`,className:X(Q.trigger,b&&Q.triggerActive,l&&Q.triggerOpen),"aria-haspopup":`dialog`,"aria-expanded":l,"aria-controls":l?g:void 0,"aria-label":i(`hostScope.trigger.aria`,{current:C}),title:i(`hostScope.trigger.aria`,{current:C}),onClick:e=>{e.stopPropagation(),u(e=>!e)},children:[x?.hostId!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.dot,"data-state":x.state??`disconnected`,"data-color":np(x.hostId,x.color),"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.triggerLabel,children:C}),/* @__PURE__ */ (0,o.jsx)(r.IconChevronDownOutlineRegular,{size:12,className:Q.triggerChevron})]}),l&&(0,c.createPortal)(/* @__PURE__ */ (0,o.jsxs)(r.MenuSurface,{ref:h,id:g,role:`dialog`,"aria-label":i(`hostScope.popover.aria`),className:Q.popover,style:S??{visibility:`hidden`,left:0,top:0},onClick:e=>{e.stopPropagation()},children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.scrollArea,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.section,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.sectionTitleRow,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.sectionTitle,children:i(`hostScope.host.label`)}),b&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Q.resetLink,onClick:()=>{n(Nv())},children:i(`hostScope.reset`)})]}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.hostList,role:`radiogroup`,"aria-label":i(`hostScope.host.label`),children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":y.selectedHost===`all`,className:X(Q.hostRow,y.selectedHost===`all`&&Q.hostRowSelected),onClick:()=>{n(kv(y,`all`))},children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.hostName,children:i(`hostScope.allHosts`)}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.hostCount,children:D}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.checkSlot,children:y.selectedHost===`all`&&/* @__PURE__ */ (0,o.jsx)(r.IconCheckOutlineRegular,{size:14})})]}),v.map(e=>{let t=y.selectedHost===e.key,a=y.perHost[e.key],s=a?.mode===`selected`,c=Ov(e,a),l=s?`${c}/${e.workspaceCount}`:String(e.workspaceCount),u=ob(e,i),d=e.hostId===void 0?u:`${u} · ${sb(e.state,i)}`;return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,className:X(Q.hostRow,t&&Q.hostRowSelected),title:d,onClick:()=>{n(kv(y,e.key))},children:[e.hostId!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.dot,"data-state":e.state??`disconnected`,"data-color":np(e.hostId,e.color),"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.hostName,children:u}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:X(Q.hostCount,s&&Q.hostCountFiltered),children:l}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.checkSlot,children:t&&/* @__PURE__ */ (0,o.jsx)(r.IconCheckOutlineRegular,{size:14})})]},e.key)})]})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.divider,role:`separator`}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.section,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.sectionTitleRow,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.sectionTitle,children:i(`hostScope.scope.label`)})}),x===void 0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.allHostsScopeList,children:v.map(e=>{let t=d===e.key,a=y.perHost[e.key],s=a?.mode===`selected`,c=s?`${Ov(e,a)}/${e.workspaceCount}`:i(`hostScope.allShort`);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.perHostAccordion,children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:X(Q.perHostTrigger,t&&Q.perHostTriggerOpen),"aria-expanded":t,onClick:()=>{f(t=>t===e.key?null:e.key)},children:[t?/* @__PURE__ */ (0,o.jsx)(r.IconChevronDownOutlineRegular,{size:12,className:Q.accordionIcon}):/* @__PURE__ */ (0,o.jsx)(r.IconChevronRightOutlineRegular,{size:12,className:Q.accordionIcon}),e.hostId!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.dot,"data-state":e.state??`disconnected`,"data-color":np(e.hostId,e.color),"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.hostName,children:ob(e,i)}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:X(Q.scopeSummaryTag,s&&Q.scopeSummaryTagFiltered),children:c})]}),t&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.perHostBody,children:/* @__PURE__ */ (0,o.jsx)(cb,{host:e,state:y,onChange:n,t:i})})]},e.key)})}):/* @__PURE__ */ (0,o.jsx)(cb,{host:x,state:y,onChange:n,t:i})]})]}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.footer,children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:Q.footerAction,onClick:T,children:[/* @__PURE__ */ (0,o.jsx)(r.IconPlusOutlineRegular,{size:14,className:Q.footerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:i(`hostScope.action.addRemoteWorkspace`)})]}),/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:Q.footerAction,onClick:E,children:[/* @__PURE__ */ (0,o.jsx)(r.IconSettingsOutlineRegular,{size:14,className:Q.footerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:i(`hostScope.action.manageRemoteHosts`)})]})]})]}),document.body)]})}function fb(){let[e,t]=(0,s.useState)(vy);return(0,s.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(_y);t(e.matches);let n=e=>{t(e.matches)};if(typeof e.addEventListener==`function`)return e.addEventListener(`change`,n),()=>{e.removeEventListener(`change`,n)}},[]),e}function pb({enabled:e,nativeSections:t,visibleSectionRows:n,nativeThreadIds:r,pinnedSessionIds:i,archivedSessionIds:a,moveSessionToSection:o,onCancelLocalDrag:c}){let[l,u]=(0,s.useState)(null),d=(0,s.useRef)(null),f=(0,s.useRef)(!1),p=(0,s.useRef)(!1),m=(0,s.useRef)(c),h=e=>{d.current=e,u(e)},g=e&&l!==null;(0,s.useLayoutEffect)(()=>{m.current=c,!(e||d.current===null)&&(p.current=!0,d.current=null,u(null),m.current())},[e,c]),(0,s.useEffect)(()=>{if(!g)return;let e=()=>{p.current=!0,h(null),m.current()},t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`keydown`,t,!0),window.addEventListener(`blur`,e),()=>{window.removeEventListener(`keydown`,t,!0),window.removeEventListener(`blur`,e)}},[g]);let _=(t,n=!1)=>e&&yy({sessionId:t.id,nativeThreadIds:r,pinnedSessionIds:i,archivedSessionIds:a,blank:t.blank,archived:t.archived,pinned:t.pinned,remote:n||!!t.remote,depth:t.tree?.depth??0}),v=(t,n)=>{e&&(f.current=!1,p.current=!1,h({source:{sessionId:t,sourceSectionId:n},over:null}))},y=e=>{let t=d.current;if(t===null||p.current||e.kind===`unsectioned`&&t.source.sourceSectionId===null)return;let n=t.over;n!==null&&n.kind===e.kind&&(e.kind===`unsectioned`||e.kind===`section-end`&&n.kind===`section-end`&&n.sectionId===e.sectionId||e.kind===`section-row`&&n.kind===`section-row`&&n.sectionId===e.sectionId&&n.targetSessionId===e.targetSessionId&&n.half===e.half)||h({...t,over:e})},b=()=>{let e=d.current;e!==null&&e.over!==null&&h({...e,over:null})},x=(r,i)=>{let a=d.current;if(!e||a===null||!Ty({committed:f.current,cancelled:p.current,dropEffect:i}))return;f.current=!0,h(null),m.current();let s=Ey(a.source,r,t,n);s!==null&&o!==void 0&&o(s)},S=()=>{h(null),f.current=!1,p.current=!1},C=e?{active:g,draggedSessionId:l?.source.sessionId??null,over:l?.over??null,canDragRow:e=>_(e),startFromSection:(e,t)=>{v(e,t)},hoverSectionEnd:e=>{y({kind:`section-end`,sectionId:e})},hoverSectionRow:(e,t,n)=>{y({kind:`section-row`,sectionId:e,targetSessionId:t,half:n})},dropSectionEnd:(e,t)=>{x({kind:`section-end`,sectionId:e},t)},dropSectionRow:(e,t,n,r)=>{x({kind:`section-row`,sectionId:e,targetSessionId:t,half:n},r)},clearHover:b,end:S}:void 0;return{active:g,hasSectionTarget:g&&l.over!==null,canFinishLocalDrop:e=>Ty({committed:f.current,cancelled:p.current,dropEffect:e?`copy`:null}),canDropToUnsectioned:g&&l.source.sourceSectionId!==null,isUnsectionedTarget:g&&l.over?.kind===`unsectioned`,canDragRow:_,startFromUnsectioned:e=>{v(e,null)},hoverUnsectioned:()=>{y({kind:`unsectioned`})},dropUnsectioned:e=>{x({kind:`unsectioned`},e)},clearHover:b,end:S,interaction:C}}function mb(e,t){let n=_v(e),r=n.find(e=>e.key===`local`)??{key:`local`,workspaces:[]},i=/* @__PURE__ */ new Map;for(let e of n)e.key!==`local`&&e.hostId!==void 0&&i.set(e.hostId,{...e,workspaces:e.workspaces.filter(e=>!hv(e))});for(let e of t){if(!e.enabled){i.delete(e.hostId);continue}let t=i.get(e.hostId);t===void 0?i.set(e.hostId,{key:e.hostId,hostId:e.hostId,displayName:e.name,state:e.state,workspaces:[]}):i.set(e.hostId,{...t,displayName:e.name||t.displayName,state:e.state||t.state})}return[r,...i.values()]}function hb(e,t){return t===void 0?`local`:e.find(e=>e.workspaceId===t)?.remote?.hostId??`local`}function gb(e,t,n){let r=t.trim().toLowerCase();return r===``?[...e]:e.filter(e=>(e.key===`local`?n:e.displayName??e.hostId??e.key).toLowerCase().includes(r)||e.hostId!==void 0&&e.hostId.toLowerCase().includes(r))}function _b(e,t,n){let r=e.filter(e=>!hv(e)),i=t.trim().toLowerCase();return i===``?r:r.filter(e=>{let t=n(e).toLowerCase(),r=(e.path??``).toLowerCase();return t.includes(i)||r.includes(i)})}function vb(e,t){if(!e)return;let n=e.replace(/[\\/]+$/u,``);if(!n)return;let r=n.split(/[\\/]+/u).filter(Boolean);if(r.length<2)return;let i=r[r.length-2];if(i&&i!==t&&i!==`~`&&i!==`Users`&&i!==`home`)return i}function yb(e){if(typeof e!=`object`||!e)return[];let t=e.result;if(typeof t!=`object`||!t)return[];let n=t,r=(n.ok===!0&&typeof n.value==`object`&&n.value!==null?n.value:n).peers;if(!Array.isArray(r))return[];let i=[];for(let e of r){if(typeof e!=`object`||!e)continue;let t=e;typeof t.hostId==`string`&&t.hostId!==``&&typeof t.name==`string`&&typeof t.state==`string`&&i.push({hostId:t.hostId,name:t.name,state:t.state,enabled:t.enabled!==!1})}return i}function bb(e,t){if(t.workspaceId!==void 0){let n=e.find(e=>e.workspaceId===t.workspaceId);if(n!==void 0)return n}let n=t.path.replace(/[\\/]+$/u,``);return e.find(e=>e.remote?.hostId===t.hostId&&e.path.replace(/[\\/]+$/u,``)===n)}let xb=`@deepseek-ai/dsh-client-ui-workspace/HeroLocationWorkspacePicker.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(xb)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=xb,e.textContent=`.tXrwyq_root{align-items:center;gap:4px;min-width:0;max-width:100%;display:inline-flex}.tXrwyq_trigger{min-width:0;max-width:240px;height:30px;color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;background:0 0;border:none;border-radius:9999px;align-items:center;gap:7px;padding:0 10px;font-size:13.5px;font-weight:450;line-height:20px;transition:background-color .11s,color .11s;display:inline-flex}.tXrwyq_trigger:hover:not(:disabled),.tXrwyq_triggerOpen{background:color-mix(in srgb, var(--dsw-alias-label-primary) 9%, transparent)}.tXrwyq_trigger:disabled{opacity:.55;cursor:default}.tXrwyq_trigger:focus-visible,.tXrwyq_row:focus-visible,.tXrwyq_footerAction:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.tXrwyq_triggerPlaceholder{color:var(--dsw-alias-label-tertiary);font-weight:400}.tXrwyq_triggerPlaceholder:hover:not(:disabled),.tXrwyq_triggerPlaceholder.tXrwyq_triggerOpen{color:var(--dsw-alias-label-secondary)}.tXrwyq_triggerLocation{flex:0 auto;max-width:180px}.tXrwyq_triggerProject{flex:0 auto;max-width:260px}.tXrwyq_triggerIcon{color:currentColor;opacity:.9;flex:none}.tXrwyq_triggerPlaceholder .tXrwyq_triggerIcon{opacity:.8}.tXrwyq_triggerLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.tXrwyq_statusDot{background:var(--dsw-alias-label-tertiary);opacity:.78;border-radius:50%;flex:none;width:6px;height:6px}.tXrwyq_statusDot[data-state=connecting]{background:var(--dsw-alias-state-warning-primary,#c27803);opacity:.92}.tXrwyq_statusDot[data-state=auth-error]{background:var(--dsw-alias-state-error-primary);opacity:.92}.tXrwyq_popover{z-index:1100;box-sizing:border-box;border:.5px solid var(--dsw-alias-border-l3);--dsw-elevation-stroke-color:transparent;box-shadow:var(--dsw-elevation-prominent);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);color:var(--dsw-alias-label-primary);border-radius:16px;flex-direction:column;padding:6px;display:flex;position:fixed}.tXrwyq_popoverLocation{width:min(264px,100vw - 24px)}.tXrwyq_popoverProject{width:min(280px,100vw - 24px)}.tXrwyq_searchRow{align-items:center;gap:8px;height:36px;padding:0 10px;display:flex}.tXrwyq_searchIcon{color:var(--dsw-alias-label-tertiary);flex:none}.tXrwyq_searchInput{min-width:0;height:100%;color:var(--dsw-alias-label-primary);font:inherit;background:0 0;border:none;outline:none;flex:1;padding:0;font-size:14px;line-height:20px}.tXrwyq_searchInput::placeholder{color:var(--dsw-alias-label-tertiary)}.tXrwyq_divider{background:var(--dsw-alias-border-l2);flex:none;height:.5px;margin:4px 10px 6px}.tXrwyq_footerDivider{background:var(--dsw-alias-border-l2);flex:none;height:.5px;margin:6px 10px 4px}.tXrwyq_list{flex-direction:column;gap:2px;max-height:260px;display:flex;overflow-y:auto}.tXrwyq_row{width:100%;min-height:36px;color:var(--dsw-alias-label-primary);font:inherit;text-align:left;cursor:pointer;background:0 0;border:none;border-radius:11px;align-items:center;gap:9px;padding:6px 10px;font-size:14px;font-weight:450;line-height:20px;transition:background-color 90ms;display:flex}.tXrwyq_row:hover,.tXrwyq_rowActive{background:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent)}.tXrwyq_rowIcon{width:16px;height:16px;color:var(--dsw-alias-label-secondary);flex:none;justify-content:center;align-items:center;display:inline-flex}.tXrwyq_rowMain{flex:1;align-items:baseline;gap:7px;min-width:0;display:flex}.tXrwyq_rowTitle{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.tXrwyq_rowHint{text-overflow:ellipsis;white-space:nowrap;min-width:0;color:var(--dsw-alias-label-tertiary);flex:0 auto;font-size:13px;font-weight:400;line-height:18px;overflow:hidden}.tXrwyq_rowStatus{color:var(--dsw-alias-label-tertiary);flex:none;font-size:11.5px;line-height:16px}.tXrwyq_checkSlot{width:16px;height:16px;color:var(--dsw-alias-label-primary);flex:none;justify-content:center;align-items:center;display:inline-flex}.tXrwyq_emptyState{text-align:center;color:var(--dsw-alias-label-tertiary);padding:16px 10px;font-size:13px;line-height:18px}.tXrwyq_footerAction{width:100%;min-height:36px;color:var(--dsw-alias-label-primary);font:inherit;text-align:left;cursor:pointer;background:0 0;border:none;border-radius:11px;align-items:center;gap:9px;padding:6px 10px;font-size:14px;font-weight:450;line-height:20px;transition:background-color 90ms;display:flex}.tXrwyq_footerAction:hover:not(:disabled){background:color-mix(in srgb, var(--dsw-alias-label-primary) 8%, transparent)}.tXrwyq_footerAction:disabled{opacity:.5;cursor:default}.tXrwyq_footerIcon{color:var(--dsw-alias-label-secondary);flex:none}.tXrwyq_modalAction{min-width:72px}.tXrwyq_modalError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}@media (hover:none),(pointer:coarse){.tXrwyq_trigger{min-height:34px;padding:0 11px}.tXrwyq_row,.tXrwyq_footerAction{min-height:40px}}@media (prefers-reduced-motion:reduce){.tXrwyq_trigger,.tXrwyq_row,.tXrwyq_footerAction{transition:none}}`,document.head.appendChild(e)}var $={checkSlot:`tXrwyq_checkSlot`,divider:`tXrwyq_divider`,emptyState:`tXrwyq_emptyState`,footerAction:`tXrwyq_footerAction`,footerDivider:`tXrwyq_footerDivider`,footerIcon:`tXrwyq_footerIcon`,list:`tXrwyq_list`,modalAction:`tXrwyq_modalAction`,modalError:`tXrwyq_modalError`,popover:`tXrwyq_popover`,popoverLocation:`tXrwyq_popoverLocation`,popoverProject:`tXrwyq_popoverProject`,root:`tXrwyq_root`,row:`tXrwyq_row`,rowActive:`tXrwyq_rowActive`,rowHint:`tXrwyq_rowHint`,rowIcon:`tXrwyq_rowIcon`,rowMain:`tXrwyq_rowMain`,rowStatus:`tXrwyq_rowStatus`,rowTitle:`tXrwyq_rowTitle`,searchIcon:`tXrwyq_searchIcon`,searchInput:`tXrwyq_searchInput`,searchRow:`tXrwyq_searchRow`,statusDot:`tXrwyq_statusDot`,trigger:`tXrwyq_trigger`,triggerIcon:`tXrwyq_triggerIcon`,triggerLabel:`tXrwyq_triggerLabel`,triggerLocation:`tXrwyq_triggerLocation`,triggerOpen:`tXrwyq_triggerOpen`,triggerPlaceholder:`tXrwyq_triggerPlaceholder`,triggerProject:`tXrwyq_triggerProject`};let Sb=`codexhost:remote-peers-updated`,Cb=`codexhost:remote-workspace-created`,wb=`codexhost/remote-peers/list`,Tb=`::no-project`;function Eb({className:e}){return/* @__PURE__ */ (0,o.jsxs)(`svg`,{width:15,height:15,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,o.jsx)(`rect`,{x:`2.25`,y:`2.75`,width:`11.5`,height:`8`,rx:`1.5`}),/* @__PURE__ */ (0,o.jsx)(`path`,{d:`M1.25 12.75h13.5`})]})}function Db({className:e}){return/* @__PURE__ */ (0,o.jsxs)(`svg`,{width:15,height:15,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.35`,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,o.jsx)(`rect`,{x:`2`,y:`2.5`,width:`12`,height:`8.5`,rx:`1.6`}),/* @__PURE__ */ (0,o.jsx)(`path`,{d:`M5.5 13.5h5M8 11v2.5`})]})}function Ob(e,t){return e.key===`local`?t(`host.thisComputer`):e.displayName||e.hostId||e.key}function kb(e,t){if(e!==void 0&&e!==`connected`)return t(e===`connecting`?`host.connecting`:`host.disconnected`)}function Ab({location:e,className:t}){return e.key===`local`?/* @__PURE__ */ (0,o.jsx)(Eb,{className:t}):e.state!==void 0&&e.state!==`connected`?/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.statusDot,"data-state":e.state,"aria-hidden":`true`}):/* @__PURE__ */ (0,o.jsx)(Db,{className:t})}async function jb(e){try{let t=typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`hero-peers-${Date.now()}`,n=await fetch(`api/${wb}`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({type:`client-request`,rpcId:t,method:wb,payload:{args:{}}}),...e===void 0?{}:{signal:e}});return n.ok?yb(await n.json()):null}catch{return null}}function Mb({open:e,selectedId:t,fallbackLabel:n,onOpenChange:i,onPick:a,onClose:l,useWorkspaces:u,createWorkspace:d,useDirectoryFlow:f,renderSlot:p,t:m}){let h=u(e=>e),g=h.items,_=h.canStartProjectless===!0,v=f(e=>e),[y,b]=(0,s.useState)([]),[x,S]=(0,s.useState)(!1),[C,w]=(0,s.useState)(!1),[T,E]=(0,s.useState)(!1),[D,ee]=(0,s.useState)(``),[te,ne]=(0,s.useState)(``),[re,ie]=(0,s.useState)(-1),[ae,oe]=(0,s.useState)(-1),[se,O]=(0,s.useState)(!1),[k,ce]=(0,s.useState)(!1),[le,ue]=(0,s.useState)(!1),[de,A]=(0,s.useState)(null),fe=(0,r.usePhoneSidebar)(),j=(0,s.useRef)(!1),pe=(0,s.useRef)(null),[me,he]=(0,s.useState)(null),ge=(0,s.useRef)(null),_e=(0,s.useRef)(null),ve=(0,s.useRef)(null),ye=(0,s.useRef)(null),be=(0,s.useRef)(null),xe=(0,s.useRef)(null),Se=(0,s.useRef)(null),Ce=(0,s.useId)(),M=(0,s.useId)(),we=e||T,Te=se||k,Ee=(0,s.useMemo)(()=>hb(g,t),[g,t]),De=(0,s.useMemo)(()=>mb(g,y),[g,y]),Oe=(0,s.useMemo)(()=>new Set(De.map(e=>e.key)),[De]),ke=(0,s.useMemo)(()=>new Set(y.filter(e=>!e.enabled).map(e=>e.hostId)),[y]),Ae=h.phase===`ready`&&h.state===`idle`&&x,[je,Me]=(0,s.useState)(()=>Ee),N=(0,s.useCallback)((e,t=!1)=>{E(e),i?.(e),e||(t||Me(Oe.has(Ee)?Ee:`local`),l())},[Oe,l,i,Ee]);(0,s.useEffect)(()=>{e&&(w(!1),E(!0))},[e]);let Ne=(0,s.useCallback)(e=>{jb(e).then(t=>{e?.aborted||t===null||(b(t),S(!0))})},[]);(0,s.useEffect)(()=>{let e=new AbortController;Ne(e.signal);let t=()=>{Ne()};return window.addEventListener(Sb,t),()=>{e.abort(),window.removeEventListener(Sb,t)}},[Ne]),(0,s.useEffect)(()=>{C&&Ne()},[C,Ne]),(0,s.useEffect)(()=>{let e=e=>{let t=e.detail;t&&typeof t.hostId==`string`&&typeof t.path==`string`&&pe.current!==null&&t.hostId===pe.current&&(pe.current=null,he({hostId:t.hostId,path:t.path,...typeof t.workspaceId==`string`?{workspaceId:t.workspaceId}:{}}))};return window.addEventListener(Cb,e),()=>{window.removeEventListener(Cb,e)}},[]);let Pe=(0,s.useRef)(t);(0,s.useEffect)(()=>{if(t!==Pe.current&&(Pe.current=t,t!==void 0)){let e=hb(g,t);Me(Oe.has(e)?e:`local`)}},[Oe,t,g]),(0,s.useEffect)(()=>{t!==void 0&&Ee!==`local`&&Oe.has(Ee)&&Me(e=>e===`local`?Ee:e)},[Oe,t,Ee]);let Fe=(0,s.useRef)(void 0);(0,s.useEffect)(()=>{let e=e=>e!==`local`&&!Oe.has(e)&&(Ae||ke.has(e));e(je)&&Me(`local`),pe.current!==null&&e(pe.current)&&(pe.current=null),me!==null&&e(me.hostId)&&he(null);let n=t===void 0?void 0:g.find(e=>e.workspaceId===t),r=n?.remote!==void 0&&e(n.remote.hostId),i=me!==null&&!e(me.hostId)&&me.workspaceId===t,o=Ae&&t!==void 0&&n===void 0&&!i&&(je!==`local`||t.startsWith(`remote-peer:`));r||o?_&&Fe.current!==t&&(Fe.current=t,a(null)):Fe.current=void 0},[je,Oe,_,ke,Ae,a,me,t,g]);let Ie=(0,s.useMemo)(()=>De.find(e=>e.key===je)??De[0]??{key:`local`,workspaces:[]},[je,De]);(0,s.useEffect)(()=>{if(me===null)return;let e=bb(g,me);e!==void 0&&(he(null),Me(e.remote?.hostId??`local`),a(e.workspaceId))},[a,me,g]),(0,s.useEffect)(()=>{se&&!v&&O(!1)},[se,v]);let Le=(0,r.useAnchoredPosition)({open:C,anchorRef:_e,panelRef:ye,side:`bottom`,align:`start`,gap:6,margin:12}),P=(0,r.useAnchoredPosition)({open:we,anchorRef:ve,panelRef:be,side:`bottom`,align:`start`,gap:6,margin:12});(0,r.useDismissOnOutsidePointer)(ge,C,w,ye),(0,r.useDismissOnOutsidePointer)(ge,we,(0,s.useCallback)(e=>{e||N(!1)},[N]),be),(0,s.useEffect)(()=>{if(!C)return;ee(``),ie(-1);let e=requestAnimationFrame(()=>{xe.current?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(e)},[C]),(0,s.useEffect)(()=>{if(!we)return;ne(``),oe(-1);let e=requestAnimationFrame(()=>{Se.current?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(e)},[we]),(0,s.useEffect)(()=>{if(!C&&!we)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),C?(w(!1),_e.current?.focus({preventScroll:!0})):we&&(N(!1),ve.current?.focus({preventScroll:!0})))};return document.addEventListener(`keydown`,e,!0),()=>{document.removeEventListener(`keydown`,e,!0)}},[C,we,N]);let Re=(0,s.useCallback)(e=>H_(e.title,m(`workspace.defaultName`)),[m]),ze=(0,s.useMemo)(()=>gb(De,D,m(`host.thisComputer`)),[De,D,m]),Be=(0,s.useMemo)(()=>_b(Ie.workspaces,te,Re),[Ie.workspaces,te,Re]),Ve=Ie.key===`local`&&_&&te.trim()===``,F=(0,s.useMemo)(()=>[...Ve?[{id:Tb,workspace:void 0}]:[],...Be.map(e=>({id:e.workspaceId,workspace:e}))],[Be,Ve]);(0,s.useEffect)(()=>{ie(e=>ze.length===0?-1:e>=ze.length?0:e)},[ze.length]),(0,s.useEffect)(()=>{oe(e=>F.length===0?-1:e>=F.length?0:e)},[F.length]);let He=De.length>1,Ue=Ob(Ie,m),I=(0,s.useMemo)(()=>t===void 0?void 0:g.find(e=>e.workspaceId===t&&!hv(e)),[t,g]),We=I!==void 0&&(I.remote?.hostId??`local`)===Ie.key,Ge=We&&I!==void 0?Re(I):t===void 0&&Ie.key===`local`&&n!==void 0?n:m(`heroPicker.project.choose`),Ke=!We&&(t!==void 0||Ie.key!==`local`||n===void 0),qe=e=>{let t=e.key!==Ie.key;Me(e.key),w(!1),t&&N(!0)},Je=e=>{pe.current=null,N(!1,!0),a(e===Tb?null:e)},Ye=(0,s.useCallback)(()=>{pe.current=null,j.current=fe?.open===!0,N(!1,!0),ue(!1),A(null),O(!0)},[fe?.open,N]),Xe=()=>{Ie.key===`local`?v&&!Te&&Ye():Ie.hostId?.startsWith(`remote-peer:`)&&Ie.state===`connected`&&(N(!1),pe.current=Ie.hostId,window.dispatchEvent(new CustomEvent(`codexhost:open-add-remote-workspace`,{detail:{hostId:Ie.hostId}})))},Ze=Ie.key===`local`?v:Ie.hostId?.startsWith(`remote-peer:`)===!0&&Ie.state===`connected`,Qe=()=>{w(!1),window.dispatchEvent(new CustomEvent(`codexhost:open-remote-peers-settings`))},L=e=>d({path:e}).then(e=>{O(!1),Me(`local`),a(e.workspaceId)}).catch(e=>{A(e instanceof Error?e.message:String(e)),O(!1),ue(!0)}),$e={open:se,busy:k,onPicked:e=>{ce(!0),L(e).finally(()=>{ce(!1)})},onCancel:()=>{O(!1)},onError:e=>{O(!1),A(e),ue(!0)}},et=e=>{if(ze.length!==0){if(e.key===`ArrowDown`)e.preventDefault(),ie(e=>e<0?0:(e+1)%ze.length);else if(e.key===`ArrowUp`)e.preventDefault(),ie(e=>e<0?ze.length-1:(e-1+ze.length)%ze.length);else if(e.key===`Enter`){e.preventDefault();let t=ze[re>=0?re:0];t!==void 0&&qe(t)}}},tt=e=>{if(F.length!==0){if(e.key===`ArrowDown`)e.preventDefault(),oe(e=>e<0?0:(e+1)%F.length);else if(e.key===`ArrowUp`)e.preventDefault(),oe(e=>e<0?F.length-1:(e-1+F.length)%F.length);else if(e.key===`Enter`){e.preventDefault();let t=F[ae>=0?ae:0];t!==void 0&&Je(t.id)}}},nt=()=>{ue(!1),A(null)};return/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:ge,className:$.root,"data-hero-location-picker":``,children:[/* @__PURE__ */ (0,o.jsxs)(`button`,{ref:_e,type:`button`,className:X($.trigger,$.triggerLocation,C&&$.triggerOpen),"aria-haspopup":`dialog`,"aria-expanded":C,"aria-controls":C?Ce:void 0,"aria-label":m(`heroPicker.location.aria`,{current:Ue}),disabled:Te,"data-hero-location-trigger":``,onClick:()=>{N(!1),w(e=>!e)},children:[/* @__PURE__ */ (0,o.jsx)(Ab,{location:Ie,className:$.triggerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.triggerLabel,children:Ue})]}),/* @__PURE__ */ (0,o.jsxs)(`button`,{ref:ve,type:`button`,className:X($.trigger,$.triggerProject,Ke&&$.triggerPlaceholder,we&&$.triggerOpen),"aria-haspopup":`dialog`,"aria-expanded":we,"aria-controls":we?M:void 0,"aria-label":m(`heroPicker.project.aria`,{current:Ge}),disabled:Te,"data-hero-project-trigger":``,onClick:()=>{w(!1),N(!we)},children:[Ke?/* @__PURE__ */ (0,o.jsx)(r.IconFolderCloseRegular,{size:15,className:$.triggerIcon}):/* @__PURE__ */ (0,o.jsx)(r.IconFolderOpenOutlineRegular,{size:15,className:$.triggerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.triggerLabel,children:Ge})]}),C&&(0,c.createPortal)(/* @__PURE__ */ (0,o.jsxs)(r.MenuSurface,{ref:ye,id:Ce,role:`dialog`,"aria-label":m(`heroPicker.location.placeholder`),className:X($.popover,$.popoverLocation),style:Le??{visibility:`hidden`,left:0,top:0},"data-hero-location-popover":``,onClick:e=>{e.stopPropagation()},children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:$.searchRow,children:[/* @__PURE__ */ (0,o.jsx)(r.IconSearchOutlineRegular,{size:15,className:$.searchIcon}),/* @__PURE__ */ (0,o.jsx)(`input`,{ref:xe,type:`text`,className:$.searchInput,value:D,placeholder:m(`heroPicker.location.placeholder`),"aria-label":m(`heroPicker.location.placeholder`),spellCheck:!1,autoComplete:`off`,onChange:e=>{ee(e.target.value),ie(e.target.value.trim()===``?-1:0)},onKeyDown:et})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.divider,role:`separator`}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.list,role:`listbox`,"aria-label":m(`heroPicker.location.placeholder`),onMouseLeave:()=>ie(-1),children:ze.length===0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.emptyState,children:m(`heroPicker.location.empty`)}):ze.map((e,t)=>{let n=e.key===Ie.key,i=Ob(e,m),a=kb(e.state,m);return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n,className:X($.row,t===re&&$.rowActive),onMouseEnter:()=>ie(t),onClick:()=>qe(e),children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowIcon,children:/* @__PURE__ */ (0,o.jsx)(Ab,{location:e})}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowMain,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowTitle,children:i})}),a!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowStatus,children:a}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.checkSlot,children:n&&/* @__PURE__ */ (0,o.jsx)(r.IconCheckOutlineRegular,{size:15})})]},e.key)})}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.footerDivider,role:`separator`}),/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:$.footerAction,onClick:Qe,children:[He?/* @__PURE__ */ (0,o.jsx)(r.IconSettingsOutlineRegular,{size:15,className:$.footerIcon}):/* @__PURE__ */ (0,o.jsx)(r.IconPlusOutlineRegular,{size:15,className:$.footerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:m(He?`heroPicker.location.manageRemote`:`heroPicker.location.connectRemote`)})]})]}),document.body),we&&(0,c.createPortal)(/* @__PURE__ */ (0,o.jsxs)(r.MenuSurface,{ref:be,id:M,role:`dialog`,"aria-label":m(`heroPicker.project.placeholder`),className:X($.popover,$.popoverProject),style:P??{visibility:`hidden`,left:0,top:0},"data-hero-project-popover":``,onClick:e=>{e.stopPropagation()},children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:$.searchRow,children:[/* @__PURE__ */ (0,o.jsx)(r.IconSearchOutlineRegular,{size:15,className:$.searchIcon}),/* @__PURE__ */ (0,o.jsx)(`input`,{ref:Se,type:`text`,className:$.searchInput,value:te,placeholder:m(`heroPicker.project.placeholder`),"aria-label":m(`heroPicker.project.placeholder`),spellCheck:!1,autoComplete:`off`,onChange:e=>{ne(e.target.value),oe(e.target.value.trim()===``?-1:0)},onKeyDown:tt})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.divider,role:`separator`}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.list,role:`listbox`,"aria-label":m(`heroPicker.project.placeholder`),onMouseLeave:()=>oe(-1),children:h.phase===`pending`&&F.length===0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.emptyState,role:`status`,children:m(`picker.loading`)}):F.length===0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.emptyState,children:te.trim()===``?m(`heroPicker.project.empty`):m(`heroPicker.project.noMatches`)}):F.map((e,n)=>{let i=e.workspace===void 0,a=i?t===void 0:e.id===t,s=i?m(`heroPicker.project.noProject`):Re(e.workspace),c=i?void 0:vb(e.workspace.path,s);return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":a,className:X($.row,n===ae&&$.rowActive),title:e.workspace?.path||s,onMouseEnter:()=>oe(n),onClick:()=>Je(e.id),children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowIcon,children:/* @__PURE__ */ (0,o.jsx)(r.IconFolderCloseRegular,{size:15})}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:$.rowMain,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowTitle,children:s}),c!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowHint,children:c})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.checkSlot,children:a&&/* @__PURE__ */ (0,o.jsx)(r.IconCheckOutlineRegular,{size:15})})]},e.id)})}),Ze&&/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.footerDivider,role:`separator`}),/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:$.footerAction,disabled:Te,onClick:Xe,children:[/* @__PURE__ */ (0,o.jsx)(r.IconPlusOutlineRegular,{size:15,className:$.footerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:m(`heroPicker.project.new`)})]})]})]}),document.body),p(`conversation.hero.workspace.directoryFlow`,$e),/* @__PURE__ */ (0,o.jsx)(r.Modal,{phoneSidebar:!0,phoneSidebarOrigin:j.current,open:le,onClose:nt,closeLabel:m(`close`),title:m(`folderError.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,className:$.modalAction,onClick:nt,children:m(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`primary`,className:$.modalAction,disabled:!v,onClick:Ye,children:m(`folderError.retry`)})]}),children:/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.modalError,role:`alert`,children:de})})]})}let Nb=`@deepseek-ai/dsh-client-ui-workspace/WorkspacePicker.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Nb)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Nb,e.textContent=`.s4nt4G_modalAction{min-width:72px}.s4nt4G_modalError,.s4nt4G_menuStatus{margin-top:8px;font-size:12px;line-height:18px}.s4nt4G_modalError{color:var(--dsw-alias-state-error-primary)}.s4nt4G_menuStatus{color:var(--dsw-alias-label-secondary)}`,document.head.appendChild(e)}var Pb={menuStatus:`s4nt4G_menuStatus`,modalAction:`s4nt4G_modalAction`,modalError:`s4nt4G_modalError`};let Fb=`::add-workspace`,Ib=`::no-workspace`;function Lb(e,t){let n=0;for(let r=0;r<t.length&&n<e.length;r+=1)t[r]===e[n]&&(n+=1);return n===e.length}function Rb(e,t){let n=t.trim().toLowerCase();if(n===``)return e;let r=[];for(let t=0;t<e.length;t+=1){let i=e[t],a=i.title.toLowerCase(),o=i.path.toLowerCase(),s=null;a.startsWith(n)?s=0:a.includes(n)?s=1:o.includes(n)?s=2:Lb(n,a)&&(s=3),s!==null&&r.push({row:i,rank:s,order:t})}return r.sort((e,t)=>e.rank-t.rank||e.order-t.order),r.map(e=>e.row)}function zb({t:e,open:t,anchorRef:n,useWorkspaces:i,createWorkspace:a,useDirectoryFlow:c,renderDirectoryFlow:l,onPick:u,onPickNone:d,onClose:f,addOnly:p=!1,onBusyChange:m,side:h=`bottom`,selectedId:g}){let _=i(e=>e),v=(0,s.useMemo)(()=>_.items.filter(e=>!hv(e)),[_.items]),y=!p&&v.length>1,[b,x]=(0,s.useState)(``);(!t||!y)&&b!==``&&x(``);let S=(0,s.useCallback)(()=>n?.current?.getBoundingClientRect()??null,[n]),[C,w]=(0,s.useState)(!1),[T,E]=(0,s.useState)(null),[D,ee]=(0,s.useState)(!1),te=(0,r.usePhoneSidebar)(),ne=(0,s.useRef)(!1),[re,ie]=(0,s.useState)(!1),ae=D||re;(0,s.useEffect)(()=>{m?.(ae)},[ae,m]);let oe=c(e=>e);(0,s.useEffect)(()=>{D&&!oe&&ee(!1)},[D,oe]);let se=oe?[{id:Fb,label:e(`menu.addWorkspace`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconPlusOutlineRegular,{size:16}),disabled:ae}]:[],O=!p&&v.length>0,k=d!==void 0&&!p,ce=e(`menu.noWorkspace`),le=e(`workspace.defaultName`),ue=(0,s.useMemo)(()=>O?v.map(e=>({id:e.workspaceId,title:H_(e.title,le),path:e.path})):[],[O,v,le]),de=b.trim(),A=(0,s.useMemo)(()=>y?Rb(ue,b):ue,[y,ue,b]),fe=k&&(de===``||ce.toLowerCase().includes(de.toLowerCase()))?[{id:Ib,label:ce,disabled:ae}]:[],j=O?[...fe,...A.map(e=>({id:e.id,label:e.title,icon:/* @__PURE__ */ (0,o.jsx)(r.IconFolderCloseRegular,{size:16}),disabled:ae}))]:[...fe,...se],pe=!k&&!O&&se.length===0,me=()=>{w(!1),E(null)},he=e=>a({path:e}).then(e=>{ee(!1),u(e.workspaceId)}).catch(e=>{E(e instanceof Error?e.message:String(e)),ee(!1),w(!0)}),ge=(0,s.useCallback)(()=>{ne.current=te?.open===!0,f(),w(!1),E(null),ee(!0)},[f,te?.open]),_e=p||_.phase===`ready`,ve=!k&&!O&&_e&&se.length===1;(0,s.useEffect)(()=>{t&&ve&&!ae&&ge()},[t,ve,ae,ge]);let ye={open:D,busy:re,onPicked:e=>{ie(!0),he(e).finally(()=>{ie(!1)})},onCancel:()=>{ee(!1)},onError:e=>{ee(!1),E(e),w(!0)}},be=e=>{e===Ib?d?.():e===Fb?ge():u(e)};return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Menu,{open:t&&!ve&&!pe,anchor:null,items:j,...O?{footer:se}:{},...y?{search:{label:e(`picker.search`),value:b,onChange:x,clearLabel:e(`picker.clearSearch`),emptyMessage:e(`picker.noResults`),skipAutoFocusOnTouch:!0}}:{},selectedId:g??(k?Ib:void 0),onSelect:be,onClose:f,side:h,portal:!0,getAnchorRect:S,focusReturnTarget:n?.current??void 0}),t&&!ve&&!pe&&_.phase===`pending`&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Pb.menuStatus,role:`status`,children:e(`picker.loading`)}),l(ye),/* @__PURE__ */ (0,o.jsx)(r.Modal,{phoneSidebar:!0,phoneSidebarOrigin:ne.current,open:C,onClose:me,closeLabel:e(`close`),title:e(`folderError.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,className:Pb.modalAction,onClick:me,children:e(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`primary`,className:Pb.modalAction,disabled:!oe,onClick:ge,children:e(`folderError.retry`)})]}),children:/* @__PURE__ */ (0,o.jsx)(`div`,{className:Pb.modalError,role:`alert`,children:T})})]})}function Bb(e){return/* @__PURE__ */ (0,o.jsx)(Mb,{...e})}function Vb(e){let t=e.replaceAll(`\0`,``);if(t.length<=500)return t;let n=500,r=t.charCodeAt(n-1),i=t.charCodeAt(n);return r>=55296&&r<=56319&&i>=56320&&i<=57343&&n--,t.slice(0,n)}function Hb(e){(0,s.useEffect)(()=>{if(!e)return;let t=e=>{e.defaultPrevented||(e.preventDefault(),e.dataTransfer!==null&&(e.dataTransfer.dropEffect=`move`))},n=e=>{e.preventDefault()};return document.addEventListener(`dragover`,t),document.addEventListener(`drop`,n),()=>{document.removeEventListener(`dragover`,t),document.removeEventListener(`drop`,n)}},[e])}function Ub({groupBy:e,orderBy:t,archivedFilter:n,onGroupPick:i,onOrderPick:a,onArchivedFilterPick:c,t:l}){let[u,d]=(0,s.useState)(!1),f=(0,s.useRef)(null),p=(0,r.usePhoneSidebar)(),{collapseStyle:m,setCollapseStyle:h}=Zv(),{busy:g,failed:_,save:v}=O_(h);return/* @__PURE__ */ (0,o.jsx)(r.Menu,{phoneSidebarTitle:l(`viewOptions.label`),open:u,onClose:()=>{d(!1)},items:[{type:`label`,id:`group-by`,text:l(`groupBy.label`)},{id:`workspace`,label:l(`groupBy.workspace`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconFolderCloseRegular,{})},{id:`workspace-tree`,label:l(`groupBy.workspaceTree`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconWorkspaceTreeOutlineRegular,{})},{id:`flat`,label:l(`groupBy.flat`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconFlatListOutlineRegular,{})},{type:`separator`,id:`order-by-separator`},{type:`label`,id:`order-by`,text:l(`orderBy.label`)},{id:`manual`,label:l(`orderBy.manual`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconChevronsUpDownOutlineRegular,{})},{id:`updated`,label:l(`orderBy.updated`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconClockOutlineRegular,{})},{type:`separator`,id:`archived-filter-separator`},{type:`label`,id:`filter-by`,text:l(`filterBy.label`)},{id:`hide-archived`,label:l(`viewOptions.hideArchived`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconArchiveOffOutlineRegular,{})},{id:`show-archived`,label:l(`viewOptions.showArchived`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconQueueOutlineRegular,{})},{id:`only-archived`,label:l(`viewOptions.onlyArchived`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconArchiveCheckOutlineRegular,{})},{type:`separator`,id:`thread-tree-style-separator`},{type:`label`,id:`thread-tree-style`,text:l(`threadTree.style.title`)},{id:`summary`,label:l(`threadTree.style.summary`),disabled:g},{id:`ring`,label:l(`threadTree.style.ring`),disabled:g}],selectedIds:[e,t,{default:`hide-archived`,show:`show-archived`,only:`only-archived`}[n],m],onSelect:e=>{e===`summary`||e===`ring`?v(e).then(e=>{e&&(d(!1),f.current&&(0,r.focusWithoutRing)(f.current))}):(e===`workspace`||e===`workspace-tree`||e===`flat`?i(e):e===`manual`||e===`updated`?a(e):e===`hide-archived`?c(`default`):e===`show-archived`?c(`show`):e===`only-archived`&&c(`only`),d(!1))},align:`end`,dense:!0,listClassName:Z.viewOptionsMenu,portal:!0,anchor:/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:l(`viewOptions.label`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,ref:f,className:X(Z.iconButton,Z.wide),"aria-label":l(`viewOptions.label`),"data-phone-sidebar-return":p!==null||void 0,onClick:()=>{d(e=>!e)},children:/* @__PURE__ */ (0,o.jsx)(r.IconSlidersTwoOutlineRegular,{})})}),children:_&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:E_.error,role:`alert`,children:l(`threadTree.style.error`)})})}function Wb(e){let t=e.currentTarget.getBoundingClientRect();return e.clientY<t.top+t.height/2?`before`:`after`}function Gb({rowState:e,onLeaveArchivedOnly:t,partial:n,t:i}){let a=e.archivedFilter===`only`;return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.emptyState,"data-row-key":`empty`,children:[a?/* @__PURE__ */ (0,o.jsx)(r.IconArchiveOutlineRegular,{size:24}):/* @__PURE__ */ (0,o.jsx)(r.IconQueueOutlineRegular,{size:24}),/* @__PURE__ */ (0,o.jsx)(`div`,{children:i(n?`sessions.notLoaded`:a?`empty.noneArchived`:`empty.none`)}),a&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.emptyAction,onClick:t,children:i(`empty.viewOthers`)})]})}function Kb({list:e,groupRooms:t,showGroupsSection:n=!0,useSessionStatus:i,startSession:a,copyWorkingDirectory:c,open:l,workspaces:u,allWorkspaces:d=u,linkedRoots:f,ungroupedSessionIds:p,rowState:m,nativeSections:h,nativeThreadIds:g,useMovingSectionSessions:_,moveSessionToSection:v,finePointer:y,manageThreadSection:b,onLeaveArchivedOnly:x,workspaceReady:S,canStartProjectless:C,animationResetKey:w,scrollRef:T,onScroll:E,sessionLimits:D,setSessionLimits:ee,allWorkspacesShown:te,setAllWorkspacesShown:ne,usePanelInfo:re,onRenameRequest:ie,onDefaultHarnessRequest:ae,onDeleteRequest:oe,onSessionRenameRequest:se,renderSlot:O,insertWorkspaceBefore:k,moveWorkspaceToSection:ce,nestWorkspaces:le,groupExpansion:ue,setGroupExpanded:de,sectionExpansion:A,setSectionExpanded:fe,setSessionOrder:j,pinnedWorkspaceIds:pe,setWorkspacePinned:me,home:he,t:ge,revealSessionId:_e,onSessionRevealed:ve,shortcuts:ye,loadMoreSessions:be,hostScopeFiltered:xe=!1,singleRemoteHostScoped:Se=!1,onResetHostScope:Ce}){let M=Zv(),we=(0,r.usePhoneSidebar)(),Te=re(e=>e.activePanelId!==null),Ee=i(e=>e),De=Te?void 0:Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,Oe=(0,s.useMemo)(()=>u.map(e=>{let t=f.get(e.workspaceId);return t===void 0||t.size===0?e:{...e,sessionIds:e.sessionIds.filter(e=>!t.has(e))}}),[f,u]),ke=_e===void 0||!S?void 0:vh(Oe,M.rootId(_e)),[Ae,je]=(0,s.useState)(null),Me=(0,s.useRef)(!1),[N,Ne]=(0,s.useState)(null),Pe=(0,s.useRef)(!1),Fe=(0,s.useRef)(null),Ie=(0,s.useRef)(null);(0,s.useLayoutEffect)(()=>{let e=Ie.current;if(Ie.current=null,e===null||document.activeElement!==document.body)return;let t=Fe.current?.querySelector(`[role="tree"]`);(t?.querySelector(`[data-row-key="${CSS.escape(`workspace:${e}`)}"]`)??t?.querySelector(`[data-row-key][tabindex="0"]`))?.focus()},[pe]);let Le=(0,s.useMemo)(()=>m.archivedFilter===`only`?Yb:zv(t),[t,m.archivedFilter]),P=(0,s.useMemo)(()=>Ih(e,m,Ee),[e,m,Ee]),Re=(0,s.useMemo)(()=>new Map(P.map(e=>[e.id,e])),[P]),ze=(0,s.useMemo)(()=>Le.size===0?Re:new Map(Bv(P,Le).map(e=>[e.id,e])),[Re,P,Le]),Be=(0,s.useMemo)(()=>Xb(h,e,m,Ee,A,ze),[h,e,m,Ee,A,ze]),Ve=(0,s.useMemo)(()=>new Map(Be.map(e=>[e.id,e.rows.filter(e=>!e.archived&&!e.pinned).map(e=>e.id)])),[Be]),F=pb({enabled:y&&v!==void 0&&h.length>0,nativeSections:h,visibleSectionRows:Ve,nativeThreadIds:g,pinnedSessionIds:m.pinnedSessionIds,archivedSessionIds:m.archivedSessionIds,moveSessionToSection:v,onCancelLocalDrag:()=>{Me.current=!0,je(null)}}),He=Ae!==null||N!==null||F.active;Hb(N!==null||Ae!==null);let Ue=De===void 0||!S?void 0:vh(Oe,M.rootId(De)),I=(0,s.useMemo)(()=>new Set(pe),[pe]),{nativeSectionOf:We,sectionOf:Ge}=(0,s.useMemo)(()=>R_(h,I),[h,I]),[Ke,qe]=(0,s.useState)(),[Je,Ye]=(0,s.useState)(!1),Xe=(0,s.useMemo)(()=>new Set(ce&&h.length>0?d.filter(e=>e.projectId&&!e.remote&&!I.has(e.workspaceId)).map(e=>e.workspaceId):[]),[d,ce,h.length,I]);(0,s.useEffect)(()=>{Ke&&!Xe.has(Ke)&&qe(void 0)},[Ke,Xe]);let Ze=e=>{if(N&&ce&&Xe.has(N.workspaceId)&&(We.get(N.workspaceId)??null)!==e)return{active:N.overSection===e,hover:()=>{N.overSection!==e&&Ne({...N,over:null,overSection:e})},leave:()=>Ne(t=>t?.overSection===e?{workspaceId:t.workspaceId,over:null}:t),drop:()=>{Pe.current||(Pe.current=!0,Ne(null),Ye(!1),ce(N.workspaceId,e).catch(()=>Ye(!0)))}}},Qe=(0,s.useMemo)(()=>z_(u,le,We,I),[le,We,I,u]),L=(0,s.useMemo)(()=>d===u?Qe:z_(d,le,We,I),[d,le,We,Qe,I,u]),$e=(0,s.useMemo)(()=>{let e=new Set(Qe.values());return[...u.map(e=>e.workspaceId),``].filter(t=>ue[t]??(t===``||e.has(t)))},[ue,Qe,u]),et=(0,s.useMemo)(()=>{let n=Lh(e,u,m,Ee,{expandedGroups:$e,excludePinned:!0,hiddenSessionIds:Le},Re);return(C||m.archivedFilter!==`only`&&t.length>0||e.hasMore&&n.length===0)&&!n.some(e=>e.key===``)&&n.push({key:``,workspaceId:void 0,cwd:void 0,createdAt:void 0,label:``,sessionCount:0,expanded:$e.includes(``),containsCurrent:!1,activity:{running:0,pendingInteraction:0,completed:0},sessions:[]}),n},[e,u,m,Ee,$e,Le,C,t.length,Re]),tt=Date.now(),nt=e=>Wv(e.sessions,D[e.key]??5,De,_e,{keepPinned:e.key!==``}),rt=(e,t)=>{if(Me.current)return;Me.current=!0,je(null);let n=et.find(t=>t.key===e.accountKey);if(n===void 0||t.id===e.sessionId)return;let r=e.accountKey===``?p:u.find(t=>t.workspaceId===e.accountKey)?.sessionIds;if(r===void 0)return;let i=wh(r,nt(n).rows,e,t);i!==void 0&&j(e.accountKey,i)},it=(e,t)=>{if(Pe.current)return;Pe.current=!0,Ne(null);let n=L_(d,e.workspaceId,t,{sectionOf:Ge,parents:L});n!==null&&k(e.workspaceId,n.beforeWorkspaceId).catch(e=>{console.warn(`workspace reorder rejected:`,e)})},at=(0,s.useMemo)(()=>{let e=new Set(et.map(e=>e.key)),t=/* @__PURE__ */ new Map;for(let n of et){let r=Qe.get(n.key);for(;r!==void 0&&!e.has(r);)r=Qe.get(r);let i=t.get(r);i===void 0?t.set(r,[n]):i.push(n)}return t},[et,Qe]),ot=at.get(void 0)??[],st=(0,s.useMemo)(()=>{let e=/* @__PURE__ */ new Map,t=(n,r)=>{e.set(n.key,r);for(let e of at.get(n.key)??[])t(e,r)};for(let e of ot)t(e,e.key);return e},[at,ot]),ct=(0,s.useMemo)(()=>{let e=/* @__PURE__ */ new Set;for(let t of[Ue,ke]){let n=t===void 0?void 0:st.get(t);n!==void 0&&n!==``&&e.add(n)}return e},[Ue,ke,st]),{pinnedGroups:lt,sectionRoots:ut,workspaceRoots:dt}=(0,s.useMemo)(()=>B_(ot,h,pe,Ge),[h,pe,ot,Ge]),ft=Kv(dt,5,ct),pt=te?dt:ft.rows,mt=Jh(A,Gh),ht=Jh(A,Kh),gt=(0,s.useMemo)(()=>[...t].filter(e=>e.pinned).sort((e,t)=>t.updatedAt-e.updatedAt),[t]),_t=(0,s.useMemo)(()=>[...t].sort((e,t)=>t.updatedAt-e.updatedAt),[t]),vt=ke===void 0?void 0:st.get(ke),yt=vt!==void 0&&I.has(vt);(0,s.useEffect)(()=>{if(yt){mt||fe(Gh,!0);for(let e=ke;e!==void 0;e=Qe.get(e))$e.includes(e)||de(e,!0)}},[$e,Qe,mt,ke,yt,de,fe]);let bt=Jh(A,qh),xt=e=>{e.expanded&&ee(t=>({...t,[e.key]:5})),de(e.key,!e.expanded)},St=(0,s.useMemo)(()=>new Set(m.archivedSessionIds),[m.archivedSessionIds]),Ct=(0,s.useMemo)(()=>new Map(d.map(e=>[e.workspaceId,e])),[d]),wt=(0,s.useMemo)(()=>Bh(e,m.pinnedSessionIds,m,Ee,ze).filter(e=>e.pinned),[e,m,Ee,ze]),Tt=wt.length>0||lt.length>0||gt.length>0,Et=mt&&_e!==void 0&&wt.some(e=>e.id===_e||e.tree?.descendantIds.includes(_e)),Dt=[];if(Tt&&(Dt.push(`section:${Gh}`),mt)){for(let e of gt)Dt.push(`pinned-group:${e.roomId}`);for(let e of M.rows(wt))Dt.push(`session:${e.id}`)}if(n&&(Dt.push(`section:${Kh}`),ht))for(let e of _t)Dt.push(`group:${e.roomId}`);let Ot=e=>{let t={...e.activity};for(let n of at.get(e.key)??[]){let e=Ot(n);t.running+=e.running,t.pendingInteraction+=e.pendingInteraction,t.completed+=e.completed}return t},kt=(t,n)=>{let i=t.workspaceId,u=i!==void 0&&!t.remote,p=I.has(t.key),h=at.get(t.key)??[],g=Ge.has(t.key),v=N!==null&&I_(d,N.workspaceId,i,{sectionOf:Ge,parents:L}),y=i===void 0&&t.expanded?Gv(t.sessions,m.archivedFilter===`only`?[]:_t,D[t.key]??5,De,_e):null,b=y===null?nt(t):null,x=y?.hiddenCount??b?.hiddenCount??0,w=y?.ordinaryCount??b?.ordinaryCount??0;Dt.push(`workspace:${t.key}`);let T=t.expanded?h.map(e=>kt(e,n+1)):[],E=t.expanded?void 0:Ot(t),te=b===null?[]:M.rows(b.rows),ne=f.get(t.key),re=new Set(ne===void 0||b===null?[]:b.rows.flatMap(e=>ne.has(e.id)?[e.id,...e.tree?.descendantIds??[]]:[])),k=e=>i===void 0?`recent:${e}`:re.has(e)?`linked:${t.key}:${e}`:`session:${e}`;if(y!==null)for(let e of y.entries)if(e.kind===`group`){Dt.push(`recent-group:${e.room.roomId}`);for(let t of M.rows(e.members))Dt.push(k(t.id))}else for(let t of M.rows([e.node]))Dt.push(k(t.id));else for(let e of te)Dt.push(k(e.id));let ce=e=>m.archivedFilter===`show`?!0:m.archivedFilter===`only`?St.has(e):!St.has(e),le=t.remote&&i!==void 0&&(Ct.get(i)?.sessionIds.some(t=>e.byId[t]===void 0&&ce(t))??!1),ue=u||le,A=ue?e.workspaceHistory?.[i]??(e.canSearchWorkspaceHistory?`search`:`done`):void 0,j=A===void 0?!t.remote&&e.hasMore:A!==`done`,pe=t.expanded&&(x>0||j);pe&&Dt.push(`overflow:${t.key}`);let xe=i!==void 0&&N?.over?.id===i?N?.over?.half??null:null,Ce=i!==void 0&&Xe.has(i),Te=i===void 0||g&&!Ce?void 0:{start:()=>{Pe.current=!1,Ne({workspaceId:i,over:null})},end:()=>{N?.over!==null&&N?.over!==void 0?it(N,N.over):Ne(null),Pe.current=!1}},Ee=i===void 0||!v?void 0:e=>{Ne(t=>t===null?t:{workspaceId:t.workspaceId,over:{id:i,half:e}})},Oe=i===void 0||!v?void 0:e=>{it(N,{id:i,half:e})},Fe=e=>{let n=Ae!==null&&Ae.accountKey===t.key,r=n&&Ae.pinned===e.pinned,a=t=>e.blank?`after`:t,s=i!==void 0&&!t.remote&&(e.tree?.depth??0)===0,c=F.canDragRow(e,!!t.remote),u=s?{start:()=>{Me.current=!1,je({accountKey:t.key,sessionId:e.id,pinned:e.pinned,over:null}),c?F.startFromUnsectioned(e.id):F.end()},active:r,marker:!F.hasSectionTarget&&n&&Ae.over?.id===e.id?Ae.over.half:null,hover:t=>{
122
122
  /* v8 ignore next -- narrowing guard: Rows gates hover on `active`, which is false while the drag state is null. */
123
- F.clearHover(),Ae(n=>n===null?n:{...n,over:{id:e.id,half:a(t)}})},drop:t=>{F.end(),ke!==null&&et(ke,{id:e.id,half:a(t)})},end:e=>{let t=F.canFinishLocalDrop(e);F.end(),t&&ke?.over?et(ke,ke.over):Ae(null),je.current=!1}}:c?{canDrag:!0,start:()=>{F.startFromUnsectioned(e.id)},active:!1,marker:null,hover:()=>{},drop:()=>{},end:()=>{F.end()}}:void 0;return/* @__PURE__ */ (0,o.jsx)(hy,{rowKey:D(e.id),showHost:!t.remote&&!(i===void 0&&xe),node:e,currentId:Ee,now:L,onOpen:l,onRenameRequest:se,renderSlot:O,onReveal:e.id===ge&&t.key===Oe&&!Ct?()=>{_e(e.id)}:void 0,drag:u,useMovingSectionSessions:_,t:he},e.id)}}):E.map(e=>e.kind===`group`?/* @__PURE__ */ (0,o.jsx)(`div`,{children:O(`sidebar.workspaces.groups.row`,{roomId:e.room.roomId,rowKey:`recent-group:${e.room.roomId}`,placement:`recent`,showHost:!xe})},`recent-group:${e.room.roomId}`):/* @__PURE__ */ (0,o.jsx)(Bv,{roots:[e.node],children:e=>/* @__PURE__ */ (0,o.jsx)(hy,{rowKey:D(e.id),showHost:!t.remote&&!(i===void 0&&xe),node:e,currentId:Ee,now:L,onOpen:l,onRenameRequest:se,renderSlot:O,onReveal:e.id===ge&&t.key===Oe&&!Ct?()=>{_e(e.id)}:void 0,useMovingSectionSessions:_,t:he},e.id)},e.node.id)),A&&/* @__PURE__ */ (0,o.jsx)(My,{rowKey:`overflow:${t.key}`,hiddenCount:v.hiddenCount,hasMore:k,loading:ce===void 0?!t.remote&&e.loading:ce===`loading`,workspaceHistory:ce,workspaceId:re?i:void 0,fillWorkspace:s&&S&&e.phase===`ready`&&e.workspaceHistory?.[i]===void 0&&v.ordinaryCount<5,expand:()=>{ee(e=>({...e,[t.key]:(e[t.key]??5)+10}))},loadMoreSessions:ye,t:he})]})]},t.key)},Dt=dt?ot.map(e=>Et(e,0)):void 0,Ot=/* @__PURE__ */ new Map;for(let e of Le)wt.push(...Tb([e],N.rows)),e.expanded&&Ot.set(e.key,(st.get(e.id)??[]).map(e=>Et(e,0)));!be&&Qe.length===0&&!St&&h.length===0&&wt.push(`empty`);let kt=Je(null),At=be&&ct.length===0&&ot.length===0,jt=ct.length>0||At||!!kt,Mt=!(jt||St||Le.length>0)&&ut[0]?.workspaceId!==void 0&&P?.over?.id===ut[0].workspaceId&&P?.over?.half===`before`,Nt=[];if(jt&&wt.push(`section:${jh}`),_t){At&&(wt.push(`empty:host-scope`),Nt.push(/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.filterEmptyHint,"data-row-key":`empty:host-scope`,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{children:he(`hostScope.emptyWorkspaces`)}),Se!==void 0&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.emptyAction,onClick:Se,children:he(`hostScope.showAll`)})]},`empty:host-scope`)));for(let e of ut)Nt.push(Et(e,0));!te&&lt.hiddenCount>0&&(wt.push(`overflow:workspaces`),Nt.push(/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.sessionOverflowButton,"data-row-key":`overflow:workspaces`,onClick:()=>ne(!0),children:he(`workspaces.expand`)},`overflow:workspaces`)))}let Pt=rt.find(e=>e.key===``);return Pt!==void 0&&Nt.push(Et(Pt,0)),/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:Pe,className:X(Z.treeBody,Z.wide),onDragOver:F.active?F.clearHover:void 0,onDragLeave:F.active?e=>{(!(e.relatedTarget instanceof Node)||!e.currentTarget.contains(e.relatedTarget))&&F.clearHover()}:void 0,children:[Mt&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.listTopDropIndicator,"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsxs)(K_,{className:X(Z.list,Mt&&Z.listTopDropActive),label:he(`section.sessions`),rowKeys:wt,scrollRef:T,onScroll:E,ready:e.phase===`ready`&&S&&!ze,resetKey:JSON.stringify([w,D,te,dt,ft,_t]),children:[/* @__PURE__ */ (0,o.jsx)(Oy,{rows:xt,hasWorkspaces:ot.length>0,hasExtraItems:pt.length>0,leadingChildren:pt.length>0?pt.map(e=>/* @__PURE__ */ (0,o.jsx)(`div`,{children:O(`sidebar.workspaces.groups.row`,{roomId:e.roomId,rowKey:`pinned-group:${e.roomId}`,placement:`pinned`,showHost:!xe})},`pinned-group:${e.roomId}`)):void 0,sectionDrag:F.interaction,currentId:Ee,showHost:!xe,onOpen:l,onRenameRequest:se,renderSlot:O,useMovingSectionSessions:_,revealSessionId:ge,onSessionRevealed:_e,expanded:dt,onToggle:()=>{de(kh,!dt)},t:he,children:Dt}),n&&O(`sidebar.workspaces.groups.section`,{expanded:ft,onToggle:()=>{de(`groups`,!ft)},rowKey:`section:groups`,roomIds:mt.map(e=>e.roomId),showHost:!xe,allowCreate:!xe}),/* @__PURE__ */ (0,o.jsx)(Eb,{sections:Le,groupRows:Ot,projectSectionDrop:Je,manageThreadSection:b,sectionDrag:F.interaction,currentId:Ee,showHost:!xe,onOpen:l,onRenameRequest:se,renderSlot:O,useMovingSectionSessions:_,revealSessionId:ge,onSessionRevealed:_e,setSectionExpanded:de,t:he}),!be&&Qe.length===0&&!St&&h.length===0&&/* @__PURE__ */ (0,o.jsx)(bb,{rowState:m,onLeaveArchivedOnly:x,partial:e.hasMore,t:he}),(jt||Nt.length>0||F.canDropToUnsectioned)&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(Z.unsectionedZone,F.isUnsectionedTarget&&Z.unsectionedDropTarget),"data-section-drop-unsectioned":``,onDragOver:F.canDropToUnsectioned?e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`,F.hoverUnsectioned()}:void 0,onDrop:F.canDropToUnsectioned?e=>{e.dataTransfer.dropEffect!==`copy`&&(e.preventDefault(),e.stopPropagation(),F.dropUnsectioned(e.dataTransfer.dropEffect))}:void 0,children:[jt&&/* @__PURE__ */ (0,o.jsx)(Ty,{label:he(`section.workspaces`),projectDrop:kt,expanded:_t,onToggle:()=>{_t&&ne(!1),de(`workspaces`,!_t)},rowKey:`section:workspaces`}),Nt,!jt&&Nt.length===0&&F.canDropToUnsectioned&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.unsectionedDropHint,children:he(`section.unsectioned`)})]})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.fade}),We&&qe.has(We)&&k&&/* @__PURE__ */ (0,o.jsx)(Ny,{current:He.get(We)??``,sections:h,move:e=>k(We,e),dismiss:()=>Ge(void 0),defaultLabel:he(`section.workspaces`),failedLabel:he(`section.projectMoveFailed`),t:he},We),I&&/* @__PURE__ */ (0,o.jsx)(r.Toast,{text:he(`section.projectMoveFailed`),onDone:()=>Ke(!1)})]})}let Sb=[],Cb=[];function wb(e,t,n,r,i,a){if(!e.length)return[];let o=a??new Map(bh(t,n,r).map(e=>[e.id,e])),s=/* @__PURE__ */ new Set;return e.map(e=>{let{id:t,threadIds:n}=e,r=`native-section:${t}`;return{id:t,section:e,key:r,rows:n.flatMap(e=>{let t=o.get(e);return!t||t.pinned||s.has(e)?[]:(s.add(e),[t])}),expanded:Mh(i,r)}})}function Tb(e,t){return e.flatMap(({key:e,rows:n,expanded:r})=>[`section:${e}`,...r?t(n).map(e=>`session:${e.id}`):[]])}function Eb({sections:e,groupRows:t,projectSectionDrop:n,manageThreadSection:r,setSectionExpanded:i,...a}){return e.map(({key:e,section:s,rows:c,expanded:l})=>/* @__PURE__ */ (0,o.jsx)(Oy,{...a,rows:c,customSection:{key:e,section:s,projectDrop:n?.(s.id)},headingActions:r&&Uv(s)&&/* @__PURE__ */ (0,o.jsx)(O_,{section:s,request:r,t:a.t}),expanded:l,onToggle:()=>i(e,!l),children:t?.get(e)},e))}function Db({list:e,groupRooms:t,showGroupsSection:n=!0,sessionIds:r,rowState:i,nativeSections:a,nativeThreadIds:c,useMovingSectionSessions:l,moveSessionToSection:u,finePointer:d,manageThreadSection:f,onLeaveArchivedOnly:p,useSessionStatus:m,open:h,onSessionRenameRequest:g,usePanelInfo:_,setSessionOrder:v,sectionExpansion:y,setSectionExpanded:b,workspaceReady:x,animationResetKey:S,scrollRef:C,onScroll:w,limit:T,setLimit:E,revealSessionId:D,onSessionRevealed:ee,renderSlot:te,loadMoreSessions:ne,hostScopeFiltered:re=!1,singleRemoteHostScoped:ie=!1,onResetHostScope:ae,t:oe}){let se=_(e=>e.activePanelId!==null),O=m(e=>e),ce=wv(),k=(0,s.useMemo)(()=>new Map(bh(e,i,O).map(e=>[e.id,e])),[e,i,O]),A=(0,s.useMemo)(()=>wh(e,r,i,O,k,{floatPinned:!1}).filter(e=>!i.sectionedSessionIds?.has(e.id)),[e,r,i,O,k]),le=(0,s.useMemo)(()=>wh(e,i.pinnedSessionIds,i,O,k).filter(e=>e.pinned),[e,i,O,k]),[ue,j]=(0,s.useState)(null),de=(0,s.useRef)(!1),M=Mh(y,kh),fe=Mh(y,Ah),pe=(0,s.useMemo)(()=>[...t].filter(e=>e.pinned).sort((e,t)=>t.updatedAt-e.updatedAt),[t]),me=(0,s.useMemo)(()=>[...t].sort((e,t)=>t.updatedAt-e.updatedAt),[t]),he=M&&D!==void 0&&le.some(e=>e.id===D||e.tree?.descendantIds.includes(D)),ge=(0,s.useMemo)(()=>wb(a,e,i,O,y,k),[a,e,i,O,y,k]),_e=(0,s.useMemo)(()=>new Map(ge.map(e=>[e.id,e.rows.filter(e=>!e.archived&&!e.pinned).map(e=>e.id)])),[ge]),ve=Hy({enabled:d&&u!==void 0&&a.length>0,nativeSections:a,visibleSectionRows:_e,nativeThreadIds:c,pinnedSessionIds:i.pinnedSessionIds,archivedSessionIds:i.archivedSessionIds,moveSessionToSection:u,onCancelLocalDrag:()=>{de.current=!0,j(null)}});hb(ue!==null);let ye=se?void 0:Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,be=Ay(A,T,ye,D,{keepPinned:!1}),xe=Ay(A,10,ye,D,{keepPinned:!1}).hiddenCount>0,Se=(e,t)=>{if(de.current)return;de.current=!0,j(null);let n=_b(r,A,e,t,!1);n!==void 0&&v(Oh,n)},N=Date.now();return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(Z.treeBody,Z.wide),onDragOver:ve.active?ve.clearHover:void 0,onDragLeave:ve.active?e=>{(!(e.relatedTarget instanceof Node)||!e.currentTarget.contains(e.relatedTarget))&&ve.clearHover()}:void 0,children:[/* @__PURE__ */ (0,o.jsxs)(K_,{className:X(Z.list,Z.flatList),label:oe(`section.sessions`),scrollRef:C,onScroll:w,rowKeys:[...le.length===0&&pe.length===0?[]:[`section:${kh}`],...M?[...pe.map(e=>`pinned-group:${e.roomId}`),...ce.rows(le).map(e=>`session:${e.id}`)]:[],...n?[`section:${Ah}`,...fe?me.map(e=>`group:${e.roomId}`):[]]:[],...Tb(ge,ce.rows),...A.length===0&&le.length===0&&pe.length===0&&me.length===0&&a.length===0?[re?`empty:host-scope`:`empty`]:[],...ce.rows(be.rows).map(e=>`recent:${e.id}`),...xe||e.hasMore?[`overflow:flat`]:[]],ready:e.phase===`ready`&&x&&ue===null&&!ve.active,resetKey:`${S}/${T}/${String(M)}/${String(fe)}`,children:[/* @__PURE__ */ (0,o.jsx)(Oy,{rows:le,hasExtraItems:pe.length>0,leadingChildren:pe.length>0?pe.map(e=>/* @__PURE__ */ (0,o.jsx)(`div`,{children:te(`sidebar.workspaces.groups.row`,{roomId:e.roomId,rowKey:`pinned-group:${e.roomId}`,placement:`pinned`,showHost:!ie})},`pinned-group:${e.roomId}`)):void 0,sectionDrag:ve.interaction,currentId:ye,showHost:!ie,onOpen:h,onRenameRequest:g,renderSlot:te,useMovingSectionSessions:l,revealSessionId:D,onSessionRevealed:ee,expanded:M,onToggle:()=>{b(kh,!M)},t:oe}),n&&te(`sidebar.workspaces.groups.section`,{expanded:fe,onToggle:()=>{b(`groups`,!fe)},rowKey:`section:groups`,roomIds:me.map(e=>e.roomId),showHost:!ie,allowCreate:!ie}),/* @__PURE__ */ (0,o.jsx)(Eb,{sections:ge,manageThreadSection:f,sectionDrag:ve.interaction,currentId:ye,showHost:!ie,onOpen:h,onRenameRequest:g,renderSlot:te,useMovingSectionSessions:l,revealSessionId:D,onSessionRevealed:ee,setSectionExpanded:b,t:oe}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(Z.unsectionedZone,Z.flatUnsectioned,ve.isUnsectionedTarget&&Z.unsectionedDropTarget),"data-section-drop-unsectioned":``,onDragOver:ve.canDropToUnsectioned?e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`,ve.hoverUnsectioned()}:void 0,onDrop:ve.canDropToUnsectioned?e=>{e.dataTransfer.dropEffect!==`copy`&&(e.preventDefault(),e.stopPropagation(),ve.dropUnsectioned(e.dataTransfer.dropEffect))}:void 0,children:[(le.length>0||pe.length>0||a.length>0)&&/* @__PURE__ */ (0,o.jsx)(Ty,{label:oe(`section.sessions`)}),A.length===0&&le.length===0&&pe.length===0&&me.length===0&&a.length===0&&(re?/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.filterEmptyHint,"data-row-key":`empty:host-scope`,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{children:oe(`hostScope.emptySessions`)}),ae!==void 0&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.emptyAction,onClick:ae,children:oe(`hostScope.showAll`)})]}):/* @__PURE__ */ (0,o.jsx)(bb,{rowState:i,onLeaveArchivedOnly:p,partial:e.hasMore,t:oe})),/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.flatRows,onDragOver:!ve.canDropToUnsectioned&&ue!==null?e=>{let t=Zv(e,null);t!==null&&(ve.clearHover(),(ue.over?.id!==t.id||ue.over.half!==t.half)&&j({...ue,over:t}),e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`)}:void 0,onDrop:!ve.canDropToUnsectioned&&ue!==null?e=>{if(e.dataTransfer.dropEffect===`copy`)return;let t=Zv(e,null);t!==null&&(e.preventDefault(),e.stopPropagation(),ve.end(),Se(ue,t))}:void 0,children:/* @__PURE__ */ (0,o.jsx)(Bv,{roots:be.rows,children:e=>{let t=ue!==null,n=t=>e.blank?`after`:t,r=ve.canDragRow(e);return/* @__PURE__ */ (0,o.jsx)(hy,{rowKey:`recent:${e.id}`,node:e,showHost:!ie,currentId:ye,now:N,onOpen:h,onRenameRequest:g,renderSlot:te,onReveal:e.id===D&&!he?()=>{ee(e.id)}:void 0,drag:{start:()=>{de.current=!1,j({accountKey:Oh,sessionId:e.id,pinned:e.pinned,over:null}),r?ve.startFromUnsectioned(e.id):ve.end()},active:t,marker:!ve.hasSectionTarget&&t&&ue.over?.id===e.id?ue.over.half:null,hover:t=>{ve.clearHover(),j(r=>r===null?r:{...r,over:{id:e.id,half:n(t)}})},drop:t=>{ve.end(),ue!==null&&Se(ue,{id:e.id,half:n(t)})},end:e=>{let t=ve.canFinishLocalDrop(e);ve.end(),t&&ue?.over?Se(ue,ue.over):j(null),de.current=!1}},useMovingSectionSessions:l,t:oe},e.id)}})}),/* @__PURE__ */ (0,o.jsx)(My,{rowKey:`overflow:flat`,hiddenCount:be.hiddenCount,hasMore:e.hasMore,loading:e.loading,expanded:T>10,expand:()=>E(T+10),collapse:xe?()=>E(10):void 0,loadMoreSessions:ne,t:oe})]})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.fade})]})}function Ob({useSessions:e,useSessionStatus:t,open:n,onUnarchive:r,workspaces:i,archivedSessionIds:a,archivedFilter:c,query:l,remote:u,resultLimit:d,treeRef:f,usePanelInfo:p,scrollRef:m,onScroll:h,t:g}){let _=p(e=>e.activePanelId!==null),v=e(e=>e),y=t(e=>e),b=u.query===l?u:{query:l,status:`loading`,items:[],hasMore:!1},x=(0,s.useMemo)(()=>Th(v,i,l,a,c,y,b,d),[v,i,l,a,c,y,b,d]),S=b.status===`loading`,C=_?void 0:Object.values(v.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id;return(0,s.useLayoutEffect)(()=>{H_(f.current)},[C,x,f]),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(Z.treeBody,Z.wide),children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.list,ref:m,onScroll:h,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.searchTree,role:`tree`,"aria-label":g(`search.results.aria`),ref:f,onFocusCapture:()=>H_(f.current),onKeyDown:U_,children:x.items.map(e=>/* @__PURE__ */ (0,o.jsx)(my,{result:e,currentId:C,onOpen:n,onUnarchive:r,t:g},e.id))}),S&&/* @__PURE__ */ (0,o.jsx)(`div`,{role:`status`,"aria-label":g(`search.pending`),children:(x.items.length===0?[0,1]:[0]).map(e=>/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.skeletonRow,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.skeletonDot}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:Z.skeletonBars,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.skeletonBar}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:X(Z.skeletonBar,Z.skeletonBarWide)})]})]},e))}),!S&&x.items.length===0&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.empty,children:g(`search.noMatches`)}),x.hasMore&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.searchStatus,children:g(`search.hasMore`,{n:d})})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.fade})]})}function kb(e){return/* @__PURE__ */ (0,o.jsx)(Tv,{browser:e,children:/* @__PURE__ */ (0,o.jsx)(Ab,{...e})})}function Ab({wide:e,usePanelInfo:t,expandSidebar:n,useSessions:i,useSessionStatus:a,useWorkspaces:c,useStore:l,actions:u,startSession:d,copyWorkingDirectory:f,open:p,markCompletionsRead:m,requestSessionRename:h,notifyArchivedNotOpenable:g,renameWorkspace:_,deleteWorkspace:v,insertWorkspaceBefore:y,moveWorkspaceToSection:b,setWorkspacePinned:x,unarchiveSession:S,createWorkspace:C,requestManageThreadSection:w,moveSessionToSection:T,setScopedSessionIds:E,searchSessions:D,searchResultLimit:ee,useDirectoryFlow:te,useHostInfo:ne,useShortcuts:re,useWorkspaceShortcuts:ie,useNativeThreads:ae,useMovingSectionSessions:oe,useGroupRooms:se,requestSearch:O,requestAddWorkspace:ce,closeAddWorkspace:k,setDirectoryBusy:A,dismissForkError:le,refreshSessions:ue,loadMoreSessions:j,renderSlot:de,t:M}){let fe=ne(e=>e.home),pe=re(e=>e),me=pe.find(e=>e.id===`session.search`),he=pe.find(e=>e.id===`session.activityView`),ge=pe.find(e=>e.id===`workspace.add`),_e=ie(e=>e),ve=t(e=>e.activePanelId!==null),ye=a(e=>e),be=ae(e=>e),xe=se(e=>e),Se=Vy(),N=i(e=>e),Ce=c(e=>e.items),we=c(e=>e.canStartProjectless===!0),Te=M(`workspace.defaultName`),Ee=M(`group.remoteOtherSessions`),De=(0,s.useMemo)(()=>Ce.map(e=>({...e,title:$_(e)?Ee:E_(e.title,Te)})),[Ce,Te,Ee]),Oe=c(e=>e.phase),ke=c(e=>e.state),Ae=c(e=>e.archivedSessionIds),je=c(e=>e.pinnedSessionIds),P=c(e=>e.pinnedWorkspaceIds??Cb),Me=c(e=>e.threadSections??Sb),Ne=c(e=>e.state===`idle`&&e.threadSectionsV1===!0),Pe=Ne?w:void 0,Fe=te(e=>e),Ie=l(e=>e.groupBy),Le=l(e=>e.orderBy),Re=l(e=>e.archivedFilter??`default`),F=l(e=>e.groupExpansion),ze=wv(),Be=l(e=>e.sectionExpansion),Ve=l(e=>e.sessionOrderByAccount),He=e=>{Ae.includes(e)?g():(ze.selectSidebarRow(e),p(e))},Ue=()=>{u.setArchivedFilter(`default`)},We=Oe===`ready`&&ke!==`loading`,Ge=Object.values(N.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,I=Ge!==void 0&&N.byId[Ge]?.blank===!0?Ge:void 0,Ke=(0,s.useMemo)(()=>{let e=new Set(De.flatMap(e=>e.sessionIds));return[.../* @__PURE__ */ new Set([...N.ids,...Ae])].filter(t=>!e.has(t))},[Ae,N.ids,De]),qe=(0,s.useMemo)(()=>({pinnedSessionIds:je,archivedSessionIds:Ae}),[Ae,je]),Je=Re===`only`?Sb:Me,Ye=(0,s.useMemo)(()=>({...qe,archivedFilter:Re,sectionedSessionIds:new Set(Je.flatMap(e=>e.threadIds))}),[qe,Re,Je]),Xe=(0,s.useMemo)(()=>Sh(N,Ae),[Ae,N]),Ze=(0,s.useMemo)(()=>Fh(N,Ye,ze.forest),[N,Ye,ze.forest]),Qe=(0,s.useMemo)(()=>De.map(e=>{let{memberIds:t,linkedRootIds:n}=Ih(e.sessionIds,Ze),r=Le===`updated`?oh(t,Ze.summaries):sh(t,Ve[e.workspaceId],Ze.summaries,qe);return{workspace:{...e,sessionIds:ch(r,I!==void 0&&t.includes(I)?I:void 0)},linkedRootIds:n}}),[I,Ze,Le,qe,Ve,De]),L=(0,s.useMemo)(()=>Qe.map(({workspace:e})=>e),[Qe]),$e=(0,s.useMemo)(()=>new Map(Qe.map(({workspace:e,linkedRootIds:t})=>[e.workspaceId,t])),[Qe]),et=(0,s.useMemo)(()=>oh(Ke.filter(e=>Ze.rootIds.has(e)),Ze.summaries),[Ze,Ke]),tt=(0,s.useMemo)(()=>{let e=Xe.filter(e=>Ze.rootIds.has(e));return ch(Le===`updated`?oh(e,Ze.summaries):sh(e,Ve[Oh],Ze.summaries,qe),I!==void 0&&Xe.includes(I)?I:void 0)},[I,Xe,Ze,Le,qe,Ve]),nt=(0,s.useMemo)(()=>Lh(De,N,Ye,Ze),[N,Ye,Ze,De]),rt=(0,s.useMemo)(()=>Object.fromEntries([...L.map(e=>[e.workspaceId,e.sessionIds]),[``,et],[Oh,tt]]),[tt,et,L]);(0,s.useEffect)(()=>{Oe===`ready`&&u.retainAccountKeys([``,Oh,...De.map(e=>e.workspaceId)])},[u.retainAccountKeys,Oe,De]),(0,s.useEffect)(()=>{if(N.phase!==`ready`||We||Le!==`manual`||I===void 0)return;let e={};for(let[t,n]of Object.entries(rt)){if(t!==`__flat_session_order__`&&Oe!==`ready`)continue;let r=Ve[t]??[];n[0]===I&&r[0]!==I&&(e[t]=[I,...r.filter(e=>e!==I)])}Object.keys(e).length>0&&u.syncSessionOrders(e,nt)},[u.syncSessionOrders,rt,I,N.phase,Le,Ve,nt,Oe,We]),(0,s.useEffect)(()=>{N.phase===`ready`&&We&&Le===`manual`&&I!==void 0&&Object.entries(rt).some(([e,t])=>t[0]===I&&Ve[e]?.[0]!==I)&&u.syncSessionOrders(rt,nt)},[u.syncSessionOrders,rt,I,N.phase,Le,Ve,nt,We]);let it=(e,t)=>{u.setSessionOrder(e,t,rt,nt)},[at,ot]=(0,s.useState)(``),[st,ct]=(0,s.useState)(!1),[lt,ut]=(0,s.useState)(!1),[dt,ft]=(0,s.useState)(void 0),[pt,mt]=(0,s.useState)({}),[ht,gt]=(0,s.useState)(!1),[_t,vt]=(0,s.useState)(10),yt=mb(at).trim(),[bt,xt]=(0,s.useState)({query:``,status:`idle`,items:[],hasMore:!1}),St=(0,s.useRef)(null),Ct=(0,s.useRef)(null),wt=(0,s.useRef)(null),Tt=_e.addRequested,Et=(0,s.useRef)(null),[Dt,Ot]=(0,s.useState)(!1),[kt,At]=(0,s.useState)(()=>bv()),jt=(0,s.useRef)(null);if(jt.current===null){let e=/* @__PURE__ */ new Set;for(let t of Object.keys(kt.perHost))t!==`local`&&t!==kt.selectedHost&&e.add(t);jt.current=e}let Mt=(0,s.useCallback)(e=>{At(e),xv(e)},[]);(0,s.useEffect)(()=>{let e=e=>{let t=e.detail;if(!t||typeof t.hostId!=`string`||t.hostId===``||!Array.isArray(t.workspaceIds))return;let n=t.workspaceIds.filter(e=>typeof e==`string`);jt.current?.add(t.hostId),At(e=>{let r=hv(e,t.hostId,n);return xv(r),r})};return window.addEventListener(Z_,e),()=>{window.removeEventListener(Z_,e)}},[]),(0,s.useEffect)(()=>{if(Oe!==`ready`||ke!==`idle`)return;let e=window.setTimeout(()=>{let e=jt.current;if(e!==null&&e.size>0)for(let t of L){let n=t.remote?.hostId;n!==void 0&&t.remote?.state===`connected`&&e.delete(n)}let t=rv(kt,L,e===null||e.size===0?void 0:{preserveHostKeys:e});t!==kt&&Mt(t)},250);return()=>{window.clearTimeout(e)}},[kt,L,Mt,Oe,ke]);let Nt=()=>{Mt(gv())},Pt=(0,s.useMemo)(()=>Q_(L),[L]),Ft=(0,s.useMemo)(()=>ev(L),[L]),It=(0,s.useMemo)(()=>nv(kt,L),[kt,L]),Lt=(0,s.useMemo)(()=>Pt&&iv(It,L),[Pt,It,L]),Rt=(0,s.useMemo)(()=>Pt&&It.selectedHost!==`all`&&It.selectedHost!==`local`,[Pt,It.selectedHost]),zt=(0,s.useMemo)(()=>Lt?av(L,It):L,[Lt,L,It]),Bt=(0,s.useMemo)(()=>new Set(zt.map(e=>e.workspaceId)),[zt]),Vt=(0,s.useMemo)(()=>Lt?uv(tt.map(e=>({id:e,remote:N.byId[e]?.projectionValues?.remoteHost??void 0})),Bt,L,It).map(e=>e.id):tt,[Lt,tt,N.byId,Bt,L,It]),Ht=(0,s.useMemo)(()=>we&&cv(It,L),[we,It,L]),Ut=(0,s.useMemo)(()=>lv(It,L,zt),[It,L,zt]),Wt=(0,s.useMemo)(()=>{if(!Pt||!Lt)return xe;let e=It.selectedHost;return xe.filter(t=>{let n=t.remote?.hostId??`local`;return e!==`all`&&e!==n?!1:n===`local`?Ut:It.perHost[n]?.mode!==`selected`||zt.some(e=>e.remote?.hostId===n)})},[Pt,Lt,xe,It,Ut,zt]),Gt=Rt?Wt.length>0:Ut||Wt.length>0,Kt=(0,s.useMemo)(()=>Lt?new Set(uv(N.ids.map(e=>({id:e,remote:N.byId[e]?.projectionValues?.remoteHost??void 0})),Bt,L,It,Ze.rootOf).map(e=>e.id)):null,[Lt,N.ids,N.byId,Bt,L,It,Ze.rootOf]),qt=(0,s.useMemo)(()=>Kt===null?N:{...N,ids:N.ids.filter(e=>Kt.has(e)),...Ut?{}:{hasMore:!1,loading:!1}},[N,Ut,Kt]);(0,s.useEffect)(()=>{E?.(Kt)},[E,Kt]),(0,s.useEffect)(()=>()=>{E?.(null)},[E]);let Jt=(0,s.useMemo)(()=>Lt?JSON.stringify(It):`all`,[Lt,It]),Yt=`${Ie}/${Le}/${Re}/${Jt}`,Xt=yt===``?`${lt?`activity`:Ie===`flat`?`flat`:`tree`}/${Yt}`:`search/${Yt}/${yt}`,Zt=N.phase===`ready`&&We&&(yt===``||bt.query===yt&&bt.status!==`loading`),Qt=(0,s.useRef)(null),$t=(0,s.useRef)(),en=(0,s.useRef)(null);(0,s.useLayoutEffect)(()=>{let t=Qt.current;if(!e||t===null){en.current=null;return}let n=en.current;if((n?.key!==Xt||n.node!==t)&&(n?.node===t&&dt===void 0&&(t.scrollTop=0),n={key:Xt,node:t,pending:!0},en.current=n),n.pending){if(dt===void 0){let e=t.scrollTop;if(e!==0)($t.current??=/* @__PURE__ */ new Map).set(Xt,e);else{let e=$t.current?.get(Xt)??0;if(e!==0){if(!Zt)return;t.scrollTop=e,$t.current?.set(Xt,t.scrollTop)}}}n.pending=!1}},[e,Xt,Zt,dt]);let tn={scrollRef:Qt,onScroll:({currentTarget:t})=>{let n=en.current;if(!e||n?.key!==Xt||n.node!==t)return;let r=t.scrollTop;r===0&&(n.pending||t.scrollHeight<=t.clientHeight)||(n.pending=!1,($t.current??=/* @__PURE__ */ new Map).set(Xt,r))}},nn=(0,s.useMemo)(()=>R_(qt,Ye,ye),[qt,Ye,ye]),rn=ve?void 0:Ge,an=(0,s.useCallback)(e=>{e.length!==0&&(m??ze.markCompletionsRead)(e)},[m,ze.markCompletionsRead]),on=()=>{let e=It.selectedHost!==`all`&&It.selectedHost!==`local`?It.selectedHost:void 0;window.dispatchEvent(new CustomEvent(`codexhost:open-add-remote-workspace`,{detail:e===void 0?{}:{hostId:e}}))},sn=(0,s.useRef)(!1),cn=e=>{if(Ae.includes(e)){g();return}let t=ze.rootId(e),n=De.find(e=>e.sessionIds.includes(t));if(Lt){let e=_v(It,n,L);e!==It&&Mt(e)}let r=Ie===`flat`?void 0:n?.workspaceId,i=Je.find(({threadIds:e})=>e.includes(t))??(r===void 0?void 0:Je.find(({workspaceIds:e})=>e?.includes(r)===!0));i&&u.setSectionExpanded(`native-section:${i.id}`,!0),ut(!1),ft(e),ot(``),ct(!1),ze.reveal(e),p(e)},ln=e=>{let t=Qt.current;e===dt&&t!==null&&($t.current??=/* @__PURE__ */ new Map).set(Xt,t.scrollTop),ft(t=>t===e?void 0:t)};(0,s.useEffect)(()=>{yt!==``&&ft(void 0)},[yt]);let[un,dn]=(0,s.useState)(!1);(0,s.useEffect)(()=>{if(e&&un){let e=window.setTimeout(()=>{Ct.current?.focus({preventScroll:!0}),dn(!1)},300);return()=>{window.clearTimeout(e)}}},[e,un]),(0,s.useEffect)(()=>{_e.searchRequest!==0&&(k(),ct(!0),e?Ct.current?.focus({preventScroll:!0}):(dn(!0),n()))},[_e.searchRequest]);let fn=(0,s.useRef)({wide:e,searchActive:!1});fn.current={wide:e,searchActive:st||at!==``},(0,s.useEffect)(()=>{if(_e.activityViewRequest===0)return;k();let{wide:e,searchActive:t}=fn.current;t?(ot(``),ct(!1),ut(!0),e||n()):e?ut(e=>!e):(n(),ut(!0))},[_e.activityViewRequest]),(0,s.useEffect)(()=>{e&&st&&!un&&Ct.current?.focus({preventScroll:!0})},[e,st,un]),(0,s.useEffect)(()=>{if(!e||!st||un)return;let t=e=>{e.target instanceof Node&&St.current?.contains(e.target)!==!0&&(Ct.current?.blur(),yt===``&&ct(!1))};return document.addEventListener(`click`,t),()=>{document.removeEventListener(`click`,t)}},[yt,e,st,un]),(0,s.useEffect)(()=>{if(yt===``){xt({query:``,status:`idle`,items:[],hasMore:!1});return}let e=new AbortController;xt({query:yt,status:`loading`,items:[],hasMore:!1});let t=window.setTimeout(()=>{D(yt,e.signal).then(t=>{e.signal.aborted||xt({query:yt,status:`ready`,items:t.items,hasMore:t.hasMore})}).catch(()=>{e.signal.aborted||xt({query:yt,status:`error`,items:[],hasMore:!1})})},250);return()=>{window.clearTimeout(t),e.abort()}},[yt,D]);let[pn,mn]=(0,s.useState)(null),[hn,gn]=(0,s.useState)(``),[_n,vn]=(0,s.useState)(null),yn=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(_n!==null)return;let e=yn.current;yn.current=null,e?.isConnected&&e.focus()},[_n]);let[bn,xn]=(0,s.useState)(!1),[Sn,Cn]=(0,s.useState)(null),wn=hn.trim(),Tn=pn!==null&&wn!==``&&De.some(e=>e.workspaceId!==pn.workspaceId&&e.title===wn),En=bn||wn===``||pn===null||wn===pn.storedTitle||Tn,Dn=()=>{bn||(mn(null),Cn(null))},On=()=>{En||(xn(!0),Cn(null),_(pn.workspaceId,wn).then(()=>{xn(!1),mn(null)}).catch(e=>{xn(!1),Cn(e instanceof Error?e.message:String(e))}))},kn=e=>{S(e).catch(e=>{console.warn(`session unarchive rejected:`,e)})},[An,jn]=(0,s.useState)(null),[Mn,Nn]=(0,s.useState)(!1),[Pn,Fn]=(0,s.useState)(null),[In,Ln]=(0,s.useState)(null);(0,s.useEffect)(()=>{Pn===null||De.some(e=>e.workspaceId===Pn)||(Nn(!1),Fn(null),jn(null))},[Pn,De]);let Rn=()=>{Mn||(jn(null),Ln(null))},zn=()=>{
123
+ F.clearHover(),je(n=>n===null?n:{...n,over:{id:e.id,half:a(t)}})},drop:t=>{F.end(),Ae!==null&&rt(Ae,{id:e.id,half:a(t)})},end:e=>{let t=F.canFinishLocalDrop(e);F.end(),t&&Ae?.over?rt(Ae,Ae.over):je(null),Me.current=!1}}:c?{canDrag:!0,start:()=>{F.startFromUnsectioned(e.id)},active:!1,marker:null,hover:()=>{},drop:()=>{},end:()=>{F.end()}}:void 0;return/* @__PURE__ */ (0,o.jsx)(Hy,{rowKey:k(e.id),showHost:!t.remote&&!(i===void 0&&Se),node:e,currentId:De,now:tt,onOpen:l,onRenameRequest:se,renderSlot:O,onReveal:e.id===_e&&t.key===ke&&!Et?()=>{ve(e.id)}:void 0,drag:u,useMovingSectionSessions:_,t:ge},e.id)};return/* @__PURE__ */ (0,o.jsxs)(`div`,{"data-sidebar-group":t.key,style:{"--dsh-workspace-indent":`${n*12}px`},className:X(Z.groupSection,xe===`before`&&Z.workspaceDropBefore,xe===`after`&&Z.workspaceDropAfter),onDragOver:N===null?void 0:e=>{e.preventDefault(),(Ee!==void 0||Qe.get(t.key)===void 0)&&(e.stopPropagation(),Ee===void 0?(e.dataTransfer.dropEffect=`none`,N.over!==null&&Ne({...N,over:null})):(e.dataTransfer.dropEffect=`move`,Ee(Wb(e))))},onDrop:N===null?void 0:e=>{e.preventDefault(),(Oe!==void 0||Qe.get(t.key)===void 0)&&(e.stopPropagation(),Oe===void 0?(Pe.current=!0,Ne(null)):Oe(Wb(e)))},children:[i===void 0?/* @__PURE__ */ (0,o.jsx)(Qy,{label:ge(`group.ungrouped`),expanded:t.expanded,onToggle:()=>{xt(t)},rowKey:`workspace:${t.key}`,action:C?{label:ge(`actions.newSession`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconNewChatOutlineRegular,{size:16}),onActivate:()=>{de(t.key,!0),we?.close(),a()}}:void 0}):/* @__PURE__ */ (0,o.jsx)(zy,{copyWorkingDirectory:c,newShortcut:ye.find(e=>e.id===`session.new`),group:t,foldedActivity:E,showHost:!Se,home:he,t:ge,onToggle:()=>{xt(t)},onCreate:()=>{t.workspaceId!==void 0&&(de(t.key,t.expanded),we?.close(),a(t.workspaceId))},drag:Te,pin:me?{pinned:p,toggle:()=>{Ie.current=i,p||fe(Gh,!0),me(i,!p).catch(e=>{console.warn(`workspace pin rejected:`,e)})}}:void 0,actions:u?{...Ce?{moveToSection:()=>qe(i)}:{},rename:()=>ie(i,t.label),defaultHarness:e=>ae(i,t.label,e),delete:()=>oe(i,t.label)}:void 0}),T.length>0&&/* @__PURE__ */ (0,o.jsx)(`div`,{role:`group`,children:T}),(te.length>0||y!==null&&y.entries.length>0||pe)&&/* @__PURE__ */ (0,o.jsxs)(`div`,{role:`group`,className:Z.groupSessions,style:{"--dsh-workspace-indent":`${i===void 0?0:n*12+22}px`},onDragOver:Ae!==null&&Ae.accountKey===t.key?e=>{let t=wy(e,Ae.pinned);t!==null&&(F.clearHover(),(Ae.over?.id!==t.id||Ae.over.half!==t.half)&&je({...Ae,over:t}),e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`)}:void 0,onDrop:Ae!==null&&Ae.accountKey===t.key?e=>{if(e.dataTransfer.dropEffect===`copy`)return;let t=wy(e,Ae.pinned);t!==null&&(e.preventDefault(),e.stopPropagation(),F.end(),rt(Ae,t))}:void 0,children:[y===null?/* @__PURE__ */ (0,o.jsx)(py,{roots:b?.rows??[],children:Fe}):y.entries.map(e=>e.kind===`group`?/* @__PURE__ */ (0,o.jsxs)(s.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(`div`,{children:O(`sidebar.workspaces.groups.row`,{roomId:e.room.roomId,rowKey:`recent-group:${e.room.roomId}`,placement:`recent`,showHost:!Se})}),e.members.length>0&&/* @__PURE__ */ (0,o.jsx)(py,{roots:e.members,children:Fe})]},`recent-group:${e.room.roomId}`):/* @__PURE__ */ (0,o.jsx)(py,{roots:[e.node],children:Fe},e.node.id)),pe&&/* @__PURE__ */ (0,o.jsx)(rb,{rowKey:`overflow:${t.key}`,hiddenCount:x,hasMore:j,loading:A===void 0?!t.remote&&e.loading:A===`loading`,workspaceHistory:A,workspaceId:ue?i:void 0,fillWorkspace:u&&S&&e.phase===`ready`&&e.workspaceHistory?.[i]===void 0&&w<5,expand:()=>{ee(e=>({...e,[t.key]:(e[t.key]??5)+10}))},loadMoreSessions:be,t:ge})]})]},t.key)},At=mt?lt.map(e=>kt(e,0)):void 0,jt=/* @__PURE__ */ new Map;for(let e of Be)Dt.push(...Zb([e],M.rows)),e.expanded&&jt.set(e.key,(ut.get(e.id)??[]).map(e=>kt(e,0)));!xe&&et.length===0&&!Tt&&h.length===0&&Dt.push(`empty`);let Mt=Ze(null),Nt=xe&&dt.length===0&&lt.length===0,Pt=dt.length>0||Nt||!!Mt,Ft=!(Pt||Tt||Be.length>0)&&pt[0]?.workspaceId!==void 0&&N?.over?.id===pt[0].workspaceId&&N?.over?.half===`before`,R=[];if(Pt&&Dt.push(`section:${qh}`),bt){Nt&&(Dt.push(`empty:host-scope`),R.push(/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.filterEmptyHint,"data-row-key":`empty:host-scope`,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{children:ge(`hostScope.emptyWorkspaces`)}),Ce!==void 0&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.emptyAction,onClick:Ce,children:ge(`hostScope.showAll`)})]},`empty:host-scope`)));for(let e of pt)R.push(kt(e,0));!te&&ft.hiddenCount>0&&(Dt.push(`overflow:workspaces`),R.push(/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.sessionOverflowButton,"data-row-key":`overflow:workspaces`,onClick:()=>ne(!0),children:ge(`workspaces.expand`)},`overflow:workspaces`)))}let It=ot.find(e=>e.key===``);return It!==void 0&&R.push(kt(It,0)),/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:Fe,className:X(Z.treeBody,Z.wide),onDragOver:F.active?F.clearHover:void 0,onDragLeave:F.active?e=>{(!(e.relatedTarget instanceof Node)||!e.currentTarget.contains(e.relatedTarget))&&F.clearHover()}:void 0,children:[Ft&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.listTopDropIndicator,"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsxs)(cv,{className:X(Z.list,Ft&&Z.listTopDropActive),label:ge(`section.sessions`),rowKeys:Dt,scrollRef:T,onScroll:E,ready:e.phase===`ready`&&S&&!He,resetKey:JSON.stringify([w,D,te,mt,ht,bt]),children:[/* @__PURE__ */ (0,o.jsx)(tb,{rows:wt,hasWorkspaces:lt.length>0,hasExtraItems:gt.length>0,leadingChildren:gt.length>0?gt.map(e=>/* @__PURE__ */ (0,o.jsx)(`div`,{children:O(`sidebar.workspaces.groups.row`,{roomId:e.roomId,rowKey:`pinned-group:${e.roomId}`,placement:`pinned`,showHost:!Se})},`pinned-group:${e.roomId}`)):void 0,sectionDrag:F.interaction,currentId:De,showHost:!Se,onOpen:l,onRenameRequest:se,renderSlot:O,useMovingSectionSessions:_,revealSessionId:_e,onSessionRevealed:ve,expanded:mt,onToggle:()=>{fe(Gh,!mt)},t:ge,children:At}),n&&O(`sidebar.workspaces.groups.section`,{expanded:ht,onToggle:()=>{fe(`groups`,!ht)},rowKey:`section:groups`,roomIds:_t.map(e=>e.roomId),showHost:!Se,allowCreate:!Se}),/* @__PURE__ */ (0,o.jsx)(Qb,{sections:Be,groupRows:jt,projectSectionDrop:Ze,manageThreadSection:b,sectionDrag:F.interaction,currentId:De,showHost:!Se,onOpen:l,onRenameRequest:se,renderSlot:O,useMovingSectionSessions:_,revealSessionId:_e,onSessionRevealed:ve,setSectionExpanded:fe,t:ge}),!xe&&et.length===0&&!Tt&&h.length===0&&/* @__PURE__ */ (0,o.jsx)(Gb,{rowState:m,onLeaveArchivedOnly:x,partial:e.hasMore,t:ge}),(Pt||R.length>0||F.canDropToUnsectioned)&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(Z.unsectionedZone,F.isUnsectionedTarget&&Z.unsectionedDropTarget),"data-section-drop-unsectioned":``,onDragOver:F.canDropToUnsectioned?e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`,F.hoverUnsectioned()}:void 0,onDrop:F.canDropToUnsectioned?e=>{e.dataTransfer.dropEffect!==`copy`&&(e.preventDefault(),e.stopPropagation(),F.dropUnsectioned(e.dataTransfer.dropEffect))}:void 0,children:[Pt&&/* @__PURE__ */ (0,o.jsx)(Qy,{label:ge(`section.workspaces`),projectDrop:Mt,expanded:bt,onToggle:()=>{bt&&ne(!1),fe(`workspaces`,!bt)},rowKey:`section:workspaces`}),R,!Pt&&R.length===0&&F.canDropToUnsectioned&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.unsectionedDropHint,children:ge(`section.unsectioned`)})]})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.fade}),Ke&&Xe.has(Ke)&&ce&&/* @__PURE__ */ (0,o.jsx)(ib,{current:We.get(Ke)??``,sections:h,move:e=>ce(Ke,e),dismiss:()=>qe(void 0),defaultLabel:ge(`section.workspaces`),failedLabel:ge(`section.projectMoveFailed`),t:ge},Ke),Je&&/* @__PURE__ */ (0,o.jsx)(r.Toast,{text:ge(`section.projectMoveFailed`),onDone:()=>Ye(!1)})]})}let qb=[],Jb=[],Yb=/* @__PURE__ */ new Set;function Xb(e,t,n,r,i,a){if(!e.length)return[];let o=a??new Map(Ih(t,n,r).map(e=>[e.id,e])),s=/* @__PURE__ */ new Set;return e.map(e=>{let{id:t,threadIds:n}=e,r=`native-section:${t}`;return{id:t,section:e,key:r,rows:n.flatMap(e=>{let t=o.get(e);return!t||t.pinned||s.has(e)?[]:(s.add(e),[t])}),expanded:Jh(i,r)}})}function Zb(e,t){return e.flatMap(({key:e,rows:n,expanded:r})=>[`section:${e}`,...r?t(n).map(e=>`session:${e.id}`):[]])}function Qb({sections:e,groupRows:t,projectSectionDrop:n,manageThreadSection:r,setSectionExpanded:i,...a}){return e.map(({key:e,section:s,rows:c,expanded:l})=>/* @__PURE__ */ (0,o.jsx)(tb,{...a,rows:c,customSection:{key:e,section:s,projectDrop:n?.(s.id)},headingActions:r&&gy(s)&&/* @__PURE__ */ (0,o.jsx)(W_,{section:s,request:r,t:a.t}),expanded:l,onToggle:()=>i(e,!l),children:t?.get(e)},e))}function $b({list:e,groupRooms:t,showGroupsSection:n=!0,sessionIds:r,rowState:i,nativeSections:a,nativeThreadIds:c,useMovingSectionSessions:l,moveSessionToSection:u,finePointer:d,manageThreadSection:f,onLeaveArchivedOnly:p,useSessionStatus:m,open:h,onSessionRenameRequest:g,usePanelInfo:_,setSessionOrder:v,sectionExpansion:y,setSectionExpanded:b,workspaceReady:x,animationResetKey:S,scrollRef:C,onScroll:w,limit:T,setLimit:E,revealSessionId:D,onSessionRevealed:ee,renderSlot:te,loadMoreSessions:ne,hostScopeFiltered:re=!1,singleRemoteHostScoped:ie=!1,onResetHostScope:ae,t:oe}){let se=_(e=>e.activePanelId!==null),O=m(e=>e),k=Zv(),ce=(0,s.useMemo)(()=>i.archivedFilter===`only`?Yb:zv(t),[t,i.archivedFilter]),le=(0,s.useMemo)(()=>new Map(Ih(e,i,O,ce).map(e=>[e.id,e])),[e,i,O,ce]),ue=(0,s.useMemo)(()=>Bh(e,r,i,O,le,{floatPinned:!1}).filter(e=>!i.sectionedSessionIds?.has(e.id)),[e,r,i,O,le]),de=(0,s.useMemo)(()=>Bh(e,i.pinnedSessionIds,i,O,le).filter(e=>e.pinned),[e,i,O,le]),[A,fe]=(0,s.useState)(null),j=(0,s.useRef)(!1),pe=Jh(y,Gh),me=Jh(y,Kh),he=(0,s.useMemo)(()=>[...t].filter(e=>e.pinned).sort((e,t)=>t.updatedAt-e.updatedAt),[t]),ge=(0,s.useMemo)(()=>[...t].sort((e,t)=>t.updatedAt-e.updatedAt),[t]),_e=pe&&D!==void 0&&de.some(e=>e.id===D||e.tree?.descendantIds.includes(D)),ve=(0,s.useMemo)(()=>Xb(a,e,i,O,y,le),[a,e,i,O,y,le]),ye=(0,s.useMemo)(()=>new Map(ve.map(e=>[e.id,e.rows.filter(e=>!e.archived&&!e.pinned).map(e=>e.id)])),[ve]),be=pb({enabled:d&&u!==void 0&&a.length>0,nativeSections:a,visibleSectionRows:ye,nativeThreadIds:c,pinnedSessionIds:i.pinnedSessionIds,archivedSessionIds:i.archivedSessionIds,moveSessionToSection:u,onCancelLocalDrag:()=>{j.current=!0,fe(null)}});Hb(A!==null);let xe=se?void 0:Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,Se=Wv(ue,T,xe,D,{keepPinned:!1}),Ce=Wv(ue,10,xe,D,{keepPinned:!1}).hiddenCount>0,M=(e,t)=>{if(j.current)return;j.current=!0,fe(null);let n=wh(r,ue,e,t,!1);n!==void 0&&v(Wh,n)},we=Date.now();return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(Z.treeBody,Z.wide),onDragOver:be.active?be.clearHover:void 0,onDragLeave:be.active?e=>{(!(e.relatedTarget instanceof Node)||!e.currentTarget.contains(e.relatedTarget))&&be.clearHover()}:void 0,children:[/* @__PURE__ */ (0,o.jsxs)(cv,{className:X(Z.list,Z.flatList),label:oe(`section.sessions`),scrollRef:C,onScroll:w,rowKeys:[...de.length===0&&he.length===0?[]:[`section:${Gh}`],...pe?[...he.map(e=>`pinned-group:${e.roomId}`),...k.rows(de).map(e=>`session:${e.id}`)]:[],...n?[`section:${Kh}`,...me?ge.map(e=>`group:${e.roomId}`):[]]:[],...Zb(ve,k.rows),...ue.length===0&&de.length===0&&he.length===0&&ge.length===0&&a.length===0?[re?`empty:host-scope`:`empty`]:[],...k.rows(Se.rows).map(e=>`recent:${e.id}`),...Ce||e.hasMore?[`overflow:flat`]:[]],ready:e.phase===`ready`&&x&&A===null&&!be.active,resetKey:`${S}/${T}/${String(pe)}/${String(me)}`,children:[/* @__PURE__ */ (0,o.jsx)(tb,{rows:de,hasExtraItems:he.length>0,leadingChildren:he.length>0?he.map(e=>/* @__PURE__ */ (0,o.jsx)(`div`,{children:te(`sidebar.workspaces.groups.row`,{roomId:e.roomId,rowKey:`pinned-group:${e.roomId}`,placement:`pinned`,showHost:!ie})},`pinned-group:${e.roomId}`)):void 0,sectionDrag:be.interaction,currentId:xe,showHost:!ie,onOpen:h,onRenameRequest:g,renderSlot:te,useMovingSectionSessions:l,revealSessionId:D,onSessionRevealed:ee,expanded:pe,onToggle:()=>{b(Gh,!pe)},t:oe}),n&&te(`sidebar.workspaces.groups.section`,{expanded:me,onToggle:()=>{b(`groups`,!me)},rowKey:`section:groups`,roomIds:ge.map(e=>e.roomId),showHost:!ie,allowCreate:!ie}),/* @__PURE__ */ (0,o.jsx)(Qb,{sections:ve,manageThreadSection:f,sectionDrag:be.interaction,currentId:xe,showHost:!ie,onOpen:h,onRenameRequest:g,renderSlot:te,useMovingSectionSessions:l,revealSessionId:D,onSessionRevealed:ee,setSectionExpanded:b,t:oe}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(Z.unsectionedZone,Z.flatUnsectioned,be.isUnsectionedTarget&&Z.unsectionedDropTarget),"data-section-drop-unsectioned":``,onDragOver:be.canDropToUnsectioned?e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`,be.hoverUnsectioned()}:void 0,onDrop:be.canDropToUnsectioned?e=>{e.dataTransfer.dropEffect!==`copy`&&(e.preventDefault(),e.stopPropagation(),be.dropUnsectioned(e.dataTransfer.dropEffect))}:void 0,children:[(de.length>0||he.length>0||a.length>0)&&/* @__PURE__ */ (0,o.jsx)(Qy,{label:oe(`section.sessions`)}),ue.length===0&&de.length===0&&he.length===0&&ge.length===0&&a.length===0&&(re?/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.filterEmptyHint,"data-row-key":`empty:host-scope`,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{children:oe(`hostScope.emptySessions`)}),ae!==void 0&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.emptyAction,onClick:ae,children:oe(`hostScope.showAll`)})]}):/* @__PURE__ */ (0,o.jsx)(Gb,{rowState:i,onLeaveArchivedOnly:p,partial:e.hasMore,t:oe})),/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.flatRows,onDragOver:!be.canDropToUnsectioned&&A!==null?e=>{let t=wy(e,null);t!==null&&(be.clearHover(),(A.over?.id!==t.id||A.over.half!==t.half)&&fe({...A,over:t}),e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`)}:void 0,onDrop:!be.canDropToUnsectioned&&A!==null?e=>{if(e.dataTransfer.dropEffect===`copy`)return;let t=wy(e,null);t!==null&&(e.preventDefault(),e.stopPropagation(),be.end(),M(A,t))}:void 0,children:/* @__PURE__ */ (0,o.jsx)(py,{roots:Se.rows,children:e=>{let t=A!==null,n=t=>e.blank?`after`:t,r=be.canDragRow(e);return/* @__PURE__ */ (0,o.jsx)(Hy,{rowKey:`recent:${e.id}`,node:e,showHost:!ie,currentId:xe,now:we,onOpen:h,onRenameRequest:g,renderSlot:te,onReveal:e.id===D&&!_e?()=>{ee(e.id)}:void 0,drag:{start:()=>{j.current=!1,fe({accountKey:Wh,sessionId:e.id,pinned:e.pinned,over:null}),r?be.startFromUnsectioned(e.id):be.end()},active:t,marker:!be.hasSectionTarget&&t&&A.over?.id===e.id?A.over.half:null,hover:t=>{be.clearHover(),fe(r=>r===null?r:{...r,over:{id:e.id,half:n(t)}})},drop:t=>{be.end(),A!==null&&M(A,{id:e.id,half:n(t)})},end:e=>{let t=be.canFinishLocalDrop(e);be.end(),t&&A?.over?M(A,A.over):fe(null),j.current=!1}},useMovingSectionSessions:l,t:oe},e.id)}})}),/* @__PURE__ */ (0,o.jsx)(rb,{rowKey:`overflow:flat`,hiddenCount:Se.hiddenCount,hasMore:e.hasMore,loading:e.loading,expanded:T>10,expand:()=>E(T+10),collapse:Ce?()=>E(10):void 0,loadMoreSessions:ne,t:oe})]})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.fade})]})}function ex({useSessions:e,useSessionStatus:t,open:n,onUnarchive:r,workspaces:i,archivedSessionIds:a,archivedFilter:c,query:l,remote:u,resultLimit:d,treeRef:f,usePanelInfo:p,scrollRef:m,onScroll:h,t:g}){let _=p(e=>e.activePanelId!==null),v=e(e=>e),y=t(e=>e),b=u.query===l?u:{query:l,status:`loading`,items:[],hasMore:!1},x=(0,s.useMemo)(()=>Vh(v,i,l,a,c,y,b,d),[v,i,l,a,c,y,b,d]),S=b.status===`loading`,C=_?void 0:Object.values(v.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id;return(0,s.useLayoutEffect)(()=>{iv(f.current)},[C,x,f]),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(Z.treeBody,Z.wide),children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.list,ref:m,onScroll:h,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.searchTree,role:`tree`,"aria-label":g(`search.results.aria`),ref:f,onFocusCapture:()=>iv(f.current),onKeyDown:av,children:x.items.map(e=>/* @__PURE__ */ (0,o.jsx)(Vy,{result:e,currentId:C,onOpen:n,onUnarchive:r,t:g},e.id))}),S&&/* @__PURE__ */ (0,o.jsx)(`div`,{role:`status`,"aria-label":g(`search.pending`),children:(x.items.length===0?[0,1]:[0]).map(e=>/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.skeletonRow,"aria-hidden":`true`,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.skeletonDot}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:Z.skeletonBars,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.skeletonBar}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:X(Z.skeletonBar,Z.skeletonBarWide)})]})]},e))}),!S&&x.items.length===0&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.empty,children:g(`search.noMatches`)}),x.hasMore&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.searchStatus,children:g(`search.hasMore`,{n:d})})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.fade})]})}function tx(e){return/* @__PURE__ */ (0,o.jsx)(Qv,{browser:e,children:/* @__PURE__ */ (0,o.jsx)(nx,{...e})})}function nx({wide:e,usePanelInfo:t,expandSidebar:n,useSessions:i,useSessionStatus:a,useWorkspaces:c,useStore:l,actions:u,startSession:d,copyWorkingDirectory:f,open:p,markCompletionsRead:m,requestSessionRename:h,notifyArchivedNotOpenable:g,renameWorkspace:_,deleteWorkspace:v,insertWorkspaceBefore:y,moveWorkspaceToSection:b,setWorkspacePinned:x,unarchiveSession:S,createWorkspace:C,requestManageThreadSection:w,moveSessionToSection:T,setScopedSessionIds:E,searchSessions:D,searchResultLimit:ee,useDirectoryFlow:te,useHostInfo:ne,useShortcuts:re,useWorkspaceShortcuts:ie,useNativeThreads:ae,useMovingSectionSessions:oe,useGroupRooms:se,requestSearch:O,requestAddWorkspace:k,closeAddWorkspace:ce,setDirectoryBusy:le,dismissForkError:ue,refreshSessions:de,loadMoreSessions:A,renderSlot:fe,t:j}){let pe=ne(e=>e.home),me=re(e=>e),he=me.find(e=>e.id===`session.search`),ge=me.find(e=>e.id===`session.activityView`),_e=me.find(e=>e.id===`workspace.add`),ve=ie(e=>e),ye=t(e=>e.activePanelId!==null),be=a(e=>e),xe=ae(e=>e),Se=se(e=>e),Ce=fb(),M=i(e=>e),we=c(e=>e.items),Te=c(e=>e.canStartProjectless===!0),Ee=j(`workspace.defaultName`),De=j(`group.remoteOtherSessions`),Oe=(0,s.useMemo)(()=>we.map(e=>({...e,title:hv(e)?De:H_(e.title,Ee)})),[we,Ee,De]),ke=c(e=>e.phase),Ae=c(e=>e.state),je=c(e=>e.archivedSessionIds),Me=c(e=>e.pinnedSessionIds),N=c(e=>e.pinnedWorkspaceIds??Jb),Ne=c(e=>e.threadSections??qb),Pe=c(e=>e.state===`idle`&&e.threadSectionsV1===!0),Fe=Pe?w:void 0,Ie=te(e=>e),Le=l(e=>e.groupBy),P=l(e=>e.orderBy),Re=l(e=>e.archivedFilter??`default`),ze=l(e=>e.groupExpansion),Be=Zv(),Ve=l(e=>e.sectionExpansion),F=l(e=>e.sessionOrderByAccount),He=(0,s.useCallback)(e=>{je.includes(e)?g():(Be.selectSidebarRow(e),p(e))},[je,g,p,Be]),Ue=()=>{u.setArchivedFilter(`default`)},I=ke===`ready`&&Ae!==`loading`,We=Object.values(M.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,Ge=We!==void 0&&M.byId[We]?.blank===!0?We:void 0,Ke=(0,s.useMemo)(()=>{let e=new Set(Oe.flatMap(e=>e.sessionIds));return[.../* @__PURE__ */ new Set([...M.ids,...je])].filter(t=>!e.has(t))},[je,M.ids,Oe]),qe=(0,s.useMemo)(()=>({pinnedSessionIds:Me,archivedSessionIds:je}),[je,Me]),Je=Re===`only`?qb:Ne,Ye=(0,s.useMemo)(()=>({...qe,archivedFilter:Re,sectionedSessionIds:new Set(Je.flatMap(e=>e.threadIds))}),[qe,Re,Je]),Xe=(0,s.useMemo)(()=>Rh(M,je),[je,M]),Ze=(0,s.useMemo)(()=>Zh(M,Ye,Be.forest),[M,Ye,Be.forest]),Qe=(0,s.useMemo)(()=>Oe.map(e=>{let{memberIds:t,linkedRootIds:n}=Qh(e.sessionIds,Ze),r=P===`updated`?xh(t,Ze.summaries):Sh(t,F[e.workspaceId],Ze.summaries,qe);return{workspace:{...e,sessionIds:Ch(r,Ge!==void 0&&t.includes(Ge)?Ge:void 0)},linkedRootIds:n}}),[Ge,Ze,P,qe,F,Oe]),L=(0,s.useMemo)(()=>Qe.map(({workspace:e})=>e),[Qe]),$e=(0,s.useMemo)(()=>new Map(Qe.map(({workspace:e,linkedRootIds:t})=>[e.workspaceId,t])),[Qe]),et=(0,s.useMemo)(()=>xh(Ke.filter(e=>Ze.rootIds.has(e)),Ze.summaries),[Ze,Ke]),tt=(0,s.useMemo)(()=>{let e=Xe.filter(e=>Ze.rootIds.has(e));return Ch(P===`updated`?xh(e,Ze.summaries):Sh(e,F[Wh],Ze.summaries,qe),Ge!==void 0&&Xe.includes(Ge)?Ge:void 0)},[Ge,Xe,Ze,P,qe,F]),nt=(0,s.useMemo)(()=>$h(Oe,M,Ye,Ze),[M,Ye,Ze,Oe]),rt=(0,s.useMemo)(()=>Object.fromEntries([...L.map(e=>[e.workspaceId,e.sessionIds]),[``,et],[Wh,tt]]),[tt,et,L]);(0,s.useEffect)(()=>{ke===`ready`&&u.retainAccountKeys([``,Wh,...Oe.map(e=>e.workspaceId)])},[u.retainAccountKeys,ke,Oe]),(0,s.useEffect)(()=>{if(M.phase!==`ready`||I||P!==`manual`||Ge===void 0)return;let e={};for(let[t,n]of Object.entries(rt)){if(t!==`__flat_session_order__`&&ke!==`ready`)continue;let r=F[t]??[];n[0]===Ge&&r[0]!==Ge&&(e[t]=[Ge,...r.filter(e=>e!==Ge)])}Object.keys(e).length>0&&u.syncSessionOrders(e,nt)},[u.syncSessionOrders,rt,Ge,M.phase,P,F,nt,ke,I]),(0,s.useEffect)(()=>{M.phase===`ready`&&I&&P===`manual`&&Ge!==void 0&&Object.entries(rt).some(([e,t])=>t[0]===Ge&&F[e]?.[0]!==Ge)&&u.syncSessionOrders(rt,nt)},[u.syncSessionOrders,rt,Ge,M.phase,P,F,nt,I]);let it=(e,t)=>{u.setSessionOrder(e,t,rt,nt)},[at,ot]=(0,s.useState)(``),[st,ct]=(0,s.useState)(!1),[lt,ut]=(0,s.useState)(!1),[dt,ft]=(0,s.useState)(void 0),[pt,mt]=(0,s.useState)({}),[ht,gt]=(0,s.useState)(!1),[_t,vt]=(0,s.useState)(10),yt=Vb(at).trim(),[bt,xt]=(0,s.useState)({query:``,status:`idle`,items:[],hasMore:!1}),St=(0,s.useRef)(null),Ct=(0,s.useRef)(null),wt=(0,s.useRef)(null),Tt=ve.addRequested,Et=(0,s.useRef)(null),[Dt,Ot]=(0,s.useState)(!1),[kt,At]=(0,s.useState)(()=>Lv()),jt=(0,s.useRef)(null);if(jt.current===null){let e=/* @__PURE__ */ new Set;for(let t of Object.keys(kt.perHost))t!==`local`&&t!==kt.selectedHost&&e.add(t);jt.current=e}let Mt=(0,s.useCallback)(e=>{At(e),Rv(e)},[]);(0,s.useEffect)(()=>{let e=e=>{let t=e.detail;if(!t||typeof t.hostId!=`string`||t.hostId===``||!Array.isArray(t.workspaceIds))return;let n=t.workspaceIds.filter(e=>typeof e==`string`);jt.current?.add(t.hostId),At(e=>{let r=Mv(e,t.hostId,n);return Rv(r),r})};return window.addEventListener(pv,e),()=>{window.removeEventListener(pv,e)}},[]),(0,s.useEffect)(()=>{if(ke!==`ready`||Ae!==`idle`)return;let e=window.setTimeout(()=>{let e=jt.current;if(e!==null&&e.size>0)for(let t of L){let n=t.remote?.hostId;n!==void 0&&t.remote?.state===`connected`&&e.delete(n)}let t=yv(kt,L,e===null||e.size===0?void 0:{preserveHostKeys:e});t!==kt&&Mt(t)},250);return()=>{window.clearTimeout(e)}},[kt,L,Mt,ke,Ae]);let Nt=()=>{Mt(Nv())},Pt=(0,s.useMemo)(()=>mv(L),[L]),Ft=(0,s.useMemo)(()=>gv(L),[L]),R=(0,s.useMemo)(()=>vv(kt,L),[kt,L]),It=(0,s.useMemo)(()=>Pt&&bv(R,L),[Pt,R,L]),Lt=(0,s.useMemo)(()=>Pt&&R.selectedHost!==`all`&&R.selectedHost!==`local`,[Pt,R.selectedHost]),Rt=(0,s.useMemo)(()=>It?xv(L,R):L,[It,L,R]),zt=(0,s.useMemo)(()=>new Set(Rt.map(e=>e.workspaceId)),[Rt]),Bt=(0,s.useMemo)(()=>It?Ev(tt.map(e=>({id:e,remote:M.byId[e]?.projectionValues?.remoteHost??void 0})),zt,L,R).map(e=>e.id):tt,[It,tt,M.byId,zt,L,R]),Vt=(0,s.useMemo)(()=>Te&&wv(R,L),[Te,R,L]),Ht=(0,s.useMemo)(()=>Tv(R,L,Rt),[R,L,Rt]),Ut=(0,s.useMemo)(()=>{if(!Pt||!It)return Se;let e=R.selectedHost;return Se.filter(t=>{let n=t.remote?.hostId??`local`;return e!==`all`&&e!==n?!1:n===`local`?Ht:R.perHost[n]?.mode!==`selected`||Rt.some(e=>e.remote?.hostId===n)})},[Pt,It,Se,R,Ht,Rt]),Wt=Lt?Ut.length>0:Ht||Ut.length>0,Gt=(0,s.useMemo)(()=>It?new Set(Ev(M.ids.map(e=>({id:e,remote:M.byId[e]?.projectionValues?.remoteHost??void 0})),zt,L,R,Ze.rootOf).filter(e=>{let t=M.byId[e.id];return t===void 0||t.blank!==!0&&t.origin!==`subagent`}).map(e=>e.id)):null,[It,M.ids,M.byId,zt,L,R,Ze.rootOf]),Kt=(0,s.useMemo)(()=>Dv(Je,R,L,Gt,{pinnedSessionIds:new Set(Me),archivedSessionIds:new Set(je),archivedFilter:Re,visibleWorkspaceIds:zt}),[Je,R,L,Gt,Me,je,Re,zt]),qt=(0,s.useMemo)(()=>Gt===null?M:{...M,ids:M.ids.filter(e=>Gt.has(e)),...Ht?{}:{hasMore:!1,loading:!1}},[M,Ht,Gt]);(0,s.useEffect)(()=>{E?.(Gt)},[E,Gt]),(0,s.useEffect)(()=>()=>{E?.(null)},[E]);let Jt=(0,s.useMemo)(()=>It?JSON.stringify(R):`all`,[It,R]),Yt=`${Le}/${P}/${Re}/${Jt}`,Xt=yt===``?`${lt?`activity`:Le===`flat`?`flat`:`tree`}/${Yt}`:`search/${Yt}/${yt}`,Zt=M.phase===`ready`&&I&&(yt===``||bt.query===yt&&bt.status!==`loading`),Qt=(0,s.useRef)(null),$t=(0,s.useRef)(),en=(0,s.useRef)(null);(0,s.useLayoutEffect)(()=>{let t=Qt.current;if(!e||t===null){en.current=null;return}let n=en.current;if((n?.key!==Xt||n.node!==t)&&(n?.node===t&&dt===void 0&&(t.scrollTop=0),n={key:Xt,node:t,pending:!0},en.current=n),n.pending){if(dt===void 0){let e=t.scrollTop;if(e!==0)($t.current??=/* @__PURE__ */ new Map).set(Xt,e);else{let e=$t.current?.get(Xt)??0;if(e!==0){if(!Zt)return;t.scrollTop=e,$t.current?.set(Xt,t.scrollTop)}}}n.pending=!1}},[e,Xt,Zt,dt]);let tn={scrollRef:Qt,onScroll:({currentTarget:t})=>{let n=en.current;if(!e||n?.key!==Xt||n.node!==t)return;let r=t.scrollTop;r===0&&(n.pending||t.scrollHeight<=t.clientHeight)||(n.pending=!1,($t.current??=/* @__PURE__ */ new Map).set(Xt,r))}},nn=(0,s.useMemo)(()=>ev(qt,Ye,be),[qt,Ye,be]),rn=ye?void 0:We,an=(0,s.useCallback)(e=>{e.length!==0&&(m??Be.markCompletionsRead)(e)},[m,Be.markCompletionsRead]),on=()=>{let e=R.selectedHost!==`all`&&R.selectedHost!==`local`?R.selectedHost:void 0;window.dispatchEvent(new CustomEvent(`codexhost:open-add-remote-workspace`,{detail:e===void 0?{}:{hostId:e}}))},sn=(0,s.useRef)(!1),cn=e=>{if(je.includes(e)){g();return}let t=Be.rootId(e),n=Oe.find(e=>e.sessionIds.includes(t));if(It){let e=Pv(R,n,L);e!==R&&Mt(e)}let r=Le===`flat`?void 0:n?.workspaceId,i=Je.find(({threadIds:e})=>e.includes(t))??(r===void 0?void 0:Je.find(({workspaceIds:e})=>e?.includes(r)===!0));i&&u.setSectionExpanded(`native-section:${i.id}`,!0),ut(!1),ft(e),ot(``),ct(!1),Be.reveal(e),p(e)},ln=e=>{let t=Qt.current;e===dt&&t!==null&&($t.current??=/* @__PURE__ */ new Map).set(Xt,t.scrollTop),ft(t=>t===e?void 0:t)};(0,s.useEffect)(()=>{yt!==``&&ft(void 0)},[yt]);let[un,dn]=(0,s.useState)(!1);(0,s.useEffect)(()=>{if(e&&un){let e=window.setTimeout(()=>{Ct.current?.focus({preventScroll:!0}),dn(!1)},300);return()=>{window.clearTimeout(e)}}},[e,un]),(0,s.useEffect)(()=>{ve.searchRequest!==0&&(ce(),ct(!0),e?Ct.current?.focus({preventScroll:!0}):(dn(!0),n()))},[ve.searchRequest]);let fn=(0,s.useRef)({wide:e,searchActive:!1});fn.current={wide:e,searchActive:st||at!==``},(0,s.useEffect)(()=>{if(ve.activityViewRequest===0)return;ce();let{wide:e,searchActive:t}=fn.current;t?(ot(``),ct(!1),ut(!0),e||n()):e?ut(e=>!e):(n(),ut(!0))},[ve.activityViewRequest]),(0,s.useEffect)(()=>{e&&st&&!un&&Ct.current?.focus({preventScroll:!0})},[e,st,un]),(0,s.useEffect)(()=>{if(!e||!st||un)return;let t=e=>{e.target instanceof Node&&St.current?.contains(e.target)!==!0&&(Ct.current?.blur(),yt===``&&ct(!1))};return document.addEventListener(`click`,t),()=>{document.removeEventListener(`click`,t)}},[yt,e,st,un]),(0,s.useEffect)(()=>{if(yt===``){xt({query:``,status:`idle`,items:[],hasMore:!1});return}let e=new AbortController;xt({query:yt,status:`loading`,items:[],hasMore:!1});let t=window.setTimeout(()=>{D(yt,e.signal).then(t=>{e.signal.aborted||xt({query:yt,status:`ready`,items:t.items,hasMore:t.hasMore})}).catch(()=>{e.signal.aborted||xt({query:yt,status:`error`,items:[],hasMore:!1})})},250);return()=>{window.clearTimeout(t),e.abort()}},[yt,D]);let[pn,mn]=(0,s.useState)(null),[hn,gn]=(0,s.useState)(``),[_n,vn]=(0,s.useState)(null),yn=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(_n!==null)return;let e=yn.current;yn.current=null,e?.isConnected&&e.focus()},[_n]);let[bn,xn]=(0,s.useState)(!1),[Sn,Cn]=(0,s.useState)(null),wn=hn.trim(),Tn=pn!==null&&wn!==``&&Oe.some(e=>e.workspaceId!==pn.workspaceId&&e.title===wn),En=bn||wn===``||pn===null||wn===pn.storedTitle||Tn,Dn=()=>{bn||(mn(null),Cn(null))},On=()=>{En||(xn(!0),Cn(null),_(pn.workspaceId,wn).then(()=>{xn(!1),mn(null)}).catch(e=>{xn(!1),Cn(e instanceof Error?e.message:String(e))}))},kn=e=>{S(e).catch(e=>{console.warn(`session unarchive rejected:`,e)})},[An,jn]=(0,s.useState)(null),[Mn,Nn]=(0,s.useState)(!1),[Pn,Fn]=(0,s.useState)(null),[In,Ln]=(0,s.useState)(null);(0,s.useEffect)(()=>{Pn===null||Oe.some(e=>e.workspaceId===Pn)||(Nn(!1),Fn(null),jn(null))},[Pn,Oe]);let Rn=()=>{Mn||(jn(null),Ln(null))},zn=()=>{
124
124
  /* v8 ignore next -- the Modal is absent without a target and its button is disabled while deleting. */
125
- Mn||An===null||(Nn(!0),Fn(null),Ln(null),v(An.workspaceId).then(()=>{Fn(An.workspaceId)}).catch(e=>{Nn(!1),Ln(e instanceof Error?e.message:String(e))}))};return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(Z.root,!e&&Z.rail),children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.sectionHeader,children:[e&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:X(Z.sectionLabel,Z.wide,st&&Z.sectionLabelHidden),children:M(`section.sessions`)}),e&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:X(Z.activitySlot,st&&Z.activitySlotHidden),children:/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:M(`activityView.label`),shortcutKeys:he?.keys,side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:X(Z.iconButton,Z.wide,Z.activityButton,lt&&Z.activityButtonActive),"aria-label":M(`activityView.label`),"aria-pressed":lt,"aria-keyshortcuts":he?.aria,onClick:()=>{k(),ut(e=>!e)},children:/* @__PURE__ */ (0,o.jsxs)(`span`,{className:Z.activityIconWrap,children:[/* @__PURE__ */ (0,o.jsx)(vy,{size:16}),!lt&&nn.hasAttention&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.activityDot,"data-attention":nn.pendingCount>0?`pending`:`unread`,"aria-hidden":`true`})]})})})}),e&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:X(Z.searchSlot,st&&Z.searchSlotExpanded),children:/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:St,className:X(Z.search,st&&Z.searchExpanded),onClick:()=>{k(),ct(!0),Ct.current?.focus()},children:[/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:M(`search`),shortcutKeys:me?.keys,side:`bottom`,delayMs:500,disabled:st,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.searchButton,"aria-label":M(`search.sessions.aria`),"aria-keyshortcuts":me?.aria,"aria-expanded":st,onClick:()=>{O()},children:/* @__PURE__ */ (0,o.jsx)(r.IconSearchOutlineRegular,{size:16})})}),/* @__PURE__ */ (0,o.jsx)(`input`,{ref:Ct,className:Z.searchInput,type:`text`,placeholder:M(`search.placeholder`),maxLength:500,value:at,tabIndex:st?0:-1,onChange:e=>{ot(mb(e.target.value))},onKeyDown:e=>{if(!(e.nativeEvent.isComposing||e.keyCode===229)){if(e.key===`ArrowDown`&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey){let t=wt.current?.querySelector(`[data-row-key]`);t&&(e.preventDefault(),t.focus({preventScroll:!0}),t.scrollIntoView({block:`nearest`}))}else e.key===`Escape`&&(e.currentTarget.closest(`[data-phone-drawer]`)&&(e.preventDefault(),e.stopPropagation()),ot(``),ct(!1))}}}),st&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.clearButton,"aria-label":M(`search.clear`),onClick:e=>{e.stopPropagation(),ot(``),ct(!1)},children:/* @__PURE__ */ (0,o.jsx)(r.IconCloseFillRegular,{})})]})}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(Z.headerActions,e&&st&&Z.headerActionsHidden),children:[e&&Pe&&/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:M(`section.create.title`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:X(Z.iconButton,Z.wide),"aria-label":M(`section.create.title`),onClick:()=>Pe({mode:`create`}),children:/* @__PURE__ */ (0,o.jsx)(r.IconPlusOutlineRegular,{size:16})})}),e&&/* @__PURE__ */ (0,o.jsx)(gb,{groupBy:Ie,orderBy:Le,archivedFilter:Re,onGroupPick:u.setGroupBy,onOrderPick:e=>{u.setOrderBy(e,rt,nt)},onArchivedFilterPick:e=>{e===`only`&&ut(!1),u.setArchivedFilter(e)},t:M}),e&&Ft?Fe?/* @__PURE__ */ (0,o.jsx)(r.Menu,{phoneSidebarTitle:M(`workspace.add`),open:Dt,onClose:()=>{Ot(!1)},items:[{id:`add-local`,label:M(`workspace.addLocal`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconFolderCloseRegular,{})},{id:`add-remote`,label:M(`workspace.addRemote`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconGlobeOutlineRegular,{})}],onSelect:e=>{Ot(!1),e===`add-local`?ce():e===`add-remote`&&on()},align:`end`,dense:!0,portal:!0,anchor:/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:M(`workspace.add`),shortcutKeys:ge?.keys,side:`bottom`,delayMs:500,disabled:Dt,children:/* @__PURE__ */ (0,o.jsx)(`button`,{ref:Et,type:`button`,className:Z.iconButton,"aria-label":M(`workspace.add`),"aria-keyshortcuts":ge?.aria,"aria-haspopup":`menu`,"aria-expanded":Dt,onClick:()=>{Ot(e=>!e)},children:/* @__PURE__ */ (0,o.jsx)(r.IconProjectAddOutlineRegular,{size:16})})})}):/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:M(`workspace.addRemote`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{ref:Et,type:`button`,className:Z.iconButton,"aria-label":M(`workspace.addRemote`),onClick:on,children:/* @__PURE__ */ (0,o.jsx)(r.IconProjectAddOutlineRegular,{size:16})})}):Fe&&/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:M(`workspace.add`),shortcutKeys:ge?.keys,side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{ref:Et,type:`button`,className:Z.iconButton,"aria-label":M(`workspace.add`),"aria-keyshortcuts":ge?.aria,onClick:()=>{ce()},children:/* @__PURE__ */ (0,o.jsx)(r.IconProjectAddOutlineRegular,{size:e?16:18})})})]}),/* @__PURE__ */ (0,o.jsx)(fb,{t:M,open:Tt,anchorRef:Et,useWorkspaces:c,createWorkspace:C,useDirectoryFlow:te,renderDirectoryFlow:e=>de(`sidebar.workspaces.directoryFlow`,e),addOnly:!0,onBusyChange:A,side:`right`,onPick:e=>{k(),d(e)},onClose:()=>{k()}})]}),!e&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.search,children:/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:M(`search`),shortcutKeys:me?.keys,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.searchButton,"aria-label":M(`search.sessions.aria`),"aria-keyshortcuts":me?.aria,onClick:()=>{O()},children:/* @__PURE__ */ (0,o.jsx)(r.IconSearchOutlineRegular,{size:18})})})}),e&&Pt&&yt===``&&/* @__PURE__ */ (0,o.jsx)(zy,{workspaces:L,state:It,onChange:Mt,t:M}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.listArea,children:[e&&N.phase===`pending`&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.empty,role:`status`,children:M(`sessions.loading`)}),e&&(yt===``?lt?/* @__PURE__ */ (0,o.jsx)(yy,{...tn,projection:nn,currentId:rn,ready:N.phase===`ready`&&We,animationResetKey:`activity/${Jt}`,singleRemoteHostScoped:Rt,onOpen:He,onSessionRenameRequest:h,onMarkAllRead:an,onExit:()=>{ut(!1)},renderSlot:de,t:M}):Ie===`flat`?/* @__PURE__ */ (0,o.jsx)(Db,{...tn,limit:_t,setLimit:vt,loadMoreSessions:j,usePanelInfo:t,list:qt,groupRooms:Wt,showGroupsSection:Gt,sessionIds:Vt,rowState:Ye,nativeSections:Je,nativeThreadIds:be,useMovingSectionSessions:oe,moveSessionToSection:T,finePointer:Se&&Ne,manageThreadSection:Pe,onLeaveArchivedOnly:Ue,workspaceReady:We,animationResetKey:Yt,useSessionStatus:a,open:He,onSessionRenameRequest:h,renderSlot:de,setSessionOrder:it,sectionExpansion:Be,setSectionExpanded:u.setSectionExpanded,revealSessionId:dt,onSessionRevealed:ln,hostScopeFiltered:Lt,singleRemoteHostScoped:Rt,onResetHostScope:Nt,t:M}):/* @__PURE__ */ (0,o.jsx)(xb,{...tn,sessionLimits:pt,setSessionLimits:mt,allWorkspacesShown:ht,setAllWorkspacesShown:gt,loadMoreSessions:j,usePanelInfo:t,list:qt,groupRooms:Wt,showGroupsSection:Gt,shortcuts:pe,useSessionStatus:a,onSessionRenameRequest:h,renderSlot:de,workspaces:zt,allWorkspaces:L,linkedRoots:$e,ungroupedSessionIds:et,canStartProjectless:Ht,workspaceReady:We,nestWorkspaces:Ie===`workspace-tree`,animationResetKey:Yt,groupExpansion:F,setGroupExpanded:u.setGroupExpanded,sectionExpansion:Be,setSectionExpanded:u.setSectionExpanded,setSessionOrder:it,pinnedWorkspaceIds:P,setWorkspacePinned:x,rowState:Ye,nativeSections:Je,nativeThreadIds:be,useMovingSectionSessions:oe,moveSessionToSection:T,finePointer:Se&&Ne,manageThreadSection:Pe,onLeaveArchivedOnly:Ue,startSession:d,copyWorkingDirectory:f,open:He,insertWorkspaceBefore:y,moveWorkspaceToSection:b,revealSessionId:dt,onSessionRevealed:ln,hostScopeFiltered:Lt,singleRemoteHostScoped:Rt,onResetHostScope:Nt,home:fe,t:M,onRenameRequest:(e,t)=>{mn({workspaceId:e,storedTitle:Ce.find(t=>t.workspaceId===e)?.title??t}),gn(t),Cn(null)},onDeleteRequest:(e,t)=>{jn({workspaceId:e,title:t}),Ln(null)},onDefaultHarnessRequest:(e,t,n)=>{yn.current=n,vn({workspaceId:e,title:t})}}):/* @__PURE__ */ (0,o.jsx)(Ob,{...tn,usePanelInfo:t,useSessions:i,useSessionStatus:a,open:cn,onUnarchive:kn,workspaces:De,archivedSessionIds:Ae,archivedFilter:Re,query:yt,remote:bt,resultLimit:ee,treeRef:wt,t:M}))]}),e&&/* @__PURE__ */ (0,o.jsx)(ky,{list:N,refreshSessions:ue,loadMoreSessions:j,t:M}),_n&&/* @__PURE__ */ (0,o.jsx)(Sy,{..._n,t:M,onClose:()=>vn(null)},_n.workspaceId),/* @__PURE__ */ (0,o.jsxs)(r.Modal,{open:pn!==null,onClose:Dn,closeLabel:M(`close`),title:M(`rename.workspace.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,disabled:bn,onClick:Dn,children:M(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`primary`,disabled:En,onClick:On,children:M(`rename`)})]}),children:[/* @__PURE__ */ (0,o.jsx)(`input`,{className:Z.renameInput,value:hn,"aria-label":M(`field.workspaceName`),"data-modal-autofocus":!0,disabled:bn,onFocus:e=>{e.target.select()},onChange:e=>{gn(e.target.value),Cn(null)},onCompositionStart:()=>{sn.current=!0},onCompositionEnd:()=>{sn.current=!1},onKeyDown:e=>{e.key===`Enter`&&!sn.current&&(e.preventDefault(),On())}}),Tn&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:M(`conflict.named`,{name:wn})}),Sn!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:Sn})]}),/* @__PURE__ */ (0,o.jsxs)(r.Modal,{open:An!==null,onClose:Rn,closeLabel:M(`close`),title:M(`delete.workspace`),...An===null?{}:{description:M(De.find(e=>e.workspaceId===An.workspaceId)?.projectId?`delete.nativeProject`:`delete.desc`,{name:An.title})},footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,disabled:Mn,onClick:Rn,children:M(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,className:Z.deleteAction,disabled:Mn,onClick:zn,children:M(`delete.workspace`)})]}),children:[Mn&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.deleteStatus,role:`status`,children:M(`delete.pending`)}),In!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:In})]}),_e.forkError!==null&&/* @__PURE__ */ (0,o.jsx)(r.Toast,{text:M(_e.forkError.reason===`unavailable`?`shortcut.noCompletedTurn`:`shortcut.forkFailed`),onDone:le},_e.forkError.seq)]})}function jb({sessionId:e,useArchived:t,useMenuOpenState:n,useShortcuts:i,archiveSession:a,unarchiveSession:s,t:c}){let[,l]=n(),u=i(e=>e.find(e=>e.id===`session.archive`)),d=t(t=>t.has(e));return/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{shortcut:d?void 0:u,icon:d?/* @__PURE__ */ (0,o.jsx)(r.IconUnarchiveOutlineRegular,{size:16}):/* @__PURE__ */ (0,o.jsx)(r.IconArchiveOutlineRegular,{size:16}),onSelect:()=>{l(!1),(d?s:a)(e)},children:c(d?`menu.unarchiveSession`:`menu.archiveSession`)})}function Mb({sessionId:e,useArchived:t,archiveSession:n,unarchiveSession:i,t:a}){let s=t(t=>t.has(e));return/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:a(s?`actions.unarchive`:`actions.archive`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:J.iconButton,"aria-label":a(s?`menu.unarchiveSession`:`menu.archiveSession`),onClick:()=>{(s?i:n)(e)},children:s?/* @__PURE__ */ (0,o.jsx)(r.IconUnarchiveOutlineRegular,{size:16}):/* @__PURE__ */ (0,o.jsx)(r.IconArchiveOutlineRegular,{size:16})})})}function Nb({useArchiveRequest:e,settleSessionArchive:t,stopAndArchiveSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,o.jsx)(Pb,{request:i,stopAndArchiveSession:n,onSettle:t,t:r},i.sessionId)}function Pb({request:e,stopAndArchiveSession:t,onSettle:n,t:i}){let[a,c]=(0,s.useState)(!1),[l,u]=(0,s.useState)(null),d=()=>{a||n()};return/* @__PURE__ */ (0,o.jsxs)(r.Modal,{phoneSidebar:!0,open:!0,onClose:d,closeLabel:i(`close`),title:i(`archive.confirm.title`),description:i(`archive.confirm.desc`,{title:e.displayTitle}),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,disabled:a,onClick:d,children:i(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,className:Z.deleteAction,disabled:a,onClick:()=>{c(!0),u(null),t(e.sessionId,e.children).then(()=>{c(!1),n()}).catch(e=>{c(!1),u(e instanceof Error?e.message:String(e))})},children:i(`archive.confirm.action`)})]}),children:[/* @__PURE__ */ (0,o.jsxs)(`ul`,{className:Z.archiveActivity,"aria-label":i(`archive.confirm.activity`),children:[e.runningThreads?.map(e=>/* @__PURE__ */ (0,o.jsx)(`li`,{children:i(`archive.confirm.thread`,{title:e.title})},e.id)),e.activity.map((e,t)=>/* @__PURE__ */ (0,o.jsx)(`li`,{children:Fb(e,i)},`${e.kind}-${String(t)}`))]}),a&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.deleteStatus,role:`status`,children:i(`archive.confirm.pending`)}),l!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:l})]})}function Fb(e,t){let n=e.items??[],r=n.length,i=n.map(e=>e.label??e.id).join(t(`archive.confirm.listSeparator`)),a=r===1?`one`:`other`;switch(e.kind){case`turn`:return t(`archive.confirm.turn`);case`subagent`:return t(`archive.confirm.subagents.${a}`,{n:r,names:i});case`job`:return t(`archive.confirm.jobs.${a}`,{n:r,names:i});case`schedule`:return t(`archive.confirm.schedules.${a}`,{n:r,names:i});default:return t(`archive.confirm.other.${a}`,{kind:e.kind,n:r})}}function Ib({useArchiveChildrenRequest:e,...t}){let n=e(e=>e);return n?/* @__PURE__ */ (0,o.jsx)(Lb,{request:n,...t},n.sessionId):null}function Lb({request:e,choose:t,dismiss:n,t:i}){return/* @__PURE__ */ (0,o.jsx)(r.Modal,{phoneSidebar:!0,open:!0,title:i(`archive.children.title`),description:i(`archive.children.description`,{title:e.title}),closeLabel:i(`close`),onClose:n,footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,onClick:()=>t(e,!1),children:i(`archive.children.parentOnly`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,className:Z.deleteAction,onClick:()=>t(e,!0),children:i(`archive.children.include`,{n:e.children.length})})]}),children:/* @__PURE__ */ (0,o.jsx)(`ul`,{className:Z.archiveActivity,children:e.children.map(({id:e,title:t})=>/* @__PURE__ */ (0,o.jsx)(`li`,{children:t},e))})})}function Rb({sessionId:e,useSessions:t,useMenuOpenState:n,requestSessionDelete:i,t:a}){let[,s]=n();return t(t=>Rm(t.byId[e]))?/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{danger:!0,separatorBefore:!0,icon:/* @__PURE__ */ (0,o.jsx)(r.IconTrashOutlineRegular,{size:16}),onSelect:()=>{s(!1),i(e)},children:a(`menu.deleteSession`)}):null}function zb({useDeleteRequest:e,dismiss:t,deleteSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,o.jsx)(Bb,{request:i,dismiss:t,deleteSession:n,t:r},i.sessionId)}function Bb({request:e,dismiss:t,deleteSession:n,t:i}){let[a,c]=(0,s.useState)(!1),[l,u]=(0,s.useState)(null),d=e.children.length>0,f=e.running||e.children.some(e=>e.running),p=()=>{a||t()},m=r=>{c(!0),u(null),n(e,r).then(()=>{c(!1),t()}).catch(e=>{c(!1),u(e instanceof Error?e.message:String(e))})};return/* @__PURE__ */ (0,o.jsxs)(r.Modal,{phoneSidebar:!0,open:!0,onClose:p,closeLabel:i(`close`),title:i(d?`delete.session.children.title`:`delete.session.title`),description:d?i(`delete.session.children.description`,{title:e.title,n:e.children.length}):i(`delete.session.description`,{title:e.title}),footer:d?/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,disabled:a,onClick:()=>m(!1),children:i(`delete.session.children.parentOnly`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,className:Z.deleteAction,disabled:a,onClick:()=>m(!0),children:i(`delete.session.children.include`,{n:e.children.length})})]}):/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,disabled:a,onClick:p,children:i(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,className:Z.deleteAction,disabled:a,onClick:()=>m(!1),children:i(`delete.session.action`)})]}),children:[f&&/* @__PURE__ */ (0,o.jsx)(`p`,{className:Z.deleteStatus,children:i(`delete.session.runningHint`)}),d&&/* @__PURE__ */ (0,o.jsx)(`ul`,{className:Z.archiveActivity,children:e.children.map(({id:e,title:t})=>/* @__PURE__ */ (0,o.jsx)(`li`,{children:t},e))}),a&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.deleteStatus,role:`status`,children:i(`delete.session.pending`)}),l!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:l})]})}function Vb(e,t){let n,r;return{getSnapshot:()=>{let i=e.getSnapshot();return(r===void 0||i!==n)&&(n=i,r=t(i)),r},subscribe:t=>e.subscribe(t)}}function Hb(e){let{sessionId:t,useNativeThreads:n,useSectionWorkspace:r,useSectionSessions:i,useMovingSectionSessions:a}=e,o=n(e=>e.has(t)),s=i(e=>e.byId[t]?.projectionValues?.harnessIdentity?.id===`codex`),c=r(e=>e.threadSectionsV1===!0),l=r(e=>(e.threadSections?.some(Uv)??!1)&&!e.pinnedSessionIds.includes(t)&&!e.archivedSessionIds.includes(t)),u=a(e=>e.has(t));return{eligible:o&&(s||c)&&l,moving:u,preciseMoves:c}}function Ub(e){let{sessionId:t,useMenuOpenState:n,requestMove:i,t:a}=e,[,s]=n(),{eligible:c,moving:l}=Hb(e);return c?/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(r.IconFolderCloseRegular,{}),disabled:l,onSelect:()=>{l||(s(!1),i({sessionId:t}))},children:a(`menu.moveToSection`)}):null}function Wb(e){let{sessionId:t,useMenuOpenState:n,moveSession:i,t:a}=e,[,s]=n(),{eligible:c,moving:l}=Hb(e),u=e.useSectionWorkspace(e=>Jv(t,e.threadSections)?.id);return!c||u===void 0?null:/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(r.IconFolderCloseRegular,{}),disabled:l,onSelect:()=>{l||(s(!1),i({sessionId:t,sectionId:null}))},children:a(`menu.removeFromSection`)})}function Gb(e){return/* @__PURE__ */ (0,o.jsx)(qb,{...e,direction:`up`})}function Kb(e){return/* @__PURE__ */ (0,o.jsx)(qb,{...e,direction:`down`})}function qb({direction:e,...t}){let{sessionId:n,useMenuOpenState:a,moveSession:s,t:c}=t,[,l]=a(),{eligible:u,moving:d,preciseMoves:f}=Hb(t),p=t.useSectionWorkspace(e=>Jv(n,e.threadSections)),m=t.useSectionWorkspace(e=>e.pinnedSessionIds),h=t.useSectionWorkspace(e=>e.archivedSessionIds),g=t.useScopedSessionIds(e=>e&&p?p.threadIds.filter(t=>e.has(t)):null,i.shallowEqual),_=t.useArchivedFilter(e=>e),v=t.useSectionSessions(t=>{if(!u||!f||!p)return null;let r=Yv(p,{byId:t.byId,pinnedSessionIds:m,archivedSessionIds:h,archivedFilter:_,visibleSessionIds:new Set(g??t.ids)});return ey(n,e,p,r)},(e,t)=>e?.sectionId===t?.sectionId&&e?.beforeSessionId===t?.beforeSessionId);if(!u||!f||p===void 0)return null;let y=d||v===null;return/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{icon:e===`up`?/* @__PURE__ */ (0,o.jsx)(r.IconChevronUpOutlineRegular,{}):/* @__PURE__ */ (0,o.jsx)(r.IconChevronDownOutlineRegular,{}),disabled:y,onSelect:()=>{y||v===null||(l(!1),s(v))},children:c(e===`up`?`menu.moveSectionUp`:`menu.moveSectionDown`)})}function Jb({useThreadSectionMove:e,...t}){let n=e(e=>e);return n?/* @__PURE__ */ (0,o.jsx)(Yb,{request:n,...t},n.sessionId):null}function Yb({request:e,useSectionWorkspace:t,useMovingSectionSessions:n,dismiss:r,move:i,t:a}){let c=t(e=>e.threadSections),l=n(t=>t.has(e.sessionId)),[u,d]=(0,s.useState)(!1),f=(c??[]).filter(Uv),p=Jv(e.sessionId,f)?.id??``;return/* @__PURE__ */ (0,o.jsx)(Ny,{current:p,sections:f,dismiss:r,busy:l,disabled:u,blockedMessage:u?a(`section.outcomeUnknown`):void 0,defaultLabel:a(`section.unsectioned`),failedLabel:a(`section.moveFailed`),deletedTargetLabel:a(`section.targetDeleted`),move:async t=>{let n=await i({sessionId:e.sessionId,sectionId:t});switch(n.status){case`committed`:return;case`failed`:throw n.error;case`unknown`:return d(!0),!1;case`skipped-in-flight`:return!1}},t:a})}function Xb({sessionId:e,useSessions:t,useMenuOpenState:n,useShortcuts:i,forkSession:a,t:s}){let c=t(t=>Lm(t.byId[e])),[,l]=n(),u=i(e=>e.find(e=>e.id===`session.fork`));return c?/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{shortcut:u,icon:/* @__PURE__ */ (0,o.jsx)(r.IconBranchOutlineRegular,{}),onSelect:()=>{l(!1),a(e)},children:s(`menu.fork`)}):null}function Zb({sessionId:e,useMenuOpenState:t,useSessions:n,useSessionStatus:i,useArchived:a,markCompletionUnread:s,t:c}){let[,l]=t(),u=n(e=>e),d=u.byId[e],f=i(t=>{let n=t.get(e);if(d===void 0||(d.retainedBy.mainView??0)>0||n?.completionUnread!==!1||n.pendingInteraction!==void 0)return!1;let{running:r,runningSubagentCount:i}=_h(d,u,t);return!r&&i===0}),p=a(t=>t.has(e));return!f||p?null:/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(r.IconBellOutlineRegular,{}),onSelect:()=>{l(!1),s(e)},children:c(`menu.markAsUnread`)})}function Qb({markChildThreadsRead:e,useMenuOpenState:t,t:n}){let[,i]=t();return e===void 0?null:/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(r.IconCheckCircleOutlineRegular,{}),onSelect:()=>{i(!1),e()},children:n(`menu.markChildrenAsRead`)})}function $b({sessionId:e,useSessions:t,useMenuOpenState:n,copySessionLink:i,t:a}){let s=t(t=>{let n=t.byId[e];return n!==void 0&&Qm(n)!==void 0}),[,c]=n();return s?/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(r.IconCopyOutlineRegular,{}),onSelect:()=>{c(!1),i(e)},children:a(`menu.copySessionLink`)}):null}function ex({sessionId:e,useSessions:t,useMenuOpenState:n,copyWorkingDirectory:i,t:a}){let s=t(t=>t.byId[e]?.cwd),[,c]=n();return s===void 0||s.trim()===``?null:/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(r.IconCopyOutlineRegular,{}),onSelect:()=>{c(!1),i(s)},children:a(`menu.copyWorkingDirectory`)})}function tx({sessionId:e,usePinned:t,useArchived:n,useSessions:r}){return{pinned:t(t=>t.has(e)),archived:n(t=>t.has(e)),supported:r(t=>Im(t.byId[e]))}}function nx(e){let{sessionId:t,useMenuOpenState:n,pinSession:i,unpinSession:a,t:s}=e,[,c]=n(),{pinned:l,archived:u,supported:d}=tx(e);return u||!d?null:/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{icon:l?/* @__PURE__ */ (0,o.jsx)(r.IconPinFillRegular,{}):/* @__PURE__ */ (0,o.jsx)(r.IconPinOutlineRegular,{}),onSelect:()=>{c(!1),(l?a:i)(t)},children:s(l?`menu.unpinSession`:`menu.pinSession`)})}function rx(e){let{sessionId:t,pinSession:n,unpinSession:i,t:a}=e,{pinned:s,archived:c,supported:l}=tx(e);return c||!l?null:/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:a(s?`actions.unpin`:`actions.pin`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:J.iconButton,"aria-label":a(s?`menu.unpinSession`:`menu.pinSession`),onClick:()=>{(s?i:n)(t)},children:s?/* @__PURE__ */ (0,o.jsx)(r.IconPinFillRegular,{size:16}):/* @__PURE__ */ (0,o.jsx)(r.IconPinOutlineRegular,{size:16})})})}function ix({sessionId:e,displayTitle:t,useMenuOpenState:n,useShortcuts:i,requestSessionRename:a,t:s}){let[,c]=n(),l=i(e=>e.find(e=>e.id===`session.rename`));return/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{shortcut:l,icon:/* @__PURE__ */ (0,o.jsx)(r.IconEditOutlineRegular,{}),onSelect:()=>{c(!1),a(e,t)},children:s(`rename`)})}function ax({useRenameRequest:e,settleSessionRename:t,renameSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,o.jsx)(ox,{request:i,renameSession:n,onSettle:t,t:r},i.sessionId)}function ox({request:e,renameSession:t,onSettle:n,t:i}){let[a,c]=(0,s.useState)(e.currentTitle),[l,u]=(0,s.useState)(!1),[d,f]=(0,s.useState)(null),p=(0,s.useRef)(!1),m=a.trim(),h=l||m===``,g=()=>{l||n()},_=()=>{h||(u(!0),f(null),t(e.sessionId,m).then(()=>{u(!1),n()}).catch(e=>{u(!1),f(e instanceof Error?e.message:String(e))}))};return/* @__PURE__ */ (0,o.jsxs)(r.Modal,{phoneSidebar:!0,open:!0,onClose:g,closeLabel:i(`close`),title:i(`rename.session.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,disabled:l,onClick:g,children:i(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`primary`,disabled:h,onClick:_,children:i(`rename`)})]}),children:[/* @__PURE__ */ (0,o.jsx)(`input`,{className:Z.renameInput,value:a,"aria-label":i(`field.sessionName`),"data-modal-autofocus":!0,disabled:l,onFocus:e=>{e.target.select()},onChange:e=>{c(e.target.value),f(null)},onCompositionStart:()=>{p.current=!0},onCompositionEnd:()=>{p.current=!1},onKeyDown:e=>{e.key===`Enter`&&!p.current&&(e.preventDefault(),_())}}),d!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:d})]})}let sx=6e3;function cx({useToast:e,useStore:t,dismissToast:n,undoArchive:i,showArchived:a,t:s}){let c=e(e=>e),l=t(e=>(e.archivedFilter??`default`)!=="default");if(c===null)return null;if(c.kind===`archived`||c.kind===`stoppedAndArchived`){let{sessionId:e}=c;return/* @__PURE__ */ (0,o.jsx)(r.Toast,{text:c.failedChildren?s(`archive.children.partial`,{n:c.failedChildren}):s(c.kind===`archived`?`toast.archived`:`toast.stoppedAndArchived`),...c.failedChildren?{icon:/* @__PURE__ */ (0,o.jsx)(r.IconWarningOutlineRegular,{})}:{tone:`success`},holdMs:sx,actions:[{label:s(`toast.archivedUndo`),onClick:()=>{n(),i(e)}},...l?[]:[{prefix:s(`toast.archivedOr`),label:s(`toast.archivedFilter`),onClick:()=>{n(),a()}}]],onDone:n},`toast-${String(c.seq)}`)}return c.kind===`deleted`?/* @__PURE__ */ (0,o.jsx)(r.Toast,{text:c.failedChildren?s(`delete.session.children.partial`,{n:c.failedChildren}):s(`toast.deleted`),...c.failedChildren?{icon:/* @__PURE__ */ (0,o.jsx)(r.IconWarningOutlineRegular,{}),holdMs:sx}:{tone:`success`},onDone:n},`toast-${String(c.seq)}`):c.kind===`createFailed`||c.kind===`forkFailed`?/* @__PURE__ */ (0,o.jsx)(r.Toast,{text:s(c.kind===`forkFailed`?`toast.forkFailed`:`toast.createFailed`,{message:c.message}),icon:/* @__PURE__ */ (0,o.jsx)(r.IconWarningOutlineRegular,{}),holdMs:sx,onDone:n},`toast-${String(c.seq)}`):/* @__PURE__ */ (0,o.jsx)(r.Toast,{text:lx(c,s),...c.kind===`workingDirectoryCopied`?{tone:`success`}:{icon:/* @__PURE__ */ (0,o.jsx)(r.IconWarningOutlineRegular,{})},onDone:n},`toast-${String(c.seq)}`)}function lx(e,t){switch(e.kind){case`archiveFailed`:return t(`toast.archiveFailed`,{message:e.message});case`unarchiveFailed`:return t(`toast.unarchiveFailed`,{message:e.message});case`deleteFailed`:return t(`toast.deleteFailed`,{message:e.message});case`pinFailed`:return t(`toast.pinFailed`,{message:e.message});case`unpinFailed`:return t(`toast.unpinFailed`,{message:e.message});case`defaultWorkspaceFailed`:return t(`defaultWorkspace.failed`);case`archivedNotOpenable`:return t(`toast.archivedNotOpenable`);case`sessionLinkCopied`:return t(`toast.sessionLinkCopied`);case`sessionLinkCopyFailed`:return t(`toast.sessionLinkCopyFailed`);case`workingDirectoryCopied`:return t(`toast.workingDirectoryCopied`);case`workingDirectoryCopyFailed`:return t(`toast.workingDirectoryCopyFailed`);case`sectionSyncPending`:return t(`toast.sectionSyncPending`);case`sectionMoveUnknown`:return t(`section.outcomeUnknown`);case`sectionMoveFailed`:return t(`toast.sectionMoveFailed`,{message:e.message});case`recentVisitsStorageFailed`:return t(`recent.cache.error`);
125
+ Mn||An===null||(Nn(!0),Fn(null),Ln(null),v(An.workspaceId).then(()=>{Fn(An.workspaceId)}).catch(e=>{Nn(!1),Ln(e instanceof Error?e.message:String(e))}))};return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(Z.root,!e&&Z.rail),children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.sectionHeader,children:[e&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:X(Z.sectionLabel,Z.wide,st&&Z.sectionLabelHidden),children:j(`section.sessions`)}),e&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:X(Z.activitySlot,st&&Z.activitySlotHidden),children:/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:j(`activityView.label`),shortcutKeys:ge?.keys,side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:X(Z.iconButton,Z.wide,Z.activityButton,lt&&Z.activityButtonActive),"aria-label":j(`activityView.label`),"aria-pressed":lt,"aria-keyshortcuts":ge?.aria,onClick:()=>{ce(),ut(e=>!e)},children:/* @__PURE__ */ (0,o.jsxs)(`span`,{className:Z.activityIconWrap,children:[/* @__PURE__ */ (0,o.jsx)(Gy,{size:16}),!lt&&nn.hasAttention&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.activityDot,"data-attention":nn.pendingCount>0?`pending`:`unread`,"aria-hidden":`true`})]})})})}),e&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:X(Z.searchSlot,st&&Z.searchSlotExpanded),children:/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:St,className:X(Z.search,st&&Z.searchExpanded),onClick:()=>{ce(),ct(!0),Ct.current?.focus()},children:[/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:j(`search`),shortcutKeys:he?.keys,side:`bottom`,delayMs:500,disabled:st,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.searchButton,"aria-label":j(`search.sessions.aria`),"aria-keyshortcuts":he?.aria,"aria-expanded":st,onClick:()=>{O()},children:/* @__PURE__ */ (0,o.jsx)(r.IconSearchOutlineRegular,{size:16})})}),/* @__PURE__ */ (0,o.jsx)(`input`,{ref:Ct,className:Z.searchInput,type:`text`,placeholder:j(`search.placeholder`),maxLength:500,value:at,tabIndex:st?0:-1,onChange:e=>{ot(Vb(e.target.value))},onKeyDown:e=>{if(!(e.nativeEvent.isComposing||e.keyCode===229)){if(e.key===`ArrowDown`&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey){let t=wt.current?.querySelector(`[data-row-key]`);t&&(e.preventDefault(),t.focus({preventScroll:!0}),t.scrollIntoView({block:`nearest`}))}else e.key===`Escape`&&(e.currentTarget.closest(`[data-phone-drawer]`)&&(e.preventDefault(),e.stopPropagation()),ot(``),ct(!1))}}}),st&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.clearButton,"aria-label":j(`search.clear`),onClick:e=>{e.stopPropagation(),ot(``),ct(!1)},children:/* @__PURE__ */ (0,o.jsx)(r.IconCloseFillRegular,{})})]})}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(Z.headerActions,e&&st&&Z.headerActionsHidden),children:[e&&Fe&&/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:j(`section.create.title`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:X(Z.iconButton,Z.wide),"aria-label":j(`section.create.title`),onClick:()=>Fe({mode:`create`}),children:/* @__PURE__ */ (0,o.jsx)(r.IconPlusOutlineRegular,{size:16})})}),e&&/* @__PURE__ */ (0,o.jsx)(Ub,{groupBy:Le,orderBy:P,archivedFilter:Re,onGroupPick:u.setGroupBy,onOrderPick:e=>{u.setOrderBy(e,rt,nt)},onArchivedFilterPick:e=>{e===`only`&&ut(!1),u.setArchivedFilter(e)},t:j}),e&&Ft?Ie?/* @__PURE__ */ (0,o.jsx)(r.Menu,{phoneSidebarTitle:j(`workspace.add`),open:Dt,onClose:()=>{Ot(!1)},items:[{id:`add-local`,label:j(`workspace.addLocal`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconFolderCloseRegular,{})},{id:`add-remote`,label:j(`workspace.addRemote`),icon:/* @__PURE__ */ (0,o.jsx)(r.IconGlobeOutlineRegular,{})}],onSelect:e=>{Ot(!1),e===`add-local`?k():e===`add-remote`&&on()},align:`end`,dense:!0,portal:!0,anchor:/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:j(`workspace.add`),shortcutKeys:_e?.keys,side:`bottom`,delayMs:500,disabled:Dt,children:/* @__PURE__ */ (0,o.jsx)(`button`,{ref:Et,type:`button`,className:Z.iconButton,"aria-label":j(`workspace.add`),"aria-keyshortcuts":_e?.aria,"aria-haspopup":`menu`,"aria-expanded":Dt,onClick:()=>{Ot(e=>!e)},children:/* @__PURE__ */ (0,o.jsx)(r.IconProjectAddOutlineRegular,{size:16})})})}):/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:j(`workspace.addRemote`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{ref:Et,type:`button`,className:Z.iconButton,"aria-label":j(`workspace.addRemote`),onClick:on,children:/* @__PURE__ */ (0,o.jsx)(r.IconProjectAddOutlineRegular,{size:16})})}):Ie&&/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:j(`workspace.add`),shortcutKeys:_e?.keys,side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{ref:Et,type:`button`,className:Z.iconButton,"aria-label":j(`workspace.add`),"aria-keyshortcuts":_e?.aria,onClick:()=>{k()},children:/* @__PURE__ */ (0,o.jsx)(r.IconProjectAddOutlineRegular,{size:e?16:18})})})]}),/* @__PURE__ */ (0,o.jsx)(zb,{t:j,open:Tt,anchorRef:Et,useWorkspaces:c,createWorkspace:C,useDirectoryFlow:te,renderDirectoryFlow:e=>fe(`sidebar.workspaces.directoryFlow`,e),addOnly:!0,onBusyChange:le,side:`right`,onPick:e=>{ce(),d(e)},onClose:()=>{ce()}})]}),!e&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.search,children:/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:j(`search`),shortcutKeys:he?.keys,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.searchButton,"aria-label":j(`search.sessions.aria`),"aria-keyshortcuts":he?.aria,onClick:()=>{O()},children:/* @__PURE__ */ (0,o.jsx)(r.IconSearchOutlineRegular,{size:18})})})}),e&&Pt&&yt===``&&/* @__PURE__ */ (0,o.jsx)(ub,{workspaces:L,state:R,onChange:Mt,t:j}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.listArea,children:[e&&M.phase===`pending`&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.empty,role:`status`,children:j(`sessions.loading`)}),e&&(yt===``?lt?/* @__PURE__ */ (0,o.jsx)(Ky,{...tn,projection:nn,currentId:rn,ready:M.phase===`ready`&&I,animationResetKey:`activity/${Jt}`,singleRemoteHostScoped:Lt,onOpen:He,onSessionRenameRequest:h,onMarkAllRead:an,onExit:()=>{ut(!1)},renderSlot:fe,t:j}):Le===`flat`?/* @__PURE__ */ (0,o.jsx)($b,{...tn,limit:_t,setLimit:vt,loadMoreSessions:A,usePanelInfo:t,list:qt,groupRooms:Ut,showGroupsSection:Wt,sessionIds:Bt,rowState:Ye,nativeSections:Kt,nativeThreadIds:xe,useMovingSectionSessions:oe,moveSessionToSection:T,finePointer:Ce&&Pe,manageThreadSection:Fe,onLeaveArchivedOnly:Ue,workspaceReady:I,animationResetKey:Yt,useSessionStatus:a,open:He,onSessionRenameRequest:h,renderSlot:fe,setSessionOrder:it,sectionExpansion:Ve,setSectionExpanded:u.setSectionExpanded,revealSessionId:dt,onSessionRevealed:ln,hostScopeFiltered:It,singleRemoteHostScoped:Lt,onResetHostScope:Nt,t:j}):/* @__PURE__ */ (0,o.jsx)(Kb,{...tn,sessionLimits:pt,setSessionLimits:mt,allWorkspacesShown:ht,setAllWorkspacesShown:gt,loadMoreSessions:A,usePanelInfo:t,list:qt,groupRooms:Ut,showGroupsSection:Wt,shortcuts:me,useSessionStatus:a,onSessionRenameRequest:h,renderSlot:fe,workspaces:Rt,allWorkspaces:L,linkedRoots:$e,ungroupedSessionIds:et,canStartProjectless:Vt,workspaceReady:I,nestWorkspaces:Le===`workspace-tree`,animationResetKey:Yt,groupExpansion:ze,setGroupExpanded:u.setGroupExpanded,sectionExpansion:Ve,setSectionExpanded:u.setSectionExpanded,setSessionOrder:it,pinnedWorkspaceIds:N,setWorkspacePinned:x,rowState:Ye,nativeSections:Kt,nativeThreadIds:xe,useMovingSectionSessions:oe,moveSessionToSection:T,finePointer:Ce&&Pe,manageThreadSection:Fe,onLeaveArchivedOnly:Ue,startSession:d,copyWorkingDirectory:f,open:He,insertWorkspaceBefore:y,moveWorkspaceToSection:b,revealSessionId:dt,onSessionRevealed:ln,hostScopeFiltered:It,singleRemoteHostScoped:Lt,onResetHostScope:Nt,home:pe,t:j,onRenameRequest:(e,t)=>{mn({workspaceId:e,storedTitle:we.find(t=>t.workspaceId===e)?.title??t}),gn(t),Cn(null)},onDeleteRequest:(e,t)=>{jn({workspaceId:e,title:t}),Ln(null)},onDefaultHarnessRequest:(e,t,n)=>{yn.current=n,vn({workspaceId:e,title:t})}}):/* @__PURE__ */ (0,o.jsx)(ex,{...tn,usePanelInfo:t,useSessions:i,useSessionStatus:a,open:cn,onUnarchive:kn,workspaces:Oe,archivedSessionIds:je,archivedFilter:Re,query:yt,remote:bt,resultLimit:ee,treeRef:wt,t:j}))]}),e&&/* @__PURE__ */ (0,o.jsx)(nb,{list:M,refreshSessions:de,loadMoreSessions:A,t:j}),_n&&/* @__PURE__ */ (0,o.jsx)(Yy,{..._n,t:j,onClose:()=>vn(null)},_n.workspaceId),/* @__PURE__ */ (0,o.jsxs)(r.Modal,{open:pn!==null,onClose:Dn,closeLabel:j(`close`),title:j(`rename.workspace.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,disabled:bn,onClick:Dn,children:j(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`primary`,disabled:En,onClick:On,children:j(`rename`)})]}),children:[/* @__PURE__ */ (0,o.jsx)(`input`,{className:Z.renameInput,value:hn,"aria-label":j(`field.workspaceName`),"data-modal-autofocus":!0,disabled:bn,onFocus:e=>{e.target.select()},onChange:e=>{gn(e.target.value),Cn(null)},onCompositionStart:()=>{sn.current=!0},onCompositionEnd:()=>{sn.current=!1},onKeyDown:e=>{e.key===`Enter`&&!sn.current&&(e.preventDefault(),On())}}),Tn&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:j(`conflict.named`,{name:wn})}),Sn!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:Sn})]}),/* @__PURE__ */ (0,o.jsxs)(r.Modal,{open:An!==null,onClose:Rn,closeLabel:j(`close`),title:j(`delete.workspace`),...An===null?{}:{description:j(Oe.find(e=>e.workspaceId===An.workspaceId)?.projectId?`delete.nativeProject`:`delete.desc`,{name:An.title})},footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,disabled:Mn,onClick:Rn,children:j(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,className:Z.deleteAction,disabled:Mn,onClick:zn,children:j(`delete.workspace`)})]}),children:[Mn&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.deleteStatus,role:`status`,children:j(`delete.pending`)}),In!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:In})]}),ve.forkError!==null&&/* @__PURE__ */ (0,o.jsx)(r.Toast,{text:j(ve.forkError.reason===`unavailable`?`shortcut.noCompletedTurn`:`shortcut.forkFailed`),onDone:ue},ve.forkError.seq)]})}function rx({sessionId:e,useArchived:t,useMenuOpenState:n,useShortcuts:i,archiveSession:a,unarchiveSession:s,t:c}){let[,l]=n(),u=i(e=>e.find(e=>e.id===`session.archive`)),d=t(t=>t.has(e));return/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{shortcut:d?void 0:u,icon:d?/* @__PURE__ */ (0,o.jsx)(r.IconUnarchiveOutlineRegular,{size:16}):/* @__PURE__ */ (0,o.jsx)(r.IconArchiveOutlineRegular,{size:16}),onSelect:()=>{l(!1),(d?s:a)(e)},children:c(d?`menu.unarchiveSession`:`menu.archiveSession`)})}function ix({sessionId:e,useArchived:t,archiveSession:n,unarchiveSession:i,t:a}){let s=t(t=>t.has(e));return/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:a(s?`actions.unarchive`:`actions.archive`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:J.iconButton,"aria-label":a(s?`menu.unarchiveSession`:`menu.archiveSession`),onClick:()=>{(s?i:n)(e)},children:s?/* @__PURE__ */ (0,o.jsx)(r.IconUnarchiveOutlineRegular,{size:16}):/* @__PURE__ */ (0,o.jsx)(r.IconArchiveOutlineRegular,{size:16})})})}function ax({useArchiveRequest:e,settleSessionArchive:t,stopAndArchiveSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,o.jsx)(ox,{request:i,stopAndArchiveSession:n,onSettle:t,t:r},i.sessionId)}function ox({request:e,stopAndArchiveSession:t,onSettle:n,t:i}){let[a,c]=(0,s.useState)(!1),[l,u]=(0,s.useState)(null),d=()=>{a||n()};return/* @__PURE__ */ (0,o.jsxs)(r.Modal,{phoneSidebar:!0,open:!0,onClose:d,closeLabel:i(`close`),title:i(`archive.confirm.title`),description:i(`archive.confirm.desc`,{title:e.displayTitle}),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,disabled:a,onClick:d,children:i(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,className:Z.deleteAction,disabled:a,onClick:()=>{c(!0),u(null),t(e.sessionId,e.children).then(()=>{c(!1),n()}).catch(e=>{c(!1),u(e instanceof Error?e.message:String(e))})},children:i(`archive.confirm.action`)})]}),children:[/* @__PURE__ */ (0,o.jsxs)(`ul`,{className:Z.archiveActivity,"aria-label":i(`archive.confirm.activity`),children:[e.runningThreads?.map(e=>/* @__PURE__ */ (0,o.jsx)(`li`,{children:i(`archive.confirm.thread`,{title:e.title})},e.id)),e.activity.map((e,t)=>/* @__PURE__ */ (0,o.jsx)(`li`,{children:sx(e,i)},`${e.kind}-${String(t)}`))]}),a&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.deleteStatus,role:`status`,children:i(`archive.confirm.pending`)}),l!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:l})]})}function sx(e,t){let n=e.items??[],r=n.length,i=n.map(e=>e.label??e.id).join(t(`archive.confirm.listSeparator`)),a=r===1?`one`:`other`;switch(e.kind){case`turn`:return t(`archive.confirm.turn`);case`subagent`:return t(`archive.confirm.subagents.${a}`,{n:r,names:i});case`job`:return t(`archive.confirm.jobs.${a}`,{n:r,names:i});case`schedule`:return t(`archive.confirm.schedules.${a}`,{n:r,names:i});default:return t(`archive.confirm.other.${a}`,{kind:e.kind,n:r})}}function cx({useArchiveChildrenRequest:e,...t}){let n=e(e=>e);return n?/* @__PURE__ */ (0,o.jsx)(lx,{request:n,...t},n.sessionId):null}function lx({request:e,choose:t,dismiss:n,t:i}){return/* @__PURE__ */ (0,o.jsx)(r.Modal,{phoneSidebar:!0,open:!0,title:i(`archive.children.title`),description:i(`archive.children.description`,{title:e.title}),closeLabel:i(`close`),onClose:n,footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,onClick:()=>t(e,!1),children:i(`archive.children.parentOnly`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,className:Z.deleteAction,onClick:()=>t(e,!0),children:i(`archive.children.include`,{n:e.children.length})})]}),children:/* @__PURE__ */ (0,o.jsx)(`ul`,{className:Z.archiveActivity,children:e.children.map(({id:e,title:t})=>/* @__PURE__ */ (0,o.jsx)(`li`,{children:t},e))})})}function ux({sessionId:e,useSessions:t,useMenuOpenState:n,requestSessionDelete:i,t:a}){let[,s]=n();return t(t=>Qm(t.byId[e]))?/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{danger:!0,separatorBefore:!0,icon:/* @__PURE__ */ (0,o.jsx)(r.IconTrashOutlineRegular,{size:16}),onSelect:()=>{s(!1),i(e)},children:a(`menu.deleteSession`)}):null}function dx({useDeleteRequest:e,dismiss:t,deleteSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,o.jsx)(fx,{request:i,dismiss:t,deleteSession:n,t:r},i.sessionId)}function fx({request:e,dismiss:t,deleteSession:n,t:i}){let[a,c]=(0,s.useState)(!1),[l,u]=(0,s.useState)(null),d=e.children.length>0,f=e.running||e.children.some(e=>e.running),p=()=>{a||t()},m=r=>{c(!0),u(null),n(e,r).then(()=>{c(!1),t()}).catch(e=>{c(!1),u(e instanceof Error?e.message:String(e))})};return/* @__PURE__ */ (0,o.jsxs)(r.Modal,{phoneSidebar:!0,open:!0,onClose:p,closeLabel:i(`close`),title:i(d?`delete.session.children.title`:`delete.session.title`),description:d?i(`delete.session.children.description`,{title:e.title,n:e.children.length}):i(`delete.session.description`,{title:e.title}),footer:d?/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,disabled:a,onClick:()=>m(!1),children:i(`delete.session.children.parentOnly`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,className:Z.deleteAction,disabled:a,onClick:()=>m(!0),children:i(`delete.session.children.include`,{n:e.children.length})})]}):/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,disabled:a,onClick:p,children:i(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,className:Z.deleteAction,disabled:a,onClick:()=>m(!1),children:i(`delete.session.action`)})]}),children:[f&&/* @__PURE__ */ (0,o.jsx)(`p`,{className:Z.deleteStatus,children:i(`delete.session.runningHint`)}),d&&/* @__PURE__ */ (0,o.jsx)(`ul`,{className:Z.archiveActivity,children:e.children.map(({id:e,title:t})=>/* @__PURE__ */ (0,o.jsx)(`li`,{children:t},e))}),a&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.deleteStatus,role:`status`,children:i(`delete.session.pending`)}),l!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:l})]})}function px(e,t){let n,r;return{getSnapshot:()=>{let i=e.getSnapshot();return(r===void 0||i!==n)&&(n=i,r=t(i)),r},subscribe:t=>e.subscribe(t)}}function mx(e){let{sessionId:t,useNativeThreads:n,useSectionWorkspace:r,useSectionSessions:i,useMovingSectionSessions:a}=e,o=n(e=>e.has(t)),s=i(e=>e.byId[t]?.projectionValues?.harnessIdentity?.id===`codex`),c=r(e=>e.threadSectionsV1===!0),l=r(e=>(e.threadSections?.some(gy)??!1)&&!e.pinnedSessionIds.includes(t)&&!e.archivedSessionIds.includes(t)),u=a(e=>e.has(t));return{eligible:o&&(s||c)&&l,moving:u,preciseMoves:c}}function hx(e){let{sessionId:t,useMenuOpenState:n,requestMove:i,t:a}=e,[,s]=n(),{eligible:c,moving:l}=mx(e);return c?/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(r.IconFolderCloseRegular,{}),disabled:l,onSelect:()=>{l||(s(!1),i({sessionId:t}))},children:a(`menu.moveToSection`)}):null}function gx(e){let{sessionId:t,useMenuOpenState:n,moveSession:i,t:a}=e,[,s]=n(),{eligible:c,moving:l}=mx(e),u=e.useSectionWorkspace(e=>xy(t,e.threadSections)?.id);return!c||u===void 0?null:/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(r.IconFolderCloseRegular,{}),disabled:l,onSelect:()=>{l||(s(!1),i({sessionId:t,sectionId:null}))},children:a(`menu.removeFromSection`)})}function _x(e){return/* @__PURE__ */ (0,o.jsx)(yx,{...e,direction:`up`})}function vx(e){return/* @__PURE__ */ (0,o.jsx)(yx,{...e,direction:`down`})}function yx({direction:e,...t}){let{sessionId:n,useMenuOpenState:a,moveSession:s,t:c}=t,[,l]=a(),{eligible:u,moving:d,preciseMoves:f}=mx(t),p=t.useSectionWorkspace(e=>xy(n,e.threadSections)),m=t.useSectionWorkspace(e=>e.pinnedSessionIds),h=t.useSectionWorkspace(e=>e.archivedSessionIds),g=t.useScopedSessionIds(e=>e&&p?p.threadIds.filter(t=>e.has(t)):null,i.shallowEqual),_=t.useArchivedFilter(e=>e),v=t.useSectionSessions(t=>{if(!u||!f||!p)return null;let r=Sy(p,{byId:t.byId,pinnedSessionIds:m,archivedSessionIds:h,archivedFilter:_,visibleSessionIds:new Set(g??t.ids)});return Dy(n,e,p,r)},(e,t)=>e?.sectionId===t?.sectionId&&e?.beforeSessionId===t?.beforeSessionId);if(!u||!f||p===void 0)return null;let y=d||v===null;return/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{icon:e===`up`?/* @__PURE__ */ (0,o.jsx)(r.IconChevronUpOutlineRegular,{}):/* @__PURE__ */ (0,o.jsx)(r.IconChevronDownOutlineRegular,{}),disabled:y,onSelect:()=>{y||v===null||(l(!1),s(v))},children:c(e===`up`?`menu.moveSectionUp`:`menu.moveSectionDown`)})}function bx({useThreadSectionMove:e,...t}){let n=e(e=>e);return n?/* @__PURE__ */ (0,o.jsx)(xx,{request:n,...t},n.sessionId):null}function xx({request:e,useSectionWorkspace:t,useMovingSectionSessions:n,dismiss:r,move:i,t:a}){let c=t(e=>e.threadSections),l=n(t=>t.has(e.sessionId)),[u,d]=(0,s.useState)(!1),f=(c??[]).filter(gy),p=xy(e.sessionId,f)?.id??``;return/* @__PURE__ */ (0,o.jsx)(ib,{current:p,sections:f,dismiss:r,busy:l,disabled:u,blockedMessage:u?a(`section.outcomeUnknown`):void 0,defaultLabel:a(`section.unsectioned`),failedLabel:a(`section.moveFailed`),deletedTargetLabel:a(`section.targetDeleted`),move:async t=>{let n=await i({sessionId:e.sessionId,sectionId:t});switch(n.status){case`committed`:return;case`failed`:throw n.error;case`unknown`:return d(!0),!1;case`skipped-in-flight`:return!1}},t:a})}function Sx({sessionId:e,useSessions:t,useMenuOpenState:n,useShortcuts:i,forkSession:a,t:s}){let c=t(t=>Zm(t.byId[e])),[,l]=n(),u=i(e=>e.find(e=>e.id===`session.fork`));return c?/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{shortcut:u,icon:/* @__PURE__ */ (0,o.jsx)(r.IconBranchOutlineRegular,{}),onSelect:()=>{l(!1),a(e)},children:s(`menu.fork`)}):null}function Cx({sessionId:e,useMenuOpenState:t,useSessions:n,useSessionStatus:i,useArchived:a,markCompletionUnread:s,t:c}){let[,l]=t(),u=n(e=>e),d=u.byId[e],f=i(t=>{let n=t.get(e);if(d===void 0||(d.retainedBy.mainView??0)>0||n?.completionUnread!==!1||n.pendingInteraction!==void 0)return!1;let{running:r,runningSubagentCount:i}=Nh(d,u,t);return!r&&i===0}),p=a(t=>t.has(e));return!f||p?null:/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(r.IconBellOutlineRegular,{}),onSelect:()=>{l(!1),s(e)},children:c(`menu.markAsUnread`)})}function wx({markChildThreadsRead:e,useMenuOpenState:t,t:n}){let[,i]=t();return e===void 0?null:/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(r.IconCheckCircleOutlineRegular,{}),onSelect:()=>{i(!1),e()},children:n(`menu.markChildrenAsRead`)})}function Tx({sessionId:e,useSessions:t,useMenuOpenState:n,copySessionLink:i,t:a}){let s=t(t=>{let n=t.byId[e];return n!==void 0&&fh(n)!==void 0}),[,c]=n();return s?/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(r.IconCopyOutlineRegular,{}),onSelect:()=>{c(!1),i(e)},children:a(`menu.copySessionLink`)}):null}function Ex({sessionId:e,useSessions:t,useMenuOpenState:n,copyWorkingDirectory:i,t:a}){let s=t(t=>t.byId[e]?.cwd),[,c]=n();return s===void 0||s.trim()===``?null:/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(r.IconCopyOutlineRegular,{}),onSelect:()=>{c(!1),i(s)},children:a(`menu.copyWorkingDirectory`)})}function Dx({sessionId:e,usePinned:t,useArchived:n,useSessions:r}){return{pinned:t(t=>t.has(e)),archived:n(t=>t.has(e)),supported:r(t=>Xm(t.byId[e]))}}function Ox(e){let{sessionId:t,useMenuOpenState:n,pinSession:i,unpinSession:a,t:s}=e,[,c]=n(),{pinned:l,archived:u,supported:d}=Dx(e);return u||!d?null:/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{icon:l?/* @__PURE__ */ (0,o.jsx)(r.IconPinFillRegular,{}):/* @__PURE__ */ (0,o.jsx)(r.IconPinOutlineRegular,{}),onSelect:()=>{c(!1),(l?a:i)(t)},children:s(l?`menu.unpinSession`:`menu.pinSession`)})}function kx(e){let{sessionId:t,pinSession:n,unpinSession:i,t:a}=e,{pinned:s,archived:c,supported:l}=Dx(e);return c||!l?null:/* @__PURE__ */ (0,o.jsx)(r.Tooltip,{label:a(s?`actions.unpin`:`actions.pin`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:J.iconButton,"aria-label":a(s?`menu.unpinSession`:`menu.pinSession`),onClick:()=>{(s?i:n)(t)},children:s?/* @__PURE__ */ (0,o.jsx)(r.IconPinFillRegular,{size:16}):/* @__PURE__ */ (0,o.jsx)(r.IconPinOutlineRegular,{size:16})})})}function Ax({sessionId:e,displayTitle:t,useMenuOpenState:n,useShortcuts:i,requestSessionRename:a,t:s}){let[,c]=n(),l=i(e=>e.find(e=>e.id===`session.rename`));return/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{shortcut:l,icon:/* @__PURE__ */ (0,o.jsx)(r.IconEditOutlineRegular,{}),onSelect:()=>{c(!1),a(e,t)},children:s(`rename`)})}function jx({useRenameRequest:e,settleSessionRename:t,renameSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,o.jsx)(Mx,{request:i,renameSession:n,onSettle:t,t:r},i.sessionId)}function Mx({request:e,renameSession:t,onSettle:n,t:i}){let[a,c]=(0,s.useState)(e.currentTitle),[l,u]=(0,s.useState)(!1),[d,f]=(0,s.useState)(null),p=(0,s.useRef)(!1),m=a.trim(),h=l||m===``,g=()=>{l||n()},_=()=>{h||(u(!0),f(null),t(e.sessionId,m).then(()=>{u(!1),n()}).catch(e=>{u(!1),f(e instanceof Error?e.message:String(e))}))};return/* @__PURE__ */ (0,o.jsxs)(r.Modal,{phoneSidebar:!0,open:!0,onClose:g,closeLabel:i(`close`),title:i(`rename.session.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`outline`,disabled:l,onClick:g,children:i(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(r.Button,{variant:`primary`,disabled:h,onClick:_,children:i(`rename`)})]}),children:[/* @__PURE__ */ (0,o.jsx)(`input`,{className:Z.renameInput,value:a,"aria-label":i(`field.sessionName`),"data-modal-autofocus":!0,disabled:l,onFocus:e=>{e.target.select()},onChange:e=>{c(e.target.value),f(null)},onCompositionStart:()=>{p.current=!0},onCompositionEnd:()=>{p.current=!1},onKeyDown:e=>{e.key===`Enter`&&!p.current&&(e.preventDefault(),_())}}),d!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:d})]})}let Nx=6e3;function Px({useToast:e,useStore:t,dismissToast:n,undoArchive:i,showArchived:a,t:s}){let c=e(e=>e),l=t(e=>(e.archivedFilter??`default`)!=="default");if(c===null)return null;if(c.kind===`archived`||c.kind===`stoppedAndArchived`){let{sessionId:e}=c;return/* @__PURE__ */ (0,o.jsx)(r.Toast,{text:c.failedChildren?s(`archive.children.partial`,{n:c.failedChildren}):s(c.kind===`archived`?`toast.archived`:`toast.stoppedAndArchived`),...c.failedChildren?{icon:/* @__PURE__ */ (0,o.jsx)(r.IconWarningOutlineRegular,{})}:{tone:`success`},holdMs:Nx,actions:[{label:s(`toast.archivedUndo`),onClick:()=>{n(),i(e)}},...l?[]:[{prefix:s(`toast.archivedOr`),label:s(`toast.archivedFilter`),onClick:()=>{n(),a()}}]],onDone:n},`toast-${String(c.seq)}`)}return c.kind===`deleted`?/* @__PURE__ */ (0,o.jsx)(r.Toast,{text:c.failedChildren?s(`delete.session.children.partial`,{n:c.failedChildren}):s(`toast.deleted`),...c.failedChildren?{icon:/* @__PURE__ */ (0,o.jsx)(r.IconWarningOutlineRegular,{}),holdMs:Nx}:{tone:`success`},onDone:n},`toast-${String(c.seq)}`):c.kind===`createFailed`||c.kind===`forkFailed`?/* @__PURE__ */ (0,o.jsx)(r.Toast,{text:s(c.kind===`forkFailed`?`toast.forkFailed`:`toast.createFailed`,{message:c.message}),icon:/* @__PURE__ */ (0,o.jsx)(r.IconWarningOutlineRegular,{}),holdMs:Nx,onDone:n},`toast-${String(c.seq)}`):/* @__PURE__ */ (0,o.jsx)(r.Toast,{text:Fx(c,s),...c.kind===`workingDirectoryCopied`?{tone:`success`}:{icon:/* @__PURE__ */ (0,o.jsx)(r.IconWarningOutlineRegular,{})},onDone:n},`toast-${String(c.seq)}`)}function Fx(e,t){switch(e.kind){case`archiveFailed`:return t(`toast.archiveFailed`,{message:e.message});case`unarchiveFailed`:return t(`toast.unarchiveFailed`,{message:e.message});case`deleteFailed`:return t(`toast.deleteFailed`,{message:e.message});case`pinFailed`:return t(`toast.pinFailed`,{message:e.message});case`unpinFailed`:return t(`toast.unpinFailed`,{message:e.message});case`defaultWorkspaceFailed`:return t(`defaultWorkspace.failed`);case`archivedNotOpenable`:return t(`toast.archivedNotOpenable`);case`sessionLinkCopied`:return t(`toast.sessionLinkCopied`);case`sessionLinkCopyFailed`:return t(`toast.sessionLinkCopyFailed`);case`workingDirectoryCopied`:return t(`toast.workingDirectoryCopied`);case`workingDirectoryCopyFailed`:return t(`toast.workingDirectoryCopyFailed`);case`sectionSyncPending`:return t(`toast.sectionSyncPending`);case`sectionMoveUnknown`:return t(`section.outcomeUnknown`);case`sectionMoveFailed`:return t(`toast.sectionMoveFailed`,{message:e.message});case`recentVisitsStorageFailed`:return t(`recent.cache.error`);
126
126
  /* v8 ignore next 2 -- closed-union backstop; only reached if a notice kind is forged */
127
- default:return qm(e)}}let ux={"host.local":`本机`,"host.thisComputer":`此计算机`,"host.connected":`已连接`,"host.connecting":`连接中`,"host.disconnected":`未连接`,"heroPicker.location.aria":`选择工作位置:{current}`,"heroPicker.location.placeholder":`工作位置`,"heroPicker.location.empty":`无匹配位置`,"heroPicker.location.connectRemote":`连接远程主机…`,"heroPicker.location.manageRemote":`管理远程主机`,"heroPicker.project.aria":`选择项目:{current}`,"heroPicker.project.choose":`选择项目`,"heroPicker.project.noProject":`不选择项目`,"heroPicker.project.placeholder":`搜索项目`,"heroPicker.project.empty":`该位置暂无项目`,"heroPicker.project.noMatches":`无匹配项目`,"heroPicker.project.new":`新建项目`,"hostScope.allShort":`全部`,"hostScope.allHosts":`全部主机`,"hostScope.filtered":`已筛选`,"hostScope.trigger.aria":`主机与工作区范围筛选:{current}`,"hostScope.popover.aria":`主机与工作区范围筛选`,"hostScope.host.label":`选择主机`,"hostScope.scope.label":`展示范围`,"hostScope.scope.allSessions":`全部会话`,"hostScope.scope.selectedWorkspaces":`仅选定工作区`,"hostScope.selectedCount":`已选 {selected}/{total}`,"hostScope.selectAll":`全选`,"hostScope.clear":`清空`,"hostScope.reset":`重置筛选`,"hostScope.noHostWorkspaces":`该主机暂无工作区`,"hostScope.emptyWorkspaces":`当前筛选下暂无工作区`,"hostScope.emptySessions":`当前筛选下暂无会话`,"hostScope.showAll":`显示全部`,"hostScope.action.addRemoteWorkspace":`远程新增工作区`,"hostScope.action.manageRemoteHosts":`管理远程主机`,"workspace.addLocal":`添加本机工作区`,"workspace.addRemote":`远程新增工作区…`,"defaultWorkspace.failed":`无法创建默认工作区,请通过“选择工作区”选择文件夹`,"draft.workspaceRequired":`请先选择工作区`,"draft.initializationFailed":`暂时无法填入草稿,请稍后重试`,"recent.navigation":`会话标签`,"recent.expand":`展开会话标签栏`,"recent.collapse":`收起会话标签栏`,"recent.settings.title":`显示会话标签`,"recent.settings.mobile":`移动端`,"recent.settings.description":`在手机会话顶部显示可关闭的标签栏。`,"recent.settings.error":`无法在此浏览器中保存设置,已保留原设置。`,"recent.timeout.title":`自动关闭闲置标签`,"recent.timeout.off":`不自动关闭`,"recent.timeout.minutes":`{n} 分钟`,"recent.timeout.hours":`{n} 小时`,"recent.timeout.default":`{value}(默认)`,"recent.close":`关闭标签“{name}”`,"recent.closeHint":`仅关闭标签,不删除会话或停止任务`,"recent.closeFailed":`未能关闭标签,请重试。`,"recent.clear":`清空`,"recent.clearAll":`清空所有会话标签`,"recent.clearAllHint":`关闭所有标签,不删除会话或停止任务`,"recent.cache.error":`无法读取或保存会话标签。仍可在本页切换会话,刷新后标签可能丢失。`,"group.ungrouped":`最近`,"group.remoteOtherSessions":`未归类`,"session.new":`新会话`,"session.untitled":`未命名`,"session.backToList":`返回会话列表`,"shortcut.noSession":`请先选择一个会话`,"shortcut.noPicker":`目录选择器不可用`,"shortcut.directoryBusy":`正在选择或添加工作区`,"shortcut.noCompletedTurn":`当前会话没有已结束的轮次`,"shortcut.remoteForkUnsupported":`远程会话暂不支持分叉`,"shortcut.forkFailed":`无法分叉会话,请重试`,"section.workspaces":`工作区`,"section.sessions":`会话`,"section.pinned":`置顶`,"viewOptions.label":`视图选项`,"groupBy.label":`分组方式`,"groupBy.workspace":`按工作区`,"groupBy.workspaceTree":`按工作区树`,"groupBy.flat":`单列表`,"orderBy.label":`排序方式`,"orderBy.manual":`手动排序`,"orderBy.updated":`最近更新`,"filterBy.label":`筛选会话`,"viewOptions.hideArchived":`隐藏已归档`,"viewOptions.showArchived":`全部对话(显示已归档)`,"viewOptions.onlyArchived":`仅显示已归档`,"sessions.expand":`展开显示`,"sessions.collapse":`收起`,"sessions.loading":`正在加载历史会话…`,"sessions.expandMore":`展开显示`,"sessions.searchWorkspaceHistory":`查找更早的会话`,"sessions.continueWorkspaceHistory":`继续查找更早的会话`,"sessions.retryWorkspaceHistory":`重试查找更早的会话`,"sessions.retry":`重试`,"sessions.notLoaded":`已加载的会话中暂无匹配项,可按需加载更早会话`,"workspaces.expand":`展开显示`,"empty.none":`暂无会话`,"empty.noneArchived":`暂无已归档会话`,"empty.viewOthers":`查看其他会话`,"empty.noMatches":`无匹配结果`,"workspace.add":`添加工作区`,"search.sessions.aria":`搜索会话`,"activityView.label":`活动视图`,"activityView.unreadCount.one":`· {n} 条未读`,"activityView.unreadCount.other":`· {n} 条未读`,"activityView.markAllRead":`全部已读`,"activityView.empty":`暂无未读或进行中的会话`,"activityView.backToAll":`返回全部会话`,"search.placeholder":`搜索会话名称`,"search.clear":`清除搜索`,"search.results.aria":`搜索结果`,"search.pending":`正在搜索会话历史…`,"search.noMatches":`无匹配会话`,"search.hasMore":`仅显示前 {n} 条结果,请缩小搜索范围。`,"menu.addWorkspace":`添加工作区…`,"menu.noWorkspace":`不选择工作区`,"picker.loading":`正在加载工作区…`,"conflict.named":`已存在名为“{name}”的工作区。`,"folderError.title":`无法打开文件夹`,"folderError.retry":`重新选择`,rename:`重命名`,"rename.workspace.title":`重命名工作区`,"defaultHarness.title":`默认 Harness`,"defaultHarness.select":`选择默认 Harness,当前:{name}`,"defaultHarness.description":`选择「{name}」新会话默认使用的 Harness。`,"defaultHarness.global":`跟随全局`,"defaultHarness.global.desc":`不单独设置,沿用所有项目最近一次使用的 Harness`,"defaultHarness.last":`记住本项目上次所用`,"defaultHarness.last.desc":`自动沿用上一次在本项目新建会话时使用的 Harness`,"defaultHarness.manual":`固定指定 Harness`,"defaultHarness.manual.desc":`每次在本项目新建会话时,始终使用下方选定的 Harness`,"defaultHarness.choose":`选择 Harness`,"defaultHarness.loading":`正在加载可用的 Harness…`,"defaultHarness.unavailable":`{name}(当前不可用)`,"defaultHarness.loadFailed":`无法加载项目默认设置,请关闭后重试。`,"defaultHarness.saveFailed":`无法保存项目默认设置,请重试。`,"defaultHarness.save":`保存`,"rename.session.title":`重命名会话`,"field.workspaceName":`工作区名称`,"field.sessionName":`会话名称`,"delete.workspace":`删除工作区`,"delete.desc":`将把“{name}”从工作区列表中移除。文件夹与会话记录会保留,其会话将显示在“未分组”下。`,"delete.nativeProject":`将从 Codex 和 Web 的项目列表移除“{name}”。文件夹和会话记录会保留,会话将显示在“未分组”下。`,"delete.pending":`正在删除工作区…`,"menu.copySessionLink":`复制会话链接`,"menu.copyWorkingDirectory":`复制工作目录`,"toast.workingDirectoryCopied":`已复制工作目录`,"toast.workingDirectoryCopyFailed":`复制工作目录失败`,"menu.referenceSession":`引用会话`,"menu.referenceSessionFailed":`未加入草稿:编辑位置或会话已失效`,"toast.sessionLinkCopied":`已复制`,"toast.sessionLinkCopyFailed":`复制会话链接失败`,"menu.markAsUnread":`标记为未读`,"menu.markChildrenAsRead":`将子对话全部标为已读`,"menu.fork":`分叉会话`,"menu.archiveSession":`归档会话`,"menu.deleteSession":`删除会话`,"delete.session.title":`删除会话`,"delete.session.description":`确定要删除「{title}」吗?此操作无法撤销。`,"delete.session.action":`删除`,"delete.session.pending":`正在删除…`,"delete.session.runningHint":`存在正在运行的会话,删除将中断当前任务。`,"delete.session.children.title":`删除父会话`,"delete.session.children.description":`「{title}」下有 {n} 个子会话。请选择仅删除父会话,还是连同全部子会话一起删除(无法撤销)。`,"delete.session.children.parentOnly":`仅删除父会话`,"delete.session.children.include":`同时删除全部 {n} 个子会话`,"delete.session.children.partial":`父会话已删除,{n} 个子会话未能删除。`,"archive.children.title":`归档父会话`,"archive.children.description":`选择是否同时归档「{title}」下的全部子会话。`,"archive.children.parentOnly":`仅归档父会话`,"archive.children.include":`同时归档全部 {n} 个子会话`,"archive.children.partial":`父会话已归档,{n} 个子会话未归档。`,"menu.moveToSection":`移动到分区`,"menu.removeFromSection":`移回无分区`,"menu.moveSectionUp":`在分区中上移`,"menu.moveSectionDown":`在分区中下移`,"section.destination":`目标分区`,"section.unsectioned":`无分区`,"section.move":`移动`,"section.projectMoveFailed":`无法移动项目。请刷新后重试。`,"section.moving":`正在移动…`,"section.moveFailed":`无法移动会话。请刷新后重试。`,"section.targetDeletedOption":`所选分区已删除`,"section.targetDeleted":`所选目标分区已被删除,请重新选择目标分区。`,"toast.sectionMoveFailed":`移动会话未完成:{message}`,"section.create.title":`新建分区`,"section.create.action":`创建`,"section.rename.title":`重命名分区`,"section.delete.title":`删除分区`,"section.delete.action":`删除分区`,"section.delete.desc":`删除分区“{name}”?会话将移回无分区,不会被删除、归档或移出所属项目。`,"section.delete.pending":`正在删除分区…`,"section.namePlaceholder":`输入分区名称`,"field.sectionName":`分区名称`,"section.empty":`暂无会话`,"actions.section.aria":`分区“{name}”的操作`,"section.outcomeUnknown":`操作结果未知,请确认当前分区状态后再试。`,"toast.sectionSyncPending":`分区已更新,外部会话归属仍在同步。`,"menu.unarchiveSession":`取消归档`,"threadTree.style.title":`会话树的展示方式`,"threadTree.style.promptTitle":`选择会话树的展示方式`,"threadTree.style.description":`父会话收起时,如何显示子会话的状态。`,"threadTree.style.summary":`详细`,"threadTree.style.ring":`简洁`,"threadTree.style.summarySubtitle":`显示数量与状态`,"threadTree.style.ringSubtitle":`图标外圈显示状态`,"threadTree.style.hint":`可随时在“视图选项”或“设置”中修改。`,"threadTree.style.later":`稍后`,"threadTree.style.error":`无法保存样式,请重试;已保留原设置。`,"threadTree.style.samplePending":`有子会话等待批准`,"threadTree.style.sampleRunning":`有子会话正在运行`,"threadTree.style.sampleUnread":`有子会话未读完成`,"threadTree.style.sampleRead":`子会话都已读`,"threadTree.expand":`展开 {n} 个子会话`,"threadTree.collapse":`收起 {n} 个子会话`,"threadTree.children":`{n} 个子会话`,"threadTree.expandSummary":`{title},{summary},展开`,"threadTree.running":`{n} 运行中`,"threadTree.pending":`{n} 待批准`,"threadTree.completed":`{n} 未读`,"archive.confirm.thread":`正在运行的会话:{title}`,"menu.pinSession":`置顶会话`,"menu.unpinSession":`取消置顶`,"menu.pinWorkspace":`置顶工作区`,"menu.unpinWorkspace":`取消置顶工作区`,"row.archived":`已归档`,"row.pinned":`已置顶`,"toast.archivedNotOpenable":`已归档对话暂时无法查看,请取消归档后查看`,"toast.archived":`会话已归档,可`,"toast.stoppedAndArchived":`已停止并归档,可`,"archive.confirm.title":`停止并归档此会话?`,"archive.confirm.desc":`“{title}”仍有正在进行的工作。归档会先停止这些工作;之后可在侧栏筛选“全部对话(显示已归档)”中恢复会话,被停止的工作不会自动继续。`,"archive.confirm.activity":`将被停止的工作`,"archive.confirm.turn":`进行中的回合`,"archive.confirm.subagents.one":`{n} 个运行中的子智能体:{names}`,"archive.confirm.subagents.other":`{n} 个运行中的子智能体:{names}`,"archive.confirm.jobs.one":`{n} 个后台任务:{names}`,"archive.confirm.jobs.other":`{n} 个后台任务:{names}`,"archive.confirm.schedules.one":`{n} 条定时提醒:{names}`,"archive.confirm.schedules.other":`{n} 条定时提醒:{names}`,"archive.confirm.other.one":`{n} 项其他工作({kind})`,"archive.confirm.other.other":`{n} 项其他工作({kind})`,"archive.confirm.listSeparator":`、`,"archive.confirm.action":`停止并归档`,"archive.confirm.pending":`正在停止并归档…`,"toast.archivedUndo":`撤销`,"toast.archivedOr":`或`,"toast.archivedFilter":`筛选已归档会话`,"toast.archiveFailed":`归档未确认,请检查会话状态:{message}`,"toast.unarchiveFailed":`取消归档未确认,请刷新后检查:{message}`,"toast.deleted":`会话已删除`,"toast.deleteFailed":`删除失败:{message}`,"toast.pinFailed":`置顶未确认,请刷新后检查:{message}`,"toast.unpinFailed":`取消置顶未确认,请刷新后检查:{message}`,"toast.createFailed":`新建会话失败:{message}`,"toast.forkFailed":`分叉未完成:{message}`,"sessions.count.one":`{n} 个会话`,"sessions.count.other":`{n} 个会话`,"actions.workspace.aria":`工作区“{name}”的操作`,"actions.session.aria":`会话“{name}”的操作`,"actions.archive":`归档会话`,"actions.unarchive":`取消归档`,"actions.pin":`置顶会话`,"actions.unpin":`取消置顶`,"actions.newSession":`新会话`,"actions.newSession.aria":`在“{name}”中新建会话`,"status.running":`进行中`,"status.subagentsRunning.one":`{n} 个子智能体运行中`,"status.subagentsRunning.other":`{n} 个子智能体运行中`,"status.idle":`空闲`,"status.waitingApproval":`等待审批`,"status.planReview":`计划待审`,"status.waitingAnswer":`等待回答`,"status.compact.approval":`待审批`,"status.compact.planReview":`计划待审`,"status.compact.answer":`待回答`,"status.completed":`已完成`,"hover.created":`创建于 {time}`,"hover.copied":`已复制`,"date.ymd":`{y}年{m}月{d}日`,"time.now":`刚刚`,"time.minutes":`{n}分钟`,"time.hours":`{n}小时`,"time.days":`{n}天`,"time.months":`{n}个月`,"time.years":`{n}年`,"time.ago":`{t}前`},dx={"host.local":`Local`,"host.thisComputer":`This computer`,"host.connected":`Connected`,"host.connecting":`Connecting`,"host.disconnected":`Disconnected`,"heroPicker.location.aria":`Work location: {current}`,"heroPicker.location.placeholder":`Work location`,"heroPicker.location.empty":`No matching locations`,"heroPicker.location.connectRemote":`Connect remote host…`,"heroPicker.location.manageRemote":`Manage remote hosts`,"heroPicker.project.aria":`Project: {current}`,"heroPicker.project.choose":`Choose project`,"heroPicker.project.noProject":`No project`,"heroPicker.project.placeholder":`Search projects`,"heroPicker.project.empty":`No projects on this host`,"heroPicker.project.noMatches":`No matching projects`,"heroPicker.project.new":`New project`,"hostScope.allShort":`All`,"hostScope.allHosts":`All hosts`,"hostScope.filtered":`Filtered`,"hostScope.trigger.aria":`Filter host and workspace scope: {current}`,"hostScope.popover.aria":`Host and workspace scope filter`,"hostScope.host.label":`Host`,"hostScope.scope.label":`Display scope`,"hostScope.scope.allSessions":`All sessions`,"hostScope.scope.selectedWorkspaces":`Selected workspaces`,"hostScope.selectedCount":`{selected}/{total} selected`,"hostScope.selectAll":`Select all`,"hostScope.clear":`Clear`,"hostScope.reset":`Reset`,"hostScope.noHostWorkspaces":`No workspaces on this host`,"hostScope.emptyWorkspaces":`No workspaces match the current filter`,"hostScope.emptySessions":`No sessions match the current filter`,"hostScope.showAll":`Show all`,"hostScope.action.addRemoteWorkspace":`Add remote workspace`,"hostScope.action.manageRemoteHosts":`Manage remote hosts`,"workspace.addLocal":`Add local workspace`,"workspace.addRemote":`Add remote workspace…`,"defaultWorkspace.failed":`Unable to create default workspace. Use Choose workspace to select a folder.`,"draft.workspaceRequired":`Choose a workspace first.`,"draft.initializationFailed":`Could not fill the draft. Please try again shortly.`,"recent.navigation":`Session tabs`,"recent.expand":`Expand session tabs`,"recent.collapse":`Collapse session tabs`,"recent.settings.title":`Show session tabs`,"recent.settings.mobile":`Mobile`,"recent.settings.description":`Show closable tabs above phone conversations.`,"recent.settings.error":`Could not save in this browser. The previous setting is unchanged.`,"recent.timeout.title":`Automatically close idle tabs`,"recent.timeout.off":`Never`,"recent.timeout.minutes":`{n} minutes`,"recent.timeout.hours":`{n} hours`,"recent.timeout.default":`{value} (default)`,"recent.close":`Close tab “{name}”`,"recent.closeHint":`Close only this tab, without deleting the session or stopping tasks`,"recent.closeFailed":`Could not close the tab. Please try again.`,"recent.clear":`Clear`,"recent.clearAll":`Clear all session tabs`,"recent.clearAllHint":`Close all tabs without deleting sessions or stopping tasks`,"recent.cache.error":`Could not read or save session tabs. Switching still works in this page; tabs may be lost on reload.`,"group.ungrouped":`Recents`,"group.remoteOtherSessions":`Uncategorized`,"session.new":`New Session`,"session.untitled":`Untitled`,"session.backToList":`Back to session list`,"shortcut.noSession":`Select a session first`,"shortcut.noPicker":`Directory picker unavailable`,"shortcut.directoryBusy":`Selecting or adding a workspace`,"shortcut.noCompletedTurn":`This session has no completed turn`,"shortcut.remoteForkUnsupported":`Remote sessions cannot be forked`,"shortcut.forkFailed":`Could not fork the session. Try again.`,"section.workspaces":`Workspaces`,"section.sessions":`Sessions`,"section.pinned":`Pinned`,"viewOptions.label":`View options`,"groupBy.label":`Group by`,"groupBy.workspace":`WorkSpace`,"groupBy.workspaceTree":`Workspace Tree`,"groupBy.flat":`In one list`,"orderBy.label":`Order by`,"orderBy.manual":`Manual`,"orderBy.updated":`Last updated`,"filterBy.label":`Filter sessions`,"viewOptions.hideArchived":`Hide archived`,"viewOptions.showArchived":`All conversations (show archived)`,"viewOptions.onlyArchived":`Archived only`,"sessions.expand":`Show {n} more`,"sessions.collapse":`Show less`,"sessions.loading":`Loading conversation history…`,"sessions.expandMore":`Show more`,"sessions.searchWorkspaceHistory":`Find older conversations`,"sessions.continueWorkspaceHistory":`Keep looking for older conversations`,"sessions.retryWorkspaceHistory":`Retry finding older conversations`,"sessions.retry":`Retry`,"sessions.notLoaded":`No matching loaded conversations. Older conversations can be loaded on demand.`,"workspaces.expand":`Show all workspaces`,"empty.none":`No sessions yet`,"empty.noneArchived":`No archived sessions yet`,"empty.viewOthers":`View other sessions`,"empty.noMatches":`No matches`,"workspace.add":`Add workspace`,"search.sessions.aria":`Search sessions`,"activityView.label":`Activity view`,"activityView.unreadCount.one":`· {n} unread`,"activityView.unreadCount.other":`· {n} unread`,"activityView.markAllRead":`Mark all read`,"activityView.empty":`No unread or active conversations`,"activityView.backToAll":`Back to all sessions`,"search.placeholder":`Search session names`,"search.clear":`Clear search`,"search.results.aria":`Search results`,"search.pending":`Searching session history…`,"search.noMatches":`No matching sessions`,"search.hasMore":`Showing the first {n} results. Narrow your search.`,"menu.addWorkspace":`Add workspace…`,"menu.noWorkspace":`No workspace`,"picker.loading":`Loading workspaces…`,"conflict.named":`A workspace named “{name}” already exists.`,"folderError.title":`Couldn’t open folder`,"folderError.retry":`Choose again`,rename:`Rename`,"rename.workspace.title":`Rename workspace`,"defaultHarness.title":`Default Harness`,"defaultHarness.select":`Choose default Harness, current: {name}`,"defaultHarness.description":`Choose the default Harness for new sessions in “{name}”.`,"defaultHarness.global":`Follow global`,"defaultHarness.global.desc":`Do not override; use the Harness most recently used across all projects`,"defaultHarness.last":`Remember last used in this project`,"defaultHarness.last.desc":`Reuse the Harness most recently used for a new session in this project`,"defaultHarness.manual":`Always use a specific Harness`,"defaultHarness.manual.desc":`Always use the Harness selected below for new sessions in this project`,"defaultHarness.choose":`Choose a Harness`,"defaultHarness.loading":`Loading available Harnesses…`,"defaultHarness.unavailable":`{name} (currently unavailable)`,"defaultHarness.loadFailed":`Could not load the project default. Close the dialog and try again.`,"defaultHarness.saveFailed":`Could not save the project default. Try again.`,"defaultHarness.save":`Save`,"rename.session.title":`Rename session`,"field.workspaceName":`Workspace name`,"field.sessionName":`Session name`,"delete.workspace":`Delete workspace`,"delete.desc":`This removes “{name}” from the workspace list. The folder and session logs will be kept. Its sessions will appear under Ungrouped.`,"delete.nativeProject":`This removes “{name}” from the project list in Codex and Web. Its folders and conversations are kept. The conversations appear under Ungrouped.`,"delete.pending":`Deleting workspace…`,"menu.copySessionLink":`Copy session link`,"menu.copyWorkingDirectory":`Copy working directory`,"toast.workingDirectoryCopied":`Working directory copied`,"toast.workingDirectoryCopyFailed":`Could not copy working directory`,"menu.referenceSession":`Reference session`,"menu.referenceSessionFailed":`Not added: the editing position or session is no longer available`,"toast.sessionLinkCopied":`Copied`,"toast.sessionLinkCopyFailed":`Could not copy session link`,"menu.markAsUnread":`Mark as unread`,"menu.markChildrenAsRead":`Mark all child threads as read`,"menu.fork":`Fork session`,"menu.archiveSession":`Archive session`,"menu.deleteSession":`Delete session`,"delete.session.title":`Delete session`,"delete.session.description":`Delete “{title}”? This action cannot be undone.`,"delete.session.action":`Delete`,"delete.session.pending":`Deleting…`,"delete.session.runningHint":`Active work is running and will be stopped.`,"delete.session.children.title":`Delete parent session`,"delete.session.children.description":`“{title}” has {n} child sessions. Choose whether to delete only the parent session or all child sessions as well. This cannot be undone.`,"delete.session.children.parentOnly":`Delete parent only`,"delete.session.children.include":`Also delete {n} child sessions`,"delete.session.children.partial":`Parent deleted. {n} child sessions could not be deleted.`,"archive.children.title":`Archive parent session`,"archive.children.description":`Choose whether to also archive all child sessions of “{title}”.`,"archive.children.parentOnly":`Archive parent only`,"archive.children.include":`Also archive all {n} child sessions`,"archive.children.partial":`Parent archived. {n} child sessions could not be archived.`,"menu.moveToSection":`Move to section`,"menu.removeFromSection":`Remove from section`,"menu.moveSectionUp":`Move up in section`,"menu.moveSectionDown":`Move down in section`,"section.destination":`Destination section`,"section.unsectioned":`No section`,"section.move":`Move`,"section.projectMoveFailed":`Could not move the project. Refresh and try again.`,"section.moving":`Moving…`,"section.moveFailed":`Could not move the session. Refresh and try again.`,"section.targetDeletedOption":`Selected section deleted`,"section.targetDeleted":`The selected section was deleted. Choose another destination.`,"toast.sectionMoveFailed":`Could not move session: {message}`,"section.create.title":`New section`,"section.create.action":`Create`,"section.rename.title":`Rename section`,"section.delete.title":`Delete section`,"section.delete.action":`Delete section`,"section.delete.desc":`Delete section “{name}”? Sessions will return to the unsectioned list without being deleted, archived, or moved out of their projects.`,"section.delete.pending":`Deleting section…`,"section.namePlaceholder":`Enter section name`,"field.sectionName":`Section name`,"section.empty":`No sessions`,"actions.section.aria":`Actions for section {name}`,"section.outcomeUnknown":`Operation outcome unknown. Check the current section state before retrying.`,"toast.sectionSyncPending":`Section updated. External Thread membership is still syncing.`,"menu.unarchiveSession":`Unarchive session`,"threadTree.style.title":`Session tree display`,"threadTree.style.promptTitle":`Choose how to display session trees`,"threadTree.style.description":`How a collapsed parent shows its child sessions' status.`,"threadTree.style.summary":`Detailed`,"threadTree.style.ring":`Compact`,"threadTree.style.summarySubtitle":`Count and status`,"threadTree.style.ringSubtitle":`Icon status ring`,"threadTree.style.hint":`Change this anytime in View options or Settings.`,"threadTree.style.later":`Later`,"threadTree.style.error":`Could not save the style. Previous setting kept; please retry.`,"threadTree.style.samplePending":`Child awaiting approval`,"threadTree.style.sampleRunning":`Child running`,"threadTree.style.sampleUnread":`Child finished, unread`,"threadTree.style.sampleRead":`All read`,"threadTree.expand":`Expand {n} child sessions`,"threadTree.collapse":`Collapse {n} child sessions`,"threadTree.children":`{n} child sessions`,"threadTree.expandSummary":`{title}, {summary}, expand`,"threadTree.running":`{n} running`,"threadTree.pending":`{n} needs approval`,"threadTree.completed":`{n} unread`,"archive.confirm.thread":`Running session: {title}`,"menu.pinSession":`Pin session`,"menu.unpinSession":`Unpin session`,"menu.pinWorkspace":`Pin workspace`,"menu.unpinWorkspace":`Unpin workspace`,"row.archived":`Archived`,"row.pinned":`Pinned`,"toast.archivedNotOpenable":`Archived sessions cannot be opened. Unarchive it to view.`,"toast.archived":`Session archived. You can `,"toast.stoppedAndArchived":`Session stopped and archived. You can `,"archive.confirm.title":`Stop and archive this session?`,"archive.confirm.desc":`“{title}” still has work in progress. Archiving stops it first; you can restore the session later from the “All conversations (show archived)” filter in the sidebar, and the stopped work will not resume on its own.`,"archive.confirm.activity":`Work that will be stopped`,"archive.confirm.turn":`The turn in progress`,"archive.confirm.subagents.one":`{n} running subagent: {names}`,"archive.confirm.subagents.other":`{n} running subagents: {names}`,"archive.confirm.jobs.one":`{n} background job: {names}`,"archive.confirm.jobs.other":`{n} background jobs: {names}`,"archive.confirm.schedules.one":`{n} scheduled reminder: {names}`,"archive.confirm.schedules.other":`{n} scheduled reminders: {names}`,"archive.confirm.other.one":`{n} other item of work ({kind})`,"archive.confirm.other.other":`{n} other items of work ({kind})`,"archive.confirm.listSeparator":`, `,"archive.confirm.action":`Stop and archive`,"archive.confirm.pending":`Stopping and archiving…`,"toast.archivedUndo":`undo`,"toast.archivedOr":` or `,"toast.archivedFilter":`filter archived sessions`,"toast.archiveFailed":`Archive not confirmed. Check session status: {message}`,"toast.unarchiveFailed":`Unarchive not confirmed. Refresh to check: {message}`,"toast.deleted":`Session deleted`,"toast.deleteFailed":`Delete failed: {message}`,"toast.pinFailed":`Pin not confirmed. Refresh to check: {message}`,"toast.unpinFailed":`Unpin not confirmed. Refresh to check: {message}`,"toast.createFailed":`New session failed: {message}`,"toast.forkFailed":`Fork did not complete: {message}`,"sessions.count.one":`{n} session`,"sessions.count.other":`{n} sessions`,"actions.workspace.aria":`Workspace actions for {name}`,"actions.session.aria":`Session actions for {name}`,"actions.archive":`Archive`,"actions.unarchive":`Unarchive`,"actions.pin":`Pin`,"actions.unpin":`Unpin`,"actions.newSession":`New session`,"actions.newSession.aria":`New session in {name}`,"status.running":`Running`,"status.subagentsRunning.one":`{n} subagent running`,"status.subagentsRunning.other":`{n} subagents running`,"status.idle":`Idle`,"status.waitingApproval":`Waiting for approval`,"status.planReview":`Plan awaiting review`,"status.waitingAnswer":`Waiting for answer`,"status.compact.approval":`Approval`,"status.compact.planReview":`Plan review`,"status.compact.answer":`Answer`,"status.completed":`Completed`,"hover.created":`Created {time}`,"hover.copied":`Copied`,"date.ymd":`{y}-{m}-{d}`,"time.now":`now`,"time.minutes":`{n}min`,"time.hours":`{n}h`,"time.days":`{n}d`,"time.months":`{n}mo`,"time.years":`{n}y`,"time.ago":`{t} ago`};function fx(e,t,n=!1){let r=/* @__PURE__ */ new Map;for(let t of Object.values(e.byId)){if(n&&!px(t))continue;let i=yh(t,e)??(n?t.projectionValues?.archiveForkParent:null);if(!i)continue;let a=r.get(i)??[];a.push(t.id),r.set(i,a)}let i=/* @__PURE__ */ new Set([t]),a=[...r.get(t)??[]];for(let e=a.pop();e!==void 0;e=a.pop())i.has(e)||(i.add(e),a.push(...r.get(e)??[]));return i.delete(t),i}function px(e){return e!==void 0&&!e.blank&&e.origin!==`subagent`&&e.projectionValues?.threadTreeParent!==void 0}function mx(e,t,n){let r=[];for(let i of fx(e,t,!0)){let t=Hm(i),a=e.byId[t];!n.has(t)&&a&&r.push({id:t,title:a.displayTitle})}return r}function hx(e,t){let n=/* @__PURE__ */ new Map;for(let t of Object.values(e.byId)){let r=yh(t,e);if(!r)continue;let i=n.get(r)??[];i.push(t.id),n.set(r,i)}let r=/* @__PURE__ */ new Set([t]),i=[],a=t=>{for(let o of n.get(t)??[]){if(r.has(o))continue;r.add(o),a(o);let t=e.byId[o];t&&i.push({id:o,title:t.displayTitle,running:t.running})}};return a(t),i}function gx(e,t,n=fx(e,t)){let r=[t,...n],i=/* @__PURE__ */ new Set,a=/* @__PURE__ */ new Map;for(let t=r.pop();t!==void 0;t=r.pop()){if(i.has(t))continue;i.add(t);let n=e.projectionsBySession[Hm(t)]?.values.subagentCatalog??[];for(let t of n)e.byId[t.id]?.running&&a.set(t.id,{id:t.id,...t.label===void 0?{}:{label:t.label}}),r.push(t.id)}return[...a.values()]}let _x=()=>!1,vx=()=>()=>{};function yx(e){let t=(0,r.usePhoneSidebar)();return t!==null&&!t.open?null:/* @__PURE__ */ (0,o.jsx)(bx,{...e,closeDrawer:t?.close},e.sessionId)}function bx({sessionId:e,prepareDraftReference:t,closeDrawer:n,useMenuOpenState:i,t:a}){let[c]=(0,s.useState)(()=>t(e)),l=(0,s.useSyncExternalStore)(c?.subscribe??vx,c?.getSnapshot??_x),u=(0,s.useRef)(!1),[d,f]=(0,s.useState)(!1),[,p]=i();return c===void 0?null:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(r.IconLinkOutlineRegular,{}),disabled:d||!l,onSelect:()=>{if(!u.current){u.current=!0;try{if(c?.insert()===!0){p(!1),n?.();return}}catch{}f(!0)}},children:a(`menu.referenceSession`)}),d&&/* @__PURE__ */ (0,o.jsx)(`div`,{role:`status`,children:a(`menu.referenceSessionFailed`)})]})}let xx=`workspace`,Sx=[`slots`,`sessions`,`uiSession`,`workspaces`,`locale`,`remote`,`remote.directoryPicker`,`remote.session`,`layout`,`shortcuts`,`configForms`];function Cx(e){let t=e.get(`sessions`),n=e.get(`workspaces`),a=Ph(),o=a.create();o.actions.setArchivedFilter(`default`),e.effect(()=>{let e=()=>{t.setIncludeArchived((o.getSnapshot().archivedFilter??`default`)!=="default")},n=o.subscribe(e);return e(),n},`ui-workspace: browser-local archive query scope`);let s={...a,create:()=>o},c=(0,i.createSnapshotStore)(null),u=0,d=e=>{c.set({...e,seq:++u})},f=new eg(e,e.remote.directoryPicker,n,t,o.actions,d,e.remote.session),p=v_(e);c_(e,f,p),e.slots.provideRoot({hooks:{workspaces:n.list}}),e.effect(()=>e.locale.register(xx,{zh:ux,en:dx}),`ui-workspace: dictionaries`);let m=zm(),h=async(e,n)=>{let r=await t.search(e,n);if(!r.ok)throw Error(r.error.message);return r.value},g=t=>({getSnapshot:()=>e.slots.entries(t).length>0,subscribe:n=>e.slots.subscribe(t,n)}),_=g(`sidebar.workspaces.directoryFlow`),v={getSnapshot:()=>e.remote.$host,subscribe:t=>e.on(`connection/reset`,t)},y=g(`conversation.hero.workspace.directoryFlow`),b=e=>{f.openSession(e)},x=Vb(n.list,e=>new Set(e.pinnedSessionIds)),S=Vb(n.list,e=>new Set(e.archivedSessionIds)),C=Vb(m.state,e=>e.renameTarget),w=(0,i.createSnapshotStore)(null),T=(0,i.createSnapshotStore)(null),E=(0,i.createSnapshotStore)(null),D=m.rename,ee=e=>{f.unarchiveSession(e).catch(e=>{d({kind:`unarchiveFailed`,message:e instanceof Error?e.message:String(e)})})},te=async(e,n)=>{let r=await t.using(e,{source:`workspaceOperation`},e=>e.binding.session.rename(n));if(!r.ok)throw Error(r.error.message)},ne=Vb(t.list,e=>new Set(Object.values(e.byId).filter(e=>!e.blank&&e.origin!==`subagent`&&!e.projectionValues?.remoteHost&&!!e.projectionValues?.harnessIdentity?.id).map(e=>e.id))),re=(0,i.createSnapshotStore)(null),ie=(0,i.createSnapshotStore)(null),ae=Vb(o,e=>e.archivedFilter??`default`),oe=ty({execute:(e,t,r,i)=>n.moveSessionToSection?n.moveSessionToSection(e,t,r,i):Promise.reject(/* @__PURE__ */ Error(`Section moves are unavailable`)),onError:e=>{d({kind:`sectionMoveFailed`,message:e instanceof Error?e.message:String(e)})},onUnknown:()=>d({kind:`sectionMoveUnknown`})}),se=()=>({hooks:{nativeThreads:ne,sectionWorkspace:n.list,sectionSessions:t.list,scopedSessionIds:ie,archivedFilter:ae,movingSectionSessions:oe.movingSessionIds},requestMove:e=>re.set(e),moveSession:e=>oe.move(e)}),O=()=>({hooks:{threadSectionMove:re,sectionWorkspace:n.list,movingSectionSessions:oe.movingSessionIds},dismiss:()=>re.set(null),move:e=>oe.move(e,{notifyOnError:!1})}),ce=(0,i.createSnapshotStore)(null),k=()=>({hooks:{threadSectionManage:ce},dismiss:()=>ce.set(null),createSection:async e=>{if(!n.createThreadSection)throw Error(`Section management is unavailable`);return n.createThreadSection(e)},updateSection:async(e,t)=>{if(!n.updateThreadSection)throw Error(`Section management is unavailable`);return n.updateThreadSection(e,t)},deleteSection:async e=>{if(!n.deleteThreadSection)throw Error(`Section management is unavailable`);return n.deleteThreadSection(e)},notifySyncPending:()=>d({kind:`sectionSyncPending`})}),A=()=>({hooks:{pinned:x,archived:S},pinSession:e=>{f.pinSession(e).catch(e=>{d({kind:`pinFailed`,message:e instanceof Error?e.message:String(e)})})},unpinSession:e=>{f.unpinSession(e).catch(e=>{d({kind:`unpinFailed`,message:e instanceof Error?e.message:String(e)})})}}),le=async(e,r,i=!1)=>{await f.archiveSession(e,{stopActivity:i});let a=0;for(let e of r)if(!n.list.getSnapshot().archivedSessionIds.includes(e))try{let n=t.list.getSnapshot();if(n.byId[e]?.running||gx(n,e,[]).length)throw Error(`Child Session is active`);await f.archiveSession(e)}catch{a++}d({kind:i?`stoppedAndArchived`:`archived`,sessionId:e,failedChildren:a})},ue=(e,n)=>{let r=t.list.getSnapshot(),i=r.byId[e],a=i?.displayTitle??e,o=gx(r,e,[]);i?.running||o.length>0?w.set({sessionId:e,displayTitle:a,children:n,activity:o.length?[{kind:`subagent`,items:o}]:[],...i?.running?{runningThreads:[{id:e,title:a}]}:{}}):le(e,n).catch(t=>{let r=wx(t);r===void 0?d({kind:`archiveFailed`,message:t instanceof Error?t.message:String(t)}):w.set({sessionId:e,displayTitle:a,activity:r,children:n})})},j=()=>({hooks:{archived:S},archiveSession:e=>{let n=t.list.getSnapshot(),r=mx(n,e,S.getSnapshot());r.length?T.set({sessionId:e,title:n.byId[e]?.displayTitle??e,children:r}):ue(e,[])},unarchiveSession:ee});Bm(e,f,m,j().archiveSession);let de=()=>({hooks:{archiveChildrenRequest:T},dismiss:()=>T.set(null),choose(e,t){T.getSnapshot()===e&&(T.set(null),ue(e.sessionId,t?e.children.map(({id:e})=>e):[]))}}),M=()=>({hooks:{archiveRequest:w},settleSessionArchive:()=>{w.set(null)},stopAndArchiveSession:(e,t=[])=>le(e,t,!0)}),fe=()=>({requestSessionDelete:e=>{let n=t.list.getSnapshot(),r=n.byId[e];E.set({sessionId:e,title:r?.displayTitle??e,running:r?.running===!0,children:hx(n,e)})}}),pe=()=>({hooks:{deleteRequest:E},dismiss:()=>{E.set(null)},deleteSession:async(e,t)=>{let n=0;if(t)for(let t of e.children)try{await f.deleteSession(t.id)}catch{n++}await f.deleteSession(e.sessionId),d({kind:`deleted`,...n>0?{failedChildren:n}:{}})}}),me=()=>({hooks:{archived:S},markCompletionUnread:t=>e.uiSession.markCompletionUnread(t)}),he=()=>({forkSession:t=>{f.forkSession(t,n=>{e.get(`productAnalytics`)?.track(`branch_session_click`,{session_id:n,parent_session_id:t,click_position:`sidebar`})}).then(e=>f.openSession(e)).catch(e=>{d({kind:`forkFailed`,message:e instanceof Error?e.message:String(e)})})}}),ge=e=>{e.trim()!==``&&(0,r.writeClipboard)(e).then(e=>{d({kind:e?`workingDirectoryCopied`:`workingDirectoryCopyFailed`})})},_e=()=>({copyWorkingDirectory:ge}),ve=()=>({copySessionLink:e=>{let n=t.list.getSnapshot().byId[e],i=n===void 0?void 0:Qm(n);i!==void 0&&(0,r.writeClipboard)($m(i)).then(e=>{d({kind:e?`sessionLinkCopied`:`sessionLinkCopyFailed`})})}}),ye=()=>({requestSessionRename:D}),be=()=>({hooks:{renameRequest:C},settleSessionRename:m.closeRename,renameSession:te}),xe=()=>({hooks:{toast:c},dismissToast:()=>{c.set(null)},undoArchive:ee,showArchived:()=>{o.actions.setArchivedFilter(`show`)}}),Se=()=>({startSession:e=>{f.startSession(e)},open:b,copyWorkingDirectory:ge,markCompletionsRead:t=>{e.get(`uiSession`)?.markCompletionsRead(t)},searchSessions:h,refreshSessions:()=>{t.refresh()},loadMoreSessions:e=>{t.loadMore(e)},searchResultLimit:t.searchResultLimit,requestSessionRename:D,notifyArchivedNotOpenable:()=>{d({kind:`archivedNotOpenable`})},setWorkspacePinned:n.setWorkspacePinned?.bind(n),moveWorkspaceToSection:n.moveWorkspaceToSection?.bind(n),renameWorkspace:async(e,t)=>{await n.rename(e,t)},deleteWorkspace:async e=>{await n.delete(e)},insertWorkspaceBefore:async(e,t)=>{await n.insertBefore(e,t)},unarchiveSession:async e=>{await f.unarchiveSession(e)},createWorkspace:e=>n.create(e),requestManageThreadSection:n.createThreadSection&&n.updateThreadSection&&n.deleteThreadSection?e=>ce.set(e):void 0,moveSessionToSection:n.moveSessionToSection?e=>oe.move(e):void 0,setScopedSessionIds:e=>{ie.set(e)},requestSearch:m.search,requestAddWorkspace:m.add,closeAddWorkspace:m.closeAdd,setDirectoryBusy:m.directoryBusy,dismissForkError:m.dismissForkError,setThreadTreeCollapseStyle:e=>p.set(`threadTreeCollapseStyle`,e),hooks:{workspacePreferences:p,directoryFlow:_,hostInfo:v,workspaceShortcuts:m.state,shortcuts:e.shortcuts.catalog,nativeThreads:ne,movingSectionSessions:oe.movingSessionIds,groupRooms:f.groupRooms}}),N=()=>({createWorkspace:e=>n.create(e),hooks:{directoryFlow:y}});e.slots.inject(`sidebar.workspaces`,()=>e.slots.register({name:`sidebar.workspaces`,children:{"sidebar.workspaces.directoryFlow":{kind:`single`,scope:`root`},"sidebar.workspaces.session.menu.item":{kind:`list`,scope:`root`,inject:{hooks:{menuOpenState:l,shortcuts:e.shortcuts.catalog}}},"sidebar.workspaces.session.row.action":{kind:`list`,scope:`root`},"sidebar.workspaces.groups.section":{kind:`single`,scope:`root`},"sidebar.workspaces.groups.row":{kind:`single`,scope:`root`},"sidebar.session.row.identity":{kind:`list`,scope:`root`},"sidebar.session.row.titlePrefix":{kind:`list`,scope:`root`},"sidebar.session.row.leading":{kind:`list`,scope:`root`},"sidebar.session.row.hover":{kind:`list`,scope:`root`}},store:s,inject:Se,locale:xx},kb)),e.slots.inject(`sidebar.workspaces.session.menu.item`,function*(){yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`pin`,order:100,locale:xx,inject:A},nx),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`move-to-section`,order:150,locale:xx,inject:se},Ub),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`remove-from-section`,order:155,locale:xx,inject:se},Wb),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`move-section-up`,order:160,locale:xx,inject:se},Gb),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`move-section-down`,order:165,locale:xx,inject:se},Kb),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`rename`,order:200,locale:xx,inject:ye},ix),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`mark-as-unread`,order:250,locale:xx,inject:me},Zb),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`mark-children-as-read`,order:260,locale:xx},Qb),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`fork`,order:300,locale:xx,inject:he},Xb),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`copy-session-link`,order:350,locale:xx,inject:ve},$b),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`copy-working-directory`,order:360,locale:xx,inject:_e},ex),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`archive`,order:400,locale:xx,inject:j},jb),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`delete`,order:500,locale:xx,inject:fe},Rb)}),e.slots.inject(`sidebar.workspaces.session.row.action`,function*(){yield e.slots.register({name:`sidebar.workspaces.session.row.action`,id:`archive`,order:100,locale:xx,inject:j},Mb),yield e.slots.register({name:`sidebar.workspaces.session.row.action`,id:`pin`,order:200,locale:xx,inject:A},rx)}),e.slots.inject(`shell.overlay`,function*(){yield e.slots.register({name:`shell.overlay`,id:`workspace.move-to-section`,locale:xx,inject:O},Jb),yield e.slots.register({name:`shell.overlay`,id:`workspace.manage-thread-section`,locale:xx,inject:k},k_),yield e.slots.register({name:`shell.overlay`,id:`workspace.session-rename`,locale:xx,inject:be},ax),yield e.slots.register({name:`shell.overlay`,id:`workspace.session-archive`,locale:xx,inject:M},Nb),yield e.slots.register({name:`shell.overlay`,id:`workspace.archive-children`,locale:xx,inject:de},Ib),yield e.slots.register({name:`shell.overlay`,id:`workspace.delete-session`,locale:xx,inject:pe},zb),yield e.slots.register({name:`shell.overlay`,id:`workspace.row-toast`,locale:xx,store:s,inject:xe},cx)}),e.slots.inject(`conversation.hero.workspace`,()=>e.slots.register({name:`conversation.hero.workspace`,children:{"conversation.hero.workspace.directoryFlow":{kind:`single`,scope:`root`}},inject:N,locale:xx},pb))}function wx(e){if(!(e instanceof Error)||e.name!==`WorkspaceArchiveError`)return;let{rpcError:t}=e;return t.code===`workspace/session-active`?t.details.activity:void 0}return n.ReferenceSessionMenuItem=yx,n.apply=Cx,n.inject=Sx,t.exports}});
127
+ default:return sh(e)}}let Ix={"host.local":`本机`,"host.thisComputer":`此计算机`,"host.connected":`已连接`,"host.connecting":`连接中`,"host.disconnected":`未连接`,"heroPicker.location.aria":`选择工作位置:{current}`,"heroPicker.location.placeholder":`工作位置`,"heroPicker.location.empty":`无匹配位置`,"heroPicker.location.connectRemote":`连接远程主机…`,"heroPicker.location.manageRemote":`管理远程主机`,"heroPicker.project.aria":`选择项目:{current}`,"heroPicker.project.choose":`选择项目`,"heroPicker.project.noProject":`不选择项目`,"heroPicker.project.placeholder":`搜索项目`,"heroPicker.project.empty":`该位置暂无项目`,"heroPicker.project.noMatches":`无匹配项目`,"heroPicker.project.new":`新建项目`,"hostScope.allShort":`全部`,"hostScope.allHosts":`全部主机`,"hostScope.filtered":`已筛选`,"hostScope.trigger.aria":`主机与工作区范围筛选:{current}`,"hostScope.popover.aria":`主机与工作区范围筛选`,"hostScope.host.label":`选择主机`,"hostScope.scope.label":`展示范围`,"hostScope.scope.allSessions":`全部会话`,"hostScope.scope.selectedWorkspaces":`仅选定工作区`,"hostScope.selectedCount":`已选 {selected}/{total}`,"hostScope.selectAll":`全选`,"hostScope.clear":`清空`,"hostScope.reset":`重置筛选`,"hostScope.noHostWorkspaces":`该主机暂无工作区`,"hostScope.emptyWorkspaces":`当前筛选下暂无工作区`,"hostScope.emptySessions":`当前筛选下暂无会话`,"hostScope.showAll":`显示全部`,"hostScope.action.addRemoteWorkspace":`远程新增工作区`,"hostScope.action.manageRemoteHosts":`管理远程主机`,"workspace.addLocal":`添加本机工作区`,"workspace.addRemote":`远程新增工作区…`,"defaultWorkspace.failed":`无法创建默认工作区,请通过“选择工作区”选择文件夹`,"draft.workspaceRequired":`请先选择工作区`,"draft.initializationFailed":`暂时无法填入草稿,请稍后重试`,"recent.navigation":`会话标签`,"recent.expand":`展开会话标签栏`,"recent.collapse":`收起会话标签栏`,"recent.settings.title":`显示会话标签`,"recent.settings.mobile":`移动端`,"recent.settings.description":`在手机会话顶部显示可关闭的标签栏。`,"recent.settings.error":`无法在此浏览器中保存设置,已保留原设置。`,"recent.timeout.title":`自动关闭闲置标签`,"recent.timeout.off":`不自动关闭`,"recent.timeout.minutes":`{n} 分钟`,"recent.timeout.hours":`{n} 小时`,"recent.timeout.default":`{value}(默认)`,"recent.close":`关闭标签“{name}”`,"recent.closeHint":`仅关闭标签,不删除会话或停止任务`,"recent.closeFailed":`未能关闭标签,请重试。`,"recent.clear":`清空`,"recent.clearAll":`清空所有会话标签`,"recent.clearAllHint":`关闭所有标签,不删除会话或停止任务`,"recent.cache.error":`无法读取或保存会话标签。仍可在本页切换会话,刷新后标签可能丢失。`,"group.ungrouped":`最近`,"group.remoteOtherSessions":`未归类`,"session.new":`新会话`,"session.untitled":`未命名`,"session.backToList":`返回会话列表`,"shortcut.noSession":`请先选择一个会话`,"shortcut.noPicker":`目录选择器不可用`,"shortcut.directoryBusy":`正在选择或添加工作区`,"shortcut.noCompletedTurn":`当前会话没有已结束的轮次`,"shortcut.remoteForkUnsupported":`远程会话暂不支持分叉`,"shortcut.forkFailed":`无法分叉会话,请重试`,"section.workspaces":`工作区`,"section.sessions":`会话`,"section.pinned":`置顶`,"viewOptions.label":`视图选项`,"groupBy.label":`分组方式`,"groupBy.workspace":`按工作区`,"groupBy.workspaceTree":`按工作区树`,"groupBy.flat":`单列表`,"orderBy.label":`排序方式`,"orderBy.manual":`手动排序`,"orderBy.updated":`最近更新`,"filterBy.label":`筛选会话`,"viewOptions.hideArchived":`隐藏已归档`,"viewOptions.showArchived":`全部对话(显示已归档)`,"viewOptions.onlyArchived":`仅显示已归档`,"sessions.expand":`展开显示`,"sessions.collapse":`收起`,"sessions.loading":`正在加载历史会话…`,"sessions.expandMore":`展开显示`,"sessions.searchWorkspaceHistory":`查找更早的会话`,"sessions.continueWorkspaceHistory":`继续查找更早的会话`,"sessions.retryWorkspaceHistory":`重试查找更早的会话`,"sessions.retry":`重试`,"sessions.notLoaded":`已加载的会话中暂无匹配项,可按需加载更早会话`,"workspaces.expand":`展开显示`,"empty.none":`暂无会话`,"empty.noneArchived":`暂无已归档会话`,"empty.viewOthers":`查看其他会话`,"empty.noMatches":`无匹配结果`,"workspace.add":`添加工作区`,"search.sessions.aria":`搜索会话`,"activityView.label":`活动视图`,"activityView.unreadCount.one":`· {n} 条未读`,"activityView.unreadCount.other":`· {n} 条未读`,"activityView.markAllRead":`全部已读`,"activityView.empty":`暂无未读或进行中的会话`,"activityView.backToAll":`返回全部会话`,"search.placeholder":`搜索会话名称`,"search.clear":`清除搜索`,"search.results.aria":`搜索结果`,"search.pending":`正在搜索会话历史…`,"search.noMatches":`无匹配会话`,"search.hasMore":`仅显示前 {n} 条结果,请缩小搜索范围。`,"menu.addWorkspace":`添加工作区…`,"menu.noWorkspace":`不选择工作区`,"picker.loading":`正在加载工作区…`,"picker.search":`搜索工作区`,"picker.noResults":`无匹配工作区`,"picker.clearSearch":`清除搜索`,"conflict.named":`已存在名为“{name}”的工作区。`,"folderError.title":`无法打开文件夹`,"folderError.retry":`重新选择`,rename:`重命名`,"rename.workspace.title":`重命名工作区`,"defaultHarness.title":`默认 Harness`,"defaultHarness.select":`选择默认 Harness,当前:{name}`,"defaultHarness.description":`选择「{name}」新会话默认使用的 Harness。`,"defaultHarness.global":`跟随全局`,"defaultHarness.global.desc":`不单独设置,沿用所有项目最近一次使用的 Harness`,"defaultHarness.last":`记住本项目上次所用`,"defaultHarness.last.desc":`自动沿用上一次在本项目新建会话时使用的 Harness`,"defaultHarness.manual":`固定指定 Harness`,"defaultHarness.manual.desc":`每次在本项目新建会话时,始终使用下方选定的 Harness`,"defaultHarness.choose":`选择 Harness`,"defaultHarness.loading":`正在加载可用的 Harness…`,"defaultHarness.unavailable":`{name}(当前不可用)`,"defaultHarness.loadFailed":`无法加载项目默认设置,请关闭后重试。`,"defaultHarness.saveFailed":`无法保存项目默认设置,请重试。`,"defaultHarness.save":`保存`,"rename.session.title":`重命名会话`,"field.workspaceName":`工作区名称`,"field.sessionName":`会话名称`,"delete.workspace":`删除工作区`,"delete.desc":`将把“{name}”从工作区列表中移除。文件夹与会话记录会保留,其会话将显示在“未分组”下。`,"delete.nativeProject":`将从 Codex 和 Web 的项目列表移除“{name}”。文件夹和会话记录会保留,会话将显示在“未分组”下。`,"delete.pending":`正在删除工作区…`,"menu.copySessionLink":`复制会话链接`,"menu.copyWorkingDirectory":`复制工作目录`,"toast.workingDirectoryCopied":`已复制工作目录`,"toast.workingDirectoryCopyFailed":`复制工作目录失败`,"menu.referenceSession":`引用会话`,"menu.referenceSessionFailed":`未加入草稿:编辑位置或会话已失效`,"toast.sessionLinkCopied":`已复制`,"toast.sessionLinkCopyFailed":`复制会话链接失败`,"menu.markAsUnread":`标记为未读`,"menu.markChildrenAsRead":`将子对话全部标为已读`,"menu.fork":`分叉会话`,"menu.archiveSession":`归档会话`,"menu.deleteSession":`删除会话`,"delete.session.title":`删除会话`,"delete.session.description":`确定要删除「{title}」吗?此操作无法撤销。`,"delete.session.action":`删除`,"delete.session.pending":`正在删除…`,"delete.session.runningHint":`存在正在运行的会话,删除将中断当前任务。`,"delete.session.children.title":`删除父会话`,"delete.session.children.description":`「{title}」下有 {n} 个子会话。请选择仅删除父会话,还是连同全部子会话一起删除(无法撤销)。`,"delete.session.children.parentOnly":`仅删除父会话`,"delete.session.children.include":`同时删除全部 {n} 个子会话`,"delete.session.children.partial":`父会话已删除,{n} 个子会话未能删除。`,"archive.children.title":`归档父会话`,"archive.children.description":`选择是否同时归档「{title}」下的全部子会话。`,"archive.children.parentOnly":`仅归档父会话`,"archive.children.include":`同时归档全部 {n} 个子会话`,"archive.children.partial":`父会话已归档,{n} 个子会话未归档。`,"menu.moveToSection":`移动到分区`,"menu.removeFromSection":`移回无分区`,"menu.moveSectionUp":`在分区中上移`,"menu.moveSectionDown":`在分区中下移`,"section.destination":`目标分区`,"section.unsectioned":`无分区`,"section.move":`移动`,"section.projectMoveFailed":`无法移动项目。请刷新后重试。`,"section.moving":`正在移动…`,"section.moveFailed":`无法移动会话。请刷新后重试。`,"section.targetDeletedOption":`所选分区已删除`,"section.targetDeleted":`所选目标分区已被删除,请重新选择目标分区。`,"toast.sectionMoveFailed":`移动会话未完成:{message}`,"section.create.title":`新建分区`,"section.create.action":`创建`,"section.rename.title":`重命名分区`,"section.delete.title":`删除分区`,"section.delete.action":`删除分区`,"section.delete.desc":`删除分区“{name}”?会话将移回无分区,不会被删除、归档或移出所属项目。`,"section.delete.pending":`正在删除分区…`,"section.namePlaceholder":`输入分区名称`,"field.sectionName":`分区名称`,"section.empty":`暂无会话`,"actions.section.aria":`分区“{name}”的操作`,"section.outcomeUnknown":`操作结果未知,请确认当前分区状态后再试。`,"toast.sectionSyncPending":`分区已更新,外部会话归属仍在同步。`,"menu.unarchiveSession":`取消归档`,"threadTree.style.title":`会话树的展示方式`,"threadTree.style.promptTitle":`选择会话树的展示方式`,"threadTree.style.description":`父会话收起时,如何显示子会话的状态。`,"threadTree.style.summary":`详细`,"threadTree.style.ring":`简洁`,"threadTree.style.summarySubtitle":`显示数量与状态`,"threadTree.style.ringSubtitle":`图标外圈显示状态`,"threadTree.style.hint":`可随时在“视图选项”或“设置”中修改。`,"threadTree.style.later":`稍后`,"threadTree.style.error":`无法保存样式,请重试;已保留原设置。`,"threadTree.style.samplePending":`有子会话等待批准`,"threadTree.style.sampleRunning":`有子会话正在运行`,"threadTree.style.sampleUnread":`有子会话未读完成`,"threadTree.style.sampleRead":`子会话都已读`,"threadTree.expand":`展开 {n} 个子会话`,"threadTree.collapse":`收起 {n} 个子会话`,"threadTree.children":`{n} 个子会话`,"threadTree.expandSummary":`{title},{summary},展开`,"threadTree.running":`{n} 运行中`,"threadTree.pending":`{n} 待批准`,"threadTree.completed":`{n} 未读`,"archive.confirm.thread":`正在运行的会话:{title}`,"menu.pinSession":`置顶会话`,"menu.unpinSession":`取消置顶`,"menu.pinWorkspace":`置顶工作区`,"menu.unpinWorkspace":`取消置顶工作区`,"row.archived":`已归档`,"row.pinned":`已置顶`,"toast.archivedNotOpenable":`已归档对话暂时无法查看,请取消归档后查看`,"toast.archived":`会话已归档,可`,"toast.stoppedAndArchived":`已停止并归档,可`,"archive.confirm.title":`停止并归档此会话?`,"archive.confirm.desc":`“{title}”仍有正在进行的工作。归档会先停止这些工作;之后可在侧栏筛选“全部对话(显示已归档)”中恢复会话,被停止的工作不会自动继续。`,"archive.confirm.activity":`将被停止的工作`,"archive.confirm.turn":`进行中的回合`,"archive.confirm.subagents.one":`{n} 个运行中的子智能体:{names}`,"archive.confirm.subagents.other":`{n} 个运行中的子智能体:{names}`,"archive.confirm.jobs.one":`{n} 个后台任务:{names}`,"archive.confirm.jobs.other":`{n} 个后台任务:{names}`,"archive.confirm.schedules.one":`{n} 条定时提醒:{names}`,"archive.confirm.schedules.other":`{n} 条定时提醒:{names}`,"archive.confirm.other.one":`{n} 项其他工作({kind})`,"archive.confirm.other.other":`{n} 项其他工作({kind})`,"archive.confirm.listSeparator":`、`,"archive.confirm.action":`停止并归档`,"archive.confirm.pending":`正在停止并归档…`,"toast.archivedUndo":`撤销`,"toast.archivedOr":`或`,"toast.archivedFilter":`筛选已归档会话`,"toast.archiveFailed":`归档未确认,请检查会话状态:{message}`,"toast.unarchiveFailed":`取消归档未确认,请刷新后检查:{message}`,"toast.deleted":`会话已删除`,"toast.deleteFailed":`删除失败:{message}`,"toast.pinFailed":`置顶未确认,请刷新后检查:{message}`,"toast.unpinFailed":`取消置顶未确认,请刷新后检查:{message}`,"toast.createFailed":`新建会话失败:{message}`,"toast.forkFailed":`分叉未完成:{message}`,"sessions.count.one":`{n} 个会话`,"sessions.count.other":`{n} 个会话`,"actions.workspace.aria":`工作区“{name}”的操作`,"actions.session.aria":`会话“{name}”的操作`,"actions.archive":`归档会话`,"actions.unarchive":`取消归档`,"actions.pin":`置顶会话`,"actions.unpin":`取消置顶`,"actions.newSession":`新会话`,"actions.newSession.aria":`在“{name}”中新建会话`,"status.running":`进行中`,"status.subagentsRunning.one":`{n} 个子智能体运行中`,"status.subagentsRunning.other":`{n} 个子智能体运行中`,"status.idle":`空闲`,"status.waitingApproval":`等待审批`,"status.planReview":`计划待审`,"status.waitingAnswer":`等待回答`,"status.compact.approval":`待审批`,"status.compact.planReview":`计划待审`,"status.compact.answer":`待回答`,"status.completed":`已完成`,"hover.created":`创建于 {time}`,"hover.copied":`已复制`,"date.ymd":`{y}年{m}月{d}日`,"time.now":`刚刚`,"time.minutes":`{n}分钟`,"time.hours":`{n}小时`,"time.days":`{n}天`,"time.months":`{n}个月`,"time.years":`{n}年`,"time.ago":`{t}前`},Lx={"host.local":`Local`,"host.thisComputer":`This computer`,"host.connected":`Connected`,"host.connecting":`Connecting`,"host.disconnected":`Disconnected`,"heroPicker.location.aria":`Work location: {current}`,"heroPicker.location.placeholder":`Work location`,"heroPicker.location.empty":`No matching locations`,"heroPicker.location.connectRemote":`Connect remote host…`,"heroPicker.location.manageRemote":`Manage remote hosts`,"heroPicker.project.aria":`Project: {current}`,"heroPicker.project.choose":`Choose project`,"heroPicker.project.noProject":`No project`,"heroPicker.project.placeholder":`Search projects`,"heroPicker.project.empty":`No projects on this host`,"heroPicker.project.noMatches":`No matching projects`,"heroPicker.project.new":`New project`,"hostScope.allShort":`All`,"hostScope.allHosts":`All hosts`,"hostScope.filtered":`Filtered`,"hostScope.trigger.aria":`Filter host and workspace scope: {current}`,"hostScope.popover.aria":`Host and workspace scope filter`,"hostScope.host.label":`Host`,"hostScope.scope.label":`Display scope`,"hostScope.scope.allSessions":`All sessions`,"hostScope.scope.selectedWorkspaces":`Selected workspaces`,"hostScope.selectedCount":`{selected}/{total} selected`,"hostScope.selectAll":`Select all`,"hostScope.clear":`Clear`,"hostScope.reset":`Reset`,"hostScope.noHostWorkspaces":`No workspaces on this host`,"hostScope.emptyWorkspaces":`No workspaces match the current filter`,"hostScope.emptySessions":`No sessions match the current filter`,"hostScope.showAll":`Show all`,"hostScope.action.addRemoteWorkspace":`Add remote workspace`,"hostScope.action.manageRemoteHosts":`Manage remote hosts`,"workspace.addLocal":`Add local workspace`,"workspace.addRemote":`Add remote workspace…`,"defaultWorkspace.failed":`Unable to create default workspace. Use Choose workspace to select a folder.`,"draft.workspaceRequired":`Choose a workspace first.`,"draft.initializationFailed":`Could not fill the draft. Please try again shortly.`,"recent.navigation":`Session tabs`,"recent.expand":`Expand session tabs`,"recent.collapse":`Collapse session tabs`,"recent.settings.title":`Show session tabs`,"recent.settings.mobile":`Mobile`,"recent.settings.description":`Show closable tabs above phone conversations.`,"recent.settings.error":`Could not save in this browser. The previous setting is unchanged.`,"recent.timeout.title":`Automatically close idle tabs`,"recent.timeout.off":`Never`,"recent.timeout.minutes":`{n} minutes`,"recent.timeout.hours":`{n} hours`,"recent.timeout.default":`{value} (default)`,"recent.close":`Close tab “{name}”`,"recent.closeHint":`Close only this tab, without deleting the session or stopping tasks`,"recent.closeFailed":`Could not close the tab. Please try again.`,"recent.clear":`Clear`,"recent.clearAll":`Clear all session tabs`,"recent.clearAllHint":`Close all tabs without deleting sessions or stopping tasks`,"recent.cache.error":`Could not read or save session tabs. Switching still works in this page; tabs may be lost on reload.`,"group.ungrouped":`Recents`,"group.remoteOtherSessions":`Uncategorized`,"session.new":`New Session`,"session.untitled":`Untitled`,"session.backToList":`Back to session list`,"shortcut.noSession":`Select a session first`,"shortcut.noPicker":`Directory picker unavailable`,"shortcut.directoryBusy":`Selecting or adding a workspace`,"shortcut.noCompletedTurn":`This session has no completed turn`,"shortcut.remoteForkUnsupported":`Remote sessions cannot be forked`,"shortcut.forkFailed":`Could not fork the session. Try again.`,"section.workspaces":`Workspaces`,"section.sessions":`Sessions`,"section.pinned":`Pinned`,"viewOptions.label":`View options`,"groupBy.label":`Group by`,"groupBy.workspace":`WorkSpace`,"groupBy.workspaceTree":`Workspace Tree`,"groupBy.flat":`In one list`,"orderBy.label":`Order by`,"orderBy.manual":`Manual`,"orderBy.updated":`Last updated`,"filterBy.label":`Filter sessions`,"viewOptions.hideArchived":`Hide archived`,"viewOptions.showArchived":`All conversations (show archived)`,"viewOptions.onlyArchived":`Archived only`,"sessions.expand":`Show {n} more`,"sessions.collapse":`Show less`,"sessions.loading":`Loading conversation history…`,"sessions.expandMore":`Show more`,"sessions.searchWorkspaceHistory":`Find older conversations`,"sessions.continueWorkspaceHistory":`Keep looking for older conversations`,"sessions.retryWorkspaceHistory":`Retry finding older conversations`,"sessions.retry":`Retry`,"sessions.notLoaded":`No matching loaded conversations. Older conversations can be loaded on demand.`,"workspaces.expand":`Show all workspaces`,"empty.none":`No sessions yet`,"empty.noneArchived":`No archived sessions yet`,"empty.viewOthers":`View other sessions`,"empty.noMatches":`No matches`,"workspace.add":`Add workspace`,"search.sessions.aria":`Search sessions`,"activityView.label":`Activity view`,"activityView.unreadCount.one":`· {n} unread`,"activityView.unreadCount.other":`· {n} unread`,"activityView.markAllRead":`Mark all read`,"activityView.empty":`No unread or active conversations`,"activityView.backToAll":`Back to all sessions`,"search.placeholder":`Search session names`,"search.clear":`Clear search`,"search.results.aria":`Search results`,"search.pending":`Searching session history…`,"search.noMatches":`No matching sessions`,"search.hasMore":`Showing the first {n} results. Narrow your search.`,"menu.addWorkspace":`Add workspace…`,"menu.noWorkspace":`No workspace`,"picker.loading":`Loading workspaces…`,"picker.search":`Search workspaces`,"picker.noResults":`No matching workspaces`,"picker.clearSearch":`Clear search`,"conflict.named":`A workspace named “{name}” already exists.`,"folderError.title":`Couldn’t open folder`,"folderError.retry":`Choose again`,rename:`Rename`,"rename.workspace.title":`Rename workspace`,"defaultHarness.title":`Default Harness`,"defaultHarness.select":`Choose default Harness, current: {name}`,"defaultHarness.description":`Choose the default Harness for new sessions in “{name}”.`,"defaultHarness.global":`Follow global`,"defaultHarness.global.desc":`Do not override; use the Harness most recently used across all projects`,"defaultHarness.last":`Remember last used in this project`,"defaultHarness.last.desc":`Reuse the Harness most recently used for a new session in this project`,"defaultHarness.manual":`Always use a specific Harness`,"defaultHarness.manual.desc":`Always use the Harness selected below for new sessions in this project`,"defaultHarness.choose":`Choose a Harness`,"defaultHarness.loading":`Loading available Harnesses…`,"defaultHarness.unavailable":`{name} (currently unavailable)`,"defaultHarness.loadFailed":`Could not load the project default. Close the dialog and try again.`,"defaultHarness.saveFailed":`Could not save the project default. Try again.`,"defaultHarness.save":`Save`,"rename.session.title":`Rename session`,"field.workspaceName":`Workspace name`,"field.sessionName":`Session name`,"delete.workspace":`Delete workspace`,"delete.desc":`This removes “{name}” from the workspace list. The folder and session logs will be kept. Its sessions will appear under Ungrouped.`,"delete.nativeProject":`This removes “{name}” from the project list in Codex and Web. Its folders and conversations are kept. The conversations appear under Ungrouped.`,"delete.pending":`Deleting workspace…`,"menu.copySessionLink":`Copy session link`,"menu.copyWorkingDirectory":`Copy working directory`,"toast.workingDirectoryCopied":`Working directory copied`,"toast.workingDirectoryCopyFailed":`Could not copy working directory`,"menu.referenceSession":`Reference session`,"menu.referenceSessionFailed":`Not added: the editing position or session is no longer available`,"toast.sessionLinkCopied":`Copied`,"toast.sessionLinkCopyFailed":`Could not copy session link`,"menu.markAsUnread":`Mark as unread`,"menu.markChildrenAsRead":`Mark all child threads as read`,"menu.fork":`Fork session`,"menu.archiveSession":`Archive session`,"menu.deleteSession":`Delete session`,"delete.session.title":`Delete session`,"delete.session.description":`Delete “{title}”? This action cannot be undone.`,"delete.session.action":`Delete`,"delete.session.pending":`Deleting…`,"delete.session.runningHint":`Active work is running and will be stopped.`,"delete.session.children.title":`Delete parent session`,"delete.session.children.description":`“{title}” has {n} child sessions. Choose whether to delete only the parent session or all child sessions as well. This cannot be undone.`,"delete.session.children.parentOnly":`Delete parent only`,"delete.session.children.include":`Also delete {n} child sessions`,"delete.session.children.partial":`Parent deleted. {n} child sessions could not be deleted.`,"archive.children.title":`Archive parent session`,"archive.children.description":`Choose whether to also archive all child sessions of “{title}”.`,"archive.children.parentOnly":`Archive parent only`,"archive.children.include":`Also archive all {n} child sessions`,"archive.children.partial":`Parent archived. {n} child sessions could not be archived.`,"menu.moveToSection":`Move to section`,"menu.removeFromSection":`Remove from section`,"menu.moveSectionUp":`Move up in section`,"menu.moveSectionDown":`Move down in section`,"section.destination":`Destination section`,"section.unsectioned":`No section`,"section.move":`Move`,"section.projectMoveFailed":`Could not move the project. Refresh and try again.`,"section.moving":`Moving…`,"section.moveFailed":`Could not move the session. Refresh and try again.`,"section.targetDeletedOption":`Selected section deleted`,"section.targetDeleted":`The selected section was deleted. Choose another destination.`,"toast.sectionMoveFailed":`Could not move session: {message}`,"section.create.title":`New section`,"section.create.action":`Create`,"section.rename.title":`Rename section`,"section.delete.title":`Delete section`,"section.delete.action":`Delete section`,"section.delete.desc":`Delete section “{name}”? Sessions will return to the unsectioned list without being deleted, archived, or moved out of their projects.`,"section.delete.pending":`Deleting section…`,"section.namePlaceholder":`Enter section name`,"field.sectionName":`Section name`,"section.empty":`No sessions`,"actions.section.aria":`Actions for section {name}`,"section.outcomeUnknown":`Operation outcome unknown. Check the current section state before retrying.`,"toast.sectionSyncPending":`Section updated. External Thread membership is still syncing.`,"menu.unarchiveSession":`Unarchive session`,"threadTree.style.title":`Session tree display`,"threadTree.style.promptTitle":`Choose how to display session trees`,"threadTree.style.description":`How a collapsed parent shows its child sessions' status.`,"threadTree.style.summary":`Detailed`,"threadTree.style.ring":`Compact`,"threadTree.style.summarySubtitle":`Count and status`,"threadTree.style.ringSubtitle":`Icon status ring`,"threadTree.style.hint":`Change this anytime in View options or Settings.`,"threadTree.style.later":`Later`,"threadTree.style.error":`Could not save the style. Previous setting kept; please retry.`,"threadTree.style.samplePending":`Child awaiting approval`,"threadTree.style.sampleRunning":`Child running`,"threadTree.style.sampleUnread":`Child finished, unread`,"threadTree.style.sampleRead":`All read`,"threadTree.expand":`Expand {n} child sessions`,"threadTree.collapse":`Collapse {n} child sessions`,"threadTree.children":`{n} child sessions`,"threadTree.expandSummary":`{title}, {summary}, expand`,"threadTree.running":`{n} running`,"threadTree.pending":`{n} needs approval`,"threadTree.completed":`{n} unread`,"archive.confirm.thread":`Running session: {title}`,"menu.pinSession":`Pin session`,"menu.unpinSession":`Unpin session`,"menu.pinWorkspace":`Pin workspace`,"menu.unpinWorkspace":`Unpin workspace`,"row.archived":`Archived`,"row.pinned":`Pinned`,"toast.archivedNotOpenable":`Archived sessions cannot be opened. Unarchive it to view.`,"toast.archived":`Session archived. You can `,"toast.stoppedAndArchived":`Session stopped and archived. You can `,"archive.confirm.title":`Stop and archive this session?`,"archive.confirm.desc":`“{title}” still has work in progress. Archiving stops it first; you can restore the session later from the “All conversations (show archived)” filter in the sidebar, and the stopped work will not resume on its own.`,"archive.confirm.activity":`Work that will be stopped`,"archive.confirm.turn":`The turn in progress`,"archive.confirm.subagents.one":`{n} running subagent: {names}`,"archive.confirm.subagents.other":`{n} running subagents: {names}`,"archive.confirm.jobs.one":`{n} background job: {names}`,"archive.confirm.jobs.other":`{n} background jobs: {names}`,"archive.confirm.schedules.one":`{n} scheduled reminder: {names}`,"archive.confirm.schedules.other":`{n} scheduled reminders: {names}`,"archive.confirm.other.one":`{n} other item of work ({kind})`,"archive.confirm.other.other":`{n} other items of work ({kind})`,"archive.confirm.listSeparator":`, `,"archive.confirm.action":`Stop and archive`,"archive.confirm.pending":`Stopping and archiving…`,"toast.archivedUndo":`undo`,"toast.archivedOr":` or `,"toast.archivedFilter":`filter archived sessions`,"toast.archiveFailed":`Archive not confirmed. Check session status: {message}`,"toast.unarchiveFailed":`Unarchive not confirmed. Refresh to check: {message}`,"toast.deleted":`Session deleted`,"toast.deleteFailed":`Delete failed: {message}`,"toast.pinFailed":`Pin not confirmed. Refresh to check: {message}`,"toast.unpinFailed":`Unpin not confirmed. Refresh to check: {message}`,"toast.createFailed":`New session failed: {message}`,"toast.forkFailed":`Fork did not complete: {message}`,"sessions.count.one":`{n} session`,"sessions.count.other":`{n} sessions`,"actions.workspace.aria":`Workspace actions for {name}`,"actions.session.aria":`Session actions for {name}`,"actions.archive":`Archive`,"actions.unarchive":`Unarchive`,"actions.pin":`Pin`,"actions.unpin":`Unpin`,"actions.newSession":`New session`,"actions.newSession.aria":`New session in {name}`,"status.running":`Running`,"status.subagentsRunning.one":`{n} subagent running`,"status.subagentsRunning.other":`{n} subagents running`,"status.idle":`Idle`,"status.waitingApproval":`Waiting for approval`,"status.planReview":`Plan awaiting review`,"status.waitingAnswer":`Waiting for answer`,"status.compact.approval":`Approval`,"status.compact.planReview":`Plan review`,"status.compact.answer":`Answer`,"status.completed":`Completed`,"hover.created":`Created {time}`,"hover.copied":`Copied`,"date.ymd":`{y}-{m}-{d}`,"time.now":`now`,"time.minutes":`{n}min`,"time.hours":`{n}h`,"time.days":`{n}d`,"time.months":`{n}mo`,"time.years":`{n}y`,"time.ago":`{t} ago`};function Rx(e,t,n=!1){let r=/* @__PURE__ */ new Map;for(let t of Object.values(e.byId)){if(n&&!zx(t))continue;let i=Fh(t,e)??(n?t.projectionValues?.archiveForkParent:null);if(!i)continue;let a=r.get(i)??[];a.push(t.id),r.set(i,a)}let i=/* @__PURE__ */ new Set([t]),a=[...r.get(t)??[]];for(let e=a.pop();e!==void 0;e=a.pop())i.has(e)||(i.add(e),a.push(...r.get(e)??[]));return i.delete(t),i}function zx(e){return e!==void 0&&!e.blank&&e.origin!==`subagent`&&e.projectionValues?.threadTreeParent!==void 0}function Bx(e,t,n){let r=[];for(let i of Rx(e,t,!0)){let t=nh(i),a=e.byId[t];!n.has(t)&&a&&r.push({id:t,title:a.displayTitle})}return r}function Vx(e,t){let n=/* @__PURE__ */ new Map;for(let t of Object.values(e.byId)){let r=Fh(t,e);if(!r)continue;let i=n.get(r)??[];i.push(t.id),n.set(r,i)}let r=/* @__PURE__ */ new Set([t]),i=[],a=t=>{for(let o of n.get(t)??[]){if(r.has(o))continue;r.add(o),a(o);let t=e.byId[o];t&&i.push({id:o,title:t.displayTitle,running:t.running})}};return a(t),i}function Hx(e,t,n=Rx(e,t)){let r=[t,...n],i=/* @__PURE__ */ new Set,a=/* @__PURE__ */ new Map;for(let t=r.pop();t!==void 0;t=r.pop()){if(i.has(t))continue;i.add(t);let n=e.projectionsBySession[nh(t)]?.values.subagentCatalog??[];for(let t of n)e.byId[t.id]?.running&&a.set(t.id,{id:t.id,...t.label===void 0?{}:{label:t.label}}),r.push(t.id)}return[...a.values()]}let Ux=()=>!1,Wx=()=>()=>{};function Gx(e){let t=(0,r.usePhoneSidebar)();return t!==null&&!t.open?null:/* @__PURE__ */ (0,o.jsx)(Kx,{...e,closeDrawer:t?.close},e.sessionId)}function Kx({sessionId:e,prepareDraftReference:t,closeDrawer:n,useMenuOpenState:i,t:a}){let[c]=(0,s.useState)(()=>t(e)),l=(0,s.useSyncExternalStore)(c?.subscribe??Wx,c?.getSnapshot??Ux),u=(0,s.useRef)(!1),[d,f]=(0,s.useState)(!1),[,p]=i();return c===void 0?null:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(r.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(r.IconLinkOutlineRegular,{}),disabled:d||!l,onSelect:()=>{if(!u.current){u.current=!0;try{if(c?.insert()===!0){p(!1),n?.();return}}catch{}f(!0)}},children:a(`menu.referenceSession`)}),d&&/* @__PURE__ */ (0,o.jsx)(`div`,{role:`status`,children:a(`menu.referenceSessionFailed`)})]})}let qx=`workspace`,Jx=[`slots`,`sessions`,`uiSession`,`workspaces`,`locale`,`remote`,`remote.directoryPicker`,`remote.session`,`layout`,`shortcuts`,`configForms`];function Yx(e){let t=e.get(`sessions`),n=e.get(`workspaces`),a=Xh(),o=a.create();o.actions.setArchivedFilter(`default`),e.effect(()=>{let e=()=>{t.setIncludeArchived((o.getSnapshot().archivedFilter??`default`)!=="default")},n=o.subscribe(e);return e(),n},`ui-workspace: browser-local archive query scope`);let s={...a,create:()=>o},c=(0,i.createSnapshotStore)(null),u=0,d=e=>{c.set({...e,seq:++u})},f=new gg(e,e.remote.directoryPicker,n,t,o.actions,d,e.remote.session),p=P_(e);w_(e,f,p),e.slots.provideRoot({hooks:{workspaces:n.list}}),e.effect(()=>e.locale.register(qx,{zh:Ix,en:Lx}),`ui-workspace: dictionaries`);let m=$m(),h=async(e,n)=>{let r=await t.search(e,n);if(!r.ok)throw Error(r.error.message);return r.value},g=t=>({getSnapshot:()=>e.slots.entries(t).length>0,subscribe:n=>e.slots.subscribe(t,n)}),_=g(`sidebar.workspaces.directoryFlow`),v={getSnapshot:()=>e.remote.$host,subscribe:t=>e.on(`connection/reset`,t)},y=g(`conversation.hero.workspace.directoryFlow`),b=e=>{f.openSession(e)},x=px(n.list,e=>new Set(e.pinnedSessionIds)),S=px(n.list,e=>new Set(e.archivedSessionIds)),C=px(m.state,e=>e.renameTarget),w=(0,i.createSnapshotStore)(null),T=(0,i.createSnapshotStore)(null),E=(0,i.createSnapshotStore)(null),D=m.rename,ee=e=>{f.unarchiveSession(e).catch(e=>{d({kind:`unarchiveFailed`,message:e instanceof Error?e.message:String(e)})})},te=async(e,n)=>{let r=await t.using(e,{source:`workspaceOperation`},e=>e.binding.session.rename(n));if(!r.ok)throw Error(r.error.message)},ne=px(t.list,e=>new Set(Object.values(e.byId).filter(e=>!e.blank&&e.origin!==`subagent`&&!e.projectionValues?.remoteHost&&!!e.projectionValues?.harnessIdentity?.id).map(e=>e.id))),re=(0,i.createSnapshotStore)(null),ie=(0,i.createSnapshotStore)(null),ae=px(o,e=>e.archivedFilter??`default`),oe=Oy({execute:(e,t,r,i)=>n.moveSessionToSection?n.moveSessionToSection(e,t,r,i):Promise.reject(/* @__PURE__ */ Error(`Section moves are unavailable`)),onError:e=>{d({kind:`sectionMoveFailed`,message:e instanceof Error?e.message:String(e)})},onUnknown:()=>d({kind:`sectionMoveUnknown`})}),se=()=>({hooks:{nativeThreads:ne,sectionWorkspace:n.list,sectionSessions:t.list,scopedSessionIds:ie,archivedFilter:ae,movingSectionSessions:oe.movingSessionIds},requestMove:e=>re.set(e),moveSession:e=>oe.move(e)}),O=()=>({hooks:{threadSectionMove:re,sectionWorkspace:n.list,movingSectionSessions:oe.movingSessionIds},dismiss:()=>re.set(null),move:e=>oe.move(e,{notifyOnError:!1})}),k=(0,i.createSnapshotStore)(null),ce=()=>({hooks:{threadSectionManage:k},dismiss:()=>k.set(null),createSection:async e=>{if(!n.createThreadSection)throw Error(`Section management is unavailable`);return n.createThreadSection(e)},updateSection:async(e,t)=>{if(!n.updateThreadSection)throw Error(`Section management is unavailable`);return n.updateThreadSection(e,t)},deleteSection:async e=>{if(!n.deleteThreadSection)throw Error(`Section management is unavailable`);return n.deleteThreadSection(e)},notifySyncPending:()=>d({kind:`sectionSyncPending`})}),le=()=>({hooks:{pinned:x,archived:S},pinSession:e=>{f.pinSession(e).catch(e=>{d({kind:`pinFailed`,message:e instanceof Error?e.message:String(e)})})},unpinSession:e=>{f.unpinSession(e).catch(e=>{d({kind:`unpinFailed`,message:e instanceof Error?e.message:String(e)})})}}),ue=async(e,r,i=!1)=>{await f.archiveSession(e,{stopActivity:i});let a=0;for(let e of r)if(!n.list.getSnapshot().archivedSessionIds.includes(e))try{let n=t.list.getSnapshot();if(n.byId[e]?.running||Hx(n,e,[]).length)throw Error(`Child Session is active`);await f.archiveSession(e)}catch{a++}d({kind:i?`stoppedAndArchived`:`archived`,sessionId:e,failedChildren:a})},de=(e,n)=>{let r=t.list.getSnapshot(),i=r.byId[e],a=i?.displayTitle??e,o=Hx(r,e,[]);i?.running||o.length>0?w.set({sessionId:e,displayTitle:a,children:n,activity:o.length?[{kind:`subagent`,items:o}]:[],...i?.running?{runningThreads:[{id:e,title:a}]}:{}}):ue(e,n).catch(t=>{let r=Xx(t);r===void 0?d({kind:`archiveFailed`,message:t instanceof Error?t.message:String(t)}):w.set({sessionId:e,displayTitle:a,activity:r,children:n})})},A=()=>({hooks:{archived:S},archiveSession:e=>{let n=t.list.getSnapshot(),r=Bx(n,e,S.getSnapshot());r.length?T.set({sessionId:e,title:n.byId[e]?.displayTitle??e,children:r}):de(e,[])},unarchiveSession:ee});eh(e,f,m,A().archiveSession);let fe=()=>({hooks:{archiveChildrenRequest:T},dismiss:()=>T.set(null),choose(e,t){T.getSnapshot()===e&&(T.set(null),de(e.sessionId,t?e.children.map(({id:e})=>e):[]))}}),j=()=>({hooks:{archiveRequest:w},settleSessionArchive:()=>{w.set(null)},stopAndArchiveSession:(e,t=[])=>ue(e,t,!0)}),pe=()=>({requestSessionDelete:e=>{let n=t.list.getSnapshot(),r=n.byId[e];E.set({sessionId:e,title:r?.displayTitle??e,running:r?.running===!0,children:Vx(n,e)})}}),me=()=>({hooks:{deleteRequest:E},dismiss:()=>{E.set(null)},deleteSession:async(e,t)=>{let n=0;if(t)for(let t of e.children)try{await f.deleteSession(t.id)}catch{n++}await f.deleteSession(e.sessionId),d({kind:`deleted`,...n>0?{failedChildren:n}:{}})}}),he=()=>({hooks:{archived:S},markCompletionUnread:t=>e.uiSession.markCompletionUnread(t)}),ge=()=>({forkSession:t=>{f.forkSession(t,n=>{e.get(`productAnalytics`)?.track(`branch_session_click`,{session_id:n,parent_session_id:t,click_position:`sidebar`})}).then(e=>f.openSession(e)).catch(e=>{d({kind:`forkFailed`,message:e instanceof Error?e.message:String(e)})})}}),_e=e=>{e.trim()!==``&&(0,r.writeClipboard)(e).then(e=>{d({kind:e?`workingDirectoryCopied`:`workingDirectoryCopyFailed`})})},ve=()=>({copyWorkingDirectory:_e}),ye=()=>({copySessionLink:e=>{let n=t.list.getSnapshot().byId[e],i=n===void 0?void 0:fh(n);i!==void 0&&(0,r.writeClipboard)(ph(i)).then(e=>{d({kind:e?`sessionLinkCopied`:`sessionLinkCopyFailed`})})}}),be=()=>({requestSessionRename:D}),xe=()=>({hooks:{renameRequest:C},settleSessionRename:m.closeRename,renameSession:te}),Se=()=>({hooks:{toast:c},dismissToast:()=>{c.set(null)},undoArchive:ee,showArchived:()=>{o.actions.setArchivedFilter(`show`)}}),Ce=()=>({startSession:e=>{f.startSession(e)},open:b,copyWorkingDirectory:_e,markCompletionsRead:t=>{e.get(`uiSession`)?.markCompletionsRead(t)},searchSessions:h,refreshSessions:()=>{t.refresh()},loadMoreSessions:e=>{t.loadMore(e)},searchResultLimit:t.searchResultLimit,requestSessionRename:D,notifyArchivedNotOpenable:()=>{d({kind:`archivedNotOpenable`})},setWorkspacePinned:n.setWorkspacePinned?.bind(n),moveWorkspaceToSection:n.moveWorkspaceToSection?.bind(n),renameWorkspace:async(e,t)=>{await n.rename(e,t)},deleteWorkspace:async e=>{await n.delete(e)},insertWorkspaceBefore:async(e,t)=>{await n.insertBefore(e,t)},unarchiveSession:async e=>{await f.unarchiveSession(e)},createWorkspace:e=>n.create(e),requestManageThreadSection:n.createThreadSection&&n.updateThreadSection&&n.deleteThreadSection?e=>k.set(e):void 0,moveSessionToSection:n.moveSessionToSection?e=>oe.move(e):void 0,setScopedSessionIds:e=>{ie.set(e)},requestSearch:m.search,requestAddWorkspace:m.add,closeAddWorkspace:m.closeAdd,setDirectoryBusy:m.directoryBusy,dismissForkError:m.dismissForkError,setThreadTreeCollapseStyle:e=>p.set(`threadTreeCollapseStyle`,e),hooks:{workspacePreferences:p,directoryFlow:_,hostInfo:v,workspaceShortcuts:m.state,shortcuts:e.shortcuts.catalog,nativeThreads:ne,movingSectionSessions:oe.movingSessionIds,groupRooms:f.groupRooms}}),M=()=>({createWorkspace:e=>n.create(e),hooks:{directoryFlow:y}});e.slots.inject(`sidebar.workspaces`,()=>e.slots.register({name:`sidebar.workspaces`,children:{"sidebar.workspaces.directoryFlow":{kind:`single`,scope:`root`},"sidebar.workspaces.session.menu.item":{kind:`list`,scope:`root`,inject:{hooks:{menuOpenState:l,shortcuts:e.shortcuts.catalog}}},"sidebar.workspaces.session.row.action":{kind:`list`,scope:`root`},"sidebar.workspaces.groups.section":{kind:`single`,scope:`root`},"sidebar.workspaces.groups.row":{kind:`single`,scope:`root`},"sidebar.session.row.identity":{kind:`list`,scope:`root`},"sidebar.session.row.titlePrefix":{kind:`list`,scope:`root`},"sidebar.session.row.leading":{kind:`list`,scope:`root`},"sidebar.session.row.hover":{kind:`list`,scope:`root`}},store:s,inject:Ce,locale:qx},tx)),e.slots.inject(`sidebar.workspaces.session.menu.item`,function*(){yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`pin`,order:100,locale:qx,inject:le},Ox),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`move-to-section`,order:150,locale:qx,inject:se},hx),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`remove-from-section`,order:155,locale:qx,inject:se},gx),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`move-section-up`,order:160,locale:qx,inject:se},_x),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`move-section-down`,order:165,locale:qx,inject:se},vx),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`rename`,order:200,locale:qx,inject:be},Ax),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`mark-as-unread`,order:250,locale:qx,inject:he},Cx),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`mark-children-as-read`,order:260,locale:qx},wx),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`fork`,order:300,locale:qx,inject:ge},Sx),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`copy-session-link`,order:350,locale:qx,inject:ye},Tx),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`copy-working-directory`,order:360,locale:qx,inject:ve},Ex),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`archive`,order:400,locale:qx,inject:A},rx),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`delete`,order:500,locale:qx,inject:pe},ux)}),e.slots.inject(`sidebar.workspaces.session.row.action`,function*(){yield e.slots.register({name:`sidebar.workspaces.session.row.action`,id:`archive`,order:100,locale:qx,inject:A},ix),yield e.slots.register({name:`sidebar.workspaces.session.row.action`,id:`pin`,order:200,locale:qx,inject:le},kx)}),e.slots.inject(`shell.overlay`,function*(){yield e.slots.register({name:`shell.overlay`,id:`workspace.move-to-section`,locale:qx,inject:O},bx),yield e.slots.register({name:`shell.overlay`,id:`workspace.manage-thread-section`,locale:qx,inject:ce},G_),yield e.slots.register({name:`shell.overlay`,id:`workspace.session-rename`,locale:qx,inject:xe},jx),yield e.slots.register({name:`shell.overlay`,id:`workspace.session-archive`,locale:qx,inject:j},ax),yield e.slots.register({name:`shell.overlay`,id:`workspace.archive-children`,locale:qx,inject:fe},cx),yield e.slots.register({name:`shell.overlay`,id:`workspace.delete-session`,locale:qx,inject:me},dx),yield e.slots.register({name:`shell.overlay`,id:`workspace.row-toast`,locale:qx,store:s,inject:Se},Px)}),e.slots.inject(`conversation.hero.workspace`,()=>e.slots.register({name:`conversation.hero.workspace`,children:{"conversation.hero.workspace.directoryFlow":{kind:`single`,scope:`root`}},inject:M,locale:qx},Bb))}function Xx(e){if(!(e instanceof Error)||e.name!==`WorkspaceArchiveError`)return;let{rpcError:t}=e;return t.code===`workspace/session-active`?t.details.activity:void 0}return n.ReferenceSessionMenuItem=Gx,n.apply=Yx,n.inject=Jx,t.exports}});