@codexhost/cli-win32-x64 0.29.2 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +40 -15
  4. package/app/console-web.js +49 -24
  5. package/app/desktop-controller.mjs +53 -28
  6. package/app/host-runtime.mjs +2616 -1978
  7. package/app/plugins/antigravity/plugin.mjs +40 -15
  8. package/app/plugins/claude-code/plugin.mjs +40 -15
  9. package/app/plugins/codebuddy/plugin.mjs +514 -109
  10. package/app/plugins/codex-usage/plugin.mjs +58 -33
  11. package/app/plugins/copilot/plugin.mjs +40 -15
  12. package/app/plugins/cursor-cli/plugin.mjs +40 -15
  13. package/app/plugins/deepseek-harness/plugin.mjs +40 -15
  14. package/app/plugins/devin/plugin.mjs +40 -15
  15. package/app/plugins/grok/plugin.mjs +40 -15
  16. package/app/plugins/hermes/plugin.mjs +40 -15
  17. package/app/plugins/kimi-code/plugin.mjs +40 -15
  18. package/app/plugins/kiro-cli/plugin.mjs +40 -15
  19. package/app/plugins/omp/plugin.mjs +40 -15
  20. package/app/plugins/opencode/plugin.mjs +40 -15
  21. package/app/plugins/pi/plugin.mjs +40 -15
  22. package/app/plugins/qoder/plugin.mjs +40 -15
  23. package/app/plugins/qoder-cn/plugin.mjs +40 -15
  24. package/app/plugins/qwen-code/plugin.mjs +40 -15
  25. package/app/plugins/workbuddy/plugin.mjs +548 -112
  26. package/app/plugins/zcode/plugin.mjs +40 -15
  27. package/app/renderer-extension.js +52 -27
  28. package/app/web/assets/abnfDiagram-XWFEHMT6-BdinLox4.js +1 -0
  29. package/app/web/assets/architectureDiagram-CSQXQB3N-DgPBbtvP.js +36 -0
  30. package/app/web/assets/blockDiagram-BEDRHYPZ-B4ENdwtZ.js +140 -0
  31. package/app/web/assets/bpmnIcons-APHXDYXF-ByGoYv9M.js +1 -0
  32. package/app/web/assets/c4Diagram-M2UUVUY5-DA6Owfyu.js +38 -0
  33. package/app/web/assets/chunk-2Q5K7J3B-Dvh3qOmo.js +1 -0
  34. package/app/web/assets/chunk-3GCGMST5-VIkqueym.js +1 -0
  35. package/app/web/assets/chunk-5VM5RSS4-DTYof_OI.js +15 -0
  36. package/app/web/assets/chunk-7U7NFRK5-Dp7s2dg0.js +88 -0
  37. package/app/web/assets/chunk-CNRTWJTD-TKBKxZLU.js +1 -0
  38. package/app/web/assets/chunk-D5HYT7QG-BRZDovSS.js +1 -0
  39. package/app/web/assets/chunk-EBZ3SEQC-C9USZ3tT.js +2 -0
  40. package/app/web/assets/chunk-JWPE2WC7-BrdvVNVo.js +1 -0
  41. package/app/web/assets/chunk-KTR4FSNJ-C7qwjGba.js +1 -0
  42. package/app/web/assets/chunk-XXDRQBXY-DlSrRuwN.js +1 -0
  43. package/app/web/assets/classDiagram-v2-KXABOMEV-BFvB4kwX.js +217 -0
  44. package/app/web/assets/cose-bilkent-JH36ORCC-UyCAqNvj.js +1 -0
  45. package/app/web/assets/cynefin-EF2NZ3EQ-CwawUbjJ.js +141 -0
  46. package/app/web/assets/cynefinDiagram-NJNITYFG-BaWEIQJ0.js +62 -0
  47. package/app/web/assets/cytoscape.esm-Cm0uQArZ.js +332 -0
  48. package/app/web/assets/d3-scale-4DPf7zan.js +1 -0
  49. package/app/web/assets/dagre-KIHZ2IZ3-B7ENIjLG.js +4 -0
  50. package/app/web/assets/diagram-7YQZDPLS-CxRMU8xq.js +41 -0
  51. package/app/web/assets/diagram-QBROCOUO-qo7sxm4K.js +200 -0
  52. package/app/web/assets/diagram-RJJCUUZO-CQiGMCMe.js +30 -0
  53. package/app/web/assets/diagram-WERXNKYE-D0Jps1As.js +24 -0
  54. package/app/web/assets/diagram-YHHI257C-p4AB8cqK.js +3 -0
  55. package/app/web/assets/diagram-YR4HJLHV-Bh6JKT04.js +24 -0
  56. package/app/web/assets/ebnfDiagram-N527522P-DRac0k4W.js +1 -0
  57. package/app/web/assets/elk-O5DQBFGD-CWTz5SZP.js +27 -0
  58. package/app/web/assets/erDiagram-K3K3BIDK-DE3w4BEY.js +99 -0
  59. package/app/web/assets/flowDiagram-Z6JWZHQI-NYs8bi5t.js +213 -0
  60. package/app/web/assets/ganttDiagram-3PRQTZWP-Bspp9btW.js +292 -0
  61. package/app/web/assets/gitGraphDiagram-VXDFKS5L-ByGW1uvv.js +106 -0
  62. package/app/web/assets/graph-D8UmR1vK.js +1 -0
  63. package/app/web/assets/grid-E2QIVN74-CegebiIw.js +1 -0
  64. package/app/web/assets/{index-aSHN2MIG.css → index-BbmB5VLj.css} +1 -1
  65. package/app/web/assets/{index-0TnaYwHS.js → index-DFPOGLS4.js} +80 -80
  66. package/app/web/assets/infoDiagram-EZ3ZOAHP-CexmsdZx.js +2 -0
  67. package/app/web/assets/ishikawaDiagram-S3EKX5GW-BbWqKhg6.js +70 -0
  68. package/app/web/assets/journeyDiagram-POQNLL5X-27YlCe-1.js +139 -0
  69. package/app/web/assets/kanban-definition-BH5XI6FM-BAhOdeck.js +89 -0
  70. package/app/web/assets/langs/{graphql-ChAeyPkT.js → graphql-D6Z3qcRW.js} +1 -1
  71. package/app/web/assets/langs/{http-BvreBIbD.js → http-XiU9G9In.js} +1 -1
  72. package/app/web/assets/langs/{php-D8omCIuJ.js → php-DL3xwS-7.js} +1 -1
  73. package/app/web/assets/langs/{rst-Do7RLLCS.js → rst-DudRVJ9g.js} +1 -1
  74. package/app/web/assets/langs/{ruby-rH_O_vse.js → ruby-_FqsfqJi.js} +1 -1
  75. package/app/web/assets/langs/{svelte-xZy73wAj.js → svelte-ClsVJoBT.js} +1 -1
  76. package/app/web/assets/langs/{vue-C4DW8agZ.js → vue-BiKMXCyK.js} +1 -1
  77. package/app/web/assets/mermaid.core-sGgCbv5y.js +314 -0
  78. package/app/web/assets/mindmap-definition-WVAN44T4-CsMIX0Lj.js +98 -0
  79. package/app/web/assets/pegDiagram-D4NLKWP3-Cs3LXqn_.js +1 -0
  80. package/app/web/assets/pieDiagram-36ENHN4W-DdQsQX9I.js +39 -0
  81. package/app/web/assets/quadrantDiagram-ZQUDMS73-D1jOKqx_.js +7 -0
  82. package/app/web/assets/railroadDiagram-JIZHGYPL-XulrgX5n.js +1 -0
  83. package/app/web/assets/render-VIF2ZAQL-CSsGw-0I.js +2 -0
  84. package/app/web/assets/requirementDiagram-AXW2TVFA-CT66GXLN.js +84 -0
  85. package/app/web/assets/sankeyDiagram-FBCJTAIF-CNRKebNY.js +40 -0
  86. package/app/web/assets/sequenceDiagram-3LA2ROMG-DVl5y64e.js +169 -0
  87. package/app/web/assets/sizeCapture-2Q2CQKSF-Kg0XxSga.js +1 -0
  88. package/app/web/assets/stateDiagram-v2-ATKHQDJO-DYQnfMsS.js +291 -0
  89. package/app/web/assets/swimlanes-YQL5WMAO-Chqt7pxD.js +1 -0
  90. package/app/web/assets/swimlanesDiagram-UCCPES4V-BfREktNP.js +8 -0
  91. package/app/web/assets/timeline-definition-7Z437IG3-aHFxjIT6.js +120 -0
  92. package/app/web/assets/usecaseDiagram-RDK6N6HP-DsC5tFe4.js +370 -0
  93. package/app/web/assets/vendor-BKfNgqAm.js +666 -0
  94. package/app/web/assets/vennDiagram-SHRQU5PJ-C65oZxFn.js +34 -0
  95. package/app/web/assets/wardleyDiagram-F3OXNVQS-HTkq7DT0.js +78 -0
  96. package/app/web/assets/xychartDiagram-GDYJKCDI-p1LpQ9MH.js +7 -0
  97. package/app/web/codexhost-settings.js +39 -39
  98. package/app/web/index.html +3 -3
  99. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +65 -65
  100. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
  101. package/app/web/plugins/deepseek-ai__dsh-client-locale/client.js +1 -1
  102. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +17 -17
  103. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +16 -16
  104. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +16 -16
  105. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +3 -3
  106. package/app/web/plugins/deepseek-ai__dsh-client-ui-permission-presets/client.js +1 -1
  107. package/app/web/plugins/deepseek-ai__dsh-client-ui-plan/client.js +1 -1
  108. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +9 -9
  109. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
  110. package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +1 -1
  111. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +14 -14
  112. package/app/web-modules/licenses/DSH-THIRD_PARTY_NOTICES.md +1 -1
  113. package/app/web-modules/server.mjs +348 -118
  114. package/bin/codexhost.exe +0 -0
  115. package/libexec/codexhost-node-repl.exe +0 -0
  116. package/libexec/codexhost-screenshot.exe +0 -0
  117. package/libexec/codexhost-shell.exe +0 -0
  118. package/libexec/codexhost-shim.exe +0 -0
  119. package/libexec/codexhost-updater.exe +0 -0
  120. package/package.json +1 -1
  121. package/app/web/assets/vendor-C9g2bw8s.js +0 -410
@@ -143,37 +143,37 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
143
143
 
144
144
  `)}return e}getTextContentSize(){let e=function(e){let t=0;for(let n of By(e)){let r=Vy(e,n);r!==null&&(t+=r.getTextContentSize())}return t}(this),t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContentSize(),U(i)&&r!==n-1&&!i.isInline()&&(e+=2)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(e!==``){let t=Id[e];return(this.getFormat()&t)!==0}return!1}hasTextFormat(e){let t=Pd[e];return(this.getTextFormat()&t)!==0}getFormatFlags(e,t){return L_(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}select(e,t){wg();let n=V(),r=e,i=t,a=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){let e=this.getFirstChild();if(z(e)||U(e))return e.select(0,0)}else if(!(e!==void 0&&e!==a||t!==void 0&&t!==a)){let e=this.getLastChild();if(z(e)||U(e))return e.select()}}r===void 0&&(r=a),i===void 0&&(i=a);let o=this.__key;return B(n)?(n.anchor.set(o,r,`element`),n.focus.set(o,i,`element`),n.dirty=!0,n):Yh(o,r,o,i,`element`,`element`)}selectStart(){let e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){let e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){let e=this.getWritable();return this.getChildren().forEach(e=>e.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){let t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=e!==``&&Id[e]||0,this}setStyle(e){return this.getWritable().__style=e||``,this}setTextFormat(e){let t=this.getWritable();return t.__textFormat=e,t}setTextStyle(e){let t=this.getWritable();return t.__textStyle=e,t}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){Hm(this)&&F(324,this.__key,this.__type);let r=this.getChildrenSize(),i=this.getWritable();e+t<=r||F(226,String(e),String(t),String(r));for(let e of n);let a=i.__key,o=[],s=[],c=this.getChildAtIndex(e+t),l=null,u=r-t+n.length;if(e!==0){if(e===r)l=this.getLastChild();else{let t=this.getChildAtIndex(e);t!==null&&(l=t.getPreviousSibling())}}if(t>0){let e=l===null?this.getFirstChild():l.getNextSibling();for(let n=0;n<t;n++){e===null&&F(100);let t=e.getNextSibling(),n=e.__key;z_(e.getWritable()),s.push(n),e=t}}let d=l;for(let e of n){d!==null&&e.is(d)&&(l=d=d.getPreviousSibling());let t=e.getWritable();t.__parent===a&&u--,z_(t);let n=e.__key;if(d===null)i.__first=n,t.__prev=null;else{let e=d.getWritable();e.__next=n,t.__prev=e.__key}e.__key===a&&F(76),t.__parent=a,o.push(n),d=e}if(e+t===r)d!==null&&(d.getWritable().__next=null,i.__last=d.__key);else if(c!==null){let e=c.getWritable();if(d!==null){let t=d.getWritable();e.__prev=d.__key,t.__next=c.__key}else e.__prev=null}if(i.__size=u,s.length){let e=V();if(B(e)){let t=new Set(s),n=new Set(o),{anchor:r,focus:i}=e;Gg(r,t,n)&&ng(r,r.getNode(),this,l,c),Gg(i,t,n)&&ng(i,i.getNode(),this,l,c),u!==0||this.canBeEmpty()||kv(this)||this.remove()}}return i}getDOMSlot(e){return new Gd(e)}exportDOM(e){let{element:t}=super.exportDOM(e);if(q(t)){let e=this.getIndent();e>0&&(t.style.paddingInlineStart=40*e+`px`,t.setAttribute(`data-lexical-indent`,String(e)));let n=this.getDirection();n&&(t.dir=n)}return{element:t}}exportJSON(){let e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},t=this.getTextFormat(),n=this.getTextStyle();return t===0&&n===``||kv(this)||this.getChildren().some(z)||(t!==0&&(e.textFormat=t),n!==``&&(e.textStyle=n)),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||``)}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){let n=cy(this,e,t),r=n.getFirstChild();for(let e=this.getFirstChild();e;e=e.getNextSibling()){let i=t.getElementByKey(e.getKey());i!==null&&(r==null?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling)}}};function U(e){return e instanceof Wg}function Gg(e,t,n){let r=e.getNode();for(;r;){let e=r.__key;if(t.has(e)&&!n.has(e))return!0;r=r.getParent()}return!1}var Kg=class extends Wm{__slotHost;__slots;constructor(e){super(e),this.__slotHost=null,this.__slots=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__slotHost=e.__slotHost,this.__slotHost!==null&&this.__parent!==null&&F(383,this.__key,String(this.__slotHost),String(this.__parent)),this.__slots=e.__slots)}decorate(e,t){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function W(e){return e instanceof Kg}var qg=class extends Wg{__cachedText;$config(){return this.config(`root`,{extends:Wg})}constructor(){super(`root`),this.__cachedText=null}getTopLevelElementOrThrow(){F(51)}getTextContent(){let e=this.__cachedText;return e===null||!Cg()&&H()._dirtyType!==0?super.getTextContent():e}remove(){F(52)}replace(e){F(53)}insertBefore(e){F(54)}insertAfter(e){F(55)}updateDOM(e,t){return!1}splice(e,t,n){for(let e of n)U(e)||W(e)||F(282);return super.splice(e,t,n)}static importJSON(e){return X_().updateFromJSON(e)}collapseAtStart(){return!0}};function Jg(e){return e instanceof qg}function Yg(e){return new $g(Xd(e._nodeMap),null,e._slotsUsed)}function Xg(){return new $g(/* @__PURE__ */ new Map([[`root`,new qg]]),null,!1)}function Zg(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&F(130,n.name),U(e)){let r=t.children;Array.isArray(r)||F(59,n.name);let i=e.getChildren();for(let e=0;e<i.length;e++){let t=Zg(i[e]);r.push(t)}}let r=By(e);if(r.length>0){let i={};for(let t of r){let r=Vy(e,t);r===null&&F(366,n.name,t),i[t]=Zg(r)}t.$slots=i}return t}function Qg(e){return e instanceof $g}var $g=class e{_nodeMap;_selection;_flushSync;_readOnly;_parsed;_slotsUsed;constructor(e,t=null,n=!1){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1,this._parsed=!1,this._slotsUsed=n}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return Fg(t&&t.editor||null,this,e)}clone(t){let n=new e(this._nodeMap,t===void 0?this._selection:t,this._slotsUsed);return n._readOnly=!0,n}toJSON(){return Fg(null,this,()=>({root:Zg(X_())}))}},e_=class extends Wg{$config(){return this.config(`artificial`,{extends:Wg})}createDOM(e){return Uv().createElement(`div`)}},t_=class extends Wm{$config(){return this.config(`linebreak`,{importDOM:{br:e=>a_(e)||o_(e)?null:{conversion:n_,priority:0}}})}getTextContent(){return`
145
145
  `}createDOM(){return Uv().createElement(`br`)}updateDOM(){return!1}isInline(){return!0}};function n_(e){return{node:r_()}}function r_(){return jv(new t_)}function i_(e){return e instanceof t_}function a_(e){let t=e.parentElement;if(t!==null&&iy(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&s_(n)){let n=t.lastChild;if(n===e||n.previousSibling===e&&s_(n))return!0}}return!1}function o_(e){let t=e.parentElement;if(t!==null&&iy(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&s_(n))return!1;let r=t.lastChild;if(r===e||r.previousSibling===e&&s_(r))return!0}return!1}function s_(e){return P_(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||``)}var c_=class extends Wg{$config(){return this.config(`paragraph`,{extends:Wg,importDOM:{p:()=>({conversion:l_,priority:0})}})}createDOM(e){let t=Uv().createElement(`p`),n=pv(e.theme,`paragraph`);return n!==void 0&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}exportDOM(e){let{element:t}=super.exportDOM(e);if(q(t)){this.isEmpty()&&t.append(Uv().createElement(`br`));let e=this.getFormatType();e&&(t.style.textAlign=e)}return{element:t}}exportJSON(){let e=super.exportJSON();if(e.textFormat===void 0||e.textStyle===void 0){let t=this.getChildren().find(z);t?(e.textFormat=t.getFormat(),e.textStyle=t.getStyle()):(e.textFormat=this.getTextFormat(),e.textStyle=this.getTextStyle())}return e}insertNewAfter(e,t){let n=u_();n.setTextFormat(e.format),n.setTextStyle(e.style);let r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,t),n}collapseAtStart(){let e=this.getChildren();if(e.length===0||z(e[0])&&e[0].getTextContent().trim()===``){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function l_(e){let t=u_();if(vy(t,e),gy(e,t),t.getFormatType()===``){let n=e.getAttribute(`align`);n&&n&&n in Id&&t.setFormat(n)}return _y(t,e),{node:t}}function u_(){return jv(new c_)}function d_(e){return e instanceof c_}function f_(e){console.warn(e)}function p_(e,t,n,r,i){let a=e._keyToDOMMap;a.clear(),e._editorState=Xg(),e._pendingEditorState=r,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=/* @__PURE__ */ new Set,e._dirtyElements.clear(),e._normalizedNodes=/* @__PURE__ */ new Set,i&&i.preserveUpdateQueue||(e._updateTags=/* @__PURE__ */ new Set,e._updates=[],e._cascadeCount=0),e._blockCursorElement=null,e._inputState.handledSelectionCommandTimeoutId!==null&&clearTimeout(e._inputState.handledSelectionCommandTimeoutId),e._inputState={collapsedSelectionFormat:{format:0,key:`root`,offset:0,style:``,timeStamp:0},compositionEndData:``,compositionPhase:`idle`,hadOrphanedCompositionEvents:!1,handledSelectionCommandTimeoutId:null,isInsertLineBreak:!1,isInsertTextAfterHandledSelectionCommand:!1,isSelectionChangeFromDOMUpdate:!1,isSelectionChangeFromMouseDown:!1,lastBeforeInputInsertTextTimeStamp:0,lastKeyCode:null,lastKeyDownTimeStamp:0,postDeleteSelectionToRestore:null,unprocessedBeforeInputData:null};let o=e._observer;o!==null&&(o.disconnect(),e._observer=null),t!==null&&(t.textContent=``,function(e,t){let n=`__lexicalKey_${t._key}`;delete e[n]}(t,e)),n!==null&&(n.textContent=``,a.set(`root`,n),G_(n,e,`root`))}function m_(e){let t=/* @__PURE__ */ new Set,n=/* @__PURE__ */ new Set;for(let{klass:r,ownNodeConfig:i}of Dy(e)){let e=r.transform;if(!n.has(e)){n.add(e);let i=r.transform();i&&t.add(i)}if(i){let e=i.$transform;e&&t.add(e)}}return t}let h_={$createDOM:(e,t)=>e.createDOM(t._config,t),$decorateDOM:(e,t,n,r)=>{},$exportDOM:(e,t)=>{let n=T_(t,e.getType());return n&&n.exportDOM!==void 0?n.exportDOM(t,e):e.exportDOM(t)},$extractWithChild:(e,t,n,r,i)=>U(e)&&e.extractWithChild(t,n,r),$getDOMSlot:(e,t,n)=>e.getDOMSlot(t),$getSlotTargetElement:(e,t,n,r)=>null,$shouldExclude:(e,t,n)=>U(e)&&e.excludeFromCopy(`html`),$shouldInclude:(e,t,n)=>!t||e.isSelected(t),$updateDOM:(e,t,n,r)=>e.updateDOM(t,n,r._config)};function g_(e){let t=e||{},n=Ag(),r=t.theme||{},i=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,o=Xg(),s=t.namespace||(i===null?nv():i._config.namespace),c=t.editorState,l=[qg,sh,t_,vh,c_,e_,...t.nodes||[]],{onError:u,onWarn:d,html:f}=t,p=t.editable===void 0||t.editable,m;if(e===void 0&&n!==null)m=n._nodes;else{m=/* @__PURE__ */ new Map;for(let e=0;e<l.length;e++){let n=l[e],r=null,i=null;if(n&&typeof n==`object`){let e=n;n=e.replace,r=e.with,i=e.withKlass||null}if(typeof n!=`function`||!n.prototype||!(n===Wm||n.prototype instanceof Wm)){let r=`<unknown>`;try{r=JSON.parse(Jd)}catch{}F(365,String(e-l.length+(t.nodes?t.nodes.length:0)),typeof n==`function`?`${n.name}${typeof n.getType==`function`?` (type ${String(n.getType())})`:``}`:String(n),String(r))}Ey(n);let a=n.getType(),o=m_(n);m.set(a,{exportDOM:f&&f.export?f.export.get(n):void 0,klass:n,replace:r,replaceWithKlass:i,sharedNodeState:ff(l[e]),transforms:o})}}let h=new y_(o,i,m,{disableEvents:a,dom:{...h_,...e&&e.dom},namespace:s,theme:r},u||console.error,d||f_,function(e,t){let n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Set,i=e=>{Object.keys(e).forEach(t=>{let r=n.get(t);r===void 0&&(r=[],n.set(t,r)),r.push(e[t])})};return e.forEach(e=>{let t=e.klass.importDOM;if(t==null||r.has(t))return;r.add(t);let n=t.call(e.klass);n!==null&&i(n)}),t&&i(t),n}(m,f?f.import:void 0),p,e);return c!==void 0&&(h._pendingEditorState=c,h._dirtyType=2),function(e){e.registerCommand(Sp,Dm,0),e.registerCommand(Cp,Om,0),e.registerCommand(wp,km,0),e.registerCommand(Tp,Am,0),e.registerCommand(Lp,Nm,0)}(h),h}function __(e,t){let n=e.get(t);e.delete(t),n&&n()}function v_(e,t,n){return e.set(t,n),__.bind(null,e,t)}var y_=class{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_cascadeCount;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_onWarn;_htmlConversions;_window;_editable;_blockCursorElement;_slotsUsed;_inputState;_createEditorArgs;constructor(e,t,n,r,i,a,o,s,c){this._createEditorArgs=c,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Zd,this._updates=[],this._updating=!1,this._cascadeCount=0,this._listeners={decorator:/* @__PURE__ */ new Map,editable:/* @__PURE__ */ new Map,mutation:/* @__PURE__ */ new Map,root:/* @__PURE__ */ new Map,textcontent:/* @__PURE__ */ new Map,update:/* @__PURE__ */ new Map},this._commands=/* @__PURE__ */ new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=/* @__PURE__ */ new Set,this._dirtyLeaves=/* @__PURE__ */ new Set,this._dirtyElements=/* @__PURE__ */ new Map,this._normalizedNodes=/* @__PURE__ */ new Set,this._updateTags=/* @__PURE__ */ new Set,this._observer=null,this._key=nv(),this._onError=i,this._onWarn=a,this._htmlConversions=o,this._editable=s,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null,this._slotsUsed=!1,this._inputState={collapsedSelectionFormat:{format:0,key:`root`,offset:0,style:``,timeStamp:0},compositionEndData:``,compositionPhase:`idle`,hadOrphanedCompositionEvents:!1,handledSelectionCommandTimeoutId:null,isInsertLineBreak:!1,isInsertTextAfterHandledSelectionCommand:!1,isSelectionChangeFromDOMUpdate:!1,isSelectionChangeFromMouseDown:!1,lastBeforeInputInsertTextTimeStamp:0,lastKeyCode:null,lastKeyDownTimeStamp:0,postDeleteSelectionToRestore:null,unprocessedBeforeInputData:null}}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){return v_(this._listeners.update,e)}registerEditableListener(e){return v_(this._listeners.editable,e)}registerDecoratorListener(e){return v_(this._listeners.decorator,e)}registerTextContentListener(e){return v_(this._listeners.textcontent,e)}registerRootListener(e){let t=this._listeners.root;return tx(v_(t,e,e(this._rootElement,null)||void 0),()=>function(e,t,n){let r=e.get(t);r&&r(),e.set(t,t(...n)||void 0)}(t,e,[null,this._rootElement]))}registerCommand(e,t,n){n===void 0&&F(35);let r=this._commands;r.has(e)||r.set(e,[new Yd,new Yd,new Yd,new Yd,new Yd]);let i=r.get(e);i===void 0&&F(36,String(e));let a=function(e){return 7&e}(n),o=i[a];return a===n?o.addBack(t):o.addFront(t),()=>{o.delete(t),i.every(e=>e.size===0)&&r.delete(e)}}registerMutationListener(e,t,n){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation,a=i.get(t);a===void 0&&(a=/* @__PURE__ */ new Set,i.set(t,a)),a.add(r);let o=n&&n.skipInitialization;return o!==void 0&&o||this.initializeMutationListener(t,r),()=>{a.delete(r),a.size===0&&i.delete(t)}}getRegisteredNode(e){let t=this._nodes.get(e.getType());return t===void 0&&F(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){let n=this._editorState,r=py(n).get(t.getType());if(!r)return;let i=/* @__PURE__ */ new Map;for(let e of r.keys())i.set(e,`created`);i.size>0&&e(i,{dirtyLeaves:/* @__PURE__ */ new Set,prevEditorState:n,updateTags:/* @__PURE__ */ new Set([`registerMutationListener`])})}registerNodeTransformToKlass(e,t){let n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){let n=this.registerNodeTransformToKlass(e,t),r=[n],i=n.replaceWithKlass;if(i!=null){let e=this.registerNodeTransformToKlass(i,t);r.push(e)}return function(e,t){let n=py(e.getEditorState()),r=[];for(let e of t){let t=n.get(e);t&&r.push(t)}r.length!==0&&e.update(()=>{for(let e of r)for(let t of e.keys()){let e=U_(t);e&&e.markDirty()}},e._pendingEditorState===null?{tag:Km}:void 0)}(this,r.map(e=>e.klass.getType())),()=>{r.forEach(e=>e.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,...t){return K(this,e,...t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){let t=this._rootElement;if(e!==t){let n=pv(this._config.theme,`root`),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,p_(this,t,e,r,{preserveUpdateQueue:!0}),t!==null&&(this._config.disableEvents||zm(t),n!=null&&t.classList.remove(...n)),e!==null){let t=wv(e),r=e.style;r.userSelect=`text`,r.whiteSpace=`pre-wrap`,r.wordBreak=`break-word`,e.setAttribute(`data-lexical-editor`,`true`),this._window=t,this._dirtyType=2,lf(this),this._updateTags.add(Km),Ig(this),this._config.disableEvents||function(e,t){let n=e.ownerDocument;mm.set(e,n);let r=hm.get(n);r===void 0&&(r={editors:/* @__PURE__ */ new Set,hasShadowEditor:void 0},hm.set(n,r)),r.editors.add(t),r.hasShadowEditor=void 0,e.__lexicalEditor=t;let i=Pm(e);i.push(gm.register(n));for(let n=0;n<pm.length;n++){let[r,a]=pm[n],o=typeof a==`function`?e=>{Rm(e)||(Lm(e),(t.isEditable()||r===`click`)&&a(e,t))}:e=>{if(Rm(e))return;Lm(e);let n=t.isEditable();switch(r){case`cut`:return n&&K(t,tm,e);case`copy`:return K(t,em,e);case`paste`:return n&&K(t,Ap,e);case`dragstart`:return n&&K(t,Zp,e);case`dragover`:return n&&K(t,Qp,e);case`dragend`:return n&&K(t,$p,e);case`focus`:return n&&K(t,sm,e);case`blur`:return n&&K(t,cm,e);case`drop`:return n&&K(t,Xp,e)}};i.push(dm(e,r,o))}}(e,this),n!=null&&e.classList.add(...n)}else this._window=null,this._updateTags.add(Km),Ig(this);Lg(`root`,this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&F(38);let n=e;n._readOnly&&(n=Yg(e),n._selection=e._selection?e._selection.clone():null),cf(this);let r=this._pendingEditorState,i=t===void 0?null:t.tag;r===null||r.isEmpty()||(i!=null&&this._updateTags.add(i),Ig(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set(`root`,!1),this._compositionKey=null,this._slotsUsed=this._slotsUsed||e._slotsUsed,Hg(this,()=>{if(i&&this._updateTags.add(i),e._parsed)for(let[e,t]of n._nodeMap.entries())U(t)?this._dirtyElements.set(e,!0):this._dirtyLeaves.add(e)},{discrete:!this._updating||void 0})}parseEditorState(e,t){return function(e,t,n){let r=Xg(),i=hg,a=_g,o=gg,s=t._dirtyElements,c=t._dirtyLeaves,l=t._cloneNotNeeded,u=t._dirtyType;t._dirtyElements=/* @__PURE__ */ new Map,t._dirtyLeaves=/* @__PURE__ */ new Set,t._cloneNotNeeded=/* @__PURE__ */ new Set,t._dirtyType=0,hg=r,_g=!1,gg=t,x_(null);try{let i=t._nodes;Pg(e.root,i),n&&n(),r._readOnly=!0,r._parsed=!0}catch(e){e instanceof Error&&t._onError(e)}finally{t._dirtyElements=s,t._dirtyLeaves=c,t._cloneNotNeeded=l,t._dirtyType=u,hg=i,_g=a,gg=o}return r}(typeof e==`string`?JSON.parse(e):e,this,t)}read(...e){let[t,n]=e.length===1?[`force-commit`,e[0]]:e;return t===`force-commit`&&Ig(this),(t===`pending`?this._pendingEditorState||this._editorState:this.getEditorState()).read(n,{editor:this})}update(e,t){(function(e,t,n){e._updating?e._updates.push([t,n]):Vg(e,t,n)})(this,e,t)}focus(e,t={}){let n=this._rootElement;n!==null&&(n.setAttribute(`autocapitalize`,`off`),Hg(this,()=>{let r=V(),i=X_();r===null?i.getChildrenSize()!==0&&(t.defaultSelection===`rootStart`?i.selectStart():i.selectEnd()):r.dirty||Z_(r.clone()),xv(`focus`),Sv(()=>{n.removeAttribute(`autocapitalize`),e&&e()})}),this._pendingEditorState===null&&n.removeAttribute(`autocapitalize`))}blur(){let e=this._rootElement;e!==null&&e.blur();let t=Iv(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Lg(`editable`,this,!0,e),this._slotsUsed&&this.update(()=>Og()))}toJSON(){return{editorState:this._editorState.toJSON()}}};y_.version=Jd;let b_=null;function x_(e){b_=e}let S_=Symbol(`INTERNAL_SKIP_AFTER_CLONE_FROM`),C_=1;function w_(e,t){let n=T_(e,t);return n===void 0&&F(30,t),n}function T_(e,t){return e._nodes.get(t)}let E_=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)};function D_(e,t){let n=t===void 0?(()=>{let t=e.getRootNode();return F_(t)||Rv(t)?Zv(t):null})():t;if(!q(n)||n.hasAttribute(`data-lexical-slot`))return!1;let r=q_(n),i=n.nodeName;return Gm(r)&&(i===`INPUT`||i===`TEXTAREA`||n.contentEditable===`true`&&j_(n)==null)}function O_(e,t,n){let r=e.getRootElement();if(!r)return!1;try{if(!t||!r.contains(t)||!r.contains(n))return!1}catch{return!1}return A_(t)===e&&e.read(`latest`,()=>!D_(t))}function k_(e){return e instanceof y_}function A_(e){let t=e;for(;t!=null;){let e=j_(t);if(k_(e))return e;t=yv(t)}return null}function j_(e){return e?e.__lexicalEditor:null}function M_(e){return bh(e)||e.isToken()}function N_(e){return M_(e)||e.isSegmented()}function P_(e){return $v(e)&&e.nodeType===3}function F_(e){return $v(e)&&e.nodeType===9}function I_(e){let t=e;for(;t!=null;){if(P_(t))return t;t=t.firstChild}return null}function L_(e,t,n){let r=Pd[t];if(n!==null&&(e&r)===(n&r))return e;let i=e^r;return t===`subscript`?i&=~Pd.superscript:t===`superscript`?i&=~Pd.subscript:t===`lowercase`?(i&=~Pd.uppercase,i&=~Pd.capitalize):t===`uppercase`?(i&=~Pd.lowercase,i&=~Pd.capitalize):t===`capitalize`&&(i&=~Pd.lowercase,i&=~Pd.uppercase),i}function R_(e,t){let n=function(){let e=b_;return b_=null,e}();if((t||=n&&n.__key)!=null)return void(e.__key=t);wg(),Tg();let r=H(),i=Eg(),a=``+C_++;i._nodeMap.set(a,e),U(e)?r._dirtyElements.set(a,!0):r._dirtyLeaves.add(a),r._cloneNotNeeded.add(a),r._dirtyType===0&&(r._dirtyType=1),e.__key=a}function z_(e){Fy(e)!==null&&F(380,e.__key,String(Fy(e)));let t=e.getParent();if(t!==null){let n=e.getWritable(),r=t.getWritable(),i=e.getPreviousSibling(),a=e.getNextSibling(),o=a===null?null:a.__key,s=i===null?null:i.__key,c=i===null?null:i.getWritable(),l=a===null?null:a.getWritable();i===null&&(r.__first=o),a===null&&(r.__last=s),c!==null&&(c.__next=o),l!==null&&(l.__prev=s),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function B_(e){Tg(),Hm(e)&&F(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent===null?Py(t)?t.__slotHost:null:t.__parent,r=Eg(),i=H(),a=r._nodeMap,o=i._dirtyElements;n!==null&&function(e,t,n){let r=e;for(;r!==null;){if(n.has(r))return;let e=t.get(r);if(e===void 0)break;n.set(r,!1),r=e.__parent===null?Py(e)?e.__slotHost:null:e.__parent}}(n,a,o);let s=t.__key;i._dirtyType===0&&(i._dirtyType=1),U(e)?o.set(s,!0):i._dirtyLeaves.add(s)}function V_(e){wg();let t=H(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let e=U_(n);e!==null&&e.getWritable()}if(e!==null){let t=U_(e);t!==null&&t.getWritable()}}}function H_(){return Cg()?null:H()._compositionKey}function U_(e,t){let n=(t||Eg())._nodeMap.get(e);return n===void 0?null:n}function W_(e,t){let n=K_(e,H());return n===void 0?null:U_(n,t)}function G_(e,t,n){e[`__lexicalKey_${t._key}`]=n}function K_(e,t){return e[`__lexicalKey_${t._key}`]}function q_(e,t){let n=e;for(;n!=null;){let e=W_(n,t);if(e!==null)return e;n=yv(n)}return null}function J_(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function Y_(e){return e.read(()=>X_().getTextContent())}function X_(){return Eg()._nodeMap.get(`root`)}function Z_(e){wg();let t=Eg();e!==null&&(e.dirty=!0,e.setCachedNodes(null),B(e)&&H()._slotsUsed&&Kh(e)),t._selection=e}function Q_(){wg(),cf(H())}function $_(e){let t=function(e,t){let n=e;for(;n!=null;){let e=K_(n,t);if(e!==void 0)return e;n=yv(n)}return null}(e,H());return t===null?null:U_(t)}function ev(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function tv(e){let t=[];for(let n=e;n!==null;n=n._parentEditor)t.push(n);return t}function nv(){return Math.random().toString(36).replace(/[^a-z]+/g,``).substring(0,5)}function rv(e){return P_(e)?e.nodeValue:null}function iv(e,t,n){let r=Iv(Tv(t));if(r===null)return;let i=Kv(r,t._rootElement),a=i.anchorNode,{anchorOffset:o,focusOffset:s}=i;if(a!==null){let t=rv(a),r=q_(a);if(t!==null&&z(r)){if((t===Ad||t===jd)&&n){let e=n.length;t=n,o=e,s=e}t!==null&&av(r,t,o,s,e)}}}function av(e,t,n,r,i){let a=e;if(a.isAttached()&&(i||!a.isDirty())){let o=a.isComposing();if(a.isToken()&&o)return;let s=t;if((o||i)&&(t.endsWith(Ad)&&(s=t.slice(0,-Ad.length)),i)){let e=jd,t;for(;(t=s.indexOf(e))!==-1;)s=s.slice(0,t)+s.slice(t+e.length),n!==null&&n>t&&(n=Math.max(t,n-e.length)),r!==null&&r>t&&(r=Math.max(t,r-e.length))}let c=a.getTextContent();if(i||s!==c){let t=V();if(s===``){if(V_(null),Ed||wd||kd)a.remove();else{let e=H();ov(a,``,t),setTimeout(()=>{e.update(()=>{a.isAttached()&&a.getTextContent()===``&&a.remove()})},20)}return}let i=a.getParent(),c=$h(),l=a.getTextContentSize(),u=H_(),d=a.getKey();if(a.isToken()&&!o||u!==null&&d===u&&!o||B(c)&&(i!==null&&!i.canInsertTextBefore()&&c.anchor.offset===0||c.anchor.key===e.__key&&c.anchor.offset===0&&!a.canInsertTextBefore()&&!o||c.focus.key===e.__key&&c.focus.offset===l&&!a.canInsertTextAfter()&&!o))return void a.markDirty();if(!B(t)||n===null||r===null)return void ov(a,s,t);if(t.setTextNodeRange(a,n,a,r),a.isSegmented()){let e=gh(a.getTextContent());a.replace(e),a=e}ov(a,s,t)}}}function ov(e,t,n){if(e.setTextContent(t),B(n)){let t=e.getKey(),r=!1;for(let i of[`anchor`,`focus`]){let a=n[i];a.type===`text`&&a.key===t&&(a.offset=gb(e,a.offset,`clamp`),r=!0)}r&&(n._cachedNodes=null,n._cachedIsBackward=null)}}function sv(e,t,n){let r=t[n]||!1;return r===`any`||r===e[n]}function cv(e,t){return sv(e,t,`altKey`)&&sv(e,t,`ctrlKey`)&&sv(e,t,`shiftKey`)&&sv(e,t,`metaKey`)}function G(e,t,n){if(!cv(e,n))return!1;if(e.key.toLowerCase()===t.toLowerCase())return!0;if(t.length>1||e.key.length===1&&e.key.charCodeAt(0)<=127)return!1;if(e.code.startsWith(`Digit`)&&/^\d$/.test(t))return e.code===`Digit${t}`;let r=`Key`+t.toUpperCase();return e.code===r}let lv={ctrlKey:!xd,metaKey:xd},uv={altKey:xd,ctrlKey:!xd};function dv(e){return e.key===`Backspace`}function fv(e){let t=X_();if(B(e)){let t=e.anchor,n=e.focus,r=t.getNode();if(Jg(r))return t.set(r.getKey(),0,`element`),n.set(r.getKey(),r.getChildrenSize(),`element`),Tf(e),e;let i=r.getTopLevelElementOrThrow(),a=i.getParent();if(a===null)return U(i)&&(t.set(i.getKey(),0,`element`),n.set(i.getKey(),i.getChildrenSize(),`element`),Tf(e)),e;let o=a;return t.set(o.getKey(),0,`element`),n.set(o.getKey(),o.getChildrenSize(),`element`),Tf(e),e}{let e=t.select(0,t.getChildrenSize());return Z_(Tf(e)),e}}function pv(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let n=e.__lexicalClassNameCache,r=n[t];if(r!==void 0)return r;let i=e[t];if(typeof i==`string`){let e=$b(i);return n[t]=e,e}return i}function mv(e,t,n,r,i){if(n.size===0)return;let a=r.__type,o=r.__key,s=t.get(a);s===void 0&&F(33,a);let c=s.klass,l=e.get(c);l===void 0&&(l=/* @__PURE__ */ new Map,e.set(c,l));let u=l.get(o),d=u===`destroyed`&&i===`created`;(u===void 0||d)&&l.set(o,d?`updated`:i)}function hv(e,t,n){let r=e.getParent(),i=n,a=e;return r!==null&&(t&&n===0?(i=a.getIndexWithinParent(),a=r):t||n!==a.getChildrenSize()||(i=a.getIndexWithinParent()+1,a=r)),a.getChildAtIndex(t?i-1:i)}function gv(e,t){let n=e.offset;if(e.type===`element`)return hv(e.getNode(),t,n);{let r=e.getNode();if(t&&n===0||!t&&n===r.getTextContentSize()){let e=t?r.getPreviousSibling():r.getNextSibling();return e===null?hv(r.getParentOrThrow(),t,r.getIndexWithinParent()+ +!t):e}}return null}function _v(e){let t=Tv(e).event,n=t&&t.inputType;return n===`insertFromPaste`||n===`insertFromPasteAsQuotation`}function K(e,t,...n){return Rg(e,t,n[0],e)}function vv(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&F(75,t),n}function yv(e){let t=e.assignedSlot||e.parentElement;if(t!==null)return t;let n=e.parentNode;return Rv(n)?n.host:null}function bv(e){return F_(e)?e:q(e)?e.ownerDocument:null}function xv(e){wg(),H()._updateTags.add(e)}function Sv(e){wg(),H()._deferred.push(e)}function Cv(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function wv(e){let t=bv(e);return t?t.defaultView:null}function Tv(e){let t=e._window;return t===null&&F(78),t}function Ev(e){return U(e)&&e.isInline()||W(e)&&e.isInline()}function Dv(e){let t=e.getLatest();for(;t!==null;){if(Fy(t)!==null&&U(t))return t;let e=t.getParentOrThrow();if(kv(e))return e;t=e}return t}function Ov(e){return U(e)&&e.isShadowRoot()}function kv(e){return Jg(e)||Ov(e)}function Av(e,t=!1){let n=e.constructor.clone(e,S_);return R_(n,null),n.afterCloneFrom(e),t||n.resetOnCopyNodeFrom(e),n}function jv(e){let t=H(),n=e.getType(),r=T_(t,n);r===void 0&&F(200,e.constructor.name,n);let{replace:i,replaceWithKlass:a}=r;if(i!==null){let t=i(e),r=t.constructor;return a===null?t instanceof e.constructor&&r!==e.constructor||F(202,r.name,r.getType(),e.constructor.name,n):t instanceof a||F(201,a.name,a.getType(),r.name,r.getType(),e.constructor.name,n),t.__key===e.__key&&F(203,e.constructor.name,n,r.name,r.getType()),t}return e}function Mv(e,t){!Jg(e.getParent())||U(t)||W(t)||F(99)}function Nv(e){let t=U_(e);return t===null&&F(63,e),t}function Pv(e){if(!e||e.isInline())return!1;if(W(e))return!0;if(U(e)){if(e.isShadowRoot()){let t=e.getParent();return!(U(t)&&t.isShadowRoot())}return!e.canBeEmpty()}return!1}function Fv(e,t,n){n.style.removeProperty(`caret-color`),t._blockCursorElement=null;let r=e.parentElement;r!==null&&r.removeChild(e)}function Iv(e){return yd?(e||window).getSelection():null}function Lv(e){let t=wv(e);return t?t.getSelection():null}function Rv(e){return ey(e)&&`host`in e}let zv=[];function Bv(e){let t=e.getRootNode();if(t===e||!Rv(t))return zv;let n=[t],r=t.host;for(;;){let e=r.getRootNode();if(e===r||!Rv(e))break;n.push(e),r=e.host}return n}function*Vv(e){let t=[e],n;for(;n=t.pop();){yield*n.querySelectorAll(`[data-lexical-editor="true"]`);let e=(F_(n)?n:n.ownerDocument).createTreeWalker(n,NodeFilter.SHOW_ELEMENT),r;for(;r=e.nextNode();)r.shadowRoot&&t.push(r.shadowRoot)}}function Hv(e){return e===null?document:e.ownerDocument}function Uv(){let e=Ag();return Hv(e===null?null:e._rootElement)}function Wv(e,t){if(t===null||typeof e.getComposedRanges!=`function`)return null;let n=Bv(t);if(n.length===0)return null;let r=e.getComposedRanges;try{let t=r.call(e,{shadowRoots:n})[0];if(t!==void 0)return t}catch{}try{let t=r.apply(e,n)[0];if(t!==void 0)return t}catch{}return null}function Gv(e,t){let n=Wv(e,t);if(n!==null){let e=qv(n);if(e!==null)return e}return e.rangeCount>0?e.getRangeAt(0):null}function Kv(e,t){let n=Wv(e,t);return n===null?e:Jv(n,Yv(e))}function qv(e){let t=e.startContainer.ownerDocument;if(t===null)return null;let n=t.createRange();try{return n.setStart(e.startContainer,e.startOffset),n.setEnd(e.endContainer,e.endOffset),n}catch{return null}}function Jv(e,t){let{startContainer:n,startOffset:r,endContainer:i,endOffset:a}=e;return t===`backward`?{anchorNode:i,anchorOffset:a,direction:t,focusNode:n,focusOffset:r}:{anchorNode:n,anchorOffset:r,direction:t,focusNode:i,focusOffset:a}}function Yv(e){return e.direction}function Xv(e){let t=e.getRootNode();return F_(t)||Rv(t)?t.activeElement:null}function Zv(e){let t=e.activeElement;for(;t!==null&&t.shadowRoot!==null;){let e=t.shadowRoot.activeElement;if(e===null)break;t=e}return t}function Qv(e){let t=e.target;if(t!==null&&q(t)&&t.shadowRoot!==null&&typeof e.composedPath==`function`){let t=e.composedPath();if(t.length>0)return t[0]}return t}function q(e){return $v(e)&&e.nodeType===1}function $v(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function ey(e){return $v(e)&&e.nodeType===11}let ty=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/i;function ny(e){return!(!q(e)||!e.style.display.startsWith(`inline`))||ty.test(e.nodeName)}let ry=/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/i;function iy(e){return(!q(e)||!e.style.display.startsWith(`inline`))&&ry.test(e.nodeName)}function ay(e){if(W(e)&&!e.isInline())return!0;if(!U(e)||kv(e))return!1;let t=e.getFirstChild(),n=t===null||i_(t)||z(t)||t.isInline();return!e.isInline()&&!1!==e.canBeEmpty()&&n}function oy(){return H()}function sy(e=oy()){return e._config.dom||h_}function cy(e,t,n=oy()){let r=sy(n).$getDOMSlot(e,t,n);return U(e)&&(ly(r)||F(344,e.getKey(),e.getType())),r}function ly(e){return e instanceof Gd}function uy(e,t,n=oy()){return I_(cy(e,t,n).element)}let dy=/* @__PURE__ */ new WeakMap,fy=/* @__PURE__ */ new Map;function py(e){if(!e._readOnly&&e.isEmpty())return fy;e._readOnly||F(192);let t=dy.get(e);return t||(t=function(e){let t=/* @__PURE__ */ new Map;for(let[n,r]of e._nodeMap){let e=r.__type,i=t.get(e);i||(i=/* @__PURE__ */ new Map,t.set(e,i)),i.set(n,r)}return t}(e),dy.set(e,t)),t}function my(e){let t=e.constructor.clone(e,S_);return t.afterCloneFrom(e),t}function hy(e){return(t=my(e))[Vm]=!0,t;var t}function gy(e,t){let n=e.getAttribute(`data-lexical-indent`);if(n!==null){let e=parseInt(n,10);if(Number.isFinite(e)&&e>=0)return void t.setIndent(e)}let r=parseInt(e.style.paddingInlineStart,10)||0,i=Math.round(r/40);t.setIndent(i)}function _y(e,t){let n=t.getAttribute(`dir`);return n===`ltr`||n===`rtl`?e.setDirection(n):e}function vy(e,t){let n=t.style.textAlign;return n&&n in Id?e.setFormat(n):e}function yy(e,t){e.__lexicalUnmanaged=!0,t&&t.captureSelection!==void 0&&(e.__lexicalCapturedSelection=t.captureSelection)}function by(e){return!0===e.__lexicalUnmanaged}function xy(e,t=oy()){let n=t.isEditable();e.contentEditable=n?`true`:`false`,n?e.__lexicalEditor=t:delete e.__lexicalEditor}function Sy(e,t){let n=e;for(;n!=null;){if(!0===n.__lexicalCapturedSelection)return!0;if(q(n)&&n.hasAttribute(`data-lexical-slot`)||K_(n,t)!==void 0)return!1;n=yv(n)}return!1}function Cy(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)&&e[t]!==Wm[t]}let wy=/* @__PURE__ */ new WeakMap,Ty=Symbol(`lexical.synthesizedGetType`);function Ey(e){let t=wy.get(e);if(t)return t;let n=e.prototype!=null&&Bd in e.prototype?e.prototype[Bd]():void 0,r=function(e){if(!(e===Wm||e.prototype instanceof Wm)){let t=`<unknown>`,n=`<unknown>`;try{t=e.getType()}catch{}try{y_.version&&(n=JSON.parse(y_.version))}catch{}F(290,e.name,t,n)}return e===Kg||e===Wg||e===Wm}(e),i=!r&&Cy(e,`getType`)?e.getType:void 0,a=i&&!(Ty in i)?i.call(e):void 0,o,s=a;if(n){if(a)o=n[a];else{for(let[e,t]of Object.entries(n))s=e,o=t;if(!o)for(let e of Object.getOwnPropertySymbols(n)){let t=n[e];if(t){o=t;break}}}}if(!r&&s){if(!Cy(e,`getType`)){let t=e,n=function(){return this===t?s:Wm.getType.call(this)};n[Ty]=!0,e.getType=n}if(Cy(e,`clone`)||(e.clone=(t,n)=>{x_(t);let r=new e;return n!==S_&&r.afterCloneFrom(t),r}),Cy(e,`importJSON`)||(e.importJSON=o&&o.$importJSON||(t=>new e().updateFromJSON(t))),!Cy(e,`importDOM`)&&o){let{importDOM:t}=o;t&&(e.importDOM=()=>t)}}let c={klass:e,ownNodeConfig:o,ownNodeType:s};return wy.set(e,c),c}function*Dy(e){for(let t=e;t&&(t===Wm||Gm(t.prototype));){let e=Ey(t);yield e,t=e.ownNodeConfig&&e.ownNodeConfig.extends||jy(t)}}function Oy(e){let t=oy();return wg(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}let ky=(e,t)=>{let n=e;for(;n!=null&&!Jg(n);){if(t(n))return n;n=n.getParent()}return null};function Ay(e,t){let n=[],r=e.__first;for(;r!==null;){let e=t===null?U_(r):t.get(r);e??F(174),n.push(r),r=e.__next}return n}function jy(e){let t=Object.getPrototypeOf(e);if(typeof t==`function`&&t!==Function.prototype)return t;let n=e.prototype&&Object.getPrototypeOf(e.prototype);return n?n.constructor:null}let My=/* @__PURE__ */ new Map;function Ny(e){return U(e)||W(e)}function Py(e){return U(e)||W(e)}function Fy(e){let t=e.getLatest();return Py(t)?t.__slotHost:null}function Iy(e){let t=Fy(e);if(t===null)return null;let n=U_(t);return U(n)||W(n)||F(370),n}function Ly(e){let t=Iy(e);if(t===null)return null;let n=e.getLatest().__key;for(let[e,r]of zy(t))if(r===n)return e;return null}function Ry(e){let t=e.getLatest();for(;t!==null;){if(Fy(t)!==null)return t;t=t.getParent()}return null}function zy(e){let t=e.getLatest();return Ny(t)&&t.__slots!==null?t.__slots:My}function By(e){return Array.from(zy(e).keys())}function Vy(e,t){let n=zy(e).get(t);return n===void 0?null:U_(n)}let Hy=[`__proto__`,`constructor`,`prototype`],Uy=Symbol(`slotMapOwner`);function Wy(e){let t=e.__slots;return t!==null&&t[Uy]===e||(t=new Map(t),t[Uy]=e,e.__slots=t),t}let Gy=/* @__PURE__ */ new WeakMap,Ky=[];function qy(e){for(let{ownNodeConfig:t}of Dy(e)){let e=t&&t.slots;if(e)return e}return Ky}function Jy(e){let t=``;for(let n of By(e)){let r=Vy(e,n);r!==null&&(t+=r.getTextContent())}return t}function Yy(e,t,n){let r=n.get(e),i=n.get(t);return r===void 0?i===void 0?e<t?-1:+(e>t):1:i===void 0?-1:r-i}function Xy(e){let t=e.__slots;if(t===null||t.size<2)return;let n=function(e){let t=Gy.get(e);if(t===void 0){let n=qy(e),r=/* @__PURE__ */ new Map;for(let t of n)Hy.includes(t)&&F(371,e.name,t),r.has(t)&&F(372,e.name,t),r.set(t,r.size);t=r,Gy.set(e,t)}return t}(e.constructor),r=null,i=!0;for(let e of t.keys()){if(r!==null&&Yy(r,e,n)>0){i=!1;break}r=e}if(i)return;let a=Array.from(t).sort(([e],[t])=>Yy(e,t,n));t.clear();for(let[e,n]of a)t.set(e,n)}function Zy(e,t,n){t!==`__proto__`&&t!==`constructor`&&t!==`prototype`||F(373,t);let r=e.getLatest();if(r.__slots!==null&&r.__slots.get(t)===n.getLatest().__key)return r;(!U(n)&&!W(n)||n.isInline())&&F(374,n.__key);let i=e.getWritable(),a=Wy(i),o=a.get(t);o!==void 0&&$y(o);let s=n.getWritable(),c=Iy(s);if(c!==null){let e=Ly(s);e!==null&&Wy(c.getWritable()).delete(e),s.__slotHost=null}return z_(s),s.__slotHost=i.__key,a.set(t,s.__key),Xy(i),function(){let e=oy();e._slotsUsed=!0,e._pendingEditorState&&(e._pendingEditorState._slotsUsed=!0)}(),i}function Qy(e,t){let n=e.getWritable();if(n.__slots===null)return n;let r=n.__slots.get(t);return r!==void 0&&($y(r),Wy(n).delete(t)),n}function $y(e){let t=U_(e);if(t===null)return;let n=t.getWritable();Py(n)||F(377,e),n.__slotHost=null,n.remove()}let eb={next:`previous`,previous:`next`};var tb=class{origin;constructor(e){this.origin=e}[Symbol.iterator](){return Eb({hasNext:lb,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return mb(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return mb(this.origin,this.direction)}remove(){let e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,t){let n=this.getNodeAtCaret();return e.is(this.origin)||e.is(n)||(n===null?this.insert(e):n.replace(e,t)),this}splice(e,t,n=`next`){let r=n===this.direction?t:Array.from(t).reverse(),i=this,a=this.getParentAtCaret(),o=/* @__PURE__ */ new Map;for(let t=i.getAdjacentCaret();t!==null&&o.size<e;t=t.getAdjacentCaret()){let e=t.origin.getWritable();o.set(e.getKey(),e)}for(let e of r){if(o.size>0){let t=i.getNodeAtCaret();if(t){if(o.delete(t.getKey()),o.delete(e.getKey()),!(t.is(e)||i.origin.is(e))){let n=e.getParent();n&&n.is(a)&&e.remove(),t.replace(e)}}else t===null&&F(263,Array.from(o).join(` `))}else i.insert(e);i=mb(e,this.direction)}for(let e of o.values())e.remove();return this}},nb=class e extends tb{type=`child`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:vb(e,this.direction)}getParentCaret(e=`root`){return mb(ab(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=ib(this.direction);return mb(this.getNodeAtCaret(),e)||vb(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}};let rb={root:Jg,shadowRoot:kv};function ib(e){return eb[e]}function ab(e,t=`root`){return e===null||rb[t](e)?null:Fy(e)===null?e:null}var ob=class e extends tb{type=`sibling`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:mb(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return U(this.origin)?vb(this.origin,this.direction):null}getParentCaret(e=`root`){return mb(ab(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=ib(this.direction);return mb(this.getNodeAtCaret(),e)||vb(this.origin.getParentOrThrow(),e)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof e||t instanceof sb)&&this.direction===t.direction&&this.origin.is(t.origin)}},sb=class e extends tb{type=`text`;offset;constructor(e,t){super(e),this.offset=t}getLatest(){let e=this.origin.getLatest();return e===this.origin?this:hb(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e=`root`){return mb(ab(this.getParentAtCaret(),e),this.direction)}getFlipped(){return hb(this.origin,ib(this.direction),this.offset)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof ob||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return mb(this.origin,this.direction)}};function cb(e){return e instanceof sb}function lb(e){return e instanceof ob}function ub(e){return e instanceof nb}let db={next:class extends sb{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends sb{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},fb={next:class extends ob{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends ob{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},pb={next:class extends nb{direction=`next`;getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends nb{direction=`previous`;getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function mb(e,t){return e?new fb[t](e):null}function hb(e,t,n){return e?new db[t](e,gb(e,n)):null}function gb(e,t,n=`error`){let r=e.getTextContentSize(),i=t===`next`?r:t===`previous`?0:t;return(i<0||i>r)&&(n!==`clamp`&&vd(284,String(t),String(r),e.getKey()),i=i<0?0:r),i}function _b(e,t){return new Sb(e,t)}function vb(e,t){return U(e)?new pb[t](e):null}function yb(e){return e&&e.getChildCaret()||e}function bb(e){return e&&yb(e.getAdjacentCaret())}var xb=class e{type=`node-caret-range`;direction;anchor;focus;constructor(e,t,n){this.anchor=e,this.focus=t,this.direction=n}getLatest(){let t=this.anchor.getLatest(),n=this.focus.getLatest();return t===this.anchor&&n===this.focus?this:new e(t,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let e=e=>{let t=this[e].getLatest();return cb(t)?function(e,t){let{direction:n,origin:r}=e;return _b(e,gb(r,t===`focus`?ib(n):n)-e.offset)}(t,e):null},t=e(`anchor`),n=e(`focus`);if(t&&n){let{caret:e}=t,{caret:r}=n;if(e.isSameNodeCaret(r))return[_b(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e=`root`){let t=cb(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=cb(n),i=t=>t.isSameNodeCaret(n)?null:bb(t)||t.getParentCaret(e);return Eb({hasNext:e=>e!==null&&!(r&&n.isSameNodeCaret(e)),initial:t.isSameNodeCaret(n)?null:i(t),map:e=>e,step:i})}[Symbol.iterator](){return this.iterNodeCarets(`root`)}},Sb=class{type=`slice`;caret;distance;constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){let{distance:e,caret:{offset:t}}=this,n=t+e;return n<t?[n,t]:[t,n]}getTextContent(){let[e,t]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,t)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:e,direction:t}}=this,[n,r]=this.getSliceIndices(),i=e.getTextContent();return hb(e.setTextContent(i.slice(0,n)+i.slice(r)),t,n)}};function Cb(e){return Tb(e,mb(X_(),e.direction))}function wb(e){return Tb(e,e)}function Tb(e,t){return e.direction!==t.direction&&F(265),new xb(e,t,e.direction)}function Eb(e){let{initial:t,hasNext:n,step:r,map:i}=e,a=t;return{[Symbol.iterator](){return this},next(){if(!n(a))return{done:!0,value:void 0};let e={done:!1,value:i(a)};return a=r(a),e}}}function Db(e,t){let n=jb(e.origin,t.origin);switch(n===null&&F(275,e.origin.getKey(),t.origin.getKey()),n.type){case`same`:{let n=e.type===`text`,r=t.type===`text`;return n&&r?function(e,t){return Math.sign(e-t)}(e.offset,t.offset):e.type===t.type?0:n?-1:r?1:e.type===`child`?-1:1}case`ancestor`:return e.type===`child`?-1:1;case`descendant`:return t.type===`child`?1:-1;case`branch`:return Ob(n)}}function Ob(e){let{a:t,b:n}=e,r=t.__key,i=n.__key,a=t,o=n;for(;a&&o;a=a.getNextSibling(),o=o.getNextSibling()){if(a.__key===i)return-1;if(o.__key===r)return 1}return a===null?1:-1}function kb(e,t){return t.is(e)}function Ab(e){return U(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function jb(e,t){if(e.is(t))return{commonAncestor:e,type:`same`};let n=/* @__PURE__ */ new Map;for(let[t,r]=Ab(e);t;r=t,t=t.getParent())n.set(t,r);for(let[r,i]=Ab(t);r;i=r,r=r.getParent()){let a=n.get(r);if(a!==void 0)return a===null?(kb(e,r)||F(276),{commonAncestor:r,type:`ancestor`}):i===null?(kb(t,r)||F(277),{commonAncestor:r,type:`descendant`}):((U(a)||kb(e,a))&&(U(i)||kb(t,i))&&r.is(a.getParent())&&r.is(i.getParent())||F(278),{a,b:i,commonAncestor:r,type:`branch`})}return null}function Mb(e,t){let{type:n,key:r,offset:i}=e,a=Nv(e.key);return n===`text`?(z(a)||F(266,a.getType(),r),hb(a,t,i)):(U(a)||F(267,a.getType(),r),Gb(a,e.offset,t))}function Nb(e,t){let{origin:n,direction:r}=t,i=r===`next`;cb(t)?e.set(n.getKey(),t.offset,`text`):lb(t)?z(n)?e.set(n.getKey(),gb(n,r),`text`):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+ +!!i,`element`):(ub(t)&&U(n)||F(268),e.set(n.getKey(),i?0:n.getChildrenSize(),`element`))}function Pb(e){let t=V(),n=B(t)?t:Xh();return Fb(n,e),Z_(n),n}function Fb(e,t){Nb(e.anchor,t.anchor),Nb(e.focus,t.focus)}function Ib(e){let{anchor:t,focus:n}=e,r=Mb(t,`next`),i=Mb(n,`next`),a=Db(r,i)<=0?`next`:`previous`;return Tb(Ub(r,a),Ub(i,a))}function Lb(e){let{direction:t,origin:n}=e,r=mb(n,ib(t)).getNodeAtCaret();return r?mb(r,t):vb(n.getParentOrThrow(),t)}function Rb(e,t=`root`){let n=[e];for(let r=ub(e)?e.getParentCaret(t):e.getSiblingCaret();r!==null;r=r.getParentCaret(t))n.push(Lb(r));return n}function zb(e){return!!e&&e.origin.isAttached()}function Bb(e,t=`removeEmptySlices`){if(e.isCollapsed())return e;let n=`root`,r=`next`,i=t,a=Wb(e,r),o=Rb(a.anchor,n),s=Rb(a.focus.getFlipped(),n),c=/* @__PURE__ */ new Set,l=[];for(let e of a.iterNodeCarets(n))if(ub(e))c.add(e.origin.getKey());else if(lb(e)){let{origin:t}=e;U(t)&&!c.has(t.getKey())||l.push(t)}let u=/* @__PURE__ */ new Set;for(let e of l){let t=e.getParent();t===null||c.has(t.getKey())||u.add(t),z_(e)}for(let e of u)!e.canBeEmpty()&&!kv(e)&&e.isEmpty()&&e.isAttached()&&e.remove();for(let e of a.getTextSlices()){if(!e)continue;let{origin:t}=e.caret,n=t.getTextContentSize(),a=Lb(mb(t,r)),c=t.getMode();if(Math.abs(e.distance)===n&&i===`removeEmptySlices`||c===`token`&&e.distance!==0)a.remove();else if(e.distance!==0){i=`removeEmptySlices`;let t=e.removeTextSlice(),n=e.caret.origin;if(c===`segmented`){let e=t.origin,n=gh(e.getTextContent()).setStyle(e.getStyle()).setFormat(e.getFormat());a.replaceOrInsert(n),t=hb(n,r,t.offset)}n.is(o[0].origin)&&(o[0]=t),n.is(s[0].origin)&&(s[0]=t.getFlipped())}}let d,f;for(let e of o)if(zb(e)){d=Vb(e);break}for(let e of s)if(zb(e)){f=Vb(e);break}let p=function(e,t,n){if(!e||!t)return null;let r=e.getParentAtCaret(),i=t.getParentAtCaret();if(!r||!i)return null;let a=r.getParents().reverse();a.push(r);let o=i.getParents().reverse();o.push(i);let s=Math.min(a.length,o.length),c=0;for(;c<s&&a[c]===o[c];c++);let l=(e,t)=>{let n;for(let r=c;r<e.length;r++){let i=e[r];if(kv(i))return;!n&&t(i)&&(n=i)}return n},u=l(a,ay),d=u&&l(o,e=>n.has(e.getKey())&&ay(e));return d&&By(d).length>0?null:u&&d?[u,d]:null}(d,f,c);if(p){let[e,t]=p;vb(e,`previous`).splice(0,t.getChildren());let n=t.getParent();for(t.remove(!0);n&&n.isEmpty();){let e=n;n=n.getParent(),e.remove(!0)}}else if(f){let e=function(e){if(ub(e)){let t=e.origin;if(ay(t))return t}else{let t=e.getParentAtCaret();if(t&&ay(t))return t}return null}(f),t=e&&e.getParent(),n=e&&e.getParents().findLast(Ov);if(e&&t&&!Jg(t)&&e.isEmpty()&&c.has(e.getKey())&&By(e).length===0&&(!n||c.has(n.getKey()))){e.remove(!0);let n=t;for(;n&&!Jg(n)&&n.isEmpty();){let e=n.getParent();if(e&&Jg(e)&&e.getChildrenSize()<=1)break;let t=n;n=e,t.remove(!0)}}}let m=[d,f,...o,...s].find(zb);if(m)return wb(Ub(Vb(m),e.direction));F(269,JSON.stringify(o.map(e=>e.origin.__key)))}function Vb(e){let t=function(e){let t=e;for(;ub(t);){let e=bb(t);if(!ub(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(z(t.origin))return cb(t)?t:hb(t.origin,n,n);let r=t.getAdjacentCaret();return lb(r)&&z(r.origin)?hb(r.origin,n,ib(n)):t}function Hb(e){return cb(e)&&e.offset!==gb(e.origin,e.direction)}function Ub(e,t){return e.direction===t?e:e.getFlipped()}function Wb(e,t){return e.direction===t?e:Tb(Ub(e.focus,t),Ub(e.anchor,t))}function Gb(e,t,n){let r=vb(e,`next`);for(let e=0;e<t;e++){let e=r.getAdjacentCaret();if(e===null)break;r=e}return Ub(r,n)}function Kb(e){let{origin:t,offset:n,direction:r}=e;if(n===gb(t,r))return e.getSiblingCaret();if(n===gb(t,ib(r)))return Lb(e.getSiblingCaret());let[i]=t.splitText(n);return z(i)||F(281),Ub(mb(i,`next`),r)}function qb(e,t){return!0}function Jb(e,{$copyElementNode:t=Av,$splitTextPointCaretNext:n=Kb,rootMode:r=`shadowRoot`,$shouldSplit:i=qb,removeEmptyDestination:a=!1}={}){if(cb(e))return n(e);let o=e.getParentCaret(r);if(o){let{origin:n}=o;if(ub(e)){let e=Lb(o);if(a&&n.isEmpty())return n.remove(),e;if(!n.canBeEmpty()||!i(n,`first`))return e}let r=function(e){let t=[];for(let n=e.getAdjacentCaret();n;n=n.getAdjacentCaret())t.push(n.origin);return t}(e);(r.length>0||!a&&n.canBeEmpty()&&i(n,`last`))&&o.insert(t(n).splice(0,0,r))}return o}function Yb(e,t,n){let r=Ub(t,`next`);cb(r)&&(r.offset===0?r=mb(r.origin,`previous`).getFlipped():r.offset===r.origin.getTextContentSize()&&(r=mb(r.origin,`next`))),r.origin.is(e)&&(lb(r)||F(342,e.getKey(),e.getType()),r=Lb(r)),(e.is(r.getNodeAtCaret())||e.is(r.getFlipped().getNodeAtCaret()))&&e.remove(!0);for(let e=r;e;e=Jb(e,n))r=e;return cb(r)&&F(283),r.insert(e.isInline()?u_().append(e):e),Ub(mb(e.getLatest(),`next`),t.direction)}function Xb(e){return e}function Zb(e){return e}function Qb(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function $b(...e){let t=[];for(let n of e)if(n&&typeof n==`string`)for(let[e]of n.matchAll(/\S+/g))t.push(e);return t}function ex(e,...t){let n=$b(...t);n.length>0&&e.classList.add(...n)}function tx(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function nx(e){throw Error(`unreachable input event: ${JSON.stringify(e)}`)}function rx(e,t){let n=e.trimStart();if(n.startsWith(t))return n.slice(t.length);let r=t.trimEnd();if(n.startsWith(r)){let e=n.slice(r.length);return/^\s/.test(e)?e.slice(1):e}return``}function ix(e,t){return e.startsWith(t)||e===t.trimEnd()}var ax=class{phase=`plain`;claim;seq=0;inflight;detached=/* @__PURE__ */ new Map;get state(){let e=this.claim;return{phase:this.phase,...e?{claim:{name:e.name,token:e.token,...e.hint===void 0?{}:{hint:e.hint},...e.attachments===!0?{attachments:!0}:{}}}:{}}}dispatch(e){switch(e.type){case`draft-changed`:return this.onDraftChanged(e.draft);case`claim`:return this.onClaim(e.claim);case`enter`:return this.onEnter(e.mode,e.draft,e.annotated,e.submission);case`adjudicated`:return this.onAdjudicated(e.attempt,e.outcome);case`adjudication-failed`:return this.onAdjudicationFailed(e.attempt,e.message);case`submit-settled`:return this.onSubmitSettled(e);case`sink-settled`:return this.onSinkSettled(e);case`send-committed`:return this.onSendCommitted();case`release`:return this.onRelease();default:return nx(e)}}onDraftChanged(e){return this.phase===`claimed`&&this.claim!==void 0&&!ix(e,this.claim.token)&&(this.phase=`plain`,this.claim=void 0),[]}onClaim(e){return this.phase!==`plain`&&this.phase!==`claimed`||(this.claim=e,this.phase=`claimed`),[]}mintAttempt(e,t,n){let r=new AbortController;return this.seq+=1,{attempt:{seq:this.seq,signal:r.signal,draftSnapshot:t,mode:e,...n===void 0?{}:{submission:n}},controller:r}}beginAttempt(e,t,n){let r=this.mintAttempt(e,t,n);return this.inflight=r,r.attempt}beginDetached(e,t,n){let r=this.mintAttempt(e,t,n);return this.detached.set(r.attempt.seq,r.controller),this.claim=void 0,this.phase=`plain`,r.attempt}detachedEffects(e){return[{type:`default-sink`,attempt:e,draft:e.draftSnapshot,mode:e.mode},{type:`commit-draft`,retainSuffixOf:e.draftSnapshot}]}onEnter(e,t,n,r){if(this.phase===`adjudicating`||this.phase===`submitting`)return[];if(this.phase===`claimed`&&this.claim!==void 0){let n=this.beginAttempt(e,t,r);return this.phase=`submitting`,[{type:`begin-submit`,attempt:n,claim:this.claim,args:rx(t,this.claim.token)}]}let i=t.trim();if(i===``&&!n)return[];if(i.startsWith(`/`)){let n=this.beginAttempt(e,t,r);return this.phase=`adjudicating`,[{type:`adjudicate`,attempt:n,draft:t}]}return this.detachedEffects(this.beginDetached(e,t,r))}onAdjudicated(e,t){let n=this.inflight;return this.phase!==`adjudicating`||n===void 0||n.attempt.seq!==e.seq?[]:t!==void 0&&t!==`handled`&&t!==`refresh`&&`claim`in t?(this.claim=t.claim,this.phase=`submitting`,[{type:`begin-submit`,attempt:e,claim:t.claim,args:rx(e.draftSnapshot,t.claim.token)}]):(this.inflight=void 0,this.phase=`plain`,t===void 0?(this.detached.set(e.seq,n.controller),this.detachedEffects(e)):[])}onAdjudicationFailed(e,t){return this.phase!==`adjudicating`||this.inflight?.attempt.seq!==e.seq?[]:(this.inflight=void 0,this.phase=`plain`,[{type:`notice`,level:`error`,text:t}])}onSubmitSettled(e){let t=this.inflight;if(this.phase!==`submitting`||t===void 0||t.attempt.seq!==e.attempt.seq)return[];if(this.inflight=void 0,e.ok){this.phase=`plain`,this.claim=void 0;let n=[{type:`commit-draft`,retainSuffixOf:t.attempt.draftSnapshot}];return e.outcome?.text!==void 0&&n.push({type:`notice`,level:e.outcome.kind===`error`?`error`:`info`,text:e.outcome.text}),n}let n=e.message??e.outcome?.text;return e.draft===t.attempt.draftSnapshot&&this.claim!==void 0&&ix(e.draft,this.claim.token)?(this.phase=`claimed`,n===void 0?[]:[{type:`notice`,level:`error`,text:n}]):(this.phase=`plain`,this.claim=void 0,n===void 0?[]:[{type:`notice`,level:`error`,text:n}])}onSinkSettled(e){if(!this.detached.delete(e.attempt.seq))return[];let t=e.message??e.outcome?.text;return t===void 0?[]:[{type:`notice`,level:e.ok&&e.outcome?.kind!==`error`?`info`:`error`,text:t}]}onSendCommitted(){return this.phase===`plain`?(this.claim=void 0,[{type:`commit-draft`,retainSuffixOf:null}]):[]}onRelease(){this.inflight!==void 0&&(this.inflight.controller.abort(),this.inflight=void 0);for(let e of this.detached.values())e.abort();return this.detached.clear(),this.phase=`plain`,this.claim=void 0,[]}};function ox(e){let t=oy().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function sx(e){return ox(Jg(e)?e:e.getParentOrThrow())}function cx(e,t,n=`self`){let r=e.getStartEndPoints();if(t.isSelected(e)&&!N_(t)&&r!==null){let[i,a]=r,o=e.isBackward(),s=i.getNode(),c=a.getNode(),l=t.is(s),u=t.is(c);if(l||u){let[r,i]=Ph(e),a=s.is(c),l=t.is(o?c:s),u=t.is(o?s:c),d,f=0;a?(f=r>i?i:r,d=r>i?r:i):l?(f=o?i:r,d=void 0):u&&(f=0,d=o?r:i);let p=t.__text.slice(f,d);p!==t.__text&&(n===`clone`&&(t=hy(t)),t.__text=p)}}return t}function lx(e){let t=ux(e);return t!==null&&t.writingMode===`vertical-rl`}function ux(e){let t=e.anchor.getNode();return U(t)?ox(t):sx(t)}function dx(e,t){let n=lx(e)?!t:t;px(e)&&(n=!n);let r=Mb(e.focus,n?`previous`:`next`);if(Hb(r))return!1;if(cb(r)&&!bh(r.origin)&&r.origin.isUnmergeable()){let e=r.getNodeAtCaret();if(z(e)&&!bh(e))return!0}for(let e of Cb(r)){if(ub(e))return!e.origin.isInline();if(!U(e.origin)){if(W(e.origin))return!0;break}}return!1}function fx(e,t,n,r){e.modify(t?`extend`:`move`,n,r)}function px(e){let t=ux(e);return t!==null&&t.direction===`rtl`}function mx(e,t,n){let r=px(e),i;i=lx(e)||r?!n:n,fx(e,t,i,`character`)}function hx(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}let gx=Symbol.for(`preact-signals`);function _x(){if(xx>1)return void xx--;let e,t=!1;for(function(){let e=bx;for(bx=void 0;e!==void 0;)e.S.v===e.v&&(e.S.i=e.i),e=e.o}();vx!==void 0;){let n=vx;for(vx=void 0,Sx++;n!==void 0;){let r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Ex(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(Sx=0,xx--,t)throw e}let J,vx;function yx(e){let t=J;J=void 0;try{return e()}finally{J=t}}let bx,xx=0,Sx=0,Cx=0;function wx(e){if(J===void 0)return;let t=e.n;return t===void 0||t.t!==J?(t={i:0,S:e,p:J.s,n:void 0,t:J,e:void 0,x:void 0,r:t},J.s!==void 0&&(J.s.n=t),J.s=t,e.n=t,32&J.f&&e.S(t),t):t.i===-1?(t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=J.s,t.n=void 0,J.s.n=t,J.s=t),t):void 0}function Tx(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function Ex(e){for(let t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Dx(e){for(let t=e.s;t!==void 0;t=t.n){let n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function Ox(e){let t,n=e.s;for(;n!==void 0;){let e=n.p;n.i===-1?(n.S.U(n),e!==void 0&&(e.n=n.n),n.n!==void 0&&(n.n.p=e)):t=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=e}e.s=t}function kx(e,t){Tx.call(this,void 0),this.x=e,this.s=void 0,this.g=Cx-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function Ax(e){let t=e.m;if(e.m=void 0,typeof t==`function`){xx++;let n=J;J=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,jx(e),t}finally{J=n,_x()}}}function jx(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Ax(e)}function Mx(e){if(J!==this)throw Error(`Out-of-order effect`);Ox(this),J=e,this.f&=-2,8&this.f&&jx(this),_x()}function Nx(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name}function Px(e,t){let n=new Nx(e,t);try{n.c()}catch(e){throw n.d(),e}let r=n.d.bind(n);return r[Symbol.dispose]=r,r}Tx.prototype.brand=gx,Tx.prototype.h=function(){return!0},Tx.prototype.S=function(e){let t=this.t;t!==e&&e.e===void 0&&(e.x=t,this.t=e,t===void 0?yx(()=>{var e;(e=this.W)==null||e.call(this)}):t.e=e)},Tx.prototype.U=function(e){if(this.t!==void 0){let t=e.e,n=e.x;t!==void 0&&(t.x=n,e.e=void 0),n!==void 0&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,n===void 0&&yx(()=>{var e;(e=this.Z)==null||e.call(this)}))}},Tx.prototype.subscribe=function(e){return Px(()=>{let t=this.value,n=J;J=void 0;try{e(t)}finally{J=n}},{name:`sub`})},Tx.prototype.valueOf=function(){return this.value},Tx.prototype.toString=function(){return this.value+``},Tx.prototype.toJSON=function(){return this.value},Tx.prototype.peek=function(){let e=J;J=void 0;try{return this.value}finally{J=e}},Object.defineProperty(Tx.prototype,"value",{get(){let e=wx(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Sx>100)throw Error(`Cycle detected`);(function(e){xx!==0&&Sx===0&&e.l!==0&&(e.l=0,bx={S:e,v:e.v,i:e.i,o:bx})})(this),this.v=e,this.i++,Cx++,xx++;try{for(let e=this.t;e!==void 0;e=e.x)e.t.N()}finally{_x()}}}}),kx.prototype=new Tx,kx.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Cx))return!0;if(this.g=Cx,this.f|=1,this.i>0&&!Ex(this))return this.f&=-2,!0;let e=J;try{Dx(this),J=this;let e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return J=e,Ox(this),this.f&=-2,!0},kx.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(let e=this.s;e!==void 0;e=e.n)e.S.S(e)}Tx.prototype.S.call(this,e)},kx.prototype.U=function(e){if(this.t!==void 0&&(Tx.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(let e=this.s;e!==void 0;e=e.n)e.S.U(e)}},kx.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(kx.prototype,"value",{get(){if(1&this.f)throw Error(`Cycle detected`);let e=wx(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Nx.prototype.c=function(){let e=this.S();try{if(8&this.f||this.x===void 0)return;let e=this.x();typeof e==`function`&&(this.m=e)}finally{e()}},Nx.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,Ax(this),Dx(this),xx++;let e=J;return J=this,Mx.bind(this,e)},Nx.prototype.N=function(){2&this.f||(this.f|=2,this.u=vx,vx=this)},Nx.prototype.d=function(){this.f|=8,1&this.f||jx(this)},Nx.prototype.dispose=function(){this.d()};function Fx(e){return(typeof e.nodes==`function`?e.nodes():e.nodes)||[]}function Ix(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let Lx;try{Lx=`0.49.0+prod.esm`}catch{}let Rx=Lx??`"<unknown>+source"`,zx=/* @__PURE__ */ new Set([`__proto__`,`constructor`,`prototype`]);function Bx(e,t){if(e&&t&&!Array.isArray(t)&&typeof e==`object`&&typeof t==`object`){let n=e,r=t;for(let e in r)!zx.has(e)&&Object.prototype.hasOwnProperty.call(r,e)&&(n[e]=Bx(n[e],r[e]));return e}return t}function Vx(e){return e.id===0}function Hx(e){return e.id===2}function Ux(e){return function(e){return e.id===1}(e)||Ix(305,String(e.id),`1`),Object.assign(e,{id:2})}let Wx=/* @__PURE__ */ new Set;var Gx=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=/* @__PURE__ */ new Set,this.state={id:0}}mergeConfigs(){let e=this.extension.config||{},t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):Qb;for(let n of this.configs)e=t(e,n);return e}init(e){let t=this.state;Hx(t)||Ix(306,String(t.id));let n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},i=function(e,t,n){return Object.assign(e,{config:t,id:3,registerState:n})}(t,this.mergeConfigs(),n),a;this.state=i,this.extension.init&&(a=this.extension.init(e,i.config,n)),this.state=function(e,t,n){return Object.assign(e,{id:4,initResult:t,registerState:n})}(i,a,r)}build(e){let t=this.state,n;t.id!==4&&Ix(307,String(t.id),`5`),this.extension.build&&(n=this.extension.build(e,t.config,t.registerState));let r={...t.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(e,t,n){return Object.assign(e,{id:5,output:t,registerState:n})}(t,n,r)}register(e,t){this._signal=t;let n=this.state;n.id!==5&&Ix(308,String(n.id),`5`);let r=this.extension.register&&this.extension.register(e,n.config,n.registerState);return this.state=function(e){return Object.assign(e,{id:6})}(n),()=>{let e=this.state;e.id!==7&&Ix(309,String(n.id),`7`),this.state=function(e){return Object.assign(e,{id:5})}(e),r&&r()}}afterRegistration(e){let t=this.state,n;return t.id!==6&&Ix(310,String(t.id),`6`),this.extension.afterRegistration&&(n=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=function(e){return Object.assign(e,{id:7})}(t),n}getSignal(){return this._signal===void 0&&Ix(311),this._signal}getInitResult(){this.extension.init===void 0&&Ix(312,this.extension.name);let e=this.state;return function(e){return e.id>=4}(e)||Ix(313,String(e.id),`4`),e.initResult}getInitPeer(e){let t=this.builder.extensionNameMap.get(e);return t?t.getExtensionInitDependency():void 0}getExtensionInitDependency(){let e=this.state;return function(e){return e.id>=3}(e)||Ix(314,String(e.id),`3`),{config:e.config}}getPeer(e){let t=this.builder.extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}getInitDependency(e){let t=this.builder.getExtensionRep(e);return t===void 0&&Ix(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){let t=this.builder.getExtensionRep(e);return t===void 0&&Ix(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){let e=this.state;return function(e){return e.id>=7}(e)||Ix(316,String(e.id),`7`),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||Wx}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map(([e])=>e)),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){let e=this.state;(function(e){return e.id>=5})(e)||Ix(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}};let Kx={tag:Km};function qx(){let e=X_();e.isEmpty()&&e.append(u_())}let Jx=/* @__PURE__ */ Xb({config:/* @__PURE__ */ Zb({setOptions:Kx,updateOptions:Kx}),init:({$initialEditorState:e=qx})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},r){let i=r.getInitResult();if(!i.initialized){i.initialized=!0;let{$initialEditorState:r}=i;if(Qg(r))e.setEditorState(r,n);else if(typeof r==`function`)e.update(()=>{r(e)},t);else if(r&&(typeof r==`string`||typeof r==`object`)){let t=e.parseEditorState(r);e.setEditorState(t,n)}}return()=>{}},name:`@lexical/extension/InitialState`,nodes:[qg,sh,t_,vh,c_]}),Yx=Symbol.for(`@lexical/extension/LexicalBuilder`);function Xx(){}function Zx(e){throw e}function Qx(e){return Array.isArray(e)?e:[e]}let $x=Rx;var eS=class e{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){this.outgoingConfigEdges=/* @__PURE__ */ new Map,this.incomingEdges=/* @__PURE__ */ new Map,this.extensionNameMap=/* @__PURE__ */ new Map,this.conflicts=/* @__PURE__ */ new Map,this.PACKAGE_VERSION=$x,this.roots=e;for(let t of e)this.addExtension(t)}static fromExtensions(t){let n=[Qx(Jx)];for(let e of t)n.push(Qx(e));return new e(n)}static maybeFromEditor(t){let n=t[Yx];return n&&(n.PACKAGE_VERSION!==$x&&Ix(292,n.PACKAGE_VERSION,$x),n instanceof e||Ix(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&Ix(294),n}constructEditor(){let{$initialEditorState:e,onError:t,onWarn:n,...r}=this.buildCreateEditorArgs(),i=Object.assign(g_({...r,...t?{onError:e=>{t(e,i)}}:{},...n?{onWarn:e=>{n(e,i)}}:{}}),{[Yx]:this});for(let e of this.sortedExtensionReps())e.build(i);return i}buildEditor(){let e=Xx;function t(){try{e()}finally{e=Xx}}let n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=tx(this.registerEditor(n),()=>n.setRootElement(null)),n}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){let t=this.extensionNameMap.get(e.name);if(t)return t.extension!==e&&Ix(295,e.name),t}addEdge(e,t,n){let r=this.outgoingConfigEdges.get(e);r?r.set(t,n):this.outgoingConfigEdges.set(e,/* @__PURE__ */ new Map([[t,n]]));let i=this.incomingEdges.get(t);i?i.add(e):this.incomingEdges.set(t,/* @__PURE__ */ new Set([e]))}addExtension(e){this._sortedExtensionReps!==void 0&&Ix(296);let[t]=Qx(e);typeof t.name!=`string`&&Ix(297,typeof t.name);let n=this.extensionNameMap.get(t.name);if(n!==void 0&&n.extension!==t&&Ix(298,t.name),!n){n=new Gx(this,t),this.extensionNameMap.set(t.name,n);let e=this.conflicts.get(t.name);typeof e==`string`&&Ix(299,t.name,e);for(let e of t.conflictsWith||[])this.extensionNameMap.has(e)&&Ix(299,t.name,e),this.conflicts.set(e,t.name);for(let e of t.dependencies||[]){let n=Qx(e);this.addEdge(t.name,n[0].name,n.slice(1)),this.addExtension(n)}for(let[e,n]of t.peerDependencies||[])this.addEdge(t.name,e,n?[n]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let e=[],t=(n,r)=>{let i=n.state;if(Hx(i))return;let a=n.extension.name;var o;Vx(i)||Ix(300,a,r||`[unknown]`),Vx(o=i)||Ix(304,String(o.id),`0`),i=Object.assign(o,{id:1}),n.state=i;let s=this.outgoingConfigEdges.get(a);if(s)for(let e of s.keys()){let n=this.extensionNameMap.get(e);n&&t(n,a)}i=Ux(i),n.state=i,e.push(n)};for(let e of this.extensionNameMap.values())Vx(e.state)&&t(e);for(let t of e)for(let[e,n]of this.outgoingConfigEdges.get(t.extension.name)||[])if(n.length>0){let t=this.extensionNameMap.get(e);if(t)for(let e of n)t.configs.add(e)}for(let[e,...t]of this.roots)if(t.length>0){let n=this.extensionNameMap.get(e.name);n===void 0&&Ix(301,e.name);for(let e of t)n.configs.add(e)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){let t=this.sortedExtensionReps(),n=new AbortController,r=[()=>n.abort()],i=n.signal;for(let n of t){let t=n.register(e,i);t&&r.push(t)}for(let n of t){let t=n.afterRegistration(e);t&&r.push(t)}return tx(...r)}buildCreateEditorArgs(){let e={},t=/* @__PURE__ */ new Set,n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map,i={},a={},o=this.sortedExtensionReps();for(let s of o){let{extension:o}=s;if(o.onError!==void 0&&(e.onError=o.onError),o.onWarn!==void 0&&(e.onWarn=o.onWarn),o.disableEvents!==void 0&&(e.disableEvents=o.disableEvents),o.parentEditor!==void 0&&(e.parentEditor=o.parentEditor),o.editable!==void 0&&(e.editable=o.editable),o.namespace!==void 0&&(e.namespace=o.namespace),o.$initialEditorState!==void 0&&(e.$initialEditorState=o.$initialEditorState),o.nodes)for(let e of Fx(o)){if(typeof e!=`function`){let t=n.get(e.replace);t&&Ix(302,o.name,e.replace.name,t.extension.name),n.set(e.replace,s)}t.add(e)}if(o.html){if(o.html.export)for(let[e,t]of o.html.export.entries())r.set(e,t);o.html.import&&Object.assign(i,o.html.import)}o.theme&&Bx(a,o.theme)}Object.keys(a).length>0&&(e.theme=a),t.size&&(e.nodes=[...t]);let s=Object.keys(i).length>0,c=r.size>0;(s||c)&&(e.html={},s&&(e.html.import=i),c&&(e.html.export=r));for(let t of o)t.init(e);return e.onError||=Zx,e}};function tS(e,t){let n=eS.maybeFromEditor(e);if(!n)return;let r=n.extensionNameMap.get(t);return r?r.getExtensionDependency():void 0}var nS=class extends Kg{$config(){return this.config(`horizontalrule`,{importDOM:{hr:()=>({conversion:rS,priority:0})}})}exportDOM(){return{element:Uv().createElement(`hr`)}}createDOM(e){let t=Uv().createElement(`hr`);return ex(t,e.theme.hr),t}getTextContent(){return`
146
- `}isInline(){return!1}updateDOM(){return!1}};function rS(){return{node:iS()}}function iS(){return Oy(nS)}Date.now;function aS(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let oS;function sS(e,t){let{key:n}=t;return e&&n in e?e[n]:t.defaultValue}function cS(e){return oS&&oS.editor===e?oS:void 0}function lS(e,t){if(`cfg`in t){let{cfg:n,updater:r}=t;return[n,r(sS(e,n))]}return t}function uS(e,t){let n=t;for(let r of e){let[e,i]=lS(n,r),a=e.key;if(n===t&&sS(n,e)===i)continue;let o=n===t||n===void 0?dS(t):n;o[a]=i,n=o}return n}function dS(e){return Object.create(e||null)}function fS(e,t){return[e,t]}function pS(e,t,n,r=oy()){let i=oS,a=cS(r);try{return oS={...a,editor:r,[e]:t},n()}finally{oS=i}}function mS(e,t=()=>{}){return(n,r=oy())=>i=>{let a=cS(r),o=a&&a[e],s=uS(n,o||t(r));return s&&s!==o?pS(e,s,i,r):i()}}function hS(e,t,n,r){return Object.assign(df(Symbol(t),{isEqual:r,parse:n}),{[e]:!0})}let gS=`@lexical/html/DOM`,_S=Symbol.for(`@lexical/html/DOMExportContext`);function vS(e,t,n){return hS(_S,e,t,n)}let yS=/* @__PURE__ */ vS(`isExport`,Boolean);function bS(e){let t=tS(e,gS);return t?t.output.defaults:void 0}function xS(e){let t=tS(e,gS);return t?t.output.runtime:void 0}function SS(e=oy()){let t=xS(e);return t?t.getSessionConfig():sy(e)}let CS=mS(_S,bS),wS=Symbol.for(`@lexical/html/SelectorImpl`);function TS(e,t){let n={kind:`element`,predicate:(r=t,r.length===0?q:r.length===1?r[0]:(e,t)=>{for(let n of r)if(!n(e,t))return!1;return!0}),tags:e};var r;let i=n=>TS(e,[...t,n]);return{[wS]:n,attr:(e,t,n)=>i(OS(e,t,n)),classAll:(...e)=>i(DS(e)),classAny:(...e)=>i(function(e){let t=ES(e);return t.length===0?()=>!1:e=>{if(!q(e))return!1;let n=e.classList;for(let e of t)if(n.contains(e))return!0;return!1}}(e)),styleAny:(e,t,n)=>i(function(e,t,n){if(typeof t==`string`)return n=>q(n)&&n.style.getPropertyValue(e)===t;if(t instanceof RegExp){let r=n&&n.capture,i=t;return(t,n)=>{if(!q(t))return!1;let a=t.style.getPropertyValue(e);if(!a)return!1;let o=a.match(i);return o!==null&&(r!==void 0&&(n[r]=o),!0)}}aS(362,JSON.stringify(e))}(e,t,n))}}function ES(e){let t=[];for(let n of e)n&&t.push(n);return t}function DS(e){let t=ES(e);return t.length===0?()=>!0:e=>{if(!q(e))return!1;let n=e.classList;for(let e of t)if(!n.contains(e))return!1;return!0}}function OS(e,t,n){if(!0===t)return t=>q(t)&&t.hasAttribute(e);if(typeof t==`string`)return n=>q(n)&&n.getAttribute(e)===t;if(t instanceof RegExp){let r=n&&n.capture,i=t;return(t,n)=>{if(!q(t))return!1;let a=t.getAttribute(e);if(a==null)return!1;let o=a.match(i);return o!==null&&(r!==void 0&&(n[r]=o),!0)}}aS(361,JSON.stringify(e))}let kS={kind:`text`,predicate:P_,tags:/* @__PURE__ */ new Set},AS={[wS]:kS},jS={kind:`comment`,predicate:e=>e.nodeType===8,tags:/* @__PURE__ */ new Set},MS={[wS]:jS},NS={any:()=>TS(/* @__PURE__ */ new Set,[]),comment:()=>MS,tag(...e){e.length>0||aS(363);let t=/* @__PURE__ */ new Set;for(let n of e)t.add(n.toUpperCase());return TS(t,[])},text:()=>AS},PS=NS;PS.tag(`b`,`strong`,`em`,`i`,`code`,`mark`,`s`,`sub`,`sup`,`u`,`span`),PS.text(),PS.tag(`script`,`style`),PS.tag(`br`),PS.tag(`p`),PS.tag(`hr`),PS.any(),Object.freeze([]),Object.freeze({}),NS.any(),NS.any,NS.comment,NS.tag,NS.text;function FS(e,t=null,n=oy()){return CS([fS(yS,!0)],n)(()=>{let r=X_(),i=SS(n),a=B(t)?Ry(t.anchor.getNode()):null,o=e.append.bind(e);for(let e of(U(a)?a:r).getChildren())LS(n,e,o,t,i);return e})}function IS(e,t=null){return(typeof document>`u`||typeof window>`u`&&global.window===void 0)&&aS(338),Dg(e),FS(Uv().createElement(`div`),t,e).innerHTML}function LS(e,t,n,r=null,i=sy(e)){let a=i.$shouldInclude(t,r,e),o=i.$shouldExclude(t,r,e),s=t;r!==null&&z(t)&&(s=cx(r,t,`clone`));let{element:c,after:l,append:u,$getChildNodes:d}=i.$exportDOM(s,e);if(!c)return!1;let f=Uv().createDocumentFragment(),p=d?d():U(s)?s.getChildren():[],m=a&&Ah(r)&&U(t)?null:r,h=f.append.bind(f);for(let n of p){let o=LS(e,n,h,m,i);!a&&o&&i.$extractWithChild(t,n,r,`html`,e)&&(a=!0)}if(a&&!o){if((q(c)||ey(c))&&(u?u(f):c.append(f)),n(c),l){let e=l.call(s,c);e&&(ey(c)?c.replaceChildren(e):c.replaceWith(e))}}else n(f);return a}function RS(e,t,n=null){let r=Hv(n),i=n?Bv(n):[],a=n!==null&&i.length>0;if(a&&typeof r.caretPositionFromPoint==`function`){let a=r.caretPositionFromPoint(e,t,{shadowRoots:i});if(a!==null&&function(e,t){for(let n=e;n!==null;){if(n===t)return!0;n=yv(n)}return!1}(a.offsetNode,n))return{node:a.offsetNode,offset:a.offset}}if(a){let i=n.getRootNode();if(Rv(i)){let a=i.elementFromPoint(e,t);if(a!==null&&n.contains(a)){let n=function(e,t,n,r){let i=r.createRange(),a=e=>t<e.top?e.top-t:t>e.bottom?t-e.bottom:0,o=t=>e<t.left?t.left-e:e>t.right?e-t.right:0,s=r.createTreeWalker(n,NodeFilter.SHOW_TEXT),c=null,l=1/0,u=1/0;for(let e=s.nextNode();e;e=s.nextNode()){i.selectNodeContents(e);for(let t of i.getClientRects()){let n=a(t),r=o(t);(n<l||n===l&&r<u)&&(l=n,u=r,c=e)}}if(c===null)return null;let d=0,f=1/0,p=1/0;for(let t=0;t<=c.length;t++){i.setStart(c,t),i.collapse(!0);let n=i.getBoundingClientRect(),r=a(n),o=Math.abs(e-n.left);(r<f||r===f&&o<p)&&(f=r,p=o,d=t)}return{node:c,offset:d}}(e,t,a,r);if(n!==null)return n}}}if(typeof r.caretRangeFromPoint==`function`){let n=r.caretRangeFromPoint(e,t);return n===null?null:{node:n.startContainer,offset:n.startOffset}}if(typeof r.caretPositionFromPoint==`function`){let n=r.caretPositionFromPoint(e,t);return n===null?null:{node:n.offsetNode,offset:n.offset}}return null}function zS(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function BS(e,t=V()){return t??zS(166),B(t)&&t.isCollapsed()||t.getNodes().length===0?``:IS(e,t)}function VS(e,t){let n=e.getData(`text/plain`)||e.getData(`text/uri-list`);n!=null&&t.insertRawText(n)}let HS=`application/x-lexical-drag`;function US(e,t){let n={editorKey:t.getKey()};e.setData(HS,JSON.stringify(n))}function WS(e,t,n){let r=e.dataTransfer;if(r===null)return!1;let i=function(e){let t=e.getData(HS);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}return(r=n)!==null&&typeof r==`object`&&`editorKey`in r&&typeof r.editorKey==`string`?n:null;var r}(r);if(i===null)return!1;let a=function(e,t){let n=RS(e.clientX,e.clientY,t.getRootElement());if(n===null)return null;let r=q_(n.node);if(r===null)return null;if(z(r))return hb(r,`next`,n.offset);if(U(r))return Gb(r,n.offset,`next`);let i=r.getParent();return i===null?null:Gb(i,r.getIndexWithinParent()+1,`next`)}(e,t);if(a===null)return!1;let o=Jb(a);if(o===null)return!1;let s=i.editorKey===t.getKey(),c=V();if(s){if(!B(c)||c.isCollapsed())return!1;if(function(e,t){let{anchor:n,focus:r}=Wb(Ib(t),`next`);return Db(n,e)<0&&Db(e,r)<0}(a,c))return e.preventDefault(),!0;c.removeText()}if(!o.origin.isAttached())return e.preventDefault(),!0;if(n(r,Pb(wb(o)),t),!s){let e=t.getRootElement(),n=e?e.ownerDocument:null,r=n?function(e,t){for(let n of Vv(t)){let t=j_(n);if(k_(t)&&t.getKey()===e&&q(n))return n}return null}(i.editorKey,n):null;r!==null&&r.dispatchEvent(new InputEvent(`beforeinput`,{bubbles:!0,cancelable:!0,inputType:`deleteByDrag`}))}return e.preventDefault(),!0}function GS(e,t){return WS(e,t,(e,t)=>VS(e,t))}function KS(e,t){t.update(()=>{if(e!==null){let n=hx(e,KeyboardEvent)?null:e.clipboardData,r=V();if(r!==null&&!r.isCollapsed()&&n!=null){e.preventDefault();let i=BS(t);i!==null&&n.setData(`text/html`,i),n.setData(`text/plain`,r.getTextContent())}}})}function qS(e){return tx(e.registerCommand(Ep,e=>{let t=V();return!!B(t)&&(t.deleteCharacter(e),!0)},0),e.registerCommand(Mp,e=>{let t=V();return!!B(t)&&(t.deleteWord(e),!0)},0),e.registerCommand(Np,e=>{let t=V();return!!B(t)&&(t.deleteLine(e),!0)},0),e.registerCommand(kp,e=>{let t=V();if(!B(t))return!1;if(typeof e==`string`)t.insertText(e);else{let n=e.dataTransfer;if(n!=null)VS(n,t);else{let n=e.data;n&&t.insertText(n)}}return!0},0),e.registerCommand(jp,()=>{let e=V();return!!B(e)&&(e.removeText(),!0)},0),e.registerCommand(Dp,e=>{let t=V();return!!B(t)&&(t.insertLineBreak(e),!0)},0),e.registerCommand(Op,()=>{let e=V();return!!B(e)&&(e.insertLineBreak(),!0)},0),e.registerCommand(Bp,e=>{let t=V();if(!B(t))return!1;let n=e,r=n.shiftKey;return!!dx(t,!0)&&(n.preventDefault(),mx(t,r,!0),!0)},0),e.registerCommand(Rp,e=>{let t=V();if(!B(t))return!1;let n=e,r=n.shiftKey;return!!dx(t,!1)&&(n.preventDefault(),mx(t,r,!1),!0)},0),e.registerCommand(Kp,t=>!!B(V())&&(!wd||!Cd)&&(t.preventDefault(),e.dispatchCommand(Ep,!0)),0),e.registerCommand(Jp,t=>!!B(V())&&(t.preventDefault(),e.dispatchCommand(Ep,!1)),0),e.registerCommand(Wp,t=>{if(!B(V()))return!1;if(t!==null){if((wd||Ed||kd)&&Cd)return!1;t.preventDefault()}return e.dispatchCommand(Dp,!1)},0),e.registerCommand(nm,()=>{let e=V();return fv(B(e)&&Ry(e.anchor.getNode())!==null?e:null),!0},0),e.registerCommand(em,t=>!!B(V())&&(KS(t,e),!0),0),e.registerCommand(tm,t=>!!B(V())&&(function(e,t){KS(e,t),t.update(()=>{let e=V();B(e)&&e.removeText()},{tag:`cut`})}(t,e),!0),0),e.registerCommand(Ap,t=>!!B(V())&&(function(e,t){e.preventDefault(),t.update(()=>{let t=V(),n=hx(e,ClipboardEvent)?e.clipboardData:null;n!=null&&B(t)&&VS(n,t)},{tag:`paste`})}(t,e),!0),0),e.registerCommand(Xp,t=>GS(t,e),0),e.registerCommand(Zp,t=>{let n=V();return!!B(n)&&(n.isCollapsed()||t.dataTransfer===null||US(t.dataTransfer,e),!0)},0))}function JS(e,t,n,r,i){if(e===null||n.size===0&&r.size===0&&!i)return 0;let a=t._selection,o=e._selection;if(i)return 1;if(!(B(a)&&B(o)&&o.isCollapsed()&&a.isCollapsed()))return 0;let s=function(e,t,n){let r=e._nodeMap,i=[];for(let e of t){let t=r.get(e);t!==void 0&&i.push(t)}for(let[e,t]of n){if(!t)continue;let n=r.get(e);n===void 0||Jg(n)||i.push(n)}return i}(t,n,r);if(s.length===0)return 0;if(s.length>1){let n=t._nodeMap,r=n.get(a.anchor.key),i=n.get(o.anchor.key);return r&&i&&!e._nodeMap.has(r.__key)&&z(r)&&r.__text.length===1&&a.anchor.offset===1?2:0}let c=s[0],l=e._nodeMap.get(c.__key);if(!z(l)||!z(c)||l.__mode!==c.__mode)return 0;let u=l.__text,d=c.__text;if(u===d)return 0;let f=a.anchor,p=o.anchor;if(f.key!==p.key||f.type!==`text`)return 0;let m=f.offset,h=p.offset,g=d.length-u.length;return g===1&&h===m-1?2:g===-1&&h===m+1?3:g===-1&&h===m?4:0}function YS(e,t,n){let r=n(),i=0,a=r,o=0,s=null;return(c,l,u,d,f,p)=>{let m=n();if(p.has(`composition-start`)&&(a=r,o=i,s=c),p.has(`historic`))return i=0,r=m,2;p.has(`composition-end`)&&s&&(r=a,i=o,c=s);let h=p.has(`paste`)||p.has(`cut`)?0:JS(c,l,d,f,e.isComposing()),g=(()=>{let n=u===null||u.editor===e,a=p.has(`history-push`);if(!a&&n&&p.has(`history-merge`))return 0;if(h===1)return 2;if(c===null)return 1;let o=l._selection;if(!(d.size>0||f.size>0))return o===null?2:0;let s=typeof t==`number`?t:t.peek();return!1===a&&h!==0&&h===i&&m<r+s&&n||d.size===1&&function(e,t,n){let r=t._nodeMap.get(e),i=n._nodeMap.get(e),a=t._selection,o=n._selection;return!(B(a)&&B(o)&&a.anchor.type===`element`&&a.focus.type===`element`&&o.anchor.type===`text`&&o.focus.type===`text`||!z(r)||!z(i)||r.__parent!==i.__parent)&&JSON.stringify(t.read(()=>r.exportJSON()))===JSON.stringify(n.read(()=>i.exportJSON()))}(Array.from(d)[0],c,l)?0:1})();return r=m,i=h,g}}function XS(e,t){e.undoStack=[],e.redoStack=[],e.current=null,t&&t(e)}function ZS(e,t,n,r=Date.now,i,a=null){let o=YS(e,n,r),s=()=>{i&&i(t)};return s(),tx(e.registerCommand(Fp,()=>(function(e,t,n){let r=t.redoStack,i=t.undoStack;if(i.length!==0){let a=t.current,o=i.pop();a!==null&&(r.push(a),e.dispatchCommand(am,!0)),i.length===0&&e.dispatchCommand(om,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(Ip,()=>(function(e,t,n){let r=t.redoStack,i=t.undoStack;if(r.length!==0){let a=t.current;a!==null&&(i.push(a),e.dispatchCommand(om,!0));let o=r.pop();r.length===0&&e.dispatchCommand(am,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(rm,()=>(XS(t,i),!1),0),e.registerCommand(im,()=>(XS(t,i),e.dispatchCommand(am,!1),e.dispatchCommand(om,!1),!0),0),e.registerUpdateListener(({editorState:n,prevEditorState:r,dirtyLeaves:i,dirtyElements:c,tags:l})=>{let u=t.current,d=t.redoStack,f=t.undoStack,p=u===null?null:u.editorState;if(u!==null&&n===p)return;let m=o(r,n,u,i,c,l);if(m===1){if(d.length!==0&&(t.redoStack=[],e.dispatchCommand(am,!1)),u!==null){f.push({...u});let t=typeof a==`number`||a===null?a:a.peek();t!==null&&f.length>t&&f.splice(0,f.length-t),e.dispatchCommand(om,!0)}}else if(m===2)return;t.current={editor:e,editorState:n},s()}))}function QS(){return{current:null,redoStack:[],undoStack:[]}}Date.now;let $S=`application/x-codexhost-thread-reference`,eC=/^remote-(?:peer:|ssh(?:-|:)|control:).+/u;function tC(e){let t=e.projectionValues?.threadReference;if(!e.blank&&t?.hostId&&(t.hostId===`local`||eC.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 nC(e){return`thread://${encodeURIComponent(e.threadId).replace(/[!'()*]/gu,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}?hostId=${encodeURIComponent(e.hostId)}`}function rC(e){if(e.trim()!==e)return;let t=/^codex:\/\/threads\/([^/?#\s<>]+)$/u.exec(e)??/^thread:\/\/([^/?#\s<>]+)\?hostId=([^&#\s]+)$/u.exec(e);if(t?.[1]!==void 0)try{let e=decodeURIComponent(t[1]),n=decodeURIComponent(t[2]??`local`);if(!e||!n||/[\u0000-\u001f\u007f]/u.test(e+n))return;if(n===`local`)return e;if(!eC.test(n))return;let r=new TextEncoder().encode(JSON.stringify([n,e]));return`web-remote:`+btoa(Array.from(r,e=>String.fromCharCode(e)).join(``)).replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/u,``)}catch{return}}function iC(e){let t=`[@${e.title.replace(/[\\`*{}[\]()#+.!_<>|~-]/gu,e=>`\\${e}`)}](${nC(e)})`;return{source:`codexhost-thread`,ref:t,label:e.title,appearance:`session`,clipboardText:t}}function aC(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return;let{threadId:n,hostId:r,title:i}=t;return typeof n!=`string`||!n||typeof r!=`string`||!r||r!==`local`&&!eC.test(r)||typeof i!=`string`?void 0:tC({id:n,blank:!1,title:i,projectionValues:{threadReference:{hostId:r,threadId:n}}})}catch{return}}function oC(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=oC(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function sC(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=oC(e))&&(r&&(r+=` `),r+=t);return r}let cC=`@deepseek-ai/dsh-client-ui-conversation/ReferenceChip.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(cC)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=cC,e.textContent=`.s8J5YG_chip{max-width:240px;color:var(--dsw-alias-state-business-primary);user-select:none;align-items:baseline;gap:3px;display:inline-flex}.s8J5YG_marker{flex:none;font-weight:500}.s8J5YG_icon{flex:none;align-self:center}.s8J5YG_label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.s8J5YG_invalid{color:var(--dsw-alias-state-error-primary);opacity:.7;text-decoration:line-through}`,document.head.appendChild(e)}var lC={chip:`s8J5YG_chip`,icon:`s8J5YG_icon`,invalid:`s8J5YG_invalid`,label:`s8J5YG_label`,marker:`s8J5YG_marker`};let uC=`@deepseek-ai/dsh-client-ui-conversation/composer-editor.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(uC)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=uC,e.textContent=`._VTzna_reference{border-radius:var(--dsw-radius-sm);line-height:inherit;vertical-align:baseline;color:var(--dsw-alias-state-business-primary);-webkit-box-decoration-break:clone;box-decoration-break:clone;background:0 0;padding:0 4px}._VTzna_reference:hover{background:var(--dsw-alias-state-business-tertiary)}._VTzna_openable{cursor:pointer}._VTzna_textRef{max-width:100%;display:inline-block}`,document.head.appendChild(e)}var dC={openable:`_VTzna_openable`,reference:`_VTzna_reference`,textRef:`_VTzna_textRef`};function fC({label:e,reference:t,appearance:n,invalid:r}){return/* @__PURE__ */ (0,h.jsxs)(`span`,{className:sC(dC.reference,lC.chip,n===`file`&&!r&&dC.openable,r&&lC.invalid),title:e,children:[n===void 0?/* @__PURE__ */ (0,h.jsx)(`span`,{className:lC.marker,"aria-hidden":!0,children:`@`}):/* @__PURE__ */ (0,h.jsx)(d.ReferenceIconRegular,{kind:n,reference:t,size:14,className:lC.icon}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:lC.label,children:e})]})}var pC=class e extends Kg{__source;__ref;__label;__appearance;__clipboardText;__invalid;static getType(){return`reference-chip`}static clone(t){return new e({source:t.__source,ref:t.__ref,label:t.__label,appearance:t.__appearance,clipboardText:t.__clipboardText},t.__invalid,t.__key)}static importJSON(t){return new e({source:t.source,ref:t.ref,label:t.label,appearance:t.appearance,clipboardText:t.clipboardText},t.invalid)}constructor(e,t=!1,n){super(n),this.__source=e.source,this.__ref=e.ref,this.__label=e.label,this.__appearance=e.appearance,this.__clipboardText=e.clipboardText,this.__invalid=t}exportJSON(){return{...super.exportJSON(),type:`reference-chip`,version:1,source:this.__source,ref:this.__ref,label:this.__label,...this.__appearance===void 0?{}:{appearance:this.__appearance},clipboardText:this.__clipboardText,invalid:this.__invalid}}createDOM(e){let t=document.createElement(`span`);return t.setAttribute(`data-composer-chip`,this.__source),t.setAttribute(`contenteditable`,`false`),t}updateDOM(){return!1}isInline(){return!0}isKeyboardSelectable(){return!1}getTextContent(){return this.__clipboardText}setInvalid(e){let t=this.getWritable();t.__invalid=e}isInvalid(){return this.getLatest().__invalid}getSource(){return this.getLatest().__source}getReference(){return this.getLatest().__ref}getLabel(){return this.getLatest().__label}getAppearance(){return this.getLatest().__appearance}decorate(){return/* @__PURE__ */ (0,h.jsx)(fC,{label:this.__label,reference:this.__ref,appearance:this.__appearance,invalid:this.__invalid})}};function mC(e){return new pC(e)}function hC(e){return e instanceof pC}function gC(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function _C(e,t,n,r){let i=e=>e instanceof n,a=e=>{let t=gh(e.getTextContent());t.setFormat(e.getFormat()),e.replace(t)};return[e.registerNodeTransform(sh,e=>{if(!e.isSimpleText())return;let n,o=e.getPreviousSibling(),s=e.getTextContent(),c=e;if(z(o)){let n=o.getTextContent(),r=t(n+s);if(i(o)){if(r===null||(e=>e.getLatest().__mode)(o)!==0)return void a(o);{let t=r.end-n.length;if(t>0){let r=n+s.slice(0,t);if(o.select(),o.setTextContent(r),t===s.length)e.remove();else{let n=s.slice(t);e.setTextContent(n)}return}}}else if(r===null||r.start<n.length)return}let l=0;for(;;){n=t(s);let e,u=n===null?``:s.slice(n.end);if(s=u,u===``){let e=c.getNextSibling();if(z(e)){u=c.getTextContent()+e.getTextContent();let n=t(u);if(n===null)return void(i(e)?a(e):e.markDirty());if(n.start!==0)return}}if(n===null)return;if(n.start===0&&z(o)&&o.isTextEntity()){l+=n.end;continue}n.start===0?[e,c]=c.splitText(n.end):[,e,c]=c.splitText(n.start+l,n.end+l),e===void 0&&gC(165,`nodeToReplace`);let d=r(e);if(d.setFormat(e.getFormat()),e.replace(d),c==null)return;l=0,o=d}}),e.registerNodeTransform(n,e=>{let n=e.getTextContent(),r=t(n);if(r===null||r.start!==0)return void a(e);if(n.length>r.end)return void e.splitText(r.end);let o=e.getPreviousSibling();z(o)&&o.isTextEntity()&&(a(o),a(e));let s=e.getNextSibling();z(s)&&s.isTextEntity()&&(a(s),i(e)&&a(e))})]}let vC=/(^|\s)([/@])([\w-]+)/g,yC=/(^|\s)(@(?:"[^"\n]*"?|[^\s"]\S*))/g,bC=/* @__PURE__ */ new Set(`.,;:!?,。;:!?`),xC=/^@.*[/\\.]/u;function SC(e,t,n){if(!n.startsWith(`@"`)){let e=n.length;for(;bC.has(n.charAt(e-1));)--e;return xC.test(n.slice(0,e))?t+e:void 0}if(n.length>3&&n.endsWith(`"`))return t+n.length;let r=n.lastIndexOf(`/`);if(r<0)return;let i=t+r+1;for(;bC.has(e.charAt(i));)i+=1;return i===e.length||/\s/u.test(e.charAt(i))?t+r+1:void 0}let CC=/^(?:\s|$)/;function wC(e,t){if(e===``)return[];let n=[];vC.lastIndex=0;let r;for(;(r=vC.exec(e))!==null;){let i=r[2],a=r[3]??``;if((i!==`/`||CC.test(e.slice(r.index+r[0].length)))&&t.get(i)?.includes(a)){let e=r.index+(r[1]?.length??0);n.push({start:e,end:e+1+a.length,trigger:i})}}yC.lastIndex=0;let i;for(;(i=yC.exec(e))!==null;){let t=i.index+(i[1]?.length??0),r=SC(e,t,i[2]??``);r!==void 0&&!n.some(e=>e.start<r&&e.end>t)&&n.push({start:t,end:r,trigger:`@`})}return n.sort((e,t)=>e.start-t.start)}var TC=class e extends sh{static getType(){return`composer-text-ref`}static clone(t){return new e(t.__text,t.__key)}static importJSON(t){let n=new e(t.text);return n.setFormat(t.format),n.setDetail(t.detail),n.setMode(t.mode),n.setStyle(t.style),n}exportJSON(){return{...super.exportJSON(),type:`composer-text-ref`}}createDOM(e){let t=super.createDOM(e);return t.className=sC(t.className,dC.reference,dC.textRef,this.getTextContent().startsWith(`/`)&&dC.openable),t.setAttribute(`spellcheck`,`false`),t.setAttribute(`data-composer-text-ref`,``),t}isTextEntity(){return!0}canInsertTextBefore(){return!0}};function EC(e,t,n){return tx(..._C(e,e=>{let r=n();for(let n of wC(e,t()))if(r===null||n.start!==0||e.slice(n.start,n.end)!==r.trimEnd())return{start:n.start,end:n.end};return null},TC,e=>new TC(e.getTextContent())))}function DC(e){e.update(()=>{for(let e of X_().getAllTextNodes())(e instanceof TC||e.getPreviousSibling()instanceof TC||/[/@]/u.test(e.getTextContent()))&&e.markDirty()},{tag:Km})}function OC(e,t){return e.registerCommand(xp,e=>{if(e.target===null||e.button!==0||e.detail>1)return!1;let n=V();if(B(n)&&!n.isCollapsed())return!1;let r=q_(e.target);if(hC(r)){if(r.isInvalid())return!1;let e=r.getAppearance();return t(r.getSource(),{ref:r.getReference(),...e===void 0?{}:{appearance:e}})}return r instanceof TC&&t(void 0,{ref:r.getTextContent()})},1)}function kC(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 AC=ru([D(),O(),k(),Yl()]);function jC(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 MC=Lu(jC,{message:`JSON value must not contain circular references`}),NC=Fu(()=>ru([AC,A(NC),du(D(),NC)])),PC=MC.pipe(NC);MC.pipe(A(NC));let FC=MC.pipe(du(D(),NC)),IC=M({code:D().min(1),message:D().min(1),retryable:k(),diagnostic:D().min(1).optional(),stage:D().min(1).optional(),durationMs:O().int().nonnegative().optional(),stderrTail:D().min(1).optional()}).superRefine(kC([`diagnostic`,`stage`,`durationMs`,`stderrTail`])),LC=D().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u),RC=e=>D().min(1).max(e).refine(e=>e.trim().length>0),zC=du(LC,j({label:RC(256).optional(),description:RC(1024).optional()}).strict()).refine(e=>Object.keys(e).length<=16,`Too many locales`),BC=du(LC,RC(4096)).refine(e=>typeof e.en==`string`,`English fallback is required`).refine(e=>Object.keys(e).length<=16,`Too many locales`),VC=D().refine(e=>e.trim().length>0,{message:`Identifier must not be empty or whitespace`}),HC=VC.brand(),Y=VC.brand(),UC=VC.brand();VC.brand(),VC.brand();let WC=D().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),GC=WC.max(128).regex(/^[A-Za-z0-9._~:-]+$/u,`Permission Mode ID must use transport-safe characters`).brand(),KC=j({modes:A(j({id:GC,label:WC.max(256),description:WC.max(1024).optional(),dangerous:k().optional(),localizations:zC.optional()}).strict()).min(1).max(32),defaultModeId:GC}).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`]})});j({threadId:Y,permissionModeId:GC}).strict();let qC=D().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`});j({sourceThreadId:Y,lastTurnId:UC.optional(),targetHarnessId:HC,targetModel:qC.max(1024).optional(),targetThinkingOptionId:qC.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).optional()}).strict();let JC=j({sourceThreadId:Y,sourceHarnessId:HC,sourceHarnessLabel:qC.max(256).optional(),sourceModel:qC.max(1024).optional(),targetHarnessId:HC,targetHarnessLabel:qC.max(256).optional(),targetModel:qC.max(1024).optional(),totalTurns:O().int().min(1),boundaryTurnNumber:O().int().min(1),includedTurnNumbers:A(O().int().min(1)),omittedTurns:O().int().min(0),preview:D().max(32e3),createdAtMs:O().int().nonnegative()}).strict();j({threadId:Y,handoff:JC}).strict();let YC=O().int().safe().nonnegative(),XC=O().finite().nonnegative(),ZC=O().finite().min(0).max(100),QC=j({version:ru([P(3),P(4)]).optional(),requestId:D().min(1),turnId:D().min(1).max(1024),outputTokens:YC,startedAtMs:YC,completedAtMs:YC}).strict().refine(e=>e.completedAtMs>e.startedAtMs),$C=j({version:ru([P(2),P(3),P(4)]).optional(),value:XC,turnId:D().min(1).max(1024),at:YC}).strict();j({outputTimings:A(QC).transform(e=>e.filter(e=>e.version===4)).optional(),outputTokensPerSecond:$C.refine(e=>e.version===4).optional().catch(void 0),timeToFirstOutputMs:$C.extend({value:YC}).optional()}).strict();let ew=e=>BC.refine(t=>Object.values(t).every(t=>t.length<=e)),tw=j({composerIndicators:A(j({kind:P(`countdown`),id:D().min(1).max(64),expiresAtUnix:YC,label:ew(256).optional(),tooltip:ew(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:YC.optional(),cachedInputTokens:YC.optional(),cacheWriteInputTokens:YC.optional(),outputTokens:YC.optional(),outputTokensPerSecond:XC.optional(),sessionOutputTokensPerSecond:XC.optional(),apiOutputTokensPerSecond:XC.optional(),reasoningOutputTokens:YC.optional(),totalTokens:YC.optional(),totalCostUsd:XC.optional(),totalCredits:XC.optional(),contextUsagePercent:XC.optional(),cacheHitRatePercent:ZC.optional(),contextWindowTokens:YC.optional(),contextUsedTokens:YC.optional(),planFiveHourUsedPercent:ZC.optional(),planFiveHourResetsAtUnix:YC.optional(),planSevenDayUsedPercent:ZC.optional(),planSevenDayResetsAtUnix:YC.optional(),sessionCacheHitRatePercent:ZC.optional(),timeToFirstOutputMs:YC.optional(),latestRequestTimeToFirstOutputMs:YC.optional(),costSource:N([`publicPrice`,`native`]).optional(),unpricedModels:A(D().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`]})}),nw=O().finite().min(0).max(100),rw=N([`weekly`,`monthly`,`five_hour`,`seven_day`,`unknown`]),iw=j({id:D().min(1).max(256),label:D().min(1).max(256),localizations:zC.optional()}).strict(),aw=j({product:D().min(1),periodType:rw.optional(),scope:iw.optional(),localizations:zC.optional(),used:O().finite().nonnegative().optional(),limit:O().finite().nonnegative().optional(),unit:D().min(1).max(32).optional(),usagePercent:nw,resetsAt:D().min(1).optional()}).strict(),ow=j({availableCount:O().int().safe().positive(),nextExpiresAt:D().min(1).optional(),expiresAt:A(D().min(1)).min(1).max(32).optional()}).strict(),sw=j({used:O().finite().nonnegative().optional(),limit:O().finite().nonnegative().optional(),unit:D().min(1).max(32).optional(),label:D().min(1).optional(),scope:iw.optional(),localizations:zC.optional(),usedPercent:nw,resetsAt:D().min(1).optional(),periodType:rw,productUsage:A(aw).min(1).optional(),resetCredits:ow.optional()}).strict(),cw=j({amount:O().finite().nonnegative(),currency:D().trim().min(1).max(8),label:D().trim().min(1).max(128).optional()}).strict();j({threadId:Y,refresh:P(`exact`).optional()}).strict(),j({threadId:Y,usage:tw.nullable(),accountCredits:sw.optional(),accountBalance:cw.optional(),accountCreditsSupported:k().optional()}).strict();let lw=D().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),uw=D().min(1).max(512).refine(e=>!/\p{Cc}/u.test(e),`Model Ref must not contain control characters`).brand(),dw=N([`priority`,`ultrafast`]),fw=j({id:uw,serviceTier:dw.optional()}).strict();function pw(e,t){return e?.id===t?.id&&e?.serviceTier===t?.serviceTier}let mw=lw.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).brand(),hw=lw.max(256),gw=j({id:mw,label:lw.max(256)}).strict(),_w=j({ref:fw,label:lw.max(256),resolvedModelLabel:hw.optional(),fastModel:fw.optional(),supportedThinkingOptionIds:A(mw).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 vw(e,t){if(t)return e?.models.find(e=>pw(e.ref,t)||pw(e.fastModel,t))}let yw=A(gw).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)}),bw=N([`catalog`,`activeModel`]),xw=j({models:A(_w),defaultModel:fw.optional(),thinkingOptions:yw,defaultThinkingOptionId:mw.optional(),thinkingOptionsScope:bw.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=>pw(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=>pw(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&&!vw(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`]})}),Sw=j({fork:k(),forkAcrossCwd:k(),rollbackLastTurn:k()}).strict().refine(e=>e.fork||!e.forkAcrossCwd,{path:[`forkAcrossCwd`],message:`Cross-cwd Fork requires exact history Fork support`}),Cw=N([`live`,`atCreate`]),ww=j({configuration:j({selectModel:k(),selectThinkingOption:k(),selectPermissionMode:k(),permissionModeScope:Cw.default(`live`)}).strict(),history:Sw,subagents:j({observe:k(),readTranscript:k()}).strict().optional(),autonomousTurns:j({observe:k()}).strict().optional(),steer:k().optional(),persistentPlan:k().optional()}).strict();j({effectiveModel:fw.optional(),resolvedModelLabel:hw.optional(),effectiveThinkingOptionId:mw.optional(),availableThinkingOptions:yw.optional(),effectivePermissionModeId:GC.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 Tw=j({open:P(!0)}).strict();ru([j({status:P(`ready`),catalog:xw,permissionModes:KC.optional(),capabilities:ww,webUi:Tw.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`]})}),j({status:N([`notInstalled`,`unavailable`,`error`]),error:IC}).strict()]),j({harnessId:HC,cwd:lw.max(16384).optional(),refresh:k().optional(),purpose:P(`availability`).optional(),credentialAccess:N([`allow`,`retry`]).optional()}).strict(),j({harnessId:HC}).strict(),j({}).strict(),j({threadId:Y,model:fw}).strict(),j({threadId:Y,thinkingOptionId:mw}).strict(),j({threadId:Y,includeReferenceCapability:k().optional()}).strict(),au(`owner`,[j({owner:P(`codex`),locked:k(),effectiveModel:fw.optional(),resolvedModelLabel:hw.optional(),effectiveThinkingOptionId:mw.optional(),effectivePermissionModeId:GC.optional(),history:Sw.optional(),supportsThreadReferences:P(!0).optional(),handoff:JC.optional()}).strict(),j({owner:P(`external`),harnessId:lw.max(256),transportModelId:lw.max(8192),effectiveModel:fw.optional(),resolvedModelLabel:hw.optional(),effectiveThinkingOptionId:mw.optional(),availableThinkingOptions:yw.optional(),effectivePermissionModeId:GC.optional(),catalog:xw.optional(),history:Sw,usage:tw.optional(),handoff:JC.optional(),locked:P(!0)}).strict()]),j({threadIds:A(Y).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 Ew=au(`owner`,[j({threadId:Y,owner:P(`codex`)}).strict(),j({threadId:Y,owner:P(`external`),harnessId:D().max(256).pipe(HC)}).strict()]);j({threads:A(Ew).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)}),j({threadId:Y,text:D().optional()}).strict(),j({kind:P(`application`),value:D().transform((e,t)=>{try{return JSON.parse(e)}catch{return t.addIssue({code:`custom`,message:`Invalid steering context JSON`}),Qn}}).pipe(j({expectedTurnId:UC,clientUserMessageId:D().min(1),delivery:N([`newTurn`,`activeTurn`])}).strict())}).strict().transform(e=>e.value),N([`activeTurn`,`newTurn`]),j({delivery:N([`official`,`activeTurn`,`newTurn`])}).strict();let Dw=D().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u),Ow=Dw.pipe(HC),kw=Ow.refine(e=>e!==`codex`,`The official Codex identity is reserved`),Aw=D().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`),jw=Ol().refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Plugin documentation links must be credential-free HTTPS URLs`),Mw=j({en:D().max(4096),"zh-CN":D().max(4096).optional()}).strict(),Nw=j({commands:A(j({terminal:D().max(256),command:D().max(4096)}).strict()).max(8),before:Mw.optional(),after:Mw.optional(),downloads:A(j({label:D().max(128),url:jw}).strict()).max(8).optional()}).strict(),Pw={id:Ow,name:D().trim().min(1).max(128),version:D().min(1).max(128),kind:P(`usage`).optional(),iconStyle:j({vector:j({viewBox:D().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),color:D().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),paths:A(j({d:D().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),fillRule:N([`evenodd`,`nonzero`]).optional(),fill:D().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()}).strict()).min(1).max(32)}).strict().optional(),background:D().regex(/^#[a-f0-9]{6}$/iu).optional(),borderRadius:O().min(0).max(50).optional(),paddingRatio:O().min(0).max(.25).optional()}).strict().optional(),installation:Nw.optional(),notice:Mw.optional(),launchCommand:P(!0).optional(),links:j({website:jw.optional(),documentation:jw.optional(),installation:jw.optional()}).strict().optional()};j({manifestVersion:P(1),...Pw,adapterApiVersion:O().int().positive(),entry:Aw,icon:Aw.optional()}).strict();let Fw=D().max(174828).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u),Iw=j({...Pw,icon:Fw.optional()}).strict();j({}).strict(),j({plugins:A(Iw.extend({id:kw})).max(128)}).strict(),j({version:P(1),enabled:A(Ow).max(128)}).strict().refine(e=>new Set(e.enabled).size===e.enabled.length,{message:`Enabled plugin IDs must be unique`,path:[`enabled`]});let Lw=131072,Rw=Dw,zw=N([`sidebar.thread-layout`,`sidebar.thread-badge`,`appearance.theme`]),Bw=N([`appearance`,`interface`,`workflow`,`analytics`,`integrations`,`tools`]),Vw=D().trim().min(1).max(128);function Hw(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 Uw=e=>e.split(`/`).every(e=>!/[. ]$/u.test(e)),Ww=Aw.refine(e=>Hw(e)!==void 0&&Uw(e),`Images must be relative .png, .jpg, .jpeg, or .webp paths with no segments ending in a dot or space`),Gw=D().trim().max(2048).regex(/^https?:\/\/[^/?#\\\s]+/iu,`Expected an HTTP(S) URL`).pipe(Ol({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 Kw(e){return M({en:e,"zh-CN":e})}let qw=Kw(D().trim().min(1)),Jw=A(Bw).max(Bw.options.length).refine(e=>new Set(e).size===e.length,`Duplicate categories`),Yw=A(zw).max(zw.options.length).refine(e=>new Set(e).size===e.length,`Duplicate slots`),Xw={key:D().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),label:qw,description:qw.optional()},Zw={...Xw,step:O().positive().optional(),default:O().optional()},Qw=M({value:D(),label:qw}),$w=au(`type`,[M({...Xw,type:P(`boolean`),default:k().optional()}),M({...Xw,type:P(`string`),placeholder:qw.optional(),default:D().optional()}),M({...Zw,type:P(`number`),min:O().optional(),max:O().optional()}),M({...Zw,type:P(`range`),min:O(),max:O()}),M({...Xw,type:P(`select`),options:A(Qw).min(1),default:D().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`)}}),eT=j({manifestVersion:Kl().positive(),id:Rw,name:ru([Vw,Kw(Vw)]),version:D().min(1).max(128),desktopApi:Kl().positive()}).passthrough().extend({manifestVersion:P(1),desktopApi:P(1),description:M({en:D().max(4096),"zh-CN":D().max(4096).optional()}).optional(),author:D().trim().min(1).max(128).optional(),repository:Gw.optional(),details:M({en:D().max(16384),"zh-CN":D().max(16384).optional()}).optional(),icon:Ww.optional(),screenshots:A(Ww).max(4).refine(e=>new Set(e).size===e.length,`Duplicate screenshots`).optional(),desktop:M({script:Aw,style:Aw.optional()}).optional(),backend:M({script:Aw.refine(Uw)}).optional(),slots:Yw.default(()=>[]),settingsSchema:A($w).max(32).refine(e=>new Set(e.map(({key:e})=>e)).size===e.length,`Duplicate setting keys`).optional(),categories:Jw.optional()}).strict().refine(e=>e.desktop!==void 0||e.backend!==void 0,`Expected at least one desktop or backend entry`),tT=D().regex(/^[a-f0-9]{64}$/u),nT=M({state:N([`running`,`disabled`,`invalid`,`incompatible`,`conflict`,`failed`,`waiting`]),hash:tT.optional(),error:D().optional(),conflictWith:Rw.optional()});M({controllerPid:Kl().positive(),targetId:D().nullable(),updatedAt:Bu(),handledReloadToken:El().optional(),extensions:du(D(),nT),surfaces:du(D(),nT).optional()});let rT=N([`official`,`community`]);function iT(e){return e.origin===`https://api.github.com`&&/^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(e.pathname)}let aT=Gw.refine(e=>{let t=new URL(e);return/\.zip$/iu.test(t.pathname)||iT(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`),oT=M({id:Rw,version:D().trim().min(1).max(128),name:qw.extend({en:Vw,"zh-CN":Vw}),description:Kw(D().trim().min(1).max(4096)),details:Kw(D().trim().min(1).max(16384)).optional(),author:D().trim().min(1).max(128),repository:Gw,stars:O().int().min(0).optional(),downloads:O().int().min(0).optional(),categories:Jw.optional(),trustTier:rT.default(`community`),icon:Gw.optional(),screenshots:A(Gw).max(4).optional(),downloadUrl:aT,sha256:tT,slots:Yw.optional(),publishedAt:D().optional(),updatedAt:D().optional(),minCodexHostVersion:D().optional()});M({schemaVersion:P(1),generatedAt:D(),extensions:A(oT).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,`Duplicate extension IDs`)});let sT=D().trim().min(1).max(128),cT=/^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³]) *(?:\.|$)/iu,lT=Rw.refine(e=>!cT.test(e),`Reserved extension ID`),uT=N([`desktop`,`web`]),dT=tT,fT=El(),pT=Aw.refine(e=>!/[\x00-\x1f\x7f<>"|*]/u.test(e)&&e.split(`/`).every(e=>!/[. ]$/u.test(e)&&!cT.test(e)),`Expected a portable relative resource path`).refine(e=>e.split(`/`).length<=32,`Extension resources may be at most 32 segments deep`),mT=eT.shape,hT=(e,t=0)=>M({en:D().trim().min(t).max(e),"zh-CN":D().trim().min(t).max(e)}),gT=e=>pT.refine(t=>t.endsWith(e),`Expected a ${e} file`),_T=gT(`.mjs`),vT=gT(`.css`).optional(),yT=e=>e.normalize(`NFC`).toLowerCase(),bT=M({manifestVersion:P(2),id:lT,name:hT(128,1),version:D().trim().min(1).max(128),description:hT(4096),details:hT(16384).optional(),author:mT.author,repository:mT.repository,icon:mT.icon.refine(e=>e===void 0||pT.safeParse(e).success),screenshots:mT.screenshots.refine(e=>e===void 0||e.every(e=>pT.safeParse(e).success)),categories:mT.categories,settingsSchema:mT.settingsSchema,slots:mT.slots.removeDefault().optional(),page:M({apiVersion:P(1),entry:_T,style:vT,title:hT(128,1).optional()}).optional(),widget:M({apiVersion:P(1),entry:_T,style:vT}).optional(),desktop:M({apiVersion:P(1),script:gT(`.js`),style:vT}).optional(),web:M({apiVersion:P(1),entry:_T.optional(),style:vT}).refine(({entry:e,style:t})=>e!==void 0||t!==void 0,`Expected a Web entry or style`).optional(),backend:M({apiVersion:P(1),entry:_T}).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||yT(e)!==yT(r.entry)),{path:[`backend`,`entry`],message:`A backend entry cannot also be a frontend entry`});function xT({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 ST=sT,CT=N([`running`,`waiting`,`idle`,`unknown`]),wT=M({sourceThreadId:Y,createdAtMs:O().int().nonnegative()}),TT=M({harnessId:HC,title:D().optional(),status:CT,archived:k(),updatedAtMs:O().int().nonnegative().optional()}),ET=M({revision:Kl().nonnegative(),parents:du(Y,Y),handoffs:du(Y,wT).optional(),nodes:du(Y,TT),truncated:k()}).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`),DT=D().min(1).max(128);M({});let OT=M({subscriptionId:DT});M({}),OT.extend({snapshot:ET});let kT=Kl().nonnegative(),AT=M({revision:kT,enabled:A(lT).max(64).refine(e=>new Set(e).size===e.length,`Duplicate extension IDs`)});M({version:P(1),seeded:A(lT).max(64).refine(e=>new Set(e).size===e.length,`Duplicate extension IDs`)});let jT=j({version:D().trim().min(1).max(128),publishedAt:D().trim().min(1).max(64).optional(),notes:D().trim().min(1).max(8192),url:Gw.optional()}),{downloadUrl:MT,...NT}=oT.shape,PT=j({...NT,id:lT,format:P(`codexhost`),targets:A(uT).min(1).max(2).refine(e=>new Set(e).size===e.length,`Duplicate targets`),apis:M({page:Kl().positive().optional(),widget:Kl().positive().optional(),desktop:Kl().positive().optional(),web:Kl().positive().optional(),backend:Kl().positive().optional()}),downloadUrl:MT.refine(e=>e.startsWith(`https://`),`Expected HTTPS`),featured:k().optional(),featuredOrder:Kl().nonnegative().optional(),changelog:A(jT).max(20).optional()}).refine(({targets:e,apis:t})=>{let n=xT({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`);j({schemaVersion:P(2),generatedAt:D().min(1),extensions:A(PT).max(1e4).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,`Duplicate extension IDs`)}).extend({catalogUrl:Gw,fetchedAt:Bu(),cached:k(),stale:k().optional()});let FT={id:lT},IT={...FT,activationId:fT,digest:dT},LT={...FT,activationId:IT.activationId.optional()},RT=D().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`),zT=D().min(1).max(256).refine(e=>e.split(`/`).every(e=>e&&/^[a-z0-9_.-]+$/iu.test(e)&&e!==`.`&&e!==`..`),`Invalid GitHub ref`);function BT(e){return D().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 VT=M({type:P(`github`),repository:D().max(150).regex(/^[a-z0-9-]+\/[a-z0-9_-][a-z0-9_.-]*$/iu),ref:zT.optional(),tag:zT.optional(),asset:D().max(255).regex(/^[a-z0-9_.-]+\.zip$/iu).optional(),subpath:pT.optional()}).refine(({ref:e,tag:t,asset:n})=>!e||!t&&!n,`Use either a zipball ref or a release tag/asset`),HT=ru([M({type:P(`catalog`),...FT}),VT,M({type:P(`zip`),base64:BT(67108864).min(4)}),M({type:P(`zip`),localZipPath:RT}),M({type:P(`localDir`),localDir:RT})]),UT=au(`type`,[M({type:P(`catalog`),...FT}),VT,M({type:P(`zip`)}),M({type:P(`localDir`)})]),WT=M({...IT,manifest:bT,installedAt:Bu(),source:UT.optional()}),GT=e=>D().max(23+4*Math.ceil(e/3)).regex(/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/u),KT={desktopConflictWith:lT.optional()},qT=N([`none`,`inactive`,`starting`,`running`,`failed`]),JT=au(`state`,[WT.extend({state:P(`valid`),enabled:k(),...KT,iconDataUrl:GT(Lw).optional(),screenshotDataUrls:A(GT(524288)).max(4).optional(),backendState:qT.optional(),backendError:D().optional()}),M({state:N([`invalid`,`incompatible`]),id:D().min(1),enabled:k(),error:D()})]);M({revision:kT,configuration:AT,diagnostics:A(D()),extensions:A(JT)}),M({revision:kT,extensions:A(WT.extend({...KT,settingsRevision:kT})).max(64)});let YT={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`},XT=Object.freeze(Object.values(YT));new Set(XT),M({});let ZT={expectedRevision:kT};M({...FT,...ZT}),WT.extend({replaced:k()}),au(`state`,[M({state:P(`saved`),configuration:AT}),M({state:P(`revision-conflict`),revision:kT})]),M({...LT,digest:IT.digest.optional(),path:pT}),M({mimeType:D().min(1),base64:BT(16777216),digest:IT.digest}),M({mimeType:N([`image/png`,`image/jpeg`,`image/webp`]),base64:BT(Lw)}),M({settingsRevision:kT,values:FC}),YT.list,YT.snapshot,YT.catalog,M({forceRefresh:k().optional(),staleWhileRevalidate:k().optional()}),YT.catalogIcon,M({...FT}),YT.install,M({source:HT}),YT.update,M({...FT,expectedDigest:IT.digest,expectedActivationId:IT.activationId.optional(),source:HT.optional()}),YT.enable,YT.disable,YT.uninstall,M({...FT,removeData:k().optional(),expectedDigest:IT.digest.optional()}),M({...FT,removed:k()}),YT.recover,M({expectedRevision:ZT.expectedRevision.optional()}),YT.asset,YT.settingsGet,M(LT),YT.settingsSet,M({...LT,expectedSettingsRevision:kT,values:FC}),YT.backendInvoke,M({...LT,method:ST,params:PC.optional()}),M({result:PC}),YT.threadTree,j({threadId:Y}).strict(),j({confirmed:k()}).strict();let QT=[`codex-desktop`,`web`,`web-desktop-shell`,`web-mobile`,`ssh-remote`,`cli`],$T=[`darwin`,`win32`,`linux`],eE=[`arm64`,`x64`,`ia32`,`arm`],tE=[`zh`,`en`,`ja`,`ko`,`de`,`fr`,`es`,`pt`,`ru`,`other`],nE=[`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`],rE=[`official-relay`,`self-hosted-relay`,`tailscale-serve`,`tailscale-funnel`,`tailscale-ip`,`lan`,`custom-proxy`,`remote-peer`],iE=D().min(1).max(40).regex(/^[0-9A-Za-z._+-]+$/u),aE=N(QT),oE=N(tE),sE=N(nE),cE=N(rE);new Set(nE),new Set(tE),j({enabled:k(),forcedOffByEnv:k()}).strict(),j({enabled:k()}).strict(),j({surfaces:A(aE).max(12).optional(),harnesses:A(sE).max(32).optional(),remoteAccess:A(cE).max(12).optional()}).strict(),j({dailyActive:P(!0).optional(),weeklyActive:P(!0).optional(),monthlyActive:P(!0).optional(),newInstall:P(!0).optional(),retainedD1:P(!0).optional(),retainedD7:P(!0).optional(),remoteAny:P(!0).optional(),appVersion:iE.optional(),codexDesktopVersion:iE.optional(),os:N($T).optional(),arch:N(eE).optional(),uiLanguage:oE.optional(),surfaces:A(aE).min(1).max(12).optional(),harnesses:A(sE).min(1).max(32).optional(),remoteAccess:A(cE).min(1).max(12).optional()}).strict().refine(e=>Object.keys(e).length>0,{message:`Telemetry heartbeat must contain at least one countable field`}),[...XT],j({sections:A(j({id:D().min(1),name:D().min(1),threads:A(FC)}).strict())}).strict(),j({threadId:D().min(1).max(1024),sectionId:D().min(1).max(1024).nullable()}).strict(),j({threadIds:A(D().min(1))}).strict(),j({threadId:D().min(1).max(1024),pinned:k()}).strict(),j({}).strict(),j({parents:du(D().min(1),D().min(1))}).strict(),j({prompt:D().max(16384).optional()}).strict(),j({projects:A(j({id:D(),name:D(),rootPaths:A(D()),createdAt:O().int().optional()})),nativeProjects:P(!0).optional(),assignments:du(D(),D()),projectless:A(D()),pinned:A(D()),sectionProjects:du(D(),A(D())).optional(),pinnedProjects:A(D()).optional()});let lE=du(D(),Zl()),uE=j({epoch:D().uuid(),sequence:O().int().nonnegative()});au(`type`,[j({type:P(`projects-changed`),cursor:uE}),j({type:P(`skills-changed`),cursor:uE,cwd:D().optional()}),j({type:P(`harness-inspection-changed`),cursor:uE,harnessId:D().min(1)}),j({type:P(`display-settings-changed`),cursor:uE}),j({type:P(`preferences-changed`),cursor:uE,revision:O().int().nonnegative()}),j({type:P(`extensions-changed`),cursor:uE,revision:kT}),j({type:P(`hello`),version:P(1),cursor:uE,reset:k()}),j({type:P(`changed`),cursor:uE,threadId:D().min(1),method:D().min(1)})]);let dE=au(`type`,[j({type:P(`text`),id:D(),prompt:D(),secret:k().optional(),optional:k().optional()}),j({type:P(`choice`),id:D(),prompt:D(),multiple:k(),allowOther:k(),optional:k().optional(),options:A(j({value:D(),label:D(),description:D().optional()}))})]),fE=au(`type`,[j({type:P(`approval`),title:D(),description:D().optional(),subject:Zl().optional(),actions:A(j({id:D(),label:D(),effect:D()}))}),j({type:P(`question`),title:D().optional(),questions:A(dE)})]),pE=j({requestId:ru([D(),O().int()]),threadId:D(),kind:N([`approval`,`question`]),interaction:fE,request:lE}),mE=j({id:D().min(1),clientUserMessageId:D().min(1),input:A(lE),presentationInput:A(lE).nullable().optional()}).passthrough();j({fields:A(j({path:A(ru([D(),O().int().nonnegative()])),originalLength:O().int().nonnegative()}))});let hE=j({id:D().min(1),status:D().min(1),codexhostTurnOutcome:j({status:P(`unknown`),reason:D()}).optional(),items:A(j({id:D().min(1),type:D().min(1)}).passthrough()),codexhostFileOperations:A(j({beforeItemId:D().nullable(),item:j({id:D().min(1),type:D().min(1)}).passthrough()})).optional(),error:j({message:D().optional()}).passthrough().nullable().optional(),fingerprint:D().min(1).optional(),unchanged:P(!0).optional()}).passthrough(),gE=j({id:D().min(1).max(512),fingerprint:D().min(1).max(128)});j({threadId:D().min(1),knownTurns:A(gE).max(64).optional(),truncateToolOutput:k().optional()});let _E=j({harnessId:D().min(1),nativeSessionId:D().min(1)});j({cursor:uE,activeTurnId:D().min(1).nullable().optional(),command:j({name:D().min(1),turn:hE,subsequentTurnId:D().min(1).optional()}).optional(),thread:j({id:D().min(1),cwd:D(),modelProvider:D().min(1),createdAt:O(),updatedAt:O(),recencyAt:O().nullable().optional(),status:j({type:D()}).passthrough(),name:D().nullable().optional(),preview:D().optional(),codexhostImportSource:_E.optional(),turns:A(hE).length(0)}).passthrough(),turnsPage:j({data:A(hE).max(5),nextCursor:D().nullable()}),configuration:j({native:j({model:D().min(1).max(1024).optional(),reasoningEffort:D().min(1).max(128).optional()}).optional(),effectiveModel:fw.optional(),effectiveThinkingOptionId:mw.optional(),effectivePermissionModeId:GC.optional()}),queue:j({items:A(mE),pausedReason:N([`interrupted`,`outcome-unknown`,`failed`]).nullable()}).optional(),interactions:A(pE),handoff:JC.optional()}),j({version:P(1),owner:P(`service`).optional(),pid:O().int().positive(),port:O().int().min(1).max(65535),token:D().regex(/^[0-9a-f]{64}$/u),startedAt:O(),epoch:D().uuid(),capabilities:j({peerDelegation:P(1).optional()}).optional()}),j({epoch:D().uuid(),threadId:D().min(1),requestId:ru([D(),O().int()]),result:lE}),j({includeArchived:k().optional(),officialCursor:j({live:D().nullable(),archived:D().nullable().optional()}).strict().optional(),scope:ru([j({cwd:D().min(1).max(4096),excludeCwds:A(D().min(1).max(4096)).max(1024)}).strict(),j({projectId:D().min(1).max(1024),legacyThreadIds:A(D().min(1).max(1024)).max(1024),rootPaths:A(D().min(1).max(4096)).max(1024).optional()}).strict()]).optional()}).strict(),j({threads:A(FC),ownership:A(Ew),archivedThreadIds:A(Y),officialCursor:j({live:D().nullable(),archived:D().nullable().optional()}).strict().optional()}).strict(),Iw.pick({id:!0,name:!0,icon:!0,iconStyle:!0});let vE=M({threadId:D().max(1024),title:D().max(240),project:D().max(240),harness:M({id:D().min(1).max(128),name:D().min(1).max(128)}).optional(),state:N([`idle`,`running`,`waiting`,`completed`,`failed`]),updatedAt:O().nonnegative()});M({epoch:D().max(128),revision:Kl().nonnegative(),running:Kl().nonnegative(),waiting:Kl().nonnegative(),sessions:A(vE).max(32).default([]),notifications:A(M({threadId:D().max(1024),key:D().max(4096),kind:N([`completed`,`failed`,`approval`,`question`]),revision:Kl().nonnegative()})).max(256)});let yE=D().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);j({available:k()}).strict(),j({path:D().min(1),mimeType:yE}).strict();let bE=N([`credentials-unavailable`,`login-expired`,`rate-limited`,`service-rejected`,`host-incompatible`,`network`,`timeout`,`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`]);au(`ok`,[j({ok:P(!0),text:D()}).strict(),j({ok:P(!1),error:j({code:bE}).strict()}).strict()]),j({threadId:Y.optional(),cwd:D().min(1).optional()}).strict().refine(e=>!(e.threadId&&e.cwd),{message:`Specify threadId or cwd, not both`});let xE=j({name:D().min(1).regex(/^[^\s[\]]+$/u),description:D().optional(),path:D().min(1),scope:N([`project`,`global`]),source:D().min(1)}).strict();j({revision:O().int().nonnegative(),complete:k(),skills:A(xE),warnings:A(D()).optional()}).strict(),j({cwd:D().min(1).optional()}).strict();let SE=/\[\$([^\]\r\n]+)\]\((?:<([^<>\r\n]+)>|([^\s()]+))(?:[ \t]+(?:"[^"\r\n]*"|'[^'\r\n]*'))?\)/gu;function CE(e){return[...e.matchAll(SE)].flatMap(e=>{let t=e[2]??e[3]??``;return!/^(?:\/|[A-Za-z]:[\\/]|\\\\)/u.test(t)||!/[\\/]SKILL\.md$/u.test(t)?[]:[{start:e.index,end:e.index+e[0].length,name:e[1]??``,path:t,text:e[0]}]})}let wE=j({kind:N([`public`,`relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`]),url:D().min(1)}).strict(),TE=au(`status`,[j({status:P(`not-installed`)}),j({status:P(`not-running`)}),j({status:P(`not-logged-in`)}),j({status:P(`https-disabled`)}),j({status:P(`not-serving`),command:D()}),j({status:P(`occupied`),target:D()}),j({status:P(`serving`),url:D(),funnel:k()}),j({status:P(`error`),message:D()})]);j({state:TE,error:D().optional()}).strict();let EE=au(`status`,[j({status:P(`on`)}),j({status:P(`off`)}),j({status:P(`invalid`),reason:D()})]),DE=j({lan:k(),autostart:EE}).strict(),OE=j({expiresAt:D().optional(),issuing:k(),failure:j({detail:D().optional(),retryAt:D(),paused:k()}).optional()}),kE=au(`status`,[j({status:P(`off`),reason:N([`invite`,`name-taken`,`banned`]).optional()}),j({status:P(`connecting`),reason:N([`full`,`unreachable`]).optional()}),j({status:P(`connected`),url:D(),certificate:OE}),j({status:P(`missing-certificate`),url:D(),certificate:OE}),j({status:P(`stopped`),reason:N([`replaced`,`rejected`,`unsupported-version`])})]);D().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()),D().regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)?$/);let AE=N([`official`,`self-hosted`]);j({secret:D().min(1),lastUsedAt:O().nullable(),networkUrls:A(wE),directCandidates:A(wE).optional(),tailscale:TE,background:DE.optional(),relay:j({state:kE,enabled:k(),kind:AE,officialHost:D(),customHost:D().optional(),officialHostname:D().optional(),customHostname:D().optional(),quotaUntil:D().optional()}).strict().optional()}).strict();let jE=M({threadId:D().min(1).max(1024),view:N([`result`,`messages`]),from:O().int().min(1).max(2**53-1).optional(),to:O().int().min(1).max(2**53-1).optional()}),ME=/^[a-zA-Z0-9_-]{1,64}$/u,NE=D().regex(ME),PE=D().regex(ME),FE=D().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u),IE=N([`relay`,`tailscale`,`lan`,`custom`]),LE=[`blue`,`purple`,`cyan`,`green`,`amber`,`rose`,`slate`],RE=N(LE);new Set(LE);let zE=N([`connected`,`connecting`,`auth-error`,`offline`,`disabled`]),BE=j({peerId:NE,hostId:FE,nodeId:PE.optional(),name:D().min(1).max(120),color:RE.optional(),origin:D().min(1).max(2048),transportKind:IE,encrypted:k(),enabled:k(),state:zE,supportsPeerPairing:k().optional(),pairedBack:k().optional(),linkedPeerIds:A(NE).max(128).optional(),latencyMs:O().int().nonnegative().optional(),version:D().max(128).optional(),platform:D().max(64).optional(),hostname:D().max(255).optional(),homeDir:D().max(4096).optional(),lastError:D().max(1e3).optional(),projectCount:O().int().nonnegative(),createdAt:D(),updatedAt:D()});j({localPlatform:D().max(64).optional(),peers:A(BE)}),j({connectionUrl:D().min(1).max(4096).optional(),origin:D().min(1).max(2048).optional(),token:D().min(1).max(2048).optional(),name:D().trim().min(1).max(120).optional(),color:RE.optional(),pairBack:k().optional(),meshPeerIds:A(NE).max(64).optional(),selfOrigin:D().min(1).max(2048).optional()}).refine(e=>!!e.connectionUrl||!!e.origin&&!!e.token,`Provide either connectionUrl or both origin and token`),M({origin:D().min(1).max(2048),token:D().min(1).max(2048),name:D().trim().min(1).max(120).optional(),color:RE.optional(),expectedNodeId:PE.optional()}),j({status:N([`added`,`updated`,`existing`]),peerId:NE,hostId:FE,nodeId:PE.optional()});let VE=N([`added`,`updated`,`existing`,`failed`,`skipped`]);j({results:A(j({targetPeerId:NE,targetName:D().min(1).max(120),introducedHost:ru([P(`local`),NE]),introducedName:D().min(1).max(120),status:VE,error:D().max(1e3).optional()}))}),j({peerIds:A(NE).max(64).optional(),includeSelf:k().optional(),includeMesh:k().optional(),selfOrigin:D().min(1).max(2048).optional()}),j({peerId:NE,name:D().trim().min(1).max(120).optional(),color:RE.nullable().optional(),connectionUrl:D().min(1).max(4096).optional(),origin:D().min(1).max(2048).optional(),token:D().min(1).max(2048).optional(),enabled:k().optional()}),j({peerId:NE}),j({removed:k()}),j({peerId:NE.optional(),connectionUrl:D().min(1).max(4096).optional(),origin:D().min(1).max(2048).optional(),token:D().min(1).max(2048).optional()}).refine(e=>!!e.peerId||!!e.connectionUrl||!!e.origin&&!!e.token,`Provide peerId, connectionUrl, or both origin and token`);let HE=j({id:D().min(1).max(1024),name:D().min(1).max(512),path:D().min(1).max(8192)});j({ok:k(),nodeId:PE.optional(),supportsPeerPairing:k().optional(),pairedBack:k().optional(),latencyMs:O().int().nonnegative().optional(),origin:D().max(2048).optional(),transportKind:IE.optional(),encrypted:k().optional(),version:D().max(128).optional(),platform:D().max(64).optional(),hostname:D().max(255).optional(),homeDir:D().max(4096).optional(),projectCount:O().int().nonnegative().optional(),projects:A(HE).optional(),error:D().max(1e3).optional()});let UE=j({id:D().min(1).max(1024),name:D().min(1).max(512),path:D().min(1).max(8192),threadIds:A(D().min(1).max(1024))}),WE=j({attachments:P(1).optional(),workspaceFiles:P(1).optional(),officePreview:P(1).optional(),delegation:P(1).optional(),peerPairing:P(1).optional()}),GE=j({version:D().max(128),platform:D().max(64),hostname:D().max(255),homeDir:D().max(4096).optional(),epoch:D().min(1).max(256),nodeId:PE.optional(),peerNodes:du(FE,PE).refine(e=>Object.keys(e).length<=128).optional(),projects:A(UE),capabilities:WE.optional()});M({threadId:D().min(1).max(1024),scope:D().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:D().min(1).max(256).optional(),mode:N([`queue`,`steer`]).optional(),expectedTurnId:D().min(1).max(1024).nullable().optional(),content:A(au(`type`,[M({type:P(`text`),text:D()}),M({type:P(`file`),receiptId:D().min(1).max(128)})])).min(1).max(64)});let KE=j({ok:P(!1),error:j({code:D(),message:D(),details:du(D(),Zl()).optional()})});ru([j({ok:P(!0),value:j({receiptId:D().min(1),file:j({attachmentId:D(),name:D(),bytes:O().int().nonnegative()})})}),KE]),ru([j({ok:P(!0),value:j({accepted:P(!0)})}),KE]);let qE=j({name:D().min(1).max(512),path:D().min(1).max(8192),kind:P(`directory`)});j({peerId:NE,path:D().min(1).max(8192).optional()}),j({path:D().min(1).max(8192),parentPath:D().min(1).max(8192).nullable(),homeDir:D().min(1).max(8192).optional(),entries:A(qE)}),j({peerId:NE,parentPath:D().min(1).max(8192),name:D().min(1).max(255).refine(e=>e.trim().length>0,`Directory name cannot be blank`)}),j({path:D().min(1).max(8192),name:D().min(1).max(255)}),j({peerId:NE,path:D().min(1).max(8192),title:D().trim().min(1).max(255).optional()}),j({peerId:NE,workspaceId:D().min(1).max(1024),title:D().trim().min(1).max(255)}),j({peerId:NE,workspaceId:D().min(1).max(1024)}),j({workspaceId:D().min(1).max(1024).optional(),manifest:GE}),j({sessionHostId:D().min(1).max(128).optional()}),j({hosts:A(j({hostId:ru([P(`local`),FE]),name:D().min(1).max(120),isLocal:k().optional(),color:RE.optional(),hostname:D().max(255).optional()}))}),j({hostId:ru([P(`local`),FE])}),j({harnesses:A(j({id:D().regex(/^[a-z0-9][a-z0-9-]*$/u),name:D().min(1).max(120)}))});let JE=N([`listHarnesses`,`inspect`,`start`,`send`,`cancel`,`read`,`answer`,`list`]);M({operation:JE,hopCount:O().int().min(0).max(16),sourceId:NE.optional(),input:FC});let YE=M({code:D().min(1).max(128),message:D().max(4096),details:FC.optional()});ru([M({ok:P(!0),value:PC}),M({ok:P(!1),error:YE})]);let XE=M({id:D().min(1).max(1024),name:D().min(1).max(512),path:D().min(1).max(8192)});M({hosts:A(M({hostId:FE,nodeId:PE.optional(),displayName:D().min(1).max(120),online:k(),state:zE,delegation:k(),projects:A(XE),platform:D().max(64).optional(),hostname:D().max(255).optional(),homeDir:D().max(4096).optional()}))}),M({version:P(1),instanceId:D().min(1).max(128),pid:O().int().positive(),endpoint:D().min(1).max(256),token:D().regex(/^[0-9a-f]{64}$/u),startedAt:O().int().nonnegative()}),ru([M({operation:P(`hosts`)}),M({operation:JE,hostId:FE,hopCount:O().int().min(0).max(16),timeoutMs:O().int().min(1).max(12e4).optional(),input:FC})]);let ZE=j({id:D().min(1).max(256),harnessId:D().min(1),label:D().min(1).max(512),provider:N([`openai-codex`,`xai`])}).strict(),QE=D().regex(/^[a-z][a-z0-9-]{0,47}$/),$E=j({name:QE,source:ZE,importedAt:D()}).strict(),eD=au(`action`,[j({action:P(`list`)}).strict(),j({action:P(`import`),sourceId:D().min(1).max(256),name:QE,confirmed:P(!0)}).strict(),j({action:P(`reimport`),sourceId:D().min(1).max(256),name:QE,confirmed:P(!0)}).strict(),j({action:P(`remove`),name:QE,confirmed:P(!0)}).strict()]),tD=j({provider:D().min(1).max(128),type:N([`oauth`,`api_key`,`unknown`]),label:D().min(1).max(512).optional(),vendor:N([`openai-codex`,`xai`]).optional()}).strict();j({sources:A(ZE),targets:A(j({harnessId:D(),providers:A(N([`openai-codex`,`xai`])),imports:A($E),others:A(tD).default([])}).strict())}).strict(),j({targetHarnessId:D().min(1).max(128).optional(),request:eD}).strict(),j({events:k()});let nD=A(M({agent:D().min(1).max(128),section:N([`main`,`more`,`auto`])})).max(256).refine(e=>new Set(e.map(e=>e.agent)).size===e.length,`Duplicate Harness IDs`);M({entries:nD.nullable()}),M({}),M({entries:nD,initializeOnly:k().optional()});let rD=M({enabled:k(),timeoutMinutes:O().int().min(5).max(1440)});Object.freeze({enabled:!0,timeoutMinutes:10});let iD=D().regex(/^external$/u),aD=HC.transform(e=>String(e)),oD=M({model:fw.optional(),thinkingOptionId:mw.optional(),permissionModeId:GC.optional()}).refine(e=>!!(e.model||e.thinkingOptionId||e.permissionModeId),`A default configuration must contain a preference`),sD=M({lastHarness:HC.optional(),byHarness:du(aD,oD)}),cD=M({model:fw.optional(),thinkingOptionId:mw.optional()}).refine(e=>!!(e.model||e.thinkingOptionId),`A delegation default must contain a Model or Thinking option`),lD=M({byHarness:du(aD,cD)}),uD=D().min(1).max(1024),dD=M({idleRelease:rD.optional(),favorites:du(aD,A(uD).max(2048)).default({}),newThread:sD.optional(),delegation:lD.optional()});M({scope:iD,revision:O().int().nonnegative(),values:dD}),M({scope:iD.default(`external`)});let fD=au(`kind`,[M({kind:P(`idleRelease`),value:rD}),M({kind:P(`favorite`),harnessId:HC,modelId:uD,enabled:k()}),M({kind:P(`favorites`),harnessId:HC,modelIds:A(uD).max(2048)}),M({kind:P(`newThread`),lastHarness:HC.optional(),harnessId:HC.optional(),configuration:oD.optional()}),M({kind:P(`delegation`),harnessId:HC,configuration:cD.nullable()})]);M({scope:iD.default(`external`),operations:A(fD).min(1).max(256),initializeOnly:k().optional(),expectedRevision:O().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`})}),M({version:P(1),revision:O().int().nonnegative(),scopes:du(iD,dD)});let pD=O().finite().nonnegative(),mD=M({input:pD,output:pD,cacheRead:pD.optional(),cacheWrite:pD.optional(),cacheWrite1h:pD.optional()}),hD=D().max(512).refine(e=>e.trim()===e&&e.length>0,`Model ID is required`);M({path:D(),entries:A(M({key:D(),price:mD})),error:D().nullable()}),M({}),M({key:hD,price:mD.nullable(),previousKey:hD.optional()}),M({model:hD});let gD=M({official:k().optional(),canonicalModelId:D().min(1).optional(),provider:D().min(1).max(512),model:D().min(1).max(512),price:mD});M({price:mD.nullable(),suggestions:A(gD).max(6).optional()});let _D=[`today`,`7d`,`30d`,`90d`,`all`],vD=O().int().min(0).max(2**53-1),yD=D().regex(/^\d{4}-\d{2}-\d{2}$/u),bD=D().min(1).max(128),xD=D().min(1).max(512),SD=D().min(1).max(4096);M({range:N(_D),timeZone:D().min(1).max(128).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Unsupported usage statistics timezone`).optional(),harness:bD.optional(),model:xD.nullable().optional(),project:SD.nullable().optional(),date:yD.optional()});let CD=M({requests:vD,inputTokens:vD,cachedInputTokens:vD,cacheWriteInputTokens:vD,cacheKnownInputTokens:vD,cacheHitCachedInputTokens:vD,cacheHitInputTokens:vD,outputTokens:vD,reasoningOutputTokens:vD,costUsd:O().finite().min(0),unpricedRequests:vD,unmeteredRequests:vD}),wD=CD.shape,TD=M({harness:bD,sessionId:D().min(1).max(512),project:SD.nullable(),title:D().min(1).max(200).optional(),models:A(xD).max(16),firstAtMs:vD,lastAtMs:vD,...wD});M({range:N(_D),from:yD.nullable(),to:yD,filters:M({harness:bD.nullable(),model:xD.nullable(),unknownModel:k(),project:SD.nullable(),unknownProject:k(),date:yD.nullable()}),reading:M({complete:k(),sources:vD,read:vD}),failures:A(M({harness:bD,message:D().max(2048)})).max(256),options:M({harnesses:A(bD).max(256),models:A(xD.nullable()).max(4096),projects:A(SD.nullable()).max(4096)}),modelLabels:A(M({harness:bD,model:xD,label:xD})).max(4096).optional(),credits:A(M({harness:bD,model:xD.nullable(),credits:O().finite().min(0),reportedRequests:vD,requests:vD})).max(4096).optional(),totals:CD,daily:A(M({date:yD,harness:bD,...wD})).max(2e5),hourly:A(M({weekday:O().int().min(0).max(6),hour:O().int().min(0).max(23),...wD})).max(168),byHarness:A(M({harness:bD,...wD})).max(256),byModel:A(M({model:xD.nullable(),...wD,harnessPricedRequests:vD})).max(4096),byProject:A(M({project:SD.nullable(),...wD})).max(4096),sessions:A(TD).max(100),recentSessions:A(TD).max(100).optional()}),j({threadId:Y}),j({discarded:k()});let ED=au(`type`,[j({id:D().min(1),type:P(`choice`),prompt:D(),options:A(j({value:D().min(1),label:D(),description:D().optional()})).min(1),multiple:k(),allowOther:k(),optional:k()}),j({id:D().min(1),type:P(`text`),prompt:D(),multiline:k(),secret:P(!1),optional:k(),placeholder:D().optional(),prefill:D().optional()})]),DD=j({interactionId:D().min(1),turnId:D().min(1),title:D().optional(),questions:A(ED).min(1)}).refine(({questions:e})=>e.some(e=>e.type===`choice`&&e.multiple),{message:`Shared cards require at least one multi-select question`});M({threadId:D().min(1)}),j({questions:A(DD)}),M({threadId:D().min(1),turnId:D().min(1),interactionId:D().min(1),answers:du(D(),A(D())),cancelled:k().default(!1)}),j({accepted:P(!0)});let OD=j({path:D(),oldText:D().nullable(),newText:D()});j({sessionId:D().min(1),turn:O().int().nonnegative(),path:D().min(1).optional()}),j({diffs:A(OD)}),M({}),M({}),j({reference:j({sessionId:D().min(1),epoch:D().min(1),turn:O().int().nonnegative(),seq:O().int().nonnegative(),callId:D().min(1),part:O().int().nonnegative(),version:D().min(1)}),length:O().int().nonnegative(),bytes:O().int().nonnegative()}),M({title:D().trim().min(1).max(200),type:N([`info`,`warning`,`danger`]),body:D().trim().min(1).max(16384)}),M({}),M({url:D().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 kD=N([`idle`,`running`,`busy`,`closing`,`failed`,`blocked`]),AD=N([`none`,`disabled`,`timeout`,`operation`,`background`,`identity`,`persistence`,`closeFailed`]);M({threadId:D(),title:D(),harnessId:D(),state:kD,reason:AD,inactiveMs:O().nonnegative()}),M({threadId:Y,turnId:UC});let jD=j({email:D().trim().min(1).max(320).optional(),label:D().trim().min(1).max(256).optional(),plan:D().trim().min(1).max(128).optional(),credits:sw.optional(),balance:cw.optional()}).strict();function MD(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 ND=MD(jD),PD={harnessId:HC,harnessName:D().trim().min(1).max(128)},FD=j(PD).strict();j({}).strict(),j({sources:A(FD).max(128)}).strict(),j({harnessId:HC,refresh:k().optional()}).strict(),j({...PD,account:ND.nullable(),accounts:A(ND).max(8).optional()}).strict(),j({refresh:k().optional()}).strict(),j({accounts:A(MD(jD.extend(PD))).max(128)}).strict(),j({harnessId:kw,model:fw.optional(),thinkingOptionId:mw.optional(),permissionModeId:GC.optional(),prewarm:P(!0).optional()}).strict();let ID=D().trim().min(1).max(4096).refine(e=>!/[\u0000\r\n]/u.test(e),`Invalid entrypoint path`);j({harnessId:kw}).strict().extend({path:ID.nullable()}),j({path:ID.nullable(),restartRequired:k()}).strict(),j({harnessId:HC,action:N([`check`,`update`,`install`]),confirmedVersion:D().min(1).max(128).optional()}).strict().refine(({action:e,confirmedVersion:t})=>e===`update`||t===void 0);let LD=j({currentVersion:D().min(1).max(128),latestVersion:D().min(1).max(128),updateAvailable:k(),canUpdate:k(),latestVerifiedVersion:D().min(1).max(128).optional(),confirmationRequired:P(!0).optional(),versionKind:N([`cli`,`application`]).optional(),manualUpdateUrl:Ol().max(2048).refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Manual updates require a credential-free HTTPS URL`).optional(),message:D().max(2048).optional(),messageCode:D().min(1).max(128).optional(),notice:BC.optional(),latestVersionKind:N([`unknown`,`tracking-branch`]).optional()}).strict();j({taskId:D().uuid()}).strict(),au(`status`,[j({taskId:D().uuid(),status:P(`running`)}).strict(),j({taskId:D().uuid(),status:P(`succeeded`),result:LD}).strict(),j({taskId:D().uuid(),status:P(`failed`),error:j({code:O().int(),message:D().min(1).max(2048)}).strict()}).strict()]);let RD=D().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u),zD=D().trim().min(1),BD=N([`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`]),VD=j({accountId:RD,label:zD.max(256),email:D().email().max(320).optional(),planType:BD.optional()}).strict(),HD=N([`ready`,`unavailable`]);j({version:P(2),currentAccountId:RD.nullable(),phase:HD,revision:O().int().nonnegative(),instanceId:zD.max(1024).optional(),accounts:A(VD).max(1)}).strict(),j({accountId:RD,refresh:k().optional()}).strict(),j({accountId:RD,usage:tw.nullable(),accountCredits:sw.optional(),freshness:N([`live`,`cached`]),observedAt:D().datetime().nullable()}).strict();let UD=1e3,WD=D().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),GD=WD.max(1024),KD=j({nativeSessionId:GD,title:WD.max(4096).nullable(),updatedAt:O().int().nonnegative().max(864e13),cwd:WD.max(16384),running:k().nullable()}).strict();j({}).strict(),j({harnesses:A(j({harnessId:kw,name:WD.max(128)}).strict()).max(128)}).strict(),j({harnessId:kw,query:D().trim().max(4096).refine(e=>!e.includes(`\0`)).optional(),offset:O().int().nonnegative().safe().optional(),limit:O().int().min(1).max(UD).optional()}).strict(),j({candidates:A(KD).max(UD),total:O().int().nonnegative().safe()}).strict(),j({harnessId:kw,nativeSessionId:GD}).strict(),j({threadId:WD.max(1024).pipe(Y)}).strict();let qD=D().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),JD=GD,YD=KD;j({}).strict(),j({candidates:A(YD).max(1e3)}).strict(),j({nativeSessionId:JD}).strict(),j({threadId:qD.max(1024).pipe(Y)}).strict(),j({threadId:Y,lastTurnId:UC}).strict(),j({threadId:Y}).strict();let XD=D().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u).brand();j({commands:A(j({id:XD,invocation:D().min(1).max(128),label:D().trim().min(1).max(128),description:D().trim().min(1).max(512).optional(),localizations:zC.optional(),argumentMode:N([`none`,`text`]),kind:N([`command`,`skill`]).optional()}).strict()),warnings:A(D().min(1)).optional(),source:N([`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)}),j({harnessId:HC,cwd:D().min(1).optional()}).strict(),j({threadId:Y}).strict(),j({threadId:Y,commandId:XD,turnId:UC.optional(),arguments:FC.optional()}).strict(),j({accepted:P(!0),turnId:UC.optional()}).strict();let ZD=P(`2.0`).optional(),QD=$l().optional(),$D=D().min(1),eO=ru([D(),O().int()]),tO=j({code:O().int(),message:D(),data:PC.optional()}).catchall(PC).superRefine(kC([`data`]));ru([j({jsonrpc:ZD,id:eO,method:$D,params:PC.optional(),result:QD,error:QD}).catchall(PC).superRefine(kC([`jsonrpc`,`params`,`result`,`error`])),j({jsonrpc:ZD,id:QD,method:$D,params:PC.optional(),result:QD,error:QD}).catchall(PC).superRefine(kC([`jsonrpc`,`id`,`params`,`result`,`error`])),j({jsonrpc:ZD,id:eO,method:QD,params:QD,result:PC,error:QD}).catchall(PC).superRefine(kC([`jsonrpc`,`method`,`params`,`error`])),j({jsonrpc:ZD,id:eO,method:QD,params:QD,result:QD,error:tO}).catchall(PC).superRefine(kC([`jsonrpc`,`method`,`params`,`result`]))]);let nO=D().refine(e=>e.trim().length>0,{message:`Native identifier must not be empty or whitespace`});M({harnessId:HC,nativeSessionId:nO,locator:PC.optional(),formatVersion:P(1)}).superRefine(kC([`locator`])),M({harnessId:HC,nativeSessionId:nO,nativeTurnKey:nO,formatVersion:P(1)}),M({harnessId:HC,nativeSessionId:nO,checkpointId:nO,locator:PC.optional(),formatVersion:P(1)}).superRefine(kC([`locator`]));let rO=D().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u),iO=N([`npm`,`windows-installer`,`macos-dmg`,`linux-archive`]),aO=N([`prepared`,`downloading`,`waiting-for-exit`,`installing`,`restarting`,`succeeded`,`failed`]),oO=M({completed:O().int().nonnegative(),total:O().int().positive()}).refine(e=>e.completed<=e.total,{path:[`completed`],message:`completed must not exceed total`}),sO=M({version:rO,installation:iO,phase:aO,updatedAt:O().int().nonnegative(),downloadedBytes:O().int().nonnegative().optional(),totalBytes:O().int().positive().optional(),npmDownload:oO.optional(),error:D().min(1).max(500).nullable(),serviceStopOutput:D().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`})});M({});let cO=D().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`),lO=N([`idle`,`downloading`,`ready`,`failed`]),uO=M({downloadedBytes:O().int().nonnegative(),totalBytes:O().int().positive()}).refine(e=>e.downloadedBytes<=e.totalBytes,{path:[`downloadedBytes`],message:`downloadedBytes must not exceed totalBytes`});j({currentVersion:rO,installation:iO.nullable(),latestVersion:rO.nullable(),updateAvailable:k(),installationAvailable:k(),releaseNotes:D().min(1).max(2e4).nullable(),releaseNotesUrl:cO.nullable(),status:sO.nullable(),error:D().min(1).max(500).nullable(),stagedVersion:rO.nullable().optional(),backgroundPhase:lO.optional(),backgroundDownload:uO.nullable().optional(),backgroundError:D().min(1).max(500).nullable().optional(),runningTaskCount:O().int().nonnegative().optional()}),M({status:sO}),M({status:sO.nullable()}),M({supported:k(),enabled:k(),certificatePresent:k(),appSignedWithLocalCert:k(),appPath:D().min(1).nullable(),certificateName:D().min(1),certificateSha1:D().regex(/^[0-9A-Fa-f]{40}$/u).nullable()});let dO=M({icon:D().min(1).max(16).optional(),title:D().min(1).max(120),body:D().min(1).max(1200),contributors:A(D().min(1).max(39)).max(30)}),fO=M({summary:D().min(1).max(600).optional(),themes:A(dO).min(1).max(12)}),pO=M({version:rO,publishedAt:Bu(),url:D().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u),zh:fO.nullable(),en:fO.nullable()}).refine(e=>e.zh!==null||e.en!==null,{message:`an announcement needs at least one language`});M({manual:k().optional()}),M({announcement:pO.nullable(),unread:k()}),M({version:rO}),RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): `+`(${[`completed`,`failed`,`interrupted`,`needsInput`,`timedOut`,`unreadable`,`notFound`].join(`|`)})(?:\. (.+))?$`,`u`);let mO=`<response-annotations>`,hO=`</response-annotations>`,gO=/^\s*## My request(?: for Codex)?:[ \t]*(?:\r?\n|$)/u;function _O(e){if(e.length===0)return``;let t=e.map(({text:e,annotation:t})=>({text:e,...t===void 0?{}:{annotation:t}}));return`\n# Response annotations:\nEach item contains text selected from an earlier Codex response and may include a user comment. Treat items as Annotation 1, Annotation 2, and so on in array order. Use every selection as context and address every comment. For every annotation you address, include its inline directive \`:codex-annotation{index="N"}\`, where N is its one-based array position (for example, \`:codex-annotation{index="1"}\`). Do not use unstructured annotation labels.\n${mO}\n${JSON.stringify(t)}\n${hO}\n`}function vO(e,t){let n=_O(e);return n===``?t:`${n}\n## My request:\n${t}\n`}function yO(e){let t=e.trimStart().startsWith(`# Response annotations:`)?0:e.length,n=e.indexOf(`\n${mO}\n`,t);if(n<0)return;let r=n+1+22+1,i=e.indexOf(`\n${hO}`,r);if(!(i<0))return{json:e.slice(r,i),closeEnd:i+1+23}}function bO(e){let t=yO(e);if(t===void 0)return{annotations:[],body:e};let n=SO(t.json);if(n.length===0)return{annotations:[],body:e};let r=e.slice(t.closeEnd),i=gO.exec(r);if(i===null)return{annotations:[],body:e};let a=r.slice(i[0].length);return{annotations:n,body:i[0].endsWith(`\r
146
+ `}isInline(){return!1}updateDOM(){return!1}};function rS(){return{node:iS()}}function iS(){return Oy(nS)}Date.now;function aS(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let oS;function sS(e,t){let{key:n}=t;return e&&n in e?e[n]:t.defaultValue}function cS(e){return oS&&oS.editor===e?oS:void 0}function lS(e,t){if(`cfg`in t){let{cfg:n,updater:r}=t;return[n,r(sS(e,n))]}return t}function uS(e,t){let n=t;for(let r of e){let[e,i]=lS(n,r),a=e.key;if(n===t&&sS(n,e)===i)continue;let o=n===t||n===void 0?dS(t):n;o[a]=i,n=o}return n}function dS(e){return Object.create(e||null)}function fS(e,t){return[e,t]}function pS(e,t,n,r=oy()){let i=oS,a=cS(r);try{return oS={...a,editor:r,[e]:t},n()}finally{oS=i}}function mS(e,t=()=>{}){return(n,r=oy())=>i=>{let a=cS(r),o=a&&a[e],s=uS(n,o||t(r));return s&&s!==o?pS(e,s,i,r):i()}}function hS(e,t,n,r){return Object.assign(df(Symbol(t),{isEqual:r,parse:n}),{[e]:!0})}let gS=`@lexical/html/DOM`,_S=Symbol.for(`@lexical/html/DOMExportContext`);function vS(e,t,n){return hS(_S,e,t,n)}let yS=/* @__PURE__ */ vS(`isExport`,Boolean);function bS(e){let t=tS(e,gS);return t?t.output.defaults:void 0}function xS(e){let t=tS(e,gS);return t?t.output.runtime:void 0}function SS(e=oy()){let t=xS(e);return t?t.getSessionConfig():sy(e)}let CS=mS(_S,bS),wS=Symbol.for(`@lexical/html/SelectorImpl`);function TS(e,t){let n={kind:`element`,predicate:(r=t,r.length===0?q:r.length===1?r[0]:(e,t)=>{for(let n of r)if(!n(e,t))return!1;return!0}),tags:e};var r;let i=n=>TS(e,[...t,n]);return{[wS]:n,attr:(e,t,n)=>i(OS(e,t,n)),classAll:(...e)=>i(DS(e)),classAny:(...e)=>i(function(e){let t=ES(e);return t.length===0?()=>!1:e=>{if(!q(e))return!1;let n=e.classList;for(let e of t)if(n.contains(e))return!0;return!1}}(e)),styleAny:(e,t,n)=>i(function(e,t,n){if(typeof t==`string`)return n=>q(n)&&n.style.getPropertyValue(e)===t;if(t instanceof RegExp){let r=n&&n.capture,i=t;return(t,n)=>{if(!q(t))return!1;let a=t.style.getPropertyValue(e);if(!a)return!1;let o=a.match(i);return o!==null&&(r!==void 0&&(n[r]=o),!0)}}aS(362,JSON.stringify(e))}(e,t,n))}}function ES(e){let t=[];for(let n of e)n&&t.push(n);return t}function DS(e){let t=ES(e);return t.length===0?()=>!0:e=>{if(!q(e))return!1;let n=e.classList;for(let e of t)if(!n.contains(e))return!1;return!0}}function OS(e,t,n){if(!0===t)return t=>q(t)&&t.hasAttribute(e);if(typeof t==`string`)return n=>q(n)&&n.getAttribute(e)===t;if(t instanceof RegExp){let r=n&&n.capture,i=t;return(t,n)=>{if(!q(t))return!1;let a=t.getAttribute(e);if(a==null)return!1;let o=a.match(i);return o!==null&&(r!==void 0&&(n[r]=o),!0)}}aS(361,JSON.stringify(e))}let kS={kind:`text`,predicate:P_,tags:/* @__PURE__ */ new Set},AS={[wS]:kS},jS={kind:`comment`,predicate:e=>e.nodeType===8,tags:/* @__PURE__ */ new Set},MS={[wS]:jS},NS={any:()=>TS(/* @__PURE__ */ new Set,[]),comment:()=>MS,tag(...e){e.length>0||aS(363);let t=/* @__PURE__ */ new Set;for(let n of e)t.add(n.toUpperCase());return TS(t,[])},text:()=>AS},PS=NS;PS.tag(`b`,`strong`,`em`,`i`,`code`,`mark`,`s`,`sub`,`sup`,`u`,`span`),PS.text(),PS.tag(`script`,`style`),PS.tag(`br`),PS.tag(`p`),PS.tag(`hr`),PS.any(),Object.freeze([]),Object.freeze({}),NS.any(),NS.any,NS.comment,NS.tag,NS.text;function FS(e,t=null,n=oy()){return CS([fS(yS,!0)],n)(()=>{let r=X_(),i=SS(n),a=B(t)?Ry(t.anchor.getNode()):null,o=e.append.bind(e);for(let e of(U(a)?a:r).getChildren())LS(n,e,o,t,i);return e})}function IS(e,t=null){return(typeof document>`u`||typeof window>`u`&&global.window===void 0)&&aS(338),Dg(e),FS(Uv().createElement(`div`),t,e).innerHTML}function LS(e,t,n,r=null,i=sy(e)){let a=i.$shouldInclude(t,r,e),o=i.$shouldExclude(t,r,e),s=t;r!==null&&z(t)&&(s=cx(r,t,`clone`));let{element:c,after:l,append:u,$getChildNodes:d}=i.$exportDOM(s,e);if(!c)return!1;let f=Uv().createDocumentFragment(),p=d?d():U(s)?s.getChildren():[],m=a&&Ah(r)&&U(t)?null:r,h=f.append.bind(f);for(let n of p){let o=LS(e,n,h,m,i);!a&&o&&i.$extractWithChild(t,n,r,`html`,e)&&(a=!0)}if(a&&!o){if((q(c)||ey(c))&&(u?u(f):c.append(f)),n(c),l){let e=l.call(s,c);e&&(ey(c)?c.replaceChildren(e):c.replaceWith(e))}}else n(f);return a}function RS(e,t,n=null){let r=Hv(n),i=n?Bv(n):[],a=n!==null&&i.length>0;if(a&&typeof r.caretPositionFromPoint==`function`){let a=r.caretPositionFromPoint(e,t,{shadowRoots:i});if(a!==null&&function(e,t){for(let n=e;n!==null;){if(n===t)return!0;n=yv(n)}return!1}(a.offsetNode,n))return{node:a.offsetNode,offset:a.offset}}if(a){let i=n.getRootNode();if(Rv(i)){let a=i.elementFromPoint(e,t);if(a!==null&&n.contains(a)){let n=function(e,t,n,r){let i=r.createRange(),a=e=>t<e.top?e.top-t:t>e.bottom?t-e.bottom:0,o=t=>e<t.left?t.left-e:e>t.right?e-t.right:0,s=r.createTreeWalker(n,NodeFilter.SHOW_TEXT),c=null,l=1/0,u=1/0;for(let e=s.nextNode();e;e=s.nextNode()){i.selectNodeContents(e);for(let t of i.getClientRects()){let n=a(t),r=o(t);(n<l||n===l&&r<u)&&(l=n,u=r,c=e)}}if(c===null)return null;let d=0,f=1/0,p=1/0;for(let t=0;t<=c.length;t++){i.setStart(c,t),i.collapse(!0);let n=i.getBoundingClientRect(),r=a(n),o=Math.abs(e-n.left);(r<f||r===f&&o<p)&&(f=r,p=o,d=t)}return{node:c,offset:d}}(e,t,a,r);if(n!==null)return n}}}if(typeof r.caretRangeFromPoint==`function`){let n=r.caretRangeFromPoint(e,t);return n===null?null:{node:n.startContainer,offset:n.startOffset}}if(typeof r.caretPositionFromPoint==`function`){let n=r.caretPositionFromPoint(e,t);return n===null?null:{node:n.offsetNode,offset:n.offset}}return null}function zS(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function BS(e,t=V()){return t??zS(166),B(t)&&t.isCollapsed()||t.getNodes().length===0?``:IS(e,t)}function VS(e,t){let n=e.getData(`text/plain`)||e.getData(`text/uri-list`);n!=null&&t.insertRawText(n)}let HS=`application/x-lexical-drag`;function US(e,t){let n={editorKey:t.getKey()};e.setData(HS,JSON.stringify(n))}function WS(e,t,n){let r=e.dataTransfer;if(r===null)return!1;let i=function(e){let t=e.getData(HS);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}return(r=n)!==null&&typeof r==`object`&&`editorKey`in r&&typeof r.editorKey==`string`?n:null;var r}(r);if(i===null)return!1;let a=function(e,t){let n=RS(e.clientX,e.clientY,t.getRootElement());if(n===null)return null;let r=q_(n.node);if(r===null)return null;if(z(r))return hb(r,`next`,n.offset);if(U(r))return Gb(r,n.offset,`next`);let i=r.getParent();return i===null?null:Gb(i,r.getIndexWithinParent()+1,`next`)}(e,t);if(a===null)return!1;let o=Jb(a);if(o===null)return!1;let s=i.editorKey===t.getKey(),c=V();if(s){if(!B(c)||c.isCollapsed())return!1;if(function(e,t){let{anchor:n,focus:r}=Wb(Ib(t),`next`);return Db(n,e)<0&&Db(e,r)<0}(a,c))return e.preventDefault(),!0;c.removeText()}if(!o.origin.isAttached())return e.preventDefault(),!0;if(n(r,Pb(wb(o)),t),!s){let e=t.getRootElement(),n=e?e.ownerDocument:null,r=n?function(e,t){for(let n of Vv(t)){let t=j_(n);if(k_(t)&&t.getKey()===e&&q(n))return n}return null}(i.editorKey,n):null;r!==null&&r.dispatchEvent(new InputEvent(`beforeinput`,{bubbles:!0,cancelable:!0,inputType:`deleteByDrag`}))}return e.preventDefault(),!0}function GS(e,t){return WS(e,t,(e,t)=>VS(e,t))}function KS(e,t){t.update(()=>{if(e!==null){let n=hx(e,KeyboardEvent)?null:e.clipboardData,r=V();if(r!==null&&!r.isCollapsed()&&n!=null){e.preventDefault();let i=BS(t);i!==null&&n.setData(`text/html`,i),n.setData(`text/plain`,r.getTextContent())}}})}function qS(e){return tx(e.registerCommand(Ep,e=>{let t=V();return!!B(t)&&(t.deleteCharacter(e),!0)},0),e.registerCommand(Mp,e=>{let t=V();return!!B(t)&&(t.deleteWord(e),!0)},0),e.registerCommand(Np,e=>{let t=V();return!!B(t)&&(t.deleteLine(e),!0)},0),e.registerCommand(kp,e=>{let t=V();if(!B(t))return!1;if(typeof e==`string`)t.insertText(e);else{let n=e.dataTransfer;if(n!=null)VS(n,t);else{let n=e.data;n&&t.insertText(n)}}return!0},0),e.registerCommand(jp,()=>{let e=V();return!!B(e)&&(e.removeText(),!0)},0),e.registerCommand(Dp,e=>{let t=V();return!!B(t)&&(t.insertLineBreak(e),!0)},0),e.registerCommand(Op,()=>{let e=V();return!!B(e)&&(e.insertLineBreak(),!0)},0),e.registerCommand(Bp,e=>{let t=V();if(!B(t))return!1;let n=e,r=n.shiftKey;return!!dx(t,!0)&&(n.preventDefault(),mx(t,r,!0),!0)},0),e.registerCommand(Rp,e=>{let t=V();if(!B(t))return!1;let n=e,r=n.shiftKey;return!!dx(t,!1)&&(n.preventDefault(),mx(t,r,!1),!0)},0),e.registerCommand(Kp,t=>!!B(V())&&(!wd||!Cd)&&(t.preventDefault(),e.dispatchCommand(Ep,!0)),0),e.registerCommand(Jp,t=>!!B(V())&&(t.preventDefault(),e.dispatchCommand(Ep,!1)),0),e.registerCommand(Wp,t=>{if(!B(V()))return!1;if(t!==null){if((wd||Ed||kd)&&Cd)return!1;t.preventDefault()}return e.dispatchCommand(Dp,!1)},0),e.registerCommand(nm,()=>{let e=V();return fv(B(e)&&Ry(e.anchor.getNode())!==null?e:null),!0},0),e.registerCommand(em,t=>!!B(V())&&(KS(t,e),!0),0),e.registerCommand(tm,t=>!!B(V())&&(function(e,t){KS(e,t),t.update(()=>{let e=V();B(e)&&e.removeText()},{tag:`cut`})}(t,e),!0),0),e.registerCommand(Ap,t=>!!B(V())&&(function(e,t){e.preventDefault(),t.update(()=>{let t=V(),n=hx(e,ClipboardEvent)?e.clipboardData:null;n!=null&&B(t)&&VS(n,t)},{tag:`paste`})}(t,e),!0),0),e.registerCommand(Xp,t=>GS(t,e),0),e.registerCommand(Zp,t=>{let n=V();return!!B(n)&&(n.isCollapsed()||t.dataTransfer===null||US(t.dataTransfer,e),!0)},0))}function JS(e,t,n,r,i){if(e===null||n.size===0&&r.size===0&&!i)return 0;let a=t._selection,o=e._selection;if(i)return 1;if(!(B(a)&&B(o)&&o.isCollapsed()&&a.isCollapsed()))return 0;let s=function(e,t,n){let r=e._nodeMap,i=[];for(let e of t){let t=r.get(e);t!==void 0&&i.push(t)}for(let[e,t]of n){if(!t)continue;let n=r.get(e);n===void 0||Jg(n)||i.push(n)}return i}(t,n,r);if(s.length===0)return 0;if(s.length>1){let n=t._nodeMap,r=n.get(a.anchor.key),i=n.get(o.anchor.key);return r&&i&&!e._nodeMap.has(r.__key)&&z(r)&&r.__text.length===1&&a.anchor.offset===1?2:0}let c=s[0],l=e._nodeMap.get(c.__key);if(!z(l)||!z(c)||l.__mode!==c.__mode)return 0;let u=l.__text,d=c.__text;if(u===d)return 0;let f=a.anchor,p=o.anchor;if(f.key!==p.key||f.type!==`text`)return 0;let m=f.offset,h=p.offset,g=d.length-u.length;return g===1&&h===m-1?2:g===-1&&h===m+1?3:g===-1&&h===m?4:0}function YS(e,t,n){let r=n(),i=0,a=r,o=0,s=null;return(c,l,u,d,f,p)=>{let m=n();if(p.has(`composition-start`)&&(a=r,o=i,s=c),p.has(`historic`))return i=0,r=m,2;p.has(`composition-end`)&&s&&(r=a,i=o,c=s);let h=p.has(`paste`)||p.has(`cut`)?0:JS(c,l,d,f,e.isComposing()),g=(()=>{let n=u===null||u.editor===e,a=p.has(`history-push`);if(!a&&n&&p.has(`history-merge`))return 0;if(h===1)return 2;if(c===null)return 1;let o=l._selection;if(!(d.size>0||f.size>0))return o===null?2:0;let s=typeof t==`number`?t:t.peek();return!1===a&&h!==0&&h===i&&m<r+s&&n||d.size===1&&function(e,t,n){let r=t._nodeMap.get(e),i=n._nodeMap.get(e),a=t._selection,o=n._selection;return!(B(a)&&B(o)&&a.anchor.type===`element`&&a.focus.type===`element`&&o.anchor.type===`text`&&o.focus.type===`text`||!z(r)||!z(i)||r.__parent!==i.__parent)&&JSON.stringify(t.read(()=>r.exportJSON()))===JSON.stringify(n.read(()=>i.exportJSON()))}(Array.from(d)[0],c,l)?0:1})();return r=m,i=h,g}}function XS(e,t){e.undoStack=[],e.redoStack=[],e.current=null,t&&t(e)}function ZS(e,t,n,r=Date.now,i,a=null){let o=YS(e,n,r),s=()=>{i&&i(t)};return s(),tx(e.registerCommand(Fp,()=>(function(e,t,n){let r=t.redoStack,i=t.undoStack;if(i.length!==0){let a=t.current,o=i.pop();a!==null&&(r.push(a),e.dispatchCommand(am,!0)),i.length===0&&e.dispatchCommand(om,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(Ip,()=>(function(e,t,n){let r=t.redoStack,i=t.undoStack;if(r.length!==0){let a=t.current;a!==null&&(i.push(a),e.dispatchCommand(om,!0));let o=r.pop();r.length===0&&e.dispatchCommand(am,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(rm,()=>(XS(t,i),!1),0),e.registerCommand(im,()=>(XS(t,i),e.dispatchCommand(am,!1),e.dispatchCommand(om,!1),!0),0),e.registerUpdateListener(({editorState:n,prevEditorState:r,dirtyLeaves:i,dirtyElements:c,tags:l})=>{let u=t.current,d=t.redoStack,f=t.undoStack,p=u===null?null:u.editorState;if(u!==null&&n===p)return;let m=o(r,n,u,i,c,l);if(m===1){if(d.length!==0&&(t.redoStack=[],e.dispatchCommand(am,!1)),u!==null){f.push({...u});let t=typeof a==`number`||a===null?a:a.peek();t!==null&&f.length>t&&f.splice(0,f.length-t),e.dispatchCommand(om,!0)}}else if(m===2)return;t.current={editor:e,editorState:n},s()}))}function QS(){return{current:null,redoStack:[],undoStack:[]}}Date.now;let $S=`application/x-codexhost-thread-reference`,eC=/^remote-(?:peer:|ssh(?:-|:)|control:).+/u;function tC(e){let t=e.projectionValues?.threadReference;if(!e.blank&&t?.hostId&&(t.hostId===`local`||eC.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 nC(e){return`thread://${encodeURIComponent(e.threadId).replace(/[!'()*]/gu,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}?hostId=${encodeURIComponent(e.hostId)}`}function rC(e){if(e.trim()!==e)return;let t=/^codex:\/\/threads\/([^/?#\s<>]+)$/u.exec(e)??/^thread:\/\/([^/?#\s<>]+)\?hostId=([^&#\s]+)$/u.exec(e);if(t?.[1]!==void 0)try{let e=decodeURIComponent(t[1]),n=decodeURIComponent(t[2]??`local`);if(!e||!n||/[\u0000-\u001f\u007f]/u.test(e+n))return;if(n===`local`)return e;if(!eC.test(n))return;let r=new TextEncoder().encode(JSON.stringify([n,e]));return`web-remote:`+btoa(Array.from(r,e=>String.fromCharCode(e)).join(``)).replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/u,``)}catch{return}}function iC(e){let t=`[@${e.title.replace(/[\\`*{}[\]()#+.!_<>|~-]/gu,e=>`\\${e}`)}](${nC(e)})`;return{source:`codexhost-thread`,ref:t,label:e.title,appearance:`session`,clipboardText:t}}function aC(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return;let{threadId:n,hostId:r,title:i}=t;return typeof n!=`string`||!n||typeof r!=`string`||!r||r!==`local`&&!eC.test(r)||typeof i!=`string`?void 0:tC({id:n,blank:!1,title:i,projectionValues:{threadReference:{hostId:r,threadId:n}}})}catch{return}}function oC(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=oC(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function sC(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=oC(e))&&(r&&(r+=` `),r+=t);return r}let cC=`@deepseek-ai/dsh-client-ui-conversation/ReferenceChip.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(cC)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=cC,e.textContent=`.s8J5YG_chip{max-width:240px;color:var(--dsw-alias-state-business-primary);user-select:none;align-items:baseline;gap:3px;display:inline-flex}.s8J5YG_marker{flex:none;font-weight:500}.s8J5YG_icon{flex:none;align-self:center}.s8J5YG_label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.s8J5YG_invalid{color:var(--dsw-alias-state-error-primary);opacity:.7;text-decoration:line-through}`,document.head.appendChild(e)}var lC={chip:`s8J5YG_chip`,icon:`s8J5YG_icon`,invalid:`s8J5YG_invalid`,label:`s8J5YG_label`,marker:`s8J5YG_marker`};let uC=`@deepseek-ai/dsh-client-ui-conversation/composer-editor.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(uC)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=uC,e.textContent=`._VTzna_reference{border-radius:var(--dsw-radius-sm);line-height:inherit;vertical-align:baseline;color:var(--dsw-alias-state-business-primary);-webkit-box-decoration-break:clone;box-decoration-break:clone;background:0 0;padding:0 4px}._VTzna_reference:hover{background:var(--dsw-alias-state-business-tertiary)}._VTzna_openable{cursor:pointer}._VTzna_textRef{max-width:100%;display:inline-block}`,document.head.appendChild(e)}var dC={openable:`_VTzna_openable`,reference:`_VTzna_reference`,textRef:`_VTzna_textRef`};function fC({label:e,reference:t,appearance:n,invalid:r}){return/* @__PURE__ */ (0,h.jsxs)(`span`,{className:sC(dC.reference,lC.chip,n===`file`&&!r&&dC.openable,r&&lC.invalid),title:e,children:[n===void 0?/* @__PURE__ */ (0,h.jsx)(`span`,{className:lC.marker,"aria-hidden":!0,children:`@`}):/* @__PURE__ */ (0,h.jsx)(d.ReferenceIconRegular,{kind:n,reference:t,size:14,className:lC.icon}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:lC.label,children:e})]})}var pC=class e extends Kg{__source;__ref;__label;__appearance;__clipboardText;__invalid;static getType(){return`reference-chip`}static clone(t){return new e({source:t.__source,ref:t.__ref,label:t.__label,appearance:t.__appearance,clipboardText:t.__clipboardText},t.__invalid,t.__key)}static importJSON(t){return new e({source:t.source,ref:t.ref,label:t.label,appearance:t.appearance,clipboardText:t.clipboardText},t.invalid)}constructor(e,t=!1,n){super(n),this.__source=e.source,this.__ref=e.ref,this.__label=e.label,this.__appearance=e.appearance,this.__clipboardText=e.clipboardText,this.__invalid=t}exportJSON(){return{...super.exportJSON(),type:`reference-chip`,version:1,source:this.__source,ref:this.__ref,label:this.__label,...this.__appearance===void 0?{}:{appearance:this.__appearance},clipboardText:this.__clipboardText,invalid:this.__invalid}}createDOM(e){let t=document.createElement(`span`);return t.setAttribute(`data-composer-chip`,this.__source),t.setAttribute(`contenteditable`,`false`),t}updateDOM(){return!1}isInline(){return!0}isKeyboardSelectable(){return!1}getTextContent(){return this.__clipboardText}setInvalid(e){let t=this.getWritable();t.__invalid=e}isInvalid(){return this.getLatest().__invalid}getSource(){return this.getLatest().__source}getReference(){return this.getLatest().__ref}getLabel(){return this.getLatest().__label}getAppearance(){return this.getLatest().__appearance}decorate(){return/* @__PURE__ */ (0,h.jsx)(fC,{label:this.__label,reference:this.__ref,appearance:this.__appearance,invalid:this.__invalid})}};function mC(e){return new pC(e)}function hC(e){return e instanceof pC}function gC(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function _C(e,t,n,r){let i=e=>e instanceof n,a=e=>{let t=gh(e.getTextContent());t.setFormat(e.getFormat()),e.replace(t)};return[e.registerNodeTransform(sh,e=>{if(!e.isSimpleText())return;let n,o=e.getPreviousSibling(),s=e.getTextContent(),c=e;if(z(o)){let n=o.getTextContent(),r=t(n+s);if(i(o)){if(r===null||(e=>e.getLatest().__mode)(o)!==0)return void a(o);{let t=r.end-n.length;if(t>0){let r=n+s.slice(0,t);if(o.select(),o.setTextContent(r),t===s.length)e.remove();else{let n=s.slice(t);e.setTextContent(n)}return}}}else if(r===null||r.start<n.length)return}let l=0;for(;;){n=t(s);let e,u=n===null?``:s.slice(n.end);if(s=u,u===``){let e=c.getNextSibling();if(z(e)){u=c.getTextContent()+e.getTextContent();let n=t(u);if(n===null)return void(i(e)?a(e):e.markDirty());if(n.start!==0)return}}if(n===null)return;if(n.start===0&&z(o)&&o.isTextEntity()){l+=n.end;continue}n.start===0?[e,c]=c.splitText(n.end):[,e,c]=c.splitText(n.start+l,n.end+l),e===void 0&&gC(165,`nodeToReplace`);let d=r(e);if(d.setFormat(e.getFormat()),e.replace(d),c==null)return;l=0,o=d}}),e.registerNodeTransform(n,e=>{let n=e.getTextContent(),r=t(n);if(r===null||r.start!==0)return void a(e);if(n.length>r.end)return void e.splitText(r.end);let o=e.getPreviousSibling();z(o)&&o.isTextEntity()&&(a(o),a(e));let s=e.getNextSibling();z(s)&&s.isTextEntity()&&(a(s),i(e)&&a(e))})]}let vC=/(^|\s)([/@])([\w-]+)/g,yC=/(^|\s)(@(?:"[^"\n]*"?|[^\s"]\S*))/g,bC=/* @__PURE__ */ new Set(`.,;:!?,。;:!?`),xC=/^@.*[/\\.]/u;function SC(e,t,n){if(!n.startsWith(`@"`)){let e=n.length;for(;bC.has(n.charAt(e-1));)--e;return xC.test(n.slice(0,e))?t+e:void 0}if(n.length>3&&n.endsWith(`"`))return t+n.length;let r=n.lastIndexOf(`/`);if(r<0)return;let i=t+r+1;for(;bC.has(e.charAt(i));)i+=1;return i===e.length||/\s/u.test(e.charAt(i))?t+r+1:void 0}let CC=/^(?:\s|$)/;function wC(e,t){if(e===``)return[];let n=[];vC.lastIndex=0;let r;for(;(r=vC.exec(e))!==null;){let i=r[2],a=r[3]??``;if((i!==`/`||CC.test(e.slice(r.index+r[0].length)))&&t.get(i)?.includes(a)){let e=r.index+(r[1]?.length??0);n.push({start:e,end:e+1+a.length,trigger:i})}}yC.lastIndex=0;let i;for(;(i=yC.exec(e))!==null;){let t=i.index+(i[1]?.length??0),r=SC(e,t,i[2]??``);r!==void 0&&!n.some(e=>e.start<r&&e.end>t)&&n.push({start:t,end:r,trigger:`@`})}return n.sort((e,t)=>e.start-t.start)}var TC=class e extends sh{static getType(){return`composer-text-ref`}static clone(t){return new e(t.__text,t.__key)}static importJSON(t){let n=new e(t.text);return n.setFormat(t.format),n.setDetail(t.detail),n.setMode(t.mode),n.setStyle(t.style),n}exportJSON(){return{...super.exportJSON(),type:`composer-text-ref`}}createDOM(e){let t=super.createDOM(e);return t.className=sC(t.className,dC.reference,dC.textRef,this.getTextContent().startsWith(`/`)&&dC.openable),t.setAttribute(`spellcheck`,`false`),t.setAttribute(`data-composer-text-ref`,``),t}isTextEntity(){return!0}canInsertTextBefore(){return!0}};function EC(e,t,n){return tx(..._C(e,e=>{let r=n();for(let n of wC(e,t()))if(r===null||n.start!==0||e.slice(n.start,n.end)!==r.trimEnd())return{start:n.start,end:n.end};return null},TC,e=>new TC(e.getTextContent())))}function DC(e){e.update(()=>{for(let e of X_().getAllTextNodes())(e instanceof TC||e.getPreviousSibling()instanceof TC||/[/@]/u.test(e.getTextContent()))&&e.markDirty()},{tag:Km})}function OC(e,t){return e.registerCommand(xp,e=>{if(e.target===null||e.button!==0||e.detail>1)return!1;let n=V();if(B(n)&&!n.isCollapsed())return!1;let r=q_(e.target);if(hC(r)){if(r.isInvalid())return!1;let e=r.getAppearance();return t(r.getSource(),{ref:r.getReference(),...e===void 0?{}:{appearance:e}})}return r instanceof TC&&t(void 0,{ref:r.getTextContent()})},1)}function kC(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 AC=ru([D(),O(),k(),Yl()]);function jC(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 MC=Lu(jC,{message:`JSON value must not contain circular references`}),NC=Fu(()=>ru([AC,A(NC),du(D(),NC)])),PC=MC.pipe(NC);MC.pipe(A(NC));let FC=MC.pipe(du(D(),NC)),IC=M({code:D().min(1),message:D().min(1),retryable:k(),diagnostic:D().min(1).optional(),stage:D().min(1).optional(),durationMs:O().int().nonnegative().optional(),stderrTail:D().min(1).optional()}).superRefine(kC([`diagnostic`,`stage`,`durationMs`,`stderrTail`])),LC=D().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u),RC=e=>D().min(1).max(e).refine(e=>e.trim().length>0),zC=du(LC,j({label:RC(256).optional(),description:RC(1024).optional()}).strict()).refine(e=>Object.keys(e).length<=16,`Too many locales`),BC=du(LC,RC(4096)).refine(e=>typeof e.en==`string`,`English fallback is required`).refine(e=>Object.keys(e).length<=16,`Too many locales`),VC=D().refine(e=>e.trim().length>0,{message:`Identifier must not be empty or whitespace`}),HC=VC.brand(),Y=VC.brand(),UC=VC.brand();VC.brand(),VC.brand();let WC=D().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),GC=WC.max(128).regex(/^[A-Za-z0-9._~:-]+$/u,`Permission Mode ID must use transport-safe characters`).brand(),KC=j({modes:A(j({id:GC,label:WC.max(256),description:WC.max(1024).optional(),dangerous:k().optional(),localizations:zC.optional()}).strict()).min(1).max(32),defaultModeId:GC}).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`]})});j({threadId:Y,permissionModeId:GC}).strict();let qC=D().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`});j({sourceThreadId:Y,lastTurnId:UC.optional(),targetHarnessId:HC,targetModel:qC.max(1024).optional(),targetThinkingOptionId:qC.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).optional()}).strict();let JC=j({sourceThreadId:Y,sourceHarnessId:HC,sourceHarnessLabel:qC.max(256).optional(),sourceModel:qC.max(1024).optional(),targetHarnessId:HC,targetHarnessLabel:qC.max(256).optional(),targetModel:qC.max(1024).optional(),totalTurns:O().int().min(1),boundaryTurnNumber:O().int().min(1),includedTurnNumbers:A(O().int().min(1)),omittedTurns:O().int().min(0),preview:D().max(32e3),createdAtMs:O().int().nonnegative()}).strict();j({threadId:Y,handoff:JC}).strict();let YC=O().int().safe().nonnegative(),XC=O().finite().nonnegative(),ZC=O().finite().min(0).max(100),QC=j({version:ru([P(3),P(4)]).optional(),requestId:D().min(1),turnId:D().min(1).max(1024),outputTokens:YC,startedAtMs:YC,completedAtMs:YC}).strict().refine(e=>e.completedAtMs>e.startedAtMs),$C=j({version:ru([P(2),P(3),P(4)]).optional(),value:XC,turnId:D().min(1).max(1024),at:YC}).strict();j({outputTimings:A(QC).transform(e=>e.filter(e=>e.version===4)).optional(),outputTokensPerSecond:$C.refine(e=>e.version===4).optional().catch(void 0),timeToFirstOutputMs:$C.extend({value:YC}).optional()}).strict();let ew=e=>BC.refine(t=>Object.values(t).every(t=>t.length<=e)),tw=j({composerIndicators:A(j({kind:P(`countdown`),id:D().min(1).max(64),expiresAtUnix:YC,label:ew(256).optional(),tooltip:ew(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:YC.optional(),cachedInputTokens:YC.optional(),cacheWriteInputTokens:YC.optional(),outputTokens:YC.optional(),outputTokensPerSecond:XC.optional(),sessionOutputTokensPerSecond:XC.optional(),apiOutputTokensPerSecond:XC.optional(),reasoningOutputTokens:YC.optional(),totalTokens:YC.optional(),totalCostUsd:XC.optional(),totalCredits:XC.optional(),contextUsagePercent:XC.optional(),cacheHitRatePercent:ZC.optional(),contextWindowTokens:YC.optional(),contextUsedTokens:YC.optional(),planFiveHourUsedPercent:ZC.optional(),planFiveHourResetsAtUnix:YC.optional(),planSevenDayUsedPercent:ZC.optional(),planSevenDayResetsAtUnix:YC.optional(),sessionCacheHitRatePercent:ZC.optional(),timeToFirstOutputMs:YC.optional(),latestRequestTimeToFirstOutputMs:YC.optional(),costSource:N([`publicPrice`,`native`]).optional(),unpricedModels:A(D().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`]})}),nw=O().finite().min(0).max(100),rw=N([`weekly`,`monthly`,`five_hour`,`seven_day`,`unknown`]),iw=j({id:D().min(1).max(256),label:D().min(1).max(256),localizations:zC.optional()}).strict(),aw=j({product:D().min(1),periodType:rw.optional(),scope:iw.optional(),localizations:zC.optional(),used:O().finite().nonnegative().optional(),limit:O().finite().nonnegative().optional(),unit:D().min(1).max(32).optional(),usagePercent:nw,resetsAt:D().min(1).optional()}).strict(),ow=j({availableCount:O().int().safe().positive(),nextExpiresAt:D().min(1).optional(),expiresAt:A(D().min(1)).min(1).max(32).optional()}).strict(),sw=j({used:O().finite().nonnegative().optional(),limit:O().finite().nonnegative().optional(),unit:D().min(1).max(32).optional(),label:D().min(1).optional(),scope:iw.optional(),localizations:zC.optional(),usedPercent:nw,resetsAt:D().min(1).optional(),periodType:rw,productUsage:A(aw).min(1).optional(),resetCredits:ow.optional()}).strict(),cw=j({amount:O().finite().nonnegative(),currency:D().trim().min(1).max(8),label:D().trim().min(1).max(128).optional()}).strict();j({threadId:Y,refresh:P(`exact`).optional()}).strict(),j({threadId:Y,usage:tw.nullable(),accountCredits:sw.optional(),accountBalance:cw.optional(),accountCreditsSupported:k().optional()}).strict();let lw=D().refine(e=>e.trim().length>0,{message:`Value must not be empty or whitespace`}),uw=D().min(1).max(512).refine(e=>!/\p{Cc}/u.test(e),`Model Ref must not contain control characters`).brand(),dw=N([`priority`,`ultrafast`]),fw=j({id:uw,serviceTier:dw.optional()}).strict();function pw(e,t){return e?.id===t?.id&&e?.serviceTier===t?.serviceTier}let mw=lw.max(128).regex(/^[A-Za-z0-9._~-]+$/u,`Thinking option ID must use transport-safe characters`).brand(),hw=lw.max(256),gw=j({id:mw,label:lw.max(256)}).strict(),_w=j({ref:fw,label:lw.max(256),resolvedModelLabel:hw.optional(),fastModel:fw.optional(),supportedThinkingOptionIds:A(mw).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 vw(e,t){if(t)return e?.models.find(e=>pw(e.ref,t)||pw(e.fastModel,t))}let yw=A(gw).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)}),bw=N([`catalog`,`activeModel`]),xw=j({models:A(_w),defaultModel:fw.optional(),thinkingOptions:yw,defaultThinkingOptionId:mw.optional(),thinkingOptionsScope:bw.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=>pw(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=>pw(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&&!vw(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`]})}),Sw=j({fork:k(),forkAcrossCwd:k(),rollbackLastTurn:k()}).strict().refine(e=>e.fork||!e.forkAcrossCwd,{path:[`forkAcrossCwd`],message:`Cross-cwd Fork requires exact history Fork support`}),Cw=N([`live`,`atCreate`]),ww=j({configuration:j({selectModel:k(),selectThinkingOption:k(),selectPermissionMode:k(),permissionModeScope:Cw.default(`live`)}).strict(),history:Sw,subagents:j({observe:k(),readTranscript:k()}).strict().optional(),autonomousTurns:j({observe:k()}).strict().optional(),steer:k().optional(),persistentPlan:k().optional()}).strict();j({effectiveModel:fw.optional(),resolvedModelLabel:hw.optional(),effectiveThinkingOptionId:mw.optional(),availableThinkingOptions:yw.optional(),effectivePermissionModeId:GC.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 Tw=j({open:P(!0)}).strict();ru([j({status:P(`ready`),catalog:xw,permissionModes:KC.optional(),capabilities:ww,webUi:Tw.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`]})}),j({status:N([`notInstalled`,`unavailable`,`error`]),error:IC}).strict()]),j({harnessId:HC,cwd:lw.max(16384).optional(),refresh:k().optional(),purpose:P(`availability`).optional(),credentialAccess:N([`allow`,`retry`]).optional()}).strict(),j({harnessId:HC}).strict(),j({}).strict(),j({threadId:Y,model:fw}).strict(),j({threadId:Y,thinkingOptionId:mw}).strict(),j({threadId:Y,includeReferenceCapability:k().optional()}).strict(),au(`owner`,[j({owner:P(`codex`),locked:k(),effectiveModel:fw.optional(),resolvedModelLabel:hw.optional(),effectiveThinkingOptionId:mw.optional(),effectivePermissionModeId:GC.optional(),history:Sw.optional(),supportsThreadReferences:P(!0).optional(),handoff:JC.optional()}).strict(),j({owner:P(`external`),harnessId:lw.max(256),transportModelId:lw.max(8192),effectiveModel:fw.optional(),resolvedModelLabel:hw.optional(),effectiveThinkingOptionId:mw.optional(),availableThinkingOptions:yw.optional(),effectivePermissionModeId:GC.optional(),catalog:xw.optional(),history:Sw,usage:tw.optional(),handoff:JC.optional(),locked:P(!0)}).strict()]),j({threadIds:A(Y).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 Ew=au(`owner`,[j({threadId:Y,owner:P(`codex`)}).strict(),j({threadId:Y,owner:P(`external`),harnessId:D().max(256).pipe(HC)}).strict()]);j({threads:A(Ew).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)}),j({threadId:Y,text:D().optional()}).strict(),j({kind:P(`application`),value:D().transform((e,t)=>{try{return JSON.parse(e)}catch{return t.addIssue({code:`custom`,message:`Invalid steering context JSON`}),Qn}}).pipe(j({expectedTurnId:UC,clientUserMessageId:D().min(1),delivery:N([`newTurn`,`activeTurn`])}).strict())}).strict().transform(e=>e.value),N([`activeTurn`,`newTurn`]),j({delivery:N([`official`,`activeTurn`,`newTurn`])}).strict();let Dw=D().min(1).max(128).regex(/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u),Ow=Dw.pipe(HC),kw=Ow.refine(e=>e!==`codex`,`The official Codex identity is reserved`),Aw=D().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`),jw=Ol().refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Plugin documentation links must be credential-free HTTPS URLs`),Mw=j({en:D().max(4096),"zh-CN":D().max(4096).optional()}).strict(),Nw=j({commands:A(j({terminal:D().max(256),command:D().max(4096)}).strict()).max(8),before:Mw.optional(),after:Mw.optional(),downloads:A(j({label:D().max(128),url:jw}).strict()).max(8).optional()}).strict(),Pw={id:Ow,name:D().trim().min(1).max(128),version:D().min(1).max(128),kind:P(`usage`).optional(),iconStyle:j({vector:j({viewBox:D().max(128).regex(/^-?\d+(?:\.\d+)?(?: +-?\d+(?:\.\d+)?){3}$/u),color:D().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu),paths:A(j({d:D().min(1).max(32768).regex(/^[MmLlHhVvCcSsQqTtAaZz\d.,+eE\s-]+$/u),fillRule:N([`evenodd`,`nonzero`]).optional(),fill:D().regex(/^(?:currentColor|#[a-f0-9]{6})$/iu).optional()}).strict()).min(1).max(32)}).strict().optional(),background:D().regex(/^#[a-f0-9]{6}$/iu).optional(),borderRadius:O().min(0).max(50).optional(),paddingRatio:O().min(0).max(.25).optional()}).strict().optional(),installation:Nw.optional(),notice:Mw.optional(),launchCommand:P(!0).optional(),links:j({website:jw.optional(),documentation:jw.optional(),installation:jw.optional()}).strict().optional()};j({manifestVersion:P(1),...Pw,adapterApiVersion:O().int().positive(),entry:Aw,icon:Aw.optional()}).strict();let Fw=D().max(174828).regex(/^data:image\/(?:png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/u),Iw=j({...Pw,icon:Fw.optional()}).strict();j({}).strict(),j({plugins:A(Iw.extend({id:kw})).max(128)}).strict(),j({version:P(1),enabled:A(Ow).max(128)}).strict().refine(e=>new Set(e.enabled).size===e.enabled.length,{message:`Enabled plugin IDs must be unique`,path:[`enabled`]});let Lw=131072,Rw=Dw,zw=N([`sidebar.thread-layout`,`sidebar.thread-badge`,`appearance.theme`]),Bw=N([`appearance`,`interface`,`workflow`,`analytics`,`integrations`,`tools`]),Vw=D().trim().min(1).max(128);function Hw(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 Uw=e=>e.split(`/`).every(e=>!/[. ]$/u.test(e)),Ww=Aw.refine(e=>Hw(e)!==void 0&&Uw(e),`Images must be relative .png, .jpg, .jpeg, or .webp paths with no segments ending in a dot or space`),Gw=D().trim().max(2048).regex(/^https?:\/\/[^/?#\\\s]+/iu,`Expected an HTTP(S) URL`).pipe(Ol({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 Kw(e){return M({en:e,"zh-CN":e})}let qw=Kw(D().trim().min(1)),Jw=A(Bw).max(Bw.options.length).refine(e=>new Set(e).size===e.length,`Duplicate categories`),Yw=A(zw).max(zw.options.length).refine(e=>new Set(e).size===e.length,`Duplicate slots`),Xw={key:D().regex(/^[A-Za-z_][A-Za-z0-9_]*$/u),label:qw,description:qw.optional()},Zw={...Xw,step:O().positive().optional(),default:O().optional()},Qw=M({value:D(),label:qw}),$w=au(`type`,[M({...Xw,type:P(`boolean`),default:k().optional()}),M({...Xw,type:P(`string`),placeholder:qw.optional(),default:D().optional()}),M({...Zw,type:P(`number`),min:O().optional(),max:O().optional()}),M({...Zw,type:P(`range`),min:O(),max:O()}),M({...Xw,type:P(`select`),options:A(Qw).min(1),default:D().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`)}}),eT=j({manifestVersion:Kl().positive(),id:Rw,name:ru([Vw,Kw(Vw)]),version:D().min(1).max(128),desktopApi:Kl().positive()}).passthrough().extend({manifestVersion:P(1),desktopApi:P(1),description:M({en:D().max(4096),"zh-CN":D().max(4096).optional()}).optional(),author:D().trim().min(1).max(128).optional(),repository:Gw.optional(),details:M({en:D().max(16384),"zh-CN":D().max(16384).optional()}).optional(),icon:Ww.optional(),screenshots:A(Ww).max(4).refine(e=>new Set(e).size===e.length,`Duplicate screenshots`).optional(),desktop:M({script:Aw,style:Aw.optional()}).optional(),backend:M({script:Aw.refine(Uw)}).optional(),slots:Yw.default(()=>[]),settingsSchema:A($w).max(32).refine(e=>new Set(e.map(({key:e})=>e)).size===e.length,`Duplicate setting keys`).optional(),categories:Jw.optional()}).strict().refine(e=>e.desktop!==void 0||e.backend!==void 0,`Expected at least one desktop or backend entry`),tT=D().regex(/^[a-f0-9]{64}$/u),nT=M({state:N([`running`,`disabled`,`invalid`,`incompatible`,`conflict`,`failed`,`waiting`]),hash:tT.optional(),error:D().optional(),conflictWith:Rw.optional()});M({controllerPid:Kl().positive(),targetId:D().nullable(),updatedAt:Bu(),handledReloadToken:El().optional(),extensions:du(D(),nT),surfaces:du(D(),nT).optional()});let rT=N([`official`,`community`]);function iT(e){return e.origin===`https://api.github.com`&&/^\/repos\/[\w-]+\/[\w.-]+\/zipball(?:\/[^/]+)?\/?$/u.test(e.pathname)}let aT=Gw.refine(e=>{let t=new URL(e);return/\.zip$/iu.test(t.pathname)||iT(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`),oT=M({id:Rw,version:D().trim().min(1).max(128),name:qw.extend({en:Vw,"zh-CN":Vw}),description:Kw(D().trim().min(1).max(4096)),details:Kw(D().trim().min(1).max(16384)).optional(),author:D().trim().min(1).max(128),repository:Gw,stars:O().int().min(0).optional(),downloads:O().int().min(0).optional(),categories:Jw.optional(),trustTier:rT.default(`community`),icon:Gw.optional(),screenshots:A(Gw).max(4).optional(),downloadUrl:aT,sha256:tT,slots:Yw.optional(),publishedAt:D().optional(),updatedAt:D().optional(),minCodexHostVersion:D().optional()});M({schemaVersion:P(1),generatedAt:D(),extensions:A(oT).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,`Duplicate extension IDs`)});let sT=D().trim().min(1).max(128),cT=/^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³]) *(?:\.|$)/iu,lT=Rw.refine(e=>!cT.test(e),`Reserved extension ID`),uT=N([`desktop`,`web`]),dT=tT,fT=El(),pT=Aw.refine(e=>!/[\x00-\x1f\x7f<>"|*]/u.test(e)&&e.split(`/`).every(e=>!/[. ]$/u.test(e)&&!cT.test(e)),`Expected a portable relative resource path`).refine(e=>e.split(`/`).length<=32,`Extension resources may be at most 32 segments deep`),mT=eT.shape,hT=(e,t=0)=>M({en:D().trim().min(t).max(e),"zh-CN":D().trim().min(t).max(e)}),gT=e=>pT.refine(t=>t.endsWith(e),`Expected a ${e} file`),_T=gT(`.mjs`),vT=gT(`.css`).optional(),yT=e=>e.normalize(`NFC`).toLowerCase(),bT=M({manifestVersion:P(2),id:lT,name:hT(128,1),version:D().trim().min(1).max(128),description:hT(4096),details:hT(16384).optional(),author:mT.author,repository:mT.repository,icon:mT.icon.refine(e=>e===void 0||pT.safeParse(e).success),screenshots:mT.screenshots.refine(e=>e===void 0||e.every(e=>pT.safeParse(e).success)),categories:mT.categories,settingsSchema:mT.settingsSchema,slots:mT.slots.removeDefault().optional(),page:M({apiVersion:P(1),entry:_T,style:vT,title:hT(128,1).optional()}).optional(),widget:M({apiVersion:P(1),entry:_T,style:vT}).optional(),desktop:M({apiVersion:P(1),script:gT(`.js`),style:vT}).optional(),web:M({apiVersion:P(1),entry:_T.optional(),style:vT}).refine(({entry:e,style:t})=>e!==void 0||t!==void 0,`Expected a Web entry or style`).optional(),backend:M({apiVersion:P(1),entry:_T}).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||yT(e)!==yT(r.entry)),{path:[`backend`,`entry`],message:`A backend entry cannot also be a frontend entry`});function xT({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 ST=sT,CT=N([`running`,`waiting`,`idle`,`unknown`]),wT=M({sourceThreadId:Y,createdAtMs:O().int().nonnegative()}),TT=M({harnessId:HC,title:D().optional(),status:CT,archived:k(),updatedAtMs:O().int().nonnegative().optional()}),ET=M({revision:Kl().nonnegative(),parents:du(Y,Y),handoffs:du(Y,wT).optional(),nodes:du(Y,TT),truncated:k()}).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`),DT=D().min(1).max(128);M({});let OT=M({subscriptionId:DT});M({}),OT.extend({snapshot:ET});let kT=Kl().nonnegative(),AT=M({revision:kT,enabled:A(lT).max(64).refine(e=>new Set(e).size===e.length,`Duplicate extension IDs`)});M({version:P(1),seeded:A(lT).max(64).refine(e=>new Set(e).size===e.length,`Duplicate extension IDs`)});let jT=j({version:D().trim().min(1).max(128),publishedAt:D().trim().min(1).max(64).optional(),notes:D().trim().min(1).max(8192),url:Gw.optional()}),{downloadUrl:MT,...NT}=oT.shape,PT=j({...NT,id:lT,format:P(`codexhost`),targets:A(uT).min(1).max(2).refine(e=>new Set(e).size===e.length,`Duplicate targets`),apis:M({page:Kl().positive().optional(),widget:Kl().positive().optional(),desktop:Kl().positive().optional(),web:Kl().positive().optional(),backend:Kl().positive().optional()}),downloadUrl:MT.refine(e=>e.startsWith(`https://`),`Expected HTTPS`),featured:k().optional(),featuredOrder:Kl().nonnegative().optional(),changelog:A(jT).max(20).optional()}).refine(({targets:e,apis:t})=>{let n=xT({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`);j({schemaVersion:P(2),generatedAt:D().min(1),extensions:A(PT).max(1e4).refine(e=>new Set(e.map(({id:e})=>e)).size===e.length,`Duplicate extension IDs`)}).extend({catalogUrl:Gw,fetchedAt:Bu(),cached:k(),stale:k().optional()});let FT={id:lT},IT={...FT,activationId:fT,digest:dT},LT={...FT,activationId:IT.activationId.optional()},RT=D().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`),zT=D().min(1).max(256).refine(e=>e.split(`/`).every(e=>e&&/^[a-z0-9_.-]+$/iu.test(e)&&e!==`.`&&e!==`..`),`Invalid GitHub ref`);function BT(e){return D().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 VT=M({type:P(`github`),repository:D().max(150).regex(/^[a-z0-9-]+\/[a-z0-9_-][a-z0-9_.-]*$/iu),ref:zT.optional(),tag:zT.optional(),asset:D().max(255).regex(/^[a-z0-9_.-]+\.zip$/iu).optional(),subpath:pT.optional()}).refine(({ref:e,tag:t,asset:n})=>!e||!t&&!n,`Use either a zipball ref or a release tag/asset`),HT=ru([M({type:P(`catalog`),...FT}),VT,M({type:P(`zip`),base64:BT(67108864).min(4)}),M({type:P(`zip`),localZipPath:RT}),M({type:P(`localDir`),localDir:RT})]),UT=au(`type`,[M({type:P(`catalog`),...FT}),VT,M({type:P(`zip`)}),M({type:P(`localDir`)})]),WT=M({...IT,manifest:bT,installedAt:Bu(),source:UT.optional()}),GT=e=>D().max(23+4*Math.ceil(e/3)).regex(/^data:image\/(?:png|jpeg|webp);base64,[A-Za-z0-9+/]+={0,2}$/u),KT={desktopConflictWith:lT.optional()},qT=N([`none`,`inactive`,`starting`,`running`,`failed`]),JT=au(`state`,[WT.extend({state:P(`valid`),enabled:k(),...KT,iconDataUrl:GT(Lw).optional(),screenshotDataUrls:A(GT(524288)).max(4).optional(),backendState:qT.optional(),backendError:D().optional()}),M({state:N([`invalid`,`incompatible`]),id:D().min(1),enabled:k(),error:D()})]);M({revision:kT,configuration:AT,diagnostics:A(D()),extensions:A(JT)}),M({revision:kT,extensions:A(WT.extend({...KT,settingsRevision:kT})).max(64)});let YT={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`},XT=Object.freeze(Object.values(YT));new Set(XT),M({});let ZT={expectedRevision:kT};M({...FT,...ZT}),WT.extend({replaced:k()}),au(`state`,[M({state:P(`saved`),configuration:AT}),M({state:P(`revision-conflict`),revision:kT})]),M({...LT,digest:IT.digest.optional(),path:pT}),M({mimeType:D().min(1),base64:BT(16777216),digest:IT.digest}),M({mimeType:N([`image/png`,`image/jpeg`,`image/webp`]),base64:BT(Lw)}),M({settingsRevision:kT,values:FC}),YT.list,YT.snapshot,YT.catalog,M({forceRefresh:k().optional(),staleWhileRevalidate:k().optional()}),YT.catalogIcon,M({...FT}),YT.install,M({source:HT}),YT.update,M({...FT,expectedDigest:IT.digest,expectedActivationId:IT.activationId.optional(),source:HT.optional()}),YT.enable,YT.disable,YT.uninstall,M({...FT,removeData:k().optional(),expectedDigest:IT.digest.optional()}),M({...FT,removed:k()}),YT.recover,M({expectedRevision:ZT.expectedRevision.optional()}),YT.asset,YT.settingsGet,M(LT),YT.settingsSet,M({...LT,expectedSettingsRevision:kT,values:FC}),YT.backendInvoke,M({...LT,method:ST,params:PC.optional()}),M({result:PC}),YT.threadTree,j({threadId:Y}).strict(),j({confirmed:k()}).strict();let QT=[`codex-desktop`,`web`,`web-desktop-shell`,`web-mobile`,`ssh-remote`,`cli`],$T=[`darwin`,`win32`,`linux`],eE=[`arm64`,`x64`,`ia32`,`arm`],tE=[`zh`,`en`,`ja`,`ko`,`de`,`fr`,`es`,`pt`,`ru`,`other`],nE=[`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`],rE=[`official-relay`,`self-hosted-relay`,`tailscale-serve`,`tailscale-funnel`,`tailscale-ip`,`lan`,`custom-proxy`,`remote-peer`],iE=D().min(1).max(40).regex(/^[0-9A-Za-z._+-]+$/u),aE=N(QT),oE=N(tE),sE=N(nE),cE=N(rE);new Set(nE),new Set(tE),j({enabled:k(),forcedOffByEnv:k()}).strict(),j({enabled:k()}).strict(),j({surfaces:A(aE).max(12).optional(),harnesses:A(sE).max(32).optional(),remoteAccess:A(cE).max(12).optional()}).strict(),j({dailyActive:P(!0).optional(),weeklyActive:P(!0).optional(),monthlyActive:P(!0).optional(),newInstall:P(!0).optional(),retainedD1:P(!0).optional(),retainedD7:P(!0).optional(),remoteAny:P(!0).optional(),appVersion:iE.optional(),codexDesktopVersion:iE.optional(),os:N($T).optional(),arch:N(eE).optional(),uiLanguage:oE.optional(),surfaces:A(aE).min(1).max(12).optional(),harnesses:A(sE).min(1).max(32).optional(),remoteAccess:A(cE).min(1).max(12).optional()}).strict().refine(e=>Object.keys(e).length>0,{message:`Telemetry heartbeat must contain at least one countable field`});let lE=4e3,uE={threadId:Y};au(`action`,[M({...uE,action:N([`get`,`pause`,`resume`,`clear`])}),M({...uE,action:N([`create`,`edit`]),objective:D().trim().min(1).refine(e=>Array.from(e).length<=lE,`A goal objective can have up to ${lE} characters.`)})]),j({goal:j({threadId:Y,objective:D(),status:N([`active`,`paused`,`blocked`,`usageLimited`,`budgetLimited`,`complete`]),tokenBudget:Kl().positive().nullable().default(null),tokensUsed:Kl().nonnegative(),timeUsedSeconds:Kl().nonnegative()}).nullable()}),[...XT],j({sections:A(j({id:D().min(1),name:D().min(1),threads:A(FC)}).strict())}).strict(),j({threadId:D().min(1).max(1024),sectionId:D().min(1).max(1024).nullable()}).strict(),j({threadIds:A(D().min(1))}).strict(),j({threadId:D().min(1).max(1024),pinned:k()}).strict(),j({}).strict(),j({parents:du(D().min(1),D().min(1))}).strict(),j({prompt:D().max(16384).optional()}).strict(),j({projects:A(j({id:D(),name:D(),rootPaths:A(D()),createdAt:O().int().optional()})),nativeProjects:P(!0).optional(),assignments:du(D(),D()),projectless:A(D()),pinned:A(D()),sectionProjects:du(D(),A(D())).optional(),pinnedProjects:A(D()).optional()});let dE=du(D(),Zl()),fE=j({epoch:D().uuid(),sequence:O().int().nonnegative()});au(`type`,[j({type:P(`projects-changed`),cursor:fE}),j({type:P(`skills-changed`),cursor:fE,cwd:D().optional()}),j({type:P(`harness-inspection-changed`),cursor:fE,harnessId:D().min(1)}),j({type:P(`display-settings-changed`),cursor:fE}),j({type:P(`preferences-changed`),cursor:fE,revision:O().int().nonnegative()}),j({type:P(`extensions-changed`),cursor:fE,revision:kT}),j({type:P(`hello`),version:P(1),cursor:fE,reset:k()}),j({type:P(`changed`),cursor:fE,threadId:D().min(1),method:D().min(1)})]);let pE=au(`type`,[j({type:P(`text`),id:D(),prompt:D(),secret:k().optional(),optional:k().optional()}),j({type:P(`choice`),id:D(),prompt:D(),multiple:k(),allowOther:k(),optional:k().optional(),options:A(j({value:D(),label:D(),description:D().optional()}))})]),mE=au(`type`,[j({type:P(`approval`),title:D(),description:D().optional(),subject:Zl().optional(),actions:A(j({id:D(),label:D(),effect:D()}))}),j({type:P(`question`),title:D().optional(),questions:A(pE)})]),hE=j({requestId:ru([D(),O().int()]),threadId:D(),kind:N([`approval`,`question`]),interaction:mE,request:dE}),gE=j({id:D().min(1),clientUserMessageId:D().min(1),input:A(dE),presentationInput:A(dE).nullable().optional()}).passthrough();j({fields:A(j({path:A(ru([D(),O().int().nonnegative()])),originalLength:O().int().nonnegative()}))});let _E=j({id:D().min(1),status:D().min(1),codexhostTurnOutcome:j({status:P(`unknown`),reason:D()}).optional(),items:A(j({id:D().min(1),type:D().min(1)}).passthrough()),codexhostFileOperations:A(j({beforeItemId:D().nullable(),item:j({id:D().min(1),type:D().min(1)}).passthrough()})).optional(),error:j({message:D().optional()}).passthrough().nullable().optional(),fingerprint:D().min(1).optional(),unchanged:P(!0).optional()}).passthrough(),vE=j({id:D().min(1).max(512),fingerprint:D().min(1).max(128)});j({threadId:D().min(1),knownTurns:A(vE).max(64).optional(),truncateToolOutput:k().optional()});let yE=j({harnessId:D().min(1),nativeSessionId:D().min(1)});j({cursor:fE,activeTurnId:D().min(1).nullable().optional(),command:j({name:D().min(1),turn:_E,subsequentTurnId:D().min(1).optional()}).optional(),thread:j({id:D().min(1),cwd:D(),modelProvider:D().min(1),createdAt:O(),updatedAt:O(),recencyAt:O().nullable().optional(),status:j({type:D()}).passthrough(),name:D().nullable().optional(),preview:D().optional(),codexhostImportSource:yE.optional(),turns:A(_E).length(0)}).passthrough(),turnsPage:j({data:A(_E).max(5),nextCursor:D().nullable()}),configuration:j({native:j({model:D().min(1).max(1024).optional(),reasoningEffort:D().min(1).max(128).optional()}).optional(),effectiveModel:fw.optional(),effectiveThinkingOptionId:mw.optional(),effectivePermissionModeId:GC.optional()}),queue:j({items:A(gE),pausedReason:N([`interrupted`,`outcome-unknown`,`failed`]).nullable()}).optional(),interactions:A(hE),handoff:JC.optional()}),j({version:P(1),owner:P(`service`).optional(),pid:O().int().positive(),port:O().int().min(1).max(65535),token:D().regex(/^[0-9a-f]{64}$/u),startedAt:O(),epoch:D().uuid(),capabilities:j({peerDelegation:P(1).optional()}).optional()}),j({epoch:D().uuid(),threadId:D().min(1),requestId:ru([D(),O().int()]),result:dE}),j({includeArchived:k().optional(),officialCursor:j({live:D().nullable(),archived:D().nullable().optional()}).strict().optional(),scope:ru([j({cwd:D().min(1).max(4096),excludeCwds:A(D().min(1).max(4096)).max(1024)}).strict(),j({projectId:D().min(1).max(1024),legacyThreadIds:A(D().min(1).max(1024)).max(1024),rootPaths:A(D().min(1).max(4096)).max(1024).optional()}).strict()]).optional()}).strict(),j({threads:A(FC),ownership:A(Ew),archivedThreadIds:A(Y),officialCursor:j({live:D().nullable(),archived:D().nullable().optional()}).strict().optional()}).strict(),Iw.pick({id:!0,name:!0,icon:!0,iconStyle:!0});let bE=M({threadId:D().max(1024),title:D().max(240),project:D().max(240),harness:M({id:D().min(1).max(128),name:D().min(1).max(128)}).optional(),state:N([`idle`,`running`,`waiting`,`completed`,`failed`]),updatedAt:O().nonnegative()});M({epoch:D().max(128),revision:Kl().nonnegative(),running:Kl().nonnegative(),waiting:Kl().nonnegative(),sessions:A(bE).max(32).default([]),notifications:A(M({threadId:D().max(1024),key:D().max(4096),kind:N([`completed`,`failed`,`approval`,`question`]),revision:Kl().nonnegative()})).max(256)});let xE=D().regex(/^audio\/[a-z0-9.+-]+(?:\s*;[^\r\n]*)?$/i);j({available:k()}).strict(),j({path:D().min(1),mimeType:xE}).strict();let SE=N([`credentials-unavailable`,`login-expired`,`rate-limited`,`service-rejected`,`host-incompatible`,`network`,`timeout`,`audio-empty`,`audio-too-large`,`audio-format`,`audio-invalid`]);au(`ok`,[j({ok:P(!0),text:D()}).strict(),j({ok:P(!1),error:j({code:SE}).strict()}).strict()]),j({threadId:Y.optional(),cwd:D().min(1).optional()}).strict().refine(e=>!(e.threadId&&e.cwd),{message:`Specify threadId or cwd, not both`});let CE=j({name:D().min(1).regex(/^[^\s[\]]+$/u),description:D().optional(),path:D().min(1),scope:N([`project`,`global`]),source:D().min(1)}).strict();j({revision:O().int().nonnegative(),complete:k(),skills:A(CE),warnings:A(D()).optional()}).strict(),j({cwd:D().min(1).optional()}).strict();let wE=/\[\$([^\]\r\n]+)\]\((?:<([^<>\r\n]+)>|([^\s()]+))(?:[ \t]+(?:"[^"\r\n]*"|'[^'\r\n]*'))?\)/gu;function TE(e){return[...e.matchAll(wE)].flatMap(e=>{let t=e[2]??e[3]??``;return!/^(?:\/|[A-Za-z]:[\\/]|\\\\)/u.test(t)||!/[\\/]SKILL\.md$/u.test(t)?[]:[{start:e.index,end:e.index+e[0].length,name:e[1]??``,path:t,text:e[0]}]})}let EE=j({kind:N([`public`,`relay`,`tailscale-funnel`,`tailscale-https`,`tailscale`,`lan`,`virtual`]),url:D().min(1)}).strict(),DE=au(`status`,[j({status:P(`not-installed`)}),j({status:P(`not-running`)}),j({status:P(`not-logged-in`)}),j({status:P(`https-disabled`)}),j({status:P(`not-serving`),command:D()}),j({status:P(`occupied`),target:D()}),j({status:P(`serving`),url:D(),funnel:k()}),j({status:P(`error`),message:D()})]);j({state:DE,error:D().optional()}).strict();let OE=au(`status`,[j({status:P(`on`)}),j({status:P(`off`)}),j({status:P(`invalid`),reason:D()})]),kE=j({lan:k(),autostart:OE}).strict(),AE=j({expiresAt:D().optional(),issuing:k(),failure:j({detail:D().optional(),retryAt:D(),paused:k()}).optional()}),jE=au(`status`,[j({status:P(`off`),reason:N([`invite`,`name-taken`,`banned`]).optional()}),j({status:P(`connecting`),reason:N([`full`,`unreachable`]).optional()}),j({status:P(`connected`),url:D(),certificate:AE}),j({status:P(`missing-certificate`),url:D(),certificate:AE}),j({status:P(`stopped`),reason:N([`replaced`,`rejected`,`unsupported-version`])})]);D().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()),D().regex(/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)?$/);let ME=N([`official`,`self-hosted`]);j({secret:D().min(1),lastUsedAt:O().nullable(),networkUrls:A(EE),directCandidates:A(EE).optional(),tailscale:DE,background:kE.optional(),relay:j({state:jE,enabled:k(),kind:ME,officialHost:D(),customHost:D().optional(),officialHostname:D().optional(),customHostname:D().optional(),quotaUntil:D().optional()}).strict().optional()}).strict();let NE=M({threadId:D().min(1).max(1024),view:N([`result`,`messages`]),from:O().int().min(1).max(2**53-1).optional(),to:O().int().min(1).max(2**53-1).optional()}),PE=/^[a-zA-Z0-9_-]{1,64}$/u,FE=D().regex(PE),IE=D().regex(PE),LE=D().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u),RE=N([`relay`,`tailscale`,`lan`,`custom`]),zE=[`blue`,`purple`,`cyan`,`green`,`amber`,`rose`,`slate`],BE=N(zE);new Set(zE);let VE=N([`connected`,`connecting`,`auth-error`,`offline`,`disabled`]),HE=j({peerId:FE,hostId:LE,nodeId:IE.optional(),name:D().min(1).max(120),color:BE.optional(),origin:D().min(1).max(2048),transportKind:RE,encrypted:k(),enabled:k(),state:VE,supportsPeerPairing:k().optional(),pairedBack:k().optional(),linkedPeerIds:A(FE).max(128).optional(),latencyMs:O().int().nonnegative().optional(),version:D().max(128).optional(),platform:D().max(64).optional(),hostname:D().max(255).optional(),homeDir:D().max(4096).optional(),lastError:D().max(1e3).optional(),projectCount:O().int().nonnegative(),createdAt:D(),updatedAt:D()});j({localPlatform:D().max(64).optional(),peers:A(HE)}),j({connectionUrl:D().min(1).max(4096).optional(),origin:D().min(1).max(2048).optional(),token:D().min(1).max(2048).optional(),name:D().trim().min(1).max(120).optional(),color:BE.optional(),pairBack:k().optional(),meshPeerIds:A(FE).max(64).optional(),selfOrigin:D().min(1).max(2048).optional()}).refine(e=>!!e.connectionUrl||!!e.origin&&!!e.token,`Provide either connectionUrl or both origin and token`),M({origin:D().min(1).max(2048),token:D().min(1).max(2048),name:D().trim().min(1).max(120).optional(),color:BE.optional(),expectedNodeId:IE.optional()}),j({status:N([`added`,`updated`,`existing`]),peerId:FE,hostId:LE,nodeId:IE.optional()});let UE=N([`added`,`updated`,`existing`,`failed`,`skipped`]);j({results:A(j({targetPeerId:FE,targetName:D().min(1).max(120),introducedHost:ru([P(`local`),FE]),introducedName:D().min(1).max(120),status:UE,error:D().max(1e3).optional()}))}),j({peerIds:A(FE).max(64).optional(),includeSelf:k().optional(),includeMesh:k().optional(),selfOrigin:D().min(1).max(2048).optional()}),j({peerId:FE,name:D().trim().min(1).max(120).optional(),color:BE.nullable().optional(),connectionUrl:D().min(1).max(4096).optional(),origin:D().min(1).max(2048).optional(),token:D().min(1).max(2048).optional(),enabled:k().optional()}),j({peerId:FE}),j({removed:k()}),j({peerId:FE.optional(),connectionUrl:D().min(1).max(4096).optional(),origin:D().min(1).max(2048).optional(),token:D().min(1).max(2048).optional()}).refine(e=>!!e.peerId||!!e.connectionUrl||!!e.origin&&!!e.token,`Provide peerId, connectionUrl, or both origin and token`);let WE=j({id:D().min(1).max(1024),name:D().min(1).max(512),path:D().min(1).max(8192)});j({ok:k(),nodeId:IE.optional(),supportsPeerPairing:k().optional(),pairedBack:k().optional(),latencyMs:O().int().nonnegative().optional(),origin:D().max(2048).optional(),transportKind:RE.optional(),encrypted:k().optional(),version:D().max(128).optional(),platform:D().max(64).optional(),hostname:D().max(255).optional(),homeDir:D().max(4096).optional(),projectCount:O().int().nonnegative().optional(),projects:A(WE).optional(),error:D().max(1e3).optional()});let GE=j({id:D().min(1).max(1024),name:D().min(1).max(512),path:D().min(1).max(8192),threadIds:A(D().min(1).max(1024))}),KE=j({attachments:P(1).optional(),workspaceFiles:P(1).optional(),officePreview:P(1).optional(),delegation:P(1).optional(),peerPairing:P(1).optional()}),qE=j({version:D().max(128),platform:D().max(64),hostname:D().max(255),homeDir:D().max(4096).optional(),epoch:D().min(1).max(256),nodeId:IE.optional(),peerNodes:du(LE,IE).refine(e=>Object.keys(e).length<=128).optional(),projects:A(GE),capabilities:KE.optional()});M({threadId:D().min(1).max(1024),scope:D().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:D().min(1).max(256).optional(),mode:N([`queue`,`steer`]).optional(),expectedTurnId:D().min(1).max(1024).nullable().optional(),content:A(au(`type`,[M({type:P(`text`),text:D()}),M({type:P(`file`),receiptId:D().min(1).max(128)})])).min(1).max(64)});let JE=j({ok:P(!1),error:j({code:D(),message:D(),details:du(D(),Zl()).optional()})});ru([j({ok:P(!0),value:j({receiptId:D().min(1),file:j({attachmentId:D(),name:D(),bytes:O().int().nonnegative()})})}),JE]),ru([j({ok:P(!0),value:j({accepted:P(!0)})}),JE]);let YE=j({name:D().min(1).max(512),path:D().min(1).max(8192),kind:P(`directory`)});j({peerId:FE,path:D().min(1).max(8192).optional()}),j({path:D().min(1).max(8192),parentPath:D().min(1).max(8192).nullable(),homeDir:D().min(1).max(8192).optional(),entries:A(YE)}),j({peerId:FE,parentPath:D().min(1).max(8192),name:D().min(1).max(255).refine(e=>e.trim().length>0,`Directory name cannot be blank`)}),j({path:D().min(1).max(8192),name:D().min(1).max(255)}),j({peerId:FE,path:D().min(1).max(8192),title:D().trim().min(1).max(255).optional()}),j({peerId:FE,workspaceId:D().min(1).max(1024),title:D().trim().min(1).max(255)}),j({peerId:FE,workspaceId:D().min(1).max(1024)}),j({workspaceId:D().min(1).max(1024).optional(),manifest:qE}),j({sessionHostId:D().min(1).max(128).optional()}),j({hosts:A(j({hostId:ru([P(`local`),LE]),name:D().min(1).max(120),isLocal:k().optional(),color:BE.optional(),hostname:D().max(255).optional()}))}),j({hostId:ru([P(`local`),LE])}),j({harnesses:A(j({id:D().regex(/^[a-z0-9][a-z0-9-]*$/u),name:D().min(1).max(120)}))});let XE=N([`listHarnesses`,`inspect`,`start`,`send`,`cancel`,`read`,`answer`,`list`]);M({operation:XE,hopCount:O().int().min(0).max(16),sourceId:FE.optional(),input:FC});let ZE=M({code:D().min(1).max(128),message:D().max(4096),details:FC.optional()});ru([M({ok:P(!0),value:PC}),M({ok:P(!1),error:ZE})]);let QE=M({id:D().min(1).max(1024),name:D().min(1).max(512),path:D().min(1).max(8192)});M({hosts:A(M({hostId:LE,nodeId:IE.optional(),displayName:D().min(1).max(120),online:k(),state:VE,delegation:k(),projects:A(QE),platform:D().max(64).optional(),hostname:D().max(255).optional(),homeDir:D().max(4096).optional()}))}),M({version:P(1),instanceId:D().min(1).max(128),pid:O().int().positive(),endpoint:D().min(1).max(256),token:D().regex(/^[0-9a-f]{64}$/u),startedAt:O().int().nonnegative()}),ru([M({operation:P(`hosts`)}),M({operation:XE,hostId:LE,hopCount:O().int().min(0).max(16),timeoutMs:O().int().min(1).max(12e4).optional(),input:FC})]);let $E=j({id:D().min(1).max(256),harnessId:D().min(1),label:D().min(1).max(512),provider:N([`openai-codex`,`xai`])}).strict(),eD=D().regex(/^[a-z][a-z0-9-]{0,47}$/),tD=j({name:eD,source:$E,importedAt:D()}).strict(),nD=au(`action`,[j({action:P(`list`)}).strict(),j({action:P(`import`),sourceId:D().min(1).max(256),name:eD,confirmed:P(!0)}).strict(),j({action:P(`reimport`),sourceId:D().min(1).max(256),name:eD,confirmed:P(!0)}).strict(),j({action:P(`remove`),name:eD,confirmed:P(!0)}).strict()]),rD=j({provider:D().min(1).max(128),type:N([`oauth`,`api_key`,`unknown`]),label:D().min(1).max(512).optional(),vendor:N([`openai-codex`,`xai`]).optional()}).strict();j({sources:A($E),targets:A(j({harnessId:D(),providers:A(N([`openai-codex`,`xai`])),imports:A(tD),others:A(rD).default([])}).strict())}).strict(),j({targetHarnessId:D().min(1).max(128).optional(),request:nD}).strict(),j({events:k()});let iD=A(M({agent:D().min(1).max(128),section:N([`main`,`more`,`auto`])})).max(256).refine(e=>new Set(e.map(e=>e.agent)).size===e.length,`Duplicate Harness IDs`);M({entries:iD.nullable()}),M({}),M({entries:iD,initializeOnly:k().optional()});let aD=M({enabled:k(),timeoutMinutes:O().int().min(5).max(1440)});Object.freeze({enabled:!0,timeoutMinutes:10});let oD=D().regex(/^external$/u),sD=HC.transform(e=>String(e)),cD=M({model:fw.optional(),thinkingOptionId:mw.optional(),permissionModeId:GC.optional()}).refine(e=>!!(e.model||e.thinkingOptionId||e.permissionModeId),`A default configuration must contain a preference`),lD=M({lastHarness:HC.optional(),byHarness:du(sD,cD)}),uD=M({model:fw.optional(),thinkingOptionId:mw.optional()}).refine(e=>!!(e.model||e.thinkingOptionId),`A delegation default must contain a Model or Thinking option`),dD=M({byHarness:du(sD,uD)}),fD=D().min(1).max(1024),pD=M({idleRelease:aD.optional(),favorites:du(sD,A(fD).max(2048)).default({}),newThread:lD.optional(),delegation:dD.optional()});M({scope:oD,revision:O().int().nonnegative(),values:pD}),M({scope:oD.default(`external`)});let mD=au(`kind`,[M({kind:P(`idleRelease`),value:aD}),M({kind:P(`favorite`),harnessId:HC,modelId:fD,enabled:k()}),M({kind:P(`favorites`),harnessId:HC,modelIds:A(fD).max(2048)}),M({kind:P(`newThread`),lastHarness:HC.optional(),harnessId:HC.optional(),configuration:cD.optional()}),M({kind:P(`delegation`),harnessId:HC,configuration:uD.nullable()})]);M({scope:oD.default(`external`),operations:A(mD).min(1).max(256),initializeOnly:k().optional(),expectedRevision:O().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`})}),M({version:P(1),revision:O().int().nonnegative(),scopes:du(oD,pD)});let hD=O().finite().nonnegative(),gD=M({input:hD,output:hD,cacheRead:hD.optional(),cacheWrite:hD.optional(),cacheWrite1h:hD.optional()}),_D=D().max(512).refine(e=>e.trim()===e&&e.length>0,`Model ID is required`);M({path:D(),entries:A(M({key:D(),price:gD})),error:D().nullable()}),M({}),M({key:_D,price:gD.nullable(),previousKey:_D.optional()}),M({model:_D});let vD=M({official:k().optional(),canonicalModelId:D().min(1).optional(),provider:D().min(1).max(512),model:D().min(1).max(512),price:gD});M({price:gD.nullable(),suggestions:A(vD).max(6).optional()});let yD=[`today`,`7d`,`30d`,`90d`,`all`],bD=O().int().min(0).max(2**53-1),xD=D().regex(/^\d{4}-\d{2}-\d{2}$/u),SD=D().min(1).max(128),CD=D().min(1).max(512),wD=D().min(1).max(4096);M({range:N(yD),timeZone:D().min(1).max(128).refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Unsupported usage statistics timezone`).optional(),harness:SD.optional(),model:CD.nullable().optional(),project:wD.nullable().optional(),date:xD.optional()});let TD=M({requests:bD,inputTokens:bD,cachedInputTokens:bD,cacheWriteInputTokens:bD,cacheKnownInputTokens:bD,cacheHitCachedInputTokens:bD,cacheHitInputTokens:bD,outputTokens:bD,reasoningOutputTokens:bD,costUsd:O().finite().min(0),unpricedRequests:bD,unmeteredRequests:bD}),ED=TD.shape,DD=M({harness:SD,sessionId:D().min(1).max(512),project:wD.nullable(),title:D().min(1).max(200).optional(),models:A(CD).max(16),firstAtMs:bD,lastAtMs:bD,...ED});M({range:N(yD),from:xD.nullable(),to:xD,filters:M({harness:SD.nullable(),model:CD.nullable(),unknownModel:k(),project:wD.nullable(),unknownProject:k(),date:xD.nullable()}),reading:M({complete:k(),sources:bD,read:bD}),failures:A(M({harness:SD,message:D().max(2048)})).max(256),options:M({harnesses:A(SD).max(256),models:A(CD.nullable()).max(4096),projects:A(wD.nullable()).max(4096)}),modelLabels:A(M({harness:SD,model:CD,label:CD})).max(4096).optional(),credits:A(M({harness:SD,model:CD.nullable(),credits:O().finite().min(0),reportedRequests:bD,requests:bD})).max(4096).optional(),totals:TD,daily:A(M({date:xD,harness:SD,...ED})).max(2e5),hourly:A(M({weekday:O().int().min(0).max(6),hour:O().int().min(0).max(23),...ED})).max(168),byHarness:A(M({harness:SD,...ED})).max(256),byModel:A(M({model:CD.nullable(),...ED,harnessPricedRequests:bD})).max(4096),byProject:A(M({project:wD.nullable(),...ED})).max(4096),sessions:A(DD).max(100),recentSessions:A(DD).max(100).optional()}),j({threadId:Y}),j({discarded:k()});let OD=au(`type`,[j({id:D().min(1),type:P(`choice`),prompt:D(),options:A(j({value:D().min(1),label:D(),description:D().optional()})).min(1),multiple:k(),allowOther:k(),optional:k()}),j({id:D().min(1),type:P(`text`),prompt:D(),multiline:k(),secret:P(!1),optional:k(),placeholder:D().optional(),prefill:D().optional()})]),kD=j({interactionId:D().min(1),turnId:D().min(1),title:D().optional(),questions:A(OD).min(1)}).refine(({questions:e})=>e.some(e=>e.type===`choice`&&e.multiple),{message:`Shared cards require at least one multi-select question`});M({threadId:D().min(1)}),j({questions:A(kD)}),M({threadId:D().min(1),turnId:D().min(1),interactionId:D().min(1),answers:du(D(),A(D())),cancelled:k().default(!1)}),j({accepted:P(!0)});let AD=j({path:D(),oldText:D().nullable(),newText:D()});j({sessionId:D().min(1),turn:O().int().nonnegative(),path:D().min(1).optional()}),j({diffs:A(AD)}),M({}),M({}),j({reference:j({sessionId:D().min(1),epoch:D().min(1),turn:O().int().nonnegative(),seq:O().int().nonnegative(),callId:D().min(1),part:O().int().nonnegative(),version:D().min(1)}),length:O().int().nonnegative(),bytes:O().int().nonnegative()}),M({title:D().trim().min(1).max(200),type:N([`info`,`warning`,`danger`]),body:D().trim().min(1).max(16384)}),M({}),M({url:D().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 jD=N([`idle`,`running`,`busy`,`closing`,`failed`,`blocked`]),MD=N([`none`,`disabled`,`timeout`,`operation`,`background`,`identity`,`persistence`,`closeFailed`]);M({threadId:D(),title:D(),harnessId:D(),state:jD,reason:MD,inactiveMs:O().nonnegative()}),M({threadId:Y,turnId:UC});let ND=j({email:D().trim().min(1).max(320).optional(),label:D().trim().min(1).max(256).optional(),plan:D().trim().min(1).max(128).optional(),credits:sw.optional(),balance:cw.optional()}).strict();function PD(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 FD=PD(ND),ID={harnessId:HC,harnessName:D().trim().min(1).max(128)},LD=j(ID).strict();j({}).strict(),j({sources:A(LD).max(128)}).strict(),j({harnessId:HC,refresh:k().optional()}).strict(),j({...ID,account:FD.nullable(),accounts:A(FD).max(8).optional()}).strict(),j({refresh:k().optional()}).strict(),j({accounts:A(PD(ND.extend(ID))).max(128)}).strict(),j({harnessId:kw,model:fw.optional(),thinkingOptionId:mw.optional(),permissionModeId:GC.optional(),prewarm:P(!0).optional()}).strict();let RD=D().trim().min(1).max(4096).refine(e=>!/[\u0000\r\n]/u.test(e),`Invalid entrypoint path`);j({harnessId:kw}).strict().extend({path:RD.nullable()}),j({path:RD.nullable(),restartRequired:k()}).strict(),j({harnessId:HC,action:N([`check`,`update`,`install`]),confirmedVersion:D().min(1).max(128).optional()}).strict().refine(({action:e,confirmedVersion:t})=>e===`update`||t===void 0);let zD=j({currentVersion:D().min(1).max(128),latestVersion:D().min(1).max(128),updateAvailable:k(),canUpdate:k(),latestVerifiedVersion:D().min(1).max(128).optional(),confirmationRequired:P(!0).optional(),versionKind:N([`cli`,`application`]).optional(),manualUpdateUrl:Ol().max(2048).refine(e=>/^https:\/\/[^/?#@]+(?:[/?#]|$)/iu.test(e),`Manual updates require a credential-free HTTPS URL`).optional(),message:D().max(2048).optional(),messageCode:D().min(1).max(128).optional(),notice:BC.optional(),latestVersionKind:N([`unknown`,`tracking-branch`]).optional()}).strict();j({taskId:D().uuid()}).strict(),au(`status`,[j({taskId:D().uuid(),status:P(`running`)}).strict(),j({taskId:D().uuid(),status:P(`succeeded`),result:zD}).strict(),j({taskId:D().uuid(),status:P(`failed`),error:j({code:O().int(),message:D().min(1).max(2048)}).strict()}).strict()]);let BD=D().min(1).max(256).regex(/^[A-Za-z0-9._~-]+$/u),VD=D().trim().min(1),HD=N([`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`]),UD=j({accountId:BD,label:VD.max(256),email:D().email().max(320).optional(),planType:HD.optional()}).strict(),WD=N([`ready`,`unavailable`]);j({version:P(2),currentAccountId:BD.nullable(),phase:WD,revision:O().int().nonnegative(),instanceId:VD.max(1024).optional(),accounts:A(UD).max(1)}).strict(),j({accountId:BD,refresh:k().optional()}).strict(),j({accountId:BD,usage:tw.nullable(),accountCredits:sw.optional(),freshness:N([`live`,`cached`]),observedAt:D().datetime().nullable()}).strict();let GD=1e3,KD=D().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),qD=KD.max(1024),JD=j({nativeSessionId:qD,title:KD.max(4096).nullable(),updatedAt:O().int().nonnegative().max(864e13),cwd:KD.max(16384),running:k().nullable()}).strict();j({}).strict(),j({harnesses:A(j({harnessId:kw,name:KD.max(128)}).strict()).max(128)}).strict(),j({harnessId:kw,query:D().trim().max(4096).refine(e=>!e.includes(`\0`)).optional(),offset:O().int().nonnegative().safe().optional(),limit:O().int().min(1).max(GD).optional()}).strict(),j({candidates:A(JD).max(GD),total:O().int().nonnegative().safe()}).strict(),j({harnessId:kw,nativeSessionId:qD}).strict(),j({threadId:KD.max(1024).pipe(Y)}).strict();let YD=D().refine(e=>e.trim().length>0,`Value must not be empty or whitespace`).refine(e=>!e.includes(`\0`),`Value must not contain NUL`),XD=qD,ZD=JD;j({}).strict(),j({candidates:A(ZD).max(1e3)}).strict(),j({nativeSessionId:XD}).strict(),j({threadId:YD.max(1024).pipe(Y)}).strict(),j({threadId:Y,lastTurnId:UC}).strict(),j({threadId:Y}).strict();let QD=D().trim().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u).brand();j({commands:A(j({id:QD,invocation:D().min(1).max(128),label:D().trim().min(1).max(128),description:D().trim().min(1).max(512).optional(),localizations:zC.optional(),argumentMode:N([`none`,`text`]),kind:N([`command`,`skill`]).optional()}).strict()),warnings:A(D().min(1)).optional(),source:N([`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)}),j({harnessId:HC,cwd:D().min(1).optional()}).strict(),j({threadId:Y}).strict(),j({threadId:Y,commandId:QD,turnId:UC.optional(),arguments:FC.optional()}).strict(),j({accepted:P(!0),turnId:UC.optional()}).strict();let $D=P(`2.0`).optional(),eO=$l().optional(),tO=D().min(1),nO=ru([D(),O().int()]),rO=j({code:O().int(),message:D(),data:PC.optional()}).catchall(PC).superRefine(kC([`data`]));ru([j({jsonrpc:$D,id:nO,method:tO,params:PC.optional(),result:eO,error:eO}).catchall(PC).superRefine(kC([`jsonrpc`,`params`,`result`,`error`])),j({jsonrpc:$D,id:eO,method:tO,params:PC.optional(),result:eO,error:eO}).catchall(PC).superRefine(kC([`jsonrpc`,`id`,`params`,`result`,`error`])),j({jsonrpc:$D,id:nO,method:eO,params:eO,result:PC,error:eO}).catchall(PC).superRefine(kC([`jsonrpc`,`method`,`params`,`error`])),j({jsonrpc:$D,id:nO,method:eO,params:eO,result:eO,error:rO}).catchall(PC).superRefine(kC([`jsonrpc`,`method`,`params`,`result`]))]);let iO=D().refine(e=>e.trim().length>0,{message:`Native identifier must not be empty or whitespace`});M({harnessId:HC,nativeSessionId:iO,locator:PC.optional(),formatVersion:P(1)}).superRefine(kC([`locator`])),M({harnessId:HC,nativeSessionId:iO,nativeTurnKey:iO,formatVersion:P(1)}),M({harnessId:HC,nativeSessionId:iO,checkpointId:iO,locator:PC.optional(),formatVersion:P(1)}).superRefine(kC([`locator`]));let aO=D().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u),oO=N([`npm`,`windows-installer`,`macos-dmg`,`linux-archive`]),sO=N([`prepared`,`downloading`,`waiting-for-exit`,`installing`,`restarting`,`succeeded`,`failed`]),cO=M({completed:O().int().nonnegative(),total:O().int().positive()}).refine(e=>e.completed<=e.total,{path:[`completed`],message:`completed must not exceed total`}),lO=M({version:aO,installation:oO,phase:sO,updatedAt:O().int().nonnegative(),downloadedBytes:O().int().nonnegative().optional(),totalBytes:O().int().positive().optional(),npmDownload:cO.optional(),error:D().min(1).max(500).nullable(),serviceStopOutput:D().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`})});M({});let uO=D().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`),dO=N([`idle`,`downloading`,`ready`,`failed`]),fO=M({downloadedBytes:O().int().nonnegative(),totalBytes:O().int().positive()}).refine(e=>e.downloadedBytes<=e.totalBytes,{path:[`downloadedBytes`],message:`downloadedBytes must not exceed totalBytes`});j({currentVersion:aO,installation:oO.nullable(),latestVersion:aO.nullable(),updateAvailable:k(),installationAvailable:k(),releaseNotes:D().min(1).max(2e4).nullable(),releaseNotesUrl:uO.nullable(),status:lO.nullable(),error:D().min(1).max(500).nullable(),stagedVersion:aO.nullable().optional(),backgroundPhase:dO.optional(),backgroundDownload:fO.nullable().optional(),backgroundError:D().min(1).max(500).nullable().optional(),runningTaskCount:O().int().nonnegative().optional()}),M({status:lO}),M({status:lO.nullable()}),M({supported:k(),enabled:k(),certificatePresent:k(),appSignedWithLocalCert:k(),appPath:D().min(1).nullable(),certificateName:D().min(1),certificateSha1:D().regex(/^[0-9A-Fa-f]{40}$/u).nullable()});let pO=M({icon:D().min(1).max(16).optional(),title:D().min(1).max(120),body:D().min(1).max(1200),contributors:A(D().min(1).max(39)).max(30)}),mO=M({summary:D().min(1).max(600).optional(),themes:A(pO).min(1).max(12)}),hO=M({version:aO,publishedAt:Bu(),url:D().max(300).regex(/^https:\/\/github\.com\/BytePioneer-AI\/codex-host\/releases\/tag\/v[0-9A-Za-z.+-]+$/u),zh:mO.nullable(),en:mO.nullable()}).refine(e=>e.zh!==null||e.en!==null,{message:`an announcement needs at least one language`});M({manual:k().optional()}),M({announcement:hO.nullable(),unread:k()}),M({version:aO}),RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): `+`(${[`completed`,`failed`,`interrupted`,`needsInput`,`timedOut`,`unreadable`,`notFound`].join(`|`)})(?:\. (.+))?$`,`u`);let gO=`<response-annotations>`,_O=`</response-annotations>`,vO=/^\s*## My request(?: for Codex)?:[ \t]*(?:\r?\n|$)/u;function yO(e){if(e.length===0)return``;let t=e.map(({text:e,annotation:t})=>({text:e,...t===void 0?{}:{annotation:t}}));return`\n# Response annotations:\nEach item contains text selected from an earlier Codex response and may include a user comment. Treat items as Annotation 1, Annotation 2, and so on in array order. Use every selection as context and address every comment. For every annotation you address, include its inline directive \`:codex-annotation{index="N"}\`, where N is its one-based array position (for example, \`:codex-annotation{index="1"}\`). Do not use unstructured annotation labels.\n${gO}\n${JSON.stringify(t)}\n${_O}\n`}function bO(e,t){let n=yO(e);return n===``?t:`${n}\n## My request:\n${t}\n`}function xO(e){let t=e.trimStart().startsWith(`# Response annotations:`)?0:e.length,n=e.indexOf(`\n${gO}\n`,t);if(n<0)return;let r=n+1+22+1,i=e.indexOf(`\n${_O}`,r);if(!(i<0))return{json:e.slice(r,i),closeEnd:i+1+23}}function SO(e){let t=xO(e);if(t===void 0)return{annotations:[],body:e};let n=wO(t.json);if(n.length===0)return{annotations:[],body:e};let r=e.slice(t.closeEnd),i=vO.exec(r);if(i===null)return{annotations:[],body:e};let a=r.slice(i[0].length);return{annotations:n,body:i[0].endsWith(`\r
147
147
  `)&&a.endsWith(`\r
148
148
  `)?a.slice(0,-2):a.endsWith(`
149
- `)?a.slice(0,-1):a}}function xO(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function SO(e){if(e===``)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t)||t.length===0)return[];let n=[];for(let e of t){if(!xO(e))return[];let{text:t,annotation:r}=e;if(typeof t!=`string`||t.length===0||r!==void 0&&(typeof r!=`string`||r.length===0))return[];n.push({text:t,...r===void 0?{}:{annotation:r}})}return n}let CO=N([`idle`,`installing`,`restarting`,`succeeded`,`failed`]);j({runningVersion:D().nullable(),installedVersion:D().nullable(),restartRequired:k(),remote:k(),updateSupported:k(),update:j({phase:CO,targetVersion:D().nullable(),error:D().nullable()})});let wO=j({version:D().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)}).strict();j({hostname:D().min(1).max(1024).refine(e=>!e.startsWith(`-`)&&!/\s/u.test(e)),port:O().int().min(1).max(65535).nullable(),identity:D().max(4096).nullable(),action:N([`inspect`,`install`,`update`,`repair`,`uninstall`]),uninstallPackage:k().optional(),version:D().regex(/^\d+\.\d+\.\d+$/u).nullable()}).strict(),j({state:N([`installed`,`not-installed`])}).strict();let X=D().min(1).max(1024),TO={hostId:X.regex(/^(?:remote-(?:ssh(?:-|:)|control:)|remote-peer:[a-zA-Z0-9_-]{1,64}$)/u)},EO={...TO,threadId:X},DO=D().min(1).max(8e3),OO={text:DO,requestId:X};au(`accepted`,[j({accepted:P(!0),startQueuedItemId:X.optional()}),j({accepted:P(!1),code:N([`remote/queue-unavailable`,`remote/steer-unavailable`,`remote/turn-changed`,`remote/send-rejected`,`session/queue-item-not-found`,`session/queue-item-starting`]),message:D()})]),au(`available`,[j({available:P(!1)}),j({available:P(!0),items:A(j({id:X,clientUserMessageId:X,preview:D().max(801)})).max(100)})]);let kO=au(`kind`,[M({kind:P(`hosts`)}),M({kind:P(`create`),...TO,cwd:D().min(1).max(8192),epoch:X}),M({kind:P(`projectHarnesses`),...TO,epoch:X}),M({kind:P(`inspectHarness`),...TO,epoch:X,cwd:D().min(1).max(8192),harnessId:X}),M({kind:P(`startSelected`),...TO,epoch:X,cwd:D().min(1).max(8192),harnessId:X,model:D().min(1).max(4096),serviceTier:N([`priority`,`ultrafast`]).optional(),reasoningEffort:X.optional()}),M({kind:P(`status`),...EO}),M({kind:P(`list`),...TO,cursor:D().nullable(),archived:k(),includeLoaded:P(!0).optional()}),M({kind:P(`read`),...EO,page:M({cursor:D().min(1).max(8192).nullable(),epoch:X.optional(),sortDirection:N([`asc`,`desc`]).optional(),limit:O().int().min(1).max(20).optional()}).refine(e=>e.cursor===null||e.epoch!==void 0,{message:`A history continuation requires its connection epoch`}).optional()}),M({kind:P(`usage`),...EO,epoch:X}),M({kind:P(`configure`),...EO,epoch:X,modelId:X.optional(),serviceTier:dw.optional(),thinkingOptionId:X.optional(),permissionModeId:X.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`}),M({kind:P(`prompt`),...EO,epoch:X,text:DO,requestId:X.optional()}),M({kind:P(`queue`),...EO,epoch:X}),M({kind:P(`delivery`),...EO,epoch:X,action:au(`kind`,[M({kind:P(`enqueue`),...OO}),M({kind:P(`steer`),...OO,turnId:X}),M({kind:P(`remove`),itemId:X}),M({kind:P(`start`),itemId:X,onlyIfHead:P(!0).optional()}),M({kind:P(`sendNow`),itemId:X})])}),M({kind:P(`interrupt`),...EO,epoch:X,turnId:X}),M({kind:P(`rename`),...EO,epoch:X,name:D().min(1).max(512)}),M({kind:P(`archive`),...EO,epoch:X,archived:k()}),M({kind:P(`respond`),...EO,epoch:X,requestId:ru([X,O().int()]),result:du(D(),Zl())})]),AO=D().min(1).max(1024),jO=j({hostId:AO,displayName:D().min(1).max(1024),source:N([`codex-managed`,`discovered`]),sshAlias:D().max(1024).nullable(),sshHost:D().min(1).max(1024),sshPort:O().int().min(1).max(65535).nullable(),identity:D().max(4096).nullable(),autoConnect:k(),connectionAnalyticsId:D().max(1024).optional()}),MO=M({displayName:D().min(1).max(1024),hostname:D().min(1).max(1024),sshPort:O().int().min(1).max(65535).nullable(),identity:D().max(4096).nullable()});au(`action`,[M({action:P(`session`),operation:kO}),M({action:P(`list`)}),M({action:P(`catalog`)}),M({action:P(`read-thread`),hostId:AO.refine(e=>e!==`local`),input:jE}),M({action:P(`save`),draft:MO,previous:jO.nullable()}),M({action:P(`remove`),previous:jO}),M({action:P(`connect`),hostId:AO,enabled:k()}),M({action:P(`state`),hostId:AO}),M({action:P(`runtime`),hostId:AO}),M({action:P(`update`),hostId:AO.refine(e=>e!==`local`),version:wO.shape.version})]),ru([M({result:PC}),M({error:M({code:O().int(),message:D()})})]),M({prompt:D().trim().min(1).max(2e3),cwd:D().max(4096).nullable()}),D().trim().min(1).max(60).nullable();let NO=D().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u),PO=ru([D(),j({en:D()}).catchall(D())]),FO=j({title:PO.optional(),description:PO.optional(),icon:D().max(349592).regex(/^data:image\/(?:svg\+xml|png|jpeg|webp);base64,[A-Za-z0-9+/]*={0,2}$/u).optional(),error:D().optional()});j({extensions:A(j({id:NO,name:D().min(1).max(214),version:D().min(1).max(128),format:P(`dsh`),supportedTargets:lu([P(`web`)]),enabledTargets:A(P(`web`)).max(1),source:D().min(1).max(4096),projectUrl:D().max(4096).url({protocol:/^https?$/u}).optional(),installedAt:D(),meta:FO.optional(),loadError:D().optional()})),loadedIds:A(NO),safeMode:k(),storeError:D().optional()});let IO=D().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}/`);j({spec:D().trim().min(1).max(4096),registry:IO.optional()}).strict(),j({id:NO,enabled:k()}).strict(),j({id:NO}).strict(),P(1);function LO(e){return e.registerNodeTransform(sh,e=>{let t=CE(e.getTextContent())[0];t&&e.splitText(t.start,t.end)[t.start===0?0:1]?.replace(new pC({source:`codexhost-skill`,ref:t.text,label:t.name,appearance:`skill`,clipboardText:t.text}))})}let RO=`color: var(--dsw-alias-state-business-primary)`;function zO(){let e=X_().getFirstChild();if(!U(e))return null;let t=e.getFirstChild();return z(t)?t:null}function BO(e,t){return e.registerNodeTransform(sh,e=>{let n=zO();if(n===null||e.getKey()!==n.getKey()){e.getStyle()===RO&&e.setStyle(``);return}let r=e.getTextContent(),i=t(),a=r===i?.trimEnd()?r:i;if(a===null||!r.startsWith(a))e.getStyle()===RO&&e.setStyle(``);else if(r.length>a.length){let[t,n]=e.splitText(a.length);t!==void 0&&t.getStyle()!==RO&&t.setStyle(RO),n?.setStyle(``)}else e.getStyle()!==RO&&e.setStyle(RO)})}function VO(e){e.update(()=>{zO()?.markDirty()})}function HO(){let e=[],t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map,i=``,a=``,o=(n,r,o,s)=>{let c={kind:n,node:r,detectStart:i.length,detectLength:o.length,clipboardStart:a.length,clipboardLength:s.length};e.push(c),t.set(r.getKey(),c),i+=o,a+=s},s=e=>{let t=i.length,a=e.getChildren();n.set(e.getKey(),a.map(e=>e.getKey()));for(let e of a)if(hC(e))o(`chip`,e,``,e.getTextContent());else if(z(e)){let t=e.getTextContent();o(`text`,e,t,t)}else i_(e)?o(`linebreak`,e,`
149
+ `)?a.slice(0,-1):a}}function CO(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function wO(e){if(e===``)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t)||t.length===0)return[];let n=[];for(let e of t){if(!CO(e))return[];let{text:t,annotation:r}=e;if(typeof t!=`string`||t.length===0||r!==void 0&&(typeof r!=`string`||r.length===0))return[];n.push({text:t,...r===void 0?{}:{annotation:r}})}return n}let TO=N([`idle`,`installing`,`restarting`,`succeeded`,`failed`]);j({runningVersion:D().nullable(),installedVersion:D().nullable(),restartRequired:k(),remote:k(),updateSupported:k(),update:j({phase:TO,targetVersion:D().nullable(),error:D().nullable()})});let EO=j({version:D().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u)}).strict();j({hostname:D().min(1).max(1024).refine(e=>!e.startsWith(`-`)&&!/\s/u.test(e)),port:O().int().min(1).max(65535).nullable(),identity:D().max(4096).nullable(),action:N([`inspect`,`install`,`update`,`repair`,`uninstall`]),uninstallPackage:k().optional(),version:D().regex(/^\d+\.\d+\.\d+$/u).nullable()}).strict(),j({state:N([`installed`,`not-installed`])}).strict();let X=D().min(1).max(1024),DO={hostId:X.regex(/^(?:remote-(?:ssh(?:-|:)|control:)|remote-peer:[a-zA-Z0-9_-]{1,64}$)/u)},OO={...DO,threadId:X},kO=D().min(1).max(8e3),AO={text:kO,requestId:X};au(`accepted`,[j({accepted:P(!0),startQueuedItemId:X.optional()}),j({accepted:P(!1),code:N([`remote/queue-unavailable`,`remote/steer-unavailable`,`remote/turn-changed`,`remote/send-rejected`,`session/queue-item-not-found`,`session/queue-item-starting`]),message:D()})]),au(`available`,[j({available:P(!1)}),j({available:P(!0),items:A(j({id:X,clientUserMessageId:X,preview:D().max(801)})).max(100)})]);let jO=au(`kind`,[M({kind:P(`hosts`)}),M({kind:P(`create`),...DO,cwd:D().min(1).max(8192),epoch:X}),M({kind:P(`projectHarnesses`),...DO,epoch:X}),M({kind:P(`inspectHarness`),...DO,epoch:X,cwd:D().min(1).max(8192),harnessId:X}),M({kind:P(`startSelected`),...DO,epoch:X,cwd:D().min(1).max(8192),harnessId:X,model:D().min(1).max(4096),serviceTier:N([`priority`,`ultrafast`]).optional(),reasoningEffort:X.optional()}),M({kind:P(`status`),...OO}),M({kind:P(`list`),...DO,cursor:D().nullable(),archived:k(),includeLoaded:P(!0).optional()}),M({kind:P(`read`),...OO,page:M({cursor:D().min(1).max(8192).nullable(),epoch:X.optional(),sortDirection:N([`asc`,`desc`]).optional(),limit:O().int().min(1).max(20).optional()}).refine(e=>e.cursor===null||e.epoch!==void 0,{message:`A history continuation requires its connection epoch`}).optional()}),M({kind:P(`usage`),...OO,epoch:X}),M({kind:P(`configure`),...OO,epoch:X,modelId:X.optional(),serviceTier:dw.optional(),thinkingOptionId:X.optional(),permissionModeId:X.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`}),M({kind:P(`prompt`),...OO,epoch:X,text:kO,requestId:X.optional()}),M({kind:P(`queue`),...OO,epoch:X}),M({kind:P(`delivery`),...OO,epoch:X,action:au(`kind`,[M({kind:P(`enqueue`),...AO}),M({kind:P(`steer`),...AO,turnId:X}),M({kind:P(`remove`),itemId:X}),M({kind:P(`start`),itemId:X,onlyIfHead:P(!0).optional()}),M({kind:P(`sendNow`),itemId:X})])}),M({kind:P(`interrupt`),...OO,epoch:X,turnId:X}),M({kind:P(`rename`),...OO,epoch:X,name:D().min(1).max(512)}),M({kind:P(`archive`),...OO,epoch:X,archived:k()}),M({kind:P(`respond`),...OO,epoch:X,requestId:ru([X,O().int()]),result:du(D(),Zl())})]),MO=D().min(1).max(1024),NO=j({hostId:MO,displayName:D().min(1).max(1024),source:N([`codex-managed`,`discovered`]),sshAlias:D().max(1024).nullable(),sshHost:D().min(1).max(1024),sshPort:O().int().min(1).max(65535).nullable(),identity:D().max(4096).nullable(),autoConnect:k(),connectionAnalyticsId:D().max(1024).optional()}),PO=M({displayName:D().min(1).max(1024),hostname:D().min(1).max(1024),sshPort:O().int().min(1).max(65535).nullable(),identity:D().max(4096).nullable()});au(`action`,[M({action:P(`session`),operation:jO}),M({action:P(`list`)}),M({action:P(`catalog`)}),M({action:P(`read-thread`),hostId:MO.refine(e=>e!==`local`),input:NE}),M({action:P(`save`),draft:PO,previous:NO.nullable()}),M({action:P(`remove`),previous:NO}),M({action:P(`connect`),hostId:MO,enabled:k()}),M({action:P(`state`),hostId:MO}),M({action:P(`runtime`),hostId:MO}),M({action:P(`update`),hostId:MO.refine(e=>e!==`local`),version:EO.shape.version})]),ru([M({result:PC}),M({error:M({code:O().int(),message:D()})})]),M({prompt:D().trim().min(1).max(2e3),cwd:D().max(4096).nullable()}),D().trim().min(1).max(60).nullable();let FO=D().max(214).regex(/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/u),IO=ru([D(),j({en:D()}).catchall(D())]),LO=j({title:IO.optional(),description:IO.optional(),icon:D().max(349592).regex(/^data:image\/(?:svg\+xml|png|jpeg|webp);base64,[A-Za-z0-9+/]*={0,2}$/u).optional(),error:D().optional()});j({extensions:A(j({id:FO,name:D().min(1).max(214),version:D().min(1).max(128),format:P(`dsh`),supportedTargets:lu([P(`web`)]),enabledTargets:A(P(`web`)).max(1),source:D().min(1).max(4096),projectUrl:D().max(4096).url({protocol:/^https?$/u}).optional(),installedAt:D(),meta:LO.optional(),loadError:D().optional()})),loadedIds:A(FO),safeMode:k(),storeError:D().optional()});let RO=D().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}/`);j({spec:D().trim().min(1).max(4096),registry:RO.optional()}).strict(),j({id:FO,enabled:k()}).strict(),j({id:FO}).strict(),P(1);function zO(e){return e.registerNodeTransform(sh,e=>{let t=TE(e.getTextContent())[0];t&&e.splitText(t.start,t.end)[t.start===0?0:1]?.replace(new pC({source:`codexhost-skill`,ref:t.text,label:t.name,appearance:`skill`,clipboardText:t.text}))})}let BO=`color: var(--dsw-alias-state-business-primary)`;function VO(){let e=X_().getFirstChild();if(!U(e))return null;let t=e.getFirstChild();return z(t)?t:null}function HO(e,t){return e.registerNodeTransform(sh,e=>{let n=VO();if(n===null||e.getKey()!==n.getKey()){e.getStyle()===BO&&e.setStyle(``);return}let r=e.getTextContent(),i=t(),a=r===i?.trimEnd()?r:i;if(a===null||!r.startsWith(a))e.getStyle()===BO&&e.setStyle(``);else if(r.length>a.length){let[t,n]=e.splitText(a.length);t!==void 0&&t.getStyle()!==BO&&t.setStyle(BO),n?.setStyle(``)}else e.getStyle()!==BO&&e.setStyle(BO)})}function UO(e){e.update(()=>{VO()?.markDirty()})}function WO(){let e=[],t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map,i=``,a=``,o=(n,r,o,s)=>{let c={kind:n,node:r,detectStart:i.length,detectLength:o.length,clipboardStart:a.length,clipboardLength:s.length};e.push(c),t.set(r.getKey(),c),i+=o,a+=s},s=e=>{let t=i.length,a=e.getChildren();n.set(e.getKey(),a.map(e=>e.getKey()));for(let e of a)if(hC(e))o(`chip`,e,``,e.getTextContent());else if(z(e)){let t=e.getTextContent();o(`text`,e,t,t)}else i_(e)?o(`linebreak`,e,`
150
150
  `,`
151
151
  `):U(e)&&
152
152
  /* v8 ignore next 4 -- plain-text composition nests no block elements today; the walk stays total for imported states. */
153
153
  s(e);r.set(e.getKey(),{start:t,end:i.length})},c=X_(),l=c.getChildren();n.set(c.getKey(),l.map(e=>e.getKey()));let u=i.length;return l.forEach((t,n)=>{let r=l[n-1];n>0&&r!==void 0&&(e.push({kind:`gap`,node:null,detectStart:i.length,detectLength:1,clipboardStart:a.length,clipboardLength:1,gapBetween:{before:r.getKey(),after:t.getKey()}}),i+=`
154
154
  `,a+=`
155
- `),U(t)&&s(t)}),r.set(c.getKey(),{start:u,end:i.length}),{segments:e,detectLength:i.length,detectText:i,clipboardText:a,byKey:t,children:n,bounds:r}}function UO(e,t){for(let n of e.segments){let e=n.clipboardStart+n.clipboardLength;if(!(t>e))return t===e||n.kind===`chip`?n.detectStart+n.detectLength:n.detectStart+(t-n.clipboardStart)}return e.detectLength}function WO(e,t){if(t.type===`text`){let n=e.byKey.get(t.key);return n===void 0?null:n.detectStart+Math.min(t.offset,n.detectLength)}let n=e.children.get(t.key),r=e.bounds.get(t.key);if(n===void 0||r===void 0)return null;if(t.offset>=n.length)return r.end;let i=n[t.offset];if(i===void 0)return r.end;let a=e.byKey.get(i);if(a!==void 0)return a.detectStart;let o=e.bounds.get(i);return o===void 0?null:o.start}function GO(e){let t=HO(),n=[];for(let r of t.segments){if(r.kind!==`chip`||!hC(r.node))continue;let t=r.node;n.push({occurrenceId:e(t.getKey()),source:t.getSource(),ref:t.getReference(),offset:r.clipboardStart,length:r.clipboardLength,label:t.getLabel(),...t.getAppearance()===void 0?{}:{appearance:t.getAppearance()},clipboardText:t.getTextContent(),...t.isInvalid()?{invalid:!0}:{}})}let r=V(),i=null;if(B(r)){let e=WO(t,r.anchor),n=WO(t,r.focus);e!==null&&n!==null&&(i={start:Math.min(e,n),end:Math.max(e,n)})}return{detectText:t.detectText,clipboardText:t.clipboardText,occurrences:n,selection:i,caret:i!==null&&i.start===i.end?i.start:null}}function KO(e,t){if(t<0||t>e.detectLength)return null;for(let n of e.segments){if(t>=n.detectStart+n.detectLength)continue;if(n.kind===`text`&&n.node!==null)return{key:n.node.getKey(),offset:t-n.detectStart,type:`text`};if(n.kind===`gap`&&n.gapBetween!==void 0){let t=n.gapBetween.before;return{key:t,offset:e.children.get(t)?.length??0,type:`element`}}
155
+ `),U(t)&&s(t)}),r.set(c.getKey(),{start:u,end:i.length}),{segments:e,detectLength:i.length,detectText:i,clipboardText:a,byKey:t,children:n,bounds:r}}function GO(e,t){for(let n of e.segments){let e=n.clipboardStart+n.clipboardLength;if(!(t>e))return t===e||n.kind===`chip`?n.detectStart+n.detectLength:n.detectStart+(t-n.clipboardStart)}return e.detectLength}function KO(e,t){if(t.type===`text`){let n=e.byKey.get(t.key);return n===void 0?null:n.detectStart+Math.min(t.offset,n.detectLength)}let n=e.children.get(t.key),r=e.bounds.get(t.key);if(n===void 0||r===void 0)return null;if(t.offset>=n.length)return r.end;let i=n[t.offset];if(i===void 0)return r.end;let a=e.byKey.get(i);if(a!==void 0)return a.detectStart;let o=e.bounds.get(i);return o===void 0?null:o.start}function qO(e){let t=WO(),n=[];for(let r of t.segments){if(r.kind!==`chip`||!hC(r.node))continue;let t=r.node;n.push({occurrenceId:e(t.getKey()),source:t.getSource(),ref:t.getReference(),offset:r.clipboardStart,length:r.clipboardLength,label:t.getLabel(),...t.getAppearance()===void 0?{}:{appearance:t.getAppearance()},clipboardText:t.getTextContent(),...t.isInvalid()?{invalid:!0}:{}})}let r=V(),i=null;if(B(r)){let e=KO(t,r.anchor),n=KO(t,r.focus);e!==null&&n!==null&&(i={start:Math.min(e,n),end:Math.max(e,n)})}return{detectText:t.detectText,clipboardText:t.clipboardText,occurrences:n,selection:i,caret:i!==null&&i.start===i.end?i.start:null}}function JO(e,t){if(t<0||t>e.detectLength)return null;for(let n of e.segments){if(t>=n.detectStart+n.detectLength)continue;if(n.kind===`text`&&n.node!==null)return{key:n.node.getKey(),offset:t-n.detectStart,type:`text`};if(n.kind===`gap`&&n.gapBetween!==void 0){let t=n.gapBetween.before;return{key:t,offset:e.children.get(t)?.length??0,type:`element`}}
156
156
  /* v8 ignore next -- non-gap segments always carry their node. */
157
- if(n.node===null)return null;let r=n.node.getParent();return r===null?null:{key:r.getKey(),offset:n.node.getIndexWithinParent(),type:`element`}}let n=X_().getChildren(),r=n[n.length-1];return r===void 0?{key:X_().getKey(),offset:0,type:`element`}:{key:r.getKey(),offset:e.children.get(r.getKey())?.length??0,type:`element`}}function qO(e,t){if(t.start<0||t.start>t.end||t.end>e.detectLength)return null;let n=KO(e,t.start),r=KO(e,t.end);
157
+ if(n.node===null)return null;let r=n.node.getParent();return r===null?null:{key:r.getKey(),offset:n.node.getIndexWithinParent(),type:`element`}}let n=X_().getChildren(),r=n[n.length-1];return r===void 0?{key:X_().getKey(),offset:0,type:`element`}:{key:r.getKey(),offset:e.children.get(r.getKey())?.length??0,type:`element`}}function YO(e,t){if(t.start<0||t.start>t.end||t.end>e.detectLength)return null;let n=JO(e,t.start),r=JO(e,t.end);
158
158
  /* v8 ignore next -- bounds were checked above; resolvePoint only fails out of bounds. */
159
- if(n===null||r===null)return null;let i=Xh();return i.anchor.set(n.key,n.offset,n.type),i.focus.set(r.key,r.offset,r.type),Z_(i),i}function JO(e,t){let n=qO(HO(),e);if(n===null)return!1;if(t===``)n.isCollapsed()||n.removeText();else{let e=t.replace(/\r\n?/gu,`
159
+ if(n===null||r===null)return null;let i=Xh();return i.anchor.set(n.key,n.offset,n.type),i.focus.set(r.key,r.offset,r.type),Z_(i),i}function XO(e,t){let n=YO(WO(),e);if(n===null)return!1;if(t===``)n.isCollapsed()||n.removeText();else{let e=t.replace(/\r\n?/gu,`
160
160
  `);e.includes(`
161
- `)?n.insertRawText(e):n.insertText(e)}return!0}function YO(e,t){let n=qO(HO(),e);return n!==null&&(n.insertNodes([...t]),!0)}let XO=/[\uE100-\uE11D\uFFFC]/gu;var ZO=class{deps;editor;projected={detectText:``,clipboardText:``,occurrences:[],selection:null,caret:null};occurrenceIds=/* @__PURE__ */ new Map;occurrenceSeq=0;lexiconOff;lexiconSource;domComposing=!1;constructor(e){this.deps=e,this.editor=g_({namespace:`dsh-composer`,nodes:[pC,TC],onError:e=>{throw e}}),this.editor.update(()=>{let e=X_();e.getChildrenSize()===0&&e.append(u_())},{discrete:!0,tag:Jm})}register(){let e=()=>{let e=this.editor.getRootElement();return e!==null&&!e.contains(e.ownerDocument.activeElement)&&xv(Jm),!1},t=()=>{this.domComposing=!0},n=()=>{this.domComposing=!1,this.deps.onCompositionEnd?.()},r=tx(qS(this.editor),this.editor.registerRootListener((e,r)=>{r?.removeEventListener(`compositionstart`,t),r?.removeEventListener(`compositionend`,n),this.domComposing=!1,e?.addEventListener(`compositionstart`,t),e?.addEventListener(`compositionend`,n)}),this.editor.registerCommand(Qp,e=>!this.editor.isEditable()||!e.dataTransfer?.types.includes(`application/x-codexhost-thread-reference`)||e.dataTransfer.types.includes(`Files`)?!1:(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,!0),4),this.editor.registerCommand(Xp,e=>{if(!this.editor.isEditable()||!e.dataTransfer||e.dataTransfer.types.includes(`Files`))return!1;let t=aC(e.dataTransfer.getData($S));return t!==void 0&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,this.insertFileReferences([iC(t)]))},4),this.editor.registerCommand(cm,()=>(this.editor.update(e,{discrete:!0}),!1),4),this.editor.registerCommand(bp,e,4),this.editor.registerNodeTransform(qg,e),OC(this.editor,(e,t)=>this.deps.openReference(e,t)),ZS(this.editor,QS(),1e3),this.editor.registerUpdateListener(()=>{this.deps.onUpdate()}),LO(this.editor),BO(this.editor,()=>this.deps.activeClaimToken()),EC(this.editor,()=>this.deps.lexicon(),()=>this.deps.activeClaimToken()),()=>{this.lexiconOff?.(),this.lexiconOff=void 0,this.lexiconSource=void 0});return()=>{r(),this.editor.setRootElement(null)}}get projection(){return this.projected}isComposing(){return this.domComposing||this.editor.isComposing()}applyEdit(e,t){this.editor._updating?(t!==void 0&&xv(t),e()):this.editor.update(e,{discrete:!0,...t===void 0?{}:{tag:t}})}refreshLexiconSubscription(){let e=this.deps.resolveLexicon();e!==this.lexiconSource&&(this.lexiconOff?.(),this.lexiconSource=e,this.lexiconOff=e?.subscribe(()=>{DC(this.editor)}),DC(this.editor))}refreshProjection(){let e=this.projected;return this.projected=this.editor.getEditorState().read(()=>GO(e=>this.occurrenceIdOf(e))),e}occurrenceIdOf(e){let t=this.occurrenceIds.get(e);return t===void 0?(this.occurrenceSeq+=1,this.occurrenceIds.set(e,this.occurrenceSeq),this.occurrenceSeq):t}setDraft(e){let t=e.replace(XO,``);(t!==this.projection.clipboardText||this.projection.occurrences.length!==0)&&this.editor.update(()=>{let e=X_();e.clear();for(let n of t.split(`
162
- `)){let t=u_();n!==``&&t.append(gh(n)),e.append(t)}e.selectEnd()},{discrete:!0,tag:Km})}paste(e){let t=e.replace(XO,``).replace(/\r\n?/gu,`
163
- `);t!==``&&this.applyEdit(()=>{let e=V();if(B(e)){e.insertRawText(t);return}let n=X_();n.getChildrenSize()===0&&n.append(u_()),n.selectEnd().insertRawText(t)},qm)}caretSpan(){if(this.projection.selection!==null)return this.projection.selection;let e=this.projection.detectText.length;return{start:e,end:e}}replaceText(e,t){let n=!1;return this.applyEdit(()=>{n=JO(e,t)}),n}insertAsyncText(e,t){let n=!1,r=t.replace(XO,``);return this.applyEdit(()=>{n=JO(e,r)},qm),n}insertReference(e,t,n){let r=!1;return this.applyEdit(()=>{r=YO(e,n===` `?[mC(t)]:[mC(t),gh(` `)])}),r}insertFileReferences(e,t){if(e.length===0)return!0;let n=!1;return this.applyEdit(()=>{let r=GO(e=>this.occurrenceIdOf(e)),i=t?.end??r.selection?.end??r.detectText.length,a=r.detectText.slice(0,i),o=e.flatMap(e=>[mC(e),gh(` `)]);a!==``&&!/\s$/u.test(a)&&o.unshift(gh(` `)),n=YO({start:i,end:i},o)},qm),n}refreshClaimDecoration(){VO(this.editor)}clearCommittedDraft(e){this.editor.update(()=>{let t=HO(),n=e(t.clipboardText);if(n!==null){JO({start:0,end:UO(t,n)},``);return}let r=X_();r.clear(),r.append(u_()),r.selectEnd()},{discrete:!0,tag:Km})}restoreDraft(e,t){this.editor.update(()=>{let n=X_();n.clear();let r=u_();n.append(r);let i=e=>{let t=e.replace(XO,``).split(`
164
- `);for(let e=0;e<t.length;e+=1){let i=t[e];i!==``&&r.append(gh(i)),e<t.length-1&&(r=u_(),n.append(r))}},a=0;for(let n of t)i(e.slice(a,n.offset)),r.append(new pC({source:n.source,ref:n.ref,label:n.label,...n.appearance===void 0?{}:{appearance:n.appearance},clipboardText:n.clipboardText},n.invalid===!0)),a=n.offset+n.length;i(e.slice(a)),n.selectEnd()},{discrete:!0,tag:Km})}clearHistory(){this.editor.dispatchCommand(im,void 0)}};function QO(e){switch(e){case`plain`:return`plain`;case`claimed`:return`claimed`;default:return`frozen`}}function $O(e,t){return e.clipboardText!==t.clipboardText||e.detectText!==t.detectText||e.occurrences.length!==t.occurrences.length||t.occurrences.some((t,n)=>{let r=e.occurrences[n];return r===void 0||r.occurrenceId!==t.occurrenceId||r.invalid!==t.invalid})}let ek=[],tk=/* @__PURE__ */ new Map;var nk=class{deps;state;notices=(0,f.createSnapshotStore)(null);get editor(){return this.draftEditor.editor}get isDisposed(){return this.disposed}actions={captureInsertion:e=>{let t=this.projection.detectText.length;return{...e===`end`?{start:t,end:t}:this.caretSpan(),draftRev:this.rev}},bindPrimaryAction:e=>(this.primaryAction=e,this.publish(),()=>{this.primaryAction===e&&(this.primaryAction=void 0,this.publish())}),insertText:(e,t)=>this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`||this.disposed||t.draftRev!==this.rev?!1:this.draftEditor.insertAsyncText(t,e),setDraft:e=>{this.setDraft(e)},persistDraft:()=>{this.persistCurrentDraft()},addAttachments:e=>this.addAttachments(e),removeAttachment:e=>{this.removeAttachment(e)},pruneAttachments:e=>{this.pruneAttachments(e)},addResponseAnnotation:(e,t)=>{let n=this.addResponseAnnotation(e);return n!==void 0&&t?.focus===`end`&&this.canInsertReferences()&&this.focus(`end`),n},updateResponseAnnotation:(e,t)=>{this.updateResponseAnnotation(e,t)},removeResponseAnnotation:e=>{this.removeResponseAnnotation(e)},clearResponseAnnotations:()=>{this.clearResponseAnnotations()},hoverResponseAnnotation:e=>{this.hoverResponseAnnotation(e)},submit:()=>{this.submit(`queue`)}};primaryAction;core=new ax;draftEditor;get projection(){return this.draftEditor.projection}rev=0;unregister;noticeSeq=0;lastPublishedDraft;draftSnapshotCache;attachmentIds=[];responseAnnotations=[];hoveredResponseAnnotationId;annotationSeq=0;submittedAnnotationAnchors=/* @__PURE__ */ new Map;adjudication;disposed=!1;persistDraft;persistDraftTimer;pendingPersistDraft;removeUnloadFlush;deferredTriggerTrack=!1;filePicker;detachedDrafts=/* @__PURE__ */ new Map;failedDetached=/* @__PURE__ */ new Map;failedRestoreRev;failedRestorePrefix;restoringFailures=!1;attachmentFlightSeq=0;attachmentFlights=/* @__PURE__ */ new Map;unsubscribeInbox;constructor(e){this.deps=e,this.draftEditor=new ZO({onUpdate:()=>{this.onEditorUpdate()},onCompositionEnd:()=>{this.onCompositionEnd()},openReference:(e,t)=>this.deps.inputTriggers?.()?.openReference(e,t)??!1,activeClaimToken:()=>this.activeClaimToken(),lexicon:()=>this.lexicon.getSnapshot(),resolveLexicon:()=>this.deps.inputTriggers?.()?.lexicon}),this.unregister=this.draftEditor.register(),this.state=(0,f.createSnapshotStore)(this.compose()),this.unsubscribeInbox=e.inbox?.subscribe(()=>{this.publish()})}onEditorUpdate(){$O(this.draftEditor.refreshProjection(),this.projection)&&(this.rev+=1,!this.restoringFailures&&this.failedRestoreRev!==void 0&&(this.failedDetached.clear(),this.failedRestorePrefix=void 0,this.failedRestoreRev=void 0),this.dispatchRun({type:`draft-changed`,draft:this.projection.clipboardText})),this.draftEditor.isComposing()?this.deferredTriggerTrack=!0:(this.deferredTriggerTrack=!1,this.trackCurrentTriggers())}onCompositionEnd(){this.disposed||(this.draftEditor.refreshProjection(),(this.deferredTriggerTrack||this.projection.caret!==null)&&(this.deferredTriggerTrack=!1,this.trackCurrentTriggers()))}trackCurrentTriggers(){let e=this.projection.caret;e!==null&&this.deps.inputTriggers?.()?.track(this.projection.detectText,e,{tier:QO(this.core.state.phase)},this.rev)}setDraft(e){let t=Uu(e);t.references.length===0?this.draftEditor.setDraft(t.text):this.draftEditor.restoreDraft(t.text,t.references)}refreshLexiconSubscription(){this.disposed||this.draftEditor.refreshLexiconSubscription()}get draftSnapshot(){if(this.draftSnapshotCache?.revision===this.rev)return this.draftSnapshotCache.value;let e=Gu(this.projection.clipboardText,this.projection.occurrences);return this.draftSnapshotCache={revision:this.rev,value:e},e}persistCurrentDraft(){let e=this.draftSnapshot;this.lastPublishedDraft=e,this.clearPersistTimer(),this.pendingPersistDraft=void 0,this.persistDraft?.(e)}flushDraftPersistence(){this.clearPersistTimer();let e=this.pendingPersistDraft;e!==void 0&&(this.pendingPersistDraft=void 0,this.persistDraft?.(e))}scheduleDraftPersistence(e){this.persistDraft!==void 0&&(this.pendingPersistDraft=e,this.persistDraftTimer!==void 0&&clearTimeout(this.persistDraftTimer),this.armUnloadFlush(),this.persistDraftTimer=setTimeout(()=>{this.persistDraftTimer=void 0,this.flushDraftPersistence()},180))}clearPersistTimer(){this.persistDraftTimer!==void 0&&(clearTimeout(this.persistDraftTimer),this.persistDraftTimer=void 0),this.disarmUnloadFlush()}armUnloadFlush(){if(this.removeUnloadFlush!==void 0||typeof window>`u`)return;let e=()=>{this.flushDraftPersistence()};window.addEventListener(`pagehide`,e),window.addEventListener(`beforeunload`,e),this.removeUnloadFlush=()=>{window.removeEventListener(`pagehide`,e),window.removeEventListener(`beforeunload`,e)}}disarmUnloadFlush(){this.removeUnloadFlush?.(),this.removeUnloadFlush=void 0}requestDraftInitialization(e){return this.draftInitializationBlocked()?`blocked`:e.prompt===void 0&&e.clearPreviousDraft!==!0||e.clearPreviousDraft!==!0&&(this.snapshot.draft!==``||this.attachmentIds.length>0)?`preserved`:(this.setDraft(e.prompt??``),`applied`)}draftInitializationBlocked(){let{phase:e}=this.core.state;return this.disposed||e===`adjudicating`||e===`submitting`||this.detachedDrafts.size>0||this.attachmentFlights.size>0}canInsertReferences(){let e=this.editor.getRootElement();return!this.disposed&&this.editor.isEditable()&&e!==null&&e.isConnected&&e.getClientRects().length>0&&(this.snapshot.phase===`plain`||this.snapshot.phase===`claimed`)}insertReferences(e,t){return!this.canInsertReferences()||t.draftRev!==this.rev?!1:this.draftEditor.insertFileReferences(e,t)}addAttachments(e){return this.disposed||this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`?!1:(e.length===0||(this.attachmentIds=[...this.attachmentIds,...e],this.publish()),!0)}addFiles(e,t){return this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`||!this.draftEditor.insertFileReferences(e)?!1:(this.attachmentIds=[...this.attachmentIds,...t],this.publish(),!0)}removeAttachment(e){if(this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`)return!1;let t=this.attachmentIds.filter(t=>t!==e);return t.length!==this.attachmentIds.length&&(this.attachmentIds=t,this.publish(),!0)}pruneAttachments(e){let t=new Set(e),n=this.attachmentIds.filter(e=>t.has(e));n.length!==this.attachmentIds.length&&(this.attachmentIds=n,this.publish())}addResponseAnnotation(e){if(this.disposed||this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`)return;this.annotationSeq+=1;let t=`response-annotation-${String(this.annotationSeq)}`;return this.responseAnnotations=[...this.responseAnnotations,{id:t,text:e.text.trim(),...e.annotation===void 0?{}:{annotation:e.annotation},...e.anchor===void 0?{}:{anchor:e.anchor}}],this.publish(),t}addResponseAnnotations(e){if(this.disposed||e.length===0||this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`)return[];let t=[],n=[];for(let r of e){this.annotationSeq+=1;let e=`response-annotation-${String(this.annotationSeq)}`;t.push(e),n.push({id:e,text:r.text.trim(),...r.annotation===void 0?{}:{annotation:r.annotation},...r.anchor===void 0?{}:{anchor:r.anchor}})}return this.responseAnnotations=[...this.responseAnnotations,...n],this.publish(),t}takeSubmittedAnnotationAnchors(e,t){if(e===void 0)return t;let n=this.submittedAnnotationAnchors.get(e);if(this.submittedAnnotationAnchors.delete(e),n===void 0||n.length!==t.length)return t;for(let e=0;e<t.length;e+=1)if(n[e]?.text!==t[e]?.text)return t;return t.map((e,t)=>{let r=n[t]?.anchor;return r===void 0?e:{...e,anchor:r}})}rememberSubmittedAnnotations(e,t){let n=t.map(e=>({text:e.text,...e.annotation===void 0?{}:{annotation:e.annotation},...e.anchor===void 0?{}:{anchor:e.anchor}}));for(this.submittedAnnotationAnchors.delete(e),this.submittedAnnotationAnchors.set(e,n);this.submittedAnnotationAnchors.size>32;){let e=this.submittedAnnotationAnchors.keys().next().value;if(e===void 0)break;this.submittedAnnotationAnchors.delete(e)}}updateResponseAnnotation(e,t){if(this.disposed||this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`)return!1;let n=t?.trim()??``,r,i=this.responseAnnotations.map(t=>{if(t.id!==e)return t;let i=n===``?void 0:n;return t.annotation===i?t:(r={id:t.id,text:t.text,...i===void 0?{}:{annotation:i},...t.anchor===void 0?{}:{anchor:t.anchor}},r)});return r!==void 0&&(this.responseAnnotations=i,this.syncFailedAnnotation(r),this.publish(),!0)}removeResponseAnnotation(e){if(this.disposed||this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`)return!1;let t=this.responseAnnotations.filter(t=>t.id!==e);return t.length!==this.responseAnnotations.length&&(this.responseAnnotations=t,this.hoveredResponseAnnotationId===e&&(this.hoveredResponseAnnotationId=void 0),this.forgetFailedAnnotation(e),this.publish(),!0)}clearResponseAnnotations(){if(this.disposed||this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`||this.responseAnnotations.length===0)return!1;let e=this.responseAnnotations;this.responseAnnotations=[],this.hoveredResponseAnnotationId=void 0;for(let t of e)this.forgetFailedAnnotation(t.id);return this.publish(),!0}hoverResponseAnnotation(e){if(this.disposed)return;let t=e!==null&&this.responseAnnotations.some(t=>t.id===e)?e:void 0;this.hoveredResponseAnnotationId!==t&&(this.hoveredResponseAnnotationId=t,this.state.set(this.compose()))}syncFailedAnnotation(e){let t=t=>{let n=!1,r=t.map(t=>t.id===e.id?(n=!0,e):t);return n?r:null};if(this.failedRestorePrefix!==void 0){let e=t(this.failedRestorePrefix.responseAnnotations);e!==null&&(this.failedRestorePrefix={...this.failedRestorePrefix,responseAnnotations:e})}for(let[e,n]of this.failedDetached){let r=t(n.responseAnnotations);r!==null&&this.failedDetached.set(e,{...n,responseAnnotations:r})}}forgetFailedAnnotation(e){this.failedRestorePrefix!==void 0&&(this.failedRestorePrefix={...this.failedRestorePrefix,responseAnnotations:this.failedRestorePrefix.responseAnnotations.filter(t=>t.id!==e)});for(let[t,n]of this.failedDetached){let r=n.responseAnnotations.filter(t=>t.id!==e);r.length!==n.responseAnnotations.length&&this.failedDetached.set(t,{...n,responseAnnotations:r})}}commitSend(e){let t=new Set(e);this.attachmentIds=this.attachmentIds.filter(e=>!t.has(e)),this.dispatchRun({type:`send-committed`})}paste(e){this.draftEditor.paste(e)}submit(e=`queue`,t){if(this.disposed)return;let n=Date.now(),r;if(this.snapshot.phase===`plain`&&(this.snapshot.draft.trim()!==``||this.attachmentIds.length>0||this.responseAnnotations.length>0))try{r=this.deps.submissionState?.()}catch{}let i=Object.freeze({timestamp:n,mode:e,...t===void 0?{}:{source:t},...r===void 0?{}:{state:r}});if(this.snapshot.draft.trim()===``&&this.attachmentIds.length>0&&this.responseAnnotations.length===0){if(this.snapshot.phase===`plain`){let t=[...this.attachmentIds],n=new AbortController;this.attachmentFlightSeq+=1;let r=this.attachmentFlightSeq;this.attachmentFlights.set(r,{controller:n,attachmentIds:t}),this.commitSend(t),this.notifySubmission(i),this.deps.defaultSink(``,t,e,n.signal).then(e=>{!this.disposed&&this.attachmentFlights.delete(r)&&e.kind!==`success`&&(this.restoreAttachments(t),e.text!==void 0&&this.notify(`error`,e.text))},e=>{!this.disposed&&this.attachmentFlights.delete(r)&&(this.restoreAttachments(t),this.notify(`error`,e instanceof Error?e.message:String(e)))})}return}let a=this.snapshot;if(a.phase===`claimed`&&this.attachmentIds.length>0&&a.claim?.attachments!==!0){this.notify(`error`,this.deps.commandAttachments.unsupportedNotice(a.claim?.token??a.draft));return}this.dispatchRun({type:`enter`,mode:e,draft:this.projection.clipboardText,annotated:this.responseAnnotations.length>0,submission:i});let o=this.snapshot.phase;(o===`adjudicating`||o===`submitting`)&&(this.deps.popup?.()?.dismiss(),this.deps.inputTriggers?.()?.track(this.projection.detectText,0,{tier:`frozen`},this.rev)),this.flushDraftPersistence()}arbitrate(e,t){return this.deps.inputTriggers?.()?.arbitrate(e,t)??`pass`}steerQueue(){this.deps.steerQueue?.()}space(){let e=this.deps.inputTriggers?.();return e!==void 0&&e.onSpace()}dismissPopup(){this.deps.popup?.()?.dismiss()}caretSpan(){return this.draftEditor.caretSpan()}lexicon={getSnapshot:()=>this.deps.inputTriggers?.()?.lexicon.getSnapshot()??tk,subscribe:e=>this.deps.inputTriggers?.()?.lexicon.subscribe(e)??(()=>{})};beginCommand(e,t){let n=this.core.state.phase;return n!==`plain`&&n!==`claimed`||t.draftRev!==this.rev||this.projection.detectText.slice(0,t.start).trim()!==``||!this.draftEditor.replaceText({start:0,end:t.end},e.token)?!1:(this.dispatchRun({type:`claim`,claim:e}),!0)}insertReference(e,t){let n=this.core.state.phase;if(n!==`plain`&&n!==`claimed`||t.draftRev!==this.rev)return!1;let r=this.projection.detectText.slice(t.end,t.end+1);return this.draftEditor.insertReference(t,e,r)}consumeToken(e){return e.kind===`span`?e.span.draftRev!==this.rev||e.span.start===e.span.end?!1:this.draftEditor.replaceText(e.span,``):e.token===``||this.projection.clipboardText.trim()!==e.token?!1:(this.setDraft(``),!0)}insertText(e,t,n=!1){return t.draftRev===this.rev&&this.draftEditor.replaceText(t,e)}notify(e,t){this.noticeSeq+=1,this.notices.set({level:e,text:t,seq:this.noticeSeq})}focus(e){this.editor.getRootElement()?.focus({preventScroll:!0}),e===`end`?this.editor.update(()=>{X_().selectEnd()},{discrete:!0}):this.editor.focus()}dispose(){if(this.disposed)return[];this.flushDraftPersistence(),this.persistDraft=void 0;let e=new Set(this.attachmentIds);for(let t of this.detachedDrafts.values())for(let n of t.attachmentIds)e.add(n);for(let t of this.attachmentFlights.values()){for(let n of t.attachmentIds)e.add(n);t.controller.abort()}return this.disposed=!0,this.dispatchRun({type:`release`}),this.unsubscribeInbox?.(),this.unregister(),this.detachedDrafts.clear(),this.failedDetached.clear(),this.failedRestorePrefix=void 0,this.hoveredResponseAnnotationId=void 0,this.submittedAnnotationAnchors.clear(),this.attachmentFlights.clear(),[...e]}get snapshot(){return this.state.getSnapshot()}bindDraftPersistence(e){return this.persistDraft=e,()=>{this.persistDraft===e&&(this.flushDraftPersistence(),this.persistDraft=void 0)}}bindFilePicker(e){return this.filePicker=e,()=>{this.filePicker===e&&(this.filePicker=void 0)}}canPickFiles(){return this.filePicker?.available()===!0}pickFiles(){return this.filePicker===void 0||!this.filePicker.available()?!1:(this.filePicker.open(),!0)}activeClaimToken(){let e=this.core.state;return(e.phase===`claimed`||e.phase===`submitting`)&&e.claim!==void 0?e.claim.token:null}dispatchRun(e){let t=this.activeClaimToken(),n=this.core.dispatch(e);this.run(n),this.activeClaimToken()!==t&&this.draftEditor.refreshClaimDecoration()}run(e){for(let t of e)this.execute(t);this.publish()}execute(e){switch(e.type){case`notice`:this.noticeSeq+=1,this.notices.set({level:e.level,text:e.text,seq:this.noticeSeq});return;case`adjudicate`:this.adjudicate(e.attempt,e.draft);return;case`begin-submit`:this.beginSubmit(e.attempt,e.claim,e.args);return;case`default-sink`:this.sinkSerialized(e.attempt,e.draft,e.mode);return;case`commit-draft`:this.commitDraft(e.retainSuffixOf);return}}commitDraft(e){this.draftEditor.clearCommittedDraft(t=>e!==null&&t!==e&&t.startsWith(e)?e.length:null),this.draftEditor.clearHistory(),this.flushDraftPersistence()}sinkSerialized(e,t,n){this.notifySubmission(e.submission);let r=[...this.attachmentIds];this.attachmentIds=[];let i=[...this.responseAnnotations];this.responseAnnotations=[],this.hoveredResponseAnnotationId=void 0;let a=this.projection.occurrences,o={draft:t,occurrences:a,attachmentIds:r,responseAnnotations:i};this.detachedDrafts.set(e.seq,o),this.failedRestoreRev===this.rev&&(this.failedDetached.clear(),this.failedRestorePrefix=void 0,this.failedRestoreRev=void 0);let s=i.some(e=>e.anchor!==void 0)?e=>{this.rememberSubmittedAnnotations(e,i)}:void 0,c=t=>this.deps.defaultSink(vO(i,t.trim()),r,n,e.signal,s);if(a.length===0){this.settleSink(e,c(t));return}let l=this.deps.inputTriggers?.();Promise.all(a.map(async t=>{if(l===void 0)throw Error(`no serializer for reference source "${t.source}"`);return{offset:t.offset,length:t.length,text:await l.serializeReference(t.source,t.ref,e.signal)}})).then(n=>{if(this.disposed)return;let r=``,i=0;for(let e of n)r+=t.slice(i,e.offset)+e.text,i=e.offset+e.length;r+=t.slice(i),this.settleSink(e,c(r))},t=>{if(this.dead(e))return;let n=t instanceof Error?t.message:String(t);this.settleDetachedFailure(e,n)})}notifySubmission(e){if(e!==void 0)try{this.deps.messageSubmitted?.(e)}catch{}}settleSink(e,t){t.then(t=>{this.dead(e)||(t.kind===`success`?(this.detachedDrafts.delete(e.seq),this.dispatchRun({type:`sink-settled`,attempt:e,ok:!0,outcome:t})):this.settleDetachedFailure(e,t.text))},t=>{this.dead(e)||this.settleDetachedFailure(e,t instanceof Error?t.message:String(t))})}settleDetachedFailure(e,t){if(this.adjudication!==void 0){let n=()=>{this.dead(e)||this.settleDetachedFailure(e,t)};this.adjudication.then(n,n);return}let n=this.detachedDrafts.get(e.seq);if(n===void 0)return;this.detachedDrafts.delete(e.seq),this.restoreAttachments(n.attachmentIds);let r=n.draft!==``||n.responseAnnotations.length>0||this.failedRestorePrefix!==void 0,i=this.projection.clipboardText;i!==``&&this.failedRestoreRev!==this.rev&&r&&(this.failedDetached.clear(),this.failedRestorePrefix={draft:i,occurrences:this.projection.occurrences,responseAnnotations:[]}),(n.draft!==``||n.responseAnnotations.length>0)&&this.failedDetached.set(e.seq,n),this.restoreFailedDrafts(),this.dispatchRun({type:`sink-settled`,attempt:e,ok:!1,...t===void 0?{}:{message:t}})}restoreFailedDrafts(){let e=[...this.failedRestorePrefix===void 0?[]:[this.failedRestorePrefix],...[...this.failedDetached.entries()].sort(([e],[t])=>e-t).map(([,e])=>e)];if(e.length===0)return;let t=``,n=[],r=[];for(let i of e){if(r.push(...i.responseAnnotations),i.draft===``)continue;let e=t.length+(t===``?0:2);t!==``&&(t+=`
161
+ `)?n.insertRawText(e):n.insertText(e)}return!0}function ZO(e,t){let n=YO(WO(),e);return n!==null&&(n.insertNodes([...t]),!0)}let QO=/[\uE100-\uE11D\uFFFC]/gu;var $O=class{deps;editor;projected={detectText:``,clipboardText:``,occurrences:[],selection:null,caret:null};occurrenceIds=/* @__PURE__ */ new Map;occurrenceSeq=0;lexiconOff;lexiconSource;domComposing=!1;constructor(e){this.deps=e,this.editor=g_({namespace:`dsh-composer`,nodes:[pC,TC],onError:e=>{throw e}}),this.editor.update(()=>{let e=X_();e.getChildrenSize()===0&&e.append(u_())},{discrete:!0,tag:Jm})}register(){let e=()=>{let e=this.editor.getRootElement();return e!==null&&!e.contains(e.ownerDocument.activeElement)&&xv(Jm),!1},t=()=>{this.domComposing=!0},n=()=>{this.domComposing=!1,this.deps.onCompositionEnd?.()},r=tx(qS(this.editor),this.editor.registerRootListener((e,r)=>{r?.removeEventListener(`compositionstart`,t),r?.removeEventListener(`compositionend`,n),this.domComposing=!1,e?.addEventListener(`compositionstart`,t),e?.addEventListener(`compositionend`,n)}),this.editor.registerCommand(Qp,e=>!this.editor.isEditable()||!e.dataTransfer?.types.includes(`application/x-codexhost-thread-reference`)||e.dataTransfer.types.includes(`Files`)?!1:(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,!0),4),this.editor.registerCommand(Xp,e=>{if(!this.editor.isEditable()||!e.dataTransfer||e.dataTransfer.types.includes(`Files`))return!1;let t=aC(e.dataTransfer.getData($S));return t!==void 0&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,this.insertFileReferences([iC(t)]))},4),this.editor.registerCommand(cm,()=>(this.editor.update(e,{discrete:!0}),!1),4),this.editor.registerCommand(bp,e,4),this.editor.registerNodeTransform(qg,e),OC(this.editor,(e,t)=>this.deps.openReference(e,t)),ZS(this.editor,QS(),1e3),this.editor.registerUpdateListener(()=>{this.deps.onUpdate()}),zO(this.editor),HO(this.editor,()=>this.deps.activeClaimToken()),EC(this.editor,()=>this.deps.lexicon(),()=>this.deps.activeClaimToken()),()=>{this.lexiconOff?.(),this.lexiconOff=void 0,this.lexiconSource=void 0});return()=>{r(),this.editor.setRootElement(null)}}get projection(){return this.projected}isComposing(){return this.domComposing||this.editor.isComposing()}applyEdit(e,t){this.editor._updating?(t!==void 0&&xv(t),e()):this.editor.update(e,{discrete:!0,...t===void 0?{}:{tag:t}})}refreshLexiconSubscription(){let e=this.deps.resolveLexicon();e!==this.lexiconSource&&(this.lexiconOff?.(),this.lexiconSource=e,this.lexiconOff=e?.subscribe(()=>{DC(this.editor)}),DC(this.editor))}refreshProjection(){let e=this.projected;return this.projected=this.editor.getEditorState().read(()=>qO(e=>this.occurrenceIdOf(e))),e}occurrenceIdOf(e){let t=this.occurrenceIds.get(e);return t===void 0?(this.occurrenceSeq+=1,this.occurrenceIds.set(e,this.occurrenceSeq),this.occurrenceSeq):t}setDraft(e){let t=e.replace(QO,``);(t!==this.projection.clipboardText||this.projection.occurrences.length!==0)&&this.editor.update(()=>{let e=X_();e.clear();for(let n of t.split(`
162
+ `)){let t=u_();n!==``&&t.append(gh(n)),e.append(t)}e.selectEnd()},{discrete:!0,tag:Km})}paste(e){let t=e.replace(QO,``).replace(/\r\n?/gu,`
163
+ `);t!==``&&this.applyEdit(()=>{let e=V();if(B(e)){e.insertRawText(t);return}let n=X_();n.getChildrenSize()===0&&n.append(u_()),n.selectEnd().insertRawText(t)},qm)}caretSpan(){if(this.projection.selection!==null)return this.projection.selection;let e=this.projection.detectText.length;return{start:e,end:e}}replaceText(e,t){let n=!1;return this.applyEdit(()=>{n=XO(e,t)}),n}insertAsyncText(e,t){let n=!1,r=t.replace(QO,``);return this.applyEdit(()=>{n=XO(e,r)},qm),n}insertReference(e,t,n){let r=!1;return this.applyEdit(()=>{r=ZO(e,n===` `?[mC(t)]:[mC(t),gh(` `)])}),r}insertFileReferences(e,t){if(e.length===0)return!0;let n=!1;return this.applyEdit(()=>{let r=qO(e=>this.occurrenceIdOf(e)),i=t?.end??r.selection?.end??r.detectText.length,a=r.detectText.slice(0,i),o=e.flatMap(e=>[mC(e),gh(` `)]);a!==``&&!/\s$/u.test(a)&&o.unshift(gh(` `)),n=ZO({start:i,end:i},o)},qm),n}refreshClaimDecoration(){UO(this.editor)}clearCommittedDraft(e){this.editor.update(()=>{let t=WO(),n=e(t.clipboardText);if(n!==null){XO({start:0,end:GO(t,n)},``);return}let r=X_();r.clear(),r.append(u_()),r.selectEnd()},{discrete:!0,tag:Km})}restoreDraft(e,t){this.editor.update(()=>{let n=X_();n.clear();let r=u_();n.append(r);let i=e=>{let t=e.replace(QO,``).split(`
164
+ `);for(let e=0;e<t.length;e+=1){let i=t[e];i!==``&&r.append(gh(i)),e<t.length-1&&(r=u_(),n.append(r))}},a=0;for(let n of t)i(e.slice(a,n.offset)),r.append(new pC({source:n.source,ref:n.ref,label:n.label,...n.appearance===void 0?{}:{appearance:n.appearance},clipboardText:n.clipboardText},n.invalid===!0)),a=n.offset+n.length;i(e.slice(a)),n.selectEnd()},{discrete:!0,tag:Km})}clearHistory(){this.editor.dispatchCommand(im,void 0)}};function ek(e){switch(e){case`plain`:return`plain`;case`claimed`:return`claimed`;default:return`frozen`}}function tk(e,t){return e.clipboardText!==t.clipboardText||e.detectText!==t.detectText||e.occurrences.length!==t.occurrences.length||t.occurrences.some((t,n)=>{let r=e.occurrences[n];return r===void 0||r.occurrenceId!==t.occurrenceId||r.invalid!==t.invalid})}let nk=[],rk=/* @__PURE__ */ new Map;var ik=class{deps;state;notices=(0,f.createSnapshotStore)(null);get editor(){return this.draftEditor.editor}get isDisposed(){return this.disposed}actions={captureInsertion:e=>{let t=this.projection.detectText.length;return{...e===`end`?{start:t,end:t}:this.caretSpan(),draftRev:this.rev}},bindPrimaryAction:e=>(this.primaryAction=e,this.publish(),()=>{this.primaryAction===e&&(this.primaryAction=void 0,this.publish())}),insertText:(e,t)=>this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`||this.disposed||t.draftRev!==this.rev?!1:this.draftEditor.insertAsyncText(t,e),setDraft:e=>{this.setDraft(e)},persistDraft:()=>{this.persistCurrentDraft()},addAttachments:e=>this.addAttachments(e),removeAttachment:e=>{this.removeAttachment(e)},pruneAttachments:e=>{this.pruneAttachments(e)},addResponseAnnotation:(e,t)=>{let n=this.addResponseAnnotation(e);return n!==void 0&&t?.focus===`end`&&this.canInsertReferences()&&this.focus(`end`),n},updateResponseAnnotation:(e,t)=>{this.updateResponseAnnotation(e,t)},removeResponseAnnotation:e=>{this.removeResponseAnnotation(e)},clearResponseAnnotations:()=>{this.clearResponseAnnotations()},hoverResponseAnnotation:e=>{this.hoverResponseAnnotation(e)},submit:()=>{this.submit(`queue`)}};primaryAction;core=new ax;draftEditor;get projection(){return this.draftEditor.projection}rev=0;unregister;noticeSeq=0;lastPublishedDraft;draftSnapshotCache;attachmentIds=[];responseAnnotations=[];hoveredResponseAnnotationId;annotationSeq=0;submittedAnnotationAnchors=/* @__PURE__ */ new Map;adjudication;disposed=!1;persistDraft;persistDraftTimer;pendingPersistDraft;removeUnloadFlush;deferredTriggerTrack=!1;filePicker;detachedDrafts=/* @__PURE__ */ new Map;failedDetached=/* @__PURE__ */ new Map;failedRestoreRev;failedRestorePrefix;restoringFailures=!1;attachmentFlightSeq=0;attachmentFlights=/* @__PURE__ */ new Map;unsubscribeInbox;constructor(e){this.deps=e,this.draftEditor=new $O({onUpdate:()=>{this.onEditorUpdate()},onCompositionEnd:()=>{this.onCompositionEnd()},openReference:(e,t)=>this.deps.inputTriggers?.()?.openReference(e,t)??!1,activeClaimToken:()=>this.activeClaimToken(),lexicon:()=>this.lexicon.getSnapshot(),resolveLexicon:()=>this.deps.inputTriggers?.()?.lexicon}),this.unregister=this.draftEditor.register(),this.state=(0,f.createSnapshotStore)(this.compose()),this.unsubscribeInbox=e.inbox?.subscribe(()=>{this.publish()})}onEditorUpdate(){tk(this.draftEditor.refreshProjection(),this.projection)&&(this.rev+=1,!this.restoringFailures&&this.failedRestoreRev!==void 0&&(this.failedDetached.clear(),this.failedRestorePrefix=void 0,this.failedRestoreRev=void 0),this.dispatchRun({type:`draft-changed`,draft:this.projection.clipboardText})),this.draftEditor.isComposing()?this.deferredTriggerTrack=!0:(this.deferredTriggerTrack=!1,this.trackCurrentTriggers())}onCompositionEnd(){this.disposed||(this.draftEditor.refreshProjection(),(this.deferredTriggerTrack||this.projection.caret!==null)&&(this.deferredTriggerTrack=!1,this.trackCurrentTriggers()))}trackCurrentTriggers(){let e=this.projection.caret;e!==null&&this.deps.inputTriggers?.()?.track(this.projection.detectText,e,{tier:ek(this.core.state.phase)},this.rev)}setDraft(e){let t=Uu(e);t.references.length===0?this.draftEditor.setDraft(t.text):this.draftEditor.restoreDraft(t.text,t.references)}refreshLexiconSubscription(){this.disposed||this.draftEditor.refreshLexiconSubscription()}get draftSnapshot(){if(this.draftSnapshotCache?.revision===this.rev)return this.draftSnapshotCache.value;let e=Gu(this.projection.clipboardText,this.projection.occurrences);return this.draftSnapshotCache={revision:this.rev,value:e},e}persistCurrentDraft(){let e=this.draftSnapshot;this.lastPublishedDraft=e,this.clearPersistTimer(),this.pendingPersistDraft=void 0,this.persistDraft?.(e)}flushDraftPersistence(){this.clearPersistTimer();let e=this.pendingPersistDraft;e!==void 0&&(this.pendingPersistDraft=void 0,this.persistDraft?.(e))}scheduleDraftPersistence(e){this.persistDraft!==void 0&&(this.pendingPersistDraft=e,this.persistDraftTimer!==void 0&&clearTimeout(this.persistDraftTimer),this.armUnloadFlush(),this.persistDraftTimer=setTimeout(()=>{this.persistDraftTimer=void 0,this.flushDraftPersistence()},180))}clearPersistTimer(){this.persistDraftTimer!==void 0&&(clearTimeout(this.persistDraftTimer),this.persistDraftTimer=void 0),this.disarmUnloadFlush()}armUnloadFlush(){if(this.removeUnloadFlush!==void 0||typeof window>`u`)return;let e=()=>{this.flushDraftPersistence()};window.addEventListener(`pagehide`,e),window.addEventListener(`beforeunload`,e),this.removeUnloadFlush=()=>{window.removeEventListener(`pagehide`,e),window.removeEventListener(`beforeunload`,e)}}disarmUnloadFlush(){this.removeUnloadFlush?.(),this.removeUnloadFlush=void 0}requestDraftInitialization(e){return this.draftInitializationBlocked()?`blocked`:e.prompt===void 0&&e.clearPreviousDraft!==!0||e.clearPreviousDraft!==!0&&(this.snapshot.draft!==``||this.attachmentIds.length>0)?`preserved`:(this.setDraft(e.prompt??``),`applied`)}draftInitializationBlocked(){let{phase:e}=this.core.state;return this.disposed||e===`adjudicating`||e===`submitting`||this.detachedDrafts.size>0||this.attachmentFlights.size>0}canInsertReferences(){let e=this.editor.getRootElement();return!this.disposed&&this.editor.isEditable()&&e!==null&&e.isConnected&&e.getClientRects().length>0&&(this.snapshot.phase===`plain`||this.snapshot.phase===`claimed`)}insertReferences(e,t){return!this.canInsertReferences()||t.draftRev!==this.rev?!1:this.draftEditor.insertFileReferences(e,t)}addAttachments(e){return this.disposed||this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`?!1:(e.length===0||(this.attachmentIds=[...this.attachmentIds,...e],this.publish()),!0)}addFiles(e,t){return this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`||!this.draftEditor.insertFileReferences(e)?!1:(this.attachmentIds=[...this.attachmentIds,...t],this.publish(),!0)}removeAttachment(e){if(this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`)return!1;let t=this.attachmentIds.filter(t=>t!==e);return t.length!==this.attachmentIds.length&&(this.attachmentIds=t,this.publish(),!0)}pruneAttachments(e){let t=new Set(e),n=this.attachmentIds.filter(e=>t.has(e));n.length!==this.attachmentIds.length&&(this.attachmentIds=n,this.publish())}addResponseAnnotation(e){if(this.disposed||this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`)return;this.annotationSeq+=1;let t=`response-annotation-${String(this.annotationSeq)}`;return this.responseAnnotations=[...this.responseAnnotations,{id:t,text:e.text.trim(),...e.annotation===void 0?{}:{annotation:e.annotation},...e.anchor===void 0?{}:{anchor:e.anchor}}],this.publish(),t}addResponseAnnotations(e){if(this.disposed||e.length===0||this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`)return[];let t=[],n=[];for(let r of e){this.annotationSeq+=1;let e=`response-annotation-${String(this.annotationSeq)}`;t.push(e),n.push({id:e,text:r.text.trim(),...r.annotation===void 0?{}:{annotation:r.annotation},...r.anchor===void 0?{}:{anchor:r.anchor}})}return this.responseAnnotations=[...this.responseAnnotations,...n],this.publish(),t}takeSubmittedAnnotationAnchors(e,t){if(e===void 0)return t;let n=this.submittedAnnotationAnchors.get(e);if(this.submittedAnnotationAnchors.delete(e),n===void 0||n.length!==t.length)return t;for(let e=0;e<t.length;e+=1)if(n[e]?.text!==t[e]?.text)return t;return t.map((e,t)=>{let r=n[t]?.anchor;return r===void 0?e:{...e,anchor:r}})}rememberSubmittedAnnotations(e,t){let n=t.map(e=>({text:e.text,...e.annotation===void 0?{}:{annotation:e.annotation},...e.anchor===void 0?{}:{anchor:e.anchor}}));for(this.submittedAnnotationAnchors.delete(e),this.submittedAnnotationAnchors.set(e,n);this.submittedAnnotationAnchors.size>32;){let e=this.submittedAnnotationAnchors.keys().next().value;if(e===void 0)break;this.submittedAnnotationAnchors.delete(e)}}updateResponseAnnotation(e,t){if(this.disposed||this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`)return!1;let n=t?.trim()??``,r,i=this.responseAnnotations.map(t=>{if(t.id!==e)return t;let i=n===``?void 0:n;return t.annotation===i?t:(r={id:t.id,text:t.text,...i===void 0?{}:{annotation:i},...t.anchor===void 0?{}:{anchor:t.anchor}},r)});return r!==void 0&&(this.responseAnnotations=i,this.syncFailedAnnotation(r),this.publish(),!0)}removeResponseAnnotation(e){if(this.disposed||this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`)return!1;let t=this.responseAnnotations.filter(t=>t.id!==e);return t.length!==this.responseAnnotations.length&&(this.responseAnnotations=t,this.hoveredResponseAnnotationId===e&&(this.hoveredResponseAnnotationId=void 0),this.forgetFailedAnnotation(e),this.publish(),!0)}clearResponseAnnotations(){if(this.disposed||this.snapshot.phase===`adjudicating`||this.snapshot.phase===`submitting`||this.responseAnnotations.length===0)return!1;let e=this.responseAnnotations;this.responseAnnotations=[],this.hoveredResponseAnnotationId=void 0;for(let t of e)this.forgetFailedAnnotation(t.id);return this.publish(),!0}hoverResponseAnnotation(e){if(this.disposed)return;let t=e!==null&&this.responseAnnotations.some(t=>t.id===e)?e:void 0;this.hoveredResponseAnnotationId!==t&&(this.hoveredResponseAnnotationId=t,this.state.set(this.compose()))}syncFailedAnnotation(e){let t=t=>{let n=!1,r=t.map(t=>t.id===e.id?(n=!0,e):t);return n?r:null};if(this.failedRestorePrefix!==void 0){let e=t(this.failedRestorePrefix.responseAnnotations);e!==null&&(this.failedRestorePrefix={...this.failedRestorePrefix,responseAnnotations:e})}for(let[e,n]of this.failedDetached){let r=t(n.responseAnnotations);r!==null&&this.failedDetached.set(e,{...n,responseAnnotations:r})}}forgetFailedAnnotation(e){this.failedRestorePrefix!==void 0&&(this.failedRestorePrefix={...this.failedRestorePrefix,responseAnnotations:this.failedRestorePrefix.responseAnnotations.filter(t=>t.id!==e)});for(let[t,n]of this.failedDetached){let r=n.responseAnnotations.filter(t=>t.id!==e);r.length!==n.responseAnnotations.length&&this.failedDetached.set(t,{...n,responseAnnotations:r})}}commitSend(e){let t=new Set(e);this.attachmentIds=this.attachmentIds.filter(e=>!t.has(e)),this.dispatchRun({type:`send-committed`})}paste(e){this.draftEditor.paste(e)}submit(e=`queue`,t){if(this.disposed)return;let n=Date.now(),r;if(this.snapshot.phase===`plain`&&(this.snapshot.draft.trim()!==``||this.attachmentIds.length>0||this.responseAnnotations.length>0))try{r=this.deps.submissionState?.()}catch{}let i=Object.freeze({timestamp:n,mode:e,...t===void 0?{}:{source:t},...r===void 0?{}:{state:r}});if(this.snapshot.draft.trim()===``&&this.attachmentIds.length>0&&this.responseAnnotations.length===0){if(this.snapshot.phase===`plain`){let t=[...this.attachmentIds],n=new AbortController;this.attachmentFlightSeq+=1;let r=this.attachmentFlightSeq;this.attachmentFlights.set(r,{controller:n,attachmentIds:t}),this.commitSend(t),this.notifySubmission(i),this.deps.defaultSink(``,t,e,n.signal).then(e=>{!this.disposed&&this.attachmentFlights.delete(r)&&e.kind!==`success`&&(this.restoreAttachments(t),e.text!==void 0&&this.notify(`error`,e.text))},e=>{!this.disposed&&this.attachmentFlights.delete(r)&&(this.restoreAttachments(t),this.notify(`error`,e instanceof Error?e.message:String(e)))})}return}let a=this.snapshot;if(a.phase===`claimed`&&this.attachmentIds.length>0&&a.claim?.attachments!==!0){this.notify(`error`,this.deps.commandAttachments.unsupportedNotice(a.claim?.token??a.draft));return}this.dispatchRun({type:`enter`,mode:e,draft:this.projection.clipboardText,annotated:this.responseAnnotations.length>0,submission:i});let o=this.snapshot.phase;(o===`adjudicating`||o===`submitting`)&&(this.deps.popup?.()?.dismiss(),this.deps.inputTriggers?.()?.track(this.projection.detectText,0,{tier:`frozen`},this.rev)),this.flushDraftPersistence()}arbitrate(e,t){return this.deps.inputTriggers?.()?.arbitrate(e,t)??`pass`}steerQueue(){this.deps.steerQueue?.()}space(){let e=this.deps.inputTriggers?.();return e!==void 0&&e.onSpace()}dismissPopup(){this.deps.popup?.()?.dismiss()}caretSpan(){return this.draftEditor.caretSpan()}lexicon={getSnapshot:()=>this.deps.inputTriggers?.()?.lexicon.getSnapshot()??rk,subscribe:e=>this.deps.inputTriggers?.()?.lexicon.subscribe(e)??(()=>{})};beginCommand(e,t){let n=this.core.state.phase;return n!==`plain`&&n!==`claimed`||t.draftRev!==this.rev||this.projection.detectText.slice(0,t.start).trim()!==``||!this.draftEditor.replaceText({start:0,end:t.end},e.token)?!1:(this.dispatchRun({type:`claim`,claim:e}),!0)}insertReference(e,t){let n=this.core.state.phase;if(n!==`plain`&&n!==`claimed`||t.draftRev!==this.rev)return!1;let r=this.projection.detectText.slice(t.end,t.end+1);return this.draftEditor.insertReference(t,e,r)}consumeToken(e){return e.kind===`span`?e.span.draftRev!==this.rev||e.span.start===e.span.end?!1:this.draftEditor.replaceText(e.span,``):e.token===``||this.projection.clipboardText.trim()!==e.token?!1:(this.setDraft(``),!0)}insertText(e,t,n=!1){return t.draftRev===this.rev&&this.draftEditor.replaceText(t,e)}notify(e,t){this.noticeSeq+=1,this.notices.set({level:e,text:t,seq:this.noticeSeq})}focus(e){this.editor.getRootElement()?.focus({preventScroll:!0}),e===`end`?this.editor.update(()=>{X_().selectEnd()},{discrete:!0}):this.editor.focus()}dispose(){if(this.disposed)return[];this.flushDraftPersistence(),this.persistDraft=void 0;let e=new Set(this.attachmentIds);for(let t of this.detachedDrafts.values())for(let n of t.attachmentIds)e.add(n);for(let t of this.attachmentFlights.values()){for(let n of t.attachmentIds)e.add(n);t.controller.abort()}return this.disposed=!0,this.dispatchRun({type:`release`}),this.unsubscribeInbox?.(),this.unregister(),this.detachedDrafts.clear(),this.failedDetached.clear(),this.failedRestorePrefix=void 0,this.hoveredResponseAnnotationId=void 0,this.submittedAnnotationAnchors.clear(),this.attachmentFlights.clear(),[...e]}get snapshot(){return this.state.getSnapshot()}bindDraftPersistence(e){return this.persistDraft=e,()=>{this.persistDraft===e&&(this.flushDraftPersistence(),this.persistDraft=void 0)}}bindFilePicker(e){return this.filePicker=e,()=>{this.filePicker===e&&(this.filePicker=void 0)}}canPickFiles(){return this.filePicker?.available()===!0}pickFiles(){return this.filePicker===void 0||!this.filePicker.available()?!1:(this.filePicker.open(),!0)}activeClaimToken(){let e=this.core.state;return(e.phase===`claimed`||e.phase===`submitting`)&&e.claim!==void 0?e.claim.token:null}dispatchRun(e){let t=this.activeClaimToken(),n=this.core.dispatch(e);this.run(n),this.activeClaimToken()!==t&&this.draftEditor.refreshClaimDecoration()}run(e){for(let t of e)this.execute(t);this.publish()}execute(e){switch(e.type){case`notice`:this.noticeSeq+=1,this.notices.set({level:e.level,text:e.text,seq:this.noticeSeq});return;case`adjudicate`:this.adjudicate(e.attempt,e.draft);return;case`begin-submit`:this.beginSubmit(e.attempt,e.claim,e.args);return;case`default-sink`:this.sinkSerialized(e.attempt,e.draft,e.mode);return;case`commit-draft`:this.commitDraft(e.retainSuffixOf);return}}commitDraft(e){this.draftEditor.clearCommittedDraft(t=>e!==null&&t!==e&&t.startsWith(e)?e.length:null),this.draftEditor.clearHistory(),this.flushDraftPersistence()}sinkSerialized(e,t,n){this.notifySubmission(e.submission);let r=[...this.attachmentIds];this.attachmentIds=[];let i=[...this.responseAnnotations];this.responseAnnotations=[],this.hoveredResponseAnnotationId=void 0;let a=this.projection.occurrences,o={draft:t,occurrences:a,attachmentIds:r,responseAnnotations:i};this.detachedDrafts.set(e.seq,o),this.failedRestoreRev===this.rev&&(this.failedDetached.clear(),this.failedRestorePrefix=void 0,this.failedRestoreRev=void 0);let s=i.some(e=>e.anchor!==void 0)?e=>{this.rememberSubmittedAnnotations(e,i)}:void 0,c=t=>this.deps.defaultSink(bO(i,t.trim()),r,n,e.signal,s);if(a.length===0){this.settleSink(e,c(t));return}let l=this.deps.inputTriggers?.();Promise.all(a.map(async t=>{if(l===void 0)throw Error(`no serializer for reference source "${t.source}"`);return{offset:t.offset,length:t.length,text:await l.serializeReference(t.source,t.ref,e.signal)}})).then(n=>{if(this.disposed)return;let r=``,i=0;for(let e of n)r+=t.slice(i,e.offset)+e.text,i=e.offset+e.length;r+=t.slice(i),this.settleSink(e,c(r))},t=>{if(this.dead(e))return;let n=t instanceof Error?t.message:String(t);this.settleDetachedFailure(e,n)})}notifySubmission(e){if(e!==void 0)try{this.deps.messageSubmitted?.(e)}catch{}}settleSink(e,t){t.then(t=>{this.dead(e)||(t.kind===`success`?(this.detachedDrafts.delete(e.seq),this.dispatchRun({type:`sink-settled`,attempt:e,ok:!0,outcome:t})):this.settleDetachedFailure(e,t.text))},t=>{this.dead(e)||this.settleDetachedFailure(e,t instanceof Error?t.message:String(t))})}settleDetachedFailure(e,t){if(this.adjudication!==void 0){let n=()=>{this.dead(e)||this.settleDetachedFailure(e,t)};this.adjudication.then(n,n);return}let n=this.detachedDrafts.get(e.seq);if(n===void 0)return;this.detachedDrafts.delete(e.seq),this.restoreAttachments(n.attachmentIds);let r=n.draft!==``||n.responseAnnotations.length>0||this.failedRestorePrefix!==void 0,i=this.projection.clipboardText;i!==``&&this.failedRestoreRev!==this.rev&&r&&(this.failedDetached.clear(),this.failedRestorePrefix={draft:i,occurrences:this.projection.occurrences,responseAnnotations:[]}),(n.draft!==``||n.responseAnnotations.length>0)&&this.failedDetached.set(e.seq,n),this.restoreFailedDrafts(),this.dispatchRun({type:`sink-settled`,attempt:e,ok:!1,...t===void 0?{}:{message:t}})}restoreFailedDrafts(){let e=[...this.failedRestorePrefix===void 0?[]:[this.failedRestorePrefix],...[...this.failedDetached.entries()].sort(([e],[t])=>e-t).map(([,e])=>e)];if(e.length===0)return;let t=``,n=[],r=[];for(let i of e){if(r.push(...i.responseAnnotations),i.draft===``)continue;let e=t.length+(t===``?0:2);t!==``&&(t+=`
165
165
 
166
- `),t+=i.draft;for(let t of i.occurrences)n.push({...t,offset:e+t.offset})}let i=new Set(r.map(e=>e.id));this.responseAnnotations=[...r,...this.responseAnnotations.filter(e=>!i.has(e.id))],this.restoringFailures=!0;try{this.draftEditor.restoreDraft(t,n),this.draftEditor.clearHistory(),this.failedRestoreRev=this.rev}finally{this.restoringFailures=!1}this.publish()}restoreAttachments(e){if(e.length===0)return;let t=new Set(this.attachmentIds),n=e.filter(e=>!t.has(e));n.length!==0&&(this.attachmentIds=[...n,...this.attachmentIds],this.publish())}adjudicate(e,t){let n=this.deps.inputTriggers?.();n===void 0?this.dispatchRun({type:`adjudicated`,attempt:e,outcome:void 0}):(this.adjudication=n.adjudicate(t.trim(),e.signal,{attachments:this.attachmentIds.length}),this.adjudication.then(t=>{this.adjudication=void 0,!this.dead(e)&&this.dispatchRun({type:`adjudicated`,attempt:e,outcome:t})},t=>{if(this.adjudication=void 0,this.dead(e))return;let n=t instanceof Error?t.message:String(t);this.dispatchRun({type:`adjudication-failed`,attempt:e,message:n})}))}beginSubmit(e,t,n){let r=t.attachments===!0?[...this.attachmentIds]:[];Promise.resolve().then(async()=>{let i=r.length>0?await this.deps.commandAttachments.serialize(r):[];if(!this.dead(e))return t.submit(n,this.deps.actx,i)}).then(t=>{if(!(t===void 0||this.dead(e))){if(t.kind===`success`&&r.length>0){let e=new Set(r);this.attachmentIds=this.attachmentIds.filter(t=>!e.has(t)),this.deps.commandAttachments.release(r)}this.dispatchRun({type:`submit-settled`,attempt:e,ok:t.kind===`success`,draft:this.projection.clipboardText,outcome:t,...t.kind===`error`&&t.text===void 0?{message:`command failed`}:{}})}},t=>{if(this.dead(e))return;let n=t instanceof Error?t.message:String(t);this.dispatchRun({type:`submit-settled`,attempt:e,ok:!1,draft:this.projection.clipboardText,message:n})})}dead(e){return this.disposed||e.signal.aborted}compose(){let e=this.core.state;return{draft:this.projection.clipboardText,attachmentIds:this.attachmentIds,responseAnnotations:this.responseAnnotations,...this.hoveredResponseAnnotationId===void 0?{}:{hoveredResponseAnnotationId:this.hoveredResponseAnnotationId},draftRev:this.rev,...this.primaryAction===void 0?{}:{primaryAction:this.primaryAction},phase:e.phase,...e.claim===void 0?{}:{claim:e.claim},occurrences:this.projection.occurrences,queue:this.deps.inbox?.getSnapshot()?.[`next-turn`]??ek}}publish(){let e=this.compose();this.state.set(e);let t=this.draftSnapshot;t!==this.lastPublishedDraft&&(this.lastPublishedDraft=t,this.scheduleDraftPersistence(t))}};function rk(e,t){let{state:n,timestamp:r,mode:i}=t;if(n===void 0)return;let a=n.model;e.get(`productAnalytics`)?.track(`send_button_click`,{...n.sessionId===void 0?{}:{session_id:n.sessionId},...a===void 0?{}:{model_name:`${a.provider}/${a.name}`,...a.effort===void 0?{}:{thinking_effort:a.effort}},run_mode:n.runMode,msg_type:n.running?i:`default`},r)}var ik=class{rootCtx;t;pendingDraft;shells=/* @__PURE__ */ new WeakMap;constructor(e,t,n){this.rootCtx=e,this.t=t,this.pendingDraft=n}for(e){let t=this.sessions(),n=t.sessionOf(e),r=n===void 0?void 0:t.binding(n.sessionId);if(r===void 0||r.session!==n)throw Error(`conversation.input.for requires a retained Session scope`);return this.shellFor(r)}captureReferenceInsertion(e){let t=this.sessions(),n=this.shells.get(e);if(t.binding(e.sessionId)!==e||n===void 0)return;let r=this.rootCtx.get(`conversation`);if(r===void 0)return;let i=n.actions.captureInsertion(),a=r.blocks.storeFor(e.sessionId),o=this.rootCtx.uiSession.sessionStatus,s=!1,c=()=>{let r=e.session.getSnapshot();return!s&&t.binding(e.sessionId)===e&&r.openState===`open`&&!r.removed&&a.getSnapshot()===void 0&&o.getSnapshot().get(e.sessionId)?.pendingInteraction===void 0&&n.snapshot.draftRev===i.draftRev&&n.canInsertReferences()};return{getSnapshot:c,subscribe:r=>{let i=[t.list.subscribe(r),e.session.subscribe(r),n.state.subscribe(r),a.subscribe(r),o.subscribe(r),n.editor.registerEditableListener(r),n.editor.registerRootListener(r)];return()=>i.forEach(e=>e())},insert:e=>{let t=c();return s=!0,t&&n.insertReferences([e],i)}}}requestDraftInitialization(e,t){if(this.sessions().binding(e.sessionId)!==e)throw Error(`conversation.input.requestDraftInitialization requires a retained Session binding`);return this.shellFor(e).requestDraftInitialization(t)}adoptPendingDraft(e,t){if(this.sessions().binding(e.sessionId)!==e)throw Error(`conversation.input.adoptPendingDraft requires a retained Session binding`);let n=this.pendingDraft?.take(),r=this.shellFor(e);return t===void 0?n!==void 0&&n.text!==``?(r.setDraft(n.text),`applied`):`preserved`:n?.modified?r.requestDraftInitialization({prompt:n.text,clearPreviousDraft:!0}):r.requestDraftInitialization(t)}shellFor(e){let t=this.shells.get(e);if(t!==void 0)return t;let{session:n,ctx:r}=e,i=new nk({actx:r,submissionState:()=>{let e=n.getSnapshot(),t=n.projections.faceOf(`modelSelection`).getSnapshot(),r=n.projections.faceOf(`plan`).getSnapshot(),i=n.projections.faceOf(`goal`).getSnapshot(),a=t?.next??t?.lastUsed;return Object.freeze({...e.blank?{}:{sessionId:e.sessionId},...a==null?{}:{model:Object.freeze({provider:a.provider,name:a.model,...a.reasoningEffort===void 0?{}:{effort:a.reasoningEffort}})},runMode:r?.active?`plan`:i?.goal.phase===`active`?`goal`:`default`,running:e.running})},messageSubmitted:e=>{rk(this.rootCtx,e)},inputTriggers:()=>this.controller(r),popup:()=>this.popup(r),inbox:n.projections.faceOf(`inbox`),defaultSink:(e,t,r,i,a)=>this.sink(n,e,t,r,i,a),steerQueue:()=>{this.steerQueue(n,i)},commandAttachments:{serialize:async e=>(await this.conversation().serializeDraftAttachments(e)).attachments,release:e=>{let t=this.rootCtx.get(`conversation`);for(let n of e)t?.releaseDraftAttachment(n)},unsupportedNotice:e=>this.t(`command.attachmentsUnsupported`,{command:e.trim().replace(/^\//u,``)})}});return this.shells.set(e,i),r.effect(()=>{let t=[r.on(`slash/input-begin-command`,e=>i.beginCommand(e.claim,e.span)?!0:void 0),r.on(`slash/input-insert-reference`,e=>i.insertReference(e.reference,e.span)?!0:void 0),r.on(`slash/input-consume-token`,e=>i.consumeToken(e.guard)?!0:void 0),r.on(`slash/input-insert-text`,e=>i.insertText(e.text,e.span,e.continue===!0)?!0:void 0)];return()=>{for(let e of t)e();let n=i.dispose();this.shells.delete(e);let r=this.rootCtx.get(`conversation`);for(let e of n)r?.releaseDraftAttachment(e)}},`conversation.input: session shell`),r.inject([`inputTriggers`],e=>{e.effect(()=>(i.refreshLexiconSubscription(),()=>{i.refreshLexiconSubscription()}),`conversation.input: reference catalogs`)}),i.setDraft(Yu(e.sessionId)),i}shell(e){let t=this.sessions().binding(e);if(t===void 0)throw Error(`conversation.input: session "${e}" resolved no binding`);return this.shellFor(t)}keyboard(e){return this.shell(e)}canPickFiles(e){let t=this.sessions().binding(e);return t!==void 0&&this.shells.get(t)?.canPickFiles()===!0}pickFiles(e){let t=this.sessions().binding(e);t!==void 0&&this.shells.get(t)?.pickFiles()}inputTriggers(e){let t=this.sessions().binding(e);return t===void 0?void 0:this.controller(t.ctx)}sink(e,t,n,r,i,a){return t===``&&n.length===0?Promise.resolve({kind:`success`}):this.conversation().sendSession(e,t,n,r,i,a)}async steerQueue(e,t){let n=e.projections.faceOf(`inbox`).getSnapshot()?.[`next-turn`]??[];if(n.length!==0)for(let r of n){let n=await e.updateQueue(r.id,{kind:`steer`});if(!n.ok){if(n.error.code===`session/steer-unavailable`||n.error.code===`session/queue-item-not-found`)return;t.notify(`error`,this.t(`queue.steerFailed`));return}}}controller(e){if(this.sessions().sessionOf(e)!==void 0)return this.rootCtx.get(`inputTriggers`)?.sessionOf(e)}popup(e){if(this.sessions().sessionOf(e)!==void 0)return this.rootCtx.get(`commandUi`)?.popupFor(e)}sessions(){let e=this.rootCtx.get(`sessions`);if(e===void 0)throw Error(`conversation.input: sessions service unavailable`);return e}conversation(){let e=this.rootCtx.get(`conversation`);if(e===void 0)throw Error(`conversation.input: conversation service unavailable`);return e}};let ak=/* @__PURE__ */ new Map;var ok=class{runtime;unregister;textStore=(0,f.createSnapshotStore)(``);activeToken=null;modified=!1;seeding=!1;text=this.textStore;constructor(){this.runtime=new ZO({onUpdate:()=>{let e=this.runtime.refreshProjection(),t=this.runtime.projection.clipboardText;e.clipboardText!==t&&(this.seeding||(this.modified=!0),this.textStore.set(t))},openReference:()=>!1,activeClaimToken:()=>null,lexicon:()=>ak,resolveLexicon:()=>void 0}),this.unregister=this.runtime.register()}get editor(){return this.runtime.editor}syncCreation(e){if(e.state===`idle`){(this.activeToken!==null||this.textStore.getSnapshot()!==``)&&(this.activeToken=null,this.clearEditor());return}let t=e.token??null;t!==this.activeToken&&(this.activeToken=t,this.seed(e.initialPrompt??``))}paste(e){this.runtime.paste(e)}take(){if(this.activeToken===null)return;let e={text:this.runtime.projection.clipboardText,modified:this.modified};return this.activeToken=null,this.clearEditor(),e}dispose(){this.activeToken=null,this.unregister()}seed(e){this.seeding=!0;try{this.modified=!1,this.runtime.setDraft(e),this.runtime.clearHistory(),this.textStore.set(this.runtime.projection.clipboardText)}finally{this.seeding=!1}}clearEditor(){this.seed(``)}};let sk=`busyEnter`,ck=[`queue`,`steer`],lk=`queue`,uk={[sk]:S.union([...ck]).default(lk)};S.object(uk);function dk(e,t,n,r){return!t||!r?`queue`:n===`enter`?e:e===`queue`?`steer`:`queue`}var fk=class{busyEnter=(0,f.createSnapshotStore)(lk);unsubscribe;host;constructor(e){this.host=e,e!==void 0&&(this.unsubscribe=e.subscribe(()=>{this.adopt(e)}),this.adopt(e))}dispose(){this.unsubscribe?.()}setBusyEnter(e){this.busyEnter.getSnapshot()!==e&&(this.busyEnter.set(e),this.host?.set(sk,e))}adopt(e){let t=e.getSnapshot().value;t!==void 0&&this.busyEnter.getSnapshot()!==t.busyEnter&&this.busyEnter.set(t.busyEnter)}};async function pk(e,t){let n=/* @__PURE__ */ new Map;for(let t of e)n.has(t.attachmentId)||n.set(t.attachmentId,t);let r=/* @__PURE__ */ new Map;return await Promise.all([...n.entries()].map(async([e,n])=>{let i=await t(n),a=await fetch(i);if(!a.ok)throw Error(`Queued image preview fetch failed (${a.status})`);r.set(e,{blob:await a.blob(),mediaType:n.mediaType})})),r}function mk(e,t,n){let{annotations:r,body:i}=bO(t);if(r.length>0&&e.addResponseAnnotations(e.takeSubmittedAnnotationAnchors(n,r)),i!==``){let t=e.draftSnapshot;e.setDraft({...t,text:t.text===``?i:`${t.text}\n${i}`})}}function hk(e){let{sessionId:t,shell:n,conversation:r,message:i,imageBlobs:a,rpcId:o}=e,s=()=>{if(n.isDisposed)throw Error(`Queued message was removed, but the session composer was closed before restoring.`);let{phase:e}=n.snapshot;if(e!==`plain`&&e!==`claimed`)return!1;if(i.attachments.length>0){if(r===void 0)throw Error(`Queued attachments cannot be restored without a conversation controller.`);let e=i.attachments.map(e=>{if(e.kind!==`image`)return e;let t=a.get(e.file.attachmentId);if(t===void 0)return e;let n=new File([t.blob],e.file.name,{type:t.blob.type||t.mediaType||`image/png`});return{...e,imageFile:n}}),o=r.restoreStagedDrafts(t,e);if(!n.addAttachments(o.map(e=>e.id))){if(r.releaseDraftAttachments(o),n.isDisposed)throw Error(`Queued message was removed, but the session composer was closed before restoring.`);return!1}}return i.text!==``&&mk(n,i.text,o),n.actions.persistDraft(),n.focus(`end`),!0};try{if(s())return Promise.resolve()}catch(e){return Promise.reject(e)}return new Promise((e,t)=>{let r=!1,i=!1,a,o=()=>{if(!(r||i)){i=!0;try{if(!s())return;r=!0,a?.(),e()}catch(e){r=!0,a?.(),t(e)}finally{i=!1}}};a=n.state.subscribe(o),o()})}let gk=`@deepseek-ai/dsh-client-ui-conversation/QueueDock.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(gk)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=gk,e.textContent=`.ZMI-0G_dock{box-sizing:border-box;width:calc(100% - var(--dsh-composer-side-clearance) - var(--dsh-composer-side-clearance) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));max-width:calc(var(--dsh-composer-card-max-width) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));margin:0 auto calc(0px - var(--dsh-composer-stack-gap) - 3px);padding:0 var(--dsh-composer-dock-inset);flex:none}.ZMI-0G_pendingAttachment{flex-direction:column;gap:2px;display:inline-flex}.ZMI-0G_panel{z-index:0;border-radius:var(--dsw-radius-lg) var(--dsw-radius-lg) 0 0;--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);width:100%;padding:2px 0;position:relative;overflow:hidden}.ZMI-0G_panel:before{z-index:-1;border-radius:inherit;background:var(--dsw-specific-menu);backdrop-filter:var(--dsw-menu-backdrop-filter);content:"";pointer-events:none;position:absolute;inset:0}.ZMI-0G_panel:after{border:.5px solid var(--dsw-alias-border-l1);border-radius:inherit;content:"";pointer-events:none;border-bottom:none;position:absolute;inset:0}.ZMI-0G_paused{color:var(--dsw-alias-label-tertiary);font:var(--dsw-font-xs-13);padding:6px 12px 2px}.ZMI-0G_header{box-sizing:border-box;border-radius:var(--dsw-radius-md);width:100%;height:36px;color:var(--dsw-alias-label-primary);text-align:left;cursor:pointer;background:0 0;border:none;align-items:center;gap:10px;padding:4px 12px;display:flex}.ZMI-0G_header:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.ZMI-0G_header:disabled{cursor:default}.ZMI-0G_lead{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.ZMI-0G_count{min-width:0;font-family:Inter, var(--dsw-font-family);flex:auto;font-size:13px;font-weight:500;line-height:24px}.ZMI-0G_chevron{width:14px;height:14px;color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.ZMI-0G_list{max-height:180px;margin:0;padding:0;list-style:none;overflow-y:auto}.ZMI-0G_row{box-sizing:border-box;border-radius:var(--dsw-radius-md);align-items:center;gap:10px;width:100%;min-height:36px;padding:4px 5px 4px 12px;display:flex}.ZMI-0G_row+.ZMI-0G_row{box-shadow:inset 0 1px 0 var(--dsw-alias-border-l1)}.ZMI-0G_attachments{flex:none;gap:4px;min-width:0;max-width:55%;display:flex;overflow:hidden}.ZMI-0G_pendingRow .ZMI-0G_attachments{flex-shrink:1}.ZMI-0G_file{border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-base);box-sizing:border-box;flex:0 180px;align-items:center;gap:4px;min-width:74px;height:24px;padding:0 6px;display:inline-flex;overflow:hidden}.ZMI-0G_fileIcon{flex:none;width:16px;height:16px;display:inline-flex}.ZMI-0G_fileName{min-width:0;color:var(--dsw-alias-label-primary-dimmed);font:var(--dsw-font-xs-13);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.ZMI-0G_fileSize{color:var(--dsw-alias-label-tertiary);white-space:nowrap;flex:none;font-size:10px}.ZMI-0G_thumb{border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-xs);background:var(--dsw-alias-bg-base);object-fit:cover;width:24px;height:24px}.ZMI-0G_annotationBadge{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 14%, transparent);height:20px;color:var(--dsw-alias-state-business-primary);white-space:nowrap;border-radius:999px;flex:none;align-items:center;padding:0 7px;font-size:11px;font-weight:500;line-height:1;display:inline-flex}.ZMI-0G_preview{min-width:0;font:var(--dsw-font-xs-13);font-family:Inter, var(--dsw-font-family);color:var(--dsw-alias-label-primary-dimmed);text-overflow:ellipsis;white-space:nowrap;word-break:break-word;flex:auto;overflow:hidden}.ZMI-0G_previewFallback{color:var(--dsw-alias-label-tertiary)}.ZMI-0G_actions{flex:none;align-items:center;gap:10px;display:flex}.ZMI-0G_actionWrap{flex:none;display:inline-flex}.ZMI-0G_actionWrap>.ZMI-0G_action:disabled{pointer-events:none}.ZMI-0G_status{color:var(--dsw-alias-label-tertiary);font:var(--dsw-font-xs-13);white-space:nowrap;flex:none}.ZMI-0G_action{corner-shape:round;width:28px;height:28px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;border-radius:999px;flex:none;place-items:center;padding:0;display:grid}.ZMI-0G_action:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.ZMI-0G_action:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.ZMI-0G_action:disabled{cursor:default;opacity:.45}`,document.head.appendChild(e)}var Z={action:`ZMI-0G_action`,actionWrap:`ZMI-0G_actionWrap`,actions:`ZMI-0G_actions`,annotationBadge:`ZMI-0G_annotationBadge`,attachments:`ZMI-0G_attachments`,chevron:`ZMI-0G_chevron`,count:`ZMI-0G_count`,dock:`ZMI-0G_dock`,file:`ZMI-0G_file`,fileIcon:`ZMI-0G_fileIcon`,fileName:`ZMI-0G_fileName`,fileSize:`ZMI-0G_fileSize`,header:`ZMI-0G_header`,lead:`ZMI-0G_lead`,list:`ZMI-0G_list`,panel:`ZMI-0G_panel`,paused:`ZMI-0G_paused`,pendingAttachment:`ZMI-0G_pendingAttachment`,pendingRow:`ZMI-0G_pendingRow`,preview:`ZMI-0G_preview`,previewFallback:`ZMI-0G_previewFallback`,row:`ZMI-0G_row`,status:`ZMI-0G_status`,thumb:`ZMI-0G_thumb`};let _k=[];function vk(e){let t=e.replace(/\s+/g,` `).trim(),n=Array.from(t);return n.length>200?`${n.slice(0,200).join(``)}…`:t}function yk(e,t){let n=vk(t);if(e.length===0)return{annotations:e,preview:n,fallbackPreview:``,annotationTooltip:``};let r=e[0];return{annotations:e,preview:n,fallbackPreview:n===``?vk(r.annotation??r.text):``,annotationTooltip:e.map((e,t)=>`${String(t+1)}. ${vk(e.annotation??e.text)}`).join(`
167
- `)}}function bk(e){let t=[],n=[];for(let r of e)if(r.type!==`image`&&r.type!==`file`){if(r.type===`text`){let e=bO(r.text);t.push(...e.annotations),e.body!==``&&n.push(e.body)}else n.push(`[${r.type}]`)}return yk(t,n.join(` `))}function xk(e){let t=bO(e);return yk(t.annotations,t.body)}function Sk({display:e,t}){return/* @__PURE__ */ (0,h.jsxs)(h.Fragment,{children:[e.annotations.length>0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.annotationBadge,"data-queue-annotations":e.annotations.length,title:e.annotationTooltip,children:t(`annotation.trayCount`,{count:e.annotations.length})}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:e.preview===``&&e.fallbackPreview!==``?`${Z.preview} ${Z.previewFallback}`:Z.preview,children:e.preview===``?e.fallbackPreview:(0,d.projectUserText)(e.preview,[])})]})}function Ck(e){return e.every(e=>e.type===`text`)?e.map(e=>e.text).join(``):null}function wk(e){let t=[];for(let n of e){if(n.type===`image`){let{attachment:e}=n;e!==void 0&&t.push({type:`image`,attachment:e})}if(n.type===`file`){let{attachment:e}=n;e!==void 0&&t.push({type:`file`,attachment:e})}}return t}function Tk({attachment:e,label:t}){return/* @__PURE__ */ (0,h.jsxs)(`span`,{className:Z.file,"aria-label":t,title:e.name,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.fileIcon,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.FileTypeIcon,{path:e.name,size:16})}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.fileName,children:e.name}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.fileSize,children:(0,d.fileSizeText)(e.bytes)})]})}function Ek({attachment:e,loadImage:t,label:n}){let[r,i]=(0,g.useState)(null);return(0,g.useEffect)(()=>{let n=!0;return t(e).then(e=>{n&&i(e)},()=>{}),()=>{n=!1}},[e,t]),r===null?/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.thumb,"aria-hidden":!0}):/* @__PURE__ */ (0,h.jsx)(`img`,{className:Z.thumb,src:r,alt:n})}function Dk({upload:e,t}){let n=(0,g.useSyncExternalStore)(e.subscribe,e.getSnapshot);return n?.status===`uploading`?/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.status,role:`status`,"data-upload-progress":!0,children:n.total===void 0||n.total===0?t(`file.uploading`):t(`file.uploadingPercent`,{percent:Math.round(Math.min(1,(n.loaded??0)/n.total)*100)})}):null}function Ok({useSession:e,useProjection:t,updateQueue:n,editQueue:r,hasStructuredQueueEdit:i,notify:a,loadImage:o,t:s}){let c=t(`inbox`),l=t(`queueState`),u=e(e=>e.pendingSubmissions),f=(0,g.useMemo)(()=>{let e=c?.[`next-turn`]??_k,t=new Set(u.filter(e=>e.placement===`transcript`).map(e=>e.requestId));return t.size===0?e:e.filter(({source:e})=>e.kind!==`user`||!(`rpcId`in e)||!t.has(e.rpcId))},[c,u]),p=(0,g.useMemo)(()=>{let e=new Set(f.flatMap(({source:e})=>e.kind===`user`&&`rpcId`in e?[e.rpcId]:[]));return u.filter(t=>t.placement===`queued`&&!e.has(t.requestId))},[u,f]),m=f.length+p.length,_=e(e=>e.running),v=e(e=>e.subagent===null||e.subagent.address.mode===`continuable`)&&l?.stale!==!0,y=l?.previewOnly===!0,b=(0,g.useRef)(!1),[ee,te]=(0,g.useState)(null),[ne,re]=(0,g.useState)(!0),ie=(0,g.useId)(),ae=l?.pausedReason??null,oe=ae===`interrupted`?s(`queue.paused.interrupted`):ae===`outcome-unknown`?s(`queue.paused.unknown`):ae===`failed`?s(`queue.paused.failed`):null;if((0,g.useEffect)(()=>{m===0&&!ne&&re(!0)},[ne,m]),m===0)return null;let se=v&&ee!==null,ce=!ne||se,le=m===1||ce,ue=async(e,t,r)=>{if(b.current)return!1;b.current=!0,te(e);try{return typeof t==`function`?await t():await n(e,t),!0}catch{return a(`error`,y?s(`queue.remoteActionFailed`):r),!1}finally{b.current=!1,te(t=>t===e?null:t)}};return/* @__PURE__ */ (0,h.jsx)(`div`,{className:Z.dock,"data-queue-dock":``,children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Z.panel,children:[l?.stale&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:Z.paused,role:`status`,children:s(`queue.remoteStale`)}),oe!==null&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:Z.paused,role:`status`,children:oe}),m>1&&/* @__PURE__ */ (0,h.jsxs)(`button`,{type:`button`,className:Z.header,"aria-controls":ie,"aria-expanded":ce,disabled:se,onClick:()=>{re(e=>!e)},children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.lead,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconQueueOutlineRegular,{})}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.count,children:s(`queue.count`,{n:m})}),!le&&p.length>0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.status,role:`status`,children:s(`queue.sending`)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.chevron,"aria-hidden":!0,children:ce?/* @__PURE__ */ (0,h.jsx)(d.IconChevronDownOutlineRegular,{}):/* @__PURE__ */ (0,h.jsx)(d.IconChevronUpOutlineRegular,{})})]}),/* @__PURE__ */ (0,h.jsxs)(`ul`,{id:ie,className:Z.list,hidden:!le,children:[le&&f.map(e=>{let t=wk(e.content),n=bk(e.content),a=e.source.kind===`user`&&`rpcId`in e.source?e.source.rpcId:void 0,c=l?.editable===void 0?(()=>{let t=Ck(e.content);return t===null?null:{kind:`legacyText`,text:t,...a===void 0?{}:{rpcId:a}}})():(()=>{let n=l.editable?.[e.id];return n===void 0||!i()?null:{kind:`structured`,revision:n,images:t.flatMap(e=>e.type===`image`?[e.attachment]:[]),...a===void 0?{}:{rpcId:a}}})(),u=c!==null;return/* @__PURE__ */ (0,h.jsxs)(`li`,{className:Z.row,children:[m===1&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.lead,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconQueueOutlineRegular,{})}),t.length>0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.attachments,children:t.map((e,t)=>e.type===`image`?/* @__PURE__ */ (0,h.jsx)(Ek,{attachment:e.attachment,loadImage:o,label:s(`queue.image`)},`${e.attachment.attachmentId}:${t}`):/* @__PURE__ */ (0,h.jsx)(Tk,{attachment:e.attachment,label:s(`queue.file`,{name:e.attachment.name})},`${e.attachment.attachmentId}:${e.attachment.name}:${t}`))}),/* @__PURE__ */ (0,h.jsx)(Sk,{display:n,t:s}),v&&/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Z.actions,children:[!y&&/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:!0,label:s(u?`queue.edit`:`queue.edit.unsupported`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.actionWrap,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Z.action,"aria-label":s(`queue.edit`),disabled:ee!==null||!u,onClick:()=>{c!==null&&ue(e.id,()=>r(e.id,c),s(`queue.editFailed`))},children:/* @__PURE__ */ (0,h.jsx)(d.IconEditOutlineRegular,{size:14})})})}),/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:!0,label:s(`queue.remove`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Z.action,"aria-label":s(`queue.remove`),disabled:ee!==null,onClick:()=>{ue(e.id,{kind:`remove`},s(`queue.removeFailed`))},children:/* @__PURE__ */ (0,h.jsx)(d.IconTrashOutlineRegular,{size:14})})}),(!y||!_)&&/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:!0,label:s(_?`queue.steer`:`queue.resume`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Z.action,"aria-label":s(_?`queue.steer`:`queue.resume`),disabled:ee!==null,onClick:()=>{ue(e.id,{kind:`steer`},s(_?`queue.steerFailed`:`queue.resumeFailed`))},children:/* @__PURE__ */ (0,h.jsx)(d.IconSendOutlineRegular,{})})})]})]},e.id)}),le&&p.map(e=>{let t=xk(e.text);return/* @__PURE__ */ (0,h.jsxs)(`li`,{className:`${Z.row} ${Z.pendingRow}`,"data-submission-echo":``,children:[m===1&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.lead,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconQueueOutlineRegular,{})}),e.attachments.length>0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.attachments,children:e.attachments.map((e,t)=>/* @__PURE__ */ (0,h.jsxs)(`span`,{className:Z.pendingAttachment,children:[e.type===`image`?/* @__PURE__ */ (0,h.jsx)(`img`,{className:Z.thumb,src:e.value.previewUrl,alt:s(`queue.image`)}):/* @__PURE__ */ (0,h.jsx)(Tk,{attachment:e.value,label:s(`queue.file`,{name:e.value.name})}),e.upload&&/* @__PURE__ */ (0,h.jsx)(Dk,{upload:e.upload,t:s})]},t))}),/* @__PURE__ */ (0,h.jsx)(Sk,{display:t,t:s}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.status,role:`status`,children:s(`queue.sending`)}),v&&!y&&/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Z.actions,children:[/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Z.action,"aria-label":s(`queue.edit`),title:s(`queue.sending`),disabled:!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconEditOutlineRegular,{size:14})}),/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Z.action,"aria-label":s(`queue.remove`),title:s(`queue.sending`),disabled:!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconTrashOutlineRegular,{size:14})}),/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Z.action,"aria-label":s(`queue.steer`),title:s(`queue.sending`),disabled:!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconSendOutlineRegular,{})})]})]},e.requestId)})]})]})})}let kk={name:`conversation-queue-dock`,inject:[`slots`,`conversation`,`sessions`,`uiConversation`],apply(e,t){e.slots.inject(`conversation.input.dock`,()=>e.slots.register({name:`conversation.input.dock`,id:`queue`,order:20,locale:ed,inject:n=>{let r=e.sessions.scope(n);if(r===void 0)throw Error(`queue dock: session "${n}" resolved no scope`);let i=r.get(`conversation`);if(i===void 0)throw Error(`queue dock: conversation service unavailable`);let a=t=>e.uiConversation.imageUrl(n,t);return{updateQueue:(e,t)=>i.updateQueue(e,t),hasStructuredQueueEdit:()=>{let t=e.get(`conversation`);return e.get(`queueMessageEditing`)!==void 0&&typeof t?.restoreStagedDrafts==`function`},editQueue:async(r,o)=>{let s=e.sessions.retain(n,{source:`controllerOperation`});try{let s=t.shell(n);if(o.kind===`legacyText`){await i.updateQueue(r,{kind:`remove`}),await hk({sessionId:n,shell:s,message:{text:o.text,attachments:[]},imageBlobs:/* @__PURE__ */ new Map,...o.rpcId===void 0?{}:{rpcId:o.rpcId}});return}let c=e.get(`queueMessageEditing`),l=e.get(`conversation`);if(c===void 0||typeof l?.restoreStagedDrafts!=`function`)throw Error(`queue dock: structured queue editing unavailable`);let u=o.images.length>0?await pk(o.images,a):/* @__PURE__ */ new Map;if(s.isDisposed)throw Error(`queue dock: session composer closed before editing`);await hk({sessionId:n,shell:s,conversation:l,message:await c.takeForEdit(n,r,o.revision),imageBlobs:u,...o.rpcId===void 0?{}:{rpcId:o.rpcId}})}finally{s.release()}},notify:(t,a)=>{e.sessions.scope(n)===r&&i.input.for(r).notify(t,a)},loadImage:a}}},Ok))}},Ak=`@deepseek-ai/dsh-client-ui-conversation/EnterBehaviorRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ak)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=Ak,e.textContent=`.v-9l-a_row{border-bottom:.5px solid var(--dsw-alias-border-l2);align-items:center;gap:8px;padding:16px 0;display:flex}.v-9l-a_rowText{flex-direction:column;flex:1;gap:4px;min-width:0;padding-right:48px;display:flex}.v-9l-a_title{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:400;line-height:22px}.v-9l-a_desc{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:400;line-height:18px}.v-9l-a_selector{border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-module-platform);height:36px;font:inherit;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;align-items:center;gap:12px;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}.v-9l-a_selector:hover{background:var(--dsw-alias-interactive-bg-hover)}.v-9l-a_chevron{flex:none}`,document.head.appendChild(e)}var jk={chevron:`v-9l-a_chevron`,desc:`v-9l-a_desc`,row:`v-9l-a_row`,rowText:`v-9l-a_rowText`,selector:`v-9l-a_selector`,title:`v-9l-a_title`};let Mk=[{id:`queue`,label:`settings.enter.queue`},{id:`steer`,label:`settings.enter.steer`}];function Nk({useBusyEnter:e,setBusyEnter:t,t:n}){let r=e(e=>e),[i,a]=(0,g.useState)(!1),o=r===`queue`?`settings.enter.queue`:`settings.enter.steer`;return/* @__PURE__ */ (0,h.jsxs)(`div`,{className:jk.row,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:jk.rowText,children:[/* @__PURE__ */ (0,h.jsx)(`div`,{className:jk.title,children:n(`settings.enter.title`)}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:jk.desc,children:n(`settings.enter.description`)})]}),/* @__PURE__ */ (0,h.jsx)(d.Menu,{open:i,onClose:()=>{a(!1)},items:Mk.map(e=>({id:e.id,label:n(e.label)})),selectedId:r,onSelect:e=>{a(!1),t(e)},align:`end`,portal:!0,anchor:/* @__PURE__ */ (0,h.jsxs)(`button`,{type:`button`,className:jk.selector,"aria-haspopup":`menu`,"aria-expanded":i,onClick:()=>{a(e=>!e)},children:[n(o),/* @__PURE__ */ (0,h.jsx)(d.IconChevronDownOutlineRegular,{className:jk.chevron})]})})]})}let Pk={views:{get:()=>void 0,grouped:()=>void 0},activeTargets:/* @__PURE__ */ new Set};function Fk(e,t){return t.activeTargets.size>0||!e.blank&&!e.awaitingFirstTurn||e.running?`active`:e.promptAttempted?`engaging`:`blank`}let Ik=`@deepseek-ai/dsh-client-ui-conversation/ConversationRoot.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ik)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=Ik,e.textContent=`.vbpo1q_root{background:var(--dsw-alias-bg-base);flex-direction:column;min-width:0;height:100%;display:flex;position:relative}body[data-codexhost-wallpaper] .vbpo1q_root{background:0 0}.vbpo1q_header{box-sizing:border-box;flex:none;grid-template-columns:auto minmax(0,1fr);min-height:76px;padding:10px 28px 0 20px;display:grid}.vbpo1q_header:where(:not(:has(.vbpo1q_tabs))){min-height:0;padding:10px 24px 6px 20px}[data-windows-titlebar] .vbpo1q_header:where(:not(:has(.vbpo1q_tabs))){padding-top:8px;padding-bottom:4px}.vbpo1q_headerBlank{border-bottom:none;min-height:0;padding-bottom:0}.vbpo1q_headerBlank .vbpo1q_headerCorner{margin-left:auto}html:not([data-platform=darwin]) .vbpo1q_headerSessionless{padding-top:0}html:not([data-platform=darwin]) .vbpo1q_headerSessionless .vbpo1q_titleRow{min-height:0}[data-platform=darwin] .vbpo1q_headerLeading,[data-platform=darwin] .vbpo1q_headerActions,[data-platform=darwin] .vbpo1q_headerUtilities,[data-platform=darwin] .vbpo1q_headerCorner{-webkit-app-region:no-drag}.vbpo1q_titleRow{min-height:30px;grid-column:2;align-items:center;gap:0;padding-inline-start:max(0px, calc(var(--dsh-frame-leading-clearance,0px) - 20px));display:flex;container-type:inline-size}.vbpo1q_titleCenter{display:contents}.vbpo1q_phoneTrailingAction{display:none}.vbpo1q_titleCluster{flex:1;align-items:center;gap:10px;min-width:0;display:flex}.vbpo1q_headerLeading{flex:none;grid-area:1/1;align-items:center;gap:8px;display:flex}.vbpo1q_crumbs{white-space:nowrap;align-items:center;gap:4px;min-width:0;display:flex;overflow:hidden}.vbpo1q_crumbSeg{align-items:center;gap:4px;min-width:0;display:inline-flex}.vbpo1q_crumbSep{color:var(--dsw-alias-label-caption);font-size:14px;line-height:20px}.vbpo1q_crumb{border-radius:var(--dsw-radius-md);max-width:220px;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;cursor:pointer;background:0 0;border:none;padding:4px 8px;font-size:14px;line-height:20px;display:inline-block;overflow:hidden}.vbpo1q_crumbSubagent{font-size:12px;line-height:18px}button.vbpo1q_crumb:hover{background:var(--dsw-alias-interactive-bg-hover)}.vbpo1q_crumbCurrent{color:var(--dsw-alias-label-primary);cursor:default;font-weight:500}.vbpo1q_headerActions{flex:none;align-items:center;gap:8px;display:flex}.vbpo1q_headerUtilities{flex:none;align-items:center;gap:8px;margin-left:20px;display:flex}.vbpo1q_headerUtilities:empty{display:none}.vbpo1q_headerCorner{flex:none;align-items:center;margin-left:8px;margin-right:-16px;display:flex}.vbpo1q_headerCorner:empty,.vbpo1q_headerCorner:not(:has([data-slot="conversation.session.header.corner"]>*)){display:none}[data-phone] .vbpo1q_root[data-phase=active]{--dsh-phone-header-height:calc(env(safe-area-inset-top) + 44px)}[data-phone] .vbpo1q_root[data-phase=active]:has([data-slot="conversation.header.shortcuts"] nav){--dsh-phone-header-height:calc(env(safe-area-inset-top) + 88px)}[data-phone] .vbpo1q_header{z-index:8;padding-top:env(safe-area-inset-top);background:0 0;border-bottom:none;row-gap:0;padding-bottom:0;position:relative}[data-phone] .vbpo1q_root[data-phase=active] .vbpo1q_header{pointer-events:none;position:absolute;top:0;left:0;right:0}[data-phone] .vbpo1q_root[data-phase=active] .vbpo1q_header [data-slot="conversation.header.shortcuts"]{pointer-events:auto}[data-phone] .vbpo1q_root[data-phase=active]:not(:has([data-slot="conversation.header.notice"]>*)) .vbpo1q_scrollBody{padding-top:var(--dsh-phone-header-height)}[data-phone] .vbpo1q_root[data-phase=active]>[data-slot="conversation.header.notice"]>*{z-index:5;position:relative}[data-phone] .vbpo1q_root[data-phase=active]>[data-slot="conversation.header.notice"]>:first-child{margin-top:var(--dsh-phone-header-height)}[data-phone] .vbpo1q_root[data-phase=active] .vbpo1q_header:before{content:"";height:calc(var(--dsh-phone-header-height) + 32px);z-index:-1;background:linear-gradient(180deg, color-mix(in srgb, var(--dsw-alias-bg-base) 78%, transparent) 0%, color-mix(in srgb, var(--dsw-alias-bg-base) 58%, transparent) 44%, color-mix(in srgb, var(--dsw-alias-bg-base) 24%, transparent) 74%, transparent 100%);pointer-events:none;position:absolute;top:0;left:0;right:0}@supports (backdrop-filter:blur(16px)){[data-phone] .vbpo1q_root[data-phase=active] .vbpo1q_header:before{backdrop-filter:blur(16px)saturate(140%);-webkit-mask-image:linear-gradient(#000 0%,#000000eb 42%,#0000008f 62%,#00000038 78%,#0000000d 91%,#0000 100%);mask-image:linear-gradient(#000 0%,#000000eb 42%,#0000008f 62%,#00000038 78%,#0000000d 91%,#0000 100%)}}body[data-codexhost-wallpaper] [data-phone] .vbpo1q_root[data-phase=active] .vbpo1q_header:before{background:linear-gradient(180deg, color-mix(in srgb, var(--dsw-alias-bg-base) 64%, transparent) 0%, color-mix(in srgb, var(--dsw-alias-bg-base) 42%, transparent) 44%, color-mix(in srgb, var(--dsw-alias-bg-base) 16%, transparent) 74%, transparent 100%)}[data-phone] .vbpo1q_headerLeading{display:none}[data-phone] .vbpo1q_titleRow{grid-area:1/1/auto/-1;grid-template-columns:minmax(80px,1fr) minmax(0,auto) minmax(80px,1fr);align-items:center;gap:6px;min-height:44px;margin-inline:-8px -16px;padding-inline-start:0;display:grid}[data-phone] .vbpo1q_titleCluster{grid-column:2;justify-content:center;align-items:center;gap:4px;min-width:0;max-width:100%;display:flex}[data-phone] .vbpo1q_titleCenter{pointer-events:auto;border-radius:8px;justify-content:center;align-items:center;gap:4px;min-width:0;max-width:100%;min-height:36px;padding:0 2px;transition:opacity .12s;display:inline-flex;position:relative}[data-phone] .vbpo1q_root[data-phase=active] .vbpo1q_titleCenter:before{content:"";z-index:-1;background:radial-gradient(closest-side, color-mix(in srgb, var(--dsw-alias-bg-base) 88%, transparent) 38%, color-mix(in srgb, var(--dsw-alias-bg-base) 42%, transparent) 72%, transparent 100%);pointer-events:none;position:absolute;inset:-4px -22px}body[data-codexhost-wallpaper] [data-phone] .vbpo1q_root[data-phase=active] .vbpo1q_titleCenter:before{background:radial-gradient(closest-side, color-mix(in srgb, var(--dsw-alias-bg-base) 68%, transparent) 38%, color-mix(in srgb, var(--dsw-alias-bg-base) 28%, transparent) 72%, transparent 100%)}body[data-codexhost-wallpaper][data-ds-dark-theme] [data-phone] .vbpo1q_titleCenter{text-shadow:0 1px 10px #0000006b}[data-phone] .vbpo1q_titleCenter:has([data-navigation-focus-return]){cursor:pointer;-webkit-tap-highlight-color:transparent}[data-phone] .vbpo1q_titleRow>.vbpo1q_titleCenter,[data-phone] .vbpo1q_titleRow>[data-slot="conversation.header.navigation"]{pointer-events:auto;grid-column:2;justify-self:center}[data-phone] .vbpo1q_titleCenter>[data-slot="conversation.header.navigation"]{display:contents}[data-phone] .vbpo1q_titleCenter:has([data-navigation-focus-return]):active{opacity:.52}[data-phone] .vbpo1q_titleCenter:has([data-navigation-focus-return]:focus-visible){outline:none}@media (hover:hover) and (pointer:fine){[data-phone] .vbpo1q_titleCenter:has([data-navigation-focus-return]:focus-visible){outline:2px solid var(--dsw-alias-label-primary);outline-offset:2px}}[data-phone] .vbpo1q_crumbs{justify-content:center;gap:3px}[data-phone] .vbpo1q_crumb{letter-spacing:-.015em;max-width:none;padding:0;font-size:15px;font-weight:600;line-height:20px}[data-phone] button.vbpo1q_crumb{z-index:1;position:relative}[data-phone] .vbpo1q_headerActions:not(:has(button)),[data-phone] .vbpo1q_headerUtilities{display:none}[data-phone] .vbpo1q_phoneTrailingAction,[data-phone] .vbpo1q_headerCorner>[data-slot="conversation.session.header.corner"],[data-phone] .vbpo1q_phoneTrailingAction>[data-slot="conversation.header.trailing"]{display:contents}[data-phone] .vbpo1q_headerCorner:has(button){box-sizing:border-box;corner-shape:round;pointer-events:auto;background:#ffffffd6;border:.5px solid #0f11151a;border-radius:9999px;grid-column:3;justify-content:center;justify-self:end;align-items:center;gap:2px;height:36px;margin:0;padding:0 3px;display:inline-flex;box-shadow:inset 0 1px #ffffffb8,inset 0 -.5px #ffffff47,inset 0 0 0 .5px #ffffff38,0 1px 2px #0f11150d,0 6px 18px -4px #0f11151c}[data-phone] .vbpo1q_headerCorner:has(button):not(:has([data-phone-new-session]):has([data-sidebar-right-expand])){width:36px;padding:0}[data-ds-dark-theme] [data-phone] .vbpo1q_headerCorner:has(button){background:#24262cc7;border-color:#ffffff24;box-shadow:inset 0 1px #ffffff47,inset 0 -.5px #ffffff14,0 2px 8px #00000042,0 8px 22px -6px #0000006b}@supports (backdrop-filter:blur(8px)){[data-phone] .vbpo1q_headerCorner:has(button){backdrop-filter:blur(8px)saturate(180%);background:linear-gradient(#ffffff38 0%,#ffffff17 100%);box-shadow:inset 0 1px .5px #ffffffd9,inset 0 -.5px #0f11150f,0 1px 2px #0f11150f,0 6px 16px -4px #0f11151f}[data-ds-dark-theme] [data-phone] .vbpo1q_headerCorner:has(button){backdrop-filter:blur(10px)saturate(180%);background:linear-gradient(#ffffff1f 0%,#ffffff0d 100%)}}@media (prefers-reduced-motion:reduce){[data-phone] .vbpo1q_titleCenter{transition:none}}@media (prefers-reduced-transparency:reduce),(prefers-contrast:more){[data-phone] .vbpo1q_root[data-phase=active] .vbpo1q_header{pointer-events:auto;background:var(--dsw-alias-bg-base);border-bottom:.5px solid var(--dsw-alias-border-l3);position:relative}[data-phone] .vbpo1q_root[data-phase=active] .vbpo1q_header:before{display:none}[data-phone] .vbpo1q_root[data-phase=active]:not(:has([data-slot="conversation.header.notice"]>*)) .vbpo1q_scrollBody{padding-top:0}[data-phone] .vbpo1q_root[data-phase=active]>[data-slot="conversation.header.notice"]>:first-child{margin-top:0}[data-phone] .vbpo1q_headerCorner:has(button),[data-ds-dark-theme] [data-phone] .vbpo1q_headerCorner:has(button){border:1px solid var(--dsw-alias-border-l3);background:var(--dsw-alias-bg-layer-1);backdrop-filter:none;box-shadow:0 1px 2px #00000014}}@media (prefers-contrast:more){[data-phone] .vbpo1q_headerCorner:has(button),[data-ds-dark-theme] [data-phone] .vbpo1q_headerCorner:has(button){border-color:var(--dsw-alias-label-secondary);box-shadow:none}}@media (forced-colors:active){[data-phone] .vbpo1q_root[data-phase=active] .vbpo1q_header{pointer-events:auto;background:canvas;border-bottom:1px solid canvastext;position:relative}[data-phone] .vbpo1q_root[data-phase=active] .vbpo1q_header:before{display:none}[data-phone] .vbpo1q_root[data-phase=active]:not(:has([data-slot="conversation.header.notice"]>*)) .vbpo1q_scrollBody{padding-top:0}[data-phone] .vbpo1q_root[data-phase=active]>[data-slot="conversation.header.notice"]>:first-child{margin-top:0}[data-phone] .vbpo1q_headerCorner:has(button),[data-ds-dark-theme] [data-phone] .vbpo1q_headerCorner:has(button){backdrop-filter:none;box-shadow:none;background:buttonface;border:1px solid buttontext}}.vbpo1q_tabs{z-index:1;grid-column:1/-1;gap:36px;margin-top:10px;padding-left:8px;display:flex;position:relative}.vbpo1q_tab{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;padding:0 0 9px;font-size:13px;font-weight:500;line-height:16px;position:relative}.vbpo1q_tab:after{content:"";background:0 0;border-radius:2px;height:2px;position:absolute;bottom:0;left:0;right:0}.vbpo1q_tabActive{color:var(--dsw-alias-state-business-primary)}.vbpo1q_tabActive:after{background:var(--dsw-alias-state-business-primary)}.vbpo1q_viewArea{flex-direction:column;flex:1;min-height:0;display:flex}.vbpo1q_widthHandle{z-index:0;width:min(10px, calc((100% - var(--dsh-chat-content-width)) / 2 - 24px - 24px));cursor:col-resize;position:absolute;top:0;bottom:0}.vbpo1q_widthHandle[data-side=left]{right:calc(50% + var(--dsh-chat-content-width) / 2 + 24px)}.vbpo1q_widthHandle[data-side=right]{left:calc(50% + var(--dsh-chat-content-width) / 2 + 24px)}.vbpo1q_widthHandle:after{content:"";background:linear-gradient(to bottom, transparent calc(var(--dsh-width-handle-pointer-y,50%) - 36px), var(--dsw-alias-scrollbar-bg-l1) calc(var(--dsh-width-handle-pointer-y,50%) - 8px), var(--dsw-alias-scrollbar-bg-l1) calc(var(--dsh-width-handle-pointer-y,50%) + 8px), transparent calc(var(--dsh-width-handle-pointer-y,50%) + 36px));opacity:0;pointer-events:none;border-radius:2px;width:2px;position:absolute;top:0;bottom:0}.vbpo1q_widthHandle[data-side=left]:after{right:4px}.vbpo1q_widthHandle[data-side=right]:after{left:4px}.vbpo1q_widthHandle:hover:after,.vbpo1q_widthHandle[data-dragging]:after{opacity:1}.vbpo1q_widthHandle[data-dragging]{z-index:8}.vbpo1q_root:has([data-conversation-composer-overlay]) .vbpo1q_widthHandle{display:none}.vbpo1q_composerStack{--dsh-composer-stack-gap:6px;gap:var(--dsh-composer-stack-gap);flex-direction:column;display:flex}.vbpo1q_composerSeat{-webkit-user-select:none;user-select:none;--dsh-composer-text-max-height:336px;flex-direction:column;flex:none;display:flex}.vbpo1q_composerSeat :is(input,textarea,[contenteditable=true],[contenteditable=""]){-webkit-user-select:text;user-select:text}.vbpo1q_root[data-phase=active]{overflow:hidden}.vbpo1q_root[data-phase=active] .vbpo1q_header{flex:none}.vbpo1q_body{--dsh-chat-content-width:var(--dsh-chat-user-width,clamp(680px, calc(var(--dsh-conversation-column-width,0px) * .64), 920px));--dsh-composer-card-max-width:calc(var(--dsh-chat-content-width) + 32px);--dsh-composer-side-clearance:16px;--dsh-composer-dock-inset:8px;flex-direction:column;flex:1;min-height:0;display:flex;position:relative}.vbpo1q_embeddedBody{--dsh-chat-content-width:min(calc(100% - 32px), 920px);--dsh-composer-card-max-width:min(calc(100% - 16px), 952px);--dsh-composer-side-clearance:8px;--dsh-composer-dock-inset:8px;overflow:hidden}.vbpo1q_scrollBody{scrollbar-gutter:stable;flex-direction:column;flex:1;min-height:0;margin-right:2px;display:flex;overflow:hidden auto}.vbpo1q_scrollBody::-webkit-scrollbar-track{margin:2px}.vbpo1q_root[data-phase=active] .vbpo1q_viewArea,.vbpo1q_embeddedBody[data-content-phase=active] .vbpo1q_viewArea{flex:1 0 auto;min-height:auto}.vbpo1q_root[data-phase=active] .vbpo1q_composerSeat,.vbpo1q_embeddedBody[data-content-phase=active] .vbpo1q_composerSeat{z-index:7;background:var(--dsh-phone-composer-mask,linear-gradient(180deg, color-mix(in srgb, var(--dsw-alias-bg-base) 0%, transparent) 0px, var(--dsw-alias-bg-base) 36px));position:sticky;bottom:0}@supports (backdrop-filter:blur(14px)){[data-phone] .vbpo1q_composerSeat:where(:has([data-chain-overlay-fallback=conversation\\.composer]:only-child [data-composer-card])){--dsh-phone-composer-mask:linear-gradient(180deg, transparent 0px, color-mix(in srgb, var(--dsw-alias-bg-base) 60%, transparent) 36px, color-mix(in srgb, var(--dsw-alias-bg-base) 60%, transparent) calc(100% - 28px), var(--dsw-alias-bg-base) 100%)}}@media (prefers-reduced-transparency:reduce),(prefers-contrast:more),(forced-colors:active){[data-phone] .vbpo1q_composerSeat{--dsh-phone-composer-mask:initial}}body[data-codexhost-wallpaper] .vbpo1q_root[data-phase=active] .vbpo1q_composerSeat,body[data-codexhost-wallpaper] .vbpo1q_embeddedBody[data-content-phase=active] .vbpo1q_composerSeat{background:0 0}.vbpo1q_root[data-phase=active] .vbpo1q_composerSeat:has([data-trigger-menu]){z-index:9}.vbpo1q_scrollBody[data-selection-drag]{scroll-padding-bottom:var(--dsh-composer-height,0px)}.vbpo1q_scrollBody[data-selection-drag]>.vbpo1q_composerSeat :is(input,textarea,[contenteditable=true],[contenteditable=""]){pointer-events:none}.vbpo1q_scrollBody:has([data-conversation-composer-overlay]){scrollbar-gutter:auto;position:relative;overflow:hidden auto}.vbpo1q_scrollBody:has([data-conversation-composer-overlay])>[data-slot=conversation\\.session]>.vbpo1q_viewArea{flex:1 1 0;min-height:0;overflow:hidden}.vbpo1q_scrollBody:has([data-conversation-composer-overlay])>.vbpo1q_composerSeat{right:var(--dsh-scrollbar-width);position:absolute;bottom:0;left:0}.vbpo1q_composerHero{width:min(calc(var(--dsh-composer-card-max-width) + 2 * var(--dsh-composer-side-clearance)), 100%);z-index:1;align-self:center;gap:16px;padding-bottom:32px}.vbpo1q_heroTopBarInner{align-items:center;gap:4px;width:100%;min-width:0;display:flex}.vbpo1q_heroAgentPresetSeat{flex:none;align-items:center;margin-left:auto;display:flex}.vbpo1q_heroAgentPresetSeat:empty{display:none}.vbpo1q_root[data-phase=hero] .vbpo1q_scrollBody,.vbpo1q_embeddedBody[data-content-phase=hero] .vbpo1q_scrollBody{justify-content:center;overflow-y:auto}.vbpo1q_root[data-phase=settling] .vbpo1q_composerSeat,.vbpo1q_embeddedBody[data-content-phase=settling] .vbpo1q_composerSeat{visibility:hidden}`,document.head.appendChild(e)}var Q={body:`vbpo1q_body`,composerHero:`vbpo1q_composerHero`,composerSeat:`vbpo1q_composerSeat`,composerStack:`vbpo1q_composerStack`,crumb:`vbpo1q_crumb`,crumbCurrent:`vbpo1q_crumbCurrent`,crumbSeg:`vbpo1q_crumbSeg`,crumbSep:`vbpo1q_crumbSep`,crumbSubagent:`vbpo1q_crumbSubagent`,crumbs:`vbpo1q_crumbs`,embeddedBody:`vbpo1q_embeddedBody`,header:`vbpo1q_header`,headerActions:`vbpo1q_headerActions`,headerBlank:`vbpo1q_headerBlank`,headerCorner:`vbpo1q_headerCorner`,headerLeading:`vbpo1q_headerLeading`,headerSessionless:`vbpo1q_headerSessionless`,headerUtilities:`vbpo1q_headerUtilities`,heroAgentPresetSeat:`vbpo1q_heroAgentPresetSeat`,heroTopBarInner:`vbpo1q_heroTopBarInner`,phoneTrailingAction:`vbpo1q_phoneTrailingAction`,root:`vbpo1q_root`,scrollBody:`vbpo1q_scrollBody`,tab:`vbpo1q_tab`,tabActive:`vbpo1q_tabActive`,tabs:`vbpo1q_tabs`,titleCenter:`vbpo1q_titleCenter`,titleCluster:`vbpo1q_titleCluster`,titleRow:`vbpo1q_titleRow`,viewArea:`vbpo1q_viewArea`,widthHandle:`vbpo1q_widthHandle`};let Lk=`dsh.conversation.contentWidth`;function Rk(){let e=localStorage.getItem(Lk);if(e===null)return null;let t=Number(e);return Number.isFinite(t)&&t>0?t:null}function zk(e,t){let n=Math.max(640,e-176);return t===null?Math.max(680,Math.min(e*.64,920)):Math.min(Math.max(t,640),n)}function Bk(e,t){if(e.deltaMode===1){let n=Number.parseFloat(getComputedStyle(t).lineHeight);return e.deltaY*(Number.isFinite(n)?n:16)}return e.deltaMode===2?e.deltaY*t.clientHeight:e.deltaY}function Vk(e){let t=(0,g.useRef)(!1),n=(0,g.useRef)(0),r=(0,g.useRef)(0),i=(0,g.useRef)(0),a=(0,g.useRef)(null),o=(0,g.useRef)(e);o.current=e;let s=()=>{let e=i.current-r.current,t=o.current.side===`right`?e:-e;return n.current+t*2},c=()=>{a.current!==null&&(cancelAnimationFrame(a.current),a.current=null)},l=(0,g.useCallback)(e=>{e.button===0&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),r.current=e.clientX,i.current=e.clientX,n.current=o.current.onStart(),t.current=!0,e.currentTarget.toggleAttribute(`data-dragging`,!0))},[]),u=(0,g.useCallback)(e=>{if(!t.current||!e.currentTarget.hasPointerCapture(e.pointerId))return;let n=e.currentTarget.getBoundingClientRect();e.currentTarget.style.setProperty(`--dsh-width-handle-pointer-y`,`${e.clientY-n.top}px`),i.current=e.clientX,a.current??=requestAnimationFrame(()=>{a.current=null,o.current.onDrag(s())})},[]),d=(0,g.useCallback)(e=>{t.current&&e.currentTarget.hasPointerCapture(e.pointerId)&&(t.current=!1,e.currentTarget.toggleAttribute(`data-dragging`,!1),e.currentTarget.releasePointerCapture(e.pointerId),c(),i.current=e.clientX,i.current!==r.current&&o.current.onCommit(s()),o.current.onEnd())},[]),f=(0,g.useCallback)(e=>{t.current&&(t.current=!1,e.currentTarget.toggleAttribute(`data-dragging`,!1),c(),o.current.onEnd())},[]),p=(0,g.useCallback)(e=>{let t=e.currentTarget.parentElement;
166
+ `),t+=i.draft;for(let t of i.occurrences)n.push({...t,offset:e+t.offset})}let i=new Set(r.map(e=>e.id));this.responseAnnotations=[...r,...this.responseAnnotations.filter(e=>!i.has(e.id))],this.restoringFailures=!0;try{this.draftEditor.restoreDraft(t,n),this.draftEditor.clearHistory(),this.failedRestoreRev=this.rev}finally{this.restoringFailures=!1}this.publish()}restoreAttachments(e){if(e.length===0)return;let t=new Set(this.attachmentIds),n=e.filter(e=>!t.has(e));n.length!==0&&(this.attachmentIds=[...n,...this.attachmentIds],this.publish())}adjudicate(e,t){let n=this.deps.inputTriggers?.();n===void 0?this.dispatchRun({type:`adjudicated`,attempt:e,outcome:void 0}):(this.adjudication=n.adjudicate(t.trim(),e.signal,{attachments:this.attachmentIds.length}),this.adjudication.then(t=>{this.adjudication=void 0,!this.dead(e)&&this.dispatchRun({type:`adjudicated`,attempt:e,outcome:t})},t=>{if(this.adjudication=void 0,this.dead(e))return;let n=t instanceof Error?t.message:String(t);this.dispatchRun({type:`adjudication-failed`,attempt:e,message:n})}))}beginSubmit(e,t,n){let r=t.attachments===!0?[...this.attachmentIds]:[];Promise.resolve().then(async()=>{let i=r.length>0?await this.deps.commandAttachments.serialize(r):[];if(!this.dead(e))return t.submit(n,this.deps.actx,i)}).then(t=>{if(!(t===void 0||this.dead(e))){if(t.kind===`success`&&r.length>0){let e=new Set(r);this.attachmentIds=this.attachmentIds.filter(t=>!e.has(t)),this.deps.commandAttachments.release(r)}this.dispatchRun({type:`submit-settled`,attempt:e,ok:t.kind===`success`,draft:this.projection.clipboardText,outcome:t,...t.kind===`error`&&t.text===void 0?{message:`command failed`}:{}})}},t=>{if(this.dead(e))return;let n=t instanceof Error?t.message:String(t);this.dispatchRun({type:`submit-settled`,attempt:e,ok:!1,draft:this.projection.clipboardText,message:n})})}dead(e){return this.disposed||e.signal.aborted}compose(){let e=this.core.state;return{draft:this.projection.clipboardText,attachmentIds:this.attachmentIds,responseAnnotations:this.responseAnnotations,...this.hoveredResponseAnnotationId===void 0?{}:{hoveredResponseAnnotationId:this.hoveredResponseAnnotationId},draftRev:this.rev,...this.primaryAction===void 0?{}:{primaryAction:this.primaryAction},phase:e.phase,...e.claim===void 0?{}:{claim:e.claim},occurrences:this.projection.occurrences,queue:this.deps.inbox?.getSnapshot()?.[`next-turn`]??nk}}publish(){let e=this.compose();this.state.set(e);let t=this.draftSnapshot;t!==this.lastPublishedDraft&&(this.lastPublishedDraft=t,this.scheduleDraftPersistence(t))}};function ak(e,t){let{state:n,timestamp:r,mode:i}=t;if(n===void 0)return;let a=n.model;e.get(`productAnalytics`)?.track(`send_button_click`,{...n.sessionId===void 0?{}:{session_id:n.sessionId},...a===void 0?{}:{model_name:`${a.provider}/${a.name}`,...a.effort===void 0?{}:{thinking_effort:a.effort}},run_mode:n.runMode,msg_type:n.running?i:`default`},r)}var ok=class{rootCtx;t;pendingDraft;shells=/* @__PURE__ */ new WeakMap;constructor(e,t,n){this.rootCtx=e,this.t=t,this.pendingDraft=n}for(e){let t=this.sessions(),n=t.sessionOf(e),r=n===void 0?void 0:t.binding(n.sessionId);if(r===void 0||r.session!==n)throw Error(`conversation.input.for requires a retained Session scope`);return this.shellFor(r)}captureReferenceInsertion(e){let t=this.sessions(),n=this.shells.get(e);if(t.binding(e.sessionId)!==e||n===void 0)return;let r=this.rootCtx.get(`conversation`);if(r===void 0)return;let i=n.actions.captureInsertion(),a=r.blocks.storeFor(e.sessionId),o=this.rootCtx.uiSession.sessionStatus,s=!1,c=()=>{let r=e.session.getSnapshot();return!s&&t.binding(e.sessionId)===e&&r.openState===`open`&&!r.removed&&a.getSnapshot()===void 0&&o.getSnapshot().get(e.sessionId)?.pendingInteraction===void 0&&n.snapshot.draftRev===i.draftRev&&n.canInsertReferences()};return{getSnapshot:c,subscribe:r=>{let i=[t.list.subscribe(r),e.session.subscribe(r),n.state.subscribe(r),a.subscribe(r),o.subscribe(r),n.editor.registerEditableListener(r),n.editor.registerRootListener(r)];return()=>i.forEach(e=>e())},insert:e=>{let t=c();return s=!0,t&&n.insertReferences([e],i)}}}requestDraftInitialization(e,t){if(this.sessions().binding(e.sessionId)!==e)throw Error(`conversation.input.requestDraftInitialization requires a retained Session binding`);return this.shellFor(e).requestDraftInitialization(t)}adoptPendingDraft(e,t){if(this.sessions().binding(e.sessionId)!==e)throw Error(`conversation.input.adoptPendingDraft requires a retained Session binding`);let n=this.pendingDraft?.take(),r=this.shellFor(e);return t===void 0?n!==void 0&&n.text!==``?(r.setDraft(n.text),`applied`):`preserved`:n?.modified?r.requestDraftInitialization({prompt:n.text,clearPreviousDraft:!0}):r.requestDraftInitialization(t)}shellFor(e){let t=this.shells.get(e);if(t!==void 0)return t;let{session:n,ctx:r}=e,i=new ik({actx:r,submissionState:()=>{let e=n.getSnapshot(),t=n.projections.faceOf(`modelSelection`).getSnapshot(),r=n.projections.faceOf(`plan`).getSnapshot(),i=n.projections.faceOf(`goal`).getSnapshot(),a=t?.next??t?.lastUsed;return Object.freeze({...e.blank?{}:{sessionId:e.sessionId},...a==null?{}:{model:Object.freeze({provider:a.provider,name:a.model,...a.reasoningEffort===void 0?{}:{effort:a.reasoningEffort}})},runMode:r?.active?`plan`:i?.goal.phase===`active`?`goal`:`default`,running:e.running})},messageSubmitted:e=>{ak(this.rootCtx,e)},inputTriggers:()=>this.controller(r),popup:()=>this.popup(r),inbox:n.projections.faceOf(`inbox`),defaultSink:(e,t,r,i,a)=>this.sink(n,e,t,r,i,a),steerQueue:()=>{this.steerQueue(n,i)},commandAttachments:{serialize:async e=>(await this.conversation().serializeDraftAttachments(e)).attachments,release:e=>{let t=this.rootCtx.get(`conversation`);for(let n of e)t?.releaseDraftAttachment(n)},unsupportedNotice:e=>this.t(`command.attachmentsUnsupported`,{command:e.trim().replace(/^\//u,``)})}});return this.shells.set(e,i),r.effect(()=>{let t=[r.on(`slash/input-begin-command`,e=>i.beginCommand(e.claim,e.span)?!0:void 0),r.on(`slash/input-insert-reference`,e=>i.insertReference(e.reference,e.span)?!0:void 0),r.on(`slash/input-consume-token`,e=>i.consumeToken(e.guard)?!0:void 0),r.on(`slash/input-insert-text`,e=>i.insertText(e.text,e.span,e.continue===!0)?!0:void 0)];return()=>{for(let e of t)e();let n=i.dispose();this.shells.delete(e);let r=this.rootCtx.get(`conversation`);for(let e of n)r?.releaseDraftAttachment(e)}},`conversation.input: session shell`),r.inject([`inputTriggers`],e=>{e.effect(()=>(i.refreshLexiconSubscription(),()=>{i.refreshLexiconSubscription()}),`conversation.input: reference catalogs`)}),i.setDraft(Yu(e.sessionId)),i}shell(e){let t=this.sessions().binding(e);if(t===void 0)throw Error(`conversation.input: session "${e}" resolved no binding`);return this.shellFor(t)}keyboard(e){return this.shell(e)}canPickFiles(e){let t=this.sessions().binding(e);return t!==void 0&&this.shells.get(t)?.canPickFiles()===!0}pickFiles(e){let t=this.sessions().binding(e);t!==void 0&&this.shells.get(t)?.pickFiles()}inputTriggers(e){let t=this.sessions().binding(e);return t===void 0?void 0:this.controller(t.ctx)}sink(e,t,n,r,i,a){return t===``&&n.length===0?Promise.resolve({kind:`success`}):this.conversation().sendSession(e,t,n,r,i,a)}async steerQueue(e,t){let n=e.projections.faceOf(`inbox`).getSnapshot()?.[`next-turn`]??[];if(n.length!==0)for(let r of n){let n=await e.updateQueue(r.id,{kind:`steer`});if(!n.ok){if(n.error.code===`session/steer-unavailable`||n.error.code===`session/queue-item-not-found`)return;t.notify(`error`,this.t(`queue.steerFailed`));return}}}controller(e){if(this.sessions().sessionOf(e)!==void 0)return this.rootCtx.get(`inputTriggers`)?.sessionOf(e)}popup(e){if(this.sessions().sessionOf(e)!==void 0)return this.rootCtx.get(`commandUi`)?.popupFor(e)}sessions(){let e=this.rootCtx.get(`sessions`);if(e===void 0)throw Error(`conversation.input: sessions service unavailable`);return e}conversation(){let e=this.rootCtx.get(`conversation`);if(e===void 0)throw Error(`conversation.input: conversation service unavailable`);return e}};let sk=/* @__PURE__ */ new Map;var ck=class{runtime;unregister;textStore=(0,f.createSnapshotStore)(``);activeToken=null;modified=!1;seeding=!1;text=this.textStore;constructor(){this.runtime=new $O({onUpdate:()=>{let e=this.runtime.refreshProjection(),t=this.runtime.projection.clipboardText;e.clipboardText!==t&&(this.seeding||(this.modified=!0),this.textStore.set(t))},openReference:()=>!1,activeClaimToken:()=>null,lexicon:()=>sk,resolveLexicon:()=>void 0}),this.unregister=this.runtime.register()}get editor(){return this.runtime.editor}syncCreation(e){if(e.state===`idle`){(this.activeToken!==null||this.textStore.getSnapshot()!==``)&&(this.activeToken=null,this.clearEditor());return}let t=e.token??null;t!==this.activeToken&&(this.activeToken=t,this.seed(e.initialPrompt??``))}paste(e){this.runtime.paste(e)}take(){if(this.activeToken===null)return;let e={text:this.runtime.projection.clipboardText,modified:this.modified};return this.activeToken=null,this.clearEditor(),e}dispose(){this.activeToken=null,this.unregister()}seed(e){this.seeding=!0;try{this.modified=!1,this.runtime.setDraft(e),this.runtime.clearHistory(),this.textStore.set(this.runtime.projection.clipboardText)}finally{this.seeding=!1}}clearEditor(){this.seed(``)}};let lk=`busyEnter`,uk=[`queue`,`steer`],dk=`queue`,fk={[lk]:S.union([...uk]).default(dk)};S.object(fk);function pk(e,t,n,r){return!t||!r?`queue`:n===`enter`?e:e===`queue`?`steer`:`queue`}var mk=class{busyEnter=(0,f.createSnapshotStore)(dk);unsubscribe;host;constructor(e){this.host=e,e!==void 0&&(this.unsubscribe=e.subscribe(()=>{this.adopt(e)}),this.adopt(e))}dispose(){this.unsubscribe?.()}setBusyEnter(e){this.busyEnter.getSnapshot()!==e&&(this.busyEnter.set(e),this.host?.set(lk,e))}adopt(e){let t=e.getSnapshot().value;t!==void 0&&this.busyEnter.getSnapshot()!==t.busyEnter&&this.busyEnter.set(t.busyEnter)}};async function hk(e,t){let n=/* @__PURE__ */ new Map;for(let t of e)n.has(t.attachmentId)||n.set(t.attachmentId,t);let r=/* @__PURE__ */ new Map;return await Promise.all([...n.entries()].map(async([e,n])=>{let i=await t(n),a=await fetch(i);if(!a.ok)throw Error(`Queued image preview fetch failed (${a.status})`);r.set(e,{blob:await a.blob(),mediaType:n.mediaType})})),r}function gk(e,t,n){let{annotations:r,body:i}=SO(t);if(r.length>0&&e.addResponseAnnotations(e.takeSubmittedAnnotationAnchors(n,r)),i!==``){let t=e.draftSnapshot;e.setDraft({...t,text:t.text===``?i:`${t.text}\n${i}`})}}function _k(e){let{sessionId:t,shell:n,conversation:r,message:i,imageBlobs:a,rpcId:o}=e,s=()=>{if(n.isDisposed)throw Error(`Queued message was removed, but the session composer was closed before restoring.`);let{phase:e}=n.snapshot;if(e!==`plain`&&e!==`claimed`)return!1;if(i.attachments.length>0){if(r===void 0)throw Error(`Queued attachments cannot be restored without a conversation controller.`);let e=i.attachments.map(e=>{if(e.kind!==`image`)return e;let t=a.get(e.file.attachmentId);if(t===void 0)return e;let n=new File([t.blob],e.file.name,{type:t.blob.type||t.mediaType||`image/png`});return{...e,imageFile:n}}),o=r.restoreStagedDrafts(t,e);if(!n.addAttachments(o.map(e=>e.id))){if(r.releaseDraftAttachments(o),n.isDisposed)throw Error(`Queued message was removed, but the session composer was closed before restoring.`);return!1}}return i.text!==``&&gk(n,i.text,o),n.actions.persistDraft(),n.focus(`end`),!0};try{if(s())return Promise.resolve()}catch(e){return Promise.reject(e)}return new Promise((e,t)=>{let r=!1,i=!1,a,o=()=>{if(!(r||i)){i=!0;try{if(!s())return;r=!0,a?.(),e()}catch(e){r=!0,a?.(),t(e)}finally{i=!1}}};a=n.state.subscribe(o),o()})}let vk=`@deepseek-ai/dsh-client-ui-conversation/QueueDock.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(vk)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=vk,e.textContent=`.ZMI-0G_dock{box-sizing:border-box;width:calc(100% - var(--dsh-composer-side-clearance) - var(--dsh-composer-side-clearance) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));max-width:calc(var(--dsh-composer-card-max-width) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));margin:0 auto calc(0px - var(--dsh-composer-stack-gap) - 3px);padding:0 var(--dsh-composer-dock-inset);flex:none}.ZMI-0G_pendingAttachment{flex-direction:column;gap:2px;display:inline-flex}.ZMI-0G_panel{z-index:0;border-radius:var(--dsw-radius-lg) var(--dsw-radius-lg) 0 0;--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);width:100%;padding:2px 0;position:relative;overflow:hidden}.ZMI-0G_panel:before{z-index:-1;border-radius:inherit;background:var(--dsw-specific-menu);backdrop-filter:var(--dsw-menu-backdrop-filter);content:"";pointer-events:none;position:absolute;inset:0}.ZMI-0G_panel:after{border:.5px solid var(--dsw-alias-border-l1);border-radius:inherit;content:"";pointer-events:none;border-bottom:none;position:absolute;inset:0}.ZMI-0G_paused{color:var(--dsw-alias-label-tertiary);font:var(--dsw-font-xs-13);padding:6px 12px 2px}.ZMI-0G_header{box-sizing:border-box;border-radius:var(--dsw-radius-md);width:100%;height:36px;color:var(--dsw-alias-label-primary);text-align:left;cursor:pointer;background:0 0;border:none;align-items:center;gap:10px;padding:4px 12px;display:flex}.ZMI-0G_header:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.ZMI-0G_header:disabled{cursor:default}.ZMI-0G_lead{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.ZMI-0G_count{min-width:0;font-family:Inter, var(--dsw-font-family);flex:auto;font-size:13px;font-weight:500;line-height:24px}.ZMI-0G_chevron{width:14px;height:14px;color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.ZMI-0G_list{max-height:180px;margin:0;padding:0;list-style:none;overflow-y:auto}.ZMI-0G_row{box-sizing:border-box;border-radius:var(--dsw-radius-md);align-items:center;gap:10px;width:100%;min-height:36px;padding:4px 5px 4px 12px;display:flex}.ZMI-0G_row+.ZMI-0G_row{box-shadow:inset 0 1px 0 var(--dsw-alias-border-l1)}.ZMI-0G_attachments{flex:none;gap:4px;min-width:0;max-width:55%;display:flex;overflow:hidden}.ZMI-0G_pendingRow .ZMI-0G_attachments{flex-shrink:1}.ZMI-0G_file{border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-base);box-sizing:border-box;flex:0 180px;align-items:center;gap:4px;min-width:74px;height:24px;padding:0 6px;display:inline-flex;overflow:hidden}.ZMI-0G_fileIcon{flex:none;width:16px;height:16px;display:inline-flex}.ZMI-0G_fileName{min-width:0;color:var(--dsw-alias-label-primary-dimmed);font:var(--dsw-font-xs-13);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.ZMI-0G_fileSize{color:var(--dsw-alias-label-tertiary);white-space:nowrap;flex:none;font-size:10px}.ZMI-0G_thumb{border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-xs);background:var(--dsw-alias-bg-base);object-fit:cover;width:24px;height:24px}.ZMI-0G_annotationBadge{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 14%, transparent);height:20px;color:var(--dsw-alias-state-business-primary);white-space:nowrap;border-radius:999px;flex:none;align-items:center;padding:0 7px;font-size:11px;font-weight:500;line-height:1;display:inline-flex}.ZMI-0G_preview{min-width:0;font:var(--dsw-font-xs-13);font-family:Inter, var(--dsw-font-family);color:var(--dsw-alias-label-primary-dimmed);text-overflow:ellipsis;white-space:nowrap;word-break:break-word;flex:auto;overflow:hidden}.ZMI-0G_previewFallback{color:var(--dsw-alias-label-tertiary)}.ZMI-0G_actions{flex:none;align-items:center;gap:10px;display:flex}.ZMI-0G_actionWrap{flex:none;display:inline-flex}.ZMI-0G_actionWrap>.ZMI-0G_action:disabled{pointer-events:none}.ZMI-0G_status{color:var(--dsw-alias-label-tertiary);font:var(--dsw-font-xs-13);white-space:nowrap;flex:none}.ZMI-0G_action{corner-shape:round;width:28px;height:28px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;border-radius:999px;flex:none;place-items:center;padding:0;display:grid}.ZMI-0G_action:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.ZMI-0G_action:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}.ZMI-0G_action:disabled{cursor:default;opacity:.45}`,document.head.appendChild(e)}var Z={action:`ZMI-0G_action`,actionWrap:`ZMI-0G_actionWrap`,actions:`ZMI-0G_actions`,annotationBadge:`ZMI-0G_annotationBadge`,attachments:`ZMI-0G_attachments`,chevron:`ZMI-0G_chevron`,count:`ZMI-0G_count`,dock:`ZMI-0G_dock`,file:`ZMI-0G_file`,fileIcon:`ZMI-0G_fileIcon`,fileName:`ZMI-0G_fileName`,fileSize:`ZMI-0G_fileSize`,header:`ZMI-0G_header`,lead:`ZMI-0G_lead`,list:`ZMI-0G_list`,panel:`ZMI-0G_panel`,paused:`ZMI-0G_paused`,pendingAttachment:`ZMI-0G_pendingAttachment`,pendingRow:`ZMI-0G_pendingRow`,preview:`ZMI-0G_preview`,previewFallback:`ZMI-0G_previewFallback`,row:`ZMI-0G_row`,status:`ZMI-0G_status`,thumb:`ZMI-0G_thumb`};let yk=[];function bk(e){let t=e.replace(/\s+/g,` `).trim(),n=Array.from(t);return n.length>200?`${n.slice(0,200).join(``)}…`:t}function xk(e,t){let n=bk(t);if(e.length===0)return{annotations:e,preview:n,fallbackPreview:``,annotationTooltip:``};let r=e[0];return{annotations:e,preview:n,fallbackPreview:n===``?bk(r.annotation??r.text):``,annotationTooltip:e.map((e,t)=>`${String(t+1)}. ${bk(e.annotation??e.text)}`).join(`
167
+ `)}}function Sk(e){let t=[],n=[];for(let r of e)if(r.type!==`image`&&r.type!==`file`){if(r.type===`text`){let e=SO(r.text);t.push(...e.annotations),e.body!==``&&n.push(e.body)}else n.push(`[${r.type}]`)}return xk(t,n.join(` `))}function Ck(e){let t=SO(e);return xk(t.annotations,t.body)}function wk({display:e,t}){return/* @__PURE__ */ (0,h.jsxs)(h.Fragment,{children:[e.annotations.length>0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.annotationBadge,"data-queue-annotations":e.annotations.length,title:e.annotationTooltip,children:t(`annotation.trayCount`,{count:e.annotations.length})}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:e.preview===``&&e.fallbackPreview!==``?`${Z.preview} ${Z.previewFallback}`:Z.preview,children:e.preview===``?e.fallbackPreview:(0,d.projectUserText)(e.preview,[])})]})}function Tk(e){return e.every(e=>e.type===`text`)?e.map(e=>e.text).join(``):null}function Ek(e){let t=[];for(let n of e){if(n.type===`image`){let{attachment:e}=n;e!==void 0&&t.push({type:`image`,attachment:e})}if(n.type===`file`){let{attachment:e}=n;e!==void 0&&t.push({type:`file`,attachment:e})}}return t}function Dk({attachment:e,label:t}){return/* @__PURE__ */ (0,h.jsxs)(`span`,{className:Z.file,"aria-label":t,title:e.name,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.fileIcon,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.FileTypeIcon,{path:e.name,size:16})}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.fileName,children:e.name}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.fileSize,children:(0,d.fileSizeText)(e.bytes)})]})}function Ok({attachment:e,loadImage:t,label:n}){let[r,i]=(0,g.useState)(null);return(0,g.useEffect)(()=>{let n=!0;return t(e).then(e=>{n&&i(e)},()=>{}),()=>{n=!1}},[e,t]),r===null?/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.thumb,"aria-hidden":!0}):/* @__PURE__ */ (0,h.jsx)(`img`,{className:Z.thumb,src:r,alt:n})}function kk({upload:e,t}){let n=(0,g.useSyncExternalStore)(e.subscribe,e.getSnapshot);return n?.status===`uploading`?/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.status,role:`status`,"data-upload-progress":!0,children:n.total===void 0||n.total===0?t(`file.uploading`):t(`file.uploadingPercent`,{percent:Math.round(Math.min(1,(n.loaded??0)/n.total)*100)})}):null}function Ak({useSession:e,useProjection:t,updateQueue:n,editQueue:r,hasStructuredQueueEdit:i,notify:a,loadImage:o,t:s}){let c=t(`inbox`),l=t(`queueState`),u=e(e=>e.pendingSubmissions),f=(0,g.useMemo)(()=>{let e=c?.[`next-turn`]??yk,t=new Set(u.filter(e=>e.placement===`transcript`).map(e=>e.requestId));return t.size===0?e:e.filter(({source:e})=>e.kind!==`user`||!(`rpcId`in e)||!t.has(e.rpcId))},[c,u]),p=(0,g.useMemo)(()=>{let e=new Set(f.flatMap(({source:e})=>e.kind===`user`&&`rpcId`in e?[e.rpcId]:[]));return u.filter(t=>t.placement===`queued`&&!e.has(t.requestId))},[u,f]),m=f.length+p.length,_=e(e=>e.running),v=e(e=>e.subagent===null||e.subagent.address.mode===`continuable`)&&l?.stale!==!0,y=l?.previewOnly===!0,b=(0,g.useRef)(!1),[ee,te]=(0,g.useState)(null),[ne,re]=(0,g.useState)(!0),ie=(0,g.useId)(),ae=l?.pausedReason??null,oe=ae===`interrupted`?s(`queue.paused.interrupted`):ae===`outcome-unknown`?s(`queue.paused.unknown`):ae===`failed`?s(`queue.paused.failed`):null;if((0,g.useEffect)(()=>{m===0&&!ne&&re(!0)},[ne,m]),m===0)return null;let se=v&&ee!==null,ce=!ne||se,le=m===1||ce,ue=async(e,t,r)=>{if(b.current)return!1;b.current=!0,te(e);try{return typeof t==`function`?await t():await n(e,t),!0}catch{return a(`error`,y?s(`queue.remoteActionFailed`):r),!1}finally{b.current=!1,te(t=>t===e?null:t)}};return/* @__PURE__ */ (0,h.jsx)(`div`,{className:Z.dock,"data-queue-dock":``,children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Z.panel,children:[l?.stale&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:Z.paused,role:`status`,children:s(`queue.remoteStale`)}),oe!==null&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:Z.paused,role:`status`,children:oe}),m>1&&/* @__PURE__ */ (0,h.jsxs)(`button`,{type:`button`,className:Z.header,"aria-controls":ie,"aria-expanded":ce,disabled:se,onClick:()=>{re(e=>!e)},children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.lead,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconQueueOutlineRegular,{})}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.count,children:s(`queue.count`,{n:m})}),!le&&p.length>0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.status,role:`status`,children:s(`queue.sending`)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.chevron,"aria-hidden":!0,children:ce?/* @__PURE__ */ (0,h.jsx)(d.IconChevronDownOutlineRegular,{}):/* @__PURE__ */ (0,h.jsx)(d.IconChevronUpOutlineRegular,{})})]}),/* @__PURE__ */ (0,h.jsxs)(`ul`,{id:ie,className:Z.list,hidden:!le,children:[le&&f.map(e=>{let t=Ek(e.content),n=Sk(e.content),a=e.source.kind===`user`&&`rpcId`in e.source?e.source.rpcId:void 0,c=l?.editable===void 0?(()=>{let t=Tk(e.content);return t===null?null:{kind:`legacyText`,text:t,...a===void 0?{}:{rpcId:a}}})():(()=>{let n=l.editable?.[e.id];return n===void 0||!i()?null:{kind:`structured`,revision:n,images:t.flatMap(e=>e.type===`image`?[e.attachment]:[]),...a===void 0?{}:{rpcId:a}}})(),u=c!==null;return/* @__PURE__ */ (0,h.jsxs)(`li`,{className:Z.row,children:[m===1&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.lead,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconQueueOutlineRegular,{})}),t.length>0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.attachments,children:t.map((e,t)=>e.type===`image`?/* @__PURE__ */ (0,h.jsx)(Ok,{attachment:e.attachment,loadImage:o,label:s(`queue.image`)},`${e.attachment.attachmentId}:${t}`):/* @__PURE__ */ (0,h.jsx)(Dk,{attachment:e.attachment,label:s(`queue.file`,{name:e.attachment.name})},`${e.attachment.attachmentId}:${e.attachment.name}:${t}`))}),/* @__PURE__ */ (0,h.jsx)(wk,{display:n,t:s}),v&&/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Z.actions,children:[!y&&/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:!0,label:s(u?`queue.edit`:`queue.edit.unsupported`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.actionWrap,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Z.action,"aria-label":s(`queue.edit`),disabled:ee!==null||!u,onClick:()=>{c!==null&&ue(e.id,()=>r(e.id,c),s(`queue.editFailed`))},children:/* @__PURE__ */ (0,h.jsx)(d.IconEditOutlineRegular,{size:14})})})}),/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:!0,label:s(`queue.remove`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Z.action,"aria-label":s(`queue.remove`),disabled:ee!==null,onClick:()=>{ue(e.id,{kind:`remove`},s(`queue.removeFailed`))},children:/* @__PURE__ */ (0,h.jsx)(d.IconTrashOutlineRegular,{size:14})})}),(!y||!_)&&/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:!0,label:s(_?`queue.steer`:`queue.resume`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Z.action,"aria-label":s(_?`queue.steer`:`queue.resume`),disabled:ee!==null,onClick:()=>{ue(e.id,{kind:`steer`},s(_?`queue.steerFailed`:`queue.resumeFailed`))},children:/* @__PURE__ */ (0,h.jsx)(d.IconSendOutlineRegular,{})})})]})]},e.id)}),le&&p.map(e=>{let t=Ck(e.text);return/* @__PURE__ */ (0,h.jsxs)(`li`,{className:`${Z.row} ${Z.pendingRow}`,"data-submission-echo":``,children:[m===1&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.lead,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconQueueOutlineRegular,{})}),e.attachments.length>0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.attachments,children:e.attachments.map((e,t)=>/* @__PURE__ */ (0,h.jsxs)(`span`,{className:Z.pendingAttachment,children:[e.type===`image`?/* @__PURE__ */ (0,h.jsx)(`img`,{className:Z.thumb,src:e.value.previewUrl,alt:s(`queue.image`)}):/* @__PURE__ */ (0,h.jsx)(Dk,{attachment:e.value,label:s(`queue.file`,{name:e.value.name})}),e.upload&&/* @__PURE__ */ (0,h.jsx)(kk,{upload:e.upload,t:s})]},t))}),/* @__PURE__ */ (0,h.jsx)(wk,{display:t,t:s}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.status,role:`status`,children:s(`queue.sending`)}),v&&!y&&/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Z.actions,children:[/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Z.action,"aria-label":s(`queue.edit`),title:s(`queue.sending`),disabled:!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconEditOutlineRegular,{size:14})}),/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Z.action,"aria-label":s(`queue.remove`),title:s(`queue.sending`),disabled:!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconTrashOutlineRegular,{size:14})}),/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Z.action,"aria-label":s(`queue.steer`),title:s(`queue.sending`),disabled:!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconSendOutlineRegular,{})})]})]},e.requestId)})]})]})})}let jk={name:`conversation-queue-dock`,inject:[`slots`,`conversation`,`sessions`,`uiConversation`],apply(e,t){e.slots.inject(`conversation.input.dock`,()=>e.slots.register({name:`conversation.input.dock`,id:`queue`,order:20,locale:ed,inject:n=>{let r=e.sessions.scope(n);if(r===void 0)throw Error(`queue dock: session "${n}" resolved no scope`);let i=r.get(`conversation`);if(i===void 0)throw Error(`queue dock: conversation service unavailable`);let a=t=>e.uiConversation.imageUrl(n,t);return{updateQueue:(e,t)=>i.updateQueue(e,t),hasStructuredQueueEdit:()=>{let t=e.get(`conversation`);return e.get(`queueMessageEditing`)!==void 0&&typeof t?.restoreStagedDrafts==`function`},editQueue:async(r,o)=>{let s=e.sessions.retain(n,{source:`controllerOperation`});try{let s=t.shell(n);if(o.kind===`legacyText`){await i.updateQueue(r,{kind:`remove`}),await _k({sessionId:n,shell:s,message:{text:o.text,attachments:[]},imageBlobs:/* @__PURE__ */ new Map,...o.rpcId===void 0?{}:{rpcId:o.rpcId}});return}let c=e.get(`queueMessageEditing`),l=e.get(`conversation`);if(c===void 0||typeof l?.restoreStagedDrafts!=`function`)throw Error(`queue dock: structured queue editing unavailable`);let u=o.images.length>0?await hk(o.images,a):/* @__PURE__ */ new Map;if(s.isDisposed)throw Error(`queue dock: session composer closed before editing`);await _k({sessionId:n,shell:s,conversation:l,message:await c.takeForEdit(n,r,o.revision),imageBlobs:u,...o.rpcId===void 0?{}:{rpcId:o.rpcId}})}finally{s.release()}},notify:(t,a)=>{e.sessions.scope(n)===r&&i.input.for(r).notify(t,a)},loadImage:a}}},Ak))}},Mk=`@deepseek-ai/dsh-client-ui-conversation/EnterBehaviorRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Mk)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=Mk,e.textContent=`.v-9l-a_row{border-bottom:.5px solid var(--dsw-alias-border-l2);align-items:center;gap:8px;padding:16px 0;display:flex}.v-9l-a_rowText{flex-direction:column;flex:1;gap:4px;min-width:0;padding-right:48px;display:flex}.v-9l-a_title{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:400;line-height:22px}.v-9l-a_desc{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:400;line-height:18px}.v-9l-a_selector{border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-module-platform);height:36px;font:inherit;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;align-items:center;gap:12px;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}.v-9l-a_selector:hover{background:var(--dsw-alias-interactive-bg-hover)}.v-9l-a_chevron{flex:none}`,document.head.appendChild(e)}var Nk={chevron:`v-9l-a_chevron`,desc:`v-9l-a_desc`,row:`v-9l-a_row`,rowText:`v-9l-a_rowText`,selector:`v-9l-a_selector`,title:`v-9l-a_title`};let Pk=[{id:`queue`,label:`settings.enter.queue`},{id:`steer`,label:`settings.enter.steer`}];function Fk({useBusyEnter:e,setBusyEnter:t,t:n}){let r=e(e=>e),[i,a]=(0,g.useState)(!1),o=r===`queue`?`settings.enter.queue`:`settings.enter.steer`;return/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Nk.row,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Nk.rowText,children:[/* @__PURE__ */ (0,h.jsx)(`div`,{className:Nk.title,children:n(`settings.enter.title`)}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:Nk.desc,children:n(`settings.enter.description`)})]}),/* @__PURE__ */ (0,h.jsx)(d.Menu,{open:i,onClose:()=>{a(!1)},items:Pk.map(e=>({id:e.id,label:n(e.label)})),selectedId:r,onSelect:e=>{a(!1),t(e)},align:`end`,portal:!0,anchor:/* @__PURE__ */ (0,h.jsxs)(`button`,{type:`button`,className:Nk.selector,"aria-haspopup":`menu`,"aria-expanded":i,onClick:()=>{a(e=>!e)},children:[n(o),/* @__PURE__ */ (0,h.jsx)(d.IconChevronDownOutlineRegular,{className:Nk.chevron})]})})]})}let Ik={views:{get:()=>void 0,grouped:()=>void 0},activeTargets:/* @__PURE__ */ new Set};function Lk(e,t){return t.activeTargets.size>0||!e.blank&&!e.awaitingFirstTurn||e.running?`active`:e.promptAttempted?`engaging`:`blank`}let Rk=`@deepseek-ai/dsh-client-ui-conversation/ConversationRoot.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Rk)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=Rk,e.textContent=`.vbpo1q_root{background:var(--dsw-alias-bg-base);flex-direction:column;min-width:0;height:100%;display:flex;position:relative}body[data-codexhost-wallpaper] .vbpo1q_root{background:0 0}.vbpo1q_header{box-sizing:border-box;flex:none;grid-template-columns:auto minmax(0,1fr);min-height:76px;padding:10px 28px 0 20px;display:grid}.vbpo1q_header:where(:not(:has(.vbpo1q_tabs))){min-height:0;padding:10px 24px 6px 20px}[data-windows-titlebar] .vbpo1q_header:where(:not(:has(.vbpo1q_tabs))){padding-top:8px;padding-bottom:4px}.vbpo1q_headerBlank{border-bottom:none;min-height:0;padding-bottom:0}.vbpo1q_headerBlank .vbpo1q_headerCorner{margin-left:auto}html:not([data-platform=darwin]) .vbpo1q_headerSessionless{padding-top:0}html:not([data-platform=darwin]) .vbpo1q_headerSessionless .vbpo1q_titleRow{min-height:0}[data-platform=darwin] .vbpo1q_headerLeading,[data-platform=darwin] .vbpo1q_headerActions,[data-platform=darwin] .vbpo1q_headerUtilities,[data-platform=darwin] .vbpo1q_headerCorner{-webkit-app-region:no-drag}.vbpo1q_titleRow{min-height:30px;grid-column:2;align-items:center;gap:0;padding-inline-start:max(0px, calc(var(--dsh-frame-leading-clearance,0px) - 20px));display:flex;container-type:inline-size}.vbpo1q_titleCenter{display:contents}.vbpo1q_phoneTrailingAction{display:none}.vbpo1q_titleCluster{flex:1;align-items:center;gap:10px;min-width:0;display:flex}.vbpo1q_headerLeading{flex:none;grid-area:1/1;align-items:center;gap:8px;display:flex}.vbpo1q_crumbs{white-space:nowrap;align-items:center;gap:4px;min-width:0;display:flex;overflow:hidden}.vbpo1q_crumbSeg{align-items:center;gap:4px;min-width:0;display:inline-flex}.vbpo1q_crumbSep{color:var(--dsw-alias-label-caption);font-size:14px;line-height:20px}.vbpo1q_crumb{border-radius:var(--dsw-radius-md);max-width:220px;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;cursor:pointer;background:0 0;border:none;padding:4px 8px;font-size:14px;line-height:20px;display:inline-block;overflow:hidden}.vbpo1q_crumbSubagent{font-size:12px;line-height:18px}button.vbpo1q_crumb:hover{background:var(--dsw-alias-interactive-bg-hover)}.vbpo1q_crumbCurrent{color:var(--dsw-alias-label-primary);cursor:default;font-weight:500}.vbpo1q_headerActions{flex:none;align-items:center;gap:8px;display:flex}.vbpo1q_headerUtilities{flex:none;align-items:center;gap:8px;margin-left:20px;display:flex}.vbpo1q_headerUtilities:empty{display:none}.vbpo1q_headerCorner{flex:none;align-items:center;margin-left:8px;margin-right:-16px;display:flex}.vbpo1q_headerCorner:empty,.vbpo1q_headerCorner:not(:has([data-slot="conversation.session.header.corner"]>*)){display:none}[data-phone] .vbpo1q_root[data-phase=active]{--dsh-phone-header-height:calc(env(safe-area-inset-top) + 44px)}[data-phone] .vbpo1q_root[data-phase=active]:has([data-slot="conversation.header.shortcuts"] nav){--dsh-phone-header-height:calc(env(safe-area-inset-top) + 88px)}[data-phone] .vbpo1q_header{z-index:8;padding-top:env(safe-area-inset-top);background:0 0;border-bottom:none;row-gap:0;padding-bottom:0;position:relative}[data-phone] .vbpo1q_root[data-phase=active] .vbpo1q_header{pointer-events:none;position:absolute;top:0;left:0;right:0}[data-phone] .vbpo1q_root[data-phase=active] .vbpo1q_header [data-slot="conversation.header.shortcuts"]{pointer-events:auto}[data-phone] .vbpo1q_root[data-phase=active]:not(:has([data-slot="conversation.header.notice"]>*)) .vbpo1q_scrollBody{padding-top:var(--dsh-phone-header-height)}[data-phone] .vbpo1q_root[data-phase=active]>[data-slot="conversation.header.notice"]>*{z-index:5;position:relative}[data-phone] .vbpo1q_root[data-phase=active]>[data-slot="conversation.header.notice"]>:first-child{margin-top:var(--dsh-phone-header-height)}[data-phone] .vbpo1q_root[data-phase=active] .vbpo1q_header:before{content:"";height:calc(var(--dsh-phone-header-height) + 32px);z-index:-1;background:linear-gradient(180deg, color-mix(in srgb, var(--dsw-alias-bg-base) 78%, transparent) 0%, color-mix(in srgb, var(--dsw-alias-bg-base) 58%, transparent) 44%, color-mix(in srgb, var(--dsw-alias-bg-base) 24%, transparent) 74%, transparent 100%);pointer-events:none;position:absolute;top:0;left:0;right:0}@supports (backdrop-filter:blur(16px)){[data-phone] .vbpo1q_root[data-phase=active] .vbpo1q_header:before{backdrop-filter:blur(16px)saturate(140%);-webkit-mask-image:linear-gradient(#000 0%,#000000eb 42%,#0000008f 62%,#00000038 78%,#0000000d 91%,#0000 100%);mask-image:linear-gradient(#000 0%,#000000eb 42%,#0000008f 62%,#00000038 78%,#0000000d 91%,#0000 100%)}}body[data-codexhost-wallpaper] [data-phone] .vbpo1q_root[data-phase=active] .vbpo1q_header:before{background:linear-gradient(180deg, color-mix(in srgb, var(--dsw-alias-bg-base) 64%, transparent) 0%, color-mix(in srgb, var(--dsw-alias-bg-base) 42%, transparent) 44%, color-mix(in srgb, var(--dsw-alias-bg-base) 16%, transparent) 74%, transparent 100%)}[data-phone] .vbpo1q_headerLeading{display:none}[data-phone] .vbpo1q_titleRow{grid-area:1/1/auto/-1;grid-template-columns:minmax(80px,1fr) minmax(0,auto) minmax(80px,1fr);align-items:center;gap:6px;min-height:44px;margin-inline:-8px -16px;padding-inline-start:0;display:grid}[data-phone] .vbpo1q_titleCluster{grid-column:2;justify-content:center;align-items:center;gap:4px;min-width:0;max-width:100%;display:flex}[data-phone] .vbpo1q_titleCenter{pointer-events:auto;border-radius:8px;justify-content:center;align-items:center;gap:4px;min-width:0;max-width:100%;min-height:36px;padding:0 2px;transition:opacity .12s;display:inline-flex;position:relative}[data-phone] .vbpo1q_root[data-phase=active] .vbpo1q_titleCenter:before{content:"";z-index:-1;background:radial-gradient(closest-side, color-mix(in srgb, var(--dsw-alias-bg-base) 88%, transparent) 38%, color-mix(in srgb, var(--dsw-alias-bg-base) 42%, transparent) 72%, transparent 100%);pointer-events:none;position:absolute;inset:-4px -22px}body[data-codexhost-wallpaper] [data-phone] .vbpo1q_root[data-phase=active] .vbpo1q_titleCenter:before{background:radial-gradient(closest-side, color-mix(in srgb, var(--dsw-alias-bg-base) 68%, transparent) 38%, color-mix(in srgb, var(--dsw-alias-bg-base) 28%, transparent) 72%, transparent 100%)}body[data-codexhost-wallpaper][data-ds-dark-theme] [data-phone] .vbpo1q_titleCenter{text-shadow:0 1px 10px #0000006b}[data-phone] .vbpo1q_titleCenter:has([data-navigation-focus-return]){cursor:pointer;-webkit-tap-highlight-color:transparent}[data-phone] .vbpo1q_titleRow>.vbpo1q_titleCenter,[data-phone] .vbpo1q_titleRow>[data-slot="conversation.header.navigation"]{pointer-events:auto;grid-column:2;justify-self:center}[data-phone] .vbpo1q_titleCenter>[data-slot="conversation.header.navigation"]{display:contents}[data-phone] .vbpo1q_titleCenter:has([data-navigation-focus-return]):active{opacity:.52}[data-phone] .vbpo1q_titleCenter:has([data-navigation-focus-return]:focus-visible){outline:none}@media (hover:hover) and (pointer:fine){[data-phone] .vbpo1q_titleCenter:has([data-navigation-focus-return]:focus-visible){outline:2px solid var(--dsw-alias-label-primary);outline-offset:2px}}[data-phone] .vbpo1q_crumbs{justify-content:center;gap:3px}[data-phone] .vbpo1q_crumb{letter-spacing:-.015em;max-width:none;padding:0;font-size:15px;font-weight:600;line-height:20px}[data-phone] button.vbpo1q_crumb{z-index:1;position:relative}[data-phone] .vbpo1q_headerActions:not(:has(button)),[data-phone] .vbpo1q_headerUtilities{display:none}[data-phone] .vbpo1q_phoneTrailingAction,[data-phone] .vbpo1q_headerCorner>[data-slot="conversation.session.header.corner"],[data-phone] .vbpo1q_phoneTrailingAction>[data-slot="conversation.header.trailing"]{display:contents}[data-phone] .vbpo1q_headerCorner:has(button){box-sizing:border-box;corner-shape:round;pointer-events:auto;background:#ffffffd6;border:.5px solid #0f11151a;border-radius:9999px;grid-column:3;justify-content:center;justify-self:end;align-items:center;gap:2px;height:36px;margin:0;padding:0 3px;display:inline-flex;box-shadow:inset 0 1px #ffffffb8,inset 0 -.5px #ffffff47,inset 0 0 0 .5px #ffffff38,0 1px 2px #0f11150d,0 6px 18px -4px #0f11151c}[data-phone] .vbpo1q_headerCorner:has(button):not(:has([data-phone-new-session]):has([data-sidebar-right-expand])){width:36px;padding:0}[data-ds-dark-theme] [data-phone] .vbpo1q_headerCorner:has(button){background:#24262cc7;border-color:#ffffff24;box-shadow:inset 0 1px #ffffff47,inset 0 -.5px #ffffff14,0 2px 8px #00000042,0 8px 22px -6px #0000006b}@supports (backdrop-filter:blur(8px)){[data-phone] .vbpo1q_headerCorner:has(button){backdrop-filter:blur(8px)saturate(180%);background:linear-gradient(#ffffff38 0%,#ffffff17 100%);box-shadow:inset 0 1px .5px #ffffffd9,inset 0 -.5px #0f11150f,0 1px 2px #0f11150f,0 6px 16px -4px #0f11151f}[data-ds-dark-theme] [data-phone] .vbpo1q_headerCorner:has(button){backdrop-filter:blur(10px)saturate(180%);background:linear-gradient(#ffffff1f 0%,#ffffff0d 100%)}}@media (prefers-reduced-motion:reduce){[data-phone] .vbpo1q_titleCenter{transition:none}}@media (prefers-reduced-transparency:reduce),(prefers-contrast:more){[data-phone] .vbpo1q_root[data-phase=active] .vbpo1q_header{pointer-events:auto;background:var(--dsw-alias-bg-base);border-bottom:.5px solid var(--dsw-alias-border-l3);position:relative}[data-phone] .vbpo1q_root[data-phase=active] .vbpo1q_header:before{display:none}[data-phone] .vbpo1q_root[data-phase=active]:not(:has([data-slot="conversation.header.notice"]>*)) .vbpo1q_scrollBody{padding-top:0}[data-phone] .vbpo1q_root[data-phase=active]>[data-slot="conversation.header.notice"]>:first-child{margin-top:0}[data-phone] .vbpo1q_headerCorner:has(button),[data-ds-dark-theme] [data-phone] .vbpo1q_headerCorner:has(button){border:1px solid var(--dsw-alias-border-l3);background:var(--dsw-alias-bg-layer-1);backdrop-filter:none;box-shadow:0 1px 2px #00000014}}@media (prefers-contrast:more){[data-phone] .vbpo1q_headerCorner:has(button),[data-ds-dark-theme] [data-phone] .vbpo1q_headerCorner:has(button){border-color:var(--dsw-alias-label-secondary);box-shadow:none}}@media (forced-colors:active){[data-phone] .vbpo1q_root[data-phase=active] .vbpo1q_header{pointer-events:auto;background:canvas;border-bottom:1px solid canvastext;position:relative}[data-phone] .vbpo1q_root[data-phase=active] .vbpo1q_header:before{display:none}[data-phone] .vbpo1q_root[data-phase=active]:not(:has([data-slot="conversation.header.notice"]>*)) .vbpo1q_scrollBody{padding-top:0}[data-phone] .vbpo1q_root[data-phase=active]>[data-slot="conversation.header.notice"]>:first-child{margin-top:0}[data-phone] .vbpo1q_headerCorner:has(button),[data-ds-dark-theme] [data-phone] .vbpo1q_headerCorner:has(button){backdrop-filter:none;box-shadow:none;background:buttonface;border:1px solid buttontext}}.vbpo1q_tabs{z-index:1;grid-column:1/-1;gap:36px;margin-top:10px;padding-left:8px;display:flex;position:relative}.vbpo1q_tab{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;padding:0 0 9px;font-size:13px;font-weight:500;line-height:16px;position:relative}.vbpo1q_tab:after{content:"";background:0 0;border-radius:2px;height:2px;position:absolute;bottom:0;left:0;right:0}.vbpo1q_tabActive{color:var(--dsw-alias-state-business-primary)}.vbpo1q_tabActive:after{background:var(--dsw-alias-state-business-primary)}.vbpo1q_viewArea{flex-direction:column;flex:1;min-height:0;display:flex}.vbpo1q_widthHandle{z-index:0;width:min(10px, calc((100% - var(--dsh-chat-content-width)) / 2 - 24px - 24px));cursor:col-resize;position:absolute;top:0;bottom:0}.vbpo1q_widthHandle[data-side=left]{right:calc(50% + var(--dsh-chat-content-width) / 2 + 24px)}.vbpo1q_widthHandle[data-side=right]{left:calc(50% + var(--dsh-chat-content-width) / 2 + 24px)}.vbpo1q_widthHandle:after{content:"";background:linear-gradient(to bottom, transparent calc(var(--dsh-width-handle-pointer-y,50%) - 36px), var(--dsw-alias-scrollbar-bg-l1) calc(var(--dsh-width-handle-pointer-y,50%) - 8px), var(--dsw-alias-scrollbar-bg-l1) calc(var(--dsh-width-handle-pointer-y,50%) + 8px), transparent calc(var(--dsh-width-handle-pointer-y,50%) + 36px));opacity:0;pointer-events:none;border-radius:2px;width:2px;position:absolute;top:0;bottom:0}.vbpo1q_widthHandle[data-side=left]:after{right:4px}.vbpo1q_widthHandle[data-side=right]:after{left:4px}.vbpo1q_widthHandle:hover:after,.vbpo1q_widthHandle[data-dragging]:after{opacity:1}.vbpo1q_widthHandle[data-dragging]{z-index:8}.vbpo1q_root:has([data-conversation-composer-overlay]) .vbpo1q_widthHandle{display:none}.vbpo1q_composerStack{--dsh-composer-stack-gap:6px;gap:var(--dsh-composer-stack-gap);flex-direction:column;display:flex}.vbpo1q_composerSeat{-webkit-user-select:none;user-select:none;--dsh-composer-text-max-height:336px;flex-direction:column;flex:none;display:flex}.vbpo1q_composerSeat :is(input,textarea,[contenteditable=true],[contenteditable=""]){-webkit-user-select:text;user-select:text}.vbpo1q_root[data-phase=active]{overflow:hidden}.vbpo1q_root[data-phase=active] .vbpo1q_header{flex:none}.vbpo1q_body{--dsh-chat-content-width:var(--dsh-chat-user-width,clamp(680px, calc(var(--dsh-conversation-column-width,0px) * .64), 920px));--dsh-composer-card-max-width:calc(var(--dsh-chat-content-width) + 32px);--dsh-composer-side-clearance:16px;--dsh-composer-dock-inset:8px;flex-direction:column;flex:1;min-height:0;display:flex;position:relative}.vbpo1q_embeddedBody{--dsh-chat-content-width:min(calc(100% - 32px), 920px);--dsh-composer-card-max-width:min(calc(100% - 16px), 952px);--dsh-composer-side-clearance:8px;--dsh-composer-dock-inset:8px;overflow:hidden}.vbpo1q_scrollBody{scrollbar-gutter:stable;flex-direction:column;flex:1;min-height:0;margin-right:2px;display:flex;overflow:hidden auto}.vbpo1q_scrollBody::-webkit-scrollbar-track{margin:2px}.vbpo1q_root[data-phase=active] .vbpo1q_viewArea,.vbpo1q_embeddedBody[data-content-phase=active] .vbpo1q_viewArea{flex:1 0 auto;min-height:auto}.vbpo1q_root[data-phase=active] .vbpo1q_composerSeat,.vbpo1q_embeddedBody[data-content-phase=active] .vbpo1q_composerSeat{z-index:7;background:var(--dsh-phone-composer-mask,linear-gradient(180deg, color-mix(in srgb, var(--dsw-alias-bg-base) 0%, transparent) 0px, var(--dsw-alias-bg-base) 36px));position:sticky;bottom:0}@supports (backdrop-filter:blur(14px)){[data-phone] .vbpo1q_composerSeat:where(:has([data-chain-overlay-fallback=conversation\\.composer]:only-child [data-composer-card])){--dsh-phone-composer-mask:linear-gradient(180deg, transparent 0px, color-mix(in srgb, var(--dsw-alias-bg-base) 60%, transparent) 36px, color-mix(in srgb, var(--dsw-alias-bg-base) 60%, transparent) calc(100% - 28px), var(--dsw-alias-bg-base) 100%)}}@media (prefers-reduced-transparency:reduce),(prefers-contrast:more),(forced-colors:active){[data-phone] .vbpo1q_composerSeat{--dsh-phone-composer-mask:initial}}body[data-codexhost-wallpaper] .vbpo1q_root[data-phase=active] .vbpo1q_composerSeat,body[data-codexhost-wallpaper] .vbpo1q_embeddedBody[data-content-phase=active] .vbpo1q_composerSeat{background:0 0}.vbpo1q_root[data-phase=active] .vbpo1q_composerSeat:has([data-trigger-menu]){z-index:9}.vbpo1q_scrollBody[data-selection-drag]{scroll-padding-bottom:var(--dsh-composer-height,0px)}.vbpo1q_scrollBody[data-selection-drag]>.vbpo1q_composerSeat :is(input,textarea,[contenteditable=true],[contenteditable=""]){pointer-events:none}.vbpo1q_scrollBody:has([data-conversation-composer-overlay]){scrollbar-gutter:auto;position:relative;overflow:hidden auto}.vbpo1q_scrollBody:has([data-conversation-composer-overlay])>[data-slot=conversation\\.session]>.vbpo1q_viewArea{flex:1 1 0;min-height:0;overflow:hidden}.vbpo1q_scrollBody:has([data-conversation-composer-overlay])>.vbpo1q_composerSeat{right:var(--dsh-scrollbar-width);position:absolute;bottom:0;left:0}.vbpo1q_composerHero{width:min(calc(var(--dsh-composer-card-max-width) + 2 * var(--dsh-composer-side-clearance)), 100%);z-index:1;align-self:center;gap:16px;padding-bottom:32px}.vbpo1q_heroTopBarInner{align-items:center;gap:4px;width:100%;min-width:0;display:flex}.vbpo1q_heroAgentPresetSeat{flex:none;align-items:center;margin-left:auto;display:flex}.vbpo1q_heroAgentPresetSeat:empty{display:none}.vbpo1q_root[data-phase=hero] .vbpo1q_scrollBody,.vbpo1q_embeddedBody[data-content-phase=hero] .vbpo1q_scrollBody{justify-content:center;overflow-y:auto}.vbpo1q_root[data-phase=settling] .vbpo1q_composerSeat,.vbpo1q_embeddedBody[data-content-phase=settling] .vbpo1q_composerSeat{visibility:hidden}`,document.head.appendChild(e)}var Q={body:`vbpo1q_body`,composerHero:`vbpo1q_composerHero`,composerSeat:`vbpo1q_composerSeat`,composerStack:`vbpo1q_composerStack`,crumb:`vbpo1q_crumb`,crumbCurrent:`vbpo1q_crumbCurrent`,crumbSeg:`vbpo1q_crumbSeg`,crumbSep:`vbpo1q_crumbSep`,crumbSubagent:`vbpo1q_crumbSubagent`,crumbs:`vbpo1q_crumbs`,embeddedBody:`vbpo1q_embeddedBody`,header:`vbpo1q_header`,headerActions:`vbpo1q_headerActions`,headerBlank:`vbpo1q_headerBlank`,headerCorner:`vbpo1q_headerCorner`,headerLeading:`vbpo1q_headerLeading`,headerSessionless:`vbpo1q_headerSessionless`,headerUtilities:`vbpo1q_headerUtilities`,heroAgentPresetSeat:`vbpo1q_heroAgentPresetSeat`,heroTopBarInner:`vbpo1q_heroTopBarInner`,phoneTrailingAction:`vbpo1q_phoneTrailingAction`,root:`vbpo1q_root`,scrollBody:`vbpo1q_scrollBody`,tab:`vbpo1q_tab`,tabActive:`vbpo1q_tabActive`,tabs:`vbpo1q_tabs`,titleCenter:`vbpo1q_titleCenter`,titleCluster:`vbpo1q_titleCluster`,titleRow:`vbpo1q_titleRow`,viewArea:`vbpo1q_viewArea`,widthHandle:`vbpo1q_widthHandle`};let zk=`dsh.conversation.contentWidth`;function Bk(){let e=localStorage.getItem(zk);if(e===null)return null;let t=Number(e);return Number.isFinite(t)&&t>0?t:null}function Vk(e,t){let n=Math.max(640,e-176);return t===null?Math.max(680,Math.min(e*.64,920)):Math.min(Math.max(t,640),n)}function Hk(e,t){if(e.deltaMode===1){let n=Number.parseFloat(getComputedStyle(t).lineHeight);return e.deltaY*(Number.isFinite(n)?n:16)}return e.deltaMode===2?e.deltaY*t.clientHeight:e.deltaY}function Uk(e){let t=(0,g.useRef)(!1),n=(0,g.useRef)(0),r=(0,g.useRef)(0),i=(0,g.useRef)(0),a=(0,g.useRef)(null),o=(0,g.useRef)(e);o.current=e;let s=()=>{let e=i.current-r.current,t=o.current.side===`right`?e:-e;return n.current+t*2},c=()=>{a.current!==null&&(cancelAnimationFrame(a.current),a.current=null)},l=(0,g.useCallback)(e=>{e.button===0&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),r.current=e.clientX,i.current=e.clientX,n.current=o.current.onStart(),t.current=!0,e.currentTarget.toggleAttribute(`data-dragging`,!0))},[]),u=(0,g.useCallback)(e=>{if(!t.current||!e.currentTarget.hasPointerCapture(e.pointerId))return;let n=e.currentTarget.getBoundingClientRect();e.currentTarget.style.setProperty(`--dsh-width-handle-pointer-y`,`${e.clientY-n.top}px`),i.current=e.clientX,a.current??=requestAnimationFrame(()=>{a.current=null,o.current.onDrag(s())})},[]),d=(0,g.useCallback)(e=>{t.current&&e.currentTarget.hasPointerCapture(e.pointerId)&&(t.current=!1,e.currentTarget.toggleAttribute(`data-dragging`,!1),e.currentTarget.releasePointerCapture(e.pointerId),c(),i.current=e.clientX,i.current!==r.current&&o.current.onCommit(s()),o.current.onEnd())},[]),f=(0,g.useCallback)(e=>{t.current&&(t.current=!1,e.currentTarget.toggleAttribute(`data-dragging`,!1),c(),o.current.onEnd())},[]),p=(0,g.useCallback)(e=>{let t=e.currentTarget.parentElement;
168
168
  /* v8 ignore next -- a width handle renders only inside the Conversation body. */
169
169
  if(t===null)return;let n=t.querySelector(`:scope > [data-conversation-scroll]`);
170
170
  /* v8 ignore next -- the Conversation body always contains its direct scroll element. */
171
- n!==null&&(e.ctrlKey||e.deltaY===0||n.scrollBy({top:Bk(e,n)}))},[]);return/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.widthHandle,"data-side":e.side,"data-width-handle":e.side,onPointerDown:l,onPointerMove:u,onPointerUp:d,onPointerCancel:f,onLostPointerCapture:f,onWheel:p})}function Hk({container:e,phase:t}){let n=(0,g.useCallback)(e=>{let t=e.parentElement??e,n=e.offsetWidth;t.style.setProperty(`--dsh-conversation-column-width`,`${n}px`);let r=Rk();r===null?t.style.removeProperty(`--dsh-chat-user-width`):t.style.setProperty(`--dsh-chat-user-width`,`${zk(n,r)}px`)},[]);(0,g.useLayoutEffect)(()=>{if(e===null)return;let t=new ResizeObserver(()=>{n(e)});return t.observe(e),n(e),()=>{t.disconnect()}},[e,n]);let r=(0,g.useCallback)(()=>e===null?680:zk(e.offsetWidth,Rk()),[e]),i=(0,g.useCallback)(t=>{e!==null&&(e.parentElement??e).style.setProperty(`--dsh-chat-user-width`,`${zk(e.offsetWidth,t)}px`)},[e]),a=(0,g.useCallback)(t=>{e!==null&&localStorage.setItem(Lk,`${zk(e.offsetWidth,t)}`)},[e]),o=(0,g.useCallback)(()=>{e!==null&&n(e)},[e,n]);return e===null||t!==`active`?null:[`left`,`right`].map(e=>/* @__PURE__ */ (0,h.jsx)(Vk,{side:e,onStart:r,onDrag:i,onCommit:a,onEnd:o},e))}let Uk={widthControls:Hk};function Wk(e){let{sessionId:t,useSession:n,useSessions:r,useConversation:i,renderSlot:a,renderFactorySlot:o}=e,s=n(e=>e),c=i(e=>e),l=s===void 0||c===void 0?`blank`:Fk(s,c),u=s?.openState,d=r(e=>t===void 0?void 0:e.byId[t]?.blank),f=s?.subagent?.address.mode===`continuable`&&s.subagent.parentAvailable===void 0,p=t!==void 0&&(l===`blank`&&u===`loading`&&d!==!0||f),m=t===void 0||l===`blank`&&(u===`open`||d===!0),g=p?`settling`:m?`hero`:`active`;return/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.root,"data-phase":g,"data-cx-region":`conversation`,children:[a(`conversation.header`,{}),a(`conversation.header.notice`,{}),o(`conversation.content`,{variant:`main`,phase:g,hero:m},{slots:Uk})]})}function Gk(e){return/* @__PURE__ */ (0,h.jsx)(Wk,{...e})}function Kk(e,t){return e===`default-workspace`?t:e}let qk=`@deepseek-ai/dsh-client-ui-conversation/HeroShell.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(qk)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=qk,e.textContent=`.Dgrl1G_root{justify-content:center;align-items:center;min-width:0;height:100%;padding:0 24px;display:flex}.Dgrl1G_stack{width:100%;max-width:var(--dsh-composer-card-max-width);flex-direction:column;align-items:stretch;gap:12px;display:flex;overflow:visible}.Dgrl1G_headline{color:var(--dsw-alias-label-primary);flex-wrap:wrap;justify-content:center;align-items:center;gap:12px 10px;font-size:26px;font-weight:500;line-height:32px;display:flex}.Dgrl1G_titleGroup{flex-wrap:wrap;justify-content:center;align-items:center;gap:4px 7px;min-width:0;display:flex}.Dgrl1G_previewBadge{border:.5px solid var(--dsw-alias-interactive-bg-hover);corner-shape:round;background:var(--dsw-alias-state-business-tertiary);color:var(--dsw-alias-label-primary-bluish);font-family:var(--ds-font-family-code);white-space:nowrap;border-radius:999px;align-self:flex-start;margin-top:2px;padding:1px 7px 0;font-size:12px;font-weight:500;line-height:18px}.Dgrl1G_previewBadgeDesktop{display:none}html[data-codexhost-shell] .Dgrl1G_previewBadgeWeb,html[data-tauri-shell] .Dgrl1G_previewBadgeWeb{display:none}html[data-codexhost-shell] .Dgrl1G_previewBadgeDesktop,html[data-tauri-shell] .Dgrl1G_previewBadgeDesktop{display:inline}.Dgrl1G_fishHitbox{flex:none;justify-content:center;align-items:center;display:inline-flex}.Dgrl1G_fish{transform-origin:50% 60%;color:var(--dsw-alias-label-primary);display:block;overflow:visible}@keyframes Dgrl1G_hero-fish-swim{0%,to{transform:none}35%{transform:rotate(-4deg)translate(-.4px,-.9px)}70%{transform:rotate(1.6deg)translate(.3px,.2px)}}@media (hover:hover) and (prefers-reduced-motion:no-preference){.Dgrl1G_fishHitbox:hover .Dgrl1G_fish{animation:1.6s ease-in-out infinite Dgrl1G_hero-fish-swim}}.Dgrl1G_body{flex-direction:column;gap:12px;min-width:0;display:flex;position:relative;overflow:visible}.Dgrl1G_body>*{z-index:1;position:relative}.Dgrl1G_body>.Dgrl1G_workspaceRow{z-index:10;align-items:center;min-width:0;padding-left:8px;display:flex}.Dgrl1G_workspace{border-radius:var(--dsw-radius-sm);max-width:min(100%,360px);min-height:28px;color:var(--dsw-alias-label-primary);cursor:pointer;background:0 0;border:none;align-items:center;gap:4px;padding:0 8px;font-size:13px;font-weight:500;line-height:20px;display:inline-flex}.Dgrl1G_workspace:not(:disabled):hover,.Dgrl1G_workspace[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover)}.Dgrl1G_workspace:disabled{cursor:default}.Dgrl1G_folder{color:var(--dsw-alias-label-primary);flex:none}.Dgrl1G_workspaceLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.Dgrl1G_chevron{color:var(--dsw-alias-label-caption);flex:none}.Dgrl1G_modalInput{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}.Dgrl1G_modalInput::placeholder{color:var(--dsw-alias-label-caption)}.Dgrl1G_modalInput:disabled{color:var(--dsw-alias-label-dimmed)}.Dgrl1G_modalAction{min-width:72px}.Dgrl1G_modalError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}`,document.head.appendChild(e)}var Jk={body:`Dgrl1G_body`,chevron:`Dgrl1G_chevron`,fish:`Dgrl1G_fish`,fishHitbox:`Dgrl1G_fishHitbox`,folder:`Dgrl1G_folder`,headline:`Dgrl1G_headline`,"hero-fish-swim":`Dgrl1G_hero-fish-swim`,modalAction:`Dgrl1G_modalAction`,modalError:`Dgrl1G_modalError`,modalInput:`Dgrl1G_modalInput`,previewBadge:`Dgrl1G_previewBadge`,previewBadgeDesktop:`Dgrl1G_previewBadgeDesktop`,previewBadgeWeb:`Dgrl1G_previewBadgeWeb`,root:`Dgrl1G_root`,stack:`Dgrl1G_stack`,titleGroup:`Dgrl1G_titleGroup`,workspace:`Dgrl1G_workspace`,workspaceLabel:`Dgrl1G_workspaceLabel`,workspaceRow:`Dgrl1G_workspaceRow`};function Yk(e){let t=Qu(e);return t===``?e:t}function Xk({buttonRef:e,label:t,projectless:n=!1,menuOpen:r=!1,onClick:i,t:a}){return/* @__PURE__ */ (0,h.jsxs)(`button`,{ref:e,type:`button`,className:Jk.workspace,"aria-label":a(`hero.chooseWorkspace`),"aria-haspopup":`menu`,"aria-expanded":r,onClick:i,children:[t===void 0||n?/* @__PURE__ */ (0,h.jsx)(d.IconFolderCloseRegular,{className:Jk.folder,size:16}):/* @__PURE__ */ (0,h.jsx)(d.IconFolderOpenRegular,{className:Jk.folder,size:16}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Jk.workspaceLabel,children:t??a(`hero.chooseWorkspace`)}),/* @__PURE__ */ (0,h.jsx)(d.IconChevronDownOutlineRegular,{className:Jk.chevron,size:12})]})}function Zk({hovering:e}){return/* @__PURE__ */ (0,h.jsx)(`svg`,{className:Jk.fish,width:34,height:34*d.FISH_LOGO_VIEWBOX.height/d.FISH_LOGO_VIEWBOX.width,viewBox:`0 0 ${d.FISH_LOGO_VIEWBOX.width} ${d.FISH_LOGO_VIEWBOX.height}`,fill:`none`,"aria-hidden":`true`,children:/* @__PURE__ */ (0,h.jsx)(`path`,{d:d.FISH_LOGO_PATH,fill:`currentColor`,children:e&&/* @__PURE__ */ (0,h.jsx)(`animate`,{attributeName:`d`,values:`${d.FISH_LOGO_PATH};M22.403 0.567C22.145 0.477 22.068 0.718 21.939 0.85C21.895 0.893 21.86 0.947 21.824 0.997C21.515 1.421 21.13 1.721 20.591 1.77C19.829 1.867 19.221 2.244 18.712 2.958C18.535 2.227 18.116 1.839 17.516 1.626C17.203 1.506 16.887 1.379 16.663 1.064C16.508 0.839 16.462 0.581 16.383 0.329C16.332 0.176 16.283 0.02 16.121 -0.002C15.944 -0.029 15.875 0.133 15.805 0.269C15.52 0.822 15.408 1.43 15.42 2.046C15.449 3.432 16.031 4.532 17.202 5.274C17.337 5.356 17.374 5.445 17.335 5.582C17.261 5.862 17.169 6.134 17.086 6.413C17.032 6.59 16.952 6.63 16.764 6.558C16.118 6.301 15.562 5.909 15.074 5.433C14.248 4.633 13.5 3.751 12.568 3.06C12.349 2.898 12.13 2.748 11.903 2.605C10.952 1.682 12.028 0.923 12.277 0.833C12.537 0.739 12.367 0.416 11.526 0.42C10.684 0.424 9.914 0.706 8.933 1.081C8.789 1.138 8.638 1.179 8.484 1.213C7.593 1.044 6.668 1.006 5.702 1.115C3.883 1.318 2.43 2.178 1.362 3.646C0.079 5.41 -0.223 7.415 0.147 9.506C0.535 11.71 1.66 13.535 3.389 14.962C5.181 16.441 7.246 17.166 9.601 17.027C11.032 16.944 12.624 16.753 14.421 15.232C14.874 15.458 15.35 15.548 16.138 15.615C16.746 15.672 17.331 15.585 17.784 15.491C18.493 15.341 18.444 14.684 18.188 14.564C16.108 13.595 16.565 13.989 16.15 13.67C17.206 12.42 18.82 10.198 19.363 7.086C19.421 6.709 19.484 6.171 19.469 5.866C19.458 5.681 19.493 5.604 19.681 5.556C20.199 5.412 20.691 5.172 21.125 4.806C22.366 3.824 22.758 2.554 22.708 1.1C22.7 0.878 22.649 0.654 22.403 0.567ZM11.175 14.451C9.159 12.726 8.182 12.088 7.778 12.067C7.401 12.047 7.469 12.505 7.552 12.807C7.639 13.103 7.752 13.313 7.91 13.581C8.02 13.758 8.095 14.01 7.801 14.16C7.152 14.487 6.023 13.806 5.97 13.772C4.657 12.85 3.559 11.766 2.785 10.369C2.037 9.025 1.603 7.583 1.532 6.044C1.513 5.672 1.622 5.541 1.992 5.473C2.479 5.383 2.981 5.364 3.468 5.436C5.525 5.736 7.276 6.675 8.744 8.323C9.582 9.299 10.216 10.425 10.869 11.496C11.563 12.592 12.31 13.603 13.262 14.414C13.598 14.696 13.866 14.91 14.123 15.068C13.349 15.154 12.058 15.167 11.175 14.452L11.175 14.451ZM12.141 8.26C12.141 8.095 12.273 7.963 12.439 7.963C12.476 7.963 12.511 7.971 12.541 7.982C12.582 7.997 12.62 8.019 12.65 8.053C12.704 8.106 12.733 8.181 12.733 8.26C12.733 8.425 12.601 8.556 12.435 8.556C12.27 8.556 12.141 8.425 12.141 8.26ZM15.142 9.799C14.949 9.878 14.757 9.945 14.572 9.953C14.284 9.968 13.972 9.851 13.802 9.709C13.537 9.487 13.348 9.363 13.27 8.977C13.236 8.812 13.255 8.556 13.284 8.41C13.352 8.094 13.277 7.892 13.055 7.708C12.873 7.558 12.643 7.516 12.39 7.516C12.296 7.516 12.209 7.475 12.145 7.441C12.039 7.389 11.952 7.257 12.035 7.096C12.062 7.043 12.19 6.916 12.22 6.893C12.563 6.698 12.96 6.762 13.326 6.908C13.665 7.047 13.922 7.302 14.292 7.663C14.669 8.098 14.738 8.218 14.953 8.545C15.123 8.801 15.277 9.063 15.383 9.364C15.447 9.551 15.364 9.705 15.142 9.799Z;${d.FISH_LOGO_PATH};M23.271 2.216C23.039 2.071 22.91 2.287 22.755 2.388C22.703 2.42 22.656 2.464 22.61 2.505C22.214 2.848 21.771 3.054 21.225 2.956C20.412 2.784 19.68 2.919 19.005 3.435C18.92 2.663 18.493 2.157 17.808 1.798C17.446 1.621 17.08 1.449 16.83 1.111C16.656 0.872 16.611 0.612 16.524 0.354C16.469 0.198 16.414 0.039 16.223 0.009C16.017 -0.024 15.936 0.137 15.856 0.271C15.539 0.822 15.418 1.43 15.429 2.046C15.454 3.432 16.041 4.538 17.196 5.36C17.325 5.456 17.356 5.547 17.312 5.674C17.229 5.936 17.134 6.191 17.051 6.454C16.999 6.623 16.921 6.659 16.738 6.58C16.107 6.306 15.56 5.909 15.074 5.433C14.248 4.633 13.5 3.751 12.568 3.06C12.349 2.898 12.13 2.748 11.903 2.605C10.952 1.682 12.028 0.923 12.277 0.833C12.537 0.739 12.367 0.416 11.526 0.42C10.684 0.424 9.914 0.706 8.933 1.081C8.789 1.138 8.638 1.179 8.484 1.213C7.593 1.044 6.668 1.006 5.702 1.115C3.883 1.318 2.43 2.178 1.362 3.646C0.079 5.41 -0.223 7.415 0.147 9.506C0.535 11.71 1.66 13.535 3.389 14.962C5.181 16.441 7.246 17.166 9.601 17.027C11.032 16.944 12.624 16.753 14.421 15.232C14.874 15.458 15.35 15.548 16.138 15.615C16.746 15.672 17.331 15.585 17.784 15.491C18.493 15.341 18.444 14.684 18.188 14.564C16.108 13.595 16.565 13.989 16.15 13.67C17.206 12.42 18.82 10.198 19.278 7.246C19.318 6.948 19.375 6.534 19.371 6.293C19.371 6.145 19.411 6.092 19.597 6.098C20.113 6.109 20.619 6.051 21.096 5.891C22.503 5.375 23.169 4.232 23.448 2.804C23.49 2.586 23.491 2.356 23.271 2.216ZM11.175 14.49C9.159 13.005 8.182 12.567 7.778 12.621C7.401 12.673 7.469 13.087 7.552 13.354C7.639 13.619 7.752 13.797 7.91 14.024C8.02 14.175 8.095 14.406 7.801 14.609C7.152 15.063 6.023 14.63 5.97 14.609C4.657 13.941 3.559 12.965 2.785 11.569C2.037 10.225 1.603 8.783 1.532 7.244C1.513 6.872 1.622 6.741 1.992 6.673C2.479 6.583 2.981 6.564 3.468 6.636C5.525 6.936 7.276 7.843 8.744 9.163C9.582 9.888 10.216 10.783 10.869 11.679C11.563 12.659 12.31 13.617 13.262 14.415C13.598 14.696 13.866 14.91 14.123 15.068C13.349 15.155 12.058 15.177 11.175 14.491L11.175 14.49ZM12.141 8.26C12.141 8.095 12.273 7.963 12.439 7.963C12.476 7.963 12.511 7.971 12.541 7.982C12.582 7.997 12.62 8.019 12.65 8.053C12.704 8.106 12.733 8.181 12.733 8.26C12.733 8.425 12.601 8.556 12.435 8.556C12.27 8.556 12.141 8.425 12.141 8.26ZM15.142 9.799C14.949 9.878 14.757 9.945 14.572 9.953C14.284 9.968 13.972 9.851 13.802 9.709C13.537 9.487 13.348 9.363 13.27 8.977C13.236 8.812 13.255 8.556 13.284 8.41C13.352 8.094 13.277 7.892 13.055 7.708C12.873 7.558 12.643 7.516 12.39 7.516C12.296 7.516 12.209 7.475 12.145 7.441C12.039 7.389 11.952 7.257 12.035 7.096C12.062 7.043 12.19 6.916 12.22 6.893C12.563 6.698 12.96 6.762 13.326 6.908C13.665 7.047 13.922 7.302 14.292 7.663C14.669 8.098 14.738 8.218 14.953 8.545C15.123 8.801 15.277 9.063 15.383 9.364C15.447 9.551 15.364 9.705 15.142 9.799Z;${d.FISH_LOGO_PATH}`,keyTimes:`0;0.35;0.55;0.75;1`,calcMode:`spline`,keySplines:`0.45 0 0.55 1;0.45 0 0.55 1;0.45 0 0.55 1;0.45 0 0.55 1`,dur:`1.6s`,repeatCount:`indefinite`})})})}function Qk({t:e,renderSlot:t,children:n}){let[r,i]=(0,g.useState)(!1);return/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Jk.root,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Jk.stack,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Jk.headline,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:Jk.fishHitbox,onMouseEnter:()=>{window.matchMedia(`(hover: hover) and (prefers-reduced-motion: no-preference)`).matches&&i(!0)},onMouseLeave:()=>{i(!1)},children:t(`conversation.hero.brand.mark`,{size:34,className:Jk.fish},{fallback:/* @__PURE__ */ (0,h.jsx)(Zk,{hovering:r})})}),/* @__PURE__ */ (0,h.jsxs)(`span`,{className:Jk.titleGroup,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{children:e(`hero.headline`)}),/* @__PURE__ */ (0,h.jsxs)(`span`,{className:Jk.previewBadge,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:Jk.previewBadgeWeb,children:e(`hero.preview`)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Jk.previewBadgeDesktop,children:e(`hero.previewDesktop`)})]})]})]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:Jk.body})]}),n]})}let $k=`@deepseek-ai/dsh-client-ui-conversation/ThreadReferenceDropTarget.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify($k)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=$k,e.textContent=`.tWXKHq_overlay{z-index:30;pointer-events:none;background:color-mix(in srgb, var(--dsw-alias-state-business-tertiary) 88%, transparent);place-items:center;display:grid;position:absolute;inset:0}.tWXKHq_invitation{flex-direction:column;align-items:center;gap:8px;max-width:calc(100% - 40px);display:flex}.tWXKHq_hint{border:1px solid color-mix(in srgb, var(--dsw-alias-state-business-primary) 15%, transparent);background:var(--dsw-alias-state-business-tertiary);color:var(--dsw-alias-label-primary);border-radius:10px;padding:8px 16px;font-size:16px;line-height:24px;box-shadow:0 1px 4px #00000014}.tWXKHq_preview{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l3);background:var(--dsw-alias-bg-base);max-width:min(440px,100%);color:var(--dsw-alias-label-primary);border-radius:12px;align-items:center;gap:10px;padding:10px 14px;font-size:14px;line-height:20px;display:flex;box-shadow:0 4px 14px #00000014}.tWXKHq_preview svg{flex:none}.tWXKHq_title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}`,document.head.appendChild(e)}var eA={hint:`tWXKHq_hint`,invitation:`tWXKHq_invitation`,overlay:`tWXKHq_overlay`,preview:`tWXKHq_preview`,title:`tWXKHq_title`};function tA({container:e,editor:t,useSessions:n,t:r}){let i=n(e=>e.byId),a=(0,g.useRef)(i);a.current=i;let[o,s]=(0,g.useState)(null);return(0,g.useEffect)(()=>{if(e===null||t===void 0)return;let n,r=()=>{n=void 0,s(null)},i=()=>t.isEditable()&&t.getRootElement()!==null,o=e=>{let t=e.dataTransfer;return t?.types.includes(`application/x-codexhost-thread-reference`)&&!t.types.includes(`Files`)?t:null},c=e=>{let t=e===void 0?void 0:rC(nC(e)),n=t===void 0?void 0:a.current[t];return n!==void 0&&tC(n)!==void 0},l=t=>!(t instanceof Node)||!e.contains(t)?!1:(t instanceof Element?t:t.parentElement)?.closest(`[data-conversation-content]`)===e,u=e=>{r();let t=o(e),i=t===null?void 0:aC(t.getData($S));c(i)&&(n=i)},d=e=>{let r=o(e);r===null||!l(e.target)?s(null):!i()||!c(n)?(e.preventDefault(),e.stopPropagation(),r.dropEffect=`none`,s(null)):t.dispatchCommand(Qp,e)&&s(n??null)},f=t=>{if(t.relatedTarget instanceof Node&&e.contains(t.relatedTarget))return;let n=e.getBoundingClientRect();(t.relatedTarget!==null||t.target===e||t.clientX<=n.left||t.clientX>=n.right||t.clientY<=n.top||t.clientY>=n.bottom)&&s(null)},p=e=>{let a=o(e);if(a!==null&&l(e.target)){let r=aC(a.getData($S));i()&&c(r)&&r?.threadId===n?.threadId&&r?.hostId===n?.hostId?t.dispatchCommand(Xp,e):(e.preventDefault(),e.stopPropagation(),a.dropEffect=`none`)}r()},m=e=>{e.key===`Escape`&&r()},h=t.registerEditableListener(e=>{e||r()});return document.addEventListener(`dragstart`,u),document.addEventListener(`dragenter`,d,!0),document.addEventListener(`dragover`,d,!0),document.addEventListener(`dragleave`,f,!0),document.addEventListener(`drop`,p,!0),window.addEventListener(`dragend`,r),window.addEventListener(`blur`,r),window.addEventListener(`keydown`,m,!0),()=>{h(),document.removeEventListener(`dragstart`,u),document.removeEventListener(`dragenter`,d,!0),document.removeEventListener(`dragover`,d,!0),document.removeEventListener(`dragleave`,f,!0),document.removeEventListener(`drop`,p,!0),window.removeEventListener(`dragend`,r),window.removeEventListener(`blur`,r),window.removeEventListener(`keydown`,m,!0)}},[e,t]),o===null?null:/* @__PURE__ */ (0,h.jsx)(`div`,{className:eA.overlay,"data-thread-reference-drop":!0,role:`status`,"aria-live":`polite`,children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:eA.invitation,children:[/* @__PURE__ */ (0,h.jsx)(`div`,{className:eA.hint,children:r(`reference.dropTitle`)}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:eA.preview,"data-thread-reference-preview":!0,children:[/* @__PURE__ */ (0,h.jsx)(d.ReferenceIconRegular,{kind:`session`,size:20}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:eA.title,children:o.title})]})]})})}let nA=`data-selection-drag`,rA=[`pointerup`,`pointercancel`,`dragstart`,`contextmenu`];function iA(e){let t=e.ownerDocument.defaultView;if(t===null)return()=>{};let n=()=>{e.removeAttribute(nA);for(let e of rA)t.removeEventListener(e,n,!0);t.removeEventListener(`blur`,n)},r=r=>{if(r.pointerType!==`mouse`||r.button!==0)return;let i=r.target instanceof Element?r.target:null;if(i!==null&&i.closest(`[data-composer-seat]`)===null){e.setAttribute(nA,``);for(let e of rA)t.addEventListener(e,n,!0);t.addEventListener(`blur`,n)}};return e.addEventListener(`pointerdown`,r,!0),()=>{e.removeEventListener(`pointerdown`,r,!0),n()}}function aA({renderSlot:e}){return e(`conversation.session`,{})}function oA({session:e,useInput:t,renderSlot:n}){let r=t(e=>e);return e===void 0||r===void 0?null:n(`conversation.input.dock`,{session:e,input:r})}function sA(){return null}function cA(e){let{sessionId:t,phase:n,hero:r,useSession:i,useSessions:a,useSessionStatus:o,useWorkspaces:s,useInput:c,useComposerBlock:l,useSessionCreation:u,renderSlot:d,renderSlotChain:f,selectWorkspace:p,retrySessionCreation:m,referenceEditor:_,t:v,useFactorySlot:y}=e,b=i(e=>e),ee=y(`views`,aA),te=y(`widthControls`,sA),[ne,re]=(0,g.useState)(null),ie=o(e=>t===void 0?void 0:e.get(t)?.pendingInteraction),ae=a(e=>t===void 0?void 0:e.byId[t]?.cwd),oe=s(e=>e),se=l(e=>e),ce=u(e=>e),le=t===void 0&&ce.state!==`idle`?ce.workspaceId:void 0,[ue,de]=(0,g.useState)(!1),[fe,pe]=(0,g.useState)(),me=(0,g.useRef)(null),x=(0,g.useRef)(null),S=(0,g.useCallback)(e=>{x.current?.disconnect(),x.current=null;let t=e?.parentElement??null;e!==null&&t!==null&&(x.current=new ResizeObserver(()=>{t.style.setProperty(`--dsh-composer-height`,`${e.offsetHeight}px`),t.style.setProperty(`--dsh-conversation-viewport-height`,`${t.clientHeight}px`)}),x.current.observe(e),x.current.observe(t))},[]);(0,g.useEffect)(()=>{let e=ne?.querySelector(`:scope > [data-conversation-scroll]`);return e==null?void 0:iA(e)},[ne]);let he=t===void 0?void 0:oe.items.find(e=>e.sessionIds.includes(t)),ge=fe?fe.id:le,_e=oe.items.find(e=>e.workspaceId===ge),ve=(ge===null?void 0:_e?.title)??(ge===null||t===void 0?void 0:he?.title??(oe.phase===`ready`||ae===void 0||ae===``?void 0:Yk(ae))),ye=ve===void 0?void 0:Kk(ve,v(`workspace.defaultName`)),be=/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.heroTopBarInner,children:[d(`conversation.hero.workspace`,{open:ue,anchorRef:me,selectedId:ge===null?void 0:ge??he?.workspaceId,fallbackLabel:ye,onOpenChange:de,onPick:e=>{de(!1);let t={id:e};pe(t);let n=()=>pe(e=>e===t?void 0:e);p(e).then(n,n)},onClose:()=>{de(!1)}},{fallback:/* @__PURE__ */ (0,h.jsx)(Xk,{buttonRef:me,label:ye??(oe.canStartProjectless?v(`hero.noWorkspace`):void 0),projectless:oe.canStartProjectless===!0&&ye===void 0,menuOpen:ue,onClick:()=>{de(e=>!e)},t:v})}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.heroAgentPresetSeat,children:d(`conversation.hero.agentPreset`,{})})]}),xe=oe.phase===`ready`&&!oe.canStartProjectless&&ye===void 0,Se=t===void 0&&ce.state!==`idle`,Ce=t!==void 0&&r&&b?.openState===`loading`&&!xe,we=r&&fe!==void 0,Te=!we&&t!==void 0&&b?.openState===`error`,Ee=Te&&b?.openError?.code===`remote/unsupported`,De=we||!Te&&(t===void 0||b?.openState!==`open`)&&!xe,Oe=we||t===void 0||b?.openState!==`open`||r&&xe,ke=!Oe&&se!==void 0,Ae=d(`conversation.composer.bar`,{variant:r?`hero`:`composer`,...r?{topBar:be}:{},...Se?{sessionCreation:ce,onRetrySessionCreation:m,placeholder:v(`placeholder.hero`)}:Ce?{disabled:!0,preparingDraft:!0,placeholder:v(`placeholder.hero`)}:Oe?Te?{disabled:!0,placeholder:v(Ee?`placeholder.loadUnsupported`:`placeholder.loadFailed`)}:{disabled:!0,placeholder:v(De?`placeholder.preparing`:`placeholder.workspace`),...De?{}:{workspacePickerOpen:ue,onRequestWorkspace:()=>{de(!0)}}}:ke?{blocked:se,placeholder:se.reason}:r?{placeholder:v(`placeholder.hero`)}:{}}),je=/* @__PURE__ */ (0,h.jsxs)(`div`,{className:sC(Q.composerStack,r&&Q.composerHero),children:[r&&/* @__PURE__ */ (0,h.jsx)(Qk,{t:v,renderSlot:d}),/* @__PURE__ */ (0,h.jsx)(oA,{session:b,useInput:c,renderSlot:d}),Ae]}),Me=f(`conversation.composer`,{sessionId:t,session:b,pendingInteraction:b?.openState===`open`?ie:void 0},{fallback:je,fallbackOnly:t===void 0,overlay:!0}),Ne=/* @__PURE__ */ (0,h.jsx)(`div`,{ref:S,className:Q.composerSeat,"data-composer-seat":``,"data-conversation-region":`composer`,children:Me});return/* @__PURE__ */ (0,h.jsxs)(`div`,{ref:re,className:sC(Q.body,e.variant===`embedded`&&Q.embeddedBody),"data-conversation-content":``,"data-conversation-session":t,"data-conversation-region":`chat`,"data-content-phase":n,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.scrollBody,"data-conversation-scroll":``,children:[t===void 0?null:/* @__PURE__ */ (0,h.jsx)(ee,{}),Ne]}),/* @__PURE__ */ (0,h.jsx)(te,{container:ne,phase:n}),/* @__PURE__ */ (0,h.jsx)(tA,{container:ne,editor:_,useSessions:a,t:v},t)]})}function lA({renderSlot:e}){return e(`main.conversation`,{})}function uA(){let e=()=>{let e=document.querySelector(`[data-conversation-navigation-focus]`),t=e?.querySelector(`[data-navigation-focus-return]`);(t!=null&&t.getClientRects().length>0?t:e)?.focus({preventScroll:!0})};e(),requestAnimationFrame(()=>{document.activeElement===document.body&&e()})}function dA({sessionId:e,useSession:t,useConversation:n,renderSlot:r}){let i=t(e=>e),a=n(e=>e),o=i===void 0||a===void 0||i.blank&&Fk(i,a)===`blank`;return/* @__PURE__ */ (0,h.jsxs)(`header`,{className:sC(Q.header,o&&Q.headerBlank,e===void 0&&Q.headerSessionless),"data-window-drag":!0,"data-conversation-navigation-focus":!0,"data-cx-region":`topbar`,tabIndex:-1,children:[/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.headerLeading,"data-conversation-header-leading":``,children:r(`conversation.header.leading`,{})}),e===void 0?/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.titleRow,children:[r(`conversation.header.navigation`,{restoreNavigationFocus:uA}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.headerCorner,"data-conversation-header-corner":``,children:/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.phoneTrailingAction,children:r(`conversation.header.trailing`,{})})})]}):r(`conversation.session.header`,{hideChrome:o,titleNavigation:r(`conversation.header.navigation`,{restoreNavigationFocus:uA}),trailingAction:r(`conversation.header.trailing`,{})}),r(`conversation.header.shortcuts`,{restoreNavigationFocus:uA})]})}function fA(e,t){return(t===null?void 0:e.find(e=>e.id===t))??e.find(e=>e.id===`chat`)}function pA({view:e,useSession:t,useConversation:n,useConversationViews:r,inputActions:i,useStore:a,actions:o,renderSlot:s,bindDraftPersistence:c,onRevealResponseAnnotation:l,openView:u,useInspectCall:d}){let f=r(e=>e),p=d(e=>e),m=fA(f,a(e=>e.view)),_=t(e=>e),v=n(e=>e),y=a(e=>e.viewRequest??null);if((0,g.useEffect)(()=>{let e=c(o.setDraft);return i.persistDraft(),()=>{e()}},[i]),(0,g.useEffect)(()=>l(e=>u(`chat`,e)),[l,u]),_.blank&&Fk(_,v)===`blank`)return null;let b=e??m?.id;return/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.viewArea,children:b!==void 0&&s(`conversation.view`,{inspectCall:p,viewRequest:y,openView:u,completeViewRequest:o.completeViewRequest},{only:b})})}function mA(e,t){let n=[],r=/* @__PURE__ */ new Set,i=t;for(;i!==void 0&&!r.has(i);){r.add(i);let t=e.byId[i];if(t===void 0||(n.unshift({id:t.id,displayTitle:t.displayTitle,subagent:t.origin===`subagent`}),t.origin!==`subagent`))break;i=t.parentId}return n}function hA(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t.at(n);return r!==void 0&&e.id===r.id&&e.displayTitle===r.displayTitle})}function gA({sessionId:e,hideChrome:t,titleNavigation:n,trailingAction:r,useSessions:i,useConversationViews:a,useStore:o,renderSlot:s,open:c,selectView:l,t:u}){let d=a(e=>e),f=fA(d,o(e=>e.view)),p=i(t=>mA(t,e),hA),m=!t&&d.length>1;return/* @__PURE__ */ (0,h.jsxs)(h.Fragment,{children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.titleRow,children:[!t&&/* @__PURE__ */ (0,h.jsxs)(h.Fragment,{children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.titleCluster,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.titleCenter,onClick:e=>{if(e.target?.closest(`button, a, input, [role='button']`))return;let t=e.currentTarget.querySelector(`[data-navigation-focus-return]`);t!==null&&t.getClientRects().length>0&&t.click()},children:[/* @__PURE__ */ (0,h.jsxs)(`nav`,{className:Q.crumbs,"aria-label":u(`session.hierarchy`),children:[p.map((e,t)=>{let n=t===p.length-1,r=n?/* @__PURE__ */ (0,h.jsx)(`span`,{className:sC(Q.crumb,e.subagent&&Q.crumbSubagent,Q.crumbCurrent),children:e.displayTitle}):/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:sC(Q.crumb,e.subagent&&Q.crumbSubagent),onClick:()=>{c(e.id)},children:e.displayTitle}),i=n||e.subagent,a={lineageSessionId:e.id,displayTitle:e.displayTitle,...n?{}:{openTitle:()=>{c(e.id)}}};return/* @__PURE__ */ (0,h.jsxs)(`span`,{className:Q.crumbSeg,children:[t>0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.crumbSep,children:`/`}),i?e.subagent?s(`conversation.session.header.lineage`,a,{fallback:r}):/* @__PURE__ */ (0,h.jsxs)(h.Fragment,{children:[r,s(`conversation.session.header.lineage`,a,{fallback:null})]}):r]},e.id)}),p.length===0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.crumbCurrent,children:e})]}),n]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.headerActions,children:s(`conversation.session.header.actions`,{})})]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.headerUtilities,children:s(`conversation.session.header.utilities`,{})})]}),t&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.titleCenter,children:n}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.headerCorner,"data-conversation-header-corner":``,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.phoneTrailingAction,children:r}),s(`conversation.session.header.corner`,{})]})]}),m&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.tabs,role:`tablist`,"data-conversation-tabs":``,children:d.map(e=>/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===f?.id,className:sC(Q.tab,e.id===f?.id&&Q.tabActive),onClick:()=>{l(e.id)},children:e.label},e.id))})]})}function _A(e){return/* @__PURE__ */ (0,h.jsx)(pA,{...e})}function vA({editor:e,editable:t,preserveFocus:n=!1,...r}){let i=(0,g.useRef)(null),a=(0,g.useRef)(n);return a.current=n,(0,g.useLayoutEffect)(()=>{let t=i.current;if(t!==null&&(!(0,d.shouldAutoFocusTextInput)()&&!a.current&&(t.ownerDocument.activeElement===t&&t.blur(),e?.setEditable(!1)),e!==null))return e.setRootElement(t),()=>{e.setRootElement(null)}},[e]),(0,g.useLayoutEffect)(()=>{e!==null&&e.setEditable(t)},[e,t]),/* @__PURE__ */ (0,h.jsx)(`div`,{ref:i,contentEditable:e!==null&&t,suppressContentEditableWarning:!0,role:`textbox`,"aria-multiline":`true`,"data-composer-input":!0,...r})}function yA({editor:e}){let[t,n]=g.useState(()=>e===null?{}:e.getDecorators());return g.useLayoutEffect(()=>{if(e!==null)return n(e.getDecorators()),e.registerDecoratorListener(e=>{n(e)})},[e]),e===null?null:/* @__PURE__ */ (0,h.jsx)(h.Fragment,{children:Object.entries(t).map(([t,n])=>{let r=e.getElementByKey(t);return r===null?null:(0,_.createPortal)(n,r,t)})})}function bA({classNames:e,editor:t,scrollRef:n,editable:r,editorDisabled:i,preserveFocus:a=!1,phase:o,placeholderText:s,ariaLabel:c,workspaceTrigger:l,workspacePickerOpen:u,onWorkspaceKeyDown:d,hint:f,showPlaceholder:p}){return/* @__PURE__ */ (0,h.jsx)(`div`,{ref:n,className:e.scroll,"data-input-scroll":!0,children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:e.grow,children:[/* @__PURE__ */ (0,h.jsx)(vA,{editor:l?null:t,editable:r,preserveFocus:a,className:sC(e.input,i&&e.inputDisabled),"data-phase":o,"aria-disabled":i||void 0,"data-placeholder":s,"aria-label":c,"aria-haspopup":l?`menu`:void 0,"aria-expanded":l?u:void 0,tabIndex:l?0:void 0,onKeyDown:l?d:void 0,style:f===null?void 0:{"--dsh-composer-hint":JSON.stringify(f)}}),p&&/* @__PURE__ */ (0,h.jsx)(`div`,{"aria-hidden":!0,className:e.placeholder,"data-composer-placeholder":!0,children:s}),/* @__PURE__ */ (0,h.jsx)(yA,{editor:l?null:t})]})})}function xA(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(pointer: coarse)`).matches}function SA(e,t){return e.isComposing||e.keyCode===229||t()}function CA(e,t){let n=!1,r=0,i=null,a=()=>{i?.toggleAttribute(`data-composer-composing`,n||e.isComposing())},o=()=>{n=!0,a()},s=()=>{n=!1,r=Date.now()+10,e.update(()=>{},{onUpdate:a})},c=()=>n||Date.now()<r,l=e=>n=>{let r=n!==null&&SA(n,c);return t.arbitrate(e,r)!==`pass`&&(n?.preventDefault(),!0)};return tx(e.registerRootListener((e,t)=>{t?.removeEventListener(`compositionstart`,o),t?.removeEventListener(`compositionend`,s),t?.removeAttribute(`data-composer-composing`),n=!1,r=0,i=e,e?.addEventListener(`compositionstart`,o),e?.addEventListener(`compositionend`,s),a()}),e.registerUpdateListener(a),e.registerCommand(Hp,l(`up`),4),e.registerCommand(Up,l(`down`),4),e.registerCommand(Rp,t=>e.getEditorState().read(()=>{let e=V();if(!B(e)||!e.isCollapsed())return!1;let t=e.anchor,n=t.getNode();if(!z(n))return!0;let r=n.getTextContent().charAt(t.offset);return r===``||/\s/u.test(r)})?l(`right`)(t):!1,4),e.registerCommand(Bp,t=>e.getEditorState().read(()=>{let e=V();return B(e)&&e.isCollapsed()})?l(`left`)(t):!1,4),e.registerCommand(Yp,e=>l(e.shiftKey?`tabBack`:`tab`)(e),4),e.registerCommand(qp,e=>(t.dismissPopup(),t.arbitrate(`escape`,SA(e,c))===`consumed`&&(e.preventDefault(),!0)),4),e.registerCommand(Gp,e=>SA(e,c)?!1:t.space()?(e.preventDefault(),!0):!1,4),e.registerCommand(Wp,e=>e!==null&&(e.altKey||e.getModifierState(`AltGraph`)||e.ctrlKey&&e.metaKey||e.shiftKey&&(e.ctrlKey||e.metaKey))?!0:e?.shiftKey===!0?!1:e!==null&&SA(e,c)?!0:t.arbitrate(`enter`,!1)===`pass`?xA()&&e?.ctrlKey!==!0&&e?.metaKey!==!0?!1:(e?.preventDefault(),e?.repeat===!0||!t.canSubmit()||t.submit(e?.ctrlKey===!0||e?.metaKey===!0),!0):(e?.preventDefault(),!0),4),e.registerCommand(Ap,e=>{let n=e.clipboardData??null;if(n===null)return!1;let r=[],i=/* @__PURE__ */ new Set;for(let e of n.items){if(e.kind!==`file`)continue;let t=e.getAsFile();t!==null&&(r.push(t),typeof e.webkitGetAsEntry==`function`&&e.webkitGetAsEntry()?.isDirectory===!0&&i.add(t))}r.length>0&&t.intakeFiles(r,i.size===0?void 0:i);let a=n.getData(`text/plain`);return a===``?r.length!==0&&(e.preventDefault(),!0):(e.preventDefault(),t.pasteText(a),!0)},4))}function wA(e){let t=e.current;if(t===null||t.scrollHeight<=t.clientHeight)return;let n=window.getSelection();if(n===null||n.rangeCount===0)return;let r=n.getRangeAt(0).getBoundingClientRect();if(r.height===0&&r.width===0){let e=n.anchorNode,t=e instanceof HTMLElement?e:e?.parentElement;if(t==null)return;r=t.getBoundingClientRect()}let i=t.getBoundingClientRect();r.bottom>i.bottom?t.scrollTop+=r.bottom-i.bottom:r.top<i.top&&(t.scrollTop-=i.top-r.top)}function TA(e,t){e.getRootElement()?.focus({preventScroll:!0}),e.focus(()=>{t()})}function EA(e){let t=e.getRootElement();if(t===null||e.isComposing())return;let n=t.ownerDocument;if(n.activeElement!==t&&!t.contains(n.activeElement))return;let r=n.defaultView?.getSelection();if(r==null)return;if(r.rangeCount>0){if(!r.isCollapsed)return;let e=r.getRangeAt(0).cloneRange();if(t.contains(e.startContainer)&&t.contains(e.endContainer)){r.removeAllRanges(),r.addRange(e);return}}let i=t.firstChild??t,a=n.createRange();a.setStart(i,0),a.collapse(!0),r.removeAllRanges(),r.addRange(a)}function DA(e){let t=e.current;if(t===null)return;let n=e=>{let n=t.closest(`[data-conversation-scroll]`);if(!(n instanceof HTMLElement)||e.deltaY===0)return;let r=t.scrollTop<=0,i=t.scrollTop+t.clientHeight>=t.scrollHeight-1;e.deltaY<0&&!r||e.deltaY>0&&!i||(e.preventDefault(),n.scrollTop+=e.deltaY)};return t.addEventListener(`wheel`,n,{passive:!1}),()=>{t.removeEventListener(`wheel`,n)}}function OA(e,t,n){return e.bindFilePicker({available:()=>t.current.canAcceptDrop&&n.current!==null,open:()=>{n.current?.click()}})}function kA(e,t,n){return CA(e,{arbitrate:(e,r)=>e===`enter`&&n.current.primaryAction!==void 0?`pass`:t.arbitrate(e,r),space:()=>n.current.machineBusy||n.current.locked?!1:t.space(),dismissPopup:()=>{t.dismissPopup()},canSubmit:()=>!n.current.locked&&!n.current.machineBusy&&n.current.primaryAction?.disabled!==!0,submit:e=>{let r=n.current;r.uploadsFailed?r.showToast(r.t(`file.retryOrRemove`)):r.primaryAction===void 0?e&&r.canSteerQueue?t.steerQueue():t.submit(dk(r.busyEnter,r.running,e?`accelerated`:`enter`,r.steeringAvailable),`enter`):r.primaryAction.run()},intakeFiles:(e,t)=>{n.current.intakeFiles(e,t)},pasteText:e=>{!n.current.machineBusy&&n.current.canPasteText&&t.paste(e)}})}function AA(e){let t=e.activeElement,n=e.defaultView?.HTMLTextAreaElement??globalThis.HTMLTextAreaElement;return n!==void 0&&t instanceof n&&t.closest(`[data-composer-annotations]`)!==null&&(t.blur(),!0)}function jA(e){let t=e?.getRootElement()??null;if(t===null)return!1;let n=t.ownerDocument.activeElement;return n===null||!t.contains(n)?!1:(typeof n.blur==`function`?n.blur():t.blur(),!0)}function MA(e,t){(0,d.shouldAutoFocusTextInput)()&&(e.preventDefault(),t?.getRootElement()?.focus({preventScroll:!0}))}function NA(e){let t=e/1048576;return`${Number.isInteger(t)?String(t):t.toFixed(1)}MB`}function PA(e,t,n){switch(t){case`MODEL_DOES_NOT_SUPPORT_IMAGES`:return e(`image.modelUnsupported`);case`FILE_NOT_STAGED`:return e(`file.notStaged`);case`FILE_UNAVAILABLE`:return e(`file.unavailable`);case`IMAGE_TOO_MANY_PIXELS`:return e(`image.tooManyPixels`);case`INVALID_IMAGE`:case`IMAGE_TYPE_MISMATCH`:return e(`image.unsupportedType`);case`TOO_MANY_IMAGES`:if(n!==void 0)return e(`image.tooMany`,{count:n.maxImagesPerMessage});break;case`IMAGE_TOO_LARGE`:if(n!==void 0)return e(`image.fileTooLarge`,{size:NA(n.maxImageBytes)});break;case`IMAGES_TOO_LARGE`:if(n!==void 0)return e(`image.totalTooLarge`,{size:NA(n.maxMessageImageBytes)})}return e(`image.sendFailed`,{reason:t})}function FA(e){let t=e?.projectedTokens??e?.pressureTokens;return t===void 0||e?.contextWindow===void 0?null:{percent:Math.min(100,Math.round(t/e.contextWindow*100)),usedTokens:t,contextWindow:e.contextWindow}}let IA=`@deepseek-ai/dsh-client-ui-conversation/ContextMeter.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(IA)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=IA,e.textContent=`.h1Hkra_root{flex:none;display:inline-flex}.h1Hkra_trigger{border-radius:var(--dsw-radius-sm);color:var(--dsw-alias-label-tertiary);font-family:inherit;font-size:var(--dsh-content-font-size-secondary,13px);font-variant-numeric:tabular-nums;line-height:calc(20px + var(--dsh-content-font-delta-secondary,0px));white-space:nowrap;cursor:pointer;background:0 0;border:none;flex:none;align-items:center;gap:6px;padding:1px 8px;display:inline-flex}.h1Hkra_trigger:hover,.h1Hkra_trigger[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.h1Hkra_track{fill:none;stroke:var(--dsw-alias-border-l3);stroke-width:2px}.h1Hkra_fill{fill:none;stroke:var(--dsw-alias-label-tertiary);stroke-width:2px;stroke-linecap:round}.h1Hkra_panel{z-index:1100;box-sizing:border-box;border-radius:var(--dsw-radius-lg);background:var(--dsw-specific-menu);width:min(264px,100vw - 24px);backdrop-filter:var(--dsw-menu-backdrop-filter);--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);box-shadow:var(--dsw-elevation-prominent);color:var(--dsw-alias-label-secondary);cursor:default;border:0;padding:12px;font-size:12px;line-height:20px;position:fixed}.h1Hkra_header{align-items:center;gap:6px;display:flex}.h1Hkra_figures{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);margin-left:auto;font-weight:500}.h1Hkra_percent{color:var(--dsw-alias-label-primary);font-weight:500}.h1Hkra_headline{color:var(--dsw-alias-label-tertiary)}.h1Hkra_headline:empty{display:none}.h1Hkra_bar{corner-shape:round;background:var(--dsw-alias-interactive-bg-hover);border-radius:999px;gap:1px;height:4px;margin:10px 0 12px;display:flex;overflow:hidden}.h1Hkra_segment{background:var(--meter-tint,var(--dsw-alias-label-tertiary));border-radius:1px;flex:none;min-width:2px;height:100%}.h1Hkra_swatch{background:var(--meter-tint);vertical-align:baseline;border-radius:2px;width:8px;height:8px;margin-right:6px;display:inline-block}.h1Hkra_colorSystem{--meter-tint:var(--dsw-static-neutral-bluish-400)}.h1Hkra_colorTools{--meter-tint:#a78bfa}.h1Hkra_colorMessages{--meter-tint:var(--dsw-static-blue-450)}.h1Hkra_rows{margin:6px 0 0}.h1Hkra_row{justify-content:space-between;align-items:center;gap:12px;padding:2px 0;display:flex}.h1Hkra_row dt{color:var(--dsw-alias-label-secondary)}.h1Hkra_row dd{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);margin:0}`,document.head.appendChild(e)}var LA={bar:`h1Hkra_bar`,colorMessages:`h1Hkra_colorMessages`,colorSystem:`h1Hkra_colorSystem`,colorTools:`h1Hkra_colorTools`,figures:`h1Hkra_figures`,fill:`h1Hkra_fill`,header:`h1Hkra_header`,headline:`h1Hkra_headline`,panel:`h1Hkra_panel`,percent:`h1Hkra_percent`,root:`h1Hkra_root`,row:`h1Hkra_row`,rows:`h1Hkra_rows`,segment:`h1Hkra_segment`,swatch:`h1Hkra_swatch`,track:`h1Hkra_track`,trigger:`h1Hkra_trigger`};let RA=5.5,zA=2*Math.PI*RA,BA=[{key:`systemTokens`,label:`context.system`,color:LA.colorSystem},{key:`toolsTokens`,label:`context.tools`,color:LA.colorTools},{key:`messageTokens`,label:`context.messages`,color:LA.colorMessages}];function VA(e,t){let n=e=>String(e>=100?Math.round(e):Math.round(e*10)/10);return e<1e3?String(e):e<1e6?t(`number.thousand`,{value:n(e/1e3)}):t(`number.million`,{value:n(e/1e6)})}function HA({useProjection:e,t}){let n=e(`contextPressure`),r=e(`contextBreakdown`),[i,a]=(0,g.useState)(!1),o=(0,g.useRef)(null),s=(0,g.useRef)(null),c=FA(n),l=c!==null,u=(0,d.useAnchoredPosition)({open:i&&l,anchorRef:o,panelRef:s,side:`top`,gap:8,margin:12});if((0,d.useDismissOnOutsidePointer)(o,i&&l,a,s),(0,g.useEffect)(()=>{!l&&i&&a(!1)},[l,i]),(0,g.useEffect)(()=>{if(!i||!l)return;let e=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[l,i]),c===null)return null;let f=c.percent,p=`${f}%`,[m=``,v=``]=t(`context.aria`,{percent:`\0`}).split(`\0`).map(e=>e.trim()),y=r===void 0?0:r.systemTokens+r.toolsTokens+r.messageTokens,b=(r===void 0||y===0?[{key:`total`,color:void 0,width:f}]:BA.map(e=>({key:e.key,color:e.color,width:f*r[e.key]/y}))).filter(e=>e.width>0);return/* @__PURE__ */ (0,h.jsxs)(`span`,{ref:o,className:LA.root,children:[/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{label:t(`context.aria`,{percent:p}),side:`top`,delayMs:200,disabled:i,children:/* @__PURE__ */ (0,h.jsxs)(`button`,{type:`button`,className:LA.trigger,"aria-label":t(`context.aria`,{percent:p}),"aria-haspopup":`dialog`,"aria-expanded":i,onClick:()=>{a(!i)},children:[/* @__PURE__ */ (0,h.jsxs)(`svg`,{viewBox:`0 0 14 14`,width:`14`,height:`14`,"aria-hidden":!0,children:[/* @__PURE__ */ (0,h.jsx)(`circle`,{className:LA.track,cx:`7`,cy:`7`,r:RA}),/* @__PURE__ */ (0,h.jsx)(`circle`,{className:LA.fill,cx:`7`,cy:`7`,r:RA,strokeDasharray:`${zA*f/100} ${zA}`,transform:`rotate(-90 7 7)`})]}),/* @__PURE__ */ (0,h.jsx)(`span`,{children:p})]})}),i&&(0,_.createPortal)(/* @__PURE__ */ (0,h.jsxs)(`div`,{ref:s,className:LA.panel,style:u??{visibility:`hidden`,left:0,top:0},role:`dialog`,"aria-label":t(`context.used`),children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:LA.header,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:LA.headline,children:m}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:LA.percent,children:p}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:LA.headline,children:v}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:LA.figures,children:`~${VA(c.usedTokens,t)} / ${VA(c.contextWindow,t)}`})]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:LA.bar,children:b.map(e=>/* @__PURE__ */ (0,h.jsx)(`div`,{className:e.color===void 0?LA.segment:`${LA.segment} ${e.color}`,style:{width:`${e.width}%`}},e.key))}),r!==void 0&&/* @__PURE__ */ (0,h.jsx)(`dl`,{className:LA.rows,children:BA.map(e=>/* @__PURE__ */ (0,h.jsxs)(`div`,{className:LA.row,children:[/* @__PURE__ */ (0,h.jsxs)(`dt`,{children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:`${LA.swatch} ${e.color}`,"aria-hidden":!0}),t(e.label)]}),/* @__PURE__ */ (0,h.jsx)(`dd`,{children:`~${VA(r[e.key],t)}`})]},e.key))})]}),document.body)]})}function UA(e,t){let n=e.querySelector(`[data-toolbar-scroll]`);if(n===null)return()=>{};let r=e.querySelector(`[data-toolbar-fixed="start"]`),i=e.querySelector(`[data-toolbar-fixed="end"]`),a={phone:!1,overflowActions:!1},o=!1,s=/* @__PURE__ */ new Set,c=()=>{if(!a.phone||e.hasAttribute(`data-toolbar-activity`))return;let t=e.ownerDocument.activeElement;if(!(t instanceof HTMLElement)||!e.contains(t)||t.closest(`[data-toolbar-fixed]`))return;let{left:r,right:i}=n.getBoundingClientRect(),o=t.getBoundingClientRect();o.left<r?n.scrollLeft+=o.left-r:o.right>i&&(n.scrollLeft+=Math.min(o.right-i,o.left-r))},l=()=>{if(o)return;let s=e.closest(`[data-phone]`)!==null;if(e.toggleAttribute(`data-phone-toolbar`,s),e.hasAttribute(`data-toolbar-activity`)){s!==a.phone&&(a={...a,phone:s},t?.(a));return}let l=e.hasAttribute(`data-actions-overflow`);if(e.removeAttribute(`data-model-compact`),e.removeAttribute(`data-actions-overflow`),e.toggleAttribute(`data-toolbar-measuring`,s),s)for(let[t,n]of[[`start`,r],[`end`,i]]){if(n===null)continue;let r=`--dsh-composer-${t}-width`,i=`${n.getBoundingClientRect().width}px`;e.style.getPropertyValue(r)!==i&&e.style.setProperty(r,i)}let u=getComputedStyle(e),d=e.getBoundingClientRect().width-parseFloat(u.paddingLeft)-parseFloat(u.paddingRight),f=s?(()=>{let t=e=>Array.from(e.children).flatMap(e=>{let r=getComputedStyle(e).display;return r===`none`?[]:e===n||r===`contents`?t(e):[e]}),r=t(e);return r.reduce((e,t)=>{let n=getComputedStyle(t);return e+t.getBoundingClientRect().width+(parseFloat(n.marginLeft)||0)+(parseFloat(n.marginRight)||0)},0)+Math.max(0,r.length-1)*(parseFloat(u.columnGap)||0)})():(()=>{let e=Array.from(n.children,e=>e.getBoundingClientRect().width).filter(e=>e>0);return e.reduce((e,t)=>e+t,0)+Math.max(0,e.length-1)*parseFloat(u.columnGap)})();e.toggleAttribute(`data-model-compact`,!s&&f>d);let p=e.querySelector(`[data-composer-overflow-action]`),m=e.querySelector(`[data-toolbar-fixed="start"] button`),h=s&&p!==null&&m?.disabled===!1&&f>d-(l?2:0),g=e.hasAttribute(`data-command-menu-open`)||p!==null&&p.contains(e.ownerDocument.activeElement)?l:h;e.removeAttribute(`data-toolbar-measuring`),e.toggleAttribute(`data-actions-overflow`,g),(s!==a.phone||g!==a.overflowActions)&&(a={phone:s,overflowActions:g},t?.(a)),(!s||n.scrollWidth<=n.clientWidth)&&(n.scrollLeft=0),c()},u=new ResizeObserver(l),d=()=>{let t=/* @__PURE__ */ new Set([e,...e.querySelectorAll(`*`)]);for(let e of s)t.has(e)||(u.unobserve(e),s.delete(e));for(let e of t)s.has(e)||(u.observe(e),s.add(e))},f=new MutationObserver(()=>{d(),l()});f.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`hidden`,`class`,`style`,`aria-label`,`aria-busy`,`disabled`,`data-command-menu-open`,`data-toolbar-activity`]});let p=new MutationObserver(l);for(let t=e.parentElement;t!==null;t=t.parentElement)p.observe(t,{attributes:!0,attributeFilter:t===e.ownerDocument.body||t===e.ownerDocument.documentElement?[`data-phone`,`class`,`style`,`lang`,`dir`]:[`data-phone`,`lang`,`dir`]});let m=()=>{queueMicrotask(()=>{o||l()})};e.addEventListener(`focusin`,c),e.addEventListener(`focusout`,m);let h=document.fonts;return h.addEventListener(`loadingdone`,l),d(),l(),()=>{o=!0,u.disconnect(),f.disconnect(),p.disconnect(),e.removeEventListener(`focusin`,c),e.removeEventListener(`focusout`,m),h.removeEventListener(`loadingdone`,l)}}let WA=`@deepseek-ai/dsh-client-ui-conversation/InputBar.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(WA)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=WA,e.textContent=`.SFO4UW_root{padding:0 var(--dsh-composer-side-clearance) 4px;flex-direction:column;align-items:center;display:flex}[data-phone] .SFO4UW_root{padding-bottom:max(4px, calc(env(safe-area-inset-bottom) - 23px))}.SFO4UW_dock{-webkit-user-select:none;user-select:none;justify-content:center;align-items:center;gap:12px;max-width:100%;padding-top:4px;display:flex}.SFO4UW_hero .SFO4UW_dock:empty{display:none}.SFO4UW_hero{padding:0 var(--dsh-composer-side-clearance)}.SFO4UW_notice{width:100%;max-width:var(--dsh-composer-card-max-width);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary);-webkit-user-select:text;user-select:text;margin-bottom:6px;padding:4px 8px;font-size:12px;line-height:18px}.SFO4UW_cardStack{width:100%;max-width:var(--dsh-composer-card-max-width);flex-direction:column;display:flex;position:relative}.SFO4UW_topRail{z-index:0;box-sizing:border-box;margin-inline:16px;background:color-mix(in srgb, var(--dsw-alias-label-primary) 5%, var(--dsw-alias-bg-base));-webkit-user-select:none;user-select:none;border:0;border-radius:16px 16px 0 0;align-items:center;margin-bottom:-16px;padding:5px 10px 21px;display:flex;position:relative}.SFO4UW_card{box-sizing:border-box;z-index:1;width:100%;max-width:var(--dsh-composer-card-max-width);--dsw-elevation-stroke-color:var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-panel);background:var(--dsw-specific-input-major);box-shadow:var(--dsw-elevation-soft);font-size:var(--dsh-content-font-size,14px);line-height:calc(24px + var(--dsh-content-font-delta,0px));--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);border:0;flex-direction:column;gap:12px;padding-top:8px;display:flex;position:relative}@supports (backdrop-filter:blur(14px)){body[data-codexhost-wallpaper] .SFO4UW_card,[data-phone] .SFO4UW_card{box-shadow:none;background:0 0}body[data-codexhost-wallpaper] .SFO4UW_card:before,[data-phone] .SFO4UW_card:before{content:"";z-index:-1;border-radius:inherit;background:color-mix(in srgb, var(--dsw-specific-input-major) 60%, transparent);backdrop-filter:blur(16px);box-shadow:inset 0 1px 0 color-mix(in srgb, var(--dsw-alias-bg-layer-3) 65%, transparent), var(--dsw-elevation-soft), 0 8px 24px -12px var(--dsw-alias-bg-mask-2);pointer-events:none;position:absolute;inset:0}body:not([data-codexhost-wallpaper]) [data-phone] .SFO4UW_card:before{background:color-mix(in srgb, var(--dsw-specific-input-major) 24%, transparent);backdrop-filter:blur(14px)}}@media (prefers-reduced-transparency:reduce),(prefers-contrast:more),(forced-colors:active){body[data-codexhost-wallpaper] .SFO4UW_card,[data-phone] .SFO4UW_card{background:var(--dsw-specific-input-major);box-shadow:var(--dsw-elevation-soft)}body[data-codexhost-wallpaper] .SFO4UW_card:before,[data-phone] .SFO4UW_card:before{display:none}}@media (prefers-contrast:more),(forced-colors:active){[data-phone] .SFO4UW_card:not(.SFO4UW_cardWorkspaceTrigger){outline:1px solid var(--dsw-alias-label-primary);outline-offset:-1px}}.SFO4UW_cardWorkspaceTrigger{--dsw-elevation-stroke-color:transparent;cursor:pointer}.SFO4UW_cardWorkspaceTrigger:after{content:"";box-sizing:border-box;border-radius:var(--dsw-radius-panel);color:var(--dsw-alias-border-l4);pointer-events:none;border:1px dashed;transition:color .1s;position:absolute;inset:0}.SFO4UW_cardWorkspaceTrigger :disabled{pointer-events:none}.SFO4UW_cardWorkspaceTrigger:hover:after{color:var(--dsw-alias-state-business-primary)}.SFO4UW_inlineNotices{-webkit-user-select:text;user-select:text;flex-direction:column;gap:8px;display:flex}.SFO4UW_inlineNotices>[data-slot]>*{margin:10px 10px 0}.SFO4UW_accessory{align-items:center;gap:8px;padding:10px 12px 0;display:flex}.SFO4UW_overlayAnchor{height:0;position:absolute;inset:0 0 auto}.SFO4UW_scroll{max-height:var(--dsh-composer-text-max-height);margin-right:4px;overflow-y:auto}.SFO4UW_scroll::-webkit-scrollbar-track{margin-top:8px}.SFO4UW_grow{position:relative}.SFO4UW_pending{corner-shape:round;background:var(--dsw-alias-state-business-primary);border-radius:50%;width:8px;height:8px;animation:1s ease-in-out infinite alternate SFO4UW_input-pending}@keyframes SFO4UW_input-pending{0%{opacity:.35}to{opacity:1}}.SFO4UW_input{box-sizing:border-box;min-height:36px;font-family:var(--dsw-font-family);font-size:inherit;line-height:inherit;white-space:pre-wrap;word-break:break-word;overflow-wrap:anywhere;color:var(--dsw-alias-label-primary);caret-color:var(--dsw-alias-state-business-primary);-webkit-user-select:text;user-select:text;outline:none;padding:4px 8px 0 14px}.SFO4UW_input p{margin:0}.SFO4UW_input p:last-child:after{content:var(--dsh-composer-hint);color:var(--dsw-alias-label-caption)}.SFO4UW_input[data-composer-composing] p:last-child:after{content:none}.SFO4UW_input[data-composer-composing]+.SFO4UW_placeholder{visibility:hidden}.SFO4UW_placeholder{color:var(--dsw-alias-label-caption);white-space:nowrap;text-overflow:ellipsis;pointer-events:none;-webkit-user-select:none;user-select:none;position:absolute;inset:4px 8px auto 14px;overflow:hidden}.SFO4UW_inputDisabled{color:var(--dsw-alias-label-tertiary);cursor:not-allowed}.SFO4UW_input[aria-haspopup=menu]{cursor:pointer}.SFO4UW_hero .SFO4UW_input{min-height:52px}.SFO4UW_hero .SFO4UW_placeholder{white-space:normal;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box}@media (width<=600px){.SFO4UW_hero .SFO4UW_input{min-height:36px}.SFO4UW_hero .SFO4UW_placeholder{white-space:nowrap;display:block}}.SFO4UW_row{-webkit-user-select:none;user-select:none;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;min-width:0;padding:2px 8px 6px;display:flex;container-type:inline-size}.SFO4UW_row[data-model-compact]{--dsh-composer-model-text-display:none;--dsh-composer-model-icon-display:block}.SFO4UW_tools,.SFO4UW_modes,.SFO4UW_trailing{align-items:center;min-width:0;display:flex}.SFO4UW_tools,.SFO4UW_modes{gap:12px}.SFO4UW_trailing{flex:none;gap:12px;margin-left:auto}@container (width<=560px){.SFO4UW_tools,.SFO4UW_modes,.SFO4UW_trailing{gap:8px}}.SFO4UW_add{corner-shape:round;background:var(--dsw-specific-selector);width:28px;height:28px;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;border-radius:999px;flex:none;place-items:center;display:grid}.SFO4UW_add:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid)}.SFO4UW_add:disabled{opacity:.5;cursor:default}.SFO4UW_select{border-radius:var(--dsw-radius-sm);max-width:220px;height:28px;color:var(--dsw-alias-label-secondary);white-space:nowrap;cursor:pointer;appearance:none;background-color:#0000;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2381858C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-position:right 4px center;background-repeat:no-repeat;background-size:12px 12px;border:none;outline:none;padding:0 20px 0 8px;font-size:13px;font-weight:500;line-height:20px}.SFO4UW_select:hover:not(:disabled){background-color:var(--dsw-alias-interactive-bg-hover)}.SFO4UW_select:disabled{opacity:.5;cursor:default}.SFO4UW_primary{corner-shape:round;background:var(--dsw-alias-button-info-fill);color:#fff;cursor:pointer;border:none;border-radius:999px;flex:none;place-items:center;width:30px;height:30px;transition:background-color .1s;display:grid;transform:translateY(-2px)}.SFO4UW_primary:hover:not(:disabled){background:var(--dsw-alias-button-info-hover)}.SFO4UW_primary:disabled{opacity:.4;cursor:default}.SFO4UW_retry{border-radius:var(--dsw-radius-sm);color:inherit;cursor:pointer;background:0 0;border:1px solid;margin-left:8px;padding:1px 8px;font-size:12px}.SFO4UW_addSeat,.SFO4UW_submitSeat,.SFO4UW_controlScroll{display:contents}.SFO4UW_row[data-phone-toolbar]{flex-wrap:nowrap;gap:4px;position:relative}.SFO4UW_row[data-phone-toolbar] .SFO4UW_controlScroll{--dsh-composer-edge-gap:4px;align-items:center;gap:inherit;min-width:0;min-height:44px;margin-left:calc(var(--dsh-composer-start-width,44px) + var(--dsh-composer-edge-gap));margin-right:calc(var(--dsh-composer-end-width,44px) + var(--dsh-composer-edge-gap));overscroll-behavior-x:contain;scrollbar-width:none;flex:1;display:flex;overflow-x:auto}.SFO4UW_row[data-phone-toolbar] .SFO4UW_controlScroll::-webkit-scrollbar{display:none}.SFO4UW_row[data-phone-toolbar] .SFO4UW_tools:not([hidden]),.SFO4UW_row[data-phone-toolbar] .SFO4UW_trailing:not(.SFO4UW_trailingActive){display:contents}.SFO4UW_row[data-phone-toolbar] .SFO4UW_tools>*,.SFO4UW_row[data-phone-toolbar] [data-slot="conversation.input.left"]>*,.SFO4UW_row[data-phone-toolbar] [data-slot="conversation.input.right"]>*{flex-shrink:0}.SFO4UW_row[data-phone-toolbar] button:focus-visible{outline-offset:-2px}.SFO4UW_row[data-phone-toolbar] .SFO4UW_modes{flex:none;gap:4px;width:max-content}.SFO4UW_row[data-phone-toolbar] .SFO4UW_standardControls{flex:0 auto;gap:4px;min-width:0;margin-left:0}.SFO4UW_row[data-phone-toolbar][data-toolbar-measuring] .SFO4UW_standardControls{flex:none;width:max-content}.SFO4UW_row[data-phone-toolbar] .SFO4UW_addSeat,.SFO4UW_row[data-phone-toolbar] .SFO4UW_submitSeat{z-index:1;flex:none;align-items:center;gap:4px;display:flex;position:absolute;inset-block:2px 6px}.SFO4UW_row[data-phone-toolbar] .SFO4UW_addSeat{left:8px}.SFO4UW_row[data-phone-toolbar] .SFO4UW_submitSeat{margin-left:0;right:8px}.SFO4UW_row[data-phone-toolbar] .SFO4UW_add,.SFO4UW_row[data-phone-toolbar] .SFO4UW_primary{box-sizing:border-box;background-clip:padding-box;width:44px;height:44px}.SFO4UW_row[data-phone-toolbar] .SFO4UW_add{border:8px solid #0000}.SFO4UW_row[data-phone-toolbar] .SFO4UW_primary{border:7px solid #0000}.SFO4UW_row[data-phone-toolbar][data-toolbar-activity] .SFO4UW_controlScroll{display:contents}.SFO4UW_row[data-phone-toolbar][data-toolbar-activity] .SFO4UW_submitSeat{position:static}.SFO4UW_row[data-actions-overflow] [data-composer-overflow-action]{display:none}.SFO4UW_standardControls{align-items:center;gap:12px;min-width:0;display:flex}.SFO4UW_tools[hidden],.SFO4UW_standardControls[hidden]{display:none}.SFO4UW_trailingActive{flex:1;margin-left:0}.SFO4UW_activity{flex:none;align-items:center;display:flex}.SFO4UW_activity:empty{display:none}.SFO4UW_activityExpanded{flex:1;min-width:0}.SFO4UW_annotations{padding:8px 8px 2px}.SFO4UW_creationError{border-radius:var(--dsw-radius-md);background:var(--dsw-alias-interactive-bg-hover-danger);color:var(--dsw-alias-state-error-primary);align-items:center;gap:8px;margin:2px 10px 0;padding:8px 10px;font-size:13px;line-height:18px;display:flex}.SFO4UW_creationErrorIcon{flex:none}.SFO4UW_creationErrorCopy{overflow-wrap:anywhere;-webkit-user-select:text;user-select:text;flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.SFO4UW_creationErrorTitle{font-weight:500}.SFO4UW_creationErrorDetail{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:17px}.SFO4UW_creationRetry{border-radius:var(--dsw-radius-sm);min-height:28px;color:var(--dsw-alias-state-error-primary);font:inherit;cursor:pointer;touch-action:manipulation;background:0 0;border:1px solid;flex:none;padding:4px 10px;font-size:12px;font-weight:500;line-height:16px}.SFO4UW_creationRetry:hover{background:color-mix(in srgb, currentColor 10%, transparent)}.SFO4UW_creationRetry:focus-visible{outline-offset:2px;outline:2px solid}.SFO4UW_pendingControls{align-items:center;gap:6px;min-width:0;display:inline-flex}.SFO4UW_pendingModel{border-radius:var(--dsw-radius-sm);min-width:0;max-width:min(220px,45cqw);height:28px;color:var(--dsw-alias-label-tertiary);white-space:nowrap;user-select:none;align-items:center;gap:6px;padding:0 8px;font-size:13px;line-height:20px;display:inline-flex}.SFO4UW_pendingModelLabel{text-overflow:ellipsis;min-width:0;overflow:hidden}.SFO4UW_pendingHarness{width:30px;height:28px;color:var(--dsw-alias-label-tertiary);opacity:.7;user-select:none;border-radius:6px;flex-shrink:0;justify-content:center;align-items:center;display:inline-flex}[data-phone] .SFO4UW_creationRetry{min-height:36px;padding:6px 12px}[data-phone] .SFO4UW_pendingModel{max-width:100%}[data-phone] .SFO4UW_pendingModelLabel{flex:0 auto;min-width:0;max-width:120px}[data-phone] .SFO4UW_pendingHarness{width:36px;height:36px}`,document.head.appendChild(e)}var $={accessory:`SFO4UW_accessory`,activity:`SFO4UW_activity`,activityExpanded:`SFO4UW_activityExpanded`,add:`SFO4UW_add`,addSeat:`SFO4UW_addSeat`,annotations:`SFO4UW_annotations`,card:`SFO4UW_card`,cardStack:`SFO4UW_cardStack`,cardWorkspaceTrigger:`SFO4UW_cardWorkspaceTrigger`,controlScroll:`SFO4UW_controlScroll`,creationError:`SFO4UW_creationError`,creationErrorCopy:`SFO4UW_creationErrorCopy`,creationErrorDetail:`SFO4UW_creationErrorDetail`,creationErrorIcon:`SFO4UW_creationErrorIcon`,creationErrorTitle:`SFO4UW_creationErrorTitle`,creationRetry:`SFO4UW_creationRetry`,dock:`SFO4UW_dock`,grow:`SFO4UW_grow`,hero:`SFO4UW_hero`,inlineNotices:`SFO4UW_inlineNotices`,input:`SFO4UW_input`,"input-pending":`SFO4UW_input-pending`,inputDisabled:`SFO4UW_inputDisabled`,modes:`SFO4UW_modes`,notice:`SFO4UW_notice`,overlayAnchor:`SFO4UW_overlayAnchor`,pending:`SFO4UW_pending`,pendingControls:`SFO4UW_pendingControls`,pendingHarness:`SFO4UW_pendingHarness`,pendingModel:`SFO4UW_pendingModel`,pendingModelLabel:`SFO4UW_pendingModelLabel`,placeholder:`SFO4UW_placeholder`,primary:`SFO4UW_primary`,retry:`SFO4UW_retry`,root:`SFO4UW_root`,row:`SFO4UW_row`,scroll:`SFO4UW_scroll`,select:`SFO4UW_select`,standardControls:`SFO4UW_standardControls`,submitSeat:`SFO4UW_submitSeat`,tools:`SFO4UW_tools`,topRail:`SFO4UW_topRail`,trailing:`SFO4UW_trailing`,trailingActive:`SFO4UW_trailingActive`};let GA=[],KA=(0,g.memo)(function({useSession:e,useInput:t,inputActions:n,keyboard:r,pendingDraft:i,addFiles:a,removeAttachment:o,resolveDraftAttachments:s,retryFileUpload:c,revealResponseAnnotation:l,toggleCommandMenu:u,stop:f,t:p,renderSlot:m,usePendingDraftText:_,useBusyEnter:v,useFileUploads:y,useNotices:b,useLexicon:ee,useMenuLauncher:te,useStopShortcut:ne,useProjection:re,sessionId:ie,variant:ae,disabled:oe=!1,preparingDraft:se=!1,sessionCreation:ce,onRetrySessionCreation:le,blocked:ue,workspacePickerOpen:de=!1,onRequestWorkspace:fe,placeholder:pe,topBar:me,accessory:x}){let S=t(e=>e),he=_(e=>e),ge=S?.responseAnnotations??GA,_e=S?.hoveredResponseAnnotationId,ve=(0,g.useMemo)(()=>({regionAria:p(`annotation.rail`),count:e=>p(`annotation.trayCount`,{count:e}),clearAll:p(`annotation.clearAll`),emptyComment:p(`annotation.emptyComment`),editHint:e=>p(`annotation.editHint`,{index:e}),revealHint:e=>p(`annotation.revealHint`,{index:e}),remove:e=>p(`annotation.remove`,{index:e})}),[p]),ye=(0,g.useMemo)(()=>ge.map(e=>({id:e.id,text:e.text,...e.annotation===void 0?{}:{annotation:e.annotation},canReveal:e.anchor!==void 0})),[ge]),be=b(e=>e),xe=v(e=>e),Se=ne(e=>e),Ce=te(e=>e===`command`),[we,Te]=(0,g.useState)(!1);(0,g.useEffect)(()=>{Te(!1)},[ie]);let Ee=e(e=>e.promptError)??null,De=e(e=>e.running)??!1,Oe=e(e=>e.subagent)??null,ke=e(e=>e.removed)??!1,Ae=re(`plan`,e=>e!==void 0&&(e.pending?!e.active:e.active)),je=re(`goal`,e=>e!=null),Me=ie===void 0&&i!==void 0&&ce!==void 0&&ce.state!==`idle`,Ne=Me&&ce.state===`creating`,Pe=Me&&ce.state===`error`,Fe=Me?ce.token:void 0,Ie=S!==void 0&&r!==void 0&&n!==void 0,Le=Me?he:S?.draft??``,Re=S?.primaryAction,C=Me?i.editor:r?.editor??null,ze=(0,g.useMemo)(()=>S===void 0||s===void 0?[]:s(S.attachmentIds),[s,S?.attachmentIds]),Be=Le.trim()===``&&ze.length===0&&ge.length===0,Ve=y(e=>e),He=ze.some(e=>Ve[e.id]?.status===`error`),[Ue,We]=(0,g.useState)(null),Ge=(0,g.useRef)(0),Ke=(0,g.useCallback)(e=>{Ge.current+=1,We({seq:Ge.current,text:e})},[]),qe=(0,g.useCallback)(()=>{We(null)},[]),Je=re(`imageLimits`),Ye=re(`attachmentInput`),Xe=re(`queueState`),Ze=Ye?.enabled!==!1,Qe=Ye?.imagesOnly===!0;(0,g.useEffect)(()=>{if(Ee===null)return;let{error:e}=Ee;e.code===`session/writer-held`?Ke(p(`error.sessionInUse`)):e.code===`remote/turn-changed`?Ke(p(`error.steerTurnChanged`)):e.code===`remote/steer-unavailable`?Ke(p(`error.remoteSteerUnavailable`)):Ke(e.code===`session/attachment-invalid`||e.code===`subagent/attachment-invalid`?PA(p,e.details.reason,Je):`${e.message} (${e.code})`)},[Ee,Ke,p,Je]),(0,g.useEffect)(()=>{be?.level===`error`&&Ke(be.text)},[be,Ke]);let $e=(0,g.useRef)(null),[et,tt]=(0,g.useState)({phone:!1,overflowActions:!1});(0,g.useLayoutEffect)(()=>{let e=$e.current;if(e!==null)return UA(e,tt)},[]);let nt=(0,g.useRef)(null),rt=(0,g.useRef)(null),it=Oe?.address.mode===`continuable`,at=it&&Oe.parentAvailable!==!0,ot=Me||ke||oe||!Ie||ue!==void 0||at,st=ot,ct=Me||ke||oe||!Ie,lt=S?.phase===`adjudicating`||S?.phase===`submitting`,ut=!Me&&oe&&!ke&&fe!==void 0,dt=Me||Ie&&!lt&&(!st||!Me&&se&&Ie&&!ke&&!at&&!ut),ft=ke||!dt&&!ut,pt=Oe===null||Oe.address.mode===`continuable`,mt=!st&&!lt&&Be&&De&&pt&&Xe?.previewOnly!==!0&&S.queue.length>0,ht=(0,g.useRef)(Me),gt=(0,g.useRef)(!1);if(ht.current&&!Me&&ie!==void 0){let e=document.activeElement;e!==null&&nt.current?.contains(e)&&(gt.current=!0)}(0,g.useLayoutEffect)(()=>{ht.current=Me},[Me]),(0,g.useEffect)(()=>{S!==void 0&&n!==void 0&&ze.length!==S.attachmentIds.length&&n.pruneAttachments(ze.map(e=>e.id))},[ze,S?.attachmentIds,n]);let _t=()=>{wA(rt)};(0,g.useEffect)(()=>{Me?C!==null&&(0,d.shouldAutoFocusTextInput)()&&TA(C,_t):C!==null&&dt&&(gt.current?(gt.current=!1,TA(C,_t)):!st&&(0,d.shouldAutoFocusTextInput)()&&TA(C,_t))},[Me,Fe,st,dt,ie,C]),(0,g.useEffect)(()=>{st||Le===``||_t()},[Le!==``]),(0,g.useEffect)(()=>DA(rt),[]);let vt=(0,g.useRef)({sessionId:ie,ids:new Set(ze.map(e=>e.id)),count:ze.length}),[yt,bt]=(0,g.useState)(0),xt=(0,g.useRef)(0);(0,g.useEffect)(()=>{let e=vt.current,t=e.sessionId!==ie,n=yt!==xt.current;if(xt.current=yt,t){vt.current={sessionId:ie,ids:new Set(ze.map(e=>e.id)),count:ze.length};return}let r=!1;for(let t of ze)e.ids.has(t.id)||(e.ids.add(t.id),r=!0);let i=e.count!==ze.length;e.count=ze.length;let a=(r||n)&&(0,d.shouldAutoFocusTextInput)();if(!a&&!i&&!r&&!n||C===null||!dt||st)return;a&&TA(C,_t);let o=window.requestAnimationFrame(()=>{let e=C.getRootElement();if(e===null)return;let t=e.ownerDocument.activeElement;a&&(t===null||t===e.ownerDocument.body||t===e.ownerDocument.documentElement)&&TA(C,_t),EA(C),_t()});return()=>{window.cancelAnimationFrame(o)}},[ie,ze,yt,C,dt,st]);let St=(0,g.useCallback)((e,t)=>{if(Oe!==null||a===void 0||e.length===0)return;if(!Ze){Ke(p(`attachment.unavailable`));return}let n=(()=>{if(Qe&&e.some(e=>!(Je?.mediaTypes)?.includes(e.type)))return p(`image.unsupportedType`);if(Je!==void 0){let t=Je.mediaTypes,n=e.filter(e=>t.includes(e.type)),r=ze.filter(e=>e.kind===`image`);if(r.length+n.length>Je.maxImagesPerMessage)return p(`image.tooMany`,{count:Je.maxImagesPerMessage});if(n.some(e=>e.size>Je.maxImageBytes))return p(`image.fileTooLarge`,{size:NA(Je.maxImageBytes)});if(r.reduce((e,t)=>e+t.file.size,0)+n.reduce((e,t)=>e+t.size,0)>Je.maxMessageImageBytes)return p(`image.totalTooLarge`,{size:NA(Je.maxMessageImageBytes)})}return a(e,t)})();n===null?bt(e=>e+1):Ke(n)},[Oe,a,Ze,Qe,ze,Je,Ke,p]),Ct=Ze&&Oe===null&&!st&&!lt&&a!==void 0,wt=p(Ze?Qe?`input.imagesAndCommands`:`input.commands`:`input.commandsOnly`),Tt=(0,g.useRef)(null),Et=e=>{let t=e.target.files===null?[]:[...e.target.files];e.target.value=``,t.length>0&&St(t)},Dt=(0,g.useRef)({locked:st,canPasteText:dt,machineBusy:lt,primaryAction:Re,canSteerQueue:mt,running:De,steeringAvailable:pt,busyEnter:xe,intakeFiles:St,uploadsFailed:He,showToast:Ke,t:p,canAcceptDrop:Ct});Dt.current={locked:st,canPasteText:dt,machineBusy:lt,primaryAction:Re,canSteerQueue:mt,running:De,steeringAvailable:pt,busyEnter:xe,intakeFiles:St,uploadsFailed:He,showToast:Ke,t:p,canAcceptDrop:Ct},(0,g.useEffect)(()=>{if(r!==void 0)return OA(r,Dt,Tt)},[r]),(0,g.useEffect)(()=>{if(C!==null){if(Me&&i!==void 0)return CA(C,{arbitrate:()=>`pass`,space:()=>!1,dismissPopup:()=>{},canSubmit:()=>!1,submit:()=>{},intakeFiles:()=>{Dt.current.showToast(Dt.current.t(`newSession.uploadUnavailable`))},pasteText:e=>{i.paste(e)}});if(r!==void 0)return kA(C,r,Dt)}},[C,r,Me,i]);let Ot=e=>{MA(e,C)},kt=e=>{!Mt&&e.button===0&&AA(e.currentTarget.ownerDocument),MA(e,C)},At=()=>{r!==void 0&&(C!==null&&(0,d.shouldAutoFocusTextInput)()&&TA(C,_t),u?.(r.caretSpan()))},jt=e=>{ut&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),fe())},Mt=Re===void 0&&De&&Oe===null&&(Be||ue!==void 0),Nt=Mt?f===void 0:(Re===void 0?Be:Re.disabled)||ot||lt,Pt=De&&it,Ft=dk(xe,De,`enter`,pt),It=!Be&&S?.phase===`plain`&&!Le.trimStart().startsWith(`/`),Lt=p(Mt?`input.stop`:Re===void 0&&De&&pt&&!ot&&!He&&It?Ft===`steer`?`input.send.steer`:`input.send.queue`:`input.send`),Rt=()=>{(0,d.shouldAutoFocusTextInput)()||jA(C)},zt=()=>{Rt(),f?.()},Bt=()=>{Mt?zt():He?Ke(p(`file.retryOrRemove`)):Re===void 0?r!==void 0&&!Be&&!ot&&!lt&&(Rt(),r.submit(Ft,`click`)):Nt||(Rt(),Re.run())},Vt=(S?.phase===`claimed`||S?.phase===`submitting`)&&S.claim!==void 0&&Le.startsWith(S.claim.token),Ht=Vt&&S.claim.hint!==void 0&&Le.slice(S.claim.token.length).trim()===``?S.claim.hint:null,Ut=(()=>{if(Ht===null)return null;let e=S?.claim?.name??``,t=`hint.${e===`goal`&&je?`goal.active`:e}`,n=p(t);return n===t?Ht:n})(),Wt=pe??p(at?`placeholder.parentOffline`:ot?`placeholder.unavailable`:mt?`placeholder.steerQueue`:Ae?`placeholder.plan`:`placeholder.default`);return/* @__PURE__ */ (0,h.jsxs)(`div`,{className:sC($.root,ae===`hero`&&$.hero),"data-composer-variant":ae,children:[Ue!==null&&/* @__PURE__ */ (0,h.jsx)(d.Toast,{text:Ue.text,icon:/* @__PURE__ */ (0,h.jsx)(d.IconWarningOutlineRegular,{}),anchor:nt.current,onDone:qe},Ue.seq),be?.level===`info`&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.notice,role:`status`,children:be.text}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.cardStack,children:[me!==void 0&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.topRail,"data-composer-top-bar":``,onClick:e=>{e.stopPropagation()},onPointerDown:e=>{e.stopPropagation()},children:me}),/* @__PURE__ */ (0,h.jsxs)(`div`,{ref:nt,className:sC($.card,ut&&$.cardWorkspaceTrigger),"data-composer-card":!0,onClick:ut?fe:void 0,onPointerDown:ut?e=>{e.stopPropagation()}:void 0,children:[ie!==void 0&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.overlayAnchor,children:m(`conversation.input.overlay`,{})}),x!==void 0&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.accessory,children:x}),Pe&&/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.creationError,role:`alert`,"data-new-session-error":``,children:[/* @__PURE__ */ (0,h.jsx)(d.IconWarningOutlineRegular,{className:$.creationErrorIcon,size:16}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.creationErrorCopy,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:$.creationErrorTitle,children:p(`newSession.createFailedTitle`)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:$.creationErrorDetail,children:ce.reason===`no-harness`?p(`newSession.createFailed.noHarness`):ce.reason===`workspace-required`?p(`newSession.createFailed.workspaceRequired`):ce.message??p(`newSession.createFailed.generic`)})]}),le!==void 0&&/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:$.creationRetry,onMouseDown:Ot,onClick:le,children:p(`newSession.retry`)})]}),ye.length===0?null:/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.annotations,children:/* @__PURE__ */ (0,h.jsx)(d.ResponseAnnotationTray,{annotations:ye,hoveredId:_e,disabled:st||lt,labels:ve,onHover:e=>{n?.hoverResponseAnnotation(e)},onReveal:l===void 0?void 0:e=>{l(e)},onUpdate:(e,t)=>{n?.updateResponseAnnotation(e,t)},onRemove:e=>{n?.removeResponseAnnotation(e)},onClearAll:()=>{n?.clearResponseAnnotations()}})}),S===void 0||ie===void 0?null:/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.inlineNotices,children:m(`conversation.input.notice`,{})}),m(`conversation.input.attachments`,{attachments:ze,canAcceptDrop:Ct,onAddFiles:St,onRemoveAttachment:e=>{o?.(e)},uploads:Ve,onRetryFile:e=>{c?.(e)},dropLimits:Je===void 0?void 0:{count:Je.maxImagesPerMessage,size:NA(Je.maxImageBytes)}}),/* @__PURE__ */ (0,h.jsx)(bA,{classNames:$,editor:C,scrollRef:rt,editable:dt,editorDisabled:ft,preserveFocus:gt.current,phase:Me?`plain`:S?.phase??`inert`,placeholderText:Wt,ariaLabel:ut?p(`hero.chooseWorkspace`):Wt,workspaceTrigger:ut,workspacePickerOpen:de,onWorkspaceKeyDown:jt,hint:Ut,showPlaceholder:Le===``&&ze.length===0&&!Vt}),/* @__PURE__ */ (0,h.jsx)(`div`,{ref:$e,className:$.row,"data-composer-toolbar":!0,"data-command-menu-open":Ce||void 0,"data-toolbar-activity":we||void 0,children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.controlScroll,"data-toolbar-scroll":!0,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.tools,hidden:we,"data-composer-tools":!0,children:[/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.addSeat,"data-toolbar-fixed":`start`,children:/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:et.phone,label:wt,side:`top`,delayMs:500,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:$.add,"aria-label":wt,"aria-haspopup":`listbox`,"aria-expanded":Ce,disabled:st||lt||u===void 0,onMouseDown:Ot,onClick:At,children:/* @__PURE__ */ (0,h.jsx)(d.IconPlusOutlineMedium,{size:14})})})}),/* @__PURE__ */ (0,h.jsx)(`input`,{ref:Tt,type:`file`,accept:Qe?Je?.mediaTypes.join(`,`):void 0,multiple:!0,disabled:!Ze||Oe!==null,hidden:!0,onChange:Et}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.modes,children:[ie===void 0?null:m(`conversation.input.permission`,{locked:st}),ie===void 0?null:m(`conversation.input.plan`,{locked:st})]}),S===void 0||ie===void 0?null:m(`conversation.input.left`,{})]}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:sC($.trailing,we&&$.trailingActive),children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.standardControls,hidden:we,children:[S===void 0||ie===void 0?null:m(`conversation.input.right`,{overflowActions:et.overflowActions}),ie===void 0?Ne?/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.pendingControls,role:`status`,"aria-live":`polite`,"data-new-session-loading":``,children:[/* @__PURE__ */ (0,h.jsxs)(`span`,{className:$.pendingModel,children:[/* @__PURE__ */ (0,h.jsx)(d.StateDot,{state:`ongoing`}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:$.pendingModelLabel,children:p(`newSession.loadingModel`)})]}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:$.pendingHarness,role:`img`,"aria-label":p(`newSession.loadingHarness`),"aria-busy":`true`,title:p(`newSession.loadingHarness`),children:/* @__PURE__ */ (0,h.jsx)(d.StateDot,{state:`ongoing`})})]}):null:m(`conversation.input.model`,{locked:ct})]}),S===void 0||ie===void 0?null:/* @__PURE__ */ (0,h.jsx)(`div`,{className:we?$.activityExpanded:$.activity,children:m(`conversation.input.activity`,{locked:st,onActiveChange:Te})}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.submitSeat,"data-toolbar-fixed":`end`,children:[Pt&&/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:et.phone,label:p(`input.stop`),shortcutKeys:Se,side:`top`,delayMs:500,disabled:f===void 0,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:$.primary,"aria-label":p(`input.stop`),disabled:f===void 0,onMouseDown:Ot,onClick:zt,children:/* @__PURE__ */ (0,h.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(`rect`,{x:`3`,y:`3`,width:`10`,height:`10`,rx:`3`,fill:`currentColor`})})})}),/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:et.phone,label:Mt?p(`input.stop`):Lt,shortcutKeys:Mt?Se:void 0,side:`top`,delayMs:500,disabled:Nt,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:$.primary,"aria-label":Lt,disabled:Nt,onMouseDown:kt,onClick:Bt,children:Mt?/* @__PURE__ */ (0,h.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(`rect`,{x:`3`,y:`3`,width:`10`,height:`10`,rx:`3`,fill:`currentColor`})}):/* @__PURE__ */ (0,h.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(`path`,{d:`M8.3125 0.980183C8.66767 1.0531 8.97902 1.20418 9.2627 1.43233C9.48724 1.61297 9.73029 1.85793 9.97949 2.10714L14.707 6.83468L13.293 8.24874L9 3.95577V15.0417H7V3.95577L2.70703 8.24874L1.29297 6.83468L6.02051 2.10714C6.26971 1.85793 6.51277 1.61297 6.7373 1.43233C6.97662 1.23986 7.28445 1.04402 7.6875 0.980183C7.8973 0.947006 8.1031 0.95516 8.3125 0.980183Z`,fill:`currentColor`})})})})]})]})]})})]})]}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.dock,"data-composer-dock":!0,"data-cx-region":`composer-dock`,children:[ae===`composer`&&S!==void 0&&ie!==void 0?m(`conversation.composer.dock`,{}):null,we?null:/* @__PURE__ */ (0,h.jsx)(HA,{useProjection:re,t:p})]})]})}),qA=`@deepseek-ai/dsh-client-ui-conversation/TodoPanel.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(qA)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=qA,e.textContent=`.OKyn-W_root{box-sizing:border-box;width:calc(100% - var(--dsh-composer-side-clearance) - var(--dsh-composer-side-clearance) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));max-width:calc(var(--dsh-composer-card-max-width) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-lg);background:var(--dsw-specific-menu);backdrop-filter:var(--dsw-menu-backdrop-filter);box-shadow:var(--dsw-elevation-panel);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);border:0;flex:none;margin:0 auto;overflow:hidden}.OKyn-W_body{flex-direction:column;gap:8px;padding:6px 12px;display:flex}.OKyn-W_header{text-align:left;cursor:pointer;background:0 0;border:none;align-items:center;gap:10px;width:100%;padding:0;display:flex}.OKyn-W_lead{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.OKyn-W_title{color:var(--dsw-alias-label-primary);flex:none;font-size:13px;font-weight:500;line-height:24px}.OKyn-W_progress{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex:auto;font-size:13px;font-weight:400;line-height:20px;overflow:hidden}.OKyn-W_chevron{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.OKyn-W_list{flex-direction:column;gap:8px;max-height:180px;margin:0;padding:0;list-style:none;display:flex;overflow-y:auto}.OKyn-W_item{min-width:0;color:var(--dsw-alias-label-secondary);align-items:center;gap:10px;font-size:13px;line-height:20px;display:flex}.OKyn-W_glyph{flex:none;place-items:center;width:16px;height:16px;display:grid}.OKyn-W_content{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}`,document.head.appendChild(e)}var JA={body:`OKyn-W_body`,chevron:`OKyn-W_chevron`,content:`OKyn-W_content`,glyph:`OKyn-W_glyph`,header:`OKyn-W_header`,item:`OKyn-W_item`,lead:`OKyn-W_lead`,list:`OKyn-W_list`,progress:`OKyn-W_progress`,root:`OKyn-W_root`,title:`OKyn-W_title`};
171
+ n!==null&&(e.ctrlKey||e.deltaY===0||n.scrollBy({top:Hk(e,n)}))},[]);return/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.widthHandle,"data-side":e.side,"data-width-handle":e.side,onPointerDown:l,onPointerMove:u,onPointerUp:d,onPointerCancel:f,onLostPointerCapture:f,onWheel:p})}function Wk({container:e,phase:t}){let n=(0,g.useCallback)(e=>{let t=e.parentElement??e,n=e.offsetWidth;t.style.setProperty(`--dsh-conversation-column-width`,`${n}px`);let r=Bk();r===null?t.style.removeProperty(`--dsh-chat-user-width`):t.style.setProperty(`--dsh-chat-user-width`,`${Vk(n,r)}px`)},[]);(0,g.useLayoutEffect)(()=>{if(e===null)return;let t=new ResizeObserver(()=>{n(e)});return t.observe(e),n(e),()=>{t.disconnect()}},[e,n]);let r=(0,g.useCallback)(()=>e===null?680:Vk(e.offsetWidth,Bk()),[e]),i=(0,g.useCallback)(t=>{e!==null&&(e.parentElement??e).style.setProperty(`--dsh-chat-user-width`,`${Vk(e.offsetWidth,t)}px`)},[e]),a=(0,g.useCallback)(t=>{e!==null&&localStorage.setItem(zk,`${Vk(e.offsetWidth,t)}`)},[e]),o=(0,g.useCallback)(()=>{e!==null&&n(e)},[e,n]);return e===null||t!==`active`?null:[`left`,`right`].map(e=>/* @__PURE__ */ (0,h.jsx)(Uk,{side:e,onStart:r,onDrag:i,onCommit:a,onEnd:o},e))}let Gk={widthControls:Wk};function Kk(e){let{sessionId:t,useSession:n,useSessions:r,useConversation:i,renderSlot:a,renderFactorySlot:o}=e,s=n(e=>e),c=i(e=>e),l=s===void 0||c===void 0?`blank`:Lk(s,c),u=s?.openState,d=r(e=>t===void 0?void 0:e.byId[t]?.blank),f=s?.subagent?.address.mode===`continuable`&&s.subagent.parentAvailable===void 0,p=t!==void 0&&(l===`blank`&&u===`loading`&&d!==!0||f),m=t===void 0||l===`blank`&&(u===`open`||d===!0),g=p?`settling`:m?`hero`:`active`;return/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.root,"data-phase":g,"data-cx-region":`conversation`,children:[a(`conversation.header`,{}),a(`conversation.header.notice`,{}),o(`conversation.content`,{variant:`main`,phase:g,hero:m},{slots:Gk})]})}function qk(e){return/* @__PURE__ */ (0,h.jsx)(Kk,{...e})}function Jk(e,t){return e===`default-workspace`?t:e}let Yk=`@deepseek-ai/dsh-client-ui-conversation/HeroShell.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Yk)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=Yk,e.textContent=`.Dgrl1G_root{justify-content:center;align-items:center;min-width:0;height:100%;padding:0 24px;display:flex}.Dgrl1G_stack{width:100%;max-width:var(--dsh-composer-card-max-width);flex-direction:column;align-items:stretch;gap:12px;display:flex;overflow:visible}.Dgrl1G_headline{color:var(--dsw-alias-label-primary);flex-wrap:wrap;justify-content:center;align-items:center;gap:12px 10px;font-size:26px;font-weight:500;line-height:32px;display:flex}.Dgrl1G_titleGroup{flex-wrap:wrap;justify-content:center;align-items:center;gap:4px 7px;min-width:0;display:flex}.Dgrl1G_previewBadge{border:.5px solid var(--dsw-alias-interactive-bg-hover);corner-shape:round;background:var(--dsw-alias-state-business-tertiary);color:var(--dsw-alias-label-primary-bluish);font-family:var(--ds-font-family-code);white-space:nowrap;border-radius:999px;align-self:flex-start;margin-top:2px;padding:1px 7px 0;font-size:12px;font-weight:500;line-height:18px}.Dgrl1G_previewBadgeDesktop{display:none}html[data-codexhost-shell] .Dgrl1G_previewBadgeWeb,html[data-tauri-shell] .Dgrl1G_previewBadgeWeb{display:none}html[data-codexhost-shell] .Dgrl1G_previewBadgeDesktop,html[data-tauri-shell] .Dgrl1G_previewBadgeDesktop{display:inline}.Dgrl1G_fishHitbox{flex:none;justify-content:center;align-items:center;display:inline-flex}.Dgrl1G_fish{transform-origin:50% 60%;color:var(--dsw-alias-label-primary);display:block;overflow:visible}@keyframes Dgrl1G_hero-fish-swim{0%,to{transform:none}35%{transform:rotate(-4deg)translate(-.4px,-.9px)}70%{transform:rotate(1.6deg)translate(.3px,.2px)}}@media (hover:hover) and (prefers-reduced-motion:no-preference){.Dgrl1G_fishHitbox:hover .Dgrl1G_fish{animation:1.6s ease-in-out infinite Dgrl1G_hero-fish-swim}}.Dgrl1G_body{flex-direction:column;gap:12px;min-width:0;display:flex;position:relative;overflow:visible}.Dgrl1G_body>*{z-index:1;position:relative}.Dgrl1G_body>.Dgrl1G_workspaceRow{z-index:10;align-items:center;min-width:0;padding-left:8px;display:flex}.Dgrl1G_workspace{border-radius:var(--dsw-radius-sm);max-width:min(100%,360px);min-height:28px;color:var(--dsw-alias-label-primary);cursor:pointer;background:0 0;border:none;align-items:center;gap:4px;padding:0 8px;font-size:13px;font-weight:500;line-height:20px;display:inline-flex}.Dgrl1G_workspace:not(:disabled):hover,.Dgrl1G_workspace[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover)}.Dgrl1G_workspace:disabled{cursor:default}.Dgrl1G_folder{color:var(--dsw-alias-label-primary);flex:none}.Dgrl1G_workspaceLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.Dgrl1G_chevron{color:var(--dsw-alias-label-caption);flex:none}.Dgrl1G_modalInput{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}.Dgrl1G_modalInput::placeholder{color:var(--dsw-alias-label-caption)}.Dgrl1G_modalInput:disabled{color:var(--dsw-alias-label-dimmed)}.Dgrl1G_modalAction{min-width:72px}.Dgrl1G_modalError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}`,document.head.appendChild(e)}var Xk={body:`Dgrl1G_body`,chevron:`Dgrl1G_chevron`,fish:`Dgrl1G_fish`,fishHitbox:`Dgrl1G_fishHitbox`,folder:`Dgrl1G_folder`,headline:`Dgrl1G_headline`,"hero-fish-swim":`Dgrl1G_hero-fish-swim`,modalAction:`Dgrl1G_modalAction`,modalError:`Dgrl1G_modalError`,modalInput:`Dgrl1G_modalInput`,previewBadge:`Dgrl1G_previewBadge`,previewBadgeDesktop:`Dgrl1G_previewBadgeDesktop`,previewBadgeWeb:`Dgrl1G_previewBadgeWeb`,root:`Dgrl1G_root`,stack:`Dgrl1G_stack`,titleGroup:`Dgrl1G_titleGroup`,workspace:`Dgrl1G_workspace`,workspaceLabel:`Dgrl1G_workspaceLabel`,workspaceRow:`Dgrl1G_workspaceRow`};function Zk(e){let t=Qu(e);return t===``?e:t}function Qk({buttonRef:e,label:t,projectless:n=!1,menuOpen:r=!1,onClick:i,t:a}){return/* @__PURE__ */ (0,h.jsxs)(`button`,{ref:e,type:`button`,className:Xk.workspace,"aria-label":a(`hero.chooseWorkspace`),"aria-haspopup":`menu`,"aria-expanded":r,onClick:i,children:[t===void 0||n?/* @__PURE__ */ (0,h.jsx)(d.IconFolderCloseRegular,{className:Xk.folder,size:16}):/* @__PURE__ */ (0,h.jsx)(d.IconFolderOpenRegular,{className:Xk.folder,size:16}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Xk.workspaceLabel,children:t??a(`hero.chooseWorkspace`)}),/* @__PURE__ */ (0,h.jsx)(d.IconChevronDownOutlineRegular,{className:Xk.chevron,size:12})]})}function $k({hovering:e}){return/* @__PURE__ */ (0,h.jsx)(`svg`,{className:Xk.fish,width:34,height:34*d.FISH_LOGO_VIEWBOX.height/d.FISH_LOGO_VIEWBOX.width,viewBox:`0 0 ${d.FISH_LOGO_VIEWBOX.width} ${d.FISH_LOGO_VIEWBOX.height}`,fill:`none`,"aria-hidden":`true`,children:/* @__PURE__ */ (0,h.jsx)(`path`,{d:d.FISH_LOGO_PATH,fill:`currentColor`,children:e&&/* @__PURE__ */ (0,h.jsx)(`animate`,{attributeName:`d`,values:`${d.FISH_LOGO_PATH};M22.403 0.567C22.145 0.477 22.068 0.718 21.939 0.85C21.895 0.893 21.86 0.947 21.824 0.997C21.515 1.421 21.13 1.721 20.591 1.77C19.829 1.867 19.221 2.244 18.712 2.958C18.535 2.227 18.116 1.839 17.516 1.626C17.203 1.506 16.887 1.379 16.663 1.064C16.508 0.839 16.462 0.581 16.383 0.329C16.332 0.176 16.283 0.02 16.121 -0.002C15.944 -0.029 15.875 0.133 15.805 0.269C15.52 0.822 15.408 1.43 15.42 2.046C15.449 3.432 16.031 4.532 17.202 5.274C17.337 5.356 17.374 5.445 17.335 5.582C17.261 5.862 17.169 6.134 17.086 6.413C17.032 6.59 16.952 6.63 16.764 6.558C16.118 6.301 15.562 5.909 15.074 5.433C14.248 4.633 13.5 3.751 12.568 3.06C12.349 2.898 12.13 2.748 11.903 2.605C10.952 1.682 12.028 0.923 12.277 0.833C12.537 0.739 12.367 0.416 11.526 0.42C10.684 0.424 9.914 0.706 8.933 1.081C8.789 1.138 8.638 1.179 8.484 1.213C7.593 1.044 6.668 1.006 5.702 1.115C3.883 1.318 2.43 2.178 1.362 3.646C0.079 5.41 -0.223 7.415 0.147 9.506C0.535 11.71 1.66 13.535 3.389 14.962C5.181 16.441 7.246 17.166 9.601 17.027C11.032 16.944 12.624 16.753 14.421 15.232C14.874 15.458 15.35 15.548 16.138 15.615C16.746 15.672 17.331 15.585 17.784 15.491C18.493 15.341 18.444 14.684 18.188 14.564C16.108 13.595 16.565 13.989 16.15 13.67C17.206 12.42 18.82 10.198 19.363 7.086C19.421 6.709 19.484 6.171 19.469 5.866C19.458 5.681 19.493 5.604 19.681 5.556C20.199 5.412 20.691 5.172 21.125 4.806C22.366 3.824 22.758 2.554 22.708 1.1C22.7 0.878 22.649 0.654 22.403 0.567ZM11.175 14.451C9.159 12.726 8.182 12.088 7.778 12.067C7.401 12.047 7.469 12.505 7.552 12.807C7.639 13.103 7.752 13.313 7.91 13.581C8.02 13.758 8.095 14.01 7.801 14.16C7.152 14.487 6.023 13.806 5.97 13.772C4.657 12.85 3.559 11.766 2.785 10.369C2.037 9.025 1.603 7.583 1.532 6.044C1.513 5.672 1.622 5.541 1.992 5.473C2.479 5.383 2.981 5.364 3.468 5.436C5.525 5.736 7.276 6.675 8.744 8.323C9.582 9.299 10.216 10.425 10.869 11.496C11.563 12.592 12.31 13.603 13.262 14.414C13.598 14.696 13.866 14.91 14.123 15.068C13.349 15.154 12.058 15.167 11.175 14.452L11.175 14.451ZM12.141 8.26C12.141 8.095 12.273 7.963 12.439 7.963C12.476 7.963 12.511 7.971 12.541 7.982C12.582 7.997 12.62 8.019 12.65 8.053C12.704 8.106 12.733 8.181 12.733 8.26C12.733 8.425 12.601 8.556 12.435 8.556C12.27 8.556 12.141 8.425 12.141 8.26ZM15.142 9.799C14.949 9.878 14.757 9.945 14.572 9.953C14.284 9.968 13.972 9.851 13.802 9.709C13.537 9.487 13.348 9.363 13.27 8.977C13.236 8.812 13.255 8.556 13.284 8.41C13.352 8.094 13.277 7.892 13.055 7.708C12.873 7.558 12.643 7.516 12.39 7.516C12.296 7.516 12.209 7.475 12.145 7.441C12.039 7.389 11.952 7.257 12.035 7.096C12.062 7.043 12.19 6.916 12.22 6.893C12.563 6.698 12.96 6.762 13.326 6.908C13.665 7.047 13.922 7.302 14.292 7.663C14.669 8.098 14.738 8.218 14.953 8.545C15.123 8.801 15.277 9.063 15.383 9.364C15.447 9.551 15.364 9.705 15.142 9.799Z;${d.FISH_LOGO_PATH};M23.271 2.216C23.039 2.071 22.91 2.287 22.755 2.388C22.703 2.42 22.656 2.464 22.61 2.505C22.214 2.848 21.771 3.054 21.225 2.956C20.412 2.784 19.68 2.919 19.005 3.435C18.92 2.663 18.493 2.157 17.808 1.798C17.446 1.621 17.08 1.449 16.83 1.111C16.656 0.872 16.611 0.612 16.524 0.354C16.469 0.198 16.414 0.039 16.223 0.009C16.017 -0.024 15.936 0.137 15.856 0.271C15.539 0.822 15.418 1.43 15.429 2.046C15.454 3.432 16.041 4.538 17.196 5.36C17.325 5.456 17.356 5.547 17.312 5.674C17.229 5.936 17.134 6.191 17.051 6.454C16.999 6.623 16.921 6.659 16.738 6.58C16.107 6.306 15.56 5.909 15.074 5.433C14.248 4.633 13.5 3.751 12.568 3.06C12.349 2.898 12.13 2.748 11.903 2.605C10.952 1.682 12.028 0.923 12.277 0.833C12.537 0.739 12.367 0.416 11.526 0.42C10.684 0.424 9.914 0.706 8.933 1.081C8.789 1.138 8.638 1.179 8.484 1.213C7.593 1.044 6.668 1.006 5.702 1.115C3.883 1.318 2.43 2.178 1.362 3.646C0.079 5.41 -0.223 7.415 0.147 9.506C0.535 11.71 1.66 13.535 3.389 14.962C5.181 16.441 7.246 17.166 9.601 17.027C11.032 16.944 12.624 16.753 14.421 15.232C14.874 15.458 15.35 15.548 16.138 15.615C16.746 15.672 17.331 15.585 17.784 15.491C18.493 15.341 18.444 14.684 18.188 14.564C16.108 13.595 16.565 13.989 16.15 13.67C17.206 12.42 18.82 10.198 19.278 7.246C19.318 6.948 19.375 6.534 19.371 6.293C19.371 6.145 19.411 6.092 19.597 6.098C20.113 6.109 20.619 6.051 21.096 5.891C22.503 5.375 23.169 4.232 23.448 2.804C23.49 2.586 23.491 2.356 23.271 2.216ZM11.175 14.49C9.159 13.005 8.182 12.567 7.778 12.621C7.401 12.673 7.469 13.087 7.552 13.354C7.639 13.619 7.752 13.797 7.91 14.024C8.02 14.175 8.095 14.406 7.801 14.609C7.152 15.063 6.023 14.63 5.97 14.609C4.657 13.941 3.559 12.965 2.785 11.569C2.037 10.225 1.603 8.783 1.532 7.244C1.513 6.872 1.622 6.741 1.992 6.673C2.479 6.583 2.981 6.564 3.468 6.636C5.525 6.936 7.276 7.843 8.744 9.163C9.582 9.888 10.216 10.783 10.869 11.679C11.563 12.659 12.31 13.617 13.262 14.415C13.598 14.696 13.866 14.91 14.123 15.068C13.349 15.155 12.058 15.177 11.175 14.491L11.175 14.49ZM12.141 8.26C12.141 8.095 12.273 7.963 12.439 7.963C12.476 7.963 12.511 7.971 12.541 7.982C12.582 7.997 12.62 8.019 12.65 8.053C12.704 8.106 12.733 8.181 12.733 8.26C12.733 8.425 12.601 8.556 12.435 8.556C12.27 8.556 12.141 8.425 12.141 8.26ZM15.142 9.799C14.949 9.878 14.757 9.945 14.572 9.953C14.284 9.968 13.972 9.851 13.802 9.709C13.537 9.487 13.348 9.363 13.27 8.977C13.236 8.812 13.255 8.556 13.284 8.41C13.352 8.094 13.277 7.892 13.055 7.708C12.873 7.558 12.643 7.516 12.39 7.516C12.296 7.516 12.209 7.475 12.145 7.441C12.039 7.389 11.952 7.257 12.035 7.096C12.062 7.043 12.19 6.916 12.22 6.893C12.563 6.698 12.96 6.762 13.326 6.908C13.665 7.047 13.922 7.302 14.292 7.663C14.669 8.098 14.738 8.218 14.953 8.545C15.123 8.801 15.277 9.063 15.383 9.364C15.447 9.551 15.364 9.705 15.142 9.799Z;${d.FISH_LOGO_PATH}`,keyTimes:`0;0.35;0.55;0.75;1`,calcMode:`spline`,keySplines:`0.45 0 0.55 1;0.45 0 0.55 1;0.45 0 0.55 1;0.45 0 0.55 1`,dur:`1.6s`,repeatCount:`indefinite`})})})}function eA({t:e,renderSlot:t,children:n}){let[r,i]=(0,g.useState)(!1);return/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Xk.root,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Xk.stack,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Xk.headline,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:Xk.fishHitbox,onMouseEnter:()=>{window.matchMedia(`(hover: hover) and (prefers-reduced-motion: no-preference)`).matches&&i(!0)},onMouseLeave:()=>{i(!1)},children:t(`conversation.hero.brand.mark`,{size:34,className:Xk.fish},{fallback:/* @__PURE__ */ (0,h.jsx)($k,{hovering:r})})}),/* @__PURE__ */ (0,h.jsxs)(`span`,{className:Xk.titleGroup,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{children:e(`hero.headline`)}),/* @__PURE__ */ (0,h.jsxs)(`span`,{className:Xk.previewBadge,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:Xk.previewBadgeWeb,children:e(`hero.preview`)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Xk.previewBadgeDesktop,children:e(`hero.previewDesktop`)})]})]})]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:Xk.body})]}),n]})}let tA=`@deepseek-ai/dsh-client-ui-conversation/ThreadReferenceDropTarget.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(tA)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=tA,e.textContent=`.tWXKHq_overlay{z-index:30;pointer-events:none;background:color-mix(in srgb, var(--dsw-alias-state-business-tertiary) 88%, transparent);place-items:center;display:grid;position:absolute;inset:0}.tWXKHq_invitation{flex-direction:column;align-items:center;gap:8px;max-width:calc(100% - 40px);display:flex}.tWXKHq_hint{border:1px solid color-mix(in srgb, var(--dsw-alias-state-business-primary) 15%, transparent);background:var(--dsw-alias-state-business-tertiary);color:var(--dsw-alias-label-primary);border-radius:10px;padding:8px 16px;font-size:16px;line-height:24px;box-shadow:0 1px 4px #00000014}.tWXKHq_preview{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l3);background:var(--dsw-alias-bg-base);max-width:min(440px,100%);color:var(--dsw-alias-label-primary);border-radius:12px;align-items:center;gap:10px;padding:10px 14px;font-size:14px;line-height:20px;display:flex;box-shadow:0 4px 14px #00000014}.tWXKHq_preview svg{flex:none}.tWXKHq_title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}`,document.head.appendChild(e)}var nA={hint:`tWXKHq_hint`,invitation:`tWXKHq_invitation`,overlay:`tWXKHq_overlay`,preview:`tWXKHq_preview`,title:`tWXKHq_title`};function rA({container:e,editor:t,useSessions:n,t:r}){let i=n(e=>e.byId),a=(0,g.useRef)(i);a.current=i;let[o,s]=(0,g.useState)(null);return(0,g.useEffect)(()=>{if(e===null||t===void 0)return;let n,r=()=>{n=void 0,s(null)},i=()=>t.isEditable()&&t.getRootElement()!==null,o=e=>{let t=e.dataTransfer;return t?.types.includes(`application/x-codexhost-thread-reference`)&&!t.types.includes(`Files`)?t:null},c=e=>{let t=e===void 0?void 0:rC(nC(e)),n=t===void 0?void 0:a.current[t];return n!==void 0&&tC(n)!==void 0},l=t=>!(t instanceof Node)||!e.contains(t)?!1:(t instanceof Element?t:t.parentElement)?.closest(`[data-conversation-content]`)===e,u=e=>{r();let t=o(e),i=t===null?void 0:aC(t.getData($S));c(i)&&(n=i)},d=e=>{let r=o(e);r===null||!l(e.target)?s(null):!i()||!c(n)?(e.preventDefault(),e.stopPropagation(),r.dropEffect=`none`,s(null)):t.dispatchCommand(Qp,e)&&s(n??null)},f=t=>{if(t.relatedTarget instanceof Node&&e.contains(t.relatedTarget))return;let n=e.getBoundingClientRect();(t.relatedTarget!==null||t.target===e||t.clientX<=n.left||t.clientX>=n.right||t.clientY<=n.top||t.clientY>=n.bottom)&&s(null)},p=e=>{let a=o(e);if(a!==null&&l(e.target)){let r=aC(a.getData($S));i()&&c(r)&&r?.threadId===n?.threadId&&r?.hostId===n?.hostId?t.dispatchCommand(Xp,e):(e.preventDefault(),e.stopPropagation(),a.dropEffect=`none`)}r()},m=e=>{e.key===`Escape`&&r()},h=t.registerEditableListener(e=>{e||r()});return document.addEventListener(`dragstart`,u),document.addEventListener(`dragenter`,d,!0),document.addEventListener(`dragover`,d,!0),document.addEventListener(`dragleave`,f,!0),document.addEventListener(`drop`,p,!0),window.addEventListener(`dragend`,r),window.addEventListener(`blur`,r),window.addEventListener(`keydown`,m,!0),()=>{h(),document.removeEventListener(`dragstart`,u),document.removeEventListener(`dragenter`,d,!0),document.removeEventListener(`dragover`,d,!0),document.removeEventListener(`dragleave`,f,!0),document.removeEventListener(`drop`,p,!0),window.removeEventListener(`dragend`,r),window.removeEventListener(`blur`,r),window.removeEventListener(`keydown`,m,!0)}},[e,t]),o===null?null:/* @__PURE__ */ (0,h.jsx)(`div`,{className:nA.overlay,"data-thread-reference-drop":!0,role:`status`,"aria-live":`polite`,children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:nA.invitation,children:[/* @__PURE__ */ (0,h.jsx)(`div`,{className:nA.hint,children:r(`reference.dropTitle`)}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:nA.preview,"data-thread-reference-preview":!0,children:[/* @__PURE__ */ (0,h.jsx)(d.ReferenceIconRegular,{kind:`session`,size:20}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:nA.title,children:o.title})]})]})})}let iA=`data-selection-drag`,aA=[`pointerup`,`pointercancel`,`dragstart`,`contextmenu`];function oA(e){let t=e.ownerDocument.defaultView;if(t===null)return()=>{};let n=()=>{e.removeAttribute(iA);for(let e of aA)t.removeEventListener(e,n,!0);t.removeEventListener(`blur`,n)},r=r=>{if(r.pointerType!==`mouse`||r.button!==0)return;let i=r.target instanceof Element?r.target:null;if(i!==null&&i.closest(`[data-composer-seat]`)===null){e.setAttribute(iA,``);for(let e of aA)t.addEventListener(e,n,!0);t.addEventListener(`blur`,n)}};return e.addEventListener(`pointerdown`,r,!0),()=>{e.removeEventListener(`pointerdown`,r,!0),n()}}function sA({renderSlot:e}){return e(`conversation.session`,{})}function cA({session:e,useInput:t,renderSlot:n}){let r=t(e=>e);return e===void 0||r===void 0?null:n(`conversation.input.dock`,{session:e,input:r})}function lA(){return null}function uA(e){let{sessionId:t,phase:n,hero:r,useSession:i,useSessions:a,useSessionStatus:o,useWorkspaces:s,useInput:c,useComposerBlock:l,useSessionCreation:u,renderSlot:d,renderSlotChain:f,selectWorkspace:p,retrySessionCreation:m,referenceEditor:_,t:v,useFactorySlot:y}=e,b=i(e=>e),ee=y(`views`,sA),te=y(`widthControls`,lA),[ne,re]=(0,g.useState)(null),ie=o(e=>t===void 0?void 0:e.get(t)?.pendingInteraction),ae=a(e=>t===void 0?void 0:e.byId[t]?.cwd),oe=s(e=>e),se=l(e=>e),ce=u(e=>e),le=t===void 0&&ce.state!==`idle`?ce.workspaceId:void 0,[ue,de]=(0,g.useState)(!1),[fe,pe]=(0,g.useState)(),me=(0,g.useRef)(null),x=(0,g.useRef)(null),S=(0,g.useCallback)(e=>{x.current?.disconnect(),x.current=null;let t=e?.parentElement??null;e!==null&&t!==null&&(x.current=new ResizeObserver(()=>{t.style.setProperty(`--dsh-composer-height`,`${e.offsetHeight}px`),t.style.setProperty(`--dsh-conversation-viewport-height`,`${t.clientHeight}px`)}),x.current.observe(e),x.current.observe(t))},[]);(0,g.useEffect)(()=>{let e=ne?.querySelector(`:scope > [data-conversation-scroll]`);return e==null?void 0:oA(e)},[ne]);let he=t===void 0?void 0:oe.items.find(e=>e.sessionIds.includes(t)),ge=fe?fe.id:le,_e=oe.items.find(e=>e.workspaceId===ge),ve=(ge===null?void 0:_e?.title)??(ge===null||t===void 0?void 0:he?.title??(oe.phase===`ready`||ae===void 0||ae===``?void 0:Zk(ae))),ye=ve===void 0?void 0:Jk(ve,v(`workspace.defaultName`)),be=/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.heroTopBarInner,children:[d(`conversation.hero.workspace`,{open:ue,anchorRef:me,selectedId:ge===null?void 0:ge??he?.workspaceId,fallbackLabel:ye,onOpenChange:de,onPick:e=>{de(!1);let t={id:e};pe(t);let n=()=>pe(e=>e===t?void 0:e);p(e).then(n,n)},onClose:()=>{de(!1)}},{fallback:/* @__PURE__ */ (0,h.jsx)(Qk,{buttonRef:me,label:ye??(oe.canStartProjectless?v(`hero.noWorkspace`):void 0),projectless:oe.canStartProjectless===!0&&ye===void 0,menuOpen:ue,onClick:()=>{de(e=>!e)},t:v})}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.heroAgentPresetSeat,children:d(`conversation.hero.agentPreset`,{})})]}),xe=oe.phase===`ready`&&!oe.canStartProjectless&&ye===void 0,Se=t===void 0&&ce.state!==`idle`,Ce=t!==void 0&&r&&b?.openState===`loading`&&!xe,we=r&&fe!==void 0,Te=!we&&t!==void 0&&b?.openState===`error`,Ee=Te&&b?.openError?.code===`remote/unsupported`,De=we||!Te&&(t===void 0||b?.openState!==`open`)&&!xe,Oe=we||t===void 0||b?.openState!==`open`||r&&xe,ke=!Oe&&se!==void 0,Ae=d(`conversation.composer.bar`,{variant:r?`hero`:`composer`,...r?{topBar:be}:{},...Se?{sessionCreation:ce,onRetrySessionCreation:m,placeholder:v(`placeholder.hero`)}:Ce?{disabled:!0,preparingDraft:!0,placeholder:v(`placeholder.hero`)}:Oe?Te?{disabled:!0,placeholder:v(Ee?`placeholder.loadUnsupported`:`placeholder.loadFailed`)}:{disabled:!0,placeholder:v(De?`placeholder.preparing`:`placeholder.workspace`),...De?{}:{workspacePickerOpen:ue,onRequestWorkspace:()=>{de(!0)}}}:ke?{blocked:se,placeholder:se.reason}:r?{placeholder:v(`placeholder.hero`)}:{}}),je=/* @__PURE__ */ (0,h.jsxs)(`div`,{className:sC(Q.composerStack,r&&Q.composerHero),children:[r&&/* @__PURE__ */ (0,h.jsx)(eA,{t:v,renderSlot:d}),/* @__PURE__ */ (0,h.jsx)(cA,{session:b,useInput:c,renderSlot:d}),Ae]}),Me=f(`conversation.composer`,{sessionId:t,session:b,pendingInteraction:b?.openState===`open`?ie:void 0},{fallback:je,fallbackOnly:t===void 0,overlay:!0}),Ne=/* @__PURE__ */ (0,h.jsx)(`div`,{ref:S,className:Q.composerSeat,"data-composer-seat":``,"data-conversation-region":`composer`,children:Me});return/* @__PURE__ */ (0,h.jsxs)(`div`,{ref:re,className:sC(Q.body,e.variant===`embedded`&&Q.embeddedBody),"data-conversation-content":``,"data-conversation-session":t,"data-conversation-region":`chat`,"data-content-phase":n,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.scrollBody,"data-conversation-scroll":``,children:[t===void 0?null:/* @__PURE__ */ (0,h.jsx)(ee,{}),Ne]}),/* @__PURE__ */ (0,h.jsx)(te,{container:ne,phase:n}),/* @__PURE__ */ (0,h.jsx)(rA,{container:ne,editor:_,useSessions:a,t:v},t)]})}function dA({renderSlot:e}){return e(`main.conversation`,{})}function fA(){let e=()=>{let e=document.querySelector(`[data-conversation-navigation-focus]`),t=e?.querySelector(`[data-navigation-focus-return]`);(t!=null&&t.getClientRects().length>0?t:e)?.focus({preventScroll:!0})};e(),requestAnimationFrame(()=>{document.activeElement===document.body&&e()})}function pA({sessionId:e,useSession:t,useConversation:n,renderSlot:r}){let i=t(e=>e),a=n(e=>e),o=i===void 0||a===void 0||i.blank&&Lk(i,a)===`blank`;return/* @__PURE__ */ (0,h.jsxs)(`header`,{className:sC(Q.header,o&&Q.headerBlank,e===void 0&&Q.headerSessionless),"data-window-drag":!0,"data-conversation-navigation-focus":!0,"data-cx-region":`topbar`,tabIndex:-1,children:[/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.headerLeading,"data-conversation-header-leading":``,children:r(`conversation.header.leading`,{})}),e===void 0?/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.titleRow,children:[r(`conversation.header.navigation`,{restoreNavigationFocus:fA}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.headerCorner,"data-conversation-header-corner":``,children:/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.phoneTrailingAction,children:r(`conversation.header.trailing`,{})})})]}):r(`conversation.session.header`,{hideChrome:o,titleNavigation:r(`conversation.header.navigation`,{restoreNavigationFocus:fA}),trailingAction:r(`conversation.header.trailing`,{})}),r(`conversation.header.shortcuts`,{restoreNavigationFocus:fA})]})}function mA(e,t){return(t===null?void 0:e.find(e=>e.id===t))??e.find(e=>e.id===`chat`)}function hA({view:e,useSession:t,useConversation:n,useConversationViews:r,inputActions:i,useStore:a,actions:o,renderSlot:s,bindDraftPersistence:c,onRevealResponseAnnotation:l,openView:u,useInspectCall:d}){let f=r(e=>e),p=d(e=>e),m=mA(f,a(e=>e.view)),_=t(e=>e),v=n(e=>e),y=a(e=>e.viewRequest??null);if((0,g.useEffect)(()=>{let e=c(o.setDraft);return i.persistDraft(),()=>{e()}},[i]),(0,g.useEffect)(()=>l(e=>u(`chat`,e)),[l,u]),_.blank&&Lk(_,v)===`blank`)return null;let b=e??m?.id;return/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.viewArea,children:b!==void 0&&s(`conversation.view`,{inspectCall:p,viewRequest:y,openView:u,completeViewRequest:o.completeViewRequest},{only:b})})}function gA(e,t){let n=[],r=/* @__PURE__ */ new Set,i=t;for(;i!==void 0&&!r.has(i);){r.add(i);let t=e.byId[i];if(t===void 0||(n.unshift({id:t.id,displayTitle:t.displayTitle,subagent:t.origin===`subagent`}),t.origin!==`subagent`))break;i=t.parentId}return n}function _A(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t.at(n);return r!==void 0&&e.id===r.id&&e.displayTitle===r.displayTitle})}function vA({sessionId:e,hideChrome:t,titleNavigation:n,trailingAction:r,useSessions:i,useConversationViews:a,useStore:o,renderSlot:s,open:c,selectView:l,t:u}){let d=a(e=>e),f=mA(d,o(e=>e.view)),p=i(t=>gA(t,e),_A),m=!t&&d.length>1;return/* @__PURE__ */ (0,h.jsxs)(h.Fragment,{children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.titleRow,children:[!t&&/* @__PURE__ */ (0,h.jsxs)(h.Fragment,{children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.titleCluster,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.titleCenter,onClick:e=>{if(e.target?.closest(`button, a, input, [role='button']`))return;let t=e.currentTarget.querySelector(`[data-navigation-focus-return]`);t!==null&&t.getClientRects().length>0&&t.click()},children:[/* @__PURE__ */ (0,h.jsxs)(`nav`,{className:Q.crumbs,"aria-label":u(`session.hierarchy`),children:[p.map((e,t)=>{let n=t===p.length-1,r=n?/* @__PURE__ */ (0,h.jsx)(`span`,{className:sC(Q.crumb,e.subagent&&Q.crumbSubagent,Q.crumbCurrent),children:e.displayTitle}):/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:sC(Q.crumb,e.subagent&&Q.crumbSubagent),onClick:()=>{c(e.id)},children:e.displayTitle}),i=n||e.subagent,a={lineageSessionId:e.id,displayTitle:e.displayTitle,...n?{}:{openTitle:()=>{c(e.id)}}};return/* @__PURE__ */ (0,h.jsxs)(`span`,{className:Q.crumbSeg,children:[t>0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.crumbSep,children:`/`}),i?e.subagent?s(`conversation.session.header.lineage`,a,{fallback:r}):/* @__PURE__ */ (0,h.jsxs)(h.Fragment,{children:[r,s(`conversation.session.header.lineage`,a,{fallback:null})]}):r]},e.id)}),p.length===0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.crumbCurrent,children:e})]}),n]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.headerActions,children:s(`conversation.session.header.actions`,{})})]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.headerUtilities,children:s(`conversation.session.header.utilities`,{})})]}),t&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.titleCenter,children:n}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.headerCorner,"data-conversation-header-corner":``,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.phoneTrailingAction,children:r}),s(`conversation.session.header.corner`,{})]})]}),m&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.tabs,role:`tablist`,"data-conversation-tabs":``,children:d.map(e=>/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===f?.id,className:sC(Q.tab,e.id===f?.id&&Q.tabActive),onClick:()=>{l(e.id)},children:e.label},e.id))})]})}function yA(e){return/* @__PURE__ */ (0,h.jsx)(hA,{...e})}function bA({editor:e,editable:t,preserveFocus:n=!1,...r}){let i=(0,g.useRef)(null),a=(0,g.useRef)(n);return a.current=n,(0,g.useLayoutEffect)(()=>{let t=i.current;if(t!==null&&(!(0,d.shouldAutoFocusTextInput)()&&!a.current&&(t.ownerDocument.activeElement===t&&t.blur(),e?.setEditable(!1)),e!==null))return e.setRootElement(t),()=>{e.setRootElement(null)}},[e]),(0,g.useLayoutEffect)(()=>{e!==null&&e.setEditable(t)},[e,t]),/* @__PURE__ */ (0,h.jsx)(`div`,{ref:i,contentEditable:e!==null&&t,suppressContentEditableWarning:!0,role:`textbox`,"aria-multiline":`true`,"data-composer-input":!0,...r})}function xA({editor:e}){let[t,n]=g.useState(()=>e===null?{}:e.getDecorators());return g.useLayoutEffect(()=>{if(e!==null)return n(e.getDecorators()),e.registerDecoratorListener(e=>{n(e)})},[e]),e===null?null:/* @__PURE__ */ (0,h.jsx)(h.Fragment,{children:Object.entries(t).map(([t,n])=>{let r=e.getElementByKey(t);return r===null?null:(0,_.createPortal)(n,r,t)})})}function SA({classNames:e,editor:t,scrollRef:n,editable:r,editorDisabled:i,preserveFocus:a=!1,phase:o,placeholderText:s,ariaLabel:c,workspaceTrigger:l,workspacePickerOpen:u,onWorkspaceKeyDown:d,hint:f,showPlaceholder:p}){return/* @__PURE__ */ (0,h.jsx)(`div`,{ref:n,className:e.scroll,"data-input-scroll":!0,children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:e.grow,children:[/* @__PURE__ */ (0,h.jsx)(bA,{editor:l?null:t,editable:r,preserveFocus:a,className:sC(e.input,i&&e.inputDisabled),"data-phase":o,"aria-disabled":i||void 0,"data-placeholder":s,"aria-label":c,"aria-haspopup":l?`menu`:void 0,"aria-expanded":l?u:void 0,tabIndex:l?0:void 0,onKeyDown:l?d:void 0,style:f===null?void 0:{"--dsh-composer-hint":JSON.stringify(f)}}),p&&/* @__PURE__ */ (0,h.jsx)(`div`,{"aria-hidden":!0,className:e.placeholder,"data-composer-placeholder":!0,children:s}),/* @__PURE__ */ (0,h.jsx)(xA,{editor:l?null:t})]})})}function CA(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(pointer: coarse)`).matches}function wA(e,t){return e.isComposing||e.keyCode===229||t()}function TA(e,t){let n=!1,r=0,i=null,a=()=>{i?.toggleAttribute(`data-composer-composing`,n||e.isComposing())},o=()=>{n=!0,a()},s=()=>{n=!1,r=Date.now()+10,e.update(()=>{},{onUpdate:a})},c=()=>n||Date.now()<r,l=e=>n=>{let r=n!==null&&wA(n,c);return t.arbitrate(e,r)!==`pass`&&(n?.preventDefault(),!0)};return tx(e.registerRootListener((e,t)=>{t?.removeEventListener(`compositionstart`,o),t?.removeEventListener(`compositionend`,s),t?.removeAttribute(`data-composer-composing`),n=!1,r=0,i=e,e?.addEventListener(`compositionstart`,o),e?.addEventListener(`compositionend`,s),a()}),e.registerUpdateListener(a),e.registerCommand(Hp,l(`up`),4),e.registerCommand(Up,l(`down`),4),e.registerCommand(Rp,t=>e.getEditorState().read(()=>{let e=V();if(!B(e)||!e.isCollapsed())return!1;let t=e.anchor,n=t.getNode();if(!z(n))return!0;let r=n.getTextContent().charAt(t.offset);return r===``||/\s/u.test(r)})?l(`right`)(t):!1,4),e.registerCommand(Bp,t=>e.getEditorState().read(()=>{let e=V();return B(e)&&e.isCollapsed()})?l(`left`)(t):!1,4),e.registerCommand(Yp,e=>l(e.shiftKey?`tabBack`:`tab`)(e),4),e.registerCommand(qp,e=>(t.dismissPopup(),t.arbitrate(`escape`,wA(e,c))===`consumed`&&(e.preventDefault(),!0)),4),e.registerCommand(Gp,e=>wA(e,c)?!1:t.space()?(e.preventDefault(),!0):!1,4),e.registerCommand(Wp,e=>e!==null&&(e.altKey||e.getModifierState(`AltGraph`)||e.ctrlKey&&e.metaKey||e.shiftKey&&(e.ctrlKey||e.metaKey))?!0:e?.shiftKey===!0?!1:e!==null&&wA(e,c)?!0:t.arbitrate(`enter`,!1)===`pass`?CA()&&e?.ctrlKey!==!0&&e?.metaKey!==!0?!1:(e?.preventDefault(),e?.repeat===!0||!t.canSubmit()||t.submit(e?.ctrlKey===!0||e?.metaKey===!0),!0):(e?.preventDefault(),!0),4),e.registerCommand(Ap,e=>{let n=e.clipboardData??null;if(n===null)return!1;let r=[],i=/* @__PURE__ */ new Set;for(let e of n.items){if(e.kind!==`file`)continue;let t=e.getAsFile();t!==null&&(r.push(t),typeof e.webkitGetAsEntry==`function`&&e.webkitGetAsEntry()?.isDirectory===!0&&i.add(t))}r.length>0&&t.intakeFiles(r,i.size===0?void 0:i);let a=n.getData(`text/plain`);return a===``?r.length!==0&&(e.preventDefault(),!0):(e.preventDefault(),t.pasteText(a),!0)},4))}function EA(e){let t=e.current;if(t===null||t.scrollHeight<=t.clientHeight)return;let n=window.getSelection();if(n===null||n.rangeCount===0)return;let r=n.getRangeAt(0).getBoundingClientRect();if(r.height===0&&r.width===0){let e=n.anchorNode,t=e instanceof HTMLElement?e:e?.parentElement;if(t==null)return;r=t.getBoundingClientRect()}let i=t.getBoundingClientRect();r.bottom>i.bottom?t.scrollTop+=r.bottom-i.bottom:r.top<i.top&&(t.scrollTop-=i.top-r.top)}function DA(e,t){e.getRootElement()?.focus({preventScroll:!0}),e.focus(()=>{t()})}function OA(e){let t=e.getRootElement();if(t===null||e.isComposing())return;let n=t.ownerDocument;if(n.activeElement!==t&&!t.contains(n.activeElement))return;let r=n.defaultView?.getSelection();if(r==null)return;if(r.rangeCount>0){if(!r.isCollapsed)return;let e=r.getRangeAt(0).cloneRange();if(t.contains(e.startContainer)&&t.contains(e.endContainer)){r.removeAllRanges(),r.addRange(e);return}}let i=t.firstChild??t,a=n.createRange();a.setStart(i,0),a.collapse(!0),r.removeAllRanges(),r.addRange(a)}function kA(e){let t=e.current;if(t===null)return;let n=e=>{let n=t.closest(`[data-conversation-scroll]`);if(!(n instanceof HTMLElement)||e.deltaY===0)return;let r=t.scrollTop<=0,i=t.scrollTop+t.clientHeight>=t.scrollHeight-1;e.deltaY<0&&!r||e.deltaY>0&&!i||(e.preventDefault(),n.scrollTop+=e.deltaY)};return t.addEventListener(`wheel`,n,{passive:!1}),()=>{t.removeEventListener(`wheel`,n)}}function AA(e,t,n){return e.bindFilePicker({available:()=>t.current.canAcceptDrop&&n.current!==null,open:()=>{n.current?.click()}})}function jA(e,t,n){return TA(e,{arbitrate:(e,r)=>e===`enter`&&n.current.primaryAction!==void 0?`pass`:t.arbitrate(e,r),space:()=>n.current.machineBusy||n.current.locked?!1:t.space(),dismissPopup:()=>{t.dismissPopup()},canSubmit:()=>!n.current.locked&&!n.current.machineBusy&&n.current.primaryAction?.disabled!==!0,submit:e=>{let r=n.current;r.uploadsFailed?r.showToast(r.t(`file.retryOrRemove`)):r.primaryAction===void 0?e&&r.canSteerQueue?t.steerQueue():t.submit(pk(r.busyEnter,r.running,e?`accelerated`:`enter`,r.steeringAvailable),`enter`):r.primaryAction.run()},intakeFiles:(e,t)=>{n.current.intakeFiles(e,t)},pasteText:e=>{!n.current.machineBusy&&n.current.canPasteText&&t.paste(e)}})}function MA(e){let t=e.activeElement,n=e.defaultView?.HTMLTextAreaElement??globalThis.HTMLTextAreaElement;return n!==void 0&&t instanceof n&&t.closest(`[data-composer-annotations]`)!==null&&(t.blur(),!0)}function NA(e){let t=e?.getRootElement()??null;if(t===null)return!1;let n=t.ownerDocument.activeElement;return n===null||!t.contains(n)?!1:(typeof n.blur==`function`?n.blur():t.blur(),!0)}function PA(e,t){(0,d.shouldAutoFocusTextInput)()&&(e.preventDefault(),t?.getRootElement()?.focus({preventScroll:!0}))}function FA(e){let t=e/1048576;return`${Number.isInteger(t)?String(t):t.toFixed(1)}MB`}function IA(e,t,n){switch(t){case`MODEL_DOES_NOT_SUPPORT_IMAGES`:return e(`image.modelUnsupported`);case`FILE_NOT_STAGED`:return e(`file.notStaged`);case`FILE_UNAVAILABLE`:return e(`file.unavailable`);case`IMAGE_TOO_MANY_PIXELS`:return e(`image.tooManyPixels`);case`INVALID_IMAGE`:case`IMAGE_TYPE_MISMATCH`:return e(`image.unsupportedType`);case`TOO_MANY_IMAGES`:if(n!==void 0)return e(`image.tooMany`,{count:n.maxImagesPerMessage});break;case`IMAGE_TOO_LARGE`:if(n!==void 0)return e(`image.fileTooLarge`,{size:FA(n.maxImageBytes)});break;case`IMAGES_TOO_LARGE`:if(n!==void 0)return e(`image.totalTooLarge`,{size:FA(n.maxMessageImageBytes)})}return e(`image.sendFailed`,{reason:t})}function LA(e){let t=e?.projectedTokens??e?.pressureTokens;return t===void 0||e?.contextWindow===void 0?null:{percent:Math.min(100,Math.round(t/e.contextWindow*100)),usedTokens:t,contextWindow:e.contextWindow}}let RA=`@deepseek-ai/dsh-client-ui-conversation/ContextMeter.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(RA)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=RA,e.textContent=`.h1Hkra_root{flex:none;display:inline-flex}.h1Hkra_trigger{border-radius:var(--dsw-radius-sm);color:var(--dsw-alias-label-tertiary);font-family:inherit;font-size:var(--dsh-content-font-size-secondary,13px);font-variant-numeric:tabular-nums;line-height:calc(20px + var(--dsh-content-font-delta-secondary,0px));white-space:nowrap;cursor:pointer;background:0 0;border:none;flex:none;align-items:center;gap:6px;padding:1px 8px;display:inline-flex}.h1Hkra_trigger:hover,.h1Hkra_trigger[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.h1Hkra_track{fill:none;stroke:var(--dsw-alias-border-l3);stroke-width:2px}.h1Hkra_fill{fill:none;stroke:var(--dsw-alias-label-tertiary);stroke-width:2px;stroke-linecap:round}.h1Hkra_panel{z-index:1100;box-sizing:border-box;border-radius:var(--dsw-radius-lg);background:var(--dsw-specific-menu);width:min(264px,100vw - 24px);backdrop-filter:var(--dsw-menu-backdrop-filter);--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);box-shadow:var(--dsw-elevation-prominent);color:var(--dsw-alias-label-secondary);cursor:default;border:0;padding:12px;font-size:12px;line-height:20px;position:fixed}.h1Hkra_header{align-items:center;gap:6px;display:flex}.h1Hkra_figures{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);margin-left:auto;font-weight:500}.h1Hkra_percent{color:var(--dsw-alias-label-primary);font-weight:500}.h1Hkra_headline{color:var(--dsw-alias-label-tertiary)}.h1Hkra_headline:empty{display:none}.h1Hkra_bar{corner-shape:round;background:var(--dsw-alias-interactive-bg-hover);border-radius:999px;gap:1px;height:4px;margin:10px 0 12px;display:flex;overflow:hidden}.h1Hkra_segment{background:var(--meter-tint,var(--dsw-alias-label-tertiary));border-radius:1px;flex:none;min-width:2px;height:100%}.h1Hkra_swatch{background:var(--meter-tint);vertical-align:baseline;border-radius:2px;width:8px;height:8px;margin-right:6px;display:inline-block}.h1Hkra_colorSystem{--meter-tint:var(--dsw-static-neutral-bluish-400)}.h1Hkra_colorTools{--meter-tint:#a78bfa}.h1Hkra_colorMessages{--meter-tint:var(--dsw-static-blue-450)}.h1Hkra_rows{margin:6px 0 0}.h1Hkra_row{justify-content:space-between;align-items:center;gap:12px;padding:2px 0;display:flex}.h1Hkra_row dt{color:var(--dsw-alias-label-secondary)}.h1Hkra_row dd{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);margin:0}`,document.head.appendChild(e)}var zA={bar:`h1Hkra_bar`,colorMessages:`h1Hkra_colorMessages`,colorSystem:`h1Hkra_colorSystem`,colorTools:`h1Hkra_colorTools`,figures:`h1Hkra_figures`,fill:`h1Hkra_fill`,header:`h1Hkra_header`,headline:`h1Hkra_headline`,panel:`h1Hkra_panel`,percent:`h1Hkra_percent`,root:`h1Hkra_root`,row:`h1Hkra_row`,rows:`h1Hkra_rows`,segment:`h1Hkra_segment`,swatch:`h1Hkra_swatch`,track:`h1Hkra_track`,trigger:`h1Hkra_trigger`};let BA=5.5,VA=2*Math.PI*BA,HA=[{key:`systemTokens`,label:`context.system`,color:zA.colorSystem},{key:`toolsTokens`,label:`context.tools`,color:zA.colorTools},{key:`messageTokens`,label:`context.messages`,color:zA.colorMessages}];function UA(e,t){let n=e=>String(e>=100?Math.round(e):Math.round(e*10)/10);return e<1e3?String(e):e<1e6?t(`number.thousand`,{value:n(e/1e3)}):t(`number.million`,{value:n(e/1e6)})}function WA({useProjection:e,t}){let n=e(`contextPressure`),r=e(`contextBreakdown`),[i,a]=(0,g.useState)(!1),o=(0,g.useRef)(null),s=(0,g.useRef)(null),c=LA(n),l=c!==null,u=(0,d.useAnchoredPosition)({open:i&&l,anchorRef:o,panelRef:s,side:`top`,gap:8,margin:12});if((0,d.useDismissOnOutsidePointer)(o,i&&l,a,s),(0,g.useEffect)(()=>{!l&&i&&a(!1)},[l,i]),(0,g.useEffect)(()=>{if(!i||!l)return;let e=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[l,i]),c===null)return null;let f=c.percent,p=`${f}%`,[m=``,v=``]=t(`context.aria`,{percent:`\0`}).split(`\0`).map(e=>e.trim()),y=r===void 0?0:r.systemTokens+r.toolsTokens+r.messageTokens,b=(r===void 0||y===0?[{key:`total`,color:void 0,width:f}]:HA.map(e=>({key:e.key,color:e.color,width:f*r[e.key]/y}))).filter(e=>e.width>0);return/* @__PURE__ */ (0,h.jsxs)(`span`,{ref:o,className:zA.root,children:[/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{label:t(`context.aria`,{percent:p}),side:`top`,delayMs:200,disabled:i,children:/* @__PURE__ */ (0,h.jsxs)(`button`,{type:`button`,className:zA.trigger,"aria-label":t(`context.aria`,{percent:p}),"aria-haspopup":`dialog`,"aria-expanded":i,onClick:()=>{a(!i)},children:[/* @__PURE__ */ (0,h.jsxs)(`svg`,{viewBox:`0 0 14 14`,width:`14`,height:`14`,"aria-hidden":!0,children:[/* @__PURE__ */ (0,h.jsx)(`circle`,{className:zA.track,cx:`7`,cy:`7`,r:BA}),/* @__PURE__ */ (0,h.jsx)(`circle`,{className:zA.fill,cx:`7`,cy:`7`,r:BA,strokeDasharray:`${VA*f/100} ${VA}`,transform:`rotate(-90 7 7)`})]}),/* @__PURE__ */ (0,h.jsx)(`span`,{children:p})]})}),i&&(0,_.createPortal)(/* @__PURE__ */ (0,h.jsxs)(`div`,{ref:s,className:zA.panel,style:u??{visibility:`hidden`,left:0,top:0},role:`dialog`,"aria-label":t(`context.used`),children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:zA.header,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:zA.headline,children:m}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:zA.percent,children:p}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:zA.headline,children:v}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:zA.figures,children:`~${UA(c.usedTokens,t)} / ${UA(c.contextWindow,t)}`})]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:zA.bar,children:b.map(e=>/* @__PURE__ */ (0,h.jsx)(`div`,{className:e.color===void 0?zA.segment:`${zA.segment} ${e.color}`,style:{width:`${e.width}%`}},e.key))}),r!==void 0&&/* @__PURE__ */ (0,h.jsx)(`dl`,{className:zA.rows,children:HA.map(e=>/* @__PURE__ */ (0,h.jsxs)(`div`,{className:zA.row,children:[/* @__PURE__ */ (0,h.jsxs)(`dt`,{children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:`${zA.swatch} ${e.color}`,"aria-hidden":!0}),t(e.label)]}),/* @__PURE__ */ (0,h.jsx)(`dd`,{children:`~${UA(r[e.key],t)}`})]},e.key))})]}),document.body)]})}function GA(e,t){let n=e.querySelector(`[data-toolbar-scroll]`);if(n===null)return()=>{};let r=e.querySelector(`[data-toolbar-fixed="start"]`),i=e.querySelector(`[data-toolbar-fixed="end"]`),a={phone:!1,overflowActions:!1},o=!1,s=/* @__PURE__ */ new Set,c=()=>{if(!a.phone||e.hasAttribute(`data-toolbar-activity`))return;let t=e.ownerDocument.activeElement;if(!(t instanceof HTMLElement)||!e.contains(t)||t.closest(`[data-toolbar-fixed]`))return;let{left:r,right:i}=n.getBoundingClientRect(),o=t.getBoundingClientRect();o.left<r?n.scrollLeft+=o.left-r:o.right>i&&(n.scrollLeft+=Math.min(o.right-i,o.left-r))},l=()=>{if(o)return;let s=e.closest(`[data-phone]`)!==null;if(e.toggleAttribute(`data-phone-toolbar`,s),e.hasAttribute(`data-toolbar-activity`)){s!==a.phone&&(a={...a,phone:s},t?.(a));return}let l=e.hasAttribute(`data-actions-overflow`);if(e.removeAttribute(`data-model-compact`),e.removeAttribute(`data-actions-overflow`),e.toggleAttribute(`data-toolbar-measuring`,s),s)for(let[t,n]of[[`start`,r],[`end`,i]]){if(n===null)continue;let r=`--dsh-composer-${t}-width`,i=`${n.getBoundingClientRect().width}px`;e.style.getPropertyValue(r)!==i&&e.style.setProperty(r,i)}let u=getComputedStyle(e),d=e.getBoundingClientRect().width-parseFloat(u.paddingLeft)-parseFloat(u.paddingRight),f=s?(()=>{let t=e=>Array.from(e.children).flatMap(e=>{let r=getComputedStyle(e).display;return r===`none`?[]:e===n||r===`contents`?t(e):[e]}),r=t(e);return r.reduce((e,t)=>{let n=getComputedStyle(t);return e+t.getBoundingClientRect().width+(parseFloat(n.marginLeft)||0)+(parseFloat(n.marginRight)||0)},0)+Math.max(0,r.length-1)*(parseFloat(u.columnGap)||0)})():(()=>{let e=Array.from(n.children,e=>e.getBoundingClientRect().width).filter(e=>e>0);return e.reduce((e,t)=>e+t,0)+Math.max(0,e.length-1)*parseFloat(u.columnGap)})();e.toggleAttribute(`data-model-compact`,!s&&f>d);let p=e.querySelector(`[data-composer-overflow-action]`),m=e.querySelector(`[data-toolbar-fixed="start"] button`),h=s&&p!==null&&m?.disabled===!1&&f>d-(l?2:0),g=e.hasAttribute(`data-command-menu-open`)||p!==null&&p.contains(e.ownerDocument.activeElement)?l:h;e.removeAttribute(`data-toolbar-measuring`),e.toggleAttribute(`data-actions-overflow`,g),(s!==a.phone||g!==a.overflowActions)&&(a={phone:s,overflowActions:g},t?.(a)),(!s||n.scrollWidth<=n.clientWidth)&&(n.scrollLeft=0),c()},u=new ResizeObserver(l),d=()=>{let t=/* @__PURE__ */ new Set([e,...e.querySelectorAll(`*`)]);for(let e of s)t.has(e)||(u.unobserve(e),s.delete(e));for(let e of t)s.has(e)||(u.observe(e),s.add(e))},f=new MutationObserver(()=>{d(),l()});f.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`hidden`,`class`,`style`,`aria-label`,`aria-busy`,`disabled`,`data-command-menu-open`,`data-toolbar-activity`]});let p=new MutationObserver(l);for(let t=e.parentElement;t!==null;t=t.parentElement)p.observe(t,{attributes:!0,attributeFilter:t===e.ownerDocument.body||t===e.ownerDocument.documentElement?[`data-phone`,`class`,`style`,`lang`,`dir`]:[`data-phone`,`lang`,`dir`]});let m=()=>{queueMicrotask(()=>{o||l()})};e.addEventListener(`focusin`,c),e.addEventListener(`focusout`,m);let h=document.fonts;return h.addEventListener(`loadingdone`,l),d(),l(),()=>{o=!0,u.disconnect(),f.disconnect(),p.disconnect(),e.removeEventListener(`focusin`,c),e.removeEventListener(`focusout`,m),h.removeEventListener(`loadingdone`,l)}}let KA=`@deepseek-ai/dsh-client-ui-conversation/InputBar.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(KA)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=KA,e.textContent=`.SFO4UW_root{padding:0 var(--dsh-composer-side-clearance) 4px;flex-direction:column;align-items:center;display:flex}[data-phone] .SFO4UW_root{padding-bottom:max(4px, calc(env(safe-area-inset-bottom) - 23px))}.SFO4UW_dock{-webkit-user-select:none;user-select:none;justify-content:center;align-items:center;gap:12px;max-width:100%;padding-top:4px;display:flex}.SFO4UW_hero .SFO4UW_dock:empty{display:none}.SFO4UW_hero{padding:0 var(--dsh-composer-side-clearance)}.SFO4UW_notice{width:100%;max-width:var(--dsh-composer-card-max-width);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary);-webkit-user-select:text;user-select:text;margin-bottom:6px;padding:4px 8px;font-size:12px;line-height:18px}.SFO4UW_cardStack{width:100%;max-width:var(--dsh-composer-card-max-width);flex-direction:column;display:flex;position:relative}.SFO4UW_topRail{z-index:0;box-sizing:border-box;margin-inline:16px;background:color-mix(in srgb, var(--dsw-alias-label-primary) 5%, var(--dsw-alias-bg-base));-webkit-user-select:none;user-select:none;border:0;border-radius:16px 16px 0 0;align-items:center;margin-bottom:-16px;padding:5px 10px 21px;display:flex;position:relative}.SFO4UW_card{box-sizing:border-box;z-index:1;width:100%;max-width:var(--dsh-composer-card-max-width);--dsw-elevation-stroke-color:var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-panel);background:var(--dsw-specific-input-major);box-shadow:var(--dsw-elevation-soft);font-size:var(--dsh-content-font-size,14px);line-height:calc(24px + var(--dsh-content-font-delta,0px));--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);border:0;flex-direction:column;gap:12px;padding-top:8px;display:flex;position:relative}@supports (backdrop-filter:blur(14px)){body[data-codexhost-wallpaper] .SFO4UW_card,[data-phone] .SFO4UW_card{box-shadow:none;background:0 0}body[data-codexhost-wallpaper] .SFO4UW_card:before,[data-phone] .SFO4UW_card:before{content:"";z-index:-1;border-radius:inherit;background:color-mix(in srgb, var(--dsw-specific-input-major) 60%, transparent);backdrop-filter:blur(16px);box-shadow:inset 0 1px 0 color-mix(in srgb, var(--dsw-alias-bg-layer-3) 65%, transparent), var(--dsw-elevation-soft), 0 8px 24px -12px var(--dsw-alias-bg-mask-2);pointer-events:none;position:absolute;inset:0}body:not([data-codexhost-wallpaper]) [data-phone] .SFO4UW_card:before{background:color-mix(in srgb, var(--dsw-specific-input-major) 24%, transparent);backdrop-filter:blur(14px)}}@media (prefers-reduced-transparency:reduce),(prefers-contrast:more),(forced-colors:active){body[data-codexhost-wallpaper] .SFO4UW_card,[data-phone] .SFO4UW_card{background:var(--dsw-specific-input-major);box-shadow:var(--dsw-elevation-soft)}body[data-codexhost-wallpaper] .SFO4UW_card:before,[data-phone] .SFO4UW_card:before{display:none}}@media (prefers-contrast:more),(forced-colors:active){[data-phone] .SFO4UW_card:not(.SFO4UW_cardWorkspaceTrigger){outline:1px solid var(--dsw-alias-label-primary);outline-offset:-1px}}.SFO4UW_cardWorkspaceTrigger{--dsw-elevation-stroke-color:transparent;cursor:pointer}.SFO4UW_cardWorkspaceTrigger:after{content:"";box-sizing:border-box;border-radius:var(--dsw-radius-panel);color:var(--dsw-alias-border-l4);pointer-events:none;border:1px dashed;transition:color .1s;position:absolute;inset:0}.SFO4UW_cardWorkspaceTrigger :disabled{pointer-events:none}.SFO4UW_cardWorkspaceTrigger:hover:after{color:var(--dsw-alias-state-business-primary)}.SFO4UW_inlineNotices{-webkit-user-select:text;user-select:text;flex-direction:column;gap:8px;display:flex}.SFO4UW_inlineNotices>[data-slot]>*{margin:10px 10px 0}.SFO4UW_accessory{align-items:center;gap:8px;padding:10px 12px 0;display:flex}.SFO4UW_overlayAnchor{height:0;position:absolute;inset:0 0 auto}.SFO4UW_scroll{max-height:var(--dsh-composer-text-max-height);margin-right:4px;overflow-y:auto}.SFO4UW_scroll::-webkit-scrollbar-track{margin-top:8px}.SFO4UW_grow{position:relative}.SFO4UW_pending{corner-shape:round;background:var(--dsw-alias-state-business-primary);border-radius:50%;width:8px;height:8px;animation:1s ease-in-out infinite alternate SFO4UW_input-pending}@keyframes SFO4UW_input-pending{0%{opacity:.35}to{opacity:1}}.SFO4UW_input{box-sizing:border-box;min-height:36px;font-family:var(--dsw-font-family);font-size:inherit;line-height:inherit;white-space:pre-wrap;word-break:break-word;overflow-wrap:anywhere;color:var(--dsw-alias-label-primary);caret-color:var(--dsw-alias-state-business-primary);-webkit-user-select:text;user-select:text;outline:none;padding:4px 8px 0 14px}.SFO4UW_input p{margin:0}.SFO4UW_input p:last-child:after{content:var(--dsh-composer-hint);color:var(--dsw-alias-label-caption)}.SFO4UW_input[data-composer-composing] p:last-child:after{content:none}.SFO4UW_input[data-composer-composing]+.SFO4UW_placeholder{visibility:hidden}.SFO4UW_placeholder{color:var(--dsw-alias-label-caption);white-space:nowrap;text-overflow:ellipsis;pointer-events:none;-webkit-user-select:none;user-select:none;position:absolute;inset:4px 8px auto 14px;overflow:hidden}.SFO4UW_inputDisabled{color:var(--dsw-alias-label-tertiary);cursor:not-allowed}.SFO4UW_input[aria-haspopup=menu]{cursor:pointer}.SFO4UW_hero .SFO4UW_input{min-height:52px}.SFO4UW_hero .SFO4UW_placeholder{white-space:normal;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box}@media (width<=600px){.SFO4UW_hero .SFO4UW_input{min-height:36px}.SFO4UW_hero .SFO4UW_placeholder{white-space:nowrap;display:block}}.SFO4UW_row{-webkit-user-select:none;user-select:none;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;min-width:0;padding:2px 8px 6px;display:flex;container-type:inline-size}.SFO4UW_row[data-model-compact]{--dsh-composer-model-text-display:none;--dsh-composer-model-icon-display:block}.SFO4UW_tools,.SFO4UW_modes,.SFO4UW_trailing{align-items:center;min-width:0;display:flex}.SFO4UW_tools,.SFO4UW_modes{gap:12px}.SFO4UW_trailing{flex:none;gap:12px;margin-left:auto}@container (width<=560px){.SFO4UW_tools,.SFO4UW_modes,.SFO4UW_trailing{gap:8px}}.SFO4UW_add{corner-shape:round;background:var(--dsw-specific-selector);width:28px;height:28px;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;border-radius:999px;flex:none;place-items:center;display:grid}.SFO4UW_add:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid)}.SFO4UW_add:disabled{opacity:.5;cursor:default}.SFO4UW_select{border-radius:var(--dsw-radius-sm);max-width:220px;height:28px;color:var(--dsw-alias-label-secondary);white-space:nowrap;cursor:pointer;appearance:none;background-color:#0000;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2381858C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-position:right 4px center;background-repeat:no-repeat;background-size:12px 12px;border:none;outline:none;padding:0 20px 0 8px;font-size:13px;font-weight:500;line-height:20px}.SFO4UW_select:hover:not(:disabled){background-color:var(--dsw-alias-interactive-bg-hover)}.SFO4UW_select:disabled{opacity:.5;cursor:default}.SFO4UW_primary{corner-shape:round;background:var(--dsw-alias-button-info-fill);color:#fff;cursor:pointer;border:none;border-radius:999px;flex:none;place-items:center;width:30px;height:30px;transition:background-color .1s;display:grid;transform:translateY(-2px)}.SFO4UW_primary:hover:not(:disabled){background:var(--dsw-alias-button-info-hover)}.SFO4UW_primary:disabled{opacity:.4;cursor:default}.SFO4UW_retry{border-radius:var(--dsw-radius-sm);color:inherit;cursor:pointer;background:0 0;border:1px solid;margin-left:8px;padding:1px 8px;font-size:12px}.SFO4UW_addSeat,.SFO4UW_submitSeat,.SFO4UW_controlScroll{display:contents}.SFO4UW_row[data-phone-toolbar]{flex-wrap:nowrap;gap:4px;position:relative}.SFO4UW_row[data-phone-toolbar] .SFO4UW_controlScroll{--dsh-composer-edge-gap:4px;align-items:center;gap:inherit;min-width:0;min-height:44px;margin-left:calc(var(--dsh-composer-start-width,44px) + var(--dsh-composer-edge-gap));margin-right:calc(var(--dsh-composer-end-width,44px) + var(--dsh-composer-edge-gap));overscroll-behavior-x:contain;scrollbar-width:none;flex:1;display:flex;overflow-x:auto}.SFO4UW_row[data-phone-toolbar] .SFO4UW_controlScroll::-webkit-scrollbar{display:none}.SFO4UW_row[data-phone-toolbar] .SFO4UW_tools:not([hidden]),.SFO4UW_row[data-phone-toolbar] .SFO4UW_trailing:not(.SFO4UW_trailingActive){display:contents}.SFO4UW_row[data-phone-toolbar] .SFO4UW_tools>*,.SFO4UW_row[data-phone-toolbar] [data-slot="conversation.input.left"]>*,.SFO4UW_row[data-phone-toolbar] [data-slot="conversation.input.right"]>*{flex-shrink:0}.SFO4UW_row[data-phone-toolbar] button:focus-visible{outline-offset:-2px}.SFO4UW_row[data-phone-toolbar] .SFO4UW_modes{flex:none;gap:4px;width:max-content}.SFO4UW_row[data-phone-toolbar] .SFO4UW_standardControls{flex:0 auto;gap:4px;min-width:0;margin-left:0}.SFO4UW_row[data-phone-toolbar][data-toolbar-measuring] .SFO4UW_standardControls{flex:none;width:max-content}.SFO4UW_row[data-phone-toolbar] .SFO4UW_addSeat,.SFO4UW_row[data-phone-toolbar] .SFO4UW_submitSeat{z-index:1;flex:none;align-items:center;gap:4px;display:flex;position:absolute;inset-block:2px 6px}.SFO4UW_row[data-phone-toolbar] .SFO4UW_addSeat{left:8px}.SFO4UW_row[data-phone-toolbar] .SFO4UW_submitSeat{margin-left:0;right:8px}.SFO4UW_row[data-phone-toolbar] .SFO4UW_add,.SFO4UW_row[data-phone-toolbar] .SFO4UW_primary{box-sizing:border-box;background-clip:padding-box;width:44px;height:44px}.SFO4UW_row[data-phone-toolbar] .SFO4UW_add{border:8px solid #0000}.SFO4UW_row[data-phone-toolbar] .SFO4UW_primary{border:7px solid #0000}.SFO4UW_row[data-phone-toolbar][data-toolbar-activity] .SFO4UW_controlScroll{display:contents}.SFO4UW_row[data-phone-toolbar][data-toolbar-activity] .SFO4UW_submitSeat{position:static}.SFO4UW_row[data-actions-overflow] [data-composer-overflow-action]{display:none}.SFO4UW_standardControls{align-items:center;gap:12px;min-width:0;display:flex}.SFO4UW_tools[hidden],.SFO4UW_standardControls[hidden]{display:none}.SFO4UW_trailingActive{flex:1;margin-left:0}.SFO4UW_activity{flex:none;align-items:center;display:flex}.SFO4UW_activity:empty{display:none}.SFO4UW_activityExpanded{flex:1;min-width:0}.SFO4UW_annotations{padding:8px 8px 2px}.SFO4UW_creationError{border-radius:var(--dsw-radius-md);background:var(--dsw-alias-interactive-bg-hover-danger);color:var(--dsw-alias-state-error-primary);align-items:center;gap:8px;margin:2px 10px 0;padding:8px 10px;font-size:13px;line-height:18px;display:flex}.SFO4UW_creationErrorIcon{flex:none}.SFO4UW_creationErrorCopy{overflow-wrap:anywhere;-webkit-user-select:text;user-select:text;flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.SFO4UW_creationErrorTitle{font-weight:500}.SFO4UW_creationErrorDetail{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:17px}.SFO4UW_creationRetry{border-radius:var(--dsw-radius-sm);min-height:28px;color:var(--dsw-alias-state-error-primary);font:inherit;cursor:pointer;touch-action:manipulation;background:0 0;border:1px solid;flex:none;padding:4px 10px;font-size:12px;font-weight:500;line-height:16px}.SFO4UW_creationRetry:hover{background:color-mix(in srgb, currentColor 10%, transparent)}.SFO4UW_creationRetry:focus-visible{outline-offset:2px;outline:2px solid}.SFO4UW_pendingControls{align-items:center;gap:6px;min-width:0;display:inline-flex}.SFO4UW_pendingModel{border-radius:var(--dsw-radius-sm);min-width:0;max-width:min(220px,45cqw);height:28px;color:var(--dsw-alias-label-tertiary);white-space:nowrap;user-select:none;align-items:center;gap:6px;padding:0 8px;font-size:13px;line-height:20px;display:inline-flex}.SFO4UW_pendingModelLabel{text-overflow:ellipsis;min-width:0;overflow:hidden}.SFO4UW_pendingHarness{width:30px;height:28px;color:var(--dsw-alias-label-tertiary);opacity:.7;user-select:none;border-radius:6px;flex-shrink:0;justify-content:center;align-items:center;display:inline-flex}[data-phone] .SFO4UW_creationRetry{min-height:36px;padding:6px 12px}[data-phone] .SFO4UW_pendingModel{max-width:100%}[data-phone] .SFO4UW_pendingModelLabel{flex:0 auto;min-width:0;max-width:120px}[data-phone] .SFO4UW_pendingHarness{width:36px;height:36px}`,document.head.appendChild(e)}var $={accessory:`SFO4UW_accessory`,activity:`SFO4UW_activity`,activityExpanded:`SFO4UW_activityExpanded`,add:`SFO4UW_add`,addSeat:`SFO4UW_addSeat`,annotations:`SFO4UW_annotations`,card:`SFO4UW_card`,cardStack:`SFO4UW_cardStack`,cardWorkspaceTrigger:`SFO4UW_cardWorkspaceTrigger`,controlScroll:`SFO4UW_controlScroll`,creationError:`SFO4UW_creationError`,creationErrorCopy:`SFO4UW_creationErrorCopy`,creationErrorDetail:`SFO4UW_creationErrorDetail`,creationErrorIcon:`SFO4UW_creationErrorIcon`,creationErrorTitle:`SFO4UW_creationErrorTitle`,creationRetry:`SFO4UW_creationRetry`,dock:`SFO4UW_dock`,grow:`SFO4UW_grow`,hero:`SFO4UW_hero`,inlineNotices:`SFO4UW_inlineNotices`,input:`SFO4UW_input`,"input-pending":`SFO4UW_input-pending`,inputDisabled:`SFO4UW_inputDisabled`,modes:`SFO4UW_modes`,notice:`SFO4UW_notice`,overlayAnchor:`SFO4UW_overlayAnchor`,pending:`SFO4UW_pending`,pendingControls:`SFO4UW_pendingControls`,pendingHarness:`SFO4UW_pendingHarness`,pendingModel:`SFO4UW_pendingModel`,pendingModelLabel:`SFO4UW_pendingModelLabel`,placeholder:`SFO4UW_placeholder`,primary:`SFO4UW_primary`,retry:`SFO4UW_retry`,root:`SFO4UW_root`,row:`SFO4UW_row`,scroll:`SFO4UW_scroll`,select:`SFO4UW_select`,standardControls:`SFO4UW_standardControls`,submitSeat:`SFO4UW_submitSeat`,tools:`SFO4UW_tools`,topRail:`SFO4UW_topRail`,trailing:`SFO4UW_trailing`,trailingActive:`SFO4UW_trailingActive`};let qA=[],JA=(0,g.memo)(function({useSession:e,useInput:t,inputActions:n,keyboard:r,pendingDraft:i,addFiles:a,removeAttachment:o,resolveDraftAttachments:s,retryFileUpload:c,revealResponseAnnotation:l,toggleCommandMenu:u,stop:f,t:p,renderSlot:m,usePendingDraftText:_,useBusyEnter:v,useFileUploads:y,useNotices:b,useLexicon:ee,useMenuLauncher:te,useStopShortcut:ne,useProjection:re,sessionId:ie,variant:ae,disabled:oe=!1,preparingDraft:se=!1,sessionCreation:ce,onRetrySessionCreation:le,blocked:ue,workspacePickerOpen:de=!1,onRequestWorkspace:fe,placeholder:pe,topBar:me,accessory:x}){let S=t(e=>e),he=_(e=>e),ge=S?.responseAnnotations??qA,_e=S?.hoveredResponseAnnotationId,ve=(0,g.useMemo)(()=>({regionAria:p(`annotation.rail`),count:e=>p(`annotation.trayCount`,{count:e}),clearAll:p(`annotation.clearAll`),emptyComment:p(`annotation.emptyComment`),editHint:e=>p(`annotation.editHint`,{index:e}),revealHint:e=>p(`annotation.revealHint`,{index:e}),remove:e=>p(`annotation.remove`,{index:e})}),[p]),ye=(0,g.useMemo)(()=>ge.map(e=>({id:e.id,text:e.text,...e.annotation===void 0?{}:{annotation:e.annotation},canReveal:e.anchor!==void 0})),[ge]),be=b(e=>e),xe=v(e=>e),Se=ne(e=>e),Ce=te(e=>e===`command`),[we,Te]=(0,g.useState)(!1);(0,g.useEffect)(()=>{Te(!1)},[ie]);let Ee=e(e=>e.promptError)??null,De=e(e=>e.running)??!1,Oe=e(e=>e.subagent)??null,ke=e(e=>e.removed)??!1,Ae=re(`plan`,e=>e!==void 0&&(e.pending?!e.active:e.active)),je=re(`goal`,e=>e!=null),Me=ie===void 0&&i!==void 0&&ce!==void 0&&ce.state!==`idle`,Ne=Me&&ce.state===`creating`,Pe=Me&&ce.state===`error`,Fe=Me?ce.token:void 0,Ie=S!==void 0&&r!==void 0&&n!==void 0,Le=Me?he:S?.draft??``,Re=S?.primaryAction,C=Me?i.editor:r?.editor??null,ze=(0,g.useMemo)(()=>S===void 0||s===void 0?[]:s(S.attachmentIds),[s,S?.attachmentIds]),Be=Le.trim()===``&&ze.length===0&&ge.length===0,Ve=y(e=>e),He=ze.some(e=>Ve[e.id]?.status===`error`),[Ue,We]=(0,g.useState)(null),Ge=(0,g.useRef)(0),Ke=(0,g.useCallback)(e=>{Ge.current+=1,We({seq:Ge.current,text:e})},[]),qe=(0,g.useCallback)(()=>{We(null)},[]),Je=re(`imageLimits`),Ye=re(`attachmentInput`),Xe=re(`queueState`),Ze=Ye?.enabled!==!1,Qe=Ye?.imagesOnly===!0;(0,g.useEffect)(()=>{if(Ee===null)return;let{error:e}=Ee;e.code===`session/writer-held`?Ke(p(`error.sessionInUse`)):e.code===`remote/turn-changed`?Ke(p(`error.steerTurnChanged`)):e.code===`remote/steer-unavailable`?Ke(p(`error.remoteSteerUnavailable`)):Ke(e.code===`session/attachment-invalid`||e.code===`subagent/attachment-invalid`?IA(p,e.details.reason,Je):`${e.message} (${e.code})`)},[Ee,Ke,p,Je]),(0,g.useEffect)(()=>{be?.level===`error`&&Ke(be.text)},[be,Ke]);let $e=(0,g.useRef)(null),[et,tt]=(0,g.useState)({phone:!1,overflowActions:!1});(0,g.useLayoutEffect)(()=>{let e=$e.current;if(e!==null)return GA(e,tt)},[]);let nt=(0,g.useRef)(null),rt=(0,g.useRef)(null),it=Oe?.address.mode===`continuable`,at=it&&Oe.parentAvailable!==!0,ot=Me||ke||oe||!Ie||ue!==void 0||at,st=ot,ct=Me||ke||oe||!Ie,lt=S?.phase===`adjudicating`||S?.phase===`submitting`,ut=!Me&&oe&&!ke&&fe!==void 0,dt=Me||Ie&&!lt&&(!st||!Me&&se&&Ie&&!ke&&!at&&!ut),ft=ke||!dt&&!ut,pt=Oe===null||Oe.address.mode===`continuable`,mt=!st&&!lt&&Be&&De&&pt&&Xe?.previewOnly!==!0&&S.queue.length>0,ht=(0,g.useRef)(Me),gt=(0,g.useRef)(!1);if(ht.current&&!Me&&ie!==void 0){let e=document.activeElement;e!==null&&nt.current?.contains(e)&&(gt.current=!0)}(0,g.useLayoutEffect)(()=>{ht.current=Me},[Me]),(0,g.useEffect)(()=>{S!==void 0&&n!==void 0&&ze.length!==S.attachmentIds.length&&n.pruneAttachments(ze.map(e=>e.id))},[ze,S?.attachmentIds,n]);let _t=()=>{EA(rt)};(0,g.useEffect)(()=>{Me?C!==null&&(0,d.shouldAutoFocusTextInput)()&&DA(C,_t):C!==null&&dt&&(gt.current?(gt.current=!1,DA(C,_t)):!st&&(0,d.shouldAutoFocusTextInput)()&&DA(C,_t))},[Me,Fe,st,dt,ie,C]),(0,g.useEffect)(()=>{st||Le===``||_t()},[Le!==``]),(0,g.useEffect)(()=>kA(rt),[]);let vt=(0,g.useRef)({sessionId:ie,ids:new Set(ze.map(e=>e.id)),count:ze.length}),[yt,bt]=(0,g.useState)(0),xt=(0,g.useRef)(0);(0,g.useEffect)(()=>{let e=vt.current,t=e.sessionId!==ie,n=yt!==xt.current;if(xt.current=yt,t){vt.current={sessionId:ie,ids:new Set(ze.map(e=>e.id)),count:ze.length};return}let r=!1;for(let t of ze)e.ids.has(t.id)||(e.ids.add(t.id),r=!0);let i=e.count!==ze.length;e.count=ze.length;let a=(r||n)&&(0,d.shouldAutoFocusTextInput)();if(!a&&!i&&!r&&!n||C===null||!dt||st)return;a&&DA(C,_t);let o=window.requestAnimationFrame(()=>{let e=C.getRootElement();if(e===null)return;let t=e.ownerDocument.activeElement;a&&(t===null||t===e.ownerDocument.body||t===e.ownerDocument.documentElement)&&DA(C,_t),OA(C),_t()});return()=>{window.cancelAnimationFrame(o)}},[ie,ze,yt,C,dt,st]);let St=(0,g.useCallback)((e,t)=>{if(Oe!==null||a===void 0||e.length===0)return;if(!Ze){Ke(p(`attachment.unavailable`));return}let n=(()=>{if(Qe&&e.some(e=>!(Je?.mediaTypes)?.includes(e.type)))return p(`image.unsupportedType`);if(Je!==void 0){let t=Je.mediaTypes,n=e.filter(e=>t.includes(e.type)),r=ze.filter(e=>e.kind===`image`);if(r.length+n.length>Je.maxImagesPerMessage)return p(`image.tooMany`,{count:Je.maxImagesPerMessage});if(n.some(e=>e.size>Je.maxImageBytes))return p(`image.fileTooLarge`,{size:FA(Je.maxImageBytes)});if(r.reduce((e,t)=>e+t.file.size,0)+n.reduce((e,t)=>e+t.size,0)>Je.maxMessageImageBytes)return p(`image.totalTooLarge`,{size:FA(Je.maxMessageImageBytes)})}return a(e,t)})();n===null?bt(e=>e+1):Ke(n)},[Oe,a,Ze,Qe,ze,Je,Ke,p]),Ct=Ze&&Oe===null&&!st&&!lt&&a!==void 0,wt=p(Ze?Qe?`input.imagesAndCommands`:`input.commands`:`input.commandsOnly`),Tt=(0,g.useRef)(null),Et=e=>{let t=e.target.files===null?[]:[...e.target.files];e.target.value=``,t.length>0&&St(t)},Dt=(0,g.useRef)({locked:st,canPasteText:dt,machineBusy:lt,primaryAction:Re,canSteerQueue:mt,running:De,steeringAvailable:pt,busyEnter:xe,intakeFiles:St,uploadsFailed:He,showToast:Ke,t:p,canAcceptDrop:Ct});Dt.current={locked:st,canPasteText:dt,machineBusy:lt,primaryAction:Re,canSteerQueue:mt,running:De,steeringAvailable:pt,busyEnter:xe,intakeFiles:St,uploadsFailed:He,showToast:Ke,t:p,canAcceptDrop:Ct},(0,g.useEffect)(()=>{if(r!==void 0)return AA(r,Dt,Tt)},[r]),(0,g.useEffect)(()=>{if(C!==null){if(Me&&i!==void 0)return TA(C,{arbitrate:()=>`pass`,space:()=>!1,dismissPopup:()=>{},canSubmit:()=>!1,submit:()=>{},intakeFiles:()=>{Dt.current.showToast(Dt.current.t(`newSession.uploadUnavailable`))},pasteText:e=>{i.paste(e)}});if(r!==void 0)return jA(C,r,Dt)}},[C,r,Me,i]);let Ot=e=>{PA(e,C)},kt=e=>{!Mt&&e.button===0&&MA(e.currentTarget.ownerDocument),PA(e,C)},At=()=>{r!==void 0&&(C!==null&&(0,d.shouldAutoFocusTextInput)()&&DA(C,_t),u?.(r.caretSpan()))},jt=e=>{ut&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),fe())},Mt=Re===void 0&&De&&Oe===null&&(Be||ue!==void 0),Nt=Mt?f===void 0:(Re===void 0?Be:Re.disabled)||ot||lt,Pt=De&&it,Ft=pk(xe,De,`enter`,pt),It=!Be&&S?.phase===`plain`&&!Le.trimStart().startsWith(`/`),Lt=p(Mt?`input.stop`:Re===void 0&&De&&pt&&!ot&&!He&&It?Ft===`steer`?`input.send.steer`:`input.send.queue`:`input.send`),Rt=()=>{(0,d.shouldAutoFocusTextInput)()||NA(C)},zt=()=>{Rt(),f?.()},Bt=()=>{Mt?zt():He?Ke(p(`file.retryOrRemove`)):Re===void 0?r!==void 0&&!Be&&!ot&&!lt&&(Rt(),r.submit(Ft,`click`)):Nt||(Rt(),Re.run())},Vt=(S?.phase===`claimed`||S?.phase===`submitting`)&&S.claim!==void 0&&Le.startsWith(S.claim.token),Ht=Vt&&S.claim.hint!==void 0&&Le.slice(S.claim.token.length).trim()===``?S.claim.hint:null,Ut=(()=>{if(Ht===null)return null;let e=S?.claim?.name??``,t=`hint.${e===`goal`&&je?`goal.active`:e}`,n=p(t);return n===t?Ht:n})(),Wt=pe??p(at?`placeholder.parentOffline`:ot?`placeholder.unavailable`:mt?`placeholder.steerQueue`:Ae?`placeholder.plan`:`placeholder.default`);return/* @__PURE__ */ (0,h.jsxs)(`div`,{className:sC($.root,ae===`hero`&&$.hero),"data-composer-variant":ae,children:[Ue!==null&&/* @__PURE__ */ (0,h.jsx)(d.Toast,{text:Ue.text,icon:/* @__PURE__ */ (0,h.jsx)(d.IconWarningOutlineRegular,{}),anchor:nt.current,onDone:qe},Ue.seq),be?.level===`info`&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.notice,role:`status`,children:be.text}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.cardStack,children:[me!==void 0&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.topRail,"data-composer-top-bar":``,onClick:e=>{e.stopPropagation()},onPointerDown:e=>{e.stopPropagation()},children:me}),/* @__PURE__ */ (0,h.jsxs)(`div`,{ref:nt,className:sC($.card,ut&&$.cardWorkspaceTrigger),"data-composer-card":!0,onClick:ut?fe:void 0,onPointerDown:ut?e=>{e.stopPropagation()}:void 0,children:[ie!==void 0&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.overlayAnchor,children:m(`conversation.input.overlay`,{})}),x!==void 0&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.accessory,children:x}),Pe&&/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.creationError,role:`alert`,"data-new-session-error":``,children:[/* @__PURE__ */ (0,h.jsx)(d.IconWarningOutlineRegular,{className:$.creationErrorIcon,size:16}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.creationErrorCopy,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:$.creationErrorTitle,children:p(`newSession.createFailedTitle`)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:$.creationErrorDetail,children:ce.reason===`no-harness`?p(`newSession.createFailed.noHarness`):ce.reason===`workspace-required`?p(`newSession.createFailed.workspaceRequired`):ce.message??p(`newSession.createFailed.generic`)})]}),le!==void 0&&/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:$.creationRetry,onMouseDown:Ot,onClick:le,children:p(`newSession.retry`)})]}),ye.length===0?null:/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.annotations,children:/* @__PURE__ */ (0,h.jsx)(d.ResponseAnnotationTray,{annotations:ye,hoveredId:_e,disabled:st||lt,labels:ve,onHover:e=>{n?.hoverResponseAnnotation(e)},onReveal:l===void 0?void 0:e=>{l(e)},onUpdate:(e,t)=>{n?.updateResponseAnnotation(e,t)},onRemove:e=>{n?.removeResponseAnnotation(e)},onClearAll:()=>{n?.clearResponseAnnotations()}})}),S===void 0||ie===void 0?null:/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.inlineNotices,children:m(`conversation.input.notice`,{})}),m(`conversation.input.attachments`,{attachments:ze,canAcceptDrop:Ct,onAddFiles:St,onRemoveAttachment:e=>{o?.(e)},uploads:Ve,onRetryFile:e=>{c?.(e)},dropLimits:Je===void 0?void 0:{count:Je.maxImagesPerMessage,size:FA(Je.maxImageBytes)}}),/* @__PURE__ */ (0,h.jsx)(SA,{classNames:$,editor:C,scrollRef:rt,editable:dt,editorDisabled:ft,preserveFocus:gt.current,phase:Me?`plain`:S?.phase??`inert`,placeholderText:Wt,ariaLabel:ut?p(`hero.chooseWorkspace`):Wt,workspaceTrigger:ut,workspacePickerOpen:de,onWorkspaceKeyDown:jt,hint:Ut,showPlaceholder:Le===``&&ze.length===0&&!Vt}),/* @__PURE__ */ (0,h.jsx)(`div`,{ref:$e,className:$.row,"data-composer-toolbar":!0,"data-command-menu-open":Ce||void 0,"data-toolbar-activity":we||void 0,children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.controlScroll,"data-toolbar-scroll":!0,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.tools,hidden:we,"data-composer-tools":!0,children:[/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.addSeat,"data-toolbar-fixed":`start`,children:/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:et.phone,label:wt,side:`top`,delayMs:500,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:$.add,"aria-label":wt,"aria-haspopup":`listbox`,"aria-expanded":Ce,disabled:st||lt||u===void 0,onMouseDown:Ot,onClick:At,children:/* @__PURE__ */ (0,h.jsx)(d.IconPlusOutlineMedium,{size:14})})})}),/* @__PURE__ */ (0,h.jsx)(`input`,{ref:Tt,type:`file`,accept:Qe?Je?.mediaTypes.join(`,`):void 0,multiple:!0,disabled:!Ze||Oe!==null,hidden:!0,onChange:Et}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.modes,children:[ie===void 0?null:m(`conversation.input.permission`,{locked:st}),ie===void 0?null:m(`conversation.input.plan`,{locked:st})]}),S===void 0||ie===void 0?null:m(`conversation.input.left`,{})]}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:sC($.trailing,we&&$.trailingActive),children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.standardControls,hidden:we,children:[S===void 0||ie===void 0?null:m(`conversation.input.right`,{overflowActions:et.overflowActions}),ie===void 0?Ne?/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.pendingControls,role:`status`,"aria-live":`polite`,"data-new-session-loading":``,children:[/* @__PURE__ */ (0,h.jsxs)(`span`,{className:$.pendingModel,children:[/* @__PURE__ */ (0,h.jsx)(d.StateDot,{state:`ongoing`}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:$.pendingModelLabel,children:p(`newSession.loadingModel`)})]}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:$.pendingHarness,role:`img`,"aria-label":p(`newSession.loadingHarness`),"aria-busy":`true`,title:p(`newSession.loadingHarness`),children:/* @__PURE__ */ (0,h.jsx)(d.StateDot,{state:`ongoing`})})]}):null:m(`conversation.input.model`,{locked:ct})]}),S===void 0||ie===void 0?null:/* @__PURE__ */ (0,h.jsx)(`div`,{className:we?$.activityExpanded:$.activity,children:m(`conversation.input.activity`,{locked:st,onActiveChange:Te})}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.submitSeat,"data-toolbar-fixed":`end`,children:[Pt&&/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:et.phone,label:p(`input.stop`),shortcutKeys:Se,side:`top`,delayMs:500,disabled:f===void 0,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:$.primary,"aria-label":p(`input.stop`),disabled:f===void 0,onMouseDown:Ot,onClick:zt,children:/* @__PURE__ */ (0,h.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(`rect`,{x:`3`,y:`3`,width:`10`,height:`10`,rx:`3`,fill:`currentColor`})})})}),/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:et.phone,label:Mt?p(`input.stop`):Lt,shortcutKeys:Mt?Se:void 0,side:`top`,delayMs:500,disabled:Nt,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:$.primary,"aria-label":Lt,disabled:Nt,onMouseDown:kt,onClick:Bt,children:Mt?/* @__PURE__ */ (0,h.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(`rect`,{x:`3`,y:`3`,width:`10`,height:`10`,rx:`3`,fill:`currentColor`})}):/* @__PURE__ */ (0,h.jsx)(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(`path`,{d:`M8.3125 0.980183C8.66767 1.0531 8.97902 1.20418 9.2627 1.43233C9.48724 1.61297 9.73029 1.85793 9.97949 2.10714L14.707 6.83468L13.293 8.24874L9 3.95577V15.0417H7V3.95577L2.70703 8.24874L1.29297 6.83468L6.02051 2.10714C6.26971 1.85793 6.51277 1.61297 6.7373 1.43233C6.97662 1.23986 7.28445 1.04402 7.6875 0.980183C7.8973 0.947006 8.1031 0.95516 8.3125 0.980183Z`,fill:`currentColor`})})})})]})]})]})})]})]}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.dock,"data-composer-dock":!0,"data-cx-region":`composer-dock`,children:[ae===`composer`&&S!==void 0&&ie!==void 0?m(`conversation.composer.dock`,{}):null,we?null:/* @__PURE__ */ (0,h.jsx)(WA,{useProjection:re,t:p})]})]})}),YA=`@deepseek-ai/dsh-client-ui-conversation/TodoPanel.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(YA)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=YA,e.textContent=`.OKyn-W_root{box-sizing:border-box;width:calc(100% - var(--dsh-composer-side-clearance) - var(--dsh-composer-side-clearance) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));max-width:calc(var(--dsh-composer-card-max-width) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));--dsw-elevation-stroke-color:var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-lg);background:var(--dsw-specific-menu);backdrop-filter:var(--dsw-menu-backdrop-filter);box-shadow:var(--dsw-elevation-panel);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);border:0;flex:none;margin:0 auto;overflow:hidden}.OKyn-W_body{flex-direction:column;gap:8px;padding:6px 12px;display:flex}.OKyn-W_header{text-align:left;cursor:pointer;background:0 0;border:none;align-items:center;gap:10px;width:100%;padding:0;display:flex}.OKyn-W_lead{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.OKyn-W_title{color:var(--dsw-alias-label-primary);flex:none;font-size:13px;font-weight:500;line-height:24px}.OKyn-W_progress{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex:auto;font-size:13px;font-weight:400;line-height:20px;overflow:hidden}.OKyn-W_chevron{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.OKyn-W_list{flex-direction:column;gap:8px;max-height:180px;margin:0;padding:0;list-style:none;display:flex;overflow-y:auto}.OKyn-W_item{min-width:0;color:var(--dsw-alias-label-secondary);align-items:center;gap:10px;font-size:13px;line-height:20px;display:flex}.OKyn-W_glyph{flex:none;place-items:center;width:16px;height:16px;display:grid}.OKyn-W_content{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}`,document.head.appendChild(e)}var XA={body:`OKyn-W_body`,chevron:`OKyn-W_chevron`,content:`OKyn-W_content`,glyph:`OKyn-W_glyph`,header:`OKyn-W_header`,item:`OKyn-W_item`,lead:`OKyn-W_lead`,list:`OKyn-W_list`,progress:`OKyn-W_progress`,root:`OKyn-W_root`,title:`OKyn-W_title`};
172
172
  /* v8 ignore next 3 -- closed-union backstop; only reached if status is forged */
173
- function YA(e){throw Error(`unreachable todo status: ${String(e)}`)}function XA(e){switch(e){case`completed`:return`done`;case`in_progress`:return`ongoing`;case`pending`:return`idle`;
173
+ function ZA(e){throw Error(`unreachable todo status: ${String(e)}`)}function QA(e){switch(e){case`completed`:return`done`;case`in_progress`:return`ongoing`;case`pending`:return`idle`;
174
174
  /* v8 ignore next -- closed TodoItem status union */
175
- default:return YA(e)}}function ZA(e,t){switch(e){case`completed`:return t(`todo.status.completed`);case`in_progress`:return t(`todo.status.inProgress`);case`pending`:return t(`todo.status.pending`);
175
+ default:return ZA(e)}}function $A(e,t){switch(e){case`completed`:return t(`todo.status.completed`);case`in_progress`:return t(`todo.status.inProgress`);case`pending`:return t(`todo.status.pending`);
176
176
  /* v8 ignore next -- closed TodoItem status union */
177
- default:return YA(e)}}function QA(e,t){let n=e.filter(e=>e.status===`completed`).length,r=e.filter(e=>e.status===`in_progress`).length,i=e.length-n-r;return[...n>0?[t(`todo.progress.done`,{done:n})]:[],...r>0?[t(`todo.progress.active`,{active:r})]:[],...i>0?[t(`todo.progress.pending`,{pending:i})]:[]].join(` · `)}function $A({todos:e,t}){let[n,r]=(0,g.useState)(!0);return e.length===0?null:/* @__PURE__ */ (0,h.jsx)(`section`,{className:JA.root,"data-testid":`todo-panel`,"aria-label":t(`todo.title`),children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:JA.body,children:[/* @__PURE__ */ (0,h.jsxs)(`button`,{type:`button`,className:JA.header,"aria-expanded":!n,onClick:()=>{r(e=>!e)},children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:JA.lead,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconChecklistOutlineRegular,{})}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:JA.title,children:t(`todo.title`)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:JA.progress,children:QA(e,t)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:JA.chevron,"aria-hidden":!0,children:n?/* @__PURE__ */ (0,h.jsx)(d.IconChevronUpOutlineRegular,{}):/* @__PURE__ */ (0,h.jsx)(d.IconChevronDownOutlineRegular,{})})]}),!n&&/* @__PURE__ */ (0,h.jsx)(`ul`,{className:JA.list,children:e.map(e=>/* @__PURE__ */ (0,h.jsxs)(`li`,{className:JA.item,"data-status":e.status,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:JA.glyph,role:`img`,"aria-label":ZA(e.status,t),children:/* @__PURE__ */ (0,h.jsx)(d.StateDot,{state:XA(e.status)})}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:JA.content,children:e.content})]},e.content))})]})})}function ej({useProjection:e,t}){let n=e(`todos`);return/* @__PURE__ */ (0,h.jsx)($A,{todos:n??[],t})}let tj={name:`conversation-todo-dock`,inject:[`slots`],apply(e){e.slots.inject(`conversation.input.dock`,()=>e.slots.register({name:`conversation.input.dock`,id:`todo`,order:0,locale:ed},ej))}};var nj=class{intervalMs;release;first;timer;constructor(e,t){this.intervalMs=e,this.release=t}reset(){this.first=void 0,clearTimeout(this.timer),this.timer=void 0,this.release()}press(e){let t=this.first;return this.reset(),t!==void 0&&performance.now()<=t.deadline&&t.target.sessionId===e.sessionId&&t.target.turn===e.turn&&t.target.generation===e.generation&&t.target.region===e.region?(e.cancel(),!0):(this.first={target:e,deadline:performance.now()+this.intervalMs},this.timer=setTimeout(()=>{this.reset()},this.intervalMs+1),!1)}};function rj(e,t,n,r,i){let a=()=>{},o=new nj(e.stopSequenceMs,()=>{a(),a=()=>{}}),s=()=>{o.reset()},c=e.observeFixedInput(e=>{if(e.type===`reset`){s();return}let{gesture:c,context:l}=e;if(c.code!==`Escape`||c.repeat||c.composing||c.defaultPrevented||c.control||c.alt||c.shift||c.meta||l.modal!==null||l.region===`terminal`||l.target===null){s();return}let u=l.target,d=u.closest(`[data-conversation-session]`),f=u.closest(`[data-conversation-region]`);if(d===null||f===null||!d.contains(f)||u.closest(`[data-approval-key], iframe, .xterm, [inert]`)!==null){s();return}let p=d.dataset.conversationSession,m=t.binding(p);if(m===void 0){s();return}let h=n(m),g=()=>{let e=m.session.getSnapshot();if(!(!e.running||e.removed||e.subagent!==null&&e.subagent.address.mode!==`continuable`||r.sessionStatus.getSnapshot().get(p)?.pendingInteraction!==void 0))return h.getSnapshot()},_=g();if(_===void 0){s();return}if(e.consume(),o.press({sessionId:p,turn:_,generation:m,region:f,cancel:()=>{i(p)}}))return;let v=()=>{(t.binding(p)!==m||g()!==_)&&s()},y=[h.subscribe(v),m.session.subscribe(v),r.sessionStatus.subscribe(v)];a=()=>{for(let e of y)e()}});return()=>{c(),s()}}let ij=[`slots`,`sessions`,`fileUpload`,`uiSession`,`uiWorkspace`,`locale`,`configForms`],aj=S.object({maxConcurrentFileUploads:S.natural().min(1).default(2)}),oj={getSnapshot:()=>null,subscribe:()=>()=>{}},sj={getSnapshot:()=>void 0,subscribe:()=>()=>{}},cj=/* @__PURE__ */ new Map,lj={getSnapshot:()=>cj,subscribe:()=>()=>{}},uj={getSnapshot:()=>null,subscribe:()=>()=>{}},dj={},fj={getSnapshot:()=>dj,subscribe:()=>()=>{}},pj={state:`idle`},mj={getSnapshot:()=>pj,subscribe:()=>()=>{}},hj={getSnapshot:()=>``,subscribe:()=>()=>{}};function gj(){return globalThis.__DSH_HOST_PATHS__}function _j(e,t){let n=e.scope(t);if(n===void 0)throw Error(`ui-conversation: session "${t}" resolved no scope`);let r=n.get(`conversation`);if(r===void 0)throw Error(`ui-conversation: conversation service unavailable through the session scope`);return r}function vj(e){let t=e.get(`conversation`);if(t===void 0)throw Error(`ui-conversation: conversation service unavailable`);return t}function yj(e,t=aj({})){let n=e.sessions,r=e.slots,i=t.maxConcurrentFileUploads,a=e.get(`uiWorkspace`),o=new zt(e,n);e.effect(()=>e.locale.register(ed,{zh:rd,en:id}),`ui-conversation: dictionaries`);let s=e.locale.bind(ed),c=Ju(),l=new fk(e.configForms.get(`ui-conversation`));e.effect(()=>()=>{l.dispose()}),e.slots.inject(`settings.general.item`,()=>e.slots.register({name:`settings.general.item`,id:`composer-enter`,order:20,locale:ed,inject:()=>({hooks:{busyEnter:l.busyEnter},setBusyEnter:e=>{l.setBusyEnter(e)}})},Nk));let u=()=>{let t=[];for(let n of r.entries(`conversation.view`))
177
+ default:return ZA(e)}}function ej(e,t){let n=e.filter(e=>e.status===`completed`).length,r=e.filter(e=>e.status===`in_progress`).length,i=e.length-n-r;return[...n>0?[t(`todo.progress.done`,{done:n})]:[],...r>0?[t(`todo.progress.active`,{active:r})]:[],...i>0?[t(`todo.progress.pending`,{pending:i})]:[]].join(` · `)}function tj({todos:e,t}){let[n,r]=(0,g.useState)(!0);return e.length===0?null:/* @__PURE__ */ (0,h.jsx)(`section`,{className:XA.root,"data-testid":`todo-panel`,"aria-label":t(`todo.title`),children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:XA.body,children:[/* @__PURE__ */ (0,h.jsxs)(`button`,{type:`button`,className:XA.header,"aria-expanded":!n,onClick:()=>{r(e=>!e)},children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:XA.lead,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconChecklistOutlineRegular,{})}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:XA.title,children:t(`todo.title`)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:XA.progress,children:ej(e,t)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:XA.chevron,"aria-hidden":!0,children:n?/* @__PURE__ */ (0,h.jsx)(d.IconChevronUpOutlineRegular,{}):/* @__PURE__ */ (0,h.jsx)(d.IconChevronDownOutlineRegular,{})})]}),!n&&/* @__PURE__ */ (0,h.jsx)(`ul`,{className:XA.list,children:e.map(e=>/* @__PURE__ */ (0,h.jsxs)(`li`,{className:XA.item,"data-status":e.status,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:XA.glyph,role:`img`,"aria-label":$A(e.status,t),children:/* @__PURE__ */ (0,h.jsx)(d.StateDot,{state:QA(e.status)})}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:XA.content,children:e.content})]},e.content))})]})})}function nj({useProjection:e,t}){let n=e(`todos`);return/* @__PURE__ */ (0,h.jsx)(tj,{todos:n??[],t})}let rj={name:`conversation-todo-dock`,inject:[`slots`],apply(e){e.slots.inject(`conversation.input.dock`,()=>e.slots.register({name:`conversation.input.dock`,id:`todo`,order:0,locale:ed},nj))}};var ij=class{intervalMs;release;first;timer;constructor(e,t){this.intervalMs=e,this.release=t}reset(){this.first=void 0,clearTimeout(this.timer),this.timer=void 0,this.release()}press(e){let t=this.first;return this.reset(),t!==void 0&&performance.now()<=t.deadline&&t.target.sessionId===e.sessionId&&t.target.turn===e.turn&&t.target.generation===e.generation&&t.target.region===e.region?(e.cancel(),!0):(this.first={target:e,deadline:performance.now()+this.intervalMs},this.timer=setTimeout(()=>{this.reset()},this.intervalMs+1),!1)}};function aj(e,t,n,r,i){let a=()=>{},o=new ij(e.stopSequenceMs,()=>{a(),a=()=>{}}),s=()=>{o.reset()},c=e.observeFixedInput(e=>{if(e.type===`reset`){s();return}let{gesture:c,context:l}=e;if(c.code!==`Escape`||c.repeat||c.composing||c.defaultPrevented||c.control||c.alt||c.shift||c.meta||l.modal!==null||l.region===`terminal`||l.target===null){s();return}let u=l.target,d=u.closest(`[data-conversation-session]`),f=u.closest(`[data-conversation-region]`);if(d===null||f===null||!d.contains(f)||u.closest(`[data-approval-key], iframe, .xterm, [inert]`)!==null){s();return}let p=d.dataset.conversationSession,m=t.binding(p);if(m===void 0){s();return}let h=n(m),g=()=>{let e=m.session.getSnapshot();if(!(!e.running||e.removed||e.subagent!==null&&e.subagent.address.mode!==`continuable`||r.sessionStatus.getSnapshot().get(p)?.pendingInteraction!==void 0))return h.getSnapshot()},_=g();if(_===void 0){s();return}if(e.consume(),o.press({sessionId:p,turn:_,generation:m,region:f,cancel:()=>{i(p)}}))return;let v=()=>{(t.binding(p)!==m||g()!==_)&&s()},y=[h.subscribe(v),m.session.subscribe(v),r.sessionStatus.subscribe(v)];a=()=>{for(let e of y)e()}});return()=>{c(),s()}}let oj=[`slots`,`sessions`,`fileUpload`,`uiSession`,`uiWorkspace`,`locale`,`configForms`],sj=S.object({maxConcurrentFileUploads:S.natural().min(1).default(2)}),cj={getSnapshot:()=>null,subscribe:()=>()=>{}},lj={getSnapshot:()=>void 0,subscribe:()=>()=>{}},uj=/* @__PURE__ */ new Map,dj={getSnapshot:()=>uj,subscribe:()=>()=>{}},fj={getSnapshot:()=>null,subscribe:()=>()=>{}},pj={},mj={getSnapshot:()=>pj,subscribe:()=>()=>{}},hj={state:`idle`},gj={getSnapshot:()=>hj,subscribe:()=>()=>{}},_j={getSnapshot:()=>``,subscribe:()=>()=>{}};function vj(){return globalThis.__DSH_HOST_PATHS__}function yj(e,t){let n=e.scope(t);if(n===void 0)throw Error(`ui-conversation: session "${t}" resolved no scope`);let r=n.get(`conversation`);if(r===void 0)throw Error(`ui-conversation: conversation service unavailable through the session scope`);return r}function bj(e){let t=e.get(`conversation`);if(t===void 0)throw Error(`ui-conversation: conversation service unavailable`);return t}function xj(e,t=sj({})){let n=e.sessions,r=e.slots,i=t.maxConcurrentFileUploads,a=e.get(`uiWorkspace`),o=new zt(e,n);e.effect(()=>e.locale.register(ed,{zh:rd,en:id}),`ui-conversation: dictionaries`);let s=e.locale.bind(ed),c=Ju(),l=new mk(e.configForms.get(`ui-conversation`));e.effect(()=>()=>{l.dispose()}),e.slots.inject(`settings.general.item`,()=>e.slots.register({name:`settings.general.item`,id:`composer-enter`,order:20,locale:ed,inject:()=>({hooks:{busyEnter:l.busyEnter},setBusyEnter:e=>{l.setBusyEnter(e)}})},Fk));let u=()=>{let t=[];for(let n of r.entries(`conversation.view`))
178
178
  /* v8 ignore next -- list registration validates id at load. */
179
- n.options.id!==void 0&&(e.configForms.developerTools.enabled.getSnapshot()||n.options.id!==`trajectory`)&&t.push({id:n.options.id,label:(0,p.resolveSlotLabel)(n.options.label)??n.options.id});return t},m=(e,t)=>{let n=fA(u(),t);n!==void 0&&o.binding(e).activate(n.id)},h=e=>{m(e,Xu(e))},g=(0,f.createSnapshotStore)(u()),_=/* @__PURE__ */ new Set,v=/* @__PURE__ */ new WeakSet,y=e=>{v.has(e)||(v.add(e),_.add(e),e.ctx.effect(()=>()=>{_.delete(e)},`ui-conversation: active Provider binding`))},b=()=>{let e=g.getSnapshot(),t=u();e.length===t.length&&e.every((e,n)=>{let r=t.at(n);return r!==void 0&&e.id===r.id&&e.label===r.label})||g.set(t);for(let e of _)n.binding(e.sessionId)===e&&h(e.sessionId)};e.effect(()=>{let t=r.subscribe(`conversation.view`,b),n=e.locale.subscribe(b),i=e.configForms.developerTools.enabled.subscribe(b);return()=>{i(),n(),t()}},`ui-conversation: View selection`);let ee=e=>{_j(n,e).cancel().catch(e=>{})},te=(0,f.createSnapshotStore)([]);e.inject([`shortcuts`],t=>{let r=[{id:`fixed.send`,label:()=>s(`input.send`),keys:[`Enter`],bindings:[{code:`Enter`,modifiers:[]}],group:`input`},{id:`fixed.newline`,label:()=>s(`shortcut.newline`),keys:t.shortcuts.describeBinding({code:`Enter`,modifiers:[`shift`]}).keys,bindings:[{code:`Enter`,modifiers:[`shift`]}],group:`input`},{id:`fixed.complementary`,label:()=>s(`shortcut.complementary`),keys:t.shortcuts.describeBinding({code:`Enter`,modifiers:[`primary`]}).keys,bindings:[{code:`Enter`,modifiers:[`control`]},{code:`Enter`,modifiers:[`meta`]}],group:`input`},{id:`fixed.slash`,label:()=>s(`shortcut.slash`),keys:[`/`],bindings:[{code:`Slash`,modifiers:[]}],group:`input`},{id:`fixed.mention`,label:()=>s(`shortcut.mention`),keys:[`@`],bindings:[{code:`Digit2`,modifiers:[`shift`]}],group:`input`}];for(let e of r)t.effect(()=>t.shortcuts.registerFixed(e),`ui-conversation: ${e.id}`);t.effect(()=>rj(t.shortcuts,n,e=>o.binding(e).openTurn,e.uiSession,ee),`ui-conversation: fixed stop input`),t.effect(()=>{let e={id:`response.stop`,label:()=>s(`input.stop`),keys:[`Esc`,`Esc`],bindings:[{code:`Escape`,modifiers:[]}],group:`input`},n=t.shortcuts.registerFixed(e);return te.set(e.keys),()=>{te.set([]),n()}},`ui-conversation: fixed stop reference`)});let ne=new ok;e.effect(()=>{let e=a.creating;e!==void 0&&ne.syncCreation(e.getSnapshot());let t=e?.subscribe(()=>{ne.syncCreation(e.getSnapshot())});return()=>{t?.(),ne.dispose()}},`ui-conversation: pending new-session draft`);let re=new ik(e,s,ne),ie=new _d;e.inject([`commandUi`],e=>{let t=e.get(`commandUi`);e.effect(()=>t.register({name:`file`,label:()=>s(`input.file`),icon:d.IconPaperclipOutlineRegular,available:e=>re.canPickFiles(e.sessionId),ui:{kind:`action`,run:e=>{re.pickFiles(e.sessionId)}}}),`ui-conversation: File action`)}),e.uiSession.provide({hooks:[`conversation`,`input`],props:[`inputActions`],resolve:e=>{y(e);let t=re.shellFor(e),n=o.binding(e);return h(e.sessionId),{hooks:{conversation:n.snapshot,input:t.state},props:{inputActions:t.actions}}}});let ae=()=>r.register({name:`main.conversation`,children:{"conversation.header":{kind:`single`,scope:`session-maybe`},"conversation.header.notice":{kind:`list`,scope:`session-maybe`}}},Gk),oe=()=>r.registerFactory({name:`conversation.content`,scope:`session-maybe`,locale:ed,children:{"conversation.session":{kind:`single`,scope:`session`},"conversation.composer":{kind:`chain`,scope:`session`},"conversation.composer.bar":{kind:`single`,scope:`session-maybe`},"conversation.input.dock":{kind:`list`,scope:`session`},"conversation.hero.brand.mark":{kind:`single`,scope:`root`},"conversation.hero.workspace":{kind:`single`,scope:`root`},"conversation.hero.agentPreset":{kind:`single`,scope:`session-maybe`}},slots:{views:{scope:`session`},widthControls:{scope:`root`}},inject:t=>({referenceEditor:t===void 0?void 0:re.shell(t).editor,retrySessionCreation:()=>{a.retryCreating?.()},hooks:{composerBlock:t===void 0?sj:ie.storeFor(t),sessionCreation:a.creating??mj},selectWorkspace:r=>a.openWorkspace(r,r=>{if(t!==void 0&&r!==t){let i=re.shell(t),a=i.draftSnapshot,o=i.snapshot.attachmentIds,s=re.shell(r);if(o.length===0||s.addAttachments(o)){if(n.binding(r)===void 0)throw Error(`ui-conversation: session "${r}" resolved no binding`);if(vj(e).rebindDraftFiles(r,o),a.text!==``&&(s.setDraft(a),i.setDraft(``)),o.length>0)for(let e of o)i.removeAttachment(e)}}})})},cA),se=()=>r.register({name:`conversation.session`,children:{"conversation.view":{kind:`list`,scope:`session`}},store:c,inject:(e,t)=>{let r=(n,r)=>{u().some(e=>e.id===n)&&(m(e,n),t.openView(n,r))},i=()=>o.views.entries().find(e=>e.toolCallFocus!==void 0&&g.getSnapshot().some(t=>t.id===e.target)),a=e=>{let t=i();t?.toolCallFocus!==void 0&&r(t.target,t.toolCallFocus(e))};return{hooks:{conversationViews:g,inspectCall:{getSnapshot:()=>i()===void 0?void 0:a,subscribe:e=>{let t=g.subscribe(e),n=o.views.subscribe(e);return()=>{t(),n()}}}},bindDraftPersistence:t=>re.shell(e).bindDraftPersistence(t),onRevealResponseAnnotation:t=>n.scope(e)?.on(`conversation/reveal-response-annotation`,t)??(()=>{}),openView:r}}},_A),ce=()=>r.register({name:`conversation.header`,children:{"conversation.header.leading":{kind:`single`,scope:`root`},"conversation.header.navigation":{kind:`single`,scope:`session-maybe`},"conversation.header.shortcuts":{kind:`single`,scope:`session-maybe`},"conversation.header.trailing":{kind:`single`,scope:`root`},"conversation.session.header":{kind:`single`,scope:`session`}}},dA),le=()=>r.register({name:`conversation.session.header`,locale:ed,children:{"conversation.session.header.lineage":{kind:`single`,scope:`session`},"conversation.session.header.actions":{kind:`list`,scope:`session`},"conversation.session.header.utilities":{kind:`list`,scope:`session`},"conversation.session.header.corner":{kind:`single`,scope:`session`}},store:c,inject:(e,t)=>({hooks:{conversationViews:g},open:e=>{a.openSession(e)},selectView:n=>{m(e,n),t.setView(n)}})},gA),ue=()=>r.register({name:`conversation.composer.bar`,locale:ed,children:{"conversation.input.attachments":{kind:`single`,scope:`session-maybe`},"conversation.input.overlay":{kind:`list`,scope:`session`},"conversation.input.notice":{kind:`list`,scope:`session`},"conversation.input.permission":{kind:`single`,scope:`session`},"conversation.input.left":{kind:`list`,scope:`session`},"conversation.input.plan":{kind:`single`,scope:`session`},"conversation.input.right":{kind:`list`,scope:`session`},"conversation.input.model":{kind:`single`,scope:`session`},"conversation.input.activity":{kind:`single`,scope:`session`},"conversation.composer.dock":{kind:`list`,scope:`session`}},inject:t=>{if(t===void 0)return{keyboard:void 0,pendingDraft:{editor:ne.editor,paste:e=>{ne.paste(e)}},addFiles:void 0,removeAttachment:void 0,resolveDraftAttachments:void 0,retryFileUpload:void 0,revealResponseAnnotation:void 0,toggleCommandMenu:void 0,stop:void 0,hooks:{pendingDraftText:ne.text,stopShortcut:te,busyEnter:l.busyEnter,fileUploads:fj,notices:oj,lexicon:lj,menuLauncher:uj}};let r=vj(e),i=re.shell(t),a=re.inputTriggers(t),o=gj();return{keyboard:i,pendingDraft:void 0,addFiles:(e,a=/* @__PURE__ */ new Set)=>{if(n.binding(t)===void 0)return s(`file.sessionUnavailable`);if(i.snapshot.phase===`adjudicating`||i.snapshot.phase===`submitting`)return s(`attachment.dropBlocked`);let c=[],l=[],u=n.list.getSnapshot().byId[t]?.cwd;for(let t of e){let e=a.has(t);if(o===void 0&&e)return s(`attachment.directoryDesktopOnly`);let n=o?.pathFor(t)??``;if(e&&n===``)return s(`attachment.pathUnavailable`);if(n===``||!e&&hd(t.type)){c.push(t);continue}let r=$u(n,u),i=Zu({path:e?`${r}/`:r,kind:`file`},!1);if(i===void 0)return s(`attachment.pathUnsupported`);let d=Qu(n)||t.name;l.push({source:`reference`,ref:i,label:e?`${d}/`:d,appearance:e?`folder`:`file`,clipboardText:i})}try{let e=r.createDrafts(t,c);return i.addFiles(l,e.map(e=>e.id))?null:(r.releaseDraftAttachments(e),s(`attachment.dropBlocked`))}catch(e){return e instanceof Error?e.message:String(e)}},removeAttachment:e=>{i.removeAttachment(e)&&r.releaseDraftAttachment(e)},resolveDraftAttachments:e=>r.resolveDraftAttachments(e),retryFileUpload:e=>{n.binding(t)!==void 0&&r.retryFileUpload(t,e)},revealResponseAnnotation:e=>{let r=n.scope(t);r?.emit(r,`conversation/reveal-response-annotation`,e)},toggleCommandMenu:a===void 0?void 0:e=>{i.dismissPopup();let t=i.snapshot;a.toggleSource(`command`,{trigger:`/`,query:``,quoted:!1,position:t.draft.slice(0,e.start).trim()===``?`leading`:`inline`,span:{...e,draftRev:t.draftRev}})},stop:()=>{ee(t)},hooks:{pendingDraftText:hj,stopShortcut:te,busyEnter:l.busyEnter,fileUploads:r.fileUploads,notices:i.notices,lexicon:i.lexicon,menuLauncher:a?.launcher??uj}}}},KA);e.inject([`conversation`],e=>e.slots.inject(`main`,function*(){yield r.register({name:`main`,key:`conversation`,children:{"main.conversation":{kind:`single`,scope:`session-maybe`}}},lA),yield ae(),yield oe(),yield se(),yield ce(),yield le(),yield ue()})),e.plugin(md,{input:re,blocks:ie,maxConcurrentFileUploads:i}),e.plugin(tj),e.plugin(kk,re)}return n.Config=aj,n.ConversationController=md,n.ConversationDefinitionRegistry=ht,n.ConversationEventRegistry=gt,n.ConversationLocationIndex=$e,n.ConversationNodeAssembler=ft,n.ConversationViewRegistry=Nt,n.EMPTY_CONVERSATION_SNAPSHOT=Pk,n.UiConversation=zt,n.apply=yj,n.conversationPhase=Fk,n.inject=ij,n.inspectRequestPrompt=Pe,t.exports}});
179
+ n.options.id!==void 0&&(e.configForms.developerTools.enabled.getSnapshot()||n.options.id!==`trajectory`)&&t.push({id:n.options.id,label:(0,p.resolveSlotLabel)(n.options.label)??n.options.id});return t},m=(e,t)=>{let n=mA(u(),t);n!==void 0&&o.binding(e).activate(n.id)},h=e=>{m(e,Xu(e))},g=(0,f.createSnapshotStore)(u()),_=/* @__PURE__ */ new Set,v=/* @__PURE__ */ new WeakSet,y=e=>{v.has(e)||(v.add(e),_.add(e),e.ctx.effect(()=>()=>{_.delete(e)},`ui-conversation: active Provider binding`))},b=()=>{let e=g.getSnapshot(),t=u();e.length===t.length&&e.every((e,n)=>{let r=t.at(n);return r!==void 0&&e.id===r.id&&e.label===r.label})||g.set(t);for(let e of _)n.binding(e.sessionId)===e&&h(e.sessionId)};e.effect(()=>{let t=r.subscribe(`conversation.view`,b),n=e.locale.subscribe(b),i=e.configForms.developerTools.enabled.subscribe(b);return()=>{i(),n(),t()}},`ui-conversation: View selection`);let ee=e=>{yj(n,e).cancel().catch(e=>{})},te=(0,f.createSnapshotStore)([]);e.inject([`shortcuts`],t=>{let r=[{id:`fixed.send`,label:()=>s(`input.send`),keys:[`Enter`],bindings:[{code:`Enter`,modifiers:[]}],group:`input`},{id:`fixed.newline`,label:()=>s(`shortcut.newline`),keys:t.shortcuts.describeBinding({code:`Enter`,modifiers:[`shift`]}).keys,bindings:[{code:`Enter`,modifiers:[`shift`]}],group:`input`},{id:`fixed.complementary`,label:()=>s(`shortcut.complementary`),keys:t.shortcuts.describeBinding({code:`Enter`,modifiers:[`primary`]}).keys,bindings:[{code:`Enter`,modifiers:[`control`]},{code:`Enter`,modifiers:[`meta`]}],group:`input`},{id:`fixed.slash`,label:()=>s(`shortcut.slash`),keys:[`/`],bindings:[{code:`Slash`,modifiers:[]}],group:`input`},{id:`fixed.mention`,label:()=>s(`shortcut.mention`),keys:[`@`],bindings:[{code:`Digit2`,modifiers:[`shift`]}],group:`input`}];for(let e of r)t.effect(()=>t.shortcuts.registerFixed(e),`ui-conversation: ${e.id}`);t.effect(()=>aj(t.shortcuts,n,e=>o.binding(e).openTurn,e.uiSession,ee),`ui-conversation: fixed stop input`),t.effect(()=>{let e={id:`response.stop`,label:()=>s(`input.stop`),keys:[`Esc`,`Esc`],bindings:[{code:`Escape`,modifiers:[]}],group:`input`},n=t.shortcuts.registerFixed(e);return te.set(e.keys),()=>{te.set([]),n()}},`ui-conversation: fixed stop reference`)});let ne=new ck;e.effect(()=>{let e=a.creating;e!==void 0&&ne.syncCreation(e.getSnapshot());let t=e?.subscribe(()=>{ne.syncCreation(e.getSnapshot())});return()=>{t?.(),ne.dispose()}},`ui-conversation: pending new-session draft`);let re=new ok(e,s,ne),ie=new _d;e.inject([`commandUi`],e=>{let t=e.get(`commandUi`);e.effect(()=>t.register({name:`file`,label:()=>s(`input.file`),icon:d.IconPaperclipOutlineRegular,available:e=>re.canPickFiles(e.sessionId),ui:{kind:`action`,run:e=>{re.pickFiles(e.sessionId)}}}),`ui-conversation: File action`)}),e.uiSession.provide({hooks:[`conversation`,`input`],props:[`inputActions`],resolve:e=>{y(e);let t=re.shellFor(e),n=o.binding(e);return h(e.sessionId),{hooks:{conversation:n.snapshot,input:t.state},props:{inputActions:t.actions}}}});let ae=()=>r.register({name:`main.conversation`,children:{"conversation.header":{kind:`single`,scope:`session-maybe`},"conversation.header.notice":{kind:`list`,scope:`session-maybe`}}},qk),oe=()=>r.registerFactory({name:`conversation.content`,scope:`session-maybe`,locale:ed,children:{"conversation.session":{kind:`single`,scope:`session`},"conversation.composer":{kind:`chain`,scope:`session`},"conversation.composer.bar":{kind:`single`,scope:`session-maybe`},"conversation.input.dock":{kind:`list`,scope:`session`},"conversation.hero.brand.mark":{kind:`single`,scope:`root`},"conversation.hero.workspace":{kind:`single`,scope:`root`},"conversation.hero.agentPreset":{kind:`single`,scope:`session-maybe`}},slots:{views:{scope:`session`},widthControls:{scope:`root`}},inject:t=>({referenceEditor:t===void 0?void 0:re.shell(t).editor,retrySessionCreation:()=>{a.retryCreating?.()},hooks:{composerBlock:t===void 0?lj:ie.storeFor(t),sessionCreation:a.creating??gj},selectWorkspace:r=>a.openWorkspace(r,r=>{if(t!==void 0&&r!==t){let i=re.shell(t),a=i.draftSnapshot,o=i.snapshot.attachmentIds,s=re.shell(r);if(o.length===0||s.addAttachments(o)){if(n.binding(r)===void 0)throw Error(`ui-conversation: session "${r}" resolved no binding`);if(bj(e).rebindDraftFiles(r,o),a.text!==``&&(s.setDraft(a),i.setDraft(``)),o.length>0)for(let e of o)i.removeAttachment(e)}}})})},uA),se=()=>r.register({name:`conversation.session`,children:{"conversation.view":{kind:`list`,scope:`session`}},store:c,inject:(e,t)=>{let r=(n,r)=>{u().some(e=>e.id===n)&&(m(e,n),t.openView(n,r))},i=()=>o.views.entries().find(e=>e.toolCallFocus!==void 0&&g.getSnapshot().some(t=>t.id===e.target)),a=e=>{let t=i();t?.toolCallFocus!==void 0&&r(t.target,t.toolCallFocus(e))};return{hooks:{conversationViews:g,inspectCall:{getSnapshot:()=>i()===void 0?void 0:a,subscribe:e=>{let t=g.subscribe(e),n=o.views.subscribe(e);return()=>{t(),n()}}}},bindDraftPersistence:t=>re.shell(e).bindDraftPersistence(t),onRevealResponseAnnotation:t=>n.scope(e)?.on(`conversation/reveal-response-annotation`,t)??(()=>{}),openView:r}}},yA),ce=()=>r.register({name:`conversation.header`,children:{"conversation.header.leading":{kind:`single`,scope:`root`},"conversation.header.navigation":{kind:`single`,scope:`session-maybe`},"conversation.header.shortcuts":{kind:`single`,scope:`session-maybe`},"conversation.header.trailing":{kind:`single`,scope:`root`},"conversation.session.header":{kind:`single`,scope:`session`}}},pA),le=()=>r.register({name:`conversation.session.header`,locale:ed,children:{"conversation.session.header.lineage":{kind:`single`,scope:`session`},"conversation.session.header.actions":{kind:`list`,scope:`session`},"conversation.session.header.utilities":{kind:`list`,scope:`session`},"conversation.session.header.corner":{kind:`single`,scope:`session`}},store:c,inject:(e,t)=>({hooks:{conversationViews:g},open:e=>{a.openSession(e)},selectView:n=>{m(e,n),t.setView(n)}})},vA),ue=()=>r.register({name:`conversation.composer.bar`,locale:ed,children:{"conversation.input.attachments":{kind:`single`,scope:`session-maybe`},"conversation.input.overlay":{kind:`list`,scope:`session`},"conversation.input.notice":{kind:`list`,scope:`session`},"conversation.input.permission":{kind:`single`,scope:`session`},"conversation.input.left":{kind:`list`,scope:`session`},"conversation.input.plan":{kind:`single`,scope:`session`},"conversation.input.right":{kind:`list`,scope:`session`},"conversation.input.model":{kind:`single`,scope:`session`},"conversation.input.activity":{kind:`single`,scope:`session`},"conversation.composer.dock":{kind:`list`,scope:`session`}},inject:t=>{if(t===void 0)return{keyboard:void 0,pendingDraft:{editor:ne.editor,paste:e=>{ne.paste(e)}},addFiles:void 0,removeAttachment:void 0,resolveDraftAttachments:void 0,retryFileUpload:void 0,revealResponseAnnotation:void 0,toggleCommandMenu:void 0,stop:void 0,hooks:{pendingDraftText:ne.text,stopShortcut:te,busyEnter:l.busyEnter,fileUploads:mj,notices:cj,lexicon:dj,menuLauncher:fj}};let r=bj(e),i=re.shell(t),a=re.inputTriggers(t),o=vj();return{keyboard:i,pendingDraft:void 0,addFiles:(e,a=/* @__PURE__ */ new Set)=>{if(n.binding(t)===void 0)return s(`file.sessionUnavailable`);if(i.snapshot.phase===`adjudicating`||i.snapshot.phase===`submitting`)return s(`attachment.dropBlocked`);let c=[],l=[],u=n.list.getSnapshot().byId[t]?.cwd;for(let t of e){let e=a.has(t);if(o===void 0&&e)return s(`attachment.directoryDesktopOnly`);let n=o?.pathFor(t)??``;if(e&&n===``)return s(`attachment.pathUnavailable`);if(n===``||!e&&hd(t.type)){c.push(t);continue}let r=$u(n,u),i=Zu({path:e?`${r}/`:r,kind:`file`},!1);if(i===void 0)return s(`attachment.pathUnsupported`);let d=Qu(n)||t.name;l.push({source:`reference`,ref:i,label:e?`${d}/`:d,appearance:e?`folder`:`file`,clipboardText:i})}try{let e=r.createDrafts(t,c);return i.addFiles(l,e.map(e=>e.id))?null:(r.releaseDraftAttachments(e),s(`attachment.dropBlocked`))}catch(e){return e instanceof Error?e.message:String(e)}},removeAttachment:e=>{i.removeAttachment(e)&&r.releaseDraftAttachment(e)},resolveDraftAttachments:e=>r.resolveDraftAttachments(e),retryFileUpload:e=>{n.binding(t)!==void 0&&r.retryFileUpload(t,e)},revealResponseAnnotation:e=>{let r=n.scope(t);r?.emit(r,`conversation/reveal-response-annotation`,e)},toggleCommandMenu:a===void 0?void 0:e=>{i.dismissPopup();let t=i.snapshot;a.toggleSource(`command`,{trigger:`/`,query:``,quoted:!1,position:t.draft.slice(0,e.start).trim()===``?`leading`:`inline`,span:{...e,draftRev:t.draftRev}})},stop:()=>{ee(t)},hooks:{pendingDraftText:_j,stopShortcut:te,busyEnter:l.busyEnter,fileUploads:r.fileUploads,notices:i.notices,lexicon:i.lexicon,menuLauncher:a?.launcher??fj}}}},JA);e.inject([`conversation`],e=>e.slots.inject(`main`,function*(){yield r.register({name:`main`,key:`conversation`,children:{"main.conversation":{kind:`single`,scope:`session-maybe`}}},dA),yield ae(),yield oe(),yield se(),yield ce(),yield le(),yield ue()})),e.plugin(md,{input:re,blocks:ie,maxConcurrentFileUploads:i}),e.plugin(rj),e.plugin(jk,re)}return n.Config=sj,n.ConversationController=md,n.ConversationDefinitionRegistry=ht,n.ConversationEventRegistry=gt,n.ConversationLocationIndex=$e,n.ConversationNodeAssembler=ft,n.ConversationViewRegistry=Nt,n.EMPTY_CONVERSATION_SNAPSHOT=Ik,n.UiConversation=zt,n.apply=xj,n.conversationPhase=Lk,n.inject=oj,n.inspectRequestPrompt=Pe,t.exports}});