@telepath-computer/television 0.1.67 → 0.1.69

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.
@@ -1,9 +1,9 @@
1
- var xb=Object.defineProperty;var Yh=n=>{throw TypeError(n)};var Ab=(n,e,t)=>e in n?xb(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var b=(n,e,t)=>Ab(n,typeof e!="symbol"?e+"":e,t),Sl=(n,e,t)=>e.has(n)||Yh("Cannot "+t);var c=(n,e,t)=>(Sl(n,e,"read from private field"),t?t.call(n):e.get(n)),w=(n,e,t)=>e.has(n)?Yh("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),E=(n,e,t,r)=>(Sl(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),v=(n,e,t)=>(Sl(n,e,"access private method"),t);var Xh=(n,e,t,r)=>({set _(i){E(n,e,i,t)},get _(){return c(n,e,r)}});(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();var On=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $b(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var Kh=Object.prototype.toString,jf=function(e){var t=Kh.call(e),r=t==="[object Arguments]";return r||(r=t!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Kh.call(e.callee)==="[object Function]"),r},_l,Jh;function Tb(){if(Jh)return _l;Jh=1;var n;if(!Object.keys){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=jf,i=Object.prototype.propertyIsEnumerable,s=!i.call({toString:null},"toString"),o=i.call(function(){},"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(g){var m=g.constructor;return m&&m.prototype===g},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},h=function(){if(typeof window>"u")return!1;for(var g in window)try{if(!u["$"+g]&&e.call(window,g)&&window[g]!==null&&typeof window[g]=="object")try{l(window[g])}catch{return!0}}catch{return!0}return!1}(),p=function(g){if(typeof window>"u"||!h)return l(g);try{return l(g)}catch{return!1}};n=function(m){var A=m!==null&&typeof m=="object",k=t.call(m)==="[object Function]",I=r(m),U=A&&t.call(m)==="[object String]",P=[];if(!A&&!k&&!I)throw new TypeError("Object.keys called on a non-object");var V=o&&k;if(U&&m.length>0&&!e.call(m,0))for(var O=0;O<m.length;++O)P.push(String(O));if(I&&m.length>0)for(var H=0;H<m.length;++H)P.push(String(H));else for(var F in m)!(V&&F==="prototype")&&e.call(m,F)&&P.push(String(F));if(s)for(var ce=p(m),ue=0;ue<a.length;++ue)!(ce&&a[ue]==="constructor")&&e.call(m,a[ue])&&P.push(a[ue]);return P}}return _l=n,_l}var Cb=Array.prototype.slice,Ib=jf,Qh=Object.keys,Zo=Qh?function(e){return Qh(e)}:Tb(),ed=Object.keys;Zo.shim=function(){if(Object.keys){var e=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);e||(Object.keys=function(r){return Ib(r)?ed(Cb.call(r)):ed(r)})}else Object.keys=Zo;return Object.keys||Zo};var Pb=Zo,Ho=Object.defineProperty||!1;if(Ho)try{Ho({},"a",{value:1})}catch{Ho=!1}var Xs=Ho,Qt=SyntaxError,j=TypeError,Rb=Object.getOwnPropertyDescriptor,Bo=Rb;if(Bo)try{Bo([],"length")}catch{Bo=null}var gi=Bo,td=Xs,Db=Qt,$r=j,nd=gi,qf=function(e,t,r){if(!e||typeof e!="object"&&typeof e!="function")throw new $r("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new $r("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new $r("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new $r("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new $r("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new $r("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,l=!!nd&&nd(e,t);if(td)td(e,t,{configurable:o===null&&l?l.configurable:!o,enumerable:i===null&&l?l.enumerable:!i,value:r,writable:s===null&&l?l.writable:!s});else if(a||!i&&!s&&!o)e[t]=r;else throw new Db("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},yc=Xs,Yf=function(){return!!yc};Yf.hasArrayLengthDefineBug=function(){if(!yc)return null;try{return yc([],"length",{value:1}).length!==1}catch{return!0}};var Ga=Yf,Ob=Pb,Lb=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",zb=Object.prototype.toString,Mb=Array.prototype.concat,rd=qf,Nb=function(n){return typeof n=="function"&&zb.call(n)==="[object Function]"},Xf=Ga(),Ub=function(n,e,t,r){if(e in n){if(r===!0){if(n[e]===t)return}else if(!Nb(r)||!r())return}Xf?rd(n,e,t,!0):rd(n,e,t)},Kf=function(n,e){var t=arguments.length>2?arguments[2]:{},r=Ob(e);Lb&&(r=Mb.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i<r.length;i+=1)Ub(n,r[i],e[r[i]],t[r[i]])};Kf.supportsDescriptors=!!Xf;var vr=Kf,Go={exports:{}};typeof self<"u"?Go.exports=self:typeof window<"u"?Go.exports=window:Go.exports=Function("return this")();var Jf=Go.exports,Fb=Jf,Qf=function(){return typeof On!="object"||!On||On.Math!==Math||On.Array!==Array?Fb:On},Zb=vr,Hb=gi,Bb=Qf,Gb=function(){var e=Bb();if(Zb.supportsDescriptors){var t=Hb(e,"globalThis");(!t||t.configurable&&(t.enumerable||!t.writable||globalThis!==e))&&Object.defineProperty(e,"globalThis",{configurable:!0,enumerable:!1,value:e,writable:!0})}else(typeof globalThis!="object"||globalThis!==e)&&(e.globalThis=e);return e},Vb=vr,Wb=Jf,eg=Qf,jb=Gb,qb=eg(),tg=function(){return qb};Vb(tg,{getPolyfill:eg,implementation:Wb,shim:jb});var Su=tg,en=function(e){return!!e&&(typeof e=="function"||typeof e=="object")},_u=Object,ng=Error,Yb=EvalError,Xb=RangeError,ku=ReferenceError,Kb=URIError,Jb=Math.abs,Qb=Math.floor,ew=Math.max,tw=Math.min,nw=Math.pow,rw=Math.round,Eu=Number.isNaN||function(e){return e!==e},iw=Eu,sw=function(e){return iw(e)||e===0?e:e<0?-1:1},mi=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),r=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var i=42;e[t]=i;for(var s in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,t);if(a.value!==i||a.enumerable!==!0)return!1}return!0},id=typeof Symbol<"u"&&Symbol,ow=mi,xu=function(){return typeof id!="function"||typeof Symbol!="function"||typeof id("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:ow()},kl,sd;function rg(){return sd||(sd=1,kl=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),kl}var El,od;function ig(){if(od)return El;od=1;var n=_u;return El=n.getPrototypeOf||null,El}var aw="Function.prototype.bind called on incompatible ",lw=Object.prototype.toString,cw=Math.max,uw="[object Function]",ad=function(e,t){for(var r=[],i=0;i<e.length;i+=1)r[i]=e[i];for(var s=0;s<t.length;s+=1)r[s+e.length]=t[s];return r},hw=function(e,t){for(var r=[],i=t,s=0;i<e.length;i+=1,s+=1)r[s]=e[i];return r},dw=function(n,e){for(var t="",r=0;r<n.length;r+=1)t+=n[r],r+1<n.length&&(t+=e);return t},pw=function(e){var t=this;if(typeof t!="function"||lw.apply(t)!==uw)throw new TypeError(aw+t);for(var r=hw(arguments,1),i,s=function(){if(this instanceof i){var h=t.apply(this,ad(r,arguments));return Object(h)===h?h:this}return t.apply(e,ad(r,arguments))},o=cw(0,t.length-r.length),a=[],l=0;l<o;l++)a[l]="$"+l;if(i=Function("binder","return function ("+dw(a,",")+"){ return binder.apply(this,arguments); }")(s),t.prototype){var u=function(){};u.prototype=t.prototype,i.prototype=new u,u.prototype=null}return i},fw=pw,Ks=Function.prototype.bind||fw,Au=Function.prototype.call,xl,ld;function $u(){return ld||(ld=1,xl=Function.prototype.apply),xl}var gw=typeof Reflect<"u"&&Reflect&&Reflect.apply,mw=Ks,vw=$u(),yw=Au,bw=gw,sg=bw||mw.call(yw,vw),ww=Ks,Sw=j,_w=Au,kw=sg,Va=function(e){if(e.length<1||typeof e[0]!="function")throw new Sw("a function is required");return kw(ww,_w,e)},Ew=Va,cd=gi,og;try{og=[].__proto__===Array.prototype}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var Al=!!og&&cd&&cd(Object.prototype,"__proto__"),ag=Object,ud=ag.getPrototypeOf,xw=Al&&typeof Al.get=="function"?Ew([Al.get]):typeof ud=="function"?function(e){return ud(e==null?e:ag(e))}:!1,hd=rg(),dd=ig(),pd=xw,lg=hd?function(e){return hd(e)}:dd?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return dd(e)}:pd?function(e){return pd(e)}:null,Aw=Function.prototype.call,$w=Object.prototype.hasOwnProperty,Tw=Ks,tn=Tw.call(Aw,$w),W,Cw=_u,Iw=ng,Pw=Yb,Rw=Xb,Dw=ku,ci=Qt,Br=j,Ow=Kb,Lw=Jb,zw=Qb,Mw=ew,Nw=tw,Uw=nw,Fw=rw,Zw=sw,cg=Function,$l=function(n){try{return cg('"use strict"; return ('+n+").constructor;")()}catch{}},is=gi,Hw=Xs,Tl=function(){throw new Br},Bw=is?function(){try{return arguments.callee,Tl}catch{try{return is(arguments,"callee").get}catch{return Tl}}}():Tl,Tr=xu(),ke=lg,Gw=ig(),Vw=rg(),ug=$u(),Js=Au,Dr={},Ww=typeof Uint8Array>"u"||!ke?W:ke(Uint8Array),ur={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?W:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?W:ArrayBuffer,"%ArrayIteratorPrototype%":Tr&&ke?ke([][Symbol.iterator]()):W,"%AsyncFromSyncIteratorPrototype%":W,"%AsyncFunction%":Dr,"%AsyncGenerator%":Dr,"%AsyncGeneratorFunction%":Dr,"%AsyncIteratorPrototype%":Dr,"%Atomics%":typeof Atomics>"u"?W:Atomics,"%BigInt%":typeof BigInt>"u"?W:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?W:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?W:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?W:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Iw,"%eval%":eval,"%EvalError%":Pw,"%Float16Array%":typeof Float16Array>"u"?W:Float16Array,"%Float32Array%":typeof Float32Array>"u"?W:Float32Array,"%Float64Array%":typeof Float64Array>"u"?W:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?W:FinalizationRegistry,"%Function%":cg,"%GeneratorFunction%":Dr,"%Int8Array%":typeof Int8Array>"u"?W:Int8Array,"%Int16Array%":typeof Int16Array>"u"?W:Int16Array,"%Int32Array%":typeof Int32Array>"u"?W:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Tr&&ke?ke(ke([][Symbol.iterator]())):W,"%JSON%":typeof JSON=="object"?JSON:W,"%Map%":typeof Map>"u"?W:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Tr||!ke?W:ke(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Cw,"%Object.getOwnPropertyDescriptor%":is,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?W:Promise,"%Proxy%":typeof Proxy>"u"?W:Proxy,"%RangeError%":Rw,"%ReferenceError%":Dw,"%Reflect%":typeof Reflect>"u"?W:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?W:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Tr||!ke?W:ke(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?W:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Tr&&ke?ke(""[Symbol.iterator]()):W,"%Symbol%":Tr?Symbol:W,"%SyntaxError%":ci,"%ThrowTypeError%":Bw,"%TypedArray%":Ww,"%TypeError%":Br,"%Uint8Array%":typeof Uint8Array>"u"?W:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?W:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?W:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?W:Uint32Array,"%URIError%":Ow,"%WeakMap%":typeof WeakMap>"u"?W:WeakMap,"%WeakRef%":typeof WeakRef>"u"?W:WeakRef,"%WeakSet%":typeof WeakSet>"u"?W:WeakSet,"%Function.prototype.call%":Js,"%Function.prototype.apply%":ug,"%Object.defineProperty%":Hw,"%Object.getPrototypeOf%":Gw,"%Math.abs%":Lw,"%Math.floor%":zw,"%Math.max%":Mw,"%Math.min%":Nw,"%Math.pow%":Uw,"%Math.round%":Fw,"%Math.sign%":Zw,"%Reflect.getPrototypeOf%":Vw};if(ke)try{null.error}catch(n){var jw=ke(ke(n));ur["%Error.prototype%"]=jw}var qw=function n(e){var t;if(e==="%AsyncFunction%")t=$l("async function () {}");else if(e==="%GeneratorFunction%")t=$l("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=$l("async function* () {}");else if(e==="%AsyncGenerator%"){var r=n("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=n("%AsyncGenerator%");i&&ke&&(t=ke(i.prototype))}return ur[e]=t,t},fd={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Qs=Ks,sa=tn,Yw=Qs.call(Js,Array.prototype.concat),Xw=Qs.call(ug,Array.prototype.splice),gd=Qs.call(Js,String.prototype.replace),oa=Qs.call(Js,String.prototype.slice),Kw=Qs.call(Js,RegExp.prototype.exec),Jw=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Qw=/\\(\\)?/g,e0=function(e){var t=oa(e,0,1),r=oa(e,-1);if(t==="%"&&r!=="%")throw new ci("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&t!=="%")throw new ci("invalid intrinsic syntax, expected opening `%`");var i=[];return gd(e,Jw,function(s,o,a,l){i[i.length]=a?gd(l,Qw,"$1"):o||s}),i},t0=function(e,t){var r=e,i;if(sa(fd,r)&&(i=fd[r],r="%"+i[0]+"%"),sa(ur,r)){var s=ur[r];if(s===Dr&&(s=qw(r)),typeof s>"u"&&!t)throw new Br("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new ci("intrinsic "+e+" does not exist!")},lt=function(e,t){if(typeof e!="string"||e.length===0)throw new Br("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Br('"allowMissing" argument must be a boolean');if(Kw(/^%?[^%]*%?$/,e)===null)throw new ci("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=e0(e),i=r.length>0?r[0]:"",s=t0("%"+i+"%",t),o=s.name,a=s.value,l=!1,u=s.alias;u&&(i=u[0],Xw(r,Yw([0,1],u)));for(var h=1,p=!0;h<r.length;h+=1){var g=r[h],m=oa(g,0,1),A=oa(g,-1);if((m==='"'||m==="'"||m==="`"||A==='"'||A==="'"||A==="`")&&m!==A)throw new ci("property names with quotes must have matching quotes");if((g==="constructor"||!p)&&(l=!0),i+="."+g,o="%"+i+"%",sa(ur,o))a=ur[o];else if(a!=null){if(!(g in a)){if(!t)throw new Br("base intrinsic for "+e+" exists, but the property is not available.");return}if(is&&h+1>=r.length){var k=is(a,g);p=!!k,p&&"get"in k&&!("originalValue"in k.get)?a=k.get:a=a[g]}else p=sa(a,g),a=a[g];p&&!l&&(ur[o]=a)}}return a},Cl,md;function _n(){if(md)return Cl;md=1;var n=lt,e=Va,t=e([n("%String.prototype.indexOf%")]);return Cl=function(i,s){var o=n(i,!!s);return typeof o=="function"&&t(i,".prototype.")>-1?e([o]):o},Cl}var Il,vd;function Tu(){if(vd)return Il;vd=1;var n=lt,e=n("%Array%"),t=!e.isArray&&_n()("Object.prototype.toString");return Il=e.isArray||function(i){return t(i)==="[object Array]"},Il}var n0=Ga,yd=Xs,hg=n0.hasArrayLengthDefineBug(),r0=hg&&Tu(),i0=_n(),s0=i0("Object.prototype.propertyIsEnumerable"),Cu=function(e,t,r,i,s,o){if(!yd){if(!e(o)||!o["[[Configurable]]"]||!o["[[Writable]]"]||s in i&&s0(i,s)!==!!o["[[Enumerable]]"])return!1;var a=o["[[Value]]"];return i[s]=a,t(i[s],a)}return hg&&s==="length"&&"[[Value]]"in o&&r0(i)&&i.length!==o["[[Value]]"]?(i.length=o["[[Value]]"],i.length===o["[[Value]]"]):(yd(i,s,r(o)),!0)},o0=j,Ri=tn,a0={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0},vi=function(e){if(!e||typeof e!="object")return!1;for(var t in e)if(Ri(e,t)&&!a0[t])return!1;var r=Ri(e,"[[Value]]")||Ri(e,"[[Writable]]"),i=Ri(e,"[[Get]]")||Ri(e,"[[Set]]");if(r&&i)throw new o0("Property Descriptors may not be both accessor and data descriptors");return!0},dg=function(e){if(typeof e>"u")return e;var t={};return"[[Value]]"in e&&(t.value=e["[[Value]]"]),"[[Writable]]"in e&&(t.writable=!!e["[[Writable]]"]),"[[Get]]"in e&&(t.get=e["[[Get]]"]),"[[Set]]"in e&&(t.set=e["[[Set]]"]),"[[Enumerable]]"in e&&(t.enumerable=!!e["[[Enumerable]]"]),"[[Configurable]]"in e&&(t.configurable=!!e["[[Configurable]]"]),t},l0=j,c0=vi,u0=dg,pg=function(e){if(typeof e<"u"&&!c0(e))throw new l0("Assertion failed: `Desc` must be a Property Descriptor");return u0(e)},h0=j,bd=tn,d0=vi,fg=function(e){if(typeof e>"u")return!1;if(!d0(e))throw new h0("Assertion failed: `Desc` must be a Property Descriptor");return!(!bd(e,"[[Value]]")&&!bd(e,"[[Writable]]"))},yi=function(e){return typeof e=="string"||typeof e=="symbol"},wd=Eu,gg=function(e,t){return e===t?e===0?1/e===1/t:!0:wd(e)&&wd(t)},Sd=j,p0=en,f0=Cu,g0=pg,m0=fg,v0=yi,y0=gg,Iu=function(e,t,r){if(!p0(e))throw new Sd("Assertion failed: Type(O) is not Object");if(!v0(t))throw new Sd("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return f0(m0,y0,g0,e,t,i)},mg=Function.prototype.toString,Ur=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,bc,Vo;if(typeof Ur=="function"&&typeof Object.defineProperty=="function")try{bc=Object.defineProperty({},"length",{get:function(){throw Vo}}),Vo={},Ur(function(){throw 42},null,bc)}catch(n){n!==Vo&&(Ur=null)}else Ur=null;var b0=/^\s*class\b/,wc=function(e){try{var t=mg.call(e);return b0.test(t)}catch{return!1}},Pl=function(e){try{return wc(e)?!1:(mg.call(e),!0)}catch{return!1}},Wo=Object.prototype.toString,w0="[object Object]",S0="[object Function]",_0="[object GeneratorFunction]",k0="[object HTMLAllCollection]",E0="[object HTML document.all class]",x0="[object HTMLCollection]",A0=typeof Symbol=="function"&&!!Symbol.toStringTag,$0=!(0 in[,]),Sc=function(){return!1};if(typeof document=="object"){var T0=document.all;Wo.call(T0)===Wo.call(document.all)&&(Sc=function(e){if(($0||!e)&&(typeof e>"u"||typeof e=="object"))try{var t=Wo.call(e);return(t===k0||t===E0||t===x0||t===w0)&&e("")==null}catch{}return!1})}var vg=Ur?function(e){if(Sc(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Ur(e,null,bc)}catch(t){if(t!==Vo)return!1}return!wc(e)&&Pl(e)}:function(e){if(Sc(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(A0)return Pl(e);if(wc(e))return!1;var t=Wo.call(e);return t!==S0&&t!==_0&&!/^\[object HTML/.test(t)?!1:Pl(e)},C0=vg,I0=function(e){return!!e},kt=tn,So=j,P0=en,_d=C0,Rl=I0,R0=function(e){if(!P0(e))throw new So("ToPropertyDescriptor requires an object");var t={};if(kt(e,"enumerable")&&(t["[[Enumerable]]"]=Rl(e.enumerable)),kt(e,"configurable")&&(t["[[Configurable]]"]=Rl(e.configurable)),kt(e,"value")&&(t["[[Value]]"]=e.value),kt(e,"writable")&&(t["[[Writable]]"]=Rl(e.writable)),kt(e,"get")){var r=e.get;if(typeof r<"u"&&!_d(r))throw new So("getter must be a function");t["[[Get]]"]=r}if(kt(e,"set")){var i=e.set;if(typeof i<"u"&&!_d(i))throw new So("setter must be a function");t["[[Set]]"]=i}if((kt(t,"[[Get]]")||kt(t,"[[Set]]"))&&(kt(t,"[[Value]]")||kt(t,"[[Writable]]")))throw new So("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t},Dl=j,D0=en,kd=vi,O0=Cu,L0=pg,z0=fg,M0=yi,N0=gg,U0=R0,F0=function(e,t,r){if(!D0(e))throw new Dl("Assertion failed: Type(O) is not Object");if(!M0(t))throw new Dl("Assertion failed: P is not a Property Key");var i=kd(r)?r:U0(r);if(!kd(i))throw new Dl("Assertion failed: Desc is not a valid Property Descriptor");return O0(z0,N0,L0,e,t,i)},Ed=j,Z0=en,H0=F0,B0=yi,G0=function(e,t,r){if(!Z0(e))throw new Ed("Assertion failed: Type(O) is not Object");if(!B0(t))throw new Ed("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return H0(e,t,i)},V0=typeof Reflect<"u"&&Reflect.setPrototypeOf||null,W0=_u,j0=W0.setPrototypeOf||null,q0=Va,xd=gi,Y0=j,yg={};try{yg.__proto__=null}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var X0=!("toString"in yg),Ol=xd&&xd(Object.prototype,"__proto__"),K0=X0&&(!!Ol&&typeof Ol.set=="function"&&q0([Ol.set])||function(e,t){if(e==null)throw new Y0("set Object.prototype.__proto__ called on null or undefined");return e.__proto__=t,t}),Ad=V0,J0=j0,$d=K0,Q0=j,eS=Ad?function(e,t){if(Ad(e,t))return e;throw new Q0("Reflect.setPrototypeOf: failed to set [[Prototype]]")}:J0||($d?function(e,t){return $d(e,t),e}:null),Td=j,tS=en,Cd=lg,nS=function(e){if(!tS(e))throw new Td("Assertion failed: O must be an Object");if(!Cd)throw new Td("This environment does not support fetching prototypes.");return Cd(e)},rS=j,iS=eS,sS=en,oS=nS,aS=function(e,t){if(t!==null&&!sS(t))throw new rS("Assertion failed: V must be Object or Null");try{iS(e,t)}catch{return!1}return oS(e)===t},Ll=Iu,Id=G0,bg=aS,lS=Ga(),Pu=ng;function eo(n,e,t){var r=new Pu(t);return bg(r,jo),delete r.constructor,Id(r,"error",n),Id(r,"suppressed",e),r}lS&&Object.defineProperty(eo,"prototype",{writable:!1});var jo=eo.prototype;if(!Ll(jo,"constructor",eo)||!Ll(jo,"message","")||!Ll(jo,"name","SuppressedError"))throw new Pu("unable to install SuppressedError.prototype properties; please report this!");bg(eo.prototype,Pu.prototype);var cS=eo,uS=cS,wg=function(){return typeof SuppressedError=="function"?SuppressedError:uS},hS=vr,Pd=Su(),dS=wg,pS=function(){var e=dS();return hS(Pd,{SuppressedError:e},{SuppressedError:function(){return Pd.SuppressedError!==e}}),e};pS();var fS=j,gS=vi,mS=dg,vS=function(e){if(typeof e<"u"&&!gS(e))throw new fS("Assertion failed: `Desc` must be a Property Descriptor");return mS(e)},yS=j,Rd=tn,bS=vi,wS=function(e){if(typeof e>"u")return!1;if(!bS(e))throw new yS("Assertion failed: `Desc` must be a Property Descriptor");return!(!Rd(e,"[[Value]]")&&!Rd(e,"[[Writable]]"))},Dd=Eu,SS=function(e,t){return e===t?e===0?1/e===1/t:!0:Dd(e)&&Dd(t)},bi=vg,_S=function(e){return!!e},Et=tn,_o=j,kS=en,Od=bi,zl=_S,ES=function(e){if(!kS(e))throw new _o("ToPropertyDescriptor requires an object");var t={};if(Et(e,"enumerable")&&(t["[[Enumerable]]"]=zl(e.enumerable)),Et(e,"configurable")&&(t["[[Configurable]]"]=zl(e.configurable)),Et(e,"value")&&(t["[[Value]]"]=e.value),Et(e,"writable")&&(t["[[Writable]]"]=zl(e.writable)),Et(e,"get")){var r=e.get;if(typeof r<"u"&&!Od(r))throw new _o("getter must be a function");t["[[Get]]"]=r}if(Et(e,"set")){var i=e.set;if(typeof i<"u"&&!Od(i))throw new _o("setter must be a function");t["[[Set]]"]=i}if((Et(t,"[[Get]]")||Et(t,"[[Set]]"))&&(Et(t,"[[Value]]")||Et(t,"[[Writable]]")))throw new _o("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t},Ml=j,xS=en,Ld=vi,AS=Cu,$S=vS,TS=wS,CS=yi,IS=SS,PS=ES,to=function(e,t,r){if(!xS(e))throw new Ml("Assertion failed: Type(O) is not Object");if(!CS(t))throw new Ml("Assertion failed: P is not a Property Key");var i=Ld(r)?r:PS(r);if(!Ld(i))throw new Ml("Assertion failed: Desc is not a valid Property Descriptor");return AS(TS,IS,$S,e,t,i)},RS=mi(),DS=RS?Symbol.dispose||Symbol("Symbol.dispose"):null,OS=mi,LS=DS,Ru=function(){return OS()&&Symbol.dispose||LS},zS=xu,MS=to,NS=Ru,US=function(){var e=NS();return zS()&&MS(Symbol,"dispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":e}),e},FS=mi(),ZS=FS?Symbol.asyncDispose||Symbol("Symbol.asyncDispose"):null,HS=mi,BS=ZS,Du=function(){return HS()&&Symbol.asyncDispose||BS},GS=xu,VS=to,WS=Du,jS=function(){var e=WS();return GS()&&VS(Symbol,"asyncDispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":e}),e},qS=Tu(),YS=lt,XS=_n(),KS=j,JS=qS,QS=YS("%Reflect.apply%",!0)||XS("Function.prototype.apply"),Wa=function(e,t){var r=arguments.length>2?arguments[2]:[];if(!JS(r))throw new KS("Assertion failed: optional `argumentsList`, if provided, must be a List");return QS(e,t,r)};const e_={},t_=Object.freeze(Object.defineProperty({__proto__:null,default:e_},Symbol.toStringTag,{value:"Module"})),n_=$b(t_);var Ou=typeof Map=="function"&&Map.prototype,Nl=Object.getOwnPropertyDescriptor&&Ou?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,aa=Ou&&Nl&&typeof Nl.get=="function"?Nl.get:null,zd=Ou&&Map.prototype.forEach,Lu=typeof Set=="function"&&Set.prototype,Ul=Object.getOwnPropertyDescriptor&&Lu?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,la=Lu&&Ul&&typeof Ul.get=="function"?Ul.get:null,Md=Lu&&Set.prototype.forEach,r_=typeof WeakMap=="function"&&WeakMap.prototype,Qi=r_?WeakMap.prototype.has:null,i_=typeof WeakSet=="function"&&WeakSet.prototype,es=i_?WeakSet.prototype.has:null,s_=typeof WeakRef=="function"&&WeakRef.prototype,Nd=s_?WeakRef.prototype.deref:null,o_=Boolean.prototype.valueOf,a_=Object.prototype.toString,l_=Function.prototype.toString,c_=String.prototype.match,zu=String.prototype.slice,fn=String.prototype.replace,u_=String.prototype.toUpperCase,Ud=String.prototype.toLowerCase,Sg=RegExp.prototype.test,Fd=Array.prototype.concat,Dt=Array.prototype.join,h_=Array.prototype.slice,Zd=Math.floor,_c=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Fl=Object.getOwnPropertySymbols,kc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ui=typeof Symbol=="function"&&typeof Symbol.iterator=="object",ts=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ui||!0)?Symbol.toStringTag:null,_g=Object.prototype.propertyIsEnumerable,Hd=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function Bd(n,e){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||Sg.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var r=n<0?-Zd(-n):Zd(n);if(r!==n){var i=String(r),s=zu.call(e,i.length+1);return fn.call(i,t,"$&_")+"."+fn.call(fn.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return fn.call(e,t,"$&_")}var Ec=n_,Gd=Ec.custom,Vd=xg(Gd)?Gd:null,kg={__proto__:null,double:'"',single:"'"},d_={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},wi=function n(e,t,r,i){var s=t||{};if(Ht(s,"quoteStyle")&&!Ht(kg,s.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Ht(s,"maxStringLength")&&(typeof s.maxStringLength=="number"?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=Ht(s,"customInspect")?s.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Ht(s,"indent")&&s.indent!==null&&s.indent!==" "&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Ht(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return $g(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return a?Bd(e,l):l}if(typeof e=="bigint"){var u=String(e)+"n";return a?Bd(e,u):u}var h=typeof s.depth>"u"?5:s.depth;if(typeof r>"u"&&(r=0),r>=h&&h>0&&typeof e=="object")return xc(e)?"[Array]":"[Object]";var p=I_(s,r);if(typeof i>"u")i=[];else if(Ag(i,e)>=0)return"[Circular]";function g(wt,nn,cl){if(nn&&(i=h_.call(i),i.push(nn)),cl){var ho={depth:s.depth};return Ht(s,"quoteStyle")&&(ho.quoteStyle=s.quoteStyle),n(wt,ho,r+1,i)}return n(wt,s,r+1,i)}if(typeof e=="function"&&!Wd(e)){var m=S_(e),A=ko(e,g);return"[Function"+(m?": "+m:" (anonymous)")+"]"+(A.length>0?" { "+Dt.call(A,", ")+" }":"")}if(xg(e)){var k=ui?fn.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):kc.call(e);return typeof e=="object"&&!ui?Di(k):k}if($_(e)){for(var I="<"+Ud.call(String(e.nodeName)),U=e.attributes||[],P=0;P<U.length;P++)I+=" "+U[P].name+"="+Eg(p_(U[P].value),"double",s);return I+=">",e.childNodes&&e.childNodes.length&&(I+="..."),I+="</"+Ud.call(String(e.nodeName))+">",I}if(xc(e)){if(e.length===0)return"[]";var V=ko(e,g);return p&&!C_(V)?"["+Ac(V,p)+"]":"[ "+Dt.call(V,", ")+" ]"}if(g_(e)){var O=ko(e,g);return!("cause"in Error.prototype)&&"cause"in e&&!_g.call(e,"cause")?"{ ["+String(e)+"] "+Dt.call(Fd.call("[cause]: "+g(e.cause),O),", ")+" }":O.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Dt.call(O,", ")+" }"}if(typeof e=="object"&&o){if(Vd&&typeof e[Vd]=="function"&&Ec)return Ec(e,{depth:h-r});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(__(e)){var H=[];return zd&&zd.call(e,function(wt,nn){H.push(g(nn,e,!0)+" => "+g(wt,e))}),jd("Map",aa.call(e),H,p)}if(x_(e)){var F=[];return Md&&Md.call(e,function(wt){F.push(g(wt,e))}),jd("Set",la.call(e),F,p)}if(k_(e))return Zl("WeakMap");if(A_(e))return Zl("WeakSet");if(E_(e))return Zl("WeakRef");if(v_(e))return Di(g(Number(e)));if(b_(e))return Di(g(_c.call(e)));if(y_(e))return Di(o_.call(e));if(m_(e))return Di(g(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof On<"u"&&e===On)return"{ [object globalThis] }";if(!f_(e)&&!Wd(e)){var ce=ko(e,g),ue=Hd?Hd(e)===Object.prototype:e instanceof Object||e.constructor===Object,Ti=e instanceof Object?"":"null prototype",uo=!ue&&ts&&Object(e)===e&&ts in e?zu.call(kn(e),8,-1):Ti?"Object":"",xe=ue||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",An=xe+(uo||Ti?"["+Dt.call(Fd.call([],uo||[],Ti||[]),": ")+"] ":"");return ce.length===0?An+"{}":p?An+"{"+Ac(ce,p)+"}":An+"{ "+Dt.call(ce,", ")+" }"}return String(e)};function Eg(n,e,t){var r=t.quoteStyle||e,i=kg[r];return i+n+i}function p_(n){return fn.call(String(n),/"/g,"&quot;")}function yr(n){return!ts||!(typeof n=="object"&&(ts in n||typeof n[ts]<"u"))}function xc(n){return kn(n)==="[object Array]"&&yr(n)}function f_(n){return kn(n)==="[object Date]"&&yr(n)}function Wd(n){return kn(n)==="[object RegExp]"&&yr(n)}function g_(n){return kn(n)==="[object Error]"&&yr(n)}function m_(n){return kn(n)==="[object String]"&&yr(n)}function v_(n){return kn(n)==="[object Number]"&&yr(n)}function y_(n){return kn(n)==="[object Boolean]"&&yr(n)}function xg(n){if(ui)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!kc)return!1;try{return kc.call(n),!0}catch{}return!1}function b_(n){if(!n||typeof n!="object"||!_c)return!1;try{return _c.call(n),!0}catch{}return!1}var w_=Object.prototype.hasOwnProperty||function(n){return n in this};function Ht(n,e){return w_.call(n,e)}function kn(n){return a_.call(n)}function S_(n){if(n.name)return n.name;var e=c_.call(l_.call(n),/^function\s*([\w$]+)/);return e?e[1]:null}function Ag(n,e){if(n.indexOf)return n.indexOf(e);for(var t=0,r=n.length;t<r;t++)if(n[t]===e)return t;return-1}function __(n){if(!aa||!n||typeof n!="object")return!1;try{aa.call(n);try{la.call(n)}catch{return!0}return n instanceof Map}catch{}return!1}function k_(n){if(!Qi||!n||typeof n!="object")return!1;try{Qi.call(n,Qi);try{es.call(n,es)}catch{return!0}return n instanceof WeakMap}catch{}return!1}function E_(n){if(!Nd||!n||typeof n!="object")return!1;try{return Nd.call(n),!0}catch{}return!1}function x_(n){if(!la||!n||typeof n!="object")return!1;try{la.call(n);try{aa.call(n)}catch{return!0}return n instanceof Set}catch{}return!1}function A_(n){if(!es||!n||typeof n!="object")return!1;try{es.call(n,es);try{Qi.call(n,Qi)}catch{return!0}return n instanceof WeakSet}catch{}return!1}function $_(n){return!n||typeof n!="object"?!1:typeof HTMLElement<"u"&&n instanceof HTMLElement?!0:typeof n.nodeName=="string"&&typeof n.getAttribute=="function"}function $g(n,e){if(n.length>e.maxStringLength){var t=n.length-e.maxStringLength,r="... "+t+" more character"+(t>1?"s":"");return $g(zu.call(n,0,e.maxStringLength),e)+r}var i=d_[e.quoteStyle||"single"];i.lastIndex=0;var s=fn.call(fn.call(n,i,"\\$1"),/[\x00-\x1f]/g,T_);return Eg(s,"single",e)}function T_(n){var e=n.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+u_.call(e.toString(16))}function Di(n){return"Object("+n+")"}function Zl(n){return n+" { ? }"}function jd(n,e,t,r){var i=r?Ac(t,r):Dt.call(t,", ");return n+" ("+e+") {"+i+"}"}function C_(n){for(var e=0;e<n.length;e++)if(Ag(n[e],`
2
- `)>=0)return!1;return!0}function I_(n,e){var t;if(n.indent===" ")t=" ";else if(typeof n.indent=="number"&&n.indent>0)t=Dt.call(Array(n.indent+1)," ");else return null;return{base:t,prev:Dt.call(Array(e+1),t)}}function Ac(n,e){if(n.length===0)return"";var t=`
1
+ var bb=Object.defineProperty;var Wh=n=>{throw TypeError(n)};var wb=(n,e,t)=>e in n?bb(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var b=(n,e,t)=>wb(n,typeof e!="symbol"?e+"":e,t),Sl=(n,e,t)=>e.has(n)||Wh("Cannot "+t);var c=(n,e,t)=>(Sl(n,e,"read from private field"),t?t.call(n):e.get(n)),w=(n,e,t)=>e.has(n)?Wh("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),E=(n,e,t,r)=>(Sl(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),v=(n,e,t)=>(Sl(n,e,"access private method"),t);var jh=(n,e,t,r)=>({set _(i){E(n,e,i,t)},get _(){return c(n,e,r)}});(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();var On=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sb(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var qh=Object.prototype.toString,Zf=function(e){var t=qh.call(e),r=t==="[object Arguments]";return r||(r=t!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&qh.call(e.callee)==="[object Function]"),r},_l,Yh;function _b(){if(Yh)return _l;Yh=1;var n;if(!Object.keys){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Zf,i=Object.prototype.propertyIsEnumerable,s=!i.call({toString:null},"toString"),o=i.call(function(){},"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(g){var m=g.constructor;return m&&m.prototype===g},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},h=function(){if(typeof window>"u")return!1;for(var g in window)try{if(!u["$"+g]&&e.call(window,g)&&window[g]!==null&&typeof window[g]=="object")try{l(window[g])}catch{return!0}}catch{return!0}return!1}(),p=function(g){if(typeof window>"u"||!h)return l(g);try{return l(g)}catch{return!1}};n=function(m){var A=m!==null&&typeof m=="object",k=t.call(m)==="[object Function]",I=r(m),U=A&&t.call(m)==="[object String]",P=[];if(!A&&!k&&!I)throw new TypeError("Object.keys called on a non-object");var V=o&&k;if(U&&m.length>0&&!e.call(m,0))for(var O=0;O<m.length;++O)P.push(String(O));if(I&&m.length>0)for(var H=0;H<m.length;++H)P.push(String(H));else for(var F in m)!(V&&F==="prototype")&&e.call(m,F)&&P.push(String(F));if(s)for(var ce=p(m),ue=0;ue<a.length;++ue)!(ce&&a[ue]==="constructor")&&e.call(m,a[ue])&&P.push(a[ue]);return P}}return _l=n,_l}var kb=Array.prototype.slice,Eb=Zf,Xh=Object.keys,Zo=Xh?function(e){return Xh(e)}:_b(),Kh=Object.keys;Zo.shim=function(){if(Object.keys){var e=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);e||(Object.keys=function(r){return Eb(r)?Kh(kb.call(r)):Kh(r)})}else Object.keys=Zo;return Object.keys||Zo};var xb=Zo,Ho=Object.defineProperty||!1;if(Ho)try{Ho({},"a",{value:1})}catch{Ho=!1}var Xs=Ho,Qt=SyntaxError,j=TypeError,Ab=Object.getOwnPropertyDescriptor,Bo=Ab;if(Bo)try{Bo([],"length")}catch{Bo=null}var gi=Bo,Jh=Xs,$b=Qt,$r=j,Qh=gi,Hf=function(e,t,r){if(!e||typeof e!="object"&&typeof e!="function")throw new $r("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new $r("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new $r("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new $r("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new $r("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new $r("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,l=!!Qh&&Qh(e,t);if(Jh)Jh(e,t,{configurable:o===null&&l?l.configurable:!o,enumerable:i===null&&l?l.enumerable:!i,value:r,writable:s===null&&l?l.writable:!s});else if(a||!i&&!s&&!o)e[t]=r;else throw new $b("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},gc=Xs,Bf=function(){return!!gc};Bf.hasArrayLengthDefineBug=function(){if(!gc)return null;try{return gc([],"length",{value:1}).length!==1}catch{return!0}};var Ga=Bf,Tb=xb,Cb=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Ib=Object.prototype.toString,Pb=Array.prototype.concat,ed=Hf,Rb=function(n){return typeof n=="function"&&Ib.call(n)==="[object Function]"},Gf=Ga(),Db=function(n,e,t,r){if(e in n){if(r===!0){if(n[e]===t)return}else if(!Rb(r)||!r())return}Gf?ed(n,e,t,!0):ed(n,e,t)},Vf=function(n,e){var t=arguments.length>2?arguments[2]:{},r=Tb(e);Cb&&(r=Pb.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i<r.length;i+=1)Db(n,r[i],e[r[i]],t[r[i]])};Vf.supportsDescriptors=!!Gf;var vr=Vf,Go={exports:{}};typeof self<"u"?Go.exports=self:typeof window<"u"?Go.exports=window:Go.exports=Function("return this")();var Wf=Go.exports,Ob=Wf,jf=function(){return typeof On!="object"||!On||On.Math!==Math||On.Array!==Array?Ob:On},Lb=vr,zb=gi,Mb=jf,Nb=function(){var e=Mb();if(Lb.supportsDescriptors){var t=zb(e,"globalThis");(!t||t.configurable&&(t.enumerable||!t.writable||globalThis!==e))&&Object.defineProperty(e,"globalThis",{configurable:!0,enumerable:!1,value:e,writable:!0})}else(typeof globalThis!="object"||globalThis!==e)&&(e.globalThis=e);return e},Ub=vr,Fb=Wf,qf=jf,Zb=Nb,Hb=qf(),Yf=function(){return Hb};Ub(Yf,{getPolyfill:qf,implementation:Fb,shim:Zb});var yu=Yf,en=function(e){return!!e&&(typeof e=="function"||typeof e=="object")},bu=Object,Xf=Error,Bb=EvalError,Gb=RangeError,wu=ReferenceError,Vb=URIError,Wb=Math.abs,jb=Math.floor,qb=Math.max,Yb=Math.min,Xb=Math.pow,Kb=Math.round,Su=Number.isNaN||function(e){return e!==e},Jb=Su,Qb=function(e){return Jb(e)||e===0?e:e<0?-1:1},mi=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),r=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var i=42;e[t]=i;for(var s in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,t);if(a.value!==i||a.enumerable!==!0)return!1}return!0},td=typeof Symbol<"u"&&Symbol,ew=mi,_u=function(){return typeof td!="function"||typeof Symbol!="function"||typeof td("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:ew()},Kf=typeof Reflect<"u"&&Reflect.getPrototypeOf||null,tw=bu,Jf=tw.getPrototypeOf||null,nw="Function.prototype.bind called on incompatible ",rw=Object.prototype.toString,iw=Math.max,sw="[object Function]",nd=function(e,t){for(var r=[],i=0;i<e.length;i+=1)r[i]=e[i];for(var s=0;s<t.length;s+=1)r[s+e.length]=t[s];return r},ow=function(e,t){for(var r=[],i=t,s=0;i<e.length;i+=1,s+=1)r[s]=e[i];return r},aw=function(n,e){for(var t="",r=0;r<n.length;r+=1)t+=n[r],r+1<n.length&&(t+=e);return t},lw=function(e){var t=this;if(typeof t!="function"||rw.apply(t)!==sw)throw new TypeError(nw+t);for(var r=ow(arguments,1),i,s=function(){if(this instanceof i){var h=t.apply(this,nd(r,arguments));return Object(h)===h?h:this}return t.apply(e,nd(r,arguments))},o=iw(0,t.length-r.length),a=[],l=0;l<o;l++)a[l]="$"+l;if(i=Function("binder","return function ("+aw(a,",")+"){ return binder.apply(this,arguments); }")(s),t.prototype){var u=function(){};u.prototype=t.prototype,i.prototype=new u,u.prototype=null}return i},cw=lw,Ks=Function.prototype.bind||cw,ku=Function.prototype.call,Eu=Function.prototype.apply,uw=typeof Reflect<"u"&&Reflect&&Reflect.apply,hw=Ks,dw=Eu,pw=ku,fw=uw,Qf=fw||hw.call(pw,dw),gw=Ks,mw=j,vw=ku,yw=Qf,Va=function(e){if(e.length<1||typeof e[0]!="function")throw new mw("a function is required");return yw(gw,vw,e)},bw=Va,rd=gi,eg;try{eg=[].__proto__===Array.prototype}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var kl=!!eg&&rd&&rd(Object.prototype,"__proto__"),tg=Object,id=tg.getPrototypeOf,ww=kl&&typeof kl.get=="function"?bw([kl.get]):typeof id=="function"?function(e){return id(e==null?e:tg(e))}:!1,sd=Kf,od=Jf,ad=ww,ng=sd?function(e){return sd(e)}:od?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return od(e)}:ad?function(e){return ad(e)}:null,Sw=Function.prototype.call,_w=Object.prototype.hasOwnProperty,kw=Ks,tn=kw.call(Sw,_w),W,Ew=bu,xw=Xf,Aw=Bb,$w=Gb,Tw=wu,ci=Qt,Br=j,Cw=Vb,Iw=Wb,Pw=jb,Rw=qb,Dw=Yb,Ow=Xb,Lw=Kb,zw=Qb,rg=Function,El=function(n){try{return rg('"use strict"; return ('+n+").constructor;")()}catch{}},is=gi,Mw=Xs,xl=function(){throw new Br},Nw=is?function(){try{return arguments.callee,xl}catch{try{return is(arguments,"callee").get}catch{return xl}}}():xl,Tr=_u(),ke=ng,Uw=Jf,Fw=Kf,ig=Eu,Js=ku,Dr={},Zw=typeof Uint8Array>"u"||!ke?W:ke(Uint8Array),ur={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?W:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?W:ArrayBuffer,"%ArrayIteratorPrototype%":Tr&&ke?ke([][Symbol.iterator]()):W,"%AsyncFromSyncIteratorPrototype%":W,"%AsyncFunction%":Dr,"%AsyncGenerator%":Dr,"%AsyncGeneratorFunction%":Dr,"%AsyncIteratorPrototype%":Dr,"%Atomics%":typeof Atomics>"u"?W:Atomics,"%BigInt%":typeof BigInt>"u"?W:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?W:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?W:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?W:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":xw,"%eval%":eval,"%EvalError%":Aw,"%Float16Array%":typeof Float16Array>"u"?W:Float16Array,"%Float32Array%":typeof Float32Array>"u"?W:Float32Array,"%Float64Array%":typeof Float64Array>"u"?W:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?W:FinalizationRegistry,"%Function%":rg,"%GeneratorFunction%":Dr,"%Int8Array%":typeof Int8Array>"u"?W:Int8Array,"%Int16Array%":typeof Int16Array>"u"?W:Int16Array,"%Int32Array%":typeof Int32Array>"u"?W:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Tr&&ke?ke(ke([][Symbol.iterator]())):W,"%JSON%":typeof JSON=="object"?JSON:W,"%Map%":typeof Map>"u"?W:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Tr||!ke?W:ke(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Ew,"%Object.getOwnPropertyDescriptor%":is,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?W:Promise,"%Proxy%":typeof Proxy>"u"?W:Proxy,"%RangeError%":$w,"%ReferenceError%":Tw,"%Reflect%":typeof Reflect>"u"?W:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?W:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Tr||!ke?W:ke(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?W:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Tr&&ke?ke(""[Symbol.iterator]()):W,"%Symbol%":Tr?Symbol:W,"%SyntaxError%":ci,"%ThrowTypeError%":Nw,"%TypedArray%":Zw,"%TypeError%":Br,"%Uint8Array%":typeof Uint8Array>"u"?W:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?W:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?W:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?W:Uint32Array,"%URIError%":Cw,"%WeakMap%":typeof WeakMap>"u"?W:WeakMap,"%WeakRef%":typeof WeakRef>"u"?W:WeakRef,"%WeakSet%":typeof WeakSet>"u"?W:WeakSet,"%Function.prototype.call%":Js,"%Function.prototype.apply%":ig,"%Object.defineProperty%":Mw,"%Object.getPrototypeOf%":Uw,"%Math.abs%":Iw,"%Math.floor%":Pw,"%Math.max%":Rw,"%Math.min%":Dw,"%Math.pow%":Ow,"%Math.round%":Lw,"%Math.sign%":zw,"%Reflect.getPrototypeOf%":Fw};if(ke)try{null.error}catch(n){var Hw=ke(ke(n));ur["%Error.prototype%"]=Hw}var Bw=function n(e){var t;if(e==="%AsyncFunction%")t=El("async function () {}");else if(e==="%GeneratorFunction%")t=El("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=El("async function* () {}");else if(e==="%AsyncGenerator%"){var r=n("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=n("%AsyncGenerator%");i&&ke&&(t=ke(i.prototype))}return ur[e]=t,t},ld={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Qs=Ks,sa=tn,Gw=Qs.call(Js,Array.prototype.concat),Vw=Qs.call(ig,Array.prototype.splice),cd=Qs.call(Js,String.prototype.replace),oa=Qs.call(Js,String.prototype.slice),Ww=Qs.call(Js,RegExp.prototype.exec),jw=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,qw=/\\(\\)?/g,Yw=function(e){var t=oa(e,0,1),r=oa(e,-1);if(t==="%"&&r!=="%")throw new ci("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&t!=="%")throw new ci("invalid intrinsic syntax, expected opening `%`");var i=[];return cd(e,jw,function(s,o,a,l){i[i.length]=a?cd(l,qw,"$1"):o||s}),i},Xw=function(e,t){var r=e,i;if(sa(ld,r)&&(i=ld[r],r="%"+i[0]+"%"),sa(ur,r)){var s=ur[r];if(s===Dr&&(s=Bw(r)),typeof s>"u"&&!t)throw new Br("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:s}}throw new ci("intrinsic "+e+" does not exist!")},lt=function(e,t){if(typeof e!="string"||e.length===0)throw new Br("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Br('"allowMissing" argument must be a boolean');if(Ww(/^%?[^%]*%?$/,e)===null)throw new ci("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=Yw(e),i=r.length>0?r[0]:"",s=Xw("%"+i+"%",t),o=s.name,a=s.value,l=!1,u=s.alias;u&&(i=u[0],Vw(r,Gw([0,1],u)));for(var h=1,p=!0;h<r.length;h+=1){var g=r[h],m=oa(g,0,1),A=oa(g,-1);if((m==='"'||m==="'"||m==="`"||A==='"'||A==="'"||A==="`")&&m!==A)throw new ci("property names with quotes must have matching quotes");if((g==="constructor"||!p)&&(l=!0),i+="."+g,o="%"+i+"%",sa(ur,o))a=ur[o];else if(a!=null){if(!(g in a)){if(!t)throw new Br("base intrinsic for "+e+" exists, but the property is not available.");return}if(is&&h+1>=r.length){var k=is(a,g);p=!!k,p&&"get"in k&&!("originalValue"in k.get)?a=k.get:a=a[g]}else p=sa(a,g),a=a[g];p&&!l&&(ur[o]=a)}}return a},Al,ud;function _n(){if(ud)return Al;ud=1;var n=lt,e=Va,t=e([n("%String.prototype.indexOf%")]);return Al=function(i,s){var o=n(i,!!s);return typeof o=="function"&&t(i,".prototype.")>-1?e([o]):o},Al}var $l,hd;function xu(){if(hd)return $l;hd=1;var n=lt,e=n("%Array%"),t=!e.isArray&&_n()("Object.prototype.toString");return $l=e.isArray||function(i){return t(i)==="[object Array]"},$l}var Kw=Ga,dd=Xs,sg=Kw.hasArrayLengthDefineBug(),Jw=sg&&xu(),Qw=_n(),e0=Qw("Object.prototype.propertyIsEnumerable"),Au=function(e,t,r,i,s,o){if(!dd){if(!e(o)||!o["[[Configurable]]"]||!o["[[Writable]]"]||s in i&&e0(i,s)!==!!o["[[Enumerable]]"])return!1;var a=o["[[Value]]"];return i[s]=a,t(i[s],a)}return sg&&s==="length"&&"[[Value]]"in o&&Jw(i)&&i.length!==o["[[Value]]"]?(i.length=o["[[Value]]"],i.length===o["[[Value]]"]):(dd(i,s,r(o)),!0)},t0=j,Ri=tn,n0={__proto__:null,"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0},vi=function(e){if(!e||typeof e!="object")return!1;for(var t in e)if(Ri(e,t)&&!n0[t])return!1;var r=Ri(e,"[[Value]]")||Ri(e,"[[Writable]]"),i=Ri(e,"[[Get]]")||Ri(e,"[[Set]]");if(r&&i)throw new t0("Property Descriptors may not be both accessor and data descriptors");return!0},og=function(e){if(typeof e>"u")return e;var t={};return"[[Value]]"in e&&(t.value=e["[[Value]]"]),"[[Writable]]"in e&&(t.writable=!!e["[[Writable]]"]),"[[Get]]"in e&&(t.get=e["[[Get]]"]),"[[Set]]"in e&&(t.set=e["[[Set]]"]),"[[Enumerable]]"in e&&(t.enumerable=!!e["[[Enumerable]]"]),"[[Configurable]]"in e&&(t.configurable=!!e["[[Configurable]]"]),t},r0=j,i0=vi,s0=og,ag=function(e){if(typeof e<"u"&&!i0(e))throw new r0("Assertion failed: `Desc` must be a Property Descriptor");return s0(e)},o0=j,pd=tn,a0=vi,lg=function(e){if(typeof e>"u")return!1;if(!a0(e))throw new o0("Assertion failed: `Desc` must be a Property Descriptor");return!(!pd(e,"[[Value]]")&&!pd(e,"[[Writable]]"))},yi=function(e){return typeof e=="string"||typeof e=="symbol"},fd=Su,cg=function(e,t){return e===t?e===0?1/e===1/t:!0:fd(e)&&fd(t)},gd=j,l0=en,c0=Au,u0=ag,h0=lg,d0=yi,p0=cg,$u=function(e,t,r){if(!l0(e))throw new gd("Assertion failed: Type(O) is not Object");if(!d0(t))throw new gd("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return c0(h0,p0,u0,e,t,i)},ug=Function.prototype.toString,Ur=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,mc,Vo;if(typeof Ur=="function"&&typeof Object.defineProperty=="function")try{mc=Object.defineProperty({},"length",{get:function(){throw Vo}}),Vo={},Ur(function(){throw 42},null,mc)}catch(n){n!==Vo&&(Ur=null)}else Ur=null;var f0=/^\s*class\b/,vc=function(e){try{var t=ug.call(e);return f0.test(t)}catch{return!1}},Tl=function(e){try{return vc(e)?!1:(ug.call(e),!0)}catch{return!1}},Wo=Object.prototype.toString,g0="[object Object]",m0="[object Function]",v0="[object GeneratorFunction]",y0="[object HTMLAllCollection]",b0="[object HTML document.all class]",w0="[object HTMLCollection]",S0=typeof Symbol=="function"&&!!Symbol.toStringTag,_0=!(0 in[,]),yc=function(){return!1};if(typeof document=="object"){var k0=document.all;Wo.call(k0)===Wo.call(document.all)&&(yc=function(e){if((_0||!e)&&(typeof e>"u"||typeof e=="object"))try{var t=Wo.call(e);return(t===y0||t===b0||t===w0||t===g0)&&e("")==null}catch{}return!1})}var hg=Ur?function(e){if(yc(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Ur(e,null,mc)}catch(t){if(t!==Vo)return!1}return!vc(e)&&Tl(e)}:function(e){if(yc(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(S0)return Tl(e);if(vc(e))return!1;var t=Wo.call(e);return t!==m0&&t!==v0&&!/^\[object HTML/.test(t)?!1:Tl(e)},E0=hg,x0=function(e){return!!e},kt=tn,So=j,A0=en,md=E0,Cl=x0,$0=function(e){if(!A0(e))throw new So("ToPropertyDescriptor requires an object");var t={};if(kt(e,"enumerable")&&(t["[[Enumerable]]"]=Cl(e.enumerable)),kt(e,"configurable")&&(t["[[Configurable]]"]=Cl(e.configurable)),kt(e,"value")&&(t["[[Value]]"]=e.value),kt(e,"writable")&&(t["[[Writable]]"]=Cl(e.writable)),kt(e,"get")){var r=e.get;if(typeof r<"u"&&!md(r))throw new So("getter must be a function");t["[[Get]]"]=r}if(kt(e,"set")){var i=e.set;if(typeof i<"u"&&!md(i))throw new So("setter must be a function");t["[[Set]]"]=i}if((kt(t,"[[Get]]")||kt(t,"[[Set]]"))&&(kt(t,"[[Value]]")||kt(t,"[[Writable]]")))throw new So("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t},Il=j,T0=en,vd=vi,C0=Au,I0=ag,P0=lg,R0=yi,D0=cg,O0=$0,L0=function(e,t,r){if(!T0(e))throw new Il("Assertion failed: Type(O) is not Object");if(!R0(t))throw new Il("Assertion failed: P is not a Property Key");var i=vd(r)?r:O0(r);if(!vd(i))throw new Il("Assertion failed: Desc is not a valid Property Descriptor");return C0(P0,D0,I0,e,t,i)},yd=j,z0=en,M0=L0,N0=yi,U0=function(e,t,r){if(!z0(e))throw new yd("Assertion failed: Type(O) is not Object");if(!N0(t))throw new yd("Assertion failed: P is not a Property Key");var i={"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Value]]":r,"[[Writable]]":!0};return M0(e,t,i)},F0=typeof Reflect<"u"&&Reflect.setPrototypeOf||null,Z0=bu,H0=Z0.setPrototypeOf||null,B0=Va,bd=gi,G0=j,dg={};try{dg.__proto__=null}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var V0=!("toString"in dg),Pl=bd&&bd(Object.prototype,"__proto__"),W0=V0&&(!!Pl&&typeof Pl.set=="function"&&B0([Pl.set])||function(e,t){if(e==null)throw new G0("set Object.prototype.__proto__ called on null or undefined");return e.__proto__=t,t}),wd=F0,j0=H0,Sd=W0,q0=j,Y0=wd?function(e,t){if(wd(e,t))return e;throw new q0("Reflect.setPrototypeOf: failed to set [[Prototype]]")}:j0||(Sd?function(e,t){return Sd(e,t),e}:null),_d=j,X0=en,kd=ng,K0=function(e){if(!X0(e))throw new _d("Assertion failed: O must be an Object");if(!kd)throw new _d("This environment does not support fetching prototypes.");return kd(e)},J0=j,Q0=Y0,eS=en,tS=K0,nS=function(e,t){if(t!==null&&!eS(t))throw new J0("Assertion failed: V must be Object or Null");try{Q0(e,t)}catch{return!1}return tS(e)===t},Rl=$u,Ed=U0,pg=nS,rS=Ga(),Tu=Xf;function eo(n,e,t){var r=new Tu(t);return pg(r,jo),delete r.constructor,Ed(r,"error",n),Ed(r,"suppressed",e),r}rS&&Object.defineProperty(eo,"prototype",{writable:!1});var jo=eo.prototype;if(!Rl(jo,"constructor",eo)||!Rl(jo,"message","")||!Rl(jo,"name","SuppressedError"))throw new Tu("unable to install SuppressedError.prototype properties; please report this!");pg(eo.prototype,Tu.prototype);var iS=eo,sS=iS,fg=function(){return typeof SuppressedError=="function"?SuppressedError:sS},oS=vr,xd=yu(),aS=fg,lS=function(){var e=aS();return oS(xd,{SuppressedError:e},{SuppressedError:function(){return xd.SuppressedError!==e}}),e};lS();var cS=j,uS=vi,hS=og,dS=function(e){if(typeof e<"u"&&!uS(e))throw new cS("Assertion failed: `Desc` must be a Property Descriptor");return hS(e)},pS=j,Ad=tn,fS=vi,gS=function(e){if(typeof e>"u")return!1;if(!fS(e))throw new pS("Assertion failed: `Desc` must be a Property Descriptor");return!(!Ad(e,"[[Value]]")&&!Ad(e,"[[Writable]]"))},$d=Su,mS=function(e,t){return e===t?e===0?1/e===1/t:!0:$d(e)&&$d(t)},bi=hg,vS=function(e){return!!e},Et=tn,_o=j,yS=en,Td=bi,Dl=vS,bS=function(e){if(!yS(e))throw new _o("ToPropertyDescriptor requires an object");var t={};if(Et(e,"enumerable")&&(t["[[Enumerable]]"]=Dl(e.enumerable)),Et(e,"configurable")&&(t["[[Configurable]]"]=Dl(e.configurable)),Et(e,"value")&&(t["[[Value]]"]=e.value),Et(e,"writable")&&(t["[[Writable]]"]=Dl(e.writable)),Et(e,"get")){var r=e.get;if(typeof r<"u"&&!Td(r))throw new _o("getter must be a function");t["[[Get]]"]=r}if(Et(e,"set")){var i=e.set;if(typeof i<"u"&&!Td(i))throw new _o("setter must be a function");t["[[Set]]"]=i}if((Et(t,"[[Get]]")||Et(t,"[[Set]]"))&&(Et(t,"[[Value]]")||Et(t,"[[Writable]]")))throw new _o("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t},Ol=j,wS=en,Cd=vi,SS=Au,_S=dS,kS=gS,ES=yi,xS=mS,AS=bS,to=function(e,t,r){if(!wS(e))throw new Ol("Assertion failed: Type(O) is not Object");if(!ES(t))throw new Ol("Assertion failed: P is not a Property Key");var i=Cd(r)?r:AS(r);if(!Cd(i))throw new Ol("Assertion failed: Desc is not a valid Property Descriptor");return SS(kS,xS,_S,e,t,i)},$S=mi(),TS=$S?Symbol.dispose||Symbol("Symbol.dispose"):null,CS=mi,IS=TS,Cu=function(){return CS()&&Symbol.dispose||IS},PS=_u,RS=to,DS=Cu,OS=function(){var e=DS();return PS()&&RS(Symbol,"dispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":e}),e},LS=mi(),zS=LS?Symbol.asyncDispose||Symbol("Symbol.asyncDispose"):null,MS=mi,NS=zS,Iu=function(){return MS()&&Symbol.asyncDispose||NS},US=_u,FS=to,ZS=Iu,HS=function(){var e=ZS();return US()&&FS(Symbol,"asyncDispose",{"[[Configurable]]":!1,"[[Enumerable]]":!1,"[[Writable]]":!1,"[[Value]]":e}),e},BS=xu(),GS=lt,VS=_n(),WS=j,jS=BS,qS=GS("%Reflect.apply%",!0)||VS("Function.prototype.apply"),Wa=function(e,t){var r=arguments.length>2?arguments[2]:[];if(!jS(r))throw new WS("Assertion failed: optional `argumentsList`, if provided, must be a List");return qS(e,t,r)};const YS={},XS=Object.freeze(Object.defineProperty({__proto__:null,default:YS},Symbol.toStringTag,{value:"Module"})),KS=Sb(XS);var Pu=typeof Map=="function"&&Map.prototype,Ll=Object.getOwnPropertyDescriptor&&Pu?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,aa=Pu&&Ll&&typeof Ll.get=="function"?Ll.get:null,Id=Pu&&Map.prototype.forEach,Ru=typeof Set=="function"&&Set.prototype,zl=Object.getOwnPropertyDescriptor&&Ru?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,la=Ru&&zl&&typeof zl.get=="function"?zl.get:null,Pd=Ru&&Set.prototype.forEach,JS=typeof WeakMap=="function"&&WeakMap.prototype,Qi=JS?WeakMap.prototype.has:null,QS=typeof WeakSet=="function"&&WeakSet.prototype,es=QS?WeakSet.prototype.has:null,e_=typeof WeakRef=="function"&&WeakRef.prototype,Rd=e_?WeakRef.prototype.deref:null,t_=Boolean.prototype.valueOf,n_=Object.prototype.toString,r_=Function.prototype.toString,i_=String.prototype.match,Du=String.prototype.slice,fn=String.prototype.replace,s_=String.prototype.toUpperCase,Dd=String.prototype.toLowerCase,gg=RegExp.prototype.test,Od=Array.prototype.concat,Dt=Array.prototype.join,o_=Array.prototype.slice,Ld=Math.floor,bc=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ml=Object.getOwnPropertySymbols,wc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ui=typeof Symbol=="function"&&typeof Symbol.iterator=="object",ts=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ui||!0)?Symbol.toStringTag:null,mg=Object.prototype.propertyIsEnumerable,zd=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(n){return n.__proto__}:null);function Md(n,e){if(n===1/0||n===-1/0||n!==n||n&&n>-1e3&&n<1e3||gg.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof n=="number"){var r=n<0?-Ld(-n):Ld(n);if(r!==n){var i=String(r),s=Du.call(e,i.length+1);return fn.call(i,t,"$&_")+"."+fn.call(fn.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return fn.call(e,t,"$&_")}var Sc=KS,Nd=Sc.custom,Ud=bg(Nd)?Nd:null,vg={__proto__:null,double:'"',single:"'"},a_={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},wi=function n(e,t,r,i){var s=t||{};if(Ht(s,"quoteStyle")&&!Ht(vg,s.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Ht(s,"maxStringLength")&&(typeof s.maxStringLength=="number"?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=Ht(s,"customInspect")?s.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Ht(s,"indent")&&s.indent!==null&&s.indent!==" "&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Ht(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return Sg(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return a?Md(e,l):l}if(typeof e=="bigint"){var u=String(e)+"n";return a?Md(e,u):u}var h=typeof s.depth>"u"?5:s.depth;if(typeof r>"u"&&(r=0),r>=h&&h>0&&typeof e=="object")return _c(e)?"[Array]":"[Object]";var p=x_(s,r);if(typeof i>"u")i=[];else if(wg(i,e)>=0)return"[Circular]";function g(wt,nn,cl){if(nn&&(i=o_.call(i),i.push(nn)),cl){var ho={depth:s.depth};return Ht(s,"quoteStyle")&&(ho.quoteStyle=s.quoteStyle),n(wt,ho,r+1,i)}return n(wt,s,r+1,i)}if(typeof e=="function"&&!Fd(e)){var m=m_(e),A=ko(e,g);return"[Function"+(m?": "+m:" (anonymous)")+"]"+(A.length>0?" { "+Dt.call(A,", ")+" }":"")}if(bg(e)){var k=ui?fn.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):wc.call(e);return typeof e=="object"&&!ui?Di(k):k}if(__(e)){for(var I="<"+Dd.call(String(e.nodeName)),U=e.attributes||[],P=0;P<U.length;P++)I+=" "+U[P].name+"="+yg(l_(U[P].value),"double",s);return I+=">",e.childNodes&&e.childNodes.length&&(I+="..."),I+="</"+Dd.call(String(e.nodeName))+">",I}if(_c(e)){if(e.length===0)return"[]";var V=ko(e,g);return p&&!E_(V)?"["+kc(V,p)+"]":"[ "+Dt.call(V,", ")+" ]"}if(u_(e)){var O=ko(e,g);return!("cause"in Error.prototype)&&"cause"in e&&!mg.call(e,"cause")?"{ ["+String(e)+"] "+Dt.call(Od.call("[cause]: "+g(e.cause),O),", ")+" }":O.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Dt.call(O,", ")+" }"}if(typeof e=="object"&&o){if(Ud&&typeof e[Ud]=="function"&&Sc)return Sc(e,{depth:h-r});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(v_(e)){var H=[];return Id&&Id.call(e,function(wt,nn){H.push(g(nn,e,!0)+" => "+g(wt,e))}),Zd("Map",aa.call(e),H,p)}if(w_(e)){var F=[];return Pd&&Pd.call(e,function(wt){F.push(g(wt,e))}),Zd("Set",la.call(e),F,p)}if(y_(e))return Nl("WeakMap");if(S_(e))return Nl("WeakSet");if(b_(e))return Nl("WeakRef");if(d_(e))return Di(g(Number(e)));if(f_(e))return Di(g(bc.call(e)));if(p_(e))return Di(t_.call(e));if(h_(e))return Di(g(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof On<"u"&&e===On)return"{ [object globalThis] }";if(!c_(e)&&!Fd(e)){var ce=ko(e,g),ue=zd?zd(e)===Object.prototype:e instanceof Object||e.constructor===Object,Ti=e instanceof Object?"":"null prototype",uo=!ue&&ts&&Object(e)===e&&ts in e?Du.call(kn(e),8,-1):Ti?"Object":"",xe=ue||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",An=xe+(uo||Ti?"["+Dt.call(Od.call([],uo||[],Ti||[]),": ")+"] ":"");return ce.length===0?An+"{}":p?An+"{"+kc(ce,p)+"}":An+"{ "+Dt.call(ce,", ")+" }"}return String(e)};function yg(n,e,t){var r=t.quoteStyle||e,i=vg[r];return i+n+i}function l_(n){return fn.call(String(n),/"/g,"&quot;")}function yr(n){return!ts||!(typeof n=="object"&&(ts in n||typeof n[ts]<"u"))}function _c(n){return kn(n)==="[object Array]"&&yr(n)}function c_(n){return kn(n)==="[object Date]"&&yr(n)}function Fd(n){return kn(n)==="[object RegExp]"&&yr(n)}function u_(n){return kn(n)==="[object Error]"&&yr(n)}function h_(n){return kn(n)==="[object String]"&&yr(n)}function d_(n){return kn(n)==="[object Number]"&&yr(n)}function p_(n){return kn(n)==="[object Boolean]"&&yr(n)}function bg(n){if(ui)return n&&typeof n=="object"&&n instanceof Symbol;if(typeof n=="symbol")return!0;if(!n||typeof n!="object"||!wc)return!1;try{return wc.call(n),!0}catch{}return!1}function f_(n){if(!n||typeof n!="object"||!bc)return!1;try{return bc.call(n),!0}catch{}return!1}var g_=Object.prototype.hasOwnProperty||function(n){return n in this};function Ht(n,e){return g_.call(n,e)}function kn(n){return n_.call(n)}function m_(n){if(n.name)return n.name;var e=i_.call(r_.call(n),/^function\s*([\w$]+)/);return e?e[1]:null}function wg(n,e){if(n.indexOf)return n.indexOf(e);for(var t=0,r=n.length;t<r;t++)if(n[t]===e)return t;return-1}function v_(n){if(!aa||!n||typeof n!="object")return!1;try{aa.call(n);try{la.call(n)}catch{return!0}return n instanceof Map}catch{}return!1}function y_(n){if(!Qi||!n||typeof n!="object")return!1;try{Qi.call(n,Qi);try{es.call(n,es)}catch{return!0}return n instanceof WeakMap}catch{}return!1}function b_(n){if(!Rd||!n||typeof n!="object")return!1;try{return Rd.call(n),!0}catch{}return!1}function w_(n){if(!la||!n||typeof n!="object")return!1;try{la.call(n);try{aa.call(n)}catch{return!0}return n instanceof Set}catch{}return!1}function S_(n){if(!es||!n||typeof n!="object")return!1;try{es.call(n,es);try{Qi.call(n,Qi)}catch{return!0}return n instanceof WeakSet}catch{}return!1}function __(n){return!n||typeof n!="object"?!1:typeof HTMLElement<"u"&&n instanceof HTMLElement?!0:typeof n.nodeName=="string"&&typeof n.getAttribute=="function"}function Sg(n,e){if(n.length>e.maxStringLength){var t=n.length-e.maxStringLength,r="... "+t+" more character"+(t>1?"s":"");return Sg(Du.call(n,0,e.maxStringLength),e)+r}var i=a_[e.quoteStyle||"single"];i.lastIndex=0;var s=fn.call(fn.call(n,i,"\\$1"),/[\x00-\x1f]/g,k_);return yg(s,"single",e)}function k_(n){var e=n.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+s_.call(e.toString(16))}function Di(n){return"Object("+n+")"}function Nl(n){return n+" { ? }"}function Zd(n,e,t,r){var i=r?kc(t,r):Dt.call(t,", ");return n+" ("+e+") {"+i+"}"}function E_(n){for(var e=0;e<n.length;e++)if(wg(n[e],`
2
+ `)>=0)return!1;return!0}function x_(n,e){var t;if(n.indent===" ")t=" ";else if(typeof n.indent=="number"&&n.indent>0)t=Dt.call(Array(n.indent+1)," ");else return null;return{base:t,prev:Dt.call(Array(e+1),t)}}function kc(n,e){if(n.length===0)return"";var t=`
3
3
  `+e.prev+e.base;return t+Dt.call(n,","+t)+`
4
- `+e.prev}function ko(n,e){var t=xc(n),r=[];if(t){r.length=n.length;for(var i=0;i<n.length;i++)r[i]=Ht(n,i)?e(n[i],n):""}var s=typeof Fl=="function"?Fl(n):[],o;if(ui){o={};for(var a=0;a<s.length;a++)o["$"+s[a]]=s[a]}for(var l in n)Ht(n,l)&&(t&&String(Number(l))===l&&l<n.length||ui&&o["$"+l]instanceof Symbol||(Sg.call(/[^\w$]/,l)?r.push(e(l,n)+": "+e(n[l],n)):r.push(l+": "+e(n[l],n))));if(typeof Fl=="function")for(var u=0;u<s.length;u++)_g.call(n,s[u])&&r.push("["+e(s[u])+"]: "+e(n[s[u]],n));return r}var P_=wi,R_=j,ja=function(n,e,t){for(var r=n,i;(i=r.next)!=null;r=i)if(i.key===e)return r.next=i.next,t||(i.next=n.next,n.next=i),i},D_=function(n,e){if(n){var t=ja(n,e);return t&&t.value}},O_=function(n,e,t){var r=ja(n,e);r?r.value=t:n.next={key:e,next:n.next,value:t}},L_=function(n,e){return n?!!ja(n,e):!1},z_=function(n,e){if(n)return ja(n,e,!0)},M_=function(){var e,t={assert:function(r){if(!t.has(r))throw new R_("Side channel does not contain "+P_(r))},delete:function(r){var i=e&&e.next,s=z_(e,r);return s&&i&&i===s&&(e=void 0),!!s},get:function(r){return D_(e,r)},has:function(r){return L_(e,r)},set:function(r,i){e||(e={next:void 0}),O_(e,r,i)}};return t},N_=lt,no=_n(),U_=wi,F_=j,qd=N_("%Map%",!0),Z_=no("Map.prototype.get",!0),H_=no("Map.prototype.set",!0),B_=no("Map.prototype.has",!0),G_=no("Map.prototype.delete",!0),V_=no("Map.prototype.size",!0),Tg=!!qd&&function(){var e,t={assert:function(r){if(!t.has(r))throw new F_("Side channel does not contain "+U_(r))},delete:function(r){if(e){var i=G_(e,r);return V_(e)===0&&(e=void 0),i}return!1},get:function(r){if(e)return Z_(e,r)},has:function(r){return e?B_(e,r):!1},set:function(r,i){e||(e=new qd),H_(e,r,i)}};return t},W_=lt,qa=_n(),j_=wi,Eo=Tg,q_=j,Cr=W_("%WeakMap%",!0),Y_=qa("WeakMap.prototype.get",!0),X_=qa("WeakMap.prototype.set",!0),K_=qa("WeakMap.prototype.has",!0),J_=qa("WeakMap.prototype.delete",!0),Q_=Cr?function(){var e,t,r={assert:function(i){if(!r.has(i))throw new q_("Side channel does not contain "+j_(i))},delete:function(i){if(Cr&&i&&(typeof i=="object"||typeof i=="function")){if(e)return J_(e,i)}else if(Eo&&t)return t.delete(i);return!1},get:function(i){return Cr&&i&&(typeof i=="object"||typeof i=="function")&&e?Y_(e,i):t&&t.get(i)},has:function(i){return Cr&&i&&(typeof i=="object"||typeof i=="function")&&e?K_(e,i):!!t&&t.has(i)},set:function(i,s){Cr&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new Cr),X_(e,i,s)):Eo&&(t||(t=Eo()),t.set(i,s))}};return r}:Eo,ek=j,tk=wi,nk=M_,rk=Tg,ik=Q_,sk=ik||rk||nk,ok=function(){var e,t={assert:function(r){if(!t.has(r))throw new ek("Side channel does not contain "+tk(r))},delete:function(r){return!!e&&e.delete(r)},get:function(r){return e&&e.get(r)},has:function(r){return!!e&&e.has(r)},set:function(r,i){e||(e=sk()),e.set(r,i)}};return t},ak=tn,Oi=ok(),Ut=j,Mu={assert:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Ut("`O` is not an object");if(typeof e!="string")throw new Ut("`slot` must be a string");if(Oi.assert(n),!Mu.has(n,e))throw new Ut("`"+e+"` is not present on `O`")},get:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Ut("`O` is not an object");if(typeof e!="string")throw new Ut("`slot` must be a string");var t=Oi.get(n);return t&&t["$"+e]},has:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Ut("`O` is not an object");if(typeof e!="string")throw new Ut("`slot` must be a string");var t=Oi.get(n);return!!t&&ak(t,"$"+e)},set:function(n,e,t){if(!n||typeof n!="object"&&typeof n!="function")throw new Ut("`O` is not an object");if(typeof e!="string")throw new Ut("`slot` must be a string");var r=Oi.get(n);r||(r={},Oi.set(n,r)),r["$"+e]=t}};Object.freeze&&Object.freeze(Mu);var Nu=Mu,Cg=Qt,gn=Nu,ro=function n(e,t){if(!(this instanceof n))return new n(e,t);if(e!=="normal"&&e!=="break"&&e!=="continue"&&e!=="return"&&e!=="throw")throw new Cg('Assertion failed: `type` must be one of "normal", "break", "continue", "return", or "throw"');gn.set(this,"[[Type]]",e),gn.set(this,"[[Value]]",t)};ro.prototype.type=function(){return gn.get(this,"[[Type]]")};ro.prototype.value=function(){return gn.get(this,"[[Value]]")};ro.prototype["?"]=function(){var e=gn.get(this,"[[Type]]"),t=gn.get(this,"[[Value]]");if(e==="throw")throw t;return t};ro.prototype["!"]=function(){var e=gn.get(this,"[[Type]]");if(e!=="normal")throw new Cg('Assertion failed: Completion Record is not of type "normal"');return gn.get(this,"[[Value]]")};var Uu=ro,lk=Uu,Fu=function(e){return new lk("normal",e)},Hl,Yd;function ck(){if(Yd)return Hl;Yd=1;var n=mi;return Hl=function(){return n()&&!!Symbol.toStringTag},Hl}var uk=lt,Xd=uk("%Object.defineProperty%",!0),hk=ck()(),dk=tn,pk=j,xo=hk?Symbol.toStringTag:null,Ig=function(e,t){var r=arguments.length>2&&!!arguments[2]&&arguments[2].force,i=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof r<"u"&&typeof r!="boolean"||typeof i<"u"&&typeof i!="boolean")throw new pk("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");xo&&(r||!dk(e,xo))&&(Xd?Xd(e,xo,{configurable:!i,enumerable:!1,value:t,writable:!1}):e[xo]=t)},Pg={exports:{}},fk=lt,Kd=qf,gk=Ga(),Jd=gi,Qd=j,mk=fk("%Math.floor%"),vk=function(e,t){if(typeof e!="function")throw new Qd("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||mk(t)!==t)throw new Qd("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&Jd){var o=Jd(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!r)&&(gk?Kd(e,"length",t,!0,!0):Kd(e,"length",t)),e},yk=Ks,bk=$u(),wk=sg,Sk=function(){return wk(yk,bk,arguments)};(function(n){var e=vk,t=Xs,r=Va,i=Sk;n.exports=function(o){var a=r(arguments),l=1+o.length-(arguments.length-1);return e(a,l>0?l:0,!0)},t?t(n.exports,"apply",{value:i}):n.exports.apply=i})(Pg);var Zu=Pg.exports,_k=function(e,t){for(var r=0;r<e.length;r+=1)if(!t(e[r],r,e))return!1;return!0},kk=Object,Ek=function(e){return e&&typeof e=="object"&&(typeof e["[[ResourceValue]]"]>"u"||kk(e["[[ResourceValue]]"])===e["[[ResourceValue]]"])&&(e["[[Hint]]"]==="SYNC-DISPOSE"||e["[[Hint]]"]==="ASYNC-DISPOSE")&&(typeof e["[[DisposeMethod]]"]=="function"||typeof e["[[DisposeMethod]]"]>"u")},xk=tn,Ak=Tu(),$k=_k,Tk=Ek,Ck=function(e){return e&&typeof e=="object"&&xk(e,"[[DisposableResourceStack]]")&&Ak(e["[[DisposableResourceStack]]"])&&(e["[[DisposableResourceStack]]"].length===0||$k(e["[[DisposableResourceStack]]"],Tk))},Ik=en,Pk=function(e){if(e===null)return"Null";if(typeof e>"u")return"Undefined";if(Ik(e))return"Object";if(typeof e=="number")return"Number";if(typeof e=="boolean")return"Boolean";if(typeof e=="string")return"String"},Rk=Pk,Hu=function(e){return typeof e=="symbol"?"Symbol":typeof e=="bigint"?"BigInt":Rk(e)},Dk=j,Ok=wi,Lk=yi,zk=function(e,t){if(!Lk(t))throw new Dk("Assertion failed: P is not a Property Key, got "+Ok(t));return e[t]},ep=j,Mk=zk,Nk=bi,Uk=yi,tp=wi,Fk=function(e,t){if(!Uk(t))throw new ep("Assertion failed: P is not a Property Key");var r=Mk(e,t);if(r!=null){if(!Nk(r))throw new ep(tp(t)+" is not a function: "+tp(r));return r}},$c={exports:{}},Zk=lt,Hk=Zk,np=Hk("%Reflect.construct%",!0),ca=to;try{ca({},"",{"[[Get]]":function(){}})}catch{ca=null}if(ca&&np){var rp={},ip={};ca(ip,"length",{"[[Get]]":function(){throw rp},"[[Enumerable]]":!0}),$c.exports=function(e){try{np(e,ip)}catch(t){return t===rp}}}else $c.exports=function(e){return typeof e=="function"&&!!e.prototype};var Bk=$c.exports,Bl=j,sp=bi,Gk=Bk,Vk=function(e){if(!Gk(e))throw new Bl("C must be a constructor");var t={"[[Resolve]]":void 0,"[[Reject]]":void 0},r=new e(function(i,s){if(typeof t["[[Resolve]]"]<"u"||typeof t["[[Reject]]"]<"u")throw new Bl("executor has already been called");t["[[Resolve]]"]=i,t["[[Reject]]"]=s});if(!sp(t["[[Resolve]]"])||!sp(t["[[Reject]]"]))throw new Bl("executor must provide valid resolve and reject functions");return{"[[Promise]]":r,"[[Resolve]]":t["[[Resolve]]"],"[[Reject]]":t["[[Reject]]"]}},op=Qt,Wk=j,Gl=Wa,ap=Fk,jk=Vk,qk=Hu,lp=Ru(),cp=Du(),Yk=function(e,t){if(qk(e)!=="Object")throw new Wk("`V` must be an Object");if(t!=="SYNC-DISPOSE"&&t!=="ASYNC-DISPOSE")throw new op("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(t==="ASYNC-DISPOSE"&&cp&&(r=ap(e,cp)),!r){if(!lp)throw new op("`Symbol.dispose` is not supported");if(r=ap(e,lp),typeof r<"u")return function(){var i=this;if(t==="ASYNC-DISPOSE"){var s=jk(Promise);try{Gl(r,i),Gl(s["[[Resolve]]"],void 0,[void 0])}catch(o){s["[[Reject]]"](o)}return s["[[Promise]]"]}Gl(r,i)}}return r},Xk=Qt,Vl=j,Kk=bi,Jk=Hu,Qk=Yk,eE=function(e,t){if(t!=="SYNC-DISPOSE"&&t!=="ASYNC-DISPOSE")throw new Xk("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(arguments.length<3)if(e==null)e=void 0,r=void 0;else{if(typeof e<"u"&&Jk(e)!=="Object")throw new Vl("`V` must be an Object, or `null` or `undefined`");if(r=Qk(e,t),typeof r>"u")throw new Vl("dispose method must not be `undefined` on `V` when an object `V` is provided")}else if(r=arguments[2],!Kk(r))throw new Vl("`method`, when provided, must be a function");return{"[[ResourceValue]]":e,"[[Hint]]":t,"[[DisposeMethod]]":r}},tE=Qt,Ao=j,nE=Ck,up=eE,rE=_n(),iE=rE("Array.prototype.push"),Rg=function(e,t,r){if(!nE(e))throw new Ao("Assertion failed: `disposeCapability` must be a DisposeCapability Record");if(r!=="SYNC-DISPOSE"&&r!=="ASYNC-DISPOSE")throw new tE("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var i=arguments.length>3?arguments[3]:void 0;if(arguments.length>3&&typeof i!="function")throw new Ao("Assertion failed: `method`, when present, must be a function");if(!e["[[DisposableResourceStack]]"])throw new Ao("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");var s;if(arguments.length<4){if(t==null&&r==="SYNC_DISPOSE")return"UNUSED";s=up(t,r)}else{if(typeof t<"u")throw new Ao("Assertion failed: `V` must be undefined when `method` is present");s=up(void 0,r,i)}return iE(e["[[DisposableResourceStack]]"],s),"UNUSED"},Wl,hp;function Bu(){if(hp)return Wl;hp=1;var n=lt,e=Zu,t=Qt,r=n("%Promise.resolve%",!0),i=r&&e(r);return Wl=function(o,a){if(!i)throw new t("This environment does not support Promises.");return i(o,a)},Wl}var jl,dp;function sE(){if(dp)return jl;dp=1;var n=lt,e=Qt,t=n("%Promise%",!0),r=Wa,i=Bu(),s=Hu;return jl=function(a,l,u){if(typeof a<"u"&&s(a)!=="Object")throw new e("Assertion failed: `V` must be `undefined` or an Object");if(l!=="SYNC-DISPOSE"&&l!=="ASYNC-DISPOSE")throw new e("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");if(typeof u<"u"&&typeof u!="function")throw new e("Assertion failed: `method` must be `undefined` or a function");var h=typeof u>"u"?u:r(u,a);if(l==="ASYNC-DISPOSE")return i(t,h)},jl}var ql,pp;function oE(){if(pp)return ql;pp=1;var n=Uu;return ql=function(t){return new n("throw",t)},ql}var aE=lt,Yl=Qt,fp=j,lE=aE("%Promise%",!0),cE=_n(),gp=cE("Promise.prototype.then",!0),uE=Uu,mp=sE(),hE=Fu,dE=Bu(),vp=oE(),pE=wg(),Dg=function(e,t){if(!(t instanceof uE))throw new fp("`completion` must be a Completion Record");var r=e["[[DisposableResourceStack]]"];if(!r)throw new fp("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");for(var i,s=r.length-1;s>=0;s-=1)if(!i)i=r[s]["[[Hint]]"];else if(i!==r[s]["[[Hint]]"])throw new Yl("mixed hint stacks are not supported");for(var o=i==="ASYNC-DISPOSE"&&dE(lE,t),a=function(g){if(t.type()==="throw"){var m=t.value(),A=new pE(g,m);t=vp(A)}else t=vp(g)},l=i==="ASYNC-DISPOSE"&&function(m){return gp(o,function(){var A=mp(m["[[ResourceValue]]"],m["[[Hint]]"],m["[[DisposeMethod]]"]);if(!A)throw new Yl("Assertion failed: non-`~ASYNC-DISPOSE~` resource returned a promise from Dispose");return gp(A,hE)},a)},u=r.length-1;u>=0;u-=1)if(i==="ASYNC-DISPOSE")o=l(r[u]);else{var h=r[u];try{var p=mp(h["[[ResourceValue]]"],h["[[Hint]]"],h["[[DisposeMethod]]"]);if(p)throw new Yl("Assertion failed: `~SYNC-DISPOSE~` resource returned something from Dispose")}catch(g){a(g)}}return e["[[DisposableResourceStack]]"]=null,i==="ASYNC-DISPOSE"?o:t},Og=function(){var e=[];return{"[[DisposableResourceStack]]":e}},Ya=ku,Gu=j,fE=Wa,Si=Iu,gE=to,Lg=bi,mE=Fu,We=Nu,vE=Ig,zg=vr.supportsDescriptors,yE=Zu,Vu=Rg,bE=Dg,Mg=Og,yp=Ru(),st=function n(){if(!(this instanceof n)||We.has(this,"[[DisposableState]]")||We.has(this,"[[DisposeCapability]]"))throw new Gu("can only be used with new");We.set(this,"[[DisposableState]]","PENDING"),We.set(this,"[[DisposeCapability]]",Mg())},Ng=function(){var e=this;return We.assert(e,"[[DisposableState]]"),We.get(e,"[[DisposableState]]")==="DISPOSED"},io=yE(Ng);zg?gE(st.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Ng}):st.prototype.disposed=!1;var Ug=function(e){We.set(e,"[[DisposableState]]","DISPOSED"),zg||(e.disposed=!0)};Si(st.prototype,"dispose",function(){var e=this;if(!io(e))return Ug(e),bE(We.get(e,"[[DisposeCapability]]"),mE())["?"]()});Si(st.prototype,"use",function(e){var t=this;if(io(t))throw new Ya("a disposed stack can not use anything new");return Vu(We.get(t,"[[DisposeCapability]]"),e,"SYNC-DISPOSE"),e});Si(st.prototype,"adopt",function(e,t){var r=this;if(io(r))throw new Ya("a disposed stack can not use anything new");if(!Lg(t))throw new Gu("`onDispose` must be a function");var i=function(){return fE(t,void 0,[e])};return Vu(We.get(r,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",i),e});Si(st.prototype,"defer",function(e){var t=this;if(io(t))throw new Ya("a disposed stack can not defer anything new");if(!Lg(e))throw new Gu("`onDispose` must be a function");Vu(We.get(t,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",e)});Si(st.prototype,"move",function(){var e=this;if(io(e))throw new Ya("a disposed stack can not use anything new");var t=new st;return We.set(t,"[[DisposeCapability]]",We.get(e,"[[DisposeCapability]]")),We.set(e,"[[DisposeCapability]]",Mg()),Ug(e),t});yp&&Si(st.prototype,yp,st.prototype.dispose);vE(st.prototype,"DisposableStack");var wE=st,SE=wE,_E=function(){return typeof DisposableStack=="function"?DisposableStack:SE},kE=vr,EE=Su(),xE=_E,AE=function(){var e=xE();return kE(EE,{DisposableStack:e},{DisposableStack:!0}),e},$E=lt,Xa=ku,Wu=j,bp=$E("%Promise%",!0),ju=Rg,TE=Wa,_i=Iu,CE=to,IE=Dg,Fg=bi,Zg=Og,PE=Fu,wp=Bu(),je=Nu,RE=Ig,Hg=vr.supportsDescriptors,DE=Zu,OE=_n(),LE=OE("Promise.prototype.then",!0),Sp=Du(),ot=function n(){if(!(this instanceof n)||je.has(this,"[[AsyncDisposableState]]")||je.has(this,"[[DisposeCapability]]"))throw new Wu("can only be used with new");je.set(this,"[[AsyncDisposableState]]","pending"),je.set(this,"[[DisposeCapability]]",Zg())},Bg=function(){var e=this;return je.assert(e,"[[AsyncDisposableState]]"),je.get(e,"[[AsyncDisposableState]]")==="disposed"},so=DE(Bg);Hg?CE(ot.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Bg}):ot.prototype.disposed=!1;var Gg=function(e){je.set(e,"[[AsyncDisposableState]]","disposed"),Hg||(e.disposed=!0)};_i(ot.prototype,"disposeAsync",function(){var e=this;return so(e)?wp(bp):(Gg(e),LE(wp(bp,IE(je.get(e,"[[DisposeCapability]]"),PE())),function(t){return t["?"]()}))});_i(ot.prototype,"use",function(e){var t=this;if(so(t))throw new Xa("a disposed stack can not use anything new");return ju(je.get(t,"[[DisposeCapability]]"),e,"ASYNC-DISPOSE"),e});_i(ot.prototype,"adopt",function(e,t){var r=this;if(so(r))throw new Xa("a disposed stack can not use anything new");if(!Fg(t))throw new Wu("`onDisposeAsync` must be a function");var i=function(){return TE(t,void 0,[e])};return i.value=e,ju(je.get(r,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",i),e});_i(ot.prototype,"defer",function(e){var t=this;if(so(t))throw new Xa("a disposed stack can not defer anything new");if(!Fg(e))throw new Wu("`onDispose` must be a function");ju(je.get(t,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",e)});_i(ot.prototype,"move",function(){var e=this;if(so(e))throw new Xa("a disposed stack can not use anything new");var t=new ot;return je.set(t,"[[DisposeCapability]]",je.get(e,"[[DisposeCapability]]")),je.set(e,"[[DisposeCapability]]",Zg()),Gg(e),t});Sp&&_i(ot.prototype,Sp,ot.prototype.disposeAsync);RE(ot.prototype,"AsyncDisposableStack");var zE=ot,ME=zE,NE=function(){return typeof AsyncDisposableStack=="function"?AsyncDisposableStack:ME},UE=vr,FE=Su(),ZE=NE,HE=function(){var e=ZE();return UE(FE,{AsyncDisposableStack:e},{AsyncDisposableStack:!0}),e},BE=US,GE=jS,VE=AE,WE=HE,jE=function(){BE(),GE(),VE(),WE()};jE();const _p=new WeakMap;function qE(n){return(typeof n=="object"||typeof n=="function")&&n!==null&&"then"in n&&typeof n.then=="function"}function Ir(n){return typeof n=="string"?n:typeof n=="symbol"?n.description??n.toString():n.name||"(anonymous class)"}function kp(){return new Error("register(Key, factory) requires a factory function. Wrap existing instances as () => instance.")}function YE(){return new Error("register(Key, factory) does not accept async factories. Await setup before registering.")}class XE{constructor(){b(this,"entries",new Map);b(this,"constructionStack",[])}register(e,t){if(t===void 0){if(typeof e!="function")throw kp();this.validateClassRegistration(e),this.storeFactory(e,()=>this.instantiateClass(e));return}if(typeof t!="function")throw kp();if(t.constructor.name==="AsyncFunction")throw YE();this.storeFactory(e,t)}has(e){var t;return((t=this.entries.get(e))==null?void 0:t.factory)!==void 0}resolve(e){return this.resolveAny(e)}storeFactory(e,t){const r=this.getOrCreateEntry(e);r.factory=t,r.instance=void 0,r.error=void 0}validateClassRegistration(e){const t=_p.get(e);if(t){if(e.length!==t.length)throw new Error(`${Ir(e)} cannot be registered with register(Class). @injectable(...) declared ${t.length} dependencies but constructor arity is ${e.length}. Use register(Key, () => value) instead.`);return}if(e.length!==0)throw new Error(`${Ir(e)} cannot be registered with register(Class). Undecorated classes must have zero required constructor parameters. Use register(Key, () => value) instead.`)}instantiateClass(e){const t=_p.get(e);if(!t)return new e;const r=t.map(i=>this.resolveAny(i));return new e(...r)}resolveAny(e){return this.getOrCreateEntry(e).proxy}getOrCreateEntry(e){let t=this.entries.get(e);return t||(t={key:e},t.proxy=this.createProxy(t),this.entries.set(e,t),t)}createProxy(e){return new Proxy({},{get:(t,r)=>{if(r==="then")return;const i=this.getInstance(e),s=Reflect.get(i,r,i);return typeof s=="function"?s.bind(i):s},set:(t,r,i)=>{const s=this.getInstance(e);return Reflect.set(s,r,i,s)},has:(t,r)=>{const i=this.getInstance(e);return r in i}})}getInstance(e){if(e.instance)return e.instance;if(e.error)throw e.error;if(!e.factory)throw new Error(`${Ir(e.key)} was resolved but never registered`);const t=this.constructionStack.indexOf(e.key);if(t!==-1){const r=[...this.constructionStack.slice(t),e.key].map(i=>Ir(i)).join(" -> ");throw new Error(`Circular dependency detected: ${r}`)}this.constructionStack.push(e.key);try{const r=e.factory();if(qE(r))throw new Error(`Factory for ${Ir(e.key)} returned a Promise. Await setup before registering.`);if(typeof r!="object"||r===null)throw new Error(`Factory for ${Ir(e.key)} returned a non-object value. Wrap primitives in an object.`);return e.instance=r,r}catch(r){throw e.error=r,r}finally{this.constructionStack.pop()}}}const qe=new XE,KE=new Set(["target","currentTarget","eventPhase","defaultPrevented","isTrusted","timeStamp","srcElement","returnValue","cancelBubble","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","composedPath","stopPropagation","stopImmediatePropagation","preventDefault","initEvent"]);function JE(n){for(const e of Object.keys(n))if(KE.has(e))throw new Error(`Event payload key "${e}" is reserved; choose a different property name`)}function QE(n,e){JE(e);for(const t of Object.keys(e))Object.defineProperty(n,t,{value:e[t],writable:!0,enumerable:!0,configurable:!0})}function yt(){class n extends Event{constructor(t,r){const{type:i,bubbles:s,cancelable:o,composed:a,...l}=r??{};if(i!==void 0)throw new Error('Do not pass "type" in init; use the constructor argument instead');super(t,{bubbles:s,cancelable:o,composed:a}),QE(this,l)}}return n}class bt extends globalThis.EventTarget{}function ex(n,e,t){const r=n.dispose.bind(n);n.dispose=()=>{if(!e())return t(),r()}}function ki(n){var t;class e extends n{constructor(...s){super(...s);w(this,t,!1);ex(this,()=>c(this,t),()=>{E(this,t,!0)})}[Symbol.dispose](){this.dispose()}get disposed(){return c(this,t)}}return t=new WeakMap,e}const tx=yt(),nx=yt(),qo=yt(),Vg="0123456789ABCDEFGHJKMNPQRSTVWXYZ",ua=32,rx=16,Wg=10,Ep=0xffffffffffff;var Un;(function(n){n.Base32IncorrectEncoding="B32_ENC_INVALID",n.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",n.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",n.EncodeTimeNegative="ENC_TIME_NEG",n.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",n.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",n.PRNGDetectFailure="PRNG_DETECT",n.ULIDInvalid="ULID_INVALID",n.Unexpected="UNEXPECTED",n.UUIDInvalid="UUID_INVALID"})(Un||(Un={}));class Bi extends Error{constructor(e,t){super(`${t} (${e})`),this.name="ULIDError",this.code=e}}function ix(n){const e=Math.floor(n()*ua)%ua;return Vg.charAt(e)}function sx(n){const e=ox(),t=e&&(e.crypto||e.msCrypto)||null;if(typeof(t==null?void 0:t.getRandomValues)=="function")return()=>{const r=new Uint8Array(1);return t.getRandomValues(r),r[0]/256};if(typeof(t==null?void 0:t.randomBytes)=="function")return()=>t.randomBytes(1).readUInt8()/256;throw new Bi(Un.PRNGDetectFailure,"Failed to find a reliable PRNG")}function ox(){return cx()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function ax(n,e){let t="";for(;n>0;n--)t=ix(e)+t;return t}function lx(n,e=Wg){if(isNaN(n))throw new Bi(Un.EncodeTimeValueMalformed,`Time must be a number: ${n}`);if(n>Ep)throw new Bi(Un.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${Ep}: ${n}`);if(n<0)throw new Bi(Un.EncodeTimeNegative,`Time must be positive: ${n}`);if(Number.isInteger(n)===!1)throw new Bi(Un.EncodeTimeValueMalformed,`Time must be an integer: ${n}`);let t,r="";for(let i=e;i>0;i--)t=n%ua,r=Vg.charAt(t)+r,n=(n-t)/ua;return r}function cx(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function qu(n,e){const t=sx(),r=Date.now();return lx(r,Wg)+ax(rx,t)}const Ot=4,et=6,jg=2,Tc=2,ux=Ot,hx=et,Yu="auto",mn="auto",Ln=120,xp=50,he=16,hr=Ln*Ot+he*(Ot-1),ha=Ln*et+he*(et-1),dx=hr+he*2,px=200,fx=4,$o=150,gx=10,Ap=2,$p=8,mx=300,vx=4;function qg(n){return Kg(n)}function Yg(n,e){return Kg(n.flatMap(t=>Qg(t,e)))}function Xg(n){const e=[],t=new Set;for(const r of n){if(r.type==="row"){e.push(`Top-level rows are invalid: ${r.id}`);continue}em(r,"strip",e,t)}return{valid:e.length===0,errors:e}}function Fr(n){const e=qg(n),t=Xg(e);if(!t.valid)throw new Error(`Invalid layout: ${t.errors.join("; ")}`);return{totalNodes:e.length,nodes:e.filter(r=>r.type!=="row").map(Sx)}}function Kg(n){const e=[];for(const t of n){const r=Jg(t);for(const i of r){if(i.type==="row"){e.push(...i.children.map(Kt));continue}e.push(i)}}return e}function Jg(n){switch(n.type){case"card":return[Kt(n)];case"row":{const e=n.children.map(Kt);return e.length===0?[]:e.length===1?[e[0]]:[{...n,children:e}]}case"stack":{const e=[];for(const t of n.children){const r=Jg(t);for(const i of r){if(i.type==="stack"){e.push(...i.children.map(Cc));continue}if(i.type==="row"){e.push({...i,children:i.children.map(Kt)});continue}e.push(Kt(i))}}return e.length===0?[]:e.length===1?[Cc(e[0])]:[{...n,children:e}]}}}function Qg(n,e){switch(n.type){case"card":return n.artifactID===e?[]:[Kt(n)];case"row":{const t=n.children.filter(r=>r.artifactID!==e).map(Kt);return t.length===0?[]:t.length===1?[t[0]]:[{...n,children:t}]}case"stack":{const t=n.children.flatMap(r=>Qg(r,e).filter(s=>s.type!=="stack"));return t.length===0?[]:t.length===1?[Cc(t[0])]:[{...n,children:t}]}}}function em(n,e,t,r){switch(n.type){case"card":tm(n,e,t,r);return;case"row":yx(n,e,t,r);return;case"stack":bx(n,e,t,r);return}}function tm(n,e,t,r){Xu(n.id,t),typeof n.artifactID!="string"||n.artifactID.length===0?t.push(`Card ${n.id} is missing artifactID`):r.has(n.artifactID)?t.push(`Duplicate artifactID in layout: ${n.artifactID}`):r.add(n.artifactID),wx(n.width)||t.push(`Card ${n.id} width must be an integer in the range 2-4`),nm(n.height)||t.push(`Card ${n.id} height must be an integer in the range 2-6 or "auto"`);const i=zn(n.width);e==="row"&&i<jg&&t.push(`Row child ${n.id} must be at least 2 columns wide`)}function yx(n,e,t,r){if(Xu(n.id,t),e!=="stack"&&t.push(`Row ${n.id} may only appear inside a stack`),nm(n.height,vx)||t.push(`Row ${n.id} height must be an integer in the range 2-4 or "auto"`),!Array.isArray(n.children)||n.children.length===0){t.push(`Row ${n.id} must contain card nodes`);return}let i=0;for(const s of n.children){if(s.type!=="card"){t.push(`Row ${n.id} must contain only card nodes`);continue}tm(s,"row",t,r),i+=zn(s.width)}i!==Ot&&t.push(`Row ${n.id} children must sum to 4 columns`)}function bx(n,e,t,r){if(Xu(n.id,t),e!=="strip"&&t.push(`Invalid nested stack at ${n.id}; stack children cannot contain another nested stack`),!Array.isArray(n.children)||n.children.length===0){t.push(`Stack ${n.id} must contain at least one child`);return}let i=0,s=0;for(const a of n.children){if(a.type==="stack"){t.push(`Stack ${n.id} cannot contain another nested stack`);continue}if(em(a,"stack",t,r),a.height===mn){s+=1;continue}i+=a.height}if(i>et&&t.push(`Stack ${n.id} exceeds the 6-row budget`),s===0)return;const o=et-i;if(o<s*Tc||o%s!==0){t.push(`Stack ${n.id} has auto-height children that cannot resolve to whole height >= 2`);return}o/s<Tc&&t.push(`Stack ${n.id} has auto-height children below the minimum row size`)}function Xu(n,e){(typeof n!="string"||n.length===0)&&e.push(`Node id must be a non-empty string: ${String(n)}`)}function wx(n){return n===Yu||Number.isInteger(n)&&n>=jg&&n<=ux}function nm(n,e=hx){return n===mn||Number.isInteger(n)&&n>=Tc&&n<=e}function zn(n){return n===Yu?Ot:n}function Sx(n){if(n.type==="card")return{id:n.id,type:"card",width:zn(n.width),cards:[{id:n.id,artifactID:n.artifactID,col:1,row:1,width:zn(n.width),height:rm(n.height,et)}]};const e=_x(n.children),t=[];let r=1;for(let i=0;i<n.children.length;i+=1){const s=n.children[i],o=e[i];if(s.type==="card")t.push({id:s.id,artifactID:s.artifactID,col:1,row:r,width:zn(s.width),height:o});else{let a=1;for(const l of s.children)t.push({id:l.id,artifactID:l.artifactID,col:a,row:r,width:zn(l.width),height:o}),a+=zn(l.width)}r+=o}return{id:n.id,type:"stack",width:t.reduce((i,s)=>Math.max(i,s.col+s.width-1),1),cards:t}}function _x(n){let e=0,t=0;for(const i of n)i.height===mn?t+=1:e+=i.height;const r=t>0?(et-e)/t:0;return n.map(i=>rm(i.height,r))}function rm(n,e){return n===mn?e:n}function Kt(n){return{...n}}function Cc(n){return n.type==="card"?Kt(n):{...n,children:n.children.map(Kt)}}function im(n,e={}){return{id:e.id??qu(),type:"card",artifactID:n,width:e.width??Yu,height:e.height??mn}}function sm(n,e){return n.some(t=>om(t,e))}function om(n,e){switch(n.type){case"card":return n.artifactID===e;case"row":return n.children.some(t=>t.artifactID===e);case"stack":return n.children.some(t=>om(t,e))}}function Tp(n){return n.layout.flatMap(am)}function am(n){switch(n.type){case"card":return[n.artifactID];case"row":return n.children.map(e=>e.artifactID);case"stack":return n.children.flatMap(am)}}const K=yt(),lm=yt(),Pr=yt(),kx=yt();function Ex(n){class e extends Error{constructor(r,i){super(r),this.name=n,i&&Object.assign(this,i)}}return e}const xx=Ex("RequestError"),Ax=200,$x=300;class Tx{constructor(e,t){b(this,"serverURL");b(this,"token");this.serverURL=e.replace(/\/$/,""),this.token=t.token}async requestJSON(e,t,r){const i=await this.request(e,t,r!==void 0?JSON.stringify(r):void 0,r!==void 0?{"content-type":"application/json"}:void 0),s=await Cx(i);if(!i.ok||i.status<Ax||i.status>=$x)throw this.createError(typeof s.error=="string"?s.error:i.statusText,i.status);return s}async requestVoid(e,t){const r=await this.request(e,t);if(!r.ok)throw this.createError(await Xl(r,r.statusText),r.status)}async requestText(e,t){const r=await this.request(e,t);if(!r.ok)throw this.createError(await Xl(r,r.statusText),r.status);return r.text()}async requestRawVoid(e,t,r){const i=await this.request(e,t,r,{"content-type":"text/plain"});if(!i.ok)throw this.createError(await Xl(i,i.statusText),i.status)}createError(e,t){const r={serverURL:this.serverURL};return t!==void 0&&(r.status=t),new xx(e,r)}async request(e,t,r,i){const s=`${this.serverURL}${t}`;try{return await fetch(s,{method:e,headers:this.buildHeaders(i),body:r})}catch(o){throw this.createError(o instanceof Error?o.message:"Failed to reach server")}}buildHeaders(e){const t={...e??{}};return this.token&&(t.Authorization=`Bearer ${this.token}`),Object.keys(t).length>0?t:void 0}}async function Cx(n){try{return await n.json()}catch{const e=await n.text().catch(()=>"");return e?{message:e}:{}}}async function Xl(n,e){try{const t=await n.json();if(typeof t.error=="string")return t.error;if(typeof t.message=="string")return t.message}catch{}return e}function Ix(n){return n.map(e=>`${e.name} (${e.id})`).join(", ")}var Tt,ka,cm;class Px{constructor(e){w(this,ka);w(this,Tt);E(this,Tt,e)}list(){return c(this,Tt).requestJSON("GET","/screens")}async get(e={}){const t=await v(this,ka,cm).call(this,e.screenID);return c(this,Tt).requestJSON("GET",`/screens/${encodeURIComponent(t)}`)}create(e){const t={name:e.name};return e.id!==void 0&&(t.id=e.id),c(this,Tt).requestJSON("POST","/screens",t)}update(e){const{screenID:t,...r}=e;return c(this,Tt).requestJSON("PATCH",`/screens/${encodeURIComponent(t)}`,r)}remove(e){return c(this,Tt).requestJSON("DELETE",`/screens/${encodeURIComponent(e.screenID)}`)}}Tt=new WeakMap,ka=new WeakSet,cm=async function(e){if(e!==void 0)return e;const{screens:t}=await this.list();if(t.length===1)return t[0].id;throw c(this,Tt).createError(`screenID is required when multiple screens exist. Available screens: ${Ix(t)}`)};var Oe;class Rx{constructor(e){w(this,Oe);E(this,Oe,e)}create(e){const t={type:e.type,title:e.title};return e.externalFilePath!==void 0&&(t.externalFilePath=e.externalFilePath),e.screenID!==void 0&&(t.screenID=e.screenID),c(this,Oe).requestJSON("POST","/artifacts",t)}list(e={}){const t=new URLSearchParams;e.screenID!==void 0&&t.set("screenID",e.screenID),e.unplaced&&t.set("unplaced","true");const r=t.toString();return c(this,Oe).requestJSON("GET",r?`/artifacts?${r}`:"/artifacts")}get(e){return c(this,Oe).requestJSON("GET",`/artifacts/${encodeURIComponent(e.artifactID)}`)}update(e){const t={};return e.title!==void 0&&(t.title=e.title),c(this,Oe).requestJSON("PATCH",`/artifacts/${encodeURIComponent(e.artifactID)}`,t)}edit(e){return c(this,Oe).requestJSON("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/edit`)}commitPending(e){return c(this,Oe).requestJSON("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/commit`)}abandonPending(e){return c(this,Oe).requestVoid("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/abandon`)}attach(e){return c(this,Oe).requestJSON("POST",`/screens/${encodeURIComponent(e.screenID)}/artifacts/${encodeURIComponent(e.artifactID)}`)}detach(e){return c(this,Oe).requestJSON("DELETE",`/screens/${encodeURIComponent(e.screenID)}/artifacts/${encodeURIComponent(e.artifactID)}`)}delete(e){return c(this,Oe).requestJSON("DELETE",`/artifacts/${encodeURIComponent(e.artifactID)}`)}getContent(e){return c(this,Oe).requestText("GET",`/artifacts/${encodeURIComponent(e.artifactID)}/content`)}putContent(e){return c(this,Oe).requestRawVoid("PUT",`/artifacts/${encodeURIComponent(e.artifactID)}/content`,e.content)}}Oe=new WeakMap;var Hn;class Dx{constructor(e){w(this,Hn);E(this,Hn,e)}state(){return c(this,Hn).requestJSON("GET","/viewer/state")}setActive(e){return c(this,Hn).requestJSON("PUT","/viewer/active-screen",{screenID:e.screenID})}focus(e){const t={artifactID:e.artifactID};return e.screenID!==void 0&&(t.screenID=e.screenID),c(this,Hn).requestJSON("POST","/viewer/focus",t)}}Hn=new WeakMap;var us;class Ox{constructor(e){w(this,us);E(this,us,e)}async list(){const{views:e}=await c(this,us).requestJSON("GET","/views");return e}}us=new WeakMap;var Bt;class Lx{constructor(e,t={}){b(this,"screens");b(this,"artifacts");b(this,"viewer");b(this,"views");w(this,Bt);E(this,Bt,new Tx(e,t)),this.screens=new Px(c(this,Bt)),this.artifacts=new Rx(c(this,Bt)),this.viewer=new Dx(c(this,Bt)),this.views=new Ox(c(this,Bt))}health(){return c(this,Bt).requestJSON("GET","/health")}}Bt=new WeakMap;const zx={focusCommandInput:{label:"Focus Command Input",trigger:{key:"k",meta:!0}}},Mx=ki(bt);var Bn,Be,Gn,Me,ut,on,an,J,Pn,um,hs,hm,dm,pm,fm,Ic,Pc,Rc,gm;class Nx extends Mx{constructor(t){var i;super();w(this,J);b(this,"id");b(this,"server");w(this,Bn);w(this,Be,new Map);w(this,Gn);w(this,Me);w(this,ut);w(this,on);w(this,an,null);w(this,hs,t=>{if(this.disposed)return;const r=t.event;switch(r.type){case"screen-updated":r.screen.id===this.id&&v(this,J,hm).call(this,r.screen);break;case"artifact-created":break;case"artifact-attached":r.screenID===this.id&&v(this,J,dm).call(this,r.cardID,r.artifact);break;case"artifact-updated":v(this,J,pm).call(this,r.artifact);break;case"artifact-removed":r.screenID===this.id&&v(this,J,fm).call(this,r.artifactID);break;case"artifact-content-changed":c(this,Be).has(r.artifactID)&&this.dispatchEvent(new kx("artifact-content-changed",{artifactID:r.artifactID}));break}});this.id=t.screen.id,this.server=t.server,E(this,Bn,t.localStore),E(this,Gn,t.screen.name),E(this,Me,structuredClone(t.screen.layout)),E(this,ut,t.screen.starred);const r=((i=c(this,Bn).get().screens[this.id])==null?void 0:i.scrollPosition)??0;E(this,on,Math.max(0,r)),this.server.addEventListener("server-event",c(this,hs)),v(this,J,um).call(this)}get name(){return c(this,Gn)}get layout(){return c(this,Me)}get starred(){return c(this,ut)}get scrollPosition(){return c(this,on)}get artifacts(){return c(this,Be)}setScrollPosition(t){v(this,J,Pn).call(this);const r=Math.max(0,t);r!==c(this,on)&&(E(this,on,r),v(this,J,gm).call(this),this.dispatchEvent(new K("change")))}setLayout(t){v(this,J,Pn).call(this);const r=qg(t);if(!Xg(r).valid)return;const s=v(this,J,Pc).call(this);E(this,Me,r),E(this,an,{layout:r,snapshot:s}),this.dispatchEvent(new K("change")),this.server.client.screens.update({screenID:this.id,layout:r.map(o=>structuredClone(o))}).catch(()=>{var o;this.disposed||((o=c(this,an))==null?void 0:o.layout)===r&&(E(this,an,null),v(this,J,Rc).call(this,s),this.dispatchEvent(new K("change")))})}rename(t){v(this,J,Pn).call(this),E(this,Gn,t),this.dispatchEvent(new K("change")),this.server.client.screens.update({screenID:this.id,name:t}).catch(()=>{})}setStarred(t){if(v(this,J,Pn).call(this),c(this,ut)===t)return;const r=c(this,ut);E(this,ut,t),this.dispatchEvent(new K("change")),this.server.client.screens.update({screenID:this.id,starred:t}).catch(()=>{this.disposed||c(this,ut)===t&&(E(this,ut,r),this.dispatchEvent(new K("change")))})}async remove(){v(this,J,Pn).call(this),await this.server.client.screens.remove({screenID:this.id})}removeArtifact(t){if(v(this,J,Pn).call(this),!c(this,Be).has(t))return;const r=v(this,J,Pc).call(this);v(this,J,Ic).call(this,t),this.dispatchEvent(new K("change")),this.server.client.artifacts.detach({artifactID:t,screenID:this.id}).catch(()=>{this.disposed||(v(this,J,Rc).call(this,r),this.dispatchEvent(new K("change")))})}dispose(){this.server.removeEventListener("server-event",c(this,hs))}}Bn=new WeakMap,Be=new WeakMap,Gn=new WeakMap,Me=new WeakMap,ut=new WeakMap,on=new WeakMap,an=new WeakMap,J=new WeakSet,Pn=function(){if(this.disposed)throw new Error("ScreenModel is disposed")},um=async function(){try{const t=await this.server.client.screens.get({screenID:this.id});if(this.disposed)return;for(const r of t.artifacts)c(this,Be).set(r.id,r);this.dispatchEvent(new K("change"))}catch{}},hs=new WeakMap,hm=function(t){c(this,an)&&E(this,an,null),E(this,Gn,t.name),E(this,Me,structuredClone(t.layout)),E(this,ut,t.starred),this.dispatchEvent(new K("change"))},dm=function(t,r){sm(c(this,Me),r.id)||E(this,Me,[...c(this,Me),im(r.id,{id:t})]),c(this,Be).set(r.id,r),this.dispatchEvent(new K("change"))},pm=function(t){const r=c(this,Be).get(t.id);r&&(c(this,Be).set(t.id,{...r,...t}),this.dispatchEvent(new K("change")))},fm=function(t){v(this,J,Ic).call(this,t)&&this.dispatchEvent(new K("change"))},Ic=function(t){const r=c(this,Be).delete(t),i=Tp({layout:c(this,Me)}).length,s=Yg(c(this,Me),t),o=Tp({layout:s}).length;return E(this,Me,s),r||i!==o},Pc=function(){return{layout:structuredClone(c(this,Me)),artifacts:new Map([...c(this,Be).entries()].map(([t,r])=>[t,structuredClone(r)]))}},Rc=function(t){E(this,Me,structuredClone(t.layout)),c(this,Be).clear();for(const[r,i]of t.artifacts)c(this,Be).set(r,structuredClone(i))},gm=function(){const t=c(this,Bn).get();c(this,Bn).set({...t,screens:{...t.screens,[this.id]:{scrollPosition:c(this,on)}}})};const Ux=ki(bt);var tt,Ct,ht,ds,ps,fs,Vr,Yo;class Fx extends Ux{constructor(t){super();w(this,Vr);w(this,tt);w(this,Ct);w(this,ht,null);w(this,ds,()=>{this.disposed||v(this,Vr,Yo).call(this)});w(this,ps,()=>{this.disposed||v(this,Vr,Yo).call(this)});w(this,fs,t=>{var i;if(this.disposed)return;const r=t.event;if(r.type==="screen-removed"&&((i=c(this,ht))==null?void 0:i.id)===r.screenID&&this.clearActive(),r.type==="viewer-active-screen-changed"){const s=c(this,Ct).servers.get(t.serverURL);s&&s.screens.has(r.screenID)&&this.setActive(t.serverURL,r.screenID)}});E(this,tt,t.localStore),E(this,Ct,t.serverManager),c(this,tt).addEventListener("change",c(this,ds)),c(this,Ct).addEventListener("change",c(this,ps)),c(this,Ct).addEventListener("server-event",c(this,fs)),v(this,Vr,Yo).call(this)}get activeScreen(){return c(this,ht)}setActive(t,r){const i=c(this,tt).get();i.activeServerURL===t&&i.activeScreenID===r||c(this,tt).set({...i,activeServerURL:t,activeScreenID:r})}clearActive(){const t=c(this,tt).get();t.activeScreenID!==null&&c(this,tt).set({...t,activeScreenID:null})}dispose(){var t;c(this,tt).removeEventListener("change",c(this,ds)),c(this,Ct).removeEventListener("change",c(this,ps)),c(this,Ct).removeEventListener("server-event",c(this,fs)),(t=c(this,ht))==null||t.dispose(),E(this,ht,null)}}tt=new WeakMap,Ct=new WeakMap,ht=new WeakMap,ds=new WeakMap,ps=new WeakMap,fs=new WeakMap,Vr=new WeakSet,Yo=function(){var l,u,h;const{activeServerURL:t,activeScreenID:r}=c(this,tt).get(),i=t?c(this,Ct).servers.get(t)??null:null,s=i&&r?i.screens.get(r)??null:null,o=((l=c(this,ht))==null?void 0:l.id)??null,a=(s==null?void 0:s.id)??null;o===a&&((u=c(this,ht))==null?void 0:u.server)===i||((h=c(this,ht))==null||h.dispose(),E(this,ht,i&&s?new Nx({screen:s,server:i,localStore:c(this,tt)}):null),this.dispatchEvent(new tx("active-screen-changed")))};const Zx="Local",Hx="store-";function $t(n){return new URL(n).origin}function Bx(n){return{servers:[{url:$t(n),name:Zx}],activeServerURL:null,activeScreenID:null,screens:{}}}var Vn,Wn,jn;class Gx extends bt{constructor(t,r,i={}){super();w(this,Vn);w(this,Wn);w(this,jn);E(this,Vn,`${Hx}${t}`),E(this,Wn,i.storage??Vx());const s=c(this,Wn).getItem(c(this,Vn));s===null?(E(this,jn,r),c(this,Wn).setItem(c(this,Vn),JSON.stringify(r))):E(this,jn,JSON.parse(s))}get(){return c(this,jn)}set(t){E(this,jn,t),c(this,Wn).setItem(c(this,Vn),JSON.stringify(t)),this.dispatchEvent(new K("change"))}}Vn=new WeakMap,Wn=new WeakMap,jn=new WeakMap;function Vx(){const n=globalThis.localStorage;if(!n)throw new Error("LocalStore: no storage adapter supplied and window.localStorage is unavailable");return n}function x(n,e,t){function r(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:o,traits:new Set},enumerable:!1}),a._zod.traits.has(n))return;a._zod.traits.add(n),e(a,l);const u=o.prototype,h=Object.keys(u);for(let p=0;p<h.length;p++){const g=h[p];g in a||(a[g]=u[g].bind(a))}}const i=(t==null?void 0:t.Parent)??Object;class s extends i{}Object.defineProperty(s,"name",{value:n});function o(a){var l;const u=t!=null&&t.Parent?new s:this;r(u,a),(l=u._zod).deferred??(l.deferred=[]);for(const h of u._zod.deferred)h();return u}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>{var l,u;return t!=null&&t.Parent&&a instanceof t.Parent?!0:(u=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:u.has(n)}}),Object.defineProperty(o,"name",{value:n}),o}class Gr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class mm extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const vm={};function vn(n){return vm}function ym(n){const e=Object.values(n).filter(r=>typeof r=="number");return Object.entries(n).filter(([r,i])=>e.indexOf(+r)===-1).map(([r,i])=>i)}function Dc(n,e){return typeof e=="bigint"?e.toString():e}function Ku(n){return{get value(){{const e=n();return Object.defineProperty(this,"value",{value:e}),e}}}}function Ju(n){return n==null}function Qu(n){const e=n.startsWith("^")?1:0,t=n.endsWith("$")?n.length-1:n.length;return n.slice(e,t)}function Wx(n,e){const t=(n.toString().split(".")[1]||"").length,r=e.toString();let i=(r.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(r)){const l=r.match(/\d?e-(\d?)/);l!=null&&l[1]&&(i=Number.parseInt(l[1]))}const s=t>i?t:i,o=Number.parseInt(n.toFixed(s).replace(".","")),a=Number.parseInt(e.toFixed(s).replace(".",""));return o%a/10**s}const Cp=Symbol("evaluating");function ee(n,e,t){let r;Object.defineProperty(n,e,{get(){if(r!==Cp)return r===void 0&&(r=Cp,r=t()),r},set(i){Object.defineProperty(n,e,{value:i})},configurable:!0})}function br(n,e,t){Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}function En(...n){const e={};for(const t of n){const r=Object.getOwnPropertyDescriptors(t);Object.assign(e,r)}return Object.defineProperties({},e)}function Ip(n){return JSON.stringify(n)}function jx(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const bm="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function da(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const qx=Ku(()=>{var n;if(typeof navigator<"u"&&((n=navigator==null?void 0:navigator.userAgent)!=null&&n.includes("Cloudflare")))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function hi(n){if(da(n)===!1)return!1;const e=n.constructor;if(e===void 0||typeof e!="function")return!0;const t=e.prototype;return!(da(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}function wm(n){return hi(n)?{...n}:Array.isArray(n)?[...n]:n}const Yx=new Set(["string","number","symbol"]);function di(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xn(n,e,t){const r=new n._zod.constr(e??n._zod.def);return(!e||t!=null&&t.parent)&&(r._zod.parent=n),r}function L(n){const e=n;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Xx(n){return Object.keys(n).filter(e=>n[e]._zod.optin==="optional"&&n[e]._zod.optout==="optional")}const Kx={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Jx(n,e){const t=n._zod.def,r=t.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=En(n._zod.def,{get shape(){const o={};for(const a in e){if(!(a in t.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(o[a]=t.shape[a])}return br(this,"shape",o),o},checks:[]});return xn(n,s)}function Qx(n,e){const t=n._zod.def,r=t.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=En(n._zod.def,{get shape(){const o={...n._zod.def.shape};for(const a in e){if(!(a in t.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete o[a]}return br(this,"shape",o),o},checks:[]});return xn(n,s)}function e1(n,e){if(!hi(e))throw new Error("Invalid input to extend: expected a plain object");const t=n._zod.def.checks;if(t&&t.length>0){const s=n._zod.def.shape;for(const o in e)if(Object.getOwnPropertyDescriptor(s,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=En(n._zod.def,{get shape(){const s={...n._zod.def.shape,...e};return br(this,"shape",s),s}});return xn(n,i)}function t1(n,e){if(!hi(e))throw new Error("Invalid input to safeExtend: expected a plain object");const t=En(n._zod.def,{get shape(){const r={...n._zod.def.shape,...e};return br(this,"shape",r),r}});return xn(n,t)}function n1(n,e){const t=En(n._zod.def,{get shape(){const r={...n._zod.def.shape,...e._zod.def.shape};return br(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:[]});return xn(n,t)}function r1(n,e,t){const i=e._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const o=En(e._zod.def,{get shape(){const a=e._zod.def.shape,l={...a};if(t)for(const u in t){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(l[u]=n?new n({type:"optional",innerType:a[u]}):a[u])}else for(const u in a)l[u]=n?new n({type:"optional",innerType:a[u]}):a[u];return br(this,"shape",l),l},checks:[]});return xn(e,o)}function i1(n,e,t){const r=En(e._zod.def,{get shape(){const i=e._zod.def.shape,s={...i};if(t)for(const o in t){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(s[o]=new n({type:"nonoptional",innerType:i[o]}))}else for(const o in i)s[o]=new n({type:"nonoptional",innerType:i[o]});return br(this,"shape",s),s}});return xn(e,r)}function Zr(n,e=0){var t;if(n.aborted===!0)return!0;for(let r=e;r<n.issues.length;r++)if(((t=n.issues[r])==null?void 0:t.continue)!==!0)return!0;return!1}function Hr(n,e){return e.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(n),t})}function To(n){return typeof n=="string"?n:n==null?void 0:n.message}function yn(n,e,t){var i,s,o,a,l,u;const r={...n,path:n.path??[]};if(!n.message){const h=To((o=(s=(i=n.inst)==null?void 0:i._zod.def)==null?void 0:s.error)==null?void 0:o.call(s,n))??To((a=e==null?void 0:e.error)==null?void 0:a.call(e,n))??To((l=t.customError)==null?void 0:l.call(t,n))??To((u=t.localeError)==null?void 0:u.call(t,n))??"Invalid input";r.message=h}return delete r.inst,delete r.continue,e!=null&&e.reportInput||delete r.input,r}function eh(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function ss(...n){const[e,t,r]=n;return typeof e=="string"?{message:e,code:"custom",input:t,inst:r}:{...e}}const Sm=(n,e)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:e,enumerable:!1}),n.message=JSON.stringify(e,Dc,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},_m=x("$ZodError",Sm),km=x("$ZodError",Sm,{Parent:Error});function s1(n,e=t=>t.message){const t={},r=[];for(const i of n.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:t}}function o1(n,e=t=>t.message){const t={_errors:[]},r=i=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(o=>r({issues:o}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)t._errors.push(e(s));else{let o=t,a=0;for(;a<s.path.length;){const l=s.path[a];a===s.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(e(s))):o[l]=o[l]||{_errors:[]},o=o[l],a++}}};return r(n),t}const th=n=>(e,t,r,i)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},o=e._zod.run({value:t,issues:[]},s);if(o instanceof Promise)throw new Gr;if(o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(l=>yn(l,s,vn())));throw bm(a,i==null?void 0:i.callee),a}return o.value},nh=n=>async(e,t,r,i)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let o=e._zod.run({value:t,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(l=>yn(l,s,vn())));throw bm(a,i==null?void 0:i.callee),a}return o.value},Ka=n=>(e,t,r)=>{const i=r?{...r,async:!1}:{async:!1},s=e._zod.run({value:t,issues:[]},i);if(s instanceof Promise)throw new Gr;return s.issues.length?{success:!1,error:new(n??_m)(s.issues.map(o=>yn(o,i,vn())))}:{success:!0,data:s.value}},a1=Ka(km),Ja=n=>async(e,t,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=e._zod.run({value:t,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new n(s.issues.map(o=>yn(o,i,vn())))}:{success:!0,data:s.value}},l1=Ja(km),c1=n=>(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return th(n)(e,t,i)},u1=n=>(e,t,r)=>th(n)(e,t,r),h1=n=>async(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return nh(n)(e,t,i)},d1=n=>async(e,t,r)=>nh(n)(e,t,r),p1=n=>(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ka(n)(e,t,i)},f1=n=>(e,t,r)=>Ka(n)(e,t,r),g1=n=>async(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ja(n)(e,t,i)},m1=n=>async(e,t,r)=>Ja(n)(e,t,r),v1=/^[cC][^\s-]{8,}$/,y1=/^[0-9a-z]+$/,b1=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,w1=/^[0-9a-vA-V]{20}$/,S1=/^[A-Za-z0-9]{27}$/,_1=/^[a-zA-Z0-9_-]{21}$/,k1=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,E1=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Pp=n=>n?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${n}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,x1=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,A1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function $1(){return new RegExp(A1,"u")}const T1=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,C1=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,I1=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,P1=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,R1=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Em=/^[A-Za-z0-9_-]*$/,D1=/^\+[1-9]\d{6,14}$/,xm="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",O1=new RegExp(`^${xm}$`);function Am(n){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof n.precision=="number"?n.precision===-1?`${e}`:n.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${n.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function L1(n){return new RegExp(`^${Am(n)}$`)}function z1(n){const e=Am({precision:n.precision}),t=["Z"];n.local&&t.push(""),n.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${e}(?:${t.join("|")})`;return new RegExp(`^${xm}T(?:${r})$`)}const M1=n=>{const e=n?`[\\s\\S]{${(n==null?void 0:n.minimum)??0},${(n==null?void 0:n.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},N1=/^-?\d+$/,$m=/^-?\d+(?:\.\d+)?$/,U1=/^(?:true|false)$/i,F1=/^[^A-Z]*$/,Z1=/^[^a-z]*$/,Ye=x("$ZodCheck",(n,e)=>{var t;n._zod??(n._zod={}),n._zod.def=e,(t=n._zod).onattach??(t.onattach=[])}),Tm={number:"number",bigint:"bigint",object:"date"},Cm=x("$ZodCheckLessThan",(n,e)=>{Ye.init(n,e);const t=Tm[typeof e.value];n._zod.onattach.push(r=>{const i=r._zod.bag,s=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),n._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:t,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:n,continue:!e.abort})}}),Im=x("$ZodCheckGreaterThan",(n,e)=>{Ye.init(n,e);const t=Tm[typeof e.value];n._zod.onattach.push(r=>{const i=r._zod.bag,s=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),n._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:t,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:n,continue:!e.abort})}}),H1=x("$ZodCheckMultipleOf",(n,e)=>{Ye.init(n,e),n._zod.onattach.push(t=>{var r;(r=t._zod.bag).multipleOf??(r.multipleOf=e.value)}),n._zod.check=t=>{if(typeof t.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof t.value=="bigint"?t.value%e.value===BigInt(0):Wx(t.value,e.value)===0)||t.issues.push({origin:typeof t.value,code:"not_multiple_of",divisor:e.value,input:t.value,inst:n,continue:!e.abort})}}),B1=x("$ZodCheckNumberFormat",(n,e)=>{var o;Ye.init(n,e),e.format=e.format||"float64";const t=(o=e.format)==null?void 0:o.includes("int"),r=t?"int":"number",[i,s]=Kx[e.format];n._zod.onattach.push(a=>{const l=a._zod.bag;l.format=e.format,l.minimum=i,l.maximum=s,t&&(l.pattern=N1)}),n._zod.check=a=>{const l=a.value;if(t){if(!Number.isInteger(l)){a.issues.push({expected:r,format:e.format,code:"invalid_type",continue:!1,input:l,inst:n});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:r,inclusive:!0,continue:!e.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:r,inclusive:!0,continue:!e.abort});return}}l<i&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:i,inclusive:!0,inst:n,continue:!e.abort}),l>s&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:s,inclusive:!0,inst:n,continue:!e.abort})}}),G1=x("$ZodCheckMaxLength",(n,e)=>{var t;Ye.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!Ju(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),n._zod.check=r=>{const i=r.value;if(i.length<=e.maximum)return;const o=eh(i);r.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:n,continue:!e.abort})}}),V1=x("$ZodCheckMinLength",(n,e)=>{var t;Ye.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!Ju(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),n._zod.check=r=>{const i=r.value;if(i.length>=e.minimum)return;const o=eh(i);r.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:n,continue:!e.abort})}}),W1=x("$ZodCheckLengthEquals",(n,e)=>{var t;Ye.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!Ju(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),n._zod.check=r=>{const i=r.value,s=i.length;if(s===e.length)return;const o=eh(i),a=s>e.length;r.issues.push({origin:o,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:n,continue:!e.abort})}}),Qa=x("$ZodCheckStringFormat",(n,e)=>{var t,r;Ye.init(n,e),n._zod.onattach.push(i=>{const s=i._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(t=n._zod).check??(t.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:n,continue:!e.abort})}):(r=n._zod).check??(r.check=()=>{})}),j1=x("$ZodCheckRegex",(n,e)=>{Qa.init(n,e),n._zod.check=t=>{e.pattern.lastIndex=0,!e.pattern.test(t.value)&&t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:e.pattern.toString(),inst:n,continue:!e.abort})}}),q1=x("$ZodCheckLowerCase",(n,e)=>{e.pattern??(e.pattern=F1),Qa.init(n,e)}),Y1=x("$ZodCheckUpperCase",(n,e)=>{e.pattern??(e.pattern=Z1),Qa.init(n,e)}),X1=x("$ZodCheckIncludes",(n,e)=>{Ye.init(n,e);const t=di(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${t}`:t);e.pattern=r,n._zod.onattach.push(i=>{const s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),n._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:n,continue:!e.abort})}}),K1=x("$ZodCheckStartsWith",(n,e)=>{Ye.init(n,e);const t=new RegExp(`^${di(e.prefix)}.*`);e.pattern??(e.pattern=t),n._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(t)}),n._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:n,continue:!e.abort})}}),J1=x("$ZodCheckEndsWith",(n,e)=>{Ye.init(n,e);const t=new RegExp(`.*${di(e.suffix)}$`);e.pattern??(e.pattern=t),n._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(t)}),n._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:n,continue:!e.abort})}}),Q1=x("$ZodCheckOverwrite",(n,e)=>{Ye.init(n,e),n._zod.check=t=>{t.value=e.tx(t.value)}});class eA{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
4
+ `+e.prev}function ko(n,e){var t=_c(n),r=[];if(t){r.length=n.length;for(var i=0;i<n.length;i++)r[i]=Ht(n,i)?e(n[i],n):""}var s=typeof Ml=="function"?Ml(n):[],o;if(ui){o={};for(var a=0;a<s.length;a++)o["$"+s[a]]=s[a]}for(var l in n)Ht(n,l)&&(t&&String(Number(l))===l&&l<n.length||ui&&o["$"+l]instanceof Symbol||(gg.call(/[^\w$]/,l)?r.push(e(l,n)+": "+e(n[l],n)):r.push(l+": "+e(n[l],n))));if(typeof Ml=="function")for(var u=0;u<s.length;u++)mg.call(n,s[u])&&r.push("["+e(s[u])+"]: "+e(n[s[u]],n));return r}var A_=wi,$_=j,ja=function(n,e,t){for(var r=n,i;(i=r.next)!=null;r=i)if(i.key===e)return r.next=i.next,t||(i.next=n.next,n.next=i),i},T_=function(n,e){if(n){var t=ja(n,e);return t&&t.value}},C_=function(n,e,t){var r=ja(n,e);r?r.value=t:n.next={key:e,next:n.next,value:t}},I_=function(n,e){return n?!!ja(n,e):!1},P_=function(n,e){if(n)return ja(n,e,!0)},R_=function(){var e,t={assert:function(r){if(!t.has(r))throw new $_("Side channel does not contain "+A_(r))},delete:function(r){var i=e&&e.next,s=P_(e,r);return s&&i&&i===s&&(e=void 0),!!s},get:function(r){return T_(e,r)},has:function(r){return I_(e,r)},set:function(r,i){e||(e={next:void 0}),C_(e,r,i)}};return t},D_=lt,no=_n(),O_=wi,L_=j,Hd=D_("%Map%",!0),z_=no("Map.prototype.get",!0),M_=no("Map.prototype.set",!0),N_=no("Map.prototype.has",!0),U_=no("Map.prototype.delete",!0),F_=no("Map.prototype.size",!0),_g=!!Hd&&function(){var e,t={assert:function(r){if(!t.has(r))throw new L_("Side channel does not contain "+O_(r))},delete:function(r){if(e){var i=U_(e,r);return F_(e)===0&&(e=void 0),i}return!1},get:function(r){if(e)return z_(e,r)},has:function(r){return e?N_(e,r):!1},set:function(r,i){e||(e=new Hd),M_(e,r,i)}};return t},Z_=lt,qa=_n(),H_=wi,Eo=_g,B_=j,Cr=Z_("%WeakMap%",!0),G_=qa("WeakMap.prototype.get",!0),V_=qa("WeakMap.prototype.set",!0),W_=qa("WeakMap.prototype.has",!0),j_=qa("WeakMap.prototype.delete",!0),q_=Cr?function(){var e,t,r={assert:function(i){if(!r.has(i))throw new B_("Side channel does not contain "+H_(i))},delete:function(i){if(Cr&&i&&(typeof i=="object"||typeof i=="function")){if(e)return j_(e,i)}else if(Eo&&t)return t.delete(i);return!1},get:function(i){return Cr&&i&&(typeof i=="object"||typeof i=="function")&&e?G_(e,i):t&&t.get(i)},has:function(i){return Cr&&i&&(typeof i=="object"||typeof i=="function")&&e?W_(e,i):!!t&&t.has(i)},set:function(i,s){Cr&&i&&(typeof i=="object"||typeof i=="function")?(e||(e=new Cr),V_(e,i,s)):Eo&&(t||(t=Eo()),t.set(i,s))}};return r}:Eo,Y_=j,X_=wi,K_=R_,J_=_g,Q_=q_,ek=Q_||J_||K_,tk=function(){var e,t={assert:function(r){if(!t.has(r))throw new Y_("Side channel does not contain "+X_(r))},delete:function(r){return!!e&&e.delete(r)},get:function(r){return e&&e.get(r)},has:function(r){return!!e&&e.has(r)},set:function(r,i){e||(e=ek()),e.set(r,i)}};return t},nk=tn,Oi=tk(),Ut=j,Ou={assert:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Ut("`O` is not an object");if(typeof e!="string")throw new Ut("`slot` must be a string");if(Oi.assert(n),!Ou.has(n,e))throw new Ut("`"+e+"` is not present on `O`")},get:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Ut("`O` is not an object");if(typeof e!="string")throw new Ut("`slot` must be a string");var t=Oi.get(n);return t&&t["$"+e]},has:function(n,e){if(!n||typeof n!="object"&&typeof n!="function")throw new Ut("`O` is not an object");if(typeof e!="string")throw new Ut("`slot` must be a string");var t=Oi.get(n);return!!t&&nk(t,"$"+e)},set:function(n,e,t){if(!n||typeof n!="object"&&typeof n!="function")throw new Ut("`O` is not an object");if(typeof e!="string")throw new Ut("`slot` must be a string");var r=Oi.get(n);r||(r={},Oi.set(n,r)),r["$"+e]=t}};Object.freeze&&Object.freeze(Ou);var Lu=Ou,kg=Qt,gn=Lu,ro=function n(e,t){if(!(this instanceof n))return new n(e,t);if(e!=="normal"&&e!=="break"&&e!=="continue"&&e!=="return"&&e!=="throw")throw new kg('Assertion failed: `type` must be one of "normal", "break", "continue", "return", or "throw"');gn.set(this,"[[Type]]",e),gn.set(this,"[[Value]]",t)};ro.prototype.type=function(){return gn.get(this,"[[Type]]")};ro.prototype.value=function(){return gn.get(this,"[[Value]]")};ro.prototype["?"]=function(){var e=gn.get(this,"[[Type]]"),t=gn.get(this,"[[Value]]");if(e==="throw")throw t;return t};ro.prototype["!"]=function(){var e=gn.get(this,"[[Type]]");if(e!=="normal")throw new kg('Assertion failed: Completion Record is not of type "normal"');return gn.get(this,"[[Value]]")};var zu=ro,rk=zu,Mu=function(e){return new rk("normal",e)},Ul,Bd;function ik(){if(Bd)return Ul;Bd=1;var n=mi;return Ul=function(){return n()&&!!Symbol.toStringTag},Ul}var sk=lt,Gd=sk("%Object.defineProperty%",!0),ok=ik()(),ak=tn,lk=j,xo=ok?Symbol.toStringTag:null,Eg=function(e,t){var r=arguments.length>2&&!!arguments[2]&&arguments[2].force,i=arguments.length>2&&!!arguments[2]&&arguments[2].nonConfigurable;if(typeof r<"u"&&typeof r!="boolean"||typeof i<"u"&&typeof i!="boolean")throw new lk("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");xo&&(r||!ak(e,xo))&&(Gd?Gd(e,xo,{configurable:!i,enumerable:!1,value:t,writable:!1}):e[xo]=t)},xg={exports:{}},ck=lt,Vd=Hf,uk=Ga(),Wd=gi,jd=j,hk=ck("%Math.floor%"),dk=function(e,t){if(typeof e!="function")throw new jd("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||hk(t)!==t)throw new jd("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&Wd){var o=Wd(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!r)&&(uk?Vd(e,"length",t,!0,!0):Vd(e,"length",t)),e},pk=Ks,fk=Eu,gk=Qf,mk=function(){return gk(pk,fk,arguments)};(function(n){var e=dk,t=Xs,r=Va,i=mk;n.exports=function(o){var a=r(arguments),l=1+o.length-(arguments.length-1);return e(a,l>0?l:0,!0)},t?t(n.exports,"apply",{value:i}):n.exports.apply=i})(xg);var Nu=xg.exports,vk=function(e,t){for(var r=0;r<e.length;r+=1)if(!t(e[r],r,e))return!1;return!0},yk=Object,bk=function(e){return e&&typeof e=="object"&&(typeof e["[[ResourceValue]]"]>"u"||yk(e["[[ResourceValue]]"])===e["[[ResourceValue]]"])&&(e["[[Hint]]"]==="SYNC-DISPOSE"||e["[[Hint]]"]==="ASYNC-DISPOSE")&&(typeof e["[[DisposeMethod]]"]=="function"||typeof e["[[DisposeMethod]]"]>"u")},wk=tn,Sk=xu(),_k=vk,kk=bk,Ek=function(e){return e&&typeof e=="object"&&wk(e,"[[DisposableResourceStack]]")&&Sk(e["[[DisposableResourceStack]]"])&&(e["[[DisposableResourceStack]]"].length===0||_k(e["[[DisposableResourceStack]]"],kk))},xk=en,Ak=function(e){if(e===null)return"Null";if(typeof e>"u")return"Undefined";if(xk(e))return"Object";if(typeof e=="number")return"Number";if(typeof e=="boolean")return"Boolean";if(typeof e=="string")return"String"},$k=Ak,Uu=function(e){return typeof e=="symbol"?"Symbol":typeof e=="bigint"?"BigInt":$k(e)},Tk=j,Ck=wi,Ik=yi,Pk=function(e,t){if(!Ik(t))throw new Tk("Assertion failed: P is not a Property Key, got "+Ck(t));return e[t]},qd=j,Rk=Pk,Dk=bi,Ok=yi,Yd=wi,Lk=function(e,t){if(!Ok(t))throw new qd("Assertion failed: P is not a Property Key");var r=Rk(e,t);if(r!=null){if(!Dk(r))throw new qd(Yd(t)+" is not a function: "+Yd(r));return r}},Ec={exports:{}},zk=lt,Mk=zk,Xd=Mk("%Reflect.construct%",!0),ca=to;try{ca({},"",{"[[Get]]":function(){}})}catch{ca=null}if(ca&&Xd){var Kd={},Jd={};ca(Jd,"length",{"[[Get]]":function(){throw Kd},"[[Enumerable]]":!0}),Ec.exports=function(e){try{Xd(e,Jd)}catch(t){return t===Kd}}}else Ec.exports=function(e){return typeof e=="function"&&!!e.prototype};var Nk=Ec.exports,Fl=j,Qd=bi,Uk=Nk,Fk=function(e){if(!Uk(e))throw new Fl("C must be a constructor");var t={"[[Resolve]]":void 0,"[[Reject]]":void 0},r=new e(function(i,s){if(typeof t["[[Resolve]]"]<"u"||typeof t["[[Reject]]"]<"u")throw new Fl("executor has already been called");t["[[Resolve]]"]=i,t["[[Reject]]"]=s});if(!Qd(t["[[Resolve]]"])||!Qd(t["[[Reject]]"]))throw new Fl("executor must provide valid resolve and reject functions");return{"[[Promise]]":r,"[[Resolve]]":t["[[Resolve]]"],"[[Reject]]":t["[[Reject]]"]}},ep=Qt,Zk=j,Zl=Wa,tp=Lk,Hk=Fk,Bk=Uu,np=Cu(),rp=Iu(),Gk=function(e,t){if(Bk(e)!=="Object")throw new Zk("`V` must be an Object");if(t!=="SYNC-DISPOSE"&&t!=="ASYNC-DISPOSE")throw new ep("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(t==="ASYNC-DISPOSE"&&rp&&(r=tp(e,rp)),!r){if(!np)throw new ep("`Symbol.dispose` is not supported");if(r=tp(e,np),typeof r<"u")return function(){var i=this;if(t==="ASYNC-DISPOSE"){var s=Hk(Promise);try{Zl(r,i),Zl(s["[[Resolve]]"],void 0,[void 0])}catch(o){s["[[Reject]]"](o)}return s["[[Promise]]"]}Zl(r,i)}}return r},Vk=Qt,Hl=j,Wk=bi,jk=Uu,qk=Gk,Yk=function(e,t){if(t!=="SYNC-DISPOSE"&&t!=="ASYNC-DISPOSE")throw new Vk("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var r;if(arguments.length<3)if(e==null)e=void 0,r=void 0;else{if(typeof e<"u"&&jk(e)!=="Object")throw new Hl("`V` must be an Object, or `null` or `undefined`");if(r=qk(e,t),typeof r>"u")throw new Hl("dispose method must not be `undefined` on `V` when an object `V` is provided")}else if(r=arguments[2],!Wk(r))throw new Hl("`method`, when provided, must be a function");return{"[[ResourceValue]]":e,"[[Hint]]":t,"[[DisposeMethod]]":r}},Xk=Qt,Ao=j,Kk=Ek,ip=Yk,Jk=_n(),Qk=Jk("Array.prototype.push"),Ag=function(e,t,r){if(!Kk(e))throw new Ao("Assertion failed: `disposeCapability` must be a DisposeCapability Record");if(r!=="SYNC-DISPOSE"&&r!=="ASYNC-DISPOSE")throw new Xk("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");var i=arguments.length>3?arguments[3]:void 0;if(arguments.length>3&&typeof i!="function")throw new Ao("Assertion failed: `method`, when present, must be a function");if(!e["[[DisposableResourceStack]]"])throw new Ao("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");var s;if(arguments.length<4){if(t==null&&r==="SYNC_DISPOSE")return"UNUSED";s=ip(t,r)}else{if(typeof t<"u")throw new Ao("Assertion failed: `V` must be undefined when `method` is present");s=ip(void 0,r,i)}return Qk(e["[[DisposableResourceStack]]"],s),"UNUSED"},Bl,sp;function Fu(){if(sp)return Bl;sp=1;var n=lt,e=Nu,t=Qt,r=n("%Promise.resolve%",!0),i=r&&e(r);return Bl=function(o,a){if(!i)throw new t("This environment does not support Promises.");return i(o,a)},Bl}var Gl,op;function eE(){if(op)return Gl;op=1;var n=lt,e=Qt,t=n("%Promise%",!0),r=Wa,i=Fu(),s=Uu;return Gl=function(a,l,u){if(typeof a<"u"&&s(a)!=="Object")throw new e("Assertion failed: `V` must be `undefined` or an Object");if(l!=="SYNC-DISPOSE"&&l!=="ASYNC-DISPOSE")throw new e("Assertion failed: `hint` must be `~SYNC-DISPOSE~` or `~ASYNC-DISPOSE~`");if(typeof u<"u"&&typeof u!="function")throw new e("Assertion failed: `method` must be `undefined` or a function");var h=typeof u>"u"?u:r(u,a);if(l==="ASYNC-DISPOSE")return i(t,h)},Gl}var Vl,ap;function tE(){if(ap)return Vl;ap=1;var n=zu;return Vl=function(t){return new n("throw",t)},Vl}var nE=lt,Wl=Qt,lp=j,rE=nE("%Promise%",!0),iE=_n(),cp=iE("Promise.prototype.then",!0),sE=zu,up=eE(),oE=Mu,aE=Fu(),hp=tE(),lE=fg(),$g=function(e,t){if(!(t instanceof sE))throw new lp("`completion` must be a Completion Record");var r=e["[[DisposableResourceStack]]"];if(!r)throw new lp("Assertion failed: `disposeCapability.[[DisposableResourceStack]]` must not be ~EMPTY~");for(var i,s=r.length-1;s>=0;s-=1)if(!i)i=r[s]["[[Hint]]"];else if(i!==r[s]["[[Hint]]"])throw new Wl("mixed hint stacks are not supported");for(var o=i==="ASYNC-DISPOSE"&&aE(rE,t),a=function(g){if(t.type()==="throw"){var m=t.value(),A=new lE(g,m);t=hp(A)}else t=hp(g)},l=i==="ASYNC-DISPOSE"&&function(m){return cp(o,function(){var A=up(m["[[ResourceValue]]"],m["[[Hint]]"],m["[[DisposeMethod]]"]);if(!A)throw new Wl("Assertion failed: non-`~ASYNC-DISPOSE~` resource returned a promise from Dispose");return cp(A,oE)},a)},u=r.length-1;u>=0;u-=1)if(i==="ASYNC-DISPOSE")o=l(r[u]);else{var h=r[u];try{var p=up(h["[[ResourceValue]]"],h["[[Hint]]"],h["[[DisposeMethod]]"]);if(p)throw new Wl("Assertion failed: `~SYNC-DISPOSE~` resource returned something from Dispose")}catch(g){a(g)}}return e["[[DisposableResourceStack]]"]=null,i==="ASYNC-DISPOSE"?o:t},Tg=function(){var e=[];return{"[[DisposableResourceStack]]":e}},Ya=wu,Zu=j,cE=Wa,Si=$u,uE=to,Cg=bi,hE=Mu,We=Lu,dE=Eg,Ig=vr.supportsDescriptors,pE=Nu,Hu=Ag,fE=$g,Pg=Tg,dp=Cu(),st=function n(){if(!(this instanceof n)||We.has(this,"[[DisposableState]]")||We.has(this,"[[DisposeCapability]]"))throw new Zu("can only be used with new");We.set(this,"[[DisposableState]]","PENDING"),We.set(this,"[[DisposeCapability]]",Pg())},Rg=function(){var e=this;return We.assert(e,"[[DisposableState]]"),We.get(e,"[[DisposableState]]")==="DISPOSED"},io=pE(Rg);Ig?uE(st.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Rg}):st.prototype.disposed=!1;var Dg=function(e){We.set(e,"[[DisposableState]]","DISPOSED"),Ig||(e.disposed=!0)};Si(st.prototype,"dispose",function(){var e=this;if(!io(e))return Dg(e),fE(We.get(e,"[[DisposeCapability]]"),hE())["?"]()});Si(st.prototype,"use",function(e){var t=this;if(io(t))throw new Ya("a disposed stack can not use anything new");return Hu(We.get(t,"[[DisposeCapability]]"),e,"SYNC-DISPOSE"),e});Si(st.prototype,"adopt",function(e,t){var r=this;if(io(r))throw new Ya("a disposed stack can not use anything new");if(!Cg(t))throw new Zu("`onDispose` must be a function");var i=function(){return cE(t,void 0,[e])};return Hu(We.get(r,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",i),e});Si(st.prototype,"defer",function(e){var t=this;if(io(t))throw new Ya("a disposed stack can not defer anything new");if(!Cg(e))throw new Zu("`onDispose` must be a function");Hu(We.get(t,"[[DisposeCapability]]"),void 0,"SYNC-DISPOSE",e)});Si(st.prototype,"move",function(){var e=this;if(io(e))throw new Ya("a disposed stack can not use anything new");var t=new st;return We.set(t,"[[DisposeCapability]]",We.get(e,"[[DisposeCapability]]")),We.set(e,"[[DisposeCapability]]",Pg()),Dg(e),t});dp&&Si(st.prototype,dp,st.prototype.dispose);dE(st.prototype,"DisposableStack");var gE=st,mE=gE,vE=function(){return typeof DisposableStack=="function"?DisposableStack:mE},yE=vr,bE=yu(),wE=vE,SE=function(){var e=wE();return yE(bE,{DisposableStack:e},{DisposableStack:!0}),e},_E=lt,Xa=wu,Bu=j,pp=_E("%Promise%",!0),Gu=Ag,kE=Wa,_i=$u,EE=to,xE=$g,Og=bi,Lg=Tg,AE=Mu,fp=Fu(),je=Lu,$E=Eg,zg=vr.supportsDescriptors,TE=Nu,CE=_n(),IE=CE("Promise.prototype.then",!0),gp=Iu(),ot=function n(){if(!(this instanceof n)||je.has(this,"[[AsyncDisposableState]]")||je.has(this,"[[DisposeCapability]]"))throw new Bu("can only be used with new");je.set(this,"[[AsyncDisposableState]]","pending"),je.set(this,"[[DisposeCapability]]",Lg())},Mg=function(){var e=this;return je.assert(e,"[[AsyncDisposableState]]"),je.get(e,"[[AsyncDisposableState]]")==="disposed"},so=TE(Mg);zg?EE(ot.prototype,"disposed",{"[[Configurable]]":!0,"[[Enumerable]]":!1,"[[Get]]":Mg}):ot.prototype.disposed=!1;var Ng=function(e){je.set(e,"[[AsyncDisposableState]]","disposed"),zg||(e.disposed=!0)};_i(ot.prototype,"disposeAsync",function(){var e=this;return so(e)?fp(pp):(Ng(e),IE(fp(pp,xE(je.get(e,"[[DisposeCapability]]"),AE())),function(t){return t["?"]()}))});_i(ot.prototype,"use",function(e){var t=this;if(so(t))throw new Xa("a disposed stack can not use anything new");return Gu(je.get(t,"[[DisposeCapability]]"),e,"ASYNC-DISPOSE"),e});_i(ot.prototype,"adopt",function(e,t){var r=this;if(so(r))throw new Xa("a disposed stack can not use anything new");if(!Og(t))throw new Bu("`onDisposeAsync` must be a function");var i=function(){return kE(t,void 0,[e])};return i.value=e,Gu(je.get(r,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",i),e});_i(ot.prototype,"defer",function(e){var t=this;if(so(t))throw new Xa("a disposed stack can not defer anything new");if(!Og(e))throw new Bu("`onDispose` must be a function");Gu(je.get(t,"[[DisposeCapability]]"),void 0,"ASYNC-DISPOSE",e)});_i(ot.prototype,"move",function(){var e=this;if(so(e))throw new Xa("a disposed stack can not use anything new");var t=new ot;return je.set(t,"[[DisposeCapability]]",je.get(e,"[[DisposeCapability]]")),je.set(e,"[[DisposeCapability]]",Lg()),Ng(e),t});gp&&_i(ot.prototype,gp,ot.prototype.disposeAsync);$E(ot.prototype,"AsyncDisposableStack");var PE=ot,RE=PE,DE=function(){return typeof AsyncDisposableStack=="function"?AsyncDisposableStack:RE},OE=vr,LE=yu(),zE=DE,ME=function(){var e=zE();return OE(LE,{AsyncDisposableStack:e},{AsyncDisposableStack:!0}),e},NE=OS,UE=HS,FE=SE,ZE=ME,HE=function(){NE(),UE(),FE(),ZE()};HE();const mp=new WeakMap;function BE(n){return(typeof n=="object"||typeof n=="function")&&n!==null&&"then"in n&&typeof n.then=="function"}function Ir(n){return typeof n=="string"?n:typeof n=="symbol"?n.description??n.toString():n.name||"(anonymous class)"}function vp(){return new Error("register(Key, factory) requires a factory function. Wrap existing instances as () => instance.")}function GE(){return new Error("register(Key, factory) does not accept async factories. Await setup before registering.")}class VE{constructor(){b(this,"entries",new Map);b(this,"constructionStack",[])}register(e,t){if(t===void 0){if(typeof e!="function")throw vp();this.validateClassRegistration(e),this.storeFactory(e,()=>this.instantiateClass(e));return}if(typeof t!="function")throw vp();if(t.constructor.name==="AsyncFunction")throw GE();this.storeFactory(e,t)}has(e){var t;return((t=this.entries.get(e))==null?void 0:t.factory)!==void 0}resolve(e){return this.resolveAny(e)}storeFactory(e,t){const r=this.getOrCreateEntry(e);r.factory=t,r.instance=void 0,r.error=void 0}validateClassRegistration(e){const t=mp.get(e);if(t){if(e.length!==t.length)throw new Error(`${Ir(e)} cannot be registered with register(Class). @injectable(...) declared ${t.length} dependencies but constructor arity is ${e.length}. Use register(Key, () => value) instead.`);return}if(e.length!==0)throw new Error(`${Ir(e)} cannot be registered with register(Class). Undecorated classes must have zero required constructor parameters. Use register(Key, () => value) instead.`)}instantiateClass(e){const t=mp.get(e);if(!t)return new e;const r=t.map(i=>this.resolveAny(i));return new e(...r)}resolveAny(e){return this.getOrCreateEntry(e).proxy}getOrCreateEntry(e){let t=this.entries.get(e);return t||(t={key:e},t.proxy=this.createProxy(t),this.entries.set(e,t),t)}createProxy(e){return new Proxy({},{get:(t,r)=>{if(r==="then")return;const i=this.getInstance(e),s=Reflect.get(i,r,i);return typeof s=="function"?s.bind(i):s},set:(t,r,i)=>{const s=this.getInstance(e);return Reflect.set(s,r,i,s)},has:(t,r)=>{const i=this.getInstance(e);return r in i}})}getInstance(e){if(e.instance)return e.instance;if(e.error)throw e.error;if(!e.factory)throw new Error(`${Ir(e.key)} was resolved but never registered`);const t=this.constructionStack.indexOf(e.key);if(t!==-1){const r=[...this.constructionStack.slice(t),e.key].map(i=>Ir(i)).join(" -> ");throw new Error(`Circular dependency detected: ${r}`)}this.constructionStack.push(e.key);try{const r=e.factory();if(BE(r))throw new Error(`Factory for ${Ir(e.key)} returned a Promise. Await setup before registering.`);if(typeof r!="object"||r===null)throw new Error(`Factory for ${Ir(e.key)} returned a non-object value. Wrap primitives in an object.`);return e.instance=r,r}catch(r){throw e.error=r,r}finally{this.constructionStack.pop()}}}const qe=new VE,WE=new Set(["target","currentTarget","eventPhase","defaultPrevented","isTrusted","timeStamp","srcElement","returnValue","cancelBubble","NONE","CAPTURING_PHASE","AT_TARGET","BUBBLING_PHASE","composedPath","stopPropagation","stopImmediatePropagation","preventDefault","initEvent"]);function jE(n){for(const e of Object.keys(n))if(WE.has(e))throw new Error(`Event payload key "${e}" is reserved; choose a different property name`)}function qE(n,e){jE(e);for(const t of Object.keys(e))Object.defineProperty(n,t,{value:e[t],writable:!0,enumerable:!0,configurable:!0})}function yt(){class n extends Event{constructor(t,r){const{type:i,bubbles:s,cancelable:o,composed:a,...l}=r??{};if(i!==void 0)throw new Error('Do not pass "type" in init; use the constructor argument instead');super(t,{bubbles:s,cancelable:o,composed:a}),qE(this,l)}}return n}class bt extends globalThis.EventTarget{}function YE(n,e,t){const r=n.dispose.bind(n);n.dispose=()=>{if(!e())return t(),r()}}function ki(n){var t;class e extends n{constructor(...s){super(...s);w(this,t,!1);YE(this,()=>c(this,t),()=>{E(this,t,!0)})}[Symbol.dispose](){this.dispose()}get disposed(){return c(this,t)}}return t=new WeakMap,e}const XE=yt(),KE=yt(),qo=yt(),Ug="0123456789ABCDEFGHJKMNPQRSTVWXYZ",ua=32,JE=16,Fg=10,yp=0xffffffffffff;var Un;(function(n){n.Base32IncorrectEncoding="B32_ENC_INVALID",n.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",n.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",n.EncodeTimeNegative="ENC_TIME_NEG",n.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",n.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",n.PRNGDetectFailure="PRNG_DETECT",n.ULIDInvalid="ULID_INVALID",n.Unexpected="UNEXPECTED",n.UUIDInvalid="UUID_INVALID"})(Un||(Un={}));class Bi extends Error{constructor(e,t){super(`${t} (${e})`),this.name="ULIDError",this.code=e}}function QE(n){const e=Math.floor(n()*ua)%ua;return Ug.charAt(e)}function ex(n){const e=tx(),t=e&&(e.crypto||e.msCrypto)||null;if(typeof(t==null?void 0:t.getRandomValues)=="function")return()=>{const r=new Uint8Array(1);return t.getRandomValues(r),r[0]/256};if(typeof(t==null?void 0:t.randomBytes)=="function")return()=>t.randomBytes(1).readUInt8()/256;throw new Bi(Un.PRNGDetectFailure,"Failed to find a reliable PRNG")}function tx(){return ix()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function nx(n,e){let t="";for(;n>0;n--)t=QE(e)+t;return t}function rx(n,e=Fg){if(isNaN(n))throw new Bi(Un.EncodeTimeValueMalformed,`Time must be a number: ${n}`);if(n>yp)throw new Bi(Un.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${yp}: ${n}`);if(n<0)throw new Bi(Un.EncodeTimeNegative,`Time must be positive: ${n}`);if(Number.isInteger(n)===!1)throw new Bi(Un.EncodeTimeValueMalformed,`Time must be an integer: ${n}`);let t,r="";for(let i=e;i>0;i--)t=n%ua,r=Ug.charAt(t)+r,n=(n-t)/ua;return r}function ix(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function Vu(n,e){const t=ex(),r=Date.now();return rx(r,Fg)+nx(JE,t)}const Ot=4,et=6,Zg=2,xc=2,sx=Ot,ox=et,Wu="auto",mn="auto",Ln=120,bp=50,he=16,hr=Ln*Ot+he*(Ot-1),ha=Ln*et+he*(et-1),ax=hr+he*2,lx=200,cx=4,$o=150,ux=10,wp=2,Sp=8,hx=300,dx=4;function Hg(n){return Vg(n)}function Bg(n,e){return Vg(n.flatMap(t=>jg(t,e)))}function Gg(n){const e=[],t=new Set;for(const r of n){if(r.type==="row"){e.push(`Top-level rows are invalid: ${r.id}`);continue}qg(r,"strip",e,t)}return{valid:e.length===0,errors:e}}function Fr(n){const e=Hg(n),t=Gg(e);if(!t.valid)throw new Error(`Invalid layout: ${t.errors.join("; ")}`);return{totalNodes:e.length,nodes:e.filter(r=>r.type!=="row").map(mx)}}function Vg(n){const e=[];for(const t of n){const r=Wg(t);for(const i of r){if(i.type==="row"){e.push(...i.children.map(Kt));continue}e.push(i)}}return e}function Wg(n){switch(n.type){case"card":return[Kt(n)];case"row":{const e=n.children.map(Kt);return e.length===0?[]:e.length===1?[e[0]]:[{...n,children:e}]}case"stack":{const e=[];for(const t of n.children){const r=Wg(t);for(const i of r){if(i.type==="stack"){e.push(...i.children.map(Ac));continue}if(i.type==="row"){e.push({...i,children:i.children.map(Kt)});continue}e.push(Kt(i))}}return e.length===0?[]:e.length===1?[Ac(e[0])]:[{...n,children:e}]}}}function jg(n,e){switch(n.type){case"card":return n.artifactID===e?[]:[Kt(n)];case"row":{const t=n.children.filter(r=>r.artifactID!==e).map(Kt);return t.length===0?[]:t.length===1?[t[0]]:[{...n,children:t}]}case"stack":{const t=n.children.flatMap(r=>jg(r,e).filter(s=>s.type!=="stack"));return t.length===0?[]:t.length===1?[Ac(t[0])]:[{...n,children:t}]}}}function qg(n,e,t,r){switch(n.type){case"card":Yg(n,e,t,r);return;case"row":px(n,e,t,r);return;case"stack":fx(n,e,t,r);return}}function Yg(n,e,t,r){ju(n.id,t),typeof n.artifactID!="string"||n.artifactID.length===0?t.push(`Card ${n.id} is missing artifactID`):r.has(n.artifactID)?t.push(`Duplicate artifactID in layout: ${n.artifactID}`):r.add(n.artifactID),gx(n.width)||t.push(`Card ${n.id} width must be an integer in the range 2-4`),Xg(n.height)||t.push(`Card ${n.id} height must be an integer in the range 2-6 or "auto"`);const i=zn(n.width);e==="row"&&i<Zg&&t.push(`Row child ${n.id} must be at least 2 columns wide`)}function px(n,e,t,r){if(ju(n.id,t),e!=="stack"&&t.push(`Row ${n.id} may only appear inside a stack`),Xg(n.height,dx)||t.push(`Row ${n.id} height must be an integer in the range 2-4 or "auto"`),!Array.isArray(n.children)||n.children.length===0){t.push(`Row ${n.id} must contain card nodes`);return}let i=0;for(const s of n.children){if(s.type!=="card"){t.push(`Row ${n.id} must contain only card nodes`);continue}Yg(s,"row",t,r),i+=zn(s.width)}i!==Ot&&t.push(`Row ${n.id} children must sum to 4 columns`)}function fx(n,e,t,r){if(ju(n.id,t),e!=="strip"&&t.push(`Invalid nested stack at ${n.id}; stack children cannot contain another nested stack`),!Array.isArray(n.children)||n.children.length===0){t.push(`Stack ${n.id} must contain at least one child`);return}let i=0,s=0;for(const a of n.children){if(a.type==="stack"){t.push(`Stack ${n.id} cannot contain another nested stack`);continue}if(qg(a,"stack",t,r),a.height===mn){s+=1;continue}i+=a.height}if(i>et&&t.push(`Stack ${n.id} exceeds the 6-row budget`),s===0)return;const o=et-i;if(o<s*xc||o%s!==0){t.push(`Stack ${n.id} has auto-height children that cannot resolve to whole height >= 2`);return}o/s<xc&&t.push(`Stack ${n.id} has auto-height children below the minimum row size`)}function ju(n,e){(typeof n!="string"||n.length===0)&&e.push(`Node id must be a non-empty string: ${String(n)}`)}function gx(n){return n===Wu||Number.isInteger(n)&&n>=Zg&&n<=sx}function Xg(n,e=ox){return n===mn||Number.isInteger(n)&&n>=xc&&n<=e}function zn(n){return n===Wu?Ot:n}function mx(n){if(n.type==="card")return{id:n.id,type:"card",width:zn(n.width),cards:[{id:n.id,artifactID:n.artifactID,col:1,row:1,width:zn(n.width),height:Kg(n.height,et)}]};const e=vx(n.children),t=[];let r=1;for(let i=0;i<n.children.length;i+=1){const s=n.children[i],o=e[i];if(s.type==="card")t.push({id:s.id,artifactID:s.artifactID,col:1,row:r,width:zn(s.width),height:o});else{let a=1;for(const l of s.children)t.push({id:l.id,artifactID:l.artifactID,col:a,row:r,width:zn(l.width),height:o}),a+=zn(l.width)}r+=o}return{id:n.id,type:"stack",width:t.reduce((i,s)=>Math.max(i,s.col+s.width-1),1),cards:t}}function vx(n){let e=0,t=0;for(const i of n)i.height===mn?t+=1:e+=i.height;const r=t>0?(et-e)/t:0;return n.map(i=>Kg(i.height,r))}function Kg(n,e){return n===mn?e:n}function Kt(n){return{...n}}function Ac(n){return n.type==="card"?Kt(n):{...n,children:n.children.map(Kt)}}function Jg(n,e={}){return{id:e.id??Vu(),type:"card",artifactID:n,width:e.width??Wu,height:e.height??mn}}function Qg(n,e){return n.some(t=>em(t,e))}function em(n,e){switch(n.type){case"card":return n.artifactID===e;case"row":return n.children.some(t=>t.artifactID===e);case"stack":return n.children.some(t=>em(t,e))}}function _p(n){return n.layout.flatMap(tm)}function tm(n){switch(n.type){case"card":return[n.artifactID];case"row":return n.children.map(e=>e.artifactID);case"stack":return n.children.flatMap(tm)}}const K=yt(),nm=yt(),Pr=yt(),yx=yt();function bx(n){class e extends Error{constructor(r,i){super(r),this.name=n,i&&Object.assign(this,i)}}return e}const wx=bx("RequestError"),Sx=200,_x=300;class kx{constructor(e,t){b(this,"serverURL");b(this,"token");this.serverURL=e.replace(/\/$/,""),this.token=t.token}async requestJSON(e,t,r){const i=await this.request(e,t,r!==void 0?JSON.stringify(r):void 0,r!==void 0?{"content-type":"application/json"}:void 0),s=await Ex(i);if(!i.ok||i.status<Sx||i.status>=_x)throw this.createError(typeof s.error=="string"?s.error:i.statusText,i.status);return s}async requestVoid(e,t){const r=await this.request(e,t);if(!r.ok)throw this.createError(await jl(r,r.statusText),r.status)}async requestText(e,t){const r=await this.request(e,t);if(!r.ok)throw this.createError(await jl(r,r.statusText),r.status);return r.text()}async requestRawVoid(e,t,r){const i=await this.request(e,t,r,{"content-type":"text/plain"});if(!i.ok)throw this.createError(await jl(i,i.statusText),i.status)}createError(e,t){const r={serverURL:this.serverURL};return t!==void 0&&(r.status=t),new wx(e,r)}async request(e,t,r,i){const s=`${this.serverURL}${t}`;try{return await fetch(s,{method:e,headers:this.buildHeaders(i),body:r})}catch(o){throw this.createError(o instanceof Error?o.message:"Failed to reach server")}}buildHeaders(e){const t={...e??{}};return this.token&&(t.Authorization=`Bearer ${this.token}`),Object.keys(t).length>0?t:void 0}}async function Ex(n){try{return await n.json()}catch{const e=await n.text().catch(()=>"");return e?{message:e}:{}}}async function jl(n,e){try{const t=await n.json();if(typeof t.error=="string")return t.error;if(typeof t.message=="string")return t.message}catch{}return e}function xx(n){return n.map(e=>`${e.name} (${e.id})`).join(", ")}var Tt,ka,rm;class Ax{constructor(e){w(this,ka);w(this,Tt);E(this,Tt,e)}list(){return c(this,Tt).requestJSON("GET","/screens")}async get(e={}){const t=await v(this,ka,rm).call(this,e.screenID);return c(this,Tt).requestJSON("GET",`/screens/${encodeURIComponent(t)}`)}create(e){const t={name:e.name};return e.id!==void 0&&(t.id=e.id),c(this,Tt).requestJSON("POST","/screens",t)}update(e){const{screenID:t,...r}=e;return c(this,Tt).requestJSON("PATCH",`/screens/${encodeURIComponent(t)}`,r)}remove(e){return c(this,Tt).requestJSON("DELETE",`/screens/${encodeURIComponent(e.screenID)}`)}}Tt=new WeakMap,ka=new WeakSet,rm=async function(e){if(e!==void 0)return e;const{screens:t}=await this.list();if(t.length===1)return t[0].id;throw c(this,Tt).createError(`screenID is required when multiple screens exist. Available screens: ${xx(t)}`)};var Oe;class $x{constructor(e){w(this,Oe);E(this,Oe,e)}create(e){const t={type:e.type,title:e.title};return e.externalFilePath!==void 0&&(t.externalFilePath=e.externalFilePath),e.screenID!==void 0&&(t.screenID=e.screenID),c(this,Oe).requestJSON("POST","/artifacts",t)}list(e={}){const t=new URLSearchParams;e.screenID!==void 0&&t.set("screenID",e.screenID),e.unplaced&&t.set("unplaced","true");const r=t.toString();return c(this,Oe).requestJSON("GET",r?`/artifacts?${r}`:"/artifacts")}get(e){return c(this,Oe).requestJSON("GET",`/artifacts/${encodeURIComponent(e.artifactID)}`)}update(e){const t={};return e.title!==void 0&&(t.title=e.title),c(this,Oe).requestJSON("PATCH",`/artifacts/${encodeURIComponent(e.artifactID)}`,t)}edit(e){return c(this,Oe).requestJSON("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/edit`)}commitPending(e){return c(this,Oe).requestJSON("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/commit`)}abandonPending(e){return c(this,Oe).requestVoid("POST",`/artifacts/${encodeURIComponent(e.artifactID)}/abandon`)}attach(e){return c(this,Oe).requestJSON("POST",`/screens/${encodeURIComponent(e.screenID)}/artifacts/${encodeURIComponent(e.artifactID)}`)}detach(e){return c(this,Oe).requestJSON("DELETE",`/screens/${encodeURIComponent(e.screenID)}/artifacts/${encodeURIComponent(e.artifactID)}`)}delete(e){return c(this,Oe).requestJSON("DELETE",`/artifacts/${encodeURIComponent(e.artifactID)}`)}getContent(e){return c(this,Oe).requestText("GET",`/artifacts/${encodeURIComponent(e.artifactID)}/content`)}putContent(e){return c(this,Oe).requestRawVoid("PUT",`/artifacts/${encodeURIComponent(e.artifactID)}/content`,e.content)}}Oe=new WeakMap;var Hn;class Tx{constructor(e){w(this,Hn);E(this,Hn,e)}state(){return c(this,Hn).requestJSON("GET","/viewer/state")}setActive(e){return c(this,Hn).requestJSON("PUT","/viewer/active-screen",{screenID:e.screenID})}focus(e){const t={artifactID:e.artifactID};return e.screenID!==void 0&&(t.screenID=e.screenID),c(this,Hn).requestJSON("POST","/viewer/focus",t)}}Hn=new WeakMap;var us;class Cx{constructor(e){w(this,us);E(this,us,e)}async list(){const{views:e}=await c(this,us).requestJSON("GET","/views");return e}}us=new WeakMap;var Bt;class Ix{constructor(e,t={}){b(this,"screens");b(this,"artifacts");b(this,"viewer");b(this,"views");w(this,Bt);E(this,Bt,new kx(e,t)),this.screens=new Ax(c(this,Bt)),this.artifacts=new $x(c(this,Bt)),this.viewer=new Tx(c(this,Bt)),this.views=new Cx(c(this,Bt))}health(){return c(this,Bt).requestJSON("GET","/health")}}Bt=new WeakMap;const Px={focusCommandInput:{label:"Focus Command Input",trigger:{key:"k",meta:!0}}},Rx=ki(bt);var Bn,Be,Gn,Me,ut,on,an,J,Pn,im,hs,sm,om,am,lm,$c,Tc,Cc,cm;class Dx extends Rx{constructor(t){var i;super();w(this,J);b(this,"id");b(this,"server");w(this,Bn);w(this,Be,new Map);w(this,Gn);w(this,Me);w(this,ut);w(this,on);w(this,an,null);w(this,hs,t=>{if(this.disposed)return;const r=t.event;switch(r.type){case"screen-updated":r.screen.id===this.id&&v(this,J,sm).call(this,r.screen);break;case"artifact-created":break;case"artifact-attached":r.screenID===this.id&&v(this,J,om).call(this,r.cardID,r.artifact);break;case"artifact-updated":v(this,J,am).call(this,r.artifact);break;case"artifact-removed":r.screenID===this.id&&v(this,J,lm).call(this,r.artifactID);break;case"artifact-content-changed":c(this,Be).has(r.artifactID)&&this.dispatchEvent(new yx("artifact-content-changed",{artifactID:r.artifactID}));break}});this.id=t.screen.id,this.server=t.server,E(this,Bn,t.localStore),E(this,Gn,t.screen.name),E(this,Me,structuredClone(t.screen.layout)),E(this,ut,t.screen.starred);const r=((i=c(this,Bn).get().screens[this.id])==null?void 0:i.scrollPosition)??0;E(this,on,Math.max(0,r)),this.server.addEventListener("server-event",c(this,hs)),v(this,J,im).call(this)}get name(){return c(this,Gn)}get layout(){return c(this,Me)}get starred(){return c(this,ut)}get scrollPosition(){return c(this,on)}get artifacts(){return c(this,Be)}setScrollPosition(t){v(this,J,Pn).call(this);const r=Math.max(0,t);r!==c(this,on)&&(E(this,on,r),v(this,J,cm).call(this),this.dispatchEvent(new K("change")))}setLayout(t){v(this,J,Pn).call(this);const r=Hg(t);if(!Gg(r).valid)return;const s=v(this,J,Tc).call(this);E(this,Me,r),E(this,an,{layout:r,snapshot:s}),this.dispatchEvent(new K("change")),this.server.client.screens.update({screenID:this.id,layout:r.map(o=>structuredClone(o))}).catch(()=>{var o;this.disposed||((o=c(this,an))==null?void 0:o.layout)===r&&(E(this,an,null),v(this,J,Cc).call(this,s),this.dispatchEvent(new K("change")))})}rename(t){v(this,J,Pn).call(this),E(this,Gn,t),this.dispatchEvent(new K("change")),this.server.client.screens.update({screenID:this.id,name:t}).catch(()=>{})}setStarred(t){if(v(this,J,Pn).call(this),c(this,ut)===t)return;const r=c(this,ut);E(this,ut,t),this.dispatchEvent(new K("change")),this.server.client.screens.update({screenID:this.id,starred:t}).catch(()=>{this.disposed||c(this,ut)===t&&(E(this,ut,r),this.dispatchEvent(new K("change")))})}async remove(){v(this,J,Pn).call(this),await this.server.client.screens.remove({screenID:this.id})}removeArtifact(t){if(v(this,J,Pn).call(this),!c(this,Be).has(t))return;const r=v(this,J,Tc).call(this);v(this,J,$c).call(this,t),this.dispatchEvent(new K("change")),this.server.client.artifacts.detach({artifactID:t,screenID:this.id}).catch(()=>{this.disposed||(v(this,J,Cc).call(this,r),this.dispatchEvent(new K("change")))})}dispose(){this.server.removeEventListener("server-event",c(this,hs))}}Bn=new WeakMap,Be=new WeakMap,Gn=new WeakMap,Me=new WeakMap,ut=new WeakMap,on=new WeakMap,an=new WeakMap,J=new WeakSet,Pn=function(){if(this.disposed)throw new Error("ScreenModel is disposed")},im=async function(){try{const t=await this.server.client.screens.get({screenID:this.id});if(this.disposed)return;for(const r of t.artifacts)c(this,Be).set(r.id,r);this.dispatchEvent(new K("change"))}catch{}},hs=new WeakMap,sm=function(t){c(this,an)&&E(this,an,null),E(this,Gn,t.name),E(this,Me,structuredClone(t.layout)),E(this,ut,t.starred),this.dispatchEvent(new K("change"))},om=function(t,r){Qg(c(this,Me),r.id)||E(this,Me,[...c(this,Me),Jg(r.id,{id:t})]),c(this,Be).set(r.id,r),this.dispatchEvent(new K("change"))},am=function(t){const r=c(this,Be).get(t.id);r&&(c(this,Be).set(t.id,{...r,...t}),this.dispatchEvent(new K("change")))},lm=function(t){v(this,J,$c).call(this,t)&&this.dispatchEvent(new K("change"))},$c=function(t){const r=c(this,Be).delete(t),i=_p({layout:c(this,Me)}).length,s=Bg(c(this,Me),t),o=_p({layout:s}).length;return E(this,Me,s),r||i!==o},Tc=function(){return{layout:structuredClone(c(this,Me)),artifacts:new Map([...c(this,Be).entries()].map(([t,r])=>[t,structuredClone(r)]))}},Cc=function(t){E(this,Me,structuredClone(t.layout)),c(this,Be).clear();for(const[r,i]of t.artifacts)c(this,Be).set(r,structuredClone(i))},cm=function(){const t=c(this,Bn).get();c(this,Bn).set({...t,screens:{...t.screens,[this.id]:{scrollPosition:c(this,on)}}})};const Ox=ki(bt);var tt,Ct,ht,ds,ps,fs,Vr,Yo;class Lx extends Ox{constructor(t){super();w(this,Vr);w(this,tt);w(this,Ct);w(this,ht,null);w(this,ds,()=>{this.disposed||v(this,Vr,Yo).call(this)});w(this,ps,()=>{this.disposed||v(this,Vr,Yo).call(this)});w(this,fs,t=>{var i;if(this.disposed)return;const r=t.event;if(r.type==="screen-removed"&&((i=c(this,ht))==null?void 0:i.id)===r.screenID&&this.clearActive(),r.type==="viewer-active-screen-changed"){const s=c(this,Ct).servers.get(t.serverURL);s&&s.screens.has(r.screenID)&&this.setActive(t.serverURL,r.screenID)}});E(this,tt,t.localStore),E(this,Ct,t.serverManager),c(this,tt).addEventListener("change",c(this,ds)),c(this,Ct).addEventListener("change",c(this,ps)),c(this,Ct).addEventListener("server-event",c(this,fs)),v(this,Vr,Yo).call(this)}get activeScreen(){return c(this,ht)}setActive(t,r){const i=c(this,tt).get();i.activeServerURL===t&&i.activeScreenID===r||c(this,tt).set({...i,activeServerURL:t,activeScreenID:r})}clearActive(){const t=c(this,tt).get();t.activeScreenID!==null&&c(this,tt).set({...t,activeScreenID:null})}dispose(){var t;c(this,tt).removeEventListener("change",c(this,ds)),c(this,Ct).removeEventListener("change",c(this,ps)),c(this,Ct).removeEventListener("server-event",c(this,fs)),(t=c(this,ht))==null||t.dispose(),E(this,ht,null)}}tt=new WeakMap,Ct=new WeakMap,ht=new WeakMap,ds=new WeakMap,ps=new WeakMap,fs=new WeakMap,Vr=new WeakSet,Yo=function(){var l,u,h;const{activeServerURL:t,activeScreenID:r}=c(this,tt).get(),i=t?c(this,Ct).servers.get(t)??null:null,s=i&&r?i.screens.get(r)??null:null,o=((l=c(this,ht))==null?void 0:l.id)??null,a=(s==null?void 0:s.id)??null;o===a&&((u=c(this,ht))==null?void 0:u.server)===i||((h=c(this,ht))==null||h.dispose(),E(this,ht,i&&s?new Dx({screen:s,server:i,localStore:c(this,tt)}):null),this.dispatchEvent(new XE("active-screen-changed")))};const zx="Local",Mx="store-";function $t(n){return new URL(n).origin}function Nx(n){return{servers:[{url:$t(n),name:zx}],activeServerURL:null,activeScreenID:null,screens:{}}}var Vn,Wn,jn;class Ux extends bt{constructor(t,r,i={}){super();w(this,Vn);w(this,Wn);w(this,jn);E(this,Vn,`${Mx}${t}`),E(this,Wn,i.storage??Fx());const s=c(this,Wn).getItem(c(this,Vn));s===null?(E(this,jn,r),c(this,Wn).setItem(c(this,Vn),JSON.stringify(r))):E(this,jn,JSON.parse(s))}get(){return c(this,jn)}set(t){E(this,jn,t),c(this,Wn).setItem(c(this,Vn),JSON.stringify(t)),this.dispatchEvent(new K("change"))}}Vn=new WeakMap,Wn=new WeakMap,jn=new WeakMap;function Fx(){const n=globalThis.localStorage;if(!n)throw new Error("LocalStore: no storage adapter supplied and window.localStorage is unavailable");return n}function x(n,e,t){function r(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:o,traits:new Set},enumerable:!1}),a._zod.traits.has(n))return;a._zod.traits.add(n),e(a,l);const u=o.prototype,h=Object.keys(u);for(let p=0;p<h.length;p++){const g=h[p];g in a||(a[g]=u[g].bind(a))}}const i=(t==null?void 0:t.Parent)??Object;class s extends i{}Object.defineProperty(s,"name",{value:n});function o(a){var l;const u=t!=null&&t.Parent?new s:this;r(u,a),(l=u._zod).deferred??(l.deferred=[]);for(const h of u._zod.deferred)h();return u}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>{var l,u;return t!=null&&t.Parent&&a instanceof t.Parent?!0:(u=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:u.has(n)}}),Object.defineProperty(o,"name",{value:n}),o}class Gr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class um extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const hm={};function vn(n){return hm}function dm(n){const e=Object.values(n).filter(r=>typeof r=="number");return Object.entries(n).filter(([r,i])=>e.indexOf(+r)===-1).map(([r,i])=>i)}function Ic(n,e){return typeof e=="bigint"?e.toString():e}function qu(n){return{get value(){{const e=n();return Object.defineProperty(this,"value",{value:e}),e}}}}function Yu(n){return n==null}function Xu(n){const e=n.startsWith("^")?1:0,t=n.endsWith("$")?n.length-1:n.length;return n.slice(e,t)}function Zx(n,e){const t=(n.toString().split(".")[1]||"").length,r=e.toString();let i=(r.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(r)){const l=r.match(/\d?e-(\d?)/);l!=null&&l[1]&&(i=Number.parseInt(l[1]))}const s=t>i?t:i,o=Number.parseInt(n.toFixed(s).replace(".","")),a=Number.parseInt(e.toFixed(s).replace(".",""));return o%a/10**s}const kp=Symbol("evaluating");function ee(n,e,t){let r;Object.defineProperty(n,e,{get(){if(r!==kp)return r===void 0&&(r=kp,r=t()),r},set(i){Object.defineProperty(n,e,{value:i})},configurable:!0})}function br(n,e,t){Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}function En(...n){const e={};for(const t of n){const r=Object.getOwnPropertyDescriptors(t);Object.assign(e,r)}return Object.defineProperties({},e)}function Ep(n){return JSON.stringify(n)}function Hx(n){return n.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const pm="captureStackTrace"in Error?Error.captureStackTrace:(...n)=>{};function da(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}const Bx=qu(()=>{var n;if(typeof navigator<"u"&&((n=navigator==null?void 0:navigator.userAgent)!=null&&n.includes("Cloudflare")))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function hi(n){if(da(n)===!1)return!1;const e=n.constructor;if(e===void 0||typeof e!="function")return!0;const t=e.prototype;return!(da(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}function fm(n){return hi(n)?{...n}:Array.isArray(n)?[...n]:n}const Gx=new Set(["string","number","symbol"]);function di(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xn(n,e,t){const r=new n._zod.constr(e??n._zod.def);return(!e||t!=null&&t.parent)&&(r._zod.parent=n),r}function L(n){const e=n;if(!e)return{};if(typeof e=="string")return{error:()=>e};if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Vx(n){return Object.keys(n).filter(e=>n[e]._zod.optin==="optional"&&n[e]._zod.optout==="optional")}const Wx={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function jx(n,e){const t=n._zod.def,r=t.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=En(n._zod.def,{get shape(){const o={};for(const a in e){if(!(a in t.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(o[a]=t.shape[a])}return br(this,"shape",o),o},checks:[]});return xn(n,s)}function qx(n,e){const t=n._zod.def,r=t.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=En(n._zod.def,{get shape(){const o={...n._zod.def.shape};for(const a in e){if(!(a in t.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete o[a]}return br(this,"shape",o),o},checks:[]});return xn(n,s)}function Yx(n,e){if(!hi(e))throw new Error("Invalid input to extend: expected a plain object");const t=n._zod.def.checks;if(t&&t.length>0){const s=n._zod.def.shape;for(const o in e)if(Object.getOwnPropertyDescriptor(s,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=En(n._zod.def,{get shape(){const s={...n._zod.def.shape,...e};return br(this,"shape",s),s}});return xn(n,i)}function Xx(n,e){if(!hi(e))throw new Error("Invalid input to safeExtend: expected a plain object");const t=En(n._zod.def,{get shape(){const r={...n._zod.def.shape,...e};return br(this,"shape",r),r}});return xn(n,t)}function Kx(n,e){const t=En(n._zod.def,{get shape(){const r={...n._zod.def.shape,...e._zod.def.shape};return br(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:[]});return xn(n,t)}function Jx(n,e,t){const i=e._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const o=En(e._zod.def,{get shape(){const a=e._zod.def.shape,l={...a};if(t)for(const u in t){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(l[u]=n?new n({type:"optional",innerType:a[u]}):a[u])}else for(const u in a)l[u]=n?new n({type:"optional",innerType:a[u]}):a[u];return br(this,"shape",l),l},checks:[]});return xn(e,o)}function Qx(n,e,t){const r=En(e._zod.def,{get shape(){const i=e._zod.def.shape,s={...i};if(t)for(const o in t){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(s[o]=new n({type:"nonoptional",innerType:i[o]}))}else for(const o in i)s[o]=new n({type:"nonoptional",innerType:i[o]});return br(this,"shape",s),s}});return xn(e,r)}function Zr(n,e=0){var t;if(n.aborted===!0)return!0;for(let r=e;r<n.issues.length;r++)if(((t=n.issues[r])==null?void 0:t.continue)!==!0)return!0;return!1}function Hr(n,e){return e.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(n),t})}function To(n){return typeof n=="string"?n:n==null?void 0:n.message}function yn(n,e,t){var i,s,o,a,l,u;const r={...n,path:n.path??[]};if(!n.message){const h=To((o=(s=(i=n.inst)==null?void 0:i._zod.def)==null?void 0:s.error)==null?void 0:o.call(s,n))??To((a=e==null?void 0:e.error)==null?void 0:a.call(e,n))??To((l=t.customError)==null?void 0:l.call(t,n))??To((u=t.localeError)==null?void 0:u.call(t,n))??"Invalid input";r.message=h}return delete r.inst,delete r.continue,e!=null&&e.reportInput||delete r.input,r}function Ku(n){return Array.isArray(n)?"array":typeof n=="string"?"string":"unknown"}function ss(...n){const[e,t,r]=n;return typeof e=="string"?{message:e,code:"custom",input:t,inst:r}:{...e}}const gm=(n,e)=>{n.name="$ZodError",Object.defineProperty(n,"_zod",{value:n._zod,enumerable:!1}),Object.defineProperty(n,"issues",{value:e,enumerable:!1}),n.message=JSON.stringify(e,Ic,2),Object.defineProperty(n,"toString",{value:()=>n.message,enumerable:!1})},mm=x("$ZodError",gm),vm=x("$ZodError",gm,{Parent:Error});function e1(n,e=t=>t.message){const t={},r=[];for(const i of n.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:t}}function t1(n,e=t=>t.message){const t={_errors:[]},r=i=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(o=>r({issues:o}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)t._errors.push(e(s));else{let o=t,a=0;for(;a<s.path.length;){const l=s.path[a];a===s.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(e(s))):o[l]=o[l]||{_errors:[]},o=o[l],a++}}};return r(n),t}const Ju=n=>(e,t,r,i)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},o=e._zod.run({value:t,issues:[]},s);if(o instanceof Promise)throw new Gr;if(o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(l=>yn(l,s,vn())));throw pm(a,i==null?void 0:i.callee),a}return o.value},Qu=n=>async(e,t,r,i)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let o=e._zod.run({value:t,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){const a=new((i==null?void 0:i.Err)??n)(o.issues.map(l=>yn(l,s,vn())));throw pm(a,i==null?void 0:i.callee),a}return o.value},Ka=n=>(e,t,r)=>{const i=r?{...r,async:!1}:{async:!1},s=e._zod.run({value:t,issues:[]},i);if(s instanceof Promise)throw new Gr;return s.issues.length?{success:!1,error:new(n??mm)(s.issues.map(o=>yn(o,i,vn())))}:{success:!0,data:s.value}},n1=Ka(vm),Ja=n=>async(e,t,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=e._zod.run({value:t,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new n(s.issues.map(o=>yn(o,i,vn())))}:{success:!0,data:s.value}},r1=Ja(vm),i1=n=>(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ju(n)(e,t,i)},s1=n=>(e,t,r)=>Ju(n)(e,t,r),o1=n=>async(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Qu(n)(e,t,i)},a1=n=>async(e,t,r)=>Qu(n)(e,t,r),l1=n=>(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ka(n)(e,t,i)},c1=n=>(e,t,r)=>Ka(n)(e,t,r),u1=n=>async(e,t,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ja(n)(e,t,i)},h1=n=>async(e,t,r)=>Ja(n)(e,t,r),d1=/^[cC][^\s-]{8,}$/,p1=/^[0-9a-z]+$/,f1=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,g1=/^[0-9a-vA-V]{20}$/,m1=/^[A-Za-z0-9]{27}$/,v1=/^[a-zA-Z0-9_-]{21}$/,y1=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,b1=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,xp=n=>n?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${n}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,w1=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,S1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function _1(){return new RegExp(S1,"u")}const k1=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,E1=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,x1=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,A1=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$1=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ym=/^[A-Za-z0-9_-]*$/,T1=/^\+[1-9]\d{6,14}$/,bm="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",C1=new RegExp(`^${bm}$`);function wm(n){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof n.precision=="number"?n.precision===-1?`${e}`:n.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${n.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function I1(n){return new RegExp(`^${wm(n)}$`)}function P1(n){const e=wm({precision:n.precision}),t=["Z"];n.local&&t.push(""),n.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${e}(?:${t.join("|")})`;return new RegExp(`^${bm}T(?:${r})$`)}const R1=n=>{const e=n?`[\\s\\S]{${(n==null?void 0:n.minimum)??0},${(n==null?void 0:n.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},D1=/^-?\d+$/,Sm=/^-?\d+(?:\.\d+)?$/,O1=/^(?:true|false)$/i,L1=/^[^A-Z]*$/,z1=/^[^a-z]*$/,Ye=x("$ZodCheck",(n,e)=>{var t;n._zod??(n._zod={}),n._zod.def=e,(t=n._zod).onattach??(t.onattach=[])}),_m={number:"number",bigint:"bigint",object:"date"},km=x("$ZodCheckLessThan",(n,e)=>{Ye.init(n,e);const t=_m[typeof e.value];n._zod.onattach.push(r=>{const i=r._zod.bag,s=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),n._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:t,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:n,continue:!e.abort})}}),Em=x("$ZodCheckGreaterThan",(n,e)=>{Ye.init(n,e);const t=_m[typeof e.value];n._zod.onattach.push(r=>{const i=r._zod.bag,s=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),n._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:t,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:n,continue:!e.abort})}}),M1=x("$ZodCheckMultipleOf",(n,e)=>{Ye.init(n,e),n._zod.onattach.push(t=>{var r;(r=t._zod.bag).multipleOf??(r.multipleOf=e.value)}),n._zod.check=t=>{if(typeof t.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof t.value=="bigint"?t.value%e.value===BigInt(0):Zx(t.value,e.value)===0)||t.issues.push({origin:typeof t.value,code:"not_multiple_of",divisor:e.value,input:t.value,inst:n,continue:!e.abort})}}),N1=x("$ZodCheckNumberFormat",(n,e)=>{var o;Ye.init(n,e),e.format=e.format||"float64";const t=(o=e.format)==null?void 0:o.includes("int"),r=t?"int":"number",[i,s]=Wx[e.format];n._zod.onattach.push(a=>{const l=a._zod.bag;l.format=e.format,l.minimum=i,l.maximum=s,t&&(l.pattern=D1)}),n._zod.check=a=>{const l=a.value;if(t){if(!Number.isInteger(l)){a.issues.push({expected:r,format:e.format,code:"invalid_type",continue:!1,input:l,inst:n});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:r,inclusive:!0,continue:!e.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:n,origin:r,inclusive:!0,continue:!e.abort});return}}l<i&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:i,inclusive:!0,inst:n,continue:!e.abort}),l>s&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:s,inclusive:!0,inst:n,continue:!e.abort})}}),U1=x("$ZodCheckMaxLength",(n,e)=>{var t;Ye.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!Yu(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),n._zod.check=r=>{const i=r.value;if(i.length<=e.maximum)return;const o=Ku(i);r.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:n,continue:!e.abort})}}),F1=x("$ZodCheckMinLength",(n,e)=>{var t;Ye.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!Yu(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),n._zod.check=r=>{const i=r.value;if(i.length>=e.minimum)return;const o=Ku(i);r.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:n,continue:!e.abort})}}),Z1=x("$ZodCheckLengthEquals",(n,e)=>{var t;Ye.init(n,e),(t=n._zod.def).when??(t.when=r=>{const i=r.value;return!Yu(i)&&i.length!==void 0}),n._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),n._zod.check=r=>{const i=r.value,s=i.length;if(s===e.length)return;const o=Ku(i),a=s>e.length;r.issues.push({origin:o,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:n,continue:!e.abort})}}),Qa=x("$ZodCheckStringFormat",(n,e)=>{var t,r;Ye.init(n,e),n._zod.onattach.push(i=>{const s=i._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(t=n._zod).check??(t.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:n,continue:!e.abort})}):(r=n._zod).check??(r.check=()=>{})}),H1=x("$ZodCheckRegex",(n,e)=>{Qa.init(n,e),n._zod.check=t=>{e.pattern.lastIndex=0,!e.pattern.test(t.value)&&t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:e.pattern.toString(),inst:n,continue:!e.abort})}}),B1=x("$ZodCheckLowerCase",(n,e)=>{e.pattern??(e.pattern=L1),Qa.init(n,e)}),G1=x("$ZodCheckUpperCase",(n,e)=>{e.pattern??(e.pattern=z1),Qa.init(n,e)}),V1=x("$ZodCheckIncludes",(n,e)=>{Ye.init(n,e);const t=di(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${t}`:t);e.pattern=r,n._zod.onattach.push(i=>{const s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),n._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:n,continue:!e.abort})}}),W1=x("$ZodCheckStartsWith",(n,e)=>{Ye.init(n,e);const t=new RegExp(`^${di(e.prefix)}.*`);e.pattern??(e.pattern=t),n._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(t)}),n._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:n,continue:!e.abort})}}),j1=x("$ZodCheckEndsWith",(n,e)=>{Ye.init(n,e);const t=new RegExp(`.*${di(e.suffix)}$`);e.pattern??(e.pattern=t),n._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(t)}),n._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:n,continue:!e.abort})}}),q1=x("$ZodCheckOverwrite",(n,e)=>{Ye.init(n,e),n._zod.check=t=>{t.value=e.tx(t.value)}});class Y1{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const r=e.split(`
5
5
  `).filter(o=>o),i=Math.min(...r.map(o=>o.length-o.trimStart().length)),s=r.map(o=>o.slice(i)).map(o=>" ".repeat(this.indent*2)+o);for(const o of s)this.content.push(o)}compile(){const e=Function,t=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new e(...t,i.join(`
6
- `))}}const tA={major:4,minor:3,patch:6},pe=x("$ZodType",(n,e)=>{var i;var t;n??(n={}),n._zod.def=e,n._zod.bag=n._zod.bag||{},n._zod.version=tA;const r=[...n._zod.def.checks??[]];n._zod.traits.has("$ZodCheck")&&r.unshift(n);for(const s of r)for(const o of s._zod.onattach)o(n);if(r.length===0)(t=n._zod).deferred??(t.deferred=[]),(i=n._zod.deferred)==null||i.push(()=>{n._zod.run=n._zod.parse});else{const s=(a,l,u)=>{let h=Zr(a),p;for(const g of l){if(g._zod.def.when){if(!g._zod.def.when(a))continue}else if(h)continue;const m=a.issues.length,A=g._zod.check(a);if(A instanceof Promise&&(u==null?void 0:u.async)===!1)throw new Gr;if(p||A instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await A,a.issues.length!==m&&(h||(h=Zr(a,m)))});else{if(a.issues.length===m)continue;h||(h=Zr(a,m))}}return p?p.then(()=>a):a},o=(a,l,u)=>{if(Zr(a))return a.aborted=!0,a;const h=s(l,r,u);if(h instanceof Promise){if(u.async===!1)throw new Gr;return h.then(p=>n._zod.parse(p,u))}return n._zod.parse(h,u)};n._zod.run=(a,l)=>{if(l.skipChecks)return n._zod.parse(a,l);if(l.direction==="backward"){const h=n._zod.parse({value:a.value,issues:[]},{...l,skipChecks:!0});return h instanceof Promise?h.then(p=>o(p,a,l)):o(h,a,l)}const u=n._zod.parse(a,l);if(u instanceof Promise){if(l.async===!1)throw new Gr;return u.then(h=>s(h,r,l))}return s(u,r,l)}}ee(n,"~standard",()=>({validate:s=>{var o;try{const a=a1(n,s);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return l1(n,s).then(l=>{var u;return l.success?{value:l.data}:{issues:(u=l.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}))}),rh=x("$ZodString",(n,e)=>{var t;pe.init(n,e),n._zod.pattern=[...((t=n==null?void 0:n._zod.bag)==null?void 0:t.patterns)??[]].pop()??M1(n._zod.bag),n._zod.parse=(r,i)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:n}),r}}),le=x("$ZodStringFormat",(n,e)=>{Qa.init(n,e),rh.init(n,e)}),nA=x("$ZodGUID",(n,e)=>{e.pattern??(e.pattern=E1),le.init(n,e)}),rA=x("$ZodUUID",(n,e)=>{if(e.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Pp(r))}else e.pattern??(e.pattern=Pp());le.init(n,e)}),iA=x("$ZodEmail",(n,e)=>{e.pattern??(e.pattern=x1),le.init(n,e)}),sA=x("$ZodURL",(n,e)=>{le.init(n,e),n._zod.check=t=>{try{const r=t.value.trim(),i=new URL(r);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:t.value,inst:n,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:t.value,inst:n,continue:!e.abort})),e.normalize?t.value=i.href:t.value=r;return}catch{t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:n,continue:!e.abort})}}}),oA=x("$ZodEmoji",(n,e)=>{e.pattern??(e.pattern=$1()),le.init(n,e)}),aA=x("$ZodNanoID",(n,e)=>{e.pattern??(e.pattern=_1),le.init(n,e)}),lA=x("$ZodCUID",(n,e)=>{e.pattern??(e.pattern=v1),le.init(n,e)}),cA=x("$ZodCUID2",(n,e)=>{e.pattern??(e.pattern=y1),le.init(n,e)}),uA=x("$ZodULID",(n,e)=>{e.pattern??(e.pattern=b1),le.init(n,e)}),hA=x("$ZodXID",(n,e)=>{e.pattern??(e.pattern=w1),le.init(n,e)}),dA=x("$ZodKSUID",(n,e)=>{e.pattern??(e.pattern=S1),le.init(n,e)}),pA=x("$ZodISODateTime",(n,e)=>{e.pattern??(e.pattern=z1(e)),le.init(n,e)}),fA=x("$ZodISODate",(n,e)=>{e.pattern??(e.pattern=O1),le.init(n,e)}),gA=x("$ZodISOTime",(n,e)=>{e.pattern??(e.pattern=L1(e)),le.init(n,e)}),mA=x("$ZodISODuration",(n,e)=>{e.pattern??(e.pattern=k1),le.init(n,e)}),vA=x("$ZodIPv4",(n,e)=>{e.pattern??(e.pattern=T1),le.init(n,e),n._zod.bag.format="ipv4"}),yA=x("$ZodIPv6",(n,e)=>{e.pattern??(e.pattern=C1),le.init(n,e),n._zod.bag.format="ipv6",n._zod.check=t=>{try{new URL(`http://[${t.value}]`)}catch{t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:n,continue:!e.abort})}}}),bA=x("$ZodCIDRv4",(n,e)=>{e.pattern??(e.pattern=I1),le.init(n,e)}),wA=x("$ZodCIDRv6",(n,e)=>{e.pattern??(e.pattern=P1),le.init(n,e),n._zod.check=t=>{const r=t.value.split("/");try{if(r.length!==2)throw new Error;const[i,s]=r;if(!s)throw new Error;const o=Number(s);if(`${o}`!==s)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${i}]`)}catch{t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:n,continue:!e.abort})}}});function Pm(n){if(n==="")return!0;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const SA=x("$ZodBase64",(n,e)=>{e.pattern??(e.pattern=R1),le.init(n,e),n._zod.bag.contentEncoding="base64",n._zod.check=t=>{Pm(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:n,continue:!e.abort})}});function _A(n){if(!Em.test(n))return!1;const e=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),t=e.padEnd(Math.ceil(e.length/4)*4,"=");return Pm(t)}const kA=x("$ZodBase64URL",(n,e)=>{e.pattern??(e.pattern=Em),le.init(n,e),n._zod.bag.contentEncoding="base64url",n._zod.check=t=>{_A(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:n,continue:!e.abort})}}),EA=x("$ZodE164",(n,e)=>{e.pattern??(e.pattern=D1),le.init(n,e)});function xA(n,e=null){try{const t=n.split(".");if(t.length!==3)return!1;const[r]=t;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}const AA=x("$ZodJWT",(n,e)=>{le.init(n,e),n._zod.check=t=>{xA(t.value,e.alg)||t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:n,continue:!e.abort})}}),Rm=x("$ZodNumber",(n,e)=>{pe.init(n,e),n._zod.pattern=n._zod.bag.pattern??$m,n._zod.parse=(t,r)=>{if(e.coerce)try{t.value=Number(t.value)}catch{}const i=t.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return t;const s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return t.issues.push({expected:"number",code:"invalid_type",input:i,inst:n,...s?{received:s}:{}}),t}}),$A=x("$ZodNumberFormat",(n,e)=>{B1.init(n,e),Rm.init(n,e)}),TA=x("$ZodBoolean",(n,e)=>{pe.init(n,e),n._zod.pattern=U1,n._zod.parse=(t,r)=>{if(e.coerce)try{t.value=!!t.value}catch{}const i=t.value;return typeof i=="boolean"||t.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:n}),t}}),CA=x("$ZodUnknown",(n,e)=>{pe.init(n,e),n._zod.parse=t=>t}),IA=x("$ZodNever",(n,e)=>{pe.init(n,e),n._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:n}),t)});function Rp(n,e,t){n.issues.length&&e.issues.push(...Hr(t,n.issues)),e.value[t]=n.value}const PA=x("$ZodArray",(n,e)=>{pe.init(n,e),n._zod.parse=(t,r)=>{const i=t.value;if(!Array.isArray(i))return t.issues.push({expected:"array",code:"invalid_type",input:i,inst:n}),t;t.value=Array(i.length);const s=[];for(let o=0;o<i.length;o++){const a=i[o],l=e.element._zod.run({value:a,issues:[]},r);l instanceof Promise?s.push(l.then(u=>Rp(u,t,o))):Rp(l,t,o)}return s.length?Promise.all(s).then(()=>t):t}});function pa(n,e,t,r,i){if(n.issues.length){if(i&&!(t in r))return;e.issues.push(...Hr(t,n.issues))}n.value===void 0?t in r&&(e.value[t]=void 0):e.value[t]=n.value}function Dm(n){var r,i,s,o;const e=Object.keys(n.shape);for(const a of e)if(!((o=(s=(i=(r=n.shape)==null?void 0:r[a])==null?void 0:i._zod)==null?void 0:s.traits)!=null&&o.has("$ZodType")))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const t=Xx(n.shape);return{...n,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(t)}}function Om(n,e,t,r,i,s){const o=[],a=i.keySet,l=i.catchall._zod,u=l.def.type,h=l.optout==="optional";for(const p in e){if(a.has(p))continue;if(u==="never"){o.push(p);continue}const g=l.run({value:e[p],issues:[]},r);g instanceof Promise?n.push(g.then(m=>pa(m,t,p,e,h))):pa(g,t,p,e,h)}return o.length&&t.issues.push({code:"unrecognized_keys",keys:o,input:e,inst:s}),n.length?Promise.all(n).then(()=>t):t}const RA=x("$ZodObject",(n,e)=>{pe.init(n,e);const t=Object.getOwnPropertyDescriptor(e,"shape");if(!(t!=null&&t.get)){const a=e.shape;Object.defineProperty(e,"shape",{get:()=>{const l={...a};return Object.defineProperty(e,"shape",{value:l}),l}})}const r=Ku(()=>Dm(e));ee(n._zod,"propValues",()=>{const a=e.shape,l={};for(const u in a){const h=a[u]._zod;if(h.values){l[u]??(l[u]=new Set);for(const p of h.values)l[u].add(p)}}return l});const i=da,s=e.catchall;let o;n._zod.parse=(a,l)=>{o??(o=r.value);const u=a.value;if(!i(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:n}),a;a.value={};const h=[],p=o.shape;for(const g of o.keys){const m=p[g],A=m._zod.optout==="optional",k=m._zod.run({value:u[g],issues:[]},l);k instanceof Promise?h.push(k.then(I=>pa(I,a,g,u,A))):pa(k,a,g,u,A)}return s?Om(h,u,a,l,r.value,n):h.length?Promise.all(h).then(()=>a):a}}),DA=x("$ZodObjectJIT",(n,e)=>{RA.init(n,e);const t=n._zod.parse,r=Ku(()=>Dm(e)),i=g=>{var V;const m=new eA(["shape","payload","ctx"]),A=r.value,k=O=>{const H=Ip(O);return`shape[${H}]._zod.run({ value: input[${H}], issues: [] }, ctx)`};m.write("const input = payload.value;");const I=Object.create(null);let U=0;for(const O of A.keys)I[O]=`key_${U++}`;m.write("const newResult = {};");for(const O of A.keys){const H=I[O],F=Ip(O),ce=g[O],ue=((V=ce==null?void 0:ce._zod)==null?void 0:V.optout)==="optional";m.write(`const ${H} = ${k(O)};`),ue?m.write(`
6
+ `))}}const X1={major:4,minor:3,patch:6},pe=x("$ZodType",(n,e)=>{var i;var t;n??(n={}),n._zod.def=e,n._zod.bag=n._zod.bag||{},n._zod.version=X1;const r=[...n._zod.def.checks??[]];n._zod.traits.has("$ZodCheck")&&r.unshift(n);for(const s of r)for(const o of s._zod.onattach)o(n);if(r.length===0)(t=n._zod).deferred??(t.deferred=[]),(i=n._zod.deferred)==null||i.push(()=>{n._zod.run=n._zod.parse});else{const s=(a,l,u)=>{let h=Zr(a),p;for(const g of l){if(g._zod.def.when){if(!g._zod.def.when(a))continue}else if(h)continue;const m=a.issues.length,A=g._zod.check(a);if(A instanceof Promise&&(u==null?void 0:u.async)===!1)throw new Gr;if(p||A instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await A,a.issues.length!==m&&(h||(h=Zr(a,m)))});else{if(a.issues.length===m)continue;h||(h=Zr(a,m))}}return p?p.then(()=>a):a},o=(a,l,u)=>{if(Zr(a))return a.aborted=!0,a;const h=s(l,r,u);if(h instanceof Promise){if(u.async===!1)throw new Gr;return h.then(p=>n._zod.parse(p,u))}return n._zod.parse(h,u)};n._zod.run=(a,l)=>{if(l.skipChecks)return n._zod.parse(a,l);if(l.direction==="backward"){const h=n._zod.parse({value:a.value,issues:[]},{...l,skipChecks:!0});return h instanceof Promise?h.then(p=>o(p,a,l)):o(h,a,l)}const u=n._zod.parse(a,l);if(u instanceof Promise){if(l.async===!1)throw new Gr;return u.then(h=>s(h,r,l))}return s(u,r,l)}}ee(n,"~standard",()=>({validate:s=>{var o;try{const a=n1(n,s);return a.success?{value:a.data}:{issues:(o=a.error)==null?void 0:o.issues}}catch{return r1(n,s).then(l=>{var u;return l.success?{value:l.data}:{issues:(u=l.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}))}),eh=x("$ZodString",(n,e)=>{var t;pe.init(n,e),n._zod.pattern=[...((t=n==null?void 0:n._zod.bag)==null?void 0:t.patterns)??[]].pop()??R1(n._zod.bag),n._zod.parse=(r,i)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:n}),r}}),le=x("$ZodStringFormat",(n,e)=>{Qa.init(n,e),eh.init(n,e)}),K1=x("$ZodGUID",(n,e)=>{e.pattern??(e.pattern=b1),le.init(n,e)}),J1=x("$ZodUUID",(n,e)=>{if(e.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=xp(r))}else e.pattern??(e.pattern=xp());le.init(n,e)}),Q1=x("$ZodEmail",(n,e)=>{e.pattern??(e.pattern=w1),le.init(n,e)}),eA=x("$ZodURL",(n,e)=>{le.init(n,e),n._zod.check=t=>{try{const r=t.value.trim(),i=new URL(r);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:t.value,inst:n,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:t.value,inst:n,continue:!e.abort})),e.normalize?t.value=i.href:t.value=r;return}catch{t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:n,continue:!e.abort})}}}),tA=x("$ZodEmoji",(n,e)=>{e.pattern??(e.pattern=_1()),le.init(n,e)}),nA=x("$ZodNanoID",(n,e)=>{e.pattern??(e.pattern=v1),le.init(n,e)}),rA=x("$ZodCUID",(n,e)=>{e.pattern??(e.pattern=d1),le.init(n,e)}),iA=x("$ZodCUID2",(n,e)=>{e.pattern??(e.pattern=p1),le.init(n,e)}),sA=x("$ZodULID",(n,e)=>{e.pattern??(e.pattern=f1),le.init(n,e)}),oA=x("$ZodXID",(n,e)=>{e.pattern??(e.pattern=g1),le.init(n,e)}),aA=x("$ZodKSUID",(n,e)=>{e.pattern??(e.pattern=m1),le.init(n,e)}),lA=x("$ZodISODateTime",(n,e)=>{e.pattern??(e.pattern=P1(e)),le.init(n,e)}),cA=x("$ZodISODate",(n,e)=>{e.pattern??(e.pattern=C1),le.init(n,e)}),uA=x("$ZodISOTime",(n,e)=>{e.pattern??(e.pattern=I1(e)),le.init(n,e)}),hA=x("$ZodISODuration",(n,e)=>{e.pattern??(e.pattern=y1),le.init(n,e)}),dA=x("$ZodIPv4",(n,e)=>{e.pattern??(e.pattern=k1),le.init(n,e),n._zod.bag.format="ipv4"}),pA=x("$ZodIPv6",(n,e)=>{e.pattern??(e.pattern=E1),le.init(n,e),n._zod.bag.format="ipv6",n._zod.check=t=>{try{new URL(`http://[${t.value}]`)}catch{t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:n,continue:!e.abort})}}}),fA=x("$ZodCIDRv4",(n,e)=>{e.pattern??(e.pattern=x1),le.init(n,e)}),gA=x("$ZodCIDRv6",(n,e)=>{e.pattern??(e.pattern=A1),le.init(n,e),n._zod.check=t=>{const r=t.value.split("/");try{if(r.length!==2)throw new Error;const[i,s]=r;if(!s)throw new Error;const o=Number(s);if(`${o}`!==s)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${i}]`)}catch{t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:n,continue:!e.abort})}}});function xm(n){if(n==="")return!0;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}const mA=x("$ZodBase64",(n,e)=>{e.pattern??(e.pattern=$1),le.init(n,e),n._zod.bag.contentEncoding="base64",n._zod.check=t=>{xm(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:n,continue:!e.abort})}});function vA(n){if(!ym.test(n))return!1;const e=n.replace(/[-_]/g,r=>r==="-"?"+":"/"),t=e.padEnd(Math.ceil(e.length/4)*4,"=");return xm(t)}const yA=x("$ZodBase64URL",(n,e)=>{e.pattern??(e.pattern=ym),le.init(n,e),n._zod.bag.contentEncoding="base64url",n._zod.check=t=>{vA(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:n,continue:!e.abort})}}),bA=x("$ZodE164",(n,e)=>{e.pattern??(e.pattern=T1),le.init(n,e)});function wA(n,e=null){try{const t=n.split(".");if(t.length!==3)return!1;const[r]=t;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}const SA=x("$ZodJWT",(n,e)=>{le.init(n,e),n._zod.check=t=>{wA(t.value,e.alg)||t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:n,continue:!e.abort})}}),Am=x("$ZodNumber",(n,e)=>{pe.init(n,e),n._zod.pattern=n._zod.bag.pattern??Sm,n._zod.parse=(t,r)=>{if(e.coerce)try{t.value=Number(t.value)}catch{}const i=t.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return t;const s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return t.issues.push({expected:"number",code:"invalid_type",input:i,inst:n,...s?{received:s}:{}}),t}}),_A=x("$ZodNumberFormat",(n,e)=>{N1.init(n,e),Am.init(n,e)}),kA=x("$ZodBoolean",(n,e)=>{pe.init(n,e),n._zod.pattern=O1,n._zod.parse=(t,r)=>{if(e.coerce)try{t.value=!!t.value}catch{}const i=t.value;return typeof i=="boolean"||t.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:n}),t}}),EA=x("$ZodUnknown",(n,e)=>{pe.init(n,e),n._zod.parse=t=>t}),xA=x("$ZodNever",(n,e)=>{pe.init(n,e),n._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:n}),t)});function Ap(n,e,t){n.issues.length&&e.issues.push(...Hr(t,n.issues)),e.value[t]=n.value}const AA=x("$ZodArray",(n,e)=>{pe.init(n,e),n._zod.parse=(t,r)=>{const i=t.value;if(!Array.isArray(i))return t.issues.push({expected:"array",code:"invalid_type",input:i,inst:n}),t;t.value=Array(i.length);const s=[];for(let o=0;o<i.length;o++){const a=i[o],l=e.element._zod.run({value:a,issues:[]},r);l instanceof Promise?s.push(l.then(u=>Ap(u,t,o))):Ap(l,t,o)}return s.length?Promise.all(s).then(()=>t):t}});function pa(n,e,t,r,i){if(n.issues.length){if(i&&!(t in r))return;e.issues.push(...Hr(t,n.issues))}n.value===void 0?t in r&&(e.value[t]=void 0):e.value[t]=n.value}function $m(n){var r,i,s,o;const e=Object.keys(n.shape);for(const a of e)if(!((o=(s=(i=(r=n.shape)==null?void 0:r[a])==null?void 0:i._zod)==null?void 0:s.traits)!=null&&o.has("$ZodType")))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const t=Vx(n.shape);return{...n,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(t)}}function Tm(n,e,t,r,i,s){const o=[],a=i.keySet,l=i.catchall._zod,u=l.def.type,h=l.optout==="optional";for(const p in e){if(a.has(p))continue;if(u==="never"){o.push(p);continue}const g=l.run({value:e[p],issues:[]},r);g instanceof Promise?n.push(g.then(m=>pa(m,t,p,e,h))):pa(g,t,p,e,h)}return o.length&&t.issues.push({code:"unrecognized_keys",keys:o,input:e,inst:s}),n.length?Promise.all(n).then(()=>t):t}const $A=x("$ZodObject",(n,e)=>{pe.init(n,e);const t=Object.getOwnPropertyDescriptor(e,"shape");if(!(t!=null&&t.get)){const a=e.shape;Object.defineProperty(e,"shape",{get:()=>{const l={...a};return Object.defineProperty(e,"shape",{value:l}),l}})}const r=qu(()=>$m(e));ee(n._zod,"propValues",()=>{const a=e.shape,l={};for(const u in a){const h=a[u]._zod;if(h.values){l[u]??(l[u]=new Set);for(const p of h.values)l[u].add(p)}}return l});const i=da,s=e.catchall;let o;n._zod.parse=(a,l)=>{o??(o=r.value);const u=a.value;if(!i(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:n}),a;a.value={};const h=[],p=o.shape;for(const g of o.keys){const m=p[g],A=m._zod.optout==="optional",k=m._zod.run({value:u[g],issues:[]},l);k instanceof Promise?h.push(k.then(I=>pa(I,a,g,u,A))):pa(k,a,g,u,A)}return s?Tm(h,u,a,l,r.value,n):h.length?Promise.all(h).then(()=>a):a}}),TA=x("$ZodObjectJIT",(n,e)=>{$A.init(n,e);const t=n._zod.parse,r=qu(()=>$m(e)),i=g=>{var V;const m=new Y1(["shape","payload","ctx"]),A=r.value,k=O=>{const H=Ep(O);return`shape[${H}]._zod.run({ value: input[${H}], issues: [] }, ctx)`};m.write("const input = payload.value;");const I=Object.create(null);let U=0;for(const O of A.keys)I[O]=`key_${U++}`;m.write("const newResult = {};");for(const O of A.keys){const H=I[O],F=Ep(O),ce=g[O],ue=((V=ce==null?void 0:ce._zod)==null?void 0:V.optout)==="optional";m.write(`const ${H} = ${k(O)};`),ue?m.write(`
7
7
  if (${H}.issues.length) {
8
8
  if (${F} in input) {
9
9
  payload.issues = payload.issues.concat(${H}.issues.map(iss => ({
@@ -37,35 +37,35 @@ var xb=Object.defineProperty;var Yh=n=>{throw TypeError(n)};var Ab=(n,e,t)=>e in
37
37
  newResult[${F}] = ${H}.value;
38
38
  }
39
39
 
40
- `)}m.write("payload.value = newResult;"),m.write("return payload;");const P=m.compile();return(O,H)=>P(g,O,H)};let s;const o=da,a=!vm.jitless,u=a&&qx.value,h=e.catchall;let p;n._zod.parse=(g,m)=>{p??(p=r.value);const A=g.value;return o(A)?a&&u&&(m==null?void 0:m.async)===!1&&m.jitless!==!0?(s||(s=i(e.shape)),g=s(g,m),h?Om([],A,g,m,p,n):g):t(g,m):(g.issues.push({expected:"object",code:"invalid_type",input:A,inst:n}),g)}});function Dp(n,e,t,r){for(const s of n)if(s.issues.length===0)return e.value=s.value,e;const i=n.filter(s=>!Zr(s));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:t,errors:n.map(s=>s.issues.map(o=>yn(o,r,vn())))}),e)}const OA=x("$ZodUnion",(n,e)=>{pe.init(n,e),ee(n._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),ee(n._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),ee(n._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),ee(n._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){const i=e.options.map(s=>s._zod.pattern);return new RegExp(`^(${i.map(s=>Qu(s.source)).join("|")})$`)}});const t=e.options.length===1,r=e.options[0]._zod.run;n._zod.parse=(i,s)=>{if(t)return r(i,s);let o=!1;const a=[];for(const l of e.options){const u=l._zod.run({value:i.value,issues:[]},s);if(u instanceof Promise)a.push(u),o=!0;else{if(u.issues.length===0)return u;a.push(u)}}return o?Promise.all(a).then(l=>Dp(l,i,n,s)):Dp(a,i,n,s)}}),LA=x("$ZodIntersection",(n,e)=>{pe.init(n,e),n._zod.parse=(t,r)=>{const i=t.value,s=e.left._zod.run({value:i,issues:[]},r),o=e.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([l,u])=>Op(t,l,u)):Op(t,s,o)}});function Oc(n,e){if(n===e)return{valid:!0,data:n};if(n instanceof Date&&e instanceof Date&&+n==+e)return{valid:!0,data:n};if(hi(n)&&hi(e)){const t=Object.keys(e),r=Object.keys(n).filter(s=>t.indexOf(s)!==-1),i={...n,...e};for(const s of r){const o=Oc(n[s],e[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};i[s]=o.data}return{valid:!0,data:i}}if(Array.isArray(n)&&Array.isArray(e)){if(n.length!==e.length)return{valid:!1,mergeErrorPath:[]};const t=[];for(let r=0;r<n.length;r++){const i=n[r],s=e[r],o=Oc(i,s);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};t.push(o.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function Op(n,e,t){const r=new Map;let i;for(const a of e.issues)if(a.code==="unrecognized_keys"){i??(i=a);for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else n.issues.push(a);for(const a of t.issues)if(a.code==="unrecognized_keys")for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).r=!0;else n.issues.push(a);const s=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&i&&n.issues.push({...i,keys:s}),Zr(n))return n;const o=Oc(e.value,t.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return n.value=o.data,n}const zA=x("$ZodRecord",(n,e)=>{pe.init(n,e),n._zod.parse=(t,r)=>{const i=t.value;if(!hi(i))return t.issues.push({expected:"record",code:"invalid_type",input:i,inst:n}),t;const s=[],o=e.keyType._zod.values;if(o){t.value={};const a=new Set;for(const u of o)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);const h=e.valueType._zod.run({value:i[u],issues:[]},r);h instanceof Promise?s.push(h.then(p=>{p.issues.length&&t.issues.push(...Hr(u,p.issues)),t.value[u]=p.value})):(h.issues.length&&t.issues.push(...Hr(u,h.issues)),t.value[u]=h.value)}let l;for(const u in i)a.has(u)||(l=l??[],l.push(u));l&&l.length>0&&t.issues.push({code:"unrecognized_keys",input:i,inst:n,keys:l})}else{t.value={};for(const a of Reflect.ownKeys(i)){if(a==="__proto__")continue;let l=e.keyType._zod.run({value:a,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&$m.test(a)&&l.issues.length){const p=e.keyType._zod.run({value:Number(a),issues:[]},r);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(l=p)}if(l.issues.length){e.mode==="loose"?t.value[a]=i[a]:t.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(p=>yn(p,r,vn())),input:a,path:[a],inst:n});continue}const h=e.valueType._zod.run({value:i[a],issues:[]},r);h instanceof Promise?s.push(h.then(p=>{p.issues.length&&t.issues.push(...Hr(a,p.issues)),t.value[l.value]=p.value})):(h.issues.length&&t.issues.push(...Hr(a,h.issues)),t.value[l.value]=h.value)}}return s.length?Promise.all(s).then(()=>t):t}}),MA=x("$ZodEnum",(n,e)=>{pe.init(n,e);const t=ym(e.entries),r=new Set(t);n._zod.values=r,n._zod.pattern=new RegExp(`^(${t.filter(i=>Yx.has(typeof i)).map(i=>typeof i=="string"?di(i):i.toString()).join("|")})$`),n._zod.parse=(i,s)=>{const o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:t,input:o,inst:n}),i}}),NA=x("$ZodLiteral",(n,e)=>{if(pe.init(n,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");const t=new Set(e.values);n._zod.values=t,n._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?di(r):r?di(r.toString()):String(r)).join("|")})$`),n._zod.parse=(r,i)=>{const s=r.value;return t.has(s)||r.issues.push({code:"invalid_value",values:e.values,input:s,inst:n}),r}}),UA=x("$ZodTransform",(n,e)=>{pe.init(n,e),n._zod.parse=(t,r)=>{if(r.direction==="backward")throw new mm(n.constructor.name);const i=e.transform(t.value,t);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(t.value=o,t));if(i instanceof Promise)throw new Gr;return t.value=i,t}});function Lp(n,e){return n.issues.length&&e===void 0?{issues:[],value:void 0}:n}const Lm=x("$ZodOptional",(n,e)=>{pe.init(n,e),n._zod.optin="optional",n._zod.optout="optional",ee(n._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),ee(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${Qu(t.source)})?$`):void 0}),n._zod.parse=(t,r)=>{if(e.innerType._zod.optin==="optional"){const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>Lp(s,t.value)):Lp(i,t.value)}return t.value===void 0?t:e.innerType._zod.run(t,r)}}),FA=x("$ZodExactOptional",(n,e)=>{Lm.init(n,e),ee(n._zod,"values",()=>e.innerType._zod.values),ee(n._zod,"pattern",()=>e.innerType._zod.pattern),n._zod.parse=(t,r)=>e.innerType._zod.run(t,r)}),ZA=x("$ZodNullable",(n,e)=>{pe.init(n,e),ee(n._zod,"optin",()=>e.innerType._zod.optin),ee(n._zod,"optout",()=>e.innerType._zod.optout),ee(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${Qu(t.source)}|null)$`):void 0}),ee(n._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),n._zod.parse=(t,r)=>t.value===null?t:e.innerType._zod.run(t,r)}),HA=x("$ZodDefault",(n,e)=>{pe.init(n,e),n._zod.optin="optional",ee(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);if(t.value===void 0)return t.value=e.defaultValue,t;const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>zp(s,e)):zp(i,e)}});function zp(n,e){return n.value===void 0&&(n.value=e.defaultValue),n}const BA=x("$ZodPrefault",(n,e)=>{pe.init(n,e),n._zod.optin="optional",ee(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>(r.direction==="backward"||t.value===void 0&&(t.value=e.defaultValue),e.innerType._zod.run(t,r))}),GA=x("$ZodNonOptional",(n,e)=>{pe.init(n,e),ee(n._zod,"values",()=>{const t=e.innerType._zod.values;return t?new Set([...t].filter(r=>r!==void 0)):void 0}),n._zod.parse=(t,r)=>{const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>Mp(s,n)):Mp(i,n)}});function Mp(n,e){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:e}),n}const VA=x("$ZodCatch",(n,e)=>{pe.init(n,e),ee(n._zod,"optin",()=>e.innerType._zod.optin),ee(n._zod,"optout",()=>e.innerType._zod.optout),ee(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>(t.value=s.value,s.issues.length&&(t.value=e.catchValue({...t,error:{issues:s.issues.map(o=>yn(o,r,vn()))},input:t.value}),t.issues=[]),t)):(t.value=i.value,i.issues.length&&(t.value=e.catchValue({...t,error:{issues:i.issues.map(s=>yn(s,r,vn()))},input:t.value}),t.issues=[]),t)}}),WA=x("$ZodPipe",(n,e)=>{pe.init(n,e),ee(n._zod,"values",()=>e.in._zod.values),ee(n._zod,"optin",()=>e.in._zod.optin),ee(n._zod,"optout",()=>e.out._zod.optout),ee(n._zod,"propValues",()=>e.in._zod.propValues),n._zod.parse=(t,r)=>{if(r.direction==="backward"){const s=e.out._zod.run(t,r);return s instanceof Promise?s.then(o=>Co(o,e.in,r)):Co(s,e.in,r)}const i=e.in._zod.run(t,r);return i instanceof Promise?i.then(s=>Co(s,e.out,r)):Co(i,e.out,r)}});function Co(n,e,t){return n.issues.length?(n.aborted=!0,n):e._zod.run({value:n.value,issues:n.issues},t)}const jA=x("$ZodReadonly",(n,e)=>{pe.init(n,e),ee(n._zod,"propValues",()=>e.innerType._zod.propValues),ee(n._zod,"values",()=>e.innerType._zod.values),ee(n._zod,"optin",()=>{var t,r;return(r=(t=e.innerType)==null?void 0:t._zod)==null?void 0:r.optin}),ee(n._zod,"optout",()=>{var t,r;return(r=(t=e.innerType)==null?void 0:t._zod)==null?void 0:r.optout}),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(Np):Np(i)}});function Np(n){return n.value=Object.freeze(n.value),n}const qA=x("$ZodCustom",(n,e)=>{Ye.init(n,e),pe.init(n,e),n._zod.parse=(t,r)=>t,n._zod.check=t=>{const r=t.value,i=e.fn(r);if(i instanceof Promise)return i.then(s=>Up(s,t,r,n));Up(i,t,r,n)}});function Up(n,e,t,r){if(!n){const i={code:"custom",input:t,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),e.issues.push(ss(i))}}var Fp;class YA{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const r=t[0];return this._map.set(e,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const 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){const t=e._zod.parent;if(t){const r={...this.get(t)??{}};delete r.id;const i={...r,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function XA(){return new YA}(Fp=globalThis).__zod_globalRegistry??(Fp.__zod_globalRegistry=XA());const Gi=globalThis.__zod_globalRegistry;function KA(n,e){return new n({type:"string",...L(e)})}function JA(n,e){return new n({type:"string",format:"email",check:"string_format",abort:!1,...L(e)})}function Zp(n,e){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...L(e)})}function QA(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...L(e)})}function e$(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...L(e)})}function t$(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...L(e)})}function n$(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...L(e)})}function r$(n,e){return new n({type:"string",format:"url",check:"string_format",abort:!1,...L(e)})}function i$(n,e){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...L(e)})}function s$(n,e){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...L(e)})}function o$(n,e){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...L(e)})}function a$(n,e){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...L(e)})}function l$(n,e){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...L(e)})}function c$(n,e){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...L(e)})}function u$(n,e){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...L(e)})}function h$(n,e){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...L(e)})}function d$(n,e){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...L(e)})}function p$(n,e){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...L(e)})}function f$(n,e){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...L(e)})}function g$(n,e){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...L(e)})}function m$(n,e){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...L(e)})}function v$(n,e){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...L(e)})}function y$(n,e){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...L(e)})}function b$(n,e){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...L(e)})}function w$(n,e){return new n({type:"string",format:"date",check:"string_format",...L(e)})}function S$(n,e){return new n({type:"string",format:"time",check:"string_format",precision:null,...L(e)})}function _$(n,e){return new n({type:"string",format:"duration",check:"string_format",...L(e)})}function k$(n,e){return new n({type:"number",checks:[],...L(e)})}function E$(n,e){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...L(e)})}function x$(n,e){return new n({type:"boolean",...L(e)})}function A$(n){return new n({type:"unknown"})}function $$(n,e){return new n({type:"never",...L(e)})}function Hp(n,e){return new Cm({check:"less_than",...L(e),value:n,inclusive:!1})}function Kl(n,e){return new Cm({check:"less_than",...L(e),value:n,inclusive:!0})}function Bp(n,e){return new Im({check:"greater_than",...L(e),value:n,inclusive:!1})}function Jl(n,e){return new Im({check:"greater_than",...L(e),value:n,inclusive:!0})}function Gp(n,e){return new H1({check:"multiple_of",...L(e),value:n})}function zm(n,e){return new G1({check:"max_length",...L(e),maximum:n})}function fa(n,e){return new V1({check:"min_length",...L(e),minimum:n})}function Mm(n,e){return new W1({check:"length_equals",...L(e),length:n})}function T$(n,e){return new j1({check:"string_format",format:"regex",...L(e),pattern:n})}function C$(n){return new q1({check:"string_format",format:"lowercase",...L(n)})}function I$(n){return new Y1({check:"string_format",format:"uppercase",...L(n)})}function P$(n,e){return new X1({check:"string_format",format:"includes",...L(e),includes:n})}function R$(n,e){return new K1({check:"string_format",format:"starts_with",...L(e),prefix:n})}function D$(n,e){return new J1({check:"string_format",format:"ends_with",...L(e),suffix:n})}function Ei(n){return new Q1({check:"overwrite",tx:n})}function O$(n){return Ei(e=>e.normalize(n))}function L$(){return Ei(n=>n.trim())}function z$(){return Ei(n=>n.toLowerCase())}function M$(){return Ei(n=>n.toUpperCase())}function N$(){return Ei(n=>jx(n))}function U$(n,e,t){return new n({type:"array",element:e,...L(t)})}function F$(n,e,t){return new n({type:"custom",check:"custom",fn:e,...L(t)})}function Z$(n){const e=H$(t=>(t.addIssue=r=>{if(typeof r=="string")t.issues.push(ss(r,t.value,e._zod.def));else{const i=r;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=t.value),i.inst??(i.inst=e),i.continue??(i.continue=!e._zod.def.abort),t.issues.push(ss(i))}},n(t.value,t)));return e}function H$(n,e){const t=new Ye({check:"custom",...L(e)});return t._zod.check=n,t}function Nm(n){let e=(n==null?void 0:n.target)??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:n.processors??{},metadataRegistry:(n==null?void 0:n.metadata)??Gi,target:e,unrepresentable:(n==null?void 0:n.unrepresentable)??"throw",override:(n==null?void 0:n.override)??(()=>{}),io:(n==null?void 0:n.io)??"output",counter:0,seen:new Map,cycles:(n==null?void 0:n.cycles)??"ref",reused:(n==null?void 0:n.reused)??"inline",external:(n==null?void 0:n.external)??void 0}}function ye(n,e,t={path:[],schemaPath:[]}){var h,p;var r;const i=n._zod.def,s=e.seen.get(n);if(s)return s.count++,t.schemaPath.includes(n)&&(s.cycle=t.path),s.schema;const o={schema:{},count:1,cycle:void 0,path:t.path};e.seen.set(n,o);const a=(p=(h=n._zod).toJSONSchema)==null?void 0:p.call(h);if(a)o.schema=a;else{const g={...t,schemaPath:[...t.schemaPath,n],path:t.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(e,o.schema,g);else{const A=o.schema,k=e.processors[i.type];if(!k)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);k(n,e,A,g)}const m=n._zod.parent;m&&(o.ref||(o.ref=m),ye(m,e,g),e.seen.get(m).isParent=!0)}const l=e.metadataRegistry.get(n);return l&&Object.assign(o.schema,l),e.io==="input"&&ze(n)&&(delete o.schema.examples,delete o.schema.default),e.io==="input"&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,e.seen.get(n).schema}function Um(n,e){var o,a,l,u;const t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const h of n.seen.entries()){const p=(o=n.metadataRegistry.get(h[0]))==null?void 0:o.id;if(p){const g=r.get(p);if(g&&g!==h[0])throw new Error(`Duplicate schema id "${p}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(p,h[0])}}const i=h=>{var k;const p=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const I=(k=n.external.registry.get(h[0]))==null?void 0:k.id,U=n.external.uri??(V=>V);if(I)return{ref:U(I)};const P=h[1].defId??h[1].schema.id??`schema${n.counter++}`;return h[1].defId=P,{defId:P,ref:`${U("__shared")}#/${p}/${P}`}}if(h[1]===t)return{ref:"#"};const m=`#/${p}/`,A=h[1].schema.id??`__schema${n.counter++}`;return{defId:A,ref:m+A}},s=h=>{if(h[1].schema.$ref)return;const p=h[1],{ref:g,defId:m}=i(h);p.def={...p.schema},m&&(p.defId=m);const A=p.schema;for(const k in A)delete A[k];A.$ref=g};if(n.cycles==="throw")for(const h of n.seen.entries()){const p=h[1];if(p.cycle)throw new Error(`Cycle detected: #/${(a=p.cycle)==null?void 0:a.join("/")}/<root>
40
+ `)}m.write("payload.value = newResult;"),m.write("return payload;");const P=m.compile();return(O,H)=>P(g,O,H)};let s;const o=da,a=!hm.jitless,u=a&&Bx.value,h=e.catchall;let p;n._zod.parse=(g,m)=>{p??(p=r.value);const A=g.value;return o(A)?a&&u&&(m==null?void 0:m.async)===!1&&m.jitless!==!0?(s||(s=i(e.shape)),g=s(g,m),h?Tm([],A,g,m,p,n):g):t(g,m):(g.issues.push({expected:"object",code:"invalid_type",input:A,inst:n}),g)}});function $p(n,e,t,r){for(const s of n)if(s.issues.length===0)return e.value=s.value,e;const i=n.filter(s=>!Zr(s));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:t,errors:n.map(s=>s.issues.map(o=>yn(o,r,vn())))}),e)}const CA=x("$ZodUnion",(n,e)=>{pe.init(n,e),ee(n._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),ee(n._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),ee(n._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),ee(n._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){const i=e.options.map(s=>s._zod.pattern);return new RegExp(`^(${i.map(s=>Xu(s.source)).join("|")})$`)}});const t=e.options.length===1,r=e.options[0]._zod.run;n._zod.parse=(i,s)=>{if(t)return r(i,s);let o=!1;const a=[];for(const l of e.options){const u=l._zod.run({value:i.value,issues:[]},s);if(u instanceof Promise)a.push(u),o=!0;else{if(u.issues.length===0)return u;a.push(u)}}return o?Promise.all(a).then(l=>$p(l,i,n,s)):$p(a,i,n,s)}}),IA=x("$ZodIntersection",(n,e)=>{pe.init(n,e),n._zod.parse=(t,r)=>{const i=t.value,s=e.left._zod.run({value:i,issues:[]},r),o=e.right._zod.run({value:i,issues:[]},r);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([l,u])=>Tp(t,l,u)):Tp(t,s,o)}});function Pc(n,e){if(n===e)return{valid:!0,data:n};if(n instanceof Date&&e instanceof Date&&+n==+e)return{valid:!0,data:n};if(hi(n)&&hi(e)){const t=Object.keys(e),r=Object.keys(n).filter(s=>t.indexOf(s)!==-1),i={...n,...e};for(const s of r){const o=Pc(n[s],e[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};i[s]=o.data}return{valid:!0,data:i}}if(Array.isArray(n)&&Array.isArray(e)){if(n.length!==e.length)return{valid:!1,mergeErrorPath:[]};const t=[];for(let r=0;r<n.length;r++){const i=n[r],s=e[r],o=Pc(i,s);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};t.push(o.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function Tp(n,e,t){const r=new Map;let i;for(const a of e.issues)if(a.code==="unrecognized_keys"){i??(i=a);for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else n.issues.push(a);for(const a of t.issues)if(a.code==="unrecognized_keys")for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).r=!0;else n.issues.push(a);const s=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&i&&n.issues.push({...i,keys:s}),Zr(n))return n;const o=Pc(e.value,t.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return n.value=o.data,n}const PA=x("$ZodRecord",(n,e)=>{pe.init(n,e),n._zod.parse=(t,r)=>{const i=t.value;if(!hi(i))return t.issues.push({expected:"record",code:"invalid_type",input:i,inst:n}),t;const s=[],o=e.keyType._zod.values;if(o){t.value={};const a=new Set;for(const u of o)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);const h=e.valueType._zod.run({value:i[u],issues:[]},r);h instanceof Promise?s.push(h.then(p=>{p.issues.length&&t.issues.push(...Hr(u,p.issues)),t.value[u]=p.value})):(h.issues.length&&t.issues.push(...Hr(u,h.issues)),t.value[u]=h.value)}let l;for(const u in i)a.has(u)||(l=l??[],l.push(u));l&&l.length>0&&t.issues.push({code:"unrecognized_keys",input:i,inst:n,keys:l})}else{t.value={};for(const a of Reflect.ownKeys(i)){if(a==="__proto__")continue;let l=e.keyType._zod.run({value:a,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Sm.test(a)&&l.issues.length){const p=e.keyType._zod.run({value:Number(a),issues:[]},r);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(l=p)}if(l.issues.length){e.mode==="loose"?t.value[a]=i[a]:t.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(p=>yn(p,r,vn())),input:a,path:[a],inst:n});continue}const h=e.valueType._zod.run({value:i[a],issues:[]},r);h instanceof Promise?s.push(h.then(p=>{p.issues.length&&t.issues.push(...Hr(a,p.issues)),t.value[l.value]=p.value})):(h.issues.length&&t.issues.push(...Hr(a,h.issues)),t.value[l.value]=h.value)}}return s.length?Promise.all(s).then(()=>t):t}}),RA=x("$ZodEnum",(n,e)=>{pe.init(n,e);const t=dm(e.entries),r=new Set(t);n._zod.values=r,n._zod.pattern=new RegExp(`^(${t.filter(i=>Gx.has(typeof i)).map(i=>typeof i=="string"?di(i):i.toString()).join("|")})$`),n._zod.parse=(i,s)=>{const o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:t,input:o,inst:n}),i}}),DA=x("$ZodLiteral",(n,e)=>{if(pe.init(n,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");const t=new Set(e.values);n._zod.values=t,n._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?di(r):r?di(r.toString()):String(r)).join("|")})$`),n._zod.parse=(r,i)=>{const s=r.value;return t.has(s)||r.issues.push({code:"invalid_value",values:e.values,input:s,inst:n}),r}}),OA=x("$ZodTransform",(n,e)=>{pe.init(n,e),n._zod.parse=(t,r)=>{if(r.direction==="backward")throw new um(n.constructor.name);const i=e.transform(t.value,t);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(t.value=o,t));if(i instanceof Promise)throw new Gr;return t.value=i,t}});function Cp(n,e){return n.issues.length&&e===void 0?{issues:[],value:void 0}:n}const Cm=x("$ZodOptional",(n,e)=>{pe.init(n,e),n._zod.optin="optional",n._zod.optout="optional",ee(n._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),ee(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${Xu(t.source)})?$`):void 0}),n._zod.parse=(t,r)=>{if(e.innerType._zod.optin==="optional"){const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>Cp(s,t.value)):Cp(i,t.value)}return t.value===void 0?t:e.innerType._zod.run(t,r)}}),LA=x("$ZodExactOptional",(n,e)=>{Cm.init(n,e),ee(n._zod,"values",()=>e.innerType._zod.values),ee(n._zod,"pattern",()=>e.innerType._zod.pattern),n._zod.parse=(t,r)=>e.innerType._zod.run(t,r)}),zA=x("$ZodNullable",(n,e)=>{pe.init(n,e),ee(n._zod,"optin",()=>e.innerType._zod.optin),ee(n._zod,"optout",()=>e.innerType._zod.optout),ee(n._zod,"pattern",()=>{const t=e.innerType._zod.pattern;return t?new RegExp(`^(${Xu(t.source)}|null)$`):void 0}),ee(n._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),n._zod.parse=(t,r)=>t.value===null?t:e.innerType._zod.run(t,r)}),MA=x("$ZodDefault",(n,e)=>{pe.init(n,e),n._zod.optin="optional",ee(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);if(t.value===void 0)return t.value=e.defaultValue,t;const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>Ip(s,e)):Ip(i,e)}});function Ip(n,e){return n.value===void 0&&(n.value=e.defaultValue),n}const NA=x("$ZodPrefault",(n,e)=>{pe.init(n,e),n._zod.optin="optional",ee(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>(r.direction==="backward"||t.value===void 0&&(t.value=e.defaultValue),e.innerType._zod.run(t,r))}),UA=x("$ZodNonOptional",(n,e)=>{pe.init(n,e),ee(n._zod,"values",()=>{const t=e.innerType._zod.values;return t?new Set([...t].filter(r=>r!==void 0)):void 0}),n._zod.parse=(t,r)=>{const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>Pp(s,n)):Pp(i,n)}});function Pp(n,e){return!n.issues.length&&n.value===void 0&&n.issues.push({code:"invalid_type",expected:"nonoptional",input:n.value,inst:e}),n}const FA=x("$ZodCatch",(n,e)=>{pe.init(n,e),ee(n._zod,"optin",()=>e.innerType._zod.optin),ee(n._zod,"optout",()=>e.innerType._zod.optout),ee(n._zod,"values",()=>e.innerType._zod.values),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(s=>(t.value=s.value,s.issues.length&&(t.value=e.catchValue({...t,error:{issues:s.issues.map(o=>yn(o,r,vn()))},input:t.value}),t.issues=[]),t)):(t.value=i.value,i.issues.length&&(t.value=e.catchValue({...t,error:{issues:i.issues.map(s=>yn(s,r,vn()))},input:t.value}),t.issues=[]),t)}}),ZA=x("$ZodPipe",(n,e)=>{pe.init(n,e),ee(n._zod,"values",()=>e.in._zod.values),ee(n._zod,"optin",()=>e.in._zod.optin),ee(n._zod,"optout",()=>e.out._zod.optout),ee(n._zod,"propValues",()=>e.in._zod.propValues),n._zod.parse=(t,r)=>{if(r.direction==="backward"){const s=e.out._zod.run(t,r);return s instanceof Promise?s.then(o=>Co(o,e.in,r)):Co(s,e.in,r)}const i=e.in._zod.run(t,r);return i instanceof Promise?i.then(s=>Co(s,e.out,r)):Co(i,e.out,r)}});function Co(n,e,t){return n.issues.length?(n.aborted=!0,n):e._zod.run({value:n.value,issues:n.issues},t)}const HA=x("$ZodReadonly",(n,e)=>{pe.init(n,e),ee(n._zod,"propValues",()=>e.innerType._zod.propValues),ee(n._zod,"values",()=>e.innerType._zod.values),ee(n._zod,"optin",()=>{var t,r;return(r=(t=e.innerType)==null?void 0:t._zod)==null?void 0:r.optin}),ee(n._zod,"optout",()=>{var t,r;return(r=(t=e.innerType)==null?void 0:t._zod)==null?void 0:r.optout}),n._zod.parse=(t,r)=>{if(r.direction==="backward")return e.innerType._zod.run(t,r);const i=e.innerType._zod.run(t,r);return i instanceof Promise?i.then(Rp):Rp(i)}});function Rp(n){return n.value=Object.freeze(n.value),n}const BA=x("$ZodCustom",(n,e)=>{Ye.init(n,e),pe.init(n,e),n._zod.parse=(t,r)=>t,n._zod.check=t=>{const r=t.value,i=e.fn(r);if(i instanceof Promise)return i.then(s=>Dp(s,t,r,n));Dp(i,t,r,n)}});function Dp(n,e,t,r){if(!n){const i={code:"custom",input:t,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),e.issues.push(ss(i))}}var Op;class GA{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const r=t[0];return this._map.set(e,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const 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){const t=e._zod.parent;if(t){const r={...this.get(t)??{}};delete r.id;const i={...r,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function VA(){return new GA}(Op=globalThis).__zod_globalRegistry??(Op.__zod_globalRegistry=VA());const Gi=globalThis.__zod_globalRegistry;function WA(n,e){return new n({type:"string",...L(e)})}function jA(n,e){return new n({type:"string",format:"email",check:"string_format",abort:!1,...L(e)})}function Lp(n,e){return new n({type:"string",format:"guid",check:"string_format",abort:!1,...L(e)})}function qA(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,...L(e)})}function YA(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...L(e)})}function XA(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...L(e)})}function KA(n,e){return new n({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...L(e)})}function JA(n,e){return new n({type:"string",format:"url",check:"string_format",abort:!1,...L(e)})}function QA(n,e){return new n({type:"string",format:"emoji",check:"string_format",abort:!1,...L(e)})}function e$(n,e){return new n({type:"string",format:"nanoid",check:"string_format",abort:!1,...L(e)})}function t$(n,e){return new n({type:"string",format:"cuid",check:"string_format",abort:!1,...L(e)})}function n$(n,e){return new n({type:"string",format:"cuid2",check:"string_format",abort:!1,...L(e)})}function r$(n,e){return new n({type:"string",format:"ulid",check:"string_format",abort:!1,...L(e)})}function i$(n,e){return new n({type:"string",format:"xid",check:"string_format",abort:!1,...L(e)})}function s$(n,e){return new n({type:"string",format:"ksuid",check:"string_format",abort:!1,...L(e)})}function o$(n,e){return new n({type:"string",format:"ipv4",check:"string_format",abort:!1,...L(e)})}function a$(n,e){return new n({type:"string",format:"ipv6",check:"string_format",abort:!1,...L(e)})}function l$(n,e){return new n({type:"string",format:"cidrv4",check:"string_format",abort:!1,...L(e)})}function c$(n,e){return new n({type:"string",format:"cidrv6",check:"string_format",abort:!1,...L(e)})}function u$(n,e){return new n({type:"string",format:"base64",check:"string_format",abort:!1,...L(e)})}function h$(n,e){return new n({type:"string",format:"base64url",check:"string_format",abort:!1,...L(e)})}function d$(n,e){return new n({type:"string",format:"e164",check:"string_format",abort:!1,...L(e)})}function p$(n,e){return new n({type:"string",format:"jwt",check:"string_format",abort:!1,...L(e)})}function f$(n,e){return new n({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...L(e)})}function g$(n,e){return new n({type:"string",format:"date",check:"string_format",...L(e)})}function m$(n,e){return new n({type:"string",format:"time",check:"string_format",precision:null,...L(e)})}function v$(n,e){return new n({type:"string",format:"duration",check:"string_format",...L(e)})}function y$(n,e){return new n({type:"number",checks:[],...L(e)})}function b$(n,e){return new n({type:"number",check:"number_format",abort:!1,format:"safeint",...L(e)})}function w$(n,e){return new n({type:"boolean",...L(e)})}function S$(n){return new n({type:"unknown"})}function _$(n,e){return new n({type:"never",...L(e)})}function zp(n,e){return new km({check:"less_than",...L(e),value:n,inclusive:!1})}function ql(n,e){return new km({check:"less_than",...L(e),value:n,inclusive:!0})}function Mp(n,e){return new Em({check:"greater_than",...L(e),value:n,inclusive:!1})}function Yl(n,e){return new Em({check:"greater_than",...L(e),value:n,inclusive:!0})}function Np(n,e){return new M1({check:"multiple_of",...L(e),value:n})}function Im(n,e){return new U1({check:"max_length",...L(e),maximum:n})}function fa(n,e){return new F1({check:"min_length",...L(e),minimum:n})}function Pm(n,e){return new Z1({check:"length_equals",...L(e),length:n})}function k$(n,e){return new H1({check:"string_format",format:"regex",...L(e),pattern:n})}function E$(n){return new B1({check:"string_format",format:"lowercase",...L(n)})}function x$(n){return new G1({check:"string_format",format:"uppercase",...L(n)})}function A$(n,e){return new V1({check:"string_format",format:"includes",...L(e),includes:n})}function $$(n,e){return new W1({check:"string_format",format:"starts_with",...L(e),prefix:n})}function T$(n,e){return new j1({check:"string_format",format:"ends_with",...L(e),suffix:n})}function Ei(n){return new q1({check:"overwrite",tx:n})}function C$(n){return Ei(e=>e.normalize(n))}function I$(){return Ei(n=>n.trim())}function P$(){return Ei(n=>n.toLowerCase())}function R$(){return Ei(n=>n.toUpperCase())}function D$(){return Ei(n=>Hx(n))}function O$(n,e,t){return new n({type:"array",element:e,...L(t)})}function L$(n,e,t){return new n({type:"custom",check:"custom",fn:e,...L(t)})}function z$(n){const e=M$(t=>(t.addIssue=r=>{if(typeof r=="string")t.issues.push(ss(r,t.value,e._zod.def));else{const i=r;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=t.value),i.inst??(i.inst=e),i.continue??(i.continue=!e._zod.def.abort),t.issues.push(ss(i))}},n(t.value,t)));return e}function M$(n,e){const t=new Ye({check:"custom",...L(e)});return t._zod.check=n,t}function Rm(n){let e=(n==null?void 0:n.target)??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:n.processors??{},metadataRegistry:(n==null?void 0:n.metadata)??Gi,target:e,unrepresentable:(n==null?void 0:n.unrepresentable)??"throw",override:(n==null?void 0:n.override)??(()=>{}),io:(n==null?void 0:n.io)??"output",counter:0,seen:new Map,cycles:(n==null?void 0:n.cycles)??"ref",reused:(n==null?void 0:n.reused)??"inline",external:(n==null?void 0:n.external)??void 0}}function ye(n,e,t={path:[],schemaPath:[]}){var h,p;var r;const i=n._zod.def,s=e.seen.get(n);if(s)return s.count++,t.schemaPath.includes(n)&&(s.cycle=t.path),s.schema;const o={schema:{},count:1,cycle:void 0,path:t.path};e.seen.set(n,o);const a=(p=(h=n._zod).toJSONSchema)==null?void 0:p.call(h);if(a)o.schema=a;else{const g={...t,schemaPath:[...t.schemaPath,n],path:t.path};if(n._zod.processJSONSchema)n._zod.processJSONSchema(e,o.schema,g);else{const A=o.schema,k=e.processors[i.type];if(!k)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);k(n,e,A,g)}const m=n._zod.parent;m&&(o.ref||(o.ref=m),ye(m,e,g),e.seen.get(m).isParent=!0)}const l=e.metadataRegistry.get(n);return l&&Object.assign(o.schema,l),e.io==="input"&&ze(n)&&(delete o.schema.examples,delete o.schema.default),e.io==="input"&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,e.seen.get(n).schema}function Dm(n,e){var o,a,l,u;const t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const h of n.seen.entries()){const p=(o=n.metadataRegistry.get(h[0]))==null?void 0:o.id;if(p){const g=r.get(p);if(g&&g!==h[0])throw new Error(`Duplicate schema id "${p}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(p,h[0])}}const i=h=>{var k;const p=n.target==="draft-2020-12"?"$defs":"definitions";if(n.external){const I=(k=n.external.registry.get(h[0]))==null?void 0:k.id,U=n.external.uri??(V=>V);if(I)return{ref:U(I)};const P=h[1].defId??h[1].schema.id??`schema${n.counter++}`;return h[1].defId=P,{defId:P,ref:`${U("__shared")}#/${p}/${P}`}}if(h[1]===t)return{ref:"#"};const m=`#/${p}/`,A=h[1].schema.id??`__schema${n.counter++}`;return{defId:A,ref:m+A}},s=h=>{if(h[1].schema.$ref)return;const p=h[1],{ref:g,defId:m}=i(h);p.def={...p.schema},m&&(p.defId=m);const A=p.schema;for(const k in A)delete A[k];A.$ref=g};if(n.cycles==="throw")for(const h of n.seen.entries()){const p=h[1];if(p.cycle)throw new Error(`Cycle detected: #/${(a=p.cycle)==null?void 0:a.join("/")}/<root>
41
41
 
42
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of n.seen.entries()){const p=h[1];if(e===h[0]){s(h);continue}if(n.external){const m=(l=n.external.registry.get(h[0]))==null?void 0:l.id;if(e!==h[0]&&m){s(h);continue}}if((u=n.metadataRegistry.get(h[0]))==null?void 0:u.id){s(h);continue}if(p.cycle){s(h);continue}if(p.count>1&&n.reused==="ref"){s(h);continue}}}function Fm(n,e){var o,a,l;const t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=u=>{const h=n.seen.get(u);if(h.ref===null)return;const p=h.def??h.schema,g={...p},m=h.ref;if(h.ref=null,m){r(m);const k=n.seen.get(m),I=k.schema;if(I.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(I)):Object.assign(p,I),Object.assign(p,g),u._zod.parent===m)for(const P in p)P==="$ref"||P==="allOf"||P in g||delete p[P];if(I.$ref&&k.def)for(const P in p)P==="$ref"||P==="allOf"||P in k.def&&JSON.stringify(p[P])===JSON.stringify(k.def[P])&&delete p[P]}const A=u._zod.parent;if(A&&A!==m){r(A);const k=n.seen.get(A);if(k!=null&&k.schema.$ref&&(p.$ref=k.schema.$ref,k.def))for(const I in p)I==="$ref"||I==="allOf"||I in k.def&&JSON.stringify(p[I])===JSON.stringify(k.def[I])&&delete p[I]}n.override({zodSchema:u,jsonSchema:p,path:h.path??[]})};for(const u of[...n.seen.entries()].reverse())r(u[0]);const i={};if(n.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":n.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":n.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":n.target,(o=n.external)!=null&&o.uri){const u=(a=n.external.registry.get(e))==null?void 0:a.id;if(!u)throw new Error("Schema is missing an `id` property");i.$id=n.external.uri(u)}Object.assign(i,t.def??t.schema);const s=((l=n.external)==null?void 0:l.defs)??{};for(const u of n.seen.entries()){const h=u[1];h.def&&h.defId&&(s[h.defId]=h.def)}n.external||Object.keys(s).length>0&&(n.target==="draft-2020-12"?i.$defs=s:i.definitions=s);try{const u=JSON.parse(JSON.stringify(i));return Object.defineProperty(u,"~standard",{value:{...e["~standard"],jsonSchema:{input:ga(e,"input",n.processors),output:ga(e,"output",n.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function ze(n,e){const t=e??{seen:new Set};if(t.seen.has(n))return!1;t.seen.add(n);const r=n._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return ze(r.element,t);if(r.type==="set")return ze(r.valueType,t);if(r.type==="lazy")return ze(r.getter(),t);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return ze(r.innerType,t);if(r.type==="intersection")return ze(r.left,t)||ze(r.right,t);if(r.type==="record"||r.type==="map")return ze(r.keyType,t)||ze(r.valueType,t);if(r.type==="pipe")return ze(r.in,t)||ze(r.out,t);if(r.type==="object"){for(const i in r.shape)if(ze(r.shape[i],t))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(ze(i,t))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(ze(i,t))return!0;return!!(r.rest&&ze(r.rest,t))}return!1}const B$=(n,e={})=>t=>{const r=Nm({...t,processors:e});return ye(n,r),Um(r,n),Fm(r,n)},ga=(n,e,t={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=Nm({...i??{},target:s,io:e,processors:t});return ye(n,o),Um(o,n),Fm(o,n)},G$={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},V$=(n,e,t,r)=>{const i=t;i.type="string";const{minimum:s,maximum:o,format:a,patterns:l,contentEncoding:u}=n._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof o=="number"&&(i.maxLength=o),a&&(i.format=G$[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),u&&(i.contentEncoding=u),l&&l.size>0){const h=[...l];h.length===1?i.pattern=h[0].source:h.length>1&&(i.allOf=[...h.map(p=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},W$=(n,e,t,r)=>{const i=t,{minimum:s,maximum:o,format:a,multipleOf:l,exclusiveMaximum:u,exclusiveMinimum:h}=n._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number",typeof h=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.minimum=h,i.exclusiveMinimum=!0):i.exclusiveMinimum=h),typeof s=="number"&&(i.minimum=s,typeof h=="number"&&e.target!=="draft-04"&&(h>=s?delete i.minimum:delete i.exclusiveMinimum)),typeof u=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u),typeof o=="number"&&(i.maximum=o,typeof u=="number"&&e.target!=="draft-04"&&(u<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof l=="number"&&(i.multipleOf=l)},j$=(n,e,t,r)=>{t.type="boolean"},q$=(n,e,t,r)=>{t.not={}},Y$=(n,e,t,r)=>{},X$=(n,e,t,r)=>{const i=n._zod.def,s=ym(i.entries);s.every(o=>typeof o=="number")&&(t.type="number"),s.every(o=>typeof o=="string")&&(t.type="string"),t.enum=s},K$=(n,e,t,r)=>{const i=n._zod.def,s=[];for(const o of i.values)if(o===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(o))}else s.push(o);if(s.length!==0)if(s.length===1){const o=s[0];t.type=o===null?"null":typeof o,e.target==="draft-04"||e.target==="openapi-3.0"?t.enum=[o]:t.const=o}else s.every(o=>typeof o=="number")&&(t.type="number"),s.every(o=>typeof o=="string")&&(t.type="string"),s.every(o=>typeof o=="boolean")&&(t.type="boolean"),s.every(o=>o===null)&&(t.type="null"),t.enum=s},J$=(n,e,t,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Q$=(n,e,t,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},eT=(n,e,t,r)=>{const i=t,s=n._zod.def,{minimum:o,maximum:a}=n._zod.bag;typeof o=="number"&&(i.minItems=o),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=ye(s.element,e,{...r,path:[...r.path,"items"]})},tT=(n,e,t,r)=>{var u;const i=t,s=n._zod.def;i.type="object",i.properties={};const o=s.shape;for(const h in o)i.properties[h]=ye(o[h],e,{...r,path:[...r.path,"properties",h]});const a=new Set(Object.keys(o)),l=new Set([...a].filter(h=>{const p=s.shape[h]._zod;return e.io==="input"?p.optin===void 0:p.optout===void 0}));l.size>0&&(i.required=Array.from(l)),((u=s.catchall)==null?void 0:u._zod.def.type)==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=ye(s.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},nT=(n,e,t,r)=>{const i=n._zod.def,s=i.inclusive===!1,o=i.options.map((a,l)=>ye(a,e,{...r,path:[...r.path,s?"oneOf":"anyOf",l]}));s?t.oneOf=o:t.anyOf=o},rT=(n,e,t,r)=>{const i=n._zod.def,s=ye(i.left,e,{...r,path:[...r.path,"allOf",0]}),o=ye(i.right,e,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,l=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];t.allOf=l},iT=(n,e,t,r)=>{const i=t,s=n._zod.def;i.type="object";const o=s.keyType,a=o._zod.bag,l=a==null?void 0:a.patterns;if(s.mode==="loose"&&l&&l.size>0){const h=ye(s.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const p of l)i.patternProperties[p.source]=h}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=ye(s.keyType,e,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=ye(s.valueType,e,{...r,path:[...r.path,"additionalProperties"]});const u=o._zod.values;if(u){const h=[...u].filter(p=>typeof p=="string"||typeof p=="number");h.length>0&&(i.required=h)}},sT=(n,e,t,r)=>{const i=n._zod.def,s=ye(i.innerType,e,r),o=e.seen.get(n);e.target==="openapi-3.0"?(o.ref=i.innerType,t.nullable=!0):t.anyOf=[s,{type:"null"}]},oT=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType},aT=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,t.default=JSON.parse(JSON.stringify(i.defaultValue))},lT=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,e.io==="input"&&(t._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},cT=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=o},uT=(n,e,t,r)=>{const i=n._zod.def,s=e.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;ye(s,e,r);const o=e.seen.get(n);o.ref=s},hT=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,t.readOnly=!0},Zm=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType},dT=x("ZodISODateTime",(n,e)=>{pA.init(n,e),ge.init(n,e)});function pT(n){return b$(dT,n)}const fT=x("ZodISODate",(n,e)=>{fA.init(n,e),ge.init(n,e)});function gT(n){return w$(fT,n)}const mT=x("ZodISOTime",(n,e)=>{gA.init(n,e),ge.init(n,e)});function vT(n){return S$(mT,n)}const yT=x("ZodISODuration",(n,e)=>{mA.init(n,e),ge.init(n,e)});function bT(n){return _$(yT,n)}const Hm=(n,e)=>{_m.init(n,e),n.name="ZodError",Object.defineProperties(n,{format:{value:t=>o1(n,t)},flatten:{value:t=>s1(n,t)},addIssue:{value:t=>{n.issues.push(t),n.message=JSON.stringify(n.issues,Dc,2)}},addIssues:{value:t=>{n.issues.push(...t),n.message=JSON.stringify(n.issues,Dc,2)}},isEmpty:{get(){return n.issues.length===0}}})},Vp=x("ZodError",Hm),ct=x("ZodError",Hm,{Parent:Error}),wT=th(ct),ST=nh(ct),_T=Ka(ct),kT=Ja(ct),ET=c1(ct),xT=u1(ct),AT=h1(ct),$T=d1(ct),TT=p1(ct),CT=f1(ct),IT=g1(ct),PT=m1(ct),fe=x("ZodType",(n,e)=>(pe.init(n,e),Object.assign(n["~standard"],{jsonSchema:{input:ga(n,"input"),output:ga(n,"output")}}),n.toJSONSchema=B$(n,{}),n.def=e,n.type=e.type,Object.defineProperty(n,"_def",{value:e}),n.check=(...t)=>n.clone(En(e,{checks:[...e.checks??[],...t.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),n.with=n.check,n.clone=(t,r)=>xn(n,t,r),n.brand=()=>n,n.register=(t,r)=>(t.add(n,r),n),n.parse=(t,r)=>wT(n,t,r,{callee:n.parse}),n.safeParse=(t,r)=>_T(n,t,r),n.parseAsync=async(t,r)=>ST(n,t,r,{callee:n.parseAsync}),n.safeParseAsync=async(t,r)=>kT(n,t,r),n.spa=n.safeParseAsync,n.encode=(t,r)=>ET(n,t,r),n.decode=(t,r)=>xT(n,t,r),n.encodeAsync=async(t,r)=>AT(n,t,r),n.decodeAsync=async(t,r)=>$T(n,t,r),n.safeEncode=(t,r)=>TT(n,t,r),n.safeDecode=(t,r)=>CT(n,t,r),n.safeEncodeAsync=async(t,r)=>IT(n,t,r),n.safeDecodeAsync=async(t,r)=>PT(n,t,r),n.refine=(t,r)=>n.check(_C(t,r)),n.superRefine=t=>n.check(kC(t)),n.overwrite=t=>n.check(Ei(t)),n.optional=()=>qp(n),n.exactOptional=()=>cC(n),n.nullable=()=>Yp(n),n.nullish=()=>qp(Yp(n)),n.nonoptional=t=>gC(n,t),n.array=()=>D(n),n.or=t=>B([n,t]),n.and=t=>el(n,t),n.transform=t=>Xp(n,aC(t)),n.default=t=>dC(n,t),n.prefault=t=>fC(n,t),n.catch=t=>vC(n,t),n.pipe=t=>Xp(n,t),n.readonly=()=>wC(n),n.describe=t=>{const r=n.clone();return Gi.add(r,{description:t}),r},Object.defineProperty(n,"description",{get(){var t;return(t=Gi.get(n))==null?void 0:t.description},configurable:!0}),n.meta=(...t)=>{if(t.length===0)return Gi.get(n);const r=n.clone();return Gi.add(r,t[0]),r},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=t=>t(n),n)),Bm=x("_ZodString",(n,e)=>{rh.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(r,i,s)=>V$(n,r,i);const t=n._zod.bag;n.format=t.format??null,n.minLength=t.minimum??null,n.maxLength=t.maximum??null,n.regex=(...r)=>n.check(T$(...r)),n.includes=(...r)=>n.check(P$(...r)),n.startsWith=(...r)=>n.check(R$(...r)),n.endsWith=(...r)=>n.check(D$(...r)),n.min=(...r)=>n.check(fa(...r)),n.max=(...r)=>n.check(zm(...r)),n.length=(...r)=>n.check(Mm(...r)),n.nonempty=(...r)=>n.check(fa(1,...r)),n.lowercase=r=>n.check(C$(r)),n.uppercase=r=>n.check(I$(r)),n.trim=()=>n.check(L$()),n.normalize=(...r)=>n.check(O$(...r)),n.toLowerCase=()=>n.check(z$()),n.toUpperCase=()=>n.check(M$()),n.slugify=()=>n.check(N$())}),RT=x("ZodString",(n,e)=>{rh.init(n,e),Bm.init(n,e),n.email=t=>n.check(JA(DT,t)),n.url=t=>n.check(r$(OT,t)),n.jwt=t=>n.check(y$(YT,t)),n.emoji=t=>n.check(i$(LT,t)),n.guid=t=>n.check(Zp(Wp,t)),n.uuid=t=>n.check(QA(Io,t)),n.uuidv4=t=>n.check(e$(Io,t)),n.uuidv6=t=>n.check(t$(Io,t)),n.uuidv7=t=>n.check(n$(Io,t)),n.nanoid=t=>n.check(s$(zT,t)),n.guid=t=>n.check(Zp(Wp,t)),n.cuid=t=>n.check(o$(MT,t)),n.cuid2=t=>n.check(a$(NT,t)),n.ulid=t=>n.check(l$(UT,t)),n.base64=t=>n.check(g$(WT,t)),n.base64url=t=>n.check(m$(jT,t)),n.xid=t=>n.check(c$(FT,t)),n.ksuid=t=>n.check(u$(ZT,t)),n.ipv4=t=>n.check(h$(HT,t)),n.ipv6=t=>n.check(d$(BT,t)),n.cidrv4=t=>n.check(p$(GT,t)),n.cidrv6=t=>n.check(f$(VT,t)),n.e164=t=>n.check(v$(qT,t)),n.datetime=t=>n.check(pT(t)),n.date=t=>n.check(gT(t)),n.time=t=>n.check(vT(t)),n.duration=t=>n.check(bT(t))});function d(n){return KA(RT,n)}const ge=x("ZodStringFormat",(n,e)=>{le.init(n,e),Bm.init(n,e)}),DT=x("ZodEmail",(n,e)=>{iA.init(n,e),ge.init(n,e)}),Wp=x("ZodGUID",(n,e)=>{nA.init(n,e),ge.init(n,e)}),Io=x("ZodUUID",(n,e)=>{rA.init(n,e),ge.init(n,e)}),OT=x("ZodURL",(n,e)=>{sA.init(n,e),ge.init(n,e)}),LT=x("ZodEmoji",(n,e)=>{oA.init(n,e),ge.init(n,e)}),zT=x("ZodNanoID",(n,e)=>{aA.init(n,e),ge.init(n,e)}),MT=x("ZodCUID",(n,e)=>{lA.init(n,e),ge.init(n,e)}),NT=x("ZodCUID2",(n,e)=>{cA.init(n,e),ge.init(n,e)}),UT=x("ZodULID",(n,e)=>{uA.init(n,e),ge.init(n,e)}),FT=x("ZodXID",(n,e)=>{hA.init(n,e),ge.init(n,e)}),ZT=x("ZodKSUID",(n,e)=>{dA.init(n,e),ge.init(n,e)}),HT=x("ZodIPv4",(n,e)=>{vA.init(n,e),ge.init(n,e)}),BT=x("ZodIPv6",(n,e)=>{yA.init(n,e),ge.init(n,e)}),GT=x("ZodCIDRv4",(n,e)=>{bA.init(n,e),ge.init(n,e)}),VT=x("ZodCIDRv6",(n,e)=>{wA.init(n,e),ge.init(n,e)}),WT=x("ZodBase64",(n,e)=>{SA.init(n,e),ge.init(n,e)}),jT=x("ZodBase64URL",(n,e)=>{kA.init(n,e),ge.init(n,e)}),qT=x("ZodE164",(n,e)=>{EA.init(n,e),ge.init(n,e)}),YT=x("ZodJWT",(n,e)=>{AA.init(n,e),ge.init(n,e)}),Gm=x("ZodNumber",(n,e)=>{Rm.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(r,i,s)=>W$(n,r,i),n.gt=(r,i)=>n.check(Bp(r,i)),n.gte=(r,i)=>n.check(Jl(r,i)),n.min=(r,i)=>n.check(Jl(r,i)),n.lt=(r,i)=>n.check(Hp(r,i)),n.lte=(r,i)=>n.check(Kl(r,i)),n.max=(r,i)=>n.check(Kl(r,i)),n.int=r=>n.check(jp(r)),n.safe=r=>n.check(jp(r)),n.positive=r=>n.check(Bp(0,r)),n.nonnegative=r=>n.check(Jl(0,r)),n.negative=r=>n.check(Hp(0,r)),n.nonpositive=r=>n.check(Kl(0,r)),n.multipleOf=(r,i)=>n.check(Gp(r,i)),n.step=(r,i)=>n.check(Gp(r,i)),n.finite=()=>n;const t=n._zod.bag;n.minValue=Math.max(t.minimum??Number.NEGATIVE_INFINITY,t.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,n.maxValue=Math.min(t.maximum??Number.POSITIVE_INFINITY,t.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,n.isInt=(t.format??"").includes("int")||Number.isSafeInteger(t.multipleOf??.5),n.isFinite=!0,n.format=t.format??null});function Z(n){return k$(Gm,n)}const XT=x("ZodNumberFormat",(n,e)=>{$A.init(n,e),Gm.init(n,e)});function jp(n){return E$(XT,n)}const KT=x("ZodBoolean",(n,e)=>{TA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>j$(n,t,r)});function Ee(n){return x$(KT,n)}const JT=x("ZodUnknown",(n,e)=>{CA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Y$()});function S(){return A$(JT)}const QT=x("ZodNever",(n,e)=>{IA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>q$(n,t,r)});function eC(n){return $$(QT,n)}const tC=x("ZodArray",(n,e)=>{PA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>eT(n,t,r,i),n.element=e.element,n.min=(t,r)=>n.check(fa(t,r)),n.nonempty=t=>n.check(fa(1,t)),n.max=(t,r)=>n.check(zm(t,r)),n.length=(t,r)=>n.check(Mm(t,r)),n.unwrap=()=>n.element});function D(n,e){return U$(tC,n,e)}const Vm=x("ZodObject",(n,e)=>{DA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>tT(n,t,r,i),ee(n,"shape",()=>e.shape),n.keyof=()=>ma(Object.keys(n._zod.def.shape)),n.catchall=t=>n.clone({...n._zod.def,catchall:t}),n.passthrough=()=>n.clone({...n._zod.def,catchall:S()}),n.loose=()=>n.clone({...n._zod.def,catchall:S()}),n.strict=()=>n.clone({...n._zod.def,catchall:eC()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=t=>e1(n,t),n.safeExtend=t=>t1(n,t),n.merge=t=>n1(n,t),n.pick=t=>Jx(n,t),n.omit=t=>Qx(n,t),n.partial=(...t)=>r1(jm,n,t[0]),n.required=(...t)=>i1(qm,n,t[0])});function Wm(n,e){const t={type:"object",shape:n??{},...L(e)};return new Vm(t)}function f(n,e){return new Vm({type:"object",shape:n,catchall:S(),...L(e)})}const nC=x("ZodUnion",(n,e)=>{OA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>nT(n,t,r,i),n.options=e.options});function B(n,e){return new nC({type:"union",options:n,...L(e)})}const rC=x("ZodIntersection",(n,e)=>{LA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>rT(n,t,r,i)});function el(n,e){return new rC({type:"intersection",left:n,right:e})}const iC=x("ZodRecord",(n,e)=>{zA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>iT(n,t,r,i),n.keyType=e.keyType,n.valueType=e.valueType});function _(n,e,t){return new iC({type:"record",keyType:n,valueType:e,...L(t)})}const Lc=x("ZodEnum",(n,e)=>{MA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(r,i,s)=>X$(n,r,i),n.enum=e.entries,n.options=Object.values(e.entries);const t=new Set(Object.keys(e.entries));n.extract=(r,i)=>{const s={};for(const o of r)if(t.has(o))s[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new Lc({...e,checks:[],...L(i),entries:s})},n.exclude=(r,i)=>{const s={...e.entries};for(const o of r)if(t.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new Lc({...e,checks:[],...L(i),entries:s})}});function ma(n,e){const t=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new Lc({type:"enum",entries:t,...L(e)})}const sC=x("ZodLiteral",(n,e)=>{NA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>K$(n,t,r),n.values=new Set(e.values),Object.defineProperty(n,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function $(n,e){return new sC({type:"literal",values:Array.isArray(n)?n:[n],...L(e)})}const oC=x("ZodTransform",(n,e)=>{UA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Q$(n,t),n._zod.parse=(t,r)=>{if(r.direction==="backward")throw new mm(n.constructor.name);t.addIssue=s=>{if(typeof s=="string")t.issues.push(ss(s,t.value,e));else{const o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=t.value),o.inst??(o.inst=n),t.issues.push(ss(o))}};const i=e.transform(t.value,t);return i instanceof Promise?i.then(s=>(t.value=s,t)):(t.value=i,t)}});function aC(n){return new oC({type:"transform",transform:n})}const jm=x("ZodOptional",(n,e)=>{Lm.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Zm(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function qp(n){return new jm({type:"optional",innerType:n})}const lC=x("ZodExactOptional",(n,e)=>{FA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Zm(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function cC(n){return new lC({type:"optional",innerType:n})}const uC=x("ZodNullable",(n,e)=>{ZA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>sT(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function Yp(n){return new uC({type:"nullable",innerType:n})}const hC=x("ZodDefault",(n,e)=>{HA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>aT(n,t,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function dC(n,e){return new hC({type:"default",innerType:n,get defaultValue(){return typeof e=="function"?e():wm(e)}})}const pC=x("ZodPrefault",(n,e)=>{BA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>lT(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function fC(n,e){return new pC({type:"prefault",innerType:n,get defaultValue(){return typeof e=="function"?e():wm(e)}})}const qm=x("ZodNonOptional",(n,e)=>{GA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>oT(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function gC(n,e){return new qm({type:"nonoptional",innerType:n,...L(e)})}const mC=x("ZodCatch",(n,e)=>{VA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>cT(n,t,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function vC(n,e){return new mC({type:"catch",innerType:n,catchValue:typeof e=="function"?e:()=>e})}const yC=x("ZodPipe",(n,e)=>{WA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>uT(n,t,r,i),n.in=e.in,n.out=e.out});function Xp(n,e){return new yC({type:"pipe",in:n,out:e})}const bC=x("ZodReadonly",(n,e)=>{jA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>hT(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function wC(n){return new bC({type:"readonly",innerType:n})}const SC=x("ZodCustom",(n,e)=>{qA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>J$(n,t)});function _C(n,e={}){return F$(SC,n,e)}function kC(n){return Z$(n)}const EC=["text/markdown","text/html"],xC=["committed","pending"];Wm({id:d().min(1),type:ma(EC),title:d(),status:ma(xC),externalFilePath:d().optional()});Wm({name:d().min(1),description:d(),accepts:D(d().min(1)).min(1)});function oo(n){return typeof n=="object"&&n!==null}function AC(n){return!oo(n)||n.type!=="ready"?!1:!("id"in n)}function $C(n){return!(!oo(n)||n.type!=="update-content"||typeof n.id!="string"||typeof n.content!="string")}function TC(n){return!oo(n)||n.type!=="wheel"||typeof n.deltaX!="number"||typeof n.deltaY!="number"||typeof n.shiftKey!="boolean"?!1:!("id"in n)}function CC(n){return!oo(n)||n.type!=="swipe-move"||typeof n.deltaX!="number"?!1:!("id"in n)}function IC(n){return!oo(n)||n.type!=="swipe-end"||typeof n.velocityX!="number"?!1:!("id"in n)}function PC(n,e){if(n===e)return 2;if(n==="*/*")return 0;const t=n.indexOf("/");if(t>0&&n.slice(t+1)==="*"){const r=n.slice(0,t),i=e.indexOf("/");if(i>0&&e.slice(0,i)===r)return 1}return null}function RC(n,e){let t=null;for(const r of n.accepts){const i=PC(r,e);i!==null&&(t===null||i>t)&&(t=i)}return t}function DC(n,e){let t=-1,r=null;for(const i of e){const s=RC(i,n);s!==null&&(s>t||s===t&&r!==null&&i.id<r.id)&&(t=s,r=i)}return r}const OC=4401;class zc extends Error{constructor(e="Authentication required"){super(e),this.name="AuthError"}}class Mc extends bt{constructor(t){super();b(this,"url");b(this,"name");b(this,"token");b(this,"status","disconnected");b(this,"screens",new Map);b(this,"views",[]);b(this,"client");b(this,"createSocket");b(this,"createClient");b(this,"socket",null);b(this,"connectAttempt",0);this.url=$t(t.url),this.name=t.name,this.token=t.token??null,this.createSocket=t.createSocket??(r=>new WebSocket(r)),this.createClient=t.createClient??((r,i)=>new Lx(r,{token:i??void 0})),this.client=this.createClient(this.url,this.token)}async connect(){var i;this.connectAttempt+=1;const t=this.connectAttempt;(i=this.socket)==null||i.close(),this.client=this.createClient(this.url,this.token),this.status="connecting",this.dispatchEvent(new K("change"));const r=this.createSocket(LC(this.url,this.token));return this.socket=r,await new Promise((s,o)=>{let a=!1;const l=()=>{a||this.connectAttempt!==t||(a=!0,this.status="connected",this.dispatchEvent(new K("change")),s())},u=p=>{a||this.connectAttempt!==t||(a=!0,this.status="disconnected",this.dispatchEvent(new K("change")),o(p))},h=async()=>{try{const[{screens:p},g]=await Promise.all([this.client.screens.list(),this.client.views.list()]);this.screens=new Map(p.map(m=>[m.id,structuredClone(m)])),this.views=g,this.dispatchEvent(new K("change")),l()}catch(p){u(p instanceof Error?p:new Error(String(p)))}};r.addEventListener("open",()=>{h()}),r.addEventListener("message",p=>{const g=MC(p);g&&(this.applyServerEvent(g),this.dispatchEvent(new lm("server-event",{serverURL:this.url,event:g})))}),r.addEventListener("close",p=>{if(this.connectAttempt===t){if(this.socket=null,zC(p)===OC){u(new zc);return}if(!a){u(new Error("Connection closed before initialization"));return}this.status="disconnected",this.dispatchEvent(new K("change"))}}),r.addEventListener("error",()=>{u(new Error("WebSocket connection failed"))})})}disconnect(){var t;this.connectAttempt+=1,(t=this.socket)==null||t.close(),this.socket=null,this.status="disconnected",this.dispatchEvent(new K("change"))}getViewURL(t){const r=DC(t.type,this.views);if(!r)return null;const i=`${this.url}/views/${encodeURIComponent(r.id)}/`;return this.token===null?i:`${i}?token=${encodeURIComponent(this.token)}`}getContentURL(t){const r=`${this.url}/artifacts/${encodeURIComponent(t)}/content`;return this.token===null?r:`${r}?token=${encodeURIComponent(this.token)}`}async createScreen(t){const{screen:r}=await this.client.screens.create({name:t});return this.screens.set(r.id,structuredClone(r)),r}applyServerEvent(t){switch(t.type){case"screen-created":this.screens.set(t.screen.id,structuredClone(t.screen)),this.dispatchEvent(new qo("screens-changed"));break;case"screen-updated":this.screens.set(t.screen.id,structuredClone(t.screen)),this.dispatchEvent(new qo("screens-changed"));break;case"screen-removed":this.screens.delete(t.screenID),this.dispatchEvent(new qo("screens-changed"));break;case"artifact-created":break;case"artifact-attached":{const r=this.screens.get(t.screenID);r&&!sm(r.layout,t.artifact.id)&&(r.layout=[...r.layout,im(t.artifact.id,{id:t.cardID})]);break}case"artifact-removed":{const r=this.screens.get(t.screenID);r&&(r.layout=Yg(r.layout,t.artifactID));break}}}}function LC(n,e){const t=new URL(n);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.pathname="/events",t.search="",e&&t.searchParams.set("token",e),t.hash="",t.toString()}function zC(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="number"?n.code:null}function MC(n){const e=typeof n=="string"?n:typeof n=="object"&&n!==null&&"data"in n&&typeof n.data=="string"?n.data:"";if(!e)return null;try{return JSON.parse(e)}catch{return null}}class NC extends bt{constructor(t){super();b(this,"servers",new Map);b(this,"localServerURL");b(this,"localStore");b(this,"createSocket");b(this,"lastActiveServerURL");b(this,"serverListeners",new Map);b(this,"handleLocalStoreChange",()=>{const t=this.localStore.get().activeServerURL;t!==this.lastActiveServerURL&&(this.lastActiveServerURL=t,this.dispatchEvent(new K("change")))});this.localStore=t.localStore,this.localServerURL=t.localServerURL?$t(t.localServerURL):null,this.createSocket=t.createSocket??(r=>new WebSocket(r)),this.lastActiveServerURL=this.localStore.get().activeServerURL,this.localStore.addEventListener("change",this.handleLocalStoreChange)}get activeServer(){const t=this.localStore.get().activeServerURL;return t===null?null:this.servers.get(t)??null}add(t){const r=$t(t.url);this.servers.get(r)&&this.remove(r),this.servers.set(r,t);const s=()=>{this.dispatchEvent(new K("change"))},o=l=>{this.dispatchEvent(new lm("server-event",{serverURL:l.serverURL,event:l.event}))},a=()=>{this.dispatchEvent(new qo("screens-changed"))};t.addEventListener("change",s),t.addEventListener("server-event",o),t.addEventListener("screens-changed",a),this.serverListeners.set(r,{onServerChange:s,onServerEvent:o,onScreensChanged:a}),this.dispatchEvent(new K("change"))}remove(t){const r=$t(t);if(this.localServerURL&&r===this.localServerURL)return;const i=this.servers.get(r);if(!i)return;const s=this.serverListeners.get(r);s&&(i.removeEventListener("change",s.onServerChange),i.removeEventListener("server-event",s.onServerEvent),i.removeEventListener("screens-changed",s.onScreensChanged),this.serverListeners.delete(r)),i.disconnect(),this.servers.delete(r);const o=this.localStore.get(),a=o.activeServerURL===r;this.localStore.set({...o,servers:o.servers.filter(l=>l.url!==r),activeServerURL:a?null:o.activeServerURL}),this.dispatchEvent(new K("change"))}setActive(t){const r=this.localStore.get(),i=t?$t(t.url):null;r.activeServerURL!==i&&this.localStore.set({...r,activeServerURL:i})}connectConfiguredServers(t,r){const i=this.localStore.get().servers,s=t?$t(t):null;for(const a of i){const l=$t(a.url),u=s!==null&&l===s,h=new Mc({url:a.url,name:a.name,token:u?r??null:null,createSocket:this.createSocket});this.add(h),h.connect().catch(()=>{})}const o=s?this.servers.get(s)??null:null;this.setActive(o??this.servers.values().next().value??null)}addServer(t,r){const i=$t(t);this.remove(i);const s=this.localStore.get();this.localStore.set({...s,servers:[...s.servers.filter(a=>$t(a.url)!==i),{url:i,name:r}]});const o=new Mc({url:i,name:r,createSocket:this.createSocket});this.add(o),this.setActive(o),o.connect().catch(()=>{})}removeServer(t){this.remove(t)}}const ae={authenticate:"authenticate",document_did_change:"document/didChange",document_did_close:"document/didClose",document_did_focus:"document/didFocus",document_did_open:"document/didOpen",document_did_save:"document/didSave",initialize:"initialize",logout:"logout",nes_accept:"nes/accept",nes_close:"nes/close",nes_reject:"nes/reject",nes_start:"nes/start",nes_suggest:"nes/suggest",session_cancel:"session/cancel",session_close:"session/close",session_fork:"session/fork",session_list:"session/list",session_load:"session/load",session_new:"session/new",session_prompt:"session/prompt",session_resume:"session/resume",session_set_config_option:"session/set_config_option",session_set_mode:"session/set_mode",session_set_model:"session/set_model"},Ft={fs_read_text_file:"fs/read_text_file",fs_write_text_file:"fs/write_text_file",session_request_permission:"session/request_permission",session_update:"session/update",terminal_create:"terminal/create",terminal_kill:"terminal/kill",terminal_output:"terminal/output",terminal_release:"terminal/release",terminal_wait_for_exit:"terminal/wait_for_exit"},UC=1,FC=f({_meta:_(d(),S()).nullish(),terminal:Ee().optional().default(!1)}),ZC=f({_meta:_(d(),S()).nullish(),label:d().nullish(),name:d(),optional:Ee().optional().default(!1),secret:Ee().optional().default(!0)}),HC=f({_meta:_(d(),S()).nullish(),description:d().nullish(),id:d(),name:d()}),BC=f({_meta:_(d(),S()).nullish(),description:d().nullish(),id:d(),link:d().nullish(),name:d(),vars:D(ZC)}),GC=f({_meta:_(d(),S()).nullish(),args:D(d()).optional(),description:d().nullish(),env:_(d(),d()).optional(),id:d(),name:d()}),VC=B([BC.and(f({type:$("env_var")})),GC.and(f({type:$("terminal")})),HC]),WC=f({_meta:_(d(),S()).nullish(),methodId:d()}),jC=f({_meta:_(d(),S()).nullish()}),qC=f({_meta:_(d(),S()).nullish(),blob:d(),mimeType:d().nullish(),uri:d()}),YC=f({default:Ee().nullish(),description:d().nullish(),title:d().nullish()}),XC=f({_meta:_(d(),S()).nullish()}),KC=f({_meta:_(d(),S()).nullish()}),JC=f({amount:Z(),currency:d()}),QC=f({_meta:_(d(),S()).nullish(),terminalId:d()}),eI=f({_meta:_(d(),S()).nullish(),newText:d(),oldText:d().nullish(),path:d()}),tI=B([d(),Z(),Z(),Ee(),D(d())]),nI=f({content:_(d(),tI).nullish()}),rI=B([nI.and(f({action:$("accept")})),f({action:$("decline")}),f({action:$("cancel")})]),iI=f({_meta:_(d(),S()).nullish()}),Ym=d(),sI=f({_meta:_(d(),S()).nullish(),elicitationId:Ym}),oI=f({_meta:_(d(),S()).nullish(),action:rI}),aI=$("object"),lI=$("string"),cI=f({_meta:_(d(),S()).nullish()}),uI=f({_meta:_(d(),S()).nullish(),form:iI.nullish(),url:cI.nullish()}),hI=f({elicitationId:Ym,url:d().url()}),Xm=f({const:d(),title:d()}),Km=f({_meta:_(d(),S()).nullish(),name:d(),value:d()}),dI=B([$(-32700),$(-32600),$(-32601),$(-32602),$(-32603),$(-32800),$(-32e3),$(-32002),$(-32042),Z().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),Jm=f({code:dI,data:S().optional(),message:d()}),Qm=S(),ev=S(),tv=S(),pI=f({_meta:_(d(),S()).nullish(),readTextFile:Ee().optional().default(!1),writeTextFile:Ee().optional().default(!1)}),nv=f({_meta:_(d(),S()).nullish(),name:d(),value:d()}),rv=f({_meta:_(d(),S()).nullish(),name:d(),title:d().nullish(),version:d()}),fI=f({default:Z().nullish(),description:d().nullish(),maximum:Z().nullish(),minimum:Z().nullish(),title:d().nullish()}),gI=f({_meta:_(d(),S()).nullish()}),mI=f({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cursor:d().nullish(),cwd:d().nullish()}),vI=f({_meta:_(d(),S()).nullish()}),yI=f({_meta:_(d(),S()).nullish(),logout:vI.nullish()}),bI=f({_meta:_(d(),S()).nullish()}),wI=f({_meta:_(d(),S()).nullish()}),SI=f({_meta:_(d(),S()).nullish(),http:Ee().optional().default(!1),sse:Ee().optional().default(!1)}),_I=f({_meta:_(d(),S()).nullish(),headers:D(nv),name:d(),url:d()}),kI=f({_meta:_(d(),S()).nullish(),headers:D(nv),name:d(),url:d()}),EI=f({_meta:_(d(),S()).nullish(),args:D(d()),command:d(),env:D(Km),name:d()}),tl=B([_I.and(f({type:$("http")})),kI.and(f({type:$("sse")})),EI]),ih=d(),xI=f({_meta:_(d(),S()).nullish(),description:d().nullish(),modelId:ih,name:d()}),AI=B([$("error"),$("warning"),$("information"),$("hint")]),$I=f({_meta:_(d(),S()).nullish()}),TI=f({_meta:_(d(),S()).nullish()}),CI=f({_meta:_(d(),S()).nullish()}),II=f({_meta:_(d(),S()).nullish()}),PI=f({_meta:_(d(),S()).nullish()}),RI=f({_meta:_(d(),S()).nullish(),maxCount:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),DI=f({diff:d(),uri:d()}),OI=f({endLine:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),startLine:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),text:d()}),LI=f({_meta:_(d(),S()).nullish()}),zI=f({_meta:_(d(),S()).nullish()}),MI=f({languageId:d(),text:d(),uri:d()}),NI=f({_meta:_(d(),S()).nullish(),maxCount:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),UI=B([$("rejected"),$("ignored"),$("replaced"),$("cancelled")]),FI=f({excerpts:D(OI),uri:d()}),ZI=f({_meta:_(d(),S()).nullish()}),HI=f({_meta:_(d(),S()).nullish()}),BI=f({name:d(),owner:d(),remoteUrl:d()}),GI=f({_meta:_(d(),S()).nullish()}),VI=f({_meta:_(d(),S()).nullish(),jump:LI.nullish(),rename:HI.nullish(),searchAndReplace:GI.nullish()}),WI=f({id:d(),isRegex:Ee().nullish(),replace:d(),search:d(),uri:d()}),jI=B([$("automatic"),$("diagnostic"),$("manual")]),qI=f({_meta:_(d(),S()).nullish(),maxCount:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),YI=f({_meta:_(d(),S()).nullish(),diagnostics:$I.nullish(),editHistory:RI.nullish(),openFiles:zI.nullish(),recentFiles:NI.nullish(),relatedSnippets:ZI.nullish(),userActions:qI.nullish()}),XI=f({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(tl)}),KI=f({default:Z().nullish(),description:d().nullish(),maximum:Z().nullish(),minimum:Z().nullish(),title:d().nullish()}),iv=d(),JI=B([$("allow_once"),$("allow_always"),$("reject_once"),$("reject_always")]),QI=f({_meta:_(d(),S()).nullish(),kind:JI,name:d(),optionId:iv}),eP=B([$("high"),$("medium"),$("low")]),tP=B([$("pending"),$("in_progress"),$("completed")]),nP=f({_meta:_(d(),S()).nullish(),content:d(),priority:eP,status:tP}),rP=f({_meta:_(d(),S()).nullish(),entries:D(nP)}),bn=f({character:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),line:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"})}),iP=f({id:d(),position:bn,uri:d()}),sP=f({id:d(),newName:d(),position:bn,uri:d()}),oP=f({action:d(),position:bn,timestampMs:Z(),uri:d()}),sv=B([$("utf-16"),$("utf-32"),$("utf-8")]),aP=f({_meta:_(d(),S()).nullish(),auth:FC.optional().default({terminal:!1}),elicitation:uI.nullish(),fs:pI.optional().default({readTextFile:!1,writeTextFile:!1}),nes:VI.nullish(),positionEncodings:D(sv).optional(),terminal:Ee().optional().default(!1)}),lP=f({_meta:_(d(),S()).nullish(),audio:Ee().optional().default(!1),embeddedContext:Ee().optional().default(!1),image:Ee().optional().default(!1)}),ov=Z().int().gte(0).lte(65535),cP=f({_meta:_(d(),S()).nullish(),clientCapabilities:aP.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:rv.nullish(),protocolVersion:ov}),xi=f({end:bn,start:bn}),uP=f({message:d(),range:xi,severity:AI,uri:d()}),hP=f({languageId:d(),lastFocusedMs:Z().nullish(),uri:d(),visibleRange:xi.nullish()}),dP=f({_meta:_(d(),S()).nullish(),diagnostics:D(uP).nullish(),editHistory:D(DI).nullish(),openFiles:D(hP).nullish(),recentFiles:D(MI).nullish(),relatedSnippets:D(FI).nullish(),userActions:D(oP).nullish()}),pP=f({newText:d(),range:xi}),fP=f({cursorPosition:bn.nullish(),edits:D(pP),id:d(),uri:d()}),gP=B([fP.and(f({kind:$("edit")})),iP.and(f({kind:$("jump")})),sP.and(f({kind:$("rename")})),WI.and(f({kind:$("searchAndReplace")}))]),mP=f({_meta:_(d(),S()).nullish(),content:d()}),vP=f({_meta:_(d(),S()).nullish()}),dr=B([Z(),d()]).nullable();f({_meta:_(d(),S()).nullish(),requestId:dr});const yP=ma(["assistant","user"]),ao=f({_meta:_(d(),S()).nullish(),audience:D(yP).nullish(),lastModified:d().nullish(),priority:Z().nullish()}),bP=f({_meta:_(d(),S()).nullish(),annotations:ao.nullish(),data:d(),mimeType:d()}),wP=f({_meta:_(d(),S()).nullish(),annotations:ao.nullish(),data:d(),mimeType:d(),uri:d().nullish()}),SP=f({_meta:_(d(),S()).nullish(),annotations:ao.nullish(),description:d().nullish(),mimeType:d().nullish(),name:d(),size:Z().nullish(),title:d().nullish(),uri:d()}),_P=f({_meta:_(d(),S()).nullish(),optionId:iv}),kP=B([f({outcome:$("cancelled")}),_P.and(f({outcome:$("selected")}))]),EP=f({_meta:_(d(),S()).nullish(),outcome:kP}),xP=f({_meta:_(d(),S()).nullish()}),AP=f({_meta:_(d(),S()).nullish()}),$P=f({currentValue:Ee()}),TP=d(),av=d(),CP=B([$("mode"),$("model"),$("thought_level"),d()]),sh=d(),lv=f({_meta:_(d(),S()).nullish(),description:d().nullish(),name:d(),value:sh}),IP=f({_meta:_(d(),S()).nullish(),group:TP,name:d(),options:D(lv)}),PP=B([D(lv),D(IP)]),RP=f({currentValue:sh,options:PP}),Ai=el(B([RP.and(f({type:$("select")})),$P.and(f({type:$("boolean")}))]),f({_meta:_(d(),S()).nullish(),category:CP.nullish(),description:d().nullish(),id:av,name:d()})),DP=f({_meta:_(d(),S()).nullish(),configOptions:D(Ai)}),OP=f({_meta:_(d(),S()).nullish()}),X=d(),LP=f({_meta:_(d(),S()).nullish(),id:d(),sessionId:X}),zP=f({_meta:_(d(),S()).nullish(),sessionId:X}),MP=f({_meta:_(d(),S()).nullish(),sessionId:X}),NP=f({_meta:_(d(),S()).nullish(),sessionId:X}),cv=f({_meta:_(d(),S()).nullish(),args:D(d()).optional(),command:d(),cwd:d().nullish(),env:D(Km).optional(),outputByteLimit:Z().nullish(),sessionId:X}),UP=f({_meta:_(d(),S()).nullish(),sessionId:X,uri:d()}),FP=f({_meta:_(d(),S()).nullish(),position:bn,sessionId:X,uri:d(),version:Z(),visibleRange:xi}),ZP=f({_meta:_(d(),S()).nullish(),languageId:d(),sessionId:X,text:d(),uri:d(),version:Z()}),HP=f({_meta:_(d(),S()).nullish(),sessionId:X,uri:d()}),BP=f({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(tl).optional(),sessionId:X}),uv=f({_meta:_(d(),S()).nullish(),sessionId:X,terminalId:d()}),GP=f({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(tl),sessionId:X}),hv=f({_meta:_(d(),S()).nullish(),limit:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:d(),sessionId:X}),VP=f({_meta:_(d(),S()).nullish(),id:d(),reason:UI.nullish(),sessionId:X}),dv=f({_meta:_(d(),S()).nullish(),sessionId:X,terminalId:d()}),WP=f({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(tl).optional(),sessionId:X}),jP=f({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),sessionId:X,title:d().nullish(),updatedAt:d().nullish()}),qP=f({_meta:_(d(),S()).nullish(),nextCursor:d().nullish(),sessions:D(jP)}),YP=f({_meta:_(d(),S()).nullish(),title:d().nullish(),updatedAt:d().nullish()}),XP=f({_meta:_(d(),S()).nullish()}),nl=d(),KP=f({_meta:_(d(),S()).nullish(),currentModeId:nl}),JP=f({_meta:_(d(),S()).nullish(),description:d().nullish(),id:nl,name:d()}),rl=f({_meta:_(d(),S()).nullish(),availableModes:D(JP),currentModeId:nl}),il=f({_meta:_(d(),S()).nullish(),availableModels:D(xI),currentModelId:ih}),QP=f({_meta:_(d(),S()).nullish(),configOptions:D(Ai).nullish(),models:il.nullish(),modes:rl.nullish(),sessionId:X}),eR=f({_meta:_(d(),S()).nullish(),configOptions:D(Ai).nullish(),models:il.nullish(),modes:rl.nullish()}),tR=f({_meta:_(d(),S()).nullish(),configOptions:D(Ai).nullish(),models:il.nullish(),modes:rl.nullish(),sessionId:X}),nR=f({_meta:_(d(),S()).nullish(),configOptions:D(Ai).nullish(),models:il.nullish(),modes:rl.nullish()}),rR=f({_meta:_(d(),S()).nullish()}),iR=f({_meta:_(d(),S()).nullish(),additionalDirectories:xP.nullish(),close:AP.nullish(),fork:OP.nullish(),list:XP.nullish(),resume:rR.nullish()}),sR=el(B([f({type:$("boolean"),value:Ee()}),f({value:sh})]),f({_meta:_(d(),S()).nullish(),configId:av,sessionId:X})),oR=f({_meta:_(d(),S()).nullish(),configOptions:D(Ai)}),aR=f({_meta:_(d(),S()).nullish(),modeId:nl,sessionId:X}),lR=f({_meta:_(d(),S()).nullish()}),cR=f({_meta:_(d(),S()).nullish(),modelId:ih,sessionId:X}),uR=f({_meta:_(d(),S()).nullish()}),hR=f({_meta:_(d(),S()).nullish(),sessionId:X}),dR=B([$("end_turn"),$("max_tokens"),$("max_turn_requests"),$("refusal"),$("cancelled")]),pR=B([$("email"),$("uri"),$("date"),$("date-time")]),fR=f({default:d().nullish(),description:d().nullish(),enum:D(d()).nullish(),format:pR.nullish(),maxLength:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),minLength:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),oneOf:D(Xm).nullish(),pattern:d().nullish(),title:d().nullish()}),gR=f({_meta:_(d(),S()).nullish(),context:dP.nullish(),position:bn,selection:xi.nullish(),sessionId:X,triggerKind:jI,uri:d(),version:Z()}),mR=f({_meta:_(d(),S()).nullish(),suggestions:D(gP)}),vR=f({_meta:_(d(),S()).nullish(),terminalId:d()}),yR=f({_meta:_(d(),S()).nullish(),exitCode:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:d().nullish()}),pv=f({_meta:_(d(),S()).nullish(),sessionId:X,terminalId:d()}),bR=f({_meta:_(d(),S()).nullish(),exitStatus:yR.nullish(),output:d(),truncated:Ee()}),wR=f({_meta:_(d(),S()).nullish(),annotations:ao.nullish(),text:d()}),SR=f({range:xi.nullish(),text:d()}),_R=f({_meta:_(d(),S()).nullish(),contentChanges:D(SR),sessionId:X,uri:d(),version:Z()});f({method:d(),params:B([zP,ZP,_R,UP,HP,FP,LP,VP,Qm]).nullish()});const kR=B([$("full"),$("incremental")]),ER=f({_meta:_(d(),S()).nullish(),syncKind:kR}),xR=f({_meta:_(d(),S()).nullish(),didChange:ER.nullish(),didClose:TI.nullish(),didFocus:CI.nullish(),didOpen:II.nullish(),didSave:PI.nullish()}),AR=f({_meta:_(d(),S()).nullish(),document:xR.nullish()}),$R=f({_meta:_(d(),S()).nullish(),context:YI.nullish(),events:AR.nullish()}),TR=f({_meta:_(d(),S()).nullish(),auth:yI.optional().default({}),loadSession:Ee().optional().default(!1),mcpCapabilities:SI.optional().default({http:!1,sse:!1}),nes:$R.nullish(),positionEncoding:sv.nullish(),promptCapabilities:lP.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:iR.optional().default({})}),CR=f({_meta:_(d(),S()).nullish(),agentCapabilities:TR.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:rv.nullish(),authMethods:D(VC).optional().default([]),protocolVersion:ov}),IR=f({_meta:_(d(),S()).nullish(),mimeType:d().nullish(),text:d(),uri:d()}),PR=B([IR,qC]),RR=f({_meta:_(d(),S()).nullish(),annotations:ao.nullish(),resource:PR}),oh=B([wR.and(f({type:$("text")})),wP.and(f({type:$("image")})),bP.and(f({type:$("audio")})),SP.and(f({type:$("resource_link")})),RR.and(f({type:$("resource")}))]),DR=f({_meta:_(d(),S()).nullish(),content:oh}),Ql=f({_meta:_(d(),S()).nullish(),content:oh,messageId:d().nullish()}),OR=f({_meta:_(d(),S()).nullish(),messageId:d().nullish(),prompt:D(oh),sessionId:X}),LR=f({anyOf:D(Xm)}),fv=B([DR.and(f({type:$("content")})),eI.and(f({type:$("diff")})),vR.and(f({type:$("terminal")}))]),gv=d(),mv=f({_meta:_(d(),S()).nullish(),line:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:d()}),vv=B([$("pending"),$("in_progress"),$("completed"),$("failed")]),yv=B([$("read"),$("edit"),$("delete"),$("move"),$("search"),$("execute"),$("think"),$("fetch"),$("switch_mode"),$("other")]),zR=f({_meta:_(d(),S()).nullish(),content:D(fv).optional(),kind:yv.optional(),locations:D(mv).optional(),rawInput:S().optional(),rawOutput:S().optional(),status:vv.optional(),title:d(),toolCallId:gv}),bv=f({_meta:_(d(),S()).nullish(),content:D(fv).nullish(),kind:yv.nullish(),locations:D(mv).nullish(),rawInput:S().optional(),rawOutput:S().optional(),status:vv.nullish(),title:d().nullish(),toolCallId:gv}),wv=f({_meta:_(d(),S()).nullish(),options:D(QI),sessionId:X,toolCall:bv}),MR=f({_meta:_(d(),S()).nullish(),hint:d()}),NR=MR,UR=f({_meta:_(d(),S()).nullish(),description:d(),input:NR.nullish(),name:d()}),FR=f({_meta:_(d(),S()).nullish(),availableCommands:D(UR)}),ZR=f({enum:D(d()),type:lI}),HR=B([ZR,LR]),BR=f({default:D(d()).nullish(),description:d().nullish(),items:HR,maxItems:Z().nullish(),minItems:Z().nullish(),title:d().nullish()}),GR=B([fR.and(f({type:$("string")})),KI.and(f({type:$("number")})),fI.and(f({type:$("integer")})),YC.and(f({type:$("boolean")})),BR.and(f({type:$("array")}))]),VR=f({description:d().nullish(),properties:_(d(),GR).optional().default({}),required:D(d()).nullish(),title:d().nullish(),type:aI.optional().default("object")}),WR=f({requestedSchema:VR}),jR=el(B([WR.and(f({mode:$("form")})),hI.and(f({mode:$("url")}))]),f({_meta:_(d(),S()).nullish(),message:d(),sessionId:X})),qR=f({cachedReadTokens:Z().nullish(),cachedWriteTokens:Z().nullish(),inputTokens:Z(),outputTokens:Z(),thoughtTokens:Z().nullish(),totalTokens:Z()}),YR=f({_meta:_(d(),S()).nullish(),stopReason:dR,usage:qR.nullish(),userMessageId:d().nullish()});B([f({id:dr,result:B([CR,jC,wI,tR,eR,qP,QP,nR,KC,lR,oR,YR,uR,hR,mR,XC,tv])}),f({error:Jm,id:dr})]);const XR=f({_meta:_(d(),S()).nullish(),cost:JC.nullish(),size:Z(),used:Z()}),KR=B([Ql.and(f({sessionUpdate:$("user_message_chunk")})),Ql.and(f({sessionUpdate:$("agent_message_chunk")})),Ql.and(f({sessionUpdate:$("agent_thought_chunk")})),zR.and(f({sessionUpdate:$("tool_call")})),bv.and(f({sessionUpdate:$("tool_call_update")})),rP.and(f({sessionUpdate:$("plan")})),FR.and(f({sessionUpdate:$("available_commands_update")})),KP.and(f({sessionUpdate:$("current_mode_update")})),DP.and(f({sessionUpdate:$("config_option_update")})),YP.and(f({sessionUpdate:$("session_info_update")})),XR.and(f({sessionUpdate:$("usage_update")}))]),Sv=f({_meta:_(d(),S()).nullish(),sessionId:X,update:KR});f({method:d(),params:B([Sv,sI,Qm]).nullish()});const _v=f({_meta:_(d(),S()).nullish(),sessionId:X,terminalId:d()}),JR=f({_meta:_(d(),S()).nullish(),exitCode:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:d().nullish()}),QR=f({name:d(),uri:d()}),e2=f({_meta:_(d(),S()).nullish(),repository:BI.nullish(),workspaceFolders:D(QR).nullish(),workspaceUri:d().nullish()});f({id:dr,method:d(),params:B([cP,WC,bI,XI,GP,mI,BP,WP,NP,aR,sR,OR,cR,e2,gR,MP,ev]).nullish()});const kv=f({_meta:_(d(),S()).nullish(),content:d(),path:d(),sessionId:X});f({id:dr,method:d(),params:B([kv,hv,wv,cv,pv,dv,_v,uv,jR,ev]).nullish()});const t2=f({_meta:_(d(),S()).nullish()});B([f({id:dr,result:B([t2,mP,EP,QC,bR,vP,JR,gI,oI,tv])}),f({error:Jm,id:dr})]);var Y;class n2{constructor(e,t){w(this,Y);const r=e(this),i=async(o,a)=>{var l,u,h,p,g,m,A;switch(o){case Ft.fs_write_text_file:{const k=kv.parse(a);return(l=r.writeTextFile)==null?void 0:l.call(r,k)}case Ft.fs_read_text_file:{const k=hv.parse(a);return(u=r.readTextFile)==null?void 0:u.call(r,k)}case Ft.session_request_permission:{const k=wv.parse(a);return r.requestPermission(k)}case Ft.terminal_create:{const k=cv.parse(a);return(h=r.createTerminal)==null?void 0:h.call(r,k)}case Ft.terminal_output:{const k=pv.parse(a);return(p=r.terminalOutput)==null?void 0:p.call(r,k)}case Ft.terminal_release:{const k=dv.parse(a);return await((g=r.releaseTerminal)==null?void 0:g.call(r,k))??{}}case Ft.terminal_wait_for_exit:{const k=_v.parse(a);return(m=r.waitForTerminalExit)==null?void 0:m.call(r,k)}case Ft.terminal_kill:{const k=uv.parse(a);return await((A=r.killTerminal)==null?void 0:A.call(r,k))??{}}default:if(r.extMethod)return r.extMethod(o,a);throw Se.methodNotFound(o)}},s=async(o,a)=>{switch(o){case Ft.session_update:{const l=Sv.parse(a);return r.sessionUpdate(l)}default:if(r.extNotification)return r.extNotification(o,a);throw Se.methodNotFound(o)}};E(this,Y,new r2(i,s,t))}async initialize(e){return await c(this,Y).sendRequest(ae.initialize,e)}async newSession(e){return await c(this,Y).sendRequest(ae.session_new,e)}async loadSession(e){return await c(this,Y).sendRequest(ae.session_load,e)??{}}async unstable_forkSession(e){return await c(this,Y).sendRequest(ae.session_fork,e)}async listSessions(e){return await c(this,Y).sendRequest(ae.session_list,e)}async unstable_resumeSession(e){return await c(this,Y).sendRequest(ae.session_resume,e)}async unstable_closeSession(e){return await c(this,Y).sendRequest(ae.session_close,e)}async setSessionMode(e){return await c(this,Y).sendRequest(ae.session_set_mode,e)??{}}async unstable_setSessionModel(e){return await c(this,Y).sendRequest(ae.session_set_model,e)??{}}async setSessionConfigOption(e){return await c(this,Y).sendRequest(ae.session_set_config_option,e)}async authenticate(e){return await c(this,Y).sendRequest(ae.authenticate,e)??{}}async unstable_logout(e){return await c(this,Y).sendRequest(ae.logout,e)??{}}async prompt(e){return await c(this,Y).sendRequest(ae.session_prompt,e)}async cancel(e){return await c(this,Y).sendNotification(ae.session_cancel,e)}async unstable_startNes(e){return await c(this,Y).sendRequest(ae.nes_start,e)}async unstable_suggestNes(e){return await c(this,Y).sendRequest(ae.nes_suggest,e)}async unstable_closeNes(e){return await c(this,Y).sendRequest(ae.nes_close,e)??{}}async unstable_didOpenDocument(e){return await c(this,Y).sendNotification(ae.document_did_open,e)}async unstable_didChangeDocument(e){return await c(this,Y).sendNotification(ae.document_did_change,e)}async unstable_didCloseDocument(e){return await c(this,Y).sendNotification(ae.document_did_close,e)}async unstable_didSaveDocument(e){return await c(this,Y).sendNotification(ae.document_did_save,e)}async unstable_didFocusDocument(e){return await c(this,Y).sendNotification(ae.document_did_focus,e)}async unstable_acceptNes(e){return await c(this,Y).sendNotification(ae.nes_accept,e)}async unstable_rejectNes(e){return await c(this,Y).sendNotification(ae.nes_reject,e)}async extMethod(e,t){return await c(this,Y).sendRequest(e,t)}async extNotification(e,t){return await c(this,Y).sendNotification(e,t)}get signal(){return c(this,Y).signal}get closed(){return c(this,Y).closed}}Y=new WeakMap;var ln,Ea,gs,ms,Wr,jr,It,vs,de,Ev,Nc,xv,Av,$v,Tv,Uc,Vi;class r2{constructor(e,t,r){w(this,de);w(this,ln,new Map);w(this,Ea,0);w(this,gs);w(this,ms);w(this,Wr);w(this,jr,Promise.resolve());w(this,It,new AbortController);w(this,vs);E(this,gs,e),E(this,ms,t),E(this,Wr,r),E(this,vs,new Promise(i=>{c(this,It).signal.addEventListener("abort",()=>i())})),v(this,de,Ev).call(this)}get signal(){return c(this,It).signal}get closed(){return c(this,vs)}async sendRequest(e,t){v(this,de,Uc).call(this);const r=Xh(this,Ea)._++,i=new Promise((s,o)=>{c(this,ln).set(r,{resolve:s,reject:o})});return await v(this,de,Vi).call(this,{jsonrpc:"2.0",id:r,method:e,params:t}),i}async sendNotification(e,t){v(this,de,Uc).call(this),await v(this,de,Vi).call(this,{jsonrpc:"2.0",method:e,params:t})}}ln=new WeakMap,Ea=new WeakMap,gs=new WeakMap,ms=new WeakMap,Wr=new WeakMap,jr=new WeakMap,It=new WeakMap,vs=new WeakMap,de=new WeakSet,Ev=async function(){let e;try{const t=c(this,Wr).readable.getReader();try{for(;!c(this,It).signal.aborted;){const{value:r,done:i}=await t.read();if(i)break;if(r)try{v(this,de,xv).call(this,r)}catch(s){console.error("Unexpected error during message processing:",r,s),"id"in r&&r.id!==void 0&&v(this,de,Vi).call(this,{jsonrpc:"2.0",id:r.id,error:{code:-32700,message:"Parse error"}})}}}finally{t.releaseLock()}}catch(t){e=t}finally{v(this,de,Nc).call(this,e)}},Nc=function(e){if(c(this,It).signal.aborted)return;const t=e??new Error("ACP connection closed");for(const r of c(this,ln).values())r.reject(t);c(this,ln).clear(),c(this,It).abort(t)},xv=async function(e){if("method"in e&&"id"in e){const t=await v(this,de,Av).call(this,e.method,e.params);"error"in t&&console.error("Error handling request",e,t.error),await v(this,de,Vi).call(this,{jsonrpc:"2.0",id:e.id,...t})}else if("method"in e){const t=await v(this,de,$v).call(this,e.method,e.params);"error"in t&&console.error("Error handling notification",e,t.error)}else"id"in e?v(this,de,Tv).call(this,e):console.error("Invalid message",{message:e})},Av=async function(e,t){try{return{result:await c(this,gs).call(this,e,t)??null}}catch(r){if(r instanceof Se)return r.toResult();if(r instanceof Vp)return Se.invalidParams(r.format()).toResult();let i;(r instanceof Error||typeof r=="object"&&r!=null&&"message"in r&&typeof r.message=="string")&&(i=r.message);try{return Se.internalError(i?JSON.parse(i):{}).toResult()}catch{return Se.internalError({details:i}).toResult()}}},$v=async function(e,t){try{return await c(this,ms).call(this,e,t),{result:null}}catch(r){if(r instanceof Se)return r.toResult();if(r instanceof Vp)return Se.invalidParams(r.format()).toResult();let i;(r instanceof Error||typeof r=="object"&&r!=null&&"message"in r&&typeof r.message=="string")&&(i=r.message);try{return Se.internalError(i?JSON.parse(i):{}).toResult()}catch{return Se.internalError({details:i}).toResult()}}},Tv=function(e){const t=c(this,ln).get(e.id);if(t){if("result"in e)t.resolve(e.result);else if("error"in e){const{code:r,message:i,data:s}=e.error;t.reject(new Se(r,i,s))}c(this,ln).delete(e.id)}else console.error("Got response to unknown request",e.id)},Uc=function(){if(c(this,It).signal.aborted)throw c(this,It).signal.reason??new Error("ACP connection closed")},Vi=async function(e){return E(this,jr,c(this,jr).then(async()=>{const t=c(this,Wr).writable.getWriter();try{await t.write(e)}finally{t.releaseLock()}}).catch(t=>{v(this,de,Nc).call(this,t)})),c(this,jr)};class Se extends Error{constructor(t,r,i){super(r);b(this,"code");b(this,"data");this.code=t,this.name="RequestError",this.data=i}static parseError(t,r){return new Se(-32700,`Parse error${r?`: ${r}`:""}`,t)}static invalidRequest(t,r){return new Se(-32600,`Invalid request${r?`: ${r}`:""}`,t)}static methodNotFound(t){return new Se(-32601,`"Method not found": ${t}`,{method:t})}static invalidParams(t,r){return new Se(-32602,`Invalid params${r?`: ${r}`:""}`,t)}static internalError(t,r){return new Se(-32603,`Internal error${r?`: ${r}`:""}`,t)}static authRequired(t,r){return new Se(-32e3,`Authentication required${r?`: ${r}`:""}`,t)}static resourceNotFound(t){return new Se(-32002,`Resource not found${t?`: ${t}`:""}`,t&&{uri:t})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}}const i2=/^Sender \(untrusted metadata\):\n```json\n[\s\S]*?\n```\n\n?/,s2=/^\[[^\n]*Working directory:[^\n]*\]\n\n?/,o2=/\[Television screen context\][\s\S]*?\[\/Television screen context\]\n*/,a2=/\[\[\s*(?:reply_to_current|reply_to\s*:\s*[^\]\n]+|audio_as_voice)\s*\]\]\s*/gi,l2="single_session",c2={name:"television-acp-client",version:"0.0.0"},Cv="agent:main:television",u2=ki(bt);var te,Gt,qr,Vt,qn,Yn,Xn,Kn,cn,Yr,Pt,dt,un,Jn,Wt,hn,ys,jt,pt,xa,qt,T,Iv,Pv,Rv,Fc,Dv,Ov,Lv,zv,Mv,Nv,Uv,Rn,Or,Lr,He,Fv,zr,Zc,Hc,Xo,Zv,Hv,bs,ws,Bc,Mr,Bv,Gv;class h2 extends u2{constructor(t){super();w(this,T);w(this,te,p2());w(this,Gt,null);w(this,qr,null);w(this,Vt,null);w(this,qn,null);w(this,Yn,null);w(this,Xn,null);w(this,Kn);w(this,cn,null);w(this,Yr,1);w(this,Pt,null);w(this,dt,null);w(this,un,!1);w(this,Jn,!1);w(this,Wt,null);w(this,hn,new Set);w(this,ys);w(this,jt);w(this,pt);w(this,xa,t=>{v(this,T,Pv).call(this,t)});w(this,qt,null);w(this,bs,()=>{v(this,T,Mr).call(this,"ACP bridge websocket closed")});w(this,ws,()=>{v(this,T,Mr).call(this,"ACP bridge websocket error")});E(this,jt,t),E(this,pt,t.sessionMode??l2),E(this,Kn,t.mappedSessionStore??d2()),E(this,ys,t.createSocket??(r=>new WebSocket(r)))}getState(){return c(this,te)}get messages(){return c(this,te).messageOrder.map(t=>c(this,te).messagesById[t]).filter(t=>t!==void 0)}async connect(){if(this.disposed)throw new Error("ACPClient has been disposed");if(c(this,te).lifecycle.status!=="ready"){v(this,T,He).call(this,{lifecycle:{status:"connecting"}}),c(this,qr)??E(this,qr,v(this,T,Iv).call(this));try{await c(this,qr),await v(this,T,Fc).call(this)}catch(t){throw v(this,T,Mr).call(this,Po(t)),t}}}dispose(){v(this,T,Bc).call(this),v(this,T,He).call(this,{lifecycle:{status:"disposed"},run:{status:"idle",stopReason:null,canCancel:!1,error:null},bridge:null})}async sendMessage(t){if(await this.connect(),c(this,te).lifecycle.status!=="ready"||c(this,te).run.status==="running"||c(this,te).run.status==="cancelling")throw new Error("ACPClient is not ready to send a new message");const r=t.text.trim();if(!r)throw new Error("Cannot send an empty message");v(this,T,Or).call(this,{id:v(this,T,zr).call(this,"user"),kind:"user",text:r,status:"final"}),v(this,T,He).call(this,{run:{status:"running",stopReason:null,canCancel:!0,error:null}});try{const i=await v(this,T,Xo).call(this).prompt({sessionId:v(this,T,Hc).call(this),prompt:[{type:"text",text:v(this,T,Fv).call(this,r)}]});v(this,T,Rn).call(this,i.stopReason==="cancelled"?"cancelled":"final"),v(this,T,He).call(this,{run:{status:i.stopReason==="cancelled"?"cancelled":"completed",stopReason:i.stopReason,canCancel:!1,error:null}})}catch(i){throw v(this,T,Gv).call(this)||(v(this,T,Rn).call(this,"error"),v(this,T,He).call(this,{run:{status:"error",stopReason:null,canCancel:!1,error:Po(i)}})),i}}async cancel(){if(await this.connect(),!c(this,te).run.canCancel||c(this,te).run.status!=="running")throw new Error("No active cancellable run");v(this,T,He).call(this,{run:{...c(this,te).run,status:"cancelling"}}),await v(this,T,Xo).call(this).cancel({sessionId:v(this,T,Hc).call(this)})}setScreenContext(t){var s,o,a;const r={screenID:t.screenID,screenName:t.screenName};if(((s=c(this,dt))==null?void 0:s.screenID)===r.screenID&&((o=c(this,dt))==null?void 0:o.screenName)===r.screenName)return;const i=((a=c(this,dt))==null?void 0:a.screenID)??null;if(E(this,dt,r),c(this,pt)==="single_session"){(!c(this,cn)||i!==r.screenID)&&E(this,un,!0);return}c(this,cn)!==Kp(c(this,pt),r.screenID,c(this,jt).clientGUID??"default-client")&&(E(this,Vt,null),E(this,qn,null),c(this,Gt)&&c(this,te).run.status==="idle"&&v(this,T,Fc).call(this).catch(l=>{v(this,T,Mr).call(this,Po(l))}))}}te=new WeakMap,Gt=new WeakMap,qr=new WeakMap,Vt=new WeakMap,qn=new WeakMap,Yn=new WeakMap,Xn=new WeakMap,Kn=new WeakMap,cn=new WeakMap,Yr=new WeakMap,Pt=new WeakMap,dt=new WeakMap,un=new WeakMap,Jn=new WeakMap,Wt=new WeakMap,hn=new WeakMap,ys=new WeakMap,jt=new WeakMap,pt=new WeakMap,xa=new WeakMap,qt=new WeakMap,T=new WeakSet,Iv=async function(){try{v(this,T,He).call(this,{lifecycle:{status:"connecting"}});const{stream:t,socket:r,metadata:i}=await m2({serverURL:c(this,jt).serverURL,token:c(this,jt).token,createSocket:c(this,ys),onDisconnect:c(this,xa)});E(this,Xn,i),v(this,T,He).call(this,{bridge:i}),E(this,qt,r),r.addEventListener("close",c(this,bs)),r.addEventListener("error",c(this,ws)),E(this,Gt,new n2(s=>({connection:s,sessionUpdate:async o=>{await v(this,T,Ov).call(this,o)},requestPermission:async o=>v(this,T,Lv).call(this,o)}),t)),await c(this,Gt).initialize({protocolVersion:UC,clientCapabilities:{},clientInfo:c2})}catch(t){throw t}},Pv=function(t){v(this,T,Mr).call(this,Po(t))},Rv=function(t){const r=t==null?void 0:t.models;if(!(r!=null&&r.currentModelId))return;const i=r.availableModels.find(s=>s.modelId===r.currentModelId);console.info("[ACPClient] Current model:",(i==null?void 0:i.name)??r.currentModelId,`(${r.currentModelId})`)},Fc=async function(){const t=v(this,T,Hv).call(this);if(c(this,Vt)&&c(this,qn)===t){await c(this,Vt);return}E(this,qn,t),E(this,Vt,v(this,T,Dv).call(this,t)),await c(this,Vt)},Dv=async function(t){var l;const r=v(this,T,Xo).call(this);v(this,T,Bv).call(this);let i,s=!1,o=null;const a={cwd:v(this,T,Zv).call(this),mcpServers:[],_meta:{sessionKey:t}};try{if(E(this,Jn,!0),E(this,Wt,null),((l=c(this,Xn))==null?void 0:l.sessionIdStrategy)==="mapped"){const u=c(this,Kn).getActualSessionId(t);if(u)try{const h=await r.loadSession({...a,sessionId:u});if(f2(h))throw new Error("Mapped ACP session was not found");o=h,i=u,s=!0}catch{const h=await r.newSession(a);o=h,i=h.sessionId,c(this,Kn).setActualSessionId(t,i),s=!1}else{const h=await r.newSession(a);o=h,i=h.sessionId,c(this,Kn).setActualSessionId(t,i),s=!1}}else try{o=await r.loadSession({...a,sessionId:t}),i=t,s=c(this,te).messageOrder.length>0}catch{const u=await r.newSession(a);o=u,i=u.sessionId,s=!1}}finally{E(this,Jn,!1),E(this,Wt,null),v(this,T,Rn).call(this,"final")}v(this,T,Rv).call(this,o),await r.setSessionConfigOption({sessionId:i,configId:"verbose_level",value:"full"}),E(this,Yn,i),E(this,cn,t),s?(c(this,hn).add(t),c(this,pt)==="single_session"&&E(this,un,!1)):(c(this,hn).delete(t),E(this,un,c(this,pt)==="single_session")),v(this,T,He).call(this,{lifecycle:{status:"ready"}})},Ov=async function(t){const r=t.update;switch(r.sessionUpdate){case"user_message_chunk":r.content.type==="text"&&v(this,T,Uv).call(this,r.content.text);return;case"agent_message_chunk":r.content.type==="text"&&v(this,T,zv).call(this,r.content.text);return;case"tool_call":v(this,T,Mv).call(this,r);return;case"tool_call_update":v(this,T,Nv).call(this,r);return;case"agent_thought_chunk":return;default:return}},Lv=async function(t){return{outcome:{outcome:"cancelled"}}},zv=function(t){E(this,Wt,null);const r=g2(t);if(!r)return;if(!c(this,Pt)){const s={id:v(this,T,zr).call(this,"assistant"),kind:"assistant",text:r,status:"streaming"};E(this,Pt,s.id),v(this,T,Or).call(this,s);return}const i=c(this,te).messagesById[c(this,Pt)];if(!i||i.kind!=="assistant")throw new Error("Open assistant message invariant violated");v(this,T,Lr).call(this,{...i,text:`${i.text}${r}`,status:"streaming"})},Mv=function(t){v(this,T,Rn).call(this,"final");const r=v(this,T,Zc).call(this,t.toolCallId),i=Qp("content"in t?t.content:void 0),s={id:(r==null?void 0:r.id)??v(this,T,zr).call(this,"tool"),kind:"tool_call",toolCallId:t.toolCallId,title:t.title,toolKind:t.kind??"other",status:t.status==="failed"?"failed":t.status==="completed"?"completed":"in_progress",text:(r==null?void 0:r.text)??i,locations:t.locations??(r==null?void 0:r.locations)};if(r){v(this,T,Lr).call(this,s);return}v(this,T,Or).call(this,s)},Nv=function(t){const r=v(this,T,Zc).call(this,t.toolCallId),i=(r==null?void 0:r.text)??"",s=Qp(t.content),o=s?`${i}${s}`:i,a={id:(r==null?void 0:r.id)??v(this,T,zr).call(this,"tool"),kind:"tool_call",toolCallId:t.toolCallId,title:(r==null?void 0:r.title)??t.toolCallId,toolKind:(r==null?void 0:r.toolKind)??"other",status:t.status==="failed"?"failed":t.status==="completed"?"completed":"in_progress",text:o,locations:t.locations??(r==null?void 0:r.locations)};if(r){v(this,T,Lr).call(this,a);return}v(this,T,Or).call(this,a)},Uv=function(t){if(v(this,T,Rn).call(this,"final"),!t)return;const r=c(this,Jn)?c(this,Wt):null;if(!r){const s=Jp(t);if(!s)return;const o={id:v(this,T,zr).call(this,"user"),kind:"user",text:s,status:"final"};v(this,T,Or).call(this,o),c(this,Jn)&&E(this,Wt,o.id);return}const i=c(this,te).messagesById[r];if(!i||i.kind!=="user")throw new Error("Replay user message invariant violated");v(this,T,Lr).call(this,{...i,text:Jp(`${i.text}${t}`)})},Rn=function(t){if(!c(this,Pt))return;const r=c(this,te).messagesById[c(this,Pt)];(r==null?void 0:r.kind)==="assistant"&&v(this,T,Lr).call(this,{...r,status:t}),E(this,Pt,null)},Or=function(t){v(this,T,He).call(this,{messagesById:{...c(this,te).messagesById,[t.id]:t},messageOrder:[...c(this,te).messageOrder,t.id]})},Lr=function(t){v(this,T,He).call(this,{messagesById:{...c(this,te).messagesById,[t.id]:t}})},He=function(t){const r={...c(this,te),...t};E(this,te,{...r,sendDisabled:r.lifecycle.status!=="ready"||r.run.status==="running"||r.run.status==="cancelling",cancelDisabled:!(r.run.status==="running"||r.run.status==="cancelling")||!r.run.canCancel}),this.dispatchEvent(new K("change"))},Fv=function(t){const r=c(this,cn);return!c(this,dt)||!r||!(c(this,pt)==="single_session"?c(this,un)||!c(this,hn).has(r):!c(this,hn).has(r))?t:(E(this,un,!1),c(this,hn).add(r),["[Television screen context]","This chat session is coming from a Television client in the screen below.",`screen_id: ${c(this,dt).screenID}`,`screen_name: ${c(this,dt).screenName??""}`,"When the user asks to inspect or change Television state with the tv CLI, use this screen ID with the --screen argument.","[/Television screen context]","",t].join(`
43
- `))},zr=function(t){const r=`${t}-${c(this,Yr)}`;return E(this,Yr,c(this,Yr)+1),r},Zc=function(t){for(const r of c(this,te).messageOrder){const i=c(this,te).messagesById[r];if((i==null?void 0:i.kind)==="tool_call"&&i.toolCallId===t)return i}return null},Hc=function(){if(!c(this,Yn))throw new Error("ACP session is not ready");return c(this,Yn)},Xo=function(){if(!c(this,Gt))throw new Error("ACP connection is not ready");return c(this,Gt)},Zv=function(){var r;const t=(r=c(this,Xn))==null?void 0:r.sessionCwd;if(!t)throw new Error("ACP bridge session cwd is not ready");return t},Hv=function(){var r;if(c(this,pt)==="single_session")return`${Cv}-${(c(this,jt).clientGUID??"default-client").toLowerCase()}`;const t=(r=c(this,dt))==null?void 0:r.screenID;if(!t)throw new Error("Screen context is required for per-screen session mode");return Kp(c(this,pt),t,c(this,jt).clientGUID??"default-client")},bs=new WeakMap,ws=new WeakMap,Bc=function(){E(this,Gt,null),E(this,qr,null),E(this,Vt,null),E(this,qn,null),E(this,Yn,null),E(this,cn,null),E(this,Xn,null),c(this,qt)&&(c(this,qt).removeEventListener("close",c(this,bs)),c(this,qt).removeEventListener("error",c(this,ws)),c(this,qt).close(),E(this,qt,null))},Mr=function(t){this.disposed||c(this,te).lifecycle.status==="disconnected"||(v(this,T,Rn).call(this,"error"),v(this,T,Bc).call(this),v(this,T,He).call(this,{lifecycle:{status:"disconnected",...t?{error:t}:{}},run:{status:"idle",stopReason:null,canCancel:!1,error:null},bridge:null}))},Bv=function(){E(this,Pt,null),E(this,Wt,null),E(this,Yr,1),v(this,T,He).call(this,{run:{status:"idle",stopReason:null,canCancel:!1,error:null},messagesById:{},messageOrder:[]})},Gv=function(){return c(this,te).lifecycle.status==="disconnected"};function d2(){const n=new Map;return{getActualSessionId(e){return n.get(e)??null},setActualSessionId(e,t){n.set(e,t)},clearActualSessionId(e){n.delete(e)}}}function p2(){return{lifecycle:{status:"connecting"},run:{status:"idle",stopReason:null,canCancel:!1,error:null},bridge:null,messagesById:{},messageOrder:[],sendDisabled:!0,cancelDisabled:!0}}function f2(n){return n==null?!0:typeof n=="object"&&Object.keys(n).length===0}function Kp(n,e,t){return n==="single_session"?`${Cv}-${t.toLowerCase()}`:`agent:main:television-${t.toLowerCase()}-${e.toLowerCase()}`}function Vv(n){return n.replace(/^(?:\s*\n)+/,"")}function Jp(n){let e=n;return e=e.replace(i2,""),e=e.replace(s2,""),e=e.replace(o2,""),e=Vv(e),e}function g2(n){let e=n;return e=e.replace(a2,""),e=Vv(e),e}function Qp(n){return!n||n.length===0?"":n.flatMap(e=>e.type==="content"&&e.content.type==="text"?[e.content.text]:[]).join("")}async function m2(n){const e=n.createSocket(b2(n.serverURL,n.token));let t=!1,r,i;const s=new Promise((u,h)=>{r=u,i=h}),o=new ReadableStream({start(u){let h=!1;const p=()=>{e.send(JSON.stringify({type:"acp-bridge-connect"}))},g=k=>{const I=y2(k);if(!I)return;let U;try{U=JSON.parse(I)}catch(P){const V=P instanceof Error?P:new Error(String(P));i(V),u.error(V);return}switch(U.type){case"acp-bridge-status":if(U.status==="ready"){let P;try{P=v2(U)}catch(V){const O=V instanceof Error?V:new Error(String(V));t||i(O),u.error(O);return}t||(t=!0,r(P));return}if(U.status==="error"||U.status==="exited"){const P=new Error(U.error??`ACP bridge ${U.status}`);t||i(P),u.error(P)}return;case"acp-bridge-message":u.enqueue(U.message);return}},m=()=>{var I;if(h)return;h=!0;const k=new Error("ACP bridge websocket closed");t||i(k),(I=n.onDisconnect)==null||I.call(n,k),u.close()},A=()=>{var I;if(h)return;h=!0;const k=new Error("ACP bridge websocket error");t||i(k),(I=n.onDisconnect)==null||I.call(n,k),u.error(k)};e.addEventListener("open",p),e.addEventListener("message",g),e.addEventListener("close",m),e.addEventListener("error",A)}}),a=new WritableStream({async write(u){await s,e.send(JSON.stringify({type:"acp-bridge-message",message:u}))},close(){e.close()},abort(){e.close()}}),l=await s;return{stream:{readable:o,writable:a},socket:e,metadata:l}}function v2(n){const{agent:e,sessionIdStrategy:t,sessionCwd:r}=n;if((e==="openclaw"||e==="hermes")&&(t==="deterministic"||t==="mapped")&&typeof r=="string"&&r.length>0)return{agent:e,sessionIdStrategy:t,sessionCwd:r};throw new Error("ACP bridge ready status missing bootstrap metadata")}function y2(n){if(typeof n=="string")return n;if(n instanceof Uint8Array)return new TextDecoder().decode(n);if(typeof Buffer<"u"&&n instanceof Buffer)return n.toString("utf8");if(typeof n=="object"&&n!==null&&"data"in n){const e=n.data;if(typeof e=="string")return e;if(e instanceof Uint8Array)return new TextDecoder().decode(e);if(Array.isArray(e))return Buffer.concat(e).toString("utf8")}return null}function b2(n,e){const t=new URL(n);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.pathname="/acp",t.search="",t.searchParams.set("token",e),t.hash="",t.toString()}function Po(n){return n instanceof Error?n.message:String(n)}const ef="television.acpClientGUID",tf="television.acpMappedSessions",w2=ki(bt);class S2 extends w2{constructor(t){super();b(this,"screenManager");b(this,"clients",new Map);b(this,"options");b(this,"sessionMode");b(this,"clientGUID");b(this,"mappedSessionStore");b(this,"activeClient",null);b(this,"handleActiveScreenChanged",()=>{this.syncActiveClient()});this.screenManager=t.screenManager,this.sessionMode=t.sessionMode??"single_session";const r=t.storage??E2();this.options={serverURL:t.serverURL,token:t.token,...t.createSocket?{createSocket:t.createSocket}:{},...t.sessionMode?{sessionMode:t.sessionMode}:{}},this.clientGUID=t.clientGUID??A2(x2(r)),this.mappedSessionStore=t.mappedSessionStore??(r?new k2(r,t.serverURL):new _2),this.screenManager.addEventListener("active-screen-changed",this.handleActiveScreenChanged),this.syncActiveClient()}getActiveClient(){return this.activeClient}dispose(){this.screenManager.removeEventListener("active-screen-changed",this.handleActiveScreenChanged);for(const t of this.clients.values())t.dispose();this.clients.clear(),this.activeClient=null}syncActiveClient(){const t=this.screenManager.activeScreen,r=t?this.getClientForScreen(t):null;this.activeClient!==r&&(this.activeClient=r,this.dispatchEvent(new K("change")))}getClientForScreen(t){const r=this.sessionMode==="single_session"?"single_session":t.id;let i=this.clients.get(r);return i||(i=new h2({...this.options,sessionMode:this.sessionMode,clientGUID:this.clientGUID,mappedSessionStore:this.mappedSessionStore}),this.clients.set(r,i)),i.setScreenContext({screenID:t.id,screenName:t.name}),i}}var Xr;class _2{constructor(){w(this,Xr,new Map)}getActualSessionId(e){return c(this,Xr).get(e)??null}setActualSessionId(e,t){c(this,Xr).set(e,t)}clearActualSessionId(e){c(this,Xr).delete(e)}}Xr=new WeakMap;const nf=1;var Kr,Ss,Qe,Ko,Jo,Gc;class k2{constructor(e,t){w(this,Qe);w(this,Kr);w(this,Ss);E(this,Kr,e),E(this,Ss,t)}getActualSessionId(e){const t=v(this,Qe,Jo).call(this)[v(this,Qe,Ko).call(this,e)];return typeof t=="string"&&t.length>0?t:null}setActualSessionId(e,t){const r=v(this,Qe,Jo).call(this);r[v(this,Qe,Ko).call(this,e)]=t,v(this,Qe,Gc).call(this,r)}clearActualSessionId(e){const t=v(this,Qe,Jo).call(this);delete t[v(this,Qe,Ko).call(this,e)],v(this,Qe,Gc).call(this,t)}}Kr=new WeakMap,Ss=new WeakMap,Qe=new WeakSet,Ko=function(e){return JSON.stringify([c(this,Ss),e])},Jo=function(){const e=c(this,Kr).getItem(tf);if(!e)return{};let t;try{t=JSON.parse(e)}catch{return{}}if(typeof t!="object"||t===null||Array.isArray(t))return{};const r=t;return r.version!==nf?{}:typeof r.entries!="object"||r.entries===null||Array.isArray(r.entries)?{}:Object.fromEntries(Object.entries(r.entries).filter(i=>typeof i[1]=="string"))},Gc=function(e){const t={version:nf,entries:e};c(this,Kr).setItem(tf,JSON.stringify(t))};function E2(){return typeof window>"u"?null:window.localStorage}function x2(n){if(!n)throw new Error("ACPClientManager requires storage when clientGUID is not provided");return n}function A2(n){const e=n.getItem(ef);if(e)return e;const t=qu().toLowerCase();return n.setItem(ef,t),t}var _s;class $2 extends bt{constructor(){super();w(this,_s,t=>{const r=T2(t);r!==null&&(t.preventDefault(),this.dispatchEvent(new nx("shortcut-triggered",{shortcut:r})))});document.addEventListener("keydown",c(this,_s))}dispose(){document.removeEventListener("keydown",c(this,_s))}}_s=new WeakMap;function T2(n){for(const[e,t]of Object.entries(zx))if(C2(n,t.trigger))return e;return null}function C2(n,e){return!(n.key.toLowerCase()!==e.key.toLowerCase()||n.metaKey!==!!e.meta||n.ctrlKey!==!!e.ctrl||n.shiftKey!==!!e.shift||n.altKey!==!!e.alt)}const I2="serverURL",P2="token",R2="mode",D2="electron";function Wv(n=window.location.search,e=window.location.origin){const r=new URLSearchParams(n).get(I2);return r?new URL(r).origin:new URL(e).origin}function Vc(n=window.location.search){return new URLSearchParams(n).get(P2)}function jv(n=window.location.search){return new URLSearchParams(n).get(R2)===D2}/**
42
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of n.seen.entries()){const p=h[1];if(e===h[0]){s(h);continue}if(n.external){const m=(l=n.external.registry.get(h[0]))==null?void 0:l.id;if(e!==h[0]&&m){s(h);continue}}if((u=n.metadataRegistry.get(h[0]))==null?void 0:u.id){s(h);continue}if(p.cycle){s(h);continue}if(p.count>1&&n.reused==="ref"){s(h);continue}}}function Om(n,e){var o,a,l;const t=n.seen.get(e);if(!t)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=u=>{const h=n.seen.get(u);if(h.ref===null)return;const p=h.def??h.schema,g={...p},m=h.ref;if(h.ref=null,m){r(m);const k=n.seen.get(m),I=k.schema;if(I.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(I)):Object.assign(p,I),Object.assign(p,g),u._zod.parent===m)for(const P in p)P==="$ref"||P==="allOf"||P in g||delete p[P];if(I.$ref&&k.def)for(const P in p)P==="$ref"||P==="allOf"||P in k.def&&JSON.stringify(p[P])===JSON.stringify(k.def[P])&&delete p[P]}const A=u._zod.parent;if(A&&A!==m){r(A);const k=n.seen.get(A);if(k!=null&&k.schema.$ref&&(p.$ref=k.schema.$ref,k.def))for(const I in p)I==="$ref"||I==="allOf"||I in k.def&&JSON.stringify(p[I])===JSON.stringify(k.def[I])&&delete p[I]}n.override({zodSchema:u,jsonSchema:p,path:h.path??[]})};for(const u of[...n.seen.entries()].reverse())r(u[0]);const i={};if(n.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":n.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":n.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":n.target,(o=n.external)!=null&&o.uri){const u=(a=n.external.registry.get(e))==null?void 0:a.id;if(!u)throw new Error("Schema is missing an `id` property");i.$id=n.external.uri(u)}Object.assign(i,t.def??t.schema);const s=((l=n.external)==null?void 0:l.defs)??{};for(const u of n.seen.entries()){const h=u[1];h.def&&h.defId&&(s[h.defId]=h.def)}n.external||Object.keys(s).length>0&&(n.target==="draft-2020-12"?i.$defs=s:i.definitions=s);try{const u=JSON.parse(JSON.stringify(i));return Object.defineProperty(u,"~standard",{value:{...e["~standard"],jsonSchema:{input:ga(e,"input",n.processors),output:ga(e,"output",n.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function ze(n,e){const t=e??{seen:new Set};if(t.seen.has(n))return!1;t.seen.add(n);const r=n._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return ze(r.element,t);if(r.type==="set")return ze(r.valueType,t);if(r.type==="lazy")return ze(r.getter(),t);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return ze(r.innerType,t);if(r.type==="intersection")return ze(r.left,t)||ze(r.right,t);if(r.type==="record"||r.type==="map")return ze(r.keyType,t)||ze(r.valueType,t);if(r.type==="pipe")return ze(r.in,t)||ze(r.out,t);if(r.type==="object"){for(const i in r.shape)if(ze(r.shape[i],t))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(ze(i,t))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(ze(i,t))return!0;return!!(r.rest&&ze(r.rest,t))}return!1}const N$=(n,e={})=>t=>{const r=Rm({...t,processors:e});return ye(n,r),Dm(r,n),Om(r,n)},ga=(n,e,t={})=>r=>{const{libraryOptions:i,target:s}=r??{},o=Rm({...i??{},target:s,io:e,processors:t});return ye(n,o),Dm(o,n),Om(o,n)},U$={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},F$=(n,e,t,r)=>{const i=t;i.type="string";const{minimum:s,maximum:o,format:a,patterns:l,contentEncoding:u}=n._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof o=="number"&&(i.maxLength=o),a&&(i.format=U$[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),u&&(i.contentEncoding=u),l&&l.size>0){const h=[...l];h.length===1?i.pattern=h[0].source:h.length>1&&(i.allOf=[...h.map(p=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},Z$=(n,e,t,r)=>{const i=t,{minimum:s,maximum:o,format:a,multipleOf:l,exclusiveMaximum:u,exclusiveMinimum:h}=n._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number",typeof h=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.minimum=h,i.exclusiveMinimum=!0):i.exclusiveMinimum=h),typeof s=="number"&&(i.minimum=s,typeof h=="number"&&e.target!=="draft-04"&&(h>=s?delete i.minimum:delete i.exclusiveMinimum)),typeof u=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u),typeof o=="number"&&(i.maximum=o,typeof u=="number"&&e.target!=="draft-04"&&(u<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof l=="number"&&(i.multipleOf=l)},H$=(n,e,t,r)=>{t.type="boolean"},B$=(n,e,t,r)=>{t.not={}},G$=(n,e,t,r)=>{},V$=(n,e,t,r)=>{const i=n._zod.def,s=dm(i.entries);s.every(o=>typeof o=="number")&&(t.type="number"),s.every(o=>typeof o=="string")&&(t.type="string"),t.enum=s},W$=(n,e,t,r)=>{const i=n._zod.def,s=[];for(const o of i.values)if(o===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(o))}else s.push(o);if(s.length!==0)if(s.length===1){const o=s[0];t.type=o===null?"null":typeof o,e.target==="draft-04"||e.target==="openapi-3.0"?t.enum=[o]:t.const=o}else s.every(o=>typeof o=="number")&&(t.type="number"),s.every(o=>typeof o=="string")&&(t.type="string"),s.every(o=>typeof o=="boolean")&&(t.type="boolean"),s.every(o=>o===null)&&(t.type="null"),t.enum=s},j$=(n,e,t,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},q$=(n,e,t,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Y$=(n,e,t,r)=>{const i=t,s=n._zod.def,{minimum:o,maximum:a}=n._zod.bag;typeof o=="number"&&(i.minItems=o),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=ye(s.element,e,{...r,path:[...r.path,"items"]})},X$=(n,e,t,r)=>{var u;const i=t,s=n._zod.def;i.type="object",i.properties={};const o=s.shape;for(const h in o)i.properties[h]=ye(o[h],e,{...r,path:[...r.path,"properties",h]});const a=new Set(Object.keys(o)),l=new Set([...a].filter(h=>{const p=s.shape[h]._zod;return e.io==="input"?p.optin===void 0:p.optout===void 0}));l.size>0&&(i.required=Array.from(l)),((u=s.catchall)==null?void 0:u._zod.def.type)==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=ye(s.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},K$=(n,e,t,r)=>{const i=n._zod.def,s=i.inclusive===!1,o=i.options.map((a,l)=>ye(a,e,{...r,path:[...r.path,s?"oneOf":"anyOf",l]}));s?t.oneOf=o:t.anyOf=o},J$=(n,e,t,r)=>{const i=n._zod.def,s=ye(i.left,e,{...r,path:[...r.path,"allOf",0]}),o=ye(i.right,e,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,l=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];t.allOf=l},Q$=(n,e,t,r)=>{const i=t,s=n._zod.def;i.type="object";const o=s.keyType,a=o._zod.bag,l=a==null?void 0:a.patterns;if(s.mode==="loose"&&l&&l.size>0){const h=ye(s.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const p of l)i.patternProperties[p.source]=h}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=ye(s.keyType,e,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=ye(s.valueType,e,{...r,path:[...r.path,"additionalProperties"]});const u=o._zod.values;if(u){const h=[...u].filter(p=>typeof p=="string"||typeof p=="number");h.length>0&&(i.required=h)}},eT=(n,e,t,r)=>{const i=n._zod.def,s=ye(i.innerType,e,r),o=e.seen.get(n);e.target==="openapi-3.0"?(o.ref=i.innerType,t.nullable=!0):t.anyOf=[s,{type:"null"}]},tT=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType},nT=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,t.default=JSON.parse(JSON.stringify(i.defaultValue))},rT=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,e.io==="input"&&(t._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},iT=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=o},sT=(n,e,t,r)=>{const i=n._zod.def,s=e.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;ye(s,e,r);const o=e.seen.get(n);o.ref=s},oT=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType,t.readOnly=!0},Lm=(n,e,t,r)=>{const i=n._zod.def;ye(i.innerType,e,r);const s=e.seen.get(n);s.ref=i.innerType},aT=x("ZodISODateTime",(n,e)=>{lA.init(n,e),ge.init(n,e)});function lT(n){return f$(aT,n)}const cT=x("ZodISODate",(n,e)=>{cA.init(n,e),ge.init(n,e)});function uT(n){return g$(cT,n)}const hT=x("ZodISOTime",(n,e)=>{uA.init(n,e),ge.init(n,e)});function dT(n){return m$(hT,n)}const pT=x("ZodISODuration",(n,e)=>{hA.init(n,e),ge.init(n,e)});function fT(n){return v$(pT,n)}const zm=(n,e)=>{mm.init(n,e),n.name="ZodError",Object.defineProperties(n,{format:{value:t=>t1(n,t)},flatten:{value:t=>e1(n,t)},addIssue:{value:t=>{n.issues.push(t),n.message=JSON.stringify(n.issues,Ic,2)}},addIssues:{value:t=>{n.issues.push(...t),n.message=JSON.stringify(n.issues,Ic,2)}},isEmpty:{get(){return n.issues.length===0}}})},Up=x("ZodError",zm),ct=x("ZodError",zm,{Parent:Error}),gT=Ju(ct),mT=Qu(ct),vT=Ka(ct),yT=Ja(ct),bT=i1(ct),wT=s1(ct),ST=o1(ct),_T=a1(ct),kT=l1(ct),ET=c1(ct),xT=u1(ct),AT=h1(ct),fe=x("ZodType",(n,e)=>(pe.init(n,e),Object.assign(n["~standard"],{jsonSchema:{input:ga(n,"input"),output:ga(n,"output")}}),n.toJSONSchema=N$(n,{}),n.def=e,n.type=e.type,Object.defineProperty(n,"_def",{value:e}),n.check=(...t)=>n.clone(En(e,{checks:[...e.checks??[],...t.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),n.with=n.check,n.clone=(t,r)=>xn(n,t,r),n.brand=()=>n,n.register=(t,r)=>(t.add(n,r),n),n.parse=(t,r)=>gT(n,t,r,{callee:n.parse}),n.safeParse=(t,r)=>vT(n,t,r),n.parseAsync=async(t,r)=>mT(n,t,r,{callee:n.parseAsync}),n.safeParseAsync=async(t,r)=>yT(n,t,r),n.spa=n.safeParseAsync,n.encode=(t,r)=>bT(n,t,r),n.decode=(t,r)=>wT(n,t,r),n.encodeAsync=async(t,r)=>ST(n,t,r),n.decodeAsync=async(t,r)=>_T(n,t,r),n.safeEncode=(t,r)=>kT(n,t,r),n.safeDecode=(t,r)=>ET(n,t,r),n.safeEncodeAsync=async(t,r)=>xT(n,t,r),n.safeDecodeAsync=async(t,r)=>AT(n,t,r),n.refine=(t,r)=>n.check(vC(t,r)),n.superRefine=t=>n.check(yC(t)),n.overwrite=t=>n.check(Ei(t)),n.optional=()=>Hp(n),n.exactOptional=()=>iC(n),n.nullable=()=>Bp(n),n.nullish=()=>Hp(Bp(n)),n.nonoptional=t=>uC(n,t),n.array=()=>D(n),n.or=t=>B([n,t]),n.and=t=>el(n,t),n.transform=t=>Gp(n,nC(t)),n.default=t=>aC(n,t),n.prefault=t=>cC(n,t),n.catch=t=>dC(n,t),n.pipe=t=>Gp(n,t),n.readonly=()=>gC(n),n.describe=t=>{const r=n.clone();return Gi.add(r,{description:t}),r},Object.defineProperty(n,"description",{get(){var t;return(t=Gi.get(n))==null?void 0:t.description},configurable:!0}),n.meta=(...t)=>{if(t.length===0)return Gi.get(n);const r=n.clone();return Gi.add(r,t[0]),r},n.isOptional=()=>n.safeParse(void 0).success,n.isNullable=()=>n.safeParse(null).success,n.apply=t=>t(n),n)),Mm=x("_ZodString",(n,e)=>{eh.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(r,i,s)=>F$(n,r,i);const t=n._zod.bag;n.format=t.format??null,n.minLength=t.minimum??null,n.maxLength=t.maximum??null,n.regex=(...r)=>n.check(k$(...r)),n.includes=(...r)=>n.check(A$(...r)),n.startsWith=(...r)=>n.check($$(...r)),n.endsWith=(...r)=>n.check(T$(...r)),n.min=(...r)=>n.check(fa(...r)),n.max=(...r)=>n.check(Im(...r)),n.length=(...r)=>n.check(Pm(...r)),n.nonempty=(...r)=>n.check(fa(1,...r)),n.lowercase=r=>n.check(E$(r)),n.uppercase=r=>n.check(x$(r)),n.trim=()=>n.check(I$()),n.normalize=(...r)=>n.check(C$(...r)),n.toLowerCase=()=>n.check(P$()),n.toUpperCase=()=>n.check(R$()),n.slugify=()=>n.check(D$())}),$T=x("ZodString",(n,e)=>{eh.init(n,e),Mm.init(n,e),n.email=t=>n.check(jA(TT,t)),n.url=t=>n.check(JA(CT,t)),n.jwt=t=>n.check(p$(GT,t)),n.emoji=t=>n.check(QA(IT,t)),n.guid=t=>n.check(Lp(Fp,t)),n.uuid=t=>n.check(qA(Io,t)),n.uuidv4=t=>n.check(YA(Io,t)),n.uuidv6=t=>n.check(XA(Io,t)),n.uuidv7=t=>n.check(KA(Io,t)),n.nanoid=t=>n.check(e$(PT,t)),n.guid=t=>n.check(Lp(Fp,t)),n.cuid=t=>n.check(t$(RT,t)),n.cuid2=t=>n.check(n$(DT,t)),n.ulid=t=>n.check(r$(OT,t)),n.base64=t=>n.check(u$(ZT,t)),n.base64url=t=>n.check(h$(HT,t)),n.xid=t=>n.check(i$(LT,t)),n.ksuid=t=>n.check(s$(zT,t)),n.ipv4=t=>n.check(o$(MT,t)),n.ipv6=t=>n.check(a$(NT,t)),n.cidrv4=t=>n.check(l$(UT,t)),n.cidrv6=t=>n.check(c$(FT,t)),n.e164=t=>n.check(d$(BT,t)),n.datetime=t=>n.check(lT(t)),n.date=t=>n.check(uT(t)),n.time=t=>n.check(dT(t)),n.duration=t=>n.check(fT(t))});function d(n){return WA($T,n)}const ge=x("ZodStringFormat",(n,e)=>{le.init(n,e),Mm.init(n,e)}),TT=x("ZodEmail",(n,e)=>{Q1.init(n,e),ge.init(n,e)}),Fp=x("ZodGUID",(n,e)=>{K1.init(n,e),ge.init(n,e)}),Io=x("ZodUUID",(n,e)=>{J1.init(n,e),ge.init(n,e)}),CT=x("ZodURL",(n,e)=>{eA.init(n,e),ge.init(n,e)}),IT=x("ZodEmoji",(n,e)=>{tA.init(n,e),ge.init(n,e)}),PT=x("ZodNanoID",(n,e)=>{nA.init(n,e),ge.init(n,e)}),RT=x("ZodCUID",(n,e)=>{rA.init(n,e),ge.init(n,e)}),DT=x("ZodCUID2",(n,e)=>{iA.init(n,e),ge.init(n,e)}),OT=x("ZodULID",(n,e)=>{sA.init(n,e),ge.init(n,e)}),LT=x("ZodXID",(n,e)=>{oA.init(n,e),ge.init(n,e)}),zT=x("ZodKSUID",(n,e)=>{aA.init(n,e),ge.init(n,e)}),MT=x("ZodIPv4",(n,e)=>{dA.init(n,e),ge.init(n,e)}),NT=x("ZodIPv6",(n,e)=>{pA.init(n,e),ge.init(n,e)}),UT=x("ZodCIDRv4",(n,e)=>{fA.init(n,e),ge.init(n,e)}),FT=x("ZodCIDRv6",(n,e)=>{gA.init(n,e),ge.init(n,e)}),ZT=x("ZodBase64",(n,e)=>{mA.init(n,e),ge.init(n,e)}),HT=x("ZodBase64URL",(n,e)=>{yA.init(n,e),ge.init(n,e)}),BT=x("ZodE164",(n,e)=>{bA.init(n,e),ge.init(n,e)}),GT=x("ZodJWT",(n,e)=>{SA.init(n,e),ge.init(n,e)}),Nm=x("ZodNumber",(n,e)=>{Am.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(r,i,s)=>Z$(n,r,i),n.gt=(r,i)=>n.check(Mp(r,i)),n.gte=(r,i)=>n.check(Yl(r,i)),n.min=(r,i)=>n.check(Yl(r,i)),n.lt=(r,i)=>n.check(zp(r,i)),n.lte=(r,i)=>n.check(ql(r,i)),n.max=(r,i)=>n.check(ql(r,i)),n.int=r=>n.check(Zp(r)),n.safe=r=>n.check(Zp(r)),n.positive=r=>n.check(Mp(0,r)),n.nonnegative=r=>n.check(Yl(0,r)),n.negative=r=>n.check(zp(0,r)),n.nonpositive=r=>n.check(ql(0,r)),n.multipleOf=(r,i)=>n.check(Np(r,i)),n.step=(r,i)=>n.check(Np(r,i)),n.finite=()=>n;const t=n._zod.bag;n.minValue=Math.max(t.minimum??Number.NEGATIVE_INFINITY,t.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,n.maxValue=Math.min(t.maximum??Number.POSITIVE_INFINITY,t.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,n.isInt=(t.format??"").includes("int")||Number.isSafeInteger(t.multipleOf??.5),n.isFinite=!0,n.format=t.format??null});function Z(n){return y$(Nm,n)}const VT=x("ZodNumberFormat",(n,e)=>{_A.init(n,e),Nm.init(n,e)});function Zp(n){return b$(VT,n)}const WT=x("ZodBoolean",(n,e)=>{kA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>H$(n,t,r)});function Ee(n){return w$(WT,n)}const jT=x("ZodUnknown",(n,e)=>{EA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>G$()});function S(){return S$(jT)}const qT=x("ZodNever",(n,e)=>{xA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>B$(n,t,r)});function YT(n){return _$(qT,n)}const XT=x("ZodArray",(n,e)=>{AA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Y$(n,t,r,i),n.element=e.element,n.min=(t,r)=>n.check(fa(t,r)),n.nonempty=t=>n.check(fa(1,t)),n.max=(t,r)=>n.check(Im(t,r)),n.length=(t,r)=>n.check(Pm(t,r)),n.unwrap=()=>n.element});function D(n,e){return O$(XT,n,e)}const Um=x("ZodObject",(n,e)=>{TA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>X$(n,t,r,i),ee(n,"shape",()=>e.shape),n.keyof=()=>ma(Object.keys(n._zod.def.shape)),n.catchall=t=>n.clone({...n._zod.def,catchall:t}),n.passthrough=()=>n.clone({...n._zod.def,catchall:S()}),n.loose=()=>n.clone({...n._zod.def,catchall:S()}),n.strict=()=>n.clone({...n._zod.def,catchall:YT()}),n.strip=()=>n.clone({...n._zod.def,catchall:void 0}),n.extend=t=>Yx(n,t),n.safeExtend=t=>Xx(n,t),n.merge=t=>Kx(n,t),n.pick=t=>jx(n,t),n.omit=t=>qx(n,t),n.partial=(...t)=>Jx(Zm,n,t[0]),n.required=(...t)=>Qx(Hm,n,t[0])});function Fm(n,e){const t={type:"object",shape:n??{},...L(e)};return new Um(t)}function f(n,e){return new Um({type:"object",shape:n,catchall:S(),...L(e)})}const KT=x("ZodUnion",(n,e)=>{CA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>K$(n,t,r,i),n.options=e.options});function B(n,e){return new KT({type:"union",options:n,...L(e)})}const JT=x("ZodIntersection",(n,e)=>{IA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>J$(n,t,r,i)});function el(n,e){return new JT({type:"intersection",left:n,right:e})}const QT=x("ZodRecord",(n,e)=>{PA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Q$(n,t,r,i),n.keyType=e.keyType,n.valueType=e.valueType});function _(n,e,t){return new QT({type:"record",keyType:n,valueType:e,...L(t)})}const Rc=x("ZodEnum",(n,e)=>{RA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(r,i,s)=>V$(n,r,i),n.enum=e.entries,n.options=Object.values(e.entries);const t=new Set(Object.keys(e.entries));n.extract=(r,i)=>{const s={};for(const o of r)if(t.has(o))s[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new Rc({...e,checks:[],...L(i),entries:s})},n.exclude=(r,i)=>{const s={...e.entries};for(const o of r)if(t.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new Rc({...e,checks:[],...L(i),entries:s})}});function ma(n,e){const t=Array.isArray(n)?Object.fromEntries(n.map(r=>[r,r])):n;return new Rc({type:"enum",entries:t,...L(e)})}const eC=x("ZodLiteral",(n,e)=>{DA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>W$(n,t,r),n.values=new Set(e.values),Object.defineProperty(n,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function $(n,e){return new eC({type:"literal",values:Array.isArray(n)?n:[n],...L(e)})}const tC=x("ZodTransform",(n,e)=>{OA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>q$(n,t),n._zod.parse=(t,r)=>{if(r.direction==="backward")throw new um(n.constructor.name);t.addIssue=s=>{if(typeof s=="string")t.issues.push(ss(s,t.value,e));else{const o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=t.value),o.inst??(o.inst=n),t.issues.push(ss(o))}};const i=e.transform(t.value,t);return i instanceof Promise?i.then(s=>(t.value=s,t)):(t.value=i,t)}});function nC(n){return new tC({type:"transform",transform:n})}const Zm=x("ZodOptional",(n,e)=>{Cm.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Lm(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function Hp(n){return new Zm({type:"optional",innerType:n})}const rC=x("ZodExactOptional",(n,e)=>{LA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>Lm(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function iC(n){return new rC({type:"optional",innerType:n})}const sC=x("ZodNullable",(n,e)=>{zA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>eT(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function Bp(n){return new sC({type:"nullable",innerType:n})}const oC=x("ZodDefault",(n,e)=>{MA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>nT(n,t,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeDefault=n.unwrap});function aC(n,e){return new oC({type:"default",innerType:n,get defaultValue(){return typeof e=="function"?e():fm(e)}})}const lC=x("ZodPrefault",(n,e)=>{NA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>rT(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function cC(n,e){return new lC({type:"prefault",innerType:n,get defaultValue(){return typeof e=="function"?e():fm(e)}})}const Hm=x("ZodNonOptional",(n,e)=>{UA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>tT(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function uC(n,e){return new Hm({type:"nonoptional",innerType:n,...L(e)})}const hC=x("ZodCatch",(n,e)=>{FA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>iT(n,t,r,i),n.unwrap=()=>n._zod.def.innerType,n.removeCatch=n.unwrap});function dC(n,e){return new hC({type:"catch",innerType:n,catchValue:typeof e=="function"?e:()=>e})}const pC=x("ZodPipe",(n,e)=>{ZA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>sT(n,t,r,i),n.in=e.in,n.out=e.out});function Gp(n,e){return new pC({type:"pipe",in:n,out:e})}const fC=x("ZodReadonly",(n,e)=>{HA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>oT(n,t,r,i),n.unwrap=()=>n._zod.def.innerType});function gC(n){return new fC({type:"readonly",innerType:n})}const mC=x("ZodCustom",(n,e)=>{BA.init(n,e),fe.init(n,e),n._zod.processJSONSchema=(t,r,i)=>j$(n,t)});function vC(n,e={}){return L$(mC,n,e)}function yC(n){return z$(n)}const bC=["text/markdown","text/html"],wC=["committed","pending"];Fm({id:d().min(1),type:ma(bC),title:d(),status:ma(wC),externalFilePath:d().optional()});Fm({name:d().min(1),description:d(),accepts:D(d().min(1)).min(1)});function oo(n){return typeof n=="object"&&n!==null}function SC(n){return!oo(n)||n.type!=="ready"?!1:!("id"in n)}function _C(n){return!(!oo(n)||n.type!=="update-content"||typeof n.id!="string"||typeof n.content!="string")}function kC(n){return!oo(n)||n.type!=="wheel"||typeof n.deltaX!="number"||typeof n.deltaY!="number"||typeof n.shiftKey!="boolean"?!1:!("id"in n)}function EC(n){return!oo(n)||n.type!=="swipe-move"||typeof n.deltaX!="number"?!1:!("id"in n)}function xC(n){return!oo(n)||n.type!=="swipe-end"||typeof n.velocityX!="number"?!1:!("id"in n)}function AC(n,e){if(n===e)return 2;if(n==="*/*")return 0;const t=n.indexOf("/");if(t>0&&n.slice(t+1)==="*"){const r=n.slice(0,t),i=e.indexOf("/");if(i>0&&e.slice(0,i)===r)return 1}return null}function $C(n,e){let t=null;for(const r of n.accepts){const i=AC(r,e);i!==null&&(t===null||i>t)&&(t=i)}return t}function TC(n,e){let t=-1,r=null;for(const i of e){const s=$C(i,n);s!==null&&(s>t||s===t&&r!==null&&i.id<r.id)&&(t=s,r=i)}return r}const CC=4401;class Dc extends Error{constructor(e="Authentication required"){super(e),this.name="AuthError"}}class Oc extends bt{constructor(t){super();b(this,"url");b(this,"name");b(this,"token");b(this,"status","disconnected");b(this,"screens",new Map);b(this,"views",[]);b(this,"client");b(this,"createSocket");b(this,"createClient");b(this,"socket",null);b(this,"connectAttempt",0);this.url=$t(t.url),this.name=t.name,this.token=t.token??null,this.createSocket=t.createSocket??(r=>new WebSocket(r)),this.createClient=t.createClient??((r,i)=>new Ix(r,{token:i??void 0})),this.client=this.createClient(this.url,this.token)}async connect(){var i;this.connectAttempt+=1;const t=this.connectAttempt;(i=this.socket)==null||i.close(),this.client=this.createClient(this.url,this.token),this.status="connecting",this.dispatchEvent(new K("change"));const r=this.createSocket(IC(this.url,this.token));return this.socket=r,await new Promise((s,o)=>{let a=!1;const l=()=>{a||this.connectAttempt!==t||(a=!0,this.status="connected",this.dispatchEvent(new K("change")),s())},u=p=>{a||this.connectAttempt!==t||(a=!0,this.status="disconnected",this.dispatchEvent(new K("change")),o(p))},h=async()=>{try{const[{screens:p},g]=await Promise.all([this.client.screens.list(),this.client.views.list()]);this.screens=new Map(p.map(m=>[m.id,structuredClone(m)])),this.views=g,this.dispatchEvent(new K("change")),l()}catch(p){u(p instanceof Error?p:new Error(String(p)))}};r.addEventListener("open",()=>{h()}),r.addEventListener("message",p=>{const g=RC(p);g&&(this.applyServerEvent(g),this.dispatchEvent(new nm("server-event",{serverURL:this.url,event:g})))}),r.addEventListener("close",p=>{if(this.connectAttempt===t){if(this.socket=null,PC(p)===CC){u(new Dc);return}if(!a){u(new Error("Connection closed before initialization"));return}this.status="disconnected",this.dispatchEvent(new K("change"))}}),r.addEventListener("error",()=>{u(new Error("WebSocket connection failed"))})})}disconnect(){var t;this.connectAttempt+=1,(t=this.socket)==null||t.close(),this.socket=null,this.status="disconnected",this.dispatchEvent(new K("change"))}getViewURL(t){const r=TC(t.type,this.views);if(!r)return null;const i=`${this.url}/views/${encodeURIComponent(r.id)}/`;return this.token===null?i:`${i}?token=${encodeURIComponent(this.token)}`}getContentURL(t){const r=`${this.url}/artifacts/${encodeURIComponent(t)}/content`;return this.token===null?r:`${r}?token=${encodeURIComponent(this.token)}`}async createScreen(t){const{screen:r}=await this.client.screens.create({name:t});return this.screens.set(r.id,structuredClone(r)),r}applyServerEvent(t){switch(t.type){case"screen-created":this.screens.set(t.screen.id,structuredClone(t.screen)),this.dispatchEvent(new qo("screens-changed"));break;case"screen-updated":this.screens.set(t.screen.id,structuredClone(t.screen)),this.dispatchEvent(new qo("screens-changed"));break;case"screen-removed":this.screens.delete(t.screenID),this.dispatchEvent(new qo("screens-changed"));break;case"artifact-created":break;case"artifact-attached":{const r=this.screens.get(t.screenID);r&&!Qg(r.layout,t.artifact.id)&&(r.layout=[...r.layout,Jg(t.artifact.id,{id:t.cardID})]);break}case"artifact-removed":{const r=this.screens.get(t.screenID);r&&(r.layout=Bg(r.layout,t.artifactID));break}}}}function IC(n,e){const t=new URL(n);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.pathname="/events",t.search="",e&&t.searchParams.set("token",e),t.hash="",t.toString()}function PC(n){return typeof n=="object"&&n!==null&&"code"in n&&typeof n.code=="number"?n.code:null}function RC(n){const e=typeof n=="string"?n:typeof n=="object"&&n!==null&&"data"in n&&typeof n.data=="string"?n.data:"";if(!e)return null;try{return JSON.parse(e)}catch{return null}}class DC extends bt{constructor(t){super();b(this,"servers",new Map);b(this,"localServerURL");b(this,"localStore");b(this,"createSocket");b(this,"lastActiveServerURL");b(this,"serverListeners",new Map);b(this,"handleLocalStoreChange",()=>{const t=this.localStore.get().activeServerURL;t!==this.lastActiveServerURL&&(this.lastActiveServerURL=t,this.dispatchEvent(new K("change")))});this.localStore=t.localStore,this.localServerURL=t.localServerURL?$t(t.localServerURL):null,this.createSocket=t.createSocket??(r=>new WebSocket(r)),this.lastActiveServerURL=this.localStore.get().activeServerURL,this.localStore.addEventListener("change",this.handleLocalStoreChange)}get activeServer(){const t=this.localStore.get().activeServerURL;return t===null?null:this.servers.get(t)??null}add(t){const r=$t(t.url);this.servers.get(r)&&this.remove(r),this.servers.set(r,t);const s=()=>{this.dispatchEvent(new K("change"))},o=l=>{this.dispatchEvent(new nm("server-event",{serverURL:l.serverURL,event:l.event}))},a=()=>{this.dispatchEvent(new qo("screens-changed"))};t.addEventListener("change",s),t.addEventListener("server-event",o),t.addEventListener("screens-changed",a),this.serverListeners.set(r,{onServerChange:s,onServerEvent:o,onScreensChanged:a}),this.dispatchEvent(new K("change"))}remove(t){const r=$t(t);if(this.localServerURL&&r===this.localServerURL)return;const i=this.servers.get(r);if(!i)return;const s=this.serverListeners.get(r);s&&(i.removeEventListener("change",s.onServerChange),i.removeEventListener("server-event",s.onServerEvent),i.removeEventListener("screens-changed",s.onScreensChanged),this.serverListeners.delete(r)),i.disconnect(),this.servers.delete(r);const o=this.localStore.get(),a=o.activeServerURL===r;this.localStore.set({...o,servers:o.servers.filter(l=>l.url!==r),activeServerURL:a?null:o.activeServerURL}),this.dispatchEvent(new K("change"))}setActive(t){const r=this.localStore.get(),i=t?$t(t.url):null;r.activeServerURL!==i&&this.localStore.set({...r,activeServerURL:i})}connectConfiguredServers(t,r){const i=this.localStore.get().servers,s=t?$t(t):null;for(const a of i){const l=$t(a.url),u=s!==null&&l===s,h=new Oc({url:a.url,name:a.name,token:u?r??null:null,createSocket:this.createSocket});this.add(h),h.connect().catch(()=>{})}const o=s?this.servers.get(s)??null:null;this.setActive(o??this.servers.values().next().value??null)}addServer(t,r){const i=$t(t);this.remove(i);const s=this.localStore.get();this.localStore.set({...s,servers:[...s.servers.filter(a=>$t(a.url)!==i),{url:i,name:r}]});const o=new Oc({url:i,name:r,createSocket:this.createSocket});this.add(o),this.setActive(o),o.connect().catch(()=>{})}removeServer(t){this.remove(t)}}const ae={authenticate:"authenticate",document_did_change:"document/didChange",document_did_close:"document/didClose",document_did_focus:"document/didFocus",document_did_open:"document/didOpen",document_did_save:"document/didSave",initialize:"initialize",logout:"logout",nes_accept:"nes/accept",nes_close:"nes/close",nes_reject:"nes/reject",nes_start:"nes/start",nes_suggest:"nes/suggest",session_cancel:"session/cancel",session_close:"session/close",session_fork:"session/fork",session_list:"session/list",session_load:"session/load",session_new:"session/new",session_prompt:"session/prompt",session_resume:"session/resume",session_set_config_option:"session/set_config_option",session_set_mode:"session/set_mode",session_set_model:"session/set_model"},Ft={fs_read_text_file:"fs/read_text_file",fs_write_text_file:"fs/write_text_file",session_request_permission:"session/request_permission",session_update:"session/update",terminal_create:"terminal/create",terminal_kill:"terminal/kill",terminal_output:"terminal/output",terminal_release:"terminal/release",terminal_wait_for_exit:"terminal/wait_for_exit"},OC=1,LC=f({_meta:_(d(),S()).nullish(),terminal:Ee().optional().default(!1)}),zC=f({_meta:_(d(),S()).nullish(),label:d().nullish(),name:d(),optional:Ee().optional().default(!1),secret:Ee().optional().default(!0)}),MC=f({_meta:_(d(),S()).nullish(),description:d().nullish(),id:d(),name:d()}),NC=f({_meta:_(d(),S()).nullish(),description:d().nullish(),id:d(),link:d().nullish(),name:d(),vars:D(zC)}),UC=f({_meta:_(d(),S()).nullish(),args:D(d()).optional(),description:d().nullish(),env:_(d(),d()).optional(),id:d(),name:d()}),FC=B([NC.and(f({type:$("env_var")})),UC.and(f({type:$("terminal")})),MC]),ZC=f({_meta:_(d(),S()).nullish(),methodId:d()}),HC=f({_meta:_(d(),S()).nullish()}),BC=f({_meta:_(d(),S()).nullish(),blob:d(),mimeType:d().nullish(),uri:d()}),GC=f({default:Ee().nullish(),description:d().nullish(),title:d().nullish()}),VC=f({_meta:_(d(),S()).nullish()}),WC=f({_meta:_(d(),S()).nullish()}),jC=f({amount:Z(),currency:d()}),qC=f({_meta:_(d(),S()).nullish(),terminalId:d()}),YC=f({_meta:_(d(),S()).nullish(),newText:d(),oldText:d().nullish(),path:d()}),XC=B([d(),Z(),Z(),Ee(),D(d())]),KC=f({content:_(d(),XC).nullish()}),JC=B([KC.and(f({action:$("accept")})),f({action:$("decline")}),f({action:$("cancel")})]),QC=f({_meta:_(d(),S()).nullish()}),Bm=d(),eI=f({_meta:_(d(),S()).nullish(),elicitationId:Bm}),tI=f({_meta:_(d(),S()).nullish(),action:JC}),nI=$("object"),rI=$("string"),iI=f({_meta:_(d(),S()).nullish()}),sI=f({_meta:_(d(),S()).nullish(),form:QC.nullish(),url:iI.nullish()}),oI=f({elicitationId:Bm,url:d().url()}),Gm=f({const:d(),title:d()}),Vm=f({_meta:_(d(),S()).nullish(),name:d(),value:d()}),aI=B([$(-32700),$(-32600),$(-32601),$(-32602),$(-32603),$(-32800),$(-32e3),$(-32002),$(-32042),Z().int().min(-2147483648,{message:"Invalid value: Expected int32 to be >= -2147483648"}).max(2147483647,{message:"Invalid value: Expected int32 to be <= 2147483647"})]),Wm=f({code:aI,data:S().optional(),message:d()}),jm=S(),qm=S(),Ym=S(),lI=f({_meta:_(d(),S()).nullish(),readTextFile:Ee().optional().default(!1),writeTextFile:Ee().optional().default(!1)}),Xm=f({_meta:_(d(),S()).nullish(),name:d(),value:d()}),Km=f({_meta:_(d(),S()).nullish(),name:d(),title:d().nullish(),version:d()}),cI=f({default:Z().nullish(),description:d().nullish(),maximum:Z().nullish(),minimum:Z().nullish(),title:d().nullish()}),uI=f({_meta:_(d(),S()).nullish()}),hI=f({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cursor:d().nullish(),cwd:d().nullish()}),dI=f({_meta:_(d(),S()).nullish()}),pI=f({_meta:_(d(),S()).nullish(),logout:dI.nullish()}),fI=f({_meta:_(d(),S()).nullish()}),gI=f({_meta:_(d(),S()).nullish()}),mI=f({_meta:_(d(),S()).nullish(),http:Ee().optional().default(!1),sse:Ee().optional().default(!1)}),vI=f({_meta:_(d(),S()).nullish(),headers:D(Xm),name:d(),url:d()}),yI=f({_meta:_(d(),S()).nullish(),headers:D(Xm),name:d(),url:d()}),bI=f({_meta:_(d(),S()).nullish(),args:D(d()),command:d(),env:D(Vm),name:d()}),tl=B([vI.and(f({type:$("http")})),yI.and(f({type:$("sse")})),bI]),th=d(),wI=f({_meta:_(d(),S()).nullish(),description:d().nullish(),modelId:th,name:d()}),SI=B([$("error"),$("warning"),$("information"),$("hint")]),_I=f({_meta:_(d(),S()).nullish()}),kI=f({_meta:_(d(),S()).nullish()}),EI=f({_meta:_(d(),S()).nullish()}),xI=f({_meta:_(d(),S()).nullish()}),AI=f({_meta:_(d(),S()).nullish()}),$I=f({_meta:_(d(),S()).nullish(),maxCount:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),TI=f({diff:d(),uri:d()}),CI=f({endLine:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),startLine:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),text:d()}),II=f({_meta:_(d(),S()).nullish()}),PI=f({_meta:_(d(),S()).nullish()}),RI=f({languageId:d(),text:d(),uri:d()}),DI=f({_meta:_(d(),S()).nullish(),maxCount:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),OI=B([$("rejected"),$("ignored"),$("replaced"),$("cancelled")]),LI=f({excerpts:D(CI),uri:d()}),zI=f({_meta:_(d(),S()).nullish()}),MI=f({_meta:_(d(),S()).nullish()}),NI=f({name:d(),owner:d(),remoteUrl:d()}),UI=f({_meta:_(d(),S()).nullish()}),FI=f({_meta:_(d(),S()).nullish(),jump:II.nullish(),rename:MI.nullish(),searchAndReplace:UI.nullish()}),ZI=f({id:d(),isRegex:Ee().nullish(),replace:d(),search:d(),uri:d()}),HI=B([$("automatic"),$("diagnostic"),$("manual")]),BI=f({_meta:_(d(),S()).nullish(),maxCount:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish()}),GI=f({_meta:_(d(),S()).nullish(),diagnostics:_I.nullish(),editHistory:$I.nullish(),openFiles:PI.nullish(),recentFiles:DI.nullish(),relatedSnippets:zI.nullish(),userActions:BI.nullish()}),VI=f({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(tl)}),WI=f({default:Z().nullish(),description:d().nullish(),maximum:Z().nullish(),minimum:Z().nullish(),title:d().nullish()}),Jm=d(),jI=B([$("allow_once"),$("allow_always"),$("reject_once"),$("reject_always")]),qI=f({_meta:_(d(),S()).nullish(),kind:jI,name:d(),optionId:Jm}),YI=B([$("high"),$("medium"),$("low")]),XI=B([$("pending"),$("in_progress"),$("completed")]),KI=f({_meta:_(d(),S()).nullish(),content:d(),priority:YI,status:XI}),JI=f({_meta:_(d(),S()).nullish(),entries:D(KI)}),bn=f({character:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}),line:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"})}),QI=f({id:d(),position:bn,uri:d()}),eP=f({id:d(),newName:d(),position:bn,uri:d()}),tP=f({action:d(),position:bn,timestampMs:Z(),uri:d()}),Qm=B([$("utf-16"),$("utf-32"),$("utf-8")]),nP=f({_meta:_(d(),S()).nullish(),auth:LC.optional().default({terminal:!1}),elicitation:sI.nullish(),fs:lI.optional().default({readTextFile:!1,writeTextFile:!1}),nes:FI.nullish(),positionEncodings:D(Qm).optional(),terminal:Ee().optional().default(!1)}),rP=f({_meta:_(d(),S()).nullish(),audio:Ee().optional().default(!1),embeddedContext:Ee().optional().default(!1),image:Ee().optional().default(!1)}),ev=Z().int().gte(0).lte(65535),iP=f({_meta:_(d(),S()).nullish(),clientCapabilities:nP.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:Km.nullish(),protocolVersion:ev}),xi=f({end:bn,start:bn}),sP=f({message:d(),range:xi,severity:SI,uri:d()}),oP=f({languageId:d(),lastFocusedMs:Z().nullish(),uri:d(),visibleRange:xi.nullish()}),aP=f({_meta:_(d(),S()).nullish(),diagnostics:D(sP).nullish(),editHistory:D(TI).nullish(),openFiles:D(oP).nullish(),recentFiles:D(RI).nullish(),relatedSnippets:D(LI).nullish(),userActions:D(tP).nullish()}),lP=f({newText:d(),range:xi}),cP=f({cursorPosition:bn.nullish(),edits:D(lP),id:d(),uri:d()}),uP=B([cP.and(f({kind:$("edit")})),QI.and(f({kind:$("jump")})),eP.and(f({kind:$("rename")})),ZI.and(f({kind:$("searchAndReplace")}))]),hP=f({_meta:_(d(),S()).nullish(),content:d()}),dP=f({_meta:_(d(),S()).nullish()}),dr=B([Z(),d()]).nullable();f({_meta:_(d(),S()).nullish(),requestId:dr});const pP=ma(["assistant","user"]),ao=f({_meta:_(d(),S()).nullish(),audience:D(pP).nullish(),lastModified:d().nullish(),priority:Z().nullish()}),fP=f({_meta:_(d(),S()).nullish(),annotations:ao.nullish(),data:d(),mimeType:d()}),gP=f({_meta:_(d(),S()).nullish(),annotations:ao.nullish(),data:d(),mimeType:d(),uri:d().nullish()}),mP=f({_meta:_(d(),S()).nullish(),annotations:ao.nullish(),description:d().nullish(),mimeType:d().nullish(),name:d(),size:Z().nullish(),title:d().nullish(),uri:d()}),vP=f({_meta:_(d(),S()).nullish(),optionId:Jm}),yP=B([f({outcome:$("cancelled")}),vP.and(f({outcome:$("selected")}))]),bP=f({_meta:_(d(),S()).nullish(),outcome:yP}),wP=f({_meta:_(d(),S()).nullish()}),SP=f({_meta:_(d(),S()).nullish()}),_P=f({currentValue:Ee()}),kP=d(),tv=d(),EP=B([$("mode"),$("model"),$("thought_level"),d()]),nh=d(),nv=f({_meta:_(d(),S()).nullish(),description:d().nullish(),name:d(),value:nh}),xP=f({_meta:_(d(),S()).nullish(),group:kP,name:d(),options:D(nv)}),AP=B([D(nv),D(xP)]),$P=f({currentValue:nh,options:AP}),Ai=el(B([$P.and(f({type:$("select")})),_P.and(f({type:$("boolean")}))]),f({_meta:_(d(),S()).nullish(),category:EP.nullish(),description:d().nullish(),id:tv,name:d()})),TP=f({_meta:_(d(),S()).nullish(),configOptions:D(Ai)}),CP=f({_meta:_(d(),S()).nullish()}),X=d(),IP=f({_meta:_(d(),S()).nullish(),id:d(),sessionId:X}),PP=f({_meta:_(d(),S()).nullish(),sessionId:X}),RP=f({_meta:_(d(),S()).nullish(),sessionId:X}),DP=f({_meta:_(d(),S()).nullish(),sessionId:X}),rv=f({_meta:_(d(),S()).nullish(),args:D(d()).optional(),command:d(),cwd:d().nullish(),env:D(Vm).optional(),outputByteLimit:Z().nullish(),sessionId:X}),OP=f({_meta:_(d(),S()).nullish(),sessionId:X,uri:d()}),LP=f({_meta:_(d(),S()).nullish(),position:bn,sessionId:X,uri:d(),version:Z(),visibleRange:xi}),zP=f({_meta:_(d(),S()).nullish(),languageId:d(),sessionId:X,text:d(),uri:d(),version:Z()}),MP=f({_meta:_(d(),S()).nullish(),sessionId:X,uri:d()}),NP=f({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(tl).optional(),sessionId:X}),iv=f({_meta:_(d(),S()).nullish(),sessionId:X,terminalId:d()}),UP=f({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(tl),sessionId:X}),sv=f({_meta:_(d(),S()).nullish(),limit:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),line:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:d(),sessionId:X}),FP=f({_meta:_(d(),S()).nullish(),id:d(),reason:OI.nullish(),sessionId:X}),ov=f({_meta:_(d(),S()).nullish(),sessionId:X,terminalId:d()}),ZP=f({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),mcpServers:D(tl).optional(),sessionId:X}),HP=f({_meta:_(d(),S()).nullish(),additionalDirectories:D(d()).optional(),cwd:d(),sessionId:X,title:d().nullish(),updatedAt:d().nullish()}),BP=f({_meta:_(d(),S()).nullish(),nextCursor:d().nullish(),sessions:D(HP)}),GP=f({_meta:_(d(),S()).nullish(),title:d().nullish(),updatedAt:d().nullish()}),VP=f({_meta:_(d(),S()).nullish()}),nl=d(),WP=f({_meta:_(d(),S()).nullish(),currentModeId:nl}),jP=f({_meta:_(d(),S()).nullish(),description:d().nullish(),id:nl,name:d()}),rl=f({_meta:_(d(),S()).nullish(),availableModes:D(jP),currentModeId:nl}),il=f({_meta:_(d(),S()).nullish(),availableModels:D(wI),currentModelId:th}),qP=f({_meta:_(d(),S()).nullish(),configOptions:D(Ai).nullish(),models:il.nullish(),modes:rl.nullish(),sessionId:X}),YP=f({_meta:_(d(),S()).nullish(),configOptions:D(Ai).nullish(),models:il.nullish(),modes:rl.nullish()}),XP=f({_meta:_(d(),S()).nullish(),configOptions:D(Ai).nullish(),models:il.nullish(),modes:rl.nullish(),sessionId:X}),KP=f({_meta:_(d(),S()).nullish(),configOptions:D(Ai).nullish(),models:il.nullish(),modes:rl.nullish()}),JP=f({_meta:_(d(),S()).nullish()}),QP=f({_meta:_(d(),S()).nullish(),additionalDirectories:wP.nullish(),close:SP.nullish(),fork:CP.nullish(),list:VP.nullish(),resume:JP.nullish()}),eR=el(B([f({type:$("boolean"),value:Ee()}),f({value:nh})]),f({_meta:_(d(),S()).nullish(),configId:tv,sessionId:X})),tR=f({_meta:_(d(),S()).nullish(),configOptions:D(Ai)}),nR=f({_meta:_(d(),S()).nullish(),modeId:nl,sessionId:X}),rR=f({_meta:_(d(),S()).nullish()}),iR=f({_meta:_(d(),S()).nullish(),modelId:th,sessionId:X}),sR=f({_meta:_(d(),S()).nullish()}),oR=f({_meta:_(d(),S()).nullish(),sessionId:X}),aR=B([$("end_turn"),$("max_tokens"),$("max_turn_requests"),$("refusal"),$("cancelled")]),lR=B([$("email"),$("uri"),$("date"),$("date-time")]),cR=f({default:d().nullish(),description:d().nullish(),enum:D(d()).nullish(),format:lR.nullish(),maxLength:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),minLength:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),oneOf:D(Gm).nullish(),pattern:d().nullish(),title:d().nullish()}),uR=f({_meta:_(d(),S()).nullish(),context:aP.nullish(),position:bn,selection:xi.nullish(),sessionId:X,triggerKind:HI,uri:d(),version:Z()}),hR=f({_meta:_(d(),S()).nullish(),suggestions:D(uP)}),dR=f({_meta:_(d(),S()).nullish(),terminalId:d()}),pR=f({_meta:_(d(),S()).nullish(),exitCode:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:d().nullish()}),av=f({_meta:_(d(),S()).nullish(),sessionId:X,terminalId:d()}),fR=f({_meta:_(d(),S()).nullish(),exitStatus:pR.nullish(),output:d(),truncated:Ee()}),gR=f({_meta:_(d(),S()).nullish(),annotations:ao.nullish(),text:d()}),mR=f({range:xi.nullish(),text:d()}),vR=f({_meta:_(d(),S()).nullish(),contentChanges:D(mR),sessionId:X,uri:d(),version:Z()});f({method:d(),params:B([PP,zP,vR,OP,MP,LP,IP,FP,jm]).nullish()});const yR=B([$("full"),$("incremental")]),bR=f({_meta:_(d(),S()).nullish(),syncKind:yR}),wR=f({_meta:_(d(),S()).nullish(),didChange:bR.nullish(),didClose:kI.nullish(),didFocus:EI.nullish(),didOpen:xI.nullish(),didSave:AI.nullish()}),SR=f({_meta:_(d(),S()).nullish(),document:wR.nullish()}),_R=f({_meta:_(d(),S()).nullish(),context:GI.nullish(),events:SR.nullish()}),kR=f({_meta:_(d(),S()).nullish(),auth:pI.optional().default({}),loadSession:Ee().optional().default(!1),mcpCapabilities:mI.optional().default({http:!1,sse:!1}),nes:_R.nullish(),positionEncoding:Qm.nullish(),promptCapabilities:rP.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:QP.optional().default({})}),ER=f({_meta:_(d(),S()).nullish(),agentCapabilities:kR.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:Km.nullish(),authMethods:D(FC).optional().default([]),protocolVersion:ev}),xR=f({_meta:_(d(),S()).nullish(),mimeType:d().nullish(),text:d(),uri:d()}),AR=B([xR,BC]),$R=f({_meta:_(d(),S()).nullish(),annotations:ao.nullish(),resource:AR}),rh=B([gR.and(f({type:$("text")})),gP.and(f({type:$("image")})),fP.and(f({type:$("audio")})),mP.and(f({type:$("resource_link")})),$R.and(f({type:$("resource")}))]),TR=f({_meta:_(d(),S()).nullish(),content:rh}),Xl=f({_meta:_(d(),S()).nullish(),content:rh,messageId:d().nullish()}),CR=f({_meta:_(d(),S()).nullish(),messageId:d().nullish(),prompt:D(rh),sessionId:X}),IR=f({anyOf:D(Gm)}),lv=B([TR.and(f({type:$("content")})),YC.and(f({type:$("diff")})),dR.and(f({type:$("terminal")}))]),cv=d(),uv=f({_meta:_(d(),S()).nullish(),line:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),path:d()}),hv=B([$("pending"),$("in_progress"),$("completed"),$("failed")]),dv=B([$("read"),$("edit"),$("delete"),$("move"),$("search"),$("execute"),$("think"),$("fetch"),$("switch_mode"),$("other")]),PR=f({_meta:_(d(),S()).nullish(),content:D(lv).optional(),kind:dv.optional(),locations:D(uv).optional(),rawInput:S().optional(),rawOutput:S().optional(),status:hv.optional(),title:d(),toolCallId:cv}),pv=f({_meta:_(d(),S()).nullish(),content:D(lv).nullish(),kind:dv.nullish(),locations:D(uv).nullish(),rawInput:S().optional(),rawOutput:S().optional(),status:hv.nullish(),title:d().nullish(),toolCallId:cv}),fv=f({_meta:_(d(),S()).nullish(),options:D(qI),sessionId:X,toolCall:pv}),RR=f({_meta:_(d(),S()).nullish(),hint:d()}),DR=RR,OR=f({_meta:_(d(),S()).nullish(),description:d(),input:DR.nullish(),name:d()}),LR=f({_meta:_(d(),S()).nullish(),availableCommands:D(OR)}),zR=f({enum:D(d()),type:rI}),MR=B([zR,IR]),NR=f({default:D(d()).nullish(),description:d().nullish(),items:MR,maxItems:Z().nullish(),minItems:Z().nullish(),title:d().nullish()}),UR=B([cR.and(f({type:$("string")})),WI.and(f({type:$("number")})),cI.and(f({type:$("integer")})),GC.and(f({type:$("boolean")})),NR.and(f({type:$("array")}))]),FR=f({description:d().nullish(),properties:_(d(),UR).optional().default({}),required:D(d()).nullish(),title:d().nullish(),type:nI.optional().default("object")}),ZR=f({requestedSchema:FR}),HR=el(B([ZR.and(f({mode:$("form")})),oI.and(f({mode:$("url")}))]),f({_meta:_(d(),S()).nullish(),message:d(),sessionId:X})),BR=f({cachedReadTokens:Z().nullish(),cachedWriteTokens:Z().nullish(),inputTokens:Z(),outputTokens:Z(),thoughtTokens:Z().nullish(),totalTokens:Z()}),GR=f({_meta:_(d(),S()).nullish(),stopReason:aR,usage:BR.nullish(),userMessageId:d().nullish()});B([f({id:dr,result:B([ER,HC,gI,XP,YP,BP,qP,KP,WC,rR,tR,GR,sR,oR,hR,VC,Ym])}),f({error:Wm,id:dr})]);const VR=f({_meta:_(d(),S()).nullish(),cost:jC.nullish(),size:Z(),used:Z()}),WR=B([Xl.and(f({sessionUpdate:$("user_message_chunk")})),Xl.and(f({sessionUpdate:$("agent_message_chunk")})),Xl.and(f({sessionUpdate:$("agent_thought_chunk")})),PR.and(f({sessionUpdate:$("tool_call")})),pv.and(f({sessionUpdate:$("tool_call_update")})),JI.and(f({sessionUpdate:$("plan")})),LR.and(f({sessionUpdate:$("available_commands_update")})),WP.and(f({sessionUpdate:$("current_mode_update")})),TP.and(f({sessionUpdate:$("config_option_update")})),GP.and(f({sessionUpdate:$("session_info_update")})),VR.and(f({sessionUpdate:$("usage_update")}))]),gv=f({_meta:_(d(),S()).nullish(),sessionId:X,update:WR});f({method:d(),params:B([gv,eI,jm]).nullish()});const mv=f({_meta:_(d(),S()).nullish(),sessionId:X,terminalId:d()}),jR=f({_meta:_(d(),S()).nullish(),exitCode:Z().int().gte(0).max(4294967295,{message:"Invalid value: Expected uint32 to be <= 4294967295"}).nullish(),signal:d().nullish()}),qR=f({name:d(),uri:d()}),YR=f({_meta:_(d(),S()).nullish(),repository:NI.nullish(),workspaceFolders:D(qR).nullish(),workspaceUri:d().nullish()});f({id:dr,method:d(),params:B([iP,ZC,fI,VI,UP,hI,NP,ZP,DP,nR,eR,CR,iR,YR,uR,RP,qm]).nullish()});const vv=f({_meta:_(d(),S()).nullish(),content:d(),path:d(),sessionId:X});f({id:dr,method:d(),params:B([vv,sv,fv,rv,av,ov,mv,iv,HR,qm]).nullish()});const XR=f({_meta:_(d(),S()).nullish()});B([f({id:dr,result:B([XR,hP,bP,qC,fR,dP,jR,uI,tI,Ym])}),f({error:Wm,id:dr})]);var Y;class KR{constructor(e,t){w(this,Y);const r=e(this),i=async(o,a)=>{var l,u,h,p,g,m,A;switch(o){case Ft.fs_write_text_file:{const k=vv.parse(a);return(l=r.writeTextFile)==null?void 0:l.call(r,k)}case Ft.fs_read_text_file:{const k=sv.parse(a);return(u=r.readTextFile)==null?void 0:u.call(r,k)}case Ft.session_request_permission:{const k=fv.parse(a);return r.requestPermission(k)}case Ft.terminal_create:{const k=rv.parse(a);return(h=r.createTerminal)==null?void 0:h.call(r,k)}case Ft.terminal_output:{const k=av.parse(a);return(p=r.terminalOutput)==null?void 0:p.call(r,k)}case Ft.terminal_release:{const k=ov.parse(a);return await((g=r.releaseTerminal)==null?void 0:g.call(r,k))??{}}case Ft.terminal_wait_for_exit:{const k=mv.parse(a);return(m=r.waitForTerminalExit)==null?void 0:m.call(r,k)}case Ft.terminal_kill:{const k=iv.parse(a);return await((A=r.killTerminal)==null?void 0:A.call(r,k))??{}}default:if(r.extMethod)return r.extMethod(o,a);throw Se.methodNotFound(o)}},s=async(o,a)=>{switch(o){case Ft.session_update:{const l=gv.parse(a);return r.sessionUpdate(l)}default:if(r.extNotification)return r.extNotification(o,a);throw Se.methodNotFound(o)}};E(this,Y,new JR(i,s,t))}async initialize(e){return await c(this,Y).sendRequest(ae.initialize,e)}async newSession(e){return await c(this,Y).sendRequest(ae.session_new,e)}async loadSession(e){return await c(this,Y).sendRequest(ae.session_load,e)??{}}async unstable_forkSession(e){return await c(this,Y).sendRequest(ae.session_fork,e)}async listSessions(e){return await c(this,Y).sendRequest(ae.session_list,e)}async unstable_resumeSession(e){return await c(this,Y).sendRequest(ae.session_resume,e)}async unstable_closeSession(e){return await c(this,Y).sendRequest(ae.session_close,e)}async setSessionMode(e){return await c(this,Y).sendRequest(ae.session_set_mode,e)??{}}async unstable_setSessionModel(e){return await c(this,Y).sendRequest(ae.session_set_model,e)??{}}async setSessionConfigOption(e){return await c(this,Y).sendRequest(ae.session_set_config_option,e)}async authenticate(e){return await c(this,Y).sendRequest(ae.authenticate,e)??{}}async unstable_logout(e){return await c(this,Y).sendRequest(ae.logout,e)??{}}async prompt(e){return await c(this,Y).sendRequest(ae.session_prompt,e)}async cancel(e){return await c(this,Y).sendNotification(ae.session_cancel,e)}async unstable_startNes(e){return await c(this,Y).sendRequest(ae.nes_start,e)}async unstable_suggestNes(e){return await c(this,Y).sendRequest(ae.nes_suggest,e)}async unstable_closeNes(e){return await c(this,Y).sendRequest(ae.nes_close,e)??{}}async unstable_didOpenDocument(e){return await c(this,Y).sendNotification(ae.document_did_open,e)}async unstable_didChangeDocument(e){return await c(this,Y).sendNotification(ae.document_did_change,e)}async unstable_didCloseDocument(e){return await c(this,Y).sendNotification(ae.document_did_close,e)}async unstable_didSaveDocument(e){return await c(this,Y).sendNotification(ae.document_did_save,e)}async unstable_didFocusDocument(e){return await c(this,Y).sendNotification(ae.document_did_focus,e)}async unstable_acceptNes(e){return await c(this,Y).sendNotification(ae.nes_accept,e)}async unstable_rejectNes(e){return await c(this,Y).sendNotification(ae.nes_reject,e)}async extMethod(e,t){return await c(this,Y).sendRequest(e,t)}async extNotification(e,t){return await c(this,Y).sendNotification(e,t)}get signal(){return c(this,Y).signal}get closed(){return c(this,Y).closed}}Y=new WeakMap;var ln,Ea,gs,ms,Wr,jr,It,vs,de,yv,Lc,bv,wv,Sv,_v,zc,Vi;class JR{constructor(e,t,r){w(this,de);w(this,ln,new Map);w(this,Ea,0);w(this,gs);w(this,ms);w(this,Wr);w(this,jr,Promise.resolve());w(this,It,new AbortController);w(this,vs);E(this,gs,e),E(this,ms,t),E(this,Wr,r),E(this,vs,new Promise(i=>{c(this,It).signal.addEventListener("abort",()=>i())})),v(this,de,yv).call(this)}get signal(){return c(this,It).signal}get closed(){return c(this,vs)}async sendRequest(e,t){v(this,de,zc).call(this);const r=jh(this,Ea)._++,i=new Promise((s,o)=>{c(this,ln).set(r,{resolve:s,reject:o})});return await v(this,de,Vi).call(this,{jsonrpc:"2.0",id:r,method:e,params:t}),i}async sendNotification(e,t){v(this,de,zc).call(this),await v(this,de,Vi).call(this,{jsonrpc:"2.0",method:e,params:t})}}ln=new WeakMap,Ea=new WeakMap,gs=new WeakMap,ms=new WeakMap,Wr=new WeakMap,jr=new WeakMap,It=new WeakMap,vs=new WeakMap,de=new WeakSet,yv=async function(){let e;try{const t=c(this,Wr).readable.getReader();try{for(;!c(this,It).signal.aborted;){const{value:r,done:i}=await t.read();if(i)break;if(r)try{v(this,de,bv).call(this,r)}catch(s){console.error("Unexpected error during message processing:",r,s),"id"in r&&r.id!==void 0&&v(this,de,Vi).call(this,{jsonrpc:"2.0",id:r.id,error:{code:-32700,message:"Parse error"}})}}}finally{t.releaseLock()}}catch(t){e=t}finally{v(this,de,Lc).call(this,e)}},Lc=function(e){if(c(this,It).signal.aborted)return;const t=e??new Error("ACP connection closed");for(const r of c(this,ln).values())r.reject(t);c(this,ln).clear(),c(this,It).abort(t)},bv=async function(e){if("method"in e&&"id"in e){const t=await v(this,de,wv).call(this,e.method,e.params);"error"in t&&console.error("Error handling request",e,t.error),await v(this,de,Vi).call(this,{jsonrpc:"2.0",id:e.id,...t})}else if("method"in e){const t=await v(this,de,Sv).call(this,e.method,e.params);"error"in t&&console.error("Error handling notification",e,t.error)}else"id"in e?v(this,de,_v).call(this,e):console.error("Invalid message",{message:e})},wv=async function(e,t){try{return{result:await c(this,gs).call(this,e,t)??null}}catch(r){if(r instanceof Se)return r.toResult();if(r instanceof Up)return Se.invalidParams(r.format()).toResult();let i;(r instanceof Error||typeof r=="object"&&r!=null&&"message"in r&&typeof r.message=="string")&&(i=r.message);try{return Se.internalError(i?JSON.parse(i):{}).toResult()}catch{return Se.internalError({details:i}).toResult()}}},Sv=async function(e,t){try{return await c(this,ms).call(this,e,t),{result:null}}catch(r){if(r instanceof Se)return r.toResult();if(r instanceof Up)return Se.invalidParams(r.format()).toResult();let i;(r instanceof Error||typeof r=="object"&&r!=null&&"message"in r&&typeof r.message=="string")&&(i=r.message);try{return Se.internalError(i?JSON.parse(i):{}).toResult()}catch{return Se.internalError({details:i}).toResult()}}},_v=function(e){const t=c(this,ln).get(e.id);if(t){if("result"in e)t.resolve(e.result);else if("error"in e){const{code:r,message:i,data:s}=e.error;t.reject(new Se(r,i,s))}c(this,ln).delete(e.id)}else console.error("Got response to unknown request",e.id)},zc=function(){if(c(this,It).signal.aborted)throw c(this,It).signal.reason??new Error("ACP connection closed")},Vi=async function(e){return E(this,jr,c(this,jr).then(async()=>{const t=c(this,Wr).writable.getWriter();try{await t.write(e)}finally{t.releaseLock()}}).catch(t=>{v(this,de,Lc).call(this,t)})),c(this,jr)};class Se extends Error{constructor(t,r,i){super(r);b(this,"code");b(this,"data");this.code=t,this.name="RequestError",this.data=i}static parseError(t,r){return new Se(-32700,`Parse error${r?`: ${r}`:""}`,t)}static invalidRequest(t,r){return new Se(-32600,`Invalid request${r?`: ${r}`:""}`,t)}static methodNotFound(t){return new Se(-32601,`"Method not found": ${t}`,{method:t})}static invalidParams(t,r){return new Se(-32602,`Invalid params${r?`: ${r}`:""}`,t)}static internalError(t,r){return new Se(-32603,`Internal error${r?`: ${r}`:""}`,t)}static authRequired(t,r){return new Se(-32e3,`Authentication required${r?`: ${r}`:""}`,t)}static resourceNotFound(t){return new Se(-32002,`Resource not found${t?`: ${t}`:""}`,t&&{uri:t})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}}const QR=/^Sender \(untrusted metadata\):\n```json\n[\s\S]*?\n```\n\n?/,e2=/^\[[^\n]*Working directory:[^\n]*\]\n\n?/,t2=/\[Television screen context\][\s\S]*?\[\/Television screen context\]\n*/,n2=/\[\[\s*(?:reply_to_current|reply_to\s*:\s*[^\]\n]+|audio_as_voice)\s*\]\]\s*/gi,r2="single_session",i2={name:"television-acp-client",version:"0.0.0"},kv="agent:main:television",s2=ki(bt);var te,Gt,qr,Vt,qn,Yn,Xn,Kn,cn,Yr,Pt,dt,un,Jn,Wt,hn,ys,jt,pt,xa,qt,T,Ev,xv,Av,Mc,$v,Tv,Cv,Iv,Pv,Rv,Dv,Rn,Or,Lr,He,Ov,zr,Nc,Uc,Xo,Lv,zv,bs,ws,Fc,Mr,Mv,Nv;class o2 extends s2{constructor(t){super();w(this,T);w(this,te,l2());w(this,Gt,null);w(this,qr,null);w(this,Vt,null);w(this,qn,null);w(this,Yn,null);w(this,Xn,null);w(this,Kn);w(this,cn,null);w(this,Yr,1);w(this,Pt,null);w(this,dt,null);w(this,un,!1);w(this,Jn,!1);w(this,Wt,null);w(this,hn,new Set);w(this,ys);w(this,jt);w(this,pt);w(this,xa,t=>{v(this,T,xv).call(this,t)});w(this,qt,null);w(this,bs,()=>{v(this,T,Mr).call(this,"ACP bridge websocket closed")});w(this,ws,()=>{v(this,T,Mr).call(this,"ACP bridge websocket error")});E(this,jt,t),E(this,pt,t.sessionMode??r2),E(this,Kn,t.mappedSessionStore??a2()),E(this,ys,t.createSocket??(r=>new WebSocket(r)))}getState(){return c(this,te)}get messages(){return c(this,te).messageOrder.map(t=>c(this,te).messagesById[t]).filter(t=>t!==void 0)}async connect(){if(this.disposed)throw new Error("ACPClient has been disposed");if(c(this,te).lifecycle.status!=="ready"){v(this,T,He).call(this,{lifecycle:{status:"connecting"}}),c(this,qr)??E(this,qr,v(this,T,Ev).call(this));try{await c(this,qr),await v(this,T,Mc).call(this)}catch(t){throw v(this,T,Mr).call(this,Po(t)),t}}}dispose(){v(this,T,Fc).call(this),v(this,T,He).call(this,{lifecycle:{status:"disposed"},run:{status:"idle",stopReason:null,canCancel:!1,error:null},bridge:null})}async sendMessage(t){if(await this.connect(),c(this,te).lifecycle.status!=="ready"||c(this,te).run.status==="running"||c(this,te).run.status==="cancelling")throw new Error("ACPClient is not ready to send a new message");const r=t.text.trim();if(!r)throw new Error("Cannot send an empty message");v(this,T,Or).call(this,{id:v(this,T,zr).call(this,"user"),kind:"user",text:r,status:"final"}),v(this,T,He).call(this,{run:{status:"running",stopReason:null,canCancel:!0,error:null}});try{const i=await v(this,T,Xo).call(this).prompt({sessionId:v(this,T,Uc).call(this),prompt:[{type:"text",text:v(this,T,Ov).call(this,r)}]});v(this,T,Rn).call(this,i.stopReason==="cancelled"?"cancelled":"final"),v(this,T,He).call(this,{run:{status:i.stopReason==="cancelled"?"cancelled":"completed",stopReason:i.stopReason,canCancel:!1,error:null}})}catch(i){throw v(this,T,Nv).call(this)||(v(this,T,Rn).call(this,"error"),v(this,T,He).call(this,{run:{status:"error",stopReason:null,canCancel:!1,error:Po(i)}})),i}}async cancel(){if(await this.connect(),!c(this,te).run.canCancel||c(this,te).run.status!=="running")throw new Error("No active cancellable run");v(this,T,He).call(this,{run:{...c(this,te).run,status:"cancelling"}}),await v(this,T,Xo).call(this).cancel({sessionId:v(this,T,Uc).call(this)})}setScreenContext(t){var s,o,a;const r={screenID:t.screenID,screenName:t.screenName};if(((s=c(this,dt))==null?void 0:s.screenID)===r.screenID&&((o=c(this,dt))==null?void 0:o.screenName)===r.screenName)return;const i=((a=c(this,dt))==null?void 0:a.screenID)??null;if(E(this,dt,r),c(this,pt)==="single_session"){(!c(this,cn)||i!==r.screenID)&&E(this,un,!0);return}c(this,cn)!==Vp(c(this,pt),r.screenID,c(this,jt).clientGUID??"default-client")&&(E(this,Vt,null),E(this,qn,null),c(this,Gt)&&c(this,te).run.status==="idle"&&v(this,T,Mc).call(this).catch(l=>{v(this,T,Mr).call(this,Po(l))}))}}te=new WeakMap,Gt=new WeakMap,qr=new WeakMap,Vt=new WeakMap,qn=new WeakMap,Yn=new WeakMap,Xn=new WeakMap,Kn=new WeakMap,cn=new WeakMap,Yr=new WeakMap,Pt=new WeakMap,dt=new WeakMap,un=new WeakMap,Jn=new WeakMap,Wt=new WeakMap,hn=new WeakMap,ys=new WeakMap,jt=new WeakMap,pt=new WeakMap,xa=new WeakMap,qt=new WeakMap,T=new WeakSet,Ev=async function(){try{v(this,T,He).call(this,{lifecycle:{status:"connecting"}});const{stream:t,socket:r,metadata:i}=await h2({serverURL:c(this,jt).serverURL,token:c(this,jt).token,createSocket:c(this,ys),onDisconnect:c(this,xa)});E(this,Xn,i),v(this,T,He).call(this,{bridge:i}),E(this,qt,r),r.addEventListener("close",c(this,bs)),r.addEventListener("error",c(this,ws)),E(this,Gt,new KR(s=>({connection:s,sessionUpdate:async o=>{await v(this,T,Tv).call(this,o)},requestPermission:async o=>v(this,T,Cv).call(this,o)}),t)),await c(this,Gt).initialize({protocolVersion:OC,clientCapabilities:{},clientInfo:i2})}catch(t){throw t}},xv=function(t){v(this,T,Mr).call(this,Po(t))},Av=function(t){const r=t==null?void 0:t.models;if(!(r!=null&&r.currentModelId))return;const i=r.availableModels.find(s=>s.modelId===r.currentModelId);console.info("[ACPClient] Current model:",(i==null?void 0:i.name)??r.currentModelId,`(${r.currentModelId})`)},Mc=async function(){const t=v(this,T,zv).call(this);if(c(this,Vt)&&c(this,qn)===t){await c(this,Vt);return}E(this,qn,t),E(this,Vt,v(this,T,$v).call(this,t)),await c(this,Vt)},$v=async function(t){var l;const r=v(this,T,Xo).call(this);v(this,T,Mv).call(this);let i,s=!1,o=null;const a={cwd:v(this,T,Lv).call(this),mcpServers:[],_meta:{sessionKey:t}};try{if(E(this,Jn,!0),E(this,Wt,null),((l=c(this,Xn))==null?void 0:l.sessionIdStrategy)==="mapped"){const u=c(this,Kn).getActualSessionId(t);if(u)try{const h=await r.loadSession({...a,sessionId:u});if(c2(h))throw new Error("Mapped ACP session was not found");o=h,i=u,s=!0}catch{const h=await r.newSession(a);o=h,i=h.sessionId,c(this,Kn).setActualSessionId(t,i),s=!1}else{const h=await r.newSession(a);o=h,i=h.sessionId,c(this,Kn).setActualSessionId(t,i),s=!1}}else try{o=await r.loadSession({...a,sessionId:t}),i=t,s=c(this,te).messageOrder.length>0}catch{const u=await r.newSession(a);o=u,i=u.sessionId,s=!1}}finally{E(this,Jn,!1),E(this,Wt,null),v(this,T,Rn).call(this,"final")}v(this,T,Av).call(this,o),await r.setSessionConfigOption({sessionId:i,configId:"verbose_level",value:"full"}),E(this,Yn,i),E(this,cn,t),s?(c(this,hn).add(t),c(this,pt)==="single_session"&&E(this,un,!1)):(c(this,hn).delete(t),E(this,un,c(this,pt)==="single_session")),v(this,T,He).call(this,{lifecycle:{status:"ready"}})},Tv=async function(t){const r=t.update;switch(r.sessionUpdate){case"user_message_chunk":r.content.type==="text"&&v(this,T,Dv).call(this,r.content.text);return;case"agent_message_chunk":r.content.type==="text"&&v(this,T,Iv).call(this,r.content.text);return;case"tool_call":v(this,T,Pv).call(this,r);return;case"tool_call_update":v(this,T,Rv).call(this,r);return;case"agent_thought_chunk":return;default:return}},Cv=async function(t){return{outcome:{outcome:"cancelled"}}},Iv=function(t){E(this,Wt,null);const r=u2(t);if(!r)return;if(!c(this,Pt)){const s={id:v(this,T,zr).call(this,"assistant"),kind:"assistant",text:r,status:"streaming"};E(this,Pt,s.id),v(this,T,Or).call(this,s);return}const i=c(this,te).messagesById[c(this,Pt)];if(!i||i.kind!=="assistant")throw new Error("Open assistant message invariant violated");v(this,T,Lr).call(this,{...i,text:`${i.text}${r}`,status:"streaming"})},Pv=function(t){v(this,T,Rn).call(this,"final");const r=v(this,T,Nc).call(this,t.toolCallId),i=jp("content"in t?t.content:void 0),s={id:(r==null?void 0:r.id)??v(this,T,zr).call(this,"tool"),kind:"tool_call",toolCallId:t.toolCallId,title:t.title,toolKind:t.kind??"other",status:t.status==="failed"?"failed":t.status==="completed"?"completed":"in_progress",text:(r==null?void 0:r.text)??i,locations:t.locations??(r==null?void 0:r.locations)};if(r){v(this,T,Lr).call(this,s);return}v(this,T,Or).call(this,s)},Rv=function(t){const r=v(this,T,Nc).call(this,t.toolCallId),i=(r==null?void 0:r.text)??"",s=jp(t.content),o=s?`${i}${s}`:i,a={id:(r==null?void 0:r.id)??v(this,T,zr).call(this,"tool"),kind:"tool_call",toolCallId:t.toolCallId,title:(r==null?void 0:r.title)??t.toolCallId,toolKind:(r==null?void 0:r.toolKind)??"other",status:t.status==="failed"?"failed":t.status==="completed"?"completed":"in_progress",text:o,locations:t.locations??(r==null?void 0:r.locations)};if(r){v(this,T,Lr).call(this,a);return}v(this,T,Or).call(this,a)},Dv=function(t){if(v(this,T,Rn).call(this,"final"),!t)return;const r=c(this,Jn)?c(this,Wt):null;if(!r){const s=Wp(t);if(!s)return;const o={id:v(this,T,zr).call(this,"user"),kind:"user",text:s,status:"final"};v(this,T,Or).call(this,o),c(this,Jn)&&E(this,Wt,o.id);return}const i=c(this,te).messagesById[r];if(!i||i.kind!=="user")throw new Error("Replay user message invariant violated");v(this,T,Lr).call(this,{...i,text:Wp(`${i.text}${t}`)})},Rn=function(t){if(!c(this,Pt))return;const r=c(this,te).messagesById[c(this,Pt)];(r==null?void 0:r.kind)==="assistant"&&v(this,T,Lr).call(this,{...r,status:t}),E(this,Pt,null)},Or=function(t){v(this,T,He).call(this,{messagesById:{...c(this,te).messagesById,[t.id]:t},messageOrder:[...c(this,te).messageOrder,t.id]})},Lr=function(t){v(this,T,He).call(this,{messagesById:{...c(this,te).messagesById,[t.id]:t}})},He=function(t){const r={...c(this,te),...t};E(this,te,{...r,sendDisabled:r.lifecycle.status!=="ready"||r.run.status==="running"||r.run.status==="cancelling",cancelDisabled:!(r.run.status==="running"||r.run.status==="cancelling")||!r.run.canCancel}),this.dispatchEvent(new K("change"))},Ov=function(t){const r=c(this,cn);return!c(this,dt)||!r||!(c(this,pt)==="single_session"?c(this,un)||!c(this,hn).has(r):!c(this,hn).has(r))?t:(E(this,un,!1),c(this,hn).add(r),["[Television screen context]","This chat session is coming from a Television client in the screen below.",`screen_id: ${c(this,dt).screenID}`,`screen_name: ${c(this,dt).screenName??""}`,"When the user asks to inspect or change Television state with the tv CLI, use this screen ID with the --screen argument.","[/Television screen context]","",t].join(`
43
+ `))},zr=function(t){const r=`${t}-${c(this,Yr)}`;return E(this,Yr,c(this,Yr)+1),r},Nc=function(t){for(const r of c(this,te).messageOrder){const i=c(this,te).messagesById[r];if((i==null?void 0:i.kind)==="tool_call"&&i.toolCallId===t)return i}return null},Uc=function(){if(!c(this,Yn))throw new Error("ACP session is not ready");return c(this,Yn)},Xo=function(){if(!c(this,Gt))throw new Error("ACP connection is not ready");return c(this,Gt)},Lv=function(){var r;const t=(r=c(this,Xn))==null?void 0:r.sessionCwd;if(!t)throw new Error("ACP bridge session cwd is not ready");return t},zv=function(){var r;if(c(this,pt)==="single_session")return`${kv}-${(c(this,jt).clientGUID??"default-client").toLowerCase()}`;const t=(r=c(this,dt))==null?void 0:r.screenID;if(!t)throw new Error("Screen context is required for per-screen session mode");return Vp(c(this,pt),t,c(this,jt).clientGUID??"default-client")},bs=new WeakMap,ws=new WeakMap,Fc=function(){E(this,Gt,null),E(this,qr,null),E(this,Vt,null),E(this,qn,null),E(this,Yn,null),E(this,cn,null),E(this,Xn,null),c(this,qt)&&(c(this,qt).removeEventListener("close",c(this,bs)),c(this,qt).removeEventListener("error",c(this,ws)),c(this,qt).close(),E(this,qt,null))},Mr=function(t){this.disposed||c(this,te).lifecycle.status==="disconnected"||(v(this,T,Rn).call(this,"error"),v(this,T,Fc).call(this),v(this,T,He).call(this,{lifecycle:{status:"disconnected",...t?{error:t}:{}},run:{status:"idle",stopReason:null,canCancel:!1,error:null},bridge:null}))},Mv=function(){E(this,Pt,null),E(this,Wt,null),E(this,Yr,1),v(this,T,He).call(this,{run:{status:"idle",stopReason:null,canCancel:!1,error:null},messagesById:{},messageOrder:[]})},Nv=function(){return c(this,te).lifecycle.status==="disconnected"};function a2(){const n=new Map;return{getActualSessionId(e){return n.get(e)??null},setActualSessionId(e,t){n.set(e,t)},clearActualSessionId(e){n.delete(e)}}}function l2(){return{lifecycle:{status:"connecting"},run:{status:"idle",stopReason:null,canCancel:!1,error:null},bridge:null,messagesById:{},messageOrder:[],sendDisabled:!0,cancelDisabled:!0}}function c2(n){return n==null?!0:typeof n=="object"&&Object.keys(n).length===0}function Vp(n,e,t){return n==="single_session"?`${kv}-${t.toLowerCase()}`:`agent:main:television-${t.toLowerCase()}-${e.toLowerCase()}`}function Uv(n){return n.replace(/^(?:\s*\n)+/,"")}function Wp(n){let e=n;return e=e.replace(QR,""),e=e.replace(e2,""),e=e.replace(t2,""),e=Uv(e),e}function u2(n){let e=n;return e=e.replace(n2,""),e=Uv(e),e}function jp(n){return!n||n.length===0?"":n.flatMap(e=>e.type==="content"&&e.content.type==="text"?[e.content.text]:[]).join("")}async function h2(n){const e=n.createSocket(f2(n.serverURL,n.token));let t=!1,r,i;const s=new Promise((u,h)=>{r=u,i=h}),o=new ReadableStream({start(u){let h=!1;const p=()=>{e.send(JSON.stringify({type:"acp-bridge-connect"}))},g=k=>{const I=p2(k);if(!I)return;let U;try{U=JSON.parse(I)}catch(P){const V=P instanceof Error?P:new Error(String(P));i(V),u.error(V);return}switch(U.type){case"acp-bridge-status":if(U.status==="ready"){let P;try{P=d2(U)}catch(V){const O=V instanceof Error?V:new Error(String(V));t||i(O),u.error(O);return}t||(t=!0,r(P));return}if(U.status==="error"||U.status==="exited"){const P=new Error(U.error??`ACP bridge ${U.status}`);t||i(P),u.error(P)}return;case"acp-bridge-message":u.enqueue(U.message);return}},m=()=>{var I;if(h)return;h=!0;const k=new Error("ACP bridge websocket closed");t||i(k),(I=n.onDisconnect)==null||I.call(n,k),u.close()},A=()=>{var I;if(h)return;h=!0;const k=new Error("ACP bridge websocket error");t||i(k),(I=n.onDisconnect)==null||I.call(n,k),u.error(k)};e.addEventListener("open",p),e.addEventListener("message",g),e.addEventListener("close",m),e.addEventListener("error",A)}}),a=new WritableStream({async write(u){await s,e.send(JSON.stringify({type:"acp-bridge-message",message:u}))},close(){e.close()},abort(){e.close()}}),l=await s;return{stream:{readable:o,writable:a},socket:e,metadata:l}}function d2(n){const{agent:e,sessionIdStrategy:t,sessionCwd:r}=n;if((e==="openclaw"||e==="hermes")&&(t==="deterministic"||t==="mapped")&&typeof r=="string"&&r.length>0)return{agent:e,sessionIdStrategy:t,sessionCwd:r};throw new Error("ACP bridge ready status missing bootstrap metadata")}function p2(n){if(typeof n=="string")return n;if(n instanceof Uint8Array)return new TextDecoder().decode(n);if(typeof Buffer<"u"&&n instanceof Buffer)return n.toString("utf8");if(typeof n=="object"&&n!==null&&"data"in n){const e=n.data;if(typeof e=="string")return e;if(e instanceof Uint8Array)return new TextDecoder().decode(e);if(Array.isArray(e))return Buffer.concat(e).toString("utf8")}return null}function f2(n,e){const t=new URL(n);return t.protocol=t.protocol==="https:"?"wss:":"ws:",t.pathname="/acp",t.search="",t.searchParams.set("token",e),t.hash="",t.toString()}function Po(n){return n instanceof Error?n.message:String(n)}const qp="television.acpClientGUID",Yp="television.acpMappedSessions",g2=ki(bt);class m2 extends g2{constructor(t){super();b(this,"screenManager");b(this,"clients",new Map);b(this,"options");b(this,"sessionMode");b(this,"clientGUID");b(this,"mappedSessionStore");b(this,"activeClient",null);b(this,"handleActiveScreenChanged",()=>{this.syncActiveClient()});this.screenManager=t.screenManager,this.sessionMode=t.sessionMode??"single_session";const r=t.storage??b2();this.options={serverURL:t.serverURL,token:t.token,...t.createSocket?{createSocket:t.createSocket}:{},...t.sessionMode?{sessionMode:t.sessionMode}:{}},this.clientGUID=t.clientGUID??S2(w2(r)),this.mappedSessionStore=t.mappedSessionStore??(r?new y2(r,t.serverURL):new v2),this.screenManager.addEventListener("active-screen-changed",this.handleActiveScreenChanged),this.syncActiveClient()}getActiveClient(){return this.activeClient}dispose(){this.screenManager.removeEventListener("active-screen-changed",this.handleActiveScreenChanged);for(const t of this.clients.values())t.dispose();this.clients.clear(),this.activeClient=null}syncActiveClient(){const t=this.screenManager.activeScreen,r=t?this.getClientForScreen(t):null;this.activeClient!==r&&(this.activeClient=r,this.dispatchEvent(new K("change")))}getClientForScreen(t){const r=this.sessionMode==="single_session"?"single_session":t.id;let i=this.clients.get(r);return i||(i=new o2({...this.options,sessionMode:this.sessionMode,clientGUID:this.clientGUID,mappedSessionStore:this.mappedSessionStore}),this.clients.set(r,i)),i.setScreenContext({screenID:t.id,screenName:t.name}),i}}var Xr;class v2{constructor(){w(this,Xr,new Map)}getActualSessionId(e){return c(this,Xr).get(e)??null}setActualSessionId(e,t){c(this,Xr).set(e,t)}clearActualSessionId(e){c(this,Xr).delete(e)}}Xr=new WeakMap;const Xp=1;var Kr,Ss,Qe,Ko,Jo,Zc;class y2{constructor(e,t){w(this,Qe);w(this,Kr);w(this,Ss);E(this,Kr,e),E(this,Ss,t)}getActualSessionId(e){const t=v(this,Qe,Jo).call(this)[v(this,Qe,Ko).call(this,e)];return typeof t=="string"&&t.length>0?t:null}setActualSessionId(e,t){const r=v(this,Qe,Jo).call(this);r[v(this,Qe,Ko).call(this,e)]=t,v(this,Qe,Zc).call(this,r)}clearActualSessionId(e){const t=v(this,Qe,Jo).call(this);delete t[v(this,Qe,Ko).call(this,e)],v(this,Qe,Zc).call(this,t)}}Kr=new WeakMap,Ss=new WeakMap,Qe=new WeakSet,Ko=function(e){return JSON.stringify([c(this,Ss),e])},Jo=function(){const e=c(this,Kr).getItem(Yp);if(!e)return{};let t;try{t=JSON.parse(e)}catch{return{}}if(typeof t!="object"||t===null||Array.isArray(t))return{};const r=t;return r.version!==Xp?{}:typeof r.entries!="object"||r.entries===null||Array.isArray(r.entries)?{}:Object.fromEntries(Object.entries(r.entries).filter(i=>typeof i[1]=="string"))},Zc=function(e){const t={version:Xp,entries:e};c(this,Kr).setItem(Yp,JSON.stringify(t))};function b2(){return typeof window>"u"?null:window.localStorage}function w2(n){if(!n)throw new Error("ACPClientManager requires storage when clientGUID is not provided");return n}function S2(n){const e=n.getItem(qp);if(e)return e;const t=Vu().toLowerCase();return n.setItem(qp,t),t}var _s;class _2 extends bt{constructor(){super();w(this,_s,t=>{const r=k2(t);r!==null&&(t.preventDefault(),this.dispatchEvent(new KE("shortcut-triggered",{shortcut:r})))});document.addEventListener("keydown",c(this,_s))}dispose(){document.removeEventListener("keydown",c(this,_s))}}_s=new WeakMap;function k2(n){for(const[e,t]of Object.entries(Px))if(E2(n,t.trigger))return e;return null}function E2(n,e){return!(n.key.toLowerCase()!==e.key.toLowerCase()||n.metaKey!==!!e.meta||n.ctrlKey!==!!e.ctrl||n.shiftKey!==!!e.shift||n.altKey!==!!e.alt)}const x2="serverURL",A2="token",$2="mode",T2="electron";function Fv(n=window.location.search,e=window.location.origin){const r=new URLSearchParams(n).get(x2);return r?new URL(r).origin:new URL(e).origin}function Hc(n=window.location.search){return new URLSearchParams(n).get(A2)}function Zv(n=window.location.search){return new URLSearchParams(n).get($2)===T2}/**
44
44
  * @license
45
45
  * Copyright 2017 Google LLC
46
46
  * SPDX-License-Identifier: BSD-3-Clause
47
- */const ns=globalThis,rf=n=>n,va=ns.trustedTypes,sf=va?va.createPolicy("lit-html",{createHTML:n=>n}):void 0,qv="$lit$",sn=`lit$${Math.random().toFixed(9).slice(2)}$`,Yv="?"+sn,O2=`<${Yv}>`,pr=document,os=()=>pr.createComment(""),as=n=>n===null||typeof n!="object"&&typeof n!="function",ah=Array.isArray,L2=n=>ah(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",ec=`[
48
- \f\r]`,Li=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,of=/-->/g,af=/>/g,Cn=RegExp(`>|${ec}(?:([^\\s"'>=/]+)(${ec}*=${ec}*(?:[^
49
- \f\r"'\`<>=]|("|')|))|$)`,"g"),lf=/'/g,cf=/"/g,Xv=/^(?:script|style|textarea|title)$/i,z2=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),N=z2(1),pi=Symbol.for("lit-noChange"),se=Symbol.for("lit-nothing"),uf=new WeakMap,Fn=pr.createTreeWalker(pr,129);function Kv(n,e){if(!ah(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return sf!==void 0?sf.createHTML(e):e}const M2=(n,e)=>{const t=n.length-1,r=[];let i,s=e===2?"<svg>":e===3?"<math>":"",o=Li;for(let a=0;a<t;a++){const l=n[a];let u,h,p=-1,g=0;for(;g<l.length&&(o.lastIndex=g,h=o.exec(l),h!==null);)g=o.lastIndex,o===Li?h[1]==="!--"?o=of:h[1]!==void 0?o=af:h[2]!==void 0?(Xv.test(h[2])&&(i=RegExp("</"+h[2],"g")),o=Cn):h[3]!==void 0&&(o=Cn):o===Cn?h[0]===">"?(o=i??Li,p=-1):h[1]===void 0?p=-2:(p=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?Cn:h[3]==='"'?cf:lf):o===cf||o===lf?o=Cn:o===of||o===af?o=Li:(o=Cn,i=void 0);const m=o===Cn&&n[a+1].startsWith("/>")?" ":"";s+=o===Li?l+O2:p>=0?(r.push(u),l.slice(0,p)+qv+l.slice(p)+sn+m):l+sn+(p===-2?a:m)}return[Kv(n,s+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]};class ls{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let s=0,o=0;const a=e.length-1,l=this.parts,[u,h]=M2(e,t);if(this.el=ls.createElement(u,r),Fn.currentNode=this.el.content,t===2||t===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=Fn.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const p of i.getAttributeNames())if(p.endsWith(qv)){const g=h[o++],m=i.getAttribute(p).split(sn),A=/([.?@])?(.*)/.exec(g);l.push({type:1,index:s,name:A[2],strings:m,ctor:A[1]==="."?U2:A[1]==="?"?F2:A[1]==="@"?Z2:sl}),i.removeAttribute(p)}else p.startsWith(sn)&&(l.push({type:6,index:s}),i.removeAttribute(p));if(Xv.test(i.tagName)){const p=i.textContent.split(sn),g=p.length-1;if(g>0){i.textContent=va?va.emptyScript:"";for(let m=0;m<g;m++)i.append(p[m],os()),Fn.nextNode(),l.push({type:2,index:++s});i.append(p[g],os())}}}else if(i.nodeType===8)if(i.data===Yv)l.push({type:2,index:s});else{let p=-1;for(;(p=i.data.indexOf(sn,p+1))!==-1;)l.push({type:7,index:s}),p+=sn.length-1}s++}}static createElement(e,t){const r=pr.createElement("template");return r.innerHTML=e,r}}function fi(n,e,t=n,r){var o,a;if(e===pi)return e;let i=r!==void 0?(o=t._$Co)==null?void 0:o[r]:t._$Cl;const s=as(e)?void 0:e._$litDirective$;return(i==null?void 0:i.constructor)!==s&&((a=i==null?void 0:i._$AO)==null||a.call(i,!1),s===void 0?i=void 0:(i=new s(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??(t._$Co=[]))[r]=i:t._$Cl=i),i!==void 0&&(e=fi(n,i._$AS(n,e.values),i,r)),e}class N2{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:r}=this._$AD,i=((e==null?void 0:e.creationScope)??pr).importNode(t,!0);Fn.currentNode=i;let s=Fn.nextNode(),o=0,a=0,l=r[0];for(;l!==void 0;){if(o===l.index){let u;l.type===2?u=new lh(s,s.nextSibling,this,e):l.type===1?u=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(u=new H2(s,this,e)),this._$AV.push(u),l=r[++a]}o!==(l==null?void 0:l.index)&&(s=Fn.nextNode(),o++)}return Fn.currentNode=pr,i}p(e){let t=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}let lh=class Jv{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=se,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=(i==null?void 0:i.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=fi(this,e,t),as(e)?e===se||e==null||e===""?(this._$AH!==se&&this._$AR(),this._$AH=se):e!==this._$AH&&e!==pi&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):L2(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==se&&as(this._$AH)?this._$AA.nextSibling.data=e:this.T(pr.createTextNode(e)),this._$AH=e}$(e){var s;const{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=ls.createElement(Kv(r.h,r.h[0]),this.options)),r);if(((s=this._$AH)==null?void 0:s._$AD)===i)this._$AH.p(t);else{const o=new N2(i,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=uf.get(e.strings);return t===void 0&&uf.set(e.strings,t=new ls(e)),t}k(e){ah(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,i=0;for(const s of e)i===t.length?t.push(r=new Jv(this.O(os()),this.O(os()),this,this.options)):r=t[i],r._$AI(s),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,t);e!==this._$AB;){const i=rf(e).nextSibling;rf(e).remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}},sl=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,s){this.type=1,this._$AH=se,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=se}_$AI(e,t=this,r,i){const s=this.strings;let o=!1;if(s===void 0)e=fi(this,e,t,0),o=!as(e)||e!==this._$AH&&e!==pi,o&&(this._$AH=e);else{const a=e;let l,u;for(e=s[0],l=0;l<s.length-1;l++)u=fi(this,a[r+l],t,l),u===pi&&(u=this._$AH[l]),o||(o=!as(u)||u!==this._$AH[l]),u===se?e=se:e!==se&&(e+=(u??"")+s[l+1]),this._$AH[l]=u}o&&!i&&this.j(e)}j(e){e===se?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},U2=class extends sl{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===se?void 0:e}},F2=class extends sl{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==se)}},Z2=class extends sl{constructor(e,t,r,i,s){super(e,t,r,i,s),this.type=5}_$AI(e,t=this){if((e=fi(this,e,t,0)??se)===pi)return;const r=this._$AH,i=e===se&&r!==se||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,s=e!==se&&(r===se||i);i&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}};class H2{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){fi(this,e)}}const tc=ns.litHtmlPolyfillSupport;tc==null||tc(ls,lh),(ns.litHtmlVersions??(ns.litHtmlVersions=[])).push("3.3.2");const Re=(n,e,t)=>{const r=e;let i=r._$litPart$;return i===void 0&&(r._$litPart$=i=new lh(e.insertBefore(os(),null),null,void 0,{})),i._$AI(n),i},B2=.5,hf=.1,df=8,G2=4,Qv=3,ey=3,V2=4,Zn=255,ty=.2126,ny=.7152,ry=.0722;async function ch(n){const e=W2(n);if(!e)return"light";try{return await Y2(n,e)>=B2?"light":"dark"}catch{return"light"}}function W2(n){if(typeof document.elementsFromPoint!="function")return null;const e=n.getBoundingClientRect(),t=e.left+e.width/2,r=e.top+e.height/2,i=document.elementsFromPoint(t,r);for(const s of i){if(!(s instanceof HTMLElement)||s===n||n.contains(s))continue;const o=window.getComputedStyle(s);if(j2(o))return s}return null}function j2(n){return n.backgroundImage&&n.backgroundImage!=="none"?!0:q2(n.backgroundColor)>0}function q2(n){if(!n)return 0;const e=n.match(/rgba?\(([^)]+)\)/);if(!e)return 0;const t=e[1].split(/[\s,/]+/).filter(Boolean);return t.length===V2?parseFloat(t[Qv]):t.length===ey?1:0}async function Y2(n,e){const t=n.getBoundingClientRect(),r=e.getBoundingClientRect(),i={x:Ro((t.left-r.left)/r.width),y:Ro((t.top-r.top)/r.height),width:Ro(t.width/r.width),height:Ro(t.height/r.height)},s=window.getComputedStyle(e),o=X2(s.backgroundImage);return o?J2({url:o,surfaceWidth:r.width,surfaceHeight:r.height,region:i}):Q2(s.backgroundColor)}function X2(n){const e=n.match(/url\(\s*["']?([^"')]+)["']?\s*\)/);return e?e[1]:null}const pf=new Map;function K2(n){let e=pf.get(n);return e||(e=new Promise((t,r)=>{const i=new Image;i.crossOrigin="anonymous",i.onload=()=>t(i),i.onerror=()=>r(new Error(`Failed to load ${n}`)),i.src=n}),pf.set(n,e),e)}async function J2(n){const e=await K2(n.url),t=Math.max(df,Math.ceil(n.surfaceWidth*hf)),r=Math.max(df,Math.ceil(n.surfaceHeight*hf)),i=document.createElement("canvas");i.width=t,i.height=r;const s=i.getContext("2d",{willReadFrequently:!0});if(!s)return 1;const o=n.surfaceWidth/n.surfaceHeight,a=e.naturalWidth/e.naturalHeight;let l,u;a>o?(u=r,l=r*a):(l=t,u=t/a);const h=(t-l)/2,p=(r-u)/2;s.drawImage(e,h,p,l,u);const g=Math.max(0,Math.floor(n.region.x*t)),m=Math.max(0,Math.floor(n.region.y*r)),A=Math.max(1,Math.min(t-g,Math.floor(n.region.width*t))),k=Math.max(1,Math.min(r-m,Math.floor(n.region.height*r))),I=s.getImageData(g,m,A,k).data;let U=0,P=0;for(let V=0;V<I.length;V+=G2){const O=I[V]/Zn,H=I[V+1]/Zn,F=I[V+2]/Zn,ce=I[V+Qv]/Zn;U+=ce*(ty*O+ny*H+ry*F),P+=1}return P>0?U/P:1}function Q2(n){const e=n.match(/rgba?\(([^)]+)\)/);if(!e)return 1;const t=e[1].split(/[\s,/]+/).filter(Boolean).map(parseFloat);if(t.length<ey)return 1;const r=t[0]/Zn,i=t[1]/Zn,s=t[2]/Zn;return ty*r+ny*i+ry*s}function Ro(n){return n<0?0:n>1?1:n}const nc=new WeakSet,ff=new WeakSet;function iy(n){if(ff.has(n))return;ff.add(n);for(const t of n.querySelectorAll('button[variant="ghost"]'))rc(t);if(typeof MutationObserver!="function")return;new MutationObserver(t=>{for(const r of t)if(r.type==="childList")for(const i of r.addedNodes)eD(i,rc);else r.type==="attributes"&&r.target instanceof HTMLButtonElement&&r.target.getAttribute("variant")==="ghost"&&rc(r.target)}).observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["variant"]})}function eD(n,e){if(n instanceof Element){n instanceof HTMLButtonElement&&n.getAttribute("variant")==="ghost"&&e(n);for(const t of n.querySelectorAll('button[variant="ghost"]'))e(t)}}async function rc(n){if(nc.has(n))return;nc.add(n);const e=await ch(n);if(n.getAttribute("variant")!=="ghost"){nc.delete(n);return}n.setAttribute("tone",e)}const tD="*,*:before,*:after{box-sizing:border-box}html,body{margin:0;padding:0;width:100%;height:100%}h1,h2,h3,h4,h5,h6,p,ul,ol,blockquote,pre,hr{margin:0}button,input,textarea,select{font:inherit;color:inherit}@font-face{font-family:Hind;src:url("+new URL("Hind-Variable-C47b_dt9.woff2",import.meta.url).href+') format("woff2-variations");font-weight:300 700;font-style:normal;font-display:swap}:root{--font-sans: "Hind", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;--font-brand: var(--font-sans);--font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;--font-weight-body: 500;--text-base: 13.5px;--text-scale: 1.125;--text-sm: round(calc(var(--text-base) / var(--text-scale)), 1px);--text-lg: round(calc(var(--text-base) * var(--text-scale)), 1px);--text-xl: round(calc(var(--text-lg) * var(--text-scale)), 1px);--leading-base: 1.5;--space-2: 2px;--space-4: 4px;--space-6: 6px;--space-8: 8px;--space-12: 12px;--space-16: 16px;--space-20: 20px;--space-24: 24px;--space-32: 32px;--space-48: 48px;--space-64: 64px;--radius-4: 4px;--radius-8: 8px;--radius-12: 12px;--radius-16: 16px;--radius-24: 24px;--radius-full: 9999px;--shadow-hairline: 0 0 0 .5px var(--color-border);--shadow-control: 0 1px 1px rgb(0 0 0 / .04), 0 2px 6px rgb(0 0 0 / .06);--alpha-50: 4%;--alpha-100: 8%;--alpha-200: 15%;--alpha-300: 22%;--alpha-400: 30%;--alpha-500: 40%;--alpha-600: 50%;--alpha-700: 65%;--alpha-800: 80%;--alpha-900: 90%;--alpha-950: 95%;--tint-50: color-mix(in srgb, currentColor var(--alpha-50), transparent);--tint-100: color-mix(in srgb, currentColor var(--alpha-100), transparent);--tint-200: color-mix(in srgb, currentColor var(--alpha-200), transparent);--tint-300: color-mix(in srgb, currentColor var(--alpha-300), transparent);--tint-400: color-mix(in srgb, currentColor var(--alpha-400), transparent);--tint-500: color-mix(in srgb, currentColor var(--alpha-500), transparent);--tint-600: color-mix(in srgb, currentColor var(--alpha-600), transparent);--tint-700: color-mix(in srgb, currentColor var(--alpha-700), transparent);--tint-800: color-mix(in srgb, currentColor var(--alpha-800), transparent);--tint-900: color-mix(in srgb, currentColor var(--alpha-900), transparent);--tint-950: color-mix(in srgb, currentColor var(--alpha-950), transparent);--color-overlay-hover: color-mix(in srgb, var(--black) var(--alpha-100), transparent);--color-overlay-active: color-mix(in srgb, var(--black) var(--alpha-300), transparent);--backdrop-blur-glass: blur(20px) saturate(1.4);--black: #000000;--white: #ffffff;--neutral-50: oklch(.985 0 0);--neutral-100: oklch(.97 0 0);--neutral-200: oklch(.923 0 0);--neutral-300: oklch(.869 0 0);--neutral-350: oklch(.79 0 0);--neutral-400: oklch(.709 0 0);--neutral-500: oklch(.553 0 0);--neutral-600: oklch(.444 0 0);--neutral-700: oklch(.374 0 0);--neutral-800: oklch(.268 0 0);--neutral-900: oklch(.216 0 0);--neutral-950: oklch(.147 0 0);--red-50: oklch(.969 .015 12.422);--red-100: oklch(.941 .03 12.58);--red-200: oklch(.892 .058 10.001);--red-300: oklch(.81 .117 11.638);--red-400: oklch(.712 .194 13.428);--red-500: oklch(.645 .246 16.439);--red-600: oklch(.586 .253 17.585);--red-700: oklch(.514 .222 16.935);--red-800: oklch(.455 .188 13.697);--red-900: oklch(.41 .159 10.272);--red-950: oklch(.271 .105 12.094);--orange-50: oklch(.98 .016 73.684);--orange-100: oklch(.954 .038 75.164);--orange-200: oklch(.901 .076 70.697);--orange-300: oklch(.837 .128 66.29);--orange-400: oklch(.75 .183 55.934);--orange-500: oklch(.705 .213 47.604);--orange-600: oklch(.646 .222 41.116);--orange-700: oklch(.553 .195 38.402);--orange-800: oklch(.47 .157 37.304);--orange-900: oklch(.408 .123 38.172);--orange-950: oklch(.266 .079 36.259);--yellow-50: oklch(.987 .026 102.212);--yellow-100: oklch(.973 .071 103.193);--yellow-200: oklch(.945 .129 101.54);--yellow-300: oklch(.905 .182 98.111);--yellow-400: oklch(.852 .199 91.936);--yellow-500: oklch(.795 .184 86.047);--yellow-600: oklch(.681 .162 75.834);--yellow-700: oklch(.554 .135 66.442);--yellow-800: oklch(.476 .114 61.907);--yellow-900: oklch(.421 .095 57.708);--yellow-950: oklch(.286 .066 53.813);--green-50: oklch(.979 .021 166.113);--green-100: oklch(.95 .052 163.051);--green-200: oklch(.905 .093 164.15);--green-300: oklch(.845 .143 164.978);--green-400: oklch(.765 .177 163.223);--green-500: oklch(.696 .17 162.48);--green-600: oklch(.596 .145 163.225);--green-700: oklch(.508 .118 165.612);--green-800: oklch(.432 .095 166.913);--green-900: oklch(.378 .077 168.94);--green-950: oklch(.262 .051 172.552);--blue-50: oklch(.97 .014 254.604);--blue-100: oklch(.932 .032 255.585);--blue-200: oklch(.882 .059 254.128);--blue-300: oklch(.809 .105 251.813);--blue-400: oklch(.707 .165 254.624);--blue-500: oklch(.623 .214 259.815);--blue-600: oklch(.546 .245 262.881);--blue-700: oklch(.488 .243 264.376);--blue-800: oklch(.424 .199 265.638);--blue-900: oklch(.379 .146 265.522);--blue-950: oklch(.282 .091 267.935);--purple-50: oklch(.969 .016 293.756);--purple-100: oklch(.943 .029 294.588);--purple-200: oklch(.894 .057 293.283);--purple-300: oklch(.811 .111 293.571);--purple-400: oklch(.702 .183 293.541);--purple-500: oklch(.606 .25 292.717);--purple-600: oklch(.541 .281 293.009);--purple-700: oklch(.491 .27 292.581);--purple-800: oklch(.432 .232 292.759);--purple-900: oklch(.38 .189 293.745);--purple-950: oklch(.283 .141 291.089)}@supports (corner-shape: squircle){:root{--radius-8: 10px;--radius-12: 15px;--radius-16: 20px;--radius-24: 30px}}:root[data-font=system]{--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif}:root{--color-bg: var(--neutral-50);--color-bg-muted: var(--neutral-100);--color-surface: var(--white);--color-surface-muted: var(--neutral-100);--color-interactive: var(--neutral-200);--color-interactive-hover: var(--neutral-300);--color-border: rgba(0, 0, 0, .1);--color-border-muted: rgba(0, 0, 0, .06);--color-text: var(--neutral-900);--color-text-muted: var(--neutral-500);--color-link: inherit;--color-focus-ring: var(--neutral-500);--color-overlay-backdrop: rgb(0 0 0 / .5);--color-highlight: rgb(255 255 255 / .5);--color-primary: var(--blue-500);--color-danger: var(--red-600);color-scheme:light}body{font-family:var(--font-sans);font-size:var(--text-base);font-weight:var(--font-weight-body);line-height:var(--leading-base);letter-spacing:.015em;color:var(--color-text);background:var(--color-bg);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}a{color:var(--color-link);text-underline-offset:.15em;text-decoration-thickness:.08em}h1,h2,h3,h4,h5,h6{font-weight:600;color:inherit}code{font-family:var(--font-mono);font-size:.9em;background:var(--color-bg-muted);padding:var(--space-2) var(--space-4);border-radius:var(--radius-4)}pre{font-family:var(--font-mono);background:var(--color-bg-muted);padding:var(--space-12);border-radius:var(--radius-8);overflow-x:auto}pre code{background:none;padding:0}blockquote{padding-left:var(--space-16);border-left:3px solid var(--color-border);color:var(--color-text-muted)}hr{border:none;border-top:1px solid var(--color-border)}table{border-collapse:collapse}th,td{padding:var(--space-8) var(--space-12);border:1px solid var(--color-border);text-align:left}th{background:var(--color-bg-muted);font-weight:600}input,textarea{padding:6px 10px;border:.5px solid var(--tint-300);border-radius:var(--radius-12);background:var(--tint-100);color:inherit;font:inherit;transition:background .12s ease,border-color .12s ease,box-shadow .12s ease}textarea{resize:none}input::placeholder,textarea::placeholder{color:var(--tint-500)}input:focus,textarea:focus{background:color-mix(in srgb,var(--white) var(--alpha-300),transparent);border-color:var(--color-primary);outline:none;box-shadow:0 0 0 1.5px var(--color-primary)}label.field{display:grid;gap:4px;font-size:13px}label.field>span{font-size:11.5px;font-weight:450;color:var(--tint-800)}@supports (corner-shape: squircle){*{corner-shape:squircle}}button{display:inline-flex;align-items:center;justify-content:center;gap:var(--space-6);padding:4px 14px;border:.5px solid var(--tint-200);border-radius:var(--radius-12);background:var(--color-surface);color:inherit;font:inherit;cursor:default;box-shadow:var(--shadow-control)}button:hover:not(:disabled){background:color-mix(in srgb,var(--color-surface) 96%,black)}button:active:not(:disabled){background:color-mix(in srgb,var(--color-surface) 88%,black);box-shadow:inset 0 1px 2px #00000014}button:focus-visible{outline:2px solid var(--color-focus-ring);outline-offset:2px}button[variant=primary]{background:var(--color-primary);border-color:#0000002e;color:var(--white)}button[variant=primary]:hover:not(:disabled){background:color-mix(in srgb,var(--color-primary) 92%,black)}button[variant=primary]:active:not(:disabled){background:color-mix(in srgb,var(--color-primary) 82%,black);box-shadow:inset 0 1px 2px #0000002e}button[variant=danger]{background:var(--color-danger);border-color:#0000002e;color:var(--white)}button[variant=danger]:hover:not(:disabled){background:color-mix(in srgb,var(--color-danger) 92%,black)}button[variant=danger]:active:not(:disabled){background:color-mix(in srgb,var(--color-danger) 82%,black);box-shadow:inset 0 1px 2px #0000002e}button[variant=ghost]{background:transparent;border-color:transparent;color:inherit;box-shadow:none}button[variant=ghost]:hover:not(:disabled){background:var(--color-overlay-hover)}button[variant=ghost]:active:not(:disabled){background:var(--color-overlay-active);box-shadow:none}button[variant=ghost][data-active]:not(:disabled),button[variant=ghost][data-active]:hover:not(:disabled),button[variant=ghost][aria-expanded=true]:not(:disabled),button[variant=ghost][aria-expanded=true]:hover:not(:disabled){background:var(--color-overlay-active);box-shadow:none}button:disabled{background:var(--tint-300);border-color:transparent;color:var(--tint-700);box-shadow:none}[tone=dark] button:not([variant]):not(:disabled){background:var(--tint-200);border-color:var(--tint-300);box-shadow:inset 0 .5px 0 var(--tint-300)}[tone=dark] button:not([variant]):hover:not(:disabled){background:var(--tint-300)}[tone=dark] button:not([variant]):active:not(:disabled){background:var(--tint-400);box-shadow:inset 0 1px 2px #0003}[tone=light] button:not([variant]):not(:disabled){background:var(--color-surface);border-color:var(--tint-200);box-shadow:var(--shadow-control)}[tone=light] button:not([variant]):hover:not(:disabled){background:color-mix(in srgb,var(--color-surface) 96%,black)}[tone=light] button:not([variant]):active:not(:disabled){background:color-mix(in srgb,var(--color-surface) 88%,black);box-shadow:inset 0 1px 2px #00000014}button[size=sm]{min-height:24px;padding:var(--space-2) var(--space-8)}button[size=md]{min-height:32px;padding:var(--space-6) var(--space-12)}button[icon-only]{width:24px;height:24px;min-height:0;padding:0}[data-ui-icon]{display:inline-block;vertical-align:middle}.prose{line-height:var(--leading-base)}.prose h1{font-size:var(--text-xl);margin-bottom:var(--space-8)}.prose h2{font-size:var(--text-lg);margin-top:var(--space-24);margin-bottom:var(--space-8)}.prose h3,.prose h4,.prose h5,.prose h6{font-size:var(--text-base);margin-top:var(--space-24);margin-bottom:var(--space-8)}.prose p{margin:var(--space-12) 0}.prose ul,.prose ol{padding-left:var(--space-24);margin:var(--space-12) 0}.prose blockquote,.prose pre{margin:var(--space-12) 0}.prose hr{margin:var(--space-24) 0}.prose table{width:100%;margin:var(--space-12) 0}.prose img{max-width:100%;height:auto}.prose>:first-child{margin-top:0}.prose>:last-child{margin-bottom:0}[material=paper]{background:var(--white);border:.5px solid color-mix(in srgb,var(--black) var(--alpha-100),transparent);color:var(--color-text)}[material=glass]{background:color-mix(in srgb,var(--white) var(--alpha-700),transparent);border:.5px solid color-mix(in srgb,var(--black) var(--alpha-100),transparent);color:var(--color-text);backdrop-filter:var(--backdrop-blur-glass);-webkit-backdrop-filter:var(--backdrop-blur-glass)}[tone=dark]{color:color-mix(in srgb,var(--white) var(--alpha-950),transparent);border-color:color-mix(in srgb,var(--white) var(--alpha-200),transparent);--color-overlay-hover: color-mix(in srgb, var(--white) var(--alpha-200), transparent);--color-overlay-active: color-mix(in srgb, var(--black) var(--alpha-500), transparent)}[tone=dark][material=paper]{background:#000}[tone=dark][material=glass]{background:color-mix(in srgb,var(--black) var(--alpha-600),transparent)}[tone=light]{color:var(--color-text);border-color:color-mix(in srgb,var(--black) var(--alpha-100),transparent);--color-overlay-hover: color-mix(in srgb, var(--black) var(--alpha-100), transparent);--color-overlay-active: color-mix(in srgb, var(--black) var(--alpha-300), transparent)}[level="1"]{box-shadow:0 12px 32px #00000024}[level="2"]{box-shadow:0 4px 6px -2px #0000001f,0 40px 60px -16px #00000038}dropdown-menu{position:relative;display:inline-block;color:inherit}dropdown-group{display:grid;gap:var(--space-4)}dropdown-label{display:block;padding:var(--space-4) var(--space-8);color:var(--color-text-muted);font:inherit;font-size:var(--text-sm);font-weight:600;letter-spacing:.04em;text-transform:uppercase}dropdown-divider{display:block;height:1px;margin:2px 0;background:var(--color-border)}[data-dropdown-trigger][aria-expanded=true],[data-dropdown-trigger][aria-expanded=true]:hover,dropdown-menu[open]::part(trigger),dropdown-menu[open]::part(trigger):hover{background:color-mix(in srgb,var(--color-surface) 88%,black);box-shadow:inset 0 1px 2px #00000014}[data-dropdown-trigger-label],dropdown-menu::part(trigger-label){min-width:0}[data-dropdown-trigger-icon],dropdown-menu::part(trigger-icon){display:inline-flex;align-items:center;justify-content:center;flex:none;color:var(--color-text-muted);transform:translateY(1px)}dropdown-item:focus-visible{outline:2px solid var(--color-focus-ring);outline-offset:2px}dropdown-menu::part(panel){position:absolute;left:0;min-width:192px;padding:var(--space-4);border-radius:var(--radius-8);display:flex;flex-direction:column;gap:2px;z-index:2000}dropdown-menu::part(panel-bottom){top:calc(100% + var(--space-4))}dropdown-menu::part(panel-top){bottom:calc(100% + var(--space-4))}dropdown-item{display:flex;align-items:center;gap:var(--space-8);margin:0;padding:6px 12px;border-radius:var(--radius-8);font:inherit;line-height:1.2;color:inherit;font-weight:var(--font-weight-body);-webkit-user-select:none;user-select:none}dropdown-item>[data-ui-icon]{flex:none}dropdown-item[selected]{background:var(--color-overlay-active)}dropdown-item:hover{background:var(--color-primary);color:var(--white)}dropdown-item[action]{color:inherit}dropdown-item[danger]{color:var(--color-danger)}dropdown-item[danger]:hover{background:var(--color-danger);color:var(--white)}modal-overlay{color:inherit}modal-overlay::part(backdrop){position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--layer-overlay);display:flex;align-items:center;justify-content:center;padding:var(--space-16);background:var(--color-overlay-backdrop)}panel-view{display:block}panel-view::part(panel){display:flex;flex-direction:column;gap:var(--space-16);color:var(--color-text)}panel-view::part(header){display:flex;align-items:center;justify-content:space-between;gap:var(--space-12)}panel-view::part(title){margin:0;font:inherit;font-size:var(--text-lg);font-weight:600;color:var(--color-text)}panel-view::part(button){display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;margin:0;border:1px solid var(--color-border);border-radius:var(--radius-4);background:var(--color-surface);color:var(--color-text);box-shadow:none}panel-view::part(button):hover{background:var(--color-interactive-hover)}panel-view::part(button):focus-visible{outline:2px solid var(--color-focus-ring);outline-offset:2px}panel-view::part(icon){display:inline-flex;align-items:center;justify-content:center;flex:none}ui-popover{display:contents}ui-popover::part(panel){position:fixed;min-width:192px;max-width:384px;padding:var(--space-16) var(--space-20);border-radius:var(--radius-16);outline:none;z-index:2000}ui-pill{display:inline-block;vertical-align:baseline;margin:2px 0;padding:0 var(--space-8);font-size:var(--text-sm);font-weight:500;line-height:1.7;border-radius:var(--radius-full);border:1px solid var(--neutral-300);background:var(--neutral-200);color:var(--neutral-900);white-space:nowrap}ui-pill[color=gray]{border-color:var(--neutral-300);background:var(--neutral-200);color:var(--neutral-900)}ui-pill[color=red]{border-color:var(--red-200);background:var(--red-100);color:var(--red-950)}ui-pill[color=orange]{border-color:var(--orange-200);background:var(--orange-100);color:var(--orange-950)}ui-pill[color=yellow]{border-color:var(--yellow-200);background:var(--yellow-100);color:var(--yellow-950)}ui-pill[color=green]{border-color:var(--green-200);background:var(--green-100);color:var(--green-950)}ui-pill[color=blue]{border-color:var(--blue-200);background:var(--blue-100);color:var(--blue-950)}ui-pill[color=purple]{border-color:var(--purple-200);background:var(--purple-100);color:var(--purple-950)}',uh=new CSSStyleSheet;uh.replaceSync(tD);try{document.adoptedStyleSheets=[...document.adoptedStyleSheets,uh]}catch{}iy(document);function sy(n){try{n.adoptedStyleSheets=[...n.adoptedStyleSheets,uh]}catch{}iy(n)}/**
47
+ */const ns=globalThis,Kp=n=>n,va=ns.trustedTypes,Jp=va?va.createPolicy("lit-html",{createHTML:n=>n}):void 0,Hv="$lit$",sn=`lit$${Math.random().toFixed(9).slice(2)}$`,Bv="?"+sn,C2=`<${Bv}>`,pr=document,os=()=>pr.createComment(""),as=n=>n===null||typeof n!="object"&&typeof n!="function",ih=Array.isArray,I2=n=>ih(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",Kl=`[
48
+ \f\r]`,Li=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Qp=/-->/g,ef=/>/g,Cn=RegExp(`>|${Kl}(?:([^\\s"'>=/]+)(${Kl}*=${Kl}*(?:[^
49
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),tf=/'/g,nf=/"/g,Gv=/^(?:script|style|textarea|title)$/i,P2=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),N=P2(1),pi=Symbol.for("lit-noChange"),se=Symbol.for("lit-nothing"),rf=new WeakMap,Fn=pr.createTreeWalker(pr,129);function Vv(n,e){if(!ih(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Jp!==void 0?Jp.createHTML(e):e}const R2=(n,e)=>{const t=n.length-1,r=[];let i,s=e===2?"<svg>":e===3?"<math>":"",o=Li;for(let a=0;a<t;a++){const l=n[a];let u,h,p=-1,g=0;for(;g<l.length&&(o.lastIndex=g,h=o.exec(l),h!==null);)g=o.lastIndex,o===Li?h[1]==="!--"?o=Qp:h[1]!==void 0?o=ef:h[2]!==void 0?(Gv.test(h[2])&&(i=RegExp("</"+h[2],"g")),o=Cn):h[3]!==void 0&&(o=Cn):o===Cn?h[0]===">"?(o=i??Li,p=-1):h[1]===void 0?p=-2:(p=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?Cn:h[3]==='"'?nf:tf):o===nf||o===tf?o=Cn:o===Qp||o===ef?o=Li:(o=Cn,i=void 0);const m=o===Cn&&n[a+1].startsWith("/>")?" ":"";s+=o===Li?l+C2:p>=0?(r.push(u),l.slice(0,p)+Hv+l.slice(p)+sn+m):l+sn+(p===-2?a:m)}return[Vv(n,s+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]};class ls{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let s=0,o=0;const a=e.length-1,l=this.parts,[u,h]=R2(e,t);if(this.el=ls.createElement(u,r),Fn.currentNode=this.el.content,t===2||t===3){const p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(i=Fn.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const p of i.getAttributeNames())if(p.endsWith(Hv)){const g=h[o++],m=i.getAttribute(p).split(sn),A=/([.?@])?(.*)/.exec(g);l.push({type:1,index:s,name:A[2],strings:m,ctor:A[1]==="."?O2:A[1]==="?"?L2:A[1]==="@"?z2:sl}),i.removeAttribute(p)}else p.startsWith(sn)&&(l.push({type:6,index:s}),i.removeAttribute(p));if(Gv.test(i.tagName)){const p=i.textContent.split(sn),g=p.length-1;if(g>0){i.textContent=va?va.emptyScript:"";for(let m=0;m<g;m++)i.append(p[m],os()),Fn.nextNode(),l.push({type:2,index:++s});i.append(p[g],os())}}}else if(i.nodeType===8)if(i.data===Bv)l.push({type:2,index:s});else{let p=-1;for(;(p=i.data.indexOf(sn,p+1))!==-1;)l.push({type:7,index:s}),p+=sn.length-1}s++}}static createElement(e,t){const r=pr.createElement("template");return r.innerHTML=e,r}}function fi(n,e,t=n,r){var o,a;if(e===pi)return e;let i=r!==void 0?(o=t._$Co)==null?void 0:o[r]:t._$Cl;const s=as(e)?void 0:e._$litDirective$;return(i==null?void 0:i.constructor)!==s&&((a=i==null?void 0:i._$AO)==null||a.call(i,!1),s===void 0?i=void 0:(i=new s(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??(t._$Co=[]))[r]=i:t._$Cl=i),i!==void 0&&(e=fi(n,i._$AS(n,e.values),i,r)),e}class D2{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:r}=this._$AD,i=((e==null?void 0:e.creationScope)??pr).importNode(t,!0);Fn.currentNode=i;let s=Fn.nextNode(),o=0,a=0,l=r[0];for(;l!==void 0;){if(o===l.index){let u;l.type===2?u=new sh(s,s.nextSibling,this,e):l.type===1?u=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(u=new M2(s,this,e)),this._$AV.push(u),l=r[++a]}o!==(l==null?void 0:l.index)&&(s=Fn.nextNode(),o++)}return Fn.currentNode=pr,i}p(e){let t=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}let sh=class Wv{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=se,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=(i==null?void 0:i.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=fi(this,e,t),as(e)?e===se||e==null||e===""?(this._$AH!==se&&this._$AR(),this._$AH=se):e!==this._$AH&&e!==pi&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):I2(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==se&&as(this._$AH)?this._$AA.nextSibling.data=e:this.T(pr.createTextNode(e)),this._$AH=e}$(e){var s;const{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=ls.createElement(Vv(r.h,r.h[0]),this.options)),r);if(((s=this._$AH)==null?void 0:s._$AD)===i)this._$AH.p(t);else{const o=new D2(i,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=rf.get(e.strings);return t===void 0&&rf.set(e.strings,t=new ls(e)),t}k(e){ih(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,i=0;for(const s of e)i===t.length?t.push(r=new Wv(this.O(os()),this.O(os()),this,this.options)):r=t[i],r._$AI(s),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,t);e!==this._$AB;){const i=Kp(e).nextSibling;Kp(e).remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}},sl=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,s){this.type=1,this._$AH=se,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=se}_$AI(e,t=this,r,i){const s=this.strings;let o=!1;if(s===void 0)e=fi(this,e,t,0),o=!as(e)||e!==this._$AH&&e!==pi,o&&(this._$AH=e);else{const a=e;let l,u;for(e=s[0],l=0;l<s.length-1;l++)u=fi(this,a[r+l],t,l),u===pi&&(u=this._$AH[l]),o||(o=!as(u)||u!==this._$AH[l]),u===se?e=se:e!==se&&(e+=(u??"")+s[l+1]),this._$AH[l]=u}o&&!i&&this.j(e)}j(e){e===se?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},O2=class extends sl{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===se?void 0:e}},L2=class extends sl{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==se)}},z2=class extends sl{constructor(e,t,r,i,s){super(e,t,r,i,s),this.type=5}_$AI(e,t=this){if((e=fi(this,e,t,0)??se)===pi)return;const r=this._$AH,i=e===se&&r!==se||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,s=e!==se&&(r===se||i);i&&this.element.removeEventListener(this.name,this,r),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}};class M2{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){fi(this,e)}}const Jl=ns.litHtmlPolyfillSupport;Jl==null||Jl(ls,sh),(ns.litHtmlVersions??(ns.litHtmlVersions=[])).push("3.3.2");const Re=(n,e,t)=>{const r=e;let i=r._$litPart$;return i===void 0&&(r._$litPart$=i=new sh(e.insertBefore(os(),null),null,void 0,{})),i._$AI(n),i},N2=.5,sf=.1,of=8,U2=4,jv=3,qv=3,F2=4,Zn=255,Yv=.2126,Xv=.7152,Kv=.0722;async function oh(n){const e=Z2(n);if(!e)return"light";try{return await G2(n,e)>=N2?"light":"dark"}catch{return"light"}}function Z2(n){if(typeof document.elementsFromPoint!="function")return null;const e=n.getBoundingClientRect(),t=e.left+e.width/2,r=e.top+e.height/2,i=document.elementsFromPoint(t,r);for(const s of i){if(!(s instanceof HTMLElement)||s===n||n.contains(s))continue;const o=window.getComputedStyle(s);if(H2(o))return s}return null}function H2(n){return n.backgroundImage&&n.backgroundImage!=="none"?!0:B2(n.backgroundColor)>0}function B2(n){if(!n)return 0;const e=n.match(/rgba?\(([^)]+)\)/);if(!e)return 0;const t=e[1].split(/[\s,/]+/).filter(Boolean);return t.length===F2?parseFloat(t[jv]):t.length===qv?1:0}async function G2(n,e){const t=n.getBoundingClientRect(),r=e.getBoundingClientRect(),i={x:Ro((t.left-r.left)/r.width),y:Ro((t.top-r.top)/r.height),width:Ro(t.width/r.width),height:Ro(t.height/r.height)},s=window.getComputedStyle(e),o=V2(s.backgroundImage);return o?j2({url:o,surfaceWidth:r.width,surfaceHeight:r.height,region:i}):q2(s.backgroundColor)}function V2(n){const e=n.match(/url\(\s*["']?([^"')]+)["']?\s*\)/);return e?e[1]:null}const af=new Map;function W2(n){let e=af.get(n);return e||(e=new Promise((t,r)=>{const i=new Image;i.crossOrigin="anonymous",i.onload=()=>t(i),i.onerror=()=>r(new Error(`Failed to load ${n}`)),i.src=n}),af.set(n,e),e)}async function j2(n){const e=await W2(n.url),t=Math.max(of,Math.ceil(n.surfaceWidth*sf)),r=Math.max(of,Math.ceil(n.surfaceHeight*sf)),i=document.createElement("canvas");i.width=t,i.height=r;const s=i.getContext("2d",{willReadFrequently:!0});if(!s)return 1;const o=n.surfaceWidth/n.surfaceHeight,a=e.naturalWidth/e.naturalHeight;let l,u;a>o?(u=r,l=r*a):(l=t,u=t/a);const h=(t-l)/2,p=(r-u)/2;s.drawImage(e,h,p,l,u);const g=Math.max(0,Math.floor(n.region.x*t)),m=Math.max(0,Math.floor(n.region.y*r)),A=Math.max(1,Math.min(t-g,Math.floor(n.region.width*t))),k=Math.max(1,Math.min(r-m,Math.floor(n.region.height*r))),I=s.getImageData(g,m,A,k).data;let U=0,P=0;for(let V=0;V<I.length;V+=U2){const O=I[V]/Zn,H=I[V+1]/Zn,F=I[V+2]/Zn,ce=I[V+jv]/Zn;U+=ce*(Yv*O+Xv*H+Kv*F),P+=1}return P>0?U/P:1}function q2(n){const e=n.match(/rgba?\(([^)]+)\)/);if(!e)return 1;const t=e[1].split(/[\s,/]+/).filter(Boolean).map(parseFloat);if(t.length<qv)return 1;const r=t[0]/Zn,i=t[1]/Zn,s=t[2]/Zn;return Yv*r+Xv*i+Kv*s}function Ro(n){return n<0?0:n>1?1:n}const Ql=new WeakSet,lf=new WeakSet;function Jv(n){if(lf.has(n))return;lf.add(n);for(const t of n.querySelectorAll('button[variant="ghost"]'))ec(t);if(typeof MutationObserver!="function")return;new MutationObserver(t=>{for(const r of t)if(r.type==="childList")for(const i of r.addedNodes)Y2(i,ec);else r.type==="attributes"&&r.target instanceof HTMLButtonElement&&r.target.getAttribute("variant")==="ghost"&&ec(r.target)}).observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["variant"]})}function Y2(n,e){if(n instanceof Element){n instanceof HTMLButtonElement&&n.getAttribute("variant")==="ghost"&&e(n);for(const t of n.querySelectorAll('button[variant="ghost"]'))e(t)}}async function ec(n){if(Ql.has(n))return;Ql.add(n);const e=await oh(n);if(n.getAttribute("variant")!=="ghost"){Ql.delete(n);return}n.setAttribute("tone",e)}const X2="*,*:before,*:after{box-sizing:border-box}html,body{margin:0;padding:0;width:100%;height:100%}h1,h2,h3,h4,h5,h6,p,ul,ol,blockquote,pre,hr{margin:0}button,input,textarea,select{font:inherit;color:inherit}@font-face{font-family:Hind;src:url("+new URL("Hind-Variable-C47b_dt9.woff2",import.meta.url).href+') format("woff2-variations");font-weight:300 700;font-style:normal;font-display:swap}:root{--font-sans: "Hind", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;--font-brand: var(--font-sans);--font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;--font-weight-body: 500;--text-base: 13.5px;--text-scale: 1.125;--text-sm: round(calc(var(--text-base) / var(--text-scale)), 1px);--text-lg: round(calc(var(--text-base) * var(--text-scale)), 1px);--text-xl: round(calc(var(--text-lg) * var(--text-scale)), 1px);--leading-base: 1.5;--space-2: 2px;--space-4: 4px;--space-6: 6px;--space-8: 8px;--space-12: 12px;--space-16: 16px;--space-20: 20px;--space-24: 24px;--space-32: 32px;--space-48: 48px;--space-64: 64px;--radius-4: 4px;--radius-8: 8px;--radius-12: 12px;--radius-16: 16px;--radius-24: 24px;--radius-full: 9999px;--shadow-hairline: 0 0 0 .5px var(--color-border);--shadow-control: 0 1px 1px rgb(0 0 0 / .04), 0 2px 6px rgb(0 0 0 / .06);--alpha-50: 4%;--alpha-100: 8%;--alpha-200: 15%;--alpha-300: 22%;--alpha-400: 30%;--alpha-500: 40%;--alpha-600: 50%;--alpha-700: 65%;--alpha-800: 80%;--alpha-900: 90%;--alpha-950: 95%;--tint-50: color-mix(in srgb, currentColor var(--alpha-50), transparent);--tint-100: color-mix(in srgb, currentColor var(--alpha-100), transparent);--tint-200: color-mix(in srgb, currentColor var(--alpha-200), transparent);--tint-300: color-mix(in srgb, currentColor var(--alpha-300), transparent);--tint-400: color-mix(in srgb, currentColor var(--alpha-400), transparent);--tint-500: color-mix(in srgb, currentColor var(--alpha-500), transparent);--tint-600: color-mix(in srgb, currentColor var(--alpha-600), transparent);--tint-700: color-mix(in srgb, currentColor var(--alpha-700), transparent);--tint-800: color-mix(in srgb, currentColor var(--alpha-800), transparent);--tint-900: color-mix(in srgb, currentColor var(--alpha-900), transparent);--tint-950: color-mix(in srgb, currentColor var(--alpha-950), transparent);--color-overlay-hover: color-mix(in srgb, var(--black) var(--alpha-100), transparent);--color-overlay-active: color-mix(in srgb, var(--black) var(--alpha-300), transparent);--backdrop-blur-glass: blur(20px) saturate(1.4);--black: #000000;--white: #ffffff;--neutral-50: oklch(.985 0 0);--neutral-100: oklch(.97 0 0);--neutral-200: oklch(.923 0 0);--neutral-300: oklch(.869 0 0);--neutral-350: oklch(.79 0 0);--neutral-400: oklch(.709 0 0);--neutral-500: oklch(.553 0 0);--neutral-600: oklch(.444 0 0);--neutral-700: oklch(.374 0 0);--neutral-800: oklch(.268 0 0);--neutral-900: oklch(.216 0 0);--neutral-950: oklch(.147 0 0);--red-50: oklch(.969 .015 12.422);--red-100: oklch(.941 .03 12.58);--red-200: oklch(.892 .058 10.001);--red-300: oklch(.81 .117 11.638);--red-400: oklch(.712 .194 13.428);--red-500: oklch(.645 .246 16.439);--red-600: oklch(.586 .253 17.585);--red-700: oklch(.514 .222 16.935);--red-800: oklch(.455 .188 13.697);--red-900: oklch(.41 .159 10.272);--red-950: oklch(.271 .105 12.094);--orange-50: oklch(.98 .016 73.684);--orange-100: oklch(.954 .038 75.164);--orange-200: oklch(.901 .076 70.697);--orange-300: oklch(.837 .128 66.29);--orange-400: oklch(.75 .183 55.934);--orange-500: oklch(.705 .213 47.604);--orange-600: oklch(.646 .222 41.116);--orange-700: oklch(.553 .195 38.402);--orange-800: oklch(.47 .157 37.304);--orange-900: oklch(.408 .123 38.172);--orange-950: oklch(.266 .079 36.259);--yellow-50: oklch(.987 .026 102.212);--yellow-100: oklch(.973 .071 103.193);--yellow-200: oklch(.945 .129 101.54);--yellow-300: oklch(.905 .182 98.111);--yellow-400: oklch(.852 .199 91.936);--yellow-500: oklch(.795 .184 86.047);--yellow-600: oklch(.681 .162 75.834);--yellow-700: oklch(.554 .135 66.442);--yellow-800: oklch(.476 .114 61.907);--yellow-900: oklch(.421 .095 57.708);--yellow-950: oklch(.286 .066 53.813);--green-50: oklch(.979 .021 166.113);--green-100: oklch(.95 .052 163.051);--green-200: oklch(.905 .093 164.15);--green-300: oklch(.845 .143 164.978);--green-400: oklch(.765 .177 163.223);--green-500: oklch(.696 .17 162.48);--green-600: oklch(.596 .145 163.225);--green-700: oklch(.508 .118 165.612);--green-800: oklch(.432 .095 166.913);--green-900: oklch(.378 .077 168.94);--green-950: oklch(.262 .051 172.552);--blue-50: oklch(.97 .014 254.604);--blue-100: oklch(.932 .032 255.585);--blue-200: oklch(.882 .059 254.128);--blue-300: oklch(.809 .105 251.813);--blue-400: oklch(.707 .165 254.624);--blue-500: oklch(.623 .214 259.815);--blue-600: oklch(.546 .245 262.881);--blue-700: oklch(.488 .243 264.376);--blue-800: oklch(.424 .199 265.638);--blue-900: oklch(.379 .146 265.522);--blue-950: oklch(.282 .091 267.935);--purple-50: oklch(.969 .016 293.756);--purple-100: oklch(.943 .029 294.588);--purple-200: oklch(.894 .057 293.283);--purple-300: oklch(.811 .111 293.571);--purple-400: oklch(.702 .183 293.541);--purple-500: oklch(.606 .25 292.717);--purple-600: oklch(.541 .281 293.009);--purple-700: oklch(.491 .27 292.581);--purple-800: oklch(.432 .232 292.759);--purple-900: oklch(.38 .189 293.745);--purple-950: oklch(.283 .141 291.089)}@supports (corner-shape: squircle){:root{--radius-8: 10px;--radius-12: 15px;--radius-16: 20px;--radius-24: 30px}}:root[data-font=system]{--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif}:root{--color-bg: var(--neutral-50);--color-bg-muted: var(--neutral-100);--color-surface: var(--white);--color-surface-muted: var(--neutral-100);--color-interactive: var(--neutral-200);--color-interactive-hover: var(--neutral-300);--color-border: rgba(0, 0, 0, .1);--color-border-muted: rgba(0, 0, 0, .06);--color-text: var(--neutral-900);--color-text-muted: var(--neutral-500);--color-link: inherit;--color-focus-ring: var(--neutral-500);--color-overlay-backdrop: rgb(0 0 0 / .5);--color-highlight: rgb(255 255 255 / .5);--color-primary: var(--blue-500);--color-danger: var(--red-600);color-scheme:light}body{font-family:var(--font-sans);font-size:var(--text-base);font-weight:var(--font-weight-body);line-height:var(--leading-base);letter-spacing:.015em;color:var(--color-text);background:var(--color-bg);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}a{color:var(--color-link);text-underline-offset:.15em;text-decoration-thickness:.08em}h1,h2,h3,h4,h5,h6{font-weight:600;color:inherit}code{font-family:var(--font-mono);font-size:.9em;background:var(--color-bg-muted);padding:var(--space-2) var(--space-4);border-radius:var(--radius-4)}pre{font-family:var(--font-mono);background:var(--color-bg-muted);padding:var(--space-12);border-radius:var(--radius-8);overflow-x:auto}pre code{background:none;padding:0}blockquote{padding-left:var(--space-16);border-left:3px solid var(--color-border);color:var(--color-text-muted)}hr{border:none;border-top:1px solid var(--color-border)}table{border-collapse:collapse}th,td{padding:var(--space-8) var(--space-12);border:1px solid var(--color-border);text-align:left}th{background:var(--color-bg-muted);font-weight:600}input,textarea{padding:6px 10px;border:.5px solid var(--tint-300);border-radius:var(--radius-12);background:var(--tint-100);color:inherit;font:inherit;transition:background .12s ease,border-color .12s ease,box-shadow .12s ease}textarea{resize:none}input::placeholder,textarea::placeholder{color:var(--tint-500)}input:focus,textarea:focus{background:color-mix(in srgb,var(--white) var(--alpha-300),transparent);border-color:var(--color-primary);outline:none;box-shadow:0 0 0 1.5px var(--color-primary)}label.field{display:grid;gap:4px;font-size:13px}label.field>span{font-size:11.5px;font-weight:450;color:var(--tint-800)}@supports (corner-shape: squircle){*{corner-shape:squircle}}button{display:inline-flex;align-items:center;justify-content:center;gap:var(--space-6);padding:4px 14px;border:.5px solid var(--tint-200);border-radius:var(--radius-12);background:var(--color-surface);color:inherit;font:inherit;cursor:default;box-shadow:var(--shadow-control)}button:hover:not(:disabled){background:color-mix(in srgb,var(--color-surface) 96%,black)}button:active:not(:disabled){background:color-mix(in srgb,var(--color-surface) 88%,black);box-shadow:inset 0 1px 2px #00000014}button:focus-visible{outline:2px solid var(--color-focus-ring);outline-offset:2px}button[variant=primary]{background:var(--color-primary);border-color:#0000002e;color:var(--white)}button[variant=primary]:hover:not(:disabled){background:color-mix(in srgb,var(--color-primary) 92%,black)}button[variant=primary]:active:not(:disabled){background:color-mix(in srgb,var(--color-primary) 82%,black);box-shadow:inset 0 1px 2px #0000002e}button[variant=danger]{background:var(--color-danger);border-color:#0000002e;color:var(--white)}button[variant=danger]:hover:not(:disabled){background:color-mix(in srgb,var(--color-danger) 92%,black)}button[variant=danger]:active:not(:disabled){background:color-mix(in srgb,var(--color-danger) 82%,black);box-shadow:inset 0 1px 2px #0000002e}button[variant=ghost]{background:transparent;border-color:transparent;color:inherit;box-shadow:none}button[variant=ghost]:hover:not(:disabled){background:var(--color-overlay-hover)}button[variant=ghost]:active:not(:disabled){background:var(--color-overlay-active);box-shadow:none}button[variant=ghost][data-active]:not(:disabled),button[variant=ghost][data-active]:hover:not(:disabled),button[variant=ghost][aria-expanded=true]:not(:disabled),button[variant=ghost][aria-expanded=true]:hover:not(:disabled){background:var(--color-overlay-active);box-shadow:none}button:disabled{background:var(--tint-300);border-color:transparent;color:var(--tint-700);box-shadow:none}[tone=dark] button:not([variant]):not(:disabled){background:var(--tint-200);border-color:var(--tint-300);box-shadow:inset 0 .5px 0 var(--tint-300)}[tone=dark] button:not([variant]):hover:not(:disabled){background:var(--tint-300)}[tone=dark] button:not([variant]):active:not(:disabled){background:var(--tint-400);box-shadow:inset 0 1px 2px #0003}[tone=light] button:not([variant]):not(:disabled){background:var(--color-surface);border-color:var(--tint-200);box-shadow:var(--shadow-control)}[tone=light] button:not([variant]):hover:not(:disabled){background:color-mix(in srgb,var(--color-surface) 96%,black)}[tone=light] button:not([variant]):active:not(:disabled){background:color-mix(in srgb,var(--color-surface) 88%,black);box-shadow:inset 0 1px 2px #00000014}button[size=sm]{min-height:24px;padding:var(--space-2) var(--space-8)}button[size=md]{min-height:32px;padding:var(--space-6) var(--space-12)}button[icon-only]{width:24px;height:24px;min-height:0;padding:0}[data-ui-icon]{display:inline-block;vertical-align:middle}.prose{line-height:var(--leading-base)}.prose h1{font-size:var(--text-xl);margin-bottom:var(--space-8)}.prose h2{font-size:var(--text-lg);margin-top:var(--space-24);margin-bottom:var(--space-8)}.prose h3,.prose h4,.prose h5,.prose h6{font-size:var(--text-base);margin-top:var(--space-24);margin-bottom:var(--space-8)}.prose p{margin:var(--space-12) 0}.prose ul,.prose ol{padding-left:var(--space-24);margin:var(--space-12) 0}.prose blockquote,.prose pre{margin:var(--space-12) 0}.prose hr{margin:var(--space-24) 0}.prose table{width:100%;margin:var(--space-12) 0}.prose img{max-width:100%;height:auto}.prose>:first-child{margin-top:0}.prose>:last-child{margin-bottom:0}[material=paper]{background:var(--white);border:.5px solid color-mix(in srgb,var(--black) var(--alpha-100),transparent);color:var(--color-text)}[material=glass]{background:color-mix(in srgb,var(--white) var(--alpha-700),transparent);border:.5px solid color-mix(in srgb,var(--black) var(--alpha-100),transparent);color:var(--color-text);backdrop-filter:var(--backdrop-blur-glass);-webkit-backdrop-filter:var(--backdrop-blur-glass)}[tone=dark]{color:color-mix(in srgb,var(--white) var(--alpha-950),transparent);border-color:color-mix(in srgb,var(--white) var(--alpha-200),transparent);--color-overlay-hover: color-mix(in srgb, var(--white) var(--alpha-200), transparent);--color-overlay-active: color-mix(in srgb, var(--black) var(--alpha-500), transparent)}[tone=dark][material=paper]{background:#000}[tone=dark][material=glass]{background:color-mix(in srgb,var(--black) var(--alpha-600),transparent)}[tone=light]{color:var(--color-text);border-color:color-mix(in srgb,var(--black) var(--alpha-100),transparent);--color-overlay-hover: color-mix(in srgb, var(--black) var(--alpha-100), transparent);--color-overlay-active: color-mix(in srgb, var(--black) var(--alpha-300), transparent)}[level="1"]{box-shadow:0 12px 32px #00000024}[level="2"]{box-shadow:0 4px 6px -2px #0000001f,0 40px 60px -16px #00000038}dropdown-menu{position:relative;display:inline-block;color:inherit}dropdown-group{display:grid;gap:var(--space-4)}dropdown-label{display:block;padding:var(--space-4) var(--space-8);color:var(--color-text-muted);font:inherit;font-size:var(--text-sm);font-weight:600;letter-spacing:.04em;text-transform:uppercase}dropdown-divider{display:block;height:1px;margin:2px 0;background:var(--color-border)}[data-dropdown-trigger][aria-expanded=true],[data-dropdown-trigger][aria-expanded=true]:hover,dropdown-menu[open]::part(trigger),dropdown-menu[open]::part(trigger):hover{background:color-mix(in srgb,var(--color-surface) 88%,black);box-shadow:inset 0 1px 2px #00000014}[data-dropdown-trigger-label],dropdown-menu::part(trigger-label){min-width:0}[data-dropdown-trigger-icon],dropdown-menu::part(trigger-icon){display:inline-flex;align-items:center;justify-content:center;flex:none;color:var(--color-text-muted);transform:translateY(1px)}dropdown-item:focus-visible{outline:2px solid var(--color-focus-ring);outline-offset:2px}dropdown-menu::part(panel){position:absolute;left:0;min-width:192px;padding:var(--space-4);border-radius:var(--radius-8);display:flex;flex-direction:column;gap:2px;z-index:2000}dropdown-menu::part(panel-bottom){top:calc(100% + var(--space-4))}dropdown-menu::part(panel-top){bottom:calc(100% + var(--space-4))}dropdown-item{display:flex;align-items:center;gap:var(--space-8);margin:0;padding:6px 12px;border-radius:var(--radius-8);font:inherit;line-height:1.2;color:inherit;font-weight:var(--font-weight-body);-webkit-user-select:none;user-select:none}dropdown-item>[data-ui-icon]{flex:none}dropdown-item[selected]{background:var(--color-overlay-active)}dropdown-item:hover{background:var(--color-primary);color:var(--white)}dropdown-item[action]{color:inherit}dropdown-item[danger]{color:var(--color-danger)}dropdown-item[danger]:hover{background:var(--color-danger);color:var(--white)}modal-overlay{color:inherit}modal-overlay::part(backdrop){position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--layer-overlay);display:flex;align-items:center;justify-content:center;padding:var(--space-16);background:var(--color-overlay-backdrop)}panel-view{display:block}panel-view::part(panel){display:flex;flex-direction:column;gap:var(--space-16);color:var(--color-text)}panel-view::part(header){display:flex;align-items:center;justify-content:space-between;gap:var(--space-12)}panel-view::part(title){margin:0;font:inherit;font-size:var(--text-lg);font-weight:600;color:var(--color-text)}panel-view::part(button){display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;margin:0;border:1px solid var(--color-border);border-radius:var(--radius-4);background:var(--color-surface);color:var(--color-text);box-shadow:none}panel-view::part(button):hover{background:var(--color-interactive-hover)}panel-view::part(button):focus-visible{outline:2px solid var(--color-focus-ring);outline-offset:2px}panel-view::part(icon){display:inline-flex;align-items:center;justify-content:center;flex:none}ui-popover{display:contents}ui-popover::part(panel){position:fixed;min-width:192px;max-width:384px;padding:var(--space-16) var(--space-20);border-radius:var(--radius-16);outline:none;z-index:2000}ui-pill{display:inline-block;vertical-align:baseline;margin:2px 0;padding:0 var(--space-8);font-size:var(--text-sm);font-weight:500;line-height:1.7;border-radius:var(--radius-full);border:1px solid var(--neutral-300);background:var(--neutral-200);color:var(--neutral-900);white-space:nowrap}ui-pill[color=gray]{border-color:var(--neutral-300);background:var(--neutral-200);color:var(--neutral-900)}ui-pill[color=red]{border-color:var(--red-200);background:var(--red-100);color:var(--red-950)}ui-pill[color=orange]{border-color:var(--orange-200);background:var(--orange-100);color:var(--orange-950)}ui-pill[color=yellow]{border-color:var(--yellow-200);background:var(--yellow-100);color:var(--yellow-950)}ui-pill[color=green]{border-color:var(--green-200);background:var(--green-100);color:var(--green-950)}ui-pill[color=blue]{border-color:var(--blue-200);background:var(--blue-100);color:var(--blue-950)}ui-pill[color=purple]{border-color:var(--purple-200);background:var(--purple-100);color:var(--purple-950)}',ah=new CSSStyleSheet;ah.replaceSync(X2);try{document.adoptedStyleSheets=[...document.adoptedStyleSheets,ah]}catch{}Jv(document);function Qv(n){try{n.adoptedStyleSheets=[...n.adoptedStyleSheets,ah]}catch{}Jv(n)}/**
50
50
  * @license
51
51
  * Copyright 2017 Google LLC
52
52
  * SPDX-License-Identifier: BSD-3-Clause
53
- */const oy={CHILD:2},hh=n=>(...e)=>({_$litDirective$:n,values:e});class ay{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
53
+ */const ey={CHILD:2},lh=n=>(...e)=>({_$litDirective$:n,values:e});class ty{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}/**
54
54
  * @license
55
55
  * Copyright 2017 Google LLC
56
56
  * SPDX-License-Identifier: BSD-3-Clause
57
- */let ya=class extends ay{constructor(e){if(super(e),this.it=se,e.type!==oy.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===se||e==null)return this._t=void 0,this.it=e;if(e===pi)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};ya.directiveName="unsafeHTML",ya.resultType=1;const nD=hh(ya);/**
57
+ */let ya=class extends ty{constructor(e){if(super(e),this.it=se,e.type!==ey.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===se||e==null)return this._t=void 0,this.it=e;if(e===pi)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};ya.directiveName="unsafeHTML",ya.resultType=1;const K2=lh(ya);/**
58
58
  * @license
59
59
  * Copyright 2017 Google LLC
60
60
  * SPDX-License-Identifier: BSD-3-Clause
61
- */class Wc extends ya{}Wc.directiveName="unsafeSVG",Wc.resultType=2;const rD=hh(Wc),iD={size:16,color:"currentColor",weight:"regular"};function sD(n){return typeof n=="string"?{regular:n}:n}function Lt(n,e="0 0 256 256"){const t=sD(n);return r=>{const{size:i,color:s,weight:o}={...iD,...r},a=t[o]??t.regular;return N`<svg
61
+ */class Bc extends ya{}Bc.directiveName="unsafeSVG",Bc.resultType=2;const J2=lh(Bc),Q2={size:16,color:"currentColor",weight:"regular"};function eD(n){return typeof n=="string"?{regular:n}:n}function Lt(n,e="0 0 256 256"){const t=eD(n);return r=>{const{size:i,color:s,weight:o}={...Q2,...r},a=t[o]??t.regular;return N`<svg
62
62
  xmlns="http://www.w3.org/2000/svg"
63
63
  data-ui-icon=""
64
64
  width="${i}"
65
65
  height="${i}"
66
66
  viewBox="${e}"
67
67
  fill="${s}"
68
- >${rD(a)}</svg>`}}const oD=Lt('<path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" d="M200 224H56C53.8783 224 51.8434 223.157 50.3431 221.657C48.8429 220.157 48 218.122 48 216V40C48 37.8783 48.8429 35.8434 50.3431 34.3431C51.8434 32.8429 53.8783 32 56 32H152L208 88V216C208 218.122 207.157 220.157 205.657 221.657C204.157 223.157 202.122 224 200 224Z"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" d="M152 32V88H208"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" d="M80 88H124.5"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" d="M80 128H175"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" d="M80 169H175"/>'),ly=Lt('<path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"/>'),aD=Lt('<path d="M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"/>'),cy=Lt('<path d="M213.66,93.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,82.34L128,156.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"/>'),lD=Lt('<path d="M213.66,162.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,53.66,173.66L128,99.31l74.34,74.35a8,8,0,0,0,11.32-11.32Z"/>'),cD=Lt('<path d="M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"/>'),uD=Lt({regular:'<path d="M219.31,108.68l-80-80a16,16,0,0,0-22.62,0l-80,80A15.87,15.87,0,0,0,32,120v96a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V160h32v56a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V120A15.87,15.87,0,0,0,219.31,108.68ZM208,208H160V152a8,8,0,0,0-8-8H104a8,8,0,0,0-8,8v56H48V120l80-80,80,80Z"/>',bold:'<path d="M222.14,105.85l-80-80a20,20,0,0,0-28.28,0l-80,80A19.86,19.86,0,0,0,28,120v96a12,12,0,0,0,12,12h64a12,12,0,0,0,12-12V164h24v52a12,12,0,0,0,12,12h64a12,12,0,0,0,12-12V120A19.86,19.86,0,0,0,222.14,105.85ZM204,204H164V152a12,12,0,0,0-12-12H104a12,12,0,0,0-12,12v52H52V121.65l76-76,76,76Z"/>',fill:'<path d="M224,120v96a8,8,0,0,1-8,8H160a8,8,0,0,1-8-8V164a4,4,0,0,0-4-4H108a4,4,0,0,0-4,4v52a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V120a16,16,0,0,1,4.69-11.31l80-80a16,16,0,0,1,22.62,0l80,80A16,16,0,0,1,224,120Z"/>'}),hD=Lt({regular:'<path d="M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM51.31,160,136,75.31,152.69,92,68,176.68ZM48,179.31,76.69,208H48Zm48,25.38L79.31,188,164,103.31,180.69,120Zm96-96L147.31,64l24-24L216,84.68Z"/>',bold:'<path d="M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM93,180l71-71,11,11-71,71ZM76,163,65,152l71-71,11,11ZM52,173l15.51,15.51h0L83,204H52ZM192,103,153,64l18.34-18.34,39,39Z"/>'}),dD=Lt({regular:'<path d="M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"/>',bold:'<path d="M216,44H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v4H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V68h4a12,12,0,0,0,0-24ZM104,40h48v4H104Zm84,164H68V68H188Zm-84-48V120a12,12,0,0,1,24,0v36a12,12,0,0,1-24,0Zm40,0V120a12,12,0,0,1,24,0v36a12,12,0,0,1-24,0Z"/>'}),jc=Lt({regular:'<path d="M239.18,97.26A16.38,16.38,0,0,0,224.92,86l-59-4.76L143.14,26.15a16.36,16.36,0,0,0-30.27,0L90.11,81.23,31.08,86a16.46,16.46,0,0,0-9.37,28.86l45,38.83L53,211.75a16.38,16.38,0,0,0,24.5,17.82L128,198.49l50.53,31.08A16.4,16.4,0,0,0,203,211.75l-13.76-58.07,45-38.83A16.43,16.43,0,0,0,239.18,97.26Zm-15.34,5.47-48.7,42a8,8,0,0,0-2.56,7.91l14.88,62.8a.37.37,0,0,1-.17.48c-.18.14-.23.11-.38,0l-54.72-33.65a8,8,0,0,0-8.38,0L69.09,215.94c-.15.09-.19.12-.38,0a.37.37,0,0,1-.17-.48l14.88-62.8a8,8,0,0,0-2.56-7.91l-48.7-42c-.12-.1-.23-.19-.13-.5s.18-.27.33-.29l63.92-5.16A8,8,0,0,0,103,91.86l24.62-59.61c.08-.17.11-.25.35-.25s.27.08.35.25L153,91.86a8,8,0,0,0,6.75,4.92l63.92,5.16c.15,0,.24,0,.33.29S224,102.63,223.84,102.73Z"/>',bold:'<path d="M243,96a20.33,20.33,0,0,0-17.74-14l-56.59-4.57L146.83,24.62a20.36,20.36,0,0,0-37.66,0L87.35,77.44,30.76,82A20.45,20.45,0,0,0,19.1,117.88l43.18,37.24-13.2,55.7A20.37,20.37,0,0,0,79.57,233L128,203.19,176.43,233a20.39,20.39,0,0,0,30.49-22.15l-13.2-55.7,43.18-37.24A20.43,20.43,0,0,0,243,96ZM172.53,141.7a12,12,0,0,0-3.84,11.86L181.58,208l-47.29-29.08a12,12,0,0,0-12.58,0L74.42,208l12.89-54.4a12,12,0,0,0-3.84-11.86L41.2,105.24l55.4-4.47a12,12,0,0,0,10.13-7.38L128,41.89l21.27,51.5a12,12,0,0,0,10.13,7.38l55.4,4.47Z"/>',fill:'<path d="M234.29,114.85l-45,38.83L203,211.75a16.4,16.4,0,0,1-24.5,17.82L128,198.49,77.47,229.57A16.4,16.4,0,0,1,53,211.75l13.76-58.07-45-38.83A16.46,16.46,0,0,1,31.08,86l59-4.76,22.76-55.08a16.36,16.36,0,0,1,30.27,0l22.75,55.08,59,4.76a16.46,16.46,0,0,1,9.37,28.86Z"/>'});class uy extends Event{constructor(t){super("dropdown-item-select",{bubbles:!0,composed:!0});b(this,"value");this.value=t}}class pD extends Event{constructor(t){super("select",{bubbles:!0,composed:!0});b(this,"value");this.value=t}}var Ke,ft,dn,Qn,ne,ks,z,dy,Wi,py,fy,qc,gy,ji,Dn,er,Es,xs,As,Aa,my,vy,Yc,qi,yy,Xc,Zt;class hy extends HTMLElement{constructor(){super();w(this,z);w(this,Ke,!1);w(this,ft,null);w(this,dn,null);w(this,Qn);w(this,ne,null);w(this,ks,new MutationObserver(t=>v(this,z,my).call(this,t)));w(this,er,()=>{v(this,z,ji).call(this,!c(this,Ke))});w(this,Es,t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),c(this,er).call(this))});w(this,xs,t=>{c(this,Ke)&&(t.composedPath().includes(this)||v(this,z,ji).call(this,!1))});w(this,As,t=>{t instanceof uy&&(t.stopPropagation(),E(this,Ke,!1),v(this,z,Wi).call(this,t.value),v(this,z,Zt).call(this),this.dispatchEvent(new pD(t.value)))});w(this,Aa,()=>{v(this,z,Yc).call(this)});E(this,Qn,this.attachShadow({mode:"open"})),sy(c(this,Qn))}connectedCallback(){this.addEventListener("dropdown-item-select",c(this,As)),document.addEventListener("click",c(this,xs),!0),v(this,z,dy).call(this),c(this,ks).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["selected","value","slot"]}),v(this,z,Zt).call(this)}disconnectedCallback(){this.removeEventListener("dropdown-item-select",c(this,As)),document.removeEventListener("click",c(this,xs),!0),c(this,ks).disconnect(),v(this,z,Xc).call(this)}attributeChangedCallback(t){if(t==="open"){v(this,z,ji).call(this,this.hasAttribute("open"));return}v(this,z,Zt).call(this)}get open(){return c(this,Ke)}set open(t){this.toggleAttribute("open",t)}get title(){return this.getAttribute("title")??""}get placement(){return this.getAttribute("placement")==="top"?"top":"bottom"}get value(){return c(this,ft)}set value(t){t===null?(v(this,z,Dn).call(this,null,null),v(this,z,py).call(this)):v(this,z,Wi).call(this,t),v(this,z,Zt).call(this)}close(){v(this,z,ji).call(this,!1)}}Ke=new WeakMap,ft=new WeakMap,dn=new WeakMap,Qn=new WeakMap,ne=new WeakMap,ks=new WeakMap,z=new WeakSet,dy=function(){var r;const t=this.querySelector("dropdown-item[selected]");t&&v(this,z,Dn).call(this,t.value,((r=t.textContent)==null?void 0:r.trim())??null)},Wi=function(t){var r;for(const i of c(this,z,qc))i.value===t?(v(this,z,Dn).call(this,t,((r=i.textContent)==null?void 0:r.trim())??null),i.hasAttribute("selected")||i.setAttribute("selected","")):i.hasAttribute("selected")&&i.removeAttribute("selected")},py=function(){const t=this.querySelectorAll("dropdown-item[selected]");for(const r of t)r.removeAttribute("selected")},fy=function(t){for(const r of c(this,z,qc))if(r.value===t)return r;return null},qc=function(){return this.querySelectorAll("dropdown-item")},gy=function(){return c(this,dn)??this.title},ji=function(t){c(this,Ke)!==t&&(E(this,Ke,t),v(this,z,Zt).call(this))},Dn=function(t,r){E(this,ft,t),E(this,dn,r)},er=new WeakMap,Es=new WeakMap,xs=new WeakMap,As=new WeakMap,Aa=new WeakMap,my=function(t){t.every(i=>i.target instanceof Element?i.target.closest('[slot="trigger"]')!==null:!1)||v(this,z,vy).call(this)},vy=function(){var r,i;const t=this.querySelector("dropdown-item[selected]");if(t){const s=t.value,o=((r=t.textContent)==null?void 0:r.trim())??null,a=c(this,ft)!==s||c(this,dn)!==o;v(this,z,Dn).call(this,s,o),v(this,z,Wi).call(this,s),a?v(this,z,Zt).call(this):v(this,z,qi).call(this);return}if(c(this,ft)!==null){const s=v(this,z,fy).call(this,c(this,ft));if(s){const o=((i=s.textContent)==null?void 0:i.trim())??null,a=c(this,dn)!==o;v(this,z,Dn).call(this,c(this,ft),o),v(this,z,Wi).call(this,c(this,ft)),a?v(this,z,Zt).call(this):v(this,z,qi).call(this);return}}if(c(this,ft)!==null||c(this,dn)!==null){v(this,z,Dn).call(this,null,null),v(this,z,Zt).call(this);return}v(this,z,qi).call(this)},Yc=function(){const t=c(this,Qn).querySelector('slot[name="trigger"]'),r=t instanceof HTMLSlotElement?t.assignedElements()[0]??null:null;c(this,ne)!==r&&(v(this,z,Xc).call(this),E(this,ne,r),c(this,ne)&&(c(this,ne).addEventListener("click",c(this,er)),c(this,ne)instanceof HTMLButtonElement?c(this,ne).hasAttribute("type")||(c(this,ne).type="button"):(c(this,ne).hasAttribute("role")||c(this,ne).setAttribute("role","button"),c(this,ne).hasAttribute("tabindex")||(c(this,ne).tabIndex=0),c(this,ne).addEventListener("keydown",c(this,Es))))),v(this,z,qi).call(this)},qi=function(){c(this,ne)&&(c(this,ne).setAttribute("data-dropdown-trigger",""),c(this,ne).setAttribute("aria-haspopup","listbox"),c(this,ne).setAttribute("aria-expanded",c(this,Ke)?"true":"false"))},yy=function(){return this.placement==="top"?lD:cy},Xc=function(){c(this,ne)&&(c(this,ne).removeEventListener("click",c(this,er)),c(this,ne).removeEventListener("keydown",c(this,Es)),c(this,ne).removeAttribute("data-dropdown-trigger"),c(this,ne).removeAttribute("aria-haspopup"),c(this,ne).removeAttribute("aria-expanded"),E(this,ne,null))},Zt=function(){this.toggleAttribute("open",c(this,Ke)),Re(N`
68
+ >${J2(a)}</svg>`}}const tD=Lt('<path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" d="M200 224H56C53.8783 224 51.8434 223.157 50.3431 221.657C48.8429 220.157 48 218.122 48 216V40C48 37.8783 48.8429 35.8434 50.3431 34.3431C51.8434 32.8429 53.8783 32 56 32H152L208 88V216C208 218.122 207.157 220.157 205.657 221.657C204.157 223.157 202.122 224 200 224Z"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" d="M152 32V88H208"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" d="M80 88H124.5"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" d="M80 128H175"/><path fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" d="M80 169H175"/>'),ny=Lt('<path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"/>'),nD=Lt('<path d="M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"/>'),ry=Lt('<path d="M213.66,93.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,82.34L128,156.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"/>'),rD=Lt('<path d="M213.66,162.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,53.66,173.66L128,99.31l74.34,74.35a8,8,0,0,0,11.32-11.32Z"/>'),iD=Lt('<path d="M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"/>'),sD=Lt({regular:'<path d="M219.31,108.68l-80-80a16,16,0,0,0-22.62,0l-80,80A15.87,15.87,0,0,0,32,120v96a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V160h32v56a8,8,0,0,0,8,8h64a8,8,0,0,0,8-8V120A15.87,15.87,0,0,0,219.31,108.68ZM208,208H160V152a8,8,0,0,0-8-8H104a8,8,0,0,0-8,8v56H48V120l80-80,80,80Z"/>',bold:'<path d="M222.14,105.85l-80-80a20,20,0,0,0-28.28,0l-80,80A19.86,19.86,0,0,0,28,120v96a12,12,0,0,0,12,12h64a12,12,0,0,0,12-12V164h24v52a12,12,0,0,0,12,12h64a12,12,0,0,0,12-12V120A19.86,19.86,0,0,0,222.14,105.85ZM204,204H164V152a12,12,0,0,0-12-12H104a12,12,0,0,0-12,12v52H52V121.65l76-76,76,76Z"/>',fill:'<path d="M224,120v96a8,8,0,0,1-8,8H160a8,8,0,0,1-8-8V164a4,4,0,0,0-4-4H108a4,4,0,0,0-4,4v52a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V120a16,16,0,0,1,4.69-11.31l80-80a16,16,0,0,1,22.62,0l80,80A16,16,0,0,1,224,120Z"/>'}),oD=Lt({regular:'<path d="M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM51.31,160,136,75.31,152.69,92,68,176.68ZM48,179.31,76.69,208H48Zm48,25.38L79.31,188,164,103.31,180.69,120Zm96-96L147.31,64l24-24L216,84.68Z"/>',bold:'<path d="M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM93,180l71-71,11,11-71,71ZM76,163,65,152l71-71,11,11ZM52,173l15.51,15.51h0L83,204H52ZM192,103,153,64l18.34-18.34,39,39Z"/>'}),aD=Lt({regular:'<path d="M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"/>',bold:'<path d="M216,44H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v4H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V68h4a12,12,0,0,0,0-24ZM104,40h48v4H104Zm84,164H68V68H188Zm-84-48V120a12,12,0,0,1,24,0v36a12,12,0,0,1-24,0Zm40,0V120a12,12,0,0,1,24,0v36a12,12,0,0,1-24,0Z"/>'}),Gc=Lt({regular:'<path d="M239.18,97.26A16.38,16.38,0,0,0,224.92,86l-59-4.76L143.14,26.15a16.36,16.36,0,0,0-30.27,0L90.11,81.23,31.08,86a16.46,16.46,0,0,0-9.37,28.86l45,38.83L53,211.75a16.38,16.38,0,0,0,24.5,17.82L128,198.49l50.53,31.08A16.4,16.4,0,0,0,203,211.75l-13.76-58.07,45-38.83A16.43,16.43,0,0,0,239.18,97.26Zm-15.34,5.47-48.7,42a8,8,0,0,0-2.56,7.91l14.88,62.8a.37.37,0,0,1-.17.48c-.18.14-.23.11-.38,0l-54.72-33.65a8,8,0,0,0-8.38,0L69.09,215.94c-.15.09-.19.12-.38,0a.37.37,0,0,1-.17-.48l14.88-62.8a8,8,0,0,0-2.56-7.91l-48.7-42c-.12-.1-.23-.19-.13-.5s.18-.27.33-.29l63.92-5.16A8,8,0,0,0,103,91.86l24.62-59.61c.08-.17.11-.25.35-.25s.27.08.35.25L153,91.86a8,8,0,0,0,6.75,4.92l63.92,5.16c.15,0,.24,0,.33.29S224,102.63,223.84,102.73Z"/>',bold:'<path d="M243,96a20.33,20.33,0,0,0-17.74-14l-56.59-4.57L146.83,24.62a20.36,20.36,0,0,0-37.66,0L87.35,77.44,30.76,82A20.45,20.45,0,0,0,19.1,117.88l43.18,37.24-13.2,55.7A20.37,20.37,0,0,0,79.57,233L128,203.19,176.43,233a20.39,20.39,0,0,0,30.49-22.15l-13.2-55.7,43.18-37.24A20.43,20.43,0,0,0,243,96ZM172.53,141.7a12,12,0,0,0-3.84,11.86L181.58,208l-47.29-29.08a12,12,0,0,0-12.58,0L74.42,208l12.89-54.4a12,12,0,0,0-3.84-11.86L41.2,105.24l55.4-4.47a12,12,0,0,0,10.13-7.38L128,41.89l21.27,51.5a12,12,0,0,0,10.13,7.38l55.4,4.47Z"/>',fill:'<path d="M234.29,114.85l-45,38.83L203,211.75a16.4,16.4,0,0,1-24.5,17.82L128,198.49,77.47,229.57A16.4,16.4,0,0,1,53,211.75l13.76-58.07-45-38.83A16.46,16.46,0,0,1,31.08,86l59-4.76,22.76-55.08a16.36,16.36,0,0,1,30.27,0l22.75,55.08,59,4.76a16.46,16.46,0,0,1,9.37,28.86Z"/>'});class iy extends Event{constructor(t){super("dropdown-item-select",{bubbles:!0,composed:!0});b(this,"value");this.value=t}}class lD extends Event{constructor(t){super("select",{bubbles:!0,composed:!0});b(this,"value");this.value=t}}var Ke,ft,dn,Qn,ne,ks,z,oy,Wi,ay,ly,Vc,cy,ji,Dn,er,Es,xs,As,Aa,uy,hy,Wc,qi,dy,jc,Zt;class sy extends HTMLElement{constructor(){super();w(this,z);w(this,Ke,!1);w(this,ft,null);w(this,dn,null);w(this,Qn);w(this,ne,null);w(this,ks,new MutationObserver(t=>v(this,z,uy).call(this,t)));w(this,er,()=>{v(this,z,ji).call(this,!c(this,Ke))});w(this,Es,t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),c(this,er).call(this))});w(this,xs,t=>{c(this,Ke)&&(t.composedPath().includes(this)||v(this,z,ji).call(this,!1))});w(this,As,t=>{t instanceof iy&&(t.stopPropagation(),E(this,Ke,!1),v(this,z,Wi).call(this,t.value),v(this,z,Zt).call(this),this.dispatchEvent(new lD(t.value)))});w(this,Aa,()=>{v(this,z,Wc).call(this)});E(this,Qn,this.attachShadow({mode:"open"})),Qv(c(this,Qn))}connectedCallback(){this.addEventListener("dropdown-item-select",c(this,As)),document.addEventListener("click",c(this,xs),!0),v(this,z,oy).call(this),c(this,ks).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["selected","value","slot"]}),v(this,z,Zt).call(this)}disconnectedCallback(){this.removeEventListener("dropdown-item-select",c(this,As)),document.removeEventListener("click",c(this,xs),!0),c(this,ks).disconnect(),v(this,z,jc).call(this)}attributeChangedCallback(t){if(t==="open"){v(this,z,ji).call(this,this.hasAttribute("open"));return}v(this,z,Zt).call(this)}get open(){return c(this,Ke)}set open(t){this.toggleAttribute("open",t)}get title(){return this.getAttribute("title")??""}get placement(){return this.getAttribute("placement")==="top"?"top":"bottom"}get value(){return c(this,ft)}set value(t){t===null?(v(this,z,Dn).call(this,null,null),v(this,z,ay).call(this)):v(this,z,Wi).call(this,t),v(this,z,Zt).call(this)}close(){v(this,z,ji).call(this,!1)}}Ke=new WeakMap,ft=new WeakMap,dn=new WeakMap,Qn=new WeakMap,ne=new WeakMap,ks=new WeakMap,z=new WeakSet,oy=function(){var r;const t=this.querySelector("dropdown-item[selected]");t&&v(this,z,Dn).call(this,t.value,((r=t.textContent)==null?void 0:r.trim())??null)},Wi=function(t){var r;for(const i of c(this,z,Vc))i.value===t?(v(this,z,Dn).call(this,t,((r=i.textContent)==null?void 0:r.trim())??null),i.hasAttribute("selected")||i.setAttribute("selected","")):i.hasAttribute("selected")&&i.removeAttribute("selected")},ay=function(){const t=this.querySelectorAll("dropdown-item[selected]");for(const r of t)r.removeAttribute("selected")},ly=function(t){for(const r of c(this,z,Vc))if(r.value===t)return r;return null},Vc=function(){return this.querySelectorAll("dropdown-item")},cy=function(){return c(this,dn)??this.title},ji=function(t){c(this,Ke)!==t&&(E(this,Ke,t),v(this,z,Zt).call(this))},Dn=function(t,r){E(this,ft,t),E(this,dn,r)},er=new WeakMap,Es=new WeakMap,xs=new WeakMap,As=new WeakMap,Aa=new WeakMap,uy=function(t){t.every(i=>i.target instanceof Element?i.target.closest('[slot="trigger"]')!==null:!1)||v(this,z,hy).call(this)},hy=function(){var r,i;const t=this.querySelector("dropdown-item[selected]");if(t){const s=t.value,o=((r=t.textContent)==null?void 0:r.trim())??null,a=c(this,ft)!==s||c(this,dn)!==o;v(this,z,Dn).call(this,s,o),v(this,z,Wi).call(this,s),a?v(this,z,Zt).call(this):v(this,z,qi).call(this);return}if(c(this,ft)!==null){const s=v(this,z,ly).call(this,c(this,ft));if(s){const o=((i=s.textContent)==null?void 0:i.trim())??null,a=c(this,dn)!==o;v(this,z,Dn).call(this,c(this,ft),o),v(this,z,Wi).call(this,c(this,ft)),a?v(this,z,Zt).call(this):v(this,z,qi).call(this);return}}if(c(this,ft)!==null||c(this,dn)!==null){v(this,z,Dn).call(this,null,null),v(this,z,Zt).call(this);return}v(this,z,qi).call(this)},Wc=function(){const t=c(this,Qn).querySelector('slot[name="trigger"]'),r=t instanceof HTMLSlotElement?t.assignedElements()[0]??null:null;c(this,ne)!==r&&(v(this,z,jc).call(this),E(this,ne,r),c(this,ne)&&(c(this,ne).addEventListener("click",c(this,er)),c(this,ne)instanceof HTMLButtonElement?c(this,ne).hasAttribute("type")||(c(this,ne).type="button"):(c(this,ne).hasAttribute("role")||c(this,ne).setAttribute("role","button"),c(this,ne).hasAttribute("tabindex")||(c(this,ne).tabIndex=0),c(this,ne).addEventListener("keydown",c(this,Es))))),v(this,z,qi).call(this)},qi=function(){c(this,ne)&&(c(this,ne).setAttribute("data-dropdown-trigger",""),c(this,ne).setAttribute("aria-haspopup","listbox"),c(this,ne).setAttribute("aria-expanded",c(this,Ke)?"true":"false"))},dy=function(){return this.placement==="top"?rD:ry},jc=function(){c(this,ne)&&(c(this,ne).removeEventListener("click",c(this,er)),c(this,ne).removeEventListener("keydown",c(this,Es)),c(this,ne).removeAttribute("data-dropdown-trigger"),c(this,ne).removeAttribute("aria-haspopup"),c(this,ne).removeAttribute("aria-expanded"),E(this,ne,null))},Zt=function(){this.toggleAttribute("open",c(this,Ke)),Re(N`
69
69
  <slot name="trigger" @slotchange=${c(this,Aa)}>
70
70
  <button
71
71
  class="fallback-trigger"
@@ -75,9 +75,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
75
75
  aria-expanded=${c(this,Ke)?"true":"false"}
76
76
  @click=${c(this,er)}
77
77
  >
78
- <span class="trigger-label" part="trigger-label">${c(this,z,gy)}</span>
78
+ <span class="trigger-label" part="trigger-label">${c(this,z,cy)}</span>
79
79
  <span class="trigger-icon" part="trigger-icon" aria-hidden="true">
80
- ${c(this,z,yy).call(this,{size:16})}
80
+ ${c(this,z,dy).call(this,{size:16})}
81
81
  </span>
82
82
  </button>
83
83
  </slot>
@@ -92,13 +92,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
92
92
  <slot></slot>
93
93
  </div>
94
94
  `:null}
95
- `,c(this,Qn)),queueMicrotask(()=>v(this,z,Yc).call(this))},b(hy,"observedAttributes",["title","placement","open"]);class fD extends HTMLElement{}class gD extends HTMLElement{}class mD extends HTMLElement{}var mr,Kc,wy,$s,Ts;class by extends HTMLElement{constructor(){super(...arguments);w(this,mr);w(this,$s,()=>{this.action||v(this,mr,wy).call(this)});w(this,Ts,t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),this.click())})}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","option"),this.hasAttribute("tabindex")||(this.tabIndex=0),this.addEventListener("click",c(this,$s)),this.addEventListener("keydown",c(this,Ts)),v(this,mr,Kc).call(this)}disconnectedCallback(){this.removeEventListener("click",c(this,$s)),this.removeEventListener("keydown",c(this,Ts))}attributeChangedCallback(){v(this,mr,Kc).call(this)}get value(){return this.getAttribute("value")??""}get selected(){return this.hasAttribute("selected")}get action(){return this.hasAttribute("action")}}mr=new WeakSet,Kc=function(){if(this.action){this.setAttribute("role","button"),this.removeAttribute("aria-selected");return}this.setAttribute("role","option"),this.setAttribute("aria-selected",this.selected?"true":"false")},wy=function(){this.dispatchEvent(new uy(this.value))},$s=new WeakMap,Ts=new WeakMap,b(by,"observedAttributes",["action","selected","value"]);customElements.get("dropdown-menu")||customElements.define("dropdown-menu",hy);customElements.get("dropdown-group")||customElements.define("dropdown-group",fD);customElements.get("dropdown-label")||customElements.define("dropdown-label",gD);customElements.get("dropdown-divider")||customElements.define("dropdown-divider",mD);customElements.get("dropdown-item")||customElements.define("dropdown-item",by);class vD extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}var Cs,wn,Jc,$a,Is,Qc;class Sy extends HTMLElement{constructor(){super();w(this,wn);w(this,Cs);w(this,$a,t=>{t.target===t.currentTarget&&v(this,wn,Jc).call(this)});w(this,Is,t=>{this.open&&t.key==="Escape"&&v(this,wn,Jc).call(this)});E(this,Cs,this.attachShadow({mode:"open"}))}connectedCallback(){document.addEventListener("keydown",c(this,Is)),v(this,wn,Qc).call(this)}disconnectedCallback(){document.removeEventListener("keydown",c(this,Is))}attributeChangedCallback(){v(this,wn,Qc).call(this)}get open(){return this.hasAttribute("open")}}Cs=new WeakMap,wn=new WeakSet,Jc=function(){this.dispatchEvent(new vD)},$a=new WeakMap,Is=new WeakMap,Qc=function(){Re(N`
95
+ `,c(this,Qn)),queueMicrotask(()=>v(this,z,Wc).call(this))},b(sy,"observedAttributes",["title","placement","open"]);class cD extends HTMLElement{}class uD extends HTMLElement{}class hD extends HTMLElement{}var mr,qc,fy,$s,Ts;class py extends HTMLElement{constructor(){super(...arguments);w(this,mr);w(this,$s,()=>{this.action||v(this,mr,fy).call(this)});w(this,Ts,t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),this.click())})}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","option"),this.hasAttribute("tabindex")||(this.tabIndex=0),this.addEventListener("click",c(this,$s)),this.addEventListener("keydown",c(this,Ts)),v(this,mr,qc).call(this)}disconnectedCallback(){this.removeEventListener("click",c(this,$s)),this.removeEventListener("keydown",c(this,Ts))}attributeChangedCallback(){v(this,mr,qc).call(this)}get value(){return this.getAttribute("value")??""}get selected(){return this.hasAttribute("selected")}get action(){return this.hasAttribute("action")}}mr=new WeakSet,qc=function(){if(this.action){this.setAttribute("role","button"),this.removeAttribute("aria-selected");return}this.setAttribute("role","option"),this.setAttribute("aria-selected",this.selected?"true":"false")},fy=function(){this.dispatchEvent(new iy(this.value))},$s=new WeakMap,Ts=new WeakMap,b(py,"observedAttributes",["action","selected","value"]);customElements.get("dropdown-menu")||customElements.define("dropdown-menu",sy);customElements.get("dropdown-group")||customElements.define("dropdown-group",cD);customElements.get("dropdown-label")||customElements.define("dropdown-label",uD);customElements.get("dropdown-divider")||customElements.define("dropdown-divider",hD);customElements.get("dropdown-item")||customElements.define("dropdown-item",py);class dD extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}var Cs,wn,Yc,$a,Is,Xc;class gy extends HTMLElement{constructor(){super();w(this,wn);w(this,Cs);w(this,$a,t=>{t.target===t.currentTarget&&v(this,wn,Yc).call(this)});w(this,Is,t=>{this.open&&t.key==="Escape"&&v(this,wn,Yc).call(this)});E(this,Cs,this.attachShadow({mode:"open"}))}connectedCallback(){document.addEventListener("keydown",c(this,Is)),v(this,wn,Xc).call(this)}disconnectedCallback(){document.removeEventListener("keydown",c(this,Is))}attributeChangedCallback(){v(this,wn,Xc).call(this)}get open(){return this.hasAttribute("open")}}Cs=new WeakMap,wn=new WeakSet,Yc=function(){this.dispatchEvent(new dD)},$a=new WeakMap,Is=new WeakMap,Xc=function(){Re(N`
96
96
  ${this.open?N`
97
97
  <div class="backdrop" part="backdrop" @click=${c(this,$a)}>
98
98
  <slot></slot>
99
99
  </div>
100
100
  `:null}
101
- `,c(this,Cs))},b(Sy,"observedAttributes",["open"]);customElements.get("modal-overlay")||customElements.define("modal-overlay",Sy);class yD extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}class bD extends HTMLElement{}var Ps,Rs,eu;class _y extends HTMLElement{constructor(){super();w(this,Rs);w(this,Ps);E(this,Ps,this.attachShadow({mode:"open"}))}connectedCallback(){v(this,Rs,eu).call(this)}attributeChangedCallback(){v(this,Rs,eu).call(this)}get closable(){return this.hasAttribute("closable")}}Ps=new WeakMap,Rs=new WeakSet,eu=function(){const t=this.querySelector("panel-page");Re(N`
101
+ `,c(this,Cs))},b(gy,"observedAttributes",["open"]);customElements.get("modal-overlay")||customElements.define("modal-overlay",gy);class pD extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}class fD extends HTMLElement{}var Ps,Rs,Kc;class my extends HTMLElement{constructor(){super();w(this,Rs);w(this,Ps);E(this,Ps,this.attachShadow({mode:"open"}))}connectedCallback(){v(this,Rs,Kc).call(this)}attributeChangedCallback(){v(this,Rs,Kc).call(this)}get closable(){return this.hasAttribute("closable")}}Ps=new WeakMap,Rs=new WeakSet,Kc=function(){const t=this.querySelector("panel-page");Re(N`
102
102
  <section class="panel" part="panel">
103
103
  <header class="title-bar" part="header">
104
104
  <h2 class="title" part="title">${(t==null?void 0:t.getAttribute("title"))??""}</h2>
@@ -108,15 +108,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
108
108
  class="title-button"
109
109
  part="button close-button"
110
110
  aria-label="Close"
111
- @click=${()=>this.dispatchEvent(new yD)}
111
+ @click=${()=>this.dispatchEvent(new pD)}
112
112
  >
113
- <span class="close-icon" part="icon close-icon">${ly({size:16})}</span>
113
+ <span class="close-icon" part="icon close-icon">${ny({size:16})}</span>
114
114
  </button>
115
115
  `:null}
116
116
  </header>
117
117
  <slot></slot>
118
118
  </section>
119
- `,c(this,Ps))},b(_y,"observedAttributes",["closable"]);customElements.get("panel-view")||customElements.define("panel-view",_y);customElements.get("panel-page")||customElements.define("panel-page",bD);class wD extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}const gf='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',ic=4;var Ge,Yt,tr,nt,Ds,Jr,re,Ey,xy,tu,Os,Ls,nr,Ay,nu,$y,Ty,Qo,ea;class ky extends HTMLElement{constructor(){super();w(this,re);w(this,Ge,!1);w(this,Yt,null);w(this,tr);w(this,nt,null);w(this,Ds,"bottom-start");w(this,Jr,!1);w(this,Os,t=>{c(this,Ge)&&(c(this,Jr)||t.composedPath().includes(this)||(this.open=!1))});w(this,Ls,t=>{if(c(this,Ge)){if(t.key==="Escape"){t.preventDefault(),this.open=!1;return}t.key==="Tab"&&v(this,re,Ay).call(this,t)}});w(this,nr,()=>{c(this,Ge)&&v(this,re,Qo).call(this)});E(this,tr,this.attachShadow({mode:"open"})),sy(c(this,tr))}connectedCallback(){this.hasAttribute("tone")||this.setAttribute("tone","light"),v(this,re,ea).call(this)}disconnectedCallback(){v(this,re,tu).call(this)}attributeChangedCallback(t){t==="open"&&v(this,re,Ey).call(this,this.hasAttribute("open"))}get open(){return c(this,Ge)}set open(t){this.toggleAttribute("open",t)}get anchor(){return c(this,Yt)}set anchor(t){c(this,Yt)!==t&&(E(this,Yt,t),c(this,Ge)&&v(this,re,Qo).call(this))}}Ge=new WeakMap,Yt=new WeakMap,tr=new WeakMap,nt=new WeakMap,Ds=new WeakMap,Jr=new WeakMap,re=new WeakSet,Ey=function(t){var r;c(this,Ge)!==t&&(E(this,Ge,t),t?(E(this,Jr,!0),setTimeout(()=>{E(this,Jr,!1)},0),v(this,re,ea).call(this),v(this,re,xy).call(this),queueMicrotask(()=>{c(this,Ge)&&(v(this,re,Qo).call(this),v(this,re,Ty).call(this))})):(v(this,re,tu).call(this),v(this,re,ea).call(this),(r=c(this,Yt))==null||r.focus(),this.dispatchEvent(new wD)))},xy=function(){document.addEventListener("click",c(this,Os)),document.addEventListener("keydown",c(this,Ls),!0),window.addEventListener("resize",c(this,nr)),window.addEventListener("scroll",c(this,nr),!0)},tu=function(){document.removeEventListener("click",c(this,Os)),document.removeEventListener("keydown",c(this,Ls),!0),window.removeEventListener("resize",c(this,nr)),window.removeEventListener("scroll",c(this,nr),!0)},Os=new WeakMap,Ls=new WeakMap,nr=new WeakMap,Ay=function(t){const r=v(this,re,nu).call(this);if(r.length===0){t.preventDefault();return}const i=r[0],s=r[r.length-1],o=v(this,re,$y).call(this),a=o instanceof HTMLElement&&r.includes(o);t.shiftKey?(!a||o===i)&&(t.preventDefault(),s.focus()):(!a||o===s)&&(t.preventDefault(),i.focus())},nu=function(){if(!c(this,nt))return[];const t=c(this,nt).querySelector("slot");if(!(t instanceof HTMLSlotElement))return[];const r=[];for(const i of t.assignedElements({flatten:!0}))if(i instanceof HTMLElement){i.matches(gf)&&r.push(i);for(const s of i.querySelectorAll(gf))r.push(s)}return r},$y=function(){var r;let t=document.activeElement;for(;t&&((r=t.shadowRoot)!=null&&r.activeElement);)t=t.shadowRoot.activeElement;return t},Ty=function(){var r;const t=v(this,re,nu).call(this);t.length>0?t[0].focus():(r=c(this,nt))==null||r.focus()},Qo=function(){if(!c(this,Ge)||!c(this,Yt)||!c(this,nt))return;const t=c(this,Yt).getBoundingClientRect(),r=c(this,nt).getBoundingClientRect(),s=window.innerHeight-t.bottom,o=r.height+ic,a=s<o&&t.top>o?"top-start":"bottom-start";E(this,Ds,a);const l=a==="bottom-start"?t.bottom+ic:t.top-r.height-ic,u=t.left;c(this,nt).style.top=`${l}px`,c(this,nt).style.left=`${u}px`,c(this,nt).setAttribute("data-placement",a)},ea=function(){this.toggleAttribute("open",c(this,Ge)),Re(c(this,Ge)?N`<div
119
+ `,c(this,Ps))},b(my,"observedAttributes",["closable"]);customElements.get("panel-view")||customElements.define("panel-view",my);customElements.get("panel-page")||customElements.define("panel-page",fD);class gD extends Event{constructor(){super("close",{bubbles:!0,composed:!0})}}const cf='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',tc=4;var Ge,Yt,tr,nt,Ds,Jr,re,yy,by,Jc,Os,Ls,nr,wy,Qc,Sy,_y,Qo,ea;class vy extends HTMLElement{constructor(){super();w(this,re);w(this,Ge,!1);w(this,Yt,null);w(this,tr);w(this,nt,null);w(this,Ds,"bottom-start");w(this,Jr,!1);w(this,Os,t=>{c(this,Ge)&&(c(this,Jr)||t.composedPath().includes(this)||(this.open=!1))});w(this,Ls,t=>{if(c(this,Ge)){if(t.key==="Escape"){t.preventDefault(),this.open=!1;return}t.key==="Tab"&&v(this,re,wy).call(this,t)}});w(this,nr,()=>{c(this,Ge)&&v(this,re,Qo).call(this)});E(this,tr,this.attachShadow({mode:"open"})),Qv(c(this,tr))}connectedCallback(){this.hasAttribute("tone")||this.setAttribute("tone","light"),v(this,re,ea).call(this)}disconnectedCallback(){v(this,re,Jc).call(this)}attributeChangedCallback(t){t==="open"&&v(this,re,yy).call(this,this.hasAttribute("open"))}get open(){return c(this,Ge)}set open(t){this.toggleAttribute("open",t)}get anchor(){return c(this,Yt)}set anchor(t){c(this,Yt)!==t&&(E(this,Yt,t),c(this,Ge)&&v(this,re,Qo).call(this))}}Ge=new WeakMap,Yt=new WeakMap,tr=new WeakMap,nt=new WeakMap,Ds=new WeakMap,Jr=new WeakMap,re=new WeakSet,yy=function(t){var r;c(this,Ge)!==t&&(E(this,Ge,t),t?(E(this,Jr,!0),setTimeout(()=>{E(this,Jr,!1)},0),v(this,re,ea).call(this),v(this,re,by).call(this),queueMicrotask(()=>{c(this,Ge)&&(v(this,re,Qo).call(this),v(this,re,_y).call(this))})):(v(this,re,Jc).call(this),v(this,re,ea).call(this),(r=c(this,Yt))==null||r.focus(),this.dispatchEvent(new gD)))},by=function(){document.addEventListener("click",c(this,Os)),document.addEventListener("keydown",c(this,Ls),!0),window.addEventListener("resize",c(this,nr)),window.addEventListener("scroll",c(this,nr),!0)},Jc=function(){document.removeEventListener("click",c(this,Os)),document.removeEventListener("keydown",c(this,Ls),!0),window.removeEventListener("resize",c(this,nr)),window.removeEventListener("scroll",c(this,nr),!0)},Os=new WeakMap,Ls=new WeakMap,nr=new WeakMap,wy=function(t){const r=v(this,re,Qc).call(this);if(r.length===0){t.preventDefault();return}const i=r[0],s=r[r.length-1],o=v(this,re,Sy).call(this),a=o instanceof HTMLElement&&r.includes(o);t.shiftKey?(!a||o===i)&&(t.preventDefault(),s.focus()):(!a||o===s)&&(t.preventDefault(),i.focus())},Qc=function(){if(!c(this,nt))return[];const t=c(this,nt).querySelector("slot");if(!(t instanceof HTMLSlotElement))return[];const r=[];for(const i of t.assignedElements({flatten:!0}))if(i instanceof HTMLElement){i.matches(cf)&&r.push(i);for(const s of i.querySelectorAll(cf))r.push(s)}return r},Sy=function(){var r;let t=document.activeElement;for(;t&&((r=t.shadowRoot)!=null&&r.activeElement);)t=t.shadowRoot.activeElement;return t},_y=function(){var r;const t=v(this,re,Qc).call(this);t.length>0?t[0].focus():(r=c(this,nt))==null||r.focus()},Qo=function(){if(!c(this,Ge)||!c(this,Yt)||!c(this,nt))return;const t=c(this,Yt).getBoundingClientRect(),r=c(this,nt).getBoundingClientRect(),s=window.innerHeight-t.bottom,o=r.height+tc,a=s<o&&t.top>o?"top-start":"bottom-start";E(this,Ds,a);const l=a==="bottom-start"?t.bottom+tc:t.top-r.height-tc,u=t.left;c(this,nt).style.top=`${l}px`,c(this,nt).style.left=`${u}px`,c(this,nt).setAttribute("data-placement",a)},ea=function(){this.toggleAttribute("open",c(this,Ge)),Re(c(this,Ge)?N`<div
120
120
  class="panel"
121
121
  part="panel"
122
122
  data-placement=${c(this,Ds)}
@@ -126,8 +126,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
126
126
  level="1"
127
127
  >
128
128
  <slot></slot>
129
- </div>`:se,c(this,tr)),E(this,nt,c(this,tr).querySelector(".panel"))},b(ky,"observedAttributes",["open"]);customElements.get("ui-popover")||customElements.define("ui-popover",ky);const SD=yt(),_D="No handler registered for update-content",kD="handleUpdateContent: handler already registered";function ED(n){return n instanceof Error&&typeof n.message=="string"?n.message:String(n)}const xD=ki(bt);var Qr,ei,ti,rr,ir,zs,Ce,ru,Cy,Iy,Yi,iu,Wf;let AD=(Wf=class extends xD{constructor(t){super();w(this,Ce);w(this,Qr);w(this,ei);w(this,ti);w(this,rr,null);w(this,ir,null);w(this,zs,!1);E(this,Qr,t);const r=t.ownerDocument.defaultView;if(!r)throw new Error("ArtifactView: iframe has no owner window");E(this,ei,r),E(this,ti,i=>v(this,Ce,Cy).call(this,i)),c(this,ei).addEventListener("message",c(this,ti))}get content(){return c(this,ir)}set content(t){v(this,Ce,iu).call(this),E(this,ir,t),c(this,zs)&&v(this,Ce,ru).call(this,t)}handleUpdateContent(t){if(v(this,Ce,iu).call(this),c(this,rr)!==null)throw new Error(kD);E(this,rr,t)}dispose(){c(this,ei).removeEventListener("message",c(this,ti)),E(this,rr,null)}},Qr=new WeakMap,ei=new WeakMap,ti=new WeakMap,rr=new WeakMap,ir=new WeakMap,zs=new WeakMap,Ce=new WeakSet,ru=function(t){const r={type:"content-updated",content:t};v(this,Ce,Yi).call(this,r)},Cy=function(t){if(this.disposed||t.source!==c(this,Qr).contentWindow)return;const r=t.data;if(AC(r)){E(this,zs,!0),this.dispatchEvent(new SD("ready")),c(this,ir)!==null&&v(this,Ce,ru).call(this,c(this,ir));return}if($C(r)){v(this,Ce,Iy).call(this,r);return}},Iy=async function(t){const r=c(this,rr);if(r===null){v(this,Ce,Yi).call(this,{type:"response",id:t.id,error:{message:_D}});return}try{await r(t.content)}catch(i){if(this.disposed)return;v(this,Ce,Yi).call(this,{type:"response",id:t.id,error:{message:ED(i)}});return}this.disposed||v(this,Ce,Yi).call(this,{type:"response",id:t.id,result:{}})},Yi=function(t){const r=c(this,Qr).contentWindow;r&&r.postMessage(t,"*")},iu=function(){if(this.disposed)throw new Error("ArtifactView is disposed")},Wf);function $D(n=window){if(n.parent===n)return;let e=0,t=0;n.document.documentElement&&(n.document.documentElement.style.touchAction="pan-y"),n.addEventListener("wheel",a=>{const l=a;e=l.clientX,t=l.clientY,n.parent.postMessage({type:"wheel",deltaX:l.deltaX,deltaY:l.deltaY,shiftKey:l.shiftKey},"*"),l.preventDefault()},{passive:!1});const r=8,i=100,s=1e3,o=new Map;n.addEventListener("pointerdown",a=>{const l=a;l.pointerType==="touch"&&o.set(l.pointerId,{startX:l.clientX,startY:l.clientY,lastX:l.clientX,offset:0,active:!1,discarded:!1,samples:[{time:l.timeStamp,offset:0}]})},{passive:!0}),n.addEventListener("pointermove",a=>{const l=a,u=o.get(l.pointerId);if(!u||u.discarded)return;if(!u.active){const m=l.clientX-u.startX,A=l.clientY-u.startY,k=Math.abs(m),I=Math.abs(A);if(k<r&&I<r)return;if(I>=k){u.discarded=!0;return}u.active=!0}const h=l.clientX-u.lastX;u.lastX=l.clientX,u.offset+=h,u.samples.push({time:l.timeStamp,offset:u.offset});const p=l.timeStamp-i;let g=0;for(let m=0;m<u.samples.length;m+=1){if(u.samples[m].time>=p){g=m;break}g=m+1}if(g>0){const m=Math.max(0,g-1);u.samples.splice(0,m)}n.parent.postMessage({type:"swipe-move",deltaX:h},"*"),l.preventDefault()},{passive:!1}),n.addEventListener("pointerup",a=>{const l=a,u=o.get(l.pointerId);if(!u||(o.delete(l.pointerId),!u.active))return;let h=0;if(u.samples.length>=2){const p=u.samples[0],g=u.samples[u.samples.length-1],m=g.time-p.time;m>0&&(h=(g.offset-p.offset)/m*s)}n.parent.postMessage({type:"swipe-end",velocityX:h},"*")}),n.addEventListener("pointercancel",a=>{const l=a,u=o.get(l.pointerId);u&&(o.delete(l.pointerId),u.active&&n.parent.postMessage({type:"swipe-end",velocityX:0},"*"))}),n.addEventListener("message",a=>{var m,A;const l=a.data;if(l===null||typeof l!="object"||l.type!=="scroll")return;const u=l,h=typeof u.deltaX=="number"?u.deltaX:0,p=typeof u.deltaY=="number"?u.deltaY:0;let g=((A=(m=n.document).elementFromPoint)==null?void 0:A.call(m,e,t))??null;for(;g!==null;){const k=n.getComputedStyle(g);if(p!==0){const I=(k.overflowY==="auto"||k.overflowY==="scroll")&&g.scrollHeight>g.clientHeight,U=p>0?g.scrollTop+g.clientHeight<g.scrollHeight:g.scrollTop>0;if(I&&U){g.scrollBy(h,p);return}}if(h!==0){const I=(k.overflowX==="auto"||k.overflowX==="scroll")&&g.scrollWidth>g.clientWidth,U=h>0?g.scrollLeft+g.clientWidth<g.scrollWidth:g.scrollLeft>0;if(I&&U){g.scrollBy(h,p);return}}g=g.parentElement}n.scrollBy(h,p)})}function TD(){return`(${$D.toString()})(window);`}async function CD(n){const e=await fetch(n);if(!e.ok)throw new Error(`Failed to fetch artifact content: ${e.status}`);const t=await e.text(),r=new DOMParser().parseFromString(t,"text/html"),i=r.createElement("base");i.href=new URL(n,window.location.href).href,r.head.insertBefore(i,r.head.firstChild);const s=r.createElement("script");s.textContent=TD(),r.head.appendChild(s);const o=new Blob([`<!DOCTYPE html>
130
- ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(o)}const Py=yt();class ID extends HTMLElement{constructor(){super(...arguments);b(this,"_artifact",null);b(this,"_viewURL",null);b(this,"_contentURL",null);b(this,"_screen",null);b(this,"_subscribedScreen",null);b(this,"_activeView",null);b(this,"_contentState",{kind:"idle"});b(this,"_fetchSequence",0);b(this,"_blobSequence",0);b(this,"_mountedViewURL",null);b(this,"_directRender",!1);b(this,"_blobURL",null);b(this,"handleScreenContentChanged",t=>{!this._artifact||t.artifactID!==this._artifact.id||this._activeView!==null&&this.refetchContent()})}set artifact(t){const r=this._artifact;this._artifact=t,this.render(),r!==null&&r!==t&&this.syncView()}get artifact(){return this._artifact}set viewURL(t){this._viewURL!==t&&(this._viewURL=t,this.syncView())}get viewURL(){return this._viewURL}set contentURL(t){this._contentURL!==t&&(this._contentURL=t,this.syncView())}get contentURL(){return this._contentURL}set screen(t){this._screen!==t&&(this._screen=t,this.syncScreenSubscription())}get screen(){return this._screen}set dragging(t){t?this.setAttribute("dragging","true"):this.removeAttribute("dragging")}get dragging(){return this.getAttribute("dragging")==="true"}get activeView(){return this._activeView}connectedCallback(){this.setAttribute("level","2"),this.render(),this.syncView(),this.syncScreenSubscription()}disconnectedCallback(){this.teardownView(),this.unsubscribeFromScreen()}handleClose(){this._artifact&&this.dispatchEvent(new Py("close-artifact",{artifactID:this._artifact.id,bubbles:!0,composed:!0}))}syncView(){var t;if(this.isConnected){if(this._viewURL!==null){if(this._directRender&&this.teardownView(),this._mountedViewURL!==this._viewURL){this.teardownView(),this._contentState={kind:"loading"},this._mountedViewURL=this._viewURL,this.render();const r=this.querySelector("iframe.artifact-frame");if(!r){this._contentState={kind:"error"},this.render();return}this._activeView=new AD(r),this._activeView.handleUpdateContent(async i=>{await this.saveContent(i)}),this.loadBlobFrame(this._viewURL),this.startContentFetch();return}this._activeView!==null&&this.startContentFetch();return}if(this._contentURL!==null){this.teardownView(),this._directRender=!0,this._contentState={kind:"idle"},this.render(),((t=this._artifact)==null?void 0:t.status)==="committed"&&this.loadBlobFrame(this._contentURL);return}this.teardownView(),this._contentState={kind:"idle"},this.render()}}async saveContent(t){const r=this._screen,i=this._artifact;if(!r||!i)throw new Error("artifact-view: cannot save without a screen and artifact");await r.server.client.artifacts.putContent({artifactID:i.id,content:t})}syncScreenSubscription(){if(!this.isConnected){this.unsubscribeFromScreen();return}this._subscribedScreen!==this._screen&&(this.unsubscribeFromScreen(),this._screen!==null&&(this._screen.addEventListener("artifact-content-changed",this.handleScreenContentChanged),this._subscribedScreen=this._screen))}unsubscribeFromScreen(){this._subscribedScreen!==null&&(this._subscribedScreen.removeEventListener("artifact-content-changed",this.handleScreenContentChanged),this._subscribedScreen=null)}startContentFetch(){this._fetchSequence+=1;const t=this._fetchSequence,r=this._contentURL,i=this._activeView;if(!i||r===null){this._contentState={kind:"error"},this.render();return}this._contentState={kind:"loading"},(async()=>{try{const s=await fetch(r);if(t!==this._fetchSequence)return;if(!s.ok){this._contentState={kind:"error"},this.teardownView(),this.render();return}const o=await s.text();if(t!==this._fetchSequence||this._activeView!==i)return;this._activeView.content=o,this._contentState={kind:"ready"}}catch{if(t!==this._fetchSequence)return;this._contentState={kind:"error"},this.teardownView(),this.render()}})()}refetchContent(){this._fetchSequence+=1;const t=this._fetchSequence,r=this._contentURL,i=this._activeView;!i||r===null||(async()=>{try{const s=await fetch(r);if(t!==this._fetchSequence||!s.ok)return;const o=await s.text();if(t!==this._fetchSequence||this._activeView!==i)return;this._activeView.content=o}catch{}})()}loadBlobFrame(t){this._blobSequence+=1;const r=this._blobSequence;(async()=>{try{const i=await CD(t);if(r!==this._blobSequence){URL.revokeObjectURL(i);return}this._blobURL=i,this.render();const s=this.querySelector("iframe.artifact-frame");s&&(s.src=i)}catch{if(r!==this._blobSequence)return;this._contentState={kind:"error"},this.teardownView(),this.render()}})()}teardownView(){this._activeView!==null&&(this._activeView.dispose(),this._activeView=null),this._blobURL!==null&&(URL.revokeObjectURL(this._blobURL),this._blobURL=null),this._mountedViewURL=null,this._directRender=!1,this._fetchSequence+=1,this._blobSequence+=1}contentTemplate(){return this._contentState.kind==="error"?N`
129
+ </div>`:se,c(this,tr)),E(this,nt,c(this,tr).querySelector(".panel"))},b(vy,"observedAttributes",["open"]);customElements.get("ui-popover")||customElements.define("ui-popover",vy);const mD=yt(),vD="No handler registered for update-content",yD="handleUpdateContent: handler already registered";function bD(n){return n instanceof Error&&typeof n.message=="string"?n.message:String(n)}const wD=ki(bt);var Qr,ei,ti,rr,ir,zs,Ce,eu,ky,Ey,Yi,tu,Ff;let SD=(Ff=class extends wD{constructor(t){super();w(this,Ce);w(this,Qr);w(this,ei);w(this,ti);w(this,rr,null);w(this,ir,null);w(this,zs,!1);E(this,Qr,t);const r=t.ownerDocument.defaultView;if(!r)throw new Error("ArtifactView: iframe has no owner window");E(this,ei,r),E(this,ti,i=>v(this,Ce,ky).call(this,i)),c(this,ei).addEventListener("message",c(this,ti))}get content(){return c(this,ir)}set content(t){v(this,Ce,tu).call(this),E(this,ir,t),c(this,zs)&&v(this,Ce,eu).call(this,t)}handleUpdateContent(t){if(v(this,Ce,tu).call(this),c(this,rr)!==null)throw new Error(yD);E(this,rr,t)}dispose(){c(this,ei).removeEventListener("message",c(this,ti)),E(this,rr,null)}},Qr=new WeakMap,ei=new WeakMap,ti=new WeakMap,rr=new WeakMap,ir=new WeakMap,zs=new WeakMap,Ce=new WeakSet,eu=function(t){const r={type:"content-updated",content:t};v(this,Ce,Yi).call(this,r)},ky=function(t){if(this.disposed||t.source!==c(this,Qr).contentWindow)return;const r=t.data;if(SC(r)){E(this,zs,!0),this.dispatchEvent(new mD("ready")),c(this,ir)!==null&&v(this,Ce,eu).call(this,c(this,ir));return}if(_C(r)){v(this,Ce,Ey).call(this,r);return}},Ey=async function(t){const r=c(this,rr);if(r===null){v(this,Ce,Yi).call(this,{type:"response",id:t.id,error:{message:vD}});return}try{await r(t.content)}catch(i){if(this.disposed)return;v(this,Ce,Yi).call(this,{type:"response",id:t.id,error:{message:bD(i)}});return}this.disposed||v(this,Ce,Yi).call(this,{type:"response",id:t.id,result:{}})},Yi=function(t){const r=c(this,Qr).contentWindow;r&&r.postMessage(t,"*")},tu=function(){if(this.disposed)throw new Error("ArtifactView is disposed")},Ff);function _D(n=window){if(n.parent===n)return;let e=0,t=0;n.document.documentElement&&(n.document.documentElement.style.touchAction="pan-y"),n.addEventListener("wheel",a=>{const l=a;e=l.clientX,t=l.clientY,n.parent.postMessage({type:"wheel",deltaX:l.deltaX,deltaY:l.deltaY,shiftKey:l.shiftKey},"*"),l.preventDefault()},{passive:!1});const r=8,i=100,s=1e3,o=new Map;n.addEventListener("pointerdown",a=>{const l=a;l.pointerType==="touch"&&o.set(l.pointerId,{startX:l.clientX,startY:l.clientY,lastX:l.clientX,offset:0,active:!1,discarded:!1,samples:[{time:l.timeStamp,offset:0}]})},{passive:!0}),n.addEventListener("pointermove",a=>{const l=a,u=o.get(l.pointerId);if(!u||u.discarded)return;if(!u.active){const m=l.clientX-u.startX,A=l.clientY-u.startY,k=Math.abs(m),I=Math.abs(A);if(k<r&&I<r)return;if(I>=k){u.discarded=!0;return}u.active=!0}const h=l.clientX-u.lastX;u.lastX=l.clientX,u.offset+=h,u.samples.push({time:l.timeStamp,offset:u.offset});const p=l.timeStamp-i;let g=0;for(let m=0;m<u.samples.length;m+=1){if(u.samples[m].time>=p){g=m;break}g=m+1}if(g>0){const m=Math.max(0,g-1);u.samples.splice(0,m)}n.parent.postMessage({type:"swipe-move",deltaX:h},"*"),l.preventDefault()},{passive:!1}),n.addEventListener("pointerup",a=>{const l=a,u=o.get(l.pointerId);if(!u||(o.delete(l.pointerId),!u.active))return;let h=0;if(u.samples.length>=2){const p=u.samples[0],g=u.samples[u.samples.length-1],m=g.time-p.time;m>0&&(h=(g.offset-p.offset)/m*s)}n.parent.postMessage({type:"swipe-end",velocityX:h},"*")}),n.addEventListener("pointercancel",a=>{const l=a,u=o.get(l.pointerId);u&&(o.delete(l.pointerId),u.active&&n.parent.postMessage({type:"swipe-end",velocityX:0},"*"))}),n.addEventListener("message",a=>{var m,A;const l=a.data;if(l===null||typeof l!="object"||l.type!=="scroll")return;const u=l,h=typeof u.deltaX=="number"?u.deltaX:0,p=typeof u.deltaY=="number"?u.deltaY:0;let g=((A=(m=n.document).elementFromPoint)==null?void 0:A.call(m,e,t))??null;for(;g!==null;){const k=n.getComputedStyle(g);if(p!==0){const I=(k.overflowY==="auto"||k.overflowY==="scroll")&&g.scrollHeight>g.clientHeight,U=p>0?g.scrollTop+g.clientHeight<g.scrollHeight:g.scrollTop>0;if(I&&U){g.scrollBy(h,p);return}}if(h!==0){const I=(k.overflowX==="auto"||k.overflowX==="scroll")&&g.scrollWidth>g.clientWidth,U=h>0?g.scrollLeft+g.clientWidth<g.scrollWidth:g.scrollLeft>0;if(I&&U){g.scrollBy(h,p);return}}g=g.parentElement}n.scrollBy(h,p)})}function kD(){return`(${_D.toString()})(window);`}async function ED(n){const e=await fetch(n);if(!e.ok)throw new Error(`Failed to fetch artifact content: ${e.status}`);const t=await e.text(),r=new DOMParser().parseFromString(t,"text/html"),i=r.createElement("base");i.href=new URL(n,window.location.href).href,r.head.insertBefore(i,r.head.firstChild);const s=r.createElement("script");s.textContent=kD(),r.head.appendChild(s);const o=new Blob([`<!DOCTYPE html>
130
+ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(o)}const xy=yt();class xD extends HTMLElement{constructor(){super(...arguments);b(this,"_artifact",null);b(this,"_viewURL",null);b(this,"_contentURL",null);b(this,"_screen",null);b(this,"_subscribedScreen",null);b(this,"_activeView",null);b(this,"_contentState",{kind:"idle"});b(this,"_fetchSequence",0);b(this,"_blobSequence",0);b(this,"_mountedViewURL",null);b(this,"_directRender",!1);b(this,"_blobURL",null);b(this,"handleScreenContentChanged",t=>{!this._artifact||t.artifactID!==this._artifact.id||this._activeView!==null&&this.refetchContent()})}set artifact(t){const r=this._artifact;this._artifact=t,this.render(),r!==null&&r!==t&&this.syncView()}get artifact(){return this._artifact}set viewURL(t){this._viewURL!==t&&(this._viewURL=t,this.syncView())}get viewURL(){return this._viewURL}set contentURL(t){this._contentURL!==t&&(this._contentURL=t,this.syncView())}get contentURL(){return this._contentURL}set screen(t){this._screen!==t&&(this._screen=t,this.syncScreenSubscription())}get screen(){return this._screen}set dragging(t){t?this.setAttribute("dragging","true"):this.removeAttribute("dragging")}get dragging(){return this.getAttribute("dragging")==="true"}get activeView(){return this._activeView}connectedCallback(){this.setAttribute("level","2"),this.render(),this.syncView(),this.syncScreenSubscription()}disconnectedCallback(){this.teardownView(),this.unsubscribeFromScreen()}handleClose(){this._artifact&&this.dispatchEvent(new xy("close-artifact",{artifactID:this._artifact.id,bubbles:!0,composed:!0}))}syncView(){var t;if(this.isConnected){if(this._viewURL!==null){if(this._directRender&&this.teardownView(),this._mountedViewURL!==this._viewURL){this.teardownView(),this._contentState={kind:"loading"},this._mountedViewURL=this._viewURL,this.render();const r=this.querySelector("iframe.artifact-frame");if(!r){this._contentState={kind:"error"},this.render();return}this._activeView=new SD(r),this._activeView.handleUpdateContent(async i=>{await this.saveContent(i)}),this.loadBlobFrame(this._viewURL),this.startContentFetch();return}this._activeView!==null&&this.startContentFetch();return}if(this._contentURL!==null){this.teardownView(),this._directRender=!0,this._contentState={kind:"idle"},this.render(),((t=this._artifact)==null?void 0:t.status)==="committed"&&this.loadBlobFrame(this._contentURL);return}this.teardownView(),this._contentState={kind:"idle"},this.render()}}async saveContent(t){const r=this._screen,i=this._artifact;if(!r||!i)throw new Error("artifact-view: cannot save without a screen and artifact");await r.server.client.artifacts.putContent({artifactID:i.id,content:t})}syncScreenSubscription(){if(!this.isConnected){this.unsubscribeFromScreen();return}this._subscribedScreen!==this._screen&&(this.unsubscribeFromScreen(),this._screen!==null&&(this._screen.addEventListener("artifact-content-changed",this.handleScreenContentChanged),this._subscribedScreen=this._screen))}unsubscribeFromScreen(){this._subscribedScreen!==null&&(this._subscribedScreen.removeEventListener("artifact-content-changed",this.handleScreenContentChanged),this._subscribedScreen=null)}startContentFetch(){this._fetchSequence+=1;const t=this._fetchSequence,r=this._contentURL,i=this._activeView;if(!i||r===null){this._contentState={kind:"error"},this.render();return}this._contentState={kind:"loading"},(async()=>{try{const s=await fetch(r);if(t!==this._fetchSequence)return;if(!s.ok){this._contentState={kind:"error"},this.teardownView(),this.render();return}const o=await s.text();if(t!==this._fetchSequence||this._activeView!==i)return;this._activeView.content=o,this._contentState={kind:"ready"}}catch{if(t!==this._fetchSequence)return;this._contentState={kind:"error"},this.teardownView(),this.render()}})()}refetchContent(){this._fetchSequence+=1;const t=this._fetchSequence,r=this._contentURL,i=this._activeView;!i||r===null||(async()=>{try{const s=await fetch(r);if(t!==this._fetchSequence||!s.ok)return;const o=await s.text();if(t!==this._fetchSequence||this._activeView!==i)return;this._activeView.content=o}catch{}})()}loadBlobFrame(t){this._blobSequence+=1;const r=this._blobSequence;(async()=>{try{const i=await ED(t);if(r!==this._blobSequence){URL.revokeObjectURL(i);return}this._blobURL=i,this.render();const s=this.querySelector("iframe.artifact-frame");s&&(s.src=i)}catch{if(r!==this._blobSequence)return;this._contentState={kind:"error"},this.teardownView(),this.render()}})()}teardownView(){this._activeView!==null&&(this._activeView.dispose(),this._activeView=null),this._blobURL!==null&&(URL.revokeObjectURL(this._blobURL),this._blobURL=null),this._mountedViewURL=null,this._directRender=!1,this._fetchSequence+=1,this._blobSequence+=1}contentTemplate(){return this._contentState.kind==="error"?N`
131
131
  <div class="artifact-content artifact-placeholder">
132
132
  <em>Failed to load content</em>
133
133
  </div>
@@ -145,7 +145,7 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
145
145
  ${this.contentTemplate()}
146
146
  <footer class="artifact-title-bar" drag-handle material="glass">
147
147
  <div class="artifact-title-group">
148
- <span class="artifact-title-icon">${oD({size:16})}</span>
148
+ <span class="artifact-title-icon">${tD({size:16})}</span>
149
149
  <span class="artifact-title">${t.title}</span>
150
150
  </div>
151
151
  <button
@@ -155,10 +155,10 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
155
155
  @click=${()=>this.handleClose()}
156
156
  aria-label="Close"
157
157
  >
158
- ${ly({size:16})}
158
+ ${ny({size:16})}
159
159
  </button>
160
160
  </footer>
161
- `}render(){this._artifact&&(this.setAttribute("type",this._artifact.type),Re(this.template(),this))}}customElements.define("artifact-view",ID);const we=n=>({type:"px",...n}),Te=n=>({type:"unit",...n}),Do=2;class PD{constructor(e){b(this,"basis");b(this,"min");b(this,"_gap");b(this,"_viewport");b(this,"_unit");this.basis=e.basis,this.min=e.min,this._viewport=e.viewport,this._gap=e.gap??we({x:he,y:he});const t=this._viewport.x??hr,r=this._viewport.y??ha,i=this._gap.x??he,s=this._gap.y??he,o=t<=dx,a=o?t-i*Do:Math.min(hr,t-i*Do),l=o?r-s*Do:Math.min(ha,r-s*Do),u=(a-i*(Ot-1))/Ot,h=(l-s*(et-1))/et,p=this.basis.x??0,g=this.basis.y??0,m=this.min.x??0,A=this.min.y??0;this._unit=we(o?{x:Math.max(m,u),y:Math.max(A,h)}:{x:Math.max(m,Math.min(p,u)),y:Math.max(A,Math.min(g,h))})}get unit(){return this._unit}get viewport(){return this._viewport}get gap(){return this._gap}toUnits(e){return Te({x:e.x==null?void 0:e.x/(this._unit.x??1),y:e.y==null?void 0:e.y/(this._unit.y??1)})}toPixels(e){const t=this._unit.x??0,r=this._unit.y??0,i=this._gap.x??he,s=this._gap.y??he,o=e.x==null?void 0:e.x*t+Math.max(0,e.x-1)*i,a=e.y==null?void 0:e.y*r+Math.max(0,e.y-1)*s;return we({x:o,y:a})}}const fr=1e-4,Je=1e-6,RD=40,DD=24;function Ry(n,e){return Math.max(0,n-e*2)}function Dy(n){const e=[0];for(const t of n)e.push((e[e.length-1]??0)+t);return e}function Oy(n){const e=[0];for(let t=0;t<n.length;t+=1){const r=e[t]??0;e.push(r+n[t]+he)}return e}function Ly(n,e,t){if(e<0||e>=n.length)return 0;let r=0,i=0;for(let s=e;s<n.length;s+=1){const o=n[s],a=i===0?o:r+he+o;if(a>t+fr)break;r=a,i+=1}return Math.max(1,i)}function OD(n,e,t){if(e<0||e>=n.length)return 0;let r=0,i=0;for(let s=e;s>=0;s-=1){const o=n[s],a=i===0?o:r+he+o;if(a>t+fr)break;r=a,i+=1}return Math.max(1,i)}function LD(n,e){if(n.length===0)return 0;let t=0,r=0;for(let i=n.length-1;i>=0;i-=1){const s=n[i],o=r===0?s:t+he+s;if(o>e+fr)break;t=o,r+=1}return Math.max(1,r)}function dh(n,e){if(n.length===0)return 0;const t=LD(n,e);return Math.max(0,n.length-t)}function mf(n,e,t){if(n.length===0)return 0;const r=Ly(n,e,t),i=Math.min(n.length,e+r);if(i<=e)return 0;const s=n.slice(e,i);return s.reduce((o,a)=>o+a,0)+Math.max(0,s.length-1)*he}function su(n,e,t){const r=n[e]??0;return t-r}function Nr(n,e,t,r,i){if(n.length===0)return 0;const s=dh(n,i),o=e[s]??0,a=Math.max(0,Math.min(o,t));let l=0;for(let H=0;H<s;H+=1){const F=e[H]??0,ce=e[H+1]??F;if(a>=F&&a<=ce+fr){l=H;break}l=H+1}const u=Math.min(l+1,s),h=e[l]??0,p=e[u]??h,g=Math.max(p-h,fr),m=u===l?0:(a-h)/g,A=Oy(n),k=mf(n,l,i),I=mf(n,u,i),U=(r-k)/2,P=(r-I)/2,V=su(A,l,U),O=su(A,u,P);return V+(O-V)*m}function vf(n,e,t,r,i){const s=dh(n,r),o=e[s]??0;let a=0,l=o;for(let u=0;u<RD;u+=1){const h=(a+l)/2;Nr(n,e,h,t,r)>i?a=h:l=h}return(a+l)/2}function yf(n,e,t){const r=Oy(n),[i,s]=e,o=n.slice(i,s+1),a=o.reduce((u,h)=>u+h,0)+Math.max(0,o.length-1)*he,l=(t-a)/2;return su(r,i,l)}function zD(n,e,t){const r=Ly(n,e,t);return[e,Math.min(n.length-1,e+r-1)]}function MD(n,e,t){const r=OD(n,e,t);return[Math.max(0,e-r+1),e]}function ND(n){const e=new Set,t=[];for(const r of n){const i=`${r.nodeRange[0]}:${r.nodeRange[1]}`;if(e.has(i))continue;const s=t[t.length-1];s&&Math.abs(s.anchor-r.anchor)<=Je||(e.add(i),t.push(r))}return t}function UD(n){const{nodeCols:e,nodeWidthsPx:t,viewportWidthPx:r}=n;if(e.length===0||t.length===0)return{viewspans:[],minScroll:0,maxScroll:0};const i=n.gapPx??he,s=Ry(r,i),o=Dy(e),a=dh(t,s),l=o[a]??0,u=[];for(let h=0;h<=a;h+=1){const p=zD(t,h,s),g=yf(t,p,r),m=vf(t,o,r,s,g);u.push({nodeRange:p,anchor:Math.max(0,Math.min(l,m))})}for(let h=t.length-1;h>=0;h-=1){const p=MD(t,h,s),g=`${p[0]}:${p[1]}`;if(u.some(k=>`${k.nodeRange[0]}:${k.nodeRange[1]}`===g))continue;const m=yf(t,p,r),A=vf(t,o,r,s,m);u.push({nodeRange:p,anchor:Math.max(0,Math.min(l,A))})}return u.sort((h,p)=>Math.abs(h.anchor-p.anchor)>Je?h.anchor-p.anchor:h.nodeRange[0]!==p.nodeRange[0]?h.nodeRange[0]-p.nodeRange[0]:h.nodeRange[1]-p.nodeRange[1]),{viewspans:ND(u),minScroll:0,maxScroll:l}}function sc(n,e){var i;let t=0,r=Number.POSITIVE_INFINITY;for(let s=0;s<n.length;s+=1){const o=Math.abs((((i=n[s])==null?void 0:i.anchor)??0)-e);if(o+Je<r){r=o,t=s;continue}Math.abs(o-r)<=Je&&s<t&&(t=s)}return t}function FD(n,e,t){return t<=0?0:Math.max(0,Math.min(t-1,n+e))}function Rr(n,e,t){return Math.max(e,Math.min(t,n))}function ZD(n,e){var t;for(let r=0;r<n.length;r+=1)if(Math.abs((((t=n[r])==null?void 0:t.anchor)??0)-e)<=Je)return r;return-1}function HD(n,e,t){var i,s,o,a;if(n.length===0)return e;const r=ZD(n,e);if(r>=0){const l=n[r];if(!l)return e;if(t>0){const g=l.nodeRange[0]+1,m=n.filter(k=>k.nodeRange[0]===g);if(m.length===0)return((i=n[n.length-1])==null?void 0:i.anchor)??e;let A=m[0];for(const k of m)k.nodeRange[1]>A.nodeRange[1]&&(A=k);return A.anchor}const u=l.nodeRange[1]-1,h=n.filter(g=>g.nodeRange[1]===u);if(h.length===0)return((s=n[0])==null?void 0:s.anchor)??e;let p=h[0];for(const g of h)g.nodeRange[0]<p.nodeRange[0]&&(p=g);return p.anchor}if(t>0){for(const l of n)if(l.anchor>e+Je)return l.anchor;return((o=n[n.length-1])==null?void 0:o.anchor)??e}for(let l=n.length-1;l>=0;l-=1){const u=n[l];if(u&&u.anchor<e-Je)return u.anchor}return((a=n[0])==null?void 0:a.anchor)??e}class BD extends bt{constructor(t){super();b(this,"_scroll",0);b(this,"minScroll",0);b(this,"maxScroll",0);b(this,"viewspans",[]);b(this,"activeViewspanIndex",null);b(this,"nodeWidthsPx",[]);b(this,"boundaryCols",[0]);b(this,"viewportWidthPx",0);b(this,"framedViewportWidthPx",0);this._scroll=(t==null?void 0:t.x)??0}get scroll(){return Te({x:this._scroll})}get translate(){return we({x:Nr(this.nodeWidthsPx,this.boundaryCols,this._scroll,this.viewportWidthPx,this.framedViewportWidthPx)})}set scroll(t){const r=Rr(t.x??this._scroll,this.minScroll,this.maxScroll);Math.abs(r-this._scroll)<=Je||(this._scroll=r,this.activeViewspanIndex=null,this.dispatchEvent(new Pr("layout-scroll",{scroll:this.scroll})))}rebuild(t){const r=t.nodeWidths.map(u=>Math.max(0,u.x??0)),i=r.map(u=>t.grid.toPixels(Te({x:u})).x??0),s=t.grid.viewport.x??0,o=t.grid.gap.x??he,a=UD({nodeCols:r,nodeWidthsPx:i,viewportWidthPx:s,gapPx:o});this.nodeWidthsPx=i,this.boundaryCols=Dy(r),this.viewportWidthPx=s,this.framedViewportWidthPx=Ry(s,o),this.viewspans=a.viewspans,this.minScroll=a.minScroll,this.maxScroll=a.maxScroll,this.activeViewspanIndex=null;const l=Rr(this._scroll,this.minScroll,this.maxScroll);Math.abs(l-this._scroll)>Je&&(this._scroll=l,this.dispatchEvent(new Pr("layout-scroll",{scroll:this.scroll})))}step(t){var a;if(this.viewspans.length===0)return;const r=this.activeViewspanIndex??sc(this.viewspans,this._scroll),i=FD(r,t,this.viewspans.length),s=((a=this.viewspans[i])==null?void 0:a.anchor)??this._scroll,o=Rr(s,this.minScroll,this.maxScroll);this.activeViewspanIndex=i,!(Math.abs(o-this._scroll)<=Je)&&(this._scroll=o,this.dispatchEvent(new Pr("layout-scroll",{scroll:this.scroll})))}snap(t){var s;if(this.viewspans.length===0)return;const r=t===void 0?((s=this.viewspans[sc(this.viewspans,this._scroll)])==null?void 0:s.anchor)??this._scroll:HD(this.viewspans,this._scroll,t),i=Rr(r,this.minScroll,this.maxScroll);this.activeViewspanIndex=sc(this.viewspans,i),!(Math.abs(i-this._scroll)<=Je)&&(this._scroll=i,this.dispatchEvent(new Pr("layout-scroll",{scroll:this.scroll})))}wheel(t){const r=Rr(this._scroll+(t.x??0),this.minScroll,this.maxScroll);this.activeViewspanIndex=null,!(Math.abs(r-this._scroll)<=Je)&&(this._scroll=r,this.dispatchEvent(new Pr("layout-scroll",{scroll:this.scroll})))}wheelPixels(t){const r=t.x??0;if(Math.abs(r)<=fr)return;this.activeViewspanIndex=null;const i=Nr(this.nodeWidthsPx,this.boundaryCols,this._scroll,this.viewportWidthPx,this.framedViewportWidthPx),s=i-r,o=Nr(this.nodeWidthsPx,this.boundaryCols,this.maxScroll,this.viewportWidthPx,this.framedViewportWidthPx),a=Nr(this.nodeWidthsPx,this.boundaryCols,this.minScroll,this.viewportWidthPx,this.framedViewportWidthPx),l=Math.max(o,Math.min(a,s));if(Math.abs(l-i)<=fr)return;let u=this.minScroll,h=this.maxScroll;for(let g=0;g<DD;g+=1){const m=(u+h)/2;Nr(this.nodeWidthsPx,this.boundaryCols,m,this.viewportWidthPx,this.framedViewportWidthPx)>l?u=m:h=m}const p=Rr((u+h)/2,this.minScroll,this.maxScroll);Math.abs(p-this._scroll)<=Je||(this._scroll=p,this.dispatchEvent(new Pr("layout-scroll",{scroll:this.scroll})))}}const oc={"stack-above":{left:.25,top:0,width:.5,height:.5},"stack-below":{left:.25,top:.5,width:.5,height:.5},"reorder-before":{left:0,top:0,width:.25,height:1},"reorder-after":{left:.75,top:0,width:.25,height:1}},GD=["stack-above","stack-below","reorder-before","reorder-after"];function ac(n,e){return{left:n.left+n.width*e.left,top:n.top+n.height*e.top,width:n.width*e.width,height:n.height*e.height}}function In(n,e,t){return n>=t.left&&n<t.left+t.width&&e>=t.top&&e<t.top+t.height}function ph(n,e){for(const t of n){if(t.type==="card"&&t.id===e)return t;if(t.type==="stack")for(const r of t.children){if(r.type==="card"&&r.id===e)return r;if(r.type==="row"){for(const i of r.children)if(i.id===e)return i}}}return null}function ou(n){return n.height===et||n.height===mn?{...n,height:mn}:n}function au(n){return n.height===mn?{...n,height:et}:n}function VD(n,e,t,r){const i=n.findIndex(h=>h.type==="stack"&&h.id===e);if(i===-1)return n;const s=n[i];if(!s||s.type!=="stack")return n;const o=s.children.find(h=>h.type==="card"&&h.id===t);if(!o||o.type!=="card")return n;const a=s.children.filter(h=>h.id!==t);if(a.length===s.children.length||a.length<1)return n;const l=[...n];if(a.length===1){const[h]=a;l[i]=h.type==="card"?au(h):h}else l[i]={...s,children:a};const u=Math.max(0,Math.min(r,l.length));return l.splice(u,0,au(o)),l}const WD=yt(),jD=yt(),qD=50;function YD(n,e){if(n.type!==e.type)return!1;switch(n.type){case"reorder":return e.index===n.index;case"stack":return e.targetCardId===n.targetCardId&&e.position===n.position;case"stack-child-noop":return!0;case"stack-child-extract":return e.toIndex===n.toIndex;case"stack-child-reorder":return e.position===n.position;default:return!1}}function lo(n){return{id:n.id,type:"drop-target",width:n.width,height:n.height}}function bf(n){return n.map(KD)}function XD(n){return n.type==="drop-target"?{id:n.id,type:"card",artifactID:n.id,width:n.width,height:n.height}:n}function KD(n){return n.type==="drop-target"?{id:n.id,type:"card",artifactID:n.id,width:n.width,height:n.height}:n.type==="stack"?{...n,children:n.children.map(XD)}:n}function zy(n,e){return n.find(r=>r.type==="card"&&r.id===e)??null}function wf(n,e){return n.find(r=>r.type==="stack"&&r.id===e)??null}function JD(n,e){const t=[...e],r=t.findIndex(a=>a.type==="card"&&a.id===n.nodeId);if(r===-1)return null;const i=t[r];if(!i||i.type!=="card")return null;t.splice(r,1);const s=Math.max(0,Math.min(n.lastReorderIndex,t.length));t.splice(s,0,i);const o=t.findIndex(a=>a.type==="card"&&a.id===n.nodeId);return o===-1?null:{base:t,visualDraggedIndex:o}}function QD(n,e,t,r){const i=[...n.base];i.splice(n.visualDraggedIndex,1);const s=i.findIndex(g=>g.type==="card"&&g.id===t.targetCardId),o=s===-1?null:i[s];if(!o||o.type!=="card")return null;const a=zy(r,e.nodeId);if(!a)return null;const l=ou(a),u=ou(o),h=lo(l),p=t.position==="above"?[h,u]:[u,h];return i[s]={id:o.id,type:"stack",children:p},i}function lc(n,e){return n.parentStackId?tO(n,e):eO(n,e)}function eO(n,e){const t=n.hitTarget;if(t.type==="reorder"){const r=e[n.sourceIndex];if(!r||r.type!=="card")return[...e];const i=[...e];return i.splice(n.sourceIndex,1),i.splice(t.index,0,lo(r)),i}if(t.type==="stack"){const r=JD(n,e);return r?QD(r,n,t,e)??[...e]:[...e]}return[...e]}function tO(n,e){const t=n.hitTarget;switch(t.type){case"stack-child-reorder":return nO(n,e,t.position);case"stack-child-extract":return rO(n,e,t.toIndex);case"stack-child-noop":return iO(n,e);default:return[...e]}}function nO(n,e,t){const r=e.findIndex(g=>g.type==="stack"&&g.id===n.parentStackId);if(r===-1)return[...e];const i=e[r];if(!i||i.type!=="stack")return[...e];if(!i.children.every(g=>g.type==="card"))return[...e];const s=i.children,o=s.findIndex(g=>g.id===n.nodeId);if(o===-1)return[...e];const a=s[o],l=s.filter(g=>g.id!==n.nodeId),u=lo(a),h=t==="above"?[u,...l]:[...l,u],p=[...e];return p[r]={...i,children:h},p}function rO(n,e,t){if(!n.parentStackId)return[...e];const r=VD(e,n.parentStackId,n.nodeId,t);if(r===e)return[...e];const i=r.findIndex(a=>a.type==="card"&&a.id===n.nodeId);if(i===-1)return[...e];const s=r[i];if(!s||s.type!=="card")return[...e];const o=[...r];return o[i]=lo(s),o}function iO(n,e){const t=e.findIndex(l=>l.type==="stack"&&l.id===n.parentStackId);if(t===-1)return[...e];const r=e[t];if(!r||r.type!=="stack")return[...e];const i=r.children.findIndex(l=>l.type==="card"&&l.id===n.nodeId);if(i===-1)return[...e];const s=r.children[i];if(!s||s.type!=="card")return[...e];const o=[...e],a=[...r.children];return a[i]=lo(s),o[t]={...r,children:a},o}function sO(n,e){return e.find(r=>r.type==="stack"&&r.id===n.id)?n.id:qu()}function oO(n,e,t){if(n.type==="drop-target"){const r=ph(e,t);if(!r)throw new Error(`finalize: missing dragged card ${t}`);return ou(r)}return n}function aO(n,e,t){const r=n.children.map(s=>oO(s,e,t));return{id:sO(n,e),type:"stack",children:r}}function lO(n,e,t){if(n.type==="drop-target"){const r=ph(e,t);if(!r)throw new Error(`finalize: missing dragged card ${t}`);return zy(e,t)!==null?r:au(r)}return n.type==="card"||n.type==="row"?n:aO(n,e,t)}function cO(n,e,t){return n.map(r=>lO(r,e,t))}function uO(n,e){return JSON.stringify(n)===JSON.stringify(e)}const hO=ki(bt);class dO extends hO{constructor(t={}){super();b(this,"pending",null);b(this,"active",null)}start(t){if(this.pending||this.active)return;const r=t.pointer.x??0,i=t.pointer.y??0;this.pending={startX:r,startY:i,grabOffsetX:t.grabOffset.x??0,grabOffsetY:t.grabOffset.y??0,nodeId:t.nodeId,sourceIndex:t.source.index,parentStackId:t.source.parentId,width:t.size.x??0,height:t.size.y??0,baseLayout:t.layout}}update(t){const r=t.pointer.x??0,i=t.pointer.y??0,s=this.pending;if(s){const u=r-s.startX,h=i-s.startY;Math.hypot(u,h)>=fx&&(this.pending=null,this.active={...s,pointerX:r,pointerY:i,hitTarget:{type:"reorder",index:s.sourceIndex},lastReorderIndex:s.sourceIndex},this.emitDrag(),this.dispatchEvent(new K("change")));return}if(!this.active)return;const o=lc(this.active,this.active.baseLayout),a=this.getHitTargetForPointer(r,i,t,o),l=a.type==="reorder"?a.index:this.active.lastReorderIndex;this.active.pointerX===r&&this.active.pointerY===i&&YD(this.active.hitTarget,a)&&this.active.lastReorderIndex===l||(this.active={...this.active,pointerX:r,pointerY:i,hitTarget:a,lastReorderIndex:l},this.emitDrag(),this.dispatchEvent(new K("change")))}drop(){if(this.pending){this.cancel();return}if(!this.active)return;const t=this.active.baseLayout;let r=null;try{const i=lc(this.active,t),s=cO(i,t,this.active.nodeId);uO(s,t)||(r=s)}catch{r=null}this.reset(),r&&this.dispatchEvent(new jD("drop",{layout:r})),this.dispatchEvent(new K("change"))}cancel(){!this.pending&&!this.active||(this.reset(),this.dispatchEvent(new K("change")))}dispose(){this.reset()}get status(){return this.active?"active":this.pending?"pending":"idle"}reset(){this.pending=null,this.active=null}emitDrag(){if(!this.active)return;const t=lc(this.active,this.active.baseLayout);this.dispatchEvent(new WD("drag",{nodeId:this.active.nodeId,source:{index:this.active.sourceIndex,parentId:this.active.parentStackId},grabOffset:we({x:this.active.grabOffsetX,y:this.active.grabOffsetY}),pointer:we({x:this.active.pointerX,y:this.active.pointerY}),size:we({x:this.active.width,y:this.active.height}),projectedLayout:t}))}getHitTargetForPointer(t,r,i,s){return this.active?this.isPointerInsideDragBounds(t,r,i.viewport)?this.active.parentStackId?this.getStackChildHitTarget(t,r,i,s):this.getTopLevelCardHitTarget(t,r,i,s):{type:"reorder",index:this.active.sourceIndex}:{type:"reorder",index:0}}getStackChildHitTarget(t,r,i,s){var u;if(!((u=this.active)!=null&&u.parentStackId))return{type:"stack-child-noop"};const o=this.getSourceStackInteractionRect(i.geometry);if(o&&In(t,r,o)){const h=o.top+o.height/2;return{type:"stack-child-reorder",position:r<h?"above":"below"}}const a=this.getSourceRemainingSiblingRect(i.geometry);if(a&&In(t,r,a)){const h=a.top+a.height/2;return{type:"stack-child-reorder",position:r<h?"above":"below"}}return{type:"stack-child-extract",toIndex:this.getTopLevelReorderIndexForPointer(t,r,i,s)}}getSourceRemainingSiblingRect(t){var s,o;if(!((s=this.active)!=null&&s.parentStackId))return;const r=wf(this.active.baseLayout,this.active.parentStackId);if(!r)return;const i=r.children.find(a=>{var l;return a.type==="card"&&a.id!==((l=this.active)==null?void 0:l.nodeId)});if(i)return(o=t.find(a=>a.id===i.id))==null?void 0:o.rect}getSourceStackInteractionRect(t){var o;if(!((o=this.active)!=null&&o.parentStackId))return;const r=t.find(a=>{var l;return a.id===((l=this.active)==null?void 0:l.parentStackId)});if(r)return this.active.sourceStackRect=r.rect,r.rect;const i=wf(this.active.baseLayout,this.active.parentStackId);if(!i)return this.active.sourceStackRect;const s=i.children.find(a=>{var l;return a.type==="card"&&a.id!==((l=this.active)==null?void 0:l.nodeId)});if(s){const a=t.find(l=>l.id===s.id);if(a)return a.rect}return this.active.sourceStackRect}getTopLevelCardHitTarget(t,r,i,s){var m,A,k;const o=this.getTopLevelZoneNodes(i.geometry,s);if(o.length===0)return{type:"reorder",index:((m=this.active)==null?void 0:m.sourceIndex)??0};const l=(i.effectiveVelocity??0)<=qD;for(const I of o){const U=I.rect;if(!In(t,r,U))continue;const P=this.resolveTopLevelTargetForCard(t,r,I,I.logicalIndex,l);if(P)return P;if(!l&&((A=this.active)!=null&&A.hitTarget))return this.active.hitTarget}const u=this.getNearestTargetableZone(t,o);if(!u)return{type:"reorder",index:((k=this.active)==null?void 0:k.sourceIndex)??0};const h=Math.max(u.rect.left,Math.min(u.rect.left+u.rect.width,t)),p=this.resolveTopLevelTargetForCard(h,r,u,u.logicalIndex,l);if(p)return p;const g=u.rect.left+u.rect.width/2;return{type:"reorder",index:t<g?u.logicalIndex:u.logicalIndex+1}}getTopLevelReorderIndexForPointer(t,r,i,s){var u,h;const o=this.getTopLevelZoneNodes(i.geometry,s);if(o.length===0)return((u=this.active)==null?void 0:u.sourceIndex)??0;for(const p of o){if(!In(t,r,p.rect))continue;const g=ac(p.rect,oc["reorder-before"]);if(In(t,r,g))return p.logicalIndex;const m=ac(p.rect,oc["reorder-after"]);if(In(t,r,m))return p.logicalIndex+1}const a=this.getNearestTargetableZone(t,o);if(!a)return((h=this.active)==null?void 0:h.sourceIndex)??0;const l=a.rect.left+a.rect.width/2;return t<l?a.logicalIndex:a.logicalIndex+1}getTopLevelZoneNodes(t,r){const i=new Map(r.map(a=>[a.id,a])),s=[];let o=0;for(const a of t){const l=i.get(a.id);l&&l.type!=="drop-target"&&(l.type==="card"||l.type==="stack")&&(s.push({id:l.id,rect:a.rect,logicalIndex:o}),o+=1)}return s}resolveTopLevelTargetForCard(t,r,i,s,o){const a=i.rect;for(const l of GD){if(!o&&(l==="stack-above"||l==="stack-below"))continue;const u=oc[l],h=ac(a,u);if(In(t,r,h))return l==="stack-above"?{type:"stack",targetCardId:i.id,position:"above"}:l==="stack-below"?{type:"stack",targetCardId:i.id,position:"below"}:l==="reorder-before"?{type:"reorder",index:s}:{type:"reorder",index:s+1}}return null}getNearestTargetableZone(t,r){let i=null,s=Number.POSITIVE_INFINITY;for(const o of r){const a=o.rect.left,l=o.rect.left+o.rect.width,u=t<a?a-t:t>l?t-l:0;u<s&&(s=u,i=o)}return i}isPointerInsideDragBounds(t,r,i){return t>=i.left&&t<=i.left+i.width&&r>=i.top&&r<=i.top+i.height}}const Sf=60,pO=80,_f=.5,kf=10;class fO{constructor(){b(this,"awaitingFreshWheelGesture",!1);b(this,"lastWheelEventAt",Number.NEGATIVE_INFINITY);b(this,"lastWheelDeltaX",0);b(this,"activeGestureType","none");b(this,"lastWheelGestureAt",Number.NEGATIVE_INFINITY)}markKeyboardNavigation(e){this.awaitingFreshWheelGesture=!0,this.lastWheelEventAt=e,this.activeGestureType="none"}reset(){this.awaitingFreshWheelGesture=!1,this.lastWheelEventAt=Number.NEGATIVE_INFINITY,this.lastWheelDeltaX=0,this.activeGestureType="none",this.lastWheelGestureAt=Number.NEGATIVE_INFINITY}decide(e){const{now:t,shiftKey:r,deltaX:i,deltaY:s,overArtifactContent:o}=e;t-this.lastWheelGestureAt>=Sf&&(this.activeGestureType="none");const l=r&&s!==0,u=l?s:i,h=Math.abs(u),p=Math.abs(s);return this.activeGestureType==="vertical-artifact"&&o?h>=_f&&h>=p*kf?this.classifyHorizontal(t,u):(this.lastWheelGestureAt=t,{type:"scroll-native"}):this.activeGestureType==="horizontal-filmstrip"?!l&&o&&p>0&&p>=h*kf?(this.activeGestureType="vertical-artifact",this.lastWheelGestureAt=t,{type:"scroll-native"}):this.classifyHorizontal(t,u):h<_f?(o&&(this.activeGestureType="vertical-artifact"),this.lastWheelGestureAt=t,{type:"scroll-native"}):l||h>p?this.classifyHorizontal(t,u):p>h?(o&&(this.activeGestureType="vertical-artifact"),this.lastWheelGestureAt=t,{type:"scroll-native"}):o?(this.activeGestureType="vertical-artifact",this.lastWheelGestureAt=t,{type:"scroll-native"}):this.classifyHorizontal(t,u)}classifyHorizontal(e,t){const r=e-this.lastWheelEventAt,i=Math.sign(this.lastWheelDeltaX),s=Math.sign(t),o=i!==0&&s!==0&&i!==s,a=i!==0&&Math.abs(t)>=Math.abs(this.lastWheelDeltaX)+pO;return this.awaitingFreshWheelGesture&&r<Sf&&!o&&!a?{type:"ignore"}:(this.lastWheelEventAt=e,this.lastWheelDeltaX=t,this.lastWheelGestureAt=e,this.awaitingFreshWheelGesture=!1,this.activeGestureType="horizontal-filmstrip",{type:"scroll-horizontal",horizontalDelta:t})}}const gO=100,mO=1e3;class vO{constructor(e,t){b(this,"_status","idle");b(this,"cumulativeOffset",0);b(this,"samples",[]);b(this,"scroll");b(this,"setAnimating");this.scroll=e,this.setAnimating=t}get status(){return this._status}start(e){this._status="active",this.cumulativeOffset=0,this.samples=[{time:e,offset:0}]}move(e,t){this._status==="active"&&(this.cumulativeOffset+=t,this.samples.push({time:e,offset:this.cumulativeOffset}),this.pruneSamples(e),this.setAnimating(!1),this.scroll.wheelPixels(we({x:-t})))}end(){if(this._status!=="active")return;const e=this.computeVelocityPxPerSec();this.setAnimating(!0),Math.abs(e)<mx?this.scroll.snap():this.scroll.snap(e>0?-1:1),this.reset()}cancel(){this._status==="active"&&(this.setAnimating(!0),this.scroll.snap(),this.reset())}reset(){this._status="idle",this.cumulativeOffset=0,this.samples=[]}pruneSamples(e){const t=e-gO;let r=0;for(let i=0;i<this.samples.length;i+=1){if(this.samples[i].time>=t){r=i;break}r=i+1}if(r>0){const i=Math.max(0,r-1);this.samples=this.samples.slice(i)}}computeVelocityPxPerSec(){if(this.samples.length<2)return 0;const e=this.samples[0],t=this.samples[this.samples.length-1],r=t.time-e.time;return r<=0?0:(t.offset-e.offset)/r*mO}}const yO=2,Ef=1e3,Oo=1e-4;function bO(n){return n.replace(/["\\]/g,"\\$&")}function xf(n,e,t){if(n===0)return 0;const r=e.toPixels(Te({y:et})).y??0;return(t-r)/yO}function cc(n){const e=n.clientWidth>0?n.clientWidth:hr,t=n.clientHeight>0?n.clientHeight:ha;let r=0,i=0;if(n.isConnected){const o=getComputedStyle(n);r=parseFloat(o.paddingTop)||0,i=parseFloat(o.paddingBottom)||0}const s=Math.max(1,t-r-i);return{width:e,height:s,offsetY:r}}class wO extends Event{constructor(t){super("scroll",{bubbles:!0,composed:!0});b(this,"scrollPosition");this.scrollPosition=t}}class My extends Event{constructor(t){super("layout-change",{bubbles:!0,composed:!0});b(this,"layout");this.layout=t}}class SO extends HTMLElement{constructor(){super();b(this,"_layout",[]);b(this,"_scrollPosition",0);b(this,"layoutGrid",null);b(this,"layoutScroll",new BD(Te({x:0})));b(this,"scrollModelKey","");b(this,"resizeObserver",null);b(this,"renderPending",!1);b(this,"animateNextRender",!0);b(this,"wheelGesture",new fO);b(this,"swipeGesture",new vO(this.layoutScroll,t=>{this.animateNextRender=t}));b(this,"swipePointerId",null);b(this,"swipeStartX",0);b(this,"swipeStartY",0);b(this,"swipeLastX",0);b(this,"swipeActive",!1);b(this,"swipeShouldSuppressClick",!1);b(this,"swipeListenersAttached",!1);b(this,"dragController",new dO);b(this,"dragState",null);b(this,"activeDragPointerId",null);b(this,"dragListenersAttached",!1);b(this,"dragFrame",0);b(this,"lastDragFrameTime",0);b(this,"lastPointerX",0);b(this,"lastPointerY",0);b(this,"pointerVelocityPxPerSec",0);b(this,"scrollVelocityPxPerSec",0);b(this,"motionSampleTime",0);b(this,"motionSampleX",0);b(this,"motionSampleY",0);b(this,"dragTrackOffsetXPx",0);b(this,"previousProjectedLayoutForOffset",null);b(this,"renderContent",()=>N``);b(this,"onDragControllerChange",()=>{this.dragController.status==="idle"&&(this.dragState=null,this.dragTrackOffsetXPx=0,this.previousProjectedLayoutForOffset=null),this.scheduleRender()});b(this,"onDragControllerDrag",t=>{const r=bf(t.projectedLayout),i=this.shouldApplyTrackOffset(t.projectedLayout,t.source.parentId),s=t.source.parentId?this.getStackChildAnchorCardId(t.source.parentId,t.nodeId):null;this.dragTrackOffsetXPx=i?this.computeDragTrackOffset(this.previousProjectedLayoutForOffset,r,t.nodeId,t.source.parentId,s,this.dragTrackOffsetXPx):0,this.previousProjectedLayoutForOffset=r,this.dragState={nodeId:t.nodeId,source:t.source,grabOffset:t.grabOffset,pointer:t.pointer,size:t.size,projectedLayout:t.projectedLayout},this.scheduleRender()});b(this,"onDragControllerDrop",t=>{this.dragState=null,this.dragTrackOffsetXPx=0,this.previousProjectedLayoutForOffset=null,this.commitLayout(t.layout)});b(this,"onLayoutScrollInternal",t=>{const i=t.scroll.x??0;Math.abs(i-this._scrollPosition)<Oo||(this._scrollPosition=i,this.emitScrollPositionChanged(i),this.scheduleRender())});b(this,"handleKeyDown",t=>{if(t.key==="Escape"&&this.dragController.status!=="idle"){t.preventDefault(),this.stopDragFrameLoop(),this.releaseActiveDragPointerCapture(),this.dragController.cancel(),this.detachDragListeners();return}this.dragController.status==="idle"&&(t.key==="ArrowRight"?(t.preventDefault(),this.wheelGesture.markKeyboardNavigation(Date.now()),this.shiftWindow(1)):t.key==="ArrowLeft"&&(t.preventDefault(),this.wheelGesture.markKeyboardNavigation(Date.now()),this.shiftWindow(-1)))});b(this,"handleWheel",t=>{if(this._layout.length===0)return;const r=this.wheelGesture.decide({now:Date.now(),shiftKey:t.shiftKey,deltaX:t.deltaX,deltaY:t.deltaY,overArtifactContent:!1});r.type==="scroll-horizontal"&&(t.preventDefault(),this.applyHorizontalWheel(r.horizontalDelta))});b(this,"handleWindowMessage",t=>{var o;if(this._layout.length===0)return;const r=this.findManagedArtifactFrame(t.source);if(!r||!this.isTrustedArtifactFrameMessage(t,r))return;if(CC(t.data)){const a=typeof performance<"u"?performance.now():Date.now();this.swipeGesture.status==="idle"&&this.swipeGesture.start(a),this.swipeGesture.move(a,t.data.deltaX);return}if(IC(t.data)){this.swipeGesture.status==="active"&&this.swipeGesture.end();return}if(!TC(t.data))return;const i=this.wheelGesture.decide({now:Date.now(),shiftKey:t.data.shiftKey,deltaX:t.data.deltaX,deltaY:t.data.deltaY,overArtifactContent:!0});if(i.type==="scroll-horizontal"){this.applyHorizontalWheel(i.horizontalDelta);return}if(i.type!=="scroll-native")return;const s={type:"scroll",deltaX:0,deltaY:t.data.deltaY};(o=r.contentWindow)==null||o.postMessage(s,this.getArtifactFrameTargetOrigin(r))});b(this,"handlePointerDown",t=>{if(t.button!==0||this.dragController.status!=="idle")return;const r=t.target;if(!(r instanceof Element))return;const i=r.closest("[drag-handle]")!==null,s=r.closest("button, input, textarea, select, a, [role='button']")!==null;if(t.pointerType==="touch"&&!i&&!s&&this._layout.length>0){this.beginSwipeTracking(t);return}if(!i||s)return;const o=r.closest(".card-slot");if(!o)return;const a=o.getAttribute("data-layout-node-id");if(!a)return;const l=kO(this._layout,a);if(!l)return;const u=o.getBoundingClientRect();this.lastPointerX=t.clientX,this.lastPointerY=t.clientY,this.resetMotionTracking(t.clientX,t.clientY),this.focus(),this.dragController.start({nodeId:a,source:{index:l.topLevelIndex,parentId:l.sourceStackId},pointer:we({x:t.clientX,y:t.clientY}),grabOffset:we({x:t.clientX-u.left,y:t.clientY-u.top}),size:we({x:u.width,y:u.height}),layout:this._layout}),this.attachDragListeners(),this.activeDragPointerId=t.pointerId;try{this.setPointerCapture(t.pointerId)}catch{}t.preventDefault()});b(this,"handleSwipePointerMove",t=>{if(this.swipePointerId===null||t.pointerId!==this.swipePointerId)return;if(!this.swipeActive){const i=t.clientX-this.swipeStartX,s=t.clientY-this.swipeStartY,o=Math.abs(i),a=Math.abs(s);if(o<$p&&a<$p)return;if(a>=o){this.endSwipeTracking();return}this.swipeActive=!0,this.swipeShouldSuppressClick=!0;try{this.setPointerCapture(t.pointerId)}catch{}this.swipeGesture.start(t.timeStamp)}const r=t.clientX-this.swipeLastX;this.swipeLastX=t.clientX,this.swipeGesture.move(t.timeStamp,r),t.preventDefault()});b(this,"handleSwipePointerUp",t=>{this.swipePointerId===null||t.pointerId!==this.swipePointerId||(this.swipeActive&&this.swipeGesture.end(),this.releaseSwipePointerCapture(t.pointerId),this.endSwipeTracking())});b(this,"handleSwipePointerCancel",t=>{this.swipePointerId===null||t.pointerId!==this.swipePointerId||(this.swipeActive&&this.swipeGesture.cancel(),this.releaseSwipePointerCapture(t.pointerId),this.endSwipeTracking())});b(this,"handleSwipeWindowBlur",()=>{this.swipePointerId!==null&&this.swipeActive&&this.swipeGesture.cancel(),this.swipePointerId!==null&&this.releaseSwipePointerCapture(this.swipePointerId),this.endSwipeTracking()});b(this,"handleSwipeClick",t=>{this.swipeShouldSuppressClick&&(this.swipeShouldSuppressClick=!1,t.preventDefault(),t.stopPropagation(),typeof t.stopImmediatePropagation=="function"&&t.stopImmediatePropagation())});b(this,"handleWindowPointerMove",t=>{this.lastPointerX=t.clientX,this.lastPointerY=t.clientY,this.updatePointerVelocity(t.clientX,t.clientY),this.syncDragTargetForLatestPointer(),this.ensureDragFrameLoop()});b(this,"handleWindowPointerUp",t=>{this.stopDragFrameLoop(),this.releasePointerCaptureForEvent(t.pointerId),this.dragController.drop(),this.clearMotionTracking(),this.detachDragListeners()});b(this,"handleWindowPointerCancel",t=>{this.stopDragFrameLoop(),this.releasePointerCaptureForEvent(t.pointerId),this.dragController.cancel(),this.clearMotionTracking(),this.detachDragListeners()});b(this,"handleWindowBlur",()=>{this.releaseActiveDragPointerCapture(),this.stopDragFrameLoop(),this.dragController.cancel(),this.clearMotionTracking(),this.detachDragListeners()});b(this,"runDragFrame",t=>{if(this.dragController.status==="idle"){this.dragFrame=0;return}const r=Math.max(0,t-this.lastDragFrameTime)/Ef;this.lastDragFrameTime=t,this.samplePointerVelocityAt(t,this.lastPointerX,this.lastPointerY);const i=this.getBoundingClientRect(),s=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,i),o=this.getDragEdgeScrollDeltaPixels(s.x,i,r);this.scrollVelocityPxPerSec=r>Oo?Math.abs(o)/r:0,Math.abs(o)>Oo&&(this.animateNextRender=!1,this.layoutScroll.wheelPixels(we({x:o}))),this.dragController.status==="active"&&this.syncDragTarget(s.x,s.y,i),this.dragFrame=requestAnimationFrame(this.runDragFrame)});this.dragController.addEventListener("change",this.onDragControllerChange),this.dragController.addEventListener("drag",this.onDragControllerDrag),this.dragController.addEventListener("drop",this.onDragControllerDrop),this.layoutScroll.addEventListener("layout-scroll",this.onLayoutScrollInternal)}set layout(t){this._layout=[...t],this.stopDragFrameLoop(),this.dragController.cancel(),this.scrollModelKey="",this.syncScrollModel(),this.layoutScroll.scroll=Te({x:this._scrollPosition}),this.scheduleRender()}get layout(){return this._layout}commitLayout(t){this.layout=t,this.emitLayoutChanged()}set scrollPosition(t){Math.abs(t-this._scrollPosition)<Oo||(this.animateNextRender=!1,this.syncScrollModel(),this.layoutScroll.scroll=Te({x:t}))}get scrollPosition(){return this._scrollPosition}focusArtifact(t){const r=Fr(this._layout),i=r.nodes.findIndex(o=>o.cards.some(a=>a.artifactID===t));if(i<0)return;let s=0;for(let o=0;o<i;o+=1)s+=r.nodes[o].width;this.scrollPosition=s,queueMicrotask(()=>{const o=this.querySelector(`.card-slot[data-layout-card-id="${bO(t)}"]`);if(!o)return;o.classList.remove("card-focus-pulse"),o.offsetHeight,o.classList.add("card-focus-pulse");const a=()=>{o.classList.remove("card-focus-pulse"),o.removeEventListener("animationend",a)};o.addEventListener("animationend",a)})}connectedCallback(){this.hasAttribute("tabindex")||(this.tabIndex=0),this.focus(),this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("wheel",this.handleWheel,{passive:!1}),this.addEventListener("pointerdown",this.handlePointerDown),window.addEventListener("message",this.handleWindowMessage),typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>this.render()),this.resizeObserver.observe(this)),this.render()}disconnectedCallback(){var t;this.removeEventListener("keydown",this.handleKeyDown),this.removeEventListener("wheel",this.handleWheel),this.removeEventListener("pointerdown",this.handlePointerDown),window.removeEventListener("message",this.handleWindowMessage),(t=this.resizeObserver)==null||t.disconnect(),this.resizeObserver=null,this.wheelGesture.reset(),this.detachDragListeners(),this.swipeGesture.status==="active"&&this.swipeGesture.cancel(),this.swipePointerId!==null&&this.releaseSwipePointerCapture(this.swipePointerId),this.endSwipeTracking(),this.dragController.removeEventListener("change",this.onDragControllerChange),this.dragController.removeEventListener("drag",this.onDragControllerDrag),this.dragController.removeEventListener("drop",this.onDragControllerDrop),this.layoutScroll.removeEventListener("layout-scroll",this.onLayoutScrollInternal),this.dragController.dispose(),this.stopDragFrameLoop()}scheduleRender(){this.renderPending||(this.renderPending=!0,queueMicrotask(()=>{this.renderPending=!1,this.render()}))}createGrid(t,r){return new PD({basis:we({x:Ln,y:Ln}),min:we({x:xp,y:xp}),viewport:we({x:t,y:r}),gap:we({x:he,y:he})})}syncScrollModel(){const t=cc(this),i=Fr(this._layout).nodes.map(o=>o.width),s=`${t.width}x${t.height}:${i.join(",")}`;s===this.scrollModelKey&&this.layoutGrid||(this.scrollModelKey=s,this.layoutGrid=this.createGrid(t.width,t.height),this.layoutScroll.rebuild({grid:this.layoutGrid,nodeWidths:i.map(o=>Te({x:o}))}))}emitScrollPositionChanged(t){this.dispatchEvent(new wO(t))}emitLayoutChanged(){this.dispatchEvent(new My([...this._layout]))}shiftWindow(t){this.syncScrollModel(),this.animateNextRender=!0,this.layoutScroll.step(t)}applyHorizontalWheel(t){this.syncScrollModel();const r=this.layoutGrid;if(!r)return;this.animateNextRender=!1;const i=r.toUnits(we({x:t}));this.layoutScroll.wheel(Te({x:i.x??0}))}findManagedArtifactFrame(t){if(!t)return null;const r=this.querySelectorAll("iframe.artifact-frame");for(const i of r)if(i.contentWindow===t)return i;return null}isTrustedArtifactFrameMessage(t,r){if(t.origin==="null")return!0;const i=this.getArtifactFrameOrigin(r);return i===null||t.origin===i}getArtifactFrameTargetOrigin(t){const r=t.getAttribute("sandbox")??"";return new Set(r.split(/\s+/).filter(Boolean)).has("allow-same-origin")?this.getArtifactFrameOrigin(t)??"*":"*"}getArtifactFrameOrigin(t){const r=t.getAttribute("src")??t.src;if(!r)return null;try{return new URL(r,window.location.href).origin}catch{return null}}beginSwipeTracking(t){this.swipePointerId=t.pointerId,this.swipeStartX=t.clientX,this.swipeStartY=t.clientY,this.swipeLastX=t.clientX,this.swipeActive=!1,this.swipeShouldSuppressClick=!1,this.attachSwipeListeners()}attachSwipeListeners(){this.swipeListenersAttached||(window.addEventListener("pointermove",this.handleSwipePointerMove),window.addEventListener("pointerup",this.handleSwipePointerUp),window.addEventListener("pointercancel",this.handleSwipePointerCancel),this.addEventListener("pointermove",this.handleSwipePointerMove),this.addEventListener("pointerup",this.handleSwipePointerUp),this.addEventListener("pointercancel",this.handleSwipePointerCancel),window.addEventListener("blur",this.handleSwipeWindowBlur),this.addEventListener("click",this.handleSwipeClick,{capture:!0}),this.swipeListenersAttached=!0)}detachSwipeListeners(){this.swipeListenersAttached&&(window.removeEventListener("pointermove",this.handleSwipePointerMove),window.removeEventListener("pointerup",this.handleSwipePointerUp),window.removeEventListener("pointercancel",this.handleSwipePointerCancel),this.removeEventListener("pointermove",this.handleSwipePointerMove),this.removeEventListener("pointerup",this.handleSwipePointerUp),this.removeEventListener("pointercancel",this.handleSwipePointerCancel),window.removeEventListener("blur",this.handleSwipeWindowBlur),this.removeEventListener("click",this.handleSwipeClick,{capture:!0}),this.swipeListenersAttached=!1)}endSwipeTracking(){this.swipePointerId=null,this.swipeActive=!1,this.detachSwipeListeners()}releaseSwipePointerCapture(t){try{this.hasPointerCapture(t)&&this.releasePointerCapture(t)}catch{}}releaseActiveDragPointerCapture(){this.activeDragPointerId!==null&&this.releasePointerCaptureForEvent(this.activeDragPointerId)}releasePointerCaptureForEvent(t){try{this.hasPointerCapture(t)&&this.releasePointerCapture(t)}catch{}}attachDragListeners(){this.dragListenersAttached||(window.addEventListener("pointermove",this.handleWindowPointerMove),window.addEventListener("pointerup",this.handleWindowPointerUp),window.addEventListener("pointercancel",this.handleWindowPointerCancel),this.addEventListener("pointermove",this.handleWindowPointerMove),this.addEventListener("pointerup",this.handleWindowPointerUp),this.addEventListener("pointercancel",this.handleWindowPointerCancel),window.addEventListener("blur",this.handleWindowBlur),this.dragListenersAttached=!0)}detachDragListeners(){this.dragListenersAttached&&(window.removeEventListener("pointermove",this.handleWindowPointerMove),window.removeEventListener("pointerup",this.handleWindowPointerUp),window.removeEventListener("pointercancel",this.handleWindowPointerCancel),this.removeEventListener("pointermove",this.handleWindowPointerMove),this.removeEventListener("pointerup",this.handleWindowPointerUp),this.removeEventListener("pointercancel",this.handleWindowPointerCancel),window.removeEventListener("blur",this.handleWindowBlur),this.dragListenersAttached=!1,this.activeDragPointerId=null)}getDisplayModel(){if(this.dragController.status!=="active"||!this.dragState)return{layout:this._layout,activePlaceholderId:null,placeholdersById:new Map};const t=new Map;return t.set(this.dragState.nodeId,{id:this.dragState.nodeId,sourceCardId:this.dragState.nodeId}),{layout:bf(this.dragState.projectedLayout),activePlaceholderId:this.dragState.nodeId,placeholdersById:t}}render(){const t=cc(this),r=this.createGrid(t.width,t.height);this.layoutGrid=r;const i=this.getDisplayModel(),s=i.layout,o=this.dragController.status==="active",a=Fr(s),l=a.nodes.map(O=>O.width),u=`${t.width}x${t.height}:${l.join(",")}`;!o&&u!==this.scrollModelKey&&(this.scrollModelKey=u,this.layoutScroll.rebuild({grid:r,nodeWidths:l.map(O=>Te({x:O}))}),this._scrollPosition=this.layoutScroll.scroll.x??this._scrollPosition);const h=_O(s),p=r.unit.x??Ln,g=r.unit.y??Ln,m=o?this.dragTrackOffsetXPx:0,A=(this.layoutScroll.translate.x??0)+m,k=xf(a.nodes.length,r,t.height),I=this.animateNextRender&&!o,U=[`transform: translate(${A}px, ${k}px);`,`transition-duration: ${I?px:0}ms;`,`pointer-events: ${o?"none":"auto"};`].join(" ");this.animateNextRender=!0,this.style.setProperty("--layout-unit-x",`${p}px`),this.style.setProperty("--layout-unit-y",`${g}px`),this.style.setProperty("--layout-gap",`${he}px`);const P=this.dragState,V={width:(P==null?void 0:P.size.x)??0,height:(P==null?void 0:P.size.y)??0};Re(N`
161
+ `}render(){this._artifact&&(this.setAttribute("type",this._artifact.type),Re(this.template(),this))}}customElements.define("artifact-view",xD);const we=n=>({type:"px",...n}),Te=n=>({type:"unit",...n}),Do=2;class AD{constructor(e){b(this,"basis");b(this,"min");b(this,"_gap");b(this,"_viewport");b(this,"_unit");this.basis=e.basis,this.min=e.min,this._viewport=e.viewport,this._gap=e.gap??we({x:he,y:he});const t=this._viewport.x??hr,r=this._viewport.y??ha,i=this._gap.x??he,s=this._gap.y??he,o=t<=ax,a=o?t-i*Do:Math.min(hr,t-i*Do),l=o?r-s*Do:Math.min(ha,r-s*Do),u=(a-i*(Ot-1))/Ot,h=(l-s*(et-1))/et,p=this.basis.x??0,g=this.basis.y??0,m=this.min.x??0,A=this.min.y??0;this._unit=we(o?{x:Math.max(m,u),y:Math.max(A,h)}:{x:Math.max(m,Math.min(p,u)),y:Math.max(A,Math.min(g,h))})}get unit(){return this._unit}get viewport(){return this._viewport}get gap(){return this._gap}toUnits(e){return Te({x:e.x==null?void 0:e.x/(this._unit.x??1),y:e.y==null?void 0:e.y/(this._unit.y??1)})}toPixels(e){const t=this._unit.x??0,r=this._unit.y??0,i=this._gap.x??he,s=this._gap.y??he,o=e.x==null?void 0:e.x*t+Math.max(0,e.x-1)*i,a=e.y==null?void 0:e.y*r+Math.max(0,e.y-1)*s;return we({x:o,y:a})}}const fr=1e-4,Je=1e-6,$D=40,TD=24;function Ay(n,e){return Math.max(0,n-e*2)}function $y(n){const e=[0];for(const t of n)e.push((e[e.length-1]??0)+t);return e}function Ty(n){const e=[0];for(let t=0;t<n.length;t+=1){const r=e[t]??0;e.push(r+n[t]+he)}return e}function Cy(n,e,t){if(e<0||e>=n.length)return 0;let r=0,i=0;for(let s=e;s<n.length;s+=1){const o=n[s],a=i===0?o:r+he+o;if(a>t+fr)break;r=a,i+=1}return Math.max(1,i)}function CD(n,e,t){if(e<0||e>=n.length)return 0;let r=0,i=0;for(let s=e;s>=0;s-=1){const o=n[s],a=i===0?o:r+he+o;if(a>t+fr)break;r=a,i+=1}return Math.max(1,i)}function ID(n,e){if(n.length===0)return 0;let t=0,r=0;for(let i=n.length-1;i>=0;i-=1){const s=n[i],o=r===0?s:t+he+s;if(o>e+fr)break;t=o,r+=1}return Math.max(1,r)}function ch(n,e){if(n.length===0)return 0;const t=ID(n,e);return Math.max(0,n.length-t)}function uf(n,e,t){if(n.length===0)return 0;const r=Cy(n,e,t),i=Math.min(n.length,e+r);if(i<=e)return 0;const s=n.slice(e,i);return s.reduce((o,a)=>o+a,0)+Math.max(0,s.length-1)*he}function nu(n,e,t){const r=n[e]??0;return t-r}function Nr(n,e,t,r,i){if(n.length===0)return 0;const s=ch(n,i),o=e[s]??0,a=Math.max(0,Math.min(o,t));let l=0;for(let H=0;H<s;H+=1){const F=e[H]??0,ce=e[H+1]??F;if(a>=F&&a<=ce+fr){l=H;break}l=H+1}const u=Math.min(l+1,s),h=e[l]??0,p=e[u]??h,g=Math.max(p-h,fr),m=u===l?0:(a-h)/g,A=Ty(n),k=uf(n,l,i),I=uf(n,u,i),U=(r-k)/2,P=(r-I)/2,V=nu(A,l,U),O=nu(A,u,P);return V+(O-V)*m}function hf(n,e,t,r,i){const s=ch(n,r),o=e[s]??0;let a=0,l=o;for(let u=0;u<$D;u+=1){const h=(a+l)/2;Nr(n,e,h,t,r)>i?a=h:l=h}return(a+l)/2}function df(n,e,t){const r=Ty(n),[i,s]=e,o=n.slice(i,s+1),a=o.reduce((u,h)=>u+h,0)+Math.max(0,o.length-1)*he,l=(t-a)/2;return nu(r,i,l)}function PD(n,e,t){const r=Cy(n,e,t);return[e,Math.min(n.length-1,e+r-1)]}function RD(n,e,t){const r=CD(n,e,t);return[Math.max(0,e-r+1),e]}function DD(n){const e=new Set,t=[];for(const r of n){const i=`${r.nodeRange[0]}:${r.nodeRange[1]}`;if(e.has(i))continue;const s=t[t.length-1];s&&Math.abs(s.anchor-r.anchor)<=Je||(e.add(i),t.push(r))}return t}function OD(n){const{nodeCols:e,nodeWidthsPx:t,viewportWidthPx:r}=n;if(e.length===0||t.length===0)return{viewspans:[],minScroll:0,maxScroll:0};const i=n.gapPx??he,s=Ay(r,i),o=$y(e),a=ch(t,s),l=o[a]??0,u=[];for(let h=0;h<=a;h+=1){const p=PD(t,h,s),g=df(t,p,r),m=hf(t,o,r,s,g);u.push({nodeRange:p,anchor:Math.max(0,Math.min(l,m))})}for(let h=t.length-1;h>=0;h-=1){const p=RD(t,h,s),g=`${p[0]}:${p[1]}`;if(u.some(k=>`${k.nodeRange[0]}:${k.nodeRange[1]}`===g))continue;const m=df(t,p,r),A=hf(t,o,r,s,m);u.push({nodeRange:p,anchor:Math.max(0,Math.min(l,A))})}return u.sort((h,p)=>Math.abs(h.anchor-p.anchor)>Je?h.anchor-p.anchor:h.nodeRange[0]!==p.nodeRange[0]?h.nodeRange[0]-p.nodeRange[0]:h.nodeRange[1]-p.nodeRange[1]),{viewspans:DD(u),minScroll:0,maxScroll:l}}function nc(n,e){var i;let t=0,r=Number.POSITIVE_INFINITY;for(let s=0;s<n.length;s+=1){const o=Math.abs((((i=n[s])==null?void 0:i.anchor)??0)-e);if(o+Je<r){r=o,t=s;continue}Math.abs(o-r)<=Je&&s<t&&(t=s)}return t}function LD(n,e,t){return t<=0?0:Math.max(0,Math.min(t-1,n+e))}function Rr(n,e,t){return Math.max(e,Math.min(t,n))}function zD(n,e){var t;for(let r=0;r<n.length;r+=1)if(Math.abs((((t=n[r])==null?void 0:t.anchor)??0)-e)<=Je)return r;return-1}function MD(n,e,t){var i,s,o,a;if(n.length===0)return e;const r=zD(n,e);if(r>=0){const l=n[r];if(!l)return e;if(t>0){const g=l.nodeRange[0]+1,m=n.filter(k=>k.nodeRange[0]===g);if(m.length===0)return((i=n[n.length-1])==null?void 0:i.anchor)??e;let A=m[0];for(const k of m)k.nodeRange[1]>A.nodeRange[1]&&(A=k);return A.anchor}const u=l.nodeRange[1]-1,h=n.filter(g=>g.nodeRange[1]===u);if(h.length===0)return((s=n[0])==null?void 0:s.anchor)??e;let p=h[0];for(const g of h)g.nodeRange[0]<p.nodeRange[0]&&(p=g);return p.anchor}if(t>0){for(const l of n)if(l.anchor>e+Je)return l.anchor;return((o=n[n.length-1])==null?void 0:o.anchor)??e}for(let l=n.length-1;l>=0;l-=1){const u=n[l];if(u&&u.anchor<e-Je)return u.anchor}return((a=n[0])==null?void 0:a.anchor)??e}class ND extends bt{constructor(t){super();b(this,"_scroll",0);b(this,"minScroll",0);b(this,"maxScroll",0);b(this,"viewspans",[]);b(this,"activeViewspanIndex",null);b(this,"nodeWidthsPx",[]);b(this,"boundaryCols",[0]);b(this,"viewportWidthPx",0);b(this,"framedViewportWidthPx",0);this._scroll=(t==null?void 0:t.x)??0}get scroll(){return Te({x:this._scroll})}get translate(){return we({x:Nr(this.nodeWidthsPx,this.boundaryCols,this._scroll,this.viewportWidthPx,this.framedViewportWidthPx)})}set scroll(t){const r=Rr(t.x??this._scroll,this.minScroll,this.maxScroll);Math.abs(r-this._scroll)<=Je||(this._scroll=r,this.activeViewspanIndex=null,this.dispatchEvent(new Pr("layout-scroll",{scroll:this.scroll})))}rebuild(t){const r=t.nodeWidths.map(u=>Math.max(0,u.x??0)),i=r.map(u=>t.grid.toPixels(Te({x:u})).x??0),s=t.grid.viewport.x??0,o=t.grid.gap.x??he,a=OD({nodeCols:r,nodeWidthsPx:i,viewportWidthPx:s,gapPx:o});this.nodeWidthsPx=i,this.boundaryCols=$y(r),this.viewportWidthPx=s,this.framedViewportWidthPx=Ay(s,o),this.viewspans=a.viewspans,this.minScroll=a.minScroll,this.maxScroll=a.maxScroll,this.activeViewspanIndex=null;const l=Rr(this._scroll,this.minScroll,this.maxScroll);Math.abs(l-this._scroll)>Je&&(this._scroll=l,this.dispatchEvent(new Pr("layout-scroll",{scroll:this.scroll})))}step(t){var a;if(this.viewspans.length===0)return;const r=this.activeViewspanIndex??nc(this.viewspans,this._scroll),i=LD(r,t,this.viewspans.length),s=((a=this.viewspans[i])==null?void 0:a.anchor)??this._scroll,o=Rr(s,this.minScroll,this.maxScroll);this.activeViewspanIndex=i,!(Math.abs(o-this._scroll)<=Je)&&(this._scroll=o,this.dispatchEvent(new Pr("layout-scroll",{scroll:this.scroll})))}snap(t){var s;if(this.viewspans.length===0)return;const r=t===void 0?((s=this.viewspans[nc(this.viewspans,this._scroll)])==null?void 0:s.anchor)??this._scroll:MD(this.viewspans,this._scroll,t),i=Rr(r,this.minScroll,this.maxScroll);this.activeViewspanIndex=nc(this.viewspans,i),!(Math.abs(i-this._scroll)<=Je)&&(this._scroll=i,this.dispatchEvent(new Pr("layout-scroll",{scroll:this.scroll})))}wheel(t){const r=Rr(this._scroll+(t.x??0),this.minScroll,this.maxScroll);this.activeViewspanIndex=null,!(Math.abs(r-this._scroll)<=Je)&&(this._scroll=r,this.dispatchEvent(new Pr("layout-scroll",{scroll:this.scroll})))}wheelPixels(t){const r=t.x??0;if(Math.abs(r)<=fr)return;this.activeViewspanIndex=null;const i=Nr(this.nodeWidthsPx,this.boundaryCols,this._scroll,this.viewportWidthPx,this.framedViewportWidthPx),s=i-r,o=Nr(this.nodeWidthsPx,this.boundaryCols,this.maxScroll,this.viewportWidthPx,this.framedViewportWidthPx),a=Nr(this.nodeWidthsPx,this.boundaryCols,this.minScroll,this.viewportWidthPx,this.framedViewportWidthPx),l=Math.max(o,Math.min(a,s));if(Math.abs(l-i)<=fr)return;let u=this.minScroll,h=this.maxScroll;for(let g=0;g<TD;g+=1){const m=(u+h)/2;Nr(this.nodeWidthsPx,this.boundaryCols,m,this.viewportWidthPx,this.framedViewportWidthPx)>l?u=m:h=m}const p=Rr((u+h)/2,this.minScroll,this.maxScroll);Math.abs(p-this._scroll)<=Je||(this._scroll=p,this.dispatchEvent(new Pr("layout-scroll",{scroll:this.scroll})))}}const rc={"stack-above":{left:.25,top:0,width:.5,height:.5},"stack-below":{left:.25,top:.5,width:.5,height:.5},"reorder-before":{left:0,top:0,width:.25,height:1},"reorder-after":{left:.75,top:0,width:.25,height:1}},UD=["stack-above","stack-below","reorder-before","reorder-after"];function ic(n,e){return{left:n.left+n.width*e.left,top:n.top+n.height*e.top,width:n.width*e.width,height:n.height*e.height}}function In(n,e,t){return n>=t.left&&n<t.left+t.width&&e>=t.top&&e<t.top+t.height}function uh(n,e){for(const t of n){if(t.type==="card"&&t.id===e)return t;if(t.type==="stack")for(const r of t.children){if(r.type==="card"&&r.id===e)return r;if(r.type==="row"){for(const i of r.children)if(i.id===e)return i}}}return null}function ru(n){return n.height===et||n.height===mn?{...n,height:mn}:n}function iu(n){return n.height===mn?{...n,height:et}:n}function FD(n,e,t,r){const i=n.findIndex(h=>h.type==="stack"&&h.id===e);if(i===-1)return n;const s=n[i];if(!s||s.type!=="stack")return n;const o=s.children.find(h=>h.type==="card"&&h.id===t);if(!o||o.type!=="card")return n;const a=s.children.filter(h=>h.id!==t);if(a.length===s.children.length||a.length<1)return n;const l=[...n];if(a.length===1){const[h]=a;l[i]=h.type==="card"?iu(h):h}else l[i]={...s,children:a};const u=Math.max(0,Math.min(r,l.length));return l.splice(u,0,iu(o)),l}const ZD=yt(),HD=yt(),BD=50;function GD(n,e){if(n.type!==e.type)return!1;switch(n.type){case"reorder":return e.index===n.index;case"stack":return e.targetCardId===n.targetCardId&&e.position===n.position;case"stack-child-noop":return!0;case"stack-child-extract":return e.toIndex===n.toIndex;case"stack-child-reorder":return e.position===n.position;default:return!1}}function lo(n){return{id:n.id,type:"drop-target",width:n.width,height:n.height}}function pf(n){return n.map(WD)}function VD(n){return n.type==="drop-target"?{id:n.id,type:"card",artifactID:n.id,width:n.width,height:n.height}:n}function WD(n){return n.type==="drop-target"?{id:n.id,type:"card",artifactID:n.id,width:n.width,height:n.height}:n.type==="stack"?{...n,children:n.children.map(VD)}:n}function Iy(n,e){return n.find(r=>r.type==="card"&&r.id===e)??null}function ff(n,e){return n.find(r=>r.type==="stack"&&r.id===e)??null}function jD(n,e){const t=[...e],r=t.findIndex(a=>a.type==="card"&&a.id===n.nodeId);if(r===-1)return null;const i=t[r];if(!i||i.type!=="card")return null;t.splice(r,1);const s=Math.max(0,Math.min(n.lastReorderIndex,t.length));t.splice(s,0,i);const o=t.findIndex(a=>a.type==="card"&&a.id===n.nodeId);return o===-1?null:{base:t,visualDraggedIndex:o}}function qD(n,e,t,r){const i=[...n.base];i.splice(n.visualDraggedIndex,1);const s=i.findIndex(g=>g.type==="card"&&g.id===t.targetCardId),o=s===-1?null:i[s];if(!o||o.type!=="card")return null;const a=Iy(r,e.nodeId);if(!a)return null;const l=ru(a),u=ru(o),h=lo(l),p=t.position==="above"?[h,u]:[u,h];return i[s]={id:o.id,type:"stack",children:p},i}function sc(n,e){return n.parentStackId?XD(n,e):YD(n,e)}function YD(n,e){const t=n.hitTarget;if(t.type==="reorder"){const r=e[n.sourceIndex];if(!r||r.type!=="card")return[...e];const i=[...e];return i.splice(n.sourceIndex,1),i.splice(t.index,0,lo(r)),i}if(t.type==="stack"){const r=jD(n,e);return r?qD(r,n,t,e)??[...e]:[...e]}return[...e]}function XD(n,e){const t=n.hitTarget;switch(t.type){case"stack-child-reorder":return KD(n,e,t.position);case"stack-child-extract":return JD(n,e,t.toIndex);case"stack-child-noop":return QD(n,e);default:return[...e]}}function KD(n,e,t){const r=e.findIndex(g=>g.type==="stack"&&g.id===n.parentStackId);if(r===-1)return[...e];const i=e[r];if(!i||i.type!=="stack")return[...e];if(!i.children.every(g=>g.type==="card"))return[...e];const s=i.children,o=s.findIndex(g=>g.id===n.nodeId);if(o===-1)return[...e];const a=s[o],l=s.filter(g=>g.id!==n.nodeId),u=lo(a),h=t==="above"?[u,...l]:[...l,u],p=[...e];return p[r]={...i,children:h},p}function JD(n,e,t){if(!n.parentStackId)return[...e];const r=FD(e,n.parentStackId,n.nodeId,t);if(r===e)return[...e];const i=r.findIndex(a=>a.type==="card"&&a.id===n.nodeId);if(i===-1)return[...e];const s=r[i];if(!s||s.type!=="card")return[...e];const o=[...r];return o[i]=lo(s),o}function QD(n,e){const t=e.findIndex(l=>l.type==="stack"&&l.id===n.parentStackId);if(t===-1)return[...e];const r=e[t];if(!r||r.type!=="stack")return[...e];const i=r.children.findIndex(l=>l.type==="card"&&l.id===n.nodeId);if(i===-1)return[...e];const s=r.children[i];if(!s||s.type!=="card")return[...e];const o=[...e],a=[...r.children];return a[i]=lo(s),o[t]={...r,children:a},o}function eO(n,e){return e.find(r=>r.type==="stack"&&r.id===n.id)?n.id:Vu()}function tO(n,e,t){if(n.type==="drop-target"){const r=uh(e,t);if(!r)throw new Error(`finalize: missing dragged card ${t}`);return ru(r)}return n}function nO(n,e,t){const r=n.children.map(s=>tO(s,e,t));return{id:eO(n,e),type:"stack",children:r}}function rO(n,e,t){if(n.type==="drop-target"){const r=uh(e,t);if(!r)throw new Error(`finalize: missing dragged card ${t}`);return Iy(e,t)!==null?r:iu(r)}return n.type==="card"||n.type==="row"?n:nO(n,e,t)}function iO(n,e,t){return n.map(r=>rO(r,e,t))}function sO(n,e){return JSON.stringify(n)===JSON.stringify(e)}const oO=ki(bt);class aO extends oO{constructor(t={}){super();b(this,"pending",null);b(this,"active",null)}start(t){if(this.pending||this.active)return;const r=t.pointer.x??0,i=t.pointer.y??0;this.pending={startX:r,startY:i,grabOffsetX:t.grabOffset.x??0,grabOffsetY:t.grabOffset.y??0,nodeId:t.nodeId,sourceIndex:t.source.index,parentStackId:t.source.parentId,width:t.size.x??0,height:t.size.y??0,baseLayout:t.layout}}update(t){const r=t.pointer.x??0,i=t.pointer.y??0,s=this.pending;if(s){const u=r-s.startX,h=i-s.startY;Math.hypot(u,h)>=cx&&(this.pending=null,this.active={...s,pointerX:r,pointerY:i,hitTarget:{type:"reorder",index:s.sourceIndex},lastReorderIndex:s.sourceIndex},this.emitDrag(),this.dispatchEvent(new K("change")));return}if(!this.active)return;const o=sc(this.active,this.active.baseLayout),a=this.getHitTargetForPointer(r,i,t,o),l=a.type==="reorder"?a.index:this.active.lastReorderIndex;this.active.pointerX===r&&this.active.pointerY===i&&GD(this.active.hitTarget,a)&&this.active.lastReorderIndex===l||(this.active={...this.active,pointerX:r,pointerY:i,hitTarget:a,lastReorderIndex:l},this.emitDrag(),this.dispatchEvent(new K("change")))}drop(){if(this.pending){this.cancel();return}if(!this.active)return;const t=this.active.baseLayout;let r=null;try{const i=sc(this.active,t),s=iO(i,t,this.active.nodeId);sO(s,t)||(r=s)}catch{r=null}this.reset(),r&&this.dispatchEvent(new HD("drop",{layout:r})),this.dispatchEvent(new K("change"))}cancel(){!this.pending&&!this.active||(this.reset(),this.dispatchEvent(new K("change")))}dispose(){this.reset()}get status(){return this.active?"active":this.pending?"pending":"idle"}reset(){this.pending=null,this.active=null}emitDrag(){if(!this.active)return;const t=sc(this.active,this.active.baseLayout);this.dispatchEvent(new ZD("drag",{nodeId:this.active.nodeId,source:{index:this.active.sourceIndex,parentId:this.active.parentStackId},grabOffset:we({x:this.active.grabOffsetX,y:this.active.grabOffsetY}),pointer:we({x:this.active.pointerX,y:this.active.pointerY}),size:we({x:this.active.width,y:this.active.height}),projectedLayout:t}))}getHitTargetForPointer(t,r,i,s){return this.active?this.isPointerInsideDragBounds(t,r,i.viewport)?this.active.parentStackId?this.getStackChildHitTarget(t,r,i,s):this.getTopLevelCardHitTarget(t,r,i,s):{type:"reorder",index:this.active.sourceIndex}:{type:"reorder",index:0}}getStackChildHitTarget(t,r,i,s){var u;if(!((u=this.active)!=null&&u.parentStackId))return{type:"stack-child-noop"};const o=this.getSourceStackInteractionRect(i.geometry);if(o&&In(t,r,o)){const h=o.top+o.height/2;return{type:"stack-child-reorder",position:r<h?"above":"below"}}const a=this.getSourceRemainingSiblingRect(i.geometry);if(a&&In(t,r,a)){const h=a.top+a.height/2;return{type:"stack-child-reorder",position:r<h?"above":"below"}}return{type:"stack-child-extract",toIndex:this.getTopLevelReorderIndexForPointer(t,r,i,s)}}getSourceRemainingSiblingRect(t){var s,o;if(!((s=this.active)!=null&&s.parentStackId))return;const r=ff(this.active.baseLayout,this.active.parentStackId);if(!r)return;const i=r.children.find(a=>{var l;return a.type==="card"&&a.id!==((l=this.active)==null?void 0:l.nodeId)});if(i)return(o=t.find(a=>a.id===i.id))==null?void 0:o.rect}getSourceStackInteractionRect(t){var o;if(!((o=this.active)!=null&&o.parentStackId))return;const r=t.find(a=>{var l;return a.id===((l=this.active)==null?void 0:l.parentStackId)});if(r)return this.active.sourceStackRect=r.rect,r.rect;const i=ff(this.active.baseLayout,this.active.parentStackId);if(!i)return this.active.sourceStackRect;const s=i.children.find(a=>{var l;return a.type==="card"&&a.id!==((l=this.active)==null?void 0:l.nodeId)});if(s){const a=t.find(l=>l.id===s.id);if(a)return a.rect}return this.active.sourceStackRect}getTopLevelCardHitTarget(t,r,i,s){var m,A,k;const o=this.getTopLevelZoneNodes(i.geometry,s);if(o.length===0)return{type:"reorder",index:((m=this.active)==null?void 0:m.sourceIndex)??0};const l=(i.effectiveVelocity??0)<=BD;for(const I of o){const U=I.rect;if(!In(t,r,U))continue;const P=this.resolveTopLevelTargetForCard(t,r,I,I.logicalIndex,l);if(P)return P;if(!l&&((A=this.active)!=null&&A.hitTarget))return this.active.hitTarget}const u=this.getNearestTargetableZone(t,o);if(!u)return{type:"reorder",index:((k=this.active)==null?void 0:k.sourceIndex)??0};const h=Math.max(u.rect.left,Math.min(u.rect.left+u.rect.width,t)),p=this.resolveTopLevelTargetForCard(h,r,u,u.logicalIndex,l);if(p)return p;const g=u.rect.left+u.rect.width/2;return{type:"reorder",index:t<g?u.logicalIndex:u.logicalIndex+1}}getTopLevelReorderIndexForPointer(t,r,i,s){var u,h;const o=this.getTopLevelZoneNodes(i.geometry,s);if(o.length===0)return((u=this.active)==null?void 0:u.sourceIndex)??0;for(const p of o){if(!In(t,r,p.rect))continue;const g=ic(p.rect,rc["reorder-before"]);if(In(t,r,g))return p.logicalIndex;const m=ic(p.rect,rc["reorder-after"]);if(In(t,r,m))return p.logicalIndex+1}const a=this.getNearestTargetableZone(t,o);if(!a)return((h=this.active)==null?void 0:h.sourceIndex)??0;const l=a.rect.left+a.rect.width/2;return t<l?a.logicalIndex:a.logicalIndex+1}getTopLevelZoneNodes(t,r){const i=new Map(r.map(a=>[a.id,a])),s=[];let o=0;for(const a of t){const l=i.get(a.id);l&&l.type!=="drop-target"&&(l.type==="card"||l.type==="stack")&&(s.push({id:l.id,rect:a.rect,logicalIndex:o}),o+=1)}return s}resolveTopLevelTargetForCard(t,r,i,s,o){const a=i.rect;for(const l of UD){if(!o&&(l==="stack-above"||l==="stack-below"))continue;const u=rc[l],h=ic(a,u);if(In(t,r,h))return l==="stack-above"?{type:"stack",targetCardId:i.id,position:"above"}:l==="stack-below"?{type:"stack",targetCardId:i.id,position:"below"}:l==="reorder-before"?{type:"reorder",index:s}:{type:"reorder",index:s+1}}return null}getNearestTargetableZone(t,r){let i=null,s=Number.POSITIVE_INFINITY;for(const o of r){const a=o.rect.left,l=o.rect.left+o.rect.width,u=t<a?a-t:t>l?t-l:0;u<s&&(s=u,i=o)}return i}isPointerInsideDragBounds(t,r,i){return t>=i.left&&t<=i.left+i.width&&r>=i.top&&r<=i.top+i.height}}const gf=60,lO=80,mf=.5,vf=10;class cO{constructor(){b(this,"awaitingFreshWheelGesture",!1);b(this,"lastWheelEventAt",Number.NEGATIVE_INFINITY);b(this,"lastWheelDeltaX",0);b(this,"activeGestureType","none");b(this,"lastWheelGestureAt",Number.NEGATIVE_INFINITY)}markKeyboardNavigation(e){this.awaitingFreshWheelGesture=!0,this.lastWheelEventAt=e,this.activeGestureType="none"}reset(){this.awaitingFreshWheelGesture=!1,this.lastWheelEventAt=Number.NEGATIVE_INFINITY,this.lastWheelDeltaX=0,this.activeGestureType="none",this.lastWheelGestureAt=Number.NEGATIVE_INFINITY}decide(e){const{now:t,shiftKey:r,deltaX:i,deltaY:s,overArtifactContent:o}=e;t-this.lastWheelGestureAt>=gf&&(this.activeGestureType="none");const l=r&&s!==0,u=l?s:i,h=Math.abs(u),p=Math.abs(s);return this.activeGestureType==="vertical-artifact"&&o?h>=mf&&h>=p*vf?this.classifyHorizontal(t,u):(this.lastWheelGestureAt=t,{type:"scroll-native"}):this.activeGestureType==="horizontal-filmstrip"?!l&&o&&p>0&&p>=h*vf?(this.activeGestureType="vertical-artifact",this.lastWheelGestureAt=t,{type:"scroll-native"}):this.classifyHorizontal(t,u):h<mf?(o&&(this.activeGestureType="vertical-artifact"),this.lastWheelGestureAt=t,{type:"scroll-native"}):l||h>p?this.classifyHorizontal(t,u):p>h?(o&&(this.activeGestureType="vertical-artifact"),this.lastWheelGestureAt=t,{type:"scroll-native"}):o?(this.activeGestureType="vertical-artifact",this.lastWheelGestureAt=t,{type:"scroll-native"}):this.classifyHorizontal(t,u)}classifyHorizontal(e,t){const r=e-this.lastWheelEventAt,i=Math.sign(this.lastWheelDeltaX),s=Math.sign(t),o=i!==0&&s!==0&&i!==s,a=i!==0&&Math.abs(t)>=Math.abs(this.lastWheelDeltaX)+lO;return this.awaitingFreshWheelGesture&&r<gf&&!o&&!a?{type:"ignore"}:(this.lastWheelEventAt=e,this.lastWheelDeltaX=t,this.lastWheelGestureAt=e,this.awaitingFreshWheelGesture=!1,this.activeGestureType="horizontal-filmstrip",{type:"scroll-horizontal",horizontalDelta:t})}}const uO=100,hO=1e3;class dO{constructor(e,t){b(this,"_status","idle");b(this,"cumulativeOffset",0);b(this,"samples",[]);b(this,"scroll");b(this,"setAnimating");this.scroll=e,this.setAnimating=t}get status(){return this._status}start(e){this._status="active",this.cumulativeOffset=0,this.samples=[{time:e,offset:0}]}move(e,t){this._status==="active"&&(this.cumulativeOffset+=t,this.samples.push({time:e,offset:this.cumulativeOffset}),this.pruneSamples(e),this.setAnimating(!1),this.scroll.wheelPixels(we({x:-t})))}end(){if(this._status!=="active")return;const e=this.computeVelocityPxPerSec();this.setAnimating(!0),Math.abs(e)<hx?this.scroll.snap():this.scroll.snap(e>0?-1:1),this.reset()}cancel(){this._status==="active"&&(this.setAnimating(!0),this.scroll.snap(),this.reset())}reset(){this._status="idle",this.cumulativeOffset=0,this.samples=[]}pruneSamples(e){const t=e-uO;let r=0;for(let i=0;i<this.samples.length;i+=1){if(this.samples[i].time>=t){r=i;break}r=i+1}if(r>0){const i=Math.max(0,r-1);this.samples=this.samples.slice(i)}}computeVelocityPxPerSec(){if(this.samples.length<2)return 0;const e=this.samples[0],t=this.samples[this.samples.length-1],r=t.time-e.time;return r<=0?0:(t.offset-e.offset)/r*hO}}const pO=2,yf=1e3,Oo=1e-4;function fO(n){return n.replace(/["\\]/g,"\\$&")}function bf(n,e,t){if(n===0)return 0;const r=e.toPixels(Te({y:et})).y??0;return(t-r)/pO}function oc(n){const e=n.clientWidth>0?n.clientWidth:hr,t=n.clientHeight>0?n.clientHeight:ha;let r=0,i=0;if(n.isConnected){const o=getComputedStyle(n);r=parseFloat(o.paddingTop)||0,i=parseFloat(o.paddingBottom)||0}const s=Math.max(1,t-r-i);return{width:e,height:s,offsetY:r}}class gO extends Event{constructor(t){super("scroll",{bubbles:!0,composed:!0});b(this,"scrollPosition");this.scrollPosition=t}}class Py extends Event{constructor(t){super("layout-change",{bubbles:!0,composed:!0});b(this,"layout");this.layout=t}}class mO extends HTMLElement{constructor(){super();b(this,"_layout",[]);b(this,"_scrollPosition",0);b(this,"layoutGrid",null);b(this,"layoutScroll",new ND(Te({x:0})));b(this,"scrollModelKey","");b(this,"resizeObserver",null);b(this,"renderPending",!1);b(this,"animateNextRender",!0);b(this,"wheelGesture",new cO);b(this,"swipeGesture",new dO(this.layoutScroll,t=>{this.animateNextRender=t}));b(this,"swipePointerId",null);b(this,"swipeStartX",0);b(this,"swipeStartY",0);b(this,"swipeLastX",0);b(this,"swipeActive",!1);b(this,"swipeShouldSuppressClick",!1);b(this,"swipeListenersAttached",!1);b(this,"dragController",new aO);b(this,"dragState",null);b(this,"activeDragPointerId",null);b(this,"dragListenersAttached",!1);b(this,"dragFrame",0);b(this,"lastDragFrameTime",0);b(this,"lastPointerX",0);b(this,"lastPointerY",0);b(this,"pointerVelocityPxPerSec",0);b(this,"scrollVelocityPxPerSec",0);b(this,"motionSampleTime",0);b(this,"motionSampleX",0);b(this,"motionSampleY",0);b(this,"dragTrackOffsetXPx",0);b(this,"previousProjectedLayoutForOffset",null);b(this,"renderContent",()=>N``);b(this,"onDragControllerChange",()=>{this.dragController.status==="idle"&&(this.dragState=null,this.dragTrackOffsetXPx=0,this.previousProjectedLayoutForOffset=null),this.scheduleRender()});b(this,"onDragControllerDrag",t=>{const r=pf(t.projectedLayout),i=this.shouldApplyTrackOffset(t.projectedLayout,t.source.parentId),s=t.source.parentId?this.getStackChildAnchorCardId(t.source.parentId,t.nodeId):null;this.dragTrackOffsetXPx=i?this.computeDragTrackOffset(this.previousProjectedLayoutForOffset,r,t.nodeId,t.source.parentId,s,this.dragTrackOffsetXPx):0,this.previousProjectedLayoutForOffset=r,this.dragState={nodeId:t.nodeId,source:t.source,grabOffset:t.grabOffset,pointer:t.pointer,size:t.size,projectedLayout:t.projectedLayout},this.scheduleRender()});b(this,"onDragControllerDrop",t=>{this.dragState=null,this.dragTrackOffsetXPx=0,this.previousProjectedLayoutForOffset=null,this.commitLayout(t.layout)});b(this,"onLayoutScrollInternal",t=>{const i=t.scroll.x??0;Math.abs(i-this._scrollPosition)<Oo||(this._scrollPosition=i,this.emitScrollPositionChanged(i),this.scheduleRender())});b(this,"handleKeyDown",t=>{if(t.key==="Escape"&&this.dragController.status!=="idle"){t.preventDefault(),this.stopDragFrameLoop(),this.releaseActiveDragPointerCapture(),this.dragController.cancel(),this.detachDragListeners();return}this.dragController.status==="idle"&&(t.key==="ArrowRight"?(t.preventDefault(),this.wheelGesture.markKeyboardNavigation(Date.now()),this.shiftWindow(1)):t.key==="ArrowLeft"&&(t.preventDefault(),this.wheelGesture.markKeyboardNavigation(Date.now()),this.shiftWindow(-1)))});b(this,"handleWheel",t=>{if(this._layout.length===0)return;const r=this.wheelGesture.decide({now:Date.now(),shiftKey:t.shiftKey,deltaX:t.deltaX,deltaY:t.deltaY,overArtifactContent:!1});r.type==="scroll-horizontal"&&(t.preventDefault(),this.applyHorizontalWheel(r.horizontalDelta))});b(this,"handleWindowMessage",t=>{var o;if(this._layout.length===0)return;const r=this.findManagedArtifactFrame(t.source);if(!r||!this.isTrustedArtifactFrameMessage(t,r))return;if(EC(t.data)){const a=typeof performance<"u"?performance.now():Date.now();this.swipeGesture.status==="idle"&&this.swipeGesture.start(a),this.swipeGesture.move(a,t.data.deltaX);return}if(xC(t.data)){this.swipeGesture.status==="active"&&this.swipeGesture.end();return}if(!kC(t.data))return;const i=this.wheelGesture.decide({now:Date.now(),shiftKey:t.data.shiftKey,deltaX:t.data.deltaX,deltaY:t.data.deltaY,overArtifactContent:!0});if(i.type==="scroll-horizontal"){this.applyHorizontalWheel(i.horizontalDelta);return}if(i.type!=="scroll-native")return;const s={type:"scroll",deltaX:0,deltaY:t.data.deltaY};(o=r.contentWindow)==null||o.postMessage(s,this.getArtifactFrameTargetOrigin(r))});b(this,"handlePointerDown",t=>{if(t.button!==0||this.dragController.status!=="idle")return;const r=t.target;if(!(r instanceof Element))return;const i=r.closest("[drag-handle]")!==null,s=r.closest("button, input, textarea, select, a, [role='button']")!==null;if(t.pointerType==="touch"&&!i&&!s&&this._layout.length>0){this.beginSwipeTracking(t);return}if(!i||s)return;const o=r.closest(".card-slot");if(!o)return;const a=o.getAttribute("data-layout-node-id");if(!a)return;const l=yO(this._layout,a);if(!l)return;const u=o.getBoundingClientRect();this.lastPointerX=t.clientX,this.lastPointerY=t.clientY,this.resetMotionTracking(t.clientX,t.clientY),this.focus(),this.dragController.start({nodeId:a,source:{index:l.topLevelIndex,parentId:l.sourceStackId},pointer:we({x:t.clientX,y:t.clientY}),grabOffset:we({x:t.clientX-u.left,y:t.clientY-u.top}),size:we({x:u.width,y:u.height}),layout:this._layout}),this.attachDragListeners(),this.activeDragPointerId=t.pointerId;try{this.setPointerCapture(t.pointerId)}catch{}t.preventDefault()});b(this,"handleSwipePointerMove",t=>{if(this.swipePointerId===null||t.pointerId!==this.swipePointerId)return;if(!this.swipeActive){const i=t.clientX-this.swipeStartX,s=t.clientY-this.swipeStartY,o=Math.abs(i),a=Math.abs(s);if(o<Sp&&a<Sp)return;if(a>=o){this.endSwipeTracking();return}this.swipeActive=!0,this.swipeShouldSuppressClick=!0;try{this.setPointerCapture(t.pointerId)}catch{}this.swipeGesture.start(t.timeStamp)}const r=t.clientX-this.swipeLastX;this.swipeLastX=t.clientX,this.swipeGesture.move(t.timeStamp,r),t.preventDefault()});b(this,"handleSwipePointerUp",t=>{this.swipePointerId===null||t.pointerId!==this.swipePointerId||(this.swipeActive&&this.swipeGesture.end(),this.releaseSwipePointerCapture(t.pointerId),this.endSwipeTracking())});b(this,"handleSwipePointerCancel",t=>{this.swipePointerId===null||t.pointerId!==this.swipePointerId||(this.swipeActive&&this.swipeGesture.cancel(),this.releaseSwipePointerCapture(t.pointerId),this.endSwipeTracking())});b(this,"handleSwipeWindowBlur",()=>{this.swipePointerId!==null&&this.swipeActive&&this.swipeGesture.cancel(),this.swipePointerId!==null&&this.releaseSwipePointerCapture(this.swipePointerId),this.endSwipeTracking()});b(this,"handleSwipeClick",t=>{this.swipeShouldSuppressClick&&(this.swipeShouldSuppressClick=!1,t.preventDefault(),t.stopPropagation(),typeof t.stopImmediatePropagation=="function"&&t.stopImmediatePropagation())});b(this,"handleWindowPointerMove",t=>{this.lastPointerX=t.clientX,this.lastPointerY=t.clientY,this.updatePointerVelocity(t.clientX,t.clientY),this.syncDragTargetForLatestPointer(),this.ensureDragFrameLoop()});b(this,"handleWindowPointerUp",t=>{this.stopDragFrameLoop(),this.releasePointerCaptureForEvent(t.pointerId),this.dragController.drop(),this.clearMotionTracking(),this.detachDragListeners()});b(this,"handleWindowPointerCancel",t=>{this.stopDragFrameLoop(),this.releasePointerCaptureForEvent(t.pointerId),this.dragController.cancel(),this.clearMotionTracking(),this.detachDragListeners()});b(this,"handleWindowBlur",()=>{this.releaseActiveDragPointerCapture(),this.stopDragFrameLoop(),this.dragController.cancel(),this.clearMotionTracking(),this.detachDragListeners()});b(this,"runDragFrame",t=>{if(this.dragController.status==="idle"){this.dragFrame=0;return}const r=Math.max(0,t-this.lastDragFrameTime)/yf;this.lastDragFrameTime=t,this.samplePointerVelocityAt(t,this.lastPointerX,this.lastPointerY);const i=this.getBoundingClientRect(),s=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,i),o=this.getDragEdgeScrollDeltaPixels(s.x,i,r);this.scrollVelocityPxPerSec=r>Oo?Math.abs(o)/r:0,Math.abs(o)>Oo&&(this.animateNextRender=!1,this.layoutScroll.wheelPixels(we({x:o}))),this.dragController.status==="active"&&this.syncDragTarget(s.x,s.y,i),this.dragFrame=requestAnimationFrame(this.runDragFrame)});this.dragController.addEventListener("change",this.onDragControllerChange),this.dragController.addEventListener("drag",this.onDragControllerDrag),this.dragController.addEventListener("drop",this.onDragControllerDrop),this.layoutScroll.addEventListener("layout-scroll",this.onLayoutScrollInternal)}set layout(t){this._layout=[...t],this.stopDragFrameLoop(),this.dragController.cancel(),this.scrollModelKey="",this.syncScrollModel(),this.layoutScroll.scroll=Te({x:this._scrollPosition}),this.scheduleRender()}get layout(){return this._layout}commitLayout(t){this.layout=t,this.emitLayoutChanged()}set scrollPosition(t){Math.abs(t-this._scrollPosition)<Oo||(this.animateNextRender=!1,this.syncScrollModel(),this.layoutScroll.scroll=Te({x:t}))}get scrollPosition(){return this._scrollPosition}focusArtifact(t){const r=Fr(this._layout),i=r.nodes.findIndex(o=>o.cards.some(a=>a.artifactID===t));if(i<0)return;let s=0;for(let o=0;o<i;o+=1)s+=r.nodes[o].width;this.scrollPosition=s,queueMicrotask(()=>{const o=this.querySelector(`.card-slot[data-layout-card-id="${fO(t)}"]`);if(!o)return;o.classList.remove("card-focus-pulse"),o.offsetHeight,o.classList.add("card-focus-pulse");const a=()=>{o.classList.remove("card-focus-pulse"),o.removeEventListener("animationend",a)};o.addEventListener("animationend",a)})}connectedCallback(){this.hasAttribute("tabindex")||(this.tabIndex=0),this.focus(),this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("wheel",this.handleWheel,{passive:!1}),this.addEventListener("pointerdown",this.handlePointerDown),window.addEventListener("message",this.handleWindowMessage),typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>this.render()),this.resizeObserver.observe(this)),this.render()}disconnectedCallback(){var t;this.removeEventListener("keydown",this.handleKeyDown),this.removeEventListener("wheel",this.handleWheel),this.removeEventListener("pointerdown",this.handlePointerDown),window.removeEventListener("message",this.handleWindowMessage),(t=this.resizeObserver)==null||t.disconnect(),this.resizeObserver=null,this.wheelGesture.reset(),this.detachDragListeners(),this.swipeGesture.status==="active"&&this.swipeGesture.cancel(),this.swipePointerId!==null&&this.releaseSwipePointerCapture(this.swipePointerId),this.endSwipeTracking(),this.dragController.removeEventListener("change",this.onDragControllerChange),this.dragController.removeEventListener("drag",this.onDragControllerDrag),this.dragController.removeEventListener("drop",this.onDragControllerDrop),this.layoutScroll.removeEventListener("layout-scroll",this.onLayoutScrollInternal),this.dragController.dispose(),this.stopDragFrameLoop()}scheduleRender(){this.renderPending||(this.renderPending=!0,queueMicrotask(()=>{this.renderPending=!1,this.render()}))}createGrid(t,r){return new AD({basis:we({x:Ln,y:Ln}),min:we({x:bp,y:bp}),viewport:we({x:t,y:r}),gap:we({x:he,y:he})})}syncScrollModel(){const t=oc(this),i=Fr(this._layout).nodes.map(o=>o.width),s=`${t.width}x${t.height}:${i.join(",")}`;s===this.scrollModelKey&&this.layoutGrid||(this.scrollModelKey=s,this.layoutGrid=this.createGrid(t.width,t.height),this.layoutScroll.rebuild({grid:this.layoutGrid,nodeWidths:i.map(o=>Te({x:o}))}))}emitScrollPositionChanged(t){this.dispatchEvent(new gO(t))}emitLayoutChanged(){this.dispatchEvent(new Py([...this._layout]))}shiftWindow(t){this.syncScrollModel(),this.animateNextRender=!0,this.layoutScroll.step(t)}applyHorizontalWheel(t){this.syncScrollModel();const r=this.layoutGrid;if(!r)return;this.animateNextRender=!1;const i=r.toUnits(we({x:t}));this.layoutScroll.wheel(Te({x:i.x??0}))}findManagedArtifactFrame(t){if(!t)return null;const r=this.querySelectorAll("iframe.artifact-frame");for(const i of r)if(i.contentWindow===t)return i;return null}isTrustedArtifactFrameMessage(t,r){if(t.origin==="null")return!0;const i=this.getArtifactFrameOrigin(r);return i===null||t.origin===i}getArtifactFrameTargetOrigin(t){const r=t.getAttribute("sandbox")??"";return new Set(r.split(/\s+/).filter(Boolean)).has("allow-same-origin")?this.getArtifactFrameOrigin(t)??"*":"*"}getArtifactFrameOrigin(t){const r=t.getAttribute("src")??t.src;if(!r)return null;try{return new URL(r,window.location.href).origin}catch{return null}}beginSwipeTracking(t){this.swipePointerId=t.pointerId,this.swipeStartX=t.clientX,this.swipeStartY=t.clientY,this.swipeLastX=t.clientX,this.swipeActive=!1,this.swipeShouldSuppressClick=!1,this.attachSwipeListeners()}attachSwipeListeners(){this.swipeListenersAttached||(window.addEventListener("pointermove",this.handleSwipePointerMove),window.addEventListener("pointerup",this.handleSwipePointerUp),window.addEventListener("pointercancel",this.handleSwipePointerCancel),this.addEventListener("pointermove",this.handleSwipePointerMove),this.addEventListener("pointerup",this.handleSwipePointerUp),this.addEventListener("pointercancel",this.handleSwipePointerCancel),window.addEventListener("blur",this.handleSwipeWindowBlur),this.addEventListener("click",this.handleSwipeClick,{capture:!0}),this.swipeListenersAttached=!0)}detachSwipeListeners(){this.swipeListenersAttached&&(window.removeEventListener("pointermove",this.handleSwipePointerMove),window.removeEventListener("pointerup",this.handleSwipePointerUp),window.removeEventListener("pointercancel",this.handleSwipePointerCancel),this.removeEventListener("pointermove",this.handleSwipePointerMove),this.removeEventListener("pointerup",this.handleSwipePointerUp),this.removeEventListener("pointercancel",this.handleSwipePointerCancel),window.removeEventListener("blur",this.handleSwipeWindowBlur),this.removeEventListener("click",this.handleSwipeClick,{capture:!0}),this.swipeListenersAttached=!1)}endSwipeTracking(){this.swipePointerId=null,this.swipeActive=!1,this.detachSwipeListeners()}releaseSwipePointerCapture(t){try{this.hasPointerCapture(t)&&this.releasePointerCapture(t)}catch{}}releaseActiveDragPointerCapture(){this.activeDragPointerId!==null&&this.releasePointerCaptureForEvent(this.activeDragPointerId)}releasePointerCaptureForEvent(t){try{this.hasPointerCapture(t)&&this.releasePointerCapture(t)}catch{}}attachDragListeners(){this.dragListenersAttached||(window.addEventListener("pointermove",this.handleWindowPointerMove),window.addEventListener("pointerup",this.handleWindowPointerUp),window.addEventListener("pointercancel",this.handleWindowPointerCancel),this.addEventListener("pointermove",this.handleWindowPointerMove),this.addEventListener("pointerup",this.handleWindowPointerUp),this.addEventListener("pointercancel",this.handleWindowPointerCancel),window.addEventListener("blur",this.handleWindowBlur),this.dragListenersAttached=!0)}detachDragListeners(){this.dragListenersAttached&&(window.removeEventListener("pointermove",this.handleWindowPointerMove),window.removeEventListener("pointerup",this.handleWindowPointerUp),window.removeEventListener("pointercancel",this.handleWindowPointerCancel),this.removeEventListener("pointermove",this.handleWindowPointerMove),this.removeEventListener("pointerup",this.handleWindowPointerUp),this.removeEventListener("pointercancel",this.handleWindowPointerCancel),window.removeEventListener("blur",this.handleWindowBlur),this.dragListenersAttached=!1,this.activeDragPointerId=null)}getDisplayModel(){if(this.dragController.status!=="active"||!this.dragState)return{layout:this._layout,activePlaceholderId:null,placeholdersById:new Map};const t=new Map;return t.set(this.dragState.nodeId,{id:this.dragState.nodeId,sourceCardId:this.dragState.nodeId}),{layout:pf(this.dragState.projectedLayout),activePlaceholderId:this.dragState.nodeId,placeholdersById:t}}render(){const t=oc(this),r=this.createGrid(t.width,t.height);this.layoutGrid=r;const i=this.getDisplayModel(),s=i.layout,o=this.dragController.status==="active",a=Fr(s),l=a.nodes.map(O=>O.width),u=`${t.width}x${t.height}:${l.join(",")}`;!o&&u!==this.scrollModelKey&&(this.scrollModelKey=u,this.layoutScroll.rebuild({grid:r,nodeWidths:l.map(O=>Te({x:O}))}),this._scrollPosition=this.layoutScroll.scroll.x??this._scrollPosition);const h=vO(s),p=r.unit.x??Ln,g=r.unit.y??Ln,m=o?this.dragTrackOffsetXPx:0,A=(this.layoutScroll.translate.x??0)+m,k=bf(a.nodes.length,r,t.height),I=this.animateNextRender&&!o,U=[`transform: translate(${A}px, ${k}px);`,`transition-duration: ${I?lx:0}ms;`,`pointer-events: ${o?"none":"auto"};`].join(" ");this.animateNextRender=!0,this.style.setProperty("--layout-unit-x",`${p}px`),this.style.setProperty("--layout-unit-y",`${g}px`),this.style.setProperty("--layout-gap",`${he}px`);const P=this.dragState,V={width:(P==null?void 0:P.size.x)??0,height:(P==null?void 0:P.size.y)??0};Re(N`
162
162
  <div class="track" style=${U}>
163
163
  ${a.nodes.map((O,H)=>N`
164
164
  <div
@@ -201,7 +201,7 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
201
201
  ${this.renderDraggedPreview(P.nodeId)}
202
202
  </div>
203
203
  `})():null}
204
- `,this)}ensureDragFrameLoop(){this.dragFrame!==0||this.dragController.status==="idle"||(this.lastDragFrameTime=performance.now(),this.dragFrame=requestAnimationFrame(this.runDragFrame))}stopDragFrameLoop(){this.dragFrame!==0&&(cancelAnimationFrame(this.dragFrame),this.dragFrame=0,this.scrollVelocityPxPerSec=0)}syncDragTargetForLatestPointer(){if(this.dragController.status==="idle")return;const t=this.getBoundingClientRect();if(this.dragController.status==="active"){const i=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,t);this.syncDragTarget(i.x,i.y,t);return}if(this.syncDragTarget(this.lastPointerX,this.lastPointerY,t),this.dragController.status==="pending")return;const r=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,t);(r.x!==this.lastPointerX||r.y!==this.lastPointerY)&&this.syncDragTarget(r.x,r.y,t)}syncDragTarget(t,r,i=this.getBoundingClientRect()){if(this.dragController.status==="idle")return;const s=this.getDisplayModel(),o=new Set(s.placeholdersById.keys()),a=this.dragController.status==="active"?this.dragTrackOffsetXPx:0,l=this.measureLayoutGeometry(s.layout,o,a);this.dragController.update({pointer:we({x:t,y:r}),viewport:{left:i.left,top:i.top,width:i.width,height:i.height},geometry:l,effectiveVelocity:Math.max(this.pointerVelocityPxPerSec,this.scrollVelocityPxPerSec)})}resetMotionTracking(t,r){this.pointerVelocityPxPerSec=0,this.scrollVelocityPxPerSec=0,this.motionSampleTime=performance.now(),this.motionSampleX=t,this.motionSampleY=r}clearMotionTracking(){this.pointerVelocityPxPerSec=0,this.scrollVelocityPxPerSec=0,this.motionSampleTime=0}updatePointerVelocity(t,r){this.samplePointerVelocityAt(performance.now(),t,r)}samplePointerVelocityAt(t,r,i){if(this.motionSampleTime===0){this.motionSampleTime=t,this.motionSampleX=r,this.motionSampleY=i,this.pointerVelocityPxPerSec=0;return}const s=t-this.motionSampleTime;if(s<100)return;const o=r-this.motionSampleX;this.pointerVelocityPxPerSec=Math.abs(o)/s*Ef,this.motionSampleTime=t,this.motionSampleX=r,this.motionSampleY=i}clampPointerToViewport(t,r,i){return{x:Math.max(i.left,Math.min(i.left+i.width,t)),y:Math.max(i.top,Math.min(i.top+i.height,r))}}isPointerOutsideViewport(t,r,i){return t<i.left||t>i.left+i.width||r<i.top||r>i.top+i.height}getDragEdgeScrollDeltaPixels(t,r,i){var u;const s=r.left+$o,o=r.left+r.width-$o,a=((u=this.layoutGrid)==null?void 0:u.unit.x)??Ln,l=gx*a;if(t<s){const h=Math.max(0,Math.min(1,(s-t)/$o));return-(l*h**Ap)*i}if(t>o){const h=Math.max(0,Math.min(1,(t-o)/$o));return l*h**Ap*i}return 0}measureLayoutGeometry(t,r,i=0){const s=this.layoutGrid;if(!s)return[];const o=Fr(t),a=new Map(o.nodes.map(k=>[k.id,k.width])),l=s.toPixels(Te({y:et})).y??ha,u=cc(this),h=(this.layoutScroll.translate.x??0)+i,p=xf(o.nodes.length,s,u.height),g=u.offsetY+p,m=[];let A=h;for(const k of t){const I=a.get(k.id)??Ot,U=s.toPixels(Te({x:I})).x??hr,P={left:A,top:g,width:U,height:l};m.push({id:k.id,rect:P}),A+=U+he}return m}getPlaceholderPixelSize(t,r,i,s){if(!r)return s;for(const o of t.nodes)for(const a of o.cards)if(a.id===r)return{width:i.toPixels(Te({x:a.width})).x??s.width,height:i.toPixels(Te({y:a.height})).y??s.height};return s}renderDraggedPreview(t){const r=ph(this._layout,t);return r?this.renderContent(r,{isDragging:!0}):N``}shouldApplyTrackOffset(t,r){if(r)return!0;for(const i of t){if(i.type!=="stack")continue;if(i.children.some(o=>o.type==="drop-target")&&r!==i.id)return!0}return!1}computeDragTrackOffset(t,r,i,s,o,a){if(!t)return a;const l=s?o??this.getStableAnchorCardId(t,r,i):this.getStableAnchorNodeId(t,r,i);if(!l)return a;const u=s?$f(t,l,this.layoutGrid):Tf(t,l,this.layoutGrid),h=s?$f(r,l,this.layoutGrid):Tf(r,l,this.layoutGrid);return u===null||h===null?a:a+(u-h)}getStableAnchorCardId(t,r,i){const s=Af(t),o=new Set(Af(r));for(const a of s)if(a!==i&&o.has(a))return a;return null}getStableAnchorNodeId(t,r,i){const s=new Set(r.map(o=>o.id));for(const o of t)if(o.id!==i&&s.has(o.id))return o.id;return null}getStackChildAnchorCardId(t,r){const i=this._layout.find(o=>o.type==="stack"&&o.id===t);if(!i||i.type!=="stack")return null;const s=i.children.find(o=>o.type==="card"&&o.id!==r);return(s==null?void 0:s.id)??null}}function _O(n){const e=new Map;for(const t of n){if(t.type==="card"){e.set(t.id,t);continue}for(const r of t.children)if(r.type==="card")e.set(r.id,r);else for(const i of r.children)e.set(i.id,i)}return e}function kO(n,e){const t=n.findIndex(r=>r.type==="card"&&r.id===e);if(t!==-1)return{topLevelIndex:t};for(let r=0;r<n.length;r+=1){const i=n[r];if(!(!i||i.type!=="stack")&&i.children.some(s=>s.type==="card"&&s.id===e))return{topLevelIndex:r,sourceStackId:i.id}}return null}function Af(n){const e=[];for(const t of n){if(t.type==="card"){e.push(t.id);continue}if(t.type==="stack"){const r=t.children.find(i=>i.type==="card");r&&e.push(r.id)}}return e}function $f(n,e,t){if(!t)return null;const r=Fr(n),i=new Map(r.nodes.map(o=>[o.id,o.width]));let s=0;for(const o of n){if(o.type==="card"&&o.id===e||o.type==="stack"&&o.children.some(u=>u.type==="card"&&u.id===e))return s;const a=i.get(o.id)??Ot,l=t.toPixels(Te({x:a})).x??hr;s+=l+he}return null}function Tf(n,e,t){if(!t)return null;const r=Fr(n),i=new Map(r.nodes.map(o=>[o.id,o.width]));let s=0;for(const o of n){if(o.id===e)return s;const a=i.get(o.id)??Ot,l=t.toPixels(Te({x:a})).x??hr;s+=l+he}return null}customElements.get("layout-view")||customElements.define("layout-view",SO);class EO extends HTMLElement{constructor(){super(...arguments);b(this,"screenManager",qe.resolve("ScreenManager"));b(this,"boundModel",null);b(this,"handleActiveScreenChanged",()=>{this.rebindModel(),this.render()});b(this,"handleModelChange",()=>{this.render()});b(this,"handleCloseArtifact",t=>{t instanceof Py&&this.screenManager.activeScreen&&this.screenManager.activeScreen.removeArtifact(t.artifactID)});b(this,"handleScrollPositionChanged",t=>{const r=t;typeof r.scrollPosition=="number"&&Number.isFinite(r.scrollPosition)&&this.screenManager.activeScreen&&this.screenManager.activeScreen.setScrollPosition(r.scrollPosition)});b(this,"handleLayoutChanged",t=>{t instanceof My&&this.screenManager.activeScreen&&this.screenManager.activeScreen.setLayout(t.layout)});b(this,"handleServerEvent",t=>{const r=t.event;if(r.type!=="viewer-focus"||!this.boundModel||r.screenID!==this.boundModel.id)return;const i=this.querySelector("layout-view");i&&i.focusArtifact(r.artifactID)})}connectedCallback(){this.screenManager.addEventListener("active-screen-changed",this.handleActiveScreenChanged),this.rebindModel(),this.render()}disconnectedCallback(){this.screenManager.removeEventListener("active-screen-changed",this.handleActiveScreenChanged),this.unbindModel()}rebindModel(){const t=this.screenManager.activeScreen;this.boundModel!==t&&(this.unbindModel(),this.boundModel=t,t&&(t.addEventListener("change",this.handleModelChange),t.server.addEventListener("server-event",this.handleServerEvent)))}unbindModel(){this.boundModel&&(this.boundModel.removeEventListener("change",this.handleModelChange),this.boundModel.server.removeEventListener("server-event",this.handleServerEvent),this.boundModel=null)}buildArtifactMap(){const t=this.screenManager.activeScreen;return t?new Map(t.artifacts):new Map}render(){const t=this.screenManager.activeScreen,r=(t==null?void 0:t.layout)??[],i=this.buildArtifactMap();if(r.length===0){Re(N`<p data-testid="empty-screen" class="empty">
204
+ `,this)}ensureDragFrameLoop(){this.dragFrame!==0||this.dragController.status==="idle"||(this.lastDragFrameTime=performance.now(),this.dragFrame=requestAnimationFrame(this.runDragFrame))}stopDragFrameLoop(){this.dragFrame!==0&&(cancelAnimationFrame(this.dragFrame),this.dragFrame=0,this.scrollVelocityPxPerSec=0)}syncDragTargetForLatestPointer(){if(this.dragController.status==="idle")return;const t=this.getBoundingClientRect();if(this.dragController.status==="active"){const i=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,t);this.syncDragTarget(i.x,i.y,t);return}if(this.syncDragTarget(this.lastPointerX,this.lastPointerY,t),this.dragController.status==="pending")return;const r=this.clampPointerToViewport(this.lastPointerX,this.lastPointerY,t);(r.x!==this.lastPointerX||r.y!==this.lastPointerY)&&this.syncDragTarget(r.x,r.y,t)}syncDragTarget(t,r,i=this.getBoundingClientRect()){if(this.dragController.status==="idle")return;const s=this.getDisplayModel(),o=new Set(s.placeholdersById.keys()),a=this.dragController.status==="active"?this.dragTrackOffsetXPx:0,l=this.measureLayoutGeometry(s.layout,o,a);this.dragController.update({pointer:we({x:t,y:r}),viewport:{left:i.left,top:i.top,width:i.width,height:i.height},geometry:l,effectiveVelocity:Math.max(this.pointerVelocityPxPerSec,this.scrollVelocityPxPerSec)})}resetMotionTracking(t,r){this.pointerVelocityPxPerSec=0,this.scrollVelocityPxPerSec=0,this.motionSampleTime=performance.now(),this.motionSampleX=t,this.motionSampleY=r}clearMotionTracking(){this.pointerVelocityPxPerSec=0,this.scrollVelocityPxPerSec=0,this.motionSampleTime=0}updatePointerVelocity(t,r){this.samplePointerVelocityAt(performance.now(),t,r)}samplePointerVelocityAt(t,r,i){if(this.motionSampleTime===0){this.motionSampleTime=t,this.motionSampleX=r,this.motionSampleY=i,this.pointerVelocityPxPerSec=0;return}const s=t-this.motionSampleTime;if(s<100)return;const o=r-this.motionSampleX;this.pointerVelocityPxPerSec=Math.abs(o)/s*yf,this.motionSampleTime=t,this.motionSampleX=r,this.motionSampleY=i}clampPointerToViewport(t,r,i){return{x:Math.max(i.left,Math.min(i.left+i.width,t)),y:Math.max(i.top,Math.min(i.top+i.height,r))}}isPointerOutsideViewport(t,r,i){return t<i.left||t>i.left+i.width||r<i.top||r>i.top+i.height}getDragEdgeScrollDeltaPixels(t,r,i){var u;const s=r.left+$o,o=r.left+r.width-$o,a=((u=this.layoutGrid)==null?void 0:u.unit.x)??Ln,l=ux*a;if(t<s){const h=Math.max(0,Math.min(1,(s-t)/$o));return-(l*h**wp)*i}if(t>o){const h=Math.max(0,Math.min(1,(t-o)/$o));return l*h**wp*i}return 0}measureLayoutGeometry(t,r,i=0){const s=this.layoutGrid;if(!s)return[];const o=Fr(t),a=new Map(o.nodes.map(k=>[k.id,k.width])),l=s.toPixels(Te({y:et})).y??ha,u=oc(this),h=(this.layoutScroll.translate.x??0)+i,p=bf(o.nodes.length,s,u.height),g=u.offsetY+p,m=[];let A=h;for(const k of t){const I=a.get(k.id)??Ot,U=s.toPixels(Te({x:I})).x??hr,P={left:A,top:g,width:U,height:l};m.push({id:k.id,rect:P}),A+=U+he}return m}getPlaceholderPixelSize(t,r,i,s){if(!r)return s;for(const o of t.nodes)for(const a of o.cards)if(a.id===r)return{width:i.toPixels(Te({x:a.width})).x??s.width,height:i.toPixels(Te({y:a.height})).y??s.height};return s}renderDraggedPreview(t){const r=uh(this._layout,t);return r?this.renderContent(r,{isDragging:!0}):N``}shouldApplyTrackOffset(t,r){if(r)return!0;for(const i of t){if(i.type!=="stack")continue;if(i.children.some(o=>o.type==="drop-target")&&r!==i.id)return!0}return!1}computeDragTrackOffset(t,r,i,s,o,a){if(!t)return a;const l=s?o??this.getStableAnchorCardId(t,r,i):this.getStableAnchorNodeId(t,r,i);if(!l)return a;const u=s?Sf(t,l,this.layoutGrid):_f(t,l,this.layoutGrid),h=s?Sf(r,l,this.layoutGrid):_f(r,l,this.layoutGrid);return u===null||h===null?a:a+(u-h)}getStableAnchorCardId(t,r,i){const s=wf(t),o=new Set(wf(r));for(const a of s)if(a!==i&&o.has(a))return a;return null}getStableAnchorNodeId(t,r,i){const s=new Set(r.map(o=>o.id));for(const o of t)if(o.id!==i&&s.has(o.id))return o.id;return null}getStackChildAnchorCardId(t,r){const i=this._layout.find(o=>o.type==="stack"&&o.id===t);if(!i||i.type!=="stack")return null;const s=i.children.find(o=>o.type==="card"&&o.id!==r);return(s==null?void 0:s.id)??null}}function vO(n){const e=new Map;for(const t of n){if(t.type==="card"){e.set(t.id,t);continue}for(const r of t.children)if(r.type==="card")e.set(r.id,r);else for(const i of r.children)e.set(i.id,i)}return e}function yO(n,e){const t=n.findIndex(r=>r.type==="card"&&r.id===e);if(t!==-1)return{topLevelIndex:t};for(let r=0;r<n.length;r+=1){const i=n[r];if(!(!i||i.type!=="stack")&&i.children.some(s=>s.type==="card"&&s.id===e))return{topLevelIndex:r,sourceStackId:i.id}}return null}function wf(n){const e=[];for(const t of n){if(t.type==="card"){e.push(t.id);continue}if(t.type==="stack"){const r=t.children.find(i=>i.type==="card");r&&e.push(r.id)}}return e}function Sf(n,e,t){if(!t)return null;const r=Fr(n),i=new Map(r.nodes.map(o=>[o.id,o.width]));let s=0;for(const o of n){if(o.type==="card"&&o.id===e||o.type==="stack"&&o.children.some(u=>u.type==="card"&&u.id===e))return s;const a=i.get(o.id)??Ot,l=t.toPixels(Te({x:a})).x??hr;s+=l+he}return null}function _f(n,e,t){if(!t)return null;const r=Fr(n),i=new Map(r.nodes.map(o=>[o.id,o.width]));let s=0;for(const o of n){if(o.id===e)return s;const a=i.get(o.id)??Ot,l=t.toPixels(Te({x:a})).x??hr;s+=l+he}return null}customElements.get("layout-view")||customElements.define("layout-view",mO);class bO extends HTMLElement{constructor(){super(...arguments);b(this,"screenManager",qe.resolve("ScreenManager"));b(this,"boundModel",null);b(this,"handleActiveScreenChanged",()=>{this.rebindModel(),this.render()});b(this,"handleModelChange",()=>{this.render()});b(this,"handleCloseArtifact",t=>{t instanceof xy&&this.screenManager.activeScreen&&this.screenManager.activeScreen.removeArtifact(t.artifactID)});b(this,"handleScrollPositionChanged",t=>{const r=t;typeof r.scrollPosition=="number"&&Number.isFinite(r.scrollPosition)&&this.screenManager.activeScreen&&this.screenManager.activeScreen.setScrollPosition(r.scrollPosition)});b(this,"handleLayoutChanged",t=>{t instanceof Py&&this.screenManager.activeScreen&&this.screenManager.activeScreen.setLayout(t.layout)});b(this,"handleServerEvent",t=>{const r=t.event;if(r.type!=="viewer-focus"||!this.boundModel||r.screenID!==this.boundModel.id)return;const i=this.querySelector("layout-view");i&&i.focusArtifact(r.artifactID)})}connectedCallback(){this.screenManager.addEventListener("active-screen-changed",this.handleActiveScreenChanged),this.rebindModel(),this.render()}disconnectedCallback(){this.screenManager.removeEventListener("active-screen-changed",this.handleActiveScreenChanged),this.unbindModel()}rebindModel(){const t=this.screenManager.activeScreen;this.boundModel!==t&&(this.unbindModel(),this.boundModel=t,t&&(t.addEventListener("change",this.handleModelChange),t.server.addEventListener("server-event",this.handleServerEvent)))}unbindModel(){this.boundModel&&(this.boundModel.removeEventListener("change",this.handleModelChange),this.boundModel.server.removeEventListener("server-event",this.handleServerEvent),this.boundModel=null)}buildArtifactMap(){const t=this.screenManager.activeScreen;return t?new Map(t.artifacts):new Map}render(){const t=this.screenManager.activeScreen,r=(t==null?void 0:t.layout)??[],i=this.buildArtifactMap();if(r.length===0){Re(N`<p data-testid="empty-screen" class="empty">
205
205
  No artifacts yet. Create one by asking for something.
206
206
  </p>`,this);return}Re(N`
207
207
  <layout-view
@@ -218,7 +218,7 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
218
218
  @layout-change=${this.handleLayoutChanged}
219
219
  @close-artifact=${this.handleCloseArtifact}
220
220
  ></layout-view>
221
- `,this)}}customElements.define("screen-view",EO);var Ta,ni,Ms,Jt,Ny,Uy,lu;class xO extends HTMLElement{constructor(){super(...arguments);w(this,Jt);w(this,Ta,qe.resolve("ScreenManager"));w(this,ni,qe.resolve("ServerManager"));w(this,Ms,()=>{v(this,Jt,lu).call(this)})}connectedCallback(){c(this,ni).addEventListener("change",c(this,Ms)),v(this,Jt,lu).call(this)}disconnectedCallback(){c(this,ni).removeEventListener("change",c(this,Ms))}}Ta=new WeakMap,ni=new WeakMap,Ms=new WeakMap,Jt=new WeakSet,Ny=function(t,r){c(this,Ta).setActive(t,r)},Uy=function(){for(const t of c(this,ni).servers.values())return t;return null},lu=function(){const t=v(this,Jt,Uy).call(this),i=(t?[...t.screens.values()]:[]).slice().sort((o,a)=>o.starred!==a.starred?o.starred?-1:1:o.name.localeCompare(a.name,void 0,{sensitivity:"base"})),s=i.length===0?N`<p class="empty">No screens yet. Hit + to create one.</p>`:N`
221
+ `,this)}}customElements.define("screen-view",bO);var Ta,ni,Ms,Jt,Ry,Dy,su;class wO extends HTMLElement{constructor(){super(...arguments);w(this,Jt);w(this,Ta,qe.resolve("ScreenManager"));w(this,ni,qe.resolve("ServerManager"));w(this,Ms,()=>{v(this,Jt,su).call(this)})}connectedCallback(){c(this,ni).addEventListener("change",c(this,Ms)),v(this,Jt,su).call(this)}disconnectedCallback(){c(this,ni).removeEventListener("change",c(this,Ms))}}Ta=new WeakMap,ni=new WeakMap,Ms=new WeakMap,Jt=new WeakSet,Ry=function(t,r){c(this,Ta).setActive(t,r)},Dy=function(){for(const t of c(this,ni).servers.values())return t;return null},su=function(){const t=v(this,Jt,Dy).call(this),i=(t?[...t.screens.values()]:[]).slice().sort((o,a)=>o.starred!==a.starred?o.starred?-1:1:o.name.localeCompare(a.name,void 0,{sensitivity:"base"})),s=i.length===0?N`<p class="empty">No screens yet. Hit + to create one.</p>`:N`
222
222
  <ul class="tiles">
223
223
  ${i.map(o=>N`
224
224
  <li>
@@ -226,27 +226,27 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
226
226
  class="tile"
227
227
  type="button"
228
228
  material="glass"
229
- @click=${()=>t&&v(this,Jt,Ny).call(this,t.url,o.id)}
229
+ @click=${()=>t&&v(this,Jt,Ry).call(this,t.url,o.id)}
230
230
  >
231
231
  <span class="tile-name">${o.name}</span>
232
- ${o.starred?N`<span class="tile-star" aria-hidden="true">${jc({weight:"fill"})}</span>`:se}
232
+ ${o.starred?N`<span class="tile-star" aria-hidden="true">${Gc({weight:"fill"})}</span>`:se}
233
233
  </button>
234
234
  </li>
235
235
  `)}
236
236
  </ul>
237
- `;Re(s,this)};customElements.get("home-screen")||customElements.define("home-screen",xO);const uc=new WeakMap,Cf=Object.prototype.hasOwnProperty,AO=(()=>{const n=new Set;let e=HTMLElement.prototype;for(;e;){for(const t of Object.getOwnPropertyNames(e))n.add(t);if(e===Node.prototype)break;e=Object.getPrototypeOf(e)}return n})();function $O(n,e){if(n===Boolean)return e!==null;if(e!==null)return n===Number?Number(e):e}var Ns,cu,sr,rt,Rt,ri,or,ii,Ie,Xi,Fy,Zy,Hy,ta;const Nn=class Nn extends HTMLElement{constructor(){var i;super();w(this,Ie);w(this,sr,new Map);w(this,rt,new Map);w(this,Rt,new Map);w(this,ri,!1);w(this,or,!1);w(this,ii,!1);const t=v(i=Nn,Ns,cu).call(i,this.constructor),r=this;for(const s of t.properties)Cf.call(r,s)&&(c(this,Rt).set(s,r[s]),delete r[s])}static get observedAttributes(){var t;return v(t=Nn,Ns,cu).call(t,this).observedAttributes}connected(){}disconnected(){}changed(t){}connectedCallback(){if(v(this,Ie,Hy).call(this),!c(this,or))for(const t of v(this,Ie,Xi).call(this).properties)c(this,rt).has(t)||c(this,rt).set(t,void 0);this.dispatchEvent(new Event("reactive:connect")),this.connected(),v(this,Ie,ta).call(this)}disconnectedCallback(){this.dispatchEvent(new Event("reactive:disconnect")),this.disconnected()}attributeChangedCallback(t,r,i){if(r===i)return;const s=v(this,Ie,Xi).call(this).byAttr.get(t);s&&(c(this,Rt).has(s.property)||(this[s.property]=$O(s.type,i)))}};Ns=new WeakSet,cu=function(t){const r=uc.get(t);if(r)return r;const i=[...t.properties??[]],s=t.attributes??{},o=new Map,a=new Map;for(const u of i)if(AO.has(u))throw new Error(`Reactive property "${u}" collides with a built-in DOM property. Rename it to avoid shadowing the platform API.`);for(const[u,h]of Object.entries(s)){if(u.includes("-")&&h.property===void 0)throw new Error(`Attribute "${u}" must declare a "property" name because kebab-case cannot be a property.`);const p=h.property??u;if(!i.includes(p))throw new Error(`Attribute '${u}' references property '${p}', which isn't declared in \`static properties\`. Add it to \`properties\` to make it reactive.`);const g={attribute:u,property:p,type:h.type};o.set(u,g),a.set(p,g)}for(const u of i){const h=Object.getOwnPropertyDescriptor(t.prototype,u);if((h==null?void 0:h.get)!==void 0||(h==null?void 0:h.set)!==void 0)throw new Error(`Observed property "${u}" cannot define a custom getter/setter. Use changed() for side effects instead.`);h===void 0&&Object.defineProperty(t.prototype,u,{configurable:!0,enumerable:!0,get(){return c(this,sr).get(u)},set(p){v(this,Ie,Fy).call(this,u,p)}})}const l={properties:i,observedAttributes:Object.keys(s),byAttr:o,byProp:a};return uc.set(t,l),l},sr=new WeakMap,rt=new WeakMap,Rt=new WeakMap,ri=new WeakMap,or=new WeakMap,ii=new WeakMap,Ie=new WeakSet,Xi=function(){return uc.get(this.constructor)},Fy=function(t,r){if(!c(this,ii)&&c(this,Rt).has(t))return;const i=c(this,sr).get(t);Object.is(i,r)||(c(this,rt).has(t)||c(this,rt).set(t,i),c(this,sr).set(t,r),c(this,Rt).delete(t),v(this,Ie,Zy).call(this,t,r),this.isConnected&&v(this,Ie,ta).call(this))},Zy=function(t,r){const i=v(this,Ie,Xi).call(this).byProp.get(t);if(!i)return;const{attribute:s,type:o}=i;if(o===Boolean){const l=this.hasAttribute(s);r&&!l?this.setAttribute(s,""):!r&&l&&this.removeAttribute(s);return}if(r==null){this.hasAttribute(s)&&this.removeAttribute(s);return}const a=String(r);this.getAttribute(s)!==a&&this.setAttribute(s,a)},Hy=function(){const t=this,r=v(this,Ie,Xi).call(this);for(const i of r.properties){if(!Cf.call(t,i))continue;const s=t[i];delete t[i],!(c(this,Rt).has(i)||c(this,sr).has(i))&&(t[i]=s)}E(this,ii,!0);try{for(const[i,s]of c(this,Rt))t[i]=s;c(this,Rt).clear()}finally{E(this,ii,!1)}},ta=function(){c(this,ri)||!this.isConnected||c(this,or)&&c(this,rt).size===0||(E(this,ri,!0),queueMicrotask(()=>{if(E(this,ri,!1),!this.isConnected||c(this,or)&&c(this,rt).size===0)return;const t=new Map(c(this,rt));c(this,rt).clear(),E(this,or,!0);try{this.changed(t)}catch(r){console.error(r)}this.isConnected&&c(this,rt).size>0&&v(this,Ie,ta).call(this)}))},w(Nn,Ns),b(Nn,"properties"),b(Nn,"attributes");let cs=Nn;/**
237
+ `;Re(s,this)};customElements.get("home-screen")||customElements.define("home-screen",wO);const ac=new WeakMap,kf=Object.prototype.hasOwnProperty,SO=(()=>{const n=new Set;let e=HTMLElement.prototype;for(;e;){for(const t of Object.getOwnPropertyNames(e))n.add(t);if(e===Node.prototype)break;e=Object.getPrototypeOf(e)}return n})();function _O(n,e){if(n===Boolean)return e!==null;if(e!==null)return n===Number?Number(e):e}var Ns,ou,sr,rt,Rt,ri,or,ii,Ie,Xi,Oy,Ly,zy,ta;const Nn=class Nn extends HTMLElement{constructor(){var i;super();w(this,Ie);w(this,sr,new Map);w(this,rt,new Map);w(this,Rt,new Map);w(this,ri,!1);w(this,or,!1);w(this,ii,!1);const t=v(i=Nn,Ns,ou).call(i,this.constructor),r=this;for(const s of t.properties)kf.call(r,s)&&(c(this,Rt).set(s,r[s]),delete r[s])}static get observedAttributes(){var t;return v(t=Nn,Ns,ou).call(t,this).observedAttributes}connected(){}disconnected(){}changed(t){}connectedCallback(){if(v(this,Ie,zy).call(this),!c(this,or))for(const t of v(this,Ie,Xi).call(this).properties)c(this,rt).has(t)||c(this,rt).set(t,void 0);this.dispatchEvent(new Event("reactive:connect")),this.connected(),v(this,Ie,ta).call(this)}disconnectedCallback(){this.dispatchEvent(new Event("reactive:disconnect")),this.disconnected()}attributeChangedCallback(t,r,i){if(r===i)return;const s=v(this,Ie,Xi).call(this).byAttr.get(t);s&&(c(this,Rt).has(s.property)||(this[s.property]=_O(s.type,i)))}};Ns=new WeakSet,ou=function(t){const r=ac.get(t);if(r)return r;const i=[...t.properties??[]],s=t.attributes??{},o=new Map,a=new Map;for(const u of i)if(SO.has(u))throw new Error(`Reactive property "${u}" collides with a built-in DOM property. Rename it to avoid shadowing the platform API.`);for(const[u,h]of Object.entries(s)){if(u.includes("-")&&h.property===void 0)throw new Error(`Attribute "${u}" must declare a "property" name because kebab-case cannot be a property.`);const p=h.property??u;if(!i.includes(p))throw new Error(`Attribute '${u}' references property '${p}', which isn't declared in \`static properties\`. Add it to \`properties\` to make it reactive.`);const g={attribute:u,property:p,type:h.type};o.set(u,g),a.set(p,g)}for(const u of i){const h=Object.getOwnPropertyDescriptor(t.prototype,u);if((h==null?void 0:h.get)!==void 0||(h==null?void 0:h.set)!==void 0)throw new Error(`Observed property "${u}" cannot define a custom getter/setter. Use changed() for side effects instead.`);h===void 0&&Object.defineProperty(t.prototype,u,{configurable:!0,enumerable:!0,get(){return c(this,sr).get(u)},set(p){v(this,Ie,Oy).call(this,u,p)}})}const l={properties:i,observedAttributes:Object.keys(s),byAttr:o,byProp:a};return ac.set(t,l),l},sr=new WeakMap,rt=new WeakMap,Rt=new WeakMap,ri=new WeakMap,or=new WeakMap,ii=new WeakMap,Ie=new WeakSet,Xi=function(){return ac.get(this.constructor)},Oy=function(t,r){if(!c(this,ii)&&c(this,Rt).has(t))return;const i=c(this,sr).get(t);Object.is(i,r)||(c(this,rt).has(t)||c(this,rt).set(t,i),c(this,sr).set(t,r),c(this,Rt).delete(t),v(this,Ie,Ly).call(this,t,r),this.isConnected&&v(this,Ie,ta).call(this))},Ly=function(t,r){const i=v(this,Ie,Xi).call(this).byProp.get(t);if(!i)return;const{attribute:s,type:o}=i;if(o===Boolean){const l=this.hasAttribute(s);r&&!l?this.setAttribute(s,""):!r&&l&&this.removeAttribute(s);return}if(r==null){this.hasAttribute(s)&&this.removeAttribute(s);return}const a=String(r);this.getAttribute(s)!==a&&this.setAttribute(s,a)},zy=function(){const t=this,r=v(this,Ie,Xi).call(this);for(const i of r.properties){if(!kf.call(t,i))continue;const s=t[i];delete t[i],!(c(this,Rt).has(i)||c(this,sr).has(i))&&(t[i]=s)}E(this,ii,!0);try{for(const[i,s]of c(this,Rt))t[i]=s;c(this,Rt).clear()}finally{E(this,ii,!1)}},ta=function(){c(this,ri)||!this.isConnected||c(this,or)&&c(this,rt).size===0||(E(this,ri,!0),queueMicrotask(()=>{if(E(this,ri,!1),!this.isConnected||c(this,or)&&c(this,rt).size===0)return;const t=new Map(c(this,rt));c(this,rt).clear(),E(this,or,!0);try{this.changed(t)}catch(r){console.error(r)}this.isConnected&&c(this,rt).size>0&&v(this,Ie,ta).call(this)}))},w(Nn,Ns),b(Nn,"properties"),b(Nn,"attributes");let cs=Nn;/**
238
238
  * @license
239
239
  * Copyright 2020 Google LLC
240
240
  * SPDX-License-Identifier: BSD-3-Clause
241
- */const TO=n=>n.strings===void 0;/**
241
+ */const kO=n=>n.strings===void 0;/**
242
242
  * @license
243
243
  * Copyright 2017 Google LLC
244
244
  * SPDX-License-Identifier: BSD-3-Clause
245
- */const rs=(n,e)=>{var r;const t=n._$AN;if(t===void 0)return!1;for(const i of t)(r=i._$AO)==null||r.call(i,e,!1),rs(i,e);return!0},ba=n=>{let e,t;do{if((e=n._$AM)===void 0)break;t=e._$AN,t.delete(n),n=e}while((t==null?void 0:t.size)===0)},By=n=>{for(let e;e=n._$AM;n=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(n))break;t.add(n),PO(e)}};function CO(n){this._$AN!==void 0?(ba(this),this._$AM=n,By(this)):this._$AM=n}function IO(n,e=!1,t=0){const r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(r))for(let s=t;s<r.length;s++)rs(r[s],!1),ba(r[s]);else r!=null&&(rs(r,!1),ba(r));else rs(this,n)}const PO=n=>{n.type==oy.CHILD&&(n._$AP??(n._$AP=IO),n._$AQ??(n._$AQ=CO))};class RO extends ay{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),By(this),this.isConnected=e._$AU}_$AO(e,t=!0){var r,i;e!==this.isConnected&&(this.isConnected=e,e?(r=this.reconnected)==null||r.call(this):(i=this.disconnected)==null||i.call(this)),t&&(rs(this,e),ba(this))}setValue(e){if(TO(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}/**
245
+ */const rs=(n,e)=>{var r;const t=n._$AN;if(t===void 0)return!1;for(const i of t)(r=i._$AO)==null||r.call(i,e,!1),rs(i,e);return!0},ba=n=>{let e,t;do{if((e=n._$AM)===void 0)break;t=e._$AN,t.delete(n),n=e}while((t==null?void 0:t.size)===0)},My=n=>{for(let e;e=n._$AM;n=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(n))break;t.add(n),AO(e)}};function EO(n){this._$AN!==void 0?(ba(this),this._$AM=n,My(this)):this._$AM=n}function xO(n,e=!1,t=0){const r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(r))for(let s=t;s<r.length;s++)rs(r[s],!1),ba(r[s]);else r!=null&&(rs(r,!1),ba(r));else rs(this,n)}const AO=n=>{n.type==ey.CHILD&&(n._$AP??(n._$AP=xO),n._$AQ??(n._$AQ=EO))};class $O extends ty{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),My(this),this.isConnected=e._$AU}_$AO(e,t=!0){var r,i;e!==this.isConnected&&(this.isConnected=e,e?(r=this.reconnected)==null||r.call(this):(i=this.disconnected)==null||i.call(this)),t&&(rs(this,e),ba(this))}setValue(e){if(kO(this._$Ct))this._$Ct._$AI(e,this);else{const t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}/**
246
246
  * @license
247
247
  * Copyright 2020 Google LLC
248
248
  * SPDX-License-Identifier: BSD-3-Clause
249
- */const Lo=()=>new DO;class DO{}const hc=new WeakMap,zo=hh(class extends RO{render(n){return se}update(n,[e]){var r;const t=e!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=e,this.ht=(r=n.options)==null?void 0:r.host,this.rt(this.ct=n.element)),se}rt(n){if(this.isConnected||(n=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let t=hc.get(e);t===void 0&&(t=new WeakMap,hc.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,n),n!==void 0&&this.G.call(this.ht,n)}else this.G.value=n}get lt(){var n,e;return typeof this.G=="function"?(n=hc.get(this.ht??globalThis))==null?void 0:n.get(this.G):(e=this.G)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var Ve,pn,si,oi,Us,ar,lr,ie,Pe,Gy,Fs,Zs,uu,hu,Ca,Ia,Pa,Ra,Da,Oa,La,za,Hs,Bs,Ki,Vy,gt;class OO extends cs{constructor(){super(...arguments);w(this,Pe);w(this,Ve,qe.resolve("ScreenManager"));w(this,pn,null);w(this,si,new DisposableStack);w(this,oi,Lo());w(this,Us,Lo());w(this,ar,Lo());w(this,lr,Lo());w(this,ie,{kind:"none"});w(this,Fs,()=>{v(this,Pe,uu).call(this),c(this,gt).call(this)});w(this,Zs,()=>{c(this,gt).call(this)});w(this,Ca,()=>{c(this,Ve).clearActive()});w(this,Ia,()=>{const t=c(this,Ve).activeScreen;t&&t.setStarred(!t.starred)});w(this,Pa,t=>{c(this,ie).kind!=="none"&&(t.stopImmediatePropagation(),v(this,Pe,Ki).call(this))});w(this,Ra,()=>{var r;const t=c(this,Ve).activeScreen;t&&((r=c(this,oi).value)==null||r.close(),E(this,ie,{kind:"rename",draft:t.name}),c(this,gt).call(this))});w(this,Da,()=>{var t;c(this,Ve).activeScreen&&((t=c(this,oi).value)==null||t.close(),E(this,ie,{kind:"delete",error:null}),c(this,gt).call(this))});w(this,Oa,t=>{if(c(this,ie).kind!=="rename")return;const r=t.target;r instanceof HTMLInputElement&&E(this,ie,{kind:"rename",draft:r.value})});w(this,La,t=>{if(t.preventDefault(),c(this,ie).kind!=="rename")return;const r=c(this,Ve).activeScreen;if(!r)return;const i=c(this,ie).draft.trim();i.length>0&&i!==r.name&&r.rename(i),v(this,Pe,Ki).call(this)});w(this,za,async()=>{if(c(this,ie).kind!=="delete")return;const t=c(this,Ve).activeScreen;if(t){E(this,ie,{kind:"delete",error:null});try{await t.remove(),c(this,Ve).clearActive(),v(this,Pe,Ki).call(this)}catch(r){E(this,ie,{kind:"delete",error:r instanceof Error?r.message:"Failed to delete screen."}),c(this,gt).call(this)}}});w(this,Hs,()=>{v(this,Pe,Ki).call(this)});w(this,Bs,()=>{c(this,ie).kind!=="none"&&(E(this,ie,{kind:"none"}),c(this,gt).call(this))});w(this,gt,()=>{const t=N`
249
+ */const Lo=()=>new TO;class TO{}const lc=new WeakMap,zo=lh(class extends $O{render(n){return se}update(n,[e]){var r;const t=e!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=e,this.ht=(r=n.options)==null?void 0:r.host,this.rt(this.ct=n.element)),se}rt(n){if(this.isConnected||(n=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let t=lc.get(e);t===void 0&&(t=new WeakMap,lc.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,n),n!==void 0&&this.G.call(this.ht,n)}else this.G.value=n}get lt(){var n,e;return typeof this.G=="function"?(n=lc.get(this.ht??globalThis))==null?void 0:n.get(this.G):(e=this.G)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var Ve,pn,si,oi,Us,ar,lr,ie,Pe,Ny,Fs,Zs,au,lu,Ca,Ia,Pa,Ra,Da,Oa,La,za,Hs,Bs,Ki,Uy,gt;class CO extends cs{constructor(){super(...arguments);w(this,Pe);w(this,Ve,qe.resolve("ScreenManager"));w(this,pn,null);w(this,si,new DisposableStack);w(this,oi,Lo());w(this,Us,Lo());w(this,ar,Lo());w(this,lr,Lo());w(this,ie,{kind:"none"});w(this,Fs,()=>{v(this,Pe,au).call(this),c(this,gt).call(this)});w(this,Zs,()=>{c(this,gt).call(this)});w(this,Ca,()=>{c(this,Ve).clearActive()});w(this,Ia,()=>{const t=c(this,Ve).activeScreen;t&&t.setStarred(!t.starred)});w(this,Pa,t=>{c(this,ie).kind!=="none"&&(t.stopImmediatePropagation(),v(this,Pe,Ki).call(this))});w(this,Ra,()=>{var r;const t=c(this,Ve).activeScreen;t&&((r=c(this,oi).value)==null||r.close(),E(this,ie,{kind:"rename",draft:t.name}),c(this,gt).call(this))});w(this,Da,()=>{var t;c(this,Ve).activeScreen&&((t=c(this,oi).value)==null||t.close(),E(this,ie,{kind:"delete",error:null}),c(this,gt).call(this))});w(this,Oa,t=>{if(c(this,ie).kind!=="rename")return;const r=t.target;r instanceof HTMLInputElement&&E(this,ie,{kind:"rename",draft:r.value})});w(this,La,t=>{if(t.preventDefault(),c(this,ie).kind!=="rename")return;const r=c(this,Ve).activeScreen;if(!r)return;const i=c(this,ie).draft.trim();i.length>0&&i!==r.name&&r.rename(i),v(this,Pe,Ki).call(this)});w(this,za,async()=>{if(c(this,ie).kind!=="delete")return;const t=c(this,Ve).activeScreen;if(t){E(this,ie,{kind:"delete",error:null});try{await t.remove(),c(this,Ve).clearActive(),v(this,Pe,Ki).call(this)}catch(r){E(this,ie,{kind:"delete",error:r instanceof Error?r.message:"Failed to delete screen."}),c(this,gt).call(this)}}});w(this,Hs,()=>{v(this,Pe,Ki).call(this)});w(this,Bs,()=>{c(this,ie).kind!=="none"&&(E(this,ie,{kind:"none"}),c(this,gt).call(this))});w(this,gt,()=>{const t=N`
250
250
  <button
251
251
  icon-only
252
252
  variant="ghost"
@@ -255,11 +255,11 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
255
255
  aria-label="Home"
256
256
  @click=${c(this,Ca)}
257
257
  >
258
- ${uD({weight:"fill"})}
258
+ ${sD({weight:"fill"})}
259
259
  </button>
260
- `;Re(N`${t}${v(this,Pe,Vy).call(this)}`,this);const r=c(this,Us).value??null;c(this,ar).value&&(c(this,ar).value.anchor=r),c(this,lr).value&&(c(this,lr).value.anchor=r)})}connected(){c(this,Ve).addEventListener("active-screen-changed",c(this,Fs)),v(this,Pe,uu).call(this),c(this,gt).call(this),v(this,Pe,Gy).call(this),c(this,si).defer(()=>{c(this,Ve).removeEventListener("active-screen-changed",c(this,Fs)),v(this,Pe,hu).call(this)})}disconnected(){c(this,si).dispose(),E(this,si,new DisposableStack)}}Ve=new WeakMap,pn=new WeakMap,si=new WeakMap,oi=new WeakMap,Us=new WeakMap,ar=new WeakMap,lr=new WeakMap,ie=new WeakMap,Pe=new WeakSet,Gy=async function(){const t=await ch(this);this.setAttribute("tone",t)},Fs=new WeakMap,Zs=new WeakMap,uu=function(){var r;const t=c(this,Ve).activeScreen;c(this,pn)!==t&&(v(this,Pe,hu).call(this),E(this,pn,t),(r=c(this,pn))==null||r.addEventListener("change",c(this,Zs)))},hu=function(){var t;(t=c(this,pn))==null||t.removeEventListener("change",c(this,Zs)),E(this,pn,null)},Ca=new WeakMap,Ia=new WeakMap,Pa=new WeakMap,Ra=new WeakMap,Da=new WeakMap,Oa=new WeakMap,La=new WeakMap,za=new WeakMap,Hs=new WeakMap,Bs=new WeakMap,Ki=function(){const t=c(this,ie).kind==="rename"?c(this,ar).value:c(this,ie).kind==="delete"?c(this,lr).value:null;t&&(t.open=!1),E(this,ie,{kind:"none"}),c(this,gt).call(this)},Vy=function(){const t=c(this,Ve).activeScreen;if(!t)return null;const r=c(this,ie).kind==="rename"?c(this,ie).draft:"",i=c(this,ie).kind==="delete"?c(this,ie).error:null;return N`
260
+ `;Re(N`${t}${v(this,Pe,Uy).call(this)}`,this);const r=c(this,Us).value??null;c(this,ar).value&&(c(this,ar).value.anchor=r),c(this,lr).value&&(c(this,lr).value.anchor=r)})}connected(){c(this,Ve).addEventListener("active-screen-changed",c(this,Fs)),v(this,Pe,au).call(this),c(this,gt).call(this),v(this,Pe,Ny).call(this),c(this,si).defer(()=>{c(this,Ve).removeEventListener("active-screen-changed",c(this,Fs)),v(this,Pe,lu).call(this)})}disconnected(){c(this,si).dispose(),E(this,si,new DisposableStack)}}Ve=new WeakMap,pn=new WeakMap,si=new WeakMap,oi=new WeakMap,Us=new WeakMap,ar=new WeakMap,lr=new WeakMap,ie=new WeakMap,Pe=new WeakSet,Ny=async function(){const t=await oh(this);this.setAttribute("tone",t)},Fs=new WeakMap,Zs=new WeakMap,au=function(){var r;const t=c(this,Ve).activeScreen;c(this,pn)!==t&&(v(this,Pe,lu).call(this),E(this,pn,t),(r=c(this,pn))==null||r.addEventListener("change",c(this,Zs)))},lu=function(){var t;(t=c(this,pn))==null||t.removeEventListener("change",c(this,Zs)),E(this,pn,null)},Ca=new WeakMap,Ia=new WeakMap,Pa=new WeakMap,Ra=new WeakMap,Da=new WeakMap,Oa=new WeakMap,La=new WeakMap,za=new WeakMap,Hs=new WeakMap,Bs=new WeakMap,Ki=function(){const t=c(this,ie).kind==="rename"?c(this,ar).value:c(this,ie).kind==="delete"?c(this,lr).value:null;t&&(t.open=!1),E(this,ie,{kind:"none"}),c(this,gt).call(this)},Uy=function(){const t=c(this,Ve).activeScreen;if(!t)return null;const r=c(this,ie).kind==="rename"?c(this,ie).draft:"",i=c(this,ie).kind==="delete"?c(this,ie).error:null;return N`
261
261
  <span class="separator" aria-hidden="true">
262
- ${aD()}
262
+ ${nD()}
263
263
  </span>
264
264
  <dropdown-menu ${zo(c(this,oi))}>
265
265
  <button
@@ -275,10 +275,10 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
275
275
  </button>
276
276
  <dropdown-group>
277
277
  <dropdown-item action @click=${c(this,Ra)}>
278
- ${hD()} Rename
278
+ ${oD()} Rename
279
279
  </dropdown-item>
280
280
  <dropdown-item action danger @click=${c(this,Da)}>
281
- ${dD()} Delete
281
+ ${aD()} Delete
282
282
  </dropdown-item>
283
283
  </dropdown-group>
284
284
  </dropdown-menu>
@@ -333,9 +333,9 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
333
333
  ?data-starred=${t.starred}
334
334
  @click=${c(this,Ia)}
335
335
  >
336
- ${t.starred?jc({weight:"fill"}):jc()}
336
+ ${t.starred?Gc({weight:"fill"}):Gc()}
337
337
  </button>
338
- `},gt=new WeakMap;customElements.define("screen-breadcrumb",OO);var Ma,Na,ai,Sn,Wy,jy,Ua,qy;class LO extends HTMLElement{constructor(){super(...arguments);w(this,Sn);w(this,Ma,qe.resolve("ServerManager"));w(this,Na,qe.resolve("ScreenManager"));w(this,ai,!1);w(this,Ua,async()=>{if(c(this,ai))return;const t=v(this,Sn,jy).call(this);if(t){E(this,ai,!0);try{const r=await t.createScreen(zO(new Date));c(this,Na).setActive(t.url,r.id)}catch{}finally{E(this,ai,!1)}}})}connectedCallback(){v(this,Sn,qy).call(this),v(this,Sn,Wy).call(this)}}Ma=new WeakMap,Na=new WeakMap,ai=new WeakMap,Sn=new WeakSet,Wy=async function(){const t=await ch(this);this.setAttribute("tone",t)},jy=function(){for(const t of c(this,Ma).servers.values())return t;return null},Ua=new WeakMap,qy=function(){Re(N`
338
+ `},gt=new WeakMap;customElements.define("screen-breadcrumb",CO);var Ma,Na,ai,Sn,Fy,Zy,Ua,Hy;class IO extends HTMLElement{constructor(){super(...arguments);w(this,Sn);w(this,Ma,qe.resolve("ServerManager"));w(this,Na,qe.resolve("ScreenManager"));w(this,ai,!1);w(this,Ua,async()=>{if(c(this,ai))return;const t=v(this,Sn,Zy).call(this);if(t){E(this,ai,!0);try{const r=await t.createScreen(PO(new Date));c(this,Na).setActive(t.url,r.id)}catch{}finally{E(this,ai,!1)}}})}connectedCallback(){v(this,Sn,Hy).call(this),v(this,Sn,Fy).call(this)}}Ma=new WeakMap,Na=new WeakMap,ai=new WeakMap,Sn=new WeakSet,Fy=async function(){const t=await oh(this);this.setAttribute("tone",t)},Zy=function(){for(const t of c(this,Ma).servers.values())return t;return null},Ua=new WeakMap,Hy=function(){Re(N`
339
339
  <button
340
340
  icon-only
341
341
  variant="ghost"
@@ -344,14 +344,14 @@ ${r.documentElement.outerHTML}`],{type:"text/html"});return URL.createObjectURL(
344
344
  aria-label="New screen"
345
345
  @click=${c(this,Ua)}
346
346
  >
347
- ${cD({size:16,weight:"bold"})}
347
+ ${iD({size:16,weight:"bold"})}
348
348
  </button>
349
- `,this)};function zO(n){const e=n.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"}),t=12,r=n.getHours(),i=r%t===0?t:r%t,s=n.getMinutes().toString().padStart(2,"0"),o=r>=t?"pm":"am";return`${e} at ${i}:${s}${o}`}customElements.define("screen-create-button",LO);function MO(n,e){let t=null;const r=()=>e((t==null?void 0:t.messages)??[]),i=()=>{const o=n.getActiveClient();o!==t&&(t==null||t.removeEventListener("change",r),t=o,t&&(t.addEventListener("change",r),t.connect().catch(a=>{console.error("ACPClient.connect() failed",a)})),r())};n.addEventListener("change",i),i();const s=()=>{n.removeEventListener("change",i),t==null||t.removeEventListener("change",r),t=null};return{dispose:s,[Symbol.dispose](){s()}}}/*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */const{entries:Yy,setPrototypeOf:If,isFrozen:NO,getPrototypeOf:UO,getOwnPropertyDescriptor:FO}=Object;let{freeze:Ue,seal:at,create:na}=Object,{apply:du,construct:pu}=typeof Reflect<"u"&&Reflect;Ue||(Ue=function(e){return e});at||(at=function(e){return e});du||(du=function(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];return e.apply(t,i)});pu||(pu=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return new e(...r)});const Mo=Fe(Array.prototype.forEach),ZO=Fe(Array.prototype.lastIndexOf),Pf=Fe(Array.prototype.pop),zi=Fe(Array.prototype.push),HO=Fe(Array.prototype.splice),ra=Fe(String.prototype.toLowerCase),dc=Fe(String.prototype.toString),pc=Fe(String.prototype.match),Mi=Fe(String.prototype.replace),BO=Fe(String.prototype.indexOf),GO=Fe(String.prototype.trim),Xe=Fe(Object.prototype.hasOwnProperty),Le=Fe(RegExp.prototype.test),Ni=VO(TypeError);function Fe(n){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return du(n,e,r)}}function VO(n){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return pu(n,t)}}function G(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ra;If&&If(n,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const s=t(i);s!==i&&(NO(e)||(e[r]=s),i=s)}n[i]=!0}return n}function WO(n){for(let e=0;e<n.length;e++)Xe(n,e)||(n[e]=null);return n}function xt(n){const e=na(null);for(const[t,r]of Yy(n))Xe(n,t)&&(Array.isArray(r)?e[t]=WO(r):r&&typeof r=="object"&&r.constructor===Object?e[t]=xt(r):e[t]=r);return e}function Ui(n,e){for(;n!==null;){const r=FO(n,e);if(r){if(r.get)return Fe(r.get);if(typeof r.value=="function")return Fe(r.value)}n=UO(n)}function t(){return null}return t}const Rf=Ue(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),fc=Ue(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),gc=Ue(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),jO=Ue(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),mc=Ue(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),qO=Ue(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Df=Ue(["#text"]),Of=Ue(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),vc=Ue(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Lf=Ue(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),No=Ue(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),YO=at(/\{\{[\w\W]*|[\w\W]*\}\}/gm),XO=at(/<%[\w\W]*|[\w\W]*%>/gm),KO=at(/\$\{[\w\W]*/gm),JO=at(/^data-[\-\w.\u00B7-\uFFFF]+$/),QO=at(/^aria-[\-\w]+$/),Xy=at(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),eL=at(/^(?:\w+script|data):/i),tL=at(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ky=at(/^html$/i),nL=at(/^[a-z][.\w]*(-[.\w]+)+$/i);var zf=Object.freeze({__proto__:null,ARIA_ATTR:QO,ATTR_WHITESPACE:tL,CUSTOM_ELEMENT:nL,DATA_ATTR:JO,DOCTYPE_NAME:Ky,ERB_EXPR:XO,IS_ALLOWED_URI:Xy,IS_SCRIPT_OR_DATA:eL,MUSTACHE_EXPR:YO,TMPLIT_EXPR:KO});const Fi={element:1,text:3,progressingInstruction:7,comment:8,document:9},rL=function(){return typeof window>"u"?null:window},iL=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(r=t.getAttribute(i));const s="dompurify"+(r?"#"+r:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Mf=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Jy(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:rL();const e=M=>Jy(M);if(e.version="3.3.3",e.removed=[],!n||!n.document||n.document.nodeType!==Fi.document||!n.Element)return e.isSupported=!1,e;let{document:t}=n;const r=t,i=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:u,NamedNodeMap:h=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:p,DOMParser:g,trustedTypes:m}=n,A=l.prototype,k=Ui(A,"cloneNode"),I=Ui(A,"remove"),U=Ui(A,"nextSibling"),P=Ui(A,"childNodes"),V=Ui(A,"parentNode");if(typeof o=="function"){const M=t.createElement("template");M.content&&M.content.ownerDocument&&(t=M.content.ownerDocument)}let O,H="";const{implementation:F,createNodeIterator:ce,createDocumentFragment:ue,getElementsByTagName:Ti}=t,{importNode:uo}=r;let xe=Mf();e.isSupported=typeof Yy=="function"&&typeof V=="function"&&F&&F.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:An,ERB_EXPR:wt,TMPLIT_EXPR:nn,DATA_ATTR:cl,ARIA_ATTR:ho,IS_SCRIPT_OR_DATA:gb,ATTR_WHITESPACE:xh,CUSTOM_ELEMENT:mb}=zf;let{IS_ALLOWED_URI:Ah}=zf,_e=null;const $h=G({},[...Rf,...fc,...gc,...mc,...Df]);let Ae=null;const Th=G({},[...Of,...vc,...Lf,...No]);let me=Object.seal(na(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ci=null,po=null;const rn=Object.seal(na(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ch=!0,ul=!0,Ih=!1,Ph=!0,Sr=!1,fo=!0,$n=!1,hl=!1,dl=!1,_r=!1,go=!1,mo=!1,Rh=!0,Dh=!1;const vb="user-content-";let pl=!0,Ii=!1,kr={},St=null;const fl=G({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Oh=null;const Lh=G({},["audio","video","img","source","image","track"]);let gl=null;const zh=G({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),vo="http://www.w3.org/1998/Math/MathML",yo="http://www.w3.org/2000/svg",zt="http://www.w3.org/1999/xhtml";let Er=zt,ml=!1,vl=null;const yb=G({},[vo,yo,zt],dc);let bo=G({},["mi","mo","mn","ms","mtext"]),wo=G({},["annotation-xml"]);const bb=G({},["title","style","font","a","script"]);let Pi=null;const wb=["application/xhtml+xml","text/html"],Sb="text/html";let be=null,xr=null;const _b=t.createElement("form"),Mh=function(y){return y instanceof RegExp||y instanceof Function},yl=function(){let y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(xr&&xr===y)){if((!y||typeof y!="object")&&(y={}),y=xt(y),Pi=wb.indexOf(y.PARSER_MEDIA_TYPE)===-1?Sb:y.PARSER_MEDIA_TYPE,be=Pi==="application/xhtml+xml"?dc:ra,_e=Xe(y,"ALLOWED_TAGS")?G({},y.ALLOWED_TAGS,be):$h,Ae=Xe(y,"ALLOWED_ATTR")?G({},y.ALLOWED_ATTR,be):Th,vl=Xe(y,"ALLOWED_NAMESPACES")?G({},y.ALLOWED_NAMESPACES,dc):yb,gl=Xe(y,"ADD_URI_SAFE_ATTR")?G(xt(zh),y.ADD_URI_SAFE_ATTR,be):zh,Oh=Xe(y,"ADD_DATA_URI_TAGS")?G(xt(Lh),y.ADD_DATA_URI_TAGS,be):Lh,St=Xe(y,"FORBID_CONTENTS")?G({},y.FORBID_CONTENTS,be):fl,Ci=Xe(y,"FORBID_TAGS")?G({},y.FORBID_TAGS,be):xt({}),po=Xe(y,"FORBID_ATTR")?G({},y.FORBID_ATTR,be):xt({}),kr=Xe(y,"USE_PROFILES")?y.USE_PROFILES:!1,Ch=y.ALLOW_ARIA_ATTR!==!1,ul=y.ALLOW_DATA_ATTR!==!1,Ih=y.ALLOW_UNKNOWN_PROTOCOLS||!1,Ph=y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Sr=y.SAFE_FOR_TEMPLATES||!1,fo=y.SAFE_FOR_XML!==!1,$n=y.WHOLE_DOCUMENT||!1,_r=y.RETURN_DOM||!1,go=y.RETURN_DOM_FRAGMENT||!1,mo=y.RETURN_TRUSTED_TYPE||!1,dl=y.FORCE_BODY||!1,Rh=y.SANITIZE_DOM!==!1,Dh=y.SANITIZE_NAMED_PROPS||!1,pl=y.KEEP_CONTENT!==!1,Ii=y.IN_PLACE||!1,Ah=y.ALLOWED_URI_REGEXP||Xy,Er=y.NAMESPACE||zt,bo=y.MATHML_TEXT_INTEGRATION_POINTS||bo,wo=y.HTML_INTEGRATION_POINTS||wo,me=y.CUSTOM_ELEMENT_HANDLING||{},y.CUSTOM_ELEMENT_HANDLING&&Mh(y.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(me.tagNameCheck=y.CUSTOM_ELEMENT_HANDLING.tagNameCheck),y.CUSTOM_ELEMENT_HANDLING&&Mh(y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(me.attributeNameCheck=y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),y.CUSTOM_ELEMENT_HANDLING&&typeof y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(me.allowCustomizedBuiltInElements=y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Sr&&(ul=!1),go&&(_r=!0),kr&&(_e=G({},Df),Ae=na(null),kr.html===!0&&(G(_e,Rf),G(Ae,Of)),kr.svg===!0&&(G(_e,fc),G(Ae,vc),G(Ae,No)),kr.svgFilters===!0&&(G(_e,gc),G(Ae,vc),G(Ae,No)),kr.mathMl===!0&&(G(_e,mc),G(Ae,Lf),G(Ae,No))),Xe(y,"ADD_TAGS")||(rn.tagCheck=null),Xe(y,"ADD_ATTR")||(rn.attributeCheck=null),y.ADD_TAGS&&(typeof y.ADD_TAGS=="function"?rn.tagCheck=y.ADD_TAGS:(_e===$h&&(_e=xt(_e)),G(_e,y.ADD_TAGS,be))),y.ADD_ATTR&&(typeof y.ADD_ATTR=="function"?rn.attributeCheck=y.ADD_ATTR:(Ae===Th&&(Ae=xt(Ae)),G(Ae,y.ADD_ATTR,be))),y.ADD_URI_SAFE_ATTR&&G(gl,y.ADD_URI_SAFE_ATTR,be),y.FORBID_CONTENTS&&(St===fl&&(St=xt(St)),G(St,y.FORBID_CONTENTS,be)),y.ADD_FORBID_CONTENTS&&(St===fl&&(St=xt(St)),G(St,y.ADD_FORBID_CONTENTS,be)),pl&&(_e["#text"]=!0),$n&&G(_e,["html","head","body"]),_e.table&&(G(_e,["tbody"]),delete Ci.tbody),y.TRUSTED_TYPES_POLICY){if(typeof y.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ni('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ni('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');O=y.TRUSTED_TYPES_POLICY,H=O.createHTML("")}else O===void 0&&(O=iL(m,i)),O!==null&&typeof H=="string"&&(H=O.createHTML(""));Ue&&Ue(y),xr=y}},Nh=G({},[...fc,...gc,...jO]),Uh=G({},[...mc,...qO]),kb=function(y){let C=V(y);(!C||!C.tagName)&&(C={namespaceURI:Er,tagName:"template"});const R=ra(y.tagName),oe=ra(C.tagName);return vl[y.namespaceURI]?y.namespaceURI===yo?C.namespaceURI===zt?R==="svg":C.namespaceURI===vo?R==="svg"&&(oe==="annotation-xml"||bo[oe]):!!Nh[R]:y.namespaceURI===vo?C.namespaceURI===zt?R==="math":C.namespaceURI===yo?R==="math"&&wo[oe]:!!Uh[R]:y.namespaceURI===zt?C.namespaceURI===yo&&!wo[oe]||C.namespaceURI===vo&&!bo[oe]?!1:!Uh[R]&&(bb[R]||!Nh[R]):!!(Pi==="application/xhtml+xml"&&vl[y.namespaceURI]):!1},_t=function(y){zi(e.removed,{element:y});try{V(y).removeChild(y)}catch{I(y)}},Tn=function(y,C){try{zi(e.removed,{attribute:C.getAttributeNode(y),from:C})}catch{zi(e.removed,{attribute:null,from:C})}if(C.removeAttribute(y),y==="is")if(_r||go)try{_t(C)}catch{}else try{C.setAttribute(y,"")}catch{}},Fh=function(y){let C=null,R=null;if(dl)y="<remove></remove>"+y;else{const ve=pc(y,/^[\r\n\t ]+/);R=ve&&ve[0]}Pi==="application/xhtml+xml"&&Er===zt&&(y='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+y+"</body></html>");const oe=O?O.createHTML(y):y;if(Er===zt)try{C=new g().parseFromString(oe,Pi)}catch{}if(!C||!C.documentElement){C=F.createDocument(Er,"template",null);try{C.documentElement.innerHTML=ml?H:oe}catch{}}const De=C.body||C.documentElement;return y&&R&&De.insertBefore(t.createTextNode(R),De.childNodes[0]||null),Er===zt?Ti.call(C,$n?"html":"body")[0]:$n?C.documentElement:De},Zh=function(y){return ce.call(y.ownerDocument||y,y,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},bl=function(y){return y instanceof p&&(typeof y.nodeName!="string"||typeof y.textContent!="string"||typeof y.removeChild!="function"||!(y.attributes instanceof h)||typeof y.removeAttribute!="function"||typeof y.setAttribute!="function"||typeof y.namespaceURI!="string"||typeof y.insertBefore!="function"||typeof y.hasChildNodes!="function")},Hh=function(y){return typeof a=="function"&&y instanceof a};function Mt(M,y,C){Mo(M,R=>{R.call(e,y,C,xr)})}const Bh=function(y){let C=null;if(Mt(xe.beforeSanitizeElements,y,null),bl(y))return _t(y),!0;const R=be(y.nodeName);if(Mt(xe.uponSanitizeElement,y,{tagName:R,allowedTags:_e}),fo&&y.hasChildNodes()&&!Hh(y.firstElementChild)&&Le(/<[/\w!]/g,y.innerHTML)&&Le(/<[/\w!]/g,y.textContent)||y.nodeType===Fi.progressingInstruction||fo&&y.nodeType===Fi.comment&&Le(/<[/\w]/g,y.data))return _t(y),!0;if(!(rn.tagCheck instanceof Function&&rn.tagCheck(R))&&(!_e[R]||Ci[R])){if(!Ci[R]&&Vh(R)&&(me.tagNameCheck instanceof RegExp&&Le(me.tagNameCheck,R)||me.tagNameCheck instanceof Function&&me.tagNameCheck(R)))return!1;if(pl&&!St[R]){const oe=V(y)||y.parentNode,De=P(y)||y.childNodes;if(De&&oe){const ve=De.length;for(let Ze=ve-1;Ze>=0;--Ze){const Nt=k(De[Ze],!0);Nt.__removalCount=(y.__removalCount||0)+1,oe.insertBefore(Nt,U(y))}}}return _t(y),!0}return y instanceof l&&!kb(y)||(R==="noscript"||R==="noembed"||R==="noframes")&&Le(/<\/no(script|embed|frames)/i,y.innerHTML)?(_t(y),!0):(Sr&&y.nodeType===Fi.text&&(C=y.textContent,Mo([An,wt,nn],oe=>{C=Mi(C,oe," ")}),y.textContent!==C&&(zi(e.removed,{element:y.cloneNode()}),y.textContent=C)),Mt(xe.afterSanitizeElements,y,null),!1)},Gh=function(y,C,R){if(po[C]||Rh&&(C==="id"||C==="name")&&(R in t||R in _b))return!1;if(!(ul&&!po[C]&&Le(cl,C))){if(!(Ch&&Le(ho,C))){if(!(rn.attributeCheck instanceof Function&&rn.attributeCheck(C,y))){if(!Ae[C]||po[C]){if(!(Vh(y)&&(me.tagNameCheck instanceof RegExp&&Le(me.tagNameCheck,y)||me.tagNameCheck instanceof Function&&me.tagNameCheck(y))&&(me.attributeNameCheck instanceof RegExp&&Le(me.attributeNameCheck,C)||me.attributeNameCheck instanceof Function&&me.attributeNameCheck(C,y))||C==="is"&&me.allowCustomizedBuiltInElements&&(me.tagNameCheck instanceof RegExp&&Le(me.tagNameCheck,R)||me.tagNameCheck instanceof Function&&me.tagNameCheck(R))))return!1}else if(!gl[C]){if(!Le(Ah,Mi(R,xh,""))){if(!((C==="src"||C==="xlink:href"||C==="href")&&y!=="script"&&BO(R,"data:")===0&&Oh[y])){if(!(Ih&&!Le(gb,Mi(R,xh,"")))){if(R)return!1}}}}}}}return!0},Vh=function(y){return y!=="annotation-xml"&&pc(y,mb)},Wh=function(y){Mt(xe.beforeSanitizeAttributes,y,null);const{attributes:C}=y;if(!C||bl(y))return;const R={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ae,forceKeepAttr:void 0};let oe=C.length;for(;oe--;){const De=C[oe],{name:ve,namespaceURI:Ze,value:Nt}=De,Ar=be(ve),wl=Nt;let $e=ve==="value"?wl:GO(wl);if(R.attrName=Ar,R.attrValue=$e,R.keepAttr=!0,R.forceKeepAttr=void 0,Mt(xe.uponSanitizeAttribute,y,R),$e=R.attrValue,Dh&&(Ar==="id"||Ar==="name")&&(Tn(ve,y),$e=vb+$e),fo&&Le(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,$e)){Tn(ve,y);continue}if(Ar==="attributename"&&pc($e,"href")){Tn(ve,y);continue}if(R.forceKeepAttr)continue;if(!R.keepAttr){Tn(ve,y);continue}if(!Ph&&Le(/\/>/i,$e)){Tn(ve,y);continue}Sr&&Mo([An,wt,nn],qh=>{$e=Mi($e,qh," ")});const jh=be(y.nodeName);if(!Gh(jh,Ar,$e)){Tn(ve,y);continue}if(O&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!Ze)switch(m.getAttributeType(jh,Ar)){case"TrustedHTML":{$e=O.createHTML($e);break}case"TrustedScriptURL":{$e=O.createScriptURL($e);break}}if($e!==wl)try{Ze?y.setAttributeNS(Ze,ve,$e):y.setAttribute(ve,$e),bl(y)?_t(y):Pf(e.removed)}catch{Tn(ve,y)}}Mt(xe.afterSanitizeAttributes,y,null)},Eb=function M(y){let C=null;const R=Zh(y);for(Mt(xe.beforeSanitizeShadowDOM,y,null);C=R.nextNode();)Mt(xe.uponSanitizeShadowNode,C,null),Bh(C),Wh(C),C.content instanceof s&&M(C.content);Mt(xe.afterSanitizeShadowDOM,y,null)};return e.sanitize=function(M){let y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},C=null,R=null,oe=null,De=null;if(ml=!M,ml&&(M="<!-->"),typeof M!="string"&&!Hh(M))if(typeof M.toString=="function"){if(M=M.toString(),typeof M!="string")throw Ni("dirty is not a string, aborting")}else throw Ni("toString is not a function");if(!e.isSupported)return M;if(hl||yl(y),e.removed=[],typeof M=="string"&&(Ii=!1),Ii){if(M.nodeName){const Nt=be(M.nodeName);if(!_e[Nt]||Ci[Nt])throw Ni("root node is forbidden and cannot be sanitized in-place")}}else if(M instanceof a)C=Fh("<!---->"),R=C.ownerDocument.importNode(M,!0),R.nodeType===Fi.element&&R.nodeName==="BODY"||R.nodeName==="HTML"?C=R:C.appendChild(R);else{if(!_r&&!Sr&&!$n&&M.indexOf("<")===-1)return O&&mo?O.createHTML(M):M;if(C=Fh(M),!C)return _r?null:mo?H:""}C&&dl&&_t(C.firstChild);const ve=Zh(Ii?M:C);for(;oe=ve.nextNode();)Bh(oe),Wh(oe),oe.content instanceof s&&Eb(oe.content);if(Ii)return M;if(_r){if(go)for(De=ue.call(C.ownerDocument);C.firstChild;)De.appendChild(C.firstChild);else De=C;return(Ae.shadowroot||Ae.shadowrootmode)&&(De=uo.call(r,De,!0)),De}let Ze=$n?C.outerHTML:C.innerHTML;return $n&&_e["!doctype"]&&C.ownerDocument&&C.ownerDocument.doctype&&C.ownerDocument.doctype.name&&Le(Ky,C.ownerDocument.doctype.name)&&(Ze="<!DOCTYPE "+C.ownerDocument.doctype.name+`>
350
- `+Ze),Sr&&Mo([An,wt,nn],Nt=>{Ze=Mi(Ze,Nt," ")}),O&&mo?O.createHTML(Ze):Ze},e.setConfig=function(){let M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};yl(M),hl=!0},e.clearConfig=function(){xr=null,hl=!1},e.isValidAttribute=function(M,y,C){xr||yl({});const R=be(M),oe=be(y);return Gh(R,oe,C)},e.addHook=function(M,y){typeof y=="function"&&zi(xe[M],y)},e.removeHook=function(M,y){if(y!==void 0){const C=ZO(xe[M],y);return C===-1?void 0:HO(xe[M],C,1)[0]}return Pf(xe[M])},e.removeHooks=function(M){xe[M]=[]},e.removeAllHooks=function(){xe=Mf()},e}var Qy=Jy();function fh(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var wr=fh();function eb(n){wr=n}var Mn={exec:()=>null};function q(n,e=""){let t=typeof n=="string"?n:n.source,r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(Ne.caret,"$1"),t=t.replace(i,o),r},getRegex:()=>new RegExp(t,e)};return r}var sL=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Ne={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}>`)},oL=/^(?:[ \t]*(?:\n|$))+/,aL=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,lL=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,co=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,cL=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,gh=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,tb=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,nb=q(tb).replace(/bull/g,gh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),uL=q(tb).replace(/bull/g,gh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),mh=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,hL=/^[^\n]+/,vh=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,dL=q(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",vh).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),pL=q(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,gh).getRegex(),ol="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",yh=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,fL=q("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",yh).replace("tag",ol).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),rb=q(mh).replace("hr",co).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ol).getRegex(),gL=q(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",rb).getRegex(),bh={blockquote:gL,code:aL,def:dL,fences:lL,heading:cL,hr:co,html:fL,lheading:nb,list:pL,newline:oL,paragraph:rb,table:Mn,text:hL},Nf=q("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",co).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ol).getRegex(),mL={...bh,lheading:uL,table:Nf,paragraph:q(mh).replace("hr",co).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Nf).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ol).getRegex()},vL={...bh,html:q(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",yh).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Mn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:q(mh).replace("hr",co).replace("heading",` *#{1,6} *[^
351
- ]`).replace("lheading",nb).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},yL=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,bL=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ib=/^( {2,}|\\)\n(?!\s*$)/,wL=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,$i=/[\p{P}\p{S}]/u,al=/[\s\p{P}\p{S}]/u,wh=/[^\s\p{P}\p{S}]/u,SL=q(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,al).getRegex(),sb=/(?!~)[\p{P}\p{S}]/u,_L=/(?!~)[\s\p{P}\p{S}]/u,kL=/(?:[^\s\p{P}\p{S}]|~)/u,EL=q(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",sL?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ob=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,xL=q(ob,"u").replace(/punct/g,$i).getRegex(),AL=q(ob,"u").replace(/punct/g,sb).getRegex(),ab="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",$L=q(ab,"gu").replace(/notPunctSpace/g,wh).replace(/punctSpace/g,al).replace(/punct/g,$i).getRegex(),TL=q(ab,"gu").replace(/notPunctSpace/g,kL).replace(/punctSpace/g,_L).replace(/punct/g,sb).getRegex(),CL=q("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,wh).replace(/punctSpace/g,al).replace(/punct/g,$i).getRegex(),IL=q(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,$i).getRegex(),PL="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",RL=q(PL,"gu").replace(/notPunctSpace/g,wh).replace(/punctSpace/g,al).replace(/punct/g,$i).getRegex(),DL=q(/\\(punct)/,"gu").replace(/punct/g,$i).getRegex(),OL=q(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),LL=q(yh).replace("(?:-->|$)","-->").getRegex(),zL=q("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",LL).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),wa=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,ML=q(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",wa).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),lb=q(/^!?\[(label)\]\[(ref)\]/).replace("label",wa).replace("ref",vh).getRegex(),cb=q(/^!?\[(ref)\](?:\[\])?/).replace("ref",vh).getRegex(),NL=q("reflink|nolink(?!\\()","g").replace("reflink",lb).replace("nolink",cb).getRegex(),Uf=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Sh={_backpedal:Mn,anyPunctuation:DL,autolink:OL,blockSkip:EL,br:ib,code:bL,del:Mn,delLDelim:Mn,delRDelim:Mn,emStrongLDelim:xL,emStrongRDelimAst:$L,emStrongRDelimUnd:CL,escape:yL,link:ML,nolink:cb,punctuation:SL,reflink:lb,reflinkSearch:NL,tag:zL,text:wL,url:Mn},UL={...Sh,link:q(/^!?\[(label)\]\((.*?)\)/).replace("label",wa).getRegex(),reflink:q(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",wa).getRegex()},fu={...Sh,emStrongRDelimAst:TL,emStrongLDelim:AL,delLDelim:IL,delRDelim:RL,url:q(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Uf).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:q(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Uf).getRegex()},FL={...fu,br:q(ib).replace("{2,}","*").getRegex(),text:q(fu.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Uo={normal:bh,gfm:mL,pedantic:vL},Zi={normal:Sh,gfm:fu,breaks:FL,pedantic:UL},ZL={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Ff=n=>ZL[n];function At(n,e){if(e){if(Ne.escapeTest.test(n))return n.replace(Ne.escapeReplace,Ff)}else if(Ne.escapeTestNoEncode.test(n))return n.replace(Ne.escapeReplaceNoEncode,Ff);return n}function Zf(n){try{n=encodeURI(n).replace(Ne.percentDecode,"%")}catch{return null}return n}function Hf(n,e){var s;let t=n.replace(Ne.findPipe,(o,a,l)=>{let u=!1,h=a;for(;--h>=0&&l[h]==="\\";)u=!u;return u?"|":" |"}),r=t.split(Ne.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!((s=r.at(-1))!=null&&s.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(Ne.slashPipe,"|");return r}function Hi(n,e,t){let r=n.length;if(r===0)return"";let i=0;for(;i<r&&n.charAt(r-i-1)===e;)i++;return n.slice(0,r-i)}function HL(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let r=0;r<n.length;r++)if(n[r]==="\\")r++;else if(n[r]===e[0])t++;else if(n[r]===e[1]&&(t--,t<0))return r;return t>0?-2:-1}function BL(n,e=0){let t=e,r="";for(let i of n)if(i===" "){let s=4-t%4;r+=" ".repeat(s),t+=s}else r+=i,t++;return r}function Bf(n,e,t,r,i){let s=e.href,o=e.title||null,a=n[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:s,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}function GL(n,e,t){let r=n.match(t.other.indentCodeCompensation);if(r===null)return e;let i=r[1];return e.split(`
349
+ `,this)};function PO(n){const e=n.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"}),t=12,r=n.getHours(),i=r%t===0?t:r%t,s=n.getMinutes().toString().padStart(2,"0"),o=r>=t?"pm":"am";return`${e} at ${i}:${s}${o}`}customElements.define("screen-create-button",IO);function RO(n,e){let t=null;const r=()=>e((t==null?void 0:t.messages)??[]),i=()=>{const o=n.getActiveClient();o!==t&&(t==null||t.removeEventListener("change",r),t=o,t&&(t.addEventListener("change",r),t.connect().catch(a=>{console.error("ACPClient.connect() failed",a)})),r())};n.addEventListener("change",i),i();const s=()=>{n.removeEventListener("change",i),t==null||t.removeEventListener("change",r),t=null};return{dispose:s,[Symbol.dispose](){s()}}}/*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */const{entries:By,setPrototypeOf:Ef,isFrozen:DO,getPrototypeOf:OO,getOwnPropertyDescriptor:LO}=Object;let{freeze:Ue,seal:at,create:na}=Object,{apply:cu,construct:uu}=typeof Reflect<"u"&&Reflect;Ue||(Ue=function(e){return e});at||(at=function(e){return e});cu||(cu=function(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s<r;s++)i[s-2]=arguments[s];return e.apply(t,i)});uu||(uu=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return new e(...r)});const Mo=Fe(Array.prototype.forEach),zO=Fe(Array.prototype.lastIndexOf),xf=Fe(Array.prototype.pop),zi=Fe(Array.prototype.push),MO=Fe(Array.prototype.splice),ra=Fe(String.prototype.toLowerCase),cc=Fe(String.prototype.toString),uc=Fe(String.prototype.match),Mi=Fe(String.prototype.replace),NO=Fe(String.prototype.indexOf),UO=Fe(String.prototype.trim),Xe=Fe(Object.prototype.hasOwnProperty),Le=Fe(RegExp.prototype.test),Ni=FO(TypeError);function Fe(n){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return cu(n,e,r)}}function FO(n){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return uu(n,t)}}function G(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ra;Ef&&Ef(n,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const s=t(i);s!==i&&(DO(e)||(e[r]=s),i=s)}n[i]=!0}return n}function ZO(n){for(let e=0;e<n.length;e++)Xe(n,e)||(n[e]=null);return n}function xt(n){const e=na(null);for(const[t,r]of By(n))Xe(n,t)&&(Array.isArray(r)?e[t]=ZO(r):r&&typeof r=="object"&&r.constructor===Object?e[t]=xt(r):e[t]=r);return e}function Ui(n,e){for(;n!==null;){const r=LO(n,e);if(r){if(r.get)return Fe(r.get);if(typeof r.value=="function")return Fe(r.value)}n=OO(n)}function t(){return null}return t}const Af=Ue(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),hc=Ue(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),dc=Ue(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),HO=Ue(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),pc=Ue(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),BO=Ue(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),$f=Ue(["#text"]),Tf=Ue(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),fc=Ue(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Cf=Ue(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),No=Ue(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),GO=at(/\{\{[\w\W]*|[\w\W]*\}\}/gm),VO=at(/<%[\w\W]*|[\w\W]*%>/gm),WO=at(/\$\{[\w\W]*/gm),jO=at(/^data-[\-\w.\u00B7-\uFFFF]+$/),qO=at(/^aria-[\-\w]+$/),Gy=at(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),YO=at(/^(?:\w+script|data):/i),XO=at(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Vy=at(/^html$/i),KO=at(/^[a-z][.\w]*(-[.\w]+)+$/i);var If=Object.freeze({__proto__:null,ARIA_ATTR:qO,ATTR_WHITESPACE:XO,CUSTOM_ELEMENT:KO,DATA_ATTR:jO,DOCTYPE_NAME:Vy,ERB_EXPR:VO,IS_ALLOWED_URI:Gy,IS_SCRIPT_OR_DATA:YO,MUSTACHE_EXPR:GO,TMPLIT_EXPR:WO});const Fi={element:1,text:3,progressingInstruction:7,comment:8,document:9},JO=function(){return typeof window>"u"?null:window},QO=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(r=t.getAttribute(i));const s="dompurify"+(r?"#"+r:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Pf=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Wy(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:JO();const e=M=>Wy(M);if(e.version="3.3.3",e.removed=[],!n||!n.document||n.document.nodeType!==Fi.document||!n.Element)return e.isSupported=!1,e;let{document:t}=n;const r=t,i=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:u,NamedNodeMap:h=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:p,DOMParser:g,trustedTypes:m}=n,A=l.prototype,k=Ui(A,"cloneNode"),I=Ui(A,"remove"),U=Ui(A,"nextSibling"),P=Ui(A,"childNodes"),V=Ui(A,"parentNode");if(typeof o=="function"){const M=t.createElement("template");M.content&&M.content.ownerDocument&&(t=M.content.ownerDocument)}let O,H="";const{implementation:F,createNodeIterator:ce,createDocumentFragment:ue,getElementsByTagName:Ti}=t,{importNode:uo}=r;let xe=Pf();e.isSupported=typeof By=="function"&&typeof V=="function"&&F&&F.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:An,ERB_EXPR:wt,TMPLIT_EXPR:nn,DATA_ATTR:cl,ARIA_ATTR:ho,IS_SCRIPT_OR_DATA:cb,ATTR_WHITESPACE:_h,CUSTOM_ELEMENT:ub}=If;let{IS_ALLOWED_URI:kh}=If,_e=null;const Eh=G({},[...Af,...hc,...dc,...pc,...$f]);let Ae=null;const xh=G({},[...Tf,...fc,...Cf,...No]);let me=Object.seal(na(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ci=null,po=null;const rn=Object.seal(na(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ah=!0,ul=!0,$h=!1,Th=!0,Sr=!1,fo=!0,$n=!1,hl=!1,dl=!1,_r=!1,go=!1,mo=!1,Ch=!0,Ih=!1;const hb="user-content-";let pl=!0,Ii=!1,kr={},St=null;const fl=G({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ph=null;const Rh=G({},["audio","video","img","source","image","track"]);let gl=null;const Dh=G({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),vo="http://www.w3.org/1998/Math/MathML",yo="http://www.w3.org/2000/svg",zt="http://www.w3.org/1999/xhtml";let Er=zt,ml=!1,vl=null;const db=G({},[vo,yo,zt],cc);let bo=G({},["mi","mo","mn","ms","mtext"]),wo=G({},["annotation-xml"]);const pb=G({},["title","style","font","a","script"]);let Pi=null;const fb=["application/xhtml+xml","text/html"],gb="text/html";let be=null,xr=null;const mb=t.createElement("form"),Oh=function(y){return y instanceof RegExp||y instanceof Function},yl=function(){let y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(xr&&xr===y)){if((!y||typeof y!="object")&&(y={}),y=xt(y),Pi=fb.indexOf(y.PARSER_MEDIA_TYPE)===-1?gb:y.PARSER_MEDIA_TYPE,be=Pi==="application/xhtml+xml"?cc:ra,_e=Xe(y,"ALLOWED_TAGS")?G({},y.ALLOWED_TAGS,be):Eh,Ae=Xe(y,"ALLOWED_ATTR")?G({},y.ALLOWED_ATTR,be):xh,vl=Xe(y,"ALLOWED_NAMESPACES")?G({},y.ALLOWED_NAMESPACES,cc):db,gl=Xe(y,"ADD_URI_SAFE_ATTR")?G(xt(Dh),y.ADD_URI_SAFE_ATTR,be):Dh,Ph=Xe(y,"ADD_DATA_URI_TAGS")?G(xt(Rh),y.ADD_DATA_URI_TAGS,be):Rh,St=Xe(y,"FORBID_CONTENTS")?G({},y.FORBID_CONTENTS,be):fl,Ci=Xe(y,"FORBID_TAGS")?G({},y.FORBID_TAGS,be):xt({}),po=Xe(y,"FORBID_ATTR")?G({},y.FORBID_ATTR,be):xt({}),kr=Xe(y,"USE_PROFILES")?y.USE_PROFILES:!1,Ah=y.ALLOW_ARIA_ATTR!==!1,ul=y.ALLOW_DATA_ATTR!==!1,$h=y.ALLOW_UNKNOWN_PROTOCOLS||!1,Th=y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Sr=y.SAFE_FOR_TEMPLATES||!1,fo=y.SAFE_FOR_XML!==!1,$n=y.WHOLE_DOCUMENT||!1,_r=y.RETURN_DOM||!1,go=y.RETURN_DOM_FRAGMENT||!1,mo=y.RETURN_TRUSTED_TYPE||!1,dl=y.FORCE_BODY||!1,Ch=y.SANITIZE_DOM!==!1,Ih=y.SANITIZE_NAMED_PROPS||!1,pl=y.KEEP_CONTENT!==!1,Ii=y.IN_PLACE||!1,kh=y.ALLOWED_URI_REGEXP||Gy,Er=y.NAMESPACE||zt,bo=y.MATHML_TEXT_INTEGRATION_POINTS||bo,wo=y.HTML_INTEGRATION_POINTS||wo,me=y.CUSTOM_ELEMENT_HANDLING||{},y.CUSTOM_ELEMENT_HANDLING&&Oh(y.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(me.tagNameCheck=y.CUSTOM_ELEMENT_HANDLING.tagNameCheck),y.CUSTOM_ELEMENT_HANDLING&&Oh(y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(me.attributeNameCheck=y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),y.CUSTOM_ELEMENT_HANDLING&&typeof y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(me.allowCustomizedBuiltInElements=y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Sr&&(ul=!1),go&&(_r=!0),kr&&(_e=G({},$f),Ae=na(null),kr.html===!0&&(G(_e,Af),G(Ae,Tf)),kr.svg===!0&&(G(_e,hc),G(Ae,fc),G(Ae,No)),kr.svgFilters===!0&&(G(_e,dc),G(Ae,fc),G(Ae,No)),kr.mathMl===!0&&(G(_e,pc),G(Ae,Cf),G(Ae,No))),Xe(y,"ADD_TAGS")||(rn.tagCheck=null),Xe(y,"ADD_ATTR")||(rn.attributeCheck=null),y.ADD_TAGS&&(typeof y.ADD_TAGS=="function"?rn.tagCheck=y.ADD_TAGS:(_e===Eh&&(_e=xt(_e)),G(_e,y.ADD_TAGS,be))),y.ADD_ATTR&&(typeof y.ADD_ATTR=="function"?rn.attributeCheck=y.ADD_ATTR:(Ae===xh&&(Ae=xt(Ae)),G(Ae,y.ADD_ATTR,be))),y.ADD_URI_SAFE_ATTR&&G(gl,y.ADD_URI_SAFE_ATTR,be),y.FORBID_CONTENTS&&(St===fl&&(St=xt(St)),G(St,y.FORBID_CONTENTS,be)),y.ADD_FORBID_CONTENTS&&(St===fl&&(St=xt(St)),G(St,y.ADD_FORBID_CONTENTS,be)),pl&&(_e["#text"]=!0),$n&&G(_e,["html","head","body"]),_e.table&&(G(_e,["tbody"]),delete Ci.tbody),y.TRUSTED_TYPES_POLICY){if(typeof y.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ni('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ni('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');O=y.TRUSTED_TYPES_POLICY,H=O.createHTML("")}else O===void 0&&(O=QO(m,i)),O!==null&&typeof H=="string"&&(H=O.createHTML(""));Ue&&Ue(y),xr=y}},Lh=G({},[...hc,...dc,...HO]),zh=G({},[...pc,...BO]),vb=function(y){let C=V(y);(!C||!C.tagName)&&(C={namespaceURI:Er,tagName:"template"});const R=ra(y.tagName),oe=ra(C.tagName);return vl[y.namespaceURI]?y.namespaceURI===yo?C.namespaceURI===zt?R==="svg":C.namespaceURI===vo?R==="svg"&&(oe==="annotation-xml"||bo[oe]):!!Lh[R]:y.namespaceURI===vo?C.namespaceURI===zt?R==="math":C.namespaceURI===yo?R==="math"&&wo[oe]:!!zh[R]:y.namespaceURI===zt?C.namespaceURI===yo&&!wo[oe]||C.namespaceURI===vo&&!bo[oe]?!1:!zh[R]&&(pb[R]||!Lh[R]):!!(Pi==="application/xhtml+xml"&&vl[y.namespaceURI]):!1},_t=function(y){zi(e.removed,{element:y});try{V(y).removeChild(y)}catch{I(y)}},Tn=function(y,C){try{zi(e.removed,{attribute:C.getAttributeNode(y),from:C})}catch{zi(e.removed,{attribute:null,from:C})}if(C.removeAttribute(y),y==="is")if(_r||go)try{_t(C)}catch{}else try{C.setAttribute(y,"")}catch{}},Mh=function(y){let C=null,R=null;if(dl)y="<remove></remove>"+y;else{const ve=uc(y,/^[\r\n\t ]+/);R=ve&&ve[0]}Pi==="application/xhtml+xml"&&Er===zt&&(y='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+y+"</body></html>");const oe=O?O.createHTML(y):y;if(Er===zt)try{C=new g().parseFromString(oe,Pi)}catch{}if(!C||!C.documentElement){C=F.createDocument(Er,"template",null);try{C.documentElement.innerHTML=ml?H:oe}catch{}}const De=C.body||C.documentElement;return y&&R&&De.insertBefore(t.createTextNode(R),De.childNodes[0]||null),Er===zt?Ti.call(C,$n?"html":"body")[0]:$n?C.documentElement:De},Nh=function(y){return ce.call(y.ownerDocument||y,y,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},bl=function(y){return y instanceof p&&(typeof y.nodeName!="string"||typeof y.textContent!="string"||typeof y.removeChild!="function"||!(y.attributes instanceof h)||typeof y.removeAttribute!="function"||typeof y.setAttribute!="function"||typeof y.namespaceURI!="string"||typeof y.insertBefore!="function"||typeof y.hasChildNodes!="function")},Uh=function(y){return typeof a=="function"&&y instanceof a};function Mt(M,y,C){Mo(M,R=>{R.call(e,y,C,xr)})}const Fh=function(y){let C=null;if(Mt(xe.beforeSanitizeElements,y,null),bl(y))return _t(y),!0;const R=be(y.nodeName);if(Mt(xe.uponSanitizeElement,y,{tagName:R,allowedTags:_e}),fo&&y.hasChildNodes()&&!Uh(y.firstElementChild)&&Le(/<[/\w!]/g,y.innerHTML)&&Le(/<[/\w!]/g,y.textContent)||y.nodeType===Fi.progressingInstruction||fo&&y.nodeType===Fi.comment&&Le(/<[/\w]/g,y.data))return _t(y),!0;if(!(rn.tagCheck instanceof Function&&rn.tagCheck(R))&&(!_e[R]||Ci[R])){if(!Ci[R]&&Hh(R)&&(me.tagNameCheck instanceof RegExp&&Le(me.tagNameCheck,R)||me.tagNameCheck instanceof Function&&me.tagNameCheck(R)))return!1;if(pl&&!St[R]){const oe=V(y)||y.parentNode,De=P(y)||y.childNodes;if(De&&oe){const ve=De.length;for(let Ze=ve-1;Ze>=0;--Ze){const Nt=k(De[Ze],!0);Nt.__removalCount=(y.__removalCount||0)+1,oe.insertBefore(Nt,U(y))}}}return _t(y),!0}return y instanceof l&&!vb(y)||(R==="noscript"||R==="noembed"||R==="noframes")&&Le(/<\/no(script|embed|frames)/i,y.innerHTML)?(_t(y),!0):(Sr&&y.nodeType===Fi.text&&(C=y.textContent,Mo([An,wt,nn],oe=>{C=Mi(C,oe," ")}),y.textContent!==C&&(zi(e.removed,{element:y.cloneNode()}),y.textContent=C)),Mt(xe.afterSanitizeElements,y,null),!1)},Zh=function(y,C,R){if(po[C]||Ch&&(C==="id"||C==="name")&&(R in t||R in mb))return!1;if(!(ul&&!po[C]&&Le(cl,C))){if(!(Ah&&Le(ho,C))){if(!(rn.attributeCheck instanceof Function&&rn.attributeCheck(C,y))){if(!Ae[C]||po[C]){if(!(Hh(y)&&(me.tagNameCheck instanceof RegExp&&Le(me.tagNameCheck,y)||me.tagNameCheck instanceof Function&&me.tagNameCheck(y))&&(me.attributeNameCheck instanceof RegExp&&Le(me.attributeNameCheck,C)||me.attributeNameCheck instanceof Function&&me.attributeNameCheck(C,y))||C==="is"&&me.allowCustomizedBuiltInElements&&(me.tagNameCheck instanceof RegExp&&Le(me.tagNameCheck,R)||me.tagNameCheck instanceof Function&&me.tagNameCheck(R))))return!1}else if(!gl[C]){if(!Le(kh,Mi(R,_h,""))){if(!((C==="src"||C==="xlink:href"||C==="href")&&y!=="script"&&NO(R,"data:")===0&&Ph[y])){if(!($h&&!Le(cb,Mi(R,_h,"")))){if(R)return!1}}}}}}}return!0},Hh=function(y){return y!=="annotation-xml"&&uc(y,ub)},Bh=function(y){Mt(xe.beforeSanitizeAttributes,y,null);const{attributes:C}=y;if(!C||bl(y))return;const R={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ae,forceKeepAttr:void 0};let oe=C.length;for(;oe--;){const De=C[oe],{name:ve,namespaceURI:Ze,value:Nt}=De,Ar=be(ve),wl=Nt;let $e=ve==="value"?wl:UO(wl);if(R.attrName=Ar,R.attrValue=$e,R.keepAttr=!0,R.forceKeepAttr=void 0,Mt(xe.uponSanitizeAttribute,y,R),$e=R.attrValue,Ih&&(Ar==="id"||Ar==="name")&&(Tn(ve,y),$e=hb+$e),fo&&Le(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,$e)){Tn(ve,y);continue}if(Ar==="attributename"&&uc($e,"href")){Tn(ve,y);continue}if(R.forceKeepAttr)continue;if(!R.keepAttr){Tn(ve,y);continue}if(!Th&&Le(/\/>/i,$e)){Tn(ve,y);continue}Sr&&Mo([An,wt,nn],Vh=>{$e=Mi($e,Vh," ")});const Gh=be(y.nodeName);if(!Zh(Gh,Ar,$e)){Tn(ve,y);continue}if(O&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!Ze)switch(m.getAttributeType(Gh,Ar)){case"TrustedHTML":{$e=O.createHTML($e);break}case"TrustedScriptURL":{$e=O.createScriptURL($e);break}}if($e!==wl)try{Ze?y.setAttributeNS(Ze,ve,$e):y.setAttribute(ve,$e),bl(y)?_t(y):xf(e.removed)}catch{Tn(ve,y)}}Mt(xe.afterSanitizeAttributes,y,null)},yb=function M(y){let C=null;const R=Nh(y);for(Mt(xe.beforeSanitizeShadowDOM,y,null);C=R.nextNode();)Mt(xe.uponSanitizeShadowNode,C,null),Fh(C),Bh(C),C.content instanceof s&&M(C.content);Mt(xe.afterSanitizeShadowDOM,y,null)};return e.sanitize=function(M){let y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},C=null,R=null,oe=null,De=null;if(ml=!M,ml&&(M="<!-->"),typeof M!="string"&&!Uh(M))if(typeof M.toString=="function"){if(M=M.toString(),typeof M!="string")throw Ni("dirty is not a string, aborting")}else throw Ni("toString is not a function");if(!e.isSupported)return M;if(hl||yl(y),e.removed=[],typeof M=="string"&&(Ii=!1),Ii){if(M.nodeName){const Nt=be(M.nodeName);if(!_e[Nt]||Ci[Nt])throw Ni("root node is forbidden and cannot be sanitized in-place")}}else if(M instanceof a)C=Mh("<!---->"),R=C.ownerDocument.importNode(M,!0),R.nodeType===Fi.element&&R.nodeName==="BODY"||R.nodeName==="HTML"?C=R:C.appendChild(R);else{if(!_r&&!Sr&&!$n&&M.indexOf("<")===-1)return O&&mo?O.createHTML(M):M;if(C=Mh(M),!C)return _r?null:mo?H:""}C&&dl&&_t(C.firstChild);const ve=Nh(Ii?M:C);for(;oe=ve.nextNode();)Fh(oe),Bh(oe),oe.content instanceof s&&yb(oe.content);if(Ii)return M;if(_r){if(go)for(De=ue.call(C.ownerDocument);C.firstChild;)De.appendChild(C.firstChild);else De=C;return(Ae.shadowroot||Ae.shadowrootmode)&&(De=uo.call(r,De,!0)),De}let Ze=$n?C.outerHTML:C.innerHTML;return $n&&_e["!doctype"]&&C.ownerDocument&&C.ownerDocument.doctype&&C.ownerDocument.doctype.name&&Le(Vy,C.ownerDocument.doctype.name)&&(Ze="<!DOCTYPE "+C.ownerDocument.doctype.name+`>
350
+ `+Ze),Sr&&Mo([An,wt,nn],Nt=>{Ze=Mi(Ze,Nt," ")}),O&&mo?O.createHTML(Ze):Ze},e.setConfig=function(){let M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};yl(M),hl=!0},e.clearConfig=function(){xr=null,hl=!1},e.isValidAttribute=function(M,y,C){xr||yl({});const R=be(M),oe=be(y);return Zh(R,oe,C)},e.addHook=function(M,y){typeof y=="function"&&zi(xe[M],y)},e.removeHook=function(M,y){if(y!==void 0){const C=zO(xe[M],y);return C===-1?void 0:MO(xe[M],C,1)[0]}return xf(xe[M])},e.removeHooks=function(M){xe[M]=[]},e.removeAllHooks=function(){xe=Pf()},e}var jy=Wy();function hh(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var wr=hh();function qy(n){wr=n}var Mn={exec:()=>null};function q(n,e=""){let t=typeof n=="string"?n:n.source,r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(Ne.caret,"$1"),t=t.replace(i,o),r},getRegex:()=>new RegExp(t,e)};return r}var eL=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Ne={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}>`)},tL=/^(?:[ \t]*(?:\n|$))+/,nL=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,rL=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,co=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,iL=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,dh=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Yy=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Xy=q(Yy).replace(/bull/g,dh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),sL=q(Yy).replace(/bull/g,dh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ph=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,oL=/^[^\n]+/,fh=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,aL=q(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",fh).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),lL=q(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,dh).getRegex(),ol="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",gh=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,cL=q("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",gh).replace("tag",ol).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ky=q(ph).replace("hr",co).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ol).getRegex(),uL=q(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ky).getRegex(),mh={blockquote:uL,code:nL,def:aL,fences:rL,heading:iL,hr:co,html:cL,lheading:Xy,list:lL,newline:tL,paragraph:Ky,table:Mn,text:oL},Rf=q("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",co).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ol).getRegex(),hL={...mh,lheading:sL,table:Rf,paragraph:q(ph).replace("hr",co).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Rf).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ol).getRegex()},dL={...mh,html:q(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",gh).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Mn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:q(ph).replace("hr",co).replace("heading",` *#{1,6} *[^
351
+ ]`).replace("lheading",Xy).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},pL=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,fL=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Jy=/^( {2,}|\\)\n(?!\s*$)/,gL=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,$i=/[\p{P}\p{S}]/u,al=/[\s\p{P}\p{S}]/u,vh=/[^\s\p{P}\p{S}]/u,mL=q(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,al).getRegex(),Qy=/(?!~)[\p{P}\p{S}]/u,vL=/(?!~)[\s\p{P}\p{S}]/u,yL=/(?:[^\s\p{P}\p{S}]|~)/u,bL=q(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",eL?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),eb=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,wL=q(eb,"u").replace(/punct/g,$i).getRegex(),SL=q(eb,"u").replace(/punct/g,Qy).getRegex(),tb="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",_L=q(tb,"gu").replace(/notPunctSpace/g,vh).replace(/punctSpace/g,al).replace(/punct/g,$i).getRegex(),kL=q(tb,"gu").replace(/notPunctSpace/g,yL).replace(/punctSpace/g,vL).replace(/punct/g,Qy).getRegex(),EL=q("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,vh).replace(/punctSpace/g,al).replace(/punct/g,$i).getRegex(),xL=q(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,$i).getRegex(),AL="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",$L=q(AL,"gu").replace(/notPunctSpace/g,vh).replace(/punctSpace/g,al).replace(/punct/g,$i).getRegex(),TL=q(/\\(punct)/,"gu").replace(/punct/g,$i).getRegex(),CL=q(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),IL=q(gh).replace("(?:-->|$)","-->").getRegex(),PL=q("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",IL).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),wa=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,RL=q(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",wa).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),nb=q(/^!?\[(label)\]\[(ref)\]/).replace("label",wa).replace("ref",fh).getRegex(),rb=q(/^!?\[(ref)\](?:\[\])?/).replace("ref",fh).getRegex(),DL=q("reflink|nolink(?!\\()","g").replace("reflink",nb).replace("nolink",rb).getRegex(),Df=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,yh={_backpedal:Mn,anyPunctuation:TL,autolink:CL,blockSkip:bL,br:Jy,code:fL,del:Mn,delLDelim:Mn,delRDelim:Mn,emStrongLDelim:wL,emStrongRDelimAst:_L,emStrongRDelimUnd:EL,escape:pL,link:RL,nolink:rb,punctuation:mL,reflink:nb,reflinkSearch:DL,tag:PL,text:gL,url:Mn},OL={...yh,link:q(/^!?\[(label)\]\((.*?)\)/).replace("label",wa).getRegex(),reflink:q(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",wa).getRegex()},hu={...yh,emStrongRDelimAst:kL,emStrongLDelim:SL,delLDelim:xL,delRDelim:$L,url:q(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Df).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:q(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Df).getRegex()},LL={...hu,br:q(Jy).replace("{2,}","*").getRegex(),text:q(hu.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Uo={normal:mh,gfm:hL,pedantic:dL},Zi={normal:yh,gfm:hu,breaks:LL,pedantic:OL},zL={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Of=n=>zL[n];function At(n,e){if(e){if(Ne.escapeTest.test(n))return n.replace(Ne.escapeReplace,Of)}else if(Ne.escapeTestNoEncode.test(n))return n.replace(Ne.escapeReplaceNoEncode,Of);return n}function Lf(n){try{n=encodeURI(n).replace(Ne.percentDecode,"%")}catch{return null}return n}function zf(n,e){var s;let t=n.replace(Ne.findPipe,(o,a,l)=>{let u=!1,h=a;for(;--h>=0&&l[h]==="\\";)u=!u;return u?"|":" |"}),r=t.split(Ne.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!((s=r.at(-1))!=null&&s.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(Ne.slashPipe,"|");return r}function Hi(n,e,t){let r=n.length;if(r===0)return"";let i=0;for(;i<r&&n.charAt(r-i-1)===e;)i++;return n.slice(0,r-i)}function ML(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let r=0;r<n.length;r++)if(n[r]==="\\")r++;else if(n[r]===e[0])t++;else if(n[r]===e[1]&&(t--,t<0))return r;return t>0?-2:-1}function NL(n,e=0){let t=e,r="";for(let i of n)if(i===" "){let s=4-t%4;r+=" ".repeat(s),t+=s}else r+=i,t++;return r}function Mf(n,e,t,r,i){let s=e.href,o=e.title||null,a=n[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:n[0].charAt(0)==="!"?"image":"link",raw:t,href:s,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}function UL(n,e,t){let r=n.match(t.other.indentCodeCompensation);if(r===null)return e;let i=r[1];return e.split(`
352
352
  `).map(s=>{let o=s.match(t.other.beginningSpace);if(o===null)return s;let[a]=o;return a.length>=i.length?s.slice(i.length):s}).join(`
353
353
  `)}var Sa=class{constructor(n){b(this,"options");b(this,"rules");b(this,"lexer");this.options=n||wr}space(n){let e=this.rules.block.newline.exec(n);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(n){let e=this.rules.block.code.exec(n);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:Hi(t,`
354
- `)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],r=GL(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let r=Hi(t,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(t=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:Hi(e[0],`
354
+ `)}}}fences(n){let e=this.rules.block.fences.exec(n);if(e){let t=e[0],r=UL(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(n){let e=this.rules.block.heading.exec(n);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let r=Hi(t,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(t=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(n){let e=this.rules.block.hr.exec(n);if(e)return{type:"hr",raw:Hi(e[0],`
355
355
  `)}}blockquote(n){let e=this.rules.block.blockquote.exec(n);if(e){let t=Hi(e[0],`
356
356
  `).split(`
357
357
  `),r="",i="",s=[];for(;t.length>0;){let o=!1,a=[],l;for(l=0;l<t.length;l++)if(this.rules.other.blockquoteStart.test(t[l]))a.push(t[l]),o=!0;else if(!o)a.push(t[l]);else break;t=t.slice(l);let u=a.join(`
@@ -363,16 +363,16 @@ ${h}`:h;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
363
363
  `),k=this.blockquote(A);s[s.length-1]=k,r=r.substring(0,r.length-m.raw.length)+k.raw,i=i.substring(0,i.length-m.text.length)+k.text;break}else if((g==null?void 0:g.type)==="list"){let m=g,A=m.raw+`
364
364
  `+t.join(`
365
365
  `),k=this.list(A);s[s.length-1]=k,r=r.substring(0,r.length-g.raw.length)+k.raw,i=i.substring(0,i.length-m.raw.length)+k.raw,t=A.substring(s.at(-1).raw.length).split(`
366
- `);continue}}return{type:"blockquote",raw:r,tokens:s,text:i}}}list(n){var t,r;let e=this.rules.block.list.exec(n);if(e){let i=e[1].trim(),s=i.length>1,o={type:"list",raw:"",ordered:s,start:s?+i.slice(0,-1):"",loose:!1,items:[]};i=s?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=s?i:"[*+-]");let a=this.rules.other.listItemRegex(i),l=!1;for(;n;){let h=!1,p="",g="";if(!(e=a.exec(n))||this.rules.block.hr.test(n))break;p=e[0],n=n.substring(p.length);let m=BL(e[2].split(`
366
+ `);continue}}return{type:"blockquote",raw:r,tokens:s,text:i}}}list(n){var t,r;let e=this.rules.block.list.exec(n);if(e){let i=e[1].trim(),s=i.length>1,o={type:"list",raw:"",ordered:s,start:s?+i.slice(0,-1):"",loose:!1,items:[]};i=s?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=s?i:"[*+-]");let a=this.rules.other.listItemRegex(i),l=!1;for(;n;){let h=!1,p="",g="";if(!(e=a.exec(n))||this.rules.block.hr.test(n))break;p=e[0],n=n.substring(p.length);let m=NL(e[2].split(`
367
367
  `,1)[0],e[1].length),A=n.split(`
368
368
  `,1)[0],k=!m.trim(),I=0;if(this.options.pedantic?(I=2,g=m.trimStart()):k?I=e[1].length+1:(I=m.search(this.rules.other.nonSpaceChar),I=I>4?1:I,g=m.slice(I),I+=e[1].length),k&&this.rules.other.blankLine.test(A)&&(p+=A+`
369
369
  `,n=n.substring(A.length+1),h=!0),!h){let U=this.rules.other.nextBulletRegex(I),P=this.rules.other.hrRegex(I),V=this.rules.other.fencesBeginRegex(I),O=this.rules.other.headingBeginRegex(I),H=this.rules.other.htmlBeginRegex(I),F=this.rules.other.blockquoteBeginRegex(I);for(;n;){let ce=n.split(`
370
370
  `,1)[0],ue;if(A=ce,this.options.pedantic?(A=A.replace(this.rules.other.listReplaceNesting," "),ue=A):ue=A.replace(this.rules.other.tabCharGlobal," "),V.test(A)||O.test(A)||H.test(A)||F.test(A)||U.test(A)||P.test(A))break;if(ue.search(this.rules.other.nonSpaceChar)>=I||!A.trim())g+=`
371
371
  `+ue.slice(I);else{if(k||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||V.test(m)||O.test(m)||P.test(m))break;g+=`
372
372
  `+A}k=!A.trim(),p+=ce+`
373
- `,n=n.substring(ce.length+1),m=ue.slice(I)}}o.loose||(l?o.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(l=!0)),o.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(g),loose:!1,text:g,tokens:[]}),o.raw+=p}let u=o.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let h of o.items){if(this.lexer.state.top=!1,h.tokens=this.lexer.blockTokens(h.text,[]),h.task){if(h.text=h.text.replace(this.rules.other.listReplaceTask,""),((t=h.tokens[0])==null?void 0:t.type)==="text"||((r=h.tokens[0])==null?void 0:r.type)==="paragraph"){h.tokens[0].raw=h.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),h.tokens[0].text=h.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let g=this.lexer.inlineQueue.length-1;g>=0;g--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)){this.lexer.inlineQueue[g].src=this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask,"");break}}let p=this.rules.other.listTaskCheckbox.exec(h.raw);if(p){let g={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};h.checked=g.checked,o.loose?h.tokens[0]&&["paragraph","text"].includes(h.tokens[0].type)&&"tokens"in h.tokens[0]&&h.tokens[0].tokens?(h.tokens[0].raw=g.raw+h.tokens[0].raw,h.tokens[0].text=g.raw+h.tokens[0].text,h.tokens[0].tokens.unshift(g)):h.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):h.tokens.unshift(g)}}if(!o.loose){let p=h.tokens.filter(m=>m.type==="space"),g=p.length>0&&p.some(m=>this.rules.other.anyLine.test(m.raw));o.loose=g}}if(o.loose)for(let h of o.items){h.loose=!0;for(let p of h.tokens)p.type==="text"&&(p.type="paragraph")}return o}}html(n){let e=this.rules.block.html.exec(n);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:r,title:i}}}table(n){var o;let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=Hf(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
374
- `):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===r.length){for(let a of r)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a<t.length;a++)s.header.push({text:t[a],tokens:this.lexer.inline(t[a]),header:!0,align:s.align[a]});for(let a of i)s.rows.push(Hf(a,s.header.length).map((l,u)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:s.align[u]})));return s}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e){let t=e[1].trim();return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let t=e[1].charAt(e[1].length-1)===`
375
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let s=Hi(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=HL(e[2],"()");if(s===-2)return;if(s>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3])}else i=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?r=r.slice(1):r=r.slice(1,-1)),Bf(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let r=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[r.toLowerCase()];if(!i){let s=t[0].charAt(0);return{type:"text",raw:s,text:s}}return Bf(t,i,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let r=this.rules.inline.emStrongLDelim.exec(n);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!t||this.rules.inline.punctuation.exec(t))){let i=[...r[0]].length-1,s,o,a=i,l=0,u=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*n.length+i);(r=u.exec(e))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(o=[...s].length,r[3]||r[4]){a+=o;continue}else if((r[5]||r[6])&&i%3&&!((i+o)%3)){l+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let h=[...r[0]][0].length,p=n.slice(0,i+r.index+h+o);if(Math.min(i,o)%2){let m=p.slice(1,-1);return{type:"em",raw:p,text:m,tokens:this.lexer.inlineTokens(m)}}let g=p.slice(2,-2);return{type:"strong",raw:p,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return r&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,t=""){let r=this.rules.inline.delLDelim.exec(n);if(r&&(!r[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...r[0]].length-1,s,o,a=i,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*n.length+i);(r=l.exec(e))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s||(o=[...s].length,o!==i))continue;if(r[3]||r[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let u=[...r[0]][0].length,h=n.slice(0,i+r.index+u+o),p=h.slice(i,-i);return{type:"del",raw:h,text:p,tokens:this.lexer.inlineTokens(p)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,r;return e[2]==="@"?(t=e[1],r="mailto:"+t):(t=e[1],r=t),{type:"link",raw:e[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}url(n){var t;let e;if(e=this.rules.inline.url.exec(n)){let r,i;if(e[2]==="@")r=e[0],i="mailto:"+r;else{let s;do s=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(s!==e[0]);r=e[0],e[1]==="www."?i="http://"+e[0]:i=e[0]}return{type:"link",raw:e[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},mt=class gu{constructor(e){b(this,"tokens");b(this,"options");b(this,"state");b(this,"inlineQueue");b(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||wr,this.options.tokenizer=this.options.tokenizer||new Sa,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Ne,block:Uo.normal,inline:Zi.normal};this.options.pedantic?(t.block=Uo.pedantic,t.inline=Zi.pedantic):this.options.gfm&&(t.block=Uo.gfm,this.options.breaks?t.inline=Zi.breaks:t.inline=Zi.gfm),this.tokenizer.rules=t}static get rules(){return{block:Uo,inline:Zi}}static lex(e,t){return new gu(t).lex(e)}static lexInline(e,t){return new gu(t).inlineTokens(e)}lex(e){e=e.replace(Ne.carriageReturn,`
373
+ `,n=n.substring(ce.length+1),m=ue.slice(I)}}o.loose||(l?o.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(l=!0)),o.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(g),loose:!1,text:g,tokens:[]}),o.raw+=p}let u=o.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let h of o.items){if(this.lexer.state.top=!1,h.tokens=this.lexer.blockTokens(h.text,[]),h.task){if(h.text=h.text.replace(this.rules.other.listReplaceTask,""),((t=h.tokens[0])==null?void 0:t.type)==="text"||((r=h.tokens[0])==null?void 0:r.type)==="paragraph"){h.tokens[0].raw=h.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),h.tokens[0].text=h.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let g=this.lexer.inlineQueue.length-1;g>=0;g--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)){this.lexer.inlineQueue[g].src=this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask,"");break}}let p=this.rules.other.listTaskCheckbox.exec(h.raw);if(p){let g={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};h.checked=g.checked,o.loose?h.tokens[0]&&["paragraph","text"].includes(h.tokens[0].type)&&"tokens"in h.tokens[0]&&h.tokens[0].tokens?(h.tokens[0].raw=g.raw+h.tokens[0].raw,h.tokens[0].text=g.raw+h.tokens[0].text,h.tokens[0].tokens.unshift(g)):h.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):h.tokens.unshift(g)}}if(!o.loose){let p=h.tokens.filter(m=>m.type==="space"),g=p.length>0&&p.some(m=>this.rules.other.anyLine.test(m.raw));o.loose=g}}if(o.loose)for(let h of o.items){h.loose=!0;for(let p of h.tokens)p.type==="text"&&(p.type="paragraph")}return o}}html(n){let e=this.rules.block.html.exec(n);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(n){let e=this.rules.block.def.exec(n);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:r,title:i}}}table(n){var o;let e=this.rules.block.table.exec(n);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=zf(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
374
+ `):[],s={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===r.length){for(let a of r)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a<t.length;a++)s.header.push({text:t[a],tokens:this.lexer.inline(t[a]),header:!0,align:s.align[a]});for(let a of i)s.rows.push(zf(a,s.header.length).map((l,u)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:s.align[u]})));return s}}lheading(n){let e=this.rules.block.lheading.exec(n);if(e){let t=e[1].trim();return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(n){let e=this.rules.block.paragraph.exec(n);if(e){let t=e[1].charAt(e[1].length-1)===`
375
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(n){let e=this.rules.block.text.exec(n);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(n){let e=this.rules.inline.escape.exec(n);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(n){let e=this.rules.inline.tag.exec(n);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(n){let e=this.rules.inline.link.exec(n);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let s=Hi(t.slice(0,-1),"\\");if((t.length-s.length)%2===0)return}else{let s=ML(e[2],"()");if(s===-2)return;if(s>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let r=e[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3])}else i=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?r=r.slice(1):r=r.slice(1,-1)),Mf(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(n,e){let t;if((t=this.rules.inline.reflink.exec(n))||(t=this.rules.inline.nolink.exec(n))){let r=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[r.toLowerCase()];if(!i){let s=t[0].charAt(0);return{type:"text",raw:s,text:s}}return Mf(t,i,t[0],this.lexer,this.rules)}}emStrong(n,e,t=""){let r=this.rules.inline.emStrongLDelim.exec(n);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!t||this.rules.inline.punctuation.exec(t))){let i=[...r[0]].length-1,s,o,a=i,l=0,u=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*n.length+i);(r=u.exec(e))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(o=[...s].length,r[3]||r[4]){a+=o;continue}else if((r[5]||r[6])&&i%3&&!((i+o)%3)){l+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+l);let h=[...r[0]][0].length,p=n.slice(0,i+r.index+h+o);if(Math.min(i,o)%2){let m=p.slice(1,-1);return{type:"em",raw:p,text:m,tokens:this.lexer.inlineTokens(m)}}let g=p.slice(2,-2);return{type:"strong",raw:p,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(n){let e=this.rules.inline.code.exec(n);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(t),i=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return r&&i&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(n){let e=this.rules.inline.br.exec(n);if(e)return{type:"br",raw:e[0]}}del(n,e,t=""){let r=this.rules.inline.delLDelim.exec(n);if(r&&(!r[1]||!t||this.rules.inline.punctuation.exec(t))){let i=[...r[0]].length-1,s,o,a=i,l=this.rules.inline.delRDelim;for(l.lastIndex=0,e=e.slice(-1*n.length+i);(r=l.exec(e))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s||(o=[...s].length,o!==i))continue;if(r[3]||r[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let u=[...r[0]][0].length,h=n.slice(0,i+r.index+u+o),p=h.slice(i,-i);return{type:"del",raw:h,text:p,tokens:this.lexer.inlineTokens(p)}}}}autolink(n){let e=this.rules.inline.autolink.exec(n);if(e){let t,r;return e[2]==="@"?(t=e[1],r="mailto:"+t):(t=e[1],r=t),{type:"link",raw:e[0],text:t,href:r,tokens:[{type:"text",raw:t,text:t}]}}}url(n){var t;let e;if(e=this.rules.inline.url.exec(n)){let r,i;if(e[2]==="@")r=e[0],i="mailto:"+r;else{let s;do s=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(s!==e[0]);r=e[0],e[1]==="www."?i="http://"+e[0]:i=e[0]}return{type:"link",raw:e[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(n){let e=this.rules.inline.text.exec(n);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},mt=class du{constructor(e){b(this,"tokens");b(this,"options");b(this,"state");b(this,"inlineQueue");b(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||wr,this.options.tokenizer=this.options.tokenizer||new Sa,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Ne,block:Uo.normal,inline:Zi.normal};this.options.pedantic?(t.block=Uo.pedantic,t.inline=Zi.pedantic):this.options.gfm&&(t.block=Uo.gfm,this.options.breaks?t.inline=Zi.breaks:t.inline=Zi.gfm),this.tokenizer.rules=t}static get rules(){return{block:Uo,inline:Zi}}static lex(e,t){return new du(t).lex(e)}static lexInline(e,t){return new du(t).inlineTokens(e)}lex(e){e=e.replace(Ne.carriageReturn,`
376
376
  `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let r=this.inlineQueue[t];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],r=!1){var i,s,o;for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(Ne.tabCharGlobal," ").replace(Ne.spaceLine,""));e;){let a;if((s=(i=this.options.extensions)==null?void 0:i.block)!=null&&s.some(u=>(a=u.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let u=t.at(-1);a.raw.length===1&&u!==void 0?u.raw+=`
377
377
  `:t.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let u=t.at(-1);(u==null?void 0:u.type)==="paragraph"||(u==null?void 0:u.type)==="text"?(u.raw+=(u.raw.endsWith(`
378
378
  `)?"":`
@@ -404,16 +404,16 @@ ${this.parser.parse(n)}</blockquote>
404
404
  `}tablerow({text:n}){return`<tr>
405
405
  ${n}</tr>
406
406
  `}tablecell(n){let e=this.parser.parseInline(n.tokens),t=n.header?"th":"td";return(n.align?`<${t} align="${n.align}">`:`<${t}>`)+e+`</${t}>
407
- `}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${At(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let r=this.parser.parseInline(t),i=Zf(n);if(i===null)return r;n=i;let s='<a href="'+n+'"';return e&&(s+=' title="'+At(e)+'"'),s+=">"+r+"</a>",s}image({href:n,title:e,text:t,tokens:r}){r&&(t=this.parser.parseInline(r,this.parser.textRenderer));let i=Zf(n);if(i===null)return At(t);n=i;let s=`<img src="${n}" alt="${At(t)}"`;return e&&(s+=` title="${At(e)}"`),s+=">",s}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:At(n.text)}},_h=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},vt=class mu{constructor(e){b(this,"options");b(this,"renderer");b(this,"textRenderer");this.options=e||wr,this.options.renderer=this.options.renderer||new _a,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new _h}static parse(e,t){return new mu(t).parse(e)}static parseInline(e,t){return new mu(t).parseInline(e)}parse(e){var r,i;this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let o=e[s];if((i=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&i[o.type]){let l=o,u=this.options.extensions.renderers[l.type].call({parser:this},l);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){t+=u||"";continue}}let a=o;switch(a.type){case"space":{t+=this.renderer.space(a);break}case"hr":{t+=this.renderer.hr(a);break}case"heading":{t+=this.renderer.heading(a);break}case"code":{t+=this.renderer.code(a);break}case"table":{t+=this.renderer.table(a);break}case"blockquote":{t+=this.renderer.blockquote(a);break}case"list":{t+=this.renderer.list(a);break}case"checkbox":{t+=this.renderer.checkbox(a);break}case"html":{t+=this.renderer.html(a);break}case"def":{t+=this.renderer.def(a);break}case"paragraph":{t+=this.renderer.paragraph(a);break}case"text":{t+=this.renderer.text(a);break}default:{let l='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return t}parseInline(e,t=this.renderer){var i,s;this.renderer.parser=this;let r="";for(let o=0;o<e.length;o++){let a=e[o];if((s=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&s[a.type]){let u=this.options.extensions.renderers[a.type].call({parser:this},a);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){r+=u||"";continue}}let l=a;switch(l.type){case"escape":{r+=t.text(l);break}case"html":{r+=t.html(l);break}case"link":{r+=t.link(l);break}case"image":{r+=t.image(l);break}case"checkbox":{r+=t.checkbox(l);break}case"strong":{r+=t.strong(l);break}case"em":{r+=t.em(l);break}case"codespan":{r+=t.codespan(l);break}case"br":{r+=t.br(l);break}case"del":{r+=t.del(l);break}case"text":{r+=t.text(l);break}default:{let u='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return r}},Fo,Ji=(Fo=class{constructor(n){b(this,"options");b(this,"block");this.options=n||wr}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(){return this.block?mt.lex:mt.lexInline}provideParser(){return this.block?vt.parse:vt.parseInline}},b(Fo,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),b(Fo,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Fo),VL=class{constructor(...n){b(this,"defaults",fh());b(this,"options",this.setOptions);b(this,"parse",this.parseMarkdown(!0));b(this,"parseInline",this.parseMarkdown(!1));b(this,"Parser",vt);b(this,"Renderer",_a);b(this,"TextRenderer",_h);b(this,"Lexer",mt);b(this,"Tokenizer",Sa);b(this,"Hooks",Ji);this.use(...n)}walkTokens(n,e){var r,i;let t=[];for(let s of n)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let o=s;for(let a of o.header)t=t.concat(this.walkTokens(a.tokens,e));for(let a of o.rows)for(let l of a)t=t.concat(this.walkTokens(l.tokens,e));break}case"list":{let o=s;t=t.concat(this.walkTokens(o.items,e));break}default:{let o=s;(i=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&i[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{let l=o[a].flat(1/0);t=t.concat(this.walkTokens(l,e))}):o.tokens&&(t=t.concat(this.walkTokens(o.tokens,e)))}}return t}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let r={...t};if(r.async=this.defaults.async||r.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=e.renderers[i.name];s?e.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=s.apply(this,o)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[i.level];s?s.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),r.extensions=e),t.renderer){let i=this.defaults.renderer||new _a(this.defaults);for(let s in t.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let o=s,a=t.renderer[o],l=i[o];i[o]=(...u)=>{let h=a.apply(i,u);return h===!1&&(h=l.apply(i,u)),h||""}}r.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new Sa(this.defaults);for(let s in t.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let o=s,a=t.tokenizer[o],l=i[o];i[o]=(...u)=>{let h=a.apply(i,u);return h===!1&&(h=l.apply(i,u)),h}}r.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new Ji;for(let s in t.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let o=s,a=t.hooks[o],l=i[o];Ji.passThroughHooks.has(s)?i[o]=u=>{if(this.defaults.async&&Ji.passThroughHooksRespectAsync.has(s))return(async()=>{let p=await a.call(i,u);return l.call(i,p)})();let h=a.call(i,u);return l.call(i,h)}:i[o]=(...u)=>{if(this.defaults.async)return(async()=>{let p=await a.apply(i,u);return p===!1&&(p=await l.apply(i,u)),p})();let h=a.apply(i,u);return h===!1&&(h=l.apply(i,u)),h}}r.hooks=i}if(t.walkTokens){let i=this.defaults.walkTokens,s=t.walkTokens;r.walkTokens=function(o){let a=[];return a.push(s.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return mt.lex(n,e??this.defaults)}parser(n,e){return vt.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let r={...t},i={...this.defaults,...r},s=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=n),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,a=await(i.hooks?await i.hooks.provideLexer():n?mt.lex:mt.lexInline)(o,i),l=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser():n?vt.parse:vt.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(s);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer():n?mt.lex:mt.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser():n?vt.parse:vt.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return s(o)}}}onError(n,e){return t=>{if(t.message+=`
408
- Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error occurred:</p><pre>"+At(t.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(t);throw t}}},gr=new VL;function Q(n,e){return gr.parse(n,e)}Q.options=Q.setOptions=function(n){return gr.setOptions(n),Q.defaults=gr.defaults,eb(Q.defaults),Q};Q.getDefaults=fh;Q.defaults=wr;Q.use=function(...n){return gr.use(...n),Q.defaults=gr.defaults,eb(Q.defaults),Q};Q.walkTokens=function(n,e){return gr.walkTokens(n,e)};Q.parseInline=gr.parseInline;Q.Parser=vt;Q.parser=vt.parse;Q.Renderer=_a;Q.TextRenderer=_h;Q.Lexer=mt;Q.lexer=mt.lex;Q.Tokenizer=Sa;Q.Hooks=Ji;Q.parse=Q;Q.options;Q.setOptions;Q.use;Q.walkTokens;Q.parseInline;vt.parse;mt.lex;Qy.addHook("afterSanitizeAttributes",n=>{n.tagName==="A"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"))});function WL(n){const e=Q.parse(n,{async:!1});return Qy.sanitize(e,{USE_PROFILES:{html:!0}})}const jL=8,Gf=new WeakMap;function qL(n){const e=Gf.get(n);if(e&&e.text===n.text)return e.html;const t=WL(n.text);return Gf.set(n,{text:n.text,html:t}),t}function YL(n){return n.replace(/_/g," ")}function XL(n){return N`
407
+ `}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${At(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:e,tokens:t}){let r=this.parser.parseInline(t),i=Lf(n);if(i===null)return r;n=i;let s='<a href="'+n+'"';return e&&(s+=' title="'+At(e)+'"'),s+=">"+r+"</a>",s}image({href:n,title:e,text:t,tokens:r}){r&&(t=this.parser.parseInline(r,this.parser.textRenderer));let i=Lf(n);if(i===null)return At(t);n=i;let s=`<img src="${n}" alt="${At(t)}"`;return e&&(s+=` title="${At(e)}"`),s+=">",s}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:At(n.text)}},bh=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},vt=class pu{constructor(e){b(this,"options");b(this,"renderer");b(this,"textRenderer");this.options=e||wr,this.options.renderer=this.options.renderer||new _a,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new bh}static parse(e,t){return new pu(t).parse(e)}static parseInline(e,t){return new pu(t).parseInline(e)}parse(e){var r,i;this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let o=e[s];if((i=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&i[o.type]){let l=o,u=this.options.extensions.renderers[l.type].call({parser:this},l);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){t+=u||"";continue}}let a=o;switch(a.type){case"space":{t+=this.renderer.space(a);break}case"hr":{t+=this.renderer.hr(a);break}case"heading":{t+=this.renderer.heading(a);break}case"code":{t+=this.renderer.code(a);break}case"table":{t+=this.renderer.table(a);break}case"blockquote":{t+=this.renderer.blockquote(a);break}case"list":{t+=this.renderer.list(a);break}case"checkbox":{t+=this.renderer.checkbox(a);break}case"html":{t+=this.renderer.html(a);break}case"def":{t+=this.renderer.def(a);break}case"paragraph":{t+=this.renderer.paragraph(a);break}case"text":{t+=this.renderer.text(a);break}default:{let l='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return t}parseInline(e,t=this.renderer){var i,s;this.renderer.parser=this;let r="";for(let o=0;o<e.length;o++){let a=e[o];if((s=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&s[a.type]){let u=this.options.extensions.renderers[a.type].call({parser:this},a);if(u!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){r+=u||"";continue}}let l=a;switch(l.type){case"escape":{r+=t.text(l);break}case"html":{r+=t.html(l);break}case"link":{r+=t.link(l);break}case"image":{r+=t.image(l);break}case"checkbox":{r+=t.checkbox(l);break}case"strong":{r+=t.strong(l);break}case"em":{r+=t.em(l);break}case"codespan":{r+=t.codespan(l);break}case"br":{r+=t.br(l);break}case"del":{r+=t.del(l);break}case"text":{r+=t.text(l);break}default:{let u='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return r}},Fo,Ji=(Fo=class{constructor(n){b(this,"options");b(this,"block");this.options=n||wr}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(){return this.block?mt.lex:mt.lexInline}provideParser(){return this.block?vt.parse:vt.parseInline}},b(Fo,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),b(Fo,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Fo),FL=class{constructor(...n){b(this,"defaults",hh());b(this,"options",this.setOptions);b(this,"parse",this.parseMarkdown(!0));b(this,"parseInline",this.parseMarkdown(!1));b(this,"Parser",vt);b(this,"Renderer",_a);b(this,"TextRenderer",bh);b(this,"Lexer",mt);b(this,"Tokenizer",Sa);b(this,"Hooks",Ji);this.use(...n)}walkTokens(n,e){var r,i;let t=[];for(let s of n)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let o=s;for(let a of o.header)t=t.concat(this.walkTokens(a.tokens,e));for(let a of o.rows)for(let l of a)t=t.concat(this.walkTokens(l.tokens,e));break}case"list":{let o=s;t=t.concat(this.walkTokens(o.items,e));break}default:{let o=s;(i=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&i[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{let l=o[a].flat(1/0);t=t.concat(this.walkTokens(l,e))}):o.tokens&&(t=t.concat(this.walkTokens(o.tokens,e)))}}return t}use(...n){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(t=>{let r={...t};if(r.async=this.defaults.async||r.async||!1,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=e.renderers[i.name];s?e.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===!1&&(a=s.apply(this,o)),a}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[i.level];s?s.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),r.extensions=e),t.renderer){let i=this.defaults.renderer||new _a(this.defaults);for(let s in t.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let o=s,a=t.renderer[o],l=i[o];i[o]=(...u)=>{let h=a.apply(i,u);return h===!1&&(h=l.apply(i,u)),h||""}}r.renderer=i}if(t.tokenizer){let i=this.defaults.tokenizer||new Sa(this.defaults);for(let s in t.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let o=s,a=t.tokenizer[o],l=i[o];i[o]=(...u)=>{let h=a.apply(i,u);return h===!1&&(h=l.apply(i,u)),h}}r.tokenizer=i}if(t.hooks){let i=this.defaults.hooks||new Ji;for(let s in t.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let o=s,a=t.hooks[o],l=i[o];Ji.passThroughHooks.has(s)?i[o]=u=>{if(this.defaults.async&&Ji.passThroughHooksRespectAsync.has(s))return(async()=>{let p=await a.call(i,u);return l.call(i,p)})();let h=a.call(i,u);return l.call(i,h)}:i[o]=(...u)=>{if(this.defaults.async)return(async()=>{let p=await a.apply(i,u);return p===!1&&(p=await l.apply(i,u)),p})();let h=a.apply(i,u);return h===!1&&(h=l.apply(i,u)),h}}r.hooks=i}if(t.walkTokens){let i=this.defaults.walkTokens,s=t.walkTokens;r.walkTokens=function(o){let a=[];return a.push(s.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,e){return mt.lex(n,e??this.defaults)}parser(n,e){return vt.parse(n,e??this.defaults)}parseMarkdown(n){return(e,t)=>{let r={...t},i={...this.defaults,...r},s=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=n),i.async)return(async()=>{let o=i.hooks?await i.hooks.preprocess(e):e,a=await(i.hooks?await i.hooks.provideLexer():n?mt.lex:mt.lexInline)(o,i),l=i.hooks?await i.hooks.processAllTokens(a):a;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser():n?vt.parse:vt.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(s);try{i.hooks&&(e=i.hooks.preprocess(e));let o=(i.hooks?i.hooks.provideLexer():n?mt.lex:mt.lexInline)(e,i);i.hooks&&(o=i.hooks.processAllTokens(o)),i.walkTokens&&this.walkTokens(o,i.walkTokens);let a=(i.hooks?i.hooks.provideParser():n?vt.parse:vt.parseInline)(o,i);return i.hooks&&(a=i.hooks.postprocess(a)),a}catch(o){return s(o)}}}onError(n,e){return t=>{if(t.message+=`
408
+ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error occurred:</p><pre>"+At(t.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(t);throw t}}},gr=new FL;function Q(n,e){return gr.parse(n,e)}Q.options=Q.setOptions=function(n){return gr.setOptions(n),Q.defaults=gr.defaults,qy(Q.defaults),Q};Q.getDefaults=hh;Q.defaults=wr;Q.use=function(...n){return gr.use(...n),Q.defaults=gr.defaults,qy(Q.defaults),Q};Q.walkTokens=function(n,e){return gr.walkTokens(n,e)};Q.parseInline=gr.parseInline;Q.Parser=vt;Q.parser=vt.parse;Q.Renderer=_a;Q.TextRenderer=bh;Q.Lexer=mt;Q.lexer=mt.lex;Q.Tokenizer=Sa;Q.Hooks=Ji;Q.parse=Q;Q.options;Q.setOptions;Q.use;Q.walkTokens;Q.parseInline;vt.parse;mt.lex;jy.addHook("afterSanitizeAttributes",n=>{n.tagName==="A"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"))});function ZL(n){const e=Q.parse(n,{async:!1});return jy.sanitize(e,{USE_PROFILES:{html:!0}})}const HL=8,Nf=new WeakMap;function BL(n){const e=Nf.get(n);if(e&&e.text===n.text)return e.html;const t=ZL(n.text);return Nf.set(n,{text:n.text,html:t}),t}function GL(n){return n.replace(/_/g," ")}function VL(n){return N`
409
409
  <div class="tool-call-header">
410
410
  <span class="tool-call-title">${n.title}</span>
411
- <span class="tool-call-meta">${n.toolKind} · ${YL(n.status)}</span>
411
+ <span class="tool-call-meta">${n.toolKind} · ${GL(n.status)}</span>
412
412
  </div>
413
413
  ${n.text?N`<pre class="tool-call-text">${n.text}</pre>`:null}
414
- `}function Vf(n){for(let e=n.length-1;e>=0;e-=1){const t=n[e];if(t&&t.kind==="user")return t.id}return null}var Xt,cr,Fa,Za,Gs,vu;class ub extends cs{constructor(){super(...arguments);w(this,Gs);b(this,"messages",[]);w(this,Xt,!0);w(this,cr,null);w(this,Fa,()=>{const t=c(this,cr);if(!t)return;const i=t.scrollHeight-t.clientHeight-t.scrollTop<=jL;i!==c(this,Xt)&&(E(this,Xt,i),this.toggleAttribute("data-pinned",i))});w(this,Za,()=>{E(this,Xt,!0),this.toggleAttribute("data-pinned",!0),v(this,Gs,vu).call(this,!0)})}changed(t){let r=!1;if(t.has("messages")){const i=t.get("messages")??[],s=Vf(this.messages);r=s!==null&&s!==Vf(i),r&&E(this,Xt,!0)}Re(this.template(),this),c(this,cr)||E(this,cr,this.querySelector(".history-scroll")),this.toggleAttribute("data-pinned",c(this,Xt)),v(this,Gs,vu).call(this,r)}template(){return N`
414
+ `}function Uf(n){for(let e=n.length-1;e>=0;e-=1){const t=n[e];if(t&&t.kind==="user")return t.id}return null}var Xt,cr,Fa,Za,Gs,fu;class ib extends cs{constructor(){super(...arguments);w(this,Gs);b(this,"messages",[]);w(this,Xt,!0);w(this,cr,null);w(this,Fa,()=>{const t=c(this,cr);if(!t)return;const i=t.scrollHeight-t.clientHeight-t.scrollTop<=HL;i!==c(this,Xt)&&(E(this,Xt,i),this.toggleAttribute("data-pinned",i))});w(this,Za,()=>{E(this,Xt,!0),this.toggleAttribute("data-pinned",!0),v(this,Gs,fu).call(this,!0)})}changed(t){let r=!1;if(t.has("messages")){const i=t.get("messages")??[],s=Uf(this.messages);r=s!==null&&s!==Uf(i),r&&E(this,Xt,!0)}Re(this.template(),this),c(this,cr)||E(this,cr,this.querySelector(".history-scroll")),this.toggleAttribute("data-pinned",c(this,Xt)),v(this,Gs,fu).call(this,r)}template(){return N`
415
415
  <div class="history-scroll" @scroll=${c(this,Fa)}>
416
- ${this.messages.map(t=>{const r=t.kind==="assistant"?nD(qL(t)):t.kind==="tool_call"?XL(t):t.text;return N`<div
416
+ ${this.messages.map(t=>{const r=t.kind==="assistant"?K2(BL(t)):t.kind==="tool_call"?VL(t):t.text;return N`<div
417
417
  class="message message-${t.kind}"
418
418
  data-message-id=${t.id}
419
419
  >${r}</div>`})}
@@ -424,9 +424,9 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
424
424
  aria-label="Jump to latest message"
425
425
  @click=${c(this,Za)}
426
426
  >
427
- ${cy({size:16})}
427
+ ${ry({size:16})}
428
428
  </button>
429
- `}}Xt=new WeakMap,cr=new WeakMap,Fa=new WeakMap,Za=new WeakMap,Gs=new WeakSet,vu=function(t){requestAnimationFrame(()=>{const r=c(this,cr);r&&(!c(this,Xt)&&!t||(r.scrollTop=r.scrollHeight-r.clientHeight))})},b(ub,"properties",["messages"]);customElements.define("message-history",ub);var Vs,Ws,li,Ha,Ba,it,ia,js,bu,wu,qs,Ys;class yu extends cs{constructor(){super(...arguments);w(this,it);b(this,"placeholder","What do you want to do?");b(this,"open",!1);b(this,"messages",[]);w(this,Vs,qe.resolve("ACPClientManager"));w(this,Ws,qe.resolve("ShortcutService"));w(this,li,null);b(this,"handleTriggerActivate",()=>{this.open=!0});b(this,"handleKeydown",t=>{if(t.key!=="Enter"||t.shiftKey)return;const r=t.currentTarget,i=r.value.trim();if(t.preventDefault(),!i)return;r.value="",v(this,it,ia).call(this,r);const s=c(this,Vs).getActiveClient();s&&s.sendMessage({text:i}).catch(o=>{console.error("ACPClient.sendMessage() failed",o)})});w(this,Ha,t=>{v(this,it,ia).call(this,t.currentTarget)});w(this,Ba,t=>{if(t.target instanceof HTMLTextAreaElement)return;const r=t.currentTarget.querySelector("textarea");r==null||r.focus()});w(this,js,t=>{if(t.shortcut!=="focusCommandInput")return;if(!this.open){this.open=!0;return}const r=this.querySelector("textarea");if(r){if(document.activeElement===r){this.open=!1;return}r.focus()}});w(this,qs,t=>{t.target instanceof Node&&(this.contains(t.target)||(this.open=!1))});w(this,Ys,t=>{t.key==="Escape"&&(this.open=!1)})}connected(){const t=new DisposableStack;E(this,li,t);const r=MO(c(this,Vs),i=>{this.messages=i});t.defer(()=>r.dispose()),c(this,Ws).addEventListener("shortcut-triggered",c(this,js)),t.defer(()=>c(this,Ws).removeEventListener("shortcut-triggered",c(this,js))),this.open&&v(this,it,bu).call(this)}disconnected(){var t;(t=c(this,li))==null||t.dispose(),E(this,li,null),v(this,it,wu).call(this)}changed(t){if(this.open?(this.removeAttribute("material"),this.removeAttribute("tone"),this.removeAttribute("level")):(this.setAttribute("material","paper"),this.setAttribute("tone","dark"),this.setAttribute("level","overlay")),Re(this.template(),this),t.has("open"))if(this.open){v(this,it,bu).call(this);const r=this.querySelector("textarea");r&&(v(this,it,ia).call(this,r),r.focus())}else v(this,it,wu).call(this)}template(){return this.open?N`
429
+ `}}Xt=new WeakMap,cr=new WeakMap,Fa=new WeakMap,Za=new WeakMap,Gs=new WeakSet,fu=function(t){requestAnimationFrame(()=>{const r=c(this,cr);r&&(!c(this,Xt)&&!t||(r.scrollTop=r.scrollHeight-r.clientHeight))})},b(ib,"properties",["messages"]);customElements.define("message-history",ib);var Vs,Ws,li,Ha,Ba,it,ia,js,mu,vu,qs,Ys;class gu extends cs{constructor(){super(...arguments);w(this,it);b(this,"placeholder","What do you want to do?");b(this,"open",!1);b(this,"messages",[]);w(this,Vs,qe.resolve("ACPClientManager"));w(this,Ws,qe.resolve("ShortcutService"));w(this,li,null);b(this,"handleTriggerActivate",()=>{this.open=!0});b(this,"handleKeydown",t=>{if(t.key!=="Enter"||t.shiftKey)return;const r=t.currentTarget,i=r.value.trim();if(t.preventDefault(),!i)return;r.value="",v(this,it,ia).call(this,r);const s=c(this,Vs).getActiveClient();s&&s.sendMessage({text:i}).catch(o=>{console.error("ACPClient.sendMessage() failed",o)})});w(this,Ha,t=>{v(this,it,ia).call(this,t.currentTarget)});w(this,Ba,t=>{if(t.target instanceof HTMLTextAreaElement)return;const r=t.currentTarget.querySelector("textarea");r==null||r.focus()});w(this,js,t=>{if(t.shortcut!=="focusCommandInput")return;if(!this.open){this.open=!0;return}const r=this.querySelector("textarea");if(r){if(document.activeElement===r){this.open=!1;return}r.focus()}});w(this,qs,t=>{t.target instanceof Node&&(this.contains(t.target)||(this.open=!1))});w(this,Ys,t=>{t.key==="Escape"&&(this.open=!1)})}connected(){const t=new DisposableStack;E(this,li,t);const r=RO(c(this,Vs),i=>{this.messages=i});t.defer(()=>r.dispose()),c(this,Ws).addEventListener("shortcut-triggered",c(this,js)),t.defer(()=>c(this,Ws).removeEventListener("shortcut-triggered",c(this,js))),this.open&&v(this,it,mu).call(this)}disconnected(){var t;(t=c(this,li))==null||t.dispose(),E(this,li,null),v(this,it,vu).call(this)}changed(t){if(this.open?(this.removeAttribute("material"),this.removeAttribute("tone"),this.removeAttribute("level")):(this.setAttribute("material","paper"),this.setAttribute("tone","dark"),this.setAttribute("level","overlay")),Re(this.template(),this),t.has("open"))if(this.open){v(this,it,mu).call(this);const r=this.querySelector("textarea");r&&(v(this,it,ia).call(this,r),r.focus())}else v(this,it,vu).call(this)}template(){return this.open?N`
430
430
  ${this.messages.length>0?N`
431
431
  <div
432
432
  class="chat"
@@ -462,7 +462,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
462
462
  <span class="label">${this.placeholder}</span>
463
463
  <span class="kbd" aria-hidden="true">⌘K</span>
464
464
  </div>
465
- `}}Vs=new WeakMap,Ws=new WeakMap,li=new WeakMap,Ha=new WeakMap,Ba=new WeakMap,it=new WeakSet,ia=function(t){t.style.height="auto",t.style.height=`${t.scrollHeight}px`},js=new WeakMap,bu=function(){document.addEventListener("mousedown",c(this,qs)),document.addEventListener("keydown",c(this,Ys))},wu=function(){document.removeEventListener("mousedown",c(this,qs)),document.removeEventListener("keydown",c(this,Ys))},qs=new WeakMap,Ys=new WeakMap,b(yu,"properties",["placeholder","open","messages"]),b(yu,"attributes",{placeholder:{type:String},open:{type:Boolean}});customElements.define("command-panel",yu);class hb extends Event{constructor(t){super("auth-submit",{bubbles:!0,composed:!0});b(this,"token");this.token=t}}class KL extends HTMLElement{constructor(){super(...arguments);b(this,"_invalid",!1);b(this,"_tokenValue","")}set invalid(t){this._invalid=t,this.render()}get invalid(){return this._invalid}set tokenValue(t){this._tokenValue=t,this.render()}get tokenValue(){return this._tokenValue}connectedCallback(){this.render()}handleInput(t){const r=t.currentTarget;this._tokenValue=r.value}handleSubmit(t){t.preventDefault();const r=this._tokenValue.trim();r&&this.dispatchEvent(new hb(r))}render(){Re(N`
465
+ `}}Vs=new WeakMap,Ws=new WeakMap,li=new WeakMap,Ha=new WeakMap,Ba=new WeakMap,it=new WeakSet,ia=function(t){t.style.height="auto",t.style.height=`${t.scrollHeight}px`},js=new WeakMap,mu=function(){document.addEventListener("mousedown",c(this,qs)),document.addEventListener("keydown",c(this,Ys))},vu=function(){document.removeEventListener("mousedown",c(this,qs)),document.removeEventListener("keydown",c(this,Ys))},qs=new WeakMap,Ys=new WeakMap,b(gu,"properties",["placeholder","open","messages"]),b(gu,"attributes",{placeholder:{type:String},open:{type:Boolean}});customElements.define("command-panel",gu);class sb extends Event{constructor(t){super("auth-submit",{bubbles:!0,composed:!0});b(this,"token");this.token=t}}class WL extends HTMLElement{constructor(){super(...arguments);b(this,"_invalid",!1);b(this,"_tokenValue","")}set invalid(t){this._invalid=t,this.render()}get invalid(){return this._invalid}set tokenValue(t){this._tokenValue=t,this.render()}get tokenValue(){return this._tokenValue}connectedCallback(){this.render()}handleInput(t){const r=t.currentTarget;this._tokenValue=r.value}handleSubmit(t){t.preventDefault();const r=this._tokenValue.trim();r&&this.dispatchEvent(new sb(r))}render(){Re(N`
466
466
  <modal-overlay open>
467
467
  <section class="auth-modal">
468
468
  <form class="auth-form" @submit=${t=>this.handleSubmit(t)}>
@@ -483,7 +483,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
483
483
  </form>
484
484
  </section>
485
485
  </modal-overlay>
486
- `,this)}}customElements.get("auth-modal")||customElements.define("auth-modal",KL);class JL extends HTMLElement{constructor(){super(...arguments);b(this,"runtimeServerURL",Wv());b(this,"electronMode",jv());b(this,"serverManager",qe.resolve("ServerManager"));b(this,"screenManager",qe.resolve("ScreenManager"));b(this,"connectError",null);b(this,"handleServerManagerChange",()=>{this.render()});b(this,"handleActiveScreenChanged",()=>{this.render()})}connectedCallback(){this.serverManager.addEventListener("change",this.handleServerManagerChange),this.screenManager.addEventListener("active-screen-changed",this.handleActiveScreenChanged),this.addEventListener("auth-submit",t=>{var i;const r=t instanceof hb?t.token:t instanceof CustomEvent&&typeof((i=t.detail)==null?void 0:i.token)=="string"?t.detail.token:null;r&&this.handleAuthSubmit(r)}),this.initializeConnection(),this.render()}disconnectedCallback(){this.serverManager.removeEventListener("change",this.handleServerManagerChange),this.screenManager.removeEventListener("active-screen-changed",this.handleActiveScreenChanged)}async initializeConnection(){if(this.electronMode){this.serverManager.connectConfiguredServers(this.runtimeServerURL,Vc());return}if(this.serverManager.activeServer)return;const t=new Mc({url:this.runtimeServerURL,name:"Server",token:Vc()});this.serverManager.add(t),this.serverManager.setActive(t);try{await t.connect(),this.connectError=null}catch(r){this.connectError=r instanceof Error&&!(r instanceof zc)?r.message:null}this.render()}async handleAuthSubmit(t){const r=this.serverManager.activeServer;if(r){this.connectError=null,r.token=t,this.updateTokenQueryParam(t);try{await r.connect()}catch(i){i instanceof zc||(this.connectError=i instanceof Error?i.message:String(i))}this.render()}}updateTokenQueryParam(t){const r=new URL(window.location.href);r.searchParams.set("token",t),window.history.replaceState({},"",`${r.pathname}${r.search}${r.hash}`)}render(){const t=this.serverManager.activeServer,r=(t==null?void 0:t.status)??null;if(r==="connecting"){Re(N`
486
+ `,this)}}customElements.get("auth-modal")||customElements.define("auth-modal",WL);class jL extends HTMLElement{constructor(){super(...arguments);b(this,"runtimeServerURL",Fv());b(this,"electronMode",Zv());b(this,"serverManager",qe.resolve("ServerManager"));b(this,"screenManager",qe.resolve("ScreenManager"));b(this,"connectError",null);b(this,"handleServerManagerChange",()=>{this.render()});b(this,"handleActiveScreenChanged",()=>{this.render()})}connectedCallback(){this.serverManager.addEventListener("change",this.handleServerManagerChange),this.screenManager.addEventListener("active-screen-changed",this.handleActiveScreenChanged),this.addEventListener("auth-submit",t=>{var i;const r=t instanceof sb?t.token:t instanceof CustomEvent&&typeof((i=t.detail)==null?void 0:i.token)=="string"?t.detail.token:null;r&&this.handleAuthSubmit(r)}),this.initializeConnection(),this.render()}disconnectedCallback(){this.serverManager.removeEventListener("change",this.handleServerManagerChange),this.screenManager.removeEventListener("active-screen-changed",this.handleActiveScreenChanged)}async initializeConnection(){if(this.electronMode){this.serverManager.connectConfiguredServers(this.runtimeServerURL,Hc());return}if(this.serverManager.activeServer)return;const t=new Oc({url:this.runtimeServerURL,name:"Server",token:Hc()});this.serverManager.add(t),this.serverManager.setActive(t);try{await t.connect(),this.connectError=null}catch(r){this.connectError=r instanceof Error&&!(r instanceof Dc)?r.message:null}this.render()}async handleAuthSubmit(t){const r=this.serverManager.activeServer;if(r){this.connectError=null,r.token=t,this.updateTokenQueryParam(t);try{await r.connect()}catch(i){i instanceof Dc||(this.connectError=i instanceof Error?i.message:String(i))}this.render()}}updateTokenQueryParam(t){const r=new URL(window.location.href);r.searchParams.set("token",t),window.history.replaceState({},"",`${r.pathname}${r.search}${r.hash}`)}render(){const t=this.serverManager.activeServer,r=(t==null?void 0:t.status)??null;if(r==="connecting"){Re(N`
487
487
  <main class="auth-gate"><p>Connecting...</p></main>
488
488
  `,this);return}if(r==="disconnected"){const o=t;if(!o)return;Re(N`
489
489
  <main class="auth-gate">
@@ -507,4 +507,4 @@ Please report this to https://github.com/markedjs/marked.`,n){let r="<p>An error
507
507
  `:null}
508
508
  `}
509
509
  </main>
510
- `,this)}}customElements.get("television-app")||customElements.define("television-app",JL);const kh=jv(),ll=Wv(),db=new Gx(kh?"television-electron":"television-browser",Bx(ll)),pb=new NC({localStore:db,localServerURL:ll}),fb=new Fx({localStore:db,serverManager:pb}),QL=new S2({serverURL:ll,token:Vc()??"",screenManager:fb}),ez=new $2;qe.register("ServerManager",()=>pb);qe.register("ScreenManager",()=>fb);qe.register("ACPClientManager",()=>QL);qe.register("ShortcutService",()=>ez);const Eh=document.createElement("television-app");Eh.runtimeServerURL=ll;Eh.electronMode=kh;kh&&document.body.classList.add("electron");document.body.appendChild(Eh);
510
+ `,this)}}customElements.get("television-app")||customElements.define("television-app",jL);const wh=Zv(),ll=Fv(),ob=new Ux(wh?"television-electron":"television-browser",Nx(ll)),ab=new DC({localStore:ob,localServerURL:ll}),lb=new Lx({localStore:ob,serverManager:ab}),qL=new m2({serverURL:ll,token:Hc()??"",screenManager:lb}),YL=new _2;qe.register("ServerManager",()=>ab);qe.register("ScreenManager",()=>lb);qe.register("ACPClientManager",()=>qL);qe.register("ShortcutService",()=>YL);const Sh=document.createElement("television-app");Sh.runtimeServerURL=ll;Sh.electronMode=wh;wh&&document.body.classList.add("electron");document.body.appendChild(Sh);