@codexhost/cli-win32-x64 0.32.0 → 0.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +217 -20
- package/app/console-web.js +123 -2
- package/app/desktop-controller.mjs +526 -143
- package/app/host-runtime.mjs +414 -148
- package/app/plugins/antigravity/plugin.mjs +10 -0
- package/app/plugins/claude-code/plugin.mjs +13 -0
- package/app/plugins/codebuddy/plugin.mjs +21 -2
- package/app/plugins/codex-usage/plugin.mjs +10 -0
- package/app/plugins/copilot/plugin.mjs +10 -0
- package/app/plugins/cursor-cli/plugin.mjs +10 -0
- package/app/plugins/deepseek-harness/plugin.mjs +10 -0
- package/app/plugins/devin/plugin.mjs +10 -0
- package/app/plugins/grok/plugin.mjs +10 -0
- package/app/plugins/hermes/plugin.mjs +10 -0
- package/app/plugins/kimi-code/plugin.mjs +10 -0
- package/app/plugins/kiro-cli/plugin.mjs +10 -0
- package/app/plugins/omp/plugin.mjs +10 -0
- package/app/plugins/opencode/plugin.mjs +10 -0
- package/app/plugins/pi/plugin.mjs +10 -0
- package/app/plugins/qoder/plugin.mjs +10 -0
- package/app/plugins/qoder-cn/plugin.mjs +10 -0
- package/app/plugins/qwen-code/plugin.mjs +10 -0
- package/app/plugins/workbuddy/plugin.mjs +21 -2
- package/app/plugins/zcode/plugin.mjs +10 -0
- package/app/renderer-extension.js +124 -4
- package/app/web/assets/{abnfDiagram-XWFEHMT6-CnJyN70L.js → abnfDiagram-XWFEHMT6-7XITZmBH.js} +1 -1
- package/app/web/assets/{architectureDiagram-CSQXQB3N-DH0ITYVE.js → architectureDiagram-CSQXQB3N-C8Usdzd8.js} +1 -1
- package/app/web/assets/{blockDiagram-BEDRHYPZ-WL3ZKoKg.js → blockDiagram-BEDRHYPZ-CyN9yE_Q.js} +1 -1
- package/app/web/assets/{c4Diagram-M2UUVUY5-XwSPKj5H.js → c4Diagram-M2UUVUY5-CjhY1l3g.js} +1 -1
- package/app/web/assets/{chunk-2Q5K7J3B-CKEzexjg.js → chunk-2Q5K7J3B-o24_rh4_.js} +1 -1
- package/app/web/assets/{chunk-3GCGMST5-BdEgLpab.js → chunk-3GCGMST5-D7bw3E1a.js} +1 -1
- package/app/web/assets/{chunk-5VM5RSS4-DyxL5-Ts.js → chunk-5VM5RSS4-D0v4acf7.js} +1 -1
- package/app/web/assets/{chunk-7U7NFRK5-FXLb4tYa.js → chunk-7U7NFRK5-CYJxP4rV.js} +1 -1
- package/app/web/assets/{chunk-CNRTWJTD-DcdC1OYr.js → chunk-CNRTWJTD-DTgCtcCl.js} +1 -1
- package/app/web/assets/{chunk-D5HYT7QG-BOz9vBX9.js → chunk-D5HYT7QG-qRNelehW.js} +1 -1
- package/app/web/assets/{chunk-EBZ3SEQC-Dmc_Z53x.js → chunk-EBZ3SEQC-BgJPPYdu.js} +2 -2
- package/app/web/assets/{chunk-JWPE2WC7-CrFwSwYi.js → chunk-JWPE2WC7-C50ZnSQQ.js} +1 -1
- package/app/web/assets/{chunk-KTR4FSNJ-BY3AzFaI.js → chunk-KTR4FSNJ-Cifh4XHc.js} +1 -1
- package/app/web/assets/{chunk-XXDRQBXY-CHgNy82n.js → chunk-XXDRQBXY-D23WAHPW.js} +1 -1
- package/app/web/assets/{classDiagram-v2-KXABOMEV-ClM3-y5Z.js → classDiagram-v2-KXABOMEV-B3cezFGj.js} +1 -1
- package/app/web/assets/{cose-bilkent-JH36ORCC-I7nd8GgO.js → cose-bilkent-JH36ORCC-VSMi4La2.js} +1 -1
- package/app/web/assets/{cynefin-EF2NZ3EQ-DzsXmyBH.js → cynefin-EF2NZ3EQ-qQnfHq16.js} +1 -1
- package/app/web/assets/{cynefinDiagram-NJNITYFG-DLHq6igy.js → cynefinDiagram-NJNITYFG-BJELApXD.js} +1 -1
- package/app/web/assets/{dagre-KIHZ2IZ3-BK991Mno.js → dagre-KIHZ2IZ3-C8B5ZMVs.js} +1 -1
- package/app/web/assets/{diagram-7YQZDPLS-C4qiWdQU.js → diagram-7YQZDPLS-HIWoNpzV.js} +1 -1
- package/app/web/assets/{diagram-QBROCOUO-C_ZyBohC.js → diagram-QBROCOUO-3_vS1jbp.js} +1 -1
- package/app/web/assets/{diagram-RJJCUUZO-C5Aezm94.js → diagram-RJJCUUZO-C_Kndn_e.js} +1 -1
- package/app/web/assets/{diagram-WERXNKYE-Ckc_umlF.js → diagram-WERXNKYE-BLWdOwya.js} +1 -1
- package/app/web/assets/{diagram-YHHI257C-BHjReoZZ.js → diagram-YHHI257C-DJeOs6eS.js} +1 -1
- package/app/web/assets/{diagram-YR4HJLHV-DVTGi_y9.js → diagram-YR4HJLHV-BKNULu-g.js} +1 -1
- package/app/web/assets/{ebnfDiagram-N527522P-getuz1AR.js → ebnfDiagram-N527522P-Bu8aReoF.js} +1 -1
- package/app/web/assets/{elk-O5DQBFGD-C7mhTIuK.js → elk-O5DQBFGD-CIp7Z0ER.js} +1 -1
- package/app/web/assets/{erDiagram-K3K3BIDK-sV-HZvUV.js → erDiagram-K3K3BIDK-BTsor1Lp.js} +1 -1
- package/app/web/assets/{flowDiagram-Z6JWZHQI-D0L4wXUs.js → flowDiagram-Z6JWZHQI-p_h5PKQr.js} +1 -1
- package/app/web/assets/{ganttDiagram-3PRQTZWP-BNt9Bjjo.js → ganttDiagram-3PRQTZWP-DKjfPPJ1.js} +1 -1
- package/app/web/assets/{gitGraphDiagram-VXDFKS5L-BABZzhHw.js → gitGraphDiagram-VXDFKS5L-RnPOf2fj.js} +1 -1
- package/app/web/assets/{grid-E2QIVN74-DLe2FQ_d.js → grid-E2QIVN74-C96GnBO1.js} +1 -1
- package/app/web/assets/{index-BLmkBEoq.js → index-CDRWzs-u.js} +67 -67
- package/app/web/assets/{infoDiagram-EZ3ZOAHP-BKDuUqcr.js → infoDiagram-EZ3ZOAHP-B68eZHsb.js} +1 -1
- package/app/web/assets/{ishikawaDiagram-S3EKX5GW-C75EGghg.js → ishikawaDiagram-S3EKX5GW-BLj7PFLt.js} +1 -1
- package/app/web/assets/{journeyDiagram-POQNLL5X-q7Obruqa.js → journeyDiagram-POQNLL5X-Bo-_In0d.js} +1 -1
- package/app/web/assets/{kanban-definition-BH5XI6FM-CzAqhFED.js → kanban-definition-BH5XI6FM-BpHvxprW.js} +1 -1
- package/app/web/assets/{mermaid.core-Bysx44LR.js → mermaid.core-COb9i2Gl.js} +4 -4
- package/app/web/assets/{mindmap-definition-WVAN44T4-Ds5rXTrF.js → mindmap-definition-WVAN44T4-DG15AlXd.js} +1 -1
- package/app/web/assets/{pegDiagram-D4NLKWP3-hmdERwtT.js → pegDiagram-D4NLKWP3-GMBk8RM6.js} +1 -1
- package/app/web/assets/{pieDiagram-36ENHN4W-DfTnyG8D.js → pieDiagram-36ENHN4W-BzeJgVnn.js} +1 -1
- package/app/web/assets/{quadrantDiagram-ZQUDMS73-CreQWjZQ.js → quadrantDiagram-ZQUDMS73-C--Kif6a.js} +1 -1
- package/app/web/assets/{railroadDiagram-JIZHGYPL-Bhc_eO9G.js → railroadDiagram-JIZHGYPL-NPLVu_R7.js} +1 -1
- package/app/web/assets/{render-VIF2ZAQL-BS1Zgk8K.js → render-VIF2ZAQL-DdpQ8E0J.js} +2 -2
- package/app/web/assets/{requirementDiagram-AXW2TVFA-Dlp7d6QT.js → requirementDiagram-AXW2TVFA-WWRwRbkA.js} +1 -1
- package/app/web/assets/{sankeyDiagram-FBCJTAIF-DGBchL30.js → sankeyDiagram-FBCJTAIF-hBr6pZ0V.js} +1 -1
- package/app/web/assets/{sequenceDiagram-3LA2ROMG-DauFg5_R.js → sequenceDiagram-3LA2ROMG-DvzZWy5J.js} +1 -1
- package/app/web/assets/{sizeCapture-2Q2CQKSF-DR-zy7an.js → sizeCapture-2Q2CQKSF-C2B86W70.js} +1 -1
- package/app/web/assets/{stateDiagram-v2-ATKHQDJO-BSRBSGUi.js → stateDiagram-v2-ATKHQDJO-Jwj3XqMx.js} +1 -1
- package/app/web/assets/{swimlanes-YQL5WMAO-BwzOr5Dv.js → swimlanes-YQL5WMAO-DxI0hC09.js} +1 -1
- package/app/web/assets/swimlanesDiagram-UCCPES4V-CR0nv8kJ.js +8 -0
- package/app/web/assets/{timeline-definition-7Z437IG3-BoZ-mNKc.js → timeline-definition-7Z437IG3-m8Ew8iuN.js} +1 -1
- package/app/web/assets/{usecaseDiagram-RDK6N6HP-DikhgH2m.js → usecaseDiagram-RDK6N6HP-BsiPSzIT.js} +1 -1
- package/app/web/assets/{vennDiagram-SHRQU5PJ-DY_oIxwl.js → vennDiagram-SHRQU5PJ-yYfXhiGp.js} +1 -1
- package/app/web/assets/{wardleyDiagram-F3OXNVQS-DrRIiB_M.js → wardleyDiagram-F3OXNVQS-DHLEfnsg.js} +1 -1
- package/app/web/assets/{xychartDiagram-GDYJKCDI-CzSPgHV7.js → xychartDiagram-GDYJKCDI-Drn_UxYt.js} +1 -1
- package/app/web/codexhost-settings.js +54 -54
- package/app/web/index.html +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
- package/app/web/plugins/deepseek-ai__dsh-client-ui-attachment/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +13 -13
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +66 -66
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +16 -16
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +8 -8
- package/app/web-modules/server.mjs +44 -7
- package/bin/codexhost.exe +0 -0
- package/libexec/codexhost-node-repl.exe +0 -0
- package/libexec/codexhost-screenshot.exe +0 -0
- package/libexec/codexhost-shell.exe +0 -0
- package/libexec/codexhost-shim.exe +0 -0
- package/libexec/codexhost-updater.exe +0 -0
- package/package.json +1 -1
- package/app/web/assets/swimlanesDiagram-UCCPES4V-CNV63-us.js +0 -8
|
@@ -110,18 +110,18 @@ function Aa(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...O(n)})}//
|
|
|
110
110
|
function ja(e,t){let n=/* @__PURE__ */ Ma(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(P(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(P(r))}},e(t.value,t)),t);return n}// @__NO_SIDE_EFFECTS__
|
|
111
111
|
function Ma(e,t){let n=new nn({check:`custom`,...O(t)});return n._zod.check=e,n}function Na(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 Pa(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??Di,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 Fa(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 Ia(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,Ia(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Na(o.schema,c),t.io===`input`&&Ka(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 La(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Ra(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}/${La(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+La(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 za(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;za(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 Ba=/* @__PURE__ */ new Set([`type`,`properties`,`required`,`additionalProperties`]),Va=[`oneOf`,`anyOf`];function Ha(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Ua(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Ba.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]??Ha(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}b(n,r,e.length===1?e[0]:Ua(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=Ha(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 Wa(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Ba)if(t in e)return;let n=t.filter(e=>Va.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Ua(t);else{let e=n[0],i=Va.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=>Ua([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Na(e,r))}function Ga(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)):Na(i,s),Na(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())za(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)??[])Wa(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)}Na(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:Ja(t,`input`,e.processors),output:Ja(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Ka(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 Ka(r.element,n);if(r.type===`set`)return Ka(r.valueType,n);if(r.type===`lazy`)return Ka(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 Ka(r.innerType,n);if(r.type===`intersection`)return Ka(r.left,n)||Ka(r.right,n);if(r.type===`record`||r.type===`map`)return Ka(r.keyType,n)||Ka(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Ka(r.in,n)||Ka(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Ka(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Ka(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Ka(e,n))return!0;return!!(r.rest&&Ka(r.rest,n))}return!1}let qa=(e,t={})=>n=>{let r=Pa({...n,processors:t});return Ia(e,r),Ra(r,e),Ga(r,e)},Ja=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Pa({...i??{},target:a,io:t,processors:n});return Ia(e,o),Ra(o,e),Ga(o,e)},Ya=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Xa=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Za=(e,t)=>{Ya(e,`minimum`,t),Xa(e,`maximum`,t)},Qa=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},$a=(e,t)=>{e.patterns??=/* @__PURE__ */ new Set,e.patterns.add(t)},eo=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},to=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},no=(e,t)=>Ya(e,`minimum`,t.minimum),ro=(e,t)=>Xa(e,`maximum`,t.maximum),io=e=>(t,n)=>{to(t,n.format);let[r,i]=e[n.format];Ya(t,`minimum`,r),Xa(t,`maximum`,i)},ao={greater_than:(e,t)=>Ya(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>Xa(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Qa(e,t.value),number_format:io(de),bigint_format:io(A),min_length:no,max_length:ro,length_equals:(e,t)=>Za(e,t.length),min_size:no,max_size:ro,size_equals:(e,t)=>Za(e,t.size),string_format:(e,t)=>{to(e,t.format),t.pattern&&$a(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)=>eo(e,t.mime)};function oo(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)ao[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Ya(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Ya(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&Xa(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&Xa(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Qa(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&eo(t,i.mime);for(let e of i.patterns??[])$a(t,e);return t}let so={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},co=/* @__PURE__ */ new Map([[ar,zt],[sr,Bt]]),lo=e=>co.get(e)??e,uo=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=oo(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=so[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(lo);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}))])}},fo=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=oo(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)):Fa(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}))])}},po=(e,t,n,r)=>{n.type=`boolean`},mo=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},ho=(e,t,n,r)=>{n.not={}},go=(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)},_o=(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(Fa(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Fa(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}},vo=(e,t,n,r)=>{Fa(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},yo=(e,t,n,r)=>{Fa(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},bo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=oo(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Ia(a.element,t,{...r,path:[...r.path,`items`]})};function xo(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?xo(t.out):t.type===`catch`?xo(t.innerType):e._zod.optin}let So=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Fa(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,Ia(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`?xo(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=Ia(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Co=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Ia(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},wo=(e,t,n,r)=>{let i=e._zod.def,a=Ia(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Ia(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)},To=(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)=>Ia(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?Ia(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`?xo(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}=oo(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function Eo(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=Eo(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=>Eo(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`)?Zt:Xt).source)),p}let Do=/* @__PURE__ */ new WeakMap;function Oo(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 Do.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Eo(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 ko=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=oo(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Ia(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)b(i.patternProperties,lo(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=Ia(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Do.get(t);n||(n=[],Do.set(t,n),t.deferred.push(()=>Oo(t))),n.push(e)}i.additionalProperties=Ia(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&xo(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))}},Ao=(e,t,n,r)=>{let i=e._zod.def,a=Ia(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`}]},jo=(e,t,n,r)=>{let i=e._zod.def;Ia(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Mo=Symbol();function No(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Fa(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Mo):JSON.parse(o)}let Po=(e,t,n,r)=>{let i=e._zod.def;Ia(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=No(i.defaultValue,e,t,n,r);o!==Mo&&(n.default=o)},Fo=(e,t,n,r)=>{let i=e._zod.def;Ia(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=No(i.defaultValue,e,t,n,r);o!==Mo&&(n._prefault=o)},Io=(e,t,n,r)=>{let i=e._zod.def;Ia(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Fa(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Lo=(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;Ia(o,t,r);let s=t.seen.get(e);s.ref=o},Ro=(e,t,n,r)=>{let i=e._zod.def;Ia(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},zo=(e,t,n,r)=>{let i=e._zod.def;Ia(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Bo=(e,t,n,r)=>{let i=e._zod.innerType;Ia(i,t,r);let a=t.seen.get(e);a.ref=i},Vo=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]);function Ho(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 Uo=/*@__PURE__*/ L(`ZodError`,(e,t)=>{et.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Vo.has(n)||(Vo.add(n),Ho(n,`format`,e=>t=>rt(e,t)),Ho(n,`flatten`,e=>t=>nt(e,t)),Ho(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,f,2)}),Ho(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}),Wo=/* @__PURE__ */ at(Uo),Go=/* @__PURE__ */ ot(Uo),Ko=/* @__PURE__ */ st(Uo),qo=/* @__PURE__ */ lt(Uo),Jo=/* @__PURE__ */ ht(Uo),Yo=/* @__PURE__ */ gt(Uo),Xo=/* @__PURE__ */ _t(Uo),Zo=/* @__PURE__ */ vt(Uo),Qo=/* @__PURE__ */ yt(Uo),$o=/* @__PURE__ */ bt(Uo),es=/* @__PURE__ */ xt(Uo),ts=/* @__PURE__ */ St(Uo);function ns(){Ke.localeError||qe(Ci())}function rs(){Ke.memoizer||qe({memoizer:bi()})}let is=/*@__PURE__*/ L(`ZodType`,(e,t)=>(ns(),Cn.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(E(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 le(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Dc(e,t))},superRefine(e,t){return this.check(Oc(e,t))},overwrite(e){return this.check(/* @__PURE__ */ Sa(e))},optional(){return oc(this)},exactOptional(){return cc(this)},nullable(){return uc(this)},nullish(){return oc(uc(this))},nonoptional(e){return gc(this,e)},array(){return V(this)},or(e){return Ks([this,e])},and(e){return Xs(this,e)},transform(e){return bc(this,ic(e))},default(e){return fc(this,e)},prefault(e){return mc(this,e)},catch(e){return vc(this,e)},pipe(e){return bc(this,e)},readonly(){return Sc(this)},describe(e){let t=this.clone();return Di.add(t,{description:e}),t},meta(...e){if(e.length===0)return Di.get(this);let t=this.clone();return Di.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 je(this,`~standard`,{...En(this),jsonSchema:{input:Ja(this,`input`),output:Ja(this,`output`)}})},set"~standard"(e){Ae(this,`~standard`,e)},parse:function e(t,n){return Wo(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Go(this,t,n,{callee:e})},safeParse(e,t){return Ko(this,e,t)},async safeParseAsync(e,t){return qo(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Ae(this,`spa`,e)},validate(e,t){return ft(this,e,t)},validateAsync(e,t){return mt(this,e,t)},encode:function e(t,n){return Jo(this,t,n,{callee:e})},decode:function e(t,n){return Yo(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Xo(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Zo(this,t,n,{callee:e})},safeEncode(e,t){return Qo(this,e,t)},safeDecode(e,t){return $o(this,e,t)},async safeEncodeAsync(e,t){return es(this,e,t)},async safeDecodeAsync(e,t){return ts(this,e,t)},toJSONSchema(e){return qa(this,{})(e)},get description(){return Di.get(this)?.description},get _def(){return this._zod.def}}),as=/*@__PURE__*/ L(`_ZodString`,(e,t)=>{Dn.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r)},/*@__PURE__*/ Me({format:e=>oo(e).format??null,minLength:e=>oo(e).minimum??null,maxLength:e=>oo(e).maximum??null},{regex(...e){return this.check(/* @__PURE__ */ ga(...e))},includes(...e){return this.check(/* @__PURE__ */ ya(...e))},startsWith(...e){return this.check(/* @__PURE__ */ ba(...e))},endsWith(...e){return this.check(/* @__PURE__ */ xa(...e))},min(...e){return this.check(/* @__PURE__ */ ma(...e))},max(...e){return this.check(/* @__PURE__ */ pa(...e))},length(...e){return this.check(/* @__PURE__ */ ha(...e))},nonempty(...e){return this.check(/* @__PURE__ */ ma(1,...e))},lowercase(e){return this.check(/* @__PURE__ */ _a(e))},uppercase(e){return this.check(/* @__PURE__ */ va(e))},trim(){return this.check(/* @__PURE__ */ wa())},normalize(...e){return this.check(/* @__PURE__ */ Ca(...e))},toLowerCase(){return this.check(/* @__PURE__ */ Ta())},toUpperCase(){return this.check(/* @__PURE__ */ Ea())},slugify(){return this.check(/* @__PURE__ */ Da())}})),os=/*@__PURE__*/ L(`ZodString`,(e,t)=>{Dn.init(e,t),as.init(e,t)},{email(e){return this.check(/* @__PURE__ */ Ai(fs,e))},url(e){return this.check(/* @__PURE__ */ Ii(gs,e))},jwt(e){return this.check(/* @__PURE__ */ Zi(Ms,e))},emoji(e){return this.check(/* @__PURE__ */ Li(vs,e))},guid(e){return this.check(/* @__PURE__ */ ji(ps,e))},uuid(e){return this.check(/* @__PURE__ */ Mi(ms,e))},uuidv4(e){return this.check(/* @__PURE__ */ Ni(ms,e))},uuidv6(e){return this.check(/* @__PURE__ */ Pi(ms,e))},uuidv7(e){return this.check(/* @__PURE__ */ Fi(ms,e))},nanoid(e){return this.check(/* @__PURE__ */ Ri(ys,e))},cuid(e){return this.check(/* @__PURE__ */ zi(bs,e))},cuid2(e){return this.check(/* @__PURE__ */ Bi(xs,e))},ulid(e){return this.check(/* @__PURE__ */ Vi(Ss,e))},base64(e){return this.check(/* @__PURE__ */ Ji(ks,e))},base64url(e){return this.check(/* @__PURE__ */ Yi(As,e))},xid(e){return this.check(/* @__PURE__ */ Hi(Cs,e))},ksuid(e){return this.check(/* @__PURE__ */ Ui(ws,e))},ipv4(e){return this.check(/* @__PURE__ */ Wi(Ts,e))},ipv6(e){return this.check(/* @__PURE__ */ Gi(Es,e))},cidrv4(e){return this.check(/* @__PURE__ */ Ki(Ds,e))},cidrv6(e){return this.check(/* @__PURE__ */ qi(Os,e))},e164(e){return this.check(/* @__PURE__ */ Xi(js,e))},datetime(e){return this.check(/* @__PURE__ */ Qi(cs,e))},date(e){return this.check(/* @__PURE__ */ $i(ls,e))},time(e){return this.check(/* @__PURE__ */ ea(us,e))},duration(e){return this.check(/* @__PURE__ */ ta(ds,e))}});function R(e){return/* @__PURE__ */ ki(os,e)}let ss=/*@__PURE__*/ L(`ZodStringFormat`,(e,t)=>{On.init(e,t),as.init(e,t)}),cs=/*@__PURE__*/ L(`ZodISODateTime`,(e,t)=>{qn.init(e,t),ss.init(e,t)}),ls=/*@__PURE__*/ L(`ZodISODate`,(e,t)=>{Jn.init(e,t),ss.init(e,t)}),us=/*@__PURE__*/ L(`ZodISOTime`,(e,t)=>{Yn.init(e,t),ss.init(e,t)}),ds=/*@__PURE__*/ L(`ZodISODuration`,(e,t)=>{Xn.init(e,t),ss.init(e,t)}),fs=/*@__PURE__*/ L(`ZodEmail`,(e,t)=>{jn.init(e,t),ss.init(e,t)}),ps=/*@__PURE__*/ L(`ZodGUID`,(e,t)=>{kn.init(e,t),ss.init(e,t)}),ms=/*@__PURE__*/ L(`ZodUUID`,(e,t)=>{An.init(e,t),ss.init(e,t)});function hs(e){return/* @__PURE__ */ Mi(ms,e)}let gs=/*@__PURE__*/ L(`ZodURL`,(e,t)=>{zn.init(e,t),ss.init(e,t)});function _s(e){return/* @__PURE__ */ Ii(gs,e)}let vs=/*@__PURE__*/ L(`ZodEmoji`,(e,t)=>{Bn.init(e,t),ss.init(e,t)}),ys=/*@__PURE__*/ L(`ZodNanoID`,(e,t)=>{Vn.init(e,t),ss.init(e,t)}),bs=/*@__PURE__*/ L(`ZodCUID`,(e,t)=>{Hn.init(e,t),ss.init(e,t)}),xs=/*@__PURE__*/ L(`ZodCUID2`,(e,t)=>{Un.init(e,t),ss.init(e,t)}),Ss=/*@__PURE__*/ L(`ZodULID`,(e,t)=>{Wn.init(e,t),ss.init(e,t)}),Cs=/*@__PURE__*/ L(`ZodXID`,(e,t)=>{Gn.init(e,t),ss.init(e,t)}),ws=/*@__PURE__*/ L(`ZodKSUID`,(e,t)=>{Kn.init(e,t),ss.init(e,t)}),Ts=/*@__PURE__*/ L(`ZodIPv4`,(e,t)=>{Zn.init(e,t),ss.init(e,t)}),Es=/*@__PURE__*/ L(`ZodIPv6`,(e,t)=>{er.init(e,t),ss.init(e,t)}),Ds=/*@__PURE__*/ L(`ZodCIDRv4`,(e,t)=>{tr.init(e,t),ss.init(e,t)}),Os=/*@__PURE__*/ L(`ZodCIDRv6`,(e,t)=>{rr.init(e,t),ss.init(e,t)}),ks=/*@__PURE__*/ L(`ZodBase64`,(e,t)=>{or.init(e,t),ss.init(e,t)}),As=/*@__PURE__*/ L(`ZodBase64URL`,(e,t)=>{lr.init(e,t),ss.init(e,t)}),js=/*@__PURE__*/ L(`ZodE164`,(e,t)=>{ur.init(e,t),ss.init(e,t)}),Ms=/*@__PURE__*/ L(`ZodJWT`,(e,t)=>{fr.init(e,t),ss.init(e,t)}),Ns=/*@__PURE__*/ L(`ZodNumber`,(e,t)=>{pr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(e,t,n,r),e.isFinite=!0},/*@__PURE__*/ Me({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=oo(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=oo(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=oo(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>oo(e).format??null},{gt(e,t){return this.check(/* @__PURE__ */ ua(e,t))},gte(e,t){return this.check(/* @__PURE__ */ da(e,t))},min(e,t){return this.check(/* @__PURE__ */ da(e,t))},lt(e,t){return this.check(/* @__PURE__ */ ca(e,t))},lte(e,t){return this.check(/* @__PURE__ */ la(e,t))},max(e,t){return this.check(/* @__PURE__ */ la(e,t))},int(e){return this.check(Fs(e))},safe(e){return this.check(Fs(e))},positive(e){return this.check(/* @__PURE__ */ ua(0,e))},nonnegative(e){return this.check(/* @__PURE__ */ da(0,e))},negative(e){return this.check(/* @__PURE__ */ ca(0,e))},nonpositive(e){return this.check(/* @__PURE__ */ la(0,e))},multipleOf(e,t){return this.check(/* @__PURE__ */ fa(e,t))},step(e,t){return this.check(/* @__PURE__ */ fa(e,t))},finite(){return this}}));function z(e){return/* @__PURE__ */ na(Ns,e)}let Ps=/*@__PURE__*/ L(`ZodNumberFormat`,(e,t)=>{mr.init(e,t),Ns.init(e,t)});function Fs(e){return/* @__PURE__ */ ra(Ps,e)}let Is=/*@__PURE__*/ L(`ZodBoolean`,(e,t)=>{hr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(e,t,n,r)});function B(e){return/* @__PURE__ */ ia(Is,e)}let Ls=/*@__PURE__*/ L(`ZodNull`,(e,t)=>{gr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mo(e,t,n,r)});function Rs(e){return/* @__PURE__ */ aa(Ls,e)}let zs=/*@__PURE__*/ L(`ZodUnknown`,(e,t)=>{_r.init(e,t),is.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Bs(){return/* @__PURE__ */ oa(zs)}let Vs=/*@__PURE__*/ L(`ZodNever`,(e,t)=>{vr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r)});function Hs(e){return/* @__PURE__ */ sa(Vs,e)}let Us=/*@__PURE__*/ L(`ZodArray`,(e,t)=>{rs(),Sr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bo(e,t,n,r),e.element=t.element},{min(e,t){return this.check(/* @__PURE__ */ ma(e,t))},nonempty(e){return this.check(/* @__PURE__ */ ma(1,e))},max(e,t){return this.check(/* @__PURE__ */ pa(e,t))},length(e,t){return this.check(/* @__PURE__ */ ha(e,t))},unwrap(){return this.element}});function V(e,t){return/* @__PURE__ */ Oa(Us,e,t)}let Ws=/*@__PURE__*/ L(`ZodObject`,(e,t)=>{rs(),Or.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r),Le(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return W(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(E(this._zod.def,{catchall:e}))},passthrough(){return this.clone(E(this._zod.def,{catchall:Bs()}))},loose(){return this.clone(E(this._zod.def,{catchall:Bs()}))},strict(){return this.clone(E(this._zod.def,{catchall:Hs()}))},strip(){return this.clone(E(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 fe(this,e)},omit(e){return j(this,e)},partial(...e){return ve(ac,this,e[0])},exactPartial(...e){return ve(sc,this,e[0],`exactPartial`)},required(...e){return ye(hc,this,e[0])}});function H(e,t){let n={type:`object`,shape:e??{},...O(t)};return new Ws(n)}function U(e,t){return new Ws({type:`object`,shape:e,catchall:Hs(),...O(t)})}let Gs=/*@__PURE__*/ L(`ZodUnion`,(e,t)=>{Ar.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r),e.options=t.options});function Ks(e,t){return new Gs({type:`union`,options:e,...O(t)})}let qs=/*@__PURE__*/ L(`ZodDiscriminatedUnion`,(e,t)=>{Gs.init(e,t),Mr.init(e,t)});function Js(e,t,n){return new qs({type:`union`,options:t,discriminator:e,...O(n)})}let Ys=/*@__PURE__*/ L(`ZodIntersection`,(e,t)=>{Nr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r)});function Xs(e,t){return new Ys({type:`intersection`,left:e,right:t})}let Zs=/*@__PURE__*/ L(`ZodTuple`,(e,t)=>{rs(),Ir.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(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 ac({type:`optional`,innerType:e}))})}});function Qs(e,t,n){let r=t instanceof Cn;return new Zs({type:`tuple`,items:e,rest:r?t:null,...O(r?n:t)})}let $s=/*@__PURE__*/ L(`ZodRecord`,(e,t)=>{rs(),Br.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function ec(e,t,n){return!t||!t._zod?new $s({type:`record`,keyType:R(),valueType:e,...O(t)}):new $s({type:`record`,keyType:e,valueType:t,...O(n)})}let tc=/*@__PURE__*/ L(`ZodEnum`,(e,t)=>{Vr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(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 tc({...t,checks:[],...O(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 tc({...t,checks:[],...O(r),entries:i})}});function W(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new tc({type:`enum`,entries:n,...O(t)})}let nc=/*@__PURE__*/ L(`ZodLiteral`,(e,t)=>{Hr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_o(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 nc({type:`literal`,values:Array.isArray(e)?e:[e],...O(t)})}let rc=/*@__PURE__*/ L(`ZodTransform`,(e,t)=>{rs(),Ur.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yo(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(P(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(P(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function ic(e){return new rc({type:`transform`,transform:e})}let ac=/*@__PURE__*/ L(`ZodOptional`,(e,t)=>{Gr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function oc(e){return new ac({type:`optional`,innerType:e})}let sc=/*@__PURE__*/ L(`ZodExactOptional`,(e,t)=>{Kr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function cc(e){return new sc({type:`optional`,innerType:e})}let lc=/*@__PURE__*/ L(`ZodNullable`,(e,t)=>{qr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function uc(e){return new lc({type:`nullable`,innerType:e})}let dc=/*@__PURE__*/ L(`ZodDefault`,(e,t)=>{Jr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fc(e,t){return new dc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():se(t)}})}let pc=/*@__PURE__*/ L(`ZodPrefault`,(e,t)=>{Xr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function mc(e,t){return new pc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():se(t)}})}let hc=/*@__PURE__*/ L(`ZodNonOptional`,(e,t)=>{Zr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function gc(e,t){return new hc({type:`nonoptional`,innerType:e,...O(t)})}let _c=/*@__PURE__*/ L(`ZodCatch`,(e,t)=>{ei.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function vc(e,t){return new _c({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Re(t)})}let yc=/*@__PURE__*/ L(`ZodPipe`,(e,t)=>{ti.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.in=t.in,e.out=t.out});function bc(e,t){return new yc({type:`pipe`,in:e,out:t})}let xc=/*@__PURE__*/ L(`ZodReadonly`,(e,t)=>{ri.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ro(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Sc(e){return new xc({type:`readonly`,innerType:e})}let Cc=/*@__PURE__*/ L(`ZodLazy`,(e,t)=>{ai.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function wc(e){return new Cc({type:`lazy`,getter:e})}let Tc=/*@__PURE__*/ L(`ZodCustom`,(e,t)=>{oi.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vo(e,t,n,r)});function Ec(e,t){return/* @__PURE__ */ ka(Tc,e??(()=>!0),t)}function Dc(e,t={}){return/* @__PURE__ */ Aa(Tc,e,t)}function Oc(e,t){return/* @__PURE__ */ ja(e,t)}function kc(e){return/* @__PURE__ */ Qi(cs,e)}function Ac(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 jc=Ks([R(),z(),B(),Rs()]);function Mc(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 Nc=Ec(Mc,{message:`JSON value must not contain circular references`}),Pc=wc(()=>Ks([jc,V(Pc),ec(R(),Pc)])),Fc=Nc.pipe(Pc);Nc.pipe(V(Pc));let Ic=Nc.pipe(ec(R(),Pc)),Lc=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(Ac([`diagnostic`,`stage`,`durationMs`,`stderrTail`])),Rc=R().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u),zc=e=>R().min(1).max(e).refine(e=>e.trim().length>0),Bc=ec(Rc,H({label:zc(256).optional(),description:zc(1024).optional()}).strict()).refine(e=>Object.keys(e).length<=16,`Too many locales`),Vc=ec(Rc,zc(4096)).refine(e=>typeof e.en==`string`,`English fallback is required`).refine(e=>Object.keys(e).length<=16,`Too many locales`),Hc=R().refine(e=>e.trim().length>0,{message:`Identifier must not be empty or whitespace`}),Uc=Hc.brand(),Wc=Hc.brand(),Gc=Hc.brand();Hc.brand(),Hc.brand();let Kc=R().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),qc=Kc.max(128).regex(/^[A-Za-z0-9._~:-]+$/u,`Permission Mode ID must use transport-safe characters`).brand(),Jc=H({modes:V(H({id:qc,label:Kc.max(256),description:Kc.max(1024).optional(),dangerous:B().optional(),localizations:Bc.optional()}).strict()).min(1).max(32),defaultModeId:qc}).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:Wc,permissionModeId:qc}).strict();let Yc=R().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`});H({sourceThreadId:Wc,lastTurnId:Gc.optional(),targetHarnessId:Uc,targetModel:Yc.max(1024).optional(),targetThinkingOptionId:Yc.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).optional()}).strict();let Xc=H({sourceThreadId:Wc,sourceHarnessId:Uc,sourceHarnessLabel:Yc.max(256).optional(),sourceModel:Yc.max(1024).optional(),targetHarnessId:Uc,targetHarnessLabel:Yc.max(256).optional(),targetModel:Yc.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:Wc,handoff:Xc}).strict();let Zc=z().int().safe().nonnegative(),Qc=z().finite().nonnegative(),$c=z().finite().min(0).max(100),el=H({version:Ks([G(3),G(4)]).optional(),requestId:R().min(1),turnId:R().min(1).max(1024),outputTokens:Zc,startedAtMs:Zc,completedAtMs:Zc}).strict().refine(e=>e.completedAtMs>e.startedAtMs),tl=H({version:Ks([G(2),G(3),G(4)]).optional(),value:Qc,turnId:R().min(1).max(1024),at:Zc}).strict();H({outputTimings:V(el).transform(e=>e.filter(e=>e.version===4)).optional(),outputTokensPerSecond:tl.refine(e=>e.version===4).optional().catch(void 0),timeToFirstOutputMs:tl.extend({value:Zc}).optional()}).strict();let nl=e=>Vc.refine(t=>Object.values(t).every(t=>t.length<=e)),rl=H({composerIndicators:V(H({kind:G(`countdown`),id:R().min(1).max(64),expiresAtUnix:Zc,label:nl(256).optional(),tooltip:nl(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:Zc.optional(),cachedInputTokens:Zc.optional(),cacheWriteInputTokens:Zc.optional(),outputTokens:Zc.optional(),outputTokensPerSecond:Qc.optional(),sessionOutputTokensPerSecond:Qc.optional(),apiOutputTokensPerSecond:Qc.optional(),reasoningOutputTokens:Zc.optional(),totalTokens:Zc.optional(),totalCostUsd:Qc.optional(),totalCredits:Qc.optional(),contextUsagePercent:Qc.optional(),cacheHitRatePercent:$c.optional(),contextWindowTokens:Zc.optional(),contextUsedTokens:Zc.optional(),planFiveHourUsedPercent:$c.optional(),planFiveHourResetsAtUnix:Zc.optional(),planSevenDayUsedPercent:$c.optional(),planSevenDayResetsAtUnix:Zc.optional(),sessionCacheHitRatePercent:$c.optional(),timeToFirstOutputMs:Zc.optional(),latestRequestTimeToFirstOutputMs:Zc.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`]})}),il=z().finite().min(0).max(100),al=W([`weekly`,`monthly`,`five_hour`,`seven_day`,`unknown`]),ol=H({id:R().min(1).max(256),label:R().min(1).max(256),localizations:Bc.optional()}).strict(),sl=H({product:R().min(1),periodType:al.optional(),scope:ol.optional(),localizations:Bc.optional(),used:z().finite().nonnegative().optional(),limit:z().finite().nonnegative().optional(),unit:R().min(1).max(32).optional(),usagePercent:il,resetsAt:R().min(1).optional()}).strict(),cl=H({availableCount:z().int().safe().positive(),nextExpiresAt:R().min(1).optional(),expiresAt:V(R().min(1)).min(1).max(32).optional()}).strict(),ll=H({used:z().finite().nonnegative().optional(),limit:z().finite().nonnegative().optional(),unit:R().min(1).max(32).optional(),label:R().min(1).optional(),scope:ol.optional(),localizations:Bc.optional(),usedPercent:il,resetsAt:R().min(1).optional(),periodType:al,productUsage:V(sl).min(1).optional(),resetCredits:cl.optional()}).strict(),ul=H({amount:z().finite().nonnegative(),currency:R().trim().min(1).max(8),label:R().trim().min(1).max(128).optional()}).strict();H({threadId:Wc,refresh:G(`exact`).optional()}).strict(),H({threadId:Wc,usage:rl.nullable(),accountCredits:ll.optional(),accountBalance:ul.optional(),accountCreditsSupported:B().optional()}).strict();let dl=R().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),fl=R().min(1).max(512).refine(e=>!/\p{Cc}/u.test(e),`Model Ref must not contain control characters`).brand(),pl=W([`priority`,`ultrafast`]),ml=H({id:fl,serviceTier:pl.optional()}).strict();function hl(e,t){return e?.id===t?.id&&e?.serviceTier===t?.serviceTier}let gl=dl.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).brand(),_l=dl.max(256),vl=H({id:gl,label:dl.max(256)}).strict(),yl=H({ref:ml,label:dl.max(256),resolvedModelLabel:_l.optional(),fastModel:ml.optional(),supportedThinkingOptionIds:V(gl).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 bl(e,t){if(t)return e?.models.find(e=>hl(e.ref,t)||hl(e.fastModel,t))}let xl=V(vl).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)}),Sl=W([`catalog`,`activeModel`]),Cl=H({models:V(yl),defaultModel:ml.optional(),thinkingOptions:xl,defaultThinkingOptionId:gl.optional(),thinkingOptionsScope:Sl.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=>hl(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=>hl(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&&!bl(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`]})}),wl=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`}),Tl=W([`live`,`atCreate`]),El=H({configuration:H({selectModel:B(),selectThinkingOption:B(),selectPermissionMode:B(),permissionModeScope:Tl.default(`live`)}).strict(),history:wl,subagents:H({observe:B(),readTranscript:B()}).strict().optional(),autonomousTurns:H({observe:B()}).strict().optional(),steer:B().optional(),persistentPlan:B().optional()}).strict();H({effectiveModel:ml.optional(),resolvedModelLabel:_l.optional(),effectiveThinkingOptionId:gl.optional(),availableThinkingOptions:xl.optional(),effectivePermissionModeId:qc.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 Dl=H({open:G(!0)}).strict();Ks([H({status:G(`ready`),catalog:Cl,permissionModes:Jc.optional(),capabilities:El,webUi:Dl.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:Lc}).strict()]),H({harnessId:Uc,cwd:dl.max(16384).optional(),refresh:B().optional(),purpose:G(`availability`).optional(),credentialAccess:W([`allow`,`retry`]).optional()}).strict(),H({harnessId:Uc}).strict(),H({}).strict(),H({threadId:Wc,model:ml}).strict(),H({threadId:Wc,thinkingOptionId:gl}).strict(),H({threadId:Wc,includeReferenceCapability:B().optional()}).strict(),Js(`owner`,[H({owner:G(`codex`),locked:B(),effectiveModel:ml.optional(),resolvedModelLabel:_l.optional(),effectiveThinkingOptionId:gl.optional(),effectivePermissionModeId:qc.optional(),history:wl.optional(),supportsThreadReferences:G(!0).optional(),handoff:Xc.optional()}).strict(),H({owner:G(`external`),harnessId:dl.max(256),transportModelId:dl.max(8192),effectiveModel:ml.optional(),resolvedModelLabel:_l.optional(),effectiveThinkingOptionId:gl.optional(),availableThinkingOptions:xl.optional(),effectivePermissionModeId:qc.optional(),catalog:Cl.optional(),history:wl,usage:rl.optional(),handoff:Xc.optional(),locked:G(!0)}).strict()]),H({threadIds:V(Wc).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 Ol=Js(`owner`,[H({threadId:Wc,owner:G(`codex`)}).strict(),H({threadId:Wc,owner:G(`external`),harnessId:R().max(256).pipe(Uc)}).strict()]);H({threads:V(Ol).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:Wc,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`}),Be}}).pipe(H({expectedTurnId:Gc,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 kl=R().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u),Al=kl.pipe(Uc),jl=Al.refine(e=>e!==`codex`,`The official Codex identity is reserved`),Ml=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`),Nl=_s().refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Plugin documentation links must be credential-free HTTPS URLs`),Pl=H({en:R().max(4096),"zh-CN":R().max(4096).optional()}).strict(),Fl=H({commands:V(H({terminal:R().max(256),command:R().max(4096)}).strict()).max(8),before:Pl.optional(),after:Pl.optional(),downloads:V(H({label:R().max(128),url:Nl}).strict()).max(8).optional()}).strict(),Il={id:Al,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:Fl.optional(),notice:Pl.optional(),launchCommand:G(!0).optional(),links:H({website:Nl.optional(),documentation:Nl.optional(),installation:Nl.optional()}).strict().optional()};H({manifestVersion:G(1),...Il,adapterApiVersion:z().int().positive(),entry:Ml,icon:Ml.optional()}).strict();let Ll=R().max(174828).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u),Rl=H({...Il,icon:Ll.optional()}).strict();H({}).strict(),H({plugins:V(Rl.extend({id:jl})).max(128)}).strict(),H({version:G(1),enabled:V(Al).max(128)}).strict().refine(e=>new Set(e.enabled).size===e.enabled.length,{message:`Enabled plugin IDs must be unique`,path:[`enabled`]});let zl=131072,Bl=kl,Vl=W([`sidebar.thread-layout`,`sidebar.thread-badge`,`appearance.theme`]),Hl=W([`appearance`,`interface`,`workflow`,`analytics`,`integrations`,`tools`]),Ul=R().trim().min(1).max(128);function Wl(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 Gl=e=>e.split(`/`).every(e=>!/[. ]$/u.test(e)),Kl=Ml.refine(e=>Wl(e)!==void 0&&Gl(e),`Images must be relative .png, .jpg, .jpeg, or .webp paths with no segments ending in a dot or space`),ql=R().trim().max(2048).regex(/^https?:\/\/[^/?#\\\s]+/iu,`Expected an HTTP(S) URL`).pipe(_s({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 Jl(e){return U({en:e,"zh-CN":e})}let Yl=Jl(R().trim().min(1)),Xl=V(Hl).max(Hl.options.length).refine(e=>new Set(e).size===e.length,`Duplicate categories`),Zl=V(Vl).max(Vl.options.length).refine(e=>new Set(e).size===e.length,`Duplicate slots`),Ql={key:R().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),label:Yl,description:Yl.optional()},$l={...Ql,step:z().positive().optional(),default:z().optional()},eu=U({value:R(),label:Yl}),tu=Js(`type`,[U({...Ql,type:G(`boolean`),default:B().optional()}),U({...Ql,type:G(`string`),placeholder:Yl.optional(),default:R().optional()}),U({...$l,type:G(`number`),min:z().optional(),max:z().optional()}),U({...$l,type:G(`range`),min:z(),max:z()}),U({...Ql,type:G(`select`),options:V(eu).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`)}}),nu=H({manifestVersion:Fs().positive(),id:Bl,name:Ks([Ul,Jl(Ul)]),version:R().min(1).max(128),desktopApi:Fs().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:ql.optional(),details:U({en:R().max(16384),"zh-CN":R().max(16384).optional()}).optional(),icon:Kl.optional(),screenshots:V(Kl).max(4).refine(e=>new Set(e).size===e.length,`Duplicate screenshots`).optional(),desktop:U({script:Ml,style:Ml.optional()}).optional(),backend:U({script:Ml.refine(Gl)}).optional(),slots:Zl.default(()=>[]),settingsSchema:V(tu).max(32).refine(e=>new Set(e.map(({key:e})=>e)).size===e.length,`Duplicate setting keys`).optional(),categories:Xl.optional()}).strict().refine(e=>e.desktop!==void 0||e.backend!==void 0,`Expected at least one desktop or backend entry`),ru=R().regex(/^[a-f0-9]{64}$/u),iu=U({state:W([`running`,`disabled`,`invalid`,`incompatible`,`conflict`,`failed`,`waiting`]),hash:ru.optional(),error:R().optional(),conflictWith:Bl.optional()});U({controllerPid:Fs().positive(),targetId:R().nullable(),updatedAt:kc(),handledReloadToken:hs().optional(),extensions:ec(R(),iu),surfaces:ec(R(),iu).optional()});let au=W([`official`,`community`]);function ou(e){return e.origin===`https://api.github.com`&&/^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(e.pathname)}let su=ql.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`),cu=U({id:Bl,version:R().trim().min(1).max(128),name:Yl.extend({en:Ul,"zh-CN":Ul}),description:Jl(R().trim().min(1).max(4096)),details:Jl(R().trim().min(1).max(16384)).optional(),author:R().trim().min(1).max(128),repository:ql,stars:z().int().min(0).optional(),downloads:z().int().min(0).optional(),categories:Xl.optional(),trustTier:au.default(`community`),icon:ql.optional(),screenshots:V(ql).max(4).optional(),downloadUrl:su,sha256:ru,slots:Zl.optional(),publishedAt:R().optional(),updatedAt:R().optional(),minCodexHostVersion:R().optional()});U({schemaVersion:G(1),generatedAt:R(),extensions:V(cu).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,`Duplicate extension IDs`)});let lu=R().trim().min(1).max(128),uu=/^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³]) *(?:\.|$)/iu,du=Bl.refine(e=>!uu.test(e),`Reserved extension ID`),fu=W([`desktop`,`web`]),pu=ru,mu=hs(),hu=Ml.refine(e=>!/[\x00-\x1f\x7f<>"|*]/u.test(e)&&e.split(`/`).every(e=>!/[. ]$/u.test(e)&&!uu.test(e)),`Expected a portable relative resource path`).refine(e=>e.split(`/`).length<=32,`Extension resources may be at most 32 segments deep`),gu=nu.shape,_u=(e,t=0)=>U({en:R().trim().min(t).max(e),"zh-CN":R().trim().min(t).max(e)}),vu=e=>hu.refine(t=>t.endsWith(e),`Expected a ${e} file`),yu=vu(`.mjs`),bu=vu(`.css`).optional(),xu=e=>e.normalize(`NFC`).toLowerCase(),Su=U({manifestVersion:G(2),id:du,name:_u(128,1),version:R().trim().min(1).max(128),description:_u(4096),details:_u(16384).optional(),author:gu.author,repository:gu.repository,icon:gu.icon.refine(e=>e===void 0||hu.safeParse(e).success),screenshots:gu.screenshots.refine(e=>e===void 0||e.every(e=>hu.safeParse(e).success)),categories:gu.categories,settingsSchema:gu.settingsSchema,slots:gu.slots.removeDefault().optional(),page:U({apiVersion:G(1),entry:yu,style:bu,title:_u(128,1).optional()}).optional(),widget:U({apiVersion:G(1),entry:yu,style:bu}).optional(),desktop:U({apiVersion:G(1),script:vu(`.js`),style:bu}).optional(),web:U({apiVersion:G(1),entry:yu.optional(),style:bu}).refine(({entry:e,style:t})=>e!==void 0||t!==void 0,`Expected a Web entry or style`).optional(),backend:U({apiVersion:G(1),entry:yu}).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||xu(e)!==xu(r.entry)),{path:[`backend`,`entry`],message:`A backend entry cannot also be a frontend entry`});function Cu({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 wu=lu,Tu=W([`running`,`waiting`,`idle`,`unknown`]),Eu=U({sourceThreadId:Wc,createdAtMs:z().int().nonnegative()}),Du=U({harnessId:Uc,title:R().optional(),status:Tu,archived:B(),updatedAtMs:z().int().nonnegative().optional()}),Ou=U({revision:Fs().nonnegative(),parents:ec(Wc,Wc),handoffs:ec(Wc,Eu).optional(),nodes:ec(Wc,Du),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`),ku=R().min(1).max(128);U({});let Au=U({subscriptionId:ku});U({}),Au.extend({snapshot:Ou});let ju=Fs().nonnegative(),Mu=U({revision:ju,enabled:V(du).max(64).refine(e=>new Set(e).size===e.length,`Duplicate extension IDs`)});U({version:G(1),seeded:V(du).max(64).refine(e=>new Set(e).size===e.length,`Duplicate extension IDs`)});let Nu=H({version:R().trim().min(1).max(128),publishedAt:R().trim().min(1).max(64).optional(),notes:R().trim().min(1).max(8192),url:ql.optional()}),{downloadUrl:Pu,...Fu}=cu.shape,Iu=H({...Fu,id:du,format:G(`codexhost`),targets:V(fu).min(1).max(2).refine(e=>new Set(e).size===e.length,`Duplicate targets`),apis:U({page:Fs().positive().optional(),widget:Fs().positive().optional(),desktop:Fs().positive().optional(),web:Fs().positive().optional(),backend:Fs().positive().optional()}),downloadUrl:Pu.refine(e=>e.startsWith(`https://`),`Expected HTTPS`),featured:B().optional(),featuredOrder:Fs().nonnegative().optional(),changelog:V(Nu).max(20).optional()}).refine(({targets:e,apis:t})=>{let n=Cu({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(Iu).max(1e4).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,`Duplicate extension IDs`)}).extend({catalogUrl:ql,fetchedAt:kc(),cached:B(),stale:B().optional()});let Lu={id:du},Ru={...Lu,activationId:mu,digest:pu},zu={...Lu,activationId:Ru.activationId.optional()},Bu=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`),Vu=R().min(1).max(256).refine(e=>e.split(`/`).every(e=>e&&/^[a-z0-9_.-]+$/iu.test(e)&&e!==`.`&&e!==`..`),`Invalid GitHub ref`);function Hu(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 Uu=U({type:G(`github`),repository:R().max(150).regex(/^[a-z0-9-]+\/[a-z0-9_-][a-z0-9_.-]*$/iu),ref:Vu.optional(),tag:Vu.optional(),asset:R().max(255).regex(/^[a-z0-9_.-]+\.zip$/iu).optional(),subpath:hu.optional()}).refine(({ref:e,tag:t,asset:n})=>!e||!t&&!n,`Use either a zipball ref or a release tag/asset`),Wu=Ks([U({type:G(`catalog`),...Lu}),Uu,U({type:G(`zip`),base64:Hu(67108864).min(4)}),U({type:G(`zip`),localZipPath:Bu}),U({type:G(`localDir`),localDir:Bu})]),Gu=Js(`type`,[U({type:G(`catalog`),...Lu}),Uu,U({type:G(`zip`)}),U({type:G(`localDir`)})]),Ku=U({...Ru,manifest:Su,installedAt:kc(),source:Gu.optional()}),qu=e=>R().max(23+4*Math.ceil(e/3)).regex(/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/u),Ju={desktopConflictWith:du.optional()},Yu=W([`none`,`inactive`,`starting`,`running`,`failed`]),Xu=Js(`state`,[Ku.extend({state:G(`valid`),enabled:B(),...Ju,iconDataUrl:qu(zl).optional(),screenshotDataUrls:V(qu(524288)).max(4).optional(),backendState:Yu.optional(),backendError:R().optional()}),U({state:W([`invalid`,`incompatible`]),id:R().min(1),enabled:B(),error:R()})]);U({revision:ju,configuration:Mu,diagnostics:V(R()),extensions:V(Xu)}),U({revision:ju,extensions:V(Ku.extend({...Ju,settingsRevision:ju})).max(64)});let Zu={list:`codexhost/extensions/list`,snapshot:`codexhost/extensions/snapshot`,catalog:`codexhost/extensions/catalog`,catalogIcon:`codexhost/extensions/catalogIcon`,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`},Qu=Object.freeze(Object.values(Zu));new Set(Qu),U({});let $u={expectedRevision:ju};U({...Lu,...$u}),Ku.extend({replaced:B()}),Js(`state`,[U({state:G(`saved`),configuration:Mu}),U({state:G(`revision-conflict`),revision:ju})]),U({...zu,digest:Ru.digest.optional(),path:hu}),U({mimeType:R().min(1),base64:Hu(16777216),digest:Ru.digest}),U({mimeType:W([`image/png`,`image/jpeg`,`image/webp`]),base64:Hu(zl)}),U({settingsRevision:ju,values:Ic}),Zu.list,Zu.snapshot,Zu.catalog,U({forceRefresh:B().optional(),staleWhileRevalidate:B().optional()}),Zu.catalogIcon,U({...Lu}),Zu.install,U({source:Wu}),Zu.update,U({...Lu,expectedDigest:Ru.digest,expectedActivationId:Ru.activationId.optional(),source:Wu.optional()}),Zu.enable,Zu.disable,Zu.uninstall,U({...Lu,removeData:B().optional(),expectedDigest:Ru.digest.optional()}),U({...Lu,removed:B()}),Zu.recover,U({expectedRevision:$u.expectedRevision.optional()}),Zu.asset,Zu.settingsGet,U(zu),Zu.settingsSet,U({...zu,expectedSettingsRevision:ju,values:Ic}),Zu.backendInvoke,U({...zu,method:wu,params:Fc.optional()}),U({result:Fc}),Zu.threadTree,H({threadId:Wc}).strict(),H({confirmed:B()}).strict();let ed=[`codex-desktop`,`web`,`web-desktop-shell`,`web-mobile`,`ssh-remote`,`cli`],td=[`darwin`,`win32`,`linux`],nd=[`arm64`,`x64`,`ia32`,`arm`],rd=[`zh`,`en`,`ja`,`ko`,`de`,`fr`,`es`,`pt`,`ru`,`other`],id=[`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`],ad=[`official-relay`,`self-hosted-relay`,`tailscale-serve`,`tailscale-funnel`,`tailscale-ip`,`lan`,`custom-proxy`,`remote-peer`],od=R().min(1).max(40).regex(/^[0-9A-Za-z._+-]+$/u),sd=W(ed),cd=W(rd),ld=W(id),ud=W(ad);new Set(id),new Set(rd),H({enabled:B(),forcedOffByEnv:B()}).strict(),H({enabled:B()}).strict(),H({surfaces:V(sd).max(12).optional(),harnesses:V(ld).max(32).optional(),remoteAccess:V(ud).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:od.optional(),codexDesktopVersion:od.optional(),os:W(td).optional(),arch:W(nd).optional(),uiLanguage:cd.optional(),surfaces:V(sd).min(1).max(12).optional(),harnesses:V(ld).min(1).max(32).optional(),remoteAccess:V(ud).min(1).max(12).optional()}).strict().refine(e=>Object.keys(e).length>0,{message:`Telemetry heartbeat must contain at least one countable field`});let dd=4e3,fd={threadId:Wc};Js(`action`,[U({...fd,action:W([`get`,`pause`,`resume`,`clear`])}),U({...fd,action:W([`create`,`edit`]),objective:R().trim().min(1).refine(e=>Array.from(e).length<=dd,`A goal objective can have up to ${dd} characters.`)})]),H({goal:H({threadId:Wc,objective:R(),status:W([`active`,`paused`,`blocked`,`usageLimited`,`budgetLimited`,`complete`]),tokenBudget:Fs().positive().nullable().default(null),tokensUsed:Fs().nonnegative(),timeUsedSeconds:Fs().nonnegative()}).nullable()});let pd=R().trim().min(1),md=R().min(1),hd=H({icon:R().nullable(),color:R().nullable()}),gd=hd.nullable(),_d={create:{method:`codexhost/thread/sections/create`,params:H({name:pd}).strict()},update:{method:`codexhost/thread/sections/update`,params:H({sectionId:md,name:pd,appearance:hd.strict().nullable().optional()}).strict()},delete:{method:`codexhost/thread/sections/delete`,params:H({sectionId:md}).strict()}};Js(`status`,[H({status:G(`unknown`)}),H({status:G(`confirmed`),sectionId:md,section:H({id:md,name:R().min(1),appearance:gd}).nullable(),syncPending:B()})]),[_d.create.method,_d.update.method,_d.delete.method,...Qu],H({threadSectionsV1:G(!0).optional(),complete:G(!1).optional(),sections:V(H({id:R().min(1),name:R().min(1),appearance:gd.optional(),threads:V(Ic)}))}),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:ec(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:ec(R(),R()),projectless:V(R()),pinned:V(R()),sectionProjects:ec(R(),V(R())).optional(),pinnedProjects:V(R()).optional()});let vd=ec(R(),Bs()),yd=H({epoch:R().uuid(),sequence:z().int().nonnegative()});Js(`type`,[H({type:G(`projects-changed`),cursor:yd}),H({type:G(`skills-changed`),cursor:yd,cwd:R().optional()}),H({type:G(`harness-inspection-changed`),cursor:yd,harnessId:R().min(1)}),H({type:G(`display-settings-changed`),cursor:yd}),H({type:G(`sections-changed`),cursor:yd}),H({type:G(`preferences-changed`),cursor:yd,revision:z().int().nonnegative()}),H({type:G(`extensions-changed`),cursor:yd,revision:ju}),H({type:G(`hello`),version:G(1),cursor:yd,reset:B()}),H({type:G(`changed`),cursor:yd,threadId:R().min(1),method:R().min(1)})]);let bd=Js(`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()}))})]),xd=Js(`type`,[H({type:G(`approval`),title:R(),description:R().optional(),subject:Bs().optional(),actions:V(H({id:R(),label:R(),effect:R()}))}),H({type:G(`question`),title:R().optional(),questions:V(bd)})]),Sd=H({requestId:Ks([R(),z().int()]),threadId:R(),kind:W([`approval`,`question`]),interaction:xd,request:vd}),Cd=H({id:R().min(1),clientUserMessageId:R().min(1),input:V(vd),presentationInput:V(vd).nullable().optional()}).passthrough();H({fields:V(H({path:V(Ks([R(),z().int().nonnegative()])),originalLength:z().int().nonnegative()}))});let wd=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(),Td=H({id:R().min(1).max(512),fingerprint:R().min(1).max(128)});H({threadId:R().min(1),knownTurns:V(Td).max(64).optional(),truncateToolOutput:B().optional()});let Ed=H({harnessId:R().min(1),nativeSessionId:R().min(1)});H({cursor:yd,activeTurnId:R().min(1).nullable().optional(),command:H({name:R().min(1),turn:wd,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(),codexhostImportSource:Ed.optional(),turns:V(wd).length(0)}).passthrough(),turnsPage:H({data:V(wd).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:ml.optional(),effectiveThinkingOptionId:gl.optional(),effectivePermissionModeId:qc.optional()}),queue:H({items:V(Cd),pausedReason:W([`interrupted`,`outcome-unknown`,`failed`]).nullable()}).optional(),interactions:V(Sd),handoff:Xc.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:Ks([R(),z().int()]),result:vd}),H({includeArchived:B().optional(),officialCursor:H({live:R().nullable(),archived:R().nullable().optional()}).strict().optional(),scope:Ks([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(Ic),ownership:V(Ol),archivedThreadIds:V(Wc),officialCursor:H({live:R().nullable(),archived:R().nullable().optional()}).strict().optional()}).strict(),Rl.pick({id:!0,name:!0,icon:!0,iconStyle:!0});let Dd=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:Fs().nonnegative(),running:Fs().nonnegative(),waiting:Fs().nonnegative(),sessions:V(Dd).max(32).default([]),notifications:V(U({threadId:R().max(1024),key:R().max(4096),kind:W([`completed`,`failed`,`approval`,`question`]),revision:Fs().nonnegative()})).max(256)});let Od=R().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);H({available:B()}).strict(),H({path:R().min(1),mimeType:Od}).strict();let kd=W([`credentials-unavailable`,`login-expired`,`rate-limited`,`service-rejected`,`host-incompatible`,`network`,`timeout`,`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`]);Js(`ok`,[H({ok:G(!0),text:R()}).strict(),H({ok:G(!1),error:H({code:kd}).strict()}).strict()]),H({threadId:Wc.optional(),cwd:R().min(1).optional()}).strict().refine(e=>!(e.threadId&&e.cwd),{message:`Specify threadId or cwd, not both`});let Ad=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(Ad),warnings:V(R()).optional()}).strict(),H({cwd:R().min(1).optional()}).strict();let jd=H({kind:W([`public`,`relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`]),url:R().min(1)}).strict(),Md=Js(`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:Md,error:R().optional()}).strict();let Nd=Js(`status`,[H({status:G(`on`)}),H({status:G(`off`)}),H({status:G(`invalid`),reason:R()})]),Pd=H({lan:B(),autostart:Nd}).strict(),Fd=H({expiresAt:R().optional(),issuing:B(),failure:H({detail:R().optional(),retryAt:R(),paused:B()}).optional()}),Id=Js(`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:Fd}),H({status:G(`missing-certificate`),url:R(),certificate:Fd}),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 Ld=W([`official`,`self-hosted`]);H({secret:R().min(1),lastUsedAt:z().nullable(),networkUrls:V(jd),directCandidates:V(jd).optional(),tailscale:Md,background:Pd.optional(),relay:H({state:Id,enabled:B(),kind:Ld,officialHost:R(),customHost:R().optional(),officialHostname:R().optional(),customHostname:R().optional(),quotaUntil:R().optional()}).strict().optional()}).strict();let Rd=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()}),zd=/^[a-zA-Z0-9_-]{1,64}$/u,Bd=R().regex(zd),Vd=R().regex(zd),Hd=R().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u),Ud=W([`relay`,`tailscale`,`lan`,`custom`]),Wd=[`blue`,`purple`,`cyan`,`green`,`amber`,`rose`,`slate`],Gd=W(Wd),Kd=new Set(Wd);function qd(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return Wd[(t>>>0)%Wd.length]??Wd[0]}function Jd(e,t){return typeof t==`string`&&Kd.has(t)?t:qd(e)}let Yd=W([`connected`,`connecting`,`auth-error`,`offline`,`disabled`]),Xd=H({peerId:Bd,hostId:Hd,nodeId:Vd.optional(),name:R().min(1).max(120),color:Gd.optional(),origin:R().min(1).max(2048),transportKind:Ud,encrypted:B(),enabled:B(),state:Yd,supportsPeerPairing:B().optional(),pairedBack:B().optional(),linkedPeerIds:V(Bd).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(Xd)}),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:Gd.optional(),pairBack:B().optional(),meshPeerIds:V(Bd).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:Gd.optional(),expectedNodeId:Vd.optional()}),H({status:W([`added`,`updated`,`existing`]),peerId:Bd,hostId:Hd,nodeId:Vd.optional()});let Zd=W([`added`,`updated`,`existing`,`failed`,`skipped`]);H({results:V(H({targetPeerId:Bd,targetName:R().min(1).max(120),introducedHost:Ks([G(`local`),Bd]),introducedName:R().min(1).max(120),status:Zd,error:R().max(1e3).optional()}))}),H({peerIds:V(Bd).max(64).optional(),includeSelf:B().optional(),includeMesh:B().optional(),selfOrigin:R().min(1).max(2048).optional()}),H({peerId:Bd,name:R().trim().min(1).max(120).optional(),color:Gd.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:Bd}),H({removed:B()}),H({peerId:Bd.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 Qd=H({id:R().min(1).max(1024),name:R().min(1).max(512),path:R().min(1).max(8192)});H({ok:B(),nodeId:Vd.optional(),supportsPeerPairing:B().optional(),pairedBack:B().optional(),latencyMs:z().int().nonnegative().optional(),origin:R().max(2048).optional(),transportKind:Ud.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(Qd).optional(),error:R().max(1e3).optional()});let $d=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))}),ef=H({attachments:G(1).optional(),workspaceFiles:G(1).optional(),officePreview:G(1).optional(),delegation:G(1).optional(),peerPairing:G(1).optional()}),tf=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:Vd.optional(),peerNodes:ec(Hd,Vd).refine(e=>Object.keys(e).length<=128).optional(),projects:V($d),capabilities:ef.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(Js(`type`,[U({type:G(`text`),text:R()}),U({type:G(`file`),receiptId:R().min(1).max(128)})])).min(1).max(64)});let nf=H({ok:G(!1),error:H({code:R(),message:R(),details:ec(R(),Bs()).optional()})});Ks([H({ok:G(!0),value:H({receiptId:R().min(1),file:H({attachmentId:R(),name:R(),bytes:z().int().nonnegative()})})}),nf]),Ks([H({ok:G(!0),value:H({accepted:G(!0)})}),nf]);let rf=H({name:R().min(1).max(512),path:R().min(1).max(8192),kind:G(`directory`)});H({peerId:Bd,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(rf)}),H({peerId:Bd,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:Bd,path:R().min(1).max(8192),title:R().trim().min(1).max(255).optional()}),H({peerId:Bd,workspaceId:R().min(1).max(1024),title:R().trim().min(1).max(255)}),H({peerId:Bd,workspaceId:R().min(1).max(1024)}),H({workspaceId:R().min(1).max(1024).optional(),manifest:tf}),H({sessionHostId:R().min(1).max(128).optional()}),H({hosts:V(H({hostId:Ks([G(`local`),Hd]),name:R().min(1).max(120),isLocal:B().optional(),color:Gd.optional(),hostname:R().max(255).optional()}))}),H({hostId:Ks([G(`local`),Hd])}),H({harnesses:V(H({id:R().regex(/^[a-z0-9][a-z0-9-]*$/u),name:R().min(1).max(120)}))});let af=W([`listHarnesses`,`inspect`,`start`,`send`,`cancel`,`read`,`answer`,`list`]);U({operation:af,hopCount:z().int().min(0).max(16),sourceId:Bd.optional(),input:Ic});let of=U({code:R().min(1).max(128),message:R().max(4096),details:Ic.optional()});Ks([U({ok:G(!0),value:Fc}),U({ok:G(!1),error:of})]);let sf=U({id:R().min(1).max(1024),name:R().min(1).max(512),path:R().min(1).max(8192)});U({hosts:V(U({hostId:Hd,nodeId:Vd.optional(),displayName:R().min(1).max(120),online:B(),state:Yd,delegation:B(),projects:V(sf),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()}),Ks([U({operation:G(`hosts`)}),U({operation:af,hostId:Hd,hopCount:z().int().min(0).max(16),timeoutMs:z().int().min(1).max(12e4).optional(),input:Ic})]);let cf=H({id:R().min(1).max(256),harnessId:R().min(1),label:R().min(1).max(512),provider:W([`openai-codex`,`xai`])}).strict(),lf=R().regex(/^[a-z][a-z0-9-]{0,47}$/),uf=H({name:lf,source:cf,importedAt:R()}).strict(),df=Js(`action`,[H({action:G(`list`)}).strict(),H({action:G(`import`),sourceId:R().min(1).max(256),name:lf,confirmed:G(!0)}).strict(),H({action:G(`reimport`),sourceId:R().min(1).max(256),name:lf,confirmed:G(!0)}).strict(),H({action:G(`remove`),name:lf,confirmed:G(!0)}).strict()]),ff=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(cf),targets:V(H({harnessId:R(),providers:V(W([`openai-codex`,`xai`])),imports:V(uf),others:V(ff).default([])}).strict())}).strict(),H({targetHarnessId:R().min(1).max(128).optional(),request:df}).strict(),H({events:B()});let pf=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:pf.nullable()}),U({}),U({entries:pf,initializeOnly:B().optional()});let mf=U({enabled:B(),timeoutMinutes:z().int().min(5).max(1440)});Object.freeze({enabled:!0,timeoutMinutes:10});let hf=R().regex(/^external$/u),gf=Uc.transform(e=>String(e)),_f=U({model:ml.optional(),thinkingOptionId:gl.optional(),permissionModeId:qc.optional()}).refine(e=>!!(e.model||e.thinkingOptionId||e.permissionModeId),`A default configuration must contain a preference`);Js(`mode`,[U({mode:G(`global`)}),U({mode:G(`last`)}),U({mode:G(`manual`),harnessId:Uc})]);let vf=U({lastHarness:Uc.optional(),byHarness:ec(gf,_f)}),yf=U({model:ml.optional(),thinkingOptionId:gl.optional()}).refine(e=>!!(e.model||e.thinkingOptionId),`A delegation default must contain a Model or Thinking option`),bf=U({byHarness:ec(gf,yf)}),xf=R().min(1).max(1024),Sf=U({idleRelease:mf.optional(),favorites:ec(gf,V(xf).max(2048)).default({}),newThread:vf.optional(),delegation:bf.optional()});U({scope:hf,revision:z().int().nonnegative(),values:Sf}),U({scope:hf.default(`external`)});let Cf=Js(`kind`,[U({kind:G(`idleRelease`),value:mf}),U({kind:G(`favorite`),harnessId:Uc,modelId:xf,enabled:B()}),U({kind:G(`favorites`),harnessId:Uc,modelIds:V(xf).max(2048)}),U({kind:G(`newThread`),lastHarness:Uc.optional(),harnessId:Uc.optional(),configuration:_f.optional()}),U({kind:G(`delegation`),harnessId:Uc,configuration:yf.nullable()})]);U({scope:hf.default(`external`),operations:V(Cf).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:ec(hf,Sf)});let wf=z().finite().nonnegative(),Tf=U({input:wf,output:wf,cacheRead:wf.optional(),cacheWrite:wf.optional(),cacheWrite1h:wf.optional()}),Ef=R().max(512).refine(e=>e.trim()===e&&e.length>0,`Model ID is required`);U({path:R(),entries:V(U({key:R(),price:Tf})),error:R().nullable()}),U({}),U({key:Ef,price:Tf.nullable(),previousKey:Ef.optional()}),U({model:Ef});let Df=U({official:B().optional(),canonicalModelId:R().min(1).optional(),provider:R().min(1).max(512),model:R().min(1).max(512),price:Tf});U({price:Tf.nullable(),suggestions:V(Df).max(6).optional()});let Of=[`today`,`7d`,`30d`,`90d`,`all`],kf=z().int().min(0).max(2**53-1),Af=R().regex(/^\d{4}-\d{2}-\d{2}$/u),jf=R().min(1).max(128),Mf=R().min(1).max(512),Nf=R().min(1).max(4096);U({range:W(Of),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:jf.optional(),model:Mf.nullable().optional(),project:Nf.nullable().optional(),date:Af.optional()});let Pf=U({requests:kf,inputTokens:kf,cachedInputTokens:kf,cacheWriteInputTokens:kf,cacheKnownInputTokens:kf,cacheHitCachedInputTokens:kf,cacheHitInputTokens:kf,outputTokens:kf,reasoningOutputTokens:kf,costUsd:z().finite().min(0),unpricedRequests:kf,unmeteredRequests:kf}),Ff=Pf.shape,If=U({harness:jf,sessionId:R().min(1).max(512),project:Nf.nullable(),title:R().min(1).max(200).optional(),models:V(Mf).max(16),firstAtMs:kf,lastAtMs:kf,...Ff});U({range:W(Of),from:Af.nullable(),to:Af,filters:U({harness:jf.nullable(),model:Mf.nullable(),unknownModel:B(),project:Nf.nullable(),unknownProject:B(),date:Af.nullable()}),reading:U({complete:B(),sources:kf,read:kf}),failures:V(U({harness:jf,message:R().max(2048)})).max(256),options:U({harnesses:V(jf).max(256),models:V(Mf.nullable()).max(4096),projects:V(Nf.nullable()).max(4096)}),modelLabels:V(U({harness:jf,model:Mf,label:Mf})).max(4096).optional(),credits:V(U({harness:jf,model:Mf.nullable(),credits:z().finite().min(0),reportedRequests:kf,requests:kf})).max(4096).optional(),totals:Pf,daily:V(U({date:Af,harness:jf,...Ff})).max(2e5),hourly:V(U({weekday:z().int().min(0).max(6),hour:z().int().min(0).max(23),...Ff})).max(168),byHarness:V(U({harness:jf,...Ff})).max(256),byModel:V(U({model:Mf.nullable(),...Ff,harnessPricedRequests:kf})).max(4096),byProject:V(U({project:Nf.nullable(),...Ff})).max(4096),sessions:V(If).max(100),recentSessions:V(If).max(100).optional()}),H({threadId:Wc}),H({discarded:B()});let Lf=Js(`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()})]),Rf=H({interactionId:R().min(1),turnId:R().min(1),title:R().optional(),questions:V(Lf).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(Rf)}),U({threadId:R().min(1),turnId:R().min(1),interactionId:R().min(1),answers:ec(R(),V(R())),cancelled:B().default(!1)}),H({accepted:G(!0)});let zf=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(zf)}),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({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 Bf=W([`idle`,`running`,`busy`,`closing`,`failed`,`blocked`]),Vf=W([`none`,`disabled`,`timeout`,`operation`,`background`,`identity`,`persistence`,`closeFailed`]);U({threadId:R(),title:R(),harnessId:R(),state:Bf,reason:Vf,inactiveMs:z().nonnegative()}),U({threadId:Wc,turnId:Gc});let Hf=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:ll.optional(),balance:ul.optional()}).strict();function Uf(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 Wf=Uf(Hf),Gf={harnessId:Uc,harnessName:R().trim().min(1).max(128)},Kf=H(Gf).strict();H({}).strict(),H({sources:V(Kf).max(128)}).strict(),H({harnessId:Uc,refresh:B().optional()}).strict(),H({...Gf,account:Wf.nullable(),accounts:V(Wf).max(8).optional()}).strict(),H({refresh:B().optional()}).strict(),H({accounts:V(Uf(Hf.extend(Gf))).max(128)}).strict(),H({harnessId:jl,model:ml.optional(),thinkingOptionId:gl.optional(),permissionModeId:qc.optional(),prewarm:G(!0).optional()}).strict();let qf=R().trim().min(1).max(4096).refine(e=>!/[\u0000\r\n]/u.test(e),`Invalid entrypoint path`);H({harnessId:jl}).strict().extend({path:qf.nullable()}),H({path:qf.nullable(),restartRequired:B()}).strict(),H({harnessId:Uc,action:W([`check`,`update`,`install`]),confirmedVersion:R().min(1).max(128).optional()}).strict().refine(({action:e,confirmedVersion:t})=>e===`update`||t===void 0);let Jf=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:_s().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:Vc.optional(),latestVersionKind:W([`unknown`,`tracking-branch`]).optional()}).strict();H({taskId:R().uuid()}).strict(),Js(`status`,[H({taskId:R().uuid(),status:G(`running`)}).strict(),H({taskId:R().uuid(),status:G(`succeeded`),result:Jf}).strict(),H({taskId:R().uuid(),status:G(`failed`),error:H({code:z().int(),message:R().min(1).max(2048)}).strict()}).strict()]);let Yf=R().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u),Xf=R().trim().min(1),Zf=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`]),Qf=H({accountId:Yf,label:Xf.max(256),email:R().email().max(320).optional(),planType:Zf.optional()}).strict(),$f=W([`ready`,`unavailable`]);H({version:G(2),currentAccountId:Yf.nullable(),phase:$f,revision:z().int().nonnegative(),instanceId:Xf.max(1024).optional(),accounts:V(Qf).max(1)}).strict(),H({accountId:Yf,refresh:B().optional()}).strict(),H({accountId:Yf,usage:rl.nullable(),accountCredits:ll.optional(),freshness:W([`live`,`cached`]),observedAt:R().datetime().nullable()}).strict();let ep=1e3,tp=R().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),np=tp.max(1024),rp=H({nativeSessionId:np,title:tp.max(4096).nullable(),updatedAt:z().int().nonnegative().max(864e13),cwd:tp.max(16384),running:B().nullable()}).strict();H({}).strict(),H({harnesses:V(H({harnessId:jl,name:tp.max(128)}).strict()).max(128)}).strict(),H({harnessId:jl,query:R().trim().max(4096).refine(e=>!e.includes(`\0`)).optional(),offset:z().int().nonnegative().safe().optional(),limit:z().int().min(1).max(ep).optional()}).strict(),H({candidates:V(rp).max(ep),total:z().int().nonnegative().safe()}).strict(),H({harnessId:jl,nativeSessionId:np}).strict(),H({threadId:tp.max(1024).pipe(Wc)}).strict();let ip=R().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),ap=np,op=rp;H({}).strict(),H({candidates:V(op).max(1e3)}).strict(),H({nativeSessionId:ap}).strict(),H({threadId:ip.max(1024).pipe(Wc)}).strict(),H({threadId:Wc,lastTurnId:Gc}).strict(),H({threadId:Wc}).strict();let sp=R().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u).brand();H({commands:V(H({id:sp,invocation:R().min(1).max(128),label:R().trim().min(1).max(128),description:R().trim().min(1).max(512).optional(),localizations:Bc.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:Uc,cwd:R().min(1).optional()}).strict(),H({threadId:Wc}).strict(),H({threadId:Wc,commandId:sp,turnId:Gc.optional(),arguments:Ic.optional()}).strict(),H({accepted:G(!0),turnId:Gc.optional()}).strict();let cp=G(`2.0`).optional(),lp=Hs().optional(),up=R().min(1),dp=Ks([R(),z().int()]),fp=H({code:z().int(),message:R(),data:Fc.optional()}).catchall(Fc).superRefine(Ac([`data`]));Ks([H({jsonrpc:cp,id:dp,method:up,params:Fc.optional(),result:lp,error:lp}).catchall(Fc).superRefine(Ac([`jsonrpc`,`params`,`result`,`error`])),H({jsonrpc:cp,id:lp,method:up,params:Fc.optional(),result:lp,error:lp}).catchall(Fc).superRefine(Ac([`jsonrpc`,`id`,`params`,`result`,`error`])),H({jsonrpc:cp,id:dp,method:lp,params:lp,result:Fc,error:lp}).catchall(Fc).superRefine(Ac([`jsonrpc`,`method`,`params`,`error`])),H({jsonrpc:cp,id:dp,method:lp,params:lp,result:lp,error:fp}).catchall(Fc).superRefine(Ac([`jsonrpc`,`method`,`params`,`result`]))]);let pp=R().refine(e=>e.trim().length>0,{message:`Native identifier must not be empty or whitespace`});U({harnessId:Uc,nativeSessionId:pp,locator:Fc.optional(),formatVersion:G(1)}).superRefine(Ac([`locator`])),U({harnessId:Uc,nativeSessionId:pp,nativeTurnKey:pp,formatVersion:G(1)}),U({harnessId:Uc,nativeSessionId:pp,checkpointId:pp,locator:Fc.optional(),formatVersion:G(1)}).superRefine(Ac([`locator`]));let mp=R().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u),hp=W([`npm`,`windows-installer`,`macos-dmg`,`linux-archive`]),gp=W([`prepared`,`downloading`,`waiting-for-exit`,`installing`,`restarting`,`succeeded`,`failed`]),_p=U({completed:z().int().nonnegative(),total:z().int().positive()}).refine(e=>e.completed<=e.total,{path:[`completed`],message:`completed must not exceed total`}),vp=U({version:mp,installation:hp,phase:gp,updatedAt:z().int().nonnegative(),downloadedBytes:z().int().nonnegative().optional(),totalBytes:z().int().positive().optional(),npmDownload:_p.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 yp=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`),bp=W([`idle`,`downloading`,`ready`,`failed`]),xp=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:mp,installation:hp.nullable(),latestVersion:mp.nullable(),updateAvailable:B(),installationAvailable:B(),releaseNotes:R().min(1).max(2e4).nullable(),releaseNotesUrl:yp.nullable(),status:vp.nullable(),error:R().min(1).max(500).nullable(),stagedVersion:mp.nullable().optional(),backgroundPhase:bp.optional(),backgroundDownload:xp.nullable().optional(),backgroundError:R().min(1).max(500).nullable().optional(),runningTaskCount:z().int().nonnegative().optional()}),U({status:vp}),U({status:vp.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 Sp=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)}),Cp=U({summary:R().min(1).max(600).optional(),themes:V(Sp).min(1).max(12)}),wp=U({version:mp,publishedAt:kc(),url:R().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u),zh:Cp.nullable(),en:Cp.nullable()}).refine(e=>e.zh!==null||e.en!==null,{message:`an announcement needs at least one language`});U({manual:B().optional()}),U({announcement:wp.nullable(),unread:B()}),U({version:mp}),RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): `+`(${[`completed`,`failed`,`interrupted`,`needsInput`,`timedOut`,`unreadable`,`notFound`].join(`|`)})(?:\. (.+))?$`,`u`);let Tp=W([`idle`,`installing`,`restarting`,`succeeded`,`failed`]);H({runningVersion:R().nullable(),installedVersion:R().nullable(),restartRequired:B(),remote:B(),updateSupported:B(),update:H({phase:Tp,targetVersion:R().nullable(),error:R().nullable()})});let Ep=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 K=R().min(1).max(1024),Dp={hostId:K.regex(/^(?:remote-(?:ssh(?:-|:)|control:)|remote-peer:[a-zA-Z0-9_-]{1,64}$)/u)},Op={...Dp,threadId:K},kp=R().min(1).max(8e3),Ap={text:kp,requestId:K};Js(`accepted`,[H({accepted:G(!0),startQueuedItemId:K.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()})]),Js(`available`,[H({available:G(!1)}),H({available:G(!0),items:V(H({id:K,clientUserMessageId:K,preview:R().max(801)})).max(100)})]);let jp=Js(`kind`,[U({kind:G(`hosts`)}),U({kind:G(`create`),...Dp,cwd:R().min(1).max(8192),epoch:K}),U({kind:G(`projectHarnesses`),...Dp,epoch:K}),U({kind:G(`inspectHarness`),...Dp,epoch:K,cwd:R().min(1).max(8192),harnessId:K}),U({kind:G(`startSelected`),...Dp,epoch:K,cwd:R().min(1).max(8192),harnessId:K,model:R().min(1).max(4096),serviceTier:W([`priority`,`ultrafast`]).optional(),reasoningEffort:K.optional()}),U({kind:G(`status`),...Op}),U({kind:G(`list`),...Dp,cursor:R().nullable(),archived:B(),includeLoaded:G(!0).optional()}),U({kind:G(`read`),...Op,page:U({cursor:R().min(1).max(8192).nullable(),epoch:K.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`),...Op,epoch:K}),U({kind:G(`configure`),...Op,epoch:K,modelId:K.optional(),serviceTier:pl.optional(),thinkingOptionId:K.optional(),permissionModeId:K.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`),...Op,epoch:K,text:kp,requestId:K.optional()}),U({kind:G(`queue`),...Op,epoch:K}),U({kind:G(`delivery`),...Op,epoch:K,action:Js(`kind`,[U({kind:G(`enqueue`),...Ap}),U({kind:G(`steer`),...Ap,turnId:K}),U({kind:G(`remove`),itemId:K}),U({kind:G(`start`),itemId:K,onlyIfHead:G(!0).optional()}),U({kind:G(`sendNow`),itemId:K})])}),U({kind:G(`interrupt`),...Op,epoch:K,turnId:K}),U({kind:G(`rename`),...Op,epoch:K,name:R().min(1).max(512)}),U({kind:G(`archive`),...Op,epoch:K,archived:B()}),U({kind:G(`respond`),...Op,epoch:K,requestId:Ks([K,z().int()]),result:ec(R(),Bs())})]),Mp=R().min(1).max(1024),Np=H({hostId:Mp,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()}),Pp=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()});Js(`action`,[U({action:G(`session`),operation:jp}),U({action:G(`list`)}),U({action:G(`catalog`)}),U({action:G(`read-thread`),hostId:Mp.refine(e=>e!==`local`),input:Rd}),U({action:G(`save`),draft:Pp,previous:Np.nullable()}),U({action:G(`remove`),previous:Np}),U({action:G(`connect`),hostId:Mp,enabled:B()}),U({action:G(`state`),hostId:Mp}),U({action:G(`runtime`),hostId:Mp}),U({action:G(`update`),hostId:Mp.refine(e=>e!==`local`),version:Ep.shape.version})]),Ks([U({result:Fc}),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 Fp=R().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u),Ip=Ks([R(),H({en:R()}).catchall(R())]),Lp=H({title:Ip.optional(),description:Ip.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:Fp,name:R().min(1).max(214),version:R().min(1).max(128),format:G(`dsh`),supportedTargets:Qs([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:Lp.optional(),loadError:R().optional()})),loadedIds:V(Fp),safeMode:B(),storeError:R().optional()});let Rp=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:Rp.optional()}).strict(),H({id:Fp,enabled:B()}).strict(),H({id:Fp}).strict(),G(1);function zp(e){return e?.projectionValues?.remoteHost?.hostId}function Bp(e){return e===void 0?!1:zp(e)!==void 0||String(e.id).startsWith(`web-remote:`)}function Vp(e){if(e===void 0)return!1;let t=zp(e);return t===void 0?!String(e.id).startsWith(`web-remote:`):t.startsWith(`remote-peer:`)}function Hp(e){return e!==void 0&&!Bp(e)}function Up(e){return Vp(e)}function Wp(){let e=(0,r.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 Gp(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`)}:Hp(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 Kp(e){return e}function qp(e){return Kp(e)}let Jp={'"':`"`,"\\":`\\`,"/":`/`,b:`\b`,f:`\f`,n:`
|
|
114
|
-
`,r:`\r`,t:` `},
|
|
115
|
-
`||e===`\r`||e===` `}function
|
|
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 za(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;za(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 Ba=/* @__PURE__ */ new Set([`type`,`properties`,`required`,`additionalProperties`]),Va=[`oneOf`,`anyOf`];function Ha(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Ua(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Ba.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]??Ha(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}b(n,r,e.length===1?e[0]:Ua(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=Ha(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 Wa(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Ba)if(t in e)return;let n=t.filter(e=>Va.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Ua(t);else{let e=n[0],i=Va.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=>Ua([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Na(e,r))}function Ga(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)):Na(i,s),Na(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())za(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)??[])Wa(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)}Na(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:Ja(t,`input`,e.processors),output:Ja(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Ka(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 Ka(r.element,n);if(r.type===`set`)return Ka(r.valueType,n);if(r.type===`lazy`)return Ka(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 Ka(r.innerType,n);if(r.type===`intersection`)return Ka(r.left,n)||Ka(r.right,n);if(r.type===`record`||r.type===`map`)return Ka(r.keyType,n)||Ka(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Ka(r.in,n)||Ka(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Ka(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Ka(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Ka(e,n))return!0;return!!(r.rest&&Ka(r.rest,n))}return!1}let qa=(e,t={})=>n=>{let r=Pa({...n,processors:t});return Ia(e,r),Ra(r,e),Ga(r,e)},Ja=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Pa({...i??{},target:a,io:t,processors:n});return Ia(e,o),Ra(o,e),Ga(o,e)},Ya=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Xa=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Za=(e,t)=>{Ya(e,`minimum`,t),Xa(e,`maximum`,t)},Qa=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},$a=(e,t)=>{e.patterns??=/* @__PURE__ */ new Set,e.patterns.add(t)},eo=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},to=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},no=(e,t)=>Ya(e,`minimum`,t.minimum),ro=(e,t)=>Xa(e,`maximum`,t.maximum),io=e=>(t,n)=>{to(t,n.format);let[r,i]=e[n.format];Ya(t,`minimum`,r),Xa(t,`maximum`,i)},ao={greater_than:(e,t)=>Ya(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>Xa(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Qa(e,t.value),number_format:io(de),bigint_format:io(A),min_length:no,max_length:ro,length_equals:(e,t)=>Za(e,t.length),min_size:no,max_size:ro,size_equals:(e,t)=>Za(e,t.size),string_format:(e,t)=>{to(e,t.format),t.pattern&&$a(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)=>eo(e,t.mime)};function oo(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)ao[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Ya(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Ya(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&Xa(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&Xa(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Qa(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&eo(t,i.mime);for(let e of i.patterns??[])$a(t,e);return t}let so={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},co=/* @__PURE__ */ new Map([[ar,zt],[sr,Bt]]),lo=e=>co.get(e)??e,uo=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=oo(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=so[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(lo);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}))])}},fo=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=oo(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)):Fa(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}))])}},po=(e,t,n,r)=>{n.type=`boolean`},mo=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},ho=(e,t,n,r)=>{n.not={}},go=(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)},_o=(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(Fa(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Fa(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}},vo=(e,t,n,r)=>{Fa(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},yo=(e,t,n,r)=>{Fa(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},bo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=oo(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Ia(a.element,t,{...r,path:[...r.path,`items`]})};function xo(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?xo(t.out):t.type===`catch`?xo(t.innerType):e._zod.optin}let So=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Fa(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,Ia(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`?xo(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=Ia(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Co=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Ia(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},wo=(e,t,n,r)=>{let i=e._zod.def,a=Ia(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Ia(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)},To=(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)=>Ia(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?Ia(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`?xo(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}=oo(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function Eo(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=Eo(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=>Eo(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`)?Zt:Xt).source)),p}let Do=/* @__PURE__ */ new WeakMap;function Oo(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 Do.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Eo(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 ko=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=oo(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Ia(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)b(i.patternProperties,lo(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=Ia(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Do.get(t);n||(n=[],Do.set(t,n),t.deferred.push(()=>Oo(t))),n.push(e)}i.additionalProperties=Ia(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&xo(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))}},Ao=(e,t,n,r)=>{let i=e._zod.def,a=Ia(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`}]},jo=(e,t,n,r)=>{let i=e._zod.def;Ia(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Mo=Symbol();function No(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Fa(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Mo):JSON.parse(o)}let Po=(e,t,n,r)=>{let i=e._zod.def;Ia(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=No(i.defaultValue,e,t,n,r);o!==Mo&&(n.default=o)},Fo=(e,t,n,r)=>{let i=e._zod.def;Ia(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=No(i.defaultValue,e,t,n,r);o!==Mo&&(n._prefault=o)},Io=(e,t,n,r)=>{let i=e._zod.def;Ia(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Fa(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Lo=(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;Ia(o,t,r);let s=t.seen.get(e);s.ref=o},Ro=(e,t,n,r)=>{let i=e._zod.def;Ia(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},zo=(e,t,n,r)=>{let i=e._zod.def;Ia(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Bo=(e,t,n,r)=>{let i=e._zod.innerType;Ia(i,t,r);let a=t.seen.get(e);a.ref=i},Vo=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]);function Ho(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 Uo=/*@__PURE__*/ L(`ZodError`,(e,t)=>{et.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Vo.has(n)||(Vo.add(n),Ho(n,`format`,e=>t=>rt(e,t)),Ho(n,`flatten`,e=>t=>nt(e,t)),Ho(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,f,2)}),Ho(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}),Wo=/* @__PURE__ */ at(Uo),Go=/* @__PURE__ */ ot(Uo),Ko=/* @__PURE__ */ st(Uo),qo=/* @__PURE__ */ lt(Uo),Jo=/* @__PURE__ */ ht(Uo),Yo=/* @__PURE__ */ gt(Uo),Xo=/* @__PURE__ */ _t(Uo),Zo=/* @__PURE__ */ vt(Uo),Qo=/* @__PURE__ */ yt(Uo),$o=/* @__PURE__ */ bt(Uo),es=/* @__PURE__ */ xt(Uo),ts=/* @__PURE__ */ St(Uo);function ns(){Ke.localeError||qe(Ci())}function rs(){Ke.memoizer||qe({memoizer:bi()})}let is=/*@__PURE__*/ L(`ZodType`,(e,t)=>(ns(),Cn.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(E(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 le(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Dc(e,t))},superRefine(e,t){return this.check(Oc(e,t))},overwrite(e){return this.check(/* @__PURE__ */ Sa(e))},optional(){return oc(this)},exactOptional(){return cc(this)},nullable(){return uc(this)},nullish(){return oc(uc(this))},nonoptional(e){return gc(this,e)},array(){return V(this)},or(e){return Ks([this,e])},and(e){return Xs(this,e)},transform(e){return bc(this,ic(e))},default(e){return fc(this,e)},prefault(e){return mc(this,e)},catch(e){return vc(this,e)},pipe(e){return bc(this,e)},readonly(){return Sc(this)},describe(e){let t=this.clone();return Di.add(t,{description:e}),t},meta(...e){if(e.length===0)return Di.get(this);let t=this.clone();return Di.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 je(this,`~standard`,{...En(this),jsonSchema:{input:Ja(this,`input`),output:Ja(this,`output`)}})},set"~standard"(e){Ae(this,`~standard`,e)},parse:function e(t,n){return Wo(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Go(this,t,n,{callee:e})},safeParse(e,t){return Ko(this,e,t)},async safeParseAsync(e,t){return qo(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Ae(this,`spa`,e)},validate(e,t){return ft(this,e,t)},validateAsync(e,t){return mt(this,e,t)},encode:function e(t,n){return Jo(this,t,n,{callee:e})},decode:function e(t,n){return Yo(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Xo(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Zo(this,t,n,{callee:e})},safeEncode(e,t){return Qo(this,e,t)},safeDecode(e,t){return $o(this,e,t)},async safeEncodeAsync(e,t){return es(this,e,t)},async safeDecodeAsync(e,t){return ts(this,e,t)},toJSONSchema(e){return qa(this,{})(e)},get description(){return Di.get(this)?.description},get _def(){return this._zod.def}}),as=/*@__PURE__*/ L(`_ZodString`,(e,t)=>{Dn.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r)},/*@__PURE__*/ Me({format:e=>oo(e).format??null,minLength:e=>oo(e).minimum??null,maxLength:e=>oo(e).maximum??null},{regex(...e){return this.check(/* @__PURE__ */ ga(...e))},includes(...e){return this.check(/* @__PURE__ */ ya(...e))},startsWith(...e){return this.check(/* @__PURE__ */ ba(...e))},endsWith(...e){return this.check(/* @__PURE__ */ xa(...e))},min(...e){return this.check(/* @__PURE__ */ ma(...e))},max(...e){return this.check(/* @__PURE__ */ pa(...e))},length(...e){return this.check(/* @__PURE__ */ ha(...e))},nonempty(...e){return this.check(/* @__PURE__ */ ma(1,...e))},lowercase(e){return this.check(/* @__PURE__ */ _a(e))},uppercase(e){return this.check(/* @__PURE__ */ va(e))},trim(){return this.check(/* @__PURE__ */ wa())},normalize(...e){return this.check(/* @__PURE__ */ Ca(...e))},toLowerCase(){return this.check(/* @__PURE__ */ Ta())},toUpperCase(){return this.check(/* @__PURE__ */ Ea())},slugify(){return this.check(/* @__PURE__ */ Da())}})),os=/*@__PURE__*/ L(`ZodString`,(e,t)=>{Dn.init(e,t),as.init(e,t)},{email(e){return this.check(/* @__PURE__ */ Ai(fs,e))},url(e){return this.check(/* @__PURE__ */ Ii(gs,e))},jwt(e){return this.check(/* @__PURE__ */ Zi(Ms,e))},emoji(e){return this.check(/* @__PURE__ */ Li(vs,e))},guid(e){return this.check(/* @__PURE__ */ ji(ps,e))},uuid(e){return this.check(/* @__PURE__ */ Mi(ms,e))},uuidv4(e){return this.check(/* @__PURE__ */ Ni(ms,e))},uuidv6(e){return this.check(/* @__PURE__ */ Pi(ms,e))},uuidv7(e){return this.check(/* @__PURE__ */ Fi(ms,e))},nanoid(e){return this.check(/* @__PURE__ */ Ri(ys,e))},cuid(e){return this.check(/* @__PURE__ */ zi(bs,e))},cuid2(e){return this.check(/* @__PURE__ */ Bi(xs,e))},ulid(e){return this.check(/* @__PURE__ */ Vi(Ss,e))},base64(e){return this.check(/* @__PURE__ */ Ji(ks,e))},base64url(e){return this.check(/* @__PURE__ */ Yi(As,e))},xid(e){return this.check(/* @__PURE__ */ Hi(Cs,e))},ksuid(e){return this.check(/* @__PURE__ */ Ui(ws,e))},ipv4(e){return this.check(/* @__PURE__ */ Wi(Ts,e))},ipv6(e){return this.check(/* @__PURE__ */ Gi(Es,e))},cidrv4(e){return this.check(/* @__PURE__ */ Ki(Ds,e))},cidrv6(e){return this.check(/* @__PURE__ */ qi(Os,e))},e164(e){return this.check(/* @__PURE__ */ Xi(js,e))},datetime(e){return this.check(/* @__PURE__ */ Qi(cs,e))},date(e){return this.check(/* @__PURE__ */ $i(ls,e))},time(e){return this.check(/* @__PURE__ */ ea(us,e))},duration(e){return this.check(/* @__PURE__ */ ta(ds,e))}});function R(e){return/* @__PURE__ */ ki(os,e)}let ss=/*@__PURE__*/ L(`ZodStringFormat`,(e,t)=>{On.init(e,t),as.init(e,t)}),cs=/*@__PURE__*/ L(`ZodISODateTime`,(e,t)=>{qn.init(e,t),ss.init(e,t)}),ls=/*@__PURE__*/ L(`ZodISODate`,(e,t)=>{Jn.init(e,t),ss.init(e,t)}),us=/*@__PURE__*/ L(`ZodISOTime`,(e,t)=>{Yn.init(e,t),ss.init(e,t)}),ds=/*@__PURE__*/ L(`ZodISODuration`,(e,t)=>{Xn.init(e,t),ss.init(e,t)}),fs=/*@__PURE__*/ L(`ZodEmail`,(e,t)=>{jn.init(e,t),ss.init(e,t)}),ps=/*@__PURE__*/ L(`ZodGUID`,(e,t)=>{kn.init(e,t),ss.init(e,t)}),ms=/*@__PURE__*/ L(`ZodUUID`,(e,t)=>{An.init(e,t),ss.init(e,t)});function hs(e){return/* @__PURE__ */ Mi(ms,e)}let gs=/*@__PURE__*/ L(`ZodURL`,(e,t)=>{zn.init(e,t),ss.init(e,t)});function _s(e){return/* @__PURE__ */ Ii(gs,e)}let vs=/*@__PURE__*/ L(`ZodEmoji`,(e,t)=>{Bn.init(e,t),ss.init(e,t)}),ys=/*@__PURE__*/ L(`ZodNanoID`,(e,t)=>{Vn.init(e,t),ss.init(e,t)}),bs=/*@__PURE__*/ L(`ZodCUID`,(e,t)=>{Hn.init(e,t),ss.init(e,t)}),xs=/*@__PURE__*/ L(`ZodCUID2`,(e,t)=>{Un.init(e,t),ss.init(e,t)}),Ss=/*@__PURE__*/ L(`ZodULID`,(e,t)=>{Wn.init(e,t),ss.init(e,t)}),Cs=/*@__PURE__*/ L(`ZodXID`,(e,t)=>{Gn.init(e,t),ss.init(e,t)}),ws=/*@__PURE__*/ L(`ZodKSUID`,(e,t)=>{Kn.init(e,t),ss.init(e,t)}),Ts=/*@__PURE__*/ L(`ZodIPv4`,(e,t)=>{Zn.init(e,t),ss.init(e,t)}),Es=/*@__PURE__*/ L(`ZodIPv6`,(e,t)=>{er.init(e,t),ss.init(e,t)}),Ds=/*@__PURE__*/ L(`ZodCIDRv4`,(e,t)=>{tr.init(e,t),ss.init(e,t)}),Os=/*@__PURE__*/ L(`ZodCIDRv6`,(e,t)=>{rr.init(e,t),ss.init(e,t)}),ks=/*@__PURE__*/ L(`ZodBase64`,(e,t)=>{or.init(e,t),ss.init(e,t)}),As=/*@__PURE__*/ L(`ZodBase64URL`,(e,t)=>{lr.init(e,t),ss.init(e,t)}),js=/*@__PURE__*/ L(`ZodE164`,(e,t)=>{ur.init(e,t),ss.init(e,t)}),Ms=/*@__PURE__*/ L(`ZodJWT`,(e,t)=>{fr.init(e,t),ss.init(e,t)}),Ns=/*@__PURE__*/ L(`ZodNumber`,(e,t)=>{pr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(e,t,n,r),e.isFinite=!0},/*@__PURE__*/ Me({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=oo(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=oo(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=oo(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>oo(e).format??null},{gt(e,t){return this.check(/* @__PURE__ */ ua(e,t))},gte(e,t){return this.check(/* @__PURE__ */ da(e,t))},min(e,t){return this.check(/* @__PURE__ */ da(e,t))},lt(e,t){return this.check(/* @__PURE__ */ ca(e,t))},lte(e,t){return this.check(/* @__PURE__ */ la(e,t))},max(e,t){return this.check(/* @__PURE__ */ la(e,t))},int(e){return this.check(Fs(e))},safe(e){return this.check(Fs(e))},positive(e){return this.check(/* @__PURE__ */ ua(0,e))},nonnegative(e){return this.check(/* @__PURE__ */ da(0,e))},negative(e){return this.check(/* @__PURE__ */ ca(0,e))},nonpositive(e){return this.check(/* @__PURE__ */ la(0,e))},multipleOf(e,t){return this.check(/* @__PURE__ */ fa(e,t))},step(e,t){return this.check(/* @__PURE__ */ fa(e,t))},finite(){return this}}));function z(e){return/* @__PURE__ */ na(Ns,e)}let Ps=/*@__PURE__*/ L(`ZodNumberFormat`,(e,t)=>{mr.init(e,t),Ns.init(e,t)});function Fs(e){return/* @__PURE__ */ ra(Ps,e)}let Is=/*@__PURE__*/ L(`ZodBoolean`,(e,t)=>{hr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(e,t,n,r)});function B(e){return/* @__PURE__ */ ia(Is,e)}let Ls=/*@__PURE__*/ L(`ZodNull`,(e,t)=>{gr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mo(e,t,n,r)});function Rs(e){return/* @__PURE__ */ aa(Ls,e)}let zs=/*@__PURE__*/ L(`ZodUnknown`,(e,t)=>{_r.init(e,t),is.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Bs(){return/* @__PURE__ */ oa(zs)}let Vs=/*@__PURE__*/ L(`ZodNever`,(e,t)=>{vr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r)});function Hs(e){return/* @__PURE__ */ sa(Vs,e)}let Us=/*@__PURE__*/ L(`ZodArray`,(e,t)=>{rs(),Sr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bo(e,t,n,r),e.element=t.element},{min(e,t){return this.check(/* @__PURE__ */ ma(e,t))},nonempty(e){return this.check(/* @__PURE__ */ ma(1,e))},max(e,t){return this.check(/* @__PURE__ */ pa(e,t))},length(e,t){return this.check(/* @__PURE__ */ ha(e,t))},unwrap(){return this.element}});function V(e,t){return/* @__PURE__ */ Oa(Us,e,t)}let Ws=/*@__PURE__*/ L(`ZodObject`,(e,t)=>{rs(),Or.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r),Le(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return W(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(E(this._zod.def,{catchall:e}))},passthrough(){return this.clone(E(this._zod.def,{catchall:Bs()}))},loose(){return this.clone(E(this._zod.def,{catchall:Bs()}))},strict(){return this.clone(E(this._zod.def,{catchall:Hs()}))},strip(){return this.clone(E(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 fe(this,e)},omit(e){return j(this,e)},partial(...e){return ve(ac,this,e[0])},exactPartial(...e){return ve(sc,this,e[0],`exactPartial`)},required(...e){return ye(hc,this,e[0])}});function H(e,t){let n={type:`object`,shape:e??{},...O(t)};return new Ws(n)}function U(e,t){return new Ws({type:`object`,shape:e,catchall:Hs(),...O(t)})}let Gs=/*@__PURE__*/ L(`ZodUnion`,(e,t)=>{Ar.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r),e.options=t.options});function Ks(e,t){return new Gs({type:`union`,options:e,...O(t)})}let qs=/*@__PURE__*/ L(`ZodDiscriminatedUnion`,(e,t)=>{Gs.init(e,t),Mr.init(e,t)});function Js(e,t,n){return new qs({type:`union`,options:t,discriminator:e,...O(n)})}let Ys=/*@__PURE__*/ L(`ZodIntersection`,(e,t)=>{Nr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r)});function Xs(e,t){return new Ys({type:`intersection`,left:e,right:t})}let Zs=/*@__PURE__*/ L(`ZodTuple`,(e,t)=>{rs(),Ir.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(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 ac({type:`optional`,innerType:e}))})}});function Qs(e,t,n){let r=t instanceof Cn;return new Zs({type:`tuple`,items:e,rest:r?t:null,...O(r?n:t)})}let $s=/*@__PURE__*/ L(`ZodRecord`,(e,t)=>{rs(),Br.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function ec(e,t,n){return!t||!t._zod?new $s({type:`record`,keyType:R(),valueType:e,...O(t)}):new $s({type:`record`,keyType:e,valueType:t,...O(n)})}let tc=/*@__PURE__*/ L(`ZodEnum`,(e,t)=>{Vr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(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 tc({...t,checks:[],...O(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 tc({...t,checks:[],...O(r),entries:i})}});function W(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new tc({type:`enum`,entries:n,...O(t)})}let nc=/*@__PURE__*/ L(`ZodLiteral`,(e,t)=>{Hr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_o(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 nc({type:`literal`,values:Array.isArray(e)?e:[e],...O(t)})}let rc=/*@__PURE__*/ L(`ZodTransform`,(e,t)=>{rs(),Ur.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yo(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(P(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(P(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function ic(e){return new rc({type:`transform`,transform:e})}let ac=/*@__PURE__*/ L(`ZodOptional`,(e,t)=>{Gr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function oc(e){return new ac({type:`optional`,innerType:e})}let sc=/*@__PURE__*/ L(`ZodExactOptional`,(e,t)=>{Kr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function cc(e){return new sc({type:`optional`,innerType:e})}let lc=/*@__PURE__*/ L(`ZodNullable`,(e,t)=>{qr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function uc(e){return new lc({type:`nullable`,innerType:e})}let dc=/*@__PURE__*/ L(`ZodDefault`,(e,t)=>{Jr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fc(e,t){return new dc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():se(t)}})}let pc=/*@__PURE__*/ L(`ZodPrefault`,(e,t)=>{Xr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function mc(e,t){return new pc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():se(t)}})}let hc=/*@__PURE__*/ L(`ZodNonOptional`,(e,t)=>{Zr.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function gc(e,t){return new hc({type:`nonoptional`,innerType:e,...O(t)})}let _c=/*@__PURE__*/ L(`ZodCatch`,(e,t)=>{ei.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function vc(e,t){return new _c({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Re(t)})}let yc=/*@__PURE__*/ L(`ZodPipe`,(e,t)=>{ti.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.in=t.in,e.out=t.out});function bc(e,t){return new yc({type:`pipe`,in:e,out:t})}let xc=/*@__PURE__*/ L(`ZodReadonly`,(e,t)=>{ri.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ro(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Sc(e){return new xc({type:`readonly`,innerType:e})}let Cc=/*@__PURE__*/ L(`ZodLazy`,(e,t)=>{ai.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function wc(e){return new Cc({type:`lazy`,getter:e})}let Tc=/*@__PURE__*/ L(`ZodCustom`,(e,t)=>{oi.init(e,t),is.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vo(e,t,n,r)});function Ec(e,t){return/* @__PURE__ */ ka(Tc,e??(()=>!0),t)}function Dc(e,t={}){return/* @__PURE__ */ Aa(Tc,e,t)}function Oc(e,t){return/* @__PURE__ */ ja(e,t)}function kc(e){return/* @__PURE__ */ Qi(cs,e)}function Ac(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 jc=Ks([R(),z(),B(),Rs()]);function Mc(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 Nc=Ec(Mc,{message:`JSON value must not contain circular references`}),Pc=wc(()=>Ks([jc,V(Pc),ec(R(),Pc)])),Fc=Nc.pipe(Pc);Nc.pipe(V(Pc));let Ic=Nc.pipe(ec(R(),Pc)),Lc=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(Ac([`diagnostic`,`stage`,`durationMs`,`stderrTail`])),Rc=R().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u),zc=e=>R().min(1).max(e).refine(e=>e.trim().length>0),Bc=ec(Rc,H({label:zc(256).optional(),description:zc(1024).optional()}).strict()).refine(e=>Object.keys(e).length<=16,`Too many locales`),Vc=ec(Rc,zc(4096)).refine(e=>typeof e.en==`string`,`English fallback is required`).refine(e=>Object.keys(e).length<=16,`Too many locales`),Hc=R().refine(e=>e.trim().length>0,{message:`Identifier must not be empty or whitespace`}),Uc=Hc.brand(),Wc=Hc.brand(),Gc=Hc.brand();Hc.brand(),Hc.brand();let Kc=R().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),qc=Kc.max(128).regex(/^[A-Za-z0-9._~:-]+$/u,`Permission Mode ID must use transport-safe characters`).brand(),Jc=H({modes:V(H({id:qc,label:Kc.max(256),description:Kc.max(1024).optional(),dangerous:B().optional(),localizations:Bc.optional()}).strict()).min(1).max(32),defaultModeId:qc}).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:Wc,permissionModeId:qc}).strict();let Yc=R().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`});H({sourceThreadId:Wc,lastTurnId:Gc.optional(),targetHarnessId:Uc,targetModel:Yc.max(1024).optional(),targetThinkingOptionId:Yc.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).optional()}).strict();let Xc=H({sourceThreadId:Wc,sourceHarnessId:Uc,sourceHarnessLabel:Yc.max(256).optional(),sourceModel:Yc.max(1024).optional(),targetHarnessId:Uc,targetHarnessLabel:Yc.max(256).optional(),targetModel:Yc.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:Wc,handoff:Xc}).strict();let Zc=z().int().safe().nonnegative(),Qc=z().finite().nonnegative(),$c=z().finite().min(0).max(100),el=H({version:Ks([G(3),G(4)]).optional(),requestId:R().min(1),turnId:R().min(1).max(1024),outputTokens:Zc,startedAtMs:Zc,completedAtMs:Zc}).strict().refine(e=>e.completedAtMs>e.startedAtMs),tl=H({version:Ks([G(2),G(3),G(4)]).optional(),value:Qc,turnId:R().min(1).max(1024),at:Zc}).strict();H({outputTimings:V(el).transform(e=>e.filter(e=>e.version===4)).optional(),outputTokensPerSecond:tl.refine(e=>e.version===4).optional().catch(void 0),timeToFirstOutputMs:tl.extend({value:Zc}).optional()}).strict();let nl=e=>Vc.refine(t=>Object.values(t).every(t=>t.length<=e)),rl=H({composerIndicators:V(H({kind:G(`countdown`),id:R().min(1).max(64),expiresAtUnix:Zc,label:nl(256).optional(),tooltip:nl(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:Zc.optional(),cachedInputTokens:Zc.optional(),cacheWriteInputTokens:Zc.optional(),outputTokens:Zc.optional(),outputTokensPerSecond:Qc.optional(),sessionOutputTokensPerSecond:Qc.optional(),apiOutputTokensPerSecond:Qc.optional(),reasoningOutputTokens:Zc.optional(),totalTokens:Zc.optional(),totalCostUsd:Qc.optional(),totalCredits:Qc.optional(),contextUsagePercent:Qc.optional(),cacheHitRatePercent:$c.optional(),contextWindowTokens:Zc.optional(),contextUsedTokens:Zc.optional(),planFiveHourUsedPercent:$c.optional(),planFiveHourResetsAtUnix:Zc.optional(),planSevenDayUsedPercent:$c.optional(),planSevenDayResetsAtUnix:Zc.optional(),sessionCacheHitRatePercent:$c.optional(),timeToFirstOutputMs:Zc.optional(),latestRequestTimeToFirstOutputMs:Zc.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`]})}),il=z().finite().min(0).max(100),al=W([`weekly`,`monthly`,`five_hour`,`seven_day`,`unknown`]),ol=H({id:R().min(1).max(256),label:R().min(1).max(256),localizations:Bc.optional()}).strict(),sl=H({product:R().min(1),periodType:al.optional(),scope:ol.optional(),localizations:Bc.optional(),used:z().finite().nonnegative().optional(),limit:z().finite().nonnegative().optional(),unit:R().min(1).max(32).optional(),usagePercent:il,resetsAt:R().min(1).optional()}).strict(),cl=H({availableCount:z().int().safe().positive(),nextExpiresAt:R().min(1).optional(),expiresAt:V(R().min(1)).min(1).max(32).optional()}).strict(),ll=H({used:z().finite().nonnegative().optional(),limit:z().finite().nonnegative().optional(),unit:R().min(1).max(32).optional(),label:R().min(1).optional(),scope:ol.optional(),localizations:Bc.optional(),usedPercent:il,resetsAt:R().min(1).optional(),periodType:al,productUsage:V(sl).min(1).optional(),resetCredits:cl.optional()}).strict(),ul=H({amount:z().finite().nonnegative(),currency:R().trim().min(1).max(8),label:R().trim().min(1).max(128).optional()}).strict();H({threadId:Wc,refresh:G(`exact`).optional()}).strict(),H({threadId:Wc,usage:rl.nullable(),accountCredits:ll.optional(),accountBalance:ul.optional(),accountCreditsSupported:B().optional()}).strict();let dl=R().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),fl=R().min(1).max(512).refine(e=>!/\p{Cc}/u.test(e),`Model Ref must not contain control characters`).brand(),pl=W([`priority`,`ultrafast`]),ml=H({id:fl,serviceTier:pl.optional()}).strict();function hl(e,t){return e?.id===t?.id&&e?.serviceTier===t?.serviceTier}let gl=dl.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).brand(),_l=dl.max(256),vl=H({id:gl,label:dl.max(256)}).strict(),yl=H({ref:ml,label:dl.max(256),resolvedModelLabel:_l.optional(),fastModel:ml.optional(),supportedThinkingOptionIds:V(gl).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 bl(e,t){if(t)return e?.models.find(e=>hl(e.ref,t)||hl(e.fastModel,t))}let xl=V(vl).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)}),Sl=W([`catalog`,`activeModel`]),Cl=H({models:V(yl),defaultModel:ml.optional(),thinkingOptions:xl,defaultThinkingOptionId:gl.optional(),thinkingOptionsScope:Sl.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=>hl(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=>hl(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&&!bl(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`]})}),wl=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`}),Tl=W([`live`,`atCreate`]),El=H({configuration:H({selectModel:B(),selectThinkingOption:B(),selectPermissionMode:B(),permissionModeScope:Tl.default(`live`)}).strict(),history:wl,subagents:H({observe:B(),readTranscript:B()}).strict().optional(),autonomousTurns:H({observe:B()}).strict().optional(),steer:B().optional(),persistentPlan:B().optional()}).strict();H({effectiveModel:ml.optional(),resolvedModelLabel:_l.optional(),effectiveThinkingOptionId:gl.optional(),availableThinkingOptions:xl.optional(),effectivePermissionModeId:qc.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 Dl=H({open:G(!0)}).strict();Ks([H({status:G(`ready`),catalog:Cl,permissionModes:Jc.optional(),capabilities:El,webUi:Dl.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:Lc}).strict()]),H({harnessId:Uc,cwd:dl.max(16384).optional(),refresh:B().optional(),purpose:G(`availability`).optional(),credentialAccess:W([`allow`,`retry`]).optional()}).strict(),H({harnessId:Uc}).strict(),H({}).strict(),H({threadId:Wc,model:ml}).strict(),H({threadId:Wc,thinkingOptionId:gl}).strict(),H({threadId:Wc,includeReferenceCapability:B().optional()}).strict(),Js(`owner`,[H({owner:G(`codex`),locked:B(),effectiveModel:ml.optional(),resolvedModelLabel:_l.optional(),effectiveThinkingOptionId:gl.optional(),effectivePermissionModeId:qc.optional(),history:wl.optional(),supportsThreadReferences:G(!0).optional(),handoff:Xc.optional()}).strict(),H({owner:G(`external`),harnessId:dl.max(256),transportModelId:dl.max(8192),effectiveModel:ml.optional(),resolvedModelLabel:_l.optional(),effectiveThinkingOptionId:gl.optional(),availableThinkingOptions:xl.optional(),effectivePermissionModeId:qc.optional(),catalog:Cl.optional(),history:wl,usage:rl.optional(),handoff:Xc.optional(),locked:G(!0)}).strict()]),H({threadIds:V(Wc).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 Ol=Js(`owner`,[H({threadId:Wc,owner:G(`codex`)}).strict(),H({threadId:Wc,owner:G(`external`),harnessId:R().max(256).pipe(Uc)}).strict()]);H({threads:V(Ol).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:Wc,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`}),Be}}).pipe(H({expectedTurnId:Gc,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 kl=R().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u),Al=kl.pipe(Uc),jl=Al.refine(e=>e!==`codex`,`The official Codex identity is reserved`),Ml=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`),Nl=_s().refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Plugin documentation links must be credential-free HTTPS URLs`),Pl=H({en:R().max(4096),"zh-CN":R().max(4096).optional()}).strict(),Fl=H({commands:V(H({terminal:R().max(256),command:R().max(4096)}).strict()).max(8),before:Pl.optional(),after:Pl.optional(),downloads:V(H({label:R().max(128),url:Nl}).strict()).max(8).optional()}).strict(),Il={id:Al,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:Fl.optional(),notice:Pl.optional(),launchCommand:G(!0).optional(),links:H({website:Nl.optional(),documentation:Nl.optional(),installation:Nl.optional()}).strict().optional()};H({manifestVersion:G(1),...Il,adapterApiVersion:z().int().positive(),entry:Ml,icon:Ml.optional()}).strict();let Ll=R().max(174828).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u),Rl=H({...Il,icon:Ll.optional()}).strict();H({}).strict(),H({plugins:V(Rl.extend({id:jl})).max(128)}).strict(),H({version:G(1),enabled:V(Al).max(128)}).strict().refine(e=>new Set(e.enabled).size===e.enabled.length,{message:`Enabled plugin IDs must be unique`,path:[`enabled`]});let zl=131072,Bl=524288,Vl=kl,Hl=W([`sidebar.thread-layout`,`sidebar.thread-badge`,`appearance.theme`]),Ul=W([`appearance`,`interface`,`workflow`,`analytics`,`integrations`,`tools`]),Wl=R().trim().min(1).max(128);function Gl(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 Kl=e=>e.split(`/`).every(e=>!/[. ]$/u.test(e)),ql=Ml.refine(e=>Gl(e)!==void 0&&Kl(e),`Images must be relative .png, .jpg, .jpeg, or .webp paths with no segments ending in a dot or space`),Jl=R().trim().max(2048).regex(/^https?:\/\/[^/?#\\\s]+/iu,`Expected an HTTP(S) URL`).pipe(_s({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 Yl(e){return U({en:e,"zh-CN":e})}let Xl=Yl(R().trim().min(1)),Zl=V(Ul).max(Ul.options.length).refine(e=>new Set(e).size===e.length,`Duplicate categories`),Ql=V(Hl).max(Hl.options.length).refine(e=>new Set(e).size===e.length,`Duplicate slots`),$l={key:R().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),label:Xl,description:Xl.optional()},eu={...$l,step:z().positive().optional(),default:z().optional()},tu=U({value:R(),label:Xl}),nu=Js(`type`,[U({...$l,type:G(`boolean`),default:B().optional()}),U({...$l,type:G(`string`),placeholder:Xl.optional(),default:R().optional()}),U({...eu,type:G(`number`),min:z().optional(),max:z().optional()}),U({...eu,type:G(`range`),min:z(),max:z()}),U({...$l,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`)}}),ru=H({manifestVersion:Fs().positive(),id:Vl,name:Ks([Wl,Yl(Wl)]),version:R().min(1).max(128),desktopApi:Fs().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:Jl.optional(),details:U({en:R().max(16384),"zh-CN":R().max(16384).optional()}).optional(),icon:ql.optional(),screenshots:V(ql).max(4).refine(e=>new Set(e).size===e.length,`Duplicate screenshots`).optional(),desktop:U({script:Ml,style:Ml.optional()}).optional(),backend:U({script:Ml.refine(Kl)}).optional(),slots:Ql.default(()=>[]),settingsSchema:V(nu).max(32).refine(e=>new Set(e.map(({key:e})=>e)).size===e.length,`Duplicate setting keys`).optional(),categories:Zl.optional()}).strict().refine(e=>e.desktop!==void 0||e.backend!==void 0,`Expected at least one desktop or backend entry`),iu=R().regex(/^[a-f0-9]{64}$/u),au=U({state:W([`running`,`disabled`,`invalid`,`incompatible`,`conflict`,`failed`,`waiting`]),hash:iu.optional(),error:R().optional(),conflictWith:Vl.optional()});U({controllerPid:Fs().positive(),targetId:R().nullable(),updatedAt:kc(),handledReloadToken:hs().optional(),extensions:ec(R(),au),surfaces:ec(R(),au).optional()});let ou=W([`official`,`community`]);function su(e){return e.origin===`https://api.github.com`&&/^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(e.pathname)}let cu=Jl.refine(e=>{let t=new URL(e);return/\.zip$/iu.test(t.pathname)||su(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`),lu=U({id:Vl,version:R().trim().min(1).max(128),name:Xl.extend({en:Wl,"zh-CN":Wl}),description:Yl(R().trim().min(1).max(4096)),details:Yl(R().trim().min(1).max(16384)).optional(),author:R().trim().min(1).max(128),repository:Jl,stars:z().int().min(0).optional(),downloads:z().int().min(0).optional(),categories:Zl.optional(),trustTier:ou.default(`community`),icon:Jl.optional(),screenshots:V(Jl).max(4).optional(),downloadUrl:cu,sha256:iu,slots:Ql.optional(),publishedAt:R().optional(),updatedAt:R().optional(),minCodexHostVersion:R().optional()});U({schemaVersion:G(1),generatedAt:R(),extensions:V(lu).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,`Duplicate extension IDs`)});let uu=R().trim().min(1).max(128),du=/^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³]) *(?:\.|$)/iu,fu=Vl.refine(e=>!du.test(e),`Reserved extension ID`),pu=W([`desktop`,`web`]),mu=iu,hu=hs(),gu=Ml.refine(e=>!/[\x00-\x1f\x7f<>"|*]/u.test(e)&&e.split(`/`).every(e=>!/[. ]$/u.test(e)&&!du.test(e)),`Expected a portable relative resource path`).refine(e=>e.split(`/`).length<=32,`Extension resources may be at most 32 segments deep`),_u=ru.shape,vu=(e,t=0)=>U({en:R().trim().min(t).max(e),"zh-CN":R().trim().min(t).max(e)}),yu=e=>gu.refine(t=>t.endsWith(e),`Expected a ${e} file`),bu=yu(`.mjs`),xu=yu(`.css`).optional(),Su=e=>e.normalize(`NFC`).toLowerCase(),Cu=U({manifestVersion:G(2),id:fu,name:vu(128,1),version:R().trim().min(1).max(128),description:vu(4096),details:vu(16384).optional(),author:_u.author,repository:_u.repository,icon:_u.icon.refine(e=>e===void 0||gu.safeParse(e).success),screenshots:_u.screenshots.refine(e=>e===void 0||e.every(e=>gu.safeParse(e).success)),categories:_u.categories,settingsSchema:_u.settingsSchema,slots:_u.slots.removeDefault().optional(),page:U({apiVersion:G(1),entry:bu,style:xu,title:vu(128,1).optional()}).optional(),widget:U({apiVersion:G(1),entry:bu,style:xu}).optional(),desktop:U({apiVersion:G(1),script:yu(`.js`),style:xu}).optional(),web:U({apiVersion:G(1),entry:bu.optional(),style:xu}).refine(({entry:e,style:t})=>e!==void 0||t!==void 0,`Expected a Web entry or style`).optional(),backend:U({apiVersion:G(1),entry:bu}).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||Su(e)!==Su(r.entry)),{path:[`backend`,`entry`],message:`A backend entry cannot also be a frontend entry`});function wu({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 Tu=uu,Eu=W([`running`,`waiting`,`idle`,`unknown`]),Du=U({sourceThreadId:Wc,createdAtMs:z().int().nonnegative()}),Ou=U({harnessId:Uc,title:R().optional(),status:Eu,archived:B(),updatedAtMs:z().int().nonnegative().optional()}),ku=U({revision:Fs().nonnegative(),parents:ec(Wc,Wc),handoffs:ec(Wc,Du).optional(),nodes:ec(Wc,Ou),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`),Au=R().min(1).max(128);U({});let ju=U({subscriptionId:Au});U({}),ju.extend({snapshot:ku});let Mu=Fs().nonnegative(),Nu=U({revision:Mu,enabled:V(fu).max(64).refine(e=>new Set(e).size===e.length,`Duplicate extension IDs`)});U({version:G(1),seeded:V(fu).max(64).refine(e=>new Set(e).size===e.length,`Duplicate extension IDs`)});let Pu=H({version:R().trim().min(1).max(128),publishedAt:R().trim().min(1).max(64).optional(),notes:R().trim().min(1).max(8192),url:Jl.optional()}),{downloadUrl:Fu,...Iu}=lu.shape,Lu=H({...Iu,id:fu,format:G(`codexhost`),targets:V(pu).min(1).max(2).refine(e=>new Set(e).size===e.length,`Duplicate targets`),apis:U({page:Fs().positive().optional(),widget:Fs().positive().optional(),desktop:Fs().positive().optional(),web:Fs().positive().optional(),backend:Fs().positive().optional()}),downloadUrl:Fu.refine(e=>e.startsWith(`https://`),`Expected HTTPS`),featured:B().optional(),featuredOrder:Fs().nonnegative().optional(),changelog:V(Pu).max(20).optional()}).refine(({targets:e,apis:t})=>{let n=wu({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(Lu).max(1e4).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,`Duplicate extension IDs`)}).extend({catalogUrl:Jl,fetchedAt:kc(),cached:B(),stale:B().optional()});let Ru={id:fu},zu={...Ru,activationId:hu,digest:mu},Bu={...Ru,activationId:zu.activationId.optional()},Vu=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`),Hu=R().min(1).max(256).refine(e=>e.split(`/`).every(e=>e&&/^[a-z0-9_.-]+$/iu.test(e)&&e!==`.`&&e!==`..`),`Invalid GitHub ref`);function Uu(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 Wu=U({type:G(`github`),repository:R().max(150).regex(/^[a-z0-9-]+\/[a-z0-9_-][a-z0-9_.-]*$/iu),ref:Hu.optional(),tag:Hu.optional(),asset:R().max(255).regex(/^[a-z0-9_.-]+\.zip$/iu).optional(),subpath:gu.optional()}).refine(({ref:e,tag:t,asset:n})=>!e||!t&&!n,`Use either a zipball ref or a release tag/asset`),Gu=Ks([U({type:G(`catalog`),...Ru}),Wu,U({type:G(`zip`),base64:Uu(67108864).min(4)}),U({type:G(`zip`),localZipPath:Vu}),U({type:G(`localDir`),localDir:Vu})]),Ku=Js(`type`,[U({type:G(`catalog`),...Ru}),Wu,U({type:G(`zip`)}),U({type:G(`localDir`)})]),qu=U({...zu,manifest:Cu,installedAt:kc(),source:Ku.optional()}),Ju=e=>R().max(23+4*Math.ceil(e/3)).regex(/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/u),Yu={desktopConflictWith:fu.optional()},Xu=W([`none`,`inactive`,`starting`,`running`,`failed`]),Zu=Js(`state`,[qu.extend({state:G(`valid`),enabled:B(),...Yu,iconDataUrl:Ju(zl).optional(),screenshotDataUrls:V(Ju(Bl)).max(4).optional(),backendState:Xu.optional(),backendError:R().optional()}),U({state:W([`invalid`,`incompatible`]),id:R().min(1),enabled:B(),error:R()})]);U({revision:Mu,configuration:Nu,diagnostics:V(R()),extensions:V(Zu)}),U({revision:Mu,extensions:V(qu.extend({...Yu,settingsRevision:Mu})).max(64)});let Qu={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`},$u=Object.freeze(Object.values(Qu));new Set($u),U({});let ed={expectedRevision:Mu};U({...Ru,...ed}),qu.extend({replaced:B()}),Js(`state`,[U({state:G(`saved`),configuration:Nu}),U({state:G(`revision-conflict`),revision:Mu})]),U({...Bu,digest:zu.digest.optional(),path:gu}),U({mimeType:R().min(1),base64:Uu(16777216),digest:zu.digest}),U({mimeType:W([`image/png`,`image/jpeg`,`image/webp`]),base64:Uu(zl)});let td=Fs().min(0).max(3);U({mimeType:W([`image/png`,`image/jpeg`,`image/webp`]),base64:Uu(Bl)}),U({settingsRevision:Mu,values:Ic}),Qu.list,Qu.snapshot,Qu.catalog,U({forceRefresh:B().optional(),staleWhileRevalidate:B().optional()}),Qu.catalogIcon,U({...Ru}),Qu.catalogScreenshot,U({...Ru,index:td}),Qu.install,U({source:Gu}),Qu.update,U({...Ru,expectedDigest:zu.digest,expectedActivationId:zu.activationId.optional(),source:Gu.optional()}),Qu.enable,Qu.disable,Qu.uninstall,U({...Ru,removeData:B().optional(),expectedDigest:zu.digest.optional()}),U({...Ru,removed:B()}),Qu.recover,U({expectedRevision:ed.expectedRevision.optional()}),Qu.asset,Qu.settingsGet,U(Bu),Qu.settingsSet,U({...Bu,expectedSettingsRevision:Mu,values:Ic}),Qu.backendInvoke,U({...Bu,method:Tu,params:Fc.optional()}),U({result:Fc}),Qu.threadTree,H({threadId:Wc}).strict(),H({confirmed:B()}).strict();let nd=[`codex-desktop`,`web`,`web-desktop-shell`,`web-mobile`,`ssh-remote`,`cli`],rd=[`darwin`,`win32`,`linux`],id=[`arm64`,`x64`,`ia32`,`arm`],ad=[`zh`,`en`,`ja`,`ko`,`de`,`fr`,`es`,`pt`,`ru`,`other`],od=[`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`],sd=[`official-relay`,`self-hosted-relay`,`tailscale-serve`,`tailscale-funnel`,`tailscale-ip`,`lan`,`custom-proxy`,`remote-peer`],cd=R().min(1).max(40).regex(/^[0-9A-Za-z._+-]+$/u),ld=W(nd),ud=W(ad),dd=W(od),fd=W(sd);new Set(od),new Set(ad),H({enabled:B(),forcedOffByEnv:B()}).strict(),H({enabled:B()}).strict(),H({surfaces:V(ld).max(12).optional(),harnesses:V(dd).max(32).optional(),remoteAccess:V(fd).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:cd.optional(),codexDesktopVersion:cd.optional(),os:W(rd).optional(),arch:W(id).optional(),uiLanguage:ud.optional(),surfaces:V(ld).min(1).max(12).optional(),harnesses:V(dd).min(1).max(32).optional(),remoteAccess:V(fd).min(1).max(12).optional()}).strict().refine(e=>Object.keys(e).length>0,{message:`Telemetry heartbeat must contain at least one countable field`});let pd=4e3,md={threadId:Wc};Js(`action`,[U({...md,action:W([`get`,`pause`,`resume`,`clear`])}),U({...md,action:W([`create`,`edit`]),objective:R().trim().min(1).refine(e=>Array.from(e).length<=pd,`A goal objective can have up to ${pd} characters.`)})]),H({goal:H({threadId:Wc,objective:R(),status:W([`active`,`paused`,`blocked`,`usageLimited`,`budgetLimited`,`complete`]),tokenBudget:Fs().positive().nullable().default(null),tokensUsed:Fs().nonnegative(),timeUsedSeconds:Fs().nonnegative()}).nullable()});let hd=R().trim().min(1),gd=R().min(1),_d=H({icon:R().nullable(),color:R().nullable()}),vd=_d.nullable(),yd={create:{method:`codexhost/thread/sections/create`,params:H({name:hd}).strict()},update:{method:`codexhost/thread/sections/update`,params:H({sectionId:gd,name:hd,appearance:_d.strict().nullable().optional()}).strict()},delete:{method:`codexhost/thread/sections/delete`,params:H({sectionId:gd}).strict()}};Js(`status`,[H({status:G(`unknown`)}),H({status:G(`confirmed`),sectionId:gd,section:H({id:gd,name:R().min(1),appearance:vd}).nullable(),syncPending:B()})]),[yd.create.method,yd.update.method,yd.delete.method,...$u],H({threadSectionsV1:G(!0).optional(),complete:G(!1).optional(),sections:V(H({id:R().min(1),name:R().min(1),appearance:vd.optional(),threads:V(Ic)}))}),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:ec(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:ec(R(),R()),projectless:V(R()),pinned:V(R()),sectionProjects:ec(R(),V(R())).optional(),pinnedProjects:V(R()).optional()});let bd=ec(R(),Bs()),xd=H({epoch:R().uuid(),sequence:z().int().nonnegative()});Js(`type`,[H({type:G(`projects-changed`),cursor:xd}),H({type:G(`skills-changed`),cursor:xd,cwd:R().optional()}),H({type:G(`harness-inspection-changed`),cursor:xd,harnessId:R().min(1)}),H({type:G(`display-settings-changed`),cursor:xd}),H({type:G(`sections-changed`),cursor:xd}),H({type:G(`preferences-changed`),cursor:xd,revision:z().int().nonnegative()}),H({type:G(`extensions-changed`),cursor:xd,revision:Mu}),H({type:G(`hello`),version:G(1),cursor:xd,reset:B()}),H({type:G(`changed`),cursor:xd,threadId:R().min(1),method:R().min(1)})]);let Sd=Js(`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()}))})]),Cd=Js(`type`,[H({type:G(`approval`),title:R(),description:R().optional(),subject:Bs().optional(),actions:V(H({id:R(),label:R(),effect:R()}))}),H({type:G(`question`),title:R().optional(),questions:V(Sd)})]),wd=H({requestId:Ks([R(),z().int()]),threadId:R(),kind:W([`approval`,`question`]),interaction:Cd,request:bd}),Td=H({id:R().min(1),clientUserMessageId:R().min(1),input:V(bd),presentationInput:V(bd).nullable().optional()}).passthrough();H({fields:V(H({path:V(Ks([R(),z().int().nonnegative()])),originalLength:z().int().nonnegative()}))});let Ed=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(),Dd=H({id:R().min(1).max(512),fingerprint:R().min(1).max(128)});H({threadId:R().min(1),knownTurns:V(Dd).max(64).optional(),truncateToolOutput:B().optional()});let Od=H({harnessId:R().min(1),nativeSessionId:R().min(1)});H({cursor:xd,activeTurnId:R().min(1).nullable().optional(),command:H({name:R().min(1),turn:Ed,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(),codexhostImportSource:Od.optional(),turns:V(Ed).length(0)}).passthrough(),turnsPage:H({data:V(Ed).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:ml.optional(),effectiveThinkingOptionId:gl.optional(),effectivePermissionModeId:qc.optional()}),queue:H({items:V(Td),pausedReason:W([`interrupted`,`outcome-unknown`,`failed`]).nullable()}).optional(),interactions:V(wd),handoff:Xc.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:Ks([R(),z().int()]),result:bd}),H({includeArchived:B().optional(),officialCursor:H({live:R().nullable(),archived:R().nullable().optional()}).strict().optional(),scope:Ks([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(Ic),ownership:V(Ol),archivedThreadIds:V(Wc),officialCursor:H({live:R().nullable(),archived:R().nullable().optional()}).strict().optional()}).strict(),Rl.pick({id:!0,name:!0,icon:!0,iconStyle:!0});let kd=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:Fs().nonnegative(),running:Fs().nonnegative(),waiting:Fs().nonnegative(),sessions:V(kd).max(32).default([]),notifications:V(U({threadId:R().max(1024),key:R().max(4096),kind:W([`completed`,`failed`,`approval`,`question`]),revision:Fs().nonnegative()})).max(256)});let Ad=R().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);H({available:B()}).strict(),H({path:R().min(1),mimeType:Ad}).strict();let jd=W([`credentials-unavailable`,`login-expired`,`rate-limited`,`service-rejected`,`host-incompatible`,`network`,`timeout`,`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`]);Js(`ok`,[H({ok:G(!0),text:R()}).strict(),H({ok:G(!1),error:H({code:jd}).strict()}).strict()]),H({threadId:Wc.optional(),cwd:R().min(1).optional()}).strict().refine(e=>!(e.threadId&&e.cwd),{message:`Specify threadId or cwd, not both`});let Md=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(Md),warnings:V(R()).optional()}).strict(),H({cwd:R().min(1).optional()}).strict();let Nd=H({kind:W([`public`,`relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`]),url:R().min(1)}).strict(),Pd=Js(`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:Pd,error:R().optional()}).strict();let Fd=Js(`status`,[H({status:G(`on`)}),H({status:G(`off`)}),H({status:G(`invalid`),reason:R()})]),Id=H({lan:B(),autostart:Fd}).strict(),Ld=H({expiresAt:R().optional(),issuing:B(),failure:H({detail:R().optional(),retryAt:R(),paused:B()}).optional()}),Rd=Js(`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:Ld}),H({status:G(`missing-certificate`),url:R(),certificate:Ld}),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 zd=W([`official`,`self-hosted`]);H({secret:R().min(1),lastUsedAt:z().nullable(),networkUrls:V(Nd),directCandidates:V(Nd).optional(),tailscale:Pd,background:Id.optional(),relay:H({state:Rd,enabled:B(),kind:zd,officialHost:R(),customHost:R().optional(),officialHostname:R().optional(),customHostname:R().optional(),quotaUntil:R().optional()}).strict().optional()}).strict();let Bd=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()}),Vd=/^[a-zA-Z0-9_-]{1,64}$/u,Hd=R().regex(Vd),Ud=R().regex(Vd),Wd=R().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u),Gd=W([`relay`,`tailscale`,`lan`,`custom`]),Kd=[`blue`,`purple`,`cyan`,`green`,`amber`,`rose`,`slate`],qd=W(Kd),Jd=new Set(Kd);function Yd(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return Kd[(t>>>0)%Kd.length]??Kd[0]}function Xd(e,t){return typeof t==`string`&&Jd.has(t)?t:Yd(e)}let Zd=W([`connected`,`connecting`,`auth-error`,`offline`,`disabled`]),Qd=H({peerId:Hd,hostId:Wd,nodeId:Ud.optional(),name:R().min(1).max(120),color:qd.optional(),origin:R().min(1).max(2048),transportKind:Gd,encrypted:B(),enabled:B(),state:Zd,supportsPeerPairing:B().optional(),pairedBack:B().optional(),linkedPeerIds:V(Hd).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(Qd)}),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:qd.optional(),pairBack:B().optional(),meshPeerIds:V(Hd).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:qd.optional(),expectedNodeId:Ud.optional()}),H({status:W([`added`,`updated`,`existing`]),peerId:Hd,hostId:Wd,nodeId:Ud.optional()});let $d=W([`added`,`updated`,`existing`,`failed`,`skipped`]);H({results:V(H({targetPeerId:Hd,targetName:R().min(1).max(120),introducedHost:Ks([G(`local`),Hd]),introducedName:R().min(1).max(120),status:$d,error:R().max(1e3).optional()}))}),H({peerIds:V(Hd).max(64).optional(),includeSelf:B().optional(),includeMesh:B().optional(),selfOrigin:R().min(1).max(2048).optional()}),H({peerId:Hd,name:R().trim().min(1).max(120).optional(),color:qd.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:Hd}),H({removed:B()}),H({peerId:Hd.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 ef=H({id:R().min(1).max(1024),name:R().min(1).max(512),path:R().min(1).max(8192)});H({ok:B(),nodeId:Ud.optional(),supportsPeerPairing:B().optional(),pairedBack:B().optional(),latencyMs:z().int().nonnegative().optional(),origin:R().max(2048).optional(),transportKind:Gd.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(ef).optional(),error:R().max(1e3).optional()});let tf=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))}),nf=H({attachments:G(1).optional(),workspaceFiles:G(1).optional(),officePreview:G(1).optional(),delegation:G(1).optional(),peerPairing:G(1).optional()}),rf=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:Ud.optional(),peerNodes:ec(Wd,Ud).refine(e=>Object.keys(e).length<=128).optional(),projects:V(tf),capabilities:nf.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(Js(`type`,[U({type:G(`text`),text:R()}),U({type:G(`file`),receiptId:R().min(1).max(128)})])).min(1).max(64)});let af=H({ok:G(!1),error:H({code:R(),message:R(),details:ec(R(),Bs()).optional()})});Ks([H({ok:G(!0),value:H({receiptId:R().min(1),file:H({attachmentId:R(),name:R(),bytes:z().int().nonnegative()})})}),af]),Ks([H({ok:G(!0),value:H({accepted:G(!0)})}),af]);let of=H({name:R().min(1).max(512),path:R().min(1).max(8192),kind:G(`directory`)});H({peerId:Hd,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(of)}),H({peerId:Hd,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:Hd,path:R().min(1).max(8192),title:R().trim().min(1).max(255).optional()}),H({peerId:Hd,workspaceId:R().min(1).max(1024),title:R().trim().min(1).max(255)}),H({peerId:Hd,workspaceId:R().min(1).max(1024)}),H({workspaceId:R().min(1).max(1024).optional(),manifest:rf}),H({sessionHostId:R().min(1).max(128).optional()}),H({hosts:V(H({hostId:Ks([G(`local`),Wd]),name:R().min(1).max(120),isLocal:B().optional(),color:qd.optional(),hostname:R().max(255).optional()}))}),H({hostId:Ks([G(`local`),Wd])}),H({harnesses:V(H({id:R().regex(/^[a-z0-9][a-z0-9-]*$/u),name:R().min(1).max(120)}))});let sf=W([`listHarnesses`,`inspect`,`start`,`send`,`cancel`,`read`,`answer`,`list`]);U({operation:sf,hopCount:z().int().min(0).max(16),sourceId:Hd.optional(),input:Ic});let cf=U({code:R().min(1).max(128),message:R().max(4096),details:Ic.optional()});Ks([U({ok:G(!0),value:Fc}),U({ok:G(!1),error:cf})]);let lf=U({id:R().min(1).max(1024),name:R().min(1).max(512),path:R().min(1).max(8192)});U({hosts:V(U({hostId:Wd,nodeId:Ud.optional(),displayName:R().min(1).max(120),online:B(),state:Zd,delegation:B(),projects:V(lf),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()}),Ks([U({operation:G(`hosts`)}),U({operation:sf,hostId:Wd,hopCount:z().int().min(0).max(16),timeoutMs:z().int().min(1).max(12e4).optional(),input:Ic})]);let uf=H({id:R().min(1).max(256),harnessId:R().min(1),label:R().min(1).max(512),provider:W([`openai-codex`,`xai`])}).strict(),df=R().regex(/^[a-z][a-z0-9-]{0,47}$/),ff=H({name:df,source:uf,importedAt:R()}).strict(),pf=Js(`action`,[H({action:G(`list`)}).strict(),H({action:G(`import`),sourceId:R().min(1).max(256),name:df,confirmed:G(!0)}).strict(),H({action:G(`reimport`),sourceId:R().min(1).max(256),name:df,confirmed:G(!0)}).strict(),H({action:G(`remove`),name:df,confirmed:G(!0)}).strict()]),mf=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(uf),targets:V(H({harnessId:R(),providers:V(W([`openai-codex`,`xai`])),imports:V(ff),others:V(mf).default([])}).strict())}).strict(),H({targetHarnessId:R().min(1).max(128).optional(),request:pf}).strict(),H({events:B()});let hf=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:hf.nullable()}),U({}),U({entries:hf,initializeOnly:B().optional()});let gf=U({enabled:B(),timeoutMinutes:z().int().min(5).max(1440)});Object.freeze({enabled:!0,timeoutMinutes:10});let _f=R().regex(/^external$/u),vf=Uc.transform(e=>String(e)),yf=U({model:ml.optional(),thinkingOptionId:gl.optional(),permissionModeId:qc.optional()}).refine(e=>!!(e.model||e.thinkingOptionId||e.permissionModeId),`A default configuration must contain a preference`);Js(`mode`,[U({mode:G(`global`)}),U({mode:G(`last`)}),U({mode:G(`manual`),harnessId:Uc})]);let bf=U({lastHarness:Uc.optional(),byHarness:ec(vf,yf)}),xf=U({model:ml.optional(),thinkingOptionId:gl.optional()}).refine(e=>!!(e.model||e.thinkingOptionId),`A delegation default must contain a Model or Thinking option`),Sf=U({byHarness:ec(vf,xf)}),Cf=R().min(1).max(1024),wf=U({idleRelease:gf.optional(),favorites:ec(vf,V(Cf).max(2048)).default({}),newThread:bf.optional(),delegation:Sf.optional()});U({scope:_f,revision:z().int().nonnegative(),values:wf}),U({scope:_f.default(`external`)});let Tf=Js(`kind`,[U({kind:G(`idleRelease`),value:gf}),U({kind:G(`favorite`),harnessId:Uc,modelId:Cf,enabled:B()}),U({kind:G(`favorites`),harnessId:Uc,modelIds:V(Cf).max(2048)}),U({kind:G(`newThread`),lastHarness:Uc.optional(),harnessId:Uc.optional(),configuration:yf.optional()}),U({kind:G(`delegation`),harnessId:Uc,configuration:xf.nullable()})]);U({scope:_f.default(`external`),operations:V(Tf).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:ec(_f,wf)});let Ef=z().finite().nonnegative(),Df=U({input:Ef,output:Ef,cacheRead:Ef.optional(),cacheWrite:Ef.optional(),cacheWrite1h:Ef.optional()}),Of=R().max(512).refine(e=>e.trim()===e&&e.length>0,`Model ID is required`);U({path:R(),entries:V(U({key:R(),price:Df})),error:R().nullable()}),U({}),U({key:Of,price:Df.nullable(),previousKey:Of.optional()}),U({model:Of});let kf=U({official:B().optional(),canonicalModelId:R().min(1).optional(),provider:R().min(1).max(512),model:R().min(1).max(512),price:Df});U({price:Df.nullable(),suggestions:V(kf).max(6).optional()});let Af=[`today`,`7d`,`30d`,`90d`,`all`],jf=z().int().min(0).max(2**53-1),Mf=R().regex(/^\d{4}-\d{2}-\d{2}$/u),Nf=R().min(1).max(128),Pf=R().min(1).max(512),Ff=R().min(1).max(4096);U({range:W(Af),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:Nf.optional(),model:Pf.nullable().optional(),project:Ff.nullable().optional(),date:Mf.optional()});let If=U({requests:jf,inputTokens:jf,cachedInputTokens:jf,cacheWriteInputTokens:jf,cacheKnownInputTokens:jf,cacheHitCachedInputTokens:jf,cacheHitInputTokens:jf,outputTokens:jf,reasoningOutputTokens:jf,costUsd:z().finite().min(0),unpricedRequests:jf,unmeteredRequests:jf}),Lf=If.shape,Rf=U({harness:Nf,sessionId:R().min(1).max(512),project:Ff.nullable(),title:R().min(1).max(200).optional(),models:V(Pf).max(16),firstAtMs:jf,lastAtMs:jf,...Lf});U({range:W(Af),from:Mf.nullable(),to:Mf,filters:U({harness:Nf.nullable(),model:Pf.nullable(),unknownModel:B(),project:Ff.nullable(),unknownProject:B(),date:Mf.nullable()}),reading:U({complete:B(),sources:jf,read:jf}),failures:V(U({harness:Nf,message:R().max(2048)})).max(256),options:U({harnesses:V(Nf).max(256),models:V(Pf.nullable()).max(4096),projects:V(Ff.nullable()).max(4096)}),modelLabels:V(U({harness:Nf,model:Pf,label:Pf})).max(4096).optional(),credits:V(U({harness:Nf,model:Pf.nullable(),credits:z().finite().min(0),reportedRequests:jf,requests:jf})).max(4096).optional(),totals:If,daily:V(U({date:Mf,harness:Nf,...Lf})).max(2e5),hourly:V(U({weekday:z().int().min(0).max(6),hour:z().int().min(0).max(23),...Lf})).max(168),byHarness:V(U({harness:Nf,...Lf})).max(256),byModel:V(U({model:Pf.nullable(),...Lf,harnessPricedRequests:jf})).max(4096),byProject:V(U({project:Ff.nullable(),...Lf})).max(4096),sessions:V(Rf).max(100),recentSessions:V(Rf).max(100).optional()}),H({threadId:Wc}),H({discarded:B()});let zf=Js(`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()})]),Bf=H({interactionId:R().min(1),turnId:R().min(1),title:R().optional(),questions:V(zf).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(Bf)}),U({threadId:R().min(1),turnId:R().min(1),interactionId:R().min(1),answers:ec(R(),V(R())),cancelled:B().default(!1)}),H({accepted:G(!0)});let Vf=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(Vf)}),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({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 Hf=W([`idle`,`running`,`busy`,`closing`,`failed`,`blocked`]),Uf=W([`none`,`disabled`,`timeout`,`operation`,`background`,`identity`,`persistence`,`closeFailed`]);U({threadId:R(),title:R(),harnessId:R(),state:Hf,reason:Uf,inactiveMs:z().nonnegative()}),U({threadId:Wc,turnId:Gc});let Wf=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:ll.optional(),balance:ul.optional()}).strict();function Gf(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 Kf=Gf(Wf),qf={harnessId:Uc,harnessName:R().trim().min(1).max(128)},Jf=H(qf).strict();H({}).strict(),H({sources:V(Jf).max(128)}).strict(),H({harnessId:Uc,refresh:B().optional()}).strict(),H({...qf,account:Kf.nullable(),accounts:V(Kf).max(8).optional()}).strict(),H({refresh:B().optional()}).strict(),H({accounts:V(Gf(Wf.extend(qf))).max(128)}).strict(),H({harnessId:jl,model:ml.optional(),thinkingOptionId:gl.optional(),permissionModeId:qc.optional(),prewarm:G(!0).optional()}).strict();let Yf=R().trim().min(1).max(4096).refine(e=>!/[\u0000\r\n]/u.test(e),`Invalid entrypoint path`);H({harnessId:jl}).strict().extend({path:Yf.nullable()}),H({path:Yf.nullable(),restartRequired:B()}).strict(),H({harnessId:Uc,action:W([`check`,`update`,`install`]),confirmedVersion:R().min(1).max(128).optional()}).strict().refine(({action:e,confirmedVersion:t})=>e===`update`||t===void 0);let Xf=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:_s().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:Vc.optional(),latestVersionKind:W([`unknown`,`tracking-branch`]).optional()}).strict();H({taskId:R().uuid()}).strict(),Js(`status`,[H({taskId:R().uuid(),status:G(`running`)}).strict(),H({taskId:R().uuid(),status:G(`succeeded`),result:Xf}).strict(),H({taskId:R().uuid(),status:G(`failed`),error:H({code:z().int(),message:R().min(1).max(2048)}).strict()}).strict()]);let Zf=R().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u),Qf=R().trim().min(1),$f=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`]),ep=H({accountId:Zf,label:Qf.max(256),email:R().email().max(320).optional(),planType:$f.optional()}).strict(),tp=W([`ready`,`unavailable`]);H({version:G(2),currentAccountId:Zf.nullable(),phase:tp,revision:z().int().nonnegative(),instanceId:Qf.max(1024).optional(),accounts:V(ep).max(1)}).strict(),H({accountId:Zf,refresh:B().optional()}).strict(),H({accountId:Zf,usage:rl.nullable(),accountCredits:ll.optional(),freshness:W([`live`,`cached`]),observedAt:R().datetime().nullable()}).strict();let np=1e3,rp=R().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),ip=rp.max(1024),ap=H({nativeSessionId:ip,title:rp.max(4096).nullable(),updatedAt:z().int().nonnegative().max(864e13),cwd:rp.max(16384),running:B().nullable()}).strict();H({}).strict(),H({harnesses:V(H({harnessId:jl,name:rp.max(128)}).strict()).max(128)}).strict(),H({harnessId:jl,query:R().trim().max(4096).refine(e=>!e.includes(`\0`)).optional(),offset:z().int().nonnegative().safe().optional(),limit:z().int().min(1).max(np).optional()}).strict(),H({candidates:V(ap).max(np),total:z().int().nonnegative().safe()}).strict(),H({harnessId:jl,nativeSessionId:ip}).strict(),H({threadId:rp.max(1024).pipe(Wc)}).strict();let op=R().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),sp=ip,cp=ap;H({}).strict(),H({candidates:V(cp).max(1e3)}).strict(),H({nativeSessionId:sp}).strict(),H({threadId:op.max(1024).pipe(Wc)}).strict(),H({threadId:Wc,lastTurnId:Gc}).strict(),H({threadId:Wc}).strict();let lp=R().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u).brand();H({commands:V(H({id:lp,invocation:R().min(1).max(128),label:R().trim().min(1).max(128),description:R().trim().min(1).max(512).optional(),localizations:Bc.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:Uc,cwd:R().min(1).optional()}).strict(),H({threadId:Wc}).strict(),H({threadId:Wc,commandId:lp,turnId:Gc.optional(),arguments:Ic.optional()}).strict(),H({accepted:G(!0),turnId:Gc.optional()}).strict();let up=G(`2.0`).optional(),dp=Hs().optional(),fp=R().min(1),pp=Ks([R(),z().int()]),mp=H({code:z().int(),message:R(),data:Fc.optional()}).catchall(Fc).superRefine(Ac([`data`]));Ks([H({jsonrpc:up,id:pp,method:fp,params:Fc.optional(),result:dp,error:dp}).catchall(Fc).superRefine(Ac([`jsonrpc`,`params`,`result`,`error`])),H({jsonrpc:up,id:dp,method:fp,params:Fc.optional(),result:dp,error:dp}).catchall(Fc).superRefine(Ac([`jsonrpc`,`id`,`params`,`result`,`error`])),H({jsonrpc:up,id:pp,method:dp,params:dp,result:Fc,error:dp}).catchall(Fc).superRefine(Ac([`jsonrpc`,`method`,`params`,`error`])),H({jsonrpc:up,id:pp,method:dp,params:dp,result:dp,error:mp}).catchall(Fc).superRefine(Ac([`jsonrpc`,`method`,`params`,`result`]))]);let hp=R().refine(e=>e.trim().length>0,{message:`Native identifier must not be empty or whitespace`});U({harnessId:Uc,nativeSessionId:hp,locator:Fc.optional(),formatVersion:G(1)}).superRefine(Ac([`locator`])),U({harnessId:Uc,nativeSessionId:hp,nativeTurnKey:hp,formatVersion:G(1)}),U({harnessId:Uc,nativeSessionId:hp,checkpointId:hp,locator:Fc.optional(),formatVersion:G(1)}).superRefine(Ac([`locator`]));let gp=R().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u),_p=W([`npm`,`windows-installer`,`macos-dmg`,`linux-archive`]),vp=W([`prepared`,`downloading`,`waiting-for-exit`,`installing`,`restarting`,`succeeded`,`failed`]),yp=U({completed:z().int().nonnegative(),total:z().int().positive()}).refine(e=>e.completed<=e.total,{path:[`completed`],message:`completed must not exceed total`}),bp=U({version:gp,installation:_p,phase:vp,updatedAt:z().int().nonnegative(),downloadedBytes:z().int().nonnegative().optional(),totalBytes:z().int().positive().optional(),npmDownload:yp.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 xp=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`),Sp=W([`idle`,`downloading`,`ready`,`failed`]),Cp=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:gp,installation:_p.nullable(),latestVersion:gp.nullable(),updateAvailable:B(),installationAvailable:B(),releaseNotes:R().min(1).max(2e4).nullable(),releaseNotesUrl:xp.nullable(),status:bp.nullable(),error:R().min(1).max(500).nullable(),stagedVersion:gp.nullable().optional(),backgroundPhase:Sp.optional(),backgroundDownload:Cp.nullable().optional(),backgroundError:R().min(1).max(500).nullable().optional(),runningTaskCount:z().int().nonnegative().optional()}),U({status:bp}),U({status:bp.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 wp=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)}),Tp=U({summary:R().min(1).max(600).optional(),themes:V(wp).min(1).max(12)}),Ep=U({version:gp,publishedAt:kc(),url:R().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u),zh:Tp.nullable(),en:Tp.nullable()}).refine(e=>e.zh!==null||e.en!==null,{message:`an announcement needs at least one language`});U({manual:B().optional()}),U({announcement:Ep.nullable(),unread:B()}),U({version:gp}),RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): `+`(${[`completed`,`failed`,`interrupted`,`needsInput`,`timedOut`,`unreadable`,`notFound`].join(`|`)})(?:\. (.+))?$`,`u`);let Dp=W([`idle`,`installing`,`restarting`,`succeeded`,`failed`]);H({runningVersion:R().nullable(),installedVersion:R().nullable(),restartRequired:B(),remote:B(),updateSupported:B(),update:H({phase:Dp,targetVersion:R().nullable(),error:R().nullable()})});let Op=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 K=R().min(1).max(1024),kp={hostId:K.regex(/^(?:remote-(?:ssh(?:-|:)|control:)|remote-peer:[a-zA-Z0-9_-]{1,64}$)/u)},Ap={...kp,threadId:K},jp=R().min(1).max(8e3),Mp={text:jp,requestId:K};Js(`accepted`,[H({accepted:G(!0),startQueuedItemId:K.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()})]),Js(`available`,[H({available:G(!1)}),H({available:G(!0),items:V(H({id:K,clientUserMessageId:K,preview:R().max(801)})).max(100)})]);let Np=Js(`kind`,[U({kind:G(`hosts`)}),U({kind:G(`create`),...kp,cwd:R().min(1).max(8192),epoch:K}),U({kind:G(`projectHarnesses`),...kp,epoch:K}),U({kind:G(`inspectHarness`),...kp,epoch:K,cwd:R().min(1).max(8192),harnessId:K}),U({kind:G(`startSelected`),...kp,epoch:K,cwd:R().min(1).max(8192),harnessId:K,model:R().min(1).max(4096),serviceTier:W([`priority`,`ultrafast`]).optional(),reasoningEffort:K.optional()}),U({kind:G(`status`),...Ap}),U({kind:G(`list`),...kp,cursor:R().nullable(),archived:B(),includeLoaded:G(!0).optional()}),U({kind:G(`read`),...Ap,page:U({cursor:R().min(1).max(8192).nullable(),epoch:K.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`),...Ap,epoch:K}),U({kind:G(`configure`),...Ap,epoch:K,modelId:K.optional(),serviceTier:pl.optional(),thinkingOptionId:K.optional(),permissionModeId:K.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`),...Ap,epoch:K,text:jp,requestId:K.optional()}),U({kind:G(`queue`),...Ap,epoch:K}),U({kind:G(`delivery`),...Ap,epoch:K,action:Js(`kind`,[U({kind:G(`enqueue`),...Mp}),U({kind:G(`steer`),...Mp,turnId:K}),U({kind:G(`remove`),itemId:K}),U({kind:G(`start`),itemId:K,onlyIfHead:G(!0).optional()}),U({kind:G(`sendNow`),itemId:K})])}),U({kind:G(`interrupt`),...Ap,epoch:K,turnId:K}),U({kind:G(`rename`),...Ap,epoch:K,name:R().min(1).max(512)}),U({kind:G(`archive`),...Ap,epoch:K,archived:B()}),U({kind:G(`respond`),...Ap,epoch:K,requestId:Ks([K,z().int()]),result:ec(R(),Bs())})]),Pp=R().min(1).max(1024),Fp=H({hostId:Pp,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()}),Ip=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()});Js(`action`,[U({action:G(`session`),operation:Np}),U({action:G(`list`)}),U({action:G(`catalog`)}),U({action:G(`read-thread`),hostId:Pp.refine(e=>e!==`local`),input:Bd}),U({action:G(`save`),draft:Ip,previous:Fp.nullable()}),U({action:G(`remove`),previous:Fp}),U({action:G(`connect`),hostId:Pp,enabled:B()}),U({action:G(`state`),hostId:Pp}),U({action:G(`runtime`),hostId:Pp}),U({action:G(`update`),hostId:Pp.refine(e=>e!==`local`),version:Op.shape.version})]),Ks([U({result:Fc}),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 Lp=R().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u),Rp=Ks([R(),H({en:R()}).catchall(R())]),zp=H({title:Rp.optional(),description:Rp.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:Lp,name:R().min(1).max(214),version:R().min(1).max(128),format:G(`dsh`),supportedTargets:Qs([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:zp.optional(),loadError:R().optional()})),loadedIds:V(Lp),safeMode:B(),storeError:R().optional()});let Bp=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:Bp.optional()}).strict(),H({id:Lp,enabled:B()}).strict(),H({id:Lp}).strict(),G(1);function Vp(e){return e?.projectionValues?.remoteHost?.hostId}function Hp(e){return e===void 0?!1:Vp(e)!==void 0||String(e.id).startsWith(`web-remote:`)}function Up(e){if(e===void 0)return!1;let t=Vp(e);return t===void 0?!String(e.id).startsWith(`web-remote:`):t.startsWith(`remote-peer:`)}function Wp(e){return e!==void 0&&!Hp(e)}function Gp(e){return Up(e)}function Kp(){let e=(0,r.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 qp(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`)}:Wp(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 Jp(e){return e}function Yp(e){return Jp(e)}let Xp={'"':`"`,"\\":`\\`,"/":`/`,b:`\b`,f:`\f`,n:`
|
|
114
|
+
`,r:`\r`,t:` `},Zp=/[\\\u0000-\u001f]/u;function Qp(e){return e===` `||e===`
|
|
115
|
+
`||e===`\r`||e===` `}function $p(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(Zp),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++)$p(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=Xp[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&&Zp.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(Qp(e))return;if(e===`{`){this.#r=`key-or-end`;return}this.fail();return;case`key-or-end`:if(Qp(e))return;if(e===`}`){this.#r=`closed`;return}if(e===`"`){this.beginKey(t);return}this.fail();return;case`key-only`:if(Qp(e))return;if(e===`"`){this.beginKey(t);return}this.fail();return;case`key`:this.stepKey(e,t);return;case`colon`:if(Qp(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(Qp(e))return;if(e===`,`){this.#r=`key-only`;return}if(e===`}`){this.#r=`closed`;return}this.fail();return;case`closed`:if(Qp(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:
|
|
119
|
+
default:em(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){Qp(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===`}`||Qp(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 em(e,t){let n=JSON.stringify(e)??String(e);throw Error(`unreachable variant${t?` in ${t}`:``}: ${n}`)}function tm(e){return/^[A-Za-z]:[/\\]/.test(e)||e.startsWith(`\\\\`)}function nm(e,t){if(t===void 0||t===``||tm(e)||tm(t))return e;let n=t.replace(/\/+$/,``);return n===``||n===`/`?e:e.replace(/\/+$/,``)===n?`~`:e.startsWith(`${n}/`)?`~${e.slice(n.length)}`:e}function rm(e){let t=e.replace(/[/\\]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return t.slice(n+1)}let im=/^remote-(?:peer:|ssh(?:-|:)|control:).+/u;function am(e){let t=e.projectionValues?.threadReference;if(!e.blank&&t?.hostId&&(t.hostId===`local`||im.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 om(e){return`thread://${encodeURIComponent(e.threadId).replace(/[!'()*]/gu,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}?hostId=${encodeURIComponent(e.hostId)}`}function sm(e){let t=`[@${e.title.replace(/[\\`*{}[\]()#+.!_<>|~-]/gu,e=>`\\${e}`)}](${om(e)})`;return{source:`codexhost-thread`,ref:t,label:e.title,appearance:`session`,clipboardText:t}}function cm(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 lm(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 um(e,t){return e.find(e=>e.sessionIds.includes(t))?.workspaceId??``}function dm(e){return Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id}function fm(e){if(e===void 0||e===``)return``;let t=rm(e);return t===``?e:t}function pm(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 mm(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 pm([...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 hm(e,t){return t===void 0?[...e]:[t,...e.filter(e=>e!==t)]}function gm(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 Qp(n)}}function hm(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 gm(e){return e.blank?``:e.title?.trim()??``}function _m(e){let t=Date.parse(e);return Number.isFinite(t)&&t>0?t:void 0}function vm(e,t,n,r,i,a,o){return{key:e,workspaceId:t,cwd:n,createdAt:r,label:i,sessions:[...a],remote:o}}function ym(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&&mm(s,n,r)&&(t.push(s),i.has(o)&&a.add(o))}(r!==`only`||t.length!==0)&&o.push(vm(s.workspaceId,s.workspaceId,s.path,_m(s.createdAt),s.title,t,s.remote))}let s=dm(e.ids.filter(e=>!a.has(e)),e.byId).map(t=>e.byId[t]).filter(e=>e!==void 0&&mm(e,n,r));return s.length>0&&o.push(vm(``,void 0,void 0,void 0,``,s)),o}function bm(e){switch(e){case`approval`:case`plan-review`:case`question`:return e;default:return}}function xm(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 Sm(e,t,n){let r=n.get(e.id),i=bm(r?.pendingInteraction?.kind),a=r?.running??e.running,o=xm(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 Cm(e,t,n,r,i){let a=Sm(e,t,n),o=i.has(e.id);return{id:e.id,reference:rm(e),remote:e.projectionValues?.remoteHost??void 0,title:gm(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 wm(e,t){let n=e.projectionValues?.threadTreeParent??null;if(n===null)return null;let r=t?.byId[qp(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 Tm(e,t,n){let r=new Set(t.archivedSessionIds),i=new Set(t.pinnedSessionIds);return om(Om(e,t.archivedSessionIds,t.archivedFilter).flatMap(t=>{let a=e.byId[t];return a===void 0?[]:[Cm(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:wm(r,e)})}function Em(e,t,n,r,i,a){let o=new Set(n.archivedSessionIds),s=new Set(n.pinnedSessionIds),c=new Set(i.expandedGroups),l=lm(e),u=a??new Map(Tm(e,n,r).map(e=>[e.id,e])),d=[];for(let r of ym(e,t,o,n.archivedFilter)){let e=c.has(r.key),t=r.sessions.flatMap(e=>{let t=u.get(e.id);return t===void 0||i.excludePinned&&(t.pinned||n.sectionedSessionIds?.has(t.id))?[]:[t]});r.key===``&&t.sort((e,t)=>(t.tree?.updatedAt??t.updatedAt)-(e.tree?.updatedAt??e.updatedAt)||e.id.localeCompare(t.id));let a={running:0,pendingInteraction:0,completed:0};for(let e of t)e.archived||(a.running+=Number(e.running||e.runningSubagentCount>0)+(e.tree?.activity.running??0),a.pendingInteraction+=Number(e.pendingInteraction!==void 0)+(e.tree?.activity.pendingInteraction??0),a.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:t.length,expanded:e,activity:a,containsCurrent:t.some(e=>e.id===l||l!==void 0&&e.tree?.descendantIds.includes(l)),sessions:e?hm(t,s,o):[]})}return d}function Dm(e,t=[]){return[...Om(e,[],`show`),...t.filter(t=>e.byId[t]===void 0)]}function Om(e,t,n){let r=new Set(t);return e.ids.filter(t=>{let i=e.byId[t];return i!==void 0&&mm(i,r,n)})}function km(e,t,n,r,i){if(t.length===0)return[];let a=new Set(n.archivedSessionIds),o=new Set(n.pinnedSessionIds),s=i??new Map(Tm(e,n,r).map(e=>[e.id,e]));return hm(t.flatMap(e=>{let t=s.get(e);return t===void 0?[]:[t]}),o,a)}function Am(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)??um(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&&mm(n,l,i)&&(gm(n).toLowerCase().includes(c)||d(n).toLowerCase().includes(c))&&p.push(n)}let m=new Map(p.map(e=>[e.id,e])),h=dm(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&&mm(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=bm(r?.pendingInteraction?.kind),o=wm(t,e);return{id:t.id,title:gm(t),workspace:d(t),...o===null?{}:{parentTitle:e.byId[qp(o)]?.title??``},remote:t.projectionValues?.remoteHost??void 0,running:r?.running??t.running,runningSubagentCount:xm(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 jm(e){return(/^[A-Za-z]:[/\\]/.test(e)||e.startsWith(`\\\\`)?e.replaceAll(`\\`,`/`):e).replace(/\/+$/,``)}function Mm(e,t){let n=jm(e),r,i=-1;for(let e of t){let t=jm(e);t.length>i&&n!==t&&n.startsWith(`${t}/`)&&(r=e,i=t.length)}return r}let Nm=`__flat_session_order__`,Pm=`pinned`,Fm=`workspaces`;function Im(e,t){return e?.[t]??!0}function Lm(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 Rm(){return(0,r.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`?Lm(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,Lm(t,e.sessionOrderByAccount,n))},setSessionOrder:(e,t,n,r,i)=>{let a=Lm({...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=Lm(Object.fromEntries(Object.entries(r.members).map(([t,n])=>[t,fm(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 zm(e,t,n){let r=n??Tm(e,t,/* @__PURE__ */ new Map),i=new Set(Om(e,t.archivedSessionIds,t.archivedFilter)),a=/* @__PURE__ */ new Set([...r.map(e=>e.id),...Dm(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(qp(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 Bm(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 Vm(e,t,n,r){let i=r??zm(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,Bm(e.sessionIds,i).memberIds]),[``,a([.../* @__PURE__ */ new Set([...t.ids,...n.archivedSessionIds])]).filter(e=>!o.has(e))],[Nm,a(Dm(t,n.archivedSessionIds))]]),summaries:i.summaries,rowState:n}}function Hm(e,t){return[cm(e,t),Nm]}var Um=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 Wm=`codexhost.web.session-tabs.v2:local`,Gm=`codexhost.web.session-tabs.v1:local`,Km=`codexhost.web.recent-visits.v1:local`,qm=1048576;function Jm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ym(e){return typeof e==`string`&&e.length>0&&e.length<=1024&&e.trim()===e&&!/[\u0000-\u001f\u007f]/u.test(e)?qp(e):void 0}function Xm(e,t){if(typeof e==`string`)return e===t?t:void 0;if(!Jm(e)||Object.keys(e).length!==3)return;let n=Ym(e.parentSessionId),r=Ym(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 Zm(e,t){if(e===null||e.length>qm)return[];try{let n=JSON.parse(e);if(!Jm(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(!Jm(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=Ym(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=Xm(e.target,o);c!==void 0&&(i.add(o),r.push({sessionId:o,target:c,lastVisitedAt:s}))}return r}catch{return[]}}var Qm=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>qm){this.failed();return}localStorage.getItem(Wm)!==i&&localStorage.setItem(Wm,i),localStorage.removeItem(Gm),localStorage.removeItem(Km)}catch{this.failed()}}latest(){let e=localStorage.getItem(Wm);return e===null?Zm(localStorage.getItem(Gm)??localStorage.getItem(Km),1):Zm(e,2)}failed(){if(!this.reported){this.reported=!0;try{this.onFailure()}catch{}}}},$m=class{sessions;workspaces;subscribeRemoved;entries=(0,r.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 Qm(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=Sm(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)||eh(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 eh(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)}var th=class extends Error{rpcError;name=`DirectoryBrowseError`;constructor(e){super(`directory browse failed: ${e.code}: ${e.message}`),this.rpcError=e}},nh=class extends i.Service{directoryPicker;workspaces;sessions;view;notify;connecting=/* @__PURE__ */ new Map;lifetime=new AbortController;selection=(0,r.createSnapshotStore)({},{persist:{name:`dsh.sessions.current`}});mainReference;mainIsRemote=!1;disposeMainSessionWatch;opening=(0,r.createSnapshotStore)({state:`idle`});retryOpen;openingLoad;creating=(0,r.createSnapshotStore)({state:`idle`});retryCreate;creatingLoad;creationToken=0;openedProjectlessBlank;keepalive;recentVisits;constructor(e,t,n,r,i,a){super(e,`uiWorkspace`),this.directoryPicker=t,this.workspaces=n,this.sessions=r,this.view=i,this.notify=a,this.keepalive=new Um(r,n);let o=e.get(`remote`);this.recentVisits=new $m(r,n,o===void 0?void 0:e=>o.$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;let e=this.mainReference;this.mainReference=void 0,this.mainIsRemote=!1,e?.release()}},`ui-workspace: Workspace navigation policy`)}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){let t=this.workspaces.list.getSnapshot().archivedSessionIds,n=this.sessions.list.getSnapshot();for(let r of n.ids){let i=n.byId[r];if(i===void 0||!i.blank||i.cwd!==e.path||!e.sessionIds.includes(r)||t.includes(r))continue;let a=await this.tryReuseBlank(e.workspaceId,r);if(a!==void 0)return a}return this.sessions.create({workspaceId:e.workspaceId})}async reuseOrCreateProjectlessBlank(){let e=this.workspaces.list.getSnapshot(),t=this.sessions.list.getSnapshot(),n=n=>{let r=t.byId[n];return r!==void 0&&r.blank&&r.cwd===void 0&&r.parentId===void 0&&r.origin===void 0&&!this.isRemoteSession(n)&&!e.archivedSessionIds.includes(n)&&!e.items.some(e=>e.sessionIds.includes(n))},r=this.openedProjectlessBlank,i=r!==void 0&&n(r)?r:t.ids.find(n);return(i===void 0?void 0:await this.tryReuseBlank(void 0,i))??this.sessions.create()}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}={}){let r=e===void 0?{}:{workspaceId:e};try{return await this.sessions.create({...r,sessionId:t,...!n&&e!==void 0?{matchProjectDefault:!0}:{}})}catch(e){let t=rh(e)?.rpcError.code;if(t!==`session/writer-held`&&(n||t!==`session/busy`))throw e;return}}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=ih(n)===`remote/offline`;if(i!==void 0&&(s||ah(n))){o(),i(s?{message:lh(n)}:void 0);return}this.retryOpen=r,this.opening.set({state:`error`,sessionId:e,message:lh(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=AbortSignal.any([this.ctx.layout.beginNavigation(),this.lifetime.signal]),r;try{if(e===null&&!this.workspaces.list.getSnapshot().canStartProjectless)throw new oh;r=e===null?await this.reuseOrCreateProjectlessBlank():await this.connectWorkspace(e)}catch(e){throw n.aborted||this.notify({kind:`createFailed`,message:lh(e)}),e}n.aborted||(e===null?this.openProjectlessBlank(r,n,`reveal`,t):this.replaceMain(r,n,`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`?uh(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 oh;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=sh(r),a=i===`unknown`?ch(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,Hm(t,e),Vm(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 th(n.error);return n.value}async createDirectory(e,t){let n=await this.directoryPicker.createDirectory(e,t);if(!n.ok)throw new th(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??uh(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 rh(e){return e instanceof Error&&e.name===`SessionCreateError`?e:void 0}function ih(e){if(typeof e==`object`&&e&&`isDSHRemoteError`in e&&e.isDSHRemoteError===!0&&`code`in e)return e.code}function ah(e){let t=ih(e);return t===`session/not-found`||t===`remote/not-found`||t===`remote/identity-invalid`}var oh=class extends Error{name=`WorkspaceRequiredError`;constructor(){super(`This Host requires a Workspace.`)}};function sh(e){return rh(e)?.rpcError.code===`host/no-harness`?`no-harness`:e instanceof oh?`workspace-required`:`unknown`}function ch(e){let t=rh(e),n=(t===void 0?e instanceof Error?e.message:String(e):t.rpcError.message).trim();return n===``?void 0:n}function lh(e){let t=rh(e);return t===void 0?e instanceof Error?e.message:String(e):`${t.rpcError.code}: ${t.rpcError.message}`}function uh(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 dh=`@deepseek-ai/dsh-client-ui-workspace/PhoneHeaderNewSession.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(dh)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=dh,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 fh={button:`--73Qq_button`,icon:`--73Qq_icon`};function ph({startSession:e,useShortcuts:t,t:n}){let r=t(e=>e.find(e=>e.id===`session.new`));return/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:n(`actions.newSession`),shortcutKeys:r?.keys,side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:fh.button,"aria-label":n(`actions.newSession`),"aria-keyshortcuts":r?.aria,"data-phone-new-session":!0,onClick:()=>{e()},children:/* @__PURE__ */ (0,o.jsx)(a.IconNewChatOutlineRegular,{size:17,className:fh.icon})})})}let mh=`@deepseek-ai/dsh-client-ui-workspace/RecentShortcut.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(mh)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=mh,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_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 hh={activity:`oOF3UG_activity`,close:`oOF3UG_close`,identity:`oOF3UG_identity`,select:`oOF3UG_select`,shortcut:`oOF3UG_shortcut`,title:`oOF3UG_title`};function gh({visit:e,summary:t,identity:n,activityLabel:r,activity:i,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:hh.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:hh.select,onMouseDown:e=>e.preventDefault(),title:t.displayTitle,"aria-current":c?`page`:void 0,"aria-label":[t.displayTitle,t.id,r].filter(Boolean).join(` · `),onClick:()=>{c||(p(),d(e.target))},children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:hh.identity,children:n}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:hh.title,children:t.displayTitle}),i!=null&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:hh.activity,title:r,children:i})]}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:hh.close,onMouseDown:e=>e.preventDefault(),"aria-label":l,title:u,onClick:()=>{p(),f(e.sessionId)},children:/* @__PURE__ */ (0,o.jsx)(a.IconCloseOutlineRegular,{size:12})})]})}let _h=`@deepseek-ai/dsh-client-ui-workspace/Rows.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(_h)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=_h,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_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]){width:14px;color:inherit}._5OaiBG_sessionRow:has([data-harness-id]) ._5OaiBG_title,._5OaiBG_searchResultHeading:has([data-harness-id]) ._5OaiBG_searchResultTitle{margin-left:8px}._5OaiBG_statusOverlay{display:contents}._5OaiBG_slot:has([data-harness-id]) ._5OaiBG_statusOverlay{transform-origin:100% 100%;display:inline-flex;position:absolute;bottom:-3px;right:-3px;transform:scale(.65)}._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 q={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 vh(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 yh(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 yh(e){throw Error(`unknown pending interaction: ${String(e)}`)}function bh({statuses:e}){return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.StateDot,{state:e[0].state,size:e[0].state===`ongoing`?16:void 0}),e.map(e=>/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.visuallyHidden,children:e.label},e.label))]})}let xh=`@deepseek-ai/dsh-client-ui-workspace/RecentNavigation.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(xh)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=xh,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 Sh={clear:`qXmkFa_clear`,expanded:`qXmkFa_expanded`,shortcuts:`qXmkFa_shortcuts`,trigger:`qXmkFa_trigger`};function Ch({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:vh(Sm(t,o,c),i)}]})}function wh(e){let{useRecentNavigationSettings:t,open:n,close:r,closeAll:i,viewport:c,restoreNavigationFocus:l,renderSlot:u,t:d}=e,f=t(e=>e.value?.showRecentVisits??!0),p=Ch(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:Sh.shortcuts,"aria-label":d(`recent.navigation`),onScroll:e=>v(e.currentTarget),children:[p.map(({visit:t,summary:i,statuses:a})=>/* @__PURE__ */ (0,o.jsx)(gh,{visit:t,summary:i,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)(bh,{statuses:a}),active:e.sessionId===t.sessionId,closeLabel:d(`recent.close`,{name:i.displayTitle}),closeHint:d(`recent.closeHint`),open:e=>{v(),n(e)},close:e=>{v();try{r(e)}catch{_(!0)}},restoreNavigationFocus:l},t.sessionId)),p.length>=3&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Sh.clear,"aria-label":d(`recent.clearAll`),title:d(`recent.clearAllHint`),onMouseDown:e=>e.preventDefault(),onClick:()=>{l();try{i()}catch{_(!0)}},children:d(`recent.clear`)})]}),g&&/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:d(`recent.closeFailed`),onDone:()=>_(!1)})]}):null}function Th(e){let{useRecentNavigationSettings:t,setEnabled:n,t:r}=e,i=t(e=>e.value?.showRecentVisits??!0),c=Ch(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:Sh.trigger,"aria-label":r(i?`recent.collapse`:`recent.expand`),"aria-expanded":i,"aria-disabled":l||void 0,"aria-busy":l||void 0,onClick:()=>{p.current||(p.current=!0,u(!0),f(!1),n(!i).then(e=>f(!e)).catch(()=>f(!0)).finally(()=>{p.current=!1,u(!1)}))},children:/* @__PURE__ */ (0,o.jsx)(a.IconChevronDownOutlineRegular,{size:14,className:i?Sh.expanded:void 0})}),d&&/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:r(`recent.settings.error`),onDone:()=>f(!1)})]})}function Eh(e){return e==null}function Dh(e){return e&&typeof e==`object`&&!Array.isArray(e)}function Oh(e,t){return Object.fromEntries(Object.entries(e).filter(([e,n])=>t(e,n)))}function kh(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n,e)]))}function Ah(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 jh=Symbol.for(`cosmokit.volatile.write`);function Mh(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=>Mh(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,Mh(n,t)])))}finally{t.delete(e)}}function Nh(e){let t=Mh(e);return Object.freeze({get:()=>t,[jh]:e=>{t=e}})}function Ph(e){return typeof e==`object`&&!!e&&jh in e}function Fh(e,t){return arguments.length===1?t=>Fh(e,t):e in globalThis&&t instanceof globalThis[e]||Object.prototype.toString.call(t).slice(8,-1)===e}function Ih(e){return Fh(`ArrayBuffer`,e)||Fh(`SharedArrayBuffer`,e)}function Lh(e){return Ih(e)||ArrayBuffer.isView(e)}let Rh;(function(e){e.is=Ih,e.isSource=Lh;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})(Rh||={}),Rh.fromBase64,Rh.toBase64,Rh.fromHex,Rh.toHex;function zh(e,t=/* @__PURE__ */ new Map){if(!e||typeof e!=`object`)return e;if(Fh(`Date`,e))return new Date(e.valueOf());if(Fh(`RegExp`,e))return new RegExp(e.source,e.flags);if(Ih(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(zh,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(zh,null,[i.value,t])),Reflect.defineProperty(r,n,i)}return r}function Bh(e,t,n){let r=/* @__PURE__ */ new Set;function i(e,t){if(e===t)return!0;if(Ph(e)||Ph(t))return Ph(e)&&Ph(t);if(!n&&Eh(e)&&Eh(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(Fh(`Date`),(e,t)=>e.valueOf()===t.valueOf())??a(Fh(`URL`),(e,t)=>e.href===t.href)??a(Fh(`RegExp`),(e,t)=>e.source===t.source&&e.flags===t.flags)??a(Ih,(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 Vh;(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})(Vh||={});let Hh=Symbol.for(`schemastery`),Uh=Symbol.for(`ValidationError`);globalThis.__schemastery_index__??=0,globalThis.__schemastery_refs__=void 0;var J=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?.[Uh]}};Object.defineProperty(J.prototype,Uh,{value:!0});let Y=function(e){let t=function(e,n={}){return Y.resolve(e,t,n)[0]};if(e.refs){let t=kh(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&&kh(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[Hh]=!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(J.is(e))return{issues:[{message:e.message,path:e.options.path}]};throw e}}}}}),Y.ValidationError=J,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 Wh(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 Gh(e){return e?.$value??e?.$inner}function Kh(e){return Oh(e??{},e=>!e.startsWith(`$`))}Y.prototype.i18n=function(e){let t=Y(this),n=Wh(t.meta.description,e);return Object.keys(n).length&&(t.meta.description=n),t.dict&&=kh(t.dict,(t,n)=>t.i18n(kh(e,e=>Gh(e)?.[n]??e?.[n]))),t.list&&=t.list.map((t,n)=>t.i18n(kh(e,(e={})=>Array.isArray(Gh(e))?Gh(e)[n]:Array.isArray(e)?e[n]:Kh(e)))),t.inner&&=t.inner.i18n(kh(e,e=>Gh(e)?Gh(e):Kh(e))),t.sKey&&=t.sKey.i18n(kh(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=Ah(e,[`source`,`flags`]);return t.meta={...t.meta,pattern:n},t},Y.prototype.simplify=function(e){if(Ph(e)&&(e=e.get()),Bh(e,this.meta.default,this.type===`dict`))return null;if(Eh(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`||!Eh(r))&&(t[n]=r)}return Bh(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 tg[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 qh={},Jh=Symbol(`checked-volatile-schema`);function Yh(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 J(`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))Yh(i,[...t,n],a,r);if(e.sKey&&Yh(e.sKey,[...t,`<key>`],!0,r),e.inner&&(e.type!==`lazy`||e.inner[Hh])&&Yh(e.inner,[...t,`*`],!0,r),e.list)for(let n=0;n<e.list.length;n++)Yh(e.list[n],[...t,String(n)],!0,r)}Y.extend=function(e,t){qh[e]=t},Y.resolve=function(e,t,n={},r=!1){if(!t)return[e];if(n[Jh]||(Yh(t,n.path),n={...n,[Jh]:!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[Nh(a),o]}catch(e){throw new J(e instanceof Error?e.message:String(e),n)}}if(n.ignore?.(e,t))return[e];if(Eh(e)&&t.type!==`lazy`){if(t.meta.required)throw new J(`missing required value`,n);let r=t,i=t.meta.default;for(;r?.type===`intersect`&&Eh(i);)r=r.list[0],i=r?.meta.default;if(Eh(i))return[e];e=zh(i)}let i=qh[t.type];if(!i)throw new J(`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(Eh(e))return Y.any();if([`string`,`number`,`boolean`].includes(typeof e))return Y.const(e).required();if(e[Hh])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[Hh]||(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 J(`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 J(e.message,n)}},!0)])},Y.arrayBuffer=function(e){return Y.union([Y.is(ArrayBuffer),Y.is(SharedArrayBuffer),Y.transform(Y.any(),(e,t)=>{if(Rh.isSource(e))return Rh.fromSource(e);throw new J(`expected ArrayBufferSource but got ${e}`,t)},!0),...e?[Y.transform(Y.string(),(t,n)=>{try{return e===`base64`?Rh.fromBase64(t):Rh.fromHex(t)}catch(e){throw new J(e.message,n)}},!0)]:[]])},Y.extend(`lazy`,(e,t,n,r)=>(t.inner[Hh]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta},Yh(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 J(`expected nullable but got ${e}`,n)}),Y.extend(`const`,(e,{value:t},n)=>{if(Bh(e,t))return[t];throw new J(`expected ${t} but got ${e}`,n)});function Xh(e,t,n,r,i=!1){let{max:a=1/0,min:o=-1/0}=t;if(e>a)throw new J(`expected ${n} <= ${a} but got ${e}`,r);if(e<o&&!i)throw new J(`expected ${n} >= ${o} but got ${e}`,r)}Y.extend(`string`,(e,{meta:t},n)=>{if(typeof e!=`string`)throw new J(`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 J(`expect string to match regexp ${r}`,n)}return Xh(e.length,t,`string length`,n),[e]});function Zh(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 Qh(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(Zh(e,i)-Zh(t,i))%Zh(n,i)===0}Y.extend(`number`,(e,{meta:t},n)=>{if(typeof e!=`number`)throw new J(`expected number but got ${e}`,n);Xh(e,t,`number`,n);let{step:r}=t;if(r&&!Qh(e,t.min??0,r))throw new J(`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 J(`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 J(`expected string but got ${e}`,r);e in t&&(i|=t[e])}}else throw new J(`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 J(`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 J(`expected ${t.name} but got ${e}`,n)}{if(Eh(e))throw new J(`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 J(`expected ${t} but got ${e}`,n)}});function $h(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?Nh(n.meta.default):n.meta.default}}Y.extend(`array`,(e,{inner:t,meta:n},r)=>{if(!Array.isArray(e))throw new J(`expected array but got ${e}`,r);return Xh(e.length,n,`array length`,r,!Eh(t.meta.default)),[e.map((n,i)=>$h(e,i,t,r))]}),Y.extend(`dict`,(e,{inner:t,sKey:n},r,i)=>{if(!Dh(e))throw new J(`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]=$h(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 J(`expected array but got ${e}`,n);let i=t.map((t,r)=>$h(e,r,t,n));return r||i.push(...e.slice(t.length)),[i]});function eg(e,t){for(let n in t)n in e||(e[n]=t[n])}Y.extend(`object`,(e,{dict:t},n,r)=>{if(!Dh(e))throw new J(`expected object but got ${e}`,n);let i={};for(let r in t){let a=$h(e,r,t[r],n);(!Eh(a)||r in e)&&(i[r]=a)}return r||eg(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 J(`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(!Eh(t)){if(Eh(a))a=t;else if(typeof a!=typeof t)throw new J(`expected ${n()} but got ${JSON.stringify(e)}`,r);else if(typeof t==`object`)eg(a??={},t);else if(a!==t)throw new J(`expected ${n()} but got ${JSON.stringify(e)}`,r)}}return!i&&Dh(e)&&eg(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 tg={};function ng(e,t,n){tg[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=kh(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}})}ng(`is`,[`constructor`],({constructor:e})=>typeof e==`function`?e.name:e),ng(`any`,[],()=>`any`),ng(`never`,[],()=>`never`),ng(`const`,[`value`],({value:e})=>typeof e==`string`?JSON.stringify(e):e),ng(`string`,[],()=>`string`),ng(`number`,[],()=>`number`),ng(`boolean`,[],()=>`boolean`),ng(`bitset`,[`bits`],()=>`bitset`),ng(`function`,[],()=>`function`),ng(`array`,[`inner`],({inner:e})=>`${e.toString(!0)}[]`),ng(`dict`,[`inner`,`sKey`],({inner:e,sKey:t})=>`{ [key: ${t.toString()}]: ${e.toString()} }`),ng(`tuple`,[`list`],({list:e})=>`[${e.map(e=>e.toString()).join(`, `)}]`),ng(`object`,[`dict`],({dict:e})=>Object.keys(e).length===0?`{}`:`{ ${Object.entries(e).map(([e,t])=>`${e}${t.meta.required?``:`?`}: ${t.toString()}`).join(`, `)} }`),ng(`union`,[`list`],({list:e},t)=>{let n=e.map(({toString:e})=>e()).join(` | `);return t?`(${n})`:n}),ng(`intersect`,[`list`],({list:e})=>`${e.map(e=>e.toString(!0)).join(` & `)}`),ng(`transform`,[`inner`,`callback`,`preserve`],({inner:e},t)=>e.toString(t));let rg=[0,15,30,60,120,240,1440],ig={showRecentVisits:!0,tabIdleTimeoutMinutes:60},ag={showRecentVisits:Y.boolean().default(!0),tabIdleTimeoutMinutes:Y.natural().max(1440).default(60)},og=`@deepseek-ai/dsh-client-ui-workspace/RecentNavigationRow.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=`._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 sg={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 cg({usePreference:e,setEnabled:t,setIdleTimeout:n,t:r}){let i=e(e=>e.value),c=i?.showRecentVisits??!0,l=i?.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?r(`recent.timeout.off`):e>=120&&e%60==0?r(`recent.timeout.hours`,{n:e/60}):r(`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:sg.row,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:sg.text,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:sg.titleLine,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:sg.title,children:r(`recent.settings.title`)}),/* @__PURE__ */ (0,o.jsx)(a.Tag,{tone:`neutral`,children:r(`recent.settings.mobile`)})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:sg.description,children:r(`recent.settings.description`)})]}),/* @__PURE__ */ (0,o.jsx)(a.Switch,{checked:c,disabled:f,label:`${r(`recent.settings.title`)} · ${r(`recent.settings.mobile`)}`,onChange:e=>y(()=>t(e))})]}),c&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:`${sg.row} ${sg.timeoutRow}`,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:sg.text,children:/* @__PURE__ */ (0,o.jsx)(`div`,{className:sg.title,id:`${_}-label`,children:r(`recent.timeout.title`)})}),/* @__PURE__ */ (0,o.jsx)(a.Menu,{className:sg.menu,open:u&&c&&!f,onClose:()=>d(!1),items:rg.map(e=>({id:String(e),label:e===60?r(`recent.timeout.default`,{value:v(e)}):v(e)})),selectedId:String(l),onSelect:e=>{let t=rg.find(t=>String(t)===e);t!==void 0&&y(()=>n(t))},align:`end`,portal:!0,anchor:/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:sg.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)(a.IconChevronDownOutlineRegular,{size:14})]})})]}),m&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:sg.error,role:`alert`,children:r(`recent.settings.error`)})]})}function lg(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}})},ph)),e.slots.inject(`conversation.header.navigation`,()=>e.slots.register({name:`conversation.header.navigation`,locale:`workspace`,inject:o},Th)),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`}}},wh)),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})},cg))}let ug=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeStyle.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(ug)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=ug,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 dg={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 fg=[`summary`,`ring`];function pg(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 mg({style:e,setStyle:t,t:n,settings:r=!1}){let i=(0,s.useId)(),{busy:c,failed:l,save:u}=pg(t);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:r?a.preferenceRowStyles.row:dg.options,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:`${a.preferenceRowStyles.rowText} ${r?dg.settingsText:``}`,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:a.preferenceRowStyles.title,id:i,children:n(`threadTree.style.title`)}),r&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:a.preferenceRowStyles.description,id:`${i}-description`,children:n(`threadTree.style.description`)})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:a.preferenceRowStyles.choices,role:`radiogroup`,"aria-labelledby":i,"aria-describedby":r?`${i}-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:fg.map(t=>/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,role:`radio`,className:a.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:dg.error,role:`alert`,children:n(`threadTree.style.error`)})]})}function hg({usePreference:e,setStyle:t,t:n}){let r=e(e=>e.value?.threadTreeCollapseStyle??`summary`);return/* @__PURE__ */ (0,o.jsx)(mg,{style:r,setStyle:t,t:n,settings:!0})}let gg={...ig,threadTreeCollapseStyle:`summary`},_g=Y.object({...ag,threadTreeCollapseStyle:Y.union([`summary`,`ring`]).default(`summary`)});function vg(e){return typeof e==`object`&&!!e&&Object.hasOwn(e,`threadTreeCollapseStyle`)}function yg(e){let t=e.configForms.registerBrowser(`ui-workspace`,_g.toJSON(),{...gg});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)})},hg)),t}function bg(e,t){return e!==void 0&&e.has(t)}function xg(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||bg(r.sectionOf,t)||bg(r.sectionOf,n)||r.parents!==void 0&&r.parents.get(t)!==r.parents.get(n))}function Sg(e,t,n,r={}){if(!xg(e,t,n.id,r))return null;let i=r.parents?.get(t),a=e.filter(e=>!bg(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 Cg(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,Pm);return{nativeSectionOf:n,sectionOf:r}}function wg(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=Mm(e.path,[...t?.keys()??[]]);return[e.workspaceId,n===void 0?void 0:t?.get(n)]}))}function Tg(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 Eg(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=Eg(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=Eg(e))&&(r&&(r+=` `),r+=t);return r}function Dg(e,t){return e===`default-workspace`?t:e}let Og=`@deepseek-ai/dsh-client-ui-workspace/WorkspaceBrowser.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=`._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{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 kg({section:e,request:t,t:n}){let[r,i]=(0,s.useState)(!1),c=n(`actions.section.aria`,{name:e.name});return/* @__PURE__ */ (0,o.jsx)(a.Menu,{open:r,onClose:()=>i(!1),items:[{id:`rename`,label:n(`section.rename.title`)},{id:`delete`,label:n(`section.delete.title`)}],onSelect:n=>{i(!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":r,onClick:()=>i(!r),children:/* @__PURE__ */ (0,o.jsx)(a.IconEllipsisOutlineRegular,{size:16})})})}function Ag({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)(jg,{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)(Mg,{section:c.section,dismiss:t,deleteSection:i,notifySyncPending:a,t:s},`delete:${c.section.id}`)}function jg({initialName:e,requireChange:t,title:n,submitLabel:r,saveName:i,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 i(y);if(e.status===`unknown`){m(`unknown`),g(u(`section.outcomeUnknown`));return}c(),e.syncPending&&l()}catch(e){g(Ng(e)),v.current=!1,m(`editing`)}}};return/* @__PURE__ */ (0,o.jsxs)(a.Modal,{phoneSidebar:!0,open:!0,onClose:x,closeLabel:u(`close`),title:n,footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:p===`saving`,onClick:x,children:u(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,disabled:p!==`editing`||b,onClick:()=>void S(),children:r})]}),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 Mg({section:e,dismiss:t,deleteSection:n,notifySyncPending:r,t:i}){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 a=await n(e.id);if(a.status!==`confirmed`){d(i(`section.outcomeUnknown`));return}t(),a.syncPending&&r()}catch(e){d(Ng(e))}finally{f.current=!1,l(!1)}}};return/* @__PURE__ */ (0,o.jsxs)(a.Modal,{phoneSidebar:!0,open:!0,onClose:p,closeLabel:i(`close`),title:i(`section.delete.title`),description:i(`section.delete.desc`,{name:e.name}),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:c,onClick:p,children:i(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:Z.deleteAction,disabled:c,onClick:()=>void m(),children:i(`section.delete.action`)})]}),children:[c&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.deleteStatus,role:`status`,children:i(`section.delete.pending`)}),u!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:u})]})}function Ng(e){return e instanceof Error?e.message:String(e)}function Pg(e){return e.pendingInteraction!==void 0}function Fg(e){return e.running||e.runningSubagentCount>0}function Ig(e){return e.completed}function Lg(e){return e.archived||e.blank?null:Pg(e)||(e.tree?.activity.pendingInteraction??0)>0?0:Fg(e)||(e.tree?.activity.running??0)>0?1:Ig(e)||(e.tree?.activity.completed??0)>0?2:null}function Rg(e){let t=/* @__PURE__ */ new Set,n=[],r=e=>{!e.archived&&!e.blank&&Ig(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 zg(e,t,n){let r=Tm(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=Lg(t);n!==null&&(a+=Number(Pg(t))+(t.tree?.activity.pendingInteraction??0),o+=Number(Fg(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=Rg(s),l=c.length;return{rows:s,unreadSessionIds:c,pendingCount:a,runningCount:o,unreadCount:l,hasAttention:a>0||l>0}}let Bg=`@deepseek-ai/dsh-client-ui-workspace/AnimatedRows.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Bg)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Bg,e.textContent=`.Jek-Ha_exits{contain:strict;pointer-events:none;position:absolute;inset:0;overflow:clip}`,document.head.appendChild(e)}var Vg={exits:`Jek-Ha_exits`};function Hg(e){return[...e.querySelectorAll(`[data-row-key]`)].filter(e=>e.offsetHeight>0&&!e.closest(`[inert]`))}function Ug(e){if(!e)return;let t=Hg(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 Wg(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=Hg(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`}),Ug(t))}function Gg(e,t){return e.rowKeys.length===t.rowKeys.length&&e.rowKeys.every((e,n)=>e===t.rowKeys[n])}function Kg(e,t){return e.bottom>t.top&&e.top<t.bottom&&e.right>t.left&&e.left<t.right}var qg=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(){Ug(this.list.current)}getSnapshotBeforeUpdate(e){let t=this.list.current;if(!this.armed||Gg(e,this.props)||e.resetKey!==this.props.resetKey||!e.ready||!this.props.ready||t===null||typeof t.animate!=`function`||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return null;let n=t.getBoundingClientRect(),r=this.readPositions(),i=new Set(this.props.rowKeys),a=/* @__PURE__ */ new Map;for(let[e,t]of r){if(i.has(e)||!Kg(t.rect,n))continue;let r=t.element.cloneNode(!0);r.removeAttribute(`data-row-key`),r.inert=!0,r.style.setProperty(`--dsh-workspace-indent`,getComputedStyle(t.element).getPropertyValue(`--dsh-workspace-indent`)),a.set(e,{...t,element:r})}return{positions:r,removed:a}}componentDidUpdate(e,t,n){if(Ug(this.list.current),n===null){(!Gg(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,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(!Kg(t.rect,a)&&(r===void 0||!Kg(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()}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:Wg,onFocusCapture:()=>Ug(this.list.current),onPointerDownCapture:()=>{this.armed=!0},onKeyDownCapture:()=>{this.armed=!0},children:this.props.children}),/* @__PURE__ */ (0,o.jsx)(`div`,{ref:this.overlay,className:Vg.exits,"aria-hidden":`true`})]})}};function Jg({identity:e,ambient:t,title:n,onIdentityClick:r,identityLabel:i,identityControls:a,identityExpanded:s,children:c}){let l=/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[e,/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.statusOverlay,children:t})]});return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[r?/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:`${q.slot} ${q.identityButton}`,onClick:r,"data-thread-icon-toggle":!0,"aria-label":i,title:i,"aria-expanded":s,"aria-controls":a,children:[l,/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.foldChevron,"aria-hidden":`true`})]}):/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.slot,children:l}),/* @__PURE__ */ (0,o.jsx)(`span`,{"data-session-title":!0,className:q.title,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.titleText,children:n})}),c]})}function Yg({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:Jd(e.hostId,e.color);return/* @__PURE__ */ (0,o.jsxs)(`span`,{className:X(q.hostBadge,t===`session`&&q.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:q.hostDot,"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.hostLabel,children:r})]})}let Xg=`codexhost.sidebar.hostScopeFilter.v1`,Zg=`codexhost:apply-host-scope-workspace-selection`;function Qg(e){return e.some(e=>e.remote!==void 0)}function $g(e){if(e.remote===void 0)return!1;let t=e.path??e.cwd;return t===void 0||t.trim()===``}function e_(e){return e.some(e=>e.remote?.hostId.startsWith(`remote-peer:`)===!0)}function t_(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 n_(e,t){return e.selectedHost===`all`||t_(t).some(t=>t.key===e.selectedHost)?e:{...e,selectedHost:`all`}}function r_(e,t,n){let r=t_(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 i_(e,t){let n=n_(e,t);return n.selectedHost!==`all`||t_(t).some(e=>n.perHost[e.key]?.mode===`selected`)}function a_(e,t){let n=n_(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 o_(e){return typeof e==`string`?e:e.id}function s_(e){return typeof e==`string`?`local`:e.remote?.hostId??e.projectionValues?.remoteHost?.hostId??`local`}function c_(e,t){if(!Qg(t))return!0;let n=n_(e,t);return(n.selectedHost===`all`||n.selectedHost===`local`)&&n.perHost.local?.mode!==`selected`}function l_(e,t,n=a_(t,e)){if(!Qg(t))return!0;let r=n_(e,t);return r.selectedHost!==`all`&&r.selectedHost!==`local`?!1:r.perHost.local?.mode!==`selected`||n.some(e=>e.remote===void 0)}function u_(e,t,n,r,i){let a=n_(r,n);if(!i_(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=o_(e),n=i?.get(t)??t;if(c.has(n))return!0;if(!s.has(n)){let t=s_(e);return(a.selectedHost===`all`||a.selectedHost===t)&&a.perHost[t]?.mode!==`selected`}return!1})}function d_(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 f_(e,t){return e.selectedHost===t?e:{...e,selectedHost:t}}function p_(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 m_(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 h_(e,t,n){return{...e,perHost:{...e.perHost,[t]:{mode:`selected`,workspaceIds:[...new Set(n)]}}}}function g_(){return{selectedHost:`all`,perHost:{}}}function __(e,t,n){let r=n_(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 v_(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function y_(e){if(e===null||e===``)return g_();try{let t=JSON.parse(e);if(!v_(t))return g_();let n=typeof t.selectedHost==`string`&&t.selectedHost.trim()!==``?t.selectedHost:`all`,r={};if(v_(t.perHost))for(let[e,n]of Object.entries(t.perHost)){if(e===``||!v_(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 g_()}}function b_(e){try{let t=e===void 0?typeof window<`u`?window.localStorage:null:e;return t===null?g_():y_(t.getItem(Xg))}catch{return g_()}}function x_(e,t){try{let n=t===void 0?typeof window<`u`?window.localStorage:null:t;if(n===null)return;n.setItem(Xg,JSON.stringify(e))}catch{}}let S_={},C_=(0,s.createContext)({t:e=>e,forest:[],expansion:S_,rows:e=>sm(e,S_),toggle:()=>{},markCompletionsRead:()=>{},collapseStyle:`summary`,stylePrompt:void 0,dismissStylePrompt:()=>{},setCollapseStyle:async()=>!1,rootId:e=>e,reveal:()=>{},selectSidebarRow:()=>{},isSidebarSelection:()=>!1});function w_(){return(0,s.useContext)(C_)}function T_({browser:e,children:t}){let{useSessions:n,useStore:r,useWorkspaces:i,actions:a,useWorkspacePreferences:c,setThreadTreeCollapseStyle:l}=e,u=c(e=>e),d=vg(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??S_),x=r(e=>e.archivedFilter??`default`),S=(0,s.useMemo)(()=>Tm(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,[]),ee=(0,s.useCallback)(e=>{w.current=e,a.setThreadsExpanded(C.get(e)?.ancestors??[],!0)},[a,C]),E=(0,s.useCallback)(e=>{w.current=void 0;let t=C.get(e);t!==void 0&&a.setThreadsExpanded(t.ancestors,!0)},[a,C]),te=Object.values(g.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,ne=(0,s.useRef)(``);(0,s.useEffect)(()=>{te===void 0?ne.current=``:C.get(te)!==void 0&&ne.current!==te&&(ne.current=te,T(te)||E(te))},[te,T,E,C]);let re=(0,s.useMemo)(()=>({t:e.t,forest:S,expansion:b,rows:e=>sm(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:E,selectSidebarRow:ee,isSidebarSelection:T}),[e.t,e.markCompletionsRead,a,S,b,C,E,ee,T,f,d,p,h,l]);return/* @__PURE__ */ (0,o.jsx)(C_.Provider,{value:re,children:t})}let E_=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeControls.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(E_)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=E_,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]){--dsh-thread-icon-size:14px}.jGgv6G_branch:has(>:first-child [data-harness-id])>.jGgv6G_children{--dsh-thread-parent-icon-size:14px}.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 D_={branch:`jGgv6G_branch`,children:`jGgv6G_children`,summary:`jGgv6G_summary`};function O_(e){return[{state:`running`,count:e.running},{state:`pending`,count:e.pendingInteraction},{state:`completed`,count:e.completed}]}function k_(e){return e.pendingInteraction>0?`pending`:e.running>0?`running`:e.completed>0?`completed`:`idle`}function A_(e,t,n){return[n(`threadTree.children`,{n:e}),...O_(t).filter(e=>e.count>0).map(e=>n(`threadTree.${e.state}`,{n:e.count}))].join(` · `)}function j_({count:e,activity:t,t:n}){return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[n(`threadTree.children`,{n:e}),O_(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 M_=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeRing.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(M_)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=M_,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 N_={ring:`yY-O0a_ring`,spin:`yY-O0a_spin`};function P_({activity:e}){return/* @__PURE__ */ (0,o.jsx)(`span`,{className:N_.ring,"data-thread-ring":k_(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 F_=[{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 I_({style:e,t}){return/* @__PURE__ */ (0,o.jsx)(`div`,{className:dg.preview,"aria-hidden":`true`,children:F_.map(({title:n,activity:r})=>/* @__PURE__ */ (0,o.jsx)(`div`,{className:D_.branch,children:/* @__PURE__ */ (0,o.jsxs)(`div`,{className:`${q.sessionRow} ${dg.sampleRow}`,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.sessionMain,children:/* @__PURE__ */ (0,o.jsx)(Jg,{title:t(n),identity:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(`span`,{"data-harness-id":`codex`,className:dg.sampleIcon,children:/* @__PURE__ */ (0,o.jsx)(`img`,{src:`/harness-icons/codex`,width:14,height:14,alt:``})}),e===`ring`&&/* @__PURE__ */ (0,o.jsx)(P_,{activity:r})]})})}),e===`summary`&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:`${D_.summary} ${dg.sampleSummary}`,children:/* @__PURE__ */ (0,o.jsx)(j_,{count:2,activity:r,t})})]})},n))})}function L_({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}=pg(t);return/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:u,className:dg.prompt,"data-thread-style-prompt":!0,role:`region`,"aria-labelledby":a,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:dg.promptHeading,children:[/* @__PURE__ */ (0,o.jsx)(`strong`,{id:a,children:i(`threadTree.style.promptTitle`)}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:dg.later,disabled:f,onClick:n,children:i(`threadTree.style.later`)})]}),/* @__PURE__ */ (0,o.jsx)(`p`,{className:dg.hint,children:i(`threadTree.style.hint`)}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:dg.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`?fg[e.key===`Home`?0:1]:fg[+(c===`summary`)];e.currentTarget.querySelector(`[data-thread-style-choice="${t}"]`)?.focus()},children:fg.map(t=>/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`radio`,className:dg.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:dg.choiceTitle,id:`${a}-${t}`,children:i(`threadTree.style.${t}`)}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:dg.choiceSubtitle,id:`${a}-${t}-description`,children:i(`threadTree.style.${t}Subtitle`)}),/* @__PURE__ */ (0,o.jsx)(I_,{style:t,t:i})]},t))}),p&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:dg.error,role:`alert`,children:i(`threadTree.style.error`)})]})}let R_=(0,s.createContext)(void 0),z_=()=>(0,s.useContext)(R_);function B_({roots:e,children:t}){return e.map(e=>/* @__PURE__ */ (0,o.jsx)(V_,{node:e,renderRow:t},e.id))}function V_({node:e,renderRow:t}){let n=(0,s.useId)(),{expansion:r,stylePrompt:i,dismissStylePrompt:a,collapseStyle:c,setCollapseStyle:l,t:u}=w_(),d=r[e.id]===!0,f=e.tree?.depth??0,p=e.tree?.children??[];return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:D_.branch,"data-thread-branch":e.id,children:[/* @__PURE__ */ (0,o.jsx)(R_.Provider,{value:n,children:t(e)}),d&&i===n&&/* @__PURE__ */ (0,o.jsx)(L_,{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:D_.children,style:{"--dsh-thread-guide-indent":`${Math.min(f,3)*24}px`},children:d&&/* @__PURE__ */ (0,o.jsx)(B_,{roots:p,children:t})})]})}function H_({node:e,title:t,toggle:n,t:r}){let i=z_(),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=A_(c.descendantCount,c.activity,r);return/* @__PURE__ */ (0,o.jsx)(`button`,{ref:a,type:`button`,"data-thread-summary":!0,className:D_.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)(j_,{count:c.descendantCount,activity:c.activity,t:r})})}function U_(e){return e!=null&&e.id.length>0&&e.id!==`01984de2-8f74-7c91-a3b2-5c5e937cf318`}let W_=`(hover: hover) and (pointer: fine)`;function G_(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(W_).matches}function K_(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 q_(e){return e.moving&&(e.depth??0)===0&&e.blank!==!0&&e.archived!==!0}function J_(e,t){if(t!==void 0)return t.find(t=>U_(t)&&t.threadIds.includes(e))}function Y_(e,t){if(!U_(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 X_(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 Z_(e,t){if(e.target!==e.currentTarget)return null;let n=String(t),r=null,i=0;for(let t of e.currentTarget.children){let a=t.getAttribute(`data-thread-branch`);if(a===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 Q_(e){return!(e.committed||e.cancelled||e.dropEffect===`copy`)}function $_(e,t,n,r){if(t.kind===`unsectioned`){let t=n.find(t=>t.id===e.sourceSectionId);return t===void 0||!U_(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||!U_(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 ev(e,t,n,r){if(!U_(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 tv(e){let t=/* @__PURE__ */ new Set,n=(0,r.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 nv=/* @__PURE__ */ new Set;function rv(e){return e(nv)}function iv(e,t){return e.blank?t(`session.new`):e.title||t(`session.untitled`)}function av(e,t,n){let{unit:r,n:i}=(0,a.relativeTime)(e,t);return r===`now`?n(`time.now`):n(`time.${r}`,{n:i})}function ov(e,t,n){let{unit:r,n:i}=(0,a.relativeTime)(e,t);return r===`now`?n(`time.now`):n(`time.ago`,{t:n(`time.${r}`,{n:i})})}function sv(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 cv({label:e,cwd:t,createdAt:n,t:r}){return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:q.hoverContent,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.hoverTitle,children:e}),t!==void 0&&t!==``&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.hoverPath,children:t}),n!==void 0&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.hoverTime,children:sv(n,r)})]})}function lv(e){let t=e.currentTarget.getBoundingClientRect();return e.clientY<t.top+t.height/2?`before`:`after`}function uv({color:e,state:t,className:n}){return/* @__PURE__ */ (0,o.jsx)(`span`,{className:X(q.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 dv({group:e,foldedActivity:t,onToggle:n,onCreate:r,pin:i,actions:c,drag:l,showHost:u=!0,home:d,newShortcut:f,t:p}){let m=e,h=t===void 0?void 0:{pending:`warning`,running:`ongoing`,completed:`done`,idle:void 0}[k_(t)],g=e.remote?void 0:c,_=l,v=$g(m),y=m.workspaceId===void 0?p(`group.ungrouped`):v?p(`group.remoteOtherSessions`):m.label,b=m.remote===void 0?void 0:Jd(m.remote.hostId,m.remote.color),x=u&&m.workspaceId!==void 0&&m.remote!==void 0,[S,C]=(0,s.useState)(!1),[w,T]=(0,s.useState)(null),ee=(0,s.useRef)(null),E=p(i?.pinned?`menu.unpinWorkspace`:`menu.pinWorkspace`),te=i?.pinned?a.IconPinFillRegular:a.IconPinOutlineRegular,ne=[...i?[{id:`pin`,label:E,icon:/* @__PURE__ */ (0,o.jsx)(te,{})}]:[],...g?[{id:`rename`,label:p(`rename`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconEditOutlineRegular,{})},...g.defaultHarness?[{id:`defaultHarness`,label:p(`defaultHarness.title`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconSettingsOutlineRegular,{})}]:[],...g.moveToSection?[{id:`move`,label:p(`menu.moveToSection`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{})}]:[],{id:`delete`,label:p(`delete.workspace`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconTrashOutlineRegular,{}),danger:!0}]:[]],re=/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(q.projectRow,S&&q.menuOpen),"data-row-key":`workspace:${e.key}`,role:`treeitem`,"aria-expanded":m.expanded,tabIndex:-1,onContextMenu:e=>{ne.length&&!e.target.closest(`button`)&&(e.preventDefault(),T(new DOMRect(e.clientX,e.clientY,0,0)),C(!0))},onKeyDown:e=>{e.target===e.currentTarget&&ne.length&&(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`)&&(e.preventDefault(),T(null),C(!0))},onClick:n,draggable:_!==void 0,onDragStart:_===void 0?void 0:e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,m.key),_.start()},onDragEnd:_?.end,children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:X(q.slot,m.expanded&&q.folderExpanded),children:[v?/* @__PURE__ */ (0,o.jsx)(a.IconQueueOutlineRegular,{size:16}):m.expanded?/* @__PURE__ */ (0,o.jsx)(a.IconFolderOpenRegular,{}):/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{}),x&&m.remote&&b!==void 0&&/* @__PURE__ */ (0,o.jsx)(uv,{color:b,state:m.remote.state})]}),x&&m.remote?/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:q.remoteHostText,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.title,children:y}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.remoteHostMeta,children:m.remote.displayName})]}),h===void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.remoteHostStatusDot,"data-state":m.remote.state,"aria-hidden":`true`})]}):/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.projectText,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.title,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.titleText,children:y})})}),h!==void 0&&t!==void 0&&/* @__PURE__ */ (0,o.jsxs)(`span`,{className:q.projectActivity,"data-project-activity":h,children:[/* @__PURE__ */ (0,o.jsx)(a.StateDot,{state:h,size:h===`ongoing`?16:void 0}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.visuallyHidden,children:O_(t).filter(e=>e.count>0).map(e=>p(`threadTree.${e.state}`,{n:e.count})).join(` · `)})]}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:q.rowActions,children:[ne.length>0&&/* @__PURE__ */ (0,o.jsx)(a.Menu,{open:S,onClose:()=>{C(!1)},items:ne,onSelect:e=>{C(!1),e===`pin`&&i?.toggle(),e===`rename`&&g?.rename(),e===`defaultHarness`&&g?.defaultHarness?.(ee.current),e===`move`&&g?.moveToSection?.(),e===`delete`&&g?.delete()},portal:!0,autoFocus:!0,getAnchorRect:w===null?void 0:()=>w,anchor:/* @__PURE__ */ (0,o.jsx)(`button`,{ref:ee,type:`button`,className:q.iconButton,"aria-label":p(`actions.workspace.aria`,{name:y}),"aria-haspopup":`menu`,"aria-expanded":S,onClick:e=>{e.stopPropagation(),T(null),C(e=>!e)},children:/* @__PURE__ */ (0,o.jsx)(a.IconEllipsisOutlineRegular,{})})}),(!m.remote||m.remote.state===`connected`&&!v)&&/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:p(`actions.newSession`),shortcutKeys:f?.keys,side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:q.iconButton,"aria-keyshortcuts":f?.aria,"aria-label":p(`actions.newSession.aria`,{name:y}),onClick:e=>{e.stopPropagation(),r()},children:/* @__PURE__ */ (0,o.jsx)(a.IconNewChatOutlineRegular,{})})})]})]}),ie=m.cwd!==void 0&&m.cwd!==``?m.cwd:void 0;return m.workspaceId===void 0||ie===void 0&&m.createdAt===void 0?re:/* @__PURE__ */ (0,o.jsx)(a.HoverCard,{anchor:re,content:/* @__PURE__ */ (0,o.jsx)(cv,{label:y,cwd:ie===void 0?void 0:em(ie,d),createdAt:m.createdAt,t:p}),openDelayMs:800,disabled:S,copyText:ie,copyLabel:p(`copy`),copiedLabel:p(`hover.copied`)})}function fv({node:e,now:t,renderSlot:n,t:r}){let i=vh(e,r).filter(t=>!e.archived||t.state!==`done`&&t.state!==`idle`),s=e.remote===void 0?void 0:Jd(e.remote.hostId,e.remote.color),c=e.remote?.state===`connected`?r(`host.connected`):e.remote?.state===`connecting`?r(`host.connecting`):r(`host.disconnected`);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:q.hoverContent,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.hoverTitle,children:iv(e,r)}),e.remote&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:q.hoverHost,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.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:q.hoverPath,children:e.cwd}),!e.blank&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.hoverTime,children:ov(e.updatedAt,t,r)}),n(`sidebar.session.row.hover`,{sessionId:e.id}),i.map(e=>/* @__PURE__ */ (0,o.jsxs)(`div`,{className:q.hoverStatus,children:[/* @__PURE__ */ (0,o.jsx)(a.StateDot,{state:e.state}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:e.label})]},e.label)),e.archived&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(q.hoverStatus,q.hoverArchived),children:[/* @__PURE__ */ (0,o.jsx)(a.IconArchiveOutlineRegular,{size:16}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:r(`row.archived`)})]})]})}function pv({result:e,currentId:t,onOpen:n,onUnarchive:r,t:i}){let s=e.id===t,c=vh(e,i),l=c[0];return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(q.searchResultRow,s&&q.selected,e.archived&&q.archived),role:`treeitem`,"aria-selected":s,"aria-description":e.archived?i(`toast.archivedNotOpenable`):void 0,onClick:()=>{n(e.id)},children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:q.searchResultHeading,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.slot}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.searchResultTitle,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.titleText,children:e.title||i(`session.untitled`)})}),e.remote&&/* @__PURE__ */ (0,o.jsx)(Yg,{host:e.remote,variant:`session`,t:i}),!e.archived&&l.state!==`idle`&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.timeStatus,"data-session-status":l.state,children:/* @__PURE__ */ (0,o.jsx)(bh,{statuses:c})}),e.archived&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.rowActions,children:/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:i(`actions.unarchive`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:q.iconButton,"aria-label":i(`menu.unarchiveSession`),onClick:t=>{t.stopPropagation(),r(e.id)},children:/* @__PURE__ */ (0,o.jsx)(a.IconUnarchiveOutlineRegular,{size:16})})})})]}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:q.searchResultMeta,children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:q.searchResultWorkspace,children:[e.workspace||i(`group.ungrouped`),e.parentTitle!==void 0&&` · ${e.parentTitle||i(`session.untitled`)}`]}),e.snippet!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.searchResultSnippet,children:e.snippet})]})]})}function mv({node:e,rowKey:t=`session:${e.id}`,currentId:n,now:r,onOpen:i,onRenameRequest:c,renderSlot:l,onReveal:u,drag:d,useMovingSectionSessions:f=rv,showHost:p=!0,t:m}){let h=e,{expansion:g,toggle:_,markCompletionsRead:v,collapseStyle:y}=w_(),b=z_(),x=e.tree,S=x?.depth??0,C=!h.archived&&x!==void 0&&x.activity.completed>0?()=>{v(x.descendantIds.map(qp))}:void 0,w=g[e.id]===!0,T=S===0?d:void 0,ee=f(t=>t.has(e.id)),E=q_({depth:S,blank:h.blank,archived:h.archived,moving:ee}),te=iv(e,m),ne=e.id===n,re=vh(e,m),ie=re[0],ae=!h.archived&&ie.state!==`idle`,oe=h.remote===void 0?void 0:Jd(h.remote.hostId,h.remote.color),se=p&&h.remote!==void 0&&oe!==void 0,ce=T!==void 0&&T.canDrag!==!1&&!E&&!h.blank&&!h.archived,D=h.blank?void 0:h.reference,le=ce||D!==void 0,O=(0,s.useRef)(!1),[k,ue]=(0,s.useState)(!1),[de,A]=(0,s.useState)(null),fe=(0,s.useMemo)(()=>[k,ue],[k]),pe=(0,s.useRef)(null);(0,s.useEffect)(()=>{u!==void 0&&(pe.current?.scrollIntoView({block:`nearest`}),u())},[u]);let j=/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:pe,"data-row-key":t,"data-thread-parent":e.tree?.parentId??void 0,"data-thread-depth":S,"data-thread-sortable":String(ce),"data-thread-pinned":String(e.pinned),"data-section-moving":E?`true`:void 0,style:{"--dsh-thread-indent":`${Math.min(S,3)*24}px`},className:X(q.sessionRow,ne&&q.selected,k&&q.menuOpen,h.archived&&q.archived,E&&q.sectionMoving,T?.marker===`before`&&q.dropBefore,T?.marker===`after`&&q.dropAfter),role:`treeitem`,"aria-selected":ne,"aria-current":ne?`page`:void 0,"aria-busy":E||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(),A(new DOMRect(e.clientX,e.clientY,0,0)),ue(!0))},onKeyDown:t=>{t.target!==t.currentTarget||h.blank||(O.current=!1,t.key===`ContextMenu`||t.shiftKey&&t.key===`F10`?(t.preventDefault(),A(null),ue(!0)):t.key===`F2`&&!h.archived&&(t.preventDefault(),c(e.id,h.title)))},"aria-description":h.archived?m(`toast.archivedNotOpenable`):void 0,onPointerDown:()=>{O.current=!1},onClick:()=>{O.current||(ne&&!h.archived&&e.tree?.descendantCount?(w&&v(e.tree.descendantIds),_(e.id,!w,b)):i(e.id))},draggable:le,onDragStart:le?t=>{O.current=!0,t.dataTransfer.effectAllowed=D===void 0?`move`:ce?`copyMove`:`copy`,t.dataTransfer.setData(`text/plain`,D===void 0?e.id:am(D).clipboardText),D!==void 0&&t.dataTransfer.setData(`application/x-codexhost-thread-reference`,JSON.stringify(D)),ce&&T?.start()}:void 0,onDragEnd:le?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(lv(e)))},onDrop:T===void 0?void 0:e=>{T.active&&e.dataTransfer.dropEffect!==`copy`&&(e.preventDefault(),e.stopPropagation(),T.drop(lv(e),e.dataTransfer.dropEffect))},children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.sessionMain,children:/* @__PURE__ */ (0,o.jsx)(Jg,{identityLabel:e.tree?.descendantCount?!w&&y===`ring`?m(`threadTree.expandSummary`,{title:te,summary:A_(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)(P_,{activity:e.tree.activity}),se&&h.remote&&oe!==void 0&&/* @__PURE__ */ (0,o.jsx)(uv,{color:oe,state:h.remote.state,className:q.remoteSessionGlobe})]}),ambient:!h.archived&&!h.blank&&!ae&&l(`sidebar.session.row.leading`,{sessionId:e.id}),title:te,onIdentityClick:e.tree?.descendantCount?t=>{t.stopPropagation(),_(e.id,!w,b)}:void 0,children:/* @__PURE__ */ (0,o.jsxs)(`span`,{className:q.trailing,children:[!h.blank&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:X(q.time,(ae||E)&&q.timeStatus),"data-session-status":ae?ie.state:void 0,"data-section-moving-indicator":E?`true`:void 0,children:ae?/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(bh,{statuses:re}),ie.trailingLabel!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{"aria-hidden":`true`,children:ie.trailingLabel})]}):E?/* @__PURE__ */ (0,o.jsx)(a.StateDot,{state:`ongoing`,size:14,className:q.sectionMovingSpinner}):av(h.updatedAt,r,m)}),!h.blank&&/* @__PURE__ */ (0,o.jsxs)(`span`,{className:q.rowActions,onClick:e=>{e.stopPropagation()},children:[/* @__PURE__ */ (0,o.jsx)(a.Menu,{open:k,onClose:()=>{ue(!1)},portal:!0,autoFocus:!0,phoneSidebarTitle:te,phoneSidebarFooterBackLabel:m(`session.backToList`),phoneSidebarDetails:/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.phoneDetails,children:/* @__PURE__ */ (0,o.jsx)(fv,{node:e,now:r,renderSlot:l,t:m})}),getAnchorRect:de===null?void 0:()=>de,anchor:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:q.iconButton,"aria-label":m(`actions.session.aria`,{name:te}),"aria-haspopup":`menu`,"aria-expanded":k,onClick:()=>{A(null),ue(e=>!e)},children:/* @__PURE__ */ (0,o.jsx)(a.IconEllipsisOutlineRegular,{})}),children:l(`sidebar.workspaces.session.menu.item`,{sessionId:e.id,displayTitle:h.title,threadTreeChild:S>0,...C===void 0?{}:{markChildThreadsRead:C}},{hookContext:fe})}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.quickActions,children:l(`sidebar.workspaces.session.row.action`,{sessionId:e.id,displayTitle:h.title,threadTreeChild:S>0})})]})]})})}),!w&&y===`summary`&&/* @__PURE__ */ (0,o.jsx)(H_,{node:e,title:te,toggle:()=>_(e.id,!0,b),t:m})]});return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.HoverCard,{anchor:j,content:/* @__PURE__ */ (0,o.jsx)(fv,{node:e,now:r,renderSlot:l,t:m}),openDelayMs:800,disabled:k||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:q.visuallyHidden,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:E?m(`section.moving`):null})]})}let hv=`@deepseek-ai/dsh-client-ui-workspace/ActivityViewList.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(hv)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=hv,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 gv={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 _v({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 vv({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=w_(),{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:gv.toolbar,role:`region`,"aria-label":p(`activityView.label`),children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:gv.titleGroup,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:gv.title,children:p(`activityView.label`)}),_>0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:gv.unreadMeta,children:p(_===1?`activityView.unreadCount.one`:`activityView.unreadCount.other`,{n:_})})]}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:gv.markAllReadButton,disabled:_===0,onClick:()=>{u(g)},children:p(`activityView.markAllRead`)})]}),/* @__PURE__ */ (0,o.jsx)(qg,{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:gv.emptyState,"data-row-key":`empty:activity`,children:[/* @__PURE__ */ (0,o.jsx)(_v,{size:22,className:gv.emptyIcon}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:gv.emptyTitle,children:p(`activityView.empty`)}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:gv.backButton,onClick:d,children:p(`activityView.backToAll`)})]}):/* @__PURE__ */ (0,o.jsx)(B_,{roots:h,children:e=>/* @__PURE__ */ (0,o.jsx)(mv,{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 yv(e){return/* @__PURE__ */ (0,o.jsx)(a.RemotePluginIcon,{id:e,...(0,a.harnessIconSources)(e),size:16,fallback:/* @__PURE__ */ (0,o.jsx)(a.IconDataOutlineRegular,{size:16})})}async function bv(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 xv({workspaceId:e,title:t,t:n,onClose:r}){let[i,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 bv({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=i?.harnesses.map(({id:e,name:t})=>({id:e,label:t,icon:yv(e)}))??[],x=i?.selection.mode===`manual`?i.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:yv(e),disabled:!0})}let S=b.find(({id:e})=>e===f),C=u===`manual`?{mode:u,harnessId:f}:{mode:u},w=i===void 0||u===i.selection.mode&&(u!==`manual`||i.selection.mode===`manual`&&f===i.selection.harnessId),T=u===`manual`&&(!S||S.disabled),ee=()=>{g||r()},E=async()=>{if(!(g||w||T)){_(!0),y(void 0);try{await bv({workspaceId:e,selection:C}),r()}catch{y(`saveFailed`),_(!1)}}};return/* @__PURE__ */ (0,o.jsxs)(a.Modal,{open:!0,onClose:ee,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)(a.Button,{variant:`outline`,disabled:g,onClick:ee,children:n(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,disabled:g||w||T,onClick:()=>void E(),children:n(`defaultHarness.save`)})]}),children:[i?/* @__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)(a.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)(a.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 Sv=`@deepseek-ai/dsh-client-ui-workspace/SectionHeading.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Sv)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Sv,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 Cv={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 wv({label:e,icon:t,expanded:n,onToggle:r,rowKey:i,trailing:s,action:c,projectDrop:l,dropTarget:u=!1,onDragOver:d,onDrop:f}){let p=d||f?void 0:l,m=n!==void 0&&r!==void 0&&i!==void 0,h=/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[t,/* @__PURE__ */ (0,o.jsx)(`span`,{className:Cv.title,children:e}),m&&/* @__PURE__ */ (0,o.jsx)(a.IconChevronDownOutlineRegular,{className:n?Cv.chevron:Cv.collapsed,size:12}),s!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Cv.trailing,onClick:e=>{e.stopPropagation()},children:s}),c!==void 0&&/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:c.label,portal:!0,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:X(Cv.action,s!==void 0&&Cv.actionAfterTrailing),"aria-label":c.label,onClick:e=>{e.stopPropagation(),c.onActivate()},children:c.icon})})]});return m?/* @__PURE__ */ (0,o.jsx)(`div`,{className:X(Cv.heading,u&&Cv.dropTarget),role:`treeitem`,tabIndex:-1,"data-row-key":i,"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:r,children:h}):/* @__PURE__ */ (0,o.jsx)(`div`,{className:X(Cv.heading,u&&Cv.dropTarget),"data-section-drop-target":u||void 0,onDragOver:d,onDrop:f,children:h})}let Tv=`@deepseek-ai/dsh-client-ui-workspace/PinnedSection.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=`.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 Ev={empty:`t4p6JG_empty`,emptyDropTarget:`t4p6JG_emptyDropTarget`,section:`t4p6JG_section`};function Dv({rows:e,customSection:t,headingActions:n,sectionDrag:r,currentId:i,onOpen:s,onRenameRequest:c,renderSlot:l,useMovingSectionSessions:u,t:d,revealSessionId:f,onSessionRevealed:p,showHost:m=!0,expanded:h,onToggle:g,children:_,hasWorkspaces:v=!1}){if(e.length===0&&!v&&!t)return null;let y=t?.section,b=y?.name??d(`section.pinned`),x=y!==void 0&&U_(y),S=Array.isArray(_)?_.length>0:!!_,C=x&&y!==void 0&&r?.active===!0,w=C&&r.over?.kind===`section-end`&&r.over.sectionId===y.id,T=C&&y!==void 0?e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`,r.hoverSectionEnd(y.id)}:void 0,ee=C&&y!==void 0?e=>{e.dataTransfer.dropEffect!==`copy`&&(e.preventDefault(),e.stopPropagation(),r.dropSectionEnd(y.id,e.dataTransfer.dropEffect))}:void 0;return/* @__PURE__ */ (0,o.jsxs)(`div`,{role:`group`,"aria-label":b,className:Ev.section,"data-sidebar-pinned":!t||void 0,"data-sidebar-custom-section":y?.id,onDragOver:!t&&r?.active?()=>{r.clearHover()}:void 0,children:[/* @__PURE__ */ (0,o.jsx)(wv,{label:b,icon:t?void 0:/* @__PURE__ */ (0,o.jsx)(a.IconPinOutlineRegular,{size:14}),trailing:n,expanded:h,onToggle:g,rowKey:`section:${t?.key??`pinned`}`,projectDrop:t?.projectDrop,dropTarget:w,onDragOver:T,onDrop:ee}),h&&e.length>0&&/* @__PURE__ */ (0,o.jsx)(B_,{roots:e,children:e=>{let t=x&&y!==void 0&&r!==void 0?{canDrag:r.canDragRow(e),start:()=>{r.startFromSection(e.id,y.id)},active:r.active&&!e.blank&&!e.archived&&e.id!==r.draggedSessionId,marker:r.over?.kind===`section-row`&&r.over.sectionId===y.id&&r.over.targetSessionId===e.id?r.over.half:null,hover:t=>{r.hoverSectionRow(y.id,e.id,t)},drop:(t,n)=>{r.dropSectionRow(y.id,e.id,t,n)},end:()=>{r.end()}}:void 0;return/* @__PURE__ */ (0,o.jsx)(mv,{node:e,showHost:m,currentId:i,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&&S&&_,h&&t!==void 0&&e.length===0&&!S&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:X(Ev.empty,w&&Ev.emptyDropTarget),"data-section-drop-empty":y?.id,onDragOver:T,onDrop:ee,children:d(`section.empty`)})]})}function Ov({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 kv(e,t,n,r){let i=0,a=e.filter(e=>e.blank||e.pinned||e.running||e.runningSubagentCount>0||e.pendingInteraction!==void 0||e.tree?.activity.running||e.tree?.activity.pendingInteraction?!0:i++<t||e.id===n||e.id===r||e.tree?.descendantIds.some(e=>e===n||e===r)===!0);return{rows:a,hiddenCount:e.length-a.length,ordinaryCount:i}}function Av(e,t,n){let r=e.filter((e,r)=>r<t||n.has(e.key));return{rows:r,hiddenCount:e.length-r.length}}function jv({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 Mv({current:e,sections:t,dismiss:n,move:r,defaultLabel:i,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}=X_(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),ee=()=>{!T.current&&!l&&n()},E=async()=>{if(!T.current&&x){T.current=!0,_(!0),C(!1);try{await r(y||null)!==!1&&n()}catch{C(!0)}finally{T.current=!1,_(!1)}}};return/* @__PURE__ */ (0,o.jsxs)(a.Modal,{phoneSidebar:!0,open:!0,title:p(`menu.moveToSection`),closeLabel:p(`close`),onClose:ee,footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:v,onClick:ee,children:p(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,disabled:!x,onClick:()=>void E(),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:i}),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 Nv=`@deepseek-ai/dsh-client-ui-workspace/HostScopeFilter.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Nv)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Nv,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 Pv(e,t){return e.key===`local`?t(`host.local`):e.displayName||e.hostId||e.key}function Fv(e,t){return t(e===`connected`?`host.connected`:e===`connecting`?`host.connecting`:`host.disconnected`)}function Iv({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=d_(e,i),d=Pv(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(p_(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(p_(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(h_(t,e.key,l))},children:r(`hostScope.selectAll`)}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Q.miniLink,disabled:u===0,onClick:()=>{n(h_(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=$g(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(m_(t,e.key,i.workspaceId,l))}}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.workspaceOptionName,children:u})]},i.workspaceId)})})]})]})}function Lv(){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 Rv({workspaces:e,state:t,onChange:n,t:r}){let i=(0,s.useMemo)(()=>Qg(e),[e]),a=(0,s.useMemo)(()=>t_(e),[e]),c=(0,s.useMemo)(()=>n_(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(f_(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=Pv(e,r),a=e.hostId===void 0?i:`${i} · ${Fv(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(f_(c,e.key))},children:[e.hostId!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.tabDot,"data-state":e.state??`disconnected`,"data-color":Jd(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)(zv,{workspaces:e,state:t,onChange:n,t:r,variant:`icon`})})]}):null}function zv({workspaces:e,state:t,onChange:n,t:r,variant:i=`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)(()=>Qg(e),[e]),v=(0,s.useMemo)(()=>t_(e),[e]),y=(0,s.useMemo)(()=>n_(t,e),[t,e]),b=(0,s.useMemo)(()=>i_(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,a.useAnchoredPosition)({open:l,anchorRef:m,panelRef:h,side:`bottom`,align:`end`,gap:4,margin:12});if((0,a.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 r(`hostScope.allShort`);if(x!==void 0){let e=Pv(x,r),t=y.perHost[x.key];return t?.mode===`selected`?`${e} · ${d_(x,t)}`:e}return r(`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}}))},ee=()=>{u(!1),window.dispatchEvent(new CustomEvent(`codexhost:open-remote-peers-settings`))},E=e.length,te=v.some(e=>y.perHost[e.key]?.mode===`selected`);return/* @__PURE__ */ (0,o.jsxs)(`span`,{ref:p,className:Q.anchorRoot,children:[i===`icon`?/* @__PURE__ */ (0,o.jsxs)(`button`,{ref:m,type:`button`,className:X(Q.iconTrigger,te&&Q.iconTriggerActive,l&&Q.iconTriggerOpen),"aria-haspopup":`dialog`,"aria-expanded":l,"aria-controls":l?g:void 0,"aria-label":r(`hostScope.trigger.aria`,{current:C}),title:r(`hostScope.trigger.aria`,{current:C}),onClick:e=>{e.stopPropagation(),u(e=>!e)},children:[/* @__PURE__ */ (0,o.jsx)(Lv,{}),te&&/* @__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":r(`hostScope.trigger.aria`,{current:C}),title:r(`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":Jd(x.hostId,x.color),"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.triggerLabel,children:C}),/* @__PURE__ */ (0,o.jsx)(a.IconChevronDownOutlineRegular,{size:12,className:Q.triggerChevron})]}),l&&(0,c.createPortal)(/* @__PURE__ */ (0,o.jsxs)(a.MenuSurface,{ref:h,id:g,role:`dialog`,"aria-label":r(`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:r(`hostScope.host.label`)}),b&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Q.resetLink,onClick:()=>{n(g_())},children:r(`hostScope.reset`)})]}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.hostList,role:`radiogroup`,"aria-label":r(`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(f_(y,`all`))},children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.hostName,children:r(`hostScope.allHosts`)}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.hostCount,children:E}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.checkSlot,children:y.selectedHost===`all`&&/* @__PURE__ */ (0,o.jsx)(a.IconCheckOutlineRegular,{size:14})})]}),v.map(e=>{let t=y.selectedHost===e.key,i=y.perHost[e.key],s=i?.mode===`selected`,c=d_(e,i),l=s?`${c}/${e.workspaceCount}`:String(e.workspaceCount),u=Pv(e,r),d=e.hostId===void 0?u:`${u} · ${Fv(e.state,r)}`;return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,className:X(Q.hostRow,t&&Q.hostRowSelected),title:d,onClick:()=>{n(f_(y,e.key))},children:[e.hostId!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.dot,"data-state":e.state??`disconnected`,"data-color":Jd(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)(a.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:r(`hostScope.scope.label`)})}),x===void 0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.allHostsScopeList,children:v.map(e=>{let t=d===e.key,i=y.perHost[e.key],s=i?.mode===`selected`,c=s?`${d_(e,i)}/${e.workspaceCount}`:r(`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)(a.IconChevronDownOutlineRegular,{size:12,className:Q.accordionIcon}):/* @__PURE__ */ (0,o.jsx)(a.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":Jd(e.hostId,e.color),"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.hostName,children:Pv(e,r)}),/* @__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)(Iv,{host:e,state:y,onChange:n,t:r})})]},e.key)})}):/* @__PURE__ */ (0,o.jsx)(Iv,{host:x,state:y,onChange:n,t:r})]})]}),/* @__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)(a.IconPlusOutlineRegular,{size:14,className:Q.footerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:r(`hostScope.action.addRemoteWorkspace`)})]}),/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:Q.footerAction,onClick:ee,children:[/* @__PURE__ */ (0,o.jsx)(a.IconSettingsOutlineRegular,{size:14,className:Q.footerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:r(`hostScope.action.manageRemoteHosts`)})]})]})]}),document.body)]})}function Bv(){let[e,t]=(0,s.useState)(G_);return(0,s.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(W_);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 Vv({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&&K_({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||!Q_({committed:f.current,cancelled:p.current,dropEffect:i}))return;f.current=!0,h(null),m.current();let s=$_(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=>Q_({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 Hv(e,t){let n=t_(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=>!$g(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 Uv(e,t){return t===void 0?`local`:e.find(e=>e.workspaceId===t)?.remote?.hostId??`local`}function Wv(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 Gv(e,t,n){let r=e.filter(e=>!$g(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 Kv(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 qv(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 Jv(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 Yv=`@deepseek-ai/dsh-client-ui-workspace/HeroLocationWorkspacePicker.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Yv)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Yv,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 Xv=`codexhost:remote-peers-updated`,Zv=`codexhost:remote-workspace-created`,Qv=`codexhost/remote-peers/list`,$v=`::no-project`;function ey({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 ty({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 ny(e,t){return e.key===`local`?t(`host.thisComputer`):e.displayName||e.hostId||e.key}function ry(e,t){if(e!==void 0&&e!==`connected`)return t(e===`connecting`?`host.connecting`:`host.disconnected`)}function iy({location:e,className:t}){return e.key===`local`?/* @__PURE__ */ (0,o.jsx)(ey,{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)(ty,{className:t})}async function ay(e){try{let t=typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`hero-peers-${Date.now()}`,n=await fetch(`api/${Qv}`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({type:`client-request`,rpcId:t,method:Qv,payload:{args:{}}}),...e===void 0?{}:{signal:e}});return n.ok?qv(await n.json()):null}catch{return null}}function oy({open:e,selectedId:t,fallbackLabel:n,onOpenChange:r,onPick:i,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,ee]=(0,s.useState)(!1),[E,te]=(0,s.useState)(``),[ne,re]=(0,s.useState)(``),[ie,ae]=(0,s.useState)(-1),[oe,se]=(0,s.useState)(-1),[ce,D]=(0,s.useState)(!1),[le,O]=(0,s.useState)(!1),[k,ue]=(0,s.useState)(!1),[de,A]=(0,s.useState)(null),fe=(0,a.usePhoneSidebar)(),pe=(0,s.useRef)(!1),j=(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),M=(0,s.useRef)(null),xe=(0,s.useRef)(null),Se=(0,s.useId)(),Ce=(0,s.useId)(),we=e||T,Te=ce||le,Ee=(0,s.useMemo)(()=>Uv(g,t),[g,t]),N=(0,s.useMemo)(()=>Hv(g,y),[g,y]),De=(0,s.useMemo)(()=>new Set(N.map(e=>e.key)),[N]),Oe=(0,s.useMemo)(()=>new Set(y.filter(e=>!e.enabled).map(e=>e.hostId)),[y]),P=h.phase===`ready`&&h.state===`idle`&&x,[ke,Ae]=(0,s.useState)(()=>Ee),je=(0,s.useCallback)((e,t=!1)=>{ee(e),r?.(e),e||(t||Ae(De.has(Ee)?Ee:`local`),l())},[De,l,r,Ee]);(0,s.useEffect)(()=>{e&&(w(!1),ee(!0))},[e]);let Me=(0,s.useCallback)(e=>{ay(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(Xv,t),()=>{e.abort(),window.removeEventListener(Xv,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`&&j.current!==null&&t.hostId===j.current&&(j.current=null,he({hostId:t.hostId,path:t.path,...typeof t.workspaceId==`string`?{workspaceId:t.workspaceId}:{}}))};return window.addEventListener(Zv,e),()=>{window.removeEventListener(Zv,e)}},[]);let Ne=(0,s.useRef)(t);(0,s.useEffect)(()=>{if(t!==Ne.current&&(Ne.current=t,t!==void 0)){let e=Uv(g,t);Ae(De.has(e)?e:`local`)}},[De,t,g]),(0,s.useEffect)(()=>{t!==void 0&&Ee!==`local`&&De.has(Ee)&&Ae(e=>e===`local`?Ee:e)},[De,t,Ee]);let Pe=(0,s.useRef)(void 0);(0,s.useEffect)(()=>{let e=e=>e!==`local`&&!De.has(e)&&(P||Oe.has(e));e(ke)&&Ae(`local`),j.current!==null&&e(j.current)&&(j.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),a=me!==null&&!e(me.hostId)&&me.workspaceId===t,o=P&&t!==void 0&&n===void 0&&!a&&(ke!==`local`||t.startsWith(`remote-peer:`));r||o?_&&Pe.current!==t&&(Pe.current=t,i(null)):Pe.current=void 0},[ke,De,_,Oe,P,i,me,t,g]);let Fe=(0,s.useMemo)(()=>N.find(e=>e.key===ke)??N[0]??{key:`local`,workspaces:[]},[ke,N]);(0,s.useEffect)(()=>{if(me===null)return;let e=Jv(g,me);e!==void 0&&(he(null),Ae(e.remote?.hostId??`local`),i(e.workspaceId))},[i,me,g]),(0,s.useEffect)(()=>{ce&&!v&&D(!1)},[ce,v]);let F=(0,a.useAnchoredPosition)({open:C,anchorRef:_e,panelRef:ye,side:`bottom`,align:`start`,gap:6,margin:12}),Ie=(0,a.useAnchoredPosition)({open:we,anchorRef:ve,panelRef:be,side:`bottom`,align:`start`,gap:6,margin:12});(0,a.useDismissOnOutsidePointer)(ge,C,w,ye),(0,a.useDismissOnOutsidePointer)(ge,we,(0,s.useCallback)(e=>{e||je(!1)},[je]),be),(0,s.useEffect)(()=>{if(!C)return;te(``),ae(-1);let e=requestAnimationFrame(()=>{M.current?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(e)},[C]),(0,s.useEffect)(()=>{if(!we)return;re(``),se(-1);let e=requestAnimationFrame(()=>{xe.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&&(je(!1),ve.current?.focus({preventScroll:!0})))};return document.addEventListener(`keydown`,e,!0),()=>{document.removeEventListener(`keydown`,e,!0)}},[C,we,je]);let I=(0,s.useCallback)(e=>Dg(e.title,m(`workspace.defaultName`)),[m]),Le=(0,s.useMemo)(()=>Wv(N,E,m(`host.thisComputer`)),[N,E,m]),Re=(0,s.useMemo)(()=>Gv(Fe.workspaces,ne,I),[Fe.workspaces,ne,I]),ze=Fe.key===`local`&&_&&ne.trim()===``,Be=(0,s.useMemo)(()=>[...ze?[{id:$v,workspace:void 0}]:[],...Re.map(e=>({id:e.workspaceId,workspace:e}))],[Re,ze]);(0,s.useEffect)(()=>{ae(e=>Le.length===0?-1:e>=Le.length?0:e)},[Le.length]),(0,s.useEffect)(()=>{se(e=>Be.length===0?-1:e>=Be.length?0:e)},[Be.length]);let Ve=N.length>1,He=ny(Fe,m),Ue=(0,s.useMemo)(()=>t===void 0?void 0:g.find(e=>e.workspaceId===t&&!$g(e)),[t,g]),L=Ue!==void 0&&(Ue.remote?.hostId??`local`)===Fe.key,We=L&&Ue!==void 0?I(Ue):t===void 0&&Fe.key===`local`&&n!==void 0?n:m(`heroPicker.project.choose`),Ge=!L&&(t!==void 0||Fe.key!==`local`||n===void 0),Ke=e=>{let t=e.key!==Fe.key;Ae(e.key),w(!1),t&&je(!0)},qe=e=>{j.current=null,je(!1,!0),i(e===$v?null:e)},Je=(0,s.useCallback)(()=>{j.current=null,pe.current=fe?.open===!0,je(!1,!0),ue(!1),A(null),D(!0)},[fe?.open,je]),Ye=()=>{Fe.key===`local`?v&&!Te&&Je():Fe.hostId?.startsWith(`remote-peer:`)&&Fe.state===`connected`&&(je(!1),j.current=Fe.hostId,window.dispatchEvent(new CustomEvent(`codexhost:open-add-remote-workspace`,{detail:{hostId:Fe.hostId}})))},Xe=Fe.key===`local`?v:Fe.hostId?.startsWith(`remote-peer:`)===!0&&Fe.state===`connected`,Ze=()=>{w(!1),window.dispatchEvent(new CustomEvent(`codexhost:open-remote-peers-settings`))},Qe=e=>d({path:e}).then(e=>{D(!1),Ae(`local`),i(e.workspaceId)}).catch(e=>{A(e instanceof Error?e.message:String(e)),D(!1),ue(!0)}),$e={open:ce,busy:le,onPicked:e=>{O(!0),Qe(e).finally(()=>{O(!1)})},onCancel:()=>{D(!1)},onError:e=>{D(!1),A(e),ue(!0)}},et=e=>{if(Le.length!==0){if(e.key===`ArrowDown`)e.preventDefault(),ae(e=>e<0?0:(e+1)%Le.length);else if(e.key===`ArrowUp`)e.preventDefault(),ae(e=>e<0?Le.length-1:(e-1+Le.length)%Le.length);else if(e.key===`Enter`){e.preventDefault();let t=Le[ie>=0?ie:0];t!==void 0&&Ke(t)}}},tt=e=>{if(Be.length!==0){if(e.key===`ArrowDown`)e.preventDefault(),se(e=>e<0?0:(e+1)%Be.length);else if(e.key===`ArrowUp`)e.preventDefault(),se(e=>e<0?Be.length-1:(e-1+Be.length)%Be.length);else if(e.key===`Enter`){e.preventDefault();let t=Be[oe>=0?oe:0];t!==void 0&&qe(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?Se:void 0,"aria-label":m(`heroPicker.location.aria`,{current:He}),disabled:Te,"data-hero-location-trigger":``,onClick:()=>{je(!1),w(e=>!e)},children:[/* @__PURE__ */ (0,o.jsx)(iy,{location:Fe,className:$.triggerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.triggerLabel,children:He})]}),/* @__PURE__ */ (0,o.jsxs)(`button`,{ref:ve,type:`button`,className:X($.trigger,$.triggerProject,Ge&&$.triggerPlaceholder,we&&$.triggerOpen),"aria-haspopup":`dialog`,"aria-expanded":we,"aria-controls":we?Ce:void 0,"aria-label":m(`heroPicker.project.aria`,{current:We}),disabled:Te,"data-hero-project-trigger":``,onClick:()=>{w(!1),je(!we)},children:[Ge?/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{size:15,className:$.triggerIcon}):/* @__PURE__ */ (0,o.jsx)(a.IconFolderOpenOutlineRegular,{size:15,className:$.triggerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.triggerLabel,children:We})]}),C&&(0,c.createPortal)(/* @__PURE__ */ (0,o.jsxs)(a.MenuSurface,{ref:ye,id:Se,role:`dialog`,"aria-label":m(`heroPicker.location.placeholder`),className:X($.popover,$.popoverLocation),style:F??{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)(a.IconSearchOutlineRegular,{size:15,className:$.searchIcon}),/* @__PURE__ */ (0,o.jsx)(`input`,{ref:M,type:`text`,className:$.searchInput,value:E,placeholder:m(`heroPicker.location.placeholder`),"aria-label":m(`heroPicker.location.placeholder`),spellCheck:!1,autoComplete:`off`,onChange:e=>{te(e.target.value),ae(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:()=>ae(-1),children:Le.length===0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.emptyState,children:m(`heroPicker.location.empty`)}):Le.map((e,t)=>{let n=e.key===Fe.key,r=ny(e,m),i=ry(e.state,m);return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n,className:X($.row,t===ie&&$.rowActive),onMouseEnter:()=>ae(t),onClick:()=>Ke(e),children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowIcon,children:/* @__PURE__ */ (0,o.jsx)(iy,{location:e})}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowMain,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowTitle,children:r})}),i!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowStatus,children:i}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.checkSlot,children:n&&/* @__PURE__ */ (0,o.jsx)(a.IconCheckOutlineRegular,{size:15})})]},e.key)})}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.footerDivider,role:`separator`}),/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:$.footerAction,onClick:Ze,children:[Ve?/* @__PURE__ */ (0,o.jsx)(a.IconSettingsOutlineRegular,{size:15,className:$.footerIcon}):/* @__PURE__ */ (0,o.jsx)(a.IconPlusOutlineRegular,{size:15,className:$.footerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:m(Ve?`heroPicker.location.manageRemote`:`heroPicker.location.connectRemote`)})]})]}),document.body),we&&(0,c.createPortal)(/* @__PURE__ */ (0,o.jsxs)(a.MenuSurface,{ref:be,id:Ce,role:`dialog`,"aria-label":m(`heroPicker.project.placeholder`),className:X($.popover,$.popoverProject),style:Ie??{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)(a.IconSearchOutlineRegular,{size:15,className:$.searchIcon}),/* @__PURE__ */ (0,o.jsx)(`input`,{ref:xe,type:`text`,className:$.searchInput,value:ne,placeholder:m(`heroPicker.project.placeholder`),"aria-label":m(`heroPicker.project.placeholder`),spellCheck:!1,autoComplete:`off`,onChange:e=>{re(e.target.value),se(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:()=>se(-1),children:h.phase===`pending`&&Be.length===0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.emptyState,role:`status`,children:m(`picker.loading`)}):Be.length===0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.emptyState,children:ne.trim()===``?m(`heroPicker.project.empty`):m(`heroPicker.project.noMatches`)}):Be.map((e,n)=>{let r=e.workspace===void 0,i=r?t===void 0:e.id===t,s=r?m(`heroPicker.project.noProject`):I(e.workspace),c=r?void 0:Kv(e.workspace.path,s);return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":i,className:X($.row,n===oe&&$.rowActive),title:e.workspace?.path||s,onMouseEnter:()=>se(n),onClick:()=>qe(e.id),children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowIcon,children:/* @__PURE__ */ (0,o.jsx)(a.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:i&&/* @__PURE__ */ (0,o.jsx)(a.IconCheckOutlineRegular,{size:15})})]},e.id)})}),Xe&&/* @__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:Ye,children:[/* @__PURE__ */ (0,o.jsx)(a.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)(a.Modal,{phoneSidebar:!0,phoneSidebarOrigin:pe.current,open:k,onClose:nt,closeLabel:m(`close`),title:m(`folderError.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:$.modalAction,onClick:nt,children:m(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,className:$.modalAction,disabled:!v,onClick:Je,children:m(`folderError.retry`)})]}),children:/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.modalError,role:`alert`,children:de})})]})}let sy=`@deepseek-ai/dsh-client-ui-workspace/WorkspacePicker.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(sy)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=sy,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 cy={menuStatus:`s4nt4G_menuStatus`,modalAction:`s4nt4G_modalAction`,modalError:`s4nt4G_modalError`};let ly=`::add-workspace`,uy=`::no-workspace`;function dy({t:e,open:t,anchorRef:n,useWorkspaces:r,createWorkspace:i,useDirectoryFlow:c,renderDirectoryFlow:l,onPick:u,onPickNone:d,onClose:f,addOnly:p=!1,onBusyChange:m,side:h=`bottom`,selectedId:g}){let _=r(e=>e),v=_.items.filter(e=>!$g(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),ee=(0,a.usePhoneSidebar)(),E=(0,s.useRef)(!1),[te,ne]=(0,s.useState)(!1),re=w||te;(0,s.useEffect)(()=>{m?.(re)},[re,m]);let ie=c(e=>e);(0,s.useEffect)(()=>{w&&!ie&&T(!1)},[w,ie]);let ae=ie?[{id:ly,label:e(`menu.addWorkspace`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconPlusOutlineRegular,{size:16}),disabled:re}]:[],oe=!p&&v.length>0,se=d!==void 0&&!p,ce=se?[{id:uy,label:e(`menu.noWorkspace`),disabled:re}]:[],D=oe?[...ce,...v.map(t=>({id:t.workspaceId,label:Dg(t.title,e(`workspace.defaultName`)),icon:/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{size:16}),disabled:re}))]:[...ce,...ae],le=D.length===0,O=()=>{x(!1),C(null)},k=e=>i({path:e}).then(e=>{T(!1),u(e.workspaceId)}).catch(e=>{C(e instanceof Error?e.message:String(e)),T(!1),x(!0)}),ue=(0,s.useCallback)(()=>{E.current=ee?.open===!0,f(),x(!1),C(null),T(!0)},[f,ee?.open]),de=p||_.phase===`ready`,A=!se&&!oe&&de&&ae.length===1;(0,s.useEffect)(()=>{t&&A&&!re&&ue()},[t,A,re,ue]);let fe={open:w,busy:te,onPicked:e=>{ne(!0),k(e).finally(()=>{ne(!1)})},onCancel:()=>{T(!1)},onError:e=>{T(!1),C(e),x(!0)}},pe=e=>{e===uy?d?.():e===ly?ue():u(e)};return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Menu,{open:t&&!A&&!le,anchor:null,items:D,...oe?{footer:ae}:{},selectedId:g??(se?uy:void 0),onSelect:pe,onClose:f,side:h,portal:!0,getAnchorRect:y}),t&&!A&&!le&&_.phase===`pending`&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:cy.menuStatus,role:`status`,children:e(`picker.loading`)}),l(fe),/* @__PURE__ */ (0,o.jsx)(a.Modal,{phoneSidebar:!0,phoneSidebarOrigin:E.current,open:b,onClose:O,closeLabel:e(`close`),title:e(`folderError.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:cy.modalAction,onClick:O,children:e(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,className:cy.modalAction,disabled:!ie,onClick:ue,children:e(`folderError.retry`)})]}),children:/* @__PURE__ */ (0,o.jsx)(`div`,{className:cy.modalError,role:`alert`,children:S})})]})}function fy(e){return/* @__PURE__ */ (0,o.jsx)(oy,{...e})}function py(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 my(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 hy({groupBy:e,orderBy:t,archivedFilter:n,onGroupPick:r,onOrderPick:i,onArchivedFilterPick:c,t:l}){let[u,d]=(0,s.useState)(!1),f=(0,s.useRef)(null),p=(0,a.usePhoneSidebar)(),{collapseStyle:m,setCollapseStyle:h}=w_(),{busy:g,failed:_,save:v}=pg(h);return/* @__PURE__ */ (0,o.jsx)(a.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)(a.IconFolderCloseRegular,{})},{id:`workspace-tree`,label:l(`groupBy.workspaceTree`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconWorkspaceTreeOutlineRegular,{})},{id:`flat`,label:l(`groupBy.flat`),icon:/* @__PURE__ */ (0,o.jsx)(a.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)(a.IconChevronsUpDownOutlineRegular,{})},{id:`updated`,label:l(`orderBy.updated`),icon:/* @__PURE__ */ (0,o.jsx)(a.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)(a.IconArchiveOffOutlineRegular,{})},{id:`show-archived`,label:l(`viewOptions.showArchived`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconQueueOutlineRegular,{})},{id:`only-archived`,label:l(`viewOptions.onlyArchived`),icon:/* @__PURE__ */ (0,o.jsx)(a.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,a.focusWithoutRing)(f.current))}):(e===`workspace`||e===`workspace-tree`||e===`flat`?r(e):e===`manual`||e===`updated`?i(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)(a.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)(a.IconSlidersTwoOutlineRegular,{})})}),children:_&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:dg.error,role:`alert`,children:l(`threadTree.style.error`)})})}function gy(e,t,n,r){let i=t.find(e=>e.id===n.sessionId),a=t.find(e=>e.id===r.id);if(i===void 0||a===void 0||i.blank||i.pinned!==n.pinned||a.pinned!==n.pinned||i.id===a.id||!e.includes(i.id))return;let o=t.filter(e=>e.pinned===n.pinned),s=o.findIndex(e=>e.id===i.id);if(o.filter(e=>e.id!==i.id).findIndex(e=>e.id===a.id)+ +(r.half===`after`)===s)return;let c=e.filter(e=>e!==i.id),l=c.indexOf(a.id);if(l!==-1)return c.splice(l+ +(r.half===`after`),0,i.id),pm(c,t.find(e=>e.blank)?.id)}function _y(e){let t=e.currentTarget.getBoundingClientRect();return e.clientY<t.top+t.height/2?`before`:`after`}function vy({rowState:e,onLeaveArchivedOnly:t,partial:n,t:r}){let i=e.archivedFilter===`only`;return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.emptyState,"data-row-key":`empty`,children:[i?/* @__PURE__ */ (0,o.jsx)(a.IconArchiveOutlineRegular,{size:24}):/* @__PURE__ */ (0,o.jsx)(a.IconQueueOutlineRegular,{size:24}),/* @__PURE__ */ (0,o.jsx)(`div`,{children:r(n?`sessions.notLoaded`:i?`empty.noneArchived`:`empty.none`)}),i&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.emptyAction,onClick:t,children:r(`empty.viewOthers`)})]})}function yy({list:e,useSessionStatus:t,startSession:n,open:r,workspaces:i,allWorkspaces:c=i,linkedRoots:l,ungroupedSessionIds:u,rowState:d,nativeSections:f,nativeThreadIds:p,useMovingSectionSessions:m,moveSessionToSection:h,finePointer:g,manageThreadSection:_,onLeaveArchivedOnly:v,workspaceReady:y,canStartProjectless:b,animationResetKey:x,scrollRef:S,onScroll:C,sessionLimits:w,setSessionLimits:T,allWorkspacesShown:ee,setAllWorkspacesShown:E,usePanelInfo:te,onRenameRequest:ne,onDefaultHarnessRequest:re,onDeleteRequest:ie,onSessionRenameRequest:ae,renderSlot:oe,insertWorkspaceBefore:se,moveWorkspaceToSection:ce,nestWorkspaces:D,groupExpansion:le,setGroupExpanded:O,sectionExpansion:k,setSectionExpanded:ue,setSessionOrder:de,pinnedWorkspaceIds:A,setWorkspacePinned:fe,home:pe,t:j,revealSessionId:me,onSessionRevealed:he,shortcuts:ge,loadMoreSessions:_e,hostScopeFiltered:ve=!1,singleRemoteHostScoped:ye=!1,onResetHostScope:be}){let M=w_(),xe=(0,a.usePhoneSidebar)(),Se=te(e=>e.activePanelId!==null),Ce=t(e=>e),we=Se?void 0:Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,Te=(0,s.useMemo)(()=>i.map(e=>{let t=l.get(e.workspaceId);return t===void 0||t.size===0?e:{...e,sessionIds:e.sessionIds.filter(e=>!t.has(e))}}),[l,i]),Ee=me===void 0||!y?void 0:cm(Te,M.rootId(me)),[N,De]=(0,s.useState)(null),Oe=(0,s.useRef)(!1),[P,ke]=(0,s.useState)(null),Ae=(0,s.useRef)(!1),je=(0,s.useRef)(null),Me=(0,s.useRef)(null);(0,s.useLayoutEffect)(()=>{let e=Me.current;if(Me.current=null,e===null||document.activeElement!==document.body)return;let t=je.current?.querySelector(`[role="tree"]`);(t?.querySelector(`[data-row-key="${CSS.escape(`workspace:${e}`)}"]`)??t?.querySelector(`[data-row-key][tabindex="0"]`))?.focus()},[A]);let Ne=(0,s.useMemo)(()=>new Map(Tm(e,d,Ce).map(e=>[e.id,e])),[e,d,Ce]),Pe=(0,s.useMemo)(()=>Sy(f,e,d,Ce,k,Ne),[f,e,d,Ce,k,Ne]),Fe=(0,s.useMemo)(()=>new Map(Pe.map(e=>[e.id,e.rows.filter(e=>!e.archived&&!e.pinned).map(e=>e.id)])),[Pe]),F=Vv({enabled:g&&h!==void 0&&f.length>0,nativeSections:f,visibleSectionRows:Fe,nativeThreadIds:p,pinnedSessionIds:d.pinnedSessionIds,archivedSessionIds:d.archivedSessionIds,moveSessionToSection:h,onCancelLocalDrag:()=>{Oe.current=!0,De(null)}}),Ie=N!==null||P!==null||F.active;my(P!==null||N!==null);let I=we===void 0||!y?void 0:cm(Te,M.rootId(we)),Le=(0,s.useMemo)(()=>new Set(A),[A]),{nativeSectionOf:Re,sectionOf:ze}=(0,s.useMemo)(()=>Cg(f,Le),[f,Le]),[Be,Ve]=(0,s.useState)(),[He,Ue]=(0,s.useState)(!1),L=(0,s.useMemo)(()=>new Set(ce&&f.length>0?c.filter(e=>e.projectId&&!e.remote&&!Le.has(e.workspaceId)).map(e=>e.workspaceId):[]),[c,ce,f.length,Le]);(0,s.useEffect)(()=>{Be&&!L.has(Be)&&Ve(void 0)},[Be,L]);let We=e=>{if(P&&ce&&L.has(P.workspaceId)&&(Re.get(P.workspaceId)??null)!==e)return{active:P.overSection===e,hover:()=>{P.overSection!==e&&ke({...P,over:null,overSection:e})},leave:()=>ke(t=>t?.overSection===e?{workspaceId:t.workspaceId,over:null}:t),drop:()=>{Ae.current||(Ae.current=!0,ke(null),Ue(!1),ce(P.workspaceId,e).catch(()=>Ue(!0)))}}},Ge=(0,s.useMemo)(()=>wg(i,D,Re,Le),[D,Re,Le,i]),Ke=(0,s.useMemo)(()=>c===i?Ge:wg(c,D,Re,Le),[c,D,Re,Ge,Le,i]),qe=(0,s.useMemo)(()=>{let e=new Set(Ge.values());return[...i.map(e=>e.workspaceId),``].filter(t=>le[t]??(t===``||e.has(t)))},[le,Ge,i]),Je=(0,s.useMemo)(()=>{let t=Em(e,i,d,Ce,{expandedGroups:qe,excludePinned:!0},Ne);return(b||e.hasMore&&t.length===0)&&!t.some(e=>e.key===``)&&t.push({key:``,workspaceId:void 0,cwd:void 0,createdAt:void 0,label:``,sessionCount:0,expanded:qe.includes(``),containsCurrent:!1,activity:{running:0,pendingInteraction:0,completed:0},sessions:[]}),t},[e,i,d,Ce,qe,b,Ne]),Ye=Date.now(),Xe=e=>kv(e.sessions,w[e.key]??5,we,me),Ze=(e,t)=>{if(Oe.current)return;Oe.current=!0,De(null);let n=Je.find(t=>t.key===e.accountKey);if(n===void 0||t.id===e.sessionId)return;let r=e.accountKey===``?u:i.find(t=>t.workspaceId===e.accountKey)?.sessionIds;if(r===void 0)return;let a=gy(r,Xe(n).rows,e,t);a!==void 0&&de(e.accountKey,a)},Qe=(e,t)=>{if(Ae.current)return;Ae.current=!0,ke(null);let n=Sg(c,e.workspaceId,t,{sectionOf:ze,parents:Ke});n!==null&&se(e.workspaceId,n.beforeWorkspaceId).catch(e=>{console.warn(`workspace reorder rejected:`,e)})},$e=(0,s.useMemo)(()=>{let e=new Set(Je.map(e=>e.key)),t=/* @__PURE__ */ new Map;for(let n of Je){let r=Ge.get(n.key);for(;r!==void 0&&!e.has(r);)r=Ge.get(r);let i=t.get(r);i===void 0?t.set(r,[n]):i.push(n)}return t},[Je,Ge]),et=$e.get(void 0)??[],tt=(0,s.useMemo)(()=>{let e=/* @__PURE__ */ new Map,t=(n,r)=>{e.set(n.key,r);for(let e of $e.get(n.key)??[])t(e,r)};for(let e of et)t(e,e.key);return e},[$e,et]),nt=(0,s.useMemo)(()=>{let e=/* @__PURE__ */ new Set;for(let t of[I,Ee]){let n=t===void 0?void 0:tt.get(t);n!==void 0&&n!==``&&e.add(n)}return e},[I,Ee,tt]),{pinnedGroups:rt,sectionRoots:it,workspaceRoots:at}=(0,s.useMemo)(()=>Tg(et,f,A,ze),[f,A,et,ze]),ot=Av(at,5,nt),st=ee?at:ot.rows,ct=Im(k,Pm),lt=Ee===void 0?void 0:tt.get(Ee),ut=lt!==void 0&&Le.has(lt);(0,s.useEffect)(()=>{if(ut){ct||ue(Pm,!0);for(let e=Ee;e!==void 0;e=Ge.get(e))qe.includes(e)||O(e,!0)}},[qe,Ge,ct,Ee,ut,O,ue]);let dt=Im(k,Fm),ft=e=>{e.expanded&&T(t=>({...t,[e.key]:5})),O(e.key,!e.expanded)},pt=(0,s.useMemo)(()=>new Set(d.archivedSessionIds),[d.archivedSessionIds]),mt=(0,s.useMemo)(()=>new Map(c.map(e=>[e.workspaceId,e])),[c]),ht=(0,s.useMemo)(()=>km(e,d.pinnedSessionIds,d,Ce,Ne).filter(e=>e.pinned),[e,d,Ce,Ne]),gt=ht.length>0||rt.length>0,_t=[];if(gt&&(_t.push(`section:${Pm}`),ct))for(let e of M.rows(ht))_t.push(`session:${e.id}`);let vt=e=>{let t={...e.activity};for(let n of $e.get(e.key)??[]){let e=vt(n);t.running+=e.running,t.pendingInteraction+=e.pendingInteraction,t.completed+=e.completed}return t},yt=(t,i)=>{let s=t.workspaceId,u=s!==void 0&&!t.remote,f=Le.has(t.key),p=$e.get(t.key)??[],h=ze.has(t.key),g=P!==null&&xg(c,P.workspaceId,s,{sectionOf:ze,parents:Ke}),_=Xe(t);_t.push(`workspace:${t.key}`);let v=t.expanded?p.map(e=>yt(e,i+1)):[],x=t.expanded?void 0:vt(t),S=M.rows(_.rows),C=l.get(t.key),w=new Set(C===void 0?[]:_.rows.flatMap(e=>C.has(e.id)?[e.id,...e.tree?.descendantIds??[]]:[])),ee=e=>s===void 0?`recent:${e}`:w.has(e)?`linked:${t.key}:${e}`:`session:${e}`;for(let e of S)_t.push(ee(e.id));let E=e=>d.archivedFilter===`show`?!0:d.archivedFilter===`only`?pt.has(e):!pt.has(e),te=t.remote&&s!==void 0&&(mt.get(s)?.sessionIds.some(t=>e.byId[t]===void 0&&E(t))??!1),se=u||te,ce=se?e.workspaceHistory?.[s]??(e.canSearchWorkspaceHistory?`search`:`done`):void 0,D=ce===void 0?!t.remote&&e.hasMore:ce!==`done`,le=t.expanded&&(_.hiddenCount>0||D);le&&_t.push(`overflow:${t.key}`);let k=s!==void 0&&P?.over?.id===s?P?.over?.half??null:null,de=s!==void 0&&L.has(s),A=s===void 0||h&&!de?void 0:{start:()=>{Ae.current=!1,ke({workspaceId:s,over:null})},end:()=>{P?.over!==null&&P?.over!==void 0?Qe(P,P.over):ke(null),Ae.current=!1}},ve=s===void 0||!g?void 0:e=>{ke(t=>t===null?t:{workspaceId:t.workspaceId,over:{id:s,half:e}})},be=s===void 0||!g?void 0:e=>{Qe(P,{id:s,half:e})};return/* @__PURE__ */ (0,o.jsxs)(`div`,{"data-sidebar-group":t.key,style:{"--dsh-workspace-indent":`${i*12}px`},className:X(Z.groupSection,k===`before`&&Z.workspaceDropBefore,k===`after`&&Z.workspaceDropAfter),onDragOver:P===null?void 0:e=>{e.preventDefault(),(ve!==void 0||Ge.get(t.key)===void 0)&&(e.stopPropagation(),ve===void 0?(e.dataTransfer.dropEffect=`none`,P.over!==null&&ke({...P,over:null})):(e.dataTransfer.dropEffect=`move`,ve(_y(e))))},onDrop:P===null?void 0:e=>{e.preventDefault(),(be!==void 0||Ge.get(t.key)===void 0)&&(e.stopPropagation(),be===void 0?(Ae.current=!0,ke(null)):be(_y(e)))},children:[s===void 0?/* @__PURE__ */ (0,o.jsx)(wv,{label:j(`group.ungrouped`),expanded:t.expanded,onToggle:()=>{ft(t)},rowKey:`workspace:${t.key}`,action:b?{label:j(`actions.newSession`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconNewChatOutlineRegular,{size:16}),onActivate:()=>{O(t.key,!0),xe?.close(),n()}}:void 0}):/* @__PURE__ */ (0,o.jsx)(dv,{newShortcut:ge.find(e=>e.id===`session.new`),group:t,foldedActivity:x,showHost:!ye,home:pe,t:j,onToggle:()=>{ft(t)},onCreate:()=>{t.workspaceId!==void 0&&(O(t.key,t.expanded),xe?.close(),n(t.workspaceId))},drag:A,pin:fe?{pinned:f,toggle:()=>{Me.current=s,f||ue(Pm,!0),fe(s,!f).catch(e=>{console.warn(`workspace pin rejected:`,e)})}}:void 0,actions:u?{...de?{moveToSection:()=>Ve(s)}:{},rename:()=>ne(s,t.label),defaultHarness:e=>re(s,t.label,e),delete:()=>ie(s,t.label)}:void 0}),v.length>0&&/* @__PURE__ */ (0,o.jsx)(`div`,{role:`group`,children:v}),(S.length>0||le)&&/* @__PURE__ */ (0,o.jsxs)(`div`,{role:`group`,className:Z.groupSessions,style:{"--dsh-workspace-indent":`${s===void 0?0:i*12+22}px`},onDragOver:N!==null&&N.accountKey===t.key?e=>{let t=Z_(e,N.pinned);t!==null&&(F.clearHover(),(N.over?.id!==t.id||N.over.half!==t.half)&&De({...N,over:t}),e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`)}:void 0,onDrop:N!==null&&N.accountKey===t.key?e=>{if(e.dataTransfer.dropEffect===`copy`)return;let t=Z_(e,N.pinned);t!==null&&(e.preventDefault(),e.stopPropagation(),F.end(),Ze(N,t))}:void 0,children:[/* @__PURE__ */ (0,o.jsx)(B_,{roots:_.rows,children:e=>{let n=N!==null&&N.accountKey===t.key,i=n&&N.pinned===e.pinned,a=t=>e.blank?`after`:t,c=s!==void 0&&!t.remote&&(e.tree?.depth??0)===0,l=F.canDragRow(e,!!t.remote),u=c?{start:()=>{Oe.current=!1,De({accountKey:t.key,sessionId:e.id,pinned:e.pinned,over:null}),l?F.startFromUnsectioned(e.id):F.end()},active:i,marker:!F.hasSectionTarget&&n&&N.over?.id===e.id?N.over.half:null,hover:t=>{
|
|
121
|
+
default:return em(n)}}function _m(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 vm(e){return e.blank?``:e.title?.trim()??``}function ym(e){let t=Date.parse(e);return Number.isFinite(t)&&t>0?t:void 0}function bm(e,t,n,r,i,a,o){return{key:e,workspaceId:t,cwd:n,createdAt:r,label:i,sessions:[...a],remote:o}}function xm(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&&gm(s,n,r)&&(t.push(s),i.has(o)&&a.add(o))}(r!==`only`||t.length!==0)&&o.push(bm(s.workspaceId,s.workspaceId,s.path,ym(s.createdAt),s.title,t,s.remote))}let s=pm(e.ids.filter(e=>!a.has(e)),e.byId).map(t=>e.byId[t]).filter(e=>e!==void 0&&gm(e,n,r));return s.length>0&&o.push(bm(``,void 0,void 0,void 0,``,s)),o}function Sm(e){switch(e){case`approval`:case`plan-review`:case`question`:return e;default:return}}function Cm(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 wm(e,t,n){let r=n.get(e.id),i=Sm(r?.pendingInteraction?.kind),a=r?.running??e.running,o=Cm(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 Tm(e,t,n,r,i){let a=wm(e,t,n),o=i.has(e.id);return{id:e.id,reference:am(e),remote:e.projectionValues?.remoteHost??void 0,title:vm(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 Em(e,t){let n=e.projectionValues?.threadTreeParent??null;if(n===null)return null;let r=t?.byId[Yp(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 Dm(e,t,n){let r=new Set(t.archivedSessionIds),i=new Set(t.pinnedSessionIds);return cm(Am(e,t.archivedSessionIds,t.archivedFilter).flatMap(t=>{let a=e.byId[t];return a===void 0?[]:[Tm(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:Em(r,e)})}function Om(e,t,n,r,i,a){let o=new Set(n.archivedSessionIds),s=new Set(n.pinnedSessionIds),c=new Set(i.expandedGroups),l=dm(e),u=a??new Map(Dm(e,n,r).map(e=>[e.id,e])),d=[];for(let r of xm(e,t,o,n.archivedFilter)){let e=c.has(r.key),t=r.sessions.flatMap(e=>{let t=u.get(e.id);return t===void 0||i.excludePinned&&(t.pinned||n.sectionedSessionIds?.has(t.id))?[]:[t]});r.key===``&&t.sort((e,t)=>(t.tree?.updatedAt??t.updatedAt)-(e.tree?.updatedAt??e.updatedAt)||e.id.localeCompare(t.id));let a={running:0,pendingInteraction:0,completed:0};for(let e of t)e.archived||(a.running+=Number(e.running||e.runningSubagentCount>0)+(e.tree?.activity.running??0),a.pendingInteraction+=Number(e.pendingInteraction!==void 0)+(e.tree?.activity.pendingInteraction??0),a.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:t.length,expanded:e,activity:a,containsCurrent:t.some(e=>e.id===l||l!==void 0&&e.tree?.descendantIds.includes(l)),sessions:e?_m(t,s,o):[]})}return d}function km(e,t=[]){return[...Am(e,[],`show`),...t.filter(t=>e.byId[t]===void 0)]}function Am(e,t,n){let r=new Set(t);return e.ids.filter(t=>{let i=e.byId[t];return i!==void 0&&gm(i,r,n)})}function jm(e,t,n,r,i){if(t.length===0)return[];let a=new Set(n.archivedSessionIds),o=new Set(n.pinnedSessionIds),s=i??new Map(Dm(e,n,r).map(e=>[e.id,e]));return _m(t.flatMap(e=>{let t=s.get(e);return t===void 0?[]:[t]}),o,a)}function Mm(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)??fm(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&&gm(n,l,i)&&(vm(n).toLowerCase().includes(c)||d(n).toLowerCase().includes(c))&&p.push(n)}let m=new Map(p.map(e=>[e.id,e])),h=pm(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&&gm(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=Sm(r?.pendingInteraction?.kind),o=Em(t,e);return{id:t.id,title:vm(t),workspace:d(t),...o===null?{}:{parentTitle:e.byId[Yp(o)]?.title??``},remote:t.projectionValues?.remoteHost??void 0,running:r?.running??t.running,runningSubagentCount:Cm(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 Nm(e){return(/^[A-Za-z]:[/\\]/.test(e)||e.startsWith(`\\\\`)?e.replaceAll(`\\`,`/`):e).replace(/\/+$/,``)}function Pm(e,t){let n=Nm(e),r,i=-1;for(let e of t){let t=Nm(e);t.length>i&&n!==t&&n.startsWith(`${t}/`)&&(r=e,i=t.length)}return r}let Fm=`__flat_session_order__`,Im=`pinned`,Lm=`workspaces`;function Rm(e,t){return e?.[t]??!0}function zm(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 Bm(){return(0,r.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`?zm(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,zm(t,e.sessionOrderByAccount,n))},setSessionOrder:(e,t,n,r,i)=>{let a=zm({...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=zm(Object.fromEntries(Object.entries(r.members).map(([t,n])=>[t,mm(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 Vm(e,t,n){let r=n??Dm(e,t,/* @__PURE__ */ new Map),i=new Set(Am(e,t.archivedSessionIds,t.archivedFilter)),a=/* @__PURE__ */ new Set([...r.map(e=>e.id),...km(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(Yp(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 Hm(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 Um(e,t,n,r){let i=r??Vm(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,Hm(e.sessionIds,i).memberIds]),[``,a([.../* @__PURE__ */ new Set([...t.ids,...n.archivedSessionIds])]).filter(e=>!o.has(e))],[Fm,a(km(t,n.archivedSessionIds))]]),summaries:i.summaries,rowState:n}}function Wm(e,t){return[um(e,t),Fm]}var Gm=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 Km=`codexhost.web.session-tabs.v2:local`,qm=`codexhost.web.session-tabs.v1:local`,Jm=`codexhost.web.recent-visits.v1:local`,Ym=1048576;function Xm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Zm(e){return typeof e==`string`&&e.length>0&&e.length<=1024&&e.trim()===e&&!/[\u0000-\u001f\u007f]/u.test(e)?Yp(e):void 0}function Qm(e,t){if(typeof e==`string`)return e===t?t:void 0;if(!Xm(e)||Object.keys(e).length!==3)return;let n=Zm(e.parentSessionId),r=Zm(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 $m(e,t){if(e===null||e.length>Ym)return[];try{let n=JSON.parse(e);if(!Xm(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(!Xm(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=Zm(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=Qm(e.target,o);c!==void 0&&(i.add(o),r.push({sessionId:o,target:c,lastVisitedAt:s}))}return r}catch{return[]}}var eh=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>Ym){this.failed();return}localStorage.getItem(Km)!==i&&localStorage.setItem(Km,i),localStorage.removeItem(qm),localStorage.removeItem(Jm)}catch{this.failed()}}latest(){let e=localStorage.getItem(Km);return e===null?$m(localStorage.getItem(qm)??localStorage.getItem(Jm),1):$m(e,2)}failed(){if(!this.reported){this.reported=!0;try{this.onFailure()}catch{}}}},th=class{sessions;workspaces;subscribeRemoved;entries=(0,r.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 eh(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=wm(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)||nh(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 nh(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)}var rh=class extends Error{rpcError;name=`DirectoryBrowseError`;constructor(e){super(`directory browse failed: ${e.code}: ${e.message}`),this.rpcError=e}},ih=class extends i.Service{directoryPicker;workspaces;sessions;view;notify;connecting=/* @__PURE__ */ new Map;lifetime=new AbortController;selection=(0,r.createSnapshotStore)({},{persist:{name:`dsh.sessions.current`}});mainReference;mainIsRemote=!1;disposeMainSessionWatch;opening=(0,r.createSnapshotStore)({state:`idle`});retryOpen;openingLoad;creating=(0,r.createSnapshotStore)({state:`idle`});retryCreate;creatingLoad;creationToken=0;openedProjectlessBlank;keepalive;recentVisits;constructor(e,t,n,r,i,a){super(e,`uiWorkspace`),this.directoryPicker=t,this.workspaces=n,this.sessions=r,this.view=i,this.notify=a,this.keepalive=new Gm(r,n);let o=e.get(`remote`);this.recentVisits=new th(r,n,o===void 0?void 0:e=>o.$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;let e=this.mainReference;this.mainReference=void 0,this.mainIsRemote=!1,e?.release()}},`ui-workspace: Workspace navigation policy`)}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){let t=this.workspaces.list.getSnapshot().archivedSessionIds,n=this.sessions.list.getSnapshot();for(let r of n.ids){let i=n.byId[r];if(i===void 0||!i.blank||i.cwd!==e.path||!e.sessionIds.includes(r)||t.includes(r))continue;let a=await this.tryReuseBlank(e.workspaceId,r);if(a!==void 0)return a}return this.sessions.create({workspaceId:e.workspaceId})}async reuseOrCreateProjectlessBlank(){let e=this.workspaces.list.getSnapshot(),t=this.sessions.list.getSnapshot(),n=n=>{let r=t.byId[n];return r!==void 0&&r.blank&&r.cwd===void 0&&r.parentId===void 0&&r.origin===void 0&&!this.isRemoteSession(n)&&!e.archivedSessionIds.includes(n)&&!e.items.some(e=>e.sessionIds.includes(n))},r=this.openedProjectlessBlank,i=r!==void 0&&n(r)?r:t.ids.find(n);return(i===void 0?void 0:await this.tryReuseBlank(void 0,i))??this.sessions.create()}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}={}){let r=e===void 0?{}:{workspaceId:e};try{return await this.sessions.create({...r,sessionId:t,...!n&&e!==void 0?{matchProjectDefault:!0}:{}})}catch(e){let t=ah(e)?.rpcError.code;if(t!==`session/writer-held`&&(n||t!==`session/busy`))throw e;return}}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=oh(n)===`remote/offline`;if(i!==void 0&&(s||sh(n))){o(),i(s?{message:dh(n)}:void 0);return}this.retryOpen=r,this.opening.set({state:`error`,sessionId:e,message:dh(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=AbortSignal.any([this.ctx.layout.beginNavigation(),this.lifetime.signal]),r;try{if(e===null&&!this.workspaces.list.getSnapshot().canStartProjectless)throw new ch;r=e===null?await this.reuseOrCreateProjectlessBlank():await this.connectWorkspace(e)}catch(e){throw n.aborted||this.notify({kind:`createFailed`,message:dh(e)}),e}n.aborted||(e===null?this.openProjectlessBlank(r,n,`reveal`,t):this.replaceMain(r,n,`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`?fh(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 ch;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=lh(r),a=i===`unknown`?uh(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,Wm(t,e),Um(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 rh(n.error);return n.value}async createDirectory(e,t){let n=await this.directoryPicker.createDirectory(e,t);if(!n.ok)throw new rh(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??fh(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 ah(e){return e instanceof Error&&e.name===`SessionCreateError`?e:void 0}function oh(e){if(typeof e==`object`&&e&&`isDSHRemoteError`in e&&e.isDSHRemoteError===!0&&`code`in e)return e.code}function sh(e){let t=oh(e);return t===`session/not-found`||t===`remote/not-found`||t===`remote/identity-invalid`}var ch=class extends Error{name=`WorkspaceRequiredError`;constructor(){super(`This Host requires a Workspace.`)}};function lh(e){return ah(e)?.rpcError.code===`host/no-harness`?`no-harness`:e instanceof ch?`workspace-required`:`unknown`}function uh(e){let t=ah(e),n=(t===void 0?e instanceof Error?e.message:String(e):t.rpcError.message).trim();return n===``?void 0:n}function dh(e){let t=ah(e);return t===void 0?e instanceof Error?e.message:String(e):`${t.rpcError.code}: ${t.rpcError.message}`}function fh(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 ph=`@deepseek-ai/dsh-client-ui-workspace/PhoneHeaderNewSession.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(ph)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=ph,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 mh={button:`--73Qq_button`,icon:`--73Qq_icon`};function hh({startSession:e,useShortcuts:t,t:n}){let r=t(e=>e.find(e=>e.id===`session.new`));return/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:n(`actions.newSession`),shortcutKeys:r?.keys,side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:mh.button,"aria-label":n(`actions.newSession`),"aria-keyshortcuts":r?.aria,"data-phone-new-session":!0,onClick:()=>{e()},children:/* @__PURE__ */ (0,o.jsx)(a.IconNewChatOutlineRegular,{size:17,className:mh.icon})})})}let gh=`@deepseek-ai/dsh-client-ui-workspace/RecentShortcut.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(gh)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=gh,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_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 _h={activity:`oOF3UG_activity`,close:`oOF3UG_close`,identity:`oOF3UG_identity`,select:`oOF3UG_select`,shortcut:`oOF3UG_shortcut`,title:`oOF3UG_title`};function vh({visit:e,summary:t,identity:n,activityLabel:r,activity:i,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:_h.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:_h.select,onMouseDown:e=>e.preventDefault(),title:t.displayTitle,"aria-current":c?`page`:void 0,"aria-label":[t.displayTitle,t.id,r].filter(Boolean).join(` · `),onClick:()=>{c||(p(),d(e.target))},children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:_h.identity,children:n}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:_h.title,children:t.displayTitle}),i!=null&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:_h.activity,title:r,children:i})]}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:_h.close,onMouseDown:e=>e.preventDefault(),"aria-label":l,title:u,onClick:()=>{p(),f(e.sessionId)},children:/* @__PURE__ */ (0,o.jsx)(a.IconCloseOutlineRegular,{size:12})})]})}let yh=`@deepseek-ai/dsh-client-ui-workspace/Rows.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(yh)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=yh,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_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]){width:14px;color:inherit}._5OaiBG_sessionRow:has([data-harness-id]) ._5OaiBG_title,._5OaiBG_searchResultHeading:has([data-harness-id]) ._5OaiBG_searchResultTitle{margin-left:8px}._5OaiBG_statusOverlay{display:contents}._5OaiBG_slot:has([data-harness-id]) ._5OaiBG_statusOverlay{transform-origin:100% 100%;display:inline-flex;position:absolute;bottom:-3px;right:-3px;transform:scale(.65)}._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 q={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 bh(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 xh(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 xh(e){throw Error(`unknown pending interaction: ${String(e)}`)}function Sh({statuses:e}){return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.StateDot,{state:e[0].state,size:e[0].state===`ongoing`?16:void 0}),e.map(e=>/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.visuallyHidden,children:e.label},e.label))]})}let Ch=`@deepseek-ai/dsh-client-ui-workspace/RecentNavigation.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ch)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Ch,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 wh={clear:`qXmkFa_clear`,expanded:`qXmkFa_expanded`,shortcuts:`qXmkFa_shortcuts`,trigger:`qXmkFa_trigger`};function Th({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:bh(wm(t,o,c),i)}]})}function Eh(e){let{useRecentNavigationSettings:t,open:n,close:r,closeAll:i,viewport:c,restoreNavigationFocus:l,renderSlot:u,t:d}=e,f=t(e=>e.value?.showRecentVisits??!0),p=Th(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:wh.shortcuts,"aria-label":d(`recent.navigation`),onScroll:e=>v(e.currentTarget),children:[p.map(({visit:t,summary:i,statuses:a})=>/* @__PURE__ */ (0,o.jsx)(vh,{visit:t,summary:i,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)(Sh,{statuses:a}),active:e.sessionId===t.sessionId,closeLabel:d(`recent.close`,{name:i.displayTitle}),closeHint:d(`recent.closeHint`),open:e=>{v(),n(e)},close:e=>{v();try{r(e)}catch{_(!0)}},restoreNavigationFocus:l},t.sessionId)),p.length>=3&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:wh.clear,"aria-label":d(`recent.clearAll`),title:d(`recent.clearAllHint`),onMouseDown:e=>e.preventDefault(),onClick:()=>{l();try{i()}catch{_(!0)}},children:d(`recent.clear`)})]}),g&&/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:d(`recent.closeFailed`),onDone:()=>_(!1)})]}):null}function Dh(e){let{useRecentNavigationSettings:t,setEnabled:n,t:r}=e,i=t(e=>e.value?.showRecentVisits??!0),c=Th(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:wh.trigger,"aria-label":r(i?`recent.collapse`:`recent.expand`),"aria-expanded":i,"aria-disabled":l||void 0,"aria-busy":l||void 0,onClick:()=>{p.current||(p.current=!0,u(!0),f(!1),n(!i).then(e=>f(!e)).catch(()=>f(!0)).finally(()=>{p.current=!1,u(!1)}))},children:/* @__PURE__ */ (0,o.jsx)(a.IconChevronDownOutlineRegular,{size:14,className:i?wh.expanded:void 0})}),d&&/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:r(`recent.settings.error`),onDone:()=>f(!1)})]})}function Oh(e){return e==null}function kh(e){return e&&typeof e==`object`&&!Array.isArray(e)}function Ah(e,t){return Object.fromEntries(Object.entries(e).filter(([e,n])=>t(e,n)))}function jh(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n,e)]))}function Mh(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 Nh=Symbol.for(`cosmokit.volatile.write`);function Ph(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=>Ph(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,Ph(n,t)])))}finally{t.delete(e)}}function Fh(e){let t=Ph(e);return Object.freeze({get:()=>t,[Nh]:e=>{t=e}})}function Ih(e){return typeof e==`object`&&!!e&&Nh in e}function Lh(e,t){return arguments.length===1?t=>Lh(e,t):e in globalThis&&t instanceof globalThis[e]||Object.prototype.toString.call(t).slice(8,-1)===e}function Rh(e){return Lh(`ArrayBuffer`,e)||Lh(`SharedArrayBuffer`,e)}function zh(e){return Rh(e)||ArrayBuffer.isView(e)}let Bh;(function(e){e.is=Rh,e.isSource=zh;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})(Bh||={}),Bh.fromBase64,Bh.toBase64,Bh.fromHex,Bh.toHex;function Vh(e,t=/* @__PURE__ */ new Map){if(!e||typeof e!=`object`)return e;if(Lh(`Date`,e))return new Date(e.valueOf());if(Lh(`RegExp`,e))return new RegExp(e.source,e.flags);if(Rh(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(Vh,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(Vh,null,[i.value,t])),Reflect.defineProperty(r,n,i)}return r}function Hh(e,t,n){let r=/* @__PURE__ */ new Set;function i(e,t){if(e===t)return!0;if(Ih(e)||Ih(t))return Ih(e)&&Ih(t);if(!n&&Oh(e)&&Oh(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(Lh(`Date`),(e,t)=>e.valueOf()===t.valueOf())??a(Lh(`URL`),(e,t)=>e.href===t.href)??a(Lh(`RegExp`),(e,t)=>e.source===t.source&&e.flags===t.flags)??a(Rh,(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 Uh;(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})(Uh||={});let Wh=Symbol.for(`schemastery`),Gh=Symbol.for(`ValidationError`);globalThis.__schemastery_index__??=0,globalThis.__schemastery_refs__=void 0;var J=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?.[Gh]}};Object.defineProperty(J.prototype,Gh,{value:!0});let Y=function(e){let t=function(e,n={}){return Y.resolve(e,t,n)[0]};if(e.refs){let t=jh(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&&jh(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[Wh]=!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(J.is(e))return{issues:[{message:e.message,path:e.options.path}]};throw e}}}}}),Y.ValidationError=J,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 Kh(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 qh(e){return e?.$value??e?.$inner}function Jh(e){return Ah(e??{},e=>!e.startsWith(`$`))}Y.prototype.i18n=function(e){let t=Y(this),n=Kh(t.meta.description,e);return Object.keys(n).length&&(t.meta.description=n),t.dict&&=jh(t.dict,(t,n)=>t.i18n(jh(e,e=>qh(e)?.[n]??e?.[n]))),t.list&&=t.list.map((t,n)=>t.i18n(jh(e,(e={})=>Array.isArray(qh(e))?qh(e)[n]:Array.isArray(e)?e[n]:Jh(e)))),t.inner&&=t.inner.i18n(jh(e,e=>qh(e)?qh(e):Jh(e))),t.sKey&&=t.sKey.i18n(jh(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=Mh(e,[`source`,`flags`]);return t.meta={...t.meta,pattern:n},t},Y.prototype.simplify=function(e){if(Ih(e)&&(e=e.get()),Hh(e,this.meta.default,this.type===`dict`))return null;if(Oh(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`||!Oh(r))&&(t[n]=r)}return Hh(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 rg[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 Yh={},Xh=Symbol(`checked-volatile-schema`);function Zh(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 J(`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))Zh(i,[...t,n],a,r);if(e.sKey&&Zh(e.sKey,[...t,`<key>`],!0,r),e.inner&&(e.type!==`lazy`||e.inner[Wh])&&Zh(e.inner,[...t,`*`],!0,r),e.list)for(let n=0;n<e.list.length;n++)Zh(e.list[n],[...t,String(n)],!0,r)}Y.extend=function(e,t){Yh[e]=t},Y.resolve=function(e,t,n={},r=!1){if(!t)return[e];if(n[Xh]||(Zh(t,n.path),n={...n,[Xh]:!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[Fh(a),o]}catch(e){throw new J(e instanceof Error?e.message:String(e),n)}}if(n.ignore?.(e,t))return[e];if(Oh(e)&&t.type!==`lazy`){if(t.meta.required)throw new J(`missing required value`,n);let r=t,i=t.meta.default;for(;r?.type===`intersect`&&Oh(i);)r=r.list[0],i=r?.meta.default;if(Oh(i))return[e];e=Vh(i)}let i=Yh[t.type];if(!i)throw new J(`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(Oh(e))return Y.any();if([`string`,`number`,`boolean`].includes(typeof e))return Y.const(e).required();if(e[Wh])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[Wh]||(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 J(`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 J(e.message,n)}},!0)])},Y.arrayBuffer=function(e){return Y.union([Y.is(ArrayBuffer),Y.is(SharedArrayBuffer),Y.transform(Y.any(),(e,t)=>{if(Bh.isSource(e))return Bh.fromSource(e);throw new J(`expected ArrayBufferSource but got ${e}`,t)},!0),...e?[Y.transform(Y.string(),(t,n)=>{try{return e===`base64`?Bh.fromBase64(t):Bh.fromHex(t)}catch(e){throw new J(e.message,n)}},!0)]:[]])},Y.extend(`lazy`,(e,t,n,r)=>(t.inner[Wh]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta},Zh(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 J(`expected nullable but got ${e}`,n)}),Y.extend(`const`,(e,{value:t},n)=>{if(Hh(e,t))return[t];throw new J(`expected ${t} but got ${e}`,n)});function Qh(e,t,n,r,i=!1){let{max:a=1/0,min:o=-1/0}=t;if(e>a)throw new J(`expected ${n} <= ${a} but got ${e}`,r);if(e<o&&!i)throw new J(`expected ${n} >= ${o} but got ${e}`,r)}Y.extend(`string`,(e,{meta:t},n)=>{if(typeof e!=`string`)throw new J(`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 J(`expect string to match regexp ${r}`,n)}return Qh(e.length,t,`string length`,n),[e]});function $h(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 eg(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($h(e,i)-$h(t,i))%$h(n,i)===0}Y.extend(`number`,(e,{meta:t},n)=>{if(typeof e!=`number`)throw new J(`expected number but got ${e}`,n);Qh(e,t,`number`,n);let{step:r}=t;if(r&&!eg(e,t.min??0,r))throw new J(`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 J(`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 J(`expected string but got ${e}`,r);e in t&&(i|=t[e])}}else throw new J(`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 J(`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 J(`expected ${t.name} but got ${e}`,n)}{if(Oh(e))throw new J(`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 J(`expected ${t} but got ${e}`,n)}});function tg(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?Fh(n.meta.default):n.meta.default}}Y.extend(`array`,(e,{inner:t,meta:n},r)=>{if(!Array.isArray(e))throw new J(`expected array but got ${e}`,r);return Qh(e.length,n,`array length`,r,!Oh(t.meta.default)),[e.map((n,i)=>tg(e,i,t,r))]}),Y.extend(`dict`,(e,{inner:t,sKey:n},r,i)=>{if(!kh(e))throw new J(`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]=tg(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 J(`expected array but got ${e}`,n);let i=t.map((t,r)=>tg(e,r,t,n));return r||i.push(...e.slice(t.length)),[i]});function ng(e,t){for(let n in t)n in e||(e[n]=t[n])}Y.extend(`object`,(e,{dict:t},n,r)=>{if(!kh(e))throw new J(`expected object but got ${e}`,n);let i={};for(let r in t){let a=tg(e,r,t[r],n);(!Oh(a)||r in e)&&(i[r]=a)}return r||ng(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 J(`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(!Oh(t)){if(Oh(a))a=t;else if(typeof a!=typeof t)throw new J(`expected ${n()} but got ${JSON.stringify(e)}`,r);else if(typeof t==`object`)ng(a??={},t);else if(a!==t)throw new J(`expected ${n()} but got ${JSON.stringify(e)}`,r)}}return!i&&kh(e)&&ng(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 rg={};function ig(e,t,n){rg[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=jh(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}})}ig(`is`,[`constructor`],({constructor:e})=>typeof e==`function`?e.name:e),ig(`any`,[],()=>`any`),ig(`never`,[],()=>`never`),ig(`const`,[`value`],({value:e})=>typeof e==`string`?JSON.stringify(e):e),ig(`string`,[],()=>`string`),ig(`number`,[],()=>`number`),ig(`boolean`,[],()=>`boolean`),ig(`bitset`,[`bits`],()=>`bitset`),ig(`function`,[],()=>`function`),ig(`array`,[`inner`],({inner:e})=>`${e.toString(!0)}[]`),ig(`dict`,[`inner`,`sKey`],({inner:e,sKey:t})=>`{ [key: ${t.toString()}]: ${e.toString()} }`),ig(`tuple`,[`list`],({list:e})=>`[${e.map(e=>e.toString()).join(`, `)}]`),ig(`object`,[`dict`],({dict:e})=>Object.keys(e).length===0?`{}`:`{ ${Object.entries(e).map(([e,t])=>`${e}${t.meta.required?``:`?`}: ${t.toString()}`).join(`, `)} }`),ig(`union`,[`list`],({list:e},t)=>{let n=e.map(({toString:e})=>e()).join(` | `);return t?`(${n})`:n}),ig(`intersect`,[`list`],({list:e})=>`${e.map(e=>e.toString(!0)).join(` & `)}`),ig(`transform`,[`inner`,`callback`,`preserve`],({inner:e},t)=>e.toString(t));let ag=[0,15,30,60,120,240,1440],og={showRecentVisits:!0,tabIdleTimeoutMinutes:60},sg={showRecentVisits:Y.boolean().default(!0),tabIdleTimeoutMinutes:Y.natural().max(1440).default(60)},cg=`@deepseek-ai/dsh-client-ui-workspace/RecentNavigationRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(cg)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=cg,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 lg={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 ug({usePreference:e,setEnabled:t,setIdleTimeout:n,t:r}){let i=e(e=>e.value),c=i?.showRecentVisits??!0,l=i?.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?r(`recent.timeout.off`):e>=120&&e%60==0?r(`recent.timeout.hours`,{n:e/60}):r(`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:lg.row,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:lg.text,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:lg.titleLine,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:lg.title,children:r(`recent.settings.title`)}),/* @__PURE__ */ (0,o.jsx)(a.Tag,{tone:`neutral`,children:r(`recent.settings.mobile`)})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:lg.description,children:r(`recent.settings.description`)})]}),/* @__PURE__ */ (0,o.jsx)(a.Switch,{checked:c,disabled:f,label:`${r(`recent.settings.title`)} · ${r(`recent.settings.mobile`)}`,onChange:e=>y(()=>t(e))})]}),c&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:`${lg.row} ${lg.timeoutRow}`,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:lg.text,children:/* @__PURE__ */ (0,o.jsx)(`div`,{className:lg.title,id:`${_}-label`,children:r(`recent.timeout.title`)})}),/* @__PURE__ */ (0,o.jsx)(a.Menu,{className:lg.menu,open:u&&c&&!f,onClose:()=>d(!1),items:ag.map(e=>({id:String(e),label:e===60?r(`recent.timeout.default`,{value:v(e)}):v(e)})),selectedId:String(l),onSelect:e=>{let t=ag.find(t=>String(t)===e);t!==void 0&&y(()=>n(t))},align:`end`,portal:!0,anchor:/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:lg.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)(a.IconChevronDownOutlineRegular,{size:14})]})})]}),m&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:lg.error,role:`alert`,children:r(`recent.settings.error`)})]})}function dg(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}})},hh)),e.slots.inject(`conversation.header.navigation`,()=>e.slots.register({name:`conversation.header.navigation`,locale:`workspace`,inject:o},Dh)),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`}}},Eh)),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})},ug))}let fg=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeStyle.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=`.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 pg={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 mg=[`summary`,`ring`];function hg(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 gg({style:e,setStyle:t,t:n,settings:r=!1}){let i=(0,s.useId)(),{busy:c,failed:l,save:u}=hg(t);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:r?a.preferenceRowStyles.row:pg.options,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:`${a.preferenceRowStyles.rowText} ${r?pg.settingsText:``}`,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:a.preferenceRowStyles.title,id:i,children:n(`threadTree.style.title`)}),r&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:a.preferenceRowStyles.description,id:`${i}-description`,children:n(`threadTree.style.description`)})]}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:a.preferenceRowStyles.choices,role:`radiogroup`,"aria-labelledby":i,"aria-describedby":r?`${i}-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:mg.map(t=>/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,role:`radio`,className:a.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:pg.error,role:`alert`,children:n(`threadTree.style.error`)})]})}function _g({usePreference:e,setStyle:t,t:n}){let r=e(e=>e.value?.threadTreeCollapseStyle??`summary`);return/* @__PURE__ */ (0,o.jsx)(gg,{style:r,setStyle:t,t:n,settings:!0})}let vg={...og,threadTreeCollapseStyle:`summary`},yg=Y.object({...sg,threadTreeCollapseStyle:Y.union([`summary`,`ring`]).default(`summary`)});function bg(e){return typeof e==`object`&&!!e&&Object.hasOwn(e,`threadTreeCollapseStyle`)}function xg(e){let t=e.configForms.registerBrowser(`ui-workspace`,yg.toJSON(),{...vg});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)})},_g)),t}function Sg(e,t){return e!==void 0&&e.has(t)}function Cg(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||Sg(r.sectionOf,t)||Sg(r.sectionOf,n)||r.parents!==void 0&&r.parents.get(t)!==r.parents.get(n))}function wg(e,t,n,r={}){if(!Cg(e,t,n.id,r))return null;let i=r.parents?.get(t),a=e.filter(e=>!Sg(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 Tg(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,Im);return{nativeSectionOf:n,sectionOf:r}}function Eg(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=Pm(e.path,[...t?.keys()??[]]);return[e.workspaceId,n===void 0?void 0:t?.get(n)]}))}function Dg(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 Og(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=Og(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=Og(e))&&(r&&(r+=` `),r+=t);return r}function kg(e,t){return e===`default-workspace`?t:e}let Ag=`@deepseek-ai/dsh-client-ui-workspace/WorkspaceBrowser.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ag)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Ag,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{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 jg({section:e,request:t,t:n}){let[r,i]=(0,s.useState)(!1),c=n(`actions.section.aria`,{name:e.name});return/* @__PURE__ */ (0,o.jsx)(a.Menu,{open:r,onClose:()=>i(!1),items:[{id:`rename`,label:n(`section.rename.title`)},{id:`delete`,label:n(`section.delete.title`)}],onSelect:n=>{i(!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":r,onClick:()=>i(!r),children:/* @__PURE__ */ (0,o.jsx)(a.IconEllipsisOutlineRegular,{size:16})})})}function Mg({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)(Ng,{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)(Pg,{section:c.section,dismiss:t,deleteSection:i,notifySyncPending:a,t:s},`delete:${c.section.id}`)}function Ng({initialName:e,requireChange:t,title:n,submitLabel:r,saveName:i,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 i(y);if(e.status===`unknown`){m(`unknown`),g(u(`section.outcomeUnknown`));return}c(),e.syncPending&&l()}catch(e){g(Fg(e)),v.current=!1,m(`editing`)}}};return/* @__PURE__ */ (0,o.jsxs)(a.Modal,{phoneSidebar:!0,open:!0,onClose:x,closeLabel:u(`close`),title:n,footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:p===`saving`,onClick:x,children:u(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,disabled:p!==`editing`||b,onClick:()=>void S(),children:r})]}),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 Pg({section:e,dismiss:t,deleteSection:n,notifySyncPending:r,t:i}){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 a=await n(e.id);if(a.status!==`confirmed`){d(i(`section.outcomeUnknown`));return}t(),a.syncPending&&r()}catch(e){d(Fg(e))}finally{f.current=!1,l(!1)}}};return/* @__PURE__ */ (0,o.jsxs)(a.Modal,{phoneSidebar:!0,open:!0,onClose:p,closeLabel:i(`close`),title:i(`section.delete.title`),description:i(`section.delete.desc`,{name:e.name}),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:c,onClick:p,children:i(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:Z.deleteAction,disabled:c,onClick:()=>void m(),children:i(`section.delete.action`)})]}),children:[c&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.deleteStatus,role:`status`,children:i(`section.delete.pending`)}),u!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:u})]})}function Fg(e){return e instanceof Error?e.message:String(e)}function Ig(e){return e.pendingInteraction!==void 0}function Lg(e){return e.running||e.runningSubagentCount>0}function Rg(e){return e.completed}function zg(e){return e.archived||e.blank?null:Ig(e)||(e.tree?.activity.pendingInteraction??0)>0?0:Lg(e)||(e.tree?.activity.running??0)>0?1:Rg(e)||(e.tree?.activity.completed??0)>0?2:null}function Bg(e){let t=/* @__PURE__ */ new Set,n=[],r=e=>{!e.archived&&!e.blank&&Rg(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 Vg(e,t,n){let r=Dm(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=zg(t);n!==null&&(a+=Number(Ig(t))+(t.tree?.activity.pendingInteraction??0),o+=Number(Lg(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=Bg(s),l=c.length;return{rows:s,unreadSessionIds:c,pendingCount:a,runningCount:o,unreadCount:l,hasAttention:a>0||l>0}}let Hg=`@deepseek-ai/dsh-client-ui-workspace/AnimatedRows.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=`.Jek-Ha_exits{contain:strict;pointer-events:none;position:absolute;inset:0;overflow:clip}`,document.head.appendChild(e)}var Ug={exits:`Jek-Ha_exits`};function Wg(e){return[...e.querySelectorAll(`[data-row-key]`)].filter(e=>e.offsetHeight>0&&!e.closest(`[inert]`))}function Gg(e){if(!e)return;let t=Wg(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 Kg(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=Wg(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`}),Gg(t))}function qg(e,t){return e.rowKeys.length===t.rowKeys.length&&e.rowKeys.every((e,n)=>e===t.rowKeys[n])}function Jg(e,t){return e.bottom>t.top&&e.top<t.bottom&&e.right>t.left&&e.left<t.right}var Yg=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(){Gg(this.list.current)}getSnapshotBeforeUpdate(e){let t=this.list.current;if(!this.armed||qg(e,this.props)||e.resetKey!==this.props.resetKey||!e.ready||!this.props.ready||t===null||typeof t.animate!=`function`||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return null;let n=t.getBoundingClientRect(),r=this.readPositions(),i=new Set(this.props.rowKeys),a=/* @__PURE__ */ new Map;for(let[e,t]of r){if(i.has(e)||!Jg(t.rect,n))continue;let r=t.element.cloneNode(!0);r.removeAttribute(`data-row-key`),r.inert=!0,r.style.setProperty(`--dsh-workspace-indent`,getComputedStyle(t.element).getPropertyValue(`--dsh-workspace-indent`)),a.set(e,{...t,element:r})}return{positions:r,removed:a}}componentDidUpdate(e,t,n){if(Gg(this.list.current),n===null){(!qg(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,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(!Jg(t.rect,a)&&(r===void 0||!Jg(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()}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:Kg,onFocusCapture:()=>Gg(this.list.current),onPointerDownCapture:()=>{this.armed=!0},onKeyDownCapture:()=>{this.armed=!0},children:this.props.children}),/* @__PURE__ */ (0,o.jsx)(`div`,{ref:this.overlay,className:Ug.exits,"aria-hidden":`true`})]})}};function Xg({identity:e,ambient:t,title:n,onIdentityClick:r,identityLabel:i,identityControls:a,identityExpanded:s,children:c}){let l=/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[e,/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.statusOverlay,children:t})]});return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[r?/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:`${q.slot} ${q.identityButton}`,onClick:r,"data-thread-icon-toggle":!0,"aria-label":i,title:i,"aria-expanded":s,"aria-controls":a,children:[l,/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.foldChevron,"aria-hidden":`true`})]}):/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.slot,children:l}),/* @__PURE__ */ (0,o.jsx)(`span`,{"data-session-title":!0,className:q.title,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.titleText,children:n})}),c]})}function Zg({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:Xd(e.hostId,e.color);return/* @__PURE__ */ (0,o.jsxs)(`span`,{className:X(q.hostBadge,t===`session`&&q.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:q.hostDot,"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.hostLabel,children:r})]})}let Qg=`codexhost.sidebar.hostScopeFilter.v1`,$g=`codexhost:apply-host-scope-workspace-selection`;function e_(e){return e.some(e=>e.remote!==void 0)}function t_(e){if(e.remote===void 0)return!1;let t=e.path??e.cwd;return t===void 0||t.trim()===``}function n_(e){return e.some(e=>e.remote?.hostId.startsWith(`remote-peer:`)===!0)}function r_(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 i_(e,t){return e.selectedHost===`all`||r_(t).some(t=>t.key===e.selectedHost)?e:{...e,selectedHost:`all`}}function a_(e,t,n){let r=r_(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 o_(e,t){let n=i_(e,t);return n.selectedHost!==`all`||r_(t).some(e=>n.perHost[e.key]?.mode===`selected`)}function s_(e,t){let n=i_(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 c_(e){return typeof e==`string`?e:e.id}function l_(e){return typeof e==`string`?`local`:e.remote?.hostId??e.projectionValues?.remoteHost?.hostId??`local`}function u_(e,t){if(!e_(t))return!0;let n=i_(e,t);return(n.selectedHost===`all`||n.selectedHost===`local`)&&n.perHost.local?.mode!==`selected`}function d_(e,t,n=s_(t,e)){if(!e_(t))return!0;let r=i_(e,t);return r.selectedHost!==`all`&&r.selectedHost!==`local`?!1:r.perHost.local?.mode!==`selected`||n.some(e=>e.remote===void 0)}function f_(e,t,n,r,i){let a=i_(r,n);if(!o_(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=c_(e),n=i?.get(t)??t;if(c.has(n))return!0;if(!s.has(n)){let t=l_(e);return(a.selectedHost===`all`||a.selectedHost===t)&&a.perHost[t]?.mode!==`selected`}return!1})}function p_(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 m_(e,t){return e.selectedHost===t?e:{...e,selectedHost:t}}function h_(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 g_(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 __(e,t,n){return{...e,perHost:{...e.perHost,[t]:{mode:`selected`,workspaceIds:[...new Set(n)]}}}}function v_(){return{selectedHost:`all`,perHost:{}}}function y_(e,t,n){let r=i_(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 b_(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function x_(e){if(e===null||e===``)return v_();try{let t=JSON.parse(e);if(!b_(t))return v_();let n=typeof t.selectedHost==`string`&&t.selectedHost.trim()!==``?t.selectedHost:`all`,r={};if(b_(t.perHost))for(let[e,n]of Object.entries(t.perHost)){if(e===``||!b_(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 v_()}}function S_(e){try{let t=e===void 0?typeof window<`u`?window.localStorage:null:e;return t===null?v_():x_(t.getItem(Qg))}catch{return v_()}}function C_(e,t){try{let n=t===void 0?typeof window<`u`?window.localStorage:null:t;if(n===null)return;n.setItem(Qg,JSON.stringify(e))}catch{}}let w_={},T_=(0,s.createContext)({t:e=>e,forest:[],expansion:w_,rows:e=>lm(e,w_),toggle:()=>{},markCompletionsRead:()=>{},collapseStyle:`summary`,stylePrompt:void 0,dismissStylePrompt:()=>{},setCollapseStyle:async()=>!1,rootId:e=>e,reveal:()=>{},selectSidebarRow:()=>{},isSidebarSelection:()=>!1});function E_(){return(0,s.useContext)(T_)}function D_({browser:e,children:t}){let{useSessions:n,useStore:r,useWorkspaces:i,actions:a,useWorkspacePreferences:c,setThreadTreeCollapseStyle:l}=e,u=c(e=>e),d=bg(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??w_),x=r(e=>e.archivedFilter??`default`),S=(0,s.useMemo)(()=>Dm(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,[]),ee=(0,s.useCallback)(e=>{w.current=e,a.setThreadsExpanded(C.get(e)?.ancestors??[],!0)},[a,C]),E=(0,s.useCallback)(e=>{w.current=void 0;let t=C.get(e);t!==void 0&&a.setThreadsExpanded(t.ancestors,!0)},[a,C]),te=Object.values(g.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,ne=(0,s.useRef)(``);(0,s.useEffect)(()=>{te===void 0?ne.current=``:C.get(te)!==void 0&&ne.current!==te&&(ne.current=te,T(te)||E(te))},[te,T,E,C]);let re=(0,s.useMemo)(()=>({t:e.t,forest:S,expansion:b,rows:e=>lm(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:E,selectSidebarRow:ee,isSidebarSelection:T}),[e.t,e.markCompletionsRead,a,S,b,C,E,ee,T,f,d,p,h,l]);return/* @__PURE__ */ (0,o.jsx)(T_.Provider,{value:re,children:t})}let O_=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeControls.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(O_)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=O_,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]){--dsh-thread-icon-size:14px}.jGgv6G_branch:has(>:first-child [data-harness-id])>.jGgv6G_children{--dsh-thread-parent-icon-size:14px}.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 k_={branch:`jGgv6G_branch`,children:`jGgv6G_children`,summary:`jGgv6G_summary`};function A_(e){return[{state:`running`,count:e.running},{state:`pending`,count:e.pendingInteraction},{state:`completed`,count:e.completed}]}function j_(e){return e.pendingInteraction>0?`pending`:e.running>0?`running`:e.completed>0?`completed`:`idle`}function M_(e,t,n){return[n(`threadTree.children`,{n:e}),...A_(t).filter(e=>e.count>0).map(e=>n(`threadTree.${e.state}`,{n:e.count}))].join(` · `)}function N_({count:e,activity:t,t:n}){return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[n(`threadTree.children`,{n:e}),A_(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 P_=`@deepseek-ai/dsh-client-ui-workspace/ThreadTreeRing.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(P_)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=P_,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 F_={ring:`yY-O0a_ring`,spin:`yY-O0a_spin`};function I_({activity:e}){return/* @__PURE__ */ (0,o.jsx)(`span`,{className:F_.ring,"data-thread-ring":j_(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 L_=[{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 R_({style:e,t}){return/* @__PURE__ */ (0,o.jsx)(`div`,{className:pg.preview,"aria-hidden":`true`,children:L_.map(({title:n,activity:r})=>/* @__PURE__ */ (0,o.jsx)(`div`,{className:k_.branch,children:/* @__PURE__ */ (0,o.jsxs)(`div`,{className:`${q.sessionRow} ${pg.sampleRow}`,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.sessionMain,children:/* @__PURE__ */ (0,o.jsx)(Xg,{title:t(n),identity:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(`span`,{"data-harness-id":`codex`,className:pg.sampleIcon,children:/* @__PURE__ */ (0,o.jsx)(`img`,{src:`/harness-icons/codex`,width:14,height:14,alt:``})}),e===`ring`&&/* @__PURE__ */ (0,o.jsx)(I_,{activity:r})]})})}),e===`summary`&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:`${k_.summary} ${pg.sampleSummary}`,children:/* @__PURE__ */ (0,o.jsx)(N_,{count:2,activity:r,t})})]})},n))})}function z_({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}=hg(t);return/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:u,className:pg.prompt,"data-thread-style-prompt":!0,role:`region`,"aria-labelledby":a,children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:pg.promptHeading,children:[/* @__PURE__ */ (0,o.jsx)(`strong`,{id:a,children:i(`threadTree.style.promptTitle`)}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:pg.later,disabled:f,onClick:n,children:i(`threadTree.style.later`)})]}),/* @__PURE__ */ (0,o.jsx)(`p`,{className:pg.hint,children:i(`threadTree.style.hint`)}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:pg.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`?mg[e.key===`Home`?0:1]:mg[+(c===`summary`)];e.currentTarget.querySelector(`[data-thread-style-choice="${t}"]`)?.focus()},children:mg.map(t=>/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`radio`,className:pg.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:pg.choiceTitle,id:`${a}-${t}`,children:i(`threadTree.style.${t}`)}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:pg.choiceSubtitle,id:`${a}-${t}-description`,children:i(`threadTree.style.${t}Subtitle`)}),/* @__PURE__ */ (0,o.jsx)(R_,{style:t,t:i})]},t))}),p&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:pg.error,role:`alert`,children:i(`threadTree.style.error`)})]})}let B_=(0,s.createContext)(void 0),V_=()=>(0,s.useContext)(B_);function H_({roots:e,children:t}){return e.map(e=>/* @__PURE__ */ (0,o.jsx)(U_,{node:e,renderRow:t},e.id))}function U_({node:e,renderRow:t}){let n=(0,s.useId)(),{expansion:r,stylePrompt:i,dismissStylePrompt:a,collapseStyle:c,setCollapseStyle:l,t:u}=E_(),d=r[e.id]===!0,f=e.tree?.depth??0,p=e.tree?.children??[];return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:k_.branch,"data-thread-branch":e.id,children:[/* @__PURE__ */ (0,o.jsx)(B_.Provider,{value:n,children:t(e)}),d&&i===n&&/* @__PURE__ */ (0,o.jsx)(z_,{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:k_.children,style:{"--dsh-thread-guide-indent":`${Math.min(f,3)*24}px`},children:d&&/* @__PURE__ */ (0,o.jsx)(H_,{roots:p,children:t})})]})}function W_({node:e,title:t,toggle:n,t:r}){let i=V_(),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=M_(c.descendantCount,c.activity,r);return/* @__PURE__ */ (0,o.jsx)(`button`,{ref:a,type:`button`,"data-thread-summary":!0,className:k_.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)(N_,{count:c.descendantCount,activity:c.activity,t:r})})}function G_(e){return e!=null&&e.id.length>0&&e.id!==`01984de2-8f74-7c91-a3b2-5c5e937cf318`}let K_=`(hover: hover) and (pointer: fine)`;function q_(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(K_).matches}function J_(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 Y_(e){return e.moving&&(e.depth??0)===0&&e.blank!==!0&&e.archived!==!0}function X_(e,t){if(t!==void 0)return t.find(t=>G_(t)&&t.threadIds.includes(e))}function Z_(e,t){if(!G_(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 Q_(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 $_(e,t){if(e.target!==e.currentTarget)return null;let n=String(t),r=null,i=0;for(let t of e.currentTarget.children){let a=t.getAttribute(`data-thread-branch`);if(a===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 ev(e){return!(e.committed||e.cancelled||e.dropEffect===`copy`)}function tv(e,t,n,r){if(t.kind===`unsectioned`){let t=n.find(t=>t.id===e.sourceSectionId);return t===void 0||!G_(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||!G_(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 nv(e,t,n,r){if(!G_(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 rv(e){let t=/* @__PURE__ */ new Set,n=(0,r.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 iv=/* @__PURE__ */ new Set;function av(e){return e(iv)}function ov(e,t){return e.blank?t(`session.new`):e.title||t(`session.untitled`)}function sv(e,t,n){let{unit:r,n:i}=(0,a.relativeTime)(e,t);return r===`now`?n(`time.now`):n(`time.${r}`,{n:i})}function cv(e,t,n){let{unit:r,n:i}=(0,a.relativeTime)(e,t);return r===`now`?n(`time.now`):n(`time.ago`,{t:n(`time.${r}`,{n:i})})}function lv(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 uv({label:e,cwd:t,createdAt:n,t:r}){return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:q.hoverContent,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.hoverTitle,children:e}),t!==void 0&&t!==``&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.hoverPath,children:t}),n!==void 0&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.hoverTime,children:lv(n,r)})]})}function dv(e){let t=e.currentTarget.getBoundingClientRect();return e.clientY<t.top+t.height/2?`before`:`after`}function fv({color:e,state:t,className:n}){return/* @__PURE__ */ (0,o.jsx)(`span`,{className:X(q.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 pv({group:e,foldedActivity:t,onToggle:n,onCreate:r,pin:i,actions:c,drag:l,showHost:u=!0,home:d,newShortcut:f,t:p}){let m=e,h=t===void 0?void 0:{pending:`warning`,running:`ongoing`,completed:`done`,idle:void 0}[j_(t)],g=e.remote?void 0:c,_=l,v=t_(m),y=m.workspaceId===void 0?p(`group.ungrouped`):v?p(`group.remoteOtherSessions`):m.label,b=m.remote===void 0?void 0:Xd(m.remote.hostId,m.remote.color),x=u&&m.workspaceId!==void 0&&m.remote!==void 0,[S,C]=(0,s.useState)(!1),[w,T]=(0,s.useState)(null),ee=(0,s.useRef)(null),E=p(i?.pinned?`menu.unpinWorkspace`:`menu.pinWorkspace`),te=i?.pinned?a.IconPinFillRegular:a.IconPinOutlineRegular,ne=[...i?[{id:`pin`,label:E,icon:/* @__PURE__ */ (0,o.jsx)(te,{})}]:[],...g?[{id:`rename`,label:p(`rename`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconEditOutlineRegular,{})},...g.defaultHarness?[{id:`defaultHarness`,label:p(`defaultHarness.title`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconSettingsOutlineRegular,{})}]:[],...g.moveToSection?[{id:`move`,label:p(`menu.moveToSection`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{})}]:[],{id:`delete`,label:p(`delete.workspace`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconTrashOutlineRegular,{}),danger:!0}]:[]],re=/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(q.projectRow,S&&q.menuOpen),"data-row-key":`workspace:${e.key}`,role:`treeitem`,"aria-expanded":m.expanded,tabIndex:-1,onContextMenu:e=>{ne.length&&!e.target.closest(`button`)&&(e.preventDefault(),T(new DOMRect(e.clientX,e.clientY,0,0)),C(!0))},onKeyDown:e=>{e.target===e.currentTarget&&ne.length&&(e.key===`ContextMenu`||e.shiftKey&&e.key===`F10`)&&(e.preventDefault(),T(null),C(!0))},onClick:n,draggable:_!==void 0,onDragStart:_===void 0?void 0:e=>{e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,m.key),_.start()},onDragEnd:_?.end,children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:X(q.slot,m.expanded&&q.folderExpanded),children:[v?/* @__PURE__ */ (0,o.jsx)(a.IconQueueOutlineRegular,{size:16}):m.expanded?/* @__PURE__ */ (0,o.jsx)(a.IconFolderOpenRegular,{}):/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{}),x&&m.remote&&b!==void 0&&/* @__PURE__ */ (0,o.jsx)(fv,{color:b,state:m.remote.state})]}),x&&m.remote?/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:q.remoteHostText,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.title,children:y}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.remoteHostMeta,children:m.remote.displayName})]}),h===void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.remoteHostStatusDot,"data-state":m.remote.state,"aria-hidden":`true`})]}):/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.projectText,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.title,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.titleText,children:y})})}),h!==void 0&&t!==void 0&&/* @__PURE__ */ (0,o.jsxs)(`span`,{className:q.projectActivity,"data-project-activity":h,children:[/* @__PURE__ */ (0,o.jsx)(a.StateDot,{state:h,size:h===`ongoing`?16:void 0}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.visuallyHidden,children:A_(t).filter(e=>e.count>0).map(e=>p(`threadTree.${e.state}`,{n:e.count})).join(` · `)})]}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:q.rowActions,children:[ne.length>0&&/* @__PURE__ */ (0,o.jsx)(a.Menu,{open:S,onClose:()=>{C(!1)},items:ne,onSelect:e=>{C(!1),e===`pin`&&i?.toggle(),e===`rename`&&g?.rename(),e===`defaultHarness`&&g?.defaultHarness?.(ee.current),e===`move`&&g?.moveToSection?.(),e===`delete`&&g?.delete()},portal:!0,autoFocus:!0,getAnchorRect:w===null?void 0:()=>w,anchor:/* @__PURE__ */ (0,o.jsx)(`button`,{ref:ee,type:`button`,className:q.iconButton,"aria-label":p(`actions.workspace.aria`,{name:y}),"aria-haspopup":`menu`,"aria-expanded":S,onClick:e=>{e.stopPropagation(),T(null),C(e=>!e)},children:/* @__PURE__ */ (0,o.jsx)(a.IconEllipsisOutlineRegular,{})})}),(!m.remote||m.remote.state===`connected`&&!v)&&/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:p(`actions.newSession`),shortcutKeys:f?.keys,side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:q.iconButton,"aria-keyshortcuts":f?.aria,"aria-label":p(`actions.newSession.aria`,{name:y}),onClick:e=>{e.stopPropagation(),r()},children:/* @__PURE__ */ (0,o.jsx)(a.IconNewChatOutlineRegular,{})})})]})]}),ie=m.cwd!==void 0&&m.cwd!==``?m.cwd:void 0;return m.workspaceId===void 0||ie===void 0&&m.createdAt===void 0?re:/* @__PURE__ */ (0,o.jsx)(a.HoverCard,{anchor:re,content:/* @__PURE__ */ (0,o.jsx)(uv,{label:y,cwd:ie===void 0?void 0:nm(ie,d),createdAt:m.createdAt,t:p}),openDelayMs:800,disabled:S,copyText:ie,copyLabel:p(`copy`),copiedLabel:p(`hover.copied`)})}function mv({node:e,now:t,renderSlot:n,t:r}){let i=bh(e,r).filter(t=>!e.archived||t.state!==`done`&&t.state!==`idle`),s=e.remote===void 0?void 0:Xd(e.remote.hostId,e.remote.color),c=e.remote?.state===`connected`?r(`host.connected`):e.remote?.state===`connecting`?r(`host.connecting`):r(`host.disconnected`);return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:q.hoverContent,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.hoverTitle,children:ov(e,r)}),e.remote&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:q.hoverHost,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.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:q.hoverPath,children:e.cwd}),!e.blank&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.hoverTime,children:cv(e.updatedAt,t,r)}),n(`sidebar.session.row.hover`,{sessionId:e.id}),i.map(e=>/* @__PURE__ */ (0,o.jsxs)(`div`,{className:q.hoverStatus,children:[/* @__PURE__ */ (0,o.jsx)(a.StateDot,{state:e.state}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:e.label})]},e.label)),e.archived&&/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(q.hoverStatus,q.hoverArchived),children:[/* @__PURE__ */ (0,o.jsx)(a.IconArchiveOutlineRegular,{size:16}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:r(`row.archived`)})]})]})}function hv({result:e,currentId:t,onOpen:n,onUnarchive:r,t:i}){let s=e.id===t,c=bh(e,i),l=c[0];return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(q.searchResultRow,s&&q.selected,e.archived&&q.archived),role:`treeitem`,"aria-selected":s,"aria-description":e.archived?i(`toast.archivedNotOpenable`):void 0,onClick:()=>{n(e.id)},children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:q.searchResultHeading,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.slot}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.searchResultTitle,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.titleText,children:e.title||i(`session.untitled`)})}),e.remote&&/* @__PURE__ */ (0,o.jsx)(Zg,{host:e.remote,variant:`session`,t:i}),!e.archived&&l.state!==`idle`&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.timeStatus,"data-session-status":l.state,children:/* @__PURE__ */ (0,o.jsx)(Sh,{statuses:c})}),e.archived&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.rowActions,children:/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:i(`actions.unarchive`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:q.iconButton,"aria-label":i(`menu.unarchiveSession`),onClick:t=>{t.stopPropagation(),r(e.id)},children:/* @__PURE__ */ (0,o.jsx)(a.IconUnarchiveOutlineRegular,{size:16})})})})]}),/* @__PURE__ */ (0,o.jsxs)(`span`,{className:q.searchResultMeta,children:[/* @__PURE__ */ (0,o.jsxs)(`span`,{className:q.searchResultWorkspace,children:[e.workspace||i(`group.ungrouped`),e.parentTitle!==void 0&&` · ${e.parentTitle||i(`session.untitled`)}`]}),e.snippet!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.searchResultSnippet,children:e.snippet})]})]})}function gv({node:e,rowKey:t=`session:${e.id}`,currentId:n,now:r,onOpen:i,onRenameRequest:c,renderSlot:l,onReveal:u,drag:d,useMovingSectionSessions:f=av,showHost:p=!0,t:m}){let h=e,{expansion:g,toggle:_,markCompletionsRead:v,collapseStyle:y}=E_(),b=V_(),x=e.tree,S=x?.depth??0,C=!h.archived&&x!==void 0&&x.activity.completed>0?()=>{v(x.descendantIds.map(Yp))}:void 0,w=g[e.id]===!0,T=S===0?d:void 0,ee=f(t=>t.has(e.id)),E=Y_({depth:S,blank:h.blank,archived:h.archived,moving:ee}),te=ov(e,m),ne=e.id===n,re=bh(e,m),ie=re[0],ae=!h.archived&&ie.state!==`idle`,oe=h.remote===void 0?void 0:Xd(h.remote.hostId,h.remote.color),se=p&&h.remote!==void 0&&oe!==void 0,ce=T!==void 0&&T.canDrag!==!1&&!E&&!h.blank&&!h.archived,D=h.blank?void 0:h.reference,le=ce||D!==void 0,O=(0,s.useRef)(!1),[k,ue]=(0,s.useState)(!1),[de,A]=(0,s.useState)(null),fe=(0,s.useMemo)(()=>[k,ue],[k]),pe=(0,s.useRef)(null);(0,s.useEffect)(()=>{u!==void 0&&(pe.current?.scrollIntoView({block:`nearest`}),u())},[u]);let j=/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:pe,"data-row-key":t,"data-thread-parent":e.tree?.parentId??void 0,"data-thread-depth":S,"data-thread-sortable":String(ce),"data-thread-pinned":String(e.pinned),"data-section-moving":E?`true`:void 0,style:{"--dsh-thread-indent":`${Math.min(S,3)*24}px`},className:X(q.sessionRow,ne&&q.selected,k&&q.menuOpen,h.archived&&q.archived,E&&q.sectionMoving,T?.marker===`before`&&q.dropBefore,T?.marker===`after`&&q.dropAfter),role:`treeitem`,"aria-selected":ne,"aria-current":ne?`page`:void 0,"aria-busy":E||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(),A(new DOMRect(e.clientX,e.clientY,0,0)),ue(!0))},onKeyDown:t=>{t.target!==t.currentTarget||h.blank||(O.current=!1,t.key===`ContextMenu`||t.shiftKey&&t.key===`F10`?(t.preventDefault(),A(null),ue(!0)):t.key===`F2`&&!h.archived&&(t.preventDefault(),c(e.id,h.title)))},"aria-description":h.archived?m(`toast.archivedNotOpenable`):void 0,onPointerDown:()=>{O.current=!1},onClick:()=>{O.current||(ne&&!h.archived&&e.tree?.descendantCount?(w&&v(e.tree.descendantIds),_(e.id,!w,b)):i(e.id))},draggable:le,onDragStart:le?t=>{O.current=!0,t.dataTransfer.effectAllowed=D===void 0?`move`:ce?`copyMove`:`copy`,t.dataTransfer.setData(`text/plain`,D===void 0?e.id:sm(D).clipboardText),D!==void 0&&t.dataTransfer.setData(`application/x-codexhost-thread-reference`,JSON.stringify(D)),ce&&T?.start()}:void 0,onDragEnd:le?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(dv(e)))},onDrop:T===void 0?void 0:e=>{T.active&&e.dataTransfer.dropEffect!==`copy`&&(e.preventDefault(),e.stopPropagation(),T.drop(dv(e),e.dataTransfer.dropEffect))},children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.sessionMain,children:/* @__PURE__ */ (0,o.jsx)(Xg,{identityLabel:e.tree?.descendantCount?!w&&y===`ring`?m(`threadTree.expandSummary`,{title:te,summary:M_(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)(I_,{activity:e.tree.activity}),se&&h.remote&&oe!==void 0&&/* @__PURE__ */ (0,o.jsx)(fv,{color:oe,state:h.remote.state,className:q.remoteSessionGlobe})]}),ambient:!h.archived&&!h.blank&&!ae&&l(`sidebar.session.row.leading`,{sessionId:e.id}),title:te,onIdentityClick:e.tree?.descendantCount?t=>{t.stopPropagation(),_(e.id,!w,b)}:void 0,children:/* @__PURE__ */ (0,o.jsxs)(`span`,{className:q.trailing,children:[!h.blank&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:X(q.time,(ae||E)&&q.timeStatus),"data-session-status":ae?ie.state:void 0,"data-section-moving-indicator":E?`true`:void 0,children:ae?/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(Sh,{statuses:re}),ie.trailingLabel!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{"aria-hidden":`true`,children:ie.trailingLabel})]}):E?/* @__PURE__ */ (0,o.jsx)(a.StateDot,{state:`ongoing`,size:14,className:q.sectionMovingSpinner}):sv(h.updatedAt,r,m)}),!h.blank&&/* @__PURE__ */ (0,o.jsxs)(`span`,{className:q.rowActions,onClick:e=>{e.stopPropagation()},children:[/* @__PURE__ */ (0,o.jsx)(a.Menu,{open:k,onClose:()=>{ue(!1)},portal:!0,autoFocus:!0,phoneSidebarTitle:te,phoneSidebarFooterBackLabel:m(`session.backToList`),phoneSidebarDetails:/* @__PURE__ */ (0,o.jsx)(`div`,{className:q.phoneDetails,children:/* @__PURE__ */ (0,o.jsx)(mv,{node:e,now:r,renderSlot:l,t:m})}),getAnchorRect:de===null?void 0:()=>de,anchor:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:q.iconButton,"aria-label":m(`actions.session.aria`,{name:te}),"aria-haspopup":`menu`,"aria-expanded":k,onClick:()=>{A(null),ue(e=>!e)},children:/* @__PURE__ */ (0,o.jsx)(a.IconEllipsisOutlineRegular,{})}),children:l(`sidebar.workspaces.session.menu.item`,{sessionId:e.id,displayTitle:h.title,threadTreeChild:S>0,...C===void 0?{}:{markChildThreadsRead:C}},{hookContext:fe})}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:q.quickActions,children:l(`sidebar.workspaces.session.row.action`,{sessionId:e.id,displayTitle:h.title,threadTreeChild:S>0})})]})]})})}),!w&&y===`summary`&&/* @__PURE__ */ (0,o.jsx)(W_,{node:e,title:te,toggle:()=>_(e.id,!0,b),t:m})]});return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.HoverCard,{anchor:j,content:/* @__PURE__ */ (0,o.jsx)(mv,{node:e,now:r,renderSlot:l,t:m}),openDelayMs:800,disabled:k||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:q.visuallyHidden,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:E?m(`section.moving`):null})]})}let _v=`@deepseek-ai/dsh-client-ui-workspace/ActivityViewList.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=`.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 vv={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 yv({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 bv({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=E_(),{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:vv.toolbar,role:`region`,"aria-label":p(`activityView.label`),children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:vv.titleGroup,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:vv.title,children:p(`activityView.label`)}),_>0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:vv.unreadMeta,children:p(_===1?`activityView.unreadCount.one`:`activityView.unreadCount.other`,{n:_})})]}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:vv.markAllReadButton,disabled:_===0,onClick:()=>{u(g)},children:p(`activityView.markAllRead`)})]}),/* @__PURE__ */ (0,o.jsx)(Yg,{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:vv.emptyState,"data-row-key":`empty:activity`,children:[/* @__PURE__ */ (0,o.jsx)(yv,{size:22,className:vv.emptyIcon}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:vv.emptyTitle,children:p(`activityView.empty`)}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:vv.backButton,onClick:d,children:p(`activityView.backToAll`)})]}):/* @__PURE__ */ (0,o.jsx)(H_,{roots:h,children:e=>/* @__PURE__ */ (0,o.jsx)(gv,{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 xv(e){return/* @__PURE__ */ (0,o.jsx)(a.RemotePluginIcon,{id:e,...(0,a.harnessIconSources)(e),size:16,fallback:/* @__PURE__ */ (0,o.jsx)(a.IconDataOutlineRegular,{size:16})})}async function Sv(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 Cv({workspaceId:e,title:t,t:n,onClose:r}){let[i,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 Sv({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=i?.harnesses.map(({id:e,name:t})=>({id:e,label:t,icon:xv(e)}))??[],x=i?.selection.mode===`manual`?i.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:xv(e),disabled:!0})}let S=b.find(({id:e})=>e===f),C=u===`manual`?{mode:u,harnessId:f}:{mode:u},w=i===void 0||u===i.selection.mode&&(u!==`manual`||i.selection.mode===`manual`&&f===i.selection.harnessId),T=u===`manual`&&(!S||S.disabled),ee=()=>{g||r()},E=async()=>{if(!(g||w||T)){_(!0),y(void 0);try{await Sv({workspaceId:e,selection:C}),r()}catch{y(`saveFailed`),_(!1)}}};return/* @__PURE__ */ (0,o.jsxs)(a.Modal,{open:!0,onClose:ee,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)(a.Button,{variant:`outline`,disabled:g,onClick:ee,children:n(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,disabled:g||w||T,onClick:()=>void E(),children:n(`defaultHarness.save`)})]}),children:[i?/* @__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)(a.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)(a.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 wv=`@deepseek-ai/dsh-client-ui-workspace/SectionHeading.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(wv)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=wv,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 Tv={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 Ev({label:e,icon:t,expanded:n,onToggle:r,rowKey:i,trailing:s,action:c,projectDrop:l,dropTarget:u=!1,onDragOver:d,onDrop:f}){let p=d||f?void 0:l,m=n!==void 0&&r!==void 0&&i!==void 0,h=/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[t,/* @__PURE__ */ (0,o.jsx)(`span`,{className:Tv.title,children:e}),m&&/* @__PURE__ */ (0,o.jsx)(a.IconChevronDownOutlineRegular,{className:n?Tv.chevron:Tv.collapsed,size:12}),s!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Tv.trailing,onClick:e=>{e.stopPropagation()},children:s}),c!==void 0&&/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:c.label,portal:!0,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:X(Tv.action,s!==void 0&&Tv.actionAfterTrailing),"aria-label":c.label,onClick:e=>{e.stopPropagation(),c.onActivate()},children:c.icon})})]});return m?/* @__PURE__ */ (0,o.jsx)(`div`,{className:X(Tv.heading,u&&Tv.dropTarget),role:`treeitem`,tabIndex:-1,"data-row-key":i,"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:r,children:h}):/* @__PURE__ */ (0,o.jsx)(`div`,{className:X(Tv.heading,u&&Tv.dropTarget),"data-section-drop-target":u||void 0,onDragOver:d,onDrop:f,children:h})}let Dv=`@deepseek-ai/dsh-client-ui-workspace/PinnedSection.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Dv)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Dv,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 Ov={empty:`t4p6JG_empty`,emptyDropTarget:`t4p6JG_emptyDropTarget`,section:`t4p6JG_section`};function kv({rows:e,customSection:t,headingActions:n,sectionDrag:r,currentId:i,onOpen:s,onRenameRequest:c,renderSlot:l,useMovingSectionSessions:u,t:d,revealSessionId:f,onSessionRevealed:p,showHost:m=!0,expanded:h,onToggle:g,children:_,hasWorkspaces:v=!1}){if(e.length===0&&!v&&!t)return null;let y=t?.section,b=y?.name??d(`section.pinned`),x=y!==void 0&&G_(y),S=Array.isArray(_)?_.length>0:!!_,C=x&&y!==void 0&&r?.active===!0,w=C&&r.over?.kind===`section-end`&&r.over.sectionId===y.id,T=C&&y!==void 0?e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`,r.hoverSectionEnd(y.id)}:void 0,ee=C&&y!==void 0?e=>{e.dataTransfer.dropEffect!==`copy`&&(e.preventDefault(),e.stopPropagation(),r.dropSectionEnd(y.id,e.dataTransfer.dropEffect))}:void 0;return/* @__PURE__ */ (0,o.jsxs)(`div`,{role:`group`,"aria-label":b,className:Ov.section,"data-sidebar-pinned":!t||void 0,"data-sidebar-custom-section":y?.id,onDragOver:!t&&r?.active?()=>{r.clearHover()}:void 0,children:[/* @__PURE__ */ (0,o.jsx)(Ev,{label:b,icon:t?void 0:/* @__PURE__ */ (0,o.jsx)(a.IconPinOutlineRegular,{size:14}),trailing:n,expanded:h,onToggle:g,rowKey:`section:${t?.key??`pinned`}`,projectDrop:t?.projectDrop,dropTarget:w,onDragOver:T,onDrop:ee}),h&&e.length>0&&/* @__PURE__ */ (0,o.jsx)(H_,{roots:e,children:e=>{let t=x&&y!==void 0&&r!==void 0?{canDrag:r.canDragRow(e),start:()=>{r.startFromSection(e.id,y.id)},active:r.active&&!e.blank&&!e.archived&&e.id!==r.draggedSessionId,marker:r.over?.kind===`section-row`&&r.over.sectionId===y.id&&r.over.targetSessionId===e.id?r.over.half:null,hover:t=>{r.hoverSectionRow(y.id,e.id,t)},drop:(t,n)=>{r.dropSectionRow(y.id,e.id,t,n)},end:()=>{r.end()}}:void 0;return/* @__PURE__ */ (0,o.jsx)(gv,{node:e,showHost:m,currentId:i,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&&S&&_,h&&t!==void 0&&e.length===0&&!S&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:X(Ov.empty,w&&Ov.emptyDropTarget),"data-section-drop-empty":y?.id,onDragOver:T,onDrop:ee,children:d(`section.empty`)})]})}function Av({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 jv(e,t,n,r){let i=0,a=e.filter(e=>e.blank||e.pinned||e.running||e.runningSubagentCount>0||e.pendingInteraction!==void 0||e.tree?.activity.running||e.tree?.activity.pendingInteraction?!0:i++<t||e.id===n||e.id===r||e.tree?.descendantIds.some(e=>e===n||e===r)===!0);return{rows:a,hiddenCount:e.length-a.length,ordinaryCount:i}}function Mv(e,t,n){let r=e.filter((e,r)=>r<t||n.has(e.key));return{rows:r,hiddenCount:e.length-r.length}}function Nv({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 Pv({current:e,sections:t,dismiss:n,move:r,defaultLabel:i,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}=Q_(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),ee=()=>{!T.current&&!l&&n()},E=async()=>{if(!T.current&&x){T.current=!0,_(!0),C(!1);try{await r(y||null)!==!1&&n()}catch{C(!0)}finally{T.current=!1,_(!1)}}};return/* @__PURE__ */ (0,o.jsxs)(a.Modal,{phoneSidebar:!0,open:!0,title:p(`menu.moveToSection`),closeLabel:p(`close`),onClose:ee,footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:v,onClick:ee,children:p(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,disabled:!x,onClick:()=>void E(),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:i}),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 Fv=`@deepseek-ai/dsh-client-ui-workspace/HostScopeFilter.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Fv)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Fv,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 Iv(e,t){return e.key===`local`?t(`host.local`):e.displayName||e.hostId||e.key}function Lv(e,t){return t(e===`connected`?`host.connected`:e===`connecting`?`host.connecting`:`host.disconnected`)}function Rv({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=p_(e,i),d=Iv(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(h_(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(h_(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(__(t,e.key,l))},children:r(`hostScope.selectAll`)}),/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Q.miniLink,disabled:u===0,onClick:()=>{n(__(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=t_(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(g_(t,e.key,i.workspaceId,l))}}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.workspaceOptionName,children:u})]},i.workspaceId)})})]})]})}function zv(){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 Bv({workspaces:e,state:t,onChange:n,t:r}){let i=(0,s.useMemo)(()=>e_(e),[e]),a=(0,s.useMemo)(()=>r_(e),[e]),c=(0,s.useMemo)(()=>i_(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(m_(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=Iv(e,r),a=e.hostId===void 0?i:`${i} · ${Lv(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(m_(c,e.key))},children:[e.hostId!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.tabDot,"data-state":e.state??`disconnected`,"data-color":Xd(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)(Vv,{workspaces:e,state:t,onChange:n,t:r,variant:`icon`})})]}):null}function Vv({workspaces:e,state:t,onChange:n,t:r,variant:i=`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)(()=>e_(e),[e]),v=(0,s.useMemo)(()=>r_(e),[e]),y=(0,s.useMemo)(()=>i_(t,e),[t,e]),b=(0,s.useMemo)(()=>o_(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,a.useAnchoredPosition)({open:l,anchorRef:m,panelRef:h,side:`bottom`,align:`end`,gap:4,margin:12});if((0,a.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 r(`hostScope.allShort`);if(x!==void 0){let e=Iv(x,r),t=y.perHost[x.key];return t?.mode===`selected`?`${e} · ${p_(x,t)}`:e}return r(`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}}))},ee=()=>{u(!1),window.dispatchEvent(new CustomEvent(`codexhost:open-remote-peers-settings`))},E=e.length,te=v.some(e=>y.perHost[e.key]?.mode===`selected`);return/* @__PURE__ */ (0,o.jsxs)(`span`,{ref:p,className:Q.anchorRoot,children:[i===`icon`?/* @__PURE__ */ (0,o.jsxs)(`button`,{ref:m,type:`button`,className:X(Q.iconTrigger,te&&Q.iconTriggerActive,l&&Q.iconTriggerOpen),"aria-haspopup":`dialog`,"aria-expanded":l,"aria-controls":l?g:void 0,"aria-label":r(`hostScope.trigger.aria`,{current:C}),title:r(`hostScope.trigger.aria`,{current:C}),onClick:e=>{e.stopPropagation(),u(e=>!e)},children:[/* @__PURE__ */ (0,o.jsx)(zv,{}),te&&/* @__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":r(`hostScope.trigger.aria`,{current:C}),title:r(`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":Xd(x.hostId,x.color),"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.triggerLabel,children:C}),/* @__PURE__ */ (0,o.jsx)(a.IconChevronDownOutlineRegular,{size:12,className:Q.triggerChevron})]}),l&&(0,c.createPortal)(/* @__PURE__ */ (0,o.jsxs)(a.MenuSurface,{ref:h,id:g,role:`dialog`,"aria-label":r(`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:r(`hostScope.host.label`)}),b&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Q.resetLink,onClick:()=>{n(v_())},children:r(`hostScope.reset`)})]}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Q.hostList,role:`radiogroup`,"aria-label":r(`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(m_(y,`all`))},children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.hostName,children:r(`hostScope.allHosts`)}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.hostCount,children:E}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.checkSlot,children:y.selectedHost===`all`&&/* @__PURE__ */ (0,o.jsx)(a.IconCheckOutlineRegular,{size:14})})]}),v.map(e=>{let t=y.selectedHost===e.key,i=y.perHost[e.key],s=i?.mode===`selected`,c=p_(e,i),l=s?`${c}/${e.workspaceCount}`:String(e.workspaceCount),u=Iv(e,r),d=e.hostId===void 0?u:`${u} · ${Lv(e.state,r)}`;return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,className:X(Q.hostRow,t&&Q.hostRowSelected),title:d,onClick:()=>{n(m_(y,e.key))},children:[e.hostId!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.dot,"data-state":e.state??`disconnected`,"data-color":Xd(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)(a.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:r(`hostScope.scope.label`)})}),x===void 0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:Q.allHostsScopeList,children:v.map(e=>{let t=d===e.key,i=y.perHost[e.key],s=i?.mode===`selected`,c=s?`${p_(e,i)}/${e.workspaceCount}`:r(`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)(a.IconChevronDownOutlineRegular,{size:12,className:Q.accordionIcon}):/* @__PURE__ */ (0,o.jsx)(a.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":Xd(e.hostId,e.color),"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Q.hostName,children:Iv(e,r)}),/* @__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)(Rv,{host:e,state:y,onChange:n,t:r})})]},e.key)})}):/* @__PURE__ */ (0,o.jsx)(Rv,{host:x,state:y,onChange:n,t:r})]})]}),/* @__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)(a.IconPlusOutlineRegular,{size:14,className:Q.footerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:r(`hostScope.action.addRemoteWorkspace`)})]}),/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:Q.footerAction,onClick:ee,children:[/* @__PURE__ */ (0,o.jsx)(a.IconSettingsOutlineRegular,{size:14,className:Q.footerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:r(`hostScope.action.manageRemoteHosts`)})]})]})]}),document.body)]})}function Hv(){let[e,t]=(0,s.useState)(q_);return(0,s.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(K_);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 Uv({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&&J_({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||!ev({committed:f.current,cancelled:p.current,dropEffect:i}))return;f.current=!0,h(null),m.current();let s=tv(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=>ev({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 Wv(e,t){let n=r_(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=>!t_(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 Gv(e,t){return t===void 0?`local`:e.find(e=>e.workspaceId===t)?.remote?.hostId??`local`}function Kv(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 qv(e,t,n){let r=e.filter(e=>!t_(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 Jv(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 Yv(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 Xv(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 Zv=`@deepseek-ai/dsh-client-ui-workspace/HeroLocationWorkspacePicker.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Zv)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=Zv,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 Qv=`codexhost:remote-peers-updated`,$v=`codexhost:remote-workspace-created`,ey=`codexhost/remote-peers/list`,ty=`::no-project`;function ny({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 ry({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 iy(e,t){return e.key===`local`?t(`host.thisComputer`):e.displayName||e.hostId||e.key}function ay(e,t){if(e!==void 0&&e!==`connected`)return t(e===`connecting`?`host.connecting`:`host.disconnected`)}function oy({location:e,className:t}){return e.key===`local`?/* @__PURE__ */ (0,o.jsx)(ny,{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)(ry,{className:t})}async function sy(e){try{let t=typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`hero-peers-${Date.now()}`,n=await fetch(`api/${ey}`,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({type:`client-request`,rpcId:t,method:ey,payload:{args:{}}}),...e===void 0?{}:{signal:e}});return n.ok?Yv(await n.json()):null}catch{return null}}function cy({open:e,selectedId:t,fallbackLabel:n,onOpenChange:r,onPick:i,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,ee]=(0,s.useState)(!1),[E,te]=(0,s.useState)(``),[ne,re]=(0,s.useState)(``),[ie,ae]=(0,s.useState)(-1),[oe,se]=(0,s.useState)(-1),[ce,D]=(0,s.useState)(!1),[le,O]=(0,s.useState)(!1),[k,ue]=(0,s.useState)(!1),[de,A]=(0,s.useState)(null),fe=(0,a.usePhoneSidebar)(),pe=(0,s.useRef)(!1),j=(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),M=(0,s.useRef)(null),xe=(0,s.useRef)(null),Se=(0,s.useId)(),Ce=(0,s.useId)(),we=e||T,Te=ce||le,Ee=(0,s.useMemo)(()=>Gv(g,t),[g,t]),N=(0,s.useMemo)(()=>Wv(g,y),[g,y]),De=(0,s.useMemo)(()=>new Set(N.map(e=>e.key)),[N]),Oe=(0,s.useMemo)(()=>new Set(y.filter(e=>!e.enabled).map(e=>e.hostId)),[y]),P=h.phase===`ready`&&h.state===`idle`&&x,[ke,Ae]=(0,s.useState)(()=>Ee),je=(0,s.useCallback)((e,t=!1)=>{ee(e),r?.(e),e||(t||Ae(De.has(Ee)?Ee:`local`),l())},[De,l,r,Ee]);(0,s.useEffect)(()=>{e&&(w(!1),ee(!0))},[e]);let Me=(0,s.useCallback)(e=>{sy(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(Qv,t),()=>{e.abort(),window.removeEventListener(Qv,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`&&j.current!==null&&t.hostId===j.current&&(j.current=null,he({hostId:t.hostId,path:t.path,...typeof t.workspaceId==`string`?{workspaceId:t.workspaceId}:{}}))};return window.addEventListener($v,e),()=>{window.removeEventListener($v,e)}},[]);let Ne=(0,s.useRef)(t);(0,s.useEffect)(()=>{if(t!==Ne.current&&(Ne.current=t,t!==void 0)){let e=Gv(g,t);Ae(De.has(e)?e:`local`)}},[De,t,g]),(0,s.useEffect)(()=>{t!==void 0&&Ee!==`local`&&De.has(Ee)&&Ae(e=>e===`local`?Ee:e)},[De,t,Ee]);let Pe=(0,s.useRef)(void 0);(0,s.useEffect)(()=>{let e=e=>e!==`local`&&!De.has(e)&&(P||Oe.has(e));e(ke)&&Ae(`local`),j.current!==null&&e(j.current)&&(j.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),a=me!==null&&!e(me.hostId)&&me.workspaceId===t,o=P&&t!==void 0&&n===void 0&&!a&&(ke!==`local`||t.startsWith(`remote-peer:`));r||o?_&&Pe.current!==t&&(Pe.current=t,i(null)):Pe.current=void 0},[ke,De,_,Oe,P,i,me,t,g]);let Fe=(0,s.useMemo)(()=>N.find(e=>e.key===ke)??N[0]??{key:`local`,workspaces:[]},[ke,N]);(0,s.useEffect)(()=>{if(me===null)return;let e=Xv(g,me);e!==void 0&&(he(null),Ae(e.remote?.hostId??`local`),i(e.workspaceId))},[i,me,g]),(0,s.useEffect)(()=>{ce&&!v&&D(!1)},[ce,v]);let F=(0,a.useAnchoredPosition)({open:C,anchorRef:_e,panelRef:ye,side:`bottom`,align:`start`,gap:6,margin:12}),Ie=(0,a.useAnchoredPosition)({open:we,anchorRef:ve,panelRef:be,side:`bottom`,align:`start`,gap:6,margin:12});(0,a.useDismissOnOutsidePointer)(ge,C,w,ye),(0,a.useDismissOnOutsidePointer)(ge,we,(0,s.useCallback)(e=>{e||je(!1)},[je]),be),(0,s.useEffect)(()=>{if(!C)return;te(``),ae(-1);let e=requestAnimationFrame(()=>{M.current?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(e)},[C]),(0,s.useEffect)(()=>{if(!we)return;re(``),se(-1);let e=requestAnimationFrame(()=>{xe.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&&(je(!1),ve.current?.focus({preventScroll:!0})))};return document.addEventListener(`keydown`,e,!0),()=>{document.removeEventListener(`keydown`,e,!0)}},[C,we,je]);let I=(0,s.useCallback)(e=>kg(e.title,m(`workspace.defaultName`)),[m]),Le=(0,s.useMemo)(()=>Kv(N,E,m(`host.thisComputer`)),[N,E,m]),Re=(0,s.useMemo)(()=>qv(Fe.workspaces,ne,I),[Fe.workspaces,ne,I]),ze=Fe.key===`local`&&_&&ne.trim()===``,Be=(0,s.useMemo)(()=>[...ze?[{id:ty,workspace:void 0}]:[],...Re.map(e=>({id:e.workspaceId,workspace:e}))],[Re,ze]);(0,s.useEffect)(()=>{ae(e=>Le.length===0?-1:e>=Le.length?0:e)},[Le.length]),(0,s.useEffect)(()=>{se(e=>Be.length===0?-1:e>=Be.length?0:e)},[Be.length]);let Ve=N.length>1,He=iy(Fe,m),Ue=(0,s.useMemo)(()=>t===void 0?void 0:g.find(e=>e.workspaceId===t&&!t_(e)),[t,g]),L=Ue!==void 0&&(Ue.remote?.hostId??`local`)===Fe.key,We=L&&Ue!==void 0?I(Ue):t===void 0&&Fe.key===`local`&&n!==void 0?n:m(`heroPicker.project.choose`),Ge=!L&&(t!==void 0||Fe.key!==`local`||n===void 0),Ke=e=>{let t=e.key!==Fe.key;Ae(e.key),w(!1),t&&je(!0)},qe=e=>{j.current=null,je(!1,!0),i(e===ty?null:e)},Je=(0,s.useCallback)(()=>{j.current=null,pe.current=fe?.open===!0,je(!1,!0),ue(!1),A(null),D(!0)},[fe?.open,je]),Ye=()=>{Fe.key===`local`?v&&!Te&&Je():Fe.hostId?.startsWith(`remote-peer:`)&&Fe.state===`connected`&&(je(!1),j.current=Fe.hostId,window.dispatchEvent(new CustomEvent(`codexhost:open-add-remote-workspace`,{detail:{hostId:Fe.hostId}})))},Xe=Fe.key===`local`?v:Fe.hostId?.startsWith(`remote-peer:`)===!0&&Fe.state===`connected`,Ze=()=>{w(!1),window.dispatchEvent(new CustomEvent(`codexhost:open-remote-peers-settings`))},Qe=e=>d({path:e}).then(e=>{D(!1),Ae(`local`),i(e.workspaceId)}).catch(e=>{A(e instanceof Error?e.message:String(e)),D(!1),ue(!0)}),$e={open:ce,busy:le,onPicked:e=>{O(!0),Qe(e).finally(()=>{O(!1)})},onCancel:()=>{D(!1)},onError:e=>{D(!1),A(e),ue(!0)}},et=e=>{if(Le.length!==0){if(e.key===`ArrowDown`)e.preventDefault(),ae(e=>e<0?0:(e+1)%Le.length);else if(e.key===`ArrowUp`)e.preventDefault(),ae(e=>e<0?Le.length-1:(e-1+Le.length)%Le.length);else if(e.key===`Enter`){e.preventDefault();let t=Le[ie>=0?ie:0];t!==void 0&&Ke(t)}}},tt=e=>{if(Be.length!==0){if(e.key===`ArrowDown`)e.preventDefault(),se(e=>e<0?0:(e+1)%Be.length);else if(e.key===`ArrowUp`)e.preventDefault(),se(e=>e<0?Be.length-1:(e-1+Be.length)%Be.length);else if(e.key===`Enter`){e.preventDefault();let t=Be[oe>=0?oe:0];t!==void 0&&qe(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?Se:void 0,"aria-label":m(`heroPicker.location.aria`,{current:He}),disabled:Te,"data-hero-location-trigger":``,onClick:()=>{je(!1),w(e=>!e)},children:[/* @__PURE__ */ (0,o.jsx)(oy,{location:Fe,className:$.triggerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.triggerLabel,children:He})]}),/* @__PURE__ */ (0,o.jsxs)(`button`,{ref:ve,type:`button`,className:X($.trigger,$.triggerProject,Ge&&$.triggerPlaceholder,we&&$.triggerOpen),"aria-haspopup":`dialog`,"aria-expanded":we,"aria-controls":we?Ce:void 0,"aria-label":m(`heroPicker.project.aria`,{current:We}),disabled:Te,"data-hero-project-trigger":``,onClick:()=>{w(!1),je(!we)},children:[Ge?/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{size:15,className:$.triggerIcon}):/* @__PURE__ */ (0,o.jsx)(a.IconFolderOpenOutlineRegular,{size:15,className:$.triggerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.triggerLabel,children:We})]}),C&&(0,c.createPortal)(/* @__PURE__ */ (0,o.jsxs)(a.MenuSurface,{ref:ye,id:Se,role:`dialog`,"aria-label":m(`heroPicker.location.placeholder`),className:X($.popover,$.popoverLocation),style:F??{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)(a.IconSearchOutlineRegular,{size:15,className:$.searchIcon}),/* @__PURE__ */ (0,o.jsx)(`input`,{ref:M,type:`text`,className:$.searchInput,value:E,placeholder:m(`heroPicker.location.placeholder`),"aria-label":m(`heroPicker.location.placeholder`),spellCheck:!1,autoComplete:`off`,onChange:e=>{te(e.target.value),ae(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:()=>ae(-1),children:Le.length===0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.emptyState,children:m(`heroPicker.location.empty`)}):Le.map((e,t)=>{let n=e.key===Fe.key,r=iy(e,m),i=ay(e.state,m);return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n,className:X($.row,t===ie&&$.rowActive),onMouseEnter:()=>ae(t),onClick:()=>Ke(e),children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowIcon,children:/* @__PURE__ */ (0,o.jsx)(oy,{location:e})}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowMain,children:/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowTitle,children:r})}),i!==void 0&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowStatus,children:i}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.checkSlot,children:n&&/* @__PURE__ */ (0,o.jsx)(a.IconCheckOutlineRegular,{size:15})})]},e.key)})}),/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.footerDivider,role:`separator`}),/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,className:$.footerAction,onClick:Ze,children:[Ve?/* @__PURE__ */ (0,o.jsx)(a.IconSettingsOutlineRegular,{size:15,className:$.footerIcon}):/* @__PURE__ */ (0,o.jsx)(a.IconPlusOutlineRegular,{size:15,className:$.footerIcon}),/* @__PURE__ */ (0,o.jsx)(`span`,{children:m(Ve?`heroPicker.location.manageRemote`:`heroPicker.location.connectRemote`)})]})]}),document.body),we&&(0,c.createPortal)(/* @__PURE__ */ (0,o.jsxs)(a.MenuSurface,{ref:be,id:Ce,role:`dialog`,"aria-label":m(`heroPicker.project.placeholder`),className:X($.popover,$.popoverProject),style:Ie??{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)(a.IconSearchOutlineRegular,{size:15,className:$.searchIcon}),/* @__PURE__ */ (0,o.jsx)(`input`,{ref:xe,type:`text`,className:$.searchInput,value:ne,placeholder:m(`heroPicker.project.placeholder`),"aria-label":m(`heroPicker.project.placeholder`),spellCheck:!1,autoComplete:`off`,onChange:e=>{re(e.target.value),se(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:()=>se(-1),children:h.phase===`pending`&&Be.length===0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.emptyState,role:`status`,children:m(`picker.loading`)}):Be.length===0?/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.emptyState,children:ne.trim()===``?m(`heroPicker.project.empty`):m(`heroPicker.project.noMatches`)}):Be.map((e,n)=>{let r=e.workspace===void 0,i=r?t===void 0:e.id===t,s=r?m(`heroPicker.project.noProject`):I(e.workspace),c=r?void 0:Jv(e.workspace.path,s);return/* @__PURE__ */ (0,o.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":i,className:X($.row,n===oe&&$.rowActive),title:e.workspace?.path||s,onMouseEnter:()=>se(n),onClick:()=>qe(e.id),children:[/* @__PURE__ */ (0,o.jsx)(`span`,{className:$.rowIcon,children:/* @__PURE__ */ (0,o.jsx)(a.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:i&&/* @__PURE__ */ (0,o.jsx)(a.IconCheckOutlineRegular,{size:15})})]},e.id)})}),Xe&&/* @__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:Ye,children:[/* @__PURE__ */ (0,o.jsx)(a.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)(a.Modal,{phoneSidebar:!0,phoneSidebarOrigin:pe.current,open:k,onClose:nt,closeLabel:m(`close`),title:m(`folderError.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:$.modalAction,onClick:nt,children:m(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,className:$.modalAction,disabled:!v,onClick:Je,children:m(`folderError.retry`)})]}),children:/* @__PURE__ */ (0,o.jsx)(`div`,{className:$.modalError,role:`alert`,children:de})})]})}let ly=`@deepseek-ai/dsh-client-ui-workspace/WorkspacePicker.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(ly)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-workspace`,e.dataset.pluginCss=ly,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 uy={menuStatus:`s4nt4G_menuStatus`,modalAction:`s4nt4G_modalAction`,modalError:`s4nt4G_modalError`};let dy=`::add-workspace`,fy=`::no-workspace`;function py({t:e,open:t,anchorRef:n,useWorkspaces:r,createWorkspace:i,useDirectoryFlow:c,renderDirectoryFlow:l,onPick:u,onPickNone:d,onClose:f,addOnly:p=!1,onBusyChange:m,side:h=`bottom`,selectedId:g}){let _=r(e=>e),v=_.items.filter(e=>!t_(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),ee=(0,a.usePhoneSidebar)(),E=(0,s.useRef)(!1),[te,ne]=(0,s.useState)(!1),re=w||te;(0,s.useEffect)(()=>{m?.(re)},[re,m]);let ie=c(e=>e);(0,s.useEffect)(()=>{w&&!ie&&T(!1)},[w,ie]);let ae=ie?[{id:dy,label:e(`menu.addWorkspace`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconPlusOutlineRegular,{size:16}),disabled:re}]:[],oe=!p&&v.length>0,se=d!==void 0&&!p,ce=se?[{id:fy,label:e(`menu.noWorkspace`),disabled:re}]:[],D=oe?[...ce,...v.map(t=>({id:t.workspaceId,label:kg(t.title,e(`workspace.defaultName`)),icon:/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{size:16}),disabled:re}))]:[...ce,...ae],le=D.length===0,O=()=>{x(!1),C(null)},k=e=>i({path:e}).then(e=>{T(!1),u(e.workspaceId)}).catch(e=>{C(e instanceof Error?e.message:String(e)),T(!1),x(!0)}),ue=(0,s.useCallback)(()=>{E.current=ee?.open===!0,f(),x(!1),C(null),T(!0)},[f,ee?.open]),de=p||_.phase===`ready`,A=!se&&!oe&&de&&ae.length===1;(0,s.useEffect)(()=>{t&&A&&!re&&ue()},[t,A,re,ue]);let fe={open:w,busy:te,onPicked:e=>{ne(!0),k(e).finally(()=>{ne(!1)})},onCancel:()=>{T(!1)},onError:e=>{T(!1),C(e),x(!0)}},pe=e=>{e===fy?d?.():e===dy?ue():u(e)};return/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Menu,{open:t&&!A&&!le,anchor:null,items:D,...oe?{footer:ae}:{},selectedId:g??(se?fy:void 0),onSelect:pe,onClose:f,side:h,portal:!0,getAnchorRect:y}),t&&!A&&!le&&_.phase===`pending`&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:uy.menuStatus,role:`status`,children:e(`picker.loading`)}),l(fe),/* @__PURE__ */ (0,o.jsx)(a.Modal,{phoneSidebar:!0,phoneSidebarOrigin:E.current,open:b,onClose:O,closeLabel:e(`close`),title:e(`folderError.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:uy.modalAction,onClick:O,children:e(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,className:uy.modalAction,disabled:!ie,onClick:ue,children:e(`folderError.retry`)})]}),children:/* @__PURE__ */ (0,o.jsx)(`div`,{className:uy.modalError,role:`alert`,children:S})})]})}function my(e){return/* @__PURE__ */ (0,o.jsx)(cy,{...e})}function hy(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 gy(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 _y({groupBy:e,orderBy:t,archivedFilter:n,onGroupPick:r,onOrderPick:i,onArchivedFilterPick:c,t:l}){let[u,d]=(0,s.useState)(!1),f=(0,s.useRef)(null),p=(0,a.usePhoneSidebar)(),{collapseStyle:m,setCollapseStyle:h}=E_(),{busy:g,failed:_,save:v}=hg(h);return/* @__PURE__ */ (0,o.jsx)(a.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)(a.IconFolderCloseRegular,{})},{id:`workspace-tree`,label:l(`groupBy.workspaceTree`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconWorkspaceTreeOutlineRegular,{})},{id:`flat`,label:l(`groupBy.flat`),icon:/* @__PURE__ */ (0,o.jsx)(a.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)(a.IconChevronsUpDownOutlineRegular,{})},{id:`updated`,label:l(`orderBy.updated`),icon:/* @__PURE__ */ (0,o.jsx)(a.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)(a.IconArchiveOffOutlineRegular,{})},{id:`show-archived`,label:l(`viewOptions.showArchived`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconQueueOutlineRegular,{})},{id:`only-archived`,label:l(`viewOptions.onlyArchived`),icon:/* @__PURE__ */ (0,o.jsx)(a.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,a.focusWithoutRing)(f.current))}):(e===`workspace`||e===`workspace-tree`||e===`flat`?r(e):e===`manual`||e===`updated`?i(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)(a.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)(a.IconSlidersTwoOutlineRegular,{})})}),children:_&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:pg.error,role:`alert`,children:l(`threadTree.style.error`)})})}function vy(e,t,n,r){let i=t.find(e=>e.id===n.sessionId),a=t.find(e=>e.id===r.id);if(i===void 0||a===void 0||i.blank||i.pinned!==n.pinned||a.pinned!==n.pinned||i.id===a.id||!e.includes(i.id))return;let o=t.filter(e=>e.pinned===n.pinned),s=o.findIndex(e=>e.id===i.id);if(o.filter(e=>e.id!==i.id).findIndex(e=>e.id===a.id)+ +(r.half===`after`)===s)return;let c=e.filter(e=>e!==i.id),l=c.indexOf(a.id);if(l!==-1)return c.splice(l+ +(r.half===`after`),0,i.id),hm(c,t.find(e=>e.blank)?.id)}function yy(e){let t=e.currentTarget.getBoundingClientRect();return e.clientY<t.top+t.height/2?`before`:`after`}function by({rowState:e,onLeaveArchivedOnly:t,partial:n,t:r}){let i=e.archivedFilter===`only`;return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.emptyState,"data-row-key":`empty`,children:[i?/* @__PURE__ */ (0,o.jsx)(a.IconArchiveOutlineRegular,{size:24}):/* @__PURE__ */ (0,o.jsx)(a.IconQueueOutlineRegular,{size:24}),/* @__PURE__ */ (0,o.jsx)(`div`,{children:r(n?`sessions.notLoaded`:i?`empty.noneArchived`:`empty.none`)}),i&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.emptyAction,onClick:t,children:r(`empty.viewOthers`)})]})}function xy({list:e,useSessionStatus:t,startSession:n,open:r,workspaces:i,allWorkspaces:c=i,linkedRoots:l,ungroupedSessionIds:u,rowState:d,nativeSections:f,nativeThreadIds:p,useMovingSectionSessions:m,moveSessionToSection:h,finePointer:g,manageThreadSection:_,onLeaveArchivedOnly:v,workspaceReady:y,canStartProjectless:b,animationResetKey:x,scrollRef:S,onScroll:C,sessionLimits:w,setSessionLimits:T,allWorkspacesShown:ee,setAllWorkspacesShown:E,usePanelInfo:te,onRenameRequest:ne,onDefaultHarnessRequest:re,onDeleteRequest:ie,onSessionRenameRequest:ae,renderSlot:oe,insertWorkspaceBefore:se,moveWorkspaceToSection:ce,nestWorkspaces:D,groupExpansion:le,setGroupExpanded:O,sectionExpansion:k,setSectionExpanded:ue,setSessionOrder:de,pinnedWorkspaceIds:A,setWorkspacePinned:fe,home:pe,t:j,revealSessionId:me,onSessionRevealed:he,shortcuts:ge,loadMoreSessions:_e,hostScopeFiltered:ve=!1,singleRemoteHostScoped:ye=!1,onResetHostScope:be}){let M=E_(),xe=(0,a.usePhoneSidebar)(),Se=te(e=>e.activePanelId!==null),Ce=t(e=>e),we=Se?void 0:Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,Te=(0,s.useMemo)(()=>i.map(e=>{let t=l.get(e.workspaceId);return t===void 0||t.size===0?e:{...e,sessionIds:e.sessionIds.filter(e=>!t.has(e))}}),[l,i]),Ee=me===void 0||!y?void 0:um(Te,M.rootId(me)),[N,De]=(0,s.useState)(null),Oe=(0,s.useRef)(!1),[P,ke]=(0,s.useState)(null),Ae=(0,s.useRef)(!1),je=(0,s.useRef)(null),Me=(0,s.useRef)(null);(0,s.useLayoutEffect)(()=>{let e=Me.current;if(Me.current=null,e===null||document.activeElement!==document.body)return;let t=je.current?.querySelector(`[role="tree"]`);(t?.querySelector(`[data-row-key="${CSS.escape(`workspace:${e}`)}"]`)??t?.querySelector(`[data-row-key][tabindex="0"]`))?.focus()},[A]);let Ne=(0,s.useMemo)(()=>new Map(Dm(e,d,Ce).map(e=>[e.id,e])),[e,d,Ce]),Pe=(0,s.useMemo)(()=>wy(f,e,d,Ce,k,Ne),[f,e,d,Ce,k,Ne]),Fe=(0,s.useMemo)(()=>new Map(Pe.map(e=>[e.id,e.rows.filter(e=>!e.archived&&!e.pinned).map(e=>e.id)])),[Pe]),F=Uv({enabled:g&&h!==void 0&&f.length>0,nativeSections:f,visibleSectionRows:Fe,nativeThreadIds:p,pinnedSessionIds:d.pinnedSessionIds,archivedSessionIds:d.archivedSessionIds,moveSessionToSection:h,onCancelLocalDrag:()=>{Oe.current=!0,De(null)}}),Ie=N!==null||P!==null||F.active;gy(P!==null||N!==null);let I=we===void 0||!y?void 0:um(Te,M.rootId(we)),Le=(0,s.useMemo)(()=>new Set(A),[A]),{nativeSectionOf:Re,sectionOf:ze}=(0,s.useMemo)(()=>Tg(f,Le),[f,Le]),[Be,Ve]=(0,s.useState)(),[He,Ue]=(0,s.useState)(!1),L=(0,s.useMemo)(()=>new Set(ce&&f.length>0?c.filter(e=>e.projectId&&!e.remote&&!Le.has(e.workspaceId)).map(e=>e.workspaceId):[]),[c,ce,f.length,Le]);(0,s.useEffect)(()=>{Be&&!L.has(Be)&&Ve(void 0)},[Be,L]);let We=e=>{if(P&&ce&&L.has(P.workspaceId)&&(Re.get(P.workspaceId)??null)!==e)return{active:P.overSection===e,hover:()=>{P.overSection!==e&&ke({...P,over:null,overSection:e})},leave:()=>ke(t=>t?.overSection===e?{workspaceId:t.workspaceId,over:null}:t),drop:()=>{Ae.current||(Ae.current=!0,ke(null),Ue(!1),ce(P.workspaceId,e).catch(()=>Ue(!0)))}}},Ge=(0,s.useMemo)(()=>Eg(i,D,Re,Le),[D,Re,Le,i]),Ke=(0,s.useMemo)(()=>c===i?Ge:Eg(c,D,Re,Le),[c,D,Re,Ge,Le,i]),qe=(0,s.useMemo)(()=>{let e=new Set(Ge.values());return[...i.map(e=>e.workspaceId),``].filter(t=>le[t]??(t===``||e.has(t)))},[le,Ge,i]),Je=(0,s.useMemo)(()=>{let t=Om(e,i,d,Ce,{expandedGroups:qe,excludePinned:!0},Ne);return(b||e.hasMore&&t.length===0)&&!t.some(e=>e.key===``)&&t.push({key:``,workspaceId:void 0,cwd:void 0,createdAt:void 0,label:``,sessionCount:0,expanded:qe.includes(``),containsCurrent:!1,activity:{running:0,pendingInteraction:0,completed:0},sessions:[]}),t},[e,i,d,Ce,qe,b,Ne]),Ye=Date.now(),Xe=e=>jv(e.sessions,w[e.key]??5,we,me),Ze=(e,t)=>{if(Oe.current)return;Oe.current=!0,De(null);let n=Je.find(t=>t.key===e.accountKey);if(n===void 0||t.id===e.sessionId)return;let r=e.accountKey===``?u:i.find(t=>t.workspaceId===e.accountKey)?.sessionIds;if(r===void 0)return;let a=vy(r,Xe(n).rows,e,t);a!==void 0&&de(e.accountKey,a)},Qe=(e,t)=>{if(Ae.current)return;Ae.current=!0,ke(null);let n=wg(c,e.workspaceId,t,{sectionOf:ze,parents:Ke});n!==null&&se(e.workspaceId,n.beforeWorkspaceId).catch(e=>{console.warn(`workspace reorder rejected:`,e)})},$e=(0,s.useMemo)(()=>{let e=new Set(Je.map(e=>e.key)),t=/* @__PURE__ */ new Map;for(let n of Je){let r=Ge.get(n.key);for(;r!==void 0&&!e.has(r);)r=Ge.get(r);let i=t.get(r);i===void 0?t.set(r,[n]):i.push(n)}return t},[Je,Ge]),et=$e.get(void 0)??[],tt=(0,s.useMemo)(()=>{let e=/* @__PURE__ */ new Map,t=(n,r)=>{e.set(n.key,r);for(let e of $e.get(n.key)??[])t(e,r)};for(let e of et)t(e,e.key);return e},[$e,et]),nt=(0,s.useMemo)(()=>{let e=/* @__PURE__ */ new Set;for(let t of[I,Ee]){let n=t===void 0?void 0:tt.get(t);n!==void 0&&n!==``&&e.add(n)}return e},[I,Ee,tt]),{pinnedGroups:rt,sectionRoots:it,workspaceRoots:at}=(0,s.useMemo)(()=>Dg(et,f,A,ze),[f,A,et,ze]),ot=Mv(at,5,nt),st=ee?at:ot.rows,ct=Rm(k,Im),lt=Ee===void 0?void 0:tt.get(Ee),ut=lt!==void 0&&Le.has(lt);(0,s.useEffect)(()=>{if(ut){ct||ue(Im,!0);for(let e=Ee;e!==void 0;e=Ge.get(e))qe.includes(e)||O(e,!0)}},[qe,Ge,ct,Ee,ut,O,ue]);let dt=Rm(k,Lm),ft=e=>{e.expanded&&T(t=>({...t,[e.key]:5})),O(e.key,!e.expanded)},pt=(0,s.useMemo)(()=>new Set(d.archivedSessionIds),[d.archivedSessionIds]),mt=(0,s.useMemo)(()=>new Map(c.map(e=>[e.workspaceId,e])),[c]),ht=(0,s.useMemo)(()=>jm(e,d.pinnedSessionIds,d,Ce,Ne).filter(e=>e.pinned),[e,d,Ce,Ne]),gt=ht.length>0||rt.length>0,_t=[];if(gt&&(_t.push(`section:${Im}`),ct))for(let e of M.rows(ht))_t.push(`session:${e.id}`);let vt=e=>{let t={...e.activity};for(let n of $e.get(e.key)??[]){let e=vt(n);t.running+=e.running,t.pendingInteraction+=e.pendingInteraction,t.completed+=e.completed}return t},yt=(t,i)=>{let s=t.workspaceId,u=s!==void 0&&!t.remote,f=Le.has(t.key),p=$e.get(t.key)??[],h=ze.has(t.key),g=P!==null&&Cg(c,P.workspaceId,s,{sectionOf:ze,parents:Ke}),_=Xe(t);_t.push(`workspace:${t.key}`);let v=t.expanded?p.map(e=>yt(e,i+1)):[],x=t.expanded?void 0:vt(t),S=M.rows(_.rows),C=l.get(t.key),w=new Set(C===void 0?[]:_.rows.flatMap(e=>C.has(e.id)?[e.id,...e.tree?.descendantIds??[]]:[])),ee=e=>s===void 0?`recent:${e}`:w.has(e)?`linked:${t.key}:${e}`:`session:${e}`;for(let e of S)_t.push(ee(e.id));let E=e=>d.archivedFilter===`show`?!0:d.archivedFilter===`only`?pt.has(e):!pt.has(e),te=t.remote&&s!==void 0&&(mt.get(s)?.sessionIds.some(t=>e.byId[t]===void 0&&E(t))??!1),se=u||te,ce=se?e.workspaceHistory?.[s]??(e.canSearchWorkspaceHistory?`search`:`done`):void 0,D=ce===void 0?!t.remote&&e.hasMore:ce!==`done`,le=t.expanded&&(_.hiddenCount>0||D);le&&_t.push(`overflow:${t.key}`);let k=s!==void 0&&P?.over?.id===s?P?.over?.half??null:null,de=s!==void 0&&L.has(s),A=s===void 0||h&&!de?void 0:{start:()=>{Ae.current=!1,ke({workspaceId:s,over:null})},end:()=>{P?.over!==null&&P?.over!==void 0?Qe(P,P.over):ke(null),Ae.current=!1}},ve=s===void 0||!g?void 0:e=>{ke(t=>t===null?t:{workspaceId:t.workspaceId,over:{id:s,half:e}})},be=s===void 0||!g?void 0:e=>{Qe(P,{id:s,half:e})};return/* @__PURE__ */ (0,o.jsxs)(`div`,{"data-sidebar-group":t.key,style:{"--dsh-workspace-indent":`${i*12}px`},className:X(Z.groupSection,k===`before`&&Z.workspaceDropBefore,k===`after`&&Z.workspaceDropAfter),onDragOver:P===null?void 0:e=>{e.preventDefault(),(ve!==void 0||Ge.get(t.key)===void 0)&&(e.stopPropagation(),ve===void 0?(e.dataTransfer.dropEffect=`none`,P.over!==null&&ke({...P,over:null})):(e.dataTransfer.dropEffect=`move`,ve(yy(e))))},onDrop:P===null?void 0:e=>{e.preventDefault(),(be!==void 0||Ge.get(t.key)===void 0)&&(e.stopPropagation(),be===void 0?(Ae.current=!0,ke(null)):be(yy(e)))},children:[s===void 0?/* @__PURE__ */ (0,o.jsx)(Ev,{label:j(`group.ungrouped`),expanded:t.expanded,onToggle:()=>{ft(t)},rowKey:`workspace:${t.key}`,action:b?{label:j(`actions.newSession`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconNewChatOutlineRegular,{size:16}),onActivate:()=>{O(t.key,!0),xe?.close(),n()}}:void 0}):/* @__PURE__ */ (0,o.jsx)(pv,{newShortcut:ge.find(e=>e.id===`session.new`),group:t,foldedActivity:x,showHost:!ye,home:pe,t:j,onToggle:()=>{ft(t)},onCreate:()=>{t.workspaceId!==void 0&&(O(t.key,t.expanded),xe?.close(),n(t.workspaceId))},drag:A,pin:fe?{pinned:f,toggle:()=>{Me.current=s,f||ue(Im,!0),fe(s,!f).catch(e=>{console.warn(`workspace pin rejected:`,e)})}}:void 0,actions:u?{...de?{moveToSection:()=>Ve(s)}:{},rename:()=>ne(s,t.label),defaultHarness:e=>re(s,t.label,e),delete:()=>ie(s,t.label)}:void 0}),v.length>0&&/* @__PURE__ */ (0,o.jsx)(`div`,{role:`group`,children:v}),(S.length>0||le)&&/* @__PURE__ */ (0,o.jsxs)(`div`,{role:`group`,className:Z.groupSessions,style:{"--dsh-workspace-indent":`${s===void 0?0:i*12+22}px`},onDragOver:N!==null&&N.accountKey===t.key?e=>{let t=$_(e,N.pinned);t!==null&&(F.clearHover(),(N.over?.id!==t.id||N.over.half!==t.half)&&De({...N,over:t}),e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`)}:void 0,onDrop:N!==null&&N.accountKey===t.key?e=>{if(e.dataTransfer.dropEffect===`copy`)return;let t=$_(e,N.pinned);t!==null&&(e.preventDefault(),e.stopPropagation(),F.end(),Ze(N,t))}:void 0,children:[/* @__PURE__ */ (0,o.jsx)(H_,{roots:_.rows,children:e=>{let n=N!==null&&N.accountKey===t.key,i=n&&N.pinned===e.pinned,a=t=>e.blank?`after`:t,c=s!==void 0&&!t.remote&&(e.tree?.depth??0)===0,l=F.canDragRow(e,!!t.remote),u=c?{start:()=>{Oe.current=!1,De({accountKey:t.key,sessionId:e.id,pinned:e.pinned,over:null}),l?F.startFromUnsectioned(e.id):F.end()},active:i,marker:!F.hasSectionTarget&&n&&N.over?.id===e.id?N.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(),De(n=>n===null?n:{...n,over:{id:e.id,half:a(t)}})},drop:t=>{F.end(),N!==null&&Ze(N,{id:e.id,half:a(t)})},end:e=>{let t=F.canFinishLocalDrop(e);F.end(),t&&N?.over?Ze(N,N.over):De(null),Oe.current=!1}}:l?{canDrag:!0,start:()=>{F.startFromUnsectioned(e.id)},active:!1,marker:null,hover:()=>{},drop:()=>{},end:()=>{F.end()}}:void 0;return/* @__PURE__ */ (0,o.jsx)(mv,{rowKey:ee(e.id),showHost:!t.remote&&!(s===void 0&&ye),node:e,currentId:we,now:Ye,onOpen:r,onRenameRequest:ae,renderSlot:oe,onReveal:e.id===me&&t.key===Ee?()=>{he(e.id)}:void 0,drag:u,useMovingSectionSessions:m,t:j},e.id)}}),le&&/* @__PURE__ */ (0,o.jsx)(jv,{rowKey:`overflow:${t.key}`,hiddenCount:_.hiddenCount,hasMore:D,loading:ce===void 0?!t.remote&&e.loading:ce===`loading`,workspaceHistory:ce,workspaceId:se?s:void 0,fillWorkspace:u&&y&&e.phase===`ready`&&e.workspaceHistory?.[s]===void 0&&_.ordinaryCount<5,expand:()=>{T(e=>({...e,[t.key]:(e[t.key]??5)+10}))},loadMoreSessions:_e,t:j})]})]},t.key)},bt=ct?rt.map(e=>yt(e,0)):void 0,xt=/* @__PURE__ */ new Map;for(let e of Pe)_t.push(...Cy([e],M.rows)),e.expanded&&xt.set(e.key,(it.get(e.id)??[]).map(e=>yt(e,0)));!ve&&Je.length===0&&!gt&&f.length===0&&_t.push(`empty`);let St=We(null),Ct=ve&&at.length===0&&rt.length===0,wt=at.length>0||Ct||!!St,Tt=!(wt||gt||Pe.length>0)&&st[0]?.workspaceId!==void 0&&P?.over?.id===st[0].workspaceId&&P?.over?.half===`before`,Et=[];if(wt&&_t.push(`section:${Fm}`),dt){Ct&&(_t.push(`empty:host-scope`),Et.push(/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.filterEmptyHint,"data-row-key":`empty:host-scope`,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{children:j(`hostScope.emptyWorkspaces`)}),be!==void 0&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.emptyAction,onClick:be,children:j(`hostScope.showAll`)})]},`empty:host-scope`)));for(let e of st)Et.push(yt(e,0));!ee&&ot.hiddenCount>0&&(_t.push(`overflow:workspaces`),Et.push(/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.sessionOverflowButton,"data-row-key":`overflow:workspaces`,onClick:()=>E(!0),children:j(`workspaces.expand`)},`overflow:workspaces`)))}let Dt=et.find(e=>e.key===``);return Dt!==void 0&&Et.push(yt(Dt,0)),/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:je,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:[Tt&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.listTopDropIndicator,"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsxs)(qg,{className:X(Z.list,Tt&&Z.listTopDropActive),label:j(`section.sessions`),rowKeys:_t,scrollRef:S,onScroll:C,ready:e.phase===`ready`&&y&&!Ie,resetKey:JSON.stringify([x,w,ee,ct,dt]),children:[/* @__PURE__ */ (0,o.jsx)(Dv,{rows:ht,hasWorkspaces:rt.length>0,sectionDrag:F.interaction,currentId:we,showHost:!ye,onOpen:r,onRenameRequest:ae,renderSlot:oe,useMovingSectionSessions:m,revealSessionId:me,onSessionRevealed:he,expanded:ct,onToggle:()=>{ue(Pm,!ct)},t:j,children:bt}),/* @__PURE__ */ (0,o.jsx)(wy,{sections:Pe,groupRows:xt,projectSectionDrop:We,manageThreadSection:_,sectionDrag:F.interaction,currentId:we,showHost:!ye,onOpen:r,onRenameRequest:ae,renderSlot:oe,useMovingSectionSessions:m,revealSessionId:me,onSessionRevealed:he,setSectionExpanded:ue,t:j}),!ve&&Je.length===0&&!gt&&f.length===0&&/* @__PURE__ */ (0,o.jsx)(vy,{rowState:d,onLeaveArchivedOnly:v,partial:e.hasMore,t:j}),(wt||Et.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:[wt&&/* @__PURE__ */ (0,o.jsx)(wv,{label:j(`section.workspaces`),projectDrop:St,expanded:dt,onToggle:()=>{dt&&E(!1),ue(`workspaces`,!dt)},rowKey:`section:workspaces`}),Et,!wt&&Et.length===0&&F.canDropToUnsectioned&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.unsectionedDropHint,children:j(`section.unsectioned`)})]})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.fade}),Be&&L.has(Be)&&ce&&/* @__PURE__ */ (0,o.jsx)(Mv,{current:Re.get(Be)??``,sections:f,move:e=>ce(Be,e),dismiss:()=>Ve(void 0),defaultLabel:j(`section.workspaces`),failedLabel:j(`section.projectMoveFailed`),t:j},Be),He&&/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:j(`section.projectMoveFailed`),onDone:()=>Ue(!1)})]})}let by=[],xy=[];function Sy(e,t,n,r,i,a){if(!e.length)return[];let o=a??new Map(Tm(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:Im(i,r)}})}function Cy(e,t){return e.flatMap(({key:e,rows:n,expanded:r})=>[`section:${e}`,...r?t(n).map(e=>`session:${e.id}`):[]])}function wy({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)(Dv,{...a,rows:c,customSection:{key:e,section:s,projectDrop:n?.(s.id)},headingActions:r&&U_(s)&&/* @__PURE__ */ (0,o.jsx)(kg,{section:s,request:r,t:a.t}),expanded:l,onToggle:()=>i(e,!l),children:t?.get(e)},e))}function Ty({list:e,sessionIds:t,rowState:n,nativeSections:r,nativeThreadIds:i,useMovingSectionSessions:a,moveSessionToSection:c,finePointer:l,manageThreadSection:u,onLeaveArchivedOnly:d,useSessionStatus:f,open:p,onSessionRenameRequest:m,usePanelInfo:h,setSessionOrder:g,sectionExpansion:_,setSectionExpanded:v,workspaceReady:y,animationResetKey:b,scrollRef:x,onScroll:S,limit:C,setLimit:w,revealSessionId:T,onSessionRevealed:ee,renderSlot:E,loadMoreSessions:te,hostScopeFiltered:ne=!1,singleRemoteHostScoped:re=!1,onResetHostScope:ie,t:ae}){let oe=h(e=>e.activePanelId!==null),se=f(e=>e),ce=w_(),D=(0,s.useMemo)(()=>new Map(Tm(e,n,se).map(e=>[e.id,e])),[e,n,se]),le=(0,s.useMemo)(()=>km(e,t,n,se,D).filter(e=>!e.pinned&&!n.sectionedSessionIds?.has(e.id)),[e,t,n,se,D]),O=(0,s.useMemo)(()=>km(e,n.pinnedSessionIds,n,se,D).filter(e=>e.pinned),[e,n,se,D]),[k,ue]=(0,s.useState)(null),de=(0,s.useRef)(!1),A=Im(_,Pm),fe=(0,s.useMemo)(()=>Sy(r,e,n,se,_,D),[r,e,n,se,_,D]),pe=(0,s.useMemo)(()=>new Map(fe.map(e=>[e.id,e.rows.filter(e=>!e.archived&&!e.pinned).map(e=>e.id)])),[fe]),j=Vv({enabled:l&&c!==void 0&&r.length>0,nativeSections:r,visibleSectionRows:pe,nativeThreadIds:i,pinnedSessionIds:n.pinnedSessionIds,archivedSessionIds:n.archivedSessionIds,moveSessionToSection:c,onCancelLocalDrag:()=>{de.current=!0,ue(null)}});my(k!==null);let me=oe?void 0:Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,he=kv(le,C,me,T),ge=kv(le,10,me,T).hiddenCount>0,_e=(e,n)=>{if(de.current)return;de.current=!0,ue(null);let r=gy(t,le,e,n);r!==void 0&&g(Nm,r)},ve=Date.now();return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(Z.treeBody,Z.wide),onDragOver:j.active?j.clearHover:void 0,onDragLeave:j.active?e=>{(!(e.relatedTarget instanceof Node)||!e.currentTarget.contains(e.relatedTarget))&&j.clearHover()}:void 0,children:[/* @__PURE__ */ (0,o.jsxs)(qg,{className:X(Z.list,Z.flatList),label:ae(`section.sessions`),scrollRef:x,onScroll:S,rowKeys:[...O.length===0?[]:[`section:${Pm}`],...A?ce.rows(O).map(e=>`session:${e.id}`):[],...Cy(fe,ce.rows),...le.length===0&&O.length===0&&r.length===0?[ne?`empty:host-scope`:`empty`]:[],...ce.rows(he.rows).map(e=>`session:${e.id}`),...ge||e.hasMore?[`overflow:flat`]:[]],ready:e.phase===`ready`&&y&&k===null&&!j.active,resetKey:`${b}/${C}/${String(A)}`,children:[/* @__PURE__ */ (0,o.jsx)(Dv,{rows:O,sectionDrag:j.interaction,currentId:me,showHost:!re,onOpen:p,onRenameRequest:m,renderSlot:E,useMovingSectionSessions:a,revealSessionId:T,onSessionRevealed:ee,expanded:A,onToggle:()=>{v(Pm,!A)},t:ae}),/* @__PURE__ */ (0,o.jsx)(wy,{sections:fe,manageThreadSection:u,sectionDrag:j.interaction,currentId:me,showHost:!re,onOpen:p,onRenameRequest:m,renderSlot:E,useMovingSectionSessions:a,revealSessionId:T,onSessionRevealed:ee,setSectionExpanded:v,t:ae}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(Z.unsectionedZone,Z.flatUnsectioned,j.isUnsectionedTarget&&Z.unsectionedDropTarget),"data-section-drop-unsectioned":``,onDragOver:j.canDropToUnsectioned?e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`,j.hoverUnsectioned()}:void 0,onDrop:j.canDropToUnsectioned?e=>{e.dataTransfer.dropEffect!==`copy`&&(e.preventDefault(),e.stopPropagation(),j.dropUnsectioned(e.dataTransfer.dropEffect))}:void 0,children:[(O.length>0||r.length>0)&&/* @__PURE__ */ (0,o.jsx)(wv,{label:ae(`section.sessions`)}),le.length===0&&O.length===0&&r.length===0&&(ne?/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.filterEmptyHint,"data-row-key":`empty:host-scope`,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{children:ae(`hostScope.emptySessions`)}),ie!==void 0&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.emptyAction,onClick:ie,children:ae(`hostScope.showAll`)})]}):/* @__PURE__ */ (0,o.jsx)(vy,{rowState:n,onLeaveArchivedOnly:d,partial:e.hasMore,t:ae})),/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.flatRows,onDragOver:!j.canDropToUnsectioned&&k!==null?e=>{let t=Z_(e,k.pinned);t!==null&&(j.clearHover(),(k.over?.id!==t.id||k.over.half!==t.half)&&ue({...k,over:t}),e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`)}:void 0,onDrop:!j.canDropToUnsectioned&&k!==null?e=>{if(e.dataTransfer.dropEffect===`copy`)return;let t=Z_(e,k.pinned);t!==null&&(e.preventDefault(),e.stopPropagation(),j.end(),_e(k,t))}:void 0,children:/* @__PURE__ */ (0,o.jsx)(B_,{roots:he.rows,children:e=>{let t=k!==null&&k.pinned===e.pinned,n=t=>e.blank?`after`:t,r=j.canDragRow(e);return/* @__PURE__ */ (0,o.jsx)(mv,{node:e,showHost:!re,currentId:me,now:ve,onOpen:p,onRenameRequest:m,renderSlot:E,onReveal:e.id===T?()=>{ee(e.id)}:void 0,drag:{start:()=>{de.current=!1,ue({accountKey:Nm,sessionId:e.id,pinned:e.pinned,over:null}),r?j.startFromUnsectioned(e.id):j.end()},active:t,marker:!j.hasSectionTarget&&t&&k.over?.id===e.id?k.over.half:null,hover:t=>{j.clearHover(),ue(r=>r===null?r:{...r,over:{id:e.id,half:n(t)}})},drop:t=>{j.end(),k!==null&&_e(k,{id:e.id,half:n(t)})},end:e=>{let t=j.canFinishLocalDrop(e);j.end(),t&&k?.over?_e(k,k.over):ue(null),de.current=!1}},useMovingSectionSessions:a,t:ae},e.id)}})}),/* @__PURE__ */ (0,o.jsx)(jv,{rowKey:`overflow:flat`,hiddenCount:he.hiddenCount,hasMore:e.hasMore,loading:e.loading,expanded:C>10,expand:()=>w(C+10),collapse:ge?()=>w(10):void 0,loadMoreSessions:te,t:ae})]})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.fade})]})}function Ey({useSessions:e,useSessionStatus:t,open:n,onUnarchive:r,workspaces:i,archivedSessionIds:a,archivedFilter:c,query:l,remote:u,resultLimit:d,usePanelInfo:f,scrollRef:p,onScroll:m,t:h}){let g=f(e=>e.activePanelId!==null),_=e(e=>e),v=t(e=>e),y=u.query===l?u:{query:l,status:`loading`,items:[],hasMore:!1},b=(0,s.useMemo)(()=>Am(_,i,l,a,c,v,y,d),[_,i,l,a,c,v,y,d]),x=y.status===`loading`,S=g?void 0:Object.values(_.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id;return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(Z.treeBody,Z.wide),children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.list,ref:p,onScroll:m,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.searchTree,role:`tree`,"aria-label":h(`search.results.aria`),children:b.items.map(e=>/* @__PURE__ */ (0,o.jsx)(pv,{result:e,currentId:S,onOpen:n,onUnarchive:r,t:h},e.id))}),x&&/* @__PURE__ */ (0,o.jsx)(`div`,{role:`status`,"aria-label":h(`search.pending`),children:(b.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))}),!x&&b.items.length===0&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.empty,children:h(`search.noMatches`)}),b.hasMore&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.searchStatus,children:h(`search.hasMore`,{n:d})})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.fade})]})}function Dy(e){return/* @__PURE__ */ (0,o.jsx)(T_,{browser:e,children:/* @__PURE__ */ (0,o.jsx)(Oy,{...e})})}function Oy({wide:e,usePanelInfo:t,expandSidebar:n,useSessions:r,useSessionStatus:i,useWorkspaces:c,useStore:l,actions:u,startSession:d,open:f,markCompletionsRead:p,requestSessionRename:m,notifyArchivedNotOpenable:h,renameWorkspace:g,deleteWorkspace:_,insertWorkspaceBefore:v,moveWorkspaceToSection:y,setWorkspacePinned:b,unarchiveSession:x,createWorkspace:S,requestManageThreadSection:C,moveSessionToSection:w,setScopedSessionIds:T,searchSessions:ee,searchResultLimit:E,useDirectoryFlow:te,useHostInfo:ne,useShortcuts:re,useWorkspaceShortcuts:ie,useNativeThreads:ae,useMovingSectionSessions:oe,requestSearch:se,requestAddWorkspace:ce,closeAddWorkspace:D,setDirectoryBusy:le,dismissForkError:O,refreshSessions:k,loadMoreSessions:ue,renderSlot:de,t:A}){let fe=ne(e=>e.home),pe=re(e=>e),j=pe.find(e=>e.id===`session.search`),me=pe.find(e=>e.id===`session.activityView`),he=pe.find(e=>e.id===`workspace.add`),ge=ie(e=>e),_e=t(e=>e.activePanelId!==null),ve=i(e=>e),ye=ae(e=>e),be=Bv(),M=r(e=>e),xe=c(e=>e.items),Se=c(e=>e.canStartProjectless===!0),Ce=A(`workspace.defaultName`),we=A(`group.remoteOtherSessions`),Te=(0,s.useMemo)(()=>xe.map(e=>({...e,title:$g(e)?we:Dg(e.title,Ce)})),[xe,Ce,we]),Ee=c(e=>e.phase),N=c(e=>e.state),De=c(e=>e.archivedSessionIds),Oe=c(e=>e.pinnedSessionIds),P=c(e=>e.pinnedWorkspaceIds??xy),ke=c(e=>e.threadSections??by),Ae=c(e=>e.state===`idle`&&e.threadSectionsV1===!0),je=Ae?C:void 0,Me=te(e=>e),Ne=l(e=>e.groupBy),Pe=l(e=>e.orderBy),Fe=l(e=>e.archivedFilter??`default`),F=l(e=>e.groupExpansion),Ie=w_(),I=l(e=>e.sectionExpansion),Le=l(e=>e.sessionOrderByAccount),Re=e=>{De.includes(e)?h():(Ie.selectSidebarRow(e),f(e))},ze=()=>{u.setArchivedFilter(`default`)},Be=Ee===`ready`&&N!==`loading`,Ve=Object.values(M.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,He=Ve!==void 0&&M.byId[Ve]?.blank===!0?Ve:void 0,Ue=(0,s.useMemo)(()=>{let e=new Set(Te.flatMap(e=>e.sessionIds));return[.../* @__PURE__ */ new Set([...M.ids,...De])].filter(t=>!e.has(t))},[De,M.ids,Te]),L=(0,s.useMemo)(()=>({pinnedSessionIds:Oe,archivedSessionIds:De}),[De,Oe]),We=Fe===`only`?by:ke,Ge=(0,s.useMemo)(()=>({...L,archivedFilter:Fe,sectionedSessionIds:new Set(We.flatMap(e=>e.threadIds))}),[L,Fe,We]),Ke=(0,s.useMemo)(()=>Dm(M,De),[De,M]),qe=(0,s.useMemo)(()=>zm(M,Ge,Ie.forest),[M,Ge,Ie.forest]),Je=(0,s.useMemo)(()=>Te.map(e=>{let{memberIds:t,linkedRootIds:n}=Bm(e.sessionIds,qe),r=Pe===`updated`?dm(t,qe.summaries):fm(t,Le[e.workspaceId],qe.summaries,L);return{workspace:{...e,sessionIds:pm(r,He!==void 0&&t.includes(He)?He:void 0)},linkedRootIds:n}}),[He,qe,Pe,L,Le,Te]),Ye=(0,s.useMemo)(()=>Je.map(({workspace:e})=>e),[Je]),Xe=(0,s.useMemo)(()=>new Map(Je.map(({workspace:e,linkedRootIds:t})=>[e.workspaceId,t])),[Je]),Ze=(0,s.useMemo)(()=>dm(Ue.filter(e=>qe.rootIds.has(e)),qe.summaries),[qe,Ue]),Qe=(0,s.useMemo)(()=>{let e=Ke.filter(e=>qe.rootIds.has(e));return pm(Pe===`updated`?dm(e,qe.summaries):fm(e,Le[Nm],qe.summaries,L),He!==void 0&&Ke.includes(He)?He:void 0)},[He,Ke,qe,Pe,L,Le]),$e=(0,s.useMemo)(()=>Vm(Te,M,Ge,qe),[M,Ge,qe,Te]),et=(0,s.useMemo)(()=>Object.fromEntries([...Ye.map(e=>[e.workspaceId,e.sessionIds]),[``,Ze],[Nm,Qe]]),[Qe,Ze,Ye]);(0,s.useEffect)(()=>{Ee===`ready`&&u.retainAccountKeys([``,Nm,...Te.map(e=>e.workspaceId)])},[u.retainAccountKeys,Ee,Te]),(0,s.useEffect)(()=>{if(M.phase!==`ready`||Be||Pe!==`manual`||He===void 0)return;let e={};for(let[t,n]of Object.entries(et)){if(t!==`__flat_session_order__`&&Ee!==`ready`)continue;let r=Le[t]??[];n[0]===He&&r[0]!==He&&(e[t]=[He,...r.filter(e=>e!==He)])}Object.keys(e).length>0&&u.syncSessionOrders(e,$e)},[u.syncSessionOrders,et,He,M.phase,Pe,Le,$e,Ee,Be]),(0,s.useEffect)(()=>{M.phase===`ready`&&Be&&Pe===`manual`&&He!==void 0&&Object.entries(et).some(([e,t])=>t[0]===He&&Le[e]?.[0]!==He)&&u.syncSessionOrders(et,$e)},[u.syncSessionOrders,et,He,M.phase,Pe,Le,$e,Be]);let tt=(e,t)=>{u.setSessionOrder(e,t,et,$e)},[nt,rt]=(0,s.useState)(``),[it,at]=(0,s.useState)(!1),[ot,st]=(0,s.useState)(!1),[ct,lt]=(0,s.useState)(void 0),[ut,dt]=(0,s.useState)({}),[ft,pt]=(0,s.useState)(!1),[mt,ht]=(0,s.useState)(10),gt=py(nt).trim(),[_t,vt]=(0,s.useState)({query:``,status:`idle`,items:[],hasMore:!1}),yt=(0,s.useRef)(null),bt=(0,s.useRef)(null),xt=ge.addRequested,St=(0,s.useRef)(null),[Ct,wt]=(0,s.useState)(!1),[Tt,Et]=(0,s.useState)(()=>b_()),Dt=(0,s.useRef)(null);if(Dt.current===null){let e=/* @__PURE__ */ new Set;for(let t of Object.keys(Tt.perHost))t!==`local`&&t!==Tt.selectedHost&&e.add(t);Dt.current=e}let Ot=(0,s.useCallback)(e=>{Et(e),x_(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`);Dt.current?.add(t.hostId),Et(e=>{let r=h_(e,t.hostId,n);return x_(r),r})};return window.addEventListener(Zg,e),()=>{window.removeEventListener(Zg,e)}},[]),(0,s.useEffect)(()=>{if(Ee!==`ready`||N!==`idle`)return;let e=window.setTimeout(()=>{let e=Dt.current;if(e!==null&&e.size>0)for(let t of Ye){let n=t.remote?.hostId;n!==void 0&&t.remote?.state===`connected`&&e.delete(n)}let t=r_(Tt,Ye,e===null||e.size===0?void 0:{preserveHostKeys:e});t!==Tt&&Ot(t)},250);return()=>{window.clearTimeout(e)}},[Tt,Ye,Ot,Ee,N]);let kt=()=>{Ot(g_())},At=(0,s.useMemo)(()=>Qg(Ye),[Ye]),jt=(0,s.useMemo)(()=>e_(Ye),[Ye]),Mt=(0,s.useMemo)(()=>n_(Tt,Ye),[Tt,Ye]),Nt=(0,s.useMemo)(()=>At&&i_(Mt,Ye),[At,Mt,Ye]),Pt=(0,s.useMemo)(()=>At&&Mt.selectedHost!==`all`&&Mt.selectedHost!==`local`,[At,Mt.selectedHost]),Ft=(0,s.useMemo)(()=>Nt?a_(Ye,Mt):Ye,[Nt,Ye,Mt]),It=(0,s.useMemo)(()=>new Set(Ft.map(e=>e.workspaceId)),[Ft]),Lt=(0,s.useMemo)(()=>Nt?u_(Qe.map(e=>({id:e,remote:M.byId[e]?.projectionValues?.remoteHost??void 0})),It,Ye,Mt).map(e=>e.id):Qe,[Nt,Qe,M.byId,It,Ye,Mt]),Rt=(0,s.useMemo)(()=>Se&&c_(Mt,Ye),[Se,Mt,Ye]),zt=(0,s.useMemo)(()=>l_(Mt,Ye,Ft),[Mt,Ye,Ft]),Bt=(0,s.useMemo)(()=>Nt?new Set(u_(M.ids.map(e=>({id:e,remote:M.byId[e]?.projectionValues?.remoteHost??void 0})),It,Ye,Mt,qe.rootOf).map(e=>e.id)):null,[Nt,M.ids,M.byId,It,Ye,Mt,qe.rootOf]),Vt=(0,s.useMemo)(()=>Bt===null?M:{...M,ids:M.ids.filter(e=>Bt.has(e)),...zt?{}:{hasMore:!1,loading:!1}},[M,zt,Bt]);(0,s.useEffect)(()=>{T?.(Bt)},[T,Bt]),(0,s.useEffect)(()=>()=>{T?.(null)},[T]);let Ht=(0,s.useMemo)(()=>Nt?JSON.stringify(Mt):`all`,[Nt,Mt]),Ut=`${Ne}/${Pe}/${Fe}/${Ht}`,Wt=gt===``?`${ot?`activity`:Ne===`flat`?`flat`:`tree`}/${Ut}`:`search/${Ut}/${gt}`,Gt=M.phase===`ready`&&Be&&(gt===``||_t.query===gt&&_t.status!==`loading`),Kt=(0,s.useRef)(null),qt=(0,s.useRef)(),Jt=(0,s.useRef)(null);(0,s.useLayoutEffect)(()=>{let t=Kt.current;if(!e||t===null){Jt.current=null;return}let n=Jt.current;if((n?.key!==Wt||n.node!==t)&&(n?.node===t&&ct===void 0&&(t.scrollTop=0),n={key:Wt,node:t,pending:!0},Jt.current=n),n.pending){if(ct===void 0){let e=t.scrollTop;if(e!==0)(qt.current??=/* @__PURE__ */ new Map).set(Wt,e);else{let e=qt.current?.get(Wt)??0;if(e!==0){if(!Gt)return;t.scrollTop=e,qt.current?.set(Wt,t.scrollTop)}}}n.pending=!1}},[e,Wt,Gt,ct]);let Yt={scrollRef:Kt,onScroll:({currentTarget:t})=>{let n=Jt.current;if(!e||n?.key!==Wt||n.node!==t)return;let r=t.scrollTop;r===0&&(n.pending||t.scrollHeight<=t.clientHeight)||(n.pending=!1,(qt.current??=/* @__PURE__ */ new Map).set(Wt,r))}},Xt=(0,s.useMemo)(()=>zg(Vt,Ge,ve),[Vt,Ge,ve]),Zt=_e?void 0:Ve,Qt=(0,s.useCallback)(e=>{e.length!==0&&(p??Ie.markCompletionsRead)(e)},[p,Ie.markCompletionsRead]),$t=()=>{let e=Mt.selectedHost!==`all`&&Mt.selectedHost!==`local`?Mt.selectedHost:void 0;window.dispatchEvent(new CustomEvent(`codexhost:open-add-remote-workspace`,{detail:e===void 0?{}:{hostId:e}}))},en=(0,s.useRef)(!1),tn=e=>{if(De.includes(e)){h();return}let t=Ie.rootId(e),n=Te.find(e=>e.sessionIds.includes(t));if(Nt){let e=__(Mt,n,Ye);e!==Mt&&Ot(e)}let r=Ne===`flat`?void 0:n?.workspaceId,i=We.find(({threadIds:e})=>e.includes(t))??(r===void 0?void 0:We.find(({workspaceIds:e})=>e?.includes(r)===!0));i&&u.setSectionExpanded(`native-section:${i.id}`,!0),st(!1),lt(e),rt(``),at(!1),Ie.reveal(e),f(e)},nn=e=>{let t=Kt.current;e===ct&&t!==null&&(qt.current??=/* @__PURE__ */ new Map).set(Wt,t.scrollTop),lt(t=>t===e?void 0:t)};(0,s.useEffect)(()=>{gt!==``&<(void 0)},[gt]);let[rn,an]=(0,s.useState)(!1);(0,s.useEffect)(()=>{if(e&&rn){let e=window.setTimeout(()=>{bt.current?.focus({preventScroll:!0}),an(!1)},300);return()=>{window.clearTimeout(e)}}},[e,rn]),(0,s.useEffect)(()=>{ge.searchRequest!==0&&(D(),at(!0),e?bt.current?.focus({preventScroll:!0}):(an(!0),n()))},[ge.searchRequest]);let on=(0,s.useRef)({wide:e,searchActive:!1});on.current={wide:e,searchActive:it||nt!==``},(0,s.useEffect)(()=>{if(ge.activityViewRequest===0)return;D();let{wide:e,searchActive:t}=on.current;t?(rt(``),at(!1),st(!0),e||n()):e?st(e=>!e):(n(),st(!0))},[ge.activityViewRequest]),(0,s.useEffect)(()=>{e&&it&&!rn&&bt.current?.focus({preventScroll:!0})},[e,it,rn]),(0,s.useEffect)(()=>{if(!e||!it||rn)return;let t=e=>{e.target instanceof Node&&yt.current?.contains(e.target)!==!0&&(bt.current?.blur(),gt===``&&at(!1))};return document.addEventListener(`click`,t),()=>{document.removeEventListener(`click`,t)}},[gt,e,it,rn]),(0,s.useEffect)(()=>{if(gt===``){vt({query:``,status:`idle`,items:[],hasMore:!1});return}let e=new AbortController;vt({query:gt,status:`loading`,items:[],hasMore:!1});let t=window.setTimeout(()=>{ee(gt,e.signal).then(t=>{e.signal.aborted||vt({query:gt,status:`ready`,items:t.items,hasMore:t.hasMore})}).catch(()=>{e.signal.aborted||vt({query:gt,status:`error`,items:[],hasMore:!1})})},250);return()=>{window.clearTimeout(t),e.abort()}},[gt,ee]);let[sn,cn]=(0,s.useState)(null),[ln,un]=(0,s.useState)(``),[dn,fn]=(0,s.useState)(null),pn=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(dn!==null)return;let e=pn.current;pn.current=null,e?.isConnected&&e.focus()},[dn]);let[mn,hn]=(0,s.useState)(!1),[gn,_n]=(0,s.useState)(null),vn=ln.trim(),yn=sn!==null&&vn!==``&&Te.some(e=>e.workspaceId!==sn.workspaceId&&e.title===vn),bn=mn||vn===``||sn===null||vn===sn.storedTitle||yn,xn=()=>{mn||(cn(null),_n(null))},Sn=()=>{bn||(hn(!0),_n(null),g(sn.workspaceId,vn).then(()=>{hn(!1),cn(null)}).catch(e=>{hn(!1),_n(e instanceof Error?e.message:String(e))}))},Cn=e=>{x(e).catch(e=>{console.warn(`session unarchive rejected:`,e)})},[wn,Tn]=(0,s.useState)(null),[En,Dn]=(0,s.useState)(!1),[On,kn]=(0,s.useState)(null),[An,jn]=(0,s.useState)(null);(0,s.useEffect)(()=>{On===null||Te.some(e=>e.workspaceId===On)||(Dn(!1),kn(null),Tn(null))},[On,Te]);let Mn=()=>{En||(Tn(null),jn(null))},Nn=()=>{
|
|
123
|
+
F.clearHover(),De(n=>n===null?n:{...n,over:{id:e.id,half:a(t)}})},drop:t=>{F.end(),N!==null&&Ze(N,{id:e.id,half:a(t)})},end:e=>{let t=F.canFinishLocalDrop(e);F.end(),t&&N?.over?Ze(N,N.over):De(null),Oe.current=!1}}:l?{canDrag:!0,start:()=>{F.startFromUnsectioned(e.id)},active:!1,marker:null,hover:()=>{},drop:()=>{},end:()=>{F.end()}}:void 0;return/* @__PURE__ */ (0,o.jsx)(gv,{rowKey:ee(e.id),showHost:!t.remote&&!(s===void 0&&ye),node:e,currentId:we,now:Ye,onOpen:r,onRenameRequest:ae,renderSlot:oe,onReveal:e.id===me&&t.key===Ee?()=>{he(e.id)}:void 0,drag:u,useMovingSectionSessions:m,t:j},e.id)}}),le&&/* @__PURE__ */ (0,o.jsx)(Nv,{rowKey:`overflow:${t.key}`,hiddenCount:_.hiddenCount,hasMore:D,loading:ce===void 0?!t.remote&&e.loading:ce===`loading`,workspaceHistory:ce,workspaceId:se?s:void 0,fillWorkspace:u&&y&&e.phase===`ready`&&e.workspaceHistory?.[s]===void 0&&_.ordinaryCount<5,expand:()=>{T(e=>({...e,[t.key]:(e[t.key]??5)+10}))},loadMoreSessions:_e,t:j})]})]},t.key)},bt=ct?rt.map(e=>yt(e,0)):void 0,xt=/* @__PURE__ */ new Map;for(let e of Pe)_t.push(...Ty([e],M.rows)),e.expanded&&xt.set(e.key,(it.get(e.id)??[]).map(e=>yt(e,0)));!ve&&Je.length===0&&!gt&&f.length===0&&_t.push(`empty`);let St=We(null),Ct=ve&&at.length===0&&rt.length===0,wt=at.length>0||Ct||!!St,Tt=!(wt||gt||Pe.length>0)&&st[0]?.workspaceId!==void 0&&P?.over?.id===st[0].workspaceId&&P?.over?.half===`before`,Et=[];if(wt&&_t.push(`section:${Lm}`),dt){Ct&&(_t.push(`empty:host-scope`),Et.push(/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.filterEmptyHint,"data-row-key":`empty:host-scope`,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{children:j(`hostScope.emptyWorkspaces`)}),be!==void 0&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.emptyAction,onClick:be,children:j(`hostScope.showAll`)})]},`empty:host-scope`)));for(let e of st)Et.push(yt(e,0));!ee&&ot.hiddenCount>0&&(_t.push(`overflow:workspaces`),Et.push(/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.sessionOverflowButton,"data-row-key":`overflow:workspaces`,onClick:()=>E(!0),children:j(`workspaces.expand`)},`overflow:workspaces`)))}let Dt=et.find(e=>e.key===``);return Dt!==void 0&&Et.push(yt(Dt,0)),/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:je,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:[Tt&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.listTopDropIndicator,"aria-hidden":`true`}),/* @__PURE__ */ (0,o.jsxs)(Yg,{className:X(Z.list,Tt&&Z.listTopDropActive),label:j(`section.sessions`),rowKeys:_t,scrollRef:S,onScroll:C,ready:e.phase===`ready`&&y&&!Ie,resetKey:JSON.stringify([x,w,ee,ct,dt]),children:[/* @__PURE__ */ (0,o.jsx)(kv,{rows:ht,hasWorkspaces:rt.length>0,sectionDrag:F.interaction,currentId:we,showHost:!ye,onOpen:r,onRenameRequest:ae,renderSlot:oe,useMovingSectionSessions:m,revealSessionId:me,onSessionRevealed:he,expanded:ct,onToggle:()=>{ue(Im,!ct)},t:j,children:bt}),/* @__PURE__ */ (0,o.jsx)(Ey,{sections:Pe,groupRows:xt,projectSectionDrop:We,manageThreadSection:_,sectionDrag:F.interaction,currentId:we,showHost:!ye,onOpen:r,onRenameRequest:ae,renderSlot:oe,useMovingSectionSessions:m,revealSessionId:me,onSessionRevealed:he,setSectionExpanded:ue,t:j}),!ve&&Je.length===0&&!gt&&f.length===0&&/* @__PURE__ */ (0,o.jsx)(by,{rowState:d,onLeaveArchivedOnly:v,partial:e.hasMore,t:j}),(wt||Et.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:[wt&&/* @__PURE__ */ (0,o.jsx)(Ev,{label:j(`section.workspaces`),projectDrop:St,expanded:dt,onToggle:()=>{dt&&E(!1),ue(`workspaces`,!dt)},rowKey:`section:workspaces`}),Et,!wt&&Et.length===0&&F.canDropToUnsectioned&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.unsectionedDropHint,children:j(`section.unsectioned`)})]})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.fade}),Be&&L.has(Be)&&ce&&/* @__PURE__ */ (0,o.jsx)(Pv,{current:Re.get(Be)??``,sections:f,move:e=>ce(Be,e),dismiss:()=>Ve(void 0),defaultLabel:j(`section.workspaces`),failedLabel:j(`section.projectMoveFailed`),t:j},Be),He&&/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:j(`section.projectMoveFailed`),onDone:()=>Ue(!1)})]})}let Sy=[],Cy=[];function wy(e,t,n,r,i,a){if(!e.length)return[];let o=a??new Map(Dm(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:Rm(i,r)}})}function Ty(e,t){return e.flatMap(({key:e,rows:n,expanded:r})=>[`section:${e}`,...r?t(n).map(e=>`session:${e.id}`):[]])}function Ey({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)(kv,{...a,rows:c,customSection:{key:e,section:s,projectDrop:n?.(s.id)},headingActions:r&&G_(s)&&/* @__PURE__ */ (0,o.jsx)(jg,{section:s,request:r,t:a.t}),expanded:l,onToggle:()=>i(e,!l),children:t?.get(e)},e))}function Dy({list:e,sessionIds:t,rowState:n,nativeSections:r,nativeThreadIds:i,useMovingSectionSessions:a,moveSessionToSection:c,finePointer:l,manageThreadSection:u,onLeaveArchivedOnly:d,useSessionStatus:f,open:p,onSessionRenameRequest:m,usePanelInfo:h,setSessionOrder:g,sectionExpansion:_,setSectionExpanded:v,workspaceReady:y,animationResetKey:b,scrollRef:x,onScroll:S,limit:C,setLimit:w,revealSessionId:T,onSessionRevealed:ee,renderSlot:E,loadMoreSessions:te,hostScopeFiltered:ne=!1,singleRemoteHostScoped:re=!1,onResetHostScope:ie,t:ae}){let oe=h(e=>e.activePanelId!==null),se=f(e=>e),ce=E_(),D=(0,s.useMemo)(()=>new Map(Dm(e,n,se).map(e=>[e.id,e])),[e,n,se]),le=(0,s.useMemo)(()=>jm(e,t,n,se,D).filter(e=>!e.pinned&&!n.sectionedSessionIds?.has(e.id)),[e,t,n,se,D]),O=(0,s.useMemo)(()=>jm(e,n.pinnedSessionIds,n,se,D).filter(e=>e.pinned),[e,n,se,D]),[k,ue]=(0,s.useState)(null),de=(0,s.useRef)(!1),A=Rm(_,Im),fe=(0,s.useMemo)(()=>wy(r,e,n,se,_,D),[r,e,n,se,_,D]),pe=(0,s.useMemo)(()=>new Map(fe.map(e=>[e.id,e.rows.filter(e=>!e.archived&&!e.pinned).map(e=>e.id)])),[fe]),j=Uv({enabled:l&&c!==void 0&&r.length>0,nativeSections:r,visibleSectionRows:pe,nativeThreadIds:i,pinnedSessionIds:n.pinnedSessionIds,archivedSessionIds:n.archivedSessionIds,moveSessionToSection:c,onCancelLocalDrag:()=>{de.current=!0,ue(null)}});gy(k!==null);let me=oe?void 0:Object.values(e.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,he=jv(le,C,me,T),ge=jv(le,10,me,T).hiddenCount>0,_e=(e,n)=>{if(de.current)return;de.current=!0,ue(null);let r=vy(t,le,e,n);r!==void 0&&g(Fm,r)},ve=Date.now();return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(Z.treeBody,Z.wide),onDragOver:j.active?j.clearHover:void 0,onDragLeave:j.active?e=>{(!(e.relatedTarget instanceof Node)||!e.currentTarget.contains(e.relatedTarget))&&j.clearHover()}:void 0,children:[/* @__PURE__ */ (0,o.jsxs)(Yg,{className:X(Z.list,Z.flatList),label:ae(`section.sessions`),scrollRef:x,onScroll:S,rowKeys:[...O.length===0?[]:[`section:${Im}`],...A?ce.rows(O).map(e=>`session:${e.id}`):[],...Ty(fe,ce.rows),...le.length===0&&O.length===0&&r.length===0?[ne?`empty:host-scope`:`empty`]:[],...ce.rows(he.rows).map(e=>`session:${e.id}`),...ge||e.hasMore?[`overflow:flat`]:[]],ready:e.phase===`ready`&&y&&k===null&&!j.active,resetKey:`${b}/${C}/${String(A)}`,children:[/* @__PURE__ */ (0,o.jsx)(kv,{rows:O,sectionDrag:j.interaction,currentId:me,showHost:!re,onOpen:p,onRenameRequest:m,renderSlot:E,useMovingSectionSessions:a,revealSessionId:T,onSessionRevealed:ee,expanded:A,onToggle:()=>{v(Im,!A)},t:ae}),/* @__PURE__ */ (0,o.jsx)(Ey,{sections:fe,manageThreadSection:u,sectionDrag:j.interaction,currentId:me,showHost:!re,onOpen:p,onRenameRequest:m,renderSlot:E,useMovingSectionSessions:a,revealSessionId:T,onSessionRevealed:ee,setSectionExpanded:v,t:ae}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(Z.unsectionedZone,Z.flatUnsectioned,j.isUnsectionedTarget&&Z.unsectionedDropTarget),"data-section-drop-unsectioned":``,onDragOver:j.canDropToUnsectioned?e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`,j.hoverUnsectioned()}:void 0,onDrop:j.canDropToUnsectioned?e=>{e.dataTransfer.dropEffect!==`copy`&&(e.preventDefault(),e.stopPropagation(),j.dropUnsectioned(e.dataTransfer.dropEffect))}:void 0,children:[(O.length>0||r.length>0)&&/* @__PURE__ */ (0,o.jsx)(Ev,{label:ae(`section.sessions`)}),le.length===0&&O.length===0&&r.length===0&&(ne?/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.filterEmptyHint,"data-row-key":`empty:host-scope`,children:[/* @__PURE__ */ (0,o.jsx)(`span`,{children:ae(`hostScope.emptySessions`)}),ie!==void 0&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.emptyAction,onClick:ie,children:ae(`hostScope.showAll`)})]}):/* @__PURE__ */ (0,o.jsx)(by,{rowState:n,onLeaveArchivedOnly:d,partial:e.hasMore,t:ae})),/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.flatRows,onDragOver:!j.canDropToUnsectioned&&k!==null?e=>{let t=$_(e,k.pinned);t!==null&&(j.clearHover(),(k.over?.id!==t.id||k.over.half!==t.half)&&ue({...k,over:t}),e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`)}:void 0,onDrop:!j.canDropToUnsectioned&&k!==null?e=>{if(e.dataTransfer.dropEffect===`copy`)return;let t=$_(e,k.pinned);t!==null&&(e.preventDefault(),e.stopPropagation(),j.end(),_e(k,t))}:void 0,children:/* @__PURE__ */ (0,o.jsx)(H_,{roots:he.rows,children:e=>{let t=k!==null&&k.pinned===e.pinned,n=t=>e.blank?`after`:t,r=j.canDragRow(e);return/* @__PURE__ */ (0,o.jsx)(gv,{node:e,showHost:!re,currentId:me,now:ve,onOpen:p,onRenameRequest:m,renderSlot:E,onReveal:e.id===T?()=>{ee(e.id)}:void 0,drag:{start:()=>{de.current=!1,ue({accountKey:Fm,sessionId:e.id,pinned:e.pinned,over:null}),r?j.startFromUnsectioned(e.id):j.end()},active:t,marker:!j.hasSectionTarget&&t&&k.over?.id===e.id?k.over.half:null,hover:t=>{j.clearHover(),ue(r=>r===null?r:{...r,over:{id:e.id,half:n(t)}})},drop:t=>{j.end(),k!==null&&_e(k,{id:e.id,half:n(t)})},end:e=>{let t=j.canFinishLocalDrop(e);j.end(),t&&k?.over?_e(k,k.over):ue(null),de.current=!1}},useMovingSectionSessions:a,t:ae},e.id)}})}),/* @__PURE__ */ (0,o.jsx)(Nv,{rowKey:`overflow:flat`,hiddenCount:he.hiddenCount,hasMore:e.hasMore,loading:e.loading,expanded:C>10,expand:()=>w(C+10),collapse:ge?()=>w(10):void 0,loadMoreSessions:te,t:ae})]})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.fade})]})}function Oy({useSessions:e,useSessionStatus:t,open:n,onUnarchive:r,workspaces:i,archivedSessionIds:a,archivedFilter:c,query:l,remote:u,resultLimit:d,usePanelInfo:f,scrollRef:p,onScroll:m,t:h}){let g=f(e=>e.activePanelId!==null),_=e(e=>e),v=t(e=>e),y=u.query===l?u:{query:l,status:`loading`,items:[],hasMore:!1},b=(0,s.useMemo)(()=>Mm(_,i,l,a,c,v,y,d),[_,i,l,a,c,v,y,d]),x=y.status===`loading`,S=g?void 0:Object.values(_.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id;return/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(Z.treeBody,Z.wide),children:[/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.list,ref:p,onScroll:m,children:[/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.searchTree,role:`tree`,"aria-label":h(`search.results.aria`),children:b.items.map(e=>/* @__PURE__ */ (0,o.jsx)(hv,{result:e,currentId:S,onOpen:n,onUnarchive:r,t:h},e.id))}),x&&/* @__PURE__ */ (0,o.jsx)(`div`,{role:`status`,"aria-label":h(`search.pending`),children:(b.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))}),!x&&b.items.length===0&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.empty,children:h(`search.noMatches`)}),b.hasMore&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.searchStatus,children:h(`search.hasMore`,{n:d})})]}),/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.fade})]})}function ky(e){return/* @__PURE__ */ (0,o.jsx)(D_,{browser:e,children:/* @__PURE__ */ (0,o.jsx)(Ay,{...e})})}function Ay({wide:e,usePanelInfo:t,expandSidebar:n,useSessions:r,useSessionStatus:i,useWorkspaces:c,useStore:l,actions:u,startSession:d,open:f,markCompletionsRead:p,requestSessionRename:m,notifyArchivedNotOpenable:h,renameWorkspace:g,deleteWorkspace:_,insertWorkspaceBefore:v,moveWorkspaceToSection:y,setWorkspacePinned:b,unarchiveSession:x,createWorkspace:S,requestManageThreadSection:C,moveSessionToSection:w,setScopedSessionIds:T,searchSessions:ee,searchResultLimit:E,useDirectoryFlow:te,useHostInfo:ne,useShortcuts:re,useWorkspaceShortcuts:ie,useNativeThreads:ae,useMovingSectionSessions:oe,requestSearch:se,requestAddWorkspace:ce,closeAddWorkspace:D,setDirectoryBusy:le,dismissForkError:O,refreshSessions:k,loadMoreSessions:ue,renderSlot:de,t:A}){let fe=ne(e=>e.home),pe=re(e=>e),j=pe.find(e=>e.id===`session.search`),me=pe.find(e=>e.id===`session.activityView`),he=pe.find(e=>e.id===`workspace.add`),ge=ie(e=>e),_e=t(e=>e.activePanelId!==null),ve=i(e=>e),ye=ae(e=>e),be=Hv(),M=r(e=>e),xe=c(e=>e.items),Se=c(e=>e.canStartProjectless===!0),Ce=A(`workspace.defaultName`),we=A(`group.remoteOtherSessions`),Te=(0,s.useMemo)(()=>xe.map(e=>({...e,title:t_(e)?we:kg(e.title,Ce)})),[xe,Ce,we]),Ee=c(e=>e.phase),N=c(e=>e.state),De=c(e=>e.archivedSessionIds),Oe=c(e=>e.pinnedSessionIds),P=c(e=>e.pinnedWorkspaceIds??Cy),ke=c(e=>e.threadSections??Sy),Ae=c(e=>e.state===`idle`&&e.threadSectionsV1===!0),je=Ae?C:void 0,Me=te(e=>e),Ne=l(e=>e.groupBy),Pe=l(e=>e.orderBy),Fe=l(e=>e.archivedFilter??`default`),F=l(e=>e.groupExpansion),Ie=E_(),I=l(e=>e.sectionExpansion),Le=l(e=>e.sessionOrderByAccount),Re=e=>{De.includes(e)?h():(Ie.selectSidebarRow(e),f(e))},ze=()=>{u.setArchivedFilter(`default`)},Be=Ee===`ready`&&N!==`loading`,Ve=Object.values(M.byId).find(e=>(e.retainedBy.mainView??0)>0)?.id,He=Ve!==void 0&&M.byId[Ve]?.blank===!0?Ve:void 0,Ue=(0,s.useMemo)(()=>{let e=new Set(Te.flatMap(e=>e.sessionIds));return[.../* @__PURE__ */ new Set([...M.ids,...De])].filter(t=>!e.has(t))},[De,M.ids,Te]),L=(0,s.useMemo)(()=>({pinnedSessionIds:Oe,archivedSessionIds:De}),[De,Oe]),We=Fe===`only`?Sy:ke,Ge=(0,s.useMemo)(()=>({...L,archivedFilter:Fe,sectionedSessionIds:new Set(We.flatMap(e=>e.threadIds))}),[L,Fe,We]),Ke=(0,s.useMemo)(()=>km(M,De),[De,M]),qe=(0,s.useMemo)(()=>Vm(M,Ge,Ie.forest),[M,Ge,Ie.forest]),Je=(0,s.useMemo)(()=>Te.map(e=>{let{memberIds:t,linkedRootIds:n}=Hm(e.sessionIds,qe),r=Pe===`updated`?pm(t,qe.summaries):mm(t,Le[e.workspaceId],qe.summaries,L);return{workspace:{...e,sessionIds:hm(r,He!==void 0&&t.includes(He)?He:void 0)},linkedRootIds:n}}),[He,qe,Pe,L,Le,Te]),Ye=(0,s.useMemo)(()=>Je.map(({workspace:e})=>e),[Je]),Xe=(0,s.useMemo)(()=>new Map(Je.map(({workspace:e,linkedRootIds:t})=>[e.workspaceId,t])),[Je]),Ze=(0,s.useMemo)(()=>pm(Ue.filter(e=>qe.rootIds.has(e)),qe.summaries),[qe,Ue]),Qe=(0,s.useMemo)(()=>{let e=Ke.filter(e=>qe.rootIds.has(e));return hm(Pe===`updated`?pm(e,qe.summaries):mm(e,Le[Fm],qe.summaries,L),He!==void 0&&Ke.includes(He)?He:void 0)},[He,Ke,qe,Pe,L,Le]),$e=(0,s.useMemo)(()=>Um(Te,M,Ge,qe),[M,Ge,qe,Te]),et=(0,s.useMemo)(()=>Object.fromEntries([...Ye.map(e=>[e.workspaceId,e.sessionIds]),[``,Ze],[Fm,Qe]]),[Qe,Ze,Ye]);(0,s.useEffect)(()=>{Ee===`ready`&&u.retainAccountKeys([``,Fm,...Te.map(e=>e.workspaceId)])},[u.retainAccountKeys,Ee,Te]),(0,s.useEffect)(()=>{if(M.phase!==`ready`||Be||Pe!==`manual`||He===void 0)return;let e={};for(let[t,n]of Object.entries(et)){if(t!==`__flat_session_order__`&&Ee!==`ready`)continue;let r=Le[t]??[];n[0]===He&&r[0]!==He&&(e[t]=[He,...r.filter(e=>e!==He)])}Object.keys(e).length>0&&u.syncSessionOrders(e,$e)},[u.syncSessionOrders,et,He,M.phase,Pe,Le,$e,Ee,Be]),(0,s.useEffect)(()=>{M.phase===`ready`&&Be&&Pe===`manual`&&He!==void 0&&Object.entries(et).some(([e,t])=>t[0]===He&&Le[e]?.[0]!==He)&&u.syncSessionOrders(et,$e)},[u.syncSessionOrders,et,He,M.phase,Pe,Le,$e,Be]);let tt=(e,t)=>{u.setSessionOrder(e,t,et,$e)},[nt,rt]=(0,s.useState)(``),[it,at]=(0,s.useState)(!1),[ot,st]=(0,s.useState)(!1),[ct,lt]=(0,s.useState)(void 0),[ut,dt]=(0,s.useState)({}),[ft,pt]=(0,s.useState)(!1),[mt,ht]=(0,s.useState)(10),gt=hy(nt).trim(),[_t,vt]=(0,s.useState)({query:``,status:`idle`,items:[],hasMore:!1}),yt=(0,s.useRef)(null),bt=(0,s.useRef)(null),xt=ge.addRequested,St=(0,s.useRef)(null),[Ct,wt]=(0,s.useState)(!1),[Tt,Et]=(0,s.useState)(()=>S_()),Dt=(0,s.useRef)(null);if(Dt.current===null){let e=/* @__PURE__ */ new Set;for(let t of Object.keys(Tt.perHost))t!==`local`&&t!==Tt.selectedHost&&e.add(t);Dt.current=e}let Ot=(0,s.useCallback)(e=>{Et(e),C_(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`);Dt.current?.add(t.hostId),Et(e=>{let r=__(e,t.hostId,n);return C_(r),r})};return window.addEventListener($g,e),()=>{window.removeEventListener($g,e)}},[]),(0,s.useEffect)(()=>{if(Ee!==`ready`||N!==`idle`)return;let e=window.setTimeout(()=>{let e=Dt.current;if(e!==null&&e.size>0)for(let t of Ye){let n=t.remote?.hostId;n!==void 0&&t.remote?.state===`connected`&&e.delete(n)}let t=a_(Tt,Ye,e===null||e.size===0?void 0:{preserveHostKeys:e});t!==Tt&&Ot(t)},250);return()=>{window.clearTimeout(e)}},[Tt,Ye,Ot,Ee,N]);let kt=()=>{Ot(v_())},At=(0,s.useMemo)(()=>e_(Ye),[Ye]),jt=(0,s.useMemo)(()=>n_(Ye),[Ye]),Mt=(0,s.useMemo)(()=>i_(Tt,Ye),[Tt,Ye]),Nt=(0,s.useMemo)(()=>At&&o_(Mt,Ye),[At,Mt,Ye]),Pt=(0,s.useMemo)(()=>At&&Mt.selectedHost!==`all`&&Mt.selectedHost!==`local`,[At,Mt.selectedHost]),Ft=(0,s.useMemo)(()=>Nt?s_(Ye,Mt):Ye,[Nt,Ye,Mt]),It=(0,s.useMemo)(()=>new Set(Ft.map(e=>e.workspaceId)),[Ft]),Lt=(0,s.useMemo)(()=>Nt?f_(Qe.map(e=>({id:e,remote:M.byId[e]?.projectionValues?.remoteHost??void 0})),It,Ye,Mt).map(e=>e.id):Qe,[Nt,Qe,M.byId,It,Ye,Mt]),Rt=(0,s.useMemo)(()=>Se&&u_(Mt,Ye),[Se,Mt,Ye]),zt=(0,s.useMemo)(()=>d_(Mt,Ye,Ft),[Mt,Ye,Ft]),Bt=(0,s.useMemo)(()=>Nt?new Set(f_(M.ids.map(e=>({id:e,remote:M.byId[e]?.projectionValues?.remoteHost??void 0})),It,Ye,Mt,qe.rootOf).map(e=>e.id)):null,[Nt,M.ids,M.byId,It,Ye,Mt,qe.rootOf]),Vt=(0,s.useMemo)(()=>Bt===null?M:{...M,ids:M.ids.filter(e=>Bt.has(e)),...zt?{}:{hasMore:!1,loading:!1}},[M,zt,Bt]);(0,s.useEffect)(()=>{T?.(Bt)},[T,Bt]),(0,s.useEffect)(()=>()=>{T?.(null)},[T]);let Ht=(0,s.useMemo)(()=>Nt?JSON.stringify(Mt):`all`,[Nt,Mt]),Ut=`${Ne}/${Pe}/${Fe}/${Ht}`,Wt=gt===``?`${ot?`activity`:Ne===`flat`?`flat`:`tree`}/${Ut}`:`search/${Ut}/${gt}`,Gt=M.phase===`ready`&&Be&&(gt===``||_t.query===gt&&_t.status!==`loading`),Kt=(0,s.useRef)(null),qt=(0,s.useRef)(),Jt=(0,s.useRef)(null);(0,s.useLayoutEffect)(()=>{let t=Kt.current;if(!e||t===null){Jt.current=null;return}let n=Jt.current;if((n?.key!==Wt||n.node!==t)&&(n?.node===t&&ct===void 0&&(t.scrollTop=0),n={key:Wt,node:t,pending:!0},Jt.current=n),n.pending){if(ct===void 0){let e=t.scrollTop;if(e!==0)(qt.current??=/* @__PURE__ */ new Map).set(Wt,e);else{let e=qt.current?.get(Wt)??0;if(e!==0){if(!Gt)return;t.scrollTop=e,qt.current?.set(Wt,t.scrollTop)}}}n.pending=!1}},[e,Wt,Gt,ct]);let Yt={scrollRef:Kt,onScroll:({currentTarget:t})=>{let n=Jt.current;if(!e||n?.key!==Wt||n.node!==t)return;let r=t.scrollTop;r===0&&(n.pending||t.scrollHeight<=t.clientHeight)||(n.pending=!1,(qt.current??=/* @__PURE__ */ new Map).set(Wt,r))}},Xt=(0,s.useMemo)(()=>Vg(Vt,Ge,ve),[Vt,Ge,ve]),Zt=_e?void 0:Ve,Qt=(0,s.useCallback)(e=>{e.length!==0&&(p??Ie.markCompletionsRead)(e)},[p,Ie.markCompletionsRead]),$t=()=>{let e=Mt.selectedHost!==`all`&&Mt.selectedHost!==`local`?Mt.selectedHost:void 0;window.dispatchEvent(new CustomEvent(`codexhost:open-add-remote-workspace`,{detail:e===void 0?{}:{hostId:e}}))},en=(0,s.useRef)(!1),tn=e=>{if(De.includes(e)){h();return}let t=Ie.rootId(e),n=Te.find(e=>e.sessionIds.includes(t));if(Nt){let e=y_(Mt,n,Ye);e!==Mt&&Ot(e)}let r=Ne===`flat`?void 0:n?.workspaceId,i=We.find(({threadIds:e})=>e.includes(t))??(r===void 0?void 0:We.find(({workspaceIds:e})=>e?.includes(r)===!0));i&&u.setSectionExpanded(`native-section:${i.id}`,!0),st(!1),lt(e),rt(``),at(!1),Ie.reveal(e),f(e)},nn=e=>{let t=Kt.current;e===ct&&t!==null&&(qt.current??=/* @__PURE__ */ new Map).set(Wt,t.scrollTop),lt(t=>t===e?void 0:t)};(0,s.useEffect)(()=>{gt!==``&<(void 0)},[gt]);let[rn,an]=(0,s.useState)(!1);(0,s.useEffect)(()=>{if(e&&rn){let e=window.setTimeout(()=>{bt.current?.focus({preventScroll:!0}),an(!1)},300);return()=>{window.clearTimeout(e)}}},[e,rn]),(0,s.useEffect)(()=>{ge.searchRequest!==0&&(D(),at(!0),e?bt.current?.focus({preventScroll:!0}):(an(!0),n()))},[ge.searchRequest]);let on=(0,s.useRef)({wide:e,searchActive:!1});on.current={wide:e,searchActive:it||nt!==``},(0,s.useEffect)(()=>{if(ge.activityViewRequest===0)return;D();let{wide:e,searchActive:t}=on.current;t?(rt(``),at(!1),st(!0),e||n()):e?st(e=>!e):(n(),st(!0))},[ge.activityViewRequest]),(0,s.useEffect)(()=>{e&&it&&!rn&&bt.current?.focus({preventScroll:!0})},[e,it,rn]),(0,s.useEffect)(()=>{if(!e||!it||rn)return;let t=e=>{e.target instanceof Node&&yt.current?.contains(e.target)!==!0&&(bt.current?.blur(),gt===``&&at(!1))};return document.addEventListener(`click`,t),()=>{document.removeEventListener(`click`,t)}},[gt,e,it,rn]),(0,s.useEffect)(()=>{if(gt===``){vt({query:``,status:`idle`,items:[],hasMore:!1});return}let e=new AbortController;vt({query:gt,status:`loading`,items:[],hasMore:!1});let t=window.setTimeout(()=>{ee(gt,e.signal).then(t=>{e.signal.aborted||vt({query:gt,status:`ready`,items:t.items,hasMore:t.hasMore})}).catch(()=>{e.signal.aborted||vt({query:gt,status:`error`,items:[],hasMore:!1})})},250);return()=>{window.clearTimeout(t),e.abort()}},[gt,ee]);let[sn,cn]=(0,s.useState)(null),[ln,un]=(0,s.useState)(``),[dn,fn]=(0,s.useState)(null),pn=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(dn!==null)return;let e=pn.current;pn.current=null,e?.isConnected&&e.focus()},[dn]);let[mn,hn]=(0,s.useState)(!1),[gn,_n]=(0,s.useState)(null),vn=ln.trim(),yn=sn!==null&&vn!==``&&Te.some(e=>e.workspaceId!==sn.workspaceId&&e.title===vn),bn=mn||vn===``||sn===null||vn===sn.storedTitle||yn,xn=()=>{mn||(cn(null),_n(null))},Sn=()=>{bn||(hn(!0),_n(null),g(sn.workspaceId,vn).then(()=>{hn(!1),cn(null)}).catch(e=>{hn(!1),_n(e instanceof Error?e.message:String(e))}))},Cn=e=>{x(e).catch(e=>{console.warn(`session unarchive rejected:`,e)})},[wn,Tn]=(0,s.useState)(null),[En,Dn]=(0,s.useState)(!1),[On,kn]=(0,s.useState)(null),[An,jn]=(0,s.useState)(null);(0,s.useEffect)(()=>{On===null||Te.some(e=>e.workspaceId===On)||(Dn(!1),kn(null),Tn(null))},[On,Te]);let Mn=()=>{En||(Tn(null),jn(null))},Nn=()=>{
|
|
124
124
|
/* v8 ignore next -- the Modal is absent without a target and its button is disabled while deleting. */
|
|
125
|
-
En||wn===null||(Dn(!0),kn(null),jn(null),_(wn.workspaceId).then(()=>{kn(wn.workspaceId)}).catch(e=>{Dn(!1),jn(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,it&&Z.sectionLabelHidden),children:A(`section.sessions`)}),e&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:X(Z.activitySlot,it&&Z.activitySlotHidden),children:/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:A(`activityView.label`),shortcutKeys:me?.keys,side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:X(Z.iconButton,Z.wide,Z.activityButton,ot&&Z.activityButtonActive),"aria-label":A(`activityView.label`),"aria-pressed":ot,"aria-keyshortcuts":me?.aria,onClick:()=>{D(),st(e=>!e)},children:/* @__PURE__ */ (0,o.jsxs)(`span`,{className:Z.activityIconWrap,children:[/* @__PURE__ */ (0,o.jsx)(_v,{size:16}),!ot&&Xt.hasAttention&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.activityDot,"data-attention":Xt.pendingCount>0?`pending`:`unread`,"aria-hidden":`true`})]})})})}),e&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:X(Z.searchSlot,it&&Z.searchSlotExpanded),children:/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:yt,className:X(Z.search,it&&Z.searchExpanded),onClick:()=>{D(),at(!0),bt.current?.focus()},children:[/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:A(`search`),shortcutKeys:j?.keys,side:`bottom`,delayMs:500,disabled:it,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.searchButton,"aria-label":A(`search.sessions.aria`),"aria-keyshortcuts":j?.aria,"aria-expanded":it,onClick:()=>{se()},children:/* @__PURE__ */ (0,o.jsx)(a.IconSearchOutlineRegular,{size:16})})}),/* @__PURE__ */ (0,o.jsx)(`input`,{ref:bt,className:Z.searchInput,type:`text`,placeholder:A(`search.placeholder`),maxLength:500,value:nt,tabIndex:it?0:-1,onChange:e=>{rt(py(e.target.value))},onKeyDown:e=>{e.key===`Escape`&&(e.currentTarget.closest(`[data-phone-drawer]`)&&(e.preventDefault(),e.stopPropagation()),rt(``),at(!1))}}),it&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.clearButton,"aria-label":A(`search.clear`),onClick:e=>{e.stopPropagation(),rt(``),at(!1)},children:/* @__PURE__ */ (0,o.jsx)(a.IconCloseFillRegular,{})})]})}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(Z.headerActions,e&&it&&Z.headerActionsHidden),children:[e&&je&&/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:A(`section.create.title`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:X(Z.iconButton,Z.wide),"aria-label":A(`section.create.title`),onClick:()=>je({mode:`create`}),children:/* @__PURE__ */ (0,o.jsx)(a.IconPlusOutlineRegular,{size:16})})}),e&&/* @__PURE__ */ (0,o.jsx)(hy,{groupBy:Ne,orderBy:Pe,archivedFilter:Fe,onGroupPick:u.setGroupBy,onOrderPick:e=>{u.setOrderBy(e,et,$e)},onArchivedFilterPick:e=>{e===`only`&&st(!1),u.setArchivedFilter(e)},t:A}),e&&jt?Me?/* @__PURE__ */ (0,o.jsx)(a.Menu,{phoneSidebarTitle:A(`workspace.add`),open:Ct,onClose:()=>{wt(!1)},items:[{id:`add-local`,label:A(`workspace.addLocal`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{})},{id:`add-remote`,label:A(`workspace.addRemote`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconGlobeOutlineRegular,{})}],onSelect:e=>{wt(!1),e===`add-local`?ce():e===`add-remote`&&$t()},align:`end`,dense:!0,portal:!0,anchor:/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:A(`workspace.add`),shortcutKeys:he?.keys,side:`bottom`,delayMs:500,disabled:Ct,children:/* @__PURE__ */ (0,o.jsx)(`button`,{ref:St,type:`button`,className:Z.iconButton,"aria-label":A(`workspace.add`),"aria-keyshortcuts":he?.aria,"aria-haspopup":`menu`,"aria-expanded":Ct,onClick:()=>{wt(e=>!e)},children:/* @__PURE__ */ (0,o.jsx)(a.IconProjectAddOutlineRegular,{size:16})})})}):/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:A(`workspace.addRemote`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{ref:St,type:`button`,className:Z.iconButton,"aria-label":A(`workspace.addRemote`),onClick:$t,children:/* @__PURE__ */ (0,o.jsx)(a.IconProjectAddOutlineRegular,{size:16})})}):Me&&/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:A(`workspace.add`),shortcutKeys:he?.keys,side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{ref:St,type:`button`,className:Z.iconButton,"aria-label":A(`workspace.add`),"aria-keyshortcuts":he?.aria,onClick:()=>{ce()},children:/* @__PURE__ */ (0,o.jsx)(a.IconProjectAddOutlineRegular,{size:e?16:18})})})]}),/* @__PURE__ */ (0,o.jsx)(dy,{t:A,open:xt,anchorRef:St,useWorkspaces:c,createWorkspace:S,useDirectoryFlow:te,renderDirectoryFlow:e=>de(`sidebar.workspaces.directoryFlow`,e),addOnly:!0,onBusyChange:le,side:`right`,onPick:e=>{D(),d(e)},onClose:()=>{D()}})]}),!e&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.search,children:/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:A(`search`),shortcutKeys:j?.keys,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.searchButton,"aria-label":A(`search.sessions.aria`),"aria-keyshortcuts":j?.aria,onClick:()=>{se()},children:/* @__PURE__ */ (0,o.jsx)(a.IconSearchOutlineRegular,{size:18})})})}),e&&At&>===``&&/* @__PURE__ */ (0,o.jsx)(Rv,{workspaces:Ye,state:Mt,onChange:Ot,t:A}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.listArea,children:[e&&M.phase===`pending`&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.empty,role:`status`,children:A(`sessions.loading`)}),e&&(gt===``?ot?/* @__PURE__ */ (0,o.jsx)(vv,{...Yt,projection:Xt,currentId:Zt,ready:M.phase===`ready`&&Be,animationResetKey:`activity/${Ht}`,singleRemoteHostScoped:Pt,onOpen:Re,onSessionRenameRequest:m,onMarkAllRead:Qt,onExit:()=>{st(!1)},renderSlot:de,t:A}):Ne===`flat`?/* @__PURE__ */ (0,o.jsx)(Ty,{...Yt,limit:mt,setLimit:ht,loadMoreSessions:ue,usePanelInfo:t,list:Vt,sessionIds:Lt,rowState:Ge,nativeSections:We,nativeThreadIds:ye,useMovingSectionSessions:oe,moveSessionToSection:w,finePointer:be&&Ae,manageThreadSection:je,onLeaveArchivedOnly:ze,workspaceReady:Be,animationResetKey:Ut,useSessionStatus:i,open:Re,onSessionRenameRequest:m,renderSlot:de,setSessionOrder:tt,sectionExpansion:I,setSectionExpanded:u.setSectionExpanded,revealSessionId:ct,onSessionRevealed:nn,hostScopeFiltered:Nt,singleRemoteHostScoped:Pt,onResetHostScope:kt,t:A}):/* @__PURE__ */ (0,o.jsx)(yy,{...Yt,sessionLimits:ut,setSessionLimits:dt,allWorkspacesShown:ft,setAllWorkspacesShown:pt,loadMoreSessions:ue,usePanelInfo:t,list:Vt,shortcuts:pe,useSessionStatus:i,onSessionRenameRequest:m,renderSlot:de,workspaces:Ft,allWorkspaces:Ye,linkedRoots:Xe,ungroupedSessionIds:Ze,canStartProjectless:Rt,workspaceReady:Be,nestWorkspaces:Ne===`workspace-tree`,animationResetKey:Ut,groupExpansion:F,setGroupExpanded:u.setGroupExpanded,sectionExpansion:I,setSectionExpanded:u.setSectionExpanded,setSessionOrder:tt,pinnedWorkspaceIds:P,setWorkspacePinned:b,rowState:Ge,nativeSections:We,nativeThreadIds:ye,useMovingSectionSessions:oe,moveSessionToSection:w,finePointer:be&&Ae,manageThreadSection:je,onLeaveArchivedOnly:ze,startSession:d,open:Re,insertWorkspaceBefore:v,moveWorkspaceToSection:y,revealSessionId:ct,onSessionRevealed:nn,hostScopeFiltered:Nt,singleRemoteHostScoped:Pt,onResetHostScope:kt,home:fe,t:A,onRenameRequest:(e,t)=>{cn({workspaceId:e,storedTitle:xe.find(t=>t.workspaceId===e)?.title??t}),un(t),_n(null)},onDeleteRequest:(e,t)=>{Tn({workspaceId:e,title:t}),jn(null)},onDefaultHarnessRequest:(e,t,n)=>{pn.current=n,fn({workspaceId:e,title:t})}}):/* @__PURE__ */ (0,o.jsx)(Ey,{...Yt,usePanelInfo:t,useSessions:r,useSessionStatus:i,open:tn,onUnarchive:Cn,workspaces:Te,archivedSessionIds:De,archivedFilter:Fe,query:gt,remote:_t,resultLimit:E,t:A}))]}),e&&/* @__PURE__ */ (0,o.jsx)(Ov,{list:M,refreshSessions:k,loadMoreSessions:ue,t:A}),dn&&/* @__PURE__ */ (0,o.jsx)(xv,{...dn,t:A,onClose:()=>fn(null)},dn.workspaceId),/* @__PURE__ */ (0,o.jsxs)(a.Modal,{open:sn!==null,onClose:xn,closeLabel:A(`close`),title:A(`rename.workspace.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:mn,onClick:xn,children:A(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,disabled:bn,onClick:Sn,children:A(`rename`)})]}),children:[/* @__PURE__ */ (0,o.jsx)(`input`,{className:Z.renameInput,value:ln,"aria-label":A(`field.workspaceName`),"data-modal-autofocus":!0,disabled:mn,onFocus:e=>{e.target.select()},onChange:e=>{un(e.target.value),_n(null)},onCompositionStart:()=>{en.current=!0},onCompositionEnd:()=>{en.current=!1},onKeyDown:e=>{e.key===`Enter`&&!en.current&&(e.preventDefault(),Sn())}}),yn&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:A(`conflict.named`,{name:vn})}),gn!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:gn})]}),/* @__PURE__ */ (0,o.jsxs)(a.Modal,{open:wn!==null,onClose:Mn,closeLabel:A(`close`),title:A(`delete.workspace`),...wn===null?{}:{description:A(Te.find(e=>e.workspaceId===wn.workspaceId)?.projectId?`delete.nativeProject`:`delete.desc`,{name:wn.title})},footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:En,onClick:Mn,children:A(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:Z.deleteAction,disabled:En,onClick:Nn,children:A(`delete.workspace`)})]}),children:[En&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.deleteStatus,role:`status`,children:A(`delete.pending`)}),An!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:An})]}),ge.forkError!==null&&/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:A(ge.forkError.reason===`unavailable`?`shortcut.noCompletedTurn`:`shortcut.forkFailed`),onDone:O},ge.forkError.seq)]})}function ky({sessionId:e,useArchived:t,useMenuOpenState:n,useShortcuts:r,archiveSession:i,unarchiveSession:s,t:c}){let[,l]=n(),u=r(e=>e.find(e=>e.id===`session.archive`)),d=t(t=>t.has(e));return/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{shortcut:d?void 0:u,icon:d?/* @__PURE__ */ (0,o.jsx)(a.IconUnarchiveOutlineRegular,{size:16}):/* @__PURE__ */ (0,o.jsx)(a.IconArchiveOutlineRegular,{size:16}),onSelect:()=>{l(!1),(d?s:i)(e)},children:c(d?`menu.unarchiveSession`:`menu.archiveSession`)})}function Ay({sessionId:e,useArchived:t,archiveSession:n,unarchiveSession:r,t:i}){let s=t(t=>t.has(e));return/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:i(s?`actions.unarchive`:`actions.archive`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:q.iconButton,"aria-label":i(s?`menu.unarchiveSession`:`menu.archiveSession`),onClick:()=>{(s?r:n)(e)},children:s?/* @__PURE__ */ (0,o.jsx)(a.IconUnarchiveOutlineRegular,{size:16}):/* @__PURE__ */ (0,o.jsx)(a.IconArchiveOutlineRegular,{size:16})})})}function jy({useArchiveRequest:e,settleSessionArchive:t,stopAndArchiveSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,o.jsx)(My,{request:i,stopAndArchiveSession:n,onSettle:t,t:r},i.sessionId)}function My({request:e,stopAndArchiveSession:t,onSettle:n,t:r}){let[i,c]=(0,s.useState)(!1),[l,u]=(0,s.useState)(null),d=()=>{i||n()};return/* @__PURE__ */ (0,o.jsxs)(a.Modal,{phoneSidebar:!0,open:!0,onClose:d,closeLabel:r(`close`),title:r(`archive.confirm.title`),description:r(`archive.confirm.desc`,{title:e.displayTitle}),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:i,onClick:d,children:r(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:Z.deleteAction,disabled:i,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:r(`archive.confirm.action`)})]}),children:[/* @__PURE__ */ (0,o.jsxs)(`ul`,{className:Z.archiveActivity,"aria-label":r(`archive.confirm.activity`),children:[e.runningThreads?.map(e=>/* @__PURE__ */ (0,o.jsx)(`li`,{children:r(`archive.confirm.thread`,{title:e.title})},e.id)),e.activity.map((e,t)=>/* @__PURE__ */ (0,o.jsx)(`li`,{children:Ny(e,r)},`${e.kind}-${String(t)}`))]}),i&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.deleteStatus,role:`status`,children:r(`archive.confirm.pending`)}),l!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:l})]})}function Ny(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 Py({useArchiveChildrenRequest:e,...t}){let n=e(e=>e);return n?/* @__PURE__ */ (0,o.jsx)(Fy,{request:n,...t},n.sessionId):null}function Fy({request:e,choose:t,dismiss:n,t:r}){return/* @__PURE__ */ (0,o.jsx)(a.Modal,{phoneSidebar:!0,open:!0,title:r(`archive.children.title`),description:r(`archive.children.description`,{title:e.title}),closeLabel:r(`close`),onClose:n,footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,onClick:()=>t(e,!1),children:r(`archive.children.parentOnly`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:Z.deleteAction,onClick:()=>t(e,!0),children:r(`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 Iy({sessionId:e,useSessions:t,useMenuOpenState:n,requestSessionDelete:r,t:i}){let[,s]=n();return t(t=>Up(t.byId[e]))?/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{danger:!0,separatorBefore:!0,icon:/* @__PURE__ */ (0,o.jsx)(a.IconTrashOutlineRegular,{size:16}),onSelect:()=>{s(!1),r(e)},children:i(`menu.deleteSession`)}):null}function Ly({useDeleteRequest:e,dismiss:t,deleteSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,o.jsx)(Ry,{request:i,dismiss:t,deleteSession:n,t:r},i.sessionId)}function Ry({request:e,dismiss:t,deleteSession:n,t:r}){let[i,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=()=>{i||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)(a.Modal,{phoneSidebar:!0,open:!0,onClose:p,closeLabel:r(`close`),title:r(d?`delete.session.children.title`:`delete.session.title`),description:d?r(`delete.session.children.description`,{title:e.title,n:e.children.length}):r(`delete.session.description`,{title:e.title}),footer:d?/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:i,onClick:()=>m(!1),children:r(`delete.session.children.parentOnly`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:Z.deleteAction,disabled:i,onClick:()=>m(!0),children:r(`delete.session.children.include`,{n:e.children.length})})]}):/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:i,onClick:p,children:r(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:Z.deleteAction,disabled:i,onClick:()=>m(!1),children:r(`delete.session.action`)})]}),children:[f&&/* @__PURE__ */ (0,o.jsx)(`p`,{className:Z.deleteStatus,children:r(`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))}),i&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.deleteStatus,role:`status`,children:r(`delete.session.pending`)}),l!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:l})]})}function zy(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 By(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(U_)??!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 Vy(e){let{sessionId:t,useMenuOpenState:n,requestMove:r,t:i}=e,[,s]=n(),{eligible:c,moving:l}=By(e);return c?/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{}),disabled:l,onSelect:()=>{l||(s(!1),r({sessionId:t}))},children:i(`menu.moveToSection`)}):null}function Hy(e){let{sessionId:t,useMenuOpenState:n,moveSession:r,t:i}=e,[,s]=n(),{eligible:c,moving:l}=By(e),u=e.useSectionWorkspace(e=>J_(t,e.threadSections)?.id);return!c||u===void 0?null:/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{}),disabled:l,onSelect:()=>{l||(s(!1),r({sessionId:t,sectionId:null}))},children:i(`menu.removeFromSection`)})}function Uy(e){return/* @__PURE__ */ (0,o.jsx)(Gy,{...e,direction:`up`})}function Wy(e){return/* @__PURE__ */ (0,o.jsx)(Gy,{...e,direction:`down`})}function Gy({direction:e,...t}){let{sessionId:n,useMenuOpenState:i,moveSession:s,t:c}=t,[,l]=i(),{eligible:u,moving:d,preciseMoves:f}=By(t),p=t.useSectionWorkspace(e=>J_(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,r.shallowEqual),_=t.useArchivedFilter(e=>e),v=t.useSectionSessions(t=>{if(!u||!f||!p)return null;let r=Y_(p,{byId:t.byId,pinnedSessionIds:m,archivedSessionIds:h,archivedFilter:_,visibleSessionIds:new Set(g??t.ids)});return ev(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)(a.MenuItemButton,{icon:e===`up`?/* @__PURE__ */ (0,o.jsx)(a.IconChevronUpOutlineRegular,{}):/* @__PURE__ */ (0,o.jsx)(a.IconChevronDownOutlineRegular,{}),disabled:y,onSelect:()=>{y||v===null||(l(!1),s(v))},children:c(e===`up`?`menu.moveSectionUp`:`menu.moveSectionDown`)})}function Ky({useThreadSectionMove:e,...t}){let n=e(e=>e);return n?/* @__PURE__ */ (0,o.jsx)(qy,{request:n,...t},n.sessionId):null}function qy({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(U_),p=J_(e.sessionId,f)?.id??``;return/* @__PURE__ */ (0,o.jsx)(Mv,{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 Jy({sessionId:e,useSessions:t,useMenuOpenState:n,useShortcuts:r,forkSession:i,t:s}){let c=t(t=>Hp(t.byId[e])),[,l]=n(),u=r(e=>e.find(e=>e.id===`session.fork`));return c?/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{shortcut:u,icon:/* @__PURE__ */ (0,o.jsx)(a.IconBranchOutlineRegular,{}),onSelect:()=>{l(!1),i(e)},children:s(`menu.fork`)}):null}function Yy({sessionId:e,useMenuOpenState:t,useSessions:n,useSessionStatus:r,useArchived:i,markCompletionUnread:s,t:c}){let[,l]=t(),u=n(e=>e),d=u.byId[e],f=r(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}=Sm(d,u,t);return!r&&i===0}),p=i(t=>t.has(e));return!f||p?null:/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(a.IconBellOutlineRegular,{}),onSelect:()=>{l(!1),s(e)},children:c(`menu.markAsUnread`)})}function Xy({markChildThreadsRead:e,useMenuOpenState:t,t:n}){let[,r]=t();return e===void 0?null:/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(a.IconCheckCircleOutlineRegular,{}),onSelect:()=>{r(!1),e()},children:n(`menu.markChildrenAsRead`)})}function Zy({sessionId:e,useSessions:t,useMenuOpenState:n,copySessionLink:r,t:i}){let s=t(t=>{let n=t.byId[e];return n!==void 0&&rm(n)!==void 0}),[,c]=n();return s?/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(a.IconCopyOutlineRegular,{}),onSelect:()=>{c(!1),r(e)},children:i(`menu.copySessionLink`)}):null}function Qy({sessionId:e,usePinned:t,useArchived:n,useSessions:r}){return{pinned:t(t=>t.has(e)),archived:n(t=>t.has(e)),supported:r(t=>Vp(t.byId[e]))}}function $y(e){let{sessionId:t,useMenuOpenState:n,pinSession:r,unpinSession:i,t:s}=e,[,c]=n(),{pinned:l,archived:u,supported:d}=Qy(e);return u||!d?null:/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{icon:l?/* @__PURE__ */ (0,o.jsx)(a.IconPinFillRegular,{}):/* @__PURE__ */ (0,o.jsx)(a.IconPinOutlineRegular,{}),onSelect:()=>{c(!1),(l?i:r)(t)},children:s(l?`menu.unpinSession`:`menu.pinSession`)})}function eb(e){let{sessionId:t,pinSession:n,unpinSession:r,t:i}=e,{pinned:s,archived:c,supported:l}=Qy(e);return c||!l?null:/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:i(s?`actions.unpin`:`actions.pin`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:q.iconButton,"aria-label":i(s?`menu.unpinSession`:`menu.pinSession`),onClick:()=>{(s?r:n)(t)},children:s?/* @__PURE__ */ (0,o.jsx)(a.IconPinFillRegular,{size:16}):/* @__PURE__ */ (0,o.jsx)(a.IconPinOutlineRegular,{size:16})})})}function tb({sessionId:e,displayTitle:t,useMenuOpenState:n,useShortcuts:r,requestSessionRename:i,t:s}){let[,c]=n(),l=r(e=>e.find(e=>e.id===`session.rename`));return/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{shortcut:l,icon:/* @__PURE__ */ (0,o.jsx)(a.IconEditOutlineRegular,{}),onSelect:()=>{c(!1),i(e,t)},children:s(`rename`)})}function nb({useRenameRequest:e,settleSessionRename:t,renameSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,o.jsx)(rb,{request:i,renameSession:n,onSettle:t,t:r},i.sessionId)}function rb({request:e,renameSession:t,onSettle:n,t:r}){let[i,c]=(0,s.useState)(e.currentTitle),[l,u]=(0,s.useState)(!1),[d,f]=(0,s.useState)(null),p=(0,s.useRef)(!1),m=i.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)(a.Modal,{phoneSidebar:!0,open:!0,onClose:g,closeLabel:r(`close`),title:r(`rename.session.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:l,onClick:g,children:r(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,disabled:h,onClick:_,children:r(`rename`)})]}),children:[/* @__PURE__ */ (0,o.jsx)(`input`,{className:Z.renameInput,value:i,"aria-label":r(`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 ib=6e3;function ab({useToast:e,useStore:t,dismissToast:n,undoArchive:r,showArchived:i,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)(a.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)(a.IconWarningOutlineRegular,{})}:{tone:`success`},holdMs:ib,actions:[{label:s(`toast.archivedUndo`),onClick:()=>{n(),r(e)}},...l?[]:[{prefix:s(`toast.archivedOr`),label:s(`toast.archivedFilter`),onClick:()=>{n(),i()}}]],onDone:n},`toast-${String(c.seq)}`)}return c.kind===`deleted`?/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:c.failedChildren?s(`delete.session.children.partial`,{n:c.failedChildren}):s(`toast.deleted`),...c.failedChildren?{icon:/* @__PURE__ */ (0,o.jsx)(a.IconWarningOutlineRegular,{}),holdMs:ib}:{tone:`success`},onDone:n},`toast-${String(c.seq)}`):c.kind===`createFailed`||c.kind===`forkFailed`?/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:s(c.kind===`forkFailed`?`toast.forkFailed`:`toast.createFailed`,{message:c.message}),icon:/* @__PURE__ */ (0,o.jsx)(a.IconWarningOutlineRegular,{}),holdMs:ib,onDone:n},`toast-${String(c.seq)}`):/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:ob(c,s),icon:/* @__PURE__ */ (0,o.jsx)(a.IconWarningOutlineRegular,{}),onDone:n},`toast-${String(c.seq)}`)}function ob(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`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
|
+
En||wn===null||(Dn(!0),kn(null),jn(null),_(wn.workspaceId).then(()=>{kn(wn.workspaceId)}).catch(e=>{Dn(!1),jn(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,it&&Z.sectionLabelHidden),children:A(`section.sessions`)}),e&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:X(Z.activitySlot,it&&Z.activitySlotHidden),children:/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:A(`activityView.label`),shortcutKeys:me?.keys,side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:X(Z.iconButton,Z.wide,Z.activityButton,ot&&Z.activityButtonActive),"aria-label":A(`activityView.label`),"aria-pressed":ot,"aria-keyshortcuts":me?.aria,onClick:()=>{D(),st(e=>!e)},children:/* @__PURE__ */ (0,o.jsxs)(`span`,{className:Z.activityIconWrap,children:[/* @__PURE__ */ (0,o.jsx)(yv,{size:16}),!ot&&Xt.hasAttention&&/* @__PURE__ */ (0,o.jsx)(`span`,{className:Z.activityDot,"data-attention":Xt.pendingCount>0?`pending`:`unread`,"aria-hidden":`true`})]})})})}),e&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:X(Z.searchSlot,it&&Z.searchSlotExpanded),children:/* @__PURE__ */ (0,o.jsxs)(`div`,{ref:yt,className:X(Z.search,it&&Z.searchExpanded),onClick:()=>{D(),at(!0),bt.current?.focus()},children:[/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:A(`search`),shortcutKeys:j?.keys,side:`bottom`,delayMs:500,disabled:it,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.searchButton,"aria-label":A(`search.sessions.aria`),"aria-keyshortcuts":j?.aria,"aria-expanded":it,onClick:()=>{se()},children:/* @__PURE__ */ (0,o.jsx)(a.IconSearchOutlineRegular,{size:16})})}),/* @__PURE__ */ (0,o.jsx)(`input`,{ref:bt,className:Z.searchInput,type:`text`,placeholder:A(`search.placeholder`),maxLength:500,value:nt,tabIndex:it?0:-1,onChange:e=>{rt(hy(e.target.value))},onKeyDown:e=>{e.key===`Escape`&&(e.currentTarget.closest(`[data-phone-drawer]`)&&(e.preventDefault(),e.stopPropagation()),rt(``),at(!1))}}),it&&/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.clearButton,"aria-label":A(`search.clear`),onClick:e=>{e.stopPropagation(),rt(``),at(!1)},children:/* @__PURE__ */ (0,o.jsx)(a.IconCloseFillRegular,{})})]})}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:X(Z.headerActions,e&&it&&Z.headerActionsHidden),children:[e&&je&&/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:A(`section.create.title`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:X(Z.iconButton,Z.wide),"aria-label":A(`section.create.title`),onClick:()=>je({mode:`create`}),children:/* @__PURE__ */ (0,o.jsx)(a.IconPlusOutlineRegular,{size:16})})}),e&&/* @__PURE__ */ (0,o.jsx)(_y,{groupBy:Ne,orderBy:Pe,archivedFilter:Fe,onGroupPick:u.setGroupBy,onOrderPick:e=>{u.setOrderBy(e,et,$e)},onArchivedFilterPick:e=>{e===`only`&&st(!1),u.setArchivedFilter(e)},t:A}),e&&jt?Me?/* @__PURE__ */ (0,o.jsx)(a.Menu,{phoneSidebarTitle:A(`workspace.add`),open:Ct,onClose:()=>{wt(!1)},items:[{id:`add-local`,label:A(`workspace.addLocal`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{})},{id:`add-remote`,label:A(`workspace.addRemote`),icon:/* @__PURE__ */ (0,o.jsx)(a.IconGlobeOutlineRegular,{})}],onSelect:e=>{wt(!1),e===`add-local`?ce():e===`add-remote`&&$t()},align:`end`,dense:!0,portal:!0,anchor:/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:A(`workspace.add`),shortcutKeys:he?.keys,side:`bottom`,delayMs:500,disabled:Ct,children:/* @__PURE__ */ (0,o.jsx)(`button`,{ref:St,type:`button`,className:Z.iconButton,"aria-label":A(`workspace.add`),"aria-keyshortcuts":he?.aria,"aria-haspopup":`menu`,"aria-expanded":Ct,onClick:()=>{wt(e=>!e)},children:/* @__PURE__ */ (0,o.jsx)(a.IconProjectAddOutlineRegular,{size:16})})})}):/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:A(`workspace.addRemote`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{ref:St,type:`button`,className:Z.iconButton,"aria-label":A(`workspace.addRemote`),onClick:$t,children:/* @__PURE__ */ (0,o.jsx)(a.IconProjectAddOutlineRegular,{size:16})})}):Me&&/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:A(`workspace.add`),shortcutKeys:he?.keys,side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{ref:St,type:`button`,className:Z.iconButton,"aria-label":A(`workspace.add`),"aria-keyshortcuts":he?.aria,onClick:()=>{ce()},children:/* @__PURE__ */ (0,o.jsx)(a.IconProjectAddOutlineRegular,{size:e?16:18})})})]}),/* @__PURE__ */ (0,o.jsx)(py,{t:A,open:xt,anchorRef:St,useWorkspaces:c,createWorkspace:S,useDirectoryFlow:te,renderDirectoryFlow:e=>de(`sidebar.workspaces.directoryFlow`,e),addOnly:!0,onBusyChange:le,side:`right`,onPick:e=>{D(),d(e)},onClose:()=>{D()}})]}),!e&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.search,children:/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:A(`search`),shortcutKeys:j?.keys,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:Z.searchButton,"aria-label":A(`search.sessions.aria`),"aria-keyshortcuts":j?.aria,onClick:()=>{se()},children:/* @__PURE__ */ (0,o.jsx)(a.IconSearchOutlineRegular,{size:18})})})}),e&&At&>===``&&/* @__PURE__ */ (0,o.jsx)(Bv,{workspaces:Ye,state:Mt,onChange:Ot,t:A}),/* @__PURE__ */ (0,o.jsxs)(`div`,{className:Z.listArea,children:[e&&M.phase===`pending`&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.empty,role:`status`,children:A(`sessions.loading`)}),e&&(gt===``?ot?/* @__PURE__ */ (0,o.jsx)(bv,{...Yt,projection:Xt,currentId:Zt,ready:M.phase===`ready`&&Be,animationResetKey:`activity/${Ht}`,singleRemoteHostScoped:Pt,onOpen:Re,onSessionRenameRequest:m,onMarkAllRead:Qt,onExit:()=>{st(!1)},renderSlot:de,t:A}):Ne===`flat`?/* @__PURE__ */ (0,o.jsx)(Dy,{...Yt,limit:mt,setLimit:ht,loadMoreSessions:ue,usePanelInfo:t,list:Vt,sessionIds:Lt,rowState:Ge,nativeSections:We,nativeThreadIds:ye,useMovingSectionSessions:oe,moveSessionToSection:w,finePointer:be&&Ae,manageThreadSection:je,onLeaveArchivedOnly:ze,workspaceReady:Be,animationResetKey:Ut,useSessionStatus:i,open:Re,onSessionRenameRequest:m,renderSlot:de,setSessionOrder:tt,sectionExpansion:I,setSectionExpanded:u.setSectionExpanded,revealSessionId:ct,onSessionRevealed:nn,hostScopeFiltered:Nt,singleRemoteHostScoped:Pt,onResetHostScope:kt,t:A}):/* @__PURE__ */ (0,o.jsx)(xy,{...Yt,sessionLimits:ut,setSessionLimits:dt,allWorkspacesShown:ft,setAllWorkspacesShown:pt,loadMoreSessions:ue,usePanelInfo:t,list:Vt,shortcuts:pe,useSessionStatus:i,onSessionRenameRequest:m,renderSlot:de,workspaces:Ft,allWorkspaces:Ye,linkedRoots:Xe,ungroupedSessionIds:Ze,canStartProjectless:Rt,workspaceReady:Be,nestWorkspaces:Ne===`workspace-tree`,animationResetKey:Ut,groupExpansion:F,setGroupExpanded:u.setGroupExpanded,sectionExpansion:I,setSectionExpanded:u.setSectionExpanded,setSessionOrder:tt,pinnedWorkspaceIds:P,setWorkspacePinned:b,rowState:Ge,nativeSections:We,nativeThreadIds:ye,useMovingSectionSessions:oe,moveSessionToSection:w,finePointer:be&&Ae,manageThreadSection:je,onLeaveArchivedOnly:ze,startSession:d,open:Re,insertWorkspaceBefore:v,moveWorkspaceToSection:y,revealSessionId:ct,onSessionRevealed:nn,hostScopeFiltered:Nt,singleRemoteHostScoped:Pt,onResetHostScope:kt,home:fe,t:A,onRenameRequest:(e,t)=>{cn({workspaceId:e,storedTitle:xe.find(t=>t.workspaceId===e)?.title??t}),un(t),_n(null)},onDeleteRequest:(e,t)=>{Tn({workspaceId:e,title:t}),jn(null)},onDefaultHarnessRequest:(e,t,n)=>{pn.current=n,fn({workspaceId:e,title:t})}}):/* @__PURE__ */ (0,o.jsx)(Oy,{...Yt,usePanelInfo:t,useSessions:r,useSessionStatus:i,open:tn,onUnarchive:Cn,workspaces:Te,archivedSessionIds:De,archivedFilter:Fe,query:gt,remote:_t,resultLimit:E,t:A}))]}),e&&/* @__PURE__ */ (0,o.jsx)(Av,{list:M,refreshSessions:k,loadMoreSessions:ue,t:A}),dn&&/* @__PURE__ */ (0,o.jsx)(Cv,{...dn,t:A,onClose:()=>fn(null)},dn.workspaceId),/* @__PURE__ */ (0,o.jsxs)(a.Modal,{open:sn!==null,onClose:xn,closeLabel:A(`close`),title:A(`rename.workspace.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:mn,onClick:xn,children:A(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,disabled:bn,onClick:Sn,children:A(`rename`)})]}),children:[/* @__PURE__ */ (0,o.jsx)(`input`,{className:Z.renameInput,value:ln,"aria-label":A(`field.workspaceName`),"data-modal-autofocus":!0,disabled:mn,onFocus:e=>{e.target.select()},onChange:e=>{un(e.target.value),_n(null)},onCompositionStart:()=>{en.current=!0},onCompositionEnd:()=>{en.current=!1},onKeyDown:e=>{e.key===`Enter`&&!en.current&&(e.preventDefault(),Sn())}}),yn&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:A(`conflict.named`,{name:vn})}),gn!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:gn})]}),/* @__PURE__ */ (0,o.jsxs)(a.Modal,{open:wn!==null,onClose:Mn,closeLabel:A(`close`),title:A(`delete.workspace`),...wn===null?{}:{description:A(Te.find(e=>e.workspaceId===wn.workspaceId)?.projectId?`delete.nativeProject`:`delete.desc`,{name:wn.title})},footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:En,onClick:Mn,children:A(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:Z.deleteAction,disabled:En,onClick:Nn,children:A(`delete.workspace`)})]}),children:[En&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.deleteStatus,role:`status`,children:A(`delete.pending`)}),An!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:An})]}),ge.forkError!==null&&/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:A(ge.forkError.reason===`unavailable`?`shortcut.noCompletedTurn`:`shortcut.forkFailed`),onDone:O},ge.forkError.seq)]})}function jy({sessionId:e,useArchived:t,useMenuOpenState:n,useShortcuts:r,archiveSession:i,unarchiveSession:s,t:c}){let[,l]=n(),u=r(e=>e.find(e=>e.id===`session.archive`)),d=t(t=>t.has(e));return/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{shortcut:d?void 0:u,icon:d?/* @__PURE__ */ (0,o.jsx)(a.IconUnarchiveOutlineRegular,{size:16}):/* @__PURE__ */ (0,o.jsx)(a.IconArchiveOutlineRegular,{size:16}),onSelect:()=>{l(!1),(d?s:i)(e)},children:c(d?`menu.unarchiveSession`:`menu.archiveSession`)})}function My({sessionId:e,useArchived:t,archiveSession:n,unarchiveSession:r,t:i}){let s=t(t=>t.has(e));return/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:i(s?`actions.unarchive`:`actions.archive`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:q.iconButton,"aria-label":i(s?`menu.unarchiveSession`:`menu.archiveSession`),onClick:()=>{(s?r:n)(e)},children:s?/* @__PURE__ */ (0,o.jsx)(a.IconUnarchiveOutlineRegular,{size:16}):/* @__PURE__ */ (0,o.jsx)(a.IconArchiveOutlineRegular,{size:16})})})}function Ny({useArchiveRequest:e,settleSessionArchive:t,stopAndArchiveSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,o.jsx)(Py,{request:i,stopAndArchiveSession:n,onSettle:t,t:r},i.sessionId)}function Py({request:e,stopAndArchiveSession:t,onSettle:n,t:r}){let[i,c]=(0,s.useState)(!1),[l,u]=(0,s.useState)(null),d=()=>{i||n()};return/* @__PURE__ */ (0,o.jsxs)(a.Modal,{phoneSidebar:!0,open:!0,onClose:d,closeLabel:r(`close`),title:r(`archive.confirm.title`),description:r(`archive.confirm.desc`,{title:e.displayTitle}),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:i,onClick:d,children:r(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:Z.deleteAction,disabled:i,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:r(`archive.confirm.action`)})]}),children:[/* @__PURE__ */ (0,o.jsxs)(`ul`,{className:Z.archiveActivity,"aria-label":r(`archive.confirm.activity`),children:[e.runningThreads?.map(e=>/* @__PURE__ */ (0,o.jsx)(`li`,{children:r(`archive.confirm.thread`,{title:e.title})},e.id)),e.activity.map((e,t)=>/* @__PURE__ */ (0,o.jsx)(`li`,{children:Fy(e,r)},`${e.kind}-${String(t)}`))]}),i&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.deleteStatus,role:`status`,children:r(`archive.confirm.pending`)}),l!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:l})]})}function Fy(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 Iy({useArchiveChildrenRequest:e,...t}){let n=e(e=>e);return n?/* @__PURE__ */ (0,o.jsx)(Ly,{request:n,...t},n.sessionId):null}function Ly({request:e,choose:t,dismiss:n,t:r}){return/* @__PURE__ */ (0,o.jsx)(a.Modal,{phoneSidebar:!0,open:!0,title:r(`archive.children.title`),description:r(`archive.children.description`,{title:e.title}),closeLabel:r(`close`),onClose:n,footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,onClick:()=>t(e,!1),children:r(`archive.children.parentOnly`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:Z.deleteAction,onClick:()=>t(e,!0),children:r(`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 Ry({sessionId:e,useSessions:t,useMenuOpenState:n,requestSessionDelete:r,t:i}){let[,s]=n();return t(t=>Gp(t.byId[e]))?/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{danger:!0,separatorBefore:!0,icon:/* @__PURE__ */ (0,o.jsx)(a.IconTrashOutlineRegular,{size:16}),onSelect:()=>{s(!1),r(e)},children:i(`menu.deleteSession`)}):null}function zy({useDeleteRequest:e,dismiss:t,deleteSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,o.jsx)(By,{request:i,dismiss:t,deleteSession:n,t:r},i.sessionId)}function By({request:e,dismiss:t,deleteSession:n,t:r}){let[i,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=()=>{i||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)(a.Modal,{phoneSidebar:!0,open:!0,onClose:p,closeLabel:r(`close`),title:r(d?`delete.session.children.title`:`delete.session.title`),description:d?r(`delete.session.children.description`,{title:e.title,n:e.children.length}):r(`delete.session.description`,{title:e.title}),footer:d?/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:i,onClick:()=>m(!1),children:r(`delete.session.children.parentOnly`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:Z.deleteAction,disabled:i,onClick:()=>m(!0),children:r(`delete.session.children.include`,{n:e.children.length})})]}):/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:i,onClick:p,children:r(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,className:Z.deleteAction,disabled:i,onClick:()=>m(!1),children:r(`delete.session.action`)})]}),children:[f&&/* @__PURE__ */ (0,o.jsx)(`p`,{className:Z.deleteStatus,children:r(`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))}),i&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.deleteStatus,role:`status`,children:r(`delete.session.pending`)}),l!==null&&/* @__PURE__ */ (0,o.jsx)(`div`,{className:Z.renameError,role:`alert`,children:l})]})}function Vy(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 Hy(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(G_)??!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 Uy(e){let{sessionId:t,useMenuOpenState:n,requestMove:r,t:i}=e,[,s]=n(),{eligible:c,moving:l}=Hy(e);return c?/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{}),disabled:l,onSelect:()=>{l||(s(!1),r({sessionId:t}))},children:i(`menu.moveToSection`)}):null}function Wy(e){let{sessionId:t,useMenuOpenState:n,moveSession:r,t:i}=e,[,s]=n(),{eligible:c,moving:l}=Hy(e),u=e.useSectionWorkspace(e=>X_(t,e.threadSections)?.id);return!c||u===void 0?null:/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(a.IconFolderCloseRegular,{}),disabled:l,onSelect:()=>{l||(s(!1),r({sessionId:t,sectionId:null}))},children:i(`menu.removeFromSection`)})}function Gy(e){return/* @__PURE__ */ (0,o.jsx)(qy,{...e,direction:`up`})}function Ky(e){return/* @__PURE__ */ (0,o.jsx)(qy,{...e,direction:`down`})}function qy({direction:e,...t}){let{sessionId:n,useMenuOpenState:i,moveSession:s,t:c}=t,[,l]=i(),{eligible:u,moving:d,preciseMoves:f}=Hy(t),p=t.useSectionWorkspace(e=>X_(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,r.shallowEqual),_=t.useArchivedFilter(e=>e),v=t.useSectionSessions(t=>{if(!u||!f||!p)return null;let r=Z_(p,{byId:t.byId,pinnedSessionIds:m,archivedSessionIds:h,archivedFilter:_,visibleSessionIds:new Set(g??t.ids)});return nv(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)(a.MenuItemButton,{icon:e===`up`?/* @__PURE__ */ (0,o.jsx)(a.IconChevronUpOutlineRegular,{}):/* @__PURE__ */ (0,o.jsx)(a.IconChevronDownOutlineRegular,{}),disabled:y,onSelect:()=>{y||v===null||(l(!1),s(v))},children:c(e===`up`?`menu.moveSectionUp`:`menu.moveSectionDown`)})}function Jy({useThreadSectionMove:e,...t}){let n=e(e=>e);return n?/* @__PURE__ */ (0,o.jsx)(Yy,{request:n,...t},n.sessionId):null}function Yy({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(G_),p=X_(e.sessionId,f)?.id??``;return/* @__PURE__ */ (0,o.jsx)(Pv,{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 Xy({sessionId:e,useSessions:t,useMenuOpenState:n,useShortcuts:r,forkSession:i,t:s}){let c=t(t=>Wp(t.byId[e])),[,l]=n(),u=r(e=>e.find(e=>e.id===`session.fork`));return c?/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{shortcut:u,icon:/* @__PURE__ */ (0,o.jsx)(a.IconBranchOutlineRegular,{}),onSelect:()=>{l(!1),i(e)},children:s(`menu.fork`)}):null}function Zy({sessionId:e,useMenuOpenState:t,useSessions:n,useSessionStatus:r,useArchived:i,markCompletionUnread:s,t:c}){let[,l]=t(),u=n(e=>e),d=u.byId[e],f=r(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}=wm(d,u,t);return!r&&i===0}),p=i(t=>t.has(e));return!f||p?null:/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(a.IconBellOutlineRegular,{}),onSelect:()=>{l(!1),s(e)},children:c(`menu.markAsUnread`)})}function Qy({markChildThreadsRead:e,useMenuOpenState:t,t:n}){let[,r]=t();return e===void 0?null:/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(a.IconCheckCircleOutlineRegular,{}),onSelect:()=>{r(!1),e()},children:n(`menu.markChildrenAsRead`)})}function $y({sessionId:e,useSessions:t,useMenuOpenState:n,copySessionLink:r,t:i}){let s=t(t=>{let n=t.byId[e];return n!==void 0&&am(n)!==void 0}),[,c]=n();return s?/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(a.IconCopyOutlineRegular,{}),onSelect:()=>{c(!1),r(e)},children:i(`menu.copySessionLink`)}):null}function eb({sessionId:e,usePinned:t,useArchived:n,useSessions:r}){return{pinned:t(t=>t.has(e)),archived:n(t=>t.has(e)),supported:r(t=>Up(t.byId[e]))}}function tb(e){let{sessionId:t,useMenuOpenState:n,pinSession:r,unpinSession:i,t:s}=e,[,c]=n(),{pinned:l,archived:u,supported:d}=eb(e);return u||!d?null:/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{icon:l?/* @__PURE__ */ (0,o.jsx)(a.IconPinFillRegular,{}):/* @__PURE__ */ (0,o.jsx)(a.IconPinOutlineRegular,{}),onSelect:()=>{c(!1),(l?i:r)(t)},children:s(l?`menu.unpinSession`:`menu.pinSession`)})}function nb(e){let{sessionId:t,pinSession:n,unpinSession:r,t:i}=e,{pinned:s,archived:c,supported:l}=eb(e);return c||!l?null:/* @__PURE__ */ (0,o.jsx)(a.Tooltip,{label:i(s?`actions.unpin`:`actions.pin`),side:`bottom`,align:`end`,delayMs:500,children:/* @__PURE__ */ (0,o.jsx)(`button`,{type:`button`,className:q.iconButton,"aria-label":i(s?`menu.unpinSession`:`menu.pinSession`),onClick:()=>{(s?r:n)(t)},children:s?/* @__PURE__ */ (0,o.jsx)(a.IconPinFillRegular,{size:16}):/* @__PURE__ */ (0,o.jsx)(a.IconPinOutlineRegular,{size:16})})})}function rb({sessionId:e,displayTitle:t,useMenuOpenState:n,useShortcuts:r,requestSessionRename:i,t:s}){let[,c]=n(),l=r(e=>e.find(e=>e.id===`session.rename`));return/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{shortcut:l,icon:/* @__PURE__ */ (0,o.jsx)(a.IconEditOutlineRegular,{}),onSelect:()=>{c(!1),i(e,t)},children:s(`rename`)})}function ib({useRenameRequest:e,settleSessionRename:t,renameSession:n,t:r}){let i=e(e=>e);return i===null?null:/* @__PURE__ */ (0,o.jsx)(ab,{request:i,renameSession:n,onSettle:t,t:r},i.sessionId)}function ab({request:e,renameSession:t,onSettle:n,t:r}){let[i,c]=(0,s.useState)(e.currentTitle),[l,u]=(0,s.useState)(!1),[d,f]=(0,s.useState)(null),p=(0,s.useRef)(!1),m=i.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)(a.Modal,{phoneSidebar:!0,open:!0,onClose:g,closeLabel:r(`close`),title:r(`rename.session.title`),footer:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`outline`,disabled:l,onClick:g,children:r(`cancel`)}),/* @__PURE__ */ (0,o.jsx)(a.Button,{variant:`primary`,disabled:h,onClick:_,children:r(`rename`)})]}),children:[/* @__PURE__ */ (0,o.jsx)(`input`,{className:Z.renameInput,value:i,"aria-label":r(`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 ob=6e3;function sb({useToast:e,useStore:t,dismissToast:n,undoArchive:r,showArchived:i,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)(a.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)(a.IconWarningOutlineRegular,{})}:{tone:`success`},holdMs:ob,actions:[{label:s(`toast.archivedUndo`),onClick:()=>{n(),r(e)}},...l?[]:[{prefix:s(`toast.archivedOr`),label:s(`toast.archivedFilter`),onClick:()=>{n(),i()}}]],onDone:n},`toast-${String(c.seq)}`)}return c.kind===`deleted`?/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:c.failedChildren?s(`delete.session.children.partial`,{n:c.failedChildren}):s(`toast.deleted`),...c.failedChildren?{icon:/* @__PURE__ */ (0,o.jsx)(a.IconWarningOutlineRegular,{}),holdMs:ob}:{tone:`success`},onDone:n},`toast-${String(c.seq)}`):c.kind===`createFailed`||c.kind===`forkFailed`?/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:s(c.kind===`forkFailed`?`toast.forkFailed`:`toast.createFailed`,{message:c.message}),icon:/* @__PURE__ */ (0,o.jsx)(a.IconWarningOutlineRegular,{}),holdMs:ob,onDone:n},`toast-${String(c.seq)}`):/* @__PURE__ */ (0,o.jsx)(a.Toast,{text:cb(c,s),icon:/* @__PURE__ */ (0,o.jsx)(a.IconWarningOutlineRegular,{}),onDone:n},`toast-${String(c.seq)}`)}function cb(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`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 Qp(e)}}let sb={"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.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}前`},cb={"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.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 lb(e,t,n=!1){let r=/* @__PURE__ */ new Map;for(let t of Object.values(e.byId)){if(n&&!ub(t))continue;let i=wm(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 ub(e){return e!==void 0&&!e.blank&&e.origin!==`subagent`&&e.projectionValues?.threadTreeParent!==void 0}function db(e,t,n){let r=[];for(let i of lb(e,t,!0)){let t=qp(i),a=e.byId[t];!n.has(t)&&a&&r.push({id:t,title:a.displayTitle})}return r}function fb(e,t){let n=/* @__PURE__ */ new Map;for(let t of Object.values(e.byId)){let r=wm(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 pb(e,t,n=lb(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[qp(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 mb=()=>!1,hb=()=>()=>{};function gb(e){let t=(0,a.usePhoneSidebar)();return t!==null&&!t.open?null:/* @__PURE__ */ (0,o.jsx)(_b,{...e,closeDrawer:t?.close},e.sessionId)}function _b({sessionId:e,prepareDraftReference:t,closeDrawer:n,useMenuOpenState:r,t:i}){let[c]=(0,s.useState)(()=>t(e)),l=(0,s.useSyncExternalStore)(c?.subscribe??hb,c?.getSnapshot??mb),u=(0,s.useRef)(!1),[d,f]=(0,s.useState)(!1),[,p]=r();return c===void 0?null:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(a.IconLinkOutlineRegular,{}),disabled:d||!l,onSelect:()=>{if(!u.current){u.current=!0;try{if(c?.insert()===!0){p(!1),n?.();return}}catch{}f(!0)}},children:i(`menu.referenceSession`)}),d&&/* @__PURE__ */ (0,o.jsx)(`div`,{role:`status`,children:i(`menu.referenceSessionFailed`)})]})}let vb=`workspace`,yb=[`slots`,`sessions`,`uiSession`,`workspaces`,`locale`,`remote`,`remote.directoryPicker`,`layout`,`shortcuts`,`configForms`];function bb(e){let t=e.get(`sessions`),n=e.get(`workspaces`),i=Rm(),a=i.create();a.actions.setArchivedFilter(`default`),e.effect(()=>{let e=()=>{t.setIncludeArchived((a.getSnapshot().archivedFilter??`default`)!=="default")},n=a.subscribe(e);return e(),n},`ui-workspace: browser-local archive query scope`);let o={...i,create:()=>a},s=(0,r.createSnapshotStore)(null),c=0,u=e=>{s.set({...e,seq:++c})},d=new nh(e,e.remote.directoryPicker,n,t,a.actions,u),f=yg(e);lg(e,d,f),e.slots.provideRoot({hooks:{workspaces:n.list}}),e.effect(()=>e.locale.register(vb,{zh:sb,en:cb}),`ui-workspace: dictionaries`);let p=Wp(),m=async(e,n)=>{let r=await t.search(e,n);if(!r.ok)throw Error(r.error.message);return r.value},h=t=>({getSnapshot:()=>e.slots.entries(t).length>0,subscribe:n=>e.slots.subscribe(t,n)}),g=h(`sidebar.workspaces.directoryFlow`),_={getSnapshot:()=>e.remote.$host,subscribe:t=>e.on(`connection/reset`,t)},v=h(`conversation.hero.workspace.directoryFlow`),y=e=>{d.openSession(e)},b=zy(n.list,e=>new Set(e.pinnedSessionIds)),x=zy(n.list,e=>new Set(e.archivedSessionIds)),S=zy(p.state,e=>e.renameTarget),C=(0,r.createSnapshotStore)(null),w=(0,r.createSnapshotStore)(null),T=(0,r.createSnapshotStore)(null),ee=p.rename,E=e=>{d.unarchiveSession(e).catch(e=>{u({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=zy(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,r.createSnapshotStore)(null),ie=(0,r.createSnapshotStore)(null),ae=zy(a,e=>e.archivedFilter??`default`),oe=tv({execute:(e,t,r,i)=>n.moveSessionToSection?n.moveSessionToSection(e,t,r,i):Promise.reject(/* @__PURE__ */ Error(`Section moves are unavailable`)),onError:e=>{u({kind:`sectionMoveFailed`,message:e instanceof Error?e.message:String(e)})},onUnknown:()=>u({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)}),ce=()=>({hooks:{threadSectionMove:re,sectionWorkspace:n.list,movingSectionSessions:oe.movingSessionIds},dismiss:()=>re.set(null),move:e=>oe.move(e,{notifyOnError:!1})}),D=(0,r.createSnapshotStore)(null),le=()=>({hooks:{threadSectionManage:D},dismiss:()=>D.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:()=>u({kind:`sectionSyncPending`})}),O=()=>({hooks:{pinned:b,archived:x},pinSession:e=>{d.pinSession(e).catch(e=>{u({kind:`pinFailed`,message:e instanceof Error?e.message:String(e)})})},unpinSession:e=>{d.unpinSession(e).catch(e=>{u({kind:`unpinFailed`,message:e instanceof Error?e.message:String(e)})})}}),k=async(e,r,i=!1)=>{await d.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||pb(n,e,[]).length)throw Error(`Child Session is active`);await d.archiveSession(e)}catch{a++}u({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=pb(r,e,[]);i?.running||o.length>0?C.set({sessionId:e,displayTitle:a,children:n,activity:o.length?[{kind:`subagent`,items:o}]:[],...i?.running?{runningThreads:[{id:e,title:a}]}:{}}):k(e,n).catch(t=>{let r=xb(t);r===void 0?u({kind:`archiveFailed`,message:t instanceof Error?t.message:String(t)}):C.set({sessionId:e,displayTitle:a,activity:r,children:n})})},de=()=>({hooks:{archived:x},archiveSession:e=>{let n=t.list.getSnapshot(),r=db(n,e,x.getSnapshot());r.length?w.set({sessionId:e,title:n.byId[e]?.displayTitle??e,children:r}):ue(e,[])},unarchiveSession:E});Gp(e,d,p,de().archiveSession);let A=()=>({hooks:{archiveChildrenRequest:w},dismiss:()=>w.set(null),choose(e,t){w.getSnapshot()===e&&(w.set(null),ue(e.sessionId,t?e.children.map(({id:e})=>e):[]))}}),fe=()=>({hooks:{archiveRequest:C},settleSessionArchive:()=>{C.set(null)},stopAndArchiveSession:(e,t=[])=>k(e,t,!0)}),pe=()=>({requestSessionDelete:e=>{let n=t.list.getSnapshot(),r=n.byId[e];T.set({sessionId:e,title:r?.displayTitle??e,running:r?.running===!0,children:fb(n,e)})}}),j=()=>({hooks:{deleteRequest:T},dismiss:()=>{T.set(null)},deleteSession:async(e,t)=>{let n=0;if(t)for(let t of e.children)try{await d.deleteSession(t.id)}catch{n++}await d.deleteSession(e.sessionId),u({kind:`deleted`,...n>0?{failedChildren:n}:{}})}}),me=()=>({hooks:{archived:x},markCompletionUnread:t=>e.uiSession.markCompletionUnread(t)}),he=()=>({forkSession:t=>{d.forkSession(t,n=>{e.get(`productAnalytics`)?.track(`branch_session_click`,{session_id:n,parent_session_id:t,click_position:`sidebar`})}).then(e=>d.openSession(e)).catch(e=>{u({kind:`forkFailed`,message:e instanceof Error?e.message:String(e)})})}}),ge=()=>({copySessionLink:e=>{let n=t.list.getSnapshot().byId[e],r=n===void 0?void 0:rm(n);r!==void 0&&(async()=>{try{await navigator.clipboard.writeText(im(r)),u({kind:`sessionLinkCopied`})}catch{u({kind:`sessionLinkCopyFailed`})}})()}}),_e=()=>({requestSessionRename:ee}),ve=()=>({hooks:{renameRequest:S},settleSessionRename:p.closeRename,renameSession:te}),ye=()=>({hooks:{toast:s},dismissToast:()=>{s.set(null)},undoArchive:E,showArchived:()=>{a.actions.setArchivedFilter(`show`)}}),be=()=>({startSession:e=>{d.startSession(e)},open:y,markCompletionsRead:t=>{e.get(`uiSession`)?.markCompletionsRead(t)},searchSessions:m,refreshSessions:()=>{t.refresh()},loadMoreSessions:e=>{t.loadMore(e)},searchResultLimit:t.searchResultLimit,requestSessionRename:ee,notifyArchivedNotOpenable:()=>{u({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 d.unarchiveSession(e)},createWorkspace:e=>n.create(e),requestManageThreadSection:n.createThreadSection&&n.updateThreadSection&&n.deleteThreadSection?e=>D.set(e):void 0,moveSessionToSection:n.moveSessionToSection?e=>oe.move(e):void 0,setScopedSessionIds:e=>{ie.set(e)},requestSearch:p.search,requestAddWorkspace:p.add,closeAddWorkspace:p.closeAdd,setDirectoryBusy:p.directoryBusy,dismissForkError:p.dismissForkError,setThreadTreeCollapseStyle:e=>f.set(`threadTreeCollapseStyle`,e),hooks:{workspacePreferences:f,directoryFlow:g,hostInfo:_,workspaceShortcuts:p.state,shortcuts:e.shortcuts.catalog,nativeThreads:ne,movingSectionSessions:oe.movingSessionIds}}),M=()=>({createWorkspace:e=>n.create(e),hooks:{directoryFlow:v}});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.session.row.identity":{kind:`list`,scope:`root`},"sidebar.session.row.leading":{kind:`list`,scope:`root`},"sidebar.session.row.hover":{kind:`list`,scope:`root`}},store:o,inject:be,locale:vb},Dy)),e.slots.inject(`sidebar.workspaces.session.menu.item`,function*(){yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`pin`,order:100,locale:vb,inject:O},$y),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`move-to-section`,order:150,locale:vb,inject:se},Vy),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`remove-from-section`,order:155,locale:vb,inject:se},Hy),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`move-section-up`,order:160,locale:vb,inject:se},Uy),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`move-section-down`,order:165,locale:vb,inject:se},Wy),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`rename`,order:200,locale:vb,inject:_e},tb),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`mark-as-unread`,order:250,locale:vb,inject:me},Yy),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`mark-children-as-read`,order:260,locale:vb},Xy),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`fork`,order:300,locale:vb,inject:he},Jy),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`copy-session-link`,order:350,locale:vb,inject:ge},Zy),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`archive`,order:400,locale:vb,inject:de},ky),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`delete`,order:500,locale:vb,inject:pe},Iy)}),e.slots.inject(`sidebar.workspaces.session.row.action`,function*(){yield e.slots.register({name:`sidebar.workspaces.session.row.action`,id:`archive`,order:100,locale:vb,inject:de},Ay),yield e.slots.register({name:`sidebar.workspaces.session.row.action`,id:`pin`,order:200,locale:vb,inject:O},eb)}),e.slots.inject(`shell.overlay`,function*(){yield e.slots.register({name:`shell.overlay`,id:`workspace.move-to-section`,locale:vb,inject:ce},Ky),yield e.slots.register({name:`shell.overlay`,id:`workspace.manage-thread-section`,locale:vb,inject:le},Ag),yield e.slots.register({name:`shell.overlay`,id:`workspace.session-rename`,locale:vb,inject:ve},nb),yield e.slots.register({name:`shell.overlay`,id:`workspace.session-archive`,locale:vb,inject:fe},jy),yield e.slots.register({name:`shell.overlay`,id:`workspace.archive-children`,locale:vb,inject:A},Py),yield e.slots.register({name:`shell.overlay`,id:`workspace.delete-session`,locale:vb,inject:j},Ly),yield e.slots.register({name:`shell.overlay`,id:`workspace.row-toast`,locale:vb,store:o,inject:ye},ab)}),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:vb},fy))}function xb(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=gb,n.apply=bb,n.inject=yb,t.exports}});
|
|
127
|
+
default:return em(e)}}let lb={"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.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}前`},ub={"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.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 db(e,t,n=!1){let r=/* @__PURE__ */ new Map;for(let t of Object.values(e.byId)){if(n&&!fb(t))continue;let i=Em(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 fb(e){return e!==void 0&&!e.blank&&e.origin!==`subagent`&&e.projectionValues?.threadTreeParent!==void 0}function pb(e,t,n){let r=[];for(let i of db(e,t,!0)){let t=Yp(i),a=e.byId[t];!n.has(t)&&a&&r.push({id:t,title:a.displayTitle})}return r}function mb(e,t){let n=/* @__PURE__ */ new Map;for(let t of Object.values(e.byId)){let r=Em(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 hb(e,t,n=db(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[Yp(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 gb=()=>!1,_b=()=>()=>{};function vb(e){let t=(0,a.usePhoneSidebar)();return t!==null&&!t.open?null:/* @__PURE__ */ (0,o.jsx)(yb,{...e,closeDrawer:t?.close},e.sessionId)}function yb({sessionId:e,prepareDraftReference:t,closeDrawer:n,useMenuOpenState:r,t:i}){let[c]=(0,s.useState)(()=>t(e)),l=(0,s.useSyncExternalStore)(c?.subscribe??_b,c?.getSnapshot??gb),u=(0,s.useRef)(!1),[d,f]=(0,s.useState)(!1),[,p]=r();return c===void 0?null:/* @__PURE__ */ (0,o.jsxs)(o.Fragment,{children:[/* @__PURE__ */ (0,o.jsx)(a.MenuItemButton,{icon:/* @__PURE__ */ (0,o.jsx)(a.IconLinkOutlineRegular,{}),disabled:d||!l,onSelect:()=>{if(!u.current){u.current=!0;try{if(c?.insert()===!0){p(!1),n?.();return}}catch{}f(!0)}},children:i(`menu.referenceSession`)}),d&&/* @__PURE__ */ (0,o.jsx)(`div`,{role:`status`,children:i(`menu.referenceSessionFailed`)})]})}let bb=`workspace`,xb=[`slots`,`sessions`,`uiSession`,`workspaces`,`locale`,`remote`,`remote.directoryPicker`,`layout`,`shortcuts`,`configForms`];function Sb(e){let t=e.get(`sessions`),n=e.get(`workspaces`),i=Bm(),a=i.create();a.actions.setArchivedFilter(`default`),e.effect(()=>{let e=()=>{t.setIncludeArchived((a.getSnapshot().archivedFilter??`default`)!=="default")},n=a.subscribe(e);return e(),n},`ui-workspace: browser-local archive query scope`);let o={...i,create:()=>a},s=(0,r.createSnapshotStore)(null),c=0,u=e=>{s.set({...e,seq:++c})},d=new ih(e,e.remote.directoryPicker,n,t,a.actions,u),f=xg(e);dg(e,d,f),e.slots.provideRoot({hooks:{workspaces:n.list}}),e.effect(()=>e.locale.register(bb,{zh:lb,en:ub}),`ui-workspace: dictionaries`);let p=Kp(),m=async(e,n)=>{let r=await t.search(e,n);if(!r.ok)throw Error(r.error.message);return r.value},h=t=>({getSnapshot:()=>e.slots.entries(t).length>0,subscribe:n=>e.slots.subscribe(t,n)}),g=h(`sidebar.workspaces.directoryFlow`),_={getSnapshot:()=>e.remote.$host,subscribe:t=>e.on(`connection/reset`,t)},v=h(`conversation.hero.workspace.directoryFlow`),y=e=>{d.openSession(e)},b=Vy(n.list,e=>new Set(e.pinnedSessionIds)),x=Vy(n.list,e=>new Set(e.archivedSessionIds)),S=Vy(p.state,e=>e.renameTarget),C=(0,r.createSnapshotStore)(null),w=(0,r.createSnapshotStore)(null),T=(0,r.createSnapshotStore)(null),ee=p.rename,E=e=>{d.unarchiveSession(e).catch(e=>{u({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=Vy(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,r.createSnapshotStore)(null),ie=(0,r.createSnapshotStore)(null),ae=Vy(a,e=>e.archivedFilter??`default`),oe=rv({execute:(e,t,r,i)=>n.moveSessionToSection?n.moveSessionToSection(e,t,r,i):Promise.reject(/* @__PURE__ */ Error(`Section moves are unavailable`)),onError:e=>{u({kind:`sectionMoveFailed`,message:e instanceof Error?e.message:String(e)})},onUnknown:()=>u({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)}),ce=()=>({hooks:{threadSectionMove:re,sectionWorkspace:n.list,movingSectionSessions:oe.movingSessionIds},dismiss:()=>re.set(null),move:e=>oe.move(e,{notifyOnError:!1})}),D=(0,r.createSnapshotStore)(null),le=()=>({hooks:{threadSectionManage:D},dismiss:()=>D.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:()=>u({kind:`sectionSyncPending`})}),O=()=>({hooks:{pinned:b,archived:x},pinSession:e=>{d.pinSession(e).catch(e=>{u({kind:`pinFailed`,message:e instanceof Error?e.message:String(e)})})},unpinSession:e=>{d.unpinSession(e).catch(e=>{u({kind:`unpinFailed`,message:e instanceof Error?e.message:String(e)})})}}),k=async(e,r,i=!1)=>{await d.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||hb(n,e,[]).length)throw Error(`Child Session is active`);await d.archiveSession(e)}catch{a++}u({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=hb(r,e,[]);i?.running||o.length>0?C.set({sessionId:e,displayTitle:a,children:n,activity:o.length?[{kind:`subagent`,items:o}]:[],...i?.running?{runningThreads:[{id:e,title:a}]}:{}}):k(e,n).catch(t=>{let r=Cb(t);r===void 0?u({kind:`archiveFailed`,message:t instanceof Error?t.message:String(t)}):C.set({sessionId:e,displayTitle:a,activity:r,children:n})})},de=()=>({hooks:{archived:x},archiveSession:e=>{let n=t.list.getSnapshot(),r=pb(n,e,x.getSnapshot());r.length?w.set({sessionId:e,title:n.byId[e]?.displayTitle??e,children:r}):ue(e,[])},unarchiveSession:E});qp(e,d,p,de().archiveSession);let A=()=>({hooks:{archiveChildrenRequest:w},dismiss:()=>w.set(null),choose(e,t){w.getSnapshot()===e&&(w.set(null),ue(e.sessionId,t?e.children.map(({id:e})=>e):[]))}}),fe=()=>({hooks:{archiveRequest:C},settleSessionArchive:()=>{C.set(null)},stopAndArchiveSession:(e,t=[])=>k(e,t,!0)}),pe=()=>({requestSessionDelete:e=>{let n=t.list.getSnapshot(),r=n.byId[e];T.set({sessionId:e,title:r?.displayTitle??e,running:r?.running===!0,children:mb(n,e)})}}),j=()=>({hooks:{deleteRequest:T},dismiss:()=>{T.set(null)},deleteSession:async(e,t)=>{let n=0;if(t)for(let t of e.children)try{await d.deleteSession(t.id)}catch{n++}await d.deleteSession(e.sessionId),u({kind:`deleted`,...n>0?{failedChildren:n}:{}})}}),me=()=>({hooks:{archived:x},markCompletionUnread:t=>e.uiSession.markCompletionUnread(t)}),he=()=>({forkSession:t=>{d.forkSession(t,n=>{e.get(`productAnalytics`)?.track(`branch_session_click`,{session_id:n,parent_session_id:t,click_position:`sidebar`})}).then(e=>d.openSession(e)).catch(e=>{u({kind:`forkFailed`,message:e instanceof Error?e.message:String(e)})})}}),ge=()=>({copySessionLink:e=>{let n=t.list.getSnapshot().byId[e],r=n===void 0?void 0:am(n);r!==void 0&&(async()=>{try{await navigator.clipboard.writeText(om(r)),u({kind:`sessionLinkCopied`})}catch{u({kind:`sessionLinkCopyFailed`})}})()}}),_e=()=>({requestSessionRename:ee}),ve=()=>({hooks:{renameRequest:S},settleSessionRename:p.closeRename,renameSession:te}),ye=()=>({hooks:{toast:s},dismissToast:()=>{s.set(null)},undoArchive:E,showArchived:()=>{a.actions.setArchivedFilter(`show`)}}),be=()=>({startSession:e=>{d.startSession(e)},open:y,markCompletionsRead:t=>{e.get(`uiSession`)?.markCompletionsRead(t)},searchSessions:m,refreshSessions:()=>{t.refresh()},loadMoreSessions:e=>{t.loadMore(e)},searchResultLimit:t.searchResultLimit,requestSessionRename:ee,notifyArchivedNotOpenable:()=>{u({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 d.unarchiveSession(e)},createWorkspace:e=>n.create(e),requestManageThreadSection:n.createThreadSection&&n.updateThreadSection&&n.deleteThreadSection?e=>D.set(e):void 0,moveSessionToSection:n.moveSessionToSection?e=>oe.move(e):void 0,setScopedSessionIds:e=>{ie.set(e)},requestSearch:p.search,requestAddWorkspace:p.add,closeAddWorkspace:p.closeAdd,setDirectoryBusy:p.directoryBusy,dismissForkError:p.dismissForkError,setThreadTreeCollapseStyle:e=>f.set(`threadTreeCollapseStyle`,e),hooks:{workspacePreferences:f,directoryFlow:g,hostInfo:_,workspaceShortcuts:p.state,shortcuts:e.shortcuts.catalog,nativeThreads:ne,movingSectionSessions:oe.movingSessionIds}}),M=()=>({createWorkspace:e=>n.create(e),hooks:{directoryFlow:v}});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.session.row.identity":{kind:`list`,scope:`root`},"sidebar.session.row.leading":{kind:`list`,scope:`root`},"sidebar.session.row.hover":{kind:`list`,scope:`root`}},store:o,inject:be,locale:bb},ky)),e.slots.inject(`sidebar.workspaces.session.menu.item`,function*(){yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`pin`,order:100,locale:bb,inject:O},tb),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`move-to-section`,order:150,locale:bb,inject:se},Uy),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`remove-from-section`,order:155,locale:bb,inject:se},Wy),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`move-section-up`,order:160,locale:bb,inject:se},Gy),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`move-section-down`,order:165,locale:bb,inject:se},Ky),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`rename`,order:200,locale:bb,inject:_e},rb),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`mark-as-unread`,order:250,locale:bb,inject:me},Zy),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`mark-children-as-read`,order:260,locale:bb},Qy),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`fork`,order:300,locale:bb,inject:he},Xy),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`copy-session-link`,order:350,locale:bb,inject:ge},$y),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`archive`,order:400,locale:bb,inject:de},jy),yield e.slots.register({name:`sidebar.workspaces.session.menu.item`,id:`delete`,order:500,locale:bb,inject:pe},Ry)}),e.slots.inject(`sidebar.workspaces.session.row.action`,function*(){yield e.slots.register({name:`sidebar.workspaces.session.row.action`,id:`archive`,order:100,locale:bb,inject:de},My),yield e.slots.register({name:`sidebar.workspaces.session.row.action`,id:`pin`,order:200,locale:bb,inject:O},nb)}),e.slots.inject(`shell.overlay`,function*(){yield e.slots.register({name:`shell.overlay`,id:`workspace.move-to-section`,locale:bb,inject:ce},Jy),yield e.slots.register({name:`shell.overlay`,id:`workspace.manage-thread-section`,locale:bb,inject:le},Mg),yield e.slots.register({name:`shell.overlay`,id:`workspace.session-rename`,locale:bb,inject:ve},ib),yield e.slots.register({name:`shell.overlay`,id:`workspace.session-archive`,locale:bb,inject:fe},Ny),yield e.slots.register({name:`shell.overlay`,id:`workspace.archive-children`,locale:bb,inject:A},Iy),yield e.slots.register({name:`shell.overlay`,id:`workspace.delete-session`,locale:bb,inject:j},zy),yield e.slots.register({name:`shell.overlay`,id:`workspace.row-toast`,locale:bb,store:o,inject:ye},sb)}),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:bb},my))}function Cb(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=vb,n.apply=Sb,n.inject=xb,t.exports}});
|