@codexhost/cli-darwin-arm64 0.18.0-beta.1 → 0.18.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +103 -93
- package/app/console-web.js +104 -94
- package/app/desktop-controller.mjs +103 -109
- package/app/host-runtime.mjs +10067 -8374
- package/app/plugins/antigravity/plugin.mjs +103 -93
- package/app/plugins/claude-code/plugin.mjs +103 -93
- package/app/plugins/codebuddy/plugin.mjs +103 -93
- package/app/plugins/codex-usage/plugin.mjs +103 -93
- package/app/plugins/copilot/plugin.mjs +103 -93
- package/app/plugins/cursor-cli/plugin.mjs +103 -93
- package/app/plugins/deepseek-harness/plugin.mjs +103 -93
- package/app/plugins/devin/plugin.mjs +103 -93
- package/app/plugins/enabled.json +0 -1
- package/app/plugins/grok/plugin.mjs +103 -93
- package/app/plugins/hermes/plugin.mjs +103 -93
- package/app/plugins/kimi-code/plugin.mjs +103 -93
- package/app/plugins/kiro-cli/plugin.mjs +103 -93
- package/app/plugins/omp/plugin.mjs +103 -93
- package/app/plugins/opencode/plugin.mjs +103 -93
- package/app/plugins/pi/plugin.mjs +103 -93
- package/app/plugins/qoder/plugin.mjs +103 -93
- package/app/plugins/qoder-cn/plugin.mjs +103 -93
- package/app/plugins/qwen-code/plugin.mjs +103 -93
- package/app/plugins/workbuddy/plugin.mjs +103 -93
- package/app/plugins/zcode/plugin.mjs +103 -93
- package/app/renderer-extension.js +122 -149
- package/app/web/assets/index-C3lniEH1.css +1 -0
- package/app/web/assets/index-aKvkfNJN.js +199 -0
- package/app/web/codexhost-settings.js +104 -94
- package/app/web/index.html +2 -2
- package/app/web/plugins/deepseek-ai__dsh-api-gateway/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +64 -64
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +63 -62
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +85 -85
- package/app/web/plugins/deepseek-ai__dsh-client-ui-directory-picker-browse/client.js +10 -10
- package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +3 -3
- package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-permission-presets/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-right/client.js +55 -55
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +8 -8
- package/app/web/sw.js +55 -24
- package/app/web-modules/server.mjs +1091 -680
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
- package/app/plugins/codex-cli/manifest.json +0 -16
- package/app/plugins/codex-cli/plugin.mjs +0 -20374
- package/app/web/assets/index-CIeTchMu.css +0 -1
- package/app/web/assets/index-DeAPBQbV.js +0 -199
- /package/app/{plugins/codex-cli/assets/icon.png → web/codex.png} +0 -0
|
@@ -10,7 +10,7 @@ default:ke(this.#r)}}fail(){this.#d=this.#n,this.#r=`invalid`,this.#c=null}begin
|
|
|
10
10
|
/* v8 ignore next 2 -- closed update union; TypeScript rejects other operation tags. */
|
|
11
11
|
default:ke(e.groups)}return{upserts:t,removes:n}}},Be=class{store;key;listeners=/* @__PURE__ */ new Set;published;constructor(e,t){this.store=e,this.key=t,this.published=e.get(t)}getSnapshot=()=>this.store.get(this.key);subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});publish(){let e=this.getSnapshot();this.published!==e&&(this.published=e,(0,f.notifySubscribers)(this.listeners,`[ui-conversation] Location data ${this.key}`))}},Ve=class{markDirty;entries=/* @__PURE__ */ new Map;sources=/* @__PURE__ */ new Map;dirtyKeys=/* @__PURE__ */ new Set;constructor(e){this.markDirty=e}get(e){return this.entries.get(e)?.value}source(e){let t=this.sources.get(e);return t===void 0&&(t=new Be(this,e),this.sources.set(e,t)),t}remove(e,t){return this.entries.get(t)?.owner===e&&(this.entries.delete(t),this.changed(t),!0)}set(e,t,n){let r=this.entries.get(t);if(r!==void 0&&r.owner!==e)throw Error(`conversation Location data "${t}" is already owned by ${r.owner}`);return r?.value!==n&&(this.entries.set(t,{owner:e,value:n}),this.changed(t),!0)}replace(e){let t=[];for(let n of/* @__PURE__ */ new Set([...this.entries.keys(),...e.keys()])){let r=this.entries.get(n),i=e.get(n);(r?.owner!==i?.owner||r?.value!==i?.value)&&t.push(n)}if(t.length===0)return!1;this.entries=new Map(e);for(let e of t)this.changed(e);return!0}publish(){let e=[...this.dirtyKeys];this.dirtyKeys.clear();for(let t of e)this.sources.get(t)?.publish()}changed(e){this.dirtyKeys.add(e),this.markDirty(this)}};let He={kind:`session`},Ue={kind:`unresolved`};function We(e){let t=e.data;if(t.turn===null)return{session:!0,location:void 0};let n=Number.isSafeInteger(t.turn)&&t.turn>=0?t.turn:void 0,r=Number.isSafeInteger(t.step)&&t.step>=0?t.step:void 0;return n===void 0?r===void 0?{location:void 0}:{step:r,location:void 0}:r===void 0?{turn:n,location:void 0}:{turn:n,step:r,location:void 0}}function Ge(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Ke(e,t){return e!==void 0&&e.start===t.start&&e.end===t.end&&e.status===t.status&&e.data===t.data}function qe(e,t){return e!==void 0&&e.start===t.start&&e.end===t.end&&e.status===t.status&&e.data===t.data&&Ge(e.steps,t.steps)}function Je(e,t){return e===void 0||t===void 0||e.kind!==t.kind?e===t:e.kind===`session`||e.kind===`unresolved`?!0:t.kind===`session`||t.kind===`unresolved`?!1:e.kind===`turn`||t.kind===`turn`?e.kind===`turn`&&t.kind===`turn`&&e.turn===t.turn:e.turn===t.turn&&e.step===t.step}var Ye=class{coordinates=/* @__PURE__ */ new Map;seqsByTurn=/* @__PURE__ */ new Map;stepsByTurn=/* @__PURE__ */ new Map;timeline={turnOrder:[],turns:/* @__PURE__ */ new Map};turnDataStores=/* @__PURE__ */ new Map;stepDataStores=/* @__PURE__ */ new Map;dirtyDataStores=/* @__PURE__ */ new Set;changedTurns=/* @__PURE__ */ new Set;currentTurn;currentStep;snapshot(){return this.timeline}takeChangedTurns(){let e=[...this.changedTurns];return this.changedTurns.clear(),e}replaceData(e){let t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Map;for(let{owner:r,data:i}of e){let e=i.kind===`turn`?t.get(i.turn)??/* @__PURE__ */ new Map:n.get(Xe(i.turn,Ze(i)))??/* @__PURE__ */ new Map,a=e.get(i.key);if(a!==void 0&&a.owner!==r)throw Error(`conversation Location data "${i.key}" is already owned by ${a.owner}`);e.set(i.key,{owner:r,value:i.value}),i.kind===`turn`?t.set(i.turn,e):n.set(Xe(i.turn,Ze(i)),e)}let r=!1;for(let e of/* @__PURE__ */ new Set([...this.turnDataStores.keys(),...t.keys()]))r=this.mutableTurnData(e).replace(t.get(e)??/* @__PURE__ */ new Map)||r;for(let e of/* @__PURE__ */ new Set([...this.stepDataStores.keys(),...n.keys()]))r=this.mutableStepData(e).replace(n.get(e)??/* @__PURE__ */ new Map)||r;return r}applyData(e){let t=!1;for(let n of e){let e=n.previous;e!==null&&(t=this.storeFor(e).remove(n.owner,e.key)||t)}for(let n of e){let e=n.next;e!==null&&(t=this.storeFor(e).set(n.owner,e.key,e.value)||t)}return t}publishData(){let e=[...this.dirtyDataStores];this.dirtyDataStores.clear();for(let t of e)t.publish()}locationOf(e){return this.coordinates.get(e.seq)?.location??He}rebuild(e){let t=this.coordinates,n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map,i,a,o=(e,t)=>{let r=n.get(e);return r===void 0?(r={turn:e,firstSeq:t,steps:/* @__PURE__ */ new Map},n.set(e,r)):r.firstSeq=Math.min(r.firstSeq,t),r},s=(e,t,n)=>{let r=o(e,n),i=r.steps.get(t);return i===void 0?(i={turn:e,step:t,firstSeq:n},r.steps.set(t,i)):i.firstSeq=Math.min(i.firstSeq,n),i};for(let{event:t}of e){let e=We(t);t.type===`turn/start`&&(i=t.data.turn,a=void 0),t.type===`step/start`&&(i=t.data.turn,a=t.data.step),e.session!==!0&&e.turn!==void 0&&(i!==e.turn&&(a=void 0),i=e.turn,e.step!==void 0&&(a=e.step));let n=e.session===!0?void 0:e.turn??i,c=e.session===!0||t.type===`turn/start`||t.type===`turn/end`?void 0:e.step??(n===i?a:void 0);r.set(t.seq,{...n===void 0?{}:{turn:n},...n===void 0||c===void 0?{}:{step:c},location:void 0}),n!==void 0&&o(n,t.seq),n!==void 0&&c!==void 0&&s(n,c,t.seq),t.type===`turn/start`?o(t.data.turn,t.seq).start=t:t.type===`turn/end`?o(t.data.turn,t.seq).end=t:t.type===`step/start`?s(t.data.turn,t.data.step,t.seq).start=t:t.type===`step/end`&&(s(t.data.turn,t.data.step,t.seq).end=t),t.type===`step/end`&&i===t.data.turn&&a===t.data.step&&(a=void 0),t.type===`turn/end`&&i===t.data.turn&&(i=void 0,a=void 0)}let c=this.timeline.turns,l=/* @__PURE__ */ new Map,u=[...n.values()].sort((e,t)=>e.firstSeq-t.firstSeq);for(let e of u){let t=c.get(e.turn),n=new Map(t?.steps.map(e=>[e.step,e])??[]),r=[...e.steps.values()].sort((e,t)=>e.firstSeq-t.firstSeq).map(e=>{let t={turn:e.turn,step:e.step,start:e.start,end:e.end,status:e.end===void 0?e.start===void 0?`unknown`:`open`:`closed`,data:this.stepData(e.turn,e.step)},r=n.get(e.step);return Ke(r,t)?r:t}),i={turn:e.turn,start:e.start,end:e.end,status:e.end===void 0?e.start===void 0?`unknown`:`open`:`closed`,steps:r,data:this.turnData(e.turn)};l.set(e.turn,qe(t,i)?t:i)}let d=u.map(e=>e.turn),f=this.timeline.turnOrder.length===d.length&&this.timeline.turnOrder.every((e,t)=>e===d[t])?this.timeline.turnOrder:d,p=c.size===l.size;if(p){for(let[e,t]of l)if(c.get(e)!==t){p=!1;break}}for(let e of/* @__PURE__ */ new Set([...c.keys(),...l.keys()]))c.get(e)!==l.get(e)&&this.changedTurns.add(e);this.timeline=p&&f===this.timeline.turnOrder?this.timeline:{turnOrder:f,turns:l},this.stepsByTurn.clear();for(let[e,t]of this.timeline.turns)this.stepsByTurn.set(e,new Map(t.steps.map(e=>[e.step,e])));this.coordinates=r,this.seqsByTurn=/* @__PURE__ */ new Map;for(let{event:t}of e){let e=this.coordinates.get(t.seq);e.turn!==void 0&&this.indexTurnSeq(e.turn,t.seq),e.location=this.resolve(t.seq)}this.currentTurn=i,this.currentStep=a;let m=/* @__PURE__ */ new Set;for(let{event:n}of e)Je(t.get(n.seq)?.location,this.coordinates.get(n.seq)?.location)||m.add(n.seq);return m}appendBoundary(e){if(e.type!==`turn/start`&&e.type!==`turn/end`&&e.type!==`step/start`&&e.type!==`step/end`)throw Error(`conversation Location boundary expected, received ${e.type}`);let t=We(e);e.type===`turn/start`?(this.currentTurn=e.data.turn,this.currentStep=void 0):e.type===`step/start`&&(this.currentTurn=e.data.turn,this.currentStep=e.data.step),t.turn!==void 0&&(this.currentTurn!==t.turn&&(this.currentStep=void 0),this.currentTurn=t.turn,t.step!==void 0&&(this.currentStep=t.step));let n=t.turn??this.currentTurn;if(n===void 0)throw Error(`conversation boundary ${e.type} has no turn`);let r=e.type===`turn/start`||e.type===`turn/end`?void 0:t.step??(n===this.currentTurn?this.currentStep:void 0);this.coordinates.set(e.seq,{turn:n,...r===void 0?{}:{step:r},location:this.coordinates.get(e.seq)?.location}),this.indexTurnSeq(n,e.seq);let i=this.timeline.turns.get(n),a=i?.steps??[];if(e.type===`step/start`||e.type===`step/end`){let t=e.data.step,r=this.stepsByTurn.get(n)??/* @__PURE__ */ new Map,i=r.get(t),o={turn:n,step:t,start:e.type===`step/start`?e:i?.start,end:e.type===`step/end`?e:i?.end,status:e.type===`step/end`||i?.end!==void 0?`closed`:`open`,data:this.stepData(n,t)},s=Ke(i,o)?i:o;r.set(t,s),this.stepsByTurn.set(n,r);let c=a.findIndex(e=>e.step===t);a=c<0?[...a,s]:a.map((e,t)=>t===c?s:e)}let o={turn:n,start:e.type===`turn/start`?e:i?.start,end:e.type===`turn/end`?e:i?.end,status:e.type===`turn/end`||i?.end!==void 0?`closed`:e.type===`turn/start`||i?.start!==void 0?`open`:`unknown`,steps:a,data:this.turnData(n)},s=qe(i,o)?i:o,c=new Map(this.timeline.turns);c.set(n,s);let l=i===void 0?[...this.timeline.turnOrder,n]:this.timeline.turnOrder;this.timeline={turnOrder:l,turns:c},s!==i&&this.changedTurns.add(n);let u=/* @__PURE__ */ new Set;for(let e of this.seqsByTurn.get(n)??[]){let t=this.coordinates.get(e),n=t.location,r=this.resolve(e);t.location=r,Je(n,r)||u.add(e)}return e.type===`step/end`&&this.currentTurn===e.data.turn&&this.currentStep===e.data.step&&(this.currentStep=void 0),e.type===`turn/end`&&this.currentTurn===e.data.turn&&(this.currentTurn=void 0,this.currentStep=void 0),u}appendNonBoundary(e){let t=We(e);if(t.session===!0){this.coordinates.set(e.seq,{location:He});return}t.turn!==void 0&&(this.currentTurn!==t.turn&&(this.currentStep=void 0),this.currentTurn=t.turn,t.step!==void 0&&(this.currentStep=t.step));let n=t.turn??this.currentTurn,r=t.step??(n===this.currentTurn?this.currentStep:void 0),i=t.turn!==void 0&&t.step!==void 0?t:{...n===void 0?{}:{turn:n},...n===void 0||r===void 0?{}:{step:r},location:void 0};this.coordinates.set(e.seq,i),n!==void 0&&this.indexTurnSeq(n,e.seq),i.location=this.resolve(e.seq)}removeAssistantTransients(e){for(let t of e){let e=this.coordinates.get(t.seq)?.turn;if(e!==void 0){let n=this.seqsByTurn.get(e);n?.delete(t.seq),n?.size===0&&this.seqsByTurn.delete(e)}this.coordinates.delete(t.seq)}}insertAssistantSettlement(e){let t={turn:e.data.turn,step:e.data.step,location:void 0};this.coordinates.set(e.seq,t),this.indexTurnSeq(e.data.turn,e.seq),t.location=this.resolve(e.seq)}indexTurnSeq(e,t){let n=this.seqsByTurn.get(e);n===void 0&&(n=/* @__PURE__ */ new Set,this.seqsByTurn.set(e,n)),n.add(t)}turnData(e){return this.mutableTurnData(e)}stepData(e,t){return this.mutableStepData(Xe(e,t))}mutableTurnData(e){let t=this.turnDataStores.get(e)??this.createDataStore(e);return this.turnDataStores.set(e,t),t}mutableStepData(e){let t=this.stepDataStores.get(e)??this.createDataStore(Number(e.slice(0,e.indexOf(`:`))));return this.stepDataStores.set(e,t),t}createDataStore(e){return new Ve(t=>{this.dirtyDataStores.add(t),this.changedTurns.add(e)})}storeFor(e){return e.kind===`turn`?this.mutableTurnData(e.turn):this.mutableStepData(Xe(e.turn,Ze(e)))}resolve(e){let t=this.coordinates.get(e);if(t?.turn===void 0)return He;let n=this.timeline.turns.get(t.turn);if(n===void 0)return Ue;if(t.step===void 0)return{kind:`turn`,turn:n};let r=this.stepsByTurn.get(t.turn)?.get(t.step);return r===void 0?{kind:`turn`,turn:n}:{kind:`step`,turn:n,step:r}}};function Xe(e,t){return`${e}:${t}`}function Ze(e){if(e.kind===`step`&&e.step!==void 0)return e.step;throw Error(`conversation Step data "${e.key}" requires a step`)}let Qe={none:0,"animation-frame":1,immediate:2},$e=[`step`,`turn`];function et(){return{step:null,turn:null}}function tt(e,t){return Qe[e]>=Qe[t]?e:t}function nt(e){return e.startSeq}function rt(e,t){let n=0,r=e.length;for(;n<r;){let i=n+Math.floor((r-n)/2),a=e[i];a!==void 0&&a.startSeq<t?n=i+1:r=i}return n}function it(e){return{key:e.key,kind:e.kind,id:e.id,matches:e.matches,start:e.start,state:e.state,current:e.current}}function at(e,t,n){let r=[],i=0,a=0;for(;i<t.length||a<n.length;){let o=t[i],s=n[a];if(o!==void 0&&s!==void 0&&o.event.seq===s.event.seq)throw Error(`conversation Context ${e} received duplicate Match ${o.event.seq}`);s===void 0||o!==void 0&&o.event.seq<s.event.seq?(r.push(o),i++):(r.push(s),a++)}return r}function ot(e,t,n){return{event:e.event,role:t,location:n}}let st={entries:()=>[],forTarget:()=>void 0};var ct=class{eventDefinitions;viewDefinitions;groupDefinitions;contexts=/* @__PURE__ */ new Map;contextsByKind=/* @__PURE__ */ new Map;contextsBySeq=/* @__PURE__ */ new Map;contextsByTarget=/* @__PURE__ */ new Map;inputs=/* @__PURE__ */ new Map;locationIndex=new Ye;dirty=/* @__PURE__ */ new Set;dirtyByTarget=/* @__PURE__ */ new Map;revised=/* @__PURE__ */ new Set;dependents=/* @__PURE__ */ new Map;views=/* @__PURE__ */ new Map;groups=/* @__PURE__ */ new Map;pendingGroupStores=/* @__PURE__ */ new Set;activeTargets=/* @__PURE__ */ new Set;hasMore=!1;replacePending=!0;timelineDirty=!0;constructor(e,t,n=st){this.eventDefinitions=e,this.viewDefinitions=t,this.groupDefinitions=n,this.resetViewBuilders()}openTurn(){let e=this.locationIndex.snapshot(),t=e.turnOrder.at(-1),n=t===void 0?void 0:e.turns.get(t);return n?.status===`open`&&n.start!==void 0?n.turn:void 0}replaceWindow(e,t){this.contexts.clear(),this.contextsByKind.clear(),this.contextsBySeq.clear(),this.contextsByTarget.clear(),this.inputs.clear(),this.dirty.clear(),this.dirtyByTarget.clear(),this.revised.clear(),this.dependents.clear(),this.hasMore=t;let n=[...e].sort((e,t)=>e.event.seq-t.event.seq);for(let e of n)this.inputs.set(e.event.seq,e);this.locationIndex.rebuild(n),this.timelineDirty=!0;for(let e of n)this.matchInput(e);this.replayDependencies(),this.revised.clear();for(let e of this.contexts.values())this.markDirty(e);return this.replacePending=!0,`immediate`}append(e){let t=e.event;if(this.inputs.has(t.seq))return`none`;this.revised.size>0&&this.revised.clear(),this.inputs.set(t.seq,e);let n=`none`;if(t.type!==`assistant/live-chunk`&<(t.type)){let e=this.locationIndex.snapshot(),r=this.locationIndex.appendBoundary(t);this.locationIndex.snapshot()!==e&&(this.timelineDirty=!0,n=`immediate`),this.replayContexts(this.refreshMatchLocations(r)),r.size>0&&(n=`immediate`)}else this.locationIndex.appendNonBoundary(t);return n=tt(n,this.matchInput(e)),this.replayRevisedDependents()&&(n=`immediate`),this.revised.size>0&&this.revised.clear(),n}settleAssistant(e,t){this.revised.clear();let n=[...this.inputs.values()].filter(t=>t.type===`transient`&&t.event.data.attemptId===e),r=new Set(n.map(e=>e.event.seq)),i=/* @__PURE__ */ new Set;for(let e of r){this.inputs.delete(e);for(let t of this.contextsBySeq.get(e)??[])i.add(t);this.contextsBySeq.delete(e)}for(let e of i)e.matches=e.matches.filter(e=>!r.has(e.event.seq));this.locationIndex.removeAssistantTransients(n.map(e=>e.event));let a=n.length===0?`none`:`immediate`;if(t!==void 0&&!this.inputs.has(t.event.seq)){this.inputs.set(t.event.seq,t),this.locationIndex.insertAssistantSettlement(t.event);let e=/* @__PURE__ */ new Map;a=tt(a,this.collectInput(t,e)),this.applyPendingMatches(e,i)}return this.replayContexts(i),this.replayRevisedDependents()&&(a=`immediate`),this.revised.clear(),a}prepend(e,t){this.revised.clear();let n=`none`,r=this.hasMore,i=e.filter(e=>!this.inputs.has(e.event.seq)).sort((e,t)=>e.event.seq-t.event.seq);for(let e of i)this.inputs.set(e.event.seq,e);this.hasMore=t;let a=this.locationIndex.snapshot(),o=this.locationIndex.rebuild(this.sortedInputs());this.locationIndex.snapshot()!==a&&(this.timelineDirty=!0);let s=this.refreshMatchLocations(o),c=/* @__PURE__ */ new Map;for(let e of i)n=tt(n,this.collectInput(e,c));return this.applyPendingMatches(c,s),this.replayContexts(s),(this.revised.size>0||r!==t)&&this.replayDependencies()&&(n=`immediate`),o.size>0&&(n=`immediate`),this.revised.clear(),n}rebuildRegistry(){return this.resetViewBuilders(),this.replaceWindow(this.sortedInputs(),this.hasMore)}flush(){if(!this.replacePending&&this.dirty.size===0&&!this.timelineDirty)return!1;if(this.replacePending){this.replaceLocationData();let e=[],t=this.locationIndex.takeChangedTurns();for(let n of this.activeTargets){let r=this.views.get(n);r!==void 0&&(this.updateView(r,!0,this.buildTargetNodes(n,this.contextsByTarget.get(n)),t),e.push(r))}return this.replacePending=!1,this.dirty.clear(),this.dirtyByTarget.clear(),this.timelineDirty=!1,this.publishViews(e)}let e=[];this.applyDirtyLocationData()&&(this.timelineDirty=!0);let t=this.locationIndex.takeChangedTurns(),n=this.timelineDirty;for(let r of this.activeTargets){let i=this.views.get(r);if(i===void 0||i.builder===void 0)continue;let a=this.buildTargetUpserts(r,this.dirtyByTarget.get(r));(a.length!==0||n)&&(this.updateView(i,!1,a,t),e.push(i))}return this.dirty.clear(),this.dirtyByTarget.clear(),this.timelineDirty=!1,this.publishViews(e)}activateTarget(e){let t=this.views.get(e);if(this.activeTargets.has(e))return!1;let n=this.flush();return this.activeTargets.add(e),t===void 0?n:(this.replaceView(t),this.publishViews([t]),!0)}snapshot(e){return this.views.get(e)?.snapshot}get(e){return this.snapshot(e)}grouped(e){return this.groups.get(e)?.store}activityTargets(){let e=/* @__PURE__ */ new Set;for(let t of this.activeTargets){let n=this.views.get(t);n!==void 0&&n.isActive?.(n.snapshot)===!0&&e.add(n.target)}return e}sortedInputs(){return[...this.inputs.values()].sort((e,t)=>e.event.seq-t.event.seq)}matchInput(e){return this.dispatchInput(e,this.acceptMatch)}collectInput(e,t){return this.dispatchInput(e,(e,n,r)=>{let i=Fe(e.kind,n),a=t.get(i)??[];return a.push({definition:e,id:n,match:r}),t.set(i,a),e.publication?.(r)??`immediate`})}dispatchInput(e,t){let n=e.event,r,i,a,o=t=>(a??=this.locationIndex.locationOf(n),t===`start`?r??=ot(e,t,a):i??=ot(e,t,a)),s,c,l,u=`none`,d=this.eventDefinitions.forEvent?.(n.type);if(d===void 0)for(let e of this.eventDefinitions.entries()){let r=e.match(n);r!==null&&(e.target!==void 0&&e.target!==s&&e.target!==c&&(s===void 0?s=e.target:c===void 0?c=e.target:(l??=/* @__PURE__ */ new Set).add(e.target)),u=tt(u,t.call(this,e,r.id,o(r.role))))}else for(let{definition:e,match:r}of d){let i=r(n);i!==null&&(e.target!==void 0&&e.target!==s&&e.target!==c&&(s===void 0?s=e.target:c===void 0?c=e.target:(l??=/* @__PURE__ */ new Set).add(e.target)),u=tt(u,t.call(this,e,i.id,o(i.role))))}let f=this.eventDefinitions.fallbackEntry(),p=f?.target;if(f!==void 0&&p!==void 0&&p!==s&&p!==c&&l?.has(p)!==!0){let e=f.match(n);e!==null&&(u=tt(u,t.call(this,f,e.id,o(e.role))))}return u}createContext(e,t,n){let r={key:n,kind:e.kind,id:t,definition:e,startSeq:void 0,start:void 0,matches:[],state:void 0,revision:0,current:/* @__PURE__ */ new Map,locationData:et(),dependencies:/* @__PURE__ */ new Map};return this.contexts.set(n,r),this.indexTargetContext(r),r}acceptMatch(e,t,n){let r=this.contextsByKind.get(e.kind)?.at(-1),i=r?.id===t?r.key:Fe(e.kind,t),a=this.contexts.get(i);a??=this.createContext(e,t,i);let o=n.role===`start`&&a.start===void 0,s=a.matches.at(-1);if(s!==void 0&&s.event.seq>=n.event.seq)throw Error(`conversation Context ${i} received non-appended Match ${n.event.seq}`);if(o&&a.matches.length>0)throw Error(`conversation Context ${i} received an update before its start Match`);a.matches.push(n),o&&(a.startSeq=n.event.seq,a.start=n,this.indexStartedContext(a));let c=this.contextsBySeq.get(n.event.seq);if(c===void 0&&(c=[],this.contextsBySeq.set(n.event.seq,c)),c.push(a),o)this.replayContext(a);else if(a.state!==void 0){let t=it(a);a.state=ut(e,`update`,e.update(t,n)),a.revision++,this.revised.add(a)}return this.markDirty(a),e.publication?.(n)??`immediate`}applyPendingMatches(e,t){for(let[n,r]of e){let e=r[0];if(e===void 0)continue;let i=this.contexts.get(n);i??=this.createContext(e.definition,e.id,n);let a=r.map(e=>{if(e.definition!==i.definition||e.id!==i.id)throw Error(`conversation Context ${n} received inconsistent Definition identity`);let t=this.contextsBySeq.get(e.match.event.seq);return t===void 0&&(t=[],this.contextsBySeq.set(e.match.event.seq,t)),t.push(i),e.match}).sort((e,t)=>e.event.seq-t.event.seq);i.matches=at(i.key,a,i.matches),t.add(i),this.markDirty(i)}}replayContexts(e){this.refreshStarts(e);let t=[...e].sort((e,t)=>(e.startSeq??1/0)-(t.startSeq??1/0));for(let e of t)e.start===void 0?(e.state=void 0,this.replaceDependencies(e,/* @__PURE__ */ new Map),e.revision++,this.revised.add(e),this.markDirty(e)):this.replayContext(e)}refreshStarts(e){let t=/* @__PURE__ */ new Set,n=/* @__PURE__ */ new Map;for(let r of e){let e=r.matches.find(e=>e.role===`start`);if(e===r.start)continue;r.start=e,r.startSeq=e?.event.seq,t.add(r);let i=n.get(r.kind)??[];e!==void 0&&i.push(r),n.set(r.kind,i)}for(let[e,r]of n){let n=this.contextsByKind.get(e)??[];this.contextsByKind.set(e,n.filter(e=>!t.has(e))),this.indexStartedContexts(e,r)}}replayContext(e){let t=e.start;if(t===void 0){e.state=void 0;return}if(e.matches[0]!==t)throw Error(`conversation Context ${e.key} received an update before its start Match`);let n=/* @__PURE__ */ new Map,r=this.readerFor(t.event.seq,n);e.state=void 0,e.state=ut(e.definition,`start`,e.definition.start(it(e),t,r)),this.replaceDependencies(e,n);for(let t=1;t<e.matches.length;t++){let n=e.matches[t];if(n===void 0)continue;let r=it(e);e.state=ut(e.definition,`update`,e.definition.update(r,n))}e.revision++,this.revised.add(e),this.markDirty(e)}indexTargetContext(e){let t=e.definition.target;if(t===void 0)return;let n=this.contextsByTarget.get(t)??/* @__PURE__ */ new Set;n.add(e),this.contextsByTarget.set(t,n)}markDirty(e){if(this.dirty.has(e))return;this.dirty.add(e);let t=e.definition.target;if(t===void 0||!this.activeTargets.has(t))return;let n=this.dirtyByTarget.get(t);n===void 0&&(n=/* @__PURE__ */ new Set,this.dirtyByTarget.set(t,n)),n.add(e)}replaceDependencies(e,t){for(let t of e.dependencies.values()){if(t.key===void 0)continue;let n=this.dependents.get(t.key);n?.delete(e),n?.size===0&&this.dependents.delete(t.key)}e.dependencies=t;for(let n of t.values()){if(n.key===void 0)continue;let t=this.dependents.get(n.key)??/* @__PURE__ */ new Set;t.add(e),this.dependents.set(n.key,t)}}replayRevisedDependents(){if(this.dependents.size===0)return!1;let e=[...this.revised],t=/* @__PURE__ */ new Set;for(let n=0;n<e.length;n++){let r=e[n];if(r!==void 0)for(let n of this.dependents.get(r.key)??[])t.has(n)||(t.add(n),e.push(n))}return t.size>0&&this.replayContexts(t),t.size>0}readerFor(e,t){return{previous:n=>{let r=this.previousContext(n,e);if(t.set(n,{kind:n,key:r?.key,revision:r?.revision,windowGap:r===void 0&&this.hasMore}),r?.state===void 0)return;let i=nt(r);if(i!==void 0)return{key:r.key,kind:r.kind,id:r.id,startSeq:i,state:r.state,matches:r.matches}}}}previousContext(e,t){let n=this.contextsByKind.get(e)??[],r=rt(n,t);for(let e=r-1;e>=0;e--){let t=n[e];if(t?.state!==void 0)return t}}indexStartedContext(e){let t=e.startSeq;if(t===void 0)return;let n=this.contextsByKind.get(e.kind)??[],r=n.at(-1);r===void 0||r.startSeq<t?n.push(e):n.splice(rt(n,t),0,e),this.contextsByKind.set(e.kind,n)}indexStartedContexts(e,t){if(t.length===0)return;let n=[...t].sort((e,t)=>e.startSeq-t.startSeq),r=this.contextsByKind.get(e)??[],i=[],a=0,o=0;for(;a<r.length||o<n.length;){let e=r[a],t=n[o];t===void 0||e!==void 0&&e.startSeq<t.startSeq?(i.push(e),a++):(i.push(t),o++)}this.contextsByKind.set(e,i)}replayDependencies(){let e=!1,t=[...this.contexts.values()].filter(e=>nt(e)!==void 0).sort((e,t)=>nt(e)-nt(t));for(let n of t){if(n.state===void 0||n.dependencies.size===0)continue;let t=nt(n);if(t===void 0)continue;let r=!1;for(let e of n.dependencies.values()){let n=this.previousContext(e.kind,t),i=n===void 0&&this.hasMore;if(n?.key!==e.key||n?.revision!==e.revision||i!==e.windowGap){r=!0;break}}r&&(this.replayContext(n),e=!0)}return e}refreshMatchLocations(e){let t=/* @__PURE__ */ new Set;if(e.size===0)return t;for(let n of e)for(let e of this.contextsBySeq.get(n)??[])t.add(e);for(let n of t){let t=n.start;n.matches=n.matches.map(n=>{if(!e.has(n.event.seq))return n;if(n.role===`start`){let e={...n,location:this.locationIndex.locationOf(n.event)};return n===t&&(t=e),e}return{...n,location:this.locationIndex.locationOf(n.event)}}),n.start=t}return t}buildNode(e,t){if(e.definition.target!==t||e.definition.buildViewNode===void 0)return null;let n=e.definition.buildViewNode(it(e));if(n===null)return null;if(n.key!==e.key)throw Error(`conversation Definition "${e.kind}" returned unstable key "${n.key}"; expected "${e.key}"`);if(n.target!==t)throw Error(`conversation Definition "${e.kind}" returned target "${n.target}" while building "${t}"`);return n}replaceView(e){this.updateView(e,!0,this.buildTargetNodes(e.target,this.contextsByTarget.get(e.target)),[])}updateView(e,t,n,r){let i=e.builder??e.definition.create(),a=e.groupDefinition;if(a!==void 0&&i.groupInput===void 0)throw Error(`conversation group target "${e.target}" requires builder.groupInput()`);e.builder=i;let o=this.locationIndex.snapshot(),s=t?i.replace({nodes:n,timeline:o,changedTurns:r}):i.apply({upserts:n,timeline:o,changedTurns:r});if(a!==void 0&&i.groupInput!==void 0){let t=this.groups.get(e.target),n=t===void 0;t===void 0&&(t={definition:a,state:a.create(),store:new ze});let r=i.groupInput();t.state=a.update(t,r);let o=a.buildGroups(t);if((n||r.kind===`replace`)&&(o===null||o.entries===void 0||o.groups.kind!==`replace`))throw Error(`conversation group target "${e.target}" requires complete grouping for replacement input`);o!==null&&(t.store.prepareAndInstall(o,r.readNode),this.pendingGroupStores.add(t.store)),this.groups.set(e.target,t)}e.snapshot=s}publishViews(e){let t=e.length>0||this.pendingGroupStores.size>0,n=[...this.pendingGroupStores];this.pendingGroupStores.clear();for(let t of e)t.builder?.publish?.();for(let e of n)e.publish();return this.locationIndex.publishData(),t}buildTargetNodes(e,t){let n=[];for(let r of t??[]){let t=this.buildNode(r,e);r.current.set(e,t),t!==null&&n.push(t)}return n}buildTargetUpserts(e,t){let n=[];for(let r of t??[]){let t=r.current.get(e)??null,i=this.buildNode(r,e);if(i===null&&t!==null)throw Error(`conversation Definition "${r.kind}" withdrew materialized target "${e}"; return the same key with hidden visibility instead`);r.current.set(e,i),i!==null&&n.push(i)}return n}buildLocationData(e,t,n){if(e.definition.buildLocationData===void 0)return null;let r=e.definition.buildLocationData(it(e),t,n);if(r===null)return null;if(r.kind!==t)throw Error(`conversation Definition "${e.kind}" published ${r.kind} data through its ${t} scope`);if(r.key!==e.kind)throw Error(`conversation Definition "${e.kind}" published Location data key "${r.key}"; expected its owned kind`);if(!Number.isSafeInteger(r.turn)||r.turn<0)throw Error(`conversation Definition "${e.kind}" published invalid turn ${r.turn}`);if(r.kind===`step`&&(!Number.isSafeInteger(r.step)||r.step<0))throw Error(`conversation Definition "${e.kind}" published invalid step ${String(r.step)}`);return r}replaceLocationData(){let e=[];for(let t of $e){for(let n of this.contexts.values()){let r=this.buildLocationData(n,t,n.locationData[t]);n.locationData[t]=r,r!==null&&e.push({owner:n.key,data:r})}this.locationIndex.replaceData(e)}}applyDirtyLocationData(){let e=!1;for(let t of $e){let n=[];for(let e of this.dirty){let r=e.locationData[t],i=this.buildLocationData(e,t,r);r!==i&&(e.locationData[t]=i,n.push({owner:e.key,previous:r,next:i}))}e=this.locationIndex.applyData(n)||e}return e}resetViewBuilders(){let e=this.viewDefinitions.entries(),t=new Set(e.map(e=>e.target));for(let[e,n]of this.groups)(!t.has(e)||this.groupDefinitions.forTarget(e)!==n.definition)&&(n.store.clear(),this.pendingGroupStores.add(n.store),this.groups.delete(e));this.views.clear();for(let t of e){let e={target:t.target,definition:t,groupDefinition:this.groupDefinitions.forTarget(t.target),isActive:t.isActive===void 0?void 0:e=>t.isActive?.(e)===!0,builder:void 0,snapshot:void 0};this.views.set(t.target,e)}this.replacePending=!0}};function lt(e){return e===`turn/start`||e===`turn/end`||e===`step/start`||e===`step/end`}function ut(e,t,n){if(n===void 0)throw Error(`conversation Definition "${e.kind}" returned undefined from ${t}()`);return n}var dt=class{ctx;definitions=/* @__PURE__ */ new Map;listeners=/* @__PURE__ */ new Set;cached=[];constructor(e){this.ctx=e,Object.defineProperty(this,m.Service.tracker,{value:{property:`ctx`}})}entries(){return this.cached}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}registerDefinition(e,t,n,r){if(this.definitions.has(e))throw Error(n);let i=this.ctx.effect(()=>(this.definitions.set(e,t),this.refresh(),()=>{this.definitions.get(e)===t&&(this.definitions.delete(e),this.refresh())}),r);return()=>{i()}}refresh(){this.cached=[...this.definitions.values()],(0,f.notifySubscribers)(this.listeners,`[ui-conversation] definition registry`)}},ft=class extends dt{fallback;routes=/* @__PURE__ */ new Map;unrestricted=/* @__PURE__ */ new Set;tables=/* @__PURE__ */ new WeakMap;register(e){return pt(e),this.registerDefinition(e.kind,this.resolve(e),`conversation Definition "${e.kind}" is already registered`,`uiConversation.events.register(${JSON.stringify(e.kind)})`)}registerFallback(e){if(pt(e),e.target===void 0)throw Error(`conversation fallback Definition must declare a target`);if(this.fallback!==void 0)throw Error(`conversation fallback Definition is already registered`);let t=this.resolve(e),n=this.ctx.effect(()=>(this.fallback=t,this.refresh(),()=>{this.fallback===t&&(this.fallback=void 0,this.refresh())}),`uiConversation.events.registerFallback(${JSON.stringify(t.kind)})`);return()=>{n()}}fallbackEntry(){return this.fallback}forEvent(e){return this.routes.get(e)??this.unrestricted}resolve(e){if(typeof e.match==`function`)return e;let t=new Map(Object.entries(e.match)),n={...e,match:e=>t.get(e.type)?.call(n,e)??null};return this.tables.set(n,t),n}refresh(){let e=/* @__PURE__ */ new Map,t=/* @__PURE__ */ new Set;for(let n of this.definitions.values()){let r=this.tables.get(n);if(r===void 0){let r={definition:n,match:n.match.bind(n)};t.add(r);for(let t of e.values())t.add(r)}else for(let[i,a]of r){let r=e.get(i);r===void 0&&(r=new Set(t),e.set(i,r)),r.add({definition:n,match:a.bind(n)})}}this.routes=e,this.unrestricted=t,super.refresh()}};function pt(e){if(e.target===void 0!=(e.buildViewNode===void 0))throw Error(`conversation Definition "${e.kind}" must declare target and buildViewNode together`)}function mt(e){let t=``,n=32768;for(let r=0;r<e.length;r+=n)t+=String.fromCharCode(...e.subarray(r,r+n));return btoa(t)}function ht(){let e=globalThis.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16)),t=Array.from(e,(e,t)=>(t===6?e&15|64:t===8?e&63|128:e).toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}var gt=class{sessions;entries=new Ae;scopeDisposers=new Ae;urls=/* @__PURE__ */ new Set;disposed=!1;constructor(e,t){this.sessions=t,e.effect(()=>()=>{this.dispose()},`ui-conversation historical image cache`)}resolve(e,t){if(this.disposed)return Promise.reject(/* @__PURE__ */ Error(`ui-conversation image cache is disposed`));let n=this.sessions.binding(e);if(n===void 0)return Promise.reject(/* @__PURE__ */ Error(`ui-conversation: unknown session "${e}"`));let r=this.bindScope(n),i=t.attachmentId,a=r.get(i);if(a!==void 0)return a.pending;let o={binding:n,pending:Promise.resolve(``)};return r.set(i,o),o.pending=this.loadCanonical(i,o,t),o.pending}peek(e,t){let n=this.sessions.binding(e);return n===void 0?void 0:this.entries.get(n)?.get(t.attachmentId)?.current}seed(e,t,n){if(this.disposed)return!1;let r=this.sessions.binding(e);if(r===void 0)return!1;let i=this.bindScope(r),a=t.attachmentId;if(i.has(a))return!1;let o={binding:r,current:n,pending:Promise.resolve(n)};return this.urls.add(n),i.set(a,o),o.pending=this.loadCanonical(a,o,t).catch(e=>{throw i.get(a)===o&&o.current===n&&(i.delete(a),this.releaseUrl(n)),e}),o.pending.catch(()=>{}),!0}loadCanonical(e,t,n){return t.binding.session.readAttachment(n.attachmentId).then(n=>{if(!n.ok)throw Error(`${n.error.code}: ${n.error.message}`);this.assertLive(e,t);let r;if(typeof URL.createObjectURL!=`function`)r=`data:${n.value.attachment.mediaType};base64,${mt(n.value.data)}`;else{let e=Uint8Array.from(n.value.data);r=URL.createObjectURL(new Blob([e.buffer],{type:n.value.attachment.mediaType}))}this.assertLive(e,t),this.urls.add(r);let i=t.current;return t.current=r,i!==void 0&&i!==r&&this.releaseUrl(i),r}).catch(n=>{let r=this.entries.get(t.binding);throw r?.get(e)===t&&t.current===void 0&&r.delete(e),n})}assertLive(e,t){if(this.disposed)throw Error(`ui-conversation image cache was disposed before loading completed`);if(this.entries.get(t.binding)?.get(e)!==t)throw Error(`ui-conversation image scope was released before loading completed`)}bindScope(e){let t=this.entries.get(e);if(t!==void 0)return t;let n=/* @__PURE__ */ new Map;this.entries.set(e,n);let r=e.ctx.effect(()=>()=>{this.scopeDisposers.delete(e),this.release(e,n)},`ui-conversation historical image scope`);return this.scopeDisposers.set(e,()=>{r()}),n}release(e,t){this.entries.get(e)===t&&this.entries.delete(e);for(let e of t.values())e.current!==void 0&&this.releaseUrl(e.current);t.clear()}releaseUrl(e){this.urls.delete(e)&&_t(e)}dispose(){if(!this.disposed){this.disposed=!0;for(let e of[...this.scopeDisposers.values])e();this.scopeDisposers.clear();for(let e of this.urls)_t(e);this.urls.clear();for(let e of this.entries.values)e.clear();this.entries.clear()}}};function _t(e){e.startsWith(`blob:`)&&URL.revokeObjectURL(e)}var vt=class extends dt{register(e){return this.registerDefinition(e.target,e,`conversation view target "${e.target}" is already registered`,`uiConversation.views.register(${JSON.stringify(e.target)})`)}},yt=class extends dt{views;constructor(e,t){super(e),this.views=t}register(e){if(!this.views.entries().some(t=>t.target===e.target))throw Error(`conversation group target "${e.target}" is not registered`);return this.registerDefinition(e.target,e,`conversation group target "${e.target}" is already registered`,`uiConversation.groups.register(${JSON.stringify(e.target)})`)}forTarget(e){return this.definitions.get(e)}},bt=class{assembler;snapshot;openTurn;viewStore;targetSources=/* @__PURE__ */ new Map;revision=-1;frame;disposeFeed=()=>{};constructor(e,t){this.assembler=t,this.viewStore=t,this.snapshot=(0,f.createSnapshotStore)(this.currentSnapshot()),this.openTurn=(0,f.createSnapshotStore)(t.openTurn()),this.replace(e.getSnapshot()),this.disposeFeed=e.subscribe(()=>{this.accept(e.getSnapshot())})}target(e){let t=this.targetSources.get(e);if(t===void 0){let n=this.viewStore;t={getSnapshot:()=>n.get(e),subscribe:t=>{let n=this.snapshot.subscribe(t);return this.activate(e),n}},this.targetSources.set(e,t)}return t}activate(e){this.assembler.activateTarget(e)&&this.snapshot.set(this.currentSnapshot()),this.openTurn.set(this.assembler.openTurn())}rebuild(){this.publish(this.assembler.rebuildRegistry())}dispose(){this.cancelFrame(),this.disposeFeed()}replace(e){this.revision=e.revision,this.publish(this.assembler.replaceWindow(e.entries,e.hasMore))}accept(e){if(e.revision!==this.revision){if(e.revision!==this.revision+1||e.change.kind===`replace`)this.replace(e);else switch(this.revision=e.revision,e.change.kind){case`prepend`:this.publish(this.assembler.prepend(e.change.entries,e.hasMore));return;case`append`:{let t=`none`;for(let n of e.change.entries){let e=this.assembler.append(n);(e===`immediate`||t===`none`)&&(t=e)}this.publish(t);return}case`settle-assistant`:this.publish(this.assembler.settleAssistant(e.change.attemptId,e.change.entry));return}}}publish(e){if(e!==`none`){if(e===`animation-frame`&&typeof requestAnimationFrame==`function`){if(this.frame!==void 0)return;this.frame=requestAnimationFrame(()=>{this.frame=requestAnimationFrame(()=>{this.frame=requestAnimationFrame(()=>{this.frame=void 0,this.flush()})})})}else this.cancelFrame(),this.flush()}}cancelFrame(){this.frame!==void 0&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(this.frame),this.frame=void 0}flush(){this.assembler.flush()&&this.snapshot.set(this.currentSnapshot()),this.openTurn.set(this.assembler.openTurn())}currentSnapshot(){return{views:this.viewStore,activeTargets:this.assembler.activityTargets()}}},xt=class extends m.Service{sessions;events;views;groups;bindings=new Ae;images;constructor(e,t){super(e,`uiConversation`),this.sessions=t,this.events=new ft(e),this.views=new vt(e),this.groups=new yt(e,this.views),this.images=new gt(e,t);let n=()=>{for(let e of this.bindings.values)e.binding.rebuild()},r=!1,i=()=>{r||(r=!0,queueMicrotask(()=>{r=!1,n()}))};e.effect(()=>{let e=this.events.subscribe(i),t=this.views.subscribe(i),n=this.groups.subscribe(i);return()=>{n(),t(),e();for(let e of[...this.bindings.values])this.drop(e,!0)}},`ui-conversation assembly`)}binding(e){let t=typeof e==`string`?e:e.sessionId,n=typeof e==`string`?this.sessions.binding(e):e;if(n===void 0)throw Error(`uiConversation.binding: unknown session "${t}"`);if(this.sessions.binding(t)!==n)throw Error(`uiConversation.binding: inactive session "${t}"`);let r=this.bindings.get(n);if(r!==void 0)return r.binding;let i=new bt(n.eventSource,new ct(this.events,this.views,this.groups)),a={source:n,binding:i,disposeScope:()=>{}};this.bindings.set(n,a);let o=n.ctx.effect(()=>()=>{this.drop(a,!1)},`ui-conversation binding`);return a.disposeScope=()=>{o()},i}imageUrl(e,t){return this.images.resolve(e,t)}peekImageUrl(e,t){return this.images.peek(e,t)}seedImageUrl(e,t,n){return this.images.seed(e,t,n)}inspectSystemPrompt(e,t){return Pe(e,t)}inspectRequestPrompt(e,t,n){return je(e,t,n)}drop(e,t){this.bindings.get(e.source)===e&&(this.bindings.delete(e.source),e.binding.dispose(),t&&e.disposeScope())}},St;function E(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:/* @__PURE__ */ new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var Ct=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},wt=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(St=globalThis).__zod_globalConfig??(St.__zod_globalConfig={});let Tt=globalThis.__zod_globalConfig;function Et(e){return e&&Object.assign(Tt,e),Tt}function Dt(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Ot(e,t){return typeof t==`bigint`?t.toString():t}function kt(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function At(e){return e==null}function jt(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Mt(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}let Nt=/* @__PURE__*/ Symbol(`evaluating`);function D(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Nt)return r===void 0&&(r=Nt,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Pt(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ft(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function It(e){return JSON.stringify(e)}function Lt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}let Rt=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function zt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let Bt=/* @__PURE__*/ kt(()=>{if(Tt.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Vt(e){if(zt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return zt(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Ht(e){return Vt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}let Ut=/* @__PURE__*/ new Set([`string`,`number`,`symbol`]);function Wt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Gt(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function O(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Kt(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}let qt={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Jt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return Gt(e,Ft(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Pt(this,`shape`,e),e},checks:[]}))}function Yt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return Gt(e,Ft(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Pt(this,`shape`,r),r},checks:[]}))}function Xt(e,t){if(!Vt(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Gt(e,Ft(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Pt(this,`shape`,n),n}}))}function Zt(e,t){if(!Vt(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Gt(e,Ft(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Pt(this,`shape`,n),n}}))}function Qt(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Gt(e,Ft(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Pt(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function $t(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return Gt(t,Ft(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Pt(this,`shape`,i),i},checks:[]}))}function en(e,t,n){return Gt(t,Ft(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Pt(this,`shape`,i),i}}))}function tn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function nn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function rn(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function an(e){return typeof e==`string`?e:e?.message}function on(e,t,n){let r=e.message?e.message:an(e.inst?._zod.def?.error?.(e))??an(t?.error?.(e))??an(n.customError?.(e))??an(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function sn(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function cn(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}let ln=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ot,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},un=E(`$ZodError`,ln),dn=E(`$ZodError`,ln,{Parent:Error});function fn(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function pn(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}let mn=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Ct;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>on(e,a,Et())));throw Rt(t,i?.callee),t}return o.value},hn=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>on(e,a,Et())));throw Rt(t,i?.callee),t}return o.value},gn=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Ct;return a.issues.length?{success:!1,error:new(e??un)(a.issues.map(e=>on(e,i,Et())))}:{success:!0,data:a.value}},_n=/* @__PURE__*/ gn(dn),vn=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>on(e,i,Et())))}:{success:!0,data:a.value}},yn=/* @__PURE__*/ vn(dn),bn=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return mn(e)(t,n,i)},xn=e=>(t,n,r)=>mn(e)(t,n,r),Sn=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return hn(e)(t,n,i)},Cn=e=>async(t,n,r)=>hn(e)(t,n,r),wn=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return gn(e)(t,n,i)},Tn=e=>(t,n,r)=>gn(e)(t,n,r),En=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return vn(e)(t,n,i)},Dn=e=>async(t,n,r)=>vn(e)(t,n,r),On=/^[cC][0-9a-z]{6,}$/,kn=/^[0-9a-z]+$/,An=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,jn=/^[0-9a-vA-V]{20}$/,Mn=/^[A-Za-z0-9]{27}$/,Nn=/^[a-zA-Z0-9_-]{21}$/,Pn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Fn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,In=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ln=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Rn(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}let zn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Bn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Vn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Hn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Un=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Wn=/^[A-Za-z0-9_-]*$/,Gn=/^https?$/,Kn=/^\+[1-9]\d{6,14}$/,qn=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Jn=/*@__PURE__*/ RegExp(`^${qn}$`);function Yn(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Xn(e){return RegExp(`^${Yn(e)}$`)}function Zn(e){let t=Yn({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${qn}T(?:${r})$`)}let Qn=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},$n=/^-?\d+$/,er=/^-?\d+(?:\.\d+)?$/,tr=/^(?:true|false)$/i,nr=/^[^A-Z]*$/,rr=/^[^a-z]*$/,ir=/*@__PURE__*/ E(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ar={number:`number`,bigint:`bigint`,object:`date`},or=/*@__PURE__*/ E(`$ZodCheckLessThan`,(e,t)=>{ir.init(e,t);let n=ar[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),sr=/*@__PURE__*/ E(`$ZodCheckGreaterThan`,(e,t)=>{ir.init(e,t);let n=ar[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),cr=/*@__PURE__*/ E(`$ZodCheckMultipleOf`,(e,t)=>{ir.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Mt(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),lr=/*@__PURE__*/ E(`$ZodCheckNumberFormat`,(e,t)=>{ir.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=qt[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=$n)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),ur=/*@__PURE__*/ E(`$ZodCheckMaxLength`,(e,t)=>{var n;ir.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!At(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=sn(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),dr=/*@__PURE__*/ E(`$ZodCheckMinLength`,(e,t)=>{var n;ir.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!At(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=sn(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),fr=/*@__PURE__*/ E(`$ZodCheckLengthEquals`,(e,t)=>{var n;ir.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!At(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=sn(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),pr=/*@__PURE__*/ E(`$ZodCheckStringFormat`,(e,t)=>{var n,r;ir.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=/* @__PURE__ */ new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),mr=/*@__PURE__*/ E(`$ZodCheckRegex`,(e,t)=>{pr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),hr=/*@__PURE__*/ E(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=nr,pr.init(e,t)}),gr=/*@__PURE__*/ E(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=rr,pr.init(e,t)}),_r=/*@__PURE__*/ E(`$ZodCheckIncludes`,(e,t)=>{ir.init(e,t);let n=Wt(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=/* @__PURE__ */ new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),vr=/*@__PURE__*/ E(`$ZodCheckStartsWith`,(e,t)=>{ir.init(e,t);let n=RegExp(`^${Wt(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=/* @__PURE__ */ new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),yr=/*@__PURE__*/ E(`$ZodCheckEndsWith`,(e,t)=>{ir.init(e,t);let n=RegExp(`.*${Wt(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=/* @__PURE__ */ new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),br=/*@__PURE__*/ E(`$ZodCheckOverwrite`,(e,t)=>{ir.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var xr=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
12
12
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
13
|
-
`))}};let Sr={major:4,minor:4,patch:3},
|
|
13
|
+
`))}};let Sr={major:4,minor:4,patch:3},Cr=/*@__PURE__*/ E(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Sr;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=tn(e),i;for(let a of t){if(a._zod.def.when){if(nn(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Ct;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=tn(e,t))});else{if(e.issues.length===t)continue;r||=tn(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(tn(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Ct;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Ct;return o.then(e=>t(e,r,a))}return t(o,r,a)}}D(e,`~standard`,()=>({validate:t=>{try{let n=_n(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return yn(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),wr=/*@__PURE__*/ E(`$ZodString`,(e,t)=>{Cr.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Qn(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),k=/*@__PURE__*/ E(`$ZodStringFormat`,(e,t)=>{pr.init(e,t),wr.init(e,t)}),Tr=/*@__PURE__*/ E(`$ZodGUID`,(e,t)=>{t.pattern??=Fn,k.init(e,t)}),Er=/*@__PURE__*/ E(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=In(e)}else t.pattern??=In();k.init(e,t)}),Dr=/*@__PURE__*/ E(`$ZodEmail`,(e,t)=>{t.pattern??=Ln,k.init(e,t)}),Or=/*@__PURE__*/ E(`$ZodURL`,(e,t)=>{k.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===Gn.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),n.value=t.normalize?i.href:r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),kr=/*@__PURE__*/ E(`$ZodEmoji`,(e,t)=>{t.pattern??=Rn(),k.init(e,t)}),Ar=/*@__PURE__*/ E(`$ZodNanoID`,(e,t)=>{t.pattern??=Nn,k.init(e,t)}),jr=/*@__PURE__*/ E(`$ZodCUID`,(e,t)=>{t.pattern??=On,k.init(e,t)}),Mr=/*@__PURE__*/ E(`$ZodCUID2`,(e,t)=>{t.pattern??=kn,k.init(e,t)}),Nr=/*@__PURE__*/ E(`$ZodULID`,(e,t)=>{t.pattern??=An,k.init(e,t)}),Pr=/*@__PURE__*/ E(`$ZodXID`,(e,t)=>{t.pattern??=jn,k.init(e,t)}),Fr=/*@__PURE__*/ E(`$ZodKSUID`,(e,t)=>{t.pattern??=Mn,k.init(e,t)}),Ir=/*@__PURE__*/ E(`$ZodISODateTime`,(e,t)=>{t.pattern??=Zn(t),k.init(e,t)}),Lr=/*@__PURE__*/ E(`$ZodISODate`,(e,t)=>{t.pattern??=Jn,k.init(e,t)}),Rr=/*@__PURE__*/ E(`$ZodISOTime`,(e,t)=>{t.pattern??=Xn(t),k.init(e,t)}),zr=/*@__PURE__*/ E(`$ZodISODuration`,(e,t)=>{t.pattern??=Pn,k.init(e,t)}),Br=/*@__PURE__*/ E(`$ZodIPv4`,(e,t)=>{t.pattern??=zn,k.init(e,t),e._zod.bag.format=`ipv4`}),Vr=/*@__PURE__*/ E(`$ZodIPv6`,(e,t)=>{t.pattern??=Bn,k.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Hr=/*@__PURE__*/ E(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Vn,k.init(e,t)}),Ur=/*@__PURE__*/ E(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Hn,k.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Wr(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let Gr=/*@__PURE__*/ E(`$ZodBase64`,(e,t)=>{t.pattern??=Un,k.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Wr(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Kr(e){if(!Wn.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Wr(t.padEnd(Math.ceil(t.length/4)*4,`=`))}let qr=/*@__PURE__*/ E(`$ZodBase64URL`,(e,t)=>{t.pattern??=Wn,k.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Kr(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Jr=/*@__PURE__*/ E(`$ZodE164`,(e,t)=>{t.pattern??=Kn,k.init(e,t)});function Yr(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}let Xr=/*@__PURE__*/ E(`$ZodJWT`,(e,t)=>{k.init(e,t),e._zod.check=n=>{Yr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Zr=/*@__PURE__*/ E(`$ZodNumber`,(e,t)=>{Cr.init(e,t),e._zod.pattern=e._zod.bag.pattern??er,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Qr=/*@__PURE__*/ E(`$ZodNumberFormat`,(e,t)=>{lr.init(e,t),Zr.init(e,t)}),$r=/*@__PURE__*/ E(`$ZodBoolean`,(e,t)=>{Cr.init(e,t),e._zod.pattern=tr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),ei=/*@__PURE__*/ E(`$ZodUnknown`,(e,t)=>{Cr.init(e,t),e._zod.parse=e=>e}),ti=/*@__PURE__*/ E(`$ZodNever`,(e,t)=>{Cr.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function ni(e,t,n){e.issues.length&&t.issues.push(...rn(n,e.issues)),t.value[n]=e.value}let ri=/*@__PURE__*/ E(`$ZodArray`,(e,t)=>{Cr.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>ni(t,n,e))):ni(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function ii(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...rn(n,e.issues))}!o&&!i?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function ai(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Kt(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function oi(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>ii(e,n,i,t,u,d))):ii(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}let si=/*@__PURE__*/ E(`$ZodObject`,(e,t)=>{if(Cr.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=kt(()=>ai(t));D(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=/* @__PURE__ */ new Set);for(let e of r.values)n[t].add(e)}}return n});let r=zt,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>ii(n,t,e,s,r,i))):ii(a,t,e,s,r,i)}return i?oi(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),ci=/*@__PURE__*/ E(`$ZodObjectJIT`,(e,t)=>{si.init(e,t);let n=e._zod.parse,r=kt(()=>ai(t)),i=e=>{let t=new xr([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=It(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=It(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
|
|
14
14
|
if (${n}.issues.length) {
|
|
15
15
|
if (${o} in input) {
|
|
16
16
|
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
@@ -69,111 +69,111 @@ default:ke(e.groups)}return{upserts:t,removes:n}}},Be=class{store;key;listeners=
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=zt,s=!Tt.jitless,c=s&&Bt.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?
|
|
73
|
-
function
|
|
74
|
-
function
|
|
75
|
-
function
|
|
76
|
-
function
|
|
77
|
-
function
|
|
78
|
-
function
|
|
79
|
-
function
|
|
80
|
-
function
|
|
81
|
-
function
|
|
82
|
-
function
|
|
83
|
-
function
|
|
84
|
-
function
|
|
85
|
-
function
|
|
86
|
-
function
|
|
87
|
-
function
|
|
88
|
-
function
|
|
89
|
-
function
|
|
90
|
-
function
|
|
91
|
-
function
|
|
92
|
-
function
|
|
93
|
-
function
|
|
94
|
-
function
|
|
95
|
-
function
|
|
96
|
-
function
|
|
97
|
-
function
|
|
98
|
-
function
|
|
99
|
-
function
|
|
100
|
-
function
|
|
101
|
-
function
|
|
102
|
-
function
|
|
103
|
-
function
|
|
104
|
-
function
|
|
105
|
-
function
|
|
106
|
-
function
|
|
107
|
-
function
|
|
108
|
-
function
|
|
109
|
-
function
|
|
110
|
-
function
|
|
111
|
-
function
|
|
112
|
-
function
|
|
113
|
-
function
|
|
114
|
-
function
|
|
115
|
-
function
|
|
116
|
-
function
|
|
117
|
-
function
|
|
118
|
-
function
|
|
119
|
-
function
|
|
120
|
-
function
|
|
121
|
-
function
|
|
122
|
-
function
|
|
123
|
-
function
|
|
124
|
-
function
|
|
125
|
-
function
|
|
126
|
-
function
|
|
127
|
-
function
|
|
128
|
-
function
|
|
72
|
+
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=zt,s=!Tt.jitless,c=s&&Bt.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?oi([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function li(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!tn(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>on(e,r,Et())))}),t)}let ui=/*@__PURE__*/ E(`$ZodUnion`,(e,t)=>{Cr.init(e,t),D(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),D(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),D(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),D(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>jt(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>li(t,r,e,i)):li(o,r,e,i)}}),di=/*@__PURE__*/ E(`$ZodIntersection`,(e,t)=>{Cr.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>pi(e,t,n)):pi(e,i,a)}});function fi(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Vt(e)&&Vt(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=fi(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=fi(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function pi(e,t,n){let r=/* @__PURE__ */ new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),tn(e))return e;let o=fi(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}let mi=/*@__PURE__*/ E(`$ZodEnum`,(e,t)=>{Cr.init(e,t);let n=Dt(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Ut.has(typeof e)).map(e=>typeof e==`string`?Wt(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),hi=/*@__PURE__*/ E(`$ZodTransform`,(e,t)=>{Cr.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new wt(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new Ct;return n.value=i,n.fallback=!0,n}});function gi(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}let _i=/*@__PURE__*/ E(`$ZodOptional`,(e,t)=>{Cr.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,D(e._zod,`values`,()=>t.innerType._zod.values?/* @__PURE__ */ new Set([...t.innerType._zod.values,void 0]):void 0),D(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${jt(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>gi(e,r)):gi(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),vi=/*@__PURE__*/ E(`$ZodExactOptional`,(e,t)=>{_i.init(e,t),D(e._zod,`values`,()=>t.innerType._zod.values),D(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),yi=/*@__PURE__*/ E(`$ZodNullable`,(e,t)=>{Cr.init(e,t),D(e._zod,`optin`,()=>t.innerType._zod.optin),D(e._zod,`optout`,()=>t.innerType._zod.optout),D(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${jt(e.source)}|null)$`):void 0}),D(e._zod,`values`,()=>t.innerType._zod.values?/* @__PURE__ */ new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),bi=/*@__PURE__*/ E(`$ZodDefault`,(e,t)=>{Cr.init(e,t),e._zod.optin=`optional`,D(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>xi(e,t)):xi(r,t)}});function xi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}let Si=/*@__PURE__*/ E(`$ZodPrefault`,(e,t)=>{Cr.init(e,t),e._zod.optin=`optional`,D(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Ci=/*@__PURE__*/ E(`$ZodNonOptional`,(e,t)=>{Cr.init(e,t),D(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>wi(t,e)):wi(i,e)}});function wi(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}let Ti=/*@__PURE__*/ E(`$ZodCatch`,(e,t)=>{Cr.init(e,t),e._zod.optin=`optional`,D(e._zod,`optout`,()=>t.innerType._zod.optout),D(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>on(e,n,Et()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>on(e,n,Et()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Ei=/*@__PURE__*/ E(`$ZodPipe`,(e,t)=>{Cr.init(e,t),D(e._zod,`values`,()=>t.in._zod.values),D(e._zod,`optin`,()=>t.in._zod.optin),D(e._zod,`optout`,()=>t.out._zod.optout),D(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Di(e,t.in,n)):Di(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Di(e,t.out,n)):Di(r,t.out,n)}});function Di(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}let Oi=/*@__PURE__*/ E(`$ZodReadonly`,(e,t)=>{Cr.init(e,t),D(e._zod,`propValues`,()=>t.innerType._zod.propValues),D(e._zod,`values`,()=>t.innerType._zod.values),D(e._zod,`optin`,()=>t.innerType?._zod?.optin),D(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(ki):ki(r)}});function ki(e){return e.value=Object.freeze(e.value),e}let Ai=/*@__PURE__*/ E(`$ZodCustom`,(e,t)=>{ir.init(e,t),Cr.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>ji(t,n,r,e));ji(i,n,r,e)}});function ji(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(cn(e))}}var Mi,Ni=class{constructor(){this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Pi(){return new Ni}(Mi=globalThis).__zod_globalRegistry??(Mi.__zod_globalRegistry=Pi());let Fi=globalThis.__zod_globalRegistry;// @__NO_SIDE_EFFECTS__
|
|
73
|
+
function Ii(e,t){return new e({type:`string`,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
74
|
+
function Li(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
75
|
+
function Ri(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
76
|
+
function zi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
77
|
+
function Bi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
78
|
+
function Vi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
79
|
+
function Hi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
80
|
+
function Ui(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
81
|
+
function Wi(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
82
|
+
function Gi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
83
|
+
function Ki(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
84
|
+
function qi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
85
|
+
function Ji(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
86
|
+
function Yi(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
87
|
+
function Xi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
88
|
+
function Zi(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
89
|
+
function Qi(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
90
|
+
function $i(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
91
|
+
function ea(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
92
|
+
function ta(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
93
|
+
function na(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
94
|
+
function ra(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
95
|
+
function ia(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
96
|
+
function aa(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
97
|
+
function oa(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
98
|
+
function sa(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
99
|
+
function ca(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
100
|
+
function la(e,t){return new e({type:`number`,checks:[],...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
101
|
+
function ua(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
102
|
+
function da(e,t){return new e({type:`boolean`,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
103
|
+
function fa(e){return new e({type:`unknown`})}// @__NO_SIDE_EFFECTS__
|
|
104
|
+
function pa(e,t){return new e({type:`never`,...O(t)})}// @__NO_SIDE_EFFECTS__
|
|
105
|
+
function ma(e,t){return new or({check:`less_than`,...O(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
|
|
106
|
+
function ha(e,t){return new or({check:`less_than`,...O(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
|
|
107
|
+
function ga(e,t){return new sr({check:`greater_than`,...O(t),value:e,inclusive:!1})}// @__NO_SIDE_EFFECTS__
|
|
108
|
+
function _a(e,t){return new sr({check:`greater_than`,...O(t),value:e,inclusive:!0})}// @__NO_SIDE_EFFECTS__
|
|
109
|
+
function va(e,t){return new cr({check:`multiple_of`,...O(t),value:e})}// @__NO_SIDE_EFFECTS__
|
|
110
|
+
function ya(e,t){return new ur({check:`max_length`,...O(t),maximum:e})}// @__NO_SIDE_EFFECTS__
|
|
111
|
+
function ba(e,t){return new dr({check:`min_length`,...O(t),minimum:e})}// @__NO_SIDE_EFFECTS__
|
|
112
|
+
function xa(e,t){return new fr({check:`length_equals`,...O(t),length:e})}// @__NO_SIDE_EFFECTS__
|
|
113
|
+
function Sa(e,t){return new mr({check:`string_format`,format:`regex`,...O(t),pattern:e})}// @__NO_SIDE_EFFECTS__
|
|
114
|
+
function Ca(e){return new hr({check:`string_format`,format:`lowercase`,...O(e)})}// @__NO_SIDE_EFFECTS__
|
|
115
|
+
function wa(e){return new gr({check:`string_format`,format:`uppercase`,...O(e)})}// @__NO_SIDE_EFFECTS__
|
|
116
|
+
function Ta(e,t){return new _r({check:`string_format`,format:`includes`,...O(t),includes:e})}// @__NO_SIDE_EFFECTS__
|
|
117
|
+
function Ea(e,t){return new vr({check:`string_format`,format:`starts_with`,...O(t),prefix:e})}// @__NO_SIDE_EFFECTS__
|
|
118
|
+
function Da(e,t){return new yr({check:`string_format`,format:`ends_with`,...O(t),suffix:e})}// @__NO_SIDE_EFFECTS__
|
|
119
|
+
function Oa(e){return new br({check:`overwrite`,tx:e})}// @__NO_SIDE_EFFECTS__
|
|
120
|
+
function ka(e){return/* @__PURE__ */ Oa(t=>t.normalize(e))}// @__NO_SIDE_EFFECTS__
|
|
121
|
+
function Aa(){return/* @__PURE__ */ Oa(e=>e.trim())}// @__NO_SIDE_EFFECTS__
|
|
122
|
+
function ja(){return/* @__PURE__ */ Oa(e=>e.toLowerCase())}// @__NO_SIDE_EFFECTS__
|
|
123
|
+
function Ma(){return/* @__PURE__ */ Oa(e=>e.toUpperCase())}// @__NO_SIDE_EFFECTS__
|
|
124
|
+
function Na(){return/* @__PURE__ */ Oa(e=>Lt(e))}// @__NO_SIDE_EFFECTS__
|
|
125
|
+
function Pa(e,t,n){return new e({type:`array`,element:t,...O(n)})}// @__NO_SIDE_EFFECTS__
|
|
126
|
+
function Fa(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...O(n)})}// @__NO_SIDE_EFFECTS__
|
|
127
|
+
function Ia(e,t){let n=/* @__PURE__ */ La(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(cn(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(cn(r))}},e(t.value,t)),t);return n}// @__NO_SIDE_EFFECTS__
|
|
128
|
+
function La(e,t){let n=new ir({check:`custom`,...O(t)});return n._zod.check=e,n}function Ra(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Fi,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:/* @__PURE__ */ new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function za(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,za(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Ha(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Ba(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=/* @__PURE__ */ new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
129
129
|
|
|
130
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}}function Ba(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Ua(t,`input`,e.processors),output:Ua(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Va(e,t){let n=t??{seen:/* @__PURE__ */ new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Va(r.element,n);if(r.type===`set`)return Va(r.valueType,n);if(r.type===`lazy`)return Va(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return Va(r.innerType,n);if(r.type===`intersection`)return Va(r.left,n)||Va(r.right,n);if(r.type===`record`||r.type===`map`)return Va(r.keyType,n)||Va(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Va(r.in,n)||Va(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Va(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Va(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Va(e,n))return!0;return!!(r.rest&&Va(r.rest,n))}return!1}let Ha=(e,t={})=>n=>{let r=La({...n,processors:t});return Ra(e,r),za(r,e),Ba(r,e)},Ua=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=La({...i??{},target:a,io:t,processors:n});return Ra(e,o),za(o,e),Ba(o,e)},Wa={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Ga=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Wa[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Ka=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},qa=(e,t,n,r)=>{n.type=`boolean`},Ja=(e,t,n,r)=>{n.not={}},Ya=(e,t,n,r)=>{let i=e._zod.def,a=Dt(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Xa=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Za=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Qa=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Ra(a.element,t,{...r,path:[...r.path,`items`]})},$a=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Ra(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Ra(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},eo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Ra(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},to=(e,t,n,r)=>{let i=e._zod.def,a=Ra(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Ra(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},no=(e,t,n,r)=>{let i=e._zod.def,a=Ra(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},ro=(e,t,n,r)=>{let i=e._zod.def;Ra(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},io=(e,t,n,r)=>{let i=e._zod.def;Ra(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},ao=(e,t,n,r)=>{let i=e._zod.def;Ra(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},oo=(e,t,n,r)=>{let i=e._zod.def;Ra(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},so=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Ra(o,t,r);let s=t.seen.get(e);s.ref=o},co=(e,t,n,r)=>{let i=e._zod.def;Ra(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},lo=(e,t,n,r)=>{let i=e._zod.def;Ra(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},uo=/*@__PURE__*/ E(`ZodISODateTime`,(e,t)=>{Fr.init(e,t),j.init(e,t)});function fo(e){return/* @__PURE__ */ ia(uo,e)}let po=/*@__PURE__*/ E(`ZodISODate`,(e,t)=>{Ir.init(e,t),j.init(e,t)});function mo(e){return/* @__PURE__ */ aa(po,e)}let ho=/*@__PURE__*/ E(`ZodISOTime`,(e,t)=>{Lr.init(e,t),j.init(e,t)});function go(e){return/* @__PURE__ */ oa(ho,e)}let _o=/*@__PURE__*/ E(`ZodISODuration`,(e,t)=>{Rr.init(e,t),j.init(e,t)});function vo(e){return/* @__PURE__ */ sa(_o,e)}let yo=/*@__PURE__*/ E(`ZodError`,(e,t)=>{un.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>pn(e,t)},flatten:{value:t=>fn(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Ot,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Ot,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),bo=/* @__PURE__ */ mn(yo),xo=/* @__PURE__ */ hn(yo),So=/* @__PURE__ */ gn(yo),Co=/* @__PURE__ */ vn(yo),wo=/* @__PURE__ */ bn(yo),To=/* @__PURE__ */ xn(yo),Eo=/* @__PURE__ */ Sn(yo),Do=/* @__PURE__ */ Cn(yo),Oo=/* @__PURE__ */ wn(yo),ko=/* @__PURE__ */ Tn(yo),Ao=/* @__PURE__ */ En(yo),jo=/* @__PURE__ */ Dn(yo),Mo=/* @__PURE__ */ new WeakMap;function No(e,t,n){let r=Object.getPrototypeOf(e),i=Mo.get(r);if(i||(i=/* @__PURE__ */ new Set,Mo.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}let Po=/*@__PURE__*/ E(`ZodType`,(e,t)=>(k.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Ua(e,`input`),output:Ua(e,`output`)}}),e.toJSONSchema=Ha(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>bo(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>So(e,t,n),e.parseAsync=async(t,n)=>xo(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Co(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>wo(e,t,n),e.decode=(t,n)=>To(e,t,n),e.encodeAsync=async(t,n)=>Eo(e,t,n),e.decodeAsync=async(t,n)=>Do(e,t,n),e.safeEncode=(t,n)=>Oo(e,t,n),e.safeDecode=(t,n)=>ko(e,t,n),e.safeEncodeAsync=async(t,n)=>Ao(e,t,n),e.safeDecodeAsync=async(t,n)=>jo(e,t,n),No(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Ft(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Gt(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ws(e,t))},superRefine(e,t){return this.check(Gs(e,t))},overwrite(e){return this.check(/* @__PURE__ */ Da(e))},optional(){return Es(this)},exactOptional(){return Os(this)},nullable(){return As(this)},nullish(){return Es(As(this))},nonoptional(e){return Is(this,e)},array(){return ms(this)},or(e){return vs([this,e])},and(e){return bs(this,e)},transform(e){return Bs(this,ws(e))},default(e){return Ms(this,e)},prefault(e){return Ps(this,e)},catch(e){return Rs(this,e)},pipe(e){return Bs(this,e)},readonly(){return Hs(this)},describe(e){let t=this.clone();return Pi.add(t,{description:e}),t},meta(...e){if(e.length===0)return Pi.get(this);let t=this.clone();return Pi.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return Pi.get(e)?.description},configurable:!0}),e)),Fo=/*@__PURE__*/ E(`_ZodString`,(e,t)=>{Cr.init(e,t),Po.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ga(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,No(e,`_ZodString`,{regex(...e){return this.check(/* @__PURE__ */ xa(...e))},includes(...e){return this.check(/* @__PURE__ */ wa(...e))},startsWith(...e){return this.check(/* @__PURE__ */ Ta(...e))},endsWith(...e){return this.check(/* @__PURE__ */ Ea(...e))},min(...e){return this.check(/* @__PURE__ */ ya(...e))},max(...e){return this.check(/* @__PURE__ */ va(...e))},length(...e){return this.check(/* @__PURE__ */ ba(...e))},nonempty(...e){return this.check(/* @__PURE__ */ ya(1,...e))},lowercase(e){return this.check(/* @__PURE__ */ Sa(e))},uppercase(e){return this.check(/* @__PURE__ */ Ca(e))},trim(){return this.check(/* @__PURE__ */ ka())},normalize(...e){return this.check(/* @__PURE__ */ Oa(...e))},toLowerCase(){return this.check(/* @__PURE__ */ Aa())},toUpperCase(){return this.check(/* @__PURE__ */ ja())},slugify(){return this.check(/* @__PURE__ */ Ma())}})}),Io=/*@__PURE__*/ E(`ZodString`,(e,t)=>{Cr.init(e,t),Fo.init(e,t),e.email=t=>e.check(/* @__PURE__ */ Ii(Ro,t)),e.url=t=>e.check(/* @__PURE__ */ Hi(Vo,t)),e.jwt=t=>e.check(/* @__PURE__ */ ra(ns,t)),e.emoji=t=>e.check(/* @__PURE__ */ Ui(Ho,t)),e.guid=t=>e.check(/* @__PURE__ */ Li(zo,t)),e.uuid=t=>e.check(/* @__PURE__ */ Ri(Bo,t)),e.uuidv4=t=>e.check(/* @__PURE__ */ zi(Bo,t)),e.uuidv6=t=>e.check(/* @__PURE__ */ Bi(Bo,t)),e.uuidv7=t=>e.check(/* @__PURE__ */ Vi(Bo,t)),e.nanoid=t=>e.check(/* @__PURE__ */ Wi(Uo,t)),e.guid=t=>e.check(/* @__PURE__ */ Li(zo,t)),e.cuid=t=>e.check(/* @__PURE__ */ Gi(Wo,t)),e.cuid2=t=>e.check(/* @__PURE__ */ Ki(Go,t)),e.ulid=t=>e.check(/* @__PURE__ */ qi(Ko,t)),e.base64=t=>e.check(/* @__PURE__ */ ea($o,t)),e.base64url=t=>e.check(/* @__PURE__ */ ta(es,t)),e.xid=t=>e.check(/* @__PURE__ */ Ji(qo,t)),e.ksuid=t=>e.check(/* @__PURE__ */ Yi(Jo,t)),e.ipv4=t=>e.check(/* @__PURE__ */ Xi(Yo,t)),e.ipv6=t=>e.check(/* @__PURE__ */ Zi(Xo,t)),e.cidrv4=t=>e.check(/* @__PURE__ */ Qi(Zo,t)),e.cidrv6=t=>e.check(/* @__PURE__ */ $i(Qo,t)),e.e164=t=>e.check(/* @__PURE__ */ na(ts,t)),e.datetime=t=>e.check(fo(t)),e.date=t=>e.check(mo(t)),e.time=t=>e.check(go(t)),e.duration=t=>e.check(vo(t))});function Lo(e){return/* @__PURE__ */ Fi(Io,e)}let j=/*@__PURE__*/ E(`ZodStringFormat`,(e,t)=>{A.init(e,t),Fo.init(e,t)}),Ro=/*@__PURE__*/ E(`ZodEmail`,(e,t)=>{Er.init(e,t),j.init(e,t)}),zo=/*@__PURE__*/ E(`ZodGUID`,(e,t)=>{wr.init(e,t),j.init(e,t)}),Bo=/*@__PURE__*/ E(`ZodUUID`,(e,t)=>{Tr.init(e,t),j.init(e,t)}),Vo=/*@__PURE__*/ E(`ZodURL`,(e,t)=>{Dr.init(e,t),j.init(e,t)}),Ho=/*@__PURE__*/ E(`ZodEmoji`,(e,t)=>{Or.init(e,t),j.init(e,t)}),Uo=/*@__PURE__*/ E(`ZodNanoID`,(e,t)=>{kr.init(e,t),j.init(e,t)}),Wo=/*@__PURE__*/ E(`ZodCUID`,(e,t)=>{Ar.init(e,t),j.init(e,t)}),Go=/*@__PURE__*/ E(`ZodCUID2`,(e,t)=>{jr.init(e,t),j.init(e,t)}),Ko=/*@__PURE__*/ E(`ZodULID`,(e,t)=>{Mr.init(e,t),j.init(e,t)}),qo=/*@__PURE__*/ E(`ZodXID`,(e,t)=>{Nr.init(e,t),j.init(e,t)}),Jo=/*@__PURE__*/ E(`ZodKSUID`,(e,t)=>{Pr.init(e,t),j.init(e,t)}),Yo=/*@__PURE__*/ E(`ZodIPv4`,(e,t)=>{zr.init(e,t),j.init(e,t)}),Xo=/*@__PURE__*/ E(`ZodIPv6`,(e,t)=>{Br.init(e,t),j.init(e,t)}),Zo=/*@__PURE__*/ E(`ZodCIDRv4`,(e,t)=>{Vr.init(e,t),j.init(e,t)}),Qo=/*@__PURE__*/ E(`ZodCIDRv6`,(e,t)=>{Hr.init(e,t),j.init(e,t)}),$o=/*@__PURE__*/ E(`ZodBase64`,(e,t)=>{Wr.init(e,t),j.init(e,t)}),es=/*@__PURE__*/ E(`ZodBase64URL`,(e,t)=>{Kr.init(e,t),j.init(e,t)}),ts=/*@__PURE__*/ E(`ZodE164`,(e,t)=>{qr.init(e,t),j.init(e,t)}),ns=/*@__PURE__*/ E(`ZodJWT`,(e,t)=>{Yr.init(e,t),j.init(e,t)}),rs=/*@__PURE__*/ E(`ZodNumber`,(e,t)=>{Xr.init(e,t),Po.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ka(e,t,n,r),No(e,`ZodNumber`,{gt(e,t){return this.check(/* @__PURE__ */ ha(e,t))},gte(e,t){return this.check(/* @__PURE__ */ ga(e,t))},min(e,t){return this.check(/* @__PURE__ */ ga(e,t))},lt(e,t){return this.check(/* @__PURE__ */ pa(e,t))},lte(e,t){return this.check(/* @__PURE__ */ ma(e,t))},max(e,t){return this.check(/* @__PURE__ */ ma(e,t))},int(e){return this.check(os(e))},safe(e){return this.check(os(e))},positive(e){return this.check(/* @__PURE__ */ ha(0,e))},nonnegative(e){return this.check(/* @__PURE__ */ ga(0,e))},negative(e){return this.check(/* @__PURE__ */ pa(0,e))},nonpositive(e){return this.check(/* @__PURE__ */ ma(0,e))},multipleOf(e,t){return this.check(/* @__PURE__ */ _a(e,t))},step(e,t){return this.check(/* @__PURE__ */ _a(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function is(e){return/* @__PURE__ */ ca(rs,e)}let as=/*@__PURE__*/ E(`ZodNumberFormat`,(e,t)=>{Zr.init(e,t),rs.init(e,t)});function os(e){return/* @__PURE__ */ la(as,e)}let ss=/*@__PURE__*/ E(`ZodBoolean`,(e,t)=>{Qr.init(e,t),Po.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qa(e,t,n,r)});function cs(e){return/* @__PURE__ */ ua(ss,e)}let ls=/*@__PURE__*/ E(`ZodUnknown`,(e,t)=>{$r.init(e,t),Po.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function us(){return/* @__PURE__ */ da(ls)}let ds=/*@__PURE__*/ E(`ZodNever`,(e,t)=>{ei.init(e,t),Po.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ja(e,t,n,r)});function fs(e){return/* @__PURE__ */ fa(ds,e)}let ps=/*@__PURE__*/ E(`ZodArray`,(e,t)=>{ni.init(e,t),Po.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qa(e,t,n,r),e.element=t.element,No(e,`ZodArray`,{min(e,t){return this.check(/* @__PURE__ */ ya(e,t))},nonempty(e){return this.check(/* @__PURE__ */ ya(1,e))},max(e,t){return this.check(/* @__PURE__ */ va(e,t))},length(e,t){return this.check(/* @__PURE__ */ ba(e,t))},unwrap(){return this.element}})});function ms(e,t){return/* @__PURE__ */ Na(ps,e,t)}let hs=/*@__PURE__*/ E(`ZodObject`,(e,t)=>{si.init(e,t),Po.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$a(e,t,n,r),D(e,`shape`,()=>t.shape),No(e,`ZodObject`,{keyof(){return Ss(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:us()})},loose(){return this.clone({...this._zod.def,catchall:us()})},strict(){return this.clone({...this._zod.def,catchall:fs()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Xt(this,e)},safeExtend(e){return Zt(this,e)},merge(e){return Qt(this,e)},pick(e){return Jt(this,e)},omit(e){return Yt(this,e)},partial(...e){return $t(Ts,this,e[0])},required(...e){return en(Fs,this,e[0])}})});function gs(e,t){let n={type:`object`,shape:e??{},...O(t)};return new hs(n)}let _s=/*@__PURE__*/ E(`ZodUnion`,(e,t)=>{li.init(e,t),Po.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eo(e,t,n,r),e.options=t.options});function vs(e,t){return new _s({type:`union`,options:e,...O(t)})}let ys=/*@__PURE__*/ E(`ZodIntersection`,(e,t)=>{ui.init(e,t),Po.init(e,t),e._zod.processJSONSchema=(t,n,r)=>to(e,t,n,r)});function bs(e,t){return new ys({type:`intersection`,left:e,right:t})}let xs=/*@__PURE__*/ E(`ZodEnum`,(e,t)=>{pi.init(e,t),Po.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ya(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new xs({...t,checks:[],...O(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new xs({...t,checks:[],...O(r),entries:i})}});function Ss(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new xs({type:`enum`,entries:n,...O(t)})}let Cs=/*@__PURE__*/ E(`ZodTransform`,(e,t)=>{mi.init(e,t),Po.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Za(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new wt(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(cn(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(cn(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function ws(e){return new Cs({type:`transform`,transform:e})}let Ts=/*@__PURE__*/ E(`ZodOptional`,(e,t)=>{gi.init(e,t),Po.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Es(e){return new Ts({type:`optional`,innerType:e})}let Ds=/*@__PURE__*/ E(`ZodExactOptional`,(e,t)=>{_i.init(e,t),Po.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Os(e){return new Ds({type:`optional`,innerType:e})}let ks=/*@__PURE__*/ E(`ZodNullable`,(e,t)=>{vi.init(e,t),Po.init(e,t),e._zod.processJSONSchema=(t,n,r)=>no(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function As(e){return new ks({type:`nullable`,innerType:e})}let js=/*@__PURE__*/ E(`ZodDefault`,(e,t)=>{yi.init(e,t),Po.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ms(e,t){return new js({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ht(t)}})}let Ns=/*@__PURE__*/ E(`ZodPrefault`,(e,t)=>{xi.init(e,t),Po.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ao(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ps(e,t){return new Ns({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ht(t)}})}let Fs=/*@__PURE__*/ E(`ZodNonOptional`,(e,t)=>{Si.init(e,t),Po.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ro(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Is(e,t){return new Fs({type:`nonoptional`,innerType:e,...O(t)})}let Ls=/*@__PURE__*/ E(`ZodCatch`,(e,t)=>{wi.init(e,t),Po.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Rs(e,t){return new Ls({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}let zs=/*@__PURE__*/ E(`ZodPipe`,(e,t)=>{Ti.init(e,t),Po.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r),e.in=t.in,e.out=t.out});function Bs(e,t){return new zs({type:`pipe`,in:e,out:t})}let Vs=/*@__PURE__*/ E(`ZodReadonly`,(e,t)=>{Di.init(e,t),Po.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Hs(e){return new Vs({type:`readonly`,innerType:e})}let Us=/*@__PURE__*/ E(`ZodCustom`,(e,t)=>{ki.init(e,t),Po.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xa(e,t,n,r)});function Ws(e,t={}){return/* @__PURE__ */ Pa(Us,e,t)}function Gs(e,t){return/* @__PURE__ */ Fa(e,t)}let Ks=gs({source:Lo(),ref:Lo(),offset:is().int().nonnegative(),length:is().int().positive(),label:Lo(),appearance:Ss([`session`,`file`,`folder`]).optional(),clipboardText:Lo(),invalid:cs().optional()}),qs=gs({text:Lo(),references:ms(Ks)}).refine(e=>{let t=0;for(let n of e.references)if(n.offset<t||n.length!==n.clipboardText.length||(t=n.offset+n.length,t>e.text.length||e.text.slice(n.offset,t)!==n.clipboardText))return!1;return!0},`Draft references must identify ordered, non-overlapping text spans`);function Js(e){return typeof e==`string`?{text:e,references:[]}:{text:e.text,references:e.references.map(Zs)}}function Ys(e){if(typeof e==`string`)return Js(e);let t=qs.safeParse(e);if(t.success)return{text:t.data.text,references:t.data.references.map(({appearance:e,invalid:t,...n})=>({...n,...e===void 0?{}:{appearance:e},...t===void 0?{}:{invalid:t}}))}}function Xs(e,t){return{text:e,references:t.map(Zs)}}function Zs(e){return{source:e.source,ref:e.ref,offset:e.offset,length:e.length,label:e.label,clipboardText:e.clipboardText,...e.appearance===void 0?{}:{appearance:e.appearance},...e.invalid===void 0?{}:{invalid:e.invalid}}}let Qs=`dsh.conversation`;function $s(){return(0,f.defineStore)({init:()=>({draft:``,view:null,viewRequest:null}),persist:Qs,actions:{setDraft:(e,t)=>{e.draft=t},setView:(e,t)=>{e.view=t},openView:(e,t,n)=>{e.view=t,e.viewRequest={view:t,focus:n}},completeViewRequest:e=>{e.viewRequest=null}}})}function ec(e){let t={text:``,references:[]};if(typeof localStorage>`u`)return t;try{let n=localStorage.getItem(`${Qs}.${e}`);if(n===null)return t;let r=JSON.parse(n);return typeof r!=`object`||!r||!(`draft`in r)?t:Ys(r.draft)??t}catch{return t}}function tc(e){if(typeof localStorage>`u`)return null;try{let t=localStorage.getItem(`${Qs}.${e}`);if(t===null)return null;let n=JSON.parse(t);return typeof n!=`object`||!n||!(`view`in n)?null:typeof n.view==`string`?n.view:null}catch{return null}}function nc(e,t){let n=e.kind===`directory`?`${e.path}/`:e.path;if(!/[\u0000-\u001f\u007f-\u009f"]/u.test(n))return t||/\s/u.test(n)?e.kind===`directory`?`@"${n}`:`@"${n}"`:`@${n}`}function rc(e){let t=e.replace(/[/\\]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return t.slice(n+1)}function ic(e,t){if(t===void 0||t===``)return e;let n=t.replace(/[/\\]+$/,``);return e.startsWith(`${n}/`)||e.startsWith(`${n}\\`)?e.slice(n.length+1):e}function ac(e){return{kind:`image`,id:ht(),previewUrl:URL.createObjectURL(e),file:e}}function oc(e){if(typeof Image!=`function`)return;let t=new Image;t.onload=()=>{e.width=t.naturalWidth,e.height=t.naturalHeight},t.src=e.previewUrl}function sc(){return new Promise(e=>{if(typeof requestAnimationFrame==`function`){if(typeof document<`u`&&document.visibilityState===`hidden`){setTimeout(e,0);return}let t=!1,n=()=>{t||(t=!0,clearTimeout(r),setTimeout(e,0))},r=setTimeout(n,100);requestAnimationFrame(n)}else setTimeout(e,0)})}function cc(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let e=r.result;t(e.slice(e.indexOf(`,`)+1))},r.onerror=()=>{n(r.error??/* @__PURE__ */ Error(`conversation: image read failed`))},r.readAsDataURL(e)})}var lc=class extends Error{mediaType;constructor(e){super(`unsupported image media type: ${e||`(empty)`}`),this.name=`UnsupportedImageMediaTypeError`,this.mediaType=e}},uc=class extends m.Service{input;blocks;fileUploads=(0,f.createSnapshotStore)({});draftAttachments=/* @__PURE__ */ new Map;fileUploadOperations=/* @__PURE__ */ new Map;pendingFileUploads=/* @__PURE__ */ new Set;fileUploadQueue=[];activeFileUploads=0;maxConcurrentFileUploads;constructor(e,t){super(e,`conversation`),this.input=t.input,this.blocks=t.blocks,this.maxConcurrentFileUploads=t.maxConcurrentFileUploads,e.effect(()=>async()=>{let e=[...this.fileUploadOperations.values()];for(let t of e)t.controller.abort();await Promise.allSettled([...this.pendingFileUploads]),this.fileUploadOperations.clear(),this.fileUploadQueue.length=0;for(let e of this.draftAttachments.values())e.kind===`image`&&pc(e.previewUrl);this.draftAttachments.clear(),this.fileUploads.set({})},`conversation draft attachments`)}async send(e){let t=await this.scopedSession(`send`).prompt([{type:`text`,text:e}],`queue`);if(!t.ok)throw Error(`conversation.send failed: ${t.error.code}: ${t.error.message}`)}async sendSession(e,t,n,r,i){let a=this.resolveDraftAttachments(n);if(a.length!==n.length)throw Error(`conversation.sendSession: one or more draft attachments are no longer available`);let o=this.fileUploads.getSnapshot(),s=e=>{let t=o[e.id];if(t===void 0||t.status!==`ready`)throw Error(`conversation.sendSession: one or more files have not finished uploading`);return t},c=a.map(e=>e.kind===`image`?{type:`image`,value:{previewUrl:e.previewUrl,...e.file.name===``?{}:{name:e.file.name},...e.width===void 0?{}:{width:e.width},...e.height===void 0?{}:{height:e.height}}}:{type:`file`,value:s(e).file}),l=()=>Promise.all(a.map(async e=>e.kind===`image`?{type:`image`,...await this.encodeImage(e.file)}:{type:`file`,receiptId:s(e).receiptId}));if(e.getSnapshot().subagent!==null){let n=[...await l(),...t===``?[]:[{type:`text`,text:t}]];return(await e.prompt(n,r,i)).ok?{kind:`success`}:{kind:`error`}}let u,d=a.length===0?void 0:new Promise(e=>{u=e}),f=e.beginSubmission({mode:r,text:t,attachments:c,onRetire:t=>{this.settleSubmittedAttachments(e.sessionId,a,t),u?.(t)}}),p;try{await sc(),p=[...await l(),...t===``?[]:[{type:`text`,text:t}]]}catch(e){throw f.abandon(),e}return!(await e.prompt(p,r,i,f.requestId)).ok||d!==void 0&&(await d).reason!==`observed`?{kind:`error`}:{kind:`success`}}createDrafts(e,t){return t.map(t=>{if(fc(t.type)){let e=ac(t);return this.draftAttachments.set(e.id,e),oc(e),e}let n={kind:`file`,id:ht(),file:t};return this.draftAttachments.set(n.id,n),this.beginFileUpload(e,n),n})}retryFileUpload(e,t){let n=this.draftAttachments.get(t);n!==void 0&&n.kind===`file`&&this.fileUploads.getSnapshot()[t]?.status===`error`&&this.beginFileUpload(e,n)}rebindDraftFiles(e,t){for(let n of t){let t=this.draftAttachments.get(n);t?.kind===`file`&&this.beginFileUpload(e,t)}}beginFileUpload(e,t){this.fileUploadOperations.get(t.id)?.controller.abort();let n=new AbortController;this.fileUploads.update(e=>{e[t.id]={status:`uploading`,loaded:0}});let r,i=new Promise(e=>{r=e});this.fileUploadOperations.set(t.id,{controller:n,done:i}),this.pendingFileUploads.add(i),i.then(()=>{this.pendingFileUploads.delete(i)}),this.fileUploadQueue.push({run:async()=>{try{if(n.signal.aborted||this.fileUploadOperations.get(t.id)?.controller!==n)return;let r=await this.ctx.fileUpload.upload(e,t.file,t.file.name===``?void 0:t.file.name,n.signal,e=>{this.fileUploadOperations.get(t.id)?.controller===n&&this.fileUploads.update(n=>{t.id in n&&(n[t.id]={status:`uploading`,loaded:e.loaded,...e.total===void 0?{}:{total:e.total}})})});if(this.fileUploadOperations.get(t.id)?.controller!==n)return;this.fileUploads.update(e=>{t.id in e&&(e[t.id]=r.ok?{status:`ready`,receiptId:r.value.receiptId,file:r.value.file}:{status:`error`,message:r.error.message})})}catch(e){if(this.fileUploadOperations.get(t.id)?.controller!==n)return;this.fileUploads.update(n=>{t.id in n&&(n[t.id]={status:`error`,message:e instanceof Error?e.message:String(e)})})}finally{this.fileUploadOperations.get(t.id)?.controller===n&&this.fileUploadOperations.delete(t.id)}},settle:r}),this.pumpFileUploads()}pumpFileUploads(){for(;this.activeFileUploads<this.maxConcurrentFileUploads;){let e=this.fileUploadQueue.shift();if(e===void 0)return;this.activeFileUploads+=1,e.run().finally(()=>{--this.activeFileUploads,e.settle(),this.pumpFileUploads()})}}resolveDraftAttachments(e){let t=[];for(let n of e){let e=this.draftAttachments.get(n);e!==void 0&&t.push(e)}return t}async serializeDraftAttachments(e){let t=this.resolveDraftAttachments(e);if(t.length!==e.length)throw Error(`conversation.serializeDraftAttachments: one or more draft attachments are no longer available`);let n=this.fileUploads.getSnapshot();return{attachments:await Promise.all(t.map(async e=>{if(e.kind===`image`)return{type:`image`,...await this.encodeImage(e.file)};let t=n[e.id];if(t===void 0||t.status!==`ready`)throw Error(`conversation.serializeDraftAttachments: one or more files have not finished uploading`);return{type:`file`,receiptId:t.receiptId}}))}}releaseDraftAttachment(e){let t=this.draftAttachments.get(e);if(t===void 0)return;let n=this.fileUploadOperations.get(e);this.fileUploadOperations.delete(e),n?.controller.abort(),this.draftAttachments.delete(e),t.kind===`image`?pc(t.previewUrl):this.fileUploads.set(Object.fromEntries(Object.entries(this.fileUploads.getSnapshot()).filter(([t])=>t!==e)))}releaseDraftAttachments(e){for(let t of e)this.releaseDraftAttachment(t.id)}async updateQueue(e,t){let n=await this.scopedSession(`updateQueue`).updateQueue(e,t);if(!n.ok){if(t.kind===`steer`&&(n.error.code===`session/steer-unavailable`||n.error.code===`session/queue-item-not-found`))return;throw Error(`conversation.updateQueue failed: ${n.error.code}: ${n.error.message}`)}}async cancel(){let e=await this.scopedSession(`cancel`).cancel();if(!e.ok)throw Error(`conversation.cancel failed: ${e.error.code}: ${e.error.message}`)}async loadOlder(){await this.scopedSession(`loadOlder`).loadOlder()}scopedSession(e){let t=this.scopeId(e),n=this.requireSessions().binding(t);if(n===void 0)throw Error(`conversation.${e}: session "${t}" resolved no binding`);return n.session}scopeId(e){let t=this.requireSessions().scopeOf(this.ctx);if(t===void 0)throw Error(`conversation.${e} requires a session scope — address one via ctx.sessions.scope(id).conversation`);return t}requireSessions(){let e=this.ctx.get(`sessions`);if(e===void 0)throw Error(`conversation: sessions service unavailable`);return e}settleSubmittedAttachments(e,t,n){if(n.reason!==`observed`)return;let r=this.ctx.get(`uiConversation`),i=0;for(let a of t){let t=this.draftAttachments.get(a.id),o=n.attachments[i++];t!==void 0&&(a.kind===`file`?this.releaseDraftAttachment(a.id):(this.draftAttachments.delete(a.id),!(o!==void 0&&`mediaType`in o&&r?.seedImageUrl(e,o,a.previewUrl)===!0)&&pc(a.previewUrl)))}}async encodeImage(e){return{mediaType:dc(e.type),data:await cc(e),...e.name===``?{}:{name:e.name}}}};function dc(e){switch(e){case`image/png`:case`image/jpeg`:case`image/webp`:case`image/gif`:return e;default:throw new lc(e)}}function fc(e){return e===`image/png`||e===`image/jpeg`||e===`image/webp`||e===`image/gif`}function pc(e){e.startsWith(`blob:`)&&URL.revokeObjectURL(e)}var mc=class{stores=/* @__PURE__ */ new Map;set(e,t){let n=this.storeFor(e);n.getSnapshot()?.reason!==t?.reason&&n.set(t)}storeFor(e){let t=this.stores.get(e);if(t!==void 0)return t;let n=(0,f.createSnapshotStore)(void 0);return this.stores.set(e,n),n}forget(e){this.stores.delete(e)}};function hc(e){throw Error(`unreachable input event: ${JSON.stringify(e)}`)}function gc(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 _c(e,t){return e.startsWith(t)||e===t.trimEnd()}var vc=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.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 hc(e)}}onDraftChanged(e){return this.phase===`claimed`&&this.claim!==void 0&&!_c(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){if(this.phase===`adjudicating`||this.phase===`submitting`)return[];if(this.phase===`claimed`&&this.claim!==void 0){let r=this.beginAttempt(e,t,n);return this.phase=`submitting`,[{type:`begin-submit`,attempt:r,claim:this.claim,args:gc(t,this.claim.token)}]}let r=t.trim();if(r===``)return[];if(r.startsWith(`/`)){let r=this.beginAttempt(e,t,n);return this.phase=`adjudicating`,[{type:`adjudicate`,attempt:r,draft:t}]}return this.detachedEffects(this.beginDetached(e,t,n))}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:gc(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&&_c(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 M(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 yc(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);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let bc=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,xc=bc&&`documentMode`in document?document.documentMode:null,Sc=bc&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Cc=bc&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),wc=!(!bc||!(`InputEvent`in window)||xc)&&`getTargetRanges`in new window.InputEvent(`input`),Tc=bc&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Ec=bc&&/Android/.test(navigator.userAgent),Dc=bc&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!Ec,Oc=bc&&/^(?=.*Chrome).*/i.test(navigator.userAgent),kc=bc&&Ec&&Oc,Ac=bc&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Sc&&!Oc,jc=Dc||Tc||Ac?`\xA0`:``,Mc=Cc?`\xA0`:jc,Nc=`֑-߿יִ-﷽ﹰ-ﻼ`,Pc=`A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--`;RegExp(`^[^`+Pc+`]*[`+Nc+`]`),RegExp(`^[^`+Nc+`]*[`+Pc+`]`);let Fc={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Ic={directionless:1,unmergeable:2},Lc={center:2,end:6,justify:4,left:1,right:3,start:5},Rc={2:`center`,6:`end`,4:`justify`,1:`left`,3:`right`,5:`start`},zc={normal:0,segmented:2,token:1},Bc={0:`normal`,2:`segmented`,1:`token`},Vc=`$config`;function Hc(){return ng()._blockCursorElement}function Uc(e){return e!==null&&e.nodeType===1&&e.hasAttribute(`data-lexical-slot`)}var Wc=class e{element;before;after;constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}insertChild(e){let t=this.getInsertionAnchor();return t!==null&&t.parentElement!==this.element&&M(357),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&M(358),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&M(359),this.element.replaceChild(e,t),this}getFirstChild(){let e=this.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;return t===this.getInsertionAnchor()?null:t}getFirstChildAnchor(){return this.after}resolveLeafPosition(e,t,n){if(this.element===e)return t===e&&n===0?`before`:`after`;let r=Gc(e,this.element);if(r===null)return`after`;let i=Array.prototype.indexOf.call(e.childNodes,r);if(i<0)return`after`;if(t===e)return n<=i?`before`:`after`;let a=Gc(e,t);if(a===null)return`after`;let o=Array.prototype.indexOf.call(e.childNodes,a);return o>=0&&o<=i?`before`:`after`}getInsertionAnchor(){return this.before}};function Gc(e,t){let n=t;for(;n!==null&&n.parentNode!==e;)n=n.parentNode;return n}var Kc=class e extends Wc{withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()}getFirstChildAnchor(){let e=super.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;for(;Uc(t);)e=t,t=t.nextSibling;let n=e?e.nextSibling:this.element.firstChild;return n!==null&&n===Hc()?n:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(this.element.__lexicalLastChildKind=e,e===null)this.removeManagedLineBreak();else{let t=e===`decorator`&&(Ac||Tc||Dc);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){let e=this.getManagedLineBreak();if(e){let t=this.element,n=e.nodeName===`IMG`?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){let t=this.getManagedLineBreak();if(t){if(e===(t.nodeName===`IMG`))return;this.removeManagedLineBreak()}let n=this.element,r=this.before,i=zh().createElement(`br`);if(i.setAttribute(`data-lexical-managed-linebreak`,`true`),n.insertBefore(i,r),e){let e=zh().createElement(`img`);e.setAttribute(`data-lexical-managed-linebreak`,`true`),e.style.setProperty(`display`,`inline`,`important`),e.style.setProperty(`border`,`0px`,`important`),e.style.setProperty(`margin`,`0px`,`important`),e.alt=``,n.insertBefore(e,i),n.__lexicalLineBreak=e}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=this.getFirstChild(),t=this.getInsertionAnchor(),n=0;for(let r=this.element.firstChild;r!==null&&r!==e&&r!==t;r=r.nextSibling)n++;return n}resolveChildIndex(e,t,n,r){if(n===this.element){let t=this.getFirstChildOffset(),n=Hc(),i=this.element.childNodes,a=Math.min(r,i.length),o=0;for(let e=t;e<a;e++)i[e]!==n&&o++;return[e,Math.min(o,e.getChildrenSize())]}let i=qc(t,n);i.push(r);let a=qc(t,this.element),o=e.getIndexWithinParent();for(let e=0;e<a.length;e++){let t=i[e],n=a[e];if(t===void 0||t<n)break;if(t>n){o+=1;break}}return[e.getParentOrThrow(),o]}};function qc(e,t){let n=[],r=t;for(;r!==e&&r!==null;r=r.parentNode){let e=0;for(let t=r.previousSibling;t!==null;t=t.previousSibling)e++;n.push(e)}return r!==e&&M(225),n.reverse()}let Jc;try{Jc=`0.49.0+prod.esm`}catch{}let Yc=Jc??`"<unknown>+source"`;var Xc=class{_front=/* @__PURE__ */ new Set;_back=/* @__PURE__ */ new Set;_cache;get size(){return this._front.size+this._back.size}addBack(e){return delete this._cache,this._front.has(e)||this._back.add(e),this}addFront(e){return delete this._cache,this._back.has(e)||this._front.add(e),this}delete(e){return delete this._cache,this._front.delete(e)||this._back.delete(e)}toArray(){let e=Array.from(this._front).reverse();for(let t of this._back)e.push(t);return e}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}};function Zc(e,t=1e3){return e instanceof Qc?e.clone():e.size<t?new Map(e):new Qc().init(new Map(e),void 0,e.size)}var Qc=class e{_mutable=!1;_old=void 0;_nursery=void 0;_size=0;clone(){return this._mutable=!1,new e().init(this._old,this._nursery,this._size)}init(e,t,n){return this._old=e,this._nursery=t,this._size=n,this}get size(){return this._size}has(e){return this.get(e)!==void 0}getWithTombstone(e){let t=this._nursery&&this._nursery.get(e);return t===void 0?this._old&&this._old.get(e):t}get(e){let t=this.getWithTombstone(e);return t===null?void 0:t}shouldCompact(){return this._nursery!==void 0&&2*this._nursery.size>this._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(e=!1){if(this._nursery&&this._nursery.size>0&&(e||this.shouldCompact())){let e=new Map(this._old);for(let[t,n]of this._nursery)n===null?e.delete(t):e.set(t,n);this._old=e,this._nursery=void 0}return this._mutable=!1,this}set(e,t){let n=this.getWithTombstone(e);if(n===t)return this;let r=this.getNursery();return n??(this._size++,n===null&&r.delete(e)),r.set(e,t),this}delete(e){let t=this.has(e);return t&&(this.getNursery().set(e,null),this._size--),t}getOrInsert(e,t){let n=this.get(e);return n===void 0?(this.set(e,t),t):n}getOrInsertComputed(e,t){let n=this.get(e);if(n!==void 0)return n;let r=t(e);return this.set(e,r),r}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(let e of this.entries())yield e[0]}*values(){for(let e of this.entries())yield e[1]}*entries(){let e=this._nursery,t=this._old;if(t)for(let n of t){let t=n[0],r=e?e.get(t):void 0;r!==null&&(r!==void 0&&(n[1]=r),yield n)}if(e)for(let n of e)n[1]===null||t&&t.has(n[0])||(yield n)}forEach(e,t){t!==void 0&&(e=e.bind(t));for(let[t,n]of this.entries())e(n,t,this)}get[Symbol.toStringTag](){return`GenMap`}[Symbol.iterator](){return this.entries()}};function $c(e,t,n,r,i,a){if(H(e)){let o=e.getFirstChild();for(;o!==null;){let e=o.__key;o.__parent===t&&((H(o)||kg(o)&&o.__slots!==null)&&$c(o,e,n,r,i,a),n.has(e)||a.delete(e),i.push(e)),o=o.getNextSibling()}}for(let o of kg(e)&&e.__slots!==null?e.__slots.values():[]){let e=r.get(o);e!==void 0&&Ag(e)&&e.__slotHost===t&&((H(e)||kg(e)&&e.__slots!==null)&&$c(e,o,n,r,i,a),n.has(o)||a.delete(o),i.push(o))}}let el=!1,tl=0;function nl(e){tl=e.timeStamp}function rl(e,t,n){let r=e.nodeName===`BR`,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&Um(e,n)!==void 0}function il(e,t,n){let r=Mh(xh(n)),i=r&&Hh(r,n._rootElement),a=null,o=null;i!==null&&i.anchorNode===e&&(a=i.anchorOffset,o=i.focusOffset);let s=e.nodeValue;s!==null&&th(t,s,a,o,!1)}function al(e,t,n){if(z(e)){let t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return Mm(t)&&n.isAttached()}function ol(e,t,n){for(let r=e;r&&!gg(r);r=hh(r)){let e=Um(r,t);if(e!==void 0){let t=W(e,n);if(t)return U(t)||!J(r)?void 0:[r,t]}}}function sl(e,t,n){el=!0;let r=performance.now()-tl>100;try{Bp(e,()=>{let i=B()||function(e){return e.read(`latest`,()=>{let e=B();return e===null?null:e.clone()})}(e),a=/* @__PURE__ */ new Map,o=e._editorState,s=e._blockCursorElement,c=!1,l=``;for(let n=0;n<t.length;n++){let u=t[n],d=u.type,f=u.target,p=ol(f,e,o);if(!p)continue;let[m,h]=p;if(d===`characterData`)r&&R(h)&&Mm(f)&&al(i,f,h)&&il(f,h,e);else if(d===`childList`){c=!0;let t=u.addedNodes;for(let n=0;n<t.length;n++){let r=t[n],i=Vm(r),a=r.parentNode;if(!(a==null||r===s||i!==null||rl(r,a,e)||e._slotsUsed&&J(r)&&r.hasAttribute(`data-lexical-slot`)||gg(r))){if(Cc){let e=(J(r)?r.innerText:null)||r.nodeValue;e&&(l+=e)}a.removeChild(r)}}let n=u.removedNodes,r=n.length;if(r>0){let t=0;for(let i=0;i<r;i++){let r=n[i];(rl(r,f,e)||s===r)&&(f.appendChild(r),t++)}r!==t&&a.set(m,h)}}}if(a.size>0)for(let[t,n]of a)n.reconcileObservedMutation(t,e);let u=n.takeRecords();if(u.length>0){for(let t=0;t<u.length;t++){let n=u[t],r=n.addedNodes,i=n.target;for(let t=0;t<r.length;t++){let n=r[t],a=n.parentNode;a==null||n.nodeName!==`BR`||rl(n,i,e)||a.removeChild(n)}}n.takeRecords()}i!==null&&(c&&qm(i),Cc&&ph(e)&&i.insertRawText(l))})}finally{el=!1}}function cl(e){let t=e._observer;t!==null&&sl(e,t.takeRecords(),t)}function ll(e){(function(e){tl===0&&xh(e).addEventListener(`textInput`,nl,!0)})(e),e._observer=new MutationObserver((t,n)=>{sl(e,t,n)})}var ul=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||vl).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function dl(e,t){return new ul(e,t)}function fl(e){let t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Set;for(let{ownNodeConfig:r}of Cg(typeof e==`function`?e:e.replace))if(r&&r.stateConfigs)for(let e of r.stateConfigs){let r;`stateConfig`in e?(r=e.stateConfig,e.flat&&n.add(r.key)):r=e,t.set(r.key,r)}return{flatKeys:n,sharedConfigMap:t}}let pl=/* @__PURE__ */ new Set([`__proto__`,`constructor`,`prototype`]);var ml=class e{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,n=void 0,r=/* @__PURE__ */ new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=n,this.knownState=r;let{sharedConfigMap:a}=this.sharedNodeState,o=i===void 0?function(e,t,n){let r=n.size;if(t)for(let i in t){let t=e.get(i);t&&n.has(t)||r++}return r}(a,n,r):i;this.size=o}getValue(e){let t=this.knownState.get(e);if(t!==void 0)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){let t=this.unknownState[e.key];t!==void 0&&(n=e.parse(t)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let e={...this.unknownState},t={};for(let[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);for(let n of this.sharedNodeState.flatKeys)n in e&&(t[n]=e[n],delete e[n]);return _l(e)&&(t.$=e),t}getWritable(t){if(this.node===t)return this;let{sharedNodeState:n,unknownState:r}=this,i=new Map(this.knownState);return new e(t,n,function(e,t,n){let r;if(n)for(let[i,a]of Object.entries(n)){if(pl.has(i))continue;let n=e.get(i);n?t.has(n)||t.set(n,n.parse(a)):(r||={},r[i]=a)}return r}(n.sharedConfigMap,i,r),i,this.size)}resetOnCopyNode(){for(let e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){let n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);let{knownState:r,unknownState:i}=this;r.has(e)||i&&n in i||(i&&(delete i[n],this.unknownState=_l(i)),this.size++),r.set(e,t)}updateFromUnknown(e,t){if(pl.has(e))return;let n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){let{knownState:t}=this;for(let e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(let[t,n]of Object.entries(e))this.updateFromUnknown(t,n)}};function hl(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new ml(t,gl(t));return t.__state=n,n}function gl(e){return e.__state?e.__state.sharedNodeState:Sm(ng(),e.getType()).sharedNodeState}function _l(e){if(e)for(let t in e)return e}function vl(e){return e}function yl(e,t,n){for(let[r,i]of t.knownState){if(e.has(r.key))continue;e.add(r.key);let t=n?n.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return!0}return!1}function bl(e,t,n){let{unknownState:r}=t,i=n?n.unknownState:void 0;if(r){for(let[t,n]of Object.entries(r))if(!e.has(t)&&(e.add(t),n!==(i?i[t]:void 0)))return!0}return!1}function xl(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function Sl(e,t){let n=e.__mode,r=e.__format,i=e.__style,a=t.__mode,o=t.__format,s=t.__style,c=e.__state,l=t.__state;return(n===null||n===a)&&(r===null||r===o)&&(i===null||i===s)&&(e.__state===null||c===l||function(e,t){if(e===t)return!0;let n=/* @__PURE__ */ new Set;return!(e&&yl(n,e,t)||t&&yl(n,t,e)||e&&bl(n,e,t)||t&&bl(n,t,e))}(c,l))}function Cl(e,t){let n=e.mergeWithSibling(t),r=V()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function wl(e){let t,n,r=e;if(r.__text!==``||!r.isSimpleText()||r.isUnmergeable()){for(;(t=r.getPreviousSibling())!==null&&R(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==``){if(Sl(t,r)){r=Cl(t,r);break}break}t.remove()}for(;(n=r.getNextSibling())!==null&&R(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==``){if(Sl(r,n)){r=Cl(r,n);break}break}n.remove()}}else r.remove()}function Tl(e){return El(e.anchor),El(e.focus),e}function El(e){for(;e.type===`element`;){let t=e.getNode(),n=e.offset,r,i;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),i=!0):(r=t.getChildAtIndex(n),i=!1),R(r)){e.set(r.__key,i?r.getTextContentSize():0,`text`,!0);break}if(!H(r))break;e.set(r.__key,i?r.getChildrenSize():0,`element`,!0)}}let Dl=Symbol.for(`@lexical/CachedTextSize`);function Ol(e,t){return Vl.read(()=>{let n=0,r=e;for(let e=0;e<t&&r!==null;e++){let i=Bl.get(r);if(i===void 0&&M(345,r),H(i)){let a=I.get(r);if(a!==void 0&&H(a)&&a.__parent!==i.__parent)n+=i.getTextContentSize();else{let e=Hl.get(r),t=e&&e.__lexicalTextContent;typeof t!=`string`&&M(346,i.getType()),n+=t.length}e<t-1&&!i.isInline()&&(n+=2)}else{let e=i[Dl];e===void 0&&M(347,i.getType(),r),n+=e}r=i.__next}return n},{editor:N})}function kl(e){H(e)||e[Dl]===void 0&&(e[Dl]=R(e)?e.__text.length:e.getTextContentSize())}let Al,N,jl,P=``,F=null,Ml=null,Nl=null;function Pl(){return{firstTextKey:Nl,format:F,style:Ml}}function Fl(e){e.firstTextKey!==null&&(F=e.format,Ml=e.style,Nl=e.firstTextKey)}function Il(e){if(Nl!==null)return;let t=e.__lexicalFirstTextKey;if(t===void 0&&M(348),t===null)return;let n=I.get(t);R(n)&&(F=n.getFormat(),Ml=n.getStyle(),Nl=t)}let Ll,Rl,zl,Bl,Vl,I,Hl,Ul,Wl,Gl,Kl=!1,ql=!1;function Jl(e,t){let n=Bl.get(e),r=I.has(e);if(t!==null){let n=_u(e);n.parentNode===t&&t.removeChild(n)}if(!r){if(N._keyToDOMMap.delete(e),H(n)){let e=Eg(n,Bl);Yl(e,0,e.length-1,null)}if(n!==void 0){for(let e of ru(n).values()){let t=au(e);Jl(e,null),t!==null&&t.remove()}uh(Wl,jl,Ll,n,`destroyed`)}}}function Yl(e,t,n,r){for(let i=t;i<=n;++i){let t=e[i];t!==void 0&&Jl(t,r)}}function Xl(e,t){e.setProperty(`text-align`,t)}function Zl(e,t){let n=Al.theme.indent;if(typeof n==`string`){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}e.style.setProperty(`padding-inline-start`,t===0?``:`calc(${t} * var(--lexical-indent-base-value, 40px))`)}function Ql(e,t){let n=e.style;t===0?Xl(n,``):t===1?Xl(n,`left`):t===2?Xl(n,`center`):t===3?Xl(n,`right`):t===4?Xl(n,`justify`):t===5?Xl(n,`start`):t===6&&Xl(n,`end`)}function $l(e,t){let n=function(e){let t=e.__dir;if(t!==null)return t;if(Kp(e))return null;let n=e.getParent();return n===null||Th(n)&&n.__dir===null?`auto`:null}(t);n===null?e.removeAttribute(`dir`):e.dir=n}function eu(e){let t=zh().createElement(`div`);return t.setAttribute(`data-lexical-slot`,e),t.style.display=`none`,t}function tu(e,t,n){t||e.contentEditable===`false`?_g(n,N):n.removeAttribute(`contenteditable`)}function nu(e,t,n){let r=P,i=Pl();P=``;let a=``,o=U(e);for(let[r,i]of n){let n=eu(r);tu(t,o,n),t.appendChild(n),P=``;let s=Pl();su(i,ig(e,n,N)),Fl(s),iu(e,r,t,n),a+=P}return Fl(i),P=r,a}function ru(e){return kg(e)&&e.__slots!==null?e.__slots:Og}function iu(e,t,n,r){let i=Gl.$getSlotTargetElement(e,t,n,N);i!==null&&(r.parentElement!==i&&i.appendChild(r),r.style.display=``)}function au(e){let t=Hl.get(e);return t===void 0?null:t.parentElement}function ou(e,t,n){let r=ru(e),i=ru(t);for(let[e,t]of r)if(!i.has(e)){let e=au(t);Jl(t,null),e!==null&&e.remove()}let a=P,o=Pl(),s=``,c=null,l=U(t);for(let[e,a]of i){let i=r.get(e),o=i===void 0?null:au(i);P=``;let u=Pl();if(o===null){o=eu(e);let r=null;for(let e of n.children)if(!e.hasAttribute(`data-lexical-slot`)){r=e;break}n.insertBefore(o,r),su(a,ig(t,o,N))}else i===a?fu(a,o):(i!==void 0&&Jl(i,o),su(a,ig(t,o,N)));if(Fl(u),tu(n,l,o),iu(t,e,n,o),s+=P,o.parentElement===n){let e=c===null?n.firstChild:c.nextSibling;e!==o&&n.insertBefore(o,e),c=o}}return Fl(o),P=a,s}function su(e,t){let n=I.get(e);if(n===void 0&&M(60),t!==null){let r=Bl.get(e);if(r!==void 0){let i=Hl.get(e);if(i!==void 0){let a=Ag(r)?r.__slotHost:null,o=Ag(n)?n.__slotHost:null,s=r.__parent!==n.__parent||a!==o,c=o!==null&&i.parentElement!==t.element;if(s||c)return t.insertChild(i),fu(e,t.element)}}}let r=Gl.$createDOM(n,N);if(function(e,t,n){let r=n._keyToDOMMap;Hm(t,n,e),r.set(e,t)}(e,r,N),R(n)?r.setAttribute(`data-lexical-text`,`true`):U(n)&&(r.setAttribute(`data-lexical-decorator`,`true`),hg(r,{captureSelection:!0})),H(n)){let e=n.__indent,t=n.__size;$l(r,n),e!==0&&Zl(r,e);let i=ru(n),a=i.size>0?nu(n,r,i):``;if(t===0)r.__lexicalTextContent=a,r.__lexicalFirstTextKey=null,P+=a,i.size>0&&(r.__lexicalSlotTextLength=a.length);else{let e=P,o=t-1;if(cu(Eg(n,I),n,0,o,ig(n,r,N)),a!==``){let t=r.__lexicalTextContent||``;r.__lexicalTextContent=a+t,P=e+a+t}i.size>0&&(r.__lexicalSlotTextLength=a.length)}let o=n.__format;o!==0&&Ql(r,o),n.isInline()||lu(null,n,r)}else{let t=n.getTextContent();if(U(n)){let t=n.decorate(N,Al);t!==null&&pu(e,t),r.contentEditable=`false`;let i=ru(n);i.size>0&&nu(n,r,i)}P+=t}return t!==null&&t.insertChild(r),Gl.$decorateDOM(n,null,r,N),kl(n),uh(Wl,jl,Ll,n,`created`),r}function cu(e,t,n,r,i){let a=P,o=Pl();P=``,F=null,Ml=null,Nl=null;let s=n;for(;s<=r;++s){let t=Pl();su(e[s],i);let n=I.get(e[s]);n!==null&&R(n)?F===null&&(F=n.getFormat(),Ml=n.getStyle(),Nl=n.__key):H(n)&&s<r&&!n.isInline()&&(P+=`
|
|
130
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}}function Va(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Wa(t,`input`,e.processors),output:Wa(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Ha(e,t){let n=t??{seen:/* @__PURE__ */ new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Ha(r.element,n);if(r.type===`set`)return Ha(r.valueType,n);if(r.type===`lazy`)return Ha(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return Ha(r.innerType,n);if(r.type===`intersection`)return Ha(r.left,n)||Ha(r.right,n);if(r.type===`record`||r.type===`map`)return Ha(r.keyType,n)||Ha(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Ha(r.in,n)||Ha(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Ha(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Ha(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Ha(e,n))return!0;return!!(r.rest&&Ha(r.rest,n))}return!1}let Ua=(e,t={})=>n=>{let r=Ra({...n,processors:t});return za(e,r),Ba(r,e),Va(r,e)},Wa=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ra({...i??{},target:a,io:t,processors:n});return za(e,o),Ba(o,e),Va(o,e)},Ga={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Ka=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ga[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},qa=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Ja=(e,t,n,r)=>{n.type=`boolean`},Ya=(e,t,n,r)=>{n.not={}},Xa=(e,t,n,r)=>{let i=e._zod.def,a=Dt(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Za=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Qa=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},$a=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=za(a.element,t,{...r,path:[...r.path,`items`]})},eo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=za(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=za(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},to=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>za(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},no=(e,t,n,r)=>{let i=e._zod.def,a=za(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=za(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},ro=(e,t,n,r)=>{let i=e._zod.def,a=za(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},io=(e,t,n,r)=>{let i=e._zod.def;za(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ao=(e,t,n,r)=>{let i=e._zod.def;za(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},oo=(e,t,n,r)=>{let i=e._zod.def;za(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},so=(e,t,n,r)=>{let i=e._zod.def;za(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},co=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;za(o,t,r);let s=t.seen.get(e);s.ref=o},lo=(e,t,n,r)=>{let i=e._zod.def;za(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},uo=(e,t,n,r)=>{let i=e._zod.def;za(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},fo=/*@__PURE__*/ E(`ZodISODateTime`,(e,t)=>{Ir.init(e,t),A.init(e,t)});function po(e){return/* @__PURE__ */ aa(fo,e)}let mo=/*@__PURE__*/ E(`ZodISODate`,(e,t)=>{Lr.init(e,t),A.init(e,t)});function ho(e){return/* @__PURE__ */ oa(mo,e)}let go=/*@__PURE__*/ E(`ZodISOTime`,(e,t)=>{Rr.init(e,t),A.init(e,t)});function _o(e){return/* @__PURE__ */ sa(go,e)}let vo=/*@__PURE__*/ E(`ZodISODuration`,(e,t)=>{zr.init(e,t),A.init(e,t)});function yo(e){return/* @__PURE__ */ ca(vo,e)}let bo=/*@__PURE__*/ E(`ZodError`,(e,t)=>{un.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>pn(e,t)},flatten:{value:t=>fn(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Ot,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Ot,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),xo=/* @__PURE__ */ mn(bo),So=/* @__PURE__ */ hn(bo),Co=/* @__PURE__ */ gn(bo),wo=/* @__PURE__ */ vn(bo),To=/* @__PURE__ */ bn(bo),Eo=/* @__PURE__ */ xn(bo),Do=/* @__PURE__ */ Sn(bo),Oo=/* @__PURE__ */ Cn(bo),ko=/* @__PURE__ */ wn(bo),Ao=/* @__PURE__ */ Tn(bo),jo=/* @__PURE__ */ En(bo),Mo=/* @__PURE__ */ Dn(bo),No=/* @__PURE__ */ new WeakMap;function Po(e,t,n){let r=Object.getPrototypeOf(e),i=No.get(r);if(i||(i=/* @__PURE__ */ new Set,No.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}let Fo=/*@__PURE__*/ E(`ZodType`,(e,t)=>(Cr.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Wa(e,`input`),output:Wa(e,`output`)}}),e.toJSONSchema=Ua(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>xo(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Co(e,t,n),e.parseAsync=async(t,n)=>So(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>wo(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>To(e,t,n),e.decode=(t,n)=>Eo(e,t,n),e.encodeAsync=async(t,n)=>Do(e,t,n),e.decodeAsync=async(t,n)=>Oo(e,t,n),e.safeEncode=(t,n)=>ko(e,t,n),e.safeDecode=(t,n)=>Ao(e,t,n),e.safeEncodeAsync=async(t,n)=>jo(e,t,n),e.safeDecodeAsync=async(t,n)=>Mo(e,t,n),Po(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Ft(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Gt(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Gs(e,t))},superRefine(e,t){return this.check(Ks(e,t))},overwrite(e){return this.check(/* @__PURE__ */ Oa(e))},optional(){return Ds(this)},exactOptional(){return ks(this)},nullable(){return js(this)},nullish(){return Ds(js(this))},nonoptional(e){return Ls(this,e)},array(){return hs(this)},or(e){return ys([this,e])},and(e){return xs(this,e)},transform(e){return Vs(this,Ts(e))},default(e){return Ns(this,e)},prefault(e){return Fs(this,e)},catch(e){return zs(this,e)},pipe(e){return Vs(this,e)},readonly(){return Us(this)},describe(e){let t=this.clone();return Fi.add(t,{description:e}),t},meta(...e){if(e.length===0)return Fi.get(this);let t=this.clone();return Fi.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return Fi.get(e)?.description},configurable:!0}),e)),Io=/*@__PURE__*/ E(`_ZodString`,(e,t)=>{wr.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ka(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Po(e,`_ZodString`,{regex(...e){return this.check(/* @__PURE__ */ Sa(...e))},includes(...e){return this.check(/* @__PURE__ */ Ta(...e))},startsWith(...e){return this.check(/* @__PURE__ */ Ea(...e))},endsWith(...e){return this.check(/* @__PURE__ */ Da(...e))},min(...e){return this.check(/* @__PURE__ */ ba(...e))},max(...e){return this.check(/* @__PURE__ */ ya(...e))},length(...e){return this.check(/* @__PURE__ */ xa(...e))},nonempty(...e){return this.check(/* @__PURE__ */ ba(1,...e))},lowercase(e){return this.check(/* @__PURE__ */ Ca(e))},uppercase(e){return this.check(/* @__PURE__ */ wa(e))},trim(){return this.check(/* @__PURE__ */ Aa())},normalize(...e){return this.check(/* @__PURE__ */ ka(...e))},toLowerCase(){return this.check(/* @__PURE__ */ ja())},toUpperCase(){return this.check(/* @__PURE__ */ Ma())},slugify(){return this.check(/* @__PURE__ */ Na())}})}),Lo=/*@__PURE__*/ E(`ZodString`,(e,t)=>{wr.init(e,t),Io.init(e,t),e.email=t=>e.check(/* @__PURE__ */ Li(zo,t)),e.url=t=>e.check(/* @__PURE__ */ Ui(Ho,t)),e.jwt=t=>e.check(/* @__PURE__ */ ia(rs,t)),e.emoji=t=>e.check(/* @__PURE__ */ Wi(Uo,t)),e.guid=t=>e.check(/* @__PURE__ */ Ri(Bo,t)),e.uuid=t=>e.check(/* @__PURE__ */ zi(Vo,t)),e.uuidv4=t=>e.check(/* @__PURE__ */ Bi(Vo,t)),e.uuidv6=t=>e.check(/* @__PURE__ */ Vi(Vo,t)),e.uuidv7=t=>e.check(/* @__PURE__ */ Hi(Vo,t)),e.nanoid=t=>e.check(/* @__PURE__ */ Gi(Wo,t)),e.guid=t=>e.check(/* @__PURE__ */ Ri(Bo,t)),e.cuid=t=>e.check(/* @__PURE__ */ Ki(Go,t)),e.cuid2=t=>e.check(/* @__PURE__ */ qi(Ko,t)),e.ulid=t=>e.check(/* @__PURE__ */ Ji(qo,t)),e.base64=t=>e.check(/* @__PURE__ */ ta(es,t)),e.base64url=t=>e.check(/* @__PURE__ */ na(ts,t)),e.xid=t=>e.check(/* @__PURE__ */ Yi(Jo,t)),e.ksuid=t=>e.check(/* @__PURE__ */ Xi(Yo,t)),e.ipv4=t=>e.check(/* @__PURE__ */ Zi(Xo,t)),e.ipv6=t=>e.check(/* @__PURE__ */ Qi(Zo,t)),e.cidrv4=t=>e.check(/* @__PURE__ */ $i(Qo,t)),e.cidrv6=t=>e.check(/* @__PURE__ */ ea($o,t)),e.e164=t=>e.check(/* @__PURE__ */ ra(ns,t)),e.datetime=t=>e.check(po(t)),e.date=t=>e.check(ho(t)),e.time=t=>e.check(_o(t)),e.duration=t=>e.check(yo(t))});function Ro(e){return/* @__PURE__ */ Ii(Lo,e)}let A=/*@__PURE__*/ E(`ZodStringFormat`,(e,t)=>{k.init(e,t),Io.init(e,t)}),zo=/*@__PURE__*/ E(`ZodEmail`,(e,t)=>{Dr.init(e,t),A.init(e,t)}),Bo=/*@__PURE__*/ E(`ZodGUID`,(e,t)=>{Tr.init(e,t),A.init(e,t)}),Vo=/*@__PURE__*/ E(`ZodUUID`,(e,t)=>{Er.init(e,t),A.init(e,t)}),Ho=/*@__PURE__*/ E(`ZodURL`,(e,t)=>{Or.init(e,t),A.init(e,t)}),Uo=/*@__PURE__*/ E(`ZodEmoji`,(e,t)=>{kr.init(e,t),A.init(e,t)}),Wo=/*@__PURE__*/ E(`ZodNanoID`,(e,t)=>{Ar.init(e,t),A.init(e,t)}),Go=/*@__PURE__*/ E(`ZodCUID`,(e,t)=>{jr.init(e,t),A.init(e,t)}),Ko=/*@__PURE__*/ E(`ZodCUID2`,(e,t)=>{Mr.init(e,t),A.init(e,t)}),qo=/*@__PURE__*/ E(`ZodULID`,(e,t)=>{Nr.init(e,t),A.init(e,t)}),Jo=/*@__PURE__*/ E(`ZodXID`,(e,t)=>{Pr.init(e,t),A.init(e,t)}),Yo=/*@__PURE__*/ E(`ZodKSUID`,(e,t)=>{Fr.init(e,t),A.init(e,t)}),Xo=/*@__PURE__*/ E(`ZodIPv4`,(e,t)=>{Br.init(e,t),A.init(e,t)}),Zo=/*@__PURE__*/ E(`ZodIPv6`,(e,t)=>{Vr.init(e,t),A.init(e,t)}),Qo=/*@__PURE__*/ E(`ZodCIDRv4`,(e,t)=>{Hr.init(e,t),A.init(e,t)}),$o=/*@__PURE__*/ E(`ZodCIDRv6`,(e,t)=>{Ur.init(e,t),A.init(e,t)}),es=/*@__PURE__*/ E(`ZodBase64`,(e,t)=>{Gr.init(e,t),A.init(e,t)}),ts=/*@__PURE__*/ E(`ZodBase64URL`,(e,t)=>{qr.init(e,t),A.init(e,t)}),ns=/*@__PURE__*/ E(`ZodE164`,(e,t)=>{Jr.init(e,t),A.init(e,t)}),rs=/*@__PURE__*/ E(`ZodJWT`,(e,t)=>{Xr.init(e,t),A.init(e,t)}),is=/*@__PURE__*/ E(`ZodNumber`,(e,t)=>{Zr.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qa(e,t,n,r),Po(e,`ZodNumber`,{gt(e,t){return this.check(/* @__PURE__ */ ga(e,t))},gte(e,t){return this.check(/* @__PURE__ */ _a(e,t))},min(e,t){return this.check(/* @__PURE__ */ _a(e,t))},lt(e,t){return this.check(/* @__PURE__ */ ma(e,t))},lte(e,t){return this.check(/* @__PURE__ */ ha(e,t))},max(e,t){return this.check(/* @__PURE__ */ ha(e,t))},int(e){return this.check(ss(e))},safe(e){return this.check(ss(e))},positive(e){return this.check(/* @__PURE__ */ ga(0,e))},nonnegative(e){return this.check(/* @__PURE__ */ _a(0,e))},negative(e){return this.check(/* @__PURE__ */ ma(0,e))},nonpositive(e){return this.check(/* @__PURE__ */ ha(0,e))},multipleOf(e,t){return this.check(/* @__PURE__ */ va(e,t))},step(e,t){return this.check(/* @__PURE__ */ va(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function as(e){return/* @__PURE__ */ la(is,e)}let os=/*@__PURE__*/ E(`ZodNumberFormat`,(e,t)=>{Qr.init(e,t),is.init(e,t)});function ss(e){return/* @__PURE__ */ ua(os,e)}let cs=/*@__PURE__*/ E(`ZodBoolean`,(e,t)=>{$r.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ja(e,t,n,r)});function ls(e){return/* @__PURE__ */ da(cs,e)}let us=/*@__PURE__*/ E(`ZodUnknown`,(e,t)=>{ei.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function ds(){return/* @__PURE__ */ fa(us)}let fs=/*@__PURE__*/ E(`ZodNever`,(e,t)=>{ti.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ya(e,t,n,r)});function ps(e){return/* @__PURE__ */ pa(fs,e)}let ms=/*@__PURE__*/ E(`ZodArray`,(e,t)=>{ri.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$a(e,t,n,r),e.element=t.element,Po(e,`ZodArray`,{min(e,t){return this.check(/* @__PURE__ */ ba(e,t))},nonempty(e){return this.check(/* @__PURE__ */ ba(1,e))},max(e,t){return this.check(/* @__PURE__ */ ya(e,t))},length(e,t){return this.check(/* @__PURE__ */ xa(e,t))},unwrap(){return this.element}})});function hs(e,t){return/* @__PURE__ */ Pa(ms,e,t)}let gs=/*@__PURE__*/ E(`ZodObject`,(e,t)=>{ci.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eo(e,t,n,r),D(e,`shape`,()=>t.shape),Po(e,`ZodObject`,{keyof(){return Cs(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:ds()})},loose(){return this.clone({...this._zod.def,catchall:ds()})},strict(){return this.clone({...this._zod.def,catchall:ps()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Xt(this,e)},safeExtend(e){return Zt(this,e)},merge(e){return Qt(this,e)},pick(e){return Jt(this,e)},omit(e){return Yt(this,e)},partial(...e){return $t(Es,this,e[0])},required(...e){return en(Is,this,e[0])}})});function _s(e,t){let n={type:`object`,shape:e??{},...O(t)};return new gs(n)}let vs=/*@__PURE__*/ E(`ZodUnion`,(e,t)=>{ui.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>to(e,t,n,r),e.options=t.options});function ys(e,t){return new vs({type:`union`,options:e,...O(t)})}let bs=/*@__PURE__*/ E(`ZodIntersection`,(e,t)=>{di.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>no(e,t,n,r)});function xs(e,t){return new bs({type:`intersection`,left:e,right:t})}let Ss=/*@__PURE__*/ E(`ZodEnum`,(e,t)=>{mi.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xa(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Ss({...t,checks:[],...O(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Ss({...t,checks:[],...O(r),entries:i})}});function Cs(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Ss({type:`enum`,entries:n,...O(t)})}let ws=/*@__PURE__*/ E(`ZodTransform`,(e,t)=>{hi.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qa(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new wt(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(cn(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(cn(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Ts(e){return new ws({type:`transform`,transform:e})}let Es=/*@__PURE__*/ E(`ZodOptional`,(e,t)=>{_i.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ds(e){return new Es({type:`optional`,innerType:e})}let Os=/*@__PURE__*/ E(`ZodExactOptional`,(e,t)=>{vi.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ks(e){return new Os({type:`optional`,innerType:e})}let As=/*@__PURE__*/ E(`ZodNullable`,(e,t)=>{yi.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ro(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function js(e){return new As({type:`nullable`,innerType:e})}let Ms=/*@__PURE__*/ E(`ZodDefault`,(e,t)=>{bi.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ao(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ns(e,t){return new Ms({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ht(t)}})}let Ps=/*@__PURE__*/ E(`ZodPrefault`,(e,t)=>{Si.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Fs(e,t){return new Ps({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ht(t)}})}let Is=/*@__PURE__*/ E(`ZodNonOptional`,(e,t)=>{Ci.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ls(e,t){return new Is({type:`nonoptional`,innerType:e,...O(t)})}let Rs=/*@__PURE__*/ E(`ZodCatch`,(e,t)=>{Ti.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function zs(e,t){return new Rs({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}let Bs=/*@__PURE__*/ E(`ZodPipe`,(e,t)=>{Ei.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(e,t,n,r),e.in=t.in,e.out=t.out});function Vs(e,t){return new Bs({type:`pipe`,in:e,out:t})}let Hs=/*@__PURE__*/ E(`ZodReadonly`,(e,t)=>{Oi.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Us(e){return new Hs({type:`readonly`,innerType:e})}let Ws=/*@__PURE__*/ E(`ZodCustom`,(e,t)=>{Ai.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Za(e,t,n,r)});function Gs(e,t={}){return/* @__PURE__ */ Fa(Ws,e,t)}function Ks(e,t){return/* @__PURE__ */ Ia(e,t)}let qs=_s({source:Ro(),ref:Ro(),offset:as().int().nonnegative(),length:as().int().positive(),label:Ro(),appearance:Cs([`session`,`file`,`folder`]).optional(),clipboardText:Ro(),invalid:ls().optional()}),Js=_s({text:Ro(),references:hs(qs)}).refine(e=>{let t=0;for(let n of e.references)if(n.offset<t||n.length!==n.clipboardText.length||(t=n.offset+n.length,t>e.text.length||e.text.slice(n.offset,t)!==n.clipboardText))return!1;return!0},`Draft references must identify ordered, non-overlapping text spans`);function Ys(e){return typeof e==`string`?{text:e,references:[]}:{text:e.text,references:e.references.map(Qs)}}function Xs(e){if(typeof e==`string`)return Ys(e);let t=Js.safeParse(e);if(t.success)return{text:t.data.text,references:t.data.references.map(({appearance:e,invalid:t,...n})=>({...n,...e===void 0?{}:{appearance:e},...t===void 0?{}:{invalid:t}}))}}function Zs(e,t){return{text:e,references:t.map(Qs)}}function Qs(e){return{source:e.source,ref:e.ref,offset:e.offset,length:e.length,label:e.label,clipboardText:e.clipboardText,...e.appearance===void 0?{}:{appearance:e.appearance},...e.invalid===void 0?{}:{invalid:e.invalid}}}let $s=`dsh.conversation`;function ec(){return(0,f.defineStore)({init:()=>({draft:``,view:null,viewRequest:null}),persist:$s,actions:{setDraft:(e,t)=>{e.draft=t},setView:(e,t)=>{e.view=t},openView:(e,t,n)=>{e.view=t,e.viewRequest={view:t,focus:n}},completeViewRequest:e=>{e.viewRequest=null}}})}function tc(e){let t={text:``,references:[]};if(typeof localStorage>`u`)return t;try{let n=localStorage.getItem(`${$s}.${e}`);if(n===null)return t;let r=JSON.parse(n);return typeof r!=`object`||!r||!(`draft`in r)?t:Xs(r.draft)??t}catch{return t}}function nc(e){if(typeof localStorage>`u`)return null;try{let t=localStorage.getItem(`${$s}.${e}`);if(t===null)return null;let n=JSON.parse(t);return typeof n!=`object`||!n||!(`view`in n)?null:typeof n.view==`string`?n.view:null}catch{return null}}function rc(e,t){let n=e.kind===`directory`?`${e.path}/`:e.path;if(!/[\u0000-\u001f\u007f-\u009f"]/u.test(n))return t||/\s/u.test(n)?e.kind===`directory`?`@"${n}`:`@"${n}"`:`@${n}`}function ic(e){let t=e.replace(/[/\\]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return t.slice(n+1)}function ac(e,t){if(t===void 0||t===``)return e;let n=t.replace(/[/\\]+$/,``);return e.startsWith(`${n}/`)||e.startsWith(`${n}\\`)?e.slice(n.length+1):e}function oc(e){return{kind:`image`,id:ht(),previewUrl:URL.createObjectURL(e),file:e}}function sc(e){if(typeof Image!=`function`)return;let t=new Image;t.onload=()=>{e.width=t.naturalWidth,e.height=t.naturalHeight},t.src=e.previewUrl}function cc(){return new Promise(e=>{if(typeof requestAnimationFrame==`function`){if(typeof document<`u`&&document.visibilityState===`hidden`){setTimeout(e,0);return}let t=!1,n=()=>{t||(t=!0,clearTimeout(r),setTimeout(e,0))},r=setTimeout(n,100);requestAnimationFrame(n)}else setTimeout(e,0)})}function lc(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let e=r.result;t(e.slice(e.indexOf(`,`)+1))},r.onerror=()=>{n(r.error??/* @__PURE__ */ Error(`conversation: image read failed`))},r.readAsDataURL(e)})}var uc=class extends Error{mediaType;constructor(e){super(`unsupported image media type: ${e||`(empty)`}`),this.name=`UnsupportedImageMediaTypeError`,this.mediaType=e}},dc=class extends m.Service{input;blocks;fileUploads=(0,f.createSnapshotStore)({});draftAttachments=/* @__PURE__ */ new Map;fileUploadOperations=/* @__PURE__ */ new Map;pendingFileUploads=/* @__PURE__ */ new Set;fileUploadQueue=[];activeFileUploads=0;maxConcurrentFileUploads;constructor(e,t){super(e,`conversation`),this.input=t.input,this.blocks=t.blocks,this.maxConcurrentFileUploads=t.maxConcurrentFileUploads,e.effect(()=>async()=>{let e=[...this.fileUploadOperations.values()];for(let t of e)t.controller.abort();await Promise.allSettled([...this.pendingFileUploads]),this.fileUploadOperations.clear(),this.fileUploadQueue.length=0;for(let e of this.draftAttachments.values())e.kind===`image`&&mc(e.previewUrl);this.draftAttachments.clear(),this.fileUploads.set({})},`conversation draft attachments`)}async send(e){let t=await this.scopedSession(`send`).prompt([{type:`text`,text:e}],`queue`);if(!t.ok)throw Error(`conversation.send failed: ${t.error.code}: ${t.error.message}`)}async sendSession(e,t,n,r,i){let a=this.resolveDraftAttachments(n);if(a.length!==n.length)throw Error(`conversation.sendSession: one or more draft attachments are no longer available`);let o=this.fileUploads.getSnapshot(),s=e=>{let t=o[e.id];if(t===void 0||t.status!==`ready`)throw Error(`conversation.sendSession: one or more files have not finished uploading`);return t},c=a.map(e=>e.kind===`image`?{type:`image`,value:{previewUrl:e.previewUrl,...e.file.name===``?{}:{name:e.file.name},...e.width===void 0?{}:{width:e.width},...e.height===void 0?{}:{height:e.height}}}:{type:`file`,value:s(e).file}),l=()=>Promise.all(a.map(async e=>e.kind===`image`?{type:`image`,...await this.encodeImage(e.file)}:{type:`file`,receiptId:s(e).receiptId}));if(e.getSnapshot().subagent!==null){let n=[...await l(),...t===``?[]:[{type:`text`,text:t}]];return(await e.prompt(n,r,i)).ok?{kind:`success`}:{kind:`error`}}let u,d=a.length===0?void 0:new Promise(e=>{u=e}),f=e.beginSubmission({mode:r,text:t,attachments:c,onRetire:t=>{this.settleSubmittedAttachments(e.sessionId,a,t),u?.(t)}}),p;try{await cc(),p=[...await l(),...t===``?[]:[{type:`text`,text:t}]]}catch(e){throw f.abandon(),e}return!(await e.prompt(p,r,i,f.requestId)).ok||d!==void 0&&(await d).reason!==`observed`?{kind:`error`}:{kind:`success`}}createDrafts(e,t){return t.map(t=>{if(pc(t.type)){let e=oc(t);return this.draftAttachments.set(e.id,e),sc(e),e}let n={kind:`file`,id:ht(),file:t};return this.draftAttachments.set(n.id,n),this.beginFileUpload(e,n),n})}retryFileUpload(e,t){let n=this.draftAttachments.get(t);n!==void 0&&n.kind===`file`&&this.fileUploads.getSnapshot()[t]?.status===`error`&&this.beginFileUpload(e,n)}rebindDraftFiles(e,t){for(let n of t){let t=this.draftAttachments.get(n);t?.kind===`file`&&this.beginFileUpload(e,t)}}beginFileUpload(e,t){this.fileUploadOperations.get(t.id)?.controller.abort();let n=new AbortController;this.fileUploads.update(e=>{e[t.id]={status:`uploading`,loaded:0}});let r,i=new Promise(e=>{r=e});this.fileUploadOperations.set(t.id,{controller:n,done:i}),this.pendingFileUploads.add(i),i.then(()=>{this.pendingFileUploads.delete(i)}),this.fileUploadQueue.push({run:async()=>{try{if(n.signal.aborted||this.fileUploadOperations.get(t.id)?.controller!==n)return;let r=await this.ctx.fileUpload.upload(e,t.file,t.file.name===``?void 0:t.file.name,n.signal,e=>{this.fileUploadOperations.get(t.id)?.controller===n&&this.fileUploads.update(n=>{t.id in n&&(n[t.id]={status:`uploading`,loaded:e.loaded,...e.total===void 0?{}:{total:e.total}})})});if(this.fileUploadOperations.get(t.id)?.controller!==n)return;this.fileUploads.update(e=>{t.id in e&&(e[t.id]=r.ok?{status:`ready`,receiptId:r.value.receiptId,file:r.value.file}:{status:`error`,message:r.error.message})})}catch(e){if(this.fileUploadOperations.get(t.id)?.controller!==n)return;this.fileUploads.update(n=>{t.id in n&&(n[t.id]={status:`error`,message:e instanceof Error?e.message:String(e)})})}finally{this.fileUploadOperations.get(t.id)?.controller===n&&this.fileUploadOperations.delete(t.id)}},settle:r}),this.pumpFileUploads()}pumpFileUploads(){for(;this.activeFileUploads<this.maxConcurrentFileUploads;){let e=this.fileUploadQueue.shift();if(e===void 0)return;this.activeFileUploads+=1,e.run().finally(()=>{--this.activeFileUploads,e.settle(),this.pumpFileUploads()})}}resolveDraftAttachments(e){let t=[];for(let n of e){let e=this.draftAttachments.get(n);e!==void 0&&t.push(e)}return t}async serializeDraftAttachments(e){let t=this.resolveDraftAttachments(e);if(t.length!==e.length)throw Error(`conversation.serializeDraftAttachments: one or more draft attachments are no longer available`);let n=this.fileUploads.getSnapshot();return{attachments:await Promise.all(t.map(async e=>{if(e.kind===`image`)return{type:`image`,...await this.encodeImage(e.file)};let t=n[e.id];if(t===void 0||t.status!==`ready`)throw Error(`conversation.serializeDraftAttachments: one or more files have not finished uploading`);return{type:`file`,receiptId:t.receiptId}}))}}releaseDraftAttachment(e){let t=this.draftAttachments.get(e);if(t===void 0)return;let n=this.fileUploadOperations.get(e);this.fileUploadOperations.delete(e),n?.controller.abort(),this.draftAttachments.delete(e),t.kind===`image`?mc(t.previewUrl):this.fileUploads.set(Object.fromEntries(Object.entries(this.fileUploads.getSnapshot()).filter(([t])=>t!==e)))}releaseDraftAttachments(e){for(let t of e)this.releaseDraftAttachment(t.id)}async updateQueue(e,t){let n=await this.scopedSession(`updateQueue`).updateQueue(e,t);if(!n.ok){if(t.kind===`steer`&&(n.error.code===`session/steer-unavailable`||n.error.code===`session/queue-item-not-found`))return;throw Error(`conversation.updateQueue failed: ${n.error.code}: ${n.error.message}`)}}async cancel(){let e=await this.scopedSession(`cancel`).cancel();if(!e.ok)throw Error(`conversation.cancel failed: ${e.error.code}: ${e.error.message}`)}async loadOlder(){await this.scopedSession(`loadOlder`).loadOlder()}scopedSession(e){let t=this.scopeId(e),n=this.requireSessions().binding(t);if(n===void 0)throw Error(`conversation.${e}: session "${t}" resolved no binding`);return n.session}scopeId(e){let t=this.requireSessions().scopeOf(this.ctx);if(t===void 0)throw Error(`conversation.${e} requires a session scope — address one via ctx.sessions.scope(id).conversation`);return t}requireSessions(){let e=this.ctx.get(`sessions`);if(e===void 0)throw Error(`conversation: sessions service unavailable`);return e}settleSubmittedAttachments(e,t,n){if(n.reason!==`observed`)return;let r=this.ctx.get(`uiConversation`),i=0;for(let a of t){let t=this.draftAttachments.get(a.id),o=n.attachments[i++];t!==void 0&&(a.kind===`file`?this.releaseDraftAttachment(a.id):(this.draftAttachments.delete(a.id),!(o!==void 0&&`mediaType`in o&&r?.seedImageUrl(e,o,a.previewUrl)===!0)&&mc(a.previewUrl)))}}async encodeImage(e){return{mediaType:fc(e.type),data:await lc(e),...e.name===``?{}:{name:e.name}}}};function fc(e){switch(e){case`image/png`:case`image/jpeg`:case`image/webp`:case`image/gif`:return e;default:throw new uc(e)}}function pc(e){return e===`image/png`||e===`image/jpeg`||e===`image/webp`||e===`image/gif`}function mc(e){e.startsWith(`blob:`)&&URL.revokeObjectURL(e)}var hc=class{stores=/* @__PURE__ */ new Map;set(e,t){let n=this.storeFor(e);n.getSnapshot()?.reason!==t?.reason&&n.set(t)}storeFor(e){let t=this.stores.get(e);if(t!==void 0)return t;let n=(0,f.createSnapshotStore)(void 0);return this.stores.set(e,n),n}forget(e){this.stores.delete(e)}};function gc(e){throw Error(`unreachable input event: ${JSON.stringify(e)}`)}function _c(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 vc(e,t){return e.startsWith(t)||e===t.trimEnd()}var yc=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.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 gc(e)}}onDraftChanged(e){return this.phase===`claimed`&&this.claim!==void 0&&!vc(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){if(this.phase===`adjudicating`||this.phase===`submitting`)return[];if(this.phase===`claimed`&&this.claim!==void 0){let r=this.beginAttempt(e,t,n);return this.phase=`submitting`,[{type:`begin-submit`,attempt:r,claim:this.claim,args:_c(t,this.claim.token)}]}let r=t.trim();if(r===``)return[];if(r.startsWith(`/`)){let r=this.beginAttempt(e,t,n);return this.phase=`adjudicating`,[{type:`adjudicate`,attempt:r,draft:t}]}return this.detachedEffects(this.beginDetached(e,t,n))}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:_c(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&&vc(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 j(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 bc(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);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let xc=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,Sc=xc&&`documentMode`in document?document.documentMode:null,Cc=xc&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),wc=xc&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Tc=!(!xc||!(`InputEvent`in window)||Sc)&&`getTargetRanges`in new window.InputEvent(`input`),Ec=xc&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Dc=xc&&/Android/.test(navigator.userAgent),Oc=xc&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!Dc,kc=xc&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ac=xc&&Dc&&kc,jc=xc&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Cc&&!kc,Mc=Oc||Ec||jc?`\xA0`:``,Nc=wc?`\xA0`:Mc,Pc=`֑-߿יִ-﷽ﹰ-ﻼ`,Fc=`A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--`;RegExp(`^[^`+Fc+`]*[`+Pc+`]`),RegExp(`^[^`+Pc+`]*[`+Fc+`]`);let Ic={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Lc={directionless:1,unmergeable:2},Rc={center:2,end:6,justify:4,left:1,right:3,start:5},zc={2:`center`,6:`end`,4:`justify`,1:`left`,3:`right`,5:`start`},Bc={normal:0,segmented:2,token:1},Vc={0:`normal`,2:`segmented`,1:`token`},Hc=`$config`;function Uc(){return rg()._blockCursorElement}function Wc(e){return e!==null&&e.nodeType===1&&e.hasAttribute(`data-lexical-slot`)}var Gc=class e{element;before;after;constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}insertChild(e){let t=this.getInsertionAnchor();return t!==null&&t.parentElement!==this.element&&j(357),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&j(358),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&j(359),this.element.replaceChild(e,t),this}getFirstChild(){let e=this.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;return t===this.getInsertionAnchor()?null:t}getFirstChildAnchor(){return this.after}resolveLeafPosition(e,t,n){if(this.element===e)return t===e&&n===0?`before`:`after`;let r=Kc(e,this.element);if(r===null)return`after`;let i=Array.prototype.indexOf.call(e.childNodes,r);if(i<0)return`after`;if(t===e)return n<=i?`before`:`after`;let a=Kc(e,t);if(a===null)return`after`;let o=Array.prototype.indexOf.call(e.childNodes,a);return o>=0&&o<=i?`before`:`after`}getInsertionAnchor(){return this.before}};function Kc(e,t){let n=t;for(;n!==null&&n.parentNode!==e;)n=n.parentNode;return n}var qc=class e extends Gc{withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()}getFirstChildAnchor(){let e=super.getFirstChildAnchor(),t=e?e.nextSibling:this.element.firstChild;for(;Wc(t);)e=t,t=t.nextSibling;let n=e?e.nextSibling:this.element.firstChild;return n!==null&&n===Uc()?n:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(this.element.__lexicalLastChildKind=e,e===null)this.removeManagedLineBreak();else{let t=e===`decorator`&&(jc||Ec||Oc);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){let e=this.getManagedLineBreak();if(e){let t=this.element,n=e.nodeName===`IMG`?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){let t=this.getManagedLineBreak();if(t){if(e===(t.nodeName===`IMG`))return;this.removeManagedLineBreak()}let n=this.element,r=this.before,i=Bh().createElement(`br`);if(i.setAttribute(`data-lexical-managed-linebreak`,`true`),n.insertBefore(i,r),e){let e=Bh().createElement(`img`);e.setAttribute(`data-lexical-managed-linebreak`,`true`),e.style.setProperty(`display`,`inline`,`important`),e.style.setProperty(`border`,`0px`,`important`),e.style.setProperty(`margin`,`0px`,`important`),e.alt=``,n.insertBefore(e,i),n.__lexicalLineBreak=e}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=this.getFirstChild(),t=this.getInsertionAnchor(),n=0;for(let r=this.element.firstChild;r!==null&&r!==e&&r!==t;r=r.nextSibling)n++;return n}resolveChildIndex(e,t,n,r){if(n===this.element){let t=this.getFirstChildOffset(),n=Uc(),i=this.element.childNodes,a=Math.min(r,i.length),o=0;for(let e=t;e<a;e++)i[e]!==n&&o++;return[e,Math.min(o,e.getChildrenSize())]}let i=Jc(t,n);i.push(r);let a=Jc(t,this.element),o=e.getIndexWithinParent();for(let e=0;e<a.length;e++){let t=i[e],n=a[e];if(t===void 0||t<n)break;if(t>n){o+=1;break}}return[e.getParentOrThrow(),o]}};function Jc(e,t){let n=[],r=t;for(;r!==e&&r!==null;r=r.parentNode){let e=0;for(let t=r.previousSibling;t!==null;t=t.previousSibling)e++;n.push(e)}return r!==e&&j(225),n.reverse()}let Yc;try{Yc=`0.49.0+prod.esm`}catch{}let Xc=Yc??`"<unknown>+source"`;var Zc=class{_front=/* @__PURE__ */ new Set;_back=/* @__PURE__ */ new Set;_cache;get size(){return this._front.size+this._back.size}addBack(e){return delete this._cache,this._front.has(e)||this._back.add(e),this}addFront(e){return delete this._cache,this._back.has(e)||this._front.add(e),this}delete(e){return delete this._cache,this._front.delete(e)||this._back.delete(e)}toArray(){let e=Array.from(this._front).reverse();for(let t of this._back)e.push(t);return e}toReadonlyArray(){return this._cache=this._cache||this.toArray(),this._cache}[Symbol.iterator](){return this.toReadonlyArray()[Symbol.iterator]()}};function Qc(e,t=1e3){return e instanceof $c?e.clone():e.size<t?new Map(e):new $c().init(new Map(e),void 0,e.size)}var $c=class e{_mutable=!1;_old=void 0;_nursery=void 0;_size=0;clone(){return this._mutable=!1,new e().init(this._old,this._nursery,this._size)}init(e,t,n){return this._old=e,this._nursery=t,this._size=n,this}get size(){return this._size}has(e){return this.get(e)!==void 0}getWithTombstone(e){let t=this._nursery&&this._nursery.get(e);return t===void 0?this._old&&this._old.get(e):t}get(e){let t=this.getWithTombstone(e);return t===null?void 0:t}shouldCompact(){return this._nursery!==void 0&&2*this._nursery.size>this._size}getNursery(){return this._mutable&&this._nursery||(this.compact(),this._nursery=new Map(this._nursery),this._mutable=!0),this._nursery}compact(e=!1){if(this._nursery&&this._nursery.size>0&&(e||this.shouldCompact())){let e=new Map(this._old);for(let[t,n]of this._nursery)n===null?e.delete(t):e.set(t,n);this._old=e,this._nursery=void 0}return this._mutable=!1,this}set(e,t){let n=this.getWithTombstone(e);if(n===t)return this;let r=this.getNursery();return n??(this._size++,n===null&&r.delete(e)),r.set(e,t),this}delete(e){let t=this.has(e);return t&&(this.getNursery().set(e,null),this._size--),t}getOrInsert(e,t){let n=this.get(e);return n===void 0?(this.set(e,t),t):n}getOrInsertComputed(e,t){let n=this.get(e);if(n!==void 0)return n;let r=t(e);return this.set(e,r),r}clear(){this._mutable=!1,this._old=void 0,this._nursery=void 0,this._size=0}*keys(){for(let e of this.entries())yield e[0]}*values(){for(let e of this.entries())yield e[1]}*entries(){let e=this._nursery,t=this._old;if(t)for(let n of t){let t=n[0],r=e?e.get(t):void 0;r!==null&&(r!==void 0&&(n[1]=r),yield n)}if(e)for(let n of e)n[1]===null||t&&t.has(n[0])||(yield n)}forEach(e,t){t!==void 0&&(e=e.bind(t));for(let[t,n]of this.entries())e(n,t,this)}get[Symbol.toStringTag](){return`GenMap`}[Symbol.iterator](){return this.entries()}};function el(e,t,n,r,i,a){if(V(e)){let o=e.getFirstChild();for(;o!==null;){let e=o.__key;o.__parent===t&&((V(o)||Ag(o)&&o.__slots!==null)&&el(o,e,n,r,i,a),n.has(e)||a.delete(e),i.push(e)),o=o.getNextSibling()}}for(let o of Ag(e)&&e.__slots!==null?e.__slots.values():[]){let e=r.get(o);e!==void 0&&jg(e)&&e.__slotHost===t&&((V(e)||Ag(e)&&e.__slots!==null)&&el(e,o,n,r,i,a),n.has(o)||a.delete(o),i.push(o))}}let tl=!1,nl=0;function rl(e){nl=e.timeStamp}function il(e,t,n){let r=e.nodeName===`BR`,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&Wm(e,n)!==void 0}function al(e,t,n){let r=Nh(Sh(n)),i=r&&Uh(r,n._rootElement),a=null,o=null;i!==null&&i.anchorNode===e&&(a=i.anchorOffset,o=i.focusOffset);let s=e.nodeValue;s!==null&&nh(t,s,a,o,!1)}function ol(e,t,n){if(R(e)){let t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return Nm(t)&&n.isAttached()}function sl(e,t,n){for(let r=e;r&&!_g(r);r=gh(r)){let e=Wm(r,t);if(e!==void 0){let t=U(e,n);if(t)return H(t)||!q(r)?void 0:[r,t]}}}function cl(e,t,n){tl=!0;let r=performance.now()-nl>100;try{Vp(e,()=>{let i=z()||function(e){return e.read(`latest`,()=>{let e=z();return e===null?null:e.clone()})}(e),a=/* @__PURE__ */ new Map,o=e._editorState,s=e._blockCursorElement,c=!1,l=``;for(let n=0;n<t.length;n++){let u=t[n],d=u.type,f=u.target,p=sl(f,e,o);if(!p)continue;let[m,h]=p;if(d===`characterData`)r&&L(h)&&Nm(f)&&ol(i,f,h)&&al(f,h,e);else if(d===`childList`){c=!0;let t=u.addedNodes;for(let n=0;n<t.length;n++){let r=t[n],i=Hm(r),a=r.parentNode;if(!(a==null||r===s||i!==null||il(r,a,e)||e._slotsUsed&&q(r)&&r.hasAttribute(`data-lexical-slot`)||_g(r))){if(wc){let e=(q(r)?r.innerText:null)||r.nodeValue;e&&(l+=e)}a.removeChild(r)}}let n=u.removedNodes,r=n.length;if(r>0){let t=0;for(let i=0;i<r;i++){let r=n[i];(il(r,f,e)||s===r)&&(f.appendChild(r),t++)}r!==t&&a.set(m,h)}}}if(a.size>0)for(let[t,n]of a)n.reconcileObservedMutation(t,e);let u=n.takeRecords();if(u.length>0){for(let t=0;t<u.length;t++){let n=u[t],r=n.addedNodes,i=n.target;for(let t=0;t<r.length;t++){let n=r[t],a=n.parentNode;a==null||n.nodeName!==`BR`||il(n,i,e)||a.removeChild(n)}}n.takeRecords()}i!==null&&(c&&Jm(i),wc&&mh(e)&&i.insertRawText(l))})}finally{tl=!1}}function ll(e){let t=e._observer;t!==null&&cl(e,t.takeRecords(),t)}function ul(e){(function(e){nl===0&&Sh(e).addEventListener(`textInput`,rl,!0)})(e),e._observer=new MutationObserver((t,n)=>{cl(e,t,n)})}var dl=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||yl).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function fl(e,t){return new dl(e,t)}function pl(e){let t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Set;for(let{ownNodeConfig:r}of wg(typeof e==`function`?e:e.replace))if(r&&r.stateConfigs)for(let e of r.stateConfigs){let r;`stateConfig`in e?(r=e.stateConfig,e.flat&&n.add(r.key)):r=e,t.set(r.key,r)}return{flatKeys:n,sharedConfigMap:t}}let ml=/* @__PURE__ */ new Set([`__proto__`,`constructor`,`prototype`]);var hl=class e{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,n=void 0,r=/* @__PURE__ */ new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=n,this.knownState=r;let{sharedConfigMap:a}=this.sharedNodeState,o=i===void 0?function(e,t,n){let r=n.size;if(t)for(let i in t){let t=e.get(i);t&&n.has(t)||r++}return r}(a,n,r):i;this.size=o}getValue(e){let t=this.knownState.get(e);if(t!==void 0)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){let t=this.unknownState[e.key];t!==void 0&&(n=e.parse(t)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let e={...this.unknownState},t={};for(let[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);for(let n of this.sharedNodeState.flatKeys)n in e&&(t[n]=e[n],delete e[n]);return vl(e)&&(t.$=e),t}getWritable(t){if(this.node===t)return this;let{sharedNodeState:n,unknownState:r}=this,i=new Map(this.knownState);return new e(t,n,function(e,t,n){let r;if(n)for(let[i,a]of Object.entries(n)){if(ml.has(i))continue;let n=e.get(i);n?t.has(n)||t.set(n,n.parse(a)):(r||={},r[i]=a)}return r}(n.sharedConfigMap,i,r),i,this.size)}resetOnCopyNode(){for(let e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){let n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);let{knownState:r,unknownState:i}=this;r.has(e)||i&&n in i||(i&&(delete i[n],this.unknownState=vl(i)),this.size++),r.set(e,t)}updateFromUnknown(e,t){if(ml.has(e))return;let n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){let{knownState:t}=this;for(let e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(let[t,n]of Object.entries(e))this.updateFromUnknown(t,n)}};function gl(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new hl(t,_l(t));return t.__state=n,n}function _l(e){return e.__state?e.__state.sharedNodeState:Cm(rg(),e.getType()).sharedNodeState}function vl(e){if(e)for(let t in e)return e}function yl(e){return e}function bl(e,t,n){for(let[r,i]of t.knownState){if(e.has(r.key))continue;e.add(r.key);let t=n?n.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return!0}return!1}function xl(e,t,n){let{unknownState:r}=t,i=n?n.unknownState:void 0;if(r){for(let[t,n]of Object.entries(r))if(!e.has(t)&&(e.add(t),n!==(i?i[t]:void 0)))return!0}return!1}function Sl(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function Cl(e,t){let n=e.__mode,r=e.__format,i=e.__style,a=t.__mode,o=t.__format,s=t.__style,c=e.__state,l=t.__state;return(n===null||n===a)&&(r===null||r===o)&&(i===null||i===s)&&(e.__state===null||c===l||function(e,t){if(e===t)return!0;let n=/* @__PURE__ */ new Set;return!(e&&bl(n,e,t)||t&&bl(n,t,e)||e&&xl(n,e,t)||t&&xl(n,t,e))}(c,l))}function wl(e,t){let n=e.mergeWithSibling(t),r=B()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function Tl(e){let t,n,r=e;if(r.__text!==``||!r.isSimpleText()||r.isUnmergeable()){for(;(t=r.getPreviousSibling())!==null&&L(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==``){if(Cl(t,r)){r=wl(t,r);break}break}t.remove()}for(;(n=r.getNextSibling())!==null&&L(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==``){if(Cl(r,n)){r=wl(r,n);break}break}n.remove()}}else r.remove()}function El(e){return Dl(e.anchor),Dl(e.focus),e}function Dl(e){for(;e.type===`element`;){let t=e.getNode(),n=e.offset,r,i;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),i=!0):(r=t.getChildAtIndex(n),i=!1),L(r)){e.set(r.__key,i?r.getTextContentSize():0,`text`,!0);break}if(!V(r))break;e.set(r.__key,i?r.getChildrenSize():0,`element`,!0)}}let Ol=Symbol.for(`@lexical/CachedTextSize`);function kl(e,t){return Hl.read(()=>{let n=0,r=e;for(let e=0;e<t&&r!==null;e++){let i=Vl.get(r);if(i===void 0&&j(345,r),V(i)){let a=F.get(r);if(a!==void 0&&V(a)&&a.__parent!==i.__parent)n+=i.getTextContentSize();else{let e=Ul.get(r),t=e&&e.__lexicalTextContent;typeof t!=`string`&&j(346,i.getType()),n+=t.length}e<t-1&&!i.isInline()&&(n+=2)}else{let e=i[Ol];e===void 0&&j(347,i.getType(),r),n+=e}r=i.__next}return n},{editor:M})}function Al(e){V(e)||e[Ol]===void 0&&(e[Ol]=L(e)?e.__text.length:e.getTextContentSize())}let jl,M,Ml,N=``,P=null,Nl=null,Pl=null;function Fl(){return{firstTextKey:Pl,format:P,style:Nl}}function Il(e){e.firstTextKey!==null&&(P=e.format,Nl=e.style,Pl=e.firstTextKey)}function Ll(e){if(Pl!==null)return;let t=e.__lexicalFirstTextKey;if(t===void 0&&j(348),t===null)return;let n=F.get(t);L(n)&&(P=n.getFormat(),Nl=n.getStyle(),Pl=t)}let Rl,zl,Bl,Vl,Hl,F,Ul,Wl,Gl,Kl,ql=!1,Jl=!1;function Yl(e,t){let n=Vl.get(e),r=F.has(e);if(t!==null){let n=vu(e);n.parentNode===t&&t.removeChild(n)}if(!r){if(M._keyToDOMMap.delete(e),V(n)){let e=Dg(n,Vl);Xl(e,0,e.length-1,null)}if(n!==void 0){for(let e of iu(n).values()){let t=ou(e);Yl(e,null),t!==null&&t.remove()}dh(Gl,Ml,Rl,n,`destroyed`)}}}function Xl(e,t,n,r){for(let i=t;i<=n;++i){let t=e[i];t!==void 0&&Yl(t,r)}}function Zl(e,t){e.setProperty(`text-align`,t)}function Ql(e,t){let n=jl.theme.indent;if(typeof n==`string`){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}e.style.setProperty(`padding-inline-start`,t===0?``:`calc(${t} * var(--lexical-indent-base-value, 40px))`)}function $l(e,t){let n=e.style;t===0?Zl(n,``):t===1?Zl(n,`left`):t===2?Zl(n,`center`):t===3?Zl(n,`right`):t===4?Zl(n,`justify`):t===5?Zl(n,`start`):t===6&&Zl(n,`end`)}function eu(e,t){let n=function(e){let t=e.__dir;if(t!==null)return t;if(qp(e))return null;let n=e.getParent();return n===null||Eh(n)&&n.__dir===null?`auto`:null}(t);n===null?e.removeAttribute(`dir`):e.dir=n}function tu(e){let t=Bh().createElement(`div`);return t.setAttribute(`data-lexical-slot`,e),t.style.display=`none`,t}function nu(e,t,n){t||e.contentEditable===`false`?vg(n,M):n.removeAttribute(`contenteditable`)}function ru(e,t,n){let r=N,i=Fl();N=``;let a=``,o=H(e);for(let[r,i]of n){let n=tu(r);nu(t,o,n),t.appendChild(n),N=``;let s=Fl();cu(i,ag(e,n,M)),Il(s),au(e,r,t,n),a+=N}return Il(i),N=r,a}function iu(e){return Ag(e)&&e.__slots!==null?e.__slots:kg}function au(e,t,n,r){let i=Kl.$getSlotTargetElement(e,t,n,M);i!==null&&(r.parentElement!==i&&i.appendChild(r),r.style.display=``)}function ou(e){let t=Ul.get(e);return t===void 0?null:t.parentElement}function su(e,t,n){let r=iu(e),i=iu(t);for(let[e,t]of r)if(!i.has(e)){let e=ou(t);Yl(t,null),e!==null&&e.remove()}let a=N,o=Fl(),s=``,c=null,l=H(t);for(let[e,a]of i){let i=r.get(e),o=i===void 0?null:ou(i);N=``;let u=Fl();if(o===null){o=tu(e);let r=null;for(let e of n.children)if(!e.hasAttribute(`data-lexical-slot`)){r=e;break}n.insertBefore(o,r),cu(a,ag(t,o,M))}else i===a?pu(a,o):(i!==void 0&&Yl(i,o),cu(a,ag(t,o,M)));if(Il(u),nu(n,l,o),au(t,e,n,o),s+=N,o.parentElement===n){let e=c===null?n.firstChild:c.nextSibling;e!==o&&n.insertBefore(o,e),c=o}}return Il(o),N=a,s}function cu(e,t){let n=F.get(e);if(n===void 0&&j(60),t!==null){let r=Vl.get(e);if(r!==void 0){let i=Ul.get(e);if(i!==void 0){let a=jg(r)?r.__slotHost:null,o=jg(n)?n.__slotHost:null,s=r.__parent!==n.__parent||a!==o,c=o!==null&&i.parentElement!==t.element;if(s||c)return t.insertChild(i),pu(e,t.element)}}}let r=Kl.$createDOM(n,M);if(function(e,t,n){let r=n._keyToDOMMap;Um(t,n,e),r.set(e,t)}(e,r,M),L(n)?r.setAttribute(`data-lexical-text`,`true`):H(n)&&(r.setAttribute(`data-lexical-decorator`,`true`),gg(r,{captureSelection:!0})),V(n)){let e=n.__indent,t=n.__size;eu(r,n),e!==0&&Ql(r,e);let i=iu(n),a=i.size>0?ru(n,r,i):``;if(t===0)r.__lexicalTextContent=a,r.__lexicalFirstTextKey=null,N+=a,i.size>0&&(r.__lexicalSlotTextLength=a.length);else{let e=N,o=t-1;if(lu(Dg(n,F),n,0,o,ag(n,r,M)),a!==``){let t=r.__lexicalTextContent||``;r.__lexicalTextContent=a+t,N=e+a+t}i.size>0&&(r.__lexicalSlotTextLength=a.length)}let o=n.__format;o!==0&&$l(r,o),n.isInline()||uu(null,n,r)}else{let t=n.getTextContent();if(H(n)){let t=n.decorate(M,jl);t!==null&&mu(e,t),r.contentEditable=`false`;let i=iu(n);i.size>0&&ru(n,r,i)}N+=t}return t!==null&&t.insertChild(r),Kl.$decorateDOM(n,null,r,M),Al(n),dh(Gl,Ml,Rl,n,`created`),r}function lu(e,t,n,r,i){let a=N,o=Fl();N=``,P=null,Nl=null,Pl=null;let s=n;for(;s<=r;++s){let t=Fl();cu(e[s],i);let n=F.get(e[s]);n!==null&&L(n)?P===null&&(P=n.getFormat(),Nl=n.getStyle(),Pl=n.__key):V(n)&&s<r&&!n.isInline()&&(N+=`
|
|
131
131
|
|
|
132
|
-
`),
|
|
132
|
+
`),Il(t)}let c=M._keyToDOMMap.get(t.__key);c===void 0&&j(349,t.__key),c.__lexicalTextContent=N,c.__lexicalFirstTextKey=Pl,N=a+N,Il(o)}function uu(e,t,n){let r=ag(t,n,M),i=r.element.__lexicalLastChildKind??null,a=function(e,t){if(e){let n=e.__last;if(n){let e=t.get(n);if(e)return rm(e)?`line-break`:H(e)&&e.isInline()?`decorator`:null}return iu(e).size>0?null:`empty`}return null}(t,F);i!==a&&r.setManagedLineBreak(a)}function du(e,t,n){var r;P=null,Nl=null,Pl=null,function(e,t,n){let r=N,i=e.__size,a=t.__size;N=``;let o=n.element,s=M._keyToDOMMap.get(t.__key);s===void 0&&j(351,t.__key);let c=a-i;if(!ql&&Math.abs(c)<=1&&i>=4&&e.__first===t.__first&&(c!==0||!M._cloneNotNeeded.has(e.__key))){let i=s.__lexicalTextContent,l=Wl.get(e.__key);if(!ql&&typeof i==`string`&&l!==void 0){let a=function(e,t){let n=t.size;if(n===0||n>=e.__size)return null;let r=e.__last,i=null,a=0;for(;r!==null&&a<n;){if(!t.has(r))return null;i=r;let e=F.get(r);if(e===void 0)return null;r=e.__prev,a++}return a!==n||r!==null&&t.has(r)?null:i}(t,l);if(a!==null){let u=l.size;if(c===0){let e=kl(a,u),n=a,c=0;for(;n!==null&&c<u;){let e=F.get(n);if(e===void 0)break;let t=Fl();pu(n,o),L(e)&&P===null&&(P=e.getFormat(),Nl=e.getStyle(),Pl=e.__key),Il(t),n=e.__next,c++}let d=``;for(n=a,c=0;n!==null&&c<u;){let e=F.get(n);if(e===void 0)break;let t;if(V(e)){let r=M._keyToDOMMap.get(n),i=r&&r.__lexicalTextContent;typeof i!=`string`&&j(352,e.getType()),t=i}else t=e.getTextContent();d+=t,c<u-1&&V(e)&&!e.isInline()&&(d+=`
|
|
133
133
|
|
|
134
|
-
`),n=e.__next,c++}let f=s.__lexicalSlotTextLength||0,p=f>0?i.slice(f):i,m=p.slice(0,p.length-e)+d;s.__lexicalTextContent=m,
|
|
134
|
+
`),n=e.__next,c++}let f=s.__lexicalSlotTextLength||0,p=f>0?i.slice(f):i,m=p.slice(0,p.length-e)+d;s.__lexicalTextContent=m,N=r+m,fu(t,s,l);return}if(function(e,t,n,r,i,a,o,s){if(s!==1&&s!==-1||o!==(s===1?2:1))return!1;let c=o-s,l=e.__last;for(let e=0;e<c-1;e++){if(l===null)return!1;let e=Vl.get(l);if(e===void 0)return!1;l=e.__prev}if(l===null)return!1;let u=F.get(a),d=Vl.get(l);if(u===void 0||d===void 0||u.__prev!==d.__prev)return!1;let f=[],p=a;for(let e=0;e<o;e++){if(p===null)return!1;f.push(p);let e=F.get(p);p=e?e.__next:null}let m=[];p=l;for(let e=0;e<c;e++){if(p===null)return!1;m.push(p);let e=Vl.get(p);p=e?e.__next:null}let h=new Set(m),g=new Set(f),_=[],v=0,y=0;for(;v<c&&y<o;)if(f[y]===m[v])_.push({key:f[y],kind:`reconcile`}),v++,y++;else if(g.has(m[v])){if(h.has(f[y]))return!1;_.push({key:f[y],kind:`create`,nextIndex:y}),y++}else _.push({key:m[v],kind:`destroy`}),v++;for(;v<c;)_.push({key:m[v++],kind:`destroy`});for(;y<o;)_.push({key:f[y],kind:`create`,nextIndex:y}),y++;let ee=kl(l,c);for(let e of _){let t=Fl();if(e.kind===`reconcile`)pu(e.key,n.element);else if(e.kind===`destroy`)Yl(e.key,n.element);else{let t=null;for(let n=e.nextIndex+1;n<o;n++){let e=M._keyToDOMMap.get(f[n]);if(e!==void 0){t=e;break}}cu(e.key,n.withBefore(t??n.before))}if(e.kind!==`destroy`){let t=F.get(e.key);t&&L(t)&&P===null&&(P=t.getFormat(),Nl=t.getStyle(),Pl=t.__key)}Il(t)}let b=``;for(let e=0;e<o;e++){let t=F.get(f[e]);if(t===void 0)return!1;let n;if(V(t)){let r=M._keyToDOMMap.get(f[e]),i=r&&r.__lexicalTextContent;typeof i!=`string`&&j(350,t.getType()),n=i}else n=t.getTextContent();b+=n,e<o-1&&V(t)&&!t.isInline()&&(b+=`
|
|
135
135
|
|
|
136
|
-
`)}let x=r.__lexicalSlotTextLength||0,S=x>0?i.slice(x):i;return r.__lexicalTextContent=S.slice(0,S.length-ee)+b,!0}(e,0,n,s,i,a,u,c)){let e=s.__lexicalTextContent;typeof e!=`string`&&
|
|
136
|
+
`)}let x=r.__lexicalSlotTextLength||0,S=x>0?i.slice(x):i;return r.__lexicalTextContent=S.slice(0,S.length-ee)+b,!0}(e,0,n,s,i,a,u,c)){let e=s.__lexicalTextContent;typeof e!=`string`&&j(353),N=r+e,fu(t,s,l);return}}}if(c===0){let t=e.__first,n=0;for(;t!==null;){let e=F.get(t);if(e===void 0)break;let r=ql||Bl.has(t)||zl.has(t),i=Fl();if(r)pu(t,o);else{let n,r;if(V(e)){r=Ul.get(t);let i=r&&r.__lexicalTextContent;typeof i!=`string`&&j(354,e.getType()),n=i}else n=e.getTextContent();N+=n,r!==void 0&&Ll(r)}L(e)?P===null&&(P=e.getFormat(),Nl=e.getStyle(),Pl=e.__key):V(e)&&n<a-1&&!e.isInline()&&(N+=`
|
|
137
137
|
|
|
138
|
-
`),
|
|
138
|
+
`),Il(i),t=e.__next,n++}s.__lexicalTextContent=N,s.__lexicalFirstTextKey=Pl,N=r+N;return}}if(i===1&&a===1){let r=e.__first,i=t.__first;if(r===i)pu(r,o);else{let e=vu(r),t=cu(i,null);try{e.parentNode===o?o.replaceChild(t,e):n.insertChild(t)}catch(n){if(typeof n==`object`&&n){let a=`${n.toString()} Parent: ${o.tagName}, new child: {tag: ${t.tagName} key: ${i}}, old child: {tag: ${e.tagName}, key: ${r}}.`;throw Error(a)}throw n}Yl(r,null)}let a=F.get(i);L(a)&&P===null&&(P=a.getFormat(),Nl=a.getStyle(),Pl=a.__key)}else{let r=Dg(e,Vl),s=Dg(t,F);if(r.length!==i&&j(227),s.length!==a&&j(228),i===0)a!==0&&lu(s,t,0,a-1,n);else if(a===0){if(i!==0){let e=n.after==null&&n.before==null&&iu(t).size===0&&n.element.__lexicalLineBreak==null;Xl(r,0,i-1,e?null:o),e&&(o.textContent=``)}}else(function(e,t,n,r,i,a){let o=r-1,s=i-1,c,l,u=a.getFirstChild(),d=0,f=0;for(;d<=o&&f<=s;){let e=t[d],r=n[f],i=Fl();if(e===r)u=hu(pu(r,a.element)),d++,f++;else{if(l===void 0&&(l=gu(n,f)),c===void 0)c=gu(t,d);else if(!c.has(e)){d++,Il(i);continue}if(!l.has(e)){u=hu(vu(e)),Yl(e,a.element),d++,c.delete(e),Il(i);continue}if(c.has(r)){let e=hh(M,r);e!==u&&a.withBefore(u??a.before).insertChild(e),u=hu(pu(r,a.element)),d++,f++}else cu(r,a.withBefore(u??a.before)),f++}let o=F.get(r);o!==null&&L(o)?P===null&&(P=o.getFormat(),Nl=o.getStyle(),Pl=o.__key):V(o)&&f<=s&&!o.isInline()&&(N+=`
|
|
139
139
|
|
|
140
|
-
`),Fl(i)}let p=d>o,m=f>s;if(p&&!m){let t=n[s+1],r=t===void 0?null:N.getElementByKey(t);cu(n,e,f,s,a.withBefore(r??a.before))}else m&&!p&&Yl(t,d,o,a.element)})(t,r,s,i,a,n)}s.__lexicalTextContent=P,s.__lexicalFirstTextKey=Nl,P=r+P}(e,t,ig(t,n,N)),Th(t)||(r=t,F==null||F===r.__textFormat||ql||r.setTextFormat(F),function(e){Ml==null||Ml===e.__textStyle||ql||e.setTextStyle(Ml)}(t))}function du(e,t,n){let r=t.__lexicalFirstTextKey;if(r!=null){let t=e.__key,i=r;for(;i!==null;){let e=I.get(i);if(e===void 0){i=null;break}if(e.__parent===t)break;i=e.__parent}if(i!==null&&!n.has(i)){let e=I.get(r);if(R(e))return F=e.getFormat(),void(Ml=e.getStyle())}}t.__lexicalFirstTextKey=Nl}function fu(e,t){let n=Bl.get(e),r=I.get(e);n!==void 0&&r!==void 0||M(61);let i=Kl||zl.has(e)||Rl.has(e),a=mh(N,e);if(n===r&&!i){let e;if(H(n)){let t=a.__lexicalTextContent;typeof t!=`string`&&M(355,n.getType()),e=t,Il(a)}else e=n.getTextContent();return P+=e,a}if(n!==r&&i&&uh(Wl,jl,Ll,r,`updated`),Gl.$updateDOM(r,n,a,N)){let n=su(e,null);return t===null&&M(62),t.replaceChild(n,a),Jl(e,null),n}if(H(n)){H(r)||M(334,e);let t=r.__indent;(Kl||t!==n.__indent)&&Zl(a,t);let o=r.__format;(Kl||o!==n.__format)&&Ql(a,o);let s=i&&(ru(r).size>0||ru(n).size>0)?ou(n,r,a):``;if(i){let e=P;if(uu(n,r,a),Kp(r)||r.isInline()||lu(0,r,a),s!==``){let t=a.__lexicalTextContent||``;a.__lexicalTextContent=s+t,P=e+s+t,a.__lexicalSlotTextLength=s.length}else(ru(r).size>0||ru(n).size>0)&&(a.__lexicalSlotTextLength=0)}else{let e=a.__lexicalTextContent;typeof e!=`string`&&M(356,n.getType()),P+=e,Il(a)}if((Kl||r.__dir!==n.__dir||r.__parent!==n.__parent)&&($l(a,r),Kp(r)&&!Kl))for(let e of r.getChildren())H(e)&&$l(mh(N,e.getKey()),e)}else{let t=r.getTextContent();if(U(r)){let t=r.decorate(N,Al);t!==null&&pu(e,t),i&&(ru(r).size>0||ru(n).size>0)&&ou(n,r,a)}P+=t}if(!ql&&Kp(r)){let e=r.getLatest();if(e.__cachedText!==P){let t=e.getWritable();t.__cachedText=P,r=t}}return Gl.$decorateDOM(r,n,a,N),kl(r),a}function pu(e,t){let n=N._pendingDecorators,r=N._decorators;if(n===null){if(r[e]===t)return;n=Gm(N)}n[e]=t}function mu(e){let t=e.nextSibling;return t!==null&&t===N._blockCursorElement&&(t=t.nextSibling),t}function hu(e,t){let n=/* @__PURE__ */ new Set;for(let r=t;r<e.length;r++)n.add(e[r]);return n}function gu(e,t,n,r,i,a){P=``,F=null,Ml=null,Nl=null,Kl=r===2,N=n,Al=n._config,Gl=n._config.dom||pm,jl=n._nodes,Ll=N._listeners.mutation,Rl=i,zl=a,Bl=e._nodeMap,Vl=e,I=t._nodeMap,ql=t._readOnly,Hl=Zc(n._keyToDOMMap),Ul=function(){let e=/* @__PURE__ */ new Map,t=t=>{for(let n of t){let t=I.get(n);if(t===void 0)continue;let r=t.__parent;if(r===null)continue;let i=e.get(r);i===void 0&&(i=/* @__PURE__ */ new Set,e.set(r,i)),i.add(n)}};return t(Rl.keys()),t(zl),e}();let o=/* @__PURE__ */ new Map;return Wl=o,fu(`root`,null),N=void 0,jl=void 0,Rl=void 0,zl=void 0,Bl=void 0,Vl=void 0,I=void 0,Al=void 0,Hl=void 0,Ul=void 0,Wl=void 0,Gl=pm,o}function _u(e){let t=Hl.get(e);return t===void 0&&M(75,e),t}function L(e){return{type:e}}let vu=/* @__PURE__ */ L(`SELECTION_CHANGE_COMMAND`),yu=/* @__PURE__ */ L(`CLICK_COMMAND`),bu=/* @__PURE__ */ L(`BEFORE_INPUT_COMMAND`),xu=/* @__PURE__ */ L(`INPUT_COMMAND`),Su=/* @__PURE__ */ L(`COMPOSITION_START_COMMAND`),Cu=/* @__PURE__ */ L(`COMPOSITION_END_COMMAND`),wu=/* @__PURE__ */ L(`DELETE_CHARACTER_COMMAND`),Tu=/* @__PURE__ */ L(`INSERT_LINE_BREAK_COMMAND`),Eu=/* @__PURE__ */ L(`INSERT_PARAGRAPH_COMMAND`),Du=/* @__PURE__ */ L(`CONTROLLED_TEXT_INSERTION_COMMAND`),Ou=/* @__PURE__ */ L(`PASTE_COMMAND`),ku=/* @__PURE__ */ L(`REMOVE_TEXT_COMMAND`),Au=/* @__PURE__ */ L(`DELETE_WORD_COMMAND`),ju=/* @__PURE__ */ L(`DELETE_LINE_COMMAND`),Mu=/* @__PURE__ */ L(`FORMAT_TEXT_COMMAND`),Nu=/* @__PURE__ */ L(`UNDO_COMMAND`),Pu=/* @__PURE__ */ L(`REDO_COMMAND`),Fu=/* @__PURE__ */ L(`KEYDOWN_COMMAND`),Iu=/* @__PURE__ */ L(`KEY_ARROW_RIGHT_COMMAND`),Lu=/* @__PURE__ */ L(`MOVE_TO_END`),Ru=/* @__PURE__ */ L(`KEY_ARROW_LEFT_COMMAND`),zu=/* @__PURE__ */ L(`MOVE_TO_START`),Bu=/* @__PURE__ */ L(`KEY_ARROW_UP_COMMAND`),Vu=/* @__PURE__ */ L(`KEY_ARROW_DOWN_COMMAND`),Hu=/* @__PURE__ */ L(`KEY_ENTER_COMMAND`),Uu=/* @__PURE__ */ L(`KEY_SPACE_COMMAND`),Wu=/* @__PURE__ */ L(`KEY_BACKSPACE_COMMAND`),Gu=/* @__PURE__ */ L(`KEY_ESCAPE_COMMAND`),Ku=/* @__PURE__ */ L(`KEY_DELETE_COMMAND`),qu=/* @__PURE__ */ L(`KEY_TAB_COMMAND`),Ju=/* @__PURE__ */ L(`DROP_COMMAND`),Yu=/* @__PURE__ */ L(`DRAGSTART_COMMAND`),Xu=/* @__PURE__ */ L(`DRAGOVER_COMMAND`),Zu=/* @__PURE__ */ L(`DRAGEND_COMMAND`),Qu=/* @__PURE__ */ L(`COPY_COMMAND`),$u=/* @__PURE__ */ L(`CUT_COMMAND`),ed=/* @__PURE__ */ L(`SELECT_ALL_COMMAND`),td=/* @__PURE__ */ L(`CLEAR_EDITOR_COMMAND`),nd=/* @__PURE__ */ L(`CLEAR_HISTORY_COMMAND`),rd=/* @__PURE__ */ L(`CAN_REDO_COMMAND`),id=/* @__PURE__ */ L(`CAN_UNDO_COMMAND`),ad=/* @__PURE__ */ L(`FOCUS_COMMAND`),od=/* @__PURE__ */ L(`BLUR_COMMAND`),sd=/* @__PURE__ */ L(`KEY_MODIFIER_COMMAND`);function cd(e){let t=/* @__PURE__ */ new Map;return{dispose(){for(let e of t.values())e.dispose();t.clear()},register(n,r){let i=t.get(n);i===void 0&&(i={dispose:e(n,r),holders:/* @__PURE__ */ new Set},t.set(n,i));let a=()=>{let e=t.get(n);e&&e.holders.delete(a)&&e.holders.size===0&&(t.delete(n),e.dispose())};return i.holders.add(a),a}}}function ld(e,t,n,r){return e.addEventListener(t,n,r),e.removeEventListener.bind(e,t,n,r)}let ud=Object.freeze({}),dd=[[`keydown`,function(e,t){let n=t._inputState;n.lastKeyDownTimeStamp=e.timeStamp,n.lastKeyCode=e.key,e.key!==`Backspace`&&Sd(n),!t.isComposing()&&q(t,Fu,e)}],[`pointerdown`,function(e,t){let n=Jh(e),r=e.pointerType;Yh(n)&&r!==`touch`&&r!==`pen`&&e.button===0&&Bp(t,()=>{vg(n,t)||(t._inputState.isSelectionChangeFromMouseDown=!0)})}],[`compositionstart`,function(e,t){q(t,Su,e)}],[`compositionend`,function(e,t){let n=t._inputState;Cc?n.compositionPhase=`ending-firefox`:Tc||!Dc&&!Ac?q(t,Cu,e):(n.compositionPhase=`ending-safari`,n.compositionEndData=e.data)}],[`input`,function(e,t){e.stopPropagation();let n=t._inputState;Sd(n),Bp(t,()=>{wd(e,t)||t.dispatchCommand(xu,e)},{event:e}),n.unprocessedBeforeInputData=null}],[`click`,function(e,t){Bp(t,()=>{let n=B(),r=Mh(xh(t)),i=Zf();if(r){if(z(n)){let e=n.anchor,t=e.getNode();e.type===`element`&&e.offset===0&&n.isCollapsed()&&!Kp(t)&&G().getChildrenSize()===1&&t.getTopLevelElementOrThrow().isEmpty()&&i!==null&&n.is(i)&&(r.removeAllRanges(),n.dirty=!0)}else if(e.pointerType===`touch`||e.pointerType===`pen`){let n=Hh(r,t._rootElement).anchorNode;(J(n)||Mm(n))&&qm(Xf(i,r,t,e))}}if(Cc&&r!==null&&r.rangeCount===0){let n=t._rootElement;if(n!==null&&e.target===n){let a=e.clientY,o=n.childNodes.length;for(let e=0;e<n.childNodes.length;e++){let t=n.childNodes[e];if(J(t)){let n=t.getBoundingClientRect();if(a<=(n.top+n.bottom)/2){o=e;break}}}r.setBaseAndExtent(n,o,n,o);let s=Xf(i,r,t,e);s===null?r.removeAllRanges():qm(s)}}q(t,yu,e)})}],[`cut`,ud],[`copy`,ud],[`dragstart`,ud],[`dragover`,ud],[`dragend`,ud],[`paste`,ud],[`focus`,ud],[`blur`,ud],[`drop`,ud]];wc&&dd.push([`beforeinput`,(e,t)=>function(e,t){let n=e.inputType;n===`deleteCompositionText`||Cc&&ph(t)||n!==`insertCompositionText`&&Bp(t,()=>{wd(e,t)||q(t,bu,e)},{event:e})}(e,t)]);let fd=/* @__PURE__ */ new WeakMap,pd=/* @__PURE__ */ new WeakMap,md=cd(e=>(e.addEventListener(`selectionchange`,Pd),()=>e.removeEventListener(`selectionchange`,Pd)));function hd(e,t,n,r,i,a){let o=e.anchor,s=e.focus,c=o.getNode(),l=V(),u;if(a!==void 0)u=a;else{let e=Mh(xh(l));u=e===null?null:Hh(e,l._rootElement)}let d=u===null?null:u.anchorNode,f=o.key,p=l.getElementByKey(f),m=n.length;return f!==s.key||!R(c)||(!i&&(!wc||l._inputState.lastBeforeInputInsertTextTimeStamp<r+50)||c.isDirty()&&m<2||Xm(n))&&o.offset!==s.offset&&!c.isComposing()||jm(c)||c.isDirty()&&m>1||(i||!wc)&&p!==null&&!c.isComposing()&&d!==og(c,p,l)||u!==null&&t!==null&&(!t.collapsed||t.startContainer!==u.anchorNode||t.startOffset!==u.anchorOffset)||!c.isComposing()&&(c.getFormat()!==e.format||c.getStyle()!==e.style)||function(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;let n=e.anchor.offset,r=t.getParentOrThrow(),i=Am(t);return n===0?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){let t=e.getPreviousSibling();return(R(t)||H(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,c)}function gd(e,t){return Mm(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function _d(e,t,n){let{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}=Hh(e,t._rootElement),s=t._inputState;s.isSelectionChangeFromDOMUpdate&&(s.isSelectionChangeFromDOMUpdate=!1,gd(r,i)&&gd(a,o)&&!s.postDeleteSelectionToRestore)||Bp(t,()=>{if(!n)return void qm(null);if(!Em(t,r,a))return;let c=B();if(s.postDeleteSelectionToRestore&&z(c)&&c.isCollapsed()){let e=c.anchor,t=s.postDeleteSelectionToRestore.anchor;(e.key===t.key&&e.offset===t.offset+1||e.offset===1&&t.getNode().is(e.getNode().getPreviousSibling()))&&(c=s.postDeleteSelectionToRestore.clone(),qm(c))}if(s.postDeleteSelectionToRestore=null,z(c)){let n=c.anchor,l=n.getNode();if(c.isCollapsed()){e.type===`Range`&&r===a&&(c.dirty=!0);let i=xh(t).event,o=i?i.timeStamp:performance.now(),{format:u,style:d,offset:f,key:p,timeStamp:m}=s.collapsedSelectionFormat,h=G(),g=!1===t.isComposing()&&h.getTextContent()===``;if(o<m+200&&n.offset===f&&n.key===p)vd(c,u,d);else if(n.type===`text`)R(l)||M(141),yd(c,l);else if(n.type===`element`&&!g){H(l)||M(259);let e=n.getNode();e.isEmpty()?function(e,t){vd(e,t.getTextFormat(),t.getTextStyle())}(c,e):vd(c,c.format,``)}}else{let e=n.key,t=c.focus.key,r=c.getNodes(),a=r.length,s=c.isBackward(),l=s?o:i,u=s?i:o,d=s?t:e,f=s?e:t,p=2047,m=!1;for(let e=0;e<a;e++){let t=r[e],n=t.getTextContentSize();if(R(t)&&n!==0&&!(e===0&&t.__key===d&&l===n||e===a-1&&t.__key===f&&u===0)&&(m=!0,p&=t.getFormat(),p===0))break}c.format=m?p:0}}q(t,vu)})}function vd(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function yd(e,t){vd(e,t.getFormat(),t.getStyle())}function bd(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function xd(e){let{lastKeyCode:t}=V()._inputState;if(e==null||e.length<=1||t==null)return;let n=t.length===1?t:t===`Enter`?`
|
|
141
|
-
`:t===`Tab`?` `:null;if(!n)return;let r=
|
|
142
|
-
`){if(
|
|
143
|
-
`)e.preventDefault(),
|
|
140
|
+
`),Il(i)}let p=d>o,m=f>s;if(p&&!m){let t=n[s+1],r=t===void 0?null:M.getElementByKey(t);lu(n,e,f,s,a.withBefore(r??a.before))}else m&&!p&&Xl(t,d,o,a.element)})(t,r,s,i,a,n)}s.__lexicalTextContent=N,s.__lexicalFirstTextKey=Pl,N=r+N}(e,t,ag(t,n,M)),Eh(t)||(r=t,P==null||P===r.__textFormat||Jl||r.setTextFormat(P),function(e){Nl==null||Nl===e.__textStyle||Jl||e.setTextStyle(Nl)}(t))}function fu(e,t,n){let r=t.__lexicalFirstTextKey;if(r!=null){let t=e.__key,i=r;for(;i!==null;){let e=F.get(i);if(e===void 0){i=null;break}if(e.__parent===t)break;i=e.__parent}if(i!==null&&!n.has(i)){let e=F.get(r);if(L(e))return P=e.getFormat(),void(Nl=e.getStyle())}}t.__lexicalFirstTextKey=Pl}function pu(e,t){let n=Vl.get(e),r=F.get(e);n!==void 0&&r!==void 0||j(61);let i=ql||Bl.has(e)||zl.has(e),a=hh(M,e);if(n===r&&!i){let e;if(V(n)){let t=a.__lexicalTextContent;typeof t!=`string`&&j(355,n.getType()),e=t,Ll(a)}else e=n.getTextContent();return N+=e,a}if(n!==r&&i&&dh(Gl,Ml,Rl,r,`updated`),Kl.$updateDOM(r,n,a,M)){let n=cu(e,null);return t===null&&j(62),t.replaceChild(n,a),Yl(e,null),n}if(V(n)){V(r)||j(334,e);let t=r.__indent;(ql||t!==n.__indent)&&Ql(a,t);let o=r.__format;(ql||o!==n.__format)&&$l(a,o);let s=i&&(iu(r).size>0||iu(n).size>0)?su(n,r,a):``;if(i){let e=N;if(du(n,r,a),qp(r)||r.isInline()||uu(0,r,a),s!==``){let t=a.__lexicalTextContent||``;a.__lexicalTextContent=s+t,N=e+s+t,a.__lexicalSlotTextLength=s.length}else(iu(r).size>0||iu(n).size>0)&&(a.__lexicalSlotTextLength=0)}else{let e=a.__lexicalTextContent;typeof e!=`string`&&j(356,n.getType()),N+=e,Ll(a)}if((ql||r.__dir!==n.__dir||r.__parent!==n.__parent)&&(eu(a,r),qp(r)&&!ql))for(let e of r.getChildren())V(e)&&eu(hh(M,e.getKey()),e)}else{let t=r.getTextContent();if(H(r)){let t=r.decorate(M,jl);t!==null&&mu(e,t),i&&(iu(r).size>0||iu(n).size>0)&&su(n,r,a)}N+=t}if(!Jl&&qp(r)){let e=r.getLatest();if(e.__cachedText!==N){let t=e.getWritable();t.__cachedText=N,r=t}}return Kl.$decorateDOM(r,n,a,M),Al(r),a}function mu(e,t){let n=M._pendingDecorators,r=M._decorators;if(n===null){if(r[e]===t)return;n=Km(M)}n[e]=t}function hu(e){let t=e.nextSibling;return t!==null&&t===M._blockCursorElement&&(t=t.nextSibling),t}function gu(e,t){let n=/* @__PURE__ */ new Set;for(let r=t;r<e.length;r++)n.add(e[r]);return n}function _u(e,t,n,r,i,a){N=``,P=null,Nl=null,Pl=null,ql=r===2,M=n,jl=n._config,Kl=n._config.dom||mm,Ml=n._nodes,Rl=M._listeners.mutation,zl=i,Bl=a,Vl=e._nodeMap,Hl=e,F=t._nodeMap,Jl=t._readOnly,Ul=Qc(n._keyToDOMMap),Wl=function(){let e=/* @__PURE__ */ new Map,t=t=>{for(let n of t){let t=F.get(n);if(t===void 0)continue;let r=t.__parent;if(r===null)continue;let i=e.get(r);i===void 0&&(i=/* @__PURE__ */ new Set,e.set(r,i)),i.add(n)}};return t(zl.keys()),t(Bl),e}();let o=/* @__PURE__ */ new Map;return Gl=o,pu(`root`,null),M=void 0,Ml=void 0,zl=void 0,Bl=void 0,Vl=void 0,Hl=void 0,F=void 0,jl=void 0,Ul=void 0,Wl=void 0,Gl=void 0,Kl=mm,o}function vu(e){let t=Ul.get(e);return t===void 0&&j(75,e),t}function I(e){return{type:e}}let yu=/* @__PURE__ */ I(`SELECTION_CHANGE_COMMAND`),bu=/* @__PURE__ */ I(`CLICK_COMMAND`),xu=/* @__PURE__ */ I(`BEFORE_INPUT_COMMAND`),Su=/* @__PURE__ */ I(`INPUT_COMMAND`),Cu=/* @__PURE__ */ I(`COMPOSITION_START_COMMAND`),wu=/* @__PURE__ */ I(`COMPOSITION_END_COMMAND`),Tu=/* @__PURE__ */ I(`DELETE_CHARACTER_COMMAND`),Eu=/* @__PURE__ */ I(`INSERT_LINE_BREAK_COMMAND`),Du=/* @__PURE__ */ I(`INSERT_PARAGRAPH_COMMAND`),Ou=/* @__PURE__ */ I(`CONTROLLED_TEXT_INSERTION_COMMAND`),ku=/* @__PURE__ */ I(`PASTE_COMMAND`),Au=/* @__PURE__ */ I(`REMOVE_TEXT_COMMAND`),ju=/* @__PURE__ */ I(`DELETE_WORD_COMMAND`),Mu=/* @__PURE__ */ I(`DELETE_LINE_COMMAND`),Nu=/* @__PURE__ */ I(`FORMAT_TEXT_COMMAND`),Pu=/* @__PURE__ */ I(`UNDO_COMMAND`),Fu=/* @__PURE__ */ I(`REDO_COMMAND`),Iu=/* @__PURE__ */ I(`KEYDOWN_COMMAND`),Lu=/* @__PURE__ */ I(`KEY_ARROW_RIGHT_COMMAND`),Ru=/* @__PURE__ */ I(`MOVE_TO_END`),zu=/* @__PURE__ */ I(`KEY_ARROW_LEFT_COMMAND`),Bu=/* @__PURE__ */ I(`MOVE_TO_START`),Vu=/* @__PURE__ */ I(`KEY_ARROW_UP_COMMAND`),Hu=/* @__PURE__ */ I(`KEY_ARROW_DOWN_COMMAND`),Uu=/* @__PURE__ */ I(`KEY_ENTER_COMMAND`),Wu=/* @__PURE__ */ I(`KEY_SPACE_COMMAND`),Gu=/* @__PURE__ */ I(`KEY_BACKSPACE_COMMAND`),Ku=/* @__PURE__ */ I(`KEY_ESCAPE_COMMAND`),qu=/* @__PURE__ */ I(`KEY_DELETE_COMMAND`),Ju=/* @__PURE__ */ I(`KEY_TAB_COMMAND`),Yu=/* @__PURE__ */ I(`DROP_COMMAND`),Xu=/* @__PURE__ */ I(`DRAGSTART_COMMAND`),Zu=/* @__PURE__ */ I(`DRAGOVER_COMMAND`),Qu=/* @__PURE__ */ I(`DRAGEND_COMMAND`),$u=/* @__PURE__ */ I(`COPY_COMMAND`),ed=/* @__PURE__ */ I(`CUT_COMMAND`),td=/* @__PURE__ */ I(`SELECT_ALL_COMMAND`),nd=/* @__PURE__ */ I(`CLEAR_EDITOR_COMMAND`),rd=/* @__PURE__ */ I(`CLEAR_HISTORY_COMMAND`),id=/* @__PURE__ */ I(`CAN_REDO_COMMAND`),ad=/* @__PURE__ */ I(`CAN_UNDO_COMMAND`),od=/* @__PURE__ */ I(`FOCUS_COMMAND`),sd=/* @__PURE__ */ I(`BLUR_COMMAND`),cd=/* @__PURE__ */ I(`KEY_MODIFIER_COMMAND`);function ld(e){let t=/* @__PURE__ */ new Map;return{dispose(){for(let e of t.values())e.dispose();t.clear()},register(n,r){let i=t.get(n);i===void 0&&(i={dispose:e(n,r),holders:/* @__PURE__ */ new Set},t.set(n,i));let a=()=>{let e=t.get(n);e&&e.holders.delete(a)&&e.holders.size===0&&(t.delete(n),e.dispose())};return i.holders.add(a),a}}}function ud(e,t,n,r){return e.addEventListener(t,n,r),e.removeEventListener.bind(e,t,n,r)}let dd=Object.freeze({}),fd=[[`keydown`,function(e,t){let n=t._inputState;n.lastKeyDownTimeStamp=e.timeStamp,n.lastKeyCode=e.key,e.key!==`Backspace`&&Cd(n),!t.isComposing()&&K(t,Iu,e)}],[`pointerdown`,function(e,t){let n=Yh(e),r=e.pointerType;Xh(n)&&r!==`touch`&&r!==`pen`&&e.button===0&&Vp(t,()=>{yg(n,t)||(t._inputState.isSelectionChangeFromMouseDown=!0)})}],[`compositionstart`,function(e,t){K(t,Cu,e)}],[`compositionend`,function(e,t){let n=t._inputState;wc?n.compositionPhase=`ending-firefox`:Ec||!Oc&&!jc?K(t,wu,e):(n.compositionPhase=`ending-safari`,n.compositionEndData=e.data)}],[`input`,function(e,t){e.stopPropagation();let n=t._inputState;Cd(n),Vp(t,()=>{Td(e,t)||t.dispatchCommand(Su,e)},{event:e}),n.unprocessedBeforeInputData=null}],[`click`,function(e,t){Vp(t,()=>{let n=z(),r=Nh(Sh(t)),i=Qf();if(r){if(R(n)){let e=n.anchor,t=e.getNode();e.type===`element`&&e.offset===0&&n.isCollapsed()&&!qp(t)&&W().getChildrenSize()===1&&t.getTopLevelElementOrThrow().isEmpty()&&i!==null&&n.is(i)&&(r.removeAllRanges(),n.dirty=!0)}else if(e.pointerType===`touch`||e.pointerType===`pen`){let n=Uh(r,t._rootElement).anchorNode;(q(n)||Nm(n))&&Jm(Zf(i,r,t,e))}}if(wc&&r!==null&&r.rangeCount===0){let n=t._rootElement;if(n!==null&&e.target===n){let a=e.clientY,o=n.childNodes.length;for(let e=0;e<n.childNodes.length;e++){let t=n.childNodes[e];if(q(t)){let n=t.getBoundingClientRect();if(a<=(n.top+n.bottom)/2){o=e;break}}}r.setBaseAndExtent(n,o,n,o);let s=Zf(i,r,t,e);s===null?r.removeAllRanges():Jm(s)}}K(t,bu,e)})}],[`cut`,dd],[`copy`,dd],[`dragstart`,dd],[`dragover`,dd],[`dragend`,dd],[`paste`,dd],[`focus`,dd],[`blur`,dd],[`drop`,dd]];Tc&&fd.push([`beforeinput`,(e,t)=>function(e,t){let n=e.inputType;n===`deleteCompositionText`||wc&&mh(t)||n!==`insertCompositionText`&&Vp(t,()=>{Td(e,t)||K(t,xu,e)},{event:e})}(e,t)]);let pd=/* @__PURE__ */ new WeakMap,md=/* @__PURE__ */ new WeakMap,hd=ld(e=>(e.addEventListener(`selectionchange`,Fd),()=>e.removeEventListener(`selectionchange`,Fd)));function gd(e,t,n,r,i,a){let o=e.anchor,s=e.focus,c=o.getNode(),l=B(),u;if(a!==void 0)u=a;else{let e=Nh(Sh(l));u=e===null?null:Uh(e,l._rootElement)}let d=u===null?null:u.anchorNode,f=o.key,p=l.getElementByKey(f),m=n.length;return f!==s.key||!L(c)||(!i&&(!Tc||l._inputState.lastBeforeInputInsertTextTimeStamp<r+50)||c.isDirty()&&m<2||Zm(n))&&o.offset!==s.offset&&!c.isComposing()||Mm(c)||c.isDirty()&&m>1||(i||!Tc)&&p!==null&&!c.isComposing()&&d!==sg(c,p,l)||u!==null&&t!==null&&(!t.collapsed||t.startContainer!==u.anchorNode||t.startOffset!==u.anchorOffset)||!c.isComposing()&&(c.getFormat()!==e.format||c.getStyle()!==e.style)||function(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;let n=e.anchor.offset,r=t.getParentOrThrow(),i=jm(t);return n===0?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){let t=e.getPreviousSibling();return(L(t)||V(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,c)}function _d(e,t){return Nm(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function vd(e,t,n){let{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}=Uh(e,t._rootElement),s=t._inputState;s.isSelectionChangeFromDOMUpdate&&(s.isSelectionChangeFromDOMUpdate=!1,_d(r,i)&&_d(a,o)&&!s.postDeleteSelectionToRestore)||Vp(t,()=>{if(!n)return void Jm(null);if(!Dm(t,r,a))return;let c=z();if(s.postDeleteSelectionToRestore&&R(c)&&c.isCollapsed()){let e=c.anchor,t=s.postDeleteSelectionToRestore.anchor;(e.key===t.key&&e.offset===t.offset+1||e.offset===1&&t.getNode().is(e.getNode().getPreviousSibling()))&&(c=s.postDeleteSelectionToRestore.clone(),Jm(c))}if(s.postDeleteSelectionToRestore=null,R(c)){let n=c.anchor,l=n.getNode();if(c.isCollapsed()){e.type===`Range`&&r===a&&(c.dirty=!0);let i=Sh(t).event,o=i?i.timeStamp:performance.now(),{format:u,style:d,offset:f,key:p,timeStamp:m}=s.collapsedSelectionFormat,h=W(),g=!1===t.isComposing()&&h.getTextContent()===``;if(o<m+200&&n.offset===f&&n.key===p)yd(c,u,d);else if(n.type===`text`)L(l)||j(141),bd(c,l);else if(n.type===`element`&&!g){V(l)||j(259);let e=n.getNode();e.isEmpty()?function(e,t){yd(e,t.getTextFormat(),t.getTextStyle())}(c,e):yd(c,c.format,``)}}else{let e=n.key,t=c.focus.key,r=c.getNodes(),a=r.length,s=c.isBackward(),l=s?o:i,u=s?i:o,d=s?t:e,f=s?e:t,p=2047,m=!1;for(let e=0;e<a;e++){let t=r[e],n=t.getTextContentSize();if(L(t)&&n!==0&&!(e===0&&t.__key===d&&l===n||e===a-1&&t.__key===f&&u===0)&&(m=!0,p&=t.getFormat(),p===0))break}c.format=m?p:0}}K(t,yu)})}function yd(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function bd(e,t){yd(e,t.getFormat(),t.getStyle())}function xd(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function Sd(e){let{lastKeyCode:t}=B()._inputState;if(e==null||e.length<=1||t==null)return;let n=t.length===1?t:t===`Enter`?`
|
|
141
|
+
`:t===`Tab`?` `:null;if(!n)return;let r=z();if(!R(r)||!r.isCollapsed())return;let i=r.anchor.getNode();if(!L(i))return;let{offset:a}=r.anchor;if(i.getTextContentSize()===a){let e=i.getNextSibling();if(n===`
|
|
142
|
+
`){if(rm(e))e.selectEnd();else if(!e){let e=Eg(i,qf),t=e&&e.getNextSibling();V(t)&&t.selectStart()}}else n===` `?yf(e)&&e.selectEnd():L(e)&&e.getTextContent()[0]===n&&e.select(1,1)}else i.getTextContent()[a]===n&&i.select(a+1,a+1)}function Cd(e){e.isInsertTextAfterHandledSelectionCommand=!1,e.handledSelectionCommandTimeoutId!==null&&(clearTimeout(e.handledSelectionCommandTimeoutId),e.handledSelectionCommandTimeoutId=null)}function wd(e){Cd(e),e.isInsertTextAfterHandledSelectionCommand=!0,e.handledSelectionCommandTimeoutId=setTimeout(()=>Cd(e),0)}function Td(e,t){let n=Yh(e);if(q(n)&&yg(n,t))return!0;let r=t.getRootElement();if(r===null)return!1;let i=Jh(r.ownerDocument);return i!==null&&r.contains(i)&&yg(i,t)}function Ed(e){let t=e.inputType,n=xd(e),r=B(),i=r._inputState,a=z();if(t===`insertText`&&e.data&&i.isInsertTextAfterHandledSelectionCommand){if(Cd(i),e.preventDefault(),R(a)&&!a.isCollapsed()){let e=a.isBackward()?a.anchor:a.focus;a.anchor.set(e.key,e.offset,e.type),a.focus.set(e.key,e.offset,e.type)}return!0}if(t===`deleteContentBackward`){if(a===null){let e=Qf();if(!R(e))return!0;Jm(e.clone())}if(R(a)){let t=a.anchor.key===a.focus.key;if(function(e,t){return e.lastKeyCode===`MediaLast`&&t<e.lastKeyDownTimeStamp+30}(i,e.timeStamp)&&r.isComposing()&&t){if(Bm(null),i.lastKeyDownTimeStamp=0,setTimeout(()=>{Vp(r,()=>{Bm(null)})},30),R(a)){let e=a.anchor.getNode();e.markDirty(),L(e)||j(142),bd(a,e)}}else{if(Bm(null),Ec&&n!==null&&!n.collapsed&&(a.applyDOMRange(n),!a.isCollapsed()))return e.preventDefault(),a.removeText(),!0;e.preventDefault();let o=a.anchor.getNode(),s=o.getTextContent(),c=o.canInsertTextAfter(),l=a.anchor.offset===0&&a.focus.offset===s.length,u=Ac&&t&&!l&&c;if(u&&a.isCollapsed()&&(u=!H(ph(a.anchor,!0))),!u){K(r,Tu,!0);let e=z();Ac&&R(e)&&e.isCollapsed()&&(i.postDeleteSelectionToRestore=e,setTimeout(()=>i.postDeleteSelectionToRestore=null))}}return!0}}if(!R(a))return!0;let o=e.data;i.unprocessedBeforeInputData!==null&&th(!1,r,i.unprocessedBeforeInputData),a.dirty&&i.unprocessedBeforeInputData===null||!a.isCollapsed()||qp(a.anchor.getNode())||n===null||a.applyDOMRange(n),i.unprocessedBeforeInputData=null;let s=a.anchor,c=a.focus,l=s.getNode(),u=c.getNode();if(t===`insertText`||t===`insertTranspose`){if(o===`
|
|
143
|
+
`)e.preventDefault(),K(r,Eu,!1);else if(o===`
|
|
144
144
|
|
|
145
|
-
`)e.preventDefault(),
|
|
146
|
-
`){let t=B();if(z(t)||Of(t)){if(z(t)){let e=t.focus;t.anchor.set(e.key,e.offset,e.type)}return q(e,Hu,null),kd(n),!1}}let r=W(n);if(r!==null&&R(r)&&jm(r)){r.markDirty();let e=B(),i=r.getTextContentSize(),a=z(e)&&e.anchor.key===n?e.anchor.offset:i;return r.select(a,a).insertText(t),!0}}return eh(!0,e,t),kd(n),!1}function jd(e){let t=V(),n=t._inputState;if(e.key==null)return!0;if(n.compositionPhase===`ending-safari`){let r=sh(e);if(r&&Bp(t,()=>{Ad(t,n.compositionEndData)}),n.compositionPhase=`idle`,n.compositionEndData=``,r)return!0}if(function(e){return K(e,`ArrowRight`,{shiftKey:`any`})}(e))q(t,Iu,e);else if(function(e){return K(e,`ArrowRight`,{...ah,shiftKey:`any`})}(e))q(t,Lu,e);else if(function(e){return K(e,`ArrowLeft`,{shiftKey:`any`})}(e))q(t,Ru,e);else if(function(e){return K(e,`ArrowLeft`,{...ah,shiftKey:`any`})}(e))q(t,zu,e);else if(function(e){return K(e,`ArrowUp`,{altKey:`any`,shiftKey:`any`})}(e))q(t,Bu,e);else if(function(e){return K(e,`ArrowDown`,{altKey:`any`,shiftKey:`any`})}(e))q(t,Vu,e);else if(function(e){return K(e,`Enter`,{altKey:`any`,ctrlKey:`any`,metaKey:`any`,shiftKey:!0})}(e))n.isInsertLineBreak=!0,q(t,Hu,e);else if(function(e){return e.key===` `}(e))q(t,Uu,e);else if(function(e){return Sc&&K(e,`o`,{ctrlKey:!0})}(e))e.preventDefault(),n.isInsertLineBreak=!0,q(t,Tu,!0);else if(function(e){return K(e,`Enter`,{altKey:`any`,ctrlKey:`any`,metaKey:`any`})}(e))n.isInsertLineBreak=!1,q(t,Hu,e);else if(function(e){return K(e,`Backspace`,{shiftKey:`any`})||Sc&&K(e,`h`,{ctrlKey:!0})}(e))sh(e)?q(t,Wu,e)&&Cd(n):(e.preventDefault(),q(t,wu,!0));else if(function(e){return e.key===`Escape`}(e))q(t,Gu,e);else if(function(e){return K(e,`Delete`,{})||Sc&&K(e,`d`,{ctrlKey:!0})}(e))(function(e){return e.key===`Delete`})(e)?q(t,Ku,e):(e.preventDefault(),q(t,wu,!1));else if(function(e){return K(e,`Backspace`,oh)}(e))e.preventDefault(),q(t,Au,!0);else if(function(e){return K(e,`Delete`,oh)}(e))e.preventDefault(),q(t,Au,!1);else if(function(e){return Sc&&K(e,`Backspace`,{metaKey:!0})}(e))e.preventDefault(),q(t,ju,!0);else if(function(e){return Sc&&(K(e,`Delete`,{metaKey:!0})||K(e,`k`,{ctrlKey:!0}))}(e))e.preventDefault(),q(t,ju,!1);else if(function(e){return K(e,`b`,ah)}(e))e.preventDefault(),q(t,Mu,`bold`);else if(function(e){return K(e,`u`,ah)}(e))e.preventDefault(),q(t,Mu,`underline`);else if(function(e){return K(e,`i`,ah)}(e))e.preventDefault(),q(t,Mu,`italic`);else if(function(e){return K(e,`Tab`,{shiftKey:`any`})}(e))q(t,qu,e);else if(function(e){return K(e,`z`,ah)}(e))e.preventDefault(),q(t,Nu);else if(function(e){return Sc?K(e,`z`,{metaKey:!0,shiftKey:!0}):K(e,`y`,{ctrlKey:!0})||K(e,`z`,{ctrlKey:!0,shiftKey:!0})}(e))e.preventDefault(),q(t,Pu);else{let r=t._editorState._selection;(function(e){return K(e,`a`,ah)})(e)?(e.preventDefault(),q(t,ed,e)&&Cd(n)):r===null||z(r)||(function(e){return K(e,`c`,ah)}(e)?(e.preventDefault(),q(t,Qu,e)):function(e){return K(e,`x`,ah)}(e)&&(e.preventDefault(),q(t,$u,e)))}return function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e)&&t.dispatchCommand(sd,e),!0}function Md(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}let Nd=/* @__PURE__ */ new Map;function Pd(e){let t=Nh(e.target);if(t===null)return;let n=gh(e.target),r=null,i=null,a=n===null?void 0:pd.get(n);if(n!==null){if(a!==void 0){let e=a.editors,n=a.hasShadowEditor;if(n===void 0){n=!1;for(let t of e)if(t._rootElement!==null&&Ph(t._rootElement.getRootNode())){n=!0;break}a.hasShadowEditor=n}if(n){let n=null,a=null;for(let o of e){let e=o._rootElement;if(e===null)continue;let s=Hh(t,e).anchorNode;if(s!==null&&Om(s)===o){if(Ph(e.getRootNode())){r=o,i=s;break}n===null&&(n=o,a=s)}}r===null&&n!==null&&(r=n,i=a)}else{let e=t.anchorNode;e===null||J(e)&&e.shadowRoot!==null||(r=Om(e),r!==null&&(i=e))}}if(r===null){let e=qh(n);r=e===null?null:Om(e)}}if(r===null)return;if(r._inputState.isSelectionChangeFromMouseDown){if(a!==void 0)for(let e of a.editors)e._inputState.isSelectionChangeFromMouseDown=!1;Bp(r,()=>{let n=Zf(),a=i??Hh(t,r._rootElement).anchorNode;(J(a)||Mm(a))&&qm(Xf(n,t,r,e))})}let o=Zm(r),s=o[o.length-1],c=s._key,l=Nd.get(c),u=l||s;u!==r&&_d(t,u,!1),_d(t,r,!0),r===s?l&&Nd.delete(c):Nd.set(c,r)}function Fd(e){e._lexicalHandled=!0}function Id(e){return!0===e._lexicalHandled}function Ld(e){let t=fd.get(e);if(t===void 0)return;let n=pd.get(t);if(n===void 0)return;fd.delete(e);let r=km(e);Dm(r)?(function(e){if(e._parentEditor!==null){let t=Zm(e),n=t[t.length-1]._key;Nd.get(n)===e&&Nd.delete(n)}else Nd.delete(e._key)}(r),n.editors.delete(r),n.hasShadowEditor=void 0,e.__lexicalEditor=null):r&&M(198);let i=Md(e);for(let e=0;e<i.length;e++)i[e]();e.__lexicalEventHandles=[]}function Rd(e,t,n){Sp();let r=e.__key,i=e.getParent();if(i===null)return void(jg(e)!==null&&M(367,r,String(jg(e))));let a=function(e){let t=B();if(!z(t)||!H(e))return t;let{anchor:n,focus:r}=t,i=n.getNode(),a=r.getNode();return yh(i,e)&&n.set(e.__key,0,`element`),yh(a,e)&&r.set(e.__key,0,`element`),t}(e),o=!1;if(z(a)&&t){let t=a.anchor,n=a.focus;t.key===r&&(ep(t,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0),n.key===r&&(ep(n,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0)}else Of(a)&&t&&e.isSelected()&&e.selectPrevious();if(z(a)&&t&&!o){let t=e.getIndexWithinParent();Lm(e),Qf(a,i,t,-1)}else Lm(e);n||Th(i)||i.canBeEmpty()||!i.isEmpty()||Rd(i,t),t&&a&&Kp(i)&&i.isEmpty()&&i.selectEnd()}let zd=Symbol.for(`ephemeral`);function Bd(e){return e[zd]||!1}let Vd={configurable:!0,enumerable:!1,value:void 0,writable:!0};var Hd=class{__type;__key;__parent;__prev;__next;__state;[Dl];static getType(){let{ownNodeType:e}=Sg(this);return e===void 0&&M(64,this.name),e}static clone(e){M(65,this.name)}$config(){return{}}config(e,t){let n=t.extends||Dg(this.constructor);return Object.assign(t,{extends:n}),typeof e==`string`&&Object.assign(t,{type:e}),{[e]:t}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}resetOnCopyNodeFrom(e){this.__state&&=this.__state.getWritable(this).resetOnCopyNode()}static importDOM;constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",Vd),Object.defineProperty(this,Dl,Vd),Im(this,e)}getType(){return this.__type}isInline(){M(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e===`root`)return!0;let t=W(e);if(t===null)break;e=t.__parent===null?jg(t):t.__parent}return!1}isSelected(e){let t=e||B();if(t==null)return!1;let n=t.getNodes().some(e=>e.__key===this.__key);if(R(this))return n;if(z(t)&&t.anchor.type===`element`&&t.focus.type===`element`){if(t.isCollapsed())return!1;let e=this.getParent();if(U(this)&&this.isInline()&&e){let n=t.isBackward()?t.focus:t.anchor;if(e.is(n.getNode())&&n.offset===e.getChildrenSize()&&this.is(e.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){let e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),n=0;for(;t!==null;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){let e=this.getLatest().__parent;return e===null?null:W(e)}getParentOrThrow(){let e=this.getParent();return e===null&&M(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){let t=e.getParent();if(Th(t)||jg(e)!==null)return H(e)||e===this&&U(e)||M(194),e;e=t}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return e===null&&M(67,this.__key),e}getParents(){let e=[],t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){let e=[],t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){let e=this.getLatest().__prev;return e===null?null:W(e)}getPreviousSiblings(){let e=[],t=this.getParent();if(t===null)return e;let n=t.getFirstChild();for(;n!==null&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){let e=this.getLatest().__next;return e===null?null:W(e)}getNextSiblings(){let e=[],t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){let t=H(this)?this:this.getParent(),n=H(e)?e:e.getParent(),r=t&&n?E_(t,n):null;return r?r.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){let t=E_(this,e);return t!==null&&(t.type===`descendant`||(t.type===`branch`?C_(t)===-1:(t.type!==`same`&&t.type!==`ancestor`&&M(279),!1)))}isParentOf(e){return yh(e,this)}getNodesBetween(e){let t=this.isBefore(e),n=[],r=/* @__PURE__ */ new Set,i=this;for(;i!==null;){let a=i.__key;if(r.has(a)||(r.add(a),n.push(i)),i===e)break;let o=H(i)?t?i.getFirstChild():i.getLastChild():null;if(o!==null){i=o;continue}let s=t?i.getNextSibling():i.getPreviousSibling();if(s!==null){i=s;continue}let c=i.getParentOrThrow();if(r.has(c.__key)||n.push(c),c===e)break;let l=null,u=c;do{if(u===null&&M(68),l=t?u.getNextSibling():u.getPreviousSibling(),u=u.getParent(),u===null)break;l!==null||r.has(u.__key)||n.push(u)}while(l===null);i=l}return t||n.reverse(),n}isDirty(){let e=V()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){if(Bd(this))return this;let e=W(this.__key);return e===null&&M(113),e}getWritable(){if(Bd(this))return this;Sp();let e=wp(),t=V(),n=e._nodeMap,r=this.__key,i=this.getLatest(),a=t._cloneNotNeeded,o=B();if(o!==null&&o.setCachedNodes(null),a.has(r))return Rm(i),i;let s=ug(i);return a.add(r),Rm(s),n.set(r,s),s}getTextContent(){return Wg(this)}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){M(70)}updateDOM(e,t,n){M(71)}getDOMSlot(e){return new Wc(e)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){let e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){M(18,this.name)}updateFromJSON(e){return function(e,t){let n=e.getWritable(),r=t.$,i=r;for(let e of gl(n).flatKeys)e in t&&(i!==void 0&&i!==r||(i={...r}),i[e]=t[e]);return(n.__state||i)&&hl(e).updateFromJSON(i),n}(this,e)}static transform(){return null}remove(e){Rd(this,!0,e)}replace(e,t){Sp();let n=B();n!==null&&(n=n.clone()),Oh(this,e);let r=this.getLatest(),i=this.__key,a=e.__key,o=e.getWritable(),s=this.getParentOrThrow().getWritable(),c=s.__size,l=o.getParent(),u=l===null?-1:o.getIndexWithinParent();Lm(o),l!==null&&z(n)&&Qf(n,l,u,-1);let d=r.getPreviousSibling(),f=r.getNextSibling(),p=r.__prev,m=r.__next,h=r.__parent;Rd(r,!1,!0),d===null?s.__first=a:d.getWritable().__next=a,o.__prev=p,f===null?s.__last=a:f.getWritable().__prev=a,o.__next=m,o.__parent=h,s.__size=c;let g=0;t&&(H(this)&&H(o)||M(139),g=o.getChildrenSize(),o.splice(g,0,this.getChildren()));let _=Ig(this);if(_.length>0){kg(this)&&kg(o)||M(368,this.__key,o.__key);for(let e of _){let t=Lg(this,e);t!==null&&(Jg(this,e),qg(o,e,t))}}if(z(n)){qm(n);let e=n.anchor,r=n.focus;e.key===i&&(t&&e.type===`element`?e.set(o.__key,g+e.offset,`element`):Sf(e,o)),r.key===i&&(t&&r.type===`element`?r.set(o.__key,g+r.offset,`element`):Sf(r,o))}return Bm()===i&&zm(a),o}insertAfter(e,t=!0){Sp(),Oh(this,e);let n=this.getWritable(),r=e.getWritable();this.getParentOrThrow();let i=r.getParent(),a=B(),o=!1,s=!1;if(i!==null){let n=e.getIndexWithinParent();if(z(a)){let e=i.__key,t=a.anchor,r=a.focus;o=t.type===`element`&&t.key===e&&t.offset===n+1,s=r.type===`element`&&r.key===e&&r.offset===n+1}Lm(r),t&&z(a)&&Qf(a,i,n,-1)}else Lm(r);let c=this.getNextSibling(),l=this.getParentOrThrow().getWritable(),u=r.__key,d=n.__next;if(c===null?l.__last=u:c.getWritable().__prev=u,l.__size++,n.__next=u,r.__next=d,r.__prev=n.__key,r.__parent=n.__parent,t&&z(a)){let e=this.getIndexWithinParent();Qf(a,l,e+1);let t=l.__key;o&&a.anchor.set(t,e+2,`element`),s&&a.focus.set(t,e+2,`element`)}return e}insertBefore(e,t=!0){Sp(),Oh(this,e);let n=this.getWritable(),r=e.getWritable();this.getParentOrThrow();let i=r.__key,a=B(),o=r.getParent(),s=o===null?-1:r.getIndexWithinParent();Lm(r),o!==null&&t&&z(a)&&Qf(a,o,s,-1);let c=this.getPreviousSibling(),l=this.getParentOrThrow().getWritable(),u=n.__prev,d=this.getIndexWithinParent();return c===null?l.__first=i:c.getWritable().__next=i,l.__size++,n.__prev=i,r.__prev=u,r.__next=n.__key,r.__parent=n.__parent,t&&z(a)&&Qf(a,this.getParentOrThrow(),d),e}isParentRequired(){return!1}createParentElementNode(){return cm()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){Sp();let n=Mg(this);if(n!==null)return n.selectPrevious(e,t);let r=this.getPreviousSibling(),i=this.getParentOrThrow();if(r===null)return i.select(0,0);if(H(r))return r.select();if(!R(r)){let e=r.getIndexWithinParent()+1;return i.select(e,e)}return r.select(e,t)}selectNext(e,t){Sp();let n=Mg(this);if(n!==null)return n.selectNext(e,t);let r=this.getNextSibling(),i=this.getParentOrThrow();if(r===null)return i.select();if(H(r))return r.select(0,0);if(!R(r)){let e=r.getIndexWithinParent();return i.select(e,e)}return r.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}};function Ud(e){return e instanceof Hd}let Wd=`history-merge`,Gd=`paste`,Kd=`skip-selection-focus`,qd=`composition-end`;function Jd(e){let t={};if(!e)return t;let n=``,r=``,i=null,a=!1,o=!1,s=!1,c=0,l=e.length,u=-1;for(let d=0;d<l;d++){let l=e[d];if(a)l===`*`&&e[d+1]===`/`&&(a=!1,d++);else if(o)u===-1&&(u=d),o=!1;else if(i===null){if(l!==`/`||e[d+1]!==`*`){if(l!==`"`&&l!==`'`){if(l!==`(`){if(l!==`)`){if(s||l!==`:`||c!==0){if(l===`;`&&c===0){u!==-1&&(s?r+=e.slice(u,d):n+=e.slice(u,d),u=-1);let i=n.trim(),a=r.trim();i!==``&&a!==``&&(t[i]=a),n=``,r=``,s=!1;continue}u===-1&&(u=d)}else u!==-1&&(n+=e.slice(u,d),u=-1),s=!0}else u===-1&&(u=d),c=Math.max(0,c-1)}else u===-1&&(u=d),c++}else u===-1&&(u=d),i=l}else u!==-1&&(s?r+=e.slice(u,d):n+=e.slice(u,d),u=-1),a=!0,d++}else u===-1&&(u=d),l===`\\`?o=!0:l===i&&(i=null)}u!==-1&&(s?r+=e.slice(u,l):n+=e.slice(u,l));let d=n.trim(),f=r.trim();return d!==``&&f!==``&&(t[d]=f),t}function Yd(e,t,n){let r=n.trimEnd(),i=r.length-10;i>=0&&r.slice(i).toLowerCase()===`!important`?e.setProperty(t,r.slice(0,i).trim(),`important`):e.setProperty(t,n,``)}function Xd(e,t,n=``){if(t===n)return;let r=Jd(n),i=Jd(t);for(let t in i)delete r[t],Yd(e,t,i[t]);for(let t in r)e.removeProperty(t)}function Zd(e,t){return 16&t?`code`:t&128?`mark`:32&t?`sub`:64&t?`sup`:null}function Qd(e,t){return 1&t?`strong`:2&t?`em`:`span`}function $d(e,t,n,r,i){let a=r.classList,o=lh(i,`base`);o!==void 0&&a.add(...o),o=lh(i,`underlineStrikethrough`);let s=!1,c=8&t&&4&t;o!==void 0&&(8&n&&4&n?(s=!0,c||a.add(...o)):c&&a.remove(...o));for(let e in Fc){let r=Fc[e];if(o=lh(i,e),o!==void 0){if(n&r){if(s&&(e===`underline`||e===`strikethrough`)){t&r&&a.remove(...o);continue}((t&r)===0||c&&e===`underline`||e===`strikethrough`)&&a.add(...o)}else t&r&&a.remove(...o)}}}function ef(e,t,n){let r=n.isComposing(),i=e+(r?jc:``),a=ng(),o=rg(a).$getDOMSlot(n,t,a),s=o.getFirstChild();if(s===null||s.nodeType!==Node.TEXT_NODE)return void o.insertChild(zh().createTextNode(i));let c=s,l=c.nodeValue;if(l!==i){if(r||Cc){let[e,t,n]=function(e,t){let n=e.length,r=t.length,i=0,a=0;for(;i<n&&i<r&&e[i]===t[i];)i++;for(;a+i<n&&a+i<r&&e[n-a-1]===t[r-a-1];)a++;return[i,n-i-a,t.slice(i,r-a)]}(l,i);t!==0&&c.deleteData(e,t),c.insertData(e,n)}else c.nodeValue=i}}function tf(e,t,n,r,i,a){ef(i,e,t);let o=a.theme.text;o!==void 0&&$d(0,0,r,e,o)}function nf(e,t){let n=zh().createElement(t);return n.appendChild(e),n}function rf(e){return e!=null&&!0===e.__isInlineFormattable}var af=class extends Hd{__text;__format;__style;__mode;__detail;get __isInlineFormattable(){return!0}$config(){return this.config(`text`,{importDOM:{"#text":()=>({conversion:uf,priority:0}),b:()=>({conversion:sf,priority:0}),code:()=>({conversion:pf,priority:0}),em:()=>({conversion:pf,priority:0}),i:()=>({conversion:pf,priority:0}),mark:()=>({conversion:pf,priority:0}),s:()=>({conversion:pf,priority:0}),span:()=>({conversion:of,priority:0}),strong:()=>({conversion:pf,priority:0}),sub:()=>({conversion:pf,priority:0}),sup:()=>({conversion:pf,priority:0}),u:()=>({conversion:pf,priority:0})}})}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text,this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e=``,t){super(t),this.__text=e,this.__format=0,this.__style=``,this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let e=this.getLatest();return Bc[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===Bm()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){let t=Fc[e];return(this.getFormat()&t)!==0}isSimpleText(){return this.__type===`text`&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return Fm(this.getLatest().__format,e,t)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,t){let n=this.__format,r=Zd(0,n),i=Qd(0,n),a=r===null?i:r,o=zh().createElement(a),s=o;this.hasFormat(`code`)&&o.setAttribute(`spellcheck`,`false`),r!==null&&(s=zh().createElement(i),o.appendChild(s)),tf(s,this,0,n,this.__text,e);let c=this.__style;return c!==``&&Xd(o.style,c),o}updateDOM(e,t,n){let r=this.__text,i=e.__format,a=this.__format,o=Zd(0,i),s=Zd(0,a),c=Qd(0,i),l=Qd(0,a);if((o===null?c:o)!==(s===null?l:s))return!0;if(o===s&&c!==l){let e=t.firstChild;e??M(48);let i=zh().createElement(l);return tf(i,this,0,a,r,n),t.replaceChild(i,e),!1}let u=t;s!==null&&o!==null&&(u=t.firstChild,u??M(49)),ef(r,u,this);let d=n.theme.text;d!==void 0&&i!==a&&$d(0,i,a,u,d);let f=e.__style,p=this.__style;return f!==p&&Xd(t.style,p,f),!1}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:t}=super.exportDOM(e);return J(t)||M(132),t.style.whiteSpace=`pre-wrap`,this.hasFormat(`lowercase`)?t.style.textTransform=`lowercase`:this.hasFormat(`uppercase`)?t.style.textTransform=`uppercase`:this.hasFormat(`capitalize`)&&(t.style.textTransform=`capitalize`),this.hasFormat(`bold`)&&(t=nf(t,`b`)),this.hasFormat(`italic`)&&(t=nf(t,`i`)),this.hasFormat(`strikethrough`)&&(t=nf(t,`s`)),this.hasFormat(`underline`)&&(t=nf(t,`u`)),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,t){}setFormat(e){let t=this.getWritable();return t.__format=typeof e==`string`?Fc[e]:e,t}setDetail(e){let t=this.getWritable();return t.__detail=typeof e==`string`?Ic[e]:e,t}setStyle(e){let t=this.getWritable();return t.__style=e,t}toggleFormat(e){let t=Fm(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){let e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){let e=this.getWritable();return e.__detail^=2,e}setMode(e){let t=zc[e];if(this.__mode===t)return this;let n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;let t=this.getWritable();return t.__text=e,t}select(e,t){Sp();let n=e,r=t,i=B(),a=this.getTextContent(),o=this.__key;if(typeof a==`string`){let e=a.length;n===void 0&&(n=e),r===void 0&&(r=e)}else n=0,r=0;if(!z(i))return qf(o,n,o,r,`text`,`text`);{let e=Bm();e!==i.anchor.key&&e!==i.focus.key||zm(o),i.setTextNodeRange(this,n,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){let e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,r){let i=this.getWritable(),a=i.__text,o=n.length,s=e;s<0&&(s=o+s,s<0&&(s=0));let c=B();if(r&&z(c)){let t=e+o;c.setTextNodeRange(i,t,i,t)}return i.__text=a.slice(0,s)+n+a.slice(s+t),i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){Sp();let t=this.getLatest(),n=t.getTextContent();if(n===``)return[];let r=t.__key,i=Bm(),a=n.length;e.sort((e,t)=>e-t),e.push(a);let o=[],s=e.length;for(let t=0,r=0;t<a&&r<=s;r++){let i=e[r];i>t&&(o.push(n.slice(t,i)),t=i)}let c=o.length;if(c===1)return[t];let l=o[0],u=t.getParent(),d,f=t.getFormat(),p=t.getStyle(),m=t.__detail,h=!1,g=null,_=null,v=B();if(z(v)){let[e,t]=v.isBackward()?[v.focus,v.anchor]:[v.anchor,v.focus];e.type===`text`&&e.key===r&&(g=e),t.type===`text`&&t.key===r&&(_=t)}t.isSegmented()?(d=mf(l),d.__format=f,d.__style=p,d.__detail=m,d.__state=xl(t,d),h=!0):d=t.setTextContent(l);let y=[d];for(let e=1;e<c;e++){let n=mf(o[e]);n.__format=f,n.__style=p,n.__detail=m,n.__state=xl(t,n);let a=n.__key;i===r&&zm(a),y.push(n)}let ee=g?g.offset:null,b=_?_.offset:null,x=0;for(let e of y){if(!g&&!_)break;let t=x+e.getTextContentSize();if(g!==null&&ee!==null&&ee<=t&&ee>=x&&(g.set(e.getKey(),ee-x,`text`),ee<t&&(g=null)),_!==null&&b!==null&&b<=t&&b>=x){_.set(e.getKey(),b-x,`text`);break}x=t}if(u!==null){(function(e){let t=e.getPreviousSibling(),n=e.getNextSibling();t!==null&&Rm(t),n!==null&&Rm(n)})(this);let e=u.getWritable(),t=this.getIndexWithinParent();h?(e.splice(t,0,y),this.remove()):e.splice(t,1,y),z(v)&&Qf(v,u,t,c-1)}return y}mergeWithSibling(e){let t=e===this.getPreviousSibling();t||e===this.getNextSibling()||M(50);let n=this.__key,r=e.__key,i=this.__text,a=i.length;Bm()===r&&zm(n);let o=B();if(z(o)){let i=o.anchor,s=o.focus;i!==null&&i.key===r&&tp(i,t,n,e,a),s!==null&&s.key===r&&tp(s,t,n,e,a)}let s=e.__text,c=t?s+i:i+s;this.setTextContent(c);let l=this.getWritable();return e.remove(),l}isTextEntity(){return!1}};function of(e){return{forChild:hf(e.style),node:null}}function sf(e){let t=e,n=t.style.fontWeight===`normal`;return{forChild:hf(t.style,n?void 0:`bold`),node:null}}let cf=/* @__PURE__ */ new WeakMap;function lf(e){if(!J(e))return!1;if(e.nodeName===`PRE`)return!0;let t=e.style.whiteSpace;return typeof t==`string`&&t.startsWith(`pre`)}function uf(e){let t=e;e.parentElement===null&&M(129);let n=t.textContent||``;if(function(e){let t,n=e.parentNode,r=[e];for(;n!==null&&(t=cf.get(n))===void 0&&!lf(n);)r.push(n),n=n.parentNode;let i=t===void 0?n:t;for(let e=0;e<r.length;e++)cf.set(r[e],i);return i}(t)!==null)return{node:op(n)};if(n=n.replace(/\r/g,``).replace(/[ \t\n]+/g,` `),n===``)return{node:null};if(n[0]===` `){let e=t,r=!0;for(;e!==null&&(e=df(e,!1))!==null;){let t=e.textContent||``;if(t.length>0){/[ \t\n]$/.test(t)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(n[n.length-1]===` `){let e=t,r=!0;for(;e!==null&&(e=df(e,!0))!==null;)if((e.textContent||``).replace(/^( |\t|\r?\n)+/,``).length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return n===``?{node:null}:{node:mf(n)}}function df(e,t){let n=e;for(;;){let e;for(;(e=t?n.nextSibling:n.previousSibling)===null;){let e=n.parentElement;if(e===null)return null;n=e}if(n=e,J(n)){let e=n.style.display;if(e===``&&!Qh(n)||e!==``&&!e.startsWith(`inline`))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(Mm(n))return n;if(n.nodeName===`BR`)return null}}let ff={code:`code`,em:`italic`,i:`italic`,mark:`highlight`,s:`strikethrough`,strong:`bold`,sub:`subscript`,sup:`superscript`,u:`underline`};function pf(e){let t=ff[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:hf(e.style,t),node:null}}function mf(e=``){return Dh(new af(e))}function R(e){return e instanceof af}function hf(e,t){let n=e.fontWeight,r=e.textDecoration.split(` `),i=n===`700`||n===`bold`,a=r.includes(`line-through`),o=e.fontStyle===`italic`,s=r.includes(`underline`),c=e.verticalAlign;return e=>((R(e)||rf(e))&&(i&&!e.hasFormat(`bold`)&&e.toggleFormat(`bold`),a&&!e.hasFormat(`strikethrough`)&&e.toggleFormat(`strikethrough`),o&&!e.hasFormat(`italic`)&&e.toggleFormat(`italic`),s&&!e.hasFormat(`underline`)&&e.toggleFormat(`underline`),c!==`sub`||e.hasFormat(`subscript`)||e.toggleFormat(`subscript`),c!==`super`||e.hasFormat(`superscript`)||e.toggleFormat(`superscript`),t&&!e.hasFormat(t)&&e.toggleFormat(t)),e)}var gf=class extends af{$config(){return this.config(`tab`,{extends:af})}constructor(e=void 0){super(` `,e),this.__detail=2}createDOM(e){let t=super.createDOM(e),n=lh(e.theme,`tab`);return n!==void 0&&t.classList.add(...n),t}setTextContent(e){return super.setTextContent(` `)}spliceText(e,t,n,r){return n===``&&t===0||n===` `&&t===1||M(286),this}setDetail(e){return e!==2&&M(127),this}setMode(e){return e!==`normal`&&M(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function _f(){return Dh(new gf)}function vf(e){return e instanceof gf}var yf=class{key;offset;type;_selection;constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:S_(I_(D_(this,`next`)),I_(D_(e,`next`)))<0}getNode(){let e=W(this.key);return e===null&&M(20),e}set(e,t,n,r){let i=this._selection,a=this.key;r&&this.key===e&&this.offset===t&&this.type===n||(this.key=e,this.offset=t,this.type=n,xp()||(Bm()===a&&zm(e),i!==null&&(i.setCachedNodes(null),z(i)&&(i._cachedIsBackward=null),i.dirty=!0)))}};function bf(e,t,n){return new yf(e,t,n)}function xf(e,t){let n=t.__key,r=e.offset,i=`element`;if(R(t)){i=`text`;let e=t.getTextContentSize();r>e&&(r=e)}else if(!H(t)){let e=t.getNextSibling();if(R(e))n=e.__key,r=0,i=`text`;else{let e=t.getParent();e&&(n=e.__key,r=t.getIndexWithinParent()+1)}}e.set(n,r,i)}function Sf(e,t){if(H(t)){let n=t.getLastDescendant();H(n)||R(n)?xf(e,n):xf(e,t)}else xf(e,t)}function Cf(e,t,n,r){let i=e.getNode(),a=i.getChildAtIndex(e.offset),o=mf();if(o.setFormat(n),o.setStyle(r),lm(a))a.splice(0,0,[o]);else if(a!==null){let e=Th(i)?cm().append(o):o;a.insertBefore(e)}else if(Th(i)){let e=i.getLastChild();H(e)&&!e.isInline()&&e.isEmpty()?e.append(o):i.append(cm().append(o))}else i.append(o);e.is(t)&&t.set(o.__key,0,`text`),e.set(o.__key,0,`text`)}function wf(e,t,n,r){let i=e.anchor.getNode();R(i)||M(398);let a=e.anchor.offset,o=mf(t);o.setFormat(n),o.setStyle(r);let s=i.getParentOrThrow();if(a===0)s.isInline()&&!i.__prev?s.insertBefore(o):i.insertBefore(o,!1);else if(a===i.getTextContentSize())s.isInline()&&!i.__next?s.insertAfter(o):i.insertAfter(o,!1);else{let[e]=i.splitText(a);e.insertAfter(o,!1)}i.getTextContent()===``&&i.isAttached()&&i.remove(),o.selectEnd(),o.isComposing()&&e.anchor.type===`text`&&e.anchor.set(e.anchor.key,e.anchor.offset-t.length,e.anchor.type)}var Tf=class e{_nodes;_cachedNodes;dirty;constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Of(e))return!1;let t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every(e=>n.has(e))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new e(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){let t=this.getNodes().filter(e=>jg(e)===null),n=t.length;if(n===0)return;let r=t[n-1],i;if(R(r))i=r.select();else{let e=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(e,e)}i.insertNodes(e);for(let e=0;e<n;e++)t[e].remove()}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=this._nodes,n=[];for(let e of t){let t=W(e);t!==null&&n.push(t)}return xp()||(this._cachedNodes=n),n}getTextContent(){let e=this.getNodes(),t=``;for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}deleteNodes(){let e=this.getNodes().filter(e=>jg(e)===null);if((B()||Zf())===this&&e[0]){let t=Y(e[0],`next`);k_(b_(t,t))}for(let t of e)t.remove();Ef()}};function Ef(){let e=G();if(e.isEmpty()){let t=cm();e.append(t),t.select()}}function z(e){return e instanceof Df}var Df=class e{format;style;anchor;focus;_cachedNodes;_cachedIsBackward;dirty;constructor(e,t,n,r){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this._cachedIsBackward=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!z(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=function(e){let t=[],[n,r]=e.getTextSlices();n&&t.push(n.caret.origin);let i=/* @__PURE__ */ new Set,a=/* @__PURE__ */ new Set;for(let n of e)if(o_(n)){let{origin:e}=n;t.length===0?i.add(e):(a.add(e),t.push(e))}else{let{origin:e}=n;H(e)&&a.has(e)||t.push(e)}if(r&&t.push(r.caret.origin),a_(e.focus)&&H(e.focus.origin)&&e.focus.getNodeAtCaret()===null)for(let n=p_(e.focus.origin,`previous`);o_(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(t[t.length-1]);n=h_(n))i.delete(n.origin),t.pop();for(;t.length>1;){let e=t[t.length-1];if(!H(e)||a.has(e)||e.isEmpty()||i.has(e))break;t.pop()}if(t.length===0&&e.isCollapsed()){let n=I_(e.anchor),r=I_(e.anchor.getFlipped()),i=e=>i_(e)?e.origin:e.getNodeAtCaret(),a=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(a)}return t}(z_(j_(this),`next`));return xp()||(this._cachedNodes=t),t}setTextNodeRange(e,t,n,r){return this.anchor.set(e.__key,t,`text`),this.focus.set(n.__key,r,`text`),this}getTextContent(){let e=this.getNodes();if(e.length===0)return``;let t=e[0],n=e[e.length-1],r=this.anchor,i=this.focus,a=r.isBefore(i),[o,s]=Mf(this),c=``,l=!0;for(let u=0;u<e.length;u++){let d=e[u];if(H(d)&&!d.isInline()){l||(c+=`
|
|
147
|
-
`);let e=``;for(let t of Ig(d)){let n=Lg(d,t);n!==null&&(e+=n.getTextContent())}e===``?l=!d.isEmpty():(c+=e,l=!1)}else if(l=!1,R(d)){let e=d.getTextContent();d===t?d===n?r.type===`element`&&i.type===`element`&&i.offset!==r.offset||(e=o<s?e.slice(o,s):e.slice(s,o)):e=a?e.slice(o):e.slice(s):d===n&&(e=a?e.slice(0,s):e.slice(0,o)),c+=e}else!U(d)&&!nm(d)||d===n&&this.isCollapsed()||(c+=d.getTextContent())}return c}applyDOMRange(e){let t=V(),n=t.getEditorState()._selection,r=Gf(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(r===null)return;let[i,a,o]=r;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(a.key,a.offset,a.type,!0),o&&(this.dirty=!0),Tl(this)}clone(){let t=this.anchor,n=this.focus;return new e(bf(t.key,t.offset,t.type),bf(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(e){this.format=Fm(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){let t=Fc[e];return(this.format&t)!==0}insertRawText(e){this.insertNodes(op(e))}insertText(e){let t=this.format,n=this.style;if(!this.isCollapsed()){let r=(this.focus.isBefore(this.anchor)?this.focus:this.anchor).getNode();if(R(r)&&(t=r.getFormat(),n=r.getStyle()),this.removeText(),this.format=t,this.style=n,e===``)return;if(Bm()===null)return this.anchor.type===`element`&&Cf(this.anchor,this.focus,t,n),void wf(this,e,t,n)}this.anchor.type===`element`&&Cf(this.anchor,this.focus,t,n);let r=this.anchor.getNode();R(r)||M(398);let i=this.anchor.offset,a=r.getParentOrThrow(),o=r.getTextContentSize();if(jm(r)||i===0&&(!r.canInsertTextBefore()||!a.canInsertTextBefore()&&!r.__prev)||i===o&&(!r.canInsertTextAfter()||!a.canInsertTextAfter()&&!r.__next)){if(r.isSegmented()&&i!==0&&i!==o){if(Bm()!==null)r.setMode(`normal`).setFormat(t).setStyle(n);else{let e=mf(r.getTextContent());e.setFormat(t),e.setStyle(n),r.replace(e),e.select(i,i)}e!==``&&this.insertText(e);return}if(e===``)return;if(i===0){let i=r.getPreviousSibling();if(R(i)&&i.canInsertTextAfter()&&!jm(i))i.select();else{let e=mf();e.setFormat(t),e.setStyle(n),a.canInsertTextBefore()?r.insertBefore(e):a.insertBefore(e),e.select()}this.insertText(e);return}if(i===o){let i=r.getNextSibling();if(R(i)&&i.canInsertTextBefore()&&!jm(i))i.select(0,0);else{let e=mf();e.setFormat(t),e.setStyle(n),a.canInsertTextAfter()?r.insertAfter(e):a.insertAfter(e),e.select(0,0)}this.insertText(e);return}let s=mf(e);s.setFormat(t),s.setStyle(n),r.replace(s),s.select();return}if(e===``)return;let s=a.isInline()&&i===0&&!r.__prev,c=a.isInline()&&i===o&&!r.__next,l=r.getFormat()!==t||r.getStyle()!==n;if(s||c||l){if(r.getTextContent()!==``||s||c)return void wf(this,e,t,n);r.setFormat(t),r.setStyle(n)}r.spliceText(i,0,e,!0),r.isComposing()&&this.anchor.type===`text`&&this.anchor.set(this.anchor.key,this.anchor.offset-e.length,this.anchor.type)}removeText(){let e=B()===this;A_(this,F_(j_(this))),e&&B()!==this&&qm(this)}formatText(e,t=null){Af(this,e,t)}insertNodes(e){if(e.length===0)return;this.isCollapsed()||this.removeText();let t=this.anchor.getNode();if(this.anchor.type===`element`&&H(t)&&jg(t)!==null){let n=t.isShadowRoot()?t.getFirstChild()??t.append(cm()).getFirstChild():t.getFirstChild();if(t.isShadowRoot()&&n!==null&&!H(n)){let e=cm();n.insertBefore(e),n=e}if(n!==null){n.selectStart();let t=B();return z(t)||M(369),t.insertNodes(e)}}if(this.anchor.type===`element`&&Th(t)){let n=dp(e),r=n.getLastDescendant();t.splice(this.anchor.offset,0,n.getChildren()),r!==null&&r.selectEnd();return}let n=(this.isBackward()?this.focus:this.anchor).getNode(),r=Tg(n,tg),i=e[e.length-1];if(H(r)&&`__language`in r){if(`__language`in e[0])this.insertText(e[0].getTextContent());else{let t=cp(this);r.splice(t,0,e),i.selectEnd()}return}if(!e.some(e=>(H(e)||U(e))&&!e.isInline())){H(r)||M(211,n.constructor.name,n.getType());let t=cp(this);r.splice(t,0,e),i.selectEnd();return}if(H(r)&&jg(r)!==null){let t=cp(this),n=sp(e);r.splice(t,0,n);let i=n[n.length-1];i===void 0?r.select(t,t):i.selectEnd();return}if(r===null){let t=dp(e),n=t.getLastDescendant(),r=D_(this.anchor,`next`);for(let e of t.getChildren())r=W_(e,r);n!==null&&n.selectEnd();return}if(H(r)&&!r.isParentRequired()&&!Th(r.getParentOrThrow())){let t=cp(this),n=sp(e);r.splice(t,0,n);let i=n[n.length-1];i===void 0?r.select(t,t):i.selectEnd();return}let a=dp(e),o=a.getLastDescendant(),s=a.getChildren(),c=!H(r)||!r.isEmpty()?this.insertParagraph():null;c&&!r.isAttached()&&(n=this.anchor.getNode(),r=Tg(n,tg));let l=s[s.length-1],u=s[0];var d;H(d=u)&&tg(d)&&!d.isEmpty()&&H(r)&&(!r.isEmpty()||r.canMergeWhenEmpty())&&(H(r)||M(211,n.constructor.name,n.getType()),r.append(...u.getChildren()),u=s[1]),u&&(r===null&&M(212,n.constructor.name,n.getType()),function(e,t){let n=t.getParentOrThrow().getLastChild(),r=t,i=[t];for(;r!==n;)r.getNextSibling()||M(140),r=r.getNextSibling(),i.push(r);let a=e;for(let e of i)a=a.insertAfter(e)}(r,u));let f=Tg(o,tg);c&&H(f)&&(c.canMergeWhenEmpty()||tg(l))&&(f.append(...c.getChildren()),c.remove()),H(r)&&r.isEmpty()&&r.remove(),o.selectEnd();let p=H(r)?r.getLastChild():null;nm(p)&&f!==r&&p.remove()}insertParagraph(){let e=this.anchor.getNode();if(this.anchor.type===`element`&&Th(e)){let t=cm();return e.splice(this.anchor.offset,0,[t]),t.select(),t}let t=cp(this),n=Tg(this.anchor.getNode(),tg);if(n!==null&&jg(n)!==null)return null;H(n)||M(213);let r=n.getChildAtIndex(t),i=r?[r,...r.getNextSiblings()]:[],a=n.insertNewAfter(this,!1);return a?(a.append(...i),a.selectStart(),a):null}insertLineBreak(e){let t=tm();if(this.insertNodes([t]),e){let e=t.getParentOrThrow(),n=t.getIndexWithinParent();e.select(n,n)}}extract(){let e=[...this.getNodes()],t=e.length,n=e[0],r=e[t-1],[i,a]=Mf(this),o=this.isBackward(),[s,c]=o?[this.focus,this.anchor]:[this.anchor,this.focus],[l,u]=o?[a,i]:[i,a];if(t===0)return[];if(t===1){if(R(n)&&!this.isCollapsed()){let e=n.splitText(l,u),t=l===0?e[0]:e[1];return t?(s.set(t.getKey(),0,`text`),c.set(t.getKey(),t.getTextContentSize(),`text`),[t]):[]}return[n]}if(R(n)&&(l===n.getTextContentSize()?e.shift():l!==0&&([,n]=n.splitText(l),e[0]=n,s.set(n.getKey(),0,`text`))),R(r)){let t=r.getTextContent().length;u===0?e.pop():u!==t&&([r]=r.splitText(u),e[e.length-1]=r,c.set(r.getKey(),r.getTextContentSize(),`text`))}return e}modify(e,t,n){if(fp(this,e,t,n))return;let r=e===`move`,i=V(),a=Mh(xh(i));if(!a)return;let o=i._blockCursorElement,s=i._rootElement,c=this.focus.getNode();s===null||o===null||!H(c)||c.isInline()||c.canBeEmpty()||jh(o,i,s);let l=mh(i,this.focus.key),u=l;if(this.focus.type===`text`&&(u=R(c)?og(c,l,i):null),this.dirty){let e=mh(i,this.anchor.key),t=e;if(this.anchor.type===`text`){let n=this.anchor.getNode();t=R(n)?og(n,e,i):null}t&&u&&np(a,t,this.anchor.offset,u,this.focus.offset)}if(n===`character`&&R(c)&&c.isUnmergeable()&&(t?this.focus.offset===0:this.focus.offset===c.getTextContentSize())){let e=Y(c,t?`previous`:`next`).getNodeAtCaret();if(R(e)){if(!r){let n=e.getTextContentSize();t?this.focus.set(e.__key,n-1,`text`):this.focus.set(e.__key,1,`text`),this.dirty=!0;return}{let n=i.getElementByKey(e.getKey()),r=n?og(e,n,i):null;if(r){let e=t?r.length:0;np(a,r,e,r,e)}}}}if(Ff(a,e,t?`backward`:`forward`,n),a.rangeCount>0){let e=Bh(a,i._rootElement),n=e||a.getRangeAt(0),o=this.anchor.getNode(),s=Kp(o)?o:Ch(o);this.applyDOMRange(n),this.dirty=!0,!r&&(If(this,t,s),(e?a.direction!==`backward`:a.anchorNode===n.startContainer&&a.anchorOffset===n.startOffset)||Pf(this))}n===`lineboundary`&&fp(this,e,t,n,`decorators`)}forwardDeletion(e,t,n){if(!n&&(e.type===`element`&&H(t)&&e.offset===t.getChildrenSize()||e.type===`text`&&e.offset===t.getTextContentSize())){let e=t.getParent(),n=t.getNextSibling()||(e===null?null:e.getNextSibling());if(H(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(e){let t=this.isCollapsed();if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;let r=v_(D_(t,e?`previous`:`next`));if(r.getTextSlices().every(e=>e===null||e.distance===0)){let e={type:`initial`};for(let t of r.iterNodeCarets(`shadowRoot`))if(o_(t)){if(!t.origin.isInline()){if(t.origin.isShadowRoot()){if(e.type===`merge-block`)break;if(H(r.anchor.origin)&&r.anchor.origin.isEmpty()){let e=I_(t);A_(this,b_(e,e)),r.anchor.origin.remove()}return}e.type!==`merge-next-block`&&e.type!==`merge-block`||(e={block:e.block,caret:t,type:`merge-block`})}}else{if(e.type===`merge-block`)break;if(a_(t)){if(H(t.origin)){if(t.origin.isInline()){if(!t.origin.isParentOf(r.anchor.origin))break}else e={block:t.origin,type:`merge-next-block`};continue}if(U(t.origin)){if(!t.origin.isIsolated()){if(Ig(t.origin).length>0){if(H(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();let e=Yf();e.add(t.origin.getKey()),qm(e)}}else if(e.type===`merge-next-block`&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&H(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();let e=Yf();e.add(t.origin.getKey()),qm(e)}else t.origin.remove()}return}break}}if(e.type===`merge-block`){let{caret:t,block:n}=e;return Ig(n).length>0?void 0:t.origin.isEmpty()&&!n.isEmpty()&&t.origin.getParent()===n.getParent()?void t.origin.remove(!0):(A_(this,b_(!t.origin.isEmpty()&&n.isEmpty()?M_(Y(n,t.direction)):r.anchor,t)),this.removeText())}for(let e=t.getNode();e!==null;){if(jg(e)!==null)return;if(H(e)&&e.isShadowRoot())break;e=e.getParent()}}let i=this.focus;if(Lf(this,e,`character`),this.isCollapsed()){if(e&&t.offset===0&&Nf(this,t.getNode()))return}else{let r=i.type===`text`?i.getNode():null;if(n=t.type===`text`?t.getNode():null,r!==null&&r.isSegmented()){let t=i.offset,a=r.getTextContentSize();if(r.is(n)||e&&t!==a||!e&&t!==0)return void zf(r,e,t)}else if(n!==null&&n.isSegmented()){let i=t.offset,a=n.getTextContentSize();if(n.is(r)||e&&i!==0||!e&&i!==a)return void zf(n,e,i)}(function(e,t){let n=e.anchor,r=e.focus,i=n.getNode();if(i===r.getNode()&&n.type===`text`&&r.type===`text`){let e=n.offset,a=r.offset,o=e<a,s=o?e:a,c=o?a:e,l=c-1;s!==l&&(function(e){return!(Xm(e)||Rf(e))})(i.getTextContent().slice(s,c))&&(t?r.set(r.key,l,r.type):n.set(n.key,l,n.type))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type===`element`&&this.anchor.offset===0){let e=this.anchor.getNode();e.isEmpty()&&Kp(e.getParent())&&e.getPreviousSibling()===null&&Nf(this,e),Ef()}}deleteLine(e){let t=Hf(this.anchor);if(t!==null&&U(Mg(t)))return this.isCollapsed()||this.focus.set(this.anchor.key,this.anchor.offset,this.anchor.type),void this.deleteCharacter(e);this.isCollapsed()&&Lf(this,e,`lineboundary`),this.isCollapsed()?this.deleteCharacter(e):Tg(this.anchor.getNode(),tg)===Tg(this.focus.getNode(),tg)?this.removeText():(this.focus.set(this.anchor.key,this.anchor.offset,this.anchor.type),this.deleteCharacter(e))}deleteWord(e){if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;Lf(this,e,`word`)}this.isCollapsed()?this.deleteCharacter(e):this.removeText()}isBackward(){let e=this._cachedIsBackward;if(e!==null)return e;let t=this.focus.isBefore(this.anchor);return xp()||(this._cachedIsBackward=t),t}getStartEndPoints(){return[this.anchor,this.focus]}};function Of(e){return e instanceof Tf}function kf(e,t){if(Of(e)){for(let n of e.getNodes())rf(n)&&n.setFormat(t(n.getFormat()));return}if(e.isCollapsed())return e.setFormat(t(e.format)),void zm(null);let n=[];for(let r of e.getNodes())R(r)?n.push(r):H(r)?r.setTextFormat(t(r.getTextFormat())):rf(r)&&r.setFormat(t(r.getFormat()));let r=n.length;if(r===0)return e.setFormat(t(e.format)),void zm(null);let i=e.anchor,a=e.focus,o=e.isBackward(),s=o?a:i,c=o?i:a,l=0,u=n[0],d=s.type===`element`?0:s.offset;if(s.type===`text`&&d===u.getTextContentSize()&&(l=1,u=n[1],d=0),u==null)return;let f=r-1,p=n[f],m=c.type===`text`?c.offset:p.getTextContentSize();if(u.is(p)){if(d===m)return;let n=t(u.getFormat());if(jm(u)||d===0&&m===u.getTextContentSize())u.setFormat(n);else{let e=u.splitText(d,m),t=d===0?e[0]:e[1];t.setFormat(n),s.type===`text`&&s.set(t.__key,0,`text`),c.type===`text`&&c.set(t.__key,m-d,`text`)}e.format=n;return}d===0||jm(u)||([,u]=u.splitText(d),d=0);let h=t(u.getFormat());u.setFormat(h);let g=t(p.getFormat());m>0&&(m===p.getTextContentSize()||jm(p)||([p]=p.splitText(m)),p.setFormat(g));for(let e=l+1;e<f;e++){let r=n[e];r.setFormat(t(r.getFormat()))}s.type===`text`&&s.set(u.__key,d,`text`),c.type===`text`&&c.set(p.__key,m,`text`),e.format=h|g}function Af(e,t,n=null){let r=n===null&&z(e)?Fm(e.format,t,null):n;kf(e,e=>Fm(e,t,r))}function jf(e){let t=e.offset;if(e.type===`text`)return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function Mf(e){let t=e.getStartEndPoints();if(t===null)return[0,0];let[n,r]=t;return n.type===`element`&&r.type===`element`&&n.key===r.key&&n.offset===r.offset?[0,0]:[jf(n),jf(r)]}function Nf(e,t){for(let n=t;n;n=n.getParent()){if(H(n)){if(n.collapseAtStart(e))return!0;if(Th(n))break}if(n.getPreviousSibling())break}return!1}function Pf(e){let t=e.focus,n=e.anchor,r=n.key,i=n.offset,a=n.type;n.set(t.key,t.offset,t.type,!0),t.set(r,i,a,!0)}function Ff(e,t,n,r){e.modify(t,n,r)}function If(e,t,n){let r=e.getNodes(),i=r.filter(e=>yh(e,n));if(i.length===0||i.length===r.length)return!1;let a=t?i[0]:i[i.length-1],o=H(a)?a:a.getParentOrThrow();return t?o.selectStart():o.selectEnd(),!0}function Lf(e,t,n){if(fp(e,`extend`,t,n))return;let r=V(),i=Mh(xh(r));if(!i||typeof i.modify!=`function`)return;let a=r._blockCursorElement,o=r._rootElement,s=e.anchor,c=e.focus.getNode();o===null||a===null||!H(c)||c.isInline()||c.canBeEmpty()||jh(a,r,o);let l=e=>{let t=e.getNode(),n=r.getElementByKey(e.key);return n!==null&&e.type===`text`&&R(t)?og(t,n,r):n},u=s.getNode(),d=l(s);if(d===null)return;let f=s.offset,p=e.isCollapsed(),m=e.focus,h=p?d:l(m);if(h===null)return;let g=m.offset;if(np(i,h,g,h,g),Ff(i,`move`,t?`backward`:`forward`,n),i.rangeCount===0)return;let _=Bh(i,o)||i.getRangeAt(0),v=_.startContainer,y=_.startOffset;if(p&&n===`character`&&s.type===`text`&&R(u)&&u.isUnmergeable()&&f===(t?0:u.getTextContentSize())){let n=Y(u,t?`previous`:`next`).getNodeAtCaret();if(R(n)){let r=t?n.getTextContentSize()-1:1;e.focus.set(n.__key,r,`text`),e.dirty=!0;return}}if(p&&n===`character`&&s.type===`text`){let n=t?0:u.getTextContentSize(),r=v===d?y:f===n?-1:n;if(r>=0)return void(r!==f&&(e.focus.set(s.key,r,`text`),e.dirty=!0))}let[ee,b,x,S]=t?[v,y,d,f]:[d,f,v,y],te=Kp(u)?u:Ch(u);e.applyDOMRange({collapsed:!1,endContainer:x,endOffset:S,startContainer:ee,startOffset:b}),e.dirty=!0,!If(e,t,te)&&t&&Pf(e),n===`lineboundary`&&fp(e,`extend`,t,n,`decorators`)}let Rf=(()=>{try{let e=RegExp(`\\p{Emoji}`,`u`),t=e.test.bind(e);if(t(`❤️`)&&t(`#️⃣`)&&t(`👍`))return t}catch{}return()=>!1})();function zf(e,t,n){let r=e,i=r.getTextContent().split(/(?=\s)/g),a=i.length,o=0,s=0;for(let e=0;e<a;e++){let r=e===a-1;if(s=o,o+=i[e].length,t&&o===n||o>n||r){i.splice(e,1),r&&(s=void 0);break}}let c=i.join(``).trim();c===``?r.remove():(r.setTextContent(c),r.select(s,s))}function Bf(e,t,n,r){let i,a=t,o=!1;if(J(e)){let s=!1,c=e.childNodes,l=c.length,u=r._blockCursorElement;a===l&&l>0&&(s=!0,a=l-1),Um(e,r)!==void 0||vg(e,r)||(o=!0);let d=c[a],f=!1;if(d===u)d=c[a+1],f=!0;else if(u!==null){let n=u.parentNode;e===n&&t>Array.prototype.indexOf.call(n.children,u)&&a--}if(i=Ym(d),R(i))a=d_(i,s?`next`:`previous`);else{let c=Ym(e);if(c===null)return null;if(H(c)){let o=r.getElementByKey(c.getKey());o===null&&M(214);let l=ig(c,o,r);[c,a]=l.resolveChildIndex(c,o,e,t),H(c)||M(215),s&&a>=c.getChildrenSize()&&(a=Math.max(0,c.getChildrenSize()-1));let u=c.getChildAtIndex(a);if(H(u)&&function(e,t,n){let r=e.getParent();return n===null||r===null||!r.canBeEmpty()||r!==n.getNode()}(u,0,n)){let e=s?u.getLastDescendant():u.getFirstDescendant();e===null?c=u:(u=e,c=H(u)?u:u.getParentOrThrow()),a=0}R(u)?(i=u,c=null,a=d_(u,s?`next`:`previous`)):u!==c&&s&&!f&&(H(c)||M(216),a=Math.min(c.getChildrenSize(),a+1))}else{let n=Mg(c),i=n===null?c:n,o=i.getIndexWithinParent(),s=r.getElementByKey(c.getKey()),l=`after`;if(s!==null&&Ym(e)===c){let n=ig(c,s,r);n.element===s?t===0&&U(c)&&(l=`before`):l=n.resolveLeafPosition(s,e,t)}a=l===`before`?o:o+1,c=i.getParentOrThrow()}if(H(c))return[bf(c.__key,a,`element`),o]}}else i=Ym(e);return R(i)?[bf(i.__key,d_(i,a,`clamp`),`text`),o]:null}function Vf(e,t,n){let r=e.offset,i=e.getNode();if(r===0){let r=i.getPreviousSibling(),a=i.getParent();if(t){if((n||!t)&&r===null&&H(a)&&a.isInline()){let t=a.getPreviousSibling();R(t)&&e.set(t.__key,t.getTextContent().length,`text`)}}else H(r)&&!n&&r.isInline()?e.set(r.__key,r.getChildrenSize(),`element`):R(r)&&!i.isUnmergeable()&&e.set(r.__key,r.getTextContent().length,`text`)}else if(r===i.getTextContent().length){let r=i.getNextSibling(),a=i.getParent();if(t&&H(r)&&r.isInline())e.set(r.__key,0,`element`);else if((n||t)&&r===null&&H(a)&&a.isInline()&&!a.canInsertTextAfter()&&a.getTextContentSize()>1){let t=a.getNextSibling();R(t)&&e.set(t.__key,0,`text`)}}}function Hf(e){let t=W(e.key);return t===null?null:Pg(t)}function Uf(e,t,n){let r=Hf(e),i=Hf(t);if(r===i||r!==null&&i!==null&&r.is(i))return!1;let a=n(r,i);if(r!==null)return H(r)?t.set(r.getKey(),a?r.getChildrenSize():0,`element`):t.set(r.getKey(),a?r.getTextContentSize():0,`text`),!0;let o=Mg(i);if(o===null)return!1;let s=o.getParent();if(s===null)return!1;let c=o.getIndexWithinParent();return t.set(s.getKey(),a?c+1:c,`element`),!0}function Wf(e){let t=Uf(e.anchor,e.focus,(t,n)=>function(e,t,n,r){if(n!==null&&r!==null){let e=Mg(n),t=Mg(r);if(e!==null&&e.is(t)){for(let t of Fg(e).values()){if(t===n.getKey())return!0;if(t===r.getKey())return!1}return!0}return e===null||t===null||e.isBefore(t)}if(n!==null){let e=Mg(n),r=W(t.key);return e===null||r===null||!(!e.is(r)&&!e.isParentOf(r))||e.isBefore(r)}let i=Mg(r),a=W(e.key);return i!==null&&a!==null&&!i.is(a)&&!i.isParentOf(a)&&a.isBefore(i)}(e.anchor,e.focus,t,n));return t&&(e.dirty=!0),t}function Gf(e,t,n,r,i,a){if(e===null||n===null||!Em(i,e,n))return null;let o=Bf(e,t,z(a)?a.anchor:null,i);if(o===null)return null;let s=Bf(n,r,z(a)?a.focus:null,i);if(s===null)return null;let[c,l]=o,[u,d]=s;if(c.type===`element`&&u.type===`element`){let t=Ym(e),r=Ym(n);if(U(t)&&U(r))return null}let f=i._slotsUsed&&Uf(c,u,()=>(e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return function(e,t){if(e.type===`text`&&t.type===`text`){let n=e.isBefore(t),r=e.is(t);Vf(e,n,r),Vf(t,!n,r),r&&t.set(e.key,e.offset,e.type)}}(c,u),[c,u,l||d||f]}function Kf(e){return H(e)&&!e.isInline()}function qf(e,t,n,r,i,a){let o=wp(),s=new Df(bf(e,t,i),bf(n,r,a),0,``);return s.dirty=!0,o._selection=s,s}function Jf(){return new Df(bf(`root`,0,`element`),bf(`root`,0,`element`),0,``)}function Yf(){return new Tf(/* @__PURE__ */ new Set)}function Xf(e,t,n,r){let i=n._window;if(i===null)return null;let a=r||i.event,o=a?a.type:void 0,s=o===`selectionchange`,c=!el&&(s||o===`beforeinput`||o===`compositionstart`||o===`compositionend`||o===`click`&&a&&a.detail===3||o===`drop`||o===void 0),l,u,d,f;if(z(e)&&!c)return e.clone();{if(t===null)return null;let r=Hh(t,n._rootElement);if(l=r.anchorNode,u=r.focusNode,d=r.anchorOffset,f=r.focusOffset,(s||o===void 0)&&z(e)&&!Em(n,l,u))return e.clone()}let p=Gf(l,d,u,f,n,e);if(p===null)return null;let[m,h,g]=p,_=0,v=``;if(z(e)){let t=e.anchor;if(m.key===t.key)_=e.format,v=e.style;else{let e=m.getNode();R(e)?(_=e.getFormat(),v=e.getStyle()):H(e)&&(_=e.getTextFormat(),v=e.getTextStyle())}}let y=new Df(m,h,_,v);return g&&(y.dirty=!0),y}function B(){return wp()._selection}function Zf(){return V()._editorState._selection}function Qf(e,t,n,r=1){let i=e.anchor,a=e.focus,o=i.getNode(),s=a.getNode();if(!t.is(o)&&!t.is(s))return;let c=t.__key;if(e.isCollapsed()){let t=i.offset;if(n<=t&&r>0||n<t&&r<0){let n=Math.max(0,t+r);i.set(c,n,`element`),a.set(c,n,`element`),$f(e)}}else{let o=e.isBackward(),s=o?a:i,l=s.getNode(),u=o?i:a,d=u.getNode();if(t.is(l)){let e=s.offset;(n<=e&&r>0||n<e&&r<0)&&s.set(c,Math.max(0,e+r),`element`)}if(t.is(d)){let e=u.offset;(n<=e&&r>0||n<e&&r<0)&&u.set(c,Math.max(0,e+r),`element`)}}$f(e)}function $f(e){let t=e.anchor,n=t.offset,r=e.focus,i=r.offset,a=t.getNode(),o=r.getNode();if(e.isCollapsed()){if(!H(a))return;let e=a.getChildrenSize(),i=n>=e,o=i?a.getChildAtIndex(e-1):a.getChildAtIndex(n);if(R(o)){let e=0;i&&(e=o.getTextContentSize()),t.set(o.__key,e,`text`),r.set(o.__key,e,`text`)}}else{if(H(a)){let e=a.getChildrenSize(),r=n>=e,i=r?a.getChildAtIndex(e-1):a.getChildAtIndex(n);if(R(i)){let e=0;r&&(e=i.getTextContentSize()),t.set(i.__key,e,`text`)}}if(H(o)){let e=o.getChildrenSize(),t=i>=e,n=t?o.getChildAtIndex(e-1):o.getChildAtIndex(i);if(R(n)){let e=0;t&&(e=n.getTextContentSize()),r.set(n.__key,e,`text`)}}}}function ep(e,t,n,r,i){let a=null,o=0,s=null;r===null?i!==null&&(a=i.__key,R(i)?s=`text`:H(i)&&(s=`element`)):(a=r.__key,R(r)?(o=r.getTextContentSize(),s=`text`):H(r)&&(o=r.getChildrenSize(),s=`element`)),a!==null&&s!==null?e.set(a,o,s):(o=t.getIndexWithinParent(),o===-1&&(o=n.getChildrenSize()),e.set(n.__key,o,`element`))}function tp(e,t,n,r,i){e.type===`text`?e.set(n,e.offset+(t?0:i),`text`):e.offset>r.getIndexWithinParent()&&e.set(e.key,e.offset-1,`element`)}function np(e,t,n,r,i){try{e.setBaseAndExtent(t,n,r,i)}catch{}}function rp(e,t,n){let r=mh(e,t.getKey());if(H(t)){let i=ig(t,r,e);return[i.element,n+i.getFirstChildOffset()]}return[r,n]}function ip(e,t,n,r,i,a){let o=a.getRootNode(),s=Nm(o)||Ph(o)?qh(o):null;if(i.has(`collaboration`)&&s!==a||s!==null&&Tm(s,s))return;let c=Hh(r,a),l;if(!z(t))return void(e!==null&&Em(n,c.anchorNode,c.focusNode)&&r.removeAllRanges());let u=t.anchor,d=t.focus,f=u.getNode(),p=d.getNode(),[m,h]=rp(n,f,u.offset),[g,_]=rp(n,p,d.offset),v=t.format,y=t.style,ee=t.isCollapsed(),b=m,x=g,S=!1;if(u.type===`text`?(b=R(f)?og(f,m,n):null,S=f.getFormat()!==v||f.getStyle()!==y):z(e)&&e.anchor.type===`text`&&(S=!0),d.type===`text`&&(x=R(p)?og(p,g,n):null),b!==null&&x!==null){if(ee&&(e===null||S||z(e)&&(e.format!==v||e.style!==y))&&function(e,t,n,r,i,a){e._inputState.collapsedSelectionFormat={format:t,key:i,offset:r,style:n,timeStamp:a}}(n,v,y,h,u.key,performance.now()),(r.type!==`Range`||!ee)&&c.anchorOffset===h&&c.focusOffset===_&&c.anchorNode===b&&c.focusNode===x){if(s===null||!a.contains(s)){let e=s===null?null:Om(s);e!==null&&e!==n||i.has(`skip-selection-focus`)||a.focus({preventScroll:!0})}if(u.type!==`element`)return}if(np(r,b,h,x,_),Cc&&t.isCollapsed()&&a!==null&&!i.has(`skip-selection-focus`)){let e=Kh(a);if(e===null||!a.contains(e)){let e=qh(a.ownerDocument),t=e===null?null:Om(e);t!==null&&t!==n||a.focus({preventScroll:!0})}}if(!i.has(`skip-scroll-into-view`)&&t.isCollapsed()&&a!==null&&a===Kh(a)){let e=z(t)&&t.anchor.type===`element`?b.childNodes[h]||null:(l===void 0&&(l=Vh(r,a)),l);if(e!==null){let t;if(Mm(e)){let n=e.ownerDocument.createRange();n.selectNode(e),t=n.getBoundingClientRect()}else t=e.getBoundingClientRect();(function(e,t,n){let r=gh(n),i=bh(r);if(r===null||i===null)return;let a=n.getBoundingClientRect();if(t.bottom<a.top)return;let{top:o,bottom:s}=t,c=0,l=0,u=n;for(;u!==null;){let t=u===r.body;if(t){let t=i.visualViewport;if(t){let e=t.pageTop-i.scrollY;c=e,l=e+t.height}else c=0,l=xh(e).innerHeight;let n=i.getComputedStyle(r.documentElement),a=parseFloat(n.scrollPaddingTop),o=parseFloat(n.scrollPaddingBottom);isFinite(a)&&(c+=a),isFinite(o)&&(l-=o)}else{let e=u===n?a:u.getBoundingClientRect();c=e.top,l=e.bottom}let d=0;if(o<c?d=-(c-o):s>l&&(d=s-l),d!==0){if(t)i.scrollBy(0,d);else{let e=u.scrollTop;u.scrollTop+=d;let t=u.scrollTop-e;o-=t,s-=t}}if(t)break;u=hh(u)}})(n,t,a)}}(function(e){e._inputState.isSelectionChangeFromDOMUpdate=!0})(n)}}function ap(e,t){for(let n of e.split(/(\r?\n|\t)/))n===`
|
|
145
|
+
`)e.preventDefault(),K(r,Du);else if(o==null&&e.dataTransfer){let t=e.dataTransfer.getData(`text/plain`);e.preventDefault(),a.insertRawText(t)}else o!=null&&gd(a,n,o,e.timeStamp,!0)?(e.preventDefault(),K(r,Ou,o),Sd(o)):i.unprocessedBeforeInputData=o;return i.lastBeforeInputInsertTextTimeStamp=e.timeStamp,!0}switch(e.preventDefault(),t){case`insertFromYank`:case`insertFromDrop`:case`insertReplacementText`:K(r,Ou,e),Sd((e.dataTransfer?e.dataTransfer.getData(`text/plain`):null)??e.data);break;case`insertFromComposition`:{let t=i.hadOrphanedCompositionEvents;i.hadOrphanedCompositionEvents=!1;let n=r._compositionKey;Bm(null),t||K(r,Ou,e),Ad(n);break}case`insertLineBreak`:Bm(null),K(r,Eu,!1);break;case`insertParagraph`:Bm(null),i.isInsertLineBreak&&!Ec?(i.isInsertLineBreak=!1,K(r,Eu,!1)):K(r,Du);break;case`insertFromPaste`:case`insertFromPasteAsQuotation`:K(r,ku,e);break;case`deleteByComposition`:(function(e,t){return e!==t||V(e)||V(t)||!jm(e)||!jm(t)})(l,u)&&K(r,Au,e);break;case`deleteByDrag`:vh(qd),K(r,Au,e);break;case`deleteByCut`:K(r,Au,e);break;case`deleteContent`:K(r,Tu,!1);break;case`deleteWordBackward`:K(r,ju,!0);break;case`deleteWordForward`:K(r,ju,!1);break;case`deleteHardLineBackward`:case`deleteSoftLineBackward`:K(r,Mu,!0);break;case`deleteContentForward`:case`deleteHardLineForward`:case`deleteSoftLineForward`:K(r,Mu,!1);break;case`formatStrikeThrough`:K(r,Nu,`strikethrough`);break;case`formatBold`:K(r,Nu,`bold`);break;case`formatItalic`:K(r,Nu,`italic`);break;case`formatUnderline`:K(r,Nu,`underline`);break;case`historyUndo`:K(r,Pu);break;case`historyRedo`:K(r,Fu)}return!0}function Dd(e){let t=B(),n=t._inputState,r=z(),i=e.data,a=xd(e),o=!1;if(i!=null&&R(r)){let s=Nh(Sh(t)),c=s===null?null:Uh(s,t._rootElement),l=e.inputType===`insertCompositionText`&&n.compositionPhase!==`ending-firefox`&&!t.isComposing();l&&(n.hadOrphanedCompositionEvents=!0);let u=r.anchor.getNode(),d=e.inputType===`insertCompositionText`&&n.compositionPhase!==`ending-firefox`&&t.isComposing()&&L(u)&&Mm(u);if(!l&&!d&&gd(r,a,i,e.timeStamp,!1,c)){if(o=!0,n.compositionPhase===`ending-firefox`){let e=jd(t,i);if(n.compositionPhase=`idle`,e)return vh(Jd),Ym(),!0}let a=r.anchor.getNode();if(s===null||c===null)return!0;let l=r.isBackward(),u=l?r.anchor.offset:r.focus.offset,d=l?r.focus.offset:r.anchor.offset;Tc&&!r.isCollapsed()&&L(a)&&c.anchorNode!==null&&a.getTextContent().slice(0,u)+i+a.getTextContent().slice(u+d)===eh(c.anchorNode)||K(t,Ou,i);let f=i.length;wc&&f>1&&e.inputType===`insertCompositionText`&&!t.isComposing()&&(r.anchor.offset-=f,r._cachedNodes=null,r._cachedIsBackward=null),Ac&&t.isComposing()&&(n.lastKeyDownTimeStamp=0,Bm(null))}}return o||(th(!1,t,i===null?void 0:i),n.compositionPhase===`ending-firefox`&&(jd(t,i||void 0),vh(`composition-end`),n.compositionPhase=`idle`)),Ym(),!0}function Od(e){let t=B(),n=t._inputState,r=z();if(R(r)&&!t.isComposing()){n.compositionPhase=`composing`,n.hadOrphanedCompositionEvents=!1;let i=r.anchor,a=r.anchor.getNode();if(Bm(i.key),vh(`composition-start`),e.timeStamp<n.lastKeyDownTimeStamp+30||i.type===`element`||!r.isCollapsed()||!Ac&&(a.getFormat()!==r.format||L(a)&&a.getStyle()!==r.style)||L(a)&&(Mm(a)||i.offset===0&&!a.canInsertTextBefore()||i.offset===a.getTextContentSize()&&!a.canInsertTextAfter())){K(t,Ou,Nc);let e=z();R(e)&&Bm(e.anchor.key)}}return!0}function kd(e){let t=B();return t._inputState.compositionPhase=`idle`,jd(t,e.data),vh(Jd),!0}function Ad(e){if(e===null)return;let t=U(e);if(!L(t)||t.getType()===`text`||Mm(t)||!t.isAttached())return;let n=z(),r=R(n)&&n.anchor.key===e?n.anchor.offset:null,i=hf(t.getTextContent());if(i.setFormat(t.getFormat()),i.setStyle(t.getStyle()),t.replace(i),r!==null){let e=Math.min(r,i.getTextContentSize());i.select(e,e)}}function jd(e,t){let n=e._compositionKey;if(Bm(null),n!==null&&t!=null){if(t===``){let t=U(n),r=e.getElementByKey(n),i=r!==null&&L(t)?sg(t,r,e):null;if(i!==null&&i.nodeValue!==null&&L(t)){let n=Nh(Sh(e)),r=n&&Uh(n,e._rootElement),a=null,o=null;r!==null&&r.anchorNode===i&&(a=r.anchorOffset,o=r.focusOffset),nh(t,i.nodeValue,a,o,!0)}return Ad(n),!1}if(t[t.length-1]===`
|
|
146
|
+
`){let t=z();if(R(t)||kf(t)){if(R(t)){let e=t.focus;t.anchor.set(e.key,e.offset,e.type)}return K(e,Uu,null),Ad(n),!1}}let r=U(n);if(r!==null&&L(r)&&Mm(r)){r.markDirty();let e=z(),i=r.getTextContentSize(),a=R(e)&&e.anchor.key===n?e.anchor.offset:i;return r.select(a,a).insertText(t),!0}}return th(!0,e,t),Ad(n),!1}function Md(e){let t=B(),n=t._inputState;if(e.key==null)return!0;if(n.compositionPhase===`ending-safari`){let r=ch(e);if(r&&Vp(t,()=>{jd(t,n.compositionEndData)}),n.compositionPhase=`idle`,n.compositionEndData=``,r)return!0}if(function(e){return G(e,`ArrowRight`,{shiftKey:`any`})}(e))K(t,Lu,e);else if(function(e){return G(e,`ArrowRight`,{...oh,shiftKey:`any`})}(e))K(t,Ru,e);else if(function(e){return G(e,`ArrowLeft`,{shiftKey:`any`})}(e))K(t,zu,e);else if(function(e){return G(e,`ArrowLeft`,{...oh,shiftKey:`any`})}(e))K(t,Bu,e);else if(function(e){return G(e,`ArrowUp`,{altKey:`any`,shiftKey:`any`})}(e))K(t,Vu,e);else if(function(e){return G(e,`ArrowDown`,{altKey:`any`,shiftKey:`any`})}(e))K(t,Hu,e);else if(function(e){return G(e,`Enter`,{altKey:`any`,ctrlKey:`any`,metaKey:`any`,shiftKey:!0})}(e))n.isInsertLineBreak=!0,K(t,Uu,e);else if(function(e){return e.key===` `}(e))K(t,Wu,e);else if(function(e){return Cc&&G(e,`o`,{ctrlKey:!0})}(e))e.preventDefault(),n.isInsertLineBreak=!0,K(t,Eu,!0);else if(function(e){return G(e,`Enter`,{altKey:`any`,ctrlKey:`any`,metaKey:`any`})}(e))n.isInsertLineBreak=!1,K(t,Uu,e);else if(function(e){return G(e,`Backspace`,{shiftKey:`any`})||Cc&&G(e,`h`,{ctrlKey:!0})}(e))ch(e)?K(t,Gu,e)&&wd(n):(e.preventDefault(),K(t,Tu,!0));else if(function(e){return e.key===`Escape`}(e))K(t,Ku,e);else if(function(e){return G(e,`Delete`,{})||Cc&&G(e,`d`,{ctrlKey:!0})}(e))(function(e){return e.key===`Delete`})(e)?K(t,qu,e):(e.preventDefault(),K(t,Tu,!1));else if(function(e){return G(e,`Backspace`,sh)}(e))e.preventDefault(),K(t,ju,!0);else if(function(e){return G(e,`Delete`,sh)}(e))e.preventDefault(),K(t,ju,!1);else if(function(e){return Cc&&G(e,`Backspace`,{metaKey:!0})}(e))e.preventDefault(),K(t,Mu,!0);else if(function(e){return Cc&&(G(e,`Delete`,{metaKey:!0})||G(e,`k`,{ctrlKey:!0}))}(e))e.preventDefault(),K(t,Mu,!1);else if(function(e){return G(e,`b`,oh)}(e))e.preventDefault(),K(t,Nu,`bold`);else if(function(e){return G(e,`u`,oh)}(e))e.preventDefault(),K(t,Nu,`underline`);else if(function(e){return G(e,`i`,oh)}(e))e.preventDefault(),K(t,Nu,`italic`);else if(function(e){return G(e,`Tab`,{shiftKey:`any`})}(e))K(t,Ju,e);else if(function(e){return G(e,`z`,oh)}(e))e.preventDefault(),K(t,Pu);else if(function(e){return Cc?G(e,`z`,{metaKey:!0,shiftKey:!0}):G(e,`y`,{ctrlKey:!0})||G(e,`z`,{ctrlKey:!0,shiftKey:!0})}(e))e.preventDefault(),K(t,Fu);else{let r=t._editorState._selection;(function(e){return G(e,`a`,oh)})(e)?(e.preventDefault(),K(t,td,e)&&wd(n)):r===null||R(r)||(function(e){return G(e,`c`,oh)}(e)?(e.preventDefault(),K(t,$u,e)):function(e){return G(e,`x`,oh)}(e)&&(e.preventDefault(),K(t,ed,e)))}return function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e)&&t.dispatchCommand(cd,e),!0}function Nd(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}let Pd=/* @__PURE__ */ new Map;function Fd(e){let t=Ph(e.target);if(t===null)return;let n=_h(e.target),r=null,i=null,a=n===null?void 0:md.get(n);if(n!==null){if(a!==void 0){let e=a.editors,n=a.hasShadowEditor;if(n===void 0){n=!1;for(let t of e)if(t._rootElement!==null&&Fh(t._rootElement.getRootNode())){n=!0;break}a.hasShadowEditor=n}if(n){let n=null,a=null;for(let o of e){let e=o._rootElement;if(e===null)continue;let s=Uh(t,e).anchorNode;if(s!==null&&km(s)===o){if(Fh(e.getRootNode())){r=o,i=s;break}n===null&&(n=o,a=s)}}r===null&&n!==null&&(r=n,i=a)}else{let e=t.anchorNode;e===null||q(e)&&e.shadowRoot!==null||(r=km(e),r!==null&&(i=e))}}if(r===null){let e=Jh(n);r=e===null?null:km(e)}}if(r===null)return;if(r._inputState.isSelectionChangeFromMouseDown){if(a!==void 0)for(let e of a.editors)e._inputState.isSelectionChangeFromMouseDown=!1;Vp(r,()=>{let n=Qf(),a=i??Uh(t,r._rootElement).anchorNode;(q(a)||Nm(a))&&Jm(Zf(n,t,r,e))})}let o=Qm(r),s=o[o.length-1],c=s._key,l=Pd.get(c),u=l||s;u!==r&&vd(t,u,!1),vd(t,r,!0),r===s?l&&Pd.delete(c):Pd.set(c,r)}function Id(e){e._lexicalHandled=!0}function Ld(e){return!0===e._lexicalHandled}function Rd(e){let t=pd.get(e);if(t===void 0)return;let n=md.get(t);if(n===void 0)return;pd.delete(e);let r=Am(e);Om(r)?(function(e){if(e._parentEditor!==null){let t=Qm(e),n=t[t.length-1]._key;Pd.get(n)===e&&Pd.delete(n)}else Pd.delete(e._key)}(r),n.editors.delete(r),n.hasShadowEditor=void 0,e.__lexicalEditor=null):r&&j(198);let i=Nd(e);for(let e=0;e<i.length;e++)i[e]();e.__lexicalEventHandles=[]}function zd(e,t,n){Cp();let r=e.__key,i=e.getParent();if(i===null)return void(Mg(e)!==null&&j(367,r,String(Mg(e))));let a=function(e){let t=z();if(!R(t)||!V(e))return t;let{anchor:n,focus:r}=t,i=n.getNode(),a=r.getNode();return bh(i,e)&&n.set(e.__key,0,`element`),bh(a,e)&&r.set(e.__key,0,`element`),t}(e),o=!1;if(R(a)&&t){let t=a.anchor,n=a.focus;t.key===r&&(tp(t,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0),n.key===r&&(tp(n,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0)}else kf(a)&&t&&e.isSelected()&&e.selectPrevious();if(R(a)&&t&&!o){let t=e.getIndexWithinParent();Rm(e),$f(a,i,t,-1)}else Rm(e);n||Eh(i)||i.canBeEmpty()||!i.isEmpty()||zd(i,t),t&&a&&qp(i)&&i.isEmpty()&&i.selectEnd()}let Bd=Symbol.for(`ephemeral`);function Vd(e){return e[Bd]||!1}let Hd={configurable:!0,enumerable:!1,value:void 0,writable:!0};var Ud=class{__type;__key;__parent;__prev;__next;__state;[Ol];static getType(){let{ownNodeType:e}=Cg(this);return e===void 0&&j(64,this.name),e}static clone(e){j(65,this.name)}$config(){return{}}config(e,t){let n=t.extends||Og(this.constructor);return Object.assign(t,{extends:n}),typeof e==`string`&&Object.assign(t,{type:e}),{[e]:t}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}resetOnCopyNodeFrom(e){this.__state&&=this.__state.getWritable(this).resetOnCopyNode()}static importDOM;constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",Hd),Object.defineProperty(this,Ol,Hd),Lm(this,e)}getType(){return this.__type}isInline(){j(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e===`root`)return!0;let t=U(e);if(t===null)break;e=t.__parent===null?Mg(t):t.__parent}return!1}isSelected(e){let t=e||z();if(t==null)return!1;let n=t.getNodes().some(e=>e.__key===this.__key);if(L(this))return n;if(R(t)&&t.anchor.type===`element`&&t.focus.type===`element`){if(t.isCollapsed())return!1;let e=this.getParent();if(H(this)&&this.isInline()&&e){let n=t.isBackward()?t.focus:t.anchor;if(e.is(n.getNode())&&n.offset===e.getChildrenSize()&&this.is(e.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){let e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),n=0;for(;t!==null;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){let e=this.getLatest().__parent;return e===null?null:U(e)}getParentOrThrow(){let e=this.getParent();return e===null&&j(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){let t=e.getParent();if(Eh(t)||Mg(e)!==null)return V(e)||e===this&&H(e)||j(194),e;e=t}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return e===null&&j(67,this.__key),e}getParents(){let e=[],t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){let e=[],t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){let e=this.getLatest().__prev;return e===null?null:U(e)}getPreviousSiblings(){let e=[],t=this.getParent();if(t===null)return e;let n=t.getFirstChild();for(;n!==null&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){let e=this.getLatest().__next;return e===null?null:U(e)}getNextSiblings(){let e=[],t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){let t=V(this)?this:this.getParent(),n=V(e)?e:e.getParent(),r=t&&n?D_(t,n):null;return r?r.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){let t=D_(this,e);return t!==null&&(t.type===`descendant`||(t.type===`branch`?w_(t)===-1:(t.type!==`same`&&t.type!==`ancestor`&&j(279),!1)))}isParentOf(e){return bh(e,this)}getNodesBetween(e){let t=this.isBefore(e),n=[],r=/* @__PURE__ */ new Set,i=this;for(;i!==null;){let a=i.__key;if(r.has(a)||(r.add(a),n.push(i)),i===e)break;let o=V(i)?t?i.getFirstChild():i.getLastChild():null;if(o!==null){i=o;continue}let s=t?i.getNextSibling():i.getPreviousSibling();if(s!==null){i=s;continue}let c=i.getParentOrThrow();if(r.has(c.__key)||n.push(c),c===e)break;let l=null,u=c;do{if(u===null&&j(68),l=t?u.getNextSibling():u.getPreviousSibling(),u=u.getParent(),u===null)break;l!==null||r.has(u.__key)||n.push(u)}while(l===null);i=l}return t||n.reverse(),n}isDirty(){let e=B()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){if(Vd(this))return this;let e=U(this.__key);return e===null&&j(113),e}getWritable(){if(Vd(this))return this;Cp();let e=Tp(),t=B(),n=e._nodeMap,r=this.__key,i=this.getLatest(),a=t._cloneNotNeeded,o=z();if(o!==null&&o.setCachedNodes(null),a.has(r))return zm(i),i;let s=dg(i);return a.add(r),zm(s),n.set(r,s),s}getTextContent(){return Gg(this)}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){j(70)}updateDOM(e,t,n){j(71)}getDOMSlot(e){return new Gc(e)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){let e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){j(18,this.name)}updateFromJSON(e){return function(e,t){let n=e.getWritable(),r=t.$,i=r;for(let e of _l(n).flatKeys)e in t&&(i!==void 0&&i!==r||(i={...r}),i[e]=t[e]);return(n.__state||i)&&gl(e).updateFromJSON(i),n}(this,e)}static transform(){return null}remove(e){zd(this,!0,e)}replace(e,t){Cp();let n=z();n!==null&&(n=n.clone()),kh(this,e);let r=this.getLatest(),i=this.__key,a=e.__key,o=e.getWritable(),s=this.getParentOrThrow().getWritable(),c=s.__size,l=o.getParent(),u=l===null?-1:o.getIndexWithinParent();Rm(o),l!==null&&R(n)&&$f(n,l,u,-1);let d=r.getPreviousSibling(),f=r.getNextSibling(),p=r.__prev,m=r.__next,h=r.__parent;zd(r,!1,!0),d===null?s.__first=a:d.getWritable().__next=a,o.__prev=p,f===null?s.__last=a:f.getWritable().__prev=a,o.__next=m,o.__parent=h,s.__size=c;let g=0;t&&(V(this)&&V(o)||j(139),g=o.getChildrenSize(),o.splice(g,0,this.getChildren()));let _=Lg(this);if(_.length>0){Ag(this)&&Ag(o)||j(368,this.__key,o.__key);for(let e of _){let t=Rg(this,e);t!==null&&(Yg(this,e),Jg(o,e,t))}}if(R(n)){Jm(n);let e=n.anchor,r=n.focus;e.key===i&&(t&&e.type===`element`?e.set(o.__key,g+e.offset,`element`):Cf(e,o)),r.key===i&&(t&&r.type===`element`?r.set(o.__key,g+r.offset,`element`):Cf(r,o))}return Vm()===i&&Bm(a),o}insertAfter(e,t=!0){Cp(),kh(this,e);let n=this.getWritable(),r=e.getWritable();this.getParentOrThrow();let i=r.getParent(),a=z(),o=!1,s=!1;if(i!==null){let n=e.getIndexWithinParent();if(R(a)){let e=i.__key,t=a.anchor,r=a.focus;o=t.type===`element`&&t.key===e&&t.offset===n+1,s=r.type===`element`&&r.key===e&&r.offset===n+1}Rm(r),t&&R(a)&&$f(a,i,n,-1)}else Rm(r);let c=this.getNextSibling(),l=this.getParentOrThrow().getWritable(),u=r.__key,d=n.__next;if(c===null?l.__last=u:c.getWritable().__prev=u,l.__size++,n.__next=u,r.__next=d,r.__prev=n.__key,r.__parent=n.__parent,t&&R(a)){let e=this.getIndexWithinParent();$f(a,l,e+1);let t=l.__key;o&&a.anchor.set(t,e+2,`element`),s&&a.focus.set(t,e+2,`element`)}return e}insertBefore(e,t=!0){Cp(),kh(this,e);let n=this.getWritable(),r=e.getWritable();this.getParentOrThrow();let i=r.__key,a=z(),o=r.getParent(),s=o===null?-1:r.getIndexWithinParent();Rm(r),o!==null&&t&&R(a)&&$f(a,o,s,-1);let c=this.getPreviousSibling(),l=this.getParentOrThrow().getWritable(),u=n.__prev,d=this.getIndexWithinParent();return c===null?l.__first=i:c.getWritable().__next=i,l.__size++,n.__prev=i,r.__prev=u,r.__next=n.__key,r.__parent=n.__parent,t&&R(a)&&$f(a,this.getParentOrThrow(),d),e}isParentRequired(){return!1}createParentElementNode(){return lm()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){Cp();let n=Ng(this);if(n!==null)return n.selectPrevious(e,t);let r=this.getPreviousSibling(),i=this.getParentOrThrow();if(r===null)return i.select(0,0);if(V(r))return r.select();if(!L(r)){let e=r.getIndexWithinParent()+1;return i.select(e,e)}return r.select(e,t)}selectNext(e,t){Cp();let n=Ng(this);if(n!==null)return n.selectNext(e,t);let r=this.getNextSibling(),i=this.getParentOrThrow();if(r===null)return i.select();if(V(r))return r.select(0,0);if(!L(r)){let e=r.getIndexWithinParent();return i.select(e,e)}return r.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}};function Wd(e){return e instanceof Ud}let Gd=`history-merge`,Kd=`paste`,qd=`skip-selection-focus`,Jd=`composition-end`;function Yd(e){let t={};if(!e)return t;let n=``,r=``,i=null,a=!1,o=!1,s=!1,c=0,l=e.length,u=-1;for(let d=0;d<l;d++){let l=e[d];if(a)l===`*`&&e[d+1]===`/`&&(a=!1,d++);else if(o)u===-1&&(u=d),o=!1;else if(i===null){if(l!==`/`||e[d+1]!==`*`){if(l!==`"`&&l!==`'`){if(l!==`(`){if(l!==`)`){if(s||l!==`:`||c!==0){if(l===`;`&&c===0){u!==-1&&(s?r+=e.slice(u,d):n+=e.slice(u,d),u=-1);let i=n.trim(),a=r.trim();i!==``&&a!==``&&(t[i]=a),n=``,r=``,s=!1;continue}u===-1&&(u=d)}else u!==-1&&(n+=e.slice(u,d),u=-1),s=!0}else u===-1&&(u=d),c=Math.max(0,c-1)}else u===-1&&(u=d),c++}else u===-1&&(u=d),i=l}else u!==-1&&(s?r+=e.slice(u,d):n+=e.slice(u,d),u=-1),a=!0,d++}else u===-1&&(u=d),l===`\\`?o=!0:l===i&&(i=null)}u!==-1&&(s?r+=e.slice(u,l):n+=e.slice(u,l));let d=n.trim(),f=r.trim();return d!==``&&f!==``&&(t[d]=f),t}function Xd(e,t,n){let r=n.trimEnd(),i=r.length-10;i>=0&&r.slice(i).toLowerCase()===`!important`?e.setProperty(t,r.slice(0,i).trim(),`important`):e.setProperty(t,n,``)}function Zd(e,t,n=``){if(t===n)return;let r=Yd(n),i=Yd(t);for(let t in i)delete r[t],Xd(e,t,i[t]);for(let t in r)e.removeProperty(t)}function Qd(e,t){return 16&t?`code`:t&128?`mark`:32&t?`sub`:64&t?`sup`:null}function $d(e,t){return 1&t?`strong`:2&t?`em`:`span`}function ef(e,t,n,r,i){let a=r.classList,o=uh(i,`base`);o!==void 0&&a.add(...o),o=uh(i,`underlineStrikethrough`);let s=!1,c=8&t&&4&t;o!==void 0&&(8&n&&4&n?(s=!0,c||a.add(...o)):c&&a.remove(...o));for(let e in Ic){let r=Ic[e];if(o=uh(i,e),o!==void 0){if(n&r){if(s&&(e===`underline`||e===`strikethrough`)){t&r&&a.remove(...o);continue}((t&r)===0||c&&e===`underline`||e===`strikethrough`)&&a.add(...o)}else t&r&&a.remove(...o)}}}function tf(e,t,n){let r=n.isComposing(),i=e+(r?Mc:``),a=rg(),o=ig(a).$getDOMSlot(n,t,a),s=o.getFirstChild();if(s===null||s.nodeType!==Node.TEXT_NODE)return void o.insertChild(Bh().createTextNode(i));let c=s,l=c.nodeValue;if(l!==i){if(r||wc){let[e,t,n]=function(e,t){let n=e.length,r=t.length,i=0,a=0;for(;i<n&&i<r&&e[i]===t[i];)i++;for(;a+i<n&&a+i<r&&e[n-a-1]===t[r-a-1];)a++;return[i,n-i-a,t.slice(i,r-a)]}(l,i);t!==0&&c.deleteData(e,t),c.insertData(e,n)}else c.nodeValue=i}}function nf(e,t,n,r,i,a){tf(i,e,t);let o=a.theme.text;o!==void 0&&ef(0,0,r,e,o)}function rf(e,t){let n=Bh().createElement(t);return n.appendChild(e),n}function af(e){return e!=null&&!0===e.__isInlineFormattable}var of=class extends Ud{__text;__format;__style;__mode;__detail;get __isInlineFormattable(){return!0}$config(){return this.config(`text`,{importDOM:{"#text":()=>({conversion:df,priority:0}),b:()=>({conversion:cf,priority:0}),code:()=>({conversion:mf,priority:0}),em:()=>({conversion:mf,priority:0}),i:()=>({conversion:mf,priority:0}),mark:()=>({conversion:mf,priority:0}),s:()=>({conversion:mf,priority:0}),span:()=>({conversion:sf,priority:0}),strong:()=>({conversion:mf,priority:0}),sub:()=>({conversion:mf,priority:0}),sup:()=>({conversion:mf,priority:0}),u:()=>({conversion:mf,priority:0})}})}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text,this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e=``,t){super(t),this.__text=e,this.__format=0,this.__style=``,this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let e=this.getLatest();return Vc[e.__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===Vm()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){let t=Ic[e];return(this.getFormat()&t)!==0}isSimpleText(){return this.__type===`text`&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return Im(this.getLatest().__format,e,t)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,t){let n=this.__format,r=Qd(0,n),i=$d(0,n),a=r===null?i:r,o=Bh().createElement(a),s=o;this.hasFormat(`code`)&&o.setAttribute(`spellcheck`,`false`),r!==null&&(s=Bh().createElement(i),o.appendChild(s)),nf(s,this,0,n,this.__text,e);let c=this.__style;return c!==``&&Zd(o.style,c),o}updateDOM(e,t,n){let r=this.__text,i=e.__format,a=this.__format,o=Qd(0,i),s=Qd(0,a),c=$d(0,i),l=$d(0,a);if((o===null?c:o)!==(s===null?l:s))return!0;if(o===s&&c!==l){let e=t.firstChild;e??j(48);let i=Bh().createElement(l);return nf(i,this,0,a,r,n),t.replaceChild(i,e),!1}let u=t;s!==null&&o!==null&&(u=t.firstChild,u??j(49)),tf(r,u,this);let d=n.theme.text;d!==void 0&&i!==a&&ef(0,i,a,u,d);let f=e.__style,p=this.__style;return f!==p&&Zd(t.style,p,f),!1}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:t}=super.exportDOM(e);return q(t)||j(132),t.style.whiteSpace=`pre-wrap`,this.hasFormat(`lowercase`)?t.style.textTransform=`lowercase`:this.hasFormat(`uppercase`)?t.style.textTransform=`uppercase`:this.hasFormat(`capitalize`)&&(t.style.textTransform=`capitalize`),this.hasFormat(`bold`)&&(t=rf(t,`b`)),this.hasFormat(`italic`)&&(t=rf(t,`i`)),this.hasFormat(`strikethrough`)&&(t=rf(t,`s`)),this.hasFormat(`underline`)&&(t=rf(t,`u`)),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,t){}setFormat(e){let t=this.getWritable();return t.__format=typeof e==`string`?Ic[e]:e,t}setDetail(e){let t=this.getWritable();return t.__detail=typeof e==`string`?Lc[e]:e,t}setStyle(e){let t=this.getWritable();return t.__style=e,t}toggleFormat(e){let t=Im(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){let e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){let e=this.getWritable();return e.__detail^=2,e}setMode(e){let t=Bc[e];if(this.__mode===t)return this;let n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;let t=this.getWritable();return t.__text=e,t}select(e,t){Cp();let n=e,r=t,i=z(),a=this.getTextContent(),o=this.__key;if(typeof a==`string`){let e=a.length;n===void 0&&(n=e),r===void 0&&(r=e)}else n=0,r=0;if(!R(i))return Jf(o,n,o,r,`text`,`text`);{let e=Vm();e!==i.anchor.key&&e!==i.focus.key||Bm(o),i.setTextNodeRange(this,n,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){let e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,r){let i=this.getWritable(),a=i.__text,o=n.length,s=e;s<0&&(s=o+s,s<0&&(s=0));let c=z();if(r&&R(c)){let t=e+o;c.setTextNodeRange(i,t,i,t)}return i.__text=a.slice(0,s)+n+a.slice(s+t),i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){Cp();let t=this.getLatest(),n=t.getTextContent();if(n===``)return[];let r=t.__key,i=Vm(),a=n.length;e.sort((e,t)=>e-t),e.push(a);let o=[],s=e.length;for(let t=0,r=0;t<a&&r<=s;r++){let i=e[r];i>t&&(o.push(n.slice(t,i)),t=i)}let c=o.length;if(c===1)return[t];let l=o[0],u=t.getParent(),d,f=t.getFormat(),p=t.getStyle(),m=t.__detail,h=!1,g=null,_=null,v=z();if(R(v)){let[e,t]=v.isBackward()?[v.focus,v.anchor]:[v.anchor,v.focus];e.type===`text`&&e.key===r&&(g=e),t.type===`text`&&t.key===r&&(_=t)}t.isSegmented()?(d=hf(l),d.__format=f,d.__style=p,d.__detail=m,d.__state=Sl(t,d),h=!0):d=t.setTextContent(l);let y=[d];for(let e=1;e<c;e++){let n=hf(o[e]);n.__format=f,n.__style=p,n.__detail=m,n.__state=Sl(t,n);let a=n.__key;i===r&&Bm(a),y.push(n)}let ee=g?g.offset:null,b=_?_.offset:null,x=0;for(let e of y){if(!g&&!_)break;let t=x+e.getTextContentSize();if(g!==null&&ee!==null&&ee<=t&&ee>=x&&(g.set(e.getKey(),ee-x,`text`),ee<t&&(g=null)),_!==null&&b!==null&&b<=t&&b>=x){_.set(e.getKey(),b-x,`text`);break}x=t}if(u!==null){(function(e){let t=e.getPreviousSibling(),n=e.getNextSibling();t!==null&&zm(t),n!==null&&zm(n)})(this);let e=u.getWritable(),t=this.getIndexWithinParent();h?(e.splice(t,0,y),this.remove()):e.splice(t,1,y),R(v)&&$f(v,u,t,c-1)}return y}mergeWithSibling(e){let t=e===this.getPreviousSibling();t||e===this.getNextSibling()||j(50);let n=this.__key,r=e.__key,i=this.__text,a=i.length;Vm()===r&&Bm(n);let o=z();if(R(o)){let i=o.anchor,s=o.focus;i!==null&&i.key===r&&np(i,t,n,e,a),s!==null&&s.key===r&&np(s,t,n,e,a)}let s=e.__text,c=t?s+i:i+s;this.setTextContent(c);let l=this.getWritable();return e.remove(),l}isTextEntity(){return!1}};function sf(e){return{forChild:gf(e.style),node:null}}function cf(e){let t=e,n=t.style.fontWeight===`normal`;return{forChild:gf(t.style,n?void 0:`bold`),node:null}}let lf=/* @__PURE__ */ new WeakMap;function uf(e){if(!q(e))return!1;if(e.nodeName===`PRE`)return!0;let t=e.style.whiteSpace;return typeof t==`string`&&t.startsWith(`pre`)}function df(e){let t=e;e.parentElement===null&&j(129);let n=t.textContent||``;if(function(e){let t,n=e.parentNode,r=[e];for(;n!==null&&(t=lf.get(n))===void 0&&!uf(n);)r.push(n),n=n.parentNode;let i=t===void 0?n:t;for(let e=0;e<r.length;e++)lf.set(r[e],i);return i}(t)!==null)return{node:sp(n)};if(n=n.replace(/\r/g,``).replace(/[ \t\n]+/g,` `),n===``)return{node:null};if(n[0]===` `){let e=t,r=!0;for(;e!==null&&(e=ff(e,!1))!==null;){let t=e.textContent||``;if(t.length>0){/[ \t\n]$/.test(t)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(n[n.length-1]===` `){let e=t,r=!0;for(;e!==null&&(e=ff(e,!0))!==null;)if((e.textContent||``).replace(/^( |\t|\r?\n)+/,``).length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return n===``?{node:null}:{node:hf(n)}}function ff(e,t){let n=e;for(;;){let e;for(;(e=t?n.nextSibling:n.previousSibling)===null;){let e=n.parentElement;if(e===null)return null;n=e}if(n=e,q(n)){let e=n.style.display;if(e===``&&!$h(n)||e!==``&&!e.startsWith(`inline`))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(Nm(n))return n;if(n.nodeName===`BR`)return null}}let pf={code:`code`,em:`italic`,i:`italic`,mark:`highlight`,s:`strikethrough`,strong:`bold`,sub:`subscript`,sup:`superscript`,u:`underline`};function mf(e){let t=pf[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:gf(e.style,t),node:null}}function hf(e=``){return Oh(new of(e))}function L(e){return e instanceof of}function gf(e,t){let n=e.fontWeight,r=e.textDecoration.split(` `),i=n===`700`||n===`bold`,a=r.includes(`line-through`),o=e.fontStyle===`italic`,s=r.includes(`underline`),c=e.verticalAlign;return e=>((L(e)||af(e))&&(i&&!e.hasFormat(`bold`)&&e.toggleFormat(`bold`),a&&!e.hasFormat(`strikethrough`)&&e.toggleFormat(`strikethrough`),o&&!e.hasFormat(`italic`)&&e.toggleFormat(`italic`),s&&!e.hasFormat(`underline`)&&e.toggleFormat(`underline`),c!==`sub`||e.hasFormat(`subscript`)||e.toggleFormat(`subscript`),c!==`super`||e.hasFormat(`superscript`)||e.toggleFormat(`superscript`),t&&!e.hasFormat(t)&&e.toggleFormat(t)),e)}var _f=class extends of{$config(){return this.config(`tab`,{extends:of})}constructor(e=void 0){super(` `,e),this.__detail=2}createDOM(e){let t=super.createDOM(e),n=uh(e.theme,`tab`);return n!==void 0&&t.classList.add(...n),t}setTextContent(e){return super.setTextContent(` `)}spliceText(e,t,n,r){return n===``&&t===0||n===` `&&t===1||j(286),this}setDetail(e){return e!==2&&j(127),this}setMode(e){return e!==`normal`&&j(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function vf(){return Oh(new _f)}function yf(e){return e instanceof _f}var bf=class{key;offset;type;_selection;constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:C_(L_(O_(this,`next`)),L_(O_(e,`next`)))<0}getNode(){let e=U(this.key);return e===null&&j(20),e}set(e,t,n,r){let i=this._selection,a=this.key;r&&this.key===e&&this.offset===t&&this.type===n||(this.key=e,this.offset=t,this.type=n,Sp()||(Vm()===a&&Bm(e),i!==null&&(i.setCachedNodes(null),R(i)&&(i._cachedIsBackward=null),i.dirty=!0)))}};function xf(e,t,n){return new bf(e,t,n)}function Sf(e,t){let n=t.__key,r=e.offset,i=`element`;if(L(t)){i=`text`;let e=t.getTextContentSize();r>e&&(r=e)}else if(!V(t)){let e=t.getNextSibling();if(L(e))n=e.__key,r=0,i=`text`;else{let e=t.getParent();e&&(n=e.__key,r=t.getIndexWithinParent()+1)}}e.set(n,r,i)}function Cf(e,t){if(V(t)){let n=t.getLastDescendant();V(n)||L(n)?Sf(e,n):Sf(e,t)}else Sf(e,t)}function wf(e,t,n,r){let i=e.getNode(),a=i.getChildAtIndex(e.offset),o=hf();if(o.setFormat(n),o.setStyle(r),um(a))a.splice(0,0,[o]);else if(a!==null){let e=Eh(i)?lm().append(o):o;a.insertBefore(e)}else if(Eh(i)){let e=i.getLastChild();V(e)&&!e.isInline()&&e.isEmpty()?e.append(o):i.append(lm().append(o))}else i.append(o);e.is(t)&&t.set(o.__key,0,`text`),e.set(o.__key,0,`text`)}function Tf(e,t,n,r){let i=e.anchor.getNode();L(i)||j(398);let a=e.anchor.offset,o=hf(t);o.setFormat(n),o.setStyle(r);let s=i.getParentOrThrow();if(a===0)s.isInline()&&!i.__prev?s.insertBefore(o):i.insertBefore(o,!1);else if(a===i.getTextContentSize())s.isInline()&&!i.__next?s.insertAfter(o):i.insertAfter(o,!1);else{let[e]=i.splitText(a);e.insertAfter(o,!1)}i.getTextContent()===``&&i.isAttached()&&i.remove(),o.selectEnd(),o.isComposing()&&e.anchor.type===`text`&&e.anchor.set(e.anchor.key,e.anchor.offset-t.length,e.anchor.type)}var Ef=class e{_nodes;_cachedNodes;dirty;constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!kf(e))return!1;let t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every(e=>n.has(e))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new e(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){let t=this.getNodes().filter(e=>Mg(e)===null),n=t.length;if(n===0)return;let r=t[n-1],i;if(L(r))i=r.select();else{let e=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(e,e)}i.insertNodes(e);for(let e=0;e<n;e++)t[e].remove()}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=this._nodes,n=[];for(let e of t){let t=U(e);t!==null&&n.push(t)}return Sp()||(this._cachedNodes=n),n}getTextContent(){let e=this.getNodes(),t=``;for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}deleteNodes(){let e=this.getNodes().filter(e=>Mg(e)===null);if((z()||Qf())===this&&e[0]){let t=J(e[0],`next`);A_(x_(t,t))}for(let t of e)t.remove();Df()}};function Df(){let e=W();if(e.isEmpty()){let t=lm();e.append(t),t.select()}}function R(e){return e instanceof Of}var Of=class e{format;style;anchor;focus;_cachedNodes;_cachedIsBackward;dirty;constructor(e,t,n,r){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this._cachedIsBackward=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!R(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=function(e){let t=[],[n,r]=e.getTextSlices();n&&t.push(n.caret.origin);let i=/* @__PURE__ */ new Set,a=/* @__PURE__ */ new Set;for(let n of e)if(s_(n)){let{origin:e}=n;t.length===0?i.add(e):(a.add(e),t.push(e))}else{let{origin:e}=n;V(e)&&a.has(e)||t.push(e)}if(r&&t.push(r.caret.origin),o_(e.focus)&&V(e.focus.origin)&&e.focus.getNodeAtCaret()===null)for(let n=m_(e.focus.origin,`previous`);s_(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(t[t.length-1]);n=g_(n))i.delete(n.origin),t.pop();for(;t.length>1;){let e=t[t.length-1];if(!V(e)||a.has(e)||e.isEmpty()||i.has(e))break;t.pop()}if(t.length===0&&e.isCollapsed()){let n=L_(e.anchor),r=L_(e.anchor.getFlipped()),i=e=>a_(e)?e.origin:e.getNodeAtCaret(),a=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(a)}return t}(B_(M_(this),`next`));return Sp()||(this._cachedNodes=t),t}setTextNodeRange(e,t,n,r){return this.anchor.set(e.__key,t,`text`),this.focus.set(n.__key,r,`text`),this}getTextContent(){let e=this.getNodes();if(e.length===0)return``;let t=e[0],n=e[e.length-1],r=this.anchor,i=this.focus,a=r.isBefore(i),[o,s]=Nf(this),c=``,l=!0;for(let u=0;u<e.length;u++){let d=e[u];if(V(d)&&!d.isInline()){l||(c+=`
|
|
147
|
+
`);let e=``;for(let t of Lg(d)){let n=Rg(d,t);n!==null&&(e+=n.getTextContent())}e===``?l=!d.isEmpty():(c+=e,l=!1)}else if(l=!1,L(d)){let e=d.getTextContent();d===t?d===n?r.type===`element`&&i.type===`element`&&i.offset!==r.offset||(e=o<s?e.slice(o,s):e.slice(s,o)):e=a?e.slice(o):e.slice(s):d===n&&(e=a?e.slice(0,s):e.slice(0,o)),c+=e}else!H(d)&&!rm(d)||d===n&&this.isCollapsed()||(c+=d.getTextContent())}return c}applyDOMRange(e){let t=B(),n=t.getEditorState()._selection,r=Kf(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(r===null)return;let[i,a,o]=r;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(a.key,a.offset,a.type,!0),o&&(this.dirty=!0),El(this)}clone(){let t=this.anchor,n=this.focus;return new e(xf(t.key,t.offset,t.type),xf(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(e){this.format=Im(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){let t=Ic[e];return(this.format&t)!==0}insertRawText(e){this.insertNodes(sp(e))}insertText(e){let t=this.format,n=this.style;if(!this.isCollapsed()){let r=(this.focus.isBefore(this.anchor)?this.focus:this.anchor).getNode();if(L(r)&&(t=r.getFormat(),n=r.getStyle()),this.removeText(),this.format=t,this.style=n,e===``)return;if(Vm()===null)return this.anchor.type===`element`&&wf(this.anchor,this.focus,t,n),void Tf(this,e,t,n)}this.anchor.type===`element`&&wf(this.anchor,this.focus,t,n);let r=this.anchor.getNode();L(r)||j(398);let i=this.anchor.offset,a=r.getParentOrThrow(),o=r.getTextContentSize();if(Mm(r)||i===0&&(!r.canInsertTextBefore()||!a.canInsertTextBefore()&&!r.__prev)||i===o&&(!r.canInsertTextAfter()||!a.canInsertTextAfter()&&!r.__next)){if(r.isSegmented()&&i!==0&&i!==o){if(Vm()!==null)r.setMode(`normal`).setFormat(t).setStyle(n);else{let e=hf(r.getTextContent());e.setFormat(t),e.setStyle(n),r.replace(e),e.select(i,i)}e!==``&&this.insertText(e);return}if(e===``)return;if(i===0){let i=r.getPreviousSibling();if(L(i)&&i.canInsertTextAfter()&&!Mm(i))i.select();else{let e=hf();e.setFormat(t),e.setStyle(n),a.canInsertTextBefore()?r.insertBefore(e):a.insertBefore(e),e.select()}this.insertText(e);return}if(i===o){let i=r.getNextSibling();if(L(i)&&i.canInsertTextBefore()&&!Mm(i))i.select(0,0);else{let e=hf();e.setFormat(t),e.setStyle(n),a.canInsertTextAfter()?r.insertAfter(e):a.insertAfter(e),e.select(0,0)}this.insertText(e);return}let s=hf(e);s.setFormat(t),s.setStyle(n),r.replace(s),s.select();return}if(e===``)return;let s=a.isInline()&&i===0&&!r.__prev,c=a.isInline()&&i===o&&!r.__next,l=r.getFormat()!==t||r.getStyle()!==n;if(s||c||l){if(r.getTextContent()!==``||s||c)return void Tf(this,e,t,n);r.setFormat(t),r.setStyle(n)}r.spliceText(i,0,e,!0),r.isComposing()&&this.anchor.type===`text`&&this.anchor.set(this.anchor.key,this.anchor.offset-e.length,this.anchor.type)}removeText(){let e=z()===this;j_(this,I_(M_(this))),e&&z()!==this&&Jm(this)}formatText(e,t=null){jf(this,e,t)}insertNodes(e){if(e.length===0)return;this.isCollapsed()||this.removeText();let t=this.anchor.getNode();if(this.anchor.type===`element`&&V(t)&&Mg(t)!==null){let n=t.isShadowRoot()?t.getFirstChild()??t.append(lm()).getFirstChild():t.getFirstChild();if(t.isShadowRoot()&&n!==null&&!V(n)){let e=lm();n.insertBefore(e),n=e}if(n!==null){n.selectStart();let t=z();return R(t)||j(369),t.insertNodes(e)}}if(this.anchor.type===`element`&&Eh(t)){let n=fp(e),r=n.getLastDescendant();t.splice(this.anchor.offset,0,n.getChildren()),r!==null&&r.selectEnd();return}let n=(this.isBackward()?this.focus:this.anchor).getNode(),r=Eg(n,ng),i=e[e.length-1];if(V(r)&&`__language`in r){if(`__language`in e[0])this.insertText(e[0].getTextContent());else{let t=lp(this);r.splice(t,0,e),i.selectEnd()}return}if(!e.some(e=>(V(e)||H(e))&&!e.isInline())){V(r)||j(211,n.constructor.name,n.getType());let t=lp(this);r.splice(t,0,e),i.selectEnd();return}if(V(r)&&Mg(r)!==null){let t=lp(this),n=cp(e);r.splice(t,0,n);let i=n[n.length-1];i===void 0?r.select(t,t):i.selectEnd();return}if(r===null){let t=fp(e),n=t.getLastDescendant(),r=O_(this.anchor,`next`);for(let e of t.getChildren())r=G_(e,r);n!==null&&n.selectEnd();return}if(V(r)&&!r.isParentRequired()&&!Eh(r.getParentOrThrow())){let t=lp(this),n=cp(e);r.splice(t,0,n);let i=n[n.length-1];i===void 0?r.select(t,t):i.selectEnd();return}let a=fp(e),o=a.getLastDescendant(),s=a.getChildren(),c=!V(r)||!r.isEmpty()?this.insertParagraph():null;c&&!r.isAttached()&&(n=this.anchor.getNode(),r=Eg(n,ng));let l=s[s.length-1],u=s[0];var d;V(d=u)&&ng(d)&&!d.isEmpty()&&V(r)&&(!r.isEmpty()||r.canMergeWhenEmpty())&&(V(r)||j(211,n.constructor.name,n.getType()),r.append(...u.getChildren()),u=s[1]),u&&(r===null&&j(212,n.constructor.name,n.getType()),function(e,t){let n=t.getParentOrThrow().getLastChild(),r=t,i=[t];for(;r!==n;)r.getNextSibling()||j(140),r=r.getNextSibling(),i.push(r);let a=e;for(let e of i)a=a.insertAfter(e)}(r,u));let f=Eg(o,ng);c&&V(f)&&(c.canMergeWhenEmpty()||ng(l))&&(f.append(...c.getChildren()),c.remove()),V(r)&&r.isEmpty()&&r.remove(),o.selectEnd();let p=V(r)?r.getLastChild():null;rm(p)&&f!==r&&p.remove()}insertParagraph(){let e=this.anchor.getNode();if(this.anchor.type===`element`&&Eh(e)){let t=lm();return e.splice(this.anchor.offset,0,[t]),t.select(),t}let t=lp(this),n=Eg(this.anchor.getNode(),ng);if(n!==null&&Mg(n)!==null)return null;V(n)||j(213);let r=n.getChildAtIndex(t),i=r?[r,...r.getNextSiblings()]:[],a=n.insertNewAfter(this,!1);return a?(a.append(...i),a.selectStart(),a):null}insertLineBreak(e){let t=nm();if(this.insertNodes([t]),e){let e=t.getParentOrThrow(),n=t.getIndexWithinParent();e.select(n,n)}}extract(){let e=[...this.getNodes()],t=e.length,n=e[0],r=e[t-1],[i,a]=Nf(this),o=this.isBackward(),[s,c]=o?[this.focus,this.anchor]:[this.anchor,this.focus],[l,u]=o?[a,i]:[i,a];if(t===0)return[];if(t===1){if(L(n)&&!this.isCollapsed()){let e=n.splitText(l,u),t=l===0?e[0]:e[1];return t?(s.set(t.getKey(),0,`text`),c.set(t.getKey(),t.getTextContentSize(),`text`),[t]):[]}return[n]}if(L(n)&&(l===n.getTextContentSize()?e.shift():l!==0&&([,n]=n.splitText(l),e[0]=n,s.set(n.getKey(),0,`text`))),L(r)){let t=r.getTextContent().length;u===0?e.pop():u!==t&&([r]=r.splitText(u),e[e.length-1]=r,c.set(r.getKey(),r.getTextContentSize(),`text`))}return e}modify(e,t,n){if(pp(this,e,t,n))return;let r=e===`move`,i=B(),a=Nh(Sh(i));if(!a)return;let o=i._blockCursorElement,s=i._rootElement,c=this.focus.getNode();s===null||o===null||!V(c)||c.isInline()||c.canBeEmpty()||Mh(o,i,s);let l=hh(i,this.focus.key),u=l;if(this.focus.type===`text`&&(u=L(c)?sg(c,l,i):null),this.dirty){let e=hh(i,this.anchor.key),t=e;if(this.anchor.type===`text`){let n=this.anchor.getNode();t=L(n)?sg(n,e,i):null}t&&u&&rp(a,t,this.anchor.offset,u,this.focus.offset)}if(n===`character`&&L(c)&&c.isUnmergeable()&&(t?this.focus.offset===0:this.focus.offset===c.getTextContentSize())){let e=J(c,t?`previous`:`next`).getNodeAtCaret();if(L(e)){if(!r){let n=e.getTextContentSize();t?this.focus.set(e.__key,n-1,`text`):this.focus.set(e.__key,1,`text`),this.dirty=!0;return}{let n=i.getElementByKey(e.getKey()),r=n?sg(e,n,i):null;if(r){let e=t?r.length:0;rp(a,r,e,r,e)}}}}if(If(a,e,t?`backward`:`forward`,n),a.rangeCount>0){let e=Vh(a,i._rootElement),n=e||a.getRangeAt(0),o=this.anchor.getNode(),s=qp(o)?o:wh(o);this.applyDOMRange(n),this.dirty=!0,!r&&(Lf(this,t,s),(e?a.direction!==`backward`:a.anchorNode===n.startContainer&&a.anchorOffset===n.startOffset)||Ff(this))}n===`lineboundary`&&pp(this,e,t,n,`decorators`)}forwardDeletion(e,t,n){if(!n&&(e.type===`element`&&V(t)&&e.offset===t.getChildrenSize()||e.type===`text`&&e.offset===t.getTextContentSize())){let e=t.getParent(),n=t.getNextSibling()||(e===null?null:e.getNextSibling());if(V(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(e){let t=this.isCollapsed();if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;let r=y_(O_(t,e?`previous`:`next`));if(r.getTextSlices().every(e=>e===null||e.distance===0)){let e={type:`initial`};for(let t of r.iterNodeCarets(`shadowRoot`))if(s_(t)){if(!t.origin.isInline()){if(t.origin.isShadowRoot()){if(e.type===`merge-block`)break;if(V(r.anchor.origin)&&r.anchor.origin.isEmpty()){let e=L_(t);j_(this,x_(e,e)),r.anchor.origin.remove()}return}e.type!==`merge-next-block`&&e.type!==`merge-block`||(e={block:e.block,caret:t,type:`merge-block`})}}else{if(e.type===`merge-block`)break;if(o_(t)){if(V(t.origin)){if(t.origin.isInline()){if(!t.origin.isParentOf(r.anchor.origin))break}else e={block:t.origin,type:`merge-next-block`};continue}if(H(t.origin)){if(!t.origin.isIsolated()){if(Lg(t.origin).length>0){if(V(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();let e=Xf();e.add(t.origin.getKey()),Jm(e)}}else if(e.type===`merge-next-block`&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&V(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();let e=Xf();e.add(t.origin.getKey()),Jm(e)}else t.origin.remove()}return}break}}if(e.type===`merge-block`){let{caret:t,block:n}=e;return Lg(n).length>0?void 0:t.origin.isEmpty()&&!n.isEmpty()&&t.origin.getParent()===n.getParent()?void t.origin.remove(!0):(j_(this,x_(!t.origin.isEmpty()&&n.isEmpty()?N_(J(n,t.direction)):r.anchor,t)),this.removeText())}for(let e=t.getNode();e!==null;){if(Mg(e)!==null)return;if(V(e)&&e.isShadowRoot())break;e=e.getParent()}}let i=this.focus;if(Rf(this,e,`character`),this.isCollapsed()){if(e&&t.offset===0&&Pf(this,t.getNode()))return}else{let r=i.type===`text`?i.getNode():null;if(n=t.type===`text`?t.getNode():null,r!==null&&r.isSegmented()){let t=i.offset,a=r.getTextContentSize();if(r.is(n)||e&&t!==a||!e&&t!==0)return void Bf(r,e,t)}else if(n!==null&&n.isSegmented()){let i=t.offset,a=n.getTextContentSize();if(n.is(r)||e&&i!==0||!e&&i!==a)return void Bf(n,e,i)}(function(e,t){let n=e.anchor,r=e.focus,i=n.getNode();if(i===r.getNode()&&n.type===`text`&&r.type===`text`){let e=n.offset,a=r.offset,o=e<a,s=o?e:a,c=o?a:e,l=c-1;s!==l&&(function(e){return!(Zm(e)||zf(e))})(i.getTextContent().slice(s,c))&&(t?r.set(r.key,l,r.type):n.set(n.key,l,n.type))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type===`element`&&this.anchor.offset===0){let e=this.anchor.getNode();e.isEmpty()&&qp(e.getParent())&&e.getPreviousSibling()===null&&Pf(this,e),Df()}}deleteLine(e){let t=Uf(this.anchor);if(t!==null&&H(Ng(t)))return this.isCollapsed()||this.focus.set(this.anchor.key,this.anchor.offset,this.anchor.type),void this.deleteCharacter(e);this.isCollapsed()&&Rf(this,e,`lineboundary`),this.isCollapsed()?this.deleteCharacter(e):Eg(this.anchor.getNode(),ng)===Eg(this.focus.getNode(),ng)?this.removeText():(this.focus.set(this.anchor.key,this.anchor.offset,this.anchor.type),this.deleteCharacter(e))}deleteWord(e){if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;Rf(this,e,`word`)}this.isCollapsed()?this.deleteCharacter(e):this.removeText()}isBackward(){let e=this._cachedIsBackward;if(e!==null)return e;let t=this.focus.isBefore(this.anchor);return Sp()||(this._cachedIsBackward=t),t}getStartEndPoints(){return[this.anchor,this.focus]}};function kf(e){return e instanceof Ef}function Af(e,t){if(kf(e)){for(let n of e.getNodes())af(n)&&n.setFormat(t(n.getFormat()));return}if(e.isCollapsed())return e.setFormat(t(e.format)),void Bm(null);let n=[];for(let r of e.getNodes())L(r)?n.push(r):V(r)?r.setTextFormat(t(r.getTextFormat())):af(r)&&r.setFormat(t(r.getFormat()));let r=n.length;if(r===0)return e.setFormat(t(e.format)),void Bm(null);let i=e.anchor,a=e.focus,o=e.isBackward(),s=o?a:i,c=o?i:a,l=0,u=n[0],d=s.type===`element`?0:s.offset;if(s.type===`text`&&d===u.getTextContentSize()&&(l=1,u=n[1],d=0),u==null)return;let f=r-1,p=n[f],m=c.type===`text`?c.offset:p.getTextContentSize();if(u.is(p)){if(d===m)return;let n=t(u.getFormat());if(Mm(u)||d===0&&m===u.getTextContentSize())u.setFormat(n);else{let e=u.splitText(d,m),t=d===0?e[0]:e[1];t.setFormat(n),s.type===`text`&&s.set(t.__key,0,`text`),c.type===`text`&&c.set(t.__key,m-d,`text`)}e.format=n;return}d===0||Mm(u)||([,u]=u.splitText(d),d=0);let h=t(u.getFormat());u.setFormat(h);let g=t(p.getFormat());m>0&&(m===p.getTextContentSize()||Mm(p)||([p]=p.splitText(m)),p.setFormat(g));for(let e=l+1;e<f;e++){let r=n[e];r.setFormat(t(r.getFormat()))}s.type===`text`&&s.set(u.__key,d,`text`),c.type===`text`&&c.set(p.__key,m,`text`),e.format=h|g}function jf(e,t,n=null){let r=n===null&&R(e)?Im(e.format,t,null):n;Af(e,e=>Im(e,t,r))}function Mf(e){let t=e.offset;if(e.type===`text`)return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function Nf(e){let t=e.getStartEndPoints();if(t===null)return[0,0];let[n,r]=t;return n.type===`element`&&r.type===`element`&&n.key===r.key&&n.offset===r.offset?[0,0]:[Mf(n),Mf(r)]}function Pf(e,t){for(let n=t;n;n=n.getParent()){if(V(n)){if(n.collapseAtStart(e))return!0;if(Eh(n))break}if(n.getPreviousSibling())break}return!1}function Ff(e){let t=e.focus,n=e.anchor,r=n.key,i=n.offset,a=n.type;n.set(t.key,t.offset,t.type,!0),t.set(r,i,a,!0)}function If(e,t,n,r){e.modify(t,n,r)}function Lf(e,t,n){let r=e.getNodes(),i=r.filter(e=>bh(e,n));if(i.length===0||i.length===r.length)return!1;let a=t?i[0]:i[i.length-1],o=V(a)?a:a.getParentOrThrow();return t?o.selectStart():o.selectEnd(),!0}function Rf(e,t,n){if(pp(e,`extend`,t,n))return;let r=B(),i=Nh(Sh(r));if(!i||typeof i.modify!=`function`)return;let a=r._blockCursorElement,o=r._rootElement,s=e.anchor,c=e.focus.getNode();o===null||a===null||!V(c)||c.isInline()||c.canBeEmpty()||Mh(a,r,o);let l=e=>{let t=e.getNode(),n=r.getElementByKey(e.key);return n!==null&&e.type===`text`&&L(t)?sg(t,n,r):n},u=s.getNode(),d=l(s);if(d===null)return;let f=s.offset,p=e.isCollapsed(),m=e.focus,h=p?d:l(m);if(h===null)return;let g=m.offset;if(rp(i,h,g,h,g),If(i,`move`,t?`backward`:`forward`,n),i.rangeCount===0)return;let _=Vh(i,o)||i.getRangeAt(0),v=_.startContainer,y=_.startOffset;if(p&&n===`character`&&s.type===`text`&&L(u)&&u.isUnmergeable()&&f===(t?0:u.getTextContentSize())){let n=J(u,t?`previous`:`next`).getNodeAtCaret();if(L(n)){let r=t?n.getTextContentSize()-1:1;e.focus.set(n.__key,r,`text`),e.dirty=!0;return}}if(p&&n===`character`&&s.type===`text`){let n=t?0:u.getTextContentSize(),r=v===d?y:f===n?-1:n;if(r>=0)return void(r!==f&&(e.focus.set(s.key,r,`text`),e.dirty=!0))}let[ee,b,x,S]=t?[v,y,d,f]:[d,f,v,y],te=qp(u)?u:wh(u);e.applyDOMRange({collapsed:!1,endContainer:x,endOffset:S,startContainer:ee,startOffset:b}),e.dirty=!0,!Lf(e,t,te)&&t&&Ff(e),n===`lineboundary`&&pp(e,`extend`,t,n,`decorators`)}let zf=(()=>{try{let e=RegExp(`\\p{Emoji}`,`u`),t=e.test.bind(e);if(t(`❤️`)&&t(`#️⃣`)&&t(`👍`))return t}catch{}return()=>!1})();function Bf(e,t,n){let r=e,i=r.getTextContent().split(/(?=\s)/g),a=i.length,o=0,s=0;for(let e=0;e<a;e++){let r=e===a-1;if(s=o,o+=i[e].length,t&&o===n||o>n||r){i.splice(e,1),r&&(s=void 0);break}}let c=i.join(``).trim();c===``?r.remove():(r.setTextContent(c),r.select(s,s))}function Vf(e,t,n,r){let i,a=t,o=!1;if(q(e)){let s=!1,c=e.childNodes,l=c.length,u=r._blockCursorElement;a===l&&l>0&&(s=!0,a=l-1),Wm(e,r)!==void 0||yg(e,r)||(o=!0);let d=c[a],f=!1;if(d===u)d=c[a+1],f=!0;else if(u!==null){let n=u.parentNode;e===n&&t>Array.prototype.indexOf.call(n.children,u)&&a--}if(i=Xm(d),L(i))a=f_(i,s?`next`:`previous`);else{let c=Xm(e);if(c===null)return null;if(V(c)){let o=r.getElementByKey(c.getKey());o===null&&j(214);let l=ag(c,o,r);[c,a]=l.resolveChildIndex(c,o,e,t),V(c)||j(215),s&&a>=c.getChildrenSize()&&(a=Math.max(0,c.getChildrenSize()-1));let u=c.getChildAtIndex(a);if(V(u)&&function(e,t,n){let r=e.getParent();return n===null||r===null||!r.canBeEmpty()||r!==n.getNode()}(u,0,n)){let e=s?u.getLastDescendant():u.getFirstDescendant();e===null?c=u:(u=e,c=V(u)?u:u.getParentOrThrow()),a=0}L(u)?(i=u,c=null,a=f_(u,s?`next`:`previous`)):u!==c&&s&&!f&&(V(c)||j(216),a=Math.min(c.getChildrenSize(),a+1))}else{let n=Ng(c),i=n===null?c:n,o=i.getIndexWithinParent(),s=r.getElementByKey(c.getKey()),l=`after`;if(s!==null&&Xm(e)===c){let n=ag(c,s,r);n.element===s?t===0&&H(c)&&(l=`before`):l=n.resolveLeafPosition(s,e,t)}a=l===`before`?o:o+1,c=i.getParentOrThrow()}if(V(c))return[xf(c.__key,a,`element`),o]}}else i=Xm(e);return L(i)?[xf(i.__key,f_(i,a,`clamp`),`text`),o]:null}function Hf(e,t,n){let r=e.offset,i=e.getNode();if(r===0){let r=i.getPreviousSibling(),a=i.getParent();if(t){if((n||!t)&&r===null&&V(a)&&a.isInline()){let t=a.getPreviousSibling();L(t)&&e.set(t.__key,t.getTextContent().length,`text`)}}else V(r)&&!n&&r.isInline()?e.set(r.__key,r.getChildrenSize(),`element`):L(r)&&!i.isUnmergeable()&&e.set(r.__key,r.getTextContent().length,`text`)}else if(r===i.getTextContent().length){let r=i.getNextSibling(),a=i.getParent();if(t&&V(r)&&r.isInline())e.set(r.__key,0,`element`);else if((n||t)&&r===null&&V(a)&&a.isInline()&&!a.canInsertTextAfter()&&a.getTextContentSize()>1){let t=a.getNextSibling();L(t)&&e.set(t.__key,0,`text`)}}}function Uf(e){let t=U(e.key);return t===null?null:Fg(t)}function Wf(e,t,n){let r=Uf(e),i=Uf(t);if(r===i||r!==null&&i!==null&&r.is(i))return!1;let a=n(r,i);if(r!==null)return V(r)?t.set(r.getKey(),a?r.getChildrenSize():0,`element`):t.set(r.getKey(),a?r.getTextContentSize():0,`text`),!0;let o=Ng(i);if(o===null)return!1;let s=o.getParent();if(s===null)return!1;let c=o.getIndexWithinParent();return t.set(s.getKey(),a?c+1:c,`element`),!0}function Gf(e){let t=Wf(e.anchor,e.focus,(t,n)=>function(e,t,n,r){if(n!==null&&r!==null){let e=Ng(n),t=Ng(r);if(e!==null&&e.is(t)){for(let t of Ig(e).values()){if(t===n.getKey())return!0;if(t===r.getKey())return!1}return!0}return e===null||t===null||e.isBefore(t)}if(n!==null){let e=Ng(n),r=U(t.key);return e===null||r===null||!(!e.is(r)&&!e.isParentOf(r))||e.isBefore(r)}let i=Ng(r),a=U(e.key);return i!==null&&a!==null&&!i.is(a)&&!i.isParentOf(a)&&a.isBefore(i)}(e.anchor,e.focus,t,n));return t&&(e.dirty=!0),t}function Kf(e,t,n,r,i,a){if(e===null||n===null||!Dm(i,e,n))return null;let o=Vf(e,t,R(a)?a.anchor:null,i);if(o===null)return null;let s=Vf(n,r,R(a)?a.focus:null,i);if(s===null)return null;let[c,l]=o,[u,d]=s;if(c.type===`element`&&u.type===`element`){let t=Xm(e),r=Xm(n);if(H(t)&&H(r))return null}let f=i._slotsUsed&&Wf(c,u,()=>(e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)!==0);return function(e,t){if(e.type===`text`&&t.type===`text`){let n=e.isBefore(t),r=e.is(t);Hf(e,n,r),Hf(t,!n,r),r&&t.set(e.key,e.offset,e.type)}}(c,u),[c,u,l||d||f]}function qf(e){return V(e)&&!e.isInline()}function Jf(e,t,n,r,i,a){let o=Tp(),s=new Of(xf(e,t,i),xf(n,r,a),0,``);return s.dirty=!0,o._selection=s,s}function Yf(){return new Of(xf(`root`,0,`element`),xf(`root`,0,`element`),0,``)}function Xf(){return new Ef(/* @__PURE__ */ new Set)}function Zf(e,t,n,r){let i=n._window;if(i===null)return null;let a=r||i.event,o=a?a.type:void 0,s=o===`selectionchange`,c=!tl&&(s||o===`beforeinput`||o===`compositionstart`||o===`compositionend`||o===`click`&&a&&a.detail===3||o===`drop`||o===void 0),l,u,d,f;if(R(e)&&!c)return e.clone();{if(t===null)return null;let r=Uh(t,n._rootElement);if(l=r.anchorNode,u=r.focusNode,d=r.anchorOffset,f=r.focusOffset,(s||o===void 0)&&R(e)&&!Dm(n,l,u))return e.clone()}let p=Kf(l,d,u,f,n,e);if(p===null)return null;let[m,h,g]=p,_=0,v=``;if(R(e)){let t=e.anchor;if(m.key===t.key)_=e.format,v=e.style;else{let e=m.getNode();L(e)?(_=e.getFormat(),v=e.getStyle()):V(e)&&(_=e.getTextFormat(),v=e.getTextStyle())}}let y=new Of(m,h,_,v);return g&&(y.dirty=!0),y}function z(){return Tp()._selection}function Qf(){return B()._editorState._selection}function $f(e,t,n,r=1){let i=e.anchor,a=e.focus,o=i.getNode(),s=a.getNode();if(!t.is(o)&&!t.is(s))return;let c=t.__key;if(e.isCollapsed()){let t=i.offset;if(n<=t&&r>0||n<t&&r<0){let n=Math.max(0,t+r);i.set(c,n,`element`),a.set(c,n,`element`),ep(e)}}else{let o=e.isBackward(),s=o?a:i,l=s.getNode(),u=o?i:a,d=u.getNode();if(t.is(l)){let e=s.offset;(n<=e&&r>0||n<e&&r<0)&&s.set(c,Math.max(0,e+r),`element`)}if(t.is(d)){let e=u.offset;(n<=e&&r>0||n<e&&r<0)&&u.set(c,Math.max(0,e+r),`element`)}}ep(e)}function ep(e){let t=e.anchor,n=t.offset,r=e.focus,i=r.offset,a=t.getNode(),o=r.getNode();if(e.isCollapsed()){if(!V(a))return;let e=a.getChildrenSize(),i=n>=e,o=i?a.getChildAtIndex(e-1):a.getChildAtIndex(n);if(L(o)){let e=0;i&&(e=o.getTextContentSize()),t.set(o.__key,e,`text`),r.set(o.__key,e,`text`)}}else{if(V(a)){let e=a.getChildrenSize(),r=n>=e,i=r?a.getChildAtIndex(e-1):a.getChildAtIndex(n);if(L(i)){let e=0;r&&(e=i.getTextContentSize()),t.set(i.__key,e,`text`)}}if(V(o)){let e=o.getChildrenSize(),t=i>=e,n=t?o.getChildAtIndex(e-1):o.getChildAtIndex(i);if(L(n)){let e=0;t&&(e=n.getTextContentSize()),r.set(n.__key,e,`text`)}}}}function tp(e,t,n,r,i){let a=null,o=0,s=null;r===null?i!==null&&(a=i.__key,L(i)?s=`text`:V(i)&&(s=`element`)):(a=r.__key,L(r)?(o=r.getTextContentSize(),s=`text`):V(r)&&(o=r.getChildrenSize(),s=`element`)),a!==null&&s!==null?e.set(a,o,s):(o=t.getIndexWithinParent(),o===-1&&(o=n.getChildrenSize()),e.set(n.__key,o,`element`))}function np(e,t,n,r,i){e.type===`text`?e.set(n,e.offset+(t?0:i),`text`):e.offset>r.getIndexWithinParent()&&e.set(e.key,e.offset-1,`element`)}function rp(e,t,n,r,i){try{e.setBaseAndExtent(t,n,r,i)}catch{}}function ip(e,t,n){let r=hh(e,t.getKey());if(V(t)){let i=ag(t,r,e);return[i.element,n+i.getFirstChildOffset()]}return[r,n]}function ap(e,t,n,r,i,a){let o=a.getRootNode(),s=Pm(o)||Fh(o)?Jh(o):null;if(i.has(`collaboration`)&&s!==a||s!==null&&Em(s,s))return;let c=Uh(r,a),l;if(!R(t))return void(e!==null&&Dm(n,c.anchorNode,c.focusNode)&&r.removeAllRanges());let u=t.anchor,d=t.focus,f=u.getNode(),p=d.getNode(),[m,h]=ip(n,f,u.offset),[g,_]=ip(n,p,d.offset),v=t.format,y=t.style,ee=t.isCollapsed(),b=m,x=g,S=!1;if(u.type===`text`?(b=L(f)?sg(f,m,n):null,S=f.getFormat()!==v||f.getStyle()!==y):R(e)&&e.anchor.type===`text`&&(S=!0),d.type===`text`&&(x=L(p)?sg(p,g,n):null),b!==null&&x!==null){if(ee&&(e===null||S||R(e)&&(e.format!==v||e.style!==y))&&function(e,t,n,r,i,a){e._inputState.collapsedSelectionFormat={format:t,key:i,offset:r,style:n,timeStamp:a}}(n,v,y,h,u.key,performance.now()),(r.type!==`Range`||!ee)&&c.anchorOffset===h&&c.focusOffset===_&&c.anchorNode===b&&c.focusNode===x){if(s===null||!a.contains(s)){let e=s===null?null:km(s);e!==null&&e!==n||i.has(`skip-selection-focus`)||a.focus({preventScroll:!0})}if(u.type!==`element`)return}if(rp(r,b,h,x,_),wc&&t.isCollapsed()&&a!==null&&!i.has(`skip-selection-focus`)){let e=qh(a);if(e===null||!a.contains(e)){let e=Jh(a.ownerDocument),t=e===null?null:km(e);t!==null&&t!==n||a.focus({preventScroll:!0})}}if(!i.has(`skip-scroll-into-view`)&&t.isCollapsed()&&a!==null&&a===qh(a)){let e=R(t)&&t.anchor.type===`element`?b.childNodes[h]||null:(l===void 0&&(l=Hh(r,a)),l);if(e!==null){let t;if(Nm(e)){let n=e.ownerDocument.createRange();n.selectNode(e),t=n.getBoundingClientRect()}else t=e.getBoundingClientRect();(function(e,t,n){let r=_h(n),i=xh(r);if(r===null||i===null)return;let a=n.getBoundingClientRect();if(t.bottom<a.top)return;let{top:o,bottom:s}=t,c=0,l=0,u=n;for(;u!==null;){let t=u===r.body;if(t){let t=i.visualViewport;if(t){let e=t.pageTop-i.scrollY;c=e,l=e+t.height}else c=0,l=Sh(e).innerHeight;let n=i.getComputedStyle(r.documentElement),a=parseFloat(n.scrollPaddingTop),o=parseFloat(n.scrollPaddingBottom);isFinite(a)&&(c+=a),isFinite(o)&&(l-=o)}else{let e=u===n?a:u.getBoundingClientRect();c=e.top,l=e.bottom}let d=0;if(o<c?d=-(c-o):s>l&&(d=s-l),d!==0){if(t)i.scrollBy(0,d);else{let e=u.scrollTop;u.scrollTop+=d;let t=u.scrollTop-e;o-=t,s-=t}}if(t)break;u=gh(u)}})(n,t,a)}}(function(e){e._inputState.isSelectionChangeFromDOMUpdate=!0})(n)}}function op(e,t){for(let n of e.split(/(\r?\n|\t)/))n===`
|
|
148
148
|
`||n===`\r
|
|
149
|
-
`?t.linebreak():n===` `?t.tab():n!==``&&t.text(n)}function op(e){let t=[];return ap(e,{linebreak:()=>t.push(tm()),tab:()=>t.push(_f()),text:e=>t.push(mf(e))}),t}function sp(e){let t=[];for(let n of e)nm(n)||(!H(n)&&!U(n)||n.isInline()?t.push(n):H(n)&&t.push(...sp(n.getChildren())));return t}function cp(e){let t=e;e.isCollapsed()||t.removeText();let n=B();z(n)&&(t=n),z(t)||M(161);let r=t.anchor,i=r.getNode(),a=r.offset;for(;!tg(i)&&jg(i)===null;){let e=i;if([i,a]=lp(i,a),e.is(i))break}return a}function lp(e,t){let n=e.getParent();if(!n){let e=cm();return G().append(e),e.select(),[G(),0]}if(R(e)){let r=e.splitText(t);if(r.length===0)return[n,e.getIndexWithinParent()];let i=t===0?0:1;return[n,r[0].getIndexWithinParent()+i]}if(!H(e)||t===0)return[n,e.getIndexWithinParent()];let r=e.getChildAtIndex(t);if(r){let n=new Df(bf(e.__key,t,`element`),bf(e.__key,t,`element`),0,``),i=e.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function up(e){return nm(e)||Sh(e)||R(e)||e.isParentRequired()}function dp(e){let t=cm(),n=null;for(let r=0;r<e.length;r++){let i=e[r];if(up(i)){if(n===null){n=i.createParentElementNode(),t.append(n);let a=e[r+1];if(nm(i)&&(a===void 0||!up(a)))continue}n.append(i)}else t.append(i),n=null}return t}function fp(e,t,n,r,i=`decorators-and-blocks`){if(t===`move`&&r===`character`&&!e.isCollapsed()){let[t,r]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return r.set(t.key,t.offset,t.type),!0}let a=D_(e.focus,n?`previous`:`next`),o=r===`lineboundary`,s=t===`move`,c=a,l=i===`decorators-and-blocks`;if(!L_(c)){for(let e of c){l=!1;let{origin:t}=e;if(!U(t)||t.isIsolated()||(c=e,!o||!t.isInline()))break}if(l)for(let e of v_(a).iterNodeCarets(t===`extend`?`shadowRoot`:`root`)){if(o_(e))e.origin.isInline()||(c=e);else{if(H(e.origin))continue;U(e.origin)&&!e.origin.isInline()&&(c=e)}break}}if(c===a)return!1;if(s&&!o&&U(c.origin)&&c.origin.isKeyboardSelectable()){let e=Yf();return e.add(c.origin.getKey()),qm(e),!0}return c=I_(c),s&&O_(e.anchor,c),O_(e.focus,c),l||!o}let pp=null,mp=null,hp=!1,gp=!1,_p=!1,vp=/* @__PURE__ */ new Set,yp=0,bp={characterData:!0,childList:!0,subtree:!0};function xp(){return hp||pp!==null&&pp._readOnly}function Sp(){hp&&M(13)}function Cp(){yp>99&&M(14)}function wp(){return pp===null&&M(195,Dp()),pp}function Tp(e){wp()!==null&&mp===null&&(mp=e),mp!==e&&yc(378)}function V(){return mp===null&&M(337,Dp()),mp}function Ep(){V()._dirtyType=2}function Dp(){let e=0,t=/* @__PURE__ */ new Set,n=_m.version;if(typeof window<`u`)for(let r of Lh(document)){let i=km(r);if(Dm(i))e++;else if(i){let e=String(i.constructor.version||`<0.17.1`);e===n&&(e+=` (separately built, likely a bundler configuration issue)`),t.add(e)}}let r=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(`, `)}`),r}function Op(){return mp}function kp(e,t,n){let r=t.__type,i=Sm(e,r),a=n.get(r);a===void 0&&(a=Array.from(i.transforms),n.set(r,a));let o=a.length;for(let e=0;e<o&&(a[e](t),t.isAttached());e++);}function Ap(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function jp(e,t){if(!t)return;let n=e._updateTags,r=t;Array.isArray(t)||(r=[t]);for(let e of r)n.add(e)}function Mp(e,t){let n=e.type,r=t.get(n);r===void 0&&M(17,n);let i=r.klass;e.type!==i.getType()&&M(18,i.name);let a=i.importJSON(e),o=e.children;if(H(a)&&Array.isArray(o))for(let e=0;e<o.length;e++){let n=Mp(o[e],t);a.append(n)}let s=e.$slots;if(s){kg(a)||M(379,i.name);for(let e in s)qg(a,e,Mp(s[e],t))}return a}function Np(e,t,n){let r=pp,i=hp,a=mp;pp=t,hp=!0,mp=e;try{return n()}finally{pp=r,hp=i,mp=a}}function Pp(e,t){let n=_p;_p=!0;try{(function(e,t){let n=e._pendingEditorState,r=e._rootElement,i=e._headless||r===null;if(n===null)return void(!e._updating&&e._deferred.length>0&&Lp(e,e._deferred));let a=e._editorState,o=a._selection,s=n._selection,c=e._dirtyType!==0,l=pp,u=hp,d=mp,f=e._updating,p=e._observer,m=null;if(e._pendingEditorState=null,e._editorState=n,!i&&c&&p!==null){mp=e,pp=n,hp=!1,e._updating=!0;try{let t=e._dirtyType,r=e._dirtyElements,i=e._dirtyLeaves;p.disconnect(),m=gu(a,n,e,t,r,i)}catch(t){if(t instanceof Error&&e._onError(t),gp)throw t;dm(e,null,r,n),ll(e),e._dirtyType=2,gp=!0,Pp(e,a),gp=!1;return}finally{p.observe(r,bp),e._updating=f,pp=l,hp=u,mp=d}}n._readOnly||=!0;let h=e._dirtyLeaves,g=e._dirtyElements,_=e._normalizedNodes,v=e._updateTags;c&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=/* @__PURE__ */ new Set,e._dirtyElements=/* @__PURE__ */ new Map,e._normalizedNodes=/* @__PURE__ */ new Set),e._updateTags=/* @__PURE__ */ new Set,function(e,t){let n=e._decorators,r=e._pendingDecorators||n,i=t._nodeMap,a;for(a in r)i.has(a)||(r===n&&(r=Gm(e)),delete r[a])}(e,n);let y=i?null:Mh(xh(e));if(e._editable&&y!==null&&(c||s===null||s.dirty||!s.is(o))&&r!==null&&!v.has(`skip-dom-selection`)){mp=e,pp=n;try{if(p!==null&&p.disconnect(),c||s===null||s.dirty){let t=e._blockCursorElement;t!==null&&jh(t,e,r),ip(o,s,e,y,v,r)}(function(e,t,n){let r=e._blockCursorElement;if(z(n)&&n.isCollapsed()&&n.anchor.type===`element`&&t.contains(Kh(t))){let i=n.anchor,a=i.getNode(),o=i.offset,s=!1,c=null;if(o===a.getChildrenSize())Ah(a.getChildAtIndex(o-1))&&(s=!0);else{let t=a.getChildAtIndex(o);if(t!==null&&Ah(t)){let n=t.getPreviousSibling();(n===null||Ah(n))&&(s=!0,c=e.getElementByKey(t.__key))}}if(s){let n=ig(a,e.getElementByKey(a.__key),e).element;r===null&&(e._blockCursorElement=r=function(e){let t=e.theme,n=zh().createElement(`div`);n.contentEditable=`false`,n.setAttribute(`data-lexical-cursor`,`true`);let r=t.blockCursor;return r!==void 0&&(typeof r==`string`&&(r=t.blockCursor=J_(r)),r!==void 0&&n.classList.add(...r)),n}(e._config)),t.style.caretColor=`transparent`,c===null?n.appendChild(r):n.insertBefore(r,c);return}}r!==null&&jh(r,e,t)})(e,r,s)}finally{p!==null&&p.observe(r,bp),mp=d,pp=l}}m!==null&&function(e,t,n,r,i){let a=Array.from(e._listeners.mutation),o=a.length;for(let e=0;e<o;e++){let[o,s]=a[e];for(let e of s){let a=t.get(e);a!==void 0&&o(a,{dirtyLeaves:r,prevEditorState:i,updateTags:n})}}}(e,m,v,h,a),z(s)||s===null||o!==null&&o.is(s)||e.dispatchCommand(vu);let ee=e._pendingDecorators;ee!==null&&(e._decorators=ee,e._pendingDecorators=null,Fp(`decorator`,e,!0,ee)),function(e,t,n){let r=Km(t),i=Km(n);r!==i&&Fp(`textcontent`,e,!0,i)}(e,t||a,n),Fp(`update`,e,!0,{dirtyElements:g,dirtyLeaves:h,editorState:n,mutatedNodes:m,normalizedNodes:_,prevEditorState:t||a,tags:v}),!f&&Lp(e,e._deferred),(function(e){let t=e._updates;if(t.length===0)return void(e._cascadeCount=0);if(function(e){vp.has(e)||(vp.add(e),setTimeout(()=>{vp.delete(e),e._cascadeCount=0},0))}(e),e._cascadeCount++>99)return e._updates=[],e._cascadeCount=0,void e._onWarn(/* @__PURE__ */ Error(`One or more update listeners are endlessly enqueueing more updates. May have encountered infinite recursion caused by update listeners that trigger additional updates without a stop condition. Editor namespace: ${e._config.namespace}`));let n=t.shift();if(n){let[t,r]=n;zp(e,t,r)}})(e)})(e,t)}finally{_p=n}}function Fp(e,t,n,...r){let i=t._updating;t._updating=n;try{let n=t._listeners[e],i=Array.from(n);for(let[e,t]of i){t&&t();let i=e(...r);n.has(e)?n.set(e,i):i&&i()}}finally{t._updating=i}}function Ip(e,t,n,r){let i=Zm(e),a;if(!_p)for(let e=0;e<i.length;e++)i[e]._updating||(i[e]._cascadeCount=0);for(let e=4;e>=0;e--)for(let o=0;o<i.length;o++){let s=i[o];if(o>0&&s._updating){a=s;break}let c=s._commands.get(t);if(c!==void 0){let t=c[e];if(t.size>0){let e=!1;if(Bp(s,()=>{for(let i of t)if(i(n,r))return void(e=!0)}),e)return e}}}return a&&a.update(()=>{Ip(a,t,n,r)}),!1}function Lp(e,t){if(e._deferred=[],t.length!==0){let n=e._updating;e._updating=!0;try{for(let e=0;e<t.length;e++)t[e]()}finally{e._updating=n}}}function Rp(e,t){let n=e._updates,r=t||!1;for(;n.length!==0;){let t=n.shift();if(t){let[n,i]=t,a=e._pendingEditorState,o;i!==void 0&&(o=i.onUpdate,i.skipTransforms&&(r=!0),i.discrete&&(a===null&&M(191),a._flushSync=!0),o&&e._deferred.push(o),jp(e,i.tag)),a==null?zp(e,n,i):n()}}return r}function zp(e,t,n){let r=e._updateTags,i,a=!1,o=!1;n!==void 0&&(i=n.onUpdate,jp(e,n.tag),a=n.skipTransforms||!1,o=n.discrete||!1),i&&e._deferred.push(i);let s=e._editorState,c=e._pendingEditorState,l=!1;(c===null||c._readOnly)&&(c=e._pendingEditorState=qp(c||s),l=!0),c._flushSync=o;let u=pp,d=hp,f=mp,p=e._updating;pp=c,hp=!1,e._updating=!0,mp=e;let m=e._headless||e.getRootElement()===null;ym(null);try{l&&(m?s._selection!==null&&(c._selection=s._selection.clone()):c._selection=function(e,t){let n=e.getEditorState()._selection,r=Mh(xh(e));return z(n)||n==null?Xf(n,r,e,t):n.clone()}(e,n&&n.event||null));let r=e._compositionKey;t(),a=Rp(e,a),function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(z(r)){let e=r.anchor,t=r.focus,i;if(e.type===`text`&&(i=e.getNode(),i.selectionTransform(n,r)),t.type===`text`){let e=t.getNode();i!==e&&e.selectionTransform(n,r)}}}(c,e),e._dirtyType!==0&&(a?function(e,t){let n=t._dirtyLeaves,r=e._nodeMap;for(let e of n){let t=r.get(e);R(t)&&t.isAttached()&&t.isSimpleText()&&!t.isUnmergeable()&&wl(t)}}(c,e):function(e,t){let n=t._dirtyLeaves,r=t._dirtyElements,i=e._nodeMap,a=Bm(),o=/* @__PURE__ */ new Map,s=n,c=s.size,l=r,u=l.size;for(;c>0||u>0;){if(c>0){t._dirtyLeaves=/* @__PURE__ */ new Set;for(let e of s){let r=i.get(e);R(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&wl(r),r!==void 0&&Ap(r,a)&&kp(t,r,o),n.add(e)}if(s=t._dirtyLeaves,c=s.size,c>0){yp++;continue}}t._dirtyLeaves=/* @__PURE__ */ new Set,t._dirtyElements=/* @__PURE__ */ new Map,l.delete(`root`)&&l.set(`root`,!0);for(let e of l){let n=e[0],s=e[1];if(r.set(n,s),!s)continue;let c=i.get(n);c!==void 0&&Ap(c,a)&&kp(t,c,o)}s=t._dirtyLeaves,c=s.size,l=t._dirtyElements,u=l.size,yp++}t._dirtyLeaves=n,t._dirtyElements=r}(c,e),Rp(e),function(e,t,n,r){let i=e._nodeMap,a=t._nodeMap,o=[];for(let[e]of r){let t=a.get(e);t!==void 0&&(t.isAttached()||(H(t)&&$c(t,e,i,a,o,r),i.has(e)||r.delete(e),o.push(e)))}for(let e of n){let t=a.get(e);t===void 0||t.isAttached()||(kg(t)&&t.__slots!==null&&$c(t,e,i,a,o,n),i.has(e)||n.delete(e),o.push(e))}for(let e of o)a.delete(e);let s=V(),c=s._compositionKey;c===null||a.has(c)||(s._compositionKey=null)}(s,c,e._dirtyLeaves,e._dirtyElements)),r!==e._compositionKey&&(c._flushSync=!0);let i=c._selection;if(z(i)){e._slotsUsed&&Wf(i);let t=c._nodeMap,n=i.anchor.key,r=i.focus.key;t.get(n)!==void 0&&t.get(r)!==void 0||M(19)}else Of(i)&&i._nodes.size===0&&(c._selection=null)}catch(t){t instanceof Error&&e._onError(t),e._pendingEditorState=s,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=/* @__PURE__ */ new Set,e._dirtyElements.clear(),Pp(e);return}finally{pp=u,hp=d,mp=f,e._updating=p,yp=0}e._dirtyType!==0||e._deferred.length>0||function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(r!==null){if(r.dirty||!r.is(n))return!0}else if(n!==null)return!0;return!1}(c,e)?c._flushSync?(c._flushSync=!1,Pp(e)):l&&wm(()=>{Pp(e)}):(c._flushSync=!1,l&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function Bp(e,t,n){mp===e&&n===void 0?xp()?zp(e,t,n):t():zp(e,t,n)}function Vp(e){if(Th(e)){let t=null;for(let n of e.getChildren())t=n.isInline()?(t||n.replace(n.createParentElementNode())).append(n):null}}var Hp=class extends Hd{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;__slotHost;__slots;$config(){return this.config(Symbol.for(`ElementNode`),{$transform:Vp,extends:Hd})}constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style=``,this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=``,this.__slotHost=null,this.__slots=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size,this.__slotHost=e.__slotHost,this.__slotHost!==null&&this.__parent!==null&&M(384,this.__key,String(this.__slotHost),String(this.__parent)),this.__slots=e.__slots),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){let e=this.getFormat();return Rc[e]||``}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let e=[],t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){let e=[],t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0&&Ig(this).length===0}isDirty(){let e=V()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){let e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){let e=[];for(let t of Ig(this)){let n=Lg(this,t);H(n)&&e.push(...n.getAllTextNodes())}let t=this.getFirstChild();for(;t!==null;){if(R(t)&&e.push(t),H(t)){let n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;H(e);){let t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;H(e);){let t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){let t=this.getChildren(),n=t.length;if(e>=n){let e=t[n-1];return H(e)&&e.getLastDescendant()||e||null}let r=t[e];return H(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let e=this.getLatest().__first;return e===null?null:W(e)}getFirstChildOrThrow(){let e=this.getFirstChild();return e===null&&M(45,this.__key),e}getLastChild(){let e=this.getLatest().__last;return e===null?null:W(e)}getLastChildOrThrow(){let e=this.getLastChild();return e===null&&M(96,this.__key),e}getChildAtIndex(e){let t=this.getChildrenSize(),n,r;if(e<t/2){for(n=this.getFirstChild(),r=0;n!==null&&r<=e;){if(r===e)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=t-1;n!==null&&r>=e;){if(r===e)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let e=Wg(this),t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContent(),H(i)&&r!==n-1&&!i.isInline()&&(e+=`
|
|
149
|
+
`?t.linebreak():n===` `?t.tab():n!==``&&t.text(n)}function sp(e){let t=[];return op(e,{linebreak:()=>t.push(nm()),tab:()=>t.push(vf()),text:e=>t.push(hf(e))}),t}function cp(e){let t=[];for(let n of e)rm(n)||(!V(n)&&!H(n)||n.isInline()?t.push(n):V(n)&&t.push(...cp(n.getChildren())));return t}function lp(e){let t=e;e.isCollapsed()||t.removeText();let n=z();R(n)&&(t=n),R(t)||j(161);let r=t.anchor,i=r.getNode(),a=r.offset;for(;!ng(i)&&Mg(i)===null;){let e=i;if([i,a]=up(i,a),e.is(i))break}return a}function up(e,t){let n=e.getParent();if(!n){let e=lm();return W().append(e),e.select(),[W(),0]}if(L(e)){let r=e.splitText(t);if(r.length===0)return[n,e.getIndexWithinParent()];let i=t===0?0:1;return[n,r[0].getIndexWithinParent()+i]}if(!V(e)||t===0)return[n,e.getIndexWithinParent()];let r=e.getChildAtIndex(t);if(r){let n=new Of(xf(e.__key,t,`element`),xf(e.__key,t,`element`),0,``),i=e.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function dp(e){return rm(e)||Ch(e)||L(e)||e.isParentRequired()}function fp(e){let t=lm(),n=null;for(let r=0;r<e.length;r++){let i=e[r];if(dp(i)){if(n===null){n=i.createParentElementNode(),t.append(n);let a=e[r+1];if(rm(i)&&(a===void 0||!dp(a)))continue}n.append(i)}else t.append(i),n=null}return t}function pp(e,t,n,r,i=`decorators-and-blocks`){if(t===`move`&&r===`character`&&!e.isCollapsed()){let[t,r]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return r.set(t.key,t.offset,t.type),!0}let a=O_(e.focus,n?`previous`:`next`),o=r===`lineboundary`,s=t===`move`,c=a,l=i===`decorators-and-blocks`;if(!R_(c)){for(let e of c){l=!1;let{origin:t}=e;if(!H(t)||t.isIsolated()||(c=e,!o||!t.isInline()))break}if(l)for(let e of y_(a).iterNodeCarets(t===`extend`?`shadowRoot`:`root`)){if(s_(e))e.origin.isInline()||(c=e);else{if(V(e.origin))continue;H(e.origin)&&!e.origin.isInline()&&(c=e)}break}}if(c===a)return!1;if(s&&!o&&H(c.origin)&&c.origin.isKeyboardSelectable()){let e=Xf();return e.add(c.origin.getKey()),Jm(e),!0}return c=L_(c),s&&k_(e.anchor,c),k_(e.focus,c),l||!o}let mp=null,hp=null,gp=!1,_p=!1,vp=!1,yp=/* @__PURE__ */ new Set,bp=0,xp={characterData:!0,childList:!0,subtree:!0};function Sp(){return gp||mp!==null&&mp._readOnly}function Cp(){gp&&j(13)}function wp(){bp>99&&j(14)}function Tp(){return mp===null&&j(195,Op()),mp}function Ep(e){Tp()!==null&&hp===null&&(hp=e),hp!==e&&bc(378)}function B(){return hp===null&&j(337,Op()),hp}function Dp(){B()._dirtyType=2}function Op(){let e=0,t=/* @__PURE__ */ new Set,n=vm.version;if(typeof window<`u`)for(let r of Rh(document)){let i=Am(r);if(Om(i))e++;else if(i){let e=String(i.constructor.version||`<0.17.1`);e===n&&(e+=` (separately built, likely a bundler configuration issue)`),t.add(e)}}let r=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(`, `)}`),r}function kp(){return hp}function Ap(e,t,n){let r=t.__type,i=Cm(e,r),a=n.get(r);a===void 0&&(a=Array.from(i.transforms),n.set(r,a));let o=a.length;for(let e=0;e<o&&(a[e](t),t.isAttached());e++);}function jp(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function Mp(e,t){if(!t)return;let n=e._updateTags,r=t;Array.isArray(t)||(r=[t]);for(let e of r)n.add(e)}function Np(e,t){let n=e.type,r=t.get(n);r===void 0&&j(17,n);let i=r.klass;e.type!==i.getType()&&j(18,i.name);let a=i.importJSON(e),o=e.children;if(V(a)&&Array.isArray(o))for(let e=0;e<o.length;e++){let n=Np(o[e],t);a.append(n)}let s=e.$slots;if(s){Ag(a)||j(379,i.name);for(let e in s)Jg(a,e,Np(s[e],t))}return a}function Pp(e,t,n){let r=mp,i=gp,a=hp;mp=t,gp=!0,hp=e;try{return n()}finally{mp=r,gp=i,hp=a}}function Fp(e,t){let n=vp;vp=!0;try{(function(e,t){let n=e._pendingEditorState,r=e._rootElement,i=e._headless||r===null;if(n===null)return void(!e._updating&&e._deferred.length>0&&Rp(e,e._deferred));let a=e._editorState,o=a._selection,s=n._selection,c=e._dirtyType!==0,l=mp,u=gp,d=hp,f=e._updating,p=e._observer,m=null;if(e._pendingEditorState=null,e._editorState=n,!i&&c&&p!==null){hp=e,mp=n,gp=!1,e._updating=!0;try{let t=e._dirtyType,r=e._dirtyElements,i=e._dirtyLeaves;p.disconnect(),m=_u(a,n,e,t,r,i)}catch(t){if(t instanceof Error&&e._onError(t),_p)throw t;fm(e,null,r,n),ul(e),e._dirtyType=2,_p=!0,Fp(e,a),_p=!1;return}finally{p.observe(r,xp),e._updating=f,mp=l,gp=u,hp=d}}n._readOnly||=!0;let h=e._dirtyLeaves,g=e._dirtyElements,_=e._normalizedNodes,v=e._updateTags;c&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=/* @__PURE__ */ new Set,e._dirtyElements=/* @__PURE__ */ new Map,e._normalizedNodes=/* @__PURE__ */ new Set),e._updateTags=/* @__PURE__ */ new Set,function(e,t){let n=e._decorators,r=e._pendingDecorators||n,i=t._nodeMap,a;for(a in r)i.has(a)||(r===n&&(r=Km(e)),delete r[a])}(e,n);let y=i?null:Nh(Sh(e));if(e._editable&&y!==null&&(c||s===null||s.dirty||!s.is(o))&&r!==null&&!v.has(`skip-dom-selection`)){hp=e,mp=n;try{if(p!==null&&p.disconnect(),c||s===null||s.dirty){let t=e._blockCursorElement;t!==null&&Mh(t,e,r),ap(o,s,e,y,v,r)}(function(e,t,n){let r=e._blockCursorElement;if(R(n)&&n.isCollapsed()&&n.anchor.type===`element`&&t.contains(qh(t))){let i=n.anchor,a=i.getNode(),o=i.offset,s=!1,c=null;if(o===a.getChildrenSize())jh(a.getChildAtIndex(o-1))&&(s=!0);else{let t=a.getChildAtIndex(o);if(t!==null&&jh(t)){let n=t.getPreviousSibling();(n===null||jh(n))&&(s=!0,c=e.getElementByKey(t.__key))}}if(s){let n=ag(a,e.getElementByKey(a.__key),e).element;r===null&&(e._blockCursorElement=r=function(e){let t=e.theme,n=Bh().createElement(`div`);n.contentEditable=`false`,n.setAttribute(`data-lexical-cursor`,`true`);let r=t.blockCursor;return r!==void 0&&(typeof r==`string`&&(r=t.blockCursor=Y_(r)),r!==void 0&&n.classList.add(...r)),n}(e._config)),t.style.caretColor=`transparent`,c===null?n.appendChild(r):n.insertBefore(r,c);return}}r!==null&&Mh(r,e,t)})(e,r,s)}finally{p!==null&&p.observe(r,xp),hp=d,mp=l}}m!==null&&function(e,t,n,r,i){let a=Array.from(e._listeners.mutation),o=a.length;for(let e=0;e<o;e++){let[o,s]=a[e];for(let e of s){let a=t.get(e);a!==void 0&&o(a,{dirtyLeaves:r,prevEditorState:i,updateTags:n})}}}(e,m,v,h,a),R(s)||s===null||o!==null&&o.is(s)||e.dispatchCommand(yu);let ee=e._pendingDecorators;ee!==null&&(e._decorators=ee,e._pendingDecorators=null,Ip(`decorator`,e,!0,ee)),function(e,t,n){let r=qm(t),i=qm(n);r!==i&&Ip(`textcontent`,e,!0,i)}(e,t||a,n),Ip(`update`,e,!0,{dirtyElements:g,dirtyLeaves:h,editorState:n,mutatedNodes:m,normalizedNodes:_,prevEditorState:t||a,tags:v}),!f&&Rp(e,e._deferred),(function(e){let t=e._updates;if(t.length===0)return void(e._cascadeCount=0);if(function(e){yp.has(e)||(yp.add(e),setTimeout(()=>{yp.delete(e),e._cascadeCount=0},0))}(e),e._cascadeCount++>99)return e._updates=[],e._cascadeCount=0,void e._onWarn(/* @__PURE__ */ Error(`One or more update listeners are endlessly enqueueing more updates. May have encountered infinite recursion caused by update listeners that trigger additional updates without a stop condition. Editor namespace: ${e._config.namespace}`));let n=t.shift();if(n){let[t,r]=n;Bp(e,t,r)}})(e)})(e,t)}finally{vp=n}}function Ip(e,t,n,...r){let i=t._updating;t._updating=n;try{let n=t._listeners[e],i=Array.from(n);for(let[e,t]of i){t&&t();let i=e(...r);n.has(e)?n.set(e,i):i&&i()}}finally{t._updating=i}}function Lp(e,t,n,r){let i=Qm(e),a;if(!vp)for(let e=0;e<i.length;e++)i[e]._updating||(i[e]._cascadeCount=0);for(let e=4;e>=0;e--)for(let o=0;o<i.length;o++){let s=i[o];if(o>0&&s._updating){a=s;break}let c=s._commands.get(t);if(c!==void 0){let t=c[e];if(t.size>0){let e=!1;if(Vp(s,()=>{for(let i of t)if(i(n,r))return void(e=!0)}),e)return e}}}return a&&a.update(()=>{Lp(a,t,n,r)}),!1}function Rp(e,t){if(e._deferred=[],t.length!==0){let n=e._updating;e._updating=!0;try{for(let e=0;e<t.length;e++)t[e]()}finally{e._updating=n}}}function zp(e,t){let n=e._updates,r=t||!1;for(;n.length!==0;){let t=n.shift();if(t){let[n,i]=t,a=e._pendingEditorState,o;i!==void 0&&(o=i.onUpdate,i.skipTransforms&&(r=!0),i.discrete&&(a===null&&j(191),a._flushSync=!0),o&&e._deferred.push(o),Mp(e,i.tag)),a==null?Bp(e,n,i):n()}}return r}function Bp(e,t,n){let r=e._updateTags,i,a=!1,o=!1;n!==void 0&&(i=n.onUpdate,Mp(e,n.tag),a=n.skipTransforms||!1,o=n.discrete||!1),i&&e._deferred.push(i);let s=e._editorState,c=e._pendingEditorState,l=!1;(c===null||c._readOnly)&&(c=e._pendingEditorState=Jp(c||s),l=!0),c._flushSync=o;let u=mp,d=gp,f=hp,p=e._updating;mp=c,gp=!1,e._updating=!0,hp=e;let m=e._headless||e.getRootElement()===null;bm(null);try{l&&(m?s._selection!==null&&(c._selection=s._selection.clone()):c._selection=function(e,t){let n=e.getEditorState()._selection,r=Nh(Sh(e));return R(n)||n==null?Zf(n,r,e,t):n.clone()}(e,n&&n.event||null));let r=e._compositionKey;t(),a=zp(e,a),function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(R(r)){let e=r.anchor,t=r.focus,i;if(e.type===`text`&&(i=e.getNode(),i.selectionTransform(n,r)),t.type===`text`){let e=t.getNode();i!==e&&e.selectionTransform(n,r)}}}(c,e),e._dirtyType!==0&&(a?function(e,t){let n=t._dirtyLeaves,r=e._nodeMap;for(let e of n){let t=r.get(e);L(t)&&t.isAttached()&&t.isSimpleText()&&!t.isUnmergeable()&&Tl(t)}}(c,e):function(e,t){let n=t._dirtyLeaves,r=t._dirtyElements,i=e._nodeMap,a=Vm(),o=/* @__PURE__ */ new Map,s=n,c=s.size,l=r,u=l.size;for(;c>0||u>0;){if(c>0){t._dirtyLeaves=/* @__PURE__ */ new Set;for(let e of s){let r=i.get(e);L(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&Tl(r),r!==void 0&&jp(r,a)&&Ap(t,r,o),n.add(e)}if(s=t._dirtyLeaves,c=s.size,c>0){bp++;continue}}t._dirtyLeaves=/* @__PURE__ */ new Set,t._dirtyElements=/* @__PURE__ */ new Map,l.delete(`root`)&&l.set(`root`,!0);for(let e of l){let n=e[0],s=e[1];if(r.set(n,s),!s)continue;let c=i.get(n);c!==void 0&&jp(c,a)&&Ap(t,c,o)}s=t._dirtyLeaves,c=s.size,l=t._dirtyElements,u=l.size,bp++}t._dirtyLeaves=n,t._dirtyElements=r}(c,e),zp(e),function(e,t,n,r){let i=e._nodeMap,a=t._nodeMap,o=[];for(let[e]of r){let t=a.get(e);t!==void 0&&(t.isAttached()||(V(t)&&el(t,e,i,a,o,r),i.has(e)||r.delete(e),o.push(e)))}for(let e of n){let t=a.get(e);t===void 0||t.isAttached()||(Ag(t)&&t.__slots!==null&&el(t,e,i,a,o,n),i.has(e)||n.delete(e),o.push(e))}for(let e of o)a.delete(e);let s=B(),c=s._compositionKey;c===null||a.has(c)||(s._compositionKey=null)}(s,c,e._dirtyLeaves,e._dirtyElements)),r!==e._compositionKey&&(c._flushSync=!0);let i=c._selection;if(R(i)){e._slotsUsed&&Gf(i);let t=c._nodeMap,n=i.anchor.key,r=i.focus.key;t.get(n)!==void 0&&t.get(r)!==void 0||j(19)}else kf(i)&&i._nodes.size===0&&(c._selection=null)}catch(t){t instanceof Error&&e._onError(t),e._pendingEditorState=s,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=/* @__PURE__ */ new Set,e._dirtyElements.clear(),Fp(e);return}finally{mp=u,gp=d,hp=f,e._updating=p,bp=0}e._dirtyType!==0||e._deferred.length>0||function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(r!==null){if(r.dirty||!r.is(n))return!0}else if(n!==null)return!0;return!1}(c,e)?c._flushSync?(c._flushSync=!1,Fp(e)):l&&Tm(()=>{Fp(e)}):(c._flushSync=!1,l&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function Vp(e,t,n){hp===e&&n===void 0?Sp()?Bp(e,t,n):t():Bp(e,t,n)}function Hp(e){if(Eh(e)){let t=null;for(let n of e.getChildren())t=n.isInline()?(t||n.replace(n.createParentElementNode())).append(n):null}}var Up=class extends Ud{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;__slotHost;__slots;$config(){return this.config(Symbol.for(`ElementNode`),{$transform:Hp,extends:Ud})}constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style=``,this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=``,this.__slotHost=null,this.__slots=null}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size,this.__slotHost=e.__slotHost,this.__slotHost!==null&&this.__parent!==null&&j(384,this.__key,String(this.__slotHost),String(this.__parent)),this.__slots=e.__slots),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){let e=this.getFormat();return zc[e]||``}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let e=[],t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){let e=[],t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0&&Lg(this).length===0}isDirty(){let e=B()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){let e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){let e=[];for(let t of Lg(this)){let n=Rg(this,t);V(n)&&e.push(...n.getAllTextNodes())}let t=this.getFirstChild();for(;t!==null;){if(L(t)&&e.push(t),V(t)){let n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;V(e);){let t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;V(e);){let t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){let t=this.getChildren(),n=t.length;if(e>=n){let e=t[n-1];return V(e)&&e.getLastDescendant()||e||null}let r=t[e];return V(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let e=this.getLatest().__first;return e===null?null:U(e)}getFirstChildOrThrow(){let e=this.getFirstChild();return e===null&&j(45,this.__key),e}getLastChild(){let e=this.getLatest().__last;return e===null?null:U(e)}getLastChildOrThrow(){let e=this.getLastChild();return e===null&&j(96,this.__key),e}getChildAtIndex(e){let t=this.getChildrenSize(),n,r;if(e<t/2){for(n=this.getFirstChild(),r=0;n!==null&&r<=e;){if(r===e)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=t-1;n!==null&&r>=e;){if(r===e)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let e=Gg(this),t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContent(),V(i)&&r!==n-1&&!i.isInline()&&(e+=`
|
|
150
150
|
|
|
151
|
-
`)}return e}getTextContentSize(){let e=function(e){let t=0;for(let n of
|
|
152
|
-
`}createDOM(){return zh().createElement(`br`)}updateDOM(){return!1}isInline(){return!0}};function em(e){return{node:tm()}}function tm(){return Dh(new $p)}function nm(e){return e instanceof $p}function rm(e){let t=e.parentElement;if(t!==null&&eg(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&am(n)){let n=t.lastChild;if(n===e||n.previousSibling===e&&am(n))return!0}}return!1}function im(e){let t=e.parentElement;if(t!==null&&eg(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&am(n))return!1;let r=t.lastChild;if(r===e||r.previousSibling===e&&am(r))return!0}return!1}function am(e){return Mm(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||``)}var om=class extends Hp{$config(){return this.config(`paragraph`,{extends:Hp,importDOM:{p:()=>({conversion:sm,priority:0})}})}createDOM(e){let t=zh().createElement(`p`),n=lh(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(J(t)){this.isEmpty()&&t.append(zh().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(R);t?(e.textFormat=t.getFormat(),e.textStyle=t.getStyle()):(e.textFormat=this.getTextFormat(),e.textStyle=this.getTextStyle())}return e}insertNewAfter(e,t){let n=cm();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||R(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 sm(e){let t=cm();if(mg(t,e),fg(e,t),t.getFormatType()===``){let n=e.getAttribute(`align`);n&&n&&n in Lc&&t.setFormat(n)}return pg(t,e),{node:t}}function cm(){return Dh(new om)}function lm(e){return e instanceof om}function um(e){console.warn(e)}function dm(e,t,n,r,i){let a=e._keyToDOMMap;a.clear(),e._editorState=Jp(),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),Hm(n,e,`root`))}function fm(e){let t=/* @__PURE__ */ new Set,n=/* @__PURE__ */ new Set;for(let{klass:r,ownNodeConfig:i}of Cg(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 pm={$createDOM:(e,t)=>e.createDOM(t._config,t),$decorateDOM:(e,t,n,r)=>{},$exportDOM:(e,t)=>{let n=Cm(t,e.getType());return n&&n.exportDOM!==void 0?n.exportDOM(t,e):e.exportDOM(t)},$extractWithChild:(e,t,n,r,i)=>H(e)&&e.extractWithChild(t,n,r),$getDOMSlot:(e,t,n)=>e.getDOMSlot(t),$getSlotTargetElement:(e,t,n,r)=>null,$shouldExclude:(e,t,n)=>H(e)&&e.excludeFromCopy(`html`),$shouldInclude:(e,t,n)=>!t||e.isSelected(t),$updateDOM:(e,t,n,r)=>e.updateDOM(t,n,r._config)};function mm(e){let t=e||{},n=Op(),r=t.theme||{},i=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,o=Jp(),s=t.namespace||(i===null?Qm():i._config.namespace),c=t.editorState,l=[Gp,af,$p,gf,om,Qp,...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===Hd||n.prototype instanceof Hd)){let r=`<unknown>`;try{r=JSON.parse(Yc)}catch{}M(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))}Sg(n);let a=n.getType(),o=fm(n);m.set(a,{exportDOM:f&&f.export?f.export.get(n):void 0,klass:n,replace:r,replaceWithKlass:i,sharedNodeState:fl(l[e]),transforms:o})}}let h=new _m(o,i,m,{disableEvents:a,dom:{...pm,...e&&e.dom},namespace:s,theme:r},u||console.error,d||um,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(bu,Td,0),e.registerCommand(xu,Ed,0),e.registerCommand(Su,Dd,0),e.registerCommand(Cu,Od,0),e.registerCommand(Fu,jd,0)}(h),h}function hm(e,t){let n=e.get(t);e.delete(t),n&&n()}function gm(e,t,n){return e.set(t,n),hm.bind(null,e,t)}var _m=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 Qc,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=Qm(),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 gm(this._listeners.update,e)}registerEditableListener(e){return gm(this._listeners.editable,e)}registerDecoratorListener(e){return gm(this._listeners.decorator,e)}registerTextContentListener(e){return gm(this._listeners.textcontent,e)}registerRootListener(e){let t=this._listeners.root;return X_(gm(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&&M(35);let r=this._commands;r.has(e)||r.set(e,[new Xc,new Xc,new Xc,new Xc,new Xc]);let i=r.get(e);i===void 0&&M(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&&M(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){let n=this._editorState,r=lg(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=lg(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=W(t);e&&e.markDirty()}},e._pendingEditorState===null?{tag:Wd}: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 q(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=lh(this._config.theme,`root`),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,dm(this,t,e,r,{preserveUpdateQueue:!0}),t!==null&&(this._config.disableEvents||Ld(t),n!=null&&t.classList.remove(...n)),e!==null){let t=bh(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,ll(this),this._updateTags.add(Wd),Pp(this),this._config.disableEvents||function(e,t){let n=e.ownerDocument;fd.set(e,n);let r=pd.get(n);r===void 0&&(r={editors:/* @__PURE__ */ new Set,hasShadowEditor:void 0},pd.set(n,r)),r.editors.add(t),r.hasShadowEditor=void 0,e.__lexicalEditor=t;let i=Md(e);i.push(md.register(n));for(let n=0;n<dd.length;n++){let[r,a]=dd[n],o=typeof a==`function`?e=>{Id(e)||(Fd(e),(t.isEditable()||r===`click`)&&a(e,t))}:e=>{if(Id(e))return;Fd(e);let n=t.isEditable();switch(r){case`cut`:return n&&q(t,$u,e);case`copy`:return q(t,Qu,e);case`paste`:return n&&q(t,Ou,e);case`dragstart`:return n&&q(t,Yu,e);case`dragover`:return n&&q(t,Xu,e);case`dragend`:return n&&q(t,Zu,e);case`focus`:return n&&q(t,ad,e);case`blur`:return n&&q(t,od,e);case`drop`:return n&&q(t,Ju,e)}};i.push(ld(e,r,o))}}(e,this),n!=null&&e.classList.add(...n)}else this._window=null,this._updateTags.add(Wd),Pp(this);Fp(`root`,this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&M(38);let n=e;n._readOnly&&(n=qp(e),n._selection=e._selection?e._selection.clone():null),cl(this);let r=this._pendingEditorState,i=t===void 0?null:t.tag;r===null||r.isEmpty()||(i!=null&&this._updateTags.add(i),Pp(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set(`root`,!1),this._compositionKey=null,this._slotsUsed=this._slotsUsed||e._slotsUsed,Bp(this,()=>{if(i&&this._updateTags.add(i),e._parsed)for(let[e,t]of n._nodeMap.entries())H(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=Jp(),i=pp,a=hp,o=mp,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,pp=r,hp=!1,mp=t,ym(null);try{let i=t._nodes;Mp(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,pp=i,hp=a,mp=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`&&Pp(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]):zp(e,t,n)})(this,e,t)}focus(e,t={}){let n=this._rootElement;n!==null&&(n.setAttribute(`autocapitalize`,`off`),Bp(this,()=>{let r=B(),i=G();r===null?i.getChildrenSize()!==0&&(t.defaultSelection===`rootStart`?i.selectStart():i.selectEnd()):r.dirty||qm(r.clone()),_h(`focus`),vh(()=>{n.removeAttribute(`autocapitalize`),e&&e()})}),this._pendingEditorState===null&&n.removeAttribute(`autocapitalize`))}blur(){let e=this._rootElement;e!==null&&e.blur();let t=Mh(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Fp(`editable`,this,!0,e),this._slotsUsed&&this.update(()=>Ep()))}toJSON(){return{editorState:this._editorState.toJSON()}}};_m.version=Yc;let vm=null;function ym(e){vm=e}let bm=Symbol(`INTERNAL_SKIP_AFTER_CLONE_FROM`),xm=1;function Sm(e,t){let n=Cm(e,t);return n===void 0&&M(30,t),n}function Cm(e,t){return e._nodes.get(t)}let wm=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)};function Tm(e,t){let n=t===void 0?(()=>{let t=e.getRootNode();return Nm(t)||Ph(t)?qh(t):null})():t;if(!J(n)||n.hasAttribute(`data-lexical-slot`))return!1;let r=Wm(n),i=n.nodeName;return Ud(r)&&(i===`INPUT`||i===`TEXTAREA`||n.contentEditable===`true`&&km(n)==null)}function Em(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 Om(t)===e&&e.read(`latest`,()=>!Tm(t))}function Dm(e){return e instanceof _m}function Om(e){let t=e;for(;t!=null;){let e=km(t);if(Dm(e))return e;t=hh(t)}return null}function km(e){return e?e.__lexicalEditor:null}function Am(e){return vf(e)||e.isToken()}function jm(e){return Am(e)||e.isSegmented()}function Mm(e){return Yh(e)&&e.nodeType===3}function Nm(e){return Yh(e)&&e.nodeType===9}function Pm(e){let t=e;for(;t!=null;){if(Mm(t))return t;t=t.firstChild}return null}function Fm(e,t,n){let r=Fc[t];if(n!==null&&(e&r)===(n&r))return e;let i=e^r;return t===`subscript`?i&=~Fc.superscript:t===`superscript`?i&=~Fc.subscript:t===`lowercase`?(i&=~Fc.uppercase,i&=~Fc.capitalize):t===`uppercase`?(i&=~Fc.lowercase,i&=~Fc.capitalize):t===`capitalize`&&(i&=~Fc.lowercase,i&=~Fc.uppercase),i}function Im(e,t){let n=function(){let e=vm;return vm=null,e}();if((t||=n&&n.__key)!=null)return void(e.__key=t);Sp(),Cp();let r=V(),i=wp(),a=``+xm++;i._nodeMap.set(a,e),H(e)?r._dirtyElements.set(a,!0):r._dirtyLeaves.add(a),r._cloneNotNeeded.add(a),r._dirtyType===0&&(r._dirtyType=1),e.__key=a}function Lm(e){jg(e)!==null&&M(380,e.__key,String(jg(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 Rm(e){Cp(),Bd(e)&&M(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent===null?Ag(t)?t.__slotHost:null:t.__parent,r=wp(),i=V(),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?Ag(e)?e.__slotHost:null:e.__parent}}(n,a,o);let s=t.__key;i._dirtyType===0&&(i._dirtyType=1),H(e)?o.set(s,!0):i._dirtyLeaves.add(s)}function zm(e){Sp();let t=V(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let e=W(n);e!==null&&e.getWritable()}if(e!==null){let t=W(e);t!==null&&t.getWritable()}}}function Bm(){return xp()?null:V()._compositionKey}function W(e,t){let n=(t||wp())._nodeMap.get(e);return n===void 0?null:n}function Vm(e,t){let n=Um(e,V());return n===void 0?null:W(n,t)}function Hm(e,t,n){e[`__lexicalKey_${t._key}`]=n}function Um(e,t){return e[`__lexicalKey_${t._key}`]}function Wm(e,t){let n=e;for(;n!=null;){let e=Vm(n,t);if(e!==null)return e;n=hh(n)}return null}function Gm(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function Km(e){return e.read(()=>G().getTextContent())}function G(){return wp()._nodeMap.get(`root`)}function qm(e){Sp();let t=wp();e!==null&&(e.dirty=!0,e.setCachedNodes(null),z(e)&&V()._slotsUsed&&Wf(e)),t._selection=e}function Jm(){Sp(),cl(V())}function Ym(e){let t=function(e,t){let n=e;for(;n!=null;){let e=Um(n,t);if(e!==void 0)return e;n=hh(n)}return null}(e,V());return t===null?null:W(t)}function Xm(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Zm(e){let t=[];for(let n=e;n!==null;n=n._parentEditor)t.push(n);return t}function Qm(){return Math.random().toString(36).replace(/[^a-z]+/g,``).substring(0,5)}function $m(e){return Mm(e)?e.nodeValue:null}function eh(e,t,n){let r=Mh(xh(t));if(r===null)return;let i=Hh(r,t._rootElement),a=i.anchorNode,{anchorOffset:o,focusOffset:s}=i;if(a!==null){let t=$m(a),r=Wm(a);if(t!==null&&R(r)){if((t===jc||t===Mc)&&n){let e=n.length;t=n,o=e,s=e}t!==null&&th(r,t,o,s,e)}}}function th(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(jc)&&(s=t.slice(0,-jc.length)),i)){let e=Mc,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=B();if(s===``){if(zm(null),Dc||Tc||Ac)a.remove();else{let e=V();nh(a,``,t),setTimeout(()=>{e.update(()=>{a.isAttached()&&a.getTextContent()===``&&a.remove()})},20)}return}let i=a.getParent(),c=Zf(),l=a.getTextContentSize(),u=Bm(),d=a.getKey();if(a.isToken()&&!o||u!==null&&d===u&&!o||z(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(!z(t)||n===null||r===null)return void nh(a,s,t);if(t.setTextNodeRange(a,n,a,r),a.isSegmented()){let e=mf(a.getTextContent());a.replace(e),a=e}nh(a,s,t)}}}function nh(e,t,n){if(e.setTextContent(t),z(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=d_(e,a.offset,`clamp`),r=!0)}r&&(n._cachedNodes=null,n._cachedIsBackward=null)}}function rh(e,t,n){let r=t[n]||!1;return r===`any`||r===e[n]}function ih(e,t){return rh(e,t,`altKey`)&&rh(e,t,`ctrlKey`)&&rh(e,t,`shiftKey`)&&rh(e,t,`metaKey`)}function K(e,t,n){if(!ih(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 ah={ctrlKey:!Sc,metaKey:Sc},oh={altKey:Sc,ctrlKey:!Sc};function sh(e){return e.key===`Backspace`}function ch(e){let t=G();if(z(e)){let t=e.anchor,n=e.focus,r=t.getNode();if(Kp(r))return t.set(r.getKey(),0,`element`),n.set(r.getKey(),r.getChildrenSize(),`element`),Tl(e),e;let i=r.getTopLevelElementOrThrow(),a=i.getParent();if(a===null)return H(i)&&(t.set(i.getKey(),0,`element`),n.set(i.getKey(),i.getChildrenSize(),`element`),Tl(e)),e;let o=a;return t.set(o.getKey(),0,`element`),n.set(o.getKey(),o.getChildrenSize(),`element`),Tl(e),e}{let e=t.select(0,t.getChildrenSize());return qm(Tl(e)),e}}function lh(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=J_(i);return n[t]=e,e}return i}function uh(e,t,n,r,i){if(n.size===0)return;let a=r.__type,o=r.__key,s=t.get(a);s===void 0&&M(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 dh(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 fh(e,t){let n=e.offset;if(e.type===`element`)return dh(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?dh(r.getParentOrThrow(),t,r.getIndexWithinParent()+ +!t):e}}return null}function ph(e){let t=xh(e).event,n=t&&t.inputType;return n===`insertFromPaste`||n===`insertFromPasteAsQuotation`}function q(e,t,...n){return Ip(e,t,n[0],e)}function mh(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&M(75,t),n}function hh(e){let t=e.assignedSlot||e.parentElement;if(t!==null)return t;let n=e.parentNode;return Ph(n)?n.host:null}function gh(e){return Nm(e)?e:J(e)?e.ownerDocument:null}function _h(e){Sp(),V()._updateTags.add(e)}function vh(e){Sp(),V()._deferred.push(e)}function yh(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function bh(e){let t=gh(e);return t?t.defaultView:null}function xh(e){let t=e._window;return t===null&&M(78),t}function Sh(e){return H(e)&&e.isInline()||U(e)&&e.isInline()}function Ch(e){let t=e.getLatest();for(;t!==null;){if(jg(t)!==null&&H(t))return t;let e=t.getParentOrThrow();if(Th(e))return e;t=e}return t}function wh(e){return H(e)&&e.isShadowRoot()}function Th(e){return Kp(e)||wh(e)}function Eh(e,t=!1){let n=e.constructor.clone(e,bm);return Im(n,null),n.afterCloneFrom(e),t||n.resetOnCopyNodeFrom(e),n}function Dh(e){let t=V(),n=e.getType(),r=Cm(t,n);r===void 0&&M(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||M(202,r.name,r.getType(),e.constructor.name,n):t instanceof a||M(201,a.name,a.getType(),r.name,r.getType(),e.constructor.name,n),t.__key===e.__key&&M(203,e.constructor.name,n,r.name,r.getType()),t}return e}function Oh(e,t){!Kp(e.getParent())||H(t)||U(t)||M(99)}function kh(e){let t=W(e);return t===null&&M(63,e),t}function Ah(e){if(!e||e.isInline())return!1;if(U(e))return!0;if(H(e)){if(e.isShadowRoot()){let t=e.getParent();return!(H(t)&&t.isShadowRoot())}return!e.canBeEmpty()}return!1}function jh(e,t,n){n.style.removeProperty(`caret-color`),t._blockCursorElement=null;let r=e.parentElement;r!==null&&r.removeChild(e)}function Mh(e){return bc?(e||window).getSelection():null}function Nh(e){let t=bh(e);return t?t.getSelection():null}function Ph(e){return Xh(e)&&`host`in e}let Fh=[];function Ih(e){let t=e.getRootNode();if(t===e||!Ph(t))return Fh;let n=[t],r=t.host;for(;;){let e=r.getRootNode();if(e===r||!Ph(e))break;n.push(e),r=e.host}return n}function*Lh(e){let t=[e],n;for(;n=t.pop();){yield*n.querySelectorAll(`[data-lexical-editor="true"]`);let e=(Nm(n)?n:n.ownerDocument).createTreeWalker(n,NodeFilter.SHOW_ELEMENT),r;for(;r=e.nextNode();)r.shadowRoot&&t.push(r.shadowRoot)}}function Rh(e){return e===null?document:e.ownerDocument}function zh(){let e=Op();return Rh(e===null?null:e._rootElement)}function Bh(e,t){if(t===null||typeof e.getComposedRanges!=`function`)return null;let n=Ih(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 Vh(e,t){let n=Bh(e,t);if(n!==null){let e=Uh(n);if(e!==null)return e}return e.rangeCount>0?e.getRangeAt(0):null}function Hh(e,t){let n=Bh(e,t);return n===null?e:Wh(n,Gh(e))}function Uh(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 Wh(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 Gh(e){return e.direction}function Kh(e){let t=e.getRootNode();return Nm(t)||Ph(t)?t.activeElement:null}function qh(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 Jh(e){let t=e.target;if(t!==null&&J(t)&&t.shadowRoot!==null&&typeof e.composedPath==`function`){let t=e.composedPath();if(t.length>0)return t[0]}return t}function J(e){return Yh(e)&&e.nodeType===1}function Yh(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function Xh(e){return Yh(e)&&e.nodeType===11}let Zh=/^(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 Qh(e){return!(!J(e)||!e.style.display.startsWith(`inline`))||Zh.test(e.nodeName)}let $h=/^(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 eg(e){return(!J(e)||!e.style.display.startsWith(`inline`))&&$h.test(e.nodeName)}function tg(e){if(U(e)&&!e.isInline())return!0;if(!H(e)||Th(e))return!1;let t=e.getFirstChild(),n=t===null||nm(t)||R(t)||t.isInline();return!e.isInline()&&!1!==e.canBeEmpty()&&n}function ng(){return V()}function rg(e=ng()){return e._config.dom||pm}function ig(e,t,n=ng()){let r=rg(n).$getDOMSlot(e,t,n);return H(e)&&(ag(r)||M(344,e.getKey(),e.getType())),r}function ag(e){return e instanceof Kc}function og(e,t,n=ng()){return Pm(ig(e,t,n).element)}let sg=/* @__PURE__ */ new WeakMap,cg=/* @__PURE__ */ new Map;function lg(e){if(!e._readOnly&&e.isEmpty())return cg;e._readOnly||M(192);let t=sg.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),sg.set(e,t)),t}function ug(e){let t=e.constructor.clone(e,bm);return t.afterCloneFrom(e),t}function dg(e){return(t=ug(e))[zd]=!0,t;var t}function fg(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 pg(e,t){let n=t.getAttribute(`dir`);return n===`ltr`||n===`rtl`?e.setDirection(n):e}function mg(e,t){let n=t.style.textAlign;return n&&n in Lc?e.setFormat(n):e}function hg(e,t){e.__lexicalUnmanaged=!0,t&&t.captureSelection!==void 0&&(e.__lexicalCapturedSelection=t.captureSelection)}function gg(e){return!0===e.__lexicalUnmanaged}function _g(e,t=ng()){let n=t.isEditable();e.contentEditable=n?`true`:`false`,n?e.__lexicalEditor=t:delete e.__lexicalEditor}function vg(e,t){let n=e;for(;n!=null;){if(!0===n.__lexicalCapturedSelection)return!0;if(J(n)&&n.hasAttribute(`data-lexical-slot`)||Um(n,t)!==void 0)return!1;n=hh(n)}return!1}function yg(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)&&e[t]!==Hd[t]}let bg=/* @__PURE__ */ new WeakMap,xg=Symbol(`lexical.synthesizedGetType`);function Sg(e){let t=bg.get(e);if(t)return t;let n=e.prototype!=null&&Vc in e.prototype?e.prototype[Vc]():void 0,r=function(e){if(!(e===Hd||e.prototype instanceof Hd)){let t=`<unknown>`,n=`<unknown>`;try{t=e.getType()}catch{}try{_m.version&&(n=JSON.parse(_m.version))}catch{}M(290,e.name,t,n)}return e===Wp||e===Hp||e===Hd}(e),i=!r&&yg(e,`getType`)?e.getType:void 0,a=i&&!(xg 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(!yg(e,`getType`)){let t=e,n=function(){return this===t?s:Hd.getType.call(this)};n[xg]=!0,e.getType=n}if(yg(e,`clone`)||(e.clone=(t,n)=>{ym(t);let r=new e;return n!==bm&&r.afterCloneFrom(t),r}),yg(e,`importJSON`)||(e.importJSON=o&&o.$importJSON||(t=>new e().updateFromJSON(t))),!yg(e,`importDOM`)&&o){let{importDOM:t}=o;t&&(e.importDOM=()=>t)}}let c={klass:e,ownNodeConfig:o,ownNodeType:s};return bg.set(e,c),c}function*Cg(e){for(let t=e;t&&(t===Hd||Ud(t.prototype));){let e=Sg(t);yield e,t=e.ownNodeConfig&&e.ownNodeConfig.extends||Dg(t)}}function wg(e){let t=ng();return Sp(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}let Tg=(e,t)=>{let n=e;for(;n!=null&&!Kp(n);){if(t(n))return n;n=n.getParent()}return null};function Eg(e,t){let n=[],r=e.__first;for(;r!==null;){let e=t===null?W(r):t.get(r);e??M(174),n.push(r),r=e.__next}return n}function Dg(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 Og=/* @__PURE__ */ new Map;function kg(e){return H(e)||U(e)}function Ag(e){return H(e)||U(e)}function jg(e){let t=e.getLatest();return Ag(t)?t.__slotHost:null}function Mg(e){let t=jg(e);if(t===null)return null;let n=W(t);return H(n)||U(n)||M(370),n}function Ng(e){let t=Mg(e);if(t===null)return null;let n=e.getLatest().__key;for(let[e,r]of Fg(t))if(r===n)return e;return null}function Pg(e){let t=e.getLatest();for(;t!==null;){if(jg(t)!==null)return t;t=t.getParent()}return null}function Fg(e){let t=e.getLatest();return kg(t)&&t.__slots!==null?t.__slots:Og}function Ig(e){return Array.from(Fg(e).keys())}function Lg(e,t){let n=Fg(e).get(t);return n===void 0?null:W(n)}let Rg=[`__proto__`,`constructor`,`prototype`],zg=Symbol(`slotMapOwner`);function Bg(e){let t=e.__slots;return t!==null&&t[zg]===e||(t=new Map(t),t[zg]=e,e.__slots=t),t}let Vg=/* @__PURE__ */ new WeakMap,Hg=[];function Ug(e){for(let{ownNodeConfig:t}of Cg(e)){let e=t&&t.slots;if(e)return e}return Hg}function Wg(e){let t=``;for(let n of Ig(e)){let r=Lg(e,n);r!==null&&(t+=r.getTextContent())}return t}function Gg(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 Kg(e){let t=e.__slots;if(t===null||t.size<2)return;let n=function(e){let t=Vg.get(e);if(t===void 0){let n=Ug(e),r=/* @__PURE__ */ new Map;for(let t of n)Rg.includes(t)&&M(371,e.name,t),r.has(t)&&M(372,e.name,t),r.set(t,r.size);t=r,Vg.set(e,t)}return t}(e.constructor),r=null,i=!0;for(let e of t.keys()){if(r!==null&&Gg(r,e,n)>0){i=!1;break}r=e}if(i)return;let a=Array.from(t).sort(([e],[t])=>Gg(e,t,n));t.clear();for(let[e,n]of a)t.set(e,n)}function qg(e,t,n){t!==`__proto__`&&t!==`constructor`&&t!==`prototype`||M(373,t);let r=e.getLatest();if(r.__slots!==null&&r.__slots.get(t)===n.getLatest().__key)return r;(!H(n)&&!U(n)||n.isInline())&&M(374,n.__key);let i=e.getWritable(),a=Bg(i),o=a.get(t);o!==void 0&&Yg(o);let s=n.getWritable(),c=Mg(s);if(c!==null){let e=Ng(s);e!==null&&Bg(c.getWritable()).delete(e),s.__slotHost=null}return Lm(s),s.__slotHost=i.__key,a.set(t,s.__key),Kg(i),function(){let e=ng();e._slotsUsed=!0,e._pendingEditorState&&(e._pendingEditorState._slotsUsed=!0)}(),i}function Jg(e,t){let n=e.getWritable();if(n.__slots===null)return n;let r=n.__slots.get(t);return r!==void 0&&(Yg(r),Bg(n).delete(t)),n}function Yg(e){let t=W(e);if(t===null)return;let n=t.getWritable();Ag(n)||M(377,e),n.__slotHost=null,n.remove()}let Xg={next:`previous`,previous:`next`};var Zg=class{origin;constructor(e){this.origin=e}[Symbol.iterator](){return x_({hasNext:a_,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return Y(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Y(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&&M(263,Array.from(o).join(` `))}else i.insert(e);i=Y(e,this.direction)}for(let e of o.values())e.remove();return this}},Qg=class e extends Zg{type=`child`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:p_(e,this.direction)}getParentCaret(e=`root`){return Y(t_(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=e_(this.direction);return Y(this.getNodeAtCaret(),e)||p_(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 $g={root:Kp,shadowRoot:Th};function e_(e){return Xg[e]}function t_(e,t=`root`){return e===null||$g[t](e)?null:jg(e)===null?e:null}var n_=class e extends Zg{type=`sibling`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:Y(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return H(this.origin)?p_(this.origin,this.direction):null}getParentCaret(e=`root`){return Y(t_(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=e_(this.direction);return Y(this.getNodeAtCaret(),e)||p_(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 r_)&&this.direction===t.direction&&this.origin.is(t.origin)}},r_=class e extends Zg{type=`text`;offset;constructor(e,t){super(e),this.offset=t}getLatest(){let e=this.origin.getLatest();return e===this.origin?this:u_(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e=`root`){return Y(t_(this.getParentAtCaret(),e),this.direction)}getFlipped(){return u_(this.origin,e_(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 n_||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return Y(this.origin,this.direction)}};function i_(e){return e instanceof r_}function a_(e){return e instanceof n_}function o_(e){return e instanceof Qg}let s_={next:class extends r_{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends r_{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},c_={next:class extends n_{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends n_{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},l_={next:class extends Qg{direction=`next`;getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends Qg{direction=`previous`;getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function Y(e,t){return e?new c_[t](e):null}function u_(e,t,n){return e?new s_[t](e,d_(e,n)):null}function d_(e,t,n=`error`){let r=e.getTextContentSize(),i=t===`next`?r:t===`previous`?0:t;return(i<0||i>r)&&(n!==`clamp`&&yc(284,String(t),String(r),e.getKey()),i=i<0?0:r),i}function f_(e,t){return new __(e,t)}function p_(e,t){return H(e)?new l_[t](e):null}function m_(e){return e&&e.getChildCaret()||e}function h_(e){return e&&m_(e.getAdjacentCaret())}var g_=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 i_(t)?function(e,t){let{direction:n,origin:r}=e;return f_(e,d_(r,t===`focus`?e_(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[f_(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e=`root`){let t=i_(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=i_(n),i=t=>t.isSameNodeCaret(n)?null:h_(t)||t.getParentCaret(e);return x_({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`)}},__=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 u_(e.setTextContent(i.slice(0,n)+i.slice(r)),t,n)}};function v_(e){return b_(e,Y(G(),e.direction))}function y_(e){return b_(e,e)}function b_(e,t){return e.direction!==t.direction&&M(265),new g_(e,t,e.direction)}function x_(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 S_(e,t){let n=E_(e.origin,t.origin);switch(n===null&&M(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 C_(n)}}function C_(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 w_(e,t){return t.is(e)}function T_(e){return H(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function E_(e,t){if(e.is(t))return{commonAncestor:e,type:`same`};let n=/* @__PURE__ */ new Map;for(let[t,r]=T_(e);t;r=t,t=t.getParent())n.set(t,r);for(let[r,i]=T_(t);r;i=r,r=r.getParent()){let a=n.get(r);if(a!==void 0)return a===null?(w_(e,r)||M(276),{commonAncestor:r,type:`ancestor`}):i===null?(w_(t,r)||M(277),{commonAncestor:r,type:`descendant`}):((H(a)||w_(e,a))&&(H(i)||w_(t,i))&&r.is(a.getParent())&&r.is(i.getParent())||M(278),{a,b:i,commonAncestor:r,type:`branch`})}return null}function D_(e,t){let{type:n,key:r,offset:i}=e,a=kh(e.key);return n===`text`?(R(a)||M(266,a.getType(),r),u_(a,t,i)):(H(a)||M(267,a.getType(),r),B_(a,e.offset,t))}function O_(e,t){let{origin:n,direction:r}=t,i=r===`next`;i_(t)?e.set(n.getKey(),t.offset,`text`):a_(t)?R(n)?e.set(n.getKey(),d_(n,r),`text`):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+ +!!i,`element`):(o_(t)&&H(n)||M(268),e.set(n.getKey(),i?0:n.getChildrenSize(),`element`))}function k_(e){let t=B(),n=z(t)?t:Jf();return A_(n,e),qm(n),n}function A_(e,t){O_(e.anchor,t.anchor),O_(e.focus,t.focus)}function j_(e){let{anchor:t,focus:n}=e,r=D_(t,`next`),i=D_(n,`next`),a=S_(r,i)<=0?`next`:`previous`;return b_(R_(r,a),R_(i,a))}function M_(e){let{direction:t,origin:n}=e,r=Y(n,e_(t)).getNodeAtCaret();return r?Y(r,t):p_(n.getParentOrThrow(),t)}function N_(e,t=`root`){let n=[e];for(let r=o_(e)?e.getParentCaret(t):e.getSiblingCaret();r!==null;r=r.getParentCaret(t))n.push(M_(r));return n}function P_(e){return!!e&&e.origin.isAttached()}function F_(e,t=`removeEmptySlices`){if(e.isCollapsed())return e;let n=`root`,r=`next`,i=t,a=z_(e,r),o=N_(a.anchor,n),s=N_(a.focus.getFlipped(),n),c=/* @__PURE__ */ new Set,l=[];for(let e of a.iterNodeCarets(n))if(o_(e))c.add(e.origin.getKey());else if(a_(e)){let{origin:t}=e;H(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),Lm(e)}for(let e of u)!e.canBeEmpty()&&!Th(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=M_(Y(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=mf(e.getTextContent()).setStyle(e.getStyle()).setFormat(e.getFormat());a.replaceOrInsert(n),t=u_(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(P_(e)){d=I_(e);break}for(let e of s)if(P_(e)){f=I_(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(Th(i))return;!n&&t(i)&&(n=i)}return n},u=l(a,tg),d=u&&l(o,e=>n.has(e.getKey())&&tg(e));return d&&Ig(d).length>0?null:u&&d?[u,d]:null}(d,f,c);if(p){let[e,t]=p;p_(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(o_(e)){let t=e.origin;if(tg(t))return t}else{let t=e.getParentAtCaret();if(t&&tg(t))return t}return null}(f),t=e&&e.getParent(),n=e&&e.getParents().findLast(wh);if(e&&t&&!Kp(t)&&e.isEmpty()&&c.has(e.getKey())&&Ig(e).length===0&&(!n||c.has(n.getKey()))){e.remove(!0);let n=t;for(;n&&!Kp(n)&&n.isEmpty();){let e=n.getParent();if(e&&Kp(e)&&e.getChildrenSize()<=1)break;let t=n;n=e,t.remove(!0)}}}let m=[d,f,...o,...s].find(P_);if(m)return y_(R_(I_(m),e.direction));M(269,JSON.stringify(o.map(e=>e.origin.__key)))}function I_(e){let t=function(e){let t=e;for(;o_(t);){let e=h_(t);if(!o_(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(R(t.origin))return i_(t)?t:u_(t.origin,n,n);let r=t.getAdjacentCaret();return a_(r)&&R(r.origin)?u_(r.origin,n,e_(n)):t}function L_(e){return i_(e)&&e.offset!==d_(e.origin,e.direction)}function R_(e,t){return e.direction===t?e:e.getFlipped()}function z_(e,t){return e.direction===t?e:b_(R_(e.focus,t),R_(e.anchor,t))}function B_(e,t,n){let r=p_(e,`next`);for(let e=0;e<t;e++){let e=r.getAdjacentCaret();if(e===null)break;r=e}return R_(r,n)}function V_(e){let{origin:t,offset:n,direction:r}=e;if(n===d_(t,r))return e.getSiblingCaret();if(n===d_(t,e_(r)))return M_(e.getSiblingCaret());let[i]=t.splitText(n);return R(i)||M(281),R_(Y(i,`next`),r)}function H_(e,t){return!0}function U_(e,{$copyElementNode:t=Eh,$splitTextPointCaretNext:n=V_,rootMode:r=`shadowRoot`,$shouldSplit:i=H_,removeEmptyDestination:a=!1}={}){if(i_(e))return n(e);let o=e.getParentCaret(r);if(o){let{origin:n}=o;if(o_(e)){let e=M_(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 W_(e,t,n){let r=R_(t,`next`);i_(r)&&(r.offset===0?r=Y(r.origin,`previous`).getFlipped():r.offset===r.origin.getTextContentSize()&&(r=Y(r.origin,`next`))),r.origin.is(e)&&(a_(r)||M(342,e.getKey(),e.getType()),r=M_(r)),(e.is(r.getNodeAtCaret())||e.is(r.getFlipped().getNodeAtCaret()))&&e.remove(!0);for(let e=r;e;e=U_(e,n))r=e;return i_(r)&&M(283),r.insert(e.isInline()?cm().append(e):e),R_(Y(e.getLatest(),`next`),t.direction)}function G_(e){return e}function K_(e){return e}function q_(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function J_(...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 Y_(e,...t){let n=J_(...t);n.length>0&&e.classList.add(...n)}function X_(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function Z_(e){let t=ng().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function Q_(e){return Z_(Kp(e)?e:e.getParentOrThrow())}function $_(e,t,n=`self`){let r=e.getStartEndPoints();if(t.isSelected(e)&&!jm(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]=Mf(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=dg(t)),t.__text=p)}}return t}function ev(e){let t=tv(e);return t!==null&&t.writingMode===`vertical-rl`}function tv(e){let t=e.anchor.getNode();return H(t)?Z_(t):Q_(t)}function nv(e,t){let n=ev(e)?!t:t;iv(e)&&(n=!n);let r=D_(e.focus,n?`previous`:`next`);if(L_(r))return!1;if(i_(r)&&!vf(r.origin)&&r.origin.isUnmergeable()){let e=r.getNodeAtCaret();if(R(e)&&!vf(e))return!0}for(let e of v_(r)){if(o_(e))return!e.origin.isInline();if(!H(e.origin)){if(U(e.origin))return!0;break}}return!1}function rv(e,t,n,r){e.modify(t?`extend`:`move`,n,r)}function iv(e){let t=tv(e);return t!==null&&t.direction===`rtl`}function av(e,t,n){let r=iv(e),i;i=ev(e)||r?!n:n,rv(e,t,i,`character`)}function ov(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}let sv=Symbol.for(`preact-signals`);function cv(){if(fv>1)return void fv--;let e,t=!1;for(function(){let e=dv;for(dv=void 0;e!==void 0;)e.S.v===e.v&&(e.S.i=e.i),e=e.o}();lv!==void 0;){let n=lv;for(lv=void 0,pv++;n!==void 0;){let r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&_v(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(pv=0,fv--,t)throw e}let X,lv;function uv(e){let t=X;X=void 0;try{return e()}finally{X=t}}let dv,fv=0,pv=0,mv=0;function hv(e){if(X===void 0)return;let t=e.n;return t===void 0||t.t!==X?(t={i:0,S:e,p:X.s,n:void 0,t:X,e:void 0,x:void 0,r:t},X.s!==void 0&&(X.s.n=t),X.s=t,e.n=t,32&X.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=X.s,t.n=void 0,X.s.n=t,X.s=t),t):void 0}function gv(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 _v(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 vv(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 yv(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 bv(e,t){gv.call(this,void 0),this.x=e,this.s=void 0,this.g=mv-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function xv(e){let t=e.m;if(e.m=void 0,typeof t==`function`){fv++;let n=X;X=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,Sv(e),t}finally{X=n,cv()}}}function Sv(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,xv(e)}function Cv(e){if(X!==this)throw Error(`Out-of-order effect`);yv(this),X=e,this.f&=-2,8&this.f&&Sv(this),cv()}function wv(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 Tv(e,t){let n=new wv(e,t);try{n.c()}catch(e){throw n.d(),e}let r=n.d.bind(n);return r[Symbol.dispose]=r,r}gv.prototype.brand=sv,gv.prototype.h=function(){return!0},gv.prototype.S=function(e){let t=this.t;t!==e&&e.e===void 0&&(e.x=t,this.t=e,t===void 0?uv(()=>{var e;(e=this.W)==null||e.call(this)}):t.e=e)},gv.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&&uv(()=>{var e;(e=this.Z)==null||e.call(this)}))}},gv.prototype.subscribe=function(e){return Tv(()=>{let t=this.value,n=X;X=void 0;try{e(t)}finally{X=n}},{name:`sub`})},gv.prototype.valueOf=function(){return this.value},gv.prototype.toString=function(){return this.value+``},gv.prototype.toJSON=function(){return this.value},gv.prototype.peek=function(){let e=X;X=void 0;try{return this.value}finally{X=e}},Object.defineProperty(gv.prototype,"value",{get(){let e=hv(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(pv>100)throw Error(`Cycle detected`);(function(e){fv!==0&&pv===0&&e.l!==0&&(e.l=0,dv={S:e,v:e.v,i:e.i,o:dv})})(this),this.v=e,this.i++,mv++,fv++;try{for(let e=this.t;e!==void 0;e=e.x)e.t.N()}finally{cv()}}}}),bv.prototype=new gv,bv.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===mv))return!0;if(this.g=mv,this.f|=1,this.i>0&&!_v(this))return this.f&=-2,!0;let e=X;try{vv(this),X=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 X=e,yv(this),this.f&=-2,!0},bv.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)}gv.prototype.S.call(this,e)},bv.prototype.U=function(e){if(this.t!==void 0&&(gv.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)}},bv.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(bv.prototype,"value",{get(){if(1&this.f)throw Error(`Cycle detected`);let e=hv(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),wv.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()}},wv.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,xv(this),vv(this),fv++;let e=X;return X=this,Cv.bind(this,e)},wv.prototype.N=function(){2&this.f||(this.f|=2,this.u=lv,lv=this)},wv.prototype.d=function(){this.f|=8,1&this.f||Sv(this)},wv.prototype.dispose=function(){this.d()};function Ev(e){return(typeof e.nodes==`function`?e.nodes():e.nodes)||[]}function Z(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 Dv;try{Dv=`0.49.0+prod.esm`}catch{}let Ov=Dv??`"<unknown>+source"`,kv=/* @__PURE__ */ new Set([`__proto__`,`constructor`,`prototype`]);function Av(e,t){if(e&&t&&!Array.isArray(t)&&typeof e==`object`&&typeof t==`object`){let n=e,r=t;for(let e in r)!kv.has(e)&&Object.prototype.hasOwnProperty.call(r,e)&&(n[e]=Av(n[e],r[e]));return e}return t}function jv(e){return e.id===0}function Mv(e){return e.id===2}function Nv(e){return function(e){return e.id===1}(e)||Z(305,String(e.id),`1`),Object.assign(e,{id:2})}let Pv=/* @__PURE__ */ new Set;var Fv=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):q_;for(let n of this.configs)e=t(e,n);return e}init(e){let t=this.state;Mv(t)||Z(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&&Z(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&&Z(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&&Z(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&&Z(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&&Z(311),this._signal}getInitResult(){this.extension.init===void 0&&Z(312,this.extension.name);let e=this.state;return function(e){return e.id>=4}(e)||Z(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)||Z(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&&Z(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){let t=this.builder.getExtensionRep(e);return t===void 0&&Z(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){let e=this.state;return function(e){return e.id>=7}(e)||Z(316,String(e.id),`7`),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||Pv}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)||Z(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}};let Iv={tag:Wd};function Lv(){let e=G();e.isEmpty()&&e.append(cm())}let Rv=/* @__PURE__ */ G_({config:/* @__PURE__ */ K_({setOptions:Iv,updateOptions:Iv}),init:({$initialEditorState:e=Lv})=>({$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(Xp(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:[Gp,af,$p,gf,om]}),zv=Symbol.for(`@lexical/extension/LexicalBuilder`);function Bv(){}function Vv(e){throw e}function Hv(e){return Array.isArray(e)?e:[e]}let Uv=Ov;var Wv=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=Uv,this.roots=e;for(let t of e)this.addExtension(t)}static fromExtensions(t){let n=[Hv(Rv)];for(let e of t)n.push(Hv(e));return new e(n)}static maybeFromEditor(t){let n=t[zv];return n&&(n.PACKAGE_VERSION!==Uv&&Z(292,n.PACKAGE_VERSION,Uv),n instanceof e||Z(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&Z(294),n}constructEditor(){let{$initialEditorState:e,onError:t,onWarn:n,...r}=this.buildCreateEditorArgs(),i=Object.assign(mm({...r,...t?{onError:e=>{t(e,i)}}:{},...n?{onWarn:e=>{n(e,i)}}:{}}),{[zv]:this});for(let e of this.sortedExtensionReps())e.build(i);return i}buildEditor(){let e=Bv;function t(){try{e()}finally{e=Bv}}let n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=X_(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&&Z(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&&Z(296);let[t]=Hv(e);typeof t.name!=`string`&&Z(297,typeof t.name);let n=this.extensionNameMap.get(t.name);if(n!==void 0&&n.extension!==t&&Z(298,t.name),!n){n=new Fv(this,t),this.extensionNameMap.set(t.name,n);let e=this.conflicts.get(t.name);typeof e==`string`&&Z(299,t.name,e);for(let e of t.conflictsWith||[])this.extensionNameMap.has(e)&&Z(299,t.name,e),this.conflicts.set(e,t.name);for(let e of t.dependencies||[]){let n=Hv(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(Mv(i))return;let a=n.extension.name;var o;jv(i)||Z(300,a,r||`[unknown]`),jv(o=i)||Z(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=Nv(i),n.state=i,e.push(n)};for(let e of this.extensionNameMap.values())jv(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&&Z(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 X_(...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 Ev(o)){if(typeof e!=`function`){let t=n.get(e.replace);t&&Z(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&&Av(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||=Vv,e}};function Gv(e,t){let n=Wv.maybeFromEditor(e);if(!n)return;let r=n.extensionNameMap.get(t);return r?r.getExtensionDependency():void 0}var Kv=class extends Wp{$config(){return this.config(`horizontalrule`,{importDOM:{hr:()=>({conversion:qv,priority:0})}})}exportDOM(){return{element:zh().createElement(`hr`)}}createDOM(e){let t=zh().createElement(`hr`);return Y_(t,e.theme.hr),t}getTextContent(){return`
|
|
153
|
-
`}isInline(){return!1}updateDOM(){return!1}};function qv(){return{node:Jv()}}function Jv(){return wg(Kv)}Date.now;function Yv(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 Xv;function Zv(e,t){let{key:n}=t;return e&&n in e?e[n]:t.defaultValue}function Qv(e){return Xv&&Xv.editor===e?Xv:void 0}function $v(e,t){if(`cfg`in t){let{cfg:n,updater:r}=t;return[n,r(Zv(e,n))]}return t}function ey(e,t){let n=t;for(let r of e){let[e,i]=$v(n,r),a=e.key;if(n===t&&Zv(n,e)===i)continue;let o=n===t||n===void 0?ty(t):n;o[a]=i,n=o}return n}function ty(e){return Object.create(e||null)}function ny(e,t){return[e,t]}function ry(e,t,n,r=ng()){let i=Xv,a=Qv(r);try{return Xv={...a,editor:r,[e]:t},n()}finally{Xv=i}}function iy(e,t=()=>{}){return(n,r=ng())=>i=>{let a=Qv(r),o=a&&a[e],s=ey(n,o||t(r));return s&&s!==o?ry(e,s,i,r):i()}}function ay(e,t,n,r){return Object.assign(dl(Symbol(t),{isEqual:r,parse:n}),{[e]:!0})}let oy=`@lexical/html/DOM`,sy=Symbol.for(`@lexical/html/DOMExportContext`);function cy(e,t,n){return ay(sy,e,t,n)}let ly=/* @__PURE__ */ cy(`isExport`,Boolean);function uy(e){let t=Gv(e,oy);return t?t.output.defaults:void 0}function dy(e){let t=Gv(e,oy);return t?t.output.runtime:void 0}function fy(e=ng()){let t=dy(e);return t?t.getSessionConfig():rg(e)}let py=iy(sy,uy),my=Symbol.for(`@lexical/html/SelectorImpl`);function hy(e,t){let n={kind:`element`,predicate:(r=t,r.length===0?J: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=>hy(e,[...t,n]);return{[my]:n,attr:(e,t,n)=>i(vy(e,t,n)),classAll:(...e)=>i(_y(e)),classAny:(...e)=>i(function(e){let t=gy(e);return t.length===0?()=>!1:e=>{if(!J(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=>J(n)&&n.style.getPropertyValue(e)===t;if(t instanceof RegExp){let r=n&&n.capture,i=t;return(t,n)=>{if(!J(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)}}Yv(362,JSON.stringify(e))}(e,t,n))}}function gy(e){let t=[];for(let n of e)n&&t.push(n);return t}function _y(e){let t=gy(e);return t.length===0?()=>!0:e=>{if(!J(e))return!1;let n=e.classList;for(let e of t)if(!n.contains(e))return!1;return!0}}function vy(e,t,n){if(!0===t)return t=>J(t)&&t.hasAttribute(e);if(typeof t==`string`)return n=>J(n)&&n.getAttribute(e)===t;if(t instanceof RegExp){let r=n&&n.capture,i=t;return(t,n)=>{if(!J(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)}}Yv(361,JSON.stringify(e))}let yy={kind:`text`,predicate:Mm,tags:/* @__PURE__ */ new Set},by={[my]:yy},xy={kind:`comment`,predicate:e=>e.nodeType===8,tags:/* @__PURE__ */ new Set},Sy={[my]:xy},Cy={any:()=>hy(/* @__PURE__ */ new Set,[]),comment:()=>Sy,tag(...e){e.length>0||Yv(363);let t=/* @__PURE__ */ new Set;for(let n of e)t.add(n.toUpperCase());return hy(t,[])},text:()=>by},wy=Cy;wy.tag(`b`,`strong`,`em`,`i`,`code`,`mark`,`s`,`sub`,`sup`,`u`,`span`),wy.text(),wy.tag(`script`,`style`),wy.tag(`br`),wy.tag(`p`),wy.tag(`hr`),wy.any(),Object.freeze([]),Object.freeze({}),Cy.any(),Cy.any,Cy.comment,Cy.tag,Cy.text;function Ty(e,t=null,n=ng()){return py([ny(ly,!0)],n)(()=>{let r=G(),i=fy(n),a=z(t)?Pg(t.anchor.getNode()):null,o=e.append.bind(e);for(let e of(H(a)?a:r).getChildren())Dy(n,e,o,t,i);return e})}function Ey(e,t=null){return(typeof document>`u`||typeof window>`u`&&global.window===void 0)&&Yv(338),Tp(e),Ty(zh().createElement(`div`),t,e).innerHTML}function Dy(e,t,n,r=null,i=rg(e)){let a=i.$shouldInclude(t,r,e),o=i.$shouldExclude(t,r,e),s=t;r!==null&&R(t)&&(s=$_(r,t,`clone`));let{element:c,after:l,append:u,$getChildNodes:d}=i.$exportDOM(s,e);if(!c)return!1;let f=zh().createDocumentFragment(),p=d?d():H(s)?s.getChildren():[],m=a&&Of(r)&&H(t)?null:r,h=f.append.bind(f);for(let n of p){let o=Dy(e,n,h,m,i);!a&&o&&i.$extractWithChild(t,n,r,`html`,e)&&(a=!0)}if(a&&!o){if((J(c)||Xh(c))&&(u?u(f):c.append(f)),n(c),l){let e=l.call(s,c);e&&(Xh(c)?c.replaceChildren(e):c.replaceWith(e))}}else n(f);return a}function Oy(e,t,n=null){let r=Rh(n),i=n?Ih(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=hh(n)}return!1}(a.offsetNode,n))return{node:a.offsetNode,offset:a.offset}}if(a){let i=n.getRootNode();if(Ph(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 ky(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 Ay(e,t=B()){return t??ky(166),z(t)&&t.isCollapsed()||t.getNodes().length===0?``:Ey(e,t)}function jy(e,t){let n=e.getData(`text/plain`)||e.getData(`text/uri-list`);n!=null&&t.insertRawText(n)}let My=`application/x-lexical-drag`;function Ny(e,t){let n={editorKey:t.getKey()};e.setData(My,JSON.stringify(n))}function Py(e,t,n){let r=e.dataTransfer;if(r===null)return!1;let i=function(e){let t=e.getData(My);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=Oy(e.clientX,e.clientY,t.getRootElement());if(n===null)return null;let r=Wm(n.node);if(r===null)return null;if(R(r))return u_(r,`next`,n.offset);if(H(r))return B_(r,n.offset,`next`);let i=r.getParent();return i===null?null:B_(i,r.getIndexWithinParent()+1,`next`)}(e,t);if(a===null)return!1;let o=U_(a);if(o===null)return!1;let s=i.editorKey===t.getKey(),c=B();if(s){if(!z(c)||c.isCollapsed())return!1;if(function(e,t){let{anchor:n,focus:r}=z_(j_(t),`next`);return S_(n,e)<0&&S_(e,r)<0}(a,c))return e.preventDefault(),!0;c.removeText()}if(!o.origin.isAttached())return e.preventDefault(),!0;if(n(r,k_(y_(o)),t),!s){let e=t.getRootElement(),n=e?e.ownerDocument:null,r=n?function(e,t){for(let n of Lh(t)){let t=km(n);if(Dm(t)&&t.getKey()===e&&J(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 Fy(e,t){return Py(e,t,(e,t)=>jy(e,t))}function Iy(e,t){t.update(()=>{if(e!==null){let n=ov(e,KeyboardEvent)?null:e.clipboardData,r=B();if(r!==null&&!r.isCollapsed()&&n!=null){e.preventDefault();let i=Ay(t);i!==null&&n.setData(`text/html`,i),n.setData(`text/plain`,r.getTextContent())}}})}function Ly(e){return X_(e.registerCommand(wu,e=>{let t=B();return!!z(t)&&(t.deleteCharacter(e),!0)},0),e.registerCommand(Au,e=>{let t=B();return!!z(t)&&(t.deleteWord(e),!0)},0),e.registerCommand(ju,e=>{let t=B();return!!z(t)&&(t.deleteLine(e),!0)},0),e.registerCommand(Du,e=>{let t=B();if(!z(t))return!1;if(typeof e==`string`)t.insertText(e);else{let n=e.dataTransfer;if(n!=null)jy(n,t);else{let n=e.data;n&&t.insertText(n)}}return!0},0),e.registerCommand(ku,()=>{let e=B();return!!z(e)&&(e.removeText(),!0)},0),e.registerCommand(Tu,e=>{let t=B();return!!z(t)&&(t.insertLineBreak(e),!0)},0),e.registerCommand(Eu,()=>{let e=B();return!!z(e)&&(e.insertLineBreak(),!0)},0),e.registerCommand(Ru,e=>{let t=B();if(!z(t))return!1;let n=e,r=n.shiftKey;return!!nv(t,!0)&&(n.preventDefault(),av(t,r,!0),!0)},0),e.registerCommand(Iu,e=>{let t=B();if(!z(t))return!1;let n=e,r=n.shiftKey;return!!nv(t,!1)&&(n.preventDefault(),av(t,r,!1),!0)},0),e.registerCommand(Wu,t=>!!z(B())&&(!Tc||!wc)&&(t.preventDefault(),e.dispatchCommand(wu,!0)),0),e.registerCommand(Ku,t=>!!z(B())&&(t.preventDefault(),e.dispatchCommand(wu,!1)),0),e.registerCommand(Hu,t=>{if(!z(B()))return!1;if(t!==null){if((Tc||Dc||Ac)&&wc)return!1;t.preventDefault()}return e.dispatchCommand(Tu,!1)},0),e.registerCommand(ed,()=>{let e=B();return ch(z(e)&&Pg(e.anchor.getNode())!==null?e:null),!0},0),e.registerCommand(Qu,t=>!!z(B())&&(Iy(t,e),!0),0),e.registerCommand($u,t=>!!z(B())&&(function(e,t){Iy(e,t),t.update(()=>{let e=B();z(e)&&e.removeText()},{tag:`cut`})}(t,e),!0),0),e.registerCommand(Ou,t=>!!z(B())&&(function(e,t){e.preventDefault(),t.update(()=>{let t=B(),n=ov(e,ClipboardEvent)?e.clipboardData:null;n!=null&&z(t)&&jy(n,t)},{tag:`paste`})}(t,e),!0),0),e.registerCommand(Ju,t=>Fy(t,e),0),e.registerCommand(Yu,t=>{let n=B();return!!z(n)&&(n.isCollapsed()||t.dataTransfer===null||Ny(t.dataTransfer,e),!0)},0))}function Ry(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(!(z(a)&&z(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||Kp(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)&&R(r)&&r.__text.length===1&&a.anchor.offset===1?2:0}let c=s[0],l=e._nodeMap.get(c.__key);if(!R(l)||!R(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 zy(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:Ry(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!(z(a)&&z(o)&&a.anchor.type===`element`&&a.focus.type===`element`&&o.anchor.type===`text`&&o.focus.type===`text`||!R(r)||!R(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 By(e,t){e.undoStack=[],e.redoStack=[],e.current=null,t&&t(e)}function Vy(e,t,n,r=Date.now,i,a=null){let o=zy(e,n,r),s=()=>{i&&i(t)};return s(),X_(e.registerCommand(Nu,()=>(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(rd,!0)),i.length===0&&e.dispatchCommand(id,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(Pu,()=>(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(id,!0));let o=r.pop();r.length===0&&e.dispatchCommand(rd,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(td,()=>(By(t,i),!1),0),e.registerCommand(nd,()=>(By(t,i),e.dispatchCommand(rd,!1),e.dispatchCommand(id,!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(rd,!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(id,!0)}}else if(m===2)return;t.current={editor:e,editorState:n},s()}))}function Hy(){return{current:null,redoStack:[],undoStack:[]}}Date.now;let Uy=`application/x-codexhost-thread-reference`;function Wy(e){if(!(e.blank||e.projectionValues?.threadReference?.hostId!==`local`))return{threadId:e.id,hostId:`local`,title:e.title?.replace(/[\s\u0000-\u001f\u007f]+/gu,` `).trim()||e.id.slice(0,8)}}function Gy(e){return`thread://${encodeURIComponent(e.threadId).replace(/[!'()*]/gu,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}?hostId=local`}function Ky(e){let t=`[@${e.title.replace(/[\\`*{}[\]()#+.!_<>|~-]/gu,e=>`\\${e}`)}](${Gy(e)})`;return{source:`codexhost-thread`,ref:t,label:e.title,appearance:`session`,clipboardText:t}}function qy(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||r!==`local`||typeof i!=`string`?void 0:Wy({id:n,blank:!1,title:i,projectionValues:{threadReference:{hostId:r}}})}catch{return}}function Jy(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=Jy(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Yy(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Jy(e))&&(r&&(r+=` `),r+=t);return r}let Xy=`@deepseek-ai/dsh-client-ui-conversation/ReferenceChip.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Xy)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=Xy,e.textContent=`.HsYvBG_chip{max-width:240px;color:var(--dsw-alias-state-business-primary);user-select:none;align-items:baseline;gap:3px;display:inline-flex}.HsYvBG_marker{flex:none;font-weight:500}.HsYvBG_icon{flex:none;align-self:center}.HsYvBG_label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.HsYvBG_invalid{color:var(--dsw-alias-state-error-primary);opacity:.7;text-decoration:line-through}`,document.head.appendChild(e)}var Zy={chip:`HsYvBG_chip`,icon:`HsYvBG_icon`,invalid:`HsYvBG_invalid`,label:`HsYvBG_label`,marker:`HsYvBG_marker`};let Qy=`@deepseek-ai/dsh-client-ui-conversation/composer-editor.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Qy)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=Qy,e.textContent=`._06X5vW_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}._06X5vW_reference:hover{background:var(--dsw-alias-state-business-tertiary)}._06X5vW_openable{cursor:pointer}._06X5vW_textRef{max-width:100%;display:inline-block}`,document.head.appendChild(e)}var $y={openable:`_06X5vW_openable`,reference:`_06X5vW_reference`,textRef:`_06X5vW_textRef`};function eb({label:e,reference:t,appearance:n,invalid:r}){return/* @__PURE__ */ (0,h.jsxs)(`span`,{className:Yy($y.reference,Zy.chip,n===`file`&&!r&&$y.openable,r&&Zy.invalid),title:e,children:[n===void 0?/* @__PURE__ */ (0,h.jsx)(`span`,{className:Zy.marker,"aria-hidden":!0,children:`@`}):/* @__PURE__ */ (0,h.jsx)(d.ReferenceIconRegular,{kind:n,reference:t,size:14,className:Zy.icon}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Zy.label,children:e})]})}var tb=class e extends Wp{__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)(eb,{label:this.__label,reference:this.__ref,appearance:this.__appearance,invalid:this.__invalid})}};function nb(e){return new tb(e)}function rb(e){return e instanceof tb}function ib(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 ab(e,t,n,r){let i=e=>e instanceof n,a=e=>{let t=mf(e.getTextContent());t.setFormat(e.getFormat()),e.replace(t)};return[e.registerNodeTransform(af,e=>{if(!e.isSimpleText())return;let n,o=e.getPreviousSibling(),s=e.getTextContent(),c=e;if(R(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(R(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&&R(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&&ib(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();R(o)&&o.isTextEntity()&&(a(o),a(e));let s=e.getNextSibling();R(s)&&s.isTextEntity()&&(a(s),i(e)&&a(e))})]}let ob=/(^|\s)([/@])([\w-]+)/g,sb=/(^|\s)(@(?:"[^"\n]*"?|[^\s"]\S*))/g,cb=/* @__PURE__ */ new Set(`.,;:!?,。;:!?`),lb=/^@.*[/\\.]/u;function ub(e,t,n){if(!n.startsWith(`@"`)){let e=n.length;for(;cb.has(n.charAt(e-1));)--e;return lb.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(;cb.has(e.charAt(i));)i+=1;return i===e.length||/\s/u.test(e.charAt(i))?t+r+1:void 0}let db=/^(?:\s|$)/;function fb(e,t){if(e===``)return[];let n=[];ob.lastIndex=0;let r;for(;(r=ob.exec(e))!==null;){let i=r[2],a=r[3]??``;if((i!==`/`||db.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})}}sb.lastIndex=0;let i;for(;(i=sb.exec(e))!==null;){let t=i.index+(i[1]?.length??0),r=ub(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 pb=class e extends af{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=Yy(t.className,$y.reference,$y.textRef,this.getTextContent().startsWith(`/`)&&$y.openable),t.setAttribute(`spellcheck`,`false`),t.setAttribute(`data-composer-text-ref`,``),t}isTextEntity(){return!0}canInsertTextBefore(){return!0}};function mb(e,t,n){return X_(...ab(e,e=>{let r=n();for(let n of fb(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},pb,e=>new pb(e.getTextContent())))}function hb(e){e.update(()=>{for(let e of G().getAllTextNodes())e.markDirty()},{tag:Wd})}function gb(e,t){return e.registerCommand(yu,e=>{if(e.target===null||e.button!==0||e.detail>1)return!1;let n=B();if(z(n)&&!n.isCollapsed())return!1;let r=Wm(e.target);if(rb(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 pb&&t(void 0,{ref:r.getTextContent()})},1)}let _b=`color: var(--dsw-alias-state-business-primary)`;function vb(){let e=G().getFirstChild();if(!H(e))return null;let t=e.getFirstChild();return R(t)?t:null}function yb(e,t){return e.registerNodeTransform(af,e=>{let n=vb();if(n===null||e.getKey()!==n.getKey()){e.getStyle()===_b&&e.setStyle(``);return}let r=e.getTextContent(),i=t(),a=r===i?.trimEnd()?r:i;if(a===null||!r.startsWith(a))e.getStyle()===_b&&e.setStyle(``);else if(r.length>a.length){let[t,n]=e.splitText(a.length);t!==void 0&&t.getStyle()!==_b&&t.setStyle(_b),n?.setStyle(``)}else e.getStyle()!==_b&&e.setStyle(_b)})}function bb(e){e.update(()=>{vb()?.markDirty()})}function xb(){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(rb(e))o(`chip`,e,``,e.getTextContent());else if(R(e)){let t=e.getTextContent();o(`text`,e,t,t)}else nm(e)?o(`linebreak`,e,`
|
|
151
|
+
`)}return e}getTextContentSize(){let e=function(e){let t=0;for(let n of Lg(e)){let r=Rg(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(),V(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=Rc[e];return(this.getFormat()&t)!==0}return!1}hasTextFormat(e){let t=Ic[e];return(this.getTextFormat()&t)!==0}getFormatFlags(e,t){return Im(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}select(e,t){Cp();let n=z(),r=e,i=t,a=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){let e=this.getFirstChild();if(L(e)||V(e))return e.select(0,0)}else if(!(e!==void 0&&e!==a||t!==void 0&&t!==a)){let e=this.getLastChild();if(L(e)||V(e))return e.select()}}r===void 0&&(r=a),i===void 0&&(i=a);let o=this.__key;return R(n)?(n.anchor.set(o,r,`element`),n.focus.set(o,i,`element`),n.dirty=!0,n):Jf(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!==``&&Rc[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){Vd(this)&&j(324,this.__key,this.__type);let r=this.getChildrenSize(),i=this.getWritable();e+t<=r||j(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&&j(100);let t=e.getNextSibling(),n=e.__key;Rm(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--,Rm(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&&j(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=z();if(R(e)){let t=new Set(s),n=new Set(o),{anchor:r,focus:i}=e;Wp(r,t,n)&&tp(r,r.getNode(),this,l,c),Wp(i,t,n)&&tp(i,i.getNode(),this,l,c),u!==0||this.canBeEmpty()||Eh(this)||this.remove()}}return i}getDOMSlot(e){return new qc(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===``||Eh(this)||this.getChildren().some(L)||(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=ag(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 V(e){return e instanceof Up}function Wp(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 Gp=class extends Ud{__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&&j(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 H(e){return e instanceof Gp}var Kp=class extends Up{__cachedText;$config(){return this.config(`root`,{extends:Up})}constructor(){super(`root`),this.__cachedText=null}getTopLevelElementOrThrow(){j(51)}getTextContent(){let e=this.__cachedText;return e===null||!Sp()&&B()._dirtyType!==0?super.getTextContent():e}remove(){j(52)}replace(e){j(53)}insertBefore(e){j(54)}insertAfter(e){j(55)}updateDOM(e,t){return!1}splice(e,t,n){for(let e of n)V(e)||H(e)||j(282);return super.splice(e,t,n)}static importJSON(e){return W().updateFromJSON(e)}collapseAtStart(){return!0}};function qp(e){return e instanceof Kp}function Jp(e){return new Qp(Qc(e._nodeMap),null,e._slotsUsed)}function Yp(){return new Qp(/* @__PURE__ */ new Map([[`root`,new Kp]]),null,!1)}function Xp(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&j(130,n.name),V(e)){let r=t.children;Array.isArray(r)||j(59,n.name);let i=e.getChildren();for(let e=0;e<i.length;e++){let t=Xp(i[e]);r.push(t)}}let r=Lg(e);if(r.length>0){let i={};for(let t of r){let r=Rg(e,t);r===null&&j(366,n.name,t),i[t]=Xp(r)}t.$slots=i}return t}function Zp(e){return e instanceof Qp}var Qp=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 Pp(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 Pp(null,this,()=>({root:Xp(W())}))}},$p=class extends Up{$config(){return this.config(`artificial`,{extends:Up})}createDOM(e){return Bh().createElement(`div`)}},em=class extends Ud{$config(){return this.config(`linebreak`,{importDOM:{br:e=>im(e)||am(e)?null:{conversion:tm,priority:0}}})}getTextContent(){return`
|
|
152
|
+
`}createDOM(){return Bh().createElement(`br`)}updateDOM(){return!1}isInline(){return!0}};function tm(e){return{node:nm()}}function nm(){return Oh(new em)}function rm(e){return e instanceof em}function im(e){let t=e.parentElement;if(t!==null&&tg(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&om(n)){let n=t.lastChild;if(n===e||n.previousSibling===e&&om(n))return!0}}return!1}function am(e){let t=e.parentElement;if(t!==null&&tg(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&om(n))return!1;let r=t.lastChild;if(r===e||r.previousSibling===e&&om(r))return!0}return!1}function om(e){return Nm(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||``)}var sm=class extends Up{$config(){return this.config(`paragraph`,{extends:Up,importDOM:{p:()=>({conversion:cm,priority:0})}})}createDOM(e){let t=Bh().createElement(`p`),n=uh(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(Bh().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(L);t?(e.textFormat=t.getFormat(),e.textStyle=t.getStyle()):(e.textFormat=this.getTextFormat(),e.textStyle=this.getTextStyle())}return e}insertNewAfter(e,t){let n=lm();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||L(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 cm(e){let t=lm();if(hg(t,e),pg(e,t),t.getFormatType()===``){let n=e.getAttribute(`align`);n&&n&&n in Rc&&t.setFormat(n)}return mg(t,e),{node:t}}function lm(){return Oh(new sm)}function um(e){return e instanceof sm}function dm(e){console.warn(e)}function fm(e,t,n,r,i){let a=e._keyToDOMMap;a.clear(),e._editorState=Yp(),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),Um(n,e,`root`))}function pm(e){let t=/* @__PURE__ */ new Set,n=/* @__PURE__ */ new Set;for(let{klass:r,ownNodeConfig:i}of wg(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 mm={$createDOM:(e,t)=>e.createDOM(t._config,t),$decorateDOM:(e,t,n,r)=>{},$exportDOM:(e,t)=>{let n=wm(t,e.getType());return n&&n.exportDOM!==void 0?n.exportDOM(t,e):e.exportDOM(t)},$extractWithChild:(e,t,n,r,i)=>V(e)&&e.extractWithChild(t,n,r),$getDOMSlot:(e,t,n)=>e.getDOMSlot(t),$getSlotTargetElement:(e,t,n,r)=>null,$shouldExclude:(e,t,n)=>V(e)&&e.excludeFromCopy(`html`),$shouldInclude:(e,t,n)=>!t||e.isSelected(t),$updateDOM:(e,t,n,r)=>e.updateDOM(t,n,r._config)};function hm(e){let t=e||{},n=kp(),r=t.theme||{},i=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,o=Yp(),s=t.namespace||(i===null?$m():i._config.namespace),c=t.editorState,l=[Kp,of,em,_f,sm,$p,...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===Ud||n.prototype instanceof Ud)){let r=`<unknown>`;try{r=JSON.parse(Xc)}catch{}j(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))}Cg(n);let a=n.getType(),o=pm(n);m.set(a,{exportDOM:f&&f.export?f.export.get(n):void 0,klass:n,replace:r,replaceWithKlass:i,sharedNodeState:pl(l[e]),transforms:o})}}let h=new vm(o,i,m,{disableEvents:a,dom:{...mm,...e&&e.dom},namespace:s,theme:r},u||console.error,d||dm,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(xu,Ed,0),e.registerCommand(Su,Dd,0),e.registerCommand(Cu,Od,0),e.registerCommand(wu,kd,0),e.registerCommand(Iu,Md,0)}(h),h}function gm(e,t){let n=e.get(t);e.delete(t),n&&n()}function _m(e,t,n){return e.set(t,n),gm.bind(null,e,t)}var vm=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 $c,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=$m(),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 _m(this._listeners.update,e)}registerEditableListener(e){return _m(this._listeners.editable,e)}registerDecoratorListener(e){return _m(this._listeners.decorator,e)}registerTextContentListener(e){return _m(this._listeners.textcontent,e)}registerRootListener(e){let t=this._listeners.root;return Z_(_m(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&&j(35);let r=this._commands;r.has(e)||r.set(e,[new Zc,new Zc,new Zc,new Zc,new Zc]);let i=r.get(e);i===void 0&&j(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&&j(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){let n=this._editorState,r=ug(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=ug(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:Gd}: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=uh(this._config.theme,`root`),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,fm(this,t,e,r,{preserveUpdateQueue:!0}),t!==null&&(this._config.disableEvents||Rd(t),n!=null&&t.classList.remove(...n)),e!==null){let t=xh(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,ul(this),this._updateTags.add(Gd),Fp(this),this._config.disableEvents||function(e,t){let n=e.ownerDocument;pd.set(e,n);let r=md.get(n);r===void 0&&(r={editors:/* @__PURE__ */ new Set,hasShadowEditor:void 0},md.set(n,r)),r.editors.add(t),r.hasShadowEditor=void 0,e.__lexicalEditor=t;let i=Nd(e);i.push(hd.register(n));for(let n=0;n<fd.length;n++){let[r,a]=fd[n],o=typeof a==`function`?e=>{Ld(e)||(Id(e),(t.isEditable()||r===`click`)&&a(e,t))}:e=>{if(Ld(e))return;Id(e);let n=t.isEditable();switch(r){case`cut`:return n&&K(t,ed,e);case`copy`:return K(t,$u,e);case`paste`:return n&&K(t,ku,e);case`dragstart`:return n&&K(t,Xu,e);case`dragover`:return n&&K(t,Zu,e);case`dragend`:return n&&K(t,Qu,e);case`focus`:return n&&K(t,od,e);case`blur`:return n&&K(t,sd,e);case`drop`:return n&&K(t,Yu,e)}};i.push(ud(e,r,o))}}(e,this),n!=null&&e.classList.add(...n)}else this._window=null,this._updateTags.add(Gd),Fp(this);Ip(`root`,this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&j(38);let n=e;n._readOnly&&(n=Jp(e),n._selection=e._selection?e._selection.clone():null),ll(this);let r=this._pendingEditorState,i=t===void 0?null:t.tag;r===null||r.isEmpty()||(i!=null&&this._updateTags.add(i),Fp(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set(`root`,!1),this._compositionKey=null,this._slotsUsed=this._slotsUsed||e._slotsUsed,Vp(this,()=>{if(i&&this._updateTags.add(i),e._parsed)for(let[e,t]of n._nodeMap.entries())V(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=Yp(),i=mp,a=gp,o=hp,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,mp=r,gp=!1,hp=t,bm(null);try{let i=t._nodes;Np(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,mp=i,gp=a,hp=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`&&Fp(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]):Bp(e,t,n)})(this,e,t)}focus(e,t={}){let n=this._rootElement;n!==null&&(n.setAttribute(`autocapitalize`,`off`),Vp(this,()=>{let r=z(),i=W();r===null?i.getChildrenSize()!==0&&(t.defaultSelection===`rootStart`?i.selectStart():i.selectEnd()):r.dirty||Jm(r.clone()),vh(`focus`),yh(()=>{n.removeAttribute(`autocapitalize`),e&&e()})}),this._pendingEditorState===null&&n.removeAttribute(`autocapitalize`))}blur(){let e=this._rootElement;e!==null&&e.blur();let t=Nh(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Ip(`editable`,this,!0,e),this._slotsUsed&&this.update(()=>Dp()))}toJSON(){return{editorState:this._editorState.toJSON()}}};vm.version=Xc;let ym=null;function bm(e){ym=e}let xm=Symbol(`INTERNAL_SKIP_AFTER_CLONE_FROM`),Sm=1;function Cm(e,t){let n=wm(e,t);return n===void 0&&j(30,t),n}function wm(e,t){return e._nodes.get(t)}let Tm=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)};function Em(e,t){let n=t===void 0?(()=>{let t=e.getRootNode();return Pm(t)||Fh(t)?Jh(t):null})():t;if(!q(n)||n.hasAttribute(`data-lexical-slot`))return!1;let r=Gm(n),i=n.nodeName;return Wd(r)&&(i===`INPUT`||i===`TEXTAREA`||n.contentEditable===`true`&&Am(n)==null)}function Dm(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 km(t)===e&&e.read(`latest`,()=>!Em(t))}function Om(e){return e instanceof vm}function km(e){let t=e;for(;t!=null;){let e=Am(t);if(Om(e))return e;t=gh(t)}return null}function Am(e){return e?e.__lexicalEditor:null}function jm(e){return yf(e)||e.isToken()}function Mm(e){return jm(e)||e.isSegmented()}function Nm(e){return Xh(e)&&e.nodeType===3}function Pm(e){return Xh(e)&&e.nodeType===9}function Fm(e){let t=e;for(;t!=null;){if(Nm(t))return t;t=t.firstChild}return null}function Im(e,t,n){let r=Ic[t];if(n!==null&&(e&r)===(n&r))return e;let i=e^r;return t===`subscript`?i&=~Ic.superscript:t===`superscript`?i&=~Ic.subscript:t===`lowercase`?(i&=~Ic.uppercase,i&=~Ic.capitalize):t===`uppercase`?(i&=~Ic.lowercase,i&=~Ic.capitalize):t===`capitalize`&&(i&=~Ic.lowercase,i&=~Ic.uppercase),i}function Lm(e,t){let n=function(){let e=ym;return ym=null,e}();if((t||=n&&n.__key)!=null)return void(e.__key=t);Cp(),wp();let r=B(),i=Tp(),a=``+Sm++;i._nodeMap.set(a,e),V(e)?r._dirtyElements.set(a,!0):r._dirtyLeaves.add(a),r._cloneNotNeeded.add(a),r._dirtyType===0&&(r._dirtyType=1),e.__key=a}function Rm(e){Mg(e)!==null&&j(380,e.__key,String(Mg(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 zm(e){wp(),Vd(e)&&j(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent===null?jg(t)?t.__slotHost:null:t.__parent,r=Tp(),i=B(),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?jg(e)?e.__slotHost:null:e.__parent}}(n,a,o);let s=t.__key;i._dirtyType===0&&(i._dirtyType=1),V(e)?o.set(s,!0):i._dirtyLeaves.add(s)}function Bm(e){Cp();let t=B(),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 Vm(){return Sp()?null:B()._compositionKey}function U(e,t){let n=(t||Tp())._nodeMap.get(e);return n===void 0?null:n}function Hm(e,t){let n=Wm(e,B());return n===void 0?null:U(n,t)}function Um(e,t,n){e[`__lexicalKey_${t._key}`]=n}function Wm(e,t){return e[`__lexicalKey_${t._key}`]}function Gm(e,t){let n=e;for(;n!=null;){let e=Hm(n,t);if(e!==null)return e;n=gh(n)}return null}function Km(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function qm(e){return e.read(()=>W().getTextContent())}function W(){return Tp()._nodeMap.get(`root`)}function Jm(e){Cp();let t=Tp();e!==null&&(e.dirty=!0,e.setCachedNodes(null),R(e)&&B()._slotsUsed&&Gf(e)),t._selection=e}function Ym(){Cp(),ll(B())}function Xm(e){let t=function(e,t){let n=e;for(;n!=null;){let e=Wm(n,t);if(e!==void 0)return e;n=gh(n)}return null}(e,B());return t===null?null:U(t)}function Zm(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Qm(e){let t=[];for(let n=e;n!==null;n=n._parentEditor)t.push(n);return t}function $m(){return Math.random().toString(36).replace(/[^a-z]+/g,``).substring(0,5)}function eh(e){return Nm(e)?e.nodeValue:null}function th(e,t,n){let r=Nh(Sh(t));if(r===null)return;let i=Uh(r,t._rootElement),a=i.anchorNode,{anchorOffset:o,focusOffset:s}=i;if(a!==null){let t=eh(a),r=Gm(a);if(t!==null&&L(r)){if((t===Mc||t===Nc)&&n){let e=n.length;t=n,o=e,s=e}t!==null&&nh(r,t,o,s,e)}}}function nh(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(Mc)&&(s=t.slice(0,-Mc.length)),i)){let e=Nc,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=z();if(s===``){if(Bm(null),Oc||Ec||jc)a.remove();else{let e=B();rh(a,``,t),setTimeout(()=>{e.update(()=>{a.isAttached()&&a.getTextContent()===``&&a.remove()})},20)}return}let i=a.getParent(),c=Qf(),l=a.getTextContentSize(),u=Vm(),d=a.getKey();if(a.isToken()&&!o||u!==null&&d===u&&!o||R(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(!R(t)||n===null||r===null)return void rh(a,s,t);if(t.setTextNodeRange(a,n,a,r),a.isSegmented()){let e=hf(a.getTextContent());a.replace(e),a=e}rh(a,s,t)}}}function rh(e,t,n){if(e.setTextContent(t),R(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=f_(e,a.offset,`clamp`),r=!0)}r&&(n._cachedNodes=null,n._cachedIsBackward=null)}}function ih(e,t,n){let r=t[n]||!1;return r===`any`||r===e[n]}function ah(e,t){return ih(e,t,`altKey`)&&ih(e,t,`ctrlKey`)&&ih(e,t,`shiftKey`)&&ih(e,t,`metaKey`)}function G(e,t,n){if(!ah(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 oh={ctrlKey:!Cc,metaKey:Cc},sh={altKey:Cc,ctrlKey:!Cc};function ch(e){return e.key===`Backspace`}function lh(e){let t=W();if(R(e)){let t=e.anchor,n=e.focus,r=t.getNode();if(qp(r))return t.set(r.getKey(),0,`element`),n.set(r.getKey(),r.getChildrenSize(),`element`),El(e),e;let i=r.getTopLevelElementOrThrow(),a=i.getParent();if(a===null)return V(i)&&(t.set(i.getKey(),0,`element`),n.set(i.getKey(),i.getChildrenSize(),`element`),El(e)),e;let o=a;return t.set(o.getKey(),0,`element`),n.set(o.getKey(),o.getChildrenSize(),`element`),El(e),e}{let e=t.select(0,t.getChildrenSize());return Jm(El(e)),e}}function uh(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=Y_(i);return n[t]=e,e}return i}function dh(e,t,n,r,i){if(n.size===0)return;let a=r.__type,o=r.__key,s=t.get(a);s===void 0&&j(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 fh(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 ph(e,t){let n=e.offset;if(e.type===`element`)return fh(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?fh(r.getParentOrThrow(),t,r.getIndexWithinParent()+ +!t):e}}return null}function mh(e){let t=Sh(e).event,n=t&&t.inputType;return n===`insertFromPaste`||n===`insertFromPasteAsQuotation`}function K(e,t,...n){return Lp(e,t,n[0],e)}function hh(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&j(75,t),n}function gh(e){let t=e.assignedSlot||e.parentElement;if(t!==null)return t;let n=e.parentNode;return Fh(n)?n.host:null}function _h(e){return Pm(e)?e:q(e)?e.ownerDocument:null}function vh(e){Cp(),B()._updateTags.add(e)}function yh(e){Cp(),B()._deferred.push(e)}function bh(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function xh(e){let t=_h(e);return t?t.defaultView:null}function Sh(e){let t=e._window;return t===null&&j(78),t}function Ch(e){return V(e)&&e.isInline()||H(e)&&e.isInline()}function wh(e){let t=e.getLatest();for(;t!==null;){if(Mg(t)!==null&&V(t))return t;let e=t.getParentOrThrow();if(Eh(e))return e;t=e}return t}function Th(e){return V(e)&&e.isShadowRoot()}function Eh(e){return qp(e)||Th(e)}function Dh(e,t=!1){let n=e.constructor.clone(e,xm);return Lm(n,null),n.afterCloneFrom(e),t||n.resetOnCopyNodeFrom(e),n}function Oh(e){let t=B(),n=e.getType(),r=wm(t,n);r===void 0&&j(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||j(202,r.name,r.getType(),e.constructor.name,n):t instanceof a||j(201,a.name,a.getType(),r.name,r.getType(),e.constructor.name,n),t.__key===e.__key&&j(203,e.constructor.name,n,r.name,r.getType()),t}return e}function kh(e,t){!qp(e.getParent())||V(t)||H(t)||j(99)}function Ah(e){let t=U(e);return t===null&&j(63,e),t}function jh(e){if(!e||e.isInline())return!1;if(H(e))return!0;if(V(e)){if(e.isShadowRoot()){let t=e.getParent();return!(V(t)&&t.isShadowRoot())}return!e.canBeEmpty()}return!1}function Mh(e,t,n){n.style.removeProperty(`caret-color`),t._blockCursorElement=null;let r=e.parentElement;r!==null&&r.removeChild(e)}function Nh(e){return xc?(e||window).getSelection():null}function Ph(e){let t=xh(e);return t?t.getSelection():null}function Fh(e){return Zh(e)&&`host`in e}let Ih=[];function Lh(e){let t=e.getRootNode();if(t===e||!Fh(t))return Ih;let n=[t],r=t.host;for(;;){let e=r.getRootNode();if(e===r||!Fh(e))break;n.push(e),r=e.host}return n}function*Rh(e){let t=[e],n;for(;n=t.pop();){yield*n.querySelectorAll(`[data-lexical-editor="true"]`);let e=(Pm(n)?n:n.ownerDocument).createTreeWalker(n,NodeFilter.SHOW_ELEMENT),r;for(;r=e.nextNode();)r.shadowRoot&&t.push(r.shadowRoot)}}function zh(e){return e===null?document:e.ownerDocument}function Bh(){let e=kp();return zh(e===null?null:e._rootElement)}function Vh(e,t){if(t===null||typeof e.getComposedRanges!=`function`)return null;let n=Lh(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 Hh(e,t){let n=Vh(e,t);if(n!==null){let e=Wh(n);if(e!==null)return e}return e.rangeCount>0?e.getRangeAt(0):null}function Uh(e,t){let n=Vh(e,t);return n===null?e:Gh(n,Kh(e))}function Wh(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 Gh(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 Kh(e){return e.direction}function qh(e){let t=e.getRootNode();return Pm(t)||Fh(t)?t.activeElement:null}function Jh(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 Yh(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 Xh(e)&&e.nodeType===1}function Xh(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function Zh(e){return Xh(e)&&e.nodeType===11}let Qh=/^(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 $h(e){return!(!q(e)||!e.style.display.startsWith(`inline`))||Qh.test(e.nodeName)}let eg=/^(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 tg(e){return(!q(e)||!e.style.display.startsWith(`inline`))&&eg.test(e.nodeName)}function ng(e){if(H(e)&&!e.isInline())return!0;if(!V(e)||Eh(e))return!1;let t=e.getFirstChild(),n=t===null||rm(t)||L(t)||t.isInline();return!e.isInline()&&!1!==e.canBeEmpty()&&n}function rg(){return B()}function ig(e=rg()){return e._config.dom||mm}function ag(e,t,n=rg()){let r=ig(n).$getDOMSlot(e,t,n);return V(e)&&(og(r)||j(344,e.getKey(),e.getType())),r}function og(e){return e instanceof qc}function sg(e,t,n=rg()){return Fm(ag(e,t,n).element)}let cg=/* @__PURE__ */ new WeakMap,lg=/* @__PURE__ */ new Map;function ug(e){if(!e._readOnly&&e.isEmpty())return lg;e._readOnly||j(192);let t=cg.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),cg.set(e,t)),t}function dg(e){let t=e.constructor.clone(e,xm);return t.afterCloneFrom(e),t}function fg(e){return(t=dg(e))[Bd]=!0,t;var t}function pg(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 mg(e,t){let n=t.getAttribute(`dir`);return n===`ltr`||n===`rtl`?e.setDirection(n):e}function hg(e,t){let n=t.style.textAlign;return n&&n in Rc?e.setFormat(n):e}function gg(e,t){e.__lexicalUnmanaged=!0,t&&t.captureSelection!==void 0&&(e.__lexicalCapturedSelection=t.captureSelection)}function _g(e){return!0===e.__lexicalUnmanaged}function vg(e,t=rg()){let n=t.isEditable();e.contentEditable=n?`true`:`false`,n?e.__lexicalEditor=t:delete e.__lexicalEditor}function yg(e,t){let n=e;for(;n!=null;){if(!0===n.__lexicalCapturedSelection)return!0;if(q(n)&&n.hasAttribute(`data-lexical-slot`)||Wm(n,t)!==void 0)return!1;n=gh(n)}return!1}function bg(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)&&e[t]!==Ud[t]}let xg=/* @__PURE__ */ new WeakMap,Sg=Symbol(`lexical.synthesizedGetType`);function Cg(e){let t=xg.get(e);if(t)return t;let n=e.prototype!=null&&Hc in e.prototype?e.prototype[Hc]():void 0,r=function(e){if(!(e===Ud||e.prototype instanceof Ud)){let t=`<unknown>`,n=`<unknown>`;try{t=e.getType()}catch{}try{vm.version&&(n=JSON.parse(vm.version))}catch{}j(290,e.name,t,n)}return e===Gp||e===Up||e===Ud}(e),i=!r&&bg(e,`getType`)?e.getType:void 0,a=i&&!(Sg 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(!bg(e,`getType`)){let t=e,n=function(){return this===t?s:Ud.getType.call(this)};n[Sg]=!0,e.getType=n}if(bg(e,`clone`)||(e.clone=(t,n)=>{bm(t);let r=new e;return n!==xm&&r.afterCloneFrom(t),r}),bg(e,`importJSON`)||(e.importJSON=o&&o.$importJSON||(t=>new e().updateFromJSON(t))),!bg(e,`importDOM`)&&o){let{importDOM:t}=o;t&&(e.importDOM=()=>t)}}let c={klass:e,ownNodeConfig:o,ownNodeType:s};return xg.set(e,c),c}function*wg(e){for(let t=e;t&&(t===Ud||Wd(t.prototype));){let e=Cg(t);yield e,t=e.ownNodeConfig&&e.ownNodeConfig.extends||Og(t)}}function Tg(e){let t=rg();return Cp(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}let Eg=(e,t)=>{let n=e;for(;n!=null&&!qp(n);){if(t(n))return n;n=n.getParent()}return null};function Dg(e,t){let n=[],r=e.__first;for(;r!==null;){let e=t===null?U(r):t.get(r);e??j(174),n.push(r),r=e.__next}return n}function Og(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 kg=/* @__PURE__ */ new Map;function Ag(e){return V(e)||H(e)}function jg(e){return V(e)||H(e)}function Mg(e){let t=e.getLatest();return jg(t)?t.__slotHost:null}function Ng(e){let t=Mg(e);if(t===null)return null;let n=U(t);return V(n)||H(n)||j(370),n}function Pg(e){let t=Ng(e);if(t===null)return null;let n=e.getLatest().__key;for(let[e,r]of Ig(t))if(r===n)return e;return null}function Fg(e){let t=e.getLatest();for(;t!==null;){if(Mg(t)!==null)return t;t=t.getParent()}return null}function Ig(e){let t=e.getLatest();return Ag(t)&&t.__slots!==null?t.__slots:kg}function Lg(e){return Array.from(Ig(e).keys())}function Rg(e,t){let n=Ig(e).get(t);return n===void 0?null:U(n)}let zg=[`__proto__`,`constructor`,`prototype`],Bg=Symbol(`slotMapOwner`);function Vg(e){let t=e.__slots;return t!==null&&t[Bg]===e||(t=new Map(t),t[Bg]=e,e.__slots=t),t}let Hg=/* @__PURE__ */ new WeakMap,Ug=[];function Wg(e){for(let{ownNodeConfig:t}of wg(e)){let e=t&&t.slots;if(e)return e}return Ug}function Gg(e){let t=``;for(let n of Lg(e)){let r=Rg(e,n);r!==null&&(t+=r.getTextContent())}return t}function Kg(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 qg(e){let t=e.__slots;if(t===null||t.size<2)return;let n=function(e){let t=Hg.get(e);if(t===void 0){let n=Wg(e),r=/* @__PURE__ */ new Map;for(let t of n)zg.includes(t)&&j(371,e.name,t),r.has(t)&&j(372,e.name,t),r.set(t,r.size);t=r,Hg.set(e,t)}return t}(e.constructor),r=null,i=!0;for(let e of t.keys()){if(r!==null&&Kg(r,e,n)>0){i=!1;break}r=e}if(i)return;let a=Array.from(t).sort(([e],[t])=>Kg(e,t,n));t.clear();for(let[e,n]of a)t.set(e,n)}function Jg(e,t,n){t!==`__proto__`&&t!==`constructor`&&t!==`prototype`||j(373,t);let r=e.getLatest();if(r.__slots!==null&&r.__slots.get(t)===n.getLatest().__key)return r;(!V(n)&&!H(n)||n.isInline())&&j(374,n.__key);let i=e.getWritable(),a=Vg(i),o=a.get(t);o!==void 0&&Xg(o);let s=n.getWritable(),c=Ng(s);if(c!==null){let e=Pg(s);e!==null&&Vg(c.getWritable()).delete(e),s.__slotHost=null}return Rm(s),s.__slotHost=i.__key,a.set(t,s.__key),qg(i),function(){let e=rg();e._slotsUsed=!0,e._pendingEditorState&&(e._pendingEditorState._slotsUsed=!0)}(),i}function Yg(e,t){let n=e.getWritable();if(n.__slots===null)return n;let r=n.__slots.get(t);return r!==void 0&&(Xg(r),Vg(n).delete(t)),n}function Xg(e){let t=U(e);if(t===null)return;let n=t.getWritable();jg(n)||j(377,e),n.__slotHost=null,n.remove()}let Zg={next:`previous`,previous:`next`};var Qg=class{origin;constructor(e){this.origin=e}[Symbol.iterator](){return S_({hasNext:o_,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return J(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return J(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&&j(263,Array.from(o).join(` `))}else i.insert(e);i=J(e,this.direction)}for(let e of o.values())e.remove();return this}},$g=class e extends Qg{type=`child`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:m_(e,this.direction)}getParentCaret(e=`root`){return J(n_(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=t_(this.direction);return J(this.getNodeAtCaret(),e)||m_(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 e_={root:qp,shadowRoot:Eh};function t_(e){return Zg[e]}function n_(e,t=`root`){return e===null||e_[t](e)?null:Mg(e)===null?e:null}var r_=class e extends Qg{type=`sibling`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:J(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return V(this.origin)?m_(this.origin,this.direction):null}getParentCaret(e=`root`){return J(n_(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=t_(this.direction);return J(this.getNodeAtCaret(),e)||m_(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 i_)&&this.direction===t.direction&&this.origin.is(t.origin)}},i_=class e extends Qg{type=`text`;offset;constructor(e,t){super(e),this.offset=t}getLatest(){let e=this.origin.getLatest();return e===this.origin?this:d_(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e=`root`){return J(n_(this.getParentAtCaret(),e),this.direction)}getFlipped(){return d_(this.origin,t_(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 r_||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return J(this.origin,this.direction)}};function a_(e){return e instanceof i_}function o_(e){return e instanceof r_}function s_(e){return e instanceof $g}let c_={next:class extends i_{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends i_{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},l_={next:class extends r_{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends r_{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},u_={next:class extends $g{direction=`next`;getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends $g{direction=`previous`;getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function J(e,t){return e?new l_[t](e):null}function d_(e,t,n){return e?new c_[t](e,f_(e,n)):null}function f_(e,t,n=`error`){let r=e.getTextContentSize(),i=t===`next`?r:t===`previous`?0:t;return(i<0||i>r)&&(n!==`clamp`&&bc(284,String(t),String(r),e.getKey()),i=i<0?0:r),i}function p_(e,t){return new v_(e,t)}function m_(e,t){return V(e)?new u_[t](e):null}function h_(e){return e&&e.getChildCaret()||e}function g_(e){return e&&h_(e.getAdjacentCaret())}var __=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 a_(t)?function(e,t){let{direction:n,origin:r}=e;return p_(e,f_(r,t===`focus`?t_(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[p_(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e=`root`){let t=a_(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=a_(n),i=t=>t.isSameNodeCaret(n)?null:g_(t)||t.getParentCaret(e);return S_({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`)}},v_=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 d_(e.setTextContent(i.slice(0,n)+i.slice(r)),t,n)}};function y_(e){return x_(e,J(W(),e.direction))}function b_(e){return x_(e,e)}function x_(e,t){return e.direction!==t.direction&&j(265),new __(e,t,e.direction)}function S_(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 C_(e,t){let n=D_(e.origin,t.origin);switch(n===null&&j(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 w_(n)}}function w_(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 T_(e,t){return t.is(e)}function E_(e){return V(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function D_(e,t){if(e.is(t))return{commonAncestor:e,type:`same`};let n=/* @__PURE__ */ new Map;for(let[t,r]=E_(e);t;r=t,t=t.getParent())n.set(t,r);for(let[r,i]=E_(t);r;i=r,r=r.getParent()){let a=n.get(r);if(a!==void 0)return a===null?(T_(e,r)||j(276),{commonAncestor:r,type:`ancestor`}):i===null?(T_(t,r)||j(277),{commonAncestor:r,type:`descendant`}):((V(a)||T_(e,a))&&(V(i)||T_(t,i))&&r.is(a.getParent())&&r.is(i.getParent())||j(278),{a,b:i,commonAncestor:r,type:`branch`})}return null}function O_(e,t){let{type:n,key:r,offset:i}=e,a=Ah(e.key);return n===`text`?(L(a)||j(266,a.getType(),r),d_(a,t,i)):(V(a)||j(267,a.getType(),r),V_(a,e.offset,t))}function k_(e,t){let{origin:n,direction:r}=t,i=r===`next`;a_(t)?e.set(n.getKey(),t.offset,`text`):o_(t)?L(n)?e.set(n.getKey(),f_(n,r),`text`):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+ +!!i,`element`):(s_(t)&&V(n)||j(268),e.set(n.getKey(),i?0:n.getChildrenSize(),`element`))}function A_(e){let t=z(),n=R(t)?t:Yf();return j_(n,e),Jm(n),n}function j_(e,t){k_(e.anchor,t.anchor),k_(e.focus,t.focus)}function M_(e){let{anchor:t,focus:n}=e,r=O_(t,`next`),i=O_(n,`next`),a=C_(r,i)<=0?`next`:`previous`;return x_(z_(r,a),z_(i,a))}function N_(e){let{direction:t,origin:n}=e,r=J(n,t_(t)).getNodeAtCaret();return r?J(r,t):m_(n.getParentOrThrow(),t)}function P_(e,t=`root`){let n=[e];for(let r=s_(e)?e.getParentCaret(t):e.getSiblingCaret();r!==null;r=r.getParentCaret(t))n.push(N_(r));return n}function F_(e){return!!e&&e.origin.isAttached()}function I_(e,t=`removeEmptySlices`){if(e.isCollapsed())return e;let n=`root`,r=`next`,i=t,a=B_(e,r),o=P_(a.anchor,n),s=P_(a.focus.getFlipped(),n),c=/* @__PURE__ */ new Set,l=[];for(let e of a.iterNodeCarets(n))if(s_(e))c.add(e.origin.getKey());else if(o_(e)){let{origin:t}=e;V(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),Rm(e)}for(let e of u)!e.canBeEmpty()&&!Eh(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=N_(J(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=hf(e.getTextContent()).setStyle(e.getStyle()).setFormat(e.getFormat());a.replaceOrInsert(n),t=d_(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(F_(e)){d=L_(e);break}for(let e of s)if(F_(e)){f=L_(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(Eh(i))return;!n&&t(i)&&(n=i)}return n},u=l(a,ng),d=u&&l(o,e=>n.has(e.getKey())&&ng(e));return d&&Lg(d).length>0?null:u&&d?[u,d]:null}(d,f,c);if(p){let[e,t]=p;m_(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(s_(e)){let t=e.origin;if(ng(t))return t}else{let t=e.getParentAtCaret();if(t&&ng(t))return t}return null}(f),t=e&&e.getParent(),n=e&&e.getParents().findLast(Th);if(e&&t&&!qp(t)&&e.isEmpty()&&c.has(e.getKey())&&Lg(e).length===0&&(!n||c.has(n.getKey()))){e.remove(!0);let n=t;for(;n&&!qp(n)&&n.isEmpty();){let e=n.getParent();if(e&&qp(e)&&e.getChildrenSize()<=1)break;let t=n;n=e,t.remove(!0)}}}let m=[d,f,...o,...s].find(F_);if(m)return b_(z_(L_(m),e.direction));j(269,JSON.stringify(o.map(e=>e.origin.__key)))}function L_(e){let t=function(e){let t=e;for(;s_(t);){let e=g_(t);if(!s_(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(L(t.origin))return a_(t)?t:d_(t.origin,n,n);let r=t.getAdjacentCaret();return o_(r)&&L(r.origin)?d_(r.origin,n,t_(n)):t}function R_(e){return a_(e)&&e.offset!==f_(e.origin,e.direction)}function z_(e,t){return e.direction===t?e:e.getFlipped()}function B_(e,t){return e.direction===t?e:x_(z_(e.focus,t),z_(e.anchor,t))}function V_(e,t,n){let r=m_(e,`next`);for(let e=0;e<t;e++){let e=r.getAdjacentCaret();if(e===null)break;r=e}return z_(r,n)}function H_(e){let{origin:t,offset:n,direction:r}=e;if(n===f_(t,r))return e.getSiblingCaret();if(n===f_(t,t_(r)))return N_(e.getSiblingCaret());let[i]=t.splitText(n);return L(i)||j(281),z_(J(i,`next`),r)}function U_(e,t){return!0}function W_(e,{$copyElementNode:t=Dh,$splitTextPointCaretNext:n=H_,rootMode:r=`shadowRoot`,$shouldSplit:i=U_,removeEmptyDestination:a=!1}={}){if(a_(e))return n(e);let o=e.getParentCaret(r);if(o){let{origin:n}=o;if(s_(e)){let e=N_(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 G_(e,t,n){let r=z_(t,`next`);a_(r)&&(r.offset===0?r=J(r.origin,`previous`).getFlipped():r.offset===r.origin.getTextContentSize()&&(r=J(r.origin,`next`))),r.origin.is(e)&&(o_(r)||j(342,e.getKey(),e.getType()),r=N_(r)),(e.is(r.getNodeAtCaret())||e.is(r.getFlipped().getNodeAtCaret()))&&e.remove(!0);for(let e=r;e;e=W_(e,n))r=e;return a_(r)&&j(283),r.insert(e.isInline()?lm().append(e):e),z_(J(e.getLatest(),`next`),t.direction)}function K_(e){return e}function q_(e){return e}function J_(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function Y_(...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 X_(e,...t){let n=Y_(...t);n.length>0&&e.classList.add(...n)}function Z_(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function Q_(e){let t=rg().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function $_(e){return Q_(qp(e)?e:e.getParentOrThrow())}function ev(e,t,n=`self`){let r=e.getStartEndPoints();if(t.isSelected(e)&&!Mm(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]=Nf(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=fg(t)),t.__text=p)}}return t}function tv(e){let t=nv(e);return t!==null&&t.writingMode===`vertical-rl`}function nv(e){let t=e.anchor.getNode();return V(t)?Q_(t):$_(t)}function rv(e,t){let n=tv(e)?!t:t;av(e)&&(n=!n);let r=O_(e.focus,n?`previous`:`next`);if(R_(r))return!1;if(a_(r)&&!yf(r.origin)&&r.origin.isUnmergeable()){let e=r.getNodeAtCaret();if(L(e)&&!yf(e))return!0}for(let e of y_(r)){if(s_(e))return!e.origin.isInline();if(!V(e.origin)){if(H(e.origin))return!0;break}}return!1}function iv(e,t,n,r){e.modify(t?`extend`:`move`,n,r)}function av(e){let t=nv(e);return t!==null&&t.direction===`rtl`}function ov(e,t,n){let r=av(e),i;i=tv(e)||r?!n:n,iv(e,t,i,`character`)}function sv(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}let cv=Symbol.for(`preact-signals`);function lv(){if(pv>1)return void pv--;let e,t=!1;for(function(){let e=fv;for(fv=void 0;e!==void 0;)e.S.v===e.v&&(e.S.i=e.i),e=e.o}();uv!==void 0;){let n=uv;for(uv=void 0,mv++;n!==void 0;){let r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&vv(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(mv=0,pv--,t)throw e}let Y,uv;function dv(e){let t=Y;Y=void 0;try{return e()}finally{Y=t}}let fv,pv=0,mv=0,hv=0;function gv(e){if(Y===void 0)return;let t=e.n;return t===void 0||t.t!==Y?(t={i:0,S:e,p:Y.s,n:void 0,t:Y,e:void 0,x:void 0,r:t},Y.s!==void 0&&(Y.s.n=t),Y.s=t,e.n=t,32&Y.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=Y.s,t.n=void 0,Y.s.n=t,Y.s=t),t):void 0}function _v(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 vv(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 yv(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 bv(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 xv(e,t){_v.call(this,void 0),this.x=e,this.s=void 0,this.g=hv-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function Sv(e){let t=e.m;if(e.m=void 0,typeof t==`function`){pv++;let n=Y;Y=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,Cv(e),t}finally{Y=n,lv()}}}function Cv(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Sv(e)}function wv(e){if(Y!==this)throw Error(`Out-of-order effect`);bv(this),Y=e,this.f&=-2,8&this.f&&Cv(this),lv()}function Tv(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 Ev(e,t){let n=new Tv(e,t);try{n.c()}catch(e){throw n.d(),e}let r=n.d.bind(n);return r[Symbol.dispose]=r,r}_v.prototype.brand=cv,_v.prototype.h=function(){return!0},_v.prototype.S=function(e){let t=this.t;t!==e&&e.e===void 0&&(e.x=t,this.t=e,t===void 0?dv(()=>{var e;(e=this.W)==null||e.call(this)}):t.e=e)},_v.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&&dv(()=>{var e;(e=this.Z)==null||e.call(this)}))}},_v.prototype.subscribe=function(e){return Ev(()=>{let t=this.value,n=Y;Y=void 0;try{e(t)}finally{Y=n}},{name:`sub`})},_v.prototype.valueOf=function(){return this.value},_v.prototype.toString=function(){return this.value+``},_v.prototype.toJSON=function(){return this.value},_v.prototype.peek=function(){let e=Y;Y=void 0;try{return this.value}finally{Y=e}},Object.defineProperty(_v.prototype,"value",{get(){let e=gv(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(mv>100)throw Error(`Cycle detected`);(function(e){pv!==0&&mv===0&&e.l!==0&&(e.l=0,fv={S:e,v:e.v,i:e.i,o:fv})})(this),this.v=e,this.i++,hv++,pv++;try{for(let e=this.t;e!==void 0;e=e.x)e.t.N()}finally{lv()}}}}),xv.prototype=new _v,xv.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===hv))return!0;if(this.g=hv,this.f|=1,this.i>0&&!vv(this))return this.f&=-2,!0;let e=Y;try{yv(this),Y=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 Y=e,bv(this),this.f&=-2,!0},xv.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)}_v.prototype.S.call(this,e)},xv.prototype.U=function(e){if(this.t!==void 0&&(_v.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)}},xv.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(xv.prototype,"value",{get(){if(1&this.f)throw Error(`Cycle detected`);let e=gv(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Tv.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()}},Tv.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,Sv(this),yv(this),pv++;let e=Y;return Y=this,wv.bind(this,e)},Tv.prototype.N=function(){2&this.f||(this.f|=2,this.u=uv,uv=this)},Tv.prototype.d=function(){this.f|=8,1&this.f||Cv(this)},Tv.prototype.dispose=function(){this.d()};function Dv(e){return(typeof e.nodes==`function`?e.nodes():e.nodes)||[]}function X(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 Ov;try{Ov=`0.49.0+prod.esm`}catch{}let kv=Ov??`"<unknown>+source"`,Av=/* @__PURE__ */ new Set([`__proto__`,`constructor`,`prototype`]);function jv(e,t){if(e&&t&&!Array.isArray(t)&&typeof e==`object`&&typeof t==`object`){let n=e,r=t;for(let e in r)!Av.has(e)&&Object.prototype.hasOwnProperty.call(r,e)&&(n[e]=jv(n[e],r[e]));return e}return t}function Mv(e){return e.id===0}function Nv(e){return e.id===2}function Pv(e){return function(e){return e.id===1}(e)||X(305,String(e.id),`1`),Object.assign(e,{id:2})}let Fv=/* @__PURE__ */ new Set;var Iv=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):J_;for(let n of this.configs)e=t(e,n);return e}init(e){let t=this.state;Nv(t)||X(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&&X(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&&X(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&&X(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&&X(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&&X(311),this._signal}getInitResult(){this.extension.init===void 0&&X(312,this.extension.name);let e=this.state;return function(e){return e.id>=4}(e)||X(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)||X(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&&X(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){let t=this.builder.getExtensionRep(e);return t===void 0&&X(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){let e=this.state;return function(e){return e.id>=7}(e)||X(316,String(e.id),`7`),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||Fv}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)||X(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}};let Lv={tag:Gd};function Rv(){let e=W();e.isEmpty()&&e.append(lm())}let zv=/* @__PURE__ */ K_({config:/* @__PURE__ */ q_({setOptions:Lv,updateOptions:Lv}),init:({$initialEditorState:e=Rv})=>({$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(Zp(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:[Kp,of,em,_f,sm]}),Bv=Symbol.for(`@lexical/extension/LexicalBuilder`);function Vv(){}function Hv(e){throw e}function Uv(e){return Array.isArray(e)?e:[e]}let Wv=kv;var Gv=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=Wv,this.roots=e;for(let t of e)this.addExtension(t)}static fromExtensions(t){let n=[Uv(zv)];for(let e of t)n.push(Uv(e));return new e(n)}static maybeFromEditor(t){let n=t[Bv];return n&&(n.PACKAGE_VERSION!==Wv&&X(292,n.PACKAGE_VERSION,Wv),n instanceof e||X(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&X(294),n}constructEditor(){let{$initialEditorState:e,onError:t,onWarn:n,...r}=this.buildCreateEditorArgs(),i=Object.assign(hm({...r,...t?{onError:e=>{t(e,i)}}:{},...n?{onWarn:e=>{n(e,i)}}:{}}),{[Bv]:this});for(let e of this.sortedExtensionReps())e.build(i);return i}buildEditor(){let e=Vv;function t(){try{e()}finally{e=Vv}}let n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=Z_(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&&X(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&&X(296);let[t]=Uv(e);typeof t.name!=`string`&&X(297,typeof t.name);let n=this.extensionNameMap.get(t.name);if(n!==void 0&&n.extension!==t&&X(298,t.name),!n){n=new Iv(this,t),this.extensionNameMap.set(t.name,n);let e=this.conflicts.get(t.name);typeof e==`string`&&X(299,t.name,e);for(let e of t.conflictsWith||[])this.extensionNameMap.has(e)&&X(299,t.name,e),this.conflicts.set(e,t.name);for(let e of t.dependencies||[]){let n=Uv(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(Nv(i))return;let a=n.extension.name;var o;Mv(i)||X(300,a,r||`[unknown]`),Mv(o=i)||X(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=Pv(i),n.state=i,e.push(n)};for(let e of this.extensionNameMap.values())Mv(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&&X(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 Z_(...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 Dv(o)){if(typeof e!=`function`){let t=n.get(e.replace);t&&X(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&&jv(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||=Hv,e}};function Kv(e,t){let n=Gv.maybeFromEditor(e);if(!n)return;let r=n.extensionNameMap.get(t);return r?r.getExtensionDependency():void 0}var qv=class extends Gp{$config(){return this.config(`horizontalrule`,{importDOM:{hr:()=>({conversion:Jv,priority:0})}})}exportDOM(){return{element:Bh().createElement(`hr`)}}createDOM(e){let t=Bh().createElement(`hr`);return X_(t,e.theme.hr),t}getTextContent(){return`
|
|
153
|
+
`}isInline(){return!1}updateDOM(){return!1}};function Jv(){return{node:Yv()}}function Yv(){return Tg(qv)}Date.now;function Xv(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 Zv;function Qv(e,t){let{key:n}=t;return e&&n in e?e[n]:t.defaultValue}function $v(e){return Zv&&Zv.editor===e?Zv:void 0}function ey(e,t){if(`cfg`in t){let{cfg:n,updater:r}=t;return[n,r(Qv(e,n))]}return t}function ty(e,t){let n=t;for(let r of e){let[e,i]=ey(n,r),a=e.key;if(n===t&&Qv(n,e)===i)continue;let o=n===t||n===void 0?ny(t):n;o[a]=i,n=o}return n}function ny(e){return Object.create(e||null)}function ry(e,t){return[e,t]}function iy(e,t,n,r=rg()){let i=Zv,a=$v(r);try{return Zv={...a,editor:r,[e]:t},n()}finally{Zv=i}}function ay(e,t=()=>{}){return(n,r=rg())=>i=>{let a=$v(r),o=a&&a[e],s=ty(n,o||t(r));return s&&s!==o?iy(e,s,i,r):i()}}function oy(e,t,n,r){return Object.assign(fl(Symbol(t),{isEqual:r,parse:n}),{[e]:!0})}let sy=`@lexical/html/DOM`,cy=Symbol.for(`@lexical/html/DOMExportContext`);function ly(e,t,n){return oy(cy,e,t,n)}let uy=/* @__PURE__ */ ly(`isExport`,Boolean);function dy(e){let t=Kv(e,sy);return t?t.output.defaults:void 0}function fy(e){let t=Kv(e,sy);return t?t.output.runtime:void 0}function py(e=rg()){let t=fy(e);return t?t.getSessionConfig():ig(e)}let my=ay(cy,dy),hy=Symbol.for(`@lexical/html/SelectorImpl`);function gy(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=>gy(e,[...t,n]);return{[hy]:n,attr:(e,t,n)=>i(yy(e,t,n)),classAll:(...e)=>i(vy(e)),classAny:(...e)=>i(function(e){let t=_y(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)}}Xv(362,JSON.stringify(e))}(e,t,n))}}function _y(e){let t=[];for(let n of e)n&&t.push(n);return t}function vy(e){let t=_y(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 yy(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)}}Xv(361,JSON.stringify(e))}let by={kind:`text`,predicate:Nm,tags:/* @__PURE__ */ new Set},xy={[hy]:by},Sy={kind:`comment`,predicate:e=>e.nodeType===8,tags:/* @__PURE__ */ new Set},Cy={[hy]:Sy},wy={any:()=>gy(/* @__PURE__ */ new Set,[]),comment:()=>Cy,tag(...e){e.length>0||Xv(363);let t=/* @__PURE__ */ new Set;for(let n of e)t.add(n.toUpperCase());return gy(t,[])},text:()=>xy},Ty=wy;Ty.tag(`b`,`strong`,`em`,`i`,`code`,`mark`,`s`,`sub`,`sup`,`u`,`span`),Ty.text(),Ty.tag(`script`,`style`),Ty.tag(`br`),Ty.tag(`p`),Ty.tag(`hr`),Ty.any(),Object.freeze([]),Object.freeze({}),wy.any(),wy.any,wy.comment,wy.tag,wy.text;function Ey(e,t=null,n=rg()){return my([ry(uy,!0)],n)(()=>{let r=W(),i=py(n),a=R(t)?Fg(t.anchor.getNode()):null,o=e.append.bind(e);for(let e of(V(a)?a:r).getChildren())Oy(n,e,o,t,i);return e})}function Dy(e,t=null){return(typeof document>`u`||typeof window>`u`&&global.window===void 0)&&Xv(338),Ep(e),Ey(Bh().createElement(`div`),t,e).innerHTML}function Oy(e,t,n,r=null,i=ig(e)){let a=i.$shouldInclude(t,r,e),o=i.$shouldExclude(t,r,e),s=t;r!==null&&L(t)&&(s=ev(r,t,`clone`));let{element:c,after:l,append:u,$getChildNodes:d}=i.$exportDOM(s,e);if(!c)return!1;let f=Bh().createDocumentFragment(),p=d?d():V(s)?s.getChildren():[],m=a&&kf(r)&&V(t)?null:r,h=f.append.bind(f);for(let n of p){let o=Oy(e,n,h,m,i);!a&&o&&i.$extractWithChild(t,n,r,`html`,e)&&(a=!0)}if(a&&!o){if((q(c)||Zh(c))&&(u?u(f):c.append(f)),n(c),l){let e=l.call(s,c);e&&(Zh(c)?c.replaceChildren(e):c.replaceWith(e))}}else n(f);return a}function ky(e,t,n=null){let r=zh(n),i=n?Lh(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=gh(n)}return!1}(a.offsetNode,n))return{node:a.offsetNode,offset:a.offset}}if(a){let i=n.getRootNode();if(Fh(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 Ay(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 jy(e,t=z()){return t??Ay(166),R(t)&&t.isCollapsed()||t.getNodes().length===0?``:Dy(e,t)}function My(e,t){let n=e.getData(`text/plain`)||e.getData(`text/uri-list`);n!=null&&t.insertRawText(n)}let Ny=`application/x-lexical-drag`;function Py(e,t){let n={editorKey:t.getKey()};e.setData(Ny,JSON.stringify(n))}function Fy(e,t,n){let r=e.dataTransfer;if(r===null)return!1;let i=function(e){let t=e.getData(Ny);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=ky(e.clientX,e.clientY,t.getRootElement());if(n===null)return null;let r=Gm(n.node);if(r===null)return null;if(L(r))return d_(r,`next`,n.offset);if(V(r))return V_(r,n.offset,`next`);let i=r.getParent();return i===null?null:V_(i,r.getIndexWithinParent()+1,`next`)}(e,t);if(a===null)return!1;let o=W_(a);if(o===null)return!1;let s=i.editorKey===t.getKey(),c=z();if(s){if(!R(c)||c.isCollapsed())return!1;if(function(e,t){let{anchor:n,focus:r}=B_(M_(t),`next`);return C_(n,e)<0&&C_(e,r)<0}(a,c))return e.preventDefault(),!0;c.removeText()}if(!o.origin.isAttached())return e.preventDefault(),!0;if(n(r,A_(b_(o)),t),!s){let e=t.getRootElement(),n=e?e.ownerDocument:null,r=n?function(e,t){for(let n of Rh(t)){let t=Am(n);if(Om(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 Iy(e,t){return Fy(e,t,(e,t)=>My(e,t))}function Ly(e,t){t.update(()=>{if(e!==null){let n=sv(e,KeyboardEvent)?null:e.clipboardData,r=z();if(r!==null&&!r.isCollapsed()&&n!=null){e.preventDefault();let i=jy(t);i!==null&&n.setData(`text/html`,i),n.setData(`text/plain`,r.getTextContent())}}})}function Ry(e){return Z_(e.registerCommand(Tu,e=>{let t=z();return!!R(t)&&(t.deleteCharacter(e),!0)},0),e.registerCommand(ju,e=>{let t=z();return!!R(t)&&(t.deleteWord(e),!0)},0),e.registerCommand(Mu,e=>{let t=z();return!!R(t)&&(t.deleteLine(e),!0)},0),e.registerCommand(Ou,e=>{let t=z();if(!R(t))return!1;if(typeof e==`string`)t.insertText(e);else{let n=e.dataTransfer;if(n!=null)My(n,t);else{let n=e.data;n&&t.insertText(n)}}return!0},0),e.registerCommand(Au,()=>{let e=z();return!!R(e)&&(e.removeText(),!0)},0),e.registerCommand(Eu,e=>{let t=z();return!!R(t)&&(t.insertLineBreak(e),!0)},0),e.registerCommand(Du,()=>{let e=z();return!!R(e)&&(e.insertLineBreak(),!0)},0),e.registerCommand(zu,e=>{let t=z();if(!R(t))return!1;let n=e,r=n.shiftKey;return!!rv(t,!0)&&(n.preventDefault(),ov(t,r,!0),!0)},0),e.registerCommand(Lu,e=>{let t=z();if(!R(t))return!1;let n=e,r=n.shiftKey;return!!rv(t,!1)&&(n.preventDefault(),ov(t,r,!1),!0)},0),e.registerCommand(Gu,t=>!!R(z())&&(!Ec||!Tc)&&(t.preventDefault(),e.dispatchCommand(Tu,!0)),0),e.registerCommand(qu,t=>!!R(z())&&(t.preventDefault(),e.dispatchCommand(Tu,!1)),0),e.registerCommand(Uu,t=>{if(!R(z()))return!1;if(t!==null){if((Ec||Oc||jc)&&Tc)return!1;t.preventDefault()}return e.dispatchCommand(Eu,!1)},0),e.registerCommand(td,()=>{let e=z();return lh(R(e)&&Fg(e.anchor.getNode())!==null?e:null),!0},0),e.registerCommand($u,t=>!!R(z())&&(Ly(t,e),!0),0),e.registerCommand(ed,t=>!!R(z())&&(function(e,t){Ly(e,t),t.update(()=>{let e=z();R(e)&&e.removeText()},{tag:`cut`})}(t,e),!0),0),e.registerCommand(ku,t=>!!R(z())&&(function(e,t){e.preventDefault(),t.update(()=>{let t=z(),n=sv(e,ClipboardEvent)?e.clipboardData:null;n!=null&&R(t)&&My(n,t)},{tag:`paste`})}(t,e),!0),0),e.registerCommand(Yu,t=>Iy(t,e),0),e.registerCommand(Xu,t=>{let n=z();return!!R(n)&&(n.isCollapsed()||t.dataTransfer===null||Py(t.dataTransfer,e),!0)},0))}function zy(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(!(R(a)&&R(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||qp(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)&&L(r)&&r.__text.length===1&&a.anchor.offset===1?2:0}let c=s[0],l=e._nodeMap.get(c.__key);if(!L(l)||!L(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 By(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:zy(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!(R(a)&&R(o)&&a.anchor.type===`element`&&a.focus.type===`element`&&o.anchor.type===`text`&&o.focus.type===`text`||!L(r)||!L(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 Vy(e,t){e.undoStack=[],e.redoStack=[],e.current=null,t&&t(e)}function Hy(e,t,n,r=Date.now,i,a=null){let o=By(e,n,r),s=()=>{i&&i(t)};return s(),Z_(e.registerCommand(Pu,()=>(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(id,!0)),i.length===0&&e.dispatchCommand(ad,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(Fu,()=>(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(ad,!0));let o=r.pop();r.length===0&&e.dispatchCommand(id,!1),t.current=o||null,n&&n(t),o&&o.editor.setEditorState(o.editorState,{tag:`historic`})}}(e,t,i),!0),0),e.registerCommand(nd,()=>(Vy(t,i),!1),0),e.registerCommand(rd,()=>(Vy(t,i),e.dispatchCommand(id,!1),e.dispatchCommand(ad,!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(id,!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(ad,!0)}}else if(m===2)return;t.current={editor:e,editorState:n},s()}))}function Uy(){return{current:null,redoStack:[],undoStack:[]}}Date.now;let Wy=`application/x-codexhost-thread-reference`;function Gy(e){if(!(e.blank||e.projectionValues?.threadReference?.hostId!==`local`))return{threadId:e.id,hostId:`local`,title:e.title?.replace(/[\s\u0000-\u001f\u007f]+/gu,` `).trim()||e.id.slice(0,8)}}function Ky(e){return`thread://${encodeURIComponent(e.threadId).replace(/[!'()*]/gu,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}?hostId=local`}function qy(e){let t=`[@${e.title.replace(/[\\`*{}[\]()#+.!_<>|~-]/gu,e=>`\\${e}`)}](${Ky(e)})`;return{source:`codexhost-thread`,ref:t,label:e.title,appearance:`session`,clipboardText:t}}function Jy(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||r!==`local`||typeof i!=`string`?void 0:Gy({id:n,blank:!1,title:i,projectionValues:{threadReference:{hostId:r}}})}catch{return}}function Yy(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=Yy(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Xy(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Yy(e))&&(r&&(r+=` `),r+=t);return r}let Zy=`@deepseek-ai/dsh-client-ui-conversation/ReferenceChip.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Zy)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=Zy,e.textContent=`.HsYvBG_chip{max-width:240px;color:var(--dsw-alias-state-business-primary);user-select:none;align-items:baseline;gap:3px;display:inline-flex}.HsYvBG_marker{flex:none;font-weight:500}.HsYvBG_icon{flex:none;align-self:center}.HsYvBG_label{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.HsYvBG_invalid{color:var(--dsw-alias-state-error-primary);opacity:.7;text-decoration:line-through}`,document.head.appendChild(e)}var Qy={chip:`HsYvBG_chip`,icon:`HsYvBG_icon`,invalid:`HsYvBG_invalid`,label:`HsYvBG_label`,marker:`HsYvBG_marker`};let $y=`@deepseek-ai/dsh-client-ui-conversation/composer-editor.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify($y)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=$y,e.textContent=`._06X5vW_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}._06X5vW_reference:hover{background:var(--dsw-alias-state-business-tertiary)}._06X5vW_openable{cursor:pointer}._06X5vW_textRef{max-width:100%;display:inline-block}`,document.head.appendChild(e)}var eb={openable:`_06X5vW_openable`,reference:`_06X5vW_reference`,textRef:`_06X5vW_textRef`};function tb({label:e,reference:t,appearance:n,invalid:r}){return/* @__PURE__ */ (0,h.jsxs)(`span`,{className:Xy(eb.reference,Qy.chip,n===`file`&&!r&&eb.openable,r&&Qy.invalid),title:e,children:[n===void 0?/* @__PURE__ */ (0,h.jsx)(`span`,{className:Qy.marker,"aria-hidden":!0,children:`@`}):/* @__PURE__ */ (0,h.jsx)(d.ReferenceIconRegular,{kind:n,reference:t,size:14,className:Qy.icon}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Qy.label,children:e})]})}var nb=class e extends Gp{__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)(tb,{label:this.__label,reference:this.__ref,appearance:this.__appearance,invalid:this.__invalid})}};function rb(e){return new nb(e)}function ib(e){return e instanceof nb}function ab(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 ob(e,t,n,r){let i=e=>e instanceof n,a=e=>{let t=hf(e.getTextContent());t.setFormat(e.getFormat()),e.replace(t)};return[e.registerNodeTransform(of,e=>{if(!e.isSimpleText())return;let n,o=e.getPreviousSibling(),s=e.getTextContent(),c=e;if(L(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(L(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&&L(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&&ab(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();L(o)&&o.isTextEntity()&&(a(o),a(e));let s=e.getNextSibling();L(s)&&s.isTextEntity()&&(a(s),i(e)&&a(e))})]}let sb=/(^|\s)([/@])([\w-]+)/g,cb=/(^|\s)(@(?:"[^"\n]*"?|[^\s"]\S*))/g,lb=/* @__PURE__ */ new Set(`.,;:!?,。;:!?`),ub=/^@.*[/\\.]/u;function db(e,t,n){if(!n.startsWith(`@"`)){let e=n.length;for(;lb.has(n.charAt(e-1));)--e;return ub.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(;lb.has(e.charAt(i));)i+=1;return i===e.length||/\s/u.test(e.charAt(i))?t+r+1:void 0}let fb=/^(?:\s|$)/;function pb(e,t){if(e===``)return[];let n=[];sb.lastIndex=0;let r;for(;(r=sb.exec(e))!==null;){let i=r[2],a=r[3]??``;if((i!==`/`||fb.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})}}cb.lastIndex=0;let i;for(;(i=cb.exec(e))!==null;){let t=i.index+(i[1]?.length??0),r=db(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 mb=class e extends of{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=Xy(t.className,eb.reference,eb.textRef,this.getTextContent().startsWith(`/`)&&eb.openable),t.setAttribute(`spellcheck`,`false`),t.setAttribute(`data-composer-text-ref`,``),t}isTextEntity(){return!0}canInsertTextBefore(){return!0}};function hb(e,t,n){return Z_(...ob(e,e=>{let r=n();for(let n of pb(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},mb,e=>new mb(e.getTextContent())))}function gb(e){e.update(()=>{for(let e of W().getAllTextNodes())e.markDirty()},{tag:Gd})}function _b(e,t){return e.registerCommand(bu,e=>{if(e.target===null||e.button!==0||e.detail>1)return!1;let n=z();if(R(n)&&!n.isCollapsed())return!1;let r=Gm(e.target);if(ib(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 mb&&t(void 0,{ref:r.getTextContent()})},1)}let vb=`color: var(--dsw-alias-state-business-primary)`;function yb(){let e=W().getFirstChild();if(!V(e))return null;let t=e.getFirstChild();return L(t)?t:null}function bb(e,t){return e.registerNodeTransform(of,e=>{let n=yb();if(n===null||e.getKey()!==n.getKey()){e.getStyle()===vb&&e.setStyle(``);return}let r=e.getTextContent(),i=t(),a=r===i?.trimEnd()?r:i;if(a===null||!r.startsWith(a))e.getStyle()===vb&&e.setStyle(``);else if(r.length>a.length){let[t,n]=e.splitText(a.length);t!==void 0&&t.getStyle()!==vb&&t.setStyle(vb),n?.setStyle(``)}else e.getStyle()!==vb&&e.setStyle(vb)})}function xb(e){e.update(()=>{yb()?.markDirty()})}function Sb(){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(ib(e))o(`chip`,e,``,e.getTextContent());else if(L(e)){let t=e.getTextContent();o(`text`,e,t,t)}else rm(e)?o(`linebreak`,e,`
|
|
154
154
|
`,`
|
|
155
|
-
`):
|
|
155
|
+
`):V(e)&&
|
|
156
156
|
/* v8 ignore next 4 -- plain-text composition nests no block elements today; the walk stays total for imported states. */
|
|
157
|
-
s(e);r.set(e.getKey(),{start:t,end:i.length})},c=
|
|
157
|
+
s(e);r.set(e.getKey(),{start:t,end:i.length})},c=W(),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+=`
|
|
158
158
|
`,a+=`
|
|
159
|
-
`),
|
|
159
|
+
`),V(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 Cb(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 wb(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 Tb(e){let t=Sb(),n=[];for(let r of t.segments){if(r.kind!==`chip`||!ib(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=z(),i=null;if(R(r)){let e=wb(t,r.anchor),n=wb(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 Eb(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`}}
|
|
160
160
|
/* v8 ignore next -- non-gap segments always carry their node. */
|
|
161
|
-
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=
|
|
161
|
+
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=W().getChildren(),r=n[n.length-1];return r===void 0?{key:W().getKey(),offset:0,type:`element`}:{key:r.getKey(),offset:e.children.get(r.getKey())?.length??0,type:`element`}}function Db(e,t){if(t.start<0||t.start>t.end||t.end>e.detectLength)return null;let n=Eb(e,t.start),r=Eb(e,t.end);
|
|
162
162
|
/* v8 ignore next -- bounds were checked above; resolvePoint only fails out of bounds. */
|
|
163
|
-
if(n===null||r===null)return null;let i=
|
|
164
|
-
`)){let t=
|
|
165
|
-
`);for(let e=0;e<t.length;e+=1){let i=t[e];i!==``&&r.append(mf(i)),e<t.length-1&&(r=cm(),n.append(r))}},a=0;for(let n of t)i(e.slice(a,n.offset)),r.append(new tb({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:Wd})}clearHistory(){this.editor.dispatchCommand(nd,void 0)}};function jb(e){switch(e){case`plain`:return`plain`;case`claimed`:return`claimed`;default:return`frozen`}}function Mb(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 Nb=[],Pb=/* @__PURE__ */ new Map;var Fb=class{deps;state;notices=(0,f.createSnapshotStore)(null);get editor(){return this.draftEditor.editor}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)},submit:()=>{this.submit(`queue`)}};primaryAction;core=new vc;draftEditor;get projection(){return this.draftEditor.projection}rev=0;unregister;noticeSeq=0;lastPublishedDraft;draftSnapshotCache;attachmentIds=[];disposed=!1;persistDraft;filePicker;detachedDrafts=/* @__PURE__ */ new Map;failedDetached=/* @__PURE__ */ new Map;failedRestoreRev;restoringFailures=!1;attachmentFlightSeq=0;attachmentFlights=/* @__PURE__ */ new Map;unsubscribeInbox;constructor(e){this.deps=e,this.draftEditor=new Ab({onUpdate:()=>{this.onEditorUpdate()},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(){Mb(this.draftEditor.refreshProjection(),this.projection)&&(this.rev+=1,!this.restoringFailures&&this.failedRestoreRev!==void 0&&(this.failedDetached.clear(),this.failedRestoreRev=void 0),this.dispatchRun({type:`draft-changed`,draft:this.projection.clipboardText}));let e=this.projection.caret;e!==null&&this.deps.inputTriggers?.()?.track(this.projection.detectText,e,{tier:jb(this.core.state.phase)},this.rev)}setDraft(e){let t=Js(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=Xs(this.projection.clipboardText,this.projection.occurrences);return this.draftSnapshotCache={revision:this.rev,value:e},e}persistCurrentDraft(){this.persistDraft?.(this.draftSnapshot)}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}addAttachments(e){return 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())}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))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){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,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))}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()??Pb,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(){this.editor.getRootElement()?.focus({preventScroll:!0}),this.editor.focus()}dispose(){if(this.disposed)return[];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.attachmentFlights.clear(),[...e]}get snapshot(){return this.state.getSnapshot()}bindDraftPersistence(e){return this.persistDraft=e,()=>{this.persistDraft===e&&(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()}sinkSerialized(e,t,n){this.notifySubmission(e.submission);let r=[...this.attachmentIds];this.attachmentIds=[];let i=this.projection.occurrences,a={draft:t,occurrences:i,attachmentIds:r};if(this.detachedDrafts.set(e.seq,a),this.failedRestoreRev===this.rev&&(this.failedDetached.clear(),this.failedRestoreRev=void 0),i.length===0){this.settleSink(e,this.deps.defaultSink(t.trim(),r,n,e.signal));return}let o=this.deps.inputTriggers?.();Promise.all(i.map(async t=>{if(o===void 0)throw Error(`no serializer for reference source "${t.source}"`);return{offset:t.offset,length:t.length,text:await o.serializeReference(t.source,t.ref,e.signal)}})).then(i=>{if(this.disposed)return;let a=``,o=0;for(let e of i)a+=t.slice(o,e.offset)+e.text,o=e.offset+e.length;a+=t.slice(o),this.settleSink(e,this.deps.defaultSink(a.trim(),r,n,e.signal))},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){let n=this.detachedDrafts.get(e.seq);n!==void 0&&(this.detachedDrafts.delete(e.seq),this.restoreAttachments(n.attachmentIds),this.failedDetached.set(e.seq,n),(this.projection.clipboardText===``||this.failedRestoreRev===this.rev)&&this.restoreFailedDrafts(),this.dispatchRun({type:`sink-settled`,attempt:e,ok:!1,...t===void 0?{}:{message:t}}))}restoreFailedDrafts(){let e=[...this.failedDetached.entries()].sort(([e],[t])=>e-t).map(([,e])=>e);if(e.length===0)return;let t=``,n=[];for(let r of e){let e=t.length+(t===``?0:2);t!==``&&(t+=`
|
|
163
|
+
if(n===null||r===null)return null;let i=Yf();return i.anchor.set(n.key,n.offset,n.type),i.focus.set(r.key,r.offset,r.type),Jm(i),i}function Ob(e,t){let n=Db(Sb(),e);return n!==null&&(t===``&&!n.isCollapsed()?n.removeText():n.insertText(t),!0)}function kb(e,t){let n=Db(Sb(),e);return n!==null&&(n.insertNodes([...t]),!0)}let Ab=/[\uE100-\uE11D\uFFFC]/gu;var jb=class{deps;editor;projected={detectText:``,clipboardText:``,occurrences:[],selection:null,caret:null};occurrenceIds=/* @__PURE__ */ new Map;occurrenceSeq=0;lexiconOff;lexiconSource;constructor(e){this.deps=e,this.editor=hm({namespace:`dsh-composer`,nodes:[nb,mb],onError:e=>{throw e}})}register(){let e=()=>{let e=this.editor.getRootElement();return e!==null&&!e.contains(e.ownerDocument.activeElement)&&vh(`skip-dom-selection`),!1},t=Z_(Ry(this.editor),this.editor.registerCommand(Zu,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(Yu,e=>{if(!this.editor.isEditable()||!e.dataTransfer||e.dataTransfer.types.includes(`Files`))return!1;let t=Jy(e.dataTransfer.getData(Wy));return t!==void 0&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,this.insertFileReferences([qy(t)]))},4),this.editor.registerCommand(sd,()=>(this.editor.update(e,{discrete:!0}),!1),4),this.editor.registerCommand(yu,e,4),this.editor.registerNodeTransform(Kp,e),_b(this.editor,(e,t)=>this.deps.openReference(e,t)),Hy(this.editor,Uy(),1e3),this.editor.registerUpdateListener(()=>{this.deps.onUpdate()}),bb(this.editor,()=>this.deps.activeClaimToken()),hb(this.editor,()=>this.deps.lexicon(),()=>this.deps.activeClaimToken()),()=>{this.lexiconOff?.(),this.lexiconOff=void 0,this.lexiconSource=void 0});return()=>{t(),this.editor.setRootElement(null)}}get projection(){return this.projected}applyEdit(e,t){this.editor._updating?(t!==void 0&&vh(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(()=>{gb(this.editor)}),gb(this.editor))}refreshProjection(){let e=this.projected;return this.projected=this.editor.getEditorState().read(()=>Tb(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(Ab,``);(t!==this.projection.clipboardText||this.projection.occurrences.length!==0)&&this.editor.update(()=>{let e=W();e.clear();for(let n of t.split(`
|
|
164
|
+
`)){let t=lm();n!==``&&t.append(hf(n)),e.append(t)}e.selectEnd()},{discrete:!0,tag:Gd})}paste(e){let t=e.replace(Ab,``);t!==``&&this.applyEdit(()=>{let e=z();if(R(e)){e.insertText(t);return}let n=W();n.getChildrenSize()===0&&n.append(lm()),n.selectEnd().insertText(t)},Kd)}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=Ob(e,t)}),n}insertAsyncText(e,t){let n=!1,r=t.replace(Ab,``);return this.applyEdit(()=>{n=Ob(e,r)},Kd),n}insertReference(e,t,n){let r=!1;return this.applyEdit(()=>{r=kb(e,n===` `?[rb(t)]:[rb(t),hf(` `)])}),r}insertFileReferences(e){if(e.length===0)return!0;let t=!1;return this.applyEdit(()=>{let n=Tb(e=>this.occurrenceIdOf(e)),r=n.selection?.end??n.detectText.length,i=n.detectText.slice(0,r),a=e.flatMap(e=>[rb(e),hf(` `)]);i!==``&&!/\s$/u.test(i)&&a.unshift(hf(` `)),t=kb({start:r,end:r},a)},Kd),t}refreshClaimDecoration(){xb(this.editor)}clearCommittedDraft(e){this.editor.update(()=>{let t=Sb(),n=e(t.clipboardText);if(n!==null){Ob({start:0,end:Cb(t,n)},``);return}let r=W();r.clear(),r.selectEnd()},{discrete:!0,tag:Gd})}restoreDraft(e,t){this.editor.update(()=>{let n=W();n.clear();let r=lm();n.append(r);let i=e=>{let t=e.replace(Ab,``).split(`
|
|
165
|
+
`);for(let e=0;e<t.length;e+=1){let i=t[e];i!==``&&r.append(hf(i)),e<t.length-1&&(r=lm(),n.append(r))}},a=0;for(let n of t)i(e.slice(a,n.offset)),r.append(new nb({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:Gd})}clearHistory(){this.editor.dispatchCommand(rd,void 0)}};function Mb(e){switch(e){case`plain`:return`plain`;case`claimed`:return`claimed`;default:return`frozen`}}function Nb(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 Pb=[],Fb=/* @__PURE__ */ new Map;var Ib=class{deps;state;notices=(0,f.createSnapshotStore)(null);get editor(){return this.draftEditor.editor}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)},submit:()=>{this.submit(`queue`)}};primaryAction;core=new yc;draftEditor;get projection(){return this.draftEditor.projection}rev=0;unregister;noticeSeq=0;lastPublishedDraft;draftSnapshotCache;attachmentIds=[];disposed=!1;persistDraft;filePicker;detachedDrafts=/* @__PURE__ */ new Map;failedDetached=/* @__PURE__ */ new Map;failedRestoreRev;restoringFailures=!1;attachmentFlightSeq=0;attachmentFlights=/* @__PURE__ */ new Map;unsubscribeInbox;constructor(e){this.deps=e,this.draftEditor=new jb({onUpdate:()=>{this.onEditorUpdate()},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(){Nb(this.draftEditor.refreshProjection(),this.projection)&&(this.rev+=1,!this.restoringFailures&&this.failedRestoreRev!==void 0&&(this.failedDetached.clear(),this.failedRestoreRev=void 0),this.dispatchRun({type:`draft-changed`,draft:this.projection.clipboardText}));let e=this.projection.caret;e!==null&&this.deps.inputTriggers?.()?.track(this.projection.detectText,e,{tier:Mb(this.core.state.phase)},this.rev)}setDraft(e){let t=Ys(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=Zs(this.projection.clipboardText,this.projection.occurrences);return this.draftSnapshotCache={revision:this.rev,value:e},e}persistCurrentDraft(){this.persistDraft?.(this.draftSnapshot)}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}addAttachments(e){return 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())}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))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){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,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))}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()??Fb,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(){this.editor.getRootElement()?.focus({preventScroll:!0}),this.editor.focus()}dispose(){if(this.disposed)return[];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.attachmentFlights.clear(),[...e]}get snapshot(){return this.state.getSnapshot()}bindDraftPersistence(e){return this.persistDraft=e,()=>{this.persistDraft===e&&(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()}sinkSerialized(e,t,n){this.notifySubmission(e.submission);let r=[...this.attachmentIds];this.attachmentIds=[];let i=this.projection.occurrences,a={draft:t,occurrences:i,attachmentIds:r};if(this.detachedDrafts.set(e.seq,a),this.failedRestoreRev===this.rev&&(this.failedDetached.clear(),this.failedRestoreRev=void 0),i.length===0){this.settleSink(e,this.deps.defaultSink(t.trim(),r,n,e.signal));return}let o=this.deps.inputTriggers?.();Promise.all(i.map(async t=>{if(o===void 0)throw Error(`no serializer for reference source "${t.source}"`);return{offset:t.offset,length:t.length,text:await o.serializeReference(t.source,t.ref,e.signal)}})).then(i=>{if(this.disposed)return;let a=``,o=0;for(let e of i)a+=t.slice(o,e.offset)+e.text,o=e.offset+e.length;a+=t.slice(o),this.settleSink(e,this.deps.defaultSink(a.trim(),r,n,e.signal))},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){let n=this.detachedDrafts.get(e.seq);n!==void 0&&(this.detachedDrafts.delete(e.seq),this.restoreAttachments(n.attachmentIds),this.failedDetached.set(e.seq,n),(this.projection.clipboardText===``||this.failedRestoreRev===this.rev)&&this.restoreFailedDrafts(),this.dispatchRun({type:`sink-settled`,attempt:e,ok:!1,...t===void 0?{}:{message:t}}))}restoreFailedDrafts(){let e=[...this.failedDetached.entries()].sort(([e],[t])=>e-t).map(([,e])=>e);if(e.length===0)return;let t=``,n=[];for(let r of e){let e=t.length+(t===``?0:2);t!==``&&(t+=`
|
|
166
166
|
|
|
167
|
-
`),t+=r.draft;for(let t of r.occurrences)n.push({...t,offset:e+t.offset})}this.restoringFailures=!0;try{this.draftEditor.restoreDraft(t,n),this.draftEditor.clearHistory(),this.failedRestoreRev=this.rev}finally{this.restoringFailures=!1}}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}):n.adjudicate(t.trim(),e.signal,{attachments:this.attachmentIds.length}).then(t=>{this.dead(e)||this.dispatchRun({type:`adjudicated`,attempt:e,outcome:t})},t=>{if(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,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`]??Nb}}publish(){let e=this.compose();this.state.set(e);let t=this.draftSnapshot;t!==this.lastPublishedDraft&&(this.lastPublishedDraft=t,this.persistDraft?.(t))}};function Ib(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 Lb=class{rootCtx;t;shells=/* @__PURE__ */ new WeakMap;constructor(e,t){this.rootCtx=e,this.t=t}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)}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)}shellFor(e){let t=this.shells.get(e);if(t!==void 0)return t;let{session:n,ctx:r}=e,i=new Fb({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=>{Ib(this.rootCtx,e)},inputTriggers:()=>this.controller(r),popup:()=>this.popup(r),inbox:n.projections.faceOf(`inbox`),defaultSink:(e,t,r,i)=>this.sink(n,e,t,r,i),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(ec(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){return t===``&&n.length===0?Promise.resolve({kind:`success`}):this.conversation().sendSession(e,t,n,r,i)}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 Rb=`busyEnter`,zb=[`queue`,`steer`],Bb=`queue`,Vb={[Rb]:T.union([...zb]).default(Bb)};T.object(Vb);function Hb(e,t,n,r){return!t||!r?`queue`:n===`enter`?e:e===`queue`?`steer`:`queue`}var Ub=class{busyEnter=(0,f.createSnapshotStore)(Bb);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(Rb,e))}adopt(e){let t=e.getSnapshot().value;t!==void 0&&this.busyEnter.getSnapshot()!==t.busyEnter&&this.busyEnter.set(t.busyEnter)}};let Wb=`conversation`,Gb=`描述你的任务以生成计划`,Kb=`describe your task to generate plan`,qb={"shortcut.newline":`换行`,"shortcut.complementary":`使用互补的 Queue/Steer 方式`,"shortcut.slash":`打开命令菜单`,"shortcut.mention":`打开引用菜单`,"hint.plan":Gb,"hint.goal":`输入目标,智能体将持续执行`,"hint.goal.active":`当前目标进行中。可输入 edit 修改 / pause 暂停 / resume 继续 / clear 清除`,"placeholder.plan":Gb,"placeholder.default":`发消息或创建任务, / 调用指令, @ 文件或对话`,"placeholder.unavailable":`会话不可用`,"placeholder.parentOffline":`父会话已离线,无法继续发送;仍可停止当前运行`,"placeholder.hero":`描述你想要构建的内容, / 调用指令, @ 文件或对话`,"placeholder.workspace":`选择一个工作区开始`,"placeholder.preparing":`正在准备对话…`,"placeholder.steerQueue":`Cmd/Ctrl+Enter 插话发送全部排队消息`,"input.commands":`添加文件或调用指令`,"input.commandsOnly":`调用指令`,"input.imagesAndCommands":`添加图片或调用指令`,"attachment.unavailable":`当前 Web 连接不支持附件上传。`,"input.file":`文件`,"input.stop":`停止生成`,"input.send":`发送消息`,"input.send.queue":`排队发送`,"input.send.steer":`插话发送`,"attachment.pending":`待发送附件`,"attachment.scrollLeft":`向左滚动附件`,"attachment.scrollRight":`向右滚动附件`,"reference.dropTitle":`松开以引用聊天`,"attachment.dropTitle":`文件或图片拖动到此处即可添加`,"attachment.dropDesc":`图片限制:最多 {count} 张,每张 {size}`,"attachment.dropBlocked":`当前无法添加文件或图片`,"attachment.directoryDesktopOnly":`只有桌面端支持添加文件夹,浏览器里请添加单个文件`,"attachment.pathUnavailable":`无法获取文件夹路径,请重新拖入`,"attachment.pathUnsupported":`路径含有无法引用的字符,请改名后再试`,"image.pending":`待发送图片`,"image.openOriginal":`查看原图`,"image.openOriginalLabel":`{label},点击查看原图`,"image.remove":`移除图片 {name}`,"image.original":`原图`,"image.label":`图片`,"image.loadFailed":`图片不可用,点击重试`,"image.loading":`图片加载中…`,"image.preview":`原图预览`,"image.closePreview":`关闭原图预览`,"image.unsupportedType":`仅支持 PNG、JPG、WebP、GIF 格式的图片`,"image.tooMany":`一条消息最多添加 {count} 张图片`,"image.fileTooLarge":`单张图片不能超过 {size}`,"image.totalTooLarge":`图片总大小超过 {size},请移除部分图片`,"image.tooManyPixels":`图片分辨率过大,请压缩后重试`,"image.dimensionTooLarge":`图片宽高不能超过 {size}px,请缩小后重试`,"image.modelUnsupported":`当前模型不支持图片,请切换支持图片的模型`,"image.sendFailed":`图片发送失败({reason}),请重新添加图片后再试`,"file.unavailable":`已上传文件不可用或被修改,请重新选择`,"file.pending":`待发送文件`,"file.remove":`移除文件 {name}`,"file.uploading":`上传中…`,"file.uploadFailed":`上传失败,点击重试`,"file.retry":`重试上传 {name}`,"file.stillUploading":`文件还在上传,请等待上传完成后发送`,"file.sessionUnavailable":`会话不可用,无法上传文件`,"file.notStaged":`文件尚未上传成功,请重新添加后再试`,"file.label":`文件`,"context.aria":`上下文已用 {percent}`,"context.used":`上下文已用`,"context.system":`系统提示词`,"context.tools":`工具定义`,"context.messages":`对话消息`,"settings.enter.title":`繁忙时的发送行为`,"settings.enter.description":`智能体运行时 Enter 键和发送按钮的行为;Cmd/Ctrl+Enter 使用另一行为`,"settings.enter.queue":`排队发送`,"settings.enter.steer":`插话发送`,"hero.headline":`今天想做点什么?`,"hero.preview":`Web`,"hero.chooseWorkspace":`选择工作区`,"hero.noWorkspace":`不选择工作区`,"session.hierarchy":`会话层级`,"todo.title":`任务`,"todo.progress.done":`{done} 已完成`,"todo.progress.active":`{active} 进行中`,"todo.progress.pending":`{pending} 待处理`,"todo.status.completed":`已完成`,"todo.status.inProgress":`进行中`,"todo.status.pending":`待处理`,"todo.rowTitle":`更新任务清单`,"tool.title.createGoal":`创建目标`,"tool.title.getGoal":`查看目标`,"tool.title.updateGoal":`更新目标`,"tool.preparing.content":`{kilobytes}KB`,"tool.title.createSchedule":`创建定时任务`,"tool.title.listSchedules":`查看定时任务`,"tool.title.deleteSchedule":`删除定时任务`,"tool.title.updateSchedule":`修改定时任务`,"detail.state":`状态`,"detail.todo.completed":`已完成`,"detail.todo.in_progress":`进行中`,"detail.todo.pending":`待处理`,"detail.todo.empty":`任务清单为空`,"todo.diff.initial":`首次记录`,"todo.diff.compare":`与上次清单相比`,"todo.diff.unavailable":`旧清单不可用`,"todo.diff.noChanges":`清单没有变化`,"todo.diff.added":`新增 {count}`,"todo.diff.updated":`更新 {count}`,"todo.diff.removed":`移除 {count}`,"todo.diff.unchanged":`{count} 项未变化`,"todo.diff.addedItem":`新增`,"todo.diff.updatedItem":`状态变化`,"todo.diff.movedItem":`顺序调整`,"todo.diff.removedItem":`移除`,"detail.goal.empty":`没有目标`,"detail.goal.active":`进行中`,"detail.goal.disarmed":`等待继续`,"detail.goal.paused":`已暂停`,"detail.goal.blocked":`受阻`,"detail.goal.complete":`已完成`,"detail.goal.rounds":`执行轮次`,"detail.goal.reason":`受阻原因`,"detail.days":`{count} 天`,"detail.hours":`{count} 小时`,"detail.minutes":`{count} 分钟`,"detail.seconds":`{count} 秒`,"detail.schedule.once":`单次`,"detail.schedule.every":`每 {interval}`,"detail.schedule.when":`计划时间`,"detail.schedule.frequency":`重复`,"detail.schedule.scheduled":`等待触发`,"detail.schedule.overdue":`已到期,等待会话恢复`,"detail.schedule.empty":`没有定时任务`,"detail.schedule.deleted":`已删除`,"detail.schedule.count":`{count} 个定时任务`,"detail.schedule.daily":`每天 {time}({zone})`,"detail.schedule.weekly":`每周 {days} {time}({zone})`,"detail.schedule.cron":`Cron {expression}({zone})`,"detail.weekday.1":`周一`,"detail.weekday.2":`周二`,"detail.weekday.3":`周三`,"detail.weekday.4":`周四`,"detail.weekday.5":`周五`,"detail.weekday.6":`周六`,"detail.weekday.7":`周日`,"detail.weekday.join":`、`,"tool.title.inspectProviders":`检查提供方`,"tool.title.queryRuntime":`查询运行时`,"tool.title.inspectPlugins":`检查动态插件`,"tool.title.workflow":`运行工作流`,"tool.title.ralph":`运行循环工作流`,"tool.title.readEvent":`读取事件`,"tool.title.searchEvents":`搜索事件`,"tool.title.traceEvent":`追踪事件`,"tool.title.searchSessions":`搜索会话`,"tool.title.traceSession":`追踪会话`,"tool.title.listModels":`查看可用模型`,"tool.title.subagent":`创建子智能体`,"tool.title.listAgents":`查看子智能体`,"tool.title.sendMessage":`发送消息`,"tool.title.interruptAgent":`中断智能体`,"tool.title.listJobs":`查看后台任务`,"tool.title.readJob":`读取任务输出`,"tool.title.killJob":`取消后台任务`,"tool.title.openTerminal":`创建终端`,"tool.title.readTerminal":`读取终端`,"tool.title.listTerminals":`查看终端`,"tool.title.signalTerminal":`发送终端信号`,"tool.title.closeTerminal":`关闭终端`,"tool.title.lsp":`查询代码符号`,"tool.title.findDefinition":`查找定义`,"tool.title.findReferences":`查找引用`,"tool.title.findImplementation":`查找实现`,"tool.title.hoverSymbol":`查看符号信息`,"tool.title.spawnTeammate":`创建队友`,"tool.title.createTeamTask":`创建团队任务`,"tool.title.getTeamTask":`读取团队任务`,"tool.title.updateTeamTask":`更新团队任务`,"tool.title.listTeamTasks":`查看团队任务`,"tool.title.waitAgent":`等待子智能体`,"detail.recordedResult":`调用结果`,"detail.empty":`暂无结果`,"detail.none":`无`,"detail.yes":`是`,"detail.no":`否`,"detail.moreInInspect":`另有 {count} 项,可在「查看」中读取`,"detail.status.running":`运行中`,"detail.status.idle":`空闲`,"detail.status.ready":`就绪`,"detail.status.inactive":`未运行`,"detail.status.provisioning":`准备中`,"detail.status.failed":`失败`,"detail.status.completed":`已完成`,"detail.status.deleted":`已删除`,"detail.status.killed":`已取消`,"detail.status.accepted":`已接收`,"detail.status.queued":`已入队`,"detail.status.exited":`已退出`,"detail.field.id":`ID`,"detail.field.revision":`版本`,"detail.field.platform":`平台`,"detail.field.provider":`提供方`,"detail.field.model":`模型`,"detail.field.role":`角色`,"detail.field.context":`上下文`,"detail.field.owner":`负责人`,"detail.field.ready":`可开始`,"detail.field.dependencies":`前置任务`,"detail.field.writeScopes":`文件范围`,"detail.field.warnings":`提示`,"detail.field.diagnostics":`诊断`,"detail.field.methods":`方法`,"detail.field.inputSchema":`输入 Schema`,"detail.field.outputSchema":`输出 Schema`,"detail.field.currentPackage":`当前包`,"detail.field.nextPackage":`待运行的包`,"detail.field.latestRun":`最近运行`,"detail.field.packages":`版本包`,"detail.field.registrations":`注册项`,"detail.field.props":`属性`,"detail.field.data":`数据`,"detail.field.source":`来源`,"detail.field.content":`内容`,"detail.field.message":`消息`,"detail.field.messageId":`消息 ID`,"detail.field.root":`根节点`,"detail.field.pid":`进程 ID`,"detail.field.type":`类型`,"detail.field.time":`时间`,"detail.field.seq":`事件序号`,"detail.field.turn":`轮次`,"detail.field.step":`步骤`,"detail.field.callId":`调用 ID`,"detail.field.agents":`启动智能体数`,"detail.field.result":`结果`,"detail.field.parent":`父级`,"detail.field.depth":`层级`,"detail.field.exitCode":`退出码`,"detail.field.signal":`信号`,"detail.field.previousStatus":`中断前状态`,"detail.field.agent":`智能体 ID`,"detail.field.job":`任务 ID`,"detail.field.task":`任务内容`,"detail.field.processGroup":`进程组`,"detail.field.availability":`可用状态`,"detail.field.bestMatch":`最相关事件`,"detail.field.target":`目标事件`,"detail.field.surface":`记录状态`,"detail.agents.count":`{count} 个智能体`,"detail.jobs.count":`{count} 个后台任务`,"detail.terminals.count":`{count} 个终端`,"detail.tasks.count":`{count} 个团队任务`,"detail.tasks.nextPage":`后面还有任务;下一页位置为 {cursor}`,"detail.locations.count":`{count} 个位置`,"detail.location":`第 {line} 行,第 {column} 列`,"detail.receipt.delivered":`消息已送达`,"detail.receipt.interrupt":`已请求中断`,"detail.receipt.started":`已启动`,"detail.receipt.cancel":`已请求取消`,"detail.receipt.alreadyFinished":`任务已结束`,"detail.receipt.signal":`信号已发送`,"detail.receipt.closed":`已关闭`,"detail.receipt.closing":`关闭中`,"detail.wait.noProgress":`没有正在运行的子智能体`,"detail.wait.title":`子智能体状态`,"detail.wait.timeout":`等待超时`,"detail.wait.changed":`检测到变化`,"detail.agent.reply":`智能体回复`,"detail.models.title":`可用模型`,"detail.output.lines":`第 {begin}–{end} 行,共 {total} 行`,"detail.output.truncated":`输出已截断`,"detail.providers.count":`{count} 个检查提供方`,"detail.plugins.count":`{count} 个动态插件`,"detail.workflow.script":`工作流脚本`,"detail.ralph.reportedComplete":`智能体报告完成`,"detail.ralph.reportedBlocker":`智能体报告受阻`,"detail.ralph.limit":`已达到轮次上限`,"detail.report.nextSteps":`待完成事项`,"detail.trace.replacedBy":`被替换为`,"detail.trace.replacementChain":`替换链`,"detail.trace.replaces":`替换的事件`,"detail.trace.sources":`引用来源`,"detail.trace.derived":`派生事件`,"detail.trace.ancestors":`祖先会话`,"detail.trace.descendants":`后代会话`,"detail.matches.count":`{count} 条匹配`,"detail.matches.capped":`已达到结果上限,可缩小搜索范围`,"detail.event.neighbors":`前后事件`,"todo.completed":`{done}/{total} 已完成`,"command.attachmentsUnsupported":`/{command} 不接受附件,请先移除附件`,"ask.rowTitle":`提问`,"ask.waiting":`等待回答`,"ask.pending":`已继续工作,仍可回答`,"ask.pendingDetail":`等待中的问题仍可在输入框中回答`,"ask.reopen":`回答`,"ask.review":`查看回答`,"ask.closed":`已结束`,"ask.closedDetail":`该问题已结束,结果见下方对话`,"ask.cancelled":`已取消`,"ask.cancelledDetail":`本轮已取消,未提交回答`,"ask.interrupted":`已中断`,"ask.interruptedDetail":`本轮已中断,未提交回答`,"ask.answered":`{answered}/{total} 已回答`,"ask.skipped":`未回答`,"bash.running":`运行中`,"bash.failed":`失败`,"bash.stopped":`已停止`,"tool.output.showFull":`显示完整输出(共 {size} KB)`,"tool.output.loading":`正在加载完整输出…`,"tool.output.retry":`重试加载完整输出`,"tool.output.failed":`加载失败,请重试。`,"tool.output.stale":`工具输出已变化,请刷新会话。`,"row.running":`运行中`,"row.preparing":`正在准备调用`,"row.failed":`失败`,"row.stopped":`已停止`,"row.input":`输入`,"row.output":`输出`,"row.inspect":`查看`,"tool.title.search":`搜索`,"tool.title.read":`读取`,"tool.title.bash":`运行命令`,"tool.title.write":`写入`,"tool.title.edit":`编辑`,"tool.title.filesChanging":`{count} 个文件已更改`,"tool.title.filesEdited":`已编辑 {count} 个文件`,"tool.title.code":`代码`,"tool.title.generic":`工具调用`,"tool.contextCompaction.action":`压缩上下文`,"tool.contextCompaction.running":`正在压缩…`,"tool.contextCompaction.completed":`上下文已压缩`,"tool.title.inspect":`查询 Cordis 环境`,"tool.title.runCordis":`运行 Cordis 插件`,"tool.title.stopCordis":`停止 Cordis 插件`,"tool.title.removeCordis":`移除 Cordis 插件`,"tool.title.pwsh":`运行命令`,"tool.title.readImage":`读取图片`,"tool.title.grep":`搜索文件内容`,"tool.title.glob":`查找文件`,"tool.title.webSearch":`网页搜索`,"tool.title.webFetch":`网页获取`,"tool.autoReviewRejected":`Auto review 已拒绝`,"tool.autoReviewNotExecuted":`工具未执行。原因:{reason}`,"tool.autoReviewReasonFallback":`Auto review 未授权此次操作`,"diff.collapseAria":`收起差异`,"diff.expandAria":`展开其余 {count} 行差异`,"diff.expandRest":`… 其余 {count} 行`,"read.window":`显示 {shown} / {total} 行`,"read.collapseAria":`收起内容`,"read.expandAria":`展开其余 {count} 行`,"read.expandRest":`… 其余 {count} 行`,"search.paths":`{shown} 个路径`,"search.paths.truncated":`显示 {shown} / 共 {total} 个路径`,"search.matches":`{shown} 处匹配 · {files} 个文件`,"search.matches.truncated":`显示 {shown} / 共 {total} 处匹配 · {files} 个文件`,"search.noResults":`无结果`,"search.collapseAria":`收起结果`,"search.expandAria":`展开其余 {count} 行结果`,"search.expandRest":`… 其余 {count} 行`,"web.noResults":`未找到结果`,"web.sourcesTruncated":`来源列表已截断`,"web.http":`HTTP`,"web.contentTruncated":`内容已截断`,"details.running":`运行中…`,"queue.count":`{n} 条排队消息`,"queue.sending":`发送中…`,"queue.image":`排队消息图片`,"queue.file":`排队文件 {name}`,"queue.edit":`编辑排队消息`,"queue.edit.unsupported":`包含非文本内容,暂不支持编辑`,"queue.save":`保存排队消息`,"queue.cancelEdit":`取消编辑`,"queue.remove":`删除排队消息`,"queue.steer":`插话发送`,"queue.steer.unavailable":`仅运行中可插话发送`,"queue.resume":`继续队列`,"queue.paused.interrupted":`队列已因你中断当前任务而暂停。请选择一条继续。`,"queue.paused.unknown":`任务结果未知,队列已暂停且不会自动重试。`,"queue.paused.failed":`上一项未正常完成,队列已暂停。`,"error.sessionInUse":`当前会话已被占用,可能是其他正在运行的 DSH 导致的(如其他 dsh web、桌面端),请退出其他正在运行的 DSH 后重试。`,"queue.editFailed":`编辑失败:这条消息可能已经开始发送。`,"queue.removeFailed":`删除失败:这条消息可能已经开始发送。`,"queue.steerFailed":`插话发送失败,请重试。`,"queue.resumeFailed":`继续队列失败,请重试。`,"terminal.signal":`信号 {signal}`,"terminal.exitCode":`退出码 {code}`,"terminal.noExitCode":`未正常退出`,"terminal.running":`运行中`,"terminal.failed":`失败`,"terminal.done":`已完成`,"terminal.noOutput":`无输出`,"terminal.collapseAria":`收起输出`,"terminal.expandAria":`展开其余 {n} 行输出`,"terminal.expandRest":`… 其余 {n} 行`,"terminal.sendInput":`(发送输入)`,"terminal.session":`终端 {sessionId}`},Jb={"shortcut.newline":`New line`,"shortcut.complementary":`Use the complementary Queue / Steer action`,"shortcut.slash":`Open command menu`,"shortcut.mention":`Open reference menu`,"hint.plan":Kb,"hint.goal":`describe the objective for a long-running task`,"hint.goal.active":`goal active — edit / pause / resume / clear`,"placeholder.plan":Kb,"placeholder.default":`Message or run a task, / commands, @ files or sessions`,"placeholder.unavailable":`Session unavailable`,"placeholder.parentOffline":`Parent session offline; sending is unavailable but you can still stop the run`,"placeholder.hero":`Describe what you want to build, / commands, @ files or sessions`,"placeholder.workspace":`Choose a workspace to start`,"placeholder.preparing":`Preparing conversation…`,"placeholder.steerQueue":`Cmd/Ctrl+Enter steers all queued messages`,"input.commands":`Add files or run commands`,"input.commandsOnly":`Run commands`,"input.imagesAndCommands":`Add images or run commands`,"attachment.unavailable":`Attachment uploads are unavailable on this Web connection.`,"input.file":`File`,"input.stop":`Stop generating`,"input.send":`Send message`,"input.send.queue":`Queue message`,"input.send.steer":`Steer message`,"attachment.pending":`Pending attachments`,"attachment.scrollLeft":`Scroll attachments left`,"attachment.scrollRight":`Scroll attachments right`,"reference.dropTitle":`Release to reference chat`,"attachment.dropTitle":`Drag files or images here to add them`,"attachment.dropDesc":`Image limit: up to {count} images, {size} each`,"attachment.dropBlocked":`Files and images cannot be added right now`,"attachment.directoryDesktopOnly":`Folders can only be added in the desktop app; add individual files in the browser`,"attachment.pathUnavailable":`Could not obtain the folder path; drag it in again`,"attachment.pathUnsupported":`The path contains characters a reference cannot carry; rename it and try again`,"image.pending":`Pending images`,"image.openOriginal":`View original`,"image.openOriginalLabel":`{label}, click to view original`,"image.remove":`Remove image {name}`,"image.original":`Original image`,"image.label":`Image`,"image.loadFailed":`Image unavailable; click to retry`,"image.loading":`Loading image…`,"image.preview":`Original image preview`,"image.closePreview":`Close original image preview`,"image.unsupportedType":`Only PNG, JPG, WebP, and GIF images are supported`,"image.tooMany":`A message can include up to {count} images`,"image.fileTooLarge":`Each image must be smaller than {size}`,"image.totalTooLarge":`Images exceed {size} in total; remove some and try again`,"image.tooManyPixels":`Image resolution is too high; compress it and try again`,"image.dimensionTooLarge":`Image sides must be at most {size}px; downscale it and try again`,"image.modelUnsupported":`The current model does not support images; switch to a model that does`,"image.sendFailed":`Sending images failed ({reason}); re-add them and try again`,"file.unavailable":`The uploaded file is unavailable or changed; select it again`,"file.pending":`Pending files`,"file.remove":`Remove file {name}`,"file.uploading":`Uploading…`,"file.uploadFailed":`Upload failed; click to retry`,"file.retry":`Retry uploading {name}`,"file.stillUploading":`Files are still uploading; send after they finish`,"file.sessionUnavailable":`Session unavailable; files cannot be uploaded`,"file.notStaged":`The file has not finished uploading; re-add it and try again`,"file.label":`File`,"context.aria":`{percent} of context used`,"context.used":`of context used`,"context.system":`System prompt`,"context.tools":`Tool definitions`,"context.messages":`Messages`,"settings.enter.title":`Send behavior while busy`,"settings.enter.description":`What Enter and the Send button do while the agent is running; Cmd/Ctrl+Enter uses the other behavior`,"settings.enter.queue":`Queue`,"settings.enter.steer":`Steer`,"hero.headline":`What should we build today?`,"hero.preview":`Web`,"hero.chooseWorkspace":`Choose workspace`,"hero.noWorkspace":`No workspace`,"session.hierarchy":`Session hierarchy`,"todo.title":`To-dos`,"todo.progress.done":`{done} completed`,"todo.progress.active":`{active} in progress`,"todo.progress.pending":`{pending} pending`,"todo.status.completed":`Completed`,"todo.status.inProgress":`In progress`,"todo.status.pending":`Pending`,"todo.rowTitle":`Update to-do list`,"tool.title.createGoal":`Create goal`,"tool.title.getGoal":`View goal`,"tool.title.updateGoal":`Update goal`,"tool.preparing.content":`{kilobytes}KB`,"tool.title.createSchedule":`Create reminder`,"tool.title.listSchedules":`List reminders`,"tool.title.deleteSchedule":`Delete reminder`,"tool.title.updateSchedule":`Update reminder`,"detail.state":`Status`,"detail.todo.completed":`Completed`,"detail.todo.in_progress":`In progress`,"detail.todo.pending":`Pending`,"detail.todo.empty":`The to-do list is empty`,"todo.diff.initial":`Initial list`,"todo.diff.compare":`Changes since the previous list`,"todo.diff.unavailable":`Previous list unavailable`,"todo.diff.noChanges":`No changes to the list`,"todo.diff.added":`{count} added`,"todo.diff.updated":`{count} updated`,"todo.diff.removed":`{count} removed`,"todo.diff.unchanged":`{count} unchanged`,"todo.diff.addedItem":`Added`,"todo.diff.updatedItem":`Status changed`,"todo.diff.movedItem":`Reordered`,"todo.diff.removedItem":`Removed`,"detail.goal.empty":`No goal`,"detail.goal.active":`Active`,"detail.goal.disarmed":`Awaiting continuation`,"detail.goal.paused":`Paused`,"detail.goal.blocked":`Blocked`,"detail.goal.complete":`Completed`,"detail.goal.rounds":`Rounds`,"detail.goal.reason":`Blocker`,"detail.days":`{count} d`,"detail.hours":`{count} h`,"detail.minutes":`{count} min`,"detail.seconds":`{count} s`,"detail.schedule.once":`Once`,"detail.schedule.every":`Every {interval}`,"detail.schedule.when":`Scheduled for`,"detail.schedule.frequency":`Repeat`,"detail.schedule.scheduled":`Scheduled`,"detail.schedule.overdue":`Overdue, awaiting session resume`,"detail.schedule.empty":`No reminders`,"detail.schedule.deleted":`Deleted`,"detail.schedule.count":`{count} reminders`,"detail.schedule.daily":`Every day at {time} ({zone})`,"detail.schedule.weekly":`Weekly on {days} at {time} ({zone})`,"detail.schedule.cron":`Cron {expression} ({zone})`,"detail.weekday.1":`Mon`,"detail.weekday.2":`Tue`,"detail.weekday.3":`Wed`,"detail.weekday.4":`Thu`,"detail.weekday.5":`Fri`,"detail.weekday.6":`Sat`,"detail.weekday.7":`Sun`,"detail.weekday.join":`, `,"tool.title.inspectProviders":`Inspect providers`,"tool.title.queryRuntime":`Query runtime`,"tool.title.inspectPlugins":`Inspect plugins`,"tool.title.workflow":`Run workflow`,"tool.title.ralph":`Run ralph loop`,"tool.title.readEvent":`Read event`,"tool.title.searchEvents":`Search events`,"tool.title.traceEvent":`Trace event`,"tool.title.searchSessions":`Search sessions`,"tool.title.traceSession":`Trace session`,"tool.title.listModels":`List models`,"tool.title.subagent":`Create subagent`,"tool.title.listAgents":`List subagents`,"tool.title.sendMessage":`Send message`,"tool.title.interruptAgent":`Interrupt agent`,"tool.title.listJobs":`List background jobs`,"tool.title.readJob":`Read job output`,"tool.title.killJob":`Cancel background job`,"tool.title.openTerminal":`Open terminal`,"tool.title.readTerminal":`Read terminal`,"tool.title.listTerminals":`List terminals`,"tool.title.signalTerminal":`Signal terminal`,"tool.title.closeTerminal":`Close terminal`,"tool.title.lsp":`Query code symbols`,"tool.title.findDefinition":`Find definition`,"tool.title.findReferences":`Find references`,"tool.title.findImplementation":`Find implementation`,"tool.title.hoverSymbol":`Inspect symbol`,"tool.title.spawnTeammate":`Create teammate`,"tool.title.createTeamTask":`Create team task`,"tool.title.getTeamTask":`Read team task`,"tool.title.updateTeamTask":`Update team task`,"tool.title.listTeamTasks":`List team tasks`,"tool.title.waitAgent":`Wait for subagent`,"detail.recordedResult":`Recorded result`,"detail.empty":`No results`,"detail.none":`None`,"detail.yes":`Yes`,"detail.no":`No`,"detail.moreInInspect":`{count} more items available in Inspect`,"detail.status.running":`Running`,"detail.status.idle":`Idle`,"detail.status.ready":`Ready`,"detail.status.inactive":`Inactive`,"detail.status.provisioning":`Provisioning`,"detail.status.failed":`Failed`,"detail.status.completed":`Completed`,"detail.status.deleted":`Deleted`,"detail.status.killed":`Cancelled`,"detail.status.accepted":`Accepted`,"detail.status.queued":`Queued`,"detail.status.exited":`Exited`,"detail.field.id":`ID`,"detail.field.revision":`Revision`,"detail.field.platform":`Platform`,"detail.field.provider":`Provider`,"detail.field.model":`Model`,"detail.field.role":`Role`,"detail.field.context":`Context`,"detail.field.owner":`Owner`,"detail.field.ready":`Ready`,"detail.field.dependencies":`Dependencies`,"detail.field.writeScopes":`Write scopes`,"detail.field.warnings":`Warnings`,"detail.field.diagnostics":`Diagnostics`,"detail.field.methods":`Methods`,"detail.field.inputSchema":`Input schema`,"detail.field.outputSchema":`Output schema`,"detail.field.currentPackage":`Current package`,"detail.field.nextPackage":`Next package`,"detail.field.latestRun":`Latest run`,"detail.field.packages":`Packages`,"detail.field.registrations":`Registrations`,"detail.field.props":`Props`,"detail.field.data":`Data`,"detail.field.source":`Source`,"detail.field.content":`Content`,"detail.field.message":`Message`,"detail.field.messageId":`Message ID`,"detail.field.root":`Root`,"detail.field.pid":`Process ID`,"detail.field.type":`Type`,"detail.field.time":`Time`,"detail.field.seq":`Event sequence`,"detail.field.turn":`Turn`,"detail.field.step":`Step`,"detail.field.callId":`Call ID`,"detail.field.agents":`Agents started`,"detail.field.result":`Result`,"detail.field.parent":`Parent`,"detail.field.depth":`Depth`,"detail.field.exitCode":`Exit code`,"detail.field.signal":`Signal`,"detail.field.previousStatus":`Previous status`,"detail.field.agent":`Agent ID`,"detail.field.job":`Job ID`,"detail.field.task":`Task`,"detail.field.processGroup":`Process group`,"detail.field.availability":`Availability`,"detail.field.bestMatch":`Best match`,"detail.field.target":`Target event`,"detail.field.surface":`Record status`,"detail.agents.count":`{count} agents`,"detail.jobs.count":`{count} background jobs`,"detail.terminals.count":`{count} terminals`,"detail.tasks.count":`{count} team tasks`,"detail.tasks.nextPage":`More tasks available; next cursor is {cursor}`,"detail.locations.count":`{count} locations`,"detail.location":`Line {line}, column {column}`,"detail.receipt.delivered":`Message delivered`,"detail.receipt.interrupt":`Interrupt requested`,"detail.receipt.started":`Started`,"detail.receipt.cancel":`Cancellation requested`,"detail.receipt.alreadyFinished":`Already finished`,"detail.receipt.signal":`Signal delivered`,"detail.receipt.closed":`Closed`,"detail.receipt.closing":`Closing`,"detail.wait.noProgress":`No active subagents`,"detail.wait.title":`Subagent activity`,"detail.wait.timeout":`Wait timed out`,"detail.wait.changed":`Change detected`,"detail.agent.reply":`Agent response`,"detail.models.title":`Available models`,"detail.output.lines":`Lines {begin}–{end} of {total}`,"detail.output.truncated":`Output truncated`,"detail.providers.count":`{count} inspect providers`,"detail.plugins.count":`{count} dynamic plugins`,"detail.workflow.script":`Workflow script`,"detail.ralph.reportedComplete":`Worker reported completion`,"detail.ralph.reportedBlocker":`Worker reported a blocker`,"detail.ralph.limit":`Round limit reached`,"detail.report.nextSteps":`Remaining work`,"detail.trace.replacedBy":`Replaced by`,"detail.trace.replacementChain":`Replacement chain`,"detail.trace.replaces":`Replaced events`,"detail.trace.sources":`Source events`,"detail.trace.derived":`Derived events`,"detail.trace.ancestors":`Ancestor sessions`,"detail.trace.descendants":`Descendant sessions`,"detail.matches.count":`{count} matches`,"detail.matches.capped":`Result limit reached; narrow the search for more`,"detail.event.neighbors":`Surrounding events`,"todo.completed":`{done}/{total} completed`,"command.attachmentsUnsupported":`/{command} does not accept attachments; remove them first`,"ask.rowTitle":`Ask question`,"ask.waiting":`waiting`,"ask.pending":`continued; answer still available`,"ask.pendingDetail":`These pending questions remain answerable from the composer.`,"ask.reopen":`Answer`,"ask.review":`View answers`,"ask.closed":`closed`,"ask.closedDetail":`This question is closed; its outcome is in the conversation below.`,"ask.cancelled":`cancelled`,"ask.cancelledDetail":`This question set was cancelled before answers were submitted.`,"ask.interrupted":`interrupted`,"ask.interruptedDetail":`This question set was interrupted before answers were submitted.`,"ask.answered":`{answered}/{total} answered`,"ask.skipped":`Not answered`,"bash.running":`Running`,"bash.failed":`Failed`,"bash.stopped":`Stopped`,"tool.output.showFull":`Show full output ({size} KB total)`,"tool.output.loading":`Loading full output…`,"tool.output.retry":`Retry loading full output`,"tool.output.failed":`Could not load output. Please retry.`,"tool.output.stale":`Tool output changed. Refresh the conversation.`,"row.running":`Running`,"row.preparing":`Preparing tool call`,"row.failed":`Failed`,"row.stopped":`Stopped`,"row.input":`IN`,"row.output":`OUT`,"row.inspect":`Inspect`,"tool.title.search":`Search`,"tool.title.read":`Read`,"tool.title.bash":`Bash`,"tool.title.write":`Write`,"tool.title.edit":`Edit`,"tool.title.filesChanging":`{count} files changed`,"tool.title.filesEdited":`Edited {count} files`,"tool.title.code":`Code`,"tool.title.generic":`Tool call`,"tool.contextCompaction.action":`Compact context`,"tool.contextCompaction.running":`Compacting context…`,"tool.contextCompaction.completed":`Context compacted`,"tool.title.inspect":`Query Cordis environment`,"tool.title.runCordis":`Run Cordis Plugin`,"tool.title.stopCordis":`Stop Cordis Plugin`,"tool.title.removeCordis":`Remove Cordis Plugin`,"tool.title.pwsh":`Pwsh`,"tool.title.readImage":`Read image`,"tool.title.grep":`Grep`,"tool.title.glob":`Glob`,"tool.title.webSearch":`Search`,"tool.title.webFetch":`Fetch`,"tool.autoReviewRejected":`Rejected by Auto review`,"tool.autoReviewNotExecuted":`Tool was not executed. Reason: {reason}`,"tool.autoReviewReasonFallback":`Auto review did not authorize this action`,"diff.collapseAria":`Collapse diff`,"diff.expandAria":`Expand {count} more diff lines`,"diff.expandRest":`… {count} more lines`,"read.window":`Showing {shown} of {total} lines`,"read.collapseAria":`Collapse content`,"read.expandAria":`Expand {count} more lines`,"read.expandRest":`… {count} more lines`,"search.paths":`{shown} paths`,"search.paths.truncated":`Showing {shown} of {total} paths`,"search.matches":`{shown} matches · {files} files`,"search.matches.truncated":`Showing {shown} of {total} matches · {files} files`,"search.noResults":`No results`,"search.collapseAria":`Collapse results`,"search.expandAria":`Expand {count} more result lines`,"search.expandRest":`… {count} more lines`,"web.noResults":`No results found`,"web.sourcesTruncated":`Source list truncated`,"web.http":`HTTP`,"web.contentTruncated":`Content truncated`,"details.running":`Running…`,"queue.count":`{n} queued messages`,"queue.sending":`Sending…`,"queue.image":`Queued message image`,"queue.file":`Queued file {name}`,"queue.edit":`Edit queued message`,"queue.edit.unsupported":`Contains non-text content; editing is not supported yet`,"queue.save":`Save queued message`,"queue.cancelEdit":`Cancel editing`,"queue.remove":`Remove queued message`,"queue.steer":`Steer queued message`,"queue.steer.unavailable":`Steering is available only while the agent is running`,"queue.resume":`Resume queue`,"queue.paused.interrupted":`Queue paused because you interrupted. Choose a message to resume.`,"queue.paused.unknown":`Outcome unknown. The queue is paused and will not retry automatically.`,"queue.paused.failed":`The previous turn did not finish normally. The queue is paused.`,"error.sessionInUse":`This session is already in use, possibly by another running DSH instance (such as dsh web or the desktop app). Quit other running DSH instances and try again.`,"queue.editFailed":`Edit failed: this message may have already started sending.`,"queue.removeFailed":`Removal failed: this message may have already started sending.`,"queue.steerFailed":`Steering failed. Try again.`,"queue.resumeFailed":`Could not resume the queue. Try again.`,"terminal.signal":`signal {signal}`,"terminal.exitCode":`exit code {code}`,"terminal.noExitCode":`no exit code`,"terminal.running":`Running`,"terminal.failed":`Failed`,"terminal.done":`Done`,"terminal.noOutput":`No output`,"terminal.collapseAria":`Collapse output`,"terminal.expandAria":`Expand the remaining {n} output lines`,"terminal.expandRest":`… {n} more lines`,"terminal.sendInput":`(send input)`,"terminal.session":`Terminal {sessionId}`},Yb=`@deepseek-ai/dsh-client-ui-conversation/QueueDock.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Yb)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=Yb,e.textContent=`._45elva_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}._45elva_panel{isolation:isolate;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}._45elva_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}._45elva_panel:after{border:.5px solid var(--dsw-alias-border-l1);border-radius:inherit;content:"";pointer-events:none;border-bottom:none;position:absolute;inset:0}._45elva_paused{color:var(--dsw-alias-label-tertiary);font:var(--dsw-font-xs-13);padding:6px 12px 2px}._45elva_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}._45elva_header:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}._45elva_header:disabled{cursor:default}._45elva_lead{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}._45elva_count{min-width:0;font-family:Inter, var(--dsw-font-family);flex:auto;font-size:13px;font-weight:500;line-height:24px}._45elva_chevron{width:14px;height:14px;color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}._45elva_list{max-height:180px;margin:0;padding:0;list-style:none;overflow-y:auto}._45elva_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}._45elva_row+._45elva_row{box-shadow:inset 0 1px 0 var(--dsw-alias-border-l1)}._45elva_attachments{flex:none;gap:4px;min-width:0;max-width:55%;display:flex;overflow:hidden}._45elva_pendingRow ._45elva_attachments{flex-shrink:1}._45elva_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}._45elva_fileIcon{flex:none;width:16px;height:16px;display:inline-flex}._45elva_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}._45elva_fileSize{color:var(--dsw-alias-label-tertiary);white-space:nowrap;flex:none;font-size:10px}._45elva_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}._45elva_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}._45elva_actions{flex:none;align-items:center;gap:10px;display:flex}._45elva_status{color:var(--dsw-alias-label-tertiary);font:var(--dsw-font-xs-13);white-space:nowrap;flex:none}._45elva_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}._45elva_action:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}._45elva_action:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}._45elva_action:disabled{cursor:default;opacity:.45}`,document.head.appendChild(e)}var Q={action:`_45elva_action`,actions:`_45elva_actions`,attachments:`_45elva_attachments`,chevron:`_45elva_chevron`,count:`_45elva_count`,dock:`_45elva_dock`,file:`_45elva_file`,fileIcon:`_45elva_fileIcon`,fileName:`_45elva_fileName`,fileSize:`_45elva_fileSize`,header:`_45elva_header`,lead:`_45elva_lead`,list:`_45elva_list`,panel:`_45elva_panel`,paused:`_45elva_paused`,pendingRow:`_45elva_pendingRow`,preview:`_45elva_preview`,row:`_45elva_row`,status:`_45elva_status`,thumb:`_45elva_thumb`};let Xb=[];function Zb(e){let t=e.filter(e=>e.type!==`image`&&e.type!==`file`).map(e=>e.type===`text`?e.text:`[${e.type}]`).join(` `).replace(/\s+/g,` `).trim(),n=Array.from(t);return n.length>200?`${n.slice(0,200).join(``)}…`:t}function Qb(e){return e.every(e=>e.type===`text`)?e.map(e=>e.text).join(``):null}function $b(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 ex({attachment:e,label:t}){return/* @__PURE__ */ (0,h.jsxs)(`span`,{className:Q.file,"aria-label":t,title:e.name,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.fileIcon,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.FileTypeIcon,{path:e.name,size:16})}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.fileName,children:e.name}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.fileSize,children:(0,d.fileSizeText)(e.bytes)})]})}function tx({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:Q.thumb,"aria-hidden":!0}):/* @__PURE__ */ (0,h.jsx)(`img`,{className:Q.thumb,src:r,alt:n})}function nx({useSession:e,useProjection:t,updateQueue:n,editQueue:r,notify:i,loadImage:a,t:o}){let s=t(`inbox`),c=t(`queueState`),l=e(e=>e.pendingSubmissions),u=(0,g.useMemo)(()=>{let e=s?.[`next-turn`]??Xb,t=new Set(l.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))},[s,l]),f=(0,g.useMemo)(()=>{let e=new Set(u.flatMap(({source:e})=>e.kind===`user`&&`rpcId`in e?[e.rpcId]:[]));return l.filter(t=>t.placement===`queued`&&!e.has(t.requestId))},[l,u]),p=u.length+f.length,m=e(e=>e.running),_=e(e=>e.subagent===null||e.subagent.address.mode===`continuable`),v=(0,g.useRef)(!1),[y,ee]=(0,g.useState)(null),[b,x]=(0,g.useState)(!0),S=(0,g.useId)(),te=c?.pausedReason??null,ne=te===`interrupted`?o(`queue.paused.interrupted`):te===`outcome-unknown`?o(`queue.paused.unknown`):te===`failed`?o(`queue.paused.failed`):null;if((0,g.useEffect)(()=>{p===0&&!b&&x(!0)},[b,p]),p===0)return null;let re=_&&y!==null,ie=!b||re,ae=p===1||ie,oe=async(e,t,r)=>{if(v.current)return!1;v.current=!0,ee(e);try{return typeof t==`function`?await t():await n(e,t),!0}catch{return i(`error`,r),!1}finally{v.current=!1,ee(t=>t===e?null:t)}};return/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.dock,"data-queue-dock":``,children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.panel,children:[ne!==null&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.paused,role:`status`,children:ne}),p>1&&/* @__PURE__ */ (0,h.jsxs)(`button`,{type:`button`,className:Q.header,"aria-controls":S,"aria-expanded":ie,disabled:re,onClick:()=>{x(e=>!e)},children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.lead,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconQueueOutlineRegular,{})}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.count,children:o(`queue.count`,{n:p})}),!ae&&f.length>0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.status,role:`status`,children:o(`queue.sending`)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.chevron,"aria-hidden":!0,children:ie?/* @__PURE__ */ (0,h.jsx)(d.IconChevronDownOutlineRegular,{}):/* @__PURE__ */ (0,h.jsx)(d.IconChevronUpOutlineRegular,{})})]}),/* @__PURE__ */ (0,h.jsxs)(`ul`,{id:S,className:Q.list,hidden:!ae,children:[ae&&u.map(e=>{let t=$b(e.content),n=Qb(e.content);return/* @__PURE__ */ (0,h.jsxs)(`li`,{className:Q.row,children:[p===1&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.lead,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconQueueOutlineRegular,{})}),t.length>0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.attachments,children:t.map((e,t)=>e.type===`image`?/* @__PURE__ */ (0,h.jsx)(tx,{attachment:e.attachment,loadImage:a,label:o(`queue.image`)},`${e.attachment.attachmentId}:${t}`):/* @__PURE__ */ (0,h.jsx)(ex,{attachment:e.attachment,label:o(`queue.file`,{name:e.attachment.name})},`${e.attachment.attachmentId}:${e.attachment.name}:${t}`))}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.preview,children:(0,d.projectUserText)(Zb(e.content),[])}),_&&/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.actions,children:[/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:!0,label:o(`queue.edit`),side:`bottom`,delayMs:500,disabled:n===null,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Q.action,"aria-label":o(`queue.edit`),title:n===null?o(`queue.edit.unsupported`):void 0,disabled:y!==null||n===null,onClick:()=>{n!==null&&oe(e.id,()=>r(e.id,n),o(`queue.editFailed`))},children:/* @__PURE__ */ (0,h.jsx)(d.IconEditOutlineRegular,{size:14})})}),/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:!0,label:o(`queue.remove`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Q.action,"aria-label":o(`queue.remove`),disabled:y!==null,onClick:()=>{oe(e.id,{kind:`remove`},o(`queue.removeFailed`))},children:/* @__PURE__ */ (0,h.jsx)(d.IconTrashOutlineRegular,{size:14})})}),/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:!0,label:o(m?`queue.steer`:`queue.resume`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Q.action,"aria-label":o(m?`queue.steer`:`queue.resume`),disabled:y!==null,onClick:()=>{oe(e.id,{kind:`steer`},o(m?`queue.steerFailed`:`queue.resumeFailed`))},children:/* @__PURE__ */ (0,h.jsx)(d.IconSendOutlineRegular,{})})})]})]},e.id)}),ae&&f.map(e=>/* @__PURE__ */ (0,h.jsxs)(`li`,{className:`${Q.row} ${Q.pendingRow}`,"data-submission-echo":``,children:[p===1&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.lead,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconQueueOutlineRegular,{})}),e.attachments.length>0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.attachments,children:e.attachments.map((e,t)=>e.type===`image`?/* @__PURE__ */ (0,h.jsx)(`img`,{className:Q.thumb,src:e.value.previewUrl,alt:o(`queue.image`)},`${e.value.previewUrl}:${t}`):/* @__PURE__ */ (0,h.jsx)(ex,{attachment:e.value,label:o(`queue.file`,{name:e.value.name})},`${e.value.attachmentId}:${e.value.name}:${t}`))}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.preview,children:(0,d.projectUserText)(e.text,[])}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.status,role:`status`,children:o(`queue.sending`)}),_&&/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.actions,children:[/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Q.action,"aria-label":o(`queue.edit`),title:o(`queue.sending`),disabled:!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconEditOutlineRegular,{size:14})}),/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Q.action,"aria-label":o(`queue.remove`),title:o(`queue.sending`),disabled:!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconTrashOutlineRegular,{size:14})}),/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Q.action,"aria-label":o(`queue.steer`),title:o(`queue.sending`),disabled:!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconSendOutlineRegular,{})})]})]},e.requestId))]})]})})}let rx={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:Wb,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`);return{updateQueue:(e,t)=>i.updateQueue(e,t),editQueue:async(e,r)=>{let a=t.shell(n);await i.updateQueue(e,{kind:`remove`});let o=a.draftSnapshot;a.setDraft({...o,text:o.text===``?r:`${o.text}\n${r}`}),a.actions.persistDraft(),a.focus()},notify:(e,t)=>{i.input.for(r).notify(e,t)},loadImage:t=>e.uiConversation.imageUrl(n,t)}}},nx))}},ix=`@deepseek-ai/dsh-client-ui-conversation/EnterBehaviorRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(ix)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=ix,e.textContent=`.KaT34W_row{border-bottom:.5px solid var(--dsw-alias-border-l2);align-items:center;gap:8px;padding:16px 0;display:flex}.KaT34W_rowText{flex-direction:column;flex:1;gap:4px;min-width:0;padding-right:48px;display:flex}.KaT34W_title{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:400;line-height:22px}.KaT34W_desc{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:400;line-height:18px}.KaT34W_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}.KaT34W_selector:hover{background:var(--dsw-alias-interactive-bg-hover)}.KaT34W_chevron{flex:none}`,document.head.appendChild(e)}var ax={chevron:`KaT34W_chevron`,desc:`KaT34W_desc`,row:`KaT34W_row`,rowText:`KaT34W_rowText`,selector:`KaT34W_selector`,title:`KaT34W_title`};let ox=[{id:`queue`,label:`settings.enter.queue`},{id:`steer`,label:`settings.enter.steer`}];function sx({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:ax.row,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:ax.rowText,children:[/* @__PURE__ */ (0,h.jsx)(`div`,{className:ax.title,children:n(`settings.enter.title`)}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:ax.desc,children:n(`settings.enter.description`)})]}),/* @__PURE__ */ (0,h.jsx)(d.Menu,{open:i,onClose:()=>{a(!1)},items:ox.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:ax.selector,"aria-haspopup":`menu`,"aria-expanded":i,onClick:()=>{a(e=>!e)},children:[n(o),/* @__PURE__ */ (0,h.jsx)(d.IconChevronDownOutlineRegular,{className:ax.chevron})]})})]})}let cx={views:{get:()=>void 0,grouped:()=>void 0},activeTargets:/* @__PURE__ */ new Set};function lx(e,t){return t.activeTargets.size>0||!e.blank&&!e.awaitingFirstTurn||e.running?`active`:e.promptAttempted?`engaging`:`blank`}let ux=`@deepseek-ai/dsh-client-ui-conversation/ConversationRoot.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(ux)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=ux,e.textContent=`.ofIY9G_root{background:var(--dsw-alias-bg-base);flex-direction:column;min-width:0;height:100%;display:flex;position:relative}.ofIY9G_header{box-sizing:border-box;border-bottom:.5px solid var(--dsw-alias-border-l3);flex:none;grid-template-columns:auto minmax(0,1fr);min-height:76px;padding:10px 28px 0 20px;display:grid}.ofIY9G_header:where(:not(:has(.ofIY9G_tabs))){min-height:0;padding-bottom:10px}.ofIY9G_headerBlank{border-bottom:none;min-height:0;padding-bottom:0}.ofIY9G_headerBlank .ofIY9G_headerCorner{margin-left:auto}html:not([data-platform=darwin]) .ofIY9G_headerSessionless{padding-top:0}html:not([data-platform=darwin]) .ofIY9G_headerSessionless .ofIY9G_titleRow{min-height:0}[data-platform=darwin] .ofIY9G_headerLeading,[data-platform=darwin] .ofIY9G_headerActions,[data-platform=darwin] .ofIY9G_headerUtilities,[data-platform=darwin] .ofIY9G_headerCorner{-webkit-app-region:no-drag}.ofIY9G_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}.ofIY9G_titleCluster{flex:1;align-items:center;gap:10px;min-width:0;display:flex}.ofIY9G_headerLeading{flex:none;grid-area:1/1;align-items:center;gap:8px;display:flex}.ofIY9G_crumbs{white-space:nowrap;align-items:center;gap:4px;min-width:0;display:flex;overflow:hidden}.ofIY9G_crumbSeg{align-items:center;gap:4px;min-width:0;display:inline-flex}.ofIY9G_crumbSep{color:var(--dsw-alias-label-caption);font-size:14px;line-height:20px}.ofIY9G_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}.ofIY9G_crumbSubagent{font-size:12px;line-height:18px}button.ofIY9G_crumb:hover{background:var(--dsw-alias-interactive-bg-hover)}.ofIY9G_crumbCurrent{color:var(--dsw-alias-label-primary);cursor:default;font-weight:500}.ofIY9G_headerActions{flex:none;align-items:center;gap:8px;display:flex}.ofIY9G_headerUtilities{flex:none;align-items:center;gap:8px;margin-left:20px;display:flex}.ofIY9G_headerUtilities:empty{display:none}.ofIY9G_headerCorner{flex:none;align-items:center;margin-left:8px;margin-right:-16px;display:flex}.ofIY9G_headerCorner:empty{display:none}.ofIY9G_tabs{z-index:1;grid-column:1/-1;gap:36px;margin-top:10px;padding-left:8px;display:flex;position:relative}.ofIY9G_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}.ofIY9G_tab:after{content:"";background:0 0;border-radius:2px;height:2px;position:absolute;bottom:-1px;left:0;right:0}.ofIY9G_tabActive{color:var(--dsw-alias-state-business-primary)}.ofIY9G_tabActive:after{background:var(--dsw-alias-state-business-primary)}.ofIY9G_viewArea{flex-direction:column;flex:1;min-height:0;display:flex}.ofIY9G_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}.ofIY9G_widthHandle[data-side=left]{right:calc(50% + var(--dsh-chat-content-width) / 2 + 24px)}.ofIY9G_widthHandle[data-side=right]{left:calc(50% + var(--dsh-chat-content-width) / 2 + 24px)}.ofIY9G_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}.ofIY9G_widthHandle[data-side=left]:after{right:4px}.ofIY9G_widthHandle[data-side=right]:after{left:4px}.ofIY9G_widthHandle:hover:after,.ofIY9G_widthHandle[data-dragging]:after{opacity:1}.ofIY9G_widthHandle[data-dragging]{z-index:8}.ofIY9G_root:has([data-conversation-composer-overlay]) .ofIY9G_widthHandle{display:none}.ofIY9G_composerStack{--dsh-composer-stack-gap:6px;gap:var(--dsh-composer-stack-gap);flex-direction:column;display:flex}.ofIY9G_composerSeat{--dsh-composer-text-max-height:336px;flex-direction:column;flex:none;display:flex}.ofIY9G_root[data-phase=active]{overflow:hidden}.ofIY9G_root[data-phase=active] .ofIY9G_header{flex:none}.ofIY9G_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}.ofIY9G_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}.ofIY9G_scrollBody{scrollbar-gutter:stable;flex-direction:column;flex:1;min-height:0;margin-right:2px;display:flex;overflow-y:auto}.ofIY9G_scrollBody::-webkit-scrollbar-track{margin:2px}.ofIY9G_root[data-phase=active] .ofIY9G_viewArea,.ofIY9G_embeddedBody[data-content-phase=active] .ofIY9G_viewArea{flex:1 0 auto;min-height:auto}.ofIY9G_root[data-phase=active] .ofIY9G_composerSeat,.ofIY9G_embeddedBody[data-content-phase=active] .ofIY9G_composerSeat{z-index:7;background: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}.ofIY9G_root[data-phase=active] .ofIY9G_composerSeat:has([data-trigger-menu]){z-index:9}.ofIY9G_scrollBody:has([data-conversation-composer-overlay]){scrollbar-gutter:auto;position:relative;overflow:hidden auto}.ofIY9G_scrollBody:has([data-conversation-composer-overlay])>[data-slot=conversation\\.session]>.ofIY9G_viewArea{flex:1 1 0;min-height:0;overflow:hidden}.ofIY9G_scrollBody:has([data-conversation-composer-overlay])>.ofIY9G_composerSeat{right:var(--dsh-scrollbar-width);position:absolute;bottom:0;left:0}.ofIY9G_composerHero{width:min(calc(var(--dsh-composer-card-max-width) + 2 * var(--dsh-composer-side-clearance)), 100%);z-index:1;align-self:center;gap:8px;padding-bottom:32px}.ofIY9G_heroWorkspaceRow{align-items:center;gap:2px;min-width:0;margin-top:4px;padding:0 16px 0 20px;display:flex}.ofIY9G_root[data-phase=hero] .ofIY9G_scrollBody,.ofIY9G_embeddedBody[data-content-phase=hero] .ofIY9G_scrollBody{justify-content:center;overflow-y:auto}.ofIY9G_root[data-phase=settling] .ofIY9G_composerSeat,.ofIY9G_embeddedBody[data-content-phase=settling] .ofIY9G_composerSeat{visibility:hidden}`,document.head.appendChild(e)}var $={body:`ofIY9G_body`,composerHero:`ofIY9G_composerHero`,composerSeat:`ofIY9G_composerSeat`,composerStack:`ofIY9G_composerStack`,crumb:`ofIY9G_crumb`,crumbCurrent:`ofIY9G_crumbCurrent`,crumbSeg:`ofIY9G_crumbSeg`,crumbSep:`ofIY9G_crumbSep`,crumbSubagent:`ofIY9G_crumbSubagent`,crumbs:`ofIY9G_crumbs`,embeddedBody:`ofIY9G_embeddedBody`,header:`ofIY9G_header`,headerActions:`ofIY9G_headerActions`,headerBlank:`ofIY9G_headerBlank`,headerCorner:`ofIY9G_headerCorner`,headerLeading:`ofIY9G_headerLeading`,headerSessionless:`ofIY9G_headerSessionless`,headerUtilities:`ofIY9G_headerUtilities`,heroWorkspaceRow:`ofIY9G_heroWorkspaceRow`,root:`ofIY9G_root`,scrollBody:`ofIY9G_scrollBody`,tab:`ofIY9G_tab`,tabActive:`ofIY9G_tabActive`,tabs:`ofIY9G_tabs`,titleCluster:`ofIY9G_titleCluster`,titleRow:`ofIY9G_titleRow`,viewArea:`ofIY9G_viewArea`,widthHandle:`ofIY9G_widthHandle`};let dx=`dsh.conversation.contentWidth`;function fx(){let e=localStorage.getItem(dx);if(e===null)return null;let t=Number(e);return Number.isFinite(t)&&t>0?t:null}function px(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 mx(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 hx(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;
|
|
167
|
+
`),t+=r.draft;for(let t of r.occurrences)n.push({...t,offset:e+t.offset})}this.restoringFailures=!0;try{this.draftEditor.restoreDraft(t,n),this.draftEditor.clearHistory(),this.failedRestoreRev=this.rev}finally{this.restoringFailures=!1}}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}):n.adjudicate(t.trim(),e.signal,{attachments:this.attachmentIds.length}).then(t=>{this.dead(e)||this.dispatchRun({type:`adjudicated`,attempt:e,outcome:t})},t=>{if(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,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`]??Pb}}publish(){let e=this.compose();this.state.set(e);let t=this.draftSnapshot;t!==this.lastPublishedDraft&&(this.lastPublishedDraft=t,this.persistDraft?.(t))}};function Lb(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 Rb=class{rootCtx;t;shells=/* @__PURE__ */ new WeakMap;constructor(e,t){this.rootCtx=e,this.t=t}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)}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)}shellFor(e){let t=this.shells.get(e);if(t!==void 0)return t;let{session:n,ctx:r}=e,i=new Ib({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=>{Lb(this.rootCtx,e)},inputTriggers:()=>this.controller(r),popup:()=>this.popup(r),inbox:n.projections.faceOf(`inbox`),defaultSink:(e,t,r,i)=>this.sink(n,e,t,r,i),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(tc(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){return t===``&&n.length===0?Promise.resolve({kind:`success`}):this.conversation().sendSession(e,t,n,r,i)}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 zb=`busyEnter`,Bb=[`queue`,`steer`],Vb=`queue`,Hb={[zb]:T.union([...Bb]).default(Vb)};T.object(Hb);function Ub(e,t,n,r){return!t||!r?`queue`:n===`enter`?e:e===`queue`?`steer`:`queue`}var Wb=class{busyEnter=(0,f.createSnapshotStore)(Vb);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(zb,e))}adopt(e){let t=e.getSnapshot().value;t!==void 0&&this.busyEnter.getSnapshot()!==t.busyEnter&&this.busyEnter.set(t.busyEnter)}};let Gb=`conversation`,Kb=`描述你的任务以生成计划`,qb=`describe your task to generate plan`,Jb={"shortcut.newline":`换行`,"shortcut.complementary":`使用互补的 Queue/Steer 方式`,"shortcut.slash":`打开命令菜单`,"shortcut.mention":`打开引用菜单`,"hint.plan":Kb,"hint.goal":`输入目标,智能体将持续执行`,"hint.goal.active":`当前目标进行中。可输入 edit 修改 / pause 暂停 / resume 继续 / clear 清除`,"placeholder.plan":Kb,"placeholder.default":`发消息或创建任务, / 调用指令, @ 文件或对话`,"placeholder.unavailable":`会话不可用`,"placeholder.parentOffline":`父会话已离线,无法继续发送;仍可停止当前运行`,"placeholder.hero":`描述你想要构建的内容, / 调用指令, @ 文件或对话`,"placeholder.workspace":`选择一个工作区开始`,"placeholder.preparing":`正在准备对话…`,"placeholder.steerQueue":`Cmd/Ctrl+Enter 插话发送全部排队消息`,"input.commands":`添加文件或调用指令`,"input.commandsOnly":`调用指令`,"input.imagesAndCommands":`添加图片或调用指令`,"attachment.unavailable":`当前 Web 连接不支持附件上传。`,"input.file":`文件`,"input.stop":`停止生成`,"input.send":`发送消息`,"input.send.queue":`排队发送`,"input.send.steer":`插话发送`,"attachment.pending":`待发送附件`,"attachment.scrollLeft":`向左滚动附件`,"attachment.scrollRight":`向右滚动附件`,"reference.dropTitle":`松开以引用聊天`,"attachment.dropTitle":`文件或图片拖动到此处即可添加`,"attachment.dropDesc":`图片限制:最多 {count} 张,每张 {size}`,"attachment.dropBlocked":`当前无法添加文件或图片`,"attachment.directoryDesktopOnly":`只有桌面端支持添加文件夹,浏览器里请添加单个文件`,"attachment.pathUnavailable":`无法获取文件夹路径,请重新拖入`,"attachment.pathUnsupported":`路径含有无法引用的字符,请改名后再试`,"image.pending":`待发送图片`,"image.openOriginal":`查看原图`,"image.openOriginalLabel":`{label},点击查看原图`,"image.remove":`移除图片 {name}`,"image.original":`原图`,"image.label":`图片`,"image.loadFailed":`图片不可用,点击重试`,"image.loading":`图片加载中…`,"image.preview":`原图预览`,"image.closePreview":`关闭原图预览`,"image.unsupportedType":`仅支持 PNG、JPG、WebP、GIF 格式的图片`,"image.tooMany":`一条消息最多添加 {count} 张图片`,"image.fileTooLarge":`单张图片不能超过 {size}`,"image.totalTooLarge":`图片总大小超过 {size},请移除部分图片`,"image.tooManyPixels":`图片分辨率过大,请压缩后重试`,"image.dimensionTooLarge":`图片宽高不能超过 {size}px,请缩小后重试`,"image.modelUnsupported":`当前模型不支持图片,请切换支持图片的模型`,"image.sendFailed":`图片发送失败({reason}),请重新添加图片后再试`,"file.unavailable":`已上传文件不可用或被修改,请重新选择`,"file.pending":`待发送文件`,"file.remove":`移除文件 {name}`,"file.uploading":`上传中…`,"file.uploadFailed":`上传失败,点击重试`,"file.retry":`重试上传 {name}`,"file.stillUploading":`文件还在上传,请等待上传完成后发送`,"file.sessionUnavailable":`会话不可用,无法上传文件`,"file.notStaged":`文件尚未上传成功,请重新添加后再试`,"file.label":`文件`,"context.aria":`上下文已用 {percent}`,"context.used":`上下文已用`,"context.system":`系统提示词`,"context.tools":`工具定义`,"context.messages":`对话消息`,"settings.enter.title":`繁忙时的发送行为`,"settings.enter.description":`智能体运行时 Enter 键和发送按钮的行为;Cmd/Ctrl+Enter 使用另一行为`,"settings.enter.queue":`排队发送`,"settings.enter.steer":`插话发送`,"hero.headline":`今天想做点什么?`,"hero.preview":`Web`,"hero.chooseWorkspace":`选择工作区`,"hero.noWorkspace":`不选择工作区`,"session.hierarchy":`会话层级`,"todo.title":`任务`,"todo.progress.done":`{done} 已完成`,"todo.progress.active":`{active} 进行中`,"todo.progress.pending":`{pending} 待处理`,"todo.status.completed":`已完成`,"todo.status.inProgress":`进行中`,"todo.status.pending":`待处理`,"todo.rowTitle":`更新任务清单`,"tool.title.createGoal":`创建目标`,"tool.title.getGoal":`查看目标`,"tool.title.updateGoal":`更新目标`,"tool.preparing.content":`{kilobytes}KB`,"tool.title.createSchedule":`创建定时任务`,"tool.title.listSchedules":`查看定时任务`,"tool.title.deleteSchedule":`删除定时任务`,"tool.title.updateSchedule":`修改定时任务`,"detail.state":`状态`,"detail.todo.completed":`已完成`,"detail.todo.in_progress":`进行中`,"detail.todo.pending":`待处理`,"detail.todo.empty":`任务清单为空`,"todo.diff.initial":`首次记录`,"todo.diff.compare":`与上次清单相比`,"todo.diff.unavailable":`旧清单不可用`,"todo.diff.noChanges":`清单没有变化`,"todo.diff.added":`新增 {count}`,"todo.diff.updated":`更新 {count}`,"todo.diff.removed":`移除 {count}`,"todo.diff.unchanged":`{count} 项未变化`,"todo.diff.addedItem":`新增`,"todo.diff.updatedItem":`状态变化`,"todo.diff.movedItem":`顺序调整`,"todo.diff.removedItem":`移除`,"detail.goal.empty":`没有目标`,"detail.goal.active":`进行中`,"detail.goal.disarmed":`等待继续`,"detail.goal.paused":`已暂停`,"detail.goal.blocked":`受阻`,"detail.goal.complete":`已完成`,"detail.goal.rounds":`执行轮次`,"detail.goal.reason":`受阻原因`,"detail.days":`{count} 天`,"detail.hours":`{count} 小时`,"detail.minutes":`{count} 分钟`,"detail.seconds":`{count} 秒`,"detail.schedule.once":`单次`,"detail.schedule.every":`每 {interval}`,"detail.schedule.when":`计划时间`,"detail.schedule.frequency":`重复`,"detail.schedule.scheduled":`等待触发`,"detail.schedule.overdue":`已到期,等待会话恢复`,"detail.schedule.empty":`没有定时任务`,"detail.schedule.deleted":`已删除`,"detail.schedule.count":`{count} 个定时任务`,"detail.schedule.daily":`每天 {time}({zone})`,"detail.schedule.weekly":`每周 {days} {time}({zone})`,"detail.schedule.cron":`Cron {expression}({zone})`,"detail.weekday.1":`周一`,"detail.weekday.2":`周二`,"detail.weekday.3":`周三`,"detail.weekday.4":`周四`,"detail.weekday.5":`周五`,"detail.weekday.6":`周六`,"detail.weekday.7":`周日`,"detail.weekday.join":`、`,"tool.title.inspectProviders":`检查提供方`,"tool.title.queryRuntime":`查询运行时`,"tool.title.inspectPlugins":`检查动态插件`,"tool.title.workflow":`运行工作流`,"tool.title.ralph":`运行循环工作流`,"tool.title.readEvent":`读取事件`,"tool.title.searchEvents":`搜索事件`,"tool.title.traceEvent":`追踪事件`,"tool.title.searchSessions":`搜索会话`,"tool.title.traceSession":`追踪会话`,"tool.title.listModels":`查看可用模型`,"tool.title.subagent":`创建子智能体`,"tool.title.listAgents":`查看子智能体`,"tool.title.sendMessage":`发送消息`,"tool.title.interruptAgent":`中断智能体`,"tool.title.listJobs":`查看后台任务`,"tool.title.readJob":`读取任务输出`,"tool.title.killJob":`取消后台任务`,"tool.title.openTerminal":`创建终端`,"tool.title.readTerminal":`读取终端`,"tool.title.listTerminals":`查看终端`,"tool.title.signalTerminal":`发送终端信号`,"tool.title.closeTerminal":`关闭终端`,"tool.title.lsp":`查询代码符号`,"tool.title.findDefinition":`查找定义`,"tool.title.findReferences":`查找引用`,"tool.title.findImplementation":`查找实现`,"tool.title.hoverSymbol":`查看符号信息`,"tool.title.spawnTeammate":`创建队友`,"tool.title.createTeamTask":`创建团队任务`,"tool.title.getTeamTask":`读取团队任务`,"tool.title.updateTeamTask":`更新团队任务`,"tool.title.listTeamTasks":`查看团队任务`,"tool.title.waitAgent":`等待子智能体`,"detail.recordedResult":`调用结果`,"detail.empty":`暂无结果`,"detail.none":`无`,"detail.yes":`是`,"detail.no":`否`,"detail.moreInInspect":`另有 {count} 项,可在「查看」中读取`,"detail.status.running":`运行中`,"detail.status.idle":`空闲`,"detail.status.ready":`就绪`,"detail.status.inactive":`未运行`,"detail.status.provisioning":`准备中`,"detail.status.failed":`失败`,"detail.status.completed":`已完成`,"detail.status.deleted":`已删除`,"detail.status.killed":`已取消`,"detail.status.accepted":`已接收`,"detail.status.queued":`已入队`,"detail.status.exited":`已退出`,"detail.field.id":`ID`,"detail.field.revision":`版本`,"detail.field.platform":`平台`,"detail.field.provider":`提供方`,"detail.field.model":`模型`,"detail.field.role":`角色`,"detail.field.context":`上下文`,"detail.field.owner":`负责人`,"detail.field.ready":`可开始`,"detail.field.dependencies":`前置任务`,"detail.field.writeScopes":`文件范围`,"detail.field.warnings":`提示`,"detail.field.diagnostics":`诊断`,"detail.field.methods":`方法`,"detail.field.inputSchema":`输入 Schema`,"detail.field.outputSchema":`输出 Schema`,"detail.field.currentPackage":`当前包`,"detail.field.nextPackage":`待运行的包`,"detail.field.latestRun":`最近运行`,"detail.field.packages":`版本包`,"detail.field.registrations":`注册项`,"detail.field.props":`属性`,"detail.field.data":`数据`,"detail.field.source":`来源`,"detail.field.content":`内容`,"detail.field.message":`消息`,"detail.field.messageId":`消息 ID`,"detail.field.root":`根节点`,"detail.field.pid":`进程 ID`,"detail.field.type":`类型`,"detail.field.time":`时间`,"detail.field.seq":`事件序号`,"detail.field.turn":`轮次`,"detail.field.step":`步骤`,"detail.field.callId":`调用 ID`,"detail.field.agents":`启动智能体数`,"detail.field.result":`结果`,"detail.field.parent":`父级`,"detail.field.depth":`层级`,"detail.field.exitCode":`退出码`,"detail.field.signal":`信号`,"detail.field.previousStatus":`中断前状态`,"detail.field.agent":`智能体 ID`,"detail.field.job":`任务 ID`,"detail.field.task":`任务内容`,"detail.field.processGroup":`进程组`,"detail.field.availability":`可用状态`,"detail.field.bestMatch":`最相关事件`,"detail.field.target":`目标事件`,"detail.field.surface":`记录状态`,"detail.agents.count":`{count} 个智能体`,"detail.jobs.count":`{count} 个后台任务`,"detail.terminals.count":`{count} 个终端`,"detail.tasks.count":`{count} 个团队任务`,"detail.tasks.nextPage":`后面还有任务;下一页位置为 {cursor}`,"detail.locations.count":`{count} 个位置`,"detail.location":`第 {line} 行,第 {column} 列`,"detail.receipt.delivered":`消息已送达`,"detail.receipt.interrupt":`已请求中断`,"detail.receipt.started":`已启动`,"detail.receipt.cancel":`已请求取消`,"detail.receipt.alreadyFinished":`任务已结束`,"detail.receipt.signal":`信号已发送`,"detail.receipt.closed":`已关闭`,"detail.receipt.closing":`关闭中`,"detail.wait.noProgress":`没有正在运行的子智能体`,"detail.wait.title":`子智能体状态`,"detail.wait.timeout":`等待超时`,"detail.wait.changed":`检测到变化`,"detail.agent.reply":`智能体回复`,"detail.models.title":`可用模型`,"detail.output.lines":`第 {begin}–{end} 行,共 {total} 行`,"detail.output.truncated":`输出已截断`,"detail.providers.count":`{count} 个检查提供方`,"detail.plugins.count":`{count} 个动态插件`,"detail.workflow.script":`工作流脚本`,"detail.ralph.reportedComplete":`智能体报告完成`,"detail.ralph.reportedBlocker":`智能体报告受阻`,"detail.ralph.limit":`已达到轮次上限`,"detail.report.nextSteps":`待完成事项`,"detail.trace.replacedBy":`被替换为`,"detail.trace.replacementChain":`替换链`,"detail.trace.replaces":`替换的事件`,"detail.trace.sources":`引用来源`,"detail.trace.derived":`派生事件`,"detail.trace.ancestors":`祖先会话`,"detail.trace.descendants":`后代会话`,"detail.matches.count":`{count} 条匹配`,"detail.matches.capped":`已达到结果上限,可缩小搜索范围`,"detail.event.neighbors":`前后事件`,"todo.completed":`{done}/{total} 已完成`,"command.attachmentsUnsupported":`/{command} 不接受附件,请先移除附件`,"ask.rowTitle":`提问`,"ask.waiting":`等待回答`,"ask.pending":`已继续工作,仍可回答`,"ask.pendingDetail":`等待中的问题仍可在输入框中回答`,"ask.reopen":`回答`,"ask.review":`查看回答`,"ask.closed":`已结束`,"ask.closedDetail":`该问题已结束,结果见下方对话`,"ask.cancelled":`已取消`,"ask.cancelledDetail":`本轮已取消,未提交回答`,"ask.interrupted":`已中断`,"ask.interruptedDetail":`本轮已中断,未提交回答`,"ask.answered":`{answered}/{total} 已回答`,"ask.skipped":`未回答`,"bash.running":`运行中`,"bash.failed":`失败`,"bash.stopped":`已停止`,"tool.output.showFull":`显示完整输出(共 {size} KB)`,"tool.output.loading":`正在加载完整输出…`,"tool.output.retry":`重试加载完整输出`,"tool.output.failed":`加载失败,请重试。`,"tool.output.stale":`工具输出已变化,请刷新会话。`,"row.running":`运行中`,"row.preparing":`正在准备调用`,"row.failed":`失败`,"row.stopped":`已停止`,"row.input":`输入`,"row.output":`输出`,"row.inspect":`查看`,"tool.title.search":`搜索`,"tool.title.read":`读取`,"tool.title.bash":`运行命令`,"tool.title.write":`写入`,"tool.title.edit":`编辑`,"tool.title.filesChanging":`{count} 个文件已更改`,"tool.title.filesEdited":`已编辑 {count} 个文件`,"tool.title.code":`代码`,"tool.title.generic":`工具调用`,"tool.contextCompaction.action":`压缩上下文`,"tool.contextCompaction.running":`正在压缩…`,"tool.contextCompaction.completed":`上下文已压缩`,"tool.title.inspect":`查询 Cordis 环境`,"tool.title.runCordis":`运行 Cordis 插件`,"tool.title.stopCordis":`停止 Cordis 插件`,"tool.title.removeCordis":`移除 Cordis 插件`,"tool.title.pwsh":`运行命令`,"tool.title.readImage":`读取图片`,"tool.title.grep":`搜索文件内容`,"tool.title.glob":`查找文件`,"tool.title.webSearch":`网页搜索`,"tool.title.webFetch":`网页获取`,"tool.autoReviewRejected":`Auto review 已拒绝`,"tool.autoReviewNotExecuted":`工具未执行。原因:{reason}`,"tool.autoReviewReasonFallback":`Auto review 未授权此次操作`,"diff.collapseAria":`收起差异`,"diff.expandAria":`展开其余 {count} 行差异`,"diff.expandRest":`… 其余 {count} 行`,"read.window":`显示 {shown} / {total} 行`,"read.collapseAria":`收起内容`,"read.expandAria":`展开其余 {count} 行`,"read.expandRest":`… 其余 {count} 行`,"search.paths":`{shown} 个路径`,"search.paths.truncated":`显示 {shown} / 共 {total} 个路径`,"search.matches":`{shown} 处匹配 · {files} 个文件`,"search.matches.truncated":`显示 {shown} / 共 {total} 处匹配 · {files} 个文件`,"search.noResults":`无结果`,"search.collapseAria":`收起结果`,"search.expandAria":`展开其余 {count} 行结果`,"search.expandRest":`… 其余 {count} 行`,"web.noResults":`未找到结果`,"web.sourcesTruncated":`来源列表已截断`,"web.http":`HTTP`,"web.contentTruncated":`内容已截断`,"details.running":`运行中…`,"queue.count":`{n} 条排队消息`,"queue.sending":`发送中…`,"queue.image":`排队消息图片`,"queue.file":`排队文件 {name}`,"queue.edit":`编辑排队消息`,"queue.edit.unsupported":`包含非文本内容,暂不支持编辑`,"queue.save":`保存排队消息`,"queue.cancelEdit":`取消编辑`,"queue.remove":`删除排队消息`,"queue.steer":`插话发送`,"queue.steer.unavailable":`仅运行中可插话发送`,"queue.resume":`继续队列`,"queue.paused.interrupted":`队列已因你中断当前任务而暂停。请选择一条继续。`,"queue.paused.unknown":`任务结果未知,队列已暂停且不会自动重试。`,"queue.paused.failed":`上一项未正常完成,队列已暂停。`,"error.sessionInUse":`当前会话已被占用,可能是其他正在运行的 DSH 导致的(如其他 dsh web、桌面端),请退出其他正在运行的 DSH 后重试。`,"queue.editFailed":`编辑失败:这条消息可能已经开始发送。`,"queue.removeFailed":`删除失败:这条消息可能已经开始发送。`,"queue.steerFailed":`插话发送失败,请重试。`,"queue.resumeFailed":`继续队列失败,请重试。`,"terminal.signal":`信号 {signal}`,"terminal.exitCode":`退出码 {code}`,"terminal.noExitCode":`未正常退出`,"terminal.running":`运行中`,"terminal.failed":`失败`,"terminal.done":`已完成`,"terminal.noOutput":`无输出`,"terminal.collapseAria":`收起输出`,"terminal.expandAria":`展开其余 {n} 行输出`,"terminal.expandRest":`… 其余 {n} 行`,"terminal.sendInput":`(发送输入)`,"terminal.session":`终端 {sessionId}`},Yb={"shortcut.newline":`New line`,"shortcut.complementary":`Use the complementary Queue / Steer action`,"shortcut.slash":`Open command menu`,"shortcut.mention":`Open reference menu`,"hint.plan":qb,"hint.goal":`describe the objective for a long-running task`,"hint.goal.active":`goal active — edit / pause / resume / clear`,"placeholder.plan":qb,"placeholder.default":`Message or run a task, / commands, @ files or sessions`,"placeholder.unavailable":`Session unavailable`,"placeholder.parentOffline":`Parent session offline; sending is unavailable but you can still stop the run`,"placeholder.hero":`Describe what you want to build, / commands, @ files or sessions`,"placeholder.workspace":`Choose a workspace to start`,"placeholder.preparing":`Preparing conversation…`,"placeholder.steerQueue":`Cmd/Ctrl+Enter steers all queued messages`,"input.commands":`Add files or run commands`,"input.commandsOnly":`Run commands`,"input.imagesAndCommands":`Add images or run commands`,"attachment.unavailable":`Attachment uploads are unavailable on this Web connection.`,"input.file":`File`,"input.stop":`Stop generating`,"input.send":`Send message`,"input.send.queue":`Queue message`,"input.send.steer":`Steer message`,"attachment.pending":`Pending attachments`,"attachment.scrollLeft":`Scroll attachments left`,"attachment.scrollRight":`Scroll attachments right`,"reference.dropTitle":`Release to reference chat`,"attachment.dropTitle":`Drag files or images here to add them`,"attachment.dropDesc":`Image limit: up to {count} images, {size} each`,"attachment.dropBlocked":`Files and images cannot be added right now`,"attachment.directoryDesktopOnly":`Folders can only be added in the desktop app; add individual files in the browser`,"attachment.pathUnavailable":`Could not obtain the folder path; drag it in again`,"attachment.pathUnsupported":`The path contains characters a reference cannot carry; rename it and try again`,"image.pending":`Pending images`,"image.openOriginal":`View original`,"image.openOriginalLabel":`{label}, click to view original`,"image.remove":`Remove image {name}`,"image.original":`Original image`,"image.label":`Image`,"image.loadFailed":`Image unavailable; click to retry`,"image.loading":`Loading image…`,"image.preview":`Original image preview`,"image.closePreview":`Close original image preview`,"image.unsupportedType":`Only PNG, JPG, WebP, and GIF images are supported`,"image.tooMany":`A message can include up to {count} images`,"image.fileTooLarge":`Each image must be smaller than {size}`,"image.totalTooLarge":`Images exceed {size} in total; remove some and try again`,"image.tooManyPixels":`Image resolution is too high; compress it and try again`,"image.dimensionTooLarge":`Image sides must be at most {size}px; downscale it and try again`,"image.modelUnsupported":`The current model does not support images; switch to a model that does`,"image.sendFailed":`Sending images failed ({reason}); re-add them and try again`,"file.unavailable":`The uploaded file is unavailable or changed; select it again`,"file.pending":`Pending files`,"file.remove":`Remove file {name}`,"file.uploading":`Uploading…`,"file.uploadFailed":`Upload failed; click to retry`,"file.retry":`Retry uploading {name}`,"file.stillUploading":`Files are still uploading; send after they finish`,"file.sessionUnavailable":`Session unavailable; files cannot be uploaded`,"file.notStaged":`The file has not finished uploading; re-add it and try again`,"file.label":`File`,"context.aria":`{percent} of context used`,"context.used":`of context used`,"context.system":`System prompt`,"context.tools":`Tool definitions`,"context.messages":`Messages`,"settings.enter.title":`Send behavior while busy`,"settings.enter.description":`What Enter and the Send button do while the agent is running; Cmd/Ctrl+Enter uses the other behavior`,"settings.enter.queue":`Queue`,"settings.enter.steer":`Steer`,"hero.headline":`What should we build today?`,"hero.preview":`Web`,"hero.chooseWorkspace":`Choose workspace`,"hero.noWorkspace":`No workspace`,"session.hierarchy":`Session hierarchy`,"todo.title":`To-dos`,"todo.progress.done":`{done} completed`,"todo.progress.active":`{active} in progress`,"todo.progress.pending":`{pending} pending`,"todo.status.completed":`Completed`,"todo.status.inProgress":`In progress`,"todo.status.pending":`Pending`,"todo.rowTitle":`Update to-do list`,"tool.title.createGoal":`Create goal`,"tool.title.getGoal":`View goal`,"tool.title.updateGoal":`Update goal`,"tool.preparing.content":`{kilobytes}KB`,"tool.title.createSchedule":`Create reminder`,"tool.title.listSchedules":`List reminders`,"tool.title.deleteSchedule":`Delete reminder`,"tool.title.updateSchedule":`Update reminder`,"detail.state":`Status`,"detail.todo.completed":`Completed`,"detail.todo.in_progress":`In progress`,"detail.todo.pending":`Pending`,"detail.todo.empty":`The to-do list is empty`,"todo.diff.initial":`Initial list`,"todo.diff.compare":`Changes since the previous list`,"todo.diff.unavailable":`Previous list unavailable`,"todo.diff.noChanges":`No changes to the list`,"todo.diff.added":`{count} added`,"todo.diff.updated":`{count} updated`,"todo.diff.removed":`{count} removed`,"todo.diff.unchanged":`{count} unchanged`,"todo.diff.addedItem":`Added`,"todo.diff.updatedItem":`Status changed`,"todo.diff.movedItem":`Reordered`,"todo.diff.removedItem":`Removed`,"detail.goal.empty":`No goal`,"detail.goal.active":`Active`,"detail.goal.disarmed":`Awaiting continuation`,"detail.goal.paused":`Paused`,"detail.goal.blocked":`Blocked`,"detail.goal.complete":`Completed`,"detail.goal.rounds":`Rounds`,"detail.goal.reason":`Blocker`,"detail.days":`{count} d`,"detail.hours":`{count} h`,"detail.minutes":`{count} min`,"detail.seconds":`{count} s`,"detail.schedule.once":`Once`,"detail.schedule.every":`Every {interval}`,"detail.schedule.when":`Scheduled for`,"detail.schedule.frequency":`Repeat`,"detail.schedule.scheduled":`Scheduled`,"detail.schedule.overdue":`Overdue, awaiting session resume`,"detail.schedule.empty":`No reminders`,"detail.schedule.deleted":`Deleted`,"detail.schedule.count":`{count} reminders`,"detail.schedule.daily":`Every day at {time} ({zone})`,"detail.schedule.weekly":`Weekly on {days} at {time} ({zone})`,"detail.schedule.cron":`Cron {expression} ({zone})`,"detail.weekday.1":`Mon`,"detail.weekday.2":`Tue`,"detail.weekday.3":`Wed`,"detail.weekday.4":`Thu`,"detail.weekday.5":`Fri`,"detail.weekday.6":`Sat`,"detail.weekday.7":`Sun`,"detail.weekday.join":`, `,"tool.title.inspectProviders":`Inspect providers`,"tool.title.queryRuntime":`Query runtime`,"tool.title.inspectPlugins":`Inspect plugins`,"tool.title.workflow":`Run workflow`,"tool.title.ralph":`Run ralph loop`,"tool.title.readEvent":`Read event`,"tool.title.searchEvents":`Search events`,"tool.title.traceEvent":`Trace event`,"tool.title.searchSessions":`Search sessions`,"tool.title.traceSession":`Trace session`,"tool.title.listModels":`List models`,"tool.title.subagent":`Create subagent`,"tool.title.listAgents":`List subagents`,"tool.title.sendMessage":`Send message`,"tool.title.interruptAgent":`Interrupt agent`,"tool.title.listJobs":`List background jobs`,"tool.title.readJob":`Read job output`,"tool.title.killJob":`Cancel background job`,"tool.title.openTerminal":`Open terminal`,"tool.title.readTerminal":`Read terminal`,"tool.title.listTerminals":`List terminals`,"tool.title.signalTerminal":`Signal terminal`,"tool.title.closeTerminal":`Close terminal`,"tool.title.lsp":`Query code symbols`,"tool.title.findDefinition":`Find definition`,"tool.title.findReferences":`Find references`,"tool.title.findImplementation":`Find implementation`,"tool.title.hoverSymbol":`Inspect symbol`,"tool.title.spawnTeammate":`Create teammate`,"tool.title.createTeamTask":`Create team task`,"tool.title.getTeamTask":`Read team task`,"tool.title.updateTeamTask":`Update team task`,"tool.title.listTeamTasks":`List team tasks`,"tool.title.waitAgent":`Wait for subagent`,"detail.recordedResult":`Recorded result`,"detail.empty":`No results`,"detail.none":`None`,"detail.yes":`Yes`,"detail.no":`No`,"detail.moreInInspect":`{count} more items available in Inspect`,"detail.status.running":`Running`,"detail.status.idle":`Idle`,"detail.status.ready":`Ready`,"detail.status.inactive":`Inactive`,"detail.status.provisioning":`Provisioning`,"detail.status.failed":`Failed`,"detail.status.completed":`Completed`,"detail.status.deleted":`Deleted`,"detail.status.killed":`Cancelled`,"detail.status.accepted":`Accepted`,"detail.status.queued":`Queued`,"detail.status.exited":`Exited`,"detail.field.id":`ID`,"detail.field.revision":`Revision`,"detail.field.platform":`Platform`,"detail.field.provider":`Provider`,"detail.field.model":`Model`,"detail.field.role":`Role`,"detail.field.context":`Context`,"detail.field.owner":`Owner`,"detail.field.ready":`Ready`,"detail.field.dependencies":`Dependencies`,"detail.field.writeScopes":`Write scopes`,"detail.field.warnings":`Warnings`,"detail.field.diagnostics":`Diagnostics`,"detail.field.methods":`Methods`,"detail.field.inputSchema":`Input schema`,"detail.field.outputSchema":`Output schema`,"detail.field.currentPackage":`Current package`,"detail.field.nextPackage":`Next package`,"detail.field.latestRun":`Latest run`,"detail.field.packages":`Packages`,"detail.field.registrations":`Registrations`,"detail.field.props":`Props`,"detail.field.data":`Data`,"detail.field.source":`Source`,"detail.field.content":`Content`,"detail.field.message":`Message`,"detail.field.messageId":`Message ID`,"detail.field.root":`Root`,"detail.field.pid":`Process ID`,"detail.field.type":`Type`,"detail.field.time":`Time`,"detail.field.seq":`Event sequence`,"detail.field.turn":`Turn`,"detail.field.step":`Step`,"detail.field.callId":`Call ID`,"detail.field.agents":`Agents started`,"detail.field.result":`Result`,"detail.field.parent":`Parent`,"detail.field.depth":`Depth`,"detail.field.exitCode":`Exit code`,"detail.field.signal":`Signal`,"detail.field.previousStatus":`Previous status`,"detail.field.agent":`Agent ID`,"detail.field.job":`Job ID`,"detail.field.task":`Task`,"detail.field.processGroup":`Process group`,"detail.field.availability":`Availability`,"detail.field.bestMatch":`Best match`,"detail.field.target":`Target event`,"detail.field.surface":`Record status`,"detail.agents.count":`{count} agents`,"detail.jobs.count":`{count} background jobs`,"detail.terminals.count":`{count} terminals`,"detail.tasks.count":`{count} team tasks`,"detail.tasks.nextPage":`More tasks available; next cursor is {cursor}`,"detail.locations.count":`{count} locations`,"detail.location":`Line {line}, column {column}`,"detail.receipt.delivered":`Message delivered`,"detail.receipt.interrupt":`Interrupt requested`,"detail.receipt.started":`Started`,"detail.receipt.cancel":`Cancellation requested`,"detail.receipt.alreadyFinished":`Already finished`,"detail.receipt.signal":`Signal delivered`,"detail.receipt.closed":`Closed`,"detail.receipt.closing":`Closing`,"detail.wait.noProgress":`No active subagents`,"detail.wait.title":`Subagent activity`,"detail.wait.timeout":`Wait timed out`,"detail.wait.changed":`Change detected`,"detail.agent.reply":`Agent response`,"detail.models.title":`Available models`,"detail.output.lines":`Lines {begin}–{end} of {total}`,"detail.output.truncated":`Output truncated`,"detail.providers.count":`{count} inspect providers`,"detail.plugins.count":`{count} dynamic plugins`,"detail.workflow.script":`Workflow script`,"detail.ralph.reportedComplete":`Worker reported completion`,"detail.ralph.reportedBlocker":`Worker reported a blocker`,"detail.ralph.limit":`Round limit reached`,"detail.report.nextSteps":`Remaining work`,"detail.trace.replacedBy":`Replaced by`,"detail.trace.replacementChain":`Replacement chain`,"detail.trace.replaces":`Replaced events`,"detail.trace.sources":`Source events`,"detail.trace.derived":`Derived events`,"detail.trace.ancestors":`Ancestor sessions`,"detail.trace.descendants":`Descendant sessions`,"detail.matches.count":`{count} matches`,"detail.matches.capped":`Result limit reached; narrow the search for more`,"detail.event.neighbors":`Surrounding events`,"todo.completed":`{done}/{total} completed`,"command.attachmentsUnsupported":`/{command} does not accept attachments; remove them first`,"ask.rowTitle":`Ask question`,"ask.waiting":`waiting`,"ask.pending":`continued; answer still available`,"ask.pendingDetail":`These pending questions remain answerable from the composer.`,"ask.reopen":`Answer`,"ask.review":`View answers`,"ask.closed":`closed`,"ask.closedDetail":`This question is closed; its outcome is in the conversation below.`,"ask.cancelled":`cancelled`,"ask.cancelledDetail":`This question set was cancelled before answers were submitted.`,"ask.interrupted":`interrupted`,"ask.interruptedDetail":`This question set was interrupted before answers were submitted.`,"ask.answered":`{answered}/{total} answered`,"ask.skipped":`Not answered`,"bash.running":`Running`,"bash.failed":`Failed`,"bash.stopped":`Stopped`,"tool.output.showFull":`Show full output ({size} KB total)`,"tool.output.loading":`Loading full output…`,"tool.output.retry":`Retry loading full output`,"tool.output.failed":`Could not load output. Please retry.`,"tool.output.stale":`Tool output changed. Refresh the conversation.`,"row.running":`Running`,"row.preparing":`Preparing tool call`,"row.failed":`Failed`,"row.stopped":`Stopped`,"row.input":`IN`,"row.output":`OUT`,"row.inspect":`Inspect`,"tool.title.search":`Search`,"tool.title.read":`Read`,"tool.title.bash":`Bash`,"tool.title.write":`Write`,"tool.title.edit":`Edit`,"tool.title.filesChanging":`{count} files changed`,"tool.title.filesEdited":`Edited {count} files`,"tool.title.code":`Code`,"tool.title.generic":`Tool call`,"tool.contextCompaction.action":`Compact context`,"tool.contextCompaction.running":`Compacting context…`,"tool.contextCompaction.completed":`Context compacted`,"tool.title.inspect":`Query Cordis environment`,"tool.title.runCordis":`Run Cordis Plugin`,"tool.title.stopCordis":`Stop Cordis Plugin`,"tool.title.removeCordis":`Remove Cordis Plugin`,"tool.title.pwsh":`Pwsh`,"tool.title.readImage":`Read image`,"tool.title.grep":`Grep`,"tool.title.glob":`Glob`,"tool.title.webSearch":`Search`,"tool.title.webFetch":`Fetch`,"tool.autoReviewRejected":`Rejected by Auto review`,"tool.autoReviewNotExecuted":`Tool was not executed. Reason: {reason}`,"tool.autoReviewReasonFallback":`Auto review did not authorize this action`,"diff.collapseAria":`Collapse diff`,"diff.expandAria":`Expand {count} more diff lines`,"diff.expandRest":`… {count} more lines`,"read.window":`Showing {shown} of {total} lines`,"read.collapseAria":`Collapse content`,"read.expandAria":`Expand {count} more lines`,"read.expandRest":`… {count} more lines`,"search.paths":`{shown} paths`,"search.paths.truncated":`Showing {shown} of {total} paths`,"search.matches":`{shown} matches · {files} files`,"search.matches.truncated":`Showing {shown} of {total} matches · {files} files`,"search.noResults":`No results`,"search.collapseAria":`Collapse results`,"search.expandAria":`Expand {count} more result lines`,"search.expandRest":`… {count} more lines`,"web.noResults":`No results found`,"web.sourcesTruncated":`Source list truncated`,"web.http":`HTTP`,"web.contentTruncated":`Content truncated`,"details.running":`Running…`,"queue.count":`{n} queued messages`,"queue.sending":`Sending…`,"queue.image":`Queued message image`,"queue.file":`Queued file {name}`,"queue.edit":`Edit queued message`,"queue.edit.unsupported":`Contains non-text content; editing is not supported yet`,"queue.save":`Save queued message`,"queue.cancelEdit":`Cancel editing`,"queue.remove":`Remove queued message`,"queue.steer":`Steer queued message`,"queue.steer.unavailable":`Steering is available only while the agent is running`,"queue.resume":`Resume queue`,"queue.paused.interrupted":`Queue paused because you interrupted. Choose a message to resume.`,"queue.paused.unknown":`Outcome unknown. The queue is paused and will not retry automatically.`,"queue.paused.failed":`The previous turn did not finish normally. The queue is paused.`,"error.sessionInUse":`This session is already in use, possibly by another running DSH instance (such as dsh web or the desktop app). Quit other running DSH instances and try again.`,"queue.editFailed":`Edit failed: this message may have already started sending.`,"queue.removeFailed":`Removal failed: this message may have already started sending.`,"queue.steerFailed":`Steering failed. Try again.`,"queue.resumeFailed":`Could not resume the queue. Try again.`,"terminal.signal":`signal {signal}`,"terminal.exitCode":`exit code {code}`,"terminal.noExitCode":`no exit code`,"terminal.running":`Running`,"terminal.failed":`Failed`,"terminal.done":`Done`,"terminal.noOutput":`No output`,"terminal.collapseAria":`Collapse output`,"terminal.expandAria":`Expand the remaining {n} output lines`,"terminal.expandRest":`… {n} more lines`,"terminal.sendInput":`(send input)`,"terminal.session":`Terminal {sessionId}`},Xb=`@deepseek-ai/dsh-client-ui-conversation/QueueDock.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Xb)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=Xb,e.textContent=`._45elva_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}._45elva_panel{isolation:isolate;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}._45elva_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}._45elva_panel:after{border:.5px solid var(--dsw-alias-border-l1);border-radius:inherit;content:"";pointer-events:none;border-bottom:none;position:absolute;inset:0}._45elva_paused{color:var(--dsw-alias-label-tertiary);font:var(--dsw-font-xs-13);padding:6px 12px 2px}._45elva_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}._45elva_header:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}._45elva_header:disabled{cursor:default}._45elva_lead{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}._45elva_count{min-width:0;font-family:Inter, var(--dsw-font-family);flex:auto;font-size:13px;font-weight:500;line-height:24px}._45elva_chevron{width:14px;height:14px;color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}._45elva_list{max-height:180px;margin:0;padding:0;list-style:none;overflow-y:auto}._45elva_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}._45elva_row+._45elva_row{box-shadow:inset 0 1px 0 var(--dsw-alias-border-l1)}._45elva_attachments{flex:none;gap:4px;min-width:0;max-width:55%;display:flex;overflow:hidden}._45elva_pendingRow ._45elva_attachments{flex-shrink:1}._45elva_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}._45elva_fileIcon{flex:none;width:16px;height:16px;display:inline-flex}._45elva_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}._45elva_fileSize{color:var(--dsw-alias-label-tertiary);white-space:nowrap;flex:none;font-size:10px}._45elva_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}._45elva_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}._45elva_actions{flex:none;align-items:center;gap:10px;display:flex}._45elva_status{color:var(--dsw-alias-label-tertiary);font:var(--dsw-font-xs-13);white-space:nowrap;flex:none}._45elva_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}._45elva_action:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}._45elva_action:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-2px}._45elva_action:disabled{cursor:default;opacity:.45}`,document.head.appendChild(e)}var Z={action:`_45elva_action`,actions:`_45elva_actions`,attachments:`_45elva_attachments`,chevron:`_45elva_chevron`,count:`_45elva_count`,dock:`_45elva_dock`,file:`_45elva_file`,fileIcon:`_45elva_fileIcon`,fileName:`_45elva_fileName`,fileSize:`_45elva_fileSize`,header:`_45elva_header`,lead:`_45elva_lead`,list:`_45elva_list`,panel:`_45elva_panel`,paused:`_45elva_paused`,pendingRow:`_45elva_pendingRow`,preview:`_45elva_preview`,row:`_45elva_row`,status:`_45elva_status`,thumb:`_45elva_thumb`};let Zb=[];function Qb(e){let t=e.filter(e=>e.type!==`image`&&e.type!==`file`).map(e=>e.type===`text`?e.text:`[${e.type}]`).join(` `).replace(/\s+/g,` `).trim(),n=Array.from(t);return n.length>200?`${n.slice(0,200).join(``)}…`:t}function $b(e){return e.every(e=>e.type===`text`)?e.map(e=>e.text).join(``):null}function ex(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 tx({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 nx({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 rx({useSession:e,useProjection:t,updateQueue:n,editQueue:r,notify:i,loadImage:a,t:o}){let s=t(`inbox`),c=t(`queueState`),l=e(e=>e.pendingSubmissions),u=(0,g.useMemo)(()=>{let e=s?.[`next-turn`]??Zb,t=new Set(l.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))},[s,l]),f=(0,g.useMemo)(()=>{let e=new Set(u.flatMap(({source:e})=>e.kind===`user`&&`rpcId`in e?[e.rpcId]:[]));return l.filter(t=>t.placement===`queued`&&!e.has(t.requestId))},[l,u]),p=u.length+f.length,m=e(e=>e.running),_=e(e=>e.subagent===null||e.subagent.address.mode===`continuable`),v=(0,g.useRef)(!1),[y,ee]=(0,g.useState)(null),[b,x]=(0,g.useState)(!0),S=(0,g.useId)(),te=c?.pausedReason??null,ne=te===`interrupted`?o(`queue.paused.interrupted`):te===`outcome-unknown`?o(`queue.paused.unknown`):te===`failed`?o(`queue.paused.failed`):null;if((0,g.useEffect)(()=>{p===0&&!b&&x(!0)},[b,p]),p===0)return null;let re=_&&y!==null,ie=!b||re,ae=p===1||ie,oe=async(e,t,r)=>{if(v.current)return!1;v.current=!0,ee(e);try{return typeof t==`function`?await t():await n(e,t),!0}catch{return i(`error`,r),!1}finally{v.current=!1,ee(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:[ne!==null&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:Z.paused,role:`status`,children:ne}),p>1&&/* @__PURE__ */ (0,h.jsxs)(`button`,{type:`button`,className:Z.header,"aria-controls":S,"aria-expanded":ie,disabled:re,onClick:()=>{x(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:o(`queue.count`,{n:p})}),!ae&&f.length>0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.status,role:`status`,children:o(`queue.sending`)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.chevron,"aria-hidden":!0,children:ie?/* @__PURE__ */ (0,h.jsx)(d.IconChevronDownOutlineRegular,{}):/* @__PURE__ */ (0,h.jsx)(d.IconChevronUpOutlineRegular,{})})]}),/* @__PURE__ */ (0,h.jsxs)(`ul`,{id:S,className:Z.list,hidden:!ae,children:[ae&&u.map(e=>{let t=ex(e.content),n=$b(e.content);return/* @__PURE__ */ (0,h.jsxs)(`li`,{className:Z.row,children:[p===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)(nx,{attachment:e.attachment,loadImage:a,label:o(`queue.image`)},`${e.attachment.attachmentId}:${t}`):/* @__PURE__ */ (0,h.jsx)(tx,{attachment:e.attachment,label:o(`queue.file`,{name:e.attachment.name})},`${e.attachment.attachmentId}:${e.attachment.name}:${t}`))}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.preview,children:(0,d.projectUserText)(Qb(e.content),[])}),_&&/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Z.actions,children:[/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:!0,label:o(`queue.edit`),side:`bottom`,delayMs:500,disabled:n===null,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Z.action,"aria-label":o(`queue.edit`),title:n===null?o(`queue.edit.unsupported`):void 0,disabled:y!==null||n===null,onClick:()=>{n!==null&&oe(e.id,()=>r(e.id,n),o(`queue.editFailed`))},children:/* @__PURE__ */ (0,h.jsx)(d.IconEditOutlineRegular,{size:14})})}),/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:!0,label:o(`queue.remove`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Z.action,"aria-label":o(`queue.remove`),disabled:y!==null,onClick:()=>{oe(e.id,{kind:`remove`},o(`queue.removeFailed`))},children:/* @__PURE__ */ (0,h.jsx)(d.IconTrashOutlineRegular,{size:14})})}),/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:!0,label:o(m?`queue.steer`:`queue.resume`),side:`bottom`,delayMs:500,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Z.action,"aria-label":o(m?`queue.steer`:`queue.resume`),disabled:y!==null,onClick:()=>{oe(e.id,{kind:`steer`},o(m?`queue.steerFailed`:`queue.resumeFailed`))},children:/* @__PURE__ */ (0,h.jsx)(d.IconSendOutlineRegular,{})})})]})]},e.id)}),ae&&f.map(e=>/* @__PURE__ */ (0,h.jsxs)(`li`,{className:`${Z.row} ${Z.pendingRow}`,"data-submission-echo":``,children:[p===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)=>e.type===`image`?/* @__PURE__ */ (0,h.jsx)(`img`,{className:Z.thumb,src:e.value.previewUrl,alt:o(`queue.image`)},`${e.value.previewUrl}:${t}`):/* @__PURE__ */ (0,h.jsx)(tx,{attachment:e.value,label:o(`queue.file`,{name:e.value.name})},`${e.value.attachmentId}:${e.value.name}:${t}`))}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.preview,children:(0,d.projectUserText)(e.text,[])}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Z.status,role:`status`,children:o(`queue.sending`)}),_&&/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Z.actions,children:[/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Z.action,"aria-label":o(`queue.edit`),title:o(`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":o(`queue.remove`),title:o(`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":o(`queue.steer`),title:o(`queue.sending`),disabled:!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconSendOutlineRegular,{})})]})]},e.requestId))]})]})})}let ix={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:Gb,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`);return{updateQueue:(e,t)=>i.updateQueue(e,t),editQueue:async(e,r)=>{let a=t.shell(n);await i.updateQueue(e,{kind:`remove`});let o=a.draftSnapshot;a.setDraft({...o,text:o.text===``?r:`${o.text}\n${r}`}),a.actions.persistDraft(),a.focus()},notify:(e,t)=>{i.input.for(r).notify(e,t)},loadImage:t=>e.uiConversation.imageUrl(n,t)}}},rx))}},ax=`@deepseek-ai/dsh-client-ui-conversation/EnterBehaviorRow.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(ax)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=ax,e.textContent=`.KaT34W_row{border-bottom:.5px solid var(--dsw-alias-border-l2);align-items:center;gap:8px;padding:16px 0;display:flex}.KaT34W_rowText{flex-direction:column;flex:1;gap:4px;min-width:0;padding-right:48px;display:flex}.KaT34W_title{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:400;line-height:22px}.KaT34W_desc{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:400;line-height:18px}.KaT34W_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}.KaT34W_selector:hover{background:var(--dsw-alias-interactive-bg-hover)}.KaT34W_chevron{flex:none}`,document.head.appendChild(e)}var ox={chevron:`KaT34W_chevron`,desc:`KaT34W_desc`,row:`KaT34W_row`,rowText:`KaT34W_rowText`,selector:`KaT34W_selector`,title:`KaT34W_title`};let sx=[{id:`queue`,label:`settings.enter.queue`},{id:`steer`,label:`settings.enter.steer`}];function cx({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:ox.row,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:ox.rowText,children:[/* @__PURE__ */ (0,h.jsx)(`div`,{className:ox.title,children:n(`settings.enter.title`)}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:ox.desc,children:n(`settings.enter.description`)})]}),/* @__PURE__ */ (0,h.jsx)(d.Menu,{open:i,onClose:()=>{a(!1)},items:sx.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:ox.selector,"aria-haspopup":`menu`,"aria-expanded":i,onClick:()=>{a(e=>!e)},children:[n(o),/* @__PURE__ */ (0,h.jsx)(d.IconChevronDownOutlineRegular,{className:ox.chevron})]})})]})}let lx={views:{get:()=>void 0,grouped:()=>void 0},activeTargets:/* @__PURE__ */ new Set};function ux(e,t){return t.activeTargets.size>0||!e.blank&&!e.awaitingFirstTurn||e.running?`active`:e.promptAttempted?`engaging`:`blank`}let dx=`@deepseek-ai/dsh-client-ui-conversation/ConversationRoot.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(dx)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=dx,e.textContent=`.ofIY9G_root{background:var(--dsw-alias-bg-base);flex-direction:column;min-width:0;height:100%;display:flex;position:relative}.ofIY9G_header{box-sizing:border-box;border-bottom:.5px solid var(--dsw-alias-border-l3);flex:none;grid-template-columns:auto minmax(0,1fr);min-height:76px;padding:10px 28px 0 20px;display:grid}.ofIY9G_header:where(:not(:has(.ofIY9G_tabs))){min-height:0;padding-bottom:10px}.ofIY9G_headerBlank{border-bottom:none;min-height:0;padding-bottom:0}.ofIY9G_headerBlank .ofIY9G_headerCorner{margin-left:auto}html:not([data-platform=darwin]) .ofIY9G_headerSessionless{padding-top:0}html:not([data-platform=darwin]) .ofIY9G_headerSessionless .ofIY9G_titleRow{min-height:0}[data-platform=darwin] .ofIY9G_headerLeading,[data-platform=darwin] .ofIY9G_headerActions,[data-platform=darwin] .ofIY9G_headerUtilities,[data-platform=darwin] .ofIY9G_headerCorner{-webkit-app-region:no-drag}.ofIY9G_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}.ofIY9G_titleCluster{flex:1;align-items:center;gap:10px;min-width:0;display:flex}.ofIY9G_headerLeading{flex:none;grid-area:1/1;align-items:center;gap:8px;display:flex}.ofIY9G_crumbs{white-space:nowrap;align-items:center;gap:4px;min-width:0;display:flex;overflow:hidden}.ofIY9G_crumbSeg{align-items:center;gap:4px;min-width:0;display:inline-flex}.ofIY9G_crumbSep{color:var(--dsw-alias-label-caption);font-size:14px;line-height:20px}.ofIY9G_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}.ofIY9G_crumbSubagent{font-size:12px;line-height:18px}button.ofIY9G_crumb:hover{background:var(--dsw-alias-interactive-bg-hover)}.ofIY9G_crumbCurrent{color:var(--dsw-alias-label-primary);cursor:default;font-weight:500}.ofIY9G_headerActions{flex:none;align-items:center;gap:8px;display:flex}.ofIY9G_headerUtilities{flex:none;align-items:center;gap:8px;margin-left:20px;display:flex}.ofIY9G_headerUtilities:empty{display:none}.ofIY9G_headerCorner{flex:none;align-items:center;margin-left:8px;margin-right:-16px;display:flex}.ofIY9G_headerCorner:empty{display:none}.ofIY9G_tabs{z-index:1;grid-column:1/-1;gap:36px;margin-top:10px;padding-left:8px;display:flex;position:relative}.ofIY9G_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}.ofIY9G_tab:after{content:"";background:0 0;border-radius:2px;height:2px;position:absolute;bottom:-1px;left:0;right:0}.ofIY9G_tabActive{color:var(--dsw-alias-state-business-primary)}.ofIY9G_tabActive:after{background:var(--dsw-alias-state-business-primary)}.ofIY9G_viewArea{flex-direction:column;flex:1;min-height:0;display:flex}.ofIY9G_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}.ofIY9G_widthHandle[data-side=left]{right:calc(50% + var(--dsh-chat-content-width) / 2 + 24px)}.ofIY9G_widthHandle[data-side=right]{left:calc(50% + var(--dsh-chat-content-width) / 2 + 24px)}.ofIY9G_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}.ofIY9G_widthHandle[data-side=left]:after{right:4px}.ofIY9G_widthHandle[data-side=right]:after{left:4px}.ofIY9G_widthHandle:hover:after,.ofIY9G_widthHandle[data-dragging]:after{opacity:1}.ofIY9G_widthHandle[data-dragging]{z-index:8}.ofIY9G_root:has([data-conversation-composer-overlay]) .ofIY9G_widthHandle{display:none}.ofIY9G_composerStack{--dsh-composer-stack-gap:6px;gap:var(--dsh-composer-stack-gap);flex-direction:column;display:flex}.ofIY9G_composerSeat{--dsh-composer-text-max-height:336px;flex-direction:column;flex:none;display:flex}.ofIY9G_root[data-phase=active]{overflow:hidden}.ofIY9G_root[data-phase=active] .ofIY9G_header{flex:none}.ofIY9G_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}.ofIY9G_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}.ofIY9G_scrollBody{scrollbar-gutter:stable;flex-direction:column;flex:1;min-height:0;margin-right:2px;display:flex;overflow-y:auto}.ofIY9G_scrollBody::-webkit-scrollbar-track{margin:2px}.ofIY9G_root[data-phase=active] .ofIY9G_viewArea,.ofIY9G_embeddedBody[data-content-phase=active] .ofIY9G_viewArea{flex:1 0 auto;min-height:auto}.ofIY9G_root[data-phase=active] .ofIY9G_composerSeat,.ofIY9G_embeddedBody[data-content-phase=active] .ofIY9G_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] .ofIY9G_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] .ofIY9G_composerSeat{--dsh-phone-composer-mask:initial}}.ofIY9G_root[data-phase=active] .ofIY9G_composerSeat:has([data-trigger-menu]){z-index:9}.ofIY9G_scrollBody:has([data-conversation-composer-overlay]){scrollbar-gutter:auto;position:relative;overflow:hidden auto}.ofIY9G_scrollBody:has([data-conversation-composer-overlay])>[data-slot=conversation\\.session]>.ofIY9G_viewArea{flex:1 1 0;min-height:0;overflow:hidden}.ofIY9G_scrollBody:has([data-conversation-composer-overlay])>.ofIY9G_composerSeat{right:var(--dsh-scrollbar-width);position:absolute;bottom:0;left:0}.ofIY9G_composerHero{width:min(calc(var(--dsh-composer-card-max-width) + 2 * var(--dsh-composer-side-clearance)), 100%);z-index:1;align-self:center;gap:8px;padding-bottom:32px}.ofIY9G_heroWorkspaceRow{align-items:center;gap:2px;min-width:0;margin-top:4px;padding:0 16px 0 20px;display:flex}.ofIY9G_root[data-phase=hero] .ofIY9G_scrollBody,.ofIY9G_embeddedBody[data-content-phase=hero] .ofIY9G_scrollBody{justify-content:center;overflow-y:auto}.ofIY9G_root[data-phase=settling] .ofIY9G_composerSeat,.ofIY9G_embeddedBody[data-content-phase=settling] .ofIY9G_composerSeat{visibility:hidden}`,document.head.appendChild(e)}var Q={body:`ofIY9G_body`,composerHero:`ofIY9G_composerHero`,composerSeat:`ofIY9G_composerSeat`,composerStack:`ofIY9G_composerStack`,crumb:`ofIY9G_crumb`,crumbCurrent:`ofIY9G_crumbCurrent`,crumbSeg:`ofIY9G_crumbSeg`,crumbSep:`ofIY9G_crumbSep`,crumbSubagent:`ofIY9G_crumbSubagent`,crumbs:`ofIY9G_crumbs`,embeddedBody:`ofIY9G_embeddedBody`,header:`ofIY9G_header`,headerActions:`ofIY9G_headerActions`,headerBlank:`ofIY9G_headerBlank`,headerCorner:`ofIY9G_headerCorner`,headerLeading:`ofIY9G_headerLeading`,headerSessionless:`ofIY9G_headerSessionless`,headerUtilities:`ofIY9G_headerUtilities`,heroWorkspaceRow:`ofIY9G_heroWorkspaceRow`,root:`ofIY9G_root`,scrollBody:`ofIY9G_scrollBody`,tab:`ofIY9G_tab`,tabActive:`ofIY9G_tabActive`,tabs:`ofIY9G_tabs`,titleCluster:`ofIY9G_titleCluster`,titleRow:`ofIY9G_titleRow`,viewArea:`ofIY9G_viewArea`,widthHandle:`ofIY9G_widthHandle`};let fx=`dsh.conversation.contentWidth`;function px(){let e=localStorage.getItem(fx);if(e===null)return null;let t=Number(e);return Number.isFinite(t)&&t>0?t:null}function mx(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 hx(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 gx(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:mx(e,n)}))},[]);return/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.widthHandle,"data-side":e.side,"data-width-handle":e.side,onPointerDown:l,onPointerMove:u,onPointerUp:d,onPointerCancel:f,onLostPointerCapture:f,onWheel:p})}function gx({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=fx();r===null?t.style.removeProperty(`--dsh-chat-user-width`):t.style.setProperty(`--dsh-chat-user-width`,`${px(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:px(e.offsetWidth,fx()),[e]),i=(0,g.useCallback)(t=>{e!==null&&(e.parentElement??e).style.setProperty(`--dsh-chat-user-width`,`${px(e.offsetWidth,t)}px`)},[e]),a=(0,g.useCallback)(t=>{e!==null&&localStorage.setItem(dx,`${px(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)(hx,{side:e,onStart:r,onDrag:i,onCommit:a,onEnd:o},e))}let _x={widthControls:gx};function vx(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`:lx(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:$.root,"data-phase":g,children:[a(`conversation.header`,{}),a(`conversation.header.notice`,{}),o(`conversation.content`,{variant:`main`,phase:g,hero:m},{slots:_x})]})}function yx(e){return/* @__PURE__ */ (0,h.jsx)(vx,{...e})}function bx(e,t){return e===`default-workspace`?t:e}let xx=`@deepseek-ai/dsh-client-ui-conversation/HeroShell.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(xx)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=xx,e.textContent=`._93RU4a_root{justify-content:center;align-items:center;min-width:0;height:100%;padding:0 24px;display:flex}._93RU4a_stack{width:100%;max-width:var(--dsh-composer-card-max-width);flex-direction:column;align-items:stretch;gap:12px;display:flex;overflow:visible}._93RU4a_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}._93RU4a_titleGroup{flex-wrap:wrap;justify-content:center;align-items:center;gap:4px 7px;min-width:0;display:flex}._93RU4a_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}._93RU4a_fishHitbox{flex:none;justify-content:center;align-items:center;display:inline-flex}._93RU4a_fish{transform-origin:50% 60%;color:var(--dsw-alias-label-primary);display:block;overflow:visible}@keyframes _93RU4a_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){._93RU4a_fishHitbox:hover ._93RU4a_fish{animation:1.6s ease-in-out infinite _93RU4a_hero-fish-swim}}._93RU4a_body{flex-direction:column;gap:12px;min-width:0;display:flex;position:relative;overflow:visible}._93RU4a_body>*{z-index:1;position:relative}._93RU4a_body>._93RU4a_workspaceRow{z-index:10;align-items:center;min-width:0;padding-left:8px;display:flex}._93RU4a_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}._93RU4a_workspace:not(:disabled):hover,._93RU4a_workspace[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover)}._93RU4a_workspace:disabled{cursor:default}._93RU4a_folder{color:var(--dsw-alias-label-primary);flex:none}._93RU4a_workspaceLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}._93RU4a_chevron{color:var(--dsw-alias-label-caption);flex:none}._93RU4a_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}._93RU4a_modalInput::placeholder{color:var(--dsw-alias-label-caption)}._93RU4a_modalInput:disabled{color:var(--dsw-alias-label-dimmed)}._93RU4a_modalAction{min-width:72px}._93RU4a_modalError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}`,document.head.appendChild(e)}var Sx={body:`_93RU4a_body`,chevron:`_93RU4a_chevron`,fish:`_93RU4a_fish`,fishHitbox:`_93RU4a_fishHitbox`,folder:`_93RU4a_folder`,headline:`_93RU4a_headline`,"hero-fish-swim":`_93RU4a_hero-fish-swim`,modalAction:`_93RU4a_modalAction`,modalError:`_93RU4a_modalError`,modalInput:`_93RU4a_modalInput`,previewBadge:`_93RU4a_previewBadge`,root:`_93RU4a_root`,stack:`_93RU4a_stack`,titleGroup:`_93RU4a_titleGroup`,workspace:`_93RU4a_workspace`,workspaceLabel:`_93RU4a_workspaceLabel`,workspaceRow:`_93RU4a_workspaceRow`};function Cx(e){let t=rc(e);return t===``?e:t}function wx({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:Sx.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:Sx.folder,size:16}):/* @__PURE__ */ (0,h.jsx)(d.IconFolderOpenRegular,{className:Sx.folder,size:16}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Sx.workspaceLabel,children:t??a(`hero.chooseWorkspace`)}),/* @__PURE__ */ (0,h.jsx)(d.IconChevronDownOutlineRegular,{className:Sx.chevron,size:12})]})}function Tx({hovering:e}){return/* @__PURE__ */ (0,h.jsx)(`svg`,{className:Sx.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 Ex({t:e,renderSlot:t,children:n}){let[r,i]=(0,g.useState)(!1);return/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Sx.root,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Sx.stack,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Sx.headline,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:Sx.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:Sx.fish},{fallback:/* @__PURE__ */ (0,h.jsx)(Tx,{hovering:r})})}),/* @__PURE__ */ (0,h.jsxs)(`span`,{className:Sx.titleGroup,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{children:e(`hero.headline`)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Sx.previewBadge,children:e(`hero.preview`)})]})]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:Sx.body})]}),n]})}let Dx=`@deepseek-ai/dsh-client-ui-conversation/ThreadReferenceDropTarget.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Dx)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=Dx,e.textContent=`.DZV3nW_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}.DZV3nW_invitation{flex-direction:column;align-items:center;gap:8px;max-width:calc(100% - 40px);display:flex}.DZV3nW_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}.DZV3nW_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}.DZV3nW_preview svg{flex:none}.DZV3nW_title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}`,document.head.appendChild(e)}var Ox={hint:`DZV3nW_hint`,invitation:`DZV3nW_invitation`,overlay:`DZV3nW_overlay`,preview:`DZV3nW_preview`,title:`DZV3nW_title`};function kx({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:a.current[e.threadId];return t!==void 0&&Wy(t)!==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:qy(t.getData(Uy));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(Xu,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=qy(a.getData(Uy));i()&&c(r)&&r?.threadId===n?.threadId?t.dispatchCommand(Ju,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:Ox.overlay,"data-thread-reference-drop":!0,role:`status`,"aria-live":`polite`,children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Ox.invitation,children:[/* @__PURE__ */ (0,h.jsx)(`div`,{className:Ox.hint,children:r(`reference.dropTitle`)}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Ox.preview,"data-thread-reference-preview":!0,children:[/* @__PURE__ */ (0,h.jsx)(d.ReferenceIconRegular,{kind:`session`,size:20}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Ox.title,children:o.title})]})]})})}function Ax({renderSlot:e}){return e(`conversation.session`,{})}function jx(){return null}function Mx(e){let{sessionId:t,phase:n,hero:r,useSession:i,useSessions:a,useSessionStatus:o,useWorkspaces:s,useInput:c,useComposerBlock:l,renderSlot:u,renderSlotChain:d,selectWorkspace:f,referenceEditor:p,t:m,useFactorySlot:_}=e,v=i(e=>e),y=_(`views`,Ax),ee=_(`widthControls`,jx),[b,x]=(0,g.useState)(null),S=o(e=>t===void 0?void 0:e.get(t)?.pendingInteraction),te=c(e=>e),ne=a(e=>t===void 0?void 0:e.byId[t]?.cwd),re=s(e=>e),ie=l(e=>e),[ae,oe]=(0,g.useState)(!1),[C,se]=(0,g.useState)(),ce=(0,g.useRef)(null),le=(0,g.useRef)(null),ue=(0,g.useCallback)(e=>{le.current?.disconnect(),le.current=null;let t=e?.parentElement??null;e!==null&&t!==null&&(le.current=new ResizeObserver(()=>{t.style.setProperty(`--dsh-composer-height`,`${e.offsetHeight}px`),t.style.setProperty(`--dsh-conversation-viewport-height`,`${t.clientHeight}px`)}),le.current.observe(e),le.current.observe(t))},[]),de=t===void 0?void 0:re.items.find(e=>e.sessionIds.includes(t)),w=re.items.find(e=>e.workspaceId===C);(0,g.useEffect)(()=>{C!==void 0&&((C===null?de===void 0:de?.workspaceId===C)||C!==null&&re.phase===`ready`&&w===void 0)&&se(void 0)},[C,de?.workspaceId,re.phase,w]);let T=v===void 0||te===void 0?void 0:{session:v,input:te},fe=(C===null?void 0:w?.title)??(C===null||t===void 0?void 0:de?.title??(re.phase===`ready`||ne===void 0||ne===``?void 0:Cx(ne))),pe=fe===void 0?void 0:bx(fe,m(`workspace.defaultName`)),me=/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.heroWorkspaceRow,children:[/* @__PURE__ */ (0,h.jsx)(wx,{buttonRef:ce,label:pe??(re.canStartProjectless?m(`hero.noWorkspace`):void 0),projectless:re.canStartProjectless===!0&&pe===void 0,menuOpen:ae,onClick:()=>{oe(e=>!e)},t:m}),u(`conversation.hero.workspace`,{open:ae,anchorRef:ce,selectedId:C===null?void 0:C??de?.workspaceId,onPick:e=>{oe(!1),se(e),f(e).catch(()=>{se(t=>t===e?void 0:t)})},onClose:()=>{oe(!1)}}),u(`conversation.hero.agentPreset`,{})]}),he=re.phase===`ready`&&!re.canStartProjectless&&pe===void 0,ge=t===void 0&&!he,_e=t===void 0||r&&he,ve=u(`conversation.composer.bar`,{variant:r?`hero`:`composer`,..._e?{disabled:!0,placeholder:m(ge?`placeholder.preparing`:`placeholder.workspace`),...ge?{}:{workspacePickerOpen:ae,onRequestWorkspace:()=>{oe(!0)}}}:!_e&&ie!==void 0?{blocked:ie,placeholder:ie.reason}:r?{placeholder:m(`placeholder.hero`)}:{}}),ye=/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Yy($.composerStack,r&&$.composerHero),children:[r&&/* @__PURE__ */ (0,h.jsx)(Ex,{t:m,renderSlot:u}),r&&me,T!==void 0&&u(`conversation.input.dock`,T),ve]}),be=d(`conversation.composer`,{sessionId:t,session:v,pendingInteraction:v?.openState===`open`?S:void 0},{fallback:ye,fallbackOnly:t===void 0,overlay:!0}),xe=/* @__PURE__ */ (0,h.jsx)(`div`,{ref:ue,className:$.composerSeat,"data-composer-seat":``,"data-conversation-region":`composer`,children:be});return/* @__PURE__ */ (0,h.jsxs)(`div`,{ref:x,className:Yy($.body,e.variant===`embedded`&&$.embeddedBody),"data-conversation-content":``,"data-conversation-session":t,"data-conversation-region":`chat`,"data-content-phase":n,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.scrollBody,"data-conversation-scroll":``,children:[t===void 0?null:/* @__PURE__ */ (0,h.jsx)(y,{}),xe]}),/* @__PURE__ */ (0,h.jsx)(ee,{container:b,phase:n}),/* @__PURE__ */ (0,h.jsx)(kx,{container:b,editor:p,useSessions:a,t:m},t)]})}function Nx({renderSlot:e}){return e(`main.conversation`,{})}function Px({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&&lx(i,a)===`blank`;return/* @__PURE__ */ (0,h.jsxs)(`header`,{className:Yy($.header,o&&$.headerBlank,e===void 0&&$.headerSessionless),"data-window-drag":!0,children:[/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.headerLeading,"data-conversation-header-leading":``,children:r(`conversation.header.leading`,{})}),e===void 0?/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.titleRow}):r(`conversation.session.header`,{hideChrome:o})]})}function Fx(e,t){return(t===null?void 0:e.find(e=>e.id===t))??e.find(e=>e.id===`chat`)}function Ix({view:e,useSession:t,useConversation:n,useConversationViews:r,inputActions:i,useStore:a,actions:o,renderSlot:s,bindDraftPersistence:c,openView:l,useInspectCall:u}){let d=r(e=>e),f=u(e=>e),p=Fx(d,a(e=>e.view)),m=t(e=>e),_=n(e=>e),v=a(e=>e.viewRequest??null);if((0,g.useEffect)(()=>{let e=c(o.setDraft);return i.persistDraft(),()=>{e()}},[i]),m.blank&&lx(m,_)===`blank`)return null;let y=e??p?.id;return/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.viewArea,children:y!==void 0&&s(`conversation.view`,{inspectCall:f,viewRequest:v,openView:l,completeViewRequest:o.completeViewRequest},{only:y})})}function Lx(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 Rx(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 zx({sessionId:e,hideChrome:t,useSessions:n,useConversationViews:r,useStore:i,renderSlot:a,open:o,selectView:s,t:c}){let l=r(e=>e),u=Fx(l,i(e=>e.view)),d=n(t=>Lx(t,e),Rx),f=!t&&l.length>1;return/* @__PURE__ */ (0,h.jsxs)(h.Fragment,{children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.titleRow,children:[!t&&/* @__PURE__ */ (0,h.jsxs)(h.Fragment,{children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.titleCluster,children:[/* @__PURE__ */ (0,h.jsxs)(`nav`,{className:$.crumbs,"aria-label":c(`session.hierarchy`),children:[d.map((e,t)=>{let n=t===d.length-1,r=n?/* @__PURE__ */ (0,h.jsx)(`span`,{className:Yy($.crumb,e.subagent&&$.crumbSubagent,$.crumbCurrent),children:e.displayTitle}):/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Yy($.crumb,e.subagent&&$.crumbSubagent),onClick:()=>{o(e.id)},children:e.displayTitle}),i=n||e.subagent,s={lineageSessionId:e.id,displayTitle:e.displayTitle,...n?{}:{openTitle:()=>{o(e.id)}}};return/* @__PURE__ */ (0,h.jsxs)(`span`,{className:$.crumbSeg,children:[t>0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:$.crumbSep,children:`/`}),i?e.subagent?a(`conversation.session.header.lineage`,s,{fallback:r}):/* @__PURE__ */ (0,h.jsxs)(h.Fragment,{children:[r,a(`conversation.session.header.lineage`,s,{fallback:null})]}):r]},e.id)}),d.length===0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:$.crumbCurrent,children:e})]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.headerActions,children:a(`conversation.session.header.actions`,{})})]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.headerUtilities,children:a(`conversation.session.header.utilities`,{})})]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.headerCorner,"data-conversation-header-corner":``,children:a(`conversation.session.header.corner`,{})})]}),f&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.tabs,role:`tablist`,"data-conversation-tabs":``,children:l.map(e=>/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===u?.id,className:Yy($.tab,e.id===u?.id&&$.tabActive),onClick:()=>{s(e.id)},children:e.label},e.id))})]})}function Bx(e){return/* @__PURE__ */ (0,h.jsx)(Ix,{...e})}function Vx({editor:e,editable:t,...n}){let r=(0,g.useRef)(null);return(0,g.useLayoutEffect)(()=>{let t=r.current;if(e!==null&&t!==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:r,contentEditable:e!==null&&t,suppressContentEditableWarning:!0,role:`textbox`,"aria-multiline":`true`,"data-composer-input":!0,...n})}function Hx({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 Ux({classNames:e,editor:t,scrollRef:n,editable:r,editorDisabled:i,phase:a,placeholderText:o,ariaLabel:s,workspaceTrigger:c,workspacePickerOpen:l,onWorkspaceKeyDown:u,hint:d,showPlaceholder:f}){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)(Vx,{editor:c?null:t,editable:r,className:Yy(e.input,i&&e.inputDisabled),"data-phase":a,"aria-disabled":i||void 0,"data-placeholder":o,"aria-label":s,"aria-haspopup":c?`menu`:void 0,"aria-expanded":c?l:void 0,tabIndex:c?0:void 0,onKeyDown:c?u:void 0,style:d===null?void 0:{"--dsh-composer-hint":JSON.stringify(d)}}),f&&/* @__PURE__ */ (0,h.jsx)(`div`,{"aria-hidden":!0,className:e.placeholder,"data-composer-placeholder":!0,children:o}),/* @__PURE__ */ (0,h.jsx)(Hx,{editor:c?null:t})]})})}function Wx(e,t){return e.isComposing||e.keyCode===229||t()}function Gx(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&&Wx(n,c);return t.arbitrate(e,r)!==`pass`&&(n?.preventDefault(),!0)};return X_(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(Bu,l(`up`),4),e.registerCommand(Vu,l(`down`),4),e.registerCommand(qu,e=>l(e.shiftKey?`tabBack`:`tab`)(e),4),e.registerCommand(Gu,e=>(t.dismissPopup(),t.arbitrate(`escape`,Wx(e,c))===`consumed`&&(e.preventDefault(),!0)),4),e.registerCommand(Uu,e=>Wx(e,c)?!1:t.space()?(e.preventDefault(),!0):!1,4),e.registerCommand(Hu,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&&Wx(e,c)?!0:t.arbitrate(`enter`,!1)===`pass`?(e?.preventDefault(),e?.repeat===!0||!t.canSubmit()||t.submit(e?.ctrlKey===!0||e?.metaKey===!0),!0):(e?.preventDefault(),!0),4),e.registerCommand(Ou,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 Kx(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 qx(e,t){e.getRootElement()?.focus({preventScroll:!0}),e.focus(()=>{t()})}function Jx(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 Yx(e,t,n){return e.bindFilePicker({available:()=>t.current.canAcceptDrop&&n.current!==null,open:()=>{n.current?.click()}})}function Xx(e,t,n){return Gx(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.primaryAction===void 0?e&&r.canSteerQueue?t.steerQueue():r.uploadsPending?r.showToast(r.t(`file.stillUploading`)):t.submit(Hb(r.busyEnter,r.running,e?`accelerated`:`enter`,r.steeringAvailable),`enter`):r.uploadsPending||r.primaryAction.run()},intakeFiles:(e,t)=>{n.current.intakeFiles(e,t)},pasteText:e=>{n.current.machineBusy||n.current.locked||t.paste(e)}})}function Zx(e,t){e.preventDefault(),!(0,d.isMobileDevice)()&&t?.getRootElement()?.focus({preventScroll:!0})}function Qx(e){let t=e/1048576;return`${Number.isInteger(t)?String(t):t.toFixed(1)}MB`}function $x(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`IMAGE_DIMENSION_TOO_LARGE`:if(n!==void 0)return e(`image.dimensionTooLarge`,{size:n.maxImageDimension});break;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:Qx(n.maxImageBytes)});break;case`IMAGES_TOO_LARGE`:if(n!==void 0)return e(`image.totalTooLarge`,{size:Qx(n.maxMessageImageBytes)})}return e(`image.sendFailed`,{reason:t})}function eS(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 tS=`@deepseek-ai/dsh-client-ui-conversation/ContextMeter.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(tS)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=tS,e.textContent=`.LDRuKa_root{flex:none;display:inline-flex}.LDRuKa_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}.LDRuKa_trigger:hover,.LDRuKa_trigger[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.LDRuKa_track{fill:none;stroke:var(--dsw-alias-border-l3);stroke-width:2px}.LDRuKa_fill{fill:none;stroke:var(--dsw-alias-label-tertiary);stroke-width:2px;stroke-linecap:round}.LDRuKa_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}.LDRuKa_header{align-items:center;gap:6px;display:flex}.LDRuKa_figures{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);margin-left:auto;font-weight:500}.LDRuKa_percent{color:var(--dsw-alias-label-primary);font-weight:500}.LDRuKa_headline{color:var(--dsw-alias-label-tertiary)}.LDRuKa_headline:empty{display:none}.LDRuKa_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}.LDRuKa_segment{background:var(--meter-tint,var(--dsw-alias-label-tertiary));border-radius:1px;flex:none;min-width:2px;height:100%}.LDRuKa_swatch{background:var(--meter-tint);vertical-align:baseline;border-radius:2px;width:8px;height:8px;margin-right:6px;display:inline-block}.LDRuKa_colorSystem{--meter-tint:var(--dsw-static-neutral-bluish-400)}.LDRuKa_colorTools{--meter-tint:#a78bfa}.LDRuKa_colorMessages{--meter-tint:var(--dsw-static-blue-450)}.LDRuKa_rows{margin:6px 0 0}.LDRuKa_row{justify-content:space-between;align-items:center;gap:12px;padding:2px 0;display:flex}.LDRuKa_row dt{color:var(--dsw-alias-label-secondary)}.LDRuKa_row dd{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);margin:0}`,document.head.appendChild(e)}var nS={bar:`LDRuKa_bar`,colorMessages:`LDRuKa_colorMessages`,colorSystem:`LDRuKa_colorSystem`,colorTools:`LDRuKa_colorTools`,figures:`LDRuKa_figures`,fill:`LDRuKa_fill`,header:`LDRuKa_header`,headline:`LDRuKa_headline`,panel:`LDRuKa_panel`,percent:`LDRuKa_percent`,root:`LDRuKa_root`,row:`LDRuKa_row`,rows:`LDRuKa_rows`,segment:`LDRuKa_segment`,swatch:`LDRuKa_swatch`,track:`LDRuKa_track`,trigger:`LDRuKa_trigger`};let rS=5.5,iS=2*Math.PI*rS,aS=[{key:`systemTokens`,label:`context.system`,color:nS.colorSystem},{key:`toolsTokens`,label:`context.tools`,color:nS.colorTools},{key:`messageTokens`,label:`context.messages`,color:nS.colorMessages}];function oS(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 sS({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=eS(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,ee=(r===void 0||y===0?[{key:`total`,color:void 0,width:f}]:aS.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:nS.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:nS.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:nS.track,cx:`7`,cy:`7`,r:rS}),/* @__PURE__ */ (0,h.jsx)(`circle`,{className:nS.fill,cx:`7`,cy:`7`,r:rS,strokeDasharray:`${iS*f/100} ${iS}`,transform:`rotate(-90 7 7)`})]}),/* @__PURE__ */ (0,h.jsx)(`span`,{children:p})]})}),i&&(0,_.createPortal)(/* @__PURE__ */ (0,h.jsxs)(`div`,{ref:s,className:nS.panel,style:u??{visibility:`hidden`,left:0,top:0},role:`dialog`,"aria-label":t(`context.used`),children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:nS.header,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:nS.headline,children:m}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:nS.percent,children:p}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:nS.headline,children:v}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:nS.figures,children:`~${oS(c.usedTokens,t)} / ${oS(c.contextWindow,t)}`})]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:nS.bar,children:ee.map(e=>/* @__PURE__ */ (0,h.jsx)(`div`,{className:e.color===void 0?nS.segment:`${nS.segment} ${e.color}`,style:{width:`${e.width}%`}},e.key))}),r!==void 0&&/* @__PURE__ */ (0,h.jsx)(`dl`,{className:nS.rows,children:aS.map(e=>/* @__PURE__ */ (0,h.jsxs)(`div`,{className:nS.row,children:[/* @__PURE__ */ (0,h.jsxs)(`dt`,{children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:`${nS.swatch} ${e.color}`,"aria-hidden":!0}),t(e.label)]}),/* @__PURE__ */ (0,h.jsx)(`dd`,{children:`~${oS(r[e.key],t)}`})]},e.key))})]}),document.body)]})}function cS(e){let t=()=>{e.removeAttribute(`data-model-compact`);let t=getComputedStyle(e),n=e.getBoundingClientRect().width-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight),r=Array.from(e.children,e=>e.getBoundingClientRect().width).filter(e=>e>0),i=r.reduce((e,t)=>e+t,0)+Math.max(0,r.length-1)*parseFloat(t.columnGap);e.toggleAttribute(`data-model-compact`,i>n)},n=new ResizeObserver(t);n.observe(e);for(let t of e.children)n.observe(t);let r=new MutationObserver(t);r.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`hidden`]});let i=document.fonts;return i.addEventListener(`loadingdone`,t),t(),()=>{n.disconnect(),r.disconnect(),i.removeEventListener(`loadingdone`,t)}}let lS=`@deepseek-ai/dsh-client-ui-conversation/InputBar.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(lS)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=lS,e.textContent=`.b5Vi8W_root{padding:0 var(--dsh-composer-side-clearance) 4px;flex-direction:column;align-items:center;display:flex}.b5Vi8W_dock{justify-content:center;align-items:center;gap:12px;max-width:100%;padding-top:4px;display:flex}.b5Vi8W_hero .b5Vi8W_dock:empty{display:none}.b5Vi8W_hero{padding:0 var(--dsh-composer-side-clearance)}.b5Vi8W_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);margin-bottom:6px;padding:4px 8px;font-size:12px;line-height:18px}.b5Vi8W_card{box-sizing:border-box;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}.b5Vi8W_cardWorkspaceTrigger{--dsw-elevation-stroke-color:transparent;cursor:pointer}.b5Vi8W_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}.b5Vi8W_cardWorkspaceTrigger :disabled{pointer-events:none}.b5Vi8W_cardWorkspaceTrigger:hover:after{color:var(--dsw-alias-state-business-primary)}.b5Vi8W_inlineNotices{flex-direction:column;gap:8px;display:flex}.b5Vi8W_inlineNotices>[data-slot]>*{margin:10px 10px 0}.b5Vi8W_accessory{align-items:center;gap:8px;padding:10px 12px 0;display:flex}.b5Vi8W_overlayAnchor{height:0;position:absolute;inset:0 0 auto}.b5Vi8W_scroll{max-height:var(--dsh-composer-text-max-height);margin-right:4px;overflow-y:auto}.b5Vi8W_scroll::-webkit-scrollbar-track{margin-top:8px}.b5Vi8W_grow{position:relative}.b5Vi8W_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 b5Vi8W_input-pending}@keyframes b5Vi8W_input-pending{0%{opacity:.35}to{opacity:1}}.b5Vi8W_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);outline:none;padding:4px 8px 0 14px}.b5Vi8W_input p{margin:0}.b5Vi8W_input p:last-child:after{content:var(--dsh-composer-hint);color:var(--dsw-alias-label-caption)}.b5Vi8W_input[data-composer-composing] p:last-child:after{content:none}.b5Vi8W_input[data-composer-composing]+.b5Vi8W_placeholder{visibility:hidden}.b5Vi8W_placeholder{color:var(--dsw-alias-label-caption);white-space:nowrap;text-overflow:ellipsis;pointer-events:none;user-select:none;position:absolute;inset:4px 8px auto 14px;overflow:hidden}.b5Vi8W_inputDisabled{color:var(--dsw-alias-label-tertiary);cursor:not-allowed}.b5Vi8W_input[aria-haspopup=menu]{cursor:pointer}.b5Vi8W_hero .b5Vi8W_input{min-height:52px}.b5Vi8W_hero .b5Vi8W_placeholder{white-space:normal;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box}@media (width<=600px){.b5Vi8W_hero .b5Vi8W_input{min-height:36px}.b5Vi8W_hero .b5Vi8W_placeholder{white-space:nowrap;display:block}}.b5Vi8W_row{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}.b5Vi8W_row[data-model-compact]{--dsh-composer-model-text-display:none;--dsh-composer-model-icon-display:block}.b5Vi8W_tools,.b5Vi8W_modes,.b5Vi8W_trailing{align-items:center;min-width:0;display:flex}.b5Vi8W_tools,.b5Vi8W_modes{gap:12px}.b5Vi8W_trailing{flex:none;gap:12px;margin-left:auto}@container (width<=560px){.b5Vi8W_tools,.b5Vi8W_modes,.b5Vi8W_trailing{gap:8px}}.b5Vi8W_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}.b5Vi8W_add:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid)}.b5Vi8W_add:disabled{opacity:.5;cursor:default}.b5Vi8W_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}.b5Vi8W_select:hover:not(:disabled){background-color:var(--dsw-alias-interactive-bg-hover)}.b5Vi8W_select:disabled{opacity:.5;cursor:default}.b5Vi8W_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)}.b5Vi8W_primary:hover:not(:disabled){background:var(--dsw-alias-button-info-hover)}.b5Vi8W_primary:disabled{opacity:.4;cursor:default}.b5Vi8W_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}.b5Vi8W_standardControls{align-items:center;gap:12px;min-width:0;display:flex}.b5Vi8W_tools[hidden],.b5Vi8W_standardControls[hidden]{display:none}.b5Vi8W_trailingActive{flex:1;margin-left:0}.b5Vi8W_activity{flex:none;align-items:center;display:flex}.b5Vi8W_activity:empty{display:none}.b5Vi8W_activityExpanded{flex:1;min-width:0}`,document.head.appendChild(e)}var uS={accessory:`b5Vi8W_accessory`,activity:`b5Vi8W_activity`,activityExpanded:`b5Vi8W_activityExpanded`,add:`b5Vi8W_add`,card:`b5Vi8W_card`,cardWorkspaceTrigger:`b5Vi8W_cardWorkspaceTrigger`,dock:`b5Vi8W_dock`,grow:`b5Vi8W_grow`,hero:`b5Vi8W_hero`,inlineNotices:`b5Vi8W_inlineNotices`,input:`b5Vi8W_input`,"input-pending":`b5Vi8W_input-pending`,inputDisabled:`b5Vi8W_inputDisabled`,modes:`b5Vi8W_modes`,notice:`b5Vi8W_notice`,overlayAnchor:`b5Vi8W_overlayAnchor`,pending:`b5Vi8W_pending`,placeholder:`b5Vi8W_placeholder`,primary:`b5Vi8W_primary`,retry:`b5Vi8W_retry`,root:`b5Vi8W_root`,row:`b5Vi8W_row`,scroll:`b5Vi8W_scroll`,select:`b5Vi8W_select`,standardControls:`b5Vi8W_standardControls`,tools:`b5Vi8W_tools`,trailing:`b5Vi8W_trailing`,trailingActive:`b5Vi8W_trailingActive`};let dS=(0,g.memo)(function({useSession:e,useInput:t,inputActions:n,keyboard:r,addFiles:i,removeAttachment:a,resolveDraftAttachments:o,retryFileUpload:s,toggleCommandMenu:c,stop:l,t:u,renderSlot:f,useBusyEnter:p,useFileUploads:m,useNotices:_,useLexicon:v,useMenuLauncher:y,useStopShortcut:ee,useProjection:b,sessionId:x,variant:S,disabled:te=!1,blocked:ne,workspacePickerOpen:re=!1,onRequestWorkspace:ie,placeholder:ae,accessory:oe}){let C=t(e=>e),se=_(e=>e),ce=p(e=>e),le=ee(e=>e),ue=y(e=>e===`command`),[de,w]=(0,g.useState)(!1);(0,g.useEffect)(()=>{w(!1)},[x]);let T=e(e=>e.promptError)??null,fe=e(e=>e.running)??!1,pe=e(e=>e.subagent)??null,me=e(e=>e.removed)??!1,he=b(`plan`,e=>e!==void 0&&(e.pending?!e.active:e.active)),ge=b(`goal`,e=>e!=null),_e=C!==void 0&&r!==void 0&&n!==void 0,ve=C?.draft??``,ye=C?.primaryAction,be=r?.editor??null,xe=(0,g.useMemo)(()=>C===void 0||o===void 0?[]:o(C.attachmentIds),[o,C?.attachmentIds]),Se=ve.trim()===``&&xe.length===0,Ce=m(e=>e),we=xe.some(e=>e.kind===`file`&&Ce[e.id]?.status!==`ready`),[Te,Ee]=(0,g.useState)(null),De=(0,g.useRef)(0),Oe=(0,g.useCallback)(e=>{De.current+=1,Ee({seq:De.current,text:e})},[]),ke=(0,g.useCallback)(()=>{Ee(null)},[]),Ae=b(`imageLimits`),je=b(`attachmentInput`),Me=je?.enabled!==!1,Ne=je?.imagesOnly===!0;(0,g.useEffect)(()=>{if(T===null)return;let{error:e}=T;e.code===`session/writer-held`?Oe(u(`error.sessionInUse`)):Oe(e.code===`session/attachment-invalid`||e.code===`subagent/attachment-invalid`?$x(u,e.details.reason,Ae):`${e.message} (${e.code})`)},[T,Oe,u,Ae]),(0,g.useEffect)(()=>{se?.level===`error`&&Oe(se.text)},[se,Oe]);let Pe=(0,g.useRef)(null);(0,g.useLayoutEffect)(()=>{let e=Pe.current;if(e!==null)return cS(e)},[]);let Fe=(0,g.useRef)(null),Ie=(0,g.useRef)(null),Le=pe?.address.mode===`continuable`,Re=Le&&pe.parentAvailable!==!0,ze=me||te||!_e||ne!==void 0||Re,Be=ze,Ve=me||te||!_e,He=C?.phase===`adjudicating`||C?.phase===`submitting`,Ue=te&&!me&&ie!==void 0,We=me||Be&&!Ue,Ge=_e&&!Be&&!He,Ke=pe===null||pe.address.mode===`continuable`,qe=!Be&&!He&&Se&&fe&&Ke&&C.queue.length>0;(0,g.useEffect)(()=>{C!==void 0&&n!==void 0&&xe.length!==C.attachmentIds.length&&n.pruneAttachments(xe.map(e=>e.id))},[xe,C?.attachmentIds,n]);let Je=()=>{Kx(Ie)};(0,g.useEffect)(()=>{Be||be===null||(0,d.shouldAutoFocusTextInput)()&&qx(be,Je)},[Be,x,be]),(0,g.useEffect)(()=>{Be||ve===``||Je()},[ve!==``]),(0,g.useEffect)(()=>Jx(Ie),[]);let Ye=(0,g.useCallback)((e,t)=>{if(pe!==null||i===void 0||e.length===0)return;if(!Me){Oe(u(`attachment.unavailable`));return}let n=(()=>{if(Ne&&e.some(e=>!(Ae?.mediaTypes)?.includes(e.type)))return u(`image.unsupportedType`);if(Ae!==void 0){let t=Ae.mediaTypes,n=e.filter(e=>t.includes(e.type)),r=xe.filter(e=>e.kind===`image`);if(r.length+n.length>Ae.maxImagesPerMessage)return u(`image.tooMany`,{count:Ae.maxImagesPerMessage});if(n.some(e=>e.size>Ae.maxImageBytes))return u(`image.fileTooLarge`,{size:Qx(Ae.maxImageBytes)});if(r.reduce((e,t)=>e+t.file.size,0)+n.reduce((e,t)=>e+t.size,0)>Ae.maxMessageImageBytes)return u(`image.totalTooLarge`,{size:Qx(Ae.maxMessageImageBytes)})}return i(e,t)})();n!==null&&Oe(n)},[pe,i,Me,Ne,xe,Ae,Oe,u]),Xe=Me&&pe===null&&!Be&&!He&&i!==void 0,Ze=u(Me?Ne?`input.imagesAndCommands`:`input.commands`:`input.commandsOnly`),Qe=(0,g.useRef)(null),$e=e=>{let t=e.target.files===null?[]:[...e.target.files];e.target.value=``,t.length>0&&Ye(t)},et=(0,g.useRef)({locked:Be,machineBusy:He,primaryAction:ye,canSteerQueue:qe,running:fe,steeringAvailable:Ke,busyEnter:ce,intakeFiles:Ye,uploadsPending:we,showToast:Oe,t:u,canAcceptDrop:Xe});et.current={locked:Be,machineBusy:He,primaryAction:ye,canSteerQueue:qe,running:fe,steeringAvailable:Ke,busyEnter:ce,intakeFiles:Ye,uploadsPending:we,showToast:Oe,t:u,canAcceptDrop:Xe},(0,g.useEffect)(()=>{if(r!==void 0)return Yx(r,et,Qe)},[r]),(0,g.useEffect)(()=>{if(be!==null&&r!==void 0)return Xx(be,r,et)},[be,r]);let tt=e=>{Zx(e,be)},nt=()=>{r!==void 0&&(be!==null&&(0,d.shouldAutoFocusTextInput)()&&qx(be,Je),c?.(r.caretSpan()))},rt=e=>{Ue&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),ie())},it=ye===void 0&&fe&&pe===null&&(Se||ne!==void 0),at=it?l===void 0:(ye===void 0?Se:ye.disabled)||ze||He||we,ot=fe&&Le,st=Hb(ce,fe,`enter`,Ke),ct=!Se&&C?.phase===`plain`&&!ve.trimStart().startsWith(`/`),lt=u(it?`input.stop`:ye===void 0&&fe&&Ke&&!ze&&!we&&ct?st===`steer`?`input.send.steer`:`input.send.queue`:`input.send`),ut=()=>{it?l?.():ye===void 0?r!==void 0&&!Se&&!ze&&!He&&!we&&r.submit(st,`click`):at||ye.run()},dt=(C?.phase===`claimed`||C?.phase===`submitting`)&&C.claim!==void 0&&ve.startsWith(C.claim.token),ft=dt&&C.claim.hint!==void 0&&ve.slice(C.claim.token.length).trim()===``?C.claim.hint:null,pt=(()=>{if(ft===null)return null;let e=C?.claim?.name??``,t=`hint.${e===`goal`&&ge?`goal.active`:e}`,n=u(t);return n===t?ft:n})(),mt=ae??u(Re?`placeholder.parentOffline`:ze?`placeholder.unavailable`:qe?`placeholder.steerQueue`:he?`placeholder.plan`:`placeholder.default`);return/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Yy(uS.root,S===`hero`&&uS.hero),children:[Te!==null&&/* @__PURE__ */ (0,h.jsx)(d.Toast,{text:Te.text,icon:/* @__PURE__ */ (0,h.jsx)(d.IconWarningOutlineRegular,{}),anchor:Fe.current,onDone:ke},Te.seq),se?.level===`info`&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:uS.notice,role:`status`,children:se.text}),/* @__PURE__ */ (0,h.jsxs)(`div`,{ref:Fe,className:Yy(uS.card,Ue&&uS.cardWorkspaceTrigger),"data-composer-card":!0,onClick:Ue?ie:void 0,onPointerDown:Ue?e=>{e.stopPropagation()}:void 0,children:[x!==void 0&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:uS.overlayAnchor,children:f(`conversation.input.overlay`,{})}),oe!==void 0&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:uS.accessory,children:oe}),C===void 0||x===void 0?null:/* @__PURE__ */ (0,h.jsx)(`div`,{className:uS.inlineNotices,children:f(`conversation.input.notice`,{})}),f(`conversation.input.attachments`,{attachments:xe,canAcceptDrop:Xe,onAddFiles:Ye,onRemoveAttachment:e=>{a?.(e)},uploads:Ce,onRetryFile:e=>{s?.(e)},dropLimits:Ae===void 0?void 0:{count:Ae.maxImagesPerMessage,size:Qx(Ae.maxImageBytes)}}),/* @__PURE__ */ (0,h.jsx)(Ux,{classNames:uS,editor:be,scrollRef:Ie,editable:Ge,editorDisabled:We,phase:C?.phase??`inert`,placeholderText:mt,ariaLabel:Ue?u(`hero.chooseWorkspace`):mt,workspaceTrigger:Ue,workspacePickerOpen:re,onWorkspaceKeyDown:rt,hint:pt,showPlaceholder:ve===``&&xe.length===0&&!dt}),/* @__PURE__ */ (0,h.jsxs)(`div`,{ref:Pe,className:uS.row,"data-composer-toolbar":!0,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:uS.tools,hidden:de,"data-composer-tools":!0,children:[/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{label:Ze,side:`top`,delayMs:500,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:uS.add,"aria-label":Ze,"aria-haspopup":`listbox`,"aria-expanded":ue,disabled:Be||He||c===void 0,onMouseDown:tt,onClick:nt,children:/* @__PURE__ */ (0,h.jsx)(d.IconPlusOutlineMedium,{size:14})})}),/* @__PURE__ */ (0,h.jsx)(`input`,{ref:Qe,type:`file`,accept:Ne?Ae?.mediaTypes.join(`,`):void 0,multiple:!0,disabled:!Me||pe!==null,hidden:!0,onChange:$e}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:uS.modes,children:[x===void 0?null:f(`conversation.input.permission`,{locked:Be}),x===void 0?null:f(`conversation.input.plan`,{locked:Be})]}),C===void 0||x===void 0?null:f(`conversation.input.left`,{})]}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Yy(uS.trailing,de&&uS.trailingActive),children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:uS.standardControls,hidden:de,children:[C===void 0||x===void 0?null:f(`conversation.input.right`,{}),x===void 0?null:f(`conversation.input.model`,{locked:Ve})]}),C===void 0||x===void 0?null:/* @__PURE__ */ (0,h.jsx)(`div`,{className:de?uS.activityExpanded:uS.activity,children:f(`conversation.input.activity`,{locked:Be,onActiveChange:w})}),ot&&/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{label:u(`input.stop`),shortcutKeys:le,side:`top`,delayMs:500,disabled:l===void 0,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:uS.primary,"aria-label":u(`input.stop`),disabled:l===void 0,onMouseDown:tt,onClick:l,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,{label:it?u(`input.stop`):lt,shortcutKeys:it?le:void 0,side:`top`,delayMs:500,disabled:at,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:uS.primary,"aria-label":lt,disabled:at,onMouseDown:tt,onClick:ut,children:it?/* @__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:uS.dock,"data-composer-dock":!0,children:[S===`composer`&&C!==void 0&&x!==void 0?f(`conversation.composer.dock`,{}):null,de?null:/* @__PURE__ */ (0,h.jsx)(sS,{useProjection:b,t:u})]})]})}),fS=`@deepseek-ai/dsh-client-ui-conversation/TodoPanel.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(fS)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=fS,e.textContent=`.Sdgm8W_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}.Sdgm8W_body{flex-direction:column;gap:8px;padding:6px 12px;display:flex}.Sdgm8W_header{text-align:left;cursor:pointer;background:0 0;border:none;align-items:center;gap:10px;width:100%;padding:0;display:flex}.Sdgm8W_lead{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.Sdgm8W_title{color:var(--dsw-alias-label-primary);flex:none;font-size:13px;font-weight:500;line-height:24px}.Sdgm8W_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}.Sdgm8W_chevron{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.Sdgm8W_list{flex-direction:column;gap:8px;max-height:180px;margin:0;padding:0;list-style:none;display:flex;overflow-y:auto}.Sdgm8W_item{min-width:0;color:var(--dsw-alias-label-secondary);align-items:center;gap:10px;font-size:13px;line-height:20px;display:flex}.Sdgm8W_glyph{flex:none;place-items:center;width:16px;height:16px;display:grid}.Sdgm8W_content{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}`,document.head.appendChild(e)}var pS={body:`Sdgm8W_body`,chevron:`Sdgm8W_chevron`,content:`Sdgm8W_content`,glyph:`Sdgm8W_glyph`,header:`Sdgm8W_header`,item:`Sdgm8W_item`,lead:`Sdgm8W_lead`,list:`Sdgm8W_list`,progress:`Sdgm8W_progress`,root:`Sdgm8W_root`,title:`Sdgm8W_title`};
|
|
171
|
+
n!==null&&(e.ctrlKey||e.deltaY===0||n.scrollBy({top:hx(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 _x({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=px();r===null?t.style.removeProperty(`--dsh-chat-user-width`):t.style.setProperty(`--dsh-chat-user-width`,`${mx(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:mx(e.offsetWidth,px()),[e]),i=(0,g.useCallback)(t=>{e!==null&&(e.parentElement??e).style.setProperty(`--dsh-chat-user-width`,`${mx(e.offsetWidth,t)}px`)},[e]),a=(0,g.useCallback)(t=>{e!==null&&localStorage.setItem(fx,`${mx(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)(gx,{side:e,onStart:r,onDrag:i,onCommit:a,onEnd:o},e))}let vx={widthControls:_x};function yx(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`:ux(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,children:[a(`conversation.header`,{}),a(`conversation.header.notice`,{}),o(`conversation.content`,{variant:`main`,phase:g,hero:m},{slots:vx})]})}function bx(e){return/* @__PURE__ */ (0,h.jsx)(yx,{...e})}function xx(e,t){return e===`default-workspace`?t:e}let Sx=`@deepseek-ai/dsh-client-ui-conversation/HeroShell.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Sx)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=Sx,e.textContent=`._93RU4a_root{justify-content:center;align-items:center;min-width:0;height:100%;padding:0 24px;display:flex}._93RU4a_stack{width:100%;max-width:var(--dsh-composer-card-max-width);flex-direction:column;align-items:stretch;gap:12px;display:flex;overflow:visible}._93RU4a_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}._93RU4a_titleGroup{flex-wrap:wrap;justify-content:center;align-items:center;gap:4px 7px;min-width:0;display:flex}._93RU4a_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}._93RU4a_fishHitbox{flex:none;justify-content:center;align-items:center;display:inline-flex}._93RU4a_fish{transform-origin:50% 60%;color:var(--dsw-alias-label-primary);display:block;overflow:visible}@keyframes _93RU4a_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){._93RU4a_fishHitbox:hover ._93RU4a_fish{animation:1.6s ease-in-out infinite _93RU4a_hero-fish-swim}}._93RU4a_body{flex-direction:column;gap:12px;min-width:0;display:flex;position:relative;overflow:visible}._93RU4a_body>*{z-index:1;position:relative}._93RU4a_body>._93RU4a_workspaceRow{z-index:10;align-items:center;min-width:0;padding-left:8px;display:flex}._93RU4a_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}._93RU4a_workspace:not(:disabled):hover,._93RU4a_workspace[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover)}._93RU4a_workspace:disabled{cursor:default}._93RU4a_folder{color:var(--dsw-alias-label-primary);flex:none}._93RU4a_workspaceLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}._93RU4a_chevron{color:var(--dsw-alias-label-caption);flex:none}._93RU4a_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}._93RU4a_modalInput::placeholder{color:var(--dsw-alias-label-caption)}._93RU4a_modalInput:disabled{color:var(--dsw-alias-label-dimmed)}._93RU4a_modalAction{min-width:72px}._93RU4a_modalError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}`,document.head.appendChild(e)}var Cx={body:`_93RU4a_body`,chevron:`_93RU4a_chevron`,fish:`_93RU4a_fish`,fishHitbox:`_93RU4a_fishHitbox`,folder:`_93RU4a_folder`,headline:`_93RU4a_headline`,"hero-fish-swim":`_93RU4a_hero-fish-swim`,modalAction:`_93RU4a_modalAction`,modalError:`_93RU4a_modalError`,modalInput:`_93RU4a_modalInput`,previewBadge:`_93RU4a_previewBadge`,root:`_93RU4a_root`,stack:`_93RU4a_stack`,titleGroup:`_93RU4a_titleGroup`,workspace:`_93RU4a_workspace`,workspaceLabel:`_93RU4a_workspaceLabel`,workspaceRow:`_93RU4a_workspaceRow`};function wx(e){let t=ic(e);return t===``?e:t}function Tx({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:Cx.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:Cx.folder,size:16}):/* @__PURE__ */ (0,h.jsx)(d.IconFolderOpenRegular,{className:Cx.folder,size:16}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Cx.workspaceLabel,children:t??a(`hero.chooseWorkspace`)}),/* @__PURE__ */ (0,h.jsx)(d.IconChevronDownOutlineRegular,{className:Cx.chevron,size:12})]})}function Ex({hovering:e}){return/* @__PURE__ */ (0,h.jsx)(`svg`,{className:Cx.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 Dx({t:e,renderSlot:t,children:n}){let[r,i]=(0,g.useState)(!1);return/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Cx.root,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Cx.stack,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Cx.headline,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:Cx.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:Cx.fish},{fallback:/* @__PURE__ */ (0,h.jsx)(Ex,{hovering:r})})}),/* @__PURE__ */ (0,h.jsxs)(`span`,{className:Cx.titleGroup,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{children:e(`hero.headline`)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:Cx.previewBadge,children:e(`hero.preview`)})]})]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:Cx.body})]}),n]})}let Ox=`@deepseek-ai/dsh-client-ui-conversation/ThreadReferenceDropTarget.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(Ox)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=Ox,e.textContent=`.DZV3nW_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}.DZV3nW_invitation{flex-direction:column;align-items:center;gap:8px;max-width:calc(100% - 40px);display:flex}.DZV3nW_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}.DZV3nW_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}.DZV3nW_preview svg{flex:none}.DZV3nW_title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}`,document.head.appendChild(e)}var kx={hint:`DZV3nW_hint`,invitation:`DZV3nW_invitation`,overlay:`DZV3nW_overlay`,preview:`DZV3nW_preview`,title:`DZV3nW_title`};function Ax({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:a.current[e.threadId];return t!==void 0&&Gy(t)!==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:Jy(t.getData(Wy));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(Zu,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=Jy(a.getData(Wy));i()&&c(r)&&r?.threadId===n?.threadId?t.dispatchCommand(Yu,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:kx.overlay,"data-thread-reference-drop":!0,role:`status`,"aria-live":`polite`,children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:kx.invitation,children:[/* @__PURE__ */ (0,h.jsx)(`div`,{className:kx.hint,children:r(`reference.dropTitle`)}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:kx.preview,"data-thread-reference-preview":!0,children:[/* @__PURE__ */ (0,h.jsx)(d.ReferenceIconRegular,{kind:`session`,size:20}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:kx.title,children:o.title})]})]})})}function jx({renderSlot:e}){return e(`conversation.session`,{})}function Mx(){return null}function Nx(e){let{sessionId:t,phase:n,hero:r,useSession:i,useSessions:a,useSessionStatus:o,useWorkspaces:s,useInput:c,useComposerBlock:l,renderSlot:u,renderSlotChain:d,selectWorkspace:f,referenceEditor:p,t:m,useFactorySlot:_}=e,v=i(e=>e),y=_(`views`,jx),ee=_(`widthControls`,Mx),[b,x]=(0,g.useState)(null),S=o(e=>t===void 0?void 0:e.get(t)?.pendingInteraction),te=c(e=>e),ne=a(e=>t===void 0?void 0:e.byId[t]?.cwd),re=s(e=>e),ie=l(e=>e),[ae,oe]=(0,g.useState)(!1),[C,se]=(0,g.useState)(),ce=(0,g.useRef)(null),le=(0,g.useRef)(null),ue=(0,g.useCallback)(e=>{le.current?.disconnect(),le.current=null;let t=e?.parentElement??null;e!==null&&t!==null&&(le.current=new ResizeObserver(()=>{t.style.setProperty(`--dsh-composer-height`,`${e.offsetHeight}px`),t.style.setProperty(`--dsh-conversation-viewport-height`,`${t.clientHeight}px`)}),le.current.observe(e),le.current.observe(t))},[]),de=t===void 0?void 0:re.items.find(e=>e.sessionIds.includes(t)),w=re.items.find(e=>e.workspaceId===C);(0,g.useEffect)(()=>{C!==void 0&&((C===null?de===void 0:de?.workspaceId===C)||C!==null&&re.phase===`ready`&&w===void 0)&&se(void 0)},[C,de?.workspaceId,re.phase,w]);let T=v===void 0||te===void 0?void 0:{session:v,input:te},fe=(C===null?void 0:w?.title)??(C===null||t===void 0?void 0:de?.title??(re.phase===`ready`||ne===void 0||ne===``?void 0:wx(ne))),pe=fe===void 0?void 0:xx(fe,m(`workspace.defaultName`)),me=/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Q.heroWorkspaceRow,children:[/* @__PURE__ */ (0,h.jsx)(Tx,{buttonRef:ce,label:pe??(re.canStartProjectless?m(`hero.noWorkspace`):void 0),projectless:re.canStartProjectless===!0&&pe===void 0,menuOpen:ae,onClick:()=>{oe(e=>!e)},t:m}),u(`conversation.hero.workspace`,{open:ae,anchorRef:ce,selectedId:C===null?void 0:C??de?.workspaceId,onPick:e=>{oe(!1),se(e),f(e).catch(()=>{se(t=>t===e?void 0:t)})},onClose:()=>{oe(!1)}}),u(`conversation.hero.agentPreset`,{})]}),he=re.phase===`ready`&&!re.canStartProjectless&&pe===void 0,ge=t===void 0&&!he,_e=t===void 0||r&&he,ve=u(`conversation.composer.bar`,{variant:r?`hero`:`composer`,..._e?{disabled:!0,placeholder:m(ge?`placeholder.preparing`:`placeholder.workspace`),...ge?{}:{workspacePickerOpen:ae,onRequestWorkspace:()=>{oe(!0)}}}:!_e&&ie!==void 0?{blocked:ie,placeholder:ie.reason}:r?{placeholder:m(`placeholder.hero`)}:{}}),ye=/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Xy(Q.composerStack,r&&Q.composerHero),children:[r&&/* @__PURE__ */ (0,h.jsx)(Dx,{t:m,renderSlot:u}),r&&me,T!==void 0&&u(`conversation.input.dock`,T),ve]}),be=d(`conversation.composer`,{sessionId:t,session:v,pendingInteraction:v?.openState===`open`?S:void 0},{fallback:ye,fallbackOnly:t===void 0,overlay:!0}),xe=/* @__PURE__ */ (0,h.jsx)(`div`,{ref:ue,className:Q.composerSeat,"data-composer-seat":``,"data-conversation-region":`composer`,children:be});return/* @__PURE__ */ (0,h.jsxs)(`div`,{ref:x,className:Xy(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)(y,{}),xe]}),/* @__PURE__ */ (0,h.jsx)(ee,{container:b,phase:n}),/* @__PURE__ */ (0,h.jsx)(Ax,{container:b,editor:p,useSessions:a,t:m},t)]})}function Px({renderSlot:e}){return e(`main.conversation`,{})}function Fx({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&&ux(i,a)===`blank`;return/* @__PURE__ */ (0,h.jsxs)(`header`,{className:Xy(Q.header,o&&Q.headerBlank,e===void 0&&Q.headerSessionless),"data-window-drag":!0,children:[/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.headerLeading,"data-conversation-header-leading":``,children:r(`conversation.header.leading`,{})}),e===void 0?/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.titleRow}):r(`conversation.session.header`,{hideChrome:o})]})}function Ix(e,t){return(t===null?void 0:e.find(e=>e.id===t))??e.find(e=>e.id===`chat`)}function Lx({view:e,useSession:t,useConversation:n,useConversationViews:r,inputActions:i,useStore:a,actions:o,renderSlot:s,bindDraftPersistence:c,openView:l,useInspectCall:u}){let d=r(e=>e),f=u(e=>e),p=Ix(d,a(e=>e.view)),m=t(e=>e),_=n(e=>e),v=a(e=>e.viewRequest??null);if((0,g.useEffect)(()=>{let e=c(o.setDraft);return i.persistDraft(),()=>{e()}},[i]),m.blank&&ux(m,_)===`blank`)return null;let y=e??p?.id;return/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.viewArea,children:y!==void 0&&s(`conversation.view`,{inspectCall:f,viewRequest:v,openView:l,completeViewRequest:o.completeViewRequest},{only:y})})}function Rx(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 zx(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 Bx({sessionId:e,hideChrome:t,useSessions:n,useConversationViews:r,useStore:i,renderSlot:a,open:o,selectView:s,t:c}){let l=r(e=>e),u=Ix(l,i(e=>e.view)),d=n(t=>Rx(t,e),zx),f=!t&&l.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)(`nav`,{className:Q.crumbs,"aria-label":c(`session.hierarchy`),children:[d.map((e,t)=>{let n=t===d.length-1,r=n?/* @__PURE__ */ (0,h.jsx)(`span`,{className:Xy(Q.crumb,e.subagent&&Q.crumbSubagent,Q.crumbCurrent),children:e.displayTitle}):/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:Xy(Q.crumb,e.subagent&&Q.crumbSubagent),onClick:()=>{o(e.id)},children:e.displayTitle}),i=n||e.subagent,s={lineageSessionId:e.id,displayTitle:e.displayTitle,...n?{}:{openTitle:()=>{o(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?a(`conversation.session.header.lineage`,s,{fallback:r}):/* @__PURE__ */ (0,h.jsxs)(h.Fragment,{children:[r,a(`conversation.session.header.lineage`,s,{fallback:null})]}):r]},e.id)}),d.length===0&&/* @__PURE__ */ (0,h.jsx)(`span`,{className:Q.crumbCurrent,children:e})]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.headerActions,children:a(`conversation.session.header.actions`,{})})]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.headerUtilities,children:a(`conversation.session.header.utilities`,{})})]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.headerCorner,"data-conversation-header-corner":``,children:a(`conversation.session.header.corner`,{})})]}),f&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:Q.tabs,role:`tablist`,"data-conversation-tabs":``,children:l.map(e=>/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===u?.id,className:Xy(Q.tab,e.id===u?.id&&Q.tabActive),onClick:()=>{s(e.id)},children:e.label},e.id))})]})}function Vx(e){return/* @__PURE__ */ (0,h.jsx)(Lx,{...e})}function Hx({editor:e,editable:t,...n}){let r=(0,g.useRef)(null);return(0,g.useLayoutEffect)(()=>{let t=r.current;if(e!==null&&t!==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:r,contentEditable:e!==null&&t,suppressContentEditableWarning:!0,role:`textbox`,"aria-multiline":`true`,"data-composer-input":!0,...n})}function Ux({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 Wx({classNames:e,editor:t,scrollRef:n,editable:r,editorDisabled:i,phase:a,placeholderText:o,ariaLabel:s,workspaceTrigger:c,workspacePickerOpen:l,onWorkspaceKeyDown:u,hint:d,showPlaceholder:f}){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)(Hx,{editor:c?null:t,editable:r,className:Xy(e.input,i&&e.inputDisabled),"data-phase":a,"aria-disabled":i||void 0,"data-placeholder":o,"aria-label":s,"aria-haspopup":c?`menu`:void 0,"aria-expanded":c?l:void 0,tabIndex:c?0:void 0,onKeyDown:c?u:void 0,style:d===null?void 0:{"--dsh-composer-hint":JSON.stringify(d)}}),f&&/* @__PURE__ */ (0,h.jsx)(`div`,{"aria-hidden":!0,className:e.placeholder,"data-composer-placeholder":!0,children:o}),/* @__PURE__ */ (0,h.jsx)(Ux,{editor:c?null:t})]})})}function Gx(e,t){return e.isComposing||e.keyCode===229||t()}function Kx(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&&Gx(n,c);return t.arbitrate(e,r)!==`pass`&&(n?.preventDefault(),!0)};return Z_(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(Vu,l(`up`),4),e.registerCommand(Hu,l(`down`),4),e.registerCommand(Ju,e=>l(e.shiftKey?`tabBack`:`tab`)(e),4),e.registerCommand(Ku,e=>(t.dismissPopup(),t.arbitrate(`escape`,Gx(e,c))===`consumed`&&(e.preventDefault(),!0)),4),e.registerCommand(Wu,e=>Gx(e,c)?!1:t.space()?(e.preventDefault(),!0):!1,4),e.registerCommand(Uu,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&&Gx(e,c)?!0:t.arbitrate(`enter`,!1)===`pass`?(e?.preventDefault(),e?.repeat===!0||!t.canSubmit()||t.submit(e?.ctrlKey===!0||e?.metaKey===!0),!0):(e?.preventDefault(),!0),4),e.registerCommand(ku,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 qx(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 Jx(e,t){e.getRootElement()?.focus({preventScroll:!0}),e.focus(()=>{t()})}function Yx(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 Xx(e,t,n){return e.bindFilePicker({available:()=>t.current.canAcceptDrop&&n.current!==null,open:()=>{n.current?.click()}})}function Zx(e,t,n){return Kx(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.primaryAction===void 0?e&&r.canSteerQueue?t.steerQueue():r.uploadsPending?r.showToast(r.t(`file.stillUploading`)):t.submit(Ub(r.busyEnter,r.running,e?`accelerated`:`enter`,r.steeringAvailable),`enter`):r.uploadsPending||r.primaryAction.run()},intakeFiles:(e,t)=>{n.current.intakeFiles(e,t)},pasteText:e=>{n.current.machineBusy||n.current.locked||t.paste(e)}})}function Qx(e,t){e.preventDefault(),!(0,d.isMobileDevice)()&&t?.getRootElement()?.focus({preventScroll:!0})}function $x(e){let t=e/1048576;return`${Number.isInteger(t)?String(t):t.toFixed(1)}MB`}function eS(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`IMAGE_DIMENSION_TOO_LARGE`:if(n!==void 0)return e(`image.dimensionTooLarge`,{size:n.maxImageDimension});break;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:$x(n.maxImageBytes)});break;case`IMAGES_TOO_LARGE`:if(n!==void 0)return e(`image.totalTooLarge`,{size:$x(n.maxMessageImageBytes)})}return e(`image.sendFailed`,{reason:t})}function tS(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 nS=`@deepseek-ai/dsh-client-ui-conversation/ContextMeter.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(nS)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=nS,e.textContent=`.LDRuKa_root{flex:none;display:inline-flex}.LDRuKa_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}.LDRuKa_trigger:hover,.LDRuKa_trigger[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.LDRuKa_track{fill:none;stroke:var(--dsw-alias-border-l3);stroke-width:2px}.LDRuKa_fill{fill:none;stroke:var(--dsw-alias-label-tertiary);stroke-width:2px;stroke-linecap:round}.LDRuKa_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}.LDRuKa_header{align-items:center;gap:6px;display:flex}.LDRuKa_figures{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);margin-left:auto;font-weight:500}.LDRuKa_percent{color:var(--dsw-alias-label-primary);font-weight:500}.LDRuKa_headline{color:var(--dsw-alias-label-tertiary)}.LDRuKa_headline:empty{display:none}.LDRuKa_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}.LDRuKa_segment{background:var(--meter-tint,var(--dsw-alias-label-tertiary));border-radius:1px;flex:none;min-width:2px;height:100%}.LDRuKa_swatch{background:var(--meter-tint);vertical-align:baseline;border-radius:2px;width:8px;height:8px;margin-right:6px;display:inline-block}.LDRuKa_colorSystem{--meter-tint:var(--dsw-static-neutral-bluish-400)}.LDRuKa_colorTools{--meter-tint:#a78bfa}.LDRuKa_colorMessages{--meter-tint:var(--dsw-static-blue-450)}.LDRuKa_rows{margin:6px 0 0}.LDRuKa_row{justify-content:space-between;align-items:center;gap:12px;padding:2px 0;display:flex}.LDRuKa_row dt{color:var(--dsw-alias-label-secondary)}.LDRuKa_row dd{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);margin:0}`,document.head.appendChild(e)}var rS={bar:`LDRuKa_bar`,colorMessages:`LDRuKa_colorMessages`,colorSystem:`LDRuKa_colorSystem`,colorTools:`LDRuKa_colorTools`,figures:`LDRuKa_figures`,fill:`LDRuKa_fill`,header:`LDRuKa_header`,headline:`LDRuKa_headline`,panel:`LDRuKa_panel`,percent:`LDRuKa_percent`,root:`LDRuKa_root`,row:`LDRuKa_row`,rows:`LDRuKa_rows`,segment:`LDRuKa_segment`,swatch:`LDRuKa_swatch`,track:`LDRuKa_track`,trigger:`LDRuKa_trigger`};let iS=5.5,aS=2*Math.PI*iS,oS=[{key:`systemTokens`,label:`context.system`,color:rS.colorSystem},{key:`toolsTokens`,label:`context.tools`,color:rS.colorTools},{key:`messageTokens`,label:`context.messages`,color:rS.colorMessages}];function sS(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 cS({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=tS(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,ee=(r===void 0||y===0?[{key:`total`,color:void 0,width:f}]:oS.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:rS.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:rS.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:rS.track,cx:`7`,cy:`7`,r:iS}),/* @__PURE__ */ (0,h.jsx)(`circle`,{className:rS.fill,cx:`7`,cy:`7`,r:iS,strokeDasharray:`${aS*f/100} ${aS}`,transform:`rotate(-90 7 7)`})]}),/* @__PURE__ */ (0,h.jsx)(`span`,{children:p})]})}),i&&(0,_.createPortal)(/* @__PURE__ */ (0,h.jsxs)(`div`,{ref:s,className:rS.panel,style:u??{visibility:`hidden`,left:0,top:0},role:`dialog`,"aria-label":t(`context.used`),children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:rS.header,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:rS.headline,children:m}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:rS.percent,children:p}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:rS.headline,children:v}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:rS.figures,children:`~${sS(c.usedTokens,t)} / ${sS(c.contextWindow,t)}`})]}),/* @__PURE__ */ (0,h.jsx)(`div`,{className:rS.bar,children:ee.map(e=>/* @__PURE__ */ (0,h.jsx)(`div`,{className:e.color===void 0?rS.segment:`${rS.segment} ${e.color}`,style:{width:`${e.width}%`}},e.key))}),r!==void 0&&/* @__PURE__ */ (0,h.jsx)(`dl`,{className:rS.rows,children:oS.map(e=>/* @__PURE__ */ (0,h.jsxs)(`div`,{className:rS.row,children:[/* @__PURE__ */ (0,h.jsxs)(`dt`,{children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:`${rS.swatch} ${e.color}`,"aria-hidden":!0}),t(e.label)]}),/* @__PURE__ */ (0,h.jsx)(`dd`,{children:`~${sS(r[e.key],t)}`})]},e.key))})]}),document.body)]})}function lS(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 uS=`@deepseek-ai/dsh-client-ui-conversation/InputBar.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(uS)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=uS,e.textContent=`.b5Vi8W_root{padding:0 var(--dsh-composer-side-clearance) 4px;flex-direction:column;align-items:center;display:flex}.b5Vi8W_dock{justify-content:center;align-items:center;gap:12px;max-width:100%;padding-top:4px;display:flex}.b5Vi8W_hero .b5Vi8W_dock:empty{display:none}.b5Vi8W_hero{padding:0 var(--dsh-composer-side-clearance)}.b5Vi8W_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);margin-bottom:6px;padding:4px 8px;font-size:12px;line-height:18px}.b5Vi8W_card{box-sizing:border-box;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)){[data-phone] .b5Vi8W_card{box-shadow:none;background:0 0}[data-phone] .b5Vi8W_card:before{content:"";z-index:-1;border-radius:inherit;background:color-mix(in srgb, var(--dsw-specific-input-major) 24%, transparent);backdrop-filter:blur(14px);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}}@media (prefers-reduced-transparency:reduce),(prefers-contrast:more),(forced-colors:active){[data-phone] .b5Vi8W_card{background:var(--dsw-specific-input-major);box-shadow:var(--dsw-elevation-soft)}[data-phone] .b5Vi8W_card:before{display:none}}@media (prefers-contrast:more),(forced-colors:active){[data-phone] .b5Vi8W_card:not(.b5Vi8W_cardWorkspaceTrigger){outline:1px solid var(--dsw-alias-label-primary);outline-offset:-1px}}.b5Vi8W_cardWorkspaceTrigger{--dsw-elevation-stroke-color:transparent;cursor:pointer}.b5Vi8W_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}.b5Vi8W_cardWorkspaceTrigger :disabled{pointer-events:none}.b5Vi8W_cardWorkspaceTrigger:hover:after{color:var(--dsw-alias-state-business-primary)}.b5Vi8W_inlineNotices{flex-direction:column;gap:8px;display:flex}.b5Vi8W_inlineNotices>[data-slot]>*{margin:10px 10px 0}.b5Vi8W_accessory{align-items:center;gap:8px;padding:10px 12px 0;display:flex}.b5Vi8W_overlayAnchor{height:0;position:absolute;inset:0 0 auto}.b5Vi8W_scroll{max-height:var(--dsh-composer-text-max-height);margin-right:4px;overflow-y:auto}.b5Vi8W_scroll::-webkit-scrollbar-track{margin-top:8px}.b5Vi8W_grow{position:relative}.b5Vi8W_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 b5Vi8W_input-pending}@keyframes b5Vi8W_input-pending{0%{opacity:.35}to{opacity:1}}.b5Vi8W_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);outline:none;padding:4px 8px 0 14px}.b5Vi8W_input p{margin:0}.b5Vi8W_input p:last-child:after{content:var(--dsh-composer-hint);color:var(--dsw-alias-label-caption)}.b5Vi8W_input[data-composer-composing] p:last-child:after{content:none}.b5Vi8W_input[data-composer-composing]+.b5Vi8W_placeholder{visibility:hidden}.b5Vi8W_placeholder{color:var(--dsw-alias-label-caption);white-space:nowrap;text-overflow:ellipsis;pointer-events:none;user-select:none;position:absolute;inset:4px 8px auto 14px;overflow:hidden}.b5Vi8W_inputDisabled{color:var(--dsw-alias-label-tertiary);cursor:not-allowed}.b5Vi8W_input[aria-haspopup=menu]{cursor:pointer}.b5Vi8W_hero .b5Vi8W_input{min-height:52px}.b5Vi8W_hero .b5Vi8W_placeholder{white-space:normal;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box}@media (width<=600px){.b5Vi8W_hero .b5Vi8W_input{min-height:36px}.b5Vi8W_hero .b5Vi8W_placeholder{white-space:nowrap;display:block}}.b5Vi8W_row{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}.b5Vi8W_row[data-model-compact]{--dsh-composer-model-text-display:none;--dsh-composer-model-icon-display:block}.b5Vi8W_tools,.b5Vi8W_modes,.b5Vi8W_trailing{align-items:center;min-width:0;display:flex}.b5Vi8W_tools,.b5Vi8W_modes{gap:12px}.b5Vi8W_trailing{flex:none;gap:12px;margin-left:auto}@container (width<=560px){.b5Vi8W_tools,.b5Vi8W_modes,.b5Vi8W_trailing{gap:8px}}.b5Vi8W_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}.b5Vi8W_add:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid)}.b5Vi8W_add:disabled{opacity:.5;cursor:default}.b5Vi8W_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}.b5Vi8W_select:hover:not(:disabled){background-color:var(--dsw-alias-interactive-bg-hover)}.b5Vi8W_select:disabled{opacity:.5;cursor:default}.b5Vi8W_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)}.b5Vi8W_primary:hover:not(:disabled){background:var(--dsw-alias-button-info-hover)}.b5Vi8W_primary:disabled{opacity:.4;cursor:default}.b5Vi8W_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}.b5Vi8W_addSeat,.b5Vi8W_submitSeat,.b5Vi8W_controlScroll{display:contents}.b5Vi8W_row[data-phone-toolbar]{flex-wrap:nowrap;gap:4px;position:relative}.b5Vi8W_row[data-phone-toolbar] .b5Vi8W_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}.b5Vi8W_row[data-phone-toolbar] .b5Vi8W_controlScroll::-webkit-scrollbar{display:none}.b5Vi8W_row[data-phone-toolbar] .b5Vi8W_tools:not([hidden]),.b5Vi8W_row[data-phone-toolbar] .b5Vi8W_trailing:not(.b5Vi8W_trailingActive){display:contents}.b5Vi8W_row[data-phone-toolbar] .b5Vi8W_tools>*,.b5Vi8W_row[data-phone-toolbar] [data-slot="conversation.input.left"]>*{flex-shrink:0}.b5Vi8W_row[data-phone-toolbar] button:focus-visible{outline-offset:-2px}.b5Vi8W_row[data-phone-toolbar] .b5Vi8W_modes,.b5Vi8W_row[data-phone-toolbar] .b5Vi8W_standardControls{flex:none;gap:4px;width:max-content}.b5Vi8W_row[data-phone-toolbar] .b5Vi8W_standardControls{margin-left:0}.b5Vi8W_row[data-phone-toolbar] .b5Vi8W_addSeat,.b5Vi8W_row[data-phone-toolbar] .b5Vi8W_submitSeat{z-index:1;flex:none;align-items:center;gap:4px;display:flex;position:absolute;inset-block:2px 6px}.b5Vi8W_row[data-phone-toolbar] .b5Vi8W_addSeat{left:8px}.b5Vi8W_row[data-phone-toolbar] .b5Vi8W_submitSeat{margin-left:0;right:8px}.b5Vi8W_row[data-phone-toolbar] .b5Vi8W_add,.b5Vi8W_row[data-phone-toolbar] .b5Vi8W_primary{box-sizing:border-box;background-clip:padding-box;width:44px;height:44px}.b5Vi8W_row[data-phone-toolbar] .b5Vi8W_add{border:8px solid #0000}.b5Vi8W_row[data-phone-toolbar] .b5Vi8W_primary{border:7px solid #0000}.b5Vi8W_row[data-phone-toolbar][data-toolbar-activity] .b5Vi8W_controlScroll{display:contents}.b5Vi8W_row[data-phone-toolbar][data-toolbar-activity] .b5Vi8W_submitSeat{position:static}.b5Vi8W_row[data-actions-overflow] [data-composer-overflow-action]{display:none}.b5Vi8W_standardControls{align-items:center;gap:12px;min-width:0;display:flex}.b5Vi8W_tools[hidden],.b5Vi8W_standardControls[hidden]{display:none}.b5Vi8W_trailingActive{flex:1;margin-left:0}.b5Vi8W_activity{flex:none;align-items:center;display:flex}.b5Vi8W_activity:empty{display:none}.b5Vi8W_activityExpanded{flex:1;min-width:0}`,document.head.appendChild(e)}var $={accessory:`b5Vi8W_accessory`,activity:`b5Vi8W_activity`,activityExpanded:`b5Vi8W_activityExpanded`,add:`b5Vi8W_add`,addSeat:`b5Vi8W_addSeat`,card:`b5Vi8W_card`,cardWorkspaceTrigger:`b5Vi8W_cardWorkspaceTrigger`,controlScroll:`b5Vi8W_controlScroll`,dock:`b5Vi8W_dock`,grow:`b5Vi8W_grow`,hero:`b5Vi8W_hero`,inlineNotices:`b5Vi8W_inlineNotices`,input:`b5Vi8W_input`,"input-pending":`b5Vi8W_input-pending`,inputDisabled:`b5Vi8W_inputDisabled`,modes:`b5Vi8W_modes`,notice:`b5Vi8W_notice`,overlayAnchor:`b5Vi8W_overlayAnchor`,pending:`b5Vi8W_pending`,placeholder:`b5Vi8W_placeholder`,primary:`b5Vi8W_primary`,retry:`b5Vi8W_retry`,root:`b5Vi8W_root`,row:`b5Vi8W_row`,scroll:`b5Vi8W_scroll`,select:`b5Vi8W_select`,standardControls:`b5Vi8W_standardControls`,submitSeat:`b5Vi8W_submitSeat`,tools:`b5Vi8W_tools`,trailing:`b5Vi8W_trailing`,trailingActive:`b5Vi8W_trailingActive`};let dS=(0,g.memo)(function({useSession:e,useInput:t,inputActions:n,keyboard:r,addFiles:i,removeAttachment:a,resolveDraftAttachments:o,retryFileUpload:s,toggleCommandMenu:c,stop:l,t:u,renderSlot:f,useBusyEnter:p,useFileUploads:m,useNotices:_,useLexicon:v,useMenuLauncher:y,useStopShortcut:ee,useProjection:b,sessionId:x,variant:S,disabled:te=!1,blocked:ne,workspacePickerOpen:re=!1,onRequestWorkspace:ie,placeholder:ae,accessory:oe}){let C=t(e=>e),se=_(e=>e),ce=p(e=>e),le=ee(e=>e),ue=y(e=>e===`command`),[de,w]=(0,g.useState)(!1);(0,g.useEffect)(()=>{w(!1)},[x]);let T=e(e=>e.promptError)??null,fe=e(e=>e.running)??!1,pe=e(e=>e.subagent)??null,me=e(e=>e.removed)??!1,he=b(`plan`,e=>e!==void 0&&(e.pending?!e.active:e.active)),ge=b(`goal`,e=>e!=null),_e=C!==void 0&&r!==void 0&&n!==void 0,ve=C?.draft??``,ye=C?.primaryAction,be=r?.editor??null,xe=(0,g.useMemo)(()=>C===void 0||o===void 0?[]:o(C.attachmentIds),[o,C?.attachmentIds]),Se=ve.trim()===``&&xe.length===0,Ce=m(e=>e),we=xe.some(e=>e.kind===`file`&&Ce[e.id]?.status!==`ready`),[Te,Ee]=(0,g.useState)(null),De=(0,g.useRef)(0),Oe=(0,g.useCallback)(e=>{De.current+=1,Ee({seq:De.current,text:e})},[]),ke=(0,g.useCallback)(()=>{Ee(null)},[]),Ae=b(`imageLimits`),je=b(`attachmentInput`),Me=je?.enabled!==!1,Ne=je?.imagesOnly===!0;(0,g.useEffect)(()=>{if(T===null)return;let{error:e}=T;e.code===`session/writer-held`?Oe(u(`error.sessionInUse`)):Oe(e.code===`session/attachment-invalid`||e.code===`subagent/attachment-invalid`?eS(u,e.details.reason,Ae):`${e.message} (${e.code})`)},[T,Oe,u,Ae]),(0,g.useEffect)(()=>{se?.level===`error`&&Oe(se.text)},[se,Oe]);let Pe=(0,g.useRef)(null),[Fe,Ie]=(0,g.useState)({phone:!1,overflowActions:!1});(0,g.useLayoutEffect)(()=>{let e=Pe.current;if(e!==null)return lS(e,Ie)},[]);let Le=(0,g.useRef)(null),Re=(0,g.useRef)(null),ze=pe?.address.mode===`continuable`,Be=ze&&pe.parentAvailable!==!0,Ve=me||te||!_e||ne!==void 0||Be,He=Ve,Ue=me||te||!_e,We=C?.phase===`adjudicating`||C?.phase===`submitting`,Ge=te&&!me&&ie!==void 0,Ke=me||He&&!Ge,qe=_e&&!He&&!We,Je=pe===null||pe.address.mode===`continuable`,Ye=!He&&!We&&Se&&fe&&Je&&C.queue.length>0;(0,g.useEffect)(()=>{C!==void 0&&n!==void 0&&xe.length!==C.attachmentIds.length&&n.pruneAttachments(xe.map(e=>e.id))},[xe,C?.attachmentIds,n]);let Xe=()=>{qx(Re)};(0,g.useEffect)(()=>{He||be===null||(0,d.shouldAutoFocusTextInput)()&&Jx(be,Xe)},[He,x,be]),(0,g.useEffect)(()=>{He||ve===``||Xe()},[ve!==``]),(0,g.useEffect)(()=>Yx(Re),[]);let Ze=(0,g.useCallback)((e,t)=>{if(pe!==null||i===void 0||e.length===0)return;if(!Me){Oe(u(`attachment.unavailable`));return}let n=(()=>{if(Ne&&e.some(e=>!(Ae?.mediaTypes)?.includes(e.type)))return u(`image.unsupportedType`);if(Ae!==void 0){let t=Ae.mediaTypes,n=e.filter(e=>t.includes(e.type)),r=xe.filter(e=>e.kind===`image`);if(r.length+n.length>Ae.maxImagesPerMessage)return u(`image.tooMany`,{count:Ae.maxImagesPerMessage});if(n.some(e=>e.size>Ae.maxImageBytes))return u(`image.fileTooLarge`,{size:$x(Ae.maxImageBytes)});if(r.reduce((e,t)=>e+t.file.size,0)+n.reduce((e,t)=>e+t.size,0)>Ae.maxMessageImageBytes)return u(`image.totalTooLarge`,{size:$x(Ae.maxMessageImageBytes)})}return i(e,t)})();n!==null&&Oe(n)},[pe,i,Me,Ne,xe,Ae,Oe,u]),Qe=Me&&pe===null&&!He&&!We&&i!==void 0,$e=u(Me?Ne?`input.imagesAndCommands`:`input.commands`:`input.commandsOnly`),et=(0,g.useRef)(null),tt=e=>{let t=e.target.files===null?[]:[...e.target.files];e.target.value=``,t.length>0&&Ze(t)},nt=(0,g.useRef)({locked:He,machineBusy:We,primaryAction:ye,canSteerQueue:Ye,running:fe,steeringAvailable:Je,busyEnter:ce,intakeFiles:Ze,uploadsPending:we,showToast:Oe,t:u,canAcceptDrop:Qe});nt.current={locked:He,machineBusy:We,primaryAction:ye,canSteerQueue:Ye,running:fe,steeringAvailable:Je,busyEnter:ce,intakeFiles:Ze,uploadsPending:we,showToast:Oe,t:u,canAcceptDrop:Qe},(0,g.useEffect)(()=>{if(r!==void 0)return Xx(r,nt,et)},[r]),(0,g.useEffect)(()=>{if(be!==null&&r!==void 0)return Zx(be,r,nt)},[be,r]);let rt=e=>{Qx(e,be)},it=()=>{r!==void 0&&(be!==null&&(0,d.shouldAutoFocusTextInput)()&&Jx(be,Xe),c?.(r.caretSpan()))},at=e=>{Ge&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),ie())},ot=ye===void 0&&fe&&pe===null&&(Se||ne!==void 0),st=ot?l===void 0:(ye===void 0?Se:ye.disabled)||Ve||We||we,ct=fe&&ze,lt=Ub(ce,fe,`enter`,Je),ut=!Se&&C?.phase===`plain`&&!ve.trimStart().startsWith(`/`),dt=u(ot?`input.stop`:ye===void 0&&fe&&Je&&!Ve&&!we&&ut?lt===`steer`?`input.send.steer`:`input.send.queue`:`input.send`),ft=()=>{ot?l?.():ye===void 0?r!==void 0&&!Se&&!Ve&&!We&&!we&&r.submit(lt,`click`):st||ye.run()},pt=(C?.phase===`claimed`||C?.phase===`submitting`)&&C.claim!==void 0&&ve.startsWith(C.claim.token),mt=pt&&C.claim.hint!==void 0&&ve.slice(C.claim.token.length).trim()===``?C.claim.hint:null,ht=(()=>{if(mt===null)return null;let e=C?.claim?.name??``,t=`hint.${e===`goal`&&ge?`goal.active`:e}`,n=u(t);return n===t?mt:n})(),gt=ae??u(Be?`placeholder.parentOffline`:Ve?`placeholder.unavailable`:Ye?`placeholder.steerQueue`:he?`placeholder.plan`:`placeholder.default`);return/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Xy($.root,S===`hero`&&$.hero),children:[Te!==null&&/* @__PURE__ */ (0,h.jsx)(d.Toast,{text:Te.text,icon:/* @__PURE__ */ (0,h.jsx)(d.IconWarningOutlineRegular,{}),anchor:Le.current,onDone:ke},Te.seq),se?.level===`info`&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.notice,role:`status`,children:se.text}),/* @__PURE__ */ (0,h.jsxs)(`div`,{ref:Le,className:Xy($.card,Ge&&$.cardWorkspaceTrigger),"data-composer-card":!0,onClick:Ge?ie:void 0,onPointerDown:Ge?e=>{e.stopPropagation()}:void 0,children:[x!==void 0&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.overlayAnchor,children:f(`conversation.input.overlay`,{})}),oe!==void 0&&/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.accessory,children:oe}),C===void 0||x===void 0?null:/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.inlineNotices,children:f(`conversation.input.notice`,{})}),f(`conversation.input.attachments`,{attachments:xe,canAcceptDrop:Qe,onAddFiles:Ze,onRemoveAttachment:e=>{a?.(e)},uploads:Ce,onRetryFile:e=>{s?.(e)},dropLimits:Ae===void 0?void 0:{count:Ae.maxImagesPerMessage,size:$x(Ae.maxImageBytes)}}),/* @__PURE__ */ (0,h.jsx)(Wx,{classNames:$,editor:be,scrollRef:Re,editable:qe,editorDisabled:Ke,phase:C?.phase??`inert`,placeholderText:gt,ariaLabel:Ge?u(`hero.chooseWorkspace`):gt,workspaceTrigger:Ge,workspacePickerOpen:re,onWorkspaceKeyDown:at,hint:ht,showPlaceholder:ve===``&&xe.length===0&&!pt}),/* @__PURE__ */ (0,h.jsx)(`div`,{ref:Pe,className:$.row,"data-composer-toolbar":!0,"data-command-menu-open":ue||void 0,"data-toolbar-activity":de||void 0,children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.controlScroll,"data-toolbar-scroll":!0,children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.tools,hidden:de,"data-composer-tools":!0,children:[/* @__PURE__ */ (0,h.jsx)(`div`,{className:$.addSeat,"data-toolbar-fixed":`start`,children:/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:Fe.phone,label:$e,side:`top`,delayMs:500,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:$.add,"aria-label":$e,"aria-haspopup":`listbox`,"aria-expanded":ue,disabled:He||We||c===void 0,onMouseDown:rt,onClick:it,children:/* @__PURE__ */ (0,h.jsx)(d.IconPlusOutlineMedium,{size:14})})})}),/* @__PURE__ */ (0,h.jsx)(`input`,{ref:et,type:`file`,accept:Ne?Ae?.mediaTypes.join(`,`):void 0,multiple:!0,disabled:!Me||pe!==null,hidden:!0,onChange:tt}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.modes,children:[x===void 0?null:f(`conversation.input.permission`,{locked:He}),x===void 0?null:f(`conversation.input.plan`,{locked:He})]}),C===void 0||x===void 0?null:f(`conversation.input.left`,{})]}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:Xy($.trailing,de&&$.trailingActive),children:[/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.standardControls,hidden:de,children:[C===void 0||x===void 0?null:f(`conversation.input.right`,{overflowActions:Fe.overflowActions}),x===void 0?null:f(`conversation.input.model`,{locked:Ue})]}),C===void 0||x===void 0?null:/* @__PURE__ */ (0,h.jsx)(`div`,{className:de?$.activityExpanded:$.activity,children:f(`conversation.input.activity`,{locked:He,onActiveChange:w})}),/* @__PURE__ */ (0,h.jsxs)(`div`,{className:$.submitSeat,"data-toolbar-fixed":`end`,children:[ct&&/* @__PURE__ */ (0,h.jsx)(d.Tooltip,{portal:Fe.phone,label:u(`input.stop`),shortcutKeys:le,side:`top`,delayMs:500,disabled:l===void 0,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:$.primary,"aria-label":u(`input.stop`),disabled:l===void 0,onMouseDown:rt,onClick:l,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:Fe.phone,label:ot?u(`input.stop`):dt,shortcutKeys:ot?le:void 0,side:`top`,delayMs:500,disabled:st,children:/* @__PURE__ */ (0,h.jsx)(`button`,{type:`button`,className:$.primary,"aria-label":dt,disabled:st,onMouseDown:rt,onClick:ft,children:ot?/* @__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,children:[S===`composer`&&C!==void 0&&x!==void 0?f(`conversation.composer.dock`,{}):null,de?null:/* @__PURE__ */ (0,h.jsx)(cS,{useProjection:b,t:u})]})]})}),fS=`@deepseek-ai/dsh-client-ui-conversation/TodoPanel.module.css`;if(typeof document<`u`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(fS)+`]`)===null){let e=document.createElement(`style`);e.dataset.plugin=`@deepseek-ai/dsh-client-ui-conversation`,e.dataset.pluginCss=fS,e.textContent=`.Sdgm8W_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}.Sdgm8W_body{flex-direction:column;gap:8px;padding:6px 12px;display:flex}.Sdgm8W_header{text-align:left;cursor:pointer;background:0 0;border:none;align-items:center;gap:10px;width:100%;padding:0;display:flex}.Sdgm8W_lead{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.Sdgm8W_title{color:var(--dsw-alias-label-primary);flex:none;font-size:13px;font-weight:500;line-height:24px}.Sdgm8W_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}.Sdgm8W_chevron{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.Sdgm8W_list{flex-direction:column;gap:8px;max-height:180px;margin:0;padding:0;list-style:none;display:flex;overflow-y:auto}.Sdgm8W_item{min-width:0;color:var(--dsw-alias-label-secondary);align-items:center;gap:10px;font-size:13px;line-height:20px;display:flex}.Sdgm8W_glyph{flex:none;place-items:center;width:16px;height:16px;display:grid}.Sdgm8W_content{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}`,document.head.appendChild(e)}var pS={body:`Sdgm8W_body`,chevron:`Sdgm8W_chevron`,content:`Sdgm8W_content`,glyph:`Sdgm8W_glyph`,header:`Sdgm8W_header`,item:`Sdgm8W_item`,lead:`Sdgm8W_lead`,list:`Sdgm8W_list`,progress:`Sdgm8W_progress`,root:`Sdgm8W_root`,title:`Sdgm8W_title`};
|
|
172
172
|
/* v8 ignore next 3 -- closed-union backstop; only reached if status is forged */
|
|
173
173
|
function mS(e){throw Error(`unreachable todo status: ${String(e)}`)}function hS(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
175
|
default:return mS(e)}}function gS(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 mS(e)}}function _S(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 vS({todos:e,t}){let[n,r]=(0,g.useState)(!0);return e.length===0?null:/* @__PURE__ */ (0,h.jsx)(`section`,{className:pS.root,"data-testid":`todo-panel`,"aria-label":t(`todo.title`),children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:pS.body,children:[/* @__PURE__ */ (0,h.jsxs)(`button`,{type:`button`,className:pS.header,"aria-expanded":!n,onClick:()=>{r(e=>!e)},children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:pS.lead,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconChecklistOutlineRegular,{})}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:pS.title,children:t(`todo.title`)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:pS.progress,children:_S(e,t)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:pS.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:pS.list,children:e.map(e=>/* @__PURE__ */ (0,h.jsxs)(`li`,{className:pS.item,"data-status":e.status,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:pS.glyph,role:`img`,"aria-label":gS(e.status,t),children:/* @__PURE__ */ (0,h.jsx)(d.StateDot,{state:hS(e.status)})}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:pS.content,children:e.content})]},e.content))})]})})}function yS({useProjection:e,t}){let n=e(`todos`);return/* @__PURE__ */ (0,h.jsx)(vS,{todos:n??[],t})}let bS={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:
|
|
177
|
+
default:return mS(e)}}function _S(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 vS({todos:e,t}){let[n,r]=(0,g.useState)(!0);return e.length===0?null:/* @__PURE__ */ (0,h.jsx)(`section`,{className:pS.root,"data-testid":`todo-panel`,"aria-label":t(`todo.title`),children:/* @__PURE__ */ (0,h.jsxs)(`div`,{className:pS.body,children:[/* @__PURE__ */ (0,h.jsxs)(`button`,{type:`button`,className:pS.header,"aria-expanded":!n,onClick:()=>{r(e=>!e)},children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:pS.lead,"aria-hidden":!0,children:/* @__PURE__ */ (0,h.jsx)(d.IconChecklistOutlineRegular,{})}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:pS.title,children:t(`todo.title`)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:pS.progress,children:_S(e,t)}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:pS.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:pS.list,children:e.map(e=>/* @__PURE__ */ (0,h.jsxs)(`li`,{className:pS.item,"data-status":e.status,children:[/* @__PURE__ */ (0,h.jsx)(`span`,{className:pS.glyph,role:`img`,"aria-label":gS(e.status,t),children:/* @__PURE__ */ (0,h.jsx)(d.StateDot,{state:hS(e.status)})}),/* @__PURE__ */ (0,h.jsx)(`span`,{className:pS.content,children:e.content})]},e.content))})]})})}function yS({useProjection:e,t}){let n=e(`todos`);return/* @__PURE__ */ (0,h.jsx)(vS,{todos:n??[],t})}let bS={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:Gb},yS))}};var xS=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 SS(e,t,n,r,i){let a=()=>{},o=new xS(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 CS=[`slots`,`sessions`,`fileUpload`,`uiSession`,`uiWorkspace`,`locale`,`configForms`],wS=T.object({maxConcurrentFileUploads:T.natural().min(1).default(2)}),TS={getSnapshot:()=>null,subscribe:()=>()=>{}},ES={getSnapshot:()=>void 0,subscribe:()=>()=>{}},DS=/* @__PURE__ */ new Map,OS={getSnapshot:()=>DS,subscribe:()=>()=>{}},kS={getSnapshot:()=>null,subscribe:()=>()=>{}},AS={},jS={getSnapshot:()=>AS,subscribe:()=>()=>{}};function MS(){return globalThis.__DSH_HOST_PATHS__}function NS(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 PS(e){let t=e.get(`conversation`);if(t===void 0)throw Error(`ui-conversation: conversation service unavailable`);return t}function FS(e,t=wS({})){let n=e.sessions,r=e.slots,i=t.maxConcurrentFileUploads,a=e.get(`uiWorkspace`),o=new xt(e,n);e.effect(()=>e.locale.register(Gb,{zh:Jb,en:Yb}),`ui-conversation: dictionaries`);let s=e.locale.bind(Gb),c=ec(),l=new Wb(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:Gb,inject:()=>({hooks:{busyEnter:l.busyEnter},setBusyEnter:e=>{l.setBusyEnter(e)}})},cx));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=
|
|
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=Ix(u(),t);n!==void 0&&o.binding(e).activate(n.id)},h=e=>{m(e,nc(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`))},ee=()=>{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 _)h(e.sessionId)};e.effect(()=>{let t=r.subscribe(`conversation.view`,ee),n=e.locale.subscribe(ee),i=e.configForms.developerTools.enabled.subscribe(ee);return()=>{i(),n(),t()}},`ui-conversation: View selection`);let b=e=>{NS(n,e).cancel().catch(e=>{})},x=(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(()=>SS(t.shortcuts,n,e=>o.binding(e).openTurn,e.uiSession,b),`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 x.set(e.keys),()=>{x.set([]),n()}},`ui-conversation: fixed stop reference`)});let S=new Rb(e,s),te=new hc;e.inject([`commandUi`],e=>{let t=e.get(`commandUi`);e.effect(()=>t.register({name:`file`,label:()=>s(`input.file`),icon:d.IconPaperclipOutlineRegular,available:e=>S.canPickFiles(e.sessionId),ui:{kind:`action`,run:e=>{S.pickFiles(e.sessionId)}}}),`ui-conversation: File action`)}),e.uiSession.provide({hooks:[`conversation`,`input`],props:[`inputActions`],resolve:e=>{y(e);let t=S.shellFor(e),n=o.binding(e);return h(e.sessionId),{hooks:{conversation:n.snapshot,input:t.state},props:{inputActions:t.actions}}}});let ne=()=>r.register({name:`main.conversation`,children:{"conversation.header":{kind:`single`,scope:`session-maybe`},"conversation.header.notice":{kind:`list`,scope:`session-maybe`}}},bx),re=()=>r.registerFactory({name:`conversation.content`,scope:`session-maybe`,locale:Gb,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:S.shell(t).editor,hooks:{composerBlock:t===void 0?ES:te.storeFor(t)},selectWorkspace:r=>a.openWorkspace(r,r=>{if(t!==void 0&&r!==t){let i=S.shell(t),a=i.draftSnapshot,o=i.snapshot.attachmentIds,s=S.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(PS(e).rebindDraftFiles(r,o),a.text!==``&&(s.setDraft(a),i.setDraft(``)),o.length>0)for(let e of o)i.removeAttachment(e)}}})})},Nx),ie=()=>r.register({name:`conversation.session`,children:{"conversation.view":{kind:`list`,scope:`session`}},store:c,inject:(e,t)=>{let n=(n,r)=>{u().some(e=>e.id===n)&&(m(e,n),t.openView(n,r))},r=()=>o.views.entries().find(e=>e.toolCallFocus!==void 0&&g.getSnapshot().some(t=>t.id===e.target)),i=e=>{let t=r();t?.toolCallFocus!==void 0&&n(t.target,t.toolCallFocus(e))};return{hooks:{conversationViews:g,inspectCall:{getSnapshot:()=>r()===void 0?void 0:i,subscribe:e=>{let t=g.subscribe(e),n=o.views.subscribe(e);return()=>{t(),n()}}}},bindDraftPersistence:t=>S.shell(e).bindDraftPersistence(t),openView:n}}},Vx),ae=()=>r.register({name:`conversation.header`,children:{"conversation.header.leading":{kind:`single`,scope:`root`},"conversation.session.header":{kind:`single`,scope:`session`}}},Fx),oe=()=>r.register({name:`conversation.session.header`,locale:Gb,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)}})},Bx),C=()=>r.register({name:`conversation.composer.bar`,locale:Gb,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,addFiles:void 0,removeAttachment:void 0,resolveDraftAttachments:void 0,retryFileUpload:void 0,toggleCommandMenu:void 0,stop:void 0,hooks:{stopShortcut:x,busyEnter:l.busyEnter,fileUploads:jS,notices:TS,lexicon:OS,menuLauncher:kS}};let r=PS(e),i=S.shell(t),a=S.inputTriggers(t),o=MS();return{keyboard:i,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&&pc(t.type)){c.push(t);continue}let r=ac(n,u),i=rc({path:e?`${r}/`:r,kind:`file`},!1);if(i===void 0)return s(`attachment.pathUnsupported`);let d=ic(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 uc?s(`image.unsupportedType`):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)},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:()=>{b(t)},hooks:{stopShortcut:x,busyEnter:l.busyEnter,fileUploads:r.fileUploads,notices:i.notices,lexicon:i.lexicon,menuLauncher:a?.launcher??kS}}}},dS);r.inject(`main`,function*(){yield r.register({name:`main`,key:`conversation`,children:{"main.conversation":{kind:`single`,scope:`session-maybe`}}},Px),yield ne(),yield re(),yield ie(),yield ae(),yield oe(),yield C()}),e.plugin(dc,{input:S,blocks:te,maxConcurrentFileUploads:i}),e.plugin(bS),e.plugin(ix,S)}return n.Config=wS,n.ConversationController=dc,n.ConversationDefinitionRegistry=dt,n.ConversationEventRegistry=ft,n.ConversationLocationIndex=Ye,n.ConversationNodeAssembler=ct,n.ConversationViewRegistry=vt,n.EMPTY_CONVERSATION_SNAPSHOT=lx,n.UiConversation=xt,n.UnsupportedImageMediaTypeError=uc,n.apply=FS,n.conversationPhase=ux,n.inject=CS,n.inspectRequestPrompt=je,t.exports}});
|