@kdonev/termscape 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/profiles.d.ts +7 -0
- package/dist/agents/profiles.d.ts.map +1 -1
- package/dist/agents/profiles.js +5 -0
- package/dist/agents/profiles.js.map +1 -1
- package/dist/agents/router.d.ts +12 -6
- package/dist/agents/router.d.ts.map +1 -1
- package/dist/agents/router.js +12 -6
- package/dist/agents/router.js.map +1 -1
- package/dist/agents/templates.d.ts +11 -8
- package/dist/agents/templates.d.ts.map +1 -1
- package/dist/agents/templates.js +12 -9
- package/dist/agents/templates.js.map +1 -1
- package/dist/agents/visibility.d.ts +22 -0
- package/dist/agents/visibility.d.ts.map +1 -0
- package/dist/agents/visibility.js +20 -0
- package/dist/agents/visibility.js.map +1 -0
- package/dist/agents/wiring.d.ts +1 -1
- package/dist/agents/wiring.d.ts.map +1 -1
- package/dist/agents/wiring.js +12 -10
- package/dist/agents/wiring.js.map +1 -1
- package/dist/cli.js +25 -7
- package/dist/cli.js.map +1 -1
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/migrations.js +17 -0
- package/dist/db/migrations.js.map +1 -1
- package/dist/db/store.d.ts +1 -0
- package/dist/db/store.d.ts.map +1 -1
- package/dist/db/store.js +9 -4
- package/dist/db/store.js.map +1 -1
- package/dist/hub.d.ts +111 -30
- package/dist/hub.d.ts.map +1 -1
- package/dist/hub.js +339 -90
- package/dist/hub.js.map +1 -1
- package/dist/hub.tgz +0 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +6 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/protocol/domain.d.ts +1 -0
- package/dist/protocol/domain.d.ts.map +1 -1
- package/dist/protocol/domain.js +12 -0
- package/dist/protocol/domain.js.map +1 -1
- package/dist/protocol/mcp-tools.js +1 -1
- package/dist/protocol/mcp-tools.js.map +1 -1
- package/dist/protocol/peer.d.ts +41 -1
- package/dist/protocol/peer.d.ts.map +1 -1
- package/dist/protocol/peer.js +42 -1
- package/dist/protocol/peer.js.map +1 -1
- package/dist/protocol/ws.d.ts +6 -0
- package/dist/protocol/ws.d.ts.map +1 -1
- package/dist/protocol/ws.js +2 -0
- package/dist/protocol/ws.js.map +1 -1
- package/dist/remote/peer-serve.d.ts.map +1 -1
- package/dist/remote/peer-serve.js +15 -3
- package/dist/remote/peer-serve.js.map +1 -1
- package/dist/remote/registry.d.ts +7 -0
- package/dist/remote/registry.d.ts.map +1 -1
- package/dist/remote/registry.js +15 -0
- package/dist/remote/registry.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +13 -7
- package/dist/server.js.map +1 -1
- package/dist/session/manager.d.ts +23 -3
- package/dist/session/manager.d.ts.map +1 -1
- package/dist/session/manager.js +57 -10
- package/dist/session/manager.js.map +1 -1
- package/dist/session/pty.d.ts +35 -2
- package/dist/session/pty.d.ts.map +1 -1
- package/dist/session/pty.js +110 -17
- package/dist/session/pty.js.map +1 -1
- package/dist/window/app-window.js +20 -0
- package/dist/window/app-window.js.map +1 -1
- package/package.json +1 -1
- package/web/assets/{index-BgOaaAFO.js → index-i7fXLKF0.js} +2 -2
- package/web/icon.png +0 -0
- package/web/icon.svg +22 -0
- package/web/index.html +3 -1
|
@@ -55,7 +55,7 @@ Error generating stack: `+e.message+`
|
|
|
55
55
|
|
|
56
56
|
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=ce,c=!$e.jitless,l=c&&le.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?Cr([],p,i,f,d,e):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Dr(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=>!Te(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=>Ae(e,r,et())))}),t)}var Or=z(`$ZodUnion`,(e,t)=>{On.init(e,t),R(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),R(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),R(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),R(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>M(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=>Dr(t,r,e,i)):Dr(o,r,e,i)}}),kr=z(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Or.init(e,t);let n=e._zod.parse;R(e,`propValues`,e=>{let t={};for(let n of e.def.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(n)}"`);for(let[e,n]of Object.entries(r)){Object.prototype.hasOwnProperty.call(t,e)||P(t,e,new Set);for(let r of n)t[e].add(r)}}return t}),t.options.forEach((e,n)=>{let r=wr.get(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=A(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!ce(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Ar=z(`$ZodIntersection`,(e,t)=>{On.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])=>Mr(e,t,n)):Mr(e,i,a)}});function jr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ue(e)&&ue(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=jr(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=jr(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 Mr(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=jr(t.value,n.value);if(!c.valid){if(Te(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Nr=z(`$ZodRecord`,(e,t)=>{On.init(e,t);let n=$e.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!ue(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Ae(e,i,et())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...De(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...De(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&rn.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>Ae(e,i,et())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...De(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...De(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Pr=z(`$ZodEnum`,(e,t)=>{On.init(e,t);let n=k(t.entries),r=new Set(n);e._zod.values=r;let i=n.filter(e=>fe.has(typeof e));e._zod.pattern=RegExp(i.length?`^(${i.map(e=>pe(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Fr=z(`$ZodLiteral`,(e,t)=>{On.init(e,t);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(t.values.length?`^(${t.values.map(e=>typeof e==`string`?pe(e):e?pe(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Ir=z(`$ZodTransform`,(e,t)=>{On.init(e,t),e._zod.optin=`optional`,$e.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Qe(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Ze;return n.value=i,n}});function Lr(e,t){return e.value=t.issues.length?void 0:t.value,e}var Rr=z(`$ZodOptional`,(e,t)=>{On.init(e,t),R(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,R(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),R(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${M(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Lr(e,t)):Lr(e,r)}return t.innerType._zod.run(e,n)}}),zr=z(`$ZodExactOptional`,(e,t)=>{Rr.init(e,t),R(e,`values`,e=>e.def.innerType._zod.values),R(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Br=z(`$ZodNullable`,(e,t)=>{On.init(e,t),R(e,`optin`,e=>e.def.innerType._zod.optin),R(e,`optout`,e=>e.def.innerType._zod.optout),R(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${M(t.source)}|null)$`):void 0}),R(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Vr=z(`$ZodDefault`,(e,t)=>{On.init(e,t),e._zod.optin=`defaulted`,R(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Hr(e,t)):Hr(r,t)}});function Hr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Ur=z(`$ZodPrefault`,(e,t)=>{On.init(e,t),e._zod.optin=`defaulted`,R(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Wr=z(`$ZodNonOptional`,(e,t)=>{On.init(e,t),R(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Gr(t,e)):Gr(i,e)}});function Gr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Kr(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Ae(e,r,et()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var qr=z(`$ZodCatch`,(e,t)=>{On.init(e,t),R(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),R(e,`optout`,e=>e.def.innerType._zod.optout),R(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Kr(e,r,t,n)):Kr(e,r,t,n)}}),Jr=z(`$ZodPipe`,(e,t)=>{On.init(e,t),R(e,`values`,e=>e.def.in._zod.values),R(e,`optin`,e=>e.def.in._zod.optin),R(e,`optout`,e=>e.def.out._zod.optout),R(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Yr(e,t.in,n)):Yr(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Yr(e,t.out,n)):Yr(r,t.out,n)}});function Yr(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Xr=z(`$ZodReadonly`,(e,t)=>{On.init(e,t),R(e,`propValues`,e=>e.def.innerType._zod.propValues),R(e,`values`,e=>e.def.innerType._zod.values),R(e,`optin`,e=>e.def.innerType?._zod?.optin),R(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Zr):Zr(r)}});function Zr(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Qr=z(`$ZodCustom`,(e,t)=>{cn.init(e,t),On.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=>$r(t,n,r,e));$r(i,n,r,e)}});function $r(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(Fe(e))}}var ei=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},ti=`~memo`,ni=[];function ri(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var ii=new WeakMap;function ai(e,t){let n=ii.get(e);if(n!==void 0)return n;if(t.has(e))return!0;t.add(e);let r=!1,i=e=>{!r&&e?._zod&&ai(e,t)&&(r=!0)},a=e._zod.def;switch(a.type){case`object`:for(let e of Reflect.ownKeys(a.shape))i(a.shape[e]);i(a.catchall);break;case`array`:i(a.element);break;case`tuple`:for(let e of a.items)i(e);i(a.rest);break;case`record`:case`map`:i(a.keyType),i(a.valueType);break;case`set`:i(a.valueType);break;case`union`:for(let e of a.options)i(e);break;case`intersection`:i(a.left),i(a.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:i(a.innerType);break;case`pipe`:i(a.in),i(a.out);break;case`function`:i(a.input),i(a.output);break;case`lazy`:i(e._zod.innerType);break;case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in a){let t=Object.getOwnPropertyDescriptor(a,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)i(n);else if(Array.isArray(n))for(let e of n)i(e)}}}return t.delete(e),ii.set(e,r),r}function oi(e,t){let n=e.buckets.get(t);return n||(n=new Map,e.buckets.set(t,n)),n}var si,ci=[],li={alloc(e,t,n){let r=si;if(!r)return n;si=void 0;let i={value:n,issues:null};return r.set(t.value,i),ci.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&di(n,e.value))throw new ei;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,a=(o,s)=>{if(n===void 0&&(n=ai(e,new Set),!n))return e._zod.parse=t,e._zod.run===a&&(e._zod.run=t),t(o,s);let c=o.value;if(typeof c!=`object`||!c)return t(o,s);let l=s[ti];l||(l={buckets:new Map,backEdges:void 0},s[ti]=l);let u;r===s?u=i:(u=oi(l,e),r=s,i=u);let d=u.get(c);if(d)return o.value=d.value,d.issues?d.issues.length&&o.issues.push(...ri(d.issues)):(o.memo=!0,l.backEdges??(l.backEdges=new Set),l.backEdges.add(d.value)),o;si=u;let f=ci.length,p=t(o,s);si=void 0;let m=ci.length>f?ci.pop():void 0;return p instanceof Promise?p.then(e=>(m&&(m.issues=e.issues.length?ri(e.issues):ni),e)):(m&&(m.issues=p.issues.length?ri(p.issues):ni),p)};e._zod.parse=a,e._zod.run===t&&(e._zod.run=a)})}};function ui(){return li}function di(e,t){let n=e[ti]?.backEdges;return n!==void 0&&typeof t==`object`&&!!t&&n.has(t)}var fi=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,credit_card:`credit card number`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Pe(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${he(e.values[0])}`:`Invalid option: expected one of ${ie(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${ie(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function pi(){return{localeError:fi()}}var mi,hi=class{constructor(){this._map=new WeakMap,this._idmap=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=new WeakMap,this._idmap=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 gi(){return new hi}(mi=globalThis).__zod_globalRegistry??(mi.__zod_globalRegistry=gi());var _i=globalThis.__zod_globalRegistry;function vi(e,t){return new e({type:`string`,...L(t)})}function yi(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...L(t)})}function bi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...L(t)})}function xi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...L(t)})}function Si(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...L(t)})}function Ci(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...L(t)})}function wi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...L(t)})}function Ti(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...L(t)})}function Ei(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...L(t)})}function Di(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...L(t)})}function Oi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...L(t)})}function ki(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...L(t)})}function Ai(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...L(t)})}function ji(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...L(t)})}function Mi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...L(t)})}function Ni(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...L(t)})}function B(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...L(t)})}function Pi(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...L(t)})}function Fi(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...L(t)})}function Ii(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...L(t)})}function Li(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...L(t)})}function Ri(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...L(t)})}function zi(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...L(t)})}function Bi(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...L(t)})}function Vi(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...L(t)})}function Hi(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...L(t)})}function Ui(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...L(t)})}function Wi(e,t){return new e({type:`number`,checks:[],...L(t)})}function Gi(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...L(t)})}function Ki(e,t){return new e({type:`boolean`,...L(t)})}function qi(e){return new e({type:`unknown`})}function Ji(e,t){return new e({type:`never`,...L(t)})}function Yi(e,t){return new dn({check:`less_than`,...L(t),value:e,inclusive:!1})}function Xi(e,t){return new dn({check:`less_than`,...L(t),value:e,inclusive:!0})}function Zi(e,t){return new fn({check:`greater_than`,...L(t),value:e,inclusive:!1})}function Qi(e,t){return new fn({check:`greater_than`,...L(t),value:e,inclusive:!0})}function $i(e,t){return new pn({check:`multiple_of`,...L(t),value:e})}function ea(e,t){return new hn({check:`max_length`,...L(t),maximum:e})}function ta(e,t){return new gn({check:`min_length`,...L(t),minimum:e})}function na(e,t){return new _n({check:`length_equals`,...L(t),length:e})}function ra(e,t){return new yn({check:`string_format`,format:`regex`,...L(t),pattern:e})}function ia(e){return new bn({check:`string_format`,format:`lowercase`,...L(e)})}function aa(e){return new xn({check:`string_format`,format:`uppercase`,...L(e)})}function oa(e,t){return new Sn({check:`string_format`,format:`includes`,...L(t),includes:e})}function sa(e,t){return new Cn({check:`string_format`,format:`starts_with`,...L(t),prefix:e})}function ca(e,t){return new wn({check:`string_format`,format:`ends_with`,...L(t),suffix:e})}function la(e){return new Tn({check:`overwrite`,tx:e})}function ua(e){return la(t=>t.normalize(e))}function da(){return la(e=>e.trim())}function fa(){return la(e=>e.toLowerCase())}function pa(){return la(e=>e.toUpperCase())}function ma(){return la(e=>I(e))}function ha(e,t,n){return new e({type:`array`,element:t,...L(n)})}function ga(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...L(n)})}function _a(e,t){let n=va(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Fe(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Fe(r))}},e(t.value,t)),t);return n}function va(e,t){let n=new cn({check:`custom`,...L(t)});return n._zod.check=e,n}function ya(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&P(e,t,n[t]);return e}function ba(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??_i,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function xa(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function Sa(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Sa(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&ya(o.schema,c),t.io===`input`&&Ma(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 Ca(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function wa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=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}/${Ca(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Ca(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>
|
|
57
57
|
|
|
58
|
-
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);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Ta(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Ta(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Ea=new Set([`type`,`properties`,`required`,`additionalProperties`]),Da=[`oneOf`,`anyOf`];function Oa(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function ka(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Ea.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Oa(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}P(n,r,e.length===1?e[0]:ka(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Oa(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Aa(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Ea)if(t in e)return;let n=t.filter(e=>Da.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=ka(t);else{let e=n[0],i=Da.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>ka([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,ya(e,r))}function ja(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)):ya(i,s),ya(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Ta(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Aa(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}ya(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,P(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Pa(t,`input`,e.processors),output:Pa(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Ma(e,t){let n=t??{seen: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 Ma(r.element,n);if(r.type===`set`)return Ma(r.valueType,n);if(r.type===`lazy`)return Ma(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return Ma(r.innerType,n);if(r.type===`intersection`)return Ma(r.left,n)||Ma(r.right,n);if(r.type===`record`||r.type===`map`)return Ma(r.keyType,n)||Ma(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Ma(r.in,n)||Ma(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Ma(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Ma(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Ma(e,n))return!0;return!!(r.rest&&Ma(r.rest,n))}return!1}var Na=(e,t={})=>n=>{let r=ba({...n,processors:t});return Sa(e,r),wa(r,e),ja(r,e)},Pa=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ba({...i??{},target:a,io:t,processors:n});return Sa(e,o),wa(o,e),ja(o,e)},Fa={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Ia=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Fa[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&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}))])}},La=(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`&&(Number.isFinite(c)&&c!==0?i.multipleOf=Math.abs(c):xa(e,t,i,r,`A multipleOf divisor of ${c} cannot be represented in JSON Schema`))},Ra=(e,t,n,r)=>{n.type=`boolean`},za=(e,t,n,r)=>{n.not={}},Ba=(e,t,n,r)=>{let i=e._zod.def,a=k(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Va=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(xa(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(xa(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Ha=(e,t,n,r)=>{xa(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Ua=(e,t,n,r)=>{xa(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Wa=(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=Sa(a.element,t,{...r,path:[...r.path,`items`]})};function Ga(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Ga(t.out):t.type===`catch`?Ga(t.innerType):e._zod.optin}var Ka=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&xa(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)P(i.properties,e,Sa(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];return t.io===`input`?Ga(n)===void 0:n._zod.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=Sa(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},qa=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Sa(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ja=(e,t,n,r)=>{let i=e._zod.def,a=Sa(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Sa(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function Ya(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Ya(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Ya(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?rn:nn).source),p):p}var Xa=new WeakMap;function Za(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Xa.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Ya(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Qa=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Sa(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)P(i.patternProperties,t.source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=Sa(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Xa.get(t);n||(n=[],Xa.set(t,n),t.deferred.push(()=>Za(t))),n.push(e)}i.additionalProperties=Sa(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Ga(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},$a=(e,t,n,r)=>{let i=e._zod.def,a=Sa(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`}]},eo=(e,t,n,r)=>{let i=e._zod.def;Sa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},to=Symbol();function no(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(xa(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),to):JSON.parse(o)}var ro=(e,t,n,r)=>{let i=e._zod.def;Sa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=no(i.defaultValue,e,t,n,r);o!==to&&(n.default=o)},io=(e,t,n,r)=>{let i=e._zod.def;Sa(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=no(i.defaultValue,e,t,n,r);o!==to&&(n._prefault=o)},ao=(e,t,n,r)=>{let i=e._zod.def;Sa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{xa(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},oo=(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;Sa(o,t,r);let s=t.seen.get(e);s.ref=o},so=(e,t,n,r)=>{let i=e._zod.def;Sa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},co=(e,t,n,r)=>{let i=e._zod.def;Sa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},lo=new WeakSet([Object.prototype,Error.prototype]);function uo(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var fo=z(`ZodError`,(e,t)=>{ct.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);lo.has(n)||(lo.add(n),uo(n,`format`,e=>t=>ft(e,t)),uo(n,`flatten`,e=>t=>dt(e,t)),uo(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ae,2)}),uo(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ae,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),V=mt(fo),H=ht(fo),po=gt(fo),mo=vt(fo),ho=bt(fo),go=xt(fo),_o=St(fo),vo=Ct(fo),yo=wt(fo),bo=Tt(fo),xo=Et(fo),So=Dt(fo);function Co(){$e.localeError||et(pi())}function wo(){$e.memoizer||et({memoizer:ui()})}var To=z(`ZodType`,(e,t)=>(Co(),On.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(oe(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 me(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Hs(e,t))},superRefine(e,t){return this.check(Us(e,t))},overwrite(e){return this.check(la(e))},optional(){return ws(this)},exactOptional(){return Es(this)},nullable(){return Os(this)},nullish(){return ws(Os(this))},nonoptional(e){return Ps(this,e)},array(){return cs(this)},or(e){return ds([this,e])},and(e){return hs(this,e)},transform(e){return Rs(this,Ss(e))},default(e){return As(this,e)},prefault(e){return Ms(this,e)},catch(e){return Is(this,e)},pipe(e){return Rs(this,e)},readonly(){return Bs(this)},describe(e){let t=this.clone();return _i.add(t,{description:e}),t},meta(...e){if(e.length===0)return _i.get(this);let t=this.clone();return _i.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Re(this,`~standard`,{...An(this),jsonSchema:{input:Pa(this,`input`),output:Pa(this,`output`)}})},set"~standard"(e){Le(this,`~standard`,e)},parse:function e(t,n){return V(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await H(this,t,n,{callee:e})},safeParse(e,t){return po(this,e,t)},async safeParseAsync(e,t){return mo(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Le(this,`spa`,e)},encode:function e(t,n){return ho(this,t,n,{callee:e})},decode:function e(t,n){return go(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await _o(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await vo(this,t,n,{callee:e})},safeEncode(e,t){return yo(this,e,t)},safeDecode(e,t){return bo(this,e,t)},async safeEncodeAsync(e,t){return xo(this,e,t)},async safeDecodeAsync(e,t){return So(this,e,t)},toJSONSchema(e){return Na(this,{})(e)},get description(){return _i.get(this)?.description},get _def(){return this._zod.def}}),Eo=z(`_ZodString`,(e,t)=>{jn.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ia(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null},{regex(...e){return this.check(ra(...e))},includes(...e){return this.check(oa(...e))},startsWith(...e){return this.check(sa(...e))},endsWith(...e){return this.check(ca(...e))},min(...e){return this.check(ta(...e))},max(...e){return this.check(ea(...e))},length(...e){return this.check(na(...e))},nonempty(...e){return this.check(ta(1,...e))},lowercase(e){return this.check(ia(e))},uppercase(e){return this.check(aa(e))},trim(){return this.check(da())},normalize(...e){return this.check(ua(...e))},toLowerCase(){return this.check(fa())},toUpperCase(){return this.check(pa())},slugify(){return this.check(ma())}}),Do=z(`ZodString`,(e,t)=>{jn.init(e,t),Eo.init(e,t)},{email(e){return this.check(yi(No,e))},url(e){return this.check(Ti(Io,e))},jwt(e){return this.check(zi(Zo,e))},emoji(e){return this.check(Ei(Lo,e))},guid(e){return this.check(bi(Po,e))},uuid(e){return this.check(xi(Fo,e))},uuidv4(e){return this.check(Si(Fo,e))},uuidv6(e){return this.check(Ci(Fo,e))},uuidv7(e){return this.check(wi(Fo,e))},nanoid(e){return this.check(Di(Ro,e))},cuid(e){return this.check(Oi(zo,e))},cuid2(e){return this.check(ki(Bo,e))},ulid(e){return this.check(Ai(Vo,e))},base64(e){return this.check(Ii(Jo,e))},base64url(e){return this.check(Li(Yo,e))},xid(e){return this.check(ji(Ho,e))},ksuid(e){return this.check(Mi(Uo,e))},ipv4(e){return this.check(Ni(Wo,e))},ipv6(e){return this.check(B(Go,e))},cidrv4(e){return this.check(Pi(Ko,e))},cidrv6(e){return this.check(Fi(qo,e))},e164(e){return this.check(Ri(Xo,e))},datetime(e){return this.check(Bi(ko,e))},date(e){return this.check(Vi(Ao,e))},time(e){return this.check(Hi(jo,e))},duration(e){return this.check(Ui(Mo,e))}});function U(e){return vi(Do,e)}var Oo=z(`ZodStringFormat`,(e,t)=>{Mn.init(e,t),Eo.init(e,t)}),ko=z(`ZodISODateTime`,(e,t)=>{Yn.init(e,t),Oo.init(e,t)}),Ao=z(`ZodISODate`,(e,t)=>{Xn.init(e,t),Oo.init(e,t)}),jo=z(`ZodISOTime`,(e,t)=>{Zn.init(e,t),Oo.init(e,t)}),Mo=z(`ZodISODuration`,(e,t)=>{Qn.init(e,t),Oo.init(e,t)}),No=z(`ZodEmail`,(e,t)=>{Fn.init(e,t),Oo.init(e,t)}),Po=z(`ZodGUID`,(e,t)=>{Nn.init(e,t),Oo.init(e,t)}),Fo=z(`ZodUUID`,(e,t)=>{Pn.init(e,t),Oo.init(e,t)}),Io=z(`ZodURL`,(e,t)=>{Vn.init(e,t),Oo.init(e,t)}),Lo=z(`ZodEmoji`,(e,t)=>{Hn.init(e,t),Oo.init(e,t)}),Ro=z(`ZodNanoID`,(e,t)=>{Un.init(e,t),Oo.init(e,t)}),zo=z(`ZodCUID`,(e,t)=>{Wn.init(e,t),Oo.init(e,t)}),Bo=z(`ZodCUID2`,(e,t)=>{Gn.init(e,t),Oo.init(e,t)}),Vo=z(`ZodULID`,(e,t)=>{Kn.init(e,t),Oo.init(e,t)}),Ho=z(`ZodXID`,(e,t)=>{qn.init(e,t),Oo.init(e,t)}),Uo=z(`ZodKSUID`,(e,t)=>{Jn.init(e,t),Oo.init(e,t)}),Wo=z(`ZodIPv4`,(e,t)=>{$n.init(e,t),Oo.init(e,t)}),Go=z(`ZodIPv6`,(e,t)=>{nr.init(e,t),Oo.init(e,t)}),Ko=z(`ZodCIDRv4`,(e,t)=>{rr.init(e,t),Oo.init(e,t)}),qo=z(`ZodCIDRv6`,(e,t)=>{ar.init(e,t),Oo.init(e,t)}),Jo=z(`ZodBase64`,(e,t)=>{sr.init(e,t),Oo.init(e,t)}),Yo=z(`ZodBase64URL`,(e,t)=>{lr.init(e,t),Oo.init(e,t)}),Xo=z(`ZodE164`,(e,t)=>{ur.init(e,t),Oo.init(e,t)}),Zo=z(`ZodJWT`,(e,t)=>{fr.init(e,t),Oo.init(e,t)}),Qo=z(`ZodNumber`,(e,t)=>{pr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>La(e,t,n,r);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},{gt(e,t){return this.check(Zi(e,t))},gte(e,t){return this.check(Qi(e,t))},min(e,t){return this.check(Qi(e,t))},lt(e,t){return this.check(Yi(e,t))},lte(e,t){return this.check(Xi(e,t))},max(e,t){return this.check(Xi(e,t))},int(e){return this.check(es(e))},safe(e){return this.check(es(e))},positive(e){return this.check(Zi(0,e))},nonnegative(e){return this.check(Qi(0,e))},negative(e){return this.check(Yi(0,e))},nonpositive(e){return this.check(Xi(0,e))},multipleOf(e,t){return this.check($i(e,t))},step(e,t){return this.check($i(e,t))},finite(){return this}});function W(e){return Wi(Qo,e)}var $o=z(`ZodNumberFormat`,(e,t)=>{mr.init(e,t),Qo.init(e,t)});function es(e){return Gi($o,e)}var ts=z(`ZodBoolean`,(e,t)=>{hr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ra(e,t,n,r)});function ns(e){return Ki(ts,e)}var rs=z(`ZodUnknown`,(e,t)=>{gr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function is(){return qi(rs)}var as=z(`ZodNever`,(e,t)=>{_r.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>za(e,t,n,r)});function os(e){return Ji(as,e)}var ss=z(`ZodArray`,(e,t)=>{wo(),yr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wa(e,t,n,r),e.element=t.element},{min(e,t){return this.check(ta(e,t))},nonempty(e){return this.check(ta(1,e))},max(e,t){return this.check(ea(e,t))},length(e,t){return this.check(na(e,t))},unwrap(){return this.element}});function cs(e,t){return ha(ss,e,t)}var ls=z(`ZodObject`,(e,t)=>{wo(),Er.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ka(e,t,n,r),We(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return ys(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:is()})},loose(){return this.clone({...this._zod.def,catchall:is()})},strict(){return this.clone({...this._zod.def,catchall:os()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return be(this,e)},safeExtend(e){return xe(this,e)},merge(e){return Se(this,e)},pick(e){return ve(this,e)},omit(e){return ye(this,e)},partial(...e){return Ce(Cs,this,e[0])},exactPartial(...e){return Ce(Ts,this,e[0],`exactPartial`)},required(...e){return we(Ns,this,e[0])}});function G(e,t){return new ls({type:`object`,shape:e??{},...L(t)})}var us=z(`ZodUnion`,(e,t)=>{Or.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qa(e,t,n,r),e.options=t.options});function ds(e,t){return new us({type:`union`,options:e,...L(t)})}var fs=z(`ZodDiscriminatedUnion`,(e,t)=>{us.init(e,t),kr.init(e,t)});function ps(e,t,n){return new fs({type:`union`,options:t,discriminator:e,...L(n)})}var ms=z(`ZodIntersection`,(e,t)=>{Ar.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ja(e,t,n,r)});function hs(e,t){return new ms({type:`intersection`,left:e,right:t})}var gs=z(`ZodRecord`,(e,t)=>{wo(),Nr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qa(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function _s(e,t,n){return!t||!t._zod?new gs({type:`record`,keyType:U(),valueType:e,...L(t)}):new gs({type:`record`,keyType:e,valueType:t,...L(n)})}var vs=z(`ZodEnum`,(e,t)=>{Pr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ba(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 vs({...t,checks:[],...L(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 vs({...t,checks:[],...L(r),entries:i})}});function ys(e,t){return new vs({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...L(t)})}var bs=z(`ZodLiteral`,(e,t)=>{Fr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Va(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function K(e,t){return new bs({type:`literal`,values:Array.isArray(e)?e:[e],...L(t)})}var xs=z(`ZodTransform`,(e,t)=>{wo(),Ir.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ua(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Qe(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Fe(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Fe(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Ss(e){return new xs({type:`transform`,transform:e})}var Cs=z(`ZodOptional`,(e,t)=>{Rr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ws(e){return new Cs({type:`optional`,innerType:e})}var Ts=z(`ZodExactOptional`,(e,t)=>{zr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Es(e){return new Ts({type:`optional`,innerType:e})}var Ds=z(`ZodNullable`,(e,t)=>{Br.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$a(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Os(e){return new Ds({type:`nullable`,innerType:e})}var ks=z(`ZodDefault`,(e,t)=>{Vr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ro(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function As(e,t){return new ks({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():de(t)}})}var js=z(`ZodPrefault`,(e,t)=>{Ur.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ms(e,t){return new js({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():de(t)}})}var Ns=z(`ZodNonOptional`,(e,t)=>{Wr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ps(e,t){return new Ns({type:`nonoptional`,innerType:e,...L(t)})}var Fs=z(`ZodCatch`,(e,t)=>{qr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ao(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Is(e,t){return new Fs({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Ke(t)})}var Ls=z(`ZodPipe`,(e,t)=>{Jr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oo(e,t,n,r),e.in=t.in,e.out=t.out});function Rs(e,t){return new Ls({type:`pipe`,in:e,out:t})}var zs=z(`ZodReadonly`,(e,t)=>{Xr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bs(e){return new zs({type:`readonly`,innerType:e})}var Vs=z(`ZodCustom`,(e,t)=>{Qr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ha(e,t,n,r)});function Hs(e,t={}){return ga(Vs,e,t)}function Us(e,t){return _a(e,t)}var Ws=ys([`starting`,`running`,`stopped`,`exited`,`failed`]),Gs=ys([`idle`,`busy`,`unknown`]),Ks=ys([`local`,`remote`]),qs=ys([`ssh`,`enrolled`]),Js=G({id:U(),label:U(),kind:qs.default(`ssh`),sshHost:U().nullable(),sshUser:U().nullable(),sshPort:W().int().positive().default(22),platform:U().nullable(),hubVersion:U().nullable(),state:ys([`disconnected`,`connecting`,`connected`,`error`]),lastSeenAt:W().nullable(),error:U().nullable()}),Ys=G({id:U(),name:U(),kind:Ks,rootPath:U(),hostId:U().nullable(),color:U(),createdAt:W(),archivedAt:W().nullable()}),Xs=G({x:W(),y:W(),w:W(),h:W(),z:W(),collapsed:ns()}),Zs=G({panX:W(),panY:W(),zoom:W()}),Qs=ys([`yellow`,`pink`,`green`,`blue`]),$s=G({id:U(),x:W(),y:W(),w:W(),h:W(),z:W(),text:U().max(2e4),color:Qs,updatedAt:W()}),ec=G({id:U(),workspaceId:U(),name:U(),address:U(),profile:U(),template:U().nullable(),model:U().nullable(),effort:U().nullable(),cwd:U(),agentSessionUuid:U().nullable(),spawnedBy:U().nullable(),state:Ws,status:Gs,statusText:U().nullable(),title:U().nullable(),pid:W().nullable(),exitCode:W().nullable(),cols:W(),rows:W(),resumable:ns(),createdAt:W(),exitedAt:W().nullable(),lastActiveAt:W(),window:Xs}),tc=ys([`delivered`,`failed`]),nc=G({id:U(),fromAddr:U(),toAddr:U(),body:U(),sentAt:W(),deliveredAt:W().nullable(),deliveryState:tc,error:U().nullable()}),rc=ys([`listed`,`declared`,`none`]),ic=ys([`derived`,`stored`,`file`]),ac=G({id:U(),description:U(),agent:U(),model:U().nullable(),effort:U().nullable(),prompt:U().nullable(),env:_s(U(),U()),error:U().nullable(),source:ic}),oc=G({id:U(),fromAddr:U(),proposedAt:W(),template:G({id:U(),agent:U(),description:U().nullable(),model:U().nullable(),effort:U().nullable(),prompt:U().nullable()})}),sc=G({id:U(),description:U(),mcp:ns(),resumable:ns(),command:U(),commandPath:U().nullable(),available:ns().nullable(),version:U().nullable(),detail:U().nullable(),models:cs(U()),modelSource:rc,takesModel:ns(),takesEffort:ns(),efforts:cs(U())}),cc=G({name:U(),rootPath:U().nullable(),agents:W().int()});G({id:U(),label:U(),kind:ys([`canvas`,`ssh`,`enrolled`]),state:ys([`disconnected`,`connecting`,`connected`,`error`]),you:ns(),platform:U().nullable(),error:U().nullable(),workspaces:cs(cc),agents:cs(G({id:U(),available:ns().nullable(),version:U().nullable(),detail:U().nullable()}))});var lc={PtyOutput:1,PtyInput:2,PtyInputRaw:3};function uc(e,t,n){let r=new TextEncoder().encode(t);if(r.length>255)throw Error(`session id too long for binary frame`);let i=new Uint8Array(2+r.length+n.length);return i[0]=e,i[1]=r.length,i.set(r,2),i.set(n,2+r.length),i}function dc(e){if(e.length<2)throw Error(`binary frame too short`);let t=e[0],n=e[1];if(e.length<2+n)throw Error(`binary frame truncated`);return{kind:t,sessionId:new TextDecoder().decode(e.subarray(2,2+n)),payload:e.subarray(2+n)}}var fc=U().optional();ps(`t`,[G({t:K(`hello`),token:U()}),G({t:K(`attach`),sessionId:U()}),G({t:K(`detach`),sessionId:U()}),G({t:K(`resize`),sessionId:U(),cols:W().int().positive(),rows:W().int().positive()}),G({t:K(`checkFolder`),requestId:fc,hostId:U().nullable().optional(),path:U().min(1)}),G({t:K(`createWorkspace`),requestId:fc,name:U().min(1),rootPath:U().min(1),hostId:U().nullable().optional()}),G({t:K(`updateWorkspace`),requestId:fc,workspaceId:U(),name:U().min(1).optional(),rootPath:U().min(1).optional()}),G({t:K(`removeWorkspace`),requestId:fc,workspaceId:U()}),G({t:K(`saveTemplate`),requestId:fc,id:U().min(1),agent:U().min(1),description:U().nullable().optional(),model:U().nullable().optional(),effort:U().nullable().optional(),prompt:U().nullable().optional(),env:_s(U(),U()).optional()}),G({t:K(`removeTemplate`),requestId:fc,id:U()}),G({t:K(`resolveTemplateProposal`),requestId:fc,proposalId:U(),accept:ns(),id:U().min(1).optional(),agent:U().min(1).optional(),description:U().nullable().optional(),model:U().nullable().optional(),effort:U().nullable().optional(),prompt:U().nullable().optional(),env:_s(U(),U()).optional()}),G({t:K(`startSession`),requestId:fc,workspaceId:U(),profile:U(),model:U().optional(),effort:U().optional(),prompt:U().optional(),name:U().optional(),cwd:U().optional()}),G({t:K(`stopSession`),sessionId:U()}),G({t:K(`removeSession`),requestId:fc,sessionId:U()}),G({t:K(`resumeSession`),sessionId:U()}),G({t:K(`resumeWorkspace`),workspaceId:U()}),G({t:K(`shareSession`),requestId:fc,sessionId:U()}),G({t:K(`unshareSession`),requestId:fc,sessionId:U()}),G({t:K(`moveWindow`),sessionId:U(),rect:Xs}),G({t:K(`setViewport`),viewport:Zs}),G({t:K(`putNote`),note:$s}),G({t:K(`removeNote`),noteId:U()}),G({t:K(`addHost`),requestId:fc,label:U(),sshHost:U(),sshUser:U(),sshPort:W().int().positive().default(22),privateKeyPath:U().optional()}),G({t:K(`updateHost`),requestId:fc,hostId:U(),label:U().optional(),sshHost:U().optional(),sshUser:U().optional(),sshPort:W().int().positive().optional(),privateKeyPath:U().optional()}),G({t:K(`removeHost`),requestId:fc,hostId:U()}),G({t:K(`connectHost`),hostId:U()}),G({t:K(`refreshAgents`)})]);var pc=G({sessionId:U(),token:U()}),mc=G({hubVersion:U(),enrollUrl:U().nullable(),enrollAltUrl:U().nullable(),lanOrigin:U().nullable(),lanAltOrigin:U().nullable(),hosts:cs(Js),workspaces:cs(Ys),sessions:cs(ec),messages:cs(nc),viewport:Zs,profiles:cs(sc),templates:cs(ac),templateProposals:cs(oc),hostProfiles:_s(U(),cs(sc)),shares:cs(pc),notes:cs($s)}),hc=ps(`t`,[G({t:K(`ready`),state:mc}),G({t:K(`sessionUpserted`),session:ec}),G({t:K(`sessionRemoved`),sessionId:U()}),G({t:K(`workspaceUpserted`),workspace:Ys}),G({t:K(`templatesChanged`),templates:cs(ac)}),G({t:K(`templateProposed`),proposal:oc}),G({t:K(`templateProposalResolved`),proposalId:U()}),G({t:K(`workspaceRemoved`),workspaceId:U()}),G({t:K(`hostUpserted`),host:Js}),G({t:K(`hostRemoved`),hostId:U()}),G({t:K(`sharesChanged`),shares:cs(pc)}),G({t:K(`noteUpserted`),note:$s}),G({t:K(`noteRemoved`),noteId:U()}),G({t:K(`hostLog`),hostId:U(),line:U()}),G({t:K(`agentsDetected`),hostId:U().nullable(),profiles:cs(sc)}),G({t:K(`messageSent`),message:nc}),G({t:K(`snapshot`),sessionId:U(),serialized:U(),cols:W(),rows:W()}),G({t:K(`error`),message:U(),sessionId:U().optional()}),G({t:K(`ack`),requestId:U(),ok:ns(),message:U().optional(),sessionId:U().optional()})]);G({}),G({workspace:U().optional().describe(`Limit to one workspace. Defaults to all workspaces on all hosts.`)}),G({id:U().optional().describe(`Just this one template, in full. Omit to list them all.`)}),G({to:U().describe(`Target agent address, "workspace/name". Use list_agents to discover.`),text:U().min(1).max(8e3).describe(`Message body, injected into the target terminal. If you need an answer, ask for one here — say to reply with send_message — then end your turn and let it arrive.`)}),G({profile:U().optional().describe(`Agent profile id. Defaults to your own profile.`),name:U().optional().describe(`Name for the new agent. Auto-generated if omitted.`),host:U().optional().describe(`Machine to start it on, by the label list_hosts gives. The machine that owns the canvas is called "canvas"; "local" always means your own. Defaults to your own machine.`),workspace:U().optional().describe(`Workspace to spawn into. Defaults to your own workspace if it exists on the target machine, else the only workspace there.`),prompt:U().optional().describe(`First instruction, injected once the new agent is ready.`)}),G({}),G({address:U().describe(`Agent address to inspect.`),lines:W().int().positive().max(200).optional().describe(`Trailing lines to return (default 40).`)}),G({text:U().max(120).describe(`Short status shown under your window title on the canvas.`)}),G({address:U().describe(`Agent to stop. You may only stop agents you spawned.`)}),G({id:U().min(1).max(60).describe(`Name for the template, as it will appear in the picker, e.g. "reviewer".`),agent:U().min(1).describe(`Agent profile id it launches, e.g. "claude". Use list_agents to see what exists.`),description:U().max(200).optional().describe(`One line shown beside the name in the picker.`),model:U().optional().describe(`Model to launch on. Refused if that agent takes no model on the command line.`),effort:U().optional().describe(`Reasoning effort. Refused if that agent has no effort setting.`),prompt:U().max(4e3).optional().describe(`First instruction, typed in once the agent is up.`)});function gc(e){let t=e.indexOf(`/`);if(t<=0||t===e.length-1)return null;let n=e.slice(0,t),r=e.slice(t+1);return r.includes(`/`)?null:{workspace:n,name:r}}var _c=G({address:U(),workspace:U().nullable(),profile:U(),state:Ws,status:Gs,statusText:U().nullable(),host:U()}),vc=ps(`t`,[G({t:K(`deliver`),from:U(),to:U(),body:U()}),G({t:K(`readScreen`),address:U(),lines:W().int().positive().optional()}),G({t:K(`listHosts`)}),G({t:K(`listTemplates`)}),G({t:K(`pickTemplate`),profile:U().optional(),parentTemplate:U().nullable(),parentProfile:U()}),G({t:K(`spawn`),from:U(),host:U(),workspace:U().optional(),name:U().optional(),agent:U(),template:U().nullable().optional(),model:U().optional(),effort:U().optional(),env:_s(U(),U()).optional(),opening:U().optional(),restore:U().nullable().optional(),promptGiven:ns()})]);ps(`t`,[G({t:K(`hello`),token:U(),hubVersion:U(),schemaVersion:W().int(),enroll:G({label:U(),platform:U(),arch:U(),homeDir:U(),machineId:U().optional()}).optional()}),G({t:K(`listSessions`),id:U()}),G({t:K(`listAgents`),id:U()}),G({t:K(`startSession`),id:U(),workspaceName:U(),rootPath:U(),profile:U(),template:U().nullable().optional(),model:U().optional(),effort:U().optional(),prompt:U().optional(),restorePrompt:U().nullable().optional(),env:_s(U(),U()).optional(),name:U().optional(),spawnedByAddress:U().nullable(),sessionId:U().optional()}),G({t:K(`stopSession`),id:U(),address:U()}),G({t:K(`removeSession`),id:U(),address:U()}),G({t:K(`shutdown`),id:U()}),G({t:K(`resumeSession`),id:U(),address:U()}),G({t:K(`directory`),id:U(),agents:cs(_c),youAre:U().optional()}),G({t:K(`relayResult`),id:U(),relayId:U(),ok:ns(),result:is(),error:U().nullable()}),G({t:K(`deliver`),id:U(),from:U(),to:U(),body:U()}),G({t:K(`readScreen`),id:U(),address:U(),lines:W().int().positive().optional()}),G({t:K(`attach`),id:U(),address:U()}),G({t:K(`detach`),id:U(),address:U()}),G({t:K(`input`),id:U(),address:U(),data:U(),encoding:ys([`utf8`,`binary`]).optional()}),G({t:K(`resize`),id:U(),address:U(),cols:W().int().positive(),rows:W().int().positive()}),G({t:K(`checkFolder`),id:U(),path:U()})]),ps(`t`,[G({t:K(`welcome`),hubVersion:U(),schemaVersion:W().int(),hostToken:U().optional()}),G({t:K(`ok`),id:U(),result:is()}),G({t:K(`err`),id:U(),message:U(),code:ys([`unknown-token`,`schema-mismatch`,`bad-hello`]).optional()}),G({t:K(`sessions`),sessions:cs(ec)}),G({t:K(`agents`),agents:cs(sc)}),G({t:K(`sessionUpserted`),session:ec}),G({t:K(`sessionRemoved`),address:U()}),G({t:K(`output`),address:U(),data:U()}),G({t:K(`relay`),relayId:U(),ask:vc})]);function yc(e,t=32){let n=Array.from(e.subarray(0,t)).map(e=>e.toString(16).padStart(2,`0`)).join(` `);return e.length>t?`${n} … (${e.length}B)`:n}function bc(e){let t=``;for(let n of e)t+=n===27?`\\e`:n===13?`\\r`:n===10?`\\n`:n===9?`\\t`:n<32||n===127?`\\x${n.toString(16).padStart(2,`0`)}`:n<127?String.fromCharCode(n):`\\x${n.toString(16).padStart(2,`0`)}`;return t}function xc(e){let t=!!(e&32),n=!!(e&64),r=e&3,i=[e&4?`shift`:``,e&8?`meta`:``,e&16?`ctrl`:``].filter(Boolean),a;return a=n?r===0?`wheel-up`:r===1?`wheel-down`:`wheel-${r}`:r===3?`release`:[`left`,`middle`,`right`][r],t&&!n&&(a+=`-motion`),i.length?`${a}+${i.join(`+`)}`:a}function Sc(e){if(e.length<6||e[0]!==27||e[1]!==91||e[2]!==77)return null;let t=e[3]-32,n=e[4]-32,r=e[5]-32,i=e.length>6?` +${e.length-6}B`:``;return`X10 ${xc(t)} col=${n} row=${r}${i}`}function Cc(e){let t=bc(e),n=/^\\e\[<(\d+);(\d+);(\d+)([Mm])/.exec(t);if(!n)return null;let r=n[4]===`M`?`press`:`release`;return`SGR ${xc(Number(n[1]))} col=${n[2]} row=${n[3]} ${r}`}function wc(e){let t=Sc(e)??Cc(e);return t?`${t} [${yc(e)}]`:`"${bc(e)}" [${yc(e)}]`}function Tc(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return wc(t)}var Ec={9:`x10-mouse`,1e3:`vt200-mouse`,1002:`drag-mouse`,1003:`any-motion-mouse`,1004:`focus-events`,1005:`utf8-mouse-encoding`,1006:`sgr-mouse-encoding`,1015:`urxvt-mouse-encoding`,1016:`sgr-pixel-encoding`,1047:`alt-screen`,1049:`alt-screen+cursor`,47:`alt-screen-legacy`};function Dc(e){let t=[];for(let n of e.matchAll(/\x1b\[\?([\d;]+)([hl])/g))for(let e of n[1].split(`;`)){let r=Ec[e];r&&t.push({mode:e,name:r,set:n[2]===`h`})}return t}function Oc(e){let t=Dc(e);return t.length===0?null:t.map(e=>`${e.set?`+`:`-`}${e.name}(?${e.mode})`).join(` `)}function kc(e){let t=Dc(e);return t.length===0?`no mouse/screen modes`:t.map(e=>`${e.set?`+`:`-`}${e.name}`).join(` `)}function Ac(e,t){return t.filter(t=>t.workspaceId===e.id||e.hostId!==null&&gc(t.address)?.workspace===e.name)}function jc(e){let t=[e.kind===`enrolled`?e.platform??`joined`:e.sshUser&&e.sshHost?`${e.sshUser}@${e.sshHost}:${e.sshPort}`:null,e.hubVersion?`hub ${e.hubVersion}`:null].filter(Boolean);return t.length>0?t.join(` · `):null}function Mc(e,t,n){let r=e=>t.filter(t=>(t.hostId??null)===e).map(e=>({workspace:e,sessions:Ac(e,n)}));return[{id:``,label:`this machine`,sub:null,state:`connected`,host:null,workspaces:r(null)},...e.map(e=>({id:e.id,label:e.label,sub:jc(e),state:e.state,host:e,workspaces:r(e.id)}))]}var Nc=o(((e,t)=>{(function(n,r){if(typeof e==`object`&&typeof t==`object`)t.exports=r();else if(typeof define==`function`&&define.amd)define([],r);else{var i=r();for(var a in i)(typeof e==`object`?e:n)[a]=i[a]}})(globalThis,(()=>(()=>{var e={4567:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;let a=n(9042),o=n(9924),s=n(844),c=n(4725),l=n(2585),u=n(3656),d=t.AccessibilityManager=class extends s.Disposable{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``,this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new o.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this.register(this._terminal.onResize((e=>this._handleResize(e.rows)))),this.register(this._terminal.onRender((e=>this._refreshRows(e.start,e.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((e=>this._handleChar(e)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
58
|
+
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);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Ta(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Ta(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Ea=new Set([`type`,`properties`,`required`,`additionalProperties`]),Da=[`oneOf`,`anyOf`];function Oa(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function ka(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Ea.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Oa(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}P(n,r,e.length===1?e[0]:ka(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Oa(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Aa(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Ea)if(t in e)return;let n=t.filter(e=>Da.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=ka(t);else{let e=n[0],i=Da.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>ka([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,ya(e,r))}function ja(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)):ya(i,s),ya(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Ta(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Aa(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}ya(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,P(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Pa(t,`input`,e.processors),output:Pa(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Ma(e,t){let n=t??{seen: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 Ma(r.element,n);if(r.type===`set`)return Ma(r.valueType,n);if(r.type===`lazy`)return Ma(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return Ma(r.innerType,n);if(r.type===`intersection`)return Ma(r.left,n)||Ma(r.right,n);if(r.type===`record`||r.type===`map`)return Ma(r.keyType,n)||Ma(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Ma(r.in,n)||Ma(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Ma(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Ma(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Ma(e,n))return!0;return!!(r.rest&&Ma(r.rest,n))}return!1}var Na=(e,t={})=>n=>{let r=ba({...n,processors:t});return Sa(e,r),wa(r,e),ja(r,e)},Pa=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ba({...i??{},target:a,io:t,processors:n});return Sa(e,o),wa(o,e),ja(o,e)},Fa={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Ia=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Fa[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&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}))])}},La=(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`&&(Number.isFinite(c)&&c!==0?i.multipleOf=Math.abs(c):xa(e,t,i,r,`A multipleOf divisor of ${c} cannot be represented in JSON Schema`))},Ra=(e,t,n,r)=>{n.type=`boolean`},za=(e,t,n,r)=>{n.not={}},Ba=(e,t,n,r)=>{let i=e._zod.def,a=k(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Va=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(xa(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(xa(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Ha=(e,t,n,r)=>{xa(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Ua=(e,t,n,r)=>{xa(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Wa=(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=Sa(a.element,t,{...r,path:[...r.path,`items`]})};function Ga(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Ga(t.out):t.type===`catch`?Ga(t.innerType):e._zod.optin}var Ka=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&xa(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)P(i.properties,e,Sa(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];return t.io===`input`?Ga(n)===void 0:n._zod.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=Sa(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},qa=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Sa(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ja=(e,t,n,r)=>{let i=e._zod.def,a=Sa(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Sa(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function Ya(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Ya(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Ya(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?rn:nn).source),p):p}var Xa=new WeakMap;function Za(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Xa.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Ya(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Qa=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Sa(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)P(i.patternProperties,t.source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=Sa(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Xa.get(t);n||(n=[],Xa.set(t,n),t.deferred.push(()=>Za(t))),n.push(e)}i.additionalProperties=Sa(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Ga(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},$a=(e,t,n,r)=>{let i=e._zod.def,a=Sa(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`}]},eo=(e,t,n,r)=>{let i=e._zod.def;Sa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},to=Symbol();function no(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(xa(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),to):JSON.parse(o)}var ro=(e,t,n,r)=>{let i=e._zod.def;Sa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=no(i.defaultValue,e,t,n,r);o!==to&&(n.default=o)},io=(e,t,n,r)=>{let i=e._zod.def;Sa(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=no(i.defaultValue,e,t,n,r);o!==to&&(n._prefault=o)},ao=(e,t,n,r)=>{let i=e._zod.def;Sa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{xa(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},oo=(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;Sa(o,t,r);let s=t.seen.get(e);s.ref=o},so=(e,t,n,r)=>{let i=e._zod.def;Sa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},co=(e,t,n,r)=>{let i=e._zod.def;Sa(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},lo=new WeakSet([Object.prototype,Error.prototype]);function uo(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var fo=z(`ZodError`,(e,t)=>{ct.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);lo.has(n)||(lo.add(n),uo(n,`format`,e=>t=>ft(e,t)),uo(n,`flatten`,e=>t=>dt(e,t)),uo(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ae,2)}),uo(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ae,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),V=mt(fo),H=ht(fo),po=gt(fo),mo=vt(fo),ho=bt(fo),go=xt(fo),_o=St(fo),vo=Ct(fo),yo=wt(fo),bo=Tt(fo),xo=Et(fo),So=Dt(fo);function Co(){$e.localeError||et(pi())}function wo(){$e.memoizer||et({memoizer:ui()})}var To=z(`ZodType`,(e,t)=>(Co(),On.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(oe(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 me(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Hs(e,t))},superRefine(e,t){return this.check(Us(e,t))},overwrite(e){return this.check(la(e))},optional(){return ws(this)},exactOptional(){return Es(this)},nullable(){return Os(this)},nullish(){return ws(Os(this))},nonoptional(e){return Ps(this,e)},array(){return cs(this)},or(e){return ds([this,e])},and(e){return hs(this,e)},transform(e){return Rs(this,Ss(e))},default(e){return As(this,e)},prefault(e){return Ms(this,e)},catch(e){return Is(this,e)},pipe(e){return Rs(this,e)},readonly(){return Bs(this)},describe(e){let t=this.clone();return _i.add(t,{description:e}),t},meta(...e){if(e.length===0)return _i.get(this);let t=this.clone();return _i.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Re(this,`~standard`,{...An(this),jsonSchema:{input:Pa(this,`input`),output:Pa(this,`output`)}})},set"~standard"(e){Le(this,`~standard`,e)},parse:function e(t,n){return V(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await H(this,t,n,{callee:e})},safeParse(e,t){return po(this,e,t)},async safeParseAsync(e,t){return mo(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Le(this,`spa`,e)},encode:function e(t,n){return ho(this,t,n,{callee:e})},decode:function e(t,n){return go(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await _o(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await vo(this,t,n,{callee:e})},safeEncode(e,t){return yo(this,e,t)},safeDecode(e,t){return bo(this,e,t)},async safeEncodeAsync(e,t){return xo(this,e,t)},async safeDecodeAsync(e,t){return So(this,e,t)},toJSONSchema(e){return Na(this,{})(e)},get description(){return _i.get(this)?.description},get _def(){return this._zod.def}}),Eo=z(`_ZodString`,(e,t)=>{jn.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ia(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null},{regex(...e){return this.check(ra(...e))},includes(...e){return this.check(oa(...e))},startsWith(...e){return this.check(sa(...e))},endsWith(...e){return this.check(ca(...e))},min(...e){return this.check(ta(...e))},max(...e){return this.check(ea(...e))},length(...e){return this.check(na(...e))},nonempty(...e){return this.check(ta(1,...e))},lowercase(e){return this.check(ia(e))},uppercase(e){return this.check(aa(e))},trim(){return this.check(da())},normalize(...e){return this.check(ua(...e))},toLowerCase(){return this.check(fa())},toUpperCase(){return this.check(pa())},slugify(){return this.check(ma())}}),Do=z(`ZodString`,(e,t)=>{jn.init(e,t),Eo.init(e,t)},{email(e){return this.check(yi(No,e))},url(e){return this.check(Ti(Io,e))},jwt(e){return this.check(zi(Zo,e))},emoji(e){return this.check(Ei(Lo,e))},guid(e){return this.check(bi(Po,e))},uuid(e){return this.check(xi(Fo,e))},uuidv4(e){return this.check(Si(Fo,e))},uuidv6(e){return this.check(Ci(Fo,e))},uuidv7(e){return this.check(wi(Fo,e))},nanoid(e){return this.check(Di(Ro,e))},cuid(e){return this.check(Oi(zo,e))},cuid2(e){return this.check(ki(Bo,e))},ulid(e){return this.check(Ai(Vo,e))},base64(e){return this.check(Ii(Jo,e))},base64url(e){return this.check(Li(Yo,e))},xid(e){return this.check(ji(Ho,e))},ksuid(e){return this.check(Mi(Uo,e))},ipv4(e){return this.check(Ni(Wo,e))},ipv6(e){return this.check(B(Go,e))},cidrv4(e){return this.check(Pi(Ko,e))},cidrv6(e){return this.check(Fi(qo,e))},e164(e){return this.check(Ri(Xo,e))},datetime(e){return this.check(Bi(ko,e))},date(e){return this.check(Vi(Ao,e))},time(e){return this.check(Hi(jo,e))},duration(e){return this.check(Ui(Mo,e))}});function U(e){return vi(Do,e)}var Oo=z(`ZodStringFormat`,(e,t)=>{Mn.init(e,t),Eo.init(e,t)}),ko=z(`ZodISODateTime`,(e,t)=>{Yn.init(e,t),Oo.init(e,t)}),Ao=z(`ZodISODate`,(e,t)=>{Xn.init(e,t),Oo.init(e,t)}),jo=z(`ZodISOTime`,(e,t)=>{Zn.init(e,t),Oo.init(e,t)}),Mo=z(`ZodISODuration`,(e,t)=>{Qn.init(e,t),Oo.init(e,t)}),No=z(`ZodEmail`,(e,t)=>{Fn.init(e,t),Oo.init(e,t)}),Po=z(`ZodGUID`,(e,t)=>{Nn.init(e,t),Oo.init(e,t)}),Fo=z(`ZodUUID`,(e,t)=>{Pn.init(e,t),Oo.init(e,t)}),Io=z(`ZodURL`,(e,t)=>{Vn.init(e,t),Oo.init(e,t)}),Lo=z(`ZodEmoji`,(e,t)=>{Hn.init(e,t),Oo.init(e,t)}),Ro=z(`ZodNanoID`,(e,t)=>{Un.init(e,t),Oo.init(e,t)}),zo=z(`ZodCUID`,(e,t)=>{Wn.init(e,t),Oo.init(e,t)}),Bo=z(`ZodCUID2`,(e,t)=>{Gn.init(e,t),Oo.init(e,t)}),Vo=z(`ZodULID`,(e,t)=>{Kn.init(e,t),Oo.init(e,t)}),Ho=z(`ZodXID`,(e,t)=>{qn.init(e,t),Oo.init(e,t)}),Uo=z(`ZodKSUID`,(e,t)=>{Jn.init(e,t),Oo.init(e,t)}),Wo=z(`ZodIPv4`,(e,t)=>{$n.init(e,t),Oo.init(e,t)}),Go=z(`ZodIPv6`,(e,t)=>{nr.init(e,t),Oo.init(e,t)}),Ko=z(`ZodCIDRv4`,(e,t)=>{rr.init(e,t),Oo.init(e,t)}),qo=z(`ZodCIDRv6`,(e,t)=>{ar.init(e,t),Oo.init(e,t)}),Jo=z(`ZodBase64`,(e,t)=>{sr.init(e,t),Oo.init(e,t)}),Yo=z(`ZodBase64URL`,(e,t)=>{lr.init(e,t),Oo.init(e,t)}),Xo=z(`ZodE164`,(e,t)=>{ur.init(e,t),Oo.init(e,t)}),Zo=z(`ZodJWT`,(e,t)=>{fr.init(e,t),Oo.init(e,t)}),Qo=z(`ZodNumber`,(e,t)=>{pr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>La(e,t,n,r);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},{gt(e,t){return this.check(Zi(e,t))},gte(e,t){return this.check(Qi(e,t))},min(e,t){return this.check(Qi(e,t))},lt(e,t){return this.check(Yi(e,t))},lte(e,t){return this.check(Xi(e,t))},max(e,t){return this.check(Xi(e,t))},int(e){return this.check(es(e))},safe(e){return this.check(es(e))},positive(e){return this.check(Zi(0,e))},nonnegative(e){return this.check(Qi(0,e))},negative(e){return this.check(Yi(0,e))},nonpositive(e){return this.check(Xi(0,e))},multipleOf(e,t){return this.check($i(e,t))},step(e,t){return this.check($i(e,t))},finite(){return this}});function W(e){return Wi(Qo,e)}var $o=z(`ZodNumberFormat`,(e,t)=>{mr.init(e,t),Qo.init(e,t)});function es(e){return Gi($o,e)}var ts=z(`ZodBoolean`,(e,t)=>{hr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ra(e,t,n,r)});function ns(e){return Ki(ts,e)}var rs=z(`ZodUnknown`,(e,t)=>{gr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function is(){return qi(rs)}var as=z(`ZodNever`,(e,t)=>{_r.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>za(e,t,n,r)});function os(e){return Ji(as,e)}var ss=z(`ZodArray`,(e,t)=>{wo(),yr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wa(e,t,n,r),e.element=t.element},{min(e,t){return this.check(ta(e,t))},nonempty(e){return this.check(ta(1,e))},max(e,t){return this.check(ea(e,t))},length(e,t){return this.check(na(e,t))},unwrap(){return this.element}});function cs(e,t){return ha(ss,e,t)}var ls=z(`ZodObject`,(e,t)=>{wo(),Er.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ka(e,t,n,r),We(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return ys(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:is()})},loose(){return this.clone({...this._zod.def,catchall:is()})},strict(){return this.clone({...this._zod.def,catchall:os()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return be(this,e)},safeExtend(e){return xe(this,e)},merge(e){return Se(this,e)},pick(e){return ve(this,e)},omit(e){return ye(this,e)},partial(...e){return Ce(Cs,this,e[0])},exactPartial(...e){return Ce(Ts,this,e[0],`exactPartial`)},required(...e){return we(Ns,this,e[0])}});function G(e,t){return new ls({type:`object`,shape:e??{},...L(t)})}var us=z(`ZodUnion`,(e,t)=>{Or.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qa(e,t,n,r),e.options=t.options});function ds(e,t){return new us({type:`union`,options:e,...L(t)})}var fs=z(`ZodDiscriminatedUnion`,(e,t)=>{us.init(e,t),kr.init(e,t)});function ps(e,t,n){return new fs({type:`union`,options:t,discriminator:e,...L(n)})}var ms=z(`ZodIntersection`,(e,t)=>{Ar.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ja(e,t,n,r)});function hs(e,t){return new ms({type:`intersection`,left:e,right:t})}var gs=z(`ZodRecord`,(e,t)=>{wo(),Nr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qa(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function _s(e,t,n){return!t||!t._zod?new gs({type:`record`,keyType:U(),valueType:e,...L(t)}):new gs({type:`record`,keyType:e,valueType:t,...L(n)})}var vs=z(`ZodEnum`,(e,t)=>{Pr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ba(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 vs({...t,checks:[],...L(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 vs({...t,checks:[],...L(r),entries:i})}});function ys(e,t){return new vs({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...L(t)})}var bs=z(`ZodLiteral`,(e,t)=>{Fr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Va(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function K(e,t){return new bs({type:`literal`,values:Array.isArray(e)?e:[e],...L(t)})}var xs=z(`ZodTransform`,(e,t)=>{wo(),Ir.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ua(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Qe(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Fe(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Fe(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Ss(e){return new xs({type:`transform`,transform:e})}var Cs=z(`ZodOptional`,(e,t)=>{Rr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ws(e){return new Cs({type:`optional`,innerType:e})}var Ts=z(`ZodExactOptional`,(e,t)=>{zr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Es(e){return new Ts({type:`optional`,innerType:e})}var Ds=z(`ZodNullable`,(e,t)=>{Br.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$a(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Os(e){return new Ds({type:`nullable`,innerType:e})}var ks=z(`ZodDefault`,(e,t)=>{Vr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ro(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function As(e,t){return new ks({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():de(t)}})}var js=z(`ZodPrefault`,(e,t)=>{Ur.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ms(e,t){return new js({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():de(t)}})}var Ns=z(`ZodNonOptional`,(e,t)=>{Wr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ps(e,t){return new Ns({type:`nonoptional`,innerType:e,...L(t)})}var Fs=z(`ZodCatch`,(e,t)=>{qr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ao(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Is(e,t){return new Fs({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Ke(t)})}var Ls=z(`ZodPipe`,(e,t)=>{Jr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oo(e,t,n,r),e.in=t.in,e.out=t.out});function Rs(e,t){return new Ls({type:`pipe`,in:e,out:t})}var zs=z(`ZodReadonly`,(e,t)=>{Xr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bs(e){return new zs({type:`readonly`,innerType:e})}var Vs=z(`ZodCustom`,(e,t)=>{Qr.init(e,t),To.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ha(e,t,n,r)});function Hs(e,t={}){return ga(Vs,e,t)}function Us(e,t){return _a(e,t)}var Ws=ys([`starting`,`running`,`stopped`,`exited`,`failed`]),Gs=ys([`idle`,`busy`,`unknown`]),Ks=ys([`local`,`remote`]),qs=ys([`ssh`,`enrolled`]),Js=G({id:U(),label:U(),kind:qs.default(`ssh`),sshHost:U().nullable(),sshUser:U().nullable(),sshPort:W().int().positive().default(22),platform:U().nullable(),hubVersion:U().nullable(),state:ys([`disconnected`,`connecting`,`connected`,`error`]),lastSeenAt:W().nullable(),error:U().nullable()}),Ys=G({id:U(),name:U(),kind:Ks,rootPath:U(),hostId:U().nullable(),color:U(),createdAt:W(),archivedAt:W().nullable()}),Xs=G({x:W(),y:W(),w:W(),h:W(),z:W(),collapsed:ns()}),Zs=G({panX:W(),panY:W(),zoom:W()}),Qs=ys([`yellow`,`pink`,`green`,`blue`]),$s=G({id:U(),x:W(),y:W(),w:W(),h:W(),z:W(),text:U().max(2e4),color:Qs,updatedAt:W()}),ec=G({id:U(),workspaceId:U(),name:U(),address:U(),profile:U(),template:U().nullable(),model:U().nullable(),effort:U().nullable(),cwd:U(),agentSessionUuid:U().nullable(),spawnedBy:U().nullable(),parentAddress:U().nullable().optional(),state:Ws,status:Gs,statusText:U().nullable(),title:U().nullable(),pid:W().nullable(),exitCode:W().nullable(),cols:W(),rows:W(),resumable:ns(),createdAt:W(),exitedAt:W().nullable(),lastActiveAt:W(),window:Xs}),tc=ys([`delivered`,`failed`]),nc=G({id:U(),fromAddr:U(),toAddr:U(),body:U(),sentAt:W(),deliveredAt:W().nullable(),deliveryState:tc,error:U().nullable()}),rc=ys([`listed`,`declared`,`none`]),ic=ys([`derived`,`stored`,`file`]),ac=G({id:U(),description:U(),agent:U(),model:U().nullable(),effort:U().nullable(),prompt:U().nullable(),env:_s(U(),U()),error:U().nullable(),source:ic}),oc=G({id:U(),fromAddr:U(),proposedAt:W(),template:G({id:U(),agent:U(),description:U().nullable(),model:U().nullable(),effort:U().nullable(),prompt:U().nullable()})}),sc=G({id:U(),description:U(),mcp:ns(),resumable:ns(),command:U(),commandPath:U().nullable(),available:ns().nullable(),version:U().nullable(),detail:U().nullable(),models:cs(U()),modelSource:rc,takesModel:ns(),takesEffort:ns(),efforts:cs(U())}),cc=G({name:U(),rootPath:U().nullable(),agents:W().int()});G({id:U(),label:U(),kind:ys([`canvas`,`ssh`,`enrolled`]),state:ys([`disconnected`,`connecting`,`connected`,`error`]),you:ns(),platform:U().nullable(),error:U().nullable(),workspaces:cs(cc),agents:cs(G({id:U(),available:ns().nullable(),version:U().nullable(),detail:U().nullable()}))});var lc={PtyOutput:1,PtyInput:2,PtyInputRaw:3};function uc(e,t,n){let r=new TextEncoder().encode(t);if(r.length>255)throw Error(`session id too long for binary frame`);let i=new Uint8Array(2+r.length+n.length);return i[0]=e,i[1]=r.length,i.set(r,2),i.set(n,2+r.length),i}function dc(e){if(e.length<2)throw Error(`binary frame too short`);let t=e[0],n=e[1];if(e.length<2+n)throw Error(`binary frame truncated`);return{kind:t,sessionId:new TextDecoder().decode(e.subarray(2,2+n)),payload:e.subarray(2+n)}}var fc=U().optional();ps(`t`,[G({t:K(`hello`),token:U()}),G({t:K(`attach`),sessionId:U()}),G({t:K(`detach`),sessionId:U()}),G({t:K(`resize`),sessionId:U(),cols:W().int().positive(),rows:W().int().positive()}),G({t:K(`checkFolder`),requestId:fc,hostId:U().nullable().optional(),path:U().min(1)}),G({t:K(`createWorkspace`),requestId:fc,name:U().min(1),rootPath:U().min(1),hostId:U().nullable().optional()}),G({t:K(`updateWorkspace`),requestId:fc,workspaceId:U(),name:U().min(1).optional(),rootPath:U().min(1).optional()}),G({t:K(`removeWorkspace`),requestId:fc,workspaceId:U()}),G({t:K(`saveTemplate`),requestId:fc,id:U().min(1),agent:U().min(1),description:U().nullable().optional(),model:U().nullable().optional(),effort:U().nullable().optional(),prompt:U().nullable().optional(),env:_s(U(),U()).optional()}),G({t:K(`removeTemplate`),requestId:fc,id:U()}),G({t:K(`resolveTemplateProposal`),requestId:fc,proposalId:U(),accept:ns(),id:U().min(1).optional(),agent:U().min(1).optional(),description:U().nullable().optional(),model:U().nullable().optional(),effort:U().nullable().optional(),prompt:U().nullable().optional(),env:_s(U(),U()).optional()}),G({t:K(`startSession`),requestId:fc,workspaceId:U(),profile:U(),model:U().optional(),effort:U().optional(),prompt:U().optional(),name:U().optional(),cwd:U().optional()}),G({t:K(`stopSession`),sessionId:U()}),G({t:K(`removeSession`),requestId:fc,sessionId:U()}),G({t:K(`resumeSession`),sessionId:U()}),G({t:K(`clearSession`),sessionId:U()}),G({t:K(`resumeWorkspace`),workspaceId:U()}),G({t:K(`shareSession`),requestId:fc,sessionId:U()}),G({t:K(`unshareSession`),requestId:fc,sessionId:U()}),G({t:K(`moveWindow`),sessionId:U(),rect:Xs}),G({t:K(`setViewport`),viewport:Zs}),G({t:K(`putNote`),note:$s}),G({t:K(`removeNote`),noteId:U()}),G({t:K(`addHost`),requestId:fc,label:U(),sshHost:U(),sshUser:U(),sshPort:W().int().positive().default(22),privateKeyPath:U().optional()}),G({t:K(`updateHost`),requestId:fc,hostId:U(),label:U().optional(),sshHost:U().optional(),sshUser:U().optional(),sshPort:W().int().positive().optional(),privateKeyPath:U().optional()}),G({t:K(`removeHost`),requestId:fc,hostId:U()}),G({t:K(`connectHost`),hostId:U()}),G({t:K(`refreshAgents`)})]);var pc=G({sessionId:U(),token:U()}),mc=G({hubVersion:U(),enrollUrl:U().nullable(),enrollAltUrl:U().nullable(),lanOrigin:U().nullable(),lanAltOrigin:U().nullable(),hosts:cs(Js),workspaces:cs(Ys),sessions:cs(ec),messages:cs(nc),viewport:Zs,profiles:cs(sc),templates:cs(ac),templateProposals:cs(oc),hostProfiles:_s(U(),cs(sc)),shares:cs(pc),notes:cs($s)}),hc=ps(`t`,[G({t:K(`ready`),state:mc}),G({t:K(`sessionUpserted`),session:ec}),G({t:K(`sessionRemoved`),sessionId:U()}),G({t:K(`workspaceUpserted`),workspace:Ys}),G({t:K(`templatesChanged`),templates:cs(ac)}),G({t:K(`templateProposed`),proposal:oc}),G({t:K(`templateProposalResolved`),proposalId:U()}),G({t:K(`workspaceRemoved`),workspaceId:U()}),G({t:K(`hostUpserted`),host:Js}),G({t:K(`hostRemoved`),hostId:U()}),G({t:K(`sharesChanged`),shares:cs(pc)}),G({t:K(`noteUpserted`),note:$s}),G({t:K(`noteRemoved`),noteId:U()}),G({t:K(`hostLog`),hostId:U(),line:U()}),G({t:K(`agentsDetected`),hostId:U().nullable(),profiles:cs(sc)}),G({t:K(`messageSent`),message:nc}),G({t:K(`snapshot`),sessionId:U(),serialized:U(),cols:W(),rows:W()}),G({t:K(`error`),message:U(),sessionId:U().optional()}),G({t:K(`ack`),requestId:U(),ok:ns(),message:U().optional(),sessionId:U().optional()})]);G({}),G({workspace:U().optional().describe(`Limit to one workspace. Defaults to every agent you can see, on all hosts.`)}),G({id:U().optional().describe(`Just this one template, in full. Omit to list them all.`)}),G({to:U().describe(`Target agent address, "workspace/name". Use list_agents to discover.`),text:U().min(1).max(8e3).describe(`Message body, injected into the target terminal. If you need an answer, ask for one here — say to reply with send_message — then end your turn and let it arrive.`)}),G({profile:U().optional().describe(`Agent profile id. Defaults to your own profile.`),name:U().optional().describe(`Name for the new agent. Auto-generated if omitted.`),host:U().optional().describe(`Machine to start it on, by the label list_hosts gives. The machine that owns the canvas is called "canvas"; "local" always means your own. Defaults to your own machine.`),workspace:U().optional().describe(`Workspace to spawn into. Defaults to your own workspace if it exists on the target machine, else the only workspace there.`),prompt:U().optional().describe(`First instruction, injected once the new agent is ready.`)}),G({}),G({address:U().describe(`Agent address to inspect.`),lines:W().int().positive().max(200).optional().describe(`Trailing lines to return (default 40).`)}),G({text:U().max(120).describe(`Short status shown under your window title on the canvas.`)}),G({address:U().describe(`Agent to stop. You may only stop agents you spawned.`)}),G({id:U().min(1).max(60).describe(`Name for the template, as it will appear in the picker, e.g. "reviewer".`),agent:U().min(1).describe(`Agent profile id it launches, e.g. "claude". Use list_agents to see what exists.`),description:U().max(200).optional().describe(`One line shown beside the name in the picker.`),model:U().optional().describe(`Model to launch on. Refused if that agent takes no model on the command line.`),effort:U().optional().describe(`Reasoning effort. Refused if that agent has no effort setting.`),prompt:U().max(4e3).optional().describe(`First instruction, typed in once the agent is up.`)});function gc(e){let t=e.indexOf(`/`);if(t<=0||t===e.length-1)return null;let n=e.slice(0,t),r=e.slice(t+1);return r.includes(`/`)?null:{workspace:n,name:r}}var _c=G({address:U(),workspace:U().nullable(),profile:U(),state:Ws,status:Gs,statusText:U().nullable(),host:U(),parentAddress:U().nullable()}),vc=ps(`t`,[G({t:K(`deliver`),from:U(),to:U(),body:U()}),G({t:K(`readScreen`),from:U(),address:U(),lines:W().int().positive().optional()}),G({t:K(`listHosts`)}),G({t:K(`listTemplates`)}),G({t:K(`pickTemplate`),profile:U().optional(),parentTemplate:U().nullable(),parentProfile:U()}),G({t:K(`spawn`),from:U(),host:U(),workspace:U().optional(),name:U().optional(),agent:U(),template:U().nullable().optional(),model:U().optional(),effort:U().optional(),env:_s(U(),U()).optional(),opening:U().optional(),restore:U().nullable().optional(),promptGiven:ns()}),G({t:K(`proposeTemplate`),from:U(),id:U(),agent:U(),description:U().optional(),model:U().optional(),effort:U().optional(),prompt:U().optional()})]);ps(`t`,[G({t:K(`hello`),token:U(),hubVersion:U(),schemaVersion:W().int(),enroll:G({label:U(),platform:U(),arch:U(),homeDir:U(),machineId:U().optional()}).optional()}),G({t:K(`listSessions`),id:U()}),G({t:K(`listAgents`),id:U()}),G({t:K(`startSession`),id:U(),workspaceName:U(),rootPath:U(),profile:U(),template:U().nullable().optional(),model:U().optional(),effort:U().optional(),prompt:U().optional(),restorePrompt:U().nullable().optional(),env:_s(U(),U()).optional(),name:U().optional(),spawnedByAddress:U().nullable(),sessionId:U().optional()}),G({t:K(`stopSession`),id:U(),address:U()}),G({t:K(`removeSession`),id:U(),address:U()}),G({t:K(`shutdown`),id:U()}),G({t:K(`resumeSession`),id:U(),address:U()}),G({t:K(`clearSession`),id:U(),address:U()}),G({t:K(`directory`),id:U(),agents:cs(_c),youAre:U().optional()}),G({t:K(`relayResult`),id:U(),relayId:U(),ok:ns(),result:is(),error:U().nullable()}),G({t:K(`deliver`),id:U(),from:U(),to:U(),body:U()}),G({t:K(`readScreen`),id:U(),address:U(),lines:W().int().positive().optional()}),G({t:K(`attach`),id:U(),address:U()}),G({t:K(`detach`),id:U(),address:U()}),G({t:K(`input`),id:U(),address:U(),data:U(),encoding:ys([`utf8`,`binary`]).optional()}),G({t:K(`resize`),id:U(),address:U(),cols:W().int().positive(),rows:W().int().positive()}),G({t:K(`checkFolder`),id:U(),path:U()}),G({t:K(`notify`),id:U(),address:U(),text:U()})]),ps(`t`,[G({t:K(`welcome`),hubVersion:U(),schemaVersion:W().int(),hostToken:U().optional()}),G({t:K(`ok`),id:U(),result:is()}),G({t:K(`err`),id:U(),message:U(),code:ys([`unknown-token`,`schema-mismatch`,`bad-hello`]).optional()}),G({t:K(`sessions`),sessions:cs(ec)}),G({t:K(`agents`),agents:cs(sc)}),G({t:K(`sessionUpserted`),session:ec}),G({t:K(`sessionRemoved`),address:U()}),G({t:K(`output`),address:U(),data:U()}),G({t:K(`relay`),relayId:U(),ask:vc})]);function yc(e,t=32){let n=Array.from(e.subarray(0,t)).map(e=>e.toString(16).padStart(2,`0`)).join(` `);return e.length>t?`${n} … (${e.length}B)`:n}function bc(e){let t=``;for(let n of e)t+=n===27?`\\e`:n===13?`\\r`:n===10?`\\n`:n===9?`\\t`:n<32||n===127?`\\x${n.toString(16).padStart(2,`0`)}`:n<127?String.fromCharCode(n):`\\x${n.toString(16).padStart(2,`0`)}`;return t}function xc(e){let t=!!(e&32),n=!!(e&64),r=e&3,i=[e&4?`shift`:``,e&8?`meta`:``,e&16?`ctrl`:``].filter(Boolean),a;return a=n?r===0?`wheel-up`:r===1?`wheel-down`:`wheel-${r}`:r===3?`release`:[`left`,`middle`,`right`][r],t&&!n&&(a+=`-motion`),i.length?`${a}+${i.join(`+`)}`:a}function Sc(e){if(e.length<6||e[0]!==27||e[1]!==91||e[2]!==77)return null;let t=e[3]-32,n=e[4]-32,r=e[5]-32,i=e.length>6?` +${e.length-6}B`:``;return`X10 ${xc(t)} col=${n} row=${r}${i}`}function Cc(e){let t=bc(e),n=/^\\e\[<(\d+);(\d+);(\d+)([Mm])/.exec(t);if(!n)return null;let r=n[4]===`M`?`press`:`release`;return`SGR ${xc(Number(n[1]))} col=${n[2]} row=${n[3]} ${r}`}function wc(e){let t=Sc(e)??Cc(e);return t?`${t} [${yc(e)}]`:`"${bc(e)}" [${yc(e)}]`}function Tc(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n)&255;return wc(t)}var Ec={9:`x10-mouse`,1e3:`vt200-mouse`,1002:`drag-mouse`,1003:`any-motion-mouse`,1004:`focus-events`,1005:`utf8-mouse-encoding`,1006:`sgr-mouse-encoding`,1015:`urxvt-mouse-encoding`,1016:`sgr-pixel-encoding`,1047:`alt-screen`,1049:`alt-screen+cursor`,47:`alt-screen-legacy`};function Dc(e){let t=[];for(let n of e.matchAll(/\x1b\[\?([\d;]+)([hl])/g))for(let e of n[1].split(`;`)){let r=Ec[e];r&&t.push({mode:e,name:r,set:n[2]===`h`})}return t}function Oc(e){let t=Dc(e);return t.length===0?null:t.map(e=>`${e.set?`+`:`-`}${e.name}(?${e.mode})`).join(` `)}function kc(e){let t=Dc(e);return t.length===0?`no mouse/screen modes`:t.map(e=>`${e.set?`+`:`-`}${e.name}`).join(` `)}function Ac(e,t){return t.filter(t=>t.workspaceId===e.id||e.hostId!==null&&gc(t.address)?.workspace===e.name)}function jc(e){let t=[e.kind===`enrolled`?e.platform??`joined`:e.sshUser&&e.sshHost?`${e.sshUser}@${e.sshHost}:${e.sshPort}`:null,e.hubVersion?`hub ${e.hubVersion}`:null].filter(Boolean);return t.length>0?t.join(` · `):null}function Mc(e,t,n){let r=e=>t.filter(t=>(t.hostId??null)===e).map(e=>({workspace:e,sessions:Ac(e,n)}));return[{id:``,label:`this machine`,sub:null,state:`connected`,host:null,workspaces:r(null)},...e.map(e=>({id:e.id,label:e.label,sub:jc(e),state:e.state,host:e,workspaces:r(e.id)}))]}var Nc=o(((e,t)=>{(function(n,r){if(typeof e==`object`&&typeof t==`object`)t.exports=r();else if(typeof define==`function`&&define.amd)define([],r);else{var i=r();for(var a in i)(typeof e==`object`?e:n)[a]=i[a]}})(globalThis,(()=>(()=>{var e={4567:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;let a=n(9042),o=n(9924),s=n(844),c=n(4725),l=n(2585),u=n(3656),d=t.AccessibilityManager=class extends s.Disposable{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``,this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=this._coreBrowserService.mainDocument.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new o.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this.register(this._terminal.onResize((e=>this._handleResize(e.rows)))),this.register(this._terminal.onRender((e=>this._refreshRows(e.start,e.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((e=>this._handleChar(e)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
59
59
|
`)))),this.register(this._terminal.onA11yTab((e=>this._handleTab(e)))),this.register(this._terminal.onKey((e=>this._handleKey(e.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,u.addDisposableDomListener)(document,`selectionchange`,(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,s.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
60
60
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=a.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.innerText=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error(`anchorNode and/or focusNode are null`);let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=d=r([i(1,l.IInstantiationService),i(2,c.ICoreBrowserService),i(3,c.IRenderService)],d)},3614:(e,t)=>{function n(e){return e.replace(/\r?\n/g,`\r`)}function r(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function i(e,t,i,a){e=r(e=n(e),i.decPrivateModes.bracketedPasteMode&&!0!==a.rawOptions.ignoreBracketedPasteMode),i.triggerDataEvent(e,!0),t.value=``}function a(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=n,t.bracketTextForPaste=r,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,n,r){e.stopPropagation(),e.clipboardData&&i(e.clipboardData.getData(`text/plain`),t,n,r)},t.paste=i,t.moveTextAreaUnderMouseCursor=a,t.rightClickHandler=function(e,t,n,r,i){a(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}},7239:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;let r=n(1505);t.ColorContrastCache=class{constructor(){this._color=new r.TwoKeyMap,this._css=new r.TwoKeyMap}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}}},3656:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,n,r){e.addEventListener(t,n,r);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,n,r))}}}},3551:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;let a=n(3656),o=n(8460),s=n(844),c=n(2585),l=n(4725),u=t.Linkifier=class extends s.Disposable{get currentLink(){return this._currentLink}constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new o.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new o.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,s.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,s.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,a.addDisposableDomListener)(this._element,`mouseleave`,(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,a.addDisposableDomListener)(this._element,`mousemove`,this._handleMouseMove.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mousedown`,this._handleMouseDown.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,`mouseup`,this._handleMouseUp.bind(this)))}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}this._lastBufferCell&&t.x===this._lastBufferCell.x&&t.y===this._lastBufferCell.y||(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){this._activeProviderReplies&&t||(this._activeProviderReplies?.forEach((e=>{e?.forEach((e=>{e.link.dispose&&e.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,(t=>{if(this._isMouseOut)return;let i=t?.map((e=>({link:e})));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)}))}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)this._activeProviderReplies.has(t)&&!this._activeProviderReplies.get(t)||(i=!0);if(!i&&r){let e=r.find((e=>this._linkAtPosition(e.link,t)));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find((e=>this._linkAtPosition(e.link,t)));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){this._currentLink&&this._lastMouseEvent&&(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,s.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}}))))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};t.Linkifier=u=r([i(1,l.IMouseService),i(2,l.IRenderService),i(3,c.IBufferService),i(4,l.ILinkProviderService)],u)},9042:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel=`Terminal input`,t.tooMuchOutput=`Too much output to announce, navigate to rows manually to read`},3730:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;let a=n(511),o=n(2585),s=t.OscLinkProvider=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n)return void t(void 0);let r=[],i=this._optionsService.rawOptions.linkHandler,o=new a.CellData,s=n.getTrimmedLength(),l=-1,u=-1,d=!1;for(let t=0;t<s;t++)if(u!==-1||n.hasContent(t)){if(n.loadCell(t,o),o.hasExtendedAttrs()&&o.extended.urlId){if(u===-1){u=t,l=o.extended.urlId;continue}d=o.extended.urlId!==l}else u!==-1&&(d=!0);if(d||u!==-1&&t===s-1){let n=this._oscLinkService.getLinkData(l)?.uri;if(n){let a={start:{x:u+1,y:e},end:{x:t+(d||t!==s-1?0:1),y:e}},o=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(o=!0)}catch{o=!0}o||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):c(0,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(u=t,l=o.extended.urlId):(u=-1,l=-1)}}t(r)}};function c(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}t.OscLinkProvider=s=r([i(0,o.IBufferService),i(1,o.IOptionsService),i(2,o.IOscLinkService)],s)},6193:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}}},3236:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;let r=n(3614),i=n(3656),a=n(3551),o=n(9042),s=n(3730),c=n(1680),l=n(3107),u=n(5744),d=n(2950),f=n(1296),p=n(428),m=n(4269),h=n(5114),g=n(8934),_=n(3230),v=n(9312),y=n(4725),b=n(6731),x=n(8055),S=n(8969),C=n(8460),w=n(844),T=n(6114),ee=n(8437),E=n(2584),te=n(7399),ne=n(5941),re=n(9074),D=n(2585),O=n(5435),k=n(4567),ie=n(779);class ae extends S.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(e={}){super(e),this.browser=T,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new w.MutableDisposable),this._onCursorMove=this.register(new C.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new C.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new C.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new C.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new C.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new C.EventEmitter),this._onBlur=this.register(new C.EventEmitter),this._onA11yCharEmitter=this.register(new C.EventEmitter),this._onA11yTabEmitter=this.register(new C.EventEmitter),this._onWillOpen=this.register(new C.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(re.DecorationService),this._instantiationService.setService(D.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ie.LinkProviderService),this._instantiationService.setService(y.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(s.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((e,t)=>this.refresh(e,t)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((e=>this._reportWindowsOptions(e)))),this.register(this._inputHandler.onColor((e=>this._handleColorEvent(e)))),this.register((0,C.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,C.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,C.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((e=>this._afterResize(e.cols,e.rows)))),this.register((0,w.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=x.color.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${E.C0.ESC}]${n};${(0,ne.toRgbString)(r)}${E.C1_ESCAPED.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors((e=>e.ansi[t.index]=x.channels.toColor(...t.color)));else{let n=e;this._themeService.modifyColors((e=>e[n]=x.channels.toColor(...t.color)))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(k.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(E.C0.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(E.C0.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this.register((0,i.addDisposableDomListener)(this.element,`copy`,(e=>{this.hasSelection()&&(0,r.copyHandler)(e,this._selectionService)})));let e=e=>(0,r.handlePasteEvent)(e,this.textarea,this.coreService,this.optionsService);this.register((0,i.addDisposableDomListener)(this.textarea,`paste`,e)),this.register((0,i.addDisposableDomListener)(this.element,`paste`,e)),T.isFirefox?this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>{e.button===2&&(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,i.addDisposableDomListener)(this.element,`contextmenu`,(e=>{(0,r.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),T.isLinux&&this.register((0,i.addDisposableDomListener)(this.element,`auxclick`,(e=>{e.button===1&&(0,r.moveTextAreaUnderMouseCursor)(e,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,i.addDisposableDomListener)(this.textarea,`keyup`,(e=>this._keyUp(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keydown`,(e=>this._keyDown(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`keypress`,(e=>this._keyPress(e)),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionstart`,(()=>this._compositionHelper.compositionstart()))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionupdate`,(e=>this._compositionHelper.compositionupdate(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`compositionend`,(()=>this._compositionHelper.compositionend()))),this.register((0,i.addDisposableDomListener)(this.textarea,`input`,(e=>this._inputEvent(e)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement(`div`),this._viewportScrollArea.classList.add(`xterm-scroll-area`),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this.register((0,i.addDisposableDomListener)(this.screenElement,`mousemove`,(e=>this.updateCursorStyle(e)))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement),this.textarea=this._document.createElement(`textarea`),this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,o.promptLabel),T.isChromeOS||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(h.CoreBrowserService,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(y.ICoreBrowserService,this._coreBrowserService),this.register((0,i.addDisposableDomListener)(this.textarea,`focus`,(e=>this._handleTextAreaFocus(e)))),this.register((0,i.addDisposableDomListener)(this.textarea,`blur`,(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(p.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(y.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(b.ThemeService),this._instantiationService.setService(y.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(m.CharacterJoinerService),this._instantiationService.setService(y.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(_.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(y.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((e=>this._onRender.fire(e)))),this.onResize((e=>this._renderService.resize(e.cols,e.rows))),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(g.MouseService),this._instantiationService.setService(y.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(a.Linkifier,this.screenElement)),this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(c.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(v.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(y.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((e=>this.scrollLines(e.amount,e.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((e=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,i.addDisposableDomListener)(this._viewportElement,`scroll`,(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(l.BufferDecorationRenderer,this.screenElement)),this.register((0,i.addDisposableDomListener)(this.element,`mousedown`,(e=>this._selectionService.handleMouseDown(e)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(k.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,(e=>this._handleScreenReaderModeOptionChange(e)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRulerWidth`,(e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(f.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(t)||e.viewport.getLinesScrolled(t)===0)return!1;i=t.deltaY<0?0:1,r=4;break;default:return!1}return!(i===void 0||r===void 0||r>4)&&e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this.register(this.coreMouseService.onProtocolChange((e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),8&e?r.mousemove||=(t.addEventListener(`mousemove`,a.mousemove),a.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),16&e?r.wheel||=(t.addEventListener(`wheel`,a.wheel,{passive:!1}),a.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),2&e?r.mouseup||=a.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),4&e?r.mousedrag||=a.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,i.addDisposableDomListener)(t,`mousedown`,(e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)}))),this.register((0,i.addDisposableDomListener)(t,`wheel`,(e=>{if(!r.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(e))return!1;if(!this.buffer.hasScrollback){let t=this.viewport.getLinesScrolled(e);if(t===0)return;let n=E.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(e.deltaY<0?`A`:`B`),r=``;for(let e=0;e<Math.abs(t);e++)r+=n;return this.coreService.triggerDataEvent(r,!0),this.cancel(e,!0)}return this.viewport.handleWheel(e)?this.cancel(e):void 0}}),{passive:!1})),this.register((0,i.addDisposableDomListener)(t,`touchstart`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(e),this.cancel(e)}),{passive:!0})),this.register((0,i.addDisposableDomListener)(t,`touchmove`,(e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(e)?void 0:this.cancel(e)}),{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t,n=0){n===1?(super.scrollLines(e,t,n),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(e)}paste(e){(0,r.paste)(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;t||e.key!==`Dead`&&e.key!==`AltGraph`||(this._unprocessedDeadKey=!0);let n=(0,te.evaluateKeyboardEvent)(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}return n.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key||!!(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(n.key!==E.C0.ETX&&n.key!==E.C0.CR||(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey?this.cancel(e,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(function(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else{if(e.which===0||e.charCode===0)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(ee.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(E.C0.ESC+`[I`):this.coreService.triggerDataEvent(E.C0.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case O.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${E.C0.ESC}[4;${t};${e}t`);break;case O.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${E.C0.ESC}[6;${r};${n}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}}t.Terminal=ae},9924:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(e,t=1e3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=Date.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}}},1680:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;let a=n(3656),o=n(4725),s=n(8460),c=n(844),l=n(2585),u=t.Viewport=class extends c.Disposable{constructor(e,t,n,r,i,o,c,l){super(),this._viewportElement=e,this._scrollArea=t,this._bufferService=n,this._optionsService=r,this._charSizeService=i,this._renderService=o,this._coreBrowserService=c,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new s.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,a.addDisposableDomListener)(this._viewportElement,`scroll`,this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((e=>this._activeBuffer=e.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((e=>this._renderDimensions=e))),this._handleThemeChange(l.colors),this.register(l.onChangeColors((e=>this._handleThemeChange(e)))),this.register(this._optionsService.onSpecificOptionChange(`scrollback`,(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(e){this._viewportElement.style.backgroundColor=e.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(e){if(e)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;let e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+`px`)}let e=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==e&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=e),this._refreshAnimationFrame=null}syncScrollArea(e=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(e)}_handleScroll(e){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});let t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;let e=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(e*(this._smoothScrollState.target-this._smoothScrollState.origin)),e<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(e,t){let n=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&this._viewportElement.scrollTop!==0||t>0&&n<this._lastRecordedBufferHeight)||(e.cancelable&&e.preventDefault(),!1)}handleWheel(e){let t=this._getPixelsScrolled(e);return t!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+t:this._smoothScrollState.target+=t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}scrollLines(e){if(e!==0){if(this._optionsService.rawOptions.smoothScrollDuration){let t=e*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!1})}}_getPixelsScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._currentRowHeight:e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._currentRowHeight*this._bufferService.rows),t}getBufferElements(e,t){let n,r=``,i=[],a=t??this._bufferService.buffer.lines.length,o=this._bufferService.buffer.lines;for(let t=e;t<a;t++){let e=o.get(t);if(!e)continue;let a=o.get(t+1)?.isWrapped;if(r+=e.translateToString(!a),!a||t===o.length-1){let e=document.createElement(`div`);e.textContent=r,i.push(e),r.length>0&&(n=e),r=``}}return{bufferElements:i,cursorElement:n}}getLinesScrolled(e){if(e.deltaY===0||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(e,t){let n=this._optionsService.rawOptions.fastScrollModifier;return n===`alt`&&t.altKey||n===`ctrl`&&t.ctrlKey||n===`shift`&&t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(e){this._lastTouchY=e.touches[0].pageY}handleTouchMove(e){let t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,t!==0&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}};t.Viewport=u=r([i(2,l.IBufferService),i(3,l.IOptionsService),i(4,o.ICharSizeService),i(5,o.IRenderService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],u)},3107:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;let a=n(4725),o=n(844),s=n(2585),c=t.BufferDecorationRenderer=class extends o.Disposable{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((e=>this._removeDecoration(e)))),this.register((0,o.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=(e.options.height||1)*this._renderService.dimensions.css.cell.height+`px`,t.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+`px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose((()=>{this._decorationElements.delete(e),n.remove()}))),n.style.top=t*this._renderService.dimensions.css.cell.height+`px`,n.style.display=this._altBufferIsActive?`none`:`block`,e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?n*this._renderService.dimensions.css.cell.width+`px`:``:t.style.left=n?n*this._renderService.dimensions.css.cell.width+`px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};t.BufferDecorationRenderer=c=r([i(1,s.IBufferService),i(2,a.ICoreBrowserService),i(3,s.IDecorationService),i(4,a.IRenderService)],c)},5871:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}}},5744:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;let a=n(5871),o=n(4725),s=n(844),c=n(2585),l={full:0,left:0,center:0,right:0},u={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},f=t.OverviewRulerRenderer=class extends s.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(e,t,n,r,i,o,c){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=o,this._coreBrowserService=c,this._colorZoneStore=new a.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);let l=this._canvas.getContext(`2d`);if(!l)throw Error(`Ctx cannot be null`);this._ctx=l,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,s.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange(`overviewRulerWidth`,(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){let e=Math.floor(this._canvas.width/3),t=Math.ceil(this._canvas.width/3);u.full=this._canvas.width,u.left=e,u.center=t,u.right=e,this._refreshDrawHeightConstants(),d.full=0,d.left=0,d.center=u.left,d.right=u.left+u.center}_refreshDrawHeightConstants(){l.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);l.left=t,l.center=t,l.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*l.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1;let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(d[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-l[e.position||`full`]/2),u[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+l[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};t.OverviewRulerRenderer=f=r([i(2,c.IBufferService),i(3,c.IDecorationService),i(4,o.IRenderService),i(5,c.IOptionsService),i(6,o.ICoreBrowserService)],f)},2950:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;let a=n(4725),o=n(2585),s=n(2584),c=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}}),0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout((()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${s.C0.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}}),0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};t.CompositionHelper=c=r([i(2,o.IBufferService),i(3,o.IOptionsService),i(4,o.ICoreService),i(5,a.IRenderService)],c)},9806:(e,t)=>{function n(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=n,t.getCoords=function(e,t,r,i,a,o,s,c,l){if(!o)return;let u=n(e,t,r);return u?(u[0]=Math.ceil((u[0]+(l?s/2:0))/s),u[1]=Math.ceil(u[1]/c),u[0]=Math.min(Math.max(u[0],1),i+ +!!l),u[1]=Math.min(Math.max(u[1],1),a),u):void 0}},9504:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;let r=n(2584);function i(e,t,n,r){let i=e-a(e,n),s=t-a(t,n);return l(Math.abs(i-s)-function(e,t,n){let r=0,i=e-a(e,n),s=t-a(t,n);for(let a=0;a<Math.abs(i-s);a++){let s=o(e,t)===`A`?-1:1;n.buffer.lines.get(i+s*a)?.isWrapped&&r++}return r}(e,t,n),c(o(e,t),r))}function a(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function o(e,t){return e>t?`A`:`B`}function s(e,t,n,r,i,a){let o=e,s=t,c=``;for(;o!==n||s!==r;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function c(e,t){let n=t?`O`:`[`;return r.C0.ESC+n+e}function l(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}t.moveToCellSequence=function(e,t,n,r){let o=n.buffer.x,u=n.buffer.y;if(!n.buffer.hasScrollback)return function(e,t,n,r,o,u){return i(t,r,o,u).length===0?``:l(s(e,t,e,t-a(t,o),!1,o).length,c(`D`,u))}(o,u,0,t,n,r)+i(u,t,n,r)+function(e,t,n,r,o,u){let d;d=i(t,r,o,u).length>0?r-a(r,o):t;let f=r,p=function(e,t,n,r,o,s){let c;return c=i(n,r,o,s).length>0?r-a(r,o):t,e<n&&c<=r||e>=n&&c<r?`C`:`D`}(e,t,n,r,o,u);return l(s(e,d,n,f,p===`C`,o).length,c(p,u))}(o,u,e,t,n,r);let d;if(u===t)return d=o>e?`D`:`C`,l(Math.abs(o-e),c(d,r));d=u>t?`D`:`C`;let f=Math.abs(u-t);return l(function(e,t){return t.cols-e}(u>t?e:o,n)+(f-1)*n.cols+1+((u>t?o:e)-1),c(d,r))}},1296:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;let a=n(3787),o=n(2550),s=n(2223),c=n(6171),l=n(6052),u=n(4725),d=n(8055),f=n(8460),p=n(844),m=n(2585),h=`xterm-dom-renderer-owner-`,g=`xterm-rows`,_=`xterm-fg-`,v=`xterm-bg-`,y=`xterm-focus`,b=`xterm-selection`,x=1,S=t.DomRenderer=class extends p.Disposable{constructor(e,t,n,r,i,s,u,d,m,_,v,y,S){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=s,this._linkifier2=u,this._charSizeService=m,this._optionsService=_,this._bufferService=v,this._coreBrowserService=y,this._themeService=S,this._terminalClass=x++,this._rowElements=[],this._selectionRenderModel=(0,l.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new f.EventEmitter).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(g),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(b),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=(0,c.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((e=>this._injectCss(e)))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(a.DomRendererRowFactory,document),this._element.classList.add(h+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((e=>this._handleLinkHover(e)))),this.register(this._linkifier2.onHideLinkUnderline((e=>this._handleLinkLeave(e)))),this.register((0,p.toDisposable)((()=>{this._element.classList.remove(h+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new o.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${g} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${g} { color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${g} .xterm-dim { color: ${d.color.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${b} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${b} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${b} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${_}${n} { color: ${r.css}; }${this._terminalSelector} .${_}${n}.xterm-dim { color: ${d.color.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${v}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR} { color: ${d.color.opaque(e.background).css}; }${this._terminalSelector} .${_}${s.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${d.color.multiplyOpacity(d.color.opaque(e.background),.5).css}; }${this._terminalSelector} .${v}${s.INVERTED_DEFAULT_COLOR} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(y),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(y),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t)return;this._selectionRenderModel.update(this._terminal,e,t,n);let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow;if(a>=this._bufferService.rows||o<0)return;let s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=r*this.dimensions.css.cell.height+`px`,i.style.top=e*this.dimensions.css.cell.height+`px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._optionsService.rawOptions.cursorBlink,o=this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${h}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};t.DomRenderer=S=r([i(7,m.IInstantiationService),i(8,u.ICharSizeService),i(9,m.IOptionsService),i(10,m.IBufferService),i(11,u.ICoreBrowserService),i(12,u.IThemeService)],S)},3787:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;let a=n(2223),o=n(643),s=n(511),c=n(2585),l=n(8055),u=n(4725),d=n(4269),f=n(6171),p=n(3734),m=t.DomRendererRowFactory=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new s.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,s,c,u,f,m,g){let _=[],v=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,b,x=e.getNoBgTrimmedLength();n&&x<s+1&&(x=s+1);let S=0,C=``,w=0,T=0,ee=0,E=!1,te=0,ne=!1,re=0,D=[],O=m!==-1&&g!==-1;for(let k=0;k<x;k++){e.loadCell(k,this._workCell);let x=this._workCell.getWidth();if(x===0)continue;let ie=!1,ae=k,A=this._workCell;if(v.length>0&&k===v[0][0]){ie=!0;let t=v.shift();A=new d.JoinedCellData(this._workCell,e.translateToString(!0,t[0],t[1]),t[1]-t[0]),ae=t[1]-1,x=A.getWidth()}let j=this._isCellInSelection(k,t),M=n&&k===s,N=O&&k>=m&&k<=g,P=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,(e=>{P=!0}));let oe=A.getChars()||o.WHITESPACE_CELL_CHAR;if(oe===` `&&(A.isUnderline()||A.isOverline())&&(oe=`\xA0`),re=x*u-f.get(oe,A.isBold(),A.isItalic()),b){if(S&&(j&&ne||!j&&!ne&&A.bg===w)&&(j&&ne&&y.selectionForeground||A.fg===T)&&A.extended.ext===ee&&N===E&&re===te&&!M&&!ie&&!P){A.isInvisible()?C+=o.WHITESPACE_CELL_CHAR:C+=oe,S++;continue}S&&(b.textContent=C),b=this._document.createElement(`span`),S=0,C=``}else b=this._document.createElement(`span`);if(w=A.bg,T=A.fg,ee=A.extended.ext,E=N,te=re,ne=j,ie&&s>=k&&s<=ae&&(s=k),!this._coreService.isCursorHidden&&M&&this._coreService.isCursorInitialized){if(D.push(`xterm-cursor`),this._coreBrowserService.isFocused)c&&D.push(`xterm-cursor-blink`),D.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:D.push(`xterm-cursor-outline`);break;case`block`:D.push(`xterm-cursor-block`);break;case`bar`:D.push(`xterm-cursor-bar`);break;case`underline`:D.push(`xterm-cursor-underline`)}}if(A.isBold()&&D.push(`xterm-bold`),A.isItalic()&&D.push(`xterm-italic`),A.isDim()&&D.push(`xterm-dim`),C=A.isInvisible()?o.WHITESPACE_CELL_CHAR:A.getChars()||o.WHITESPACE_CELL_CHAR,A.isUnderline()&&(D.push(`xterm-underline-${A.extended.underlineStyle}`),C===` `&&(C=`\xA0`),!A.isUnderlineColorDefault())){if(A.isUnderlineColorRGB())b.style.textDecorationColor=`rgb(${p.AttributeData.toColorRGB(A.getUnderlineColor()).join(`,`)})`;else{let e=A.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&A.isBold()&&e<8&&(e+=8),b.style.textDecorationColor=y.ansi[e].css}}A.isOverline()&&(D.push(`xterm-overline`),C===` `&&(C=`\xA0`)),A.isStrikethrough()&&D.push(`xterm-strikethrough`),N&&(b.style.textDecoration=`underline`);let F=A.getFgColor(),I=A.getFgColorMode(),se=A.getBgColor(),ce=A.getBgColorMode(),le=!!A.isInverse();if(le){let e=F;F=se,se=e;let t=I;I=ce,ce=t}let ue,de,fe,pe=!1;switch(this._decorationService.forEachDecorationAtCell(k,t,void 0,(e=>{e.options.layer!==`top`&&pe||(e.backgroundColorRGB&&(ce=50331648,se=e.backgroundColorRGB.rgba>>8&16777215,ue=e.backgroundColorRGB),e.foregroundColorRGB&&(I=50331648,F=e.foregroundColorRGB.rgba>>8&16777215,de=e.foregroundColorRGB),pe=e.options.layer===`top`)})),!pe&&j&&(ue=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,se=ue.rgba>>8&16777215,ce=50331648,pe=!0,y.selectionForeground&&(I=50331648,F=y.selectionForeground.rgba>>8&16777215,de=y.selectionForeground)),pe&&D.push(`xterm-decoration-top`),ce){case 16777216:case 33554432:fe=y.ansi[se],D.push(`xterm-bg-${se}`);break;case 50331648:fe=l.channels.toColor(se>>16,se>>8&255,255&se),this._addStyle(b,`background-color:#${h((se>>>0).toString(16),`0`,6)}`);break;default:le?(fe=y.foreground,D.push(`xterm-bg-${a.INVERTED_DEFAULT_COLOR}`)):fe=y.background}switch(ue||A.isDim()&&(ue=l.color.multiplyOpacity(fe,.5)),I){case 16777216:case 33554432:A.isBold()&&F<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(F+=8),this._applyMinimumContrast(b,fe,y.ansi[F],A,ue,void 0)||D.push(`xterm-fg-${F}`);break;case 50331648:let e=l.channels.toColor(F>>16&255,F>>8&255,255&F);this._applyMinimumContrast(b,fe,e,A,ue,de)||this._addStyle(b,`color:#${h(F.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(b,fe,y.foreground,A,ue,de)||le&&D.push(`xterm-fg-${a.INVERTED_DEFAULT_COLOR}`)}D.length&&=(b.className=D.join(` `),0),M||ie||P?b.textContent=C:S++,re!==this.defaultSpacing&&(b.style.letterSpacing=`${re}px`),_.push(b),k=ae}return b&&S&&(b.textContent=C),_}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,f.treatGlyphAsBackgroundColor)(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(i||a||(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=l.color.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return!!s&&(this._addStyle(e,`color:${s.css}`),!0)}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!(!n||!r)&&(this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0])}};function h(e,t,n){for(;e.length<n;)e=t+e;return e}t.DomRendererRowFactory=m=r([i(1,u.ICharacterJoinerService),i(2,c.IOptionsService),i(3,u.ICoreBrowserService),i(4,c.ICoreService),i(5,c.IDecorationService),i(6,u.IThemeService)],m)},2550:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}}},2223:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;let r=n(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=r.isFirefox||r.isLegacyEdge?`bottom`:`ideographic`},6171:(e,t)=>{function n(e){return 57508<=e&&e<=57558}function r(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw Error(`value must not be falsy`);return e},t.isPowerlineGlyph=n,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=r,t.allowRescaling=function(e,t,i,a){return t===1&&i>Math.ceil(1.5*a)&&e!==void 0&&e>255&&!r(e)&&!n(e)&&!function(e){return 57344<=e&&e<=63743}(e)},t.treatGlyphAsBackgroundColor=function(e){return n(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(e,t,n=0){return(e-(2*Math.round(t)-n))%(2*Math.round(t))}},6052:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1])return void this.clear();let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);s>=e.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0])}isCellSelected(e,t,n){return!!this.hasSelection&&(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol)}}t.createSelectionRenderModel=function(){return new n}},456:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;let a=n(2585),o=n(8460),s=n(844),c=t.CharSizeService=class extends s.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this.register(new o.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new d(this._optionsService))}catch{this._measureStrategy=this.register(new u(e,t,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],(()=>this.measure())))}measure(){let e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};t.CharSizeService=c=r([i(2,a.IOptionsService)],c);class l extends s.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}}class u extends l{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class d extends l{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}}},4269:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;let a=n(3734),o=n(643),s=n(511),c=n(2585);class l extends a.AttributeData{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.JoinedCellData=l;let u=t.CharacterJoinerService=class e{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new s.CellData}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,s=0,c=t.getFg(0),l=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==c||this._workCell.bg!==l){if(e-i>1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,s=a,c=this._workCell.fg,l=this._workCell.bg}a+=this._workCell.getChars().length||o.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,s,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(t,n,r,i,a){let o=t.substring(n,r),s=[];try{s=this._characterJoiners[0].handler(o)}catch(e){console.error(e)}for(let t=1;t<this._characterJoiners.length;t++)try{let n=this._characterJoiners[t].handler(o);for(let t=0;t<n.length;t++)e._mergeRanges(s,n[t])}catch(e){console.error(e)}return this._stringRangesToCellRanges(s,i,a),s}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,s=e[r];if(s){for(let c=n;c<this._bufferService.cols;c++){let n=t.getWidth(c),l=t.getString(c).length||o.WHITESPACE_CELL_CHAR.length;if(n!==0){if(!i&&s[0]<=a&&(s[0]=c,i=!0),s[1]<=a){if(s[1]=c,s=e[++r],!s)break;s[0]<=a?(s[0]=c,i=!0):i=!1}a+=l}}s&&(s[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0)}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};t.CharacterJoinerService=u=r([i(0,c.IBufferService)],u)},5114:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;let r=n(844),i=n(8460),a=n(3656);class o extends r.Disposable{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new s(this._window),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new i.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((e=>this._screenDprMonitor.setWindow(e)))),this.register((0,i.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener(`focus`,(()=>this._isFocused=!0)),this._textarea.addEventListener(`blur`,(()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}t.CoreBrowserService=o;class s extends r.Disposable{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this.register(new r.MutableDisposable),this._onDprChange=this.register(new i.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,r.toDisposable)((()=>this.clearListener())))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,a.addDisposableDomListener)(this._parentWindow,`resize`,(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;let r=n(844);class i extends r.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,r.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}}t.LinkProviderService=i},8934:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;let a=n(4725),o=n(9806),s=t.MouseService=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return(0,o.getCoords)(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=(0,o.getCoordsRelativeToElement)(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};t.MouseService=s=r([i(0,a.IRenderService),i(1,a.ICharSizeService)],s)},3230:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;let a=n(6193),o=n(4725),s=n(8460),c=n(844),l=n(7226),u=n(2585),d=t.RenderService=class extends c.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,n,r,i,o,u,d){super(),this._rowCount=e,this._charSizeService=r,this._renderer=this.register(new c.MutableDisposable),this._pausedResizeTask=new l.DebouncedIdleTask,this._observerDisposable=this.register(new c.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new s.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new s.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new s.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new s.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new a.RenderDebouncer(((e,t)=>this._renderRows(e,t)),u),this.register(this._renderDebouncer),this.register(u.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(o.onResize((()=>this._fullRefresh()))),this.register(o.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(n.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(i.onDecorationRegistered((()=>this._fullRefresh()))),this.register(i.onDecorationRemoved((()=>this._fullRefresh()))),this.register(n.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],(()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()}))),this.register(n.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],(()=>this.refreshRows(o.buffer.y,o.buffer.y,!0)))),this.register(d.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(u.window,t),this.register(u.onWindowChange((e=>this._registerIntersectionObserver(e,t))))}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver((e=>this._handleIntersectionChange(e[e.length-1])),{threshold:0});n.observe(t),this._observerDisposable.value=(0,c.toDisposable)((()=>n.disconnect()))}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){this._isPaused?this._needsFullRefresh=!0:(n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0)}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw((e=>this.refreshRows(e.start,e.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(e,t))):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};t.RenderService=d=r([i(2,u.IOptionsService),i(3,o.ICharSizeService),i(4,u.IDecorationService),i(5,u.IBufferService),i(6,o.ICoreBrowserService),i(7,o.IThemeService)],d)},9312:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;let a=n(9806),o=n(9504),s=n(456),c=n(4725),l=n(8460),u=n(844),d=n(6114),f=n(4841),p=n(511),m=n(2585),h=RegExp(`\xA0`,`g`),g=t.SelectionService=class extends u.Disposable{constructor(e,t,n,r,i,a,o,c,d){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=c,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new p.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new l.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new l.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new l.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new l.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((e=>this._handleTrim(e))),this.register(this._bufferService.buffers.onBufferActivate((e=>this._handleBufferActivate(e)))),this.enable(),this._model=new s.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,u.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map((e=>e.replace(h,` `))).join(d.isWindows?`\r
|
|
61
61
|
`:`
|
|
@@ -104,7 +104,7 @@ out vec4 outColor;
|
|
|
104
104
|
|
|
105
105
|
void main() {
|
|
106
106
|
outColor = v_color;
|
|
107
|
-
}`)),this.register((0,i.toDisposable)((()=>l.deleteProgram(this._program)))),this._projectionLocation=(0,r.throwIfFalsy)(l.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=l.createVertexArray(),l.bindVertexArray(this._vertexArrayObject);let u=new Float32Array([0,0,1,0,0,1,1,1]),d=l.createBuffer();this.register((0,i.toDisposable)((()=>l.deleteBuffer(d)))),l.bindBuffer(l.ARRAY_BUFFER,d),l.bufferData(l.ARRAY_BUFFER,u,l.STATIC_DRAW),l.enableVertexAttribArray(3),l.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let f=new Uint8Array([0,1,2,3]),p=l.createBuffer();this.register((0,i.toDisposable)((()=>l.deleteBuffer(p)))),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,p),l.bufferData(l.ELEMENT_ARRAY_BUFFER,f,l.STATIC_DRAW),this._attributesBuffer=(0,r.throwIfFalsy)(l.createBuffer()),this.register((0,i.toDisposable)((()=>l.deleteBuffer(this._attributesBuffer)))),l.bindBuffer(l.ARRAY_BUFFER,this._attributesBuffer),l.enableVertexAttribArray(0),l.vertexAttribPointer(0,2,l.FLOAT,!1,s,0),l.vertexAttribDivisor(0,1),l.enableVertexAttribArray(1),l.vertexAttribPointer(1,2,l.FLOAT,!1,s,2*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(1,1),l.enableVertexAttribArray(2),l.vertexAttribPointer(2,4,l.FLOAT,!1,s,4*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(2,1),this._updateCachedColors(a.colors),this.register(this._themeService.onChangeColors((e=>{this._updateCachedColors(e),this._updateViewportRectangle()})))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,o.PROJECTION_MATRIX),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,r,i,o,s,c,l,u,d,f,p,m,h=1;for(r=0;r<t.rows;r++){for(o=-1,s=0,c=0,l=!1,i=0;i<t.cols;i++)u=(r*t.cols+i)*a.RENDER_MODEL_INDICIES_PER_CELL,d=e.cells[u+a.RENDER_MODEL_BG_OFFSET],f=e.cells[u+a.RENDER_MODEL_FG_OFFSET],p=!!(67108864&f),(d!==s||f!==c&&(l||p))&&((s!==0||l&&c!==0)&&(m=8*h++,this._updateRectangle(n,m,c,s,o,i,r)),o=i,s=d,c=f,l=p);(s!==0||l&&c!==0)&&(m=8*h++,this._updateRectangle(n,m,c,s,o,t.cols,r))}n.count=h}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style===`block`)return void(t.count=0);let r,i=0;n.style!==`bar`&&n.style!==`outline`||(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style===`bar`?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),n.style!==`underline`&&n.style!==`outline`||(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style===`outline`&&(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),r=8*i++,this._addRectangleFloat(t.attributes,r,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=i}_updateRectangle(e,t,n,r,i,a,s){if(67108864&n)switch(50331648&n){case 16777216:case 33554432:l=this._themeService.colors.ansi[255&n].rgba;break;case 50331648:l=(16777215&n)<<8;break;default:l=this._themeService.colors.foreground.rgba}else switch(50331648&r){case 16777216:case 33554432:l=this._themeService.colors.ansi[255&r].rgba;break;case 50331648:l=(16777215&r)<<8;break;default:l=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=(0,o.expandFloat32Array)(e.attributes,this._terminal.rows*this._terminal.cols*8)),u=i*this._dimensions.device.cell.width,d=s*this._dimensions.device.cell.height,f=(l>>24&255)/255,p=(l>>16&255)/255,m=(l>>8&255)/255,h=1,this._addRectangle(e.attributes,t,u,d,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,f,p,m,h)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(255&e.rgba)/255])}}t.RectangleRenderer=g},310:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderModel=t.COMBINED_CHAR_BIT_MASK=t.RENDER_MODEL_EXT_OFFSET=t.RENDER_MODEL_FG_OFFSET=t.RENDER_MODEL_BG_OFFSET=t.RENDER_MODEL_INDICIES_PER_CELL=void 0;let r=n(296);t.RENDER_MODEL_INDICIES_PER_CELL=4,t.RENDER_MODEL_BG_OFFSET=1,t.RENDER_MODEL_FG_OFFSET=2,t.RENDER_MODEL_EXT_OFFSET=3,t.COMBINED_CHAR_BIT_MASK=2147483648,t.RenderModel=class{constructor(){this.cells=new Uint32Array,this.lineLengths=new Uint32Array,this.selection=(0,r.createSelectionRenderModel)()}resize(e,n){let r=e*n*t.RENDER_MODEL_INDICIES_PER_CELL;r!==this.cells.length&&(this.cells=new Uint32Array(r),this.lineLengths=new Uint32Array(n))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;let r=n(820),i=n(274),a=n(627),o=n(457),s=n(56),c=n(374),l=n(345),u=n(859),d=n(147),f=n(782),p=n(855),m=n(965),h=n(742),g=n(310),_=n(733);class v extends u.Disposable{constructor(e,t,n,o,d,p,m,h,v){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=o,this._coreService=d,this._decorationService=p,this._optionsService=m,this._themeService=h,this._cursorBlinkStateManager=new u.MutableDisposable,this._charAtlasDisposable=this.register(new u.MutableDisposable),this._observerDisposable=this.register(new u.MutableDisposable),this._model=new g.RenderModel,this._workCell=new f.CellData,this._workCell2=new f.CellData,this._rectangleRenderer=this.register(new u.MutableDisposable),this._glyphRenderer=this.register(new u.MutableDisposable),this._onChangeTextureAtlas=this.register(new l.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new l.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new l.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new l.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new l.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors((()=>this._handleColorChange()))),this._cellColorResolver=new i.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new _.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,m,this._themeService)],this.dimensions=(0,c.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(m.onOptionChange((()=>this._handleOptionsChanged()))),this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let y={antialias:!1,depth:!1,preserveDrawingBuffer:v};if(this._gl=this._canvas.getContext(`webgl2`,y),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this.register((0,r.addDisposableDomListener)(this._canvas,`webglcontextlost`,(e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout((()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)}),3e3)}))),this.register((0,r.addDisposableDomListener)(this._canvas,`webglcontextrestored`,(e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,a.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()}))),this._observerDisposable.value=(0,s.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,((e,t)=>this._setCanvasDevicePixelDimensions(e,t))),this.register(this._coreBrowserService.onWindowChange((e=>{this._observerDisposable.value=(0,s.observeDevicePixelDimensions)(this._canvas,e,((e,t)=>this._setCanvasDevicePixelDimensions(e,t)))}))),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,u.toDisposable)((()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),(0,a.removeTerminalFromCache)(this._terminal)})))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let e of this._renderLayers)e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new h.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new m.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);let e=(0,a.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=(0,u.getDisposeArrayDisposable)([(0,l.forwardEvent)(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,l.forwardEvent)(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(e){return-1}deregisterCharacterJoiner(e){return!1}renderRows(e,t){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(let n of this._renderLayers)n.handleGridChanged(this._terminal,e,t);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new o.CursorBlinkStateManager((()=>{this._requestRedrawCursor()}),this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r,i,a,o,s,c,l,u,d,f,m,h,_,v,x=this._workCell;e=b(e,n.rows-1,0),t=b(t,n.rows-1,0);let S=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,C=S-n.buffer.ydisp,w=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),T=-1,ee=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let E=!1;for(i=e;i<=t;i++)for(a=i+n.buffer.ydisp,o=n.buffer.lines.get(a),this._model.lineLengths[i]=0,s=this._characterJoinerService.getJoinedCharacters(a),_=0;_<n.cols;_++)if(r=this._cellColorResolver.result.bg,o.loadCell(_,x),_===0&&(r=this._cellColorResolver.result.bg),c=!1,l=_,s.length>0&&_===s[0][0]&&(c=!0,u=s.shift(),x=new y(x,o.translateToString(!0,u[0],u[1]),u[1]-u[0]),l=u[1]-1),d=x.getChars(),f=x.getCode(),h=(i*n.cols+_)*g.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(x,_,a,this.dimensions.device.cell.width),ee&&a===S&&(_===w&&(this._model.cursor={x:w,y:C,width:x.getWidth(),style:this._coreBrowserService.isFocused?n.options.cursorStyle||`block`:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},T=w+x.getWidth()-1),_>=w&&_<=T&&(this._coreBrowserService.isFocused&&(n.options.cursorStyle||`block`)===`block`||!1===this._coreBrowserService.isFocused&&n.options.cursorInactiveStyle===`block`)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),f!==p.NULL_CELL_CODE&&(this._model.lineLengths[i]=_+1),(this._model.cells[h]!==f||this._model.cells[h+g.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[h+g.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[h+g.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(E=!0,d.length>1&&(f|=g.COMBINED_CHAR_BIT_MASK),this._model.cells[h]=f,this._model.cells[h+g.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[h+g.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[h+g.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,m=x.getWidth(),this._glyphRenderer.value.updateCell(_,i,f,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,d,m,r),c))for(x=this._workCell,_++;_<l;_++)v=(i*n.cols+_)*g.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(_,i,p.NULL_CELL_CODE,0,0,0,p.NULL_CELL_CHAR,0,0),this._model.cells[v]=p.NULL_CELL_CODE,this._model.cells[v+g.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[v+g.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[v+g.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;E&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}}t.WebglRenderer=v;class y extends d.AttributeData{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function b(e,t,n=0){return Math.max(Math.min(e,t),n)}t.JoinedCellData=y},381:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GLTexture=t.expandFloat32Array=t.createShader=t.createProgram=t.PROJECTION_MATRIX=void 0;let r=n(374);function i(e,t,n){let i=(0,r.throwIfFalsy)(e.createShader(t));if(e.shaderSource(i,n),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;console.error(e.getShaderInfoLog(i)),e.deleteShader(i)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(e,t,n){let a=(0,r.throwIfFalsy)(e.createProgram());if(e.attachShader(a,(0,r.throwIfFalsy)(i(e,e.VERTEX_SHADER,t))),e.attachShader(a,(0,r.throwIfFalsy)(i(e,e.FRAGMENT_SHADER,n))),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS))return a;console.error(e.getProgramInfoLog(a)),e.deleteProgram(a)},t.createShader=i,t.expandFloat32Array=function(e,t){let n=Math.min(2*e.length,t),r=new Float32Array(n);for(let t=0;t<e.length;t++)r[t]=e[t];return r},t.GLTexture=class{constructor(e){this.texture=e,this.version=-1}}},592:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;let r=n(627),i=n(237),a=n(374),o=n(859);class s extends o.Disposable{constructor(e,t,n,r,i,a,s,c){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=s,this._themeService=c,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors((t=>{this._refreshCharAtlas(e,t),this.reset(e)}))),this.register((0,o.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,a.throwIfFalsy)(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,r.acquireTextureAtlas)(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=i.TEXT_BASELINE,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){return`${n?`italic`:``} ${t?e.options.fontWeightBold:e.options.fontWeight} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}}t.BaseRenderLayer=s},733:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;let r=n(197),i=n(237),a=n(592);class o extends a.BaseRenderLayer{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this.register(r.onShowLinkUnderline((e=>this._handleShowLinkUnderline(e)))),this.register(r.onHideLinkUnderline((e=>this._handleHideLinkUnderline(e))))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===i.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&(0,r.is256Color)(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}}t.LinkRenderLayer=o},820:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,n,r){e.addEventListener(t,n,r);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,n,r))}}}},274:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;let r=n(855),i=n(160),a=n(374),o,s=0,c=0,l=!1,u=!1,d=!1,f=0;t.CellColorResolver=class{constructor(e,t,n,r,i,a){this._terminal=e,this._optionService=t,this._selectionRenderModel=n,this._decorationService=r,this._coreBrowserService=i,this._themeService=a,this.result={fg:0,bg:0,ext:0}}resolve(e,t,n,p){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=268435456&e.bg?e.extended.ext:0,c=0,s=0,u=!1,l=!1,d=!1,o=this._themeService.colors,f=0,e.getCode()!==r.NULL_CELL_CODE&&e.extended.underlineStyle===4){let e=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));f=t*p%(2*Math.round(e))}if(this._decorationService.forEachDecorationAtCell(t,n,`bottom`,(e=>{e.backgroundColorRGB&&(c=e.backgroundColorRGB.rgba>>8&16777215,u=!0),e.foregroundColorRGB&&(s=e.foregroundColorRGB.rgba>>8&16777215,l=!0)})),d=this._selectionRenderModel.isCellSelected(this._terminal,t,n),d){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:c=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:c=(16777215&this.result.fg)<<8|255;break;default:c=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:c=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:c=(16777215&this.result.bg)<<8|255}c=i.rgba.blend(c,4294967040&(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else c=(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(u=!0,o.selectionForeground&&(s=o.selectionForeground.rgba>>8&16777215,l=!0),(0,a.treatGlyphAsBackgroundColor)(e.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))s=(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:s=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:s=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:s=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:s=(16777215&this.result.fg)<<8|255;break;default:s=this._themeService.colors.foreground.rgba}s=i.rgba.blend(s,4294967040&(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}l=!0}}this._decorationService.forEachDecorationAtCell(t,n,`top`,(e=>{e.backgroundColorRGB&&(c=e.backgroundColorRGB.rgba>>8&16777215,u=!0),e.foregroundColorRGB&&(s=e.foregroundColorRGB.rgba>>8&16777215,l=!0)})),u&&(c=d?e.bg&-150994944|c|50331648:-16777216&e.bg|c|50331648),l&&(s=e.fg&-83886080|s|50331648),67108864&this.result.fg&&(u&&!l&&(s=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&o.background.rgba>>8|50331648,l=!0),!u&&l&&(c=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&o.foreground.rgba>>8|50331648,u=!0)),o=void 0,this.result.bg=u?c:this.result.bg,this.result.fg=l?s:this.result.fg,this.result.ext&=536870911,this.result.ext|=f<<29&3758096384}}},627:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;let r=n(509),i=n(197),a=[];t.acquireTextureAtlas=function(e,t,n,o,s,c,l,u){let d=(0,i.generateConfig)(o,s,c,l,t,n,u);for(let t=0;t<a.length;t++){let n=a[t],r=n.ownedBy.indexOf(e);if(r>=0){if((0,i.configEquals)(n.config,d))return n.atlas;n.ownedBy.length===1?(n.atlas.dispose(),a.splice(t,1)):n.ownedBy.splice(r,1);break}}for(let t=0;t<a.length;t++){let n=a[t];if((0,i.configEquals)(n.config,d))return n.ownedBy.push(e),n.atlas}let f=e._core,p={atlas:new r.TextureAtlas(document,d,f.unicodeService),config:d,ownedBy:[e]};return a.push(p),p.atlas},t.removeTerminalFromCache=function(e){for(let t=0;t<a.length;t++){let n=a[t].ownedBy.indexOf(e);if(n!==-1){a[t].ownedBy.length===1?(a[t].atlas.dispose(),a.splice(t,1)):a[t].ownedBy.splice(n,1);break}}}},197:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;let r=n(160);t.generateConfig=function(e,t,n,i,a,o,s){let c={foreground:o.foreground,background:o.background,cursor:r.NULL_COLOR,cursorAccent:r.NULL_COLOR,selectionForeground:r.NULL_COLOR,selectionBackgroundTransparent:r.NULL_COLOR,selectionBackgroundOpaque:r.NULL_COLOR,selectionInactiveBackgroundTransparent:r.NULL_COLOR,selectionInactiveBackgroundOpaque:r.NULL_COLOR,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:a.customGlyphs,devicePixelRatio:s,letterSpacing:a.letterSpacing,lineHeight:a.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:n,deviceCharHeight:i,fontFamily:a.fontFamily,fontSize:a.fontSize,fontWeight:a.fontWeight,fontWeightBold:a.fontWeightBold,allowTransparency:a.allowTransparency,drawBoldTextInBrightColors:a.drawBoldTextInBrightColors,minimumContrastRatio:a.minimumContrastRatio,colors:c}},t.configEquals=function(e,t){for(let n=0;n<e.colors.ansi.length;n++)if(e.colors.ansi[n].rgba!==t.colors.ansi[n].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba},t.is256Color=function(e){return(50331648&e)==16777216||(50331648&e)==33554432}},237:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;let r=n(399);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=r.isFirefox||r.isLegacyEdge?`bottom`:`ideographic`},457:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorBlinkStateManager=void 0,t.CursorBlinkStateManager=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=600){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout((()=>{if(this._animationTimeRestarted){let e=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0)return void this._restartInterval(e)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})),this._blinkInterval=this._coreBrowserService.window.setInterval((()=>{if(this._animationTimeRestarted){let e=600-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))}),600)}),e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;let r=n(374);t.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};let i={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};t.boxDrawingDefinitions={"─":{1:`M0,.5 L1,.5`},"━":{3:`M0,.5 L1,.5`},"│":{1:`M.5,0 L.5,1`},"┃":{3:`M.5,0 L.5,1`},"┌":{1:`M0.5,1 L.5,.5 L1,.5`},"┏":{3:`M0.5,1 L.5,.5 L1,.5`},"┐":{1:`M0,.5 L.5,.5 L.5,1`},"┓":{3:`M0,.5 L.5,.5 L.5,1`},"└":{1:`M.5,0 L.5,.5 L1,.5`},"┗":{3:`M.5,0 L.5,.5 L1,.5`},"┘":{1:`M.5,0 L.5,.5 L0,.5`},"┛":{3:`M.5,0 L.5,.5 L0,.5`},"├":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┣":{3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┤":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┫":{3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┬":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┳":{3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┴":{1:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┻":{3:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┼":{1:`M0,.5 L1,.5 M.5,0 L.5,1`},"╋":{3:`M0,.5 L1,.5 M.5,0 L.5,1`},"╴":{1:`M.5,.5 L0,.5`},"╸":{3:`M.5,.5 L0,.5`},"╵":{1:`M.5,.5 L.5,0`},"╹":{3:`M.5,.5 L.5,0`},"╶":{1:`M.5,.5 L1,.5`},"╺":{3:`M.5,.5 L1,.5`},"╷":{1:`M.5,.5 L.5,1`},"╻":{3:`M.5,.5 L.5,1`},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:`M1,0 L0,1`},"╲":{1:`M0,0 L1,1`},"╳":{1:`M1,0 L0,1 M0,0 L1,1`},"╼":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"╽":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L.5,1`},"╾":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"╿":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┍":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┎":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┑":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L0,.5`},"┒":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┕":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L1,.5`},"┖":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┙":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L0,.5`},"┚":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,0`},"┝":{1:`M.5,0 L.5,1`,3:`M.5,.5 L1,.5`},"┞":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┟":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┠":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1`},"┡":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"┢":{1:`M.5,.5 L.5,0`,3:`M0.5,1 L.5,.5 L1,.5`},"┥":{1:`M.5,0 L.5,1`,3:`M.5,.5 L0,.5`},"┦":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┧":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┨":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1`},"┩":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L0,.5`},"┪":{1:`M.5,.5 L.5,0`,3:`M0,.5 L.5,.5 L.5,1`},"┭":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┮":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┯":{1:`M.5,.5 L.5,1`,3:`M0,.5 L1,.5`},"┰":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┱":{1:`M.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"┲":{1:`M.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"┵":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┶":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┷":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5`},"┸":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┹":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"┺":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,.5 L1,.5`},"┽":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┾":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┿":{1:`M.5,0 L.5,1`,3:`M0,.5 L1,.5`},"╀":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"╁":{1:`M.5,.5 L.5,0 M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"╂":{1:`M0,.5 L1,.5`,3:`M.5,0 L.5,1`},"╃":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"╄":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"╅":{1:`M.5,0 L.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"╆":{1:`M.5,0 L.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"╇":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0 M0,.5 L1,.5`},"╈":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"╉":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"╊":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"╌":{1:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"╍":{3:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"┄":{1:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┅":{3:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┈":{1:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"┉":{3:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"╎":{1:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"╏":{3:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"┆":{1:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┇":{3:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┊":{1:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"┋":{3:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},t.powerlineDefinitions={"":{d:`M0,0 L1,.5 L0,1`,type:0,rightPadding:2},"":{d:`M-1,-.5 L1,.5 L-1,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1,0 L0,.5 L1,1`,type:0,leftPadding:2},"":{d:`M2,-.5 L0,.5 L2,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0`,type:0,rightPadding:1},"":{d:`M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0`,type:1,rightPadding:1},"":{d:`M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0`,type:0,leftPadding:1},"":{d:`M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0`,type:1,leftPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L-.5,1.5`,type:0},"":{d:`M-.5,-.5 L1.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1.5,-.5 L-.5,1.5 L1.5,1.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5 L-.5,-.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L1.5,-.5`,type:0}},t.powerlineDefinitions[``]=t.powerlineDefinitions[``],t.powerlineDefinitions[``]=t.powerlineDefinitions[``],t.tryDrawCustomChar=function(e,n,o,l,u,d,f,p){let m=t.blockElementDefinitions[n];if(m)return function(e,t,n,r,i,a){for(let o=0;o<t.length;o++){let s=t[o],c=i/8,l=a/8;e.fillRect(n+s.x*c,r+s.y*l,s.w*c,s.h*l)}}(e,m,o,l,u,d),!0;let h=i[n];if(h)return function(e,t,n,i,o,s){let c=a.get(t);c||(c=new Map,a.set(t,c));let l=e.fillStyle;if(typeof l!=`string`)throw Error(`Unexpected fillStyle type "${l}"`);let u=c.get(l);if(!u){let n=t[0].length,i=t.length,a=e.canvas.ownerDocument.createElement(`canvas`);a.width=n,a.height=i;let o=(0,r.throwIfFalsy)(a.getContext(`2d`)),s=new ImageData(n,i),d,f,p,m;if(l.startsWith(`#`))d=parseInt(l.slice(1,3),16),f=parseInt(l.slice(3,5),16),p=parseInt(l.slice(5,7),16),m=l.length>7&&parseInt(l.slice(7,9),16)||1;else{if(!l.startsWith(`rgba`))throw Error(`Unexpected fillStyle color format "${l}" when drawing pattern glyph`);[d,f,p,m]=l.substring(5,l.length-1).split(`,`).map((e=>parseFloat(e)))}for(let e=0;e<i;e++)for(let r=0;r<n;r++)s.data[4*(e*n+r)]=d,s.data[4*(e*n+r)+1]=f,s.data[4*(e*n+r)+2]=p,s.data[4*(e*n+r)+3]=t[e][r]*(255*m);o.putImageData(s,0,0),u=(0,r.throwIfFalsy)(e.createPattern(a,null)),c.set(l,u)}e.fillStyle=u,e.fillRect(n,i,o,s)}(e,h,o,l,u,d),!0;let g=t.boxDrawingDefinitions[n];if(g)return function(e,t,n,r,i,a,o){e.strokeStyle=e.fillStyle;for(let[l,u]of Object.entries(t)){let t;e.beginPath(),e.lineWidth=o*Number.parseInt(l),t=typeof u==`function`?u(.15,.15/a*i):u;for(let l of t.split(` `)){let t=l[0],u=s[t];if(!u){console.error(`Could not find drawing instructions for "${t}"`);continue}let d=l.substring(1).split(`,`);d[0]&&d[1]&&u(e,c(d,i,a,n,r,!0,o))}e.stroke(),e.closePath()}}(e,g,o,l,u,d,p),!0;let _=t.powerlineDefinitions[n];return!!_&&(function(e,t,n,r,i,a,o,l){let u=new Path2D;u.rect(n,r,i,a),e.clip(u),e.beginPath();let d=o/12;e.lineWidth=l*d;for(let o of t.d.split(` `)){let u=o[0],f=s[u];if(!f){console.error(`Could not find drawing instructions for "${u}"`);continue}let p=o.substring(1).split(`,`);p[0]&&p[1]&&f(e,c(p,i,a,n,r,!1,l,(t.leftPadding??0)*(d/2),(t.rightPadding??0)*(d/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}(e,_,o,l,u,d,f,p),!0)};let a=new Map;function o(e,t,n=0){return Math.max(Math.min(e,t),n)}let s={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function c(e,t,n,r,i,a,s,c=0,l=0){let u=e.map((e=>parseFloat(e)||parseInt(e)));if(u.length<2)throw Error(`Too few arguments for instruction`);for(let e=0;e<u.length;e+=2)u[e]*=t-c*s-l*s,a&&u[e]!==0&&(u[e]=o(Math.round(u[e]+.5)-.5,t,0)),u[e]+=r+c*s;for(let e=1;e<u.length;e+=2)u[e]*=n,a&&u[e]!==0&&(u[e]=o(Math.round(u[e]+.5)-.5,n,0)),u[e]+=i;return u}},56:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;let r=n(859);t.observeDevicePixelDimensions=function(e,t,n){let i=new t.ResizeObserver((t=>{let r=t.find((t=>t.target===e));if(!r)return;if(!(`devicePixelContentBoxSize`in r))return i?.disconnect(),void(i=void 0);let a=r.devicePixelContentBoxSize[0].inlineSize,o=r.devicePixelContentBoxSize[0].blockSize;a>0&&o>0&&n(a,o)}));try{i.observe(e,{box:[`device-pixel-content-box`]})}catch{i.disconnect(),i=void 0}return(0,r.toDisposable)((()=>i?.disconnect()))}},374:(e,t)=>{function n(e){return 57508<=e&&e<=57558}function r(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw Error(`value must not be falsy`);return e},t.isPowerlineGlyph=n,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=r,t.allowRescaling=function(e,t,i,a){return t===1&&i>Math.ceil(1.5*a)&&e!==void 0&&e>255&&!r(e)&&!n(e)&&!function(e){return 57344<=e&&e<=63743}(e)},t.treatGlyphAsBackgroundColor=function(e){return n(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(e,t,n=0){return(e-(2*Math.round(t)-n))%(2*Math.round(t))}},296:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1])return void this.clear();let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);s>=e.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0])}isCellSelected(e,t,n){return!!this.hasSelection&&(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol)}}t.createSelectionRenderModel=function(){return new n}},509:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;let r=n(237),i=n(860),a=n(374),o=n(160),s=n(345),c=n(485),l=n(385),u=n(147),d=n(855),f={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},p;class m{get pages(){return this._pages}constructor(e,t,n){this._document=e,this._config=t,this._unicodeService=n,this._didWarmUp=!1,this._cacheMap=new c.FourKeyMap,this._cacheMapCombined=new c.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new u.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new s.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new s.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=_(e,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,a.throwIfFalsy)(this._tmpCanvas.getContext(`2d`,{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||=(this._doWarmUp(),!0)}_doWarmUp(){let e=new l.IdleTaskQueue;for(let t=33;t<126;t++)e.enqueue((()=>{if(!this._cacheMap.get(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT)){let e=this._drawToCache(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT);this._cacheMap.set(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT,e)}}))}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(m.maxAtlasPages&&this._pages.length>=Math.max(4,m.maxAtlasPages)){let e=this._pages.filter((e=>2*e.canvas.width<=(m.maxTextureSize||4096))).sort(((e,t)=>t.canvas.width===e.canvas.width?t.percentageUsed-e.percentageUsed:t.canvas.width-e.canvas.width)),t=-1,n=0;for(let r=0;r<e.length;r++)if(e[r].canvas.width!==n)t=r,n=e[r].canvas.width;else if(r-t==3)break;let r=e.slice(t,t+4),i=r.map((e=>e.glyphs[0].texturePage)).sort(((e,t)=>e>t?1:-1)),a=this.pages.length-r.length,o=this._mergePages(r,a);o.version++;for(let e=i.length-1;e>=0;e--)this._deletePage(i[e]);this.pages.push(o),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(o.canvas)}let e=new h(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,t){let n=2*e[0].canvas.width,r=new h(this._document,n,e);for(let[i,a]of e.entries()){let e=i*a.canvas.width%n,o=Math.floor(i/2)*a.canvas.height;r.ctx.drawImage(a.canvas,e,o);for(let r of a.glyphs)r.texturePage=t,r.sizeClipSpace.x=r.size.x/n,r.sizeClipSpace.y=r.size.y/n,r.texturePosition.x+=e,r.texturePosition.y+=o,r.texturePositionClipSpace.x=r.texturePosition.x/n,r.texturePositionClipSpace.y=r.texturePosition.y/n;this._onRemoveTextureAtlasCanvas.fire(a.canvas);let s=this._activePages.indexOf(a);s!==-1&&this._activePages.splice(s,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let t=e;t<this._pages.length;t++){let e=this._pages[t];for(let t of e.glyphs)t.texturePage--;e.version++}}getRasterizedGlyphCombinedChar(e,t,n,r,i){return this._getFromCacheMap(this._cacheMapCombined,e,t,n,r,i)}getRasterizedGlyph(e,t,n,r,i){return this._getFromCacheMap(this._cacheMap,e,t,n,r,i)}_getFromCacheMap(e,t,n,r,i,a=!1){return p=e.get(t,n,r,i),p||(p=this._drawToCache(t,n,r,i,a),e.set(t,n,r,i,p)),p}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw Error(`No color found for idx `+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,n,r){if(this._config.allowTransparency)return o.NULL_COLOR;let i;switch(e){case 16777216:case 33554432:i=this._getColorFromAnsiIndex(t);break;case 50331648:let e=u.AttributeData.toColorRGB(t);i=o.channels.toColor(e[0],e[1],e[2]);break;default:i=n?o.color.opaque(this._config.colors.foreground):this._config.colors.background}return i}_getForegroundColor(e,t,n,i,a,s,c,l,d,f){let p=this._getMinimumContrastColor(e,t,n,i,a,s,c,d,l,f);if(p)return p;let m;switch(a){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&d&&s<8&&(s+=8),m=this._getColorFromAnsiIndex(s);break;case 50331648:let e=u.AttributeData.toColorRGB(s);m=o.channels.toColor(e[0],e[1],e[2]);break;default:m=c?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(m=o.color.opaque(m)),l&&(m=o.color.multiplyOpacity(m,r.DIM_OPACITY)),m}_resolveBackgroundRgba(e,t,n){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,n,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,n,r,i,a,s,c,l,u){if(this._config.minimumContrastRatio===1||u)return;let d=this._getContrastCache(l),f=d.getColor(e,r);if(f!==void 0)return f||void 0;let p=this._resolveBackgroundRgba(t,n,s),m=this._resolveForegroundRgba(i,a,s,c),h=o.rgba.ensureContrastRatio(p,m,this._config.minimumContrastRatio/(l?2:1));if(!h)return void d.setColor(e,r,null);let g=o.channels.toColor(h>>24&255,h>>16&255,h>>8&255);return d.setColor(e,r,g),g}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,t,n,o,s=!1){let c=typeof e==`number`?String.fromCharCode(e):e,l=Math.min(this._config.deviceCellWidth*Math.max(c.length,2)+4,this._textureSize);this._tmpCanvas.width<l&&(this._tmpCanvas.width=l);let d=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<d&&(this._tmpCanvas.height=d),this._tmpCtx.save(),this._workAttributeData.fg=n,this._workAttributeData.bg=t,this._workAttributeData.extended.ext=o,this._workAttributeData.isInvisible())return f;let p=!!this._workAttributeData.isBold(),h=!!this._workAttributeData.isInverse(),_=!!this._workAttributeData.isDim(),v=!!this._workAttributeData.isItalic(),y=!!this._workAttributeData.isUnderline(),b=!!this._workAttributeData.isStrikethrough(),x=!!this._workAttributeData.isOverline(),S=this._workAttributeData.getFgColor(),C=this._workAttributeData.getFgColorMode(),w=this._workAttributeData.getBgColor(),T=this._workAttributeData.getBgColorMode();if(h){let e=S;S=w,w=e;let t=C;C=T,T=t}let ee=this._getBackgroundColor(T,w,h,_);this._tmpCtx.globalCompositeOperation=`copy`,this._tmpCtx.fillStyle=ee.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation=`source-over`;let E=p?this._config.fontWeightBold:this._config.fontWeight,te=v?`italic`:``;this._tmpCtx.font=`${te} ${E} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=r.TEXT_BASELINE;let ne=c.length===1&&(0,a.isPowerlineGlyph)(c.charCodeAt(0)),re=c.length===1&&(0,a.isRestrictedPowerlineGlyph)(c.charCodeAt(0)),D=this._getForegroundColor(t,T,w,n,C,S,h,_,p,(0,a.treatGlyphAsBackgroundColor)(c.charCodeAt(0)));this._tmpCtx.fillStyle=D.css;let O=re?0:4,k=!1;!1!==this._config.customGlyphs&&(k=(0,i.tryDrawCustomChar)(this._tmpCtx,c,O,O,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let ie,ae=!ne;if(ie=typeof e==`number`?this._unicodeService.wcwidth(e):this._unicodeService.getStringCellWidth(e),y){this._tmpCtx.save();let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;if(this._tmpCtx.lineWidth=e,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())ae=!1,this._tmpCtx.strokeStyle=`rgb(${u.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(`,`)})`;else{ae=!1;let e=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&e<8&&(e+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(e).css}this._tmpCtx.beginPath();let n=O,r=Math.ceil(O+this._config.deviceCharHeight)-t-(s?2*e:0),i=r+e,o=r+2*e,l=this._workAttributeData.getUnderlineVariantOffset();for(let s=0;s<ie;s++){this._tmpCtx.save();let c=n+s*this._config.deviceCellWidth,u=n+(s+1)*this._config.deviceCellWidth,d=c+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r),this._tmpCtx.moveTo(c,o),this._tmpCtx.lineTo(u,o);break;case 3:let n=e<=1?o:Math.ceil(O+this._config.deviceCharHeight-e/2)-t,s=e<=1?r:Math.ceil(O+this._config.deviceCharHeight+e/2)-t,f=new Path2D;f.rect(c,r,this._config.deviceCellWidth,o-r),this._tmpCtx.clip(f),this._tmpCtx.moveTo(c-this._config.deviceCellWidth/2,i),this._tmpCtx.bezierCurveTo(c-this._config.deviceCellWidth/2,s,c,s,c,i),this._tmpCtx.bezierCurveTo(c,n,d,n,d,i),this._tmpCtx.bezierCurveTo(d,s,u,s,u,i),this._tmpCtx.bezierCurveTo(u,n,u+this._config.deviceCellWidth/2,n,u+this._config.deviceCellWidth/2,i);break;case 4:let p=l===0?0:l>=e?2*e-l:e-l;!(l>=e)==0||p===0?(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(c+p,r),this._tmpCtx.lineTo(u,r)):(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(c+p,r),this._tmpCtx.moveTo(c+p+e,r),this._tmpCtx.lineTo(u,r)),l=(0,a.computeNextVariantOffset)(u-c,e,l);break;case 5:let m=u-c,h=Math.floor(.6*m),g=Math.floor(.3*m),_=m-h-g;this._tmpCtx.setLineDash([h,g,_]),this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r);break;default:this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!k&&this._config.fontSize>=12&&!this._config.allowTransparency&&c!==` `){this._tmpCtx.save(),this._tmpCtx.textBaseline=`alphabetic`;let t=this._tmpCtx.measureText(c);if(this._tmpCtx.restore(),`actualBoundingBoxDescent`in t&&t.actualBoundingBoxDescent>0){this._tmpCtx.save();let t=new Path2D;t.rect(n,r-Math.ceil(e/2),this._config.deviceCellWidth*ie,o-r+Math.ceil(e/2)),this._tmpCtx.clip(t),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=ee.css,this._tmpCtx.strokeText(c,O,O+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(x){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(O,O+t),this._tmpCtx.lineTo(O+this._config.deviceCharWidth*ie,O+t),this._tmpCtx.stroke()}if(k||this._tmpCtx.fillText(c,O,O+this._config.deviceCharHeight),c===`_`&&!this._config.allowTransparency){let e=g(this._tmpCtx.getImageData(O,O,this._config.deviceCellWidth,this._config.deviceCellHeight),ee,D,ae);if(e)for(let t=1;t<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=ee.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(c,O,O+this._config.deviceCharHeight-t),e=g(this._tmpCtx.getImageData(O,O,this._config.deviceCellWidth,this._config.deviceCellHeight),ee,D,ae),e);t++);}if(b){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),t=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(O,O+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.lineTo(O+this._config.deviceCharWidth*ie,O+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.stroke()}this._tmpCtx.restore();let A=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),j;if(j=this._config.allowTransparency?function(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}(A):g(A,ee,D,ae),j)return f;let M=this._findGlyphBoundingBox(A,this._workBoundingBox,l,re,k,O),N,P;for(;;){if(this._activePages.length===0){let e=this._createNewPage();N=e,P=e.currentRow,P.height=M.size.y;break}N=this._activePages[this._activePages.length-1],P=N.currentRow;for(let e of this._activePages)M.size.y<=e.currentRow.height&&(N=e,P=e.currentRow);for(let e=this._activePages.length-1;e>=0;e--)for(let t of this._activePages[e].fixedRows)t.height<=P.height&&M.size.y<=t.height&&(N=this._activePages[e],P=t);if(P.y+M.size.y>=N.canvas.height||P.height>M.size.y+2){let e=!1;if(N.currentRow.y+N.currentRow.height+M.size.y>=N.canvas.height){let t;for(let e of this._activePages)if(e.currentRow.y+e.currentRow.height+M.size.y<e.canvas.height){t=e;break}if(t)N=t;else if(m.maxAtlasPages&&this._pages.length>=m.maxAtlasPages&&P.y+M.size.y<=N.canvas.height&&P.height>=M.size.y&&P.x+M.size.x<=N.canvas.width)e=!0;else{let t=this._createNewPage();N=t,P=t.currentRow,P.height=M.size.y,e=!0}}e||(N.currentRow.height>0&&N.fixedRows.push(N.currentRow),P={x:0,y:N.currentRow.y+N.currentRow.height,height:M.size.y},N.fixedRows.push(P),N.currentRow={x:0,y:P.y+P.height,height:0})}if(P.x+M.size.x<=N.canvas.width)break;P===N.currentRow?(P.x=0,P.y+=P.height,P.height=0):N.fixedRows.splice(N.fixedRows.indexOf(P),1)}return M.texturePage=this._pages.indexOf(N),M.texturePosition.x=P.x,M.texturePosition.y=P.y,M.texturePositionClipSpace.x=P.x/N.canvas.width,M.texturePositionClipSpace.y=P.y/N.canvas.height,M.sizeClipSpace.x/=N.canvas.width,M.sizeClipSpace.y/=N.canvas.height,P.height=Math.max(P.height,M.size.y),P.x+=M.size.x,N.ctx.putImageData(A,M.texturePosition.x-this._workBoundingBox.left,M.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,M.size.x,M.size.y),N.addGlyph(M),N.version++,M}_findGlyphBoundingBox(e,t,n,r,i,a){t.top=0;let o=r?this._config.deviceCellHeight:this._tmpCanvas.height,s=r?this._config.deviceCellWidth:n,c=!1;for(let n=0;n<o;n++){for(let r=0;r<s;r++){let i=n*this._tmpCanvas.width*4+4*r+3;if(e.data[i]!==0){t.top=n,c=!0;break}}if(c)break}t.left=0,c=!1;for(let n=0;n<a+s;n++){for(let r=0;r<o;r++){let i=r*this._tmpCanvas.width*4+4*n+3;if(e.data[i]!==0){t.left=n,c=!0;break}}if(c)break}t.right=s,c=!1;for(let n=a+s-1;n>=a;n--){for(let r=0;r<o;r++){let i=r*this._tmpCanvas.width*4+4*n+3;if(e.data[i]!==0){t.right=n,c=!0;break}}if(c)break}t.bottom=o,c=!1;for(let n=o-1;n>=0;n--){for(let r=0;r<s;r++){let i=n*this._tmpCanvas.width*4+4*r+3;if(e.data[i]!==0){t.bottom=n,c=!0;break}}if(c)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:t.right-t.left+1,y:t.bottom-t.top+1},sizeClipSpace:{x:t.right-t.left+1,y:t.bottom-t.top+1},offset:{x:-t.left+a+(r||i?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-t.top+a+(r||i?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=m;class h{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}constructor(e,t,n){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],n)for(let e of n)this._glyphs.push(...e.glyphs),this._usedPixels+=e._usedPixels;this.canvas=_(e,t,t),this.ctx=(0,a.throwIfFalsy)(this.canvas.getContext(`2d`,{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function g(e,t,n,r){let i=t.rgba>>>24,a=t.rgba>>>16&255,o=t.rgba>>>8&255,s=n.rgba>>>24,c=n.rgba>>>16&255,l=n.rgba>>>8&255,u=Math.floor((Math.abs(i-s)+Math.abs(a-c)+Math.abs(o-l))/12),d=!0;for(let t=0;t<e.data.length;t+=4)e.data[t]===i&&e.data[t+1]===a&&e.data[t+2]===o||r&&Math.abs(e.data[t]-i)+Math.abs(e.data[t+1]-a)+Math.abs(e.data[t+2]-o)<u?e.data[t+3]=0:d=!1;return d}function _(e,t,n){let r=e.createElement(`canvas`);return r.width=t,r.height=n,r}},160:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let n=0,r=0,i=0,a=0;var o,s,c,l,u;function d(e){let t=e.toString(16);return t.length<2?`0`+t:t}function f(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}t.NULL_COLOR={css:`#00000000`,rgba:0},function(e){e.toCss=function(e,t,n,r){return r===void 0?`#${d(e)}${d(t)}${d(n)}`:`#${d(e)}${d(t)}${d(n)}${d(r)}`},e.toRgba=function(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0},e.toColor=function(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}}(o||(t.channels=o={})),function(e){function t(e,t){return a=Math.round(255*t),[n,r,i]=u.toChannels(e.rgba),{css:o.toCss(n,r,i,a),rgba:o.toRgba(n,r,i,a)}}e.blend=function(e,t){if(a=(255&t.rgba)/255,a===1)return{css:t.css,rgba:t.rgba};let s=t.rgba>>24&255,c=t.rgba>>16&255,l=t.rgba>>8&255,u=e.rgba>>24&255,d=e.rgba>>16&255,f=e.rgba>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),{css:o.toCss(n,r,i),rgba:o.toRgba(n,r,i)}},e.isOpaque=function(e){return(255&e.rgba)==255},e.ensureContrastRatio=function(e,t,n){let r=u.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return o.toColor(r>>24&255,r>>16&255,r>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[n,r,i]=u.toChannels(t),{css:o.toCss(n,r,i),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,n){return a=255&e.rgba,t(e,a*n/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(s||(t.color=s={})),function(e){let t,s;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let n=e.getContext(`2d`,{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation=`copy`,s=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),o.toColor(n,r,i);case 5:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),a=parseInt(e.slice(4,5).repeat(2),16),o.toColor(n,r,i,a);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let c=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return n=parseInt(c[1]),r=parseInt(c[2]),i=parseInt(c[3]),a=Math.round(255*(c[5]===void 0?1:parseFloat(c[5]))),o.toColor(n,r,i,a);if(!t||!s||(t.fillStyle=s,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[n,r,i,a]=t.getImageData(0,0,1,1).data,a!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:o.toRgba(n,r,i,a),css:e}}}(c||(t.css=c={})),function(e){function t(e,t,n){let r=e/255,i=t/255,a=n/255;return .2126*(r<=.03928?r/12.92:((r+.055)/1.055)**2.4)+.7152*(i<=.03928?i/12.92:((i+.055)/1.055)**2.4)+.0722*(a<=.03928?a/12.92:((a+.055)/1.055)**2.4)}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(l||(t.rgb=l={})),function(e){function t(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(.1*o)),s-=Math.max(0,Math.ceil(.1*s)),c-=Math.max(0,Math.ceil(.1*c)),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}function s(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),s=Math.min(255,s+Math.ceil(.1*(255-s))),c=Math.min(255,c+Math.ceil(.1*(255-c))),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.blend=function(e,t){if(a=(255&t)/255,a===1)return t;let s=t>>24&255,c=t>>16&255,l=t>>8&255,u=e>>24&255,d=e>>16&255,f=e>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),o.toRgba(n,r,i)},e.ensureContrastRatio=function(e,n,r){let i=l.relativeLuminance(e>>8),a=l.relativeLuminance(n>>8);if(f(i,a)<r){if(a<i){let a=t(e,n,r),o=f(i,l.relativeLuminance(a>>8));if(o<r){let t=s(e,n,r);return o>f(i,l.relativeLuminance(t>>8))?a:t}return a}let o=s(e,n,r),c=f(i,l.relativeLuminance(o>>8));if(c<r){let a=t(e,n,r);return c>f(i,l.relativeLuminance(a>>8))?o:a}return o}},e.reduceLuminance=t,e.increaseLuminance=s,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}}(u||(t.rgba=u={})),t.toPaddedHex=d,t.contrastRatio=f},345:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed){for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}}}),this._event}fire(e,t){let n=[];for(let e=0;e<this._listeners.length;e++)n.push(this._listeners[e]);for(let r=0;r<n.length;r++)n[r].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e((e=>t.fire(e)))},t.runAndSubscribe=function(e,t){return t(void 0),e((e=>t(e)))}},859:(e,t)=>{function n(e){for(let t of e)t.dispose();e.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=n,t.getDisposeArrayDisposable=function(e){return{dispose:()=>n(e)}}},485:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}}t.TwoKeyMap=n,t.FourKeyMap=class{constructor(){this._data=new n}set(e,t,r,i,a){this._data.get(e,t)||this._data.set(e,t,new n),this._data.get(e,t).set(r,i,a)}get(e,t,n,r){return this._data.get(e,t)?.get(n,r)}clear(){this._data.clear()}}},399:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<`u`&&`title`in process;let n=t.isNode?`node`:navigator.userAgent,r=t.isNode?`node`:navigator.platform;t.isFirefox=n.includes(`Firefox`),t.isLegacyEdge=n.includes(`Edge`),t.isSafari=/^((?!chrome|android).)*safari/i.test(n),t.getSafariVersion=function(){if(!t.isSafari)return 0;let e=n.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])},t.isMac=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(r),t.isIpad=r===`iPad`,t.isIphone=r===`iPhone`,t.isWindows=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(r),t.isLinux=r.indexOf(`Linux`)>=0,t.isChromeOS=/\bCrOS\b/.test(n)},385:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;let r=n(399);class i{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),n=Math.max(t,n),i=e.timeRemaining(),1.5*n>i)return r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),void this._start();r=i}this.clear()}}class a extends i{_requestCallback(e){return setTimeout((()=>e(this._createDeadline(16))))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}t.PriorityTaskQueue=a,t.IdleTaskQueue=!r.isNode&&`requestIdleCallback`in window?class extends i{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:a,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},147:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new r}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let e=new n;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=n;class r{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new r(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=r},782:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;let r=n(133),i=n(855),a=n(147);class o extends a.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new a.ExtendedAttrs,this.combinedData=``}static fromCharData(e){let t=new o;return t.setFromCharData(e),t}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,r.stringFromCodePoint)(2097151&this.content):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[i.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[i.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(e[i.CHAR_DATA_CHAR_INDEX].length===2){let n=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(n-55296)+r-56320+65536|e[i.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[i.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[i.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[i.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=o},855:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR=``,t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=` `,t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},133:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=1024*(this._interim-55296)+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=1024*(i-55296)+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r,i,a,o,s=0,c=0,l=0;if(this.interim[0]){let r=!1,i=this.interim[0];i&=(224&i)==192?31:(240&i)==224?15:7;let a,o=0;for(;(a=63&this.interim[++o])&&o<4;)i<<=6,i|=a;let c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(a=e[l++],(192&a)!=128){l--,r=!0;break}this.interim[o++]=a,i<<=6,i|=63&a}r||(c===2?i<128?l--:t[s++]=i:c===3?i<2048||i>=55296&&i<=57343||i===65279||(t[s++]=i):i<65536||i>1114111||(t[s++]=i)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;!(!(d<u)||128&(r=e[d])||128&(i=e[d+1])||128&(a=e[d+2])||128&(o=e[d+3]));)t[s++]=r,t[s++]=i,t[s++]=a,t[s++]=o,d+=4;if(r=e[d++],r<128)t[s++]=r;else if((224&r)==192){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(c=(31&r)<<6|63&i,c<128){d--;continue}t[s++]=c}else if((240&r)==224){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(c=(15&r)<<12|(63&i)<<6|63&a,c<2048||c>=55296&&c<=57343||c===65279)continue;t[s++]=c}else if((248&r)==240){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=a,s;if(o=e[d++],(192&o)!=128){d--;continue}if(c=(7&r)<<18|(63&i)<<12|(63&a)<<6|63&o,c<65536||c>1114111)continue;t[s++]=c}}return s}}},776:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;let a=n(859),o=n(97),s={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF},c,l=t.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange(`logLevel`,(()=>this._updateLogLevel()))),c=this}_updateLogLevel(){this._logLevel=s[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:`xterm.js: `)+t,...n)}trace(e,...t){this._logLevel<=o.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=o.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=o.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=o.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=o.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};t.LogService=l=r([i(0,o.IOptionsService)],l),t.setTraceLogger=function(e){c=e},t.traceCall=function(e,t,n){if(typeof n.value!=`function`)throw Error(`not supported`);let r=n.value;n.value=function(...e){if(c.logLevel!==o.LogLevelEnum.TRACE)return r.apply(this,e);c.trace(`GlyphRenderer#${r.name}(${e.map((e=>JSON.stringify(e))).join(`, `)})`);let t=r.apply(this,e);return c.trace(`GlyphRenderer#${r.name} return`,t),t}}},726:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;let n=`di$target`,r=`di$dependencies`;t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[r]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);let i=function(e,t,a){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);(function(e,t,i){t[n]===t?t[r].push({id:e,index:i}):(t[r]=[{id:e,index:i}],t[n]=t)})(i,e,a)};return i.toString=()=>e,t.serviceRegistry.set(e,i),i}},97:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;let r=n(726);var i;t.IBufferService=(0,r.createDecorator)(`BufferService`),t.ICoreMouseService=(0,r.createDecorator)(`CoreMouseService`),t.ICoreService=(0,r.createDecorator)(`CoreService`),t.ICharsetService=(0,r.createDecorator)(`CharsetService`),t.IInstantiationService=(0,r.createDecorator)(`InstantiationService`),function(e){e[e.TRACE=0]=`TRACE`,e[e.DEBUG=1]=`DEBUG`,e[e.INFO=2]=`INFO`,e[e.WARN=3]=`WARN`,e[e.ERROR=4]=`ERROR`,e[e.OFF=5]=`OFF`}(i||(t.LogLevelEnum=i={})),t.ILogService=(0,r.createDecorator)(`LogService`),t.IOptionsService=(0,r.createDecorator)(`OptionsService`),t.IOscLinkService=(0,r.createDecorator)(`OscLinkService`),t.IUnicodeService=(0,r.createDecorator)(`UnicodeService`),t.IDecorationService=(0,r.createDecorator)(`DecorationService`)}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.WebglAddon=void 0;let t=n(345),i=n(859),a=n(399),o=n(666),s=n(776);class c extends i.Disposable{constructor(e){if(a.isSafari&&(0,a.getSafariVersion)()<16&&!document.createElement(`canvas`).getContext(`webgl2`,{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error(`Webgl2 is only supported on Safari 16 and above`);super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this.register(new t.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new t.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new t.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new t.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(e){let n=e._core;if(!e.element)return void this.register(n.onWillOpen((()=>this.activate(e))));this._terminal=e;let r=n.coreService,a=n.optionsService,c=n,l=c._renderService,u=c._characterJoinerService,d=c._charSizeService,f=c._coreBrowserService,p=c._decorationService,m=c._logService,h=c._themeService;(0,s.setTraceLogger)(m),this._renderer=this.register(new o.WebglRenderer(e,u,d,f,r,p,a,h,this._preserveDrawingBuffer)),this.register((0,t.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,t.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,t.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,t.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),l.setRenderer(this._renderer),this.register((0,i.toDisposable)((()=>{let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)})))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}}e.WebglAddon=c})(),r})()))})),Fc=Nc(),Ic=Pc(),Lc=`termscape-debug`;function Rc(){let e=``;try{e=localStorage.getItem(Lc)??``}catch{}let t=new URL(window.location.href),n=t.searchParams.get(`debug`);if(n!==null){e=n===`off`||n===`0`?``:n;try{e?localStorage.setItem(Lc,e):localStorage.removeItem(Lc)}catch{}t.searchParams.delete(`debug`),window.history.replaceState({},``,t.toString())}return new Set(e.split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean))}var zc=Rc(),Bc=zc.has(`all`)||zc.has(`1`)||zc.has(`true`);function Vc(e){return Bc||zc.has(e)}function Hc(e,...t){Vc(e)&&console.debug(`%c[termscape:${e}]`,`color:#7c9cf5`,...t)}zc.size>0&&console.info(`[termscape] tracing ${Bc?`all`:[...zc].join(`, `)}. Add ?debug=off to stop. Both hubs take the same topics in TERMSCAPE_DEBUG.`);var Uc=.08,Wc=2.5;function Gc(e,t){return{x:(e.x-t.panX)/t.zoom,y:(e.y-t.panY)/t.zoom}}function Kc(e){return Math.min(Wc,Math.max(Uc,e))}function qc(e,t,n){let r=Kc(n),i=Gc(t,e);return{zoom:r,panX:t.x-i.x*r,panY:t.y-i.y*r}}function Jc(e,t){return 12*e*t}function Yc(e,t){let n=Jc(e,t);if(!(n>=9&&n<=64))return Kc(e);let r=12*t,i=Math.round(n);return i/r>2.5&&(i=Math.floor(Wc*r)),i/r<.08&&(i=Math.ceil(Uc*r)),i/r}function Xc(e,t){return Math.min(64,Math.max(9,Math.round(Jc(e,t))))/(12*t)}function Zc(e){return 12*e}function Qc(e,t,n,r){let i=qc(e,{x:t/2,y:n/2},Yc(e.zoom,r));return{zoom:i.zoom,panX:Math.round(i.panX*r)/r,panY:Math.round(i.panY*r)/r}}function $c(e,t,n){let r=t*n;return!Number.isFinite(r)||r<=0?e:Math.round(e*r)/r}function el(e,t,n,r=400){let i=Gc({x:-r,y:-r},e),a=Gc({x:t+r,y:n+r},e);return{x:i.x,y:i.y,w:a.x-i.x,h:a.y-i.y}}function tl(e,t){return!(e.x+e.w<t.x||t.x+t.w<e.x||e.y+e.h<t.y||t.y+t.h<e.y)}function nl(e,t){return t.x>=e.x&&t.x<=e.x+e.w&&t.y>=e.y&&t.y<=e.y+e.h}function rl(e,t,n=.5){return t.x>=e.x-n&&t.y>=e.y-n&&t.x+t.w<=e.x+e.w+n&&t.y+t.h<=e.y+e.h+n}function il(e,t,n,r){return{zoom:t,panX:(n-e.w*t)/2-e.x*t,panY:(r-e.h*t)/2-e.y*t}}function al(e){if(e.length===0)return null;let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y)),r=Math.max(...e.map(e=>e.x+e.w)),i=Math.max(...e.map(e=>e.y+e.h));return{x:t,y:n,w:Math.max(1,r-t),h:Math.max(1,i-n)}}function ol(e,t,n,r=80){let i=al(e);return i?il(i,Kc(Math.min((t-r*2)/i.w,(n-r*2)/i.h)),t,n):{panX:0,panY:0,zoom:1}}var sl=.9;function cl(e,t,n,r=sl){let i=Math.max(1,e.w),a=Math.max(1,e.h),o=Kc(Math.min(t*r/i,n*r/a));return il({...e,w:i,h:a},o,t,n)}function ll(e){let t=al(e);return t?{x:t.x-28,y:t.y-28-24,w:t.w+56,h:t.h+56+24}:null}function ul(e,t){return e&&t.now-e.lastAt<=300?{owner:e.owner,lastAt:t.now}:{owner:t.overTerminal&&!t.zooming?`terminal`:`canvas`,lastAt:t.now}}function dl(e,t=0){return t!==0||Math.abs(e)>=40}var fl=1.15;function pl(e,t=0){return e===0?1:dl(e,t)?e<0?fl:1/fl:Math.min(5,Math.max(.2,1-e*.01))}function ml(e){return!(e.ratio>0)||!Number.isFinite(e.ratio)||!(e.durationMs>=0&&e.durationMs<=400)||Math.abs(Math.log(e.ratio))/Math.log(1.15)<2.999999999?null:e.ratio>1?`in`:`out`}function hl(e){if(e.events<3||!(e.ratio>0)||!Number.isFinite(e.ratio)||!(e.durationMs>=0&&e.durationMs<=900))return null;let t=Math.abs(Math.log(e.ratio));return t<Math.log(1.15)||(e.durationMs>0?t/(e.durationMs/1e3):1/0)<.6?null:e.ratio>1?`in`:`out`}function gl(e,t,n,r){let i=el(t,n,r,0),a=e.find(e=>!rl(i,e));return a?ol([a],n,r):null}function _l(e,t,n,r,i){if(n<=0)return e;if(n>=1)return t;let a=Math.exp(Math.log(e.zoom)+(Math.log(t.zoom)-Math.log(e.zoom))*n),o={x:r/2,y:i/2},s=Gc(o,e),c=Gc(o,t),l=s.x+(c.x-s.x)*n,u=s.y+(c.y-s.y)*n;return{zoom:a,panX:o.x-l*a,panY:o.y-u*a}}var vl=`\x1B[5~`,yl=`\x1B[6~`;function bl(e,t){return t===0?`none`:e.mouseTracking===`none`?e.totalLines>e.rows?`scrollback`:t<0?`page-up`:`page-down`:`program`}function xl(e){return e===`page-up`?vl:e===`page-down`?yl:null}function Sl(e){return e.mouseTracking!==`none`&&!e.shift?`program`:e.hasSelection?`copy`:`paste`}function Cl(e){return{line:e.viewportY,bottom:e.viewportY>=e.baseY}}function wl(e,t){if(e.bottom)return t.viewportY===t.baseY?null:`bottom`;let n=Math.min(e.line,t.baseY);return t.viewportY===n?null:n}async function Tl(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand(`copy`)}catch{return!1}finally{document.body.removeChild(t)}}async function El(){try{return await navigator.clipboard?.readText()??null}catch{return null}}var Dl=`ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace`,Ol=1.2;function kl(){let e=[];for(let t=9;t<=64;t++)e.push(t);return e}function Al(e,t,n=Ol){let r=Math.floor(e.charW*t/12),i=Math.ceil(e.charH*t/12),a=Math.floor(i*n);return{w:r*12/t,h:a*12/t}}function jl(e,t=Ol){let n=0,r=0;for(let i of kl()){let a=Al(e,i,t);a.w>n&&(n=a.w),a.h>r&&(r=a.h)}return{w:n,h:r}}function Ml(e,t,n,r=Ol){let i=jl(n,r);return!(i.w>0)||!(i.h>0)?{cols:2,rows:1}:{cols:Math.max(2,Math.floor(e/i.w)),rows:Math.max(1,Math.floor(t/i.h))}}function Nl(e,t,n,r,i,a,o=Ol){let s=12*i,c=n=>{let r=Al(a,n,o);return{w:Math.ceil(e*r.w),h:Math.ceil(t*r.h)}};for(let e=64;e>=9;e--){let{w:t,h:a}=c(e),o=e/s;if(t*o<=n&&a*o<=r)return{w:t,h:a,zoom:o,renderScale:Xc(o,i)}}let{w:l,h:u}=c(9);return{w:l,h:u,zoom:l>0&&u>0?Math.min(n/l,r/u):1,renderScale:9/s}}var Pl=null;function Fl(){if(Pl)return Pl;let e=document.createElement(`span`);e.textContent=`W`.repeat(32),e.setAttribute(`aria-hidden`,`true`),e.style.cssText=`display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal;white-space:pre;font-kerning:none;`,e.style.fontFamily=Dl,e.style.fontSize=`12px`,document.body.appendChild(e);let t=e.offsetWidth/32,n=e.offsetHeight;return e.remove(),!(t>0)||!(n>0)?{charW:12*.6,charH:12*1.2}:(Pl={charW:t,charH:n},Pl)}var Il=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),q=o(((e,t)=>{t.exports=Il()}))(),J=10,Ll={background:`#0e1117`,foreground:`#d5dae2`,cursor:`#7c9cf5`,selectionBackground:`#2c3b57`,black:`#1c2027`,red:`#e06c75`,green:`#88c07a`,yellow:`#d8b271`,blue:`#7c9cf5`,magenta:`#c07ac8`,cyan:`#5ab4c4`,white:`#c3c9d3`,brightBlack:`#4a5262`,brightRed:`#ef8b93`,brightGreen:`#a3d497`,brightYellow:`#e9cb92`,brightBlue:`#9db4f8`,brightMagenta:`#d69ddc`,brightCyan:`#7fcdda`,brightWhite:`#e8ecf2`};function Y(e){let t=`unknown`,n=`unknown`;try{let r=e._core?.coreMouseService;r?.activeEncoding&&(t=r.activeEncoding),r?.activeProtocol&&(n=r.activeProtocol)}catch{}return{tracking:e.modes.mouseTrackingMode,protocol:n,encoding:t,screen:e.buffer.active.type,grid:`${e.cols}x${e.rows}`,viewportY:e.buffer.active.viewportY,baseY:e.buffer.active.baseY}}function X({sessionId:e,w:t,h:n,renderScale:r,focused:i,grid:a=`drive`,cols:o,rows:s}){let c=(0,_.useRef)(null),l=(0,_.useRef)(null),u=(0,_.useRef)(null),d=O(e=>e.client),f=a===`follow`,p=(0,_.useRef)({cols:o,rows:s});p.current={cols:o,rows:s};let m=(0,_.useCallback)(()=>{if(f)return;let t=u.current,n=l.current;if(!t||!n||!d)return;let{cols:r,rows:i}=Ml(n.clientWidth,n.clientHeight,Fl(),Ol);(r!==t.cols||i!==t.rows)&&(Hc(`attach`,e,`grid ${t.cols}x${t.rows} -> ${r}x${i}`),t.resize(r,i),d.send({t:`resize`,sessionId:e,cols:r,rows:i}))},[d,e,f]),h=(0,_.useRef)(r);h.current=r,(0,_.useEffect)(()=>{let t=c.current;if(!t||!d)return;let n=f?p.current:null,r=new Fc.Terminal({theme:Ll,fontFamily:Dl,fontSize:Zc(h.current),lineHeight:Ol,cursorBlink:i,scrollback:5e3,allowProposedApi:!0,convertEol:!1,...n?.cols&&n?.rows?{cols:n.cols,rows:n.rows}:{}});r.open(t);try{let e=new Ic.WebglAddon;e.onContextLoss(()=>e.dispose()),r.loadAddon(e)}catch{}u.current=r;let a=!1,o=e=>{e.length!==0&&(a=!0,r.write(e))},s=O.getState().takeSnapshot(e);s&&o(s),Hc(`attach`,e,`mounted;`,s?`snapshot ${s.length}B restores: ${kc(s)}`:`no snapshot yet; watching for the one this attach asks for`);let g=d.attach(e,o),_=O.subscribe(t=>{if(a||!t.pendingSnapshots.has(e))return;let n=O.getState().takeSnapshot(e);n&&(Hc(`attach`,e,`snapshot arrived after mount, ${n.length}B restores:`,kc(n)),o(n))}),v=0,y={reports:0,viewportY:0},b=t=>{Vc(`input`)&&(y={reports:v,viewportY:r.buffer.active.viewportY},Hc(`input`,e,`wheel`,{deltaY:t.deltaY,deltaMode:t.deltaMode},Y(r)))},x=t=>{if(!Vc(`input`))return;let n=v-y.reports,i=r.buffer.active.viewportY-y.viewportY;Hc(`input`,e,`wheel ->`,n>0?`${n} report(s) to the program`:i===0?`NOTHING: no report encoded and no local scroll`:`no report; xterm scrolled its own buffer by ${i}`,{defaultPrevented:t.defaultPrevented,tracking:r.modes.mouseTrackingMode,screen:r.buffer.active.type})},S=l.current;S?.addEventListener(`wheel`,b,{capture:!0,passive:!0}),S?.addEventListener(`wheel`,x,{passive:!0});let C=t=>{if(t.button!==2)return;let n=Sl({mouseTracking:r.modes.mouseTrackingMode,hasSelection:r.hasSelection(),shift:t.shiftKey});if(n===`program`){Hc(`input`,e,`right-click -> program (mouse tracking on)`);return}if(t.preventDefault(),t.stopPropagation(),n===`copy`){let t=r.getSelection();Tl(t).then(n=>{Hc(`input`,e,n?`right-click -> copied ${t.length} char(s)`:`right-click -> copy failed; selection kept`),n&&r.clearSelection()})}else El().then(t=>{if(t===null){Hc(`input`,e,`right-click -> paste: clipboard unreadable (non-secure context?)`);return}if(t.length===0){Hc(`input`,e,`right-click -> paste: clipboard empty`);return}Hc(`input`,e,`right-click -> pasted ${t.length} char(s)`),r.paste(t)})};S?.addEventListener(`mousedown`,C,{capture:!0}),r.attachCustomWheelEventHandler(t=>{let n=bl({mouseTracking:r.modes.mouseTrackingMode,totalLines:r.buffer.active.length,rows:r.rows},t.deltaY),i=xl(n);return!i||(Hc(`input`,e,`wheel -> ${n} (nothing else could move)`),d.sendInput(e,i),!1)});let w=r.onData(t=>{v++,d.sendInput(e,t)}),T=r.onBinary(t=>{v++,d.sendInputBytes(e,t)});return m(),()=>{S?.removeEventListener(`wheel`,b,{capture:!0}),S?.removeEventListener(`wheel`,x),S?.removeEventListener(`mousedown`,C,{capture:!0}),_(),w.dispose(),T.dispose(),g(),r.dispose(),u.current=null}},[e,d]),(0,_.useEffect)(()=>{let e=requestAnimationFrame(m);return()=>cancelAnimationFrame(e)},[t,n,m]),(0,_.useEffect)(()=>{if(!f||!o||!s)return;let e=u.current;e&&(e.cols!==o||e.rows!==s)&&e.resize(o,s)},[f,o,s]);let g=(0,_.useRef)(null);return(0,_.useEffect)(()=>()=>{g.current&&cancelAnimationFrame(g.current.raf),g.current=null},[]),(0,_.useEffect)(()=>{let e=u.current;if(!e)return;let t=Zc(r);if(e.options.fontSize===t)return;let n=g.current,i=n?.pin??Cl(e.buffer.active);n&&cancelAnimationFrame(n.raf),e.options.fontSize=t;let a=()=>{let t=g.current;if(!t||u.current!==e)return;let n=wl(t.pin,e.buffer.active);if(n===`bottom`?e.scrollToBottom():n!==null&&e.scrollToLine(n),--t.frames<=0){g.current=null;return}t.raf=requestAnimationFrame(a)};g.current={pin:i,frames:J,raf:requestAnimationFrame(a)}},[r]),(0,_.useEffect)(()=>{let e=u.current;e&&(e.options.cursorBlink=i,i&&e.focus())},[i]),(0,q.jsx)(`div`,{className:`term-host`,ref:l,onContextMenu:e=>e.preventDefault(),children:(0,q.jsx)(`div`,{className:`term-scale`,ref:c,style:{width:`${100*r}%`,height:`${100*r}%`,transform:`scale(${1/r})`}})})}function Z(e){return e.state===`running`?e.status===`busy`?`#d8b271`:`#88c07a`:e.state===`failed`?`#e06c75`:e.state===`exited`?`#4a5262`:`#7c8596`}function Rl(e){return e.state===`running`?e.status===`busy`?`working`:e.status===`idle`?`idle`:`running`:e.state}var zl=320,Bl=200,Vl=(0,_.memo)(function({session:e,workspace:t,zoom:n,dpr:r,renderScale:i,selected:a,maximized:o,onMaximize:s}){let{moveWindow:c,select:l,client:u,shared:d,openDialog:f}=O(w(t=>({moveWindow:t.moveWindow,select:t.select,client:t.client,shared:t.shares.some(t=>t.sessionId===e.id),openDialog:t.openDialog}))),[p,m]=(0,_.useState)(null),h=(0,_.useRef)(e.window);h.current=e.window;let g=(0,_.useCallback)(t=>n=>{n.stopPropagation(),n.target.setPointerCapture(n.pointerId),l(e.id),m({mode:t,ox:n.clientX,oy:n.clientY})},[l,e.id]);(0,_.useEffect)(()=>{if(!p)return;let t=t=>{let r=(t.clientX-p.ox)/n,i=(t.clientY-p.oy)/n,a=h.current;c(e.id,p.mode===`move`?{...a,x:a.x+r,y:a.y+i}:{...a,w:Math.max(zl,a.w+r),h:Math.max(Bl,a.h+i)}),m({...p,ox:t.clientX,oy:t.clientY})},r=()=>m(null);return window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,r),()=>{window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,r)}},[p,c,e.id,n]);let{x:v,y,w:b,h:x}=e.window,S=e.state!==`running`,C=$c(v,n,r),T=$c(y,n,r);return(0,q.jsxs)(`div`,{className:`window${a?` selected`:``}${S?` stopped`:``}`,style:{transform:`translate(${C}px, ${T}px)`,width:b,height:x,zIndex:e.window.z+(a?1e3:0),borderColor:a?`#7c9cf5`:t?.color??`#2a3040`},onPointerDown:()=>l(e.id),children:[(0,q.jsxs)(`header`,{className:`window-bar`,onPointerDown:g(`move`),children:[(0,q.jsx)(`span`,{className:`dot`,style:{background:Z(e)}}),(0,q.jsx)(`span`,{className:`addr`,title:e.address,children:e.title||e.address}),(0,q.jsx)(`span`,{className:`meta`,children:e.statusText??Rl(e)}),(0,q.jsx)(`span`,{className:`spacer`}),(0,q.jsx)(`button`,{className:`btn`,title:o?`Back to the previous view (Ctrl+2)`:`Zoom the canvas to this terminal (Ctrl+2)`,onPointerDown:e=>e.stopPropagation(),onClick:()=>s(e.id),children:o?`⤡`:`⤢`}),(0,q.jsx)(`button`,{className:`btn${d?` on`:``}`,title:d?`Manage this terminal’s share link`:`Share this terminal by link`,onPointerDown:e=>e.stopPropagation(),onClick:()=>f({kind:`share`,sessionId:e.id}),children:`share`}),S&&(0,q.jsx)(`button`,{className:`btn`,title:e.resumable?`Relaunch with its previous conversation`:`Restart this session (this profile cannot resume a conversation)`,onPointerDown:e=>e.stopPropagation(),onClick:()=>u?.send({t:`resumeSession`,sessionId:e.id}),children:e.resumable?`resume`:`restart`}),!S&&(0,q.jsx)(`button`,{className:`btn`,title:`Stop this agent`,onPointerDown:e=>e.stopPropagation(),onClick:()=>u?.send({t:`stopSession`,sessionId:e.id}),children:`stop`}),(0,q.jsx)(`button`,{className:`btn danger`,title:`Remove this window and forget the session`,onPointerDown:e=>e.stopPropagation(),onClick:()=>u?.send({t:`removeSession`,sessionId:e.id}),children:`×`})]}),(0,q.jsx)(`div`,{className:`window-body`,children:(0,q.jsx)(X,{sessionId:e.id,w:b,h:x,renderScale:i,focused:a})}),(0,q.jsx)(`div`,{className:`resize-handle`,onPointerDown:g(`resize`)})]})}),Hl=120,Ul=80,Wl=[`yellow`,`pink`,`green`,`blue`],Gl=(0,_.memo)(function({note:e,zoom:t,selected:n,autoFocus:r}){let{putNote:i,removeNote:a,selectNote:o}=O(w(e=>({putNote:e.putNote,removeNote:e.removeNote,selectNote:e.selectNote}))),[s,c]=(0,_.useState)(null),l=(0,_.useRef)(e);l.current=e;let u=(0,_.useRef)(null);(0,_.useEffect)(()=>{r&&u.current?.focus()},[]);let d=(0,_.useCallback)(()=>{let e=O.getState().notes,t=Math.max(0,...e.map(e=>e.z)),n=l.current;n.z<t&&i({...n,z:t+1})},[i]),f=(0,_.useCallback)(()=>{o(e.id),d()},[o,e.id,d]),p=(0,_.useCallback)(e=>t=>{t.stopPropagation(),t.target.setPointerCapture(t.pointerId),f(),c({mode:e,ox:t.clientX,oy:t.clientY})},[f]);(0,_.useEffect)(()=>{if(!s)return;let e=e=>{let n=(e.clientX-s.ox)/t,r=(e.clientY-s.oy)/t,a=l.current;i(s.mode===`move`?{...a,x:a.x+n,y:a.y+r,updatedAt:Date.now()}:{...a,w:Math.max(Hl,a.w+n),h:Math.max(Ul,a.h+r),updatedAt:Date.now()}),c({...s,ox:e.clientX,oy:e.clientY})},n=()=>c(null);return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,n),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,n)}},[s,i,t]);let{x:m,y:h,w:g,h:v}=e,y=$c(m,t,1),b=$c(h,t,1);return(0,q.jsxs)(`div`,{className:`note${n?` selected`:``}`,"data-color":e.color,style:{transform:`translate(${y}px, ${b}px)`,width:g,height:v,zIndex:e.z+(n?1e3:0)},onPointerDown:f,children:[(0,q.jsxs)(`header`,{className:`note-bar`,onPointerDown:p(`move`),children:[n&&(0,q.jsx)(`span`,{className:`note-swatches`,children:Wl.map(t=>(0,q.jsx)(`button`,{className:`note-swatch${t===e.color?` active`:``}`,"data-color":t,title:t,onPointerDown:e=>e.stopPropagation(),onClick:()=>i({...e,color:t,updatedAt:Date.now()})},t))}),(0,q.jsx)(`span`,{className:`spacer`}),(0,q.jsx)(`button`,{className:`btn danger`,title:`Delete this note`,onPointerDown:e=>e.stopPropagation(),onClick:()=>a(e.id),children:`×`})]}),(0,q.jsx)(`textarea`,{ref:u,className:`note-text`,value:e.text,placeholder:`Type something…`,onPointerDown:e=>{e.stopPropagation(),f()},onChange:t=>i({...e,text:t.target.value,updatedAt:Date.now()})}),(0,q.jsx)(`div`,{className:`resize-handle`,onPointerDown:p(`resize`)})]})}),Kl=2600;function ql({sessions:e}){let t=O(e=>e.flashes),[,n]=(0,_.useState)(0);(0,_.useEffect)(()=>{if(t.length===0)return;let e=setInterval(()=>n(e=>e+1),80);return()=>clearInterval(e)},[t.length]);let r=new Map(e.map(e=>[e.address,e])),i=new Map(e.map(e=>[e.id,e])),a=e=>({x:e.window.x+e.window.w/2,y:e.window.y+e.window.h/2}),o=e.filter(e=>e.spawnedBy&&i.has(e.spawnedBy)).map(e=>({id:e.id,a:a(i.get(e.spawnedBy)),b:a(e)})),s=Date.now(),c=t.map(e=>{let t=r.get(e.from),n=r.get(e.to),i=s-e.at;return!t||!n||i>Kl?null:{...e,a:a(t),b:a(n),t:i/Kl}}).filter(e=>e!==null);if(o.length===0&&c.length===0)return null;let l=1e5;return(0,q.jsxs)(`svg`,{className:`edges`,style:{left:-1e5,top:-1e5},width:l*2,height:l*2,viewBox:`-100000 -100000 ${l*2} ${l*2}`,children:[o.map(e=>(0,q.jsx)(`line`,{x1:e.a.x,y1:e.a.y,x2:e.b.x,y2:e.b.y,stroke:`#39415a`,strokeWidth:2,strokeDasharray:`6 8`},`lin-${e.id}`)),c.map(e=>{let t=e.b.x-e.a.x,n=e.b.y-e.a.y,r=e.a.x+t/2-n*.12,i=e.a.y+n/2+t*.12,a=e.failed?`#e06c75`:`#7c9cf5`,o=(1-e.t)**2*e.a.x+2*(1-e.t)*e.t*r+e.t**2*e.b.x,s=(1-e.t)**2*e.a.y+2*(1-e.t)*e.t*i+e.t**2*e.b.y;return(0,q.jsxs)(`g`,{opacity:1-e.t*.8,children:[(0,q.jsx)(`path`,{d:`M ${e.a.x} ${e.a.y} Q ${r} ${i} ${e.b.x} ${e.b.y}`,fill:`none`,stroke:a,strokeWidth:2.5,strokeDasharray:e.failed?`8 6`:void 0}),!e.failed&&(0,q.jsx)(`circle`,{cx:o,cy:s,r:7,fill:a})]},`msg-${e.id}`)})]})}var Jl=(0,_.memo)(function({ws:e,box:t,sessionIds:n,zoom:r}){let i=O(e=>e.moveWindowsBy),a=(0,_.useRef)(null),[o,s]=(0,_.useState)(!1),c=(0,_.useCallback)(e=>{e.button===0&&(e.stopPropagation(),e.currentTarget.setPointerCapture(e.pointerId),a.current={x:e.clientX,y:e.clientY,ids:n},s(!0))},[n]),l=(0,_.useCallback)(e=>{let t=a.current;t&&(i(t.ids,(e.clientX-t.x)/r,(e.clientY-t.y)/r),a.current={...t,x:e.clientX,y:e.clientY})},[i,r]),u=(0,_.useCallback)(()=>{a.current=null,s(!1)},[]);return(0,q.jsx)(`div`,{className:`ws-group`,style:{transform:`translate(${t.x}px, ${t.y}px)`,width:t.w,height:t.h,color:e.color,borderColor:e.color},children:(0,q.jsxs)(`span`,{className:`ws-label${o?` dragging`:``}`,title:`Drag to move the whole workspace`,onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:u,children:[e.name,(0,q.jsx)(`span`,{className:`ws-path`,children:e.rootPath})]})})}),Yl=140,Xl=180,Zl=e=>1-(1-e)**3;function Ql(){return typeof window>`u`?1:window.devicePixelRatio||1}function $l(e,t){return e.panX===t.panX&&e.panY===t.panY&&e.zoom===t.zoom}function eu(e,t){let n,r=1/0;for(let i of e){let e=i.window.x+i.window.w/2-t.x,a=i.window.y+i.window.h/2-t.y,o=e*e+a*a;o<r&&(r=o,n=i)}return n}function tu(){let e=(0,_.useRef)(null),[t,n]=(0,_.useState)({w:1200,h:800}),[r,i]=(0,_.useState)(!1),a=(0,_.useRef)(null),o=(0,_.useRef)(null),[s,c]=(0,_.useState)(!1),l=(0,_.useRef)(null),[u,d]=(0,_.useState)(Ql),{sessions:f,workspaces:p,notes:m,viewport:h,setViewport:g,selectedId:v,selectedNoteId:y,select:b,createNoteAt:x,setPanelOpen:S}=O(w(e=>({sessions:e.sessions,workspaces:e.workspaces,notes:e.notes,viewport:e.viewport,setViewport:e.setViewport,selectedId:e.selectedId,selectedNoteId:e.selectedNoteId,select:e.select,createNoteAt:e.createNoteAt,setPanelOpen:e.setPanelOpen})));(0,_.useEffect)(()=>{let t=e.current;if(!t)return;let r=new ResizeObserver(()=>{n({w:t.clientWidth,h:t.clientHeight})});return r.observe(t),n({w:t.clientWidth,h:t.clientHeight}),()=>r.disconnect()},[]);let C=(0,_.useRef)(t);C.current=t;let T=(0,_.useRef)(h);T.current=h;let ee=(0,_.useRef)(f);ee.current=f;let E=(0,_.useRef)(u);E.current=u,(0,_.useEffect)(()=>{if(s)return;let e=Qc(h,C.current.w,C.current.h,u);$l(e,h)||g(e)},[h,s,u,g]);let te=(0,_.useCallback)(()=>{l.current=null,c(!1)},[]),ne=(0,_.useRef)(null),re=(0,_.useCallback)(()=>{let e=ne.current;e&&(ne.current=null,cancelAnimationFrame(e.raf))},[]),D=(0,_.useCallback)(()=>{re(),c(!0),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(te,Yl)},[re,te]);(0,_.useEffect)(()=>()=>{l.current!==null&&window.clearTimeout(l.current)},[]),(0,_.useEffect)(()=>{let e=window.matchMedia(`(resolution: ${u}dppx)`),t=()=>d(Ql());return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[u]);let[k,ie]=(0,_.useState)(()=>Xc(h.zoom,Ql()));(0,_.useEffect)(()=>{if(s)return;let e=Xc(h.zoom,u);ie(t=>t===e?t:e)},[h.zoom,u,s]);let ae=(0,_.useCallback)(e=>{S(!1),(e.target===e.currentTarget||e.button===1)&&(e.button===0&&b(null),a.current={x:e.clientX,y:e.clientY},i(!0),e.currentTarget.setPointerCapture(e.pointerId))},[b,S]),A=(0,_.useCallback)(e=>{(e.movementX||e.movementY)&&(o.current=null);let t=a.current;t&&(D(),g({...h,panX:h.panX+(e.clientX-t.x),panY:h.panY+(e.clientY-t.y)}),a.current={x:e.clientX,y:e.clientY})},[h,g,D]),j=(0,_.useCallback)(()=>{a.current=null,i(!1),D()},[D]),M=(0,_.useCallback)(t=>{let n=t.target;if(n!==t.currentTarget&&!n.classList.contains(`world`))return;let r=e.current;if(!r)return;let i=r.getBoundingClientRect(),a=Gc({x:t.clientX-i.left,y:t.clientY-i.top},T.current);x(a);let o=O.getState().selectedNoteId;_e.current=o,setTimeout(()=>{_e.current===o&&(_e.current=null)},0)},[x]),N=(0,_.useCallback)(e=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null),g(e),c(!1)},[g]),P=(0,_.useCallback)(e=>{re(),l.current!==null&&(window.clearTimeout(l.current),l.current=null);let t=T.current;c(!0);let n=r=>{let i=ne.current;if(!i)return;let a=(r-i.startedAt)/Xl;if(a>=1){ne.current=null,N(e);return}let{w:o,h:s}=C.current;g(_l(t,e,Zl(a),o,s)),i.raf=requestAnimationFrame(n)};ne.current={raf:requestAnimationFrame(n),startedAt:performance.now()}},[N,re,g]),[oe,F]=(0,_.useState)(null),I=(0,_.useRef)(oe);I.current=oe;let se=(0,_.useCallback)((e,t)=>{let n=ee.current.find(t=>t.id===e);if(!n)return;b(e);let{w:r,h:i}=C.current,a=T.current,o=I.current,s=o!==null&&$l(a,o.applied)?o.restore:a,c=Qc(cl(n.window,r,i),r,i,E.current);F({sessionId:e,restore:t??s,applied:c}),P(c)},[P,b]),ce=O(e=>e.focusRequest);(0,_.useEffect)(()=>{if(ce){if(ce.alsoId){let e=ee.current.filter(e=>e.id===ce.sessionId||e.id===ce.alsoId);e.length>0&&(F(null),P(ol(e.map(e=>e.window),C.current.w,C.current.h)));return}se(ce.sessionId)}},[ce]);let le=(0,_.useCallback)(e=>{let t=I.current;if(t!==null&&t.sessionId===e&&$l(T.current,t.applied)){F(null),b(e),P(t.restore);return}se(e)},[se,P,b]),ue=(0,_.useRef)(null),de=(0,_.useCallback)(()=>{let e=ue.current;e&&(ue.current=null,e.timer!==null&&window.clearTimeout(e.timer))},[]),fe=(0,_.useCallback)(()=>{let e=ue.current;if(!e)return;ue.current=null,e.timer!==null&&window.clearTimeout(e.timer);let t=e.lastAt-e.startedAt,n=e.notch?ml({ratio:e.ratio,durationMs:t}):hl({ratio:e.ratio,durationMs:t,events:e.events});if(!n)return;let r=Gc(e.anchor,e.startViewport),i=ee.current,a=i.filter(e=>nl(e.window,r)).sort((e,t)=>e.window.z-t.window.z).at(-1);if(n===`in`){if(!a)return;se(a.id,e.startViewport);return}let o=a??eu(i,r),s=[o?ll(i.filter(e=>e.workspaceId===o.workspaceId).map(e=>e.window)):null,al(i.map(e=>e.window))].filter(e=>e!==null),{w:c,h:l}=C.current,u=gl(s,T.current,c,l);u&&(F(null),P(Qc(u,c,l,E.current)))},[se,P]),pe=(0,_.useCallback)((e,t,n)=>{let r=performance.now(),i=n?80:70,a=ue.current;if(a&&a.notch===n&&r-a.lastAt<=i){a.timer!==null&&window.clearTimeout(a.timer),a.lastAt=r,a.events+=1,a.ratio*=t,a.timer=window.setTimeout(fe,i);return}de(),ue.current={startedAt:r,lastAt:r,events:1,ratio:t,notch:n,anchor:e,startViewport:T.current,timer:window.setTimeout(fe,i)}},[de,fe]);(0,_.useEffect)(()=>()=>{re(),de()},[re,de]),(0,_.useEffect)(()=>{let t=e.current;if(!t)return;let n=e=>{let n=e.ctrlKey||e.metaKey,r=ul(o.current,{now:performance.now(),zooming:n,overTerminal:!!e.target?.closest?.(`.term-host, .note-text`)});if(o.current=r,!n&&r.owner===`terminal`)return;e.preventDefault(),e.stopPropagation(),D();let i=t.getBoundingClientRect(),a={x:e.clientX-i.left,y:e.clientY-i.top};if(n){let t=pl(e.deltaY,e.deltaMode);pe(a,t,dl(e.deltaY,e.deltaMode)),g(qc(h,a,h.zoom*t))}else de(),g({...h,panX:h.panX-e.deltaX,panY:h.panY-e.deltaY})},r={passive:!1,capture:!0};return t.addEventListener(`wheel`,n,r),()=>t.removeEventListener(`wheel`,n,r)},[h,g,D,pe,de]),(0,_.useEffect)(()=>{let e=e=>{if(O.getState().dialog)return;let n=e.target?.closest?.(`.term-host`),r=e.target?.closest?.(`textarea, input`);n||r||(e.key===`0`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),P({panX:0,panY:0,zoom:1})),e.key===`1`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),P(ol([...f.map(e=>e.window),...m],t.w,t.h))),e.key===`2`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),v&&le(v)),e.key===`Escape`&&(O.getState().panelOpen?S(!1):b(null)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[f,m,t,P,b,v,le,S]);let me=oe&&$l(h,oe.applied)?oe.sessionId:null,L=(0,_.useMemo)(()=>el(h,t.w,t.h),[h,t]),he=(0,_.useMemo)(()=>f.filter(e=>tl(L,e.window)),[f,L]),ge=(0,_.useMemo)(()=>m.filter(e=>tl(L,e)),[m,L]),_e=(0,_.useRef)(null),{groups:ve,wsBySession:ye}=(0,_.useMemo)(()=>{let e=[],t=new Map;for(let n of p){let r=Ac(n,f);for(let e of r)t.set(e.id,n);let i=ll(r.map(e=>e.window));i&&e.push({ws:n,box:i,sessionIds:r.map(e=>e.id)})}return{groups:e,wsBySession:t}},[p,f]);return(0,q.jsx)(`div`,{ref:e,className:`canvas${r?` panning`:``}`,onPointerDown:ae,onPointerMove:A,onPointerUp:j,onPointerCancel:j,onDoubleClick:M,children:(0,q.jsxs)(`div`,{className:`world${s?` interacting`:``}`,style:{transform:`translate(${h.panX}px, ${h.panY}px) scale(${h.zoom})`},children:[ve.map(e=>(0,q.jsx)(Jl,{ws:e.ws,box:e.box,sessionIds:e.sessionIds,zoom:h.zoom},e.ws.id)),(0,q.jsx)(ql,{sessions:f}),he.map(e=>(0,q.jsx)(Vl,{session:e,workspace:ye.get(e.id),zoom:h.zoom,dpr:u,renderScale:k,selected:v===e.id,maximized:me===e.id,onMaximize:le},e.id)),ge.map(e=>(0,q.jsx)(Gl,{note:e,zoom:h.zoom,selected:y===e.id,autoFocus:_e.current===e.id},e.id))]})})}var nu=`https://github.com/kdonev/termscape/issues/new`;function ru(e){let t=[`## What happened`,``,``,`## What I expected`,``,``,`## Steps to reproduce`,``,`1. `,``,`---`,``,`- termscape: ${e||`unknown`}`,`- browser: ${navigator.userAgent}`,``].join(`
|
|
107
|
+
}`)),this.register((0,i.toDisposable)((()=>l.deleteProgram(this._program)))),this._projectionLocation=(0,r.throwIfFalsy)(l.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=l.createVertexArray(),l.bindVertexArray(this._vertexArrayObject);let u=new Float32Array([0,0,1,0,0,1,1,1]),d=l.createBuffer();this.register((0,i.toDisposable)((()=>l.deleteBuffer(d)))),l.bindBuffer(l.ARRAY_BUFFER,d),l.bufferData(l.ARRAY_BUFFER,u,l.STATIC_DRAW),l.enableVertexAttribArray(3),l.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let f=new Uint8Array([0,1,2,3]),p=l.createBuffer();this.register((0,i.toDisposable)((()=>l.deleteBuffer(p)))),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,p),l.bufferData(l.ELEMENT_ARRAY_BUFFER,f,l.STATIC_DRAW),this._attributesBuffer=(0,r.throwIfFalsy)(l.createBuffer()),this.register((0,i.toDisposable)((()=>l.deleteBuffer(this._attributesBuffer)))),l.bindBuffer(l.ARRAY_BUFFER,this._attributesBuffer),l.enableVertexAttribArray(0),l.vertexAttribPointer(0,2,l.FLOAT,!1,s,0),l.vertexAttribDivisor(0,1),l.enableVertexAttribArray(1),l.vertexAttribPointer(1,2,l.FLOAT,!1,s,2*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(1,1),l.enableVertexAttribArray(2),l.vertexAttribPointer(2,4,l.FLOAT,!1,s,4*Float32Array.BYTES_PER_ELEMENT),l.vertexAttribDivisor(2,1),this._updateCachedColors(a.colors),this.register(this._themeService.onChangeColors((e=>{this._updateCachedColors(e),this._updateViewportRectangle()})))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,o.PROJECTION_MATRIX),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,r,i,o,s,c,l,u,d,f,p,m,h=1;for(r=0;r<t.rows;r++){for(o=-1,s=0,c=0,l=!1,i=0;i<t.cols;i++)u=(r*t.cols+i)*a.RENDER_MODEL_INDICIES_PER_CELL,d=e.cells[u+a.RENDER_MODEL_BG_OFFSET],f=e.cells[u+a.RENDER_MODEL_FG_OFFSET],p=!!(67108864&f),(d!==s||f!==c&&(l||p))&&((s!==0||l&&c!==0)&&(m=8*h++,this._updateRectangle(n,m,c,s,o,i,r)),o=i,s=d,c=f,l=p);(s!==0||l&&c!==0)&&(m=8*h++,this._updateRectangle(n,m,c,s,o,t.cols,r))}n.count=h}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style===`block`)return void(t.count=0);let r,i=0;n.style!==`bar`&&n.style!==`outline`||(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style===`bar`?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),n.style!==`underline`&&n.style!==`outline`||(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style===`outline`&&(r=8*i++,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),r=8*i++,this._addRectangleFloat(t.attributes,r,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=i}_updateRectangle(e,t,n,r,i,a,s){if(67108864&n)switch(50331648&n){case 16777216:case 33554432:l=this._themeService.colors.ansi[255&n].rgba;break;case 50331648:l=(16777215&n)<<8;break;default:l=this._themeService.colors.foreground.rgba}else switch(50331648&r){case 16777216:case 33554432:l=this._themeService.colors.ansi[255&r].rgba;break;case 50331648:l=(16777215&r)<<8;break;default:l=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=(0,o.expandFloat32Array)(e.attributes,this._terminal.rows*this._terminal.cols*8)),u=i*this._dimensions.device.cell.width,d=s*this._dimensions.device.cell.height,f=(l>>24&255)/255,p=(l>>16&255)/255,m=(l>>8&255)/255,h=1,this._addRectangle(e.attributes,t,u,d,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,f,p,m,h)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(255&e.rgba)/255])}}t.RectangleRenderer=g},310:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderModel=t.COMBINED_CHAR_BIT_MASK=t.RENDER_MODEL_EXT_OFFSET=t.RENDER_MODEL_FG_OFFSET=t.RENDER_MODEL_BG_OFFSET=t.RENDER_MODEL_INDICIES_PER_CELL=void 0;let r=n(296);t.RENDER_MODEL_INDICIES_PER_CELL=4,t.RENDER_MODEL_BG_OFFSET=1,t.RENDER_MODEL_FG_OFFSET=2,t.RENDER_MODEL_EXT_OFFSET=3,t.COMBINED_CHAR_BIT_MASK=2147483648,t.RenderModel=class{constructor(){this.cells=new Uint32Array,this.lineLengths=new Uint32Array,this.selection=(0,r.createSelectionRenderModel)()}resize(e,n){let r=e*n*t.RENDER_MODEL_INDICIES_PER_CELL;r!==this.cells.length&&(this.cells=new Uint32Array(r),this.lineLengths=new Uint32Array(n))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;let r=n(820),i=n(274),a=n(627),o=n(457),s=n(56),c=n(374),l=n(345),u=n(859),d=n(147),f=n(782),p=n(855),m=n(965),h=n(742),g=n(310),_=n(733);class v extends u.Disposable{constructor(e,t,n,o,d,p,m,h,v){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=o,this._coreService=d,this._decorationService=p,this._optionsService=m,this._themeService=h,this._cursorBlinkStateManager=new u.MutableDisposable,this._charAtlasDisposable=this.register(new u.MutableDisposable),this._observerDisposable=this.register(new u.MutableDisposable),this._model=new g.RenderModel,this._workCell=new f.CellData,this._workCell2=new f.CellData,this._rectangleRenderer=this.register(new u.MutableDisposable),this._glyphRenderer=this.register(new u.MutableDisposable),this._onChangeTextureAtlas=this.register(new l.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new l.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new l.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new l.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new l.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors((()=>this._handleColorChange()))),this._cellColorResolver=new i.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new _.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,m,this._themeService)],this.dimensions=(0,c.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(m.onOptionChange((()=>this._handleOptionsChanged()))),this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let y={antialias:!1,depth:!1,preserveDrawingBuffer:v};if(this._gl=this._canvas.getContext(`webgl2`,y),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this.register((0,r.addDisposableDomListener)(this._canvas,`webglcontextlost`,(e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout((()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)}),3e3)}))),this.register((0,r.addDisposableDomListener)(this._canvas,`webglcontextrestored`,(e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,a.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()}))),this._observerDisposable.value=(0,s.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,((e,t)=>this._setCanvasDevicePixelDimensions(e,t))),this.register(this._coreBrowserService.onWindowChange((e=>{this._observerDisposable.value=(0,s.observeDevicePixelDimensions)(this._canvas,e,((e,t)=>this._setCanvasDevicePixelDimensions(e,t)))}))),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,u.toDisposable)((()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),(0,a.removeTerminalFromCache)(this._terminal)})))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let e of this._renderLayers)e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new h.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new m.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);let e=(0,a.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=(0,u.getDisposeArrayDisposable)([(0,l.forwardEvent)(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,l.forwardEvent)(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(e){return-1}deregisterCharacterJoiner(e){return!1}renderRows(e,t){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(let n of this._renderLayers)n.handleGridChanged(this._terminal,e,t);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new o.CursorBlinkStateManager((()=>{this._requestRedrawCursor()}),this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r,i,a,o,s,c,l,u,d,f,m,h,_,v,x=this._workCell;e=b(e,n.rows-1,0),t=b(t,n.rows-1,0);let S=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,C=S-n.buffer.ydisp,w=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),T=-1,ee=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let E=!1;for(i=e;i<=t;i++)for(a=i+n.buffer.ydisp,o=n.buffer.lines.get(a),this._model.lineLengths[i]=0,s=this._characterJoinerService.getJoinedCharacters(a),_=0;_<n.cols;_++)if(r=this._cellColorResolver.result.bg,o.loadCell(_,x),_===0&&(r=this._cellColorResolver.result.bg),c=!1,l=_,s.length>0&&_===s[0][0]&&(c=!0,u=s.shift(),x=new y(x,o.translateToString(!0,u[0],u[1]),u[1]-u[0]),l=u[1]-1),d=x.getChars(),f=x.getCode(),h=(i*n.cols+_)*g.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(x,_,a,this.dimensions.device.cell.width),ee&&a===S&&(_===w&&(this._model.cursor={x:w,y:C,width:x.getWidth(),style:this._coreBrowserService.isFocused?n.options.cursorStyle||`block`:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},T=w+x.getWidth()-1),_>=w&&_<=T&&(this._coreBrowserService.isFocused&&(n.options.cursorStyle||`block`)===`block`||!1===this._coreBrowserService.isFocused&&n.options.cursorInactiveStyle===`block`)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),f!==p.NULL_CELL_CODE&&(this._model.lineLengths[i]=_+1),(this._model.cells[h]!==f||this._model.cells[h+g.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[h+g.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[h+g.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(E=!0,d.length>1&&(f|=g.COMBINED_CHAR_BIT_MASK),this._model.cells[h]=f,this._model.cells[h+g.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[h+g.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[h+g.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,m=x.getWidth(),this._glyphRenderer.value.updateCell(_,i,f,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,d,m,r),c))for(x=this._workCell,_++;_<l;_++)v=(i*n.cols+_)*g.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(_,i,p.NULL_CELL_CODE,0,0,0,p.NULL_CELL_CHAR,0,0),this._model.cells[v]=p.NULL_CELL_CODE,this._model.cells[v+g.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[v+g.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[v+g.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;E&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}}t.WebglRenderer=v;class y extends d.AttributeData{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function b(e,t,n=0){return Math.max(Math.min(e,t),n)}t.JoinedCellData=y},381:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GLTexture=t.expandFloat32Array=t.createShader=t.createProgram=t.PROJECTION_MATRIX=void 0;let r=n(374);function i(e,t,n){let i=(0,r.throwIfFalsy)(e.createShader(t));if(e.shaderSource(i,n),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS))return i;console.error(e.getShaderInfoLog(i)),e.deleteShader(i)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(e,t,n){let a=(0,r.throwIfFalsy)(e.createProgram());if(e.attachShader(a,(0,r.throwIfFalsy)(i(e,e.VERTEX_SHADER,t))),e.attachShader(a,(0,r.throwIfFalsy)(i(e,e.FRAGMENT_SHADER,n))),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS))return a;console.error(e.getProgramInfoLog(a)),e.deleteProgram(a)},t.createShader=i,t.expandFloat32Array=function(e,t){let n=Math.min(2*e.length,t),r=new Float32Array(n);for(let t=0;t<e.length;t++)r[t]=e[t];return r},t.GLTexture=class{constructor(e){this.texture=e,this.version=-1}}},592:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;let r=n(627),i=n(237),a=n(374),o=n(859);class s extends o.Disposable{constructor(e,t,n,r,i,a,s,c){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=s,this._themeService=c,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors((t=>{this._refreshCharAtlas(e,t),this.reset(e)}))),this.register((0,o.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,a.throwIfFalsy)(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,r.acquireTextureAtlas)(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=i.TEXT_BASELINE,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){return`${n?`italic`:``} ${t?e.options.fontWeightBold:e.options.fontWeight} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}}t.BaseRenderLayer=s},733:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;let r=n(197),i=n(237),a=n(592);class o extends a.BaseRenderLayer{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this.register(r.onShowLinkUnderline((e=>this._handleShowLinkUnderline(e)))),this.register(r.onHideLinkUnderline((e=>this._handleHideLinkUnderline(e))))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===i.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&(0,r.is256Color)(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}}t.LinkRenderLayer=o},820:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,n,r){e.addEventListener(t,n,r);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,n,r))}}}},274:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;let r=n(855),i=n(160),a=n(374),o,s=0,c=0,l=!1,u=!1,d=!1,f=0;t.CellColorResolver=class{constructor(e,t,n,r,i,a){this._terminal=e,this._optionService=t,this._selectionRenderModel=n,this._decorationService=r,this._coreBrowserService=i,this._themeService=a,this.result={fg:0,bg:0,ext:0}}resolve(e,t,n,p){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=268435456&e.bg?e.extended.ext:0,c=0,s=0,u=!1,l=!1,d=!1,o=this._themeService.colors,f=0,e.getCode()!==r.NULL_CELL_CODE&&e.extended.underlineStyle===4){let e=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));f=t*p%(2*Math.round(e))}if(this._decorationService.forEachDecorationAtCell(t,n,`bottom`,(e=>{e.backgroundColorRGB&&(c=e.backgroundColorRGB.rgba>>8&16777215,u=!0),e.foregroundColorRGB&&(s=e.foregroundColorRGB.rgba>>8&16777215,l=!0)})),d=this._selectionRenderModel.isCellSelected(this._terminal,t,n),d){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:c=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:c=(16777215&this.result.fg)<<8|255;break;default:c=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:c=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:c=(16777215&this.result.bg)<<8|255}c=i.rgba.blend(c,4294967040&(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else c=(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(u=!0,o.selectionForeground&&(s=o.selectionForeground.rgba>>8&16777215,l=!0),(0,a.treatGlyphAsBackgroundColor)(e.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))s=(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:s=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:s=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:s=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:s=(16777215&this.result.fg)<<8|255;break;default:s=this._themeService.colors.foreground.rgba}s=i.rgba.blend(s,4294967040&(this._coreBrowserService.isFocused?o.selectionBackgroundOpaque:o.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}l=!0}}this._decorationService.forEachDecorationAtCell(t,n,`top`,(e=>{e.backgroundColorRGB&&(c=e.backgroundColorRGB.rgba>>8&16777215,u=!0),e.foregroundColorRGB&&(s=e.foregroundColorRGB.rgba>>8&16777215,l=!0)})),u&&(c=d?e.bg&-150994944|c|50331648:-16777216&e.bg|c|50331648),l&&(s=e.fg&-83886080|s|50331648),67108864&this.result.fg&&(u&&!l&&(s=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&o.background.rgba>>8|50331648,l=!0),!u&&l&&(c=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&o.foreground.rgba>>8|50331648,u=!0)),o=void 0,this.result.bg=u?c:this.result.bg,this.result.fg=l?s:this.result.fg,this.result.ext&=536870911,this.result.ext|=f<<29&3758096384}}},627:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;let r=n(509),i=n(197),a=[];t.acquireTextureAtlas=function(e,t,n,o,s,c,l,u){let d=(0,i.generateConfig)(o,s,c,l,t,n,u);for(let t=0;t<a.length;t++){let n=a[t],r=n.ownedBy.indexOf(e);if(r>=0){if((0,i.configEquals)(n.config,d))return n.atlas;n.ownedBy.length===1?(n.atlas.dispose(),a.splice(t,1)):n.ownedBy.splice(r,1);break}}for(let t=0;t<a.length;t++){let n=a[t];if((0,i.configEquals)(n.config,d))return n.ownedBy.push(e),n.atlas}let f=e._core,p={atlas:new r.TextureAtlas(document,d,f.unicodeService),config:d,ownedBy:[e]};return a.push(p),p.atlas},t.removeTerminalFromCache=function(e){for(let t=0;t<a.length;t++){let n=a[t].ownedBy.indexOf(e);if(n!==-1){a[t].ownedBy.length===1?(a[t].atlas.dispose(),a.splice(t,1)):a[t].ownedBy.splice(n,1);break}}}},197:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;let r=n(160);t.generateConfig=function(e,t,n,i,a,o,s){let c={foreground:o.foreground,background:o.background,cursor:r.NULL_COLOR,cursorAccent:r.NULL_COLOR,selectionForeground:r.NULL_COLOR,selectionBackgroundTransparent:r.NULL_COLOR,selectionBackgroundOpaque:r.NULL_COLOR,selectionInactiveBackgroundTransparent:r.NULL_COLOR,selectionInactiveBackgroundOpaque:r.NULL_COLOR,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:a.customGlyphs,devicePixelRatio:s,letterSpacing:a.letterSpacing,lineHeight:a.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:n,deviceCharHeight:i,fontFamily:a.fontFamily,fontSize:a.fontSize,fontWeight:a.fontWeight,fontWeightBold:a.fontWeightBold,allowTransparency:a.allowTransparency,drawBoldTextInBrightColors:a.drawBoldTextInBrightColors,minimumContrastRatio:a.minimumContrastRatio,colors:c}},t.configEquals=function(e,t){for(let n=0;n<e.colors.ansi.length;n++)if(e.colors.ansi[n].rgba!==t.colors.ansi[n].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba},t.is256Color=function(e){return(50331648&e)==16777216||(50331648&e)==33554432}},237:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;let r=n(399);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=r.isFirefox||r.isLegacyEdge?`bottom`:`ideographic`},457:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorBlinkStateManager=void 0,t.CursorBlinkStateManager=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=600){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout((()=>{if(this._animationTimeRestarted){let e=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0)return void this._restartInterval(e)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})),this._blinkInterval=this._coreBrowserService.window.setInterval((()=>{if(this._animationTimeRestarted){let e=600-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))}),600)}),e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;let r=n(374);t.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};let i={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};t.boxDrawingDefinitions={"─":{1:`M0,.5 L1,.5`},"━":{3:`M0,.5 L1,.5`},"│":{1:`M.5,0 L.5,1`},"┃":{3:`M.5,0 L.5,1`},"┌":{1:`M0.5,1 L.5,.5 L1,.5`},"┏":{3:`M0.5,1 L.5,.5 L1,.5`},"┐":{1:`M0,.5 L.5,.5 L.5,1`},"┓":{3:`M0,.5 L.5,.5 L.5,1`},"└":{1:`M.5,0 L.5,.5 L1,.5`},"┗":{3:`M.5,0 L.5,.5 L1,.5`},"┘":{1:`M.5,0 L.5,.5 L0,.5`},"┛":{3:`M.5,0 L.5,.5 L0,.5`},"├":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┣":{3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"┤":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┫":{3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"┬":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┳":{3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"┴":{1:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┻":{3:`M0,.5 L1,.5 M.5,.5 L.5,0`},"┼":{1:`M0,.5 L1,.5 M.5,0 L.5,1`},"╋":{3:`M0,.5 L1,.5 M.5,0 L.5,1`},"╴":{1:`M.5,.5 L0,.5`},"╸":{3:`M.5,.5 L0,.5`},"╵":{1:`M.5,.5 L.5,0`},"╹":{3:`M.5,.5 L.5,0`},"╶":{1:`M.5,.5 L1,.5`},"╺":{3:`M.5,.5 L1,.5`},"╷":{1:`M.5,.5 L.5,1`},"╻":{3:`M.5,.5 L.5,1`},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:`M1,0 L0,1`},"╲":{1:`M0,0 L1,1`},"╳":{1:`M1,0 L0,1 M0,0 L1,1`},"╼":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"╽":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L.5,1`},"╾":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"╿":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┍":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┎":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┑":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L0,.5`},"┒":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┕":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L1,.5`},"┖":{1:`M.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┙":{1:`M.5,.5 L.5,0`,3:`M.5,.5 L0,.5`},"┚":{1:`M.5,.5 L0,.5`,3:`M.5,.5 L.5,0`},"┝":{1:`M.5,0 L.5,1`,3:`M.5,.5 L1,.5`},"┞":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┟":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┠":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1`},"┡":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"┢":{1:`M.5,.5 L.5,0`,3:`M0.5,1 L.5,.5 L1,.5`},"┥":{1:`M.5,0 L.5,1`,3:`M.5,.5 L0,.5`},"┦":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"┧":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L.5,1`},"┨":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1`},"┩":{1:`M.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L0,.5`},"┪":{1:`M.5,.5 L.5,0`,3:`M0,.5 L.5,.5 L.5,1`},"┭":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┮":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,.5 L1,.5`},"┯":{1:`M.5,.5 L.5,1`,3:`M0,.5 L1,.5`},"┰":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"┱":{1:`M.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"┲":{1:`M.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"┵":{1:`M.5,0 L.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┶":{1:`M.5,0 L.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┷":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5`},"┸":{1:`M0,.5 L1,.5`,3:`M.5,.5 L.5,0`},"┹":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"┺":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,.5 L1,.5`},"┽":{1:`M.5,0 L.5,1 M.5,.5 L1,.5`,3:`M.5,.5 L0,.5`},"┾":{1:`M.5,0 L.5,1 M.5,.5 L0,.5`,3:`M.5,.5 L1,.5`},"┿":{1:`M.5,0 L.5,1`,3:`M0,.5 L1,.5`},"╀":{1:`M0,.5 L1,.5 M.5,.5 L.5,1`,3:`M.5,.5 L.5,0`},"╁":{1:`M.5,.5 L.5,0 M0,.5 L1,.5`,3:`M.5,.5 L.5,1`},"╂":{1:`M0,.5 L1,.5`,3:`M.5,0 L.5,1`},"╃":{1:`M0.5,1 L.5,.5 L1,.5`,3:`M.5,0 L.5,.5 L0,.5`},"╄":{1:`M0,.5 L.5,.5 L.5,1`,3:`M.5,0 L.5,.5 L1,.5`},"╅":{1:`M.5,0 L.5,.5 L1,.5`,3:`M0,.5 L.5,.5 L.5,1`},"╆":{1:`M.5,0 L.5,.5 L0,.5`,3:`M0.5,1 L.5,.5 L1,.5`},"╇":{1:`M.5,.5 L.5,1`,3:`M.5,.5 L.5,0 M0,.5 L1,.5`},"╈":{1:`M.5,.5 L.5,0`,3:`M0,.5 L1,.5 M.5,.5 L.5,1`},"╉":{1:`M.5,.5 L1,.5`,3:`M.5,0 L.5,1 M.5,.5 L0,.5`},"╊":{1:`M.5,.5 L0,.5`,3:`M.5,0 L.5,1 M.5,.5 L1,.5`},"╌":{1:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"╍":{3:`M.1,.5 L.4,.5 M.6,.5 L.9,.5`},"┄":{1:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┅":{3:`M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5`},"┈":{1:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"┉":{3:`M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5`},"╎":{1:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"╏":{3:`M.5,.1 L.5,.4 M.5,.6 L.5,.9`},"┆":{1:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┇":{3:`M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333`},"┊":{1:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"┋":{3:`M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95`},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},t.powerlineDefinitions={"":{d:`M0,0 L1,.5 L0,1`,type:0,rightPadding:2},"":{d:`M-1,-.5 L1,.5 L-1,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1,0 L0,.5 L1,1`,type:0,leftPadding:2},"":{d:`M2,-.5 L0,.5 L2,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0`,type:0,rightPadding:1},"":{d:`M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0`,type:1,rightPadding:1},"":{d:`M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0`,type:0,leftPadding:1},"":{d:`M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0`,type:1,leftPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L-.5,1.5`,type:0},"":{d:`M-.5,-.5 L1.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M1.5,-.5 L-.5,1.5 L1.5,1.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5 L-.5,-.5`,type:0},"":{d:`M1.5,-.5 L-.5,1.5`,type:1,leftPadding:1,rightPadding:1},"":{d:`M-.5,-.5 L1.5,1.5 L1.5,-.5`,type:0}},t.powerlineDefinitions[``]=t.powerlineDefinitions[``],t.powerlineDefinitions[``]=t.powerlineDefinitions[``],t.tryDrawCustomChar=function(e,n,o,l,u,d,f,p){let m=t.blockElementDefinitions[n];if(m)return function(e,t,n,r,i,a){for(let o=0;o<t.length;o++){let s=t[o],c=i/8,l=a/8;e.fillRect(n+s.x*c,r+s.y*l,s.w*c,s.h*l)}}(e,m,o,l,u,d),!0;let h=i[n];if(h)return function(e,t,n,i,o,s){let c=a.get(t);c||(c=new Map,a.set(t,c));let l=e.fillStyle;if(typeof l!=`string`)throw Error(`Unexpected fillStyle type "${l}"`);let u=c.get(l);if(!u){let n=t[0].length,i=t.length,a=e.canvas.ownerDocument.createElement(`canvas`);a.width=n,a.height=i;let o=(0,r.throwIfFalsy)(a.getContext(`2d`)),s=new ImageData(n,i),d,f,p,m;if(l.startsWith(`#`))d=parseInt(l.slice(1,3),16),f=parseInt(l.slice(3,5),16),p=parseInt(l.slice(5,7),16),m=l.length>7&&parseInt(l.slice(7,9),16)||1;else{if(!l.startsWith(`rgba`))throw Error(`Unexpected fillStyle color format "${l}" when drawing pattern glyph`);[d,f,p,m]=l.substring(5,l.length-1).split(`,`).map((e=>parseFloat(e)))}for(let e=0;e<i;e++)for(let r=0;r<n;r++)s.data[4*(e*n+r)]=d,s.data[4*(e*n+r)+1]=f,s.data[4*(e*n+r)+2]=p,s.data[4*(e*n+r)+3]=t[e][r]*(255*m);o.putImageData(s,0,0),u=(0,r.throwIfFalsy)(e.createPattern(a,null)),c.set(l,u)}e.fillStyle=u,e.fillRect(n,i,o,s)}(e,h,o,l,u,d),!0;let g=t.boxDrawingDefinitions[n];if(g)return function(e,t,n,r,i,a,o){e.strokeStyle=e.fillStyle;for(let[l,u]of Object.entries(t)){let t;e.beginPath(),e.lineWidth=o*Number.parseInt(l),t=typeof u==`function`?u(.15,.15/a*i):u;for(let l of t.split(` `)){let t=l[0],u=s[t];if(!u){console.error(`Could not find drawing instructions for "${t}"`);continue}let d=l.substring(1).split(`,`);d[0]&&d[1]&&u(e,c(d,i,a,n,r,!0,o))}e.stroke(),e.closePath()}}(e,g,o,l,u,d,p),!0;let _=t.powerlineDefinitions[n];return!!_&&(function(e,t,n,r,i,a,o,l){let u=new Path2D;u.rect(n,r,i,a),e.clip(u),e.beginPath();let d=o/12;e.lineWidth=l*d;for(let o of t.d.split(` `)){let u=o[0],f=s[u];if(!f){console.error(`Could not find drawing instructions for "${u}"`);continue}let p=o.substring(1).split(`,`);p[0]&&p[1]&&f(e,c(p,i,a,n,r,!1,l,(t.leftPadding??0)*(d/2),(t.rightPadding??0)*(d/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}(e,_,o,l,u,d,f,p),!0)};let a=new Map;function o(e,t,n=0){return Math.max(Math.min(e,t),n)}let s={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function c(e,t,n,r,i,a,s,c=0,l=0){let u=e.map((e=>parseFloat(e)||parseInt(e)));if(u.length<2)throw Error(`Too few arguments for instruction`);for(let e=0;e<u.length;e+=2)u[e]*=t-c*s-l*s,a&&u[e]!==0&&(u[e]=o(Math.round(u[e]+.5)-.5,t,0)),u[e]+=r+c*s;for(let e=1;e<u.length;e+=2)u[e]*=n,a&&u[e]!==0&&(u[e]=o(Math.round(u[e]+.5)-.5,n,0)),u[e]+=i;return u}},56:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;let r=n(859);t.observeDevicePixelDimensions=function(e,t,n){let i=new t.ResizeObserver((t=>{let r=t.find((t=>t.target===e));if(!r)return;if(!(`devicePixelContentBoxSize`in r))return i?.disconnect(),void(i=void 0);let a=r.devicePixelContentBoxSize[0].inlineSize,o=r.devicePixelContentBoxSize[0].blockSize;a>0&&o>0&&n(a,o)}));try{i.observe(e,{box:[`device-pixel-content-box`]})}catch{i.disconnect(),i=void 0}return(0,r.toDisposable)((()=>i?.disconnect()))}},374:(e,t)=>{function n(e){return 57508<=e&&e<=57558}function r(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw Error(`value must not be falsy`);return e},t.isPowerlineGlyph=n,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.isEmoji=r,t.allowRescaling=function(e,t,i,a){return t===1&&i>Math.ceil(1.5*a)&&e!==void 0&&e>255&&!r(e)&&!n(e)&&!function(e){return 57344<=e&&e<=63743}(e)},t.treatGlyphAsBackgroundColor=function(e){return n(e)||function(e){return 9472<=e&&e<=9631}(e)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(e,t,n=0){return(e-(2*Math.round(t)-n))%(2*Math.round(t))}},296:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class n{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1])return void this.clear();let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);s>=e.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0])}isCellSelected(e,t,n){return!!this.hasSelection&&(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol)}}t.createSelectionRenderModel=function(){return new n}},509:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;let r=n(237),i=n(860),a=n(374),o=n(160),s=n(345),c=n(485),l=n(385),u=n(147),d=n(855),f={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},p;class m{get pages(){return this._pages}constructor(e,t,n){this._document=e,this._config=t,this._unicodeService=n,this._didWarmUp=!1,this._cacheMap=new c.FourKeyMap,this._cacheMapCombined=new c.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new u.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new s.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new s.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=_(e,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,a.throwIfFalsy)(this._tmpCanvas.getContext(`2d`,{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||=(this._doWarmUp(),!0)}_doWarmUp(){let e=new l.IdleTaskQueue;for(let t=33;t<126;t++)e.enqueue((()=>{if(!this._cacheMap.get(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT)){let e=this._drawToCache(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT);this._cacheMap.set(t,d.DEFAULT_COLOR,d.DEFAULT_COLOR,d.DEFAULT_EXT,e)}}))}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(m.maxAtlasPages&&this._pages.length>=Math.max(4,m.maxAtlasPages)){let e=this._pages.filter((e=>2*e.canvas.width<=(m.maxTextureSize||4096))).sort(((e,t)=>t.canvas.width===e.canvas.width?t.percentageUsed-e.percentageUsed:t.canvas.width-e.canvas.width)),t=-1,n=0;for(let r=0;r<e.length;r++)if(e[r].canvas.width!==n)t=r,n=e[r].canvas.width;else if(r-t==3)break;let r=e.slice(t,t+4),i=r.map((e=>e.glyphs[0].texturePage)).sort(((e,t)=>e>t?1:-1)),a=this.pages.length-r.length,o=this._mergePages(r,a);o.version++;for(let e=i.length-1;e>=0;e--)this._deletePage(i[e]);this.pages.push(o),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(o.canvas)}let e=new h(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,t){let n=2*e[0].canvas.width,r=new h(this._document,n,e);for(let[i,a]of e.entries()){let e=i*a.canvas.width%n,o=Math.floor(i/2)*a.canvas.height;r.ctx.drawImage(a.canvas,e,o);for(let r of a.glyphs)r.texturePage=t,r.sizeClipSpace.x=r.size.x/n,r.sizeClipSpace.y=r.size.y/n,r.texturePosition.x+=e,r.texturePosition.y+=o,r.texturePositionClipSpace.x=r.texturePosition.x/n,r.texturePositionClipSpace.y=r.texturePosition.y/n;this._onRemoveTextureAtlasCanvas.fire(a.canvas);let s=this._activePages.indexOf(a);s!==-1&&this._activePages.splice(s,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let t=e;t<this._pages.length;t++){let e=this._pages[t];for(let t of e.glyphs)t.texturePage--;e.version++}}getRasterizedGlyphCombinedChar(e,t,n,r,i){return this._getFromCacheMap(this._cacheMapCombined,e,t,n,r,i)}getRasterizedGlyph(e,t,n,r,i){return this._getFromCacheMap(this._cacheMap,e,t,n,r,i)}_getFromCacheMap(e,t,n,r,i,a=!1){return p=e.get(t,n,r,i),p||(p=this._drawToCache(t,n,r,i,a),e.set(t,n,r,i,p)),p}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw Error(`No color found for idx `+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,n,r){if(this._config.allowTransparency)return o.NULL_COLOR;let i;switch(e){case 16777216:case 33554432:i=this._getColorFromAnsiIndex(t);break;case 50331648:let e=u.AttributeData.toColorRGB(t);i=o.channels.toColor(e[0],e[1],e[2]);break;default:i=n?o.color.opaque(this._config.colors.foreground):this._config.colors.background}return i}_getForegroundColor(e,t,n,i,a,s,c,l,d,f){let p=this._getMinimumContrastColor(e,t,n,i,a,s,c,d,l,f);if(p)return p;let m;switch(a){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&d&&s<8&&(s+=8),m=this._getColorFromAnsiIndex(s);break;case 50331648:let e=u.AttributeData.toColorRGB(s);m=o.channels.toColor(e[0],e[1],e[2]);break;default:m=c?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(m=o.color.opaque(m)),l&&(m=o.color.multiplyOpacity(m,r.DIM_OPACITY)),m}_resolveBackgroundRgba(e,t,n){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,n,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,n,r,i,a,s,c,l,u){if(this._config.minimumContrastRatio===1||u)return;let d=this._getContrastCache(l),f=d.getColor(e,r);if(f!==void 0)return f||void 0;let p=this._resolveBackgroundRgba(t,n,s),m=this._resolveForegroundRgba(i,a,s,c),h=o.rgba.ensureContrastRatio(p,m,this._config.minimumContrastRatio/(l?2:1));if(!h)return void d.setColor(e,r,null);let g=o.channels.toColor(h>>24&255,h>>16&255,h>>8&255);return d.setColor(e,r,g),g}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,t,n,o,s=!1){let c=typeof e==`number`?String.fromCharCode(e):e,l=Math.min(this._config.deviceCellWidth*Math.max(c.length,2)+4,this._textureSize);this._tmpCanvas.width<l&&(this._tmpCanvas.width=l);let d=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<d&&(this._tmpCanvas.height=d),this._tmpCtx.save(),this._workAttributeData.fg=n,this._workAttributeData.bg=t,this._workAttributeData.extended.ext=o,this._workAttributeData.isInvisible())return f;let p=!!this._workAttributeData.isBold(),h=!!this._workAttributeData.isInverse(),_=!!this._workAttributeData.isDim(),v=!!this._workAttributeData.isItalic(),y=!!this._workAttributeData.isUnderline(),b=!!this._workAttributeData.isStrikethrough(),x=!!this._workAttributeData.isOverline(),S=this._workAttributeData.getFgColor(),C=this._workAttributeData.getFgColorMode(),w=this._workAttributeData.getBgColor(),T=this._workAttributeData.getBgColorMode();if(h){let e=S;S=w,w=e;let t=C;C=T,T=t}let ee=this._getBackgroundColor(T,w,h,_);this._tmpCtx.globalCompositeOperation=`copy`,this._tmpCtx.fillStyle=ee.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation=`source-over`;let E=p?this._config.fontWeightBold:this._config.fontWeight,te=v?`italic`:``;this._tmpCtx.font=`${te} ${E} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=r.TEXT_BASELINE;let ne=c.length===1&&(0,a.isPowerlineGlyph)(c.charCodeAt(0)),re=c.length===1&&(0,a.isRestrictedPowerlineGlyph)(c.charCodeAt(0)),D=this._getForegroundColor(t,T,w,n,C,S,h,_,p,(0,a.treatGlyphAsBackgroundColor)(c.charCodeAt(0)));this._tmpCtx.fillStyle=D.css;let O=re?0:4,k=!1;!1!==this._config.customGlyphs&&(k=(0,i.tryDrawCustomChar)(this._tmpCtx,c,O,O,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let ie,ae=!ne;if(ie=typeof e==`number`?this._unicodeService.wcwidth(e):this._unicodeService.getStringCellWidth(e),y){this._tmpCtx.save();let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;if(this._tmpCtx.lineWidth=e,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())ae=!1,this._tmpCtx.strokeStyle=`rgb(${u.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(`,`)})`;else{ae=!1;let e=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&e<8&&(e+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(e).css}this._tmpCtx.beginPath();let n=O,r=Math.ceil(O+this._config.deviceCharHeight)-t-(s?2*e:0),i=r+e,o=r+2*e,l=this._workAttributeData.getUnderlineVariantOffset();for(let s=0;s<ie;s++){this._tmpCtx.save();let c=n+s*this._config.deviceCellWidth,u=n+(s+1)*this._config.deviceCellWidth,d=c+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r),this._tmpCtx.moveTo(c,o),this._tmpCtx.lineTo(u,o);break;case 3:let n=e<=1?o:Math.ceil(O+this._config.deviceCharHeight-e/2)-t,s=e<=1?r:Math.ceil(O+this._config.deviceCharHeight+e/2)-t,f=new Path2D;f.rect(c,r,this._config.deviceCellWidth,o-r),this._tmpCtx.clip(f),this._tmpCtx.moveTo(c-this._config.deviceCellWidth/2,i),this._tmpCtx.bezierCurveTo(c-this._config.deviceCellWidth/2,s,c,s,c,i),this._tmpCtx.bezierCurveTo(c,n,d,n,d,i),this._tmpCtx.bezierCurveTo(d,s,u,s,u,i),this._tmpCtx.bezierCurveTo(u,n,u+this._config.deviceCellWidth/2,n,u+this._config.deviceCellWidth/2,i);break;case 4:let p=l===0?0:l>=e?2*e-l:e-l;!(l>=e)==0||p===0?(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(c+p,r),this._tmpCtx.lineTo(u,r)):(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(c+p,r),this._tmpCtx.moveTo(c+p+e,r),this._tmpCtx.lineTo(u,r)),l=(0,a.computeNextVariantOffset)(u-c,e,l);break;case 5:let m=u-c,h=Math.floor(.6*m),g=Math.floor(.3*m),_=m-h-g;this._tmpCtx.setLineDash([h,g,_]),this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r);break;default:this._tmpCtx.moveTo(c,r),this._tmpCtx.lineTo(u,r)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!k&&this._config.fontSize>=12&&!this._config.allowTransparency&&c!==` `){this._tmpCtx.save(),this._tmpCtx.textBaseline=`alphabetic`;let t=this._tmpCtx.measureText(c);if(this._tmpCtx.restore(),`actualBoundingBoxDescent`in t&&t.actualBoundingBoxDescent>0){this._tmpCtx.save();let t=new Path2D;t.rect(n,r-Math.ceil(e/2),this._config.deviceCellWidth*ie,o-r+Math.ceil(e/2)),this._tmpCtx.clip(t),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=ee.css,this._tmpCtx.strokeText(c,O,O+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(x){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(O,O+t),this._tmpCtx.lineTo(O+this._config.deviceCharWidth*ie,O+t),this._tmpCtx.stroke()}if(k||this._tmpCtx.fillText(c,O,O+this._config.deviceCharHeight),c===`_`&&!this._config.allowTransparency){let e=g(this._tmpCtx.getImageData(O,O,this._config.deviceCellWidth,this._config.deviceCellHeight),ee,D,ae);if(e)for(let t=1;t<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=ee.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(c,O,O+this._config.deviceCharHeight-t),e=g(this._tmpCtx.getImageData(O,O,this._config.deviceCellWidth,this._config.deviceCellHeight),ee,D,ae),e);t++);}if(b){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),t=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(O,O+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.lineTo(O+this._config.deviceCharWidth*ie,O+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.stroke()}this._tmpCtx.restore();let A=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),j;if(j=this._config.allowTransparency?function(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}(A):g(A,ee,D,ae),j)return f;let M=this._findGlyphBoundingBox(A,this._workBoundingBox,l,re,k,O),N,P;for(;;){if(this._activePages.length===0){let e=this._createNewPage();N=e,P=e.currentRow,P.height=M.size.y;break}N=this._activePages[this._activePages.length-1],P=N.currentRow;for(let e of this._activePages)M.size.y<=e.currentRow.height&&(N=e,P=e.currentRow);for(let e=this._activePages.length-1;e>=0;e--)for(let t of this._activePages[e].fixedRows)t.height<=P.height&&M.size.y<=t.height&&(N=this._activePages[e],P=t);if(P.y+M.size.y>=N.canvas.height||P.height>M.size.y+2){let e=!1;if(N.currentRow.y+N.currentRow.height+M.size.y>=N.canvas.height){let t;for(let e of this._activePages)if(e.currentRow.y+e.currentRow.height+M.size.y<e.canvas.height){t=e;break}if(t)N=t;else if(m.maxAtlasPages&&this._pages.length>=m.maxAtlasPages&&P.y+M.size.y<=N.canvas.height&&P.height>=M.size.y&&P.x+M.size.x<=N.canvas.width)e=!0;else{let t=this._createNewPage();N=t,P=t.currentRow,P.height=M.size.y,e=!0}}e||(N.currentRow.height>0&&N.fixedRows.push(N.currentRow),P={x:0,y:N.currentRow.y+N.currentRow.height,height:M.size.y},N.fixedRows.push(P),N.currentRow={x:0,y:P.y+P.height,height:0})}if(P.x+M.size.x<=N.canvas.width)break;P===N.currentRow?(P.x=0,P.y+=P.height,P.height=0):N.fixedRows.splice(N.fixedRows.indexOf(P),1)}return M.texturePage=this._pages.indexOf(N),M.texturePosition.x=P.x,M.texturePosition.y=P.y,M.texturePositionClipSpace.x=P.x/N.canvas.width,M.texturePositionClipSpace.y=P.y/N.canvas.height,M.sizeClipSpace.x/=N.canvas.width,M.sizeClipSpace.y/=N.canvas.height,P.height=Math.max(P.height,M.size.y),P.x+=M.size.x,N.ctx.putImageData(A,M.texturePosition.x-this._workBoundingBox.left,M.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,M.size.x,M.size.y),N.addGlyph(M),N.version++,M}_findGlyphBoundingBox(e,t,n,r,i,a){t.top=0;let o=r?this._config.deviceCellHeight:this._tmpCanvas.height,s=r?this._config.deviceCellWidth:n,c=!1;for(let n=0;n<o;n++){for(let r=0;r<s;r++){let i=n*this._tmpCanvas.width*4+4*r+3;if(e.data[i]!==0){t.top=n,c=!0;break}}if(c)break}t.left=0,c=!1;for(let n=0;n<a+s;n++){for(let r=0;r<o;r++){let i=r*this._tmpCanvas.width*4+4*n+3;if(e.data[i]!==0){t.left=n,c=!0;break}}if(c)break}t.right=s,c=!1;for(let n=a+s-1;n>=a;n--){for(let r=0;r<o;r++){let i=r*this._tmpCanvas.width*4+4*n+3;if(e.data[i]!==0){t.right=n,c=!0;break}}if(c)break}t.bottom=o,c=!1;for(let n=o-1;n>=0;n--){for(let r=0;r<s;r++){let i=n*this._tmpCanvas.width*4+4*r+3;if(e.data[i]!==0){t.bottom=n,c=!0;break}}if(c)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:t.right-t.left+1,y:t.bottom-t.top+1},sizeClipSpace:{x:t.right-t.left+1,y:t.bottom-t.top+1},offset:{x:-t.left+a+(r||i?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-t.top+a+(r||i?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=m;class h{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}constructor(e,t,n){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],n)for(let e of n)this._glyphs.push(...e.glyphs),this._usedPixels+=e._usedPixels;this.canvas=_(e,t,t),this.ctx=(0,a.throwIfFalsy)(this.canvas.getContext(`2d`,{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function g(e,t,n,r){let i=t.rgba>>>24,a=t.rgba>>>16&255,o=t.rgba>>>8&255,s=n.rgba>>>24,c=n.rgba>>>16&255,l=n.rgba>>>8&255,u=Math.floor((Math.abs(i-s)+Math.abs(a-c)+Math.abs(o-l))/12),d=!0;for(let t=0;t<e.data.length;t+=4)e.data[t]===i&&e.data[t+1]===a&&e.data[t+2]===o||r&&Math.abs(e.data[t]-i)+Math.abs(e.data[t+1]-a)+Math.abs(e.data[t+2]-o)<u?e.data[t+3]=0:d=!1;return d}function _(e,t,n){let r=e.createElement(`canvas`);return r.width=t,r.height=n,r}},160:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let n=0,r=0,i=0,a=0;var o,s,c,l,u;function d(e){let t=e.toString(16);return t.length<2?`0`+t:t}function f(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}t.NULL_COLOR={css:`#00000000`,rgba:0},function(e){e.toCss=function(e,t,n,r){return r===void 0?`#${d(e)}${d(t)}${d(n)}`:`#${d(e)}${d(t)}${d(n)}${d(r)}`},e.toRgba=function(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0},e.toColor=function(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}}(o||(t.channels=o={})),function(e){function t(e,t){return a=Math.round(255*t),[n,r,i]=u.toChannels(e.rgba),{css:o.toCss(n,r,i,a),rgba:o.toRgba(n,r,i,a)}}e.blend=function(e,t){if(a=(255&t.rgba)/255,a===1)return{css:t.css,rgba:t.rgba};let s=t.rgba>>24&255,c=t.rgba>>16&255,l=t.rgba>>8&255,u=e.rgba>>24&255,d=e.rgba>>16&255,f=e.rgba>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),{css:o.toCss(n,r,i),rgba:o.toRgba(n,r,i)}},e.isOpaque=function(e){return(255&e.rgba)==255},e.ensureContrastRatio=function(e,t,n){let r=u.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return o.toColor(r>>24&255,r>>16&255,r>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[n,r,i]=u.toChannels(t),{css:o.toCss(n,r,i),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,n){return a=255&e.rgba,t(e,a*n/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(s||(t.color=s={})),function(e){let t,s;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let n=e.getContext(`2d`,{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation=`copy`,s=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),o.toColor(n,r,i);case 5:return n=parseInt(e.slice(1,2).repeat(2),16),r=parseInt(e.slice(2,3).repeat(2),16),i=parseInt(e.slice(3,4).repeat(2),16),a=parseInt(e.slice(4,5).repeat(2),16),o.toColor(n,r,i,a);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let c=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return n=parseInt(c[1]),r=parseInt(c[2]),i=parseInt(c[3]),a=Math.round(255*(c[5]===void 0?1:parseFloat(c[5]))),o.toColor(n,r,i,a);if(!t||!s||(t.fillStyle=s,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[n,r,i,a]=t.getImageData(0,0,1,1).data,a!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:o.toRgba(n,r,i,a),css:e}}}(c||(t.css=c={})),function(e){function t(e,t,n){let r=e/255,i=t/255,a=n/255;return .2126*(r<=.03928?r/12.92:((r+.055)/1.055)**2.4)+.7152*(i<=.03928?i/12.92:((i+.055)/1.055)**2.4)+.0722*(a<=.03928?a/12.92:((a+.055)/1.055)**2.4)}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(l||(t.rgb=l={})),function(e){function t(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(.1*o)),s-=Math.max(0,Math.ceil(.1*s)),c-=Math.max(0,Math.ceil(.1*c)),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}function s(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));for(;u<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),s=Math.min(255,s+Math.ceil(.1*(255-s))),c=Math.min(255,c+Math.ceil(.1*(255-c))),u=f(l.relativeLuminance2(o,s,c),l.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.blend=function(e,t){if(a=(255&t)/255,a===1)return t;let s=t>>24&255,c=t>>16&255,l=t>>8&255,u=e>>24&255,d=e>>16&255,f=e>>8&255;return n=u+Math.round((s-u)*a),r=d+Math.round((c-d)*a),i=f+Math.round((l-f)*a),o.toRgba(n,r,i)},e.ensureContrastRatio=function(e,n,r){let i=l.relativeLuminance(e>>8),a=l.relativeLuminance(n>>8);if(f(i,a)<r){if(a<i){let a=t(e,n,r),o=f(i,l.relativeLuminance(a>>8));if(o<r){let t=s(e,n,r);return o>f(i,l.relativeLuminance(t>>8))?a:t}return a}let o=s(e,n,r),c=f(i,l.relativeLuminance(o>>8));if(c<r){let a=t(e,n,r);return c>f(i,l.relativeLuminance(a>>8))?o:a}return o}},e.reduceLuminance=t,e.increaseLuminance=s,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}}(u||(t.rgba=u={})),t.toPaddedHex=d,t.contrastRatio=f},345:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed){for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}}}),this._event}fire(e,t){let n=[];for(let e=0;e<this._listeners.length;e++)n.push(this._listeners[e]);for(let r=0;r<n.length;r++)n[r].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e((e=>t.fire(e)))},t.runAndSubscribe=function(e,t){return t(void 0),e((e=>t(e)))}},859:(e,t)=>{function n(e){for(let t of e)t.dispose();e.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=n,t.getDisposeArrayDisposable=function(e){return{dispose:()=>n(e)}}},485:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}}t.TwoKeyMap=n,t.FourKeyMap=class{constructor(){this._data=new n}set(e,t,r,i,a){this._data.get(e,t)||this._data.set(e,t,new n),this._data.get(e,t).set(r,i,a)}get(e,t,n,r){return this._data.get(e,t)?.get(n,r)}clear(){this._data.clear()}}},399:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<`u`&&`title`in process;let n=t.isNode?`node`:navigator.userAgent,r=t.isNode?`node`:navigator.platform;t.isFirefox=n.includes(`Firefox`),t.isLegacyEdge=n.includes(`Edge`),t.isSafari=/^((?!chrome|android).)*safari/i.test(n),t.getSafariVersion=function(){if(!t.isSafari)return 0;let e=n.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])},t.isMac=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(r),t.isIpad=r===`iPad`,t.isIphone=r===`iPhone`,t.isWindows=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(r),t.isLinux=r.indexOf(`Linux`)>=0,t.isChromeOS=/\bCrOS\b/.test(n)},385:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;let r=n(399);class i{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),n=Math.max(t,n),i=e.timeRemaining(),1.5*n>i)return r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),void this._start();r=i}this.clear()}}class a extends i{_requestCallback(e){return setTimeout((()=>e(this._createDeadline(16))))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}t.PriorityTaskQueue=a,t.IdleTaskQueue=!r.isNode&&`requestIdleCallback`in window?class extends i{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:a,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},147:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new r}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let e=new n;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}t.AttributeData=n;class r{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new r(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=r},782:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;let r=n(133),i=n(855),a=n(147);class o extends a.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new a.ExtendedAttrs,this.combinedData=``}static fromCharData(e){let t=new o;return t.setFromCharData(e),t}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,r.stringFromCodePoint)(2097151&this.content):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[i.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[i.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(e[i.CHAR_DATA_CHAR_INDEX].length===2){let n=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(n-55296)+r-56320+65536|e[i.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[i.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[i.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[i.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=o},855:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR=``,t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=` `,t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},133:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=1024*(this._interim-55296)+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=1024*(i-55296)+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r,i,a,o,s=0,c=0,l=0;if(this.interim[0]){let r=!1,i=this.interim[0];i&=(224&i)==192?31:(240&i)==224?15:7;let a,o=0;for(;(a=63&this.interim[++o])&&o<4;)i<<=6,i|=a;let c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(a=e[l++],(192&a)!=128){l--,r=!0;break}this.interim[o++]=a,i<<=6,i|=63&a}r||(c===2?i<128?l--:t[s++]=i:c===3?i<2048||i>=55296&&i<=57343||i===65279||(t[s++]=i):i<65536||i>1114111||(t[s++]=i)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;!(!(d<u)||128&(r=e[d])||128&(i=e[d+1])||128&(a=e[d+2])||128&(o=e[d+3]));)t[s++]=r,t[s++]=i,t[s++]=a,t[s++]=o,d+=4;if(r=e[d++],r<128)t[s++]=r;else if((224&r)==192){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(c=(31&r)<<6|63&i,c<128){d--;continue}t[s++]=c}else if((240&r)==224){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(c=(15&r)<<12|(63&i)<<6|63&a,c<2048||c>=55296&&c<=57343||c===65279)continue;t[s++]=c}else if((248&r)==240){if(d>=n)return this.interim[0]=r,s;if(i=e[d++],(192&i)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,s;if(a=e[d++],(192&a)!=128){d--;continue}if(d>=n)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=a,s;if(o=e[d++],(192&o)!=128){d--;continue}if(c=(7&r)<<18|(63&i)<<12|(63&a)<<6|63&o,c<65536||c>1114111)continue;t[s++]=c}}return s}}},776:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;let a=n(859),o=n(97),s={trace:o.LogLevelEnum.TRACE,debug:o.LogLevelEnum.DEBUG,info:o.LogLevelEnum.INFO,warn:o.LogLevelEnum.WARN,error:o.LogLevelEnum.ERROR,off:o.LogLevelEnum.OFF},c,l=t.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=o.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange(`logLevel`,(()=>this._updateLogLevel()))),c=this}_updateLogLevel(){this._logLevel=s[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:`xterm.js: `)+t,...n)}trace(e,...t){this._logLevel<=o.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=o.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=o.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=o.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=o.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};t.LogService=l=r([i(0,o.IOptionsService)],l),t.setTraceLogger=function(e){c=e},t.traceCall=function(e,t,n){if(typeof n.value!=`function`)throw Error(`not supported`);let r=n.value;n.value=function(...e){if(c.logLevel!==o.LogLevelEnum.TRACE)return r.apply(this,e);c.trace(`GlyphRenderer#${r.name}(${e.map((e=>JSON.stringify(e))).join(`, `)})`);let t=r.apply(this,e);return c.trace(`GlyphRenderer#${r.name} return`,t),t}}},726:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;let n=`di$target`,r=`di$dependencies`;t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[r]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);let i=function(e,t,a){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);(function(e,t,i){t[n]===t?t[r].push({id:e,index:i}):(t[r]=[{id:e,index:i}],t[n]=t)})(i,e,a)};return i.toString=()=>e,t.serviceRegistry.set(e,i),i}},97:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;let r=n(726);var i;t.IBufferService=(0,r.createDecorator)(`BufferService`),t.ICoreMouseService=(0,r.createDecorator)(`CoreMouseService`),t.ICoreService=(0,r.createDecorator)(`CoreService`),t.ICharsetService=(0,r.createDecorator)(`CharsetService`),t.IInstantiationService=(0,r.createDecorator)(`InstantiationService`),function(e){e[e.TRACE=0]=`TRACE`,e[e.DEBUG=1]=`DEBUG`,e[e.INFO=2]=`INFO`,e[e.WARN=3]=`WARN`,e[e.ERROR=4]=`ERROR`,e[e.OFF=5]=`OFF`}(i||(t.LogLevelEnum=i={})),t.ILogService=(0,r.createDecorator)(`LogService`),t.IOptionsService=(0,r.createDecorator)(`OptionsService`),t.IOscLinkService=(0,r.createDecorator)(`OscLinkService`),t.IUnicodeService=(0,r.createDecorator)(`UnicodeService`),t.IDecorationService=(0,r.createDecorator)(`DecorationService`)}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.WebglAddon=void 0;let t=n(345),i=n(859),a=n(399),o=n(666),s=n(776);class c extends i.Disposable{constructor(e){if(a.isSafari&&(0,a.getSafariVersion)()<16&&!document.createElement(`canvas`).getContext(`webgl2`,{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error(`Webgl2 is only supported on Safari 16 and above`);super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this.register(new t.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new t.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new t.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new t.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(e){let n=e._core;if(!e.element)return void this.register(n.onWillOpen((()=>this.activate(e))));this._terminal=e;let r=n.coreService,a=n.optionsService,c=n,l=c._renderService,u=c._characterJoinerService,d=c._charSizeService,f=c._coreBrowserService,p=c._decorationService,m=c._logService,h=c._themeService;(0,s.setTraceLogger)(m),this._renderer=this.register(new o.WebglRenderer(e,u,d,f,r,p,a,h,this._preserveDrawingBuffer)),this.register((0,t.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,t.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,t.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,t.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),l.setRenderer(this._renderer),this.register((0,i.toDisposable)((()=>{let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)})))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}}e.WebglAddon=c})(),r})()))})),Fc=Nc(),Ic=Pc(),Lc=`termscape-debug`;function Rc(){let e=``;try{e=localStorage.getItem(Lc)??``}catch{}let t=new URL(window.location.href),n=t.searchParams.get(`debug`);if(n!==null){e=n===`off`||n===`0`?``:n;try{e?localStorage.setItem(Lc,e):localStorage.removeItem(Lc)}catch{}t.searchParams.delete(`debug`),window.history.replaceState({},``,t.toString())}return new Set(e.split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean))}var zc=Rc(),Bc=zc.has(`all`)||zc.has(`1`)||zc.has(`true`);function Vc(e){return Bc||zc.has(e)}function Hc(e,...t){Vc(e)&&console.debug(`%c[termscape:${e}]`,`color:#7c9cf5`,...t)}zc.size>0&&console.info(`[termscape] tracing ${Bc?`all`:[...zc].join(`, `)}. Add ?debug=off to stop. Both hubs take the same topics in TERMSCAPE_DEBUG.`);var Uc=.08,Wc=2.5;function Gc(e,t){return{x:(e.x-t.panX)/t.zoom,y:(e.y-t.panY)/t.zoom}}function Kc(e){return Math.min(Wc,Math.max(Uc,e))}function qc(e,t,n){let r=Kc(n),i=Gc(t,e);return{zoom:r,panX:t.x-i.x*r,panY:t.y-i.y*r}}function Jc(e,t){return 12*e*t}function Yc(e,t){let n=Jc(e,t);if(!(n>=9&&n<=64))return Kc(e);let r=12*t,i=Math.round(n);return i/r>2.5&&(i=Math.floor(Wc*r)),i/r<.08&&(i=Math.ceil(Uc*r)),i/r}function Xc(e,t){return Math.min(64,Math.max(9,Math.round(Jc(e,t))))/(12*t)}function Zc(e){return 12*e}function Qc(e,t,n,r){let i=qc(e,{x:t/2,y:n/2},Yc(e.zoom,r));return{zoom:i.zoom,panX:Math.round(i.panX*r)/r,panY:Math.round(i.panY*r)/r}}function $c(e,t,n){let r=t*n;return!Number.isFinite(r)||r<=0?e:Math.round(e*r)/r}function el(e,t,n,r=400){let i=Gc({x:-r,y:-r},e),a=Gc({x:t+r,y:n+r},e);return{x:i.x,y:i.y,w:a.x-i.x,h:a.y-i.y}}function tl(e,t){return!(e.x+e.w<t.x||t.x+t.w<e.x||e.y+e.h<t.y||t.y+t.h<e.y)}function nl(e,t){return t.x>=e.x&&t.x<=e.x+e.w&&t.y>=e.y&&t.y<=e.y+e.h}function rl(e,t,n=.5){return t.x>=e.x-n&&t.y>=e.y-n&&t.x+t.w<=e.x+e.w+n&&t.y+t.h<=e.y+e.h+n}function il(e,t,n,r){return{zoom:t,panX:(n-e.w*t)/2-e.x*t,panY:(r-e.h*t)/2-e.y*t}}function al(e){if(e.length===0)return null;let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y)),r=Math.max(...e.map(e=>e.x+e.w)),i=Math.max(...e.map(e=>e.y+e.h));return{x:t,y:n,w:Math.max(1,r-t),h:Math.max(1,i-n)}}function ol(e,t,n,r=80){let i=al(e);return i?il(i,Kc(Math.min((t-r*2)/i.w,(n-r*2)/i.h)),t,n):{panX:0,panY:0,zoom:1}}var sl=.9;function cl(e,t,n,r=sl){let i=Math.max(1,e.w),a=Math.max(1,e.h),o=Kc(Math.min(t*r/i,n*r/a));return il({...e,w:i,h:a},o,t,n)}function ll(e){let t=al(e);return t?{x:t.x-28,y:t.y-28-24,w:t.w+56,h:t.h+56+24}:null}function ul(e,t){return e&&t.now-e.lastAt<=300?{owner:e.owner,lastAt:t.now}:{owner:t.overTerminal&&!t.zooming?`terminal`:`canvas`,lastAt:t.now}}function dl(e,t=0){return t!==0||Math.abs(e)>=40}var fl=1.15;function pl(e,t=0){return e===0?1:dl(e,t)?e<0?fl:1/fl:Math.min(5,Math.max(.2,1-e*.01))}function ml(e){return!(e.ratio>0)||!Number.isFinite(e.ratio)||!(e.durationMs>=0&&e.durationMs<=400)||Math.abs(Math.log(e.ratio))/Math.log(1.15)<2.999999999?null:e.ratio>1?`in`:`out`}function hl(e){if(e.events<3||!(e.ratio>0)||!Number.isFinite(e.ratio)||!(e.durationMs>=0&&e.durationMs<=900))return null;let t=Math.abs(Math.log(e.ratio));return t<Math.log(1.15)||(e.durationMs>0?t/(e.durationMs/1e3):1/0)<.6?null:e.ratio>1?`in`:`out`}function gl(e,t,n,r){let i=el(t,n,r,0),a=e.find(e=>!rl(i,e));return a?ol([a],n,r):null}function _l(e,t,n,r,i){if(n<=0)return e;if(n>=1)return t;let a=Math.exp(Math.log(e.zoom)+(Math.log(t.zoom)-Math.log(e.zoom))*n),o={x:r/2,y:i/2},s=Gc(o,e),c=Gc(o,t),l=s.x+(c.x-s.x)*n,u=s.y+(c.y-s.y)*n;return{zoom:a,panX:o.x-l*a,panY:o.y-u*a}}var vl=`\x1B[5~`,yl=`\x1B[6~`;function bl(e,t){return t===0?`none`:e.mouseTracking===`none`?e.totalLines>e.rows?`scrollback`:t<0?`page-up`:`page-down`:`program`}function xl(e){return e===`page-up`?vl:e===`page-down`?yl:null}function Sl(e){return e.mouseTracking!==`none`&&!e.shift?`program`:e.hasSelection?`copy`:`paste`}function Cl(e){return{line:e.viewportY,bottom:e.viewportY>=e.baseY}}function wl(e,t){if(e.bottom)return t.viewportY===t.baseY?null:`bottom`;let n=Math.min(e.line,t.baseY);return t.viewportY===n?null:n}async function Tl(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand(`copy`)}catch{return!1}finally{document.body.removeChild(t)}}async function El(){try{return await navigator.clipboard?.readText()??null}catch{return null}}var Dl=`ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace`,Ol=1.2;function kl(){let e=[];for(let t=9;t<=64;t++)e.push(t);return e}function Al(e,t,n=Ol){let r=Math.floor(e.charW*t/12),i=Math.ceil(e.charH*t/12),a=Math.floor(i*n);return{w:r*12/t,h:a*12/t}}function jl(e,t=Ol){let n=0,r=0;for(let i of kl()){let a=Al(e,i,t);a.w>n&&(n=a.w),a.h>r&&(r=a.h)}return{w:n,h:r}}function Ml(e,t,n,r=Ol){let i=jl(n,r);return!(i.w>0)||!(i.h>0)?{cols:2,rows:1}:{cols:Math.max(2,Math.floor(e/i.w)),rows:Math.max(1,Math.floor(t/i.h))}}function Nl(e,t,n,r,i,a,o=Ol){let s=12*i,c=n=>{let r=Al(a,n,o);return{w:Math.ceil(e*r.w),h:Math.ceil(t*r.h)}};for(let e=64;e>=9;e--){let{w:t,h:a}=c(e),o=e/s;if(t*o<=n&&a*o<=r)return{w:t,h:a,zoom:o,renderScale:Xc(o,i)}}let{w:l,h:u}=c(9);return{w:l,h:u,zoom:l>0&&u>0?Math.min(n/l,r/u):1,renderScale:9/s}}var Pl=null;function Fl(){if(Pl)return Pl;let e=document.createElement(`span`);e.textContent=`W`.repeat(32),e.setAttribute(`aria-hidden`,`true`),e.style.cssText=`display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal;white-space:pre;font-kerning:none;`,e.style.fontFamily=Dl,e.style.fontSize=`12px`,document.body.appendChild(e);let t=e.offsetWidth/32,n=e.offsetHeight;return e.remove(),!(t>0)||!(n>0)?{charW:12*.6,charH:12*1.2}:(Pl={charW:t,charH:n},Pl)}var Il=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),q=o(((e,t)=>{t.exports=Il()}))(),J=10,Ll={background:`#0e1117`,foreground:`#d5dae2`,cursor:`#7c9cf5`,selectionBackground:`#2c3b57`,black:`#1c2027`,red:`#e06c75`,green:`#88c07a`,yellow:`#d8b271`,blue:`#7c9cf5`,magenta:`#c07ac8`,cyan:`#5ab4c4`,white:`#c3c9d3`,brightBlack:`#4a5262`,brightRed:`#ef8b93`,brightGreen:`#a3d497`,brightYellow:`#e9cb92`,brightBlue:`#9db4f8`,brightMagenta:`#d69ddc`,brightCyan:`#7fcdda`,brightWhite:`#e8ecf2`};function Y(e){let t=`unknown`,n=`unknown`;try{let r=e._core?.coreMouseService;r?.activeEncoding&&(t=r.activeEncoding),r?.activeProtocol&&(n=r.activeProtocol)}catch{}return{tracking:e.modes.mouseTrackingMode,protocol:n,encoding:t,screen:e.buffer.active.type,grid:`${e.cols}x${e.rows}`,viewportY:e.buffer.active.viewportY,baseY:e.buffer.active.baseY}}function X({sessionId:e,w:t,h:n,renderScale:r,focused:i,grid:a=`drive`,cols:o,rows:s}){let c=(0,_.useRef)(null),l=(0,_.useRef)(null),u=(0,_.useRef)(null),d=O(e=>e.client),f=a===`follow`,p=(0,_.useRef)({cols:o,rows:s});p.current={cols:o,rows:s};let m=(0,_.useCallback)(()=>{if(f)return;let t=u.current,n=l.current;if(!t||!n||!d)return;let{cols:r,rows:i}=Ml(n.clientWidth,n.clientHeight,Fl(),Ol);(r!==t.cols||i!==t.rows)&&(Hc(`attach`,e,`grid ${t.cols}x${t.rows} -> ${r}x${i}`),t.resize(r,i),d.send({t:`resize`,sessionId:e,cols:r,rows:i}))},[d,e,f]),h=(0,_.useRef)(r);h.current=r,(0,_.useEffect)(()=>{let t=c.current;if(!t||!d)return;let n=f?p.current:null,r=new Fc.Terminal({theme:Ll,fontFamily:Dl,fontSize:Zc(h.current),lineHeight:Ol,cursorBlink:i,scrollback:5e3,allowProposedApi:!0,convertEol:!1,...n?.cols&&n?.rows?{cols:n.cols,rows:n.rows}:{}});r.open(t);try{let e=new Ic.WebglAddon;e.onContextLoss(()=>e.dispose()),r.loadAddon(e)}catch{}u.current=r;let a=!1,o=e=>{e.length!==0&&(a=!0,r.write(e))},s=O.getState().takeSnapshot(e);s&&o(s),Hc(`attach`,e,`mounted;`,s?`snapshot ${s.length}B restores: ${kc(s)}`:`no snapshot yet; watching for the one this attach asks for`);let g=d.attach(e,o),_=O.subscribe(t=>{if(a||!t.pendingSnapshots.has(e))return;let n=O.getState().takeSnapshot(e);n&&(Hc(`attach`,e,`snapshot arrived after mount, ${n.length}B restores:`,kc(n)),o(n))}),v=0,y={reports:0,viewportY:0},b=t=>{Vc(`input`)&&(y={reports:v,viewportY:r.buffer.active.viewportY},Hc(`input`,e,`wheel`,{deltaY:t.deltaY,deltaMode:t.deltaMode},Y(r)))},x=t=>{if(!Vc(`input`))return;let n=v-y.reports,i=r.buffer.active.viewportY-y.viewportY;Hc(`input`,e,`wheel ->`,n>0?`${n} report(s) to the program`:i===0?`NOTHING: no report encoded and no local scroll`:`no report; xterm scrolled its own buffer by ${i}`,{defaultPrevented:t.defaultPrevented,tracking:r.modes.mouseTrackingMode,screen:r.buffer.active.type})},S=l.current;S?.addEventListener(`wheel`,b,{capture:!0,passive:!0}),S?.addEventListener(`wheel`,x,{passive:!0});let C=t=>{if(t.button!==2)return;let n=Sl({mouseTracking:r.modes.mouseTrackingMode,hasSelection:r.hasSelection(),shift:t.shiftKey});if(n===`program`){Hc(`input`,e,`right-click -> program (mouse tracking on)`);return}if(t.preventDefault(),t.stopPropagation(),n===`copy`){let t=r.getSelection();Tl(t).then(n=>{Hc(`input`,e,n?`right-click -> copied ${t.length} char(s)`:`right-click -> copy failed; selection kept`),n&&r.clearSelection()})}else El().then(t=>{if(t===null){Hc(`input`,e,`right-click -> paste: clipboard unreadable (non-secure context?)`);return}if(t.length===0){Hc(`input`,e,`right-click -> paste: clipboard empty`);return}Hc(`input`,e,`right-click -> pasted ${t.length} char(s)`),r.paste(t)})};S?.addEventListener(`mousedown`,C,{capture:!0}),r.attachCustomWheelEventHandler(t=>{let n=bl({mouseTracking:r.modes.mouseTrackingMode,totalLines:r.buffer.active.length,rows:r.rows},t.deltaY),i=xl(n);return!i||(Hc(`input`,e,`wheel -> ${n} (nothing else could move)`),d.sendInput(e,i),!1)});let w=r.onData(t=>{v++,d.sendInput(e,t)}),T=r.onBinary(t=>{v++,d.sendInputBytes(e,t)});return m(),()=>{S?.removeEventListener(`wheel`,b,{capture:!0}),S?.removeEventListener(`wheel`,x),S?.removeEventListener(`mousedown`,C,{capture:!0}),_(),w.dispose(),T.dispose(),g(),r.dispose(),u.current=null}},[e,d]),(0,_.useEffect)(()=>{let e=requestAnimationFrame(m);return()=>cancelAnimationFrame(e)},[t,n,m]),(0,_.useEffect)(()=>{if(!f||!o||!s)return;let e=u.current;e&&(e.cols!==o||e.rows!==s)&&e.resize(o,s)},[f,o,s]);let g=(0,_.useRef)(null);return(0,_.useEffect)(()=>()=>{g.current&&cancelAnimationFrame(g.current.raf),g.current=null},[]),(0,_.useEffect)(()=>{let e=u.current;if(!e)return;let t=Zc(r);if(e.options.fontSize===t)return;let n=g.current,i=n?.pin??Cl(e.buffer.active);n&&cancelAnimationFrame(n.raf),e.options.fontSize=t;let a=()=>{let t=g.current;if(!t||u.current!==e)return;let n=wl(t.pin,e.buffer.active);if(n===`bottom`?e.scrollToBottom():n!==null&&e.scrollToLine(n),--t.frames<=0){g.current=null;return}t.raf=requestAnimationFrame(a)};g.current={pin:i,frames:J,raf:requestAnimationFrame(a)}},[r]),(0,_.useEffect)(()=>{let e=u.current;e&&(e.options.cursorBlink=i,i&&e.focus())},[i]),(0,q.jsx)(`div`,{className:`term-host`,ref:l,onContextMenu:e=>e.preventDefault(),children:(0,q.jsx)(`div`,{className:`term-scale`,ref:c,style:{width:`${100*r}%`,height:`${100*r}%`,transform:`scale(${1/r})`}})})}function Z(e){return e.state===`running`?e.status===`busy`?`#d8b271`:`#88c07a`:e.state===`failed`?`#e06c75`:e.state===`exited`?`#4a5262`:`#7c8596`}function Rl(e){return e.state===`running`?e.status===`busy`?`working`:e.status===`idle`?`idle`:`running`:e.state}var zl=320,Bl=200,Vl=(0,_.memo)(function({session:e,workspace:t,zoom:n,dpr:r,renderScale:i,selected:a,maximized:o,onMaximize:s}){let{moveWindow:c,select:l,client:u,shared:d,openDialog:f}=O(w(t=>({moveWindow:t.moveWindow,select:t.select,client:t.client,shared:t.shares.some(t=>t.sessionId===e.id),openDialog:t.openDialog}))),[p,m]=(0,_.useState)(null),h=(0,_.useRef)(e.window);h.current=e.window;let g=(0,_.useCallback)(t=>n=>{n.stopPropagation(),n.target.setPointerCapture(n.pointerId),l(e.id),m({mode:t,ox:n.clientX,oy:n.clientY})},[l,e.id]);(0,_.useEffect)(()=>{if(!p)return;let t=t=>{let r=(t.clientX-p.ox)/n,i=(t.clientY-p.oy)/n,a=h.current;c(e.id,p.mode===`move`?{...a,x:a.x+r,y:a.y+i}:{...a,w:Math.max(zl,a.w+r),h:Math.max(Bl,a.h+i)}),m({...p,ox:t.clientX,oy:t.clientY})},r=()=>m(null);return window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,r),()=>{window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,r)}},[p,c,e.id,n]);let{x:v,y,w:b,h:x}=e.window,S=e.state!==`running`,C=$c(v,n,r),T=$c(y,n,r);return(0,q.jsxs)(`div`,{className:`window${a?` selected`:``}${S?` stopped`:``}`,style:{transform:`translate(${C}px, ${T}px)`,width:b,height:x,zIndex:e.window.z+(a?1e3:0),borderColor:a?`#7c9cf5`:t?.color??`#2a3040`},onPointerDown:()=>l(e.id),children:[(0,q.jsxs)(`header`,{className:`window-bar`,onPointerDown:g(`move`),children:[(0,q.jsx)(`span`,{className:`dot`,style:{background:Z(e)}}),(0,q.jsx)(`span`,{className:`addr`,title:e.address,children:e.title||e.address}),(0,q.jsx)(`span`,{className:`meta`,children:e.statusText??Rl(e)}),(0,q.jsx)(`span`,{className:`spacer`}),(0,q.jsx)(`button`,{className:`btn`,title:o?`Back to the previous view (Ctrl+2)`:`Zoom the canvas to this terminal (Ctrl+2)`,onPointerDown:e=>e.stopPropagation(),onClick:()=>s(e.id),children:o?`⤡`:`⤢`}),(0,q.jsx)(`button`,{className:`btn${d?` on`:``}`,title:d?`Manage this terminal’s share link`:`Share this terminal by link`,onPointerDown:e=>e.stopPropagation(),onClick:()=>f({kind:`share`,sessionId:e.id}),children:`share`}),S&&(0,q.jsx)(`button`,{className:`btn`,title:e.resumable?`Relaunch with its previous conversation`:`Restart this session (this profile cannot resume a conversation)`,onPointerDown:e=>e.stopPropagation(),onClick:()=>u?.send({t:`resumeSession`,sessionId:e.id}),children:e.resumable?`resume`:`restart`}),!S&&(0,q.jsx)(`button`,{className:`btn`,title:`Restart with a fresh conversation and send its opening instruction again`,onPointerDown:e=>e.stopPropagation(),onClick:()=>u?.send({t:`clearSession`,sessionId:e.id}),children:`clear`}),!S&&(0,q.jsx)(`button`,{className:`btn`,title:`Stop this agent`,onPointerDown:e=>e.stopPropagation(),onClick:()=>u?.send({t:`stopSession`,sessionId:e.id}),children:`stop`}),(0,q.jsx)(`button`,{className:`btn danger`,title:`Remove this window and forget the session`,onPointerDown:e=>e.stopPropagation(),onClick:()=>u?.send({t:`removeSession`,sessionId:e.id}),children:`×`})]}),(0,q.jsx)(`div`,{className:`window-body`,children:(0,q.jsx)(X,{sessionId:e.id,w:b,h:x,renderScale:i,focused:a})}),(0,q.jsx)(`div`,{className:`resize-handle`,onPointerDown:g(`resize`)})]})}),Hl=120,Ul=80,Wl=[`yellow`,`pink`,`green`,`blue`],Gl=(0,_.memo)(function({note:e,zoom:t,selected:n,autoFocus:r}){let{putNote:i,removeNote:a,selectNote:o}=O(w(e=>({putNote:e.putNote,removeNote:e.removeNote,selectNote:e.selectNote}))),[s,c]=(0,_.useState)(null),l=(0,_.useRef)(e);l.current=e;let u=(0,_.useRef)(null);(0,_.useEffect)(()=>{r&&u.current?.focus()},[]);let d=(0,_.useCallback)(()=>{let e=O.getState().notes,t=Math.max(0,...e.map(e=>e.z)),n=l.current;n.z<t&&i({...n,z:t+1})},[i]),f=(0,_.useCallback)(()=>{o(e.id),d()},[o,e.id,d]),p=(0,_.useCallback)(e=>t=>{t.stopPropagation(),t.target.setPointerCapture(t.pointerId),f(),c({mode:e,ox:t.clientX,oy:t.clientY})},[f]);(0,_.useEffect)(()=>{if(!s)return;let e=e=>{let n=(e.clientX-s.ox)/t,r=(e.clientY-s.oy)/t,a=l.current;i(s.mode===`move`?{...a,x:a.x+n,y:a.y+r,updatedAt:Date.now()}:{...a,w:Math.max(Hl,a.w+n),h:Math.max(Ul,a.h+r),updatedAt:Date.now()}),c({...s,ox:e.clientX,oy:e.clientY})},n=()=>c(null);return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,n),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,n)}},[s,i,t]);let{x:m,y:h,w:g,h:v}=e,y=$c(m,t,1),b=$c(h,t,1);return(0,q.jsxs)(`div`,{className:`note${n?` selected`:``}`,"data-color":e.color,style:{transform:`translate(${y}px, ${b}px)`,width:g,height:v,zIndex:e.z+(n?1e3:0)},onPointerDown:f,children:[(0,q.jsxs)(`header`,{className:`note-bar`,onPointerDown:p(`move`),children:[n&&(0,q.jsx)(`span`,{className:`note-swatches`,children:Wl.map(t=>(0,q.jsx)(`button`,{className:`note-swatch${t===e.color?` active`:``}`,"data-color":t,title:t,onPointerDown:e=>e.stopPropagation(),onClick:()=>i({...e,color:t,updatedAt:Date.now()})},t))}),(0,q.jsx)(`span`,{className:`spacer`}),(0,q.jsx)(`button`,{className:`btn danger`,title:`Delete this note`,onPointerDown:e=>e.stopPropagation(),onClick:()=>a(e.id),children:`×`})]}),(0,q.jsx)(`textarea`,{ref:u,className:`note-text`,value:e.text,placeholder:`Type something…`,onPointerDown:e=>{e.stopPropagation(),f()},onChange:t=>i({...e,text:t.target.value,updatedAt:Date.now()})}),(0,q.jsx)(`div`,{className:`resize-handle`,onPointerDown:p(`resize`)})]})}),Kl=2600;function ql({sessions:e}){let t=O(e=>e.flashes),[,n]=(0,_.useState)(0);(0,_.useEffect)(()=>{if(t.length===0)return;let e=setInterval(()=>n(e=>e+1),80);return()=>clearInterval(e)},[t.length]);let r=new Map(e.map(e=>[e.address,e])),i=new Map(e.map(e=>[e.id,e])),a=e=>({x:e.window.x+e.window.w/2,y:e.window.y+e.window.h/2}),o=e.filter(e=>e.spawnedBy&&i.has(e.spawnedBy)).map(e=>({id:e.id,a:a(i.get(e.spawnedBy)),b:a(e)})),s=Date.now(),c=t.map(e=>{let t=r.get(e.from),n=r.get(e.to),i=s-e.at;return!t||!n||i>Kl?null:{...e,a:a(t),b:a(n),t:i/Kl}}).filter(e=>e!==null);if(o.length===0&&c.length===0)return null;let l=1e5;return(0,q.jsxs)(`svg`,{className:`edges`,style:{left:-1e5,top:-1e5},width:l*2,height:l*2,viewBox:`-100000 -100000 ${l*2} ${l*2}`,children:[o.map(e=>(0,q.jsx)(`line`,{x1:e.a.x,y1:e.a.y,x2:e.b.x,y2:e.b.y,stroke:`#39415a`,strokeWidth:2,strokeDasharray:`6 8`},`lin-${e.id}`)),c.map(e=>{let t=e.b.x-e.a.x,n=e.b.y-e.a.y,r=e.a.x+t/2-n*.12,i=e.a.y+n/2+t*.12,a=e.failed?`#e06c75`:`#7c9cf5`,o=(1-e.t)**2*e.a.x+2*(1-e.t)*e.t*r+e.t**2*e.b.x,s=(1-e.t)**2*e.a.y+2*(1-e.t)*e.t*i+e.t**2*e.b.y;return(0,q.jsxs)(`g`,{opacity:1-e.t*.8,children:[(0,q.jsx)(`path`,{d:`M ${e.a.x} ${e.a.y} Q ${r} ${i} ${e.b.x} ${e.b.y}`,fill:`none`,stroke:a,strokeWidth:2.5,strokeDasharray:e.failed?`8 6`:void 0}),!e.failed&&(0,q.jsx)(`circle`,{cx:o,cy:s,r:7,fill:a})]},`msg-${e.id}`)})]})}var Jl=(0,_.memo)(function({ws:e,box:t,sessionIds:n,zoom:r}){let i=O(e=>e.moveWindowsBy),a=(0,_.useRef)(null),[o,s]=(0,_.useState)(!1),c=(0,_.useCallback)(e=>{e.button===0&&(e.stopPropagation(),e.currentTarget.setPointerCapture(e.pointerId),a.current={x:e.clientX,y:e.clientY,ids:n},s(!0))},[n]),l=(0,_.useCallback)(e=>{let t=a.current;t&&(i(t.ids,(e.clientX-t.x)/r,(e.clientY-t.y)/r),a.current={...t,x:e.clientX,y:e.clientY})},[i,r]),u=(0,_.useCallback)(()=>{a.current=null,s(!1)},[]);return(0,q.jsx)(`div`,{className:`ws-group`,style:{transform:`translate(${t.x}px, ${t.y}px)`,width:t.w,height:t.h,color:e.color,borderColor:e.color},children:(0,q.jsxs)(`span`,{className:`ws-label${o?` dragging`:``}`,title:`Drag to move the whole workspace`,onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:u,children:[e.name,(0,q.jsx)(`span`,{className:`ws-path`,children:e.rootPath})]})})}),Yl=140,Xl=180,Zl=e=>1-(1-e)**3;function Ql(){return typeof window>`u`?1:window.devicePixelRatio||1}function $l(e,t){return e.panX===t.panX&&e.panY===t.panY&&e.zoom===t.zoom}function eu(e,t){let n,r=1/0;for(let i of e){let e=i.window.x+i.window.w/2-t.x,a=i.window.y+i.window.h/2-t.y,o=e*e+a*a;o<r&&(r=o,n=i)}return n}function tu(){let e=(0,_.useRef)(null),[t,n]=(0,_.useState)({w:1200,h:800}),[r,i]=(0,_.useState)(!1),a=(0,_.useRef)(null),o=(0,_.useRef)(null),[s,c]=(0,_.useState)(!1),l=(0,_.useRef)(null),[u,d]=(0,_.useState)(Ql),{sessions:f,workspaces:p,notes:m,viewport:h,setViewport:g,selectedId:v,selectedNoteId:y,select:b,createNoteAt:x,setPanelOpen:S}=O(w(e=>({sessions:e.sessions,workspaces:e.workspaces,notes:e.notes,viewport:e.viewport,setViewport:e.setViewport,selectedId:e.selectedId,selectedNoteId:e.selectedNoteId,select:e.select,createNoteAt:e.createNoteAt,setPanelOpen:e.setPanelOpen})));(0,_.useEffect)(()=>{let t=e.current;if(!t)return;let r=new ResizeObserver(()=>{n({w:t.clientWidth,h:t.clientHeight})});return r.observe(t),n({w:t.clientWidth,h:t.clientHeight}),()=>r.disconnect()},[]);let C=(0,_.useRef)(t);C.current=t;let T=(0,_.useRef)(h);T.current=h;let ee=(0,_.useRef)(f);ee.current=f;let E=(0,_.useRef)(u);E.current=u,(0,_.useEffect)(()=>{if(s)return;let e=Qc(h,C.current.w,C.current.h,u);$l(e,h)||g(e)},[h,s,u,g]);let te=(0,_.useCallback)(()=>{l.current=null,c(!1)},[]),ne=(0,_.useRef)(null),re=(0,_.useCallback)(()=>{let e=ne.current;e&&(ne.current=null,cancelAnimationFrame(e.raf))},[]),D=(0,_.useCallback)(()=>{re(),c(!0),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(te,Yl)},[re,te]);(0,_.useEffect)(()=>()=>{l.current!==null&&window.clearTimeout(l.current)},[]),(0,_.useEffect)(()=>{let e=window.matchMedia(`(resolution: ${u}dppx)`),t=()=>d(Ql());return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[u]);let[k,ie]=(0,_.useState)(()=>Xc(h.zoom,Ql()));(0,_.useEffect)(()=>{if(s)return;let e=Xc(h.zoom,u);ie(t=>t===e?t:e)},[h.zoom,u,s]);let ae=(0,_.useCallback)(e=>{S(!1),(e.target===e.currentTarget||e.button===1)&&(e.button===0&&b(null),a.current={x:e.clientX,y:e.clientY},i(!0),e.currentTarget.setPointerCapture(e.pointerId))},[b,S]),A=(0,_.useCallback)(e=>{(e.movementX||e.movementY)&&(o.current=null);let t=a.current;t&&(D(),g({...h,panX:h.panX+(e.clientX-t.x),panY:h.panY+(e.clientY-t.y)}),a.current={x:e.clientX,y:e.clientY})},[h,g,D]),j=(0,_.useCallback)(()=>{a.current=null,i(!1),D()},[D]),M=(0,_.useCallback)(t=>{let n=t.target;if(n!==t.currentTarget&&!n.classList.contains(`world`))return;let r=e.current;if(!r)return;let i=r.getBoundingClientRect(),a=Gc({x:t.clientX-i.left,y:t.clientY-i.top},T.current);x(a);let o=O.getState().selectedNoteId;_e.current=o,setTimeout(()=>{_e.current===o&&(_e.current=null)},0)},[x]),N=(0,_.useCallback)(e=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null),g(e),c(!1)},[g]),P=(0,_.useCallback)(e=>{re(),l.current!==null&&(window.clearTimeout(l.current),l.current=null);let t=T.current;c(!0);let n=r=>{let i=ne.current;if(!i)return;let a=(r-i.startedAt)/Xl;if(a>=1){ne.current=null,N(e);return}let{w:o,h:s}=C.current;g(_l(t,e,Zl(a),o,s)),i.raf=requestAnimationFrame(n)};ne.current={raf:requestAnimationFrame(n),startedAt:performance.now()}},[N,re,g]),[oe,F]=(0,_.useState)(null),I=(0,_.useRef)(oe);I.current=oe;let se=(0,_.useCallback)((e,t)=>{let n=ee.current.find(t=>t.id===e);if(!n)return;b(e);let{w:r,h:i}=C.current,a=T.current,o=I.current,s=o!==null&&$l(a,o.applied)?o.restore:a,c=Qc(cl(n.window,r,i),r,i,E.current);F({sessionId:e,restore:t??s,applied:c}),P(c)},[P,b]),ce=O(e=>e.focusRequest);(0,_.useEffect)(()=>{if(ce){if(ce.alsoId){let e=ee.current.filter(e=>e.id===ce.sessionId||e.id===ce.alsoId);e.length>0&&(F(null),P(ol(e.map(e=>e.window),C.current.w,C.current.h)));return}se(ce.sessionId)}},[ce]);let le=(0,_.useCallback)(e=>{let t=I.current;if(t!==null&&t.sessionId===e&&$l(T.current,t.applied)){F(null),b(e),P(t.restore);return}se(e)},[se,P,b]),ue=(0,_.useRef)(null),de=(0,_.useCallback)(()=>{let e=ue.current;e&&(ue.current=null,e.timer!==null&&window.clearTimeout(e.timer))},[]),fe=(0,_.useCallback)(()=>{let e=ue.current;if(!e)return;ue.current=null,e.timer!==null&&window.clearTimeout(e.timer);let t=e.lastAt-e.startedAt,n=e.notch?ml({ratio:e.ratio,durationMs:t}):hl({ratio:e.ratio,durationMs:t,events:e.events});if(!n)return;let r=Gc(e.anchor,e.startViewport),i=ee.current,a=i.filter(e=>nl(e.window,r)).sort((e,t)=>e.window.z-t.window.z).at(-1);if(n===`in`){if(!a)return;se(a.id,e.startViewport);return}let o=a??eu(i,r),s=[o?ll(i.filter(e=>e.workspaceId===o.workspaceId).map(e=>e.window)):null,al(i.map(e=>e.window))].filter(e=>e!==null),{w:c,h:l}=C.current,u=gl(s,T.current,c,l);u&&(F(null),P(Qc(u,c,l,E.current)))},[se,P]),pe=(0,_.useCallback)((e,t,n)=>{let r=performance.now(),i=n?80:70,a=ue.current;if(a&&a.notch===n&&r-a.lastAt<=i){a.timer!==null&&window.clearTimeout(a.timer),a.lastAt=r,a.events+=1,a.ratio*=t,a.timer=window.setTimeout(fe,i);return}de(),ue.current={startedAt:r,lastAt:r,events:1,ratio:t,notch:n,anchor:e,startViewport:T.current,timer:window.setTimeout(fe,i)}},[de,fe]);(0,_.useEffect)(()=>()=>{re(),de()},[re,de]),(0,_.useEffect)(()=>{let t=e.current;if(!t)return;let n=e=>{let n=e.ctrlKey||e.metaKey,r=ul(o.current,{now:performance.now(),zooming:n,overTerminal:!!e.target?.closest?.(`.term-host, .note-text`)});if(o.current=r,!n&&r.owner===`terminal`)return;e.preventDefault(),e.stopPropagation(),D();let i=t.getBoundingClientRect(),a={x:e.clientX-i.left,y:e.clientY-i.top};if(n){let t=pl(e.deltaY,e.deltaMode);pe(a,t,dl(e.deltaY,e.deltaMode)),g(qc(h,a,h.zoom*t))}else de(),g({...h,panX:h.panX-e.deltaX,panY:h.panY-e.deltaY})},r={passive:!1,capture:!0};return t.addEventListener(`wheel`,n,r),()=>t.removeEventListener(`wheel`,n,r)},[h,g,D,pe,de]),(0,_.useEffect)(()=>{let e=e=>{if(O.getState().dialog)return;let n=e.target?.closest?.(`.term-host`),r=e.target?.closest?.(`textarea, input`);n||r||(e.key===`0`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),P({panX:0,panY:0,zoom:1})),e.key===`1`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),P(ol([...f.map(e=>e.window),...m],t.w,t.h))),e.key===`2`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),v&&le(v)),e.key===`Escape`&&(O.getState().panelOpen?S(!1):b(null)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[f,m,t,P,b,v,le,S]);let me=oe&&$l(h,oe.applied)?oe.sessionId:null,L=(0,_.useMemo)(()=>el(h,t.w,t.h),[h,t]),he=(0,_.useMemo)(()=>f.filter(e=>tl(L,e.window)),[f,L]),ge=(0,_.useMemo)(()=>m.filter(e=>tl(L,e)),[m,L]),_e=(0,_.useRef)(null),{groups:ve,wsBySession:ye}=(0,_.useMemo)(()=>{let e=[],t=new Map;for(let n of p){let r=Ac(n,f);for(let e of r)t.set(e.id,n);let i=ll(r.map(e=>e.window));i&&e.push({ws:n,box:i,sessionIds:r.map(e=>e.id)})}return{groups:e,wsBySession:t}},[p,f]);return(0,q.jsx)(`div`,{ref:e,className:`canvas${r?` panning`:``}`,onPointerDown:ae,onPointerMove:A,onPointerUp:j,onPointerCancel:j,onDoubleClick:M,children:(0,q.jsxs)(`div`,{className:`world${s?` interacting`:``}`,style:{transform:`translate(${h.panX}px, ${h.panY}px) scale(${h.zoom})`},children:[ve.map(e=>(0,q.jsx)(Jl,{ws:e.ws,box:e.box,sessionIds:e.sessionIds,zoom:h.zoom},e.ws.id)),(0,q.jsx)(ql,{sessions:f}),he.map(e=>(0,q.jsx)(Vl,{session:e,workspace:ye.get(e.id),zoom:h.zoom,dpr:u,renderScale:k,selected:v===e.id,maximized:me===e.id,onMaximize:le},e.id)),ge.map(e=>(0,q.jsx)(Gl,{note:e,zoom:h.zoom,selected:y===e.id,autoFocus:_e.current===e.id},e.id))]})})}var nu=`https://github.com/kdonev/termscape/issues/new`;function ru(e){let t=[`## What happened`,``,``,`## What I expected`,``,``,`## Steps to reproduce`,``,`1. `,``,`---`,``,`- termscape: ${e||`unknown`}`,`- browser: ${navigator.userAgent}`,``].join(`
|
|
108
108
|
`);return`${nu}?body=${encodeURIComponent(t)}`}function iu(){let{messages:e,connected:t,hubVersion:n,panelOpen:r,setPanelOpen:i,sessions:a}=O(w(e=>({messages:e.messages,connected:e.connected,hubVersion:e.hubVersion,panelOpen:e.panelOpen,setPanelOpen:e.setPanelOpen,sessions:e.sessions}))),[o,s]=(0,_.useState)(!1),c=a.filter(e=>e.state===`running`).length;return(0,q.jsxs)(`div`,{className:`toolbar`,children:[(0,q.jsxs)(`div`,{className:`brand`,children:[`Termscape`,(0,q.jsx)(`span`,{className:`conn ${t?`on`:`off`}`,children:t?`v${n}`:`reconnecting…`})]}),(0,q.jsx)(`span`,{className:`spacer`}),(0,q.jsx)(`a`,{className:`btn`,href:ru(n),target:`_blank`,rel:`noreferrer noopener`,title:`Open a pre-filled issue on GitHub. Nothing from this canvas is included.`,children:`report a bug`}),(0,q.jsxs)(`button`,{className:`btn`,onClick:()=>s(e=>!e),children:[`messages (`,e.length,`)`]}),(0,q.jsxs)(`button`,{className:`btn ${r?`primary`:``}`,title:`Machines, workspaces and agents`,onClick:()=>i(!r),children:[`machines · `,c,` running`]}),o&&(0,q.jsx)(au,{})]})}function au(){let e=O(e=>e.messages);return(0,q.jsxs)(`div`,{className:`msg-log`,children:[e.length===0&&(0,q.jsx)(`div`,{className:`msg-empty`,children:`no messages yet`}),e.slice().reverse().map(e=>(0,q.jsxs)(`div`,{className:`msg ${e.deliveryState}`,children:[(0,q.jsxs)(`div`,{className:`msg-head`,children:[(0,q.jsx)(`span`,{className:`from`,children:e.fromAddr}),(0,q.jsx)(`span`,{className:`arrow`,children:`→`}),(0,q.jsx)(`span`,{className:`to`,children:e.toAddr}),(0,q.jsx)(`span`,{className:`when`,children:new Date(e.sentAt).toLocaleTimeString()})]}),(0,q.jsx)(`div`,{className:`msg-body`,children:e.body}),e.error&&(0,q.jsx)(`div`,{className:`msg-error`,children:e.error})]},e.id))]})}function ou(e,t,n){return e===null?t:n[e]??[]}function su(e){return e.available!==!1}function cu(e,t){let n=t.find(t=>t.id===e.agent);return n===void 0||su(n)}function lu(e){if(e.available===!1)return e.detail??`not found: ${e.command}`;if(e.available===null)return`checking…`;let t=[];return e.version&&t.push(e.version),e.models.length>0&&t.push(e.modelSource===`listed`?`${e.models.length} model${e.models.length===1?``:`s`}`:`${e.models.length} known model${e.models.length===1?``:`s`}`),e.mcp||t.push(`no hub wiring`),t.join(` · `)}var uu={connected:`#88c07a`,connecting:`#d8b271`,disconnected:`#7c8596`,error:`#e06c75`};function du(){let{hosts:e,workspaces:t,sessions:n,open:r,setOpen:i,openDialog:a}=O(w(e=>({hosts:e.hosts,workspaces:e.workspaces,sessions:e.sessions,open:e.panelOpen,setOpen:e.setPanelOpen,openDialog:e.openDialog}))),o=Mc(e,t,n);return(0,q.jsxs)(`aside`,{className:`panel ${r?`open`:``}`,"aria-hidden":!r,children:[(0,q.jsxs)(`header`,{className:`panel-head`,children:[(0,q.jsx)(`span`,{className:`panel-title`,children:`canvas`}),(0,q.jsx)(`span`,{className:`spacer`}),(0,q.jsx)(`button`,{className:`btn`,title:`Close`,onClick:()=>i(!1),children:`›`})]}),(0,q.jsxs)(`div`,{className:`panel-body`,children:[o.map(e=>(0,q.jsx)(fu,{machine:e},e.id||`local`)),(0,q.jsx)(`button`,{className:`btn add-machine`,onClick:()=>a({kind:`addMachine`}),children:`+ machine`}),(0,q.jsx)(pu,{})]})]})}function fu({machine:e}){let{client:t,hostLogs:n,openDialog:r,profiles:i,hostProfiles:a}=O(w(e=>({client:e.client,hostLogs:e.hostLogs,openDialog:e.openDialog,profiles:e.profiles,hostProfiles:e.hostProfiles}))),[o,s]=(0,_.useState)(!1),c=e.host,l=ou(e.id||null,i,a),u=c?n[c.id]??[]:[],d=e.workspaces.reduce((e,t)=>e+t.sessions.length,0);return(0,q.jsxs)(`div`,{className:`node-group`,children:[(0,q.jsxs)(`div`,{className:`node machine`,children:[(0,q.jsx)(vu,{collapsed:o,onClick:()=>s(e=>!e)}),(0,q.jsx)(`span`,{className:`dot`,style:{background:uu[e.state]??`#7c8596`}}),(0,q.jsx)(`span`,{className:`node-label`,children:e.label}),e.sub&&(0,q.jsx)(`span`,{className:`node-sub`,children:e.sub}),(0,q.jsx)(`span`,{className:`spacer`}),(0,q.jsx)(`button`,{className:`btn`,title:`Add a workspace on ${e.label}`,onClick:()=>{s(!1),r({kind:`addWorkspace`,hostId:e.id||null})},children:`+ workspace`}),c&&(0,q.jsx)(`button`,{className:`btn`,title:`Rename ${e.label} or fix how it is reached`,onClick:()=>r({kind:`editMachine`,hostId:c.id}),children:`edit`}),c?.kind===`ssh`&&(0,q.jsx)(`button`,{className:`btn`,title:`Reconnect and redeploy if needed`,onClick:()=>t?.send({t:`connectHost`,hostId:c.id}),children:e.state===`connected`?`reconnect`:`connect`}),c&&(0,q.jsx)(`button`,{className:`btn danger`,title:`Remove this machine`,onClick:()=>{let t=[e.workspaces.length>0&&`${e.workspaces.length} workspace${e.workspaces.length===1?``:`s`}`,d>0&&`${d} agent${d===1?``:`s`}`].filter(Boolean),n=t.length>0?` Its ${t.join(` and `)} go with it.`:``;r({kind:`confirm`,title:`Remove ${e.label}?`,body:`It leaves the canvas and the hub running there is stopped too.${n}`,confirmLabel:`remove machine`,send:{t:`removeHost`,hostId:c.id}})},children:`×`})]}),c?.error&&(0,q.jsx)(`div`,{className:`node-error`,children:c.error}),!o&&l.length>0&&(0,q.jsx)(`div`,{className:`node-agents`,children:l.map(e=>(0,q.jsxs)(`span`,{className:`agent-chip ${e.available===!1?`off`:``} ${e.available===null?`unknown`:``}`,title:lu(e),children:[e.id,e.version&&(0,q.jsx)(`em`,{children:e.version})]},e.id))}),e.state===`connecting`&&u.length>0&&(0,q.jsx)(`div`,{className:`node-log`,children:u.map((e,t)=>(0,q.jsx)(`div`,{children:e},t))}),!o&&(0,q.jsxs)(`div`,{className:`node-children`,children:[e.workspaces.map(e=>(0,q.jsx)(hu,{node:e},e.workspace.id)),e.workspaces.length===0&&(0,q.jsx)(`div`,{className:`node-empty`,children:`no workspaces here yet`})]})]})}function pu(){let{templates:e,proposals:t,openDialog:n,client:r}=O(w(e=>({templates:e.templates,proposals:e.templateProposals,openDialog:e.openDialog,client:e.client}))),[i,a]=(0,_.useState)(!0),o=!i||t.length>0,s=[...e].sort((e,t)=>{let n=e=>+(e.source===`derived`);return n(e)-n(t)||e.id.localeCompare(t.id)}),c=e.filter(e=>e.source!==`derived`).length;return(0,q.jsxs)(`div`,{className:`node-group`,children:[(0,q.jsxs)(`div`,{className:`node root`,children:[(0,q.jsx)(vu,{collapsed:i,onClick:()=>a(e=>!e)}),(0,q.jsx)(`span`,{className:`node-label`,children:`templates`}),(0,q.jsx)(`span`,{className:`node-sub`,children:t.length>0?`${t.length} waiting on you`:c>0?`${c} of your own`:`one per agent`}),(0,q.jsx)(`span`,{className:`spacer`}),(0,q.jsx)(`button`,{className:`btn`,title:`Make a template: an agent plus a model, an effort and a first task`,onClick:()=>{a(!1),n({kind:`saveTemplate`,id:null})},children:`+ template`})]}),o&&(0,q.jsxs)(`div`,{className:`node-children`,children:[t.map(e=>(0,q.jsx)(`div`,{className:`node-group`,children:(0,q.jsxs)(`div`,{className:`node template`,children:[(0,q.jsx)(`span`,{className:`node-label`,children:e.template.id}),(0,q.jsxs)(`span`,{className:`node-sub`,children:[`proposed by `,e.fromAddr]}),(0,q.jsx)(`span`,{className:`spacer`}),(0,q.jsx)(`button`,{className:`btn`,title:`Review the template ${e.fromAddr} asked for`,onClick:()=>n({kind:`reviewTemplate`,proposalId:e.id}),children:`review`}),(0,q.jsx)(`button`,{className:`btn danger`,title:`Tell ${e.fromAddr} no`,onClick:()=>r?.send({t:`resolveTemplateProposal`,proposalId:e.id,accept:!1}),children:`×`})]})},e.id)),s.map(e=>(0,q.jsx)(mu,{template:e},e.id))]})]})}function mu({template:e}){let t=O(e=>e.openDialog),n=[e.model,e.effort].filter(Boolean).join(`, `),r=e.source===`file`;return(0,q.jsxs)(`div`,{className:`node-group`,children:[(0,q.jsxs)(`div`,{className:`node template`,children:[(0,q.jsx)(`span`,{className:`node-label`,children:e.id}),(0,q.jsxs)(`span`,{className:`node-sub`,children:[e.agent,n&&` · ${n}`,e.source===`derived`&&` · built in`,r&&` · agents.toml`]}),(0,q.jsx)(`span`,{className:`spacer`}),!r&&(0,q.jsx)(`button`,{className:`btn`,title:e.source===`derived`?`Make a template based on ${e.agent}`:`Edit ${e.id}`,onClick:()=>t({kind:`saveTemplate`,id:e.id}),children:`edit`}),e.source===`stored`&&(0,q.jsx)(`button`,{className:`btn danger`,title:`Remove ${e.id}`,onClick:()=>t({kind:`confirm`,title:`Remove ${e.id}?`,body:`Agents already started from it keep their model, their effort and their ability to resume. Only the next agent is affected.`,confirmLabel:`remove template`,send:{t:`removeTemplate`,id:e.id}}),children:`×`})]}),e.error&&(0,q.jsx)(`div`,{className:`node-error`,children:e.error})]})}function hu({node:e}){let{client:t,openDialog:n}=O(w(e=>({client:e.client,openDialog:e.openDialog}))),[r,i]=(0,_.useState)(!1),{workspace:a,sessions:o}=e,s=o.filter(e=>e.state!==`running`);return(0,q.jsxs)(`div`,{className:`node-group`,children:[(0,q.jsxs)(`div`,{className:`node workspace`,children:[(0,q.jsx)(vu,{collapsed:r,onClick:()=>i(e=>!e)}),(0,q.jsx)(`span`,{className:`node-label`,children:a.name}),(0,q.jsx)(`span`,{className:`node-sub`,title:a.rootPath,children:a.rootPath}),(0,q.jsx)(`span`,{className:`spacer`}),(0,q.jsx)(`button`,{className:`btn`,title:`Start an agent in this workspace`,onClick:()=>{i(!1),n({kind:`startAgent`,workspaceId:a.id})},children:`+ agent`}),(0,q.jsx)(`button`,{className:`btn`,title:`Rename this workspace or point it at another folder`,onClick:()=>n({kind:`editWorkspace`,workspaceId:a.id}),children:`edit`}),s.length>0&&(0,q.jsxs)(`button`,{className:`btn`,title:`Relaunch every stopped agent here with its prior conversation`,onClick:()=>t?.send({t:`resumeWorkspace`,workspaceId:a.id}),children:[`resume all (`,s.length,`)`]}),(0,q.jsx)(`button`,{className:`btn danger`,title:`Remove this workspace`,onClick:()=>{let e=o.length,t=e>0?` Its ${e} agent${e===1?``:`s`} go with it.`:` It has nothing running in it.`;n({kind:`confirm`,title:`Remove ${a.name}?`,body:`The folder itself is untouched; only the workspace leaves the canvas.${t}`,confirmLabel:`remove workspace`,send:{t:`removeWorkspace`,workspaceId:a.id}})},children:`×`})]}),!r&&(0,q.jsxs)(`div`,{className:`node-children`,children:[o.map(e=>(0,q.jsx)(gu,{session:e},e.id)),o.length===0&&(0,q.jsx)(`div`,{className:`node-empty`,children:`nothing running here`})]})]})}function gu({session:e}){let{client:t,selectedId:n,requestFocus:r,openDialog:i}=O(w(e=>({client:e.client,selectedId:e.selectedId,requestFocus:e.requestFocus,openDialog:e.openDialog}))),a=e.state!==`running`;return(0,q.jsxs)(`div`,{className:`node session ${n===e.id?`on`:``}`,onClick:()=>r(e.id),children:[(0,q.jsx)(`span`,{className:`dot`,style:{background:Z(e)}}),(0,q.jsx)(`span`,{className:`node-label`,title:_u(e),children:e.title||e.name}),(0,q.jsx)(`span`,{className:`node-sub`,children:e.statusText??Rl(e)}),e.model&&(0,q.jsx)(`span`,{className:`node-tag`,children:e.model}),e.effort&&(0,q.jsx)(`span`,{className:`node-tag`,children:e.effort}),(0,q.jsx)(`span`,{className:`spacer`}),(0,q.jsx)(`button`,{className:`btn`,title:a?e.resumable?`Relaunch with its previous conversation`:`Restart this session`:`Stop this agent`,onClick:n=>{n.stopPropagation(),t?.send(a?{t:`resumeSession`,sessionId:e.id}:{t:`stopSession`,sessionId:e.id})},children:a?e.resumable?`resume`:`restart`:`stop`}),(0,q.jsx)(`button`,{className:`btn danger`,title:`Remove this window and forget the session`,onClick:t=>{t.stopPropagation(),i({kind:`confirm`,title:`Remove ${e.address}?`,body:a?`Its window and its record go; the conversation it was resuming from is not deleted.`:`It is stopped and its window goes with it. The conversation itself is not deleted.`,confirmLabel:`remove agent`,send:{t:`removeSession`,sessionId:e.id}})},children:`×`})]})}function _u(e){let t=[e.template,e.model,e.effort].filter(Boolean).join(` · `);return t?`${e.address}\n${t}`:e.address}function vu({collapsed:e,onClick:t}){return(0,q.jsx)(`button`,{className:`twisty`,"aria-label":e?`Expand`:`Collapse`,onClick:t,children:e?`▸`:`▾`})}function yu(e,t,n=!1){return t.some(t=>t.id===e)?e:n?t[0]?.id??``:``}function bu({title:e,children:t}){let n=O(e=>e.closeDialog),r=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let e=r.current;if(e)return e.open||e.showModal(),e.querySelector(`.dialog-body input:not(:disabled), .dialog-body select:not(:disabled), .dialog-body textarea:not(:disabled)`)?.focus(),()=>{e.open&&e.close()}},[]),(0,q.jsx)(`dialog`,{className:`dialog`,ref:r,onClose:n,onClick:e=>{e.target===r.current&&r.current?.close()},children:(0,q.jsxs)(`div`,{className:`dialog-card`,children:[(0,q.jsxs)(`header`,{className:`dialog-head`,children:[(0,q.jsx)(`h2`,{className:`dialog-title`,children:e}),(0,q.jsx)(`span`,{className:`spacer`}),(0,q.jsx)(`button`,{className:`btn`,type:`button`,"aria-label":`Close`,onClick:()=>r.current?.close(),children:`×`})]}),t]})})}function xu({submitLabel:e,cancelLabel:t=`cancel`,canSubmit:n=!0,danger:r=!1,secondary:i,onSubmit:a,children:o}){let s=O(e=>e.closeDialog),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(null),f=(0,_.useRef)(!0);(0,_.useEffect)(()=>()=>void(f.current=!1),[]);let p=(0,_.useCallback)(async e=>{if(e.preventDefault(),!c&&n){l(!0),d(null);try{await a(),f.current&&s()}catch(e){f.current&&(d(e.message),l(!1))}}},[c,n,a,s]);return(0,q.jsxs)(`form`,{className:`dialog-body`,onSubmit:p,children:[o,u&&(0,q.jsx)(`p`,{className:`dialog-error`,role:`alert`,children:u}),(0,q.jsxs)(`footer`,{className:`dialog-actions`,children:[(0,q.jsx)(`button`,{className:`btn`,type:`button`,onClick:s,children:t}),i&&(0,q.jsx)(`button`,{className:`btn`,type:`button`,disabled:c,onClick:()=>{l(!0),d(null),i.onClick().then(()=>f.current&&s(),e=>{f.current&&(d(e.message),l(!1))})},children:i.label}),(0,q.jsx)(`button`,{className:`btn ${r?`danger-solid`:`primary`}`,type:`submit`,disabled:c||!n,children:c?`working…`:e})]})]})}function Su({label:e,hint:t,children:n}){return(0,q.jsxs)(`label`,{className:`dialog-field`,children:[(0,q.jsx)(`span`,{className:`dialog-label`,children:e}),n,t&&(0,q.jsx)(`span`,{className:`dialog-hint`,children:t})]})}function Cu(){let{enrollUrl:e,enrollAltUrl:t}=O(w(e=>({enrollUrl:e.enrollUrl,enrollAltUrl:e.enrollAltUrl}))),n=O(e=>e.closeDialog),[r,i]=(0,_.useState)(!1);return(0,q.jsxs)(`div`,{className:`dialog-body`,children:[e?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`dialog-note`,children:`Open this on the machine you want to add. It installs the hub there and connects back on its own.`}),(0,q.jsxs)(`div`,{className:`join-url`,children:[(0,q.jsx)(`code`,{children:e}),(0,q.jsx)(`button`,{className:`btn`,type:`button`,onClick:()=>{navigator.clipboard?.writeText(e),i(!0),setTimeout(()=>i(!1),1500)},children:r?`copied`:`copy`})]}),t&&(0,q.jsxs)(`p`,{className:`dialog-note`,children:[`If that machine cannot resolve this one by name, use `,(0,q.jsx)(`code`,{children:t}),` `,`instead.`]}),(0,q.jsx)(`p`,{className:`dialog-note`,children:`It needs Node 22 or newer. Its agents keep running if the link drops, and it rejoins by itself.`})]}):(0,q.jsxs)(`p`,{className:`dialog-note`,children:[`This hub has no join page. Either it was started with`,` `,(0,q.jsx)(`code`,{children:`--listen loopback`}),`, or this machine has no network address another machine could reach it on — the hub's own startup banner says which. Use the`,` `,(0,q.jsx)(`strong`,{children:`ssh`}),` tab meanwhile: it needs no join page, only a machine you can reach.`]}),(0,q.jsx)(`footer`,{className:`dialog-actions`,children:(0,q.jsx)(`button`,{className:`btn`,type:`button`,onClick:n,children:`close`})})]})}function wu(){let e=O(e=>e.client),[t,n]=(0,_.useState)(``),[r,i]=(0,_.useState)(``),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(`22`),[l,u]=(0,_.useState)(``);return(0,q.jsxs)(xu,{submitLabel:`add machine`,canSubmit:a.trim().length>0&&r.trim().length>0,onSubmit:()=>e?e.request({t:`addHost`,label:t.trim(),sshHost:a.trim(),sshUser:r.trim(),sshPort:Number(s)||22,privateKeyPath:l.trim()||void 0}):Promise.reject(Error(`not connected to the hub`)),children:[(0,q.jsxs)(`div`,{className:`dialog-row`,children:[(0,q.jsx)(Su,{label:`user`,children:(0,q.jsx)(`input`,{className:`input`,value:r,onChange:e=>i(e.target.value)})}),(0,q.jsx)(Su,{label:`host`,children:(0,q.jsx)(`input`,{className:`input`,value:a,onChange:e=>o(e.target.value)})}),(0,q.jsx)(Su,{label:`port`,children:(0,q.jsx)(`input`,{className:`input tiny`,value:s,onChange:e=>c(e.target.value)})})]}),(0,q.jsx)(Su,{label:`label`,hint:`Optional. Defaults to user@host.`,children:(0,q.jsx)(`input`,{className:`input`,value:t,onChange:e=>n(e.target.value)})}),(0,q.jsx)(Su,{label:`private key`,hint:`Leave blank to use your ssh agent.`,children:(0,q.jsx)(`input`,{className:`input`,placeholder:`path to a private key`,value:l,onChange:e=>u(e.target.value)})}),(0,q.jsx)(`p`,{className:`dialog-note`,children:`The hub is deployed over ssh and listens only on that machine's loopback interface, reached through the tunnel. Its agents keep running if the connection drops. The connection is made as soon as you add it.`})]})}function Tu(){let e=O(e=>e.dialog);return e?(0,q.jsx)(Du,{spec:e},Eu(e)):null}function Eu(e){switch(e.kind){case`addWorkspace`:return`addWorkspace:${e.hostId??``}`;case`editWorkspace`:return`editWorkspace:${e.workspaceId}`;case`startAgent`:return`startAgent:${e.workspaceId}`;case`saveTemplate`:return`saveTemplate:${e.id??`(new)`}`;case`reviewTemplate`:return`reviewTemplate:${e.proposalId}`;case`addMachine`:return`addMachine`;case`editMachine`:return`editMachine:${e.hostId}`;case`share`:return`share:${e.sessionId}`;case`confirm`:return`confirm:${e.title}`}}function Du({spec:e}){switch(e.kind){case`addWorkspace`:return(0,q.jsx)(ku,{hostId:e.hostId});case`editWorkspace`:return(0,q.jsx)(Au,{workspaceId:e.workspaceId});case`startAgent`:return(0,q.jsx)(ju,{workspaceId:e.workspaceId});case`saveTemplate`:return(0,q.jsx)(Nu,{id:e.id});case`reviewTemplate`:return(0,q.jsx)(Iu,{proposalId:e.proposalId});case`addMachine`:return(0,q.jsx)(Lu,{});case`editMachine`:return(0,q.jsx)(Ru,{hostId:e.hostId});case`share`:return(0,q.jsx)(zu,{sessionId:e.sessionId});case`confirm`:return(0,q.jsx)(Bu,{spec:e})}}function Ou(){let e=O(e=>e.client);return t=>e?e.request(t):Promise.reject(Error(`not connected to the hub`))}function ku({hostId:e}){let t=Ou(),n=O(e=>e.hosts),r=e?n.find(t=>t.id===e)??null:null,i=r?r.label:`this machine`,a=!r||r.state===`connected`,[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(``),u=r?.platform?.startsWith(`win32`)??!1,d=r?u?`C:\\Users\\you\\project`:`/Users/you/project`:`folder path`;return(0,q.jsx)(bu,{title:`Add a workspace on ${i}`,children:(0,q.jsxs)(xu,{submitLabel:`add workspace`,canSubmit:o.trim().length>0&&a,onSubmit:async()=>{await t({t:`checkFolder`,hostId:e,path:o.trim()}),await t({t:`createWorkspace`,name:c.trim()||o.trim(),rootPath:o.trim(),hostId:e})},children:[(0,q.jsx)(Su,{label:`folder`,hint:r?`A path as ${r.label} sees it — checked on that machine, not this one.`:`An absolute path, or one relative to where the hub was started.`,children:(0,q.jsx)(`input`,{className:`input`,placeholder:d,value:o,onChange:e=>s(e.target.value)})}),(0,q.jsx)(Su,{label:`name`,hint:`Optional, and lowercased and hyphenated because it becomes the first half of every agent address here. Taken from the folder if you leave it.`,children:(0,q.jsx)(`input`,{className:`input`,placeholder:`from the folder name`,value:c,onChange:e=>l(e.target.value)})}),!a&&(0,q.jsxs)(`p`,{className:`dialog-note`,children:[i,` is `,r?.state??`not connected`,`. Connect it before adding a workspace there.`]})]})})}function Au({workspaceId:e}){let t=Ou(),{workspaces:n,sessions:r}=O(w(e=>({workspaces:e.workspaces,sessions:e.sessions}))),i=n.find(t=>t.id===e),a=i?Ac(i,r):[],[o,s]=(0,_.useState)(i?.name??``),[c,l]=(0,_.useState)(i?.rootPath??``);if(!i)return(0,q.jsx)(Vu,{what:`workspace`});let u=a.length>0,d=c.trim()!==i.rootPath,f=o.trim()!==i.name||d;return(0,q.jsx)(bu,{title:`Edit ${i.name}`,children:(0,q.jsxs)(xu,{submitLabel:`save`,canSubmit:f&&o.trim().length>0&&c.trim().length>0,onSubmit:async()=>{d&&await t({t:`checkFolder`,hostId:i.hostId,path:c.trim()}),await t({t:`updateWorkspace`,workspaceId:e,name:o.trim(),rootPath:c.trim()})},children:[(0,q.jsx)(Su,{label:`name`,hint:u?`Locked: ${a.length} agent${a.length===1?``:`s`} here are addressed as ${i.name}/…, so renaming would change what they were told they are called. Remove them first.`:`The first half of every agent address here.`,children:(0,q.jsx)(`input`,{className:`input`,value:o,disabled:u,onChange:e=>s(e.target.value)})}),(0,q.jsx)(Su,{label:`folder`,hint:`Agents already running keep the folder they started in; this is where the next ones begin.`,children:(0,q.jsx)(`input`,{className:`input`,value:c,onChange:e=>l(e.target.value)})})]})})}function ju({workspaceId:e}){let t=Ou(),{workspaces:n,profiles:r,templates:i,hostProfiles:a}=O(w(e=>({workspaces:e.workspaces,profiles:e.profiles,templates:e.templates,hostProfiles:e.hostProfiles}))),o=O(e=>e.client),s=O(e=>e.requestFocus),c=n.find(t=>t.id===e),l=c?.hostId??null,u=ou(l,r,a),d=i.filter(e=>!e.error&&cu(e,u)),[f,p]=(0,_.useState)(`claude`),m=yu(f,d,!0),h=d.find(e=>e.id===m),g=u.find(e=>e.id===h?.agent),[v,y]=(0,_.useState)(``),[b,x]=(0,_.useState)(``),[S,C]=(0,_.useState)(``),T=i.filter(e=>e.error),ee=u.filter(e=>e.available===!1);return(0,q.jsx)(bu,{title:`Start an agent in ${c?.name??`this workspace`}`,children:(0,q.jsxs)(xu,{submitLabel:`start`,canSubmit:!!m,onSubmit:async()=>{let n=await t({t:`startSession`,workspaceId:e,profile:m,model:v.trim()||void 0,effort:b.trim()||void 0,prompt:S.trim()||void 0});n.sessionId&&s(n.sessionId)},children:[(0,q.jsx)(Su,{label:`template`,hint:Mu(h,g),children:(0,q.jsx)(`select`,{className:`input`,value:m,onChange:e=>p(e.target.value),children:d.map(e=>(0,q.jsxs)(`option`,{value:e.id,children:[e.id,e.id===e.agent?``:` — ${e.agent}`]},e.id))})}),g&&(g.takesModel||g.takesEffort)&&(0,q.jsxs)(`div`,{className:`dialog-row`,children:[g.takesModel&&(0,q.jsxs)(Su,{label:`model`,hint:h?.model?`${h.id} uses ${h.model}.`:g.modelSource===`listed`?`${g.models.length} to choose from.`:`Or a full model name.`,children:[(0,q.jsx)(`input`,{className:`input`,list:`models-${g.id}`,placeholder:h?.model??`the agent's default`,value:v,onChange:e=>y(e.target.value)}),(0,q.jsx)(`datalist`,{id:`models-${g.id}`,children:g.models.map(e=>(0,q.jsx)(`option`,{value:e},e))})]}),g.takesEffort&&(0,q.jsxs)(Su,{label:`effort`,hint:h?.effort?`${h.id} uses ${h.effort}.`:void 0,children:[(0,q.jsx)(`input`,{className:`input`,list:`efforts-${g.id}`,placeholder:h?.effort??`default`,value:b,onChange:e=>x(e.target.value)}),(0,q.jsx)(`datalist`,{id:`efforts-${g.id}`,children:g.efforts.map(e=>(0,q.jsx)(`option`,{value:e},e))})]})]}),(0,q.jsx)(Su,{label:`first instruction`,hint:`Typed into the terminal once the CLI is up, not passed as an argument. It does not repeat when the session is resumed.`,children:(0,q.jsx)(`textarea`,{className:`input`,rows:3,placeholder:h?.prompt??`optional`,value:S,onChange:e=>C(e.target.value)})}),T.length>0&&(0,q.jsxs)(`p`,{className:`dialog-note`,children:[`Not offered, from `,(0,q.jsx)(`code`,{children:`agents.toml`}),`:`,` `,T.map(e=>`${e.id} (${e.error})`).join(`; `),`.`]}),ee.length>0&&(0,q.jsxs)(`p`,{className:`dialog-note`,children:[`Not on `,l?`that machine's`:`this machine's`,` PATH:`,` `,ee.map(e=>e.command).join(`, `),`.`]}),(0,q.jsxs)(`p`,{className:`dialog-note`,children:[c?`Runs in ${c.rootPath}. `:``,(0,q.jsx)(`button`,{className:`link`,type:`button`,onClick:()=>o?.send({t:`refreshAgents`}),children:`check again`}),` `,`if you have just installed an agent.`]})]})})}function Mu(e,t){if(!e)return;let n=[e.id===e.agent?null:`Runs ${e.agent}.`];return t&&n.push(lu(t)),n.filter(Boolean).join(` `)||void 0}function Nu({id:e,proposal:t}){let n=Ou(),{templates:r,profiles:i}=O(w(e=>({templates:e.templates,profiles:e.profiles}))),a=e?r.find(t=>t.id===e)??null:null,o=t?.template??a,[s,c]=(0,_.useState)(o?.id??``),[l,u]=(0,_.useState)(o?.agent??i[0]?.id??`claude`),[d,f]=(0,_.useState)(o?.description??``),[p,m]=(0,_.useState)(o?.model??``),[h,g]=(0,_.useState)(o?.effort??``),[v,y]=(0,_.useState)(o?.prompt??``),[b,x]=(0,_.useState)(()=>Pu(a?.env)),S=i.find(e=>e.id===l),C={id:s.trim(),agent:l,description:d.trim()||null,model:p.trim()||null,effort:h.trim()||null,prompt:v.trim()||null,env:Fu(b)};return(0,q.jsx)(bu,{title:t?`${t.fromAddr} proposes a template`:a?`Edit ${a.id}`:`New template`,children:(0,q.jsxs)(xu,{submitLabel:t?`add template`:a?`save template`:`add template`,cancelLabel:t?`decide later`:`cancel`,canSubmit:s.trim().length>0&&!!S,secondary:t?{label:`decline`,onClick:()=>n({t:`resolveTemplateProposal`,proposalId:t.id,accept:!1})}:void 0,onSubmit:()=>n(t?{t:`resolveTemplateProposal`,proposalId:t.id,accept:!0,...C}:{t:`saveTemplate`,...C}),children:[t&&(0,q.jsxs)(`p`,{className:`dialog-note`,children:[(0,q.jsx)(`code`,{children:t.fromAddr}),` asked for this. Nothing has been saved yet, and you can change any of it first — it is a suggestion, not a request to rubber-stamp. Agents already running are unaffected either way.`,(0,q.jsx)(`br`,{}),(0,q.jsx)(`strong`,{children:`decline`}),` tells the agent no. `,(0,q.jsx)(`strong`,{children:`decide later`}),` `,`just closes this — the proposal stays in the panel under `,(0,q.jsx)(`em`,{children:`templates`}),`, and the agent cannot propose anything else while it waits.`]}),(0,q.jsx)(Su,{label:`name`,hint:t?`Rename it if you would rather it were called something else.`:a?a.source===`derived`?`Saving makes a stored template that shadows ${a.agent}'s own.`:`The name is how it is picked; to rename one, make a new one and remove this.`:`What you will pick from the list when starting an agent.`,children:(0,q.jsx)(`input`,{className:`input`,placeholder:`reviewer`,value:s,readOnly:!!a&&!t,onChange:e=>c(e.target.value)})}),(0,q.jsx)(Su,{label:`agent`,hint:S?S.description:void 0,children:(0,q.jsx)(`select`,{className:`input`,value:l,onChange:e=>u(e.target.value),children:i.map(e=>(0,q.jsx)(`option`,{value:e.id,children:e.id},e.id))})}),S&&(S.takesModel||S.takesEffort)&&(0,q.jsxs)(`div`,{className:`dialog-row`,children:[S.takesModel&&(0,q.jsxs)(Su,{label:`model`,hint:S.modelSource===`listed`?`${S.models.length} to choose from.`:`Or a full model name.`,children:[(0,q.jsx)(`input`,{className:`input`,list:`tpl-models-${S.id}`,placeholder:`the agent's default`,value:p,onChange:e=>m(e.target.value)}),(0,q.jsx)(`datalist`,{id:`tpl-models-${S.id}`,children:S.models.map(e=>(0,q.jsx)(`option`,{value:e},e))})]}),S.takesEffort&&(0,q.jsxs)(Su,{label:`effort`,children:[(0,q.jsx)(`input`,{className:`input`,list:`tpl-efforts-${S.id}`,placeholder:`default`,value:h,onChange:e=>g(e.target.value)}),(0,q.jsx)(`datalist`,{id:`tpl-efforts-${S.id}`,children:S.efforts.map(e=>(0,q.jsx)(`option`,{value:e},e))})]})]}),(0,q.jsx)(Su,{label:`description`,hint:`Shown beside the name in the picker.`,children:(0,q.jsx)(`input`,{className:`input`,placeholder:S?.description??`optional`,value:d,onChange:e=>f(e.target.value)})}),(0,q.jsx)(Su,{label:`first instruction`,hint:`Typed into the terminal once the CLI is up. It does not repeat when a session is resumed.`,children:(0,q.jsx)(`textarea`,{className:`input`,rows:3,placeholder:`optional`,value:v,onChange:e=>y(e.target.value)})}),(0,q.jsx)(Su,{label:`environment`,hint:`One NAME=value per line, set for this template's agents on top of whatever the CLI already gets. Blank lines and # comments are ignored.`,children:(0,q.jsx)(`textarea`,{className:`input`,rows:3,spellCheck:!1,placeholder:`optional
|
|
109
109
|
ANTHROPIC_BASE_URL=https://proxy.internal`,value:b,onChange:e=>x(e.target.value)})})]})})}function Pu(e){return e?Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`
|
|
110
110
|
`):``}function Fu(e){let t={};for(let n of e.split(`
|